text: 'use strict';var THREE,XRWebGLLayer,TextDecoder,performance,ImageBitmap,createImageBitmap,fetch,WeakMap,define,process,UIL,WebGL2RenderingContext,module,exports,CCapture,atob,Whammy,FFMpegServer,MediaRecorder,gc,global,OffscreenCanvas,XRDevice;(function(a,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):c(a.THREE={})})(this,function(a){function c(){}function d(b,e){this.x=b||0;this.y=e||0}function f(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function l(b,e,k,a){this._x=b||0;this._y=e||0;this._z=k||0;this._w=void 0!==a?a:1}function m(b,e,
  k){this.x=b||0;this.y=e||0;this.z=k||0}function r(){this.elements=[1,0,0,0,1,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function q(b,e,k,a,h,c,F,g,p,B){Object.defineProperty(this,"id",{value:Sh++});this.uuid=ga.generateUUID();this.name="";this.image=void 0!==b?b:q.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==e?e:q.DEFAULT_MAPPING;this.wrapS=void 0!==k?k:Qa;this.wrapT=void 0!==a?a:Qa;this.magFilter=void 0!==h?h:
  Ka;this.minFilter=void 0!==c?c:Kc;this.anisotropy=void 0!==p?p:1;this.format=void 0!==F?F:db;this.type=void 0!==g?g:Hd;this.offset=new d(0,0);this.repeat=new d(1,1);this.center=new d(0,0);this.rotation=0;this.matrixAutoUpdate=!0;this.matrix=new r;this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==B?B:Lc;this.version=0;this.onUpdate=null}function t(b,e,k,a){this.x=b||0;this.y=e||0;this.z=k||0;this.w=void 0!==a?a:1}function x(b,e,k){this.width=
  b;this.height=e;this.scissor=new t(0,0,b,e);this.scissorTest=!1;this.viewport=new t(0,0,b,e);k=k||{};void 0===k.minFilter&&(k.minFilter=Ka);this.texture=new q(void 0,void 0,k.wrapS,k.wrapT,k.magFilter,k.minFilter,k.format,k.type,k.anisotropy,k.encoding);this.texture.generateMipmaps=void 0!==k.generateMipmaps?k.generateMipmaps:!0;this.depthBuffer=void 0!==k.depthBuffer?k.depthBuffer:!0;this.stencilBuffer=void 0!==k.stencilBuffer?k.stencilBuffer:!0;this.depthTexture=void 0!==k.depthTexture?k.depthTexture:
  null}function v(b,e,k){x.call(this,b,e,k);this.activeMipMapLevel=this.activeCubeFace=0}function A(b,e,k,a,h,c,F,g,d,B,va,U){q.call(this,null,c,F,g,d,B,a,h,va,U);this.image={data:b,width:e,height:k};this.magFilter=void 0!==d?d:La;this.minFilter=void 0!==B?B:La;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}function I(b,e){this.min=void 0!==b?b:new m(Infinity,Infinity,Infinity);this.max=void 0!==e?e:new m(-Infinity,-Infinity,-Infinity)}function C(b,e){this.center=void 0!==b?b:new m;this.radius=
  void 0!==e?e:0}function u(b,e){this.normal=void 0!==b?b:new m(1,0,0);this.constant=void 0!==e?e:0}function K(b,e,k,a,h,c){this.planes=[void 0!==b?b:new u,void 0!==e?e:new u,void 0!==k?k:new u,void 0!==a?a:new u,void 0!==h?h:new u,void 0!==c?c:new u]}function w(b,e,k){return void 0===e&&void 0===k?this.set(b):this.setRGB(b,e,k)}function W(){function b(h,c){!1!==k&&(a(h,c),e.requestAnimationFrame(b))}var e=null,k=!1,a=null;return{start:function(){!0!==k&&null!==a&&(e.requestAnimationFrame(b),k=!0)},
  stop:function(){k=!1},setAnimationLoop:function(b){a=b},setContext:function(b){e=b}}}function Q(b){function e(e,k){var a=e.array,c=e.dynamic?b.DYNAMIC_DRAW:b.STATIC_DRAW,g=b.createBuffer();b.bindBuffer(k,g);b.bufferData(k,a,c);e.onUploadCallback();c=b.FLOAT;a instanceof Float32Array?c=b.FLOAT:a instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):a instanceof Uint16Array?c=b.UNSIGNED_SHORT:a instanceof Int16Array?c=b.SHORT:a instanceof Uint32Array?
  c=b.UNSIGNED_INT:a instanceof Int32Array?c=b.INT:a instanceof Int8Array?c=b.BYTE:a instanceof Uint8Array&&(c=b.UNSIGNED_BYTE);return{buffer:g,type:c,bytesPerElement:a.BYTES_PER_ELEMENT,version:e.version}}var k=new WeakMap;return{get:function(b){b.isInterleavedBufferAttribute&&(b=b.data);return k.get(b)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var a=k.get(e);a&&(b.deleteBuffer(a.buffer),k.delete(e))},update:function(a,h){a.isInterleavedBufferAttribute&&(a=a.data);var c=k.get(a);
  if(void 0===c)k.set(a,e(a,h));else if(c.version<a.version){var F=a,g=F.array,d=F.updateRange;b.bindBuffer(h,c.buffer);!1===F.dynamic?b.bufferData(h,g,b.STATIC_DRAW):-1===d.count?b.bufferSubData(h,0,g):0===d.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(b.bufferSubData(h,d.offset*g.BYTES_PER_ELEMENT,g.subarray(d.offset,d.offset+d.count)),d.count=-1);c.version=
  a.version}}}}function H(b,e,k,a,h,c){this.a=b;this.b=e;this.c=k;this.normal=a&&a.isVector3?a:new m;this.vertexNormals=Array.isArray(a)?a:[];this.color=h&&h.isColor?h:new w;this.vertexColors=Array.isArray(h)?h:[];this.materialIndex=void 0!==c?c:0}function J(b,e,k,a){this._x=b||0;this._y=e||0;this._z=k||0;this._order=a||J.DefaultOrder}function y(){this.mask=1}function D(){Object.defineProperty(this,"id",{value:Th++});this.uuid=ga.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=
  [];this.up=D.DefaultUp.clone();var b=new m,e=new J,k=new l,a=new m(1,1,1);e.onChange(function(){k.setFromEuler(e,!1)});k.onChange(function(){e.setFromQuaternion(k,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,value:b},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:k},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new f},normalMatrix:{value:new r}});this.matrix=new f;this.matrixWorld=new f;this.matrixAutoUpdate=D.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=
  !1;this.layers=new y;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={}}function g(){Object.defineProperty(this,"id",{value:Jf+=2});this.uuid=ga.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=
  this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function n(b,e,k){if(Array.isArray(b))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="";this.array=b;this.itemSize=e;this.count=void 0!==b?b.length/e:0;this.normalized=!0===k;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function s(b,e,k){n.call(this,new Int8Array(b),e,k)}function S(b,e,k){n.call(this,new Uint8Array(b),e,k)}
  function V(b,e,k){n.call(this,new Uint8ClampedArray(b),e,k)}function da(b,e,k){n.call(this,new Int16Array(b),e,k)}function ea(b,e,k){n.call(this,new Uint16Array(b),e,k)}function ba(b,e,k){n.call(this,new Int32Array(b),e,k)}function ha(b,e,k){n.call(this,new Uint32Array(b),e,k)}function N(b,e,k){n.call(this,new Float32Array(b),e,k)}function fa(b,e,k){n.call(this,new Float64Array(b),e,k)}function ma(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets=
  {};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function ia(b){if(0===b.length)return-Infinity;for(var e=b[0],k=1,a=b.length;k<a;++k)b[k]>e&&(e=b[k]);return e}function M(){Object.defineProperty(this,"id",{value:Kf+=2});this.uuid=ga.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=
  [];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function la(b,e,k,a,h,c){g.call(this);this.type="BoxGeometry";this.parameters={width:b,height:e,depth:k,widthSegments:a,heightSegments:h,depthSegments:c};this.fromBufferGeometry(new G(b,e,k,a,h,c));this.mergeVertices()}function G(b,e,k,a,h,c){function F(b,e,k,a,E,h,c,L,F,l,q){var s=h/F,r=c/l,t=h/2,u=c/2,w=L/2;c=F+1;var v=l+1,G=h=0,A,S,x=new m;for(S=0;S<v;S++){var K=S*r-u;for(A=0;A<c;A++)x[b]=(A*s-
  t)*a,x[e]=K*E,x[k]=w,B.push(x.x,x.y,x.z),x[b]=0,x[e]=0,x[k]=0<L?1:-1,va.push(x.x,x.y,x.z),U.push(A/F),U.push(1-S/l),h+=1}for(S=0;S<l;S++)for(A=0;A<F;A++)b=n+A+c*(S+1),e=n+(A+1)+c*(S+1),k=n+(A+1)+c*S,d.push(n+A+c*S,b,k),d.push(b,e,k),G+=6;g.addGroup(f,G,q);f+=G;n+=h}M.call(this);this.type="BoxBufferGeometry";this.parameters={width:b,height:e,depth:k,widthSegments:a,heightSegments:h,depthSegments:c};var g=this;b=b||1;e=e||1;k=k||1;a=Math.floor(a)||1;h=Math.floor(h)||1;c=Math.floor(c)||1;var d=[],B=
  [],va=[],U=[],n=0,f=0;F("z","y","x",-1,-1,k,e,b,c,h,0);F("z","y","x",1,-1,k,e,-b,c,h,1);F("x","z","y",1,1,b,k,e,a,c,2);F("x","z","y",1,-1,b,k,-e,a,c,3);F("x","y","z",1,-1,b,e,k,a,h,4);F("x","y","z",-1,-1,b,e,-k,a,h,5);this.setIndex(d);this.addAttribute("position",new N(B,3));this.addAttribute("normal",new N(va,3));this.addAttribute("uv",new N(U,2))}function ja(b,e,k,a){g.call(this);this.type="PlaneGeometry";this.parameters={width:b,height:e,widthSegments:k,heightSegments:a};this.fromBufferGeometry(new oa(b,
  e,k,a));this.mergeVertices()}function oa(b,e,k,a){M.call(this);this.type="PlaneBufferGeometry";this.parameters={width:b,height:e,widthSegments:k,heightSegments:a};b=b||1;e=e||1;var h=b/2,c=e/2;k=Math.floor(k)||1;a=Math.floor(a)||1;var F=k+1,g=a+1,d=b/k,B=e/a,va=[],U=[],n=[],f=[];for(b=0;b<g;b++){var m=b*B-c;for(e=0;e<F;e++)U.push(e*d-h,-m,0),n.push(0,0,1),f.push(e/k),f.push(1-b/a)}for(b=0;b<a;b++)for(e=0;e<k;e++)h=e+F*(b+1),c=e+1+F*(b+1),g=e+1+F*b,va.push(e+F*b,h,g),va.push(h,c,g);this.setIndex(va);
  this.addAttribute("position",new N(U,3));this.addAttribute("normal",new N(n,3));this.addAttribute("uv",new N(f,2))}function T(){Object.defineProperty(this,"id",{value:Uh++});this.uuid=ga.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=zb;this.side=Xb;this.flatShading=!1;this.vertexColors=ze;this.opacity=1;this.transparent=!1;this.blendSrc=Ae;this.blendDst=Be;this.blendEquation=Yb;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=
  Id;this.depthWrite=this.depthTest=!0;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.overdraw=0;this.visible=!0;this.userData={};this.needsUpdate=!0}function pa(b){T.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";
  this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!1;this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;this.uniformsNeedUpdate=!1;void 0!==b&&(void 0!==b.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),
  this.setValues(b))}function fb(b,e){this.origin=void 0!==b?b:new m;this.direction=void 0!==e?e:new m}function sa(b,e,k){this.a=void 0!==b?b:new m;this.b=void 0!==e?e:new m;this.c=void 0!==k?k:new m}function Ba(b){T.call(this);this.type="MeshBasicMaterial";this.color=new w(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=Mc;this.reflectivity=1;this.refractionRatio=0.98;this.wireframe=!1;
  this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(b)}function wa(b,e){D.call(this);this.type="Mesh";this.geometry=void 0!==b?b:new M;this.material=void 0!==e?e:new Ba({color:16777215*Math.random()});this.drawMode=Ce;this.updateMorphTargets()}function De(b,e,k,a){function h(b,k){e.buffers.color.setClear(b.r,b.g,b.b,k,a)}var c=new w(0),F=0,g,d;return{getClearColor:function(){return c},setClearColor:function(b,
  e){c.set(b);F=void 0!==e?e:1;h(c,F)},getClearAlpha:function(){return F},setClearAlpha:function(b){F=b;h(c,F)},render:function(e,a,E,n){a=a.background;null===a?h(c,F):a&&a.isColor&&(h(a,1),n=!0);(b.autoClear||n)&&b.clear(b.autoClearColor,b.autoClearDepth,b.autoClearStencil);a&&a.isCubeTexture?(void 0===d&&(d=new wa(new G(1,1,1),new pa({uniforms:Ha.clone(gb.cube.uniforms),vertexShader:gb.cube.vertexShader,fragmentShader:gb.cube.fragmentShader,side:Oa,depthTest:!0,depthWrite:!1,fog:!1})),d.geometry.removeAttribute("normal"),
  d.geometry.removeAttribute("uv"),d.onBeforeRender=function(b,e,k){this.matrixWorld.copyPosition(k.matrixWorld)},k.update(d)),d.material.uniforms.tCube.value=a,e.push(d,d.geometry,d.material,0,null)):a&&a.isTexture&&(void 0===g&&(g=new wa(new oa(2,2),new pa({uniforms:Ha.clone(gb.background.uniforms),vertexShader:gb.background.vertexShader,fragmentShader:gb.background.fragmentShader,side:Xb,depthTest:!0,depthWrite:!1,fog:!1})),g.geometry.removeAttribute("normal"),k.update(g)),g.material.uniforms.t2D.value=
  a,e.push(g,g.geometry,g.material,0,null))}}}function Ee(b,e,k,a){var h;this.setMode=function(b){h=b};this.render=function(e,a){b.drawArrays(h,e,a);k.update(a,h)};this.renderInstances=function(c,F,g){var d;if(a.isWebGL2)d=b;else if(d=e.get("ANGLE_instanced_arrays"),null===d){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[a.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](h,F,g,c.maxInstancedCount);
  k.update(g,h,c.maxInstancedCount)}}function Fe(b,e,k){function a(e){if("highp"===e){if(0<b.getShaderPrecisionFormat(b.VERTEX_SHADER,b.HIGH_FLOAT).precision&&0<b.getShaderPrecisionFormat(b.FRAGMENT_SHADER,b.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<b.getShaderPrecisionFormat(b.VERTEX_SHADER,b.MEDIUM_FLOAT).precision&&0<b.getShaderPrecisionFormat(b.FRAGMENT_SHADER,b.MEDIUM_FLOAT).precision?"mediump":"lowp"}var h,c="undefined"!==typeof WebGL2RenderingContext&&b instanceof
  WebGL2RenderingContext,F=void 0!==k.precision?k.precision:"highp",g=a(F);g!==F&&(console.warn("THREE.WebGLRenderer:",F,"not supported, using",g,"instead."),F=g);k=!0===k.logarithmicDepthBuffer;var g=b.getParameter(b.MAX_TEXTURE_IMAGE_UNITS),d=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS),B=b.getParameter(b.MAX_TEXTURE_SIZE),va=b.getParameter(b.MAX_CUBE_MAP_TEXTURE_SIZE),U=b.getParameter(b.MAX_VERTEX_ATTRIBS),n=b.getParameter(b.MAX_VERTEX_UNIFORM_VECTORS),f=b.getParameter(b.MAX_VARYING_VECTORS),
  m=b.getParameter(b.MAX_FRAGMENT_UNIFORM_VECTORS),l=0<d,q=c||!!e.get("OES_texture_float");return{isWebGL2:c,getMaxAnisotropy:function(){if(void 0!==h)return h;var k=e.get("EXT_texture_filter_anisotropic");return h=null!==k?b.getParameter(k.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:a,precision:F,logarithmicDepthBuffer:k,maxTextures:g,maxVertexTextures:d,maxTextureSize:B,maxCubemapSize:va,maxAttributes:U,maxVertexUniforms:n,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:l,floatFragmentTextures:q,
  floatVertexTextures:l&&q}}function Ge(){function b(){B.value!==a&&(B.value=a,B.needsUpdate=0<h);k.numPlanes=h;k.numIntersection=0}function e(b,e,a,E){var h=null!==b?b.length:0,c=null;if(0!==h){c=B.value;if(!0!==E||null===c){E=a+4*h;e=e.matrixWorldInverse;d.getNormalMatrix(e);if(null===c||c.length<E)c=new Float32Array(E);for(E=0;E!==h;++E,a+=4)g.copy(b[E]).applyMatrix4(e,d),g.normal.toArray(c,a),c[a+3]=g.constant}B.value=c;B.needsUpdate=!0}k.numPlanes=h;return c}var k=this,a=null,h=0,c=!1,F=!1,g=new u,
  d=new r,B={value:null,needsUpdate:!1};this.uniform=B;this.numIntersection=this.numPlanes=0;this.init=function(b,k,F){var g=0!==b.length||k||0!==h||c;c=k;a=e(b,F,0);h=b.length;return g};this.beginShadows=function(){F=!0;e(null)};this.endShadows=function(){F=!1;b()};this.setState=function(k,g,d,P,p,n){if(!c||null===k||0===k.length||F&&!d)F?e(null):b();else{d=F?0:h;var f=4*d,m=p.clippingState||null;B.value=m;m=e(k,P,f,n);for(k=0;k!==f;++k)m[k]=a[k];p.clippingState=m;this.numIntersection=g?this.numPlanes:
  0;this.numPlanes+=d}}}function He(b){var e={};return{get:function(k){if(void 0!==e[k])return e[k];var a;switch(k){case "WEBGL_depth_texture":a=b.getExtension("WEBGL_depth_texture")||b.getExtension("MOZ_WEBGL_depth_texture")||b.getExtension("WEBKIT_WEBGL_depth_texture");break;case "EXT_texture_filter_anisotropic":a=b.getExtension("EXT_texture_filter_anisotropic")||b.getExtension("MOZ_EXT_texture_filter_anisotropic")||b.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":a=
  b.getExtension("WEBGL_compressed_texture_s3tc")||b.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||b.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case "WEBGL_compressed_texture_pvrtc":a=b.getExtension("WEBGL_compressed_texture_pvrtc")||b.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=b.getExtension(k)}null===a&&console.warn("THREE.WebGLRenderer: "+k+" extension not supported.");return e[k]=a}}}function Jd(b,e,k){function a(b){var g=b.target;b=h[g.id];null!==
  b.index&&e.remove(b.index);for(var d in b.attributes)e.remove(b.attributes[d]);g.removeEventListener("dispose",a);delete h[g.id];if(d=c[b.id])e.remove(d),delete c[b.id];k.memory.geometries--}var h={},c={};return{get:function(b,e){var c=h[e.id];if(c)return c;e.addEventListener("dispose",a);e.isBufferGeometry?c=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new M).setFromObject(b)),c=e._bufferGeometry);h[e.id]=c;k.memory.geometries++;return c},update:function(k){var a=k.index,E=k.attributes;
  null!==a&&e.update(a,b.ELEMENT_ARRAY_BUFFER);for(var h in E)e.update(E[h],b.ARRAY_BUFFER);k=k.morphAttributes;for(h in k)for(var a=k[h],E=0,c=a.length;E<c;E++)e.update(a[E],b.ARRAY_BUFFER)},getWireframeAttribute:function(k){var a=c[k.id];if(a)return a;var a=[],E=k.index,h=k.attributes;if(null!==E)for(var E=E.array,h=0,g=E.length;h<g;h+=3){var d=E[h+0],n=E[h+1],f=E[h+2];a.push(d,n,n,f,f,d)}else for(E=h.position.array,h=0,g=E.length/3-1;h<g;h+=3)d=h+0,n=h+1,f=h+2,a.push(d,n,n,f,f,d);a=new (65535<ia(a)?
  ha:ea)(a,1);e.update(a,b.ELEMENT_ARRAY_BUFFER);return c[k.id]=a}}}function Vh(b,e,k,a){var h,c,g;this.setMode=function(b){h=b};this.setIndex=function(b){c=b.type;g=b.bytesPerElement};this.render=function(e,a){b.drawElements(h,a,c,e*g);k.update(a,h)};this.renderInstances=function(d,p,B){var n;if(a.isWebGL2)n=b;else if(n=e.get("ANGLE_instanced_arrays"),null===n){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
  return}n[a.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](h,B,c,p*g,d.maxInstancedCount);k.update(B,h,d.maxInstancedCount)}}function Wh(b){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++;e.calls=0;e.triangles=0;e.points=0;e.lines=0},update:function(k,a,h){h=h||1;e.calls++;switch(a){case b.TRIANGLES:e.triangles+=k/3*h;break;case b.TRIANGLE_STRIP:case b.TRIANGLE_FAN:e.triangles+=
  h*(k-2);break;case b.LINES:e.lines+=k/2*h;break;case b.LINE_STRIP:e.lines+=h*(k-1);break;case b.LINE_LOOP:e.lines+=h*k;break;case b.POINTS:e.points+=h*k;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a)}}}}function Ta(b,e){return Math.abs(e[1])-Math.abs(b[1])}function Xh(b){var e={},k=new Float32Array(8);return{update:function(a,h,c,g){var d=a.morphTargetInfluences,p=d.length;a=e[h.id];if(void 0===a){a=[];for(var B=0;B<p;B++)a[B]=[B,0];e[h.id]=a}var n=c.morphTargets&&h.morphAttributes.position;
  c=c.morphNormals&&h.morphAttributes.normal;for(B=0;B<p;B++){var U=a[B];0!==U[1]&&(n&&h.removeAttribute("morphTarget"+B),c&&h.removeAttribute("morphNormal"+B))}for(B=0;B<p;B++)U=a[B],U[0]=B,U[1]=d[B];a.sort(Ta);for(B=0;8>B;B++){if(U=a[B])if(d=U[0],p=U[1]){n&&h.addAttribute("morphTarget"+B,n[d]);c&&h.addAttribute("morphNormal"+B,c[d]);k[B]=p;continue}k[B]=0}g.getUniforms().setValue(b,"morphTargetInfluences",k)}}}function Yh(b,e){var k={};return{update:function(a){var h=e.render.frame,c=a.geometry,g=
  b.get(a,c);k[g.id]!==h&&(c.isGeometry&&g.updateFromObject(a),b.update(g),k[g.id]=h);return g},dispose:function(){k={}}}}function mb(b,e,k,a,h,c,g,d,p,B){b=void 0!==b?b:[];e=void 0!==e?e:Kd;q.call(this,b,e,k,a,h,c,g,d,p,B);this.flipY=!1}function Zb(b,e,k,a){q.call(this,null);this.image={data:b,width:e,height:k,depth:a};this.minFilter=this.magFilter=La;this.flipY=this.generateMipmaps=!1}function $b(b,e,k){var a=b[0];if(0>=a||0<a)return b;var h=e*k,c=Lf[h];void 0===c&&(c=new Float32Array(h),Lf[h]=c);
  if(0!==e)for(a.toArray(c,0),a=1,h=0;a!==e;++a)h+=k,b[a].toArray(c,h);return c}function ta(b,e){if(b.length!==e.length)return!1;for(var k=0,a=b.length;k<a;k++)if(b[k]!==e[k])return!1;return!0}function Da(b,e){for(var k=0,a=e.length;k<a;k++)b[k]=e[k]}function Mf(b,e){var k=Nf[e];void 0===k&&(k=new Int32Array(e),Nf[e]=k);for(var a=0;a!==e;++a)k[a]=b.allocTextureUnit();return k}function Zh(b,e){var k=this.cache;k[0]!==e&&(b.uniform1f(this.addr,e),k[0]=e)}function $h(b,e){var k=this.cache;k[0]!==e&&(b.uniform1i(this.addr,
  e),k[0]=e)}function ai(b,e){var k=this.cache;if(void 0!==e.x){if(k[0]!==e.x||k[1]!==e.y)b.uniform2f(this.addr,e.x,e.y),k[0]=e.x,k[1]=e.y}else ta(k,e)||(b.uniform2fv(this.addr,e),Da(k,e))}function bi(b,e){var k=this.cache;if(void 0!==e.x){if(k[0]!==e.x||k[1]!==e.y||k[2]!==e.z)b.uniform3f(this.addr,e.x,e.y,e.z),k[0]=e.x,k[1]=e.y,k[2]=e.z}else if(void 0!==e.r){if(k[0]!==e.r||k[1]!==e.g||k[2]!==e.b)b.uniform3f(this.addr,e.r,e.g,e.b),k[0]=e.r,k[1]=e.g,k[2]=e.b}else ta(k,e)||(b.uniform3fv(this.addr,e),
  Da(k,e))}function ci(b,e){var k=this.cache;if(void 0!==e.x){if(k[0]!==e.x||k[1]!==e.y||k[2]!==e.z||k[3]!==e.w)b.uniform4f(this.addr,e.x,e.y,e.z,e.w),k[0]=e.x,k[1]=e.y,k[2]=e.z,k[3]=e.w}else ta(k,e)||(b.uniform4fv(this.addr,e),Da(k,e))}function di(b,e){var k=this.cache,a=e.elements;void 0===a?ta(k,e)||(b.uniformMatrix2fv(this.addr,!1,e),Da(k,e)):ta(k,a)||(Of.set(a),b.uniformMatrix2fv(this.addr,!1,Of),Da(k,a))}function ei(b,e){var k=this.cache,a=e.elements;void 0===a?ta(k,e)||(b.uniformMatrix3fv(this.addr,
  !1,e),Da(k,e)):ta(k,a)||(Pf.set(a),b.uniformMatrix3fv(this.addr,!1,Pf),Da(k,a))}function fi(b,e){var k=this.cache,a=e.elements;void 0===a?ta(k,e)||(b.uniformMatrix4fv(this.addr,!1,e),Da(k,e)):ta(k,a)||(Qf.set(a),b.uniformMatrix4fv(this.addr,!1,Qf),Da(k,a))}function gi(b,e,k){var a=this.cache,h=k.allocTextureUnit();a[0]!==h&&(b.uniform1i(this.addr,h),a[0]=h);k.setTexture2D(e||Rf,h)}function hi(b,e,k){var a=this.cache,h=k.allocTextureUnit();a[0]!==h&&(b.uniform1i(this.addr,h),a[0]=h);k.setTexture3D(e||
  ii,h)}function ji(b,e,k){var a=this.cache,h=k.allocTextureUnit();a[0]!==h&&(b.uniform1i(this.addr,h),a[0]=h);k.setTextureCube(e||Sf,h)}function Tf(b,e){var k=this.cache;ta(k,e)||(b.uniform2iv(this.addr,e),Da(k,e))}function Uf(b,e){var k=this.cache;ta(k,e)||(b.uniform3iv(this.addr,e),Da(k,e))}function Vf(b,e){var k=this.cache;ta(k,e)||(b.uniform4iv(this.addr,e),Da(k,e))}function ki(b){switch(b){case 5126:return Zh;case 35664:return ai;case 35665:return bi;case 35666:return ci;case 35674:return di;
  case 35675:return ei;case 35676:return fi;case 35678:case 36198:return gi;case 35679:return hi;case 35680:return ji;case 5124:case 35670:return $h;case 35667:case 35671:return Tf;case 35668:case 35672:return Uf;case 35669:case 35673:return Vf}}function li(b,e){var k=this.cache;ta(k,e)||(b.uniform1fv(this.addr,e),Da(k,e))}function mi(b,e){var k=this.cache;ta(k,e)||(b.uniform1iv(this.addr,e),Da(k,e))}function ni(b,e){var k=this.cache,a=$b(e,this.size,2);ta(k,a)||(b.uniform2fv(this.addr,a),this.updateCache(a))}
  function oi(b,e){var k=this.cache,a=$b(e,this.size,3);ta(k,a)||(b.uniform3fv(this.addr,a),this.updateCache(a))}function pi(b,e){var k=this.cache,a=$b(e,this.size,4);ta(k,a)||(b.uniform4fv(this.addr,a),this.updateCache(a))}function qi(b,e){var k=this.cache,a=$b(e,this.size,4);ta(k,a)||(b.uniformMatrix2fv(this.addr,!1,a),this.updateCache(a))}function ri(b,e){var k=this.cache,a=$b(e,this.size,9);ta(k,a)||(b.uniformMatrix3fv(this.addr,!1,a),this.updateCache(a))}function si(b,e){var k=this.cache,a=$b(e,
  this.size,16);ta(k,a)||(b.uniformMatrix4fv(this.addr,!1,a),this.updateCache(a))}function ti(b,e,k){var a=this.cache,h=e.length,c=Mf(k,h);!1===ta(a,c)&&(b.uniform1iv(this.addr,c),Da(a,c));for(b=0;b!==h;++b)k.setTexture2D(e[b]||Rf,c[b])}function ui(b,e,k){var a=this.cache,h=e.length,c=Mf(k,h);!1===ta(a,c)&&(b.uniform1iv(this.addr,c),Da(a,c));for(b=0;b!==h;++b)k.setTextureCube(e[b]||Sf,c[b])}function vi(b){switch(b){case 5126:return li;case 35664:return ni;case 35665:return oi;case 35666:return pi;case 35674:return qi;
  case 35675:return ri;case 35676:return si;case 35678:return ti;case 35680:return ui;case 5124:case 35670:return mi;case 35667:case 35671:return Tf;case 35668:case 35672:return Uf;case 35669:case 35673:return Vf}}function wi(b,e,k){this.id=b;this.addr=k;this.cache=[];this.setValue=ki(e.type)}function Wf(b,e,k){this.id=b;this.addr=k;this.cache=[];this.size=e.size;this.setValue=vi(e.type)}function Xf(b){this.id=b;this.seq=[];this.map={}}function sb(b,e,k){this.seq=[];this.map={};this.renderer=k;k=b.getProgramParameter(e,
  b.ACTIVE_UNIFORMS);for(var a=0;a<k;++a){var h=b.getActiveUniform(e,a),c=b.getUniformLocation(e,h.name),g=this,d=h.name,p=d.length;for(Ie.lastIndex=0;;){var B=Ie.exec(d),n=Ie.lastIndex,U=B[1],f=B[3];"]"===B[2]&&(U|=0);if(void 0===f||"["===f&&n+2===p){d=g;h=void 0===f?new wi(U,h,c):new Wf(U,h,c);d.seq.push(h);d.map[h.id]=h;break}else f=g.map[U],void 0===f&&(f=new Xf(U),U=g,g=f,U.seq.push(g),U.map[g.id]=g),g=f}}}function xi(b){b=b.split("\n");for(var e=0;e<b.length;e++)b[e]=e+1+": "+b[e];return b.join("\n")}
  function Yf(b,e,k){var a=b.createShader(e);b.shaderSource(a,k);b.compileShader(a);!1===b.getShaderParameter(a,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(a)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===b.VERTEX_SHADER?"vertex":"fragment",b.getShaderInfoLog(a),xi(k));return a}function Zf(b){switch(b){case Lc:return["Linear","( value )"];case $f:return["sRGB","( value )"];case ag:return["RGBE","( value )"];case bg:return["RGBM",
  "( value, 7.0 )"];case cg:return["RGBM","( value, 16.0 )"];case dg:return["RGBD","( value, 256.0 )"];case Je:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+b);}}function Ld(b,e){var k=Zf(e);return"vec4 "+b+"( vec4 value ) { return "+k[0]+"ToLinear"+k[1]+"; }"}function yi(b,e){var k=Zf(e);return"vec4 "+b+"( vec4 value ) { return LinearTo"+k[0]+k[1]+"; }"}function zi(b,e){var k;switch(e){case Ke:k="Linear";break;case eg:k="Reinhard";break;case fg:k="Uncharted2";
  break;case gg:k="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+e);}return"vec3 "+b+"( vec3 color ) { return "+k+"ToneMapping( color ); }"}function Ai(b,e,k){b=b||{};return[b.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap&&!e.objectSpaceNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(b.fragDepth||e.logarithmicDepthBuffer)&&k.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",b.drawBuffers&&k.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":
  "",(b.shaderTextureLOD||e.envMap)&&k.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Nc).join("\n")}function Bi(b){var e=[],k;for(k in b){var a=b[k];!1!==a&&e.push("#define "+k+" "+a)}return e.join("\n")}function Nc(b){return""!==b}function hg(b,e){return b.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,
  e.numHemiLights)}function ig(b,e){return b.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function Le(b){return b.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(b,k){var a=ca[k];if(void 0===a)throw Error("Can not resolve #include <"+k+">");return Le(a)})}function jg(b){return b.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(b,k,a,h){b="";for(k=parseInt(k);k<
  parseInt(a);k++)b+=h.replace(/\[ i \]/g,"[ "+k+" ]");return b})}function Ci(b,e,k,a,h,c,g){var d=b.context,p=a.defines,B=h.vertexShader,n=h.fragmentShader,U="SHADOWMAP_TYPE_BASIC";c.shadowMapType===Me?U="SHADOWMAP_TYPE_PCF":c.shadowMapType===kg&&(U="SHADOWMAP_TYPE_PCF_SOFT");var f="ENVMAP_TYPE_CUBE",m="ENVMAP_MODE_REFLECTION",l="ENVMAP_BLENDING_MULTIPLY";if(c.envMap){switch(a.envMap.mapping){case Kd:case Md:f="ENVMAP_TYPE_CUBE";break;case Nd:case Od:f="ENVMAP_TYPE_CUBE_UV";break;case Ne:case Pd:f=
  "ENVMAP_TYPE_EQUIREC";break;case Oe:f="ENVMAP_TYPE_SPHERE"}switch(a.envMap.mapping){case Md:case Pd:m="ENVMAP_MODE_REFRACTION"}switch(a.combine){case Mc:l="ENVMAP_BLENDING_MULTIPLY";break;case lg:l="ENVMAP_BLENDING_MIX";break;case mg:l="ENVMAP_BLENDING_ADD"}}var q=0<b.gammaFactor?b.gammaFactor:1,s=g.isWebGL2?"":Ai(a.extensions,c,e),r=Bi(p),z=d.createProgram();a.isRawShaderMaterial?(p=[r].filter(Nc).join("\n"),0<p.length&&(p+="\n"),e=[s,r].filter(Nc).join("\n"),0<e.length&&(e+="\n")):(p=["precision "+
  c.precision+" float;","precision "+c.precision+" int;","#define SHADER_NAME "+h.name,r,c.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+q,"#define MAX_BONES "+c.maxBones,c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+m:"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.bumpMap?"#define USE_BUMPMAP":
  "",c.normalMap?"#define USE_NORMALMAP":"",c.normalMap&&c.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",c.displacementMap&&c.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.roughnessMap?"#define USE_ROUGHNESSMAP":"",c.metalnessMap?"#define USE_METALNESSMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.vertexColors?"#define USE_COLOR":"",c.flatShading?"#define FLAT_SHADED":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":
  "",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals&&!1===c.flatShading?"#define USE_MORPHNORMALS":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+U:"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"",c.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",c.logarithmicDepthBuffer&&(g.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;",
  "uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;",
  "\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Nc).join("\n"),e=[s,"precision "+c.precision+" float;","precision "+c.precision+" int;","#define SHADER_NAME "+h.name,r,c.alphaTest?"#define ALPHATEST "+c.alphaTest+
  (c.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+q,c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+f:"",c.envMap?"#define "+m:"",c.envMap?"#define "+l:"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.normalMap&&c.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":
  "",c.specularMap?"#define USE_SPECULARMAP":"",c.roughnessMap?"#define USE_ROUGHNESSMAP":"",c.metalnessMap?"#define USE_METALNESSMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.vertexColors?"#define USE_COLOR":"",c.gradientMap?"#define USE_GRADIENTMAP":"",c.flatShading?"#define FLAT_SHADED":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+U:"",c.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":
  "",c.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",c.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",c.logarithmicDepthBuffer&&(g.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",c.envMap&&(g.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",c.toneMapping!==Qd?"#define TONE_MAPPING":"",c.toneMapping!==Qd?ca.tonemapping_pars_fragment:"",c.toneMapping!==Qd?zi("toneMapping",c.toneMapping):
  "",c.dithering?"#define DITHERING":"",c.outputEncoding||c.mapEncoding||c.matcapEncoding||c.envMapEncoding||c.emissiveMapEncoding?ca.encodings_pars_fragment:"",c.mapEncoding?Ld("mapTexelToLinear",c.mapEncoding):"",c.matcapEncoding?Ld("matcapTexelToLinear",c.matcapEncoding):"",c.envMapEncoding?Ld("envMapTexelToLinear",c.envMapEncoding):"",c.emissiveMapEncoding?Ld("emissiveMapTexelToLinear",c.emissiveMapEncoding):"",c.outputEncoding?yi("linearToOutputTexel",c.outputEncoding):"",c.depthPacking?"#define DEPTH_PACKING "+
  a.depthPacking:"","\n"].filter(Nc).join("\n"));B=Le(B);B=hg(B,c);B=ig(B,c);n=Le(n);n=hg(n,c);n=ig(n,c);B=jg(B);n=jg(n);g.isWebGL2&&!a.isRawShaderMaterial&&(g=!1,U=/^\s*#version\s+300\s+es\s*\n/,a.isShaderMaterial&&null!==B.match(U)&&null!==n.match(U)&&(g=!0,B=B.replace(U,""),n=n.replace(U,"")),p="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+p,e=["#version 300 es\n\n#define varying in",g?"":"out highp vec4 pc_fragColor;",g?"":"#define gl_FragColor pc_fragColor",
  "#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+e);n=e+n;B=Yf(d,d.VERTEX_SHADER,p+B);n=Yf(d,d.FRAGMENT_SHADER,n);d.attachShader(z,B);d.attachShader(z,n);void 0!==
  a.index0AttributeName?d.bindAttribLocation(z,0,a.index0AttributeName):!0===c.morphTargets&&d.bindAttribLocation(z,0,"position");d.linkProgram(z);c=d.getProgramInfoLog(z).trim();g=d.getShaderInfoLog(B).trim();U=d.getShaderInfoLog(n).trim();m=f=!0;if(!1===d.getProgramParameter(z,d.LINK_STATUS))f=!1,console.error("THREE.WebGLProgram: shader error: ",d.getError(),"gl.VALIDATE_STATUS",d.getProgramParameter(z,d.VALIDATE_STATUS),"gl.getProgramInfoLog",c,g,U);else if(""!==c)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",
  c);else if(""===g||""===U)m=!1;m&&(this.diagnostics={runnable:f,material:a,programLog:c,vertexShader:{log:g,prefix:p},fragmentShader:{log:U,prefix:e}});d.deleteShader(B);d.deleteShader(n);var t;this.getUniforms=function(){void 0===t&&(t=new sb(d,z,b));return t};var u;this.getAttributes=function(){if(void 0===u){for(var b={},e=d.getProgramParameter(z,d.ACTIVE_ATTRIBUTES),k=0;k<e;k++){var a=d.getActiveAttrib(z,k).name;b[a]=d.getAttribLocation(z,a)}u=b}return u};this.destroy=function(){d.deleteProgram(z);
  this.program=void 0};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});this.name=h.name;this.id=Di++;this.code=k;this.usedTimes=1;this.program=z;this.vertexShader=B;this.fragmentShader=n;return this}function Ei(b,e,k){function a(b,e){var k;b?b.isTexture?k=b.encoding:
  b.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),k=b.texture.encoding):k=Lc;k===Lc&&e&&(k=Je);return k}var h=[],c={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",
  LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g="precision supportsVertexTextures map mapEncoding matcapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap objectSpaceNormalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering".split(" ");
  this.getParameters=function(e,h,g,d,F,n,f){var m=c[e.type],l;if(f.isSkinnedMesh)if(l=f.skeleton.bones,k.floatVertexTextures)l=1024;else{var q=Math.min(Math.floor((k.maxVertexUniforms-20)/4),l.length);q<l.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+l.length+" bones. This GPU supports "+q+"."),l=0):l=q}else l=0;q=k.precision;null!==e.precision&&(q=k.getMaxPrecision(e.precision),q!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",q,"instead."));
  var s=b.getRenderTarget();return{shaderID:m,precision:q,supportsVertexTextures:k.vertexTextures,outputEncoding:a(s?s.texture:null,b.gammaOutput),map:!!e.map,mapEncoding:a(e.map,b.gammaInput),matcap:!!e.matcap,matcapEncoding:a(e.matcap,b.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:a(e.envMap,b.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===Nd||e.envMap.mapping===Od),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:a(e.emissiveMap,
  b.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===ng,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexColors:e.vertexColors,fog:!!d,useFog:e.fog,fogExp:d&&d.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:k.logarithmicDepthBuffer,skinning:e.skinning&&0<l,maxBones:l,
  useVertexTexture:k.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:b.maxMorphTargets,maxMorphNormals:b.maxMorphNormals,numDirLights:h.directional.length,numPointLights:h.point.length,numSpotLights:h.spot.length,numRectAreaLights:h.rectArea.length,numHemiLights:h.hemi.length,numClippingPlanes:F,numClipIntersection:n,dithering:e.dithering,shadowMapEnabled:b.shadowMap.enabled&&f.receiveShadow&&0<g.length,shadowMapType:b.shadowMap.type,toneMapping:b.toneMapping,
  physicallyCorrectLights:b.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===ac,flipSided:e.side===Oa,depthPacking:void 0!==e.depthPacking?e.depthPacking:!1}};this.getProgramCode=function(e,k){var a=[];k.shaderID?a.push(k.shaderID):(a.push(e.fragmentShader),a.push(e.vertexShader));if(void 0!==e.defines)for(var E in e.defines)a.push(E),a.push(e.defines[E]);for(E=0;E<g.length;E++)a.push(k[g[E]]);a.push(e.onBeforeCompile.toString());a.push(b.gammaOutput);
  return a.join()};this.acquireProgram=function(a,E,c,L){for(var g,d=0,F=h.length;d<F;d++){var n=h[d];if(n.code===L){g=n;++g.usedTimes;break}}void 0===g&&(g=new Ci(b,e,L,a,E,c,k),h.push(g));return g};this.releaseProgram=function(b){if(0===--b.usedTimes){var e=h.indexOf(b);h[e]=h[h.length-1];h.pop();b.destroy()}};this.programs=h}function Fi(){var b=new WeakMap;return{get:function(e){var k=b.get(e);void 0===k&&(k={},b.set(e,k));return k},remove:function(e){b.delete(e)},update:function(e,k,a){b.get(e)[k]=
  a},dispose:function(){b=new WeakMap}}}function Gi(b,e){return b.renderOrder!==e.renderOrder?b.renderOrder-e.renderOrder:b.program&&e.program&&b.program!==e.program?b.program.id-e.program.id:b.material.id!==e.material.id?b.material.id-e.material.id:b.z!==e.z?b.z-e.z:b.id-e.id}function Hi(b,e){return b.renderOrder!==e.renderOrder?b.renderOrder-e.renderOrder:b.z!==e.z?e.z-b.z:b.id-e.id}function Ii(){var b=[],e=0,k=[],a=[];return{opaque:k,transparent:a,init:function(){e=0;k.length=0;a.length=0},push:function(h,
  c,g,d,p){var B=b[e];void 0===B?(B={id:h.id,object:h,geometry:c,material:g,program:g.program,renderOrder:h.renderOrder,z:d,group:p},b[e]=B):(B.id=h.id,B.object=h,B.geometry=c,B.material=g,B.program=g.program,B.renderOrder=h.renderOrder,B.z=d,B.group=p);(!0===g.transparent?a:k).push(B);e++},sort:function(){1<k.length&&k.sort(Gi);1<a.length&&a.sort(Hi)}}}function Ji(){var b={};return{get:function(e,k){var a=e.id+","+k.id,h=b[a];void 0===h&&(h=new Ii,b[a]=h);return h},dispose:function(){b={}}}}function Ki(){var b=
  {};return{get:function(e){if(void 0!==b[e.id])return b[e.id];var k;switch(e.type){case "DirectionalLight":k={direction:new m,color:new w,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new d};break;case "SpotLight":k={position:new m,direction:new m,color:new w,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new d};break;case "PointLight":k={position:new m,color:new w,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new d,shadowCameraNear:1,
  shadowCameraFar:1E3};break;case "HemisphereLight":k={direction:new m,skyColor:new w,groundColor:new w};break;case "RectAreaLight":k={color:new w,position:new m,halfWidth:new m,halfHeight:new m}}return b[e.id]=k}}}function Li(){var b=new Ki,e={id:Mi++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],
  point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},k=new m,a=new f,h=new f;return{setup:function(c,g,d){var p=0,B=0,n=0,U=0,f=0,m=0,l=0,q=0;d=d.matrixWorldInverse;for(var s=0,r=c.length;s<r;s++){var z=c[s],t=z.color,u=z.intensity,w=z.distance,eb=z.shadow&&z.shadow.map?z.shadow.map.texture:null;if(z.isAmbientLight)p+=t.r*u,B+=t.g*u,n+=t.b*u;else if(z.isDirectionalLight){var aa=b.get(z);aa.color.copy(z.color).multiplyScalar(z.intensity);aa.direction.setFromMatrixPosition(z.matrixWorld);k.setFromMatrixPosition(z.target.matrixWorld);
  aa.direction.sub(k);aa.direction.transformDirection(d);if(aa.shadow=z.castShadow)t=z.shadow,aa.shadowBias=t.bias,aa.shadowRadius=t.radius,aa.shadowMapSize=t.mapSize;e.directionalShadowMap[U]=eb;e.directionalShadowMatrix[U]=z.shadow.matrix;e.directional[U]=aa;U++}else if(z.isSpotLight){aa=b.get(z);aa.position.setFromMatrixPosition(z.matrixWorld);aa.position.applyMatrix4(d);aa.color.copy(t).multiplyScalar(u);aa.distance=w;aa.direction.setFromMatrixPosition(z.matrixWorld);k.setFromMatrixPosition(z.target.matrixWorld);
  aa.direction.sub(k);aa.direction.transformDirection(d);aa.coneCos=Math.cos(z.angle);aa.penumbraCos=Math.cos(z.angle*(1-z.penumbra));aa.decay=0===z.distance?0:z.decay;if(aa.shadow=z.castShadow)t=z.shadow,aa.shadowBias=t.bias,aa.shadowRadius=t.radius,aa.shadowMapSize=t.mapSize;e.spotShadowMap[m]=eb;e.spotShadowMatrix[m]=z.shadow.matrix;e.spot[m]=aa;m++}else if(z.isRectAreaLight)aa=b.get(z),aa.color.copy(t).multiplyScalar(u),aa.position.setFromMatrixPosition(z.matrixWorld),aa.position.applyMatrix4(d),
  h.identity(),a.copy(z.matrixWorld),a.premultiply(d),h.extractRotation(a),aa.halfWidth.set(0.5*z.width,0,0),aa.halfHeight.set(0,0.5*z.height,0),aa.halfWidth.applyMatrix4(h),aa.halfHeight.applyMatrix4(h),e.rectArea[l]=aa,l++;else if(z.isPointLight){aa=b.get(z);aa.position.setFromMatrixPosition(z.matrixWorld);aa.position.applyMatrix4(d);aa.color.copy(z.color).multiplyScalar(z.intensity);aa.distance=z.distance;aa.decay=0===z.distance?0:z.decay;if(aa.shadow=z.castShadow)t=z.shadow,aa.shadowBias=t.bias,
  aa.shadowRadius=t.radius,aa.shadowMapSize=t.mapSize,aa.shadowCameraNear=t.camera.near,aa.shadowCameraFar=t.camera.far;e.pointShadowMap[f]=eb;e.pointShadowMatrix[f]=z.shadow.matrix;e.point[f]=aa;f++}else z.isHemisphereLight&&(aa=b.get(z),aa.direction.setFromMatrixPosition(z.matrixWorld),aa.direction.transformDirection(d),aa.direction.normalize(),aa.skyColor.copy(z.color).multiplyScalar(u),aa.groundColor.copy(z.groundColor).multiplyScalar(u),e.hemi[q]=aa,q++)}e.ambient[0]=p;e.ambient[1]=B;e.ambient[2]=
  n;e.directional.length=U;e.spot.length=m;e.rectArea.length=l;e.point.length=f;e.hemi.length=q;e.hash.stateID=e.id;e.hash.directionalLength=U;e.hash.pointLength=f;e.hash.spotLength=m;e.hash.rectAreaLength=l;e.hash.hemiLength=q;e.hash.shadowsLength=g.length},state:e}}function og(){var b=new Li,e=[],k=[];return{init:function(){e.length=0;k.length=0},state:{lightsArray:e,shadowsArray:k,lights:b},setupLights:function(a){b.setup(e,k,a)},pushLight:function(b){e.push(b)},pushShadow:function(b){k.push(b)}}}
  function Ni(){var b={};return{get:function(e,k){var a;void 0===b[e.id]?(a=new og,b[e.id]={},b[e.id][k.id]=a):void 0===b[e.id][k.id]?(a=new og,b[e.id][k.id]=a):a=b[e.id][k.id];return a},dispose:function(){b={}}}}function tb(b){T.call(this);this.type="MeshDepthMaterial";this.depthPacking=pg;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(b)}
  function ub(b){T.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new m;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(b)}function qg(b,e,k){function a(e,k,E,h,c,L){var g=e.geometry,d=null,d=l,F=e.customDepthMaterial;E&&(d=q,F=e.customDistanceMaterial);F?d=F:(F=!1,k.morphTargets&&(g&&g.isBufferGeometry?F=g.morphAttributes&&
  g.morphAttributes.position&&0<g.morphAttributes.position.length:g&&g.isGeometry&&(F=g.morphTargets&&0<g.morphTargets.length)),e.isSkinnedMesh&&!1===k.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e),e=e.isSkinnedMesh&&k.skinning,g=0,F&&(g|=U),e&&(g|=R),d=d[g]);b.localClippingEnabled&&!0===k.clipShadows&&0!==k.clippingPlanes.length&&(F=d.uuid,e=k.uuid,g=s[F],void 0===g&&(g={},s[F]=g),F=g[e],void 0===F&&(F=d.clone(),g[e]=F),d=F);d.visible=k.visible;
  d.wireframe=k.wireframe;d.side=null!=k.shadowSide?k.shadowSide:r[k.side];d.clipShadows=k.clipShadows;d.clippingPlanes=k.clippingPlanes;d.clipIntersection=k.clipIntersection;d.wireframeLinewidth=k.wireframeLinewidth;d.linewidth=k.linewidth;E&&d.isMeshDistanceMaterial&&(d.referencePosition.copy(h),d.nearDistance=c,d.farDistance=L);return d}function h(k,g,d,F){if(!1!==k.visible){if(k.layers.test(g.layers)&&(k.isMesh||k.isLine||k.isPoints)&&k.castShadow&&(!k.frustumCulled||c.intersectsObject(k))){k.modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,
  k.matrixWorld);var p=e.update(k),P=k.material;if(Array.isArray(P))for(var B=p.groups,U=0,f=B.length;U<f;U++){var m=B[U],R=P[m.materialIndex];R&&R.visible&&(R=a(k,R,F,n,d.near,d.far),b.renderBufferDirect(d,null,p,R,k,m))}else P.visible&&(R=a(k,P,F,n,d.near,d.far),b.renderBufferDirect(d,null,p,R,k,null))}k=k.children;p=0;for(P=k.length;p<P;p++)h(k[p],g,d,F)}}var c=new K,g=new f,P=new d,p=new d(k,k),B=new m,n=new m,U=1,R=2;k=(U|R)+1;for(var l=Array(k),q=Array(k),s={},r={0:Oa,1:Xb,2:ac},u=[new m(1,0,
  0),new m(-1,0,0),new m(0,0,1),new m(0,0,-1),new m(0,1,0),new m(0,-1,0)],z=[new m(0,1,0),new m(0,1,0),new m(0,1,0),new m(0,1,0),new m(0,0,1),new m(0,0,-1)],w=[new t,new t,new t,new t,new t,new t],G=0;G!==k;++G){var v=0!==(G&U),eb=0!==(G&R),aa=new tb({depthPacking:rg,morphTargets:v,skinning:eb});l[G]=aa;v=new ub({morphTargets:v,skinning:eb});q[G]=v}var A=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=Me;this.render=function(e,k,a){if(!1!==A.enabled&&(!1!==A.autoUpdate||!1!==A.needsUpdate)&&
  0!==e.length){var E=b.state;E.disable(b.context.BLEND);E.buffers.color.setClear(1,1,1,1);E.buffers.depth.setTest(!0);E.setScissorTest(!1);for(var d,U=0,f=e.length;U<f;U++){var m=e[U];d=m.shadow;var R=m&&m.isPointLight;if(void 0===d)console.warn("THREE.WebGLShadowMap:",m,"has no shadow.");else{var l=d.camera;P.copy(d.mapSize);P.min(p);if(R){var q=P.x,Ga=P.y;w[0].set(2*q,Ga,q,Ga);w[1].set(0,Ga,q,Ga);w[2].set(3*q,Ga,q,Ga);w[3].set(q,Ga,q,Ga);w[4].set(3*q,0,q,Ga);w[5].set(q,0,q,Ga);P.x*=4;P.y*=2}null===
  d.map&&(d.map=new x(P.x,P.y,{minFilter:La,magFilter:La,format:db}),d.map.texture.name=m.name+".shadowMap",l.updateProjectionMatrix());d.isSpotLightShadow&&d.update(m);q=d.map;Ga=d.matrix;n.setFromMatrixPosition(m.matrixWorld);l.position.copy(n);R?(d=6,Ga.makeTranslation(-n.x,-n.y,-n.z)):(d=1,B.setFromMatrixPosition(m.target.matrixWorld),l.lookAt(B),l.updateMatrixWorld(),Ga.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1),Ga.multiply(l.projectionMatrix),Ga.multiply(l.matrixWorldInverse));b.setRenderTarget(q);
  b.clear();for(m=0;m<d;m++)R&&(B.copy(l.position),B.add(u[m]),l.up.copy(z[m]),l.lookAt(B),l.updateMatrixWorld(),E.viewport(w[m])),g.multiplyMatrices(l.projectionMatrix,l.matrixWorldInverse),c.setFromMatrix(g),h(k,a,l,R)}}A.needsUpdate=!1}}}function Oi(b,e,k,a){function h(e,k,a){var E=new Uint8Array(4),h=b.createTexture();b.bindTexture(e,h);b.texParameteri(e,b.TEXTURE_MIN_FILTER,b.NEAREST);b.texParameteri(e,b.TEXTURE_MAG_FILTER,b.NEAREST);for(e=0;e<a;e++)b.texImage2D(k+e,0,b.RGBA,1,1,0,b.RGBA,b.UNSIGNED_BYTE,
  E);return h}function c(k,h){r[k]=1;0===z[k]&&(b.enableVertexAttribArray(k),z[k]=1);u[k]!==h&&((a.isWebGL2?b:e.get("ANGLE_instanced_arrays"))[a.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](k,h),u[k]=h)}function g(e){!0!==w[e]&&(b.enable(e),w[e]=!0)}function d(e){!1!==w[e]&&(b.disable(e),w[e]=!1)}function p(e,a,E,h,c,L,p,B){if(e===Oc)aa&&(d(b.BLEND),aa=!1);else if(aa||(g(b.BLEND),aa=!0),e!==Qe){if(e!==v||B!==C){if(A!==Yb||K!==Yb)b.blendEquation(b.FUNC_ADD),K=A=Yb;if(B)switch(e){case zb:b.blendFuncSeparate(b.ONE,
  b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA);break;case Sd:b.blendFunc(b.ONE,b.ONE);break;case Td:b.blendFuncSeparate(b.ZERO,b.ZERO,b.ONE_MINUS_SRC_COLOR,b.ONE_MINUS_SRC_ALPHA);break;case Ud:b.blendFuncSeparate(b.ZERO,b.SRC_COLOR,b.ZERO,b.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case zb:b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA);break;case Sd:b.blendFunc(b.SRC_ALPHA,b.ONE);break;case Td:b.blendFunc(b.ZERO,
  b.ONE_MINUS_SRC_COLOR);break;case Ud:b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}y=H=x=S=null;v=e;C=B}}else{c=c||a;L=L||E;p=p||h;if(a!==A||c!==K)b.blendEquationSeparate(k.convert(a),k.convert(c)),A=a,K=c;if(E!==S||h!==x||L!==H||p!==y)b.blendFuncSeparate(k.convert(E),k.convert(h),k.convert(L),k.convert(p)),S=E,x=h,H=L,y=p;v=e;C=null}}function B(e){V!==e&&(e?b.frontFace(b.CW):b.frontFace(b.CCW),V=e)}function n(e){e!==sg?(g(b.CULL_FACE),e!==I&&
  (e===Re?b.cullFace(b.BACK):e===tg?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK))):d(b.CULL_FACE);I=e}function U(e,k,a){if(e){if(g(b.POLYGON_OFFSET_FILL),J!==k||W!==a)b.polygonOffset(k,a),J=k,W=a}else d(b.POLYGON_OFFSET_FILL)}function f(e){void 0===e&&(e=b.TEXTURE0+ja-1);Q!==e&&(b.activeTexture(e),Q=e)}var m=new function(){var e=!1,k=new t,a=null,E=new t(0,0,0,0);return{setMask:function(k){a===k||e||(b.colorMask(k,k,k,k),a=k)},setLocked:function(b){e=b},setClear:function(e,a,h,c,g){!0===g&&(e*=
  c,a*=c,h*=c);k.set(e,a,h,c);!1===E.equals(k)&&(b.clearColor(e,a,h,c),E.copy(k))},reset:function(){e=!1;a=null;E.set(-1,0,0,0)}}},l=new function(){var e=!1,k=null,a=null,E=null;return{setTest:function(e){e?g(b.DEPTH_TEST):d(b.DEPTH_TEST)},setMask:function(a){k===a||e||(b.depthMask(a),k=a)},setFunc:function(e){if(a!==e){if(e)switch(e){case ug:b.depthFunc(b.NEVER);break;case vg:b.depthFunc(b.ALWAYS);break;case wg:b.depthFunc(b.LESS);break;case Id:b.depthFunc(b.LEQUAL);break;case xg:b.depthFunc(b.EQUAL);
  break;case yg:b.depthFunc(b.GEQUAL);break;case zg:b.depthFunc(b.GREATER);break;case Ag:b.depthFunc(b.NOTEQUAL);break;default:b.depthFunc(b.LEQUAL)}else b.depthFunc(b.LEQUAL);a=e}},setLocked:function(b){e=b},setClear:function(e){E!==e&&(b.clearDepth(e),E=e)},reset:function(){e=!1;E=a=k=null}}},q=new function(){var e=!1,k=null,a=null,E=null,h=null,c=null,L=null,p=null,B=null;return{setTest:function(e){e?g(b.STENCIL_TEST):d(b.STENCIL_TEST)},setMask:function(a){k===a||e||(b.stencilMask(a),k=a)},setFunc:function(e,
  k,c){if(a!==e||E!==k||h!==c)b.stencilFunc(e,k,c),a=e,E=k,h=c},setOp:function(e,k,a){if(c!==e||L!==k||p!==a)b.stencilOp(e,k,a),c=e,L=k,p=a},setLocked:function(b){e=b},setClear:function(e){B!==e&&(b.clearStencil(e),B=e)},reset:function(){e=!1;B=p=L=c=h=E=a=k=null}}},s=b.getParameter(b.MAX_VERTEX_ATTRIBS),r=new Uint8Array(s),z=new Uint8Array(s),u=new Uint8Array(s),w={},G=null,eb=null,aa=null,v=null,A=null,S=null,x=null,K=null,H=null,y=null,C=!1,V=null,I=null,D=null,J=null,W=null,ja=b.getParameter(b.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
  N=!1,s=0,s=b.getParameter(b.VERSION);-1!==s.indexOf("WebGL")?(s=parseFloat(/^WebGL\ ([0-9])/.exec(s)[1]),N=1<=s):-1!==s.indexOf("OpenGL ES")&&(s=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(s)[1]),N=2<=s);var Q=null,T={},M=new t,oa=new t,da={};da[b.TEXTURE_2D]=h(b.TEXTURE_2D,b.TEXTURE_2D,1);da[b.TEXTURE_CUBE_MAP]=h(b.TEXTURE_CUBE_MAP,b.TEXTURE_CUBE_MAP_POSITIVE_X,6);m.setClear(0,0,0,1);l.setClear(1);q.setClear(0);g(b.DEPTH_TEST);l.setFunc(Id);B(!1);n(Re);g(b.CULL_FACE);p(Oc);return{buffers:{color:m,depth:l,
  stencil:q},initAttributes:function(){for(var b=0,e=r.length;b<e;b++)r[b]=0},enableAttribute:function(b){c(b,0)},enableAttributeAndDivisor:c,disableUnusedAttributes:function(){for(var e=0,k=z.length;e!==k;++e)z[e]!==r[e]&&(b.disableVertexAttribArray(e),z[e]=0)},enable:g,disable:d,getCompressedTextureFormats:function(){if(null===G&&(G=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")||e.get("WEBGL_compressed_texture_astc")))for(var k=
  b.getParameter(b.COMPRESSED_TEXTURE_FORMATS),a=0;a<k.length;a++)G.push(k[a]);return G},useProgram:function(e){return eb!==e?(b.useProgram(e),eb=e,!0):!1},setBlending:p,setMaterial:function(e,k){e.side===ac?d(b.CULL_FACE):g(b.CULL_FACE);var a=e.side===Oa;k&&(a=!a);B(a);e.blending===zb&&!1===e.transparent?p(Oc):p(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha);l.setFunc(e.depthFunc);l.setTest(e.depthTest);l.setMask(e.depthWrite);
  m.setMask(e.colorWrite);U(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:B,setCullFace:n,setLineWidth:function(e){e!==D&&(N&&b.lineWidth(e),D=e)},setPolygonOffset:U,setScissorTest:function(e){e?g(b.SCISSOR_TEST):d(b.SCISSOR_TEST)},activeTexture:f,bindTexture:function(e,k){null===Q&&f();var a=T[Q];void 0===a&&(a={type:void 0,texture:void 0},T[Q]=a);if(a.type!==e||a.texture!==k)b.bindTexture(e,k||da[e]),a.type=e,a.texture=k},compressedTexImage2D:function(){try{b.compressedTexImage2D.apply(b,
  arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{b.texImage2D.apply(b,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{b.texImage3D.apply(b,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===M.equals(e)&&(b.scissor(e.x,e.y,e.z,e.w),M.copy(e))},viewport:function(e){!1===oa.equals(e)&&(b.viewport(e.x,e.y,e.z,e.w),oa.copy(e))},reset:function(){for(var e=0;e<z.length;e++)1===z[e]&&(b.disableVertexAttribArray(e),
  z[e]=0);w={};Q=G=null;T={};I=V=v=eb=null;m.reset();l.reset();q.reset()}}}function Pi(b,e,k,a,h,c,g){function d(b,e){if(b.width>e||b.height>e){if("data"in b){console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+b.width+"x"+b.height+").");return}var k=e/Math.max(b.width,b.height),a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");a.width=Math.floor(b.width*k);a.height=Math.floor(b.height*k);a.getContext("2d").drawImage(b,0,0,b.width,b.height,0,0,a.width,a.height);console.warn("THREE.WebGLRenderer: image is too big ("+
  b.width+"x"+b.height+"). Resized to "+a.width+"x"+a.height);return a}return b}function p(b){return ga.isPowerOfTwo(b.width)&&ga.isPowerOfTwo(b.height)}function B(b,e){return b.generateMipmaps&&e&&b.minFilter!==La&&b.minFilter!==Ka}function n(e,k,h,c){b.generateMipmap(e);a.get(k).__maxMipLevel=Math.log(Math.max(h,c))*Math.LOG2E}function U(e,k){if(!h.isWebGL2)return e;if(e===b.RED){if(k===b.FLOAT)return b.R32F;if(k===b.HALF_FLOAT)return b.R16F;if(k===b.UNSIGNED_BYTE)return b.R8}if(e===b.RGB){if(k===
  b.FLOAT)return b.RGB32F;if(k===b.HALF_FLOAT)return b.RGB16F;if(k===b.UNSIGNED_BYTE)return b.RGB8}if(e===b.RGBA){if(k===b.FLOAT)return b.RGBA32F;if(k===b.HALF_FLOAT)return b.RGBA16F;if(k===b.UNSIGNED_BYTE)return b.RGBA8}return e}function f(e){return e===La||e===Vd||e===Wd?b.NEAREST:b.LINEAR}function m(e){e=e.target;e.removeEventListener("dispose",m);a:{var k=a.get(e);if(e.image&&k.__image__webglTextureCube)b.deleteTexture(k.__image__webglTextureCube);else{if(void 0===k.__webglInit)break a;b.deleteTexture(k.__webglTexture)}a.remove(e)}e.isVideoTexture&&
  delete u[e.id];g.memory.textures--}function l(e){e=e.target;e.removeEventListener("dispose",l);var k=a.get(e),h=a.get(e.texture);if(e){void 0!==h.__webglTexture&&b.deleteTexture(h.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(h=0;6>h;h++)b.deleteFramebuffer(k.__webglFramebuffer[h]),k.__webglDepthbuffer&&b.deleteRenderbuffer(k.__webglDepthbuffer[h]);else b.deleteFramebuffer(k.__webglFramebuffer),k.__webglDepthbuffer&&b.deleteRenderbuffer(k.__webglDepthbuffer);
  a.remove(e.texture);a.remove(e)}g.memory.textures--}function q(e,h){var c=a.get(e);if(e.isVideoTexture){var L=e.id,d=g.render.frame;u[L]!==d&&(u[L]=d,e.update())}if(0<e.version&&c.__version!==e.version)if(L=e.image,void 0===L)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(!1===L.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{r(c,e,h);return}k.activeTexture(b.TEXTURE0+h);k.bindTexture(b.TEXTURE_2D,
  c.__webglTexture)}function s(k,g,d){d?(b.texParameteri(k,b.TEXTURE_WRAP_S,c.convert(g.wrapS)),b.texParameteri(k,b.TEXTURE_WRAP_T,c.convert(g.wrapT)),b.texParameteri(k,b.TEXTURE_MAG_FILTER,c.convert(g.magFilter)),b.texParameteri(k,b.TEXTURE_MIN_FILTER,c.convert(g.minFilter))):(b.texParameteri(k,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(k,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),g.wrapS===Qa&&g.wrapT===Qa||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),
  b.texParameteri(k,b.TEXTURE_MAG_FILTER,f(g.magFilter)),b.texParameteri(k,b.TEXTURE_MIN_FILTER,f(g.minFilter)),g.minFilter!==La&&g.minFilter!==Ka&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));!(d=e.get("EXT_texture_filter_anisotropic"))||g.type===bc&&null===e.get("OES_texture_float_linear")||g.type===Xd&&null===(h.isWebGL2||e.get("OES_texture_half_float_linear"))||!(1<g.anisotropy||a.get(g).__currentAnisotropy)||
  (b.texParameterf(k,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,h.getMaxAnisotropy())),a.get(g).__currentAnisotropy=g.anisotropy)}function r(e,a,E){var f;f=a.isTexture3D?b.TEXTURE_3D:b.TEXTURE_2D;void 0===e.__webglInit&&(e.__webglInit=!0,a.addEventListener("dispose",m),e.__webglTexture=b.createTexture(),g.memory.textures++);k.activeTexture(b.TEXTURE0+E);k.bindTexture(f,e.__webglTexture);b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,a.flipY);b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);
  b.pixelStorei(b.UNPACK_ALIGNMENT,a.unpackAlignment);E=d(a.image,h.maxTextureSize);var R;R=h.isWebGL2?!1:a.wrapS!==Qa||a.wrapT!==Qa||a.minFilter!==La&&a.minFilter!==Ka;R&&!1===p(E)&&(E instanceof HTMLImageElement||E instanceof HTMLCanvasElement||E instanceof ImageBitmap)&&(void 0===w&&(w=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),w.width=ga.floorPowerOfTwo(E.width),w.height=ga.floorPowerOfTwo(E.height),w.getContext("2d").drawImage(E,0,0,w.width,w.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+
  E.width+"x"+E.height+"). Resized to "+w.width+"x"+w.height),E=w);R=p(E);var l=c.convert(a.format),q=c.convert(a.type),z=U(l,q);s(f,a,R);var Y=a.mipmaps;if(a.isDepthTexture){z=b.DEPTH_COMPONENT;if(a.type===bc){if(!h.isWebGL2)throw Error("Float Depth Texture only supported in WebGL2.0");z=b.DEPTH_COMPONENT32F}else h.isWebGL2&&(z=b.DEPTH_COMPONENT16);a.format===Ab&&z===b.DEPTH_COMPONENT&&a.type!==Pc&&a.type!==Se&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),
  a.type=Pc,q=c.convert(a.type));a.format===cc&&(z=b.DEPTH_STENCIL,a.type!==Qc&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),a.type=Qc,q=c.convert(a.type)));k.texImage2D(b.TEXTURE_2D,0,z,E.width,E.height,0,l,q,null)}else if(a.isDataTexture)if(0<Y.length&&R){for(var t=0,rb=Y.length;t<rb;t++)f=Y[t],k.texImage2D(b.TEXTURE_2D,t,z,f.width,f.height,0,l,q,f.data);a.generateMipmaps=!1;e.__maxMipLevel=Y.length-1}else k.texImage2D(b.TEXTURE_2D,0,z,E.width,
  E.height,0,l,q,E.data),e.__maxMipLevel=0;else if(a.isCompressedTexture){t=0;for(rb=Y.length;t<rb;t++)f=Y[t],a.format!==db&&a.format!==dc?-1<k.getCompressedTextureFormats().indexOf(l)?k.compressedTexImage2D(b.TEXTURE_2D,t,z,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):k.texImage2D(b.TEXTURE_2D,t,z,f.width,f.height,0,l,q,f.data);e.__maxMipLevel=Y.length-1}else if(a.isTexture3D)k.texImage3D(b.TEXTURE_3D,0,z,
  E.width,E.height,E.depth,0,l,q,E.data),e.__maxMipLevel=0;else if(0<Y.length&&R){t=0;for(rb=Y.length;t<rb;t++)f=Y[t],k.texImage2D(b.TEXTURE_2D,t,z,l,q,f);a.generateMipmaps=!1;e.__maxMipLevel=Y.length-1}else k.texImage2D(b.TEXTURE_2D,0,z,l,q,E),e.__maxMipLevel=0;B(a,R)&&n(b.TEXTURE_2D,a,E.width,E.height);e.__version=a.version;if(a.onUpdate)a.onUpdate(a)}function z(e,h,g,d){var F=c.convert(h.texture.format),p=c.convert(h.texture.type),P=U(F,p);k.texImage2D(d,0,P,h.width,h.height,0,F,p,null);b.bindFramebuffer(b.FRAMEBUFFER,
  e);b.framebufferTexture2D(b.FRAMEBUFFER,g,d,a.get(h.texture).__webglTexture,0);b.bindFramebuffer(b.FRAMEBUFFER,null)}function t(e,k){b.bindRenderbuffer(b.RENDERBUFFER,e);k.depthBuffer&&!k.stencilBuffer?(b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,k.width,k.height),b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e)):k.depthBuffer&&k.stencilBuffer?(b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_STENCIL,k.width,k.height),b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_STENCIL_ATTACHMENT,
  b.RENDERBUFFER,e)):b.renderbufferStorage(b.RENDERBUFFER,b.RGBA4,k.width,k.height);b.bindRenderbuffer(b.RENDERBUFFER,null)}var u={},w;this.setTexture2D=q;this.setTexture3D=function(e,h){var c=a.get(e);0<e.version&&c.__version!==e.version?r(c,e,h):(k.activeTexture(b.TEXTURE0+h),k.bindTexture(b.TEXTURE_3D,c.__webglTexture))};this.setTextureCube=function(e,f){var R=a.get(e);if(6===e.image.length)if(0<e.version&&R.__version!==e.version){R.__image__webglTextureCube||(e.addEventListener("dispose",m),R.__image__webglTextureCube=
  b.createTexture(),g.memory.textures++);k.activeTexture(b.TEXTURE0+f);k.bindTexture(b.TEXTURE_CUBE_MAP,R.__image__webglTextureCube);b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,q=e.image[0]&&e.image[0].isDataTexture,z=[],Y=0;6>Y;Y++)z[Y]=l||q?q?e.image[Y].image:e.image[Y]:d(e.image[Y],h.maxCubemapSize);var t=z[0],rb=p(t),r=c.convert(e.format),u=c.convert(e.type),w=U(r,u);s(b.TEXTURE_CUBE_MAP,e,rb);for(Y=0;6>Y;Y++)if(l)for(var G,v=z[Y].mipmaps,A=0,S=v.length;A<S;A++)G=
  v[A],e.format!==db&&e.format!==dc?-1<k.getCompressedTextureFormats().indexOf(r)?k.compressedTexImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+Y,A,w,G.width,G.height,0,G.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):k.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+Y,A,w,G.width,G.height,0,r,u,G.data);else q?k.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,w,z[Y].width,z[Y].height,0,r,u,z[Y].data):k.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,
  w,r,u,z[Y]);R.__maxMipLevel=l?v.length-1:0;B(e,rb)&&n(b.TEXTURE_CUBE_MAP,e,t.width,t.height);R.__version=e.version;if(e.onUpdate)e.onUpdate(e)}else k.activeTexture(b.TEXTURE0+f),k.bindTexture(b.TEXTURE_CUBE_MAP,R.__image__webglTextureCube)};this.setTextureCubeDynamic=function(e,h){k.activeTexture(b.TEXTURE0+h);k.bindTexture(b.TEXTURE_CUBE_MAP,a.get(e).__webglTexture)};this.setupRenderTarget=function(e){var h=a.get(e),c=a.get(e.texture);e.addEventListener("dispose",l);c.__webglTexture=b.createTexture();
  g.memory.textures++;var L=!0===e.isWebGLRenderTargetCube,d=p(e);if(L){h.__webglFramebuffer=[];for(var P=0;6>P;P++)h.__webglFramebuffer[P]=b.createFramebuffer()}else h.__webglFramebuffer=b.createFramebuffer();if(L){k.bindTexture(b.TEXTURE_CUBE_MAP,c.__webglTexture);s(b.TEXTURE_CUBE_MAP,e.texture,d);for(P=0;6>P;P++)z(h.__webglFramebuffer[P],e,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+P);B(e.texture,d)&&n(b.TEXTURE_CUBE_MAP,e.texture,e.width,e.height);k.bindTexture(b.TEXTURE_CUBE_MAP,null)}else k.bindTexture(b.TEXTURE_2D,
  c.__webglTexture),s(b.TEXTURE_2D,e.texture,d),z(h.__webglFramebuffer,e,b.COLOR_ATTACHMENT0,b.TEXTURE_2D),B(e.texture,d)&&n(b.TEXTURE_2D,e.texture,e.width,e.height),k.bindTexture(b.TEXTURE_2D,null);if(e.depthBuffer){h=a.get(e);c=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(c)throw Error("target.depthTexture not supported in Cube render targets");if(e&&e.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");b.bindFramebuffer(b.FRAMEBUFFER,h.__webglFramebuffer);
  if(!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");a.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0);q(e.depthTexture,0);h=a.get(e.depthTexture).__webglTexture;if(e.depthTexture.format===Ab)b.framebufferTexture2D(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.TEXTURE_2D,
  h,0);else if(e.depthTexture.format===cc)b.framebufferTexture2D(b.FRAMEBUFFER,b.DEPTH_STENCIL_ATTACHMENT,b.TEXTURE_2D,h,0);else throw Error("Unknown depthTexture format");}else if(c)for(h.__webglDepthbuffer=[],c=0;6>c;c++)b.bindFramebuffer(b.FRAMEBUFFER,h.__webglFramebuffer[c]),h.__webglDepthbuffer[c]=b.createRenderbuffer(),t(h.__webglDepthbuffer[c],e);else b.bindFramebuffer(b.FRAMEBUFFER,h.__webglFramebuffer),h.__webglDepthbuffer=b.createRenderbuffer(),t(h.__webglDepthbuffer,e);b.bindFramebuffer(b.FRAMEBUFFER,
  null)}};this.updateRenderTargetMipmap=function(e){var h=e.texture,c=p(e);if(B(h,c)){var c=e.isWebGLRenderTargetCube?b.TEXTURE_CUBE_MAP:b.TEXTURE_2D,g=a.get(h).__webglTexture;k.bindTexture(c,g);n(c,h,e.width,e.height);k.bindTexture(c,null)}}}function Bg(b,e,k){return{convert:function(a){var h;if(a===nb)return b.REPEAT;if(a===Qa)return b.CLAMP_TO_EDGE;if(a===Bb)return b.MIRRORED_REPEAT;if(a===La)return b.NEAREST;if(a===Vd)return b.NEAREST_MIPMAP_NEAREST;if(a===Wd)return b.NEAREST_MIPMAP_LINEAR;if(a===
  Ka)return b.LINEAR;if(a===Te)return b.LINEAR_MIPMAP_NEAREST;if(a===Kc)return b.LINEAR_MIPMAP_LINEAR;if(a===Hd)return b.UNSIGNED_BYTE;if(a===Cg)return b.UNSIGNED_SHORT_4_4_4_4;if(a===Dg)return b.UNSIGNED_SHORT_5_5_5_1;if(a===Eg)return b.UNSIGNED_SHORT_5_6_5;if(a===Fg)return b.BYTE;if(a===Gg)return b.SHORT;if(a===Pc)return b.UNSIGNED_SHORT;if(a===Hg)return b.INT;if(a===Se)return b.UNSIGNED_INT;if(a===bc)return b.FLOAT;if(a===Xd){if(k.isWebGL2)return b.HALF_FLOAT;h=e.get("OES_texture_half_float");if(null!==
  h)return h.HALF_FLOAT_OES}if(a===Ig)return b.ALPHA;if(a===dc)return b.RGB;if(a===db)return b.RGBA;if(a===Jg)return b.LUMINANCE;if(a===Kg)return b.LUMINANCE_ALPHA;if(a===Ab)return b.DEPTH_COMPONENT;if(a===cc)return b.DEPTH_STENCIL;if(a===Lg)return b.RED;if(a===Yb)return b.FUNC_ADD;if(a===Mg)return b.FUNC_SUBTRACT;if(a===Ng)return b.FUNC_REVERSE_SUBTRACT;if(a===Og)return b.ZERO;if(a===Pg)return b.ONE;if(a===Qg)return b.SRC_COLOR;if(a===Rg)return b.ONE_MINUS_SRC_COLOR;if(a===Ae)return b.SRC_ALPHA;if(a===
  Be)return b.ONE_MINUS_SRC_ALPHA;if(a===Sg)return b.DST_ALPHA;if(a===Tg)return b.ONE_MINUS_DST_ALPHA;if(a===Ug)return b.DST_COLOR;if(a===Vg)return b.ONE_MINUS_DST_COLOR;if(a===Wg)return b.SRC_ALPHA_SATURATE;if(a===Ue||a===Ve||a===We||a===Xe)if(h=e.get("WEBGL_compressed_texture_s3tc"),null!==h){if(a===Ue)return h.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===Ve)return h.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===We)return h.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===Xe)return h.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(a===Ye||a===
  Ze||a===$e||a===af)if(h=e.get("WEBGL_compressed_texture_pvrtc"),null!==h){if(a===Ye)return h.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===Ze)return h.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===$e)return h.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===af)return h.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(a===Xg&&(h=e.get("WEBGL_compressed_texture_etc1"),null!==h))return h.COMPRESSED_RGB_ETC1_WEBGL;if(a===Yg||a===Zg||a===$g||a===ah||a===bh||a===ch||a===dh||a===eh||a===fh||a===gh||a===hh||a===ih||a===jh||a===kh)if(h=e.get("WEBGL_compressed_texture_astc"),
  null!==h)return a;if(a===Yd||a===Zd){if(k.isWebGL2){if(a===Yd)return b.MIN;if(a===Zd)return b.MAX}h=e.get("EXT_blend_minmax");if(null!==h){if(a===Yd)return h.MIN_EXT;if(a===Zd)return h.MAX_EXT}}if(a===Qc){if(k.isWebGL2)return b.UNSIGNED_INT_24_8;h=e.get("WEBGL_depth_texture");if(null!==h)return h.UNSIGNED_INT_24_8_WEBGL}return 0}}}function ec(){D.call(this);this.type="Group"}function hb(){D.call(this);this.type="Camera";this.matrixWorldInverse=new f;this.projectionMatrix=new f;this.projectionMatrixInverse=
  new f}function qa(b,e,k,a){hb.call(this);this.type="PerspectiveCamera";this.fov=void 0!==b?b:50;this.zoom=1;this.near=void 0!==k?k:0.1;this.far=void 0!==a?a:2E3;this.focus=10;this.aspect=void 0!==e?e:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Rc(b){qa.call(this);this.cameras=b||[]}function lh(b){function e(){return null!==h&&!0===h.isPresenting}function k(){if(e()){var k=h.getEyeParameters("left"),c=k.renderWidth,k=k.renderHeight;z=b.getPixelRatio();
  u=b.getSize();b.setDrawingBufferSize(2*c,k,1);G.start()}else a.enabled&&b.setDrawingBufferSize(u.width,u.height,z),G.stop()}var a=this,h=null,c=null,g=null,d=[],p=new f,B=new f,n="stage";"undefined"!==typeof window&&"VRFrameData"in window&&(c=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",k,!1));var U=new f,R=new l,q=new m,s=new qa;s.bounds=new t(0,0,0.5,1);s.layers.enable(1);var Y=new qa;Y.bounds=new t(0.5,0,0.5,1);Y.layers.enable(2);var r=new Rc([s,Y]);r.layers.enable(1);
  r.layers.enable(2);var u,z,w=[];this.enabled=!1;this.getController=function(b){var e=d[b];void 0===e&&(e=new ec,e.matrixAutoUpdate=!1,e.visible=!1,d[b]=e);return e};this.getDevice=function(){return h};this.setDevice=function(b){void 0!==b&&(h=b);G.setContext(b)};this.setFrameOfReferenceType=function(b){n=b};this.setPoseTarget=function(b){void 0!==b&&(g=b)};this.getCamera=function(b){var e="stage"===n?1.6:0;if(null===h)return b.position.set(0,e,0),b;h.depthNear=b.near;h.depthFar=b.far;h.getFrameData(c);
  if("stage"===n){var k=h.stageParameters;k?p.fromArray(k.sittingToStandingTransform):p.makeTranslation(0,e,0)}e=c.pose;k=null!==g?g:b;k.matrix.copy(p);k.matrix.decompose(k.position,k.quaternion,k.scale);null!==e.orientation&&(R.fromArray(e.orientation),k.quaternion.multiply(R));null!==e.position&&(R.setFromRotationMatrix(p),q.fromArray(e.position),q.applyQuaternion(R),k.position.add(q));k.updateMatrixWorld();if(!1===h.isPresenting)return b;s.near=b.near;Y.near=b.near;s.far=b.far;Y.far=b.far;r.matrixWorld.copy(b.matrixWorld);
  r.matrixWorldInverse.copy(b.matrixWorldInverse);s.matrixWorldInverse.fromArray(c.leftViewMatrix);Y.matrixWorldInverse.fromArray(c.rightViewMatrix);B.getInverse(p);"stage"===n&&(s.matrixWorldInverse.multiply(B),Y.matrixWorldInverse.multiply(B));b=k.parent;null!==b&&(U.getInverse(b.matrixWorld),s.matrixWorldInverse.multiply(U),Y.matrixWorldInverse.multiply(U));s.matrixWorld.getInverse(s.matrixWorldInverse);Y.matrixWorld.getInverse(Y.matrixWorldInverse);s.projectionMatrix.fromArray(c.leftProjectionMatrix);
  Y.projectionMatrix.fromArray(c.rightProjectionMatrix);r.projectionMatrix.copy(s.projectionMatrix);b=h.getLayers();b.length&&(b=b[0],null!==b.leftBounds&&4===b.leftBounds.length&&s.bounds.fromArray(b.leftBounds),null!==b.rightBounds&&4===b.rightBounds.length&&Y.bounds.fromArray(b.rightBounds));a:for(b=0;b<d.length;b++){e=d[b];b:{for(var k=b,a=navigator.getGamepads&&navigator.getGamepads(),E=0,f=0,m=a.length;E<m;E++){var l=a[E];if(l&&("Daydream Controller"===l.id||"Gear VR Controller"===l.id||"Oculus Go Controller"===
  l.id||"OpenVR Gamepad"===l.id||l.id.startsWith("Oculus Touch")||l.id.startsWith("Spatial Controller"))){if(f===k){k=l;break b}f++}}k=void 0}if(void 0!==k&&void 0!==k.pose){if(null===k.pose)break a;a=k.pose;!1===a.hasPosition&&e.position.set(0.2,-0.6,-0.05);null!==a.position&&e.position.fromArray(a.position);null!==a.orientation&&e.quaternion.fromArray(a.orientation);e.matrix.compose(e.position,e.quaternion,e.scale);e.matrix.premultiply(p);e.matrix.decompose(e.position,e.quaternion,e.scale);e.matrixWorldNeedsUpdate=
  !0;e.visible=!0;a="Daydream Controller"===k.id?0:1;w[b]!==k.buttons[a].pressed&&(w[b]=k.buttons[a].pressed,!0===w[b]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"})))}else e.visible=!1}return r};this.getStandingMatrix=function(){return p};this.isPresenting=e;var G=new W;this.setAnimationLoop=function(b){G.setAnimationLoop(b)};this.submitFrame=function(){e()&&h.submitFrame()};this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange",
  k)}}function Qi(b){function e(){return null!==d&&null!==p}function k(b){var e=f[m.indexOf(b.inputSource)];e&&e.dispatchEvent({type:b.type})}function a(){b.setFramebuffer(null);u.stop()}function h(b,e){null===e?b.matrixWorld.copy(b.matrix):b.matrixWorld.multiplyMatrices(e.matrixWorld,b.matrix);b.matrixWorldInverse.getInverse(b.matrixWorld)}var c=b.context,g=null,d=null,p=null,B="stage",n=null,f=[],m=[],l=new qa;l.layers.enable(1);l.viewport=new t;var q=new qa;q.layers.enable(2);q.viewport=new t;var s=
  new Rc([l,q]);s.layers.enable(1);s.layers.enable(2);this.enabled=!1;this.getController=function(b){var e=f[b];void 0===e&&(e=new ec,e.matrixAutoUpdate=!1,e.visible=!1,f[b]=e);return e};this.getDevice=function(){return g};this.setDevice=function(b){void 0!==b&&(g=b);b instanceof XRDevice&&c.setCompatibleXRDevice(b)};this.setFrameOfReferenceType=function(b){B=b};this.setSession=function(e){d=e;null!==d&&(d.addEventListener("select",k),d.addEventListener("selectstart",k),d.addEventListener("selectend",
  k),d.addEventListener("end",a),d.baseLayer=new XRWebGLLayer(d,c),d.requestFrameOfReference(B).then(function(e){p=e;b.setFramebuffer(d.baseLayer.framebuffer);u.setContext(d);u.start()}),m=d.getInputSources(),d.addEventListener("inputsourceschange",function(){m=d.getInputSources();console.log(m)}))};this.getCamera=function(b){if(e()){var k=b.parent,a=s.cameras;h(s,k);for(var E=0;E<a.length;E++)h(a[E],k);b.matrixWorld.copy(s.matrixWorld);b=b.children;E=0;for(k=b.length;E<k;E++)b[E].updateMatrixWorld(!0);
  return s}return b};this.isPresenting=e;var r=null,u=new W;u.setAnimationLoop(function(b,e){n=e.getDevicePose(p);if(null!==n)for(var k=d.baseLayer,a=e.views,E=0;E<a.length;E++){var h=a[E],c=k.getViewport(h),g=n.getViewMatrix(h),L=s.cameras[E];L.matrix.fromArray(g).getInverse(L.matrix);L.projectionMatrix.fromArray(h.projectionMatrix);L.viewport.set(c.x,c.y,c.width,c.height);0===E&&(s.matrix.copy(L.matrix),s.projectionMatrix.copy(L.projectionMatrix))}for(E=0;E<f.length;E++){k=f[E];if(a=m[E])if(a=e.getInputPose(a,
  p),null!==a){"targetRay"in a?k.matrix.elements=a.targetRay.transformMatrix:"pointerMatrix"in a&&(k.matrix.elements=a.pointerMatrix);k.matrix.decompose(k.position,k.rotation,k.scale);k.visible=!0;continue}k.visible=!1}r&&r(b)});this.setAnimationLoop=function(b){r=b};this.dispose=function(){};this.getStandingMatrix=function(){console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed.");return new THREE.Matrix4};this.submitFrame=function(){}}function bf(b){var e,k,a;function h(){xa=new He(O);
  Ma=new Fe(O,xa,b);Ma.isWebGL2||(xa.get("WEBGL_depth_texture"),xa.get("OES_texture_float"),xa.get("OES_texture_half_float"),xa.get("OES_texture_half_float_linear"),xa.get("OES_standard_derivatives"),xa.get("OES_element_index_uint"),xa.get("ANGLE_instanced_arrays"));xa.get("OES_texture_float_linear");Ta=new Bg(O,xa,Ma);ka=new Oi(O,xa,Ta,Ma);ka.scissor(ba.copy(na).multiplyScalar(ca));ka.viewport(ea.copy(ma).multiplyScalar(ca));qa=new Wh(O);la=new Fi;sa=new Pi(O,xa,ka,la,Ma,Ta,qa);Ba=new Q(O);Da=new Jd(O,
  Ba,qa);Aa=new Yh(Da,qa);Ia=new Xh(O);wa=new Ei(D,xa,Ma);Ea=new Ji;Ca=new Ni;ua=new De(D,ka,Aa,H);Ka=new Ee(O,xa,qa,Ma);La=new Vh(O,xa,qa,Ma);qa.programs=wa.programs;D.context=O;D.capabilities=Ma;D.extensions=xa;D.properties=la;D.renderLists=Ea;D.state=ka;D.info=qa}function c(b){b.preventDefault();console.log("THREE.WebGLRenderer: Context Lost.");J=!0}function g(){console.log("THREE.WebGLRenderer: Context Restored.");J=!1;h()}function d(b){b=b.target;b.removeEventListener("dispose",d);p(b);la.remove(b)}
  function p(b){var e=la.get(b).program;b.program=void 0;void 0!==e&&wa.releaseProgram(e)}function B(b,e){b.render(function(b){D.renderBufferImmediate(b,e)})}function n(b,e,k){if(!1!==b.visible){if(b.layers.test(e.layers))if(b.isLight)I.pushLight(b),b.castShadow&&I.pushShadow(b);else if(b.isSprite){if(!b.frustumCulled||ra.intersectsSprite(b)){k&&vb.setFromMatrixPosition(b.matrixWorld).applyMatrix4(ta);var a=Aa.update(b),E=b.material;V.push(b,a,E,vb.z,null)}}else if(b.isImmediateRenderObject)k&&vb.setFromMatrixPosition(b.matrixWorld).applyMatrix4(ta),
  V.push(b,null,b.material,vb.z,null);else if(b.isMesh||b.isLine||b.isPoints)if(b.isSkinnedMesh&&b.skeleton.update(),!b.frustumCulled||ra.intersectsObject(b))if(k&&vb.setFromMatrixPosition(b.matrixWorld).applyMatrix4(ta),a=Aa.update(b),E=b.material,Array.isArray(E))for(var h=a.groups,c=0,g=h.length;c<g;c++){var d=h[c],L=E[d.materialIndex];L&&L.visible&&V.push(b,a,L,vb.z,d)}else E.visible&&V.push(b,a,E,vb.z,null);b=b.children;c=0;for(g=b.length;c<g;c++)n(b[c],e,k)}}function U(b,e,k,a){for(var E=0,h=
  b.length;E<h;E++){var c=b[E],g=c.object,d=c.geometry,L=void 0===a?c.material:a,c=c.group;if(k.isArrayCamera){da=k;for(var F=k.cameras,p=0,P=F.length;p<P;p++){var B=F[p];if(g.layers.test(B.layers)){if("viewport"in B)ka.viewport(ea.copy(B.viewport));else{var n=B.bounds;ka.viewport(ea.set(n.x*pa,n.y*fa,n.z*pa,n.w*fa).multiplyScalar(ca))}I.setupLights(B);R(g,e,B,d,L,c)}}}else da=null,R(g,e,k,d,L,c)}}function R(b,h,c,g,d,L){b.onBeforeRender(D,h,c,g,d,L);I=Ca.get(h,da||c);b.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,
  b.matrixWorld);b.normalMatrix.getNormalMatrix(b.modelViewMatrix);if(b.isImmediateRenderObject){ka.setMaterial(d);var F=q(c,h.fog,d,b);k=e=null;a=!1;B(b,F)}else D.renderBufferDirect(c,h.fog,g,d,b,L);b.onAfterRender(D,h,c,g,d,L);I=Ca.get(h,da||c)}function l(b,e,k){var a=la.get(b),E=I.state.lights,h=a.lightsHash,c=E.state.hash;k=wa.getParameters(b,E.state,I.state.shadowsArray,e,ia.numPlanes,ia.numIntersection,k);var g=wa.getProgramCode(b,k),L=a.program,F=!0;if(void 0===L)b.addEventListener("dispose",
  d);else if(L.code!==g)p(b);else{if(h.stateID!==c.stateID||h.directionalLength!==c.directionalLength||h.pointLength!==c.pointLength||h.spotLength!==c.spotLength||h.rectAreaLength!==c.rectAreaLength||h.hemiLength!==c.hemiLength||h.shadowsLength!==c.shadowsLength)h.stateID=c.stateID,h.directionalLength=c.directionalLength,h.pointLength=c.pointLength,h.spotLength=c.spotLength,h.rectAreaLength=c.rectAreaLength,h.hemiLength=c.hemiLength,h.shadowsLength=c.shadowsLength;else if(void 0!==k.shaderID)return;
  F=!1}F&&(k.shaderID?(g=gb[k.shaderID],a.shader={name:b.type,uniforms:Ha.clone(g.uniforms),vertexShader:g.vertexShader,fragmentShader:g.fragmentShader}):a.shader={name:b.type,uniforms:b.uniforms,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader},b.onBeforeCompile(a.shader,D),g=wa.getProgramCode(b,k),L=wa.acquireProgram(b,a.shader,k,g),a.program=L,b.program=L);k=L.getAttributes();if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<D.maxMorphTargets;g++)0<=k["morphTarget"+g]&&b.numSupportedMorphTargets++;
  if(b.morphNormals)for(g=b.numSupportedMorphNormals=0;g<D.maxMorphNormals;g++)0<=k["morphNormal"+g]&&b.numSupportedMorphNormals++;k=a.shader.uniforms;if(!b.isShaderMaterial&&!b.isRawShaderMaterial||!0===b.clipping)a.numClippingPlanes=ia.numPlanes,a.numIntersection=ia.numIntersection,k.clippingPlanes=ia.uniform;a.fog=e;void 0===h&&(a.lightsHash=h={});h.stateID=c.stateID;h.directionalLength=c.directionalLength;h.pointLength=c.pointLength;h.spotLength=c.spotLength;h.rectAreaLength=c.rectAreaLength;h.hemiLength=
  c.hemiLength;h.shadowsLength=c.shadowsLength;b.lights&&(k.ambientLightColor.value=E.state.ambient,k.directionalLights.value=E.state.directional,k.spotLights.value=E.state.spot,k.rectAreaLights.value=E.state.rectArea,k.pointLights.value=E.state.point,k.hemisphereLights.value=E.state.hemi,k.directionalShadowMap.value=E.state.directionalShadowMap,k.directionalShadowMatrix.value=E.state.directionalShadowMatrix,k.spotShadowMap.value=E.state.spotShadowMap,k.spotShadowMatrix.value=E.state.spotShadowMatrix,
  k.pointShadowMap.value=E.state.pointShadowMap,k.pointShadowMatrix.value=E.state.pointShadowMatrix);b=a.program.getUniforms();b=sb.seqWithValue(b.seq,k);a.uniformsList=b}function q(b,e,k,a){ha=0;var E=la.get(k),h=E.lightsHash,c=I.state.lights.state.hash;Rd&&(Pe||b!==oa)&&ia.setState(k.clippingPlanes,k.clipIntersection,k.clipShadows,b,E,b===oa&&k.id===M);!1===k.needsUpdate&&(void 0===E.program?k.needsUpdate=!0:k.fog&&E.fog!==e?k.needsUpdate=!0:!k.lights||h.stateID===c.stateID&&h.directionalLength===
  c.directionalLength&&h.pointLength===c.pointLength&&h.spotLength===c.spotLength&&h.rectAreaLength===c.rectAreaLength&&h.hemiLength===c.hemiLength&&h.shadowsLength===c.shadowsLength?void 0===E.numClippingPlanes||E.numClippingPlanes===ia.numPlanes&&E.numIntersection===ia.numIntersection||(k.needsUpdate=!0):k.needsUpdate=!0);k.needsUpdate&&(l(k,e,a),k.needsUpdate=!1);var g=!1,d=!1,L=!1,h=E.program,c=h.getUniforms(),F=E.shader.uniforms;ka.useProgram(h.program)&&(L=d=g=!0);k.id!==M&&(M=k.id,d=!0);if(g||
  oa!==b){c.setValue(O,"projectionMatrix",b.projectionMatrix);Ma.logarithmicDepthBuffer&&c.setValue(O,"logDepthBufFC",2/(Math.log(b.far+1)/Math.LN2));oa!==b&&(oa=b,L=d=!0);if(k.isShaderMaterial||k.isMeshPhongMaterial||k.isMeshStandardMaterial||k.envMap)g=c.map.cameraPosition,void 0!==g&&g.setValue(O,vb.setFromMatrixPosition(b.matrixWorld));(k.isMeshPhongMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial||k.skinning)&&c.setValue(O,"viewMatrix",b.matrixWorldInverse)}if(k.skinning&&
  (c.setOptional(O,a,"bindMatrix"),c.setOptional(O,a,"bindMatrixInverse"),b=a.skeleton))if(g=b.bones,Ma.floatVertexTextures){if(void 0===b.boneTexture){var g=Math.sqrt(4*g.length),g=ga.ceilPowerOfTwo(g),g=Math.max(g,4),p=new Float32Array(g*g*4);p.set(b.boneMatrices);var P=new A(p,g,g,db,bc);P.needsUpdate=!0;b.boneMatrices=p;b.boneTexture=P;b.boneTextureSize=g}c.setValue(O,"boneTexture",b.boneTexture);c.setValue(O,"boneTextureSize",b.boneTextureSize)}else c.setOptional(O,b,"boneMatrices");d&&(c.setValue(O,
  "toneMappingExposure",D.toneMappingExposure),c.setValue(O,"toneMappingWhitePoint",D.toneMappingWhitePoint),k.lights&&(d=L,F.ambientLightColor.needsUpdate=d,F.directionalLights.needsUpdate=d,F.pointLights.needsUpdate=d,F.spotLights.needsUpdate=d,F.rectAreaLights.needsUpdate=d,F.hemisphereLights.needsUpdate=d),e&&k.fog&&(F.fogColor.value=e.color,e.isFog?(F.fogNear.value=e.near,F.fogFar.value=e.far):e.isFogExp2&&(F.fogDensity.value=e.density)),k.isMeshBasicMaterial?s(F,k):k.isMeshLambertMaterial?(s(F,
  k),k.emissiveMap&&(F.emissiveMap.value=k.emissiveMap)):k.isMeshPhongMaterial?(s(F,k),k.isMeshToonMaterial?(r(F,k),k.gradientMap&&(F.gradientMap.value=k.gradientMap)):r(F,k)):k.isMeshStandardMaterial?(s(F,k),k.isMeshPhysicalMaterial?(u(F,k),F.reflectivity.value=k.reflectivity,F.clearCoat.value=k.clearCoat,F.clearCoatRoughness.value=k.clearCoatRoughness):u(F,k)):k.isMeshMatcapMaterial?(s(F,k),k.matcap&&(F.matcap.value=k.matcap),k.bumpMap&&(F.bumpMap.value=k.bumpMap,F.bumpScale.value=k.bumpScale,k.side===
  Oa&&(F.bumpScale.value*=-1)),k.normalMap&&(F.normalMap.value=k.normalMap,F.normalScale.value.copy(k.normalScale),k.side===Oa&&F.normalScale.value.negate()),k.displacementMap&&(F.displacementMap.value=k.displacementMap,F.displacementScale.value=k.displacementScale,F.displacementBias.value=k.displacementBias)):k.isMeshDepthMaterial?(s(F,k),k.displacementMap&&(F.displacementMap.value=k.displacementMap,F.displacementScale.value=k.displacementScale,F.displacementBias.value=k.displacementBias)):k.isMeshDistanceMaterial?
  (s(F,k),k.displacementMap&&(F.displacementMap.value=k.displacementMap,F.displacementScale.value=k.displacementScale,F.displacementBias.value=k.displacementBias),F.referencePosition.value.copy(k.referencePosition),F.nearDistance.value=k.nearDistance,F.farDistance.value=k.farDistance):k.isMeshNormalMaterial?(s(F,k),k.bumpMap&&(F.bumpMap.value=k.bumpMap,F.bumpScale.value=k.bumpScale,k.side===Oa&&(F.bumpScale.value*=-1)),k.normalMap&&(F.normalMap.value=k.normalMap,F.normalScale.value.copy(k.normalScale),
  k.side===Oa&&F.normalScale.value.negate()),k.displacementMap&&(F.displacementMap.value=k.displacementMap,F.displacementScale.value=k.displacementScale,F.displacementBias.value=k.displacementBias)):k.isLineBasicMaterial?(F.diffuse.value=k.color,F.opacity.value=k.opacity,k.isLineDashedMaterial&&(F.dashSize.value=k.dashSize,F.totalSize.value=k.dashSize+k.gapSize,F.scale.value=k.scale)):k.isPointsMaterial?(F.diffuse.value=k.color,F.opacity.value=k.opacity,F.size.value=k.size*ca,F.scale.value=0.5*fa,F.map.value=
  k.map,null!==k.map&&(!0===k.map.matrixAutoUpdate&&k.map.updateMatrix(),F.uvTransform.value.copy(k.map.matrix))):k.isSpriteMaterial?(F.diffuse.value=k.color,F.opacity.value=k.opacity,F.rotation.value=k.rotation,F.map.value=k.map,null!==k.map&&(!0===k.map.matrixAutoUpdate&&k.map.updateMatrix(),F.uvTransform.value.copy(k.map.matrix))):k.isShadowMaterial&&(F.color.value=k.color,F.opacity.value=k.opacity),void 0!==F.ltc_1&&(F.ltc_1.value=Z.LTC_1),void 0!==F.ltc_2&&(F.ltc_2.value=Z.LTC_2),sb.upload(O,E.uniformsList,
  F,D));k.isShaderMaterial&&!0===k.uniformsNeedUpdate&&(sb.upload(O,E.uniformsList,F,D),k.uniformsNeedUpdate=!1);k.isSpriteMaterial&&c.setValue(O,"center",a.center);c.setValue(O,"modelViewMatrix",a.modelViewMatrix);c.setValue(O,"normalMatrix",a.normalMatrix);c.setValue(O,"modelMatrix",a.matrixWorld);return h}function s(b,e){b.opacity.value=e.opacity;e.color&&(b.diffuse.value=e.color);e.emissive&&b.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity);e.map&&(b.map.value=e.map);e.alphaMap&&
  (b.alphaMap.value=e.alphaMap);e.specularMap&&(b.specularMap.value=e.specularMap);e.envMap&&(b.envMap.value=e.envMap,b.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,b.reflectivity.value=e.reflectivity,b.refractionRatio.value=e.refractionRatio,b.maxMipLevel.value=la.get(e.envMap).__maxMipLevel);e.lightMap&&(b.lightMap.value=e.lightMap,b.lightMapIntensity.value=e.lightMapIntensity);e.aoMap&&(b.aoMap.value=e.aoMap,b.aoMapIntensity.value=e.aoMapIntensity);var k;e.map?k=e.map:e.specularMap?k=e.specularMap:
  e.displacementMap?k=e.displacementMap:e.normalMap?k=e.normalMap:e.bumpMap?k=e.bumpMap:e.roughnessMap?k=e.roughnessMap:e.metalnessMap?k=e.metalnessMap:e.alphaMap?k=e.alphaMap:e.emissiveMap&&(k=e.emissiveMap);void 0!==k&&(k.isWebGLRenderTarget&&(k=k.texture),!0===k.matrixAutoUpdate&&k.updateMatrix(),b.uvTransform.value.copy(k.matrix))}function r(b,e){b.specular.value=e.specular;b.shininess.value=Math.max(e.shininess,1E-4);e.emissiveMap&&(b.emissiveMap.value=e.emissiveMap);e.bumpMap&&(b.bumpMap.value=
  e.bumpMap,b.bumpScale.value=e.bumpScale,e.side===Oa&&(b.bumpScale.value*=-1));e.normalMap&&(b.normalMap.value=e.normalMap,b.normalScale.value.copy(e.normalScale),e.side===Oa&&b.normalScale.value.negate());e.displacementMap&&(b.displacementMap.value=e.displacementMap,b.displacementScale.value=e.displacementScale,b.displacementBias.value=e.displacementBias)}function u(b,e){b.roughness.value=e.roughness;b.metalness.value=e.metalness;e.roughnessMap&&(b.roughnessMap.value=e.roughnessMap);e.metalnessMap&&
  (b.metalnessMap.value=e.metalnessMap);e.emissiveMap&&(b.emissiveMap.value=e.emissiveMap);e.bumpMap&&(b.bumpMap.value=e.bumpMap,b.bumpScale.value=e.bumpScale,e.side===Oa&&(b.bumpScale.value*=-1));e.normalMap&&(b.normalMap.value=e.normalMap,b.normalScale.value.copy(e.normalScale),e.side===Oa&&b.normalScale.value.negate());e.displacementMap&&(b.displacementMap.value=e.displacementMap,b.displacementScale.value=e.displacementScale,b.displacementBias.value=e.displacementBias);e.envMap&&(b.envMapIntensity.value=
  e.envMapIntensity)}console.log("THREE.WebGLRenderer",mh);b=b||{};var z=void 0!==b.canvas?b.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),w=void 0!==b.context?b.context:null,G=void 0!==b.alpha?b.alpha:!1,v=void 0!==b.depth?b.depth:!0,S=void 0!==b.stencil?b.stencil:!0,x=void 0!==b.antialias?b.antialias:!1,H=void 0!==b.premultipliedAlpha?b.premultipliedAlpha:!0,y=void 0!==b.preserveDrawingBuffer?b.preserveDrawingBuffer:!1,C=void 0!==b.powerPreference?b.powerPreference:"default",
  V=null,I=null;this.domElement=z;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMapping=Ke;this.toneMappingWhitePoint=this.toneMappingExposure=1;this.maxMorphTargets=8;this.maxMorphNormals=4;var D=this,J=!1,ja=null,N=null,T=null,M=-1;k=e=null;a=!1;var oa=null,da=null,ea=new t,ba=new t,X=null,
  ha=0,pa=z.width,fa=z.height,ca=1,ma=new t(0,0,pa,fa),na=new t(0,0,pa,fa),$=!1,ra=new K,ia=new Ge,Rd=!1,Pe=!1,ta=new f,vb=new m,O;try{G={alpha:G,depth:v,stencil:S,antialias:x,premultipliedAlpha:H,preserveDrawingBuffer:y,powerPreference:C};z.addEventListener("webglcontextlost",c,!1);z.addEventListener("webglcontextrestored",g,!1);O=w||z.getContext("webgl",G)||z.getContext("experimental-webgl",G);if(null===O){if(null!==z.getContext("webgl"))throw Error("Error creating WebGL context with your selected attributes.");
  throw Error("Error creating WebGL context.");}void 0===O.getShaderPrecisionFormat&&(O.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(za){console.error("THREE.WebGLRenderer: "+za.message)}var xa,Ma,ka,qa,la,sa,Ba,Da,Aa,wa,Ea,Ca,ua,Ia,Ka,La,Ta;h();var ya="xr"in navigator?new Qi(D):new lh(D);this.vr=ya;var Na=new qg(D,Aa,Ma.maxTextureSize);this.shadowMap=Na;this.getContext=function(){return O};this.getContextAttributes=function(){return O.getContextAttributes()};
  this.forceContextLoss=function(){var b=xa.get("WEBGL_lose_context");b&&b.loseContext()};this.forceContextRestore=function(){var b=xa.get("WEBGL_lose_context");b&&b.restoreContext()};this.getPixelRatio=function(){return ca};this.setPixelRatio=function(b){void 0!==b&&(ca=b,this.setSize(pa,fa,!1))};this.getSize=function(){return{width:pa,height:fa}};this.setSize=function(b,e,k){ya.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(pa=b,fa=e,z.width=
  b*ca,z.height=e*ca,!1!==k&&(z.style.width=b+"px",z.style.height=e+"px"),this.setViewport(0,0,b,e))};this.getDrawingBufferSize=function(){return{width:pa*ca,height:fa*ca}};this.setDrawingBufferSize=function(b,e,k){pa=b;fa=e;ca=k;z.width=b*k;z.height=e*k;this.setViewport(0,0,b,e)};this.getCurrentViewport=function(){return ea};this.setViewport=function(b,e,k,a){ma.set(b,fa-e-a,k,a);ka.viewport(ea.copy(ma).multiplyScalar(ca))};this.setScissor=function(b,e,k,a){na.set(b,fa-e-a,k,a);ka.scissor(ba.copy(na).multiplyScalar(ca))};
  this.setScissorTest=function(b){ka.setScissorTest($=b)};this.getClearColor=function(){return ua.getClearColor()};this.setClearColor=function(){ua.setClearColor.apply(ua,arguments)};this.getClearAlpha=function(){return ua.getClearAlpha()};this.setClearAlpha=function(){ua.setClearAlpha.apply(ua,arguments)};this.clear=function(b,e,k){var a=0;if(void 0===b||b)a|=O.COLOR_BUFFER_BIT;if(void 0===e||e)a|=O.DEPTH_BUFFER_BIT;if(void 0===k||k)a|=O.STENCIL_BUFFER_BIT;O.clear(a)};this.clearColor=function(){this.clear(!0,
  !1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.dispose=function(){z.removeEventListener("webglcontextlost",c,!1);z.removeEventListener("webglcontextrestored",g,!1);Ea.dispose();Ca.dispose();la.dispose();Aa.dispose();ya.dispose();Fa.stop()};this.renderBufferImmediate=function(b,e){ka.initAttributes();var k=la.get(b);b.hasPositions&&!k.position&&(k.position=O.createBuffer());b.hasNormals&&!k.normal&&(k.normal=O.createBuffer());b.hasUvs&&
  !k.uv&&(k.uv=O.createBuffer());b.hasColors&&!k.color&&(k.color=O.createBuffer());var a=e.getAttributes();b.hasPositions&&(O.bindBuffer(O.ARRAY_BUFFER,k.position),O.bufferData(O.ARRAY_BUFFER,b.positionArray,O.DYNAMIC_DRAW),ka.enableAttribute(a.position),O.vertexAttribPointer(a.position,3,O.FLOAT,!1,0,0));b.hasNormals&&(O.bindBuffer(O.ARRAY_BUFFER,k.normal),O.bufferData(O.ARRAY_BUFFER,b.normalArray,O.DYNAMIC_DRAW),ka.enableAttribute(a.normal),O.vertexAttribPointer(a.normal,3,O.FLOAT,!1,0,0));b.hasUvs&&
  (O.bindBuffer(O.ARRAY_BUFFER,k.uv),O.bufferData(O.ARRAY_BUFFER,b.uvArray,O.DYNAMIC_DRAW),ka.enableAttribute(a.uv),O.vertexAttribPointer(a.uv,2,O.FLOAT,!1,0,0));b.hasColors&&(O.bindBuffer(O.ARRAY_BUFFER,k.color),O.bufferData(O.ARRAY_BUFFER,b.colorArray,O.DYNAMIC_DRAW),ka.enableAttribute(a.color),O.vertexAttribPointer(a.color,3,O.FLOAT,!1,0,0));ka.disableUnusedAttributes();O.drawArrays(O.TRIANGLES,0,b.count);b.count=0};this.renderBufferDirect=function(b,h,c,g,d,L){var F=d.isMesh&&0>d.normalMatrix.determinant();
  ka.setMaterial(g,F);var p=q(b,h,g,d),P=!1;if(e!==c.id||k!==p.id||a!==(!0===g.wireframe))e=c.id,k=p.id,a=!0===g.wireframe,P=!0;d.morphTargetInfluences&&(Ia.update(d,c,g,p),P=!0);var F=c.index,B=c.attributes.position;h=1;!0===g.wireframe&&(F=Da.getWireframeAttribute(c),h=2);var n;b=Ka;null!==F&&(n=Ba.get(F),b=La,b.setIndex(n));if(P){if(c&&c.isInstancedBufferGeometry&!Ma.isWebGL2&&null===xa.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
  else{ka.initAttributes();var P=c.attributes,p=p.getAttributes(),f=g.defaultAttributeValues,m;for(m in p){var U=p[m];if(0<=U){var va=P[m];if(void 0!==va){var R=va.normalized,l=va.itemSize,s=Ba.get(va);if(void 0!==s){var Ga=s.buffer,z=s.type,s=s.bytesPerElement;if(va.isInterleavedBufferAttribute){var Y=va.data,r=Y.stride,va=va.offset;Y&&Y.isInstancedInterleavedBuffer?(ka.enableAttributeAndDivisor(U,Y.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=Y.meshPerAttribute*Y.count)):ka.enableAttribute(U);
  O.bindBuffer(O.ARRAY_BUFFER,Ga);O.vertexAttribPointer(U,l,z,R,r*s,va*s)}else va.isInstancedBufferAttribute?(ka.enableAttributeAndDivisor(U,va.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=va.meshPerAttribute*va.count)):ka.enableAttribute(U),O.bindBuffer(O.ARRAY_BUFFER,Ga),O.vertexAttribPointer(U,l,z,R,0,0)}}else if(void 0!==f&&(R=f[m],void 0!==R))switch(R.length){case 2:O.vertexAttrib2fv(U,R);break;case 3:O.vertexAttrib3fv(U,R);break;case 4:O.vertexAttrib4fv(U,R);break;default:O.vertexAttrib1fv(U,
  R)}}}ka.disableUnusedAttributes()}null!==F&&O.bindBuffer(O.ELEMENT_ARRAY_BUFFER,n.buffer)}n=Infinity;null!==F?n=F.count:void 0!==B&&(n=B.count);m=c.drawRange.start*h;F=c.drawRange.count*h;B=null!==L?L.start*h:0;h=null!==L?L.count*h:Infinity;L=Math.max(m,B);h=Math.min(n,m+F,B+h)-1;h=Math.max(0,h-L+1);if(0!==h){if(d.isMesh)if(!0===g.wireframe)ka.setLineWidth(g.wireframeLinewidth*(null===N?ca:1)),b.setMode(O.LINES);else switch(d.drawMode){case Ce:b.setMode(O.TRIANGLES);break;case nh:b.setMode(O.TRIANGLE_STRIP);
  break;case oh:b.setMode(O.TRIANGLE_FAN)}else d.isLine?(g=g.linewidth,void 0===g&&(g=1),ka.setLineWidth(g*(null===N?ca:1)),d.isLineSegments?b.setMode(O.LINES):d.isLineLoop?b.setMode(O.LINE_LOOP):b.setMode(O.LINE_STRIP)):d.isPoints?b.setMode(O.POINTS):d.isSprite&&b.setMode(O.TRIANGLES);c&&c.isInstancedBufferGeometry?0<c.maxInstancedCount&&b.renderInstances(c,L,h):b.render(L,h)}};this.compile=function(b,e){I=Ca.get(b,e);I.init();b.traverse(function(b){b.isLight&&(I.pushLight(b),b.castShadow&&I.pushShadow(b))});
  I.setupLights(e);b.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var k=0;k<e.material.length;k++)l(e.material[k],b.fog,e);else l(e.material,b.fog,e)})};var Ja=null,Fa=new W;Fa.setAnimationLoop(function(b){ya.isPresenting()||Ja&&Ja(b)});"undefined"!==typeof window&&Fa.setContext(window);this.setAnimationLoop=function(b){Ja=b;ya.setAnimationLoop(b);Fa.start()};this.render=function(b,h,c,g){if(!h||!h.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
  else if(!J){k=e=null;a=!1;M=-1;oa=null;!0===b.autoUpdate&&b.updateMatrixWorld();null===h.parent&&h.updateMatrixWorld();ya.enabled&&(h=ya.getCamera(h));I=Ca.get(b,h);I.init();b.onBeforeRender(D,b,h,c);ta.multiplyMatrices(h.projectionMatrix,h.matrixWorldInverse);ra.setFromMatrix(ta);Pe=this.localClippingEnabled;Rd=ia.init(this.clippingPlanes,Pe,h);V=Ea.get(b,h);V.init();n(b,h,D.sortObjects);!0===D.sortObjects&&V.sort();Rd&&ia.beginShadows();Na.render(I.state.shadowsArray,b,h);I.setupLights(h);Rd&&ia.endShadows();
  this.info.autoReset&&this.info.reset();void 0===c&&(c=null);this.setRenderTarget(c);ua.render(V,b,h,g);g=V.opaque;var d=V.transparent;if(b.overrideMaterial){var L=b.overrideMaterial;g.length&&U(g,b,h,L);d.length&&U(d,b,h,L)}else g.length&&U(g,b,h),d.length&&U(d,b,h);c&&sa.updateRenderTargetMipmap(c);ka.buffers.depth.setTest(!0);ka.buffers.depth.setMask(!0);ka.buffers.color.setMask(!0);ka.setPolygonOffset(!1);b.onAfterRender(D,b,h);ya.enabled&&ya.submitFrame();I=V=null}};this.allocTextureUnit=function(){var b=
  ha;b>=Ma.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+b+" texture units while this GPU supports only "+Ma.maxTextures);ha+=1;return b};this.setTexture2D=function(){var b=!1;return function(e,k){e&&e.isWebGLRenderTarget&&(b||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),b=!0),e=e.texture);sa.setTexture2D(e,k)}}();this.setTexture3D=function(){return function(b,e){sa.setTexture3D(b,e)}}();this.setTexture=
  function(){var b=!1;return function(e,k){b||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),b=!0);sa.setTexture2D(e,k)}}();this.setTextureCube=function(){var b=!1;return function(e,k){e&&e.isWebGLRenderTargetCube&&(b||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),b=!0),e=e.texture);e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?sa.setTextureCube(e,k):sa.setTextureCubeDynamic(e,
  k)}}();this.setFramebuffer=function(b){ja=b};this.getRenderTarget=function(){return N};this.setRenderTarget=function(b){(N=b)&&void 0===la.get(b).__webglFramebuffer&&sa.setupRenderTarget(b);var e=ja,k=!1;b?(e=la.get(b).__webglFramebuffer,b.isWebGLRenderTargetCube&&(e=e[b.activeCubeFace],k=!0),ea.copy(b.viewport),ba.copy(b.scissor),X=b.scissorTest):(ea.copy(ma).multiplyScalar(ca),ba.copy(na).multiplyScalar(ca),X=$);T!==e&&(O.bindFramebuffer(O.FRAMEBUFFER,e),T=e);ka.viewport(ea);ka.scissor(ba);ka.setScissorTest(X);
  k&&(k=la.get(b.texture),O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+b.activeCubeFace,k.__webglTexture,b.activeMipMapLevel))};this.readRenderTargetPixels=function(b,e,k,a,E,h){if(b&&b.isWebGLRenderTarget){var c=la.get(b).__webglFramebuffer;if(c){var g=!1;c!==T&&(O.bindFramebuffer(O.FRAMEBUFFER,c),g=!0);try{var d=b.texture,L=d.format,F=d.type;L!==db&&Ta.convert(L)!==O.getParameter(O.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):
  F===Hd||Ta.convert(F)===O.getParameter(O.IMPLEMENTATION_COLOR_READ_TYPE)||F===bc&&(Ma.isWebGL2||xa.get("OES_texture_float")||xa.get("WEBGL_color_buffer_float"))||F===Xd&&(Ma.isWebGL2?xa.get("EXT_color_buffer_float"):xa.get("EXT_color_buffer_half_float"))?O.checkFramebufferStatus(O.FRAMEBUFFER)===O.FRAMEBUFFER_COMPLETE?0<=e&&e<=b.width-a&&0<=k&&k<=b.height-E&&O.readPixels(e,k,a,E,Ta.convert(L),Ta.convert(F),h):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):
  console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{g&&O.bindFramebuffer(O.FRAMEBUFFER,T)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")};this.copyFramebufferToTexture=function(b,e,k){var a=e.image.width,E=e.image.height,h=Ta.convert(e.format);this.setTexture2D(e,0);O.copyTexImage2D(O.TEXTURE_2D,k||0,h,b.x,b.y,a,E,0)};this.copyTextureToTexture=
  function(b,e,k,a){var E=e.image.width,h=e.image.height,c=Ta.convert(k.format),g=Ta.convert(k.type);this.setTexture2D(k,0);e.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,a||0,b.x,b.y,E,h,c,g,e.image.data):O.texSubImage2D(O.TEXTURE_2D,a||0,b.x,b.y,c,g,e.image)}}function fc(b,e){this.name="";this.color=new w(b);this.density=void 0!==e?e:2.5E-4}function hc(b,e,k){this.name="";this.color=new w(b);this.near=void 0!==e?e:1;this.far=void 0!==k?k:1E3}function $d(){D.call(this);this.type="Scene";this.overrideMaterial=
  this.fog=this.background=null;this.autoUpdate=!0}function Cb(b,e){this.array=b;this.stride=e;this.count=void 0!==b?b.length/e:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function Sc(b,e,k,a){this.data=b;this.itemSize=e;this.offset=k;this.normalized=!0===a}function wb(b){T.call(this);this.type="SpriteMaterial";this.color=new w(16777215);this.map=null;this.rotation=0;this.sizeAttenuation=!0;this.lights=!1;this.transparent=!0;this.setValues(b)}function Tc(b){D.call(this);this.type=
  "Sprite";if(void 0===ic){ic=new M;var e=new Float32Array([-0.5,-0.5,0,0,0,0.5,-0.5,0,1,0,0.5,0.5,0,1,1,-0.5,0.5,0,0,1]),e=new Cb(e,5);ic.setIndex([0,1,2,0,2,3]);ic.addAttribute("position",new Sc(e,3,0,!1));ic.addAttribute("uv",new Sc(e,2,3,!1))}this.geometry=ic;this.material=void 0!==b?b:new wb;this.center=new d(0.5,0.5)}function Uc(){D.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Vc(b,e){b=b||[];this.bones=b.slice(0);this.boneMatrices=new Float32Array(16*
  this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length.");this.boneInverses=[];for(var k=0,a=this.bones.length;k<a;k++)this.boneInverses.push(new f)}}function ae(){D.call(this);this.type="Bone"}function be(b,e){wa.call(this,b,e);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new f;this.bindMatrixInverse=new f;var k=this.initBones(),k=new Vc(k);this.bind(k,
  this.matrixWorld);this.normalizeSkinWeights()}function na(b){T.call(this);this.type="LineBasicMaterial";this.color=new w(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.lights=!1;this.setValues(b)}function ya(b,e,k){1===k&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.");D.call(this);this.type="Line";this.geometry=void 0!==b?b:new M;this.material=void 0!==e?e:new na({color:16777215*Math.random()})}function ra(b,e){ya.call(this,
  b,e);this.type="LineSegments"}function ce(b,e){ya.call(this,b,e);this.type="LineLoop"}function Va(b){T.call(this);this.type="PointsMaterial";this.color=new w(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.lights=this.morphTargets=!1;this.setValues(b)}function jc(b,e){D.call(this);this.type="Points";this.geometry=void 0!==b?b:new M;this.material=void 0!==e?e:new Va({color:16777215*Math.random()})}function cf(b,e,k,a,h,c,g,d,p){q.call(this,b,e,k,a,h,c,g,d,p);this.generateMipmaps=!1}
  function kc(b,e,k,a,h,c,g,d,p,B,n,f){q.call(this,null,c,g,d,p,B,a,h,n,f);this.image={width:e,height:k};this.mipmaps=b;this.generateMipmaps=this.flipY=!1}function Wc(b,e,k,a,h,c,g,d,p){q.call(this,b,e,k,a,h,c,g,d,p);this.needsUpdate=!0}function Xc(b,e,k,a,h,c,g,d,p,B){B=void 0!==B?B:Ab;if(B!==Ab&&B!==cc)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===k&&B===Ab&&(k=Pc);void 0===k&&B===cc&&(k=Qc);q.call(this,null,a,h,c,g,d,B,k,p);this.image={width:b,
  height:e};this.magFilter=void 0!==g?g:La;this.minFilter=void 0!==d?d:La;this.generateMipmaps=this.flipY=!1}function lc(b){M.call(this);this.type="WireframeGeometry";var e=[],k,a,h,c,g=[0,0],d={},p,B,n=["a","b","c"];if(b&&b.isGeometry){var f=b.faces;k=0;for(h=f.length;k<h;k++){var R=f[k];for(a=0;3>a;a++)p=R[n[a]],B=R[n[(a+1)%3]],g[0]=Math.min(p,B),g[1]=Math.max(p,B),p=g[0]+","+g[1],void 0===d[p]&&(d[p]={index1:g[0],index2:g[1]})}for(p in d)k=d[p],n=b.vertices[k.index1],e.push(n.x,n.y,n.z),n=b.vertices[k.index2],
  e.push(n.x,n.y,n.z)}else if(b&&b.isBufferGeometry){var l,n=new m;if(null!==b.index){f=b.attributes.position;R=b.index;l=b.groups;0===l.length&&(l=[{start:0,count:R.count,materialIndex:0}]);b=0;for(c=l.length;b<c;++b)for(k=l[b],a=k.start,h=k.count,k=a,h=a+h;k<h;k+=3)for(a=0;3>a;a++)p=R.getX(k+a),B=R.getX(k+(a+1)%3),g[0]=Math.min(p,B),g[1]=Math.max(p,B),p=g[0]+","+g[1],void 0===d[p]&&(d[p]={index1:g[0],index2:g[1]});for(p in d)k=d[p],n.fromBufferAttribute(f,k.index1),e.push(n.x,n.y,n.z),n.fromBufferAttribute(f,
  k.index2),e.push(n.x,n.y,n.z)}else for(f=b.attributes.position,k=0,h=f.count/3;k<h;k++)for(a=0;3>a;a++)d=3*k+a,n.fromBufferAttribute(f,d),e.push(n.x,n.y,n.z),d=3*k+(a+1)%3,n.fromBufferAttribute(f,d),e.push(n.x,n.y,n.z)}this.addAttribute("position",new N(e,3))}function Yc(b,e,k){g.call(this);this.type="ParametricGeometry";this.parameters={func:b,slices:e,stacks:k};this.fromBufferGeometry(new mc(b,e,k));this.mergeVertices()}function mc(b,e,k){M.call(this);this.type="ParametricBufferGeometry";this.parameters=
  {func:b,slices:e,stacks:k};var a=[],h=[],c=[],g=[],d=new m,p=new m,B=new m,n=new m,f=new m,R,l;3>b.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var q=e+1;for(R=0;R<=k;R++){var s=R/k;for(l=0;l<=e;l++){var r=l/e;b(r,s,p);h.push(p.x,p.y,p.z);0<=r-1E-5?(b(r-1E-5,s,B),n.subVectors(p,B)):(b(r+1E-5,s,B),n.subVectors(B,p));0<=s-1E-5?(b(r,s-1E-5,B),f.subVectors(p,B)):(b(r,s+1E-5,B),f.subVectors(B,p));d.crossVectors(n,f).normalize();c.push(d.x,d.y,
  d.z);g.push(r,s)}}for(R=0;R<k;R++)for(l=0;l<e;l++)b=R*q+l+1,d=(R+1)*q+l+1,p=(R+1)*q+l,a.push(R*q+l,b,p),a.push(b,d,p);this.setIndex(a);this.addAttribute("position",new N(h,3));this.addAttribute("normal",new N(c,3));this.addAttribute("uv",new N(g,2))}function Zc(b,e,k,a){g.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:b,indices:e,radius:k,detail:a};this.fromBufferGeometry(new Na(b,e,k,a));this.mergeVertices()}function Na(b,e,k,a){function h(b){P.push(b.x,b.y,b.z)}function c(e,
  k){var a=3*e;k.x=b[a+0];k.y=b[a+1];k.z=b[a+2]}function g(b,e,k,a){0>a&&1===b.x&&(p[e]=b.x-1);0===k.x&&0===k.z&&(p[e]=a/2/Math.PI+0.5)}M.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:b,indices:e,radius:k,detail:a};k=k||1;a=a||0;var P=[],p=[];(function(b){for(var k=new m,a=new m,E=new m,g=0;g<e.length;g+=3){c(e[g+0],k);c(e[g+1],a);c(e[g+2],E);for(var d=k,F=a,p=E,P=Math.pow(2,b),n=[],f=void 0,l=void 0,f=0;f<=P;f++){n[f]=[];for(var q=d.clone().lerp(p,f/P),s=F.clone().lerp(p,
  f/P),r=P-f,l=0;l<=r;l++)n[f][l]=0===l&&f===P?q:q.clone().lerp(s,l/r)}for(f=0;f<P;f++)for(l=0;l<2*(P-f)-1;l++)d=Math.floor(l/2),0===l%2?(h(n[f][d+1]),h(n[f+1][d]),h(n[f][d])):(h(n[f][d+1]),h(n[f+1][d+1]),h(n[f+1][d]))}})(a);(function(b){for(var e=new m,k=0;k<P.length;k+=3)e.x=P[k+0],e.y=P[k+1],e.z=P[k+2],e.normalize().multiplyScalar(b),P[k+0]=e.x,P[k+1]=e.y,P[k+2]=e.z})(k);(function(){for(var b=new m,e=0;e<P.length;e+=3){b.x=P[e+0];b.y=P[e+1];b.z=P[e+2];var k=Math.atan2(b.z,-b.x)/2/Math.PI+0.5,a=Math.atan2(-b.y,
  Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5;p.push(k,1-a)}for(var b=new m,e=new m,k=new m,a=new m,E=new d,h=new d,c=new d,L=0,n=0;L<P.length;L+=9,n+=6){b.set(P[L+0],P[L+1],P[L+2]);e.set(P[L+3],P[L+4],P[L+5]);k.set(P[L+6],P[L+7],P[L+8]);E.set(p[n+0],p[n+1]);h.set(p[n+2],p[n+3]);c.set(p[n+4],p[n+5]);a.copy(b).add(e).add(k).divideScalar(3);var f=Math.atan2(a.z,-a.x);g(E,n+0,b,f);g(h,n+2,e,f);g(c,n+4,k,f)}for(b=0;b<p.length;b+=6)e=p[b+0],k=p[b+2],a=p[b+4],E=Math.max(e,k,a),h=Math.min(e,k,a),0.9<E&&0.1>h&&
  (0.2>e&&(p[b+0]+=1),0.2>k&&(p[b+2]+=1),0.2>a&&(p[b+4]+=1))})();this.addAttribute("position",new N(P,3));this.addAttribute("normal",new N(P.slice(),3));this.addAttribute("uv",new N(p,2));0===a?this.computeVertexNormals():this.normalizeNormals()}function $c(b,e){g.call(this);this.type="TetrahedronGeometry";this.parameters={radius:b,detail:e};this.fromBufferGeometry(new nc(b,e));this.mergeVertices()}function nc(b,e){Na.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],b,e);this.type=
  "TetrahedronBufferGeometry";this.parameters={radius:b,detail:e}}function ad(b,e){g.call(this);this.type="OctahedronGeometry";this.parameters={radius:b,detail:e};this.fromBufferGeometry(new Db(b,e));this.mergeVertices()}function Db(b,e){Na.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],b,e);this.type="OctahedronBufferGeometry";this.parameters={radius:b,detail:e}}function bd(b,e){g.call(this);this.type="IcosahedronGeometry";this.parameters={radius:b,
  detail:e};this.fromBufferGeometry(new oc(b,e));this.mergeVertices()}function oc(b,e){var k=(1+Math.sqrt(5))/2;Na.call(this,[-1,k,0,1,k,0,-1,-k,0,1,-k,0,0,-1,k,0,1,k,0,-1,-k,0,1,-k,k,0,-1,k,0,1,-k,0,-1,-k,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],b,e);this.type="IcosahedronBufferGeometry";this.parameters={radius:b,detail:e}}function cd(b,e){g.call(this);this.type="DodecahedronGeometry";this.parameters={radius:b,
  detail:e};this.fromBufferGeometry(new pc(b,e));this.mergeVertices()}function pc(b,e){var k=(1+Math.sqrt(5))/2,a=1/k;Na.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-a,-k,0,-a,k,0,a,-k,0,a,k,-a,-k,0,-a,k,0,a,-k,0,a,k,0,-k,0,-a,k,0,-a,-k,0,a,k,0,a],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,
  14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],b,e);this.type="DodecahedronBufferGeometry";this.parameters={radius:b,detail:e}}function dd(b,e,k,a,h,c){g.call(this);this.type="TubeGeometry";this.parameters={path:b,tubularSegments:e,radius:k,radialSegments:a,closed:h};void 0!==c&&console.warn("THREE.TubeGeometry: taper has been removed.");b=new qc(b,e,k,a,h);this.tangents=b.tangents;this.normals=b.normals;this.binormals=b.binormals;this.fromBufferGeometry(b);this.mergeVertices()}function qc(b,e,k,a,h){function c(h){n=
  b.getPointAt(h/e,n);var d=g.normals[h];h=g.binormals[h];for(R=0;R<=a;R++){var L=R/a*Math.PI*2,B=Math.sin(L),L=-Math.cos(L);p.x=L*d.x+B*h.x;p.y=L*d.y+B*h.y;p.z=L*d.z+B*h.z;p.normalize();q.push(p.x,p.y,p.z);P.x=n.x+k*p.x;P.y=n.y+k*p.y;P.z=n.z+k*p.z;l.push(P.x,P.y,P.z)}}M.call(this);this.type="TubeBufferGeometry";this.parameters={path:b,tubularSegments:e,radius:k,radialSegments:a,closed:h};e=e||64;k=k||1;a=a||8;h=h||!1;var g=b.computeFrenetFrames(e,h);this.tangents=g.tangents;this.normals=g.normals;
  this.binormals=g.binormals;var P=new m,p=new m,B=new d,n=new m,f,R,l=[],q=[],s=[],r=[];for(f=0;f<e;f++)c(f);c(!1===h?e:0);for(f=0;f<=e;f++)for(R=0;R<=a;R++)B.x=f/e,B.y=R/a,s.push(B.x,B.y);(function(){for(R=1;R<=e;R++)for(f=1;f<=a;f++){var b=(a+1)*R+(f-1),k=(a+1)*R+f,h=(a+1)*(R-1)+f;r.push((a+1)*(R-1)+(f-1),b,h);r.push(b,k,h)}})();this.setIndex(r);this.addAttribute("position",new N(l,3));this.addAttribute("normal",new N(q,3));this.addAttribute("uv",new N(s,2))}function ed(b,e,k,a,h,c,d){g.call(this);
  this.type="TorusKnotGeometry";this.parameters={radius:b,tube:e,tubularSegments:k,radialSegments:a,p:h,q:c};void 0!==d&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.");this.fromBufferGeometry(new rc(b,e,k,a,h,c));this.mergeVertices()}function rc(b,e,k,a,h,c){function g(b,e,k,a,E){var h=Math.cos(b),c=Math.sin(b);b*=k/e;e=Math.cos(b);E.x=a*(2+e)*0.5*h;E.y=a*(2+e)*c*0.5;E.z=a*Math.sin(b)*0.5}M.call(this);this.type="TorusKnotBufferGeometry";this.parameters=
  {radius:b,tube:e,tubularSegments:k,radialSegments:a,p:h,q:c};b=b||1;e=e||0.4;k=Math.floor(k)||64;a=Math.floor(a)||8;h=h||2;c=c||3;var d=[],p=[],B=[],n=[],f,R,l=new m,q=new m,s=new m,r=new m,t=new m,z=new m,u=new m;for(f=0;f<=k;++f)for(R=f/k*h*Math.PI*2,g(R,h,c,b,s),g(R+0.01,h,c,b,r),z.subVectors(r,s),u.addVectors(r,s),t.crossVectors(z,u),u.crossVectors(t,z),t.normalize(),u.normalize(),R=0;R<=a;++R){var w=R/a*Math.PI*2,G=-e*Math.cos(w),w=e*Math.sin(w);l.x=s.x+(G*u.x+w*t.x);l.y=s.y+(G*u.y+w*t.y);l.z=
  s.z+(G*u.z+w*t.z);p.push(l.x,l.y,l.z);q.subVectors(l,s).normalize();B.push(q.x,q.y,q.z);n.push(f/k);n.push(R/a)}for(R=1;R<=k;R++)for(f=1;f<=a;f++)b=(a+1)*R+(f-1),e=(a+1)*R+f,h=(a+1)*(R-1)+f,d.push((a+1)*(R-1)+(f-1),b,h),d.push(b,e,h);this.setIndex(d);this.addAttribute("position",new N(p,3));this.addAttribute("normal",new N(B,3));this.addAttribute("uv",new N(n,2))}function fd(b,e,k,a,h){g.call(this);this.type="TorusGeometry";this.parameters={radius:b,tube:e,radialSegments:k,tubularSegments:a,arc:h};
  this.fromBufferGeometry(new sc(b,e,k,a,h));this.mergeVertices()}function sc(b,e,k,a,h){M.call(this);this.type="TorusBufferGeometry";this.parameters={radius:b,tube:e,radialSegments:k,tubularSegments:a,arc:h};b=b||1;e=e||0.4;k=Math.floor(k)||8;a=Math.floor(a)||6;h=h||2*Math.PI;var c=[],g=[],d=[],p=[],B=new m,n=new m,f=new m,l,q;for(l=0;l<=k;l++)for(q=0;q<=a;q++){var s=q/a*h,r=l/k*Math.PI*2;n.x=(b+e*Math.cos(r))*Math.cos(s);n.y=(b+e*Math.cos(r))*Math.sin(s);n.z=e*Math.sin(r);g.push(n.x,n.y,n.z);B.x=
  b*Math.cos(s);B.y=b*Math.sin(s);f.subVectors(n,B).normalize();d.push(f.x,f.y,f.z);p.push(q/a);p.push(l/k)}for(l=1;l<=k;l++)for(q=1;q<=a;q++)b=(a+1)*(l-1)+q-1,e=(a+1)*(l-1)+q,h=(a+1)*l+q,c.push((a+1)*l+q-1,b,h),c.push(b,e,h);this.setIndex(c);this.addAttribute("position",new N(g,3));this.addAttribute("normal",new N(d,3));this.addAttribute("uv",new N(p,2))}function ph(b,e,k,a,h){for(var c,g=0,d=e,p=k-a;d<k;d+=a)g+=(b[p]-b[d])*(b[d+1]+b[p+1]),p=d;if(h===0<g)for(h=e;h<k;h+=a)c=qh(h,b[h],b[h+1],c);else for(h=
  k-a;h>=e;h-=a)c=qh(h,b[h],b[h+1],c);c&&Eb(c,c.next)&&(gd(c),c=c.next);return c}function hd(b,e){if(!b)return b;e||(e=b);var k=b,a;do if(a=!1,k.steiner||!Eb(k,k.next)&&0!==Ia(k.prev,k,k.next))k=k.next;else{gd(k);k=e=k.prev;if(k===k.next)break;a=!0}while(a||k!==e);return e}function id(b,e,k,a,h,c,g){if(b){if(!g&&c){var d=b,p=d;do null===p.z&&(p.z=df(p.x,p.y,a,h,c)),p.prevZ=p.prev,p=p.nextZ=p.next;while(p!==d);p.prevZ.nextZ=null;p.prevZ=null;var d=p,B,n,f,m,l,q,s=1;do{p=d;f=d=null;for(m=0;p;){m++;n=
  p;for(B=l=0;B<s&&(l++,n=n.nextZ,n);B++);for(q=s;0<l||0<q&&n;)0!==l&&(0===q||!n||p.z<=n.z)?(B=p,p=p.nextZ,l--):(B=n,n=n.nextZ,q--),f?f.nextZ=B:d=B,B.prevZ=f,f=B;p=n}f.nextZ=null;s*=2}while(1<m)}for(d=b;b.prev!==b.next;){p=b.prev;n=b.next;if(c)a:{f=b;q=a;var r=h,t=c;m=f.prev;l=f;s=f.next;if(0<=Ia(m,l,s))f=!1;else{var z=m.x>l.x?m.x>s.x?m.x:s.x:l.x>s.x?l.x:s.x,u=m.y>l.y?m.y>s.y?m.y:s.y:l.y>s.y?l.y:s.y;B=df(m.x<l.x?m.x<s.x?m.x:s.x:l.x<s.x?l.x:s.x,m.y<l.y?m.y<s.y?m.y:s.y:l.y<s.y?l.y:s.y,q,r,t);q=df(z,u,
  q,r,t);for(r=f.nextZ;r&&r.z<=q;){if(r!==f.prev&&r!==f.next&&de(m.x,m.y,l.x,l.y,s.x,s.y,r.x,r.y)&&0<=Ia(r.prev,r,r.next)){f=!1;break a}r=r.nextZ}for(r=f.prevZ;r&&r.z>=B;){if(r!==f.prev&&r!==f.next&&de(m.x,m.y,l.x,l.y,s.x,s.y,r.x,r.y)&&0<=Ia(r.prev,r,r.next)){f=!1;break a}r=r.prevZ}f=!0}}else a:if(f=b,m=f.prev,l=f,s=f.next,0<=Ia(m,l,s))f=!1;else{for(B=f.next.next;B!==f.prev;){if(de(m.x,m.y,l.x,l.y,s.x,s.y,B.x,B.y)&&0<=Ia(B.prev,B,B.next)){f=!1;break a}B=B.next}f=!0}if(f)e.push(p.i/k),e.push(b.i/k),
  e.push(n.i/k),gd(b),d=b=n.next;else if(b=n,b===d){if(!g)id(hd(b),e,k,a,h,c,1);else if(1===g){g=e;d=k;p=b;do n=p.prev,f=p.next.next,!Eb(n,f)&&rh(n,p,p.next,f)&&jd(n,f)&&jd(f,n)&&(g.push(n.i/d),g.push(p.i/d),g.push(f.i/d),gd(p),gd(p.next),p=b=f),p=p.next;while(p!==b);b=p;id(b,e,k,a,h,c,2)}else if(2===g)a:{g=b;do{for(d=g.next.next;d!==g.prev;){if(p=g.i!==d.i){p=g;n=d;f=void 0;if(f=p.next.i!==n.i)if(f=void 0,f=p.prev.i!==n.i){f=f=void 0;b:{f=p;do{if(f.i!==p.i&&f.next.i!==p.i&&f.i!==n.i&&f.next.i!==n.i&&
  rh(f,f.next,p,n)){f=!0;break b}f=f.next}while(f!==p);f=!1}if(f=!f)if(f=void 0,f=jd(p,n))if(f=void 0,f=jd(n,p)){f=p;m=!1;l=(p.x+n.x)/2;n=(p.y+n.y)/2;do f.y>n!==f.next.y>n&&f.next.y!==f.y&&l<(f.next.x-f.x)*(n-f.y)/(f.next.y-f.y)+f.x&&(m=!m),f=f.next;while(f!==p);f=m}}p=f}if(p){b=sh(g,d);g=hd(g,g.next);b=hd(b,b.next);id(g,e,k,a,h,c);id(b,e,k,a,h,c);break a}d=d.next}g=g.next}while(g!==b)}break}}}}function Ri(b,e){return b.x-e.x}function Si(b,e){var k=e,a=b.x,h=b.y,c=-Infinity,g;do{if(h<=k.y&&h>=k.next.y&&
  k.next.y!==k.y){var d=k.x+(h-k.y)*(k.next.x-k.x)/(k.next.y-k.y);if(d<=a&&d>c){c=d;if(d===a){if(h===k.y)return k;if(h===k.next.y)return k.next}g=k.x<k.next.x?k:k.next}}k=k.next}while(k!==e);if(!g)return null;if(a===c)return g.prev;for(var d=g,p=g.x,n=g.y,f=Infinity,m,k=g.next;k!==d;)a>=k.x&&k.x>=p&&a!==k.x&&de(h<n?a:c,h,p,n,h<n?c:a,h,k.x,k.y)&&(m=Math.abs(h-k.y)/(a-k.x),(m<f||m===f&&k.x>g.x)&&jd(k,b)&&(g=k,f=m)),k=k.next;return g}function df(b,e,k,a,h){b=32767*(b-k)*h;e=32767*(e-a)*h;b=(b|b<<8)&16711935;
  b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;e=(e|e<<8)&16711935;e=(e|e<<4)&252645135;e=(e|e<<2)&858993459;return(b|b<<1)&1431655765|((e|e<<1)&1431655765)<<1}function Ti(b){var e=b,k=b;do e.x<k.x&&(k=e),e=e.next;while(e!==b);return k}function de(b,e,k,a,h,c,g,d){return 0<=(h-g)*(e-d)-(b-g)*(c-d)&&0<=(b-g)*(a-d)-(k-g)*(e-d)&&0<=(k-g)*(c-d)-(h-g)*(a-d)}function Ia(b,e,k){return(e.y-b.y)*(k.x-e.x)-(e.x-b.x)*(k.y-e.y)}function Eb(b,e){return b.x===e.x&&b.y===e.y}function rh(b,e,k,a){return Eb(b,e)&&Eb(k,
  a)||Eb(b,a)&&Eb(k,e)?!0:0<Ia(b,e,k)!==0<Ia(b,e,a)&&0<Ia(k,a,b)!==0<Ia(k,a,e)}function jd(b,e){return 0>Ia(b.prev,b,b.next)?0<=Ia(b,e,b.next)&&0<=Ia(b,b.prev,e):0>Ia(b,e,b.prev)||0>Ia(b,b.next,e)}function sh(b,e){var k=new ef(b.i,b.x,b.y),a=new ef(e.i,e.x,e.y),h=b.next,c=e.prev;b.next=e;e.prev=b;k.next=h;h.prev=k;a.next=k;k.prev=a;c.next=a;a.prev=c;return a}function qh(b,e,k,a){b=new ef(b,e,k);a?(b.next=a.next,b.prev=a,a.next.prev=b,a.next=b):(b.prev=b,b.next=b);return b}function gd(b){b.next.prev=
  b.prev;b.prev.next=b.next;b.prevZ&&(b.prevZ.nextZ=b.nextZ);b.nextZ&&(b.nextZ.prevZ=b.prevZ)}function ef(b,e,k){this.i=b;this.x=e;this.y=k;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function th(b){var e=b.length;2<e&&b[e-1].equals(b[0])&&b.pop()}function uh(b,e){for(var k=0;k<e.length;k++)b.push(e[k].x),b.push(e[k].y)}function Fb(b,e){g.call(this);this.type="ExtrudeGeometry";this.parameters={shapes:b,options:e};this.fromBufferGeometry(new ib(b,e));this.mergeVertices()}function ib(b,
  e){function k(b){function k(b,e,a){e||console.error("THREE.ExtrudeGeometry: vec does not exist");return e.clone().multiplyScalar(a).add(b)}function g(b,e,k){var a,E,h;E=b.x-e.x;h=b.y-e.y;a=k.x-b.x;var c=k.y-b.y,L=E*E+h*h;if(Math.abs(E*c-h*a)>Number.EPSILON){var F=Math.sqrt(L),p=Math.sqrt(a*a+c*c),L=e.x-h/F;e=e.y+E/F;c=((k.x-c/p-L)*c-(k.y+a/p-e)*a)/(E*c-h*a);a=L+E*c-b.x;E=e+h*c-b.y;h=a*a+E*E;if(2>=h)return new d(a,E);h=Math.sqrt(h/2)}else b=!1,E>Number.EPSILON?a>Number.EPSILON&&(b=!0):E<-Number.EPSILON?
  a<-Number.EPSILON&&(b=!0):Math.sign(h)===Math.sign(c)&&(b=!0),b?(a=-h,h=Math.sqrt(L)):(a=E,E=h,h=Math.sqrt(L/2));return new d(a/h,E/h)}function F(b,e){var k,c;for($=b.length;0<=--$;){k=$;c=$-1;0>c&&(c=b.length-1);for(var g=0,d=r+2*v,g=0;g<d;g++){var L=ea*g,p=ea*(g+1),P=e+c+L,n=e+c+p,p=e+k+p;f(e+k+L);f(P);f(p);f(P);f(n);f(p);L=h.length/3;L=S.generateSideWallUV(a,h,L-6,L-3,L-2,L-1);l(L[0]);l(L[1]);l(L[3]);l(L[1]);l(L[2]);l(L[3])}}}function P(b,e,k){s.push(b);s.push(e);s.push(k)}function n(b,e,k){f(b);
  f(e);f(k);b=h.length/3;b=S.generateTopUV(a,h,b-3,b-2,b-1);l(b[0]);l(b[1]);l(b[2])}function f(b){h.push(s[3*b+0]);h.push(s[3*b+1]);h.push(s[3*b+2])}function l(b){c.push(b.x);c.push(b.y)}var s=[],q=void 0!==e.curveSegments?e.curveSegments:12,r=void 0!==e.steps?e.steps:1,t=void 0!==e.depth?e.depth:100,u=void 0!==e.bevelEnabled?e.bevelEnabled:!0,w=void 0!==e.bevelThickness?e.bevelThickness:6,G=void 0!==e.bevelSize?e.bevelSize:w-2,v=void 0!==e.bevelSegments?e.bevelSegments:3,A=e.extrudePath,S=void 0!==
  e.UVGenerator?e.UVGenerator:Ui;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),t=e.amount);var x,K=!1,H,D,y,I;A&&(x=A.getSpacedPoints(r),K=!0,u=!1,H=A.computeFrenetFrames(r,!1),D=new m,y=new m,I=new m);u||(G=w=v=0);var V,C,J,q=b.extractPoints(q);b=q.shape;var W=q.holes;if(!ob.isClockWise(b))for(b=b.reverse(),C=0,J=W.length;C<J;C++)V=W[C],ob.isClockWise(V)&&(W[C]=V.reverse());var ja=ob.triangulateShape(b,W),N=b;C=0;for(J=W.length;C<J;C++)V=W[C],b=
  b.concat(V);var Q,T,M,oa,da,ea=b.length,ba,Z=ja.length,q=[],$=0;M=N.length;Q=M-1;for(T=$+1;$<M;$++,Q++,T++)Q===M&&(Q=0),T===M&&(T=0),q[$]=g(N[$],N[Q],N[T]);var A=[],X,ca=q.concat();C=0;for(J=W.length;C<J;C++){V=W[C];X=[];$=0;M=V.length;Q=M-1;for(T=$+1;$<M;$++,Q++,T++)Q===M&&(Q=0),T===M&&(T=0),X[$]=g(V[$],V[Q],V[T]);A.push(X);ca=ca.concat(X)}for(Q=0;Q<v;Q++){M=Q/v;oa=w*Math.cos(M*Math.PI/2);T=G*Math.sin(M*Math.PI/2);$=0;for(M=N.length;$<M;$++)da=k(N[$],q[$],T),P(da.x,da.y,-oa);C=0;for(J=W.length;C<
  J;C++)for(V=W[C],X=A[C],$=0,M=V.length;$<M;$++)da=k(V[$],X[$],T),P(da.x,da.y,-oa)}T=G;for($=0;$<ea;$++)da=u?k(b[$],ca[$],T):b[$],K?(y.copy(H.normals[0]).multiplyScalar(da.x),D.copy(H.binormals[0]).multiplyScalar(da.y),I.copy(x[0]).add(y).add(D),P(I.x,I.y,I.z)):P(da.x,da.y,0);for(M=1;M<=r;M++)for($=0;$<ea;$++)da=u?k(b[$],ca[$],T):b[$],K?(y.copy(H.normals[M]).multiplyScalar(da.x),D.copy(H.binormals[M]).multiplyScalar(da.y),I.copy(x[M]).add(y).add(D),P(I.x,I.y,I.z)):P(da.x,da.y,t/r*M);for(Q=v-1;0<=Q;Q--){M=
  Q/v;oa=w*Math.cos(M*Math.PI/2);T=G*Math.sin(M*Math.PI/2);$=0;for(M=N.length;$<M;$++)da=k(N[$],q[$],T),P(da.x,da.y,t+oa);C=0;for(J=W.length;C<J;C++)for(V=W[C],X=A[C],$=0,M=V.length;$<M;$++)da=k(V[$],X[$],T),K?P(da.x,da.y+x[r-1].y,x[r-1].x+oa):P(da.x,da.y,t+oa)}(function(){var b=h.length/3;if(u){var e;e=0*ea;for($=0;$<Z;$++)ba=ja[$],n(ba[2]+e,ba[1]+e,ba[0]+e);e=r+2*v;e*=ea;for($=0;$<Z;$++)ba=ja[$],n(ba[0]+e,ba[1]+e,ba[2]+e)}else{for($=0;$<Z;$++)ba=ja[$],n(ba[2],ba[1],ba[0]);for($=0;$<Z;$++)ba=ja[$],
  n(ba[0]+ea*r,ba[1]+ea*r,ba[2]+ea*r)}a.addGroup(b,h.length/3-b,0)})();(function(){var b=h.length/3,e=0;F(N,e);e+=N.length;C=0;for(J=W.length;C<J;C++)V=W[C],F(V,e),e+=V.length;a.addGroup(b,h.length/3-b,1)})()}M.call(this);this.type="ExtrudeBufferGeometry";this.parameters={shapes:b,options:e};b=Array.isArray(b)?b:[b];for(var a=this,h=[],c=[],g=0,P=b.length;g<P;g++)k(b[g]);this.addAttribute("position",new N(h,3));this.addAttribute("uv",new N(c,2));this.computeVertexNormals()}function vh(b,e,k){k.shapes=
  [];if(Array.isArray(b))for(var a=0,h=b.length;a<h;a++)k.shapes.push(b[a].uuid);else k.shapes.push(b.uuid);void 0!==e.extrudePath&&(k.options.extrudePath=e.extrudePath.toJSON());return k}function kd(b,e){g.call(this);this.type="TextGeometry";this.parameters={text:b,parameters:e};this.fromBufferGeometry(new tc(b,e));this.mergeVertices()}function tc(b,e){e=e||{};var k=e.font;if(!k||!k.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new g;k=k.generateShapes(b,
  e.size);e.depth=void 0!==e.height?e.height:50;void 0===e.bevelThickness&&(e.bevelThickness=10);void 0===e.bevelSize&&(e.bevelSize=8);void 0===e.bevelEnabled&&(e.bevelEnabled=!1);ib.call(this,k,e);this.type="TextBufferGeometry"}function ld(b,e,k,a,h,c,d){g.call(this);this.type="SphereGeometry";this.parameters={radius:b,widthSegments:e,heightSegments:k,phiStart:a,phiLength:h,thetaStart:c,thetaLength:d};this.fromBufferGeometry(new Gb(b,e,k,a,h,c,d));this.mergeVertices()}function Gb(b,e,k,a,h,c,g){M.call(this);
  this.type="SphereBufferGeometry";this.parameters={radius:b,widthSegments:e,heightSegments:k,phiStart:a,phiLength:h,thetaStart:c,thetaLength:g};b=b||1;e=Math.max(3,Math.floor(e)||8);k=Math.max(2,Math.floor(k)||6);a=void 0!==a?a:0;h=void 0!==h?h:2*Math.PI;c=void 0!==c?c:0;g=void 0!==g?g:Math.PI;var d=c+g,p,f,n=0,l=[],s=new m,q=new m,r=[],t=[],u=[],w=[];for(f=0;f<=k;f++){var z=[],G=f/k;for(p=0;p<=e;p++){var v=p/e;s.x=-b*Math.cos(a+v*h)*Math.sin(c+G*g);s.y=b*Math.cos(c+G*g);s.z=b*Math.sin(a+v*h)*Math.sin(c+
  G*g);t.push(s.x,s.y,s.z);q.set(s.x,s.y,s.z).normalize();u.push(q.x,q.y,q.z);w.push(v,1-G);z.push(n++)}l.push(z)}for(f=0;f<k;f++)for(p=0;p<e;p++)b=l[f][p+1],a=l[f][p],h=l[f+1][p],g=l[f+1][p+1],(0!==f||0<c)&&r.push(b,a,g),(f!==k-1||d<Math.PI)&&r.push(a,h,g);this.setIndex(r);this.addAttribute("position",new N(t,3));this.addAttribute("normal",new N(u,3));this.addAttribute("uv",new N(w,2))}function md(b,e,k,a,h,c){g.call(this);this.type="RingGeometry";this.parameters={innerRadius:b,outerRadius:e,thetaSegments:k,
  phiSegments:a,thetaStart:h,thetaLength:c};this.fromBufferGeometry(new uc(b,e,k,a,h,c));this.mergeVertices()}function uc(b,e,k,a,h,c){M.call(this);this.type="RingBufferGeometry";this.parameters={innerRadius:b,outerRadius:e,thetaSegments:k,phiSegments:a,thetaStart:h,thetaLength:c};b=b||0.5;e=e||1;h=void 0!==h?h:0;c=void 0!==c?c:2*Math.PI;k=void 0!==k?Math.max(3,k):8;a=void 0!==a?Math.max(1,a):1;var g=[],P=[],p=[],f=[],n=b,l=(e-b)/a,s=new m,q=new d,r,t;for(r=0;r<=a;r++){for(t=0;t<=k;t++)b=h+t/k*c,s.x=
  n*Math.cos(b),s.y=n*Math.sin(b),P.push(s.x,s.y,s.z),p.push(0,0,1),q.x=(s.x/e+1)/2,q.y=(s.y/e+1)/2,f.push(q.x,q.y);n+=l}for(r=0;r<a;r++)for(e=r*(k+1),t=0;t<k;t++)b=t+e,h=b+k+1,c=b+k+2,n=b+1,g.push(b,h,n),g.push(h,c,n);this.setIndex(g);this.addAttribute("position",new N(P,3));this.addAttribute("normal",new N(p,3));this.addAttribute("uv",new N(f,2))}function nd(b,e,k,a){g.call(this);this.type="LatheGeometry";this.parameters={points:b,segments:e,phiStart:k,phiLength:a};this.fromBufferGeometry(new vc(b,
  e,k,a));this.mergeVertices()}function vc(b,e,k,a){M.call(this);this.type="LatheBufferGeometry";this.parameters={points:b,segments:e,phiStart:k,phiLength:a};e=Math.floor(e)||12;k=k||0;a=a||2*Math.PI;a=ga.clamp(a,0,2*Math.PI);var h=[],c=[],g=[],P=1/e,p=new m,f=new d,n,l;for(n=0;n<=e;n++){l=k+n*P*a;var s=Math.sin(l),q=Math.cos(l);for(l=0;l<=b.length-1;l++)p.x=b[l].x*s,p.y=b[l].y,p.z=b[l].x*q,c.push(p.x,p.y,p.z),f.x=n/e,f.y=l/(b.length-1),g.push(f.x,f.y)}for(n=0;n<e;n++)for(l=0;l<b.length-1;l++)k=l+n*
  b.length,P=k+b.length,p=k+b.length+1,f=k+1,h.push(k,P,f),h.push(P,p,f);this.setIndex(h);this.addAttribute("position",new N(c,3));this.addAttribute("uv",new N(g,2));this.computeVertexNormals();if(a===2*Math.PI)for(a=this.attributes.normal.array,h=new m,c=new m,g=new m,k=e*b.length*3,l=n=0;n<b.length;n++,l+=3)h.x=a[l+0],h.y=a[l+1],h.z=a[l+2],c.x=a[k+l+0],c.y=a[k+l+1],c.z=a[k+l+2],g.addVectors(h,c).normalize(),a[l+0]=a[k+l+0]=g.x,a[l+1]=a[k+l+1]=g.y,a[l+2]=a[k+l+2]=g.z}function Hb(b,e){g.call(this);
  this.type="ShapeGeometry";"object"===typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments);this.parameters={shapes:b,curveSegments:e};this.fromBufferGeometry(new Ib(b,e));this.mergeVertices()}function Ib(b,e){function k(b){var k,d,P=h.length/3;b=b.extractPoints(e);var f=b.shape,n=b.holes;if(!1===ob.isClockWise(f))for(f=f.reverse(),b=0,k=n.length;b<k;b++)d=n[b],!0===ob.isClockWise(d)&&(n[b]=d.reverse());var B=ob.triangulateShape(f,n);b=0;for(k=n.length;b<
  k;b++)d=n[b],f=f.concat(d);b=0;for(k=f.length;b<k;b++)d=f[b],h.push(d.x,d.y,0),c.push(0,0,1),g.push(d.x,d.y);b=0;for(k=B.length;b<k;b++)f=B[b],a.push(f[0]+P,f[1]+P,f[2]+P),p+=3}M.call(this);this.type="ShapeBufferGeometry";this.parameters={shapes:b,curveSegments:e};e=e||12;var a=[],h=[],c=[],g=[],d=0,p=0;if(!1===Array.isArray(b))k(b);else for(var f=0;f<b.length;f++)k(b[f]),this.addGroup(d,p,f),d+=p,p=0;this.setIndex(a);this.addAttribute("position",new N(h,3));this.addAttribute("normal",new N(c,3));
  this.addAttribute("uv",new N(g,2))}function wh(b,e){e.shapes=[];if(Array.isArray(b))for(var k=0,a=b.length;k<a;k++)e.shapes.push(b[k].uuid);else e.shapes.push(b.uuid);return e}function wc(b,e){M.call(this);this.type="EdgesGeometry";this.parameters={thresholdAngle:e};var k=[],a=Math.cos(ga.DEG2RAD*(void 0!==e?e:1)),h=[0,0],c={},d,P,p=["a","b","c"],f;b.isBufferGeometry?(f=new g,f.fromBufferGeometry(b)):f=b.clone();f.mergeVertices();f.computeFaceNormals();var n=f.vertices;f=f.faces;for(var m=0,l=f.length;m<
  l;m++)for(var s=f[m],q=0;3>q;q++)d=s[p[q]],P=s[p[(q+1)%3]],h[0]=Math.min(d,P),h[1]=Math.max(d,P),d=h[0]+","+h[1],void 0===c[d]?c[d]={index1:h[0],index2:h[1],face1:m,face2:void 0}:c[d].face2=m;for(d in c)if(h=c[d],void 0===h.face2||f[h.face1].normal.dot(f[h.face2].normal)<=a)p=n[h.index1],k.push(p.x,p.y,p.z),p=n[h.index2],k.push(p.x,p.y,p.z);this.addAttribute("position",new N(k,3))}function Jb(b,e,k,a,h,c,d,f){g.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:b,radiusBottom:e,height:k,
  radialSegments:a,heightSegments:h,openEnded:c,thetaStart:d,thetaLength:f};this.fromBufferGeometry(new pb(b,e,k,a,h,c,d,f));this.mergeVertices()}function pb(b,e,k,a,h,c,g,f){function p(k){var h,c,L,p=new d,u=new m,v=0,A=!0===k?b:e,Y=!0===k?1:-1;c=t;for(h=1;h<=a;h++)s.push(0,w*Y,0),q.push(0,Y,0),r.push(0.5,0.5),t++;L=t;for(h=0;h<=a;h++){var S=h/a*f+g,x=Math.cos(S),S=Math.sin(S);u.x=A*S;u.y=w*Y;u.z=A*x;s.push(u.x,u.y,u.z);q.push(0,Y,0);p.x=0.5*x+0.5;p.y=0.5*S*Y+0.5;r.push(p.x,p.y);t++}for(h=0;h<a;h++)p=
  c+h,u=L+h,!0===k?l.push(u,u+1,p):l.push(u+1,u,p),v+=3;n.addGroup(G,v,!0===k?1:2);G+=v}M.call(this);this.type="CylinderBufferGeometry";this.parameters={radiusTop:b,radiusBottom:e,height:k,radialSegments:a,heightSegments:h,openEnded:c,thetaStart:g,thetaLength:f};var n=this;b=void 0!==b?b:1;e=void 0!==e?e:1;k=k||1;a=Math.floor(a)||8;h=Math.floor(h)||1;c=void 0!==c?c:!1;g=void 0!==g?g:0;f=void 0!==f?f:2*Math.PI;var l=[],s=[],q=[],r=[],t=0,u=[],w=k/2,G=0;(function(){var c,d,L=new m,p=new m,v=0,A=(e-b)/
  k;for(d=0;d<=h;d++){var S=[],x=d/h,K=x*(e-b)+b;for(c=0;c<=a;c++){var C=c/a,H=C*f+g,V=Math.sin(H),H=Math.cos(H);p.x=K*V;p.y=-x*k+w;p.z=K*H;s.push(p.x,p.y,p.z);L.set(V,A,H).normalize();q.push(L.x,L.y,L.z);r.push(C,1-x);S.push(t++)}u.push(S)}for(c=0;c<a;c++)for(d=0;d<h;d++)L=u[d+1][c],p=u[d+1][c+1],A=u[d][c+1],l.push(u[d][c],L,A),l.push(L,p,A),v+=6;n.addGroup(G,v,0);G+=v})();!1===c&&(0<b&&p(!0),0<e&&p(!1));this.setIndex(l);this.addAttribute("position",new N(s,3));this.addAttribute("normal",new N(q,3));
  this.addAttribute("uv",new N(r,2))}function od(b,e,k,a,h,c,g){Jb.call(this,0,b,e,k,a,h,c,g);this.type="ConeGeometry";this.parameters={radius:b,height:e,radialSegments:k,heightSegments:a,openEnded:h,thetaStart:c,thetaLength:g}}function pd(b,e,k,a,h,c,g){pb.call(this,0,b,e,k,a,h,c,g);this.type="ConeBufferGeometry";this.parameters={radius:b,height:e,radialSegments:k,heightSegments:a,openEnded:h,thetaStart:c,thetaLength:g}}function qd(b,e,k,a){g.call(this);this.type="CircleGeometry";this.parameters={radius:b,
  segments:e,thetaStart:k,thetaLength:a};this.fromBufferGeometry(new xc(b,e,k,a));this.mergeVertices()}function xc(b,e,k,a){M.call(this);this.type="CircleBufferGeometry";this.parameters={radius:b,segments:e,thetaStart:k,thetaLength:a};b=b||1;e=void 0!==e?Math.max(3,e):8;k=void 0!==k?k:0;a=void 0!==a?a:2*Math.PI;var h=[],c=[],g=[],f=[],p,n,l=new m,s=new d;c.push(0,0,0);g.push(0,0,1);f.push(0.5,0.5);n=0;for(p=3;n<=e;n++,p+=3){var q=k+n/e*a;l.x=b*Math.cos(q);l.y=b*Math.sin(q);c.push(l.x,l.y,l.z);g.push(0,
  0,1);s.x=(c[p]/b+1)/2;s.y=(c[p+1]/b+1)/2;f.push(s.x,s.y)}for(p=1;p<=e;p++)h.push(p,p+1,0);this.setIndex(h);this.addAttribute("position",new N(c,3));this.addAttribute("normal",new N(g,3));this.addAttribute("uv",new N(f,2))}function Kb(b){T.call(this);this.type="ShadowMaterial";this.color=new w(0);this.transparent=!0;this.setValues(b)}function yc(b){pa.call(this,b);this.type="RawShaderMaterial"}function jb(b){T.call(this);this.defines={STANDARD:""};this.type="MeshStandardMaterial";this.color=new w(16777215);
  this.metalness=this.roughness=0.5;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new w(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=rd;this.normalScale=new d(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null;this.envMapIntensity=1;this.refractionRatio=0.98;this.wireframe=
  !1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(b)}function Lb(b){jb.call(this);this.defines={PHYSICAL:""};this.type="MeshPhysicalMaterial";this.reflectivity=0.5;this.clearCoatRoughness=this.clearCoat=0;this.setValues(b)}function Wa(b){T.call(this);this.type="MeshPhongMaterial";this.color=new w(16777215);this.specular=new w(1118481);this.shininess=30;this.lightMap=this.map=null;this.lightMapIntensity=
  1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new w(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=rd;this.normalScale=new d(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.specularMap=null;this.combine=Mc;this.reflectivity=1;this.refractionRatio=0.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=
  this.morphTargets=this.skinning=!1;this.setValues(b)}function Mb(b){Wa.call(this);this.defines={TOON:""};this.type="MeshToonMaterial";this.gradientMap=null;this.setValues(b)}function Nb(b){T.call(this);this.type="MeshNormalMaterial";this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=rd;this.normalScale=new d(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=
  this.lights=this.fog=!1;this.setValues(b)}function Ob(b){T.call(this);this.type="MeshLambertMaterial";this.color=new w(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new w(0);this.emissiveIntensity=1;this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null;this.combine=Mc;this.reflectivity=1;this.refractionRatio=0.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=
  this.morphTargets=this.skinning=!1;this.setValues(b)}function Pb(b){T.call(this);this.defines={MATCAP:""};this.type="MeshMatcapMaterial";this.color=new w(16777215);this.bumpMap=this.map=this.matcap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=rd;this.normalScale=new d(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.alphaMap=null;this.lights=this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(b);if(null===this.matcap){b=document.createElement("canvas");
  b.width=1;b.height=1;var e=b.getContext("2d");e.fillStyle="#fff";e.fillRect(0,0,1,1);this.matcap=new THREE.CanvasTexture(b)}}function Qb(b){na.call(this);this.type="LineDashedMaterial";this.scale=1;this.dashSize=3;this.gapSize=1;this.setValues(b)}function ff(b,e,k){var a=this,h=!1,c=0,g=0,d=void 0;this.onStart=void 0;this.onLoad=b;this.onProgress=e;this.onError=k;this.itemStart=function(b){g++;if(!1===h&&void 0!==a.onStart)a.onStart(b,c,g);h=!0};this.itemEnd=function(b){c++;if(void 0!==a.onProgress)a.onProgress(b,
  c,g);if(c===g&&(h=!1,void 0!==a.onLoad))a.onLoad()};this.itemError=function(b){if(void 0!==a.onError)a.onError(b)};this.resolveURL=function(b){return d?d(b):b};this.setURLModifier=function(b){d=b;return this}}function Xa(b){this.manager=void 0!==b?b:Ja}function xh(b){this.manager=void 0!==b?b:Ja;this._parser=null}function gf(b){this.manager=void 0!==b?b:Ja;this._parser=null}function sd(b){this.manager=void 0!==b?b:Ja}function hf(b){this.manager=void 0!==b?b:Ja}function ee(b){this.manager=void 0!==
  b?b:Ja}function X(){this.type="Curve";this.arcLengthDivisions=200}function Ra(b,e,k,a,h,c,g,d){X.call(this);this.type="EllipseCurve";this.aX=b||0;this.aY=e||0;this.xRadius=k||1;this.yRadius=a||1;this.aStartAngle=h||0;this.aEndAngle=c||2*Math.PI;this.aClockwise=g||!1;this.aRotation=d||0}function zc(b,e,k,a,h,c){Ra.call(this,b,e,k,k,a,h,c);this.type="ArcCurve"}function jf(){var b=0,e=0,k=0,a=0;return{initCatmullRom:function(h,c,g,d,p){h=p*(g-h);d=p*(d-c);b=c;e=h;k=-3*c+3*g-2*h-d;a=2*c-2*g+h+d},initNonuniformCatmullRom:function(h,
  c,g,d,p,f,n){h=((c-h)/p-(g-h)/(p+f)+(g-c)/f)*f;d=((g-c)/f-(d-c)/(f+n)+(d-g)/n)*f;f=h;b=c;e=f;k=-3*c+3*g-2*f-d;a=2*c-2*g+f+d},calc:function(h){var c=h*h;return b+e*h+k*c+a*c*h}}}function Ea(b,e,k,a){X.call(this);this.type="CatmullRomCurve3";this.points=b||[];this.closed=e||!1;this.curveType=k||"centripetal";this.tension=a||0.5}function yh(b,e,k,a,h){e=0.5*(a-e);h=0.5*(h-k);var c=b*b;return(2*k-2*a+e+h)*b*c+(-3*k+3*a-2*e-h)*c+e*b+k}function td(b,e,k,a){var h=1-b;return h*h*e+2*(1-b)*b*k+b*b*a}function ud(b,
  e,k,a,h){var c=1-b,g=1-b;return c*c*c*e+3*g*g*b*k+3*(1-b)*b*b*a+b*b*b*h}function Ya(b,e,k,a){X.call(this);this.type="CubicBezierCurve";this.v0=b||new d;this.v1=e||new d;this.v2=k||new d;this.v3=a||new d}function kb(b,e,k,a){X.call(this);this.type="CubicBezierCurve3";this.v0=b||new m;this.v1=e||new m;this.v2=k||new m;this.v3=a||new m}function Fa(b,e){X.call(this);this.type="LineCurve";this.v1=b||new d;this.v2=e||new d}function Za(b,e){X.call(this);this.type="LineCurve3";this.v1=b||new m;this.v2=e||
  new m}function $a(b,e,k){X.call(this);this.type="QuadraticBezierCurve";this.v0=b||new d;this.v1=e||new d;this.v2=k||new d}function lb(b,e,k){X.call(this);this.type="QuadraticBezierCurve3";this.v0=b||new m;this.v1=e||new m;this.v2=k||new m}function ab(b){X.call(this);this.type="SplineCurve";this.points=b||[]}function qb(){X.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function bb(b){qb.call(this);this.type="Path";this.currentPoint=new d;b&&this.setFromPoints(b)}function xb(b){bb.call(this,
  b);this.uuid=ga.generateUUID();this.type="Shape";this.holes=[]}function za(b,e){D.call(this);this.type="Light";this.color=new w(b);this.intensity=void 0!==e?e:1;this.receiveShadow=void 0}function fe(b,e,k){za.call(this,b,k);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(D.DefaultUp);this.updateMatrix();this.groundColor=new w(e)}function Rb(b){this.camera=b;this.bias=0;this.radius=1;this.mapSize=new d(512,512);this.map=null;this.matrix=new f}function ge(){Rb.call(this,new qa(50,
  1,0.5,500))}function he(b,e,k,a,c,g){za.call(this,b,e);this.type="SpotLight";this.position.copy(D.DefaultUp);this.updateMatrix();this.target=new D;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(b){this.intensity=b/Math.PI}});this.distance=void 0!==k?k:0;this.angle=void 0!==a?a:Math.PI/3;this.penumbra=void 0!==c?c:0;this.decay=void 0!==g?g:1;this.shadow=new ge}function ie(b,e,k,a){za.call(this,b,e);this.type="PointLight";Object.defineProperty(this,"power",
  {get:function(){return 4*this.intensity*Math.PI},set:function(b){this.intensity=b/(4*Math.PI)}});this.distance=void 0!==k?k:0;this.decay=void 0!==a?a:1;this.shadow=new Rb(new qa(90,1,0.5,500))}function vd(b,e,k,a,c,g){hb.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=b;this.right=e;this.top=k;this.bottom=a;this.near=void 0!==c?c:0.1;this.far=void 0!==g?g:2E3;this.updateProjectionMatrix()}function je(){Rb.call(this,new vd(-5,5,5,-5,0.5,500))}function ke(b,e){za.call(this,
  b,e);this.type="DirectionalLight";this.position.copy(D.DefaultUp);this.updateMatrix();this.target=new D;this.shadow=new je}function le(b,e){za.call(this,b,e);this.type="AmbientLight";this.castShadow=void 0}function me(b,e,k,a){za.call(this,b,e);this.type="RectAreaLight";this.width=void 0!==k?k:10;this.height=void 0!==a?a:10}function Sa(b,e,k,a){this.parameterPositions=b;this._cachedIndex=0;this.resultBuffer=void 0!==a?a:new e.constructor(k);this.sampleValues=e;this.valueSize=k}function ne(b,e,k,a){Sa.call(this,
  b,e,k,a);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function wd(b,e,k,a){Sa.call(this,b,e,k,a)}function oe(b,e,k,a){Sa.call(this,b,e,k,a)}function Aa(b,e,k,a){if(void 0===b)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+b);this.name=b;this.times=Ca.convertArray(e,this.TimeBufferType);this.values=Ca.convertArray(k,this.ValueBufferType);this.setInterpolation(a||this.DefaultInterpolation)}
  function pe(b,e,k){Aa.call(this,b,e,k)}function qe(b,e,k,a){Aa.call(this,b,e,k,a)}function Ac(b,e,k,a){Aa.call(this,b,e,k,a)}function re(b,e,k,a){Sa.call(this,b,e,k,a)}function xd(b,e,k,a){Aa.call(this,b,e,k,a)}function se(b,e,k,a){Aa.call(this,b,e,k,a)}function Bc(b,e,k,a){Aa.call(this,b,e,k,a)}function Ua(b,e,k){this.name=b;this.tracks=k;this.duration=void 0!==e?e:-1;this.uuid=ga.generateUUID();0>this.duration&&this.resetDuration()}function Vi(b){switch(b.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return Ac;
  case "vector":case "vector2":case "vector3":case "vector4":return Bc;case "color":return qe;case "quaternion":return xd;case "bool":case "boolean":return pe;case "string":return se}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+b);}function Wi(b){if(void 0===b.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=Vi(b.type);if(void 0===b.times){var k=[],a=[];Ca.flattenJSON(b.keys,k,a,"value");b.times=k;b.values=a}return void 0!==e.parse?e.parse(b):new e(b.name,
  b.times,b.values,b.interpolation)}function te(b){this.manager=void 0!==b?b:Ja;this.textures={}}function kf(b){this.manager=void 0!==b?b:Ja}function Cc(){}function lf(b){"boolean"===typeof b&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),b=void 0);this.manager=void 0!==b?b:Ja;this.withCredentials=!1}function zh(b){this.manager=void 0!==b?b:Ja;this.texturePath=""}function mf(b){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");
  "undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");this.manager=void 0!==b?b:Ja;this.options=void 0}function nf(){this.type="ShapePath";this.color=new w;this.subPaths=[];this.currentPath=null}function of(b){this.type="Font";this.data=b}function Ah(b){this.manager=void 0!==b?b:Ja}function pf(b){this.manager=void 0!==b?b:Ja}function Bh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=0.064;this.cameraL=new qa;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=
  !1;this.cameraR=new qa;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function yd(b,e,k){D.call(this);this.type="CubeCamera";var a=new qa(90,1,b,e);a.up.set(0,-1,0);a.lookAt(new m(1,0,0));this.add(a);var c=new qa(90,1,b,e);c.up.set(0,-1,0);c.lookAt(new m(-1,0,0));this.add(c);var g=new qa(90,1,b,e);g.up.set(0,0,1);g.lookAt(new m(0,1,0));this.add(g);var d=new qa(90,1,b,e);d.up.set(0,0,-1);d.lookAt(new m(0,-1,0));this.add(d);var f=new qa(90,1,b,e);f.up.set(0,-1,0);f.lookAt(new m(0,0,
  1));this.add(f);var p=new qa(90,1,b,e);p.up.set(0,-1,0);p.lookAt(new m(0,0,-1));this.add(p);this.renderTarget=new v(k,k,{format:dc,magFilter:Ka,minFilter:Ka});this.renderTarget.texture.name="CubeCamera";this.update=function(b,e){null===this.parent&&this.updateMatrixWorld();var k=this.renderTarget,n=k.texture.generateMipmaps;k.texture.generateMipmaps=!1;k.activeCubeFace=0;b.render(e,a,k);k.activeCubeFace=1;b.render(e,c,k);k.activeCubeFace=2;b.render(e,g,k);k.activeCubeFace=3;b.render(e,d,k);k.activeCubeFace=
  4;b.render(e,f,k);k.texture.generateMipmaps=n;k.activeCubeFace=5;b.render(e,p,k);b.setRenderTarget(null)};this.clear=function(b,e,k,a){for(var c=this.renderTarget,h=0;6>h;h++)c.activeCubeFace=h,b.setRenderTarget(c),b.clear(e,k,a);b.setRenderTarget(null)}}function qf(){D.call(this);this.type="AudioListener";this.context=rf.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function Dc(b){D.call(this);this.type="Audio";this.context=b.context;
  this.gain=this.context.createGain();this.gain.connect(b.getInput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function sf(b){Dc.call(this,b);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function tf(b,e){this.analyser=b.context.createAnalyser();this.analyser.fftSize=void 0!==e?e:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);
  b.getOutput().connect(this.analyser)}function uf(b,e,k){this.binding=b;this.valueSize=k;b=Float64Array;switch(e){case "quaternion":e=this._slerp;break;case "string":case "bool":b=Array;e=this._select;break;default:e=this._lerp}this.buffer=new b(4*k);this._mixBufferRegion=e;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Ch(b,e,k){k=k||ua.parseTrackName(e);this._targetGroup=b;this._bindings=b.subscribe_(e,k)}function ua(b,e,k){this.path=e;this.parsedPath=k||ua.parseTrackName(e);
  this.node=ua.findNode(b,this.parsedPath.nodeName)||b;this.rootNode=b}function Dh(){this.uuid=ga.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var b={};this._indicesByUUID=b;for(var e=0,k=arguments.length;e!==k;++e)b[arguments[e].uuid]=e;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var a=this;this.stats={objects:{get total(){return a._objects.length},get inUse(){return this.total-a.nCachedObjects_}},get bindingsPerObject(){return a._bindings.length}}}
  function Eh(b,e,k){this._mixer=b;this._clip=e;this._localRoot=k||null;b=e.tracks;e=b.length;k=Array(e);for(var a={endingStart:Sb,endingEnd:Sb},c=0;c!==e;++c){var g=b[c].createInterpolant(null);k[c]=g;g.settings=a}this._interpolantSettings=a;this._interpolants=k;this._propertyBindings=Array(e);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=Fh;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=
  this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function vf(b){this._root=b;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function ue(b,e){"string"===typeof b&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),b=e);this.value=b}function wf(){M.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function xf(b,e,k){Cb.call(this,b,e);this.meshPerAttribute=
  k||1}function yf(b,e,k,a){"number"===typeof k&&(a=k,k=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));n.call(this,b,e,k);this.meshPerAttribute=a||1}function Gh(b,e,k,a){this.ray=new fb(b,e);this.near=k||0;this.far=a||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");
  return this.Points}}})}function Hh(b,e){return b.distance-e.distance}function zf(b,e,a,c){if(!1!==b.visible&&(b.raycast(e,a),!0===c)){b=b.children;c=0;for(var h=b.length;c<h;c++)zf(b[c],e,a,!0)}}function Ih(b){this.autoStart=void 0!==b?b:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Jh(b,e,a){this.radius=void 0!==b?b:1;this.phi=void 0!==e?e:0;this.theta=void 0!==a?a:0;return this}function Kh(b,e,a){this.radius=void 0!==b?b:1;this.theta=void 0!==e?e:0;this.y=void 0!==a?
  a:0;return this}function Af(b,e){this.min=void 0!==b?b:new d(Infinity,Infinity);this.max=void 0!==e?e:new d(-Infinity,-Infinity)}function Bf(b,e){this.start=void 0!==b?b:new m;this.end=void 0!==e?e:new m}function zd(b){D.call(this);this.material=b;this.render=function(){}}function Ad(b,e,a,c){this.object=b;this.size=void 0!==e?e:1;b=void 0!==a?a:16711680;c=void 0!==c?c:1;e=0;(a=this.object.geometry)&&a.isGeometry?e=3*a.faces.length:a&&a.isBufferGeometry&&(e=a.attributes.normal.count);a=new M;e=new N(6*
  e,3);a.addAttribute("position",e);ra.call(this,a,new na({color:b,linewidth:c}));this.matrixAutoUpdate=!1;this.update()}function Ec(b,e){D.call(this);this.light=b;this.light.updateMatrixWorld();this.matrix=b.matrixWorld;this.matrixAutoUpdate=!1;this.color=e;for(var a=new M,c=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],h=0,g=1;32>h;h++,g++){var d=h/32*Math.PI*2,f=g/32*Math.PI*2;c.push(Math.cos(d),Math.sin(d),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new N(c,3));c=new na({fog:!1});
  this.cone=new ra(a,c);this.add(this.cone);this.update()}function Lh(b){var e=[];b&&b.isBone&&e.push(b);for(var a=0;a<b.children.length;a++)e.push.apply(e,Lh(b.children[a]));return e}function Fc(b){for(var e=Lh(b),a=new M,c=[],h=[],g=new w(0,0,1),d=new w(0,1,0),f=0;f<e.length;f++){var p=e[f];p.parent&&p.parent.isBone&&(c.push(0,0,0),c.push(0,0,0),h.push(g.r,g.g,g.b),h.push(d.r,d.g,d.b))}a.addAttribute("position",new N(c,3));a.addAttribute("color",new N(h,3));c=new na({vertexColors:Tb,depthTest:!1,
  depthWrite:!1,transparent:!0});ra.call(this,a,c);this.root=b;this.bones=e;this.matrix=b.matrixWorld;this.matrixAutoUpdate=!1}function Gc(b,e,a){this.light=b;this.light.updateMatrixWorld();this.color=a;b=new Gb(e,4,2);e=new Ba({wireframe:!0,fog:!1});wa.call(this,b,e);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1;this.update()}function Hc(b,e){D.call(this);this.light=b;this.light.updateMatrixWorld();this.matrix=b.matrixWorld;this.matrixAutoUpdate=!1;this.color=e;var a=new na({fog:!1}),
  c=new M;c.addAttribute("position",new n(new Float32Array(15),3));this.line=new ya(c,a);this.add(this.line);this.update()}function Ic(b,e,a){D.call(this);this.light=b;this.light.updateMatrixWorld();this.matrix=b.matrixWorld;this.matrixAutoUpdate=!1;this.color=a;b=new Db(e);b.rotateY(0.5*Math.PI);this.material=new Ba({wireframe:!0,fog:!1});void 0===this.color&&(this.material.vertexColors=Tb);e=b.getAttribute("position");e=new Float32Array(3*e.count);b.addAttribute("color",new n(e,3));this.add(new wa(b,
  this.material));this.update()}function Bd(b,e,a,c){b=b||10;e=e||10;a=new w(void 0!==a?a:4473924);c=new w(void 0!==c?c:8947848);var h=e/2,g=b/e,d=b/2;b=[];for(var f=[],p=0,n=0,m=-d;p<=e;p++,m+=g){b.push(-d,0,m,d,0,m);b.push(m,0,-d,m,0,d);var l=p===h?a:c;l.toArray(f,n);n+=3;l.toArray(f,n);n+=3;l.toArray(f,n);n+=3;l.toArray(f,n);n+=3}e=new M;e.addAttribute("position",new N(b,3));e.addAttribute("color",new N(f,3));a=new na({vertexColors:Tb});ra.call(this,e,a)}function ve(b,e,a,c,h,g){b=b||10;e=e||16;
  a=a||8;c=c||64;h=new w(void 0!==h?h:4473924);g=new w(void 0!==g?g:8947848);var d=[],f=[],p,n,m,l,s;for(m=0;m<=e;m++)n=m/e*2*Math.PI,p=Math.sin(n)*b,n=Math.cos(n)*b,d.push(0,0,0),d.push(p,0,n),s=m&1?h:g,f.push(s.r,s.g,s.b),f.push(s.r,s.g,s.b);for(m=0;m<=a;m++)for(s=m&1?h:g,l=b-b/a*m,e=0;e<c;e++)n=e/c*2*Math.PI,p=Math.sin(n)*l,n=Math.cos(n)*l,d.push(p,0,n),f.push(s.r,s.g,s.b),n=(e+1)/c*2*Math.PI,p=Math.sin(n)*l,n=Math.cos(n)*l,d.push(p,0,n),f.push(s.r,s.g,s.b);b=new M;b.addAttribute("position",new N(d,
  3));b.addAttribute("color",new N(f,3));d=new na({vertexColors:Tb});ra.call(this,b,d)}function Cd(b,e,a,c){this.object=b;this.size=void 0!==e?e:1;b=void 0!==a?a:16776960;c=void 0!==c?c:1;e=0;(a=this.object.geometry)&&a.isGeometry?e=a.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");a=new M;e=new N(6*e,3);a.addAttribute("position",e);ra.call(this,a,new na({color:b,linewidth:c}));this.matrixAutoUpdate=!1;this.update()}function Jc(b,
  e,a){D.call(this);this.light=b;this.light.updateMatrixWorld();this.matrix=b.matrixWorld;this.matrixAutoUpdate=!1;this.color=a;void 0===e&&(e=1);b=new M;b.addAttribute("position",new N([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));e=new na({fog:!1});this.lightPlane=new ya(b,e);this.add(this.lightPlane);b=new M;b.addAttribute("position",new N([0,0,0,0,0,1],3));this.targetLine=new ya(b,e);this.add(this.targetLine);this.update()}function Dd(b){function e(b,e,c){a(b,c);a(e,c)}function a(b,e){g.push(0,0,0);
  d.push(e.r,e.g,e.b);void 0===f[b]&&(f[b]=[]);f[b].push(g.length/3-1)}var c=new M,h=new na({color:16777215,vertexColors:Cf}),g=[],d=[],f={},p=new w(16755200),n=new w(16711680),m=new w(43775),l=new w(16777215),s=new w(3355443);e("n1","n2",p);e("n2","n4",p);e("n4","n3",p);e("n3","n1",p);e("f1","f2",p);e("f2","f4",p);e("f4","f3",p);e("f3","f1",p);e("n1","f1",p);e("n2","f2",p);e("n3","f3",p);e("n4","f4",p);e("p","n1",n);e("p","n2",n);e("p","n3",n);e("p","n4",n);e("u1","u2",m);e("u2","u3",m);e("u3","u1",
  m);e("c","t",l);e("p","c",s);e("cn1","cn2",s);e("cn3","cn4",s);e("cf1","cf2",s);e("cf3","cf4",s);c.addAttribute("position",new N(g,3));c.addAttribute("color",new N(d,3));ra.call(this,c,h);this.camera=b;this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix();this.matrix=b.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()}function Ub(b,e){this.object=b;void 0===e&&(e=16776960);var a=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]),c=new Float32Array(24),
  h=new M;h.setIndex(new n(a,1));h.addAttribute("position",new n(c,3));ra.call(this,h,new na({color:e}));this.matrixAutoUpdate=!1;this.update()}function Ed(b,e){this.type="Box3Helper";this.box=b;var a=void 0!==e?e:16776960,c=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]),h=new M;h.setIndex(new n(c,1));h.addAttribute("position",new N([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3));ra.call(this,h,new na({color:a}));this.geometry.computeBoundingSphere()}function Fd(b,
  e,a){this.type="PlaneHelper";this.plane=b;this.size=void 0===e?1:e;b=void 0!==a?a:16776960;e=new M;e.addAttribute("position",new N([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3));e.computeBoundingSphere();ya.call(this,e,new na({color:b}));e=new M;e.addAttribute("position",new N([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3));e.computeBoundingSphere();this.add(new wa(e,new Ba({color:b,opacity:0.2,transparent:!0,depthWrite:!1})))}function Vb(b,e,a,c,h,g){D.call(this);void 0===
  c&&(c=16776960);void 0===a&&(a=1);void 0===h&&(h=0.2*a);void 0===g&&(g=0.2*h);void 0===we&&(we=new M,we.addAttribute("position",new N([0,0,0,0,1,0],3)),Df=new pb(0,0.5,1,5,1),Df.translate(0,-0.5,0));this.position.copy(e);this.line=new ya(we,new na({color:c}));this.line.matrixAutoUpdate=!1;this.add(this.line);this.cone=new wa(Df,new Ba({color:c}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(b);this.setLength(a,h,g)}function Gd(b){b=b||1;var e=[0,0,0,b,0,0,0,0,0,0,b,0,0,0,0,
  0,0,b];b=new M;b.addAttribute("position",new N(e,3));b.addAttribute("color",new N([1,0,0,1,0.6,0,0,1,0,0.6,1,0,0,0,1,0,0.6,1],3));e=new na({vertexColors:Tb});ra.call(this,b,e)}function Mh(b){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");Ea.call(this,b);this.type="catmullrom";this.closed=!0}function Nh(b){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");Ea.call(this,b);this.type="catmullrom"}function Ef(b){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.");
  Ea.call(this,b);this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(b){return"number"===typeof b&&isFinite(b)&&Math.floor(b)===b});void 0===Math.sign&&(Math.sign=function(b){return 0>b?-1:0<b?1:+b});!1==="name"in Function.prototype&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});void 0===Object.assign&&function(){Object.assign=function(b){if(void 0===
  b||null===b)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(b),a=1;a<arguments.length;a++){var c=arguments[a];if(void 0!==c&&null!==c)for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(e[h]=c[h])}return e}}();Object.assign(c.prototype,{addEventListener:function(b,e){void 0===this._listeners&&(this._listeners={});var a=this._listeners;void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(e)&&a[b].push(e)},hasEventListener:function(b,e){if(void 0===this._listeners)return!1;
  var a=this._listeners;return void 0!==a[b]&&-1!==a[b].indexOf(e)},removeEventListener:function(b,e){if(void 0!==this._listeners){var a=this._listeners[b];if(void 0!==a){var c=a.indexOf(e);-1!==c&&a.splice(c,1)}}},dispatchEvent:function(b){if(void 0!==this._listeners){var e=this._listeners[b.type];if(void 0!==e){b.target=this;for(var e=e.slice(0),a=0,c=e.length;a<c;a++)e[a].call(this,b)}}}});var mh="97dev",sg=0,Re=1,tg=2,Me=1,kg=2,Xb=0,Oa=1,ac=2,ze=0,Cf=1,Tb=2,Oc=0,zb=1,Sd=2,Td=3,Ud=4,Qe=5,Yb=100,
  Mg=101,Ng=102,Yd=103,Zd=104,Og=200,Pg=201,Qg=202,Rg=203,Ae=204,Be=205,Sg=206,Tg=207,Ug=208,Vg=209,Wg=210,ug=0,vg=1,wg=2,Id=3,xg=4,yg=5,zg=6,Ag=7,Mc=0,lg=1,mg=2,Qd=0,Ke=1,eg=2,fg=3,gg=4,Kd=301,Md=302,Ne=303,Pd=304,Oe=305,Nd=306,Od=307,nb=1E3,Qa=1001,Bb=1002,La=1003,Vd=1004,Wd=1005,Ka=1006,Te=1007,Kc=1008,Hd=1009,Fg=1010,Gg=1011,Pc=1012,Hg=1013,Se=1014,bc=1015,Xd=1016,Cg=1017,Dg=1018,Eg=1019,Qc=1020,Ig=1021,dc=1022,db=1023,Jg=1024,Kg=1025,Xi=db,Ab=1026,cc=1027,Lg=1028,Ue=33776,Ve=33777,We=33778,Xe=
  33779,Ye=35840,Ze=35841,$e=35842,af=35843,Xg=36196,Yg=37808,Zg=37809,$g=37810,ah=37811,bh=37812,ch=37813,dh=37814,eh=37815,fh=37816,gh=37817,hh=37818,ih=37819,jh=37820,kh=37821,Fh=2201,Sb=2400,Ce=0,nh=1,oh=2,Lc=3E3,$f=3001,Je=3007,ag=3002,bg=3004,cg=3005,dg=3006,pg=3200,rg=3201,rd=0,ng=1,ga={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var b=[],e=0;256>e;e++)b[e]=(16>e?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,a=4294967295*Math.random()|0,c=4294967295*
  Math.random()|0,g=4294967295*Math.random()|0;return(b[e&255]+b[e>>8&255]+b[e>>16&255]+b[e>>24&255]+"-"+b[a&255]+b[a>>8&255]+"-"+b[a>>16&15|64]+b[a>>24&255]+"-"+b[c&63|128]+b[c>>8&255]+"-"+b[c>>16&255]+b[c>>24&255]+b[g&255]+b[g>>8&255]+b[g>>16&255]+b[g>>24&255]).toUpperCase()}}(),clamp:function(b,e,a){return Math.max(e,Math.min(a,b))},euclideanModulo:function(b,e){return(b%e+e)%e},mapLinear:function(b,e,a,c,h){return c+(b-e)*(h-c)/(a-e)},lerp:function(b,e,a){return(1-a)*b+a*e},smoothstep:function(b,
  e,a){if(b<=e)return 0;if(b>=a)return 1;b=(b-e)/(a-e);return b*b*(3-2*b)},smootherstep:function(b,e,a){if(b<=e)return 0;if(b>=a)return 1;b=(b-e)/(a-e);return b*b*b*(b*(6*b-15)+10)},randInt:function(b,e){return b+Math.floor(Math.random()*(e-b+1))},randFloat:function(b,e){return b+Math.random()*(e-b)},randFloatSpread:function(b){return b*(0.5-Math.random())},degToRad:function(b){return b*ga.DEG2RAD},radToDeg:function(b){return b*ga.RAD2DEG},isPowerOfTwo:function(b){return 0===(b&b-1)&&0!==b},ceilPowerOfTwo:function(b){return Math.pow(2,
  Math.ceil(Math.log(b)/Math.LN2))},floorPowerOfTwo:function(b){return Math.pow(2,Math.floor(Math.log(b)/Math.LN2))}};Object.defineProperties(d.prototype,{width:{get:function(){return this.x},set:function(b){this.x=b}},height:{get:function(){return this.y},set:function(b){this.y=b}}});Object.assign(d.prototype,{isVector2:!0,set:function(b,e){this.x=b;this.y=e;return this},setScalar:function(b){this.y=this.x=b;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},
  setComponent:function(b,e){switch(b){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+b);}return this},getComponent:function(b){switch(b){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+b);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(b){this.x=b.x;this.y=b.y;return this},add:function(b,e){if(void 0!==e)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
  this.addVectors(b,e);this.x+=b.x;this.y+=b.y;return this},addScalar:function(b){this.x+=b;this.y+=b;return this},addVectors:function(b,e){this.x=b.x+e.x;this.y=b.y+e.y;return this},addScaledVector:function(b,e){this.x+=b.x*e;this.y+=b.y*e;return this},sub:function(b,e){if(void 0!==e)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(b,e);this.x-=b.x;this.y-=b.y;return this},subScalar:function(b){this.x-=b;this.y-=b;return this},
  subVectors:function(b,e){this.x=b.x-e.x;this.y=b.y-e.y;return this},multiply:function(b){this.x*=b.x;this.y*=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divide:function(b){this.x/=b.x;this.y/=b.y;return this},divideScalar:function(b){return this.multiplyScalar(1/b)},applyMatrix3:function(b){var e=this.x,a=this.y;b=b.elements;this.x=b[0]*e+b[3]*a+b[6];this.y=b[1]*e+b[4]*a+b[7];return this},min:function(b){this.x=Math.min(this.x,b.x);this.y=Math.min(this.y,b.y);return this},
  max:function(b){this.x=Math.max(this.x,b.x);this.y=Math.max(this.y,b.y);return this},clamp:function(b,e){this.x=Math.max(b.x,Math.min(e.x,this.x));this.y=Math.max(b.y,Math.min(e.y,this.y));return this},clampScalar:function(){var b=new d,e=new d;return function(a,c){b.set(a,a);e.set(c,c);return this.clamp(b,e)}}(),clampLength:function(b,e){var a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(b,Math.min(e,a)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);
  return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(b){return this.x*b.x+this.y*b.y},cross:function(b){return this.x*b.y-this.y*b.x},lengthSq:function(){return this.x*
  this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var b=Math.atan2(this.y,this.x);0>b&&(b+=2*Math.PI);return b},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var e=this.x-b.x;b=this.y-b.y;return e*e+b*b},manhattanDistanceTo:function(b){return Math.abs(this.x-b.x)+
  Math.abs(this.y-b.y)},setLength:function(b){return this.normalize().multiplyScalar(b)},lerp:function(b,e){this.x+=(b.x-this.x)*e;this.y+=(b.y-this.y)*e;return this},lerpVectors:function(b,e,a){return this.subVectors(e,b).multiplyScalar(a).add(b)},equals:function(b){return b.x===this.x&&b.y===this.y},fromArray:function(b,e){void 0===e&&(e=0);this.x=b[e];this.y=b[e+1];return this},toArray:function(b,e){void 0===b&&(b=[]);void 0===e&&(e=0);b[e]=this.x;b[e+1]=this.y;return b},fromBufferAttribute:function(b,
  e,a){void 0!==a&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=b.getX(e);this.y=b.getY(e);return this},rotateAround:function(b,e){var a=Math.cos(e),c=Math.sin(e),h=this.x-b.x,g=this.y-b.y;this.x=h*a-g*c+b.x;this.y=h*c+g*a+b.y;return this}});Object.assign(f.prototype,{isMatrix4:!0,set:function(b,e,a,c,h,g,d,f,p,n,m,l,s,q,r,t){var u=this.elements;u[0]=b;u[4]=e;u[8]=a;u[12]=c;u[1]=h;u[5]=g;u[9]=d;u[13]=f;u[2]=p;u[6]=n;u[10]=m;u[14]=l;u[3]=s;u[7]=q;u[11]=r;
  u[15]=t;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new f).fromArray(this.elements)},copy:function(b){var e=this.elements;b=b.elements;e[0]=b[0];e[1]=b[1];e[2]=b[2];e[3]=b[3];e[4]=b[4];e[5]=b[5];e[6]=b[6];e[7]=b[7];e[8]=b[8];e[9]=b[9];e[10]=b[10];e[11]=b[11];e[12]=b[12];e[13]=b[13];e[14]=b[14];e[15]=b[15];return this},copyPosition:function(b){var e=this.elements;b=b.elements;e[12]=b[12];e[13]=b[13];e[14]=b[14];return this},extractBasis:function(b,
  e,a){b.setFromMatrixColumn(this,0);e.setFromMatrixColumn(this,1);a.setFromMatrixColumn(this,2);return this},makeBasis:function(b,e,a){this.set(b.x,e.x,a.x,0,b.y,e.y,a.y,0,b.z,e.z,a.z,0,0,0,0,1);return this},extractRotation:function(){var b=new m;return function(e){var a=this.elements,c=e.elements,h=1/b.setFromMatrixColumn(e,0).length(),g=1/b.setFromMatrixColumn(e,1).length();e=1/b.setFromMatrixColumn(e,2).length();a[0]=c[0]*h;a[1]=c[1]*h;a[2]=c[2]*h;a[3]=0;a[4]=c[4]*g;a[5]=c[5]*g;a[6]=c[6]*g;a[7]=
  0;a[8]=c[8]*e;a[9]=c[9]*e;a[10]=c[10]*e;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this}}(),makeRotationFromEuler:function(b){b&&b.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,a=b.x,c=b.y,h=b.z,g=Math.cos(a),a=Math.sin(a),d=Math.cos(c),c=Math.sin(c),f=Math.cos(h),h=Math.sin(h);if("XYZ"===b.order){b=g*f;var p=g*h,n=a*f,m=a*h;e[0]=d*f;e[4]=-d*h;e[8]=c;e[1]=p+n*c;e[5]=b-m*c;e[9]=-a*d;e[2]=m-b*c;
  e[6]=n+p*c;e[10]=g*d}else"YXZ"===b.order?(b=d*f,p=d*h,n=c*f,m=c*h,e[0]=b+m*a,e[4]=n*a-p,e[8]=g*c,e[1]=g*h,e[5]=g*f,e[9]=-a,e[2]=p*a-n,e[6]=m+b*a,e[10]=g*d):"ZXY"===b.order?(b=d*f,p=d*h,n=c*f,m=c*h,e[0]=b-m*a,e[4]=-g*h,e[8]=n+p*a,e[1]=p+n*a,e[5]=g*f,e[9]=m-b*a,e[2]=-g*c,e[6]=a,e[10]=g*d):"ZYX"===b.order?(b=g*f,p=g*h,n=a*f,m=a*h,e[0]=d*f,e[4]=n*c-p,e[8]=b*c+m,e[1]=d*h,e[5]=m*c+b,e[9]=p*c-n,e[2]=-c,e[6]=a*d,e[10]=g*d):"YZX"===b.order?(b=g*d,p=g*c,n=a*d,m=a*c,e[0]=d*f,e[4]=m-b*h,e[8]=n*h+p,e[1]=h,e[5]=
  g*f,e[9]=-a*f,e[2]=-c*f,e[6]=p*h+n,e[10]=b-m*h):"XZY"===b.order&&(b=g*d,p=g*c,n=a*d,m=a*c,e[0]=d*f,e[4]=-h,e[8]=c*f,e[1]=b*h+m,e[5]=g*f,e[9]=p*h-n,e[2]=n*h-p,e[6]=a*f,e[10]=m*h+b);e[3]=0;e[7]=0;e[11]=0;e[12]=0;e[13]=0;e[14]=0;e[15]=1;return this},makeRotationFromQuaternion:function(){var b=new m(0,0,0),e=new m(1,1,1);return function(a){return this.compose(b,a,e)}}(),lookAt:function(){var b=new m,e=new m,a=new m;return function(c,h,g){var d=this.elements;a.subVectors(c,h);0===a.lengthSq()&&(a.z=1);
  a.normalize();b.crossVectors(g,a);0===b.lengthSq()&&(1===Math.abs(g.z)?a.x+=1E-4:a.z+=1E-4,a.normalize(),b.crossVectors(g,a));b.normalize();e.crossVectors(a,b);d[0]=b.x;d[4]=e.x;d[8]=a.x;d[1]=b.y;d[5]=e.y;d[9]=a.y;d[2]=b.z;d[6]=e.z;d[10]=a.z;return this}}(),multiply:function(b,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(b,e)):this.multiplyMatrices(this,b)},premultiply:function(b){return this.multiplyMatrices(b,
  this)},multiplyMatrices:function(b,e){var a=b.elements,c=e.elements,h=this.elements,g=a[0],d=a[4],f=a[8],p=a[12],n=a[1],m=a[5],l=a[9],s=a[13],q=a[2],r=a[6],u=a[10],t=a[14],w=a[3],z=a[7],G=a[11],a=a[15],v=c[0],A=c[4],S=c[8],x=c[12],K=c[1],H=c[5],C=c[9],V=c[13],D=c[2],y=c[6],I=c[10],J=c[14],W=c[3],ja=c[7],Q=c[11],c=c[15];h[0]=g*v+d*K+f*D+p*W;h[4]=g*A+d*H+f*y+p*ja;h[8]=g*S+d*C+f*I+p*Q;h[12]=g*x+d*V+f*J+p*c;h[1]=n*v+m*K+l*D+s*W;h[5]=n*A+m*H+l*y+s*ja;h[9]=n*S+m*C+l*I+s*Q;h[13]=n*x+m*V+l*J+s*c;h[2]=q*v+
  r*K+u*D+t*W;h[6]=q*A+r*H+u*y+t*ja;h[10]=q*S+r*C+u*I+t*Q;h[14]=q*x+r*V+u*J+t*c;h[3]=w*v+z*K+G*D+a*W;h[7]=w*A+z*H+G*y+a*ja;h[11]=w*S+z*C+G*I+a*Q;h[15]=w*x+z*V+G*J+a*c;return this},multiplyScalar:function(b){var e=this.elements;e[0]*=b;e[4]*=b;e[8]*=b;e[12]*=b;e[1]*=b;e[5]*=b;e[9]*=b;e[13]*=b;e[2]*=b;e[6]*=b;e[10]*=b;e[14]*=b;e[3]*=b;e[7]*=b;e[11]*=b;e[15]*=b;return this},applyToBufferAttribute:function(){var b=new m;return function(e){for(var a=0,c=e.count;a<c;a++)b.x=e.getX(a),b.y=e.getY(a),b.z=e.getZ(a),
  b.applyMatrix4(this),e.setXYZ(a,b.x,b.y,b.z);return e}}(),determinant:function(){var b=this.elements,e=b[0],a=b[4],c=b[8],h=b[12],g=b[1],d=b[5],f=b[9],p=b[13],n=b[2],m=b[6],l=b[10],s=b[14];return b[3]*(+h*f*m-c*p*m-h*d*l+a*p*l+c*d*s-a*f*s)+b[7]*(+e*f*s-e*p*l+h*g*l-c*g*s+c*p*n-h*f*n)+b[11]*(+e*p*m-e*d*s-h*g*m+a*g*s+h*d*n-a*p*n)+b[15]*(-c*d*n-e*f*m+e*d*l+c*g*m-a*g*l+a*f*n)},transpose:function(){var b=this.elements,e;e=b[1];b[1]=b[4];b[4]=e;e=b[2];b[2]=b[8];b[8]=e;e=b[6];b[6]=b[9];b[9]=e;e=b[3];b[3]=
  b[12];b[12]=e;e=b[7];b[7]=b[13];b[13]=e;e=b[11];b[11]=b[14];b[14]=e;return this},setPosition:function(b){var e=this.elements;e[12]=b.x;e[13]=b.y;e[14]=b.z;return this},getInverse:function(b,e){var a=this.elements,c=b.elements,h=c[0],g=c[1],d=c[2],f=c[3],p=c[4],n=c[5],m=c[6],l=c[7],s=c[8],q=c[9],r=c[10],u=c[11],t=c[12],w=c[13],z=c[14],c=c[15],G=q*z*l-w*r*l+w*m*u-n*z*u-q*m*c+n*r*c,v=t*r*l-s*z*l-t*m*u+p*z*u+s*m*c-p*r*c,A=s*w*l-t*q*l+t*n*u-p*w*u-s*n*c+p*q*c,S=t*q*m-s*w*m-t*n*r+p*w*r+s*n*z-p*q*z,x=h*G+
  g*v+d*A+f*S;if(0===x){if(!0===e)throw Error("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");console.warn("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}x=1/x;a[0]=G*x;a[1]=(w*r*f-q*z*f-w*d*u+g*z*u+q*d*c-g*r*c)*x;a[2]=(n*z*f-w*m*f+w*d*l-g*z*l-n*d*c+g*m*c)*x;a[3]=(q*m*f-n*r*f-q*d*l+g*r*l+n*d*u-g*m*u)*x;a[4]=v*x;a[5]=(s*z*f-t*r*f+t*d*u-h*z*u-s*d*c+h*r*c)*x;a[6]=(t*m*f-p*z*f-t*d*l+h*z*l+p*d*c-h*m*c)*x;a[7]=(p*r*f-s*m*f+s*d*l-h*r*l-p*
  d*u+h*m*u)*x;a[8]=A*x;a[9]=(t*q*f-s*w*f-t*g*u+h*w*u+s*g*c-h*q*c)*x;a[10]=(p*w*f-t*n*f+t*g*l-h*w*l-p*g*c+h*n*c)*x;a[11]=(s*n*f-p*q*f-s*g*l+h*q*l+p*g*u-h*n*u)*x;a[12]=S*x;a[13]=(s*w*d-t*q*d+t*g*r-h*w*r-s*g*z+h*q*z)*x;a[14]=(t*n*d-p*w*d-t*g*m+h*w*m+p*g*z-h*n*z)*x;a[15]=(p*q*d-s*n*d+s*g*m-h*q*m-p*g*r+h*n*r)*x;return this},scale:function(b){var e=this.elements,a=b.x,c=b.y;b=b.z;e[0]*=a;e[4]*=c;e[8]*=b;e[1]*=a;e[5]*=c;e[9]*=b;e[2]*=a;e[6]*=c;e[10]*=b;e[3]*=a;e[7]*=c;e[11]*=b;return this},getMaxScaleOnAxis:function(){var b=
  this.elements;return Math.sqrt(Math.max(b[0]*b[0]+b[1]*b[1]+b[2]*b[2],b[4]*b[4]+b[5]*b[5]+b[6]*b[6],b[8]*b[8]+b[9]*b[9]+b[10]*b[10]))},makeTranslation:function(b,e,a){this.set(1,0,0,b,0,1,0,e,0,0,1,a,0,0,0,1);return this},makeRotationX:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,e,-b,0,0,b,e,0,0,0,0,1);return this},makeRotationY:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(e,0,b,0,0,1,0,0,-b,0,e,0,0,0,0,1);return this},makeRotationZ:function(b){var e=Math.cos(b);b=Math.sin(b);
  this.set(e,-b,0,0,b,e,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(b,e){var a=Math.cos(e),c=Math.sin(e),h=1-a,g=b.x,d=b.y,f=b.z,p=h*g,n=h*d;this.set(p*g+a,p*d-c*f,p*f+c*d,0,p*d+c*f,n*d+a,n*f-c*g,0,p*f-c*d,n*f+c*g,h*f*f+a,0,0,0,0,1);return this},makeScale:function(b,e,a){this.set(b,0,0,0,0,e,0,0,0,0,a,0,0,0,0,1);return this},makeShear:function(b,e,a){this.set(1,e,a,0,b,1,a,0,b,e,1,0,0,0,0,1);return this},compose:function(b,e,a){var c=this.elements,h=e._x,g=e._y,d=e._z,f=e._w,p=h+h,n=
  g+g,m=d+d;e=h*p;var l=h*n,h=h*m,s=g*n,g=g*m,d=d*m,p=f*p,n=f*n,f=f*m,m=a.x,q=a.y;a=a.z;c[0]=(1-(s+d))*m;c[1]=(l+f)*m;c[2]=(h-n)*m;c[3]=0;c[4]=(l-f)*q;c[5]=(1-(e+d))*q;c[6]=(g+p)*q;c[7]=0;c[8]=(h+n)*a;c[9]=(g-p)*a;c[10]=(1-(e+s))*a;c[11]=0;c[12]=b.x;c[13]=b.y;c[14]=b.z;c[15]=1;return this},decompose:function(){var b=new m,e=new f;return function(a,c,h){var g=this.elements,d=b.set(g[0],g[1],g[2]).length(),f=b.set(g[4],g[5],g[6]).length(),p=b.set(g[8],g[9],g[10]).length();0>this.determinant()&&(d=-d);
  a.x=g[12];a.y=g[13];a.z=g[14];e.copy(this);a=1/d;var g=1/f,n=1/p;e.elements[0]*=a;e.elements[1]*=a;e.elements[2]*=a;e.elements[4]*=g;e.elements[5]*=g;e.elements[6]*=g;e.elements[8]*=n;e.elements[9]*=n;e.elements[10]*=n;c.setFromRotationMatrix(e);h.x=d;h.y=f;h.z=p;return this}}(),makePerspective:function(b,e,a,c,h,g){void 0===g&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var d=this.elements;d[0]=2*h/(e-b);d[4]=0;d[8]=(e+b)/(e-
  b);d[12]=0;d[1]=0;d[5]=2*h/(a-c);d[9]=(a+c)/(a-c);d[13]=0;d[2]=0;d[6]=0;d[10]=-(g+h)/(g-h);d[14]=-2*g*h/(g-h);d[3]=0;d[7]=0;d[11]=-1;d[15]=0;return this},makeOrthographic:function(b,e,a,c,h,g){var d=this.elements,f=1/(e-b),p=1/(a-c),n=1/(g-h);d[0]=2*f;d[4]=0;d[8]=0;d[12]=-((e+b)*f);d[1]=0;d[5]=2*p;d[9]=0;d[13]=-((a+c)*p);d[2]=0;d[6]=0;d[10]=-2*n;d[14]=-((g+h)*n);d[3]=0;d[7]=0;d[11]=0;d[15]=1;return this},equals:function(b){var e=this.elements;b=b.elements;for(var a=0;16>a;a++)if(e[a]!==b[a])return!1;
  return!0},fromArray:function(b,e){void 0===e&&(e=0);for(var a=0;16>a;a++)this.elements[a]=b[a+e];return this},toArray:function(b,e){void 0===b&&(b=[]);void 0===e&&(e=0);var a=this.elements;b[e]=a[0];b[e+1]=a[1];b[e+2]=a[2];b[e+3]=a[3];b[e+4]=a[4];b[e+5]=a[5];b[e+6]=a[6];b[e+7]=a[7];b[e+8]=a[8];b[e+9]=a[9];b[e+10]=a[10];b[e+11]=a[11];b[e+12]=a[12];b[e+13]=a[13];b[e+14]=a[14];b[e+15]=a[15];return b}});Object.assign(l,{slerp:function(b,e,a,c){return a.copy(b).slerp(e,c)},slerpFlat:function(b,e,a,c,h,
  g,d){var f=a[c+0],p=a[c+1],n=a[c+2];a=a[c+3];c=h[g+0];var m=h[g+1],l=h[g+2];h=h[g+3];if(a!==h||f!==c||p!==m||n!==l){g=1-d;var s=f*c+p*m+n*l+a*h,q=0<=s?1:-1,r=1-s*s;r>Number.EPSILON&&(r=Math.sqrt(r),s=Math.atan2(r,s*q),g=Math.sin(g*s)/r,d=Math.sin(d*s)/r);q*=d;f=f*g+c*q;p=p*g+m*q;n=n*g+l*q;a=a*g+h*q;g===1-d&&(d=1/Math.sqrt(f*f+p*p+n*n+a*a),f*=d,p*=d,n*=d,a*=d)}b[e]=f;b[e+1]=p;b[e+2]=n;b[e+3]=a}});Object.defineProperties(l.prototype,{x:{get:function(){return this._x},set:function(b){this._x=b;this.onChangeCallback()}},
  y:{get:function(){return this._y},set:function(b){this._y=b;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(b){this._z=b;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(b){this._w=b;this.onChangeCallback()}}});Object.assign(l.prototype,{isQuaternion:!0,set:function(b,e,a,c){this._x=b;this._y=e;this._z=a;this._w=c;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(b){this._x=
  b.x;this._y=b.y;this._z=b.z;this._w=b.w;this.onChangeCallback();return this},setFromEuler:function(b,e){if(!b||!b.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var a=b._x,c=b._y,h=b._z,g=b.order,d=Math.cos,f=Math.sin,p=d(a/2),n=d(c/2),d=d(h/2),a=f(a/2),c=f(c/2),h=f(h/2);"XYZ"===g?(this._x=a*n*d+p*c*h,this._y=p*c*d-a*n*h,this._z=p*n*h+a*c*d,this._w=p*n*d-a*c*h):"YXZ"===g?(this._x=a*n*d+p*c*h,this._y=p*c*d-a*n*h,this._z=p*n*h-
  a*c*d,this._w=p*n*d+a*c*h):"ZXY"===g?(this._x=a*n*d-p*c*h,this._y=p*c*d+a*n*h,this._z=p*n*h+a*c*d,this._w=p*n*d-a*c*h):"ZYX"===g?(this._x=a*n*d-p*c*h,this._y=p*c*d+a*n*h,this._z=p*n*h-a*c*d,this._w=p*n*d+a*c*h):"YZX"===g?(this._x=a*n*d+p*c*h,this._y=p*c*d+a*n*h,this._z=p*n*h-a*c*d,this._w=p*n*d-a*c*h):"XZY"===g&&(this._x=a*n*d-p*c*h,this._y=p*c*d-a*n*h,this._z=p*n*h+a*c*d,this._w=p*n*d+a*c*h);if(!1!==e)this.onChangeCallback();return this},setFromAxisAngle:function(b,e){var a=e/2,c=Math.sin(a);this._x=
  b.x*c;this._y=b.y*c;this._z=b.z*c;this._w=Math.cos(a);this.onChangeCallback();return this},setFromRotationMatrix:function(b){var e=b.elements,a=e[0];b=e[4];var c=e[8],h=e[1],g=e[5],d=e[9],f=e[2],n=e[6],e=e[10],m=a+g+e;0<m?(a=0.5/Math.sqrt(m+1),this._w=0.25/a,this._x=(n-d)*a,this._y=(c-f)*a,this._z=(h-b)*a):a>g&&a>e?(a=2*Math.sqrt(1+a-g-e),this._w=(n-d)/a,this._x=0.25*a,this._y=(b+h)/a,this._z=(c+f)/a):g>e?(a=2*Math.sqrt(1+g-a-e),this._w=(c-f)/a,this._x=(b+h)/a,this._y=0.25*a,this._z=(d+n)/a):(a=2*
  Math.sqrt(1+e-a-g),this._w=(h-b)/a,this._x=(c+f)/a,this._y=(d+n)/a,this._z=0.25*a);this.onChangeCallback();return this},setFromUnitVectors:function(){var b=new m,e;return function(a,c){void 0===b&&(b=new m);e=a.dot(c)+1;1E-6>e?(e=0,Math.abs(a.x)>Math.abs(a.z)?b.set(-a.y,a.x,0):b.set(0,-a.z,a.y)):b.crossVectors(a,c);this._x=b.x;this._y=b.y;this._z=b.z;this._w=e;return this.normalize()}}(),angleTo:function(b){return 2*Math.acos(Math.abs(ga.clamp(this.dot(b),-1,1)))},rotateTowards:function(b,e){var a=
  this.angleTo(b);if(0===a)return this;a=Math.min(1,e/a);this.slerp(b,a);return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(b){return this._x*b._x+this._y*b._y+this._z*b._z+this._w*b._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var b=
  this.length();0===b?(this._z=this._y=this._x=0,this._w=1):(b=1/b,this._x*=b,this._y*=b,this._z*=b,this._w*=b);this.onChangeCallback();return this},multiply:function(b,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(b,e)):this.multiplyQuaternions(this,b)},premultiply:function(b){return this.multiplyQuaternions(b,this)},multiplyQuaternions:function(b,e){var a=b._x,c=b._y,h=b._z,g=b._w,
  d=e._x,f=e._y,n=e._z,m=e._w;this._x=a*m+g*d+c*n-h*f;this._y=c*m+g*f+h*d-a*n;this._z=h*m+g*n+a*f-c*d;this._w=g*m-a*d-c*f-h*n;this.onChangeCallback();return this},slerp:function(b,e){if(0===e)return this;if(1===e)return this.copy(b);var a=this._x,c=this._y,h=this._z,g=this._w,d=g*b._w+a*b._x+c*b._y+h*b._z;0>d?(this._w=-b._w,this._x=-b._x,this._y=-b._y,this._z=-b._z,d=-d):this.copy(b);if(1<=d)return this._w=g,this._x=a,this._y=c,this._z=h,this;var f=1-d*d;if(f<=Number.EPSILON)return f=1-e,this._w=f*
  g+e*this._w,this._x=f*a+e*this._x,this._y=f*c+e*this._y,this._z=f*h+e*this._z,this.normalize();var f=Math.sqrt(f),n=Math.atan2(f,d),d=Math.sin((1-e)*n)/f,f=Math.sin(e*n)/f;this._w=g*d+this._w*f;this._x=a*d+this._x*f;this._y=c*d+this._y*f;this._z=h*d+this._z*f;this.onChangeCallback();return this},equals:function(b){return b._x===this._x&&b._y===this._y&&b._z===this._z&&b._w===this._w},fromArray:function(b,e){void 0===e&&(e=0);this._x=b[e];this._y=b[e+1];this._z=b[e+2];this._w=b[e+3];this.onChangeCallback();
  return this},toArray:function(b,e){void 0===b&&(b=[]);void 0===e&&(e=0);b[e]=this._x;b[e+1]=this._y;b[e+2]=this._z;b[e+3]=this._w;return b},onChange:function(b){this.onChangeCallback=b;return this},onChangeCallback:function(){}});Object.assign(m.prototype,{isVector3:!0,set:function(b,e,a){this.x=b;this.y=e;this.z=a;return this},setScalar:function(b){this.z=this.y=this.x=b;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},
  setComponent:function(b,e){switch(b){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+b);}return this},getComponent:function(b){switch(b){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+b);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},add:function(b,e){if(void 0!==e)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
  this.addVectors(b,e);this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},addVectors:function(b,e){this.x=b.x+e.x;this.y=b.y+e.y;this.z=b.z+e.z;return this},addScaledVector:function(b,e){this.x+=b.x*e;this.y+=b.y*e;this.z+=b.z*e;return this},sub:function(b,e){if(void 0!==e)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(b,e);this.x-=b.x;this.y-=b.y;this.z-=b.z;
  return this},subScalar:function(b){this.x-=b;this.y-=b;this.z-=b;return this},subVectors:function(b,e){this.x=b.x-e.x;this.y=b.y-e.y;this.z=b.z-e.z;return this},multiply:function(b,e){if(void 0!==e)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(b,e);this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},multiplyVectors:function(b,e){this.x=b.x*
  e.x;this.y=b.y*e.y;this.z=b.z*e.z;return this},applyEuler:function(){var b=new l;return function(e){e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(b.setFromEuler(e))}}(),applyAxisAngle:function(){var b=new l;return function(e,a){return this.applyQuaternion(b.setFromAxisAngle(e,a))}}(),applyMatrix3:function(b){var e=this.x,a=this.y,c=this.z;b=b.elements;this.x=b[0]*e+b[3]*a+b[6]*c;this.y=b[1]*e+
  b[4]*a+b[7]*c;this.z=b[2]*e+b[5]*a+b[8]*c;return this},applyMatrix4:function(b){var e=this.x,a=this.y,c=this.z;b=b.elements;var h=1/(b[3]*e+b[7]*a+b[11]*c+b[15]);this.x=(b[0]*e+b[4]*a+b[8]*c+b[12])*h;this.y=(b[1]*e+b[5]*a+b[9]*c+b[13])*h;this.z=(b[2]*e+b[6]*a+b[10]*c+b[14])*h;return this},applyQuaternion:function(b){var e=this.x,a=this.y,c=this.z,h=b.x,g=b.y,d=b.z;b=b.w;var f=b*e+g*c-d*a,n=b*a+d*e-h*c,m=b*c+h*a-g*e,e=-h*e-g*a-d*c;this.x=f*b+e*-h+n*-d-m*-g;this.y=n*b+e*-g+m*-h-f*-d;this.z=m*b+e*-d+
  f*-g-n*-h;return this},project:function(b){return this.applyMatrix4(b.matrixWorldInverse).applyMatrix4(b.projectionMatrix)},unproject:function(){var b=new f;return function(e){return this.applyMatrix4(b.getInverse(e.projectionMatrix)).applyMatrix4(e.matrixWorld)}}(),transformDirection:function(b){var e=this.x,a=this.y,c=this.z;b=b.elements;this.x=b[0]*e+b[4]*a+b[8]*c;this.y=b[1]*e+b[5]*a+b[9]*c;this.z=b[2]*e+b[6]*a+b[10]*c;return this.normalize()},divide:function(b){this.x/=b.x;this.y/=b.y;this.z/=
  b.z;return this},divideScalar:function(b){return this.multiplyScalar(1/b)},min:function(b){this.x=Math.min(this.x,b.x);this.y=Math.min(this.y,b.y);this.z=Math.min(this.z,b.z);return this},max:function(b){this.x=Math.max(this.x,b.x);this.y=Math.max(this.y,b.y);this.z=Math.max(this.z,b.z);return this},clamp:function(b,e){this.x=Math.max(b.x,Math.min(e.x,this.x));this.y=Math.max(b.y,Math.min(e.y,this.y));this.z=Math.max(b.z,Math.min(e.z,this.z));return this},clampScalar:function(){var b=new m,e=new m;
  return function(a,c){b.set(a,a,a);e.set(c,c,c);return this.clamp(b,e)}}(),clampLength:function(b,e){var a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(b,Math.min(e,a)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);
  return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+
  Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(b){return this.normalize().multiplyScalar(b)},lerp:function(b,e){this.x+=(b.x-this.x)*e;this.y+=(b.y-this.y)*e;this.z+=(b.z-this.z)*e;return this},lerpVectors:function(b,e,a){return this.subVectors(e,b).multiplyScalar(a).add(b)},cross:function(b,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(b,
  e)):this.crossVectors(this,b)},crossVectors:function(b,e){var a=b.x,c=b.y,h=b.z,g=e.x,d=e.y,f=e.z;this.x=c*f-h*d;this.y=h*g-a*f;this.z=a*d-c*g;return this},projectOnVector:function(b){var e=b.dot(this)/b.lengthSq();return this.copy(b).multiplyScalar(e)},projectOnPlane:function(){var b=new m;return function(e){b.copy(this).projectOnVector(e);return this.sub(b)}}(),reflect:function(){var b=new m;return function(e){return this.sub(b.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(b){b=this.dot(b)/
  Math.sqrt(this.lengthSq()*b.lengthSq());return Math.acos(ga.clamp(b,-1,1))},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var e=this.x-b.x,a=this.y-b.y;b=this.z-b.z;return e*e+a*a+b*b},manhattanDistanceTo:function(b){return Math.abs(this.x-b.x)+Math.abs(this.y-b.y)+Math.abs(this.z-b.z)},setFromSpherical:function(b){return this.setFromSphericalCoords(b.radius,b.phi,b.theta)},setFromSphericalCoords:function(b,e,a){var c=Math.sin(e)*b;this.x=c*Math.sin(a);
  this.y=Math.cos(e)*b;this.z=c*Math.cos(a);return this},setFromCylindrical:function(b){return this.setFromCylindricalCoords(b.radius,b.theta,b.y)},setFromCylindricalCoords:function(b,e,a){this.x=b*Math.sin(e);this.y=a;this.z=b*Math.cos(e);return this},setFromMatrixPosition:function(b){b=b.elements;this.x=b[12];this.y=b[13];this.z=b[14];return this},setFromMatrixScale:function(b){var e=this.setFromMatrixColumn(b,0).length(),a=this.setFromMatrixColumn(b,1).length();b=this.setFromMatrixColumn(b,2).length();
  this.x=e;this.y=a;this.z=b;return this},setFromMatrixColumn:function(b,e){return this.fromArray(b.elements,4*e)},equals:function(b){return b.x===this.x&&b.y===this.y&&b.z===this.z},fromArray:function(b,e){void 0===e&&(e=0);this.x=b[e];this.y=b[e+1];this.z=b[e+2];return this},toArray:function(b,e){void 0===b&&(b=[]);void 0===e&&(e=0);b[e]=this.x;b[e+1]=this.y;b[e+2]=this.z;return b},fromBufferAttribute:function(b,e,a){void 0!==a&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");
  this.x=b.getX(e);this.y=b.getY(e);this.z=b.getZ(e);return this}});Object.assign(r.prototype,{isMatrix3:!0,set:function(b,e,a,c,h,g,d,f,n){var m=this.elements;m[0]=b;m[1]=c;m[2]=d;m[3]=e;m[4]=h;m[5]=f;m[6]=a;m[7]=g;m[8]=n;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(b){var e=this.elements;b=b.elements;e[0]=b[0];e[1]=b[1];e[2]=b[2];e[3]=b[3];e[4]=b[4];e[5]=b[5];e[6]=b[6];e[7]=b[7];e[8]=
  b[8];return this},setFromMatrix4:function(b){b=b.elements;this.set(b[0],b[4],b[8],b[1],b[5],b[9],b[2],b[6],b[10]);return this},applyToBufferAttribute:function(){var b=new m;return function(e){for(var a=0,c=e.count;a<c;a++)b.x=e.getX(a),b.y=e.getY(a),b.z=e.getZ(a),b.applyMatrix3(this),e.setXYZ(a,b.x,b.y,b.z);return e}}(),multiply:function(b){return this.multiplyMatrices(this,b)},premultiply:function(b){return this.multiplyMatrices(b,this)},multiplyMatrices:function(b,e){var a=b.elements,c=e.elements,
  h=this.elements,g=a[0],d=a[3],f=a[6],n=a[1],m=a[4],l=a[7],s=a[2],q=a[5],a=a[8],r=c[0],u=c[3],t=c[6],w=c[1],G=c[4],z=c[7],v=c[2],A=c[5],c=c[8];h[0]=g*r+d*w+f*v;h[3]=g*u+d*G+f*A;h[6]=g*t+d*z+f*c;h[1]=n*r+m*w+l*v;h[4]=n*u+m*G+l*A;h[7]=n*t+m*z+l*c;h[2]=s*r+q*w+a*v;h[5]=s*u+q*G+a*A;h[8]=s*t+q*z+a*c;return this},multiplyScalar:function(b){var e=this.elements;e[0]*=b;e[3]*=b;e[6]*=b;e[1]*=b;e[4]*=b;e[7]*=b;e[2]*=b;e[5]*=b;e[8]*=b;return this},determinant:function(){var b=this.elements,e=b[0],a=b[1],c=b[2],
  h=b[3],g=b[4],d=b[5],f=b[6],n=b[7],b=b[8];return e*g*b-e*d*n-a*h*b+a*d*f+c*h*n-c*g*f},getInverse:function(b,e){b&&b.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var a=b.elements,c=this.elements,h=a[0],g=a[1],d=a[2],f=a[3],n=a[4],m=a[5],l=a[6],s=a[7],a=a[8],q=a*n-m*s,r=m*l-a*f,u=s*f-n*l,t=h*q+g*r+d*u;if(0===t){if(!0===e)throw Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");console.warn("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");
  return this.identity()}t=1/t;c[0]=q*t;c[1]=(d*s-a*g)*t;c[2]=(m*g-d*n)*t;c[3]=r*t;c[4]=(a*h-d*l)*t;c[5]=(d*f-m*h)*t;c[6]=u*t;c[7]=(g*l-s*h)*t;c[8]=(n*h-g*f)*t;return this},transpose:function(){var b,e=this.elements;b=e[1];e[1]=e[3];e[3]=b;b=e[2];e[2]=e[6];e[6]=b;b=e[5];e[5]=e[7];e[7]=b;return this},getNormalMatrix:function(b){return this.setFromMatrix4(b).getInverse(this).transpose()},transposeIntoArray:function(b){var e=this.elements;b[0]=e[0];b[1]=e[3];b[2]=e[6];b[3]=e[1];b[4]=e[4];b[5]=e[7];b[6]=
  e[2];b[7]=e[5];b[8]=e[8];return this},setUvTransform:function(b,e,a,c,h,g,d){var f=Math.cos(h);h=Math.sin(h);this.set(a*f,a*h,-a*(f*g+h*d)+g+b,-c*h,c*f,-c*(-h*g+f*d)+d+e,0,0,1)},scale:function(b,e){var a=this.elements;a[0]*=b;a[3]*=b;a[6]*=b;a[1]*=e;a[4]*=e;a[7]*=e;return this},rotate:function(b){var e=Math.cos(b);b=Math.sin(b);var a=this.elements,c=a[0],h=a[3],g=a[6],d=a[1],f=a[4],n=a[7];a[0]=e*c+b*d;a[3]=e*h+b*f;a[6]=e*g+b*n;a[1]=-b*c+e*d;a[4]=-b*h+e*f;a[7]=-b*g+e*n;return this},translate:function(b,
  e){var a=this.elements;a[0]+=b*a[2];a[3]+=b*a[5];a[6]+=b*a[8];a[1]+=e*a[2];a[4]+=e*a[5];a[7]+=e*a[8];return this},equals:function(b){var e=this.elements;b=b.elements;for(var a=0;9>a;a++)if(e[a]!==b[a])return!1;return!0},fromArray:function(b,e){void 0===e&&(e=0);for(var a=0;9>a;a++)this.elements[a]=b[a+e];return this},toArray:function(b,e){void 0===b&&(b=[]);void 0===e&&(e=0);var a=this.elements;b[e]=a[0];b[e+1]=a[1];b[e+2]=a[2];b[e+3]=a[3];b[e+4]=a[4];b[e+5]=a[5];b[e+6]=a[6];b[e+7]=a[7];b[e+8]=a[8];
  return b}});var yb={getDataURL:function(b){var e;if(b instanceof HTMLCanvasElement)e=b;else{e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=b.width;e.height=b.height;var a=e.getContext("2d");b instanceof ImageData?a.putImageData(b,0,0):a.drawImage(b,0,0,b.width,b.height)}return 2048<e.width||2048<e.height?e.toDataURL("image/jpeg",0.6):e.toDataURL("image/png")}},Sh=0;q.DEFAULT_IMAGE=void 0;q.DEFAULT_MAPPING=300;q.prototype=Object.assign(Object.create(c.prototype),{constructor:q,
  isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.name=b.name;this.image=b.image;this.mipmaps=b.mipmaps.slice(0);this.mapping=b.mapping;this.wrapS=b.wrapS;this.wrapT=b.wrapT;this.magFilter=b.magFilter;this.minFilter=b.minFilter;this.anisotropy=b.anisotropy;this.format=b.format;this.type=b.type;this.offset.copy(b.offset);
  this.repeat.copy(b.repeat);this.center.copy(b.center);this.rotation=b.rotation;this.matrixAutoUpdate=b.matrixAutoUpdate;this.matrix.copy(b.matrix);this.generateMipmaps=b.generateMipmaps;this.premultiplyAlpha=b.premultiplyAlpha;this.flipY=b.flipY;this.unpackAlignment=b.unpackAlignment;this.encoding=b.encoding;return this},toJSON:function(b){var e=void 0===b||"string"===typeof b;if(!e&&void 0!==b.textures[this.uuid])return b.textures[this.uuid];var a={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},
  uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var c=this.image;void 0===c.uuid&&(c.uuid=ga.generateUUID());if(!e&&void 0===b.images[c.uuid]){var h;if(Array.isArray(c)){h=[];for(var g=0,d=c.length;g<
  d;g++)h.push(yb.getDataURL(c[g]))}else h=yb.getDataURL(c);b.images[c.uuid]={uuid:c.uuid,url:h}}a.image=c.uuid}e||(b.textures[this.uuid]=a);return a},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(b){if(300!==this.mapping)return b;b.applyMatrix3(this.matrix);if(0>b.x||1<b.x)switch(this.wrapS){case nb:b.x-=Math.floor(b.x);break;case Qa:b.x=0>b.x?0:1;break;case Bb:1===Math.abs(Math.floor(b.x)%2)?b.x=Math.ceil(b.x)-b.x:b.x-=Math.floor(b.x)}if(0>b.y||1<b.y)switch(this.wrapT){case nb:b.y-=
  Math.floor(b.y);break;case Qa:b.y=0>b.y?0:1;break;case Bb:1===Math.abs(Math.floor(b.y)%2)?b.y=Math.ceil(b.y)-b.y:b.y-=Math.floor(b.y)}this.flipY&&(b.y=1-b.y);return b}});Object.defineProperty(q.prototype,"needsUpdate",{set:function(b){!0===b&&this.version++}});Object.assign(t.prototype,{isVector4:!0,set:function(b,e,a,c){this.x=b;this.y=e;this.z=a;this.w=c;return this},setScalar:function(b){this.w=this.z=this.y=this.x=b;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;
  return this},setZ:function(b){this.z=b;return this},setW:function(b){this.w=b;return this},setComponent:function(b,e){switch(b){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+b);}return this},getComponent:function(b){switch(b){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+b);}},clone:function(){return new this.constructor(this.x,
  this.y,this.z,this.w)},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=void 0!==b.w?b.w:1;return this},add:function(b,e){if(void 0!==e)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(b,e);this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;this.w+=b;return this},addVectors:function(b,e){this.x=b.x+e.x;this.y=b.y+e.y;this.z=b.z+e.z;this.w=b.w+e.w;return this},
  addScaledVector:function(b,e){this.x+=b.x*e;this.y+=b.y*e;this.z+=b.z*e;this.w+=b.w*e;return this},sub:function(b,e){if(void 0!==e)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(b,e);this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},subScalar:function(b){this.x-=b;this.y-=b;this.z-=b;this.w-=b;return this},subVectors:function(b,e){this.x=b.x-e.x;this.y=b.y-e.y;this.z=b.z-e.z;this.w=b.w-e.w;return this},multiplyScalar:function(b){this.x*=
  b;this.y*=b;this.z*=b;this.w*=b;return this},applyMatrix4:function(b){var e=this.x,a=this.y,c=this.z,h=this.w;b=b.elements;this.x=b[0]*e+b[4]*a+b[8]*c+b[12]*h;this.y=b[1]*e+b[5]*a+b[9]*c+b[13]*h;this.z=b[2]*e+b[6]*a+b[10]*c+b[14]*h;this.w=b[3]*e+b[7]*a+b[11]*c+b[15]*h;return this},divideScalar:function(b){return this.multiplyScalar(1/b)},setAxisAngleFromQuaternion:function(b){this.w=2*Math.acos(b.w);var e=Math.sqrt(1-b.w*b.w);1E-4>e?(this.x=1,this.z=this.y=0):(this.x=b.x/e,this.y=b.y/e,this.z=b.z/
  e);return this},setAxisAngleFromRotationMatrix:function(b){var e,a,c;b=b.elements;var h=b[0];c=b[4];var g=b[8],d=b[1],f=b[5],n=b[9];a=b[2];e=b[6];var m=b[10];if(0.01>Math.abs(c-d)&&0.01>Math.abs(g-a)&&0.01>Math.abs(n-e)){if(0.1>Math.abs(c+d)&&0.1>Math.abs(g+a)&&0.1>Math.abs(n+e)&&0.1>Math.abs(h+f+m-3))return this.set(1,0,0,0),this;b=Math.PI;h=(h+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+d)/4;g=(g+a)/4;n=(n+e)/4;h>f&&h>m?0.01>h?(e=0,c=a=0.707106781):(e=Math.sqrt(h),a=c/e,c=g/e):f>m?0.01>f?(e=0.707106781,a=0,c=
  0.707106781):(a=Math.sqrt(f),e=c/a,c=n/a):0.01>m?(a=e=0.707106781,c=0):(c=Math.sqrt(m),e=g/c,a=n/c);this.set(e,a,c,b);return this}b=Math.sqrt((e-n)*(e-n)+(g-a)*(g-a)+(d-c)*(d-c));0.001>Math.abs(b)&&(b=1);this.x=(e-n)/b;this.y=(g-a)/b;this.z=(d-c)/b;this.w=Math.acos((h+f+m-1)/2);return this},min:function(b){this.x=Math.min(this.x,b.x);this.y=Math.min(this.y,b.y);this.z=Math.min(this.z,b.z);this.w=Math.min(this.w,b.w);return this},max:function(b){this.x=Math.max(this.x,b.x);this.y=Math.max(this.y,b.y);
  this.z=Math.max(this.z,b.z);this.w=Math.max(this.w,b.w);return this},clamp:function(b,e){this.x=Math.max(b.x,Math.min(e.x,this.x));this.y=Math.max(b.y,Math.min(e.y,this.y));this.z=Math.max(b.z,Math.min(e.z,this.z));this.w=Math.max(b.w,Math.min(e.w,this.w));return this},clampScalar:function(){var b,e;return function(a,c){void 0===b&&(b=new t,e=new t);b.set(a,a,a,a);e.set(c,c,c,c);return this.clamp(b,e)}}(),clampLength:function(b,e){var a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(b,
  Math.min(e,a)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?
  Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+
  Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(b){return this.normalize().multiplyScalar(b)},lerp:function(b,e){this.x+=(b.x-this.x)*e;this.y+=(b.y-this.y)*e;this.z+=(b.z-this.z)*e;this.w+=(b.w-this.w)*e;return this},lerpVectors:function(b,e,a){return this.subVectors(e,b).multiplyScalar(a).add(b)},equals:function(b){return b.x===this.x&&b.y===this.y&&b.z===this.z&&b.w===this.w},fromArray:function(b,e){void 0===
  e&&(e=0);this.x=b[e];this.y=b[e+1];this.z=b[e+2];this.w=b[e+3];return this},toArray:function(b,e){void 0===b&&(b=[]);void 0===e&&(e=0);b[e]=this.x;b[e+1]=this.y;b[e+2]=this.z;b[e+3]=this.w;return b},fromBufferAttribute:function(b,e,a){void 0!==a&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");this.x=b.getX(e);this.y=b.getY(e);this.z=b.getZ(e);this.w=b.getW(e);return this}});x.prototype=Object.assign(Object.create(c.prototype),{constructor:x,isWebGLRenderTarget:!0,
  setSize:function(b,e){if(this.width!==b||this.height!==e)this.width=b,this.height=e,this.dispose();this.viewport.set(0,0,b,e);this.scissor.set(0,0,b,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.width=b.width;this.height=b.height;this.viewport.copy(b.viewport);this.texture=b.texture.clone();this.depthBuffer=b.depthBuffer;this.stencilBuffer=b.stencilBuffer;this.depthTexture=b.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});
  v.prototype=Object.create(x.prototype);v.prototype.constructor=v;v.prototype.isWebGLRenderTargetCube=!0;A.prototype=Object.create(q.prototype);A.prototype.constructor=A;A.prototype.isDataTexture=!0;Object.assign(I.prototype,{isBox3:!0,set:function(b,e){this.min.copy(b);this.max.copy(e);return this},setFromArray:function(b){for(var e=Infinity,a=Infinity,c=Infinity,h=-Infinity,g=-Infinity,d=-Infinity,f=0,n=b.length;f<n;f+=3){var m=b[f],l=b[f+1],s=b[f+2];m<e&&(e=m);l<a&&(a=l);s<c&&(c=s);m>h&&(h=m);l>
  g&&(g=l);s>d&&(d=s)}this.min.set(e,a,c);this.max.set(h,g,d);return this},setFromBufferAttribute:function(b){for(var e=Infinity,a=Infinity,c=Infinity,h=-Infinity,g=-Infinity,d=-Infinity,f=0,n=b.count;f<n;f++){var m=b.getX(f),l=b.getY(f),s=b.getZ(f);m<e&&(e=m);l<a&&(a=l);s<c&&(c=s);m>h&&(h=m);l>g&&(g=l);s>d&&(d=s)}this.min.set(e,a,c);this.max.set(h,g,d);return this},setFromPoints:function(b){this.makeEmpty();for(var e=0,a=b.length;e<a;e++)this.expandByPoint(b[e]);return this},setFromCenterAndSize:function(){var b=
  new m;return function(e,a){var c=b.copy(a).multiplyScalar(0.5);this.min.copy(e).sub(c);this.max.copy(e).add(c);return this}}(),setFromObject:function(b){this.makeEmpty();return this.expandByObject(b)},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.min.copy(b.min);this.max.copy(b.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<
  this.min.y||this.max.z<this.min.z},getCenter:function(b){void 0===b&&(console.warn("THREE.Box3: .getCenter() target is now required"),b=new m);return this.isEmpty()?b.set(0,0,0):b.addVectors(this.min,this.max).multiplyScalar(0.5)},getSize:function(b){void 0===b&&(console.warn("THREE.Box3: .getSize() target is now required"),b=new m);return this.isEmpty()?b.set(0,0,0):b.subVectors(this.max,this.min)},expandByPoint:function(b){this.min.min(b);this.max.max(b);return this},expandByVector:function(b){this.min.sub(b);
  this.max.add(b);return this},expandByScalar:function(b){this.min.addScalar(-b);this.max.addScalar(b);return this},expandByObject:function(){function b(b){var g=b.geometry;if(void 0!==g)if(g.isGeometry)for(g=g.vertices,a=0,c=g.length;a<c;a++)h.copy(g[a]),h.applyMatrix4(b.matrixWorld),e.expandByPoint(h);else if(g.isBufferGeometry&&(g=g.attributes.position,void 0!==g))for(a=0,c=g.count;a<c;a++)h.fromBufferAttribute(g,a).applyMatrix4(b.matrixWorld),e.expandByPoint(h)}var e,a,c,h=new m;return function(a){e=
  this;a.updateMatrixWorld(!0);a.traverse(b);return this}}(),containsPoint:function(b){return b.x<this.min.x||b.x>this.max.x||b.y<this.min.y||b.y>this.max.y||b.z<this.min.z||b.z>this.max.z?!1:!0},containsBox:function(b){return this.min.x<=b.min.x&&b.max.x<=this.max.x&&this.min.y<=b.min.y&&b.max.y<=this.max.y&&this.min.z<=b.min.z&&b.max.z<=this.max.z},getParameter:function(b,e){void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new m);return e.set((b.x-this.min.x)/(this.max.x-
  this.min.x),(b.y-this.min.y)/(this.max.y-this.min.y),(b.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(b){return b.max.x<this.min.x||b.min.x>this.max.x||b.max.y<this.min.y||b.min.y>this.max.y||b.max.z<this.min.z||b.min.z>this.max.z?!1:!0},intersectsSphere:function(){var b=new m;return function(e){this.clampPoint(e.center,b);return b.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(b){var e,a;0<b.normal.x?(e=b.normal.x*this.min.x,a=b.normal.x*this.max.x):
  (e=b.normal.x*this.max.x,a=b.normal.x*this.min.x);0<b.normal.y?(e+=b.normal.y*this.min.y,a+=b.normal.y*this.max.y):(e+=b.normal.y*this.max.y,a+=b.normal.y*this.min.y);0<b.normal.z?(e+=b.normal.z*this.min.z,a+=b.normal.z*this.max.z):(e+=b.normal.z*this.max.z,a+=b.normal.z*this.min.z);return e<=-b.constant&&a>=-b.constant},intersectsTriangle:function(){function b(b){var h,g;h=0;for(g=b.length-3;h<=g;h+=3){f.fromArray(b,h);var d=l.x*Math.abs(f.x)+l.y*Math.abs(f.y)+l.z*Math.abs(f.z),n=e.dot(f),L=a.dot(f),
  p=c.dot(f);if(Math.max(-Math.max(n,L,p),Math.min(n,L,p))>d)return!1}return!0}var e=new m,a=new m,c=new m,h=new m,g=new m,d=new m,f=new m,n=new m,l=new m,s=new m;return function(f){if(this.isEmpty())return!1;this.getCenter(n);l.subVectors(this.max,n);e.subVectors(f.a,n);a.subVectors(f.b,n);c.subVectors(f.c,n);h.subVectors(a,e);g.subVectors(c,a);d.subVectors(e,c);f=[0,-h.z,h.y,0,-g.z,g.y,0,-d.z,d.y,h.z,0,-h.x,g.z,0,-g.x,d.z,0,-d.x,-h.y,h.x,0,-g.y,g.x,0,-d.y,d.x,0];if(!b(f))return!1;f=[1,0,0,0,1,0,0,
  0,1];if(!b(f))return!1;s.crossVectors(h,g);f=[s.x,s.y,s.z];return b(f)}}(),clampPoint:function(b,e){void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new m);return e.copy(b).clamp(this.min,this.max)},distanceToPoint:function(){var b=new m;return function(e){return b.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var b=new m;return function(e){void 0===e&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),e=new C);
  this.getCenter(e.center);e.radius=0.5*this.getSize(b).length();return e}}(),intersect:function(b){this.min.max(b.min);this.max.min(b.max);this.isEmpty()&&this.makeEmpty();return this},union:function(b){this.min.min(b.min);this.max.max(b.max);return this},applyMatrix4:function(){var b=[new m,new m,new m,new m,new m,new m,new m,new m];return function(e){if(this.isEmpty())return this;b[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e);b[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e);
  b[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e);b[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e);b[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e);b[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e);b[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e);b[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e);this.setFromPoints(b);return this}}(),translate:function(b){this.min.add(b);this.max.add(b);return this},equals:function(b){return b.min.equals(this.min)&&
  b.max.equals(this.max)}});Object.assign(C.prototype,{set:function(b,e){this.center.copy(b);this.radius=e;return this},setFromPoints:function(){var b=new I;return function(e,a){var c=this.center;void 0!==a?c.copy(a):b.setFromPoints(e).getCenter(c);for(var h=0,g=0,d=e.length;g<d;g++)h=Math.max(h,c.distanceToSquared(e[g]));this.radius=Math.sqrt(h);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.center.copy(b.center);this.radius=b.radius;return this},empty:function(){return 0>=
  this.radius},containsPoint:function(b){return b.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(b){return b.distanceTo(this.center)-this.radius},intersectsSphere:function(b){var e=this.radius+b.radius;return b.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(b){return b.intersectsSphere(this)},intersectsPlane:function(b){return Math.abs(b.distanceToPoint(this.center))<=this.radius},clampPoint:function(b,e){var a=this.center.distanceToSquared(b);
  void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new m);e.copy(b);a>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center));return e},getBoundingBox:function(b){void 0===b&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),b=new I);b.set(this.center,this.center);b.expandByScalar(this.radius);return b},applyMatrix4:function(b){this.center.applyMatrix4(b);this.radius*=b.getMaxScaleOnAxis();return this},
  translate:function(b){this.center.add(b);return this},equals:function(b){return b.center.equals(this.center)&&b.radius===this.radius}});Object.assign(u.prototype,{set:function(b,e){this.normal.copy(b);this.constant=e;return this},setComponents:function(b,e,a,c){this.normal.set(b,e,a);this.constant=c;return this},setFromNormalAndCoplanarPoint:function(b,e){this.normal.copy(b);this.constant=-e.dot(this.normal);return this},setFromCoplanarPoints:function(){var b=new m,e=new m;return function(a,c,h){c=
  b.subVectors(h,c).cross(e.subVectors(a,c)).normalize();this.setFromNormalAndCoplanarPoint(c,a);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.normal.copy(b.normal);this.constant=b.constant;return this},normalize:function(){var b=1/this.normal.length();this.normal.multiplyScalar(b);this.constant*=b;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(b){return this.normal.dot(b)+this.constant},distanceToSphere:function(b){return this.distanceToPoint(b.center)-
  b.radius},projectPoint:function(b,e){void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new m);return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(b)).add(b)},intersectLine:function(){var b=new m;return function(e,a){void 0===a&&(console.warn("THREE.Plane: .intersectLine() target is now required"),a=new m);var c=e.delta(b),h=this.normal.dot(c);if(0===h){if(0===this.distanceToPoint(e.start))return a.copy(e.start)}else return h=-(e.start.dot(this.normal)+
  this.constant)/h,0>h||1<h?void 0:a.copy(c).multiplyScalar(h).add(e.start)}}(),intersectsLine:function(b){var e=this.distanceToPoint(b.start);b=this.distanceToPoint(b.end);return 0>e&&0<b||0>b&&0<e},intersectsBox:function(b){return b.intersectsPlane(this)},intersectsSphere:function(b){return b.intersectsPlane(this)},coplanarPoint:function(b){void 0===b&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),b=new m);return b.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var b=
  new m,e=new r;return function(a,c){var h=c||e.getNormalMatrix(a),g=this.coplanarPoint(b).applyMatrix4(a),h=this.normal.applyMatrix3(h).normalize();this.constant=-g.dot(h);return this}}(),translate:function(b){this.constant-=b.dot(this.normal);return this},equals:function(b){return b.normal.equals(this.normal)&&b.constant===this.constant}});Object.assign(K.prototype,{set:function(b,e,a,c,h,g){var d=this.planes;d[0].copy(b);d[1].copy(e);d[2].copy(a);d[3].copy(c);d[4].copy(h);d[5].copy(g);return this},
  clone:function(){return(new this.constructor).copy(this)},copy:function(b){for(var e=this.planes,a=0;6>a;a++)e[a].copy(b.planes[a]);return this},setFromMatrix:function(b){var e=this.planes,a=b.elements;b=a[0];var c=a[1],h=a[2],g=a[3],d=a[4],f=a[5],n=a[6],m=a[7],l=a[8],s=a[9],q=a[10],r=a[11],t=a[12],u=a[13],w=a[14],a=a[15];e[0].setComponents(g-b,m-d,r-l,a-t).normalize();e[1].setComponents(g+b,m+d,r+l,a+t).normalize();e[2].setComponents(g+c,m+f,r+s,a+u).normalize();e[3].setComponents(g-c,m-f,r-s,a-
  u).normalize();e[4].setComponents(g-h,m-n,r-q,a-w).normalize();e[5].setComponents(g+h,m+n,r+q,a+w).normalize();return this},intersectsObject:function(){var b=new C;return function(e){var a=e.geometry;null===a.boundingSphere&&a.computeBoundingSphere();b.copy(a.boundingSphere).applyMatrix4(e.matrixWorld);return this.intersectsSphere(b)}}(),intersectsSprite:function(){var b=new C;return function(e){b.center.set(0,0,0);b.radius=0.7071067811865476;b.applyMatrix4(e.matrixWorld);return this.intersectsSphere(b)}}(),
  intersectsSphere:function(b){var e=this.planes,a=b.center;b=-b.radius;for(var c=0;6>c;c++)if(e[c].distanceToPoint(a)<b)return!1;return!0},intersectsBox:function(){var b=new m;return function(e){for(var a=this.planes,c=0;6>c;c++){var h=a[c];b.x=0<h.normal.x?e.max.x:e.min.x;b.y=0<h.normal.y?e.max.y:e.min.y;b.z=0<h.normal.z?e.max.z:e.min.z;if(0>h.distanceToPoint(b))return!1}return!0}}(),containsPoint:function(b){for(var e=this.planes,a=0;6>a;a++)if(0>e[a].distanceToPoint(b))return!1;return!0}});var ca=
  {alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",
  aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE  = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS  = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.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 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",
  bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",
  clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n",
  clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",
  color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n",
  cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",
  defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",
  emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:"  gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}\n",
  envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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",
  envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",
  envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",
  envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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",
  fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif\n",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",
  gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",
  lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",
  lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n",
  lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",
  lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",
  lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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",
  lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\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",
  lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n",
  lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif\n",
  logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif\n",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",
  map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",
  metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",
  morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",
  normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",
  normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif\n",
  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}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",
  premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n  gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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",
  roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",
  shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",
  shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",
  shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",
  skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",
  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",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#endif\n",
  specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",
  uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",
  uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",
  uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n}\n",background_vert:"varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = vec4( position, 1.0 );\n\tgl_Position.z = 1.0;\n}\n",
  cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",
  depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",
  distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",
  distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}\n",
  equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",
  linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",
  linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",
  meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",
  meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",
  meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",
  meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",
  meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\tvec4 matcapColor = texture2D( matcap, uv );\n\tmatcapColor = matcapTexelToLinear( matcapColor );\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",
  meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}\n",
  meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",
  meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",
  meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",
  meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",
  normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",
  normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",
  points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",
  points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}\n",
  shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}\n",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",
  sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",
  sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n"},
  Ha={merge:function(b){for(var e={},a=0;a<b.length;a++){var c=this.clone(b[a]),h;for(h in c)e[h]=c[h]}return e},clone:function(b){var e={},a;for(a in b){e[a]={};for(var c in b[a]){var h=b[a][c];h&&(h.isColor||h.isMatrix3||h.isMatrix4||h.isVector2||h.isVector3||h.isVector4||h.isTexture)?e[a][c]=h.clone():Array.isArray(h)?e[a][c]=h.slice():e[a][c]=h}}return e}},Yi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,
  blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,
  darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,
  lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,
  mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,
  rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(w.prototype,
  {isColor:!0,r:1,g:1,b:1,set:function(b){b&&b.isColor?this.copy(b):"number"===typeof b?this.setHex(b):"string"===typeof b&&this.setStyle(b);return this},setScalar:function(b){this.b=this.g=this.r=b;return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},setRGB:function(b,e,a){this.r=b;this.g=e;this.b=a;return this},setHSL:function(){function b(b,a,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?b+6*(a-b)*c:0.5>c?a:c<2/3?b+6*(a-b)*(2/3-c):
  b}return function(e,a,c){e=ga.euclideanModulo(e,1);a=ga.clamp(a,0,1);c=ga.clamp(c,0,1);0===a?this.r=this.g=this.b=c:(a=0.5>=c?c*(1+a):c+a-c*a,c=2*c-a,this.r=b(c,a,e+1/3),this.g=b(c,a,e),this.b=b(c,a,e-1/3));return this}}(),setStyle:function(b){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+b+" will be ignored.")}var a;if(a=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(b)){var c=a[2];switch(a[1]){case "rgb":case "rgba":if(a=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c))return this.r=
  Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,e(a[5]),this;if(a=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c))return this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,e(a[5]),this;break;case "hsl":case "hsla":if(a=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c)){var c=parseFloat(a[1])/
  360,h=parseInt(a[2],10)/100,g=parseInt(a[3],10)/100;e(a[5]);return this.setHSL(c,h,g)}}}else if(a=/^\#([A-Fa-f0-9]+)$/.exec(b)){a=a[1];c=a.length;if(3===c)return this.r=parseInt(a.charAt(0)+a.charAt(0),16)/255,this.g=parseInt(a.charAt(1)+a.charAt(1),16)/255,this.b=parseInt(a.charAt(2)+a.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(a.charAt(0)+a.charAt(1),16)/255,this.g=parseInt(a.charAt(2)+a.charAt(3),16)/255,this.b=parseInt(a.charAt(4)+a.charAt(5),16)/255,this}b&&0<b.length&&(a=Yi[b],void 0!==
  a?this.setHex(a):console.warn("THREE.Color: Unknown color "+b));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},copyGammaToLinear:function(b,e){void 0===e&&(e=2);this.r=Math.pow(b.r,e);this.g=Math.pow(b.g,e);this.b=Math.pow(b.b,e);return this},copyLinearToGamma:function(b,e){void 0===e&&(e=2);var a=0<e?1/e:1;this.r=Math.pow(b.r,a);this.g=Math.pow(b.g,a);this.b=Math.pow(b.b,a);return this},convertGammaToLinear:function(b){this.copyGammaToLinear(this,
  b);return this},convertLinearToGamma:function(b){this.copyLinearToGamma(this,b);return this},copySRGBToLinear:function(){function b(b){return 0.04045>b?0.0773993808*b:Math.pow(0.9478672986*b+0.0521327014,2.4)}return function(e){this.r=b(e.r);this.g=b(e.g);this.b=b(e.b);return this}}(),copyLinearToSRGB:function(){function b(b){return 0.0031308>b?12.92*b:1.055*Math.pow(b,0.41666)-0.055}return function(e){this.r=b(e.r);this.g=b(e.g);this.b=b(e.b);return this}}(),convertSRGBToLinear:function(){this.copySRGBToLinear(this);
  return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(b){void 0===b&&(console.warn("THREE.Color: .getHSL() target is now required"),b={h:0,s:0,l:0});var e=this.r,a=this.g,c=this.b,h=Math.max(e,a,c),g=Math.min(e,a,c),d,f=(g+h)/2;if(g===h)g=d=0;else{var n=h-g,g=0.5>=f?n/(h+g):n/(2-h-g);switch(h){case e:d=(a-
  c)/n+(a<c?6:0);break;case a:d=(c-e)/n+2;break;case c:d=(e-a)/n+4}d/=6}b.h=d;b.s=g;b.l=f;return b},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(){var b={};return function(e,a,c){this.getHSL(b);b.h+=e;b.s+=a;b.l+=c;this.setHSL(b.h,b.s,b.l);return this}}(),add:function(b){this.r+=b.r;this.g+=b.g;this.b+=b.b;return this},addColors:function(b,e){this.r=b.r+e.r;this.g=b.g+e.g;this.b=b.b+e.b;return this},addScalar:function(b){this.r+=b;this.g+=
  b;this.b+=b;return this},sub:function(b){this.r=Math.max(0,this.r-b.r);this.g=Math.max(0,this.g-b.g);this.b=Math.max(0,this.b-b.b);return this},multiply:function(b){this.r*=b.r;this.g*=b.g;this.b*=b.b;return this},multiplyScalar:function(b){this.r*=b;this.g*=b;this.b*=b;return this},lerp:function(b,e){this.r+=(b.r-this.r)*e;this.g+=(b.g-this.g)*e;this.b+=(b.b-this.b)*e;return this},lerpHSL:function(){var b={h:0,s:0,l:0},e={h:0,s:0,l:0};return function(a,c){this.getHSL(b);a.getHSL(e);var h=ga.lerp(b.h,
  e.h,c),g=ga.lerp(b.s,e.s,c),d=ga.lerp(b.l,e.l,c);this.setHSL(h,g,d);return this}}(),equals:function(b){return b.r===this.r&&b.g===this.g&&b.b===this.b},fromArray:function(b,e){void 0===e&&(e=0);this.r=b[e];this.g=b[e+1];this.b=b[e+2];return this},toArray:function(b,e){void 0===b&&(b=[]);void 0===e&&(e=0);b[e]=this.r;b[e+1]=this.g;b[e+2]=this.b;return b},toJSON:function(){return this.getHex()}});var Z={common:{diffuse:{value:new w(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new r},
  alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:0.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new d(1,1)}},displacementmap:{displacementMap:{value:null},
  displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new w(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},
  spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},
  skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new w(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new r}},sprite:{diffuse:{value:new w(15658734)},opacity:{value:1},center:{value:new d(0.5,0.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new r}}},gb={basic:{uniforms:Ha.merge([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:ca.meshbasic_vert,
  fragmentShader:ca.meshbasic_frag},lambert:{uniforms:Ha.merge([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.fog,Z.lights,{emissive:{value:new w(0)}}]),vertexShader:ca.meshlambert_vert,fragmentShader:ca.meshlambert_frag},phong:{uniforms:Ha.merge([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new w(0)},specular:{value:new w(1118481)},shininess:{value:30}}]),vertexShader:ca.meshphong_vert,
  fragmentShader:ca.meshphong_frag},standard:{uniforms:Ha.merge([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new w(0)},roughness:{value:0.5},metalness:{value:0.5},envMapIntensity:{value:1}}]),vertexShader:ca.meshphysical_vert,fragmentShader:ca.meshphysical_frag},matcap:{uniforms:Ha.merge([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:ca.meshmatcap_vert,
  fragmentShader:ca.meshmatcap_frag},points:{uniforms:Ha.merge([Z.points,Z.fog]),vertexShader:ca.points_vert,fragmentShader:ca.points_frag},dashed:{uniforms:Ha.merge([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ca.linedashed_vert,fragmentShader:ca.linedashed_frag},depth:{uniforms:Ha.merge([Z.common,Z.displacementmap]),vertexShader:ca.depth_vert,fragmentShader:ca.depth_frag},normal:{uniforms:Ha.merge([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),
  vertexShader:ca.normal_vert,fragmentShader:ca.normal_frag},sprite:{uniforms:Ha.merge([Z.sprite,Z.fog]),vertexShader:ca.sprite_vert,fragmentShader:ca.sprite_frag},background:{uniforms:{t2D:{value:null}},vertexShader:ca.background_vert,fragmentShader:ca.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ca.cube_vert,fragmentShader:ca.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ca.equirect_vert,fragmentShader:ca.equirect_frag},
  distanceRGBA:{uniforms:Ha.merge([Z.common,Z.displacementmap,{referencePosition:{value:new m},nearDistance:{value:1},farDistance:{value:1E3}}]),vertexShader:ca.distanceRGBA_vert,fragmentShader:ca.distanceRGBA_frag},shadow:{uniforms:Ha.merge([Z.lights,Z.fog,{color:{value:new w(0)},opacity:{value:1}}]),vertexShader:ca.shadow_vert,fragmentShader:ca.shadow_frag}};gb.physical={uniforms:Ha.merge([gb.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:ca.meshphysical_vert,
  fragmentShader:ca.meshphysical_frag};Object.assign(H.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.a=b.a;this.b=b.b;this.c=b.c;this.normal.copy(b.normal);this.color.copy(b.color);this.materialIndex=b.materialIndex;for(var e=0,a=b.vertexNormals.length;e<a;e++)this.vertexNormals[e]=b.vertexNormals[e].clone();e=0;for(a=b.vertexColors.length;e<a;e++)this.vertexColors[e]=b.vertexColors[e].clone();return this}});J.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");
  J.DefaultOrder="XYZ";Object.defineProperties(J.prototype,{x:{get:function(){return this._x},set:function(b){this._x=b;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(b){this._y=b;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(b){this._z=b;this.onChangeCallback()}},order:{get:function(){return this._order},set:function(b){this._order=b;this.onChangeCallback()}}});Object.assign(J.prototype,{isEuler:!0,set:function(b,e,a,c){this._x=b;this._y=e;this._z=
  a;this._order=c||this._order;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(b){this._x=b._x;this._y=b._y;this._z=b._z;this._order=b._order;this.onChangeCallback();return this},setFromRotationMatrix:function(b,e,a){var c=ga.clamp,h=b.elements;b=h[0];var g=h[4],d=h[8],f=h[1],n=h[5],m=h[9],l=h[2],s=h[6],h=h[10];e=e||this._order;"XYZ"===e?(this._y=Math.asin(c(d,-1,1)),0.99999>Math.abs(d)?(this._x=Math.atan2(-m,h),this._z=
  Math.atan2(-g,b)):(this._x=Math.atan2(s,n),this._z=0)):"YXZ"===e?(this._x=Math.asin(-c(m,-1,1)),0.99999>Math.abs(m)?(this._y=Math.atan2(d,h),this._z=Math.atan2(f,n)):(this._y=Math.atan2(-l,b),this._z=0)):"ZXY"===e?(this._x=Math.asin(c(s,-1,1)),0.99999>Math.abs(s)?(this._y=Math.atan2(-l,h),this._z=Math.atan2(-g,n)):(this._y=0,this._z=Math.atan2(f,b))):"ZYX"===e?(this._y=Math.asin(-c(l,-1,1)),0.99999>Math.abs(l)?(this._x=Math.atan2(s,h),this._z=Math.atan2(f,b)):(this._x=0,this._z=Math.atan2(-g,n))):
  "YZX"===e?(this._z=Math.asin(c(f,-1,1)),0.99999>Math.abs(f)?(this._x=Math.atan2(-m,n),this._y=Math.atan2(-l,b)):(this._x=0,this._y=Math.atan2(d,h))):"XZY"===e?(this._z=Math.asin(-c(g,-1,1)),0.99999>Math.abs(g)?(this._x=Math.atan2(s,n),this._y=Math.atan2(d,b)):(this._x=Math.atan2(-m,h),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e);this._order=e;if(!1!==a)this.onChangeCallback();return this},setFromQuaternion:function(){var b=new f;return function(e,a,
  c){b.makeRotationFromQuaternion(e);return this.setFromRotationMatrix(b,a,c)}}(),setFromVector3:function(b,e){return this.set(b.x,b.y,b.z,e||this._order)},reorder:function(){var b=new l;return function(e){b.setFromEuler(this);return this.setFromQuaternion(b,e)}}(),equals:function(b){return b._x===this._x&&b._y===this._y&&b._z===this._z&&b._order===this._order},fromArray:function(b){this._x=b[0];this._y=b[1];this._z=b[2];void 0!==b[3]&&(this._order=b[3]);this.onChangeCallback();return this},toArray:function(b,
  e){void 0===b&&(b=[]);void 0===e&&(e=0);b[e]=this._x;b[e+1]=this._y;b[e+2]=this._z;b[e+3]=this._order;return b},toVector3:function(b){return b?b.set(this._x,this._y,this._z):new m(this._x,this._y,this._z)},onChange:function(b){this.onChangeCallback=b;return this},onChangeCallback:function(){}});Object.assign(y.prototype,{set:function(b){this.mask=1<<b|0},enable:function(b){this.mask=this.mask|1<<b|0},toggle:function(b){this.mask^=1<<b|0},disable:function(b){this.mask&=~(1<<b|0)},test:function(b){return 0!==
  (this.mask&b.mask)}});var Th=0;D.DefaultUp=new m(0,1,0);D.DefaultMatrixAutoUpdate=!0;D.prototype=Object.assign(Object.create(c.prototype),{constructor:D,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(b){this.matrix.multiplyMatrices(b,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(b){this.quaternion.premultiply(b);return this},setRotationFromAxisAngle:function(b,e){this.quaternion.setFromAxisAngle(b,
  e)},setRotationFromEuler:function(b){this.quaternion.setFromEuler(b,!0)},setRotationFromMatrix:function(b){this.quaternion.setFromRotationMatrix(b)},setRotationFromQuaternion:function(b){this.quaternion.copy(b)},rotateOnAxis:function(){var b=new l;return function(e,a){b.setFromAxisAngle(e,a);this.quaternion.multiply(b);return this}}(),rotateOnWorldAxis:function(){var b=new l;return function(e,a){b.setFromAxisAngle(e,a);this.quaternion.premultiply(b);return this}}(),rotateX:function(){var b=new m(1,
  0,0);return function(e){return this.rotateOnAxis(b,e)}}(),rotateY:function(){var b=new m(0,1,0);return function(e){return this.rotateOnAxis(b,e)}}(),rotateZ:function(){var b=new m(0,0,1);return function(e){return this.rotateOnAxis(b,e)}}(),translateOnAxis:function(){var b=new m;return function(e,a){b.copy(e).applyQuaternion(this.quaternion);this.position.add(b.multiplyScalar(a));return this}}(),translateX:function(){var b=new m(1,0,0);return function(e){return this.translateOnAxis(b,e)}}(),translateY:function(){var b=
  new m(0,1,0);return function(e){return this.translateOnAxis(b,e)}}(),translateZ:function(){var b=new m(0,0,1);return function(e){return this.translateOnAxis(b,e)}}(),localToWorld:function(b){return b.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var b=new f;return function(e){return e.applyMatrix4(b.getInverse(this.matrixWorld))}}(),lookAt:function(){var b=new l,e=new f,a=new m,c=new m;return function(h,g,d){h.isVector3?a.copy(h):a.set(h,g,d);h=this.parent;this.updateWorldMatrix(!0,!1);
  c.setFromMatrixPosition(this.matrixWorld);this.isCamera?e.lookAt(c,a,this.up):e.lookAt(a,c,this.up);this.quaternion.setFromRotationMatrix(e);h&&(e.extractRotation(h.matrixWorld),b.setFromRotationMatrix(e),this.quaternion.premultiply(b.inverse()))}}(),add:function(b){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}if(b===this)return console.error("THREE.Object3D.add: object can't be added as a child of itself.",b),this;b&&b.isObject3D?(null!==b.parent&&
  b.parent.remove(b),b.parent=this,b.dispatchEvent({type:"added"}),this.children.push(b)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",b);return this},remove:function(b){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}e=this.children.indexOf(b);-1!==e&&(b.parent=null,b.dispatchEvent({type:"removed"}),this.children.splice(e,1));return this},getObjectById:function(b){return this.getObjectByProperty("id",b)},getObjectByName:function(b){return this.getObjectByProperty("name",
  b)},getObjectByProperty:function(b,e){if(this[b]===e)return this;for(var a=0,c=this.children.length;a<c;a++){var h=this.children[a].getObjectByProperty(b,e);if(void 0!==h)return h}},getWorldPosition:function(b){void 0===b&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),b=new m);this.updateMatrixWorld(!0);return b.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var b=new m,e=new m;return function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),
  a=new l);this.updateMatrixWorld(!0);this.matrixWorld.decompose(b,a,e);return a}}(),getWorldScale:function(){var b=new m,e=new l;return function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),a=new m);this.updateMatrixWorld(!0);this.matrixWorld.decompose(b,e,a);return a}}(),getWorldDirection:function(b){void 0===b&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),b=new m);this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;
  return b.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(b){b(this);for(var e=this.children,a=0,c=e.length;a<c;a++)e[a].traverse(b)},traverseVisible:function(b){if(!1!==this.visible){b(this);for(var e=this.children,a=0,c=e.length;a<c;a++)e[a].traverseVisible(b)}},traverseAncestors:function(b){var e=this.parent;null!==e&&(b(e),e.traverseAncestors(b))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(b){this.matrixAutoUpdate&&
  this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;for(var e=this.children,a=0,c=e.length;a<c;a++)e[a].updateMatrixWorld(b)},updateWorldMatrix:function(b,e){var a=this.parent;!0===b&&null!==a&&a.updateWorldMatrix(!0,!1);this.matrixAutoUpdate&&this.updateMatrix();null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,
  this.matrix);if(!0===e)for(var a=this.children,c=0,h=a.length;c<h;c++)a[c].updateWorldMatrix(!1,!0)},toJSON:function(b){function e(e,a){void 0===e[a.uuid]&&(e[a.uuid]=a.toJSON(b));return a.uuid}function a(b){var e=[],c;for(c in b){var k=b[c];delete k.metadata;e.push(k)}return e}var c=void 0===b||"string"===typeof b,h={};c&&(b={geometries:{},materials:{},textures:{},images:{},shapes:{}},h.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var g={};g.uuid=this.uuid;g.type=this.type;""!==
  this.name&&(g.name=this.name);!0===this.castShadow&&(g.castShadow=!0);!0===this.receiveShadow&&(g.receiveShadow=!0);!1===this.visible&&(g.visible=!1);!1===this.frustumCulled&&(g.frustumCulled=!1);0!==this.renderOrder&&(g.renderOrder=this.renderOrder);"{}"!==JSON.stringify(this.userData)&&(g.userData=this.userData);g.layers=this.layers.mask;g.matrix=this.matrix.toArray();!1===this.matrixAutoUpdate&&(g.matrixAutoUpdate=!1);if(this.isMesh||this.isLine||this.isPoints){g.geometry=e(b.geometries,this.geometry);
  var d=this.geometry.parameters;if(void 0!==d&&void 0!==d.shapes)if(d=d.shapes,Array.isArray(d))for(var f=0,n=d.length;f<n;f++)e(b.shapes,d[f]);else e(b.shapes,d)}if(void 0!==this.material)if(Array.isArray(this.material)){d=[];f=0;for(n=this.material.length;f<n;f++)d.push(e(b.materials,this.material[f]));g.material=d}else g.material=e(b.materials,this.material);if(0<this.children.length)for(g.children=[],f=0;f<this.children.length;f++)g.children.push(this.children[f].toJSON(b).object);if(c){var c=
  a(b.geometries),f=a(b.materials),n=a(b.textures),m=a(b.images),d=a(b.shapes);0<c.length&&(h.geometries=c);0<f.length&&(h.materials=f);0<n.length&&(h.textures=n);0<m.length&&(h.images=m);0<d.length&&(h.shapes=d)}h.object=g;return h},clone:function(b){return(new this.constructor).copy(this,b)},copy:function(b,e){void 0===e&&(e=!0);this.name=b.name;this.up.copy(b.up);this.position.copy(b.position);this.quaternion.copy(b.quaternion);this.scale.copy(b.scale);this.matrix.copy(b.matrix);this.matrixWorld.copy(b.matrixWorld);
  this.matrixAutoUpdate=b.matrixAutoUpdate;this.matrixWorldNeedsUpdate=b.matrixWorldNeedsUpdate;this.layers.mask=b.layers.mask;this.visible=b.visible;this.castShadow=b.castShadow;this.receiveShadow=b.receiveShadow;this.frustumCulled=b.frustumCulled;this.renderOrder=b.renderOrder;this.userData=JSON.parse(JSON.stringify(b.userData));if(!0===e)for(var a=0;a<b.children.length;a++)this.add(b.children[a].clone());return this}});var Jf=0;g.prototype=Object.assign(Object.create(c.prototype),{constructor:g,
  isGeometry:!0,applyMatrix:function(b){for(var e=(new r).getNormalMatrix(b),a=0,c=this.vertices.length;a<c;a++)this.vertices[a].applyMatrix4(b);a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.normal.applyMatrix3(e).normalize();for(var h=0,g=b.vertexNormals.length;h<g;h++)b.vertexNormals[h].applyMatrix3(e).normalize()}null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();this.normalsNeedUpdate=this.verticesNeedUpdate=!0;return this},rotateX:function(){var b=
  new f;return function(e){b.makeRotationX(e);this.applyMatrix(b);return this}}(),rotateY:function(){var b=new f;return function(e){b.makeRotationY(e);this.applyMatrix(b);return this}}(),rotateZ:function(){var b=new f;return function(e){b.makeRotationZ(e);this.applyMatrix(b);return this}}(),translate:function(){var b=new f;return function(e,a,c){b.makeTranslation(e,a,c);this.applyMatrix(b);return this}}(),scale:function(){var b=new f;return function(e,a,c){b.makeScale(e,a,c);this.applyMatrix(b);return this}}(),
  lookAt:function(){var b=new D;return function(e){b.lookAt(e);b.updateMatrix();this.applyMatrix(b.matrix)}}(),fromBufferGeometry:function(b){function e(b,e,c,h){var g=void 0!==f?[s[b].clone(),s[e].clone(),s[c].clone()]:[],d=void 0!==n?[a.colors[b].clone(),a.colors[e].clone(),a.colors[c].clone()]:[];h=new H(b,e,c,g,d,h);a.faces.push(h);void 0!==p&&a.faceVertexUvs[0].push([q[b].clone(),q[e].clone(),q[c].clone()]);void 0!==l&&a.faceVertexUvs[1].push([r[b].clone(),r[e].clone(),r[c].clone()])}var a=this,
  c=null!==b.index?b.index.array:void 0,h=b.attributes,g=h.position.array,f=void 0!==h.normal?h.normal.array:void 0,n=void 0!==h.color?h.color.array:void 0,p=void 0!==h.uv?h.uv.array:void 0,l=void 0!==h.uv2?h.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var s=[],q=[],r=[],t=h=0;h<g.length;h+=3,t+=2)a.vertices.push(new m(g[h],g[h+1],g[h+2])),void 0!==f&&s.push(new m(f[h],f[h+1],f[h+2])),void 0!==n&&a.colors.push(new w(n[h],n[h+1],n[h+2])),void 0!==p&&q.push(new d(p[t],p[t+1])),void 0!==
  l&&r.push(new d(l[t],l[t+1]));var u=b.groups;if(0<u.length)for(h=0;h<u.length;h++)for(var g=u[h],G=g.start,v=g.count,t=G,G=G+v;t<G;t+=3)void 0!==c?e(c[t],c[t+1],c[t+2],g.materialIndex):e(t,t+1,t+2,g.materialIndex);else if(void 0!==c)for(h=0;h<c.length;h+=3)e(c[h],c[h+1],c[h+2]);else for(h=0;h<g.length/3;h+=3)e(h,h+1,h+2);this.computeFaceNormals();null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone());null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone());return this},center:function(){var b=
  new m;return function(){this.computeBoundingBox();this.boundingBox.getCenter(b).negate();this.translate(b.x,b.y,b.z);return this}}(),normalize:function(){this.computeBoundingSphere();var b=this.boundingSphere.center,e=this.boundingSphere.radius,e=0===e?1:1/e,a=new f;a.set(e,0,0,-e*b.x,0,e,0,-e*b.y,0,0,e,-e*b.z,0,0,0,1);this.applyMatrix(a);return this},computeFaceNormals:function(){for(var b=new m,e=new m,a=0,c=this.faces.length;a<c;a++){var h=this.faces[a],g=this.vertices[h.a],d=this.vertices[h.b];
  b.subVectors(this.vertices[h.c],d);e.subVectors(g,d);b.cross(e);b.normalize();h.normal.copy(b)}},computeVertexNormals:function(b){void 0===b&&(b=!0);var e,a,c;c=Array(this.vertices.length);e=0;for(a=this.vertices.length;e<a;e++)c[e]=new m;if(b){var h,g,d,f=new m,n=new m;b=0;for(e=this.faces.length;b<e;b++)a=this.faces[b],h=this.vertices[a.a],g=this.vertices[a.b],d=this.vertices[a.c],f.subVectors(d,g),n.subVectors(h,g),f.cross(n),c[a.a].add(f),c[a.b].add(f),c[a.c].add(f)}else for(this.computeFaceNormals(),
  b=0,e=this.faces.length;b<e;b++)a=this.faces[b],c[a.a].add(a.normal),c[a.b].add(a.normal),c[a.c].add(a.normal);e=0;for(a=this.vertices.length;e<a;e++)c[e].normalize();b=0;for(e=this.faces.length;b<e;b++)a=this.faces[b],h=a.vertexNormals,3===h.length?(h[0].copy(c[a.a]),h[1].copy(c[a.b]),h[2].copy(c[a.c])):(h[0]=c[a.a].clone(),h[1]=c[a.b].clone(),h[2]=c[a.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var b,e,a;this.computeFaceNormals();b=0;for(e=this.faces.length;b<
  e;b++){a=this.faces[b];var c=a.vertexNormals;3===c.length?(c[0].copy(a.normal),c[1].copy(a.normal),c[2].copy(a.normal)):(c[0]=a.normal.clone(),c[1]=a.normal.clone(),c[2]=a.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var b,e,a,c,h;a=0;for(c=this.faces.length;a<c;a++)for(h=this.faces[a],h.__originalFaceNormal?h.__originalFaceNormal.copy(h.normal):h.__originalFaceNormal=h.normal.clone(),h.__originalVertexNormals||(h.__originalVertexNormals=[]),b=0,
  e=h.vertexNormals.length;b<e;b++)h.__originalVertexNormals[b]?h.__originalVertexNormals[b].copy(h.vertexNormals[b]):h.__originalVertexNormals[b]=h.vertexNormals[b].clone();var d=new g;d.faces=this.faces;b=0;for(e=this.morphTargets.length;b<e;b++){if(!this.morphNormals[b]){this.morphNormals[b]={};this.morphNormals[b].faceNormals=[];this.morphNormals[b].vertexNormals=[];h=this.morphNormals[b].faceNormals;var f=this.morphNormals[b].vertexNormals,n,p;a=0;for(c=this.faces.length;a<c;a++)n=new m,p={a:new m,
  b:new m,c:new m},h.push(n),f.push(p)}f=this.morphNormals[b];d.vertices=this.morphTargets[b].vertices;d.computeFaceNormals();d.computeVertexNormals();a=0;for(c=this.faces.length;a<c;a++)h=this.faces[a],n=f.faceNormals[a],p=f.vertexNormals[a],n.copy(h.normal),p.a.copy(h.vertexNormals[0]),p.b.copy(h.vertexNormals[1]),p.c.copy(h.vertexNormals[2])}a=0;for(c=this.faces.length;a<c;a++)h=this.faces[a],h.normal=h.__originalFaceNormal,h.vertexNormals=h.__originalVertexNormals},computeBoundingBox:function(){null===
  this.boundingBox&&(this.boundingBox=new I);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new C);this.boundingSphere.setFromPoints(this.vertices)},merge:function(b,e,a){if(b&&b.isGeometry){var c,h=this.vertices.length,g=this.vertices,d=b.vertices,f=this.faces,n=b.faces,m=this.faceVertexUvs[0],l=b.faceVertexUvs[0],s=this.colors,q=b.colors;void 0===a&&(a=0);void 0!==e&&(c=(new r).getNormalMatrix(e));b=0;for(var t=d.length;b<
  t;b++){var u=d[b].clone();void 0!==e&&u.applyMatrix4(e);g.push(u)}b=0;for(t=q.length;b<t;b++)s.push(q[b].clone());b=0;for(t=n.length;b<t;b++){var d=n[b],w=d.vertexNormals,q=d.vertexColors,s=new H(d.a+h,d.b+h,d.c+h);s.normal.copy(d.normal);void 0!==c&&s.normal.applyMatrix3(c).normalize();e=0;for(g=w.length;e<g;e++)u=w[e].clone(),void 0!==c&&u.applyMatrix3(c).normalize(),s.vertexNormals.push(u);s.color.copy(d.color);e=0;for(g=q.length;e<g;e++)u=q[e],s.vertexColors.push(u.clone());s.materialIndex=d.materialIndex+
  a;f.push(s)}b=0;for(t=l.length;b<t;b++)if(a=l[b],c=[],void 0!==a){e=0;for(g=a.length;e<g;e++)c.push(a[e].clone());m.push(c)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",b)},mergeMesh:function(b){b&&b.isMesh?(b.matrixAutoUpdate&&b.updateMatrix(),this.merge(b.geometry,b.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",b)},mergeVertices:function(){var b={},e=[],a=[],c,h=Math.pow(10,4),g,d;g=0;for(d=this.vertices.length;g<
  d;g++)c=this.vertices[g],c=Math.round(c.x*h)+"_"+Math.round(c.y*h)+"_"+Math.round(c.z*h),void 0===b[c]?(b[c]=g,e.push(this.vertices[g]),a[g]=e.length-1):a[g]=a[b[c]];b=[];g=0;for(d=this.faces.length;g<d;g++)for(h=this.faces[g],h.a=a[h.a],h.b=a[h.b],h.c=a[h.c],h=[h.a,h.b,h.c],c=0;3>c;c++)if(h[c]===h[(c+1)%3]){b.push(g);break}for(g=b.length-1;0<=g;g--)for(h=b[g],this.faces.splice(h,1),a=0,d=this.faceVertexUvs.length;a<d;a++)this.faceVertexUvs[a].splice(h,1);g=this.vertices.length-e.length;this.vertices=
  e;return g},setFromPoints:function(b){this.vertices=[];for(var e=0,a=b.length;e<a;e++){var c=b[e];this.vertices.push(new m(c.x,c.y,c.z||0))}return this},sortFacesByMaterialIndex:function(){for(var b=this.faces,e=b.length,a=0;a<e;a++)b[a]._id=a;b.sort(function(b,a){return b.materialIndex-a.materialIndex});var c=this.faceVertexUvs[0],h=this.faceVertexUvs[1],g,d;c&&c.length===e&&(g=[]);h&&h.length===e&&(d=[]);for(a=0;a<e;a++){var f=b[a]._id;g&&g.push(c[f]);d&&d.push(h[f])}g&&(this.faceVertexUvs[0]=g);
  d&&(this.faceVertexUvs[1]=d)},toJSON:function(){function b(b,a,e){return e?b|1<<a:b&~(1<<a)}function a(b){var e=b.x.toString()+b.y.toString()+b.z.toString();if(void 0!==m[e])return m[e];m[e]=p.length/3;p.push(b.x,b.y,b.z);return m[e]}function c(b){var a=b.r.toString()+b.g.toString()+b.b.toString();if(void 0!==s[a])return s[a];s[a]=l.length;l.push(b.getHex());return s[a]}function g(b){var a=b.x.toString()+b.y.toString();if(void 0!==r[a])return r[a];r[a]=q.length/2;q.push(b.x,b.y);return r[a]}var h=
  {metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};h.uuid=this.uuid;h.type=this.type;""!==this.name&&(h.name=this.name);if(void 0!==this.parameters){var d=this.parameters,f;for(f in d)void 0!==d[f]&&(h[f]=d[f]);return h}d=[];for(f=0;f<this.vertices.length;f++){var n=this.vertices[f];d.push(n.x,n.y,n.z)}var n=[],p=[],m={},l=[],s={},q=[],r={};for(f=0;f<this.faces.length;f++){var t=this.faces[f],u=void 0!==this.faceVertexUvs[0][f],w=0<t.normal.length(),G=0<t.vertexNormals.length,z=
  1!==t.color.r||1!==t.color.g||1!==t.color.b,v=0<t.vertexColors.length,A=0,A=b(A,0,0),A=b(A,1,!0),A=b(A,2,!1),A=b(A,3,u),A=b(A,4,w),A=b(A,5,G),A=b(A,6,z),A=b(A,7,v);n.push(A);n.push(t.a,t.b,t.c);n.push(t.materialIndex);u&&(u=this.faceVertexUvs[0][f],n.push(g(u[0]),g(u[1]),g(u[2])));w&&n.push(a(t.normal));G&&(w=t.vertexNormals,n.push(a(w[0]),a(w[1]),a(w[2])));z&&n.push(c(t.color));v&&(t=t.vertexColors,n.push(c(t[0]),c(t[1]),c(t[2])))}h.data={};h.data.vertices=d;h.data.normals=p;0<l.length&&(h.data.colors=
  l);0<q.length&&(h.data.uvs=[q]);h.data.faces=n;return h},clone:function(){return(new g).copy(this)},copy:function(b){var a,c,g,h,d,f;this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.name=b.name;g=b.vertices;a=0;for(c=g.length;a<c;a++)this.vertices.push(g[a].clone());g=b.colors;a=0;for(c=g.length;a<c;a++)this.colors.push(g[a].clone());
  g=b.faces;a=0;for(c=g.length;a<c;a++)this.faces.push(g[a].clone());a=0;for(c=b.faceVertexUvs.length;a<c;a++){var n=b.faceVertexUvs[a];void 0===this.faceVertexUvs[a]&&(this.faceVertexUvs[a]=[]);g=0;for(h=n.length;g<h;g++){var p=n[g],m=[];d=0;for(f=p.length;d<f;d++)m.push(p[d].clone());this.faceVertexUvs[a].push(m)}}d=b.morphTargets;a=0;for(c=d.length;a<c;a++){f={};f.name=d[a].name;if(void 0!==d[a].vertices)for(f.vertices=[],g=0,h=d[a].vertices.length;g<h;g++)f.vertices.push(d[a].vertices[g].clone());
  if(void 0!==d[a].normals)for(f.normals=[],g=0,h=d[a].normals.length;g<h;g++)f.normals.push(d[a].normals[g].clone());this.morphTargets.push(f)}d=b.morphNormals;a=0;for(c=d.length;a<c;a++){f={};if(void 0!==d[a].vertexNormals)for(f.vertexNormals=[],g=0,h=d[a].vertexNormals.length;g<h;g++)n=d[a].vertexNormals[g],p={},p.a=n.a.clone(),p.b=n.b.clone(),p.c=n.c.clone(),f.vertexNormals.push(p);if(void 0!==d[a].faceNormals)for(f.faceNormals=[],g=0,h=d[a].faceNormals.length;g<h;g++)f.faceNormals.push(d[a].faceNormals[g].clone());
  this.morphNormals.push(f)}g=b.skinWeights;a=0;for(c=g.length;a<c;a++)this.skinWeights.push(g[a].clone());g=b.skinIndices;a=0;for(c=g.length;a<c;a++)this.skinIndices.push(g[a].clone());g=b.lineDistances;a=0;for(c=g.length;a<c;a++)this.lineDistances.push(g[a]);a=b.boundingBox;null!==a&&(this.boundingBox=a.clone());a=b.boundingSphere;null!==a&&(this.boundingSphere=a.clone());this.elementsNeedUpdate=b.elementsNeedUpdate;this.verticesNeedUpdate=b.verticesNeedUpdate;this.uvsNeedUpdate=b.uvsNeedUpdate;this.normalsNeedUpdate=
  b.normalsNeedUpdate;this.colorsNeedUpdate=b.colorsNeedUpdate;this.lineDistancesNeedUpdate=b.lineDistancesNeedUpdate;this.groupsNeedUpdate=b.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.defineProperty(n.prototype,"needsUpdate",{set:function(b){!0===b&&this.version++}});Object.assign(n.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(b){if(Array.isArray(b))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
  this.count=void 0!==b?b.length/this.itemSize:0;this.array=b;return this},setDynamic:function(b){this.dynamic=b;return this},copy:function(b){this.name=b.name;this.array=new b.array.constructor(b.array);this.itemSize=b.itemSize;this.count=b.count;this.normalized=b.normalized;this.dynamic=b.dynamic;return this},copyAt:function(b,a,c){b*=this.itemSize;c*=a.itemSize;for(var g=0,h=this.itemSize;g<h;g++)this.array[b+g]=a.array[c+g];return this},copyArray:function(b){this.array.set(b);return this},copyColorsArray:function(b){for(var a=
  this.array,c=0,g=0,h=b.length;g<h;g++){var d=b[g];void 0===d&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",g),d=new w);a[c++]=d.r;a[c++]=d.g;a[c++]=d.b}return this},copyVector2sArray:function(b){for(var a=this.array,c=0,g=0,h=b.length;g<h;g++){var f=b[g];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",g),f=new d);a[c++]=f.x;a[c++]=f.y}return this},copyVector3sArray:function(b){for(var a=this.array,c=0,g=0,h=b.length;g<h;g++){var d=
  b[g];void 0===d&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",g),d=new m);a[c++]=d.x;a[c++]=d.y;a[c++]=d.z}return this},copyVector4sArray:function(b){for(var a=this.array,c=0,g=0,h=b.length;g<h;g++){var d=b[g];void 0===d&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",g),d=new t);a[c++]=d.x;a[c++]=d.y;a[c++]=d.z;a[c++]=d.w}return this},set:function(b,a){void 0===a&&(a=0);this.array.set(b,a);return this},getX:function(b){return this.array[b*
  this.itemSize]},setX:function(b,a){this.array[b*this.itemSize]=a;return this},getY:function(b){return this.array[b*this.itemSize+1]},setY:function(b,a){this.array[b*this.itemSize+1]=a;return this},getZ:function(b){return this.array[b*this.itemSize+2]},setZ:function(b,a){this.array[b*this.itemSize+2]=a;return this},getW:function(b){return this.array[b*this.itemSize+3]},setW:function(b,a){this.array[b*this.itemSize+3]=a;return this},setXY:function(b,a,c){b*=this.itemSize;this.array[b+0]=a;this.array[b+
  1]=c;return this},setXYZ:function(b,a,c,g){b*=this.itemSize;this.array[b+0]=a;this.array[b+1]=c;this.array[b+2]=g;return this},setXYZW:function(b,a,c,g,h){b*=this.itemSize;this.array[b+0]=a;this.array[b+1]=c;this.array[b+2]=g;this.array[b+3]=h;return this},onUpload:function(b){this.onUploadCallback=b;return this},clone:function(){return(new this.constructor(this.array,this.itemSize)).copy(this)}});s.prototype=Object.create(n.prototype);s.prototype.constructor=s;S.prototype=Object.create(n.prototype);
  S.prototype.constructor=S;V.prototype=Object.create(n.prototype);V.prototype.constructor=V;da.prototype=Object.create(n.prototype);da.prototype.constructor=da;ea.prototype=Object.create(n.prototype);ea.prototype.constructor=ea;ba.prototype=Object.create(n.prototype);ba.prototype.constructor=ba;ha.prototype=Object.create(n.prototype);ha.prototype.constructor=ha;N.prototype=Object.create(n.prototype);N.prototype.constructor=N;fa.prototype=Object.create(n.prototype);fa.prototype.constructor=fa;Object.assign(ma.prototype,
  {computeGroups:function(b){var a,c=[],g=void 0;b=b.faces;for(var h=0;h<b.length;h++){var d=b[h];d.materialIndex!==g&&(g=d.materialIndex,void 0!==a&&(a.count=3*h-a.start,c.push(a)),a={start:3*h,materialIndex:g})}void 0!==a&&(a.count=3*h-a.start,c.push(a));this.groups=c},fromGeometry:function(b){var a=b.faces,c=b.vertices,g=b.faceVertexUvs,h=g[0]&&0<g[0].length,f=g[1]&&0<g[1].length,n=b.morphTargets,m=n.length,p;if(0<m){p=[];for(var l=0;l<m;l++)p[l]={name:n[l].name,data:[]};this.morphTargets.position=
  p}var s=b.morphNormals,q=s.length,r;if(0<q){r=[];for(l=0;l<q;l++)r[l]={name:s[l].name,data:[]};this.morphTargets.normal=r}var t=b.skinIndices,u=b.skinWeights,w=t.length===c.length,G=u.length===c.length;0<c.length&&0===a.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<a.length;l++){var v=a[l];this.vertices.push(c[v.a],c[v.b],c[v.c]);var z=v.vertexNormals;3===z.length?this.normals.push(z[0],z[1],z[2]):(z=v.normal,this.normals.push(z,z,z));z=v.vertexColors;
  3===z.length?this.colors.push(z[0],z[1],z[2]):(z=v.color,this.colors.push(z,z,z));!0===h&&(z=g[0][l],void 0!==z?this.uvs.push(z[0],z[1],z[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new d,new d,new d)));!0===f&&(z=g[1][l],void 0!==z?this.uvs2.push(z[0],z[1],z[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new d,new d,new d)));for(z=0;z<m;z++){var A=n[z].vertices;p[z].data.push(A[v.a],A[v.b],A[v.c])}for(z=
  0;z<q;z++)A=s[z].vertexNormals[l],r[z].data.push(A.a,A.b,A.c);w&&this.skinIndices.push(t[v.a],t[v.b],t[v.c]);G&&this.skinWeights.push(u[v.a],u[v.b],u[v.c])}this.computeGroups(b);this.verticesNeedUpdate=b.verticesNeedUpdate;this.normalsNeedUpdate=b.normalsNeedUpdate;this.colorsNeedUpdate=b.colorsNeedUpdate;this.uvsNeedUpdate=b.uvsNeedUpdate;this.groupsNeedUpdate=b.groupsNeedUpdate;return this}});var Kf=1;M.prototype=Object.assign(Object.create(c.prototype),{constructor:M,isBufferGeometry:!0,getIndex:function(){return this.index},
  setIndex:function(b){Array.isArray(b)?this.index=new (65535<ia(b)?ha:ea)(b,1):this.index=b},addAttribute:function(b,a,c){if(!(a&&a.isBufferAttribute||a&&a.isInterleavedBufferAttribute))return console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(b,new n(a,c));if("index"===b)return console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(a),this;this.attributes[b]=a;return this},getAttribute:function(b){return this.attributes[b]},
  removeAttribute:function(b){delete this.attributes[b];return this},addGroup:function(b,a,c){this.groups.push({start:b,count:a,materialIndex:void 0!==c?c:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(b,a){this.drawRange.start=b;this.drawRange.count=a},applyMatrix:function(b){var a=this.attributes.position;void 0!==a&&(b.applyToBufferAttribute(a),a.needsUpdate=!0);a=this.attributes.normal;void 0!==a&&((new r).getNormalMatrix(b).applyToBufferAttribute(a),a.needsUpdate=!0);null!==
  this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();return this},rotateX:function(){var b=new f;return function(a){b.makeRotationX(a);this.applyMatrix(b);return this}}(),rotateY:function(){var b=new f;return function(a){b.makeRotationY(a);this.applyMatrix(b);return this}}(),rotateZ:function(){var b=new f;return function(a){b.makeRotationZ(a);this.applyMatrix(b);return this}}(),translate:function(){var b=new f;return function(a,c,g){b.makeTranslation(a,
  c,g);this.applyMatrix(b);return this}}(),scale:function(){var b=new f;return function(a,c,g){b.makeScale(a,c,g);this.applyMatrix(b);return this}}(),lookAt:function(){var b=new D;return function(a){b.lookAt(a);b.updateMatrix();this.applyMatrix(b.matrix)}}(),center:function(){var b=new m;return function(){this.computeBoundingBox();this.boundingBox.getCenter(b).negate();this.translate(b.x,b.y,b.z);return this}}(),setFromObject:function(b){var a=b.geometry;if(b.isPoints||b.isLine){b=new N(3*a.vertices.length,
  3);var c=new N(3*a.colors.length,3);this.addAttribute("position",b.copyVector3sArray(a.vertices));this.addAttribute("color",c.copyColorsArray(a.colors));a.lineDistances&&a.lineDistances.length===a.vertices.length&&(b=new N(a.lineDistances.length,1),this.addAttribute("lineDistance",b.copyArray(a.lineDistances)));null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone())}else b.isMesh&&a&&a.isGeometry&&this.fromGeometry(a);
  return this},setFromPoints:function(b){for(var a=[],c=0,g=b.length;c<g;c++){var h=b[c];a.push(h.x,h.y,h.z||0)}this.addAttribute("position",new N(a,3));return this},updateFromObject:function(b){var a=b.geometry;if(b.isMesh){var c=a.__directGeometry;!0===a.elementsNeedUpdate&&(c=void 0,a.elementsNeedUpdate=!1);if(void 0===c)return this.fromGeometry(a);c.verticesNeedUpdate=a.verticesNeedUpdate;c.normalsNeedUpdate=a.normalsNeedUpdate;c.colorsNeedUpdate=a.colorsNeedUpdate;c.uvsNeedUpdate=a.uvsNeedUpdate;
  c.groupsNeedUpdate=a.groupsNeedUpdate;a.verticesNeedUpdate=!1;a.normalsNeedUpdate=!1;a.colorsNeedUpdate=!1;a.uvsNeedUpdate=!1;a.groupsNeedUpdate=!1;a=c}!0===a.verticesNeedUpdate&&(c=this.attributes.position,void 0!==c&&(c.copyVector3sArray(a.vertices),c.needsUpdate=!0),a.verticesNeedUpdate=!1);!0===a.normalsNeedUpdate&&(c=this.attributes.normal,void 0!==c&&(c.copyVector3sArray(a.normals),c.needsUpdate=!0),a.normalsNeedUpdate=!1);!0===a.colorsNeedUpdate&&(c=this.attributes.color,void 0!==c&&(c.copyColorsArray(a.colors),
  c.needsUpdate=!0),a.colorsNeedUpdate=!1);a.uvsNeedUpdate&&(c=this.attributes.uv,void 0!==c&&(c.copyVector2sArray(a.uvs),c.needsUpdate=!0),a.uvsNeedUpdate=!1);a.lineDistancesNeedUpdate&&(c=this.attributes.lineDistance,void 0!==c&&(c.copyArray(a.lineDistances),c.needsUpdate=!0),a.lineDistancesNeedUpdate=!1);a.groupsNeedUpdate&&(a.computeGroups(b.geometry),this.groups=a.groups,a.groupsNeedUpdate=!1);return this},fromGeometry:function(b){b.__directGeometry=(new ma).fromGeometry(b);return this.fromDirectGeometry(b.__directGeometry)},
  fromDirectGeometry:function(b){var a=new Float32Array(3*b.vertices.length);this.addAttribute("position",(new n(a,3)).copyVector3sArray(b.vertices));0<b.normals.length&&(a=new Float32Array(3*b.normals.length),this.addAttribute("normal",(new n(a,3)).copyVector3sArray(b.normals)));0<b.colors.length&&(a=new Float32Array(3*b.colors.length),this.addAttribute("color",(new n(a,3)).copyColorsArray(b.colors)));0<b.uvs.length&&(a=new Float32Array(2*b.uvs.length),this.addAttribute("uv",(new n(a,2)).copyVector2sArray(b.uvs)));
  0<b.uvs2.length&&(a=new Float32Array(2*b.uvs2.length),this.addAttribute("uv2",(new n(a,2)).copyVector2sArray(b.uvs2)));this.groups=b.groups;for(var c in b.morphTargets){for(var a=[],g=b.morphTargets[c],h=0,d=g.length;h<d;h++){var f=g[h],m=new N(3*f.data.length,3);m.name=f.name;a.push(m.copyVector3sArray(f.data))}this.morphAttributes[c]=a}0<b.skinIndices.length&&(c=new N(4*b.skinIndices.length,4),this.addAttribute("skinIndex",c.copyVector4sArray(b.skinIndices)));0<b.skinWeights.length&&(c=new N(4*
  b.skinWeights.length,4),this.addAttribute("skinWeight",c.copyVector4sArray(b.skinWeights)));null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone());null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone());return this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new I);var b=this.attributes.position;void 0!==b?this.boundingBox.setFromBufferAttribute(b):this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&
  console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var b=new I,a=new m;return function(){null===this.boundingSphere&&(this.boundingSphere=new C);var c=this.attributes.position;if(c){var g=this.boundingSphere.center;b.setFromBufferAttribute(c);b.getCenter(g);for(var h=0,d=0,f=c.count;d<f;d++)a.x=c.getX(d),a.y=c.getY(d),a.z=c.getZ(d),h=Math.max(h,g.distanceToSquared(a));
  this.boundingSphere.radius=Math.sqrt(h);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var b=this.index,a=this.attributes;if(a.position){var c=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new n(new Float32Array(c.length),3));else for(var g=a.normal.array,h=0,d=g.length;h<d;h++)g[h]=
  0;var g=a.normal.array,f,l,p=new m,s=new m,q=new m,r=new m,t=new m;if(b)for(var u=b.array,h=0,d=b.count;h<d;h+=3)b=3*u[h+0],f=3*u[h+1],l=3*u[h+2],p.fromArray(c,b),s.fromArray(c,f),q.fromArray(c,l),r.subVectors(q,s),t.subVectors(p,s),r.cross(t),g[b]+=r.x,g[b+1]+=r.y,g[b+2]+=r.z,g[f]+=r.x,g[f+1]+=r.y,g[f+2]+=r.z,g[l]+=r.x,g[l+1]+=r.y,g[l+2]+=r.z;else for(h=0,d=c.length;h<d;h+=9)p.fromArray(c,h),s.fromArray(c,h+3),q.fromArray(c,h+6),r.subVectors(q,s),t.subVectors(p,s),r.cross(t),g[h]=r.x,g[h+1]=r.y,
  g[h+2]=r.z,g[h+3]=r.x,g[h+4]=r.y,g[h+5]=r.z,g[h+6]=r.x,g[h+7]=r.y,g[h+8]=r.z;this.normalizeNormals();a.normal.needsUpdate=!0}},merge:function(b,a){if(b&&b.isBufferGeometry){void 0===a&&(a=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var c=this.attributes,g;for(g in c)if(void 0!==b.attributes[g])for(var h=c[g].array,d=b.attributes[g],f=d.array,n=0,d=d.itemSize*a;n<f.length;n++,
  d++)h[d]=f[n];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",b)},normalizeNormals:function(){var b=new m;return function(){for(var a=this.attributes.normal,c=0,g=a.count;c<g;c++)b.x=a.getX(c),b.y=a.getY(c),b.z=a.getZ(c),b.normalize(),a.setXYZ(c,b.x,b.y,b.z)}}(),toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var b=new M,a=this.index.array,c=this.attributes,
  g;for(g in c){for(var h=c[g],d=h.array,f=h.itemSize,m=new d.constructor(a.length*f),p=0,l=0,h=0,s=a.length;h<s;h++)for(var p=a[h]*f,q=0;q<f;q++)m[l++]=d[p++];b.addAttribute(g,new n(m,f))}a=this.groups;h=0;for(s=a.length;h<s;h++)c=a[h],b.addGroup(c.start,c.count,c.materialIndex);return b},toJSON:function(){var b={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};b.uuid=this.uuid;b.type=this.type;""!==this.name&&(b.name=this.name);0<Object.keys(this.userData).length&&(b.userData=
  this.userData);if(void 0!==this.parameters){var a=this.parameters,c;for(c in a)void 0!==a[c]&&(b[c]=a[c]);return b}b.data={attributes:{}};var g=this.index;null!==g&&(a=Array.prototype.slice.call(g.array),b.data.index={type:g.array.constructor.name,array:a});g=this.attributes;for(c in g){var h=g[c],a=Array.prototype.slice.call(h.array);b.data.attributes[c]={itemSize:h.itemSize,type:h.array.constructor.name,array:a,normalized:h.normalized}}c=this.groups;0<c.length&&(b.data.groups=JSON.parse(JSON.stringify(c)));
  c=this.boundingSphere;null!==c&&(b.data.boundingSphere={center:c.center.toArray(),radius:c.radius});return b},clone:function(){return(new M).copy(this)},copy:function(b){var a,c,g;this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.name=b.name;c=b.index;null!==c&&this.setIndex(c.clone());c=b.attributes;for(a in c)this.addAttribute(a,c[a].clone());var h=b.morphAttributes;for(a in h){var d=[],f=h[a];c=0;for(g=f.length;c<g;c++)d.push(f[c].clone());
  this.morphAttributes[a]=d}a=b.groups;c=0;for(g=a.length;c<g;c++)h=a[c],this.addGroup(h.start,h.count,h.materialIndex);a=b.boundingBox;null!==a&&(this.boundingBox=a.clone());a=b.boundingSphere;null!==a&&(this.boundingSphere=a.clone());this.drawRange.start=b.drawRange.start;this.drawRange.count=b.drawRange.count;this.userData=b.userData;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});la.prototype=Object.create(g.prototype);la.prototype.constructor=la;G.prototype=Object.create(M.prototype);
  G.prototype.constructor=G;ja.prototype=Object.create(g.prototype);ja.prototype.constructor=ja;oa.prototype=Object.create(M.prototype);oa.prototype.constructor=oa;var Uh=0;T.prototype=Object.assign(Object.create(c.prototype),{constructor:T,isMaterial:!0,onBeforeCompile:function(){},setValues:function(b){if(void 0!==b)for(var a in b){var c=b[a];if(void 0===c)console.warn("THREE.Material: '"+a+"' parameter is undefined.");else if("shading"===a)console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),
  this.flatShading=1===c?!0:!1;else{var g=this[a];void 0===g?console.warn("THREE."+this.type+": '"+a+"' is not a property of this material."):g&&g.isColor?g.set(c):g&&g.isVector3&&c&&c.isVector3?g.copy(c):this[a]="overdraw"===a?Number(c):c}}},toJSON:function(b){function a(b){var e=[],c;for(c in b){var k=b[c];delete k.metadata;e.push(k)}return e}var c=void 0===b||"string"===typeof b;c&&(b={textures:{},images:{}});var g={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};g.uuid=this.uuid;
  g.type=this.type;""!==this.name&&(g.name=this.name);this.color&&this.color.isColor&&(g.color=this.color.getHex());void 0!==this.roughness&&(g.roughness=this.roughness);void 0!==this.metalness&&(g.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(g.emissive=this.emissive.getHex());1!==this.emissiveIntensity&&(g.emissiveIntensity=this.emissiveIntensity);this.specular&&this.specular.isColor&&(g.specular=this.specular.getHex());void 0!==this.shininess&&(g.shininess=this.shininess);void 0!==
  this.clearCoat&&(g.clearCoat=this.clearCoat);void 0!==this.clearCoatRoughness&&(g.clearCoatRoughness=this.clearCoatRoughness);this.map&&this.map.isTexture&&(g.map=this.map.toJSON(b).uuid);this.alphaMap&&this.alphaMap.isTexture&&(g.alphaMap=this.alphaMap.toJSON(b).uuid);this.lightMap&&this.lightMap.isTexture&&(g.lightMap=this.lightMap.toJSON(b).uuid);this.aoMap&&this.aoMap.isTexture&&(g.aoMap=this.aoMap.toJSON(b).uuid,g.aoMapIntensity=this.aoMapIntensity);this.bumpMap&&this.bumpMap.isTexture&&(g.bumpMap=
  this.bumpMap.toJSON(b).uuid,g.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(g.normalMap=this.normalMap.toJSON(b).uuid,g.normalMapType=this.normalMapType,g.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(g.displacementMap=this.displacementMap.toJSON(b).uuid,g.displacementScale=this.displacementScale,g.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(g.roughnessMap=this.roughnessMap.toJSON(b).uuid);
  this.metalnessMap&&this.metalnessMap.isTexture&&(g.metalnessMap=this.metalnessMap.toJSON(b).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(g.emissiveMap=this.emissiveMap.toJSON(b).uuid);this.specularMap&&this.specularMap.isTexture&&(g.specularMap=this.specularMap.toJSON(b).uuid);this.envMap&&this.envMap.isTexture&&(g.envMap=this.envMap.toJSON(b).uuid,g.reflectivity=this.reflectivity,void 0!==this.combine&&(g.combine=this.combine),void 0!==this.envMapIntensity&&(g.envMapIntensity=this.envMapIntensity));
  this.gradientMap&&this.gradientMap.isTexture&&(g.gradientMap=this.gradientMap.toJSON(b).uuid);void 0!==this.size&&(g.size=this.size);void 0!==this.sizeAttenuation&&(g.sizeAttenuation=this.sizeAttenuation);this.blending!==zb&&(g.blending=this.blending);!0===this.flatShading&&(g.flatShading=this.flatShading);this.side!==Xb&&(g.side=this.side);this.vertexColors!==ze&&(g.vertexColors=this.vertexColors);1>this.opacity&&(g.opacity=this.opacity);!0===this.transparent&&(g.transparent=this.transparent);g.depthFunc=
  this.depthFunc;g.depthTest=this.depthTest;g.depthWrite=this.depthWrite;0!==this.rotation&&(g.rotation=this.rotation);!0===this.polygonOffset&&(g.polygonOffset=!0);0!==this.polygonOffsetFactor&&(g.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(g.polygonOffsetUnits=this.polygonOffsetUnits);1!==this.linewidth&&(g.linewidth=this.linewidth);void 0!==this.dashSize&&(g.dashSize=this.dashSize);void 0!==this.gapSize&&(g.gapSize=this.gapSize);void 0!==this.scale&&(g.scale=this.scale);
  !0===this.dithering&&(g.dithering=!0);0<this.alphaTest&&(g.alphaTest=this.alphaTest);!0===this.premultipliedAlpha&&(g.premultipliedAlpha=this.premultipliedAlpha);!0===this.wireframe&&(g.wireframe=this.wireframe);1<this.wireframeLinewidth&&(g.wireframeLinewidth=this.wireframeLinewidth);"round"!==this.wireframeLinecap&&(g.wireframeLinecap=this.wireframeLinecap);"round"!==this.wireframeLinejoin&&(g.wireframeLinejoin=this.wireframeLinejoin);!0===this.morphTargets&&(g.morphTargets=!0);!0===this.skinning&&
  (g.skinning=!0);!1===this.visible&&(g.visible=!1);"{}"!==JSON.stringify(this.userData)&&(g.userData=this.userData);c&&(c=a(b.textures),b=a(b.images),0<c.length&&(g.textures=c),0<b.length&&(g.images=b));return g},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.name=b.name;this.fog=b.fog;this.lights=b.lights;this.blending=b.blending;this.side=b.side;this.flatShading=b.flatShading;this.vertexColors=b.vertexColors;this.opacity=b.opacity;this.transparent=b.transparent;this.blendSrc=
  b.blendSrc;this.blendDst=b.blendDst;this.blendEquation=b.blendEquation;this.blendSrcAlpha=b.blendSrcAlpha;this.blendDstAlpha=b.blendDstAlpha;this.blendEquationAlpha=b.blendEquationAlpha;this.depthFunc=b.depthFunc;this.depthTest=b.depthTest;this.depthWrite=b.depthWrite;this.colorWrite=b.colorWrite;this.precision=b.precision;this.polygonOffset=b.polygonOffset;this.polygonOffsetFactor=b.polygonOffsetFactor;this.polygonOffsetUnits=b.polygonOffsetUnits;this.dithering=b.dithering;this.alphaTest=b.alphaTest;
  this.premultipliedAlpha=b.premultipliedAlpha;this.overdraw=b.overdraw;this.visible=b.visible;this.userData=JSON.parse(JSON.stringify(b.userData));this.clipShadows=b.clipShadows;this.clipIntersection=b.clipIntersection;var a=b.clippingPlanes,c=null;if(null!==a)for(var g=a.length,c=Array(g),h=0;h!==g;++h)c[h]=a[h].clone();this.clippingPlanes=c;this.shadowSide=b.shadowSide;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});pa.prototype=Object.create(T.prototype);pa.prototype.constructor=
  pa;pa.prototype.isShaderMaterial=!0;pa.prototype.copy=function(b){T.prototype.copy.call(this,b);this.fragmentShader=b.fragmentShader;this.vertexShader=b.vertexShader;this.uniforms=Ha.clone(b.uniforms);this.defines=Object.assign({},b.defines);this.wireframe=b.wireframe;this.wireframeLinewidth=b.wireframeLinewidth;this.lights=b.lights;this.clipping=b.clipping;this.skinning=b.skinning;this.morphTargets=b.morphTargets;this.morphNormals=b.morphNormals;this.extensions=b.extensions;return this};pa.prototype.toJSON=
  function(b){var a=T.prototype.toJSON.call(this,b);a.uniforms={};for(var c in this.uniforms){var g=this.uniforms[c].value;a.uniforms[c]=g.isTexture?{type:"t",value:g.toJSON(b).uuid}:g.isColor?{type:"c",value:g.getHex()}:g.isVector2?{type:"v2",value:g.toArray()}:g.isVector3?{type:"v3",value:g.toArray()}:g.isVector4?{type:"v4",value:g.toArray()}:g.isMatrix4?{type:"m4",value:g.toArray()}:{value:g}}0<Object.keys(this.defines).length&&(a.defines=this.defines);a.vertexShader=this.vertexShader;a.fragmentShader=
  this.fragmentShader;return a};Object.assign(fb.prototype,{set:function(b,a){this.origin.copy(b);this.direction.copy(a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.origin.copy(b.origin);this.direction.copy(b.direction);return this},at:function(b,a){void 0===a&&(console.warn("THREE.Ray: .at() target is now required"),a=new m);return a.copy(this.direction).multiplyScalar(b).add(this.origin)},lookAt:function(b){this.direction.copy(b).sub(this.origin).normalize();
  return this},recast:function(){var b=new m;return function(a){this.origin.copy(this.at(a,b));return this}}(),closestPointToPoint:function(b,a){void 0===a&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),a=new m);a.subVectors(b,this.origin);var c=a.dot(this.direction);return 0>c?a.copy(this.origin):a.copy(this.direction).multiplyScalar(c).add(this.origin)},distanceToPoint:function(b){return Math.sqrt(this.distanceSqToPoint(b))},distanceSqToPoint:function(){var b=new m;return function(a){var c=
  b.subVectors(a,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(a);b.copy(this.direction).multiplyScalar(c).add(this.origin);return b.distanceToSquared(a)}}(),distanceSqToSegment:function(){var b=new m,a=new m,c=new m;return function(g,h,d,f){b.copy(g).add(h).multiplyScalar(0.5);a.copy(h).sub(g).normalize();c.copy(this.origin).sub(b);var n=0.5*g.distanceTo(h),p=-this.direction.dot(a),m=c.dot(this.direction),l=-c.dot(a),s=c.lengthSq(),q=Math.abs(1-p*p),r;0<q?(g=p*l-m,h=
  p*m-l,r=n*q,0<=g?h>=-r?h<=r?(n=1/q,g*=n,h*=n,p=g*(g+p*h+2*m)+h*(p*g+h+2*l)+s):(h=n,g=Math.max(0,-(p*h+m)),p=-g*g+h*(h+2*l)+s):(h=-n,g=Math.max(0,-(p*h+m)),p=-g*g+h*(h+2*l)+s):h<=-r?(g=Math.max(0,-(-p*n+m)),h=0<g?-n:Math.min(Math.max(-n,-l),n),p=-g*g+h*(h+2*l)+s):h<=r?(g=0,h=Math.min(Math.max(-n,-l),n),p=h*(h+2*l)+s):(g=Math.max(0,-(p*n+m)),h=0<g?n:Math.min(Math.max(-n,-l),n),p=-g*g+h*(h+2*l)+s)):(h=0<p?-n:n,g=Math.max(0,-(p*h+m)),p=-g*g+h*(h+2*l)+s);d&&d.copy(this.direction).multiplyScalar(g).add(this.origin);
  f&&f.copy(a).multiplyScalar(h).add(b);return p}}(),intersectSphere:function(){var b=new m;return function(a,c){b.subVectors(a.center,this.origin);var g=b.dot(this.direction),h=b.dot(b)-g*g,d=a.radius*a.radius;if(h>d)return null;d=Math.sqrt(d-h);h=g-d;g+=d;return 0>h&&0>g?null:0>h?this.at(g,c):this.at(h,c)}}(),intersectsSphere:function(b){return this.distanceSqToPoint(b.center)<=b.radius*b.radius},distanceToPlane:function(b){var a=b.normal.dot(this.direction);if(0===a)return 0===b.distanceToPoint(this.origin)?
  0:null;b=-(this.origin.dot(b.normal)+b.constant)/a;return 0<=b?b:null},intersectPlane:function(b,a){var c=this.distanceToPlane(b);return null===c?null:this.at(c,a)},intersectsPlane:function(b){var a=b.distanceToPoint(this.origin);return 0===a||0>b.normal.dot(this.direction)*a?!0:!1},intersectBox:function(b,a){var c,g,h,d,f;g=1/this.direction.x;d=1/this.direction.y;f=1/this.direction.z;var n=this.origin;0<=g?(c=(b.min.x-n.x)*g,g*=b.max.x-n.x):(c=(b.max.x-n.x)*g,g*=b.min.x-n.x);0<=d?(h=(b.min.y-n.y)*
  d,d*=b.max.y-n.y):(h=(b.max.y-n.y)*d,d*=b.min.y-n.y);if(c>d||h>g)return null;if(h>c||c!==c)c=h;if(d<g||g!==g)g=d;0<=f?(h=(b.min.z-n.z)*f,f*=b.max.z-n.z):(h=(b.max.z-n.z)*f,f*=b.min.z-n.z);if(c>f||h>g)return null;if(h>c||c!==c)c=h;if(f<g||g!==g)g=f;return 0>g?null:this.at(0<=c?c:g,a)},intersectsBox:function(){var b=new m;return function(a){return null!==this.intersectBox(a,b)}}(),intersectTriangle:function(){var b=new m,a=new m,c=new m,g=new m;return function(h,d,f,n,p){a.subVectors(d,h);c.subVectors(f,
  h);g.crossVectors(a,c);d=this.direction.dot(g);if(0<d){if(n)return null;n=1}else if(0>d)n=-1,d=-d;else return null;b.subVectors(this.origin,h);h=n*this.direction.dot(c.crossVectors(b,c));if(0>h)return null;f=n*this.direction.dot(a.cross(b));if(0>f||h+f>d)return null;h=-n*b.dot(g);return 0>h?null:this.at(h/d,p)}}(),applyMatrix4:function(b){this.origin.applyMatrix4(b);this.direction.transformDirection(b);return this},equals:function(b){return b.origin.equals(this.origin)&&b.direction.equals(this.direction)}});
  Object.assign(sa,{getNormal:function(){var b=new m;return function(a,c,g,h){void 0===h&&(console.warn("THREE.Triangle: .getNormal() target is now required"),h=new m);h.subVectors(g,c);b.subVectors(a,c);h.cross(b);a=h.lengthSq();return 0<a?h.multiplyScalar(1/Math.sqrt(a)):h.set(0,0,0)}}(),getBarycoord:function(){var b=new m,a=new m,c=new m;return function(g,h,d,f,n){b.subVectors(f,h);a.subVectors(d,h);c.subVectors(g,h);g=b.dot(b);h=b.dot(a);d=b.dot(c);var p=a.dot(a);f=a.dot(c);var l=g*p-h*h;void 0===
  n&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),n=new m);if(0===l)return n.set(-2,-1,-1);l=1/l;p=(p*d-h*f)*l;g=(g*f-h*d)*l;return n.set(1-p-g,g,p)}}(),containsPoint:function(){var b=new m;return function(a,c,g,h){sa.getBarycoord(a,c,g,h,b);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}(),getUV:function(){var b=new m;return function(a,c,g,h,d,f,n,p){this.getBarycoord(a,c,g,h,b);p.set(0,0);p.addScaledVector(d,b.x);p.addScaledVector(f,b.y);p.addScaledVector(n,b.z);return p}}()});Object.assign(sa.prototype,
  {set:function(b,a,c){this.a.copy(b);this.b.copy(a);this.c.copy(c);return this},setFromPointsAndIndices:function(b,a,c,g){this.a.copy(b[a]);this.b.copy(b[c]);this.c.copy(b[g]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.a.copy(b.a);this.b.copy(b.b);this.c.copy(b.c);return this},getArea:function(){var b=new m,a=new m;return function(){b.subVectors(this.c,this.b);a.subVectors(this.a,this.b);return 0.5*b.cross(a).length()}}(),getMidpoint:function(b){void 0===
  b&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),b=new m);return b.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(b){return sa.getNormal(this.a,this.b,this.c,b)},getPlane:function(b){void 0===b&&(console.warn("THREE.Triangle: .getPlane() target is now required"),b=new m);return b.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(b,a){return sa.getBarycoord(b,this.a,this.b,this.c,a)},containsPoint:function(b){return sa.containsPoint(b,
  this.a,this.b,this.c)},getUV:function(b,a,c,g,h){return sa.getUV(b,this.a,this.b,this.c,a,c,g,h)},intersectsBox:function(b){return b.intersectsTriangle(this)},closestPointToPoint:function(){var b=new m,a=new m,c=new m,g=new m,h=new m,d=new m;return function(f,n){void 0===n&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),n=new m);var p=this.a,l=this.b,s=this.c,q;b.subVectors(l,p);a.subVectors(s,p);g.subVectors(f,p);var r=b.dot(g),t=a.dot(g);if(0>=r&&0>=t)return n.copy(p);
  h.subVectors(f,l);var u=b.dot(h),w=a.dot(h);if(0<=u&&w<=u)return n.copy(l);q=r*w-u*t;if(0>=q&&0<=r&&0>=u)return l=r/(r-u),n.copy(p).addScaledVector(b,l);d.subVectors(f,s);var G=b.dot(d),v=a.dot(d);if(0<=v&&G<=v)return n.copy(s);r=G*t-r*v;if(0>=r&&0<=t&&0>=v)return q=t/(t-v),n.copy(p).addScaledVector(a,q);t=u*v-G*w;if(0>=t&&0<=w-u&&0<=G-v)return c.subVectors(s,l),q=(w-u)/(w-u+(G-v)),n.copy(l).addScaledVector(c,q);s=1/(t+r+q);l=r*s;q*=s;return n.copy(p).addScaledVector(b,l).addScaledVector(a,q)}}(),
  equals:function(b){return b.a.equals(this.a)&&b.b.equals(this.b)&&b.c.equals(this.c)}});Ba.prototype=Object.create(T.prototype);Ba.prototype.constructor=Ba;Ba.prototype.isMeshBasicMaterial=!0;Ba.prototype.copy=function(b){T.prototype.copy.call(this,b);this.color.copy(b.color);this.map=b.map;this.lightMap=b.lightMap;this.lightMapIntensity=b.lightMapIntensity;this.aoMap=b.aoMap;this.aoMapIntensity=b.aoMapIntensity;this.specularMap=b.specularMap;this.alphaMap=b.alphaMap;this.envMap=b.envMap;this.combine=
  b.combine;this.reflectivity=b.reflectivity;this.refractionRatio=b.refractionRatio;this.wireframe=b.wireframe;this.wireframeLinewidth=b.wireframeLinewidth;this.wireframeLinecap=b.wireframeLinecap;this.wireframeLinejoin=b.wireframeLinejoin;this.skinning=b.skinning;this.morphTargets=b.morphTargets;return this};wa.prototype=Object.assign(Object.create(D.prototype),{constructor:wa,isMesh:!0,setDrawMode:function(b){this.drawMode=b},copy:function(b){D.prototype.copy.call(this,b);this.drawMode=b.drawMode;
  void 0!==b.morphTargetInfluences&&(this.morphTargetInfluences=b.morphTargetInfluences.slice());void 0!==b.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},b.morphTargetDictionary));return this},updateMorphTargets:function(){var b=this.geometry,a,c;if(b.isBufferGeometry){if(b=b.morphAttributes,a=Object.keys(b),0<a.length){var g=b[a[0]];if(void 0!==g)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},b=0,a=g.length;b<a;b++)c=g[b].name||String(b),this.morphTargetInfluences.push(0),
  this.morphTargetDictionary[c]=b}}else if(g=b.morphTargets,void 0!==g&&0<g.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},b=0,a=g.length;b<a;b++)c=g[b].name||String(b),this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=b},raycast:function(){function b(b,a,e,c,g,k,h,d){if(null===(a.side===Oa?c.intersectTriangle(h,k,g,!0,d):c.intersectTriangle(g,k,h,a.side!==ac,d)))return null;G.copy(d);G.applyMatrix4(b.matrixWorld);a=e.ray.origin.distanceTo(G);return a<e.near||
  a>e.far?null:{distance:a,point:G.clone(),object:b}}function a(e,c,g,k,h,f,E,p,m){n.fromBufferAttribute(h,E);l.fromBufferAttribute(h,p);s.fromBufferAttribute(h,m);if(e=b(e,c,g,k,n,l,s,v))f&&(t.fromBufferAttribute(f,E),u.fromBufferAttribute(f,p),w.fromBufferAttribute(f,m),e.uv=sa.getUV(v,n,l,s,t,u,w,new d)),f=new H(E,p,m),sa.getNormal(n,l,s,f.normal),e.face=f;return e}var c=new f,g=new fb,h=new C,n=new m,l=new m,s=new m,p=new m,q=new m,r=new m,t=new d,u=new d,w=new d,v=new m,G=new m;return function(f,
  m){var G=this.geometry,A=this.material,x=this.matrixWorld;if(void 0!==A&&(null===G.boundingSphere&&G.computeBoundingSphere(),h.copy(G.boundingSphere),h.applyMatrix4(x),!1!==f.ray.intersectsSphere(h)&&(c.getInverse(x),g.copy(f.ray).applyMatrix4(c),null===G.boundingBox||!1!==g.intersectsBox(G.boundingBox))))if(G.isBufferGeometry){var S,K,H=G.index,C=G.attributes.position,V=G.attributes.uv,D=G.groups,G=G.drawRange,y,I,J,Y,W;if(null!==H)if(Array.isArray(A))for(y=0,J=D.length;y<J;y++)for(I=D[y],W=A[I.materialIndex],
  x=Math.max(I.start,G.start),Y=Math.min(I.start+I.count,G.start+G.count),I=x;I<Y;I+=3){if(x=H.getX(I),S=H.getX(I+1),K=H.getX(I+2),x=a(this,W,f,g,C,V,x,S,K))x.faceIndex=Math.floor(I/3),m.push(x)}else for(x=Math.max(0,G.start),Y=Math.min(H.count,G.start+G.count),y=x,J=Y;y<J;y+=3){if(x=H.getX(y),S=H.getX(y+1),K=H.getX(y+2),x=a(this,A,f,g,C,V,x,S,K))x.faceIndex=Math.floor(y/3),m.push(x)}else if(void 0!==C)if(Array.isArray(A))for(y=0,J=D.length;y<J;y++)for(I=D[y],W=A[I.materialIndex],x=Math.max(I.start,
  G.start),Y=Math.min(I.start+I.count,G.start+G.count),I=x;I<Y;I+=3){if(x=I,S=I+1,K=I+2,x=a(this,W,f,g,C,V,x,S,K))x.faceIndex=Math.floor(I/3),m.push(x)}else for(x=Math.max(0,G.start),Y=Math.min(C.count,G.start+G.count),y=x,J=Y;y<J;y+=3)if(x=y,S=y+1,K=y+2,x=a(this,A,f,g,C,V,x,S,K))x.faceIndex=Math.floor(y/3),m.push(x)}else if(G.isGeometry)for(C=Array.isArray(A),V=G.vertices,D=G.faces,x=G.faceVertexUvs[0],0<x.length&&(H=x),I=0,Y=D.length;I<Y;I++)if(S=D[I],x=C?A[S.materialIndex]:A,void 0!==x){y=V[S.a];
  J=V[S.b];W=V[S.c];if(!0===x.morphTargets){K=G.morphTargets;var ja=this.morphTargetInfluences;n.set(0,0,0);l.set(0,0,0);s.set(0,0,0);for(var Q=0,N=K.length;Q<N;Q++){var M=ja[Q];if(0!==M){var T=K[Q].vertices;n.addScaledVector(p.subVectors(T[S.a],y),M);l.addScaledVector(q.subVectors(T[S.b],J),M);s.addScaledVector(r.subVectors(T[S.c],W),M)}}n.add(y);l.add(J);s.add(W);y=n;J=l;W=s}if(x=b(this,x,f,g,y,J,W,v))H&&H[I]&&(K=H[I],t.copy(K[0]),u.copy(K[1]),w.copy(K[2]),x.uv=sa.getUV(v,y,J,W,t,u,w,new d)),x.face=
  S,x.faceIndex=I,m.push(x)}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});mb.prototype=Object.create(q.prototype);mb.prototype.constructor=mb;mb.prototype.isCubeTexture=!0;Object.defineProperty(mb.prototype,"images",{get:function(){return this.image},set:function(b){this.image=b}});Zb.prototype=Object.create(q.prototype);Zb.prototype.constructor=Zb;Zb.prototype.isTexture3D=!0;var Rf=new q,ii=new Zb,Sf=new mb,Lf=[],Nf=[],Qf=new Float32Array(16),Pf=new Float32Array(9),
  Of=new Float32Array(4);Wf.prototype.updateCache=function(b){var a=this.cache;b instanceof Float32Array&&a.length!==b.length&&(this.cache=new Float32Array(b.length));Da(a,b)};Xf.prototype.setValue=function(b,a,c){for(var g=this.seq,h=0,d=g.length;h!==d;++h){var f=g[h];f.setValue(b,a[f.id],c)}};var Ie=/([\w\d_]+)(\])?(\[|\.)?/g;sb.prototype.setValue=function(b,a,c){a=this.map[a];void 0!==a&&a.setValue(b,c,this.renderer)};sb.prototype.setOptional=function(b,a,c){a=a[c];void 0!==a&&this.setValue(b,c,
  a)};sb.upload=function(b,a,c,g){for(var h=0,d=a.length;h!==d;++h){var f=a[h],n=c[f.id];!1!==n.needsUpdate&&f.setValue(b,n.value,g)}};sb.seqWithValue=function(b,a){for(var c=[],g=0,h=b.length;g!==h;++g){var d=b[g];d.id in a&&c.push(d)}return c};var Di=0,Mi=0;tb.prototype=Object.create(T.prototype);tb.prototype.constructor=tb;tb.prototype.isMeshDepthMaterial=!0;tb.prototype.copy=function(b){T.prototype.copy.call(this,b);this.depthPacking=b.depthPacking;this.skinning=b.skinning;this.morphTargets=b.morphTargets;
  this.map=b.map;this.alphaMap=b.alphaMap;this.displacementMap=b.displacementMap;this.displacementScale=b.displacementScale;this.displacementBias=b.displacementBias;this.wireframe=b.wireframe;this.wireframeLinewidth=b.wireframeLinewidth;return this};ub.prototype=Object.create(T.prototype);ub.prototype.constructor=ub;ub.prototype.isMeshDistanceMaterial=!0;ub.prototype.copy=function(b){T.prototype.copy.call(this,b);this.referencePosition.copy(b.referencePosition);this.nearDistance=b.nearDistance;this.farDistance=
  b.farDistance;this.skinning=b.skinning;this.morphTargets=b.morphTargets;this.map=b.map;this.alphaMap=b.alphaMap;this.displacementMap=b.displacementMap;this.displacementScale=b.displacementScale;this.displacementBias=b.displacementBias;return this};ec.prototype=Object.assign(Object.create(D.prototype),{constructor:ec,isGroup:!0});hb.prototype=Object.assign(Object.create(D.prototype),{constructor:hb,isCamera:!0,copy:function(b,a){D.prototype.copy.call(this,b,a);this.matrixWorldInverse.copy(b.matrixWorldInverse);
  this.projectionMatrix.copy(b.projectionMatrix);this.projectionMatrixInverse.copy(b.projectionMatrixInverse);return this},getWorldDirection:function(b){void 0===b&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),b=new m);this.updateMatrixWorld(!0);var a=this.matrixWorld.elements;return b.set(-a[8],-a[9],-a[10]).normalize()},updateMatrixWorld:function(b){D.prototype.updateMatrixWorld.call(this,b);this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}});
  qa.prototype=Object.assign(Object.create(hb.prototype),{constructor:qa,isPerspectiveCamera:!0,copy:function(b,a){hb.prototype.copy.call(this,b,a);this.fov=b.fov;this.zoom=b.zoom;this.near=b.near;this.far=b.far;this.focus=b.focus;this.aspect=b.aspect;this.view=null===b.view?null:Object.assign({},b.view);this.filmGauge=b.filmGauge;this.filmOffset=b.filmOffset;return this},setFocalLength:function(b){b=0.5*this.getFilmHeight()/b;this.fov=2*ga.RAD2DEG*Math.atan(b);this.updateProjectionMatrix()},getFocalLength:function(){var b=
  Math.tan(0.5*ga.DEG2RAD*this.fov);return 0.5*this.getFilmHeight()/b},getEffectiveFOV:function(){return 2*ga.RAD2DEG*Math.atan(Math.tan(0.5*ga.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(b,a,c,g,h,d){this.aspect=b/a;null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1});this.view.enabled=!0;this.view.fullWidth=
  b;this.view.fullHeight=a;this.view.offsetX=c;this.view.offsetY=g;this.view.width=h;this.view.height=d;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var b=this.near,a=b*Math.tan(0.5*ga.DEG2RAD*this.fov)/this.zoom,c=2*a,g=this.aspect*c,h=-0.5*g,d=this.view;if(null!==this.view&&this.view.enabled)var f=d.fullWidth,n=d.fullHeight,h=h+d.offsetX*g/f,a=a-d.offsetY*c/n,g=d.width/f*g,c=d.height/
  n*c;d=this.filmOffset;0!==d&&(h+=b*d/this.getFilmWidth());this.projectionMatrix.makePerspective(h,h+g,a,a-c,b,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(b){b=D.prototype.toJSON.call(this,b);b.object.fov=this.fov;b.object.zoom=this.zoom;b.object.near=this.near;b.object.far=this.far;b.object.focus=this.focus;b.object.aspect=this.aspect;null!==this.view&&(b.object.view=Object.assign({},this.view));b.object.filmGauge=this.filmGauge;b.object.filmOffset=this.filmOffset;
  return b}});Rc.prototype=Object.assign(Object.create(qa.prototype),{constructor:Rc,isArrayCamera:!0});fc.prototype.isFogExp2=!0;fc.prototype.clone=function(){return new fc(this.color,this.density)};fc.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}};hc.prototype.isFog=!0;hc.prototype.clone=function(){return new hc(this.color,this.near,this.far)};hc.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}};
  $d.prototype=Object.assign(Object.create(D.prototype),{constructor:$d,copy:function(b,a){D.prototype.copy.call(this,b,a);null!==b.background&&(this.background=b.background.clone());null!==b.fog&&(this.fog=b.fog.clone());null!==b.overrideMaterial&&(this.overrideMaterial=b.overrideMaterial.clone());this.autoUpdate=b.autoUpdate;this.matrixAutoUpdate=b.matrixAutoUpdate;return this},toJSON:function(b){var a=D.prototype.toJSON.call(this,b);null!==this.background&&(a.object.background=this.background.toJSON(b));
  null!==this.fog&&(a.object.fog=this.fog.toJSON());return a}});Object.defineProperty(Cb.prototype,"needsUpdate",{set:function(b){!0===b&&this.version++}});Object.assign(Cb.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(b){if(Array.isArray(b))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==b?b.length/this.stride:0;this.array=b;return this},setDynamic:function(b){this.dynamic=b;return this},copy:function(b){this.array=
  new b.array.constructor(b.array);this.count=b.count;this.stride=b.stride;this.dynamic=b.dynamic;return this},copyAt:function(b,a,c){b*=this.stride;c*=a.stride;for(var g=0,h=this.stride;g<h;g++)this.array[b+g]=a.array[c+g];return this},set:function(b,a){void 0===a&&(a=0);this.array.set(b,a);return this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(b){this.onUploadCallback=b;return this}});Object.defineProperties(Sc.prototype,{count:{get:function(){return this.data.count}},
  array:{get:function(){return this.data.array}}});Object.assign(Sc.prototype,{isInterleavedBufferAttribute:!0,setX:function(b,a){this.data.array[b*this.data.stride+this.offset]=a;return this},setY:function(b,a){this.data.array[b*this.data.stride+this.offset+1]=a;return this},setZ:function(b,a){this.data.array[b*this.data.stride+this.offset+2]=a;return this},setW:function(b,a){this.data.array[b*this.data.stride+this.offset+3]=a;return this},getX:function(b){return this.data.array[b*this.data.stride+
  this.offset]},getY:function(b){return this.data.array[b*this.data.stride+this.offset+1]},getZ:function(b){return this.data.array[b*this.data.stride+this.offset+2]},getW:function(b){return this.data.array[b*this.data.stride+this.offset+3]},setXY:function(b,a,c){b=b*this.data.stride+this.offset;this.data.array[b+0]=a;this.data.array[b+1]=c;return this},setXYZ:function(b,a,c,g){b=b*this.data.stride+this.offset;this.data.array[b+0]=a;this.data.array[b+1]=c;this.data.array[b+2]=g;return this},setXYZW:function(b,
  a,c,g,h){b=b*this.data.stride+this.offset;this.data.array[b+0]=a;this.data.array[b+1]=c;this.data.array[b+2]=g;this.data.array[b+3]=h;return this}});wb.prototype=Object.create(T.prototype);wb.prototype.constructor=wb;wb.prototype.isSpriteMaterial=!0;wb.prototype.copy=function(b){T.prototype.copy.call(this,b);this.color.copy(b.color);this.map=b.map;this.rotation=b.rotation;this.sizeAttenuation=b.sizeAttenuation;return this};var ic;Tc.prototype=Object.assign(Object.create(D.prototype),{constructor:Tc,
  isSprite:!0,raycast:function(){function b(b,a,e,c,g,k){h.subVectors(b,e).addScalar(0.5).multiply(c);void 0!==g?(n.x=k*h.x-g*h.y,n.y=g*h.x+k*h.y):n.copy(h);b.copy(a);b.x+=n.x;b.y+=n.y;b.applyMatrix4(l)}var a=new m,c=new m,g=new m,h=new d,n=new d,l=new f,s=new m,p=new m,q=new m,r=new d,t=new d,u=new d;return function(h,f){c.setFromMatrixScale(this.matrixWorld);l.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld);g.setFromMatrixPosition(this.modelViewMatrix);var n=this.material.rotation,
  m,L;0!==n&&(L=Math.cos(n),m=Math.sin(n));n=this.center;b(s.set(-0.5,-0.5,0),g,n,c,m,L);b(p.set(0.5,-0.5,0),g,n,c,m,L);b(q.set(0.5,0.5,0),g,n,c,m,L);r.set(0,0);t.set(1,0);u.set(1,1);var w=h.ray.intersectTriangle(s,p,q,!1,a);if(null===w&&(b(p.set(-0.5,0.5,0),g,n,c,m,L),t.set(0,1),w=h.ray.intersectTriangle(s,q,p,!1,a),null===w))return;m=h.ray.origin.distanceTo(a);m<h.near||m>h.far||f.push({distance:m,point:a.clone(),uv:sa.getUV(a,s,p,q,r,t,u,new d),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)},
  copy:function(b){D.prototype.copy.call(this,b);void 0!==b.center&&this.center.copy(b.center);return this}});Uc.prototype=Object.assign(Object.create(D.prototype),{constructor:Uc,copy:function(b){D.prototype.copy.call(this,b,!1);b=b.levels;for(var a=0,c=b.length;a<c;a++){var g=b[a];this.addLevel(g.object.clone(),g.distance)}return this},addLevel:function(b,a){void 0===a&&(a=0);a=Math.abs(a);for(var c=this.levels,g=0;g<c.length&&!(a<c[g].distance);g++);c.splice(g,0,{distance:a,object:b});this.add(b)},
  getObjectForDistance:function(b){for(var a=this.levels,c=1,g=a.length;c<g&&!(b<a[c].distance);c++);return a[c-1].object},raycast:function(){var b=new m;return function(a,c){b.setFromMatrixPosition(this.matrixWorld);var g=a.ray.origin.distanceTo(b);this.getObjectForDistance(g).raycast(a,c)}}(),update:function(){var b=new m,a=new m;return function(c){var g=this.levels;if(1<g.length){b.setFromMatrixPosition(c.matrixWorld);a.setFromMatrixPosition(this.matrixWorld);c=b.distanceTo(a);g[0].object.visible=
  !0;for(var h=1,d=g.length;h<d;h++)if(c>=g[h].distance)g[h-1].object.visible=!1,g[h].object.visible=!0;else break;for(;h<d;h++)g[h].object.visible=!1}}}(),toJSON:function(b){b=D.prototype.toJSON.call(this,b);b.object.levels=[];for(var a=this.levels,c=0,g=a.length;c<g;c++){var h=a[c];b.object.levels.push({object:h.object.uuid,distance:h.distance})}return b}});Object.assign(Vc.prototype,{calculateInverses:function(){this.boneInverses=[];for(var b=0,a=this.bones.length;b<a;b++){var c=new f;this.bones[b]&&
  c.getInverse(this.bones[b].matrixWorld);this.boneInverses.push(c)}},pose:function(){var b,a,c;a=0;for(c=this.bones.length;a<c;a++)(b=this.bones[a])&&b.matrixWorld.getInverse(this.boneInverses[a]);a=0;for(c=this.bones.length;a<c;a++)if(b=this.bones[a])b.parent&&b.parent.isBone?(b.matrix.getInverse(b.parent.matrixWorld),b.matrix.multiply(b.matrixWorld)):b.matrix.copy(b.matrixWorld),b.matrix.decompose(b.position,b.quaternion,b.scale)},update:function(){var b=new f,a=new f;return function(){for(var c=
  this.bones,g=this.boneInverses,h=this.boneMatrices,d=this.boneTexture,f=0,n=c.length;f<n;f++)b.multiplyMatrices(c[f]?c[f].matrixWorld:a,g[f]),b.toArray(h,16*f);void 0!==d&&(d.needsUpdate=!0)}}(),clone:function(){return new Vc(this.bones,this.boneInverses)},getBoneByName:function(b){for(var a=0,c=this.bones.length;a<c;a++){var g=this.bones[a];if(g.name===b)return g}}});ae.prototype=Object.assign(Object.create(D.prototype),{constructor:ae,isBone:!0});be.prototype=Object.assign(Object.create(wa.prototype),
  {constructor:be,isSkinnedMesh:!0,initBones:function(){var b=[],a,c,g,h;if(this.geometry&&void 0!==this.geometry.bones){g=0;for(h=this.geometry.bones.length;g<h;g++)c=this.geometry.bones[g],a=new ae,b.push(a),a.name=c.name,a.position.fromArray(c.pos),a.quaternion.fromArray(c.rotq),void 0!==c.scl&&a.scale.fromArray(c.scl);g=0;for(h=this.geometry.bones.length;g<h;g++)c=this.geometry.bones[g],-1!==c.parent&&null!==c.parent&&void 0!==b[c.parent]?b[c.parent].add(b[g]):this.add(b[g])}this.updateMatrixWorld(!0);
  return b},bind:function(b,a){this.skeleton=b;void 0===a&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),a=this.matrixWorld);this.bindMatrix.copy(a);this.bindMatrixInverse.getInverse(a)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var b,a;if(this.geometry&&this.geometry.isGeometry)for(a=0;a<this.geometry.skinWeights.length;a++){var c=this.geometry.skinWeights[a];b=1/c.manhattanLength();Infinity!==b?c.multiplyScalar(b):c.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var c=
  new t,g=this.geometry.attributes.skinWeight;for(a=0;a<g.count;a++)c.x=g.getX(a),c.y=g.getY(a),c.z=g.getZ(a),c.w=g.getW(a),b=1/c.manhattanLength(),Infinity!==b?c.multiplyScalar(b):c.set(1,0,0,0),g.setXYZW(a,c.x,c.y,c.z,c.w)}},updateMatrixWorld:function(b){wa.prototype.updateMatrixWorld.call(this,b);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+
  this.bindMode)},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});na.prototype=Object.create(T.prototype);na.prototype.constructor=na;na.prototype.isLineBasicMaterial=!0;na.prototype.copy=function(b){T.prototype.copy.call(this,b);this.color.copy(b.color);this.linewidth=b.linewidth;this.linecap=b.linecap;this.linejoin=b.linejoin;return this};ya.prototype=Object.assign(Object.create(D.prototype),{constructor:ya,isLine:!0,computeLineDistances:function(){var b=new m,
  a=new m;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var g=c.attributes.position,h=[0],d=1,f=g.count;d<f;d++)b.fromBufferAttribute(g,d-1),a.fromBufferAttribute(g,d),h[d]=h[d-1],h[d]+=b.distanceTo(a);c.addAttribute("lineDistance",new N(h,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(c.isGeometry)for(g=c.vertices,h=c.lineDistances,h[0]=0,d=1,f=g.length;d<f;d++)h[d]=h[d-1],h[d]+=g[d-
  1].distanceTo(g[d]);return this}}(),raycast:function(){var b=new f,a=new fb,c=new C;return function(g,h){var d=g.linePrecision,f=this.geometry,n=this.matrixWorld;null===f.boundingSphere&&f.computeBoundingSphere();c.copy(f.boundingSphere);c.applyMatrix4(n);c.radius+=d;if(!1!==g.ray.intersectsSphere(c)){b.getInverse(n);a.copy(g.ray).applyMatrix4(b);var d=d/((this.scale.x+this.scale.y+this.scale.z)/3),d=d*d,p=new m,l=new m,n=new m,s=new m,q=this&&this.isLineSegments?2:1;if(f.isBufferGeometry){var r=
  f.index,t=f.attributes.position.array;if(null!==r)for(var r=r.array,f=0,u=r.length-1;f<u;f+=q){var w=r[f+1];p.fromArray(t,3*r[f]);l.fromArray(t,3*w);w=a.distanceSqToSegment(p,l,s,n);w>d||(s.applyMatrix4(this.matrixWorld),w=g.ray.origin.distanceTo(s),w<g.near||w>g.far||h.push({distance:w,point:n.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else for(f=0,u=t.length/3-1;f<u;f+=q)p.fromArray(t,3*f),l.fromArray(t,3*f+3),w=a.distanceSqToSegment(p,l,s,n),w>d||(s.applyMatrix4(this.matrixWorld),
  w=g.ray.origin.distanceTo(s),w<g.near||w>g.far||h.push({distance:w,point:n.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else if(f.isGeometry)for(p=f.vertices,l=p.length,f=0;f<l-1;f+=q)w=a.distanceSqToSegment(p[f],p[f+1],s,n),w>d||(s.applyMatrix4(this.matrixWorld),w=g.ray.origin.distanceTo(s),w<g.near||w>g.far||h.push({distance:w,point:n.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,
  this.material)).copy(this)}});ra.prototype=Object.assign(Object.create(ya.prototype),{constructor:ra,isLineSegments:!0,computeLineDistances:function(){var b=new m,a=new m;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var g=c.attributes.position,h=[],d=0,f=g.count;d<f;d+=2)b.fromBufferAttribute(g,d),a.fromBufferAttribute(g,d+1),h[d]=0===d?0:h[d-1],h[d+1]=h[d]+b.distanceTo(a);c.addAttribute("lineDistance",new N(h,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
  else if(c.isGeometry)for(g=c.vertices,h=c.lineDistances,d=0,f=g.length;d<f;d+=2)b.copy(g[d]),a.copy(g[d+1]),h[d]=0===d?0:h[d-1],h[d+1]=h[d]+b.distanceTo(a);return this}}()});ce.prototype=Object.assign(Object.create(ya.prototype),{constructor:ce,isLineLoop:!0});Va.prototype=Object.create(T.prototype);Va.prototype.constructor=Va;Va.prototype.isPointsMaterial=!0;Va.prototype.copy=function(b){T.prototype.copy.call(this,b);this.color.copy(b.color);this.map=b.map;this.size=b.size;this.sizeAttenuation=b.sizeAttenuation;
  this.morphTargets=b.morphTargets;return this};jc.prototype=Object.assign(Object.create(D.prototype),{constructor:jc,isPoints:!0,raycast:function(){var b=new f,a=new fb,c=new C;return function(g,h){function d(b,c){var k=a.distanceSqToPoint(b);if(k<s){a.closestPointToPoint(b,q);q.applyMatrix4(p);var n=g.ray.origin.distanceTo(q);n<g.near||n>g.far||h.push({distance:n,distanceToRay:Math.sqrt(k),point:q.clone(),index:c,face:null,object:f})}}var f=this,n=this.geometry,p=this.matrixWorld,l=g.params.Points.threshold;
  null===n.boundingSphere&&n.computeBoundingSphere();c.copy(n.boundingSphere);c.applyMatrix4(p);c.radius+=l;if(!1!==g.ray.intersectsSphere(c)){b.getInverse(p);a.copy(g.ray).applyMatrix4(b);var l=l/((this.scale.x+this.scale.y+this.scale.z)/3),s=l*l,l=new m,q=new m;if(n.isBufferGeometry){var r=n.index,n=n.attributes.position.array;if(null!==r)for(var t=r.array,r=0,u=t.length;r<u;r++){var w=t[r];l.fromArray(n,3*w);d(l,w)}else for(r=0,t=n.length/3;r<t;r++)l.fromArray(n,3*r),d(l,r)}else for(l=n.vertices,
  r=0,t=l.length;r<t;r++)d(l[r],r)}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});cf.prototype=Object.assign(Object.create(q.prototype),{constructor:cf,isVideoTexture:!0,update:function(){var b=this.image;b.readyState>=b.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});kc.prototype=Object.create(q.prototype);kc.prototype.constructor=kc;kc.prototype.isCompressedTexture=!0;Wc.prototype=Object.create(q.prototype);Wc.prototype.constructor=Wc;Wc.prototype.isCanvasTexture=
  !0;Xc.prototype=Object.create(q.prototype);Xc.prototype.constructor=Xc;Xc.prototype.isDepthTexture=!0;lc.prototype=Object.create(M.prototype);lc.prototype.constructor=lc;Yc.prototype=Object.create(g.prototype);Yc.prototype.constructor=Yc;mc.prototype=Object.create(M.prototype);mc.prototype.constructor=mc;Zc.prototype=Object.create(g.prototype);Zc.prototype.constructor=Zc;Na.prototype=Object.create(M.prototype);Na.prototype.constructor=Na;$c.prototype=Object.create(g.prototype);$c.prototype.constructor=
  $c;nc.prototype=Object.create(Na.prototype);nc.prototype.constructor=nc;ad.prototype=Object.create(g.prototype);ad.prototype.constructor=ad;Db.prototype=Object.create(Na.prototype);Db.prototype.constructor=Db;bd.prototype=Object.create(g.prototype);bd.prototype.constructor=bd;oc.prototype=Object.create(Na.prototype);oc.prototype.constructor=oc;cd.prototype=Object.create(g.prototype);cd.prototype.constructor=cd;pc.prototype=Object.create(Na.prototype);pc.prototype.constructor=pc;dd.prototype=Object.create(g.prototype);
  dd.prototype.constructor=dd;qc.prototype=Object.create(M.prototype);qc.prototype.constructor=qc;ed.prototype=Object.create(g.prototype);ed.prototype.constructor=ed;rc.prototype=Object.create(M.prototype);rc.prototype.constructor=rc;fd.prototype=Object.create(g.prototype);fd.prototype.constructor=fd;sc.prototype=Object.create(M.prototype);sc.prototype.constructor=sc;var Zi={triangulate:function(b,a,c){c=c||2;var g=a&&a.length,h=g?a[0]*c:b.length,d=ph(b,0,h,c,!0),f=[];if(!d)return f;var n,p,m,l;if(g){var s=
  c,g=[],q,r,t;l=0;for(q=a.length;l<q;l++)r=a[l]*s,t=l<q-1?a[l+1]*s:b.length,r=ph(b,r,t,s,!1),r===r.next&&(r.steiner=!0),g.push(Ti(r));g.sort(Ri);for(l=0;l<g.length;l++){a=g[l];s=d;if(s=Si(a,s))a=sh(s,a),hd(a,a.next);d=hd(d,d.next)}}if(b.length>80*c){n=m=b[0];p=g=b[1];for(s=c;s<h;s+=c)l=b[s],a=b[s+1],l<n&&(n=l),a<p&&(p=a),l>m&&(m=l),a>g&&(g=a);m=Math.max(m-n,g-p);m=0!==m?1/m:0}id(d,f,c,n,p,m);return f}},ob={area:function(b){for(var a=b.length,c=0,g=a-1,h=0;h<a;g=h++)c+=b[g].x*b[h].y-b[h].x*b[g].y;return 0.5*
  c},isClockWise:function(b){return 0>ob.area(b)},triangulateShape:function(b,a){var c=[],g=[],h=[];th(b);uh(c,b);var d=b.length;a.forEach(th);for(var f=0;f<a.length;f++)g.push(d),d+=a[f].length,uh(c,a[f]);c=Zi.triangulate(c,g);for(f=0;f<c.length;f+=3)h.push(c.slice(f,f+3));return h}};Fb.prototype=Object.create(g.prototype);Fb.prototype.constructor=Fb;Fb.prototype.toJSON=function(){var b=g.prototype.toJSON.call(this);return vh(this.parameters.shapes,this.parameters.options,b)};ib.prototype=Object.create(M.prototype);
  ib.prototype.constructor=ib;ib.prototype.toJSON=function(){var b=M.prototype.toJSON.call(this);return vh(this.parameters.shapes,this.parameters.options,b)};var Ui={generateTopUV:function(b,a,c,g,h){b=a[3*g];g=a[3*g+1];var f=a[3*h];h=a[3*h+1];return[new d(a[3*c],a[3*c+1]),new d(b,g),new d(f,h)]},generateSideWallUV:function(b,a,c,g,h,f){b=a[3*c];var n=a[3*c+1];c=a[3*c+2];var m=a[3*g],p=a[3*g+1];g=a[3*g+2];var l=a[3*h],s=a[3*h+1];h=a[3*h+2];var q=a[3*f],r=a[3*f+1];a=a[3*f+2];return 0.01>Math.abs(n-p)?
  [new d(b,1-c),new d(m,1-g),new d(l,1-h),new d(q,1-a)]:[new d(n,1-c),new d(p,1-g),new d(s,1-h),new d(r,1-a)]}};kd.prototype=Object.create(g.prototype);kd.prototype.constructor=kd;tc.prototype=Object.create(ib.prototype);tc.prototype.constructor=tc;ld.prototype=Object.create(g.prototype);ld.prototype.constructor=ld;Gb.prototype=Object.create(M.prototype);Gb.prototype.constructor=Gb;md.prototype=Object.create(g.prototype);md.prototype.constructor=md;uc.prototype=Object.create(M.prototype);uc.prototype.constructor=
  uc;nd.prototype=Object.create(g.prototype);nd.prototype.constructor=nd;vc.prototype=Object.create(M.prototype);vc.prototype.constructor=vc;Hb.prototype=Object.create(g.prototype);Hb.prototype.constructor=Hb;Hb.prototype.toJSON=function(){var b=g.prototype.toJSON.call(this);return wh(this.parameters.shapes,b)};Ib.prototype=Object.create(M.prototype);Ib.prototype.constructor=Ib;Ib.prototype.toJSON=function(){var b=M.prototype.toJSON.call(this);return wh(this.parameters.shapes,b)};wc.prototype=Object.create(M.prototype);
  wc.prototype.constructor=wc;Jb.prototype=Object.create(g.prototype);Jb.prototype.constructor=Jb;pb.prototype=Object.create(M.prototype);pb.prototype.constructor=pb;od.prototype=Object.create(Jb.prototype);od.prototype.constructor=od;pd.prototype=Object.create(pb.prototype);pd.prototype.constructor=pd;qd.prototype=Object.create(g.prototype);qd.prototype.constructor=qd;xc.prototype=Object.create(M.prototype);xc.prototype.constructor=xc;var Pa=Object.freeze({WireframeGeometry:lc,ParametricGeometry:Yc,
  ParametricBufferGeometry:mc,TetrahedronGeometry:$c,TetrahedronBufferGeometry:nc,OctahedronGeometry:ad,OctahedronBufferGeometry:Db,IcosahedronGeometry:bd,IcosahedronBufferGeometry:oc,DodecahedronGeometry:cd,DodecahedronBufferGeometry:pc,PolyhedronGeometry:Zc,PolyhedronBufferGeometry:Na,TubeGeometry:dd,TubeBufferGeometry:qc,TorusKnotGeometry:ed,TorusKnotBufferGeometry:rc,TorusGeometry:fd,TorusBufferGeometry:sc,TextGeometry:kd,TextBufferGeometry:tc,SphereGeometry:ld,SphereBufferGeometry:Gb,RingGeometry:md,
  RingBufferGeometry:uc,PlaneGeometry:ja,PlaneBufferGeometry:oa,LatheGeometry:nd,LatheBufferGeometry:vc,ShapeGeometry:Hb,ShapeBufferGeometry:Ib,ExtrudeGeometry:Fb,ExtrudeBufferGeometry:ib,EdgesGeometry:wc,ConeGeometry:od,ConeBufferGeometry:pd,CylinderGeometry:Jb,CylinderBufferGeometry:pb,CircleGeometry:qd,CircleBufferGeometry:xc,BoxGeometry:la,BoxBufferGeometry:G});Kb.prototype=Object.create(T.prototype);Kb.prototype.constructor=Kb;Kb.prototype.isShadowMaterial=!0;Kb.prototype.copy=function(b){T.prototype.copy.call(this,
  b);this.color.copy(b.color);return this};yc.prototype=Object.create(pa.prototype);yc.prototype.constructor=yc;yc.prototype.isRawShaderMaterial=!0;jb.prototype=Object.create(T.prototype);jb.prototype.constructor=jb;jb.prototype.isMeshStandardMaterial=!0;jb.prototype.copy=function(b){T.prototype.copy.call(this,b);this.defines={STANDARD:""};this.color.copy(b.color);this.roughness=b.roughness;this.metalness=b.metalness;this.map=b.map;this.lightMap=b.lightMap;this.lightMapIntensity=b.lightMapIntensity;
  this.aoMap=b.aoMap;this.aoMapIntensity=b.aoMapIntensity;this.emissive.copy(b.emissive);this.emissiveMap=b.emissiveMap;this.emissiveIntensity=b.emissiveIntensity;this.bumpMap=b.bumpMap;this.bumpScale=b.bumpScale;this.normalMap=b.normalMap;this.normalMapType=b.normalMapType;this.normalScale.copy(b.normalScale);this.displacementMap=b.displacementMap;this.displacementScale=b.displacementScale;this.displacementBias=b.displacementBias;this.roughnessMap=b.roughnessMap;this.metalnessMap=b.metalnessMap;this.alphaMap=
  b.alphaMap;this.envMap=b.envMap;this.envMapIntensity=b.envMapIntensity;this.refractionRatio=b.refractionRatio;this.wireframe=b.wireframe;this.wireframeLinewidth=b.wireframeLinewidth;this.wireframeLinecap=b.wireframeLinecap;this.wireframeLinejoin=b.wireframeLinejoin;this.skinning=b.skinning;this.morphTargets=b.morphTargets;this.morphNormals=b.morphNormals;return this};Lb.prototype=Object.create(jb.prototype);Lb.prototype.constructor=Lb;Lb.prototype.isMeshPhysicalMaterial=!0;Lb.prototype.copy=function(b){jb.prototype.copy.call(this,
  b);this.defines={PHYSICAL:""};this.reflectivity=b.reflectivity;this.clearCoat=b.clearCoat;this.clearCoatRoughness=b.clearCoatRoughness;return this};Wa.prototype=Object.create(T.prototype);Wa.prototype.constructor=Wa;Wa.prototype.isMeshPhongMaterial=!0;Wa.prototype.copy=function(b){T.prototype.copy.call(this,b);this.color.copy(b.color);this.specular.copy(b.specular);this.shininess=b.shininess;this.map=b.map;this.lightMap=b.lightMap;this.lightMapIntensity=b.lightMapIntensity;this.aoMap=b.aoMap;this.aoMapIntensity=
  b.aoMapIntensity;this.emissive.copy(b.emissive);this.emissiveMap=b.emissiveMap;this.emissiveIntensity=b.emissiveIntensity;this.bumpMap=b.bumpMap;this.bumpScale=b.bumpScale;this.normalMap=b.normalMap;this.normalMapType=b.normalMapType;this.normalScale.copy(b.normalScale);this.displacementMap=b.displacementMap;this.displacementScale=b.displacementScale;this.displacementBias=b.displacementBias;this.specularMap=b.specularMap;this.alphaMap=b.alphaMap;this.envMap=b.envMap;this.combine=b.combine;this.reflectivity=
  b.reflectivity;this.refractionRatio=b.refractionRatio;this.wireframe=b.wireframe;this.wireframeLinewidth=b.wireframeLinewidth;this.wireframeLinecap=b.wireframeLinecap;this.wireframeLinejoin=b.wireframeLinejoin;this.skinning=b.skinning;this.morphTargets=b.morphTargets;this.morphNormals=b.morphNormals;return this};Mb.prototype=Object.create(Wa.prototype);Mb.prototype.constructor=Mb;Mb.prototype.isMeshToonMaterial=!0;Mb.prototype.copy=function(b){Wa.prototype.copy.call(this,b);this.gradientMap=b.gradientMap;
  return this};Nb.prototype=Object.create(T.prototype);Nb.prototype.constructor=Nb;Nb.prototype.isMeshNormalMaterial=!0;Nb.prototype.copy=function(b){T.prototype.copy.call(this,b);this.bumpMap=b.bumpMap;this.bumpScale=b.bumpScale;this.normalMap=b.normalMap;this.normalMapType=b.normalMapType;this.normalScale.copy(b.normalScale);this.displacementMap=b.displacementMap;this.displacementScale=b.displacementScale;this.displacementBias=b.displacementBias;this.wireframe=b.wireframe;this.wireframeLinewidth=
  b.wireframeLinewidth;this.skinning=b.skinning;this.morphTargets=b.morphTargets;this.morphNormals=b.morphNormals;return this};Ob.prototype=Object.create(T.prototype);Ob.prototype.constructor=Ob;Ob.prototype.isMeshLambertMaterial=!0;Ob.prototype.copy=function(b){T.prototype.copy.call(this,b);this.color.copy(b.color);this.map=b.map;this.lightMap=b.lightMap;this.lightMapIntensity=b.lightMapIntensity;this.aoMap=b.aoMap;this.aoMapIntensity=b.aoMapIntensity;this.emissive.copy(b.emissive);this.emissiveMap=
  b.emissiveMap;this.emissiveIntensity=b.emissiveIntensity;this.specularMap=b.specularMap;this.alphaMap=b.alphaMap;this.envMap=b.envMap;this.combine=b.combine;this.reflectivity=b.reflectivity;this.refractionRatio=b.refractionRatio;this.wireframe=b.wireframe;this.wireframeLinewidth=b.wireframeLinewidth;this.wireframeLinecap=b.wireframeLinecap;this.wireframeLinejoin=b.wireframeLinejoin;this.skinning=b.skinning;this.morphTargets=b.morphTargets;this.morphNormals=b.morphNormals;return this};Pb.prototype=
  Object.create(T.prototype);Pb.prototype.constructor=Pb;Pb.prototype.isMeshMatcapMaterial=!0;Pb.prototype.copy=function(b){T.prototype.copy.call(this,b);this.defines={MATCAP:""};this.color.copy(b.color);this.matcap=b.matcap;this.map=b.map;this.bumpMap=b.bumpMap;this.bumpScale=b.bumpScale;this.normalMap=b.normalMap;this.normalMapType=b.normalMapType;this.normalScale.copy(b.normalScale);this.displacementMap=b.displacementMap;this.displacementScale=b.displacementScale;this.displacementBias=b.displacementBias;
  this.alphaMap=b.alphaMap;this.skinning=b.skinning;this.morphTargets=b.morphTargets;this.morphNormals=b.morphNormals;return this};Qb.prototype=Object.create(na.prototype);Qb.prototype.constructor=Qb;Qb.prototype.isLineDashedMaterial=!0;Qb.prototype.copy=function(b){na.prototype.copy.call(this,b);this.scale=b.scale;this.dashSize=b.dashSize;this.gapSize=b.gapSize;return this};var $i=Object.freeze({ShadowMaterial:Kb,SpriteMaterial:wb,RawShaderMaterial:yc,ShaderMaterial:pa,PointsMaterial:Va,MeshPhysicalMaterial:Lb,
  MeshStandardMaterial:jb,MeshPhongMaterial:Wa,MeshToonMaterial:Mb,MeshNormalMaterial:Nb,MeshLambertMaterial:Ob,MeshDepthMaterial:tb,MeshDistanceMaterial:ub,MeshBasicMaterial:Ba,MeshMatcapMaterial:Pb,LineDashedMaterial:Qb,LineBasicMaterial:na,Material:T}),Wb={enabled:!1,files:{},add:function(b,a){!1!==this.enabled&&(this.files[b]=a)},get:function(b){if(!1!==this.enabled)return this.files[b]},remove:function(b){delete this.files[b]},clear:function(){this.files={}}},Ja=new ff,cb={};Object.assign(Xa.prototype,
  {load:function(b,a,c,g){void 0===b&&(b="");void 0!==this.path&&(b=this.path+b);b=this.manager.resolveURL(b);var h=this,d=Wb.get(b);if(void 0!==d)return h.manager.itemStart(b),setTimeout(function(){a&&a(d);h.manager.itemEnd(b)},0),d;if(void 0!==cb[b])cb[b].push({onLoad:a,onProgress:c,onError:g});else{var f=b.match(/^data:(.*?)(;base64)?,(.*)$/);if(f){c=f[1];var n=!!f[2],f=f[3],f=window.decodeURIComponent(f);n&&(f=window.atob(f));try{var p,m=(this.responseType||"").toLowerCase();switch(m){case "arraybuffer":case "blob":for(var l=
  new Uint8Array(f.length),n=0;n<f.length;n++)l[n]=f.charCodeAt(n);p="blob"===m?new Blob([l.buffer],{type:c}):l.buffer;break;case "document":p=(new DOMParser).parseFromString(f,c);break;case "json":p=JSON.parse(f);break;default:p=f}window.setTimeout(function(){a&&a(p);h.manager.itemEnd(b)},0)}catch(s){window.setTimeout(function(){g&&g(s);h.manager.itemEnd(b);h.manager.itemError(b)},0)}}else{cb[b]=[];cb[b].push({onLoad:a,onProgress:c,onError:g});var q=new XMLHttpRequest;q.open("GET",b,!0);q.addEventListener("load",
  function(a){var e=this.response;Wb.add(b,e);var c=cb[b];delete cb[b];if(200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var g=0,k=c.length;g<k;g++){var d=c[g];if(d.onLoad)d.onLoad(e)}h.manager.itemEnd(b)}else{g=0;for(k=c.length;g<k;g++)if(d=c[g],d.onError)d.onError(a);h.manager.itemEnd(b);h.manager.itemError(b)}},!1);q.addEventListener("progress",function(a){for(var e=cb[b],c=0,g=e.length;c<g;c++){var h=e[c];if(h.onProgress)h.onProgress(a)}},
  !1);q.addEventListener("error",function(a){var e=cb[b];delete cb[b];for(var c=0,g=e.length;c<g;c++){var k=e[c];if(k.onError)k.onError(a)}h.manager.itemEnd(b);h.manager.itemError(b)},!1);q.addEventListener("abort",function(a){var e=cb[b];delete cb[b];for(var c=0,g=e.length;c<g;c++){var k=e[c];if(k.onError)k.onError(a)}h.manager.itemEnd(b);h.manager.itemError(b)},!1);void 0!==this.responseType&&(q.responseType=this.responseType);void 0!==this.withCredentials&&(q.withCredentials=this.withCredentials);
  q.overrideMimeType&&q.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(n in this.requestHeader)q.setRequestHeader(n,this.requestHeader[n]);q.send(null)}h.manager.itemStart(b);return q}},setPath:function(b){this.path=b;return this},setResponseType:function(b){this.responseType=b;return this},setWithCredentials:function(b){this.withCredentials=b;return this},setMimeType:function(b){this.mimeType=b;return this},setRequestHeader:function(b){this.requestHeader=b;return this}});Object.assign(xh.prototype,
  {load:function(b,a,c,g){function h(h){p.load(b[h],function(b){b=d._parser(b,!0);f[h]={width:b.width,height:b.height,format:b.format,mipmaps:b.mipmaps};m+=1;6===m&&(1===b.mipmapCount&&(n.minFilter=Ka),n.format=b.format,n.needsUpdate=!0,a&&a(n))},c,g)}var d=this,f=[],n=new kc;n.image=f;var p=new Xa(this.manager);p.setPath(this.path);p.setResponseType("arraybuffer");if(Array.isArray(b))for(var m=0,l=0,s=b.length;l<s;++l)h(l);else p.load(b,function(b){b=d._parser(b,!0);if(b.isCubemap)for(var c=b.mipmaps.length/
  b.mipmapCount,g=0;g<c;g++){f[g]={mipmaps:[]};for(var h=0;h<b.mipmapCount;h++)f[g].mipmaps.push(b.mipmaps[g*b.mipmapCount+h]),f[g].format=b.format,f[g].width=b.width,f[g].height=b.height}else n.image.width=b.width,n.image.height=b.height,n.mipmaps=b.mipmaps;1===b.mipmapCount&&(n.minFilter=Ka);n.format=b.format;n.needsUpdate=!0;a&&a(n)},c,g);return n},setPath:function(b){this.path=b;return this}});Object.assign(gf.prototype,{load:function(b,a,c,g){var h=this,d=new A,f=new Xa(this.manager);f.setResponseType("arraybuffer");
  f.load(b,function(b){if(b=h._parser(b))void 0!==b.image?d.image=b.image:void 0!==b.data&&(d.image.width=b.width,d.image.height=b.height,d.image.data=b.data),d.wrapS=void 0!==b.wrapS?b.wrapS:Qa,d.wrapT=void 0!==b.wrapT?b.wrapT:Qa,d.magFilter=void 0!==b.magFilter?b.magFilter:Ka,d.minFilter=void 0!==b.minFilter?b.minFilter:Kc,d.anisotropy=void 0!==b.anisotropy?b.anisotropy:1,void 0!==b.format&&(d.format=b.format),void 0!==b.type&&(d.type=b.type),void 0!==b.mipmaps&&(d.mipmaps=b.mipmaps),1===b.mipmapCount&&
  (d.minFilter=Ka),d.needsUpdate=!0,a&&a(d,b)},c,g);return d}});Object.assign(sd.prototype,{crossOrigin:"anonymous",load:function(b,a,c,g){function h(){p.removeEventListener("load",h,!1);p.removeEventListener("error",d,!1);Wb.add(b,this);a&&a(this);f.manager.itemEnd(b)}function d(a){p.removeEventListener("load",h,!1);p.removeEventListener("error",d,!1);g&&g(a);f.manager.itemEnd(b);f.manager.itemError(b)}void 0===b&&(b="");void 0!==this.path&&(b=this.path+b);b=this.manager.resolveURL(b);var f=this,n=
  Wb.get(b);if(void 0!==n)return f.manager.itemStart(b),setTimeout(function(){a&&a(n);f.manager.itemEnd(b)},0),n;var p=document.createElementNS("http://www.w3.org/1999/xhtml","img");p.addEventListener("load",h,!1);p.addEventListener("error",d,!1);"data:"!==b.substr(0,5)&&void 0!==this.crossOrigin&&(p.crossOrigin=this.crossOrigin);f.manager.itemStart(b);p.src=b;return p},setCrossOrigin:function(b){this.crossOrigin=b;return this},setPath:function(b){this.path=b;return this}});Object.assign(hf.prototype,
  {crossOrigin:"anonymous",load:function(b,a,c,g){function h(c){f.load(b[c],function(b){d.images[c]=b;n++;6===n&&(d.needsUpdate=!0,a&&a(d))},void 0,g)}var d=new mb,f=new sd(this.manager);f.setCrossOrigin(this.crossOrigin);f.setPath(this.path);var n=0;for(c=0;c<b.length;++c)h(c);return d},setCrossOrigin:function(b){this.crossOrigin=b;return this},setPath:function(b){this.path=b;return this}});Object.assign(ee.prototype,{crossOrigin:"anonymous",load:function(b,a,c,g){var h=new q,d=new sd(this.manager);
  d.setCrossOrigin(this.crossOrigin);d.setPath(this.path);d.load(b,function(c){h.image=c;c=0<b.search(/\.jpe?g$/i)||0===b.search(/^data\:image\/jpeg/);h.format=c?dc:db;h.needsUpdate=!0;void 0!==a&&a(h)},c,g);return h},setCrossOrigin:function(b){this.crossOrigin=b;return this},setPath:function(b){this.path=b;return this}});Object.assign(X.prototype,{getPoint:function(){console.warn("THREE.Curve: .getPoint() not implemented.");return null},getPointAt:function(b,a){var c=this.getUtoTmapping(b);return this.getPoint(c,
  a)},getPoints:function(b){void 0===b&&(b=5);for(var a=[],c=0;c<=b;c++)a.push(this.getPoint(c/b));return a},getSpacedPoints:function(b){void 0===b&&(b=5);for(var a=[],c=0;c<=b;c++)a.push(this.getPointAt(c/b));return a},getLength:function(){var b=this.getLengths();return b[b.length-1]},getLengths:function(b){void 0===b&&(b=this.arcLengthDivisions);if(this.cacheArcLengths&&this.cacheArcLengths.length===b+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var a=[],c,g=this.getPoint(0),
  h,d=0;a.push(0);for(h=1;h<=b;h++)c=this.getPoint(h/b),d+=c.distanceTo(g),a.push(d),g=c;return this.cacheArcLengths=a},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(b,a){var c=this.getLengths(),g=0,h=c.length,d;d=a?a:b*c[h-1];for(var f=0,n=h-1,p;f<=n;)if(g=Math.floor(f+(n-f)/2),p=c[g]-d,0>p)f=g+1;else if(0<p)n=g-1;else{n=g;break}g=n;if(c[g]===d)return g/(h-1);f=c[g];return(g+(d-f)/(c[g+1]-f))/(h-1)},getTangent:function(b){var a=b-1E-4;b+=1E-4;0>a&&(a=0);
  1<b&&(b=1);a=this.getPoint(a);return this.getPoint(b).clone().sub(a).normalize()},getTangentAt:function(b){b=this.getUtoTmapping(b);return this.getTangent(b)},computeFrenetFrames:function(b,a){var c=new m,g=[],h=[],d=[],n=new m,l=new f,p,s;for(p=0;p<=b;p++)s=p/b,g[p]=this.getTangentAt(s),g[p].normalize();h[0]=new m;d[0]=new m;p=Number.MAX_VALUE;s=Math.abs(g[0].x);var q=Math.abs(g[0].y),r=Math.abs(g[0].z);s<=p&&(p=s,c.set(1,0,0));q<=p&&(p=q,c.set(0,1,0));r<=p&&c.set(0,0,1);n.crossVectors(g[0],c).normalize();
  h[0].crossVectors(g[0],n);d[0].crossVectors(g[0],h[0]);for(p=1;p<=b;p++)h[p]=h[p-1].clone(),d[p]=d[p-1].clone(),n.crossVectors(g[p-1],g[p]),n.length()>Number.EPSILON&&(n.normalize(),c=Math.acos(ga.clamp(g[p-1].dot(g[p]),-1,1)),h[p].applyMatrix4(l.makeRotationAxis(n,c))),d[p].crossVectors(g[p],h[p]);if(!0===a)for(c=Math.acos(ga.clamp(h[0].dot(h[b]),-1,1)),c/=b,0<g[0].dot(n.crossVectors(h[0],h[b]))&&(c=-c),p=1;p<=b;p++)h[p].applyMatrix4(l.makeRotationAxis(g[p],c*p)),d[p].crossVectors(g[p],h[p]);return{tangents:g,
  normals:h,binormals:d}},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.arcLengthDivisions=b.arcLengthDivisions;return this},toJSON:function(){var b={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};b.arcLengthDivisions=this.arcLengthDivisions;b.type=this.type;return b},fromJSON:function(b){this.arcLengthDivisions=b.arcLengthDivisions;return this}});Ra.prototype=Object.create(X.prototype);Ra.prototype.constructor=Ra;Ra.prototype.isEllipseCurve=!0;Ra.prototype.getPoint=
  function(b,a){for(var c=a||new d,g=2*Math.PI,h=this.aEndAngle-this.aStartAngle,f=Math.abs(h)<Number.EPSILON;0>h;)h+=g;for(;h>g;)h-=g;h<Number.EPSILON&&(h=f?0:g);!0!==this.aClockwise||f||(h=h===g?-g:h-g);var h=this.aStartAngle+b*h,g=this.aX+this.xRadius*Math.cos(h),n=this.aY+this.yRadius*Math.sin(h);if(0!==this.aRotation)var h=Math.cos(this.aRotation),f=Math.sin(this.aRotation),m=g-this.aX,n=n-this.aY,g=m*h-n*f+this.aX,n=m*f+n*h+this.aY;return c.set(g,n)};Ra.prototype.copy=function(b){X.prototype.copy.call(this,
  b);this.aX=b.aX;this.aY=b.aY;this.xRadius=b.xRadius;this.yRadius=b.yRadius;this.aStartAngle=b.aStartAngle;this.aEndAngle=b.aEndAngle;this.aClockwise=b.aClockwise;this.aRotation=b.aRotation;return this};Ra.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.aX=this.aX;b.aY=this.aY;b.xRadius=this.xRadius;b.yRadius=this.yRadius;b.aStartAngle=this.aStartAngle;b.aEndAngle=this.aEndAngle;b.aClockwise=this.aClockwise;b.aRotation=this.aRotation;return b};Ra.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,
  b);this.aX=b.aX;this.aY=b.aY;this.xRadius=b.xRadius;this.yRadius=b.yRadius;this.aStartAngle=b.aStartAngle;this.aEndAngle=b.aEndAngle;this.aClockwise=b.aClockwise;this.aRotation=b.aRotation;return this};zc.prototype=Object.create(Ra.prototype);zc.prototype.constructor=zc;zc.prototype.isArcCurve=!0;var xe=new m,Ff=new jf,Gf=new jf,Hf=new jf;Ea.prototype=Object.create(X.prototype);Ea.prototype.constructor=Ea;Ea.prototype.isCatmullRomCurve3=!0;Ea.prototype.getPoint=function(b,a){var c=a||new m,g=this.points,
  h=g.length,d=(h-(this.closed?0:1))*b,f=Math.floor(d),d=d-f;this.closed?f+=0<f?0:(Math.floor(Math.abs(f)/h)+1)*h:0===d&&f===h-1&&(f=h-2,d=1);var n,p,l;this.closed||0<f?n=g[(f-1)%h]:(xe.subVectors(g[0],g[1]).add(g[0]),n=xe);p=g[f%h];l=g[(f+1)%h];this.closed||f+2<h?g=g[(f+2)%h]:(xe.subVectors(g[h-1],g[h-2]).add(g[h-1]),g=xe);if("centripetal"===this.curveType||"chordal"===this.curveType){var s="chordal"===this.curveType?0.5:0.25,h=Math.pow(n.distanceToSquared(p),s),f=Math.pow(p.distanceToSquared(l),s),
  s=Math.pow(l.distanceToSquared(g),s);1E-4>f&&(f=1);1E-4>h&&(h=f);1E-4>s&&(s=f);Ff.initNonuniformCatmullRom(n.x,p.x,l.x,g.x,h,f,s);Gf.initNonuniformCatmullRom(n.y,p.y,l.y,g.y,h,f,s);Hf.initNonuniformCatmullRom(n.z,p.z,l.z,g.z,h,f,s)}else"catmullrom"===this.curveType&&(Ff.initCatmullRom(n.x,p.x,l.x,g.x,this.tension),Gf.initCatmullRom(n.y,p.y,l.y,g.y,this.tension),Hf.initCatmullRom(n.z,p.z,l.z,g.z,this.tension));c.set(Ff.calc(d),Gf.calc(d),Hf.calc(d));return c};Ea.prototype.copy=function(b){X.prototype.copy.call(this,
  b);this.points=[];for(var a=0,c=b.points.length;a<c;a++)this.points.push(b.points[a].clone());this.closed=b.closed;this.curveType=b.curveType;this.tension=b.tension;return this};Ea.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.points=[];for(var a=0,c=this.points.length;a<c;a++)b.points.push(this.points[a].toArray());b.closed=this.closed;b.curveType=this.curveType;b.tension=this.tension;return b};Ea.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,b);this.points=[];
  for(var a=0,c=b.points.length;a<c;a++){var g=b.points[a];this.points.push((new m).fromArray(g))}this.closed=b.closed;this.curveType=b.curveType;this.tension=b.tension;return this};Ya.prototype=Object.create(X.prototype);Ya.prototype.constructor=Ya;Ya.prototype.isCubicBezierCurve=!0;Ya.prototype.getPoint=function(b,a){var c=a||new d,g=this.v0,h=this.v1,f=this.v2,n=this.v3;c.set(ud(b,g.x,h.x,f.x,n.x),ud(b,g.y,h.y,f.y,n.y));return c};Ya.prototype.copy=function(b){X.prototype.copy.call(this,b);this.v0.copy(b.v0);
  this.v1.copy(b.v1);this.v2.copy(b.v2);this.v3.copy(b.v3);return this};Ya.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.v0=this.v0.toArray();b.v1=this.v1.toArray();b.v2=this.v2.toArray();b.v3=this.v3.toArray();return b};Ya.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,b);this.v0.fromArray(b.v0);this.v1.fromArray(b.v1);this.v2.fromArray(b.v2);this.v3.fromArray(b.v3);return this};kb.prototype=Object.create(X.prototype);kb.prototype.constructor=kb;kb.prototype.isCubicBezierCurve3=
  !0;kb.prototype.getPoint=function(b,a){var c=a||new m,g=this.v0,h=this.v1,d=this.v2,f=this.v3;c.set(ud(b,g.x,h.x,d.x,f.x),ud(b,g.y,h.y,d.y,f.y),ud(b,g.z,h.z,d.z,f.z));return c};kb.prototype.copy=function(b){X.prototype.copy.call(this,b);this.v0.copy(b.v0);this.v1.copy(b.v1);this.v2.copy(b.v2);this.v3.copy(b.v3);return this};kb.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.v0=this.v0.toArray();b.v1=this.v1.toArray();b.v2=this.v2.toArray();b.v3=this.v3.toArray();return b};kb.prototype.fromJSON=
  function(b){X.prototype.fromJSON.call(this,b);this.v0.fromArray(b.v0);this.v1.fromArray(b.v1);this.v2.fromArray(b.v2);this.v3.fromArray(b.v3);return this};Fa.prototype=Object.create(X.prototype);Fa.prototype.constructor=Fa;Fa.prototype.isLineCurve=!0;Fa.prototype.getPoint=function(b,a){var c=a||new d;1===b?c.copy(this.v2):(c.copy(this.v2).sub(this.v1),c.multiplyScalar(b).add(this.v1));return c};Fa.prototype.getPointAt=function(b,a){return this.getPoint(b,a)};Fa.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};
  Fa.prototype.copy=function(b){X.prototype.copy.call(this,b);this.v1.copy(b.v1);this.v2.copy(b.v2);return this};Fa.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.v1=this.v1.toArray();b.v2=this.v2.toArray();return b};Fa.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,b);this.v1.fromArray(b.v1);this.v2.fromArray(b.v2);return this};Za.prototype=Object.create(X.prototype);Za.prototype.constructor=Za;Za.prototype.isLineCurve3=!0;Za.prototype.getPoint=function(b,a){var c=
  a||new m;1===b?c.copy(this.v2):(c.copy(this.v2).sub(this.v1),c.multiplyScalar(b).add(this.v1));return c};Za.prototype.getPointAt=function(b,a){return this.getPoint(b,a)};Za.prototype.copy=function(b){X.prototype.copy.call(this,b);this.v1.copy(b.v1);this.v2.copy(b.v2);return this};Za.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.v1=this.v1.toArray();b.v2=this.v2.toArray();return b};Za.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,b);this.v1.fromArray(b.v1);this.v2.fromArray(b.v2);
  return this};$a.prototype=Object.create(X.prototype);$a.prototype.constructor=$a;$a.prototype.isQuadraticBezierCurve=!0;$a.prototype.getPoint=function(b,a){var c=a||new d,g=this.v0,h=this.v1,f=this.v2;c.set(td(b,g.x,h.x,f.x),td(b,g.y,h.y,f.y));return c};$a.prototype.copy=function(b){X.prototype.copy.call(this,b);this.v0.copy(b.v0);this.v1.copy(b.v1);this.v2.copy(b.v2);return this};$a.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.v0=this.v0.toArray();b.v1=this.v1.toArray();b.v2=
  this.v2.toArray();return b};$a.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,b);this.v0.fromArray(b.v0);this.v1.fromArray(b.v1);this.v2.fromArray(b.v2);return this};lb.prototype=Object.create(X.prototype);lb.prototype.constructor=lb;lb.prototype.isQuadraticBezierCurve3=!0;lb.prototype.getPoint=function(b,a){var c=a||new m,g=this.v0,h=this.v1,d=this.v2;c.set(td(b,g.x,h.x,d.x),td(b,g.y,h.y,d.y),td(b,g.z,h.z,d.z));return c};lb.prototype.copy=function(b){X.prototype.copy.call(this,b);
  this.v0.copy(b.v0);this.v1.copy(b.v1);this.v2.copy(b.v2);return this};lb.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.v0=this.v0.toArray();b.v1=this.v1.toArray();b.v2=this.v2.toArray();return b};lb.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,b);this.v0.fromArray(b.v0);this.v1.fromArray(b.v1);this.v2.fromArray(b.v2);return this};ab.prototype=Object.create(X.prototype);ab.prototype.constructor=ab;ab.prototype.isSplineCurve=!0;ab.prototype.getPoint=function(b,a){var c=
  a||new d,g=this.points,h=(g.length-1)*b,f=Math.floor(h),h=h-f,n=g[0===f?f:f-1],m=g[f],p=g[f>g.length-2?g.length-1:f+1],g=g[f>g.length-3?g.length-1:f+2];c.set(yh(h,n.x,m.x,p.x,g.x),yh(h,n.y,m.y,p.y,g.y));return c};ab.prototype.copy=function(b){X.prototype.copy.call(this,b);this.points=[];for(var a=0,c=b.points.length;a<c;a++)this.points.push(b.points[a].clone());return this};ab.prototype.toJSON=function(){var b=X.prototype.toJSON.call(this);b.points=[];for(var a=0,c=this.points.length;a<c;a++)b.points.push(this.points[a].toArray());
  return b};ab.prototype.fromJSON=function(b){X.prototype.fromJSON.call(this,b);this.points=[];for(var a=0,c=b.points.length;a<c;a++){var g=b.points[a];this.points.push((new d).fromArray(g))}return this};var Oh=Object.freeze({ArcCurve:zc,CatmullRomCurve3:Ea,CubicBezierCurve:Ya,CubicBezierCurve3:kb,EllipseCurve:Ra,LineCurve:Fa,LineCurve3:Za,QuadraticBezierCurve:$a,QuadraticBezierCurve3:lb,SplineCurve:ab});qb.prototype=Object.assign(Object.create(X.prototype),{constructor:qb,add:function(b){this.curves.push(b)},
  closePath:function(){var b=this.curves[0].getPoint(0),a=this.curves[this.curves.length-1].getPoint(1);b.equals(a)||this.curves.push(new Fa(a,b))},getPoint:function(b){var a=b*this.getLength(),c=this.getCurveLengths();for(b=0;b<c.length;){if(c[b]>=a)return a=c[b]-a,b=this.curves[b],c=b.getLength(),b.getPointAt(0===c?0:1-a/c);b++}return null},getLength:function(){var b=this.getCurveLengths();return b[b.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},
  getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var b=[],a=0,c=0,g=this.curves.length;c<g;c++)a+=this.curves[c].getLength(),b.push(a);return this.cacheLengths=b},getSpacedPoints:function(b){void 0===b&&(b=40);for(var a=[],c=0;c<=b;c++)a.push(this.getPoint(c/b));this.autoClose&&a.push(a[0]);return a},getPoints:function(b){b=b||12;for(var a=[],c,g=0,h=this.curves;g<h.length;g++)for(var d=h[g],d=d.getPoints(d&&d.isEllipseCurve?
  2*b:d&&(d.isLineCurve||d.isLineCurve3)?1:d&&d.isSplineCurve?b*d.points.length:b),f=0;f<d.length;f++){var n=d[f];c&&c.equals(n)||(a.push(n),c=n)}this.autoClose&&1<a.length&&!a[a.length-1].equals(a[0])&&a.push(a[0]);return a},copy:function(b){X.prototype.copy.call(this,b);this.curves=[];for(var a=0,c=b.curves.length;a<c;a++)this.curves.push(b.curves[a].clone());this.autoClose=b.autoClose;return this},toJSON:function(){var b=X.prototype.toJSON.call(this);b.autoClose=this.autoClose;b.curves=[];for(var a=
  0,c=this.curves.length;a<c;a++)b.curves.push(this.curves[a].toJSON());return b},fromJSON:function(b){X.prototype.fromJSON.call(this,b);this.autoClose=b.autoClose;this.curves=[];for(var a=0,c=b.curves.length;a<c;a++){var g=b.curves[a];this.curves.push((new Oh[g.type]).fromJSON(g))}return this}});bb.prototype=Object.assign(Object.create(qb.prototype),{constructor:bb,setFromPoints:function(b){this.moveTo(b[0].x,b[0].y);for(var a=1,c=b.length;a<c;a++)this.lineTo(b[a].x,b[a].y)},moveTo:function(b,a){this.currentPoint.set(b,
  a)},lineTo:function(b,a){var c=new Fa(this.currentPoint.clone(),new d(b,a));this.curves.push(c);this.currentPoint.set(b,a)},quadraticCurveTo:function(b,a,c,g){b=new $a(this.currentPoint.clone(),new d(b,a),new d(c,g));this.curves.push(b);this.currentPoint.set(c,g)},bezierCurveTo:function(b,a,c,g,h,f){b=new Ya(this.currentPoint.clone(),new d(b,a),new d(c,g),new d(h,f));this.curves.push(b);this.currentPoint.set(h,f)},splineThru:function(b){var a=[this.currentPoint.clone()].concat(b),a=new ab(a);this.curves.push(a);
  this.currentPoint.copy(b[b.length-1])},arc:function(b,a,c,g,h,d){this.absarc(b+this.currentPoint.x,a+this.currentPoint.y,c,g,h,d)},absarc:function(b,a,c,g,h,d){this.absellipse(b,a,c,c,g,h,d)},ellipse:function(b,a,c,g,h,d,f,n){this.absellipse(b+this.currentPoint.x,a+this.currentPoint.y,c,g,h,d,f,n)},absellipse:function(b,a,c,g,h,d,f,n){b=new Ra(b,a,c,g,h,d,f,n);0<this.curves.length&&(a=b.getPoint(0),a.equals(this.currentPoint)||this.lineTo(a.x,a.y));this.curves.push(b);b=b.getPoint(1);this.currentPoint.copy(b)},
  copy:function(b){qb.prototype.copy.call(this,b);this.currentPoint.copy(b.currentPoint);return this},toJSON:function(){var b=qb.prototype.toJSON.call(this);b.currentPoint=this.currentPoint.toArray();return b},fromJSON:function(b){qb.prototype.fromJSON.call(this,b);this.currentPoint.fromArray(b.currentPoint);return this}});xb.prototype=Object.assign(Object.create(bb.prototype),{constructor:xb,getPointsHoles:function(b){for(var a=[],c=0,g=this.holes.length;c<g;c++)a[c]=this.holes[c].getPoints(b);return a},
  extractPoints:function(b){return{shape:this.getPoints(b),holes:this.getPointsHoles(b)}},copy:function(b){bb.prototype.copy.call(this,b);this.holes=[];for(var a=0,c=b.holes.length;a<c;a++)this.holes.push(b.holes[a].clone());return this},toJSON:function(){var b=bb.prototype.toJSON.call(this);b.uuid=this.uuid;b.holes=[];for(var a=0,c=this.holes.length;a<c;a++)b.holes.push(this.holes[a].toJSON());return b},fromJSON:function(b){bb.prototype.fromJSON.call(this,b);this.uuid=b.uuid;this.holes=[];for(var a=
  0,c=b.holes.length;a<c;a++){var g=b.holes[a];this.holes.push((new bb).fromJSON(g))}return this}});za.prototype=Object.assign(Object.create(D.prototype),{constructor:za,isLight:!0,copy:function(b){D.prototype.copy.call(this,b);this.color.copy(b.color);this.intensity=b.intensity;return this},toJSON:function(b){b=D.prototype.toJSON.call(this,b);b.object.color=this.color.getHex();b.object.intensity=this.intensity;void 0!==this.groundColor&&(b.object.groundColor=this.groundColor.getHex());void 0!==this.distance&&
  (b.object.distance=this.distance);void 0!==this.angle&&(b.object.angle=this.angle);void 0!==this.decay&&(b.object.decay=this.decay);void 0!==this.penumbra&&(b.object.penumbra=this.penumbra);void 0!==this.shadow&&(b.object.shadow=this.shadow.toJSON());return b}});fe.prototype=Object.assign(Object.create(za.prototype),{constructor:fe,isHemisphereLight:!0,copy:function(b){za.prototype.copy.call(this,b);this.groundColor.copy(b.groundColor);return this}});Object.assign(Rb.prototype,{copy:function(b){this.camera=
  b.camera.clone();this.bias=b.bias;this.radius=b.radius;this.mapSize.copy(b.mapSize);return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var b={};0!==this.bias&&(b.bias=this.bias);1!==this.radius&&(b.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)b.mapSize=this.mapSize.toArray();b.camera=this.camera.toJSON(!1).object;delete b.camera.matrix;return b}});ge.prototype=Object.assign(Object.create(Rb.prototype),{constructor:ge,isSpotLightShadow:!0,
  update:function(b){var a=this.camera,c=2*ga.RAD2DEG*b.angle,g=this.mapSize.width/this.mapSize.height;b=b.distance||a.far;if(c!==a.fov||g!==a.aspect||b!==a.far)a.fov=c,a.aspect=g,a.far=b,a.updateProjectionMatrix()}});he.prototype=Object.assign(Object.create(za.prototype),{constructor:he,isSpotLight:!0,copy:function(b){za.prototype.copy.call(this,b);this.distance=b.distance;this.angle=b.angle;this.penumbra=b.penumbra;this.decay=b.decay;this.target=b.target.clone();this.shadow=b.shadow.clone();return this}});
  ie.prototype=Object.assign(Object.create(za.prototype),{constructor:ie,isPointLight:!0,copy:function(b){za.prototype.copy.call(this,b);this.distance=b.distance;this.decay=b.decay;this.shadow=b.shadow.clone();return this}});vd.prototype=Object.assign(Object.create(hb.prototype),{constructor:vd,isOrthographicCamera:!0,copy:function(b,a){hb.prototype.copy.call(this,b,a);this.left=b.left;this.right=b.right;this.top=b.top;this.bottom=b.bottom;this.near=b.near;this.far=b.far;this.zoom=b.zoom;this.view=
  null===b.view?null:Object.assign({},b.view);return this},setViewOffset:function(b,a,c,g,h,d){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1});this.view.enabled=!0;this.view.fullWidth=b;this.view.fullHeight=a;this.view.offsetX=c;this.view.offsetY=g;this.view.width=h;this.view.height=d;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var b=
  (this.right-this.left)/(2*this.zoom),a=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,g=(this.top+this.bottom)/2,d=c-b,c=c+b,b=g+a,a=g-a;if(null!==this.view&&this.view.enabled)var c=this.zoom/(this.view.width/this.view.fullWidth),a=this.zoom/(this.view.height/this.view.fullHeight),f=(this.right-this.left)/this.view.width,g=(this.top-this.bottom)/this.view.height,d=d+this.view.offsetX/c*f,c=d+this.view.width/c*f,b=b-this.view.offsetY/a*g,a=b-this.view.height/a*g;this.projectionMatrix.makeOrthographic(d,
  c,b,a,this.near,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(b){b=D.prototype.toJSON.call(this,b);b.object.zoom=this.zoom;b.object.left=this.left;b.object.right=this.right;b.object.top=this.top;b.object.bottom=this.bottom;b.object.near=this.near;b.object.far=this.far;null!==this.view&&(b.object.view=Object.assign({},this.view));return b}});je.prototype=Object.assign(Object.create(Rb.prototype),{constructor:je});ke.prototype=Object.assign(Object.create(za.prototype),
  {constructor:ke,isDirectionalLight:!0,copy:function(b){za.prototype.copy.call(this,b);this.target=b.target.clone();this.shadow=b.shadow.clone();return this}});le.prototype=Object.assign(Object.create(za.prototype),{constructor:le,isAmbientLight:!0});me.prototype=Object.assign(Object.create(za.prototype),{constructor:me,isRectAreaLight:!0,copy:function(b){za.prototype.copy.call(this,b);this.width=b.width;this.height=b.height;return this},toJSON:function(b){b=za.prototype.toJSON.call(this,b);b.object.width=
  this.width;b.object.height=this.height;return b}});var Ca={arraySlice:function(b,a,c){return Ca.isTypedArray(b)?new b.constructor(b.subarray(a,void 0!==c?c:b.length)):b.slice(a,c)},convertArray:function(b,a,c){return!b||!c&&b.constructor===a?b:"number"===typeof a.BYTES_PER_ELEMENT?new a(b):Array.prototype.slice.call(b)},isTypedArray:function(b){return ArrayBuffer.isView(b)&&!(b instanceof DataView)},getKeyframeOrder:function(b){for(var a=b.length,c=Array(a),g=0;g!==a;++g)c[g]=g;c.sort(function(a,
  e){return b[a]-b[e]});return c},sortedArray:function(b,a,c){for(var g=b.length,d=new b.constructor(g),f=0,n=0;n!==g;++f)for(var m=c[f]*a,p=0;p!==a;++p)d[n++]=b[m+p];return d},flattenJSON:function(b,a,c,g){for(var d=1,f=b[0];void 0!==f&&void 0===f[g];)f=b[d++];if(void 0!==f){var n=f[g];if(void 0!==n)if(Array.isArray(n)){do n=f[g],void 0!==n&&(a.push(f.time),c.push.apply(c,n)),f=b[d++];while(void 0!==f)}else if(void 0!==n.toArray){do n=f[g],void 0!==n&&(a.push(f.time),n.toArray(c,c.length)),f=b[d++];
  while(void 0!==f)}else{do n=f[g],void 0!==n&&(a.push(f.time),c.push(n)),f=b[d++];while(void 0!==f)}}}};Object.assign(Sa.prototype,{evaluate:function(b){var a=this.parameterPositions,c=this._cachedIndex,g=a[c],d=a[c-1];a:{b:{c:{d:if(!(b<g)){for(var f=c+2;;){if(void 0===g){if(b<d)break d;this._cachedIndex=c=a.length;return this.afterEnd_(c-1,b,d)}if(c===f)break;d=g;g=a[++c];if(b<g)break b}g=a.length;break c}if(b>=d)break a;else{f=a[1];b<f&&(c=2,d=f);for(f=c-2;;){if(void 0===d)return this._cachedIndex=
  0,this.beforeStart_(0,b,g);if(c===f)break;g=d;d=a[--c-1];if(b>=d)break b}g=c;c=0}}for(;c<g;)d=c+g>>>1,b<a[d]?g=d:c=d+1;g=a[c];d=a[c-1];if(void 0===d)return this._cachedIndex=0,this.beforeStart_(0,b,g);if(void 0===g)return this._cachedIndex=c=a.length,this.afterEnd_(c-1,d,b)}this._cachedIndex=c;this.intervalChanged_(c,d,g)}return this.interpolate_(c,d,b,g)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(b){var a=this.resultBuffer,
  c=this.sampleValues,g=this.valueSize;b*=g;for(var d=0;d!==g;++d)a[d]=c[b+d];return a},interpolate_:function(){throw Error("call to abstract method");},intervalChanged_:function(){}});Object.assign(Sa.prototype,{beforeStart_:Sa.prototype.copySampleValue_,afterEnd_:Sa.prototype.copySampleValue_});ne.prototype=Object.assign(Object.create(Sa.prototype),{constructor:ne,DefaultSettings_:{endingStart:Sb,endingEnd:Sb},intervalChanged_:function(b,a,c){var g=this.parameterPositions,d=b-2,f=b+1,n=g[d],m=g[f];
  if(void 0===n)switch(this.getSettings_().endingStart){case 2401:d=b;n=2*a-c;break;case 2402:d=g.length-2;n=a+g[d]-g[d+1];break;default:d=b,n=c}if(void 0===m)switch(this.getSettings_().endingEnd){case 2401:f=b;m=2*c-a;break;case 2402:f=1;m=c+g[1]-g[0];break;default:f=b-1,m=a}b=0.5*(c-a);g=this.valueSize;this._weightPrev=b/(a-n);this._weightNext=b/(m-c);this._offsetPrev=d*g;this._offsetNext=f*g},interpolate_:function(b,a,c,g){var d=this.resultBuffer,f=this.sampleValues,n=this.valueSize;b*=n;var m=b-
  n,p=this._offsetPrev,l=this._offsetNext,s=this._weightPrev,q=this._weightNext,r=(c-a)/(g-a);c=r*r;g=c*r;a=-s*g+2*s*c-s*r;s=(1+s)*g+(-1.5-2*s)*c+(-0.5+s)*r+1;r=(-1-q)*g+(1.5+q)*c+0.5*r;q=q*g-q*c;for(c=0;c!==n;++c)d[c]=a*f[p+c]+s*f[m+c]+r*f[b+c]+q*f[l+c];return d}});wd.prototype=Object.assign(Object.create(Sa.prototype),{constructor:wd,interpolate_:function(b,a,c,g){var d=this.resultBuffer,f=this.sampleValues,n=this.valueSize;b*=n;var m=b-n;a=(c-a)/(g-a);c=1-a;for(g=0;g!==n;++g)d[g]=f[m+g]*c+f[b+g]*
  a;return d}});oe.prototype=Object.assign(Object.create(Sa.prototype),{constructor:oe,interpolate_:function(b){return this.copySampleValue_(b-1)}});Object.assign(Aa,{toJSON:function(b){var a=b.constructor;if(void 0!==a.toJSON)a=a.toJSON(b);else{var a={name:b.name,times:Ca.convertArray(b.times,Array),values:Ca.convertArray(b.values,Array)},c=b.getInterpolation();c!==b.DefaultInterpolation&&(a.interpolation=c)}a.type=b.ValueTypeName;return a}});Object.assign(Aa.prototype,{constructor:Aa,TimeBufferType:Float32Array,
  ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(b){return new oe(this.times,this.values,this.getValueSize(),b)},InterpolantFactoryMethodLinear:function(b){return new wd(this.times,this.values,this.getValueSize(),b)},InterpolantFactoryMethodSmooth:function(b){return new ne(this.times,this.values,this.getValueSize(),b)},setInterpolation:function(b){var a;switch(b){case 2300:a=this.InterpolantFactoryMethodDiscrete;break;case 2301:a=this.InterpolantFactoryMethodLinear;
  break;case 2302:a=this.InterpolantFactoryMethodSmooth}if(void 0===a){a="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(b!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(a);console.warn("THREE.KeyframeTrack:",a);return this}this.createInterpolant=a;return this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;
  case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(b){if(0!==b)for(var a=this.times,c=0,g=a.length;c!==g;++c)a[c]+=b;return this},scale:function(b){if(1!==b)for(var a=this.times,c=0,g=a.length;c!==g;++c)a[c]*=b;return this},trim:function(b,a){for(var c=this.times,g=c.length,d=0,f=g-1;d!==g&&c[d]<b;)++d;for(;-1!==f&&c[f]>a;)--f;++f;if(0!==d||f!==g)d>=f&&(f=Math.max(f,1),d=f-1),g=this.getValueSize(),this.times=Ca.arraySlice(c,
  d,f),this.values=Ca.arraySlice(this.values,d*g,f*g);return this},validate:function(){var b=!0,a=this.getValueSize();0!==a-Math.floor(a)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),b=!1);var c=this.times,a=this.values,g=c.length;0===g&&(console.error("THREE.KeyframeTrack: Track is empty.",this),b=!1);for(var d=null,f=0;f!==g;f++){var n=c[f];if("number"===typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,n);b=!1;break}if(null!==
  d&&d>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,n,d);b=!1;break}d=n}if(void 0!==a&&Ca.isTypedArray(a))for(f=0,c=a.length;f!==c;++f)if(g=a[f],isNaN(g)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,g);b=!1;break}return b},optimize:function(){for(var b=this.times,a=this.values,c=this.getValueSize(),g=2302===this.getInterpolation(),d=1,f=b.length-1,n=1;n<f;++n){var m=!1,p=b[n];if(p!==b[n+1]&&(1!==n||p!==p[0]))if(g)m=!0;else for(var l=n*c,s=l-c,q=l+c,
  p=0;p!==c;++p){var r=a[l+p];if(r!==a[s+p]||r!==a[q+p]){m=!0;break}}if(m){if(n!==d)for(b[d]=b[n],m=n*c,l=d*c,p=0;p!==c;++p)a[l+p]=a[m+p];++d}}if(0<f){b[d]=b[f];m=f*c;l=d*c;for(p=0;p!==c;++p)a[l+p]=a[m+p];++d}d!==b.length&&(this.times=Ca.arraySlice(b,0,d),this.values=Ca.arraySlice(a,0,d*c));return this}});pe.prototype=Object.assign(Object.create(Aa.prototype),{constructor:pe,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});
  qe.prototype=Object.assign(Object.create(Aa.prototype),{constructor:qe,ValueTypeName:"color"});Ac.prototype=Object.assign(Object.create(Aa.prototype),{constructor:Ac,ValueTypeName:"number"});re.prototype=Object.assign(Object.create(Sa.prototype),{constructor:re,interpolate_:function(b,a,c,g){var d=this.resultBuffer,f=this.sampleValues,n=this.valueSize;b*=n;a=(c-a)/(g-a);for(c=b+n;b!==c;b+=4)l.slerpFlat(d,0,f,b-n,f,b,a);return d}});xd.prototype=Object.assign(Object.create(Aa.prototype),{constructor:xd,
  ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(b){return new re(this.times,this.values,this.getValueSize(),b)},InterpolantFactoryMethodSmooth:void 0});se.prototype=Object.assign(Object.create(Aa.prototype),{constructor:se,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});Bc.prototype=Object.assign(Object.create(Aa.prototype),{constructor:Bc,ValueTypeName:"vector"});
  Object.assign(Ua,{parse:function(b){for(var a=[],c=b.tracks,g=1/(b.fps||1),d=0,f=c.length;d!==f;++d)a.push(Wi(c[d]).scale(g));return new Ua(b.name,b.duration,a)},toJSON:function(b){var a=[],c=b.tracks;b={name:b.name,duration:b.duration,tracks:a,uuid:b.uuid};for(var g=0,d=c.length;g!==d;++g)a.push(Aa.toJSON(c[g]));return b},CreateFromMorphTargetSequence:function(b,a,c,g){for(var d=a.length,f=[],n=0;n<d;n++){var m=[],p=[];m.push((n+d-1)%d,n,(n+1)%d);p.push(0,1,0);var l=Ca.getKeyframeOrder(m),m=Ca.sortedArray(m,
  1,l),p=Ca.sortedArray(p,1,l);g||0!==m[0]||(m.push(d),p.push(p[0]));f.push((new Ac(".morphTargetInfluences["+a[n].name+"]",m,p)).scale(1/c))}return new Ua(b,-1,f)},findByName:function(b,a){var c=b;Array.isArray(b)||(c=b.geometry&&b.geometry.animations||b.animations);for(var g=0;g<c.length;g++)if(c[g].name===a)return c[g];return null},CreateClipsFromMorphTargetSequences:function(b,a,c){for(var g={},d=/^([\w-]*?)([\d]+)$/,f=0,n=b.length;f<n;f++){var m=b[f],p=m.name.match(d);if(p&&1<p.length){var l=p[1];
  (p=g[l])||(g[l]=p=[]);p.push(m)}}b=[];for(l in g)b.push(Ua.CreateFromMorphTargetSequence(l,g[l],a,c));return b},parseAnimation:function(b,a){if(!b)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var c=function(b,a,e,c,g){if(0!==e.length){var d=[],h=[];Ca.flattenJSON(e,d,h,c);0!==d.length&&g.push(new b(a,d,h))}},g=[],d=b.name||"default",f=b.length||-1,n=b.fps||30,m=b.hierarchy||[],p=0;p<m.length;p++){var l=m[p].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var f=
  {},s=0;s<l.length;s++)if(l[s].morphTargets)for(var q=0;q<l[s].morphTargets.length;q++)f[l[s].morphTargets[q]]=-1;for(var r in f){for(var t=[],u=[],q=0;q!==l[s].morphTargets.length;++q){var w=l[s];t.push(w.time);u.push(w.morphTarget===r?1:0)}g.push(new Ac(".morphTargetInfluence["+r+"]",t,u))}f=f.length*(n||1)}else s=".bones["+a[p].name+"]",c(Bc,s+".position",l,"pos",g),c(xd,s+".quaternion",l,"rot",g),c(Bc,s+".scale",l,"scl",g)}return 0===g.length?null:new Ua(d,f,g)}});Object.assign(Ua.prototype,{resetDuration:function(){for(var b=
  0,a=0,c=this.tracks.length;a!==c;++a)var g=this.tracks[a],b=Math.max(b,g.times[g.times.length-1]);this.duration=b;return this},trim:function(){for(var b=0;b<this.tracks.length;b++)this.tracks[b].trim(0,this.duration);return this},validate:function(){for(var b=!0,a=0;a<this.tracks.length;a++)b=b&&this.tracks[a].validate();return b},optimize:function(){for(var b=0;b<this.tracks.length;b++)this.tracks[b].optimize();return this}});Object.assign(te.prototype,{load:function(b,a,c,g){var d=this;(new Xa(d.manager)).load(b,
  function(b){a(d.parse(JSON.parse(b)))},c,g)},setTextures:function(b){this.textures=b},parse:function(b){function a(b){void 0===c[b]&&console.warn("THREE.MaterialLoader: Undefined texture",b);return c[b]}var c=this.textures,g=new $i[b.type];void 0!==b.uuid&&(g.uuid=b.uuid);void 0!==b.name&&(g.name=b.name);void 0!==b.color&&g.color.setHex(b.color);void 0!==b.roughness&&(g.roughness=b.roughness);void 0!==b.metalness&&(g.metalness=b.metalness);void 0!==b.emissive&&g.emissive.setHex(b.emissive);void 0!==
  b.specular&&g.specular.setHex(b.specular);void 0!==b.shininess&&(g.shininess=b.shininess);void 0!==b.clearCoat&&(g.clearCoat=b.clearCoat);void 0!==b.clearCoatRoughness&&(g.clearCoatRoughness=b.clearCoatRoughness);void 0!==b.vertexColors&&(g.vertexColors=b.vertexColors);void 0!==b.fog&&(g.fog=b.fog);void 0!==b.flatShading&&(g.flatShading=b.flatShading);void 0!==b.blending&&(g.blending=b.blending);void 0!==b.combine&&(g.combine=b.combine);void 0!==b.side&&(g.side=b.side);void 0!==b.opacity&&(g.opacity=
  b.opacity);void 0!==b.transparent&&(g.transparent=b.transparent);void 0!==b.alphaTest&&(g.alphaTest=b.alphaTest);void 0!==b.depthTest&&(g.depthTest=b.depthTest);void 0!==b.depthWrite&&(g.depthWrite=b.depthWrite);void 0!==b.colorWrite&&(g.colorWrite=b.colorWrite);void 0!==b.wireframe&&(g.wireframe=b.wireframe);void 0!==b.wireframeLinewidth&&(g.wireframeLinewidth=b.wireframeLinewidth);void 0!==b.wireframeLinecap&&(g.wireframeLinecap=b.wireframeLinecap);void 0!==b.wireframeLinejoin&&(g.wireframeLinejoin=
  b.wireframeLinejoin);void 0!==b.rotation&&(g.rotation=b.rotation);1!==b.linewidth&&(g.linewidth=b.linewidth);void 0!==b.dashSize&&(g.dashSize=b.dashSize);void 0!==b.gapSize&&(g.gapSize=b.gapSize);void 0!==b.scale&&(g.scale=b.scale);void 0!==b.polygonOffset&&(g.polygonOffset=b.polygonOffset);void 0!==b.polygonOffsetFactor&&(g.polygonOffsetFactor=b.polygonOffsetFactor);void 0!==b.polygonOffsetUnits&&(g.polygonOffsetUnits=b.polygonOffsetUnits);void 0!==b.skinning&&(g.skinning=b.skinning);void 0!==b.morphTargets&&
  (g.morphTargets=b.morphTargets);void 0!==b.dithering&&(g.dithering=b.dithering);void 0!==b.visible&&(g.visible=b.visible);void 0!==b.userData&&(g.userData=b.userData);if(void 0!==b.uniforms)for(var h in b.uniforms){var n=b.uniforms[h];g.uniforms[h]={};switch(n.type){case "t":g.uniforms[h].value=a(n.value);break;case "c":g.uniforms[h].value=(new w).setHex(n.value);break;case "v2":g.uniforms[h].value=(new d).fromArray(n.value);break;case "v3":g.uniforms[h].value=(new m).fromArray(n.value);break;case "v4":g.uniforms[h].value=
  (new t).fromArray(n.value);break;case "m4":g.uniforms[h].value=(new f).fromArray(n.value);break;default:g.uniforms[h].value=n.value}}void 0!==b.defines&&(g.defines=b.defines);void 0!==b.vertexShader&&(g.vertexShader=b.vertexShader);void 0!==b.fragmentShader&&(g.fragmentShader=b.fragmentShader);void 0!==b.shading&&(g.flatShading=1===b.shading);void 0!==b.size&&(g.size=b.size);void 0!==b.sizeAttenuation&&(g.sizeAttenuation=b.sizeAttenuation);void 0!==b.map&&(g.map=a(b.map));void 0!==b.alphaMap&&(g.alphaMap=
  a(b.alphaMap),g.transparent=!0);void 0!==b.bumpMap&&(g.bumpMap=a(b.bumpMap));void 0!==b.bumpScale&&(g.bumpScale=b.bumpScale);void 0!==b.normalMap&&(g.normalMap=a(b.normalMap));void 0!==b.normalMapType&&(g.normalMapType=b.normalMapType);void 0!==b.normalScale&&(h=b.normalScale,!1===Array.isArray(h)&&(h=[h,h]),g.normalScale=(new d).fromArray(h));void 0!==b.displacementMap&&(g.displacementMap=a(b.displacementMap));void 0!==b.displacementScale&&(g.displacementScale=b.displacementScale);void 0!==b.displacementBias&&
  (g.displacementBias=b.displacementBias);void 0!==b.roughnessMap&&(g.roughnessMap=a(b.roughnessMap));void 0!==b.metalnessMap&&(g.metalnessMap=a(b.metalnessMap));void 0!==b.emissiveMap&&(g.emissiveMap=a(b.emissiveMap));void 0!==b.emissiveIntensity&&(g.emissiveIntensity=b.emissiveIntensity);void 0!==b.specularMap&&(g.specularMap=a(b.specularMap));void 0!==b.envMap&&(g.envMap=a(b.envMap));void 0!==b.envMapIntensity&&(g.envMapIntensity=b.envMapIntensity);void 0!==b.reflectivity&&(g.reflectivity=b.reflectivity);
  void 0!==b.lightMap&&(g.lightMap=a(b.lightMap));void 0!==b.lightMapIntensity&&(g.lightMapIntensity=b.lightMapIntensity);void 0!==b.aoMap&&(g.aoMap=a(b.aoMap));void 0!==b.aoMapIntensity&&(g.aoMapIntensity=b.aoMapIntensity);void 0!==b.gradientMap&&(g.gradientMap=a(b.gradientMap));return g}});Object.assign(kf.prototype,{load:function(b,a,c,g){var d=this;(new Xa(d.manager)).load(b,function(b){a(d.parse(JSON.parse(b)))},c,g)},parse:function(b){var a=new M,c=b.data.index;void 0!==c&&(c=new Ph[c.type](c.array),
  a.setIndex(new n(c,1)));var g=b.data.attributes,d;for(d in g){var f=g[d],c=new Ph[f.type](f.array);a.addAttribute(d,new n(c,f.itemSize,f.normalized))}d=b.data.groups||b.data.drawcalls||b.data.offsets;if(void 0!==d)for(c=0,g=d.length;c!==g;++c)f=d[c],a.addGroup(f.start,f.count,f.materialIndex);b=b.data.boundingSphere;void 0!==b&&(d=new m,void 0!==b.center&&d.fromArray(b.center),a.boundingSphere=new C(d,b.radius));return a}});var Ph={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!==
  typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};Cc.Handlers={handlers:[],add:function(b,a){this.handlers.push(b,a)},get:function(b){for(var a=this.handlers,c=0,g=a.length;c<g;c+=2){var d=a[c+1];if(a[c].test(b))return d}return null}};Object.assign(Cc.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},
  initMaterials:function(b,a,c){for(var g=[],d=0;d<b.length;++d)g[d]=this.createMaterial(b[d],a,c);return g},createMaterial:function(){var b={NoBlending:Oc,NormalBlending:zb,AdditiveBlending:Sd,SubtractiveBlending:Td,MultiplyBlending:Ud,CustomBlending:Qe},a=new w,c=new ee,g=new te;return function(d,f,n){function m(b,a,e,g,d){b=f+b;var h=Cc.Handlers.get(b);null!==h?b=h.load(b):(c.setCrossOrigin(n),b=c.load(b));void 0!==a&&(b.repeat.fromArray(a),1!==a[0]&&(b.wrapS=nb),1!==a[1]&&(b.wrapT=nb));void 0!==
  e&&b.offset.fromArray(e);void 0!==g&&("repeat"===g[0]&&(b.wrapS=nb),"mirror"===g[0]&&(b.wrapS=Bb),"repeat"===g[1]&&(b.wrapT=nb),"mirror"===g[1]&&(b.wrapT=Bb));void 0!==d&&(b.anisotropy=d);a=ga.generateUUID();p[a]=b;return a}var p={},l={uuid:ga.generateUUID(),type:"MeshLambertMaterial"},s;for(s in d){var q=d[s];switch(s){case "DbgColor":case "DbgIndex":case "opticalDensity":case "illumination":break;case "DbgName":l.name=q;break;case "blending":l.blending=b[q];break;case "colorAmbient":case "mapAmbient":console.warn("THREE.Loader.createMaterial:",
  s,"is no longer supported.");break;case "colorDiffuse":l.color=a.fromArray(q).getHex();break;case "colorSpecular":l.specular=a.fromArray(q).getHex();break;case "colorEmissive":l.emissive=a.fromArray(q).getHex();break;case "specularCoef":l.shininess=q;break;case "shading":"basic"===q.toLowerCase()&&(l.type="MeshBasicMaterial");"phong"===q.toLowerCase()&&(l.type="MeshPhongMaterial");"standard"===q.toLowerCase()&&(l.type="MeshStandardMaterial");break;case "mapDiffuse":l.map=m(q,d.mapDiffuseRepeat,d.mapDiffuseOffset,
  d.mapDiffuseWrap,d.mapDiffuseAnisotropy);break;case "mapDiffuseRepeat":case "mapDiffuseOffset":case "mapDiffuseWrap":case "mapDiffuseAnisotropy":break;case "mapEmissive":l.emissiveMap=m(q,d.mapEmissiveRepeat,d.mapEmissiveOffset,d.mapEmissiveWrap,d.mapEmissiveAnisotropy);break;case "mapEmissiveRepeat":case "mapEmissiveOffset":case "mapEmissiveWrap":case "mapEmissiveAnisotropy":break;case "mapLight":l.lightMap=m(q,d.mapLightRepeat,d.mapLightOffset,d.mapLightWrap,d.mapLightAnisotropy);break;case "mapLightRepeat":case "mapLightOffset":case "mapLightWrap":case "mapLightAnisotropy":break;
  case "mapAO":l.aoMap=m(q,d.mapAORepeat,d.mapAOOffset,d.mapAOWrap,d.mapAOAnisotropy);break;case "mapAORepeat":case "mapAOOffset":case "mapAOWrap":case "mapAOAnisotropy":break;case "mapBump":l.bumpMap=m(q,d.mapBumpRepeat,d.mapBumpOffset,d.mapBumpWrap,d.mapBumpAnisotropy);break;case "mapBumpScale":l.bumpScale=q;break;case "mapBumpRepeat":case "mapBumpOffset":case "mapBumpWrap":case "mapBumpAnisotropy":break;case "mapNormal":l.normalMap=m(q,d.mapNormalRepeat,d.mapNormalOffset,d.mapNormalWrap,d.mapNormalAnisotropy);
  break;case "mapNormalFactor":l.normalScale=q;break;case "mapNormalRepeat":case "mapNormalOffset":case "mapNormalWrap":case "mapNormalAnisotropy":break;case "mapSpecular":l.specularMap=m(q,d.mapSpecularRepeat,d.mapSpecularOffset,d.mapSpecularWrap,d.mapSpecularAnisotropy);break;case "mapSpecularRepeat":case "mapSpecularOffset":case "mapSpecularWrap":case "mapSpecularAnisotropy":break;case "mapMetalness":l.metalnessMap=m(q,d.mapMetalnessRepeat,d.mapMetalnessOffset,d.mapMetalnessWrap,d.mapMetalnessAnisotropy);
  break;case "mapMetalnessRepeat":case "mapMetalnessOffset":case "mapMetalnessWrap":case "mapMetalnessAnisotropy":break;case "mapRoughness":l.roughnessMap=m(q,d.mapRoughnessRepeat,d.mapRoughnessOffset,d.mapRoughnessWrap,d.mapRoughnessAnisotropy);break;case "mapRoughnessRepeat":case "mapRoughnessOffset":case "mapRoughnessWrap":case "mapRoughnessAnisotropy":break;case "mapAlpha":l.alphaMap=m(q,d.mapAlphaRepeat,d.mapAlphaOffset,d.mapAlphaWrap,d.mapAlphaAnisotropy);break;case "mapAlphaRepeat":case "mapAlphaOffset":case "mapAlphaWrap":case "mapAlphaAnisotropy":break;
  case "flipSided":l.side=Oa;break;case "doubleSided":l.side=ac;break;case "transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity");l.opacity=q;break;case "depthTest":case "depthWrite":case "colorWrite":case "opacity":case "reflectivity":case "transparent":case "visible":case "wireframe":l[s]=q;break;case "vertexColors":!0===q&&(l.vertexColors=Tb);"face"===q&&(l.vertexColors=Cf);break;default:console.error("THREE.Loader.createMaterial: Unsupported",s,q)}}"MeshBasicMaterial"===
  l.type&&delete l.emissive;"MeshPhongMaterial"!==l.type&&delete l.specular;1>l.opacity&&(l.transparent=!0);g.setTextures(p);return g.parse(l)}}()});var If={decodeText:function(b){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(b);for(var a="",c=0,g=b.length;c<g;c++)a+=String.fromCharCode(b[c]);return decodeURIComponent(escape(a))},extractUrlBase:function(b){var a=b.lastIndexOf("/");return-1===a?"./":b.substr(0,a+1)}};Object.assign(lf.prototype,{crossOrigin:"anonymous",load:function(b,
  a,c,g){var d=this,f=this.texturePath&&"string"===typeof this.texturePath?this.texturePath:If.extractUrlBase(b),n=new Xa(this.manager);n.setWithCredentials(this.withCredentials);n.load(b,function(c){c=JSON.parse(c);var g=c.metadata;if(void 0!==g&&(g=g.type,void 0!==g&&"object"===g.toLowerCase())){console.error("THREE.JSONLoader: "+b+" should be loaded with THREE.ObjectLoader instead.");return}c=d.parse(c,f);a(c.geometry,c.materials)},c,g)},setCrossOrigin:function(b){this.crossOrigin=b;return this},
  setTexturePath:function(b){this.texturePath=b;return this},parse:function(){return function(b,a){void 0!==b.data&&(b=b.data);b.scale=void 0!==b.scale?1/b.scale:1;var c=new g,f=b,h,n,l,s,p,q,r,u,G,v,A,x,S,I,z=f.faces;G=f.vertices;var K=f.normals,y=f.colors;q=f.scale;var C=0;if(void 0!==f.uvs){for(h=0;h<f.uvs.length;h++)f.uvs[h].length&&C++;for(h=0;h<C;h++)c.faceVertexUvs[h]=[]}s=0;for(p=G.length;s<p;)h=new m,h.x=G[s++]*q,h.y=G[s++]*q,h.z=G[s++]*q,c.vertices.push(h);s=0;for(p=z.length;s<p;)if(G=z[s++],
  v=G&1,l=G&2,h=G&8,r=G&16,A=G&32,q=G&64,G&=128,v){v=new H;v.a=z[s];v.b=z[s+1];v.c=z[s+3];x=new H;x.a=z[s+1];x.b=z[s+2];x.c=z[s+3];s+=4;l&&(l=z[s++],v.materialIndex=l,x.materialIndex=l);l=c.faces.length;if(h)for(h=0;h<C;h++)for(S=f.uvs[h],c.faceVertexUvs[h][l]=[],c.faceVertexUvs[h][l+1]=[],n=0;4>n;n++)u=z[s++],I=S[2*u],u=S[2*u+1],I=new d(I,u),2!==n&&c.faceVertexUvs[h][l].push(I),0!==n&&c.faceVertexUvs[h][l+1].push(I);r&&(r=3*z[s++],v.normal.set(K[r++],K[r++],K[r]),x.normal.copy(v.normal));if(A)for(h=
  0;4>h;h++)r=3*z[s++],A=new m(K[r++],K[r++],K[r]),2!==h&&v.vertexNormals.push(A),0!==h&&x.vertexNormals.push(A);q&&(q=z[s++],q=y[q],v.color.setHex(q),x.color.setHex(q));if(G)for(h=0;4>h;h++)q=z[s++],q=y[q],2!==h&&v.vertexColors.push(new w(q)),0!==h&&x.vertexColors.push(new w(q));c.faces.push(v);c.faces.push(x)}else{v=new H;v.a=z[s++];v.b=z[s++];v.c=z[s++];l&&(l=z[s++],v.materialIndex=l);l=c.faces.length;if(h)for(h=0;h<C;h++)for(S=f.uvs[h],c.faceVertexUvs[h][l]=[],n=0;3>n;n++)u=z[s++],I=S[2*u],u=S[2*
  u+1],I=new d(I,u),c.faceVertexUvs[h][l].push(I);r&&(r=3*z[s++],v.normal.set(K[r++],K[r++],K[r]));if(A)for(h=0;3>h;h++)r=3*z[s++],A=new m(K[r++],K[r++],K[r]),v.vertexNormals.push(A);q&&(q=z[s++],v.color.setHex(y[q]));if(G)for(h=0;3>h;h++)q=z[s++],v.vertexColors.push(new w(y[q]));c.faces.push(v)}f=b;s=void 0!==f.influencesPerVertex?f.influencesPerVertex:2;if(f.skinWeights)for(p=0,z=f.skinWeights.length;p<z;p+=s)c.skinWeights.push(new t(f.skinWeights[p],1<s?f.skinWeights[p+1]:0,2<s?f.skinWeights[p+2]:
  0,3<s?f.skinWeights[p+3]:0));if(f.skinIndices)for(p=0,z=f.skinIndices.length;p<z;p+=s)c.skinIndices.push(new t(f.skinIndices[p],1<s?f.skinIndices[p+1]:0,2<s?f.skinIndices[p+2]:0,3<s?f.skinIndices[p+3]:0));c.bones=f.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.");
  p=b;z=p.scale;if(void 0!==p.morphTargets)for(f=0,s=p.morphTargets.length;f<s;f++)for(c.morphTargets[f]={},c.morphTargets[f].name=p.morphTargets[f].name,c.morphTargets[f].vertices=[],K=c.morphTargets[f].vertices,y=p.morphTargets[f].vertices,C=0,G=y.length;C<G;C+=3)q=new m,q.x=y[C]*z,q.y=y[C+1]*z,q.z=y[C+2]*z,K.push(q);if(void 0!==p.morphColors&&0<p.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),z=c.faces,p=p.morphColors[0].colors,
  f=0,s=z.length;f<s;f++)z[f].color.fromArray(p,3*f);p=b;f=[];s=[];void 0!==p.animation&&s.push(p.animation);void 0!==p.animations&&(p.animations.length?s=s.concat(p.animations):s.push(p.animations));for(p=0;p<s.length;p++)(z=Ua.parseAnimation(s[p],c.bones))&&f.push(z);c.morphTargets&&(s=Ua.CreateClipsFromMorphTargetSequences(c.morphTargets,10),f=f.concat(s));0<f.length&&(c.animations=f);c.computeFaceNormals();c.computeBoundingSphere();if(void 0===b.materials||0===b.materials.length)return{geometry:c};
  f=Cc.prototype.initMaterials(b.materials,a,this.crossOrigin);return{geometry:c,materials:f}}}()});Object.assign(zh.prototype,{crossOrigin:"anonymous",load:function(b,a,c,g){""===this.texturePath&&(this.texturePath=b.substring(0,b.lastIndexOf("/")+1));var d=this;(new Xa(d.manager)).load(b,function(c){var k=null;try{k=JSON.parse(c)}catch(f){void 0!==g&&g(f);console.error("THREE:ObjectLoader: Can't parse "+b+".",f.message);return}c=k.metadata;void 0===c||void 0===c.type||"geometry"===c.type.toLowerCase()?
  console.error("THREE.ObjectLoader: Can't load "+b+". Use THREE.JSONLoader instead."):d.parse(k,a)},c,g)},setTexturePath:function(b){this.texturePath=b;return this},setCrossOrigin:function(b){this.crossOrigin=b;return this},parse:function(b,a){var c=this.parseShape(b.shapes),c=this.parseGeometries(b.geometries,c),g=this.parseImages(b.images,function(){void 0!==a&&a(d)}),g=this.parseTextures(b.textures,g),g=this.parseMaterials(b.materials,g),d=this.parseObject(b.object,c,g);b.animations&&(d.animations=
  this.parseAnimations(b.animations));void 0!==b.images&&0!==b.images.length||void 0===a||a(d);return d},parseShape:function(b){var a={};if(void 0!==b)for(var c=0,g=b.length;c<g;c++){var d=(new xb).fromJSON(b[c]);a[d.uuid]=d}return a},parseGeometries:function(b,a){var c={};if(void 0!==b)for(var g=new lf,d=new kf,f=0,n=b.length;f<n;f++){var m,l=b[f];switch(l.type){case "PlaneGeometry":case "PlaneBufferGeometry":m=new Pa[l.type](l.width,l.height,l.widthSegments,l.heightSegments);break;case "BoxGeometry":case "BoxBufferGeometry":case "CubeGeometry":m=
  new Pa[l.type](l.width,l.height,l.depth,l.widthSegments,l.heightSegments,l.depthSegments);break;case "CircleGeometry":case "CircleBufferGeometry":m=new Pa[l.type](l.radius,l.segments,l.thetaStart,l.thetaLength);break;case "CylinderGeometry":case "CylinderBufferGeometry":m=new Pa[l.type](l.radiusTop,l.radiusBottom,l.height,l.radialSegments,l.heightSegments,l.openEnded,l.thetaStart,l.thetaLength);break;case "ConeGeometry":case "ConeBufferGeometry":m=new Pa[l.type](l.radius,l.height,l.radialSegments,
  l.heightSegments,l.openEnded,l.thetaStart,l.thetaLength);break;case "SphereGeometry":case "SphereBufferGeometry":m=new Pa[l.type](l.radius,l.widthSegments,l.heightSegments,l.phiStart,l.phiLength,l.thetaStart,l.thetaLength);break;case "DodecahedronGeometry":case "DodecahedronBufferGeometry":case "IcosahedronGeometry":case "IcosahedronBufferGeometry":case "OctahedronGeometry":case "OctahedronBufferGeometry":case "TetrahedronGeometry":case "TetrahedronBufferGeometry":m=new Pa[l.type](l.radius,l.detail);
  break;case "RingGeometry":case "RingBufferGeometry":m=new Pa[l.type](l.innerRadius,l.outerRadius,l.thetaSegments,l.phiSegments,l.thetaStart,l.thetaLength);break;case "TorusGeometry":case "TorusBufferGeometry":m=new Pa[l.type](l.radius,l.tube,l.radialSegments,l.tubularSegments,l.arc);break;case "TorusKnotGeometry":case "TorusKnotBufferGeometry":m=new Pa[l.type](l.radius,l.tube,l.tubularSegments,l.radialSegments,l.p,l.q);break;case "LatheGeometry":case "LatheBufferGeometry":m=new Pa[l.type](l.points,
  l.segments,l.phiStart,l.phiLength);break;case "PolyhedronGeometry":case "PolyhedronBufferGeometry":m=new Pa[l.type](l.vertices,l.indices,l.radius,l.details);break;case "ShapeGeometry":case "ShapeBufferGeometry":m=[];for(var s=0,q=l.shapes.length;s<q;s++){var r=a[l.shapes[s]];m.push(r)}m=new Pa[l.type](m,l.curveSegments);break;case "ExtrudeGeometry":case "ExtrudeBufferGeometry":m=[];s=0;for(q=l.shapes.length;s<q;s++)r=a[l.shapes[s]],m.push(r);s=l.options.extrudePath;void 0!==s&&(l.options.extrudePath=
  (new Oh[s.type]).fromJSON(s));m=new Pa[l.type](m,l.options);break;case "BufferGeometry":m=d.parse(l);break;case "Geometry":m=g.parse(l,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+l.type+'"');continue}m.uuid=l.uuid;void 0!==l.name&&(m.name=l.name);!0===m.isBufferGeometry&&void 0!==l.userData&&(m.userData=l.userData);c[l.uuid]=m}return c},parseMaterials:function(b,a){var c={};if(void 0!==b){var g=new te;g.setTextures(a);for(var d=0,f=b.length;d<
  f;d++){var n=b[d];if("MultiMaterial"===n.type){for(var l=[],m=0;m<n.materials.length;m++)l.push(g.parse(n.materials[m]));c[n.uuid]=l}else c[n.uuid]=g.parse(n)}}return c},parseAnimations:function(b){for(var a=[],c=0;c<b.length;c++){var g=b[c],d=Ua.parse(g);void 0!==g.uuid&&(d.uuid=g.uuid);a.push(d)}return a},parseImages:function(b,a){function c(b){g.manager.itemStart(b);return n.load(b,function(){g.manager.itemEnd(b)},void 0,function(){g.manager.itemEnd(b);g.manager.itemError(b)})}var g=this,d={};
  if(void 0!==b&&0<b.length){var f=new ff(a),n=new sd(f);n.setCrossOrigin(this.crossOrigin);for(var f=0,l=b.length;f<l;f++){var m=b[f],s=m.url;if(Array.isArray(s)){d[m.uuid]=[];for(var q=0,r=s.length;q<r;q++){var t=s[q],t=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:g.texturePath+t;d[m.uuid].push(c(t))}}else t=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(m.url)?m.url:g.texturePath+m.url,d[m.uuid]=c(t)}}return d},parseTextures:function(b,a){function c(b,a){if("number"===typeof b)return b;console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",
  b);return a[b]}var g={};if(void 0!==b)for(var d=0,f=b.length;d<f;d++){var n=b[d];void 0===n.image&&console.warn('THREE.ObjectLoader: No "image" specified for',n.uuid);void 0===a[n.image]&&console.warn("THREE.ObjectLoader: Undefined image",n.image);var l;l=Array.isArray(a[n.image])?new mb(a[n.image]):new q(a[n.image]);l.needsUpdate=!0;l.uuid=n.uuid;void 0!==n.name&&(l.name=n.name);void 0!==n.mapping&&(l.mapping=c(n.mapping,aj));void 0!==n.offset&&l.offset.fromArray(n.offset);void 0!==n.repeat&&l.repeat.fromArray(n.repeat);
  void 0!==n.center&&l.center.fromArray(n.center);void 0!==n.rotation&&(l.rotation=n.rotation);void 0!==n.wrap&&(l.wrapS=c(n.wrap[0],Qh),l.wrapT=c(n.wrap[1],Qh));void 0!==n.format&&(l.format=n.format);void 0!==n.minFilter&&(l.minFilter=c(n.minFilter,Rh));void 0!==n.magFilter&&(l.magFilter=c(n.magFilter,Rh));void 0!==n.anisotropy&&(l.anisotropy=n.anisotropy);void 0!==n.flipY&&(l.flipY=n.flipY);g[n.uuid]=l}return g},parseObject:function(b,a,c){function g(b){void 0===a[b]&&console.warn("THREE.ObjectLoader: Undefined geometry",
  b);return a[b]}function d(b){if(void 0!==b){if(Array.isArray(b)){for(var a=[],e=0,g=b.length;e<g;e++){var h=b[e];void 0===c[h]&&console.warn("THREE.ObjectLoader: Undefined material",h);a.push(c[h])}return a}void 0===c[b]&&console.warn("THREE.ObjectLoader: Undefined material",b);return c[b]}}var f;switch(b.type){case "Scene":f=new $d;void 0!==b.background&&Number.isInteger(b.background)&&(f.background=new w(b.background));void 0!==b.fog&&("Fog"===b.fog.type?f.fog=new hc(b.fog.color,b.fog.near,b.fog.far):
  "FogExp2"===b.fog.type&&(f.fog=new fc(b.fog.color,b.fog.density)));break;case "PerspectiveCamera":f=new qa(b.fov,b.aspect,b.near,b.far);void 0!==b.focus&&(f.focus=b.focus);void 0!==b.zoom&&(f.zoom=b.zoom);void 0!==b.filmGauge&&(f.filmGauge=b.filmGauge);void 0!==b.filmOffset&&(f.filmOffset=b.filmOffset);void 0!==b.view&&(f.view=Object.assign({},b.view));break;case "OrthographicCamera":f=new vd(b.left,b.right,b.top,b.bottom,b.near,b.far);void 0!==b.zoom&&(f.zoom=b.zoom);void 0!==b.view&&(f.view=Object.assign({},
  b.view));break;case "AmbientLight":f=new le(b.color,b.intensity);break;case "DirectionalLight":f=new ke(b.color,b.intensity);break;case "PointLight":f=new ie(b.color,b.intensity,b.distance,b.decay);break;case "RectAreaLight":f=new me(b.color,b.intensity,b.width,b.height);break;case "SpotLight":f=new he(b.color,b.intensity,b.distance,b.angle,b.penumbra,b.decay);break;case "HemisphereLight":f=new fe(b.color,b.groundColor,b.intensity);break;case "SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");
  case "Mesh":f=g(b.geometry);var n=d(b.material);f=f.bones&&0<f.bones.length?new be(f,n):new wa(f,n);break;case "LOD":f=new Uc;break;case "Line":f=new ya(g(b.geometry),d(b.material),b.mode);break;case "LineLoop":f=new ce(g(b.geometry),d(b.material));break;case "LineSegments":f=new ra(g(b.geometry),d(b.material));break;case "PointCloud":case "Points":f=new jc(g(b.geometry),d(b.material));break;case "Sprite":f=new Tc(d(b.material));break;case "Group":f=new ec;break;default:f=new D}f.uuid=b.uuid;void 0!==
  b.name&&(f.name=b.name);void 0!==b.matrix?(f.matrix.fromArray(b.matrix),void 0!==b.matrixAutoUpdate&&(f.matrixAutoUpdate=b.matrixAutoUpdate),f.matrixAutoUpdate&&f.matrix.decompose(f.position,f.quaternion,f.scale)):(void 0!==b.position&&f.position.fromArray(b.position),void 0!==b.rotation&&f.rotation.fromArray(b.rotation),void 0!==b.quaternion&&f.quaternion.fromArray(b.quaternion),void 0!==b.scale&&f.scale.fromArray(b.scale));void 0!==b.castShadow&&(f.castShadow=b.castShadow);void 0!==b.receiveShadow&&
  (f.receiveShadow=b.receiveShadow);b.shadow&&(void 0!==b.shadow.bias&&(f.shadow.bias=b.shadow.bias),void 0!==b.shadow.radius&&(f.shadow.radius=b.shadow.radius),void 0!==b.shadow.mapSize&&f.shadow.mapSize.fromArray(b.shadow.mapSize),void 0!==b.shadow.camera&&(f.shadow.camera=this.parseObject(b.shadow.camera)));void 0!==b.visible&&(f.visible=b.visible);void 0!==b.frustumCulled&&(f.frustumCulled=b.frustumCulled);void 0!==b.renderOrder&&(f.renderOrder=b.renderOrder);void 0!==b.userData&&(f.userData=b.userData);
  void 0!==b.layers&&(f.layers.mask=b.layers);if(void 0!==b.children)for(var n=b.children,l=0;l<n.length;l++)f.add(this.parseObject(n[l],a,c));if("LOD"===b.type)for(b=b.levels,n=0;n<b.length;n++){var l=b[n],m=f.getObjectByProperty("uuid",l.object);void 0!==m&&f.addLevel(m,l.distance)}return f}});var aj={UVMapping:300,CubeReflectionMapping:Kd,CubeRefractionMapping:Md,EquirectangularReflectionMapping:Ne,EquirectangularRefractionMapping:Pd,SphericalReflectionMapping:Oe,CubeUVReflectionMapping:Nd,CubeUVRefractionMapping:Od},
  Qh={RepeatWrapping:nb,ClampToEdgeWrapping:Qa,MirroredRepeatWrapping:Bb},Rh={NearestFilter:La,NearestMipMapNearestFilter:Vd,NearestMipMapLinearFilter:Wd,LinearFilter:Ka,LinearMipMapNearestFilter:Te,LinearMipMapLinearFilter:Kc};mf.prototype={constructor:mf,setOptions:function(b){this.options=b;return this},load:function(b,a,c,g){void 0===b&&(b="");void 0!==this.path&&(b=this.path+b);b=this.manager.resolveURL(b);var d=this,f=Wb.get(b);if(void 0!==f)return d.manager.itemStart(b),setTimeout(function(){a&&
  a(f);d.manager.itemEnd(b)},0),f;fetch(b).then(function(b){return b.blob()}).then(function(b){return createImageBitmap(b,d.options)}).then(function(c){Wb.add(b,c);a&&a(c);d.manager.itemEnd(b)}).catch(function(a){g&&g(a);d.manager.itemEnd(b);d.manager.itemError(b)})},setCrossOrigin:function(){return this},setPath:function(b){this.path=b;return this}};Object.assign(nf.prototype,{moveTo:function(b,a){this.currentPath=new bb;this.subPaths.push(this.currentPath);this.currentPath.moveTo(b,a)},lineTo:function(b,
  a){this.currentPath.lineTo(b,a)},quadraticCurveTo:function(b,a,c,g){this.currentPath.quadraticCurveTo(b,a,c,g)},bezierCurveTo:function(b,a,c,g,d,f){this.currentPath.bezierCurveTo(b,a,c,g,d,f)},splineThru:function(b){this.currentPath.splineThru(b)},toShapes:function(b,a){function c(b){for(var a=[],e=0,g=b.length;e<g;e++){var d=b[e],h=new xb;h.curves=d.curves;a.push(h)}return a}function g(b,a){for(var c=a.length,e=!1,d=c-1,h=0;h<c;d=h++){var k=a[d],f=a[h],n=f.x-k.x,l=f.y-k.y;if(Math.abs(l)>Number.EPSILON){if(0>
  l&&(k=a[h],n=-n,f=a[d],l=-l),!(b.y<k.y||b.y>f.y))if(b.y===k.y){if(b.x===k.x)return!0}else{d=l*(b.x-k.x)-n*(b.y-k.y);if(0===d)return!0;0>d||(e=!e)}}else if(b.y===k.y&&(f.x<=b.x&&b.x<=k.x||k.x<=b.x&&b.x<=f.x))return!0}return e}var d=ob.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===a)return c(f);var n,l,m,s=[];if(1===f.length)return l=f[0],m=new xb,m.curves=l.curves,s.push(m),s;var q=!d(f[0].getPoints()),q=b?!q:q;m=[];var r=[],t=[],u=0,w;r[u]=void 0;t[u]=[];for(var G=0,v=f.length;G<v;G++)l=
  f[G],w=l.getPoints(),n=d(w),(n=b?!n:n)?(!q&&r[u]&&u++,r[u]={s:new xb,p:w},r[u].s.curves=l.curves,q&&u++,t[u]=[]):t[u].push({h:l,p:w[0]});if(!r[0])return c(f);if(1<r.length){G=!1;l=[];d=0;for(f=r.length;d<f;d++)m[d]=[];d=0;for(f=r.length;d<f;d++)for(n=t[d],q=0;q<n.length;q++){u=n[q];w=!0;for(v=0;v<r.length;v++)g(u.p,r[v].p)&&(d!==v&&l.push({froms:d,tos:v,hole:q}),w?(w=!1,m[v].push(u)):G=!0);w&&m[d].push(u)}0<l.length&&(G||(t=m))}G=0;for(d=r.length;G<d;G++)for(m=r[G].s,s.push(m),l=t[G],f=0,n=l.length;f<
  n;f++)m.holes.push(l[f].h);return s}});Object.assign(of.prototype,{isFont:!0,generateShapes:function(b,a){void 0===a&&(a=100);for(var c=[],g=a,d=this.data,f=Array.from?Array.from(b):String(b).split(""),n=g/d.resolution,l=(d.boundingBox.yMax-d.boundingBox.yMin+d.underlineThickness)*n,g=[],m=0,s=0,q=0;q<f.length;q++){var r=f[q];if("\n"===r)m=0,s-=l;else{var t;t=n;var u=m,w=s;if(r=d.glyphs[r]||d.glyphs["?"]){var G=new nf,v=void 0,A=void 0,x=A=v=void 0,S=void 0,K=void 0,I=void 0;if(r.o)for(var y=r._cachedOutline||
  (r._cachedOutline=r.o.split(" ")),C=0,H=y.length;C<H;)switch(y[C++]){case "m":v=y[C++]*t+u;A=y[C++]*t+w;G.moveTo(v,A);break;case "l":v=y[C++]*t+u;A=y[C++]*t+w;G.lineTo(v,A);break;case "q":v=y[C++]*t+u;A=y[C++]*t+w;x=y[C++]*t+u;S=y[C++]*t+w;G.quadraticCurveTo(x,S,v,A);break;case "b":v=y[C++]*t+u,A=y[C++]*t+w,x=y[C++]*t+u,S=y[C++]*t+w,K=y[C++]*t+u,I=y[C++]*t+w,G.bezierCurveTo(x,S,K,I,v,A)}t={offsetX:r.ha*t,path:G}}else t=void 0;m+=t.offsetX;g.push(t.path)}}d=0;for(f=g.length;d<f;d++)Array.prototype.push.apply(c,
  g[d].toShapes());return c}});Object.assign(Ah.prototype,{load:function(b,a,c,g){var d=this,f=new Xa(this.manager);f.setPath(this.path);f.load(b,function(b){var c;try{c=JSON.parse(b)}catch(g){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),c=JSON.parse(b.substring(65,b.length-2))}b=d.parse(c);a&&a(b)},c,g)},parse:function(b){return new of(b)},setPath:function(b){this.path=b;return this}});var ye,rf={getContext:function(){void 0===ye&&(ye=new (window.AudioContext||
  window.webkitAudioContext));return ye},setContext:function(b){ye=b}};Object.assign(pf.prototype,{load:function(b,a,c,g){var d=new Xa(this.manager);d.setResponseType("arraybuffer");d.load(b,function(b){b=b.slice(0);rf.getContext().decodeAudioData(b,function(b){a(b)})},c,g)}});Object.assign(Bh.prototype,{update:function(){var b,a,c,g,d,n,l,m,s=new f,q=new f;return function(f){if(b!==this||a!==f.focus||c!==f.fov||g!==f.aspect*this.aspect||d!==f.near||n!==f.far||l!==f.zoom||m!==this.eyeSep){b=this;a=
  f.focus;c=f.fov;g=f.aspect*this.aspect;d=f.near;n=f.far;l=f.zoom;var r=f.projectionMatrix.clone();m=this.eyeSep/2;var t=m*d/a,u=d*Math.tan(ga.DEG2RAD*c*0.5)/l,w,G;q.elements[12]=-m;s.elements[12]=m;w=-u*g+t;G=u*g+t;r.elements[0]=2*d/(G-w);r.elements[8]=(G+w)/(G-w);this.cameraL.projectionMatrix.copy(r);w=-u*g-t;G=u*g-t;r.elements[0]=2*d/(G-w);r.elements[8]=(G+w)/(G-w);this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(f.matrixWorld).multiply(q);this.cameraR.matrixWorld.copy(f.matrixWorld).multiply(s)}}()});
  yd.prototype=Object.create(D.prototype);yd.prototype.constructor=yd;qf.prototype=Object.assign(Object.create(D.prototype),{constructor:qf,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(b){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):
  this.gain.disconnect(this.context.destination);this.filter=b;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(b){this.gain.gain.setTargetAtTime(b,this.context.currentTime,0.01);return this},updateMatrixWorld:function(){var b=new m,a=new l,c=new m,g=new m;return function(d){D.prototype.updateMatrixWorld.call(this,d);d=this.context.listener;var f=this.up;this.matrixWorld.decompose(b,
  a,c);g.set(0,0,-1).applyQuaternion(a);d.positionX?(d.positionX.setValueAtTime(b.x,this.context.currentTime),d.positionY.setValueAtTime(b.y,this.context.currentTime),d.positionZ.setValueAtTime(b.z,this.context.currentTime),d.forwardX.setValueAtTime(g.x,this.context.currentTime),d.forwardY.setValueAtTime(g.y,this.context.currentTime),d.forwardZ.setValueAtTime(g.z,this.context.currentTime),d.upX.setValueAtTime(f.x,this.context.currentTime),d.upY.setValueAtTime(f.y,this.context.currentTime),d.upZ.setValueAtTime(f.z,
  this.context.currentTime)):(d.setPosition(b.x,b.y,b.z),d.setOrientation(g.x,g.y,g.z,f.x,f.y,f.z))}}()});Dc.prototype=Object.assign(Object.create(D.prototype),{constructor:Dc,getOutput:function(){return this.gain},setNodeSource:function(b){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=b;this.connect();return this},setMediaElementSource:function(b){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(b);this.connect();return this},
  setBuffer:function(b){this.buffer=b;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var b=this.context.createBufferSource();b.buffer=this.buffer;b.loop=this.loop;b.onended=this.onEnded.bind(this);b.playbackRate.setValueAtTime(this.playbackRate,this.startTime);this.startTime=this.context.currentTime;
  b.start(this.startTime,this.offset);this.isPlaying=!0;this.source=b;return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),
  this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var b=1,a=this.filters.length;b<a;b++)this.filters[b-1].connect(this.filters[b]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var b=1,a=this.filters.length;b<a;b++)this.filters[b-1].disconnect(this.filters[b]);
  this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(b){b||(b=[]);!0===this.isPlaying?(this.disconnect(),this.filters=b,this.connect()):this.filters=b;return this},getFilter:function(){return this.getFilters()[0]},setFilter:function(b){return this.setFilters(b?[b]:[])},setPlaybackRate:function(b){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");
  else return this.playbackRate=b,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(b){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.loop=
  b,!0===this.isPlaying&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(b){this.gain.gain.setTargetAtTime(b,this.context.currentTime,0.01);return this}});sf.prototype=Object.assign(Object.create(Dc.prototype),{constructor:sf,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(b){this.panner.refDistance=b;return this},getRolloffFactor:function(){return this.panner.rolloffFactor},
  setRolloffFactor:function(b){this.panner.rolloffFactor=b;return this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(b){this.panner.distanceModel=b;return this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(b){this.panner.maxDistance=b;return this},setDirectionalCone:function(b,a,c){this.panner.coneInnerAngle=b;this.panner.coneOuterAngle=a;this.panner.coneOuterGain=c;return this},updateMatrixWorld:function(){var b=new m,
  a=new l,c=new m,g=new m;return function(d){D.prototype.updateMatrixWorld.call(this,d);d=this.panner;this.matrixWorld.decompose(b,a,c);g.set(0,0,1).applyQuaternion(a);d.setPosition(b.x,b.y,b.z);d.setOrientation(g.x,g.y,g.z)}}()});Object.assign(tf.prototype,{getFrequencyData:function(){this.analyser.getByteFrequencyData(this.data);return this.data},getAverageFrequency:function(){for(var b=0,a=this.getFrequencyData(),c=0;c<a.length;c++)b+=a[c];return b/a.length}});Object.assign(uf.prototype,{accumulate:function(b,
  a){var c=this.buffer,g=this.valueSize,d=b*g+g,f=this.cumulativeWeight;if(0===f){for(f=0;f!==g;++f)c[d+f]=c[f];f=a}else f+=a,this._mixBufferRegion(c,d,0,a/f,g);this.cumulativeWeight=f},apply:function(b){var a=this.valueSize,c=this.buffer;b=b*a+a;var g=this.cumulativeWeight,d=this.binding;this.cumulativeWeight=0;1>g&&this._mixBufferRegion(c,b,3*a,1-g,a);for(var g=a,f=a+a;g!==f;++g)if(c[g]!==c[g+a]){d.setValue(c,b);break}},saveOriginalState:function(){var b=this.buffer,a=this.valueSize,c=3*a;this.binding.getValue(b,
  c);for(var g=a;g!==c;++g)b[g]=b[c+g%a];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(b,a,c,g,d){if(0.5<=g)for(g=0;g!==d;++g)b[a+g]=b[c+g]},_slerp:function(b,a,c,g){l.slerpFlat(b,a,b,a,b,c,g)},_lerp:function(b,a,c,g,d){for(var f=1-g,n=0;n!==d;++n){var l=a+n;b[l]=b[l]*f+b[c+n]*g}}});Object.assign(Ch.prototype,{getValue:function(b,a){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(b,
  a)},setValue:function(b,a){for(var c=this._bindings,g=this._targetGroup.nCachedObjects_,d=c.length;g!==d;++g)c[g].setValue(b,a)},bind:function(){for(var b=this._bindings,a=this._targetGroup.nCachedObjects_,c=b.length;a!==c;++a)b[a].bind()},unbind:function(){for(var b=this._bindings,a=this._targetGroup.nCachedObjects_,c=b.length;a!==c;++a)b[a].unbind()}});Object.assign(ua,{Composite:Ch,create:function(b,a,c){return b&&b.isAnimationObjectGroup?new ua.Composite(b,a,c):new ua(b,a,c)},sanitizeNodeName:function(){var b=
  /[\[\]\.:\/]/g;return function(a){return a.replace(/\s/g,"_").replace(b,"")}}(),parseTrackName:function(){var b="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",a=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),b=/(WCOD+)?/.source.replace("WCOD",b),c=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),g=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),d=RegExp("^"+a+b+c+g+"$"),f=["material","materials","bones"];return function(b){var a=d.exec(b);if(!a)throw Error("PropertyBinding: Cannot parse trackName: "+
  b);var a={nodeName:a[2],objectName:a[3],objectIndex:a[4],propertyName:a[5],propertyIndex:a[6]},c=a.nodeName&&a.nodeName.lastIndexOf(".");if(void 0!==c&&-1!==c){var e=a.nodeName.substring(c+1);-1!==f.indexOf(e)&&(a.nodeName=a.nodeName.substring(0,c),a.objectName=e)}if(null===a.propertyName||0===a.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+b);return a}}(),findNode:function(b,a){if(!a||""===a||"root"===a||"."===a||-1===a||a===b.name||a===b.uuid)return b;
  if(b.skeleton){var c=b.skeleton.getBoneByName(a);if(void 0!==c)return c}if(b.children){var g=function(b){for(var c=0;c<b.length;c++){var d=b[c];if(d.name===a||d.uuid===a||(d=g(d.children)))return d}return null};if(c=g(b.children))return c}return null}});Object.assign(ua.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(b,
  a){b[a]=this.node[this.propertyName]},function(b,a){for(var c=this.resolvedProperty,g=0,d=c.length;g!==d;++g)b[a++]=c[g]},function(b,a){b[a]=this.resolvedProperty[this.propertyIndex]},function(b,a){this.resolvedProperty.toArray(b,a)}],SetterByBindingTypeAndVersioning:[[function(b,a){this.targetObject[this.propertyName]=b[a]},function(b,a){this.targetObject[this.propertyName]=b[a];this.targetObject.needsUpdate=!0},function(b,a){this.targetObject[this.propertyName]=b[a];this.targetObject.matrixWorldNeedsUpdate=
  !0}],[function(b,a){for(var c=this.resolvedProperty,g=0,d=c.length;g!==d;++g)c[g]=b[a++]},function(b,a){for(var c=this.resolvedProperty,g=0,d=c.length;g!==d;++g)c[g]=b[a++];this.targetObject.needsUpdate=!0},function(b,a){for(var c=this.resolvedProperty,g=0,d=c.length;g!==d;++g)c[g]=b[a++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(b,a){this.resolvedProperty[this.propertyIndex]=b[a]},function(b,a){this.resolvedProperty[this.propertyIndex]=b[a];this.targetObject.needsUpdate=!0},function(b,
  a){this.resolvedProperty[this.propertyIndex]=b[a];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(b,a){this.resolvedProperty.fromArray(b,a)},function(b,a){this.resolvedProperty.fromArray(b,a);this.targetObject.needsUpdate=!0},function(b,a){this.resolvedProperty.fromArray(b,a);this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(b,a){this.bind();this.getValue(b,a)},setValue:function(b,a){this.bind();this.setValue(b,a)},bind:function(){var b=this.node,a=this.parsedPath,c=a.objectName,
  g=a.propertyName,d=a.propertyIndex;b||(this.node=b=ua.findNode(this.rootNode,a.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(b){if(c){var f=a.objectIndex;switch(c){case "materials":if(!b.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!b.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",
  this);return}b=b.material.materials;break;case "bones":if(!b.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}b=b.skeleton.bones;for(c=0;c<b.length;c++)if(b[c].name===f){f=c;break}break;default:if(void 0===b[c]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}b=b[c]}if(void 0!==f){if(void 0===b[f]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",
  this,b);return}b=b[f]}}f=b[g];if(void 0===f)console.error("THREE.PropertyBinding: Trying to update property for track: "+a.nodeName+"."+g+" but it wasn't found.",b);else{a=this.Versioning.None;this.targetObject=b;void 0!==b.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==b.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);c=this.BindingType.Direct;if(void 0!==d){if("morphTargetInfluences"===g){if(!b.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",
  this);return}if(b.geometry.isBufferGeometry){if(!b.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}for(c=0;c<this.node.geometry.morphAttributes.position.length;c++)if(b.geometry.morphAttributes.position[c].name===d){d=c;break}}else{if(!b.geometry.morphTargets){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",
  this);return}for(c=0;c<this.node.geometry.morphTargets.length;c++)if(b.geometry.morphTargets[c].name===d){d=c;break}}}c=this.BindingType.ArrayElement;this.resolvedProperty=f;this.propertyIndex=d}else void 0!==f.fromArray&&void 0!==f.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(c=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=g;this.getValue=this.GetterByBindingType[c];this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+
  this.path+" but it wasn't found.")},unbind:function(){this.node=null;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}});Object.assign(ua.prototype,{_getValue_unbound:ua.prototype.getValue,_setValue_unbound:ua.prototype.setValue});Object.assign(Dh.prototype,{isAnimationObjectGroup:!0,add:function(){for(var b=this._objects,a=b.length,c=this.nCachedObjects_,g=this._indicesByUUID,d=this._paths,f=this._parsedPaths,n=this._bindings,l=n.length,m=void 0,s=0,q=arguments.length;s!==
  q;++s){var r=arguments[s],t=r.uuid,u=g[t];if(void 0===u){u=a++;g[t]=u;b.push(r);for(var t=0,w=l;t!==w;++t)n[t].push(new ua(r,d[t],f[t]))}else if(u<c){var m=b[u],G=--c,w=b[G];g[w.uuid]=u;b[u]=w;g[t]=G;b[G]=r;t=0;for(w=l;t!==w;++t){var v=n[t],A=v[u];v[u]=v[G];void 0===A&&(A=new ua(r,d[t],f[t]));v[G]=A}}else b[u]!==m&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=
  c},remove:function(){for(var b=this._objects,a=this.nCachedObjects_,c=this._indicesByUUID,g=this._bindings,d=g.length,f=0,n=arguments.length;f!==n;++f){var l=arguments[f],m=l.uuid,s=c[m];if(void 0!==s&&s>=a){var q=a++,r=b[q];c[r.uuid]=s;b[s]=r;c[m]=q;b[q]=l;l=0;for(m=d;l!==m;++l){var r=g[l],t=r[s];r[s]=r[q];r[q]=t}}}this.nCachedObjects_=a},uncache:function(){for(var b=this._objects,a=b.length,c=this.nCachedObjects_,g=this._indicesByUUID,d=this._bindings,f=d.length,n=0,l=arguments.length;n!==l;++n){var m=
  arguments[n].uuid,s=g[m];if(void 0!==s)if(delete g[m],s<c){var m=--c,q=b[m],r=--a,t=b[r];g[q.uuid]=s;b[s]=q;g[t.uuid]=m;b[m]=t;b.pop();q=0;for(t=f;q!==t;++q){var u=d[q],w=u[r];u[s]=u[m];u[m]=w;u.pop()}}else for(r=--a,t=b[r],g[t.uuid]=s,b[s]=t,b.pop(),q=0,t=f;q!==t;++q)u=d[q],u[s]=u[r],u.pop()}this.nCachedObjects_=c},subscribe_:function(b,a){var c=this._bindingsIndicesByPath,g=c[b],d=this._bindings;if(void 0!==g)return d[g];var f=this._paths,n=this._parsedPaths,l=this._objects,m=this.nCachedObjects_,
  s=Array(l.length),g=d.length;c[b]=g;f.push(b);n.push(a);d.push(s);c=m;for(g=l.length;c!==g;++c)s[c]=new ua(l[c],b,a);return s},unsubscribe_:function(b){var a=this._bindingsIndicesByPath,c=a[b];if(void 0!==c){var g=this._paths,d=this._parsedPaths,f=this._bindings,n=f.length-1,l=f[n];a[b[n]]=c;f[c]=l;f.pop();d[c]=d[n];d.pop();g[c]=g[n];g.pop()}}});Object.assign(Eh.prototype,{play:function(){this._mixer._activateAction(this);return this},stop:function(){this._mixer._deactivateAction(this);return this.reset()},
  reset:function(){this.paused=!1;this.enabled=!0;this.time=0;this._loopCount=-1;this._startTime=null;return this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(b){this._startTime=b;return this},setLoop:function(b,a){this.loop=b;this.repetitions=a;return this},setEffectiveWeight:function(b){this.weight=b;
  this._effectiveWeight=this.enabled?b:0;return this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(b){return this._scheduleFading(b,0,1)},fadeOut:function(b){return this._scheduleFading(b,1,0)},crossFadeFrom:function(b,a,c){b.fadeOut(a);this.fadeIn(a);if(c){c=this._clip.duration;var g=b._clip.duration,d=c/g;b.warp(1,g/c,a);this.warp(d,1,a)}return this},crossFadeTo:function(b,a,c){return b.crossFadeFrom(this,a,c)},stopFading:function(){var b=this._weightInterpolant;
  null!==b&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(b));return this},setEffectiveTimeScale:function(b){this.timeScale=b;this._effectiveTimeScale=this.paused?0:b;return this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(b){this.timeScale=this._clip.duration/b;return this.stopWarping()},syncWith:function(b){this.time=b.time;this.timeScale=b.timeScale;return this.stopWarping()},halt:function(b){return this.warp(this._effectiveTimeScale,
  0,b)},warp:function(b,a,c){var g=this._mixer,d=g.time,f=this._timeScaleInterpolant,n=this.timeScale;null===f&&(this._timeScaleInterpolant=f=g._lendControlInterpolant());g=f.parameterPositions;f=f.sampleValues;g[0]=d;g[1]=d+c;f[0]=b/n;f[1]=a/n;return this},stopWarping:function(){var b=this._timeScaleInterpolant;null!==b&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(b));return this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||
  this._mixer._root},_update:function(b,a,c,g){if(this.enabled){var d=this._startTime;if(null!==d){a=(b-d)*c;if(0>a||0===c)return;this._startTime=null;a*=c}a*=this._updateTimeScale(b);c=this._updateTime(a);b=this._updateWeight(b);if(0<b){a=this._interpolants;for(var d=this._propertyBindings,f=0,n=a.length;f!==n;++f)a[f].evaluate(c),d[f].accumulate(g,b)}}else this._updateWeight(b)},_updateWeight:function(b){var a=0;if(this.enabled){var a=this.weight,c=this._weightInterpolant;if(null!==c){var g=c.evaluate(b)[0],
  a=a*g;b>c.parameterPositions[1]&&(this.stopFading(),0===g&&(this.enabled=!1))}}return this._effectiveWeight=a},_updateTimeScale:function(b){var a=0;if(!this.paused){var a=this.timeScale,c=this._timeScaleInterpolant;if(null!==c){var g=c.evaluate(b)[0],a=a*g;b>c.parameterPositions[1]&&(this.stopWarping(),0===a?this.paused=!0:this.timeScale=a)}}return this._effectiveTimeScale=a},_updateTime:function(b){var a=this.time+b,c=this._clip.duration,g=this.loop,d=this._loopCount,f=2202===g;if(0===b)return-1===
  d?a:f&&1===(d&1)?c-a:a;if(2200===g)a:{if(-1===d&&(this._loopCount=0,this._setEndings(!0,!0,!1)),a>=c)a=c;else if(0>a)a=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>b?-1:1})}else{-1===d&&(0<=b?(d=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f));if(a>=c||0>a){var g=Math.floor(a/c),a=a-c*g,d=d+Math.abs(g),n=this.repetitions-d;0>=n?(this.clampWhenFinished?this.paused=!0:
  this.enabled=!1,a=0<b?c:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<b?1:-1})):(1===n?(b=0>b,this._setEndings(b,!b,f)):this._setEndings(!1,!1,f),this._loopCount=d,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:g}))}if(f&&1===(d&1))return this.time=a,c-a}return this.time=a},_setEndings:function(b,a,c){var g=this._interpolantSettings;c?(g.endingStart=2401,g.endingEnd=2401):(g.endingStart=b?this.zeroSlopeAtStart?2401:Sb:2402,g.endingEnd=a?this.zeroSlopeAtEnd?2401:
  Sb:2402)},_scheduleFading:function(b,a,c){var g=this._mixer,d=g.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=g._lendControlInterpolant());g=f.parameterPositions;f=f.sampleValues;g[0]=d;f[0]=a;g[1]=d+b;f[1]=c;return this}});vf.prototype=Object.assign(Object.create(c.prototype),{constructor:vf,_bindAction:function(b,a){var c=b._localRoot||this._root,g=b._clip.tracks,d=g.length,f=b._propertyBindings,n=b._interpolants,l=c.uuid,m=this._bindingsByRootAndName,s=m[l];void 0===s&&(s=
  {},m[l]=s);for(m=0;m!==d;++m){var q=g[m],r=q.name,t=s[r];if(void 0===t){t=f[m];if(void 0!==t){null===t._cacheIndex&&(++t.referenceCount,this._addInactiveBinding(t,l,r));continue}t=new uf(ua.create(c,r,a&&a._propertyBindings[m].binding.parsedPath),q.ValueTypeName,q.getValueSize());++t.referenceCount;this._addInactiveBinding(t,l,r)}f[m]=t;n[m].resultBuffer=t.buffer}},_activateAction:function(b){if(!this._isActiveAction(b)){if(null===b._cacheIndex){var a=(b._localRoot||this._root).uuid,c=b._clip.uuid,
  g=this._actionsByClip[c];this._bindAction(b,g&&g.knownActions[0]);this._addInactiveAction(b,c,a)}a=b._propertyBindings;c=0;for(g=a.length;c!==g;++c){var d=a[c];0===d.useCount++&&(this._lendBinding(d),d.saveOriginalState())}this._lendAction(b)}},_deactivateAction:function(b){if(this._isActiveAction(b)){for(var a=b._propertyBindings,c=0,g=a.length;c!==g;++c){var d=a[c];0===--d.useCount&&(d.restoreOriginalState(),this._takeBackBinding(d))}this._takeBackAction(b)}},_initMemoryManager:function(){this._actions=
  [];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var b=this;this.stats={actions:{get total(){return b._actions.length},get inUse(){return b._nActiveActions}},bindings:{get total(){return b._bindings.length},get inUse(){return b._nActiveBindings}},controlInterpolants:{get total(){return b._controlInterpolants.length},get inUse(){return b._nActiveControlInterpolants}}}},
  _isActiveAction:function(b){b=b._cacheIndex;return null!==b&&b<this._nActiveActions},_addInactiveAction:function(b,a,c){var g=this._actions,d=this._actionsByClip,f=d[a];void 0===f?(f={knownActions:[b],actionByRoot:{}},b._byClipCacheIndex=0,d[a]=f):(a=f.knownActions,b._byClipCacheIndex=a.length,a.push(b));b._cacheIndex=g.length;g.push(b);f.actionByRoot[c]=b},_removeInactiveAction:function(b){var a=this._actions,c=a[a.length-1],g=b._cacheIndex;c._cacheIndex=g;a[g]=c;a.pop();b._cacheIndex=null;var a=
  b._clip.uuid,c=this._actionsByClip,g=c[a],d=g.knownActions,f=d[d.length-1],n=b._byClipCacheIndex;f._byClipCacheIndex=n;d[n]=f;d.pop();b._byClipCacheIndex=null;delete g.actionByRoot[(b._localRoot||this._root).uuid];0===d.length&&delete c[a];this._removeInactiveBindingsForAction(b)},_removeInactiveBindingsForAction:function(b){b=b._propertyBindings;for(var a=0,c=b.length;a!==c;++a){var g=b[a];0===--g.referenceCount&&this._removeInactiveBinding(g)}},_lendAction:function(b){var a=this._actions,c=b._cacheIndex,
  g=this._nActiveActions++,d=a[g];b._cacheIndex=g;a[g]=b;d._cacheIndex=c;a[c]=d},_takeBackAction:function(b){var a=this._actions,c=b._cacheIndex,g=--this._nActiveActions,d=a[g];b._cacheIndex=g;a[g]=b;d._cacheIndex=c;a[c]=d},_addInactiveBinding:function(b,a,c){var g=this._bindingsByRootAndName,d=g[a],f=this._bindings;void 0===d&&(d={},g[a]=d);d[c]=b;b._cacheIndex=f.length;f.push(b)},_removeInactiveBinding:function(b){var a=this._bindings,c=b.binding,g=c.rootNode.uuid,c=c.path,d=this._bindingsByRootAndName,
  f=d[g],n=a[a.length-1];b=b._cacheIndex;n._cacheIndex=b;a[b]=n;a.pop();delete f[c];a:{for(var l in f)break a;delete d[g]}},_lendBinding:function(b){var a=this._bindings,c=b._cacheIndex,g=this._nActiveBindings++,d=a[g];b._cacheIndex=g;a[g]=b;d._cacheIndex=c;a[c]=d},_takeBackBinding:function(b){var a=this._bindings,c=b._cacheIndex,g=--this._nActiveBindings,d=a[g];b._cacheIndex=g;a[g]=b;d._cacheIndex=c;a[c]=d},_lendControlInterpolant:function(){var b=this._controlInterpolants,a=this._nActiveControlInterpolants++,
  c=b[a];void 0===c&&(c=new wd(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),c.__cacheIndex=a,b[a]=c);return c},_takeBackControlInterpolant:function(b){var a=this._controlInterpolants,c=b.__cacheIndex,g=--this._nActiveControlInterpolants,d=a[g];b.__cacheIndex=g;a[g]=b;d.__cacheIndex=c;a[c]=d},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(b,a){var c=a||this._root,g=c.uuid,d="string"===typeof b?Ua.findByName(c,b):b,c=null!==d?d.uuid:b,f=this._actionsByClip[c],
  n=null;if(void 0!==f){n=f.actionByRoot[g];if(void 0!==n)return n;n=f.knownActions[0];null===d&&(d=n._clip)}if(null===d)return null;d=new Eh(this,d,a);this._bindAction(d,n);this._addInactiveAction(d,c,g);return d},existingAction:function(b,a){var c=a||this._root,g=c.uuid,c="string"===typeof b?Ua.findByName(c,b):b,c=this._actionsByClip[c?c.uuid:b];return void 0!==c?c.actionByRoot[g]||null:null},stopAllAction:function(){for(var b=this._actions,a=this._nActiveActions,c=this._bindings,g=this._nActiveBindings,
  d=this._nActiveBindings=this._nActiveActions=0;d!==a;++d)b[d].reset();for(d=0;d!==g;++d)c[d].useCount=0;return this},update:function(b){b*=this.timeScale;for(var a=this._actions,c=this._nActiveActions,g=this.time+=b,d=Math.sign(b),f=this._accuIndex^=1,n=0;n!==c;++n)a[n]._update(g,b,d,f);b=this._bindings;a=this._nActiveBindings;for(n=0;n!==a;++n)b[n].apply(f);return this},getRoot:function(){return this._root},uncacheClip:function(b){var a=this._actions;b=b.uuid;var c=this._actionsByClip,g=c[b];if(void 0!==
  g){for(var g=g.knownActions,d=0,f=g.length;d!==f;++d){var n=g[d];this._deactivateAction(n);var l=n._cacheIndex,m=a[a.length-1];n._cacheIndex=null;n._byClipCacheIndex=null;m._cacheIndex=l;a[l]=m;a.pop();this._removeInactiveBindingsForAction(n)}delete c[b]}},uncacheRoot:function(b){b=b.uuid;var a=this._actionsByClip,c;for(c in a){var g=a[c].actionByRoot[b];void 0!==g&&(this._deactivateAction(g),this._removeInactiveAction(g))}c=this._bindingsByRootAndName[b];if(void 0!==c)for(var d in c)b=c[d],b.restoreOriginalState(),
  this._removeInactiveBinding(b)},uncacheAction:function(b,a){var c=this.existingAction(b,a);null!==c&&(this._deactivateAction(c),this._removeInactiveAction(c))}});ue.prototype.clone=function(){return new ue(void 0===this.value.clone?this.value:this.value.clone())};wf.prototype=Object.assign(Object.create(M.prototype),{constructor:wf,isInstancedBufferGeometry:!0,copy:function(b){M.prototype.copy.call(this,b);this.maxInstancedCount=b.maxInstancedCount;return this},clone:function(){return(new this.constructor).copy(this)}});
  xf.prototype=Object.assign(Object.create(Cb.prototype),{constructor:xf,isInstancedInterleavedBuffer:!0,copy:function(b){Cb.prototype.copy.call(this,b);this.meshPerAttribute=b.meshPerAttribute;return this}});yf.prototype=Object.assign(Object.create(n.prototype),{constructor:yf,isInstancedBufferAttribute:!0,copy:function(b){n.prototype.copy.call(this,b);this.meshPerAttribute=b.meshPerAttribute;return this}});Object.assign(Gh.prototype,{linePrecision:1,set:function(b,a){this.ray.set(b,a)},setFromCamera:function(b,
  a){a&&a.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(a.matrixWorld),this.ray.direction.set(b.x,b.y,0.5).unproject(a).sub(this.ray.origin).normalize()):a&&a.isOrthographicCamera?(this.ray.origin.set(b.x,b.y,(a.near+a.far)/(a.near-a.far)).unproject(a),this.ray.direction.set(0,0,-1).transformDirection(a.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(b,a,c){c=c||[];zf(b,this,c,a);c.sort(Hh);return c},intersectObjects:function(b,a,c){c=
  c||[];if(!1===Array.isArray(b))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),c;for(var g=0,d=b.length;g<d;g++)zf(b[g],this,c,a);c.sort(Hh);return c}});Object.assign(Ih.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var b=
  0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var a=("undefined"===typeof performance?Date:performance).now(),b=(a-this.oldTime)/1E3;this.oldTime=a;this.elapsedTime+=b}return b}});Object.assign(Jh.prototype,{set:function(b,a,c){this.radius=b;this.phi=a;this.theta=c;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.radius=b.radius;this.phi=b.phi;this.theta=b.theta;return this},makeSafe:function(){this.phi=Math.max(1E-6,Math.min(Math.PI-
  1E-6,this.phi));return this},setFromVector3:function(b){return this.setFromCartesianCoords(b.x,b.y,b.z)},setFromCartesianCoords:function(b,a,c){this.radius=Math.sqrt(b*b+a*a+c*c);0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(b,c),this.phi=Math.acos(ga.clamp(a/this.radius,-1,1)));return this}});Object.assign(Kh.prototype,{set:function(b,a,c){this.radius=b;this.theta=a;this.y=c;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.radius=b.radius;
  this.theta=b.theta;this.y=b.y;return this},setFromVector3:function(b){return this.setFromCartesianCoords(b.x,b.y,b.z)},setFromCartesianCoords:function(b,a,c){this.radius=Math.sqrt(b*b+c*c);this.theta=Math.atan2(b,c);this.y=a;return this}});Object.assign(Af.prototype,{set:function(b,a){this.min.copy(b);this.max.copy(a);return this},setFromPoints:function(b){this.makeEmpty();for(var a=0,c=b.length;a<c;a++)this.expandByPoint(b[a]);return this},setFromCenterAndSize:function(){var b=new d;return function(a,
  c){var g=b.copy(c).multiplyScalar(0.5);this.min.copy(a).sub(g);this.max.copy(a).add(g);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.min.copy(b.min);this.max.copy(b.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(b){void 0===b&&(console.warn("THREE.Box2: .getCenter() target is now required"),
  b=new d);return this.isEmpty()?b.set(0,0):b.addVectors(this.min,this.max).multiplyScalar(0.5)},getSize:function(b){void 0===b&&(console.warn("THREE.Box2: .getSize() target is now required"),b=new d);return this.isEmpty()?b.set(0,0):b.subVectors(this.max,this.min)},expandByPoint:function(b){this.min.min(b);this.max.max(b);return this},expandByVector:function(b){this.min.sub(b);this.max.add(b);return this},expandByScalar:function(b){this.min.addScalar(-b);this.max.addScalar(b);return this},containsPoint:function(b){return b.x<
  this.min.x||b.x>this.max.x||b.y<this.min.y||b.y>this.max.y?!1:!0},containsBox:function(b){return this.min.x<=b.min.x&&b.max.x<=this.max.x&&this.min.y<=b.min.y&&b.max.y<=this.max.y},getParameter:function(b,a){void 0===a&&(console.warn("THREE.Box2: .getParameter() target is now required"),a=new d);return a.set((b.x-this.min.x)/(this.max.x-this.min.x),(b.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(b){return b.max.x<this.min.x||b.min.x>this.max.x||b.max.y<this.min.y||b.min.y>this.max.y?
  !1:!0},clampPoint:function(b,a){void 0===a&&(console.warn("THREE.Box2: .clampPoint() target is now required"),a=new d);return a.copy(b).clamp(this.min,this.max)},distanceToPoint:function(){var b=new d;return function(a){return b.copy(a).clamp(this.min,this.max).sub(a).length()}}(),intersect:function(b){this.min.max(b.min);this.max.min(b.max);return this},union:function(b){this.min.min(b.min);this.max.max(b.max);return this},translate:function(b){this.min.add(b);this.max.add(b);return this},equals:function(b){return b.min.equals(this.min)&&
  b.max.equals(this.max)}});Object.assign(Bf.prototype,{set:function(b,a){this.start.copy(b);this.end.copy(a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(b){this.start.copy(b.start);this.end.copy(b.end);return this},getCenter:function(b){void 0===b&&(console.warn("THREE.Line3: .getCenter() target is now required"),b=new m);return b.addVectors(this.start,this.end).multiplyScalar(0.5)},delta:function(b){void 0===b&&(console.warn("THREE.Line3: .delta() target is now required"),
  b=new m);return b.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(b,a){void 0===a&&(console.warn("THREE.Line3: .at() target is now required"),a=new m);return this.delta(a).multiplyScalar(b).add(this.start)},closestPointToPointParameter:function(){var b=new m,a=new m;return function(c,g){b.subVectors(c,this.start);a.subVectors(this.end,this.start);var d=a.dot(a),d=a.dot(b)/
  d;g&&(d=ga.clamp(d,0,1));return d}}(),closestPointToPoint:function(b,a,c){b=this.closestPointToPointParameter(b,a);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new m);return this.delta(c).multiplyScalar(b).add(this.start)},applyMatrix4:function(b){this.start.applyMatrix4(b);this.end.applyMatrix4(b);return this},equals:function(b){return b.start.equals(this.start)&&b.end.equals(this.end)}});zd.prototype=Object.create(D.prototype);zd.prototype.constructor=
  zd;zd.prototype.isImmediateRenderObject=!0;Ad.prototype=Object.create(ra.prototype);Ad.prototype.constructor=Ad;Ad.prototype.update=function(){var b=new m,a=new m,c=new r;return function(){var g=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);var d=this.object.matrixWorld,f=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)for(var l=n.vertices,m=n.faces,s=n=0,q=m.length;s<q;s++)for(var r=m[s],t=0,u=r.vertexNormals.length;t<u;t++){var w=
  r.vertexNormals[t];b.copy(l[r[g[t]]]).applyMatrix4(d);a.copy(w).applyMatrix3(c).normalize().multiplyScalar(this.size).add(b);f.setXYZ(n,b.x,b.y,b.z);n+=1;f.setXYZ(n,a.x,a.y,a.z);n+=1}else if(n&&n.isBufferGeometry)for(g=n.attributes.position,l=n.attributes.normal,t=n=0,u=g.count;t<u;t++)b.set(g.getX(t),g.getY(t),g.getZ(t)).applyMatrix4(d),a.set(l.getX(t),l.getY(t),l.getZ(t)),a.applyMatrix3(c).normalize().multiplyScalar(this.size).add(b),f.setXYZ(n,b.x,b.y,b.z),n+=1,f.setXYZ(n,a.x,a.y,a.z),n+=1;f.needsUpdate=
  !0}}();Ec.prototype=Object.create(D.prototype);Ec.prototype.constructor=Ec;Ec.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};Ec.prototype.update=function(){var b=new m,a=new m;return function(){this.light.updateMatrixWorld();var c=this.light.distance?this.light.distance:1E3,g=c*Math.tan(this.light.angle);this.cone.scale.set(g,g,c);b.setFromMatrixPosition(this.light.matrixWorld);a.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(a.sub(b));
  void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}();Fc.prototype=Object.create(ra.prototype);Fc.prototype.constructor=Fc;Fc.prototype.updateMatrixWorld=function(){var b=new m,a=new f,c=new f;return function(g){var d=this.bones,f=this.geometry,n=f.getAttribute("position");c.getInverse(this.root.matrixWorld);for(var l=0,m=0;l<d.length;l++){var s=d[l];s.parent&&s.parent.isBone&&(a.multiplyMatrices(c,s.matrixWorld),b.setFromMatrixPosition(a),
  n.setXYZ(m,b.x,b.y,b.z),a.multiplyMatrices(c,s.parent.matrixWorld),b.setFromMatrixPosition(a),n.setXYZ(m+1,b.x,b.y,b.z),m+=2)}f.getAttribute("position").needsUpdate=!0;D.prototype.updateMatrixWorld.call(this,g)}}();Gc.prototype=Object.create(wa.prototype);Gc.prototype.constructor=Gc;Gc.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};Gc.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};Hc.prototype=
  Object.create(D.prototype);Hc.prototype.constructor=Hc;Hc.prototype.dispose=function(){this.children[0].geometry.dispose();this.children[0].material.dispose()};Hc.prototype.update=function(){var b=0.5*this.light.width,a=0.5*this.light.height,c=this.line.geometry.attributes.position,g=c.array;g[0]=b;g[1]=-a;g[2]=0;g[3]=b;g[4]=a;g[5]=0;g[6]=-b;g[7]=a;g[8]=0;g[9]=-b;g[10]=-a;g[11]=0;g[12]=b;g[13]=-a;g[14]=0;c.needsUpdate=!0;void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)};
  Ic.prototype=Object.create(D.prototype);Ic.prototype.constructor=Ic;Ic.prototype.dispose=function(){this.children[0].geometry.dispose();this.children[0].material.dispose()};Ic.prototype.update=function(){var b=new m,a=new w,c=new w;return function(){var g=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var d=g.geometry.getAttribute("color");a.copy(this.light.color);c.copy(this.light.groundColor);for(var f=0,n=d.count;f<n;f++){var l=f<n/2?a:c;d.setXYZ(f,l.r,l.g,l.b)}d.needsUpdate=
  !0}g.lookAt(b.setFromMatrixPosition(this.light.matrixWorld).negate())}}();Bd.prototype=Object.create(ra.prototype);Bd.prototype.constructor=Bd;ve.prototype=Object.create(ra.prototype);ve.prototype.constructor=ve;Cd.prototype=Object.create(ra.prototype);Cd.prototype.constructor=Cd;Cd.prototype.update=function(){var b=new m,a=new m,c=new r;return function(){this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);for(var g=this.object.matrixWorld,d=this.geometry.attributes.position,
  f=this.object.geometry,n=f.vertices,f=f.faces,l=0,m=0,s=f.length;m<s;m++){var q=f[m],r=q.normal;b.copy(n[q.a]).add(n[q.b]).add(n[q.c]).divideScalar(3).applyMatrix4(g);a.copy(r).applyMatrix3(c).normalize().multiplyScalar(this.size).add(b);d.setXYZ(l,b.x,b.y,b.z);l+=1;d.setXYZ(l,a.x,a.y,a.z);l+=1}d.needsUpdate=!0}}();Jc.prototype=Object.create(D.prototype);Jc.prototype.constructor=Jc;Jc.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();
  this.targetLine.material.dispose()};Jc.prototype.update=function(){var b=new m,a=new m,c=new m;return function(){b.setFromMatrixPosition(this.light.matrixWorld);a.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(a,b);this.lightPlane.lookAt(c);void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color));this.targetLine.lookAt(c);
  this.targetLine.scale.z=c.length()}}();Dd.prototype=Object.create(ra.prototype);Dd.prototype.constructor=Dd;Dd.prototype.update=function(){function b(b,f,n,l){g.set(f,n,l).unproject(d);b=c[b];if(void 0!==b)for(f=a.getAttribute("position"),n=0,l=b.length;n<l;n++)f.setXYZ(b[n],g.x,g.y,g.z)}var a,c,g=new m,d=new hb;return function(){a=this.geometry;c=this.pointMap;d.projectionMatrix.copy(this.camera.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",
  1,1,-1);b("f1",-1,-1,1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);a.getAttribute("position").needsUpdate=!0}}();Ub.prototype=Object.create(ra.prototype);Ub.prototype.constructor=Ub;Ub.prototype.update=function(){var b=new I;return function(a){void 0!==a&&console.warn("THREE.BoxHelper: .update() has no longer arguments.");
  void 0!==this.object&&b.setFromObject(this.object);if(!b.isEmpty()){a=b.min;var c=b.max,g=this.geometry.attributes.position,d=g.array;d[0]=c.x;d[1]=c.y;d[2]=c.z;d[3]=a.x;d[4]=c.y;d[5]=c.z;d[6]=a.x;d[7]=a.y;d[8]=c.z;d[9]=c.x;d[10]=a.y;d[11]=c.z;d[12]=c.x;d[13]=c.y;d[14]=a.z;d[15]=a.x;d[16]=c.y;d[17]=a.z;d[18]=a.x;d[19]=a.y;d[20]=a.z;d[21]=c.x;d[22]=a.y;d[23]=a.z;g.needsUpdate=!0;this.geometry.computeBoundingSphere()}}}();Ub.prototype.setFromObject=function(b){this.object=b;this.update();return this};
  Ed.prototype=Object.create(ra.prototype);Ed.prototype.constructor=Ed;Ed.prototype.updateMatrixWorld=function(b){var a=this.box;a.isEmpty()||(a.getCenter(this.position),a.getSize(this.scale),this.scale.multiplyScalar(0.5),D.prototype.updateMatrixWorld.call(this,b))};Fd.prototype=Object.create(ya.prototype);Fd.prototype.constructor=Fd;Fd.prototype.updateMatrixWorld=function(b){var a=-this.plane.constant;1E-8>Math.abs(a)&&(a=1E-8);this.scale.set(0.5*this.size,0.5*this.size,a);this.children[0].material.side=
  0>a?Oa:Xb;this.lookAt(this.plane.normal);D.prototype.updateMatrixWorld.call(this,b)};var we,Df;Vb.prototype=Object.create(D.prototype);Vb.prototype.constructor=Vb;Vb.prototype.setDirection=function(){var b=new m,a;return function(c){0.99999<c.y?this.quaternion.set(0,0,0,1):-0.99999>c.y?this.quaternion.set(1,0,0,0):(b.set(c.z,0,-c.x).normalize(),a=Math.acos(c.y),this.quaternion.setFromAxisAngle(b,a))}}();Vb.prototype.setLength=function(b,a,c){void 0===a&&(a=0.2*b);void 0===c&&(c=0.2*a);this.line.scale.set(1,
  Math.max(0,b-a),1);this.line.updateMatrix();this.cone.scale.set(c,a,c);this.cone.position.y=b;this.cone.updateMatrix()};Vb.prototype.setColor=function(b){this.line.material.color.copy(b);this.cone.material.color.copy(b)};Gd.prototype=Object.create(ra.prototype);Gd.prototype.constructor=Gd;X.create=function(b,a){console.log("THREE.Curve.create() has been deprecated");b.prototype=Object.create(X.prototype);b.prototype.constructor=b;b.prototype.getPoint=a;return b};Object.assign(qb.prototype,{createPointsGeometry:function(b){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
  b=this.getPoints(b);return this.createGeometry(b)},createSpacedPointsGeometry:function(b){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");b=this.getSpacedPoints(b);return this.createGeometry(b)},createGeometry:function(b){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var a=new g,c=0,d=b.length;c<d;c++){var f=b[c];a.vertices.push(new m(f.x,
  f.y,f.z||0))}return a}});Object.assign(bb.prototype,{fromPoints:function(b){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints().");this.setFromPoints(b)}});Mh.prototype=Object.create(Ea.prototype);Nh.prototype=Object.create(Ea.prototype);Ef.prototype=Object.create(Ea.prototype);Object.assign(Ef.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},
  reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});Bd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Fc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(Cc.prototype,{extractUrlBase:function(b){console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.");
  return If.extractUrlBase(b)}});Object.assign(Af.prototype,{center:function(b){console.warn("THREE.Box2: .center() has been renamed to .getCenter().");return this.getCenter(b)},empty:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(b){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(b)},size:function(b){console.warn("THREE.Box2: .size() has been renamed to .getSize().");
  return this.getSize(b)}});Object.assign(I.prototype,{center:function(b){console.warn("THREE.Box3: .center() has been renamed to .getCenter().");return this.getCenter(b)},empty:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(b){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(b)},isIntersectionSphere:function(b){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");
  return this.intersectsSphere(b)},size:function(b){console.warn("THREE.Box3: .size() has been renamed to .getSize().");return this.getSize(b)}});Bf.prototype.center=function(b){console.warn("THREE.Line3: .center() has been renamed to .getCenter().");return this.getCenter(b)};Object.assign(ga,{random16:function(){console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead.");return Math.random()},nearestPowerOfTwo:function(b){console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().");
  return ga.floorPowerOfTwo(b)},nextPowerOfTwo:function(b){console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().");return ga.ceilPowerOfTwo(b)}});Object.assign(r.prototype,{flattenToArrayOffset:function(b,a){console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(b,a)},multiplyVector3:function(b){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return b.applyMatrix3(this)},
  multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(b){console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(b)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(f.prototype,{extractPosition:function(b){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");
  return this.copyPosition(b)},flattenToArrayOffset:function(b,a){console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(b,a)},getPosition:function(){var b;return function(){void 0===b&&(b=new m);console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");return b.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(b){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");
  return this.makeRotationFromQuaternion(b)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(b){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.");return b.applyMatrix4(this)},multiplyVector4:function(b){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return b.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},
  rotateAxis:function(b){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");b.transformDirection(this)},crossVector:function(b){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return b.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},
  rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(b){console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(b)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(b,a,c,g,d,f){console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.");
  return this.makePerspective(b,a,g,c,d,f)}});u.prototype.isIntersectionLine=function(b){console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().");return this.intersectsLine(b)};l.prototype.multiplyVector3=function(b){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return b.applyQuaternion(this)};Object.assign(fb.prototype,{isIntersectionBox:function(b){console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().");
  return this.intersectsBox(b)},isIntersectionPlane:function(b){console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().");return this.intersectsPlane(b)},isIntersectionSphere:function(b){console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(b)}});Object.assign(sa.prototype,{area:function(){console.warn("THREE.Triangle: .area() has been renamed to .getArea().");return this.getArea()},barycoordFromPoint:function(b,
  a){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return this.getBarycoord(b,a)},midpoint:function(b){console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint().");return this.getMidpoint(b)},normal:function(b){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return this.getNormal(b)},plane:function(b){console.warn("THREE.Triangle: .plane() has been renamed to .getPlane().");return this.getPlane(b)}});Object.assign(sa,
  {barycoordFromPoint:function(b,a,c,g,d){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return sa.getBarycoord(b,a,c,g,d)},normal:function(b,a,c,g){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return sa.getNormal(b,a,c,g)}});Object.assign(xb.prototype,{extractAllPoints:function(b){console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.");return this.extractPoints(b)},extrude:function(b){console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.");
  return new Fb(this,b)},makeGeometry:function(b){console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.");return new Hb(this,b)}});Object.assign(d.prototype,{fromAttribute:function(b,a,c){console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(b,a,c)},distanceToManhattan:function(b){console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(b)},
  lengthManhattan:function(){console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(m.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(b){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");
  return this.setFromMatrixPosition(b)},getScaleFromMatrix:function(b){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(b)},getColumnFromMatrix:function(b,a){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(a,b)},applyProjection:function(b){console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.");return this.applyMatrix4(b)},
  fromAttribute:function(b,a,c){console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(b,a,c)},distanceToManhattan:function(b){console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(b)},lengthManhattan:function(){console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(t.prototype,
  {fromAttribute:function(b,a,c){console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(b,a,c)},lengthManhattan:function(){console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(g.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}});
  Object.assign(D.prototype,{getChildByName:function(b){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(b)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(b,a){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(a,b)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}});
  Object.defineProperties(D.prototype,{eulerOrder:{get:function(){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");return this.rotation.order},set:function(b){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");this.rotation.order=b}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});
  Object.defineProperties(Uc.prototype,{objects:{get:function(){console.warn("THREE.LOD: .objects has been renamed to .levels.");return this.levels}}});Object.defineProperty(Vc.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});Object.defineProperty(X.prototype,"__arcLengthDivisions",{get:function(){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");
  return this.arcLengthDivisions},set:function(b){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");this.arcLengthDivisions=b}});qa.prototype.setLens=function(b,a){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.");void 0!==a&&(this.filmGauge=a);this.setFocalLength(b)};Object.defineProperties(za.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(b){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov.");
  this.shadow.camera.fov=b}},shadowCameraLeft:{set:function(b){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left.");this.shadow.camera.left=b}},shadowCameraRight:{set:function(b){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right.");this.shadow.camera.right=b}},shadowCameraTop:{set:function(b){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top.");this.shadow.camera.top=b}},shadowCameraBottom:{set:function(b){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.");
  this.shadow.camera.bottom=b}},shadowCameraNear:{set:function(b){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near.");this.shadow.camera.near=b}},shadowCameraFar:{set:function(b){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far.");this.shadow.camera.far=b}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(b){console.warn("THREE.Light: .shadowBias is now .shadow.bias.");
  this.shadow.bias=b}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(b){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.");this.shadow.mapSize.width=b}},shadowMapHeight:{set:function(b){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.");this.shadow.mapSize.height=b}}});Object.defineProperties(n.prototype,{length:{get:function(){console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead.");
  return this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}});Object.assign(M.prototype,{addIndex:function(b){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(b)},addDrawCall:function(b,a,c){void 0!==c&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.");console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup().");this.addGroup(b,a)},
  clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().");this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}});Object.defineProperties(M.prototype,{drawcalls:{get:function(){console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups.");return this.groups}},offsets:{get:function(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups.");
  return this.groups}}});Object.assign(ib.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.defineProperties(ue.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},
  onUpdate:{value:function(){console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.");return this}}});Object.defineProperties(T.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){console.warn("THREE.Material: .wrapRGB has been removed.");return new w}},shading:{get:function(){console.error("THREE."+this.type+
  ": .shading has been removed. Use the boolean .flatShading instead.")},set:function(b){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.");this.flatShading=1===b}}});Object.defineProperties(Wa.prototype,{metal:{get:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.");return!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});
  Object.defineProperties(pa.prototype,{derivatives:{get:function(){console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");return this.extensions.derivatives},set:function(b){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=b}}});Object.assign(bf.prototype,{clearTarget:function(b,a,c,g){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.");
  this.setRenderTarget(b);this.clear(a,c,g)},animate:function(b){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop().");this.setAnimationLoop(b)},getCurrentRenderTarget:function(){console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().");return this.getRenderTarget()},getMaxAnisotropy:function(){console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().");return this.capabilities.getMaxAnisotropy()},getPrecision:function(){console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.");
  return this.capabilities.precision},resetGLState:function(){console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset().");return this.state.reset()},supportsFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");
  return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");return this.extensions.get("WEBGL_compressed_texture_s3tc")},
  supportsCompressedTexturePVRTC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.");
  return this.capabilities.vertexTextures},supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(b){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().");this.setScissorTest(b)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},
  addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")}});Object.defineProperties(bf.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(b){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");
  this.shadowMap.enabled=b}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(b){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");this.shadowMap.type=b}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(qg.prototype,
  {cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},
  renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(x.prototype,{wrapS:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");return this.texture.wrapS},set:function(b){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");
  this.texture.wrapS=b}},wrapT:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");return this.texture.wrapT},set:function(b){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");this.texture.wrapT=b}},magFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");return this.texture.magFilter},set:function(b){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");this.texture.magFilter=
  b}},minFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");return this.texture.minFilter},set:function(b){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");this.texture.minFilter=b}},anisotropy:{get:function(){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");return this.texture.anisotropy},set:function(b){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=
  b}},offset:{get:function(){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");return this.texture.offset},set:function(b){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");this.texture.offset=b}},repeat:{get:function(){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");return this.texture.repeat},set:function(b){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");this.texture.repeat=b}},format:{get:function(){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");
  return this.texture.format},set:function(b){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");this.texture.format=b}},type:{get:function(){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");return this.texture.type},set:function(b){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");this.texture.type=b}},generateMipmaps:{get:function(){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");return this.texture.generateMipmaps},
  set:function(b){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");this.texture.generateMipmaps=b}}});Object.defineProperties(lh.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}});Dc.prototype.load=function(b){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var a=this;(new pf).load(b,
  function(b){a.setBuffer(b)});return this};tf.prototype.getData=function(){console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData().");return this.getFrequencyData()};yd.prototype.updateCubeMap=function(b,a){console.warn("THREE.CubeCamera: .updateCubeMap() is now .update().");return this.update(b,a)};yb.crossOrigin=void 0;yb.loadTexture=function(b,a,c,g){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var d=new ee;d.setCrossOrigin(this.crossOrigin);
  b=d.load(b,c,void 0,g);a&&(b.mapping=a);return b};yb.loadTextureCube=function(b,a,c,g){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var d=new hf;d.setCrossOrigin(this.crossOrigin);b=d.load(b,c,void 0,g);a&&(b.mapping=a);return b};yb.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};yb.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};
  a.WebGLRenderTargetCube=v;a.WebGLRenderTarget=x;a.WebGLRenderer=bf;a.ShaderLib=gb;a.UniformsLib=Z;a.UniformsUtils=Ha;a.ShaderChunk=ca;a.FogExp2=fc;a.Fog=hc;a.Scene=$d;a.Sprite=Tc;a.LOD=Uc;a.SkinnedMesh=be;a.Skeleton=Vc;a.Bone=ae;a.Mesh=wa;a.LineSegments=ra;a.LineLoop=ce;a.Line=ya;a.Points=jc;a.Group=ec;a.VideoTexture=cf;a.DataTexture=A;a.Texture3D=Zb;a.CompressedTexture=kc;a.CubeTexture=mb;a.CanvasTexture=Wc;a.DepthTexture=Xc;a.Texture=q;a.CompressedTextureLoader=xh;a.DataTextureLoader=gf;a.CubeTextureLoader=
  hf;a.TextureLoader=ee;a.ObjectLoader=zh;a.MaterialLoader=te;a.BufferGeometryLoader=kf;a.DefaultLoadingManager=Ja;a.LoadingManager=ff;a.JSONLoader=lf;a.ImageLoader=sd;a.ImageBitmapLoader=mf;a.FontLoader=Ah;a.FileLoader=Xa;a.Loader=Cc;a.LoaderUtils=If;a.Cache=Wb;a.AudioLoader=pf;a.SpotLightShadow=ge;a.SpotLight=he;a.PointLight=ie;a.RectAreaLight=me;a.HemisphereLight=fe;a.DirectionalLightShadow=je;a.DirectionalLight=ke;a.AmbientLight=le;a.LightShadow=Rb;a.Light=za;a.StereoCamera=Bh;a.PerspectiveCamera=
  qa;a.OrthographicCamera=vd;a.CubeCamera=yd;a.ArrayCamera=Rc;a.Camera=hb;a.AudioListener=qf;a.PositionalAudio=sf;a.AudioContext=rf;a.AudioAnalyser=tf;a.Audio=Dc;a.VectorKeyframeTrack=Bc;a.StringKeyframeTrack=se;a.QuaternionKeyframeTrack=xd;a.NumberKeyframeTrack=Ac;a.ColorKeyframeTrack=qe;a.BooleanKeyframeTrack=pe;a.PropertyMixer=uf;a.PropertyBinding=ua;a.KeyframeTrack=Aa;a.AnimationUtils=Ca;a.AnimationObjectGroup=Dh;a.AnimationMixer=vf;a.AnimationClip=Ua;a.Uniform=ue;a.InstancedBufferGeometry=wf;a.BufferGeometry=
  M;a.Geometry=g;a.InterleavedBufferAttribute=Sc;a.InstancedInterleavedBuffer=xf;a.InterleavedBuffer=Cb;a.InstancedBufferAttribute=yf;a.Face3=H;a.Object3D=D;a.Raycaster=Gh;a.Layers=y;a.EventDispatcher=c;a.Clock=Ih;a.QuaternionLinearInterpolant=re;a.LinearInterpolant=wd;a.DiscreteInterpolant=oe;a.CubicInterpolant=ne;a.Interpolant=Sa;a.Triangle=sa;a.Math=ga;a.Spherical=Jh;a.Cylindrical=Kh;a.Plane=u;a.Frustum=K;a.Sphere=C;a.Ray=fb;a.Matrix4=f;a.Matrix3=r;a.Box3=I;a.Box2=Af;a.Line3=Bf;a.Euler=J;a.Vector4=
  t;a.Vector3=m;a.Vector2=d;a.Quaternion=l;a.Color=w;a.ImmediateRenderObject=zd;a.VertexNormalsHelper=Ad;a.SpotLightHelper=Ec;a.SkeletonHelper=Fc;a.PointLightHelper=Gc;a.RectAreaLightHelper=Hc;a.HemisphereLightHelper=Ic;a.GridHelper=Bd;a.PolarGridHelper=ve;a.FaceNormalsHelper=Cd;a.DirectionalLightHelper=Jc;a.CameraHelper=Dd;a.BoxHelper=Ub;a.Box3Helper=Ed;a.PlaneHelper=Fd;a.ArrowHelper=Vb;a.AxesHelper=Gd;a.Shape=xb;a.Path=bb;a.ShapePath=nf;a.Font=of;a.CurvePath=qb;a.Curve=X;a.ImageUtils=yb;a.ShapeUtils=
  ob;a.WebGLUtils=Bg;a.WireframeGeometry=lc;a.ParametricGeometry=Yc;a.ParametricBufferGeometry=mc;a.TetrahedronGeometry=$c;a.TetrahedronBufferGeometry=nc;a.OctahedronGeometry=ad;a.OctahedronBufferGeometry=Db;a.IcosahedronGeometry=bd;a.IcosahedronBufferGeometry=oc;a.DodecahedronGeometry=cd;a.DodecahedronBufferGeometry=pc;a.PolyhedronGeometry=Zc;a.PolyhedronBufferGeometry=Na;a.TubeGeometry=dd;a.TubeBufferGeometry=qc;a.TorusKnotGeometry=ed;a.TorusKnotBufferGeometry=rc;a.TorusGeometry=fd;a.TorusBufferGeometry=
  sc;a.TextGeometry=kd;a.TextBufferGeometry=tc;a.SphereGeometry=ld;a.SphereBufferGeometry=Gb;a.RingGeometry=md;a.RingBufferGeometry=uc;a.PlaneGeometry=ja;a.PlaneBufferGeometry=oa;a.LatheGeometry=nd;a.LatheBufferGeometry=vc;a.ShapeGeometry=Hb;a.ShapeBufferGeometry=Ib;a.ExtrudeGeometry=Fb;a.ExtrudeBufferGeometry=ib;a.EdgesGeometry=wc;a.ConeGeometry=od;a.ConeBufferGeometry=pd;a.CylinderGeometry=Jb;a.CylinderBufferGeometry=pb;a.CircleGeometry=qd;a.CircleBufferGeometry=xc;a.BoxGeometry=la;a.BoxBufferGeometry=
  G;a.ShadowMaterial=Kb;a.SpriteMaterial=wb;a.RawShaderMaterial=yc;a.ShaderMaterial=pa;a.PointsMaterial=Va;a.MeshPhysicalMaterial=Lb;a.MeshStandardMaterial=jb;a.MeshPhongMaterial=Wa;a.MeshToonMaterial=Mb;a.MeshNormalMaterial=Nb;a.MeshLambertMaterial=Ob;a.MeshDepthMaterial=tb;a.MeshDistanceMaterial=ub;a.MeshBasicMaterial=Ba;a.MeshMatcapMaterial=Pb;a.LineDashedMaterial=Qb;a.LineBasicMaterial=na;a.Material=T;a.Float64BufferAttribute=fa;a.Float32BufferAttribute=N;a.Uint32BufferAttribute=ha;a.Int32BufferAttribute=
  ba;a.Uint16BufferAttribute=ea;a.Int16BufferAttribute=da;a.Uint8ClampedBufferAttribute=V;a.Uint8BufferAttribute=S;a.Int8BufferAttribute=s;a.BufferAttribute=n;a.ArcCurve=zc;a.CatmullRomCurve3=Ea;a.CubicBezierCurve=Ya;a.CubicBezierCurve3=kb;a.EllipseCurve=Ra;a.LineCurve=Fa;a.LineCurve3=Za;a.QuadraticBezierCurve=$a;a.QuadraticBezierCurve3=lb;a.SplineCurve=ab;a.REVISION=mh;a.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};a.CullFaceNone=sg;a.CullFaceBack=Re;a.CullFaceFront=tg;a.CullFaceFrontBack=3;a.FrontFaceDirectionCW=
  0;a.FrontFaceDirectionCCW=1;a.BasicShadowMap=0;a.PCFShadowMap=Me;a.PCFSoftShadowMap=kg;a.FrontSide=Xb;a.BackSide=Oa;a.DoubleSide=ac;a.FlatShading=1;a.SmoothShading=2;a.NoColors=ze;a.FaceColors=Cf;a.VertexColors=Tb;a.NoBlending=Oc;a.NormalBlending=zb;a.AdditiveBlending=Sd;a.SubtractiveBlending=Td;a.MultiplyBlending=Ud;a.CustomBlending=Qe;a.AddEquation=Yb;a.SubtractEquation=Mg;a.ReverseSubtractEquation=Ng;a.MinEquation=Yd;a.MaxEquation=Zd;a.ZeroFactor=Og;a.OneFactor=Pg;a.SrcColorFactor=Qg;a.OneMinusSrcColorFactor=
  Rg;a.SrcAlphaFactor=Ae;a.OneMinusSrcAlphaFactor=Be;a.DstAlphaFactor=Sg;a.OneMinusDstAlphaFactor=Tg;a.DstColorFactor=Ug;a.OneMinusDstColorFactor=Vg;a.SrcAlphaSaturateFactor=Wg;a.NeverDepth=ug;a.AlwaysDepth=vg;a.LessDepth=wg;a.LessEqualDepth=Id;a.EqualDepth=xg;a.GreaterEqualDepth=yg;a.GreaterDepth=zg;a.NotEqualDepth=Ag;a.MultiplyOperation=Mc;a.MixOperation=lg;a.AddOperation=mg;a.NoToneMapping=Qd;a.LinearToneMapping=Ke;a.ReinhardToneMapping=eg;a.Uncharted2ToneMapping=fg;a.CineonToneMapping=gg;a.UVMapping=
  300;a.CubeReflectionMapping=Kd;a.CubeRefractionMapping=Md;a.EquirectangularReflectionMapping=Ne;a.EquirectangularRefractionMapping=Pd;a.SphericalReflectionMapping=Oe;a.CubeUVReflectionMapping=Nd;a.CubeUVRefractionMapping=Od;a.RepeatWrapping=nb;a.ClampToEdgeWrapping=Qa;a.MirroredRepeatWrapping=Bb;a.NearestFilter=La;a.NearestMipMapNearestFilter=Vd;a.NearestMipMapLinearFilter=Wd;a.LinearFilter=Ka;a.LinearMipMapNearestFilter=Te;a.LinearMipMapLinearFilter=Kc;a.UnsignedByteType=Hd;a.ByteType=Fg;a.ShortType=
  Gg;a.UnsignedShortType=Pc;a.IntType=Hg;a.UnsignedIntType=Se;a.FloatType=bc;a.HalfFloatType=Xd;a.UnsignedShort4444Type=Cg;a.UnsignedShort5551Type=Dg;a.UnsignedShort565Type=Eg;a.UnsignedInt248Type=Qc;a.AlphaFormat=Ig;a.RGBFormat=dc;a.RGBAFormat=db;a.LuminanceFormat=Jg;a.LuminanceAlphaFormat=Kg;a.RGBEFormat=Xi;a.DepthFormat=Ab;a.DepthStencilFormat=cc;a.RedFormat=Lg;a.RGB_S3TC_DXT1_Format=Ue;a.RGBA_S3TC_DXT1_Format=Ve;a.RGBA_S3TC_DXT3_Format=We;a.RGBA_S3TC_DXT5_Format=Xe;a.RGB_PVRTC_4BPPV1_Format=Ye;
  a.RGB_PVRTC_2BPPV1_Format=Ze;a.RGBA_PVRTC_4BPPV1_Format=$e;a.RGBA_PVRTC_2BPPV1_Format=af;a.RGB_ETC1_Format=Xg;a.RGBA_ASTC_4x4_Format=Yg;a.RGBA_ASTC_5x4_Format=Zg;a.RGBA_ASTC_5x5_Format=$g;a.RGBA_ASTC_6x5_Format=ah;a.RGBA_ASTC_6x6_Format=bh;a.RGBA_ASTC_8x5_Format=ch;a.RGBA_ASTC_8x6_Format=dh;a.RGBA_ASTC_8x8_Format=eh;a.RGBA_ASTC_10x5_Format=fh;a.RGBA_ASTC_10x6_Format=gh;a.RGBA_ASTC_10x8_Format=hh;a.RGBA_ASTC_10x10_Format=ih;a.RGBA_ASTC_12x10_Format=jh;a.RGBA_ASTC_12x12_Format=kh;a.LoopOnce=2200;a.LoopRepeat=
  Fh;a.LoopPingPong=2202;a.InterpolateDiscrete=2300;a.InterpolateLinear=2301;a.InterpolateSmooth=2302;a.ZeroCurvatureEnding=Sb;a.ZeroSlopeEnding=2401;a.WrapAroundEnding=2402;a.TrianglesDrawMode=Ce;a.TriangleStripDrawMode=nh;a.TriangleFanDrawMode=oh;a.LinearEncoding=Lc;a.sRGBEncoding=$f;a.GammaEncoding=Je;a.RGBEEncoding=ag;a.LogLuvEncoding=3003;a.RGBM7Encoding=bg;a.RGBM16Encoding=cg;a.RGBDEncoding=dg;a.BasicDepthPacking=pg;a.RGBADepthPacking=rg;a.TangentSpaceNormalMap=rd;a.ObjectSpaceNormalMap=ng;a.CubeGeometry=
  la;a.Face4=function(b,a,c,g,d,f,n){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new H(b,a,c,d,f,n)};a.LineStrip=0;a.LinePieces=1;a.MeshFaceMaterial=function(b){console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead.");return b};a.MultiMaterial=function(b){void 0===b&&(b=[]);console.warn("THREE.MultiMaterial has been removed. Use an Array instead.");b.isMultiMaterial=!0;b.materials=b;b.clone=function(){return b.slice()};return b};
  a.PointCloud=function(b,a){console.warn("THREE.PointCloud has been renamed to THREE.Points.");return new jc(b,a)};a.Particle=function(b){console.warn("THREE.Particle has been renamed to THREE.Sprite.");return new Tc(b)};a.ParticleSystem=function(b,a){console.warn("THREE.ParticleSystem has been renamed to THREE.Points.");return new jc(b,a)};a.PointCloudMaterial=function(b){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.");return new Va(b)};a.ParticleBasicMaterial=function(b){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.");
  return new Va(b)};a.ParticleSystemMaterial=function(b){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.");return new Va(b)};a.Vertex=function(b,a,c){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead.");return new m(b,a,c)};a.DynamicBufferAttribute=function(b,a){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.");return(new n(b,a)).setDynamic(!0)};a.Int8Attribute=function(b,
  a){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.");return new s(b,a)};a.Uint8Attribute=function(b,a){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.");return new S(b,a)};a.Uint8ClampedAttribute=function(b,a){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.");return new V(b,a)};a.Int16Attribute=function(b,a){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.");
  return new da(b,a)};a.Uint16Attribute=function(b,a){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.");return new ea(b,a)};a.Int32Attribute=function(b,a){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.");return new ba(b,a)};a.Uint32Attribute=function(b,a){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.");return new ha(b,a)};a.Float32Attribute=
  function(b,a){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.");return new N(b,a)};a.Float64Attribute=function(b,a){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.");return new fa(b,a)};a.ClosedSplineCurve3=Mh;a.SplineCurve3=Nh;a.Spline=Ef;a.AxisHelper=function(b){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper.");return new Gd(b)};a.BoundingBoxHelper=function(b,a){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.");
  return new Ub(b,a)};a.EdgesHelper=function(b,a){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.");return new ra(new wc(b.geometry),new na({color:void 0!==a?a:16777215}))};a.WireframeHelper=function(b,a){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.");return new ra(new lc(b.geometry),new na({color:void 0!==a?a:16777215}))};a.XHRLoader=function(b){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader.");return new Xa(b)};
  a.BinaryTextureLoader=function(b){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.");return new gf(b)};a.GeometryUtils={merge:function(b,a,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var g;a.isMesh&&(a.matrixAutoUpdate&&a.updateMatrix(),g=a.matrix,a=a.geometry);b.merge(a,g,c)},center:function(b){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");
  return b.center()}};a.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(b,a){console.warn("THREE.Projector: .projectVector() is now vector.project().");b.project(a)};this.unprojectVector=function(b,a){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");b.unproject(a)};this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};a.CanvasRenderer=
  function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}};a.SceneUtils={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},
  attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};a.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")};Object.defineProperty(a,"__esModule",{value:!0})});var SEA3D={VERSION:18110,getVersion:function(){var a=SEA3D.VERSION.toString(),c=a.length;return a.substring(0,c-4)+"."+a.substring(c-4,c-3)+"."+a.substring(c-3,c-2)+"."+parseFloat(a.substring(c-2,c)).toString()}};console.log("SEA3D "+SEA3D.getVersion());SEA3D.Stream=function(a){this.position=0;this.buffer=a||new ArrayBuffer};SEA3D.Stream.NONE=0;SEA3D.Stream.BOOLEAN=1;SEA3D.Stream.BYTE=2;SEA3D.Stream.UBYTE=3;SEA3D.Stream.SHORT=4;SEA3D.Stream.USHORT=5;SEA3D.Stream.INT24=6;SEA3D.Stream.UINT24=7;
  SEA3D.Stream.INT=8;SEA3D.Stream.UINT=9;SEA3D.Stream.FLOAT=10;SEA3D.Stream.DOUBLE=11;SEA3D.Stream.DECIMAL=12;SEA3D.Stream.VECTOR3D=74;SEA3D.Stream.VECTOR4D=106;SEA3D.Stream.STRING_TINY=128;SEA3D.Stream.STRING_SHORT=129;SEA3D.Stream.STRING_LONG=130;SEA3D.Stream.ASSET=200;SEA3D.Stream.GROUP=255;SEA3D.Stream.BLEND_MODE="normal add subtract multiply dividing mix alpha screen darken overlay colorburn linearburn lighten colordodge lineardodge softlight hardlight pinlight spotlight spotlightblend hardmix average difference exclusion hue saturation color value linearlight grainextract reflect glow darkercolor lightercolor phoenix negation".split(" ");
  SEA3D.Stream.INTERPOLATION_TABLE="normal linear sine.in sine.out sine.inout cubic.in cubic.out cubic.inout quint.in quint.out quint.inout circ.in circ.out circ.inout back.in back.out back.inout quad.in quad.out quad.inout quart.in quart.out quart.inout expo.in expo.out expo.inout elastic.in elastic.out elastic.inout bounce.in bounce.out bounce.inout".split(" ");SEA3D.Stream.sizeOf=function(a){return 0===a?0:1<=a&&31>=a?1:32<=a&&63>=a?2:64<=a&&95>=a?3:96<=a&&125>=a?4:-1};
  SEA3D.Stream.prototype={constructor:SEA3D.Stream,set buffer(a){this.buf=a;this.data=new DataView(a)},get buffer(){return this.buf},get bytesAvailable(){return this.length-this.position},get length(){return this.buf.byteLength}};SEA3D.Stream.prototype.getByte=function(a){return this.data.getInt8(a)};SEA3D.Stream.prototype.readBytes=function(a){var c=this.buf.slice(this.position,this.position+a);this.position+=a;return c};SEA3D.Stream.prototype.readByte=function(){return this.data.getInt8(this.position++)};
  SEA3D.Stream.prototype.readUByte=function(){return this.data.getUint8(this.position++)};SEA3D.Stream.prototype.readBool=function(){return 0!=this.data.getInt8(this.position++)};SEA3D.Stream.prototype.readShort=function(){var a=this.data.getInt16(this.position,!0);this.position+=2;return a};SEA3D.Stream.prototype.readUShort=function(){var a=this.data.getUint16(this.position,!0);this.position+=2;return a};
  SEA3D.Stream.prototype.readUInt24=function(){var a=this.data.getUint32(this.position,!0)&16777215;this.position+=3;return a};SEA3D.Stream.prototype.readUInt24F=function(){return this.readUShort()|this.readUByte()<<16};SEA3D.Stream.prototype.readInt=function(){var a=this.data.getInt32(this.position,!0);this.position+=4;return a};SEA3D.Stream.prototype.readUInt=function(){var a=this.data.getUint32(this.position,!0);this.position+=4;return a};
  SEA3D.Stream.prototype.readFloat=function(){var a=this.data.getFloat32(this.position,!0);this.position+=4;return a};SEA3D.Stream.prototype.readUInteger=function(){var a=this.readUByte(),c=a&127;0!=(a&128)&&(a=this.readUByte(),c|=(a&127)<<7,0!=(a&128)&&(a=this.readUByte(),c|=(a&127)<<13));return c};SEA3D.Stream.prototype.readVector2=function(){return{x:this.readFloat(),y:this.readFloat()}};SEA3D.Stream.prototype.readVector3=function(){return{x:this.readFloat(),y:this.readFloat(),z:this.readFloat()}};
  SEA3D.Stream.prototype.readVector4=function(){return{x:this.readFloat(),y:this.readFloat(),z:this.readFloat(),w:this.readFloat()}};
  SEA3D.Stream.prototype.readMatrix=function(){var a=new Float32Array(16);a[0]=this.readFloat();a[1]=this.readFloat();a[2]=this.readFloat();a[3]=0;a[4]=this.readFloat();a[5]=this.readFloat();a[6]=this.readFloat();a[7]=0;a[8]=this.readFloat();a[9]=this.readFloat();a[10]=this.readFloat();a[11]=0;a[12]=this.readFloat();a[13]=this.readFloat();a[14]=this.readFloat();a[15]=1;return a};
  SEA3D.Stream.prototype.decodeText=function(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);for(var c="",d=0,f=a.length;d<f;d++)c+=String.fromCharCode(a[d]);return decodeURIComponent(escape(c))};SEA3D.Stream.prototype.readUTF8=function(a){a=this.readBytes(a);return this.decodeText(new Uint8Array(a))};SEA3D.Stream.prototype.readExt=function(){return this.readUTF8(4).replace(/\0/g,"")};SEA3D.Stream.prototype.readUTF8Tiny=function(){return this.readUTF8(this.readUByte())};
  SEA3D.Stream.prototype.readUTF8Short=function(){return this.readUTF8(this.readUShort())};SEA3D.Stream.prototype.readUTF8Long=function(){return this.readUTF8(this.readUInt())};SEA3D.Stream.prototype.readUByteArray=function(a){var c=new Uint8Array(a);SEA3D.Stream.memcpy(c.buffer,0,this.buffer,this.position,a);this.position+=a;return c};SEA3D.Stream.prototype.readUShortArray=function(a){var c=new Uint16Array(a);a*=2;SEA3D.Stream.memcpy(c.buffer,0,this.buffer,this.position,a);this.position+=a;return c};
  SEA3D.Stream.prototype.readUInt24Array=function(a){for(var c=new Uint32Array(a),d=0;d<a;d++)c[d]=this.readUInt24();return c};SEA3D.Stream.prototype.readUIntArray=function(a){var c=new Uint32Array(a);a*=4;SEA3D.Stream.memcpy(c.buffer,0,this.buffer,this.position,a);this.position+=a;return c};SEA3D.Stream.prototype.readFloatArray=function(a){var c=new Float32Array(a);a*=4;SEA3D.Stream.memcpy(c.buffer,0,this.buffer,this.position,a);this.position+=a;return c};SEA3D.Stream.prototype.readBlendMode=function(){return SEA3D.Stream.BLEND_MODE[this.readUByte()]};
  SEA3D.Stream.prototype.readInterpolation=function(){return SEA3D.Stream.INTERPOLATION_TABLE[this.readUByte()]};SEA3D.Stream.prototype.readTags=function(a){for(var c=this.readUByte(),d=0;d<c;++d){var f=this.readUShort(),l=this.readUInt(),m=this.position;a(f,this,l);this.position=m+l}};
  SEA3D.Stream.prototype.readProperties=function(a){var c=this.readUByte(),d={},f={};d.__type=f;for(var l=0;l<c;l++){var m=this.readUTF8Tiny(),r=this.readUByte();f[m]=r;d[m]=r===SEA3D.Stream.GROUP?this.readProperties(a):this.readToken(r,a)}return d};SEA3D.Stream.prototype.readAnimationList=function(a){for(var c=[],d=this.readUByte(),f=0;f<d;){var l=this.readUByte(),m={};m.relative=0!=(l&1);l&2&&(m.timeScale=this.readFloat());m.tag=a.getObject(this.readUInt());c[f++]=m}return c};
  SEA3D.Stream.prototype.readScriptList=function(a){for(var c=[],d=this.readUByte(),f=0;f<d;){var l=this.readUByte(),m={};m.priority=l&1|l&2;if(l&4){var r=this.readUByte();m.params={};for(var q=0;q<r;q++){var t=this.readUTF8Tiny();m.params[t]=this.readObject(a)}}l&8&&(m.method=this.readUTF8Tiny());m.tag=a.getObject(this.readUInt());c[f++]=m}return c};SEA3D.Stream.prototype.readObject=function(a){return this.readToken(this.readUByte(),a)};
  SEA3D.Stream.prototype.readToken=function(a,c){switch(a){case SEA3D.Stream.BOOLEAN:return this.readBool();case SEA3D.Stream.UBYTE:return this.readUByte();case SEA3D.Stream.USHORT:return this.readUShort();case SEA3D.Stream.UINT24:return this.readUInt24();case SEA3D.Stream.INT:return this.readInt();case SEA3D.Stream.UINT:return this.readUInt();case SEA3D.Stream.FLOAT:return this.readFloat();case SEA3D.Stream.VECTOR3D:return this.readVector3();case SEA3D.Stream.VECTOR4D:return this.readVector4();case SEA3D.Stream.STRING_TINY:return this.readUTF8Tiny();
  case SEA3D.Stream.STRING_SHORT:return this.readUTF8Short();case SEA3D.Stream.STRING_LONG:return this.readUTF8Long();case SEA3D.Stream.ASSET:var d=this.readUInt();return 0<d?c.getObject(d-1):null;default:console.error("DataType not found!")}return null};
  SEA3D.Stream.prototype.readVector=function(a,c,d){var f=SEA3D.Stream.sizeOf(a);c=d*f+c*f;switch(a){case SEA3D.Stream.BOOLEAN:return this.readUByteArray(c);case SEA3D.Stream.UBYTE:return this.readUByteArray(c);case SEA3D.Stream.USHORT:return this.readUShortArray(c);case SEA3D.Stream.UINT24:return this.readUInt24Array(c);case SEA3D.Stream.UINT:return this.readUIntArray(c);case SEA3D.Stream.FLOAT:return this.readFloatArray(c);case SEA3D.Stream.VECTOR3D:return this.readFloatArray(c);case SEA3D.Stream.VECTOR4D:return this.readFloatArray(c)}};
  SEA3D.Stream.prototype.append=function(a){var c=new ArrayBuffer(this.data.byteLength+a.byteLength);SEA3D.Stream.memcpy(c,0,this.data.buffer,0,this.data.byteLength);SEA3D.Stream.memcpy(c,this.data.byteLength,a,0,a.byteLength);this.buffer=c};SEA3D.Stream.prototype.concat=function(a,c){return new SEA3D.Stream(this.buffer.slice(a,a+c))};SEA3D.Stream.memcpy=function(a,c,d,f,l){a=new Uint8Array(a,c,l);d=new Uint8Array(d,f,l);a.set(d)};SEA3D.UByteArray=function(){this.ubytes=[];this.length=0};
  SEA3D.UByteArray.prototype={constructor:SEA3D.UByteArray,add:function(a){this.ubytes.push(a);this.length+=a.byteLength},toBuffer:function(){for(var a=new Uint8Array(this.length),c=0,d=0;c<this.ubytes.length;c++)a.set(this.ubytes[c],d),d+=this.ubytes[c].byteLength;return a.buffer}};SEA3D.Math={RAD_TO_DEG:180/Math.PI,DEG_TO_RAD:Math.PI/180};SEA3D.Math.angle=function(a){var c=0>a;a=(c?-a:a)%360;180<a&&(a=-180+(a-180));return c?-a:a};
  SEA3D.Math.angleDiff=function(a,c){a*=this.DEG_TO_RAD;c*=this.DEG_TO_RAD;return Math.atan2(Math.sin(a-c),Math.cos(a-c))*this.RAD_TO_DEG};SEA3D.Math.angleArea=function(a,c,d){return Math.abs(this.angleDiff(a,c))<=d};SEA3D.Math.direction=function(a,c,d,f){return Math.atan2(f-c,d-a)};SEA3D.Math.physicalLerp=function(a,c,d,f){d/=f;1<d&&(d=1);return a+(c-a)*d};SEA3D.Math.physicalAngle=function(a,c,d,f){180<Math.abs(a-c)&&(c=a>c?c+360:c-360);d/=f;1<d&&(d=1);return this.angle(a+(c-a)*d)};
  SEA3D.Math.zero=function(a,c){0>(0>a?-a:a)-(c||0.001)&&(a=0);return a};SEA3D.Math.round=function(a,c){c=Math.pow(10,c);return Math.round(a*c)/c};SEA3D.Math.lerpAngle=function(a,c,d){180<Math.abs(a-c)&&(c=a>c?c+360:c-360);return SEA3D.Math.angle(a+(c-a)*d)};SEA3D.Math.lerpColor=function(a,c,d){var f=a>>24&255,l=a>>16&255,m=a>>8&255;a&=255;l+=((c>>16&255)-l)*d;m+=((c>>8&255)-m)*d;a+=((c&255)-a)*d;return f+((c>>24&255)-f)*d<<24|l<<16|m<<8|a};SEA3D.Math.lerp=function(a,c,d){return a+(c-a)*d};
  SEA3D.Timer=function(){this.time=this.start=Date.now()};SEA3D.Timer.prototype={constructor:SEA3D.Timer,get now(){return Date.now()},get deltaTime(){return Date.now()-this.time},get elapsedTime(){return Date.now()-this.start},update:function(){this.time=Date.now()}};SEA3D.Object=function(a,c,d,f){this.name=a;this.data=c;this.type=d;this.sea3d=f};
  SEA3D.GeometryBase=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.attrib=c.readUShort();this.isBig=0!=(this.attrib&1);c.readVInt=this.isBig?c.readUInt:c.readUShort;this.numVertex=c.readVInt();this.length=3*this.numVertex};
  SEA3D.Geometry=function(a,c,d){SEA3D.GeometryBase.call(this,a,c,d);var f;this.attrib&4&&(this.normal=c.readFloatArray(this.length));this.attrib&8&&(this.tangent=c.readFloatArray(this.length));if(this.attrib&32&&(f=c.readUByte()))for(this.uv=[],d=2*this.numVertex,a=0;a<f;)this.uv[a++]=c.readFloatArray(d);this.attrib&64&&(this.jointPerVertex=c.readUByte(),a=this.numVertex*this.jointPerVertex,this.joint=c.readUShortArray(a),this.weight=c.readFloatArray(a));if(this.attrib&128&&(a=c.readUByte(),d=c.readUByte()))for(this.numColor=
  ((a&64)>>6|(a&128)>>6)+1,this.color=[],a=0;a<d;a++)this.color.push(c.readFloatArray(this.numVertex*this.numColor));this.vertex=c.readFloatArray(this.length);var l=c.readUByte();this.groups=[];if(this.attrib&1024){for(d=a=0;a<l;a++)f=3*c.readVInt(),this.groups.push({start:d,count:f}),d+=f;this.attrib&2048||(this.indexes=this.isBig?c.readUIntArray(d):c.readUShortArray(d))}else{var m=this.isBig?4:2,r=new SEA3D.UByteArray;for(f=a=0;a<l;a++)d=3*c.readVInt(),this.groups.push({start:f,count:d}),f+=d,r.add(c.readUByteArray(d*
  m));this.indexes=this.isBig?new Uint32Array(r.toBuffer()):new Uint16Array(r.toBuffer())}};SEA3D.Geometry.prototype=Object.create(SEA3D.GeometryBase.prototype);SEA3D.Geometry.prototype.constructor=SEA3D.Geometry;SEA3D.Geometry.prototype.type="geo";
  SEA3D.Object3D=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.isStatic=!1;this.visible=!0;this.attrib=c.readUShort();this.attrib&1&&(this.parent=d.getObject(c.readUInt()));this.attrib&2&&(this.animations=c.readAnimationList(d));this.attrib&4&&(this.scripts=c.readScriptList(d));this.attrib&16&&(this.attributes=d.getObject(c.readUInt()));this.attrib&32&&(a=c.readUByte(),this.isStatic=0!==(a&1),this.visible=0===(a&2))};SEA3D.Object3D.prototype.readTag=function(a,c,d){};
  SEA3D.Entity3D=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.castShadows=!0;this.attrib&64&&(this.castShadows=0===(c.readUByte()&1))};SEA3D.Entity3D.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Entity3D.prototype.constructor=SEA3D.Entity3D;SEA3D.Sound3D=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.autoPlay=0!=(this.attrib&64);this.attrib&128&&(this.mixer=d.getObject(c.readUInt()));this.sound=d.getObject(c.readUInt());this.volume=c.readFloat()};SEA3D.Sound3D.prototype=Object.create(SEA3D.Object3D.prototype);
  SEA3D.Sound3D.prototype.constructor=SEA3D.Sound3D;SEA3D.SoundPoint=function(a,c,d){SEA3D.Sound3D.call(this,a,c,d);this.position=c.readVector3();this.distance=c.readFloat();c.readTags(this.readTag.bind(this))};SEA3D.SoundPoint.prototype=Object.create(SEA3D.Sound3D.prototype);SEA3D.SoundPoint.prototype.constructor=SEA3D.SoundPoint;SEA3D.SoundPoint.prototype.type="sp";SEA3D.Container3D=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.transform=c.readMatrix();c.readTags(this.readTag.bind(this))};
  SEA3D.Container3D.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Container3D.prototype.constructor=SEA3D.Container3D;SEA3D.Container3D.prototype.type="c3d";SEA3D.ScriptURL=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.url=c.readUTF8(c.length)};SEA3D.ScriptURL.prototype.type="src";SEA3D.TextureURL=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.url=d.config.path+c.readUTF8(c.length)};SEA3D.TextureURL.prototype.type="urlT";
  SEA3D.CubeMapURL=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.faces=[];for(a=0;6>a;a++)this.faces[a]=c.readUTF8Tiny()};SEA3D.CubeMapURL.prototype.type="cURL";
  SEA3D.Actions=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.count=c.readUInt();this.actions=[];for(a=0;a<this.count;a++){var f=c.readUByte(),l=c.readUShort(),m=c.readUShort(),r=c.position,q=this.actions[a]={kind:l};f&1&&(q.range=[c.readUInt(),c.readUInt()]);f&2&&(q.time=c.readUInt());f&4&&(q.intrpl=c.readInterpolation(),0===q.intrpl.indexOf("back.")?q.intrplParam0=c.readFloat():0===q.intrpl.indexOf("elastic.")&&(q.intrplParam0=c.readFloat(),q.intrplParam1=c.readFloat()));switch(l){case SEA3D.Actions.RTT_TARGET:q.source=
  d.getObject(c.readUInt());q.target=d.getObject(c.readUInt());break;case SEA3D.Actions.LOOK_AT:q.source=d.getObject(c.readUInt());q.target=d.getObject(c.readUInt());break;case SEA3D.Actions.PLAY_SOUND:q.sound=d.getObject(c.readUInt());q.offset=c.readUInt();break;case SEA3D.Actions.PLAY_ANIMATION:q.object=d.getObject(c.readUInt());q.name=c.readUTF8Tiny();break;case SEA3D.Actions.FOG:q.color=c.readUInt24();q.min=c.readFloat();q.max=c.readFloat();break;case SEA3D.Actions.ENVIRONMENT:q.texture=d.getObject(c.readUInt());
  break;case SEA3D.Actions.ENVIRONMENT_COLOR:q.color=c.readUInt24F();break;case SEA3D.Actions.CAMERA:q.camera=d.getObject(c.readUInt());break;case SEA3D.Actions.SCRIPTS:q.scripts=c.readScriptList(d);break;case SEA3D.Actions.CLASS_OF:q.classof=d.getObject(c.readUInt());break;case SEA3D.Actions.ATTRIBUTES:q.attributes=d.getObject(c.readUInt());break;default:console.log('Action "'+l+'" not found.')}c.position=r+m}};SEA3D.Actions.SCENE=0;SEA3D.Actions.ENVIRONMENT_COLOR=1;SEA3D.Actions.ENVIRONMENT=2;
  SEA3D.Actions.FOG=3;SEA3D.Actions.PLAY_ANIMATION=4;SEA3D.Actions.PLAY_SOUND=5;SEA3D.Actions.ANIMATION_AUDIO_SYNC=6;SEA3D.Actions.LOOK_AT=7;SEA3D.Actions.RTT_TARGET=8;SEA3D.Actions.CAMERA=9;SEA3D.Actions.SCRIPTS=10;SEA3D.Actions.CLASS_OF=11;SEA3D.Actions.ATTRIBUTES=12;SEA3D.Actions.prototype.type="act";SEA3D.Properties=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.props=c.readProperties(d);this.props.__name=a};SEA3D.Properties.prototype.type="prop";
  SEA3D.FileInfo=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.info=c.readProperties(d);this.info.__name=a;d.info=this.info};SEA3D.FileInfo.prototype.type="info";SEA3D.JavaScript=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.src=c.readUTF8(c.length)};SEA3D.JavaScript.prototype.type="js";SEA3D.JavaScriptMethod=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;a=c.readUShort();this.methods={};for(d=0;d<a;d++){c.readUByte();var f=c.readUTF8Tiny();this.methods[f]={src:c.readUTF8Long()}}};
  SEA3D.JavaScriptMethod.prototype.type="jsm";SEA3D.GLSL=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.src=c.readUTF8(c.length)};SEA3D.GLSL.prototype.type="glsl";SEA3D.Dummy=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.transform=c.readMatrix();this.width=c.readFloat();this.height=c.readFloat();this.depth=c.readFloat();c.readTags(this.readTag.bind(this))};SEA3D.Dummy.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Dummy.prototype.constructor=SEA3D.Dummy;
  SEA3D.Dummy.prototype.type="dmy";SEA3D.Line=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.count=3*(this.attrib&64?c.readUInt():c.readUShort());this.closed=0!=(this.attrib&128);this.transform=c.readMatrix();this.vertex=[];for(a=0;a<this.count;)this.vertex[a++]=c.readFloat();c.readTags(this.readTag.bind(this))};SEA3D.Line.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Line.prototype.constructor=SEA3D.Line;SEA3D.Line.prototype.type="line";
  SEA3D.Sprite=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.attrib&256&&(this.material=d.getObject(c.readUInt()));this.position=c.readVector3();this.width=c.readFloat();this.height=c.readFloat();c.readTags(this.readTag.bind(this))};SEA3D.Sprite.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Sprite.prototype.constructor=SEA3D.Sprite;SEA3D.Sprite.prototype.type="m2d";
  SEA3D.Mesh=function(a,c,d){SEA3D.Entity3D.call(this,a,c,d);if(this.attrib&256)if(this.material=[],a=c.readUByte(),1===a)this.material[0]=d.getObject(c.readUInt());else for(var f=0;f<a;){var l=c.readUInt();0<l?this.material[f++]=d.getObject(l-1):this.material[f++]=void 0}if(this.attrib&512)for(this.modifiers=[],a=c.readUByte(),f=0;f<a;f++)this.modifiers[f]=d.getObject(c.readUInt());this.attrib&1024&&(this.reference={type:c.readUByte(),ref:d.getObject(c.readUInt())});this.transform=c.readMatrix();this.geometry=
  d.getObject(c.readUInt());c.readTags(this.readTag.bind(this))};SEA3D.Mesh.prototype=Object.create(SEA3D.Entity3D.prototype);SEA3D.Mesh.prototype.constructor=SEA3D.Mesh;SEA3D.Mesh.prototype.type="m3d";SEA3D.Skeleton=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;a=c.readUShort();this.joint=[];for(d=0;d<a;d++)this.joint[d]={name:c.readUTF8Tiny(),parentIndex:c.readUShort()-1,inverseBindMatrix:c.readMatrix()}};SEA3D.Skeleton.prototype.type="skl";
  SEA3D.SkeletonLocal=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;a=c.readUShort();this.joint=[];for(d=0;d<a;d++)this.joint[d]={name:c.readUTF8Tiny(),parentIndex:c.readUShort()-1,x:c.readFloat(),y:c.readFloat(),z:c.readFloat(),qx:c.readFloat(),qy:c.readFloat(),qz:c.readFloat(),qw:c.readFloat()}};SEA3D.SkeletonLocal.prototype.type="sklq";
  SEA3D.AnimationBase=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;a=c.readUByte();this.sequence=[];if(a&1)for(a=c.readUShort(),d=0;d<a;d++){var f=c.readUByte();this.sequence[d]={name:c.readUTF8Tiny(),start:c.readUInt(),count:c.readUInt(),repeat:0!==(f&1),intrpl:0===(f&2)}}this.frameRate=c.readUByte();this.numFrames=c.readUInt();0===this.sequence.length&&(this.sequence[0]={name:"root",start:0,count:this.numFrames,repeat:!0,intrpl:!0})};
  SEA3D.Animation=function(a,c,d){SEA3D.AnimationBase.call(this,a,c,d);this.dataList=[];a=0;for(d=c.readUByte();a<d;a++){var f=c.readUShort(),l=c.readUByte(),m=c.readVector(l,this.numFrames,0);this.dataList.push({kind:f,type:l,blockSize:SEA3D.Stream.sizeOf(l),data:m})}};SEA3D.Animation.POSITION=0;SEA3D.Animation.ROTATION=1;SEA3D.Animation.SCALE=2;SEA3D.Animation.COLOR=3;SEA3D.Animation.MULTIPLIER=4;SEA3D.Animation.ATTENUATION_START=5;SEA3D.Animation.ATTENUATION_END=6;SEA3D.Animation.FOV=7;
  SEA3D.Animation.OFFSET_U=8;SEA3D.Animation.OFFSET_V=9;SEA3D.Animation.SCALE_U=10;SEA3D.Animation.SCALE_V=11;SEA3D.Animation.DEGREE=12;SEA3D.Animation.ALPHA=13;SEA3D.Animation.VOLUME=14;SEA3D.Animation.RADIAN=15;SEA3D.Animation.MORPH=250;SEA3D.Animation.prototype=Object.create(SEA3D.AnimationBase.prototype);SEA3D.Animation.prototype.constructor=SEA3D.Animation;SEA3D.Animation.prototype.type="anm";
  SEA3D.SkeletonAnimation=function(a,c,d){SEA3D.AnimationBase.call(this,a,c,d);this.name=a;this.data=c;this.sea3d=d;this.numJoints=c.readUShort();this.raw=c.readFloatArray(this.numFrames*this.numJoints*7)};SEA3D.SkeletonAnimation.prototype.type="skla";SEA3D.UVWAnimation=function(a,c,d){SEA3D.Animation.call(this,a,c,d)};SEA3D.UVWAnimation.prototype.type="auvw";
  SEA3D.Morph=function(a,c,d){SEA3D.GeometryBase.call(this,a,c,d);a=0!=(this.attrib&2);d=0!=(this.attrib&4);var f=c.readUShort();this.node=[];for(var l=0;l<f;l++){var m=c.readUTF8Tiny(),r,q;a&&(r=c.readFloatArray(this.length));d&&(q=c.readFloatArray(this.length));this.node[l]={vertex:r,normal:q,name:m}}};SEA3D.Morph.prototype=Object.create(SEA3D.GeometryBase.prototype);SEA3D.Morph.prototype.constructor=SEA3D.Morph;SEA3D.Morph.prototype.type="mph";
  SEA3D.MorphAnimation=function(a,c,d){SEA3D.AnimationBase.call(this,a,c,d);this.dataList=[];a=0;for(d=c.readUByte();a<d;a++)this.dataList.push({kind:SEA3D.Animation.MORPH,type:SEA3D.Stream.FLOAT,name:c.readUTF8Tiny(),blockSize:1,data:c.readVector(SEA3D.Stream.FLOAT,this.numFrames,0)})};SEA3D.MorphAnimation.prototype.type="mpha";
  SEA3D.VertexAnimation=function(a,c,d){SEA3D.AnimationBase.call(this,a,c,d);d=c.readUByte();this.isBig=0!=(d&1);c.readVInt=this.isBig?c.readUInt:c.readUShort;this.numVertex=c.readVInt();this.length=3*this.numVertex;a=0!=(d&2);d=0!=(d&4);this.frame=[];var f,l,m;for(f=0;f<this.numFrames;f++)a&&(l=c.readFloatArray(this.length)),d&&(m=c.readFloatArray(this.length)),this.frame[f]={vertex:l,normal:m}};SEA3D.VertexAnimation.prototype=Object.create(SEA3D.AnimationBase.prototype);
  SEA3D.VertexAnimation.prototype.constructor=SEA3D.VertexAnimation;SEA3D.VertexAnimation.prototype.type="vtxa";SEA3D.Camera=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.attrib&64&&(this.dof={distance:c.readFloat(),range:c.readFloat()});this.transform=c.readMatrix();this.fov=c.readFloat();c.readTags(this.readTag.bind(this))};SEA3D.Camera.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Camera.prototype.constructor=SEA3D.Camera;SEA3D.Camera.prototype.type="cam";
  SEA3D.OrthographicCamera=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.transform=c.readMatrix();this.height=c.readFloat();c.readTags(this.readTag.bind(this))};SEA3D.OrthographicCamera.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.OrthographicCamera.prototype.constructor=SEA3D.OrthographicCamera;SEA3D.OrthographicCamera.prototype.type="camo";SEA3D.JointObject=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.target=d.getObject(c.readUInt());this.joint=c.readUShort();c.readTags(this.readTag.bind(this))};
  SEA3D.JointObject.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.JointObject.prototype.constructor=SEA3D.JointObject;SEA3D.JointObject.prototype.type="jnt";
  SEA3D.Light=function(a,c,d){SEA3D.Object3D.call(this,a,c,d);this.attenEnd=this.attenStart=Number.MAX_VALUE;this.attrib&64&&(a=c.readUByte(),this.shadow={},this.shadow.opacity=a&1?c.readFloat():1,this.shadow.color=a&2?c.readUInt24():0);this.attrib&512&&(this.attenStart=c.readFloat(),this.attenEnd=c.readFloat());this.color=c.readUInt24();this.multiplier=c.readFloat()};SEA3D.Light.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Light.prototype.constructor=SEA3D.Light;
  SEA3D.PointLight=function(a,c,d){SEA3D.Light.call(this,a,c,d);this.attrib&128&&(this.attenuation={start:c.readFloat(),end:c.readFloat()});this.position=c.readVector3();c.readTags(this.readTag.bind(this))};SEA3D.PointLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.PointLight.prototype.constructor=SEA3D.PointLight;SEA3D.PointLight.prototype.type="plht";
  SEA3D.HemisphereLight=function(a,c,d){SEA3D.Light.call(this,a,c,d);this.attrib&128&&(this.attenuation={start:c.readFloat(),end:c.readFloat()});this.secondColor=c.readUInt24();c.readTags(this.readTag.bind(this))};SEA3D.HemisphereLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.HemisphereLight.prototype.constructor=SEA3D.HemisphereLight;SEA3D.HemisphereLight.prototype.type="hlht";SEA3D.AmbientLight=function(a,c,d){SEA3D.Light.call(this,a,c,d);c.readTags(this.readTag.bind(this))};
  SEA3D.AmbientLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.AmbientLight.prototype.constructor=SEA3D.AmbientLight;SEA3D.AmbientLight.prototype.type="alht";SEA3D.DirectionalLight=function(a,c,d){SEA3D.Light.call(this,a,c,d);this.transform=c.readMatrix();c.readTags(this.readTag.bind(this))};SEA3D.DirectionalLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.DirectionalLight.prototype.constructor=SEA3D.DirectionalLight;SEA3D.DirectionalLight.prototype.type="dlht";
  SEA3D.Material=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.technique=[];this.tecniquesDict={};this.attrib=c.readUShort();this.alpha=1;this.blendMode="normal";this.doubleSided=0!=(this.attrib&1);this.receiveLights=0===(this.attrib&2);this.receiveShadows=0===(this.attrib&4);this.receiveFog=0===(this.attrib&8);this.repeat=0===(this.attrib&16);this.attrib&32&&(this.alpha=c.readFloat());this.attrib&64&&(this.blendMode=c.readBlendMode());this.attrib&128&&(this.animations=c.readAnimationList(d));
  this.depthWrite=0===(this.attrib&256);this.depthTest=0===(this.attrib&512);this.premultipliedAlpha=0!=(this.attrib&1024);a=c.readUByte();for(var f=0;f<a;++f){var l=c.readUShort(),m=c.readUShort(),r=c.position,q,t;switch(l){case SEA3D.Material.PHONG:q={ambientColor:c.readUInt24(),diffuseColor:c.readUInt24(),specularColor:c.readUInt24(),specular:c.readFloat(),gloss:c.readFloat()};break;case SEA3D.Material.PHYSICAL:q={color:c.readUInt24(),roughness:c.readFloat(),metalness:c.readFloat()};break;case SEA3D.Material.ANISOTROPIC:break;
  case SEA3D.Material.COMPOSITE_TEXTURE:q={composite:d.getObject(c.readUInt())};break;case SEA3D.Material.DIFFUSE_MAP:case SEA3D.Material.SPECULAR_MAP:case SEA3D.Material.NORMAL_MAP:case SEA3D.Material.AMBIENT_MAP:case SEA3D.Material.ALPHA_MAP:case SEA3D.Material.EMISSIVE_MAP:case SEA3D.Material.ROUGHNESS_MAP:case SEA3D.Material.METALNESS_MAP:q={texture:d.getObject(c.readUInt())};break;case SEA3D.Material.REFLECTION:case SEA3D.Material.FRESNEL_REFLECTION:q={texture:d.getObject(c.readUInt()),alpha:c.readFloat()};
  l===SEA3D.Material.FRESNEL_REFLECTION&&(q.power=c.readFloat(),q.normal=c.readFloat());break;case SEA3D.Material.REFRACTION:q={texture:d.getObject(c.readUInt()),alpha:c.readFloat(),ior:c.readFloat()};break;case SEA3D.Material.RIM:q={color:c.readUInt24(),strength:c.readFloat(),power:c.readFloat(),blendMode:c.readBlendMode()};break;case SEA3D.Material.LIGHT_MAP:q={texture:d.getObject(c.readUInt()),channel:c.readUByte(),blendMode:c.readBlendMode()};break;case SEA3D.Material.DETAIL_MAP:q={texture:d.getObject(c.readUInt()),
  scale:c.readFloat(),blendMode:c.readBlendMode()};break;case SEA3D.Material.CEL:q={color:c.readUInt24(),levels:c.readUByte(),size:c.readFloat(),specularCutOff:c.readFloat(),smoothness:c.readFloat()};break;case SEA3D.Material.TRANSLUCENT:q={translucency:c.readFloat(),scattering:c.readFloat()};break;case SEA3D.Material.BLEND_NORMAL_MAP:t=c.readUByte();q={texture:d.getObject(c.readUInt()),secondaryTexture:d.getObject(c.readUInt())};t&1?(q.offsetX0=c.readFloat(),q.offsetY0=c.readFloat(),q.offsetX1=c.readFloat(),
  q.offsetY1=c.readFloat()):q.offsetX0=q.offsetY0=q.offsetX1=q.offsetY1=0;q.animate=t&2;break;case SEA3D.Material.MIRROR_REFLECTION:q={texture:d.getObject(c.readUInt()),alpha:c.readFloat()};break;case SEA3D.Material.EMISSIVE:q={color:c.readUInt24F()};break;case SEA3D.Material.VERTEX_COLOR:q={blendMode:c.readBlendMode()};break;case SEA3D.Material.WRAP_LIGHTING:q={color:c.readUInt24(),strength:c.readFloat()};break;case SEA3D.Material.COLOR_REPLACE:t=c.readUByte();q={red:c.readUInt24(),green:c.readUInt24(),
  blue:c.readUInt24F()};t&1&&(q.mask=d.getObject(c.readUInt()));t&2&&(q.alpha=c.readFloat());break;case SEA3D.Material.REFLECTION_SPHERICAL:q={texture:d.getObject(c.readUInt()),alpha:c.readFloat()};break;case SEA3D.Material.REFLECTIVITY:t=c.readUByte();q={strength:c.readFloat()};t&1&&(q.mask=d.getObject(c.readUInt()));break;case SEA3D.Material.CLEAR_COAT:q={strength:c.readFloat(),roughness:c.readFloat()};break;case SEA3D.Material.FLACCIDITY:t=c.readUByte();q={target:d.getObject(c.readUInt()),scale:c.readFloat(),
  spring:c.readFloat(),damping:c.readFloat()};t&1&&(q.mask=d.getObject(c.readUInt()));break;default:console.warn("SEA3D: MaterialTechnique not found:",l.toString(16));c.position=r+m;continue}q.kind=l;this.technique.push(q);this.tecniquesDict[l]=q;c.position=r+m}};SEA3D.Material.PHONG=0;SEA3D.Material.COMPOSITE_TEXTURE=1;SEA3D.Material.DIFFUSE_MAP=2;SEA3D.Material.SPECULAR_MAP=3;SEA3D.Material.REFLECTION=4;SEA3D.Material.REFRACTION=5;SEA3D.Material.NORMAL_MAP=6;SEA3D.Material.FRESNEL_REFLECTION=7;
  SEA3D.Material.RIM=8;SEA3D.Material.LIGHT_MAP=9;SEA3D.Material.DETAIL_MAP=10;SEA3D.Material.CEL=11;SEA3D.Material.TRANSLUCENT=12;SEA3D.Material.BLEND_NORMAL_MAP=13;SEA3D.Material.MIRROR_REFLECTION=14;SEA3D.Material.AMBIENT_MAP=15;SEA3D.Material.ALPHA_MAP=16;SEA3D.Material.EMISSIVE_MAP=17;SEA3D.Material.VERTEX_COLOR=18;SEA3D.Material.WRAP_LIGHTING=19;SEA3D.Material.COLOR_REPLACE=20;SEA3D.Material.REFLECTION_SPHERICAL=21;SEA3D.Material.ANISOTROPIC=22;SEA3D.Material.EMISSIVE=23;
  SEA3D.Material.PHYSICAL=24;SEA3D.Material.ROUGHNESS_MAP=25;SEA3D.Material.METALNESS_MAP=26;SEA3D.Material.REFLECTIVITY=27;SEA3D.Material.CLEAR_COAT=28;SEA3D.Material.FLACCIDITY=29;SEA3D.Material.prototype.type="mat";SEA3D.Composite=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;a=c.readUByte();this.layer=[];for(var f=0;f<a;f++)this.layer[f]=new SEA3D.Composite.prototype.Layer(c,d)};
  SEA3D.Composite.prototype.getLayerByName=function(a){for(var c=0;c<this.layer.length;c++)if(this.layer[c].name===a)return this.layer[c]};SEA3D.Composite.prototype.Layer=function(a,c){var d=a.readUShort();d&1?this.texture=new SEA3D.Composite.LayerBitmap(a,c):this.color=a.readUInt24();d&2&&(this.mask=new SEA3D.Composite.LayerBitmap(a,c));d&4&&(this.name=a.readUTF8Tiny());this.blendMode=d&8?a.readBlendMode():"normal";this.opacity=d&16?a.readFloat():1};
  SEA3D.Composite.LayerBitmap=function(a,c){this.map=c.getObject(a.readUInt());var d=a.readUShort();this.channel=d&1?a.readUByte():0;this.repeat=d&0;this.offsetU=d&4?a.readFloat():0;this.offsetV=d&8?a.readFloat():0;this.scaleU=d&16?a.readFloat():1;this.scaleV=d&32?a.readFloat():1;this.rotation=d&64?a.readFloat():0;d&128&&(this.animation=a.readAnimationList(c))};SEA3D.Composite.prototype.type="ctex";
  SEA3D.PlanarRender=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.attrib=c.readUByte();this.quality=this.attrib&1|this.attrib&2;this.transform=c.readMatrix()};SEA3D.PlanarRender.prototype.type="rttp";SEA3D.CubeRender=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.attrib=c.readUByte();this.quality=this.attrib&1|this.attrib&2;this.position=c.readVector3()};SEA3D.CubeRender.prototype.type="rttc";
  SEA3D.CubeMap=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.transparent=!1;this.extension=c.readExt();this.faces=[];for(a=0;6>a;a++)d=c.readUInt(),this.faces[a]=c.concat(c.position,d),c.position+=d};SEA3D.CubeMap.prototype.type="cmap";SEA3D.JPEG=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.transparent=!1};SEA3D.JPEG.prototype.type="jpg";SEA3D.JPEG_XR=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.transparent=!0};SEA3D.JPEG_XR.prototype.type="wdp";
  SEA3D.PNG=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.transparent=6===c.getByte(25)};SEA3D.PNG.prototype.type="png";SEA3D.GIF=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.transparent=0<c.getByte(11)};SEA3D.GIF.prototype.type="gif";SEA3D.OGG=function(a,c,d){this.name=a;this.data=c;this.sea3d=d};SEA3D.OGG.prototype.type="ogg";SEA3D.MP3=function(a,c,d){this.name=a;this.data=c;this.sea3d=d};SEA3D.MP3.prototype.type="mp3";
  SEA3D.AssetUpdate=function(a,c,d){this.name=a;this.data=c;this.sea3d=d;this.index=c.readUInt();this.bytes=c.concat(c.position,c.length-c.position)};SEA3D.AssetUpdate.prototype.type="upDt";
  SEA3D.File=function(a){this.config={streaming:!0,timeLimit:60,progressive:!1};a&&(void 0!==a.streaming&&(this.config.streaming=a.streaming),void 0!==a.timeLimit&&(this.config.timeLimit=a.timeLimit),void 0!==a.progressive&&(this.config.progressive=a.progressive),void 0!==a.path&&(this.config.path=a.path));this.version=SEA3D.VERSION;this.objects=[];this.typeClass={};this.typeRead={};this.typeUnique={};this.position=this.dataPosition=0;this.scope=this;this.addClass(SEA3D.FileInfo,!0);this.addClass(SEA3D.Geometry,
  !0);this.addClass(SEA3D.Mesh);this.addClass(SEA3D.Sprite);this.addClass(SEA3D.Material);this.addClass(SEA3D.Composite);this.addClass(SEA3D.PointLight);this.addClass(SEA3D.DirectionalLight);this.addClass(SEA3D.HemisphereLight);this.addClass(SEA3D.AmbientLight);this.addClass(SEA3D.Animation,!0);this.addClass(SEA3D.Skeleton,!0);this.addClass(SEA3D.SkeletonLocal,!0);this.addClass(SEA3D.SkeletonAnimation,!0);this.addClass(SEA3D.UVWAnimation,!0);this.addClass(SEA3D.JointObject);this.addClass(SEA3D.Camera);
  this.addClass(SEA3D.OrthographicCamera);this.addClass(SEA3D.Morph,!0);this.addClass(SEA3D.MorphAnimation,!0);this.addClass(SEA3D.VertexAnimation,!0);this.addClass(SEA3D.CubeMap,!0);this.addClass(SEA3D.Dummy);this.addClass(SEA3D.Line);this.addClass(SEA3D.SoundPoint);this.addClass(SEA3D.PlanarRender);this.addClass(SEA3D.CubeRender);this.addClass(SEA3D.Actions);this.addClass(SEA3D.Container3D);this.addClass(SEA3D.Properties);this.addClass(SEA3D.ScriptURL,!0);this.addClass(SEA3D.TextureURL,!0);this.addClass(SEA3D.CubeMapURL,
  !0);this.addClass(SEA3D.JPEG,!0);this.addClass(SEA3D.JPEG_XR,!0);this.addClass(SEA3D.PNG,!0);this.addClass(SEA3D.GIF,!0);this.addClass(SEA3D.OGG,!0);this.addClass(SEA3D.MP3,!0);this.addClass(SEA3D.JavaScript,!0);this.addClass(SEA3D.JavaScriptMethod,!0);this.addClass(SEA3D.GLSL,!0);this.addClass(SEA3D.AssetUpdate,!0);for(a=SEA3D.File.Extensions.length;a--;)SEA3D.File.Extensions[a].call(this)};SEA3D.File.Extensions=[];SEA3D.File.CompressionLibs={};SEA3D.File.DecompressionMethod={};
  SEA3D.File.setExtension=function(a){SEA3D.File.Extensions.push(a)};SEA3D.File.setDecompressionEngine=function(a,c,d){SEA3D.File.CompressionLibs[a]=c;SEA3D.File.DecompressionMethod[a]=d};SEA3D.File.prototype.addClass=function(a,c){this.typeClass[a.prototype.type]=a;this.typeUnique[a.prototype.type]=!0===c};
  SEA3D.File.prototype.readHead=function(){if(16>this.stream.bytesAvailable)return!1;if("SEA"!=this.stream.readUTF8(3))throw Error("Invalid SEA3D format.");this.sign=this.stream.readUTF8(3);this.version=this.stream.readUInt24();if(0!=this.stream.readUByte())throw Error("Protection algorithm not compatible.");this.compressionID=this.stream.readUByte();this.compressionAlgorithm=SEA3D.File.CompressionLibs[this.compressionID];this.decompressionMethod=SEA3D.File.DecompressionMethod[this.compressionID];if(0<
  this.compressionID&&!this.decompressionMethod)throw Error("Compression algorithm not compatible.");this.length=this.stream.readUInt();this.dataPosition=this.stream.position;this.objects.length=0;this.state=this.readBody;if(this.onHead)this.onHead({file:this,sign:this.sign});return!0};SEA3D.File.prototype.getObject=function(a){return this.objects[a]};SEA3D.File.prototype.getObjectIndex=function(a){return this.objects[a].index};SEA3D.File.prototype.getObjectByName=function(a){return this.getObject(this.getObjectIndex(a))};
  SEA3D.File.prototype.readSEAObject=function(){if(4>this.stream.bytesAvailable)return null;var a=this.stream.readUInt(),c=this.stream.position;if(this.stream.bytesAvailable<a)return null;var d=this.stream.readUByte(),f=this.stream.readExt(),l=null,m=d&1?this.stream.readUTF8Tiny():"",r=0!=(d&2),q=0!=(d&4);d&8&&(l=this.stream.readUShort(),d=this.stream.concat(this.stream.position,l),this.stream.position+=l,r&&this.decompressionMethod&&(d.buffer=this.decompressionMethod(d.buffer)),l=d.readProperties(this));
  a-=this.stream.position-c;c=this.stream.position;d=this.stream.concat(c,a);this.typeClass[f]?(r&&this.decompressionMethod&&(d.buffer=this.decompressionMethod(d.buffer)),r=new this.typeClass[f](m,d,this),(this.config.streaming&&q||this.config.forceStreaming)&&this.typeRead[f]&&this.typeRead[f].call(this.scope,r)):(r=new SEA3D.Object(m,d,f,this),console.warn('SEA3D: Unknown format "'+f+'" of file "'+m+'". Add a module referring for this format.'));r.index=this.objects.length;r.streaming=q;r.metadata=
  l;this.objects.push(this.objects[r.name+"."+r.type]=r);this.dataPosition=c+a;++this.position;return r};SEA3D.File.prototype.isDone=function(){return this.position===this.length};
  SEA3D.File.prototype.readBody=function(){this.timer.update();if(!this.resume)return!1;for(;this.position<this.length;)if(this.timer.deltaTime<this.config.timeLimit){this.stream.position=this.dataPosition;var a=this.readSEAObject();if(a)this.dispatchCompleteObject(a);else return!1}else return!1;this.state=this.readComplete;return!0};SEA3D.File.prototype.initParse=function(){this.timer=new SEA3D.Timer;this.position=0;this.resume=!0};
  SEA3D.File.prototype.parse=function(){this.initParse();isFinite(this.config.timeLimit)?requestAnimationFrame(this.parseObject.bind(this)):this.parseObject()};
  SEA3D.File.prototype.parseObject=function(){for(this.timer.update();this.position<this.length&&this.timer.deltaTime<this.config.timeLimit;){var a=this.objects[this.position++],c=a.type;this.typeUnique[c]||delete a.tag;(a.streaming||this.config.forceStreaming)&&this.typeRead[c]&&void 0===a.tag&&this.typeRead[c].call(this.scope,a)}if(this.position===this.length)if(a=this.timer.elapsedTime,c=a+"ms, "+this.objects.length+" objects",this.onParseComplete)this.onParseComplete({file:this,timeTotal:a,message:c});
  else console.log("SEA3D Parse Complete:",c);else{if(this.onParseProgress)this.onParseProgress({file:this,loaded:this.position,total:this.length});setTimeout(this.parseObject.bind(this),10)}};SEA3D.File.prototype.readComplete=function(){this.stream.position=this.dataPosition;6202321!=this.stream.readUInt24F()&&console.warn("SEA3D file is corrupted.");delete this.state;return!1};
  SEA3D.File.prototype.readState=function(){for(;this.state(););this.state?(requestAnimationFrame(this.readState.bind(this)),this.dispatchProgress()):this.dispatchComplete()};SEA3D.File.prototype.append=function(a){this.state?this.stream.append(a):this.read(a)};SEA3D.File.prototype.read=function(a){if(!a)throw Error("No data found.");this.initParse();this.stream=new SEA3D.Stream(a);this.state=this.readHead;this.readState()};
  SEA3D.File.prototype.dispatchCompleteObject=function(a){if(this.onCompleteObject)this.onCompleteObject({file:this,object:a})};SEA3D.File.prototype.dispatchProgress=function(){if(this.onProgress)this.onProgress({file:this,loaded:this.position,total:this.length})};SEA3D.File.prototype.dispatchDownloadProgress=function(a,c){if(this.onDownloadProgress)this.onDownloadProgress({file:this,loaded:a,total:c})};
  SEA3D.File.prototype.dispatchComplete=function(){var a=this.timer.elapsedTime,c=a+"ms, "+this.objects.length+" objects";if(this.onComplete)this.onComplete({file:this,timeTotal:a,message:c});else console.log("SEA3D:",c)};SEA3D.File.prototype.dispatchError=function(a,c){if(this.onError)this.onError({file:this,id:a,message:c});else console.error("SEA3D: #"+a,c)};SEA3D.File.prototype.extractUrlBase=function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"};
  SEA3D.File.prototype.load=function(a){var c=this,d=new XMLHttpRequest;d.open("GET",a,!0);this.config.path||(this.config.path=this.extractUrlBase(a));if(c.config.progressive){var f=0;d.overrideMimeType("text/plain; charset=x-user-defined")}else d.responseType="arraybuffer";d.onprogress=function(a){if(c.config.progressive){for(var m=d.responseText.substring(f),r=new Uint8Array(m.length),q=0;q<m.length;q++)r[q]=m.charCodeAt(q)&255;f+=m.length;c.append(r.buffer)}c.dispatchDownloadProgress(a.loaded,a.total)};
  c.config.progressive||(d.onreadystatechange=function(){4===d.readyState&&(200===d.status||0===d.status?c.read(this.response):this.dispatchError(1001,"Couldn't load ["+a+"] ["+d.status+"]"))});d.send()};
  SEA3D.LZMA=function(){var a=a||{};a.OutWindow=function(){this._windowSize=0};a.OutWindow.prototype.create=function(a){this._buffer&&this._windowSize===a||(this._buffer=[]);this._windowSize=a;this._streamPos=this._pos=0};a.OutWindow.prototype.flush=function(){var a=this._pos-this._streamPos;if(0!==a){for(;a--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0);this._streamPos=this._pos}};a.OutWindow.prototype.releaseStream=function(){this.flush();this._stream=
  null};a.OutWindow.prototype.setStream=function(a){this.releaseStream();this._stream=a};a.OutWindow.prototype.init=function(a){a||(this._pos=this._streamPos=0)};a.OutWindow.prototype.copyBlock=function(a,d){var f=this._pos-a-1;for(0>f&&(f+=this._windowSize);d--;)f>=this._windowSize&&(f=0),this._buffer[this._pos++]=this._buffer[f++],this._pos>=this._windowSize&&this.flush()};a.OutWindow.prototype.putByte=function(a){this._buffer[this._pos++]=a;this._pos>=this._windowSize&&this.flush()};a.OutWindow.prototype.getByte=
  function(a){a=this._pos-a-1;0>a&&(a+=this._windowSize);return this._buffer[a]};a.RangeDecoder=function(){};a.RangeDecoder.prototype.setStream=function(a){this._stream=a};a.RangeDecoder.prototype.releaseStream=function(){this._stream=null};a.RangeDecoder.prototype.init=function(){var a=5;this._code=0;for(this._range=-1;a--;)this._code=this._code<<8|this._stream.readByte()};a.RangeDecoder.prototype.decodeDirectBits=function(a){for(var d=0,f;a--;)this._range>>>=1,f=this._code-this._range>>>31,this._code-=
  this._range&f-1,d=d<<1|1-f,0===(this._range&4278190080)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return d};a.RangeDecoder.prototype.decodeBit=function(a,d){var f=a[d],l=(this._range>>>11)*f;if((this._code^2147483648)<(l^2147483648))return this._range=l,a[d]+=2048-f>>>5,0===(this._range&4278190080)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0;this._range-=l;this._code-=l;a[d]-=f>>>5;0===(this._range&4278190080)&&(this._code=this._code<<8|this._stream.readByte(),
  this._range<<=8);return 1};a.initBitModels=function(a,d){for(;d--;)a[d]=1024};a.BitTreeDecoder=function(a){this._models=[];this._numBitLevels=a};a.BitTreeDecoder.prototype.init=function(){a.initBitModels(this._models,1<<this._numBitLevels)};a.BitTreeDecoder.prototype.decode=function(a){for(var d=1,f=this._numBitLevels;f--;)d=d<<1|a.decodeBit(this._models,d);return d-(1<<this._numBitLevels)};a.BitTreeDecoder.prototype.reverseDecode=function(a){for(var d=1,f=0,l=0,m;l<this._numBitLevels;++l)m=a.decodeBit(this._models,
  d),d=d<<1|m,f|=m<<l;return f};a.reverseDecode2=function(a,d,f,l){for(var m=1,r=0,q=0,t;q<l;++q)t=f.decodeBit(a,d+m),m=m<<1|t,r|=t<<q;return r};a.LenDecoder=function(){this._choice=[];this._lowCoder=[];this._midCoder=[];this._highCoder=new a.BitTreeDecoder(8);this._numPosStates=0};a.LenDecoder.prototype.create=function(c){for(;this._numPosStates<c;++this._numPosStates)this._lowCoder[this._numPosStates]=new a.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new a.BitTreeDecoder(3)};a.LenDecoder.prototype.init=
  function(){var c=this._numPosStates;for(a.initBitModels(this._choice,2);c--;)this._lowCoder[c].init(),this._midCoder[c].init();this._highCoder.init()};a.LenDecoder.prototype.decode=function(a,d){return 0===a.decodeBit(this._choice,0)?this._lowCoder[d].decode(a):0===a.decodeBit(this._choice,1)?8+this._midCoder[d].decode(a):16+this._highCoder.decode(a)};a.Decoder2=function(){this._decoders=[]};a.Decoder2.prototype.init=function(){a.initBitModels(this._decoders,768)};a.Decoder2.prototype.decodeNormal=
  function(a){var d=1;do d=d<<1|a.decodeBit(this._decoders,d);while(256>d);return d&255};a.Decoder2.prototype.decodeWithMatchByte=function(a,d){var f=1,l,m;do if(l=d>>7&1,d<<=1,m=a.decodeBit(this._decoders,(1+l<<8)+f),f=f<<1|m,l!==m){for(;256>f;)f=f<<1|a.decodeBit(this._decoders,f);break}while(256>f);return f&255};a.LiteralDecoder=function(){};a.LiteralDecoder.prototype.create=function(c,d){var f;if(!this._coders||this._numPrevBits!==d||this._numPosBits!==c)for(this._numPosBits=c,this._posMask=(1<<
  c)-1,this._numPrevBits=d,this._coders=[],f=1<<this._numPrevBits+this._numPosBits;f--;)this._coders[f]=new a.Decoder2};a.LiteralDecoder.prototype.init=function(){for(var a=1<<this._numPrevBits+this._numPosBits;a--;)this._coders[a].init()};a.LiteralDecoder.prototype.getDecoder=function(a,d){return this._coders[((a&this._posMask)<<this._numPrevBits)+((d&255)>>>8-this._numPrevBits)]};a.Decoder=function(){this._outWindow=new a.OutWindow;this._rangeDecoder=new a.RangeDecoder;this._isMatchDecoders=[];this._isRepDecoders=
  [];this._isRepG0Decoders=[];this._isRepG1Decoders=[];this._isRepG2Decoders=[];this._isRep0LongDecoders=[];this._posSlotDecoder=[];this._posDecoders=[];this._posAlignDecoder=new a.BitTreeDecoder(4);this._lenDecoder=new a.LenDecoder;this._repLenDecoder=new a.LenDecoder;this._literalDecoder=new a.LiteralDecoder;this._dictionarySizeCheck=this._dictionarySize=-1;this._posSlotDecoder[0]=new a.BitTreeDecoder(6);this._posSlotDecoder[1]=new a.BitTreeDecoder(6);this._posSlotDecoder[2]=new a.BitTreeDecoder(6);
  this._posSlotDecoder[3]=new a.BitTreeDecoder(6)};a.Decoder.prototype.setDictionarySize=function(a){if(0>a)return!1;this._dictionarySize!==a&&(this._dictionarySize=a,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096)));return!0};a.Decoder.prototype.setLcLpPb=function(a,d,f){var l=1<<f;if(8<a||4<d||4<f)return!1;this._literalDecoder.create(d,a);this._lenDecoder.create(l);this._repLenDecoder.create(l);this._posStateMask=l-1;return!0};
  a.Decoder.prototype.init=function(){var c=4;this._outWindow.init(!1);a.initBitModels(this._isMatchDecoders,192);a.initBitModels(this._isRep0LongDecoders,192);a.initBitModels(this._isRepDecoders,12);a.initBitModels(this._isRepG0Decoders,12);a.initBitModels(this._isRepG1Decoders,12);a.initBitModels(this._isRepG2Decoders,12);a.initBitModels(this._posDecoders,114);for(this._literalDecoder.init();c--;)this._posSlotDecoder[c].init();this._lenDecoder.init();this._repLenDecoder.init();this._posAlignDecoder.init();
  this._rangeDecoder.init()};a.Decoder.prototype.decode=function(c,d,f){var l=0,m=0,r=0,q=0,t=0,x=0,v=0;this._rangeDecoder.setStream(c);this._outWindow.setStream(d);for(this.init();0>f||x<f;)if(c=x&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(l<<4)+c))v=this._literalDecoder.getDecoder(x++,v),v=7<=l?v.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(m)):v.decodeNormal(this._rangeDecoder),this._outWindow.putByte(v),l=4>l?0:l-(10>l?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,
  l))v=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,l)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(l<<4)+c)&&(l=7>l?9:11,v=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,l)?d=r:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,l)?d=q:(d=t,t=q),q=r),r=m,m=d),0===v&&(v=2+this._repLenDecoder.decode(this._rangeDecoder,c),l=7>l?8:11);else if(t=q,q=r,r=m,v=2+this._lenDecoder.decode(this._rangeDecoder,c),l=7>l?7:10,c=this._posSlotDecoder[5>=v?v-2:3].decode(this._rangeDecoder),
  4<=c)if(d=(c>>1)-1,m=(2|c&1)<<d,14>c)m+=a.reverseDecode2(this._posDecoders,m-c-1,this._rangeDecoder,d);else{if(m+=this._rangeDecoder.decodeDirectBits(d-4)<<4,m+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),0>m){if(-1===m)break;return!1}}else m=c;if(m>=x||m>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(m,v);x+=v;v=this._outWindow.getByte(0)}this._outWindow.flush();this._outWindow.releaseStream();this._rangeDecoder.releaseStream();return!0};a.Decoder.prototype.setDecoderProperties=
  function(a){var d,f;if(5>a.size)return!1;d=a.readByte();f=d%9;d=~~(d/9);if(!this.setLcLpPb(f,d%5,~~(d/5)))return!1;d=a.readByte();d|=a.readByte()<<8;d|=a.readByte()<<16;d+=16777216*a.readByte();return this.setDictionarySize(d)};a.decompress=function(c,d,f,l){var m=new a.Decoder;if(!m.setDecoderProperties(c))throw"Incorrect stream properties";if(!m.decode(d,f,l))throw"Error in data stream";return!0};a.decompressFile=function(c,d){var f=new a.Decoder,l;if(!f.setDecoderProperties(c))throw"Incorrect stream properties";
  l=c.readByte();l|=c.readByte()<<8;l|=c.readByte()<<16;l+=16777216*c.readByte();c.readByte();c.readByte();c.readByte();c.readByte();if(!f.decode(c,d,l))throw"Error in data stream";return!0};return a}();SEA3D.File.LZMAUncompress=function(a){a=new Uint8Array(a);var c={data:[],position:0,writeByte:function(a){this.data[this.position++]=a}};SEA3D.LZMA.decompressFile({data:a,position:0,readByte:function(){return this.data[this.position++]}},c);return(new Uint8Array(c.data)).buffer};
  SEA3D.File.setDecompressionEngine(2,"lzma",SEA3D.File.LZMAUncompress);THREE.SEA3D=function(a){this.config={id:"",scripts:!0,runScripts:!0,autoPlay:!1,dummys:!0,multiplier:1,bounding:!0,audioRolloffFactor:10,lights:!0,useEnvironment:!0,useVertexTexture:!0,forceStatic:!1,streaming:!0,async:!0,paths:{},timeLimit:10};a&&this.loadConfig(a)};THREE.SEA3D.MTXBUF=new THREE.Matrix4;THREE.SEA3D.VECBUF=new THREE.Vector3;THREE.SEA3D.QUABUF=new THREE.Quaternion;THREE.SEA3D.BACKGROUND_COLOR=3355443;
  THREE.SEA3D.HELPER_COLOR=10140133;THREE.SEA3D.RTT_SIZE=512;THREE.SEA3D.identityMatrixScale=function(){var a=new THREE.Vector3;return function(c){a.setFromMatrixScale(c);return c.scale(a.set(1/a.x,1/a.y,1/a.z))}}();
  THREE.SEA3D.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D,setShadowMap:function(a){a.shadow.mapSize.width=2048;a.shadow.mapSize.height=1024;a.castShadow=!0;a.shadow.camera.left=-200;a.shadow.camera.right=200;a.shadow.camera.top=200;a.shadow.camera.bottom=-200;a.shadow.camera.near=1;a.shadow.camera.far=3E3;a.shadow.camera.fov=45;a.shadow.bias=-0.001}});
  Object.defineProperties(THREE.SEA3D.prototype,{container:{set:function(a){this.config.container=a},get:function(){return this.config.container}},elapsedTime:{get:function(){return this.file.timer.elapsedTime}}});THREE.SEA3D.Domain=function(a,c,d){this.id=a;this.objects=c;this.container=d;this.sources=[];this.local={};this.scriptTargets=[];this.events=new THREE.EventDispatcher};THREE.SEA3D.Domain.global={};
  THREE.SEA3D.Domain.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D.Domain,add:function(a){this.sources.push(a)},remove:function(a){this.sources.splice(this.sources.indexOf(a),1)},contains:function(a){return-1!=this.sources.indexOf(a)},addEventListener:function(a,c){this.events.addEventListener(a,c)},hasEventListener:function(a,c){return this.events.hasEventListener(a,c)},removeEventListener:function(a,c){this.events.removeEventListener(a,c)},print:function(){console.log.apply(console,
  arguments)},watch:function(){console.log.apply(console,"watch:",arguments)},runScripts:function(){for(var a=0;a<this.scriptTargets.length;a++)this.runJSMList(this.scriptTargets[a])},runJSMList:function(a){for(var c=a.scripts,d=0;d<c.length;d++)this.runJSM(a,c[d]);return c},runJSM:function(a,c){var d={print:this.print,watch:this.watch,sea3d:this,scene:this.container,source:new THREE.SEA3D.ScriptDomain(this,a instanceof THREE.SEA3D.Domain)};Object.freeze(d.source);THREE.SEA3D.ScriptHandler.add(d.source);
  try{this.methods[c.method](d,this.getReference,THREE.SEA3D.Domain.global,this.local,a,c.params)}catch(f){console.error('SEA3D JavaScript: Error running method "'+c.method+'".'),console.error(f)}},getReference:function(a){return eval(a)},disposeList:function(a){if(a&&a.length){a=a.concat();for(var c=a.length;c--;)a[c].dispose()}},dispatchEvent:function(a){a.domain=this;for(var c=this.sources.concat(),d=c.length;d--;)c[d].dispatchEvent(a);this.events.dispatchEvent(a)},dispose:function(){for(this.disposeList(this.sources);this.container.children.length;)this.container.remove(this.container.children[0]);
  for(var a=THREE.SEA3D.EXTENSIONS_DOMAIN.length;a--;){var c=THREE.SEA3D.EXTENSIONS_DOMAIN[a];c.dispose&&c.dispose.call(this)}this.disposeList(this.materials);this.disposeList(this.dummys);this.dispatchEvent({type:"dispose"})}});THREE.SEA3D.DomainManager=function(a){this.domains=[];this.autoDisposeRootDomain=void 0!==a?a:!0};
  Object.assign(THREE.SEA3D.DomainManager.prototype,{onDisposeDomain:function(a){this.remove(a.domain);this.autoDisposeRootDomain&&1===this.domains.length&&this.dispose()},add:function(a){this._onDisposeDomain=this._onDisposeDomain||this.onDisposeDomain.bind(this);a.on("dispose",this._onDisposeDomain);this.domains.push(a);this.textures=this.textures||a.textures;this.cubemaps=this.cubemaps||a.cubemaps;this.geometries=this.geometries||a.geometries},remove:function(a){a.removeEvent("dispose",this._onDisposeDomain);
  this.domains.splice(this.domains.indexOf(a),1)},contains:function(a){return-1!=this.domains.indexOf(a)},disposeList:function(a){if(a&&a.length){a=a.concat();for(var c=a.length;c--;)a[c].dispose()}},dispose:function(){this.disposeList(this.domains);this.disposeList(this.textures);this.disposeList(this.cubemaps);this.disposeList(this.geometries)}});
  THREE.SEA3D.ScriptDomain=function(a,c){a=a||new THREE.SEA3D.Domain;a.add(this);var d=new THREE.EventDispatcher;this.getId=function(){return a.id};this.isRoot=function(){return c};this.addEventListener=function(a,c){d.addEventListener(a,c)};this.hasEventListener=function(a,c){return d.hasEventListener(a,c)};this.removeEventListener=function(a,c){d.removeEventListener(a,c)};this.dispatchEvent=function(a){a.script=this;d.dispatchEvent(a)};this.dispose=function(){a.remove(this);c&&a.dispose();this.dispatchEvent({type:"dispose"})}};
  THREE.SEA3D.ScriptManager=function(){this.scripts=[];var a=function(a){this.remove(a.script)}.bind(this);this.add=function(c){c.addEventListener("dispose",a);this.scripts.push(c)};this.remove=function(c){c.removeEventListener("dispose",a);this.scripts.splice(this.scripts.indexOf(c),1)};this.contains=function(a){return-1<this.scripts.indexOf(a)};this.dispatchEvent=function(a){for(var d=this.scripts.concat(),f=d.length;f--;)d[f].dispatchEvent(a)}};THREE.SEA3D.ScriptHandler=new THREE.SEA3D.ScriptManager;
  THREE.SEA3D.ScriptHandler.dispatchUpdate=function(a){this.dispatchEvent({type:"update",delta:a})};THREE.SEA3D.AnimationClip=function(a,c,d,f){THREE.AnimationClip.call(this,a,c,d);this.repeat=void 0!==f?f:!0};THREE.SEA3D.AnimationClip.fromClip=function(a,c){return new THREE.SEA3D.AnimationClip(a.name,a.duration,a.tracks,c)};THREE.SEA3D.AnimationClip.prototype=Object.assign(Object.create(THREE.AnimationClip.prototype),{constructor:THREE.SEA3D.AnimationClip});
  THREE.SEA3D.Animation=function(a,c){this.clip=a;this.timeScale=void 0!==c?c:1};THREE.SEA3D.Animation.COMPLETE="animationComplete";THREE.SEA3D.Animation.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D.Animation,onComplete:function(a){this.dispatchEvent({type:THREE.SEA3D.Animation.COMPLETE,target:this})}});
  Object.defineProperties(THREE.SEA3D.Animation.prototype,{name:{get:function(){return this.clip.name}},repeat:{get:function(){return this.clip.repeat}},duration:{get:function(){return this.clip.duration}},mixer:{set:function(a){this.mx&&(this.mx.uncacheClip(this.clip),delete this.mx);a&&(this.mx=a,this.mx.clipAction(this.clip))},get:function(){return this.mx}}});THREE.SEA3D.Animator=function(a,c){this.updateAnimations(a,c);this.clone=function(a){return(new this.constructor(this.clips,new THREE.AnimationMixer(a))).copyFrom(this)}.bind(this)};
  Object.assign(THREE.SEA3D.Animator.prototype,{update:function(a){this.mixer.update(a||0);if(this.currentAnimationAction&&this.currentAnimationAction.paused&&(this.pause(),this.currentAnimation))this.currentAnimation.onComplete(this);return this},updateAnimations:function(a,c){this.playing&&this.stop();this.mixer&&THREE.SEA3D.AnimationHandler.remove(this);this.mixer=c;this.paused=this.playing=this.relative=!1;this.timeScale=1;this.animations=[];this.animation={};this.clips=[];if(a)for(var d=0;d<a.length;d++)this.addAnimation(a[d]);
  return this},addAnimation:function(a){a instanceof THREE.AnimationClip&&(this.clips.push(a),a=new THREE.SEA3D.Animation(a));this.animations.push(a);this.animation[a.name]=a;a.mixer=this.mixer;return a},removeAnimation:function(a){a instanceof THREE.AnimationClip&&(a=this.getAnimationByClip(a));this.clips.splice(this.clips.indexOf(a.clip),1);delete this.animation[a.name];this.animations.splice(this.animations.indexOf(a),1);a.mixer=null;return a},getAnimationByClip:function(a){for(var c=0;c<this.animations.length;c++)if(this.animations[c].clip===
  a)return a},getAnimationByName:function(a){return"number"===typeof a?this.animations[a]:this.animation[a]},setAnimationWeight:function(a,c){this.mixer.clipAction(this.getAnimationByName(a).clip).setEffectiveWeight(c)},getAnimationWeight:function(a){return this.mixer.clipAction(this.getAnimationByName(a).clip).getEffectiveWeight()},pause:function(){this.playing&&this.currentAnimation&&(THREE.SEA3D.AnimationHandler.remove(this),this.playing=!1);return this},resume:function(){!this.playing&&this.currentAnimation&&
  (THREE.SEA3D.AnimationHandler.add(this),this.playing=!0);return this},setTimeScale:function(a){this.timeScale=a;this.currentAnimationAction&&this.updateTimeScale();return this},getTimeScale:function(){return this.timeScale},updateTimeScale:function(){this.currentAnimationAction.setEffectiveTimeScale(this.timeScale*(this.currentAnimation?this.currentAnimation.timeScale:1));return this},play:function(a,c,d,f){var l=this.getAnimationByName(a);if(!l)throw Error('Animation "'+a+'" not found.');if(l===
  this.currentAnimation)return void 0===d&&l.repeat||(this.currentAnimationAction.time=void 0!==d?d:0<=this.currentAnimationAction.timeScale?0:this.currentAnimation.duration),this.currentAnimationAction.setEffectiveWeight(void 0!==f?f:1),this.currentAnimationAction.paused=!1,this.resume();this.previousAnimation=this.currentAnimation;this.currentAnimation=l;this.previousAnimationAction=this.currentAnimationAction;this.currentAnimationAction=this.mixer.clipAction(l.clip).setLoop(l.repeat?THREE.LoopRepeat:
  THREE.LoopOnce,Infinity).reset();this.currentAnimationAction.clampWhenFinished=!l.repeat;this.currentAnimationAction.paused=!1;this.updateTimeScale();void 0===d&&l.repeat||(this.currentAnimationAction.time=void 0!==d?d:0<=this.currentAnimationAction.timeScale?0:this.currentAnimation.duration);this.currentAnimationAction.setEffectiveWeight(void 0!==f?f:1);this.currentAnimationAction.play();this.playing||this.mixer.update(0);this.playing=!0;this.previousAnimation&&this.previousAnimationAction.crossFadeTo(this.currentAnimationAction,
  c||0,!1);THREE.SEA3D.AnimationHandler.add(this);return this},stop:function(){this.playing&&THREE.SEA3D.AnimationHandler.remove(this);this.currentAnimation&&(this.currentAnimationAction.stop(),this.previousAnimation=this.currentAnimation,this.previousAnimationAction=this.currentAnimationAction,delete this.currentAnimationAction,delete this.currentAnimation,this.playing=!1);return this},playw:function(a,c){this.playing||this.paused||THREE.SEA3D.AnimationHandler.add(this);var d=this.getAnimationByName(a);
  this.playing=!0;var f=this.mixer.clipAction(d.clip);f.setLoop(d.repeat?THREE.LoopRepeat:THREE.LoopOnce,Infinity).reset();f.clampWhenFinished=!d.repeat;f.paused=!1;f.setEffectiveWeight(c).play();return f},crossFade:function(a,c,d,f){this.mixer.stopAllAction();a=this.playw(a,1);c=this.playw(c,1);a.crossFadeTo(c,d,void 0!==f?f:!1);return this},stopAll:function(){this.stop().mixer.stopAllAction();this.playing=!1;return this},unPauseAll:function(){this.mixer.timeScale=1;this.playing=!0;this.paused=!1;
  return this},pauseAll:function(){this.mixer.timeScale=0;this.playing=!1;this.paused=!0;return this},setRelative:function(a){if(this.relative!==a)return this.stop(),this.relative=a,this},getRelative:function(){return this.relative},copyFrom:function(a){for(var c=0;c<this.animations.length;c++)this.animations[c].timeScale=a.animations[c].timeScale;return this}});
  THREE.SEA3D.Object3DAnimator=function(a,c){this.object3d=c;THREE.SEA3D.Animator.call(this,a,new THREE.AnimationMixer(c));this.clone=function(a){return(new this.constructor(this.clips,a)).copyFrom(this)}.bind(this)};
  THREE.SEA3D.Object3DAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Animator.prototype),{constructor:THREE.SEA3D.Object3DAnimator,stop:function(){if(this.currentAnimation){var a=this.object3d.animate;a&&this instanceof THREE.SEA3D.Object3DAnimator&&(a.position.set(0,0,0),a.quaternion.set(0,0,0,1),a.scale.set(1,1,1))}THREE.SEA3D.Animator.prototype.stop.call(this)},setRelative:function(a){THREE.SEA3D.Animator.prototype.setRelative.call(this,a);this.object3d.setAnimator(this.relative);this.updateAnimations(this.clips,
  new THREE.AnimationMixer(this.relative?this.object3d.animate:this.object3d))}});THREE.SEA3D.CameraAnimator=function(a,c){THREE.SEA3D.Object3DAnimator.call(this,a,c)};THREE.SEA3D.CameraAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Object3DAnimator.prototype),{constructor:THREE.SEA3D.CameraAnimator});THREE.SEA3D.SoundAnimator=function(a,c){THREE.SEA3D.Object3DAnimator.call(this,a,c)};
  THREE.SEA3D.SoundAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Object3DAnimator.prototype),{constructor:THREE.SEA3D.SoundAnimator});THREE.SEA3D.LightAnimator=function(a,c){THREE.SEA3D.Object3DAnimator.call(this,a,c)};THREE.SEA3D.LightAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Object3DAnimator.prototype),{constructor:THREE.SEA3D.LightAnimator});THREE.SEA3D.Object3D=function(){THREE.Object3D.call(this)};
  THREE.SEA3D.Object3D.prototype=Object.assign(Object.create(THREE.Object3D.prototype),{constructor:THREE.SEA3D.Object3D,updateAnimateMatrix:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.animate.updateMatrix(),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.animate.matrix),this.matrixWorldNeedsUpdate=!1,a=
  !0;for(var c=0,d=this.children.length;c<d;c++)this.children[c].updateMatrixWorld(a)},setAnimator:function(a){this.getAnimator()!=a&&(a?(this.animate=new THREE.Object3D,this.updateMatrixWorld=THREE.SEA3D.Object3D.prototype.updateAnimateMatrix):(delete this.animate,this.updateMatrixWorld=THREE.Object3D.prototype.updateMatrixWorld),this.matrixWorldNeedsUpdate=!0)},getAnimator:function(){return void 0!=this.animate},copy:function(a){THREE.Object3D.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=
  a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.Dummy=function(a,c,d){this.width=void 0!=a?a:100;this.height=void 0!=c?c:100;this.depth=void 0!=d?d:100;a=new THREE.BoxGeometry(this.width,this.height,this.depth,1,1,1);a.computeBoundingBox();a.computeBoundingSphere();THREE.Mesh.call(this,a,THREE.SEA3D.Dummy.MATERIAL)};THREE.SEA3D.Dummy.MATERIAL=new THREE.MeshBasicMaterial({wireframe:!0,color:THREE.SEA3D.HELPER_COLOR});
  THREE.SEA3D.Dummy.prototype=Object.assign(Object.create(THREE.Mesh.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.Dummy,copy:function(a){THREE.Mesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this},dispose:function(){this.geometry.dispose()}});THREE.SEA3D.Mesh=function(a,c){THREE.Mesh.call(this,a,c)};
  THREE.SEA3D.Mesh.prototype=Object.assign(Object.create(THREE.Mesh.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.Mesh,setWeight:function(a,c){this.morphTargetInfluences["number"===typeof a?a:this.morphTargetDictionary[a]]=c},getWeight:function(a){return this.morphTargetInfluences["number"===typeof a?a:this.morphTargetDictionary[a]]},copy:function(a){THREE.Mesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));
  return this}});THREE.SEA3D.SkinnedMesh=function(a,c,d){THREE.SkinnedMesh.call(this,a,c,d);this.updateAnimations(a.animations,new THREE.AnimationMixer(this))};
  THREE.SEA3D.SkinnedMesh.prototype=Object.assign(Object.create(THREE.SkinnedMesh.prototype),THREE.SEA3D.Mesh.prototype,THREE.SEA3D.Animator.prototype,{constructor:THREE.SEA3D.SkinnedMesh,boneByName:function(a){for(var c=this.skeleton.bones,d=0,f=c.length;d<f;d++)if(a===c[d].name)return c[d]},copy:function(a){THREE.SkinnedMesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});
  THREE.SEA3D.VertexAnimationMesh=function(a,c){THREE.Mesh.call(this,a,c);this.type="MorphAnimMesh";this.updateAnimations(a.animations,new THREE.AnimationMixer(this))};
  THREE.SEA3D.VertexAnimationMesh.prototype=Object.assign(Object.create(THREE.Mesh.prototype),THREE.SEA3D.Mesh.prototype,THREE.SEA3D.Animator.prototype,{constructor:THREE.SEA3D.VertexAnimationMesh,copy:function(a){THREE.Mesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.Camera=function(a,c,d,f){THREE.PerspectiveCamera.call(this,a,c,d,f)};
  THREE.SEA3D.Camera.prototype=Object.assign(Object.create(THREE.PerspectiveCamera.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.Camera,copy:function(a){THREE.PerspectiveCamera.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.OrthographicCamera=function(a,c,d,f,l,m){THREE.OrthographicCamera.call(this,a,c,d,f,l,m)};
  THREE.SEA3D.OrthographicCamera.prototype=Object.assign(Object.create(THREE.OrthographicCamera.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.OrthographicCamera,copy:function(a){THREE.OrthographicCamera.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.PointLight=function(a,c,d,f){THREE.PointLight.call(this,a,c,d,f)};
  THREE.SEA3D.PointLight.prototype=Object.assign(Object.create(THREE.PointLight.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.PointLight,copy:function(a){THREE.PointLight.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.PointSound=function(a,c){THREE.PositionalAudio.call(this,a);this.setSound(c)};
  THREE.SEA3D.PointSound.prototype=Object.assign(Object.create(THREE.PositionalAudio.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.PointSound,setSound:function(a){(this.sound=a)&&(a.buffer?this.setBuffer(a.buffer):a.addEventListener("complete",function(c){this.setBuffer(a.buffer)}.bind(this)));return this},copy:function(a){THREE.PositionalAudio.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});
  THREE.SEA3D.AnimationHandler={animators:[],update:function(a){for(var c=0;c<this.animators.length;)this.animators[c++].update(a)},add:function(a){-1===this.animators.indexOf(a)&&this.animators.push(a)},remove:function(a){a=this.animators.indexOf(a);-1!==a&&this.animators.splice(a,1)}};THREE.SEA3D.Sound=function(a){this.uuid=THREE.Math.generateUUID();this.src=a;(new THREE.AudioLoader).load(a,function(a){this.buffer=a;this.dispatchEvent({type:"complete"})}.bind(this))};
  THREE.SEA3D.Sound.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D.Sound});THREE.SEA3D.Domain.prototype.getMesh=THREE.SEA3D.prototype.getMesh=function(a){return this.objects["m3d/"+a]};THREE.SEA3D.Domain.prototype.getDummy=THREE.SEA3D.prototype.getDummy=function(a){return this.objects["dmy/"+a]};THREE.SEA3D.Domain.prototype.getLine=THREE.SEA3D.prototype.getLine=function(a){return this.objects["line/"+a]};
  THREE.SEA3D.Domain.prototype.getSound3D=THREE.SEA3D.prototype.getSound3D=function(a){return this.objects["sn3d/"+a]};THREE.SEA3D.Domain.prototype.getMaterial=THREE.SEA3D.prototype.getMaterial=function(a){return this.objects["mat/"+a]};THREE.SEA3D.Domain.prototype.getLight=THREE.SEA3D.prototype.getLight=function(a){return this.objects["lht/"+a]};THREE.SEA3D.Domain.prototype.getGLSL=THREE.SEA3D.prototype.getGLSL=function(a){return this.objects["glsl/"+a]};
  THREE.SEA3D.Domain.prototype.getCamera=THREE.SEA3D.prototype.getCamera=function(a){return this.objects["cam/"+a]};THREE.SEA3D.Domain.prototype.getTexture=THREE.SEA3D.prototype.getTexture=function(a){return this.objects["tex/"+a]};THREE.SEA3D.Domain.prototype.getCubeMap=THREE.SEA3D.prototype.getCubeMap=function(a){return this.objects["cmap/"+a]};THREE.SEA3D.Domain.prototype.getJointObject=THREE.SEA3D.prototype.getJointObject=function(a){return this.objects["jnt/"+a]};
  THREE.SEA3D.Domain.prototype.getContainer3D=THREE.SEA3D.prototype.getContainer3D=function(a){return this.objects["c3d/"+a]};THREE.SEA3D.Domain.prototype.getSprite=THREE.SEA3D.prototype.getSprite=function(a){return this.objects["m2d/"+a]};THREE.SEA3D.Domain.prototype.getProperties=THREE.SEA3D.prototype.getProperties=function(a){return this.objects["prop/"+a]};THREE.SEA3D.prototype.isPowerOfTwo=function(a){return a?(a&-a)===a:!1};
  THREE.SEA3D.prototype.nearestPowerOfTwo=function(a){return Math.pow(2,Math.round(Math.log(a)/Math.LN2))};THREE.SEA3D.prototype.updateTransform=function(a,c){var d=THREE.SEA3D.MTXBUF;c.transform?d.fromArray(c.transform):d.makeTranslation(c.position.x,c.position.y,c.position.z);a.position.setFromMatrixPosition(d);a.scale.setFromMatrixScale(d);a.rotation.setFromRotationMatrix(THREE.SEA3D.identityMatrixScale(d));if(this.config.forceStatic||c.isStatic)a.updateMatrix(),a.matrixAutoUpdate=!1};
  THREE.SEA3D.prototype.toVector3=function(a){return new THREE.Vector3(a.x,a.y,a.z)};THREE.SEA3D.prototype.toFaces=function(a){var c=[];c[0]=a[1];c[1]=a[0];c[2]=a[3];c[3]=a[2];c[4]=a[5];c[5]=a[4];return c};THREE.SEA3D.prototype.updateScene=function(){if(void 0!=this.materials)for(var a=0,c=this.materials.length;a<c;++a)this.materials[a].needsUpdate=!0};
  THREE.SEA3D.prototype.addSceneObject=function(a,c){c=c||a.tag;c.visible=a.visible;a.parent?a.parent.tag.add(c):this.config.container&&this.config.container.add(c);a.attributes&&(c.attribs=a.attributes.tag);a.scripts&&(c.scripts=this.getJSMList(c,a.scripts),this.config.scripts&&this.config.runScripts&&this.domain.runJSMList(c))};THREE.SEA3D.prototype.createObjectURL=function(a,c){return(window.URL||window.webkitURL).createObjectURL(new Blob([a],{type:c}))};
  THREE.SEA3D.prototype.parsePath=function(a){var c=this.config.paths,d;for(d in c)a=a.replace(RegExp("%"+d+"%","g"),c[d]);return a};
  THREE.SEA3D.prototype.addDefaultAnimation=function(a,c){for(var d=a.tag,f=0,l=a.animations?a.animations.length:0;f<l;f++){var m=a.animations[f];switch(m.tag.type){case SEA3D.Animation.prototype.type:return f=m.tag.tag||this.getModifier({sea:m.tag,scope:d,relative:m.relative}),d.animator=new c(f,d),d.animator.setRelative(m.relative),this.config.autoPlay&&d.animator.play(0),d.animator}}};
  THREE.SEA3D.prototype.readGeometryBuffer=function(a){for(var c=a.tag||new THREE.BufferGeometry,d=0;d<a.groups.length;d++){var f=a.groups[d];c.addGroup(f.start,f.count,d)}a.indexes&&c.setIndex(new THREE.BufferAttribute(a.indexes,1));c.addAttribute("position",new THREE.BufferAttribute(a.vertex,3));a.uv&&(c.addAttribute("uv",new THREE.BufferAttribute(a.uv[0],2)),1<a.uv.length&&c.addAttribute("uv2",new THREE.BufferAttribute(a.uv[1],2)));a.normal?c.addAttribute("normal",new THREE.BufferAttribute(a.normal,
  3)):c.computeVertexNormals();a.tangent4&&c.addAttribute("tangent",new THREE.BufferAttribute(a.tangent4,4));a.color&&c.addAttribute("color",new THREE.BufferAttribute(a.color[0],a.numColor));a.joint&&(c.addAttribute("skinIndex",new THREE.Float32BufferAttribute(a.joint,a.jointPerVertex)),c.addAttribute("skinWeight",new THREE.Float32BufferAttribute(a.weight,a.jointPerVertex)));this.config.bounding&&(c.computeBoundingBox(),c.computeBoundingSphere());c.name=a.name;this.domain.geometries=this.geometries=
  this.geometries||[];this.geometries.push(this.objects["geo/"+a.name]=a.tag=c)};THREE.SEA3D.prototype.readDummy=function(a){var c=new THREE.SEA3D.Dummy(a.width,a.height,a.depth);c.name=a.name;this.domain.dummys=this.dummys=this.dummys||[];this.dummys.push(this.objects["dmy/"+a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
  THREE.SEA3D.prototype.readLine=function(a){var c=new THREE.BufferGeometry;a.closed&&a.vertex.push(a.vertex[0],a.vertex[1],a.vertex[2]);c.addAttribute("position",new THREE.Float32BufferAttribute(a.vertex,3));c=new THREE.Line(c,new THREE.LineBasicMaterial({color:THREE.SEA3D.HELPER_COLOR,linewidth:3}));c.name=a.name;this.lines=this.lines||[];this.lines.push(this.objects["line/"+a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
  THREE.SEA3D.prototype.readContainer3D=function(a){var c=new THREE.SEA3D.Object3D;this.domain.containers=this.containers=this.containers||[];this.containers.push(this.objects["c3d/"+a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
  THREE.SEA3D.prototype.readSprite=function(a){var c;if(a.material)if(a.material.tag.sprite)c=a.material.tag.sprite;else{c=a.material.tag.sprite=new THREE.SpriteMaterial;this.setBlending(c,a.blendMode);var d=a.material.tag.map;d&&(d.flipY=!0,c.map=d);c.color.set(a.material.tag.color);c.opacity=a.material.tag.opacity;c.fog=a.material.receiveFog}c=new THREE.Sprite(c);c.name=a.name;this.domain.sprites=this.sprites=this.sprites||[];this.sprites.push(this.objects["m2d/"+a.name]=a.tag=c);this.addSceneObject(a);
  this.updateTransform(c,a);c.scale.set(a.width,a.height,1)};
  THREE.SEA3D.prototype.readMesh=function(a){var c,d,f=a.geometry.tag,l,m,r,q,t,x,v;c=0;for(d=a.modifiers?a.modifiers.length:0;c<d;c++){var A=a.modifiers[c];switch(A.type){case SEA3D.Skeleton.prototype.type:case SEA3D.SkeletonLocal.prototype.type:m=A;f.bones=m.tag;break;case SEA3D.Morph.prototype.type:r=A.tag||this.getModifier({sea:A,geometry:a.geometry}),f.morphAttributes=r.attribs,f.morphTargets=r.targets}}c=0;for(d=a.animations?a.animations.length:0;c<d;c++)switch(A=a.animations[c].tag,A.type){case SEA3D.SkeletonAnimation.prototype.type:q=
  A;f.animations=q.tag||this.getModifier({sea:q,skeleton:m,relative:!0});break;case SEA3D.VertexAnimation.prototype.type:t=A;f.morphAttributes=t.tag.attribs;f.morphTargets=t.tag.targets;f.animations=t.tag.animations;break;case SEA3D.UVWAnimation.prototype.type:x=A.tag||this.getModifier({sea:A});break;case SEA3D.MorphAnimation.prototype.type:v=A.tag||this.getModifier({sea:A})}d=void 0!=r||void 0!=t;r=r&&void 0!=r.attribs.normal||t&&void 0!=t.tag.attribs.normal;if(a.material)if(1<a.material.length)for(A=
  [],c=0;c<a.material.length;c++)A[c]=a.material[c].tag,A[c].skinning=void 0!=m,A[c].morphTargets=d,A[c].morphNormals=r,A[c].vertexColors=a.geometry.color?THREE.VertexColors:THREE.NoColors;else l=a.material[0].tag,l.skinning=void 0!=m,l.morphTargets=d,l.morphNormals=r,l.vertexColors=a.geometry.color?THREE.VertexColors:THREE.NoColors;m?(c=new THREE.SEA3D.SkinnedMesh(f,l,this.config.useVertexTexture),this.config.autoPlay&&q&&c.play(0)):t?(c=new THREE.SEA3D.VertexAnimationMesh(f,l),this.config.autoPlay&&
  c.play(0)):c=new THREE.SEA3D.Mesh(f,l);x&&(c.uvwAnimator=new THREE.SEA3D.Animator(x,new THREE.AnimationMixer(l.map)),this.config.autoPlay&&c.uvwAnimator.play(0));v&&(c.morphAnimator=new THREE.SEA3D.Animator(v,new THREE.AnimationMixer(c)),this.config.autoPlay&&c.morphAnimator.play(0));c.name=a.name;c.castShadow=a.castShadows;c.receiveShadow=a.material?a.material[0].receiveShadows:!0;this.domain.meshes=this.meshes=this.meshes||[];this.meshes.push(this.objects["m3d/"+a.name]=a.tag=c);this.addSceneObject(a);
  this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
  THREE.SEA3D.prototype.readSoundPoint=function(a){this.audioListener||(this.audioListener=new THREE.AudioListener,this.config.container&&this.config.container.add(this.audioListener));var c=new THREE.SEA3D.PointSound(this.audioListener);c.autoplay=a.autoPlay;c.setLoop(a.autoPlay);c.setVolume(a.volume);c.setRefDistance(a.distance);c.setRolloffFactor(this.config.audioRolloffFactor);c.setSound(a.sound.tag);c.name=a.name;this.domain.sounds3d=this.sounds3d=this.sounds3d||[];this.sounds3d.push(this.objects["sn3d/"+
  a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.SoundAnimator)};THREE.SEA3D.prototype.readCubeRender=function(a){var c=new THREE.CubeCamera(0.1,5E3,THREE.SEA3D.RTT_SIZE);c.renderTarget.cubeCamera=c;a.tag=c.renderTarget;this.domain.cubeRenderers=this.cubeRenderers=this.cubeRenderers||[];this.cubeRenderers.push(this.objects["rttc/"+a.name]=c);this.addSceneObject(a,c);this.updateTransform(c,a)};
  THREE.SEA3D.prototype.readTexture=function(a){var c=new Image,d=new THREE.Texture;d.name=a.name;d.wrapS=d.wrapT=THREE.RepeatWrapping;d.flipY=!1;d.image=c;void 0!==this.config.anisotropy&&(d.anisotropy=this.config.anisotropy);c.onload=function(){d.needsUpdate=!0};c.src=this.createObjectURL(a.data.buffer,"image/"+a.type);this.domain.textures=this.textures=this.textures||[];this.textures.push(this.objects["tex/"+a.name]=a.tag=d)};
  THREE.SEA3D.prototype.readCubeMap=function(a){var c=this.toFaces(a.faces),d=new THREE.CubeTexture([]),f=0;d.name=a.name;d.flipY=!1;d.format=THREE.RGBFormat;for(var l=function(){6===++f&&(d.needsUpdate=!0,this.config.async||(this.file.resume=!0))}.bind(this),m=0;m<c.length;++m){var r=new Image;r.onload=l;r.src=this.createObjectURL(c[m].buffer,"image/"+a.extension);d.images[m]=r}this.config.async||(this.file.resume=!1);this.domain.cubemaps=this.cubemaps=this.cubemaps||[];this.cubemaps.push(this.objects["cmap/"+
  a.name]=a.tag=d)};THREE.SEA3D.prototype.readGeometryUpdate=function(a,c,d){c=new d.sea3d.typeClass[d.type]("",c,d.sea3d);c.tag=a;this.readGeometryBuffer(c)};THREE.SEA3D.prototype.readTextureUpdate=function(a,c,d){var f=new Image;f.onload=function(){a.image=f;a.needsUpdate=!0};f.src=this.createObjectURL(c.buffer,"image/"+d)};
  THREE.SEA3D.prototype.readAssetUpdate=function(a){var c=this.file.objects[a.index];a=a.bytes;var d=c.tag;d&&(d.isBufferGeometry?this.readGeometryUpdate(d,a,c):d.isTexture&&this.readTextureUpdate(d,a,c.type))};THREE.SEA3D.prototype.readSound=function(a){var c=new THREE.SEA3D.Sound(this.createObjectURL(a.data.buffer,"audio/"+a.type));c.name=a.name;this.domain.sounds=this.sounds=this.sounds||[];this.sounds.push(this.objects["snd/"+a.name]=a.tag=c)};
  THREE.SEA3D.prototype.readScriptURL=function(a){this.file.resume=!1;(new THREE.FileLoader).setResponseType("text").load(a.url,function(c){this.file.resume=!0;this.domain.scripts=this.scripts=this.scripts||[];this.scripts.push(this.objects["src/"+a.name]=a.tag=c)}.bind(this))};
  THREE.SEA3D.prototype.readTextureURL=function(a){var c=(new THREE.TextureLoader).load(this.parsePath(a.url));c.name=a.name;c.wrapS=c.wrapT=THREE.RepeatWrapping;c.flipY=!1;void 0!==this.config.anisotropy&&(c.anisotropy=this.config.anisotropy);this.domain.textures=this.textures=this.textures||[];this.textures.push(this.objects["tex/"+a.name]=a.tag=c)};
  THREE.SEA3D.prototype.readCubeMapURL=function(a){for(var c=this.toFaces(a.faces),d=0;d<c.length;d++)c[d]=this.parsePath(c[d]);if("hdr"===c[0].substr(-3)){var f=null!=THREE.PMREMGenerator;this.file.resume=!f;c=(new THREE.HDRCubeTextureLoader).load(THREE.UnsignedByteType,c,function(c){if(f){var d=new THREE.PMREMGenerator(c);d.update(this.config.renderer);d=new THREE.PMREMCubeUVPacker(d.cubeLods);d.update(this.config.renderer);c.dispose();this.objects["cmap/"+a.name]=a.tag=d.CubeUVRenderTarget.texture;
  this.file.resume=!0}}.bind(this))}else c=(new THREE.CubeTextureLoader).load(c);c.name=a.name;c.wrapS=c.wrapT=THREE.RepeatWrapping;c.flipY=!1;void 0!==this.config.anisotropy&&(c.anisotropy=this.config.anisotropy);this.domain.cubemaps=this.cubemaps=this.cubemaps||[];this.cubemaps.push(this.objects["cmap/"+a.name]=a.tag=c)};
  THREE.SEA3D.prototype.getJSMList=function(a,c){for(var d=[],f=0;f<c.length;f++){var l=c[f];l.tag.type===SEA3D.JavaScriptMethod.prototype.type&&d.push(l)}this.domain.scriptTargets=this.scriptTargets=this.scriptTargets||[];this.scriptTargets.push(a);return d};
  THREE.SEA3D.prototype.readJavaScriptMethod=function(a){try{var c="(function() {\nvar $METHOD = {}\n",d='function($INC, $REF, global, local, self, $PARAM) {\nvar watch = $INC["watch"],\nscene = $INC["scene"],\nsea3d = $INC["sea3d"],\nprint = $INC["print"];\n',d=d+'var $SRC = $INC["source"],\naddEventListener = $SRC.addEventListener.bind( $SRC ),\nhasEventListener = $SRC.hasEventListener.bind( $SRC ),\nremoveEventListener = $SRC.removeEventListener.bind( $SRC ),\ndispatchEvent = $SRC.dispatchEvent.bind( $SRC ),\ndispose = $SRC.dispose.bind( $SRC );\n',
  f;for(f in a.methods)c+='$METHOD["'+f+'"] = '+d+a.methods[f].src+"}\n";this.domain.methods=eval(c+"return $METHOD; })")()}catch(l){console.error('SEA3D JavaScriptMethod: Error running "'+a.name+'".'),console.error(l)}};THREE.SEA3D.prototype.readGLSL=function(a){this.domain.glsl=this.glsl=this.glsl||[];this.glsl.push(this.objects["glsl/"+a.name]=a.tag=a.src)};
  THREE.SEA3D.prototype.materialTechnique=function(){var a={onComplete:function(a,d){if(1>d.alpha||a.blending>THREE.NormalBlending)a.opacity=d.alpha,a.transparent=!0}};a[SEA3D.Material.PHYSICAL]=function(a,d){a.color.setHex(d.color);a.roughness=d.roughness;a.metalness=d.metalness};a[SEA3D.Material.REFLECTIVITY]=function(a,d){a.reflectivity=d.strength};a[SEA3D.Material.CLEAR_COAT]=function(a,d){a.clearCoat=d.strength;a.clearCoatRoughness=d.roughness};a[SEA3D.Material.PHONG]=function(a,d){a.color.setHex(d.diffuseColor);
  a.specular.setHex(d.specularColor).multiplyScalar(d.specular);a.shininess=d.gloss};a[SEA3D.Material.DIFFUSE_MAP]=function(a,d,f){a.map=d.texture.tag;a.color.setHex(16777215);a.map.wrapS=a.map.wrapT=f.repeat?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;d.texture.transparent&&(a.transparent=!0)};a[SEA3D.Material.ROUGHNESS_MAP]=function(a,d){a.roughnessMap=d.texture.tag};a[SEA3D.Material.METALNESS_MAP]=function(a,d){a.metalnessMap=d.texture.tag};a[SEA3D.Material.SPECULAR_MAP]=function(a,d){a.specular&&
  (a.specularMap=d.texture.tag,a.specular.setHex(16777215))};a[SEA3D.Material.NORMAL_MAP]=function(a,d){a.normalMap=d.texture.tag};a[SEA3D.Material.REFLECTION]=a[SEA3D.Material.FRESNEL_REFLECTION]=function(a,d){a.envMap=d.texture.tag;a.envMap.mapping=THREE.CubeReflectionMapping;a.combine=THREE.MixOperation;a.reflectivity=d.alpha};a[SEA3D.Material.REFLECTION_SPHERICAL]=function(a,d){a.envMap=d.texture.tag;a.envMap.mapping=THREE.SphericalReflectionMapping;a.combine=THREE.MixOperation;a.reflectivity=d.alpha};
  a[SEA3D.Material.REFRACTION_MAP]=function(a,d){a.envMap=d.texture.tag;a.envMap.mapping=THREE.CubeRefractionMapping;a.refractionRatio=d.ior;a.reflectivity=d.alpha};a[SEA3D.Material.LIGHT_MAP]=function(a,d){"multiply"===d.blendMode?a.aoMap=d.texture.tag:a.lightMap=d.texture.tag};a[SEA3D.Material.EMISSIVE]=function(a,d){a.emissive.setHex(d.color)};a[SEA3D.Material.EMISSIVE_MAP]=function(a,d){a.emissiveMap=d.texture.tag};a[SEA3D.Material.ALPHA_MAP]=function(a,d,f){a.alphaMap=d.texture.tag;a.transparent=
  !0;a.alphaMap.wrapS=a.alphaMap.wrapT=f.repeat?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping};return a}();THREE.SEA3D.prototype.createMaterial=function(a){return a.tecniquesDict[SEA3D.Material.REFLECTIVITY]||a.tecniquesDict[SEA3D.Material.CLEAR_COAT]?new THREE.MeshPhysicalMaterial:a.tecniquesDict[SEA3D.Material.PHYSICAL]?new THREE.MeshStandardMaterial:new THREE.MeshPhongMaterial};
  THREE.SEA3D.prototype.setBlending=function(a,c){if("normal"!==c){switch(c){case "add":a.blending=THREE.AdditiveBlending;break;case "subtract":a.blending=THREE.SubtractiveBlending;break;case "multiply":a.blending=THREE.MultiplyBlending;break;case "screen":a.blending=THREE.CustomBlending,a.blendSrc=THREE.OneFactor,a.blendDst=THREE.OneMinusSrcColorFactor,a.blendEquation=THREE.AddEquation}a.transparent=!0}};
  THREE.SEA3D.prototype.readMaterial=function(a){var c=this.createMaterial(a);c.name=a.name;c.lights=a.receiveLights;c.fog=a.receiveFog;c.depthWrite=a.depthWrite;c.depthTest=a.depthTest;c.premultipliedAlpha=a.premultipliedAlpha;c.side=a.doubleSided?THREE.DoubleSide:THREE.FrontSide;this.setBlending(c,a.blendMode);for(var d=0;d<a.technique.length;d++){var f=a.technique[d];this.materialTechnique[f.kind]&&this.materialTechnique[f.kind].call(this,c,f,a)}this.materialTechnique.onComplete&&this.materialTechnique.onComplete.call(this,
  c,a);this.domain.materials=this.materials=this.materials||[];this.materials.push(this.objects["mat/"+a.name]=a.tag=c)};
  THREE.SEA3D.prototype.readPointLight=function(a){var c=new THREE.SEA3D.PointLight(a.color,a.multiplier*this.config.multiplier);c.name=a.name;a.attenuation&&(c.distance=a.attenuation.end);a.shadow&&this.setShadowMap(c);this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
  THREE.SEA3D.prototype.readHemisphereLight=function(a){var c=new THREE.HemisphereLight(a.color,a.secondColor,a.multiplier*this.config.multiplier);c.position.set(0,500,0);c.name=a.name;this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=c);this.addSceneObject(a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
  THREE.SEA3D.prototype.readAmbientLight=function(a){var c=new THREE.AmbientLight(a.color,a.multiplier*this.config.multiplier);c.name=a.name;this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=c);this.addSceneObject(a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
  THREE.SEA3D.prototype.readDirectionalLight=function(a){var c=new THREE.DirectionalLight(a.color,a.multiplier*this.config.multiplier);c.name=a.name;a.shadow&&this.setShadowMap(c);this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
  THREE.SEA3D.prototype.readCamera=function(a){var c=new THREE.SEA3D.Camera(a.fov);c.name=a.name;this.domain.cameras=this.cameras=this.cameras||[];this.cameras.push(this.objects["cam/"+a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,a);this.addDefaultAnimation(a,THREE.SEA3D.CameraAnimator)};
  THREE.SEA3D.prototype.readOrthographicCamera=function(a){var c,d;d=void 0!==this.config.stageWidth?this.config.stageWidth:window?window.innerWidth:1024;var f=void 0!==this.config.stageHeight?this.config.stageHeight:window?window.innerHeight:1024;d>f?(c=d/f*a.height,d=a.height):(c=a.height,d=f/d*a.height);c=new THREE.SEA3D.OrthographicCamera(-c,c,d,-d);c.name=a.name;this.domain.cameras=this.cameras=this.cameras||[];this.cameras.push(this.objects["cam/"+a.name]=a.tag=c);this.addSceneObject(a);this.updateTransform(c,
  a);this.addDefaultAnimation(a,THREE.SEA3D.CameraAnimator)};THREE.SEA3D.prototype.getSkeletonFromBones=function(a){var c=[],d,f,l,m;l=0;for(m=a.length;l<m;l++)f=a[l],d=new THREE.Bone,c.push(d),d.name=f.name,d.position.fromArray(f.pos),d.quaternion.fromArray(f.rotq),void 0!==f.scl&&d.scale.fromArray(f.scl);l=0;for(m=a.length;l<m;l++)f=a[l],-1!==f.parent&&null!==f.parent&&void 0!==c[f.parent]&&c[f.parent].add(c[l]);return new THREE.Skeleton(c)};
  THREE.SEA3D.prototype.readSkeletonLocal=function(a){for(var c=[],d=0;d<a.joint.length;d++){var f=a.joint[d];c[d]={name:f.name,pos:[f.x,f.y,f.z],rotq:[f.qx,f.qy,f.qz,f.qw],parent:f.parentIndex}}this.domain.bones=this.bones=this.bones||[];this.bones.push(this.objects[a.name+".sklq"]=a.tag=c)};THREE.SEA3D.prototype.readJointObject=function(a){var c=a.target.tag.skeleton.bones[a.joint];this.domain.joints=this.joints=this.joints||[];this.joints.push(this.objects["jnt/"+a.name]=a.tag=c)};
  THREE.SEA3D.prototype.readMorph=function(a){for(var c={position:[]},d=[],f=0;f<a.node.length;f++){var l=a.node[f];c.position[f]=new THREE.Float32BufferAttribute(l.vertex,3);c.position[f].name=l.name;l.normal&&(c.normal=c.normal||[],c.normal[f]=new THREE.Float32BufferAttribute(l.normal,3));d[f]={name:l.name}}a.tag={attribs:c,targets:d}};
  THREE.SEA3D.prototype.readAnimation=function(a){for(var c=[],d=1E3/a.frameRate/1E3,f=0;f<a.sequence.length;f++){for(var l=a.sequence[f],m=[],r=0;r<a.dataList.length;r++){var q=a.dataList[r],t,x,v,A=q.data;v=l.start*q.blockSize;t=v+l.count*q.blockSize;var I=l.intrpl?THREE.InterpolateLinear:!1,C=null;switch(q.kind){case SEA3D.Animation.POSITION:C=".position";break;case SEA3D.Animation.ROTATION:C=".quaternion";break;case SEA3D.Animation.SCALE:C=".scale";break;case SEA3D.Animation.COLOR:C=".color";break;
  case SEA3D.Animation.MULTIPLIER:C=".intensity";break;case SEA3D.Animation.FOV:C=".fov";break;case SEA3D.Animation.OFFSET_U:C=".offset[x]";break;case SEA3D.Animation.OFFSET_V:C=".offset[y]";break;case SEA3D.Animation.SCALE_U:C=".repeat[x]";break;case SEA3D.Animation.SCALE_V:C=".repeat[y]";break;case SEA3D.Animation.RADIAN:C=".rotation";break;case SEA3D.Animation.MORPH:C=".morphTargetInfluences["+q.name+"]"}if(C)switch(q.type){case SEA3D.Stream.BYTE:case SEA3D.Stream.UBYTE:case SEA3D.Stream.INT:case SEA3D.Stream.UINT:case SEA3D.Stream.FLOAT:case SEA3D.Stream.DOUBLE:case SEA3D.Stream.DECIMAL:v=
  A.subarray(v,t);x=new Float32Array(v.length);for(t=q=0;t<x.length;t++)x[t]=q,q+=d;m.push(new THREE.NumberKeyframeTrack(C,x,v,I));break;case SEA3D.Stream.VECTOR3D:v=A.subarray(v,t);x=new Float32Array(v.length/q.blockSize);for(t=q=0;t<x.length;t++)x[t]=q,q+=d;m.push(new THREE.VectorKeyframeTrack(C,x,v,I));break;case SEA3D.Stream.VECTOR4D:v=A.subarray(v,t);x=new Float32Array(v.length/q.blockSize);for(t=q=0;t<x.length;t++)x[t]=q,q+=d;m.push(new THREE.QuaternionKeyframeTrack(C,x,v,I));break;case SEA3D.Stream.INT24:case SEA3D.Stream.UINT24:v=
  new Float32Array(3*(t-v));x=new Float32Array(v.length/3);for(t=q=0;t<x.length;t++)v[3*t]=(A[t]>>16&255)/255,v[3*t+1]=(A[t]>>8&255)/255,v[3*t+2]=(A[t]&255)/255,x[t]=q,q+=d;m.push(new THREE.VectorKeyframeTrack(C,x,v,I))}}c.push(new THREE.SEA3D.AnimationClip(l.name,-1,m,l.repeat))}this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[a.name+".anm"]=a.tag=c)};
  THREE.SEA3D.prototype.readSkeletonAnimation=function(a,c){c=!c&&a.metadata&&a.metadata.skeleton?a.metadata.skeleton:c;if(!c||a.tag)return a.tag;for(var d=[],f=1E3/a.frameRate/1E3,l=0;l<a.sequence.length;l++){for(var m=a.sequence[l],r=m.start,q=r+m.count,t={name:m.name,fps:a.frameRate,length:f*m.count,hierarchy:[]},x=a.numJoints,v=a.raw,A=0;A<x;A++){for(var I={parent:c.joint[A].parentIndex,keys:[]},C=I.keys,u=0,K=r;K<q;K++){var w=K*x*7+7*A;C.push({time:u,pos:[v[w],v[w+1],v[w+2]],rot:[v[w+3],v[w+4],
  v[w+5],v[w+6]],scl:[1,1,1]});u+=f}t.hierarchy[A]=I}d.push(THREE.SEA3D.AnimationClip.fromClip(THREE.AnimationClip.parseAnimation(t,c.tag),m.repeat))}this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[a.name+".skla"]=a.tag=d)};
  THREE.SEA3D.prototype.readVertexAnimation=function(a){var c={position:[]},d=[],f=[],l,m;l=0;for(m=a.frame.length;l<m;l++){var r=a.frame[l];c.position[l]=new THREE.Float32BufferAttribute(r.vertex,3);r.normal&&(c.normal=c.normal||[],c.normal[l]=new THREE.Float32BufferAttribute(r.normal,3));d[l]={name:l}}for(l=0;l<a.sequence.length;l++){var r=a.sequence[l],q=[];for(m=0;m<r.count;m++)q[m]=d[r.start+m];f.push(THREE.SEA3D.AnimationClip.fromClip(THREE.AnimationClip.CreateFromMorphTargetSequence(r.name,q,
  a.frameRate),r.repeat))}a.tag={attribs:c,targets:d,animations:f};this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[a.name+".vtxa"]=a.tag)};
  THREE.SEA3D.prototype.getModifier=function(a){var c=a.sea;switch(c.type){case SEA3D.SkeletonAnimation.prototype.type:this.readSkeletonAnimation(c,a.skeleton);break;case SEA3D.Animation.prototype.type:case SEA3D.MorphAnimation.prototype.type:case SEA3D.UVWAnimation.prototype.type:this.readAnimation(c);break;case SEA3D.Morph.prototype.type:this.readMorph(c,a.geometry)}return c.tag};
  THREE.SEA3D.prototype.applyEnvironment=function(a){for(var c=0,d=this.materials.length;c<d;++c){var f=this.materials[c];f instanceof THREE.MeshStandardMaterial&&!f.envMap&&(f.envMap=a,f.envMap.mapping=THREE.CubeReflectionMapping,f.needsUpdate=!0)}};
  THREE.SEA3D.prototype.readActions=function(a){for(var c=0;c<a.actions.length;c++){var d=a.actions[c];switch(d.kind){case SEA3D.Actions.ATTRIBUTES:this.attribs=this.domain.attribs=d.attributes.tag;break;case SEA3D.Actions.SCRIPTS:this.domain.scripts=this.getJSMList(this.domain,d.scripts);this.config.scripts&&this.config.runScripts&&this.domain.runJSMList(this.domain);break;case SEA3D.Actions.CAMERA:this.domain.camera=this.camera=d.camera.tag;break;case SEA3D.Actions.ENVIRONMENT_COLOR:this.domain.background=
  this.background=this.background||{};this.background.color=new THREE.Color(d.color);break;case SEA3D.Actions.ENVIRONMENT:this.domain.background=this.background=this.background||{},this.background.texture=d.texture.tag,this.config.useEnvironment&&void 0!=this.materials&&this.applyEnvironment(d.texture.tag)}}};
  THREE.SEA3D.prototype.updatePropertiesAssets=function(a,c){for(var d in c)switch(c.__type[d]){case SEA3D.Stream.ASSET:c.__asset||(c.__asset={});c.__asset[d]||(c.__asset[d]=c[d]);c[d]=c.__asset[d].tag;break;case SEA3D.Stream.GROUP:c[d]=this.updatePropertiesAssets(a,c[d])}return c};THREE.SEA3D.prototype.readProperties=function(a){var c=this.updatePropertiesAssets(a,a.props);this.domain.properties=this.properties=this.properties||[];this.properties.push(this.objects["prop/"+a.name]=a.tag=c)};
  THREE.SEA3D.prototype.readFileInfo=function(a){this.domain.info=this.updatePropertiesAssets(a,a.info)};THREE.SEA3D.Event={PROGRESS:"sea3d_progress",LOAD_PROGRESS:"sea3d_load",DOWNLOAD_PROGRESS:"sea3d_download",COMPLETE:"sea3d_complete",OBJECT_COMPLETE:"sea3d_object",PARSE_PROGRESS:"parse_progress",PARSE_COMPLETE:"parse_complete",ERROR:"sea3d_error"};THREE.SEA3D.prototype.onProgress=function(a){a.status=a.type;a.progress=a.loaded/a.total;a.type=THREE.SEA3D.Event.PROGRESS;this.dispatchEvent(a)};
  THREE.SEA3D.prototype.onLoadProgress=function(a){a.type=THREE.SEA3D.Event.LOAD_PROGRESS;this.dispatchEvent(a);this.onProgress(a)};THREE.SEA3D.prototype.onDownloadProgress=function(a){a.type=THREE.SEA3D.Event.DOWNLOAD_PROGRESS;this.dispatchEvent(a);this.onProgress(a)};THREE.SEA3D.prototype.onComplete=function(a){a.type=THREE.SEA3D.Event.COMPLETE;this.dispatchEvent(a)};THREE.SEA3D.prototype.onCompleteObject=function(a){a.type=THREE.SEA3D.Event.OBJECT_COMPLETE;this.dispatchEvent(a)};
  THREE.SEA3D.prototype.onParseProgress=function(a){a.type=THREE.SEA3D.Event.PARSE_PROGRESS;this.dispatchEvent(a)};THREE.SEA3D.prototype.onParseComplete=function(a){a.type=THREE.SEA3D.Event.PARSE_COMPLETE;this.dispatchEvent(a)};THREE.SEA3D.prototype.onError=function(a){a.type=THREE.SEA3D.Event.ERROR;this.dispatchEvent(a)};THREE.SEA3D.prototype.createDomain=function(){return this.domain=new THREE.SEA3D.Domain(this.config.id,this.objects={},this.config.container)};
  THREE.SEA3D.prototype.clone=function(a,c,d){if(!this.file.isDone())throw Error("Previous parse is not completed.");this.config.container=a&&void 0!==a.container?a.container:new THREE.Object3D;a&&this.loadConfig(a);var f=this.config.timeLimit;this.config.timeLimit=a&&void 0!==a.timeLimit?a.timeLimit:Infinity;this.parse(c,d);this.config.timeLimit=f;return this.domain};THREE.SEA3D.prototype.loadConfig=function(a){for(var c in a)this.config[c]=a[c]};
  THREE.SEA3D.prototype.parse=function(a,c){delete this.cameras;delete this.containers;delete this.lights;delete this.joints;delete this.meshes;delete this.materials;delete this.sprites;delete this.sounds3d;delete this.cubeRenderers;delete this.sounds;delete this.glsl;delete this.dummy;delete this.camera;delete this.background;delete this.properties;delete this.scriptTargets;delete this.domain;this.createDomain();this.setTypeRead();this.file.onParseComplete=function(c){this.config.manager&&this.config.manager.add(this.domain);
  (a||this.onParseComplete).call(this,c)}.bind(this);this.file.onParseProgress=c||this.onParseProgress;for(var d=THREE.SEA3D.EXTENSIONS_LOADER.length;d--;){var f=THREE.SEA3D.EXTENSIONS_LOADER[d];f.parse&&f.parse.call(this)}this.file.parse();return this.domain};THREE.SEA3D.prototype.onHead=function(a){if("TJS"!=a.sign)throw Error("Sign '"+a.sign+"' not supported! Use SEA3D Studio to publish or SEA3DLegacy.js");};THREE.SEA3D.EXTENSIONS_LOADER=[];THREE.SEA3D.EXTENSIONS_DOMAIN=[];
  THREE.SEA3D.prototype.setTypeRead=function(){this.file.typeRead={};this.file.typeRead[SEA3D.Geometry.prototype.type]=this.readGeometryBuffer;this.file.typeRead[SEA3D.Mesh.prototype.type]=this.readMesh;this.file.typeRead[SEA3D.Sprite.prototype.type]=this.readSprite;this.file.typeRead[SEA3D.Container3D.prototype.type]=this.readContainer3D;this.file.typeRead[SEA3D.Line.prototype.type]=this.readLine;this.file.typeRead[SEA3D.Material.prototype.type]=this.readMaterial;this.file.typeRead[SEA3D.Camera.prototype.type]=
  this.readCamera;this.file.typeRead[SEA3D.OrthographicCamera.prototype.type]=this.readOrthographicCamera;this.file.typeRead[SEA3D.SkeletonLocal.prototype.type]=this.readSkeletonLocal;this.file.typeRead[SEA3D.SkeletonAnimation.prototype.type]=this.readSkeletonAnimation;this.file.typeRead[SEA3D.JointObject.prototype.type]=this.readJointObject;this.file.typeRead[SEA3D.CubeMap.prototype.type]=this.readCubeMap;this.file.typeRead[SEA3D.CubeRender.prototype.type]=this.readCubeRender;this.file.typeRead[SEA3D.Animation.prototype.type]=
  this.file.typeRead[SEA3D.MorphAnimation.prototype.type]=this.file.typeRead[SEA3D.UVWAnimation.prototype.type]=this.readAnimation;this.file.typeRead[SEA3D.SoundPoint.prototype.type]=this.readSoundPoint;this.file.typeRead[SEA3D.TextureURL.prototype.type]=this.readTextureURL;this.file.typeRead[SEA3D.CubeMapURL.prototype.type]=this.readCubeMapURL;this.file.typeRead[SEA3D.AssetUpdate.prototype.type]=this.readAssetUpdate;this.file.typeRead[SEA3D.Morph.prototype.type]=this.readMorph;this.file.typeRead[SEA3D.VertexAnimation.prototype.type]=
  this.readVertexAnimation;this.file.typeRead[SEA3D.Actions.prototype.type]=this.readActions;this.file.typeRead[SEA3D.FileInfo.prototype.type]=this.readFileInfo;this.file.typeRead[SEA3D.Properties.prototype.type]=this.readProperties;this.config.dummys&&(this.file.typeRead[SEA3D.Dummy.prototype.type]=this.readDummy);this.config.scripts&&(this.file.typeRead[SEA3D.ScriptURL.prototype.type]=this.readScriptURL,this.file.typeRead[SEA3D.JavaScriptMethod.prototype.type]=this.readJavaScriptMethod);this.config.lights&&
  (this.file.typeRead[SEA3D.PointLight.prototype.type]=this.readPointLight,this.file.typeRead[SEA3D.DirectionalLight.prototype.type]=this.readDirectionalLight,this.file.typeRead[SEA3D.HemisphereLight.prototype.type]=this.readHemisphereLight,this.file.typeRead[SEA3D.AmbientLight.prototype.type]=this.readAmbientLight);this.file.typeRead[SEA3D.JPEG.prototype.type]=this.file.typeRead[SEA3D.JPEG_XR.prototype.type]=this.file.typeRead[SEA3D.PNG.prototype.type]=this.file.typeRead[SEA3D.GIF.prototype.type]=
  this.readTexture;this.file.typeRead[SEA3D.MP3.prototype.type]=this.readSound;this.file.typeRead[SEA3D.GLSL.prototype.type]=this.readGLSL;for(var a=THREE.SEA3D.EXTENSIONS_LOADER.length;a--;){var c=THREE.SEA3D.EXTENSIONS_LOADER[a];c.setTypeRead&&c.setTypeRead.call(this)}};
  THREE.SEA3D.prototype.load=function(a){this.file=new SEA3D.File;this.file.scope=this;this.file.config=this.config;this.file.onProgress=this.onLoadProgress.bind(this);this.file.onCompleteObject=this.onCompleteObject.bind(this);this.file.onDownloadProgress=this.onDownloadProgress.bind(this);this.file.onParseProgress=this.onParseProgress.bind(this);this.file.onParseComplete=this.onParseComplete.bind(this);this.file.onError=this.onError.bind(this);this.file.onHead=this.onHead.bind(this);this.file.onComplete=
  function(a){this.config.manager&&this.config.manager.add(this.domain);this.onComplete.call(this,a)}.bind(this);this.createDomain();this.setTypeRead();void 0!==a&&("string"===typeof a?this.file.load(a):this.file.read(a))};
  Object.assign(THREE.SEA3D.prototype,{_onHead:THREE.SEA3D.prototype.onHead,_updateTransform:THREE.SEA3D.prototype.updateTransform,_readMorph:THREE.SEA3D.prototype.readMorph,_readVertexAnimation:THREE.SEA3D.prototype.readVertexAnimation,_readGeometryBuffer:THREE.SEA3D.prototype.readGeometryBuffer,_readLine:THREE.SEA3D.prototype.readLine,_getModifier:THREE.SEA3D.prototype.getModifier,_readAnimation:THREE.SEA3D.prototype.readAnimation});
  THREE.SEA3D.prototype.isLegacy=function(a){a=a.sea3d;return"S3D"===a.sign?a.config.legacy:!1};THREE.SEA3D.prototype.flipVec3=function(a){if(a){for(var c=2;c<a.length;)a[c]=-a[c],c+=3;return a}};THREE.SEA3D.prototype.addVector=function(a,c){if(a){for(var d=0;d<a.length;d++)a[d]+=c[d];return a}};
  THREE.SEA3D.prototype.expandJoints=function(a){for(var c=4*a.numVertex,d=a.isBig?new Uint32Array(c):new Uint16Array(c),c=new Float32Array(c),f=0,l=a.jointPerVertex,m=0;m<a.numVertex;m++){var r=4*m,f=m*l;d[r]=a.joint[f];1<l&&(d[r+1]=a.joint[f+1]);2<l&&(d[r+2]=a.joint[f+2]);3<l&&(d[r+3]=a.joint[f+3]);c[r]=a.weight[f];1<l&&(c[r+1]=a.weight[f+1]);2<l&&(c[r+2]=a.weight[f+2]);3<l&&(c[r+3]=a.weight[f+3]);f=c[r]+c[r+1]+c[r+2]+c[r+3];c[r]+=1-f}a.joint=d;a.weight=c;a.jointPerVertex=4};
  THREE.SEA3D.prototype.compressJoints=function(a){for(var c=4*a.numVertex,d=a.isBig?new Uint32Array(c):new Uint16Array(c),c=new Float32Array(c),f=0,l=a.jointPerVertex,m=0;m<a.numVertex;m++){var r=4*m,f=m*l;d[r]=a.joint[f];d[r+1]=a.joint[f+1];d[r+2]=a.joint[f+2];d[r+3]=a.joint[f+3];c[r]=a.weight[f];c[r+1]=a.weight[f+1];c[r+2]=a.weight[f+2];c[r+3]=a.weight[f+3];f=c[r]+c[r+1]+c[r+2]+c[r+3];c[r]+=1-f}a.joint=d;a.weight=c;a.jointPerVertex=4};
  THREE.SEA3D.prototype.flipIndexes=function(a){for(var c=1;c<a.length;){var d=a[c+1];a[c+1]=a[c];a[c]=d;c+=3}return a};THREE.SEA3D.prototype.flipBoneMatrix=function(){var a=new THREE.Vector3;return function(c){var d=THREE.SEA3D.VECBUF.setFromMatrixPosition(c);d.z=-d.z;c.setPosition(a);c.multiplyMatrices(THREE.SEA3D.MTXBUF.makeRotationZ(THREE.Math.degToRad(180)),c);c.setPosition(d);return c}}();
  THREE.SEA3D.prototype.flipScaleMatrix=function(){var a=new THREE.Vector3,c=new THREE.Quaternion,d=new THREE.Vector3;return function(f,l,m,r){m&&f.multiplyMatrices(m,f);f.decompose(a,c,d);d.z=-d.z;f.compose(a,c,d);l&&f.multiplyMatrices(f,THREE.SEA3D.MTXBUF.makeRotationZ(THREE.Math.degToRad(180)));m&&(m=m.clone(),this.flipScaleMatrix(m,r),f.multiplyMatrices(m.getInverse(m),f));return f}}();
  THREE.SEA3D.prototype.degToRadAnimation=function(a){if(!a.isRadians){for(var c=a.dataList,d=0;d<c.length;d++){var f=c[d];if(f.kind===SEA3D.Animation.DEGREE){f.kind=SEA3D.Animation.RADIAN;for(var l=0;l<f.data.length;l++)f.data[l]*=SEA3D.Math.DEG_TO_RAD}}a.isRadians=!0}};
  THREE.SEA3D.prototype.flipDefaultAnimation=function(){var a=new THREE.Matrix4,c=new THREE.Matrix4,d=new THREE.Vector3,f=new THREE.Quaternion,l=new THREE.Vector3,m=new THREE.Vector3,r=new THREE.Quaternion,q=new THREE.Vector3;return function(t,x,v){if(!t.isFliped){for(var A=t.dataList,I=[],C=0;C<A.length;C++){var u=A[C],K=u.data,w=u.kind,u=K.length/u.blockSize;switch(w){case SEA3D.Animation.POSITION:case SEA3D.Animation.ROTATION:case SEA3D.Animation.SCALE:I.push({kind:w,numFrames:u,raw:K})}}if(0<I.length)for(u=
  I[0].numFrames,K=void 0,v?(a.identity(),this.flipScaleMatrix(c.copy(x.matrixWorld))):(x.parent&&(K=this.flipScaleMatrix(c.copy(x.parent.matrixWorld))),this.flipScaleMatrix(a.copy(x.matrix),!1,K)),a.decompose(d,f,l),x=0;x<u;x++){for(v=0;v<I.length;v++)switch(K=I[v].raw,w=I[v].kind,w){case SEA3D.Animation.POSITION:w=3*x;d.set(K[w],K[w+1],K[w+2]);break;case SEA3D.Animation.ROTATION:w=4*x;f.set(K[w],K[w+1],K[w+2],K[w+3]);break;case SEA3D.Animation.SCALE:w=4*x,l.set(K[w],K[w+1],K[w+2])}a.compose(d,f,l);
  this.flipScaleMatrix(a,!1,c);a.decompose(m,r,q);for(v=0;v<I.length;v++)switch(K=I[v].raw,w=I[v].kind,w){case SEA3D.Animation.POSITION:w=3*x;K[w]=m.x;K[w+1]=m.y;K[w+2]=m.z;break;case SEA3D.Animation.ROTATION:w=4*x;K[w]=r.x;K[w+1]=r.y;K[w+2]=r.z;K[w+3]=r.w;break;case SEA3D.Animation.SCALE:w=3*x,K[w]=q.x,K[w+1]=q.y,K[w+2]=q.z}}t.isFliped=!0}}}();THREE.SEA3D.prototype.readAnimation=function(a){this.isLegacy(a)||this._readAnimation(a)};
  THREE.SEA3D.prototype.getModifier=function(a){var c=a.sea;if(this.isLegacy(c)&&!c.done)switch(c.done=!0,c.type){case SEA3D.SkeletonAnimation.prototype.type:return this.readSkeletonAnimationLegacy(c,a.skeleton),c.tag;case SEA3D.Animation.prototype.type:case SEA3D.MorphAnimation.prototype.type:return a.scope instanceof THREE.Object3D&&this.flipDefaultAnimation(c,a.scope,a.relative),this._readAnimation(c),c.tag;case SEA3D.UVWAnimation.prototype.type:return this.degToRadAnimation(c),this._readAnimation(c),
  c.tag;case SEA3D.Morph.prototype.type:this.readMorphLegacy(c,a.geometry)}return this._getModifier(a)};
  THREE.SEA3D.prototype.updateTransform=function(){var a=new THREE.Matrix4,c=new THREE.Matrix4;return function(d,f){this.isLegacy(f)?(f.transform?a.fromArray(f.transform):a.makeTranslation(f.position.x,f.position.y,f.position.z),this.flipScaleMatrix(a,!1,d.parent?d.parent.matrixWorld:c,d.parent instanceof THREE.Bone),d.position.setFromMatrixPosition(a),d.scale.setFromMatrixScale(a),a.scale(THREE.SEA3D.VECBUF.set(1/d.scale.x,1/d.scale.y,1/d.scale.z)),d.rotation.setFromRotationMatrix(a),d.updateMatrixWorld()):
  this._updateTransform(d,f)}}();
  THREE.SEA3D.prototype.readSkeleton=function(){var a=new THREE.Matrix4,c=new THREE.Matrix4,d=new THREE.Matrix4,f=new THREE.Vector3,l=new THREE.Quaternion;return function(m){for(var r=[],q=m.sea3d.config.legacy,t=0;t<m.joint.length;t++){var x=m.joint[t];a.fromArray(x.inverseBindMatrix);c.getInverse(a);q&&this.flipBoneMatrix(c);-1<x.parentIndex&&(a.fromArray(m.joint[x.parentIndex].inverseBindMatrix),d.getInverse(a),q&&this.flipBoneMatrix(d),d.getInverse(d),c.multiplyMatrices(d,c));f.setFromMatrixPosition(c);
  l.setFromRotationMatrix(c);r[t]={name:x.name,pos:[f.x,f.y,f.z],rotq:[l.x,l.y,l.z,l.w],parent:x.parentIndex}}this.domain.bones=this.bones=this.bones||[];this.bones.push(this.objects[m.name+".sklq"]=m.tag=r);return r}}();
  THREE.SEA3D.prototype.readSkeletonAnimationLegacy=function(){var a=new THREE.Matrix4,c=new THREE.Matrix4,d=new THREE.Matrix4,f=new THREE.Matrix4;return function(l,m){if(l.tag)return l.tag;for(var r=[],q=1E3/l.frameRate/1E3,t=[1,1,1],x=0;x<l.sequence.length;x++){for(var v=l.sequence[x],A=v.start,I=A+v.count,C={name:v.name,repeat:v.repeat,fps:l.frameRate,JIT:0,length:q*v.count,hierarchy:[]},u=l.numJoints,K=l.raw,w=0;w<u;w++){for(var W=m.joint[w],Q={parent:W.parentIndex,keys:[]},H=Q.keys,J=0,y=A;y<I;y++){var D=
  y*u*7+7*w;c.makeRotationFromQuaternion(THREE.SEA3D.QUABUF.set(K[D+3],K[D+4],K[D+5],K[D+6]));c.setPosition(THREE.SEA3D.VECBUF.set(K[D],K[D+1],K[D+2]));-1<W.parentIndex?(a.fromArray(m.joint[W.parentIndex].inverseBindMatrix),f.getInverse(a),d.multiplyMatrices(f,c),this.flipBoneMatrix(d),this.flipBoneMatrix(f),f.getInverse(f),c.multiplyMatrices(f,d)):this.flipBoneMatrix(c);var D=THREE.SEA3D.VECBUF.setFromMatrixPosition(c),g=THREE.SEA3D.QUABUF.setFromRotationMatrix(c);H.push({time:J,pos:[D.x,D.y,D.z],
  rot:[g.x,g.y,g.z,g.w],scl:t});J+=q}C.hierarchy[w]=Q}r.push(THREE.SEA3D.AnimationClip.fromClip(THREE.AnimationClip.parseAnimation(C,m.tag),v.repeat))}this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[l.name+".anm"]=l.tag=r)}}();THREE.SEA3D.prototype.readMorphLegacy=function(a,c){for(var d=0;d<a.node.length;d++){var f=a.node[d];this.flipVec3(f.vertex);this.flipVec3(f.normal);this.addVector(f.vertex,c.vertex);this.addVector(f.normal,c.normal)}this._readMorph(a)};
  THREE.SEA3D.prototype.readMorph=function(a){this.isLegacy(a)||this._readMorph(a)};THREE.SEA3D.prototype.readVertexAnimation=function(a){if(this.isLegacy(a))for(var c=0,d=a.frame.length;c<d;c++){var f=a.frame[c];this.flipVec3(f.vertex);this.flipVec3(f.normal)}this._readVertexAnimation(a)};
  THREE.SEA3D.prototype.readGeometryBuffer=function(a){this.isLegacy(a)&&(this.flipVec3(a.vertex),this.flipVec3(a.normal),this.flipIndexes(a.indexes),4<a.jointPerVertex?this.compressJoints(a):4>a.jointPerVertex&&this.expandJoints(a));this._readGeometryBuffer(a)};THREE.SEA3D.prototype.readLines=function(a){this.isLegacy(a)&&this.flipVec3(a.vertex);this._readLines(a)};THREE.SEA3D.prototype.onHead=function(a){if("S3D"!=a.sign&&"TJS"!=a.sign)throw Error("Sign '"+a.sign+"' unknown.");};
  THREE.SEA3D.EXTENSIONS_LOADER.push({setTypeRead:function(){this.config.legacy=void 0!==this.config.legacy?this.config.legacy:!0;this.file.typeRead[SEA3D.Skeleton.prototype.type]=this.readSkeleton}});var TWEEN=TWEEN||function(){var a=[];return{getAll:function(){return a},removeAll:function(){a=[]},add:function(c){a.push(c)},remove:function(c){c=a.indexOf(c);-1!==c&&a.splice(c,1)},update:function(c,d){if(0===a.length)return!1;var f=0;for(c=void 0!==c?c:TWEEN.now();f<a.length;)a[f].update(c)||d?f++:a.splice(f,1);return!0}}}();
  TWEEN.now="undefined"===typeof window&&"undefined"!==typeof process?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:"undefined"!==typeof window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now.bind(window.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()};
  TWEEN.Tween=function(a){var c={},d={},f={},l=1E3,m=0,r,q=!1,t=!1,x=0,v=null,A=TWEEN.Easing.Linear.None,I=TWEEN.Interpolation.Linear,C=[],u=null,K=!1,w=null,W=null,Q=null;this.to=function(a,c){d=a;void 0!==c&&(l=c);return this};this.start=function(l){TWEEN.add(this);t=!0;K=!1;v=void 0!==l?l:TWEEN.now();v+=x;for(var m in d){if(d[m]instanceof Array){if(0===d[m].length)continue;d[m]=[a[m]].concat(d[m])}void 0!==a[m]&&(c[m]=a[m],!1===c[m]instanceof Array&&(c[m]*=1),f[m]=c[m]||0)}return this};this.stop=
  function(){if(!t)return this;TWEEN.remove(this);t=!1;null!==Q&&Q.call(a,a);this.stopChainedTweens();return this};this.end=function(){this.update(v+l);return this};this.stopChainedTweens=function(){for(var a=0,c=C.length;a<c;a++)C[a].stop()};this.delay=function(a){x=a;return this};this.repeat=function(a){m=a;return this};this.repeatDelay=function(a){r=a;return this};this.yoyo=function(a){q=a;return this};this.easing=function(a){A=a;return this};this.interpolation=function(a){I=a;return this};this.chain=
  function(){C=arguments;return this};this.onStart=function(a){u=a;return this};this.onUpdate=function(a){w=a;return this};this.onComplete=function(a){W=a;return this};this.onStop=function(a){Q=a;return this};this.update=function(t){var J,y,D;if(t<v)return!0;!1===K&&(null!==u&&u.call(a,a),K=!0);y=(t-v)/l;y=1<y?1:y;D=A(y);for(J in d)if(void 0!==c[J]){var g=c[J]||0,n=d[J];n instanceof Array?a[J]=I(n,D):("string"===typeof n&&(n="+"===n.charAt(0)||"-"===n.charAt(0)?g+parseFloat(n):parseFloat(n)),"number"===
  typeof n&&(a[J]=g+(n-g)*D))}null!==w&&w.call(a,D);if(1===y)if(0<m){isFinite(m)&&m--;for(J in f)"string"===typeof d[J]&&(f[J]+=parseFloat(d[J])),q&&(y=f[J],f[J]=d[J],d[J]=y),c[J]=f[J];v=void 0!==r?t+r:t+x}else{null!==W&&W.call(a,a);t=0;for(J=C.length;t<J;t++)C[t].start(v+l);return!1}return!0}};
  TWEEN.Easing={Linear:{None:function(a){return a}},Quadratic:{In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return 1>(a*=2)?0.5*a*a*a:0.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return 1>(a*=2)?0.5*a*a*a*a:-0.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*
  a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return 1>(a*=2)?0.5*a*a*a*a*a:0.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return 0.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:1>(a*=2)?0.5*Math.pow(1024,a-1):0.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-
  Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return 1>(a*=2)?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){return 0===a?0:1===a?1:-Math.pow(2,10*(a-1))*Math.sin(5*(a-1.1)*Math.PI)},Out:function(a){return 0===a?0:1===a?1:Math.pow(2,-10*a)*Math.sin(5*(a-0.1)*Math.PI)+1},InOut:function(a){if(0===a)return 0;if(1===a)return 1;a*=2;return 1>a?-0.5*Math.pow(2,10*(a-1))*Math.sin(5*(a-1.1)*Math.PI):0.5*Math.pow(2,-10*(a-1))*Math.sin(5*
  (a-1.1)*Math.PI)+1}},Back:{In:function(a){return a*a*(2.70158*a-1.70158)},Out:function(a){return--a*a*(2.70158*a+1.70158)+1},InOut:function(a){return 1>(a*=2)?0.5*a*a*(3.5949095*a-2.5949095):0.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)}},Bounce:{In:function(a){return 1-TWEEN.Easing.Bounce.Out(1-a)},Out:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375},InOut:function(a){return 0.5>a?0.5*TWEEN.Easing.Bounce.In(2*
  a):0.5*TWEEN.Easing.Bounce.Out(2*a-1)+0.5}}};
  TWEEN.Interpolation={Linear:function(a,c){var d=a.length-1,f=d*c,l=Math.floor(f),m=TWEEN.Interpolation.Utils.Linear;return 0>c?m(a[0],a[1],f):1<c?m(a[d],a[d-1],d-f):m(a[l],a[l+1>d?d:l+1],f-l)},Bezier:function(a,c){for(var d=0,f=a.length-1,l=Math.pow,m=TWEEN.Interpolation.Utils.Bernstein,r=0;r<=f;r++)d+=l(1-c,f-r)*l(c,r)*a[r]*m(f,r);return d},CatmullRom:function(a,c){var d=a.length-1,f=d*c,l=Math.floor(f),m=TWEEN.Interpolation.Utils.CatmullRom;return a[0]===a[d]?(0>c&&(l=Math.floor(f=d*(1+c))),m(a[(l-
  1+d)%d],a[l],a[(l+1)%d],a[(l+2)%d],f-l)):0>c?a[0]-(m(a[0],a[0],a[1],a[1],-f)-a[0]):1<c?a[d]-(m(a[d],a[d],a[d-1],a[d-1],f-d)-a[d]):m(a[l?l-1:0],a[l],a[d<l+1?d:l+1],a[d<l+2?d:l+2],f-l)},Utils:{Linear:function(a,c,d){return(c-a)*d+a},Bernstein:function(a,c){var d=TWEEN.Interpolation.Utils.Factorial;return d(a)/d(c)/d(a-c)},Factorial:function(){var a=[1];return function(c){var d=1;if(a[c])return a[c];for(var f=c;1<f;f--)d*=f;return a[c]=d}}(),CatmullRom:function(a,c,d,f,l){a=0.5*(d-a);f=0.5*(f-c);var m=
  l*l;return(2*c-2*d+a+f)*l*m+(-3*c+3*d-2*a-f)*m+a*l+c}}};(function(a){"function"===typeof define&&define.amd?define([],function(){return TWEEN}):"undefined"!==typeof module&&"object"===typeof exports?module.exports=TWEEN:void 0!==a&&(a.TWEEN=TWEEN)})(this);(function(a,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):c(a.UIL=a.UIL||{})})(this,function(a){function c(a,c){this.x=a||0;this.y=c||0}function d(a){a=a||{};this.css=J.css;this.colors=J.colors;this.svgs=J.svgs;this.zone={x:0,y:0,w:0,h:0};this.local=(new c).neg();this.isCanvasOnly=!1;this.main=a.main||null;this.isUI=a.isUI||!1;this.parentGroup=null;this.p=void 0!==a.p?a.p:J.size.p;this.w=this.isUI?this.main.size.w:
  J.size.w;void 0!==a.w&&(this.w=a.w);this.h=this.isUI?this.main.size.h:J.size.h;void 0!==a.h&&(this.h=a.h);this.h=11>this.h?11:this.h;this.autoWidth=a.auto||!0;this.isOpen=!1;this.radius=a.radius||0;this.isEdit=this.mono=this.isNumber=!1;if(this.simple=a.simple||!1)this.sa=0;this.setSize(this.w);void 0!==a.sa&&(this.sa=a.sa);void 0!==a.sb&&(this.sb=a.sb);this.simple&&(this.sb=this.w-this.sa);this.sc=void 0===a.sc?47:a.sc;this.objectLink=null;this.isSend=!1;this.val=null;this.bg=this.isUI?this.main.bg:
  J.colors.background;this.bgOver=J.colors.backgroundOver;void 0!==a.bg&&(this.bgOver=this.bg=a.bg);void 0!==a.bgOver&&(this.bgOver=a.bgOver);this.titleColor=a.titleColor||J.colors.text;this.fontColor=a.fontColor||J.colors.text;void 0!==a.color&&(isNaN(a.color)?this.fontColor=a.color:this.fontColor=J.hexToHtml(a.color),this.titleColor=this.fontColor);this.colorPlus=J.ColorLuma(this.fontColor,0.3);this.txt=a.name||"Proto";this.rename=a.rename||"";this.target=a.target||null;this.callback=void 0===a.callback?
  null:a.callback;this.endCallback=null;null===this.callback&&this.isUI&&null!==this.main.callback&&(this.callback=this.main.callback);this.c=[];this.s=[];this.c[0]=J.dom("div",J.css.basic+"position:relative; height:20px; float:left; overflow:hidden;");this.s[0]=this.c[0].style;this.isUI&&(this.s[0].marginBottom="1px");this.simple||(this.c[1]=J.dom("div",J.css.txt),this.s[1]=this.c[1].style,this.c[1].textContent=""===this.rename?this.txt:this.rename,this.s[1].color=this.titleColor);if(a.pos){this.s[0].position=
  "absolute";for(var d in a.pos)this.s[0][d]=a.pos[d];this.mono=!0}a.css&&(this.s[0].cssText=a.css)}function f(a){d.call(this,a);this.value=a.value||!1;this.buttonColor=a.bColor||this.colors.button;this.inh=a.inh||this.h;a=Math.floor(0.5*this.h)-0.5*(this.inh-2);this.c[2]=this.dom("div",this.css.basic+"background:"+this.colors.boolbg+"; height:"+(this.inh-2)+"px; width:36px; top:"+a+"px; border-radius:10px; border:2px solid "+this.boolbg);this.c[3]=this.dom("div",this.css.basic+"height:"+(this.inh-
  6)+"px; width:16px; top:"+(a+2)+"px; border-radius:10px; background:"+this.buttonColor+";");this.init();this.update()}function l(a){d.call(this,a);this.value=!1;this.values=a.value||[this.txt];this.isDown=!1;this.buttonColor=a.bColor||this.colors.button;this.isLoadButton=a.loader||!1;if(this.isDragButton=a.drag||!1)this.isLoadButton=!0;this.lng=this.values.length;this.tmp=[];this.stat=[];for(a=0;a<this.lng;a++)this.c[a+2]=this.dom("div",this.css.txt+"text-align:center; top:1px; background:"+this.buttonColor+
  "; height:"+(this.h-2)+"px; border-radius:"+this.radius+"px; line-height:"+(this.h-4)+"px;"),this.c[a+2].style.color=this.fontColor,this.c[a+2].innerHTML=this.values[a],this.stat[a]=1;void 0!==this.c[1]&&(this.c[1].textContent="");this.isLoadButton&&this.initLoader();this.isDragButton&&(this.lng++,this.initDrager());this.init()}function m(a){d.call(this,a);this.autoWidth=!1;this.buttonColor=this.colors.button;this.setTypeNumber(a);this.radius=0.5*this.w;this.twoPi=2*Math.PI;this.pi90=0.5*Math.PI;
  this.offset=new c;this.h=a.h||this.w+10;this.top=0;this.c[0].style.width=this.w+"px";void 0!==this.c[1]&&(this.c[1].style.width=this.w+"px",this.c[1].style.textAlign="center",this.top=10,this.h+=10);this.cmode=this.percent=0;this.c[2]=this.dom("div",this.css.txt+"text-align:center; top:"+(this.h-20)+"px; width:"+this.w+"px; color:"+this.fontColor);this.c[3]=this.getCircular();this.setSvg(this.c[3],"d",this.makePath(),1);this.setSvg(this.c[3],"stroke",this.fontColor,1);this.setSvg(this.c[3],"viewBox",
  "0 0 "+this.w+" "+this.w);this.setCss(this.c[3],{width:this.w,height:this.w,left:0,top:this.top});this.init();this.update()}function r(a){d.call(this,a);this.ctype=a.ctype||"array";this.wfixe=256<this.sb?256:this.sb;this.side=a.side||"down";this.up="down"===this.side?0:1;this.baseH=this.h;this.offset=new c;this.decal=new c;this.pi90=0.5*Math.PI;this.c[2]=this.dom("div",this.css.txt+"height:"+(this.h-4)+"px;border-radius:"+this.radius+"px; line-height:"+(this.h-8)+"px;");this.s[2]=this.c[2].style;
  this.up&&(this.s[2].top="auto",this.s[2].bottom="2px");this.c[3]=this.getColorRing();this.c[3].style.visibility="hidden";this.hsl=null;this.value="#ffffff";void 0!==a.value&&(a.value instanceof Array?this.value=J.rgbToHex(a.value):isNaN(a.value)?this.value=a.value:this.value=J.hexToHtml(a.value));this.bcolor=null;this.isDown=!1;this.setColor(this.value);this.init();void 0!==a.open&&this.open()}function q(a){d.call(this,a);this.round=Math.round;this.autoHeight=!0;this.baseH=this.h;this.hplus=50;this.res=
  a.res||40;this.l=1;this.pa1=[];this.pa2=[];this.pa3=[];for(var c=this.res+1;c--;)this.pa1.push(50),this.pa2.push(50),this.pa3.push(50);c=Math.floor(0.5*this.h)-6;this.c[1].textContent="FPS";this.c[0].style.cursor="pointer";this.c[0].style.pointerEvents="auto";this.c[2]=this.dom("path",this.css.basic+("display:none; left:10px; top:"+this.h+"px; height:"+(this.hplus-8)+"px; background: rgba(0, 0, 0, 0.2);border:1px solid rgba(255, 255, 255, 0.2); "),{fill:"rgba(200,200,200,0.3)","stroke-width":1,stroke:this.fontColor,
  "vector-effect":"non-scaling-stroke"});this.c[2].setAttribute("viewBox","0 0 "+this.res+" 42");this.c[2].setAttribute("height","100%");this.c[2].setAttribute("width","100%");this.c[2].setAttribute("preserveAspectRatio","none");this.dom("path",null,{fill:"rgba(255,255,0,0.3)","stroke-width":1,stroke:"#FF0","vector-effect":"non-scaling-stroke"},this.c[2]);this.dom("path",null,{fill:"rgba(0,255,255,0.3)","stroke-width":1,stroke:"#0FF","vector-effect":"non-scaling-stroke"},this.c[2]);this.c[3]=this.dom("div",
  this.css.basic+"width:100%; bottom:0px; height:1px; background: rgba(255, 255, 255, 0.2);");this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:4px; top:"+c+"px;",{d:"M 3 8 L 8 5 3 2 3 8 Z",fill:this.fontColor,stroke:"none"});this.isShow=a.show||!1;this.c[1].style.marginLeft="10px";this.now=self.performance&&self.performance.now?self.performance.now.bind(performance):Date.now;this.prevTime=this.startTime=this.now();this.frames=0;this.isMem=!1;this.mm=this.mem=
  this.fps=this.ms=0;self.performance&&self.performance.memory&&(this.isMem=!0);this.init()}function t(a){d.call(this,a);this.value=void 0!==a.value?a.value:[0,0,0];this.lng=this.value.length;this.precision=a.precision||2;this.multiplicator=a.multiplicator||1;this.autoWidth=!0;this.isDown=this.isNumber=!1;this.h=a.h||138;this.rh=this.h-10;this.top=0;this.c[0].style.width=this.w+"px";void 0!==this.c[1]&&(this.c[1].style.width=this.w+"px",this.top=10,this.h+=10);this.gh=this.rh-28;this.gw=this.w-28;this.c[2]=
  this.dom("div",this.css.txt+"text-align:center; top:"+(this.h-20)+"px; width:"+this.w+"px; color:"+this.fontColor);this.c[2].textContent=this.value;a=this.dom("svg",this.css.basic,{viewBox:"0 0 "+this.w+" "+this.rh,width:this.w,height:this.rh,preserveAspectRatio:"none"});this.setCss(a,{width:this.w,height:this.rh,left:0,top:this.top});this.dom("path","",{d:"",stroke:this.colors.text,"stroke-width":2,fill:"none","stroke-linecap":"butt"},a);this.dom("rect","",{x:10,y:10,width:this.gw+8,height:this.gh+
  8,stroke:"rgba(0,0,0,0.3)","stroke-width":1,fill:"none"},a);this.iw=(this.gw-4*(this.lng-1))/this.lng;var c=[];this.cMode=[];this.v=[];for(var f=0;f<this.lng;f++)c[f]=[14+f*this.iw+4*f,this.iw],c[f][2]=c[f][0]+c[f][1],this.cMode[f]=0,this.v[f]=this.value[f]/this.multiplicator,this.dom("rect","",{x:c[f][0],y:14,width:c[f][1],height:1,fill:this.fontColor,"fill-opacity":0.3},a);this.tmp=c;this.c[3]=a;this.init();void 0!==this.c[1]&&(this.c[1].style.top="0px",this.c[1].style.height="20px",this.s[1].lineHeight=
  "15px");this.update(!1)}function x(a){d.call(this,a);this.uis=[];this.autoHeight=!0;this.current=-1;this.target=null;this.decal=0;this.baseH=this.h;var c=Math.floor(0.5*this.h)-6;this.isLine=void 0!==a.line?a.line:!1;this.c[2]=this.dom("div",this.css.basic+"width:100%; left:0; height:auto; overflow:hidden; top:"+this.h+"px");this.c[3]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:0; top:"+c+"px;",{d:this.svgs.group,fill:this.fontColor,stroke:"none"});this.c[4]=this.dom("path",
  this.css.basic+"position:absolute; width:10px; height:10px; left:4px; top:"+c+"px;",{d:this.svgs.arrow,fill:this.fontColor,stroke:"none"});this.isLine&&(this.c[5]=this.dom("div",this.css.basic+"background:rgba(255, 255, 255, 0.2); width:100%; left:0; height:1px; bottom:0px"));c=this.s;c[0].height=this.h+"px";c[1].height=this.h+"px";this.c[1].name="group";this.s[1].marginLeft="10px";this.s[1].lineHeight=this.h-4;this.s[1].color=this.fontColor;this.s[1].fontWeight="bold";this.init();void 0!==a.bg&&
  this.setBG(a.bg);void 0!==a.open&&this.open()}function v(a){d.call(this,a);this.autoWidth=!1;this.value=[0,0];this.joyType="analogique";this.model=void 0!==a.mode?a.mode:0;this.precision=a.precision||2;this.multiplicator=a.multiplicator||1;this.pos=new c;this.tmp=new c;this.interval=null;this.radius=0.5*this.w;this.distance=0.25*this.radius;this.h=a.h||this.w+10;this.top=0;this.c[0].style.width=this.w+"px";void 0!==this.c[1]&&(this.c[1].style.width=this.w+"px",this.c[1].style.textAlign="center",this.top=
  10,this.h+=10);this.c[2]=this.dom("div",this.css.txt+"text-align:center; top:"+(this.h-20)+"px; width:"+this.w+"px; color:"+this.fontColor);this.c[2].textContent=this.value;this.c[3]=this.getJoystick(this.model);this.setSvg(this.c[3],"viewBox","0 0 "+this.w+" "+this.w);this.setCss(this.c[3],{width:this.w,height:this.w,left:0,top:this.top});this.ratio=128/this.w;this.init();this.update(!1)}function A(a){d.call(this,a);this.autoWidth=!1;this.buttonColor=this.colors.button;this.setTypeNumber(a);this.mPI=
  0.8*Math.PI;this.toDeg=180/Math.PI;this.cirRange=2*this.mPI;this.offset=new c;this.radius=0.5*this.w;this.h=a.h||this.w+10;this.top=0;this.c[0].style.width=this.w+"px";void 0!==this.c[1]&&(this.c[1].style.width=this.w+"px",this.c[1].style.textAlign="center",this.top=10,this.h+=10);this.cmode=this.percent=0;this.c[2]=this.dom("div",this.css.txt+"text-align:center; top:"+(this.h-20)+"px; width:"+this.w+"px; color:"+this.fontColor);this.c[3]=this.getKnob();this.setSvg(this.c[3],"stroke",this.fontColor,
  1);this.setSvg(this.c[3],"stroke",this.fontColor,3);this.setSvg(this.c[3],"d",this.makeGrad(),3);this.setSvg(this.c[3],"viewBox","0 0 "+this.ww+" "+this.ww);this.setCss(this.c[3],{width:this.w,height:this.w,left:0,top:this.top});this.r=0;this.init();this.update()}function I(a){d.call(this,a);this.autoHeight=!1;var c=a.align||"center";this.tMode=this.sMode=0;this.buttonColor=a.bColor||this.colors.button;var f=Math.floor(0.5*this.h)-5;this.c[2]=this.dom("div",this.css.basic+"top:0; display:none;");
  this.c[3]=this.dom("div",this.css.txt+"text-align:"+c+"; line-height:"+(this.h-4)+"px; top:1px;  background:"+this.buttonColor+"; height:"+(this.h-2)+"px; border-radius:"+this.radius+"px;");this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; top:"+f+"px;",{d:this.svgs.arrow,fill:this.fontColor,stroke:"none"});this.scroller=this.dom("div",this.css.basic+"right:5px;  width:10px; background:#666; display:none;");this.c[3].style.color=this.fontColor;this.list=a.list||
  [];this.items=[];this.prevName="";this.baseH=this.h;this.itemHeight=a.itemHeight||this.h-3;this.full=a.full||!1;this.py=0;this.ww=this.sb;this.isDown=this.scroll=!1;this.current=null;this.side=a.side||"down";(this.up="down"===this.side?0:1)?(this.c[2].style.top="auto",this.c[3].style.top="auto",this.c[4].style.top="auto",this.c[2].style.bottom=this.h-2+"px",this.c[3].style.bottom="1px",this.c[4].style.bottom=f+"px"):this.c[2].style.top=this.baseH+"px";this.listIn=this.dom("div",this.css.basic+"left:0; top:0; width:100%; background:rgba(0,0,0,0.2);");
  this.listIn.name="list";this.topList=0;this.c[2].appendChild(this.listIn);this.c[2].appendChild(this.scroller);this.setList(this.list,a.value);this.init();void 0!==a.open&&this.open()}function C(a){d.call(this,a);this.setTypeNumber(a);this.isDown=!1;this.value=[0];this.toRad=1;this.isNumber=!0;this.isVector=this.isAngle=!1;void 0!==a.value&&(isNaN(a.value)?a.value instanceof Array?(this.value=a.value,this.isNumber=!1):a.value instanceof Object&&(this.value=[],a.value.x&&(this.value[0]=a.value.x),
  a.value.y&&(this.value[1]=a.value.y),a.value.z&&(this.value[2]=a.value.z),a.value.w&&(this.value[3]=a.value.w),this.isVector=!0):this.value=[a.value]);this.lng=this.value.length;this.tmp=[];a.isAngle&&(this.isAngle=!0,this.toRad=Math.PI/180);this.current=-1;this.prev={x:0,y:0,d:0,v:0};this.cMode=[];for(var c=this.lng;c--;)this.isAngle&&(this.value[c]=(180*this.value[c]/Math.PI).toFixed(this.precision)),this.c[2+c]=this.dom("div",this.css.txtselect+"letter-spacing:-1px; height:"+(this.h-4)+"px; line-height:"+
  (this.h-8)+"px;"),a.center&&(this.c[2+c].style.textAlign="center"),this.c[2+c].textContent=this.value[c],this.c[2+c].style.color=this.fontColor,this.c[2+c].isNum=!0,this.cMode[c]=0;this.init()}function u(a){d.call(this,a);this.setTypeNumber(a);this.model=a.stype||0;void 0!==a.mode&&(this.model=a.mode);this.buttonColor=a.bColor||this.colors.button;this.isOver=this.isDown=!1;this.allway=a.allway||!1;this.firstImput=!1;this.c[2]=this.dom("div",this.css.txtselect+"letter-spacing:-1px; text-align:right; width:47px; border:1px dashed "+
  this.colors.hide+"; color:"+this.fontColor);this.c[3]=this.dom("div",this.css.basic+" top:0; height:"+this.h+"px;");this.c[4]=this.dom("div",this.css.basic+"background:"+this.colors.scrollback+"; top:2px; height:"+(this.h-4)+"px;");this.c[5]=this.dom("div",this.css.basic+"left:4px; top:5px; height:"+(this.h-10)+"px; background:"+this.fontColor+";");this.c[2].isNum=!0;if(0!==this.model){if(1===this.model||3===this.model)var c=4,f=8,l=this.h-4,m=20;2===this.model&&(c=2,f=4,m=2,l=0.5*(this.h-4));3===
  this.model&&(this.c[5].style.visible="none");this.c[4].style.borderRadius=c+"px";this.c[4].style.height=f+"px";this.c[4].style.top=0.5*this.h-c+"px";this.c[5].style.borderRadius=0.5*c+"px";this.c[5].style.height=c+"px";this.c[5].style.top=0.5*this.h-0.5*c+"px";this.c[6]=this.dom("div",this.css.basic+"border-radius:"+m+"px; margin-left:"+0.5*-l+"px; border:1px solid "+this.colors.border+"; background:"+this.buttonColor+"; left:4px; top:2px; height:"+(this.h-4)+"px; width:"+l+"px;")}this.init()}function K(a){d.call(this,
  a);this.cmode=0;this.value=a.value||"";this.allway=a.allway||!1;this.firstImput=!1;this.c[2]=this.dom("div",this.css.txtselect);this.c[2].textContent=this.value;this.init()}function w(a){d.call(this,a);a=a.prefix||"";this.c[2]=this.dom("div",this.css.txt+"text-align:right; width:60px; line-height:"+(this.h-8)+"px; color:"+this.fontColor);31===this.h&&(this.s[0].height=this.h+"px",this.s[1].top="8px",this.c[2].style.top="8px");this.c[1].textContent=this.txt.substring(0,1).toUpperCase()+this.txt.substring(1).replace("-",
  " ");this.c[2].textContent=a;this.init()}function W(){var a=arguments,c,d,S=!1,y=null;"string"===typeof a[0]?(c=a[0],d=a[1]||{}):"object"===typeof a[0]&&(S=!0,void 0===a[2]&&[].push.call(a,{}),c=a[2].type?a[2].type:"slide",d=a[2],d.name=a[1],d.value=a[0][a[1]]);switch(c.toLowerCase()){case "bool":y=new f(d);break;case "button":y=new l(d);break;case "circular":y=new m(d);break;case "color":y=new r(d);break;case "fps":y=new q(d);break;case "graph":y=new t(d);break;case "group":y=new x(d);break;case "joystick":y=
  new v(d);break;case "knob":y=new A(d);break;case "list":y=new I(d);break;case "numeric":case "number":y=new C(d);break;case "slide":y=new u(d);break;case "textInput":case "string":y=new K(d);break;case "title":y=new w(d)}if(null!==y)return S&&y.setReferency(a[0],a[1]),y}function Q(a){this.canvas=null;a=a||{};void 0!==a.transparent&&(J.colors.background="none",J.colors.backgroundOver="none");this.isReset=!0;this.tmpAdd=null;this.tmpH=0;this.isCanvas=a.isCanvas||!1;this.isCanvasOnly=!1;this.css=void 0!==
  a.css?a.css:"";this.callback=void 0===a.callback?null:a.callback;this.forceHeight=a.maxHeight||0;this.cn="";this.size=J.size;void 0!==a.p&&(this.size.p=a.p);void 0!==a.w&&(this.size.w=a.w);void 0!==a.h&&(this.size.h=a.h);void 0!==a.s&&(this.size.s=a.s);this.size.h=11>this.size.h?11:this.size.h;this.local=(new c).neg();this.zone={x:0,y:0,w:this.size.w,h:0};this.mouse=(new c).neg();this.h=0;this.prevY=-1;this.sw=0;this.colors=J.colors;this.bg=a.bg||J.colors.background;this.bh=(this.isWithClose=void 0!==
  a.close?a.close:!0)?this.size.h:0;this.autoResize=void 0===a.autoResize?!0:a.autoResize;this.isCenter=a.center||!1;this.isOpen=!0;this.isScroll=this.isDown=!1;this.uis=[];this.current=-1;this.target=null;this.decal=0;this.ratio=1;this.oy=0;this.content=J.dom("div",J.css.basic+" width:0px; height:auto; top:0px; "+this.css);this.innerContent=J.dom("div",J.css.basic+"width:100%; top:0; left:0; height:auto; overflow:hidden;");this.content.appendChild(this.innerContent);this.inner=J.dom("div",J.css.basic+
  "width:100%; left:0; ");this.innerContent.appendChild(this.inner);this.scrollBG=J.dom("div",J.css.basic+"right:0; top:0; width:"+(this.size.s-1)+"px; height:10px; display:none; background:"+this.bg+";");this.content.appendChild(this.scrollBG);this.scroll=J.dom("div",J.css.basic+"background:"+this.colors.scroll+"; right:2px; top:0; width:"+(this.size.s-4)+"px; height:10px;");this.scrollBG.appendChild(this.scroll);this.bottom=J.dom("div",J.css.txt+"width:100%; top:auto; bottom:0; left:0; border-bottom-right-radius:10px;  border-bottom-left-radius:10px; text-align:center; height:"+
  this.bh+"px; line-height:"+(this.bh-5)+"px; border-top:1px solid "+J.colors.stroke+";");this.content.appendChild(this.bottom);this.bottom.textContent="close";this.bottom.style.background=this.bg;this.parent=void 0!==a.parent?a.parent:null;null!==this.parent||this.isCanvas||(this.parent=document.body,this.isCenter||(this.content.style.right="10px"));null!==this.parent&&this.parent.appendChild(this.content);this.isCanvas&&null===this.parent&&(this.isCanvasOnly=!0);this.isCanvasOnly||(this.content.style.pointerEvents=
  "auto");this.setWidth();this.isCanvas&&this.makeCanvas();D.add(this)}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:+a});void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});void 0===Object.assign&&function(){Object.assign=function(a){if(void 0===a||null===a)throw new TypeError("Cannot convert undefined or null to object");
  for(var c=Object(a),d=1;d<arguments.length;d++){var f=arguments[d];if(void 0!==f&&null!==f)for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(c[l]=f[l])}return c}}();var H={frag:document.createDocumentFragment(),colorRing:null,joystick_0:null,joystick_1:null,circular:null,knob:null,svgns:"http://www.w3.org/2000/svg",htmls:"http://www.w3.org/1999/xhtml",DOM_SIZE:"height width top left bottom right margin-left margin-right margin-top margin-bottom".split(" "),SVG_TYPE_D:"pattern defs transform stop animate radialGradient linearGradient animateMotion".split(" "),
  SVG_TYPE_G:"svg rect circle path polygon text g line foreignObject".split(" "),TwoPI:6.283185307179586,size:{w:240,h:20,p:30,s:20},colors:{text:"#C0C0C0",textOver:"#FFFFFF",background:"rgba(44,44,44,0.3)",backgroundOver:"rgba(11,11,11,0.5)",input:"#005AAA",border:"#454545",borderOver:"#5050AA",borderSelect:"#308AFF",scrollback:"rgba(44,44,44,0.2)",scrollbackover:"rgba(44,44,44,0.5)",button:"#404040",boolbg:"#181818",select:"#308AFF",moving:"#03afff",down:"#024699",stroke:"rgba(11,11,11,0.5)",scroll:"#333333",
  hide:"rgba(0,0,0,0)"},css:{basic:"position:absolute; pointer-events:none; box-sizing:border-box; margin:0; padding:0; overflow:hidden; -o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;"},svgs:{group:"M 7 7 L 7 8 8 8 8 7 7 7 M 5 7 L 5 8 6 8 6 7 5 7 M 3 7 L 3 8 4 8 4 7 3 7 M 7 5 L 7 6 8 6 8 5 7 5 M 6 6 L 6 5 5 5 5 6 6 6 M 7 3 L 7 4 8 4 8 3 7 3 M 6 4 L 6 3 5 3 5 4 6 4 M 3 5 L 3 6 4 6 4 5 3 5 M 3 3 L 3 4 4 4 4 3 3 3 Z",arrow:"M 3 8 L 8 5 3 2 3 8 Z",
  arrowDown:"M 5 8 L 8 3 2 3 5 8 Z",arrowUp:"M 5 2 L 2 7 8 7 5 2 Z"},setText:function(a,c,d){c=c||"#CCC";H.colors.text=c;H.css.txt=H.css.basic+"font-family:"+(d||"Monospace")+"; font-size:"+(a||11)+"px; color:"+c+"; padding:2px 10px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap;";H.css.txtselect=H.css.txt+"padding:2px 5px; border:1px dashed "+H.colors.border+";";H.css.item=H.css.txt+"position:relative; background:rgba(0,0,0,0.2); margin-bottom:1px;"},clone:function(a){return a.cloneNode(!0)},
  setSvg:function(a,c,d,f){-1===f?a.setAttributeNS(null,c,d):a.childNodes[f||0].setAttributeNS(null,c,d)},setCss:function(a,c){for(var d in c)-1!==H.DOM_SIZE.indexOf(d)?a.style[d]=c[d]+"px":a.style[d]=c[d]},set:function(a,c){for(var d in c)"txt"===d&&(a.textContent=c[d]),a.setAttributeNS(null,d,c[d])},get:function(a,c){if(void 0===c)return a;if(!isNaN(c))return a.childNodes[c];if(c instanceof Array){if(2===c.length)return a.childNodes[c[0]].childNodes[c[1]];if(3===c.length)return a.childNodes[c[0]].childNodes[c[1]].childNodes[c[2]]}},
  dom:function(a,c,d,f,l){a=a||"div";-1!==H.SVG_TYPE_D.indexOf(a)||-1!==H.SVG_TYPE_G.indexOf(a)?"svg"===a?(f=document.createElementNS(H.svgns,"svg"),H.set(f,d)):(void 0===f&&(f=document.createElementNS(H.svgns,"svg")),H.addAttributes(f,a,d,l)):f=void 0===f?document.createElementNS(H.htmls,a):f.appendChild(document.createElementNS(H.htmls,a));c&&(f.style.cssText=c);return void 0===l?f:f.childNodes[l||0]},addAttributes:function(a,c,d,f){var l=document.createElementNS(H.svgns,c);H.set(l,d);H.get(a,f).appendChild(l);
  -1!==H.SVG_TYPE_G.indexOf(c)&&(l.style.pointerEvents="none");return l},clear:function(a){for(H.purge(a);a.firstChild;)a.firstChild.firstChild&&H.clear(a.firstChild),a.removeChild(a.firstChild)},purge:function(a){var c=a.attributes,d,f;if(c)for(d=c.length;d--;)f=c[d].name,"function"===typeof a[f]&&(a[f]=null);if(c=a.childNodes)for(d=c.length;d--;)H.purge(a.childNodes[d])},clamp:function(a,c,d){return a<c?c:a>d?d:a},ColorLuma:function(a,c){a=String(a).replace(/[^0-9a-f]/gi,"");6>a.length&&(a=a[0]+a[0]+
  a[1]+a[1]+a[2]+a[2]);c=c||0;var d="#",f,l;for(l=0;3>l;l++)f=parseInt(a.substr(2*l,2),16),f=Math.round(Math.min(Math.max(0,f+f*c),255)).toString(16),d+=("00"+f).substr(f.length);return d},findDeepInver:function(a){return 0.6>=0.3*a[0]+0.59*a[1]+0.11*a[2]},hexToHtml:function(a){return"#"+("000000"+(void 0===a?0:a).toString(16)).substr(-6)},htmlToHex:function(a){return a.toUpperCase().replace("#","0x")},u255:function(a,c){return parseInt(a.substring(c,c+2),16)/255},u16:function(a,c){return parseInt(a.substring(c,
  c+1),16)/15},unpack:function(a){if(7==a.length)return[H.u255(a,1),H.u255(a,3),H.u255(a,5)];if(4==a.length)return[H.u16(a,1),H.u16(a,2),H.u16(a,3)]},htmlRgb:function(a){return"rgb("+Math.round(255*a[0])+","+Math.round(255*a[1])+","+Math.round(255*a[2])+")"},rgbToHex:function(a){return"#"+("000000"+(255*a[0]<<16^255*a[1]<<8^255*a[2]<<0).toString(16)).slice(-6)},hueToRgb:function(a,c,d){0>d&&(d+=1);1<d&&(d-=1);return d<1/6?a+6*(c-a)*d:0.5>d?c:d<2/3?a+6*(c-a)*(2/3-d):a},rgbToHsl:function(a){var c=a[0],
  d=a[1];a=a[2];var f=Math.min(c,d,a),l=Math.max(c,d,a),m=l-f,q=0,r=0,f=(f+l)/2;0<f&&1>f&&(r=m/(0.5>f?2*f:2-2*f));0<m&&(l==c&&l!=d&&(q+=(d-a)/m),l==d&&l!=a&&(q+=2+(a-c)/m),l==a&&l!=c&&(q+=4+(c-d)/m),q/=6);return[q,r,f]},hslToRgb:function(a){var c,d=a[0];c=a[1];a=a[2];if(0===c)return[a,a,a];c=0.5>=a?a*(c+1):a+c-a*c;a=2*a-c;return[H.hueToRgb(a,c,d+0.33333),H.hueToRgb(a,c,d),H.hueToRgb(a,c,d-0.33333)]},makeGradiant:function(a,c,d,f){H.dom(a,null,c,d,0);a=d.childNodes[0].childNodes.length-1;for(var l=0;l<
  f.length;l++)c=f[l],H.dom("stop",null,{offset:c[0]+"%",style:"stop-color:"+c[1]+"; stop-opacity:"+c[2]+";"},d,[0,a])},makeKnob:function(a){a=H.dom("svg",H.css.basic,{viewBox:"0 0 128 128",width:128,height:128,preserveAspectRatio:"none"});H.dom("circle","",{cx:64,cy:64,r:34,fill:H.colors.button,stroke:"rgba(0,0,0,0.3)","stroke-width":8},a);H.dom("path","",{d:"",stroke:H.colors.text,"stroke-width":4,fill:"none","stroke-linecap":"round"},a);H.dom("circle","",{cx:64,cy:64,r:41,stroke:"rgba(0,0,0,0.1)",
  "stroke-width":7,fill:"none"},a);H.dom("path","",{d:"",stroke:"rgba(255,255,255,0.3)","stroke-width":2,fill:"none","stroke-linecap":"round","stroke-opacity":0.5},a);H.knob=a},makeCircular:function(a){a=H.dom("svg",H.css.basic,{viewBox:"0 0 128 128",width:128,height:128,preserveAspectRatio:"none"});H.dom("circle","",{cx:64,cy:64,r:40,stroke:"rgba(0,0,0,0.1)","stroke-width":10,fill:"none"},a);H.dom("path","",{d:"",stroke:H.colors.text,"stroke-width":7,fill:"none","stroke-linecap":"butt"},a);H.circular=
  a},makeJoystick:function(a){var c=Math.floor(49),d=Math.floor(0.6*c),f=H.dom("svg",H.css.basic,{viewBox:"0 0 128 128",width:128,height:128,preserveAspectRatio:"none"});H.dom("defs",null,{},f);H.dom("g",null,{},f);if(0===a){var l=[[40,"rgb(0,0,0)",0.3],[80,"rgb(0,0,0)",0],[90,"rgb(50,50,50)",0.4],[100,"rgb(50,50,50)",0]];H.makeGradiant("radialGradient",{id:"grad",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},f,l);l=[[60,"rgb(0,0,0)",0.5],[100,"rgb(0,0,0)",0]];H.makeGradiant("radialGradient",{id:"gradS",
  cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},f,l);l=["rgb(40,40,40)","rgb(48,48,48)","rgb(30,30,30)"];a=["rgb(1,90,197)","rgb(3,95,207)","rgb(0,65,167)"];l=[[30,l[0],1],[60,l[1],1],[80,l[1],1],[100,l[2],1]];H.makeGradiant("radialGradient",{id:"gradIn",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},f,l);l=[[30,a[0],1],[60,a[1],1],[80,a[1],1],[100,a[2],1]];H.makeGradiant("radialGradient",{id:"gradIn2",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},f,l);H.dom("circle","",{cx:64,cy:64,r:c,fill:"url(#grad)"},
  f);H.dom("circle","",{cx:69,cy:74,r:d+10,fill:"url(#gradS)"},f);H.dom("circle","",{cx:64,cy:64,r:d,fill:"url(#gradIn)"},f);H.joystick_0=f}else l=[[69,"rgb(0,0,0)",0],[70,"rgb(0,0,0)",0.3],[100,"rgb(0,0,0)",0]],H.makeGradiant("radialGradient",{id:"gradX",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},f,l),H.dom("circle","",{cx:64,cy:64,r:c,fill:"none",stroke:"rgba(100,100,100,0.25)","stroke-width":"4"},f),H.dom("circle","",{cx:64,cy:64,r:d+14,fill:"url(#gradX)"},f),H.dom("circle","",{cx:64,cy:64,r:d,
  fill:"none",stroke:"rgb(100,100,100)","stroke-width":"4"},f),H.joystick_1=f},makeColorRing:function(){var a=H.dom("svg",H.css.basic,{viewBox:"0 0 256 256",width:256,height:256,preserveAspectRatio:"none"});H.dom("defs",null,{},a);H.dom("g",null,{},a);var c=8/108/24*Math.PI,d=0,f,l,m,q,r,t=[];for(r=0;24>=r;++r){m=r/24;q=m*H.TwoPI;f=0.5*(d+q);l=1/Math.cos(0.5*(q-d));d=[Math.sin(d),-Math.cos(d),Math.sin(f)*l,-Math.cos(f)*l,Math.sin(q),-Math.cos(q)];t[1]=H.rgbToHex(H.hslToRgb([m,1,0.5]));if(0<r){for(m=
  6;m--;)d[m]=(108*d[m]+128).toFixed(2);m=" M"+d[0]+" "+d[1]+" Q"+d[2]+" "+d[3]+" "+d[4]+" "+d[5];f=[[0,t[0],1],[100,t[1],1]];H.makeGradiant("linearGradient",{id:"G"+r,x1:d[0],y1:d[1],x2:d[4],y2:d[5],gradientUnits:"userSpaceOnUse"},a,f);H.dom("path","",{d:m,"stroke-width":40,stroke:"url(#G"+r+")","stroke-linecap":"butt"},a,1)}d=q-c;t[0]=t[1]}f=[[0,"#FFFFFF",1],[50,"#FFFFFF",0],[50,"#000000",0],[100,"#000000",1]];H.makeGradiant("linearGradient",{id:"GL1",x1:68,y1:68,x2:68,y2:188,gradientUnits:"userSpaceOnUse"},
  a,f);f=[[0,"#7f7f7f",0],[50,"#7f7f7f",0.5],[100,"#7f7f7f",1]];H.makeGradiant("linearGradient",{id:"GL2",x1:68,y1:68,x2:188,y2:68,gradientUnits:"userSpaceOnUse"},a,f);H.dom("circle","",{cx:128,cy:128,r:90,fill:"red"},a);H.dom("circle","",{cx:128,cy:128,r:90,fill:"url(#GL2)"},a);H.dom("circle","",{cx:128,cy:128,r:90,fill:"url(#GL1)"},a);H.dom("circle","",{cx:0,cy:0,r:6,"stroke-width":3,stroke:"#FFF",fill:"none"},a);H.dom("circle","",{cx:0,cy:0,r:6,"stroke-width":3,stroke:"#000",fill:"none"},a);H.colorRing=
  a},icon:function(a,c,d){d=d||40;c=c||"#DEDEDE";d=["<svg xmlns='"+H.svgns+"' version='1.1' xmlns:xlink='"+H.htmls+"' style='pointer-events:none;' preserveAspectRatio='xMinYMax meet' x='0px' y='0px' width='"+d+"px' height='"+d+"px' viewBox='0 0 256 256'><g>"];switch(a){case "logo":d[1]="<path id='logoin' stroke='"+c+"' stroke-width='16' stroke-linejoin='round' stroke-linecap='square' fill='none' d='M 192 44 L 192 148 Q 192 174.5 173.3 193.25 154.55 212 128 212 101.5 212 82.75 193.25 64 174.5 64 148 L 64 44 M 160 44 L 160 148 Q 160 161.25 150.65 170.65 141.25 180 128 180 114.75 180 105.35 170.65 96 161.25 96 148 L 96 44'/>";
  break;case "save":d[1]="<path stroke='"+c+"' stroke-width='4' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 26.125 17 L 20 22.95 14.05 17 M 20 9.95 L 20 22.95'/><path stroke='"+c+"' stroke-width='2.5' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 32.6 23 L 32.6 25.5 Q 32.6 28.5 29.6 28.5 L 10.6 28.5 Q 7.6 28.5 7.6 25.5 L 7.6 23'/>"}d[2]="</g></svg>";return d.join("\n")}};H.setText();var J=H,y={ui:[],ID:null,lock:!1,wlock:!1,current:-1,needReZone:!0,isEventsInit:!1,
  prevDefault:["contextmenu","mousedown","mousemove","mouseup"],xmlserializer:new XMLSerializer,tmpTime:null,tmpImage:null,oldCursor:"auto",input:null,firstImput:!0,callbackImput:null,isLoop:!1,listens:[],e:{type:null,clientX:0,clientY:0,keyCode:NaN,key:null,delta:0},isMobile:!1,add:function(a){y.ui.push(a);y.getZone(a);y.isEventsInit||y.initEvents()},testMobile:function(){var a=navigator.userAgent;return a.match(/Android/i)||a.match(/webOS/i)||a.match(/iPhone/i)||a.match(/iPad/i)||a.match(/iPod/i)||
  a.match(/BlackBerry/i)||a.match(/Windows Phone/i)?!0:!1},remove:function(a){var c=y.ui.indexOf(a);-1!==c&&(y.removeListen(a),y.ui.splice(c,1));0===y.ui.length&&y.removeEvents()},initEvents:function(){if(!y.isEventsInit){var a=document.body;y.isMobile=y.testMobile();y.isMobile?(a.addEventListener("touchstart",y,!1),a.addEventListener("touchend",y,!1),a.addEventListener("touchmove",y,!1)):(a.addEventListener("mousedown",y,!1),a.addEventListener("contextmenu",y,!1),a.addEventListener("wheel",y,!1),document.addEventListener("mousemove",
  y,!1),document.addEventListener("mouseup",y,!1));window.addEventListener("keydown",y,!1);window.addEventListener("resize",y.resize,!1);y.isEventsInit=!0}},removeEvents:function(){if(y.isEventsInit){var a=document.body;y.isMobile?(a.removeEventListener("touchstart",y,!1),a.removeEventListener("touchend",y,!1),a.removeEventListener("touchmove",y,!1)):(a.removeEventListener("mousedown",y,!1),a.removeEventListener("contextmenu",y,!1),a.removeEventListener("wheel",y,!1),document.removeEventListener("mousemove",
  y,!1),document.removeEventListener("mouseup",y,!1));window.removeEventListener("keydown",y);window.removeEventListener("resize",y.resize);y.isEventsInit=!1}},resize:function(){y.needReZone=!0;for(var a=y.ui.length,c;a--;)c=y.ui[a],c.isGui&&!c.isCanvasOnly&&c.autoResize&&c.setHeight()},handleEvent:function(a){-1!==a.type.indexOf(y.prevDefault)&&a.preventDefault();if("contextmenu"!==a.type){y.findZone();var c=y.e;"keydown"===a.type&&y.editText(a);c.delta="wheel"===a.type?0<a.deltaY?1:-1:0;c.clientX=
  a.clientX||0;c.clientY=a.clientY||0;c.type=a.type;y.isMobile&&(a.touches&&0<a.touches.length&&(c.clientX=a.touches[0].clientX||0,c.clientY=a.touches[0].clientY||0),"touchstart"===a.type&&(c.type="mousedown"),"touchend"===a.type&&(c.type="mouseup"),"touchmove"===a.type&&(c.type="mousemove"));"mousedown"===c.type&&(y.lock=!0);"mouseup"===c.type&&(y.lock=!1);y.isMobile&&"mousedown"===c.type&&y.findID(c);"mousemove"!==c.type||y.lock||y.findID(c);null!==y.ID&&(y.ID.isCanvasOnly&&(c.clientX=y.ID.mouse.x,
  c.clientY=y.ID.mouse.y),y.ID.handleEvent(c));y.isMobile&&"mouseup"===c.type&&y.clearOldID()}},findID:function(a){for(var c=y.ui.length,d=-1,f,l,m;c--;)if(f=y.ui[c],f.isCanvasOnly?(l=f.mouse.x,m=f.mouse.y):(l=a.clientX,m=a.clientY),y.onZone(f,l,m)){d=c;d!==y.current&&(y.clearOldID(),y.current=d,y.ID=f);break}-1===d&&y.clearOldID()},clearOldID:function(){y.ID&&(y.current=-1,y.ID.reset(),y.ID=null,y.cursor())},calcUis:function(a,c,d){var f=a.length,l,m,q=0,r=0;for(m=0;m<f;m++)l=a[m],l.zone.w=l.w,l.zone.h=
  l.h,l.autoWidth?(l.zone.x=c.x,l.zone.y=d,d+=l.h+1):(0===q&&(d+=l.h+1),l.zone.x=c.x+q,l.zone.y=0===q?d-l.h:r,r=l.zone.y,q+=l.w,q+l.w>c.w&&(q=0)),l.isGroup&&l.calcUis()},findTarget:function(a,c){for(var d=a.length;d--;)if(y.onZone(a[d],c.clientX,c.clientY))return d;return-1},findZone:function(a){if(y.needReZone||a){a=y.ui.length;for(var c;a--;)c=y.ui[a],y.getZone(c),c.isGui&&c.calcUis();y.needReZone=!1}},onZone:function(a,c,d){if(void 0===c||void 0===d)return!1;var f=a.zone;c-=f.x;d-=f.y;(f=0<=c&&0<=
  d&&c<=f.w&&d<=f.h)?a.local.set(c,d):a.local.neg();return f},getZone:function(a){if(!a.isCanvasOnly){var c=a.getDom().getBoundingClientRect();a.zone={x:c.left,y:c.top,w:c.width,h:c.height}}},cursor:function(a){a=a?a:"auto";a!==y.oldCursor&&(document.body.style.cursor=a,y.oldCursor=a)},toCanvas:function(a,c,d,f){f&&null!==y.tmpTime&&(clearTimeout(y.tmpTime),y.tmpTime=null);if(null===y.tmpTime){y.lock&&(y.tmpTime=setTimeout(function(){y.tmpTime=null},10));var l=!1;if(c!==a.canvas.width||d!==a.canvas.height)l=
  !0;null===y.tmpImage&&(y.tmpImage=new Image);f=y.tmpImage;var m=y.xmlserializer.serializeToString(a.content);f.onload=function(){var f=a.canvas.getContext("2d");l?(a.canvas.width=c,a.canvas.height=d):f.clearRect(0,0,c,d);f.drawImage(this,0,0);a.onDraw()};f.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="'+c+'" height="'+d+'"><foreignObject style="pointer-events: none; left:0;" width="100%" height="100%">'+m+"</foreignObject></svg>");f.crossOrigin=
  ""}},clearInput:function(){null!==y.input&&(y.firstImput||y.callbackImput(),y.input.style.background="none",y.callbackImput=null,y.input=null,y.firstImput=!0)},setInput:function(a,c,d){y.clearInput();y.callbackImput=c;y.input=a;y.input.style.background=d},select:function(){document.execCommand("selectall",null,!1)},editText:function(a){if(null!==y.input)if(13===a.keyCode)y.callbackImput(),y.clearInput();else if(y.input.isNum){if(95<a.keyCode&&106>a.keyCode||110===a.keyCode||109===a.keyCode)y.firstImput?
  (y.input.textContent=a.key,y.firstImput=!1):y.input.textContent+=a.key}else y.firstImput?(y.input.textContent=a.key,y.firstImput=!1):y.input.textContent+=a.key},loop:function(){y.isLoop&&requestAnimationFrame(y.loop);y.update()},update:function(){for(var a=y.listens.length;a--;)y.listens[a].listening()},removeListen:function(a){a=y.listens.indexOf(a);-1!==a&&y.listens.splice(a,1);0===y.listens.length&&(y.isLoop=!1)},addListen:function(a){-1===y.listens.indexOf(a)&&(y.listens.push(a),y.isLoop||(y.isLoop=
  !0,y.loop()))}},D=y;Object.assign(c.prototype,{set:function(a,c){this.x=a;this.y=c;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},addScalar:function(a){this.x+=
  a;this.y+=a;return this},negate:function(){this.x*=-1;this.y*=-1;return this},neg:function(){this.y=this.x=-1;return this},isZero:function(){return 0===this.x&&0===this.y},copy:function(a){this.x=a.x;this.y=a.y;return this},equals:function(a){return a.x===this.x&&a.y===this.y},nearEquals:function(a,c){return a.x.toFixed(c)===this.x.toFixed(c)&&a.y.toFixed(c)===this.y.toFixed(c)},lerp:function(a,c){null===a?(this.x-=this.x*c,this.y-=this.y*c):(this.x+=(a.x-this.x)*c,this.y+=(a.y-this.y)*c);return this}});
  Object.assign(d.prototype,{constructor:d,init:function(){var a=this.s,c=this.c;a[0].height=this.h+"px";this.zone.h=this.h;this.isUI&&(a[0].background=this.bg);void 0!==c[1]&&this.autoWidth&&(a[1]=c[1].style,a[1].height=this.h-4+"px",a[1].lineHeight=this.h-8+"px");for(var d=J.frag,f=1,l=c.length;f!==l;f++)void 0!==c[f]&&(d.appendChild(c[f]),a[f]=c[f].style);null!==this.target?this.target.appendChild(c[0]):this.isUI?this.main.inner.appendChild(c[0]):document.body.appendChild(c[0]);c[0].appendChild(d);
  this.rSize();this.isUI||(this.c[0].style.pointerEvents="auto",D.add(this))},dom:function(a,c,d,f,l){return J.dom(a,c,d,f,l)},setSvg:function(a,c,d,f){J.setSvg(a,c,d,f)},setCss:function(a,c){J.setCss(a,c)},clamp:function(a,c,d){return J.clamp(a,c,d)},getColorRing:function(){J.colorRing||J.makeColorRing();return J.clone(J.colorRing)},getJoystick:function(a){J["joystick_"+a]||J.makeJoystick(a);return J.clone(J["joystick_"+a])},getCircular:function(a){J.circular||J.makeCircular(a);return J.clone(J.circular)},
  getKnob:function(a){J.knob||J.makeKnob(a);return J.clone(J.knob)},cursor:function(a){D.cursor(a)},setInput:function(a,c){D.setInput(a,c,J.colors.input)},update:function(){},reset:function(){},getDom:function(){return this.c[0]},uiout:function(){this.s[0].background=this.bg},uiover:function(){this.s[0].background=this.bgOver},rename:function(a){void 0!==this.c[1]&&(this.c[1].textContent=a)},listen:function(){D.addListen(this);return this},listening:function(){null!==this.objectLink&&(this.isSend||
  this.isEdit||this.setValue(this.objectLink[this.val]))},setValue:function(a){this.value=this.isNumber?this.numValue(a):a;this.update()},onChange:function(a){this.callback=a;return this},onFinishChange:function(a){this.callback=null;this.endCallback=a;return this},send:function(a){this.isSend=!0;null!==this.objectLink&&(this.objectLink[this.val]=a||this.value);this.callback&&this.callback(a||this.value);this.isSend=!1},sendEnd:function(a){this.endCallback&&this.endCallback(a||this.value);null!==this.objectLink&&
  (this.objectLink[this.val]=a||this.value)},clear:function(){J.clear(this.c[0]);null!==this.target?this.target.removeChild(this.c[0]):this.isUI?this.main.clearOne(this):document.body.removeChild(this.c[0]);this.isUI||D.remove(this);this.target=this.callback=this.s=this.c=null},setSize:function(a){this.autoWidth&&(this.w=a,this.simple?this.sb=this.w-this.sa:(a=this.p/100*this.w,this.sa=Math.floor(a+10),this.sb=Math.floor(this.w-a-20)))},rSize:function(){this.autoWidth&&(this.s[0].width=this.w+"px",
  this.simple||(this.s[1].width=this.sa+"px"))},setTypeNumber:function(a){this.isNumber=!0;this.value=0;void 0!==a.value&&(this.value="string"===typeof a.value?1*a.value:a.value);this.min=void 0===a.min?-Infinity:a.min;this.max=void 0===a.max?Infinity:a.max;this.precision=void 0===a.precision?2:a.precision;var c;switch(this.precision){case 0:c=1;break;case 1:c=0.1;break;case 2:c=0.01;break;case 3:c=0.001;break;case 4:c=1E-4}this.step=void 0===a.step?c:a.step;this.range=this.max-this.min;this.value=
  this.numValue(this.value)},numValue:function(a){return 1*Math.min(this.max,Math.max(this.min,a)).toFixed(this.precision)},handleEvent:function(a){return this[a.type](a)},wheel:function(a){return!1},mousedown:function(a){return!1},mousemove:function(a){return!1},mouseup:function(a){return!1},keydown:function(a){return!1},setReferency:function(a,c){this.objectLink=a;this.val=c},display:function(a){this.s[0].display=a?"block":"none"},open:function(){this.isOpen||(this.isOpen=!0)},close:function(){this.isOpen&&
  (this.isOpen=!1)},needZone:function(){D.needReZone=!0}});f.prototype=Object.assign(Object.create(d.prototype),{constructor:f,mousemove:function(a){this.cursor("pointer")},mousedown:function(a){this.value=this.value?!1:!0;this.update();this.send();return!0},update:function(){var a=this.s;this.value?(a[2].background=this.fontColor,a[2].borderColor=this.fontColor,a[3].marginLeft="17px"):(a[2].background=this.colors.boolbg,a[2].borderColor=this.colors.boolbg,a[3].marginLeft="2px")},rSize:function(){d.prototype.rSize.call(this);
  var a=this.s;a[2].left=this.sa+"px";a[3].left=this.sa+1+"px"}});l.prototype=Object.assign(Object.create(d.prototype),{constructor:l,testZone:function(a){a=this.local;if(-1===a.x&&-1===a.y)return"";for(var c=this.lng,d=this.tmp;c--;)if(a.x>d[c][0]&&a.x<d[c][2])return c+2;return""},mouseup:function(a){return this.isDown?(this.isDown=this.value=!1,this.mousemove(a)):!1},mousedown:function(a){var c=this.testZone(a);if(!c)return!1;this.isDown=!0;this.value=this.values[c-2];this.isLoadButton||this.send();
  return this.mousemove(a)},mousemove:function(a){var c=!1;a=this.testZone(a);""!==a?(this.cursor("pointer"),c=this.modes(this.isDown?3:2,a)):c=this.reset();return c},modes:function(a,c){for(var d,f=!1,l=0;l<this.lng;l++)(d=l===c-2?this.mode(a,l+2):this.mode(1,l+2))&&(f=!0);return f},mode:function(a,c){var d=!1,f=c-2;if(this.stat[f]!==a){switch(a){case 1:this.stat[f]=1;this.s[f+2].color=this.fontColor;this.s[f+2].background=this.buttonColor;break;case 2:this.stat[f]=2;this.s[f+2].color="#FFF";this.s[f+
  2].background=this.colors.select;break;case 3:this.stat[f]=3,this.s[f+2].color="#FFF",this.s[f+2].background=this.colors.down}d=!0}return d},reset:function(){this.cursor();return this.modes(1,2)},dragover:function(a){a.preventDefault();this.s[4].borderColor=this.colors.select;this.s[4].color=this.colors.select},dragend:function(a){a.preventDefault();this.s[4].borderColor=this.fontColor;this.s[4].color=this.fontColor},drop:function(a){a.preventDefault();this.dragend(a);this.fileSelect(a.dataTransfer.files[0])},
  initDrager:function(){this.c[4]=this.dom("div",this.css.txt+" text-align:center; line-height:"+(this.h-8)+"px; border:1px dashed "+this.fontColor+"; top:2px;  height:"+(this.h-4)+"px; border-radius:"+this.r+"px; pointer-events:auto;");this.c[4].textContent="DRAG";this.c[4].addEventListener("dragover",function(a){this.dragover(a)}.bind(this),!1);this.c[4].addEventListener("dragend",function(a){this.dragend(a)}.bind(this),!1);this.c[4].addEventListener("dragleave",function(a){this.dragend(a)}.bind(this),
  !1);this.c[4].addEventListener("drop",function(a){this.drop(a)}.bind(this),!1)},initLoader:function(){this.c[3]=this.dom("input",this.css.basic+"top:0px; opacity:0; height:"+this.h+"px;pointer-events:auto;");this.c[3].name="loader";this.c[3].type="file";this.c[3].addEventListener("change",function(a){this.fileSelect(a.target.files[0])}.bind(this),!1)},fileSelect:function(a){var c=["png","jpg","mp4","webm","ogg"],d=["sea","z","hex","bvh","BVH"];if(void 0!==a){var f=new FileReader,l=a.name,m=l.substring(l.lastIndexOf(".")+
  1,l.length);-1!==c.indexOf(m)?f.readAsDataURL(a):-1!==d.indexOf(m)?f.readAsArrayBuffer(a):f.readAsText(a);f.onload=function(a){this.callback&&this.callback(a.target.result,l,m)}.bind(this)}},label:function(a,c){this.c[c||2].textContent=a},icon:function(a,c,d){d=d||2;this.s[d].padding=(c||0)+"px 0px";this.c[d].innerHTML=a},rSize:function(){d.prototype.rSize.call(this);for(var a=this.s,c=this.sa,f=this.lng,l=Math.floor((this.sb-3*(f-1))/f);f--;)this.tmp[f]=[Math.floor(c+l*f+3*f),l],this.tmp[f][2]=this.tmp[f][0]+
  this.tmp[f][1],a[f+2].left=this.tmp[f][0]+"px",a[f+2].width=this.tmp[f][1]+"px";this.isDragButton&&(a[4].left=c+l+3+"px",a[4].width=l+"px");this.isLoadButton&&(a[3].left=c+"px",a[3].width=l+"px")}});m.prototype=Object.assign(Object.create(d.prototype),{constructor:m,mode:function(a){if(this.cmode===a)return!1;switch(a){case 0:this.s[2].color=this.fontColor;this.setSvg(this.c[3],"stroke","rgba(0,0,0,0.1)",0);this.setSvg(this.c[3],"stroke",this.fontColor,1);break;case 1:this.s[2].color=this.colorPlus,
  this.setSvg(this.c[3],"stroke","rgba(0,0,0,0.3)",0),this.setSvg(this.c[3],"stroke",this.colorPlus,1)}this.cmode=a;return!0},reset:function(){this.isDown=!1},mouseup:function(a){this.isDown=!1;this.sendEnd();return this.mode(0)},mousedown:function(a){this.isDown=!0;this.old=this.value;this.oldr=null;this.mousemove(a);return this.mode(1)},mousemove:function(a){if(this.isDown){var c=this.offset;c.x=this.radius-(a.clientX-this.zone.x);c.y=this.radius-(a.clientY-this.zone.y-this.top);this.r=c.angle()-
  this.pi90;this.r=(this.r%this.twoPi+this.twoPi)%this.twoPi;null!==this.oldr&&(a=this.r-this.oldr,this.r=Math.abs(a)>Math.PI?this.oldr:this.r,6<a&&(this.r=0),-6>a&&(this.r=this.twoPi));a=1/this.twoPi*this.range*this.r+this.min-this.old;if(a>=this.step||a<=this.step)a=~~(a/this.step),this.value=this.numValue(this.old+a*this.step),this.update(!0),this.old=this.value,this.oldr=this.r}},makePath:function(){var a=this.percent*this.twoPi-0.001,c=40*Math.sin(a)+64,d=40-40*Math.cos(a)+24;return"M 64,24 A 40,40 0 "+
  (a>Math.PI?1:0)+" 1 "+c+","+d},update:function(a){this.c[2].textContent=this.value;this.percent=(this.value-this.min)/this.range;this.setSvg(this.c[3],"d",this.makePath(),1);a&&this.send()}});r.prototype=Object.assign(Object.create(d.prototype),{constructor:r,testZone:function(a,c){var d=this.local;if(-1===d.x&&-1===d.y)return"";if(this.up&&this.isOpen)return d.y>this.wfixe?"title":"color";if(d.y<this.baseH+2)return"title";if(this.isOpen)return"color"},mouseup:function(a){this.isDown=!1},mousedown:function(a){var c=
  this.testZone(a.clientX,a.clientY);if("title"===c)return this.isOpen?this.close():this.open(),!0;"color"===c&&(this.isDown=!0,this.mousemove(a))},mousemove:function(a){var c=this.testZone(a.clientX,a.clientY);"title"===c&&this.cursor("pointer");"color"===c&&(this.cursor("crosshair"),this.isDown&&(c=this.offset,c.x=a.clientX-(this.zone.x+this.decal.x+this.mid),c.y=a.clientY-(this.zone.y+this.decal.y+this.mid),a=c.length()*this.ratio,128>a&&(88<a?(c=(c.angle()+this.pi90)/6.28,this.setHSL([(c+1)%1,this.hsl[1],
  this.hsl[2]])):(a=Math.max(0,Math.min(1,0.5-c.x*this.square*0.5)),c=Math.max(0,Math.min(1,0.5-c.y*this.square*0.5)),this.setHSL([this.hsl[0],a,c])))))},setHeight:function(){this.h=this.isOpen?this.wfixe+this.baseH+5:this.baseH;this.s[0].height=this.h+"px";this.zone.h=this.h},parentHeight:function(a){null!==this.parentGroup?this.parentGroup.calc(a):this.isUI&&this.main.calc(a)},open:function(){d.prototype.open.call(this);this.setHeight();this.up&&(this.zone.y-=this.wfixe+5);var a=this.h-this.baseH;
  this.s[3].visibility="visible";this.parentHeight(a)},close:function(){d.prototype.close.call(this);this.up&&(this.zone.y+=this.wfixe+5);var a=this.h-this.baseH;this.setHeight();this.s[3].visibility="hidden";this.parentHeight(-a)},update:function(a){var c=J.rgbToHex(J.hslToRgb([this.hsl[0],1,0.5]));this.moveMarkers();this.value=this.bcolor;this.setSvg(this.c[3],"fill",c,2);this.s[2].background=this.bcolor;this.c[2].textContent=J.htmlToHex(this.bcolor);this.invert=J.findDeepInver(this.rgb);this.s[2].color=
  this.invert?"#fff":"#000";a&&("array"===this.ctype&&this.send(this.rgb),"rgb"===this.ctype&&this.send(J.htmlRgb(this.rgb)),"hex"===this.ctype&&this.send(J.htmlToHex(this.value)),"html"===this.ctype&&this.send())},setColor:function(a){var c=J.unpack(a);this.bcolor!=a&&c&&(this.bcolor=a,this.rgb=c,this.hsl=J.rgbToHsl(this.rgb),this.update());return this},setHSL:function(a){this.hsl=a;this.rgb=J.hslToRgb(a);this.bcolor=J.rgbToHex(this.rgb);this.update(!0);return this},moveMarkers:function(){var a=this.invert?
  "#fff":"#000",d=6.28*this.hsl[0],d=(new c(108*Math.sin(d),108*-Math.cos(d))).addScalar(128);this.setSvg(this.c[3],"cx",d.x,5);this.setSvg(this.c[3],"cy",d.y,5);d.set(120*(0.5-this.hsl[1]),120*(0.5-this.hsl[2])).addScalar(128);this.setSvg(this.c[3],"cx",d.x,6);this.setSvg(this.c[3],"cy",d.y,6);this.setSvg(this.c[3],"stroke",a,6)},rSize:function(){d.prototype.rSize.call(this);var a=this.s;a[2].width=this.sb+"px";a[2].left=this.sa+"px";this.decal.x=Math.floor(0.5*(this.w-this.wfixe));this.decal.y="up"===
  this.side?2:this.baseH+2;this.mid=Math.floor(0.5*this.wfixe);this.setSvg(this.c[3],"viewBox","0 0 "+this.wfixe+" "+this.wfixe);a[3].width=this.wfixe+"px";a[3].height=this.wfixe+"px";a[3].left=this.decal.x+"px";a[3].top=this.decal.y+"px";this.ratio=256/this.wfixe;this.square=1/(this.wfixe/256*60);this.setHeight()}});q.prototype=Object.assign(Object.create(d.prototype),{constructor:q,mousedown:function(a){this.isShow?this.hide():this.show()},mode:function(a){var c=this.s;switch(a){case 0:c[1].color=
  this.fontColor;break;case 1:c[1].color="#FFF";break;case 2:c[1].color=this.fontColor}},makePath:function(a){var c;c="M -1 50";for(var d=0;d<this.res+1;d++)c+=" L "+d+" "+a[d];return c+=" L "+(this.res+1)+" 50"},drawGraph:function(){var a=this.c[2];this.pa1.shift();this.pa1.push(8.5+this.round(30*(1-this.fps/100)));this.setSvg(a,"d",this.makePath(this.pa1),0);this.pa2.shift();this.pa2.push(8.5+this.round(30*(1-this.ms/200)));this.setSvg(a,"d",this.makePath(this.pa2),1);this.isMem&&(this.pa3.shift(),
  this.pa3.push(8.5+this.round(30*(1-this.mm))),this.setSvg(a,"d",this.makePath(this.pa3),2))},show:function(){this.h=this.hplus+this.baseH;this.setSvg(this.c[4],"d","M 5 8 L 8 3 2 3 5 8 Z");null!==this.parentGroup?this.parentGroup.calc(this.hplus):this.isUI&&this.main.calc(this.hplus);this.s[0].height=this.h+"px";this.s[2].display="block";this.isShow=!0;D.addListen(this)},hide:function(){this.h=this.baseH;this.setSvg(this.c[4],"d","M 3 8 L 8 5 3 2 3 8 Z");null!==this.parentGroup?this.parentGroup.calc(-this.hplus):
  this.isUI&&this.main.calc(-this.hplus);this.s[0].height=this.h+"px";this.s[2].display="none";this.isShow=!1;D.removeListen(this);this.c[1].textContent="FPS"},begin:function(){this.startTime=this.now()},end:function(){var a=this.now();this.ms=a-this.startTime;this.frames++;if(a>this.prevTime+1E3&&(this.fps=this.round(1E3*this.frames/(a-this.prevTime)),this.prevTime=a,this.frames=0,this.isMem)){var c=performance.memory.usedJSHeapSize,d=performance.memory.jsHeapSizeLimit;this.mem=this.round(9.54E-7*
  c);this.mm=c/d}this.drawGraph();this.c[1].innerHTML="FPS "+this.fps+'<font color="yellow"> MS '+(this.ms|0)+'</font><font color="cyan"> MB '+this.mem+"</font>";return a},listening:function(){this.startTime=this.end()},rSize:function(){this.s[0].width=this.w+"px";this.s[1].width=this.w+"px";this.s[2].left="10px";this.s[2].width=this.w-20+"px"}});t.prototype=Object.assign(Object.create(d.prototype),{constructor:t,testZone:function(a){a=this.local;if(-1===a.x&&-1===a.y)return"";var c=this.lng,d=this.tmp;
  if(a.y>this.top&&a.y<this.h-20)for(;c--;)if(a.x>d[c][0]&&a.x<d[c][2])return c;return""},mode:function(a,c){if(a===this.cMode[c])return!1;var d;switch(a){case 0:d=0.3;break;case 1:d=0.6;break;case 2:d=1}this.reset();this.setSvg(this.c[3],"fill-opacity",d,c+2);this.cMode[c]=a;return!0},reset:function(){for(var a=!1,c=this.lng;c--;)0!==this.cMode[c]&&(this.cMode[c]=0,this.setSvg(this.c[3],"fill-opacity",0.3,c+2),a=!0);return a},mouseup:function(a){this.isDown=!1;if(-1!==this.current)return this.reset()},
  mousedown:function(a){this.isDown=!0;return this.mousemove(a)},mousemove:function(a){var c=!1,d=this.testZone(a);""===d?c=this.reset():(c=this.mode(this.isDown?2:1,d),this.isDown&&(this.v[d]=this.clamp(1-(a.clientY-this.zone.y-this.top-10)/this.gh,0,1),this.update(!0)));return c},update:function(a){this.updateSVG();a&&this.send()},makePath:function(){for(var a="",c,d,f,l,m,q,r=0;r<this.lng;r++)c=14+(this.gh-this.v[r]*this.gh),d=14+r*this.iw+4*r,l=d+0.5*this.iw,f=d+this.iw,a=0===r?a+("M "+d+" "+c+
  " T "+l+" "+c):a+(" C "+m+" "+q+","+d+" "+c+","+l+" "+c),r===this.lng-1&&(a+=" T "+f+" "+c),m=f,q=c;return a},updateSVG:function(){this.setSvg(this.c[3],"d",this.makePath(),0);for(var a=0;a<this.lng;a++)this.setSvg(this.c[3],"height",this.v[a]*this.gh,a+2),this.setSvg(this.c[3],"y",14+(this.gh-this.v[a]*this.gh),a+2),this.value[a]=1*(this.v[a]*this.multiplicator).toFixed(this.precision);this.c[2].textContent=this.value},rSize:function(){d.prototype.rSize.call(this);var a=this.s;void 0!==this.c[1]&&
  (a[1].width=this.w+"px");a[2].width=this.w+"px";a[3].width=this.w+"px";for(var a=(this.w-28-4*(this.lng-1))/this.lng,c=[],f=0;f<this.lng;f++)c[f]=[14+f*a+4*f,a],c[f][2]=c[f][0]+c[f][1];this.tmp=c}});x.prototype=Object.assign(Object.create(d.prototype),{constructor:x,isGroup:!0,testZone:function(a){a=this.local;if(-1===a.x&&-1===a.y)return"";var c="";a.y<this.baseH?c="title":this.isOpen&&(c="content");return c},clearTarget:function(){if(-1===this.current)return!1;this.target.uiout();this.target.reset();
  this.current=-1;this.target=null;D.cursor();return!0},reset:function(){this.clearTarget()},handleEvent:function(a){var c=a.type,d=!1,f=!1,l=this.testZone(a);if(l){switch(l){case "content":D.isMobile&&"mousedown"===c&&this.getNext(a,d);this.target&&(f=this.target.handleEvent(a));D.lock||this.getNext(a,d);break;case "title":"mousedown"===c&&(this.isOpen?this.close():this.open())}this.isDown&&(d=!0);f&&(d=!0);return d}},getNext:function(a,c){var d=D.findTarget(this.uis,a);d!==this.current&&(this.clearTarget(),
  this.current=d);-1!==d&&(this.target=this.uis[this.current],this.target.uiover())},calcH:function(){var a=this.uis.length,c,d,f=0,l=0,m=0;for(c=0;c<a;c++)d=this.uis[c],d.autoWidth?f+=d.h+1:(0===l?f+=d.h+1:m<d.h&&(f+=d.h-m),m=d.h,l+=d.w,l+d.w>this.w&&(l=0));return f},calcUis:function(){this.isOpen&&D.calcUis(this.uis,this.zone,this.zone.y+this.baseH)},setBG:function(a){this.s[0].background=a;for(var c=this.uis.length;c--;)this.uis[c].setBG(a)},add:function(){var a=arguments;"object"===typeof a[1]?
  (a[1].isUI=this.isUI,a[1].target=this.c[2],a[1].main=this.main):"string"===typeof arguments[1]&&(void 0===a[2]?[].push.call(a,{isUI:!0,target:this.c[2],main:this.main}):(a[2].isUI=!0,a[2].target=this.c[2],a[2].main=this.main));a=W.apply(this,a);this.uis.push(a);a.autoHeight&&(a.parentGroup=this);return a},parentHeight:function(a){null!==this.parentGroup?this.parentGroup.calc(a):this.isUI&&this.main.calc(a)},open:function(){d.prototype.open.call(this);this.setSvg(this.c[4],"d",this.svgs.arrowDown);
  this.rSizeContent();this.parentHeight(this.h-this.baseH)},close:function(){d.prototype.close.call(this);var a=this.h-this.baseH;this.setSvg(this.c[4],"d",this.svgs.arrow);this.h=this.baseH;this.s[0].height=this.h+"px";this.parentHeight(-a)},clear:function(){this.clearGroup();this.isUI&&this.main.calc(-(this.h+1));d.prototype.clear.call(this)},clearGroup:function(){this.close();for(var a=this.uis.length;a--;)this.uis[a].clear(),this.uis.pop();this.uis=[];this.h=this.baseH},calc:function(a){this.isOpen&&
  (void 0!==a?(this.h+=a,this.isUI&&this.main.calc(a)):this.h=this.calcH()+this.baseH,this.s[0].height=this.h+"px")},rSizeContent:function(){for(var a=this.uis.length;a--;)this.uis[a].setSize(this.w),this.uis[a].rSize();this.calc()},rSize:function(){d.prototype.rSize.call(this);var a=this.s;a[3].left=this.sa+this.sb-17+"px";a[1].width=this.w+"px";a[2].width=this.w+"px";this.isOpen&&this.rSizeContent()}});v.prototype=Object.assign(Object.create(d.prototype),{constructor:v,mode:function(a){switch(a){case 0:0===
  this.model?(this.setSvg(this.c[3],"fill","url(#gradIn)",4),this.setSvg(this.c[3],"stroke","#000",4)):(this.setSvg(this.c[3],"stroke","rgba(100,100,100,0.25)",2),this.setSvg(this.c[3],"stroke","#666",4),this.setSvg(this.c[3],"fill","none",4));break;case 1:0===this.model?(this.setSvg(this.c[3],"fill","url(#gradIn2)",4),this.setSvg(this.c[3],"stroke","rgba(0,0,0,0)",4)):(this.setSvg(this.c[3],"stroke","rgba(48,138,255,0.25)",2),this.setSvg(this.c[3],"stroke",this.colors.select,4),this.setSvg(this.c[3],
  "fill","rgba(48,138,255,0.25)",4))}},addInterval:function(){null!==this.interval&&this.stopInterval();this.pos.isZero()||(this.interval=setInterval(function(){this.update()}.bind(this),10))},stopInterval:function(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)},reset:function(){this.addInterval();this.mode(0)},mouseup:function(a){this.addInterval();this.isDown=!1},mousedown:function(a){this.isDown=!0;this.mousemove(a);this.mode(2)},mousemove:function(a){this.mode(1);this.isDown&&
  (this.tmp.x=this.radius-(a.clientX-this.zone.x),this.tmp.y=this.radius-(a.clientY-this.zone.y-this.top),this.tmp.length()>this.distance&&(a=Math.atan2(this.tmp.x,this.tmp.y),this.tmp.x=Math.sin(a)*this.distance,this.tmp.y=Math.cos(a)*this.distance),this.pos.copy(this.tmp).divideScalar(this.distance).negate(),this.update())},setValue:function(a){void 0===a&&(a=[0,0]);this.pos.set(a[0]||0,a[1]||0);this.updateSVG()},update:function(a){void 0===a&&(a=!0);null===this.interval||this.isDown||(this.pos.lerp(null,
  0.3),this.pos.x=0.01>Math.abs(this.pos.x)?0:this.pos.x,this.pos.y=0.01>Math.abs(this.pos.y)?0:this.pos.y,this.isUI&&this.main.isCanvas&&this.main.draw());this.updateSVG();a&&this.send();this.pos.isZero()&&this.stopInterval()},updateSVG:function(){var a=this.radius- -this.pos.x*this.distance,c=this.radius- -this.pos.y*this.distance;if(0===this.model){var d=c+5*this.pos.y+10;this.setSvg(this.c[3],"cx",(a+5*this.pos.x+5)*this.ratio,3);this.setSvg(this.c[3],"cy",d*this.ratio,3)}else this.setSvg(this.c[3],
  "cx",a*this.ratio,3),this.setSvg(this.c[3],"cy",c*this.ratio,3);this.setSvg(this.c[3],"cx",a*this.ratio,4);this.setSvg(this.c[3],"cy",c*this.ratio,4);this.value[0]=1*(this.pos.x*this.multiplicator).toFixed(this.precision);this.value[1]=1*(this.pos.y*this.multiplicator).toFixed(this.precision);this.c[2].textContent=this.value},clear:function(){this.stopInterval();d.prototype.clear.call(this)}});A.prototype=Object.assign(Object.create(m.prototype),{constructor:A,mode:function(a){if(this.cmode===a)return!1;
  switch(a){case 0:this.s[2].color=this.fontColor;this.setSvg(this.c[3],"fill",this.colors.button,0);this.setSvg(this.c[3],"stroke",this.fontColor,1);break;case 1:this.s[2].color=this.colorPlus,this.setSvg(this.c[3],"fill",this.colors.select,0),this.setSvg(this.c[3],"stroke",this.colorPlus,1)}this.cmode=a;return!0},mousemove:function(a){if(this.isDown){var c=this.offset;c.x=this.radius-(a.clientX-this.zone.x);c.y=this.radius-(a.clientY-this.zone.y-this.top);this.r=-Math.atan2(c.x,c.y);null!==this.oldr&&
  (this.r=Math.abs(this.r-this.oldr)>Math.PI?this.oldr:this.r);this.r=this.r>this.mPI?this.mPI:this.r;this.r=this.r<-this.mPI?-this.mPI:this.r;a=1/this.cirRange*this.range*(this.r+this.mPI)+this.min-this.old;if(a>=this.step||a<=this.step)a=Math.floor(a/this.step),this.value=this.numValue(this.old+a*this.step),this.update(!0),this.old=this.value,this.oldr=this.r}},makeGrad:function(){var a="",c,d,f,l,m,q,r=Math.PI+this.mPI;c=Math.PI-this.mPI;5<this.step?(d=this.range/this.step,c=(r-c)/d):(c=(r-c)/64*
  2,d=32);for(var t=0;t<=d;++t)f=r-c*t,l=64+44*Math.sin(f),m=64+44*Math.cos(f),q=64+40*Math.sin(f),f=64+40*Math.cos(f),a+="M"+l+" "+m+" L"+q+" "+f+" ";return a},update:function(a){this.c[2].textContent=this.value;this.percent=(this.value-this.min)/this.range;var c=this.percent*this.cirRange-this.mPI,d=Math.sin(c),c=Math.cos(c);this.setSvg(this.c[3],"d","M "+(25*d+64)+" "+(-(25*c)+64)+" L "+(20*d+64)+" "+(-(20*c)+64),1);a&&this.send()}});I.prototype=Object.assign(Object.create(d.prototype),{constructor:I,
  testZone:function(a){a=this.local;if(-1===a.x&&-1===a.y)return"";if(this.up&&this.isOpen){if(a.y>this.h-this.baseH)return"title";if(this.scroll&&a.x>this.sa+this.sb-20)return"scroll";if(a.x>this.sa)return this.testItems(a.y-this.baseH)}else{if(a.y<this.baseH+2)return"title";if(this.isOpen){if(this.scroll&&a.x>this.sa+this.sb-20)return"scroll";if(a.x>this.sa)return this.testItems(a.y-this.baseH)}}return""},testItems:function(a){for(var c="",d=this.items.length,f,l,m;d--;)if(f=this.items[d],l=f.posy+
  this.topList,m=f.posy+this.itemHeight+1+this.topList,a>=l&&a<=m){c="item"+d;this.unSelected();this.current=f;this.selected();break}return c},unSelected:function(){this.current&&(this.current.style.background="rgba(0,0,0,0.2)",this.current.style.color=this.fontColor,this.current=null)},selected:function(){this.current.style.background=this.colors.select;this.current.style.color="#FFF"},mouseup:function(a){this.isDown=!1},mousedown:function(a){var c=this.testZone(a);if(!c)return!1;"scroll"===c?(this.isDown=
  !0,this.mousemove(a)):"title"===c?(this.modeTitle(2),this.isOpen?this.close():this.open()):this.current&&(this.value=this.current.textContent,this.c[3].textContent=this.value,this.send(),this.close());return!0},mousemove:function(a){var c=!1,d=this.testZone(a);if(!d)return c;"title"===d?(this.unSelected(),this.modeTitle(1),this.cursor("pointer")):"scroll"===d?(this.cursor("s-resize"),this.modeScroll(1),this.isDown&&(this.modeScroll(2),this.update(a.clientY-(this.zone.y+this.baseH-2)-0.5*this.sh))):
  (this.modeTitle(0),this.modeScroll(0),this.cursor("pointer"));d!==this.prevName&&(c=!0);this.prevName=d;return c},wheel:function(a){if("title"===this.testZone(a))return!1;this.py+=10*a.delta;this.update(this.py);return!0},reset:function(){this.prevName="";this.unSelected();this.modeTitle(0);this.modeScroll(0)},modeScroll:function(a){if(a!==this.sMode){switch(a){case 0:this.scroller.style.background=this.buttonColor;break;case 1:this.scroller.style.background=this.colors.select;break;case 2:this.scroller.style.background=
  this.colors.down}this.sMode=a}},modeTitle:function(a){if(a!==this.tMode){var c=this.s;switch(a){case 0:c[3].color=this.fontColor;c[3].background=this.buttonColor;break;case 1:c[3].color="#FFF";c[3].background=this.colors.select;break;case 2:c[3].color=this.fontColor,c[3].background=this.colors.down}this.tMode=a}},clearList:function(){for(;this.listIn.children.length;)this.listIn.removeChild(this.listIn.lastChild);this.items=[]},setList:function(a,c){this.clearList();this.list=a;this.length=this.list.length;
  this.maxItem=this.full?this.length:5;this.maxItem=this.length<this.maxItem?this.length:this.maxItem;this.maxHeight=this.maxItem*(this.itemHeight+1)+2;this.max=this.length*(this.itemHeight+1)+2;this.ratio=this.maxHeight/this.max;this.sh=this.maxHeight*this.ratio;this.range=this.maxHeight-this.sh;this.c[2].style.height=this.maxHeight+"px";this.scroller.style.height=this.sh+"px";this.max>this.maxHeight&&(this.ww=this.sb-20,this.scroll=!0);for(var d,f,l=0;l<this.length;l++)f=this.list[l],d=this.dom("div",
  this.css.item+"width:"+this.ww+"px; height:"+this.itemHeight+"px; line-height:"+(this.itemHeight-5)+"px; color:"+this.fontColor+";"),d.textContent=f,d.name="item"+l,d.posy=(this.itemHeight+1)*l,this.listIn.appendChild(d),this.items.push(d);void 0!==c?isNaN(c)?this.value=c:this.value=this.list[c]:this.value=this.list[0];this.c[3].textContent=this.value},update:function(a){this.scroll&&(a=0>a?0:a,a=a>this.range?this.range:a,this.topList=-Math.floor(a/this.ratio),this.listIn.style.top=this.topList+"px",
  this.scroller.style.top=Math.floor(a)+"px",this.py=a)},parentHeight:function(a){null!==this.parentGroup?this.parentGroup.calc(a):this.isUI&&this.main.calc(a)},open:function(){d.prototype.open.call(this);this.update(0);this.h=this.maxHeight+this.baseH+5;this.scroll?this.scroller.style.display="block":(this.topList=0,this.h=this.baseH+5+this.max,this.scroller.style.display="none");this.s[0].height=this.h+"px";this.s[2].display="block";this.up?(this.zone.y-=this.h-(this.baseH-10),this.setSvg(this.c[4],
  "d",this.svgs.arrowUp)):this.setSvg(this.c[4],"d",this.svgs.arrowDown);this.rSizeContent();var a=this.h-this.baseH;this.zone.h=this.h;this.parentHeight(a)},close:function(){d.prototype.close.call(this);this.up&&(this.zone.y+=this.h-(this.baseH-10));var a=this.h-this.baseH;this.h=this.baseH;this.s[0].height=this.h+"px";this.s[2].display="none";this.setSvg(this.c[4],"d",this.svgs.arrow);this.zone.h=this.h;this.parentHeight(-a)},text:function(a){this.c[3].textContent=a},rSizeContent:function(){for(var a=
  this.length;a--;)this.listIn.children[a].style.width=this.ww+"px"},rSize:function(){d.prototype.rSize.call(this);var a=this.s,c=this.sb,f=this.sa;a[2].width=c+"px";a[2].left=f+"px";a[3].width=c+"px";a[3].left=f+"px";a[4].left=f+c-17+"px";this.ww=c;this.max>this.maxHeight&&(this.ww=c-20);this.isOpen&&this.rSizeContent()}});C.prototype=Object.assign(Object.create(d.prototype),{constructor:C,testZone:function(a){a=this.local;if(-1===a.x&&-1===a.y)return"";for(var c=this.lng,d=this.tmp;c--;)if(a.x>d[c][0]&&
  a.x<d[c][2])return c;return""},mode:function(a,c){if(a===this.cMode[c])return!1;var d;switch(a){case 0:d=this.colors.border;break;case 1:d=this.colors.borderOver;break;case 2:d=this.colors.borderSelect}this.reset();this.c[c+2].style.borderColor=d;this.cMode[c]=a;return!0},mousedown:function(a){var c=this.testZone(a);if(""===c)return!1;this.current=c;this.isDown=!0;this.prev={x:a.clientX,y:a.clientY,d:0,v:this.isNumber?parseFloat(this.value):parseFloat(this.value[this.current])};return this.mode(2,
  c)},mouseup:function(a){a=this.testZone(a);this.isDown=!1;if(-1!==this.current){var c=this.prev.d;this.current=-1;this.prev={x:0,y:0,d:0,v:0};if(c)return this.reset();this.setInput(this.c[a+2],function(){this.testValue()}.bind(this));return!0}},mousemove:function(a){var c=!1,c=this.testZone(a);""===c?(c=this.reset(),this.cursor()):(c=this.mode(1,c),this.cursor(-1!==this.current?"move":"pointer"));-1!==this.current&&(this.prev.d+=a.clientX-this.prev.x-(a.clientY-this.prev.y),this.value[this.current]=
  this.numValue(this.prev.v+this.prev.d*this.step),this.c[2+this.current].textContent=this.value[this.current],this.validate(),this.prev.x=a.clientX,this.prev.y=a.clientY,c=!0);return c},keydown:function(a){return!0},reset:function(){var a=!1;this.isDown=!1;for(var c=this.lng;c--;)0!==this.cMode[c]&&(this.cMode[c]=0,this.c[2+c].style.borderColor=this.colors.border,a=!0);return a},setValue:function(a,c){c=c||0;this.value[c]=this.numValue(a);this.c[2+c].textContent=this.value[c]},testValue:function(){for(var a=
  this.lng;a--;)if(isNaN(this.c[2+a].textContent))this.c[2+a].textContent=this.value[a];else{var c=this.numValue(this.c[2+a].textContent);this.c[2+a].textContent=c;this.value[a]=c}this.validate()},validate:function(){for(var a=[],c=this.lng;c--;)a[c]=this.value[c]*this.toRad;this.isNumber?this.send(a[0]):this.send(a)},rSize:function(){d.prototype.rSize.call(this);for(var a=Math.floor((this.sb+5)/this.lng)-5,c=this.s,f=this.lng;f--;)this.tmp[f]=[Math.floor(this.sa+a*f+5*f),a],this.tmp[f][2]=this.tmp[f][0]+
  this.tmp[f][1],c[2+f].left=this.tmp[f][0]+"px",c[2+f].width=this.tmp[f][1]+"px"}});u.prototype=Object.assign(Object.create(d.prototype),{constructor:u,testZone:function(a){a=this.local;return-1===a.x&&-1===a.y?"":a.x>=this.txl?"text":a.x>=this.sa?"scroll":""},mouseup:function(a){this.isDown&&(this.isDown=!1)},mousedown:function(a){var c=this.testZone(a);if(!c)return!1;"scroll"===c&&(this.isDown=!0,this.old=this.value,this.mousemove(a));"text"===c&&this.setInput(this.c[2],function(){this.validate()}.bind(this));
  return!0},mousemove:function(a){var c=!1,d=this.testZone(a);"scroll"===d?(this.mode(1),this.cursor("w-resize")):"text"===d?this.cursor("pointer"):this.cursor();if(this.isDown){a=(a.clientX-(this.zone.x+this.sa)-3)/this.ww*this.range+this.min-this.old;if(a>=this.step||a<=this.step)a=Math.floor(a/this.step),this.value=this.numValue(this.old+a*this.step),this.update(!0),this.old=this.value;c=!0}return c},keydown:function(a){return!0},validate:function(){var a=this.c[2].textContent;isNaN(a)?this.c[2].textContent=
  this.value:(this.value=this.numValue(a),this.update(!0))},reset:function(){this.isDown=!1;this.mode(0)},mode:function(a){var c=this.s;switch(a){case 0:c[2].color=this.fontColor;c[4].background=this.colors.scrollback;c[5].background=this.fontColor;break;case 1:c[2].color=this.colorPlus,c[4].background=this.colors.scrollbackover,c[5].background=this.colorPlus}},update:function(a){var c=Math.floor((this.value-this.min)/this.range*this.ww);3!==this.model&&(this.s[5].width=c+"px");this.s[6]&&(this.s[6].left=
  this.sa+c+3+"px");this.c[2].textContent=this.value;a&&this.send()},rSize:function(){d.prototype.rSize.call(this);var a=this.sb-this.sc;this.ww=a-6;var c=this.sc;if(this.isUI||!this.simple)c=this.sc+10;this.txl=this.w-c+2;var c=Math.floor(0.5*this.h)-8,f=this.s;f[2].width=this.sc-2+"px";f[2].left=this.txl+"px";f[2].top=c+"px";f[3].left=this.sa+"px";f[3].width=a+"px";f[4].left=this.sa+"px";f[4].width=a+"px";f[5].left=this.sa+3+"px";this.update()}});K.prototype=Object.assign(Object.create(d.prototype),
  {constructor:K,mousedown:function(a){this.setInput(this.c[2],function(){this.validate()}.bind(this));return this.mode(2)},mousemove:function(a){return this.mode(1)},keydown:function(a){return!0},mode:function(a){if(a===this.cmode)return!1;var c;switch(a){case 0:c=this.colors.border;break;case 1:c=this.colors.borderOver;break;case 2:c=this.colors.borderSelect}this.c[2].style.borderColor=c;this.cmode=a;return!0},reset:function(){this.mode(0)},rSize:function(){d.prototype.rSize.call(this);var a=this.s;
  a[2].color=this.fontColor;a[2].left=this.sa+"px";a[2].width=this.sb+"px";a[2].height=this.h-4+"px";a[2].lineHeight=this.h-8+"px"},validate:function(){this.value=this.c[2].textContent;this.send()}});w.prototype=Object.assign(Object.create(d.prototype),{constructor:w,text:function(a){this.c[1].textContent=a},text2:function(a){this.c[2].textContent=a},rSize:function(){d.prototype.rSize.call(this);this.s[1].width=this.w-50+"px";this.s[2].left=this.w-76+"px"}});Object.assign(Q.prototype,{constructor:Q,
  isGui:!0,dispose:function(){this.clear();null!==this.parent&&this.parent.removeChild(this.content);D.remove(this)},onDraw:function(){},makeCanvas:function(){this.canvas=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");this.canvas.width=this.zone.w;this.canvas.height=this.forceHeight?this.forceHeight:this.zone.h},draw:function(a){null!==this.canvas&&D.toCanvas(this,this.zone.w,this.forceHeight?this.forceHeight:this.zone.h,a)},getDom:function(){return this.content},setMouse:function(a){this.mouse.set(a.x,
  a.y)},setText:function(a,c,d){J.setText(a,c,d)},hide:function(a){this.content.style.display=a?"none":"block"},onChange:function(a){this.callback=a;return this},mode:function(a){var c=!1;if(a!==this.cn){this.cn=a;switch(a){case "def":this.scroll.style.background=this.colors.scroll;this.bottom.style.background=this.colors.background;this.bottom.style.color=this.colors.text;break;case "scrollOver":this.scroll.style.background=this.colors.select;break;case "scrollDown":this.scroll.style.background=this.colors.down;
  break;case "bottomOver":this.bottom.style.background=this.colors.backgroundOver,this.bottom.style.color="#FFF"}c=!0}return c},clearTarget:function(){if(-1===this.current)return!1;this.target.uiout();this.target.reset();this.target=null;this.current=-1;D.cursor();return!0},testZone:function(a){a=this.local;if(-1===a.x&&-1===a.y)return"";this.isReset=!1;var c="",c=this.isScroll?this.zone.w-this.size.s:this.zone.w;return c=a.y>this.zone.h-this.bh&&a.y<this.zone.h?"bottom":a.x>c?"scroll":"content"},handleEvent:function(a){var c=
  a.type,d=!1,f=!1,l=this.testZone(a);"mouseup"===c&&this.isDown&&(this.isDown=!1);"mousedown"!==c||this.isDown||(this.isDown=!0);if(l){switch(l){case "content":a.clientY=this.isScroll?a.clientY+this.decal:a.clientY;D.isMobile&&"mousedown"===c&&this.getNext(a,d);this.target&&(f=this.target.handleEvent(a));"mousemove"===c&&(d=this.mode("def"));"wheel"===c&&!f&&this.isScroll&&(d=this.onWheel(a));D.lock||this.getNext(a,d);break;case "bottom":this.clearTarget();"mousemove"===c&&(d=this.mode("bottomOver"));
  "mousedown"===c&&(this.isOpen=this.isOpen?!1:!0,this.bottom.textContent=this.isOpen?"close":"open",this.setHeight(),this.mode("def"),d=!0);break;case "scroll":this.clearTarget(),"mousemove"===c&&(d=this.mode("scrollOver")),"mousedown"===c&&(d=this.mode("scrollDown")),"wheel"===c&&(d=this.onWheel(a)),this.isDown&&this.update(a.clientY-this.zone.y-0.5*this.sh)}this.isDown&&(d=!0);f&&(d=!0);d&&this.draw()}},getNext:function(a,c){var d=D.findTarget(this.uis,a);d!==this.current&&(this.clearTarget(),this.current=
  d);-1!==d&&(this.target=this.uis[this.current],this.target.uiover())},onWheel:function(a){this.oy+=20*a.delta;this.update(this.oy);return!0},reset:function(a){if(!this.isReset){this.mouse.neg();this.isDown=!1;D.clearInput();a=this.mode("def");var c=this.clearTarget();(a||c)&&this.draw(!0);this.isReset=!0}},add:function(){var a=arguments;"object"===typeof a[1]?(a[1].isUI=!0,a[1].main=this):"string"===typeof a[1]&&(void 0===a[2]?[].push.call(a,{isUI:!0,main:this}):(a[2].isUI=!0,a[2].main=this));a=W.apply(this,
  a);if(null!==a){this.uis.push(a);if(a.autoWidth)this.prevY=0,this.calc(a.h+1);else{var c=a.c[0].getBoundingClientRect().top;this.prevY!==c&&(this.calc(a.h+1),this.prevY=c)}return a}},applyCalc:function(){this.calc(this.tmpH);this.tmpAdd=null},calcUis:function(){D.calcUis(this.uis,this.zone,this.zone.y)},remove:function(a){a=this.uis.indexOf(a);-1!==a&&this.uis[a].clear()},clearOne:function(a){a=this.uis.indexOf(a);-1!==a&&(this.inner.removeChild(this.uis[a].c[0]),this.uis.splice(a,1))},clear:function(){for(var a=
  this.uis.length;a--;)this.uis[a].clear();this.uis=[];D.listens=[];this.calc(-this.h)},upScroll:function(a){this.sw=a?this.size.s:0;this.oy=a?this.oy:0;this.scrollBG.style.display=a?"block":"none";a&&(this.total=this.h,this.maxView=this.maxHeight,this.ratio=this.maxView/this.total,this.sh=this.maxView*this.ratio,this.range=this.maxView-this.sh,this.oy=J.clamp(this.oy,0,this.range),this.scrollBG.style.height=this.maxView+"px",this.scroll.style.height=this.sh+"px");this.setItemWidth(this.zone.w-this.sw);
  this.update(this.oy)},update:function(a){a=J.clamp(a,0,this.range);this.decal=Math.floor(a/this.ratio);this.inner.style.top=-this.decal+"px";this.scroll.style.top=Math.floor(a)+"px";this.oy=a},calc:function(a){this.h+=a;clearTimeout(this.tmp);this.tmp=setTimeout(this.setHeight.bind(this),10)},setHeight:function(){this.tmp&&clearTimeout(this.tmp);this.zone.h=this.bh;this.isScroll=!1;this.isOpen&&(this.maxHeight=(this.forceHeight?this.forceHeight:window.innerHeight)-this.zone.y-this.bh,1<this.h-this.maxHeight?
  (this.isScroll=!0,this.zone.h=this.maxHeight+this.bh):this.zone.h=this.h+this.bh);this.upScroll(this.isScroll);this.innerContent.style.height=this.zone.h-this.bh+"px";this.content.style.height=this.zone.h+"px";this.bottom.style.top=this.zone.h-this.bh+"px";this.isOpen&&this.calcUis();this.isCanvas&&this.draw(!0)},setWidth:function(a){a&&(this.zone.w=a);this.content.style.width=this.zone.w+"px";this.isCenter&&(this.content.style.marginLeft=-Math.floor(0.5*this.zone.w)+"px");this.setItemWidth(this.zone.w-
  this.sw);this.setHeight();this.isCanvasOnly||(D.needReZone=!0)},setItemWidth:function(a){for(var c=this.uis.length;c--;)this.uis[c].setSize(a),this.uis[c].rSize()}});a.REVISION="2.0";a.Tools=J;a.Gui=Q;a.Proto=d;a.add=W;a.Bool=f;a.Button=l;a.Circular=m;a.Color=r;a.Fps=q;a.Group=x;a.Joystick=v;a.Knob=A;a.List=I;a.Numeric=C;a.Slide=u;a.TextInput=K;a.Title=w;Object.defineProperty(a,"__esModule",{value:!0})});(function(){function a(a){return a&&a.Object===Object?a:null}function c(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}function d(a){var d={};this.settings=a;this.on=function(a,c){d[a]=c};this.emit=function(a){var c=d[a];c&&c.apply(null,Array.prototype.slice.call(arguments,1))};this.filename=a.name||c();this.mimeType=this.extension=""}function f(a){"image/webp"!==document.createElement("canvas").toDataURL("image/webp").substr(5,
  10)&&console.log("WebP not supported - try another export format");d.call(this,a);a.quality=a.quality/100||0.8;this.extension=".webm";this.mimeType="video/webm";this.baseFilename=this.filename;this.frames=[];this.part=1}function l(a){d.call(this,a);a.quality=a.quality/100||0.8;this.encoder=new FFMpegServer.Video(a);this.encoder.on("process",function(){this.emit("process")}.bind(this));this.encoder.on("finished",function(a,c){var d=this.callback;d&&(this.callback=void 0,d(a,c))}.bind(this));this.encoder.on("progress",
  function(a){if(this.settings.onProgress)this.settings.onProgress(a)}.bind(this));this.encoder.on("error",function(a){alert(JSON.stringify(a,null,2))}.bind(this))}function m(a){d.call(this,a);this.framerate=this.settings.framerate;this.type="video/webm";this.extension=".webm";this.mediaRecorder=this.stream=null;this.chunks=[]}function r(a){function c(){function a(){this._hooked||(this._hooked=!0,this._hookedTime=this.currentTime||0,this.pause(),Jd.push(this));return this._hookedTime+n.startTime}A("Capturer start");
  C=window.Date.now();x=C+n.startTime;ea=window.performance.now();I=ea+n.startTime;window.Date.prototype.getTime=function(){return x};window.Date.now=function(){return x};window.setTimeout=function(a,c){var d={callback:a,time:c,triggerTime:x+c};ha.push(d);A("Timeout set to "+d.time);return d};window.clearTimeout=function(a){for(var c=0;c<ha.length;c++)ha[c]==a&&(ha.splice(c,1),A("Timeout cleared"))};window.setInterval=function(a,c){var d={callback:a,time:c,triggerTime:x+c};N.push(d);A("Interval set to "+
  d.time);return d};window.clearInterval=function(a){A("clear Interval");return null};window.requestAnimationFrame=function(a){ia.push(a)};window.performance.now=function(){return I};try{Object.defineProperty(HTMLVideoElement.prototype,"currentTime",{get:a}),Object.defineProperty(HTMLAudioElement.prototype,"currentTime",{get:a})}catch(d){A(d)}}function d(){M=!1;ba.stop();A("Capturer stop");window.setTimeout=Ba;window.setInterval=wa;window.clearTimeout=De;window.requestAnimationFrame=Ee;window.Date.prototype.getTime=
  He;window.Date.now=Fe;window.performance.now=Ge}function q(){Ba(t,0,void 0)}function r(){var a=fa/n.framerate;if(n.frameLimit&&fa>=n.frameLimit||n.timeLimit&&a>=n.timeLimit)d(),v();var c=new Date(null);c.setSeconds(a);G.textContent=2<n.motionBlurFrames?"CCapture "+n.format+" | "+fa+" frames ("+ma+" inter) | "+c.toISOString().substr(11,8):"CCapture "+n.format+" | "+fa+" frames | "+c.toISOString().substr(11,8)}function t(){var a=1E3/n.framerate*(fa+ma/n.motionBlurFrames);x=C+a;I=ea+a;Jd.forEach(function(c){c._hookedTime=
  a/1E3});r();A("Frame: "+fa+" "+ma);for(var c=0;c<ha.length;c++)x>=ha[c].triggerTime&&(Ba(ha[c].callback,0,void 0),ha.splice(c,1));for(c=0;c<N.length;c++)x>=N[c].triggerTime&&(Ba(N[c].callback,0,void 0),N[c].triggerTime+=N[c].time);ia.forEach(function(a){Ba(a,0,x-u)});ia=[]}function v(a){a||(a=function(a){download(a,ba.filename+ba.extension,ba.mimeType);return!1});ba.save(a)}function A(a){s&&console.log(a)}function g(a){var c=la[a];c&&c.apply(null,Array.prototype.slice.call(arguments,1))}var n=a||
  {},s,x,C,I,ea,ba,ha=[],N=[],fa=0,ma=0,ia=[],M=!1,la={};n.framerate=n.framerate||60;n.motionBlurFrames=2*(n.motionBlurFrames||1);s=n.verbose||!1;n.step=1E3/n.framerate;n.timeLimit=n.timeLimit||0;n.frameLimit=n.frameLimit||0;n.startTime=n.startTime||0;var G=document.createElement("div");G.style.position="absolute";G.style.left=G.style.top=0;G.style.backgroundColor="black";G.style.fontFamily="monospace";G.style.fontSize="11px";G.style.padding="5px";G.style.color="red";G.style.zIndex=1E5;n.display&&document.body.appendChild(G);
  var ja=document.createElement("canvas"),oa=ja.getContext("2d"),T,pa;A("Step is set to "+n.step+"ms");a={webm:f,ffmpegserver:l,"webm-mediarecorder":m};var fb=a[n.format];if(!fb)throw"Error: Incorrect or missing format: Valid formats are "+Object.keys(a).join(", ");ba=new fb(n);ba.step=q;ba.on("process",t);ba.on("progress",function(a){g("progress",a)});!1=="performance"in window&&(window.performance={});Date.now=Date.now||function(){return(new Date).getTime()};if(!1=="now"in window.performance){var sa=
  Date.now();performance.timing&&performance.timing.navigationStart&&(sa=performance.timing.navigationStart);window.performance.now=function(){return Date.now()-sa}}var Ba=window.setTimeout,wa=window.setInterval,De=window.clearTimeout,Ee=window.requestAnimationFrame,Fe=window.Date.now,Ge=window.performance.now,He=window.Date.prototype.getTime,Jd=[];return{start:function(){c();ba.start();M=!0},capture:function(a){if(M)if(2<n.motionBlurFrames){if(ja.width!==a.width||ja.height!==a.height)ja.width=a.width,
  ja.height=a.height,T=new Uint16Array(ja.height*ja.width*4),oa.fillStyle="#0",oa.fillRect(0,0,ja.width,ja.height);oa.drawImage(a,0,0);pa=oa.getImageData(0,0,ja.width,ja.height);for(a=0;a<T.length;a+=4)T[a]+=pa.data[a],T[a+1]+=pa.data[a+1],T[a+2]+=pa.data[a+2];ma++;if(ma>=0.5*n.motionBlurFrames){a=pa.data;for(var c=0;c<T.length;c+=4)a[c]=2*T[c]/n.motionBlurFrames,a[c+1]=2*T[c+1]/n.motionBlurFrames,a[c+2]=2*T[c+2]/n.motionBlurFrames;oa.putImageData(pa,0,0);ba.add(ja);fa++;ma=0;A("Full MB Frame! "+fa+
  " "+x);for(c=0;c<T.length;c+=4)T[c]=0,T[c+1]=0,T[c+2]=0;gc()}else q()}else ba.add(a),fa++,A("Full Frame! "+fa)},stop:d,save:v,on:function(a,c){la[a]=c}}}var q={"function":!0,object:!0},t=q[typeof exports]&&exports&&!exports.nodeType?exports:void 0,x=q[typeof module]&&module&&!module.nodeType?module:void 0,v=x&&x.exports===t?t:void 0,A=a(t&&x&&"object"==typeof global&&global),I=a(q[typeof self]&&self),C=a(q[typeof window]&&window),q=a(q[typeof this]&&this),A=A||C!==(q&&q.window)&&C||I||q||Function("return this")();
  "gc"in window||(window.gc=function(){});HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(a,c,d){d=atob(this.toDataURL(c,d).split(",")[1]);for(var f=d.length,l=new Uint8Array(f),m=0;m<f;m++)l[m]=d.charCodeAt(m);a(new Blob([l],{type:c||"image/png"}))}});(function(){!1=="performance"in window&&(window.performance={});Date.now=Date.now||function(){return(new Date).getTime()};if(!1=="now"in window.performance){var a=Date.now();performance.timing&&
  performance.timing.navigationStart&&(a=performance.timing.navigationStart);window.performance.now=function(){return Date.now()-a}}})();var u=window.Date.now();d.prototype.start=function(){};d.prototype.stop=function(){};d.prototype.add=function(){};d.prototype.save=function(){};d.prototype.dispose=function(){};d.prototype.safeToProceed=function(){return!0};d.prototype.step=function(){console.log("Step not set!")};f.prototype=Object.create(d.prototype);f.prototype.start=function(a){this.dispose()};
  f.prototype.add=function(a){this.frames.push(a.toDataURL("image/webp",this.quality));0<this.settings.autoSaveTime&&this.frames.length/this.settings.framerate>=this.settings.autoSaveTime?this.save(function(a){this.filename=this.baseFilename+"-part-"+String("0000000"+this.part).slice(-7);download(a,this.filename+this.extension,this.mimeType);this.dispose();this.part++;this.filename=this.baseFilename+"-part-"+String("0000000"+this.part).slice(-7);this.step()}.bind(this)):this.step()};f.prototype.save=
  function(a){if(this.frames.length){var c=Whammy.fromImageArray(this.frames,this.settings.framerate),c=new Blob([c],{type:"octet/stream"});a(c)}};f.prototype.dispose=function(a){this.frames=[]};l.prototype=Object.create(d.prototype);l.prototype.start=function(){this.encoder.start(this.settings)};l.prototype.add=function(a){this.encoder.add(a)};l.prototype.save=function(a){this.callback=a;this.encoder.end()};l.prototype.safeToProceed=function(){return this.encoder.safeToProceed()};m.prototype=Object.create(d.prototype);
  m.prototype.add=function(a){this.stream||(this.stream=a.captureStream(this.framerate),this.mediaRecorder=new MediaRecorder(this.stream),this.mediaRecorder.start(),this.mediaRecorder.ondataavailable=function(a){this.chunks.push(a.data)}.bind(this));this.step()};m.prototype.save=function(a){this.mediaRecorder.onstop=function(c){c=new Blob(this.chunks,{type:"video/webm"});this.chunks=[];a(c)}.bind(this);this.mediaRecorder.stop()};(C||I||{}).CCapture=r;"function"==typeof define&&"object"==typeof define.amd&&
  define.amd?define(function(){return r}):t&&x?(v&&((x.exports=r).CCapture=r),t.CCapture=r):A.CCapture=r})();window.Whammy=function(){function a(a,d){for(var f=c(a),f=[{id:440786851,data:[{data:1,id:17030},{data:1,id:17143},{data:4,id:17138},{data:8,id:17139},{data:"webm",id:17026},{data:2,id:17031},{data:2,id:17029}]},{id:408125543,data:[{id:357149030,data:[{data:1E6,id:2807729},{data:"whammy",id:19840},{data:"whammy",id:22337},{data:x(f.duration),id:17545}]},{id:374648427,data:[{id:174,data:[{data:1,id:215},{data:1,id:29637},{data:0,id:156},{data:"und",id:2274716},{data:"V_VP8",id:134},{data:"VP8",id:2459272},
  {data:1,id:131},{id:224,data:[{data:f.width,id:176},{data:f.height,id:186}]}]}]},{id:475249515,data:[]}]}],m=f[1],q=m.data[2],t=0,v=0;t<a.length;){var Q={id:187,data:[{data:Math.round(v),id:179},{id:183,data:[{data:1,id:247},{data:0,size:8,id:241}]}]};q.data.push(Q);var H=[],Q=0;do H.push(a[t]),Q+=a[t].duration,t++;while(t<a.length&&3E4>Q);var J=0,H={id:524531317,data:[{data:Math.round(v),id:231}].concat(H.map(function(a){var c=r({discardable:0,frame:a.data.slice(4),invisible:0,keyframe:1,lacing:0,
  trackNum:1,timecode:Math.round(J)});J+=a.duration;return{data:c,id:163}}))};m.data.push(H);v+=Q}for(v=t=0;v<m.data.length;v++)3<=v&&(q.data[v-3].data[1].data[1].data=t),Q=l([m.data[v]],d),t+=Q.size||Q.byteLength||Q.length,2!=v&&(m.data[v]=Q);return l(f,d)}function c(a){for(var c=a[0].width,d=a[0].height,f=a[0].duration,l=1;l<a.length;l++){if(a[l].width!=c)throw"Frame "+(l+1)+" has a different width";if(a[l].height!=d)throw"Frame "+(l+1)+" has a different height";if(0>a[l].duration||32767<a[l].duration)throw"Frame "+
  (l+1)+" has a weird duration (must be between 0 and 32767)";f+=a[l].duration}return{duration:f,width:c,height:d}}function d(a){for(var c=[];0<a;)c.push(a&255),a>>=8;return new Uint8Array(c.reverse())}function f(a){var c=[];a=(a.length%8?Array(9-a.length%8).join("0"):"")+a;for(var d=0;d<a.length;d+=8)c.push(parseInt(a.substr(d,8),2));return new Uint8Array(c)}function l(a,c){for(var q=[],r=0;r<a.length;r++)if("id"in a[r]){var t=a[r].data;"object"==typeof t&&(t=l(t,c));if("number"==typeof t)if("size"in
  a[r]){for(var v=a[r].size,x=new Uint8Array(v),v=v-1;0<=v;v--)x[v]=t&255,t>>=8;t=x}else t=f(t.toString(2));if("string"==typeof t){x=new Uint8Array(t.length);for(v=0;v<t.length;v++)x[v]=t.charCodeAt(v);t=x}for(var v=t.size||t.byteLength||t.length,x=0,Q=56;0<Q;Q-=7)if(v>Math.pow(2,Q)-2){x=Q/7;break}v=v.toString(2);Q=Array(8*(x+1)+1).join("0");x=Array(x+1).join("0")+1;v=Q.substr(0,Q.length-v.length-x.length)+v;x+=v;q.push(d(a[r].id));q.push(f(x));q.push(t)}else q.push(a[r]);return c?(q=m(q),new Uint8Array(q)):
  new Blob(q,{type:"video/webm"})}function m(a,c){null==c&&(c=[]);for(var d=0;d<a.length;d++)"object"==typeof a[d]?m(a[d],c):c.push(a[d]);return c}function r(a){var c=0;a.keyframe&&(c|=128);a.invisible&&(c|=8);a.lacing&&(c|=a.lacing<<1);a.discardable&&(c|=1);if(127<a.trackNum)throw"TrackNumber > 127 not supported";return[a.trackNum|128,a.timecode>>8,a.timecode&255,c].map(function(a){return String.fromCharCode(a)}).join("")+a.frame}function q(a){for(var c=a.RIFF[0].WEBP[0],d=c.indexOf("\u009d\u0001*"),
  f=0,l=[];4>f;f++)l[f]=c.charCodeAt(d+3+f);f=l[1]<<8|l[0];d=f&16383;f=l[3]<<8|l[2];return{width:d,height:f&16383,data:c,riff:a}}function t(a){for(var c=0,d={};c<a.length;){var f=a.substr(c,4);d[f]=d[f]||[];if("RIFF"==f||"LIST"==f){var l=parseInt(a.substr(c+4,4).split("").map(function(a){a=a.charCodeAt(0).toString(2);return Array(8-a.length+1).join("0")+a}).join(""),2),m=a.substr(c+4+4,l),c=c+(8+l);d[f].push(t(m))}else"WEBP"==f?d[f].push(a.substr(c+8)):d[f].push(a.substr(c+4)),c=a.length}return d}function x(a){return[].slice.call(new Uint8Array((new Float64Array([a])).buffer),
  0).map(function(a){return String.fromCharCode(a)}).reverse().join("")}function v(a,c){this.frames=[];this.duration=1E3/a;this.quality=c||0.8}v.prototype.add=function(a,c){if("undefined"!=typeof c&&this.duration)throw"you can't pass a duration if the fps is set";if("undefined"==typeof c&&!this.duration)throw"if you don't have the fps set, you need to have durations here.";a.canvas&&(a=a.canvas);if(a.toDataURL)a=a.getContext("2d").getImageData(0,0,a.width,a.height);else if("string"!=typeof a)throw"frame must be a a HTMLCanvasElement, a CanvasRenderingContext2D or a DataURI formatted string";
  if("string"===typeof a&&!/^data:image\/webp;base64,/ig.test(a))throw"Input must be formatted properly as a base64 encoded DataURI of type image/webp";this.frames.push({image:a,duration:c||this.duration})};v.prototype.encodeFrames=function(a){if(this.frames[0].image instanceof ImageData){var c=this.frames,d=document.createElement("canvas"),f=d.getContext("2d");d.width=this.frames[0].image.width;d.height=this.frames[0].image.height;var l=function(m){var q=c[m];f.putImageData(q.image,0,0);q.image=d.toDataURL("image/webp",
  this.quality);m<c.length-1?setTimeout(function(){l(m+1)},1):a()}.bind(this);l(0)}else a()};v.prototype.compile=function(c,d){this.encodeFrames(function(){var f=new a(this.frames.map(function(a){var c=q(t(atob(a.image.slice(23))));c.duration=a.duration;return c}),c);d(f)}.bind(this))};return{Video:v,fromImageArray:function(c,d,f){return a(c.map(function(a){a=q(t(atob(a.slice(23))));a.duration=1E3/d;return a}),f)},toWebM:a}}();function download(a,c,d){function f(a){var c=a.split(/[:;,]/);a=c[1];for(var c=("base64"==c[2]?atob:decodeURIComponent)(c.pop()),d=c.length,f=0,l=new Uint8Array(d),f=0;f<d;++f)l[f]=c.charCodeAt(f);return new v([l],{type:a})}function l(a,c){if("download"in t)return t.href=a,t.setAttribute("download",I),t.innerHTML="downloading...",t.style.display="none",q.body.appendChild(t),setTimeout(function(){t.click();q.body.removeChild(t);!0===c&&setTimeout(function(){m.URL.revokeObjectURL(t.href)},250)},66),
  !0;var d=q.createElement("iframe");q.body.appendChild(d);c||(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,r));d.src=a;setTimeout(function(){q.body.removeChild(d)},333)}var m=window,r="application/octet-stream";d=d||r;var q=document,t=q.createElement("a"),x=function(a){return String(a)},v=m.Blob||m.MozBlob||m.WebKitBlob||x,A=m.MSBlobBuilder||m.WebKitBlobBuilder||m.BlobBuilder,I=c||"download",C;"true"===String(this)&&(a=[a,d],d=a[0],a=a[1]);if(String(a).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?
  navigator.msSaveBlob(f(a),I):l(a);try{C=a instanceof v?a:new v([a],{type:d})}catch(u){A&&(C=new A,C.append([a]),C=C.getBlob(d))}if(navigator.msSaveBlob)return navigator.msSaveBlob(C,I);if(m.URL)l(m.URL.createObjectURL(C),!0);else{if("string"===typeof C||C.constructor===x)try{return l("data:"+d+";base64,"+m.btoa(C))}catch(K){return l("data:"+d+","+encodeURIComponent(C))}c=new FileReader;c.onload=function(a){l(this.result)};c.readAsDataURL(C)}return!0};THREE.OrbitControls=function(a,c){function d(){return Math.pow(0.95,u.zoomSpeed)}function f(a){u.object instanceof THREE.PerspectiveCamera?g/=a:u.object instanceof THREE.OrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom*a)),u.object.updateProjectionMatrix(),s=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function l(a){u.object instanceof THREE.PerspectiveCamera?g*=a:u.object instanceof THREE.OrthographicCamera?
  (u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom/a)),u.object.updateProjectionMatrix(),s=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function m(a){if(!1!==u.enabled){a.preventDefault();if(a.button===u.mouseButtons.ORBIT){if(!1===u.enableRotate)return;S.set(a.clientX,a.clientY);H=Q.ROTATE}else if(a.button===u.mouseButtons.ZOOM){if(!1===u.enableZoom)return;N.set(a.clientX,a.clientY);H=Q.DOLLY}else if(a.button===
  u.mouseButtons.PAN){if(!1===u.enablePan)return;ea.set(a.clientX,a.clientY);H=Q.PAN}H!==Q.NONE&&(document.addEventListener("mousemove",r,!1),document.addEventListener("mouseup",q,!1),u.dispatchEvent(w))}}function r(a){!1!==u.enabled&&(a.preventDefault(),H===Q.ROTATE?!1!==u.enableRotate&&(V.set(a.clientX,a.clientY),da.subVectors(V,S),a=u.domElement===document?u.domElement.body:u.domElement,D.theta-=2*Math.PI*da.x/a.clientWidth*u.rotateSpeed,D.phi-=2*Math.PI*da.y/a.clientHeight*u.rotateSpeed,S.copy(V),
  u.update()):H===Q.DOLLY?!1!==u.enableZoom&&(fa.set(a.clientX,a.clientY),ma.subVectors(fa,N),0<ma.y?f(d()):0>ma.y&&l(d()),N.copy(fa),u.update()):H===Q.PAN&&!1!==u.enablePan&&(ba.set(a.clientX,a.clientY),ha.subVectors(ba,ea),la(ha.x,ha.y),ea.copy(ba),u.update()))}function q(a){!1!==u.enabled&&(document.removeEventListener("mousemove",r,!1),document.removeEventListener("mouseup",q,!1),u.dispatchEvent(W),H=Q.NONE)}function t(a){!1===u.enabled||!1===u.enableZoom||H!==Q.NONE&&H!==Q.ROTATE||(a.preventDefault(),
  a.stopPropagation(),0>a.deltaY?l(d()):0<a.deltaY&&f(d()),u.update(),u.dispatchEvent(w),u.dispatchEvent(W))}function x(a){if(!1!==u.enabled&&!1!==u.enableKeys&&!1!==u.enablePan)switch(a.keyCode){case u.keys.UP:la(0,u.keyPanSpeed);u.update();break;case u.keys.BOTTOM:la(0,-u.keyPanSpeed);u.update();break;case u.keys.LEFT:la(u.keyPanSpeed,0);u.update();break;case u.keys.RIGHT:la(-u.keyPanSpeed,0),u.update()}}function v(a){if(!1!==u.enabled){switch(a.touches.length){case 1:if(!1===u.enableRotate)return;
  S.set(a.touches[0].pageX,a.touches[0].pageY);H=Q.TOUCH_ROTATE;break;case 2:if(!1===u.enableZoom)return;var c=a.touches[0].pageX-a.touches[1].pageX;a=a.touches[0].pageY-a.touches[1].pageY;c=Math.sqrt(c*c+a*a);N.set(0,c);H=Q.TOUCH_DOLLY;break;case 3:if(!1===u.enablePan)return;ea.set(a.touches[0].pageX,a.touches[0].pageY);H=Q.TOUCH_PAN;break;default:H=Q.NONE}H!==Q.NONE&&u.dispatchEvent(w)}}function A(a){if(!1!==u.enabled)switch(a.preventDefault(),a.stopPropagation(),a.touches.length){case 1:if(!1===
  u.enableRotate)break;if(H!==Q.TOUCH_ROTATE)break;V.set(a.touches[0].pageX,a.touches[0].pageY);da.subVectors(V,S);var c=u.domElement===document?u.domElement.body:u.domElement;D.theta-=2*Math.PI*da.x/c.clientWidth*u.rotateSpeed;D.phi-=2*Math.PI*da.y/c.clientHeight*u.rotateSpeed;S.copy(V);u.update();break;case 2:if(!1===u.enableZoom)break;if(H!==Q.TOUCH_DOLLY)break;c=a.touches[0].pageX-a.touches[1].pageX;a=a.touches[0].pageY-a.touches[1].pageY;c=Math.sqrt(c*c+a*a);fa.set(0,c);ma.subVectors(fa,N);0<ma.y?
  l(d()):0>ma.y&&f(d());N.copy(fa);u.update();break;case 3:if(!1===u.enablePan)break;if(H!==Q.TOUCH_PAN)break;ba.set(a.touches[0].pageX,a.touches[0].pageY);ha.subVectors(ba,ea);la(ha.x,ha.y);ea.copy(ba);u.update();break;default:H=Q.NONE}}function I(a){!1!==u.enabled&&(u.dispatchEvent(W),H=Q.NONE)}function C(a){a.preventDefault()}this.object=a;this.domElement=void 0!==c?c:document;this.enabled=!0;this.target=new THREE.Vector3;this.minDistance=0;this.maxDistance=Infinity;this.minZoom=0;this.maxZoom=Infinity;
  this.minPolarAngle=0;this.maxPolarAngle=Math.PI;this.minAzimuthAngle=-Infinity;this.maxAzimuthAngle=Infinity;this.enableDamping=!1;this.dampingFactor=0.25;this.enableZoom=!0;this.zoomSpeed=1;this.enableRotate=!0;this.rotateSpeed=1;this.enablePan=!0;this.keyPanSpeed=7;this.autoRotate=!1;this.autoRotateSpeed=2;this.enableKeys=!0;this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40};this.mouseButtons={ORBIT:THREE.MOUSE.LEFT,ZOOM:THREE.MOUSE.MIDDLE,PAN:THREE.MOUSE.RIGHT};this.target0=this.target.clone();this.position0=
  this.object.position.clone();this.zoom0=this.object.zoom;this.getPolarAngle=function(){return y.phi};this.getAzimuthalAngle=function(){return y.theta};this.reset=function(){u.target.copy(u.target0);u.object.position.copy(u.position0);u.object.zoom=u.zoom0;u.object.updateProjectionMatrix();u.dispatchEvent(K);u.update();H=Q.NONE};this.update=function(){var c=new THREE.Vector3,d=(new THREE.Quaternion).setFromUnitVectors(a.up,new THREE.Vector3(0,1,0)),f=d.clone().inverse(),l=new THREE.Vector3,m=new THREE.Quaternion;
  return function(){var a=u.object.position;c.copy(a).sub(u.target);c.applyQuaternion(d);y.setFromVector3(c);u.autoRotate&&H===Q.NONE&&(D.theta-=2*Math.PI/60/60*u.autoRotateSpeed);y.theta+=D.theta;y.phi+=D.phi;y.theta=Math.max(u.minAzimuthAngle,Math.min(u.maxAzimuthAngle,y.theta));y.phi=Math.max(u.minPolarAngle,Math.min(u.maxPolarAngle,y.phi));y.makeSafe();y.radius*=g;y.radius=Math.max(u.minDistance,Math.min(u.maxDistance,y.radius));u.target.add(n);c.setFromSpherical(y);c.applyQuaternion(f);a.copy(u.target).add(c);
  u.object.lookAt(u.target);!0===u.enableDamping?(D.theta*=1-u.dampingFactor,D.phi*=1-u.dampingFactor):D.set(0,0,0);g=1;n.set(0,0,0);return s||l.distanceToSquared(u.object.position)>J||8*(1-m.dot(u.object.quaternion))>J?(u.dispatchEvent(K),l.copy(u.object.position),m.copy(u.object.quaternion),s=!1,!0):!1}}();this.dispose=function(){u.domElement.removeEventListener("contextmenu",C,!1);u.domElement.removeEventListener("mousedown",m,!1);u.domElement.removeEventListener("wheel",t,!1);u.domElement.removeEventListener("touchstart",
  v,!1);u.domElement.removeEventListener("touchend",I,!1);u.domElement.removeEventListener("touchmove",A,!1);document.removeEventListener("mousemove",r,!1);document.removeEventListener("mouseup",q,!1);window.removeEventListener("keydown",x,!1)};var u=this,K={type:"change"},w={type:"start"},W={type:"end"},Q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},H=Q.NONE,J=1E-6,y=new THREE.Spherical,D=new THREE.Spherical,g=1,n=new THREE.Vector3,s=!1,S=new THREE.Vector2,V=new THREE.Vector2,
  da=new THREE.Vector2,ea=new THREE.Vector2,ba=new THREE.Vector2,ha=new THREE.Vector2,N=new THREE.Vector2,fa=new THREE.Vector2,ma=new THREE.Vector2,ia=function(){var a=new THREE.Vector3;return function(c,d){a.setFromMatrixColumn(d,0);a.multiplyScalar(-c);n.add(a)}}(),M=function(){var a=new THREE.Vector3;return function(c,d){a.setFromMatrixColumn(d,1);a.multiplyScalar(c);n.add(a)}}(),la=function(){var a=new THREE.Vector3;return function(c,d){var f=u.domElement===document?u.domElement.body:u.domElement;
  if(u.object instanceof THREE.PerspectiveCamera){a.copy(u.object.position).sub(u.target);var g=a.length(),g=g*Math.tan(u.object.fov/2*Math.PI/180);ia(2*c*g/f.clientHeight,u.object.matrix);M(2*d*g/f.clientHeight,u.object.matrix)}else u.object instanceof THREE.OrthographicCamera?(ia(c*(u.object.right-u.object.left)/u.object.zoom/f.clientWidth,u.object.matrix),M(d*(u.object.top-u.object.bottom)/u.object.zoom/f.clientHeight,u.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),
  u.enablePan=!1)}}();u.domElement.addEventListener("contextmenu",C,!1);u.domElement.addEventListener("mousedown",m,!1);u.domElement.addEventListener("wheel",t,!1);u.domElement.addEventListener("touchstart",v,!1);u.domElement.addEventListener("touchend",I,!1);u.domElement.addEventListener("touchmove",A,!1);window.addEventListener("keydown",x,!1);this.update()};THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype);THREE.OrbitControls.prototype.constructor=THREE.OrbitControls;
  Object.defineProperties(THREE.OrbitControls.prototype,{center:{get:function(){console.warn("THREE.OrbitControls: .center has been renamed to .target");return this.target}},noZoom:{get:function(){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.");return!this.enableZoom},set:function(a){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.");this.enableZoom=!a}},noRotate:{get:function(){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.");
  return!this.enableRotate},set:function(a){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.");this.enableRotate=!a}},noPan:{get:function(){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.");return!this.enablePan},set:function(a){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.");this.enablePan=!a}},noKeys:{get:function(){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.");
  return!this.enableKeys},set:function(a){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.");this.enableKeys=!a}},staticMoving:{get:function(){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.");return!this.enableDamping},set:function(a){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.");this.enableDamping=!a}},dynamicDampingFactor:{get:function(){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.");
  return this.dampingFactor},set:function(a){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.");this.dampingFactor=a}}});THREE.BVHLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.animateBoneRotations=this.animateBonePositions=!0};
  THREE.BVHLoader.prototype={constructor:THREE.BVHLoader,load:function(a,c,d,f){var l=this;(new THREE.FileLoader(l.manager)).load(a,function(a){c(l.parse(a))},d,f)},parse:function(a){function c(a,d,f){if("ENDSITE"!==f.type){var l={time:d,position:new THREE.Vector3,rotation:new THREE.Quaternion};f.frames.push(l);for(var m=new THREE.Quaternion,r=new THREE.Vector3(1,0,0),C=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,0,1),K=0;K<f.channels.length;K++)switch(f.channels[K]){case "Xposition":l.position.x=
  parseFloat(a.shift().trim());break;case "Yposition":l.position.y=parseFloat(a.shift().trim());break;case "Zposition":l.position.z=parseFloat(a.shift().trim());break;case "Xrotation":m.setFromAxisAngle(r,parseFloat(a.shift().trim())*Math.PI/180);l.rotation.multiply(m);break;case "Yrotation":m.setFromAxisAngle(C,parseFloat(a.shift().trim())*Math.PI/180);l.rotation.multiply(m);break;case "Zrotation":m.setFromAxisAngle(u,parseFloat(a.shift().trim())*Math.PI/180);l.rotation.multiply(m);break;default:console.warn("THREE.BVHLoader: Invalid channel type.")}for(K=
  0;K<f.children.length;K++)c(a,d,f.children[K])}}function d(a,c,f){var m={name:"",type:"",frames:[]};f.push(m);c=c.split(/[\s]+/);"END"===c[0].toUpperCase()&&"SITE"===c[1].toUpperCase()?(m.type="ENDSITE",m.name="ENDSITE"):(m.name=c[1],m.type=c[0].toUpperCase());"{"!==l(a)&&console.error("THREE.BVHLoader: Expected opening { after type & name");c=l(a).split(/[\s]+/);"OFFSET"!==c[0]&&console.error("THREE.BVHLoader: Expected OFFSET but got: "+c[0]);4!==c.length&&console.error("THREE.BVHLoader: Invalid number of values for OFFSET.");
  c=new THREE.Vector3(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));(isNaN(c.x)||isNaN(c.y)||isNaN(c.z))&&console.error("THREE.BVHLoader: Invalid values of OFFSET.");m.offset=c;if("ENDSITE"!==m.type){c=l(a).split(/[\s]+/);"CHANNELS"!==c[0]&&console.error("THREE.BVHLoader: Expected CHANNELS definition.");var r=parseInt(c[1]);m.channels=c.splice(2,r);m.children=[]}for(;;){c=l(a);if("}"===c)return m;m.children.push(d(a,c,f))}}function f(a,c){var d=new THREE.Bone;c.push(d);d.position.add(a.offset);
  d.name=a.name;if("ENDSITE"!==a.type)for(var l=0;l<a.children.length;l++)d.add(f(a.children[l],c));return d}function l(a){for(var c;0===(c=a.shift().trim()).length;);return c}var m=this,r=function(a){"HIERARCHY"!==l(a)&&console.error("THREE.BVHLoader: HIERARCHY expected.");var f=[],m=d(a,l(a),f);"MOTION"!==l(a)&&console.error("THREE.BVHLoader: MOTION expected.");var r=l(a).split(/[\s]+/),A=parseInt(r[1]);isNaN(A)&&console.error("THREE.BVHLoader: Failed to read number of frames.");var r=l(a).split(/[\s]+/),
  I=parseFloat(r[2]);isNaN(I)&&console.error("THREE.BVHLoader: Failed to read frame time.");for(var C=0;C<A;C++)r=l(a).split(/[\s]+/),c(r,C*I,m);return f}(a.split(/[\r\n]+/g));a=[];this.toBone?this.toBone(r[0],a):f(r[0],a);r=function(a){for(var c=[],d=0;d<a.length;d++){var f=a[d];if("ENDSITE"!==f.type){for(var l=[],r=[],C=[],u=0;u<f.frames.length;u++){var K=f.frames[u];l.push(K.time);r.push(K.position.x+f.offset.x);r.push(K.position.y+f.offset.y);r.push(K.position.z+f.offset.z);C.push(K.rotation.x);
  C.push(K.rotation.y);C.push(K.rotation.z);C.push(K.rotation.w)}m.animateBonePositions&&c.push(new THREE.VectorKeyframeTrack(".bones["+f.name+"].position",l,r));m.animateBoneRotations&&c.push(new THREE.QuaternionKeyframeTrack(".bones["+f.name+"].quaternion",l,C))}}return new THREE.AnimationClip("animation",-1,c)}(r);return{skeleton:new THREE.Skeleton(a),clip:r}}};THREE.BVHLoader.prototype.toBone=function(a,c){var d=new THREE.Bone;c.push(d);d.position.add(a.offset);var f=this.transposeName(a.name);if("rShin"===f||"rFoot"===f)d.userData.offset=a.offset;d.name=f;if("ENDSITE"!==a.type)for(f=0;f<a.children.length;f++)d.add(this.toBone(a.children[f],c));return d};
  THREE.BVHLoader.prototype.transposeName=function(a){if("Hips"===a||"SpineBase"===a)a="hip";if("upperback"===a||"Spine1"===a||"SpineBase2"===a)a="abdomen";if("Chest"===a||"SpineMid"===a)a="chest";if("Neck"===a||"Neck2"===a)a="neck";"Head"===a&&(a="head");if("RightCollar"===a||"CollarRight"===a)a="rCollar";if("RightShoulder"===a||"ShoulderRight"===a)a="rShldr";if("RightElbow"===a||"ElbowRight"===a)a="rForeArm";if("RightHand"===a||"HandRight"===a)a="rHand";if("LeftCollar"===a||"CollarLeft"===a)a="lCollar";
  if("LeftShoulder"===a||"ShoulderLeft"===a)a="lShldr";"LeftElbow"===a|"ElbowLeft"===a&&(a="lForeArm");if("LeftHand"===a||"HandLeft"===a)a="lHand";if("RightHip"===a||"HipRight"===a)a="rThigh";if("RightKnee"===a||"KneeRight"===a)a="rShin";if("RightAnkle"===a||"AnkleRight"===a||"RightFoot"===a||"FootRight"===a)a="rFoot";if("RightToe"===a||"RightLeft"===a)a="rToe";if("LeftHip"===a||"HipLeft"===a)a="lThigh";if("LeftKnee"===a||"KneeLeft"===a)a="lShin";if("LeftAnkle"===a||"AnkleLeft"===a||"LeftFoot"===a||
  "LeftRight"===a)a="lFoot";if("LeftToe"===a||"ToeLeft"===a)a="lToe";return a};THREE.BVHLoader.prototype.parseData=function(a){return"string"===typeof a||a instanceof String?this.parse(a):this.parse((new TextDecoder("utf-8")).decode(new Uint8Array(a)))};THREE.BVHLoader.prototype.findTime=function(a,c){var d=a.length,f,l,m=0;for(f=0;f<d;f++){l=a[f];if(l>c)break;m=f}return m};
  THREE.BVHLoader.prototype.findSize=function(a,c){var d=0.5,f=c.getBoneByName("hip"),l=c.getBoneByName("rThigh"),m=c.getBoneByName("rShin"),r=c.getBoneByName("rFoot");if(void 0!==f&&void 0!==l&&void 0!==m&&void 0!==r){d=0;d=[];if(m.userData.offset)d[1]=new THREE.Vector3,d[2]=m.userData.offset.clone(),d[3]=r.userData.offset.clone(),d=d[1].distanceTo(d[2])+d[1].distanceTo(d[3]);else{var q=new THREE.Vector3;f.updateMatrixWorld(!0);d[1]=l.getWorldPosition(q.clone());d[2]=m.getWorldPosition(q.clone());
  d[3]=r.getWorldPosition(q.clone());d=d[1].distanceTo(d[2])+d[2].distanceTo(d[3])}d=1*(this.sizes[a.name]/d).toFixed(2)}else console.log("Bad bvh name = unexpected result !!");return d};
  THREE.BVHLoader.prototype.addModel=function(a,c){void 0===this.tPose&&(this.tPose={});void 0===this.sizes&&(this.sizes={});var d=a.name,f=a.skeleton.bones,l=f.length,m,r,q,t=new THREE.Vector3,x=[],v=[];for(m=0;m<l;m++)r=f[m],r.parent&&(r.userData.id=f.indexOf(r.parent)),void 0!==c&&this.renameBone(r,c.names),q=-1,"rThigh"===r.name&&(q=1),"rShin"===r.name&&(q=2),"rFoot"===r.name&&(q=3),-1!==q&&(v[q]=r.getWorldPosition(t.clone())),x.push(r.matrixWorld.clone());this.tPose[d]=x;this.sizes[d]=v[1].distanceTo(v[2])+
  v[2].distanceTo(v[3])};THREE.BVHLoader.prototype.renameBone=function(a,c){for(var d in c)a.name===d&&(a.name=c[d])};
  THREE.BVHLoader.prototype.applyToModel=function(a,c,d,f){var l=this.tPose[a.name];f=f||new THREE.Vector3;var m=this.findSize(a,c.skeleton),r=c.clip,q,t,x,v,A,I,C,u,K;c=THREE.AnimationUtils;var w=a.skeleton.bones,W=r.tracks,Q=[],H,J,y,D,g=(new THREE.Matrix4).getInverse(a.matrixWorld),n=new THREE.Quaternion,s=new THREE.Vector3,S=new THREE.Matrix4,V=new THREE.Matrix4,da,ea=new THREE.Quaternion,ba=new THREE.Vector3,ha=new THREE.Vector3;t=w.length;for(v=0;v<t;++v)C=w[v],u=C.name,"root"===u&&C.matrixWorld.copy(l[v]),
  "hip"===u&&C.matrixWorld.copy(l[v]),Q[v]=this.findBoneTrack(u,W);var N=Math.floor(1E3*r.frameTime),fa=1/30;33===N&&(fa=1/30);16===N&&(fa=1/60);11===N&&(fa=1/90);8===N&&(fa=1/120);var ma=r.name,ia=0;x=q=J=ia=u=0;var N=1,M,r=[[r.name,0,r.frames]];void 0!==d&&d.length&&(r=d);d=r.length;for(I=0;I<d;I++){ma=r[I][0];ia=r[I][1];u=r[I][2];N=void 0!==r[I][3]?r[I][3]:1;ia*=fa;J=u*fa;K=[];t=w.length;for(v=0;v<t;v++)if(C=w[v],u=C.name,"hip"===u&&(M=v),2===Q[v].length){da=C.parent?l[C.userData.id]:g;A=Q[v][1];
  q=this.findTime(W[A].times,ia);x=this.findTime(W[A].times,J)+1;C=c.arraySlice(W[A].times,q,x);y=c.arraySlice(W[A].values,4*q,4*x);D=[];H=[];q=C.length;for(A=0;A<q;A++)H[A]=C[A]-ia,x=4*A,n.set(y[x],y[x+1],y[x+2],y[x+3]),S.identity().makeRotationFromQuaternion(n),S.multiply(l[v]),V.identity().getInverse(da),V.multiply(S),V.decompose(ba,ea,ha),ea.normalize(),D[x]=ea.x,D[x+1]=ea.y,D[x+2]=ea.z,D[x+3]=ea.w;0<H.length&&K.push(new THREE.QuaternionKeyframeTrack(".bones["+u+"].quaternion",H,D))}v=M;C=w[v];
  u=C.name;if(2===Q[v].length){da=C.parent?C.parent.matrixWorld:g;t=Q[v][0];q=this.findTime(W[t].times,ia);x=this.findTime(W[t].times,J)+1;C=c.arraySlice(W[t].times,q,x);J=c.arraySlice(W[t].values,3*q,3*x);H=[];t=[];q=C.length;for(A=0;A<q;A++)H[A]=C[A]-ia,x=3*A,s.set(J[x],J[x+1],J[x+2]),s.multiplyScalar(m),s.add(f),S.identity(),S.setPosition(s),V.identity().getInverse(da),V.multiply(S),V.decompose(ba,ea,ha),t[x]=ba.x,t[x+1]=ba.y,t[x+2]=ba.z;0<H.length&&K.push(new THREE.VectorKeyframeTrack(".bones["+
  u+"].position",H,t))}ma=new THREE.AnimationClip(ma,-1,K);ma.frameTime=fa;ma.repeat=1===N?!0:!1;ma.timeScale=1;if(a.addAnimation)a.addAnimation(ma);else return ma}};THREE.BVHLoader.prototype.findBoneTrack=function(a,c){for(var d,f,l=[],m=0;m<c.length;++m)d=c[m].name,f=d.substring(d.indexOf("[")+1,d.indexOf("]")),d=d.substring(d.lastIndexOf(".")+1),a===f&&("position"===d?l[0]=m:l[1]=m);return l};Math.torad=0.017453292519943295;Math.todeg=57.29577951308232;Math.Pi=3.141592653589793;Math.TwoPI=6.283185307179586;Math.PI90=1.570796326794896;Math.PI270=4.712388980384689;Math.inv255=0.003921569;Math.golden=10.166407384630519;Math.int=function(a){return Math.floor(a)};Math.lerp=function(a,c,d){return(1-d)*a+d*c};Math.rand=function(a,c){return a+Math.random()*(c-a)};Math.randInt=function(a,c){return a+Math.floor(Math.random()*(c-a+1))};
  Math.seed=function(a){return function(){a=1E4*Math.sin(a);return a-Math.floor(a)}};Math.seed1=Math.seed(32);Math.seed2=Math.seed(Math.seed1());Math.ranSeed=Math.seed(Math.seed2());Math.randFix=function(a,c){return a+Math.ranSeed()*(c-a)};Math.randIntFix=function(a,c){return a+Math.floor(Math.ranSeed()*(c-a+1))};Math.rot2d=function(a,c,d){a=a||{x:0,y:0};var f={};f.x=c*Math.cos(d*Math.torad)+a.x;f.y=c*Math.sin(d*Math.torad)+a.y;f.z=a.z;return f};
  Math.dist2d=function(a,c){var d=c.x-a.x,f=c.y-a.y;return Math.sqrt(d*d+f*f)};Math.colorDistance=function(a,c){var d=a[0]-c[0],f=a[1]-c[1],l=a[2]-c[2];return Math.sqrt(d*d+f*f+l*l)};Math.rgbToHex=function(a){return"0x"+("000000"+(255*a[0]<<16^255*a[1]<<8^255*a[2]<<0).toString(16)).slice(-6)};
  Math.hslToRgb=function(a,c,d){a/=255;c/=255;d/=255;if(0==c)d=c=a=d;else{var f=0.5>d?d*(1+c):d+c-d*c,l=2*d-f;d=Math.hue2rgb(l,f,a+1/3);c=Math.hue2rgb(l,f,a);a=Math.hue2rgb(l,f,a-1/3)}return[Math.round(255*d),Math.round(255*c),Math.round(255*a)]};Math.hue2rgb=function(a,c,d){0>d&&(d+=1);1<d&&(d-=1);return d<1/6?a+6*(c-a)*d:0.5>d?c:d<2/3?a+(c-a)*(2/3-d)*6:a};
  Math.rgbToHsl=function(a,c,d){a/=255;c/=255;d/=255;var f=Math.max(a,c,d),l=Math.min(a,c,d),m,r=0.5*(f+l);if(f==l)m=l=0;else{var q=f-l,l=0.5<r?q/(2-f-l):q/(f+l);switch(f){case a:m=(c-d)/q+(c<d?6:0);break;case c:m=(d-a)/q+2;break;case d:m=(a-c)/q+4}m/=6}return[Math.round(255*m),Math.round(255*l),Math.round(255*r)]};
  Math.orbit=function(a,c,d,f,l){var m={x:0,y:0,z:0};void 0===f&&(f={x:0,y:0,z:0});c*=Math.torad;a*=Math.torad;l?(m.x=d*Math.cos(c)*Math.cos(a),m.z=d*Math.cos(c)*Math.sin(a),m.y=d*Math.sin(c)):(m.x=d*Math.sin(c)*Math.cos(a),m.z=d*Math.sin(c)*Math.sin(a),m.y=d*Math.cos(c));void 0!==f&&(m.x+=f.x,m.y+=f.y,m.z+=f.z);return m};Math.sphericalToUv=function(a){var c={u:0,v:0};c.u=0.5+Math.atan2(a.x,a.z)/Math.TwoPI;c.v=0.5+Math.asin(a.y)/Math.Pi;return c};
  Math.spherical=function(a){var c={lat:0,lon:0},d=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z);c.lat=Math.asin(a.y/d)*Math.todeg;c.lon=Math.atan2(a.z,a.x)*Math.todeg;return c};var pool=function(){var a={},c=null,d=null,f=window.URL||window.webkitURL,l=0,m=0;return pool={load:function(a,f){c=[];l=("undefined"===typeof performance?Date:performance).now();"string"==typeof a||a instanceof String?c.push(a):c=c.concat(a);d=f||function(){};this.loadOne()},setAssetLoadTechnique:function(a){this.loading=a},reset:function(){d=a=null},get:function(c){return a[c]},getResult:function(){return a},meshByName:function(c){c=a[c];for(var d={},f=c.length;f--;)d[c[f].name]=c[f];return d},
  getMesh:function(c,d){for(var f=a[c],l=f.length;l--;)if(f[l].name===d)return f[l]},next:function(){c.shift();0===c.length?(m=("undefined"===typeof performance?Date:performance).now()-l,console.log("loading time v2:",Math.floor(m),"ms"),d(a)):this.loadOne()},loadOne:function(){var a=c[0],d=a.substring(a.lastIndexOf("/")+1,a.lastIndexOf(".")),f=a.substring(a.lastIndexOf(".")+1);this.loading(a,d,f)},progress:function(a,c){},loading:function(a,c,d){var f=this,l=new XMLHttpRequest;l.open("GET",a,!0);switch(d){case "sea":case "z":l.responseType=
  "arraybuffer";break;case "jpg":case "png":l.responseType="blob";break;case "bvh":case "BVH":l.responseType="text"}l.onprogress=function(a){a.lengthComputable&&f.progress(a.loaded,a.total)};l.onreadystatechange=function(){2!==l.readyState&&3!==l.readyState&&4===l.readyState&&(200===l.status||0===l.status?f.load_direct(l.response,c,d):console.error("Couldn't load ["+c+"] ["+l.status+"]"))};l.send(null)},load_direct:function(c,d,l){var m=this;switch(l){case "sea":var v=new THREE.SEA3D;v.onComplete=function(c){a[d]=
  v.meshes;m.next()};v.load(c);break;case "jpg":case "png":var A=new Image;A.onload=function(c){f.revokeObjectURL(A.src);a[d]=A;m.next()};A.src=f.createObjectURL(c);break;case "z":a[d]=SEA3D.File.LZMAUncompress(c);m.next();break;case "bvh":case "BVH":a[d]=c;m.next();break;case "glsl":a[d]=c;m.next();break;case "json":a[d]=JSON.parse(c),m.next()}},load_blob:function(c,d,f){var l=this,m=new FileReader;"png"===f||"jpg"===f?m.readAsDataURL(c):"json"===f||"glsl"===f?m.readAsText(c):m.readAsArrayBuffer(c);
  m.onload=function(c){switch(f){case "sea":var m=new THREE.SEA3D;m.onComplete=function(c){a[d]=m.meshes;l.next()};m.load(c.target.result);break;case "jpg":case "png":a[d]=new Image;a[d].src=c.target.result;l.next();break;case "z":a[d]=SEA3D.File.LZMAUncompress(c.target.result);l.next();break;case "bvh":case "BVH":a[d]=c.target.result;l.next();break;case "glsl":a[d]=c.target.result;l.next();break;case "json":a[d]=JSON.parse(c.target.result),l.next()}}}}}();var shader=function(){var a="#ifdef USE_MAP{vec4 texelColor = mapTexelToLinear( texture2D( map, vUv ) );{vec4 baseColor = texelColor;{#ifdef USE_BUMPMAP{vec4 texelColor2 = mapTexelToLinear( texture2D( bumpMap, vUv ) );{vec4 transitionTexel = vec4(0.0);{#ifdef USE_EMISSIVEMAP{transitionTexel = texture2D( emissiveMap, vUv );{float mixRatio = 0.0;{float threshold = 0.3;{mixRatio = bumpScale;{float r = mixRatio * (1.0 + threshold * 2.0) - threshold;{float mixf = clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0);{baseColor = mix( texelColor2, texelColor, mixf );{#else{baseColor = mix( texelColor2, texelColor, 1.0 - bumpScale );{#endif{#endif{diffuseColor *= baseColor;{#endif".split("{");
  return shader={init:function(){},change:function(c){var d,f;c.onBeforeCompile=function(c){f=c.vertexShader;d=c.fragmentShader;d=d.replace("#include <map_fragment>",a.join("\n"));d=d.replace("#include <alphamap_fragment>","");d=d.replace("#include <emissivemap_fragment>","");c.vertexShader=f;c.fragmentShader=d;return c}}}}();THREE.Skeleton.prototype.update=function(){var a=new THREE.Matrix4,c=new THREE.Matrix4,d=new THREE.Matrix4,f=new THREE.Vector3;new THREE.Vector3;new THREE.Vector3(1,1,1);var l=new THREE.Matrix4,m=new THREE.Matrix4,r=new THREE.Vector3,q=new THREE.Vector3;return function(){for(var t=this.bones,x=this.boneInverses,v=this.boneMatrices,A=this.boneTexture,I,C,u,K=0,w=t.length;K<w;K++){var W=(u=t[K])?u.matrixWorld:c;u.parent&&t[K].parent.isBone&&void 0!==u.userData.mesh&&(I=u.userData.mesh,r.setFromMatrixPosition(u.parent.matrixWorld),
  q.setFromMatrixPosition(W),C=r.distanceTo(q),"lFoot"===I.name||"rFoot"===I.name||"lToe"===I.name||"rToe"===I.name?m.makeTranslation(0.5*-C,0,-1):m.makeTranslation(0.5*-C,0,0),l.multiplyMatrices(u.parent.matrixWorld,m),I.position.setFromMatrixPosition(l),I.quaternion.setFromRotationMatrix(l),I.scale.x=C,I.updateMatrixWorld(!0));if(void 0!==u.scalling)for(W.scale(u.scalling),I=0,C=t[K].children.length;I<C;I++)d=W.clone(),d.multiply(u.children[I].matrix),u.children[I].matrixWorld.setPosition(f.setFromMatrixPosition(d));
  a.multiplyMatrices(W,x[K]);a.toArray(v,16*K)}void 0!==A&&(A.needsUpdate=!0)}}();var Model=function(a,c,d){void 0===d&&(d=!1);this.geoms={man:c.man.geometry.clone(),woman:c.woman.geometry.clone()};this.settings={type:"Standard",color:16777215,muscles:0.1,metalness:0.1,roughness:0.4,skinAlpha:0.1,oamap:1,lightmap:0.6,shininess:60,opacity:1,reflectivity:0.1};this.colorBonesName={"0x000000":"root","0x2d00c8":"hip","0x5200b2":"abdomen","0xa3001c":"chest","0xa20015":"neck","0xb00002":"head","0x0030ff":"rThigh","0x002bff":"rShin","0x0029ff":"rFoot","0x0022ff":"rToe","0x3030cf":"lThigh",
  "0x2b2bd6":"lShin","0x2929d8":"lFoot","0x2222dd":"lToe","0x0044ff":"rCollar","0x0040ff":"rShldr","0x003dff":"rForeArm","0xff5f01":"rHand","0x4444bb":"lCollar","0x4040bf":"lShldr","0x3d3dc4":"lForeArm","0x5f5fa1":"lHand","0x77778a":"lfinger00","0x7a7a85":"lfinger01","0x797988":"lfinger02","0x0077ff":"rfinger00","0x007aff":"rfinger01","0x0079ff":"rfinger02","0x666698":"lfinger10","0x65659b":"lfinger11","0x63639d":"lfinger12","0xff6601":"rfinger10","0xff6501":"rfinger11","0xff6301":"rfinger12","0x4e4eb1":"lfinger20",
  "0xff6c01":"lfinger21","0xff6b01":"rfinger22","0xff7101":"rfinger20","0x0050ff":"rfinger21","0x5252ad":"lfinger22","0x787886":"lfinger30","0x74748a":"lfinger31","0x72728c":"lfinger32","0xff7801":"rfinger30","0xff7401":"rfinger31","0xff7201":"rfinger32","0x7c7c83":"lfinger40","0x7f7f81":"lfinger41","0x7d7d83":"lfinger42","0x007cff":"rfinger40","0xff7e01":"rfinger41","0xff7d01":"rfinger42"};this.ref=c;this.isFirst=!0;this.debug=this.isSkin=!1;this.isLockHip=!0;this.isSkeleton=!1;this.center=null;this.breath=
  this.f=this.preTime=0;this.breathSide=-1;this.frameTime=this.frameMax=this.frame=0;this.currentPlay="";this.isMapReady=this.isPlay=!1;this.txt=null;this.type=a;this.mats=[];this.position=new THREE.Vector3;this.skell=null;this.hipPos=new THREE.Vector3;this.mesh="man"===a?c.man.clone():c.woman.clone();this.mesh.name=a;this.mtx=new THREE.Matrix4;this.matrixWorldInv=(new THREE.Matrix4).getInverse(this.mesh.matrixWorld);this.bones=this.mesh.skeleton.bones;var f,l,m=this.bones.length,r;this.poseMatrix=
  [];this.bonesNames=[];this.b={};for(a=0;a<m;a++){r=new THREE.Vector3(1,1,1);l=this.bones[a];f=l.name;l.name=f;if("man"!==this.type){if("lCollar"===f||"rCollar"===f)r=new THREE.Vector3(0.9,1,1);if("lShldr"===f||"rShldr"===f)r=new THREE.Vector3(0.96,1,1);if("lForeArm"===f||"rForeArm"===f)r=new THREE.Vector3(0.96,1,1);if("lHand"===f||"rHand"===f)r=new THREE.Vector3(0.95,0.95,0.95);if("lf"===f.substring(0,2)||"rf"===f.substring(0,2))r=new THREE.Vector3(0.95,1,1)}if("abdomen"===f||"chest"===f)r=new THREE.Vector3(1,
  1,1);null!==r&&(l.scalling=r);this.b[f]=l;this.bonesNames.push(f);this.poseMatrix[a]=l.matrixWorld.clone();"hip"===f&&this.hipPos.setFromMatrixPosition(this.poseMatrix[a])}this.mesh.userData.posY=this.hipPos.y;this.geometry=this.mesh.geometry;(this.isWithMorph=d||!1)&&(this.mesh.morphTargetInfluences[0]=1);this.headBoneLook=new THREE.Euler;this.eyeTarget=new THREE.Group;this.eyeTarget.position.set(-3.54,0,-10);this.eyes=new THREE.Group;this.eye_l=c.eye_left.clone();this.eye_r=c.eye_right.clone();
  this.eye_r.up.set(0,0,1);this.eyes.add(this.eye_l);this.eyes.add(this.eye_r);this.eyes.add(this.eyeTarget);this.eyes.matrix=this.b.head.matrixWorld;this.eyes.matrixAutoUpdate=!1;this.root=new THREE.Group;this.root.add(this.eyes);this.setMaterial();this.mesh.position.copy(this.position);"man"===this.type?c.man_extra&&(this.extra=c.man_extra.clone(),this.extra.material=this.mats[0],this.extra.skeleton=this.mesh.skeleton,this.root.add(this.extra)):c.man_extra&&(this.extra=c.woman_extra.clone(),this.extra.material=
  this.mats[0],this.extra.skeleton=this.mesh.skeleton,this.root.add(this.extra))};
  Model.prototype={removeTo:function(a){this.removeSkeleton();a.remove(this.mesh);a.remove(this.root);this.isFull=!1},addTo:function(a){this.isSkeleton&&this.addSkeleton();a.add(this.mesh);a.add(this.root);this.isFull=!0},addHelper:function(a){this.center=new THREE.Mesh(new THREE.CircleGeometry(25),new THREE.MeshBasicMaterial({color:65280,wireframe:!0}));this.center.geometry.applyMatrix((new THREE.Matrix4).makeRotationX(0.5*-Math.PI));this.root.add(this.center)},showSkeleton:function(a){a?this.addSkeleton():
  this.removeSkeleton()},removeSkeleton:function(){if(null!==this.skell){for(var a=this.skell.children.length;a--;)this.skell.remove(this.skell.children[a]);this.root.remove(this.skell);this.skell=null}},addSkeleton:function(){if(null===this.skell){var a="rThigh lThigh hip rCollar lCollar rfinger40 rfinger30 rfinger00 rfinger10 lfinger40 lfinger30 lfinger00 lfinger10".split(" ");this.skell=new THREE.Group;this.root.add(this.skell);var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.BoxBufferGeometry(1,
  1,1),l=new THREE.MeshBasicMaterial({color:16777215,wireframe:!0,depthTest:!0,depthWrite:!0});this.meshBones=[];for(var m=this.bones,r,q,t,x,v=0;v<m.length;v++)if(r=this.bones[v],x=r.name,r.parent&&r.parent.isBone&&-1===a.indexOf(x)){c.setFromMatrixPosition(r.parent.matrixWorld);d.setFromMatrixPosition(r.matrixWorld);t=c.distanceTo(d);q=new THREE.Mesh(f,l);q.userData.lng=t;q.name=r.parent.name;"lf"!==x.substring(0,2)&&"rf"!==x.substring(0,2)?(q.scale.y=2,q.scale.z=2):(q.scale.y=0.5,q.scale.z=0.5);
  if("rHand"===q.name||"lHand"===q.name)q.scale.y=2,q.scale.y=3;"head"===q.name&&(q.scale.y=5,q.scale.z=5);if("hip"===q.name||"abdomen"===q.name||"chest"===q.name)q.scale.y=10,q.scale.z=5;if("rCollar"===q.name||"lCollar"===q.name||"rShldr"===q.name||"lShldr"===q.name)q.scale.y=3,q.scale.z=3;if("rThigh"===q.name||"lThigh"===q.name)q.scale.y=4,q.scale.z=4;if("rShin"===q.name||"lShin"===q.name)q.scale.y=3,q.scale.z=3;if("lFoot"===q.name||"rFoot"===q.name||"lToe"===q.name||"rToe"===q.name)q.scale.y=3,q.scale.z=
  2;this.skell.add(q);r.userData.mesh=q}}},update:function(a){THREE.SEA3D.AnimationHandler.update(a);this.getAnimInfo();this.breathing();this.look();this.isLockHip&&(this.b.hip.position.z=0,this.b.hip.position.y=0);null!==this.center&&(this.center.position.copy(this.getHipPos()),this.center.position.y=0);gui&&gui.updateTimeBarre(this)},reset:function(){this.mesh.stopAll();var a,c,d=this.bones.length;for(a=0;a<d;a++)c=this.bones[a],c.matrixWorld.copy(this.poseMatrix[a])},setTimescale:function(a){this.mesh.setTimeScale(a)},
  stop:function(){this.mesh.stopAll();this.isPlay=!1},play:function(a,c,d,f){this.unPause();this.mesh.play(a,c,d,f)},playOne:function(a){this.mesh.play(this.currentPlay,0,a*this.frameTime,1);this.pause()},pause:function(){this.mesh.pauseAll();this.isPlay=!1},unPause:function(){this.mesh.unPauseAll();this.isPlay=!0},getTime:function(){return this.mesh.currentAnimationAction?this.mesh.currentAnimationAction.time:!1},breathing:function(){this.b.chest&&this.b.abdomen&&(0<this.breathSide?(this.b.chest.scalling.z=
  Math.lerp(1,1.04,0.05*this.breath),this.b.chest.scalling.y=Math.lerp(1,1.02,0.05*this.breath),this.b.abdomen.scalling.z=Math.lerp(1,0.92,0.05*this.breath)):(this.b.chest.scalling.z=Math.lerp(1.04,1,0.05*this.breath),this.b.chest.scalling.y=Math.lerp(1.02,1,0.05*this.breath),this.b.abdomen.scalling.z=Math.lerp(0.92,1,0.05*this.breath)),this.breath++,20===this.breath&&(this.breath=0,this.breathSide=0<this.breathSide?-1:1))},look:function(){var a=view.getMouse();this.isPlay&&(this.headBoneLook.set(-(20*
  a.x)*Math.torad,20*a.y*Math.torad,0),this.b.head.quaternion.setFromEuler(this.headBoneLook,!1));this.eyeTarget.position.set(-3.54+3*-a.y,3*-a.x,-10);a=new THREE.Matrix4;a.lookAt(this.eyeTarget.position.clone().add(new THREE.Vector3(0,-1.4,0)),this.eye_l.position,this.eye_l.up);this.eye_l.quaternion.setFromRotationMatrix(a);a.lookAt(this.eyeTarget.position.clone().add(new THREE.Vector3(0,1.4,0)),this.eye_r.position,this.eye_r.up);this.eye_r.quaternion.setFromRotationMatrix(a)},getAnimInfo:function(){var a=
  this.mesh.currentAnimation;if(a){this.frameTime=a.clip.frameTime;var c=1/this.frameTime;this.frame=Math.round(this.mesh.currentAnimationAction.time*c);this.frameMax=Math.round(a.clip.duration*c);this.currentPlay=a.name}else this.frameMax=this.frame=0,this.currentPlay=""},getHipPos:function(){return this.b.hip.getWorldPosition()},setPosition:function(a){this.mesh.position.copy(this.position)},setDebug:function(a){this.debug=a;this.addHelper(this.debug);for(a=this.mats.length;a--;)this.mats[a].wireframe=
  this.debug},swapMaterial:function(a){a?(this.mesh.material=this.mats[2],this.mats[1].visible=!1):(this.mesh.material=this.mats[0],this.mats[1].visible=!0)},updateMaterial:function(){this.mats[0].needsUpdate=!0;this.mats[1].needsUpdate=!0;this.mats[2].needsUpdate=!0},setEnvmap:function(){this.mats[0].envMap=view.getEnvmap();this.mats[1].envMap=view.getEnvmap()},setMaterial:function(a){var c=this.settings;void 0!==a&&(c.type=a);var d="Mesh"+c.type+"Material";for(a=this.mats.length;a--;)this.mats[a].dispose();
  this.mats=[new THREE[d],new THREE[d],new THREE.MeshBasicMaterial];a=this.mats[0];void 0!==a.color&&(a.color=new THREE.Color(c.color));void 0!==a.normalScale&&(a.normalScale=new THREE.Vector2(c.muscles,c.muscles));void 0!==a.lightMapIntensity&&(a.lightMapIntensity=c.lightmap);void 0!==a.aoMapIntensity&&(a.aoMapIntensity=c.oamap);void 0!==a.metalness&&(a.metalness=c.metalness);void 0!==a.roughness&&(a.roughness=c.roughness);void 0!==a.shininess&&(a.shininess=c.shininess);void 0!==a.bumpScale&&(a.bumpScale=
  c.skinAlpha);void 0!==a.opacity&&(a.opacity=c.opacity);void 0!==a.transparent&&(a.transparent=!0);void 0!==a.reflectivity&&(a.reflectivity=c.reflectivity);void 0!==a.shadowSide&&(a.shadowSide=!1);void 0!==a.skinning&&(a.skinning=!0);void 0!==a.morphTargets&&this.isWithMorph&&(a.morphTargets=!0);a=this.mats[1];void 0!==a.normalScale&&(a.normalScale=new THREE.Vector2(0.5,0.5));void 0!==a.metalness&&(a.metalness=0.5);void 0!==a.roughness&&(a.roughness=0.1);void 0!==a.reflectivity&&(a.reflectivity=1);
  this.mesh.material=this.mats[0];this.eyes.children[0].material=this.mats[1];this.eyes.children[1].material=this.mats[1];a=this.mats[2];a.skinning=!0;shader.change(this.mats[0]);this.isMapReady&&this.setTextures()},setTextures:function(a,c){void 0!==a&&(this.txt=a);var d=this.mats[0];void 0!==d.map&&(d.map=c?this.txt.UV_Grid_Sm:this.txt.avatar_c);void 0!==d.envMap&&(d.envMap=view.getEnvmap());void 0!==d.normalMap&&(d.normalMap="man"===this.type?this.txt.avatar_n_m:this.txt.avatar_n_w);void 0!==d.lightMap&&
  (d.lightMap="man"===this.type?this.txt.avatar_l_m:this.txt.avatar_l_w);void 0!==d.aoMap&&(d.aoMap=this.txt.avatar_ao);void 0!==d.bumpMap&&(d.bumpMap=this.txt.muscular);d=this.mats[1];void 0!==d.map&&(d.map="man"===this.type?this.txt.eye_m:this.txt.eye_w);void 0!==d.envMap&&(d.envMap=view.getEnvmap());void 0!==d.normalMap&&(d.normalMap=this.txt.eye_n);void 0!==d.lightMap&&(d.lightMap=this.txt.eye_l);d=this.mats[2];d.map=this.txt.avatar_id;this.updateMaterial();this.isMapReady=!0},updateSetting:function(){var a=
  this.settings,c=this.mats[0];void 0!==c.color&&c.color.setHex(a.color);void 0!==c.normalScale&&c.normalScale.set(a.muscles,a.muscles);void 0!==c.aoMapIntensity&&(c.aoMapIntensity=a.oamap);void 0!==c.lightMapIntensity&&(c.lightMapIntensity=a.lightmap);void 0!==c.metalness&&(c.metalness=a.metalness);void 0!==c.roughness&&(c.roughness=a.roughness);void 0!==c.bumpScale&&(c.bumpScale=a.skinAlpha);void 0!==c.shininess&&(c.shininess=a.shininess);void 0!==c.opacity&&(c.opacity=a.opacity);void 0!==c.reflectivity&&
  (c.reflectivity=a.reflectivity)},setScale:function(a,c){null!==this.boneSelect&&(this.boneSelect.scale[a]=c)},setScalling:function(a,c){null!==this.boneSelect&&(this.boneSelect.scalling[a]=c)},hideBones:function(){this.boneSelect=null;this.mats[0].vertexColors=THREE.NoColors;this.mats[0].needsUpdate=!0},showBones:function(a){var c,d,f,l,m,r,q;d=!1;c=this.colorBonesName[a];console.log(a,c);"0x1100e5"===a&&(c="man"===this.type?"hip":"chest");void 0!==this.b[c]&&(d=!0);"root"===c&&(d=!1);if(d){this.boneSelect=
  this.b[c];a=this.bones.indexOf(this.boneSelect);this.mats[0].vertexColors=THREE.VertexColors;this.mats[0].needsUpdate=!0;gui&&gui.setBones(c,a,this.boneSelect.scalling);var t=this.geometry.attributes.color.array,x=this.geometry.attributes.skinIndex.array,v=this.geometry.attributes.skinWeight.array;d=t.length;for(c=0;c<d;c++)f=3*c,l=4*c,m=x[l]===a?v[l]:0,r=x[l+1]===a?v[l+1]:0,q=x[l+2]===a?v[l+2]:0,l=x[l+3]===a?v[l+3]:0,m=m+r+q+l,t[f]=1,t[f+1]=1-m,t[f+2]=1-m;this.geometry.attributes.color.needsUpdate=
  !0}else gui&&gui.setBones("none"),this.hideBones()}};var view=function(){var a,c,d,f,l,m,r,q,t,x,v,A=null,I=null,C=1,u=1,K=0,w=0,W=0,Q=0,H=0,J=0,y=!1,D=!1,g,n=null,s,S,V,da,ea,ba,ha,N,fa,ma="",ia="normal",M={gammaInput:!0,gammaOutput:!0,exposure:2.2,whitePoint:2.2,tone:"Uncharted2"},la;return view={isGL2:!1,framerate:60,pixelRatio:1,isMobile:!1,isShadow:!1,isGrid:!1,videoSize:[640,360],update:function(a){main.model&&main.model.update(a)},render:function(f){requestAnimationFrame(view.render);TWEEN.update();K=f;w=K-W;w>Q&&(W=K-w%Q,view.update(0.001*w),
  a.render(c,d),D&&I.capture(a.domElement),K-1E3>H&&(H=K,gui.setText(J+" "+ma),J=0),J++)},resize:function(c,f,g){C=window.innerWidth;u=window.innerHeight;f=f||C;g=g||u;a.setSize(f,g);d.aspect=f/g;d.updateProjectionMatrix();null!==n&&n.setSize(Math.floor(0.5*f),Math.floor(0.5*g));gui&&gui.resize()},setFramerate:function(a){view.framerate=a;Q=1E3/view.framerate},up:function(a){a.preventDefault();if(void 0!==V){S=view.getCurrentPosition();var c=Math.abs(V.polar-S.polar),d=Math.abs(V.azim-S.azim);5>c&&
  5>d&&(view.findMouse(a),view.pick())}},down:function(a){a.preventDefault();V=view.getCurrentPosition();view.findMouse(a)},move:function(a){a.preventDefault();view.findMouse(a)},findMouse:function(a){a.changedTouches?(s.x=a.changedTouches[0].pageX,s.y=a.changedTouches[0].pageY):(s.x=a.clientX,s.y=a.clientY);q.set(s.x/C*2-1,2*-(s.y/u)+1)},rayTest:function(){x.setFromCamera(q,d);var a=x.intersectObjects(v.children,!0),c;0<a.length&&(c=a[0].object.name,"man"===c||"wom"===c)&&(a=a[0].uv,c=Math.round(512*
  a.x),0>c&&(c+=512),t.set(c,Math.round(512*a.y)),a=view.getPixelValue(t),main.model.showBones(a),console.log(t,a))},initPickScene:function(){n=new THREE.WebGLRenderTarget(Math.floor(0.5*C),Math.floor(0.5*u));n.texture.minFilter=THREE.LinearFilter},pick:function(){if("bones"===ia){null===n&&view.initPickScene();var f=main.model;f.swapMaterial(!0);l.visible=!1;a.render(c,d,n);l.visible=!0;f.swapMaterial(!1);var g=new Uint8Array(4);a.readRenderTargetPixels(n,Math.floor(0.5*s.x),Math.floor(0.5*u)-Math.floor(0.5*
  s.y),1,1,g);g=Math.rgbToHex(g);f.showBones(g)}},setMode:function(a){"bones"===ia&&ia!==a&&main.model.hideBones();ia=a},getMode:function(){return ia},getRenderer:function(){return a},getControler:function(){return f},getCamera:function(){return d},getScene:function(){return c},getContent:function(){return v},getMouse:function(){return q},getDom:function(){return a.domElement},getSetting:function(){return M},getWebGL:function(a){var c=document.createElement("canvas"),d;c.style.cssText="position: absolute; top:0; left:0; width:100%; height:100%;";
  var f=!1,g={antialias:this.isMobile?!1:!0,alpha:this.isMobile?!1:!0,stencil:!1,depth:!0,precision:"highp",premultipliedAlpha:!0,preserveDrawingBuffer:!1};a||((d=c.getContext("webgl2",g))||(d=c.getContext("experimental-webgl2",g)),f=!!d);f||(d=c.getContext("webgl",g))||(d=c.getContext("experimental-webgl",g));g.canvas=c;g.context=d;ma=f?"GL2":"GL1";if(view.isGL2=f)d.v2=!0;return g},init:function(g,l){q=new THREE.Vector2;s=new THREE.Vector2;t=new THREE.Vector2;x=new THREE.Raycaster;la={None:THREE.NoToneMapping,
  Linear:THREE.LinearToneMapping,Reinhard:THREE.ReinhardToneMapping,Uncharted2:THREE.Uncharted2ToneMapping,Cineon:THREE.CineonToneMapping};Q=1E3/this.framerate;view.testMobile();C=window.innerWidth;u=window.innerHeight;a=new THREE.WebGLRenderer(view.getWebGL(l));view.pixelRatio=1;a.setPixelRatio(view.pixelRatio);a.setSize(C,u);a.domElement.style.position="absolute";g.appendChild(a.domElement);c=new THREE.Scene;d=new THREE.PerspectiveCamera(50,C/u,1,2E3);d.position.set(0,50,400);f=new THREE.OrbitControls(d,
  a.domElement);f.target.set(0,40,0);f.enableKeys=!1;f.update();v=new THREE.Group;c.add(v);r=new THREE.Group;c.add(r);a.setClearColor(2302755,1);window.addEventListener("resize",this.resize,!1);var m=a.domElement;m.addEventListener("mousedown",view.down,!1);m.addEventListener("mouseup",view.up,!1);m.addEventListener("mousemove",view.move,!1);m.addEventListener("touchstart",view.down,!1);m.addEventListener("touchend",view.up,!1);m.addEventListener("touchmove",view.move,!1);this.addLight();this.addShadow(this.isMobile?
  !1:!0);requestAnimationFrame(this.render);this.autoRotate({distance:100,polar:75,azim:15})},setPixelRatio:function(c){view.pixelRatio=c?0.5:1;a.setPixelRatio(view.pixelRatio)},addGrid:function(a){a?view.isGrid||(A=new THREE.GridHelper(200,20,16777215,5263440),A.material=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,transparent:!0,opacity:0.25,depthTest:!0,depthWrite:!1}),c.add(A),view.isGrid=!0):view.isGrid&&(c.remove(A),A.material.dispose(),A=null,view.isGrid=!1)},disableTone:function(c){a.gammaInput=
  !1;a.gammaOutput=!1;a.toneMapping=THREE.NoToneMapping},setTone:function(c){var d=["None","Linear","Reinhard","Uncharted2","Cineon"];a.gammaInput=M.gammaInput;a.gammaOutput=M.gammaOutput;var f=!1;void 0!==c&&(-1!==d.indexOf(c)&&(M.tone=c),f=!0);a.toneMapping=la[M.tone];a.toneMappingExposure=M.exposure;a.toneMappingWhitePoint=M.whitePoint;f&&main.updateMaterial()},addLight:function(){m=new THREE.DirectionalLight(16777215,0.5);m.position.set(50,300,100);m.lookAt(new THREE.Vector3(0,0,0));r.add(m);var a=
  new THREE.PointLight(16645629,0.4);a.position.set(75,25,58);a.position.multiplyScalar(10);r.add(a);a=new THREE.PointLight(12236986,0.2);a.position.set(-12,37,-79);a.position.multiplyScalar(10);r.add(a);a=new THREE.PointLight(13282940,0.1);a.position.set(30,78,52);a.position.multiplyScalar(10);r.add(a)},addShadow:function(c){c?view.isShadow||(view.isShadow=!0,a.shadowMap.enabled=!0,a.shadowMap.soft=view.isMobile?!1:!0,a.shadowMap.type=view.isMobile?THREE.BasicShadowMap:THREE.PCFSoftShadowMap,l=new THREE.Mesh(new THREE.PlaneBufferGeometry(200,
  200,1,1),new THREE.ShadowMaterial({opacity:0.3,depthTest:!0,depthWrite:!1})),l.geometry.applyMatrix((new THREE.Matrix4).makeRotationX(0.5*-Math.PI)),l.position.y=0.1,l.castShadow=!1,l.receiveShadow=!0,r.add(l),c=new THREE.OrthographicCamera(100,-100,100,-100,100,500),m.shadow=new THREE.LightShadow(c),m.shadow.mapSize.width=view.isMobile?512:1024,m.shadow.mapSize.height=view.isMobile?512:1024,m.castShadow=!0):view.isShadow&&(view.isShadow=!1,a.shadowMap.enabled=!1,m.castShadow=!1,r.remove(l),l.material.dispose(),
  l.geometry.dispose())},getCaptueMode:function(){return y},captureMode:function(c){(y=c)?(window.removeEventListener("resize",view.resize),a.domElement.style.position="absolute",a.domElement.style.left="50%",a.domElement.style.top="50%",a.domElement.style.border="1px solid #F00",view.setVideoSize(),view.initCapture()):(a.domElement.style.position="absolute",a.domElement.style.left="0px",a.domElement.style.top="0px",a.domElement.style.margin="0px 0px",a.domElement.style.border="none",window.addEventListener("resize",
  view.resize),view.resize())},setVideoSize:function(c){if(y){void 0!==c&&(view.videoSize=c);c=view.videoSize[0];var d=view.videoSize[1];a.domElement.style.margin=0.5*-d+"px "+0.5*-c+"px";view.resize(null,c,d)}},initCapture:function(){null===I&&(I=new CCapture({verbose:!1,display:!1,framerate:view.framerate,quality:80,format:"webm-mediarecorder",currentTime:0,timeLimit:4,frameLimit:0,autoSaveTime:0}),console.log(I))},startCapture:function(){y&&!D&&(a.setClearColor(65280,1),I.start(),D=!0)},saveCapture:function(){y&&
  D&&(I.stop(),I.save(),view.isMobile?a.setClearColor(16765952,1):a.setClearColor(0,0),D=!1)},testMobile:function(){var a=navigator.userAgent;a.match(/Android/i)||a.match(/webOS/i)||a.match(/iPhone/i)||a.match(/iPad/i)||a.match(/iPod/i)||a.match(/BlackBerry/i)||a.match(/Windows Phone/i)?view.isMobile=!0:view.isMobile=!1},extendGeometry:function(a){view.reversUV(a);view.addVertexColor(a)},reversUV:function(a){for(var c=a.attributes.uv.array,d=Math.floor(0.25*c.length);d--;)c[2*d]*=-1;a.attributes.uv.needsUpdate=
  !0;view.addUV2(a)},addVertexColor:function(a){for(var c=new THREE.Float32BufferAttribute(3*a.attributes.position.count,3),d=c.count,f;d--;)f=3*d,c[f]=1,c[f+1]=1,c[f+2]=1;a.addAttribute("color",c);a.attributes.color.needsUpdate=!0},addUV2:function(a){a.addAttribute("uv2",a.attributes.uv)},correctMorph:function(a,c,d){for(var f=0;f<a.length;f++)view.extendGeometry(d[c+"_"+a[f]].geometry),d[c].geometry.morphAttributes.position[f].array=d[c+"_"+a[f]].geometry.attributes.position.array,d[c].geometry.morphAttributes.normal[f].array=
  d[c+"_"+a[f]].geometry.attributes.normal.array},autoRotate:function(a,c,d,g){g=g||function(){};var l=view.getCurrentPosition();f.enabled=!1;(new TWEEN.Tween(l)).to(a,c||2E3).delay(d||0).easing(TWEEN.Easing.Quadratic.Out).onUpdate(function(){view.orbit(l)}).onComplete(function(){f.enabled=!0;g()}).start()},orbit:function(a){var c=a.polar*Math.torad,g=a.azim*Math.torad;f.target.set(a.x,a.y,a.z);d.position.copy(f.target);d.position.x+=a.distance*Math.sin(c)*Math.sin(g);d.position.y+=a.distance*Math.cos(c);
  d.position.z+=a.distance*Math.sin(c)*Math.cos(g);f.update()},getCurrentPosition:function(a){var c={},g=f.target,l=d.position;c.x=g.x;c.y=g.y;c.z=g.z;c.distance=Math.floor(l.distanceTo(g));c.polar=Math.floor(f.getPolarAngle()*Math.todeg);c.azim=Math.floor(f.getAzimuthalAngle()*Math.todeg);a&&console.log(JSON.stringify(c));return c},initCanvasId:function(a){var c=document.createElement("canvas");c.width=c.height=512;c=c.getContext("2d");c.drawImage(a,0,0);g=c.getImageData(0,0,512,512).data},getPixelValue:function(a){var c=
  [0,0,0,0],d=0;void 0!==g&&(a=4*(512*a.y+a.x),c[0]=g[a],c[1]=g[a+1],c[2]=g[a+2],c[3]=g[a+3],d=Math.rgbToHex(c));return d},getEnvmap:function(){return N},initSphereEnvmap:function(a){N=new THREE.Texture(a);N.mapping=THREE.SphericalReflectionMapping;N.needsUpdate=!0},showSky:function(a){fa.visible=a},initEnvScene:function(a){da=new THREE.Scene;ea=new THREE.CubeCamera(0.1,10,256);ea.renderTarget.texture.minFilter=THREE.LinearMipMapLinearFilter;ea.lookAt(new THREE.Vector3(0,0,5));da.add(ea);ba=new THREE.Texture(a);
  ba.wrapS=ba.wrapT=THREE.ClampToEdgeWrapping;ba.needsUpdate=!0;ha=new THREE.Mesh(new THREE.SphereGeometry(2,20,12),new THREE.MeshBasicMaterial({map:ba,depthWrite:!1}));ha.geometry.scale(-1,1,1);da.add(ha);fa=new THREE.Mesh(new THREE.SphereGeometry(1E3,20,12),ha.material);fa.geometry.scale(-1,1,1);c.add(fa);fa.visible=!1;view.renderEnvmap()},renderEnvmap:function(){view.disableTone();ea.update(a,da);N=ea.renderTarget.texture;view.setTone()},clear:function(a){for(var c=a.children.length;c--;)a.remove(a.children[c])}}}();var gui=function(){var a="close",c,d,f,l,m,r,q,t,x=!1,v="X VIEW ANIMATION MATERIAL BONES VIDEO".split(" "),A=!0,I,C,u,K;return gui={update:function(){"bones"===a&&gui.setBones("none");switch(a){case "view":gui.select(1);break;case "animation":gui.select(2);break;case "material":gui.select(3);break;case "bones":gui.select(4);break;case "video":gui.select(5)}},getDom:function(){return d},init:function(a){d=document.createElement("div");d.style.cssText="position:absolute; top:0; left:0; pointer-events:none; width:100%; height:100%; overflow:hidden; ";
  a.appendChild(d);q=document.createElement("div");q.style.cssText="position: absolute; bottom:50px; left:10px; pointer-events:auto; width:60px; height:90px; cursor:pointer;";r=document.createElement("div");r.style.cssText="position: absolute; top:0px; right:0px; color:#CCC; font-size: 14px; margin:0px 0px; padding: 0px 15px; line-height:40px; pointer-events:none; width:60px; height:40px; text-align: center; ";t=new Image;t.src="assets/textures/m.png";q.addEventListener("click",function(a){A?(A=!1,
  t.src="assets/textures/w.png"):(A=!0,t.src="assets/textures/m.png");main.switchModel()},!1);q.appendChild(t);f=document.createElement("div");f.style.cssText="position:absolute; top:40px; right:0; pointer-events:none; width:200px;";l=document.createElement("div");l.style.cssText="position: absolute; top:0px; left:0px; height:40px; width:100%; pointer-events:none; ";d.appendChild(q);d.appendChild(r);d.appendChild(f);d.appendChild(l);m=new Timebarre(d,"#db0bfa");for(a=0;a<v.length;a++)this.addButton(a);
  c=new UIL.Gui({w:200,bg:"rgba(23,23,23,0)",close:!1,parent:f,top:50,css:"right:0;"})},setText:function(a){r.innerHTML=a},addButton:function(a){var c=document.createElement("div");c.style.cssText="color:#CCC;  font-size: 14px;  margin:0px 0px; padding: 0px 15px; line-height:40px; position:relative; pointer-events:auto; height:40px; display:inline-block; text-align:center; cursor:pointer; transition:all 0.3s ease;";c.textContent=v[a];c.id=a;c.addEventListener("mouseover",function(a){this.style.color=
  "#FFF";this.style.background="rgba(153,153,153,0.5)"},!1);c.addEventListener("mouseout",function(a){this.style.color="#CCC";this.style.background="none"},!1);c.addEventListener("mousedown",function(a){gui.select(this.id)},!1);l.appendChild(c)},close:function(){x&&(a="close",f.style.display="none",x=!1)},open:function(){x||(f.style.display="block",x=!0)},select:function(a){view.setMode("normal");a=Number(a);c.clear();m.hide();gui.open();switch(a){case 0:gui.close();break;case 1:gui.view();break;case 2:gui.animation();
  break;case 3:gui.material();break;case 4:gui.bones();break;case 5:gui.video()}},view:function(){a="view";var d=view.getSetting();c.add("Bool",{name:"MID RESOLUTION",value:1===view.pixelRatio?!1:!0,p:60,bColor:"#929292",inh:14}).onChange(view.setPixelRatio);c.add("Bool",{name:"GRID",value:view.isGrid,p:60,bColor:"#929292",inh:14}).onChange(view.addGrid);c.add("Bool",{name:"SHADOW",value:view.isShadow,p:60,bColor:"#929292",inh:14}).onChange(view.addShadow);c.add("Bool",{name:"SKELETON",value:main.model.isSkeleton,
  p:60,bColor:"#929292",inh:14}).onChange(function(a){main.showSkeleton(a)});c.add("Bool",{name:"SKY",value:!1,p:60,bColor:"#929292",inh:14}).onChange(view.showSky);c.add("title",{name:" ",h:30});c.add(d,"gammaInput",{type:"Bool",fontColor:"#EEE",p:60,bColor:"#929292",inh:14}).onChange(function(){view.setTone("up")});c.add(d,"gammaOutput",{type:"Bool",fontColor:"#EEE",p:60,bColor:"#929292",inh:14}).onChange(function(){view.setTone("up")});c.add(d,"exposure",{min:0,max:10,precision:2,fontColor:"#fc4100"}).onChange(function(){view.setTone()});
  c.add(d,"whitePoint",{min:0,max:10,precision:1,fontColor:"#fc4100"}).onChange(function(){view.setTone()});c.add("list",{name:"type",bColor:"#b2b2b2",list:["None","Linear","Reinhard","Uncharted2","Cineon"],fontColor:"#333",value:d.tone,h:30}).onChange(function(a){view.setTone(a)})},video:function(){a="video";c.add("Bool",{name:"CAPTURE MODE",value:view.getCaptueMode(),p:60,bColor:"#929292",inh:14}).onChange(function(a){view.captureMode(a)});c.add("number",{name:"resolution",value:view.videoSize,precision:0,
  step:10}).onChange(view.setVideoSize);c.add("button",{name:"START",h:20,p:0}).onChange(function(){view.startCapture()});c.add("button",{name:"STOP",h:20,p:0}).onChange(function(){view.saveCapture()})},material:function(){a="material";var d=main.model,f=d.settings;c.add("list",{name:"type",width:100,list:"Basic Normal Depth Toon Lambert Phong Standard".split(" "),value:f.type,full:!0}).onChange(function(a){d.setMaterial(a)});c.add(f,"color",{type:"color",ctype:"hex",fontColor:"#D4B87B"}).onChange(gui.applyMaterial);
  c.add(f,"muscles",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial);c.add(f,"oamap",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial);c.add(f,"lightmap",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial);c.add(f,"metalness",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial);c.add(f,"roughness",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial);c.add(f,"skinAlpha",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial);c.add(f,"shininess",
  {min:0,max:200,fontColor:"#D4B87B",precision:0}).onChange(gui.applyMaterial);c.add(f,"opacity",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial);c.add(f,"reflectivity",{min:0,max:1,fontColor:"#D4B87B"}).onChange(gui.applyMaterial)},applyMaterial:function(){main.model.updateSetting()},bones:function(){a="bones";view.setMode("bones");I=c.add("title",{name:"Select bone in view",h:30,r:10});var d=main.model;C=c.add("slide",{name:"scale X",min:0,max:2,value:1,precision:2,fontColor:"#D4B87B",
  stype:1,bColor:"#999"}).onChange(function(a){d.setScalling("x",a)});u=c.add("slide",{name:"scale Y",min:0,max:2,value:1,precision:2,fontColor:"#D4B87B",stype:1,bColor:"#999"}).onChange(function(a){d.setScalling("y",a)});K=c.add("slide",{name:"scale Z",min:0,max:2,value:1,precision:2,fontColor:"#D4B87B",stype:1,bColor:"#999"}).onChange(function(a){d.setScalling("z",a)})},setBones:function(a,c,d){"none"===a?(I.text("Select bone in view"),I.text2(""),C.setValue(1),u.setValue(1),K.setValue(1)):(I.text(a),
  I.text2(c),C.setValue(d.x),u.setValue(d.y),K.setValue(d.z))},animation:function(){a="animation";c.add("slide",{name:"framerate",min:24,max:60,value:60,precision:0,step:1,stype:1}).onChange(view.setFramerate);c.add("slide",{name:"animation",min:-1,max:1,value:main.timescale,precision:2,stype:1}).onChange(main.setTimescale);c.add("Bool",{name:"LOCK HIP",value:main.model.isLockHip,p:60,bColor:"#929292",inh:14}).onChange(main.lockHip);c.add("button",{name:"LOAD BVH",fontColor:"#D4B87B",h:40,drag:!0,p:0}).onChange(main.loadAnimation);
  for(var d=main.animations,f,l=0;l<d.length;l++)f=d[l],c.add("button",{name:f,p:0}).onChange(function(a){main.model.play(a)});m.show()},addAnim:function(d){if("animation"===a)c.add("button",{name:d,p:0}).onChange(function(a){main.model.play(a)})},updateTimeBarre:function(a){m.isHide||(m.setTotalFrame(a.frameMax,a.frameTime),m.update(a.frame))},resize:function(){m&&m.resize()},inPlay:function(){m&&m.inPlay()}}}(),Timebarre=function(a,c){this.select=c;this.playIcon="<svg width='18px' height='17px'><path fill='#CCC' d='M 14 8 L 5 3 4 4 4 13 5 14 14 9 14 8 Z'/></svg>";
  this.pauseIcon="<svg width='18px' height='17px'><path fill='#CCC' d='M 14 4 L 13 3 11 3 10 4 10 13 11 14 13 14 14 13 14 4 M 8 4 L 7 3 5 3 4 4 4 13 5 14 7 14 8 13 8 4 Z'/></svg>";this.playing=!0;this.parent=a;this.down=!1;this.isHide=!0;this.width=window.innerWidth-80;this.ratio=this.frame=this.totalFrame=0;this.content=document.createElement("div");this.content.style.cssText="position:absolute; bottom:0; left:0px; width:100%; height:50px; pointer-events:none; display:none; ";this.parent.appendChild(this.content);
  this.timeInfo=document.createElement("div");this.timeInfo.style.cssText="position:absolute; bottom:36px; left:60px; width:200px; height:10px; pointer-events:none; color:#CCC; ";this.content.appendChild(this.timeInfo);this.timeline=document.createElement("div");this.timeline.style.cssText="position:absolute; bottom:20px; left:60px; width:"+this.width+"px; height:5px; border:3px solid rgba(255,255,255,0.2); pointer-events:auto; cursor:pointer;";this.content.appendChild(this.timeline);this.framer=document.createElement("div");
  this.framer.style.cssText="position:absolute; top:0px; left:0px; width:1px; height:5px; background:#CCC; pointer-events:none;";this.timeline.appendChild(this.framer);this.playButton=document.createElement("div");this.playButton.style.cssText="position:absolute; top:5px; left:10px; width:18px; height:18px; pointer-events:auto; cursor:pointer; border:3px solid rgba(255,255,255,0.2); padding: 5px 5px;";this.content.appendChild(this.playButton);this.playButton.innerHTML=this.playing?this.playIcon:this.pauseIcon;
  this.playButton.childNodes[0].childNodes[0].setAttribute("fill","#CCC");var d=this;this.timeline.addEventListener("mouseover",function(a){d.tOver(a)},!1);this.timeline.addEventListener("mouseout",function(a){d.tOut(a)},!1);this.timeline.addEventListener("mousedown",function(a){d.tDown(a)},!1);document.addEventListener("mouseup",function(a){d.tUp(a)},!1);document.addEventListener("mousemove",function(a){d.tMove(a)},!1);this.playButton.addEventListener("mousedown",function(a){d.play_down(a)},!1);this.playButton.addEventListener("mouseover",
  function(a){d.play_over(a)},!1);this.playButton.addEventListener("mouseout",function(a){d.play_out(a)},!1)};
  Timebarre.prototype={inPlay:function(a){this.playing=!0;this.playButton.innerHTML=this.playIcon},play_down:function(a){this.playing?(this.playing=!1,main.model.pause()):(this.playing=!0,main.model.unPause());this.playButton.innerHTML=this.playing?this.playIcon:this.pauseIcon},play_over:function(a){this.playButton.childNodes[0].childNodes[0].setAttribute("fill",this.select)},play_out:function(a){this.playButton.childNodes[0].childNodes[0].setAttribute("fill","#CCC")},show:function(){this.isHide&&(this.content.style.display=
  "block",this.isHide=!1)},hide:function(){this.isHide||(this.content.style.display="none",this.isHide=!0)},setTotalFrame:function(a,c){this.totalFrame=a;this.frameTime=c;this.ratio=this.totalFrame/this.width;this.timeInfo.innerHTML=this.totalFrame+" frames"},resize:function(a){this.width=window.innerWidth-80;this.timeline.style.width=this.width+"px";this.ratio=this.totalFrame/this.width},update:function(a){this.frame=a;this.timeInfo.innerHTML=this.frame+" / "+this.totalFrame;this.framer.style.width=
  this.frame/this.ratio+"px"},tOut:function(a){this.down||(this.framer.style.background="#CCC")},tOver:function(a){this.framer.style.background=this.select},tUp:function(a){this.down=!1;this.framer.style.background="#CCC"},tDown:function(a){this.down=!0;this.tMove(a);this.playing=!1;this.playButton.innerHTML=this.playing?this.playIcon:this.pauseIcon;this.framer.style.background=this.select},tMove:function(a){this.down&&(a=Math.floor((a.clientX-20)*this.ratio),0>a&&(a=0),a>this.totalFrame&&(a=this.totalFrame),
  this.frame=a,main.model.playOne(this.frame))}};var main=function(){var a=["bvh/base.z","models/avatar_test.sea"],c="envmap/studio.jpg avatar_id.png transition.png low/avatar_c.jpg low/avatar_ao.jpg low/avatar_n_m.jpg low/avatar_n_w.jpg low/avatar_skin_n_m.jpg low/avatar_skin_n_w.jpg low/avatar_l_m.jpg low/avatar_l_w.jpg low/muscular.png low/metalmuscl.jpg eye_m.png eye_w.png eye_n.png eye_l.png UV_Grid_Sm.jpg".split(" "),d,f,l,m,r=!1;return main={model:null,animations:[],timescale:0.5,init:function(a,c){view.init(a,c);gui.init(a);d=view.getContent();
  m=new THREE.BVHLoader;view.setTone();main.loadModel();var f=view.getDom();f.addEventListener("dragover",function(a){a.preventDefault()},!1);f.addEventListener("dragend",function(a){a.preventDefault()},!1);f.addEventListener("dragleave",function(a){a.preventDefault()},!1);f.addEventListener("drop",main.dropAnimation,!1)},dropAnimation:function(a){a.preventDefault();if(a.dataTransfer.items){a=a.dataTransfer.files[0];var c=new FileReader,d=a.name,f=d.substring(d.lastIndexOf(".")+1,d.length);if("z"===
  f||"hex"===f)c.readAsArrayBuffer(a);else if("bvh"===f||"BVH"===f)c.readAsText(a);else return;c.onload=function(a){main.loadAnimation(a.target.result,d,f)}.bind(this)}},loadModel:function(){for(var c=[],d=a.length;d--;)c[d]="./assets/"+a[d];pool.load(c,main.onLoadModel)},loadTextures:function(){for(var a=[],d=c.length;d--;)a[d]="./assets/textures/"+c[d];pool.load(a,main.onLoadTextures)},onLoadModel:function(a){var c=pool.meshByName("avatar_test");view.extendGeometry(c.man.geometry);view.extendGeometry(c.woman.geometry);
  f=new Model("man",c,!1);l=new Model("wom",c,!1);m.addModel(f.mesh);m.addModel(l.mesh);main.setTimescale();main.addAnimation("base",a.base);main.switchModel();main.model.play("idle");main.loadTextures()},onLoadTextures:function(a){for(var d={},m=c.length,r,A;m--;)r=c[m],r=r.substring(r.lastIndexOf("/")+1,r.lastIndexOf(".")),"studio"===r?view.initEnvScene(a[r]):(A=new THREE.Texture(a[r]),A.flipY=!1,A.wrapS="avatar_c"===r||"avatar_ao"===r||"muscular"===r?THREE.MirroredRepeatWrapping:THREE.RepeatWrapping,
  A.needsUpdate=!0,d[r]=A);f.setTextures(d);l.setTextures(d)},switchModel:function(){var a="",c=null;null!==main.model&&(c=main.model.settings,a=main.model.currentPlay,main.model.removeTo(d));r=r?!1:!0;main.model=r?f:l;null!==c&&(main.model.settings=c,main.model.updateSetting());main.model.addTo(d);gui.update();a&&main.model.play(a)},loadAnimation:function(a,c,d){if("z"===d||"hex"===d)a=SEA3D.File.LZMAUncompress(a);c=c.substring(0,c.lastIndexOf("."));main.applyAnimation(c,m.parseData(a))},addAnimation:function(a,
  c){main.applyAnimation(a,m.parseData(c))},applyAnimation:function(a,c){if(-1===main.animations.indexOf(a)){c.clip.name=a;var d=[];"base"===a&&(d=[["idle",5,25],["walk",325,355],["walk_side_r",360,390],["walk_diag_r",395,425],["walk_side_l",430,460],["walk_diag_l",465,495],["run",500,530],["run_side_r",535,565],["run_diag_r",570,600],["run_side_l",605,635],["run_diag_l",640,670],["crouch",675,705],["crouch_side_r",710,740],["crouch_diag_r",745,775],["crouch_side_l",780,810],["crouch_diag_l",815,845]]);
  m.applyToModel(f.mesh,c,d);m.applyToModel(l.mesh,c,d);if(d.length)for(var r=0;r<d.length;r++)main.animations.push(d[r][0]),gui.addAnim(d[r][0]);else main.model.play(a),main.animations.push(a),gui.addAnim(a)}},setTimescale:function(a){void 0!==a&&(main.timescale=a);f.setTimescale(main.timescale);l.setTimescale(main.timescale)},lockHip:function(a){f.isLockHip=a;l.isLockHip=a},updateMaterial:function(){f.updateMaterial();l.updateMaterial()},showSkeleton:function(a){f.isSkeleton=a;l.isSkeleton=a;main.model.showSkeleton(a)}}}();
  