Xenon4722-threejs/dist/saver.min.js

2 lines
635 KiB
JavaScript
Raw Blame History

var t;t=function(){"use strict";function t(){}function e(t,e){this.x=t||0,this.y=e||0}function n(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function i(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function r(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length}function o(t,n,i,a,s,c,l,u,h,p){Object.defineProperty(this,"id",{value:lc++}),this.uuid=ic.generateUUID(),this.name="",this.image=void 0!==t?t:o.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==n?n:o.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:Ba,this.wrapT=void 0!==a?a:Ba,this.magFilter=void 0!==s?s:Wa,this.minFilter=void 0!==c?c:qa,this.anisotropy=void 0!==h?h:1,this.format=void 0!==l?l:ss,this.type=void 0!==u?u:Xa,this.offset=new e(0,0),this.repeat=new e(1,1),this.center=new e(0,0),this.rotation=0,this.matrixAutoUpdate=1,this.matrix=new r,this.generateMipmaps=1,this.premultiplyAlpha=0,this.flipY=1,this.unpackAlignment=4,this.encoding=void 0!==p?p:js,this.version=0,this.onUpdate=null}function a(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function s(t,e,n){this.width=t,this.height=e,this.scissor=new a(0,0,t,e),this.scissorTest=0,this.viewport=new a(0,0,t,e),n=n||{},this.texture=new o(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==n.generateMipmaps?n.generateMipmaps:0,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Wa,this.depthBuffer=void 0!==n.depthBuffer?n.depthBuffer:1,this.stencilBuffer=void 0!==n.stencilBuffer?n.stencilBuffer:1,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function c(t,e,n){s.call(this,t,e,n),this.samples=4}function l(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length}function u(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._order=i||u.DefaultOrder}function h(){this.mask=1}function p(){var t,e,o,a;Object.defineProperty(this,"id",{value:xc++}),this.uuid=ic.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=p.DefaultUp.clone(),t=new i,e=new u,o=new n,a=new i(1,1,1),e._onChange(function(){o.setFromEuler(e,0)}),o._onChange(function(){e.setFromQuaternion(o,void 0,0)}),Object.defineProperties(this,{position:{configurable:1,enumerable:1,value:t},rotation:{configurable:1,enumerable:1,value:e},quaternion:{configurable:1,enumerable:1,value:o},scale:{configurable:1,enumerable:1,value:a},modelViewMatrix:{value:new l},normalMatrix:{value:new r}}),this.matrix=new l,this.matrixWorld=new l,this.matrixAutoUpdate=p.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=0,this.layers=new h,this.visible=1,this.castShadow=0,this.receiveShadow=0,this.frustumCulled=1,this.renderOrder=0,this.userData={}}function d(){p.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=1,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function f(t,e){this.min=void 0!==t?t:new i(1/0,1/0,1/0),this.max=void 0!==e?e:new i(-1/0,-1/0,-1/0)}function m(t,e,n,i,r){var o,a,s,c,l,u;for(o=0,a=t.length-3;o<=a;o+=3)if(Gc.fromArray(t,o),s=r.x*Math.abs(Gc.x)+r.y*Math.abs(Gc.y)+r.z*Math.abs(Gc.z),c=e.dot(Gc),l=n.dot(Gc),u=i.dot(Gc),Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return 0;return 1}function g(t,e){this.center=void 0!==t?t:new i,this.radius=void 0!==e?e:0}function v(t,e){this.origin=void 0!==t?t:new i,this.direction=void 0!==e?e:new i}function y(t,e,n){this.a=void 0!==t?t:new i,this.b=void 0!==e?e:new i,this.c=void 0!==n?n:new i}function x(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function b(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function _(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function w(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function M(t,e,n,r,o,a){this.a=t,this.b=e,this.c=n,this.normal=r&&r.isVector3?r:new i,this.vertexNormals=Array.isArray(r)?r:[],this.color=o&&o.isColor?o:new x,this.vertexColors=Array.isArray(o)?o:[],this.materialIndex=void 0!==a?a:0}function S(){Object.defineProperty(this,"id",{value:hl++}),this.uuid=ic.generateUUID(),this.name="",this.type="Material",this.fog=1,this.blending=Xo,this.side=Uo,this.flatShading=0,this.vertexTangents=0,this.vertexColors=Go,this.opacity=1,this.transparent=0,this.blendSrc=sa,this.blendDst=ca,this.blendEquation=Qo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=va,this.depthTest=1,this.depthWrite=1,this.stencilWriteMask=255,this.stencilFunc=tc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ks,this.stencilZFail=Ks,this.stencilZPass=Ks,this.stencilWrite=0,this.clippingPlanes=null,this.clipIntersection=0,this.clipShadows=0,this.shadowSide=null,this.colorWrite=1,this.precision=null,this.polygonOffset=0,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=0,this.alphaTest=0,this.premultipliedAlpha=0,this.visible=1,this.toneMapped=1,this.userData={},this.needsUpdate=1}function T(t){S.call(this),this.type="MeshBasicMaterial",this.color=new x(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=wa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.setValues(t)}function A(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=1==n,this.dynamic=0,this.updateRange={offset:0,count:-1},this.version=0}function L(t,e,n){A.call(this,new Int8Array(t),e,n)}function C(t,e,n){A.call(this,new Uint8Array(t),e,n)}function P(t,e,n){A.call(this,new Uint8ClampedArray(t),e,n)}function E(t,e,n){A.call(this,new Int16Array(t),e,n)}function N(t,e,n){A.call(this,new Uint16Array(t),e,n)}function O(t,e,n){A.call(this,new Int32Array(t),e,n)}function D(t,e,n){A.call(this,new Uint32Array(t),e,n)}function I(t,e,n){A.call(this,new Float32Array(t),e,n)}function z(t,e,n){A.call(this,new Float64Array(t),e,n)}function R(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=0,this.normalsNeedUpdate=0,this.colorsNeedUpdate=0,this.uvsNeedUpdate=0,this.groupsNeedUpdate=0}function F(t){var e,n,i;if(0===t.length)return-1/0;for(e=t[0],n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}function k(){Object.defineProperty(this,"id",{value:pl+=2}),this.uuid=ic.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function B(t,e){p.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new k,this.material=void 0!==e?e:new T({color:16777215*Math.random()}),this.drawMode=ks,this.updateMorphTargets()}function U(t,e,n,i,r,o,a,s){var c;return null===(e.side===jo?i.intersectTriangle(a,o,r,1,s):i.intersectTriangle(r,o,a,e.side!==Vo,s))?null:(zl.copy(s),zl.applyMatrix4(t.matrixWorld),(c=n.ray.origin.distanceTo(zl))<n.near||c>n.far?null:{distance:c,point:zl.clone(),object:t})}function j(t,n,i,r,o,a,s,c,l,u,h){var p,d,f,m,g,v,x;if(wl.fromBufferAttribute(o,l),Ml.fromBufferAttribute(o,u),Sl.fromBufferAttribute(o,h),p=t.morphTargetInfluences,n.morphTargets&&a&&p){for(Cl.set(0,0,0),Pl.set(0,0,0),El.set(0,0,0),d=0,f=a.length;d<f;d++)m=p[d],g=a[d],0!==m&&(Tl.fromBufferAttribute(g,l),Al.fromBufferAttribute(g,u),Ll.fromBufferAttribute(g,h),Cl.addScaledVector(Tl.sub(wl),m),Pl.addScaledVector(Al.sub(Ml),m),El.addScaledVector(Ll.sub(Sl),m));wl.add(Cl),Ml.add(Pl),Sl.add(El)}return(v=U(t,n,i,r,wl,Ml,Sl,Il))&&(s&&(Nl.fromBufferAttribute(s,l),Ol.fromBufferAttribute(s,u),Dl.fromBufferAttribute(s,h),v.uv=y.getUV(Il,wl,Ml,Sl,Nl,Ol,Dl,new e)),c&&(Nl.fromBufferAttribute(c,l),Ol.fromBufferAttribute(c,u),Dl.fromBufferAttribute(c,h),v.uv2=y.getUV(Il,wl,Ml,Sl,Nl,Ol,Dl,new e)),x=new M(l,u,h),y.getNormal(wl,Ml,Sl,x.normal),v.face=x),v}function V(){Object.defineProperty(this,"id",{value:Rl+=2}),this.uuid=ic.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=0,this.verticesNeedUpdate=0,this.uvsNeedUpdate=0,this.normalsNeedUpdate=0,this.colorsNeedUpdate=0,this.lineDistancesNeedUpdate=0,this.groupsNeedUpdate=0}function G(t){var e,n,i,r={};for(e in t)for(n in r[e]={},t[e])(i=t[e][n])&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?r[e][n]=i.clone():r[e][n]=Array.isArray(i)?i.slice():i;return r}function W(t){var e,n,i,r={};for(e=0;e<t.length;e++)for(i in n=G(t[e]))r[i]=n[i];return r}function H(t){S.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Ul,this.fragmentShader=jl,this.linewidth=1,this.wireframe=0,this.wireframeLinewidth=1,this.fog=0,this.lights=0,this.clipping=0,this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.extensions={derivatives:0,fragDepth:0,drawBuffers:0,shaderTextureLOD:0},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=0,void 0!==t&&(t.attributes,this.setValues(t))}function q(){p.call(this),this.type="Camera",this.matrixWorldInverse=new l,this.projectionMatrix=new l,this.projectionMatrixInverse=new l}function X(t,e,n,i){q.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Y(t,e,n,r){var o,a,s,c,l,u;p.call(this),this.type="CubeCamera",(o=new X(Vl,Gl,t,e)).up.set(0,-1,0),o.lookAt(new i(1,0,0)),this.add(o),(a=new X(Vl,Gl,t,e)).up.set(0,-1,0),a.lookAt(new i(-1,0,0)),this.add(a),(s=new X(Vl,Gl,t,e)).up.set(0,0,1),s.lookAt(new i(0,1,0)),this.add(s),(c=new X(Vl,Gl,t,e)).up.set(0,0,-1),c.lookAt(new i(0,-1,0)),this.add(c),(l=new X(Vl,Gl,t,e)).up.set(0,-1,0),l.lookAt(new i(0,0,1)),this.add(l),(u=new X(Vl,Gl,t,e)).up.set(0,-1,0),u.lookAt(new i(0,0,-1)),this.add(u),r=r||{format:as,magFilter:Wa,minFilter:Wa},this.renderTarget=new Z(n,n,r),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){var n,i,r;null===this.parent&&this.updateMatrixWorld(),n=t.getRenderTarget(),r=(i=this.renderTarget).texture.generateMipmaps,i.texture.generateMipmaps=0,t.setRenderTarget(i,0),t.render(e,o),t.setRenderTarget(i,1),t.render(e,a),t.setRenderTarget(i,2),t.render(e,s),t.setRenderTarget(i,3),t.render(e,c),t.setRenderTarget(i,4),t.render(e,l),i.texture.generateMipmaps=r,t.setRenderTarget(i,5),t.render(e,u),t.setRenderTarget(n)},this.clear=function(t,e,n,i){var r,o=t.getRenderTarget(),a=this.renderTarget;for(r=0;r<6;r++)t.setRenderTarget(a,r),t.clear(e,n,i);t.setRenderTarget(o)}}function Z(t,e,n){s.call(this,t,e,n)}function J(t,e,n,i,r,a,s,c,l,u,h,p){o.call(this,null,a,s,c,l,u,i,r,h,p),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ja,this.minFilter=void 0!==u?u:ja,this.generateMipmaps=0,this.flipY=0,this.unpackAlignment=1,this.needsUpdate=1}function $(t,e){this.normal=void 0!==t?t:new i(1,0,0),this.constant=void 0!==e?e:0}function Q(t,e,n,i,r,o){this.planes=[void 0!==t?t:new $,void 0!==e?e:new $,void 0!==n?n:new $,void 0!==i?i:new $,void 0!==r?r:new $,void 0!==o?o:new $]}function K(){function t(r,o){0!=n&&(i(r,o),e.requestAnimationFrame(t))}var e=null,n=0,i=null;return{start:function(){1!=n&&null!==i&&(e.requestAnimationFrame(t),n=1)},stop:function(){n=0},setAnimationLoop:function(t){i=t},setContext:function(t){e=t}}}function tt(t){var e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){n.isInterleavedBufferAttribute&&(n=n.data);var r=e.get(n);void 0===r?e.set(n,function(e,n){var i,r=e.array,o=e.dynamic?35048:35044,a=t.createBuffer();return t.bindBuffer(n,a),t.bufferData(n,r,o),e.onUploadCallback(),i=5126,r instanceof Float32Array?i=5126:r instanceof Float64Array||(r instanceof Uint16Array?i=5123:r instanceof Int16Array?i=5122:r instanceof Uint32Array?i=5125:r instanceof Int32Array?i=5124:r instanceof Int8Array?i=5120:r instanceof Uint8Array&&(i=5121)),{buffer:a,type:i,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(n,i)):r.version<n.version&&(function(e,n,i){var r=n.array,o=n.updateRange;t.bindBuffer(i,e),0==n.dynamic?t.bufferData(i,r,35044):-1===o.count?t.bufferSubData(i,0,r):0===o.count||(t.bufferSubData(i,o.offset*r.BYTES_PER_ELEMENT,r.subarray(o.offset,o.offset+o.count)),o.count=-1)}(r.buffer,n,i),r.version=n.version)}}}function et(t,e,n,i){V.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new nt(t,e,n,i)),this.mergeVertices()}function nt(t,e,n,i){var r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M;for(k.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i},r=(t=t||1)/2,o=(e=e||1)/2,c=(a=Math.floor(n)||1)+1,l=(s=Math.floor(i)||1)+1,u=t/a,h=e/s,f=[],m=[],g=[],v=[],d=0;d<l;d++)for(y=d*h-o,p=0;p<c;p++)x=p*u-r,m.push(x,-y,0),g.push(0,0,1),v.push(p/a),v.push(1-d/s);for(d=0;d<s;d++)for(p=0;p<a;p++)b=p+c*d,_=p+c*(d+1),w=p+1+c*(d+1),M=p+1+c*d,f.push(b,_,M),f.push(_,w,M);this.setIndex(f),this.addAttribute("position",new I(m,3)),this.addAttribute("normal",new I(g,3)),this.addAttribute("uv",new I(v,2))}function it(t,e,n,i){function r(t,n){e.buffers.color.setClear(t.r,t.g,t.b,n,i)}var o,a,s=new x(0),c=0,l=null,u=0;return{getClearColor:function(){return s},setClearColor:function(t,e){s.set(t),r(s,c=void 0!==e?e:1)},getClearAlpha:function(){return c},setClearAlpha:function(t){r(s,c=t)},render:function(e,i,h,p){var d,f=i.background,m=t.vr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?(r(s,c),l=null,u=0):f&&f.isColor&&(r(f,1),p=1,l=null,u=0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLRenderTargetCube)?(void 0===a&&((a=new B(new up(1,1,1),new H({type:"BackgroundCubeMaterial",uniforms:G($l.cube.uniforms),vertexShader:$l.cube.vertexShader,fragmentShader:$l.cube.fragmentShader,side:jo,depthTest:0,depthWrite:0,fog:0}))).geometry.removeAttribute("normal"),a.geometry.removeAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.tCube.value}}),n.update(a)),d=f.isWebGLRenderTargetCube?f.texture:f,a.material.uniforms.tCube.value=d,a.material.uniforms.tFlip.value=f.isWebGLRenderTargetCube?1:-1,l===f&&u===d.version||(a.material.needsUpdate=1,l=f,u=d.version),e.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===o&&((o=new B(new nt(2,2),new H({type:"BackgroundMaterial",uniforms:G($l.background.uniforms),vertexShader:$l.background.vertexShader,fragmentShader:$l.background.fragmentShader,side:Uo,depthTest:0,depthWrite:0,fog:0}))).geometry.removeAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=f,1==f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&u===f.version||(o.material.needsUpdate=1,l=f,u=f.version),e.unshift(o,o.geometry,o.material,0,0,null))}}}function rt(t,e,n,i){var r;this.setMode=function(t){r=t},this.render=function(e,i){t.drawArrays(r,e,i),n.update(i,r)},this.renderInstances=function(o,a,s,c){if(0!==c){var l,u;if(i.isWebGL2)l=t,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return;l[u](r,a,s,c),n.update(s,r,c)}}}function ot(t,e,n){function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var r,o,a,s,c="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,l=void 0!==n.precision?n.precision:"highp",u=i(l);return u!==l&&(l=u),{isWebGL2:c,getMaxAnisotropy:function(){if(void 0!==r)return r;var n=e.get("EXT_texture_filter_anisotropic");return r=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:l,logarithmicDepthBuffer:1==n.logarithmicDepthBuffer,maxTextures:t.getParameter(34930),maxVertexTextures:o=t.getParameter(35660),maxTextureSize:t.getParameter(3379),maxCubemapSize:t.getParameter(34076),maxAttributes:t.getParameter(34921),maxVertexUniforms:t.getParameter(36347),maxVaryings:t.getParameter(36348),maxFragmentUniforms:t.getParameter(36349),vertexTextures:a=o>0,floatFragmentTextures:s=c||!!e.get("OES_texture_float"),floatVertexTextures:a&&s,maxSamples:c?t.getParameter(36183):0}}function at(){function t(){u.value!==i&&(u.value=i,u.needsUpdate=o>0),n.numPlanes=o,n.numIntersection=0}function e(t,e,i,r){var o,a,s,h,p=null!==t?t.length:0,d=null;if(0!==p){if(d=u.value,1!=r||null===d)for(o=i+4*p,a=e.matrixWorldInverse,l.getNormalMatrix(a),(null===d||d.length<o)&&(d=new Float32Array(o)),s=0,h=i;s!==p;++s,h+=4)c.copy(t[s]).applyMatrix4(a,l),c.normal.toArray(d,h),d[h+3]=c.constant;u.value=d,u.needsUpdate=1}return n.numPlanes=p,d}var n=this,i=null,o=0,a=0,s=0,c=new $,l=new r,u={value:null,needsUpdate:0};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(t,n,r){var s=0!==t.length||n||0!==o||a;return a=n,i=e(t,r,0),o=t.length,s},this.beginShadows=function(){s=1,e(null)},this.endShadows=function(){s=0,t()},this.setState=function(n,r,c,l,h,p){var d,f,m,g;if(!a||null===n||0===n.length||s&&!c)s?e(null):t();else{for(f=4*(d=s?0:o),m=h.clippingState||null,u.value=m,m=e(n,l,f,p),g=0;g!==f;++g)m[g]=i[g];h.clippingState=m,this.numIntersection=r?this.numPlanes:0,this.numPlanes+=d}}}function st(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}}}function ct(t,e,n){function i(t){var r,s,c=t.target,l=o.get(c);for(r in null!==l.index&&e.remove(l.index),l.attributes)e.remove(l.attributes[r]);c.removeEventListener("dispose",i),o.delete(c),(s=a.get(l))&&(e.remove(s),a.delete(l)),n.memory.geometries--}function r(t){var n,i,r,o,s,c,l,u,h=[],p=t.index,d=t.attributes.position,f=0;if(null!==p)for(n=p.array,f=p.version,i=0,r=n.length;i<r;i+=3)o=n[i+0],s=n[i+1],c=n[i+2],h.push(o,s,s,c,c,o);else for(n=d.array,f=d.version,i=0,r=n.length/3-1;i<r;i+=3)o=i+0,s=i+1,c=i+2,h.push(o,s,s,c,c,o);(l=new(F(h)>65535?D:N)(h,1)).version=f,e.update(l,34963),(u=a.get(t))&&e.remove(u),a.set(t,l)}var o=new WeakMap,a=new WeakMap;return{get:function(t,e){var r=o.get(e);return r||(e.addEventListener("dispose",i),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new k).setFromObject(t)),r=e._bufferGeometry),o.set(e,r),n.memory.geometries++,r)},update:function(t){var n,i,r,o,a,s=t.index,c=t.attributes;for(n in null!==s&&e.update(s,34963),c)e.update(c[n],34962);for(n in i=t.morphAttributes)for(o=0,a=(r=i[n]).length;o<a;o++)e.update(r[o],34962)},getWireframeAttribute:function(t){var e,n=a.get(t);return n?null!==(e=t.index)&&n.version<e.version&&r(t):r(t),a.get(t)}}}function lt(t,e,n,i){var r,o,a;this.setMode=function(t){r=t},this.setIndex=function(t){o=t.type,a=t.bytesPerElement},this.render=function(e,i){t.drawElements(r,i,o,e*a),n.update(i,r)},this.renderInstances=function(s,c,l,u){if(0!==u){var h,p;if(i.isWebGL2)h=t,p="drawElementsInstanced";else if(p="drawElementsInstancedANGLE",null===(h=e.get("ANGLE_instanced_arrays")))return;h[p](r,l,o,c*a,u),n.update(l,r,u)}}}function ut(){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:1,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,i){switch(i=i||1,t.calls++,n){case 4:t.triangles+=i*(e/3);break;case 5:case 6:t.triangles+=i*(e-2);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e}}}}function ht(t,e){return Math.abs(e[1])-Math.abs(t[1])}function pt(t){var e={},n=new Float32Array(8);return{update:function(i,r,o,a){var s,c,l,u,h,p,d=i.morphTargetInfluences,f=d.length,m=e[r.id];if(void 0===m){for(m=[],s=0;s<f;s++)m[s]=[s,0];e[r.id]=m}for(c=o.morphTargets&&r.morphAttributes.position,l=o.morphNormals&&r.morphAttributes.normal,s=0;s<f;s++)0!==(u=m[s])[1]&&(c&&r.removeAttribute("morphTarget"+s),l&&r.removeAttribute("morphNormal"+s));for(s=0;s<f;s++)(u=m[s])[0]=s,u[1]=d[s];for(m.sort(ht),s=0;s<8;s++)(u=m[s])&&(h=u[0],p=u[1])?(c&&r.addAttribute("morphTarget"+s,c[h]),l&&r.addAttribute("morphNormal"+s,l[h]),n[s]=p):n[s]=0;a.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function dt(t,e,n,i){var r={};return{update:function(t){var o=i.render.frame,a=t.geometry,s=e.get(t,a);return r[s.id]!==o&&(a.isGeometry&&s.updateFromObject(t),e.update(s),r[s.id]=o),t.isInstancedMesh&&n.update(t.instanceMatrix,34962),s},dispose:function(){r={}}}}function ft(t,e,n,i,r,a,s,c,l,u){t=void 0!==t?t:[],e=void 0!==e?e:Na,s=void 0!==s?s:as,o.call(this,t,e,n,i,r,a,s,c,l,u),this.flipY=0}function mt(t,e,n,i){o.call(this,null),this.image={data:t||null,width:e||1,height:n||1,depth:i||1},this.magFilter=ja,this.minFilter=ja,this.wrapR=Ba,this.generateMipmaps=0,this.flipY=0,this.needsUpdate=1}function gt(t,e,n,i){o.call(this,null),this.image={data:t||null,width:e||1,height:n||1,depth:i||1},this.magFilter=ja,this.minFilter=ja,this.wrapR=Ba,this.generateMipmaps=0,this.flipY=0,this.needsUpdate=1}function vt(t,e,n){var i,r,o,a,s=t[0];if(s<=0||s>0)return t;if(void 0===(r=nu[i=e*n])&&(r=new Float32Array(i),nu[i]=r),0!==e)for(s.toArray(r,0),o=1,a=0;o!==e;++o)a+=n,t[o].toArray(r,a);return r}function yt(t,e){if(t.length!==e.length)return 0;for(var n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return 0;return 1}function xt(t,e){for(var n=0,i=e.length;n<i;n++)t[n]=e[n]}function bt(t,e){var n,i=iu[e];for(void 0===i&&(i=new Int32Array(e),iu[e]=i),n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function _t(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function wt(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(yt(n,e))return;t.uniform2fv(this.addr,e),xt(n,e)}}function Mt(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(yt(n,e))return;t.uniform3fv(this.addr,e),xt(n,e)}}function St(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(yt(n,e))return;t.uniform4fv(this.addr,e),xt(n,e)}}function Tt(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(yt(n,e))return;t.uniformMatrix2fv(this.addr,0,e),xt(n,e)}else{if(yt(n,i))return;au.set(i),t.uniformMatrix2fv(this.addr,0,au),xt(n,i)}}function At(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(yt(n,e))return;t.uniformMatrix3fv(this.addr,0,e),xt(n,e)}else{if(yt(n,i))return;ou.set(i),t.uniformMatrix3fv(this.addr,0,ou),xt(n,i)}}function Lt(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(yt(n,e))return;t.uniformMatrix4fv(this.addr,0,e),xt(n,e)}else{if(yt(n,i))return;ru.set(i),t.uniformMatrix4fv(this.addr,0,ru),xt(n,i)}}function Ct(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(e||Ql,r)}function Pt(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Kl,r)}function Et(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||tu,r)}function Nt(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(e||eu,r)}function Ot(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Dt(t,e){var n=this.cache;yt(n,e)||(t.uniform2iv(this.addr,e),xt(n,e))}function It(t,e){var n=this.cache;yt(n,e)||(t.uniform3iv(this.addr,e),xt(n,e))}function zt(t,e){var n=this.cache;yt(n,e)||(t.uniform4iv(this.addr,e),xt(n,e))}function Rt(t,e){t.uniform1fv(this.addr,e)}function Ft(t,e){t.uniform1iv(this.addr,e)}function kt(t,e){t.uniform2iv(this.addr,e)}function Bt(t,e){t.uniform3iv(this.addr,e)}function Ut(t,e){t.uniform4iv(this.addr,e)}function jt(t,e){var n=vt(e,this.size,2);t.uniform2fv(this.addr,n)}function Vt(t,e){var n=vt(e,this.size,3);t.uniform3fv(this.addr,n)}function Gt(t,e){var n=vt(e,this.size,4);t.uniform4fv(this.addr,n)}function Wt(t,e){var n=vt(e,this.size,4);t.uniformMatrix2fv(this.addr,0,n)}function Ht(t,e){var n=vt(e,this.size,9);t.uniformMatrix3fv(this.addr,0,n)}function qt(t,e){var n=vt(e,this.size,16);t.uniformMatrix4fv(this.addr,0,n)}function Xt(t,e,n){var i,r=e.length,o=bt(n,r);for(t.uniform1iv(this.addr,o),i=0;i!==r;++i)n.safeSetTexture2D(e[i]||Ql,o[i])}function Yt(t,e,n){var i,r=e.length,o=bt(n,r);for(t.uniform1iv(this.addr,o),i=0;i!==r;++i)n.safeSetTextureCube(e[i]||eu,o[i])}function Zt(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(){switch(e.type){case 5126:return _t;case 35664:return wt;case 35665:return Mt;case 35666:return St;case 35674:return Tt;case 35675:return At;case 35676:return Lt;case 35678:case 36198:return Ct;case 35679:return Et;case 35680:return Nt;case 36289:return Pt;case 5124:case 35670:return Ot;case 35667:case 35671:return Dt;case 35668:case 35672:return It;case 35669:case 35673:return zt}}()}function Jt(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(){switch(e.type){case 5126:return Rt;case 35664:return jt;case 35665:return Vt;case 35666:return Gt;case 35674:return Wt;case 35675:return Ht;case 35676:return qt;case 35678:return Xt;case 35680:return Yt;case 5124:case 35670:return Ft;case 35667:case 35671:return kt;case 35668:case 35672:return Bt;case 35669:case 35673:return Ut}}()}function $t(t){this.id=t,this.seq=[],this.map={}}function Qt(t,e){t.seq.push(e),t.map[e.id]=e}function Kt(t,e,n){var i,r,o,a,s,c=t.name,l=c.length;for(su.lastIndex=0;;){if(i=su.exec(c),r=su.lastIndex,o=i[1],"]"===i[2]&&(o|=0),void 0===(a=i[3])||"["===a&&r+2===l){Qt(n,void 0===a?new Zt(o,t,e):new Jt(o,t,e));break}void 0===(s=n.map[o])&&Qt(n,s=new $t(o)),n=s}}function te(t,e){var n,i,r;for(this.seq=[],this.map={},n=t.getProgramParameter(e,35718),i=0;i<n;++i)Kt(r=t.getActiveUniform(e,i),t.getUniformLocation(e,r.name),this)}function ee(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}function ne(t){switch(t){case js:return["Linear","( value )"];case Vs:return["sRGB","( value )"];case Ws:return["RGBE","( value )"];case qs:return["RGBM","( value, 7.0 )"];case Xs:return["RGBM","( value, 16.0 )"];case Ys:return["RGBD","( value, 256.0 )"];case Gs:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case Hs:return["LogLuv","( value )"];default:throw Error("unsupported encoding: "+t)}}function ie(t,e,n){var i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(){var n,i=t.getShaderSource(e).split("\n");for(n=0;n<i.length;n++)i[n]=n+1+": "+i[n];return i.join("\n")}()}function re(t,e){var n=ne(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function oe(t,e){var n;switch(e){case Aa:n="Linear";break;case La:n="Reinhard";break;case Ca:n="Uncharted2";break;case Pa:n="OptimizedCineon";break;case Ea:n="ACESFilmic";break;default:throw Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function ae(t){return""!==t}function se(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ce(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function le(t){return t.replace(lu,ue)}function ue(t,e){var n=Zl[e];if(void 0===n)throw Error("Can not resolve #include <"+e+">");return le(n)}function he(t){return t.replace(uu,pe)}function pe(t,e,n,i){var r,o="";for(r=parseInt(e);r<parseInt(n);r++)o+=i.replace(/\[ i \]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return o}function de(t){var e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function fe(t,e,n,i,r,o){var a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w=t.getContext(),M=i.defines,S=r.vertexShader,T=r.fragmentShader,A=function(t){var e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Fo?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===ko?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Bo&&(e="SHADOWMAP_TYPE_VSM"),e}(o),L=function(t,e){var n="ENVMAP_TYPE_CUBE";if(t.envMap)switch(e.envMap.mapping){case Na:case Oa:n="ENVMAP_TYPE_CUBE";break;case Ra:case Fa:n="ENVMAP_TYPE_CUBE_UV";break;case Da:case Ia:n="ENVMAP_TYPE_EQUIREC";break;case za:n="ENVMAP_TYPE_SPHERE"}return n}(o,i),C=function(t,e){var n="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(e.envMap.mapping){case Oa:case Ia:n="ENVMAP_MODE_REFRACTION"}return n}(o,i),P=function(t,e){var n="ENVMAP_BLENDING_MULTIPLY";if(t.envMap)switch(e.combine){case wa:n="ENVMAP_BLENDING_MULTIPLY";break;case Ma:n="ENVMAP_BLENDING_MIX";break;case Sa:n="ENVMAP_BLENDING_ADD"}return n}(o,i),E=t.gammaFactor>0?t.gammaFactor:1,N=o.isWebGL2?"":function(t,e,n){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ae).join("\n")}(i.extensions,o,e),O=function(t){var e,n,i=[];for(e in t)0!=(n=t[e])&&i.push("#define "+e+" "+n);return i.join("\n")}(M),D=w.createProgram(),I=t.getRenderTarget(),z=I&&I.isWebGLMultiviewRenderTarget?I.numViews:0;return i.isRawShaderMaterial?((a=[O].filter(ae).join("\n")).length>0&&(a+="\n"),(s=[N,O].filter(ae).join("\n")).length>0&&(s+="\n")):(a=[de(o),"#define SHADER_NAME "+r.name,O,o.instancing?"#define USE_INSTANCING":"",o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+E,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp2?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+C:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.normalMap&&o.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",o.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexTangents?"#define USE_TANGENT":"",o.vertexColors?"#define USE_COLOR":"",o.vertexUvs?"#define USE_UV":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&0==o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+A:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(o.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;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ae).join("\n"),s=[N,de(o),"#define SHADER_NAME "+r.name,O,o.alphaTest?"#define ALPHATEST "+o.alphaTest+(o.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+E,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp2?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.matcap?"#define USE_MATCAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+L:"",o.envMap?"#define "+C:"",o.envMap?"#define "+P:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.normalMap&&o.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",o.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.sheen?"#define USE_SHEEN":"",o.vertexTangents?"#define USE_TANGENT":"",o.vertexColors?"#define USE_COLOR":"",o.vertexUvs?"#define USE_UV":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+A:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensions&&i.extensions.shaderTextureLOD||o.envMap)&&(o.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==Ta?"#define TONE_MAPPING":"",o.toneMapping!==Ta?Zl.tonemapping_pars_fragment:"",o.toneMapping!==Ta?oe("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.matcapEncoding||o.envMapEncoding||o.emissiveMapEncoding?Zl.encodings_pars_fragment:"",o.mapEncoding?re("mapTexelToLinear",o.mapEncoding):"",o.matcapEncoding?re("matcapTexelToLinear",o.matcapEncoding):"",o.envMapEncoding?re("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?re("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?("linearToOutputTexel",b=o.outputEncoding,_=ne(b),"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+_[0]+_[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(ae).join("\n")),S=ce(S=se(S=le(S),o),o),T=ce(T=se(T=le(T),o),o),S=he(S),T=he(T),o.isWebGL2&&!i.isRawShaderMaterial&&(c=0,l=/^\s*#version\s+300\s+es\s*\n/,i.isShaderMaterial&&null!==S.match(l)&&null!==T.match(l)&&(c=1,S=S.replace(l,""),T=T.replace(l,"")),a="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+a,s=["#version 300 es\n\n#define varying in",c?"":"out highp vec4 pc_fragColor;",c?"":"#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"+s,z>0&&(a=(a=a.replace("#version 300 es\n",["#version 300 es\n\n#extension GL_OVR_multiview2 : require","layout(num_views = "+z+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace("uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;",["uniform mat4 modelViewMatrices["+z+"];","uniform mat4 projectionMatrices["+z+"];","uniform mat4 viewMatrices["+z+"];","uniform mat3 normalMatrices["+z+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]\n#define projectionMatrix projectionMatrices[VIEW_ID]\n#define viewMatrix viewMatrices[VIEW_ID]\n#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),s=(s=s.replace("#version 300 es\n","#version 300 es\n\n#extension GL_OVR_multiview2 : require\n#define VIEW_ID gl_ViewID_OVR")).replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+z+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n")))),u=s+T,h=ee(w,35633,a+S),p=ee(w,35632,u),w.attachShader(D,h),w.attachShader(D,p),void 0!==i.index0AttributeName?w.bindAttribLocation(D,0,i.index0AttributeName):1==o.morphTargets&&w.bindAttribLocation(D,0,"position"),w.linkProgram(D),t.debug.checkShaderErrors&&(d=w.getProgramInfoLog(D).trim(),f=w.getShaderInfoLog(h).trim(),m=w.getShaderInfoLog(p).trim(),g=1,v=1,0==w.getProgramParameter(D,35714)?(g=0,ie(w,h,"vertex"),ie(w,p,"fragment")):""!==d||""!==f&&""!==m||(v=0),v&&(this.diagnostics={runnable:g,material:i,programLog:d,vertexShader:{log:f,prefix:a},fragmentShader:{log:m,prefix:s}})),w.deleteShader(h),w.deleteShader(p),this.getUniforms=function(){return void 0===y&&(y=new te(w,D)),y},this.getAttributes=function(){return void 0===x&&(x=function(t,e){var n,i,r={},o=t.getProgramParameter(e,35721);for(n=0;n<o;n++)r[i=t.getActiveAttrib(e,n).name]=t.getAttribLocation(e,i);return r}(w,D)),x},this.destroy=function(){w.deleteProgram(D),this.program=void 0},this.name=r.name,this.id=cu++,this.code=n,this.usedTimes=1,this.program=D,this.vertexShader=h,this.fragmentShader=p,this.numMultiviewViews=z,this}function me(t,e,n){function i(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(n=t.texture.encoding):n=js,n===js&&e&&(n=Gs),n}var r=[],o={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"},a=["precision","supportsVertexTextures","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","fog","useFog","fogExp2","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","sheen"];this.getParameters=function(e,r,a,s,c,l,u){var h,p=o[e.type],d=u.isSkinnedMesh?function(t){var e,i,r=t.skeleton.bones;return n.floatVertexTextures?1024:(e=n.maxVertexUniforms,(i=Math.min(Math.floor((e-20)/4),r.length))<r.length?0:i)}(u):0,f=n.precision;return null!==e.precision&&(f=n.getMaxPrecision(e.precision),e.precision),h=t.getRenderTarget(),{isWebGL2:n.isWebGL2,shaderID:p,precision:f,instancing:1==u.isInstancedMesh,supportsVertexTextures:n.vertexTextures,outputEncoding:i(h?h.texture:null,t.gammaOutput),map:!!e.map,mapEncoding:i(e.map,t.gammaInput),matcap:!!e.matcap,matcapEncoding:i(e.matcap,t.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:i(e.envMap,t.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===Ra||e.envMap.mapping===Fa),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:i(e.emissiveMap,t.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===Qs,tangentSpaceNormalMap:e.normalMapType===$s,clearcoatNormalMap:!!e.clearcoatNormalMap,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,sheen:!!e.sheen,combine:e.combine,vertexTangents:e.normalMap&&e.vertexTangents,vertexColors:e.vertexColors,vertexUvs:!!(e.map||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e.emissiveMap||e.roughnessMap||e.metalnessMap||e.clearcoatNormalMap),fog:!!s,useFog:e.fog,fogExp2:s&&s.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:n.logarithmicDepthBuffer,skinning:e.skinning&&d>0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numDirLightShadows:r.directionalShadowMap.length,numPointLightShadows:r.pointShadowMap.length,numSpotLightShadows:r.spotShadowMap.length,numClippingPlanes:c,numClipIntersection:l,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&a.length>0,shadowMapType:t.shadowMap.type,toneMapping:e.toneMapped?t.toneMapping:Ta,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===Vo,flipSided:e.side===jo,depthPacking:void 0!==e.depthPacking?e.depthPacking:0}},this.getProgramCode=function(e,n){var i,r,o=[];if(n.shaderID?o.push(n.shaderID):(o.push(e.fragmentShader),o.push(e.vertexShader)),void 0!==e.defines)for(i in e.defines)o.push(i),o.push(e.defines[i]);for(r=0;r<59;r++)o.push(n[a[r]]);return o.push(e.onBeforeCompile.toString()),o.push(t.gammaOutput),o.push(t.gammaFactor),o.join()},this.acquireProgram=function(n,i,o,a){var s,c,l,u;for(c=0,l=r.length;c<l;c++)if((u=r[c]).code===a){++(s=u).usedTimes;break}return void 0===s&&(s=new fe(t,e,a,n,i,o),r.push(s)),s},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r}function ge(){var t=new WeakMap;return{get:function(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function ve(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function ye(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function xe(){function t(t,i,r,a,s,c){var l=e[n];return void 0===l?(l={id:t.id,object:t,geometry:i,material:r,program:r.program||o,groupOrder:a,renderOrder:t.renderOrder,z:s,group:c},e[n]=l):(l.id=t.id,l.object=t,l.geometry=i,l.material=r,l.program=r.program||o,l.groupOrder=a,l.renderOrder=t.renderOrder,l.z=s,l.group=c),n++,l}var e=[],n=0,i=[],r=[],o={id:-1};return{opaque:i,transparent:r,init:function(){n=0,i.length=0,r.length=0},push:function(e,n,o,a,s,c){var l=t(e,n,o,a,s,c);(1==o.transparent?r:i).push(l)},unshift:function(e,n,o,a,s,c){var l=t(e,n,o,a,s,c);(1==o.transparent?r:i).unshift(l)},sort:function(){i.length>1&&i.sort(ve),r.length>1&&r.sort(ye)}}}function be(){function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}var e=new WeakMap;return{get:function(n,i){var r,o=e.get(n);return void 0===o?(r=new xe,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=o.get(i))&&(r=new xe,o.set(i,r)),r},dispose:function(){e=new WeakMap}}}function _e(){var t={};return{get:function(n){if(void 0!==t[n.id])return t[n.id];var r;switch(n.type){case"DirectionalLight":r={direction:new i,color:new x,shadow:0,shadowBias:0,shadowRadius:1,shadowMapSize:new e};break;case"SpotLight":r={position:new i,direction:new i,color:new x,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:0,shadowBias:0,shadowRadius:1,shadowMapSize:new e};break;case"PointLight":r={position:new i,color:new x,distance:0,decay:0,shadow:0,shadowBias:0,shadowRadius:1,shadowMapSize:new e,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":r={direction:new i,skyColor:new x,groundColor:new x};break;case"RectAreaLight":r={color:new x,position:new i,halfWidth:new i,halfHeight:new i}}return t[n.id]=r,r}}}function we(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Me(){var t,e,n,r,o=new _e,a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1};for(t=0;t<9;t++)a.probe.push(new i);return e=new i,n=new l,r=new l,{setup:function(t,i,s){var c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A,L,C=0,P=0,E=0;for(c=0;c<9;c++)a.probe[c].set(0,0,0);for(l=0,u=0,h=0,p=0,d=0,f=0,m=0,g=0,v=s.matrixWorldInverse,t.sort(we),c=0,y=t.length;c<y;c++)if(b=(x=t[c]).color,_=x.intensity,w=x.distance,M=x.shadow&&x.shadow.map?x.shadow.map.texture:null,x.isAmbientLight)C+=b.r*_,P+=b.g*_,E+=b.b*_;else if(x.isLightProbe)for(S=0;S<9;S++)a.probe[S].addScaledVector(x.sh.coefficients[S],_);else x.isDirectionalLight?((T=o.get(x)).color.copy(x.color).multiplyScalar(x.intensity),T.direction.setFromMatrixPosition(x.matrixWorld),e.setFromMatrixPosition(x.target.matrixWorld),T.direction.sub(e),T.direction.transformDirection(v),T.shadow=x.castShadow,x.castShadow&&(A=x.shadow,T.shadowBias=A.bias,T.shadowRadius=A.radius,T.shadowMapSize=A.mapSize,a.directionalShadowMap[l]=M,a.directionalShadowMatrix[l]=x.shadow.matrix,f++),a.directional[l]=T,l++):x.isSpotLight?((T=o.get(x)).position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(v),T.color.copy(b).multiplyScalar(_),T.distance=w,T.direction.setFromMatrixPosition(x.matrixWorld),e.setFromMatrixPosition(x.target.matrixWorld),T.direction.sub(e),T.direction.transformDirection(v),T.coneCos=Math.cos(x.angle),T.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),T.decay=x.decay,T.shadow=x.castShadow,x.castShadow&&(A=x.shadow,T.shadowBias=A.bias,T.shadowRadius=A.radius,T.shadowMapSize=A.mapSize,a.spotShadowMap[h]=M,a.spotShadowMatrix[h]=x.shadow.matrix,g++),a.spot[h]=T,h++):x.isRectAreaLight?((T=o.get(x)).color.copy(b).multiplyScalar(_),T.position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(v),r.identity(),n.copy(x.matrixWorld),n.premultiply(v),r.extractRotation(n),T.halfWidth.set(.5*x.width,0,0),T.halfHeight.set(0,.5*x.height,0),T.halfWidth.applyMatrix4(r),T.halfHeight.applyMatrix4(r),a.rectArea[p]=T,p++):x.isPointLight?((T=o.get(x)).position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(v),T.color.copy(x.color).multiplyScalar(x.intensity),T.distance=x.distance,T.decay=x.decay,T.shadow=x.castShadow,x.castShadow&&(A=x.shadow,T.shadowBias=A.bias,T.shadowRadius=A.radius,T.shadowMapSize=A.mapSize,T.shadowCameraNear=A.camera.near,T.shadowCameraFar=A.camera.far,a.pointShadowMap[u]=M,a.pointShadowMatrix[u]=x.shadow.matrix,m++),a.point[u]=T,u++):x.isHemisphereLight&&((T=o.get(x)).direction.setFromMatrixPosition(x.matrixWorld),T.direction.transformDirection(v),T.direction.normalize(),T.skyColor.copy(x.color).multiplyScalar(_),T.groundColor.copy(x.groundColor).multiplyScalar(_),a.hemi[d]=T,d++);a.ambient[0]=C,a.ambient[1]=P,a.ambient[2]=E,(L=a.hash).directionalLength===l&&L.pointLength===u&&L.spotLength===h&&L.rectAreaLength===p&&L.hemiLength===d&&L.numDirectionalShadows===f&&L.numPointShadows===m&&L.numSpotShadows===g||(a.directional.length=l,a.spot.length=h,a.rectArea.length=p,a.point.length=u,a.hemi.length=d,a.directionalShadowMap.length=f,a.pointShadowMap.length=m,a.spotShadowMap.length=g,a.directionalShadowMatrix.length=f,a.pointShadowMatrix.length=m,a.spotShadowMatrix.length=g,L.directionalLength=l,L.pointLength=u,L.spotLength=h,L.rectAreaLength=p,L.hemiLength=d,L.numDirectionalShadows=f,L.numPointShadows=m,L.numSpotShadows=g,a.version=hu++)},state:a}}function Se(){var t=new Me,e=[],n=[];return{init:function(){e.length=0,n.length=0},state:{lightsArray:e,shadowsArray:n,lights:t},setupLights:function(i){t.setup(e,n,i)},pushLight:function(t){e.push(t)},pushShadow:function(t){n.push(t)}}}function Te(){function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}var e=new WeakMap;return{get:function(n,i){var r;return 0==e.has(n)?(r=new Se,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):0==e.get(n).has(i)?(r=new Se,e.get(n).set(i,r)):r=e.get(n).get(i),r},dispose:function(){e=new WeakMap}}}function Ae(t){S.call(this),this.type="MeshDepthMaterial",this.depthPacking=Zs,this.skinning=0,this.morphTargets=0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=0,this.wireframeLinewidth=1,this.fog=0,this.setValues(t)}function Le(t){S.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new i,this.nearDistance=1,this.farDistance=1e3,this.skinning=0,this.morphTargets=0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=0,this.setValues(t)}function Ce(t,n,i){function r(e,i){var r=n.update(u);P.uniforms.shadow_pass.value=e.map.texture,P.uniforms.resolution.value=e.mapSize,P.uniforms.radius.value=e.radius,t.setRenderTarget(e.mapPass),t.clear(),t.renderBufferDirect(i,null,r,P,u,null),E.uniforms.shadow_pass.value=e.mapPass.texture,E.uniforms.resolution.value=e.mapSize,E.uniforms.radius.value=e.radius,t.setRenderTarget(e.map),t.clear(),t.renderBufferDirect(i,null,r,E,u,null)}function o(e,n,i,r,o,a){var s,c,l,u,h,p,d,f=e.geometry,m=null,g=S,v=e.customDepthMaterial;return i.isPointLight&&(g=T,v=e.customDistanceMaterial),v?m=v:(s=0,n.morphTargets&&(f&&f.isBufferGeometry?s=f.morphAttributes&&f.morphAttributes.position&&f.morphAttributes.position.length>0:f&&f.isGeometry&&(s=f.morphTargets&&f.morphTargets.length>0)),e.isSkinnedMesh&&n.skinning,c=e.isSkinnedMesh&&n.skinning,l=0,s&&(l|=_),c&&(l|=w),m=g[l]),t.localClippingEnabled&&1==n.clipShadows&&0!==n.clippingPlanes.length&&(u=m.uuid,h=n.uuid,void 0===(p=L[u])&&(p={},L[u]=p),void 0===(d=p[h])&&(d=m.clone(),p[h]=d),m=d),m.visible=n.visible,m.wireframe=n.wireframe,m.side=a===Bo?null!=n.shadowSide?n.shadowSide:n.side:null!=n.shadowSide?n.shadowSide:C[n.side],m.clipShadows=n.clipShadows,m.clippingPlanes=n.clippingPlanes,m.clipIntersection=n.clipIntersection,m.wireframeLinewidth=n.wireframeLinewidth,m.linewidth=n.linewidth,i.isPointLight&&m.isMeshDistanceMaterial&&(m.referencePosition.setFromMatrixPosition(i.matrixWorld),m.nearDistance=r,m.farDistance=o),m}function c(e,i,r,a,s){var l,u,h,p,d,f,m,g,y,x,b;if(0!=e.visible){if(e.layers.test(i.layers)&&(e.isMesh||e.isLine||e.isPoints)&&(e.castShadow||e.receiveShadow&&s===Bo)&&(!e.frustumCulled||v.intersectsObject(e)))if(e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),l=n.update(e),u=e.material,Array.isArray(u))for(p=0,d=(h=l.groups).length;p<d;p++)(m=u[(f=h[p]).materialIndex])&&m.visible&&(g=o(e,m,a,r.near,r.far,s),t.renderBufferDirect(r,null,l,g,e,f));else u.visible&&(g=o(e,u,a,r.near,r.far,s),t.renderBufferDirect(r,null,l,g,e,null));for(x=0,b=(y=e.children).length;x<b;x++)c(y[x],i,r,a,s)}}var l,u,h,p,d,f,m,g,v=new Q,y=new e,x=new e,b=new a,_=1,w=2,M=1+(_|w),S=Array(M),T=Array(M),L={},C={0:jo,1:Uo,2:Vo},P=new H({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new e},radius:{value:4}},vertexShader:du,fragmentShader:pu}),E=P.clone();for(E.defines.HORIZONAL_PASS=1,(l=new k).addAttribute("position",new A(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3)),u=new B(l,P),h=0;h!==M;++h)f=new Ae({depthPacking:Js,morphTargets:p=0!=(h&_),skinning:d=0!=(h&w)}),S[h]=f,m=new Le({morphTargets:p,skinning:d}),T[h]=m;g=this,this.enabled=0,this.autoUpdate=1,this.needsUpdate=0,this.type=Fo,this.render=function(e,n,o){var a,l,u,h,p,d,f,m,_,w,M,S,T;if(0!=g.enabled&&(0!=g.autoUpdate||0!=g.needsUpdate)&&0!==e.length){for(a=t.getRenderTarget(),l=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),(h=t.state).setBlending(qo),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(1),h.setScissorTest(0),p=0,d=e.length;p<d;p++)if(void 0!==(m=(f=e[p]).shadow)){for(y.copy(m.mapSize),_=m.getFrameExtents(),y.multiply(_),x.copy(m.mapSize),(y.x>i||y.y>i)&&(y.x>i&&(x.x=Math.floor(i/_.x),y.x=x.x*_.x,m.mapSize.x=x.x),y.y>i&&(x.y=Math.floor(i/_.y),y.y=x.y*_.y,m.mapSize.y=x.y)),null!==m.map||m.isPointLightShadow||this.type!==Bo||(w={minFilter:Wa,magFilter:Wa,format:ss},m.map=new s(y.x,y.y,w),m.map.texture.name=f.name+".shadowMap",m.mapPass=new s(y.x,y.y,w),m.camera.updateProjectionMatrix()),null===m.map&&(w={minFilter:ja,magFilter:ja,format:ss},m.map=new s(y.x,y.y,w),m.map.texture.name=f.name+".shadowMap",m.camera.updateProjectionMatrix()),t.setRenderTarget(m.map),t.clear(),M=m.getViewportCount(),S=0;S<M;S++)T=m.getViewport(S),b.set(x.x*T.x,x.y*T.y,x.x*T.z,x.y*T.w),h.viewport(b),m.updateMatrices(f,o,S),v=m.getFrustum(),c(n,o,m.camera,f,this.type);m.isPointLightShadow||this.type!==Bo||r(m,o)}g.needsUpdate=0,t.setRenderTarget(a,l,u)}}}function Pe(t,e,n,i){function r(e,n,i){var r,o=new Uint8Array(4),a=t.createTexture();for(t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728),r=0;r<i;r++)t.texImage2D(n+r,0,6408,1,1,0,6408,5121,o);return a}function o(n,r){M[n]=1,0===S[n]&&(t.enableVertexAttribArray(n),S[n]=1),T[n]!==r&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),T[n]=r)}function s(e){1!=A[e]&&(t.enable(e),A[e]=1)}function c(e){0!=A[e]&&(t.disable(e),A[e]=0)}function l(e,i,r,o,a,l,u,h){if(e!==qo){if(P||(s(3042),P=1),e===$o)a=a||i,l=l||r,u=u||o,i===N&&a===I||(t.blendEquationSeparate(n.convert(i),n.convert(a)),N=i,I=a),r===O&&o===D&&l===z&&u===R||(t.blendFuncSeparate(n.convert(r),n.convert(o),n.convert(l),n.convert(u)),O=r,D=o,z=l,R=u),E=e,F=null;else if(e!==E||h!==F){if(N===Qo&&I===Qo||(t.blendEquation(32774),N=Qo,I=Qo),h)switch(e){case Xo:t.blendFuncSeparate(1,771,1,771);break;case Yo:t.blendFunc(1,1);break;case Zo:t.blendFuncSeparate(0,0,769,771);break;case Jo:t.blendFuncSeparate(0,768,0,770)}else switch(e){case Xo:t.blendFuncSeparate(770,771,1,771);break;case Yo:t.blendFunc(770,1);break;case Zo:t.blendFunc(0,769);break;case Jo:t.blendFunc(0,768)}O=null,D=null,z=null,R=null,E=e,F=h}}else P&&(c(3042),P=0)}function u(e){k!==e&&(e?t.frontFace(2304):t.frontFace(2305),k=e)}function h(e){e!==Io?(s(2884),e!==B&&(e===zo?t.cullFace(1029):e===Ro?t.cullFace(1028):t.cullFace(1032))):c(2884),B=e}function p(e,n,i){e?(s(32823),j===n&&V===i||(t.polygonOffset(n,i),j=n,V=i)):c(32823)}function d(e){void 0===e&&(e=33984+G-1),f!==e&&(t.activeTexture(e),f=e)}var f,m,g,v,y,x=new function(){var e=0,n=new a,i=null,r=new a(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,a,s){1==s&&(e*=a,i*=a,o*=a),n.set(e,i,o,a),0==r.equals(n)&&(t.clearColor(e,i,o,a),r.copy(n))},reset:function(){e=0,i=null,r.set(-1,0,0,0)}}},b=new function(){var e=0,n=null,i=null,r=null;return{setTest:function(t){t?s(2929):c(2929)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case fa:t.depthFunc(512);break;case ma:t.depthFunc(519);break;case ga:t.depthFunc(513);break;case va:t.depthFunc(515);break;case ya:t.depthFunc(514);break;case xa:t.depthFunc(518);break;case ba:t.depthFunc(516);break;case _a:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=0,n=null,i=null,r=null}}},_=new function(){var e=0,n=null,i=null,r=null,o=null,a=null,l=null,u=null,h=null;return{setTest:function(t){e||(t?s(2960):c(2960))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&o===a||(t.stencilFunc(e,n,a),i=e,r=n,o=a)},setOp:function(e,n,i){a===e&&l===n&&u===i||(t.stencilOp(e,n,i),a=e,l=n,u=i)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=0,n=null,i=null,r=null,o=null,a=null,l=null,u=null,h=null}}},w=t.getParameter(34921),M=new Uint8Array(w),S=new Uint8Array(w),T=new Uint8Array(w),A={},L=null,C=null,P=null,E=null,N=null,O=null,D=null,I=null,z=null,R=null,F=0,k=null,B=null,U=null,j=null,V=null,G=t.getParameter(35661),W=0,H=0,q=t.getParameter(7938);return-1!==q.indexOf("WebGL")?(H=parseFloat(/^WebGL\ ([0-9])/.exec(q)[1]),W=H>=1):-1!==q.indexOf("OpenGL ES")&&(H=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(q)[1]),W=H>=2),f=null,m={},g=new a,v=new a,(y={})[3553]=r(3553,3553,1),y[34067]=r(34067,34069,6),x.setClear(0,0,0,1),b.setClear(1),_.setClear(0),s(2929),b.setFunc(va),u(0),h(zo),s(2884),l(qo),{buffers:{color:x,depth:b,stencil:_},initAttributes:function(){for(var t=0,e=M.length;t<e;t++)M[t]=0},enableAttribute:function(t){o(t,0)},enableAttributeAndDivisor:o,disableUnusedAttributes:function(){for(var e=0,n=S.length;e!==n;++e)S[e]!==M[e]&&(t.disableVertexAttribArray(e),S[e]=0)},enable:s,disable:c,getCompressedTextureFormats:function(){var n,i;if(null===L&&(L=[],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(n=t.getParameter(34467),i=0;i<n.length;i++)L.push(n[i]);return L},useProgram:function(e){return C!==e?(t.useProgram(e),C=e,1):0},setBlending:l,setMaterial:function(t,e){var n,i;t.side===Vo?c(2884):s(2884),n=t.side===jo,e&&(n=!n),u(n),t.blending===Xo&&0==t.transparent?l(qo):l(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),b.setFunc(t.depthFunc),b.setTest(t.depthTest),b.setMask(t.depthWrite),x.setMask(t.colorWrite),i=t.stencilWrite,_.setTest(i),i&&(_.setMask(t.stencilWriteMask),_.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),_.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),p(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:u,setCullFace:h,setLineWidth:function(e){e!==U&&(W&&t.lineWidth(e),U=e)},setPolygonOffset:p,setScissorTest:function(t){t?s(3089):c(3089)},activeTexture:d,bindTexture:function(e,n){null===f&&d();var i=m[f];void 0===i&&(i={type:void 0,texture:void 0},m[f]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||y[e]),i.type=e,i.texture=n)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){}},scissor:function(e){0==g.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),g.copy(e))},viewport:function(e){0==v.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),v.copy(e))},reset:function(){for(var e=0;e<S.length;e++)1===S[e]&&(t.disableVertexAttribArray(e),S[e]=0);A={},L=null,f=null,m={},C=null,E=null,k=null,B=null,x.reset(),b.reset(),_.reset()}}}function Ee(t,e,n,i,r,o,a){function s(t,e){return L?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function c(t,e,n,i){var r,o,a,c,l=1;return(t.width>i||t.height>i)&&(l=i/Math.max(t.width,t.height)),(l<1||1==e)&&("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap)?(o=(r=e?ic.floorPowerOfTwo:Math.floor)(l*t.width),a=r(l*t.height),void 0===T&&(T=s(o,a)),(c=n?s(o,a):T).width=o,c.height=a,c.getContext("2d").drawImage(t,0,0,o,a),c):t}function l(t){return ic.isPowerOfTwo(t.width)&&ic.isPowerOfTwo(t.height)}function u(t,e){return t.generateMipmaps&&e&&t.minFilter!==ja&&t.minFilter!==Wa}function h(e,n,r,o){t.generateMipmap(e),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function p(t,n){if(!r.isWebGL2)return t;var i=t;return 6403===t&&(5126===n&&(i=33326),5131===n&&(i=33325),5121===n&&(i=33321)),6407===t&&(5126===n&&(i=34837),5131===n&&(i=34843),5121===n&&(i=32849)),6408===t&&(5126===n&&(i=34836),5131===n&&(i=34842),5121===n&&(i=32856)),33325!==i&&33326!==i&&34842!==i&&34836!==i||e.get("EXT_color_buffer_float"),i}function d(t){return t===ja||t===Va||t===Ga?9728:9729}function f(e){var n=e.target;n.removeEventListener("dispose",f),function(e){var n=i.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),i.remove(e))}(n),n.isVideoTexture&&A.delete(n),a.memory.textures--}function m(e){var n=e.target;n.removeEventListener("dispose",m),function(e){var n,r,o=i.get(e),s=i.get(e.texture);if(e){if(void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(n=0;n<6;n++)t.deleteFramebuffer(o.__webglFramebuffer[n]),o.__webglDepthbuffer&&t.deleteRenderbuffer(o.__webglDepthbuffer[n]);else t.deleteFramebuffer(o.__webglFramebuffer),o.__webglDepthbuffer&&t.deleteRenderbuffer(o.__webglDepthbuffer);if(e.isWebGLMultiviewRenderTarget)for(t.deleteTexture(o.__webglColorTexture),t.deleteTexture(o.__webglDepthStencilTexture),a.memory.textures-=2,n=0,r=o.__webglViewFramebuffers.length;n<r;n++)t.deleteFramebuffer(o.__webglViewFramebuffers[n]);i.remove(e.texture),i.remove(e)}}(n),a.memory.textures--}function g(t,e){var r,o=i.get(t);if(t.isVideoTexture&&function(t){var e=a.render.frame;A.get(t)!==e&&(A.set(t,e),t.update())}(t),t.version>0&&o.__version!==t.version)if(void 0===(r=t.image));else if(0!=r.complete)return void _(o,t,e);n.activeTexture(33984+e),n.bindTexture(3553,o.__webglTexture)}function v(e,a){var s,d,f,m,g,v,y,_,w,M,S,T,A,L;if(6===e.image.length)if(s=i.get(e),e.version>0&&s.__version!==e.version){for(b(s,e),n.activeTexture(33984+a),n.bindTexture(34067,s.__webglTexture),t.pixelStorei(37440,e.flipY),d=e&&e.isCompressedTexture,f=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=d||f?f?e.image[g].image:e.image[g]:c(e.image[g],0,1,r.maxCubemapSize);if(y=l(v=m[0])||r.isWebGL2,M=p(_=o.convert(e.format),w=o.convert(e.type)),x(34067,e,y),d){for(g=0;g<6;g++)for(S=m[g].mipmaps,T=0;T<S.length;T++)A=S[T],e.format!==ss&&e.format!==as?n.getCompressedTextureFormats().indexOf(_)>-1&&n.compressedTexImage2D(34069+g,T,M,A.width,A.height,0,A.data):n.texImage2D(34069+g,T,M,A.width,A.height,0,_,w,A.data);s.__maxMipLevel=S.length-1}else{for(S=e.mipmaps,g=0;g<6;g++)if(f)for(n.texImage2D(34069+g,0,M,m[g].width,m[g].height,0,_,w,m[g].data),T=0;T<S.length;T++)L=(A=S[T]).image[g].image,n.texImage2D(34069+g,T+1,M,L.width,L.height,0,_,w,L.data);else for(n.texImage2D(34069+g,0,M,_,w,m[g]),T=0;T<S.length;T++)A=S[T],n.texImage2D(34069+g,T+1,M,_,w,A.image[g]);s.__maxMipLevel=S.length}u(e,y)&&h(34067,e,v.width,v.height),s.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(33984+a),n.bindTexture(34067,s.__webglTexture)}function y(t,e){n.activeTexture(33984+e),n.bindTexture(34067,i.get(t).__webglTexture)}function x(n,a,s){var c;if(s?(t.texParameteri(n,10242,o.convert(a.wrapS)),t.texParameteri(n,10243,o.convert(a.wrapT)),32879!==n&&35866!==n||t.texParameteri(n,32882,o.convert(a.wrapR)),t.texParameteri(n,10240,o.convert(a.magFilter)),t.texParameteri(n,10241,o.convert(a.minFilter))):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS!==Ba||a.wrapT,t.texParameteri(n,10240,d(a.magFilter)),t.texParameteri(n,10241,d(a.minFilter)),a.minFilter!==ja&&a.minFilter),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===Ka&&null===e.get("OES_texture_float_linear"))return;if(a.type===ts&&null===(r.isWebGL2||e.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function b(e,n){void 0===e.__webglInit&&(e.__webglInit=1,n.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),a.memory.textures++)}function _(e,i,a){var s,d,f,m,g,v,y,_,w,M,S=3553;if(i.isDataTexture2DArray&&(S=35866),i.isDataTexture3D&&(S=32879),b(e,i),n.activeTexture(33984+a),n.bindTexture(S,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),s=function(t){return r.isWebGL2?0:t.wrapS!==Ba||t.wrapT!==Ba||t.minFilter!==ja&&t.minFilter!==Wa}(i)&&0==l(i.image),f=l(d=c(i.image,s,0,r.maxTextureSize))||r.isWebGL2,v=p(m=o.convert(i.format),g=o.convert(i.type)),x(S,i,f),_=i.mipmaps,i.isDepthTexture){if(v=6402,i.type===Ka){if(!r.isWebGL2)throw Error("Float Depth Texture only supported in WebGL2.0");v=36012}else r.isWebGL2&&(v=33189);i.format===us&&6402===v&&i.type!==Ja&&i.type!==Qa&&(i.type=Ja,g=o.convert(i.type)),i.format===hs&&(v=34041,i.type!==rs&&(i.type=rs,g=o.convert(i.type))),n.texImage2D(3553,0,v,d.width,d.height,0,m,g,null)}else if(i.isDataTexture)if(_.length>0&&f){for(w=0,M=_.length;w<M;w++)y=_[w],n.texImage2D(3553,w,v,y.width,y.height,0,m,g,y.data);i.generateMipmaps=0,e.__maxMipLevel=_.length-1}else n.texImage2D(3553,0,v,d.width,d.height,0,m,g,d.data),e.__maxMipLevel=0;else if(i.isCompressedTexture){for(w=0,M=_.length;w<M;w++)y=_[w],i.format!==ss&&i.format!==as?n.getCompressedTextureFormats().indexOf(m)>-1&&n.compressedTexImage2D(3553,w,v,y.width,y.height,0,y.data):n.texImage2D(3553,w,v,y.width,y.height,0,m,g,y.data);e.__maxMipLevel=_.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,v,d.width,d.height,d.depth,0,m,g,d.data),e.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,v,d.width,d.height,d.depth,0,m,g,d.data),e.__maxMipLevel=0;else if(_.length>0&&f){for(w=0,M=_.length;w<M;w++)y=_[w],n.texImage2D(3553,w,v,m,g,y);i.generateMipmaps=0,e.__maxMipLevel=_.length-1}else n.texImage2D(3553,0,v,m,g,d),e.__maxMipLevel=0;u(i,f)&&h(3553,i,d.width,d.height),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function w(e,r,a,s){var c=o.convert(r.texture.format),l=o.convert(r.texture.type),u=p(c,l);n.texImage2D(s,0,u,r.width,r.height,0,c,l,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,a,s,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function M(e,n,i){var r,a;t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer?(i?(r=S(n),t.renderbufferStorageMultisample(36161,r,33189,n.width,n.height)):t.renderbufferStorage(36161,33189,n.width,n.height),t.framebufferRenderbuffer(36160,36096,36161,e)):n.depthBuffer&&n.stencilBuffer?(i?(r=S(n),t.renderbufferStorageMultisample(36161,r,35056,n.width,n.height)):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)):(a=p(o.convert(n.texture.format),o.convert(n.texture.type)),i?(r=S(n),t.renderbufferStorageMultisample(36161,r,a,n.width,n.height)):t.renderbufferStorage(36161,a,n.width,n.height)),t.bindRenderbuffer(36161,null)}function S(t){return r.isWebGL2&&t.isWebGLMultisampleRenderTarget?Math.min(r.maxSamples,t.samples):0}var T,A=new WeakMap,L="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d"),C=0,P=0,E=0;this.allocateTextureUnit=function(){var t=C;return r.maxTextures,C+=1,t},this.resetTextureUnits=function(){C=0},this.setTexture2D=g,this.setTexture2DArray=function(t,e){var r=i.get(t);t.version>0&&r.__version!==t.version?_(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){var r=i.get(t);t.version>0&&r.__version!==t.version?_(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=function(s){var c,d,f,v,y,b,_,T,A,L,C,P,E,N,O=i.get(s),D=i.get(s.texture);if(s.addEventListener("dispose",m),D.__webglTexture=t.createTexture(),a.memory.textures++,c=1==s.isWebGLRenderTargetCube,d=1==s.isWebGLMultisampleRenderTarget,f=1==s.isWebGLMultiviewRenderTarget,v=l(s)||r.isWebGL2,c)for(O.__webglFramebuffer=[],y=0;y<6;y++)O.__webglFramebuffer[y]=t.createFramebuffer();else if(O.__webglFramebuffer=t.createFramebuffer(),d)r.isWebGL2&&(O.__webglMultisampledFramebuffer=t.createFramebuffer(),O.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,O.__webglColorRenderbuffer),b=p(o.convert(s.texture.format),o.convert(s.texture.type)),_=S(s),t.renderbufferStorageMultisample(36161,_,b,s.width,s.height),t.bindFramebuffer(36160,O.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,O.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),s.depthBuffer&&(O.__webglDepthRenderbuffer=t.createRenderbuffer(),M(O.__webglDepthRenderbuffer,s,1)),t.bindFramebuffer(36160,null));else if(f){for(T=s.width,A=s.height,L=s.numViews,t.bindFramebuffer(36160,O.__webglFramebuffer),C=e.get("OVR_multiview2"),a.memory.textures+=2,P=t.createTexture(),t.bindTexture(35866,P),t.texParameteri(35866,10240,9728),t.texParameteri(35866,10241,9728),t.texImage3D(35866,0,32856,T,A,L,0,6408,5121,null),C.framebufferTextureMultiviewOVR(36160,36064,P,0,0,L),E=t.createTexture(),t.bindTexture(35866,E),t.texParameteri(35866,10240,9728),t.texParameteri(35866,10241,9728),t.texImage3D(35866,0,35056,T,A,L,0,34041,34042,null),C.framebufferTextureMultiviewOVR(36160,33306,E,0,0,L),N=Array(L),y=0;y<L;++y)N[y]=t.createFramebuffer(),t.bindFramebuffer(36160,N[y]),t.framebufferTextureLayer(36160,36064,P,0,y);O.__webglColorTexture=P,O.__webglDepthStencilTexture=E,O.__webglViewFramebuffers=N,t.bindFramebuffer(36160,null),t.bindTexture(35866,null)}if(c){for(n.bindTexture(34067,D.__webglTexture),x(34067,s.texture,v),y=0;y<6;y++)w(O.__webglFramebuffer[y],s,36064,34069+y);u(s.texture,v)&&h(34067,s.texture,s.width,s.height),n.bindTexture(34067,null)}else f||(n.bindTexture(3553,D.__webglTexture),x(3553,s.texture,v),w(O.__webglFramebuffer,s,36064,3553),u(s.texture,v)&&h(3553,s.texture,s.width,s.height),n.bindTexture(3553,null));s.depthBuffer&&function(e){var n,r=i.get(e),o=1==e.isWebGLRenderTargetCube;if(e.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");!function(e,n){var r;if(n&&n.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=1),g(n.depthTexture,0),r=i.get(n.depthTexture).__webglTexture,n.depthTexture.format===us)t.framebufferTexture2D(36160,36096,3553,r,0);else{if(n.depthTexture.format!==hs)throw Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,r,0)}}(r.__webglFramebuffer,e)}else if(o)for(r.__webglDepthbuffer=[],n=0;n<6;n++)t.bindFramebuffer(36160,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),M(r.__webglDepthbuffer[n],e);else t.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),M(r.__webglDepthbuffer,e);t.bindFramebuffer(36160,null)}(s)},this.updateRenderTargetMipmap=function(t){var e,o,a=t.texture;u(a,l(t)||r.isWebGL2)&&(e=t.isWebGLRenderTargetCube?34067:3553,o=i.get(a).__webglTexture,n.bindTexture(e,o),h(e,a,t.width,t.height),n.bindTexture(e,null))},this.updateMultisampleRenderTarget=function(e){var n,o,a,s;e.isWebGLMultisampleRenderTarget&&r.isWebGL2&&(n=i.get(e),t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer),o=e.width,a=e.height,s=16384,e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,o,a,0,0,o,a,s,9728))},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(0==P&&(P=1),t=t.texture),g(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLRenderTargetCube&&(0==E&&(E=1),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?v(t,e):y(t,e)}}function Ne(t,e,n){return{convert:function(t){var i;if(t===ka)return 10497;if(t===Ba)return 33071;if(t===Ua)return 33648;if(t===ja)return 9728;if(t===Va)return 9984;if(t===Ga)return 9986;if(t===Wa)return 9729;if(t===Ha)return 9985;if(t===qa)return 9987;if(t===Xa)return 5121;if(t===es)return 32819;if(t===ns)return 32820;if(t===is)return 33635;if(t===Ya)return 5120;if(t===Za)return 5122;if(t===Ja)return 5123;if(t===$a)return 5124;if(t===Qa)return 5125;if(t===Ka)return 5126;if(t===ts){if(n.isWebGL2)return 5131;if(null!==(i=e.get("OES_texture_half_float")))return i.HALF_FLOAT_OES}if(t===os)return 6406;if(t===as)return 6407;if(t===ss)return 6408;if(t===cs)return 6409;if(t===ls)return 6410;if(t===us)return 6402;if(t===hs)return 34041;if(t===ps)return 6403;if(t===Qo)return 32774;if(t===Ko)return 32778;if(t===ta)return 32779;if(t===ia)return 0;if(t===ra)return 1;if(t===oa)return 768;if(t===aa)return 769;if(t===sa)return 770;if(t===ca)return 771;if(t===la)return 772;if(t===ua)return 773;if(t===ha)return 774;if(t===pa)return 775;if(t===da)return 776;if((t===ds||t===fs||t===ms||t===gs)&&null!==(i=e.get("WEBGL_compressed_texture_s3tc"))){if(t===ds)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===fs)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===ms)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===gs)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===vs||t===ys||t===xs||t===bs)&&null!==(i=e.get("WEBGL_compressed_texture_pvrtc"))){if(t===vs)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ys)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===xs)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===bs)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===_s&&null!==(i=e.get("WEBGL_compressed_texture_etc1")))return i.COMPRESSED_RGB_ETC1_WEBGL;if((t===ws||t===Ms||t===Ss||t===Ts||t===As||t===Ls||t===Cs||t===Ps||t===Es||t===Ns||t===Os||t===Ds||t===Is||t===zs)&&null!==(i=e.get("WEBGL_compressed_texture_astc")))return t;if(t===ea||t===na){if(n.isWebGL2){if(t===ea)return 32775;if(t===na)return 32776}if(null!==(i=e.get("EXT_blend_minmax"))){if(t===ea)return i.MIN_EXT;if(t===na)return i.MAX_EXT}}if(t===rs){if(n.isWebGL2)return 34042;if(null!==(i=e.get("WEBGL_depth_texture")))return i.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Oe(t,e,n,i){s.call(this,t,e,i),this.depthBuffer=0,this.stencilBuffer=0,this.numViews=n}function De(t,n){function i(t){return t.isArrayCamera?t.cameras:(u[0]=t,u)}var o,a,s,c,u,h,p,d=t.extensions,f=t.properties,m=0;this.isAvailable=function(){var t,i;if(void 0===p&&(t=d.get("OVR_multiview2"),p=null!==t&&0==n.getContextAttributes().antialias))for(m=n.getParameter(t.MAX_VIEWS_OVR),o=new Oe(0,0,2),h=new e,c=[],s=[],u=[],i=0;i<m;i++)c[i]=new l,s[i]=new r;return p},this.attachCamera=function(e){0!=function(t){var e,n,i;if(void 0===t.isArrayCamera)return 1;if((e=t.cameras).length>m)return 0;for(n=1,i=e.length;n<i;n++)if(e[0].viewport.z!==e[n].viewport.z||e[0].viewport.w!==e[n].viewport.w)return 0;return 1}(e)&&(a=t.getRenderTarget(),function(e){if(a?h.set(a.width,a.height):t.getDrawingBufferSize(h),e.isArrayCamera){var n=e.cameras[0].viewport;o.setSize(n.z,n.w),o.setNumViews(e.cameras.length)}else o.setSize(h.x,h.y),o.setNumViews(2)}(e),t.setRenderTarget(o))},this.detachCamera=function(e){o===t.getRenderTarget()&&(t.setRenderTarget(a),function(t){var e,i,r,a,s,c,l=o,u=l.numViews,p=f.get(l).__webglViewFramebuffers,d=l.width,m=l.height;if(t.isArrayCamera)for(e=0;e<u;e++)r=(i=t.cameras[e].viewport).x,a=i.y,s=r+i.z,c=a+i.w,n.bindFramebuffer(36008,p[e]),n.blitFramebuffer(0,0,d,m,r,a,s,c,16384,9728);else n.bindFramebuffer(36008,p[0]),n.blitFramebuffer(0,0,d,m,0,0,h.x,h.y,16384,9728)}(e))},this.updateCameraProjectionMatricesUniform=function(t,e){var r,o=i(t);for(r=0;r<o.length;r++)c[r].copy(o[r].projectionMatrix);e.setValue(n,"projectionMatrices",c)},this.updateCameraViewMatricesUniform=function(t,e){var r,o=i(t);for(r=0;r<o.length;r++)c[r].copy(o[r].matrixWorldInverse);e.setValue(n,"viewMatrices",c)},this.updateObjectMatricesUniforms=function(t,e,r){var o,a=i(e);for(o=0;o<a.length;o++)c[o].multiplyMatrices(a[o].matrixWorldInverse,t.matrixWorld),s[o].getNormalMatrix(c[o]);r.setValue(n,"modelViewMatrices",c),r.setValue(n,"normalMatrices",s)}}function Ie(){p.call(this),this.type="Group"}function ze(t){X.call(this),this.cameras=t||[]}function Re(t,e,n){var i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_;fu.setFromMatrixPosition(e.matrixWorld),mu.setFromMatrixPosition(n.matrixWorld),i=fu.distanceTo(mu),r=e.projectionMatrix.elements,o=n.projectionMatrix.elements,a=r[14]/(r[10]-1),s=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],p=a*(u=(r[8]-1)/r[0]),d=a*(h=(o[8]+1)/o[0]),m=(f=i/(-u+h))*-u,e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld),y=p-m,x=d+(i-m),b=c*s/(v=s+f)*(g=a+f),_=l*s/v*g,t.projectionMatrix.makePerspective(y,x,b,_,g,v)}function Fe(t){function r(){return null!==M&&1==M.isPresenting}function o(){if(r()){var e=M.getEyeParameters("left");u=2*e.renderWidth*P,h=e.renderHeight*P,x=t.getPixelRatio(),t.getSize(y),t.setDrawingBufferSize(u,h,1),m.viewport.set(0,0,u/2,h),g.viewport.set(u/2,0,u/2,h),_.start(),w.dispatchEvent({type:"sessionstart"})}else w.enabled&&t.setDrawingBufferSize(y.width,y.height,x),_.stop(),w.dispatchEvent({type:"sessionend"})}function s(t){var e,n,i,r,o=navigator.getGamepads&&navigator.getGamepads();for(e=0,n=0,i=o.length;e<i;e++)if((r=o[e])&&("Daydream Controller"===r.id||"Gear VR Controller"===r.id||"Oculus Go Controller"===r.id||"OpenVR Gamepad"===r.id||r.id.startsWith("Oculus Touch")||r.id.startsWith("HTC Vive Focus")||r.id.startsWith("Spatial Controller"))){if(n===t)return r;n++}}function c(t,e){null!==e&&4===e.length&&t.set(e[0]*u,e[1]*h,e[2]*u,e[3]*h)}var u,h,p,d,f,m,g,v,y,x,b,_,w=this,M=null,S=null,T=null,A=[],L=new l,C=new l,P=1,E="local-floor";"undefined"!=typeof window&&"VRFrameData"in window&&(S=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",o,0)),p=new l,d=new n,f=new i,(m=new X).viewport=new a,m.layers.enable(1),(g=new X).viewport=new a,g.layers.enable(2),(v=new ze([m,g])).layers.enable(1),v.layers.enable(2),y=new e,b=[],this.enabled=0,this.getController=function(t){var e=A[t];return void 0===e&&((e=new Ie).matrixAutoUpdate=0,e.visible=0,A[t]=e),e},this.getDevice=function(){return M},this.setDevice=function(t){void 0!==t&&(M=t),_.setContext(t)},this.setFramebufferScaleFactor=function(t){P=t},this.setReferenceSpaceType=function(t){E=t},this.setPoseTarget=function(t){void 0!==t&&(T=t)},this.getCamera=function(t){var e,n,i,o,a,l,u="local-floor"===E?1.6:0;return 0==r()?(t.position.set(0,u,0),t.rotation.set(0,0,0),t):(M.depthNear=t.near,M.depthFar=t.far,M.getFrameData(S),"local-floor"===E&&((e=M.stageParameters)?L.fromArray(e.sittingToStandingTransform):L.makeTranslation(0,u,0)),n=S.pose,(i=null!==T?T:t).matrix.copy(L),i.matrix.decompose(i.position,i.quaternion,i.scale),null!==n.orientation&&(d.fromArray(n.orientation),i.quaternion.multiply(d)),null!==n.position&&(d.setFromRotationMatrix(L),f.fromArray(n.position),f.applyQuaternion(d),i.position.add(f)),i.updateMatrixWorld(),m.near=t.near,g.near=t.near,m.far=t.far,g.far=t.far,m.matrixWorldInverse.fromArray(S.leftViewMatrix),g.matrixWorldInverse.fromArray(S.rightViewMatrix),C.getInverse(L),"local-floor"===E&&(m.matrixWorldInverse.multiply(C),g.matrixWorldInverse.multiply(C)),null!==(o=i.parent)&&(p.getInverse(o.matrixWorld),m.matrixWorldInverse.multiply(p),g.matrixWorldInverse.multiply(p)),m.matrixWorld.getInverse(m.matrixWorldInverse),g.matrixWorld.getInverse(g.matrixWorldInverse),m.projectionMatrix.fromArray(S.leftProjectionMatrix),g.projectionMatrix.fromArray(S.rightProjectionMatrix),Re(v,m,g),(a=M.getLayers()).length&&(l=a[0],c(m.viewport,l.leftBounds),c(g.viewport,l.rightBounds)),function(){var t,e,n,i,r;for(t=0;t<A.length;t++)if(e=A[t],void 0!==(n=s(t))&&void 0!==n.pose){if(null===n.pose)return;0==(i=n.pose).hasPosition&&e.position.set(.2,-.6,-.05),null!==i.position&&e.position.fromArray(i.position),null!==i.orientation&&e.quaternion.fromArray(i.orientation),e.matrix.compose(e.position,e.quaternion,e.scale),e.matrix.premultiply(L),e.matrix.decompose(e.position,e.quaternion,e.scale),e.matrixWorldNeedsUpdate=1,e.visible=1,r="Daydream Controller"===n.id?0:1,void 0===b[t]&&(b[t]=0),b[t]!==n.buttons[r].pressed&&(b[t]=n.buttons[r].pressed,1==b[t]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"})))}else e.visible=0}(),v)},this.getStandingMatrix=function(){return L},this.isPresenting=r,_=new K,this.setAnimationLoop=function(t){_.setAnimationLoop(t),r()&&_.start()},this.submitFrame=function(){r()&&M.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",o)},this.setFrameOfReferenceType=function(){}}function ke(t,e){function n(){return null!==f&&null!==m}function i(t){for(var e=0;e<y.length;e++)x[e]===t.inputSource&&y[e].dispatchEvent({type:t.type})}function r(){t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),p.stop(),d.dispatchEvent({type:"sessionend"})}function o(t){m=t,p.setContext(f),p.start(),d.dispatchEvent({type:"sessionstart"})}function s(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)}var c,u,h,p,d=this,f=null,m=null,g="local-floor",v=null,y=[],x=[],b=new X;b.layers.enable(1),b.viewport=new a,(c=new X).layers.enable(2),c.viewport=new a,(u=new ze([b,c])).layers.enable(1),u.layers.enable(2),this.enabled=0,this.getController=function(t){var e=y[t];return void 0===e&&((e=new Ie).matrixAutoUpdate=0,e.visible=0,y[t]=e),e},this.setFramebufferScaleFactor=function(){},this.setReferenceSpaceType=function(t){g=t},this.getSession=function(){return f},this.setSession=function(t){null!==(f=t)&&(f.addEventListener("select",i),f.addEventListener("selectstart",i),f.addEventListener("selectend",i),f.addEventListener("end",r),f.updateRenderState({baseLayer:new XRWebGLLayer(f,e)}),f.requestReferenceSpace(g).then(o),x=f.inputSources,f.addEventListener("inputsourceschange",function(){var t;for(x=f.inputSources,t=0;t<y.length;t++)y[t].userData.inputSource=x[t]}))},this.getCamera=function(t){var e,i,r,o,a;if(n()){for(e=t.parent,i=u.cameras,s(u,e),r=0;r<i.length;r++)s(i[r],e);for(t.matrixWorld.copy(u.matrixWorld),r=0,a=(o=t.children).length;r<a;r++)o[r].updateMatrixWorld(1);return Re(u,b,c),u}return t},this.isPresenting=n,h=null,(p=new K).setAnimationLoop(function(e,n){var i,r,o,a,s,c,l,p,d,g;if(null!==(v=n.getViewerPose(m)))for(i=v.views,r=f.renderState.baseLayer,t.setFramebuffer(r.framebuffer),o=0;o<i.length;o++)a=i[o],s=r.getViewport(a),c=a.transform.inverse.matrix,(l=u.cameras[o]).matrix.fromArray(c).getInverse(l.matrix),l.projectionMatrix.fromArray(a.projectionMatrix),l.viewport.set(s.x,s.y,s.width,s.height),0===o&&u.matrix.copy(l.matrix);for(o=0;o<y.length;o++)p=y[o],(d=x[o])&&null!==(g=n.getPose(d.targetRaySpace,m))?(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.visible=1):p.visible=0;h&&h(e)}),this.setAnimationLoop=function(t){h=t},this.dispose=function(){},this.getStandingMatrix=function(){return new l},this.getDevice=function(){},this.setDevice=function(){},this.setFrameOfReferenceType=function(){},this.submitFrame=function(){}}function Be(t){function n(){return null===z?X:1}function r(){xt=new st(vt),0==(bt=new ot(vt,xt,t)).isWebGL2&&(xt.get("WEBGL_depth_texture"),xt.get("OES_texture_float"),xt.get("OES_texture_half_float"),xt.get("OES_texture_half_float_linear"),xt.get("OES_standard_derivatives"),xt.get("OES_element_index_uint"),xt.get("ANGLE_instanced_arrays")),xt.get("OES_texture_float_linear"),zt=new Ne(vt,xt,bt),(_t=new Pe(vt,xt,zt,bt)).scissor(V.copy(Z).multiplyScalar(X).floor()),_t.viewport(j.copy(Y).multiplyScalar(X).floor()),wt=new ut(vt),Mt=new ge,St=new Ee(vt,xt,_t,Mt,bt,zt,wt),Tt=new tt(vt),At=new ct(vt,Tt,wt),Lt=new dt(vt,At,Tt,wt),Ot=new pt(vt),Ct=new me(E,xt,bt),Pt=new be,Et=new Te,Nt=new it(E,_t,Lt,S),Dt=new rt(vt,xt,wt,bt),It=new lt(vt,xt,wt,bt),wt.programs=Ct.programs,E.capabilities=bt,E.extensions=xt,E.properties=Mt,E.renderLists=Pt,E.state=_t,E.info=wt}function o(t){t.preventDefault(),N=1}function s(){N=0,r()}function c(t){var e=t.target;e.removeEventListener("dispose",c),function(t){u(t),Mt.remove(t)}(e)}function u(t){var e=Mt.get(t).program;t.program=void 0,void 0!==e&&Ct.releaseProgram(e)}function h(t,e,n,i){var r,o,a,s,c,l,u,h,d,f,m;for(r=0,o=t.length;r<o;r++)if(s=(a=t[r]).object,c=a.geometry,l=void 0===i?a.material:i,u=a.group,n.isArrayCamera)if(U=n,Rt.enabled&&Ft.isAvailable())p(s,e,n,c,l,u);else for(d=0,f=(h=n.cameras).length;d<f;d++)m=h[d],s.layers.test(m.layers)&&(_t.viewport(j.copy(m.viewport)),P.setupLights(m),p(s,e,m,c,l,u));else U=null,p(s,e,n,c,l,u)}function p(t,e,n,i,r,o){if(t.onBeforeRender(E,e,n,i,r,o),P=Et.get(e,U||n),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){_t.setMaterial(r);var a=f(n,e.fog,r,t);k.geometry=null,k.program=null,k.wireframe=0,function(t,e){t.render(function(t){E.renderBufferImmediate(t,e)})}(t,a)}else E.renderBufferDirect(n,e.fog,i,r,t,o);t.onAfterRender(E,e,n,i,r,o),P=Et.get(e,U||n)}function d(t,e,n){var i,r,o,a,s,l,h=Mt.get(t),p=P.state.lights,d=P.state.shadowsArray,f=p.state.version,m=Ct.getParameters(t,p.state,d,e,nt.numPlanes,nt.numIntersection,n),g=Ct.getProgramCode(t,m),v=h.program,y=1;if(void 0===v)t.addEventListener("dispose",c);else if(v.code!==g)u(t);else if(h.lightsStateVersion!==f)h.lightsStateVersion=f,y=0;else{if(void 0!==m.shaderID)return;y=0}if(y&&(m.shaderID?(i=$l[m.shaderID],h.shader={name:t.type,uniforms:G(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}):h.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader},t.onBeforeCompile(h.shader,E),g=Ct.getProgramCode(t,m),v=Ct.acquireProgram(t,h.shader,m,g),h.program=v,t.program=v),r=v.getAttributes(),t.morphTargets)for(t.numSupportedMorphTargets=0,o=0;o<E.maxMorphTargets;o++)r["morphTarget"+o]>=0&&t.numSupportedMorphTargets++;if(t.morphNormals)for(t.numSupportedMorphNormals=0,o=0;o<E.maxMorphNormals;o++)r["morphNormal"+o]>=0&&t.numSupportedMorphNormals++;a=h.shader.uniforms,(t.isShaderMaterial||t.isRawShaderMaterial)&&1!=t.clipping||(h.numClippingPlanes=nt.numPlanes,h.numIntersection=nt.numIntersection,a.clippingPlanes=nt.uniform),h.fog=e,h.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&1==t.lights}(t),h.lightsStateVersion=f,h.needsLights&&(a.ambientLightColor.value=p.state.ambient,a.lightProbe.value=p.state.probe,a.directionalLights.value=p.state.directional,a.spotLights.value=p.state.spot,a.rectAreaLights.value=p.state.rectArea,a.pointLights.value=p.state.point,a.hemisphereLights.value=p.state.hemi,a.directionalShadowMap.value=p.state.directionalShadowMap,a.directionalShadowMatrix.value=p.state.directionalShadowMatrix,a.spotShadowMap.value=p.state.spotShadowMap,a.spotShadowMatrix.value=p.state.spotShadowMatrix,a.pointShadowMap.value=p.state.pointShadowMap,a.pointShadowMatrix.value=p.state.pointShadowMatrix),s=h.program.getUniforms(),l=te.seqWithValue(s.seq,a),h.uniformsList=l}function f(t,e,n,i){var r,o,a,s,c,l,u,h,p,f,y,x,b,_,w,M,S;return St.resetTextureUnits(),r=Mt.get(n),o=P.state.lights,ht&&(ft||t!==B)&&(a=t===B&&n.id===F,nt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,a)),0==n.needsUpdate&&(void 0===r.program?n.needsUpdate=1:n.fog&&r.fog!==e?n.needsUpdate=1:r.needsLights&&r.lightsStateVersion!==o.state.version?n.needsUpdate=1:void 0===r.numClippingPlanes||r.numClippingPlanes===nt.numPlanes&&r.numIntersection===nt.numIntersection||(n.needsUpdate=1)),n.needsUpdate&&(d(n,e,i),n.needsUpdate=0),s=0,c=0,l=0,h=(u=r.program).getUniforms(),p=r.shader.uniforms,_t.useProgram(u.program)&&(s=1,c=1,l=1),n.id!==F&&(F=n.id,c=1),(s||B!==t)&&(u.numMultiviewViews>0?Ft.updateCameraProjectionMatricesUniform(t,h):h.setValue(vt,"projectionMatrix",t.projectionMatrix),bt.logarithmicDepthBuffer&&h.setValue(vt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),B!==t&&(B=t,c=1,l=1),(n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap)&&void 0!==(f=h.map.cameraPosition)&&f.setValue(vt,gt.setFromMatrixPosition(t.matrixWorld)),(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&(u.numMultiviewViews>0?Ft.updateCameraViewMatricesUniform(t,h):h.setValue(vt,"viewMatrix",t.matrixWorldInverse))),n.skinning&&(h.setOptional(vt,i,"bindMatrix"),h.setOptional(vt,i,"bindMatrixInverse"),(y=i.skeleton)&&(x=y.bones,bt.floatVertexTextures?(void 0===y.boneTexture&&(b=Math.sqrt(4*x.length),b=ic.ceilPowerOfTwo(b),b=Math.max(b,4),(_=new Float32Array(b*b*4)).set(y.boneMatrices),w=new J(_,b,b,ss,Ka),y.boneMatrices=_,y.boneTexture=w,y.boneTextureSize=b),h.setValue(vt,"boneTexture",y.boneTexture,St),h.setValue(vt,"boneTextureSize",y.boneTextureSize)):h.setOptional(vt,y,"boneMatrices"))),(c||r.receiveShadow!==i.receiveShadow)&&(r.receiveShadow=i.receiveShadow,h.setValue(vt,"receiveShadow",i.receiveShadow)),c&&(h.setValue(vt,"toneMappingExposure",E.toneMappingExposure),h.setValue(vt,"toneMappingWhitePoint",E.toneMappingWhitePoint),r.needsLights&&(S=l,(M=p).ambientLightColor.needsUpdate=S,M.lightProbe.needsUpdate=S,M.directionalLights.needsUpdate=S,M.pointLights.needsUpdate=S,M.spotLights.needsUpdate=S,M.rectAreaLights.needsUpdate=S,M.hemisphereLights.needsUpdate=S),e&&n.fog&&function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(p,e),n.isMeshBasicMaterial?m(p,n):n.isMeshLambertMaterial?(m(p,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(p,n)):n.isMeshPhongMaterial?(m(p,n),n.isMeshToonMaterial?function(t,e){g(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(p,n):g(p,n)):n.isMeshStandardMaterial?(m(p,n),n.isMeshPhysicalMaterial?function(t,e){v(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===jo&&t.clearcoatNormalScale.value.negate()),t.transparency.value=e.transparency}(p,n):v(p,n)):n.isMeshMatcapMaterial?(m(p,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n)):n.isMeshDepthMaterial?(m(p,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n)):n.isMeshDistanceMaterial?(m(p,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(p,n)):n.isMeshNormalMaterial?(m(p,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(p,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(p,n)):n.isPointsMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*X,t.scale.value=.5*q,t.map.value=e.map,null!==e.map&&(1==e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(p,n):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,t.map.value=e.map,null!==e.map&&(1==e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(p,n):n.isShadowMaterial&&(p.color.value.copy(n.color),p.opacity.value=n.opacity),void 0!==p.ltc_1&&(p.ltc_1.value=Jl.LTC_1),void 0!==p.ltc_2&&(p.ltc_2.value=Jl.LTC_2),te.upload(vt,r.uniformsList,p,St)),n.isShaderMaterial&&1==n.uniformsNeedUpdate&&(te.upload(vt,r.uniformsList,p,St),n.uniformsNeedUpdate=0),n.isSpriteMaterial&&h.setValue(vt,"center",i.center),u.numMultiviewViews>0?Ft.updateObjectMatricesUniforms(i,t,h):(h.setValue(vt,"modelViewMatrix",i.modelViewMatrix),h.setValue(vt,"normalMatrix",i.normalMatrix)),h.setValue(vt,"modelMatrix",i.matrixWorld),u}function m(t,e){var n;t.opacity.value=e.opacity,e.color&&t.diffuse.value.copy(e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=Mt.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),1==n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}function g(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function v(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}var y,x,b,_,w,M,S,T,A,L,C,P,E,N,O,D,I,z,R,F,k,B,U,j,V,W,H,q,X,Y,Z,$,et,nt,ht,ft,mt,gt,vt,yt,xt,bt,_t,wt,Mt,St,Tt,At,Lt,Ct,Pt,Et,Nt,Ot,Dt,It,zt,Rt,Ft,kt,Bt,Ut;y=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),x=void 0!==t.context?t.context:null,b=void 0!==t.alpha?t.alpha:0,_=void 0!==t.depth?t.depth:1,w=void 0!==t.stencil?t.stencil:1,M=void 0!==t.antialias?t.antialias:0,S=void 0!==t.premultipliedAlpha?t.premultipliedAlpha:1,T=void 0!==t.preserveDrawingBuffer?t.preserveDrawingBuffer:0,A=void 0!==t.powerPreference?t.powerPreference:"default",L=void 0!==t.failIfMajorPerformanceCaveat?t.failIfMajorPerformanceCaveat:0,C=null,P=null,this.domElement=y,this.debug={checkShaderErrors:1},this.autoClear=1,this.autoClearColor=1,this.autoClearDepth=1,this.autoClearStencil=1,this.sortObjects=1,this.clippingPlanes=[],this.localClippingEnabled=0,this.gammaFactor=2,this.gammaInput=0,this.gammaOutput=0,this.physicallyCorrectLights=0,this.toneMapping=Aa,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4,E=this,N=0,O=null,D=0,I=0,z=null,R=null,F=-1,k={geometry:null,program:null,wireframe:0},B=null,U=null,j=new a,V=new a,W=null,H=y.width,q=y.height,X=1,Y=new a(0,0,H,q),Z=new a(0,0,H,q),$=0,et=new Q,nt=new at,ht=0,ft=0,mt=new l,gt=new i;try{if(yt={alpha:b,depth:_,stencil:w,antialias:M,premultipliedAlpha:S,preserveDrawingBuffer:T,powerPreference:A,failIfMajorPerformanceCaveat:L,xrCompatible:1},y.addEventListener("webglcontextlost",o,0),y.addEventListener("webglcontextrestored",s,0),null===(vt=x||y.getContext("webgl",yt)||y.getContext("experimental-webgl",yt)))throw null!==y.getContext("webgl")?Error("Error creating WebGL context with your selected attributes."):Error("Error creating WebGL context.");void 0===vt.getShaderPrecisionFormat&&(vt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw t}r(),Rt="undefined"!=typeof navigator&&"xr"in navigator&&"supportsSession"in navigator.xr?new ke(E,vt):new Fe(E),this.vr=Rt,Ft=new De(E,vt),kt=new Ce(E,Lt,bt.maxTextureSize),this.shadowMap=kt,this.getContext=function(){return vt},this.getContextAttributes=function(){return vt.getContextAttributes()},this.forceContextLoss=function(){var t=xt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=xt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(t){void 0!==t&&(X=t,this.setSize(H,q,0))},this.getSize=function(t){return void 0===t&&(t=new e),t.set(H,q)},this.setSize=function(t,e,n){Rt.isPresenting()||(H=t,q=e,y.width=Math.floor(t*X),y.height=Math.floor(e*X),0!=n&&(y.style.width=t+"px",y.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return void 0===t&&(t=new e),t.set(H*X,q*X).floor()},this.setDrawingBufferSize=function(t,e,n){H=t,q=e,X=n,y.width=Math.floor(t*n),y.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return void 0===t&&(t=new a),t.copy(j)},this.getViewport=function(t){return t.copy(Y)},this.setViewport=function(t,e,n,i){t.isVector4?Y.set(t.x,t.y,t.z,t.w):Y.set(t,e,n,i),_t.viewport(j.copy(Y).multiplyScalar(X).floor())},this.getScissor=function(t){return t.copy(Z)},this.setScissor=function(t,e,n,i){t.isVector4?Z.set(t.x,t.y,t.z,t.w):Z.set(t,e,n,i),_t.scissor(V.copy(Z).multiplyScalar(X).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(t){_t.setScissorTest($=t)},this.getClearColor=function(){return Nt.getClearColor()},this.setClearColor=function(){Nt.setClearColor.apply(Nt,arguments)},this.getClearAlpha=function(){return Nt.getClearAlpha()},this.setClearAlpha=function(){Nt.setClearAlpha.apply(Nt,arguments)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=16384),(void 0===e||e)&&(i|=256),(void 0===n||n)&&(i|=1024),vt.clear(i)},this.clearColor=function(){this.clear(1,0,0)},this.clearDepth=function(){this.clear(0,1,0)},this.clearStencil=function(){this.clear(0,0,1)},this.dispose=function(){y.removeEventListener("webglcontextlost",o,0),y.removeEventListener("webglcontextrestored",s,0),Pt.dispose(),Et.dispose(),Mt.dispose(),Lt.dispose(),Rt.dispose(),Ut.stop()},this.renderBufferImmediate=function(t,e){var n,i;_t.initAttributes(),n=Mt.get(t),t.hasPositions&&!n.position&&(n.position=vt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=vt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=vt.createBuffer()),t.hasColors&&!n.color&&(n.color=vt.createBuffer()),i=e.getAttributes(),t.hasPositions&&(vt.bindBuffer(34962,n.position),vt.bufferData(34962,t.positionArray,35048),_t.enableAttribute(i.position),vt.vertexAttribPointer(i.position,3,5126,0,0,0)),t.hasNormals&&(vt.bindBuffer(34962,n.normal),vt.bufferData(34962,t.normalArray,35048),_t.enableAttribute(i.normal),vt.vertexAttribPointer(i.normal,3,5126,0,0,0)),t.hasUvs&&(vt.bindBuffer(34962,n.uv),vt.bufferData(34962,t.uvArray,35048),_t.enableAttribute(i.uv),vt.vertexAttribPointer(i.uv,2,5126,0,0,0)),t.hasColors&&(vt.bindBuffer(34962,n.color),vt.bufferData(34962,t.colorArray,35048),_t.enableAttribute(i.color),vt.vertexAttribPointer(i.color,3,5126,0,0,0)),_t.disableUnusedAttributes(),vt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,r,o,a){var s,c,l,u,h,p,d,m,g,v,y,x,b,_,w,M=o.isMesh&&o.matrixWorld.determinant()<0;if(_t.setMaterial(r,M),s=f(t,e,r,o),c=0,k.geometry===i.id&&k.program===s.id&&k.wireframe===(1==r.wireframe)||(k.geometry=i.id,k.program=s.id,k.wireframe=1==r.wireframe,c=1),o.morphTargetInfluences&&(Ot.update(o,i,r,s),c=1),l=i.index,u=i.attributes.position,h=1,1==r.wireframe&&(l=At.getWireframeAttribute(i),h=2),d=Dt,null!==l&&(p=Tt.get(l),(d=It).setIndex(p)),c&&(function(t,e,n,i){var r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x;if(0!=bt.isWebGL2||!t.isInstancedMesh&&!e.isInstancedBufferGeometry||null!==xt.get("ANGLE_instanced_arrays")){for(s in _t.initAttributes(),r=e.attributes,o=i.getAttributes(),a=n.defaultAttributeValues,o)if((c=o[s])>=0)if(void 0!==(l=r[s])){if(u=l.normalized,h=l.itemSize,void 0===(p=Tt.get(l)))continue;d=p.buffer,f=p.type,m=p.bytesPerElement,l.isInterleavedBufferAttribute?(v=(g=l.data).stride,y=l.offset,g&&g.isInstancedInterleavedBuffer?(_t.enableAttributeAndDivisor(c,g.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=g.meshPerAttribute*g.count)):_t.enableAttribute(c),vt.bindBuffer(34962,d),vt.vertexAttribPointer(c,h,f,u,v*m,y*m)):(l.isInstancedBufferAttribute?(_t.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=l.meshPerAttribute*l.count)):_t.enableAttribute(c),vt.bindBuffer(34962,d),vt.vertexAttribPointer(c,h,f,u,0,0))}else if("instanceMatrix"===s){if(void 0===(p=Tt.get(t.instanceMatrix)))continue;d=p.buffer,f=p.type,_t.enableAttributeAndDivisor(c+0,1),_t.enableAttributeAndDivisor(c+1,1),_t.enableAttributeAndDivisor(c+2,1),_t.enableAttributeAndDivisor(c+3,1),vt.bindBuffer(34962,d),vt.vertexAttribPointer(c+0,4,f,0,64,0),vt.vertexAttribPointer(c+1,4,f,0,64,16),vt.vertexAttribPointer(c+2,4,f,0,64,32),vt.vertexAttribPointer(c+3,4,f,0,64,48)}else if(void 0!==a&&void 0!==(x=a[s]))switch(x.length){case 2:vt.vertexAttrib2fv(c,x);break;case 3:vt.vertexAttrib3fv(c,x);break;case 4:vt.vertexAttrib4fv(c,x);break;default:vt.vertexAttrib1fv(c,x)}_t.disableUnusedAttributes()}}(o,i,r,s),null!==l&&vt.bindBuffer(34963,p.buffer)),m=1/0,null!==l?m=l.count:void 0!==u&&(m=u.count),g=i.drawRange.start*h,v=i.drawRange.count*h,y=null!==a?a.start*h:0,x=null!==a?a.count*h:1/0,b=Math.max(g,y),0!==(_=Math.max(0,Math.min(m,g+v,y+x)-1-b+1))){if(o.isMesh)if(1==r.wireframe)_t.setLineWidth(r.wireframeLinewidth*n()),d.setMode(1);else switch(o.drawMode){case ks:d.setMode(4);break;case Bs:d.setMode(5);break;case Us:d.setMode(6)}else o.isLine?(void 0===(w=r.linewidth)&&(w=1),_t.setLineWidth(w*n()),o.isLineSegments?d.setMode(1):o.isLineLoop?d.setMode(2):d.setMode(3)):o.isPoints?d.setMode(0):o.isSprite&&d.setMode(4);o.isInstancedMesh?d.renderInstances(i,b,_,o.count):i.isInstancedBufferGeometry?d.renderInstances(i,b,_,i.maxInstancedCount):d.render(b,_)}},this.compile=function(t,e){(P=Et.get(t,e)).init(),t.traverse(function(t){t.isLight&&(P.pushLight(t),t.castShadow&&P.pushShadow(t))}),P.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n<e.material.length;n++)d(e.material[n],t.fog,e);else d(e.material,t.fog,e)})},Bt=null,(Ut=new K).setAnimationLoop(function(t){Rt.isPresenting()||Bt&&Bt(t)}),"undefined"!=typeof window&&Ut.setContext(window),this.setAnimationLoop=function(t){Bt=t,Rt.setAnimationLoop(t),Ut.start()},this.render=function(t,e,n,i){var r,o,a,s,c,l;void 0!==n&&(r=n),void 0!==i&&(o=i),e&&e.isCamera&&(N||(k.geometry=null,k.program=null,k.wireframe=0,F=-1,B=null,1==t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),Rt.enabled&&(e=Rt.getCamera(e)),(P=Et.get(t,e)).init(),t.onBeforeRender(E,t,e,r||z),mt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),et.setFromMatrix(mt),ft=this.localClippingEnabled,ht=nt.init(this.clippingPlanes,ft,e),(C=Pt.get(t,e)).init(),function t(e,n,i,r){var o,a,s,c,l,u,h,p;if(0!=e.visible){if(e.layers.test(n.layers))if(e.isGroup)i=e.renderOrder;else if(e.isLOD)1==e.autoUpdate&&e.update(n);else if(e.isLight)P.pushLight(e),e.castShadow&&P.pushShadow(e);else if(e.isSprite)e.frustumCulled&&!et.intersectsSprite(e)||(r&&gt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(mt),o=Lt.update(e),(a=e.material).visible&&C.push(e,o,a,i,gt.z,null));else if(e.isImmediateRenderObject)r&&gt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(mt),C.push(e,null,e.material,i,gt.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==wt.render.frame&&(e.skeleton.update(),e.skeleton.frame=wt.render.frame),!e.frustumCulled||et.intersectsObject(e)))if(r&&gt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(mt),o=Lt.update(e),a=e.material,Array.isArray(a))for(c=0,l=(s=o.groups).length;c<l;c++)(h=a[(u=s[c]).materialIndex])&&h.visible&&C.push(e,o,h,i,gt.z,u);else a.visible&&C.push(e,o,a,i,gt.z,null);for(c=0,l=(p=e.children).length;c<l;c++)t(p[c],n,i,r)}}(t,e,0,E.sortObjects),1==E.sortObjects&&C.sort(),ht&&nt.beginShadows(),a=P.state.shadowsArray,kt.render(a,t,e),P.setupLights(e),ht&&nt.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==r&&this.setRenderTarget(r),Rt.enabled&&Ft.isAvailable()&&Ft.attachCamera(e),Nt.render(C,t,e,o),s=C.opaque,c=C.transparent,t.overrideMaterial?(l=t.overrideMaterial,s.length&&h(s,t,e,l),c.length&&h(c,t,e,l)):(s.length&&h(s,t,e),c.length&&h(c,t,e)),t.onAfterRender(E,t,e),null!==z&&(St.updateRenderTargetMipmap(z),St.updateMultisampleRenderTarget(z)),_t.buffers.depth.setTest(1),_t.buffers.depth.setMask(1),_t.buffers.color.setMask(1),_t.setPolygonOffset(0),Rt.enabled&&(Ft.isAvailable()&&Ft.detachCamera(e),Rt.submitFrame()),C=null,P=null))},this.setFramebuffer=function(t){O!==t&&vt.bindFramebuffer(36160,t),O=t},this.getActiveCubeFace=function(){return D},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return z},this.setRenderTarget=function(t,e,n){var i,r,o,a;z=t,D=e,I=n,t&&void 0===Mt.get(t).__webglFramebuffer&&St.setupRenderTarget(t),i=O,r=0,t?(o=Mt.get(t).__webglFramebuffer,t.isWebGLRenderTargetCube?(i=o[e||0],r=1):i=t.isWebGLMultisampleRenderTarget?Mt.get(t).__webglMultisampledFramebuffer:o,j.copy(t.viewport),V.copy(t.scissor),W=t.scissorTest):(j.copy(Y).multiplyScalar(X).floor(),V.copy(Z).multiplyScalar(X).floor(),W=$),R!==i&&(vt.bindFramebuffer(36160,i),R=i),_t.viewport(j),_t.scissor(V),_t.setScissorTest(W),r&&(a=Mt.get(t.texture),vt.framebufferTexture2D(36160,36064,34069+(e||0),a.__webglTexture,n||0))},this.readRenderTargetPixels=function(t,e,n,i,r,o,a){var s,c,l,u,h;if(t&&t.isWebGLRenderTarget&&(s=Mt.get(t).__webglFramebuffer,t.isWebGLRenderTargetCube&&void 0!==a&&(s=s[a]),s)){c=0,s!==R&&(vt.bindFramebuffer(36160,s),c=1);try{if(u=(l=t.texture).format,h=l.type,u!==ss&&zt.convert(u)!==vt.getParameter(35739))return;if(!(h===Xa||zt.convert(h)===vt.getParameter(35738)||h===Ka&&(bt.isWebGL2||xt.get("OES_texture_float")||xt.get("WEBGL_color_buffer_float"))||h===ts&&(bt.isWebGL2?xt.get("EXT_color_buffer_float"):xt.get("EXT_color_buffer_half_float"))))return;36053===vt.checkFramebufferStatus(36160)&&e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&vt.readPixels(e,n,i,r,zt.convert(u),zt.convert(h),o)}finally{c&&vt.bindFramebuffer(36160,R)}}},this.copyFramebufferToTexture=function(t,e,n){var i=e.image.width,r=e.image.height,o=zt.convert(e.format);St.setTexture2D(e,0),vt.copyTexImage2D(3553,n||0,o,t.x,t.y,i,r,0)},this.copyTextureToTexture=function(t,e,n,i){var r=e.image.width,o=e.image.height,a=zt.convert(n.format),s=zt.convert(n.type);St.setTexture2D(n,0),e.isDataTexture?vt.texSubImage2D(3553,i||0,t.x,t.y,r,o,a,s,e.image.data):vt.texSubImage2D(3553,i||0,t.x,t.y,a,s,e.image)},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Ue(t,e){this.name="",this.color=new x(t),this.density=void 0!==e?e:25e-5}function je(t,e,n){this.name="",this.color=new x(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function Ve(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=0,this.updateRange={offset:0,count:-1},this.version=0}function Ge(t,e,n,i){this.data=t,this.itemSize=e,this.offset=n,this.normalized=1==i}function We(t){S.call(this),this.type="SpriteMaterial",this.color=new x(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=1,this.transparent=1,this.setValues(t)}function He(t){var n;p.call(this),this.type="Sprite",void 0===gu&&(gu=new k,n=new Ve(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5),gu.setIndex([0,1,2,0,2,3]),gu.addAttribute("position",new Ge(n,3,0,0)),gu.addAttribute("uv",new Ge(n,2,3,0))),this.geometry=gu,this.material=void 0!==t?t:new We,this.center=new e(.5,.5)}function qe(t,e,n,i,r,o){bu.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(_u.x=o*bu.x-r*bu.y,_u.y=r*bu.x+o*bu.y):_u.copy(bu),t.copy(e),t.x+=_u.x,t.y+=_u.y,t.applyMatrix4(wu)}function Xe(){p.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:1,value:[]}}),this.autoUpdate=1}function Ye(t,e){t&&t.isGeometry,B.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new l,this.bindMatrixInverse=new l}function Ze(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new l)}}function Je(){p.call(this),this.type="Bone"}function $e(t,e,n){B.call(this,t,e),this.instanceMatrix=new A(new Float32Array(16*n),16),this.count=n}function Qe(t){S.call(this),this.type="LineBasicMaterial",this.color=new x(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}function Ke(t,e){p.call(this),this.type="Line",this.geometry=void 0!==t?t:new k,this.material=void 0!==e?e:new Qe({color:16777215*Math.random()})}function tn(t,e){Ke.call(this,t,e),this.type="LineSegments"}function en(t,e){Ke.call(this,t,e),this.type="LineLoop"}function nn(t){S.call(this),this.type="PointsMaterial",this.color=new x(16777215),this.map=null,this.size=1,this.sizeAttenuation=1,this.morphTargets=0,this.setValues(t)}function rn(t,e){p.call(this),this.type="Points",this.geometry=void 0!==t?t:new k,this.material=void 0!==e?e:new nn({color:16777215*Math.random()}),this.updateMorphTargets()}function on(t,e,n,r,o,a,s){var c,l,u=ju.distanceSqToPoint(t);if(u<n){if(c=new i,ju.closestPointToPoint(t,c),c.applyMatrix4(r),(l=o.ray.origin.distanceTo(c))<o.near||l>o.far)return;a.push({distance:l,distanceToRay:Math.sqrt(u),point:c,index:e,face:null,object:s})}}function an(t,e,n,i,r,a,s,c,l){o.call(this,t,e,n,i,r,a,s,c,l),this.format=void 0!==s?s:as,this.minFilter=void 0!==a?a:Wa,this.magFilter=void 0!==r?r:Wa,this.generateMipmaps=0}function sn(t,e,n,i,r,a,s,c,l,u,h,p){o.call(this,null,a,s,c,l,u,i,r,h,p),this.image={width:e,height:n},this.mipmaps=t,this.flipY=0,this.generateMipmaps=0}function cn(t,e,n,i,r,a,s,c,l){o.call(this,t,e,n,i,r,a,s,c,l),this.needsUpdate=1}function ln(t,e,n,i,r,a,s,c,l,u){if((u=void 0!==u?u:us)!==us&&u!==hs)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===us&&(n=Ja),void 0===n&&u===hs&&(n=rs),o.call(this,null,i,r,a,s,c,u,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:ja,this.minFilter=void 0!==c?c:ja,this.flipY=0,this.generateMipmaps=0}function un(t){var e,n,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S;if(k.call(this),this.type="WireframeGeometry",e=[],c=[0,0],l={},f=["a","b","c"],t&&t.isGeometry){for(n=0,o=(g=t.faces).length;n<o;n++)for(v=g[n],r=0;r<3;r++)h=v[f[r]],p=v[f[(r+1)%3]],c[0]=Math.min(h,p),c[1]=Math.max(h,p),void 0===l[d=c[0]+","+c[1]]&&(l[d]={index1:c[0],index2:c[1]});for(d in l)u=l[d],m=t.vertices[u.index1],e.push(m.x,m.y,m.z),m=t.vertices[u.index2],e.push(m.x,m.y,m.z)}else if(t&&t.isBufferGeometry)if(m=new i,null!==t.index){for(y=t.attributes.position,x=t.index,0===(b=t.groups).length&&(b=[{start:0,count:x.count,materialIndex:0}]),a=0,s=b.length;a<s;++a)for(n=w=(_=b[a]).start,o=w+_.count;n<o;n+=3)for(r=0;r<3;r++)h=x.getX(n+r),p=x.getX(n+(r+1)%3),c[0]=Math.min(h,p),c[1]=Math.max(h,p),void 0===l[d=c[0]+","+c[1]]&&(l[d]={index1:c[0],index2:c[1]});for(d in l)u=l[d],m.fromBufferAttribute(y,u.index1),e.push(m.x,m.y,m.z),m.fromBufferAttribute(y,u.index2),e.push(m.x,m.y,m.z)}else for(n=0,o=(y=t.attributes.position).count/3;n<o;n++)for(r=0;r<3;r++)M=3*n+r,m.fromBufferAttribute(y,M),e.push(m.x,m.y,m.z),S=3*n+(r+1)%3,m.fromBufferAttribute(y,S),e.push(m.x,m.y,m.z);this.addAttribute("position",new I(e,3))}function hn(t,e,n){V.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new pn(t,e,n)),this.mergeVertices()}function pn(t,e,n){var r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_;for(k.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n},r=[],o=[],a=[],s=[],1e-5,c=new i,l=new i,u=new i,h=new i,p=new i,t.length,m=e+1,d=0;d<=n;d++)for(g=d/n,f=0;f<=e;f++)t(v=f/e,g,l),o.push(l.x,l.y,l.z),v-1e-5>=0?(t(v-1e-5,g,u),h.subVectors(l,u)):(t(v+1e-5,g,u),h.subVectors(u,l)),g-1e-5>=0?(t(v,g-1e-5,u),p.subVectors(l,u)):(t(v,g+1e-5,u),p.subVectors(u,l)),c.crossVectors(h,p).normalize(),a.push(c.x,c.y,c.z),s.push(v,g);for(d=0;d<n;d++)for(f=0;f<e;f++)y=d*m+f,x=d*m+f+1,b=(d+1)*m+f+1,_=(d+1)*m+f,r.push(y,x,_),r.push(x,b,_);this.setIndex(r),this.addAttribute("position",new I(o,3)),this.addAttribute("normal",new I(a,3)),this.addAttribute("uv",new I(s,2))}function dn(t,e,n,i){V.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},this.fromBufferGeometry(new fn(t,e,n,i)),this.mergeVertices()}function fn(t,n,r,o){function a(t,e,n,i){var r,o,a,c,l,u,h=Math.pow(2,i),p=[];for(r=0;r<=h;r++)for(p[r]=[],a=t.clone().lerp(n,r/h),c=e.clone().lerp(n,r/h),l=h-r,o=0;o<=l;o++)p[r][o]=0===o&&r===h?a:a.clone().lerp(c,o/l);for(r=0;r<h;r++)for(o=0;o<2*(h-r)-1;o++)u=Math.floor(o/2),o%2==0?(s(p[r][u+1]),s(p[r+1][u]),s(p[r][u])):(s(p[r][u+1]),s(p[r+1][u+1]),s(p[r+1][u]))}function s(t){h.push(t.x,t.y,t.z)}function c(e,n){var i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function l(t,e,n,i){i<0&&1===t.x&&(p[e]=t.x-1),0===n.x&&0===n.z&&(p[e]=i/2/Math.PI+.5)}function u(t){return Math.atan2(t.z,-t.x)}var h,p;k.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:n,radius:r,detail:o},r=r||1,h=[],p=[],function(t){var e,r=new i,o=new i,s=new i;for(e=0;e<n.length;e+=3)c(n[e+0],r),c(n[e+1],o),c(n[e+2],s),a(r,o,s,t)}(o=o||0),function(t){var e,n=new i;for(e=0;e<h.length;e+=3)n.x=h[e+0],n.y=h[e+1],n.z=h[e+2],n.normalize().multiplyScalar(t),h[e+0]=n.x,h[e+1]=n.y,h[e+2]=n.z}(r),function(){var t,n,r,o,a=new i;for(t=0;t<h.length;t+=3)a.x=h[t+0],a.y=h[t+1],a.z=h[t+2],n=u(a)/2/Math.PI+.5,r=Math.atan2(-(o=a).y,Math.sqrt(o.x*o.x+o.z*o.z))/Math.PI+.5,p.push(n,1-r);!function(){var t,n,r,o,a,s,c,d,f,m;for(t=new i,n=new i,r=new i,o=new i,a=new e,s=new e,c=new e,d=0,f=0;d<h.length;d+=9,f+=6)t.set(h[d+0],h[d+1],h[d+2]),n.set(h[d+3],h[d+4],h[d+5]),r.set(h[d+6],h[d+7],h[d+8]),a.set(p[f+0],p[f+1]),s.set(p[f+2],p[f+3]),c.set(p[f+4],p[f+5]),o.copy(t).add(n).add(r).divideScalar(3),l(a,f+0,t,m=u(o)),l(s,f+2,n,m),l(c,f+4,r,m)}(),function(){var t,e,n,i;for(t=0;t<p.length;t+=6)e=p[t+0],n=p[t+2],i=p[t+4],Math.max(e,n,i)>.9&&Math.min(e,n,i)<.1&&(e<.2&&(p[t+0]+=1),n<.2&&(p[t+2]+=1),i<.2&&(p[t+4]+=1))}()}(),this.addAttribute("position",new I(h,3)),this.addAttribute("normal",new I(h.slice(),3)),this.addAttribute("uv",new I(p,2)),0===o?this.computeVertexNormals():this.normalizeNormals()}function mn(t,e){V.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new gn(t,e)),this.mergeVertices()}function gn(t,e){fn.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],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function vn(t,e){V.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new yn(t,e)),this.mergeVertices()}function yn(t,e){fn.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],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function xn(t,e){V.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new bn(t,e)),this.mergeVertices()}function bn(t,e){var n=1.618033988749895,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];fn.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function _n(t,e){V.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new wn(t,e)),this.mergeVertices()}function wn(t,e){var n=1.618033988749895,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];fn.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Mn(t,e,n,i,r){V.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};var o=new Sn(t,e,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Sn(t,n,r,o,a){function s(e){var i,a,s,h,d;for(p=t.getPointAt(e/n,p),i=c.normals[e],a=c.binormals[e],f=0;f<=o;f++)h=Math.sin(s=f/o*Math.PI*2),d=-Math.cos(s),u.x=d*i.x+h*a.x,u.y=d*i.y+h*a.y,u.z=d*i.z+h*a.z,u.normalize(),g.push(u.x,u.y,u.z),l.x=p.x+r*u.x,l.y=p.y+r*u.y,l.z=p.z+r*u.z,m.push(l.x,l.y,l.z)}var c,l,u,h,p,d,f,m,g,v,y;k.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:n,radius:r,radialSegments:o,closed:a},n=n||64,r=r||1,o=o||8,a=a||0,c=t.computeFrenetFrames(n,a),this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals,l=new i,u=new i,h=new e,p=new i,m=[],g=[],v=[],y=[],function(){for(d=0;d<n;d++)s(d);s(0==a?n:0),function(){for(d=0;d<=n;d++)for(f=0;f<=o;f++)h.x=d/n,h.y=f/o,v.push(h.x,h.y)}(),function(){var t,e,i,r;for(f=1;f<=n;f++)for(d=1;d<=o;d++)t=(o+1)*(f-1)+(d-1),e=(o+1)*f+(d-1),i=(o+1)*f+d,r=(o+1)*(f-1)+d,y.push(t,e,r),y.push(e,i,r)}()}(),this.setIndex(y),this.addAttribute("position",new I(m,3)),this.addAttribute("normal",new I(g,3)),this.addAttribute("uv",new I(v,2))}function Tn(t,e,n,i,r,o){V.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},this.fromBufferGeometry(new An(t,e,n,i,r,o)),this.mergeVertices()}function An(t,e,n,r,o,a){function s(t,e,n,i,r){var o=Math.cos(t),a=Math.sin(t),s=n/e*t,c=Math.cos(s);r.x=i*(2+c)*.5*o,r.y=i*(2+c)*a*.5,r.z=i*Math.sin(s)*.5}var c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A,L,C;for(k.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:o,q:a},t=t||1,e=e||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,o=o||2,a=a||3,c=[],l=[],u=[],h=[],f=new i,m=new i,g=new i,v=new i,y=new i,x=new i,b=new i,p=0;p<=n;++p)for(s(_=p/n*o*Math.PI*2,o,a,t,g),s(_+.01,o,a,t,v),x.subVectors(v,g),b.addVectors(v,g),y.crossVectors(x,b),b.crossVectors(y,x),y.normalize(),b.normalize(),d=0;d<=r;++d)M=-e*Math.cos(w=d/r*Math.PI*2),S=e*Math.sin(w),f.x=g.x+(M*b.x+S*y.x),f.y=g.y+(M*b.y+S*y.y),f.z=g.z+(M*b.z+S*y.z),l.push(f.x,f.y,f.z),m.subVectors(f,g).normalize(),u.push(m.x,m.y,m.z),h.push(p/n),h.push(d/r);for(d=1;d<=n;d++)for(p=1;p<=r;p++)T=(r+1)*(d-1)+(p-1),A=(r+1)*d+(p-1),L=(r+1)*d+p,C=(r+1)*(d-1)+p,c.push(T,A,C),c.push(A,L,C);this.setIndex(c),this.addAttribute("position",new I(l,3)),this.addAttribute("normal",new I(u,3)),this.addAttribute("uv",new I(h,2))}function Ln(t,e,n,i,r){V.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new Cn(t,e,n,i,r)),this.mergeVertices()}function Cn(t,e,n,r,o){var a,s,c,l,u,h,p,d,f,m,g,v,y,x,b;for(k.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:o},t=t||1,e=e||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,o=o||2*Math.PI,a=[],s=[],c=[],l=[],u=new i,h=new i,p=new i,d=0;d<=n;d++)for(f=0;f<=r;f++)m=f/r*o,g=d/n*Math.PI*2,h.x=(t+e*Math.cos(g))*Math.cos(m),h.y=(t+e*Math.cos(g))*Math.sin(m),h.z=e*Math.sin(g),s.push(h.x,h.y,h.z),u.x=t*Math.cos(m),u.y=t*Math.sin(m),p.subVectors(h,u).normalize(),c.push(p.x,p.y,p.z),l.push(f/r),l.push(d/n);for(d=1;d<=n;d++)for(f=1;f<=r;f++)v=(r+1)*d+f-1,y=(r+1)*(d-1)+f-1,x=(r+1)*(d-1)+f,b=(r+1)*d+f,a.push(v,y,b),a.push(y,x,b);this.setIndex(a),this.addAttribute("position",new I(s,3)),this.addAttribute("normal",new I(c,3)),this.addAttribute("uv",new I(l,2))}function Pn(t,e,n,i,r){var o,a;if(r===function(t,e,n,i){for(var r=0,o=e,a=n-i;o<n;o+=i)r+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return r}(t,e,n,i)>0)for(o=e;o<n;o+=i)a=Xn(o,t[o],t[o+1],a);else for(o=n-i;o>=e;o-=i)a=Xn(o,t[o],t[o+1],a);return a&&Gn(a,a.next)&&(Yn(a),a=a.next),a}function En(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=0,i.steiner||!Gn(i,i.next)&&0!==Vn(i.prev,i,i.next))i=i.next;else{if(Yn(i),(i=e=i.prev)===i.next)break;n=1}}while(n||i!==e);return e}function Nn(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=kn(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,c,l=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e<l&&(s++,i=i.nextZ);e++);for(c=l;s>0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(a>1)}(r)}(t,i,r,o);for(var s,c,l=t;t.prev!==t.next;)if(s=t.prev,c=t.next,o?Dn(t,i,r,o):On(t))e.push(s.i/n),e.push(t.i/n),e.push(c.i/n),Yn(t),t=c.next,l=c.next;else if((t=c)===l){a?1===a?Nn(t=In(t,e,n),e,n,i,r,o,2):2===a&&zn(t,e,n,i,r,o):Nn(En(t),e,n,i,r,o,1);break}}}function On(t){var e,n=t.prev,i=t,r=t.next;if(Vn(n,i,r)>=0)return 0;for(e=t.next.next;e!==t.prev;){if(Un(n.x,n.y,i.x,i.y,r.x,r.y,e.x,e.y)&&Vn(e.prev,e,e.next)>=0)return 0;e=e.next}return 1}function Dn(t,e,n,i){var r,o,a,s,c,l,u,h,p=t.prev,d=t,f=t.next;if(Vn(p,d,f)>=0)return 0;for(r=p.x<d.x?p.x<f.x?p.x:f.x:d.x<f.x?d.x:f.x,o=p.y<d.y?p.y<f.y?p.y:f.y:d.y<f.y?d.y:f.y,a=p.x>d.x?p.x>f.x?p.x:f.x:d.x>f.x?d.x:f.x,s=p.y>d.y?p.y>f.y?p.y:f.y:d.y>f.y?d.y:f.y,c=kn(r,o,e,n,i),l=kn(a,s,e,n,i),u=t.prevZ,h=t.nextZ;u&&u.z>=c&&h&&h.z<=l;){if(u!==t.prev&&u!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,u.x,u.y)&&Vn(u.prev,u,u.next)>=0)return 0;if(u=u.prevZ,h!==t.prev&&h!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,h.x,h.y)&&Vn(h.prev,h,h.next)>=0)return 0;h=h.nextZ}for(;u&&u.z>=c;){if(u!==t.prev&&u!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,u.x,u.y)&&Vn(u.prev,u,u.next)>=0)return 0;u=u.prevZ}for(;h&&h.z<=l;){if(h!==t.prev&&h!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,h.x,h.y)&&Vn(h.prev,h,h.next)>=0)return 0;h=h.nextZ}return 1}function In(t,e,n){var i,r,o=t;do{!Gn(i=o.prev,r=o.next.next)&&Wn(i,o,o.next,r)&&Hn(i,r)&&Hn(r,i)&&(e.push(i.i/n),e.push(o.i/n),e.push(r.i/n),Yn(o),Yn(o.next),o=t=r),o=o.next}while(o!==t);return o}function zn(t,e,n,i,r,o){var a,s,c=t;do{for(a=c.next.next;a!==c.prev;){if(c.i!==a.i&&jn(c,a))return s=qn(c,a),c=En(c,c.next),s=En(s,s.next),Nn(c,e,n,i,r,o),void Nn(s,e,n,i,r,o);a=a.next}c=c.next}while(c!==t)}function Rn(t,e){return t.x-e.x}function Fn(t,e){if(e=function(t,e){var n,i,r,o,a,s,c,l=e,u=t.x,h=t.y,p=-1/0;do{if(h<=l.y&&h>=l.next.y&&l.next.y!==l.y&&(i=l.x+(h-l.y)*(l.next.x-l.x)/(l.next.y-l.y))<=u&&i>p){if(p=i,i===u){if(h===l.y)return l;if(h===l.next.y)return l.next}n=l.x<l.next.x?l:l.next}l=l.next}while(l!==e);if(!n)return null;if(u===p)return n.prev;for(r=n,o=n.x,a=n.y,s=1/0,l=n.next;l!==r;)u>=l.x&&l.x>=o&&u!==l.x&&Un(h<a?u:p,h,o,a,h<a?p:u,h,l.x,l.y)&&((c=Math.abs(h-l.y)/(u-l.x))<s||c===s&&l.x>n.x)&&Hn(l,t)&&(n=l,s=c),l=l.next;return n}(t,e)){var n=qn(e,t);En(n,n.next)}}function kn(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Bn(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Un(t,e,n,i,r,o,a,s){return(r-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function jn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Wn(n,n.next,t,e))return 1;n=n.next}while(n!==t);return 0}(t,e)&&Hn(t,e)&&Hn(e,t)&&function(t,e){var n=t,i=0,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function Vn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Gn(t,e){return t.x===e.x&&t.y===e.y}function Wn(t,e,n,i){return Gn(t,n)&&Gn(e,i)||Gn(t,i)&&Gn(n,e)?1:Vn(t,e,n)>0!=Vn(t,e,i)>0&&Vn(n,i,t)>0!=Vn(n,i,e)>0}function Hn(t,e){return Vn(t.prev,t,t.next)<0?Vn(t,e,t.next)>=0&&Vn(t,t.prev,e)>=0:Vn(t,e,t.prev)<0||Vn(t,t.next,e)<0}function qn(t,e){var n=new Zn(t.i,t.x,t.y),i=new Zn(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function Xn(t,e,n,i){var r=new Zn(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Yn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Zn(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=0}function Jn(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function $n(t,e){for(var n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}function Qn(t,e){V.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new Kn(t,e)),this.mergeVertices()}function Kn(t,n){function r(t){function r(t,e,n){return e.clone().multiplyScalar(n).add(t)}function c(t,n,i){var r,o,a,s,c,l,u,h,p,d,f=t.x-n.x,m=t.y-n.y,g=i.x-t.x,v=i.y-t.y,y=f*f+m*m;if(Math.abs(f*v-m*g)>Number.EPSILON){if(s=Math.sqrt(y),c=Math.sqrt(g*g+v*v),l=n.x-m/s,u=n.y+f/s,(p=(r=l+f*(h=((i.x-v/c-l)*v-(i.y+g/c-u)*g)/(f*v-m*g))-t.x)*r+(o=u+m*h-t.y)*o)<=2)return new e(r,o);a=Math.sqrt(p/2)}else d=0,f>Number.EPSILON?g>Number.EPSILON&&(d=1):f<-Number.EPSILON?g<-Number.EPSILON&&(d=1):Math.sign(m)===Math.sign(v)&&(d=1),d?(r=-m,o=f,a=Math.sqrt(y)):(r=f,o=m,a=Math.sqrt(y/2));return new e(r/a,o/a)}function l(t,e){var n,i,r,o,a,s;for(k=t.length;--k>=0;)for(n=k,(i=k-1)<0&&(i=t.length-1),r=0,o=Y+2*tt,r=0;r<o;r++)p(e+n+(a=I*r),e+i+a,e+i+(s=I*(r+1)),e+n+s)}function u(t,e,n){q.push(t),q.push(e),q.push(n)}function h(t,e,n){var i,r;d(t),d(e),d(n),i=a.length/3,f((r=nt.generateTopUV(o,a,i-3,i-2,i-1))[0]),f(r[1]),f(r[2])}function p(t,e,n,i){var r,s;d(t),d(e),d(i),d(e),d(n),d(i),r=a.length/3,f((s=nt.generateSideWallUV(o,a,r-6,r-3,r-2,r-1))[0]),f(s[1]),f(s[3]),f(s[1]),f(s[2]),f(s[3])}function d(t){a.push(q[3*t+0]),a.push(q[3*t+1]),a.push(q[3*t+2])}function f(t){s.push(t.x),s.push(t.y)}var m,g,v,y,x,b,_,w,M,S,T,A,L,C,P,E,N,O,D,I,z,R,F,k,B,U,j,V,G,W,H,q=[],X=void 0!==n.curveSegments?n.curveSegments:12,Y=void 0!==n.steps?n.steps:1,Z=void 0!==n.depth?n.depth:100,J=void 0!==n.bevelEnabled?n.bevelEnabled:1,$=void 0!==n.bevelThickness?n.bevelThickness:6,Q=void 0!==n.bevelSize?n.bevelSize:$-2,K=void 0!==n.bevelOffset?n.bevelOffset:0,tt=void 0!==n.bevelSegments?n.bevelSegments:3,et=n.extrudePath,nt=void 0!==n.UVGenerator?n.UVGenerator:qu;if(void 0!==n.amount&&(Z=n.amount),g=0,et&&(m=et.getSpacedPoints(Y),g=1,J=0,v=et.computeFrenetFrames(Y,0),y=new i,x=new i,b=new i),J||(tt=0,$=0,Q=0,K=0),T=(S=t.extractPoints(X)).shape,A=S.holes,!Hu.isClockWise(T))for(T=T.reverse(),w=0,M=A.length;w<M;w++)_=A[w],Hu.isClockWise(_)&&(A[w]=_.reverse());for(L=Hu.triangulateShape(T,A),C=T,w=0,M=A.length;w<M;w++)_=A[w],T=T.concat(_);for(I=T.length,R=L.length,F=[],k=0,U=(B=C.length)-1,j=k+1;k<B;k++,U++,j++)U===B&&(U=0),j===B&&(j=0),F[k]=c(C[k],C[U],C[j]);for(V=[],W=F.concat(),w=0,M=A.length;w<M;w++){for(_=A[w],G=[],k=0,U=(B=_.length)-1,j=k+1;k<B;k++,U++,j++)U===B&&(U=0),j===B&&(j=0),G[k]=c(_[k],_[U],_[j]);V.push(G),W=W.concat(G)}for(P=0;P<tt;P++){for(O=$*Math.cos((N=P/tt)*Math.PI/2),E=Q*Math.sin(N*Math.PI/2)+K,k=0,B=C.length;k<B;k++)u((D=r(C[k],F[k],E)).x,D.y,-O);for(w=0,M=A.length;w<M;w++)for(_=A[w],G=V[w],k=0,B=_.length;k<B;k++)u((D=r(_[k],G[k],E)).x,D.y,-O)}for(E=Q+K,k=0;k<I;k++)D=J?r(T[k],W[k],E):T[k],g?(x.copy(v.normals[0]).multiplyScalar(D.x),y.copy(v.binormals[0]).multiplyScalar(D.y),b.copy(m[0]).add(x).add(y),u(b.x,b.y,b.z)):u(D.x,D.y,0);for(H=1;H<=Y;H++)for(k=0;k<I;k++)D=J?r(T[k],W[k],E):T[k],g?(x.copy(v.normals[H]).multiplyScalar(D.x),y.copy(v.binormals[H]).multiplyScalar(D.y),b.copy(m[H]).add(x).add(y),u(b.x,b.y,b.z)):u(D.x,D.y,Z/Y*H);for(P=tt-1;P>=0;P--){for(O=$*Math.cos((N=P/tt)*Math.PI/2),E=Q*Math.sin(N*Math.PI/2)+K,k=0,B=C.length;k<B;k++)u((D=r(C[k],F[k],E)).x,D.y,Z+O);for(w=0,M=A.length;w<M;w++)for(_=A[w],G=V[w],k=0,B=_.length;k<B;k++)D=r(_[k],G[k],E),g?u(D.x,D.y+m[Y-1].y,m[Y-1].x+O):u(D.x,D.y,Z+O)}!function(){var t,e=a.length/3;if(J){for(t=0*I,k=0;k<R;k++)h((z=L[k])[2]+t,z[1]+t,z[0]+t);for(t=I*(Y+2*tt),k=0;k<R;k++)h((z=L[k])[0]+t,z[1]+t,z[2]+t)}else{for(k=0;k<R;k++)h((z=L[k])[2],z[1],z[0]);for(k=0;k<R;k++)h((z=L[k])[0]+I*Y,z[1]+I*Y,z[2]+I*Y)}o.addGroup(e,a.length/3-e,0)}(),function(){var t=a.length/3,e=0;for(l(C,e),e+=C.length,w=0,M=A.length;w<M;w++)l(_=A[w],e),e+=_.length;o.addGroup(t,a.length/3-t,1)}()}var o,a,s,c,l;for(k.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:n},o=this,a=[],s=[],c=0,l=(t=Array.isArray(t)?t:[t]).length;c<l;c++)r(t[c]);this.addAttribute("position",new I(a,3)),this.addAttribute("uv",new I(s,2)),this.computeVertexNormals()}function ti(t,e,n){var i,r,o;if(n.shapes=[],Array.isArray(t))for(i=0,r=t.length;i<r;i++)o=t[i],n.shapes.push(o.uuid);else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}function ei(t,e){V.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new ni(t,e)),this.mergeVertices()}function ni(t,e){var n,i;if(!(n=(e=e||{}).font)||!n.isFont)return new V;i=n.generateShapes(t,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=0),Kn.call(this,i,e),this.type="TextBufferGeometry"}function ii(t,e,n,i,r,o,a){V.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new ri(t,e,n,i,r,o,a)),this.mergeVertices()}function ri(t,e,n,r,o,a,s){var c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A;for(k.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:o,thetaStart:a,thetaLength:s},t=t||1,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,c=Math.min((a=void 0!==a?a:0)+(s=void 0!==s?s:Math.PI),Math.PI),h=0,p=[],d=new i,f=new i,m=[],g=[],v=[],y=[],u=0;u<=n;u++){for(x=[],b=u/n,_=0,0==u&&0==a?_=.5/e:u==n&&c==Math.PI&&(_=-.5/e),l=0;l<=e;l++)w=l/e,d.x=-t*Math.cos(r+w*o)*Math.sin(a+b*s),d.y=t*Math.cos(a+b*s),d.z=t*Math.sin(r+w*o)*Math.sin(a+b*s),g.push(d.x,d.y,d.z),f.copy(d).normalize(),v.push(f.x,f.y,f.z),y.push(w+_,1-b),x.push(h++);p.push(x)}for(u=0;u<n;u++)for(l=0;l<e;l++)M=p[u][l+1],S=p[u][l],T=p[u+1][l],A=p[u+1][l+1],(0!==u||a>0)&&m.push(M,S,A),(u!==n-1||c<Math.PI)&&m.push(S,T,A);this.setIndex(m),this.addAttribute("position",new I(g,3)),this.addAttribute("normal",new I(v,3)),this.addAttribute("uv",new I(y,2))}function oi(t,e,n,i,r,o){V.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new ai(t,e,n,i,r,o)),this.mergeVertices()}function ai(t,n,r,o,a,s){var c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M;for(k.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:n,thetaSegments:r,phiSegments:o,thetaStart:a,thetaLength:s},t=t||.5,n=n||1,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI,r=void 0!==r?Math.max(3,r):8,c=[],l=[],u=[],h=[],d=t,f=(n-t)/(o=void 0!==o?Math.max(1,o):1),m=new i,g=new e,v=0;v<=o;v++){for(y=0;y<=r;y++)p=a+y/r*s,m.x=d*Math.cos(p),m.y=d*Math.sin(p),l.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/n+1)/2,g.y=(m.y/n+1)/2,h.push(g.x,g.y);d+=f}for(v=0;v<o;v++)for(x=v*(r+1),y=0;y<r;y++)b=p=y+x,_=p+r+1,w=p+r+2,M=p+1,c.push(b,_,M),c.push(_,w,M);this.setIndex(c),this.addAttribute("position",new I(l,3)),this.addAttribute("normal",new I(u,3)),this.addAttribute("uv",new I(h,2))}function si(t,e,n,i){V.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},this.fromBufferGeometry(new ci(t,e,n,i)),this.mergeVertices()}function ci(t,n,r,o){var a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T;for(k.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:n,phiStart:r,phiLength:o},n=Math.floor(n)||12,r=r||0,o=o||2*Math.PI,o=ic.clamp(o,0,2*Math.PI),a=[],s=[],c=[],u=1/n,h=new i,p=new e,d=0;d<=n;d++)for(g=Math.sin(m=r+d*u*o),v=Math.cos(m),f=0;f<=t.length-1;f++)h.x=t[f].x*g,h.y=t[f].y,h.z=t[f].x*v,s.push(h.x,h.y,h.z),p.x=d/n,p.y=f/(t.length-1),c.push(p.x,p.y);for(d=0;d<n;d++)for(f=0;f<t.length-1;f++)y=l=f+d*t.length,x=l+t.length,b=l+t.length+1,_=l+1,a.push(y,x,_),a.push(x,b,_);if(this.setIndex(a),this.addAttribute("position",new I(s,3)),this.addAttribute("uv",new I(c,2)),this.computeVertexNormals(),o===2*Math.PI)for(w=this.attributes.normal.array,M=new i,S=new i,T=new i,l=n*t.length*3,d=0,f=0;d<t.length;d++,f+=3)M.x=w[f+0],M.y=w[f+1],M.z=w[f+2],S.x=w[l+f+0],S.y=w[l+f+1],S.z=w[l+f+2],T.addVectors(M,S).normalize(),w[f+0]=w[l+f+0]=T.x,w[f+1]=w[l+f+1]=T.y,w[f+2]=w[l+f+2]=T.z}function li(t,e){V.call(this),this.type="ShapeGeometry","object"==typeof e&&(e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new ui(t,e)),this.mergeVertices()}function ui(t,e){function n(t){var n,s,l,u,h,p,d,f,m,g=r.length/3,v=t.extractPoints(e),y=v.shape,x=v.holes;for(0==Hu.isClockWise(y)&&(y=y.reverse()),n=0,s=x.length;n<s;n++)l=x[n],1==Hu.isClockWise(l)&&(x[n]=l.reverse());for(u=Hu.triangulateShape(y,x),n=0,s=x.length;n<s;n++)l=x[n],y=y.concat(l);for(n=0,s=y.length;n<s;n++)h=y[n],r.push(h.x,h.y,0),o.push(0,0,1),a.push(h.x,h.y);for(n=0,s=u.length;n<s;n++)d=(p=u[n])[0]+g,f=p[1]+g,m=p[2]+g,i.push(d,f,m),c+=3}var i,r,o,a,s,c,l;if(k.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12,i=[],r=[],o=[],a=[],s=0,c=0,0==Array.isArray(t))n(t);else for(l=0;l<t.length;l++)n(t[l]),this.addGroup(s,c,l),s+=c,c=0;this.setIndex(i),this.addAttribute("position",new I(r,3)),this.addAttribute("normal",new I(o,3)),this.addAttribute("uv",new I(a,2))}function hi(t,e){var n,i,r;if(e.shapes=[],Array.isArray(t))for(n=0,i=t.length;n<i;n++)r=t[n],e.shapes.push(r.uuid);else e.shapes.push(t.uuid);return e}function pi(t,e){var n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y;for(k.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,n=[],i=Math.cos(ic.DEG2RAD*e),r=[0,0],o={},l=["a","b","c"],t.isBufferGeometry?(u=new V).fromBufferGeometry(t):u=t.clone(),u.mergeVertices(),u.computeFaceNormals(),h=u.vertices,d=0,f=(p=u.faces).length;d<f;d++)for(m=p[d],g=0;g<3;g++)a=m[l[g]],s=m[l[(g+1)%3]],r[0]=Math.min(a,s),r[1]=Math.max(a,s),void 0===o[c=r[0]+","+r[1]]?o[c]={index1:r[0],index2:r[1],face1:d,face2:void 0}:o[c].face2=d;for(c in o)(void 0===(v=o[c]).face2||p[v.face1].normal.dot(p[v.face2].normal)<=i)&&(y=h[v.index1],n.push(y.x,y.y,y.z),y=h[v.index2],n.push(y.x,y.y,y.z));this.addAttribute("position",new I(n,3))}function di(t,e,n,i,r,o,a,s){V.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new fi(t,e,n,i,r,o,a,s)),this.mergeVertices()}function fi(t,n,r,o,a,s,c,l){function u(r){var a,s,u,v,b,_,w,M=new e,S=new i,T=0,A=1==r?t:n,L=1==r?1:-1,C=g;for(a=1;a<=o;a++)d.push(0,y*L,0),f.push(0,L,0),m.push(.5,.5),g++;for(s=g,a=0;a<=o;a++)v=Math.cos(u=a/o*l+c),b=Math.sin(u),S.x=A*b,S.y=y*L,S.z=A*v,d.push(S.x,S.y,S.z),f.push(0,L,0),M.x=.5*v+.5,M.y=.5*b*L+.5,m.push(M.x,M.y),g++;for(a=0;a<o;a++)_=C+a,w=s+a,1==r?p.push(w,w+1,_):p.push(w+1,w,_),T+=3;h.addGroup(x,T,1==r?1:2),x+=T}var h,p,d,f,m,g,v,y,x;k.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:n,height:r,radialSegments:o,heightSegments:a,openEnded:s,thetaStart:c,thetaLength:l},h=this,t=void 0!==t?t:1,n=void 0!==n?n:1,r=r||1,o=Math.floor(o)||8,a=Math.floor(a)||1,s=void 0!==s?s:0,c=void 0!==c?c:0,l=void 0!==l?l:2*Math.PI,p=[],d=[],f=[],m=[],g=0,v=[],y=r/2,x=0,function(){var e,s,u,b,_,w,M,S,T,A,L,C,P,E=new i,N=new i,O=0,D=(n-t)/r;for(s=0;s<=a;s++){for(u=[],_=(b=s/a)*(n-t)+t,e=0;e<=o;e++)S=Math.sin(M=(w=e/o)*l+c),T=Math.cos(M),N.x=_*S,N.y=-b*r+y,N.z=_*T,d.push(N.x,N.y,N.z),E.set(S,D,T).normalize(),f.push(E.x,E.y,E.z),m.push(w,1-b),u.push(g++);v.push(u)}for(e=0;e<o;e++)for(s=0;s<a;s++)A=v[s][e],L=v[s+1][e],C=v[s+1][e+1],P=v[s][e+1],p.push(A,L,P),p.push(L,C,P),O+=6;h.addGroup(x,O,0),x+=O}(),0==s&&(t>0&&u(1),n>0&&u(0)),this.setIndex(p),this.addAttribute("position",new I(d,3)),this.addAttribute("normal",new I(f,3)),this.addAttribute("uv",new I(m,2))}function mi(t,e,n,i,r,o,a){di.call(this,0,t,e,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function gi(t,e,n,i,r,o,a){fi.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function vi(t,e,n,i){V.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new yi(t,e,n,i)),this.mergeVertices()}function yi(t,n,r,o){var a,s,c,l,u,h,p,d,f;for(k.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:n,thetaStart:r,thetaLength:o},t=t||1,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,a=[],s=[],c=[],l=[],p=new i,d=new e,s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),h=0,u=3;h<=n;h++,u+=3)f=r+h/n*o,p.x=t*Math.cos(f),p.y=t*Math.sin(f),s.push(p.x,p.y,p.z),c.push(0,0,1),d.x=(s[u]/t+1)/2,d.y=(s[u+1]/t+1)/2,l.push(d.x,d.y);for(u=1;u<=n;u++)a.push(u,u+1,0);this.setIndex(a),this.addAttribute("position",new I(s,3)),this.addAttribute("normal",new I(c,3)),this.addAttribute("uv",new I(l,2))}function xi(t){S.call(this),this.type="ShadowMaterial",this.color=new x(0),this.transparent=1,this.setValues(t)}function bi(t){H.call(this,t),this.type="RawShaderMaterial"}function _i(t){S.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new x(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new x(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$s,this.normalScale=new e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function wi(t){_i.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new e(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(t)}function Mi(t){S.call(this),this.type="MeshPhongMaterial",this.color=new x(16777215),this.specular=new x(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new x(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$s,this.normalScale=new e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=wa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Si(t){Mi.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Ti(t){S.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$s,this.normalScale=new e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=0,this.wireframeLinewidth=1,this.fog=0,this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Ai(t){S.call(this),this.type="MeshLambertMaterial",this.color=new x(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new x(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=wa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Li(t){S.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new x(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$s,this.normalScale=new e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Ci(t){Qe.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}function Pi(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Ei(t,e,n,i){Pi.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ni(t,e,n,i){Pi.call(this,t,e,n,i)}function Oi(t,e,n,i){Pi.call(this,t,e,n,i)}function Di(t,e,n,i){if(void 0===t)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Zu.convertArray(e,this.TimeBufferType),this.values=Zu.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Ii(t,e,n){Di.call(this,t,e,n)}function zi(t,e,n,i){Di.call(this,t,e,n,i)}function Ri(t,e,n,i){Di.call(this,t,e,n,i)}function Fi(t,e,n,i){Pi.call(this,t,e,n,i)}function ki(t,e,n,i){Di.call(this,t,e,n,i)}function Bi(t,e,n,i){Di.call(this,t,e,n,i)}function Ui(t,e,n,i){Di.call(this,t,e,n,i)}function ji(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=ic.generateUUID(),this.duration<0&&this.resetDuration()}function Vi(t){var e,n,i;if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");return e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ri;case"vector":case"vector2":case"vector3":case"vector4":return Ui;case"color":return zi;case"quaternion":return ki;case"bool":case"boolean":return Ii;case"string":return Bi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type),void 0===t.times&&(n=[],i=[],Zu.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i),void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function Gi(t,e,n){var i=this,r=0,o=0,a=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,0==r&&void 0!==i.onStart&&i.onStart(t,o,a),r=1},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(r=0,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){var e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){var e,n,i,r;for(e=0,n=c.length;e<n;e+=2)if(i=c[e],r=c[e+1],i.test(t))return r;return null}}function Wi(t){this.manager=void 0!==t?t:$u,this.crossOrigin="anonymous",this.path="",this.resourcePath=""}function Hi(t){Wi.call(this,t)}function qi(t){Wi.call(this,t)}function Xi(t){Wi.call(this,t)}function Yi(t){Wi.call(this,t)}function Zi(t){Wi.call(this,t)}function Ji(t){Wi.call(this,t)}function $i(t){Wi.call(this,t)}function Qi(){this.type="Curve",this.arcLengthDivisions=200}function Ki(t,e,n,i,r,o,a,s){Qi.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=a||0,this.aRotation=s||0}function tr(t,e,n,i,r,o){Ki.call(this,t,e,n,n,i,r,o),this.type="ArcCurve"}function er(){function t(t,o,a,s){e=t,n=a,i=-3*t+3*o-2*a-s,r=2*t-2*o+a+s}var e=0,n=0,i=0,r=0;return{initCatmullRom:function(e,n,i,r,o){t(n,i,o*(i-e),o*(r-n))},initNonuniformCatmullRom:function(e,n,i,r,o,a,s){var c=(n-e)/o-(i-e)/(o+a)+(i-n)/a,l=(i-n)/a-(r-n)/(a+s)+(r-i)/s;t(n,i,c*=a,l*=a)},calc:function(t){var o=t*t;return e+n*t+i*o+r*(o*t)}}}function nr(t,e,n,i){Qi.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||0,this.curveType=n||"centripetal",this.tension=i||.5}function ir(t,e,n,i,r){var o=.5*(i-e),a=.5*(r-n),s=t*t;return(2*n-2*i+o+a)*(t*s)+(-3*n+3*i-2*o-a)*s+o*t+n}function rr(t,e,n,i){return function(t){var n=1-t;return n*n*e}(t)+function(t){return 2*(1-t)*t*n}(t)+function(t){return t*t*i}(t)}function or(t,e,n,i,r){return function(t){var n=1-t;return n*n*n*e}(t)+function(t){var e=1-t;return 3*e*e*t*n}(t)+function(t){return 3*(1-t)*t*t*i}(t)+function(t){return t*t*t*r}(t)}function ar(t,n,i,r){Qi.call(this),this.type="CubicBezierCurve",this.v0=t||new e,this.v1=n||new e,this.v2=i||new e,this.v3=r||new e}function sr(t,e,n,r){Qi.call(this),this.type="CubicBezierCurve3",this.v0=t||new i,this.v1=e||new i,this.v2=n||new i,this.v3=r||new i}function cr(t,n){Qi.call(this),this.type="LineCurve",this.v1=t||new e,this.v2=n||new e}function lr(t,e){Qi.call(this),this.type="LineCurve3",this.v1=t||new i,this.v2=e||new i}function ur(t,n,i){Qi.call(this),this.type="QuadraticBezierCurve",this.v0=t||new e,this.v1=n||new e,this.v2=i||new e}function hr(t,e,n){Qi.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new i,this.v1=e||new i,this.v2=n||new i}function pr(t){Qi.call(this),this.type="SplineCurve",this.points=t||[]}function dr(){Qi.call(this),this.type="CurvePath",this.curves=[],this.autoClose=0}function fr(t){dr.call(this),this.type="Path",this.currentPoint=new e,t&&this.setFromPoints(t)}function mr(t){fr.call(this,t),this.uuid=ic.generateUUID(),this.type="Shape",this.holes=[]}function gr(t,e){p.call(this),this.type="Light",this.color=new x(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function vr(t,e,n){gr.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(p.DefaultUp),this.updateMatrix(),this.groundColor=new x(e)}function yr(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new e(512,512),this.map=null,this.mapPass=null,this.matrix=new l,this._frustum=new Q,this._frameExtents=new e(1,1),this._viewportCount=1,this._viewports=[new a(0,0,1,1)]}function xr(){yr.call(this,new X(50,1,.5,500))}function br(t,e,n,i,r,o){gr.call(this,t,e),this.type="SpotLight",this.position.copy(p.DefaultUp),this.updateMatrix(),this.target=new p,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new xr}function _r(){yr.call(this,new X(90,1,.5,500)),this._frameExtents=new e(4,2),this._viewportCount=6,this._viewports=[new a(2,1,1,1),new a(0,1,1,1),new a(3,1,1,1),new a(1,1,1,1),new a(3,0,1,1),new a(1,0,1,1)],this._cubeDirections=[new i(1,0,0),new i(-1,0,0),new i(0,0,1),new i(0,0,-1),new i(0,1,0),new i(0,-1,0)],this._cubeUps=[new i(0,1,0),new i(0,1,0),new i(0,1,0),new i(0,1,0),new i(0,0,1),new i(0,0,-1)]}function wr(t,e,n,i){gr.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new _r}function Mr(t,e,n,i,r,o){q.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==t?t:-1,this.right=void 0!==e?e:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function Sr(){yr.call(this,new Mr(-5,5,5,-5,.5,500))}function Tr(t,e){gr.call(this,t,e),this.type="DirectionalLight",this.position.copy(p.DefaultUp),this.updateMatrix(),this.target=new p,this.shadow=new Sr}function Ar(t,e){gr.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Lr(t,e,n,i){gr.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function Cr(t){Wi.call(this,t),this.textures={}}function Pr(){k.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Er(t,e,n,i){"number"==typeof n&&(i=n,n=0),A.call(this,t,e,n),this.meshPerAttribute=i||1}function Nr(t){Wi.call(this,t)}function Or(t){Wi.call(this,t)}function Dr(t){Wi.call(this,t),this.options=void 0}function Ir(){this.type="ShapePath",this.color=new x,this.subPaths=[],this.currentPath=null}function zr(t){this.type="Font",this.data=t}function Rr(t,e,n,i,r){var o,a,s,c,l,u,h,p,d,f,m,g,v=r.glyphs[t]||r.glyphs["?"];if(v){if(o=new Ir,v.o)for(m=0,g=(f=v._cachedOutline||(v._cachedOutline=v.o.split(" "))).length;m<g;)switch(f[m++]){case"m":a=f[m++]*e+n,s=f[m++]*e+i,o.moveTo(a,s);break;case"l":a=f[m++]*e+n,s=f[m++]*e+i,o.lineTo(a,s);break;case"q":c=f[m++]*e+n,l=f[m++]*e+i,u=f[m++]*e+n,h=f[m++]*e+i,o.quadraticCurveTo(u,h,c,l);break;case"b":c=f[m++]*e+n,l=f[m++]*e+i,u=f[m++]*e+n,h=f[m++]*e+i,p=f[m++]*e+n,d=f[m++]*e+i,o.bezierCurveTo(u,h,p,d,c,l)}return{offsetX:v.ha*e,path:o}}}function Fr(t){Wi.call(this,t)}function kr(t){Wi.call(this,t)}function Br(){this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new i)}function Ur(t,e){gr.call(this,void 0,e),this.sh=void 0!==t?t:new Br}function jr(t,e,n){var r,o,a,s,c;Ur.call(this,void 0,n),r=(new x).set(t),o=(new x).set(e),a=new i(r.r,r.g,r.b),s=new i(o.r,o.g,o.b),c=1.7724538509055159*Math.sqrt(.75),this.sh.coefficients[0].copy(a).add(s).multiplyScalar(1.7724538509055159),this.sh.coefficients[1].copy(a).sub(s).multiplyScalar(c)}function Vr(t,e){Ur.call(this,void 0,e);var n=(new x).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(3.5449077018110318)}function Gr(t){this.autoStart=void 0!==t?t:1,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=0}function Wr(){p.call(this),this.type="AudioListener",this.context=uh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Gr}function Hr(t){p.call(this),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=0,this.buffer=null,this.detune=0,this.loop=0,this.startTime=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=0,this.hasPlaybackControl=1,this.sourceType="empty",this.filters=[]}function qr(t){Hr.call(this,t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function Xr(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Yr(t,e,n){this.binding=t,this.valueSize=n;var i,r=Float64Array;switch(e){case"quaternion":i=this._slerp;break;case"string":case"bool":r=Array,i=this._select;break;default:i=this._lerp}this.buffer=new r(4*n),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Zr(t,e,n){var i=n||Jr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Jr(t,e,n){this.path=e,this.parsedPath=n||Jr.parseTrackName(e),this.node=Jr.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function $r(t,e,n){var i,r,o,a,s,c;for(this._mixer=t,this._clip=e,this._localRoot=n||null,r=(i=e.tracks).length,o=Array(r),a={endingStart:Fs,endingEnd:Fs},s=0;s!==r;++s)c=i[s].createInterpolant(null),o[s]=c,c.settings=a;this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Rs,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=0,this.enabled=1,this.clampWhenFinished=0,this.zeroSlopeAtStart=1,this.zeroSlopeAtEnd=1}function Qr(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Kr(t,e){"string"==typeof t&&(t=e),this.value=t}function to(t,e,n){Ve.call(this,t,e),this.meshPerAttribute=n||1}function eo(t,e){return t.distance-e.distance}function no(t,e,n,i){var r,o,a;if(0!=t.visible&&(t.raycast(e,n),1==i))for(o=0,a=(r=t.children).length;o<a;o++)no(r[o],e,n,1)}function io(t,n){this.min=void 0!==t?t:new e(1/0,1/0),this.max=void 0!==n?n:new e(-1/0,-1/0)}function ro(t,e){this.start=void 0!==t?t:new i,this.end=void 0!==e?e:new i}function oo(t){p.call(this),this.material=t,this.render=function(){}}function ao(t,e,n,i){var r,o,a,s,c,l;this.object=t,this.size=void 0!==e?e:1,r=void 0!==n?n:16711680,o=void 0!==i?i:1,a=0,(s=this.object.geometry)&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count),c=new k,l=new I(2*a*3,3),c.addAttribute("position",l),tn.call(this,c,new Qe({color:r,linewidth:o})),this.matrixAutoUpdate=0,this.update()}function so(t,e){var n,i,r,o,a,s;for(p.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=0,this.color=e,n=new k,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,o=1,32;r<32;r++,o++)0,a=o/32*Math.PI*2,i.push(1,0,1,Math.cos(a),Math.sin(a),1);n.addAttribute("position",new I(i,3)),s=new Qe({fog:0}),this.cone=new tn(n,s),this.add(this.cone),this.update()}function co(t){var e,n,i,r=function t(e){var n,i=[];for(e&&e.isBone&&i.push(e),n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),o=new k,a=[],s=[],c=new x(0,0,1),l=new x(0,1,0);for(e=0;e<r.length;e++)(n=r[e]).parent&&n.parent.isBone&&(a.push(0,0,0),a.push(0,0,0),s.push(c.r,c.g,c.b),s.push(l.r,l.g,l.b));o.addAttribute("position",new I(a,3)),o.addAttribute("color",new I(s,3)),i=new Qe({vertexColors:Ho,depthTest:0,depthWrite:0,transparent:1}),tn.call(this,o,i),this.root=t,this.bones=r,this.matrix=t.matrixWorld,this.matrixAutoUpdate=0}function lo(t,e,n){var i,r;this.light=t,this.light.updateMatrixWorld(),this.color=n,i=new ri(e,4,2),r=new T({wireframe:1,fog:0}),B.call(this,i,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=0,this.update()}function uo(t,e){var n,i,r,o,a;this.type="RectAreaLightHelper",this.light=t,this.color=e,n=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],(i=new k).addAttribute("position",new I(n,3)),i.computeBoundingSphere(),r=new Qe({fog:0}),Ke.call(this,i,r),o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],(a=new k).addAttribute("position",new I(o,3)),a.computeBoundingSphere(),this.add(new B(a,new T({side:jo,fog:0}))),this.update()}function ho(t,e,n){var i,r,o;p.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=0,this.color=n,(i=new yn(e)).rotateY(.5*Math.PI),this.material=new T({wireframe:1,fog:0}),void 0===this.color&&(this.material.vertexColors=Ho),r=i.getAttribute("position"),o=new Float32Array(3*r.count),i.addAttribute("color",new A(o,3)),this.add(new B(i,this.material)),this.update()}function po(t,e){var n,i,r;this.lightProbe=t,this.size=e,(n={}).GAMMA_OUTPUT="",i=new H({defines:n,uniforms:{sh:{value:this.lightProbe.sh.coefficients},intensity:{value:this.lightProbe.intensity}},vertexShader:"varying vec3 vNormal;\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#define RECIPROCAL_PI 0.318309886\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\t// matrix is assumed to be orthogonal\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\t// normal is assumed to have unit length\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nuniform vec3 sh[ 9 ]; // sh coefficients\nuniform float intensity; // light probe intensity\nvarying vec3 vNormal;\nvoid main() {\n\tvec3 normal = normalize( vNormal );\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, sh );\n\tvec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;\n\toutgoingLight = linearToOutput( outgoingLight );\n\tgl_FragColor = vec4( outgoingLight, 1.0 );\n}"}),r=new ri(1,32,16),B.call(this,r,i),this.onBeforeRender()}function fo(t,e,n,i){var r,o,a,s,c,l,u,h,p,d,f;for(t=t||10,e=e||10,n=new x(void 0!==n?n:4473924),i=new x(void 0!==i?i:8947848),r=e/2,o=t/e,s=[],c=[],l=0,u=0,h=-(a=t/2);l<=e;l++,h+=o)s.push(-a,0,h,a,0,h),s.push(h,0,-a,h,0,a),(p=l===r?n:i).toArray(c,u),u+=3,p.toArray(c,u),u+=3,p.toArray(c,u),u+=3,p.toArray(c,u),u+=3;(d=new k).addAttribute("position",new I(s,3)),d.addAttribute("color",new I(c,3)),f=new Qe({vertexColors:Ho}),tn.call(this,d,f)}function mo(t,e,n,i,r,o){var a,s,c,l,u,h,p,d,f,m,g;for(t=t||10,e=e||16,n=n||8,i=i||64,r=new x(void 0!==r?r:4473924),o=new x(void 0!==o?o:8947848),a=[],s=[],h=0;h<=e;h++)c=Math.sin(u=h/e*(2*Math.PI))*t,l=Math.cos(u)*t,a.push(0,0,0),a.push(c,0,l),f=1&h?r:o,s.push(f.r,f.g,f.b),s.push(f.r,f.g,f.b);for(h=0;h<=n;h++)for(f=1&h?r:o,d=t-t/n*h,p=0;p<i;p++)c=Math.sin(u=p/i*(2*Math.PI))*d,l=Math.cos(u)*d,a.push(c,0,l),s.push(f.r,f.g,f.b),c=Math.sin(u=(p+1)/i*(2*Math.PI))*d,l=Math.cos(u)*d,a.push(c,0,l),s.push(f.r,f.g,f.b);(m=new k).addAttribute("position",new I(a,3)),m.addAttribute("color",new I(s,3)),g=new Qe({vertexColors:Ho}),tn.call(this,m,g)}function go(t,e,n,i){var r,o,a,s,c;this.audio=t,this.range=e||1,this.divisionsInnerAngle=n||16,this.divisionsOuterAngle=i||2,r=new k,o=this.divisionsInnerAngle+2*this.divisionsOuterAngle,a=new Float32Array(3*(3*o+3)),r.addAttribute("position",new A(a,3)),s=new Qe({color:65280}),c=new Qe({color:16776960}),Ke.call(this,r,[c,s]),this.update()}function vo(t,e,n,i){var r,o,a,s,c,l;this.object=t,this.size=void 0!==e?e:1,r=void 0!==n?n:16776960,o=void 0!==i?i:1,a=0,(s=this.object.geometry)&&s.isGeometry&&(a=s.faces.length),c=new k,l=new I(2*a*3,3),c.addAttribute("position",l),tn.call(this,c,new Qe({color:r,linewidth:o})),this.matrixAutoUpdate=0,this.update()}function yo(t,e,n){var i,r;p.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=0,this.color=n,void 0===e&&(e=1),(i=new k).addAttribute("position",new I([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3)),r=new Qe({fog:0}),this.lightPlane=new Ke(i,r),this.add(this.lightPlane),(i=new k).addAttribute("position",new I([0,0,0,0,0,1],3)),this.targetLine=new Ke(i,r),this.add(this.targetLine),this.update()}function xo(t){function e(t,e,i){n(t,i),n(e,i)}function n(t,e){o.push(0,0,0),a.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(o.length/3-1)}var i=new k,r=new Qe({color:16777215,vertexColors:Wo}),o=[],a=[],s={},c=new x(16755200),l=new x(16711680),u=new x(43775),h=new x(16777215),p=new x(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",l),e("p","n2",l),e("p","n3",l),e("p","n4",l),e("u1","u2",u),e("u2","u3",u),e("u3","u1",u),e("c","t",h),e("p","c",p),e("cn1","cn2",p),e("cn3","cn4",p),e("cf1","cf2",p),e("cf3","cf4",p),i.addAttribute("position",new I(o,3)),i.addAttribute("color",new I(a,3)),tn.call(this,i,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=0,this.pointMap=s,this.update()}function bo(t,e,n,i,r,o,a){var s,c,l,u;if(Yh.set(r,o,a).unproject(i),void 0!==(s=e[t]))for(c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],Yh.x,Yh.y,Yh.z)}function _o(t,e){var n,i,r;this.object=t,void 0===e&&(e=16776960),n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),(r=new k).setIndex(new A(n,1)),r.addAttribute("position",new A(i,3)),tn.call(this,r,new Qe({color:e})),this.matrixAutoUpdate=0,this.update()}function wo(t,e){var n,i,r;this.type="Box3Helper",this.box=t,e=e||16776960,n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],(r=new k).setIndex(new A(n,1)),r.addAttribute("position",new I(i,3)),tn.call(this,r,new Qe({color:e})),this.geometry.computeBoundingSphere()}function Mo(t,e,n){var i,r,o,a,s;this.type="PlaneHelper",this.plane=t,this.size=void 0===e?1:e,i=void 0!==n?n:16776960,r=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],(o=new k).addAttribute("position",new I(r,3)),o.computeBoundingSphere(),Ke.call(this,o,new Qe({color:i})),a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],(s=new k).addAttribute("position",new I(a,3)),s.computeBoundingSphere(),this.add(new B(s,new T({color:i,opacity:.2,transparent:1,depthWrite:0})))}function So(t,e,n,r,o,a){p.call(this),void 0===t&&(t=new i(0,0,1)),void 0===e&&(e=new i(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===o&&(o=.2*n),void 0===a&&(a=.2*o),void 0===Qh&&((Qh=new k).addAttribute("position",new I([0,0,0,0,1,0],3)),(Kh=new fi(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new Ke(Qh,new Qe({color:r})),this.line.matrixAutoUpdate=0,this.add(this.line),this.cone=new B(Kh,new T({color:r})),this.cone.matrixAutoUpdate=0,this.add(this.cone),this.setDirection(t),this.setLength(n,o,a)}function To(t){var e,n,i,r;e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],(i=new k).addAttribute("position",new I(e,3)),i.addAttribute("color",new I(n,3)),r=new Qe({vertexColors:Ho}),tn.call(this,i,r)}function Ao(t){nr.call(this,t),this.type="catmullrom"}function Lo(t,e){return t(e={exports:{}},e.exports),e.exports}function Co(){var t=ap("#subdivideSLT").val()>0?ap("#subdivideSLT").val():void 0,e=CK.character.data.mirroredPose,n=Do(CK.character,t,e),i=(new tp).parse(n),r=Oo(),o=new Blob([i],{type:"application/sla;charset=utf-8"});op(o,r+(t?"-smooth":"")+".stl")}function Po(){var t=ap("#subdivideSLT").val()>0?ap("#subdivideSLT").val():void 0,e=CK.character.data.mirroredPose,n=Do(CK.character,t,e),i=(new ep).parse(n),r=Oo(),o=new Blob([i],{type:"text/plain;charset=utf-8"});op(o,r+(t?"-smooth":"")+".obj")}function Eo(){var t=Oo(),e=new Blob([JSON.stringify(CK.data.getJson())],{type:"text/plain;charset=utf-8"});op(e,t+".json")}function No(t){var e=t.target.files[0],n=new FileReader;n.onload=function(t){t.preventDefault(),CK.change(JSON.parse(t.target.result))},null!=e&&n.readAsText(e)}function Oo(){var t=CK.character.data.meta.character_name;return""===t?"Hero":t}function Do(t,e,n){var i=new T,r=new Ie;return t.traverseVisible(function(t){var o,a;t.isMesh&&(o=(new sp).parse(t),1==n&&(o=function(t){const e=[0,0,0];t.index&&t.copy(t.toNonIndexed());for(let n=0;n<t.attributes.position.array.length/9;n++)e[0]=t.attributes.position.array[9*n],e[1]=t.attributes.position.array[9*n+1],e[2]=t.attributes.position.array[9*n+2],t.attributes.position.array[9*n]=t.attributes.position.array[9*n+6],t.attributes.position.array[9*n+1]=t.attributes.position.array[9*n+7],t.attributes.position.array[9*n+2]=t.attributes.position.array[9*n+8],t.attributes.position.array[9*n+6]=e[0],t.attributes.position.array[9*n+7]=e[1],t.attributes.position.array[9*n+8]=e[2];return t}(o)),e&&"baseRim"!=t.name&&"base"!=t.name&&(o=function(t){return new np(e).modify(t)}(o)),a=new B(o,i),r.add(a))}),r}var Io,zo,Ro,Fo,ko,Bo,Uo,jo,Vo,Go,Wo,Ho,qo,Xo,Yo,Zo,Jo,$o,Qo,Ko,ta,ea,na,ia,ra,oa,aa,sa,ca,la,ua,ha,pa,da,fa,ma,ga,va,ya,xa,ba,_a,wa,Ma,Sa,Ta,Aa,La,Ca,Pa,Ea,Na,Oa,Da,Ia,za,Ra,Fa,ka,Ba,Ua,ja,Va,Ga,Wa,Ha,qa,Xa,Ya,Za,Ja,$a,Qa,Ka,ts,es,ns,is,rs,os,as,ss,cs,ls,us,hs,ps,ds,fs,ms,gs,vs,ys,xs,bs,_s,ws,Ms,Ss,Ts,As,Ls,Cs,Ps,Es,Ns,Os,Ds,Is,zs,Rs,Fs,ks,Bs,Us,js,Vs,Gs,Ws,Hs,qs,Xs,Ys,Zs,Js,$s,Qs,Ks,tc,ec,nc,ic,rc,oc,ac,sc,cc,lc,uc,hc,pc,dc,fc,mc,gc,vc,yc,xc,bc,_c,wc,Mc,Sc,Tc,Ac,Lc,Cc,Pc,Ec,Nc,Oc,Dc,Ic,zc,Rc,Fc,kc,Bc,Uc,jc,Vc,Gc,Wc,Hc,qc,Xc,Yc,Zc,Jc,$c,Qc,Kc,tl,el,nl,il,rl,ol,al,sl,cl,ll,ul,hl,pl,dl,fl,ml,gl,vl,yl,xl,bl,_l,wl,Ml,Sl,Tl,Al,Ll,Cl,Pl,El,Nl,Ol,Dl,Il,zl,Rl,Fl,kl,Bl,Ul,jl,Vl,Gl,Wl,Hl,ql,Xl,Yl,Zl,Jl,$l,Ql,Kl,tu,eu,nu,iu,ru,ou,au,su,cu,lu,uu,hu,pu,du,fu,mu,gu,vu,yu,xu,bu,_u,wu,Mu,Su,Tu,Au,Lu,Cu,Pu,Eu,Nu,Ou,Du,Iu,zu,Ru,Fu,ku,Bu,Uu,ju,Vu,Gu,Wu,Hu,qu,Xu,Yu,Zu,Ju,$u,Qu,Ku,th,eh,nh,ih,rh,oh,ah,sh,ch,lh,uh,hh,ph,dh,fh,mh,gh,vh,yh,xh,bh,_h,wh,Mh,Sh,Th,Ah,Lh,Ch,Ph,Eh,Nh,Oh,Dh,Ih,zh,Rh,Fh,kh,Bh,Uh,jh,Vh,Gh,Wh,Hh,qh,Xh,Yh,Zh,Jh,$h,Qh,Kh,tp,ep,np,ip,rp,op,ap,sp,cp,lp;void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){var e,n,i,r;if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(e=Object(t),n=1;n<arguments.length;n++)if(null!=(i=arguments[n]))for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);return e}),Io=0,zo=1,Ro=2,Fo=1,ko=2,Bo=3,Uo=0,jo=1,Vo=2,Go=0,Wo=1,Ho=2,qo=0,Xo=1,Yo=2,Zo=3,Jo=4,$o=5,Qo=100,Ko=101,ta=102,ea=103,na=104,ia=200,ra=201,oa=202,aa=203,sa=204,ca=205,la=206,ua=207,ha=208,pa=209,da=210,fa=0,ma=1,ga=2,va=3,ya=4,xa=5,ba=6,_a=7,wa=0,Ma=1,Sa=2,Ta=0,Aa=1,La=2,Ca=3,Pa=4,Ea=5,Na=301,Oa=302,Da=303,Ia=304,za=305,Ra=306,Fa=307,ka=1e3,Ba=1001,Ua=1002,ja=1003,Va=1004,Ga=1005,Wa=1006,Ha=1007,qa=1008,Xa=1009,Ya=1010,Za=1011,Ja=1012,$a=1013,Qa=1014,Ka=1015,ts=1016,es=1017,ns=1018,is=1019,rs=1020,os=1021,as=1022,ss=1023,cs=1024,ls=1025,us=1026,hs=1027,ps=1028,ds=33776,fs=33777,ms=33778,gs=33779,vs=35840,ys=35841,xs=35842,bs=35843,_s=36196,ws=37808,Ms=37809,Ss=37810,Ts=37811,As=37812,Ls=37813,Cs=37814,Ps=37815,Es=37816,Ns=37817,Os=37818,Ds=37819,Is=37820,zs=37821,Rs=2201,Fs=2400,ks=0,Bs=1,Us=2,js=3e3,Vs=3001,Gs=3007,Ws=3002,Hs=3003,qs=3004,Xs=3005,Ys=3006,Zs=3200,Js=3201,$s=0,Qs=1,Ks=7680,tc=519,Object.assign(t.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return 0;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){var n,i;void 0!==this._listeners&&void 0!==(n=this._listeners[t])&&-1!==(i=n.indexOf(e))&&n.splice(i,1)},dispatchEvent:function(t){var e,n,i,r;if(void 0!==this._listeners&&void 0!==(e=this._listeners[t.type]))for(t.target=this,i=0,r=(n=e.slice(0)).length;i<r;i++)n[i].call(this,t)}}),ec=[];for(nc=0;nc<256;nc++)ec[nc]=(nc<16?"0":"")+nc.toString(16);ic={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(ec[255&t]+ec[t>>8&255]+ec[t>>16&255]+ec[t>>24&255]+"-"+ec[255&e]+ec[e>>8&255]+"-"+ec[e>>16&15|64]+ec[e>>24&255]+"-"+ec[63&n|128]+ec[n>>8&255]+"-"+ec[n>>16&255]+ec[n>>24&255]+ec[255&i]+ec[i>>8&255]+ec[i>>16&255]+ec[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*ic.DEG2RAD},radToDeg:function(t){return t*ic.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}},Object.defineProperties(e.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(e.prototype,{isVector2:1,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.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 t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e){return this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}}),Object.assign(n,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,o,a){var s,c,l,u,h,p,d,f,m=n[i+0],g=n[i+1],v=n[i+2],y=n[i+3],x=r[o+0],b=r[o+1],_=r[o+2],w=r[o+3];y===w&&m===x&&g===b&&v===_||(s=1-a,l=(c=m*x+g*b+v*_+y*w)>=0?1:-1,(u=1-c*c)>Number.EPSILON&&(s=Math.sin(s*(p=Math.atan2(h=Math.sqrt(u),c*l)))/h,a=Math.sin(a*p)/h),m=m*s+x*(d=a*l),g=g*s+b*d,v=v*s+_*d,y=y*s+w*d,s===1-a&&(m*=f=1/Math.sqrt(m*m+g*g+v*v+y*y),g*=f,v*=f,y*=f)),t[e]=m,t[e+1]=g,t[e+2]=v,t[e+3]=y}}),Object.defineProperties(n.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(n.prototype,{isQuaternion:1,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){var n,i,r,o,a,s,c,l,u,h,p,d;if(!t||!t.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");return n=t._x,i=t._y,r=t._z,o=t.order,s=Math.sin,c=(a=Math.cos)(n/2),l=a(i/2),u=a(r/2),h=s(n/2),p=s(i/2),d=s(r/2),"XYZ"===o?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"YXZ"===o?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"ZXY"===o?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"ZYX"===o?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"YZX"===o?(this._x=h*l*u+c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u-h*p*d):"XZY"===o&&(this._x=h*l*u-c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u+h*p*d),0!=e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],p=i+s+h;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(u-c)*e,this._y=(o-l)*e,this._z=(a-r)*e):i>s&&i>h?(e=2*Math.sqrt(1+i-s-h),this._w=(u-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+l)/e):s>h?(e=2*Math.sqrt(1+s-i-h),this._w=(o-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+u)/e):(e=2*Math.sqrt(1+h-i-s),this._w=(a-r)/e,this._x=(o+l)/e,this._y=(c+u)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(ic.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var n,i=this.angleTo(t);return 0===i?this:(n=Math.min(1,e/i),this.slerp(t,n),this)},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,l=e._w;return this._x=n*l+o*a+i*c-r*s,this._y=i*l+o*s+r*a-n*c,this._z=r*l+o*c+n*s-i*a,this._w=o*l-n*a-i*s-r*c,this._onChangeCallback(),this},slerp:function(t,e){var n,i,r,o,a,s,c,l,u,h,p;return 0===e?this:1===e?this.copy(t):(n=this._x,i=this._y,r=this._z,(a=(o=this._w)*t._w+n*t._x+i*t._y+r*t._z)<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1?(this._w=o,this._x=n,this._y=i,this._z=r,this):(s=1-a*a)<=Number.EPSILON?(c=1-e,this._w=c*o+e*this._w,this._x=c*n+e*this._x,this._y=c*i+e*this._y,this._z=c*r+e*this._z,this.normalize(),this._onChangeCallback(),this):(h=Math.sin((1-e)*(u=Math.atan2(l=Math.sqrt(s),a)))/l,p=Math.sin(e*u)/l,this._w=o*h+this._w*p,this._x=n*h+this._x*p,this._y=i*h+this._y*p,this._z=r*h+this._z*p,this._onChangeCallback(),this))},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),rc=new i,oc=new n,Object.assign(i.prototype,{isVector3:1,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){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: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return!t||t.isEuler,this.applyQuaternion(oc.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(oc.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*n,l=s*n+a*e-r*i,u=s*i+r*n-o*e,h=-r*e-o*n-a*i;return this.x=c*s+h*-r+l*-a-u*-o,this.y=l*s+h*-o+u*-r-c*-a,this.z=u*s+h*-a+c*-o-l*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?this.crossVectors(t,e):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(t){return rc.copy(this).projectOnVector(t),this.sub(rc)},reflect:function(t){return this.sub(rc.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e,n=Math.sqrt(this.lengthSq()*t.lengthSq());return e=this.dot(t)/n,Math.acos(ic.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,n){var i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),ac=new i,Object.assign(r.prototype,{isMatrix3:1,set:function(t,e,n,i,r,o,a,s,c){var l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(t){for(var e=0,n=t.count;e<n;e++)ac.x=t.getX(e),ac.y=t.getY(e),ac.z=t.getZ(e),ac.applyMatrix3(this),t.setXYZ(e,ac.x,ac.y,ac.z);return t},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],p=n[5],d=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],x=i[7],b=i[2],_=i[5],w=i[8];return r[0]=o*f+a*v+s*b,r[3]=o*m+a*y+s*_,r[6]=o*g+a*x+s*w,r[1]=c*f+l*v+u*b,r[4]=c*m+l*y+u*_,r[7]=c*g+l*x+u*w,r[2]=h*f+p*v+d*b,r[5]=h*m+p*y+d*_,r[8]=h*g+p*x+d*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7],l=t[8];return e*o*l-e*a*c-n*r*l+n*a*s+i*r*c-i*o*s},getInverse:function(t,e){var n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v;if(t&&t.isMatrix4,n=t.elements,i=this.elements,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],0==(g=r*(d=(p=n[8])*c-l*h)+o*(f=l*u-p*s)+a*(m=h*s-c*u))){if(1==e)throw Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}return v=1/g,i[0]=d*v,i[1]=(a*h-p*o)*v,i[2]=(l*o-a*c)*v,i[3]=f*v,i[4]=(p*r-a*u)*v,i[5]=(a*s-l*r)*v,i[6]=m*v,i[7]=(o*u-h*r)*v,i[8]=(c*r-o*s)*v,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,n,i,r,o,a){var s=Math.cos(r),c=Math.sin(r);this.set(n*s,n*c,-n*(s*o+c*a)+o+t,-i*c,i*s,-i*(-c*o+s*a)+a+e,0,0,1)},scale:function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this},rotate:function(t){var e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],o=i[3],a=i[6],s=i[1],c=i[4],l=i[7];return i[0]=e*r+n*s,i[3]=e*o+n*c,i[6]=e*a+n*l,i[1]=-n*r+e*s,i[4]=-n*o+e*c,i[7]=-n*a+e*l,this},translate:function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this},equals:function(t){var e,n=this.elements,i=t.elements;for(e=0;e<9;e++)if(n[e]!==i[e])return 0;return 1},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}}),cc={getDataURL:function(t){var e,n;return"undefined"==typeof HTMLCanvasElement?t.src:(t instanceof HTMLCanvasElement?e=t:(void 0===sc&&(sc=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),sc.width=t.width,sc.height=t.height,n=sc.getContext("2d"),t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=sc),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png"))}},lc=0,o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=300,o.prototype=Object.assign(Object.create(t.prototype),{constructor:o,isTexture:1,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(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e,n,i,r,o,a=void 0===t||"string"==typeof t;if(!a&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];if(e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment},void 0!==this.image){if(void 0===(n=this.image).uuid&&(n.uuid=ic.generateUUID()),!a&&void 0===t.images[n.uuid]){if(Array.isArray(n))for(i=[],r=0,o=n.length;r<o;r++)i.push(cc.getDataURL(n[r]));else i=cc.getDataURL(n);t.images[n.uuid]={uuid:n.uuid,url:i}}e.image=n.uuid}return a||(t.textures[this.uuid]=e),e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ka:t.x=t.x-Math.floor(t.x);break;case Ba:t.x=t.x<0?0:1;break;case Ua:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ka:t.y=t.y-Math.floor(t.y);break;case Ba:t.y=t.y<0?0:1;break;case Ua:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(o.prototype,"needsUpdate",{set:function(t){1==t&&this.version++}}),Object.defineProperties(a.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(a.prototype,{isVector4:1,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,o,a,s,c,l,u,h=t.elements,p=h[0],d=h[4],f=h[8],m=h[1],g=h[5],v=h[9],y=h[2],x=h[6],b=h[10];return Math.abs(d-m)<.01&&Math.abs(f-y)<.01&&Math.abs(v-x)<.01?Math.abs(d+m)<.1&&Math.abs(f+y)<.1&&Math.abs(v+x)<.1&&Math.abs(p+g+b-3)<.1?(this.set(1,0,0,0),this):(a=(b+1)/2,s=(d+m)/4,c=(f+y)/4,l=(v+x)/4,(r=(p+1)/2)>(o=(g+1)/2)&&r>a?r<.01?(e=0,n=.707106781,i=.707106781):(n=s/(e=Math.sqrt(r)),i=c/e):o>a?o<.01?(e=.707106781,n=0,i=.707106781):(e=s/(n=Math.sqrt(o)),i=l/n):a<.01?(e=.707106781,n=.707106781,i=0):(e=c/(i=Math.sqrt(a)),n=l/i),this.set(e,n,i,3.141592653589793),this):(Math.abs(u=Math.sqrt((x-v)*(x-v)+(f-y)*(f-y)+(m-d)*(m-d)))<.001&&(u=1),this.x=(x-v)/u,this.y=(f-y)/u,this.z=(m-d)/u,this.w=Math.acos((p+g+b-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),s.prototype=Object.assign(Object.create(t.prototype),{constructor:s,isWebGLRenderTarget:1,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),c.prototype=Object.assign(Object.create(s.prototype),{constructor:c,isWebGLMultisampleRenderTarget:1,copy:function(t){return s.prototype.copy.call(this,t),this.samples=t.samples,this}}),uc=new i,hc=new l,pc=new i(0,0,0),dc=new i(1,1,1),fc=new i,mc=new i,gc=new i,Object.assign(l.prototype,{isMatrix4:1,set:function(t,e,n,i,r,o,a,s,c,l,u,h,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=h,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new l).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(t){var e=this.elements,n=t.elements,i=1/uc.setFromMatrixColumn(t,0).length(),r=1/uc.setFromMatrixColumn(t,1).length(),o=1/uc.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromEuler:function(t){var e,n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w;return!t||t.isEuler,e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r),"XYZ"===t.order?(h=o*l,p=o*u,d=a*l,f=a*u,e[0]=s*l,e[4]=-s*u,e[8]=c,e[1]=p+d*c,e[5]=h-f*c,e[9]=-a*s,e[2]=f-h*c,e[6]=d+p*c,e[10]=o*s):"YXZ"===t.order?(m=s*l,g=s*u,v=c*l,y=c*u,e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*u,e[5]=o*l,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s):"ZXY"===t.order?(m=s*l,g=s*u,v=c*l,y=c*u,e[0]=m-y*a,e[4]=-o*u,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*l,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s):"ZYX"===t.order?(h=o*l,p=o*u,d=a*l,f=a*u,e[0]=s*l,e[4]=d*c-p,e[8]=h*c+f,e[1]=s*u,e[5]=f*c+h,e[9]=p*c-d,e[2]=-c,e[6]=a*s,e[10]=o*s):"YZX"===t.order?(x=o*s,b=o*c,_=a*s,w=a*c,e[0]=s*l,e[4]=w-x*u,e[8]=_*u+b,e[1]=u,e[5]=o*l,e[9]=-a*l,e[2]=-c*l,e[6]=b*u+_,e[10]=x-w*u):"XZY"===t.order&&(x=o*s,b=o*c,_=a*s,w=a*c,e[0]=s*l,e[4]=-u,e[8]=c*l,e[1]=x*u+w,e[5]=o*l,e[9]=b*u-_,e[2]=_*u-b,e[6]=a*l,e[10]=w*u+x),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(pc,t,dc)},lookAt:function(t,e,n){var i=this.elements;return gc.subVectors(t,e),0===gc.lengthSq()&&(gc.z=1),gc.normalize(),fc.crossVectors(n,gc),0===fc.lengthSq()&&(1===Math.abs(n.z)?gc.x+=1e-4:gc.z+=1e-4,gc.normalize(),fc.crossVectors(n,gc)),fc.normalize(),mc.crossVectors(gc,fc),i[0]=fc.x,i[4]=mc.x,i[8]=gc.x,i[1]=fc.y,i[5]=mc.y,i[9]=gc.y,i[2]=fc.z,i[6]=mc.z,i[10]=gc.z,this},multiply:function(t,e){return void 0!==e?this.multiplyMatrices(t,e):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=i[0],w=i[4],M=i[8],S=i[12],T=i[1],A=i[5],L=i[9],C=i[13],P=i[2],E=i[6],N=i[10],O=i[14],D=i[3],I=i[7],z=i[11],R=i[15];return r[0]=o*_+a*T+s*P+c*D,r[4]=o*w+a*A+s*E+c*I,r[8]=o*M+a*L+s*N+c*z,r[12]=o*S+a*C+s*O+c*R,r[1]=l*_+u*T+h*P+p*D,r[5]=l*w+u*A+h*E+p*I,r[9]=l*M+u*L+h*N+p*z,r[13]=l*S+u*C+h*O+p*R,r[2]=d*_+f*T+m*P+g*D,r[6]=d*w+f*A+m*E+g*I,r[10]=d*M+f*L+m*N+g*z,r[14]=d*S+f*C+m*O+g*R,r[3]=v*_+y*T+x*P+b*D,r[7]=v*w+y*A+x*E+b*I,r[11]=v*M+y*L+x*N+b*z,r[15]=v*S+y*C+x*O+b*R,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(t){for(var e=0,n=t.count;e<n;e++)uc.x=t.getX(e),uc.y=t.getY(e),uc.z=t.getZ(e),uc.applyMatrix4(this),t.setXYZ(e,uc.x,uc.y,uc.z);return t},determinant:function(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],a=t[5],s=t[9],c=t[13],l=t[2],u=t[6],h=t[10],p=t[14];return t[3]*(+r*s*u-i*c*u-r*a*h+n*c*h+i*a*p-n*s*p)+t[7]*(+e*s*p-e*c*h+r*o*h-i*o*p+i*c*l-r*s*l)+t[11]*(+e*c*u-e*a*p-r*o*u+n*o*p+r*a*l-n*c*l)+t[15]*(-i*a*l-e*s*u+e*a*h+i*o*u-n*o*h+n*s*l)},transpose:function(){var t=this.elements,e=t[1];return t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(t,e,n){var i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this},getInverse:function(t,e){var n,i=this.elements,r=t.elements,o=r[0],a=r[1],s=r[2],c=r[3],l=r[4],u=r[5],h=r[6],p=r[7],d=r[8],f=r[9],m=r[10],g=r[11],v=r[12],y=r[13],x=r[14],b=r[15],_=f*x*p-y*m*p+y*h*g-u*x*g-f*h*b+u*m*b,w=v*m*p-d*x*p-v*h*g+l*x*g+d*h*b-l*m*b,M=d*y*p-v*f*p+v*u*g-l*y*g-d*u*b+l*f*b,S=v*f*h-d*y*h-v*u*m+l*y*m+d*u*x-l*f*x,T=o*_+a*w+s*M+c*S;if(0===T){if(1==e)throw Error("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}return n=1/T,i[0]=_*n,i[1]=(y*m*c-f*x*c-y*s*g+a*x*g+f*s*b-a*m*b)*n,i[2]=(u*x*c-y*h*c+y*s*p-a*x*p-u*s*b+a*h*b)*n,i[3]=(f*h*c-u*m*c-f*s*p+a*m*p+u*s*g-a*h*g)*n,i[4]=w*n,i[5]=(d*x*c-v*m*c+v*s*g-o*x*g-d*s*b+o*m*b)*n,i[6]=(v*h*c-l*x*c-v*s*p+o*x*p+l*s*b-o*h*b)*n,i[7]=(l*m*c-d*h*c+d*s*p-o*m*p-l*s*g+o*h*g)*n,i[8]=M*n,i[9]=(v*f*c-d*y*c-v*a*g+o*y*g+d*a*b-o*f*b)*n,i[10]=(l*y*c-v*u*c+v*a*p-o*y*p-l*a*b+o*u*b)*n,i[11]=(d*u*c-l*f*c-d*a*p+o*f*p+l*a*g-o*u*g)*n,i[12]=S*n,i[13]=(d*y*s-v*f*s+v*a*m-o*y*m-d*a*x+o*f*x)*n,i[14]=(v*u*s-l*y*s-v*a*h+o*y*h+l*a*x-o*u*x)*n,i[15]=(l*f*s-d*u*s+d*a*h-o*f*h-l*a*m+o*u*m)*n,this},scale:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,a=t.y,s=t.z,c=r*o,l=r*a;return this.set(c*o+n,c*a-i*s,c*s+i*a,0,c*a+i*s,l*a+n,l*s-i*o,0,c*s-i*a,l*s+i*o,r*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){var i=this.elements,r=e._x,o=e._y,a=e._z,s=e._w,c=r+r,l=o+o,u=a+a,h=r*c,p=r*l,d=r*u,f=o*l,m=o*u,g=a*u,v=s*c,y=s*l,x=s*u,b=n.x,_=n.y,w=n.z;return i[0]=(1-(f+g))*b,i[1]=(p+x)*b,i[2]=(d-y)*b,i[3]=0,i[4]=(p-x)*_,i[5]=(1-(h+g))*_,i[6]=(m+v)*_,i[7]=0,i[8]=(d+y)*w,i[9]=(m-v)*w,i[10]=(1-(h+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this},decompose:function(t,e,n){var i,r,o,a=this.elements,s=uc.set(a[0],a[1],a[2]).length(),c=uc.set(a[4],a[5],a[6]).length(),l=uc.set(a[8],a[9],a[10]).length();return this.determinant()<0&&(s=-s),t.x=a[12],t.y=a[13],t.z=a[14],hc.copy(this),i=1/s,r=1/c,o=1/l,hc.elements[0]*=i,hc.elements[1]*=i,hc.elements[2]*=i,hc.elements[4]*=r,hc.elements[5]*=r,hc.elements[6]*=r,hc.elements[8]*=o,hc.elements[9]*=o,hc.elements[10]*=o,e.setFromRotationMatrix(hc),n.x=s,n.y=c,n.z=l,this},makePerspective:function(t,e,n,i,r,o){var a,s,c,l,u,h,p;return s=2*r/(e-t),c=2*r/(n-i),l=(e+t)/(e-t),u=(n+i)/(n-i),h=-(o+r)/(o-r),p=-2*o*r/(o-r),(a=this.elements)[0]=s,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,n,i,r,o){var a=this.elements,s=1/(e-t),c=1/(n-i),l=1/(o-r),u=(e+t)*s,h=(n+i)*c,p=(o+r)*l;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e,n=this.elements,i=t.elements;for(e=0;e<16;e++)if(n[e]!==i[e])return 0;return 1},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}),vc=new l,yc=new n,u.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],u.DefaultOrder="XYZ",Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}}),Object.assign(u.prototype,{isEuler:1,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var i=ic.clamp,r=t.elements,o=r[0],a=r[4],s=r[8],c=r[1],l=r[5],u=r[9],h=r[2],p=r[6],d=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,l))):"YZX"===e?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e&&(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-u,d),this._y=0)),this._order=e,0!=n&&this._onChangeCallback(),this},setFromQuaternion:function(t,e,n){return vc.makeRotationFromQuaternion(t),this.setFromRotationMatrix(vc,e,n)},setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(t){return yc.setFromEuler(this),this.setFromQuaternion(yc,t)},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new i(this._x,this._y,this._z)},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),Object.assign(h.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},enableAll:function(){this.mask=-1},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},disableAll:function(){this.mask=0},test:function(t){return 0!=(this.mask&t.mask)}}),xc=0,bc=new i,_c=new n,wc=new l,Mc=new i,Sc=new i,Tc=new i,Ac=new n,Lc=new i(1,0,0),Cc=new i(0,1,0),Pc=new i(0,0,1),Ec={type:"added"},Nc={type:"removed"},p.DefaultUp=new i(0,1,0),p.DefaultMatrixAutoUpdate=1,p.prototype=Object.assign(Object.create(t.prototype),{constructor:p,isObject3D:1,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,1)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return _c.setFromAxisAngle(t,e),this.quaternion.multiply(_c),this},rotateOnWorldAxis:function(t,e){return _c.setFromAxisAngle(t,e),this.quaternion.premultiply(_c),this},rotateX:function(t){return this.rotateOnAxis(Lc,t)},rotateY:function(t){return this.rotateOnAxis(Cc,t)},rotateZ:function(t){return this.rotateOnAxis(Pc,t)},translateOnAxis:function(t,e){return bc.copy(t).applyQuaternion(this.quaternion),this.position.add(bc.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(Lc,t)},translateY:function(t){return this.translateOnAxis(Cc,t)},translateZ:function(t){return this.translateOnAxis(Pc,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(wc.getInverse(this.matrixWorld))},lookAt:function(t,e,n){t.isVector3?Mc.copy(t):Mc.set(t,e,n);var i=this.parent;this.updateWorldMatrix(1,0),Sc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wc.lookAt(Sc,Mc,this.up):wc.lookAt(Mc,Sc,this.up),this.quaternion.setFromRotationMatrix(wc),i&&(wc.extractRotation(i.matrixWorld),_c.setFromRotationMatrix(wc),this.quaternion.premultiply(_c.inverse()))},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?this:(t&&t.isObject3D&&(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Ec)),this)},remove:function(t){var e,n;if(arguments.length>1){for(e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}return-1!==(n=this.children.indexOf(t))&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(Nc)),this},attach:function(t){return this.updateWorldMatrix(1,0),wc.getInverse(this.matrixWorld),null!==t.parent&&(t.parent.updateWorldMatrix(1,0),wc.multiply(t.parent.matrixWorld)),t.applyMatrix(wc),t.updateWorldMatrix(0,0),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){var n,i,r;if(this[t]===e)return this;for(n=0,i=this.children.length;n<i;n++)if(void 0!==(r=this.children[n].getObjectByProperty(t,e)))return r},getWorldPosition:function(t){return void 0===t&&(t=new i),this.updateMatrixWorld(1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(t=new n),this.updateMatrixWorld(1),this.matrixWorld.decompose(Sc,t,Tc),t},getWorldScale:function(t){return void 0===t&&(t=new i),this.updateMatrixWorld(1),this.matrixWorld.decompose(Sc,Ac,t),t},getWorldDirection:function(t){void 0===t&&(t=new i),this.updateMatrixWorld(1);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){var e,n,i;for(t(this),n=0,i=(e=this.children).length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){var e,n,i;if(0!=this.visible)for(t(this),n=0,i=(e=this.children).length;n<i;n++)e[n].traverseVisible(t)},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=1},updateMatrixWorld:function(t){var e,n,i;for(this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=0,t=1),n=0,i=(e=this.children).length;n<i;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){var n,i,r,o=this.parent;if(1==t&&null!==o&&o.updateWorldMatrix(1,0),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),1==e)for(i=0,r=(n=this.children).length;i<r;i++)n[i].updateWorldMatrix(0,1)},toJSON:function(t){function e(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}function n(t){var e,n,i=[];for(e in t)delete(n=t[e]).metadata,i.push(n);return i}var i,r,o,a,s,c,l,u,h,p,d,f=void 0===t||"string"==typeof t,m={};if(f&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{}},m.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"}),(i={}).uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),1==this.castShadow&&(i.castShadow=1),1==this.receiveShadow&&(i.receiveShadow=1),0==this.visible&&(i.visible=0),0==this.frustumCulled&&(i.frustumCulled=0),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),0==this.matrixAutoUpdate&&(i.matrixAutoUpdate=0),this.isMesh&&this.drawMode!==ks&&(i.drawMode=this.drawMode),(this.isMesh||this.isLine||this.isPoints)&&(i.geometry=e(t.geometries,this.geometry),void 0!==(r=this.geometry.parameters)&&void 0!==r.shapes))if(o=r.shapes,Array.isArray(o))for(a=0,s=o.length;a<s;a++)c=o[a],e(t.shapes,c);else e(t.shapes,o);if(void 0!==this.material)if(Array.isArray(this.material)){for(l=[],a=0,s=this.material.length;a<s;a++)l.push(e(t.materials,this.material[a]));i.material=l}else i.material=e(t.materials,this.material);if(this.children.length>0)for(i.children=[],a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(t).object);return f&&(u=n(t.geometries),h=n(t.materials),p=n(t.textures),d=n(t.images),o=n(t.shapes),u.length>0&&(m.geometries=u),h.length>0&&(m.materials=h),p.length>0&&(m.textures=p),d.length>0&&(m.images=d),o.length>0&&(m.shapes=o)),m.object=i,m},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){var n,i;if(void 0===e&&(e=1),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),1==e)for(n=0;n<t.children.length;n++)i=t.children[n],this.add(i.clone());return this}}),d.prototype=Object.assign(Object.create(p.prototype),{constructor:d,isScene:1,copy:function(t,e){return p.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=p.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Oc=[new i,new i,new i,new i,new i,new i,new i,new i],Dc=new i,Ic=new i,zc=new i,Rc=new i,Fc=new i,kc=new i,Bc=new i,Uc=new i,jc=new i,Vc=new i,Gc=new i,Object.assign(f.prototype,{isBox3:1,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){var e,n,i,r,o,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,h=-1/0;for(e=0,n=t.length;e<n;e+=3)(i=t[e])<a&&(a=i),(r=t[e+1])<s&&(s=r),(o=t[e+2])<c&&(c=o),i>l&&(l=i),r>u&&(u=r),o>h&&(h=o);return this.min.set(a,s,c),this.max.set(l,u,h),this},setFromBufferAttribute:function(t){var e,n,i,r,o,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,h=-1/0;for(e=0,n=t.count;e<n;e++)(i=t.getX(e))<a&&(a=i),(r=t.getY(e))<s&&(s=r),(o=t.getZ(e))<c&&(c=o),i>l&&(l=i),r>u&&(u=r),o>h&&(h=o);return this.min.set(a,s,c),this.max.set(l,u,h),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var n=Dc.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(t=new i),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(t=new i),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(t){var e,n,i,r,o,a;if(t.updateWorldMatrix(0,0),void 0!==(i=t.geometry))if(i.isGeometry)for(e=0,n=(r=i.vertices).length;e<n;e++)Dc.copy(r[e]),Dc.applyMatrix4(t.matrixWorld),this.expandByPoint(Dc);else if(i.isBufferGeometry&&void 0!==(o=i.attributes.position))for(e=0,n=o.count;e<n;e++)Dc.fromBufferAttribute(o,e).applyMatrix4(t.matrixWorld),this.expandByPoint(Dc);for(e=0,n=(a=t.children).length;e<n;e++)this.expandByObject(a[e]);return this},containsPoint:function(t){return t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z?0:1},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(e=new i),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z?0:1},intersectsSphere:function(t){return this.clampPoint(t.center,Dc),Dc.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return 0;this.getCenter(Uc),jc.subVectors(this.max,Uc),Ic.subVectors(t.a,Uc),zc.subVectors(t.b,Uc),Rc.subVectors(t.c,Uc),Fc.subVectors(zc,Ic),kc.subVectors(Rc,zc),Bc.subVectors(Ic,Rc);var e=[0,-Fc.z,Fc.y,0,-kc.z,kc.y,0,-Bc.z,Bc.y,Fc.z,0,-Fc.x,kc.z,0,-kc.x,Bc.z,0,-Bc.x,-Fc.y,Fc.x,0,-kc.y,kc.x,0,-Bc.y,Bc.x,0];return m(e,Ic,zc,Rc,jc)&&m(e=[1,0,0,0,1,0,0,0,1],Ic,zc,Rc,jc)?(Vc.crossVectors(Fc,kc),m(e=[Vc.x,Vc.y,Vc.z],Ic,zc,Rc,jc)):0},clampPoint:function(t,e){return void 0===e&&(e=new i),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return Dc.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Dc).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()?this:(Oc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Oc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Oc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Oc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Oc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Oc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Oc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Oc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Oc),this)},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Wc=new f,Object.assign(g.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(t,e){var n,i,r,o=this.center;for(void 0!==e?o.copy(e):Wc.setFromPoints(t).getCenter(o),n=0,i=0,r=t.length;i<r;i++)n=Math.max(n,o.distanceToSquared(t[i]));return this.radius=Math.sqrt(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t);return void 0===e&&(e=new i),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(t=new f),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Hc=new i,qc=new i,Xc=new i,Yc=new i,Zc=new i,Jc=new i,$c=new i,Object.assign(v.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(e=new i),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,Hc)),this},closestPointToPoint:function(t,e){void 0===e&&(e=new i),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var e=Hc.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Hc.copy(this.direction).multiplyScalar(e).add(this.origin),Hc.distanceToSquared(t))},distanceSqToSegment:function(t,e,n,i){var r,o,a,s,c,l,u,h,p,d,f;return qc.copy(t).add(e).multiplyScalar(.5),Xc.copy(e).sub(t).normalize(),Yc.copy(this.origin).sub(qc),r=.5*t.distanceTo(e),o=-this.direction.dot(Xc),a=Yc.dot(this.direction),s=-Yc.dot(Xc),c=Yc.lengthSq(),(l=Math.abs(1-o*o))>0?(h=o*a-s,d=r*l,(u=o*s-a)>=0?p=h>=-d?h<=d?(u*=f=1/l)*(u+o*(h*=f)+2*a)+h*(o*u+h+2*s)+c:-(u=Math.max(0,-(o*(h=r)+a)))*u+h*(h+2*s)+c:-(u=Math.max(0,-(o*(h=-r)+a)))*u+h*(h+2*s)+c:h<=-d?p=-(u=Math.max(0,-(-o*r+a)))*u+(h=u>0?-r:Math.min(Math.max(-r,-s),r))*(h+2*s)+c:h<=d?(u=0,p=(h=Math.min(Math.max(-r,-s),r))*(h+2*s)+c):p=-(u=Math.max(0,-(o*r+a)))*u+(h=u>0?r:Math.min(Math.max(-r,-s),r))*(h+2*s)+c):p=-(u=Math.max(0,-(o*(h=o>0?-r:r)+a)))*u+h*(h+2*s)+c,n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(Xc).multiplyScalar(h).add(qc),p},intersectSphere:function(t,e){var n,i,r,o,a,s;return Hc.subVectors(t.center,this.origin),n=Hc.dot(this.direction),(i=Hc.dot(Hc)-n*n)>(r=t.radius*t.radius)?null:(s=n+(o=Math.sqrt(r-i)),(a=n-o)<0&&s<0?null:a<0?this.at(s,e):this.at(a,e))},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e,n=t.normal.dot(this.direction);return 0===n?0===t.distanceToPoint(this.origin)?0:null:(e=-(this.origin.dot(t.normal)+t.constant)/n)>=0?e:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e?1:t.normal.dot(this.direction)*e<0?1:0},intersectBox:function(t,e){var n,i,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,i=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,i=(t.min.x-h.x)*c),l>=0?(r=(t.min.y-h.y)*l,o=(t.max.y-h.y)*l):(r=(t.max.y-h.y)*l,o=(t.min.y-h.y)*l),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o<i||i!=i)&&(i=o),u>=0?(a=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(a=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,e)))},intersectsBox:function(t){return null!==this.intersectBox(t,Hc)},intersectTriangle:function(t,e,n,i,r){var o,a,s,c,l;if(Zc.subVectors(e,t),Jc.subVectors(n,t),$c.crossVectors(Zc,Jc),(o=this.direction.dot($c))>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}return Yc.subVectors(this.origin,t),(s=a*this.direction.dot(Jc.crossVectors(Yc,Jc)))<0?null:(c=a*this.direction.dot(Zc.cross(Yc)))<0?null:s+c>o?null:(l=-a*Yc.dot($c))<0?null:this.at(l/o,r)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Qc=new i,Kc=new i,tl=new i,el=new i,nl=new i,il=new i,rl=new i,ol=new i,al=new i,sl=new i,Object.assign(y,{getNormal:function(t,e,n,r){void 0===r&&(r=new i),r.subVectors(n,e),Qc.subVectors(t,e),r.cross(Qc);var o=r.lengthSq();return o>0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)},getBarycoord:function(t,e,n,r,o){var a,s,c,l,u,h,p,d,f;return Qc.subVectors(r,e),Kc.subVectors(n,e),tl.subVectors(t,e),a=Qc.dot(Qc),s=Qc.dot(Kc),c=Qc.dot(tl),l=Kc.dot(Kc),u=Kc.dot(tl),h=a*l-s*s,void 0===o&&(o=new i),0===h?o.set(-2,-1,-1):(d=(l*c-s*u)*(p=1/h),f=(a*u-s*c)*p,o.set(1-d-f,f,d))},containsPoint:function(t,e,n,i){return y.getBarycoord(t,e,n,i,el),el.x>=0&&el.y>=0&&el.x+el.y<=1},getUV:function(t,e,n,i,r,o,a,s){return this.getBarycoord(t,e,n,i,el),s.set(0,0),s.addScaledVector(r,el.x),s.addScaledVector(o,el.y),s.addScaledVector(a,el.z),s},isFrontFacing:function(t,e,n,i){return Qc.subVectors(n,e),Kc.subVectors(t,e),Qc.cross(Kc).dot(i)<0?1:0}}),Object.assign(y.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){return Qc.subVectors(this.c,this.b),Kc.subVectors(this.a,this.b),.5*Qc.cross(Kc).length()},getMidpoint:function(t){return void 0===t&&(t=new i),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return y.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(t=new i),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return y.getBarycoord(t,this.a,this.b,this.c,e)},getUV:function(t,e,n,i,r){return y.getUV(t,this.a,this.b,this.c,e,n,i,r)},containsPoint:function(t){return y.containsPoint(t,this.a,this.b,this.c)},isFrontFacing:function(t){return y.isFrontFacing(this.a,this.b,this.c,t)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(t,e){var n,r,o,a,s,c,l,u,h,p,d,f,m,g,v;return void 0===e&&(e=new i),n=this.a,r=this.b,o=this.c,nl.subVectors(r,n),il.subVectors(o,n),ol.subVectors(t,n),c=nl.dot(ol),l=il.dot(ol),c<=0&&l<=0?e.copy(n):(al.subVectors(t,r),u=nl.dot(al),h=il.dot(al),u>=0&&h<=u?e.copy(r):(p=c*h-u*l)<=0&&c>=0&&u<=0?(a=c/(c-u),e.copy(n).addScaledVector(nl,a)):(sl.subVectors(t,o),d=nl.dot(sl),(f=il.dot(sl))>=0&&d<=f?e.copy(o):(m=d*l-c*f)<=0&&l>=0&&f<=0?(s=l/(l-f),e.copy(n).addScaledVector(il,s)):(g=u*f-d*h)<=0&&h-u>=0&&d-f>=0?(rl.subVectors(o,r),s=(h-u)/(h-u+(d-f)),e.copy(r).addScaledVector(rl,s)):(a=m*(v=1/(g+m+p)),s=p*v,e.copy(n).addScaledVector(nl,a).addScaledVector(il,s))))},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),cl={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},ll={h:0,s:0,l:0},ul={h:0,s:0,l:0},Object.assign(x.prototype,{isColor:1,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(t,e,n){var i,r;return t=ic.euclideanModulo(t,1),e=ic.clamp(e,0,1),n=ic.clamp(n,0,1),0===e?this.r=this.g=this.b=n:(r=2*n-(i=n<=.5?n*(1+e):n+e-n*e),this.r=b(r,i,t+1/3),this.g=b(r,i,t),this.b=b(r,i,t-1/3)),this},setStyle:function(t){var e,n,i,r,o,a,s,c,l;if(e=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t))switch(i=e[1],r=e[2],i){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,n[5],this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,n[5],this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return o=parseFloat(n[1])/360,a=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100,n[5],this.setHSL(o,a,s)}else if(e=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(3===(l=(c=e[1]).length))return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return t&&t.length>0&&void 0!==(c=cl[t])&&this.setHex(c),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=_(t.r),this.g=_(t.g),this.b=_(t.b),this},copyLinearToSRGB:function(t){return this.r=w(t.r),this.g=w(t.g),this.b=w(t.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,i,r,o,a,s,c,l;if(void 0===t&&(t={h:0,s:0,l:0}),e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),c=((o=Math.min(e,n,i))+r)/2,o===r)a=0,s=0;else{switch(l=r-o,s=c<=.5?l/(r+o):l/(2-r-o),r){case e:a=(n-i)/l+(n<i?6:0);break;case n:a=(i-e)/l+2;break;case i:a=(e-n)/l+4}a/=6}return t.h=a,t.s=s,t.l=c,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){return this.getHSL(ll),ll.h+=t,ll.s+=e,ll.l+=n,this.setHSL(ll.h,ll.s,ll.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},lerpHSL:function(t,e){var n,i,r;return this.getHSL(ll),t.getHSL(ul),n=ic.lerp(ll.h,ul.h,e),i=ic.lerp(ll.s,ul.s,e),r=ic.lerp(ll.l,ul.l,e),this.setHSL(n,i,r),this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}}),Object.assign(M.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){var e,n;for(this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex,e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}),hl=0,S.prototype=Object.assign(Object.create(t.prototype),{constructor:S,isMaterial:1,onBeforeCompile:function(){},setValues:function(t){var e,n,i;if(void 0!==t)for(e in t)void 0!==(n=t[e])&&("shading"!==e?void 0!==(i=this[e])&&(i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n):this.flatShading=1===n?1:0)},toJSON:function(t){function e(t){var e,n,i=[];for(e in t)delete(n=t[e]).metadata,i.push(n);return i}var n,i,r,o=void 0===t||"string"==typeof t;return o&&(t={textures:{},images:{}}),(n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}}).uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Xo&&(n.blending=this.blending),1==this.flatShading&&(n.flatShading=this.flatShading),this.side!==Uo&&(n.side=this.side),this.vertexColors!==Go&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),1==this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),1==this.polygonOffset&&(n.polygonOffset=1),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),1==this.dithering&&(n.dithering=1),this.alphaTest>0&&(n.alphaTest=this.alphaTest),1==this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),1==this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),1==this.morphTargets&&(n.morphTargets=1),1==this.morphNormals&&(n.morphNormals=1),1==this.skinning&&(n.skinning=1),0==this.visible&&(n.visible=0),0==this.toneMapped&&(n.toneMapped=0),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),o&&(i=e(t.textures),r=e(t.images),i.length>0&&(n.textures=i),r.length>0&&(n.images=r)),n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){var e,n,i,r;if(this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWrite=t.stencilWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection,n=null,null!==(e=t.clippingPlanes))for(i=e.length,n=Array(i),r=0;r!==i;++r)n[r]=e[r].clone();return this.clippingPlanes=n,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),T.prototype=Object.create(S.prototype),T.prototype.constructor=T,T.prototype.isMeshBasicMaterial=1,T.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.defineProperty(A.prototype,"needsUpdate",{set:function(t){1==t&&this.version++}}),Object.assign(A.prototype,{isBufferAttribute:1,onUploadCallback:function(){},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){var e,n,i,r=this.array,o=0;for(e=0,n=t.length;e<n;e++)void 0===(i=t[e])&&(i=new x),r[o++]=i.r,r[o++]=i.g,r[o++]=i.b;return this},copyVector2sArray:function(t){var n,i,r,o=this.array,a=0;for(n=0,i=t.length;n<i;n++)void 0===(r=t[n])&&(r=new e),o[a++]=r.x,o[a++]=r.y;return this},copyVector3sArray:function(t){var e,n,r,o=this.array,a=0;for(e=0,n=t.length;e<n;e++)void 0===(r=t[e])&&(r=new i),o[a++]=r.x,o[a++]=r.y,o[a++]=r.z;return this},copyVector4sArray:function(t){var e,n,i,r=this.array,o=0;for(e=0,n=t.length;e<n;e++)void 0===(i=t[e])&&(i=new a),r[o++]=i.x,r[o++]=i.y,r[o++]=i.z,r[o++]=i.w;return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),L.prototype=Object.create(A.prototype),L.prototype.constructor=L,C.prototype=Object.create(A.prototype),C.prototype.constructor=C,P.prototype=Object.create(A.prototype),P.prototype.constructor=P,E.prototype=Object.create(A.prototype),E.prototype.constructor=E,N.prototype=Object.create(A.prototype),N.prototype.constructor=N,O.prototype=Object.create(A.prototype),O.prototype.constructor=O,D.prototype=Object.create(A.prototype),D.prototype.constructor=D,I.prototype=Object.create(A.prototype),I.prototype.constructor=I,z.prototype=Object.create(A.prototype),z.prototype.constructor=z,Object.assign(R.prototype,{computeGroups:function(t){var e,n,i,r=[],o=void 0,a=t.faces;for(n=0;n<a.length;n++)(i=a[n]).materialIndex!==o&&(o=i.materialIndex,void 0!==e&&(e.count=3*n-e.start,r.push(e)),e={start:3*n,materialIndex:o});void 0!==e&&(e.count=3*n-e.start,r.push(e)),this.groups=r},fromGeometry:function(t){var n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b=t.faces,_=t.vertices,w=t.faceVertexUvs,M=w[0]&&w[0].length>0,S=w[1]&&w[1].length>0,T=t.morphTargets,A=T.length;if(A>0){for(n=[],i=0;i<A;i++)n[i]={name:T[i].name,data:[]};this.morphTargets.position=n}if((o=(r=t.morphNormals).length)>0){for(a=[],i=0;i<o;i++)a[i]={name:r[i].name,data:[]};this.morphTargets.normal=a}for(s=t.skinIndices,c=t.skinWeights,l=s.length===_.length,u=c.length===_.length,_.length>0&&b.length,i=0;i<b.length;i++){for(h=b[i],this.vertices.push(_[h.a],_[h.b],_[h.c]),3===(p=h.vertexNormals).length?this.normals.push(p[0],p[1],p[2]):(d=h.normal,this.normals.push(d,d,d)),3===(f=h.vertexColors).length?this.colors.push(f[0],f[1],f[2]):(m=h.color,this.colors.push(m,m,m)),1==M&&(void 0!==(g=w[0][i])?this.uvs.push(g[0],g[1],g[2]):this.uvs.push(new e,new e,new e)),1==S&&(void 0!==(g=w[1][i])?this.uvs2.push(g[0],g[1],g[2]):this.uvs2.push(new e,new e,new e)),v=0;v<A;v++)y=T[v].vertices,n[v].data.push(y[h.a],y[h.b],y[h.c]);for(v=0;v<o;v++)x=r[v].vertexNormals[i],a[v].data.push(x.a,x.b,x.c);l&&this.skinIndices.push(s[h.a],s[h.b],s[h.c]),u&&this.skinWeights.push(c[h.a],c[h.b],c[h.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}}),pl=1,dl=new l,fl=new p,ml=new i,gl=new f,vl=new f,yl=new i,k.prototype=Object.assign(Object.create(t.prototype),{constructor:k,isBufferGeometry:1,getIndex:function(){return this.index},setIndex:function(t){this.index=Array.isArray(t)?new(F(t)>65535?D:N)(t,1):t},addAttribute:function(t,e,n){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(this.setIndex(e),this):this.setAttribute(t,e):this.addAttribute(t,new A(e,n))},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e,n,i=this.attributes.position;return void 0!==i&&(t.applyToBufferAttribute(i),i.needsUpdate=1),void 0!==(e=this.attributes.normal)&&((new r).getNormalMatrix(t).applyToBufferAttribute(e),e.needsUpdate=1),void 0!==(n=this.attributes.tangent)&&((new r).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=1),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return dl.makeRotationX(t),this.applyMatrix(dl),this},rotateY:function(t){return dl.makeRotationY(t),this.applyMatrix(dl),this},rotateZ:function(t){return dl.makeRotationZ(t),this.applyMatrix(dl),this},translate:function(t,e,n){return dl.makeTranslation(t,e,n),this.applyMatrix(dl),this},scale:function(t,e,n){return dl.makeScale(t,e,n),this.applyMatrix(dl),this},lookAt:function(t){return fl.lookAt(t),fl.updateMatrix(),this.applyMatrix(fl.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ml).negate(),this.translate(ml.x,ml.y,ml.z),this},setFromObject:function(t){var e,n,i,r=t.geometry;return t.isPoints||t.isLine?(e=new I(3*r.vertices.length,3),n=new I(3*r.colors.length,3),this.addAttribute("position",e.copyVector3sArray(r.vertices)),this.addAttribute("color",n.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length&&(i=new I(r.lineDistances.length,1),this.addAttribute("lineDistance",i.copyArray(r.lineDistances))),null!==r.boundingSphere&&(this.boundingSphere=r.boundingSphere.clone()),null!==r.boundingBox&&(this.boundingBox=r.boundingBox.clone())):t.isMesh&&r&&r.isGeometry&&this.fromGeometry(r),this},setFromPoints:function(t){var e,n,i,r=[];for(e=0,n=t.length;e<n;e++)i=t[e],r.push(i.x,i.y,i.z||0);return this.addAttribute("position",new I(r,3)),this},updateFromObject:function(t){var e,n,i=t.geometry;if(t.isMesh){if(e=i.__directGeometry,1==i.elementsNeedUpdate&&(e=void 0,i.elementsNeedUpdate=0),void 0===e)return this.fromGeometry(i);e.verticesNeedUpdate=i.verticesNeedUpdate,e.normalsNeedUpdate=i.normalsNeedUpdate,e.colorsNeedUpdate=i.colorsNeedUpdate,e.uvsNeedUpdate=i.uvsNeedUpdate,e.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=0,i.normalsNeedUpdate=0,i.colorsNeedUpdate=0,i.uvsNeedUpdate=0,i.groupsNeedUpdate=0,i=e}return 1==i.verticesNeedUpdate&&(void 0!==(n=this.attributes.position)&&(n.copyVector3sArray(i.vertices),n.needsUpdate=1),i.verticesNeedUpdate=0),1==i.normalsNeedUpdate&&(void 0!==(n=this.attributes.normal)&&(n.copyVector3sArray(i.normals),n.needsUpdate=1),i.normalsNeedUpdate=0),1==i.colorsNeedUpdate&&(void 0!==(n=this.attributes.color)&&(n.copyColorsArray(i.colors),n.needsUpdate=1),i.colorsNeedUpdate=0),i.uvsNeedUpdate&&(void 0!==(n=this.attributes.uv)&&(n.copyVector2sArray(i.uvs),n.needsUpdate=1),i.uvsNeedUpdate=0),i.lineDistancesNeedUpdate&&(void 0!==(n=this.attributes.lineDistance)&&(n.copyArray(i.lineDistances),n.needsUpdate=1),i.lineDistancesNeedUpdate=0),i.groupsNeedUpdate&&(i.computeGroups(t.geometry),this.groups=i.groups,i.groupsNeedUpdate=0),this},fromGeometry:function(t){return t.__directGeometry=(new R).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e,n,i,r,o,a,s,c,l,u,h,p,d,f=new Float32Array(3*t.vertices.length);for(o in this.addAttribute("position",new A(f,3).copyVector3sArray(t.vertices)),t.normals.length>0&&(e=new Float32Array(3*t.normals.length),this.addAttribute("normal",new A(e,3).copyVector3sArray(t.normals))),t.colors.length>0&&(n=new Float32Array(3*t.colors.length),this.addAttribute("color",new A(n,3).copyColorsArray(t.colors))),t.uvs.length>0&&(i=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new A(i,2).copyVector2sArray(t.uvs))),t.uvs2.length>0&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new A(r,2).copyVector2sArray(t.uvs2))),this.groups=t.groups,t.morphTargets){for(a=[],c=0,l=(s=t.morphTargets[o]).length;c<l;c++)(h=new I(3*(u=s[c]).data.length,3)).name=u.name,a.push(h.copyVector3sArray(u.data));this.morphAttributes[o]=a}return t.skinIndices.length>0&&(p=new I(4*t.skinIndices.length,4),this.addAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))),t.skinWeights.length>0&&(d=new I(4*t.skinWeights.length,4),this.addAttribute("skinWeight",d.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){var t,e,n,i,r;if(null===this.boundingBox&&(this.boundingBox=new f),t=this.attributes.position,e=this.morphAttributes.position,void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(n=0,i=e.length;n<i;n++)r=e[n],gl.setFromBufferAttribute(r),this.boundingBox.expandByPoint(gl.min),this.boundingBox.expandByPoint(gl.max)}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||this.boundingBox.min.z},computeBoundingSphere:function(){var t,e,n,i,r,o,a,s,c;if(null===this.boundingSphere&&(this.boundingSphere=new g),t=this.attributes.position,e=this.morphAttributes.position,t){if(n=this.boundingSphere.center,gl.setFromBufferAttribute(t),e)for(i=0,r=e.length;i<r;i++)o=e[i],vl.setFromBufferAttribute(o),gl.expandByPoint(vl.min),gl.expandByPoint(vl.max);for(gl.getCenter(n),a=0,i=0,r=t.count;i<r;i++)yl.fromBufferAttribute(t,i),a=Math.max(a,n.distanceToSquared(yl));if(e)for(i=0,r=e.length;i<r;i++)for(s=0,c=(o=e[i]).count;s<c;s++)yl.fromBufferAttribute(o,s),a=Math.max(a,n.distanceToSquared(yl));this.boundingSphere.radius=Math.sqrt(a),this.boundingSphere.radius}},computeFaceNormals:function(){},computeVertexNormals:function(){var t,e,n,r,o,a,s,c,l,u,h,p,d,f,m=this.index,g=this.attributes;if(g.position){if(t=g.position.array,void 0===g.normal)this.addAttribute("normal",new A(new Float32Array(t.length),3));else for(n=0,r=(e=g.normal.array).length;n<r;n++)e[n]=0;if(o=g.normal.array,l=new i,u=new i,h=new i,p=new i,d=new i,m)for(f=m.array,n=0,r=m.count;n<r;n+=3)a=3*f[n+0],s=3*f[n+1],c=3*f[n+2],l.fromArray(t,a),u.fromArray(t,s),h.fromArray(t,c),p.subVectors(h,u),d.subVectors(l,u),p.cross(d),o[a]+=p.x,o[a+1]+=p.y,o[a+2]+=p.z,o[s]+=p.x,o[s+1]+=p.y,o[s+2]+=p.z,o[c]+=p.x,o[c+1]+=p.y,o[c+2]+=p.z;else for(n=0,r=t.length;n<r;n+=9)l.fromArray(t,n),u.fromArray(t,n+3),h.fromArray(t,n+6),p.subVectors(h,u),d.subVectors(l,u),p.cross(d),o[n]=p.x,o[n+1]=p.y,o[n+2]=p.z,o[n+3]=p.x,o[n+4]=p.y,o[n+5]=p.z,o[n+6]=p.x,o[n+7]=p.y,o[n+8]=p.z;this.normalizeNormals(),g.normal.needsUpdate=1}},merge:function(t,e){var n,i,r,o,a,s,c,l,u;if(t&&t.isBufferGeometry){for(i in void 0===e&&(e=0),n=this.attributes)if(void 0!==t.attributes[i])for(r=n[i].array,a=(o=t.attributes[i]).array,s=o.itemSize*e,c=Math.min(a.length,r.length-s),l=0,u=s;l<c;l++,u++)r[u]=a[l];return this}},normalizeNormals:function(){var t,e,n=this.attributes.normal;for(t=0,e=n.count;t<e;t++)yl.x=n.getX(t),yl.y=n.getY(t),yl.z=n.getZ(t),yl.normalize(),n.setXYZ(t,yl.x,yl.y,yl.z)},toNonIndexed:function(){function t(t,e){var n,i,r,o=t.array,a=t.itemSize,s=new o.constructor(e.length*a),c=0,l=0;for(n=0,i=e.length;n<i;n++)for(c=e[n]*a,r=0;r<a;r++)s[l++]=o[c++];return new A(s,a)}var e,n,i,r,o,a,s,c,l,u,h,p,d;if(null===this.index)return this;for(r in e=new k,n=this.index.array,i=this.attributes)o=t(i[r],n),e.addAttribute(r,o);for(r in a=this.morphAttributes){for(s=[],l=0,u=(c=a[r]).length;l<u;l++)o=t(c[l],n),s.push(o);e.morphAttributes[r]=s}for(l=0,p=(h=this.groups).length;l<p;l++)d=h[l],e.addGroup(d.start,d.count,d.materialIndex);return e},toJSON:function(){var t,e,n,i,r,o,a,s,c,l,u,h,p,d,f={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(f.uuid=this.uuid,f.type=this.type,""!==this.name&&(f.name=this.name),Object.keys(this.userData).length>0&&(f.userData=this.userData),void 0!==this.parameters){for(e in t=this.parameters)void 0!==t[e]&&(f[e]=t[e]);return f}for(e in f.data={attributes:{}},null!==(n=this.index)&&(f.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)}),i=this.attributes)o=(r=i[e]).toJSON(),""!==r.name&&(o.name=r.name),f.data.attributes[e]=o;for(e in a={},s=0,this.morphAttributes){for(l=[],u=0,h=(c=this.morphAttributes[e]).length;u<h;u++)o=(r=c[u]).toJSON(),""!==r.name&&(o.name=r.name),l.push(o);l.length>0&&(a[e]=l,s=1)}return s&&(f.data.morphAttributes=a),(p=this.groups).length>0&&(f.data.groups=JSON.parse(JSON.stringify(p))),null!==(d=this.boundingSphere)&&(f.data.boundingSphere={center:d.center.toArray(),radius:d.radius}),f},clone:function(){return(new k).copy(this)},copy:function(t){var e,n,i,r,o,a,s,c,l,u,h,p,d;for(e in this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name,null!==(r=t.index)&&this.setIndex(r.clone()),o=t.attributes)a=o[e],this.addAttribute(e,a.clone());for(e in s=t.morphAttributes){for(c=[],n=0,i=(l=s[e]).length;n<i;n++)c.push(l[n].clone());this.morphAttributes[e]=c}for(n=0,i=(u=t.groups).length;n<i;n++)h=u[n],this.addGroup(h.start,h.count,h.materialIndex);return null!==(p=t.boundingBox)&&(this.boundingBox=p.clone()),null!==(d=t.boundingSphere)&&(this.boundingSphere=d.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),xl=new l,bl=new v,_l=new g,wl=new i,Ml=new i,Sl=new i,Tl=new i,Al=new i,Ll=new i,Cl=new i,Pl=new i,El=new i,Nl=new e,Ol=new e,Dl=new e,Il=new i,zl=new i,B.prototype=Object.assign(Object.create(p.prototype),{constructor:B,isMesh:1,setDrawMode:function(t){this.drawMode=t},copy:function(t){return p.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,e,n,i,r,o,a,s=this.geometry;if(s.isBufferGeometry){if(i=s.morphAttributes,(r=Object.keys(i)).length>0&&void 0!==(o=i[r[0]]))for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)n=o[t].name||t+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}else void 0!==(a=s.morphTargets)&&a.length},raycast:function(t,n){var i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,x,b,_,w,M,S,T,A,L,C,P,E,N,O,D,I=this.geometry,z=this.material,R=this.matrixWorld;if(void 0!==z&&(null===I.boundingSphere&&I.computeBoundingSphere(),_l.copy(I.boundingSphere),_l.applyMatrix4(R),0!=t.ray.intersectsSphere(_l)&&(xl.getInverse(R),bl.copy(t.ray).applyMatrix4(xl),null===I.boundingBox||0!=bl.intersectsBox(I.boundingBox))))if(I.isBufferGeometry){if(s=I.index,c=I.attributes.position,l=I.morphAttributes.position,u=I.attributes.uv,h=I.attributes.uv2,p=I.groups,d=I.drawRange,null!==s)if(Array.isArray(z))for(f=0,g=p.length;f<g;f++)for(b=z[(x=p[f]).materialIndex],m=Math.max(x.start,d.start),v=Math.min(x.start+x.count,d.start+d.count);m<v;m+=3)r=s.getX(m),o=s.getX(m+1),a=s.getX(m+2),(i=j(this,b,t,bl,c,l,u,h,r,o,a))&&(i.faceIndex=Math.floor(m/3),i.face.materialIndex=x.materialIndex,n.push(i));else for(f=Math.max(0,d.start),g=Math.min(s.count,d.start+d.count);f<g;f+=3)r=s.getX(f),o=s.getX(f+1),a=s.getX(f+2),(i=j(this,z,t,bl,c,l,u,h,r,o,a))&&(i.faceIndex=Math.floor(f/3),n.push(i));else if(void 0!==c)if(Array.isArray(z))for(f=0,g=p.length;f<g;f++)for(b=z[(x=p[f]).materialIndex],m=Math.max(x.start,d.start),v=Math.min(x.start+x.count,d.start+d.count);m<v;m+=3)(i=j(this,b,t,bl,c,l,u,h,r=m,o=m+1,a=m+2))&&(i.faceIndex=Math.floor(m/3),i.face.materialIndex=x.materialIndex,n.push(i));else for(f=Math.max(0,d.start),g=Math.min(c.count,d.start+d.count);f<g;f+=3)(i=j(this,z,t,bl,c,l,u,h,r=f,o=f+1,a=f+2))&&(i.faceIndex=Math.floor(f/3),n.push(i))}else if(I.isGeometry)for(S=Array.isArray(z),T=I.vertices,A=I.faces,(C=I.faceVertexUvs[0]).length>0&&(L=C),P=0,E=A.length;P<E;P++)N=A[P],void 0!==(O=S?z[N.materialIndex]:z)&&(_=T[N.a],w=T[N.b],M=T[N.c],(i=U(this,O,t,bl,_,w,M,Il))&&(L&&L[P]&&(D=L[P],Nl.copy(D[0]),Ol.copy(D[1]),Dl.copy(D[2]),i.uv=y.getUV(Il,_,w,M,Nl,Ol,Dl,new e)),i.face=N,i.faceIndex=P,n.push(i)))},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Rl=0,Fl=new l,kl=new p,Bl=new i,V.prototype=Object.assign(Object.create(t.prototype),{constructor:V,isGeometry:1,applyMatrix:function(t){var e,n,i,o,a,s=(new r).getNormalMatrix(t);for(e=0,n=this.vertices.length;e<n;e++)this.vertices[e].applyMatrix4(t);for(e=0,n=this.faces.length;e<n;e++)for((i=this.faces[e]).normal.applyMatrix3(s).normalize(),o=0,a=i.vertexNormals.length;o<a;o++)i.vertexNormals[o].applyMatrix3(s).normalize();return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=1,this.normalsNeedUpdate=1,this},rotateX:function(t){return Fl.makeRotationX(t),this.applyMatrix(Fl),this},rotateY:function(t){return Fl.makeRotationY(t),this.applyMatrix(Fl),this},rotateZ:function(t){return Fl.makeRotationZ(t),this.applyMatrix(Fl),this},translate:function(t,e,n){return Fl.makeTranslation(t,e,n),this.applyMatrix(Fl),this},scale:function(t,e,n){return Fl.makeScale(t,e,n),this.applyMatrix(Fl),this},lookAt:function(t){return kl.lookAt(t),kl.updateMatrix(),this.applyMatrix(kl.matrix),this},fromBufferGeometry:function(t){function n(t,n,r,l){var u=void 0===a?[]:[m.colors[t].clone(),m.colors[n].clone(),m.colors[r].clone()],h=new M(t,n,r,void 0===o?[]:[(new i).fromArray(o,3*t),(new i).fromArray(o,3*n),(new i).fromArray(o,3*r)],u,l);m.faces.push(h),void 0!==s&&m.faceVertexUvs[0].push([(new e).fromArray(s,2*t),(new e).fromArray(s,2*n),(new e).fromArray(s,2*r)]),void 0!==c&&m.faceVertexUvs[1].push([(new e).fromArray(c,2*t),(new e).fromArray(c,2*n),(new e).fromArray(c,2*r)])}var r,o,a,s,c,l,u,h,p,d,f,m=this,g=null!==t.index?t.index.array:void 0,v=t.attributes;if(void 0===v.position)return this;for(r=v.position.array,o=void 0!==v.normal?v.normal.array:void 0,a=void 0!==v.color?v.color.array:void 0,s=void 0!==v.uv?v.uv.array:void 0,void 0!==(c=void 0!==v.uv2?v.uv2.array:void 0)&&(this.faceVertexUvs[1]=[]),l=0;l<r.length;l+=3)m.vertices.push((new i).fromArray(r,l)),void 0!==a&&m.colors.push((new x).fromArray(a,l));if((u=t.groups).length>0)for(l=0;l<u.length;l++)for(d=p=(h=u[l]).start,f=p+h.count;d<f;d+=3)void 0!==g?n(g[d],g[d+1],g[d+2],h.materialIndex):n(d,d+1,d+2,h.materialIndex);else if(void 0!==g)for(l=0;l<g.length;l+=3)n(g[l],g[l+1],g[l+2]);else for(l=0;l<r.length/3;l+=3)n(l,l+1,l+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Bl).negate(),this.translate(Bl.x,Bl.y,Bl.z),this},normalize:function(){var t,e,n,i;return this.computeBoundingSphere(),t=this.boundingSphere.center,n=0===(e=this.boundingSphere.radius)?1:1/e,(i=new l).set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){var t,e,n,r,o,a,s=new i,c=new i;for(t=0,e=this.faces.length;t<e;t++)n=this.faces[t],r=this.vertices[n.a],o=this.vertices[n.b],a=this.vertices[n.c],s.subVectors(a,o),c.subVectors(r,o),s.cross(c),s.normalize(),n.normal.copy(s)},computeVertexNormals:function(t){var e,n,r,o,a,s,c,l,u,h,p,d;for(void 0===t&&(t=1),s=Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)s[e]=new i;if(t)for(h=new i,p=new i,r=0,o=this.faces.length;r<o;r++)a=this.faces[r],c=this.vertices[a.a],l=this.vertices[a.b],u=this.vertices[a.c],h.subVectors(u,l),p.subVectors(c,l),h.cross(p),s[a.a].add(h),s[a.b].add(h),s[a.c].add(h);else for(this.computeFaceNormals(),r=0,o=this.faces.length;r<o;r++)s[(a=this.faces[r]).a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(e=0,n=this.vertices.length;e<n;e++)s[e].normalize();for(r=0,o=this.faces.length;r<o;r++)3===(d=(a=this.faces[r]).vertexNormals).length?(d[0].copy(s[a.a]),d[1].copy(s[a.b]),d[2].copy(s[a.c])):(d[0]=s[a.a].clone(),d[1]=s[a.b].clone(),d[2]=s[a.c].clone());this.faces.length>0&&(this.normalsNeedUpdate=1)},computeFlatVertexNormals:function(){var t,e,n,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++)3===(i=(n=this.faces[t]).vertexNormals).length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone());this.faces.length>0&&(this.normalsNeedUpdate=1)},computeMorphNormals:function(){var t,e,n,r,o,a,s,c,l,u,h;for(n=0,r=this.faces.length;n<r;n++)for((o=this.faces[n]).__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),t=0,e=o.vertexNormals.length;t<e;t++)o.__originalVertexNormals[t]?o.__originalVertexNormals[t].copy(o.vertexNormals[t]):o.__originalVertexNormals[t]=o.vertexNormals[t].clone();for((a=new V).faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t])for(this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[],s=this.morphNormals[t].faceNormals,c=this.morphNormals[t].vertexNormals,n=0,r=this.faces.length;n<r;n++)l=new i,u={a:new i,b:new i,c:new i},s.push(l),c.push(u);for(h=this.morphNormals[t],a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)o=this.faces[n],l=h.faceNormals[n],u=h.vertexNormals[n],l.copy(o.normal),u.a.copy(o.vertexNormals[0]),u.b.copy(o.vertexNormals[1]),u.c.copy(o.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(o=this.faces[n]).normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new f),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new g),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){var i,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,S,T,A,L,C;if(t&&t.isGeometry){for(o=this.vertices.length,a=this.vertices,s=t.vertices,c=this.faces,l=t.faces,u=this.colors,h=t.colors,void 0===n&&(n=0),void 0!==e&&(i=(new r).getNormalMatrix(e)),p=0,d=s.length;p<d;p++)f=s[p].clone(),void 0!==e&&f.applyMatrix4(e),a.push(f);for(p=0,d=h.length;p<d;p++)u.push(h[p].clone());for(p=0,d=l.length;p<d;p++){for(x=(m=l[p]).vertexNormals,b=m.vertexColors,(g=new M(m.a+o,m.b+o,m.c+o)).normal.copy(m.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize(),_=0,w=x.length;_<w;_++)v=x[_].clone(),void 0!==i&&v.applyMatrix3(i).normalize(),g.vertexNormals.push(v);for(g.color.copy(m.color),_=0,w=b.length;_<w;_++)y=b[_],g.vertexColors.push(y.clone());g.materialIndex=m.materialIndex+n,c.push(g)}for(p=0,d=t.faceVertexUvs.length;p<d;p++)for(S=t.faceVertexUvs[p],void 0===this.faceVertexUvs[p]&&(this.faceVertexUvs[p]=[]),_=0,w=S.length;_<w;_++){for(A=[],L=0,C=(T=S[_]).length;L<C;L++)A.push(T[L].clone());this.faceVertexUvs[p].push(A)}}},mergeMesh:function(t){t&&t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,n,i,r,o,a,s,c,l,u,h,p={},d=[],f=[];for(n=0,i=this.vertices.length;n<i;n++)t=this.vertices[n],void 0===p[e=Math.round(1e4*t.x)+"_"+Math.round(1e4*t.y)+"_"+Math.round(1e4*t.z)]?(p[e]=n,d.push(this.vertices[n]),f[n]=d.length-1):f[n]=f[p[e]];for(c=[],n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).a=f[r.a],r.b=f[r.b],r.c=f[r.c],o=[r.a,r.b,r.c],l=0;l<3;l++)if(o[l]===o[(l+1)%3]){c.push(n);break}for(n=c.length-1;n>=0;n--)for(u=c[n],this.faces.splice(u,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(u,1);return h=this.vertices.length-d.length,this.vertices=d,h},setFromPoints:function(t){var e,n,r;for(this.vertices=[],e=0,n=t.length;e<n;e++)r=t[e],this.vertices.push(new i(r.x,r.y,r.z||0));return this},sortFacesByMaterialIndex:function(){var t,e,n,i,r,o,a=this.faces,s=a.length;for(t=0;t<s;t++)a[t]._id=t;for(a.sort(function(t,e){return t.materialIndex-e.materialIndex}),e=this.faceVertexUvs[0],n=this.faceVertexUvs[1],e&&e.length===s&&(i=[]),n&&n.length===s&&(r=[]),t=0;t<s;t++)o=a[t]._id,i&&i.push(e[o]),r&&r.push(n[o]);i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){function t(t,e,n){return n?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==h[e]?h[e]:(h[e]=u.length/3,u.push(t.x,t.y,t.z),h[e])}function n(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==d[e]?d[e]:(d[e]=p.length,p.push(t.getHex()),d[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==m[e]?m[e]:(m[e]=f.length/2,f.push(t.x,t.y),m[e])}var r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(A.uuid=this.uuid,A.type=this.type,""!==this.name&&(A.name=this.name),void 0!==this.parameters){for(o in r=this.parameters)void 0!==r[o]&&(A[o]=r[o]);return A}for(a=[],s=0;s<this.vertices.length;s++)c=this.vertices[s],a.push(c.x,c.y,c.z);for(l=[],u=[],h={},p=[],d={},f=[],m={},s=0;s<this.faces.length;s++)g=this.faces[s],1,0,v=void 0!==this.faceVertexUvs[0][s],y=g.normal.length()>0,x=g.vertexNormals.length>0,b=1!==g.color.r||1!==g.color.g||1!==g.color.b,_=g.vertexColors.length>0,w=t(w=0,0,0),w=t(w,1,1),w=t(w,2,0),w=t(w,3,v),w=t(w,4,y),w=t(w,5,x),w=t(w,6,b),w=t(w,7,_),l.push(w),l.push(g.a,g.b,g.c),l.push(g.materialIndex),v&&(M=this.faceVertexUvs[0][s],l.push(i(M[0]),i(M[1]),i(M[2]))),y&&l.push(e(g.normal)),x&&(S=g.vertexNormals,l.push(e(S[0]),e(S[1]),e(S[2]))),b&&l.push(n(g.color)),_&&(T=g.vertexColors,l.push(n(T[0]),n(T[1]),n(T[2])));return A.data={},A.data.vertices=a,A.data.normals=u,p.length>0&&(A.data.colors=p),f.length>0&&(A.data.uvs=[f]),A.data.faces=l,A},clone:function(){return(new V).copy(this)},copy:function(t){var e,n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S;for(this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name,e=0,n=(s=t.vertices).length;e<n;e++)this.vertices.push(s[e].clone());for(e=0,n=(c=t.colors).length;e<n;e++)this.colors.push(c[e].clone());for(e=0,n=(l=t.faces).length;e<n;e++)this.faces.push(l[e].clone());for(e=0,n=t.faceVertexUvs.length;e<n;e++)for(u=t.faceVertexUvs[e],void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),i=0,r=u.length;i<r;i++){for(p=[],o=0,a=(h=u[i]).length;o<a;o++)d=h[o],p.push(d.clone());this.faceVertexUvs[e].push(p)}for(e=0,n=(f=t.morphTargets).length;e<n;e++){if((m={}).name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],i=0,r=f[e].vertices.length;i<r;i++)m.vertices.push(f[e].vertices[i].clone());if(void 0!==f[e].normals)for(m.normals=[],i=0,r=f[e].normals.length;i<r;i++)m.normals.push(f[e].normals[i].clone());this.morphTargets.push(m)}for(e=0,n=(g=t.morphNormals).length;e<n;e++){if(v={},void 0!==g[e].vertexNormals)for(v.vertexNormals=[],i=0,r=g[e].vertexNormals.length;i<r;i++)y=g[e].vertexNormals[i],(x={}).a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x);if(void 0!==g[e].faceNormals)for(v.faceNormals=[],i=0,r=g[e].faceNormals.length;i<r;i++)v.faceNormals.push(g[e].faceNormals[i].clone());this.morphNormals.push(v)}for(e=0,n=(b=t.skinWeights).length;e<n;e++)this.skinWeights.push(b[e].clone());for(e=0,n=(_=t.skinIndices).length;e<n;e++)this.skinIndices.push(_[e].clone());for(e=0,n=(w=t.lineDistances).length;e<n;e++)this.lineDistances.push(w[e]);return null!==(M=t.boundingBox)&&(this.boundingBox=M.clone()),null!==(S=t.boundingSphere)&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class up extends k{constructor(t,e,n,r,o,a){function s(t,e,n,r,o,a,s,m,g,v,y){var x,b,_,w,M,S,T,A,L=a/g,C=s/v,P=a/2,E=s/2,N=m/2,O=g+1,D=v+1,I=0,z=0,R=new i;for(b=0;b<D;b++)for(_=b*C-E,x=0;x<O;x++)w=x*L-P,R[t]=w*r,R[e]=_*o,R[n]=N,u.push(R.x,R.y,R.z),R[t]=0,R[e]=0,R[n]=m>0?1:-1,h.push(R.x,R.y,R.z),p.push(x/g),p.push(1-b/v),I+=1;for(b=0;b<v;b++)for(x=0;x<g;x++)M=d+x+O*b,S=d+x+O*(b+1),T=d+(x+1)+O*(b+1),A=d+(x+1)+O*b,l.push(M,S,A),l.push(S,T,A),z+=6;c.addGroup(f,z,y),f+=z,d+=I}var c,l,u,h,p,d,f;super(),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:o,depthSegments:a},c=this,t=t||1,e=e||1,n=n||1,r=Math.floor(r)||1,o=Math.floor(o)||1,l=[],u=[],h=[],p=[],d=0,f=0,s("z","y","x",-1,-1,n,e,t,a=Math.floor(a)||1,o,0),s("z","y","x",1,-1,n,e,-t,a,o,1),s("x","z","y",1,1,t,n,e,r,a,2),s("x","z","y",1,-1,t,n,-e,r,a,3),s("x","y","z",1,-1,t,e,n,r,o,4),s("x","y","z",-1,-1,t,e,-n,r,o,5),this.setIndex(l),this.addAttribute("position",new I(u,3)),this.addAttribute("normal",new I(h,3)),this.addAttribute("uv",new I(p,2))}}Ul="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",jl="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",H.prototype=Object.create(S.prototype),H.prototype.constructor=H,H.prototype.isShaderMaterial=1,H.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=G(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},H.prototype.toJSON=function(t){var e,n,i,r,o=S.prototype.toJSON.call(this,t);for(e in o.uniforms={},this.uniforms)(n=this.uniforms[e].value)&&n.isTexture?o.uniforms[e]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?o.uniforms[e]={type:"c",value:n.getHex()}:n&&n.isVector2?o.uniforms[e]={type:"v2",value:n.toArray()}:n&&n.isVector3?o.uniforms[e]={type:"v3",value:n.toArray()}:n&&n.isVector4?o.uniforms[e]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?o.uniforms[e]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?o.uniforms[e]={type:"m4",value:n.toArray()}:o.uniforms[e]={value:n};for(r in Object.keys(this.defines).length>0&&(o.defines=this.defines),o.vertexShader=this.vertexShader,o.fragmentShader=this.fragmentShader,i={},this.extensions)1==this.extensions[r]&&(i[r]=1);return Object.keys(i).length>0&&(o.extensions=i),o},q.prototype=Object.assign(Object.create(p.prototype),{constructor:q,isCamera:1,copy:function(t,e){return p.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(t=new i),this.updateMatrixWorld(1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){p.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),X.prototype=Object.assign(Object.create(q.prototype),{constructor:X,isPerspectiveCamera:1,copy:function(t,e){return q.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*ic.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*ic.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*ic.RAD2DEG*Math.atan(Math.tan(.5*ic.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(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=1,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=0),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t,e,n,i=this.near,r=i*Math.tan(.5*ic.DEG2RAD*this.fov)/this.zoom,o=2*r,a=this.aspect*o,s=-.5*a,c=this.view;null!==this.view&&this.view.enabled&&(t=c.fullWidth,e=c.fullHeight,s+=c.offsetX*a/t,r-=c.offsetY*o/e,a*=c.width/t,o*=c.height/e),0!==(n=this.filmOffset)&&(s+=i*n/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+a,r,r-o,i,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=p.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Vl=90,Gl=1,Y.prototype=Object.create(p.prototype),Y.prototype.constructor=Y,Z.prototype=Object.create(s.prototype),Z.prototype.constructor=Z,Z.prototype.isWebGLRenderTargetCube=1,Z.prototype.fromEquirectangularTexture=function(t,e){var n,i,r,o,a;return this.texture.type=e.type,this.texture.format=e.format,this.texture.encoding=e.encoding,n=new d,(r=new H({type:"CubemapFromEquirect",uniforms:G((i={uniforms:{tEquirect:{value:null}},vertexShader:"varying vec3 vWorldDirection;\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\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}"}).uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:jo,blending:qo})).uniforms.tEquirect.value=e,o=new B(new up(5,5,5),r),n.add(o),(a=new Y(1,10,1)).renderTarget=this,a.renderTarget.texture.name="CubeCameraTexture",a.update(t,n),o.geometry.dispose(),o.material.dispose(),this},J.prototype=Object.create(o.prototype),J.prototype.constructor=J,J.prototype.isDataTexture=1,Wl=new i,Hl=new i,ql=new r,Object.assign($.prototype,{isPlane:1,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(t,e,n){var i=Wl.subVectors(n,e).cross(Hl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(e=new i),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(t,e){var n,r,o;return void 0===e&&(e=new i),n=t.delta(Wl),0===(r=this.normal.dot(n))?0===this.distanceToPoint(t.start)?e.copy(t.start):void 0:(o=-(t.start.dot(this.normal)+this.constant)/r)<0||o>1?void 0:e.copy(n).multiplyScalar(o).add(t.start)},intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(t=new i),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(t,e){var n=e||ql.getNormalMatrix(t),i=this.coplanarPoint(Wl).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Xl=new g,Yl=new i,Object.assign(Q.prototype,{set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){var e,n=this.planes;for(e=0;e<6;e++)n[e].copy(t.planes[e]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-i,u-s,f-h,y-m).normalize(),e[1].setComponents(a+i,u+s,f+h,y+m).normalize(),e[2].setComponents(a+r,u+c,f+p,y+g).normalize(),e[3].setComponents(a-r,u-c,f-p,y-g).normalize(),e[4].setComponents(a-o,u-l,f-d,y-v).normalize(),e[5].setComponents(a+o,u+l,f+d,y+v).normalize(),this},intersectsObject:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Xl.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Xl)},intersectsSprite:function(t){return Xl.center.set(0,0,0),Xl.radius=.7071067811865476,Xl.applyMatrix4(t.matrixWorld),this.intersectsSphere(Xl)},intersectsSphere:function(t){var e,n=this.planes,i=t.center,r=-t.radius;for(e=0;e<6;e++)if(n[e].distanceToPoint(i)<r)return 0;return 1},intersectsBox:function(t){var e,n,i=this.planes;for(e=0;e<6;e++)if(n=i[e],Yl.x=n.normal.x>0?t.max.x:t.min.x,Yl.y=n.normal.y>0?t.max.y:t.min.y,Yl.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Yl)<0)return 0;return 1},containsPoint:function(t){var e,n=this.planes;for(e=0;e<6;e++)if(n[e].distanceToPoint(t)<0)return 0;return 1}}),Zl={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\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",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",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",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = 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 = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\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",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\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",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef 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",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\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\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\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",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\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)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#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#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? 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#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? 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#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? 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 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\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",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( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 1.0 ? log2( vFragDepth ) * logDepthBufFC * 0.5 : gl_FragCoord.z;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#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",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",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",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, normalScale, normalMap );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 normalScale, in sampler2D normalMap ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy *= normalScale;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tbool frontFacing = dot( cross( S, T ), N ) > 0.0;\n\t\t\tmapN.xy *= ( float( frontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, clearcoatNormal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = clearcoatNormalScale * mapN.xy;\n\t\tclearcoatNormal = normalize( vTBN * mapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 encodeHalfRGBA ( vec2 v ) {\n\tvec4 encoded = vec4( 0.0 );\n\tconst vec2 offset = vec2( 1.0 / 255.0, 0.0 );\n\tencoded.xy = vec2( v.x, fract( v.x * 255.0 ) );\n\tencoded.xy = encoded.xy - ( encoded.yy * offset );\n\tencoded.zw = vec2( v.y, fract( v.y * 255.0 ) );\n\tencoded.zw = encoded.zw - ( encoded.ww * offset );\n\treturn encoded;\n}\nvec2 decodeHalfRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn decodeHalfRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat 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 ) + 0.5 ) * texelSize;\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat 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#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? 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}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#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 = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\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}",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}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\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\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <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}",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_common_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}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <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#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <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\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <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}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <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}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_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 <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <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}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Jl={common:{diffuse:{value:new x(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:.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 e(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new x(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{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 x(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new r}},sprite:{diffuse:{value:new x(15658734)},opacity:{value:1},center:{value:new e(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new r}}},($l={basic:{uniforms:W([Jl.common,Jl.specularmap,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.fog]),vertexShader:Zl.meshbasic_vert,fragmentShader:Zl.meshbasic_frag},lambert:{uniforms:W([Jl.common,Jl.specularmap,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.emissivemap,Jl.fog,Jl.lights,{emissive:{value:new x(0)}}]),vertexShader:Zl.meshlambert_vert,fragmentShader:Zl.meshlambert_frag},phong:{uniforms:W([Jl.common,Jl.specularmap,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.emissivemap,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,Jl.gradientmap,Jl.fog,Jl.lights,{emissive:{value:new x(0)},specular:{value:new x(1118481)},shininess:{value:30}}]),vertexShader:Zl.meshphong_vert,fragmentShader:Zl.meshphong_frag},standard:{uniforms:W([Jl.common,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.emissivemap,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,Jl.roughnessmap,Jl.metalnessmap,Jl.fog,Jl.lights,{emissive:{value:new x(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Zl.meshphysical_vert,fragmentShader:Zl.meshphysical_frag},matcap:{uniforms:W([Jl.common,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,Jl.fog,{matcap:{value:null}}]),vertexShader:Zl.meshmatcap_vert,fragmentShader:Zl.meshmatcap_frag},points:{uniforms:W([Jl.points,Jl.fog]),vertexShader:Zl.points_vert,fragmentShader:Zl.points_frag},dashed:{uniforms:W([Jl.common,Jl.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Zl.linedashed_vert,fragmentShader:Zl.linedashed_frag},depth:{uniforms:W([Jl.common,Jl.displacementmap]),vertexShader:Zl.depth_vert,fragmentShader:Zl.depth_frag},normal:{uniforms:W([Jl.common,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,{opacity:{value:1}}]),vertexShader:Zl.normal_vert,fragmentShader:Zl.normal_frag},sprite:{uniforms:W([Jl.sprite,Jl.fog]),vertexShader:Zl.sprite_vert,fragmentShader:Zl.sprite_frag},background:{uniforms:{uvTransform:{value:new r},t2D:{value:null}},vertexShader:Zl.background_vert,fragmentShader:Zl.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Zl.cube_vert,fragmentShader:Zl.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Zl.equirect_vert,fragmentShader:Zl.equirect_frag},distanceRGBA:{uniforms:W([Jl.common,Jl.displacementmap,{referencePosition:{value:new i},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Zl.distanceRGBA_vert,fragmentShader:Zl.distanceRGBA_frag},shadow:{uniforms:W([Jl.lights,Jl.fog,{color:{value:new x(0)},opacity:{value:1}}]),vertexShader:Zl.shadow_vert,fragmentShader:Zl.shadow_frag}}).physical={uniforms:W([$l.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new x(0)},clearcoatNormalScale:{value:new e(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:Zl.meshphysical_vert,fragmentShader:Zl.meshphysical_frag},et.prototype=Object.create(V.prototype),et.prototype.constructor=et,nt.prototype=Object.create(k.prototype),nt.prototype.constructor=nt,ft.prototype=Object.create(o.prototype),ft.prototype.constructor=ft,ft.prototype.isCubeTexture=1,Object.defineProperty(ft.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),mt.prototype=Object.create(o.prototype),mt.prototype.constructor=mt,mt.prototype.isDataTexture2DArray=1,gt.prototype=Object.create(o.prototype),gt.prototype.constructor=gt,gt.prototype.isDataTexture3D=1,Ql=new o,Kl=new mt,tu=new gt,eu=new ft,nu=[],iu=[],ru=new Float32Array(16),ou=new Float32Array(9),au=new Float32Array(4),Jt.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),xt(e,t)},$t.prototype.setValue=function(t,e,n){var i,r,o,a=this.seq;for(i=0,r=a.length;i!==r;++i)(o=a[i]).setValue(t,e[o.id],n)},su=/([\w\d_]+)(\])?(\[|\.)?/g,te.prototype.setValue=function(t,e,n,i){var r=this.map[e];void 0!==r&&r.setValue(t,n,i)},te.prototype.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},te.upload=function(t,e,n,i){var r,o,a,s;for(r=0,o=e.length;r!==o;++r)0!=(s=n[(a=e[r]).id]).needsUpdate&&a.setValue(t,s.value,i)},te.seqWithValue=function(t,e){var n,i,r,o=[];for(n=0,i=t.length;n!==i;++n)(r=t[n]).id in e&&o.push(r);return o},cu=0,lu=/^[ \t]*#include +<([\w\d./]+)>/gm,uu=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,hu=0,Ae.prototype=Object.create(S.prototype),Ae.prototype.constructor=Ae,Ae.prototype.isMeshDepthMaterial=1,Ae.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Le.prototype=Object.create(S.prototype),Le.prototype.constructor=Le,Le.prototype.isMeshDistanceMaterial=1,Le.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},pu="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}",du="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Oe.prototype=Object.assign(Object.create(s.prototype),{constructor:Oe,isWebGLMultiviewRenderTarget:1,copy:function(t){return s.prototype.copy.call(this,t),this.numViews=t.numViews,this},setNumViews:function(t){return this.numViews!==t&&(this.numViews=t,this.dispose()),this}}),Ie.prototype=Object.assign(Object.create(p.prototype),{constructor:Ie,isGroup:1}),ze.prototype=Object.assign(Object.create(X.prototype),{constructor:ze,isArrayCamera:1}),fu=new i,mu=new i,Object.assign(Fe.prototype,t.prototype),Object.assign(ke.prototype,t.prototype),Object.assign(Ue.prototype,{isFogExp2:1,clone:function(){return new Ue(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(je.prototype,{isFog:1,clone:function(){return new je(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Ve.prototype,"needsUpdate",{set:function(t){1==t&&this.version++}}),Object.assign(Ve.prototype,{isInterleavedBuffer:1,onUploadCallback:function(){},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Object.defineProperties(Ge.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Ge.prototype,{isInterleavedBufferAttribute:1,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}}),We.prototype=Object.create(S.prototype),We.prototype.constructor=We,We.prototype.isSpriteMaterial=1,We.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this},vu=new i,yu=new i,xu=new i,bu=new e,_u=new e,wu=new l,Mu=new i,Su=new i,Tu=new i,Au=new e,Lu=new e,Cu=new e,He.prototype=Object.assign(Object.create(p.prototype),{constructor:He,isSprite:1,raycast:function(t,n){var i,r,o,a,s;t.camera,yu.setFromMatrixScale(this.matrixWorld),wu.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),xu.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&0==this.material.sizeAttenuation&&yu.multiplyScalar(-xu.z),0!==(i=this.material.rotation)&&(o=Math.cos(i),r=Math.sin(i)),a=this.center,qe(Mu.set(-.5,-.5,0),xu,a,yu,r,o),qe(Su.set(.5,-.5,0),xu,a,yu,r,o),qe(Tu.set(.5,.5,0),xu,a,yu,r,o),Au.set(0,0),Lu.set(1,0),Cu.set(1,1),null===t.ray.intersectTriangle(Mu,Su,Tu,0,vu)&&(qe(Su.set(-.5,.5,0),xu,a,yu,r,o),Lu.set(0,1),null===t.ray.intersectTriangle(Mu,Tu,Su,0,vu))||(s=t.ray.origin.distanceTo(vu))<t.near||s>t.far||n.push({distance:s,point:vu.clone(),uv:y.getUV(vu,Mu,Su,Tu,Au,Lu,Cu,new e),face:null,object:this})},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return p.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),Pu=new i,Eu=new i,Xe.prototype=Object.assign(Object.create(p.prototype),{constructor:Xe,isLOD:1,copy:function(t){var e,n,i,r;for(p.prototype.copy.call(this,t,0),n=0,i=(e=t.levels).length;n<i;n++)r=e[n],this.addLevel(r.object.clone(),r.distance);return this},addLevel:function(t,e){var n,i;for(void 0===e&&(e=0),e=Math.abs(e),n=this.levels,i=0;i<n.length&&!(e<n[i].distance);i++);return n.splice(i,0,{distance:e,object:t}),this.add(t),this},getObjectForDistance:function(t){var e,n,i=this.levels;for(e=1,n=i.length;e<n&&!(t<i[e].distance);e++);return i[e-1].object},raycast:function(t,e){Pu.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(Pu);this.getObjectForDistance(n).raycast(t,e)},update:function(t){var e,n,i,r=this.levels;if(r.length>1){for(Pu.setFromMatrixPosition(t.matrixWorld),Eu.setFromMatrixPosition(this.matrixWorld),e=Pu.distanceTo(Eu),r[0].object.visible=1,n=1,i=r.length;n<i&&e>=r[n].distance;n++)r[n-1].object.visible=0,r[n].object.visible=1;for(;n<i;n++)r[n].object.visible=0}},toJSON:function(t){var e,n,i,r,o=p.prototype.toJSON.call(this,t);for(o.object.levels=[],n=0,i=(e=this.levels).length;n<i;n++)r=e[n],o.object.levels.push({object:r.object.uuid,distance:r.distance});return o}}),Ye.prototype=Object.assign(Object.create(B.prototype),{constructor:Ye,isSkinnedMesh:1,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(1),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e,n,i=new a,r=this.geometry.attributes.skinWeight;for(t=0,e=r.count;t<e;t++)i.x=r.getX(t),i.y=r.getY(t),i.z=r.getZ(t),i.w=r.getW(t),(n=1/i.manhattanLength())!=1/0?i.multiplyScalar(n):i.set(1,0,0,0),r.setXYZW(t,i.x,i.y,i.z,i.w)},updateMatrixWorld:function(t){B.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode&&this.bindMatrixInverse.getInverse(this.bindMatrix)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Nu=new l,Ou=new l,Object.assign(Ze.prototype,{calculateInverses:function(){var t,e,n;for(this.boneInverses=[],t=0,e=this.bones.length;t<e;t++)n=new l,this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)},pose:function(){var t,e,n;for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t,e,n,i=this.bones,r=this.boneInverses,o=this.boneMatrices,a=this.boneTexture;for(t=0,e=i.length;t<e;t++)n=i[t]?i[t].matrixWorld:Ou,Nu.multiplyMatrices(n,r[t]),Nu.toArray(o,16*t);void 0!==a&&(a.needsUpdate=1)},clone:function(){return new Ze(this.bones,this.boneInverses)},getBoneByName:function(t){var e,n,i;for(e=0,n=this.bones.length;e<n;e++)if((i=this.bones[e]).name===t)return i}}),Je.prototype=Object.assign(Object.create(p.prototype),{constructor:Je,isBone:1}),$e.prototype=Object.assign(Object.create(B.prototype),{constructor:$e,isInstancedMesh:1,raycast:function(){},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){}}),Qe.prototype=Object.create(S.prototype),Qe.prototype.constructor=Qe,Qe.prototype.isLineBasicMaterial=1,Qe.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},Du=new i,Iu=new i,zu=new l,Ru=new v,Fu=new g,Ke.prototype=Object.assign(Object.create(p.prototype),{constructor:Ke,isLine:1,computeLineDistances:function(){var t,e,n,i,r,o=this.geometry;if(o.isBufferGeometry){if(null===o.index){for(e=[0],n=1,i=(t=o.attributes.position).count;n<i;n++)Du.fromBufferAttribute(t,n-1),Iu.fromBufferAttribute(t,n),e[n]=e[n-1],e[n]+=Du.distanceTo(Iu);o.addAttribute("lineDistance",new I(e,1))}}else if(o.isGeometry)for(r=o.vertices,(e=o.lineDistances)[0]=0,n=1,i=r.length;n<i;n++)e[n]=e[n-1],e[n]+=r[n-1].distanceTo(r[n]);return this},raycast:function(t,e){var n,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b=t.linePrecision,_=this.geometry,w=this.matrixWorld;if(null===_.boundingSphere&&_.computeBoundingSphere(),Fu.copy(_.boundingSphere),Fu.applyMatrix4(w),Fu.radius+=b,0!=t.ray.intersectsSphere(Fu))if(zu.getInverse(w),Ru.copy(t.ray).applyMatrix4(zu),r=(n=b/((this.scale.x+this.scale.y+this.scale.z)/3))*n,o=new i,a=new i,s=new i,c=new i,l=this&&this.isLineSegments?2:1,_.isBufferGeometry)if(u=_.index,h=_.attributes.position.array,null!==u)for(d=0,f=(p=u.array).length-1;d<f;d+=l)m=p[d],g=p[d+1],o.fromArray(h,3*m),a.fromArray(h,3*g),Ru.distanceSqToSegment(o,a,c,s)>r||(c.applyMatrix4(this.matrixWorld),(v=t.ray.origin.distanceTo(c))<t.near||v>t.far||e.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}));else for(d=0,f=h.length/3-1;d<f;d+=l)o.fromArray(h,3*d),a.fromArray(h,3*d+3),Ru.distanceSqToSegment(o,a,c,s)>r||(c.applyMatrix4(this.matrixWorld),(v=t.ray.origin.distanceTo(c))<t.near||v>t.far||e.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}));else if(_.isGeometry)for(x=(y=_.vertices).length,d=0;d<x-1;d+=l)Ru.distanceSqToSegment(y[d],y[d+1],c,s)>r||(c.applyMatrix4(this.matrixWorld),(v=t.ray.origin.distanceTo(c))<t.near||v>t.far||e.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ku=new i,Bu=new i,tn.prototype=Object.assign(Object.create(Ke.prototype),{constructor:tn,isLineSegments:1,computeLineDistances:function(){var t,e,n,i,r,o=this.geometry;if(o.isBufferGeometry){if(null===o.index){for(e=[],n=0,i=(t=o.attributes.position).count;n<i;n+=2)ku.fromBufferAttribute(t,n),Bu.fromBufferAttribute(t,n+1),e[n]=0===n?0:e[n-1],e[n+1]=e[n]+ku.distanceTo(Bu);o.addAttribute("lineDistance",new I(e,1))}}else if(o.isGeometry)for(r=o.vertices,e=o.lineDistances,n=0,i=r.length;n<i;n+=2)ku.copy(r[n]),Bu.copy(r[n+1]),e[n]=0===n?0:e[n-1],e[n+1]=e[n]+ku.distanceTo(Bu);return this}}),en.prototype=Object.assign(Object.create(Ke.prototype),{constructor:en,isLineLoop:1}),nn.prototype=Object.create(S.prototype),nn.prototype.constructor=nn,nn.prototype.isPointsMaterial=1,nn.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this},Uu=new l,ju=new v,Vu=new g,Gu=new i,rn.prototype=Object.assign(Object.create(p.prototype),{constructor:rn,isPoints:1,raycast:function(t,e){var n,i,r,o,a,s,c,l,u,h,p=this.geometry,d=this.matrixWorld,f=t.params.Points.threshold;if(null===p.boundingSphere&&p.computeBoundingSphere(),Vu.copy(p.boundingSphere),Vu.applyMatrix4(d),Vu.radius+=f,0!=t.ray.intersectsSphere(Vu))if(Uu.getInverse(d),ju.copy(t.ray).applyMatrix4(Uu),i=(n=f/((this.scale.x+this.scale.y+this.scale.z)/3))*n,p.isBufferGeometry)if(r=p.index,o=p.attributes.position.array,null!==r)for(s=0,c=(a=r.array).length;s<c;s++)l=a[s],Gu.fromArray(o,3*l),on(Gu,l,i,d,t,e,this);else for(s=0,u=o.length/3;s<u;s++)Gu.fromArray(o,3*s),on(Gu,s,i,d,t,e,this);else for(s=0,u=(h=p.vertices).length;s<u;s++)on(h[s],s,i,d,t,e,this)},updateMorphTargets:function(){var t,e,n,i,r,o,a,s=this.geometry;if(s.isBufferGeometry){if(i=s.morphAttributes,(r=Object.keys(i)).length>0&&void 0!==(o=i[r[0]]))for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)n=o[t].name||t+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}else void 0!==(a=s.morphTargets)&&a.length},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),an.prototype=Object.assign(Object.create(o.prototype),{constructor:an,isVideoTexture:1,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=1)}}),sn.prototype=Object.create(o.prototype),sn.prototype.constructor=sn,sn.prototype.isCompressedTexture=1,cn.prototype=Object.create(o.prototype),cn.prototype.constructor=cn,cn.prototype.isCanvasTexture=1,ln.prototype=Object.create(o.prototype),ln.prototype.constructor=ln,ln.prototype.isDepthTexture=1,un.prototype=Object.create(k.prototype),un.prototype.constructor=un,hn.prototype=Object.create(V.prototype),hn.prototype.constructor=hn,pn.prototype=Object.create(k.prototype),pn.prototype.constructor=pn,dn.prototype=Object.create(V.prototype),dn.prototype.constructor=dn,fn.prototype=Object.create(k.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(V.prototype),mn.prototype.constructor=mn,gn.prototype=Object.create(fn.prototype),gn.prototype.constructor=gn,vn.prototype=Object.create(V.prototype),vn.prototype.constructor=vn,yn.prototype=Object.create(fn.prototype),yn.prototype.constructor=yn,xn.prototype=Object.create(V.prototype),xn.prototype.constructor=xn,bn.prototype=Object.create(fn.prototype),bn.prototype.constructor=bn,_n.prototype=Object.create(V.prototype),_n.prototype.constructor=_n,wn.prototype=Object.create(fn.prototype),wn.prototype.constructor=wn,Mn.prototype=Object.create(V.prototype),Mn.prototype.constructor=Mn,Sn.prototype=Object.create(k.prototype),Sn.prototype.constructor=Sn,Sn.prototype.toJSON=function(){var t=k.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},Tn.prototype=Object.create(V.prototype),Tn.prototype.constructor=Tn,An.prototype=Object.create(k.prototype),An.prototype.constructor=An,Ln.prototype=Object.create(V.prototype),Ln.prototype.constructor=Ln,Cn.prototype=Object.create(k.prototype),Cn.prototype.constructor=Cn,Wu=function(t,e,n){var i,r,o,a,s,c,l,u,h,p,d,f;if(n=n||2,a=[],!(o=Pn(t,0,r=(i=e&&e.length)?e[0]*n:t.length,n,1))||o.next===o.prev)return a;if(i&&(o=function(t,e,n,i){var r,o,a,s=[];for(r=0,o=e.length;r<o;r++)(a=Pn(t,e[r]*i,r<o-1?e[r+1]*i:t.length,i,0))===a.next&&(a.steiner=1),s.push(Bn(a));for(s.sort(Rn),r=0;r<s.length;r++)Fn(s[r],n),n=En(n,n.next);return n}(t,e,o,n)),t.length>80*n){for(s=l=t[0],c=u=t[1],f=n;f<r;f+=n)(h=t[f])<s&&(s=h),(p=t[f+1])<c&&(c=p),h>l&&(l=h),p>u&&(u=p);d=0!==(d=Math.max(l-s,u-c))?1/d:0}return Nn(o,a,n,s,c,d),a},Hu={area:function(t){var e,n,i=t.length,r=0;for(e=i-1,n=0;n<i;e=n++)r+=t[e].x*t[n].y-t[n].x*t[e].y;return.5*r},isClockWise:function(t){return Hu.area(t)<0},triangulateShape:function(t,e){var n,i,r,o=[],a=[],s=[];for(Jn(t),$n(o,t),n=t.length,e.forEach(Jn),i=0;i<e.length;i++)a.push(n),n+=e[i].length,$n(o,e[i]);for(r=Wu(o,a),i=0;i<r.length;i+=3)s.push(r.slice(i,i+3));return s}},Qn.prototype=Object.create(V.prototype),Qn.prototype.constructor=Qn,Qn.prototype.toJSON=function(){var t=V.prototype.toJSON.call(this);return ti(this.parameters.shapes,this.parameters.options,t)},Kn.prototype=Object.create(k.prototype),Kn.prototype.constructor=Kn,Kn.prototype.toJSON=function(){var t=k.prototype.toJSON.call(this);return ti(this.parameters.shapes,this.parameters.options,t)},qu={generateTopUV:function(t,n,i,r,o){var a=n[3*i],s=n[3*i+1],c=n[3*r],l=n[3*r+1],u=n[3*o],h=n[3*o+1];return[new e(a,s),new e(c,l),new e(u,h)]},generateSideWallUV:function(t,n,i,r,o,a){var s=n[3*i],c=n[3*i+1],l=n[3*i+2],u=n[3*r],h=n[3*r+1],p=n[3*r+2],d=n[3*o],f=n[3*o+1],m=n[3*o+2],g=n[3*a],v=n[3*a+1],y=n[3*a+2];return Math.abs(c-h)<.01?[new e(s,1-l),new e(u,1-p),new e(d,1-m),new e(g,1-y)]:[new e(c,1-l),new e(h,1-p),new e(f,1-m),new e(v,1-y)]}},ei.prototype=Object.create(V.prototype),ei.prototype.constructor=ei,ni.prototype=Object.create(Kn.prototype),ni.prototype.constructor=ni,ii.prototype=Object.create(V.prototype),ii.prototype.constructor=ii,ri.prototype=Object.create(k.prototype),ri.prototype.constructor=ri,oi.prototype=Object.create(V.prototype),oi.prototype.constructor=oi,ai.prototype=Object.create(k.prototype),ai.prototype.constructor=ai,si.prototype=Object.create(V.prototype),si.prototype.constructor=si,ci.prototype=Object.create(k.prototype),ci.prototype.constructor=ci,li.prototype=Object.create(V.prototype),li.prototype.constructor=li,li.prototype.toJSON=function(){var t=V.prototype.toJSON.call(this);return hi(this.parameters.shapes,t)},ui.prototype=Object.create(k.prototype),ui.prototype.constructor=ui,ui.prototype.toJSON=function(){var t=k.prototype.toJSON.call(this);return hi(this.parameters.shapes,t)},pi.prototype=Object.create(k.prototype),pi.prototype.constructor=pi,di.prototype=Object.create(V.prototype),di.prototype.constructor=di,fi.prototype=Object.create(k.prototype),fi.prototype.constructor=fi,mi.prototype=Object.create(di.prototype),mi.prototype.constructor=mi,gi.prototype=Object.create(fi.prototype),gi.prototype.constructor=gi,vi.prototype=Object.create(V.prototype),vi.prototype.constructor=vi,yi.prototype=Object.create(k.prototype),yi.prototype.constructor=yi,Xu=Object.freeze({WireframeGeometry:un,ParametricGeometry:hn,ParametricBufferGeometry:pn,TetrahedronGeometry:mn,TetrahedronBufferGeometry:gn,OctahedronGeometry:vn,OctahedronBufferGeometry:yn,IcosahedronGeometry:xn,IcosahedronBufferGeometry:bn,DodecahedronGeometry:_n,DodecahedronBufferGeometry:wn,PolyhedronGeometry:dn,PolyhedronBufferGeometry:fn,TubeGeometry:Mn,TubeBufferGeometry:Sn,TorusKnotGeometry:Tn,TorusKnotBufferGeometry:An,TorusGeometry:Ln,TorusBufferGeometry:Cn,TextGeometry:ei,TextBufferGeometry:ni,SphereGeometry:ii,SphereBufferGeometry:ri,RingGeometry:oi,RingBufferGeometry:ai,PlaneGeometry:et,PlaneBufferGeometry:nt,LatheGeometry:si,LatheBufferGeometry:ci,ShapeGeometry:li,ShapeBufferGeometry:ui,ExtrudeGeometry:Qn,ExtrudeBufferGeometry:Kn,EdgesGeometry:pi,ConeGeometry:mi,ConeBufferGeometry:gi,CylinderGeometry:di,CylinderBufferGeometry:fi,CircleGeometry:vi,CircleBufferGeometry:yi,BoxGeometry:class extends V{constructor(t,e,n,i,r,o){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new up(t,e,n,i,r,o)),this.mergeVertices()}},BoxBufferGeometry:up}),xi.prototype=Object.create(S.prototype),xi.prototype.constructor=xi,xi.prototype.isShadowMaterial=1,xi.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this},bi.prototype=Object.create(H.prototype),bi.prototype.constructor=bi,bi.prototype.isRawShaderMaterial=1,_i.prototype=Object.create(S.prototype),_i.prototype.constructor=_i,_i.prototype.isMeshStandardMaterial=1,_i.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},wi.prototype=Object.create(_i.prototype),wi.prototype.constructor=wi,wi.prototype.isMeshPhysicalMaterial=1,wi.prototype.copy=function(t){return _i.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearcoat=t.clearcoat,this.clearcoatRoughness=t.clearcoatRoughness,t.sheen?this.sheen=(this.sheen||new x).copy(t.sheen):this.sheen=null,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.transparency=t.transparency,this},Mi.prototype=Object.create(S.prototype),Mi.prototype.constructor=Mi,Mi.prototype.isMeshPhongMaterial=1,Mi.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Si.prototype=Object.create(Mi.prototype),Si.prototype.constructor=Si,Si.prototype.isMeshToonMaterial=1,Si.prototype.copy=function(t){return Mi.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Ti.prototype=Object.create(S.prototype),Ti.prototype.constructor=Ti,Ti.prototype.isMeshNormalMaterial=1,Ti.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ai.prototype=Object.create(S.prototype),Ai.prototype.constructor=Ai,Ai.prototype.isMeshLambertMaterial=1,Ai.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Li.prototype=Object.create(S.prototype),Li.prototype.constructor=Li,Li.prototype.isMeshMatcapMaterial=1,Li.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ci.prototype=Object.create(Qe.prototype),Ci.prototype.constructor=Ci,Ci.prototype.isLineDashedMaterial=1,Ci.prototype.copy=function(t){return Qe.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this},Yu=Object.freeze({ShadowMaterial:xi,SpriteMaterial:We,RawShaderMaterial:bi,ShaderMaterial:H,PointsMaterial:nn,MeshPhysicalMaterial:wi,MeshStandardMaterial:_i,MeshPhongMaterial:Mi,MeshToonMaterial:Si,MeshNormalMaterial:Ti,MeshLambertMaterial:Ai,MeshDepthMaterial:Ae,MeshDistanceMaterial:Le,MeshBasicMaterial:T,MeshMatcapMaterial:Li,LineDashedMaterial:Ci,LineBasicMaterial:Qe,Material:S}),Zu={arraySlice:function(t,e,n){return Zu.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){var e,n=t.length,i=Array(n);for(e=0;e!==n;++e)i[e]=e;return i.sort(function(e,n){return t[e]-t[n]}),i},sortedArray:function(t,e,n){var i,r,o,a,s=t.length,c=new t.constructor(s);for(i=0,r=0;r!==s;++i)for(o=n[i]*e,a=0;a!==e;++a)c[r++]=t[o+a];return c},flattenJSON:function(t,e,n,i){for(var r,o=1,a=t[0];void 0!==a&&void 0===a[i];)a=t[o++];if(void 0!==a&&void 0!==(r=a[i]))if(Array.isArray(r))do{void 0!==(r=a[i])&&(e.push(a.time),n.push.apply(n,r)),a=t[o++]}while(void 0!==a);else if(void 0!==r.toArray)do{void 0!==(r=a[i])&&(e.push(a.time),r.toArray(n,n.length)),a=t[o++]}while(void 0!==a);else do{void 0!==(r=a[i])&&(e.push(a.time),n.push(r)),a=t[o++]}while(void 0!==a)}},Object.assign(Pi.prototype,{evaluate:function(t){var e,n,i,r,o=this.parameterPositions,a=this._cachedIndex,s=o[a],c=o[a-1];t:{e:{n:{i:if(!(t<s)){for(n=a+2;;){if(void 0===s){if(t<c)break i;return a=o.length,this._cachedIndex=a,this.afterEnd_(a-1,t,c)}if(a===n)break;if(c=s,t<(s=o[++a]))break e}e=o.length;break n}if(t>=c)break t;for(t<(i=o[1])&&(a=2,c=i),n=a-2;;){if(void 0===c)return this._cachedIndex=0,this.beforeStart_(0,t,s);if(a===n)break;if(s=c,t>=(c=o[--a-1]))break e}e=a,a=0}for(;a<e;)t<o[r=a+e>>>1]?e=r:a=r+1;if(s=o[a],void 0===(c=o[a-1]))return this._cachedIndex=0,this.beforeStart_(0,t,s);if(void 0===s)return a=o.length,this._cachedIndex=a,this.afterEnd_(a-1,c,t)}this._cachedIndex=a,this.intervalChanged_(a,c,s)}return this.interpolate_(a,c,t,s)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e,n=this.resultBuffer,i=this.sampleValues,r=this.valueSize,o=t*r;for(e=0;e!==r;++e)n[e]=i[o+e];return n},interpolate_:function(){throw Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Pi.prototype,{beforeStart_:Pi.prototype.copySampleValue_,afterEnd_:Pi.prototype.copySampleValue_}),Ei.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ei,DefaultSettings_:{endingStart:Fs,endingEnd:Fs},intervalChanged_:function(t,e,n){var i,r,o=this.parameterPositions,a=t-2,s=t+1,c=o[a],l=o[s];if(void 0===c)switch(this.getSettings_().endingStart){case 2401:a=t,c=2*e-n;break;case 2402:c=e+o[a=o.length-2]-o[a+1];break;default:a=t,c=n}if(void 0===l)switch(this.getSettings_().endingEnd){case 2401:s=t,l=2*n-e;break;case 2402:s=1,l=n+o[1]-o[0];break;default:s=t-1,l=e}i=.5*(n-e),r=this.valueSize,this._weightPrev=i/(e-c),this._weightNext=i/(l-n),this._offsetPrev=a*r,this._offsetNext=s*r},interpolate_:function(t,e,n,i){var r,o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,c=t*s,l=c-s,u=this._offsetPrev,h=this._offsetNext,p=this._weightPrev,d=this._weightNext,f=(n-e)/(i-e),m=f*f,g=m*f,v=-p*g+2*p*m-p*f,y=(1+p)*g+(-1.5-2*p)*m+(-.5+p)*f+1,x=(-1-d)*g+(1.5+d)*m+.5*f,b=d*g-d*m;for(r=0;r!==s;++r)o[r]=v*a[u+r]+y*a[l+r]+x*a[c+r]+b*a[h+r];return o}}),Ni.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ni,interpolate_:function(t,e,n,i){var r,o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,c=t*s,l=c-s,u=(n-e)/(i-e),h=1-u;for(r=0;r!==s;++r)o[r]=a[l+r]*h+a[c+r]*u;return o}}),Oi.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Oi,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Di,{toJSON:function(t){var e,n,i=t.constructor;return void 0!==i.toJSON?e=i.toJSON(t):(e={name:t.name,times:Zu.convertArray(t.times,Array),values:Zu.convertArray(t.values,Array)},(n=t.getInterpolation())!==t.DefaultInterpolation&&(e.interpolation=n)),e.type=t.ValueTypeName,e}}),Object.assign(Di.prototype,{constructor:Di,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Oi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Ni(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Ei(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e,n;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(n);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,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(t){var e,n,i;if(0!==t)for(n=0,i=(e=this.times).length;n!==i;++n)e[n]+=t;return this},scale:function(t){var e,n,i;if(1!==t)for(n=0,i=(e=this.times).length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n,i=this.times,r=i.length,o=0,a=r-1;o!==r&&i[o]<t;)++o;for(;-1!==a&&i[a]>e;)--a;return++a,0===o&&a===r||(o>=a&&(o=(a=Math.max(a,1))-1),n=this.getValueSize(),this.times=Zu.arraySlice(i,o,a),this.values=Zu.arraySlice(this.values,o*n,a*n)),this},validate:function(){var t,e,n,i,r,o,a,s,c=1,l=this.getValueSize();for(l-Math.floor(l)!=0&&(c=0),t=this.times,e=this.values,0===(n=t.length)&&(c=0),i=null,r=0;r!==n;r++){if("number"==typeof(o=t[r])&&isNaN(o)){c=0;break}if(null!==i&&i>o){c=0;break}i=o}if(void 0!==e&&Zu.isTypedArray(e))for(r=0,a=e.length;r!==a;++r)if(s=e[r],isNaN(s)){c=0;break}return c},optimize:function(){var t,e,n,i,r,o,a,s,c,l,u=this.times,h=this.values,p=this.getValueSize(),d=2302===this.getInterpolation(),f=1,m=u.length-1;for(t=1;t<m;++t){if(e=0,(n=u[t])!==u[t+1]&&(1!==t||n!==n[0]))if(d)e=1;else for(r=(i=t*p)-p,o=i+p,a=0;a!==p;++a)if((s=h[i+a])!==h[r+a]||s!==h[o+a]){e=1;break}if(e){if(t!==f)for(u[f]=u[t],c=t*p,l=f*p,a=0;a!==p;++a)h[l+a]=h[c+a];++f}}if(m>0){for(u[f]=u[m],c=m*p,l=f*p,a=0;a!==p;++a)h[l+a]=h[c+a];++f}return f!==u.length&&(this.times=Zu.arraySlice(u,0,f),this.values=Zu.arraySlice(h,0,f*p)),this},clone:function(){var t=Zu.arraySlice(this.times,0),e=Zu.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),Ii.prototype=Object.assign(Object.create(Di.prototype),{constructor:Ii,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),zi.prototype=Object.assign(Object.create(Di.prototype),{constructor:zi,ValueTypeName:"color"}),Ri.prototype=Object.assign(Object.create(Di.prototype),{constructor:Ri,ValueTypeName:"number"}),Fi.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Fi,interpolate_:function(t,e,i,r){var o,a=this.resultBuffer,s=this.sampleValues,c=this.valueSize,l=t*c,u=(i-e)/(r-e);for(o=l+c;l!==o;l+=4)n.slerpFlat(a,0,s,l-c,s,l,u);return a}}),ki.prototype=Object.assign(Object.create(Di.prototype),{constructor:ki,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Fi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Bi.prototype=Object.assign(Object.create(Di.prototype),{constructor:Bi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ui.prototype=Object.assign(Object.create(Di.prototype),{constructor:Ui,ValueTypeName:"vector"}),Object.assign(ji,{parse:function(t){var e,n,i=[],r=t.tracks,o=1/(t.fps||1);for(e=0,n=r.length;e!==n;++e)i.push(Vi(r[e]).scale(o));return new ji(t.name,t.duration,i)},toJSON:function(t){var e,n,i=[],r=t.tracks,o={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid};for(e=0,n=r.length;e!==n;++e)i.push(Di.toJSON(r[e]));return o},CreateFromMorphTargetSequence:function(t,e,n,i){var r,o,a,s,c=e.length,l=[];for(r=0;r<c;r++)a=[],(o=[]).push((r+c-1)%c,r,(r+1)%c),a.push(0,1,0),s=Zu.getKeyframeOrder(o),o=Zu.sortedArray(o,1,s),a=Zu.sortedArray(a,1,s),i||0!==o[0]||(o.push(c),a.push(a[0])),l.push(new Ri(".morphTargetInfluences["+e[r].name+"]",o,a).scale(1/n));return new ji(t,-1,l)},findByName:function(t,e){var n,i,r=t;for(Array.isArray(t)||(r=(n=t).geometry&&n.geometry.animations||n.animations),i=0;i<r.length;i++)if(r[i].name===e)return r[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){var i,r,o,a,s,c,l,u={},h=/^([\w-]*?)([\d]+)$/;for(i=0,r=t.length;i<r;i++)(a=(o=t[i]).name.match(h))&&a.length>1&&((c=u[s=a[1]])||(u[s]=c=[]),c.push(o));for(s in l=[],u)l.push(ji.CreateFromMorphTargetSequence(s,u[s],e,n));return l},parseAnimation:function(t,e){var n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v;if(!t)return null;for(n=function(t,e,n,i,r){var o,a;0!==n.length&&(o=[],a=[],Zu.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a)))},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++)if((l=s[c].keys)&&0!==l.length)if(l[0].morphTargets){for(u={},h=0;h<l.length;h++)if(l[h].morphTargets)for(p=0;p<l[h].morphTargets.length;p++)u[l[h].morphTargets[p]]=-1;for(d in u){for(f=[],m=[],p=0;p!==l[h].morphTargets.length;++p)g=l[h],f.push(g.time),m.push(g.morphTarget===d?1:0);i.push(new Ri(".morphTargetInfluence["+d+"]",f,m))}o=u.length*(a||1)}else n(Ui,(v=".bones["+e[c].name+"]")+".position",l,"pos",i),n(ki,v+".quaternion",l,"rot",i),n(Ui,v+".scale",l,"scl",i);return 0===i.length?null:new ji(r,o,i)}}),Object.assign(ji.prototype,{resetDuration:function(){var t,e,n,i=0;for(t=0,e=this.tracks.length;t!==e;++t)n=this.tracks[t],i=Math.max(i,n.times[n.times.length-1]);return this.duration=i,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){var t,e=1;for(t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){var t,e=[];for(t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new ji(this.name,this.duration,e)}}),Ju={enabled:0,files:{},add:function(t,e){0!=this.enabled&&(this.files[t]=e)},get:function(t){if(0!=this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},$u=new Gi,Object.assign(Wi.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this}}),Qu={},Hi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Hi,load:function(t,e,n,i){var r,o,a,s,c,l,u,h,p,d,f,m,g,v;if(void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t),r=this,void 0!==(o=Ju.get(t)))return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;if(void 0===Qu[t]){if(a=/^data:(.*?)(;base64)?,(.*)$/,s=t.match(a)){c=s[1],l=!!s[2],u=s[3],u=decodeURIComponent(u),l&&(u=atob(u));try{switch(p=(this.responseType||"").toLowerCase()){case"arraybuffer":case"blob":for(d=new Uint8Array(u.length),f=0;f<u.length;f++)d[f]=u.charCodeAt(f);h="blob"===p?new Blob([d.buffer],{type:c}):d.buffer;break;case"document":m=new DOMParser,h=m.parseFromString(u,c);break;case"json":h=JSON.parse(u);break;default:h=u}setTimeout(function(){e&&e(h),r.manager.itemEnd(t)},0)}catch(e){setTimeout(function(){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)},0)}}else{for(v in Qu[t]=[],Qu[t].push({onLoad:e,onProgress:n,onError:i}),(g=new XMLHttpRequest).open("GET",t,1),g.addEventListener("load",function(e){var n,i,o,a,s=this.response;if(Ju.add(t,s),n=Qu[t],delete Qu[t],200===this.status||0===this.status){for(this.status,i=0,o=n.length;i<o;i++)(a=n[i]).onLoad&&a.onLoad(s);r.manager.itemEnd(t)}else{for(i=0,o=n.length;i<o;i++)(a=n[i]).onError&&a.onError(e);r.manager.itemError(t),r.manager.itemEnd(t)}},0),g.addEventListener("progress",function(e){var n,i,r,o=Qu[t];for(n=0,i=o.length;n<i;n++)(r=o[n]).onProgress&&r.onProgress(e)},0),g.addEventListener("error",function(e){var n,i,o,a=Qu[t];for(delete Qu[t],n=0,i=a.length;n<i;n++)(o=a[n]).onError&&o.onError(e);r.manager.itemError(t),r.manager.itemEnd(t)},0),g.addEventListener("abort",function(e){var n,i,o,a=Qu[t];for(delete Qu[t],n=0,i=a.length;n<i;n++)(o=a[n]).onError&&o.onError(e);r.manager.itemError(t),r.manager.itemEnd(t)},0),void 0!==this.responseType&&(g.responseType=this.responseType),void 0!==this.withCredentials&&(g.withCredentials=this.withCredentials),g.overrideMimeType&&g.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)g.setRequestHeader(v,this.requestHeader[v]);g.send(null)}return r.manager.itemStart(t),g}Qu[t].push({onLoad:e,onProgress:n,onError:i})},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),qi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:qi,load:function(t,e,n,i){var r=this,o=new Hi(r.manager);o.setPath(r.path),o.load(t,function(t){e(r.parse(JSON.parse(t)))},n,i)},parse:function(t){var e,n,i=[];for(e=0;e<t.length;e++)n=ji.parse(t[e]),i.push(n);return i}}),Xi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Xi,load:function(t,e,n,i){function r(r){o.load(t[r],function(t){var n=l.parse(t,1);u[r]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(a+=1)&&(1===n.mipmapCount&&(h.minFilter=Wa),h.format=n.format,h.needsUpdate=1,e&&e(h))},n,i)}var o,a,s,c,l=this,u=[],h=new sn;if(h.image=u,(o=new Hi(this.manager)).setPath(this.path),o.setResponseType("arraybuffer"),Array.isArray(t))for(a=0,s=0,c=t.length;s<c;++s)r(s);else o.load(t,function(t){var n,i,r,o=l.parse(t,1);if(o.isCubemap)for(n=o.mipmaps.length/o.mipmapCount,i=0;i<n;i++)for(u[i]={mipmaps:[]},r=0;r<o.mipmapCount;r++)u[i].mipmaps.push(o.mipmaps[i*o.mipmapCount+r]),u[i].format=o.format,u[i].width=o.width,u[i].height=o.height;else h.image.width=o.width,h.image.height=o.height,h.mipmaps=o.mipmaps;1===o.mipmapCount&&(h.minFilter=Wa),h.format=o.format,h.needsUpdate=1,e&&e(h)},n,i);return h}}),Yi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Yi,load:function(t,e,n,i){var r=this,o=new J,a=new Hi(this.manager);return a.setResponseType("arraybuffer"),a.setPath(this.path),a.load(t,function(t){var n=r.parse(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:Ba,o.wrapT=void 0!==n.wrapT?n.wrapT:Ba,o.magFilter=void 0!==n.magFilter?n.magFilter:Wa,o.minFilter=void 0!==n.minFilter?n.minFilter:qa,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps),1===n.mipmapCount&&(o.minFilter=Wa),o.needsUpdate=1,e&&e(o,n))},n,i),o}}),Zi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Zi,load:function(t,e,n,i){function r(){c.removeEventListener("load",r,0),c.removeEventListener("error",o,0),Ju.add(t,this),e&&e(this),a.manager.itemEnd(t)}function o(e){c.removeEventListener("load",r,0),c.removeEventListener("error",o,0),i&&i(e),a.manager.itemError(t),a.manager.itemEnd(t)}var a,s,c;return void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t),a=this,void 0!==(s=Ju.get(t))?(a.manager.itemStart(t),setTimeout(function(){e&&e(s),a.manager.itemEnd(t)},0),s):((c=document.createElementNS("http://www.w3.org/1999/xhtml","img")).addEventListener("load",r,0),c.addEventListener("error",o,0),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(c.crossOrigin=this.crossOrigin),a.manager.itemStart(t),c.src=t,c)}}),Ji.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Ji,load:function(t,e,n,i){function r(n){c.load(t[n],function(t){s.images[n]=t,6==++o&&(s.needsUpdate=1,e&&e(s))},void 0,i)}var o,a,s=new ft,c=new Zi(this.manager);for(c.setCrossOrigin(this.crossOrigin),c.setPath(this.path),o=0,a=0;a<t.length;++a)r(a);return s}}),$i.prototype=Object.assign(Object.create(Wi.prototype),{constructor:$i,load:function(t,e,n,i){var r=new o,a=new Zi(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(n){r.image=n;var i=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=i?as:ss,r.needsUpdate=1,void 0!==e&&e(r)},n,i),r}}),Object.assign(Qi.prototype,{getPoint:function(){return null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){var e,n;for(void 0===t&&(t=5),e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){var e,n;for(void 0===t&&(t=5),e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){var e,n,i,r,o;if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;for(this.needsUpdate=0,e=[],i=this.getPoint(0),o=0,e.push(0),r=1;r<=t;r++)o+=(n=this.getPoint(r/t)).distanceTo(i),e.push(o),i=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=1,this.getLengths()},getUtoTmapping:function(t,e){var n,i,r,o,a,s=this.getLengths(),c=0,l=s.length;for(n=e||t*s[l-1],i=0,r=l-1;i<=r;)if((o=s[c=Math.floor(i+(r-i)/2)]-n)<0)i=c+1;else{if(!(o>0)){r=c;break}r=c-1}return s[c=r]===n?c/(l-1):(c+(n-(a=s[c]))/(s[c+1]-a))/(l-1)},getTangent:function(t){var e,n=t-1e-4,i=t+1e-4;return n<0&&(n=0),i>1&&(i=1),e=this.getPoint(n),this.getPoint(i).clone().sub(e).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,o,a,s,c,u,h=new i,p=[],d=[],f=[],m=new i,g=new l;for(n=0;n<=t;n++)r=n/t,p[n]=this.getTangentAt(r),p[n].normalize();for(d[0]=new i,f[0]=new i,a=Number.MAX_VALUE,s=Math.abs(p[0].x),c=Math.abs(p[0].y),u=Math.abs(p[0].z),s<=a&&(a=s,h.set(1,0,0)),c<=a&&(a=c,h.set(0,1,0)),u<=a&&h.set(0,0,1),m.crossVectors(p[0],h).normalize(),d[0].crossVectors(p[0],m),f[0].crossVectors(p[0],d[0]),n=1;n<=t;n++)d[n]=d[n-1].clone(),f[n]=f[n-1].clone(),m.crossVectors(p[n-1],p[n]),m.length()>Number.EPSILON&&(m.normalize(),o=Math.acos(ic.clamp(p[n-1].dot(p[n]),-1,1)),d[n].applyMatrix4(g.makeRotationAxis(m,o))),f[n].crossVectors(p[n],d[n]);if(1==e)for(o=Math.acos(ic.clamp(d[0].dot(d[t]),-1,1)),o/=t,p[0].dot(m.crossVectors(d[0],d[t]))>0&&(o=-o),n=1;n<=t;n++)d[n].applyMatrix4(g.makeRotationAxis(p[n],o*n)),f[n].crossVectors(p[n],d[n]);return{tangents:p,normals:d,binormals:f}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Ki.prototype=Object.create(Qi.prototype),Ki.prototype.constructor=Ki,Ki.prototype.isEllipseCurve=1,Ki.prototype.getPoint=function(t,n){for(var i,r,o,a,s,c,l,u=n||new e,h=2*Math.PI,p=this.aEndAngle-this.aStartAngle,d=Math.abs(p)<Number.EPSILON;p<0;)p+=h;for(;p>h;)p-=h;return p<Number.EPSILON&&(p=d?0:h),1!=this.aClockwise||d||(p===h?p=-h:p-=h),i=this.aStartAngle+t*p,r=this.aX+this.xRadius*Math.cos(i),o=this.aY+this.yRadius*Math.sin(i),0!==this.aRotation&&(a=Math.cos(this.aRotation),s=Math.sin(this.aRotation),r=(c=r-this.aX)*a-(l=o-this.aY)*s+this.aX,o=c*s+l*a+this.aY),u.set(r,o)},Ki.prototype.copy=function(t){return Qi.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Ki.prototype.toJSON=function(){var t=Qi.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},Ki.prototype.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},tr.prototype=Object.create(Ki.prototype),tr.prototype.constructor=tr,tr.prototype.isArcCurve=1,Ku=new i,th=new er,eh=new er,nh=new er,nr.prototype=Object.create(Qi.prototype),nr.prototype.constructor=nr,nr.prototype.isCatmullRomCurve3=1,nr.prototype.getPoint=function(t,e){var n,r,o,a,s,c,l,u,h=e||new i,p=this.points,d=p.length,f=(d-(this.closed?0:1))*t,m=Math.floor(f),g=f-m;return this.closed?m+=m>0?0:(Math.floor(Math.abs(m)/d)+1)*d:0===g&&m===d-1&&(m=d-2,g=1),this.closed||m>0?n=p[(m-1)%d]:(Ku.subVectors(p[0],p[1]).add(p[0]),n=Ku),r=p[m%d],o=p[(m+1)%d],this.closed||m+2<d?a=p[(m+2)%d]:(Ku.subVectors(p[d-1],p[d-2]).add(p[d-1]),a=Ku),"centripetal"===this.curveType||"chordal"===this.curveType?(s="chordal"===this.curveType?.5:.25,c=Math.pow(n.distanceToSquared(r),s),(l=Math.pow(r.distanceToSquared(o),s))<1e-4&&(l=1),c<1e-4&&(c=l),(u=Math.pow(o.distanceToSquared(a),s))<1e-4&&(u=l),th.initNonuniformCatmullRom(n.x,r.x,o.x,a.x,c,l,u),eh.initNonuniformCatmullRom(n.y,r.y,o.y,a.y,c,l,u),nh.initNonuniformCatmullRom(n.z,r.z,o.z,a.z,c,l,u)):"catmullrom"===this.curveType&&(th.initCatmullRom(n.x,r.x,o.x,a.x,this.tension),eh.initCatmullRom(n.y,r.y,o.y,a.y,this.tension),nh.initCatmullRom(n.z,r.z,o.z,a.z,this.tension)),h.set(th.calc(g),eh.calc(g),nh.calc(g)),h},nr.prototype.copy=function(t){var e,n,i;for(Qi.prototype.copy.call(this,t),this.points=[],e=0,n=t.points.length;e<n;e++)i=t.points[e],this.points.push(i.clone());return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},nr.prototype.toJSON=function(){var t,e,n,i=Qi.prototype.toJSON.call(this);for(i.points=[],t=0,e=this.points.length;t<e;t++)n=this.points[t],i.points.push(n.toArray());return i.closed=this.closed,i.curveType=this.curveType,i.tension=this.tension,i},nr.prototype.fromJSON=function(t){var e,n,r;for(Qi.prototype.fromJSON.call(this,t),this.points=[],e=0,n=t.points.length;e<n;e++)r=t.points[e],this.points.push((new i).fromArray(r));return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},ar.prototype=Object.create(Qi.prototype),ar.prototype.constructor=ar,ar.prototype.isCubicBezierCurve=1,ar.prototype.getPoint=function(t,n){var i=n||new e,r=this.v0,o=this.v1,a=this.v2,s=this.v3;return i.set(or(t,r.x,o.x,a.x,s.x),or(t,r.y,o.y,a.y,s.y)),i},ar.prototype.copy=function(t){return Qi.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},ar.prototype.toJSON=function(){var t=Qi.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},ar.prototype.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},sr.prototype=Object.create(Qi.prototype),sr.prototype.constructor=sr,sr.prototype.isCubicBezierCurve3=1,sr.prototype.getPoint=function(t,e){var n=e||new i,r=this.v0,o=this.v1,a=this.v2,s=this.v3;return n.set(or(t,r.x,o.x,a.x,s.x),or(t,r.y,o.y,a.y,s.y),or(t,r.z,o.z,a.z,s.z)),n},sr.prototype.copy=function(t){return Qi.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},sr.prototype.toJSON=function(){var t=Qi.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},sr.prototype.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},cr.prototype=Object.create(Qi.prototype),cr.prototype.constructor=cr,cr.prototype.isLineCurve=1,cr.prototype.getPoint=function(t,n){var i=n||new e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},cr.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},cr.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},cr.prototype.copy=function(t){return Qi.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},cr.prototype.toJSON=function(){var t=Qi.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},cr.prototype.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},lr.prototype=Object.create(Qi.prototype),lr.prototype.constructor=lr,lr.prototype.isLineCurve3=1,lr.prototype.getPoint=function(t,e){var n=e||new i;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},lr.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},lr.prototype.copy=function(t){return Qi.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},lr.prototype.toJSON=function(){var t=Qi.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},lr.prototype.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},ur.prototype=Object.create(Qi.prototype),ur.prototype.constructor=ur,ur.prototype.isQuadraticBezierCurve=1,ur.prototype.getPoint=function(t,n){var i=n||new e,r=this.v0,o=this.v1,a=this.v2;return i.set(rr(t,r.x,o.x,a.x),rr(t,r.y,o.y,a.y)),i},ur.prototype.copy=function(t){return Qi.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},ur.prototype.toJSON=function(){var t=Qi.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},ur.prototype.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},hr.prototype=Object.create(Qi.prototype),hr.prototype.constructor=hr,hr.prototype.isQuadraticBezierCurve3=1,hr.prototype.getPoint=function(t,e){var n=e||new i,r=this.v0,o=this.v1,a=this.v2;return n.set(rr(t,r.x,o.x,a.x),rr(t,r.y,o.y,a.y),rr(t,r.z,o.z,a.z)),n},hr.prototype.copy=function(t){return Qi.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},hr.prototype.toJSON=function(){var t=Qi.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},hr.prototype.fromJSON=function(t){return Qi.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},pr.prototype=Object.create(Qi.prototype),pr.prototype.constructor=pr,pr.prototype.isSplineCurve=1,pr.prototype.getPoint=function(t,n){var i=n||new e,r=this.points,o=(r.length-1)*t,a=Math.floor(o),s=o-a,c=r[0===a?a:a-1],l=r[a],u=r[a>r.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return i.set(ir(s,c.x,l.x,u.x,h.x),ir(s,c.y,l.y,u.y,h.y)),i},pr.prototype.copy=function(t){var e,n,i;for(Qi.prototype.copy.call(this,t),this.points=[],e=0,n=t.points.length;e<n;e++)i=t.points[e],this.points.push(i.clone());return this},pr.prototype.toJSON=function(){var t,e,n,i=Qi.prototype.toJSON.call(this);for(i.points=[],t=0,e=this.points.length;t<e;t++)n=this.points[t],i.points.push(n.toArray());return i},pr.prototype.fromJSON=function(t){var n,i,r;for(Qi.prototype.fromJSON.call(this,t),this.points=[],n=0,i=t.points.length;n<i;n++)r=t.points[n],this.points.push((new e).fromArray(r));return this},ih=Object.freeze({ArcCurve:tr,CatmullRomCurve3:nr,CubicBezierCurve:ar,CubicBezierCurve3:sr,EllipseCurve:Ki,LineCurve:cr,LineCurve3:lr,QuadraticBezierCurve:ur,QuadraticBezierCurve3:hr,SplineCurve:pr}),dr.prototype=Object.assign(Object.create(Qi.prototype),{constructor:dr,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new cr(e,t))},getPoint:function(t){for(var e,n,i,r,o=t*this.getLength(),a=this.getCurveLengths(),s=0;s<a.length;){if(a[s]>=o)return e=a[s]-o,r=0===(i=(n=this.curves[s]).getLength())?0:1-e/i,n.getPointAt(r);s++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=1,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){var t,e,n,i;if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(t=[],e=0,n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){var e,n;for(void 0===t&&(t=40),e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){var e,n,i,r,o,a,s,c,l;for(t=t||12,e=[],i=0,r=this.curves;i<r.length;i++)for(a=(o=r[i])&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a),c=0;c<s.length;c++)l=s[c],n&&n.equals(l)||(e.push(l),n=l);return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){var e,n,i;for(Qi.prototype.copy.call(this,t),this.curves=[],e=0,n=t.curves.length;e<n;e++)i=t.curves[e],this.curves.push(i.clone());return this.autoClose=t.autoClose,this},toJSON:function(){var t,e,n,i=Qi.prototype.toJSON.call(this);for(i.autoClose=this.autoClose,i.curves=[],t=0,e=this.curves.length;t<e;t++)n=this.curves[t],i.curves.push(n.toJSON());return i},fromJSON:function(t){var e,n,i;for(Qi.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[],e=0,n=t.curves.length;e<n;e++)i=t.curves[e],this.curves.push((new ih[i.type]).fromJSON(i));return this}}),fr.prototype=Object.assign(Object.create(dr.prototype),{constructor:fr,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,n){var i=new cr(this.currentPoint.clone(),new e(t,n));this.curves.push(i),this.currentPoint.set(t,n)},quadraticCurveTo:function(t,n,i,r){var o=new ur(this.currentPoint.clone(),new e(t,n),new e(i,r));this.curves.push(o),this.currentPoint.set(i,r)},bezierCurveTo:function(t,n,i,r,o,a){var s=new ar(this.currentPoint.clone(),new e(t,n),new e(i,r),new e(o,a));this.curves.push(s),this.currentPoint.set(o,a)},splineThru:function(t){var e=new pr([this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,n,i,r,o){var a=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+a,e+s,n,i,r,o)},absarc:function(t,e,n,i,r,o){this.absellipse(t,e,n,n,i,r,o)},ellipse:function(t,e,n,i,r,o,a,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(t+c,e+l,n,i,r,o,a,s)},absellipse:function(t,e,n,i,r,o,a,s){var c,l,u=new Ki(t,e,n,i,r,o,a,s);this.curves.length>0&&((c=u.getPoint(0)).equals(this.currentPoint)||this.lineTo(c.x,c.y)),this.curves.push(u),l=u.getPoint(1),this.currentPoint.copy(l)},copy:function(t){return dr.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=dr.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return dr.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),mr.prototype=Object.assign(Object.create(fr.prototype),{constructor:mr,getPointsHoles:function(t){var e,n,i=[];for(e=0,n=this.holes.length;e<n;e++)i[e]=this.holes[e].getPoints(t);return i},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){var e,n,i;for(fr.prototype.copy.call(this,t),this.holes=[],e=0,n=t.holes.length;e<n;e++)i=t.holes[e],this.holes.push(i.clone());return this},toJSON:function(){var t,e,n,i=fr.prototype.toJSON.call(this);for(i.uuid=this.uuid,i.holes=[],t=0,e=this.holes.length;t<e;t++)n=this.holes[t],i.holes.push(n.toJSON());return i},fromJSON:function(t){var e,n,i;for(fr.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[],e=0,n=t.holes.length;e<n;e++)i=t.holes[e],this.holes.push((new fr).fromJSON(i));return this}}),gr.prototype=Object.assign(Object.create(p.prototype),{constructor:gr,isLight:1,copy:function(t){return p.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=p.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),vr.prototype=Object.assign(Object.create(gr.prototype),{constructor:vr,isHemisphereLight:1,copy:function(t){return gr.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(yr.prototype,{_projScreenMatrix:new l,_lightPositionWorld:new i,_lookTarget:new i,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){var e=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(t.matrixWorld),e.position.copy(o),r.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(r),e.updateMatrixWorld(),i.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(0).object,delete t.camera.matrix,t}}),xr.prototype=Object.assign(Object.create(yr.prototype),{constructor:xr,isSpotLightShadow:1,updateMatrices:function(t,e,n){var i=this.camera,r=2*ic.RAD2DEG*t.angle,o=this.mapSize.width/this.mapSize.height,a=t.distance||i.far;r===i.fov&&o===i.aspect&&a===i.far||(i.fov=r,i.aspect=o,i.far=a,i.updateProjectionMatrix()),yr.prototype.updateMatrices.call(this,t,e,n)}}),br.prototype=Object.assign(Object.create(gr.prototype),{constructor:br,isSpotLight:1,copy:function(t){return gr.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),_r.prototype=Object.assign(Object.create(yr.prototype),{constructor:_r,isPointLightShadow:1,updateMatrices:function(t,e,n){var i=this.camera,r=this.matrix,o=this._lightPositionWorld,a=this._lookTarget,s=this._projScreenMatrix;o.setFromMatrixPosition(t.matrixWorld),i.position.copy(o),a.copy(i.position),a.add(this._cubeDirections[n]),i.up.copy(this._cubeUps[n]),i.lookAt(a),i.updateMatrixWorld(),r.makeTranslation(-o.x,-o.y,-o.z),s.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromMatrix(s)}}),wr.prototype=Object.assign(Object.create(gr.prototype),{constructor:wr,isPointLight:1,copy:function(t){return gr.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Mr.prototype=Object.assign(Object.create(q.prototype),{constructor:Mr,isOrthographicCamera:1,copy:function(t,e){return q.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,i,r,o){null===this.view&&(this.view={enabled:1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=1,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=0),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t,e,n,i,r=(this.right-this.left)/(2*this.zoom),o=(this.top-this.bottom)/(2*this.zoom),a=(this.right+this.left)/2,s=(this.top+this.bottom)/2,c=a-r,l=a+r,u=s+o,h=s-o;null!==this.view&&this.view.enabled&&(t=this.zoom/(this.view.width/this.view.fullWidth),e=this.zoom/(this.view.height/this.view.fullHeight),n=(this.right-this.left)/this.view.width,i=(this.top-this.bottom)/this.view.height,l=(c+=n*(this.view.offsetX/t))+n*(this.view.width/t),h=(u-=i*(this.view.offsetY/e))-i*(this.view.height/e)),this.projectionMatrix.makeOrthographic(c,l,u,h,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=p.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Sr.prototype=Object.assign(Object.create(yr.prototype),{constructor:Sr,isDirectionalLightShadow:1,updateMatrices:function(t,e,n){yr.prototype.updateMatrices.call(this,t,e,n)}}),Tr.prototype=Object.assign(Object.create(gr.prototype),{constructor:Tr,isDirectionalLight:1,copy:function(t){return gr.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Ar.prototype=Object.assign(Object.create(gr.prototype),{constructor:Ar,isAmbientLight:1}),Lr.prototype=Object.assign(Object.create(gr.prototype),{constructor:Lr,isRectAreaLight:1,copy:function(t){return gr.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=gr.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}}),Cr.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Cr,load:function(t,e,n,i){var r=this,o=new Hi(r.manager);o.setPath(r.path),o.load(t,function(t){e(r.parse(JSON.parse(t)))},n,i)},parse:function(t){function n(t){return h[t],h[t]}var o,s,c,u,h=this.textures,p=new Yu[t.type];if(void 0!==t.uuid&&(p.uuid=t.uuid),void 0!==t.name&&(p.name=t.name),void 0!==t.color&&p.color.setHex(t.color),void 0!==t.roughness&&(p.roughness=t.roughness),void 0!==t.metalness&&(p.metalness=t.metalness),void 0!==t.sheen&&(p.sheen=(new x).setHex(t.sheen)),void 0!==t.emissive&&p.emissive.setHex(t.emissive),void 0!==t.specular&&p.specular.setHex(t.specular),void 0!==t.shininess&&(p.shininess=t.shininess),void 0!==t.clearcoat&&(p.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(p.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.vertexColors&&(p.vertexColors=t.vertexColors),void 0!==t.fog&&(p.fog=t.fog),void 0!==t.flatShading&&(p.flatShading=t.flatShading),void 0!==t.blending&&(p.blending=t.blending),void 0!==t.combine&&(p.combine=t.combine),void 0!==t.side&&(p.side=t.side),void 0!==t.opacity&&(p.opacity=t.opacity),void 0!==t.transparent&&(p.transparent=t.transparent),void 0!==t.alphaTest&&(p.alphaTest=t.alphaTest),void 0!==t.depthTest&&(p.depthTest=t.depthTest),void 0!==t.depthWrite&&(p.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(p.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(p.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(p.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(p.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(p.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(p.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(p.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(p.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(p.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(p.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(p.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(p.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(p.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(p.rotation=t.rotation),1!==t.linewidth&&(p.linewidth=t.linewidth),void 0!==t.dashSize&&(p.dashSize=t.dashSize),void 0!==t.gapSize&&(p.gapSize=t.gapSize),void 0!==t.scale&&(p.scale=t.scale),void 0!==t.polygonOffset&&(p.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(p.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(p.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(p.skinning=t.skinning),void 0!==t.morphTargets&&(p.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(p.morphNormals=t.morphNormals),void 0!==t.dithering&&(p.dithering=t.dithering),void 0!==t.visible&&(p.visible=t.visible),void 0!==t.toneMapped&&(p.toneMapped=t.toneMapped),void 0!==t.userData&&(p.userData=t.userData),void 0!==t.uniforms)for(o in t.uniforms)switch(s=t.uniforms[o],p.uniforms[o]={},s.type){case"t":p.uniforms[o].value=n(s.value);break;case"c":p.uniforms[o].value=(new x).setHex(s.value);break;case"v2":p.uniforms[o].value=(new e).fromArray(s.value);break;case"v3":p.uniforms[o].value=(new i).fromArray(s.value);break;case"v4":p.uniforms[o].value=(new a).fromArray(s.value);break;case"m3":p.uniforms[o].value=(new r).fromArray(s.value);case"m4":p.uniforms[o].value=(new l).fromArray(s.value);break;default:p.uniforms[o].value=s.value}if(void 0!==t.defines&&(p.defines=t.defines),void 0!==t.vertexShader&&(p.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(p.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(c in t.extensions)p.extensions[c]=t.extensions[c];return void 0!==t.shading&&(p.flatShading=1===t.shading),void 0!==t.size&&(p.size=t.size),void 0!==t.sizeAttenuation&&(p.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(p.map=n(t.map)),void 0!==t.matcap&&(p.matcap=n(t.matcap)),void 0!==t.alphaMap&&(p.alphaMap=n(t.alphaMap),p.transparent=1),void 0!==t.bumpMap&&(p.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(p.bumpScale=t.bumpScale),void 0!==t.normalMap&&(p.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(p.normalMapType=t.normalMapType),void 0!==t.normalScale&&(u=t.normalScale,0==Array.isArray(u)&&(u=[u,u]),p.normalScale=(new e).fromArray(u)),void 0!==t.displacementMap&&(p.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(p.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(p.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(p.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(p.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(p.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(p.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(p.specularMap=n(t.specularMap)),void 0!==t.envMap&&(p.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(p.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(p.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(p.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(p.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(p.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(p.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(p.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(p.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatNormalMap&&(p.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(p.clearcoatNormalScale=(new e).fromArray(t.clearcoatNormalScale)),p},setTextures:function(t){return this.textures=t,this}}),rh=function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)},Pr.prototype=Object.assign(Object.create(k.prototype),{constructor:Pr,isInstancedBufferGeometry:1,copy:function(t){return k.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t=k.prototype.toJSON.call(this);return t.maxInstancedCount=this.maxInstancedCount,t.isInstancedBufferGeometry=1,t}}),Er.prototype=Object.assign(Object.create(A.prototype),{constructor:Er,isInstancedBufferAttribute:1,copy:function(t){return A.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){var t=A.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=1,t}}),Nr.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Nr,load:function(t,e,n,i){var r=this,o=new Hi(r.manager);o.setPath(r.path),o.load(t,function(t){e(r.parse(JSON.parse(t)))},n,i)},parse:function(t){var e,n,r,o,a,s,c,l,u,h,p,d,f,m,v,y=t.isInstancedBufferGeometry?new Pr:new k,x=t.data.index;for(r in void 0!==x&&(e=new oh[x.type](x.array),y.setIndex(new A(e,1))),n=t.data.attributes)o=n[r],e=new oh[o.type](o.array),a=new(o.isInstancedBufferAttribute?Er:A)(e,o.itemSize,o.normalized),void 0!==o.name&&(a.name=o.name),y.addAttribute(r,a);if(s=t.data.morphAttributes)for(r in s){for(l=[],u=0,h=(c=s[r]).length;u<h;u++)o=c[u],a=new A(e=new oh[o.type](o.array),o.itemSize,o.normalized),void 0!==o.name&&(a.name=o.name),l.push(a);y.morphAttributes[r]=l}if(void 0!==(p=t.data.groups||t.data.drawcalls||t.data.offsets))for(u=0,d=p.length;u!==d;++u)f=p[u],y.addGroup(f.start,f.count,f.materialIndex);return void 0!==(m=t.data.boundingSphere)&&(v=new i,void 0!==m.center&&v.fromArray(m.center),y.boundingSphere=new g(v,m.radius)),t.name&&(y.name=t.name),t.userData&&(y.userData=t.userData),y}}),oh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},Or.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Or,load:function(t,e,n,i){var r,o=this,a=""===this.path?rh(t):this.path;this.resourcePath=this.resourcePath||a,(r=new Hi(o.manager)).setPath(this.path),r.load(t,function(t){var n,r=null;try{r=JSON.parse(t)}catch(t){return void(void 0!==i&&i(t))}void 0!==(n=r.metadata)&&void 0!==n.type&&"geometry"!==n.type.toLowerCase()&&o.parse(r,e)},n,i)},parse:function(t,e){var n=this.parseShape(t.shapes),i=this.parseGeometries(t.geometries,n),r=this.parseImages(t.images,function(){void 0!==e&&e(s)}),o=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,o),s=this.parseObject(t.object,i,a);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e,n,i,r={};if(void 0!==t)for(e=0,n=t.length;e<n;e++)r[(i=(new mr).fromJSON(t[e])).uuid]=i;return r},parseGeometries:function(t,e){var n,i,r,o,a,s,c,l,u,h,p={};if(void 0!==t)for(n=new Nr,i=0,r=t.length;i<r;i++){switch((a=t[i]).type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Xu[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Xu[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Xu[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Xu[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Xu[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Xu[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Xu[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Xu[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Xu[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Xu[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Xu[a.type]((new ih[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Xu[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Xu[a.type](a.vertices,a.indices,a.radius,a.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(s=[],c=0,l=a.shapes.length;c<l;c++)u=e[a.shapes[c]],s.push(u);o=new Xu[a.type](s,a.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(s=[],c=0,l=a.shapes.length;c<l;c++)u=e[a.shapes[c]],s.push(u);void 0!==(h=a.options.extrudePath)&&(a.options.extrudePath=(new ih[h.type]).fromJSON(h)),o=new Xu[a.type](s,a.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=n.parse(a);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE&&(o=(new THREE.LegacyJSONLoader).parse(a,this.resourcePath).geometry);break;default:continue}o.uuid=a.uuid,void 0!==a.name&&(o.name=a.name),1==o.isBufferGeometry&&void 0!==a.userData&&(o.userData=a.userData),p[a.uuid]=o}return p},parseMaterials:function(t,e){var n,i,r,o,a,s,c,l={},u={};if(void 0!==t)for((n=new Cr).setTextures(e),i=0,r=t.length;i<r;i++)if("MultiMaterial"===(o=t[i]).type){for(a=[],s=0;s<o.materials.length;s++)void 0===l[(c=o.materials[s]).uuid]&&(l[c.uuid]=n.parse(c)),a.push(l[c.uuid]);u[o.uuid]=a}else void 0===l[o.uuid]&&(l[o.uuid]=n.parse(o)),u[o.uuid]=l[o.uuid];return u},parseAnimations:function(t){var e,n,i,r=[];for(e=0;e<t.length;e++)n=t[e],i=ji.parse(n),void 0!==n.uuid&&(i.uuid=n.uuid),r.push(i);return r},parseImages:function(t,e){function n(t){return d.manager.itemStart(t),r.load(t,function(){d.manager.itemEnd(t)},void 0,function(){d.manager.itemError(t),d.manager.itemEnd(t)})}var i,r,o,a,s,c,l,u,h,p,d=this,f={};if(void 0!==t&&t.length>0)for(i=new Gi(e),(r=new Zi(i)).setCrossOrigin(this.crossOrigin),o=0,a=t.length;o<a;o++)if(c=(s=t[o]).url,Array.isArray(c))for(f[s.uuid]=[],l=0,u=c.length;l<u;l++)h=c[l],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:d.resourcePath+h,f[s.uuid].push(n(p));else p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:d.resourcePath+s.url,f[s.uuid]=n(p);return f},parseTextures:function(t,e){function n(t,e){return"number"==typeof t?t:e[t]}var i,r,a,s,c={};if(void 0!==t)for(i=0,r=t.length;i<r;i++)(a=t[i]).image,e[a.image],(s=Array.isArray(e[a.image])?new ft(e[a.image]):new o(e[a.image])).needsUpdate=1,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=n(a.mapping,ah)),void 0!==a.offset&&s.offset.fromArray(a.offset),void 0!==a.repeat&&s.repeat.fromArray(a.repeat),void 0!==a.center&&s.center.fromArray(a.center),void 0!==a.rotation&&(s.rotation=a.rotation),void 0!==a.wrap&&(s.wrapS=n(a.wrap[0],sh),s.wrapT=n(a.wrap[1],sh)),void 0!==a.format&&(s.format=a.format),void 0!==a.type&&(s.type=a.type),void 0!==a.encoding&&(s.encoding=a.encoding),void 0!==a.minFilter&&(s.minFilter=n(a.minFilter,ch)),void 0!==a.magFilter&&(s.magFilter=n(a.magFilter,ch)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),void 0!==a.flipY&&(s.flipY=a.flipY),void 0!==a.premultiplyAlpha&&(s.premultiplyAlpha=a.premultiplyAlpha),void 0!==a.unpackAlignment&&(s.unpackAlignment=a.unpackAlignment),c[a.uuid]=s;return c},parseObject:function(t,e,n){function i(t){return e[t],e[t]}function r(t){var e,i,r,o;if(void 0!==t){if(Array.isArray(t)){for(e=[],i=0,r=t.length;i<r;i++)o=t[i],n[o],e.push(n[o]);return e}return n[t],n[t]}}var o,a,s,c,l,u,h,f,m;switch(t.type){case"Scene":o=new d,void 0!==t.background&&Number.isInteger(t.background)&&(o.background=new x(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new je(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new Ue(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new X(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new Mr(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"AmbientLight":o=new Ar(t.color,t.intensity);break;case"DirectionalLight":o=new Tr(t.color,t.intensity);break;case"PointLight":o=new wr(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":o=new Lr(t.color,t.intensity,t.width,t.height);break;case"SpotLight":o=new br(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new vr(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":case"Mesh":a=i(t.geometry),s=r(t.material),o=a.bones&&a.bones.length>0?new Ye(a,s):new B(a,s),void 0!==t.drawMode&&o.setDrawMode(t.drawMode);break;case"LOD":o=new Xe;break;case"Line":o=new Ke(i(t.geometry),r(t.material),t.mode);break;case"LineLoop":o=new en(i(t.geometry),r(t.material));break;case"LineSegments":o=new tn(i(t.geometry),r(t.material));break;case"PointCloud":case"Points":o=new rn(i(t.geometry),r(t.material));break;case"Sprite":o=new He(r(t.material));break;case"Group":o=new Ie;break;default:o=new p}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.layers&&(o.layers.mask=t.layers),void 0!==t.children)for(c=t.children,l=0;l<c.length;l++)o.add(this.parseObject(c[l],e,n));if("LOD"===t.type)for(u=t.levels,h=0;h<u.length;h++)f=u[h],void 0!==(m=o.getObjectByProperty("uuid",f.object))&&o.addLevel(m,f.distance);return o}}),ah={UVMapping:300,CubeReflectionMapping:Na,CubeRefractionMapping:Oa,EquirectangularReflectionMapping:Da,EquirectangularRefractionMapping:Ia,SphericalReflectionMapping:za,CubeUVReflectionMapping:Ra,CubeUVRefractionMapping:Fa},sh={RepeatWrapping:ka,ClampToEdgeWrapping:Ba,MirroredRepeatWrapping:Ua},ch={NearestFilter:ja,NearestMipmapNearestFilter:Va,NearestMipmapLinearFilter:Ga,LinearFilter:Wa,LinearMipmapNearestFilter:Ha,LinearMipmapLinearFilter:qa},Dr.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Dr,setOptions:function(t){return this.options=t,this},load:function(t,e,n,i){var r,o;if(void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t),r=this,void 0!==(o=Ju.get(t)))return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;fetch(t).then(function(t){return t.blob()}).then(function(t){return void 0===r.options?createImageBitmap(t):createImageBitmap(t,r.options)}).then(function(n){Ju.add(t,n),e&&e(n),r.manager.itemEnd(t)}).catch(function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}),r.manager.itemStart(t)}}),Object.assign(Ir.prototype,{moveTo:function(t,e){this.currentPath=new fr,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,n,i){this.currentPath.quadraticCurveTo(t,e,n,i)},bezierCurveTo:function(t,e,n,i,r,o){this.currentPath.bezierCurveTo(t,e,n,i,r,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function n(t){var e,n,i,r,o=[];for(e=0,n=t.length;e<n;e++)i=t[e],(r=new mr).curves=i.curves,o.push(r);return o}function i(t,e){var n,i,r,o,a,s,c,l=e.length,u=0;for(n=l-1,i=0;i<l;n=i++)if(r=e[n],a=(o=e[i]).x-r.x,s=o.y-r.y,Math.abs(s)>Number.EPSILON){if(s<0&&(r=e[i],a=-a,o=e[n],s=-s),t.y<r.y||t.y>o.y)continue;if(t.y===r.y){if(t.x===r.x)return 1}else{if(0==(c=s*(t.x-r.x)-a*(t.y-r.y)))return 1;if(c<0)continue;u=!u}}else{if(t.y!==r.y)continue;if(o.x<=t.x&&t.x<=r.x||r.x<=t.x&&t.x<=o.x)return 1}return u}var r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A,L,C,P=Hu.isClockWise,E=this.subPaths;if(0===E.length)return[];if(1==e)return n(E);if(s=[],1===E.length)return o=E[0],(a=new mr).curves=o.curves,s.push(a),s;for(c=!P(E[0].getPoints()),c=t?!c:c,l=[],h=[],(u=[])[p=0]=void 0,h[p]=[],f=0,m=E.length;f<m;f++)r=P(d=(o=E[f]).getPoints()),(r=t?!r:r)?(!c&&u[p]&&p++,u[p]={s:new mr,p:d},u[p].s.curves=o.curves,c&&p++,h[p]=[]):h[p].push({h:o,p:d[0]});if(!u[0])return n(E);if(u.length>1){for(g=0,v=[],y=0,x=u.length;y<x;y++)l[y]=[];for(y=0,x=u.length;y<x;y++)for(b=h[y],_=0;_<b.length;_++){for(w=b[_],M=1,S=0;S<u.length;S++)i(w.p,u[S].p)&&(y!==S&&v.push({froms:y,tos:S,hole:_}),M?(M=0,l[S].push(w)):g=1);M&&l[y].push(w)}v.length>0&&(g||(h=l))}for(f=0,A=u.length;f<A;f++)for(a=u[f].s,s.push(a),L=0,C=(T=h[f]).length;L<C;L++)a.holes.push(T[L].h);return s}}),Object.assign(zr.prototype,{isFont:1,generateShapes:function(t,e){var n,i,r,o;for(void 0===e&&(e=100),n=[],r=0,o=(i=function(t,e,n){var i,r,o,a=Array.from?Array.from(t):(t+"").split(""),s=e/n.resolution,c=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*s,l=[],u=0,h=0;for(i=0;i<a.length;i++)"\n"===(r=a[i])?(u=0,h-=c):(u+=(o=Rr(r,s,u,h,n)).offsetX,l.push(o.path));return l}(t,e,this.data)).length;r<o;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}),Fr.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Fr,load:function(t,e,n,i){var r=this,o=new Hi(this.manager);o.setPath(this.path),o.load(t,function(t){var n,i;try{n=JSON.parse(t)}catch(e){n=JSON.parse(t.substring(65,t.length-2))}i=r.parse(n),e&&e(i)},n,i)},parse:function(t){return new zr(t)}}),uh={getContext:function(){return void 0===lh&&(lh=new(window.AudioContext||window.webkitAudioContext)),lh},setContext:function(t){lh=t}},kr.prototype=Object.assign(Object.create(Wi.prototype),{constructor:kr,load:function(t,e,n,i){var r=new Hi(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.load(t,function(t){var n=t.slice(0);uh.getContext().decodeAudioData(n,function(t){e(t)})},n,i)}}),Object.assign(Br.prototype,{isSphericalHarmonics3:1,set:function(t){for(var e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this},zero:function(){for(var t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this},getAt:function(t,e){var n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScale(o[1],.488603*i),e.addScale(o[2],.488603*r),e.addScale(o[3],.488603*n),e.addScale(o[4],n*i*1.092548),e.addScale(o[5],i*r*1.092548),e.addScale(o[6],.315392*(3*r*r-1)),e.addScale(o[7],n*r*1.092548),e.addScale(o[8],.546274*(n*n-i*i)),e},getIrradianceAt:function(t,e){var n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScale(o[1],1.023328*i),e.addScale(o[2],1.023328*r),e.addScale(o[3],1.023328*n),e.addScale(o[4],.858086*n*i),e.addScale(o[5],.858086*i*r),e.addScale(o[6],.743125*r*r-.247708),e.addScale(o[7],.858086*n*r),e.addScale(o[8],.429043*(n*n-i*i)),e},add:function(t){for(var e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this},scale:function(t){for(var e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this},lerp:function(t,e){for(var n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this},equals:function(t){for(var e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return 0;return 1},copy:function(t){return this.set(t.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(t,e){var n,i;for(void 0===e&&(e=0),n=this.coefficients,i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this},toArray:function(t,e){var n,i;for(void 0===t&&(t=[]),void 0===e&&(e=0),n=this.coefficients,i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}}),Object.assign(Br,{getBasisAt:function(t,e){var n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}),Ur.prototype=Object.assign(Object.create(gr.prototype),{constructor:Ur,isLightProbe:1,copy:function(t){return gr.prototype.copy.call(this,t),this.sh.copy(t.sh),this.intensity=t.intensity,this},toJSON:function(t){return gr.prototype.toJSON.call(this,t)}}),jr.prototype=Object.assign(Object.create(Ur.prototype),{constructor:jr,isHemisphereLightProbe:1,copy:function(t){return Ur.prototype.copy.call(this,t),this},toJSON:function(t){return Ur.prototype.toJSON.call(this,t)}}),Vr.prototype=Object.assign(Object.create(Ur.prototype),{constructor:Vr,isAmbientLightProbe:1,copy:function(t){return Ur.prototype.copy.call(this,t),this},toJSON:function(t){return Ur.prototype.toJSON.call(this,t)}}),hh=new l,ph=new l,Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new X,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=0,this.cameraR=new X,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=0,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(t){var e,n,i,r,o,a,s=this._cache;(s.focus!==t.focus||s.fov!==t.fov||s.aspect!==t.aspect*this.aspect||s.near!==t.near||s.far!==t.far||s.zoom!==t.zoom||s.eyeSep!==this.eyeSep)&&(s.focus=t.focus,s.fov=t.fov,s.aspect=t.aspect*this.aspect,s.near=t.near,s.far=t.far,s.zoom=t.zoom,s.eyeSep=this.eyeSep,e=t.projectionMatrix.clone(),i=(n=s.eyeSep/2)*s.near/s.focus,r=s.near*Math.tan(ic.DEG2RAD*s.fov*.5)/s.zoom,ph.elements[12]=-n,hh.elements[12]=n,o=-r*s.aspect+i,a=r*s.aspect+i,e.elements[0]=2*s.near/(a-o),e.elements[8]=(a+o)/(a-o),this.cameraL.projectionMatrix.copy(e),o=-r*s.aspect-i,a=r*s.aspect-i,e.elements[0]=2*s.near/(a-o),e.elements[8]=(a+o)/(a-o),this.cameraR.projectionMatrix.copy(e)),this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(ph),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(hh)}}),Object.assign(Gr.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=1},stop:function(){this.getElapsedTime(),this.running=0,this.autoStart=0},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t,e=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(e=((t=("undefined"==typeof performance?Date:performance).now())-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e),e)}}),dh=new i,fh=new n,mh=new i,gh=new i,Wr.prototype=Object.assign(Object.create(p.prototype),{constructor:Wr,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},updateMatrixWorld:function(t){var e,n,i;p.prototype.updateMatrixWorld.call(this,t),e=this.context.listener,n=this.up,this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(dh,fh,mh),gh.set(0,0,-1).applyQuaternion(fh),e.positionX?(i=this.context.currentTime+this.timeDelta,e.positionX.linearRampToValueAtTime(dh.x,i),e.positionY.linearRampToValueAtTime(dh.y,i),e.positionZ.linearRampToValueAtTime(dh.z,i),e.forwardX.linearRampToValueAtTime(gh.x,i),e.forwardY.linearRampToValueAtTime(gh.y,i),e.forwardZ.linearRampToValueAtTime(gh.z,i),e.upX.linearRampToValueAtTime(n.x,i),e.upY.linearRampToValueAtTime(n.y,i),e.upZ.linearRampToValueAtTime(n.z,i)):(e.setPosition(dh.x,dh.y,dh.z),e.setOrientation(gh.x,gh.y,gh.z,n.x,n.y,n.z))}}),Hr.prototype=Object.assign(Object.create(p.prototype),{constructor:Hr,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=0,this.sourceType="audioNode",this.source=t,this.connect(),this},setMediaElementSource:function(t){return this.hasPlaybackControl=0,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},setMediaStreamSource:function(t){return this.hasPlaybackControl=0,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(1!=this.isPlaying&&0!=this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),this.startTime=this.context.currentTime,t.start(this.startTime,this.offset,this.duration),this.isPlaying=1,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}},pause:function(){if(0!=this.hasPlaybackControl)return 1==this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=0),this},stop:function(){if(0!=this.hasPlaybackControl)return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=0,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),1==this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},setDetune:function(t){if(this.detune=t,void 0!==this.source.detune)return 1==this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(0!=this.hasPlaybackControl)return this.playbackRate=t,1==this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=0},getLoop:function(){return 0==this.hasPlaybackControl?0:this.loop},setLoop:function(t){if(0!=this.hasPlaybackControl)return this.loop=t,1==this.isPlaying&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}),vh=new i,yh=new n,xh=new i,bh=new i,qr.prototype=Object.assign(Object.create(Hr.prototype),{constructor:qr,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){return this.panner.refDistance=t,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){return this.panner.rolloffFactor=t,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){return this.panner.distanceModel=t,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){return this.panner.maxDistance=t,this},setDirectionalCone:function(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(t){var e,n;p.prototype.updateMatrixWorld.call(this,t),1==this.hasPlaybackControl&&0==this.isPlaying||(this.matrixWorld.decompose(vh,yh,xh),bh.set(0,0,1).applyQuaternion(yh),(e=this.panner).positionX?(n=this.context.currentTime+this.listener.timeDelta,e.positionX.linearRampToValueAtTime(vh.x,n),e.positionY.linearRampToValueAtTime(vh.y,n),e.positionZ.linearRampToValueAtTime(vh.z,n),e.orientationX.linearRampToValueAtTime(bh.x,n),e.orientationY.linearRampToValueAtTime(bh.y,n),e.orientationZ.linearRampToValueAtTime(bh.z,n)):(e.setPosition(vh.x,vh.y,vh.z),e.setOrientation(bh.x,bh.y,bh.z)))}}),Object.assign(Xr.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){var t,e=0,n=this.getFrequencyData();for(t=0;t<n.length;t++)e+=n[t];return e/n.length}}),Object.assign(Yr.prototype,{accumulate:function(t,e){var n,i,r=this.buffer,o=this.valueSize,a=t*o+o,s=this.cumulativeWeight;if(0===s){for(n=0;n!==o;++n)r[a+n]=r[n];s=e}else i=e/(s+=e),this._mixBufferRegion(r,a,0,i,o);this.cumulativeWeight=s},apply:function(t){var e,n,i,r=this.valueSize,o=this.buffer,a=t*r+r,s=this.cumulativeWeight,c=this.binding;for(this.cumulativeWeight=0,s<1&&(e=3*r,this._mixBufferRegion(o,a,e,1-s,r)),n=r,i=r+r;n!==i;++n)if(o[n]!==o[n+r]){c.setValue(o,a);break}},saveOriginalState:function(){var t,e,n=this.binding,i=this.buffer,r=this.valueSize,o=3*r;for(n.getValue(i,o),t=r,e=o;t!==e;++t)i[t]=i[o+t%r];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,n,i,r){if(i>=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,i,r){n.slerpFlat(t,e,t,e,t,i,r)},_lerp:function(t,e,n,i,r){var o,a,s=1-i;for(o=0;o!==r;++o)t[a=e+o]=t[a]*s+t[n+o]*i}}),_h=RegExp("["+"\\[\\]\\.:\\/"+"]","g"),wh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Mh=/(WCOD+)?/.source.replace("WCOD","[^\\[\\]:\\/]"),Sh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Th=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ah=RegExp("^"+wh+Mh+Sh+Th+"$"),Lh=["material","materials","bones"],Object.assign(Zr.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){var n,i,r=this._bindings;for(n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(t,e)},bind:function(){var t,e,n=this._bindings;for(t=this._targetGroup.nCachedObjects_,e=n.length;t!==e;++t)n[t].bind()},unbind:function(){var t,e,n=this._bindings;for(t=this._targetGroup.nCachedObjects_,e=n.length;t!==e;++t)n[t].unbind()}}),Object.assign(Jr,{Composite:Zr,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Jr.Composite(t,e,n):new Jr(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(_h,"")},parseTrackName:function(t){var e,n,i,r=Ah.exec(t);if(!r)throw Error("PropertyBinding: Cannot parse trackName: "+t);if(void 0!==(n=(e={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]}).nodeName&&e.nodeName.lastIndexOf("."))&&-1!==n&&(i=e.nodeName.substring(n+1),-1!==Lh.indexOf(i)&&(e.nodeName=e.nodeName.substring(0,n),e.objectName=i)),null===e.propertyName||0===e.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return e},findNode:function(t,e){var n,i,r;return e&&""!==e&&"root"!==e&&"."!==e&&-1!==e&&e!==t.name&&e!==t.uuid?t.skeleton&&void 0!==(n=t.skeleton.getBoneByName(e))?n:t.children&&(r=(i=function(t){var n,r,o;for(n=0;n<t.length;n++){if((r=t[n]).name===e||r.uuid===e)return r;if(o=i(r.children))return o}return null})(t.children))?r:null:t}}),Object.assign(Jr.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(t,e){t[e]=this.node[this.propertyName]},function(t,e){var n,i,r=this.resolvedProperty;for(n=0,i=r.length;n!==i;++n)t[e++]=r[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=1},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=1}],[function(t,e){var n,i,r=this.resolvedProperty;for(n=0,i=r.length;n!==i;++n)r[n]=t[e++]},function(t,e){var n,i,r=this.resolvedProperty;for(n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.needsUpdate=1},function(t,e){var n,i,r=this.resolvedProperty;for(n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=1}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=1},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=1}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=1},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=1}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t,e,n,i,r,o=this.node,a=this.parsedPath,s=a.objectName,c=a.propertyName,l=a.propertyIndex;if(o||(o=Jr.findNode(this.rootNode,a.nodeName)||this.rootNode,this.node=o),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,o){if(s){switch(t=a.objectIndex,s){case"materials":if(!o.material)return;if(!o.material.materials)return;o=o.material.materials;break;case"bones":if(!o.skeleton)return;for(o=o.skeleton.bones,e=0;e<o.length;e++)if(o[e].name===t){t=e;break}break;default:if(void 0===o[s])return;o=o[s]}if(void 0!==t){if(void 0===o[t])return;o=o[t]}}if(void 0!==(n=o[c])){if(i=this.Versioning.None,this.targetObject=o,void 0!==o.needsUpdate?i=this.Versioning.NeedsUpdate:void 0!==o.matrixWorldNeedsUpdate&&(i=this.Versioning.MatrixWorldNeedsUpdate),r=this.BindingType.Direct,void 0!==l){if("morphTargetInfluences"===c){if(!o.geometry)return;if(o.geometry.isBufferGeometry){if(!o.geometry.morphAttributes)return;for(e=0;e<this.node.geometry.morphAttributes.position.length;e++)if(o.geometry.morphAttributes.position[e].name===l){l=e;break}}else{if(!o.geometry.morphTargets)return;for(e=0;e<this.node.geometry.morphTargets.length;e++)if(o.geometry.morphTargets[e].name===l){l=e;break}}}r=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=l}else void 0!==n.fromArray&&void 0!==n.toArray?(r=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(r=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=c;this.getValue=this.GetterByBindingType[r],this.setValue=this.SetterByBindingTypeAndVersioning[r][i]}else a.nodeName}},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Jr.prototype,{_getValue_unbound:Jr.prototype.getValue,_setValue_unbound:Jr.prototype.setValue}),Object.assign(function(){var t,e,n,i;for(this.uuid=ic.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0,t={},this._indicesByUUID=t,e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={},i=this,this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}.prototype,{isAnimationObjectGroup:1,add:function(){var t,e,n,i,r,o,a,s,c,l,u,h,p=this._objects,d=p.length,f=this.nCachedObjects_,m=this._indicesByUUID,g=this._paths,v=this._parsedPaths,y=this._bindings,x=y.length;for(t=0,e=arguments.length;t!==e;++t)if(void 0===(r=m[i=(n=arguments[t]).uuid]))for(r=d++,m[i]=r,p.push(n),o=0,a=x;o!==a;++o)y[o].push(new Jr(n,g[o],v[o]));else if(r<f)for(p[r],m[(c=p[s=--f]).uuid]=r,p[r]=c,m[i]=s,p[s]=n,o=0,a=x;o!==a;++o)u=(l=y[o])[s],h=l[r],l[r]=u,void 0===h&&(h=new Jr(n,g[o],v[o])),l[s]=h;else p[r];this.nCachedObjects_=f},remove:function(){var t,e,n,i,r,o,a,s,c,l,u,h,p=this._objects,d=this.nCachedObjects_,f=this._indicesByUUID,m=this._bindings,g=m.length;for(t=0,e=arguments.length;t!==e;++t)if(void 0!==(r=f[i=(n=arguments[t]).uuid])&&r>=d)for(f[(a=p[o=d++]).uuid]=r,p[r]=a,f[i]=o,p[o]=n,s=0,c=g;s!==c;++s)u=(l=m[s])[o],h=l[r],l[r]=u,l[o]=h;this.nCachedObjects_=d},uncache:function(){var t,e,n,i,r,o,a,s,c,l,u,h,p,d=this._objects,f=d.length,m=this.nCachedObjects_,g=this._indicesByUUID,v=this._bindings,y=v.length;for(t=0,e=arguments.length;t!==e;++t)if(void 0!==(i=g[n=arguments[t].uuid]))if(delete g[n],i<m)for(o=d[r=--m],s=d[a=--f],g[o.uuid]=i,d[i]=o,g[s.uuid]=r,d[r]=s,d.pop(),c=0,l=y;c!==l;++c)h=(u=v[c])[r],p=u[a],u[i]=h,u[r]=p,u.pop();else for(g[(s=d[a=--f]).uuid]=i,d[i]=s,d.pop(),c=0,l=y;c!==l;++c)(u=v[c])[i]=u[a],u.pop();this.nCachedObjects_=m},subscribe_:function(t,e){var n,i,r,o,a,s,c,l,u,h=this._bindingsIndicesByPath,p=h[t],d=this._bindings;if(void 0!==p)return d[p];for(n=this._paths,i=this._parsedPaths,o=(r=this._objects).length,a=this.nCachedObjects_,s=Array(o),p=d.length,h[t]=p,n.push(t),i.push(e),d.push(s),c=a,l=r.length;c!==l;++c)u=r[c],s[c]=new Jr(u,t,e);return s},unsubscribe_:function(t){var e,n,i,r,o,a=this._bindingsIndicesByPath,s=a[t];void 0!==s&&(e=this._paths,n=this._parsedPaths,o=(i=this._bindings)[r=i.length-1],a[t[r]]=s,i[s]=o,i.pop(),n[s]=n[r],n.pop(),e[s]=e[r],e.pop())}}),Object.assign($r.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=0,this.enabled=1,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var i=this._clip.duration,r=t._clip.duration,o=r/i,a=i/r;t.warp(1,o,e),this.warp(a,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,n){var i,r,o=this._mixer,a=o.time,s=this._timeScaleInterpolant,c=this.timeScale;return null===s&&(s=o._lendControlInterpolant(),this._timeScaleInterpolant=s),i=s.parameterPositions,r=s.sampleValues,i[0]=a,i[1]=a+n,r[0]=t/c,r[1]=e/c,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,n,i){var r,o,a,s,c,l,u,h;if(this.enabled){if(null!==(r=this._startTime)){if((o=(t-r)*n)<0||0===n)return;this._startTime=null,e=n*o}if(e*=this._updateTimeScale(t),a=this._updateTime(e),(s=this._updateWeight(t))>0)for(c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e,n,i=0;return this.enabled&&(i=this.weight,null!==(e=this._weightInterpolant)&&(i*=n=e.evaluate(t)[0],t>e.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=0)))),this._effectiveWeight=i,i},_updateTimeScale:function(t){var e,n=0;return this.paused||(n=this.timeScale,null!==(e=this._timeScaleInterpolant)&&(n*=e.evaluate(t)[0],t>e.parameterPositions[1]&&(this.stopWarping(),0===n?this.paused=1:this.timeScale=n))),this._effectiveTimeScale=n,n},_updateTime:function(t){var e,n,i,r=this.time+t,o=this._clip.duration,a=this.loop,s=this._loopCount,c=2202===a;if(0===t)return-1===s?r:c&&1==(1&s)?o-r:r;if(2200===a){-1===s&&(this._loopCount=0,this._setEndings(1,1,0));t:{if(r>=o)r=o;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=1:this.enabled=0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else if(-1===s&&(t>=0?(s=0,this._setEndings(1,0===this.repetitions,c)):this._setEndings(0===this.repetitions,1,c)),r>=o||r<0?(r-=o*(e=Math.floor(r/o)),s+=Math.abs(e),(n=this.repetitions-s)<=0?(this.clampWhenFinished?this.paused=1:this.enabled=0,r=t>0?o:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1})):(1===n?(i=t<0,this._setEndings(i,!i,c)):this._setEndings(0,0,c),this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:e}))):this.time=r,c&&1==(1&s))return o-r;return r},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=t?this.zeroSlopeAtStart?2401:Fs:2402,i.endingEnd=e?this.zeroSlopeAtEnd?2401:Fs:2402)},_scheduleFading:function(t,e,n){var i,r,o=this._mixer,a=o.time,s=this._weightInterpolant;return null===s&&(s=o._lendControlInterpolant(),this._weightInterpolant=s),i=s.parameterPositions,r=s.sampleValues,i[0]=a,r[0]=e,i[1]=a+t,r[1]=n,this}}),Qr.prototype=Object.assign(Object.create(t.prototype),{constructor:Qr,_bindAction:function(t,e){var n,i,r,o,a,s=t._localRoot||this._root,c=t._clip.tracks,l=c.length,u=t._propertyBindings,h=t._interpolants,p=s.uuid,d=this._bindingsByRootAndName,f=d[p];for(void 0===f&&(f={},d[p]=f),n=0;n!==l;++n){if(void 0!==(o=f[r=(i=c[n]).name]))u[n]=o;else{if(void 0!==(o=u[n])){null===o._cacheIndex&&(++o.referenceCount,this._addInactiveBinding(o,p,r));continue}a=e&&e._propertyBindings[n].binding.parsedPath,++(o=new Yr(Jr.create(s,r,a),i.ValueTypeName,i.getValueSize())).referenceCount,this._addInactiveBinding(o,p,r),u[n]=o}h[n].resultBuffer=o.buffer}},_activateAction:function(t){var e,n,i,r,o,a,s;if(!this._isActiveAction(t)){for(null===t._cacheIndex&&(e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n],this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)),o=0,a=(r=t._propertyBindings).length;o!==a;++o)0==(s=r[o]).useCount++&&(this._lendBinding(s),s.saveOriginalState());this._lendAction(t)}},_deactivateAction:function(t){var e,n,i,r;if(this._isActiveAction(t)){for(n=0,i=(e=t._propertyBindings).length;n!==i;++n)0==--(r=e[n]).useCount&&(r.restoreOriginalState(),this._takeBackBinding(r));this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var i,r=this._actions,o=this._actionsByClip,a=o[e];void 0===a?(a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,o[e]=a):(i=a.knownActions,t._byClipCacheIndex=i.length,i.push(t)),t._cacheIndex=r.length,r.push(t),a.actionByRoot[n]=t},_removeInactiveAction:function(t){var e,n,i,r,o,a,s=this._actions,c=s[s.length-1],l=t._cacheIndex;c._cacheIndex=l,s[l]=c,s.pop(),t._cacheIndex=null,e=t._clip.uuid,o=(r=(i=(n=this._actionsByClip)[e]).knownActions)[r.length-1],a=t._byClipCacheIndex,o._byClipCacheIndex=a,r[a]=o,r.pop(),t._byClipCacheIndex=null,delete i.actionByRoot[(t._localRoot||this._root).uuid],0===r.length&&delete n[e],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){var e,n,i,r=t._propertyBindings;for(e=0,n=r.length;e!==n;++e)0==--(i=r[e]).referenceCount&&this._removeInactiveBinding(i)},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_addInactiveBinding:function(t,e,n){var i=this._bindingsByRootAndName,r=i[e],o=this._bindings;void 0===r&&(r={},i[e]=r),r[n]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete a[r],0===Object.keys(a).length&&delete o[i]},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new Ni(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var n,i,r=e||this._root,o=r.uuid,a="string"==typeof t?ji.findByName(r,t):t,s=null!==a?a.uuid:t,c=this._actionsByClip[s],l=null;if(void 0!==c){if(void 0!==(n=c.actionByRoot[o]))return n;l=c.knownActions[0],null===a&&(a=l._clip)}return null===a?null:(i=new $r(this,a,e),this._bindAction(i,l),this._addInactiveAction(i,s,o),i)},existingAction:function(t,e){var n=e||this._root,i=n.uuid,r="string"==typeof t?ji.findByName(n,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[i]||null},stopAllAction:function(){var t,e=this._actions,n=this._nActiveActions,i=this._bindings,r=this._nActiveBindings;for(this._nActiveActions=0,this._nActiveBindings=0,t=0;t!==n;++t)e[t].reset();for(t=0;t!==r;++t)i[t].useCount=0;return this},update:function(t){var e,n,i,r,o,a,s,c;for(t*=this.timeScale,e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a)e[a]._update(i,t,r,o);for(s=this._bindings,c=this._nActiveBindings,a=0;a!==c;++a)s[a].apply(o);return this},setTime:function(t){this.time=0;for(var e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},getRoot:function(){return this._root},uncacheClip:function(t){var e,n,i,r,o,a,s=this._actions,c=t.uuid,l=this._actionsByClip,u=l[c];if(void 0!==u){for(n=0,i=(e=u.knownActions).length;n!==i;++n)r=e[n],this._deactivateAction(r),o=r._cacheIndex,a=s[s.length-1],r._cacheIndex=null,r._byClipCacheIndex=null,a._cacheIndex=o,s[o]=a,s.pop(),this._removeInactiveBindingsForAction(r);delete l[c]}},uncacheRoot:function(t){var e,n,i,r,o,a=t.uuid,s=this._actionsByClip;for(e in s)void 0!==(n=s[e].actionByRoot[a])&&(this._deactivateAction(n),this._removeInactiveAction(n));if(void 0!==(i=this._bindingsByRootAndName[a]))for(r in i)(o=i[r]).restoreOriginalState(),this._removeInactiveBinding(o)},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),Kr.prototype.clone=function(){return new Kr(void 0===this.value.clone?this.value:this.value.clone())},to.prototype=Object.assign(Object.create(Ve.prototype),{constructor:to,isInstancedInterleavedBuffer:1,copy:function(t){return Ve.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(function(t,e,n,i){this.ray=new v(t,e),this.near=n||0,this.far=i||1/0,this.camera=null,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return this.Points}}})}.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera&&(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e)},intersectObject:function(t,e,n){var i=n||[];return no(t,this,i,e),i.sort(eo),i},intersectObjects:function(t,e,n){var i,r,o=n||[];if(0==Array.isArray(t))return o;for(i=0,r=t.length;i<r;i++)no(t[i],this,o,e);return o.sort(eo),o}}),Object.assign(function(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}.prototype,{set:function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(ic.clamp(e/this.radius,-1,1))),this}}),Object.assign(function(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}.prototype,{set:function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}}),Ch=new e,Object.assign(io.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var n=Ch.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return void 0===t&&(t=new e),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(t=new e),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y?0:1},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,n){return void 0===n&&(n=new e),n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y?0:1},clampPoint:function(t,n){return void 0===n&&(n=new e),n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return Ch.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Ph=new i,Eh=new i,Object.assign(ro.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(t=new i),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(t=new i),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(e=new i),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){var n,i;return Ph.subVectors(t,this.start),Eh.subVectors(this.end,this.start),n=Eh.dot(Eh),i=Eh.dot(Ph)/n,e&&(i=ic.clamp(i,0,1)),i},closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e);return void 0===n&&(n=new i),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),oo.prototype=Object.create(p.prototype),oo.prototype.constructor=oo,oo.prototype.isImmediateRenderObject=1,Nh=new i,Oh=new i,Dh=new r,Ih=["a","b","c"],ao.prototype=Object.create(tn.prototype),ao.prototype.constructor=ao,ao.prototype.update=function(){var t,e,n,i,r,o,a,s,c,l,u,h,p,d,f;if(this.object.updateMatrixWorld(1),Dh.getNormalMatrix(this.object.matrixWorld),t=this.object.matrixWorld,e=this.geometry.attributes.position,(n=this.object.geometry)&&n.isGeometry)for(i=n.vertices,o=0,a=0,s=(r=n.faces).length;a<s;a++)for(l=0,u=(c=r[a]).vertexNormals.length;l<u;l++)h=i[c[Ih[l]]],p=c.vertexNormals[l],Nh.copy(h).applyMatrix4(t),Oh.copy(p).applyMatrix3(Dh).normalize().multiplyScalar(this.size).add(Nh),e.setXYZ(o,Nh.x,Nh.y,Nh.z),o+=1,e.setXYZ(o,Oh.x,Oh.y,Oh.z),o+=1;else if(n&&n.isBufferGeometry)for(d=n.attributes.position,f=n.attributes.normal,o=0,l=0,u=d.count;l<u;l++)Nh.set(d.getX(l),d.getY(l),d.getZ(l)).applyMatrix4(t),Oh.set(f.getX(l),f.getY(l),f.getZ(l)),Oh.applyMatrix3(Dh).normalize().multiplyScalar(this.size).add(Nh),e.setXYZ(o,Nh.x,Nh.y,Nh.z),o+=1,e.setXYZ(o,Oh.x,Oh.y,Oh.z),o+=1;e.needsUpdate=1},zh=new i,so.prototype=Object.create(p.prototype),so.prototype.constructor=so,so.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},so.prototype.update=function(){var t,e;this.light.updateMatrixWorld(),e=(t=this.light.distance?this.light.distance:1e3)*Math.tan(this.light.angle),this.cone.scale.set(e,e,t),zh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(zh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)},Rh=new i,Fh=new l,kh=new l,co.prototype=Object.create(tn.prototype),co.prototype.constructor=co,co.prototype.updateMatrixWorld=function(t){var e,n,i,r=this.bones,o=this.geometry,a=o.getAttribute("position");for(kh.getInverse(this.root.matrixWorld),e=0,n=0;e<r.length;e++)(i=r[e]).parent&&i.parent.isBone&&(Fh.multiplyMatrices(kh,i.matrixWorld),Rh.setFromMatrixPosition(Fh),a.setXYZ(n,Rh.x,Rh.y,Rh.z),Fh.multiplyMatrices(kh,i.parent.matrixWorld),Rh.setFromMatrixPosition(Fh),a.setXYZ(n+1,Rh.x,Rh.y,Rh.z),n+=2);o.getAttribute("position").needsUpdate=1,p.prototype.updateMatrixWorld.call(this,t)},lo.prototype=Object.create(B.prototype),lo.prototype.constructor=lo,lo.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},lo.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},uo.prototype=Object.create(Ke.prototype),uo.prototype.constructor=uo,uo.prototype.update=function(){var t,e;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),t=this.material.color,(e=Math.max(t.r,t.g,t.b))>1&&t.multiplyScalar(1/e),this.children[0].material.color.copy(this.material.color))},uo.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},Bh=new i,Uh=new x,jh=new x,ho.prototype=Object.create(p.prototype),ho.prototype.constructor=ho,ho.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ho.prototype.update=function(){var t,e,n,i,r=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{for(t=r.geometry.getAttribute("color"),Uh.copy(this.light.color),jh.copy(this.light.groundColor),e=0,n=t.count;e<n;e++)i=e<n/2?Uh:jh,t.setXYZ(e,i.r,i.g,i.b);t.needsUpdate=1}r.lookAt(Bh.setFromMatrixPosition(this.light.matrixWorld).negate())},po.prototype=Object.create(B.prototype),po.prototype.constructor=po,po.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},po.prototype.onBeforeRender=function(){this.position.copy(this.lightProbe.position),this.scale.set(1,1,1).multiplyScalar(this.size),this.material.uniforms.intensity.value=this.lightProbe.intensity},fo.prototype=Object.assign(Object.create(tn.prototype),{constructor:fo,copy:function(t){return tn.prototype.copy.call(this,t),this.geometry.copy(t.geometry),this.material.copy(t.material),this},clone:function(){return(new this.constructor).copy(this)}}),mo.prototype=Object.create(tn.prototype),mo.prototype.constructor=mo,go.prototype=Object.create(Ke.prototype),go.prototype.constructor=go,go.prototype.update=function(){function t(t,i,o,a){var s=(i-t)/o;for(f.setXYZ(h,0,0,0),p++,e=t;e<i;e+=s)n=h+p,f.setXYZ(n,Math.sin(e)*r,0,Math.cos(e)*r),f.setXYZ(n+1,Math.sin(Math.min(e+s,i))*r,0,Math.cos(Math.min(e+s,i))*r),f.setXYZ(n+2,0,0,0),p+=3;d.addGroup(h,p,a),h+=p,p=0}var e,n,i=this.audio,r=this.range,o=this.divisionsInnerAngle,a=this.divisionsOuterAngle,s=ic.degToRad(i.panner.coneInnerAngle),c=ic.degToRad(i.panner.coneOuterAngle),l=s/2,u=c/2,h=0,p=0,d=this.geometry,f=d.attributes.position;d.clearGroups(),t(-u,-l,a,0),t(-l,l,o,1),t(l,u,a,0),f.needsUpdate=1,s===c&&(this.material[0].visible=0)},go.prototype.dispose=function(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()},Vh=new i,Gh=new i,Wh=new r,vo.prototype=Object.create(tn.prototype),vo.prototype.constructor=vo,vo.prototype.update=function(){var t,e,n,i,r,o,a,s,c,l;for(this.object.updateMatrixWorld(1),Wh.getNormalMatrix(this.object.matrixWorld),t=this.object.matrixWorld,e=this.geometry.attributes.position,i=(n=this.object.geometry).vertices,o=0,a=0,s=(r=n.faces).length;a<s;a++)l=(c=r[a]).normal,Vh.copy(i[c.a]).add(i[c.b]).add(i[c.c]).divideScalar(3).applyMatrix4(t),Gh.copy(l).applyMatrix3(Wh).normalize().multiplyScalar(this.size).add(Vh),e.setXYZ(o,Vh.x,Vh.y,Vh.z),o+=1,e.setXYZ(o,Gh.x,Gh.y,Gh.z),o+=1;e.needsUpdate=1},Hh=new i,qh=new i,Xh=new i,yo.prototype=Object.create(p.prototype),yo.prototype.constructor=yo,yo.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},yo.prototype.update=function(){Hh.setFromMatrixPosition(this.light.matrixWorld),qh.setFromMatrixPosition(this.light.target.matrixWorld),Xh.subVectors(qh,Hh),this.lightPlane.lookAt(qh),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(qh),this.targetLine.scale.z=Xh.length()},Yh=new i,Zh=new q,xo.prototype=Object.create(tn.prototype),xo.prototype.constructor=xo,xo.prototype.update=function(){var t=this.geometry,e=this.pointMap;Zh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),bo("c",e,t,Zh,0,0,-1),bo("t",e,t,Zh,0,0,1),bo("n1",e,t,Zh,-1,-1,-1),bo("n2",e,t,Zh,1,-1,-1),bo("n3",e,t,Zh,-1,1,-1),bo("n4",e,t,Zh,1,1,-1),bo("f1",e,t,Zh,-1,-1,1),bo("f2",e,t,Zh,1,-1,1),bo("f3",e,t,Zh,-1,1,1),bo("f4",e,t,Zh,1,1,1),bo("u1",e,t,Zh,.7,1.1,-1),bo("u2",e,t,Zh,-.7,1.1,-1),bo("u3",e,t,Zh,0,2,-1),bo("cf1",e,t,Zh,-1,0,1),bo("cf2",e,t,Zh,1,0,1),bo("cf3",e,t,Zh,0,-1,1),bo("cf4",e,t,Zh,0,1,1),bo("cn1",e,t,Zh,-1,0,-1),bo("cn2",e,t,Zh,1,0,-1),bo("cn3",e,t,Zh,0,-1,-1),bo("cn4",e,t,Zh,0,1,-1),t.getAttribute("position").needsUpdate=1},Jh=new f,_o.prototype=Object.create(tn.prototype),_o.prototype.constructor=_o,_o.prototype.update=function(){var t,e,n,i;void 0!==this.object&&Jh.setFromObject(this.object),Jh.isEmpty()||(t=Jh.min,e=Jh.max,(i=(n=this.geometry.attributes.position).array)[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=t.x,i[4]=e.y,i[5]=e.z,i[6]=t.x,i[7]=t.y,i[8]=e.z,i[9]=e.x,i[10]=t.y,i[11]=e.z,i[12]=e.x,i[13]=e.y,i[14]=t.z,i[15]=t.x,i[16]=e.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=e.x,i[22]=t.y,i[23]=t.z,n.needsUpdate=1,this.geometry.computeBoundingSphere())},_o.prototype.setFromObject=function(t){return this.object=t,this.update(),this},_o.prototype.copy=function(t){return tn.prototype.copy.call(this,t),this.object=t.object,this},_o.prototype.clone=function(){return(new this.constructor).copy(this)},wo.prototype=Object.create(tn.prototype),wo.prototype.constructor=wo,wo.prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),p.prototype.updateMatrixWorld.call(this,t))},Mo.prototype=Object.create(Ke.prototype),Mo.prototype.constructor=Mo,Mo.prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?jo:Uo,this.lookAt(this.plane.normal),p.prototype.updateMatrixWorld.call(this,t)},$h=new i,So.prototype=Object.create(p.prototype),So.prototype.constructor=So,So.prototype.setDirection=function(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{$h.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle($h,e)}},So.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},So.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},So.prototype.copy=function(t){return p.prototype.copy.call(this,t,0),this.line.copy(t.line),this.cone.copy(t.cone),this},So.prototype.clone=function(){return(new this.constructor).copy(this)},To.prototype=Object.create(tn.prototype),To.prototype.constructor=To,Qi.create=function(t,e){return t.prototype=Object.create(Qi.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(dr.prototype,{createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){var e,n,r,o;for(e=new V,n=0,r=t.length;n<r;n++)o=t[n],e.vertices.push(new i(o.x,o.y,o.z||0));return e}}),Object.assign(fr.prototype,{fromPoints:function(t){this.setFromPoints(t)}}),Ao.prototype=Object.create(nr.prototype),Object.assign(Ao.prototype,{initFromArray:function(){},getControlPointsArray:function(){},reparametrizeByArcLength:function(){}}),fo.prototype.setColors=function(){},co.prototype.update=function(){},Object.assign(Wi.prototype,{extractUrlBase:function(t){return rh(t)}}),Wi.Handlers={add:function(){},get:function(){}},Object.assign(Or.prototype,{setTexturePath:function(t){return this.setResourcePath(t)}}),Object.assign(io.prototype,{center:function(t){return this.getCenter(t)},empty:function(){return this.isEmpty()},isIntersectionBox:function(t){return this.intersectsBox(t)},size:function(t){return this.getSize(t)}}),Object.assign(f.prototype,{center:function(t){return this.getCenter(t)},empty:function(){return this.isEmpty()},isIntersectionBox:function(t){return this.intersectsBox(t)},isIntersectionSphere:function(t){return this.intersectsSphere(t)},size:function(t){return this.getSize(t)}}),ro.prototype.center=function(t){return this.getCenter(t)},Object.assign(ic,{random16:function(){return Math.random()},nearestPowerOfTwo:function(t){return ic.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return ic.ceilPowerOfTwo(t)}}),Object.assign(r.prototype,{flattenToArrayOffset:function(t,e){return this.toArray(t,e)},multiplyVector3:function(t){return t.applyMatrix3(this)},multiplyVector3Array:function(){},applyToBuffer:function(t){return this.applyToBufferAttribute(t)},applyToVector3Array:function(){}}),Object.assign(l.prototype,{extractPosition:function(t){return this.copyPosition(t)},flattenToArrayOffset:function(t,e){return this.toArray(t,e)},getPosition:function(){return(new i).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return this.makeRotationFromQuaternion(t)},multiplyToArray:function(){},multiplyVector3:function(t){return t.applyMatrix4(this)},multiplyVector4:function(t){return t.applyMatrix4(this)},multiplyVector3Array:function(){},rotateAxis:function(t){t.transformDirection(this)},crossVector:function(t){return t.applyMatrix4(this)},translate:function(){},rotateX:function(){},rotateY:function(){},rotateZ:function(){},rotateByAxis:function(){},applyToBuffer:function(t){return this.applyToBufferAttribute(t)},applyToVector3Array:function(){},makeFrustum:function(t,e,n,i,r,o){return this.makePerspective(t,e,i,n,r,o)}}),$.prototype.isIntersectionLine=function(t){return this.intersectsLine(t)},n.prototype.multiplyVector3=function(t){return t.applyQuaternion(this)},Object.assign(v.prototype,{isIntersectionBox:function(t){return this.intersectsBox(t)},isIntersectionPlane:function(t){return this.intersectsPlane(t)},isIntersectionSphere:function(t){return this.intersectsSphere(t)}}),Object.assign(y.prototype,{area:function(){return this.getArea()},barycoordFromPoint:function(t,e){return this.getBarycoord(t,e)},midpoint:function(t){return this.getMidpoint(t)},normal:function(t){return this.getNormal(t)},plane:function(t){return this.getPlane(t)}}),Object.assign(y,{barycoordFromPoint:function(t,e,n,i,r){return y.getBarycoord(t,e,n,i,r)},normal:function(t,e,n,i){return y.getNormal(t,e,n,i)}}),Object.assign(mr.prototype,{extractAllPoints:function(t){return this.extractPoints(t)},extrude:function(t){return new Qn(this,t)},makeGeometry:function(t){return new li(this,t)}}),Object.assign(e.prototype,{fromAttribute:function(t,e,n){return this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return this.manhattanDistanceTo(t)},lengthManhattan:function(){return this.manhattanLength()}}),Object.assign(i.prototype,{setEulerFromRotationMatrix:function(){},setEulerFromQuaternion:function(){},getPositionFromMatrix:function(t){return this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return this.setFromMatrixColumn(e,t)},applyProjection:function(t){return this.applyMatrix4(t)},fromAttribute:function(t,e,n){return this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return this.manhattanDistanceTo(t)},lengthManhattan:function(){return this.manhattanLength()}}),Object.assign(a.prototype,{fromAttribute:function(t,e,n){return this.fromBufferAttribute(t,e,n)},lengthManhattan:function(){return this.manhattanLength()}}),Object.assign(V.prototype,{computeTangents:function(){},computeLineDistances:function(){}}),Object.assign(p.prototype,{getChildByName:function(t){return this.getObjectByName(t)},renderDepth:function(){},translate:function(t,e){return this.translateOnAxis(e,t)},getWorldRotation:function(){}}),Object.defineProperties(p.prototype,{eulerOrder:{get:function(){return this.rotation.order},set:function(t){this.rotation.order=t}},useQuaternion:{get:function(){},set:function(){}}}),Object.defineProperties(Xe.prototype,{objects:{get:function(){return this.levels}}}),Object.defineProperty(Ze.prototype,"useVertexTexture",{get:function(){},set:function(){}}),Ye.prototype.initBones=function(){},Object.defineProperty(Qi.prototype,"__arcLengthDivisions",{get:function(){return this.arcLengthDivisions},set:function(t){this.arcLengthDivisions=t}}),X.prototype.setLens=function(t,e){void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(gr.prototype,{onlyShadow:{set:function(){}},shadowCameraFov:{set:function(t){this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){}},shadowBias:{set:function(t){this.shadow.bias=t}},shadowDarkness:{set:function(){}},shadowMapWidth:{set:function(t){this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){this.shadow.mapSize.height=t}}}),Object.defineProperties(A.prototype,{length:{get:function(){return this.array.length}}}),Object.assign(A.prototype,{copyIndicesArray:function(){},setArray:function(t){return this.count=void 0!==t?t.length/this.itemSize:0,this.array=t,this}}),Object.assign(k.prototype,{addIndex:function(t){this.setIndex(t)},addDrawCall:function(t,e){this.addGroup(t,e)},clearDrawCalls:function(){this.clearGroups()},computeTangents:function(){},computeOffsets:function(){}}),Object.defineProperties(k.prototype,{drawcalls:{get:function(){return this.groups}},offsets:{get:function(){return this.groups}}}),Object.assign(Ve.prototype,{setArray:function(t){return this.count=void 0!==t?t.length/this.stride:0,this.array=t,this}}),Object.assign(Kn.prototype,{getArrays:function(){},addShapeList:function(){},addShape:function(){}}),Object.defineProperties(Kr.prototype,{dynamic:{set:function(){}},onUpdate:{value:function(){return this}}}),Object.defineProperties(S.prototype,{wrapAround:{get:function(){},set:function(){}},overdraw:{get:function(){},set:function(){}},wrapRGB:{get:function(){return new x}},shading:{get:function(){},set:function(t){this.flatShading=1===t}},stencilMask:{get:function(){return this.stencilFuncMask},set:function(t){this.stencilFuncMask=t}}}),Object.defineProperties(Mi.prototype,{metal:{get:function(){return 0},set:function(){}}}),Object.defineProperties(H.prototype,{derivatives:{get:function(){return this.extensions.derivatives},set:function(t){this.extensions.derivatives=t}}}),Object.assign(Be.prototype,{clearTarget:function(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)},animate:function(t){this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return this.getRenderTarget()},getMaxAnisotropy:function(){return this.capabilities.getMaxAnisotropy()},getPrecision:function(){return this.capabilities.precision},resetGLState:function(){return this.state.reset()},supportsFloatTextures:function(){return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return this.capabilities.vertexTextures},supportsInstancedArrays:function(){return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){this.setScissorTest(t)},initMaterial:function(){},addPrePlugin:function(){},addPostPlugin:function(){},updateShadowMap:function(){},setFaceCulling:function(){},allocTextureUnit:function(){},setTexture:function(){},setTexture2D:function(){},setTextureCube:function(){},getActiveMipMapLevel:function(){return this.getActiveMipmapLevel()}}),Object.defineProperties(Be.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){this.shadowMap.type=t}},shadowMapCullFace:{get:function(){},set:function(){}},context:{get:function(){return this.getContext()}}}),Object.defineProperties(Ce.prototype,{cullFace:{get:function(){},set:function(){}},renderReverseSided:{get:function(){},set:function(){}},renderSingleSided:{get:function(){},set:function(){}}}),Object.defineProperties(Z.prototype,{activeCubeFace:{set:function(){}},activeMipMapLevel:{set:function(){}}}),Object.defineProperties(s.prototype,{wrapS:{get:function(){return this.texture.wrapS},set:function(t){this.texture.wrapS=t}},wrapT:{get:function(){return this.texture.wrapT},set:function(t){this.texture.wrapT=t}},magFilter:{get:function(){return this.texture.magFilter},set:function(t){this.texture.magFilter=t}},minFilter:{get:function(){return this.texture.minFilter},set:function(t){this.texture.minFilter=t}},anisotropy:{get:function(){return this.texture.anisotropy},set:function(t){this.texture.anisotropy=t}},offset:{get:function(){return this.texture.offset},set:function(t){this.texture.offset=t}},repeat:{get:function(){return this.texture.repeat},set:function(t){this.texture.repeat=t}},format:{get:function(){return this.texture.format},set:function(t){this.texture.format=t}},type:{get:function(){return this.texture.type},set:function(t){this.texture.type=t}},generateMipmaps:{get:function(){return this.texture.generateMipmaps},set:function(t){this.texture.generateMipmaps=t}}}),Object.defineProperties(Fe.prototype,{standing:{set:function(){}},userHeight:{set:function(){}}}),Hr.prototype.load=function(t){var e;return e=this,(new kr).load(t,function(t){e.setBuffer(t)}),this},Xr.prototype.getData=function(){return this.getFrequencyData()},Y.prototype.updateCubeMap=function(t,e){return this.update(t,e)},cc.crossOrigin=void 0,cc.loadTexture=function(t,e,n,i){var r,o;return(r=new $i).setCrossOrigin(this.crossOrigin),o=r.load(t,n,void 0,i),e&&(o.mapping=e),o},cc.loadTextureCube=function(t,e,n,i){var r,o;return(r=new Ji).setCrossOrigin(this.crossOrigin),o=r.load(t,n,void 0,i),e&&(o.mapping=e),o},cc.loadCompressedTexture=function(){},cc.loadCompressedTextureCube=function(){},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"109"}})),(tp=function(){}).prototype={constructor:tp,parse:(cp=new i,lp=new r,function(t,e){var n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y;if(void 0===e&&(e={}),n=void 0!==e.binary?e.binary:0,i=[],r=0,t.traverse(function(t){if(t.isMesh){var e=t.geometry;e.isBufferGeometry&&(e=(new V).fromBufferGeometry(e)),e.isGeometry&&(r+=e.faces.length,i.push({geometry:e,matrixWorld:t.matrixWorld}))}}),n){for(o=80,a=new ArrayBuffer(2*r+3*r*4*4+80+4),(s=new DataView(a)).setUint32(o,r,1),o+=4,c=0,l=i.length;c<l;c++)for(h=(u=i[c]).geometry.vertices,p=u.geometry.faces,d=u.matrixWorld,lp.getNormalMatrix(d),f=0,m=p.length;f<m;f++){for(g=p[f],cp.copy(g.normal).applyMatrix3(lp).normalize(),s.setFloat32(o,cp.x,1),o+=4,s.setFloat32(o,cp.y,1),o+=4,s.setFloat32(o,cp.z,1),o+=4,v=[g.a,g.b,g.c],y=0;y<3;y++)cp.copy(h[v[y]]).applyMatrix4(d),s.setFloat32(o,cp.x,1),o+=4,s.setFloat32(o,cp.y,1),o+=4,s.setFloat32(o,cp.z,1),o+=4;s.setUint16(o,0,1),o+=2}return s}for(s="",s+="solid exported\n",c=0,l=i.length;c<l;c++)for(h=(u=i[c]).geometry.vertices,p=u.geometry.faces,d=u.matrixWorld,lp.getNormalMatrix(d),f=0,m=p.length;f<m;f++){for(g=p[f],cp.copy(g.normal).applyMatrix3(lp).normalize(),s+="\tfacet normal "+cp.x+" "+cp.y+" "+cp.z+"\n",s+="\t\touter loop\n",v=[g.a,g.b,g.c],y=0;y<3;y++)cp.copy(h[v[y]]).applyMatrix4(d),s+="\t\t\tvertex "+cp.x+" "+cp.y+" "+cp.z+"\n";s+="\t\tendloop\n",s+="\tendfacet\n"}return s+"endsolid exported\n"})},(ep=function(){}).prototype={constructor:ep,parse:function(t){var n,o,a,s,c,l="",u=0,h=0,p=0,d=new i,f=new i,m=new e,g=[];return t.traverse(function(t){t instanceof B&&function(t){var e,i,a,v,y=0,x=0,b=0,_=t.geometry,w=new r;if(_.isGeometry&&(_=(new k).setFromObject(t)),_.isBufferGeometry){if(e=_.getAttribute("position"),i=_.getAttribute("normal"),a=_.getAttribute("uv"),v=_.getIndex(),l+="o "+t.name+"\n",t.material&&t.material.name&&(l+="usemtl "+t.material.name+"\n"),void 0!==e)for(n=0,s=e.count;n<s;n++,y++)d.x=e.getX(n),d.y=e.getY(n),d.z=e.getZ(n),d.applyMatrix4(t.matrixWorld),l+="v "+d.x+" "+d.y+" "+d.z+"\n";if(void 0!==a)for(n=0,s=a.count;n<s;n++,b++)m.x=a.getX(n),m.y=a.getY(n),l+="vt "+m.x+" "+m.y+"\n";if(void 0!==i)for(w.getNormalMatrix(t.matrixWorld),n=0,s=i.count;n<s;n++,x++)f.x=i.getX(n),f.y=i.getY(n),f.z=i.getZ(n),f.applyMatrix3(w),l+="vn "+f.x+" "+f.y+" "+f.z+"\n";if(null!==v)for(n=0,s=v.count;n<s;n+=3){for(c=0;c<3;c++)o=v.getX(n+c)+1,g[c]=u+o+(i||a?"/"+(a?h+o:"")+(i?"/"+(p+o):""):"");l+="f "+g.join(" ")+"\n"}else for(n=0,s=e.count;n<s;n+=3){for(c=0;c<3;c++)o=n+c+1,g[c]=u+o+(i||a?"/"+(a?h+o:"")+(i?"/"+(p+o):""):"");l+="f "+g.join(" ")+"\n"}}u+=y,h+=b,p+=x}(t),t instanceof Ke&&function(t){var e,i=0,r=t.geometry,c=t.type;if(r.isGeometry&&(r=(new k).setFromObject(t)),r.isBufferGeometry){if(e=r.getAttribute("position"),l+="o "+t.name+"\n",void 0!==e)for(n=0,s=e.count;n<s;n++,i++)d.x=e.getX(n),d.y=e.getY(n),d.z=e.getZ(n),d.applyMatrix4(t.matrixWorld),l+="v "+d.x+" "+d.y+" "+d.z+"\n";if("Line"===c){for(l+="l ",o=1,s=e.count;o<=s;o++)l+=u+o+" ";l+="\n"}if("LineSegments"===c)for(a=1+(o=1),s=e.count;o<s;a=(o+=2)+1)l+="l "+(u+o)+" "+(u+a)+"\n"}u+=i}(t)}),l}},(np=function(t){this.subdivisions=void 0===t?1:t}).prototype.modify=function(t){(t=t.isBufferGeometry?(new V).fromBufferGeometry(t):t.clone()).mergeVertices();for(var e=this.subdivisions;e-- >0;)this.smooth(t);return t.computeFaceNormals(),t.computeVertexNormals(),t},function(){function t(t,e,n){return n[Math.min(t,e)+"_"+Math.max(t,e)]}function n(t,e,n,i,r,o){var a,s=Math.min(t,e),c=Math.max(t,e),l=s+"_"+c;l in i?a=i[l]:(a={a:n[s],b:n[c],newEdge:null,faces:[]},i[l]=a),a.faces.push(r),o[t].edges.push(a),o[e].edges.push(a)}function r(t,e,n,i,r){t.push(new M(e,n,i,void 0,void 0,r))}function o(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function a(t,e,n,i){t.push([e.clone(),n.clone(),i.clone()])}var s=["a","b","c"];np.prototype.smooth=function(c){var l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A,L,C,P,E,N,O,D,I,z,R,F,k,B,U,j,V,G=new i,W=[],H=c.vertices,q=c.faces,X=c.faceVertexUvs[0],Y=void 0!==X&&X.length>0,Z=Array(H.length),J={};for(p in function(t,e,i,r){var o,a,s;for(o=0,a=t.length;o<a;o++)i[o]={edges:[]};for(o=0,a=e.length;o<a;o++)n((s=e[o]).a,s.b,t,r,s,i),n(s.b,s.c,t,r,s,i),n(s.c,s.a,t,r,s,i)}(H,q,Z,J),g=[],J){for(x=J[p],b=new i,w=3/8,M=1/8,2!=(S=x.faces.length)&&(w=.5,M=0),b.addVectors(x.a,x.b).multiplyScalar(w),G.set(0,0,0),f=0;f<S;f++){for(_=x.faces[f],m=0;m<3&&((y=H[_[s[m]]])===x.a||y===x.b);m++);G.add(y)}G.multiplyScalar(M),b.add(G),x.newEdge=g.length,g.push(b)}for(v=[],p=0,d=H.length;p<d;p++){for(E=H[p],3==(h=(P=Z[p].edges).length)?T=3/16:h>3&&(T=3/(8*h)),A=1-h*T,L=T,h<=2&&2==h&&(A=.75,L=1/8),N=E.clone().multiplyScalar(A),G.set(0,0,0),f=0;f<h;f++)y=(C=P[f]).a!==E?C.a:C.b,G.add(y);G.multiplyScalar(L),N.add(G),v.push(N)}for(l=v.concat(g),O=v.length,u=[],U=new e,j=new e,V=new e,p=0,d=q.length;p<d;p++)r(u,D=t((_=q[p]).a,_.b,J).newEdge+O,I=t(_.b,_.c,J).newEdge+O,z=t(_.c,_.a,J).newEdge+O,_.materialIndex),r(u,_.a,D,z,_.materialIndex),r(u,_.b,I,D,_.materialIndex),r(u,_.c,z,I,_.materialIndex),Y&&(F=(R=X[p])[0],k=R[1],B=R[2],U.set(o(F.x,k.x),o(F.y,k.y)),j.set(o(k.x,B.x),o(k.y,B.y)),V.set(o(F.x,B.x),o(F.y,B.y)),a(W,U,j,V),a(W,F,U,V),a(W,k,j,U),a(W,B,V,j));c.vertices=l,c.faces=u,Y&&(c.faceVertexUvs[0]=W)}}(),ip="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},rp=Lo(function(t){!function(){function e(t,e,n){var i=new XMLHttpRequest;i.open("GET",t),i.responseType="blob",i.onload=function(){o(i.response,e,n)},i.onerror=function(){},i.send()}function n(t){var e=new XMLHttpRequest;e.open("HEAD",t,0);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function i(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(n){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",1,1,window,0,0,0,80,20,0,0,0,0,0,null),t.dispatchEvent(e)}}var r="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof ip&&ip.global===ip?ip:void 0,o=r.saveAs||("object"!=typeof window||window!==r?function(){}:"download"in HTMLAnchorElement.prototype?function(t,o,a){var s=r.URL||r.webkitURL,c=document.createElement("a");o=o||t.name||"download",c.download=o,c.rel="noopener","string"==typeof t?(c.href=t,c.origin===location.origin?i(c):n(c.href)?e(t,o,a):i(c,c.target="_blank")):(c.href=s.createObjectURL(t),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){i(c)},0))}:"msSaveOrOpenBlob"in navigator?function(t,r,o){if(r=r||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:0}:"object"!=typeof e&&(e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,o),r);else if(n(t))e(t,r,o);else{var a=document.createElement("a");a.href=t,a.target="_blank",setTimeout(function(){i(a)})}}:function(t,n,i,o){var a,s,c,l,u,h;if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof t)return e(t,n,i);a="application/octet-stream"===t.type,s=/constructor/i.test(r.HTMLElement)||r.safari,((c=/CriOS\/[\d]+/.test(navigator.userAgent))||a&&s)&&"object"==typeof FileReader?((l=new FileReader).onloadend=function(){var t=l.result;t=c?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=t:location=t,o=null},l.readAsDataURL(t)):(u=r.URL||r.webkitURL,h=u.createObjectURL(t),o?o.location=h:location.href=h,o=null,setTimeout(function(){u.revokeObjectURL(h)},4e4))});r.saveAs=o.saveAs=o,t.exports=o}()}),op=rp.saveAs,ap=Lo(function(t){!function(e,n){t.exports=e.document?n(e,1):function(t){if(!t.document)throw Error("jQuery requires a window with a document");return n(t)}}("undefined"!=typeof window?window:ip,function(t,e){function n(t,e,n){var i,r,o=(n=n||Ie).createElement("script");if(o.text=t,e)for(i in Ye)(r=e[i]||e.getAttribute&&e.getAttribute(i))&&o.setAttribute(i,r);n.head.appendChild(o).parentNode.removeChild(o)}function i(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?Ue[je.call(t)]||"object":typeof t}function r(t){var e=!!t&&"length"in t&&t.length,n=i(t);return qe(t)||Xe(t)?0:"array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t}function o(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}function a(t,e,n){return qe(e)?Ze.grep(t,function(t,i){return!!e.call(t,i,t)!==n}):e.nodeType?Ze.grep(t,function(t){return t===e!==n}):"string"!=typeof e?Ze.grep(t,function(t){return Be.call(e,t)>-1!==n}):Ze.filter(e,t,n)}function s(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function c(t){return t}function l(t){throw t}function u(t,e,n,i){var r;try{t&&qe(r=t.promise)?r.call(t).done(e).fail(n):t&&qe(r=t.then)?r.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.call(void 0,t)}}function h(){Ie.removeEventListener("DOMContentLoaded",h),t.removeEventListener("load",h),Ze.ready()}function p(t,e){return e.toUpperCase()}function d(t){return t.replace(pt,"ms-").replace(dt,p)}function f(){this.expando=Ze.expando+f.uid++}function m(t,e,n){var i;if(void 0===n&&1===t.nodeType)if(i="data-"+e.replace(yt,"-$&").toLowerCase(),"string"==typeof(n=t.getAttribute(i))){try{n=function(t){return"true"===t?1:"false"===t?0:"null"===t?null:t===+t+""?+t:vt.test(t)?JSON.parse(t):t}(n)}catch(t){}gt.set(t,e,n)}else n=void 0;return n}function g(t,e,n,i){var r,o,a=20,s=i?function(){return i.cur()}:function(){return Ze.css(t,e,"")},c=s(),l=n&&n[3]||(Ze.cssNumber[e]?"":"px"),u=t.nodeType&&(Ze.cssNumber[e]||"px"!==l&&+c)&&bt.exec(Ze.css(t,e));if(u&&u[3]!==l){for(c/=2,l=l||u[3],u=+c||1;a--;)Ze.style(t,e,u+l),(1-o)*(1-(o=s()/c||.5))<=0&&(a=0),u/=o;u*=2,Ze.style(t,e,u+l),n=n||[]}return n&&(u=+u||+c||0,r=n[1]?u+(n[1]+1)*n[2]:+n[2],i&&(i.unit=l,i.start=u,i.end=r)),r}function v(t){var e,n=t.ownerDocument,i=t.nodeName,r=Lt[i];return r||(e=n.body.appendChild(n.createElement(i)),r=Ze.css(e,"display"),e.parentNode.removeChild(e),"none"===r&&(r="block"),Lt[i]=r,r)}function y(t,e){for(var n,i,r=[],o=0,a=t.length;o<a;o++)(i=t[o]).style&&(n=i.style.display,e?("none"===n&&(r[o]=mt.get(i,"display")||null,r[o]||(i.style.display="")),""===i.style.display&&Tt(i)&&(r[o]=v(i))):"none"!==n&&(r[o]="none",mt.set(i,"display",n)));for(o=0;o<a;o++)null!=r[o]&&(t[o].style.display=r[o]);return t}function x(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&o(t,e)?Ze.merge([t],n):n}function b(t,e){for(var n=0,i=t.length;n<i;n++)mt.set(t[n],"globalEval",!e||mt.get(e[n],"globalEval"))}function _(t,e,n,r,o){for(var a,s,c,l,u,h,p=e.createDocumentFragment(),d=[],f=0,m=t.length;f<m;f++)if((a=t[f])||0===a)if("object"===i(a))Ze.merge(d,a.nodeType?[a]:a);else if(Ot.test(a)){for(s=s||p.appendChild(e.createElement("div")),c=(Pt.exec(a)||["",""])[1].toLowerCase(),l=Nt[c]||Nt._default,s.innerHTML=l[1]+Ze.htmlPrefilter(a)+l[2],h=l[0];h--;)s=s.lastChild;Ze.merge(d,s.childNodes),(s=p.firstChild).textContent=""}else d.push(e.createTextNode(a));for(p.textContent="",f=0;a=d[f++];)if(r&&Ze.inArray(a,r)>-1)o&&o.push(a);else if(u=Mt(a),s=x(p.appendChild(a),"script"),u&&b(s),n)for(h=0;a=s[h++];)Et.test(a.type||"")&&n.push(a);return p}function w(){return 1}function M(){return 0}function S(t,e){return t===function(){try{return Ie.activeElement}catch(t){}}()==("focus"===e)}function T(t,e,n,i,r,o){var a,s;if("object"==typeof e){for(s in"string"!=typeof n&&(i=i||n,n=void 0),e)T(t,s,n,i,e[s],o);return t}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),0==r)r=M;else if(!r)return t;return 1===o&&(a=r,(r=function(t){return Ze().off(t),a.apply(this,arguments)}).guid=a.guid||(a.guid=Ze.guid++)),t.each(function(){Ze.event.add(this,e,r,i,n)})}function A(t,e,n){n?(mt.set(t,e,0),Ze.event.add(t,e,{namespace:0,handler:function(t){var i,r,o=mt.get(this,e);if(1&t.isTrigger&&this[e]){if(o.length)(Ze.event.special[e]||{}).delegateType&&t.stopPropagation();else if(o=Re.call(arguments),mt.set(this,e,o),i=n(this,e),this[e](),o!==(r=mt.get(this,e))||i?mt.set(this,e,0):r={},o!==r)return t.stopImmediatePropagation(),t.preventDefault(),r.value}else o.length&&(mt.set(this,e,{value:Ze.event.trigger(Ze.extend(o[0],Ze.Event.prototype),o.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===mt.get(t,e)&&Ze.event.add(t,e,w)}function L(t,e){return o(t,"table")&&o(11!==e.nodeType?e:e.firstChild,"tr")&&Ze(t).children("tbody")[0]||t}function C(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function P(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function E(t,e){var n,i,r,o,a,s,c,l;if(1===e.nodeType){if(mt.hasData(t)&&(o=mt.access(t),a=mt.set(e,o),l=o.events))for(r in delete a.handle,a.events={},l)for(n=0,i=l[r].length;n<i;n++)Ze.event.add(e,r,l[r][n]);gt.hasData(t)&&(s=gt.access(t),c=Ze.extend({},s),gt.set(e,c))}}function N(t,e){var n=e.nodeName.toLowerCase();"input"===n&&Ct.test(t.type)?e.checked=t.checked:"input"!==n&&"textarea"!==n||(e.defaultValue=t.defaultValue)}function O(t,e,i,r){e=Fe.apply([],e);var o,a,s,c,l,u,h=0,p=t.length,d=p-1,f=e[0],m=qe(f);if(m||p>1&&"string"==typeof f&&!He.checkClone&&kt.test(f))return t.each(function(n){var o=t.eq(n);m&&(e[0]=f.call(this,n,o.html())),O(o,e,i,r)});if(p&&(a=(o=_(e,t[0].ownerDocument,0,t,r)).firstChild,1===o.childNodes.length&&(o=a),a||r)){for(c=(s=Ze.map(x(o,"script"),C)).length;h<p;h++)l=o,h!==d&&(l=Ze.clone(l,1,1),c&&Ze.merge(s,x(l,"script"))),i.call(t[h],l,h);if(c)for(u=s[s.length-1].ownerDocument,Ze.map(s,P),h=0;h<c;h++)l=s[h],Et.test(l.type||"")&&!mt.access(l,"globalEval")&&Ze.contains(u,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?Ze._evalUrl&&!l.noModule&&Ze._evalUrl(l.src,{nonce:l.nonce||l.getAttribute("nonce")}):n(l.textContent.replace(Bt,""),l,u))}return t}function D(t,e,n){for(var i,r=e?Ze.filter(e,t):t,o=0;null!=(i=r[o]);o++)n||1!==i.nodeType||Ze.cleanData(x(i)),i.parentNode&&(n&&Mt(i)&&b(x(i,"script")),i.parentNode.removeChild(i));return t}function I(t,e,n){var i,r,o,a,s=t.style;return(n=n||jt(t))&&(""!==(a=n.getPropertyValue(e)||n[e])||Mt(t)||(a=Ze.style(t,e)),!He.pixelBoxStyles()&&Ut.test(a)&&Vt.test(e)&&(i=s.width,r=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=i,s.minWidth=r,s.maxWidth=o)),void 0!==a?a+"":a}function z(t,e){return{get:function(){if(!t())return(this.get=e).apply(this,arguments);delete this.get}}}function R(t){return Ze.cssProps[t]||Ht[t]||(t in Wt?t:Ht[t]=function(t){for(var e=t[0].toUpperCase()+t.slice(1),n=Gt.length;n--;)if((t=Gt[n]+e)in Wt)return t}(t)||t)}function F(t,e,n){var i=bt.exec(e);return i?Math.max(0,i[2]-(n||0))+(i[3]||"px"):e}function k(t,e,n,i,r,o){var a="width"===e?1:0,s=0,c=0;if(n===(i?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(c+=Ze.css(t,n+_t[a],1,r)),i?("content"===n&&(c-=Ze.css(t,"padding"+_t[a],1,r)),"margin"!==n&&(c-=Ze.css(t,"border"+_t[a]+"Width",1,r))):(c+=Ze.css(t,"padding"+_t[a],1,r),"padding"!==n?c+=Ze.css(t,"border"+_t[a]+"Width",1,r):s+=Ze.css(t,"border"+_t[a]+"Width",1,r));return!i&&o>=0&&(c+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-o-c-s-.5))||0),c}function B(t,e,n){var i=jt(t),r=(!He.boxSizingReliable()||n)&&"border-box"===Ze.css(t,"boxSizing",0,i),o=r,a=I(t,e,i),s="offset"+e[0].toUpperCase()+e.slice(1);if(Ut.test(a)){if(!n)return a;a="auto"}return(!He.boxSizingReliable()&&r||"auto"===a||!parseFloat(a)&&"inline"===Ze.css(t,"display",0,i))&&t.getClientRects().length&&(r="border-box"===Ze.css(t,"boxSizing",0,i),(o=s in t)&&(a=t[s])),(a=parseFloat(a)||0)+k(t,e,n||(r?"border":"content"),o,i,a)+"px"}function U(t,e,n,i,r){return new U.prototype.init(t,e,n,i,r)}function j(){$t&&(0==Ie.hidden&&t.requestAnimationFrame?t.requestAnimationFrame(j):t.setTimeout(j,Ze.fx.interval),Ze.fx.tick())}function V(){return t.setTimeout(function(){Jt=void 0}),Jt=Date.now()}function G(t,e){var n,i=0,r={height:t};for(e=e?1:0;i<4;i+=2-e)r["margin"+(n=_t[i])]=r["padding"+n]=t;return e&&(r.opacity=r.width=t),r}function W(t,e,n){for(var i,r=(H.tweeners[e]||[]).concat(H.tweeners["*"]),o=0,a=r.length;o<a;o++)if(i=r[o].call(n,e,t))return i}function H(t,e,n){var i,r,o=0,a=H.prefilters.length,s=Ze.Deferred().always(function(){delete c.elem}),c=function(){if(r)return 0;for(var e=Jt||V(),n=Math.max(0,l.startTime+l.duration-e),i=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(i);return s.notifyWith(t,[l,i,n]),i<1&&a?n:(a||s.notifyWith(t,[l,1,0]),s.resolveWith(t,[l]),0)},l=s.promise({elem:t,props:Ze.extend({},e),opts:Ze.extend(1,{specialEasing:{},easing:Ze.easing._default},n),originalProperties:e,originalOptions:n,startTime:Jt||V(),duration:n.duration,tweens:[],createTween:function(e,n){var i=Ze.Tween(t,l.opts,e,n,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(i),i},stop:function(e){var n=0,i=e?l.tweens.length:0;if(r)return this;for(r=1;n<i;n++)l.tweens[n].run(1);return e?(s.notifyWith(t,[l,1,0]),s.resolveWith(t,[l,e])):s.rejectWith(t,[l,e]),this}}),u=l.props;for(function(t,e){var n,i,r,o,a;for(n in t)if(r=e[i=d(n)],o=t[n],Array.isArray(o)&&(r=o[1],o=t[n]=o[0]),n!==i&&(t[i]=o,delete t[n]),(a=Ze.cssHooks[i])&&"expand"in a)for(n in o=a.expand(o),delete t[i],o)n in t||(t[n]=o[n],e[n]=r);else e[i]=r}(u,l.opts.specialEasing);o<a;o++)if(i=H.prefilters[o].call(l,t,u,l.opts))return qe(i.stop)&&(Ze._queueHooks(l.elem,l.opts.queue).stop=i.stop.bind(i)),i;return Ze.map(u,W,l),qe(l.opts.start)&&l.opts.start.call(t,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),Ze.fx.timer(Ze.extend(c,{elem:t,anim:l,queue:l.opts.queue})),l}function q(t){return(t.match(ct)||[]).join(" ")}function X(t){return t.getAttribute&&t.getAttribute("class")||""}function Y(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(ct)||[]}function Z(t,e,n,r){var o;if(Array.isArray(e))Ze.each(e,function(e,i){n||ue.test(t)?r(t,i):Z(t+"["+("object"==typeof i&&null!=i?e:"")+"]",i,n,r)});else if(n||"object"!==i(e))r(t,e);else for(o in e)Z(t+"["+o+"]",e[o],n,r)}function J(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var i,r=0,o=e.toLowerCase().match(ct)||[];if(qe(n))for(;i=o[r++];)"+"===i[0]?(i=i.slice(1)||"*",(t[i]=t[i]||[]).unshift(n)):(t[i]=t[i]||[]).push(n)}}function $(t,e,n,i){function r(s){var c;return o[s]=1,Ze.each(t[s]||[],function(t,s){var l=s(e,n,i);return"string"!=typeof l||a||o[l]?a?!(c=l):void 0:(e.dataTypes.unshift(l),r(l),0)}),c}var o={},a=t===we;return r(e.dataTypes[0])||!o["*"]&&r("*")}function Q(t,e){var n,i,r=Ze.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((r[n]?t:i||(i={}))[n]=e[n]);return i&&Ze.extend(1,t,i),t}var K,tt,et,nt,it,rt,ot,at,st,ct,lt,ut,ht,pt,dt,ft,mt,gt,vt,yt,xt,bt,_t,wt,Mt,St,Tt,At,Lt,Ct,Pt,Et,Nt,Ot,Dt,It,zt,Rt,Ft,kt,Bt,Ut,jt,Vt,Gt,Wt,Ht,qt,Xt,Yt,Zt,Jt,$t,Qt,Kt,te,ee,ne,ie,re,oe,ae,se,ce,le,ue,he,pe,de,fe,me,ge,ve,ye,xe,be,_e,we,Me,Se,Te,Ae,Le,Ce,Pe,Ee,Ne,Oe,De=[],Ie=t.document,ze=Object.getPrototypeOf,Re=De.slice,Fe=De.concat,ke=De.push,Be=De.indexOf,Ue={},je=Ue.toString,Ve=Ue.hasOwnProperty,Ge=Ve.toString,We=Ge.call(Object),He={},qe=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType},Xe=function(t){return null!=t&&t===t.window},Ye={type:1,src:1,nonce:1,noModule:1},Ze=function(t,e){return new Ze.fn.init(t,e)},Je=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;return Ze.fn=Ze.prototype={jquery:"3.4.1",constructor:Ze,length:0,toArray:function(){return Re.call(this)},get:function(t){return null==t?Re.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=Ze.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return Ze.each(this,t)},map:function(t){return this.pushStack(Ze.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return this.pushStack(Re.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n<e?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:ke,sort:De.sort,splice:De.splice},Ze.extend=Ze.fn.extend=function(t){var e,n,i,r,o,a,s=t||{},c=1,l=arguments.length,u=0;for("boolean"==typeof s&&(u=s,s=arguments[c]||{},c++),"object"==typeof s||qe(s)||(s={}),c===l&&(s=this,c--);c<l;c++)if(null!=(e=arguments[c]))for(n in e)r=e[n],"__proto__"!==n&&s!==r&&(u&&r&&(Ze.isPlainObject(r)||(o=Array.isArray(r)))?(i=s[n],a=o&&!Array.isArray(i)?[]:o||Ze.isPlainObject(i)?i:{},o=0,s[n]=Ze.extend(u,a,r)):void 0!==r&&(s[n]=r));return s},Ze.extend({expando:"jQuery"+("3.4.1"+Math.random()).replace(/\D/g,""),isReady:1,error:function(t){throw Error(t)},noop:function(){},isPlainObject:function(t){var e,n;return t&&"[object Object]"===je.call(t)?(e=ze(t))?"function"==typeof(n=Ve.call(e,"constructor")&&e.constructor)&&Ge.call(n)===We:1:0},isEmptyObject:function(t){var e;for(e in t)return 0;return 1},globalEval:function(t,e){n(t,{nonce:e&&e.nonce})},each:function(t,e){var n,i=0;if(r(t))for(n=t.length;i<n&&0!=e.call(t[i],i,t[i]);i++);else for(i in t)if(0==e.call(t[i],i,t[i]))break;return t},trim:function(t){return null==t?"":(t+"").replace(Je,"")},makeArray:function(t,e){var n=e||[];return null!=t&&(r(Object(t))?Ze.merge(n,"string"==typeof t?[t]:t):ke.call(n,t)),n},inArray:function(t,e,n){return null==e?-1:Be.call(e,t,n)},merge:function(t,e){for(var n=+e.length,i=0,r=t.length;i<n;i++)t[r++]=e[i];return t.length=r,t},grep:function(t,e,n){for(var i=[],r=0,o=t.length,a=!n;r<o;r++)!e(t[r],r)!==a&&i.push(t[r]);return i},map:function(t,e,n){var i,o,a=0,s=[];if(r(t))for(i=t.length;a<i;a++)null!=(o=e(t[a],a,n))&&s.push(o);else for(a in t)null!=(o=e(t[a],a,n))&&s.push(o);return Fe.apply([],s)},guid:1,support:He}),"function"==typeof Symbol&&(Ze.fn[Symbol.iterator]=De[Symbol.iterator]),Ze.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){Ue["[object "+e+"]"]=e.toLowerCase()}),K=function(t){function e(t,e,n,i){var r,o,a,s,c,l,u,p=e&&e.ownerDocument,f=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==f&&9!==f&&11!==f)return n;if(!i&&((e?e.ownerDocument||e:B)!==N&&E(e),e=e||N,D)){if(11!==f&&(c=vt.exec(t)))if(r=c[1]){if(9===f){if(!(a=e.getElementById(r)))return n;if(a.id===r)return n.push(a),n}else if(p&&(a=p.getElementById(r))&&F(e,a)&&a.id===r)return n.push(a),n}else{if(c[2])return $.apply(n,e.getElementsByTagName(t)),n;if((r=c[3])&&b.getElementsByClassName&&e.getElementsByClassName)return $.apply(n,e.getElementsByClassName(r)),n}if(b.qsa&&!H[t+" "]&&(!I||!I.test(t))&&(1!==f||"object"!==e.nodeName.toLowerCase())){if(u=t,p=e,1===f&&lt.test(t)){for((s=e.getAttribute("id"))?s=s.replace(_t,wt):e.setAttribute("id",s=k),o=(l=S(t)).length;o--;)l[o]="#"+s+" "+d(l[o]);u=l.join(","),p=yt.test(t)&&h(e.parentNode)||e}try{return $.apply(n,p.querySelectorAll(u)),n}catch(e){H(t,1)}finally{s===k&&e.removeAttribute("id")}}}return A(t.replace(at,"$1"),e,n,i)}function n(){var t=[];return function e(n,i){return t.push(n+" ")>_.cacheLength&&delete e[t.shift()],e[n+" "]=i}}function i(t){return t[k]=1,t}function r(t){var e=N.createElement("fieldset");try{return!!t(e)}catch(t){return 0}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function o(t,e){for(var n=t.split("|"),i=n.length;i--;)_.attrHandle[n[i]]=e}function a(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function s(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function c(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function l(t){return function(e){return"form"in e?e.parentNode&&0==e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&St(e)===t:e.disabled===t:"label"in e?e.disabled===t:0}}function u(t){return i(function(e){return e=+e,i(function(n,i){for(var r,o=t([],n.length,e),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))})})}function h(t){return t&&void 0!==t.getElementsByTagName&&t}function p(){}function d(t){for(var e=0,n=t.length,i="";e<n;e++)i+=t[e].value;return i}function f(t,e,n){var i=e.dir,r=e.next,o=r||i,a=n&&"parentNode"===o,s=j++;return e.first?function(e,n,r){for(;e=e[i];)if(1===e.nodeType||a)return t(e,n,r);return 0}:function(e,n,c){var l,u,h,p=[U,s];if(c){for(;e=e[i];)if((1===e.nodeType||a)&&t(e,n,c))return 1}else for(;e=e[i];)if(1===e.nodeType||a)if(u=(h=e[k]||(e[k]={}))[e.uniqueID]||(h[e.uniqueID]={}),r&&r===e.nodeName.toLowerCase())e=e[i]||e;else{if((l=u[o])&&l[0]===U&&l[1]===s)return p[2]=l[2];if(u[o]=p,p[2]=t(e,n,c))return 1}return 0}}function m(t){return t.length>1?function(e,n,i){for(var r=t.length;r--;)if(!t[r](e,n,i))return 0;return 1}:t[0]}function g(t,e,n,i,r){for(var o,a=[],s=0,c=t.length,l=null!=e;s<c;s++)(o=t[s])&&(n&&!n(o,i,r)||(a.push(o),l&&e.push(s)));return a}function v(t,n,r,o,a,s){return o&&!o[k]&&(o=v(o)),a&&!a[k]&&(a=v(a,s)),i(function(i,s,c,l){var u,h,p,d=[],f=[],m=s.length,v=i||function(t,n,i){for(var r=0,o=n.length;r<o;r++)e(t,n[r],i);return i}(n||"*",c.nodeType?[c]:c,[]),y=!t||!i&&n?v:g(v,d,t,c,l),x=r?a||(i?t:m||o)?[]:s:y;if(r&&r(y,x,c,l),o)for(u=g(x,f),o(u,[],c,l),h=u.length;h--;)(p=u[h])&&(x[f[h]]=!(y[f[h]]=p));if(i){if(a||t){if(a){for(u=[],h=x.length;h--;)(p=x[h])&&u.push(y[h]=p);a(null,x=[],u,l)}for(h=x.length;h--;)(p=x[h])&&(u=a?K(i,p):d[h])>-1&&(i[u]=!(s[u]=p))}}else x=g(x===s?x.splice(m,x.length):x),a?a(null,s,x,l):$.apply(s,x)})}function y(t){for(var e,n,i,r=t.length,o=_.relative[t[0].type],a=o||_.relative[" "],s=o?1:0,c=f(function(t){return t===e},a,1),l=f(function(t){return K(e,t)>-1},a,1),u=[function(t,n,i){var r=!o&&(i||n!==L)||((e=n).nodeType?c(t,n,i):l(t,n,i));return e=null,r}];s<r;s++)if(n=_.relative[t[s].type])u=[f(m(u),n)];else{if((n=_.filter[t[s].type].apply(null,t[s].matches))[k]){for(i=++s;i<r&&!_.relative[t[i].type];i++);return v(s>1&&m(u),s>1&&d(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(at,"$1"),n,s<i&&y(t.slice(s,i)),i<r&&y(t=t.slice(i)),i<r&&d(t))}u.push(n)}return m(u)}var x,b,_,w,M,S,T,A,L,C,P,E,N,O,D,I,z,R,F,k="sizzle"+1*new Date,B=t.document,U=0,j=0,V=n(),G=n(),W=n(),H=n(),q=function(t,e){return t===e&&(P=1),0},X={}.hasOwnProperty,Y=[],Z=Y.pop,J=Y.push,$=Y.push,Q=Y.slice,K=function(t,e){for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1},tt="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",et="[\\x20\\t\\r\\n\\f]",nt="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",it="\\["+et+"*("+nt+")(?:"+et+"*([*^$|!~]?=)"+et+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+nt+"))|)"+et+"*\\]",rt=":("+nt+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+it+")*)|.*)\\)|)",ot=/[\x20\t\r\n\f]+/g,at=/^[\x20\t\r\n\f]+|((?:^|[^\\])(?:\\.)*)[\x20\t\r\n\f]+$/g,st=/^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,ct=/^[\x20\t\r\n\f]*([>+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,lt=/[\x20\t\r\n\f]|>/,ut=RegExp(rt),ht=RegExp("^"+nt+"$"),pt={ID:RegExp("^#("+nt+")"),CLASS:RegExp("^\\.("+nt+")"),TAG:RegExp("^("+nt+"|[*])"),ATTR:RegExp("^"+it),PSEUDO:RegExp("^"+rt),CHILD:/^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,bool:RegExp("^(?:"+tt+")$","i"),needsContext:/^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i},dt=/HTML$/i,ft=/^(?:input|select|textarea|button)$/i,mt=/^h\d$/i,gt=/^[^{]+\{\s*\[native \w/,vt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,yt=/[+~]/,xt=/\\([\da-f]{1,6}[\x20\t\r\n\f]?|([\x20\t\r\n\f])|.)/gi,bt=function(t,e,n){var i="0x"+e-65536;return i!=i||n?e:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},_t=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,wt=function(t,e){return e?"\0"===t?"<22>":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},Mt=function(){E()},St=f(function(t){return 1==t.disabled&&"fieldset"===t.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{$.apply(Y=Q.call(B.childNodes),B.childNodes),Y[B.childNodes.length].nodeType}catch(t){$={apply:Y.length?function(t,e){J.apply(t,Q.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}for(x in b=e.support={},M=e.isXML=function(t){var e=t.namespaceURI,n=(t.ownerDocument||t).documentElement;return!dt.test(e||n&&n.nodeName||"HTML")},E=e.setDocument=function(t){var e,n,i=t?t.ownerDocument||t:B;return i!==N&&9===i.nodeType&&i.documentElement?(O=(N=i).documentElement,D=!M(N),B!==N&&(n=N.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Mt,0):n.attachEvent&&n.attachEvent("onunload",Mt)),b.attributes=r(function(t){return t.className="i",!t.getAttribute("className")}),b.getElementsByTagName=r(function(t){return t.appendChild(N.createComment("")),!t.getElementsByTagName("*").length}),b.getElementsByClassName=gt.test(N.getElementsByClassName),b.getById=r(function(t){return O.appendChild(t).id=k,!N.getElementsByName||!N.getElementsByName(k).length}),b.getById?(_.filter.ID=function(t){var e=t.replace(xt,bt);return function(t){return t.getAttribute("id")===e}},_.find.ID=function(t,e){if(void 0!==e.getElementById&&D){var n=e.getElementById(t);return n?[n]:[]}}):(_.filter.ID=function(t){var e=t.replace(xt,bt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},_.find.ID=function(t,e){if(void 0!==e.getElementById&&D){var n,i,r,o=e.getElementById(t);if(o){if((n=o.getAttributeNode("id"))&&n.value===t)return[o];for(r=e.getElementsByName(t),i=0;o=r[i++];)if((n=o.getAttributeNode("id"))&&n.value===t)return[o]}return[]}}),_.find.TAG=b.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):b.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,i=[],r=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},_.find.CLASS=b.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&D)return e.getElementsByClassName(t)},z=[],I=[],(b.qsa=gt.test(N.querySelectorAll))&&(r(function(t){O.appendChild(t).innerHTML="<a id='"+k+"'></a><select id='"+k+"-\r\\' msallowcapture=''><option selected=''></option></select>",t.querySelectorAll("[msallowcapture^='']").length&&I.push("[*^$]="+et+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||I.push("\\["+et+"*(?:value|"+tt+")"),t.querySelectorAll("[id~="+k+"-]").length||I.push("~="),t.querySelectorAll(":checked").length||I.push(":checked"),t.querySelectorAll("a#"+k+"+*").length||I.push(".#.+[+~]")}),r(function(t){t.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var e=N.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&I.push("name"+et+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&I.push(":enabled",":disabled"),O.appendChild(t).disabled=1,2!==t.querySelectorAll(":disabled").length&&I.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),I.push(",.*:")})),(b.matchesSelector=gt.test(R=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&r(function(t){b.disconnectedMatch=R.call(t,"*"),R.call(t,"[s!='']:x"),z.push("!=",rt)}),I=I.length&&RegExp(I.join("|")),z=z.length&&RegExp(z.join("|")),e=gt.test(O.compareDocumentPosition),F=e||gt.test(O.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return 1;return 0},q=e?function(t,e){if(t===e)return P=1,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n||(1&(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!b.sortDetached&&e.compareDocumentPosition(t)===n?t===N||t.ownerDocument===B&&F(B,t)?-1:e===N||e.ownerDocument===B&&F(B,e)?1:C?K(C,t)-K(C,e):0:4&n?-1:1)}:function(t,e){if(t===e)return P=1,0;var n,i=0,r=t.parentNode,o=e.parentNode,s=[t],c=[e];if(!r||!o)return t===N?-1:e===N?1:r?-1:o?1:C?K(C,t)-K(C,e):0;if(r===o)return a(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)c.unshift(n);for(;s[i]===c[i];)i++;return i?a(s[i],c[i]):s[i]===B?-1:c[i]===B?1:0},N):N},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==N&&E(t),b.matchesSelector&&D&&!H[n+" "]&&(!z||!z.test(n))&&(!I||!I.test(n)))try{var i=R.call(t,n);if(i||b.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){H(n,1)}return e(n,N,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==N&&E(t),F(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==N&&E(t);var n=_.attrHandle[e.toLowerCase()],i=n&&X.call(_.attrHandle,e.toLowerCase())?n(t,e,!D):void 0;return void 0!==i?i:b.attributes||!D?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},e.escape=function(t){return(t+"").replace(_t,wt)},e.error=function(t){throw Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],i=0,r=0;if(P=!b.detectDuplicates,C=!b.sortStable&&t.slice(0),t.sort(q),P){for(;e=t[r++];)e===t[r]&&(i=n.push(r));for(;i--;)t.splice(n[i],1)}return C=null,t},w=e.getText=function(t){var e,n="",i=0,r=t.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=w(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[i++];)n+=w(e);return n},(_=e.selectors={cacheLength:50,createPseudo:i,match:pt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:1}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:1},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(xt,bt),t[3]=(t[3]||t[4]||t[5]||"").replace(xt,bt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return pt.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&ut.test(n)&&(e=S(n,1))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(xt,bt).toLowerCase();return"*"===t?function(){return 1}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=V[t+" "];return e||(e=RegExp("(^|"+et+")"+t+"("+et+"|$)"))&&V(t,function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,i){return function(r){var o=e.attr(r,t);return null==o?"!="===n:n?(o+="","="===n?o===i:"!="===n?o!==i:"^="===n?i&&0===o.indexOf(i):"*="===n?i&&o.indexOf(i)>-1:"$="===n?i&&o.slice(-i.length)===i:"~="===n?(" "+o.replace(ot," ")+" ").indexOf(i)>-1:"|="===n?o===i||o.slice(0,i.length+1)===i+"-":0):1}},CHILD:function(t,e,n,i,r){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===i&&0===r?function(t){return!!t.parentNode}:function(e,n,c){var l,u,h,p,d,f,m=o!==a?"nextSibling":"previousSibling",g=e.parentNode,v=s&&e.nodeName.toLowerCase(),y=!c&&!s,x=0;if(g){if(o){for(;m;){for(p=e;p=p[m];)if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return 0;f=m="only"===t&&!f&&"nextSibling"}return 1}if(f=[a?g.firstChild:g.lastChild],a&&y){for(x=(d=(l=(u=(h=(p=g)[k]||(p[k]={}))[p.uniqueID]||(h[p.uniqueID]={}))[t]||[])[0]===U&&l[1])&&l[2],p=d&&g.childNodes[d];p=++d&&p&&p[m]||(x=d=0)||f.pop();)if(1===p.nodeType&&++x&&p===e){u[t]=[U,d,x];break}}else if(y&&(x=d=(l=(u=(h=(p=e)[k]||(p[k]={}))[p.uniqueID]||(h[p.uniqueID]={}))[t]||[])[0]===U&&l[1]),0==x)for(;(p=++d&&p&&p[m]||(x=d=0)||f.pop())&&((s?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++x||(y&&((u=(h=p[k]||(p[k]={}))[p.uniqueID]||(h[p.uniqueID]={}))[t]=[U,x]),p!==e)););return(x-=r)===i||x%i==0&&x/i>=0}}},PSEUDO:function(t,n){var r,o=_.pseudos[t]||_.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return o[k]?o(n):o.length>1?(r=[t,t,"",n],_.setFilters.hasOwnProperty(t.toLowerCase())?i(function(t,e){for(var i,r=o(t,n),a=r.length;a--;)t[i=K(t,r[a])]=!(e[i]=r[a])}):function(t){return o(t,0,r)}):o}},pseudos:{not:i(function(t){var e=[],n=[],r=T(t.replace(at,"$1"));return r[k]?i(function(t,e,n,i){for(var o,a=r(t,null,i,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))}):function(t,i,o){return e[0]=t,r(e,null,o,n),e[0]=null,!n.pop()}}),has:i(function(t){return function(n){return e(t,n).length>0}}),contains:i(function(t){return t=t.replace(xt,bt),function(e){return(e.textContent||w(e)).indexOf(t)>-1}}),lang:i(function(t){return ht.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(xt,bt).toLowerCase(),function(e){var n;do{if(n=D?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return 0}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===O},focus:function(t){return t===N.activeElement&&(!N.hasFocus||N.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:l(0),disabled:l(1),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,1==t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return 0;return 1},parent:function(t){return!_.pseudos.empty(t)},header:function(t){return mt.test(t.nodeName)},input:function(t){return ft.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:u(function(){return[0]}),last:u(function(t,e){return[e-1]}),eq:u(function(t,e,n){return[n<0?n+e:n]}),even:u(function(t,e){for(var n=0;n<e;n+=2)t.push(n);return t}),odd:u(function(t,e){for(var n=1;n<e;n+=2)t.push(n);return t}),lt:u(function(t,e,n){for(var i=n<0?n+e:n>e?e:n;--i>=0;)t.push(i);return t}),gt:u(function(t,e,n){for(var i=n<0?n+e:n;++i<e;)t.push(i);return t})}}).pseudos.nth=_.pseudos.eq,{radio:1,checkbox:1,file:1,password:1,image:1})_.pseudos[x]=s(x);for(x in{submit:1,reset:1})_.pseudos[x]=c(x);return p.prototype=_.filters=_.pseudos,_.setFilters=new p,S=e.tokenize=function(t,n){var i,r,o,a,s,c,l,u=G[t+" "];if(u)return n?0:u.slice(0);for(s=t,c=[],l=_.preFilter;s;){for(a in i&&!(r=st.exec(s))||(r&&(s=s.slice(r[0].length)||s),c.push(o=[])),i=0,(r=ct.exec(s))&&(i=r.shift(),o.push({value:i,type:r[0].replace(at," ")}),s=s.slice(i.length)),_.filter)!(r=pt[a].exec(s))||l[a]&&!(r=l[a](r))||(i=r.shift(),o.push({value:i,type:a,matches:r}),s=s.slice(i.length));if(!i)break}return n?s.length:s?e.error(t):G(t,c).slice(0)},T=e.compile=function(t,n){var r,o=[],a=[],s=W[t+" "];if(!s){for(n||(n=S(t)),r=n.length;r--;)(s=y(n[r]))[k]?o.push(s):a.push(s);(s=W(t,function(t,n){var r=n.length>0,o=t.length>0,a=function(i,a,s,c,l){var u,h,p,d=0,f="0",m=i&&[],v=[],y=L,x=i||o&&_.find.TAG("*",l),b=U+=null==y?1:Math.random()||.1,w=x.length;for(l&&(L=a===N||a||l);f!==w&&null!=(u=x[f]);f++){if(o&&u){for(h=0,a||u.ownerDocument===N||(E(u),s=!D);p=t[h++];)if(p(u,a||N,s)){c.push(u);break}l&&(U=b)}r&&((u=!p&&u)&&d--,i&&m.push(u))}if(d+=f,r&&f!==d){for(h=0;p=n[h++];)p(m,v,a,s);if(i){if(d>0)for(;f--;)m[f]||v[f]||(v[f]=Z.call(c));v=g(v)}$.apply(c,v),l&&!i&&v.length>0&&d+n.length>1&&e.uniqueSort(c)}return l&&(U=b,L=y),m};return r?i(a):a}(a,o))).selector=t}return s},A=e.select=function(t,e,n,i){var r,o,a,s,c,l="function"==typeof t&&t,u=!i&&S(t=l.selector||t);if(n=n||[],1===u.length){if((o=u[0]=u[0].slice(0)).length>2&&"ID"===(a=o[0]).type&&9===e.nodeType&&D&&_.relative[o[1].type]){if(!(e=(_.find.ID(a.matches[0].replace(xt,bt),e)||[])[0]))return n;l&&(e=e.parentNode),t=t.slice(o.shift().value.length)}for(r=pt.needsContext.test(t)?0:o.length;r--&&(a=o[r],!_.relative[s=a.type]);)if((c=_.find[s])&&(i=c(a.matches[0].replace(xt,bt),yt.test(o[0].type)&&h(e.parentNode)||e))){if(o.splice(r,1),!(t=i.length&&d(o)))return $.apply(n,i),n;break}}return(l||T(t,u))(i,e,!D,n,!e||yt.test(t)&&h(e.parentNode)||e),n},b.sortStable=k.split("").sort(q).join("")===k,b.detectDuplicates=!!P,E(),b.sortDetached=r(function(t){return 1&t.compareDocumentPosition(N.createElement("fieldset"))}),r(function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")})||o("type|href|height|width",function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),b.attributes&&r(function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||o("value",function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),r(function(t){return null==t.getAttribute("disabled")})||o(tt,function(t,e,n){var i;if(!n)return 1==t[e]?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null}),e}(t),Ze.find=K,Ze.expr=K.selectors,Ze.expr[":"]=Ze.expr.pseudos,Ze.uniqueSort=Ze.unique=K.uniqueSort,Ze.text=K.getText,Ze.isXMLDoc=K.isXML,Ze.contains=K.contains,Ze.escapeSelector=K.escape,tt=function(t,e,n){for(var i=[],r=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&Ze(t).is(n))break;i.push(t)}return i},et=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},nt=Ze.expr.match.needsContext,it=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Ze.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?Ze.find.matchesSelector(i,t)?[i]:[]:Ze.find.matches(t,Ze.grep(e,function(t){return 1===t.nodeType}))},Ze.fn.extend({find:function(t){var e,n,i=this.length,r=this;if("string"!=typeof t)return this.pushStack(Ze(t).filter(function(){for(e=0;e<i;e++)if(Ze.contains(r[e],this))return 1}));for(n=this.pushStack([]),e=0;e<i;e++)Ze.find(t,r[e],n);return i>1?Ze.uniqueSort(n):n},filter:function(t){return this.pushStack(a(this,t||[],0))},not:function(t){return this.pushStack(a(this,t||[],1))},is:function(t){return!!a(this,"string"==typeof t&&nt.test(t)?Ze(t):t||[],0).length}}),ot=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,(Ze.fn.init=function(t,e,n){var i,r;if(!t)return this;if(n=n||rt,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:ot.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof Ze?e[0]:e,Ze.merge(this,Ze.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:Ie,1)),it.test(i[1])&&Ze.isPlainObject(e))for(i in e)qe(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(r=Ie.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):qe(t)?void 0!==n.ready?n.ready(t):t(Ze):Ze.makeArray(t,this)}).prototype=Ze.fn,rt=Ze(Ie),at=/^(?:parents|prev(?:Until|All))/,st={children:1,contents:1,next:1,prev:1},Ze.fn.extend({has:function(t){var e=Ze(t,this),n=e.length;return this.filter(function(){for(var t=0;t<n;t++)if(Ze.contains(this,e[t]))return 1})},closest:function(t,e){var n,i=0,r=this.length,o=[],a="string"!=typeof t&&Ze(t);if(!nt.test(t))for(;i<r;i++)for(n=this[i];n&&n!==e;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&Ze.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?Ze.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?Be.call(Ze(t),this[0]):Be.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(Ze.uniqueSort(Ze.merge(this.get(),Ze(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),Ze.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return tt(t,"parentNode")},parentsUntil:function(t,e,n){return tt(t,"parentNode",n)},next:function(t){return s(t,"nextSibling")},prev:function(t){return s(t,"previousSibling")},nextAll:function(t){return tt(t,"nextSibling")},prevAll:function(t){return tt(t,"previousSibling")},nextUntil:function(t,e,n){return tt(t,"nextSibling",n)},prevUntil:function(t,e,n){return tt(t,"previousSibling",n)},siblings:function(t){return et((t.parentNode||{}).firstChild,t)},children:function(t){return et(t.firstChild)},contents:function(t){return void 0!==t.contentDocument?t.contentDocument:(o(t,"template")&&(t=t.content||t),Ze.merge([],t.childNodes))}},function(t,e){Ze.fn[t]=function(n,i){var r=Ze.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=Ze.filter(i,r)),this.length>1&&(st[t]||Ze.uniqueSort(r),at.test(t)&&r.reverse()),this.pushStack(r)}}),ct=/[^\x20\t\r\n\f]+/g,Ze.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return Ze.each(t.match(ct)||[],function(t,n){e[n]=1}),e}(t):Ze.extend({},t);var e,n,r,o,a=[],s=[],c=-1,l=function(){for(o=o||t.once,r=e=1;s.length;c=-1)for(n=s.shift();++c<a.length;)0==a[c].apply(n[0],n[1])&&t.stopOnFalse&&(c=a.length,n=0);t.memory||(n=0),e=0,o&&(a=n?[]:"")},u={add:function(){return a&&(n&&!e&&(c=a.length-1,s.push(n)),function e(n){Ze.each(n,function(n,r){qe(r)?t.unique&&u.has(r)||a.push(r):r&&r.length&&"string"!==i(r)&&e(r)})}(arguments),n&&!e&&l()),this},remove:function(){return Ze.each(arguments,function(t,e){for(var n;(n=Ze.inArray(e,a,n))>-1;)a.splice(n,1),n<=c&&c--}),this},has:function(t){return t?Ze.inArray(t,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return o=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return o=s=[],n||e||(a=n=""),this},locked:function(){return!!o},fireWith:function(t,n){return o||(n=[t,(n=n||[]).slice?n.slice():n],s.push(n),e||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!r}};return u},Ze.extend({Deferred:function(e){var n=[["notify","progress",Ze.Callbacks("memory"),Ze.Callbacks("memory"),2],["resolve","done",Ze.Callbacks("once memory"),Ze.Callbacks("once memory"),0,"resolved"],["reject","fail",Ze.Callbacks("once memory"),Ze.Callbacks("once memory"),1,"rejected"]],i="pending",r={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return r.then(null,t)},pipe:function(){var t=arguments;return Ze.Deferred(function(e){Ze.each(n,function(n,i){var r=qe(t[i[4]])&&t[i[4]];o[i[1]](function(){var t=r&&r.apply(this,arguments);t&&qe(t.promise)?t.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[i[0]+"With"](this,r?[t]:arguments)})}),t=null}).promise()},then:function(e,i,r){function o(e,n,i,r){return function(){var s=this,u=arguments,h=function(){var t,h;if(!(e<a)){if((t=i.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");h=t&&("object"==typeof t||"function"==typeof t)&&t.then,qe(h)?r?h.call(t,o(a,n,c,r),o(a,n,l,r)):(a++,h.call(t,o(a,n,c,r),o(a,n,l,r),o(a,n,c,n.notifyWith))):(i!==c&&(s=void 0,u=[t]),(r||n.resolveWith)(s,u))}},p=r?h:function(){try{h()}catch(t){Ze.Deferred.exceptionHook&&Ze.Deferred.exceptionHook(t,p.stackTrace),e+1>=a&&(i!==l&&(s=void 0,u=[t]),n.rejectWith(s,u))}};e?p():(Ze.Deferred.getStackHook&&(p.stackTrace=Ze.Deferred.getStackHook()),t.setTimeout(p))}}var a=0;return Ze.Deferred(function(t){n[0][3].add(o(0,t,qe(r)?r:c,t.notifyWith)),n[1][3].add(o(0,t,qe(e)?e:c)),n[2][3].add(o(0,t,qe(i)?i:l))}).promise()},promise:function(t){return null!=t?Ze.extend(t,r):r}},o={};return Ze.each(n,function(t,e){var a=e[2],s=e[5];r[e[1]]=a.add,s&&a.add(function(){i=s},n[3-t][2].disable,n[3-t][3].disable,n[0][2].lock,n[0][3].lock),a.add(e[3].fire),o[e[0]]=function(){return o[e[0]+"With"](this===o?void 0:this,arguments),this},o[e[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(t){var e=arguments.length,n=e,i=Array(n),r=Re.call(arguments),o=Ze.Deferred(),a=function(t){return function(n){i[t]=this,r[t]=arguments.length>1?Re.call(arguments):n,--e||o.resolveWith(i,r)}};if(e<=1&&(u(t,o.done(a(n)).resolve,o.reject,!e),"pending"===o.state()||qe(r[n]&&r[n].then)))return o.then();for(;n--;)u(r[n],a(n),o.reject);return o.promise()}}),lt=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/,Ze.Deferred.exceptionHook=function(e,n){t.console&&t.console.warn&&e&&lt.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,n)},Ze.readyException=function(e){t.setTimeout(function(){throw e})},ut=Ze.Deferred(),Ze.fn.ready=function(t){return ut.then(t).catch(function(t){Ze.readyException(t)}),this},Ze.extend({isReady:0,readyWait:1,ready:function(t){(1==t?--Ze.readyWait:Ze.isReady)||(Ze.isReady=1,1!=t&&--Ze.readyWait>0||ut.resolveWith(Ie,[Ze]))}}),Ze.ready.then=ut.then,"complete"===Ie.readyState||"loading"!==Ie.readyState&&!Ie.documentElement.doScroll?t.setTimeout(Ze.ready):(Ie.addEventListener("DOMContentLoaded",h),t.addEventListener("load",h)),ht=function(t,e,n,r,o,a,s){var c=0,l=t.length,u=null==n;if("object"===i(n))for(c in o=1,n)ht(t,e,c,n[c],1,a,s);else if(void 0!==r&&(o=1,qe(r)||(s=1),u&&(s?(e.call(t,r),e=null):(u=e,e=function(t,e,n){return u.call(Ze(t),n)})),e))for(;c<l;c++)e(t[c],n,s?r:r.call(t[c],c,e(t[c],n)));return o?t:u?e.call(t):l?e(t[0],n):a},pt=/^-ms-/,dt=/-([a-z])/g,ft=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType},f.uid=1,f.prototype={cache:function(t){var e=t[this.expando];return e||(e={},ft(t)&&(t.nodeType?t[this.expando]=e:Object.defineProperty(t,this.expando,{value:e,configurable:1}))),e},set:function(t,e,n){var i,r=this.cache(t);if("string"==typeof e)r[d(e)]=n;else for(i in e)r[d(i)]=e[i];return r},get:function(t,e){return void 0===e?this.cache(t):t[this.expando]&&t[this.expando][d(e)]},access:function(t,e,n){return void 0===e||e&&"string"==typeof e&&void 0===n?this.get(t,e):(this.set(t,e,n),void 0!==n?n:e)},remove:function(t,e){var n,i=t[this.expando];if(void 0!==i){if(void 0!==e){n=(e=Array.isArray(e)?e.map(d):(e=d(e))in i?[e]:e.match(ct)||[]).length;for(;n--;)delete i[e[n]]}(void 0===e||Ze.isEmptyObject(i))&&(t.nodeType?t[this.expando]=void 0:delete t[this.expando])}},hasData:function(t){var e=t[this.expando];return void 0!==e&&!Ze.isEmptyObject(e)}},mt=new f,gt=new f,vt=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,yt=/[A-Z]/g,Ze.extend({hasData:function(t){return gt.hasData(t)||mt.hasData(t)},data:function(t,e,n){return gt.access(t,e,n)},removeData:function(t,e){gt.remove(t,e)},_data:function(t,e,n){return mt.access(t,e,n)},_removeData:function(t,e){mt.remove(t,e)}}),Ze.fn.extend({data:function(t,e){var n,i,r,o=this[0],a=o&&o.attributes;if(void 0===t){if(this.length&&(r=gt.get(o),1===o.nodeType&&!mt.get(o,"hasDataAttrs"))){for(n=a.length;n--;)a[n]&&0===(i=a[n].name).indexOf("data-")&&(i=d(i.slice(5)),m(o,i,r[i]));mt.set(o,"hasDataAttrs",1)}return r}return"object"==typeof t?this.each(function(){gt.set(this,t)}):ht(this,function(e){var n;if(o&&void 0===e)return void 0!==(n=gt.get(o,t))?n:void 0!==(n=m(o,t))?n:void 0;this.each(function(){gt.set(this,t,e)})},null,e,arguments.length>1,null,1)},removeData:function(t){return this.each(function(){gt.remove(this,t)})}}),Ze.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=mt.get(t,e),n&&(!i||Array.isArray(n)?i=mt.access(t,e,Ze.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=Ze.queue(t,e),i=n.length,r=n.shift(),o=Ze._queueHooks(t,e);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===e&&n.unshift("inprogress"),delete o.stop,r.call(t,function(){Ze.dequeue(t,e)},o)),!i&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return mt.get(t,n)||mt.access(t,n,{empty:Ze.Callbacks("once memory").add(function(){mt.remove(t,[e+"queue",n])})})}}),Ze.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length<n?Ze.queue(this[0],t):void 0===e?this:this.each(function(){var n=Ze.queue(this,t,e);Ze._queueHooks(this,t),"fx"===t&&"inprogress"!==n[0]&&Ze.dequeue(this,t)})},dequeue:function(t){return this.each(function(){Ze.dequeue(this,t)})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var n,i=1,r=Ze.Deferred(),o=this,a=this.length,s=function(){--i||r.resolveWith(o,[o])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";a--;)(n=mt.get(o[a],t+"queueHooks"))&&n.empty&&(i++,n.empty.add(s));return s(),r.promise(e)}}),bt=RegExp("^(?:([+-])=|)("+(xt=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source)+")([a-z%]*)$","i"),_t=["Top","Right","Bottom","Left"],wt=Ie.documentElement,Mt=function(t){return Ze.contains(t.ownerDocument,t)},St={composed:1},wt.getRootNode&&(Mt=function(t){return Ze.contains(t.ownerDocument,t)||t.getRootNode(St)===t.ownerDocument}),Tt=function(t,e){return"none"===(t=e||t).style.display||""===t.style.display&&Mt(t)&&"none"===Ze.css(t,"display")},At=function(t,e,n,i){var r,o,a={};for(o in e)a[o]=t.style[o],t.style[o]=e[o];for(o in r=n.apply(t,i||[]),e)t.style[o]=a[o];return r},Lt={},Ze.fn.extend({show:function(){return y(this,1)},hide:function(){return y(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Tt(this)?Ze(this).show():Ze(this).hide()})}}),Ct=/^(?:checkbox|radio)$/i,Pt=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Et=/^$|^module$|\/(?:java|ecma)script/i,(Nt={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]}).optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,Ot=/<|&#?\w+;/,Ee=Ie.createDocumentFragment().appendChild(Ie.createElement("div")),(Ne=Ie.createElement("input")).setAttribute("type","radio"),Ne.setAttribute("checked","checked"),Ne.setAttribute("name","t"),Ee.appendChild(Ne),He.checkClone=Ee.cloneNode(1).cloneNode(1).lastChild.checked,Ee.innerHTML="<textarea>x</textarea>",He.noCloneChecked=!!Ee.cloneNode(1).lastChild.defaultValue,Dt=/^key/,It=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,zt=/^([^.]*)(?:\.(.+)|)/,Ze.event={global:{},add:function(t,e,n,i,r){var o,a,s,c,l,u,h,p,d,f,m,g=mt.get(t);if(g)for(n.handler&&(n=(o=n).handler,r=o.selector),r&&Ze.find.matchesSelector(wt,r),n.guid||(n.guid=Ze.guid++),(c=g.events)||(c=g.events={}),(a=g.handle)||(a=g.handle=function(e){return void 0!==Ze&&Ze.event.triggered!==e.type?Ze.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(ct)||[""]).length;l--;)d=m=(s=zt.exec(e[l])||[])[1],f=(s[2]||"").split(".").sort(),d&&(h=Ze.event.special[d]||{},d=(r?h.delegateType:h.bindType)||d,h=Ze.event.special[d]||{},u=Ze.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&Ze.expr.match.needsContext.test(r),namespace:f.join(".")},o),(p=c[d])||((p=c[d]=[]).delegateCount=0,h.setup&&0!=h.setup.call(t,i,f,a)||t.addEventListener&&t.addEventListener(d,a)),h.add&&(h.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),r?p.splice(p.delegateCount++,0,u):p.push(u),Ze.event.global[d]=1)},remove:function(t,e,n,i,r){var o,a,s,c,l,u,h,p,d,f,m,g=mt.hasData(t)&&mt.get(t);if(g&&(c=g.events)){for(l=(e=(e||"").match(ct)||[""]).length;l--;)if(d=m=(s=zt.exec(e[l])||[])[1],f=(s[2]||"").split(".").sort(),d){for(h=Ze.event.special[d]||{},p=c[d=(i?h.delegateType:h.bindType)||d]||[],s=s[2]&&RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;o--;)u=p[o],!r&&m!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(p.splice(o,1),u.selector&&p.delegateCount--,h.remove&&h.remove.call(t,u));a&&!p.length&&(h.teardown&&0!=h.teardown.call(t,f,g.handle)||Ze.removeEvent(t,d,g.handle),delete c[d])}else for(d in c)Ze.event.remove(t,d+e[l],n,i,1);Ze.isEmptyObject(c)&&mt.remove(t,"handle events")}},dispatch:function(t){var e,n,i,r,o,a,s=Ze.event.fix(t),c=Array(arguments.length),l=(mt.get(this,"events")||{})[s.type]||[],u=Ze.event.special[s.type]||{};for(c[0]=s,e=1;e<arguments.length;e++)c[e]=arguments[e];if(s.delegateTarget=this,!u.preDispatch||0!=u.preDispatch.call(this,s)){for(a=Ze.event.handlers.call(this,s,l),e=0;(r=a[e++])&&!s.isPropagationStopped();)for(s.currentTarget=r.elem,n=0;(o=r.handlers[n++])&&!s.isImmediatePropagationStopped();)s.rnamespace&&0!=o.namespace&&!s.rnamespace.test(o.namespace)||(s.handleObj=o,s.data=o.data,void 0!==(i=((Ze.event.special[o.origType]||{}).handle||o.handler).apply(r.elem,c))&&0==(s.result=i)&&(s.preventDefault(),s.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,s),s.result}},handlers:function(t,e){var n,i,r,o,a,s=[],c=e.delegateCount,l=t.target;if(c&&l.nodeType&&!("click"===t.type&&t.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==t.type||1!=l.disabled)){for(o=[],a={},n=0;n<c;n++)void 0===a[r=(i=e[n]).selector+" "]&&(a[r]=i.needsContext?Ze(r,this).index(l)>-1:Ze.find(r,this,null,[l]).length),a[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return l=this,c<e.length&&s.push({elem:l,handlers:e.slice(c)}),s},addProp:function(t,e){Object.defineProperty(Ze.Event.prototype,t,{enumerable:1,configurable:1,get:qe(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:1,configurable:1,writable:1,value:e})}})},fix:function(t){return t[Ze.expando]?t:new Ze.Event(t)},special:{load:{noBubble:1},click:{setup:function(t){var e=this||t;return Ct.test(e.type)&&e.click&&o(e,"input")&&A(e,"click",w),0},trigger:function(t){var e=this||t;return Ct.test(e.type)&&e.click&&o(e,"input")&&A(e,"click"),1},_default:function(t){var e=t.target;return Ct.test(e.type)&&e.click&&o(e,"input")&&mt.get(e,"click")||o(e,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}}},Ze.removeEvent=function(t,e,n){t.removeEventListener&&t.removeEventListener(e,n)},Ze.Event=function(t,e){if(!(this instanceof Ze.Event))return new Ze.Event(t,e);t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&0==t.returnValue?w:M,this.target=t.target&&3===t.target.nodeType?t.target.parentNode:t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget):this.type=t,e&&Ze.extend(this,e),this.timeStamp=t&&t.timeStamp||Date.now(),this[Ze.expando]=1},Ze.Event.prototype={constructor:Ze.Event,isDefaultPrevented:M,isPropagationStopped:M,isImmediatePropagationStopped:M,isSimulated:0,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=w,t&&!this.isSimulated&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=w,t&&!this.isSimulated&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=w,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()}},Ze.each({altKey:1,bubbles:1,cancelable:1,changedTouches:1,ctrlKey:1,detail:1,eventPhase:1,metaKey:1,pageX:1,pageY:1,shiftKey:1,view:1,char:1,code:1,charCode:1,key:1,keyCode:1,button:1,buttons:1,clientX:1,clientY:1,offsetX:1,offsetY:1,pointerId:1,pointerType:1,screenX:1,screenY:1,targetTouches:1,toElement:1,touches:1,which:function(t){var e=t.button;return null==t.which&&Dt.test(t.type)?null!=t.charCode?t.charCode:t.keyCode:!t.which&&void 0!==e&&It.test(t.type)?1&e?1:2&e?3:4&e?2:0:t.which}},Ze.event.addProp),Ze.each({focus:"focusin",blur:"focusout"},function(t,e){Ze.event.special[t]={setup:function(){return A(this,t,S),0},trigger:function(){return A(this,t),1},delegateType:e}}),Ze.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(t,e){Ze.event.special[t]={delegateType:e,bindType:e,handle:function(t){var n,i=this,r=t.relatedTarget,o=t.handleObj;return r&&(r===i||Ze.contains(i,r))||(t.type=o.origType,n=o.handler.apply(this,arguments),t.type=e),n}}}),Ze.fn.extend({on:function(t,e,n,i){return T(this,t,e,n,i)},one:function(t,e,n,i){return T(this,t,e,n,i,1)},off:function(t,e,n){var i,r;if(t&&t.preventDefault&&t.handleObj)return i=t.handleObj,Ze(t.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof t){for(r in t)this.off(r,e,t[r]);return this}return 0!=e&&"function"!=typeof e||(n=e,e=void 0),0==n&&(n=M),this.each(function(){Ze.event.remove(this,t,n,e)})}}),Rt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ft=/<script|<style|<link/i,kt=/checked\s*(?:[^=]|=\s*.checked.)/i,Bt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ze.extend({htmlPrefilter:function(t){return t.replace(Rt,"<$1></$2>")},clone:function(t,e,n){var i,r,o,a,s=t.cloneNode(1),c=Mt(t);if(!(He.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||Ze.isXMLDoc(t)))for(a=x(s),i=0,r=(o=x(t)).length;i<r;i++)N(o[i],a[i]);if(e)if(n)for(o=o||x(t),a=a||x(s),i=0,r=o.length;i<r;i++)E(o[i],a[i]);else E(t,s);return(a=x(s,"script")).length>0&&b(a,!c&&x(t,"script")),s},cleanData:function(t){for(var e,n,i,r=Ze.event.special,o=0;void 0!==(n=t[o]);o++)if(ft(n)){if(e=n[mt.expando]){if(e.events)for(i in e.events)r[i]?Ze.event.remove(n,i):Ze.removeEvent(n,i,e.handle);n[mt.expando]=void 0}n[gt.expando]&&(n[gt.expando]=void 0)}}}),Ze.fn.extend({detach:function(t){return D(this,t,1)},remove:function(t){return D(this,t)},text:function(t){return ht(this,function(t){return void 0===t?Ze.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return O(this,arguments,function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||L(this,t).appendChild(t)})},prepend:function(){return O(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=L(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return O(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return O(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(Ze.cleanData(x(t,0)),t.textContent="");return this},clone:function(t,e){return t=null==t?0:t,e=null==e?t:e,this.map(function(){return Ze.clone(this,t,e)})},html:function(t){return ht(this,function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Ft.test(t)&&!Nt[(Pt.exec(t)||["",""])[1].toLowerCase()]){t=Ze.htmlPrefilter(t);try{for(;n<i;n++)1===(e=this[n]||{}).nodeType&&(Ze.cleanData(x(e,0)),e.innerHTML=t);e=0}catch(t){}}e&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=[];return O(this,arguments,function(e){var n=this.parentNode;Ze.inArray(this,t)<0&&(Ze.cleanData(x(this)),n&&n.replaceChild(e,this))},t)}}),Ze.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){Ze.fn[t]=function(t){for(var n,i=[],r=Ze(t),o=r.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(1),Ze(r[a])[e](n),ke.apply(i,n.get());return this.pushStack(i)}}),Ut=RegExp("^("+xt+")(?!px)[a-z%]+$","i"),jt=function(e){var n=e.ownerDocument.defaultView;return n&&n.opener||(n=t),n.getComputedStyle(e)},Vt=RegExp(_t.join("|"),"i"),function(){function e(){if(l){c.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",wt.appendChild(c).appendChild(l);var e=t.getComputedStyle(l);i="1%"!==e.top,s=12===n(e.marginLeft),l.style.right="60%",a=36===n(e.right),r=36===n(e.width),l.style.position="absolute",o=12===n(l.offsetWidth/3),wt.removeChild(c),l=null}}function n(t){return Math.round(parseFloat(t))}var i,r,o,a,s,c=Ie.createElement("div"),l=Ie.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(1).style.backgroundClip="",He.clearCloneStyle="content-box"===l.style.backgroundClip,Ze.extend(He,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),a},pixelPosition:function(){return e(),i},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),o}}))}(),Gt=["Webkit","Moz","ms"],Wt=Ie.createElement("div").style,Ht={},qt=/^(none|table(?!-c[ea]).+)/,Xt=/^--/,Yt={position:"absolute",visibility:"hidden",display:"block"},Zt={letterSpacing:"0",fontWeight:"400"},Ze.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=I(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:1,columnCount:1,fillOpacity:1,flexGrow:1,flexShrink:1,fontWeight:1,gridArea:1,gridColumn:1,gridColumnEnd:1,gridColumnStart:1,gridRow:1,gridRowEnd:1,gridRowStart:1,lineHeight:1,opacity:1,order:1,orphans:1,widows:1,zIndex:1,zoom:1},cssProps:{},style:function(t,e,n,i){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var r,o,a,s=d(e),c=Xt.test(e),l=t.style;if(c||(e=R(s)),a=Ze.cssHooks[e]||Ze.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(r=a.get(t,0,i))?r:l[e];"string"==(o=typeof n)&&(r=bt.exec(n))&&r[1]&&(n=g(t,e,r),o="number"),null!=n&&n==n&&("number"!==o||c||(n+=r&&r[3]||(Ze.cssNumber[s]?"":"px")),He.clearCloneStyle||""!==n||0!==e.indexOf("background")||(l[e]="inherit"),a&&"set"in a&&void 0===(n=a.set(t,n,i))||(c?l.setProperty(e,n):l[e]=n))}},css:function(t,e,n,i){var r,o,a,s=d(e);return Xt.test(e)||(e=R(s)),(a=Ze.cssHooks[e]||Ze.cssHooks[s])&&"get"in a&&(r=a.get(t,1,n)),void 0===r&&(r=I(t,e,i)),"normal"===r&&e in Zt&&(r=Zt[e]),""===n||n?(o=parseFloat(r),1==n||isFinite(o)?o||0:r):r}}),Ze.each(["height","width"],function(t,e){Ze.cssHooks[e]={get:function(t,n,i){if(n)return!qt.test(Ze.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?B(t,e,i):At(t,Yt,function(){return B(t,e,i)})},set:function(t,n,i){var r,o=jt(t),a=!He.scrollboxSize()&&"absolute"===o.position,s=(a||i)&&"border-box"===Ze.css(t,"boxSizing",0,o),c=i?k(t,e,i,s,o):0;return s&&a&&(c-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(o[e])-k(t,e,"border",0,o)-.5)),c&&(r=bt.exec(n))&&"px"!==(r[3]||"px")&&(t.style[e]=n,n=Ze.css(t,e)),F(0,n,c)}}}),Ze.cssHooks.marginLeft=z(He.reliableMarginLeft,function(t,e){if(e)return(parseFloat(I(t,"marginLeft"))||t.getBoundingClientRect().left-At(t,{marginLeft:0},function(){return t.getBoundingClientRect().left}))+"px"}),Ze.each({margin:"",padding:"",border:"Width"},function(t,e){Ze.cssHooks[t+e]={expand:function(n){for(var i=0,r={},o="string"==typeof n?n.split(" "):[n];i<4;i++)r[t+_t[i]+e]=o[i]||o[i-2]||o[0];return r}},"margin"!==t&&(Ze.cssHooks[t+e].set=F)}),Ze.fn.extend({css:function(t,e){return ht(this,function(t,e,n){var i,r,o={},a=0;if(Array.isArray(e)){for(i=jt(t),r=e.length;a<r;a++)o[e[a]]=Ze.css(t,e[a],0,i);return o}return void 0!==n?Ze.style(t,e,n):Ze.css(t,e)},t,e,arguments.length>1)}}),Ze.Tween=U,U.prototype={constructor:U,init:function(t,e,n,i,r,o){this.elem=t,this.prop=n,this.easing=r||Ze.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=o||(Ze.cssNumber[n]?"":"px")},cur:function(){var t=U.propHooks[this.prop];return t&&t.get?t.get(this):U.propHooks._default.get(this)},run:function(t){var e,n=U.propHooks[this.prop];return this.options.duration?this.pos=e=Ze.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):U.propHooks._default.set(this),this}},U.prototype.init.prototype=U.prototype,U.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=Ze.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){Ze.fx.step[t.prop]?Ze.fx.step[t.prop](t):1!==t.elem.nodeType||!Ze.cssHooks[t.prop]&&null==t.elem.style[R(t.prop)]?t.elem[t.prop]=t.now:Ze.style(t.elem,t.prop,t.now+t.unit)}}},U.propHooks.scrollTop=U.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},Ze.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},Ze.fx=U.prototype.init,Ze.fx.step={},Qt=/^(?:toggle|show|hide)$/,Kt=/queueHooks$/,Ze.Animation=Ze.extend(H,{tweeners:{"*":[function(t,e){var n=this.createTween(t,e);return g(n.elem,t,bt.exec(e),n),n}]},tweener:function(t,e){qe(t)?(e=t,t=["*"]):t=t.match(ct);for(var n,i=0,r=t.length;i<r;i++)n=t[i],H.tweeners[n]=H.tweeners[n]||[],H.tweeners[n].unshift(e)},prefilters:[function(t,e,n){var i,r,o,a,s,c,l,u,h="width"in e||"height"in e,p=this,d={},f=t.style,m=t.nodeType&&Tt(t),g=mt.get(t,"fxshow");for(i in n.queue||(null==(a=Ze._queueHooks(t,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,Ze.queue(t,"fx").length||a.empty.fire()})})),e)if(r=e[i],Qt.test(r)){if(delete e[i],o=o||"toggle"===r,r===(m?"hide":"show")){if("show"!==r||!g||void 0===g[i])continue;m=1}d[i]=g&&g[i]||Ze.style(t,i)}if((c=!Ze.isEmptyObject(e))||!Ze.isEmptyObject(d))for(i in h&&1===t.nodeType&&(n.overflow=[f.overflow,f.overflowX,f.overflowY],null==(l=g&&g.display)&&(l=mt.get(t,"display")),"none"===(u=Ze.css(t,"display"))&&(l?u=l:(y([t],1),l=t.style.display||l,u=Ze.css(t,"display"),y([t]))),("inline"===u||"inline-block"===u&&null!=l)&&"none"===Ze.css(t,"float")&&(c||(p.done(function(){f.display=l}),null==l&&(u=f.display,l="none"===u?"":u)),f.display="inline-block")),n.overflow&&(f.overflow="hidden",p.always(function(){f.overflow=n.overflow[0],f.overflowX=n.overflow[1],f.overflowY=n.overflow[2]})),c=0,d)c||(g?"hidden"in g&&(m=g.hidden):g=mt.access(t,"fxshow",{display:l}),o&&(g.hidden=!m),m&&y([t],1),p.done(function(){for(i in m||y([t]),mt.remove(t,"fxshow"),d)Ze.style(t,i,d[i])})),c=W(m?g[i]:0,i,p),i in g||(g[i]=c.start,m&&(c.end=c.start,c.start=0))}],prefilter:function(t,e){e?H.prefilters.unshift(t):H.prefilters.push(t)}}),Ze.speed=function(t,e,n){var i=t&&"object"==typeof t?Ze.extend({},t):{complete:n||!n&&e||qe(t)&&t,duration:t,easing:n&&e||e&&!qe(e)&&e};return Ze.fx.off?i.duration=0:"number"!=typeof i.duration&&(i.duration in Ze.fx.speeds?i.duration=Ze.fx.speeds[i.duration]:i.duration=Ze.fx.speeds._default),null!=i.queue&&1!=i.queue||(i.queue="fx"),i.old=i.complete,i.complete=function(){qe(i.old)&&i.old.call(this),i.queue&&Ze.dequeue(this,i.queue)},i},Ze.fn.extend({fadeTo:function(t,e,n,i){return this.filter(Tt).css("opacity",0).show().end().animate({opacity:e},t,n,i)},animate:function(t,e,n,i){var r=Ze.isEmptyObject(t),o=Ze.speed(e,n,i),a=function(){var e=H(this,Ze.extend({},t),o);(r||mt.get(this,"finish"))&&e.stop(1)};return a.finish=a,r||0==o.queue?this.each(a):this.queue(o.queue,a)},stop:function(t,e,n){var i=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=e,e=t,t=void 0),e&&0!=t&&this.queue(t||"fx",[]),this.each(function(){var e=1,r=null!=t&&t+"queueHooks",o=Ze.timers,a=mt.get(this);if(r)a[r]&&a[r].stop&&i(a[r]);else for(r in a)a[r]&&a[r].stop&&Kt.test(r)&&i(a[r]);for(r=o.length;r--;)o[r].elem!==this||null!=t&&o[r].queue!==t||(o[r].anim.stop(n),e=0,o.splice(r,1));!e&&n||Ze.dequeue(this,t)})},finish:function(t){return 0!=t&&(t=t||"fx"),this.each(function(){var e,n=mt.get(this),i=n[t+"queue"],r=n[t+"queueHooks"],o=Ze.timers,a=i?i.length:0;for(n.finish=1,Ze.queue(this,t,[]),r&&r.stop&&r.stop.call(this,1),e=o.length;e--;)o[e].elem===this&&o[e].queue===t&&(o[e].anim.stop(1),o.splice(e,1));for(e=0;e<a;e++)i[e]&&i[e].finish&&i[e].finish.call(this);delete n.finish})}}),Ze.each(["toggle","show","hide"],function(t,e){var n=Ze.fn[e];Ze.fn[e]=function(t,i,r){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(G(e,1),t,i,r)}}),Ze.each({slideDown:G("show"),slideUp:G("hide"),slideToggle:G("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){Ze.fn[t]=function(t,n,i){return this.animate(e,t,n,i)}}),Ze.timers=[],Ze.fx.tick=function(){var t,e=0,n=Ze.timers;for(Jt=Date.now();e<n.length;e++)(t=n[e])()||n[e]!==t||n.splice(e--,1);n.length||Ze.fx.stop(),Jt=void 0},Ze.fx.timer=function(t){Ze.timers.push(t),Ze.fx.start()},Ze.fx.interval=13,Ze.fx.start=function(){$t||($t=1,j())},Ze.fx.stop=function(){$t=null},Ze.fx.speeds={slow:600,fast:200,_default:400},Ze.fn.delay=function(e,n){return e=Ze.fx&&Ze.fx.speeds[e]||e,n=n||"fx",this.queue(n,function(n,i){var r=t.setTimeout(n,e);i.stop=function(){t.clearTimeout(r)}})},function(){var t=Ie.createElement("input"),e=Ie.createElement("select").appendChild(Ie.createElement("option"));t.type="checkbox",He.checkOn=""!==t.value,He.optSelected=e.selected,(t=Ie.createElement("input")).value="t",t.type="radio",He.radioValue="t"===t.value}(),ee=Ze.expr.attrHandle,Ze.fn.extend({attr:function(t,e){return ht(this,Ze.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){Ze.removeAttr(this,t)})}}),Ze.extend({attr:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?Ze.prop(t,e,n):(1===o&&Ze.isXMLDoc(t)||(r=Ze.attrHooks[e.toLowerCase()]||(Ze.expr.match.bool.test(e)?te:void 0)),void 0!==n?null===n?void Ze.removeAttr(t,e):r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:(t.setAttribute(e,n+""),n):r&&"get"in r&&null!==(i=r.get(t,e))?i:null==(i=Ze.find.attr(t,e))?void 0:i)},attrHooks:{type:{set:function(t,e){if(!He.radioValue&&"radio"===e&&o(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,r=e&&e.match(ct);if(r&&1===t.nodeType)for(;n=r[i++];)t.removeAttribute(n)}}),te={set:function(t,e,n){return 0==e?Ze.removeAttr(t,n):t.setAttribute(n,n),n}},Ze.each(Ze.expr.match.bool.source.match(/\w+/g),function(t,e){var n=ee[e]||Ze.find.attr;ee[e]=function(t,e,i){var r,o,a=e.toLowerCase();return i||(o=ee[a],ee[a]=r,r=null!=n(t,e,i)?a:null,ee[a]=o),r}}),ne=/^(?:input|select|textarea|button)$/i,ie=/^(?:a|area)$/i,Ze.fn.extend({prop:function(t,e){return ht(this,Ze.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[Ze.propFix[t]||t]})}}),Ze.extend({prop:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&Ze.isXMLDoc(t)||(e=Ze.propFix[e]||e,r=Ze.propHooks[e]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:t[e]=n:r&&"get"in r&&null!==(i=r.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=Ze.find.attr(t,"tabindex");return e?parseInt(e,10):ne.test(t.nodeName)||ie.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),He.optSelected||(Ze.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),Ze.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){Ze.propFix[this.toLowerCase()]=this}),Ze.fn.extend({addClass:function(t){var e,n,i,r,o,a,s,c=0;if(qe(t))return this.each(function(e){Ze(this).addClass(t.call(this,e,X(this)))});if((e=Y(t)).length)for(;n=this[c++];)if(r=X(n),i=1===n.nodeType&&" "+q(r)+" "){for(a=0;o=e[a++];)i.indexOf(" "+o+" ")<0&&(i+=o+" ");r!==(s=q(i))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,i,r,o,a,s,c=0;if(qe(t))return this.each(function(e){Ze(this).removeClass(t.call(this,e,X(this)))});if(!arguments.length)return this.attr("class","");if((e=Y(t)).length)for(;n=this[c++];)if(r=X(n),i=1===n.nodeType&&" "+q(r)+" "){for(a=0;o=e[a++];)for(;i.indexOf(" "+o+" ")>-1;)i=i.replace(" "+o+" "," ");r!==(s=q(i))&&n.setAttribute("class",s)}return this},toggleClass:function(t,e){var n=typeof t,i="string"===n||Array.isArray(t);return"boolean"==typeof e&&i?e?this.addClass(t):this.removeClass(t):qe(t)?this.each(function(n){Ze(this).toggleClass(t.call(this,n,X(this),e),e)}):this.each(function(){var e,r,o,a;if(i)for(r=0,o=Ze(this),a=Y(t);e=a[r++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==n||((e=X(this))&&mt.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||0==t?"":mt.get(this,"__className__")||""))})},hasClass:function(t){var e,n,i=0;for(e=" "+t+" ";n=this[i++];)if(1===n.nodeType&&(" "+q(X(n))+" ").indexOf(e)>-1)return 1;return 0}}),re=/\r/g,Ze.fn.extend({val:function(t){var e,n,i,r=this[0];return arguments.length?(i=qe(t),this.each(function(n){var r;1===this.nodeType&&(null==(r=i?t.call(this,n,Ze(this).val()):t)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=Ze.map(r,function(t){return null==t?"":t+""})),(e=Ze.valHooks[this.type]||Ze.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,r,"value")||(this.value=r))})):r?(e=Ze.valHooks[r.type]||Ze.valHooks[r.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(re,""):null==n?"":n:void 0}}),Ze.extend({valHooks:{option:{get:function(t){var e=Ze.find.attr(t,"value");return null!=e?e:q(Ze.text(t))}},select:{get:function(t){var e,n,i,r=t.options,a=t.selectedIndex,s="select-one"===t.type,c=s?null:[],l=s?a+1:r.length;for(i=a<0?l:s?a:0;i<l;i++)if(((n=r[i]).selected||i===a)&&!n.disabled&&(!n.parentNode.disabled||!o(n.parentNode,"optgroup"))){if(e=Ze(n).val(),s)return e;c.push(e)}return c},set:function(t,e){for(var n,i,r=t.options,o=Ze.makeArray(e),a=r.length;a--;)((i=r[a]).selected=Ze.inArray(Ze.valHooks.option.get(i),o)>-1)&&(n=1);return n||(t.selectedIndex=-1),o}}}}),Ze.each(["radio","checkbox"],function(){Ze.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=Ze.inArray(Ze(t).val(),e)>-1}},He.checkOn||(Ze.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})}),He.focusin="onfocusin"in t,oe=/^(?:focusinfocus|focusoutblur)$/,ae=function(t){t.stopPropagation()},Ze.extend(Ze.event,{trigger:function(e,n,i,r){var o,a,s,c,l,u,h,p,d=[i||Ie],f=Ve.call(e,"type")?e.type:e,m=Ve.call(e,"namespace")?e.namespace.split("."):[];if(a=p=s=i=i||Ie,3!==i.nodeType&&8!==i.nodeType&&!oe.test(f+Ze.event.triggered)&&(f.indexOf(".")>-1&&(m=f.split("."),f=m.shift(),m.sort()),l=f.indexOf(":")<0&&"on"+f,(e=e[Ze.expando]?e:new Ze.Event(f,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),n=null==n?[e]:Ze.makeArray(n,[e]),h=Ze.event.special[f]||{},r||!h.trigger||0!=h.trigger.apply(i,n))){if(!r&&!h.noBubble&&!Xe(i)){for(c=h.delegateType||f,oe.test(c+f)||(a=a.parentNode);a;a=a.parentNode)d.push(a),s=a;s===(i.ownerDocument||Ie)&&d.push(s.defaultView||s.parentWindow||t)}for(o=0;(a=d[o++])&&!e.isPropagationStopped();)p=a,e.type=o>1?c:h.bindType||f,(u=(mt.get(a,"events")||{})[e.type]&&mt.get(a,"handle"))&&u.apply(a,n),(u=l&&a[l])&&u.apply&&ft(a)&&(e.result=u.apply(a,n),0==e.result&&e.preventDefault());return e.type=f,r||e.isDefaultPrevented()||h._default&&0!=h._default.apply(d.pop(),n)||!ft(i)||l&&qe(i[f])&&!Xe(i)&&((s=i[l])&&(i[l]=null),Ze.event.triggered=f,e.isPropagationStopped()&&p.addEventListener(f,ae),i[f](),e.isPropagationStopped()&&p.removeEventListener(f,ae),Ze.event.triggered=void 0,s&&(i[l]=s)),e.result}},simulate:function(t,e,n){var i=Ze.extend(new Ze.Event,n,{type:t,isSimulated:1});Ze.event.trigger(i,null,e)}}),Ze.fn.extend({trigger:function(t,e){return this.each(function(){Ze.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];if(n)return Ze.event.trigger(t,e,n,1)}}),He.focusin||Ze.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){Ze.event.simulate(e,t.target,Ze.event.fix(t))};Ze.event.special[e]={setup:function(){var i=this.ownerDocument||this,r=mt.access(i,e);r||i.addEventListener(t,n,1),mt.access(i,e,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this,r=mt.access(i,e)-1;r?mt.access(i,e,r):(i.removeEventListener(t,n,1),mt.remove(i,e))}}}),se=t.location,ce=Date.now(),le=/\?/,Ze.parseXML=function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||Ze.error("Invalid XML: "+e),n},ue=/\[\]$/,he=/\r?\n/g,pe=/^(?:submit|button|image|reset|file)$/i,de=/^(?:input|select|textarea|keygen)/i,Ze.param=function(t,e){var n,i=[],r=function(t,e){var n=qe(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!Ze.isPlainObject(t))Ze.each(t,function(){r(this.name,this.value)});else for(n in t)Z(n,t[n],e,r);return i.join("&")},Ze.fn.extend({serialize:function(){return Ze.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=Ze.prop(this,"elements");return t?Ze.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!Ze(this).is(":disabled")&&de.test(this.nodeName)&&!pe.test(t)&&(this.checked||!Ct.test(t))}).map(function(t,e){var n=Ze(this).val();return null==n?null:Array.isArray(n)?Ze.map(n,function(t){return{name:e.name,value:t.replace(he,"\r\n")}}):{name:e.name,value:n.replace(he,"\r\n")}}).get()}}),fe=/%20/g,me=/#.*$/,ge=/([?&])_=[^&]*/,ve=/^(.*?):[ \t]*([^\r\n]*)$/gm,ye=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,xe=/^(?:GET|HEAD)$/,be=/^\/\//,_e={},we={},"*/*",(Me=Ie.createElement("a")).href=se.href,Ze.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:se.href,type:"GET",isLocal:ye.test(se.protocol),global:1,processData:1,async:1,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":1,"text json":JSON.parse,"text xml":Ze.parseXML},flatOptions:{url:1,context:1}},ajaxSetup:function(t,e){return e?Q(Q(t,Ze.ajaxSettings),e):Q(Ze.ajaxSettings,t)},ajaxPrefilter:J(_e),ajaxTransport:J(we),ajax:function(e,n){function i(e,n,i,s){var l,p,d,b,_,w=n;u||(u=1,c&&t.clearTimeout(c),r=void 0,a=s||"",M.readyState=e>0?4:0,l=e>=200&&e<300||304===e,i&&(b=function(t,e,n){for(var i,r,o,a,s=t.contents,c=t.dataTypes;"*"===c[0];)c.shift(),void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"));if(i)for(r in s)if(s[r]&&s[r].test(i)){c.unshift(r);break}if(c[0]in n)o=c[0];else{for(r in n){if(!c[0]||t.converters[r+" "+c[0]]){o=r;break}a||(a=r)}o=o||a}if(o)return o!==c[0]&&c.unshift(o),n[o]}(f,M,i)),b=function(t,e,n,i){var r,o,a,s,c,l={},u=t.dataTypes.slice();if(u[1])for(a in t.converters)l[a.toLowerCase()]=t.converters[a];for(o=u.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!c&&i&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),c=o,o=u.shift())if("*"===o)o=c;else if("*"!==c&&c!==o){if(!(a=l[c+" "+o]||l["* "+o]))for(r in l)if((s=r.split(" "))[1]===o&&(a=l[c+" "+s[0]]||l["* "+s[0]])){1==a?a=l[r]:1!=l[r]&&(o=s[0],u.unshift(s[1]));break}if(1!=a)if(a&&t.throws)e=a(e);else try{e=a(e)}catch(t){return{state:"parsererror",error:a?t:"No conversion from "+c+" to "+o}}}return{state:"success",data:e}}(f,b,M,l),l?(f.ifModified&&((_=M.getResponseHeader("Last-Modified"))&&(Ze.lastModified[o]=_),(_=M.getResponseHeader("etag"))&&(Ze.etag[o]=_)),204===e||"HEAD"===f.type?w="nocontent":304===e?w="notmodified":(w=b.state,p=b.data,l=!(d=b.error))):(d=w,!e&&w||(w="error",e<0&&(e=0))),M.status=e,M.statusText=(n||w)+"",l?v.resolveWith(m,[p,w,M]):v.rejectWith(m,[M,w,d]),M.statusCode(x),x=void 0,h&&g.trigger(l?"ajaxSuccess":"ajaxError",[M,f,l?p:d]),y.fireWith(m,[M,w]),h&&(g.trigger("ajaxComplete",[M,f]),--Ze.active||Ze.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=void 0),n=n||{};var r,o,a,s,c,l,u,h,p,d,f=Ze.ajaxSetup({},n),m=f.context||f,g=f.context&&(m.nodeType||m.jquery)?Ze(m):Ze.event,v=Ze.Deferred(),y=Ze.Callbacks("once memory"),x=f.statusCode||{},b={},_={},w="canceled",M={readyState:0,getResponseHeader:function(t){var e;if(u){if(!s)for(s={};e=ve.exec(a);)s[e[1].toLowerCase()+" "]=(s[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=s[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return u?a:null},setRequestHeader:function(t,e){return null==u&&(t=_[t.toLowerCase()]=_[t.toLowerCase()]||t,b[t]=e),this},overrideMimeType:function(t){return null==u&&(f.mimeType=t),this},statusCode:function(t){var e;if(t)if(u)M.always(t[M.status]);else for(e in t)x[e]=[x[e],t[e]];return this},abort:function(t){var e=t||w;return r&&r.abort(e),i(0,e),this}};if(v.promise(M),f.url=((e||f.url||se.href)+"").replace(be,se.protocol+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(ct)||[""],null==f.crossDomain){l=Ie.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Me.protocol+"//"+Me.host!=l.protocol+"//"+l.host}catch(t){f.crossDomain=1}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Ze.param(f.data,f.traditional)),$(_e,f,n,M),u)return M;for(p in(h=Ze.event&&f.global)&&0==Ze.active++&&Ze.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!xe.test(f.type),o=f.url.replace(me,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(fe,"+")):(d=f.url.slice(o.length),f.data&&(f.processData||"string"==typeof f.data)&&(o+=(le.test(o)?"&":"?")+f.data,delete f.data),0==f.cache&&(o=o.replace(ge,"$1"),d=(le.test(o)?"&":"?")+"_="+ce+++d),f.url=o+d),f.ifModified&&(Ze.lastModified[o]&&M.setRequestHeader("If-Modified-Since",Ze.lastModified[o]),Ze.etag[o]&&M.setRequestHeader("If-None-Match",Ze.etag[o])),(f.data&&f.hasContent&&0!=f.contentType||n.contentType)&&M.setRequestHeader("Content-Type",f.contentType),M.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", */*; q=0.01":""):f.accepts["*"]),f.headers)M.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(0==f.beforeSend.call(m,M,f)||u))return M.abort();if(w="abort",y.add(f.complete),M.done(f.success),M.fail(f.error),r=$(we,f,n,M)){if(M.readyState=1,h&&g.trigger("ajaxSend",[M,f]),u)return M;f.async&&f.timeout>0&&(c=t.setTimeout(function(){M.abort("timeout")},f.timeout));try{u=0,r.send(b,i)}catch(t){if(u)throw t;i(-1,t)}}else i(-1,"No Transport");return M},getJSON:function(t,e,n){return Ze.get(t,e,n,"json")},getScript:function(t,e){return Ze.get(t,void 0,e,"script")}}),Ze.each(["get","post"],function(t,e){Ze[e]=function(t,n,i,r){return qe(n)&&(r=r||i,i=n,n=void 0),Ze.ajax(Ze.extend({url:t,type:e,dataType:r,data:n,success:i},Ze.isPlainObject(t)&&t))}}),Ze._evalUrl=function(t,e){return Ze.ajax({url:t,type:"GET",dataType:"script",cache:1,async:0,global:0,converters:{"text script":function(){}},dataFilter:function(t){Ze.globalEval(t,e)}})},Ze.fn.extend({wrapAll:function(t){var e;return this[0]&&(qe(t)&&(t=t.call(this[0])),e=Ze(t,this[0].ownerDocument).eq(0).clone(1),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return qe(t)?this.each(function(e){Ze(this).wrapInner(t.call(this,e))}):this.each(function(){var e=Ze(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=qe(t);return this.each(function(n){Ze(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){Ze(this).replaceWith(this.childNodes)}),this}}),Ze.expr.pseudos.hidden=function(t){return!Ze.expr.pseudos.visible(t)},Ze.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},Ze.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}},Se={0:200,1223:204},Te=Ze.ajaxSettings.xhr(),He.cors=!!Te&&"withCredentials"in Te,He.ajax=Te=!!Te,Ze.ajaxTransport(function(e){var n,i;if(He.cors||Te&&!e.crossDomain)return{send:function(r,o){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];for(a in e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)s.setRequestHeader(a,r[a]);n=function(t){return function(){n&&(n=i=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===t?s.abort():"error"===t?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Se[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),i=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=i:s.onreadystatechange=function(){4===s.readyState&&t.setTimeout(function(){n&&i()})},n=n("abort");try{s.send(e.hasContent&&e.data||null)}catch(t){if(n)throw t}},abort:function(){n&&n()}}}),Ze.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=0)}),Ze.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return Ze.globalEval(t),t}}}),Ze.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=0),t.crossDomain&&(t.type="GET")}),Ze.ajaxTransport("script",function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(i,r){e=Ze("<script>").attr(t.scriptAttrs||{}).prop({charset:t.scriptCharset,src:t.url}).on("load error",n=function(t){e.remove(),n=null,t&&r("error"===t.type?404:200,t.type)}),Ie.head.appendChild(e[0])},abort:function(){n&&n()}}}),Ae=[],Le=/(=)\?(?=&|$)|\?\?/,Ze.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Ae.pop()||Ze.expando+"_"+ce++;return this[t]=1,t}}),Ze.ajaxPrefilter("json jsonp",function(e,n,i){var r,o,a,s=0!=e.jsonp&&(Le.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Le.test(e.data)&&"data");if(s||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=qe(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(Le,"$1"+r):0!=e.jsonp&&(e.url+=(le.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return a||Ze.error(r+" was not called"),a[0]},e.dataTypes[0]="json",o=t[r],t[r]=function(){a=arguments},i.always(function(){void 0===o?Ze(t).removeProp(r):t[r]=o,e[r]&&(e.jsonpCallback=n.jsonpCallback,Ae.push(r)),a&&qe(o)&&o(a[0]),a=o=void 0}),"script"}),He.createHTMLDocument=((Oe=Ie.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Oe.childNodes.length),Ze.parseHTML=function(t,e,n){return"string"!=typeof t?[]:("boolean"==typeof e&&(n=e,e=0),e||(He.createHTMLDocument?((i=(e=Ie.implementation.createHTMLDocument("")).createElement("base")).href=Ie.location.href,e.head.appendChild(i)):e=Ie),o=!n&&[],(r=it.exec(t))?[e.createElement(r[1])]:(r=_([t],e,o),o&&o.length&&Ze(o).remove(),Ze.merge([],r.childNodes)));var i,r,o},Ze.fn.load=function(t,e,n){var i,r,o,a=this,s=t.indexOf(" ");return s>-1&&(i=q(t.slice(s)),t=t.slice(0,s)),qe(e)?(n=e,e=void 0):e&&"object"==typeof e&&(r="POST"),a.length>0&&Ze.ajax({url:t,type:r||"GET",dataType:"html",data:e}).done(function(t){o=arguments,a.html(i?Ze("<div>").append(Ze.parseHTML(t)).find(i):t)}).always(n&&function(t,e){a.each(function(){n.apply(this,o||[t.responseText,e,t])})}),this},Ze.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){Ze.fn[e]=function(t){return this.on(e,t)}}),Ze.expr.pseudos.animated=function(t){return Ze.grep(Ze.timers,function(e){return t===e.elem}).length},Ze.offset={setOffset:function(t,e,n){var i,r,o,a,s,c,l=Ze.css(t,"position"),u=Ze(t),h={};"static"===l&&(t.style.position="relative"),s=u.offset(),o=Ze.css(t,"top"),c=Ze.css(t,"left"),("absolute"===l||"fixed"===l)&&(o+c).indexOf("auto")>-1?(a=(i=u.position()).top,r=i.left):(a=parseFloat(o)||0,r=parseFloat(c)||0),qe(e)&&(e=e.call(t,n,Ze.extend({},s))),null!=e.top&&(h.top=e.top-s.top+a),null!=e.left&&(h.left=e.left-s.left+r),"using"in e?e.using.call(t,h):u.css(h)}},Ze.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){Ze.offset.setOffset(this,t,e)});var e,n,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),n=i.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var t,e,n,i=this[0],r={top:0,left:0};if("fixed"===Ze.css(i,"position"))e=i.getBoundingClientRect();else{for(e=this.offset(),n=i.ownerDocument,t=i.offsetParent||n.documentElement;t&&(t===n.body||t===n.documentElement)&&"static"===Ze.css(t,"position");)t=t.parentNode;t&&t!==i&&1===t.nodeType&&((r=Ze(t).offset()).top+=Ze.css(t,"borderTopWidth",1),r.left+=Ze.css(t,"borderLeftWidth",1))}return{top:e.top-r.top-Ze.css(i,"marginTop",1),left:e.left-r.left-Ze.css(i,"marginLeft",1)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent;t&&"static"===Ze.css(t,"position");)t=t.offsetParent;return t||wt})}}),Ze.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var n="pageYOffset"===e;Ze.fn[t]=function(i){return ht(this,function(t,i,r){var o;if(Xe(t)?o=t:9===t.nodeType&&(o=t.defaultView),void 0===r)return o?o[e]:t[i];o?o.scrollTo(n?o.pageXOffset:r,n?r:o.pageYOffset):t[i]=r},t,i,arguments.length)}}),Ze.each(["top","left"],function(t,e){Ze.cssHooks[e]=z(He.pixelPosition,function(t,n){if(n)return n=I(t,e),Ut.test(n)?Ze(t).position()[e]+"px":n})}),Ze.each({Height:"height",Width:"width"},function(t,e){Ze.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,i){Ze.fn[i]=function(r,o){var a=arguments.length&&(n||"boolean"!=typeof r),s=n||(1==r||1==o?"margin":"border");return ht(this,function(e,n,r){var o;return Xe(e)?0===i.indexOf("outer")?e["inner"+t]:e.document.documentElement["client"+t]:9===e.nodeType?(o=e.documentElement,Math.max(e.body["scroll"+t],o["scroll"+t],e.body["offset"+t],o["offset"+t],o["client"+t])):void 0===r?Ze.css(e,n,s):Ze.style(e,n,r,s)},e,a?r:void 0,a)}})}),Ze.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,e){Ze.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}),Ze.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),Ze.fn.extend({bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,i){return this.on(e,t,n,i)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)}}),Ze.proxy=function(t,e){var n,i,r;if("string"==typeof e&&(n=t[e],e=t,t=n),qe(t))return i=Re.call(arguments,2),(r=function(){return t.apply(e||this,i.concat(Re.call(arguments)))}).guid=t.guid=t.guid||Ze.guid++,r},Ze.holdReady=function(t){t?Ze.readyWait++:Ze.ready(1)},Ze.isArray=Array.isArray,Ze.parseJSON=JSON.parse,Ze.nodeName=o,Ze.isFunction=qe,Ze.isWindow=Xe,Ze.camelCase=d,Ze.type=i,Ze.now=Date.now,Ze.isNumeric=function(t){var e=Ze.type(t);return("number"===e||"string"===e)&&!isNaN(t-parseFloat(t))},Ce=t.jQuery,Pe=t.$,Ze.noConflict=function(e){return t.$===Ze&&(t.$=Pe),e&&t.jQuery===Ze&&(t.jQuery=Ce),Ze},e||(t.jQuery=t.$=Ze),Ze})}),function(t,e,n){function i(t,e,n){a.addMethod(e,n,t.unbindEvent),a.addMethod(e,n,t.unbindEventWithSelectorOrCallback),a.addMethod(e,n,t.unbindEventWithSelectorAndCallback)}function r(t){t.arrive=h.bindEvent,i(h,t,"unbindArrive"),t.leave=p.bindEvent,i(p,t,"unbindLeave")}var o,a,s,c,l,u,h,p,d,f;t.MutationObserver&&"undefined"!=typeof HTMLElement&&(o=0,f=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector,a={matchesSelector:function(t,e){return t instanceof HTMLElement&&f.call(t,e)},addMethod:function(t,e,n){var i=t[e];t[e]=function(){return n.length==arguments.length?n.apply(this,arguments):"function"==typeof i?i.apply(this,arguments):void 0}},callCallbacks:function(t,e){e&&e.options.onceOnly&&1==e.firedElems.length&&(t=[t[0]]);for(var n,i=0;n=t[i];i++)n&&n.callback&&n.callback.call(n.elem,n.elem);e&&e.options.onceOnly&&1==e.firedElems.length&&e.me.unbindEventWithSelectorAndCallback.call(e.target,e.selector,e.callback)},checkChildNodesRecursively:function(t,e,n,i){for(var r,o=0;r=t[o];o++)n(r,e,i)&&i.push({callback:e.callback,elem:r}),r.childNodes.length>0&&a.checkChildNodesRecursively(r.childNodes,e,n,i)},mergeArrays:function(t,e){var n,i={};for(n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);for(n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);return i},toElementsArray:function(e){return void 0===e||"number"==typeof e.length&&e!==t||(e=[e]),e}},s=function(){var t=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null};return t.prototype.addEvent=function(t,e,n,i){var r={target:t,selector:e,options:n,callback:i,firedElems:[]};return this._beforeAdding&&this._beforeAdding(r),this._eventsBucket.push(r),r},t.prototype.removeEvent=function(t){var e,n,i;for(e=this._eventsBucket.length-1;n=this._eventsBucket[e];e--)t(n)&&(this._beforeRemoving&&this._beforeRemoving(n),(i=this._eventsBucket.splice(e,1))&&i.length&&(i[0].callback=null))},t.prototype.beforeAdding=function(t){this._beforeAdding=t},t.prototype.beforeRemoving=function(t){this._beforeRemoving=t},t}(),c=function(e,i){var r=new s,o=this,c={fireOnAttributesModification:0};return r.beforeAdding(function(n){var r,a,s=n.target;s!==t.document&&s!==t||(s=document.getElementsByTagName("html")[0]),r=new MutationObserver(function(t){i.call(this,t,n)}),a=e(n.options),r.observe(s,a),n.observer=r,n.me=o}),r.beforeRemoving(function(t){t.observer.disconnect()}),this.bindEvent=function(t,e,n){var i,o;for(e=a.mergeArrays(c,e),i=a.toElementsArray(this),o=0;o<i.length;o++)r.addEvent(i[o],t,e,n)},this.unbindEvent=function(){var t=a.toElementsArray(this);r.removeEvent(function(e){for(var i=0;i<t.length;i++)if(this===n||e.target===t[i])return 1;return 0})},this.unbindEventWithSelectorOrCallback=function(t){var e,i=a.toElementsArray(this),o=t;e="function"==typeof t?function(t){for(var e=0;e<i.length;e++)if((this===n||t.target===i[e])&&t.callback===o)return 1;return 0}:function(e){for(var r=0;r<i.length;r++)if((this===n||e.target===i[r])&&e.selector===t)return 1;return 0},r.removeEvent(e)},this.unbindEventWithSelectorAndCallback=function(t,e){var i=a.toElementsArray(this);r.removeEvent(function(r){for(var o=0;o<i.length;o++)if((this===n||r.target===i[o])&&r.selector===t&&r.callback===e)return 1;return 0})},this},l=function(){function t(t,e){return a.matchesSelector(t,e.selector)&&(t._id===n&&(t._id=o++),-1==e.firedElems.indexOf(t._id))?(e.firedElems.push(t._id),1):0}var e,i={fireOnAttributesModification:0,onceOnly:0,existing:0};return h=new c(function(t){var e={attributes:0,childList:1,subtree:1};return t.fireOnAttributesModification&&(e.attributes=1),e},function(e,n){e.forEach(function(e){var i=e.addedNodes,r=e.target,o=[];null!==i&&i.length>0?a.checkChildNodesRecursively(i,n,t,o):"attributes"===e.type&&t(r,n)&&o.push({callback:n.callback,elem:r}),a.callCallbacks(o,n)})}),e=h.bindEvent,h.bindEvent=function(t,n,r){var o,s,c,l,u;if(void 0===r?(r=n,n=i):n=a.mergeArrays(i,n),o=a.toElementsArray(this),n.existing){for(s=[],c=0;c<o.length;c++)for(l=o[c].querySelectorAll(t),u=0;u<l.length;u++)s.push({callback:r,elem:l[u]});if(n.onceOnly&&s.length)return r.call(s[0].elem,s[0].elem);setTimeout(a.callCallbacks,1,s)}e.call(this,t,n,r)},h},u=function(){function t(t,e){return a.matchesSelector(t,e.selector)}var e,n={};return p=new c(function(){return{childList:1,subtree:1}},function(e,n){e.forEach(function(e){var i=e.removedNodes,r=[];null!==i&&i.length>0&&a.checkChildNodesRecursively(i,n,t,r),a.callCallbacks(r,n)})}),e=p.bindEvent,p.bindEvent=function(t,i,r){void 0===r?(r=i,i=n):i=a.mergeArrays(n,i),e.call(this,t,i,r)},p},h=new l,p=new u,e&&r(e.fn),r(HTMLElement.prototype),r(NodeList.prototype),r(HTMLCollection.prototype),r(HTMLDocument.prototype),r(Window.prototype),i(h,d={},"unbindAllArrive"),i(p,d,"unbindAllLeave"))}(window,"undefined"==typeof jQuery?null:jQuery,void 0),(sp=function(){}).prototype={constructor:sp,parse:function(t){var e,n,r,o,s,c,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A;if(t.isMesh){if(e=new i,r=[],o=0,s=t.geometry,c=(new l).makeRotationX(90*Math.PI/180),u=(new l).makeScale(10,10,10),s.isBufferGeometry&&(h=s.clone(s),void 0!==(p=s.getAttribute("position"))))for(n=0,r=p.count;n<r;n++,o++)if(e.x=p.getX(n),e.y=p.getY(n),e.z=p.getZ(n),null==s.skinIndexNames||0==s.skinIndexNames)e.applyMatrix4(t.matrixWorld).applyMatrix4(c).applyMatrix4(u),h.attributes.position.setXYZ(n,e.x,e.y,e.z);else{if(d=new a,f=new a(e.x,e.y,e.z),void 0!==s.morphTargetInfluences){for(m=new a,g=0;g<s.morphAttributes.position.length;g++)0!=s.morphTargetInfluences[g]&&s.morphTargetDictionary.hide!=g&&(v=new a(s.morphAttributes.position[g].getX(n),s.morphAttributes.position[g].getY(n),s.morphAttributes.position[g].getZ(n)),m.addScaledVector(v,s.morphTargetInfluences[g]));f.add(m)}for(y=0;y<s.skinIndexNames.length;y++)for(x=s.getAttribute([s.skinIndexNames[y]]),b=s.getAttribute([s.skinWeightNames[y]]),(_=[])[0]=x.getX(n),_[1]=x.getY(n),_[2]=x.getZ(n),_[3]=x.getW(n),(w=[])[0]=b.getX(n),w[1]=b.getY(n),w[2]=b.getZ(n),w[3]=b.getW(n),(M=[])[0]=t.skeleton.boneInverses[_[0]],M[1]=t.skeleton.boneInverses[_[1]],M[2]=t.skeleton.boneInverses[_[2]],M[3]=t.skeleton.boneInverses[_[3]],(S=[])[0]=t.skeleton.bones[_[0]].matrixWorld,S[1]=t.skeleton.bones[_[1]].matrixWorld,S[2]=t.skeleton.bones[_[2]].matrixWorld,S[3]=t.skeleton.bones[_[3]].matrixWorld,T=0;T<4;T++)(A=void 0!==s.morphTargetInfluences?new a(f.x,f.y,f.z):new a(e.x,e.y,e.z)).multiplyScalar(w[T]),A.applyMatrix4(M[T]).applyMatrix4(S[T]).applyMatrix4(c).applyMatrix4(u),d.add(A);h.attributes.position.setXYZ(n,d.x,d.y,d.z)}return h}}},document.body.arrive(".footer",{onceOnly:1,existing:1},function(){var t,e={"margin-left":"10px",width:"50px"},n={};ap(".footer").empty(),ap(".content-side > .headerMenu-container").remove(),ap("#subDSltLabel").remove(),ap("#subdivideSLT").remove(),ap("#topSaveStl").remove(),ap("#topSaveObj").remove(),ap("#butSaveStl").remove(),ap("#butSaveObj").remove(),ap("#jsonImport").remove(),ap("#jsonExport").remove(),(t=ap(".headerMenu-container").first()).css({display:"flex","justify-content":"center","align-content":"center","align-items":"center"}),t.append(ap("<label />",{css:e,class:"jss7",id:"subDSltLabel",text:"Quality:",title:"Subdivision Passes",for:"subdivideSLT"})).append(ap("<input />",{css:e,class:"jss7 jss9 jss10",id:"subdivideSLT",name:"subdivideSLT",title:"Subdivision Passes",type:"number",min:"0",max:"2",step:"1",value:"0"})).append(ap("<a />",{css:e,class:"jss7 jss9 jss10",id:"topSaveStl",text:"💾 .stl",title:"Download in STL Format"}).on("click",Co)).append(ap("<a />",{css:e,class:"jss7 jss9 jss10",id:"topSaveObj",text:"💾 .obj",title:"Download in OBJ Format"}).on("click",Po)),ap(".editorFooter").prepend(ap("<a />",{css:n,class:"shop-button clickable",id:"butSaveStl",text:"💾 .stl",title:"Download in STL Format"}).on("click",Co)).prepend(ap("<a />",{css:n,class:"shop-button clickable",id:"butSaveObj",text:"💾 .obj",title:"Download in OBJ Format"}).on("click",Po)),ap(".headerMenu-nav-scroll:first").append([ap('<label id="jsonImport" for="import" ><span class="headerMenu-nav-item" href="#" target="_self"><input type="file" id="import" name="import" style="display: none;"/><div class="headerMenu-nav-item-img"><span style="width:20px">🡅</span></div><div class="headerMenu-nav-item-text">Import</div></span></label>').on("click",No),ap('<a id="jsonExport" class="headerMenu-nav-item" href="#" target="_self"><div class="headerMenu-nav-item-img"><span style="width:20px">🡇</span></div><div class="headerMenu-nav-item-text">Export</div></a>').on("click",Eo),ap().on("change",No)])})},"function"==typeof define&&define.amd?define(t):t();