数据可视化大屏
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

12544 řádky
2.5MB

  1. import{a as RV,b as D0,c as nL,d as LV,e as $M,f as QM}from"./chunk-DNECFSH6.js";import{$a as tf,A as Oc,Aa as xm,Ba as Sm,C as zc,Ca as wl,Ga as qc,Ia as jc,La as Kc,Pa as Jc,Sa as $c,Ua as Qc,V as Fc,W as MV,X as bV,Xa as ef,_ as Bc,aa as wV,b as JM,ba as TV,bb as rf,ca as bl,cb as EV,db as Tl,e as Ic,fb as nf,gb as AV,hb as af,jb as of,kb as CV,la as kc,pa as Vc,ra as Gc,ta as Hc,u as Nc,ua as Wc,v as Uc,wa as Xc,y as SV,ya as Yc}from"./chunk-WD6SV3WH.js";import{$ as sV,Ab as Tc,Bb as oa,Cb as sa,D as iV,Db as vu,Eb as Wi,Fb as ym,Ge as Ac,Ha as qM,I as nV,Ib as vV,Jb as ui,Ka as Ot,Kb as gV,La as Ho,Lb as yV,Le as Cc,Ma as KR,Mb as rL,Me as ZM,Ne as jM,Nf as Zc,Pa as fV,Q as aV,Sb as _m,Ta as Pr,U as oV,Va as Tt,Wa as hV,Xa as JR,Ya as pV,a as XM,ba as jR,cc as iL,cd as xV,db as $R,dc as Ec,e as Use,eb as QR,f as Ose,fb as eL,g as qR,gb as Jt,h as zse,hb as nr,hf as Rc,i as Fse,ia as lV,ib as Yr,ic as L0,j as YM,jb as Sl,kb as Ml,la as aa,lb as dV,lf as Lc,m as eV,na as li,nc as _V,o as ZR,oa as uV,p as tV,pa as cV,qb as mV,ra as R0,sb as Nr,tb as Wo,tf as KM,u as C0,ub as Li,vf as Pc,w as rV,xd as P0,xf as Dc,yb as tL,zb as wc}from"./chunk-VDRVUQCF.js";var eae={};qR(eae,{AddEquation:()=>HF,AddOperation:()=>une,AdditiveBlending:()=>BF,AlphaFormat:()=>xne,AlwaysDepth:()=>rne,AmbientLight:()=>oC,AnimationClip:()=>No,AnimationMixer:()=>hB,AnimationObjectGroup:()=>EF,AnimationUtils:()=>Jn,ArcCurve:()=>yC,ArrowHelper:()=>em,Audio:()=>Ty,AudioAnalyser:()=>fB,AudioContext:()=>uB,AudioListener:()=>wF,AudioLoader:()=>cB,AxisHelper:()=>gC,BackSide:()=>xh,BasicDepthPacking:()=>Nne,BasicShadowMap:()=>eAe,BinaryTextureLoader:()=>rB,BlendingMode:()=>Hie,Bone:()=>KA,BooleanKeyframeTrack:()=>fC,BoundingBoxHelper:()=>CLe,Box2:()=>DS,Box3:()=>su,BoxBufferGeometry:()=>zd,BoxGeometry:()=>sM,BoxHelper:()=>Uy,BufferAttribute:()=>gt,BufferGeometry:()=>Bt,BufferGeometryLoader:()=>nB,ByteType:()=>dne,Cache:()=>MF,Camera:()=>Qn,CameraHelper:()=>vM,CanvasRenderer:()=>ULe,CanvasTexture:()=>QA,CatmullRomCurve3:()=>pB,CineonToneMapping:()=>hne,CircleBufferGeometry:()=>xy,CircleGeometry:()=>oM,ClampToEdgeWrapping:()=>Uo,Clock:()=>PF,ClosedSplineCurve3:()=>Qne,Color:()=>Gt,ColorKeyframeTrack:()=>hC,CompressedTexture:()=>oy,CompressedTextureLoader:()=>qne,ConeBufferGeometry:()=>aM,ConeGeometry:()=>nM,CubeCamera:()=>pC,CubeGeometry:()=>sM,CubeReflectionMapping:()=>SC,CubeRefractionMapping:()=>WA,CubeTexture:()=>Sh,CubeTextureLoader:()=>iB,CubeUVReflectionMapping:()=>MC,CubeUVRefractionMapping:()=>bC,CubicBezierCurve:()=>Jd,CubicBezierCurve3:()=>iLe,CubicInterpolant:()=>sC,CullFaceBack:()=>TS,CullFaceFront:()=>NF,CullFaceFrontBack:()=>$Ee,CullFaceNone:()=>kie,Curve:()=>ea,CurvePath:()=>fM,CurveUtils:()=>xM,CustomBlending:()=>GF,CylinderBufferGeometry:()=>oc,CylinderGeometry:()=>Hd,Cylindrical:()=>IF,DataTexture:()=>Od,DataTextureLoader:()=>eLe,DefaultLoadingManager:()=>Fo,DepthFormat:()=>Ld,DepthStencilFormat:()=>Qg,DepthTexture:()=>HS,DirectionalLight:()=>aC,DirectionalLightHelper:()=>Ny,DirectionalLightShadow:()=>nC,DiscreteInterpolant:()=>lC,DodecahedronBufferGeometry:()=>fy,DodecahedronGeometry:()=>ZS,DoubleSide:()=>Oy,DstAlphaFactor:()=>Kie,DstColorFactor:()=>$ie,DynamicBufferAttribute:()=>yLe,EdgesGeometry:()=>_y,EdgesHelper:()=>RLe,EllipseCurve:()=>sc,EqualDepth:()=>nne,EquirectangularReflectionMapping:()=>qF,EquirectangularRefractionMapping:()=>XA,Euler:()=>Th,EventDispatcher:()=>bs,ExtrudeGeometry:()=>Ts,Face3:()=>zo,Face4:()=>sLe,FaceColors:()=>FF,FaceNormalsHelper:()=>mM,FileLoader:()=>Es,FlatShading:()=>OF,Float32Attribute:()=>ELe,Float32BufferAttribute:()=>gr,Float64Attribute:()=>ALe,Float64BufferAttribute:()=>BS,FloatType:()=>Jg,Fog:()=>ny,FogExp2:()=>iy,Font:()=>lB,FontLoader:()=>jne,FrontFaceDirectionCCW:()=>QEe,FrontFaceDirectionCW:()=>Vie,FrontSide:()=>Kg,Frustum:()=>IS,GammaEncoding:()=>$F,Geometry:()=>sr,GeometryIdCount:()=>QF,GeometryUtils:()=>DLe,GreaterDepth:()=>one,GreaterEqualDepth:()=>ane,GridHelper:()=>dM,Group:()=>GS,HalfFloatType:()=>qA,HemisphereLight:()=>eC,HemisphereLightHelper:()=>Iy,IcosahedronBufferGeometry:()=>cy,IcosahedronGeometry:()=>qS,ImageLoader:()=>_M,ImageUtils:()=>ILe,ImmediateRenderObject:()=>hM,InstancedBufferAttribute:()=>Cy,InstancedBufferGeometry:()=>Qd,InstancedInterleavedBuffer:()=>Ay,Int16Attribute:()=>MLe,Int16BufferAttribute:()=>zS,Int32Attribute:()=>wLe,Int32BufferAttribute:()=>FS,Int8Attribute:()=>_Le,Int8BufferAttribute:()=>NS,IntType:()=>vne,InterleavedBuffer:()=>Ey,InterleavedBufferAttribute:()=>CF,Interpolant:()=>ao,InterpolateDiscrete:()=>RS,InterpolateLinear:()=>wS,InterpolateSmooth:()=>GA,JSONLoader:()=>aB,KeyframeTrack:()=>jd,LOD:()=>VS,LatheBufferGeometry:()=>vy,LatheGeometry:()=>iM,Layers:()=>ZA,LensFlare:()=>SF,LessDepth:()=>ine,LessEqualDepth:()=>HA,Light:()=>Ui,LightShadow:()=>rm,Line:()=>ac,Line3:()=>Pd,LineBasicMaterial:()=>Ni,LineCurve:()=>uu,LineCurve3:()=>aLe,LineDashedMaterial:()=>Zd,LinePieces:()=>uLe,LineSegments:()=>di,LineStrip:()=>lLe,LinearEncoding:()=>PS,LinearFilter:()=>no,LinearInterpolant:()=>uM,LinearMipMapLinearFilter:()=>yM,LinearMipMapNearestFilter:()=>jF,LinearToneMapping:()=>YF,Loader:()=>Dd,LoadingManager:()=>tB,LogLuvEncoding:()=>rAe,LoopOnce:()=>wne,LoopPingPong:()=>Ene,LoopRepeat:()=>Tne,LuminanceAlphaFormat:()=>Mne,LuminanceFormat:()=>Sne,MOUSE:()=>JEe,Material:()=>mr,MaterialLoader:()=>AC,Math:()=>cr,Matrix3:()=>ws,Matrix4:()=>qt,MaxEquation:()=>uF,Mesh:()=>mn,MeshBasicMaterial:()=>oo,MeshDepthMaterial:()=>bh,MeshFaceMaterial:()=>cLe,MeshLambertMaterial:()=>qd,MeshNormalMaterial:()=>Yd,MeshPhongMaterial:()=>vl,MeshPhysicalMaterial:()=>Wd,MeshStandardMaterial:()=>lu,MeshToonMaterial:()=>Xd,MinEquation:()=>lF,MirroredRepeatWrapping:()=>Nd,MixOperation:()=>lne,MorphBlendMesh:()=>Pn,MultiMaterial:()=>lM,MultiplyBlending:()=>VF,MultiplyOperation:()=>gM,NearestFilter:()=>Oo,NearestMipMapLinearFilter:()=>TC,NearestMipMapNearestFilter:()=>wC,NeverDepth:()=>tne,NoBlending:()=>ES,NoColors:()=>_C,NoToneMapping:()=>VA,NormalBlending:()=>zy,NotEqualDepth:()=>sne,NumberKeyframeTrack:()=>wy,Object3D:()=>At,ObjectLoader:()=>Zne,OctahedronBufferGeometry:()=>Vd,OctahedronGeometry:()=>YS,OneFactor:()=>qie,OneMinusDstAlphaFactor:()=>Jie,OneMinusDstColorFactor:()=>Qie,OneMinusSrcAlphaFactor:()=>XF,OneMinusSrcColorFactor:()=>jie,OrthographicCamera:()=>ry,PCFShadowMap:()=>UF,PCFSoftShadowMap:()=>Gie,ParametricBufferGeometry:()=>ly,ParametricGeometry:()=>WS,Particle:()=>hLe,ParticleBasicMaterial:()=>mLe,ParticleSystem:()=>pLe,ParticleSystemMaterial:()=>vLe,Path:()=>SM,PerspectiveCamera:()=>Kn,Plane:()=>Io,PlaneBufferGeometry:()=>Fd,PlaneGeometry:()=>rM,PointCloud:()=>fLe,PointCloudMaterial:()=>dLe,PointLight:()=>iC,PointLightHelper:()=>Py,Points:()=>ay,PointsMaterial:()=>ml,PolarGridHelper:()=>vC,PolyhedronBufferGeometry:()=>so,PolyhedronGeometry:()=>jS,PositionalAudio:()=>TF,Projector:()=>NLe,PropertyBinding:()=>Ri,PropertyMixer:()=>dC,QuadraticBezierCurve:()=>$d,QuadraticBezierCurve3:()=>nLe,Quaternion:()=>on,QuaternionKeyframeTrack:()=>cM,QuaternionLinearInterpolant:()=>uC,REVISION:()=>Bie,RGBADepthPacking:()=>Une,RGBAFormat:()=>ou,RGBA_PVRTC_2BPPV1_Format:()=>_F,RGBA_PVRTC_4BPPV1_Format:()=>yF,RGBA_S3TC_DXT1_Format:()=>pF,RGBA_S3TC_DXT3_Format:()=>dF,RGBA_S3TC_DXT5_Format:()=>mF,RGBDEncoding:()=>Ine,RGBEEncoding:()=>Lne,RGBEFormat:()=>tAe,RGBFormat:()=>$g,RGBM16Encoding:()=>Dne,RGBM7Encoding:()=>Pne,RGB_ETC1_Format:()=>bne,RGB_PVRTC_2BPPV1_Format:()=>gF,RGB_PVRTC_4BPPV1_Format:()=>vF,RGB_S3TC_DXT1_Format:()=>hF,RawShaderMaterial:()=>My,Ray:()=>wh,Raycaster:()=>RF,RectAreaLight:()=>bF,RectAreaLightHelper:()=>Dy,ReinhardToneMapping:()=>cne,RepeatWrapping:()=>rc,ReverseSubtractEquation:()=>Xie,RingBufferGeometry:()=>my,RingGeometry:()=>tM,Scene:()=>Bd,SceneUtils:()=>oLe,ShaderChunk:()=>Xr,ShaderLib:()=>ty,ShaderMaterial:()=>Ma,ShadowMaterial:()=>Sy,Shape:()=>Id,ShapeBufferGeometry:()=>gy,ShapeGeometry:()=>yy,ShapePath:()=>sB,ShapeUtils:()=>Ln,ShortType:()=>mne,Skeleton:()=>jA,SkeletonHelper:()=>Ly,SkinnedMesh:()=>JA,SmoothShading:()=>zF,Sphere:()=>$n,SphereBufferGeometry:()=>Gd,SphereGeometry:()=>eM,Spherical:()=>DF,SphericalReflectionMapping:()=>ZF,Spline:()=>tLe,SplineCurve:()=>Kd,SplineCurve3:()=>rLe,SpotLight:()=>rC,SpotLightHelper:()=>Ry,SpotLightShadow:()=>tC,Sprite:()=>kS,SpriteMaterial:()=>kd,SrcAlphaFactor:()=>WF,SrcAlphaSaturateFactor:()=>ene,SrcColorFactor:()=>Zie,StereoCamera:()=>Kne,StringKeyframeTrack:()=>cC,SubtractEquation:()=>Wie,SubtractiveBlending:()=>kF,TetrahedronBufferGeometry:()=>uy,TetrahedronGeometry:()=>XS,TextGeometry:()=>QS,Texture:()=>ai,TextureFilter:()=>fF,TextureLoader:()=>EC,TextureMapping:()=>pne,TextureWrapping:()=>cF,TorusBufferGeometry:()=>dy,TorusGeometry:()=>$S,TorusKnotBufferGeometry:()=>py,TorusKnotGeometry:()=>JS,Triangle:()=>Ms,TriangleFanDrawMode:()=>Cne,TriangleStripDrawMode:()=>Ane,TrianglesDrawMode:()=>JF,TubeBufferGeometry:()=>hy,TubeGeometry:()=>KS,UVMapping:()=>xC,Uint16Attribute:()=>bLe,Uint16BufferAttribute:()=>ic,Uint32Attribute:()=>TLe,Uint32BufferAttribute:()=>nc,Uint8Attribute:()=>xLe,Uint8BufferAttribute:()=>US,Uint8ClampedAttribute:()=>SLe,Uint8ClampedBufferAttribute:()=>OS,Uncharted2ToneMapping:()=>fne,Uniform:()=>mC,UniformsLib:()=>hr,UniformsUtils:()=>io,UnsignedByteType:()=>YA,UnsignedInt248Type:()=>CS,UnsignedIntType:()=>KF,UnsignedShort4444Type:()=>gne,UnsignedShort5551Type:()=>yne,UnsignedShort565Type:()=>_ne,UnsignedShortType:()=>AS,Vector2:()=>St,Vector3:()=>oe,Vector4:()=>ei,VectorKeyframeTrack:()=>by,Vertex:()=>gLe,VertexColors:()=>tm,VertexNormalsHelper:()=>pM,VideoTexture:()=>$A,WebGLRenderTarget:()=>Fy,WebGLRenderTargetCube:()=>ey,WebGLRenderer:()=>eB,WireframeGeometry:()=>sy,WireframeHelper:()=>LLe,WrapAroundEnding:()=>LS,XHRLoader:()=>PLe,ZeroCurvatureEnding:()=>Ud,ZeroFactor:()=>Yie,ZeroSlopeEnding:()=>Rd,sRGBEncoding:()=>Rne});function bs(){}function St(r,e){this.x=r||0,this.y=e||0}function ai(r,e,t,i,n,a,o,s,l,u){Object.defineProperty(this,"id",{value:iAe++}),this.uuid=cr.generateUUID(),this.name="",this.image=r!==void 0?r:ai.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=e!==void 0?e:ai.DEFAULT_MAPPING,this.wrapS=t!==void 0?t:Uo,this.wrapT=i!==void 0?i:Uo,this.magFilter=n!==void 0?n:no,this.minFilter=a!==void 0?a:yM,this.anisotropy=l!==void 0?l:1,this.format=o!==void 0?o:ou,this.type=s!==void 0?s:YA,this.offset=new St(0,0),this.repeat=new St(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u!==void 0?u:PS,this.version=0,this.onUpdate=null}function ei(r,e,t,i){this.x=r||0,this.y=e||0,this.z=t||0,this.w=i!==void 0?i:1}function Fy(r,e,t){this.uuid=cr.generateUUID(),this.width=r,this.height=e,this.scissor=new ei(0,0,r,e),this.scissorTest=!1,this.viewport=new ei(0,0,r,e),t=t||{},t.minFilter===void 0&&(t.minFilter=no),this.texture=new ai(void 0,void 0,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.depthBuffer=t.depthBuffer!==void 0?t.depthBuffer:!0,this.stencilBuffer=t.stencilBuffer!==void 0?t.stencilBuffer:!0,this.depthTexture=t.depthTexture!==void 0?t.depthTexture:null}function ey(r,e,t){Fy.call(this,r,e,t),this.activeCubeFace=0,this.activeMipMapLevel=0}function on(r,e,t,i){this._x=r||0,this._y=e||0,this._z=t||0,this._w=i!==void 0?i:1}function oe(r,e,t){this.x=r||0,this.y=e||0,this.z=t||0}function qt(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function Sh(r,e,t,i,n,a,o,s,l,u){r=r!==void 0?r:[],e=e!==void 0?e:SC,ai.call(this,r,e,t,i,n,a,o,s,l,u),this.flipY=!1}function Fne(){this.seq=[],this.map={}}function By(r,e,t){var i=r[0];if(i<=0||i>0)return r;var n=e*t,a=Die[n];if(a===void 0&&(a=new Float32Array(n),Die[n]=a),e!==0){i.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=t,r[o].toArray(a,s)}return a}function Bne(r,e){var t=Iie[e];t===void 0&&(t=new Int32Array(e),Iie[e]=t);for(var i=0;i!==e;++i)t[i]=r.allocTextureUnit();return t}function nAe(r,e){r.uniform1f(this.addr,e)}function aAe(r,e){r.uniform1i(this.addr,e)}function oAe(r,e){e.x===void 0?r.uniform2fv(this.addr,e):r.uniform2f(this.addr,e.x,e.y)}function sAe(r,e){e.x!==void 0?r.uniform3f(this.addr,e.x,e.y,e.z):e.r!==void 0?r.uniform3f(this.addr,e.r,e.g,e.b):r.uniform3fv(this.addr,e)}function lAe(r,e){e.x===void 0?r.uniform4fv(this.addr,e):r.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function uAe(r,e){r.uniformMatrix2fv(this.addr,!1,e.elements||e)}function cAe(r,e){r.uniformMatrix3fv(this.addr,!1,e.elements||e)}function fAe(r,e){r.uniformMatrix4fv(this.addr,!1,e.elements||e)}function hAe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTexture2D(e||One,i)}function pAe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTextureCube(e||zne,i)}function kne(r,e){r.uniform2iv(this.addr,e)}function Vne(r,e){r.uniform3iv(this.addr,e)}function Gne(r,e){r.uniform4iv(this.addr,e)}function dAe(r){switch(r){case 5126:return nAe;case 35664:return oAe;case 35665:return sAe;case 35666:return lAe;case 35674:return uAe;case 35675:return cAe;case 35676:return fAe;case 35678:return hAe;case 35680:return pAe;case 5124:case 35670:return aAe;case 35667:case 35671:return kne;case 35668:case 35672:return Vne;case 35669:case 35673:return Gne}}function mAe(r,e){r.uniform1fv(this.addr,e)}function vAe(r,e){r.uniform1iv(this.addr,e)}function gAe(r,e){r.uniform2fv(this.addr,By(e,this.size,2))}function yAe(r,e){r.uniform3fv(this.addr,By(e,this.size,3))}function _Ae(r,e){r.uniform4fv(this.addr,By(e,this.size,4))}function xAe(r,e){r.uniformMatrix2fv(this.addr,!1,By(e,this.size,4))}function SAe(r,e){r.uniformMatrix3fv(this.addr,!1,By(e,this.size,9))}function MAe(r,e){r.uniformMatrix4fv(this.addr,!1,By(e,this.size,16))}function bAe(r,e,t){var i=e.length,n=Bne(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTexture2D(e[a]||One,n[a])}function wAe(r,e,t){var i=e.length,n=Bne(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTextureCube(e[a]||zne,n[a])}function TAe(r){switch(r){case 5126:return mAe;case 35664:return gAe;case 35665:return yAe;case 35666:return _Ae;case 35674:return xAe;case 35675:return SAe;case 35676:return MAe;case 35678:return bAe;case 35680:return wAe;case 5124:case 35670:return vAe;case 35667:case 35671:return kne;case 35668:case 35672:return Vne;case 35669:case 35673:return Gne}}function EAe(r,e,t){this.id=r,this.addr=t,this.setValue=dAe(e.type)}function AAe(r,e,t){this.id=r,this.addr=t,this.size=e.size,this.setValue=TAe(e.type)}function Hne(r){this.id=r,Fne.call(this)}function Nie(r,e){r.seq.push(e),r.map[e.id]=e}function CAe(r,e,t){var i=r.name,n=i.length;for(oF.lastIndex=0;;){var a=oF.exec(i),o=oF.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){Nie(t,u===void 0?new EAe(s,r,e):new AAe(s,r,e));break}else{var c=t.map,f=c[s];f===void 0&&(f=new Hne(s),Nie(t,f)),t=f}}}function Mh(r,e,t){Fne.call(this),this.renderer=t;for(var i=r.getProgramParameter(e,r.ACTIVE_UNIFORMS),n=0;n!==i;++n){var a=r.getActiveUniform(e,n),o=a.name,s=r.getUniformLocation(e,o);CAe(a,s,this)}}function Gt(r,e,t){return e===void 0&&t===void 0?this.set(r):this.setRGB(r,e,t)}function Od(r,e,t,i,n,a,o,s,l,u,c,f){ai.call(this,null,a,o,s,l,u,i,n,c,f),this.image={data:r,width:e,height:t},this.magFilter=l!==void 0?l:Oo,this.minFilter=u!==void 0?u:Oo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function DS(r,e){this.min=r!==void 0?r:new St(1/0,1/0),this.max=e!==void 0?e:new St(-1/0,-1/0)}function CRe(r,e){var t=r.context,i=r.state,n,a,o,s,l,u,c,f;function h(){var d=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),g=new Uint16Array([0,1,2,0,2,3]);n=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,d,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,g,t.STATIC_DRAW),c=t.createTexture(),f=t.createTexture(),i.bindTexture(t.TEXTURE_2D,c),t.texImage2D(t.TEXTURE_2D,0,t.RGB,16,16,0,t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),i.bindTexture(t.TEXTURE_2D,f),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,16,16,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),o={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join(`
  2. `),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join(`
  3. `)},s=p(o),l={vertex:t.getAttribLocation(s,"position"),uv:t.getAttribLocation(s,"uv")},u={renderType:t.getUniformLocation(s,"renderType"),map:t.getUniformLocation(s,"map"),occlusionMap:t.getUniformLocation(s,"occlusionMap"),opacity:t.getUniformLocation(s,"opacity"),color:t.getUniformLocation(s,"color"),scale:t.getUniformLocation(s,"scale"),rotation:t.getUniformLocation(s,"rotation"),screenPosition:t.getUniformLocation(s,"screenPosition")}}this.render=function(d,g,m){if(e.length!==0){var v=new oe,_=m.w/m.z,y=m.z*.5,x=m.w*.5,M=16/m.w,S=new St(M*_,M),w=new oe(1,1,0),T=new St(1,1),C=new DS;C.min.set(m.x,m.y),C.max.set(m.x+(m.z-16),m.y+(m.w-16)),s===void 0&&h(),t.useProgram(s),i.initAttributes(),i.enableAttribute(l.vertex),i.enableAttribute(l.uv),i.disableUnusedAttributes(),t.uniform1i(u.occlusionMap,0),t.uniform1i(u.map,1),t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(l.vertex,2,t.FLOAT,!1,2*8,0),t.vertexAttribPointer(l.uv,2,t.FLOAT,!1,2*8,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),i.disable(t.CULL_FACE),i.setDepthWrite(!1);for(var b=0,E=e.length;b<E;b++){M=16/m.w,S.set(M*_,M);var I=e[b];if(v.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),v.applyMatrix4(g.matrixWorldInverse),v.applyProjection(g.projectionMatrix),w.copy(v),T.x=m.x+w.x*y+y-8,T.y=m.y+w.y*x+x-8,C.containsPoint(T)===!0){i.activeTexture(t.TEXTURE0),i.bindTexture(t.TEXTURE_2D,null),i.activeTexture(t.TEXTURE1),i.bindTexture(t.TEXTURE_2D,c),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGB,T.x,T.y,16,16,0),t.uniform1i(u.renderType,0),t.uniform2f(u.scale,S.x,S.y),t.uniform3f(u.screenPosition,w.x,w.y,w.z),i.disable(t.BLEND),i.enable(t.DEPTH_TEST),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),i.activeTexture(t.TEXTURE0),i.bindTexture(t.TEXTURE_2D,f),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,T.x,T.y,16,16,0),t.uniform1i(u.renderType,1),i.disable(t.DEPTH_TEST),i.activeTexture(t.TEXTURE1),i.bindTexture(t.TEXTURE_2D,c),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),I.positionScreen.copy(w),I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares(),t.uniform1i(u.renderType,2),i.enable(t.BLEND);for(var R=0,A=I.lensFlares.length;R<A;R++){var D=I.lensFlares[R];D.opacity>.001&&D.scale>.001&&(w.x=D.x,w.y=D.y,w.z=D.z,M=D.size*D.scale/m.w,S.x=M*_,S.y=M,t.uniform3f(u.screenPosition,w.x,w.y,w.z),t.uniform2f(u.scale,S.x,S.y),t.uniform1f(u.rotation,D.rotation),t.uniform1f(u.opacity,D.opacity),t.uniform3f(u.color,D.color.r,D.color.g,D.color.b),i.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),r.setTexture2D(D.texture,1),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0))}}}i.enable(t.CULL_FACE),i.enable(t.DEPTH_TEST),i.setDepthWrite(!0),r.resetGLState()}};function p(d){var g=t.createProgram(),m=t.createShader(t.FRAGMENT_SHADER),v=t.createShader(t.VERTEX_SHADER),_="precision "+r.getPrecision()+` float;
  4. `;return t.shaderSource(m,_+d.fragmentShader),t.shaderSource(v,_+d.vertexShader),t.compileShader(m),t.compileShader(v),t.attachShader(g,m),t.attachShader(g,v),t.linkProgram(g),g}}function RRe(r,e){var t=r.context,i=r.state,n,a,o,s,l,u,c=new oe,f=new on,h=new oe;function p(){var m=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),v=new Uint16Array([0,1,2,0,2,3]);n=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,m,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,v,t.STATIC_DRAW),o=d(),s={position:t.getAttribLocation(o,"position"),uv:t.getAttribLocation(o,"uv")},l={uvOffset:t.getUniformLocation(o,"uvOffset"),uvScale:t.getUniformLocation(o,"uvScale"),rotation:t.getUniformLocation(o,"rotation"),scale:t.getUniformLocation(o,"scale"),color:t.getUniformLocation(o,"color"),map:t.getUniformLocation(o,"map"),opacity:t.getUniformLocation(o,"opacity"),modelViewMatrix:t.getUniformLocation(o,"modelViewMatrix"),projectionMatrix:t.getUniformLocation(o,"projectionMatrix"),fogType:t.getUniformLocation(o,"fogType"),fogDensity:t.getUniformLocation(o,"fogDensity"),fogNear:t.getUniformLocation(o,"fogNear"),fogFar:t.getUniformLocation(o,"fogFar"),fogColor:t.getUniformLocation(o,"fogColor"),alphaTest:t.getUniformLocation(o,"alphaTest")};var _=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");_.width=8,_.height=8;var y=_.getContext("2d");y.fillStyle="white",y.fillRect(0,0,8,8),u=new ai(_),u.needsUpdate=!0}this.render=function(m,v){if(e.length!==0){o===void 0&&p(),t.useProgram(o),i.initAttributes(),i.enableAttribute(s.position),i.enableAttribute(s.uv),i.disableUnusedAttributes(),i.disable(t.CULL_FACE),i.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,2*8,0),t.vertexAttribPointer(s.uv,2,t.FLOAT,!1,2*8,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.uniformMatrix4fv(l.projectionMatrix,!1,v.projectionMatrix.elements),i.activeTexture(t.TEXTURE0),t.uniform1i(l.map,0);var _=0,y=0,x=m.fog;x?(t.uniform3f(l.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(t.uniform1f(l.fogNear,x.near),t.uniform1f(l.fogFar,x.far),t.uniform1i(l.fogType,1),_=1,y=1):x.isFogExp2&&(t.uniform1f(l.fogDensity,x.density),t.uniform1i(l.fogType,2),_=2,y=2)):(t.uniform1i(l.fogType,0),_=0,y=0);for(var M=0,S=e.length;M<S;M++){var w=e[M];w.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(g);for(var T=[],M=0,S=e.length;M<S;M++){var w=e[M],C=w.material;if(C.visible!==!1){t.uniform1f(l.alphaTest,C.alphaTest),t.uniformMatrix4fv(l.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(c,f,h),T[0]=h.x,T[1]=h.y;var b=0;m.fog&&C.fog&&(b=y),_!==b&&(t.uniform1i(l.fogType,b),_=b),C.map!==null?(t.uniform2f(l.uvOffset,C.map.offset.x,C.map.offset.y),t.uniform2f(l.uvScale,C.map.repeat.x,C.map.repeat.y)):(t.uniform2f(l.uvOffset,0,0),t.uniform2f(l.uvScale,1,1)),t.uniform1f(l.opacity,C.opacity),t.uniform3f(l.color,C.color.r,C.color.g,C.color.b),t.uniform1f(l.rotation,C.rotation),t.uniform2fv(l.scale,T),i.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),i.setDepthTest(C.depthTest),i.setDepthWrite(C.depthWrite),C.map?r.setTexture2D(C.map,0):r.setTexture2D(u,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)}}i.enable(t.CULL_FACE),r.resetGLState()}};function d(){var m=t.createProgram(),v=t.createShader(t.VERTEX_SHADER),_=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(v,["precision "+r.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join(`
  5. `)),t.shaderSource(_,["precision "+r.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join(`
  6. `)),t.compileShader(v),t.compileShader(_),t.attachShader(m,v),t.attachShader(m,_),t.linkProgram(m),m}function g(m,v){return m.renderOrder!==v.renderOrder?m.renderOrder-v.renderOrder:m.z!==v.z?v.z-m.z:v.id-m.id}}function mr(){Object.defineProperty(this,"id",{value:LRe++}),this.uuid=cr.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=zy,this.side=Kg,this.shading=zF,this.vertexColors=_C,this.opacity=1,this.transparent=!1,this.blendSrc=WF,this.blendDst=XF,this.blendEquation=HF,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=HA,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Ma(r){mr.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=`void main() {
  7. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  8. }`,this.fragmentShader=`void main() {
  9. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  10. }`,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,r!==void 0&&(r.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(r))}function bh(r){mr.call(this),this.type="MeshDepthMaterial",this.depthPacking=Nne,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(r)}function su(r,e){this.min=r!==void 0?r:new oe(1/0,1/0,1/0),this.max=e!==void 0?e:new oe(-1/0,-1/0,-1/0)}function $n(r,e){this.center=r!==void 0?r:new oe,this.radius=e!==void 0?e:0}function ws(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function Io(r,e){this.normal=r!==void 0?r:new oe(1,0,0),this.constant=e!==void 0?e:0}function IS(r,e,t,i,n,a){this.planes=[r!==void 0?r:new Io,e!==void 0?e:new Io,t!==void 0?t:new Io,i!==void 0?i:new Io,n!==void 0?n:new Io,a!==void 0?a:new Io]}function Wne(r,e,t,i){var n=r.context,a=r.state,o=new IS,s=new qt,l=e.shadows,u=new St,c=new St(i.maxTextureSize,i.maxTextureSize),f=new oe,h=new oe,p=[],d=1,g=2,m=(d|g)+1,v=new Array(m),_=new Array(m),y={},x=[new oe(1,0,0),new oe(-1,0,0),new oe(0,0,1),new oe(0,0,-1),new oe(0,1,0),new oe(0,-1,0)],M=[new oe(0,1,0),new oe(0,1,0),new oe(0,1,0),new oe(0,1,0),new oe(0,0,1),new oe(0,0,-1)],S=[new ei,new ei,new ei,new ei,new ei,new ei],w=new bh;w.depthPacking=Une,w.clipping=!0;for(var T=ty.distanceRGBA,C=io.clone(T.uniforms),b=0;b!==m;++b){var E=(b&d)!==0,I=(b&g)!==0,R=w.clone();R.morphTargets=E,R.skinning=I,v[b]=R;var A=new Ma({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:T.vertexShader,fragmentShader:T.fragmentShader,morphTargets:E,skinning:I,clipping:!0});_[b]=A}var D=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=UF,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(z,k){if(D.enabled!==!1&&!(D.autoUpdate===!1&&D.needsUpdate===!1)&&l.length!==0){a.buffers.color.setClear(1,1,1,1),a.disable(n.BLEND),a.setDepthTest(!0),a.setScissorTest(!1);for(var G,Y,J=0,Q=l.length;J<Q;J++){var V=l[J],K=V.shadow;if(K===void 0){console.warn("THREE.WebGLShadowMap:",V,"has no shadow.");continue}var ae=K.camera;if(u.copy(K.mapSize),u.min(c),V&&V.isPointLight){G=6,Y=!0;var ve=u.x,ue=u.y;S[0].set(ve*2,ue,ve,ue),S[1].set(0,ue,ve,ue),S[2].set(ve*3,ue,ve,ue),S[3].set(ve,ue,ve,ue),S[4].set(ve*3,0,ve,ue),S[5].set(ve,0,ve,ue),u.x*=4,u.y*=2}else G=1,Y=!1;if(K.map===null){var se={minFilter:Oo,magFilter:Oo,format:ou};K.map=new Fy(u.x,u.y,se),ae.updateProjectionMatrix()}K.isSpotLightShadow&&K.update(V),K&&K.isRectAreaLightShadow&&K.update(V);var Ee=K.map,q=K.matrix;h.setFromMatrixPosition(V.matrixWorld),ae.position.copy(h),r.setRenderTarget(Ee),r.clear();for(var H=0;H<G;H++){if(Y){f.copy(ae.position),f.add(x[H]),ae.up.copy(M[H]),ae.lookAt(f);var We=S[H];a.viewport(We)}else f.setFromMatrixPosition(V.target.matrixWorld),ae.lookAt(f);ae.updateMatrixWorld(),ae.matrixWorldInverse.getInverse(ae.matrixWorld),q.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),q.multiply(ae.projectionMatrix),q.multiply(ae.matrixWorldInverse),s.multiplyMatrices(ae.projectionMatrix,ae.matrixWorldInverse),o.setFromMatrix(s),p.length=0,B(z,k,ae);for(var _e=0,xe=p.length;_e<xe;_e++){var Le=p[_e],Ue=t.update(Le),Ne=Le.material;if(Ne&&Ne.isMultiMaterial)for(var Ve=Ue.groups,ct=Ne.materials,F=0,L=Ve.length;F<L;F++){var ne=Ve[F],le=ct[ne.materialIndex];if(le.visible===!0){var me=U(Le,le,Y,h);r.renderBufferDirect(ae,null,Ue,me,Le,ne)}}else{var me=U(Le,Ne,Y,h);r.renderBufferDirect(ae,null,Ue,me,Le,null)}}}}var he=r.getClearColor(),et=r.getClearAlpha();r.setClearColor(he,et),D.needsUpdate=!1}};function U(z,k,G,Y){var J=z.geometry,Q=null,V=v,K=z.customDepthMaterial;if(G&&(V=_,K=z.customDistanceMaterial),K)Q=K;else{var ae=!1;k.morphTargets&&(J&&J.isBufferGeometry?ae=J.morphAttributes&&J.morphAttributes.position&&J.morphAttributes.position.length>0:J&&J.isGeometry&&(ae=J.morphTargets&&J.morphTargets.length>0));var ve=z.isSkinnedMesh&&k.skinning,ue=0;ae&&(ue|=d),ve&&(ue|=g),Q=V[ue]}if(r.localClippingEnabled&&k.clipShadows===!0&&k.clippingPlanes.length!==0){var se=Q.uuid,Ee=k.uuid,q=y[se];q===void 0&&(q={},y[se]=q);var H=q[Ee];H===void 0&&(H=Q.clone(),q[Ee]=H),Q=H}Q.visible=k.visible,Q.wireframe=k.wireframe;var We=k.side;return D.renderSingleSided&&We==Oy&&(We=Kg),D.renderReverseSided&&(We===Kg?We=xh:We===xh&&(We=Kg)),Q.side=We,Q.clipShadows=k.clipShadows,Q.clippingPlanes=k.clippingPlanes,Q.wireframeLinewidth=k.wireframeLinewidth,Q.linewidth=k.linewidth,G&&Q.uniforms.lightPos!==void 0&&Q.uniforms.lightPos.value.copy(Y),Q}function B(z,k,G){if(z.visible!==!1){var Y=(z.layers.mask&k.layers.mask)!==0;if(Y&&(z.isMesh||z.isLine||z.isPoints)&&z.castShadow&&(z.frustumCulled===!1||o.intersectsObject(z)===!0)){var J=z.material;J.visible===!0&&(z.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,z.matrixWorld),p.push(z))}for(var Q=z.children,V=0,K=Q.length;V<K;V++)B(Q[V],k,G)}}}function wh(r,e){this.origin=r!==void 0?r:new oe,this.direction=e!==void 0?e:new oe}function Th(r,e,t,i){this._x=r||0,this._y=e||0,this._z=t||0,this._order=i||Th.DefaultOrder}function ZA(){this.mask=1}function At(){Object.defineProperty(this,"id",{value:PRe++}),this.uuid=cr.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=At.DefaultUp.clone();var r=new oe,e=new Th,t=new on,i=new oe(1,1,1);function n(){t.setFromEuler(e,!1)}function a(){e.setFromQuaternion(t,void 0,!1)}e.onChange(n),t.onChange(a),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:t},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new qt},normalMatrix:{value:new ws}}),this.matrix=new qt,this.matrixWorld=new qt,this.matrixAutoUpdate=At.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ZA,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function Pd(r,e){this.start=r!==void 0?r:new oe,this.end=e!==void 0?e:new oe}function Ms(r,e,t){this.a=r!==void 0?r:new oe,this.b=e!==void 0?e:new oe,this.c=t!==void 0?t:new oe}function zo(r,e,t,i,n,a){this.a=r,this.b=e,this.c=t,this.normal=i&&i.isVector3?i:new oe,this.vertexNormals=Array.isArray(i)?i:[],this.color=n&&n.isColor?n:new Gt,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=a!==void 0?a:0}function oo(r){mr.call(this),this.type="MeshBasicMaterial",this.color=new Gt(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=gM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(r)}function gt(r,e,t){if(Array.isArray(r))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=cr.generateUUID(),this.array=r,this.itemSize=e,this.count=r!==void 0?r.length/e:0,this.normalized=t===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function NS(r,e){gt.call(this,new Int8Array(r),e)}function US(r,e){gt.call(this,new Uint8Array(r),e)}function OS(r,e){gt.call(this,new Uint8ClampedArray(r),e)}function zS(r,e){gt.call(this,new Int16Array(r),e)}function ic(r,e){gt.call(this,new Uint16Array(r),e)}function FS(r,e){gt.call(this,new Int32Array(r),e)}function nc(r,e){gt.call(this,new Uint32Array(r),e)}function gr(r,e){gt.call(this,new Float32Array(r),e)}function BS(r,e){gt.call(this,new Float64Array(r),e)}function Xne(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function sr(){Object.defineProperty(this,"id",{value:QF()}),this.uuid=cr.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function QF(){return DRe++}function Bt(){Object.defineProperty(this,"id",{value:QF()}),this.uuid=cr.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}}function mn(r,e){At.call(this),this.type="Mesh",this.geometry=r!==void 0?r:new Bt,this.material=e!==void 0?e:new oo({color:Math.random()*16777215}),this.drawMode=JF,this.updateMorphTargets()}function zd(r,e,t,i,n,a){Bt.call(this),this.type="BoxBufferGeometry",this.parameters={width:r,height:e,depth:t,widthSegments:i,heightSegments:n,depthSegments:a};var o=this;i=Math.floor(i)||1,n=Math.floor(n)||1,a=Math.floor(a)||1;var s=_(i,n,a),l=y(i,n,a),u=new(l>65535?Uint32Array:Uint16Array)(l),c=new Float32Array(s*3),f=new Float32Array(s*3),h=new Float32Array(s*2),p=0,d=0,g=0,m=0,v=0;x("z","y","x",-1,-1,t,e,r,a,n,0),x("z","y","x",1,-1,t,e,-r,a,n,1),x("x","z","y",1,1,r,t,e,i,a,2),x("x","z","y",1,-1,r,t,-e,i,a,3),x("x","y","z",1,-1,r,e,t,i,n,4),x("x","y","z",-1,-1,r,e,-t,i,n,5),this.setIndex(new gt(u,1)),this.addAttribute("position",new gt(c,3)),this.addAttribute("normal",new gt(f,3)),this.addAttribute("uv",new gt(h,2));function _(M,S,w){var T=0;return T+=(M+1)*(S+1)*2,T+=(M+1)*(w+1)*2,T+=(w+1)*(S+1)*2,T}function y(M,S,w){var T=0;return T+=M*S*2,T+=M*w*2,T+=w*S*2,T*6}function x(M,S,w,T,C,b,E,I,R,A,D){for(var U=b/R,B=E/A,z=b/2,k=E/2,G=I/2,Y=R+1,J=A+1,Q=0,V=0,K=new oe,ae=0;ae<J;ae++)for(var ve=ae*B-k,ue=0;ue<Y;ue++){var se=ue*U-z;K[M]=se*T,K[S]=ve*C,K[w]=G,c[p]=K.x,c[p+1]=K.y,c[p+2]=K.z,K[M]=0,K[S]=0,K[w]=I>0?1:-1,f[p]=K.x,f[p+1]=K.y,f[p+2]=K.z,h[d]=ue/R,h[d+1]=1-ae/A,p+=3,d+=2,Q+=1}for(ae=0;ae<A;ae++)for(ue=0;ue<R;ue++){var Ee=m+ue+Y*ae,q=m+ue+Y*(ae+1),H=m+(ue+1)+Y*(ae+1),We=m+(ue+1)+Y*ae;u[g]=Ee,u[g+1]=q,u[g+2]=We,u[g+3]=q,u[g+4]=H,u[g+5]=We,g+=6,V+=6}o.addGroup(v,V,D),v+=V,m+=Q}}function Fd(r,e,t,i){Bt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:r,height:e,widthSegments:t,heightSegments:i};for(var n=r/2,a=e/2,o=Math.floor(t)||1,s=Math.floor(i)||1,l=o+1,u=s+1,c=r/o,f=e/s,h=new Float32Array(l*u*3),p=new Float32Array(l*u*3),d=new Float32Array(l*u*2),g=0,m=0,v=0;v<u;v++)for(var _=v*f-a,y=0;y<l;y++){var x=y*c-n;h[g]=x,h[g+1]=-_,p[g+2]=1,d[m]=y/o,d[m+1]=1-v/s,g+=3,m+=2}g=0;for(var M=new(h.length/3>65535?Uint32Array:Uint16Array)(o*s*6),v=0;v<s;v++)for(var y=0;y<o;y++){var S=y+l*v,w=y+l*(v+1),T=y+1+l*(v+1),C=y+1+l*v;M[g]=S,M[g+1]=w,M[g+2]=C,M[g+3]=w,M[g+4]=T,M[g+5]=C,g+=6}this.setIndex(new gt(M,1)),this.addAttribute("position",new gt(h,3)),this.addAttribute("normal",new gt(p,3)),this.addAttribute("uv",new gt(d,2))}function Qn(){At.call(this),this.type="Camera",this.matrixWorldInverse=new qt,this.projectionMatrix=new qt}function Kn(r,e,t,i){Qn.call(this),this.type="PerspectiveCamera",this.fov=r!==void 0?r:50,this.zoom=1,this.near=t!==void 0?t:.1,this.far=i!==void 0?i:2e3,this.focus=10,this.aspect=e!==void 0?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ry(r,e,t,i,n,a){Qn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=r,this.right=e,this.top=t,this.bottom=i,this.near=n!==void 0?n:.1,this.far=a!==void 0?a:2e3,this.updateProjectionMatrix()}function IRe(r,e,t){var i;function n(c){i=c}var a,o;function s(c){c.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(a=r.UNSIGNED_INT,o=4):c.array instanceof Uint16Array?(a=r.UNSIGNED_SHORT,o=2):(a=r.UNSIGNED_BYTE,o=1)}function l(c,f){r.drawElements(i,f,a,c*o),t.calls++,t.vertices+=f,i===r.TRIANGLES&&(t.faces+=f/3)}function u(c,f,h){var p=e.get("ANGLE_instanced_arrays");if(p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p.drawElementsInstancedANGLE(i,h,a,f*o,c.maxInstancedCount),t.calls++,t.vertices+=h*c.maxInstancedCount,i===r.TRIANGLES&&(t.faces+=c.maxInstancedCount*h/3)}return{setMode:n,setIndex:s,render:l,renderInstances:u}}function NRe(r,e,t){var i;function n(s){i=s}function a(s,l){r.drawArrays(i,s,l),t.calls++,t.vertices+=l,i===r.TRIANGLES&&(t.faces+=l/3)}function o(s){var l=e.get("ANGLE_instanced_arrays");if(l===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}var u=s.attributes.position,c=0;u.isInterleavedBufferAttribute?(c=u.data.count,l.drawArraysInstancedANGLE(i,0,c,s.maxInstancedCount)):(c=u.count,l.drawArraysInstancedANGLE(i,0,c,s.maxInstancedCount)),t.calls++,t.vertices+=c*s.maxInstancedCount,i===r.TRIANGLES&&(t.faces+=s.maxInstancedCount*c/3)}return{setMode:n,render:a,renderInstances:o}}function URe(){var r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new oe,color:new Gt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"SpotLight":t={position:new oe,direction:new oe,color:new Gt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"PointLight":t={position:new oe,color:new Gt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"HemisphereLight":t={direction:new oe,skyColor:new Gt,groundColor:new Gt};break;case"RectAreaLight":t={color:new Gt,position:new oe,halfWidth:new oe,halfHeight:new oe};break}return r[e.id]=t,t}}}function ORe(r){for(var e=r.split(`
  11. `),t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
  12. `)}function Uie(r,e,t){var i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),r.getShaderParameter(i,r.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),r.getShaderInfoLog(i)!==""&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===r.VERTEX_SHADER?"vertex":"fragment",r.getShaderInfoLog(i),ORe(t)),i}function Yne(r){switch(r){case PS:return["Linear","( value )"];case Rne:return["sRGB","( value )"];case Lne:return["RGBE","( value )"];case Pne:return["RGBM","( value, 7.0 )"];case Dne:return["RGBM","( value, 16.0 )"];case Ine:return["RGBD","( value, 256.0 )"];case $F:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+r)}}function sF(r,e){var t=Yne(e);return"vec4 "+r+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function FRe(r,e){var t=Yne(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function BRe(r,e){var t;switch(e){case YF:t="Linear";break;case cne:t="Reinhard";break;case fne:t="Uncharted2";break;case hne:t="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function kRe(r,e,t){r=r||{};var i=[r.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(r.fragDepth||e.logarithmicDepthBuffer)&&t.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",r.drawBuffers&&t.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(r.shaderTextureLOD||e.envMap)&&t.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return i.filter(bS).join(`
  13. `)}function VRe(r){var e=[];for(var t in r){var i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  14. `)}function GRe(r,e,t){for(var i={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES),a=0;a<n;a++){var o=r.getActiveAttrib(e,a),s=o.name;i[s]=r.getAttribLocation(e,s)}return i}function bS(r){return r!==""}function Oie(r,e){return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function xF(r){var e=/#include +<([\w\d.]+)>/g;function t(i,n){var a=Xr[n];if(a===void 0)throw new Error("Can not resolve #include <"+n+">");return xF(a)}return r.replace(e,t)}function zie(r){var e=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function t(i,n,a,o){for(var s="",l=parseInt(n);l<parseInt(a);l++)s+=o.replace(/\[ i \]/g,"[ "+l+" ]");return s}return r.replace(e,t)}function HRe(r,e,t,i){var n=r.context,a=t.extensions,o=t.defines,s=t.__webglShader.vertexShader,l=t.__webglShader.fragmentShader,u="SHADOWMAP_TYPE_BASIC";i.shadowMapType===UF?u="SHADOWMAP_TYPE_PCF":i.shadowMapType===Gie&&(u="SHADOWMAP_TYPE_PCF_SOFT");var c="ENVMAP_TYPE_CUBE",f="ENVMAP_MODE_REFLECTION",h="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(t.envMap.mapping){case SC:case WA:c="ENVMAP_TYPE_CUBE";break;case MC:case bC:c="ENVMAP_TYPE_CUBE_UV";break;case qF:case XA:c="ENVMAP_TYPE_EQUIREC";break;case ZF:c="ENVMAP_TYPE_SPHERE";break}switch(t.envMap.mapping){case WA:case XA:f="ENVMAP_MODE_REFRACTION";break}switch(t.combine){case gM:h="ENVMAP_BLENDING_MULTIPLY";break;case lne:h="ENVMAP_BLENDING_MIX";break;case une:h="ENVMAP_BLENDING_ADD";break}}var p=r.gammaFactor>0?r.gammaFactor:1,d=kRe(a,i,r.extensions),g=VRe(o),m=n.createProgram(),v,_;t.isRawShaderMaterial?(v=[g,`
  15. `].filter(bS).join(`
  16. `),_=[d,g,`
  17. `].filter(bS).join(`
  18. `)):(v=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+t.__webglShader.name,g,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&r.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  19. `].filter(bS).join(`
  20. `),_=[d,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+t.__webglShader.name,g,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+p,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+f:"",i.envMap?"#define "+h:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&r.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&r.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==VA?"#define TONE_MAPPING":"",i.toneMapping!==VA?Xr.tonemapping_pars_fragment:"",i.toneMapping!==VA?BRe("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?Xr.encodings_pars_fragment:"",i.mapEncoding?sF("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?sF("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?sF("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?FRe("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  21. `].filter(bS).join(`
  22. `)),s=xF(s,i),s=Oie(s,i),l=xF(l,i),l=Oie(l,i),t.isShaderMaterial||(s=zie(s),l=zie(l));var y=v+s,x=_+l,M=Uie(n,n.VERTEX_SHADER,y),S=Uie(n,n.FRAGMENT_SHADER,x);n.attachShader(m,M),n.attachShader(m,S),t.index0AttributeName!==void 0?n.bindAttribLocation(m,0,t.index0AttributeName):i.morphTargets===!0&&n.bindAttribLocation(m,0,"position"),n.linkProgram(m);var w=n.getProgramInfoLog(m),T=n.getShaderInfoLog(M),C=n.getShaderInfoLog(S),b=!0,E=!0;n.getProgramParameter(m,n.LINK_STATUS)===!1?(b=!1,console.error("THREE.WebGLProgram: shader error: ",n.getError(),"gl.VALIDATE_STATUS",n.getProgramParameter(m,n.VALIDATE_STATUS),"gl.getProgramInfoLog",w,T,C)):w!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",w):(T===""||C==="")&&(E=!1),E&&(this.diagnostics={runnable:b,material:t,programLog:w,vertexShader:{log:T,prefix:v},fragmentShader:{log:C,prefix:_}}),n.deleteShader(M),n.deleteShader(S);var I;this.getUniforms=function(){return I===void 0&&(I=new Mh(n,m,r)),I};var R;return this.getAttributes=function(){return R===void 0&&(R=GRe(n,m)),R},this.destroy=function(){n.deleteProgram(m),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=zRe++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=M,this.fragmentShader=S,this}function WRe(r,e){var t=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},n=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking"];function a(s){if(e.floatVertexTextures&&s&&s.skeleton&&s.skeleton.useVertexTexture)return 1024;var l=e.maxVertexUniforms,u=Math.floor((l-20)/4),c=u;return s!==void 0&&s&&s.isSkinnedMesh&&(c=Math.min(s.skeleton.bones.length,c),c<s.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+s.skeleton.bones.length+", this GPU supports just "+c+" (try OpenGL instead of ANGLE)")),c}function o(s,l){var u;return s?s.isTexture?u=s.encoding:s.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),u=s.texture.encoding):u=PS,u===PS&&l&&(u=$F),u}this.getParameters=function(s,l,u,c,f,h){var p=i[s.type],d=a(h),g=r.getPrecision();s.precision!==null&&(g=e.getMaxPrecision(s.precision),g!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",g,"instead."));var m=r.getCurrentRenderTarget(),v={shaderID:p,precision:g,supportsVertexTextures:e.vertexTextures,outputEncoding:o(m?m.texture:null,r.gammaOutput),map:!!s.map,mapEncoding:o(s.map,r.gammaInput),envMap:!!s.envMap,envMapMode:s.envMap&&s.envMap.mapping,envMapEncoding:o(s.envMap,r.gammaInput),envMapCubeUV:!!s.envMap&&(s.envMap.mapping===MC||s.envMap.mapping===bC),lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,emissiveMapEncoding:o(s.emissiveMap,r.gammaInput),bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,alphaMap:!!s.alphaMap,gradientMap:!!s.gradientMap,combine:s.combine,vertexColors:s.vertexColors,fog:!!u,useFog:s.fog,fogExp:u&&u.isFogExp2,flatShading:s.shading===OF,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:s.skinning,maxBones:d,useVertexTexture:e.floatVertexTextures&&h&&h.skeleton&&h.skeleton.useVertexTexture,morphTargets:s.morphTargets,morphNormals:s.morphNormals,maxMorphTargets:r.maxMorphTargets,maxMorphNormals:r.maxMorphNormals,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numClippingPlanes:c,numClipIntersection:f,shadowMapEnabled:r.shadowMap.enabled&&h.receiveShadow&&l.shadows.length>0,shadowMapType:r.shadowMap.type,toneMapping:r.toneMapping,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,alphaTest:s.alphaTest,doubleSided:s.side===Oy,flipSided:s.side===xh,depthPacking:s.depthPacking!==void 0?s.depthPacking:!1};return v},this.getProgramCode=function(s,l){var u=[];if(l.shaderID?u.push(l.shaderID):(u.push(s.fragmentShader),u.push(s.vertexShader)),s.defines!==void 0)for(var c in s.defines)u.push(c),u.push(s.defines[c]);for(var f=0;f<n.length;f++)u.push(l[n[f]]);return u.join()},this.acquireProgram=function(s,l,u){for(var c,f=0,h=t.length;f<h;f++){var p=t[f];if(p.code===u){c=p,++c.usedTimes;break}}return c===void 0&&(c=new HRe(r,u,s,l),t.push(c)),c},this.releaseProgram=function(s){if(--s.usedTimes===0){var l=t.indexOf(s);t[l]=t[t.length-1],t.pop(),s.destroy()}},this.programs=t}function XRe(r,e,t){var i={};function n(u){var c=u.target,f=i[c.id];f.index!==null&&o(f.index),s(f.attributes),c.removeEventListener("dispose",n),delete i[c.id];var h=e.get(c);h.wireframe&&o(h.wireframe),e.delete(c);var p=e.get(f);p.wireframe&&o(p.wireframe),e.delete(f),t.memory.geometries--}function a(u){return u.isInterleavedBufferAttribute?e.get(u.data).__webglBuffer:e.get(u).__webglBuffer}function o(u){var c=a(u);c!==void 0&&(r.deleteBuffer(c),l(u))}function s(u){for(var c in u)o(u[c])}function l(u){u.isInterleavedBufferAttribute?e.delete(u.data):e.delete(u)}return{get:function(u){var c=u.geometry;if(i[c.id]!==void 0)return i[c.id];c.addEventListener("dispose",n);var f;return c.isBufferGeometry?f=c:c.isGeometry&&(c._bufferGeometry===void 0&&(c._bufferGeometry=new Bt().setFromObject(u)),f=c._bufferGeometry),i[c.id]=f,t.memory.geometries++,f}}}function YRe(r,e,t){var i=new XRe(r,e,t);function n(f){var h=i.get(f);f.geometry.isGeometry&&h.updateFromObject(f);var p=h.index,d=h.attributes;p!==null&&a(p,r.ELEMENT_ARRAY_BUFFER);for(var g in d)a(d[g],r.ARRAY_BUFFER);var m=h.morphAttributes;for(var g in m)for(var v=m[g],_=0,y=v.length;_<y;_++)a(v[_],r.ARRAY_BUFFER);return h}function a(f,h){var p=f.isInterleavedBufferAttribute?f.data:f,d=e.get(p);d.__webglBuffer===void 0?o(d,p,h):d.version!==p.version&&s(d,p,h)}function o(f,h,p){f.__webglBuffer=r.createBuffer(),r.bindBuffer(p,f.__webglBuffer);var d=h.dynamic?r.DYNAMIC_DRAW:r.STATIC_DRAW;r.bufferData(p,h.array,d);var g=r.FLOAT,m=h.array;m instanceof Float32Array?g=r.FLOAT:m instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):m instanceof Uint16Array?g=r.UNSIGNED_SHORT:m instanceof Int16Array?g=r.SHORT:m instanceof Uint32Array?g=r.UNSIGNED_INT:m instanceof Int32Array?g=r.INT:m instanceof Int8Array?g=r.BYTE:m instanceof Uint8Array&&(g=r.UNSIGNED_BYTE),f.bytesPerElement=m.BYTES_PER_ELEMENT,f.type=g,f.version=h.version,h.onUploadCallback()}function s(f,h,p){r.bindBuffer(p,f.__webglBuffer),h.dynamic===!1?r.bufferData(p,h.array,r.STATIC_DRAW):h.updateRange.count===-1?r.bufferSubData(p,0,h.array):h.updateRange.count===0?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(r.bufferSubData(p,h.updateRange.offset*h.array.BYTES_PER_ELEMENT,h.array.subarray(h.updateRange.offset,h.updateRange.offset+h.updateRange.count)),h.updateRange.count=0),f.version=h.version}function l(f){return f.isInterleavedBufferAttribute?e.get(f.data).__webglBuffer:e.get(f).__webglBuffer}function u(f){return f.isInterleavedBufferAttribute?e.get(f.data):e.get(f)}function c(f){var h=e.get(f);if(h.wireframe!==void 0)return h.wireframe;var p=[],d=f.index,g=f.attributes,m=g.position;if(d!==null)for(var v={},_=d.array,y=0,x=_.length;y<x;y+=3){var M=_[y+0],S=_[y+1],w=_[y+2];p.push(M,S,S,w,w,M)}else for(var _=g.position.array,y=0,x=_.length/3-1;y<x;y+=3){var M=y+0,S=y+1,w=y+2;p.push(M,S,S,w,w,M)}var T=m.count>65535?Uint32Array:Uint16Array,C=new gt(new T(p),1);return a(C,r.ELEMENT_ARRAY_BUFFER),h.wireframe=C,C}return{getAttributeBuffer:l,getAttributeProperties:u,getWireframeAttribute:c,update:n}}function qRe(r,e,t,i,n,a,o){var s=o.memory,l=typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext;function u(R,A){if(R.width>A||R.height>A){var D=A/Math.max(R.width,R.height),U=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");U.width=Math.floor(R.width*D),U.height=Math.floor(R.height*D);var B=U.getContext("2d");return B.drawImage(R,0,0,R.width,R.height,0,0,U.width,U.height),console.warn("THREE.WebGLRenderer: image is too big ("+R.width+"x"+R.height+"). Resized to "+U.width+"x"+U.height,R),U}return R}function c(R){return cr.isPowerOfTwo(R.width)&&cr.isPowerOfTwo(R.height)}function f(R){if(R instanceof HTMLImageElement||R instanceof HTMLCanvasElement){var A=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");A.width=cr.nearestPowerOfTwo(R.width),A.height=cr.nearestPowerOfTwo(R.height);var D=A.getContext("2d");return D.drawImage(R,0,0,A.width,A.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+R.width+"x"+R.height+"). Resized to "+A.width+"x"+A.height,R),A}return R}function h(R){return R.wrapS!==Uo||R.wrapT!==Uo||R.minFilter!==Oo&&R.minFilter!==no}function p(R){return R===Oo||R===wC||R===TC?r.NEAREST:r.LINEAR}function d(R){var A=R.target;A.removeEventListener("dispose",d),m(A),s.textures--}function g(R){var A=R.target;A.removeEventListener("dispose",g),v(A),s.textures--}function m(R){var A=i.get(R);if(R.image&&A.__image__webglTextureCube)r.deleteTexture(A.__image__webglTextureCube);else{if(A.__webglInit===void 0)return;r.deleteTexture(A.__webglTexture)}i.delete(R)}function v(R){var A=i.get(R),D=i.get(R.texture);if(R){if(D.__webglTexture!==void 0&&r.deleteTexture(D.__webglTexture),R.depthTexture&&R.depthTexture.dispose(),R.isWebGLRenderTargetCube)for(var U=0;U<6;U++)r.deleteFramebuffer(A.__webglFramebuffer[U]),A.__webglDepthbuffer&&r.deleteRenderbuffer(A.__webglDepthbuffer[U]);else r.deleteFramebuffer(A.__webglFramebuffer),A.__webglDepthbuffer&&r.deleteRenderbuffer(A.__webglDepthbuffer);i.delete(R.texture),i.delete(R)}}function _(R,A){var D=i.get(R);if(R.version>0&&D.__version!==R.version){var U=R.image;if(U===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",R);else if(U.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",R);else{S(D,R,A);return}}t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_2D,D.__webglTexture)}function y(R,A){var D=i.get(R);if(R.image.length===6)if(R.version>0&&D.__version!==R.version){D.__image__webglTextureCube||(R.addEventListener("dispose",d),D.__image__webglTextureCube=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,D.__image__webglTextureCube),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,R.flipY);for(var U=R&&R.isCompressedTexture,B=R.image[0]&&R.image[0].isDataTexture,z=[],k=0;k<6;k++)!U&&!B?z[k]=u(R.image[k],n.maxCubemapSize):z[k]=B?R.image[k].image:R.image[k];var G=z[0],Y=c(G),J=a(R.format),Q=a(R.type);M(r.TEXTURE_CUBE_MAP,R,Y);for(var k=0;k<6;k++)if(!U)B?t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,J,z[k].width,z[k].height,0,J,Q,z[k].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,J,J,Q,z[k]);else for(var V,K=z[k].mipmaps,ae=0,ve=K.length;ae<ve;ae++)V=K[ae],R.format!==ou&&R.format!==$g?t.getCompressedTextureFormats().indexOf(J)>-1?t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,ae,J,V.width,V.height,0,V.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,ae,J,V.width,V.height,0,J,Q,V.data);R.generateMipmaps&&Y&&r.generateMipmap(r.TEXTURE_CUBE_MAP),D.__version=R.version,R.onUpdate&&R.onUpdate(R)}else t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,D.__image__webglTextureCube)}function x(R,A){t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,i.get(R).__webglTexture)}function M(R,A,D){var U;if(D?(r.texParameteri(R,r.TEXTURE_WRAP_S,a(A.wrapS)),r.texParameteri(R,r.TEXTURE_WRAP_T,a(A.wrapT)),r.texParameteri(R,r.TEXTURE_MAG_FILTER,a(A.magFilter)),r.texParameteri(R,r.TEXTURE_MIN_FILTER,a(A.minFilter))):(r.texParameteri(R,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(R,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(A.wrapS!==Uo||A.wrapT!==Uo)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",A),r.texParameteri(R,r.TEXTURE_MAG_FILTER,p(A.magFilter)),r.texParameteri(R,r.TEXTURE_MIN_FILTER,p(A.minFilter)),A.minFilter!==Oo&&A.minFilter!==no&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",A)),U=e.get("EXT_texture_filter_anisotropic"),U){if(A.type===Jg&&e.get("OES_texture_float_linear")===null||A.type===qA&&e.get("OES_texture_half_float_linear")===null)return;(A.anisotropy>1||i.get(A).__currentAnisotropy)&&(r.texParameterf(R,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,n.getMaxAnisotropy())),i.get(A).__currentAnisotropy=A.anisotropy)}}function S(R,A,D){R.__webglInit===void 0&&(R.__webglInit=!0,A.addEventListener("dispose",d),R.__webglTexture=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+D),t.bindTexture(r.TEXTURE_2D,R.__webglTexture),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,A.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,A.unpackAlignment);var U=u(A.image,n.maxTextureSize);h(A)&&c(U)===!1&&(U=f(U));var B=c(U),z=a(A.format),k=a(A.type);M(r.TEXTURE_2D,A,B);var G,Y=A.mipmaps;if(A.isDepthTexture){var J=r.DEPTH_COMPONENT;if(A.type===Jg){if(!l)throw new Error("Float Depth Texture only supported in WebGL2.0");J=r.DEPTH_COMPONENT32F}else l&&(J=r.DEPTH_COMPONENT16);A.format===Ld&&J===r.DEPTH_COMPONENT&&A.type!==AS&&A.type!==KF&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),A.type=AS,k=a(A.type)),A.format===Qg&&(J=r.DEPTH_STENCIL,A.type!==CS&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),A.type=CS,k=a(A.type))),t.texImage2D(r.TEXTURE_2D,0,J,U.width,U.height,0,z,k,null)}else if(A.isDataTexture)if(Y.length>0&&B){for(var Q=0,V=Y.length;Q<V;Q++)G=Y[Q],t.texImage2D(r.TEXTURE_2D,Q,z,G.width,G.height,0,z,k,G.data);A.generateMipmaps=!1}else t.texImage2D(r.TEXTURE_2D,0,z,U.width,U.height,0,z,k,U.data);else if(A.isCompressedTexture)for(var Q=0,V=Y.length;Q<V;Q++)G=Y[Q],A.format!==ou&&A.format!==$g?t.getCompressedTextureFormats().indexOf(z)>-1?t.compressedTexImage2D(r.TEXTURE_2D,Q,z,G.width,G.height,0,G.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(r.TEXTURE_2D,Q,z,G.width,G.height,0,z,k,G.data);else if(Y.length>0&&B){for(var Q=0,V=Y.length;Q<V;Q++)G=Y[Q],t.texImage2D(r.TEXTURE_2D,Q,z,z,k,G);A.generateMipmaps=!1}else t.texImage2D(r.TEXTURE_2D,0,z,z,k,U);A.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_2D),R.__version=A.version,A.onUpdate&&A.onUpdate(A)}function w(R,A,D,U){var B=a(A.texture.format),z=a(A.texture.type);t.texImage2D(U,0,B,A.width,A.height,0,B,z,null),r.bindFramebuffer(r.FRAMEBUFFER,R),r.framebufferTexture2D(r.FRAMEBUFFER,D,U,i.get(A.texture).__webglTexture,0),r.bindFramebuffer(r.FRAMEBUFFER,null)}function T(R,A){r.bindRenderbuffer(r.RENDERBUFFER,R),A.depthBuffer&&!A.stencilBuffer?(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,A.width,A.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,R)):A.depthBuffer&&A.stencilBuffer?(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,A.width,A.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,R)):r.renderbufferStorage(r.RENDERBUFFER,r.RGBA4,A.width,A.height),r.bindRenderbuffer(r.RENDERBUFFER,null)}function C(R,A){var D=A&&A.isWebGLRenderTargetCube;if(D)throw new Error("Depth Texture with cube render targets is not supported!");if(r.bindFramebuffer(r.FRAMEBUFFER,R),!(A.depthTexture&&A.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(A.depthTexture).__webglTexture||A.depthTexture.image.width!==A.width||A.depthTexture.image.height!==A.height)&&(A.depthTexture.image.width=A.width,A.depthTexture.image.height=A.height,A.depthTexture.needsUpdate=!0),_(A.depthTexture,0);var U=i.get(A.depthTexture).__webglTexture;if(A.depthTexture.format===Ld)r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,U,0);else if(A.depthTexture.format===Qg)r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,U,0);else throw new Error("Unknown depthTexture format")}function b(R){var A=i.get(R),D=R.isWebGLRenderTargetCube===!0;if(R.depthTexture){if(D)throw new Error("target.depthTexture not supported in Cube render targets");C(A.__webglFramebuffer,R)}else if(D){A.__webglDepthbuffer=[];for(var U=0;U<6;U++)r.bindFramebuffer(r.FRAMEBUFFER,A.__webglFramebuffer[U]),A.__webglDepthbuffer[U]=r.createRenderbuffer(),T(A.__webglDepthbuffer[U],R)}else r.bindFramebuffer(r.FRAMEBUFFER,A.__webglFramebuffer),A.__webglDepthbuffer=r.createRenderbuffer(),T(A.__webglDepthbuffer,R);r.bindFramebuffer(r.FRAMEBUFFER,null)}function E(R){var A=i.get(R),D=i.get(R.texture);R.addEventListener("dispose",g),D.__webglTexture=r.createTexture(),s.textures++;var U=R.isWebGLRenderTargetCube===!0,B=c(R);if(U){A.__webglFramebuffer=[];for(var z=0;z<6;z++)A.__webglFramebuffer[z]=r.createFramebuffer()}else A.__webglFramebuffer=r.createFramebuffer();if(U){t.bindTexture(r.TEXTURE_CUBE_MAP,D.__webglTexture),M(r.TEXTURE_CUBE_MAP,R.texture,B);for(var z=0;z<6;z++)w(A.__webglFramebuffer[z],R,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+z);R.texture.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_CUBE_MAP),t.bindTexture(r.TEXTURE_CUBE_MAP,null)}else t.bindTexture(r.TEXTURE_2D,D.__webglTexture),M(r.TEXTURE_2D,R.texture,B),w(A.__webglFramebuffer,R,r.COLOR_ATTACHMENT0,r.TEXTURE_2D),R.texture.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_2D),t.bindTexture(r.TEXTURE_2D,null);R.depthBuffer&&b(R)}function I(R){var A=R.texture;if(A.generateMipmaps&&c(R)&&A.minFilter!==Oo&&A.minFilter!==no){var D=R&&R.isWebGLRenderTargetCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,U=i.get(A).__webglTexture;t.bindTexture(D,U),r.generateMipmap(D),t.bindTexture(D,null)}}this.setTexture2D=_,this.setTextureCube=y,this.setTextureCubeDynamic=x,this.setupRenderTarget=E,this.updateRenderTargetMipmap=I}function ZRe(){var r={};return{get:function(e){var t=e.uuid,i=r[t];return i===void 0&&(i={},r[t]=i),i},delete:function(e){delete r[e.uuid]},clear:function(){r={}}}}function jRe(r,e,t){function i(){var $=!1,it=new ei,Xe=null,Fe=new ei;return{setMask:function(we){Xe!==we&&!$&&(r.colorMask(we,we,we,we),Xe=we)},setLocked:function(we){$=we},setClear:function(we,Ie,st,Je,kt){kt===!0&&(we*=Je,Ie*=Je,st*=Je),it.set(we,Ie,st,Je),Fe.equals(it)===!1&&(r.clearColor(we,Ie,st,Je),Fe.copy(it))},reset:function(){$=!1,Xe=null,Fe.set(0,0,0,1)}}}function n(){var $=!1,it=null,Xe=null,Fe=null;return{setTest:function(we){we?ve(r.DEPTH_TEST):ue(r.DEPTH_TEST)},setMask:function(we){it!==we&&!$&&(r.depthMask(we),it=we)},setFunc:function(we){if(Xe!==we){if(we)switch(we){case tne:r.depthFunc(r.NEVER);break;case rne:r.depthFunc(r.ALWAYS);break;case ine:r.depthFunc(r.LESS);break;case HA:r.depthFunc(r.LEQUAL);break;case nne:r.depthFunc(r.EQUAL);break;case ane:r.depthFunc(r.GEQUAL);break;case one:r.depthFunc(r.GREATER);break;case sne:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}else r.depthFunc(r.LEQUAL);Xe=we}},setLocked:function(we){$=we},setClear:function(we){Fe!==we&&(r.clearDepth(we),Fe=we)},reset:function(){$=!1,it=null,Xe=null,Fe=null}}}function a(){var $=!1,it=null,Xe=null,Fe=null,we=null,Ie=null,st=null,Je=null,kt=null;return{setTest:function(X){X?ve(r.STENCIL_TEST):ue(r.STENCIL_TEST)},setMask:function(X){it!==X&&!$&&(r.stencilMask(X),it=X)},setFunc:function(X,Te,te){(Xe!==X||Fe!==Te||we!==te)&&(r.stencilFunc(X,Te,te),Xe=X,Fe=Te,we=te)},setOp:function(X,Te,te){(Ie!==X||st!==Te||Je!==te)&&(r.stencilOp(X,Te,te),Ie=X,st=Te,Je=te)},setLocked:function(X){$=X},setClear:function(X){kt!==X&&(r.clearStencil(X),kt=X)},reset:function(){$=!1,it=null,Xe=null,Fe=null,we=null,Ie=null,st=null,Je=null,kt=null}}}var o=new i,s=new n,l=new a,u=r.getParameter(r.MAX_VERTEX_ATTRIBS),c=new Uint8Array(u),f=new Uint8Array(u),h=new Uint8Array(u),p={},d=null,g=null,m=null,v=null,_=null,y=null,x=null,M=null,S=!1,w=null,T=null,C=null,b=null,E=null,I=null,R=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),A=parseFloat(/^WebGL\ ([0-9])/.exec(r.getParameter(r.VERSION))[1]),D=parseFloat(A)>=1,U=null,B={},z=new ei,k=new ei;function G($,it,Xe){var Fe=new Uint8Array(4),we=r.createTexture();r.bindTexture($,we),r.texParameteri($,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri($,r.TEXTURE_MAG_FILTER,r.NEAREST);for(var Ie=0;Ie<Xe;Ie++)r.texImage2D(it+Ie,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Fe);return we}var Y={};Y[r.TEXTURE_2D]=G(r.TEXTURE_2D,r.TEXTURE_2D,1),Y[r.TEXTURE_CUBE_MAP]=G(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6);function J(){o.setClear(0,0,0,1),s.setClear(1),l.setClear(0),ve(r.DEPTH_TEST),_e(HA),Ve(!1),ct(TS),ve(r.CULL_FACE),ve(r.BLEND),Ee(zy)}function Q(){for(var $=0,it=c.length;$<it;$++)c[$]=0}function V($){if(c[$]=1,f[$]===0&&(r.enableVertexAttribArray($),f[$]=1),h[$]!==0){var it=e.get("ANGLE_instanced_arrays");it.vertexAttribDivisorANGLE($,0),h[$]=0}}function K($,it,Xe){c[$]=1,f[$]===0&&(r.enableVertexAttribArray($),f[$]=1),h[$]!==it&&(Xe.vertexAttribDivisorANGLE($,it),h[$]=it)}function ae(){for(var $=0,it=f.length;$!==it;++$)f[$]!==c[$]&&(r.disableVertexAttribArray($),f[$]=0)}function ve($){p[$]!==!0&&(r.enable($),p[$]=!0)}function ue($){p[$]!==!1&&(r.disable($),p[$]=!1)}function se(){if(d===null&&(d=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var $=r.getParameter(r.COMPRESSED_TEXTURE_FORMATS),it=0;it<$.length;it++)d.push($[it]);return d}function Ee($,it,Xe,Fe,we,Ie,st,Je){$!==ES?ve(r.BLEND):ue(r.BLEND),($!==g||Je!==S)&&($===BF?Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ONE,r.ONE,r.ONE,r.ONE)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE)):$===kF?Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ZERO,r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ONE_MINUS_SRC_ALPHA)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ZERO,r.ONE_MINUS_SRC_COLOR)):$===VF?Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ZERO,r.SRC_COLOR)):Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)),g=$,S=Je),$===GF?(we=we||it,Ie=Ie||Xe,st=st||Fe,(it!==m||we!==y)&&(r.blendEquationSeparate(t(it),t(we)),m=it,y=we),(Xe!==v||Fe!==_||Ie!==x||st!==M)&&(r.blendFuncSeparate(t(Xe),t(Fe),t(Ie),t(st)),v=Xe,_=Fe,x=Ie,M=st)):(m=null,v=null,_=null,y=null,x=null,M=null)}function q($){o.setMask($)}function H($){s.setTest($)}function We($){s.setMask($)}function _e($){s.setFunc($)}function xe($){l.setTest($)}function Le($){l.setMask($)}function Ue($,it,Xe){l.setFunc($,it,Xe)}function Ne($,it,Xe){l.setOp($,it,Xe)}function Ve($){w!==$&&($?r.frontFace(r.CW):r.frontFace(r.CCW),w=$)}function ct($){$!==kie?(ve(r.CULL_FACE),$!==T&&($===TS?r.cullFace(r.BACK):$===NF?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):ue(r.CULL_FACE),T=$}function F($){$!==C&&(D&&r.lineWidth($),C=$)}function L($,it,Xe){$?(ve(r.POLYGON_OFFSET_FILL),(b!==it||E!==Xe)&&(r.polygonOffset(it,Xe),b=it,E=Xe)):ue(r.POLYGON_OFFSET_FILL)}function ne(){return I}function le($){I=$,$?ve(r.SCISSOR_TEST):ue(r.SCISSOR_TEST)}function me($){$===void 0&&($=r.TEXTURE0+R-1),U!==$&&(r.activeTexture($),U=$)}function he($,it){U===null&&me();var Xe=B[U];Xe===void 0&&(Xe={type:void 0,texture:void 0},B[U]=Xe),(Xe.type!==$||Xe.texture!==it)&&(r.bindTexture($,it||Y[$]),Xe.type=$,Xe.texture=it)}function et(){try{r.compressedTexImage2D.apply(r,arguments)}catch($){console.error($)}}function Ke(){try{r.texImage2D.apply(r,arguments)}catch($){console.error($)}}function Se($){z.equals($)===!1&&(r.scissor($.x,$.y,$.z,$.w),z.copy($))}function Ae($){k.equals($)===!1&&(r.viewport($.x,$.y,$.z,$.w),k.copy($))}function nt(){for(var $=0;$<f.length;$++)f[$]===1&&(r.disableVertexAttribArray($),f[$]=0);p={},d=null,U=null,B={},g=null,w=null,T=null,o.reset(),s.reset(),l.reset()}return{buffers:{color:o,depth:s,stencil:l},init:J,initAttributes:Q,enableAttribute:V,enableAttributeAndDivisor:K,disableUnusedAttributes:ae,enable:ve,disable:ue,getCompressedTextureFormats:se,setBlending:Ee,setColorWrite:q,setDepthTest:H,setDepthWrite:We,setDepthFunc:_e,setStencilTest:xe,setStencilWrite:Le,setStencilFunc:Ue,setStencilOp:Ne,setFlipSided:Ve,setCullFace:ct,setLineWidth:F,setPolygonOffset:L,getScissorTest:ne,setScissorTest:le,activeTexture:me,bindTexture:he,compressedTexImage2D:et,texImage2D:Ke,scissor:Se,viewport:Ae,reset:nt}}function KRe(r,e,t){var i;function n(){if(i!==void 0)return i;var x=e.get("EXT_texture_filter_anisotropic");return x!==null?i=r.getParameter(x.MAX_TEXTURE_MAX_ANISOTROPY_EXT):i=0,i}function a(x){if(x==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=t.precision!==void 0?t.precision:"highp",s=a(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=t.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),u=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),c=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_TEXTURE_SIZE),h=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),d=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),g=r.getParameter(r.MAX_VARYING_VECTORS),m=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),v=c>0,_=!!e.get("OES_texture_float"),y=v&&_;return{getMaxAnisotropy:n,getMaxPrecision:a,precision:o,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:f,maxCubemapSize:h,maxAttributes:p,maxVertexUniforms:d,maxVaryings:g,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:_,floatVertexTextures:y}}function JRe(r){var e={};return{get:function(t){if(e[t]!==void 0)return e[t];var i;switch(t){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=r.getExtension("WEBGL_compressed_texture_etc1");break;default:i=r.getExtension(t)}return i===null&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e[t]=i,i}}}function $Re(){var r=this,e=null,t=0,i=!1,n=!1,a=new Io,o=new ws,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(c,f,h){var p=c.length!==0||f||t!==0||i;return i=f,e=u(c,h,0),t=c.length,p},this.beginShadows=function(){n=!0,u(null)},this.endShadows=function(){n=!1,l()},this.setState=function(c,f,h,p,d,g){if(!i||c===null||c.length===0||n&&!h)n?u(null):l();else{var m=n?0:t,v=m*4,_=d.clippingState||null;s.value=_,_=u(c,p,v,g);for(var y=0;y!==v;++y)_[y]=e[y];d.clippingState=_,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=m}};function l(){s.value!==e&&(s.value=e,s.needsUpdate=t>0),r.numPlanes=t,r.numIntersection=0}function u(c,f,h,p){var d=c!==null?c.length:0,g=null;if(d!==0){if(g=s.value,p!==!0||g===null){var m=h+d*4,v=f.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length<m)&&(g=new Float32Array(m));for(var _=0,y=h;_!==d;++_,y+=4)a.copy(c[_]).applyMatrix4(v,o),a.normal.toArray(g,y),g[y+3]=a.constant}s.value=g,s.needsUpdate=!0}return r.numPlanes=d,g}}function eB(r){console.log("THREE.WebGLRenderer",Bie),r=r||{};var e=r.canvas!==void 0?r.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=r.context!==void 0?r.context:null,i=r.alpha!==void 0?r.alpha:!1,n=r.depth!==void 0?r.depth:!0,a=r.stencil!==void 0?r.stencil:!0,o=r.antialias!==void 0?r.antialias:!1,s=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,u=[],c=[],f=-1,h=[],p=-1,d=new Float32Array(8),g=[],m=[];this.domElement=e,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=YF,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var v=this,_=null,y=null,x=null,M=-1,S="",w=null,T=new ei,C=null,b=new ei,E=0,I=new Gt(0),R=0,A=e.width,D=e.height,U=1,B=new ei(0,0,A,D),z=!1,k=new ei(0,0,A,D),G=new IS,Y=new $Re,J=!1,Q=!1,V=new $n,K=new qt,ae=new oe,ve=new qt,ue=new qt,se={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ee={calls:0,vertices:0,faces:0,points:0};this.info={render:Ee,memory:{geometries:0,textures:0},programs:null};var q;try{var H={alpha:i,depth:n,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l};if(q=t||e.getContext("webgl",H)||e.getContext("experimental-webgl",H),q===null)throw e.getContext("webgl")!==null?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";q.getShaderPrecisionFormat===void 0&&(q.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),e.addEventListener("webglcontextlost",Xe,!1)}catch(P){console.error("THREE.WebGLRenderer: "+P)}var We=new JRe(q);We.get("WEBGL_depth_texture"),We.get("OES_texture_float"),We.get("OES_texture_float_linear"),We.get("OES_texture_half_float"),We.get("OES_texture_half_float_linear"),We.get("OES_standard_derivatives"),We.get("ANGLE_instanced_arrays"),We.get("OES_element_index_uint")&&(Bt.MaxIndex=4294967296);var _e=new KRe(q,We,r),xe=new jRe(q,We,ie),Le=new ZRe,Ue=new qRe(q,We,xe,Le,_e,ie,this.info),Ne=new YRe(q,Le,this.info),Ve=new WRe(this,_e),ct=new URe;this.info.programs=Ve.programs;var F=new NRe(q,We,Ee),L=new IRe(q,We,Ee),ne=new ry(-1,1,1,-1,0,1),le=new Kn,me=new mn(new Fd(2,2),new oo({depthTest:!1,depthWrite:!1,fog:!1})),he=ty.cube,et=new mn(new zd(5,5,5),new Ma({uniforms:he.uniforms,vertexShader:he.vertexShader,fragmentShader:he.fragmentShader,side:xh,depthTest:!1,depthWrite:!1,fog:!1}));function Ke(){return y===null?U:1}function Se(){xe.init(),xe.scissor(T.copy(B).multiplyScalar(U)),xe.viewport(b.copy(k).multiplyScalar(U)),xe.buffers.color.setClear(I.r,I.g,I.b,R,s)}function Ae(){_=null,w=null,S="",M=-1,xe.reset()}Se(),this.context=q,this.capabilities=_e,this.extensions=We,this.properties=Le,this.state=xe;var nt=new Wne(this,se,Ne,_e);this.shadowMap=nt;var $=new RRe(this,g),it=new CRe(this,m);this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){We.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return _e.getMaxAnisotropy()},this.getPrecision=function(){return _e.precision},this.getPixelRatio=function(){return U},this.setPixelRatio=function(P){P!==void 0&&(U=P,this.setSize(k.z,k.w,!1))},this.getSize=function(){return{width:A,height:D}},this.setSize=function(P,W,ee){A=P,D=W,e.width=P*U,e.height=W*U,ee!==!1&&(e.style.width=P+"px",e.style.height=W+"px"),this.setViewport(0,0,P,W)},this.setViewport=function(P,W,ee,ge){xe.viewport(k.set(P,W,ee,ge))},this.setScissor=function(P,W,ee,ge){xe.scissor(B.set(P,W,ee,ge))},this.setScissorTest=function(P){xe.setScissorTest(z=P)},this.getClearColor=function(){return I},this.setClearColor=function(P,W){I.set(P),R=W!==void 0?W:1,xe.buffers.color.setClear(I.r,I.g,I.b,R,s)},this.getClearAlpha=function(){return R},this.setClearAlpha=function(P){R=P,xe.buffers.color.setClear(I.r,I.g,I.b,R,s)},this.clear=function(P,W,ee){var ge=0;(P===void 0||P)&&(ge|=q.COLOR_BUFFER_BIT),(W===void 0||W)&&(ge|=q.DEPTH_BUFFER_BIT),(ee===void 0||ee)&&(ge|=q.STENCIL_BUFFER_BIT),q.clear(ge)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(P,W,ee,ge){this.setRenderTarget(P),this.clear(W,ee,ge)},this.resetGLState=Ae,this.dispose=function(){h=[],p=-1,c=[],f=-1,e.removeEventListener("webglcontextlost",Xe,!1)};function Xe(P){P.preventDefault(),Ae(),Se(),Le.clear()}function Fe(P){var W=P.target;W.removeEventListener("dispose",Fe),we(W)}function we(P){Ie(P),Le.delete(P)}function Ie(P){var W=Le.get(P).program;P.program=void 0,W!==void 0&&Ve.releaseProgram(W)}this.renderBufferImmediate=function(P,W,ee){xe.initAttributes();var ge=Le.get(P);P.hasPositions&&!ge.position&&(ge.position=q.createBuffer()),P.hasNormals&&!ge.normal&&(ge.normal=q.createBuffer()),P.hasUvs&&!ge.uv&&(ge.uv=q.createBuffer()),P.hasColors&&!ge.color&&(ge.color=q.createBuffer());var ce=W.getAttributes();if(P.hasPositions&&(q.bindBuffer(q.ARRAY_BUFFER,ge.position),q.bufferData(q.ARRAY_BUFFER,P.positionArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.position),q.vertexAttribPointer(ce.position,3,q.FLOAT,!1,0,0)),P.hasNormals){if(q.bindBuffer(q.ARRAY_BUFFER,ge.normal),!ee.isMeshPhongMaterial&&!ee.isMeshStandardMaterial&&!ee.isMeshNormalMaterial&&ee.shading===OF)for(var Oe=0,Ge=P.count*3;Oe<Ge;Oe+=9){var Re=P.normalArray,pt=(Re[Oe+0]+Re[Oe+3]+Re[Oe+6])/3,mt=(Re[Oe+1]+Re[Oe+4]+Re[Oe+7])/3,$e=(Re[Oe+2]+Re[Oe+5]+Re[Oe+8])/3;Re[Oe+0]=pt,Re[Oe+1]=mt,Re[Oe+2]=$e,Re[Oe+3]=pt,Re[Oe+4]=mt,Re[Oe+5]=$e,Re[Oe+6]=pt,Re[Oe+7]=mt,Re[Oe+8]=$e}q.bufferData(q.ARRAY_BUFFER,P.normalArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.normal),q.vertexAttribPointer(ce.normal,3,q.FLOAT,!1,0,0)}P.hasUvs&&ee.map&&(q.bindBuffer(q.ARRAY_BUFFER,ge.uv),q.bufferData(q.ARRAY_BUFFER,P.uvArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.uv),q.vertexAttribPointer(ce.uv,2,q.FLOAT,!1,0,0)),P.hasColors&&ee.vertexColors!==_C&&(q.bindBuffer(q.ARRAY_BUFFER,ge.color),q.bufferData(q.ARRAY_BUFFER,P.colorArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.color),q.vertexAttribPointer(ce.color,3,q.FLOAT,!1,0,0)),xe.disableUnusedAttributes(),q.drawArrays(q.TRIANGLES,0,P.count),P.count=0},this.renderBufferDirect=function(P,W,ee,ge,ce,Oe){jr(ge);var Ge=Vt(P,W,ge,ce),Re=!1,pt=ee.id+"_"+Ge.id+"_"+ge.wireframe;pt!==S&&(S=pt,Re=!0);var mt=ce.morphTargetInfluences;if(mt!==void 0){for(var $e=[],at=0,wt=mt.length;at<wt;at++){var je=mt[at];$e.push([je,at])}$e.sort(Je),$e.length>8&&($e.length=8);for(var mi=ee.morphAttributes,at=0,wt=$e.length;at<wt;at++){var je=$e[at];if(d[at]=je[0],je[0]!==0){var Cr=je[1];ge.morphTargets===!0&&mi.position&&ee.addAttribute("morphTarget"+at,mi.position[Cr]),ge.morphNormals===!0&&mi.normal&&ee.addAttribute("morphNormal"+at,mi.normal[Cr])}else ge.morphTargets===!0&&ee.removeAttribute("morphTarget"+at),ge.morphNormals===!0&&ee.removeAttribute("morphNormal"+at)}for(var at=$e.length,Ut=d.length;at<Ut;at++)d[at]=0;Ge.getUniforms().setValue(q,"morphTargetInfluences",d),Re=!0}var Cr=ee.index,Hi=ee.attributes.position,Mt=1;ge.wireframe===!0&&(Cr=Ne.getWireframeAttribute(ee),Mt=2);var Mi;Cr!==null?(Mi=L,Mi.setIndex(Cr)):Mi=F,Re&&(st(ge,Ge,ee),Cr!==null&&q.bindBuffer(q.ELEMENT_ARRAY_BUFFER,Ne.getAttributeBuffer(Cr)));var lr=0;Cr!==null?lr=Cr.count:Hi!==void 0&&(lr=Hi.count);var un=ee.drawRange.start*Mt,du=ee.drawRange.count*Mt,Kr=Oe!==null?Oe.start*Mt:0,mu=Oe!==null?Oe.count*Mt:1/0,Jh=Math.max(un,Kr),$h=Math.min(lr,un+du,Kr+mu)-1,XR=Math.max(0,$h-Jh+1);if(XR!==0){if(ce.isMesh)if(ge.wireframe===!0)xe.setLineWidth(ge.wireframeLinewidth*Ke()),Mi.setMode(q.LINES);else switch(ce.drawMode){case JF:Mi.setMode(q.TRIANGLES);break;case Ane:Mi.setMode(q.TRIANGLE_STRIP);break;case Cne:Mi.setMode(q.TRIANGLE_FAN);break}else if(ce.isLine){var YR=ge.linewidth;YR===void 0&&(YR=1),xe.setLineWidth(YR*Ke()),ce.isLineSegments?Mi.setMode(q.LINES):Mi.setMode(q.LINE_STRIP)}else ce.isPoints&&Mi.setMode(q.POINTS);ee&&ee.isInstancedBufferGeometry?ee.maxInstancedCount>0&&Mi.renderInstances(ee,Jh,XR):Mi.render(Jh,XR)}};function st(P,W,ee,ge){var ce;if(ee&&ee.isInstancedBufferGeometry&&(ce=We.get("ANGLE_instanced_arrays"),ce===null)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}ge===void 0&&(ge=0),xe.initAttributes();var Oe=ee.attributes,Ge=W.getAttributes(),Re=P.defaultAttributeValues;for(var pt in Ge){var mt=Ge[pt];if(mt>=0){var $e=Oe[pt];if($e!==void 0){var at=$e.normalized,wt=$e.itemSize,je=Ne.getAttributeProperties($e),mi=je.__webglBuffer,Ut=je.type,Cr=je.bytesPerElement;if($e.isInterleavedBufferAttribute){var Hi=$e.data,Mt=Hi.stride,Mi=$e.offset;Hi&&Hi.isInstancedInterleavedBuffer?(xe.enableAttributeAndDivisor(mt,Hi.meshPerAttribute,ce),ee.maxInstancedCount===void 0&&(ee.maxInstancedCount=Hi.meshPerAttribute*Hi.count)):xe.enableAttribute(mt),q.bindBuffer(q.ARRAY_BUFFER,mi),q.vertexAttribPointer(mt,wt,Ut,at,Mt*Cr,(ge*Mt+Mi)*Cr)}else $e.isInstancedBufferAttribute?(xe.enableAttributeAndDivisor(mt,$e.meshPerAttribute,ce),ee.maxInstancedCount===void 0&&(ee.maxInstancedCount=$e.meshPerAttribute*$e.count)):xe.enableAttribute(mt),q.bindBuffer(q.ARRAY_BUFFER,mi),q.vertexAttribPointer(mt,wt,Ut,at,0,ge*wt*Cr)}else if(Re!==void 0){var lr=Re[pt];if(lr!==void 0)switch(lr.length){case 2:q.vertexAttrib2fv(mt,lr);break;case 3:q.vertexAttrib3fv(mt,lr);break;case 4:q.vertexAttrib4fv(mt,lr);break;default:q.vertexAttrib1fv(mt,lr)}}}}xe.disableUnusedAttributes()}function Je(P,W){return Math.abs(W[0])-Math.abs(P[0])}function kt(P,W){return P.object.renderOrder!==W.object.renderOrder?P.object.renderOrder-W.object.renderOrder:P.material.program&&W.material.program&&P.material.program!==W.material.program?P.material.program.id-W.material.program.id:P.material.id!==W.material.id?P.material.id-W.material.id:P.z!==W.z?P.z-W.z:P.id-W.id}function X(P,W){return P.object.renderOrder!==W.object.renderOrder?P.object.renderOrder-W.object.renderOrder:P.z!==W.z?W.z-P.z:P.id-W.id}this.render=function(P,W,ee,ge){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}S="",M=-1,w=null,P.autoUpdate===!0&&P.updateMatrixWorld(),W.parent===null&&W.updateMatrixWorld(),W.matrixWorldInverse.getInverse(W.matrixWorld),K.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),G.setFromMatrix(K),u.length=0,f=-1,p=-1,g.length=0,m.length=0,Q=this.localClippingEnabled,J=Y.init(this.clippingPlanes,Q,W),xt(P,W),c.length=f+1,h.length=p+1,v.sortObjects===!0&&(c.sort(kt),h.sort(X)),J&&Y.beginShadows(),O(u),nt.render(P,W),j(u,W),J&&Y.endShadows(),Ee.calls=0,Ee.vertices=0,Ee.faces=0,Ee.points=0,ee===void 0&&(ee=null),this.setRenderTarget(ee);var ce=P.background;if(ce===null?xe.buffers.color.setClear(I.r,I.g,I.b,R,s):ce&&ce.isColor&&(xe.buffers.color.setClear(ce.r,ce.g,ce.b,1,s),ge=!0),(this.autoClear||ge)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),ce&&ce.isCubeTexture?(le.projectionMatrix.copy(W.projectionMatrix),le.matrixWorld.extractRotation(W.matrixWorld),le.matrixWorldInverse.getInverse(le.matrixWorld),et.material.uniforms.tCube.value=ce,et.modelViewMatrix.multiplyMatrices(le.matrixWorldInverse,et.matrixWorld),Ne.update(et),v.renderBufferDirect(le,null,et.geometry,et.material,et,null)):ce&&ce.isTexture&&(me.material.map=ce,Ne.update(me),v.renderBufferDirect(ne,null,me.geometry,me.material,me,null)),P.overrideMaterial){var Oe=P.overrideMaterial;Ft(c,P,W,Oe),Ft(h,P,W,Oe)}else xe.setBlending(ES),Ft(c,P,W),Ft(h,P,W);$.render(P,W),it.render(P,W,b),ee&&Ue.updateRenderTargetMipmap(ee),xe.setDepthTest(!0),xe.setDepthWrite(!0),xe.setColorWrite(!0)};function Te(P,W,ee,ge,ce){var Oe,Ge;ee.transparent?(Oe=h,Ge=++p):(Oe=c,Ge=++f);var Re=Oe[Ge];Re!==void 0?(Re.id=P.id,Re.object=P,Re.geometry=W,Re.material=ee,Re.z=ae.z,Re.group=ce):(Re={id:P.id,object:P,geometry:W,material:ee,z:ae.z,group:ce},Oe.push(Re))}function te(P){var W=P.geometry;return W.boundingSphere===null&&W.computeBoundingSphere(),V.copy(W.boundingSphere).applyMatrix4(P.matrixWorld),Pe(V)}function Me(P){return V.center.set(0,0,0),V.radius=.7071067811865476,V.applyMatrix4(P.matrixWorld),Pe(V)}function Pe(P){if(!G.intersectsSphere(P))return!1;var W=Y.numPlanes;if(W===0)return!0;var ee=v.clippingPlanes,ge=P.center,ce=-P.radius,Oe=0;do if(ee[Oe].distanceToPoint(ge)<ce)return!1;while(++Oe!==W);return!0}function xt(P,W){if(P.visible!==!1){var ee=(P.layers.mask&W.layers.mask)!==0;if(ee){if(P.isLight)u.push(P);else if(P.isSprite)(P.frustumCulled===!1||Me(P)===!0)&&g.push(P);else if(P.isLensFlare)m.push(P);else if(P.isImmediateRenderObject)v.sortObjects===!0&&(ae.setFromMatrixPosition(P.matrixWorld),ae.applyProjection(K)),Te(P,null,P.material,ae.z,null);else if((P.isMesh||P.isLine||P.isPoints)&&(P.isSkinnedMesh&&P.skeleton.update(),P.frustumCulled===!1||te(P)===!0)){var ge=P.material;if(ge.visible===!0){v.sortObjects===!0&&(ae.setFromMatrixPosition(P.matrixWorld),ae.applyProjection(K));var ce=Ne.update(P);if(ge.isMultiMaterial)for(var Oe=ce.groups,Ge=ge.materials,Re=0,pt=Oe.length;Re<pt;Re++){var mt=Oe[Re],$e=Ge[mt.materialIndex];$e.visible===!0&&Te(P,ce,$e,ae.z,mt)}else Te(P,ce,ge,ae.z,null)}}}for(var at=P.children,Re=0,pt=at.length;Re<pt;Re++)xt(at[Re],W)}}function Ft(P,W,ee,ge){for(var ce=0,Oe=P.length;ce<Oe;ce++){var Ge=P[ce],Re=Ge.object,pt=Ge.geometry,mt=ge===void 0?Ge.material:ge,$e=Ge.group;if(Re.modelViewMatrix.multiplyMatrices(ee.matrixWorldInverse,Re.matrixWorld),Re.normalMatrix.getNormalMatrix(Re.modelViewMatrix),Re.onBeforeRender(v,W,ee,pt,mt,$e),Re.isImmediateRenderObject){jr(mt);var at=Vt(ee,W.fog,mt,Re);S="",Re.render(function(wt){v.renderBufferImmediate(wt,at,mt)})}else v.renderBufferDirect(ee,W.fog,pt,mt,Re,$e);Re.onAfterRender(v,W,ee,pt,mt,$e)}}function Mr(P,W,ee){var ge=Le.get(P),ce=Ve.getParameters(P,se,W,Y.numPlanes,Y.numIntersection,ee),Oe=Ve.getProgramCode(P,ce),Ge=ge.program,Re=!0;if(Ge===void 0)P.addEventListener("dispose",Fe);else if(Ge.code!==Oe)Ie(P);else{if(ce.shaderID!==void 0)return;Re=!1}if(Re){if(ce.shaderID){var pt=ty[ce.shaderID];ge.__webglShader={name:P.type,uniforms:io.clone(pt.uniforms),vertexShader:pt.vertexShader,fragmentShader:pt.fragmentShader}}else ge.__webglShader={name:P.type,uniforms:P.uniforms,vertexShader:P.vertexShader,fragmentShader:P.fragmentShader};P.__webglShader=ge.__webglShader,Ge=Ve.acquireProgram(P,ce,Oe),ge.program=Ge,P.program=Ge}var mt=Ge.getAttributes();if(P.morphTargets){P.numSupportedMorphTargets=0;for(var $e=0;$e<v.maxMorphTargets;$e++)mt["morphTarget"+$e]>=0&&P.numSupportedMorphTargets++}if(P.morphNormals){P.numSupportedMorphNormals=0;for(var $e=0;$e<v.maxMorphNormals;$e++)mt["morphNormal"+$e]>=0&&P.numSupportedMorphNormals++}var at=ge.__webglShader.uniforms;(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(ge.numClippingPlanes=Y.numPlanes,ge.numIntersection=Y.numIntersection,at.clippingPlanes=Y.uniform),ge.fog=W,ge.lightsHash=se.hash,P.lights&&(at.ambientLightColor.value=se.ambient,at.directionalLights.value=se.directional,at.spotLights.value=se.spot,at.rectAreaLights.value=se.rectArea,at.pointLights.value=se.point,at.hemisphereLights.value=se.hemi,at.directionalShadowMap.value=se.directionalShadowMap,at.directionalShadowMatrix.value=se.directionalShadowMatrix,at.spotShadowMap.value=se.spotShadowMap,at.spotShadowMatrix.value=se.spotShadowMatrix,at.pointShadowMap.value=se.pointShadowMap,at.pointShadowMatrix.value=se.pointShadowMatrix);var wt=ge.program.getUniforms(),je=Mh.seqWithValue(wt.seq,at);ge.uniformsList=je}function jr(P){P.side===Oy?xe.disable(q.CULL_FACE):xe.enable(q.CULL_FACE),xe.setFlipSided(P.side===xh),P.transparent===!0?xe.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.premultipliedAlpha):xe.setBlending(ES),xe.setDepthFunc(P.depthFunc),xe.setDepthTest(P.depthTest),xe.setDepthWrite(P.depthWrite),xe.setColorWrite(P.colorWrite),xe.setPolygonOffset(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits)}function Vt(P,W,ee,ge){E=0;var ce=Le.get(ee);if(J&&(Q||P!==w)){var Oe=P===w&&ee.id===M;Y.setState(ee.clippingPlanes,ee.clipIntersection,ee.clipShadows,P,ce,Oe)}ee.needsUpdate===!1&&(ce.program===void 0||ee.fog&&ce.fog!==W||ee.lights&&ce.lightsHash!==se.hash||ce.numClippingPlanes!==void 0&&(ce.numClippingPlanes!==Y.numPlanes||ce.numIntersection!==Y.numIntersection))&&(ee.needsUpdate=!0),ee.needsUpdate&&(Mr(ee,W,ge),ee.needsUpdate=!1);var Ge=!1,Re=!1,pt=!1,mt=ce.program,$e=mt.getUniforms(),at=ce.__webglShader.uniforms;if(mt.id!==_&&(q.useProgram(mt.program),_=mt.id,Ge=!0,Re=!0,pt=!0),ee.id!==M&&(M=ee.id,Re=!0),Ge||P!==w){if($e.set(q,P,"projectionMatrix"),_e.logarithmicDepthBuffer&&$e.setValue(q,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),P!==w&&(w=P,Re=!0,pt=!0),ee.isShaderMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.envMap){var wt=$e.map.cameraPosition;wt!==void 0&&wt.setValue(q,ae.setFromMatrixPosition(P.matrixWorld))}(ee.isMeshPhongMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial||ee.skinning)&&$e.setValue(q,"viewMatrix",P.matrixWorldInverse),$e.set(q,v,"toneMappingExposure"),$e.set(q,v,"toneMappingWhitePoint")}if(ee.skinning){$e.setOptional(q,ge,"bindMatrix"),$e.setOptional(q,ge,"bindMatrixInverse");var je=ge.skeleton;je&&(_e.floatVertexTextures&&je.useVertexTexture?($e.set(q,je,"boneTexture"),$e.set(q,je,"boneTextureWidth"),$e.set(q,je,"boneTextureHeight")):$e.setOptional(q,je,"boneMatrices"))}return Re&&(ee.lights&&A0(at,pt),W&&ee.fog&&Is(at,W),(ee.isMeshBasicMaterial||ee.isMeshLambertMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.isMeshNormalMaterial||ee.isMeshDepthMaterial)&&Lr(at,ee),ee.isLineBasicMaterial?si(at,ee):ee.isLineDashedMaterial?(si(at,ee),Zh(at,ee)):ee.isPointsMaterial?w0(at,ee):ee.isMeshLambertMaterial?jh(at,ee):ee.isMeshToonMaterial?Kh(at,ee):ee.isMeshPhongMaterial?Go(at,ee):ee.isMeshPhysicalMaterial?T0(at,ee):ee.isMeshStandardMaterial?bc(at,ee):ee.isMeshDepthMaterial?ee.displacementMap&&(at.displacementMap.value=ee.displacementMap,at.displacementScale.value=ee.displacementScale,at.displacementBias.value=ee.displacementBias):ee.isMeshNormalMaterial&&E0(at,ee),at.ltcMat!==void 0&&(at.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),at.ltcMag!==void 0&&(at.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),Mh.upload(q,ce.uniformsList,at,v)),$e.set(q,ge,"modelViewMatrix"),$e.set(q,ge,"normalMatrix"),$e.setValue(q,"modelMatrix",ge.matrixWorld),mt}function Lr(P,W){P.opacity.value=W.opacity,P.diffuse.value=W.color,W.emissive&&P.emissive.value.copy(W.emissive).multiplyScalar(W.emissiveIntensity),P.map.value=W.map,P.specularMap.value=W.specularMap,P.alphaMap.value=W.alphaMap,W.lightMap&&(P.lightMap.value=W.lightMap,P.lightMapIntensity.value=W.lightMapIntensity),W.aoMap&&(P.aoMap.value=W.aoMap,P.aoMapIntensity.value=W.aoMapIntensity);var ee;if(W.map?ee=W.map:W.specularMap?ee=W.specularMap:W.displacementMap?ee=W.displacementMap:W.normalMap?ee=W.normalMap:W.bumpMap?ee=W.bumpMap:W.roughnessMap?ee=W.roughnessMap:W.metalnessMap?ee=W.metalnessMap:W.alphaMap?ee=W.alphaMap:W.emissiveMap&&(ee=W.emissiveMap),ee!==void 0){ee.isWebGLRenderTarget&&(ee=ee.texture);var ge=ee.offset,ce=ee.repeat;P.offsetRepeat.value.set(ge.x,ge.y,ce.x,ce.y)}P.envMap.value=W.envMap,P.flipEnvMap.value=W.envMap&&W.envMap.isCubeTexture?-1:1,P.reflectivity.value=W.reflectivity,P.refractionRatio.value=W.refractionRatio}function si(P,W){P.diffuse.value=W.color,P.opacity.value=W.opacity}function Zh(P,W){P.dashSize.value=W.dashSize,P.totalSize.value=W.dashSize+W.gapSize,P.scale.value=W.scale}function w0(P,W){if(P.diffuse.value=W.color,P.opacity.value=W.opacity,P.size.value=W.size*U,P.scale.value=D*.5,P.map.value=W.map,W.map!==null){var ee=W.map.offset,ge=W.map.repeat;P.offsetRepeat.value.set(ee.x,ee.y,ge.x,ge.y)}}function Is(P,W){P.fogColor.value=W.color,W.isFog?(P.fogNear.value=W.near,P.fogFar.value=W.far):W.isFogExp2&&(P.fogDensity.value=W.density)}function jh(P,W){W.emissiveMap&&(P.emissiveMap.value=W.emissiveMap)}function Go(P,W){P.specular.value=W.specular,P.shininess.value=Math.max(W.shininess,1e-4),W.emissiveMap&&(P.emissiveMap.value=W.emissiveMap),W.bumpMap&&(P.bumpMap.value=W.bumpMap,P.bumpScale.value=W.bumpScale),W.normalMap&&(P.normalMap.value=W.normalMap,P.normalScale.value.copy(W.normalScale)),W.displacementMap&&(P.displacementMap.value=W.displacementMap,P.displacementScale.value=W.displacementScale,P.displacementBias.value=W.displacementBias)}function Kh(P,W){Go(P,W),W.gradientMap&&(P.gradientMap.value=W.gradientMap)}function bc(P,W){P.roughness.value=W.roughness,P.metalness.value=W.metalness,W.roughnessMap&&(P.roughnessMap.value=W.roughnessMap),W.metalnessMap&&(P.metalnessMap.value=W.metalnessMap),W.emissiveMap&&(P.emissiveMap.value=W.emissiveMap),W.bumpMap&&(P.bumpMap.value=W.bumpMap,P.bumpScale.value=W.bumpScale),W.normalMap&&(P.normalMap.value=W.normalMap,P.normalScale.value.copy(W.normalScale)),W.displacementMap&&(P.displacementMap.value=W.displacementMap,P.displacementScale.value=W.displacementScale,P.displacementBias.value=W.displacementBias),W.envMap&&(P.envMapIntensity.value=W.envMapIntensity)}function T0(P,W){P.clearCoat.value=W.clearCoat,P.clearCoatRoughness.value=W.clearCoatRoughness,bc(P,W)}function E0(P,W){W.bumpMap&&(P.bumpMap.value=W.bumpMap,P.bumpScale.value=W.bumpScale),W.normalMap&&(P.normalMap.value=W.normalMap,P.normalScale.value.copy(W.normalScale)),W.displacementMap&&(P.displacementMap.value=W.displacementMap,P.displacementScale.value=W.displacementScale,P.displacementBias.value=W.displacementBias)}function A0(P,W){P.ambientLightColor.needsUpdate=W,P.directionalLights.needsUpdate=W,P.pointLights.needsUpdate=W,P.spotLights.needsUpdate=W,P.rectAreaLights.needsUpdate=W,P.hemisphereLights.needsUpdate=W}function O(P){for(var W=0,ee=0,ge=P.length;ee<ge;ee++){var ce=P[ee];ce.castShadow&&(se.shadows[W++]=ce)}se.shadows.length=W}function j(P,W){var ee,ge,ce,Oe=0,Ge=0,Re=0,pt,mt,$e,at,wt=W.matrixWorldInverse,je=0,mi=0,Ut=0,Cr=0,Hi=0;for(ee=0,ge=P.length;ee<ge;ee++)if(ce=P[ee],pt=ce.color,mt=ce.intensity,$e=ce.distance,at=ce.shadow&&ce.shadow.map?ce.shadow.map.texture:null,ce.isAmbientLight)Oe+=pt.r*mt,Ge+=pt.g*mt,Re+=pt.b*mt;else if(ce.isDirectionalLight){var Mt=ct.get(ce);Mt.color.copy(ce.color).multiplyScalar(ce.intensity),Mt.direction.setFromMatrixPosition(ce.matrixWorld),ae.setFromMatrixPosition(ce.target.matrixWorld),Mt.direction.sub(ae),Mt.direction.transformDirection(wt),Mt.shadow=ce.castShadow,ce.castShadow&&(Mt.shadowBias=ce.shadow.bias,Mt.shadowRadius=ce.shadow.radius,Mt.shadowMapSize=ce.shadow.mapSize),se.directionalShadowMap[je]=at,se.directionalShadowMatrix[je]=ce.shadow.matrix,se.directional[je++]=Mt}else if(ce.isSpotLight){var Mt=ct.get(ce);Mt.position.setFromMatrixPosition(ce.matrixWorld),Mt.position.applyMatrix4(wt),Mt.color.copy(pt).multiplyScalar(mt),Mt.distance=$e,Mt.direction.setFromMatrixPosition(ce.matrixWorld),ae.setFromMatrixPosition(ce.target.matrixWorld),Mt.direction.sub(ae),Mt.direction.transformDirection(wt),Mt.coneCos=Math.cos(ce.angle),Mt.penumbraCos=Math.cos(ce.angle*(1-ce.penumbra)),Mt.decay=ce.distance===0?0:ce.decay,Mt.shadow=ce.castShadow,ce.castShadow&&(Mt.shadowBias=ce.shadow.bias,Mt.shadowRadius=ce.shadow.radius,Mt.shadowMapSize=ce.shadow.mapSize),se.spotShadowMap[Ut]=at,se.spotShadowMatrix[Ut]=ce.shadow.matrix,se.spot[Ut++]=Mt}else if(ce.isRectAreaLight){var Mt=ct.get(ce);Mt.color.copy(pt).multiplyScalar(mt/(ce.width*ce.height)),Mt.position.setFromMatrixPosition(ce.matrixWorld),Mt.position.applyMatrix4(wt),ue.identity(),ve.copy(ce.matrixWorld),ve.premultiply(wt),ue.extractRotation(ve),Mt.halfWidth.set(ce.width*.5,0,0),Mt.halfHeight.set(0,ce.height*.5,0),Mt.halfWidth.applyMatrix4(ue),Mt.halfHeight.applyMatrix4(ue),se.rectArea[Cr++]=Mt}else if(ce.isPointLight){var Mt=ct.get(ce);Mt.position.setFromMatrixPosition(ce.matrixWorld),Mt.position.applyMatrix4(wt),Mt.color.copy(ce.color).multiplyScalar(ce.intensity),Mt.distance=ce.distance,Mt.decay=ce.distance===0?0:ce.decay,Mt.shadow=ce.castShadow,ce.castShadow&&(Mt.shadowBias=ce.shadow.bias,Mt.shadowRadius=ce.shadow.radius,Mt.shadowMapSize=ce.shadow.mapSize),se.pointShadowMap[mi]=at,se.pointShadowMatrix[mi]===void 0&&(se.pointShadowMatrix[mi]=new qt),ae.setFromMatrixPosition(ce.matrixWorld).negate(),se.pointShadowMatrix[mi].identity().setPosition(ae),se.point[mi++]=Mt}else if(ce.isHemisphereLight){var Mt=ct.get(ce);Mt.direction.setFromMatrixPosition(ce.matrixWorld),Mt.direction.transformDirection(wt),Mt.direction.normalize(),Mt.skyColor.copy(ce.color).multiplyScalar(mt),Mt.groundColor.copy(ce.groundColor).multiplyScalar(mt),se.hemi[Hi++]=Mt}se.ambient[0]=Oe,se.ambient[1]=Ge,se.ambient[2]=Re,se.directional.length=je,se.spot.length=Ut,se.rectArea.length=Cr,se.point.length=mi,se.hemi.length=Hi,se.hash=je+","+mi+","+Ut+","+Cr+","+Hi+","+se.shadows.length}this.setFaceCulling=function(P,W){xe.setCullFace(P),xe.setFlipSided(W===Vie)};function re(){var P=E;return P>=_e.maxTextures&&console.warn("WebGLRenderer: trying to use "+P+" texture units while this GPU supports only "+_e.maxTextures),E+=1,P}this.allocTextureUnit=re,this.setTexture2D=function(){var P=!1;return function(ee,ge){ee&&ee.isWebGLRenderTarget&&(P||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),P=!0),ee=ee.texture),Ue.setTexture2D(ee,ge)}}(),this.setTexture=function(){var P=!1;return function(ee,ge){P||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),P=!0),Ue.setTexture2D(ee,ge)}}(),this.setTextureCube=function(){var P=!1;return function(ee,ge){ee&&ee.isWebGLRenderTargetCube&&(P||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),P=!0),ee=ee.texture),ee&&ee.isCubeTexture||Array.isArray(ee.image)&&ee.image.length===6?Ue.setTextureCube(ee,ge):Ue.setTextureCubeDynamic(ee,ge)}}(),this.getCurrentRenderTarget=function(){return y},this.setRenderTarget=function(P){y=P,P&&Le.get(P).__webglFramebuffer===void 0&&Ue.setupRenderTarget(P);var W=P&&P.isWebGLRenderTargetCube,ee;if(P){var ge=Le.get(P);W?ee=ge.__webglFramebuffer[P.activeCubeFace]:ee=ge.__webglFramebuffer,T.copy(P.scissor),C=P.scissorTest,b.copy(P.viewport)}else ee=null,T.copy(B).multiplyScalar(U),C=z,b.copy(k).multiplyScalar(U);if(x!==ee&&(q.bindFramebuffer(q.FRAMEBUFFER,ee),x=ee),xe.scissor(T),xe.setScissorTest(C),xe.viewport(b),W){var ce=Le.get(P.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+P.activeCubeFace,ce.__webglTexture,P.activeMipMapLevel)}},this.readRenderTargetPixels=function(P,W,ee,ge,ce,Oe){if((P&&P.isWebGLRenderTarget)===!1){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}var Ge=Le.get(P).__webglFramebuffer;if(Ge){var Re=!1;Ge!==x&&(q.bindFramebuffer(q.FRAMEBUFFER,Ge),Re=!0);try{var pt=P.texture,mt=pt.format,$e=pt.type;if(mt!==ou&&ie(mt)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if($e!==YA&&ie($e)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_TYPE)&&!($e===Jg&&(We.get("OES_texture_float")||We.get("WEBGL_color_buffer_float")))&&!($e===qA&&We.get("EXT_color_buffer_half_float"))){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q.checkFramebufferStatus(q.FRAMEBUFFER)===q.FRAMEBUFFER_COMPLETE?W>=0&&W<=P.width-ge&&ee>=0&&ee<=P.height-ce&&q.readPixels(W,ee,ge,ce,ie(mt),ie($e),Oe):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{Re&&q.bindFramebuffer(q.FRAMEBUFFER,x)}}};function ie(P){var W;if(P===rc)return q.REPEAT;if(P===Uo)return q.CLAMP_TO_EDGE;if(P===Nd)return q.MIRRORED_REPEAT;if(P===Oo)return q.NEAREST;if(P===wC)return q.NEAREST_MIPMAP_NEAREST;if(P===TC)return q.NEAREST_MIPMAP_LINEAR;if(P===no)return q.LINEAR;if(P===jF)return q.LINEAR_MIPMAP_NEAREST;if(P===yM)return q.LINEAR_MIPMAP_LINEAR;if(P===YA)return q.UNSIGNED_BYTE;if(P===gne)return q.UNSIGNED_SHORT_4_4_4_4;if(P===yne)return q.UNSIGNED_SHORT_5_5_5_1;if(P===_ne)return q.UNSIGNED_SHORT_5_6_5;if(P===dne)return q.BYTE;if(P===mne)return q.SHORT;if(P===AS)return q.UNSIGNED_SHORT;if(P===vne)return q.INT;if(P===KF)return q.UNSIGNED_INT;if(P===Jg)return q.FLOAT;if(P===qA&&(W=We.get("OES_texture_half_float"),W!==null))return W.HALF_FLOAT_OES;if(P===xne)return q.ALPHA;if(P===$g)return q.RGB;if(P===ou)return q.RGBA;if(P===Sne)return q.LUMINANCE;if(P===Mne)return q.LUMINANCE_ALPHA;if(P===Ld)return q.DEPTH_COMPONENT;if(P===Qg)return q.DEPTH_STENCIL;if(P===HF)return q.FUNC_ADD;if(P===Wie)return q.FUNC_SUBTRACT;if(P===Xie)return q.FUNC_REVERSE_SUBTRACT;if(P===Yie)return q.ZERO;if(P===qie)return q.ONE;if(P===Zie)return q.SRC_COLOR;if(P===jie)return q.ONE_MINUS_SRC_COLOR;if(P===WF)return q.SRC_ALPHA;if(P===XF)return q.ONE_MINUS_SRC_ALPHA;if(P===Kie)return q.DST_ALPHA;if(P===Jie)return q.ONE_MINUS_DST_ALPHA;if(P===$ie)return q.DST_COLOR;if(P===Qie)return q.ONE_MINUS_DST_COLOR;if(P===ene)return q.SRC_ALPHA_SATURATE;if((P===hF||P===pF||P===dF||P===mF)&&(W=We.get("WEBGL_compressed_texture_s3tc"),W!==null)){if(P===hF)return W.COMPRESSED_RGB_S3TC_DXT1_EXT;if(P===pF)return W.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(P===dF)return W.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(P===mF)return W.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((P===vF||P===gF||P===yF||P===_F)&&(W=We.get("WEBGL_compressed_texture_pvrtc"),W!==null)){if(P===vF)return W.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(P===gF)return W.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(P===yF)return W.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(P===_F)return W.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(P===bne&&(W=We.get("WEBGL_compressed_texture_etc1"),W!==null))return W.COMPRESSED_RGB_ETC1_WEBGL;if((P===lF||P===uF)&&(W=We.get("EXT_blend_minmax"),W!==null)){if(P===lF)return W.MIN_EXT;if(P===uF)return W.MAX_EXT}return P===CS&&(W=We.get("WEBGL_depth_texture"),W!==null)?W.UNSIGNED_INT_24_8_WEBGL:0}}function iy(r,e){this.name="",this.color=new Gt(r),this.density=e!==void 0?e:25e-5}function ny(r,e,t){this.name="",this.color=new Gt(r),this.near=e!==void 0?e:1,this.far=t!==void 0?t:1e3}function Bd(){At.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function SF(r,e,t,i,n){At.call(this),this.lensFlares=[],this.positionScreen=new oe,this.customUpdateCallback=void 0,r!==void 0&&this.add(r,e,t,i,n)}function kd(r){mr.call(this),this.type="SpriteMaterial",this.color=new Gt(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(r)}function kS(r){At.call(this),this.type="Sprite",this.material=r!==void 0?r:new kd}function VS(){At.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function jA(r,e,t){if(this.useVertexTexture=t!==void 0?t:!0,this.identityMatrix=new qt,r=r||[],this.bones=r.slice(0),this.useVertexTexture){var i=Math.sqrt(this.bones.length*4);i=cr.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Od(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,ou,Jg)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(e===void 0)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,a=this.bones.length;n<a;n++)this.boneInverses.push(new qt)}}function KA(){At.call(this),this.type="Bone"}function JA(r,e,t){mn.call(this,r,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new qt,this.bindMatrixInverse=new qt;var i=[];if(this.geometry&&this.geometry.bones!==void 0){for(var n,a,o=0,s=this.geometry.bones.length;o<s;++o)a=this.geometry.bones[o],n=new KA,i.push(n),n.name=a.name,n.position.fromArray(a.pos),n.quaternion.fromArray(a.rotq),a.scl!==void 0&&n.scale.fromArray(a.scl);for(var o=0,s=this.geometry.bones.length;o<s;++o)a=this.geometry.bones[o],a.parent!==-1&&a.parent!==null&&i[a.parent]!==void 0?i[a.parent].add(i[o]):this.add(i[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new jA(i,void 0,t),this.matrixWorld)}function Ni(r){mr.call(this),this.type="LineBasicMaterial",this.color=new Gt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(r)}function ac(r,e,t){if(t===1)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new di(r,e);At.call(this),this.type="Line",this.geometry=r!==void 0?r:new Bt,this.material=e!==void 0?e:new Ni({color:Math.random()*16777215})}function di(r,e){ac.call(this,r,e),this.type="LineSegments"}function ml(r){mr.call(this),this.type="PointsMaterial",this.color=new Gt(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(r)}function ay(r,e){At.call(this),this.type="Points",this.geometry=r!==void 0?r:new Bt,this.material=e!==void 0?e:new ml({color:Math.random()*16777215})}function GS(){At.call(this),this.type="Group"}function $A(r,e,t,i,n,a,o,s,l){ai.call(this,r,e,t,i,n,a,o,s,l),this.generateMipmaps=!1;var u=this;function c(){requestAnimationFrame(c),r.readyState>=r.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}c()}function oy(r,e,t,i,n,a,o,s,l,u,c,f){ai.call(this,null,a,o,s,l,u,i,n,c,f),this.image={width:e,height:t},this.mipmaps=r,this.flipY=!1,this.generateMipmaps=!1}function QA(r,e,t,i,n,a,o,s,l){ai.call(this,r,e,t,i,n,a,o,s,l),this.needsUpdate=!0}function HS(r,e,t,i,n,a,o,s,l,u){if(u=u!==void 0?u:Ld,u!==Ld&&u!==Qg)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&u===Ld&&(t=AS),t===void 0&&u===Qg&&(t=CS),ai.call(this,null,i,n,a,o,s,u,t,l),this.image={width:r,height:e},this.magFilter=o!==void 0?o:Oo,this.minFilter=s!==void 0?s:Oo,this.flipY=!1,this.generateMipmaps=!1}function sy(r){Bt.call(this);var e=[0,0],t={};function i(I,R){return I-R}var n=["a","b","c"];if(r&&r.isGeometry){for(var a=r.vertices,o=r.faces,s=0,l=new Uint32Array(6*o.length),u=0,c=o.length;u<c;u++)for(var f=o[u],h=0;h<3;h++){e[0]=f[n[h]],e[1]=f[n[(h+1)%3]],e.sort(i);var p=e.toString();t[p]===void 0&&(l[2*s]=e[0],l[2*s+1]=e[1],t[p]=!0,s++)}for(var d=new Float32Array(s*2*3),u=0,c=s;u<c;u++)for(var h=0;h<2;h++){var g=a[l[2*u+h]],m=6*u+3*h;d[m+0]=g.x,d[m+1]=g.y,d[m+2]=g.z}this.addAttribute("position",new gt(d,3))}else if(r&&r.isBufferGeometry)if(r.index!==null){var v=r.index.array,a=r.attributes.position,_=r.groups,s=0;_.length===0&&r.addGroup(0,v.length);for(var l=new Uint32Array(2*v.length),y=0,x=_.length;y<x;++y)for(var M=_[y],S=M.start,w=M.count,u=S,T=S+w;u<T;u+=3)for(var h=0;h<3;h++){e[0]=v[u+h],e[1]=v[u+(h+1)%3],e.sort(i);var p=e.toString();t[p]===void 0&&(l[2*s]=e[0],l[2*s+1]=e[1],t[p]=!0,s++)}for(var d=new Float32Array(s*2*3),u=0,c=s;u<c;u++)for(var h=0;h<2;h++){var m=6*u+3*h,C=l[2*u+h];d[m+0]=a.getX(C),d[m+1]=a.getY(C),d[m+2]=a.getZ(C)}this.addAttribute("position",new gt(d,3))}else{for(var a=r.attributes.position.array,s=a.length/3,b=s/3,d=new Float32Array(s*2*3),u=0,c=b;u<c;u++)for(var h=0;h<3;h++){var m=18*u+6*h,E=9*u+3*h;d[m+0]=a[E],d[m+1]=a[E+1],d[m+2]=a[E+2];var C=9*u+3*((h+1)%3);d[m+3]=a[C],d[m+4]=a[C+1],d[m+5]=a[C+2]}this.addAttribute("position",new gt(d,3))}}function ly(r,e,t){Bt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:r,slices:e,stacks:t};var i=[],n=[],a,o,s,l,u,c=e+1;for(a=0;a<=t;a++)for(u=a/t,o=0;o<=e;o++)l=o/e,s=r(l,u),i.push(s.x,s.y,s.z),n.push(l,u);var f=[],h,p,d,g;for(a=0;a<t;a++)for(o=0;o<e;o++)h=a*c+o,p=a*c+o+1,d=(a+1)*c+o+1,g=(a+1)*c+o,f.push(h,p,g),f.push(p,d,g);this.setIndex(new(f.length>65535?nc:ic)(f,1)),this.addAttribute("position",new gr(i,3)),this.addAttribute("uv",new gr(n,2)),this.computeVertexNormals()}function WS(r,e,t){sr.call(this),this.type="ParametricGeometry",this.parameters={func:r,slices:e,stacks:t},this.fromBufferGeometry(new ly(r,e,t)),this.mergeVertices()}function so(r,e,t,i){Bt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:r,indices:e,radius:t,detail:i},t=t||1,i=i||0;var n=[],a=[];o(i),l(t),u(),this.addAttribute("position",new gr(n,3)),this.addAttribute("normal",new gr(n.slice(),3)),this.addAttribute("uv",new gr(a,2)),this.normalizeNormals(),this.boundingSphere=new $n(new oe,t);function o(v){for(var _=new oe,y=new oe,x=new oe,M=0;M<e.length;M+=3)h(e[M+0],_),h(e[M+1],y),h(e[M+2],x),s(_,y,x,v)}function s(v,_,y,x){var M=Math.pow(2,x),S=[],w,T;for(w=0;w<=M;w++){S[w]=[];var C=v.clone().lerp(y,w/M),b=_.clone().lerp(y,w/M),E=M-w;for(T=0;T<=E;T++)T===0&&w===M?S[w][T]=C:S[w][T]=C.clone().lerp(b,T/E)}for(w=0;w<M;w++)for(T=0;T<2*(M-w)-1;T++){var I=Math.floor(T/2);T%2===0?(f(S[w][I+1]),f(S[w+1][I]),f(S[w][I])):(f(S[w][I+1]),f(S[w+1][I+1]),f(S[w+1][I]))}}function l(v){for(var _=new oe,y=0;y<n.length;y+=3)_.x=n[y+0],_.y=n[y+1],_.z=n[y+2],_.normalize().multiplyScalar(v),n[y+0]=_.x,n[y+1]=_.y,n[y+2]=_.z}function u(){for(var v=new oe,_=0;_<n.length;_+=3){v.x=n[_+0],v.y=n[_+1],v.z=n[_+2];var y=g(v)/2/Math.PI+.5,x=m(v)/Math.PI+.5;a.push(y,1-x)}p(),c()}function c(){for(var v=0;v<a.length;v+=6){var _=a[v+0],y=a[v+2],x=a[v+4],M=Math.max(_,y,x),S=Math.min(_,y,x);M>.9&&S<.1&&(_<.2&&(a[v+0]+=1),y<.2&&(a[v+2]+=1),x<.2&&(a[v+4]+=1))}}function f(v){n.push(v.x,v.y,v.z)}function h(v,_){var y=v*3;_.x=r[y+0],_.y=r[y+1],_.z=r[y+2]}function p(){for(var v=new oe,_=new oe,y=new oe,x=new oe,M=new St,S=new St,w=new St,T=0,C=0;T<n.length;T+=9,C+=6){v.set(n[T+0],n[T+1],n[T+2]),_.set(n[T+3],n[T+4],n[T+5]),y.set(n[T+6],n[T+7],n[T+8]),M.set(a[C+0],a[C+1]),S.set(a[C+2],a[C+3]),w.set(a[C+4],a[C+5]),x.copy(v).add(_).add(y).divideScalar(3);var b=g(x);d(M,C+0,v,b),d(S,C+2,_,b),d(w,C+4,y,b)}}function d(v,_,y,x){x<0&&v.x===1&&(a[_]=v.x-1),y.x===0&&y.z===0&&(a[_]=x/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function m(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}function uy(r,e){var t=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];so.call(this,t,i,r,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:r,detail:e}}function XS(r,e){sr.call(this),this.type="TetrahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new uy(r,e)),this.mergeVertices()}function Vd(r,e){var t=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];so.call(this,t,i,r,e),this.type="OctahedronBufferGeometry",this.parameters={radius:r,detail:e}}function YS(r,e){sr.call(this),this.type="OctahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new Vd(r,e)),this.mergeVertices()}function cy(r,e){var t=(1+Math.sqrt(5))/2,i=[-1,t,0,1,t,0,-1,-t,0,1,-t,0,0,-1,t,0,1,t,0,-1,-t,0,1,-t,t,0,-1,t,0,1,-t,0,-1,-t,0,1],n=[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];so.call(this,i,n,r,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:r,detail:e}}function qS(r,e){sr.call(this),this.type="IcosahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new cy(r,e)),this.mergeVertices()}function fy(r,e){var t=(1+Math.sqrt(5))/2,i=1/t,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-t,0,-i,t,0,i,-t,0,i,t,-i,-t,0,-i,t,0,i,-t,0,i,t,0,-t,0,-i,t,0,-i,-t,0,i,t,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];so.call(this,n,a,r,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:r,detail:e}}function ZS(r,e){sr.call(this),this.type="DodecahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new fy(r,e)),this.mergeVertices()}function jS(r,e,t,i){sr.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:r,indices:e,radius:t,detail:i},this.fromBufferGeometry(new so(r,e,t,i)),this.mergeVertices()}function hy(r,e,t,i,n){Bt.call(this),this.type="TubeBufferGeometry",this.parameters={path:r,tubularSegments:e,radius:t,radialSegments:i,closed:n},e=e||64,t=t||1,i=i||8,n=n||!1;var a=r.computeFrenetFrames(e,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new oe,s=new oe,l=new St,u,c,f=[],h=[],p=[],d=[];g(),this.setIndex(new(d.length>65535?nc:ic)(d,1)),this.addAttribute("position",new gr(f,3)),this.addAttribute("normal",new gr(h,3)),this.addAttribute("uv",new gr(p,2));function g(){for(u=0;u<e;u++)m(u);m(n===!1?e:0),_(),v()}function m(y){var x=r.getPointAt(y/e),M=a.normals[y],S=a.binormals[y];for(c=0;c<=i;c++){var w=c/i*Math.PI*2,T=Math.sin(w),C=-Math.cos(w);s.x=C*M.x+T*S.x,s.y=C*M.y+T*S.y,s.z=C*M.z+T*S.z,s.normalize(),h.push(s.x,s.y,s.z),o.x=x.x+t*s.x,o.y=x.y+t*s.y,o.z=x.z+t*s.z,f.push(o.x,o.y,o.z)}}function v(){for(c=1;c<=e;c++)for(u=1;u<=i;u++){var y=(i+1)*(c-1)+(u-1),x=(i+1)*c+(u-1),M=(i+1)*c+u,S=(i+1)*(c-1)+u;d.push(y,x,S),d.push(x,M,S)}}function _(){for(u=0;u<=e;u++)for(c=0;c<=i;c++)l.x=u/e,l.y=c/i,p.push(l.x,l.y)}}function KS(r,e,t,i,n,a){sr.call(this),this.type="TubeGeometry",this.parameters={path:r,tubularSegments:e,radius:t,radialSegments:i,closed:n},a!==void 0&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new hy(r,e,t,i,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function py(r,e,t,i,n,a){Bt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:r,tube:e,tubularSegments:t,radialSegments:i,p:n,q:a},r=r||100,e=e||40,t=Math.floor(t)||64,i=Math.floor(i)||8,n=n||2,a=a||3;var o=(i+1)*(t+1),s=i*t*2*3,l=new gt(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new gt(new Float32Array(o*3),3),c=new gt(new Float32Array(o*3),3),f=new gt(new Float32Array(o*2),2),h,p,d=0,g=0,m=new oe,v=new oe,_=new St,y=new oe,x=new oe,M=new oe,S=new oe,w=new oe;for(h=0;h<=t;++h){var T=h/t*n*Math.PI*2;for(U(T,n,a,r,y),U(T+.01,n,a,r,x),S.subVectors(x,y),w.addVectors(x,y),M.crossVectors(S,w),w.crossVectors(M,S),M.normalize(),w.normalize(),p=0;p<=i;++p){var C=p/i*Math.PI*2,b=-e*Math.cos(C),E=e*Math.sin(C);m.x=y.x+(b*w.x+E*M.x),m.y=y.y+(b*w.y+E*M.y),m.z=y.z+(b*w.z+E*M.z),u.setXYZ(d,m.x,m.y,m.z),v.subVectors(m,y).normalize(),c.setXYZ(d,v.x,v.y,v.z),_.x=h/t,_.y=p/i,f.setXY(d,_.x,_.y),d++}}for(p=1;p<=t;p++)for(h=1;h<=i;h++){var I=(i+1)*(p-1)+(h-1),R=(i+1)*p+(h-1),A=(i+1)*p+h,D=(i+1)*(p-1)+h;l.setX(g,I),g++,l.setX(g,R),g++,l.setX(g,D),g++,l.setX(g,R),g++,l.setX(g,A),g++,l.setX(g,D),g++}this.setIndex(l),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f);function U(B,z,k,G,Y){var J=Math.cos(B),Q=Math.sin(B),V=k/z*B,K=Math.cos(V);Y.x=G*(2+K)*.5*J,Y.y=G*(2+K)*Q*.5,Y.z=G*Math.sin(V)*.5}}function JS(r,e,t,i,n,a,o){sr.call(this),this.type="TorusKnotGeometry",this.parameters={radius:r,tube:e,tubularSegments:t,radialSegments:i,p:n,q:a},o!==void 0&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new py(r,e,t,i,n,a)),this.mergeVertices()}function dy(r,e,t,i,n){Bt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:r,tube:e,radialSegments:t,tubularSegments:i,arc:n},r=r||100,e=e||40,t=Math.floor(t)||8,i=Math.floor(i)||6,n=n||Math.PI*2;var a=(t+1)*(i+1),o=t*i*2*3,s=new(o>65535?Uint32Array:Uint16Array)(o),l=new Float32Array(a*3),u=new Float32Array(a*3),c=new Float32Array(a*2),f=0,h=0,p=0,d=new oe,g=new oe,m=new oe,v,_;for(v=0;v<=t;v++)for(_=0;_<=i;_++){var y=_/i*n,x=v/t*Math.PI*2;g.x=(r+e*Math.cos(x))*Math.cos(y),g.y=(r+e*Math.cos(x))*Math.sin(y),g.z=e*Math.sin(x),l[f]=g.x,l[f+1]=g.y,l[f+2]=g.z,d.x=r*Math.cos(y),d.y=r*Math.sin(y),m.subVectors(g,d).normalize(),u[f]=m.x,u[f+1]=m.y,u[f+2]=m.z,c[h]=_/i,c[h+1]=v/t,f+=3,h+=2}for(v=1;v<=t;v++)for(_=1;_<=i;_++){var M=(i+1)*v+_-1,S=(i+1)*(v-1)+_-1,w=(i+1)*(v-1)+_,T=(i+1)*v+_;s[p]=M,s[p+1]=S,s[p+2]=T,s[p+3]=S,s[p+4]=w,s[p+5]=T,p+=6}this.setIndex(new gt(s,1)),this.addAttribute("position",new gt(l,3)),this.addAttribute("normal",new gt(u,3)),this.addAttribute("uv",new gt(c,2))}function $S(r,e,t,i,n){sr.call(this),this.type="TorusGeometry",this.parameters={radius:r,tube:e,radialSegments:t,tubularSegments:i,arc:n},this.fromBufferGeometry(new dy(r,e,t,i,n))}function Ts(r,e){if(typeof r>"u"){r=[];return}sr.call(this),this.type="ExtrudeGeometry",r=Array.isArray(r)?r:[r],this.addShapeList(r,e),this.computeFaceNormals()}function QS(r,e){e=e||{};var t=e.font;if((t&&t.isFont)===!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new sr;var i=t.generateShapes(r,e.size,e.curveSegments);e.amount=e.height!==void 0?e.height:50,e.bevelThickness===void 0&&(e.bevelThickness=10),e.bevelSize===void 0&&(e.bevelSize=8),e.bevelEnabled===void 0&&(e.bevelEnabled=!1),Ts.call(this,i,e),this.type="TextGeometry"}function Gd(r,e,t,i,n,a,o){Bt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:r,widthSegments:e,heightSegments:t,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},r=r||50,e=Math.max(3,Math.floor(e)||8),t=Math.max(2,Math.floor(t)||6),i=i!==void 0?i:0,n=n!==void 0?n:Math.PI*2,a=a!==void 0?a:0,o=o!==void 0?o:Math.PI;for(var s=a+o,l=(e+1)*(t+1),u=new gt(new Float32Array(l*3),3),c=new gt(new Float32Array(l*3),3),f=new gt(new Float32Array(l*2),2),h=0,p=[],d=new oe,g=0;g<=t;g++){for(var m=[],v=g/t,_=0;_<=e;_++){var y=_/e,x=-r*Math.cos(i+y*n)*Math.sin(a+v*o),M=r*Math.cos(a+v*o),S=r*Math.sin(i+y*n)*Math.sin(a+v*o);d.set(x,M,S).normalize(),u.setXYZ(h,x,M,S),c.setXYZ(h,d.x,d.y,d.z),f.setXY(h,y,1-v),m.push(h),h++}p.push(m)}for(var w=[],g=0;g<t;g++)for(var _=0;_<e;_++){var T=p[g][_+1],C=p[g][_],b=p[g+1][_],E=p[g+1][_+1];(g!==0||a>0)&&w.push(T,C,E),(g!==t-1||s<Math.PI)&&w.push(C,b,E)}this.setIndex(new(u.count>65535?nc:ic)(w,1)),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f),this.boundingSphere=new $n(new oe,r)}function eM(r,e,t,i,n,a,o){sr.call(this),this.type="SphereGeometry",this.parameters={radius:r,widthSegments:e,heightSegments:t,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Gd(r,e,t,i,n,a,o))}function my(r,e,t,i,n,a){Bt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:r,outerRadius:e,thetaSegments:t,phiSegments:i,thetaStart:n,thetaLength:a},r=r||20,e=e||50,n=n!==void 0?n:0,a=a!==void 0?a:Math.PI*2,t=t!==void 0?Math.max(3,t):8,i=i!==void 0?Math.max(1,i):1;var o=(t+1)*(i+1),s=t*i*2*3,l=new gt(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new gt(new Float32Array(o*3),3),c=new gt(new Float32Array(o*3),3),f=new gt(new Float32Array(o*2),2),h=0,p=0,d,g=r,m=(e-r)/i,v=new oe,_=new St,y,x;for(y=0;y<=i;y++){for(x=0;x<=t;x++)d=n+x/t*a,v.x=g*Math.cos(d),v.y=g*Math.sin(d),u.setXYZ(h,v.x,v.y,v.z),c.setXYZ(h,0,0,1),_.x=(v.x/e+1)/2,_.y=(v.y/e+1)/2,f.setXY(h,_.x,_.y),h++;g+=m}for(y=0;y<i;y++){var M=y*(t+1);for(x=0;x<t;x++){d=x+M;var S=d,w=d+t+1,T=d+t+2,C=d+1;l.setX(p,S),p++,l.setX(p,w),p++,l.setX(p,T),p++,l.setX(p,S),p++,l.setX(p,T),p++,l.setX(p,C),p++}}this.setIndex(l),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f)}function tM(r,e,t,i,n,a){sr.call(this),this.type="RingGeometry",this.parameters={innerRadius:r,outerRadius:e,thetaSegments:t,phiSegments:i,thetaStart:n,thetaLength:a},this.fromBufferGeometry(new my(r,e,t,i,n,a))}function rM(r,e,t,i){sr.call(this),this.type="PlaneGeometry",this.parameters={width:r,height:e,widthSegments:t,heightSegments:i},this.fromBufferGeometry(new Fd(r,e,t,i))}function vy(r,e,t,i){Bt.call(this),this.type="LatheBufferGeometry",this.parameters={points:r,segments:e,phiStart:t,phiLength:i},e=Math.floor(e)||12,t=t||0,i=i||Math.PI*2,i=cr.clamp(i,0,Math.PI*2);var n=(e+1)*r.length,a=e*r.length*2*3,o=new gt(new(a>65535?Uint32Array:Uint16Array)(a),1),s=new gt(new Float32Array(n*3),3),l=new gt(new Float32Array(n*2),2),u=0,c=0,f,h=1/e,p=new oe,d=new St,g,m;for(g=0;g<=e;g++){var v=t+g*h*i,_=Math.sin(v),y=Math.cos(v);for(m=0;m<=r.length-1;m++)p.x=r[m].x*_,p.y=r[m].y,p.z=r[m].x*y,s.setXYZ(u,p.x,p.y,p.z),d.x=g/e,d.y=m/(r.length-1),l.setXY(u,d.x,d.y),u++}for(g=0;g<e;g++)for(m=0;m<r.length-1;m++){f=m+g*r.length;var x=f,M=f+r.length,S=f+r.length+1,w=f+1;o.setX(c,x),c++,o.setX(c,M),c++,o.setX(c,w),c++,o.setX(c,M),c++,o.setX(c,S),c++,o.setX(c,w),c++}if(this.setIndex(o),this.addAttribute("position",s),this.addAttribute("uv",l),this.computeVertexNormals(),i===Math.PI*2){var T=this.attributes.normal.array,C=new oe,b=new oe,E=new oe;for(f=e*r.length*3,g=0,m=0;g<r.length;g++,m+=3)C.x=T[m+0],C.y=T[m+1],C.z=T[m+2],b.x=T[f+m+0],b.y=T[f+m+1],b.z=T[f+m+2],E.addVectors(C,b).normalize(),T[m+0]=T[f+m+0]=E.x,T[m+1]=T[f+m+1]=E.y,T[m+2]=T[f+m+2]=E.z}}function iM(r,e,t,i){sr.call(this),this.type="LatheGeometry",this.parameters={points:r,segments:e,phiStart:t,phiLength:i},this.fromBufferGeometry(new vy(r,e,t,i)),this.mergeVertices()}function gy(r,e){Bt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:r,curveSegments:e},e=e||12;var t=[],i=[],n=[],a=[],o=0,s=0;if(Array.isArray(r)===!1)u(r);else for(var l=0;l<r.length;l++)u(r[l]),this.addGroup(o,s,l),o+=s,s=0;this.setIndex(new(a.length>65535?nc:ic)(a,1)),this.addAttribute("position",new gr(t,3)),this.addAttribute("normal",new gr(i,3)),this.addAttribute("uv",new gr(n,2));function u(c){var f,h,p,d=t.length/3,g=c.extractPoints(e),m=g.shape,v=g.holes;if(Ln.isClockWise(m)===!1)for(m=m.reverse(),f=0,h=v.length;f<h;f++)p=v[f],Ln.isClockWise(p)===!0&&(v[f]=p.reverse());var _=Ln.triangulateShape(m,v);for(f=0,h=v.length;f<h;f++)p=v[f],m=m.concat(p);for(f=0,h=m.length;f<h;f++){var y=m[f];t.push(y.x,y.y,0),i.push(0,0,1),n.push(y.x,y.y)}for(f=0,h=_.length;f<h;f++){var x=_[f],M=x[0]+d,S=x[1]+d,w=x[2]+d;a.push(M,S,w),s+=3}}}function yy(r,e){sr.call(this),this.type="ShapeGeometry",typeof e=="object"&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:r,curveSegments:e},this.fromBufferGeometry(new gy(r,e)),this.mergeVertices()}function _y(r,e){Bt.call(this),e=e!==void 0?e:1;var t=Math.cos(cr.DEG2RAD*e),i=[0,0],n={};function a(_,y){return _-y}var o=["a","b","c"],s;r.isBufferGeometry?(s=new sr,s.fromBufferGeometry(r)):s=r.clone(),s.mergeVertices(),s.computeFaceNormals();for(var l=s.vertices,u=s.faces,c=0,f=u.length;c<f;c++)for(var h=u[c],p=0;p<3;p++){i[0]=h[o[p]],i[1]=h[o[(p+1)%3]],i.sort(a);var d=i.toString();n[d]===void 0?n[d]={vert1:i[0],vert2:i[1],face1:c,face2:void 0}:n[d].face2=c}var g=[];for(var d in n){var m=n[d];if(m.face2===void 0||u[m.face1].normal.dot(u[m.face2].normal)<=t){var v=l[m.vert1];g.push(v.x),g.push(v.y),g.push(v.z),v=l[m.vert2],g.push(v.x),g.push(v.y),g.push(v.z)}}this.addAttribute("position",new gr(g,3))}function oc(r,e,t,i,n,a,o,s){Bt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:r,radiusBottom:e,height:t,radialSegments:i,heightSegments:n,openEnded:a,thetaStart:o,thetaLength:s};var l=this;r=r!==void 0?r:20,e=e!==void 0?e:20,t=t!==void 0?t:100,i=Math.floor(i)||8,n=Math.floor(n)||1,a=a!==void 0?a:!1,o=o!==void 0?o:0,s=s!==void 0?s:2*Math.PI;var u=0;a===!1&&(r>0&&u++,e>0&&u++);var c=M(),f=S(),h=new gt(new(f>65535?Uint32Array:Uint16Array)(f),1),p=new gt(new Float32Array(c*3),3),d=new gt(new Float32Array(c*3),3),g=new gt(new Float32Array(c*2),2),m=0,v=0,_=[],y=t/2,x=0;w(),a===!1&&(r>0&&T(!0),e>0&&T(!1)),this.setIndex(h),this.addAttribute("position",p),this.addAttribute("normal",d),this.addAttribute("uv",g);function M(){var C=(i+1)*(n+1);return a===!1&&(C+=(i+1)*u+i*u),C}function S(){var C=i*n*2*3;return a===!1&&(C+=i*u*3),C}function w(){var C,b,E=new oe,I=new oe,R=0,A=(e-r)/t;for(b=0;b<=n;b++){var D=[],U=b/n,B=U*(e-r)+r;for(C=0;C<=i;C++){var z=C/i,k=z*s+o,G=Math.sin(k),Y=Math.cos(k);I.x=B*G,I.y=-U*t+y,I.z=B*Y,p.setXYZ(m,I.x,I.y,I.z),E.set(G,A,Y).normalize(),d.setXYZ(m,E.x,E.y,E.z),g.setXY(m,z,1-U),D.push(m),m++}_.push(D)}for(C=0;C<i;C++)for(b=0;b<n;b++){var J=_[b][C],Q=_[b+1][C],V=_[b+1][C+1],K=_[b][C+1];h.setX(v,J),v++,h.setX(v,Q),v++,h.setX(v,K),v++,h.setX(v,Q),v++,h.setX(v,V),v++,h.setX(v,K),v++,R+=6}l.addGroup(x,R,0),x+=R}function T(C){var b,E,I,R=new St,A=new oe,D=0,U=C===!0?r:e,B=C===!0?1:-1;for(E=m,b=1;b<=i;b++)p.setXYZ(m,0,y*B,0),d.setXYZ(m,0,B,0),R.x=.5,R.y=.5,g.setXY(m,R.x,R.y),m++;for(I=m,b=0;b<=i;b++){var z=b/i,k=z*s+o,G=Math.cos(k),Y=Math.sin(k);A.x=U*Y,A.y=y*B,A.z=U*G,p.setXYZ(m,A.x,A.y,A.z),d.setXYZ(m,0,B,0),R.x=G*.5+.5,R.y=Y*.5*B+.5,g.setXY(m,R.x,R.y),m++}for(b=0;b<i;b++){var J=E+b,Q=I+b;C===!0?(h.setX(v,Q),v++,h.setX(v,Q+1),v++,h.setX(v,J),v++):(h.setX(v,Q+1),v++,h.setX(v,Q),v++,h.setX(v,J),v++),D+=3}l.addGroup(x,D,C===!0?1:2),x+=D}}function Hd(r,e,t,i,n,a,o,s){sr.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:r,radiusBottom:e,height:t,radialSegments:i,heightSegments:n,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new oc(r,e,t,i,n,a,o,s)),this.mergeVertices()}function nM(r,e,t,i,n,a,o){Hd.call(this,0,r,e,t,i,n,a,o),this.type="ConeGeometry",this.parameters={radius:r,height:e,radialSegments:t,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:o}}function aM(r,e,t,i,n,a,o){oc.call(this,0,r,e,t,i,n,a,o),this.type="ConeBufferGeometry",this.parameters={radius:r,height:e,radialSegments:t,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:o}}function xy(r,e,t,i){Bt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:r,segments:e,thetaStart:t,thetaLength:i},r=r||50,e=e!==void 0?Math.max(3,e):8,t=t!==void 0?t:0,i=i!==void 0?i:Math.PI*2;var n=e+2,a=new Float32Array(n*3),o=new Float32Array(n*3),s=new Float32Array(n*2);o[2]=1,s[0]=.5,s[1]=.5;for(var l=0,u=3,c=2;l<=e;l++,u+=3,c+=2){var f=t+l/e*i;a[u]=r*Math.cos(f),a[u+1]=r*Math.sin(f),o[u+2]=1,s[c]=(a[u]/r+1)/2,s[c+1]=(a[u+1]/r+1)/2}for(var h=[],u=1;u<=e;u++)h.push(u,u+1,0);this.setIndex(new gt(new Uint16Array(h),1)),this.addAttribute("position",new gt(a,3)),this.addAttribute("normal",new gt(o,3)),this.addAttribute("uv",new gt(s,2)),this.boundingSphere=new $n(new oe,r)}function oM(r,e,t,i){sr.call(this),this.type="CircleGeometry",this.parameters={radius:r,segments:e,thetaStart:t,thetaLength:i},this.fromBufferGeometry(new xy(r,e,t,i))}function sM(r,e,t,i,n,a){sr.call(this),this.type="BoxGeometry",this.parameters={width:r,height:e,depth:t,widthSegments:i,heightSegments:n,depthSegments:a},this.fromBufferGeometry(new zd(r,e,t,i,n,a)),this.mergeVertices()}function Sy(){Ma.call(this,{uniforms:io.merge([hr.lights,{opacity:{value:1}}]),vertexShader:Xr.shadow_vert,fragmentShader:Xr.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(r){this.uniforms.opacity.value=r}}})}function My(r){Ma.call(this,r),this.type="RawShaderMaterial"}function lM(r){this.uuid=cr.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(r)?r:[],this.visible=!0}function lu(r){mr.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Gt(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 Gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function Wd(r){lu.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(r)}function vl(r){mr.call(this),this.type="MeshPhongMaterial",this.color=new Gt(16777215),this.specular=new Gt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=gM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function Xd(r){vl.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(r)}function Yd(r){mr.call(this,r),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function qd(r){mr.call(this),this.type="MeshLambertMaterial",this.color=new Gt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=gM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function Zd(r){mr.call(this),this.type="LineDashedMaterial",this.color=new Gt(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(r)}function tB(r,e,t){var i=this,n=!1,a=0,o=0;this.onStart=void 0,this.onLoad=r,this.onProgress=e,this.onError=t,this.itemStart=function(s){o++,n===!1&&i.onStart!==void 0&&i.onStart(s,a,o),n=!0},this.itemEnd=function(s){a++,i.onProgress!==void 0&&i.onProgress(s,a,o),a===o&&(n=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(s){i.onError!==void 0&&i.onError(s)}}function Es(r){this.manager=r!==void 0?r:Fo}function qne(r){this.manager=r!==void 0?r:Fo,this._parser=null}function rB(r){this.manager=r!==void 0?r:Fo,this._parser=null}function _M(r){this.manager=r!==void 0?r:Fo}function iB(r){this.manager=r!==void 0?r:Fo}function EC(r){this.manager=r!==void 0?r:Fo}function Ui(r,e){At.call(this),this.type="Light",this.color=new Gt(r),this.intensity=e!==void 0?e:1,this.receiveShadow=void 0}function eC(r,e,t){Ui.call(this,r,t),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(At.DefaultUp),this.updateMatrix(),this.groundColor=new Gt(e)}function rm(r){this.camera=r,this.bias=0,this.radius=1,this.mapSize=new St(512,512),this.map=null,this.matrix=new qt}function tC(){rm.call(this,new Kn(50,1,.5,500))}function rC(r,e,t,i,n,a){Ui.call(this,r,e),this.type="SpotLight",this.position.copy(At.DefaultUp),this.updateMatrix(),this.target=new At,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(o){this.intensity=o/Math.PI}}),this.distance=t!==void 0?t:0,this.angle=i!==void 0?i:Math.PI/3,this.penumbra=n!==void 0?n:0,this.decay=a!==void 0?a:1,this.shadow=new tC}function iC(r,e,t,i){Ui.call(this,r,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return this.intensity*4*Math.PI},set:function(n){this.intensity=n/(4*Math.PI)}}),this.distance=t!==void 0?t:0,this.decay=i!==void 0?i:1,this.shadow=new rm(new Kn(90,1,.5,500))}function nC(r){rm.call(this,new ry(-5,5,5,-5,.5,500))}function aC(r,e){Ui.call(this,r,e),this.type="DirectionalLight",this.position.copy(At.DefaultUp),this.updateMatrix(),this.target=new At,this.shadow=new nC}function oC(r,e){Ui.call(this,r,e),this.type="AmbientLight",this.castShadow=void 0}function ao(r,e,t,i){this.parameterPositions=r,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(t),this.sampleValues=e,this.valueSize=t}function sC(r,e,t,i){ao.call(this,r,e,t,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function uM(r,e,t,i){ao.call(this,r,e,t,i)}function lC(r,e,t,i){ao.call(this,r,e,t,i)}function im(r,e,t,i){if(r===void 0)throw new Error("track name is undefined");if(e===void 0||e.length===0)throw new Error("no keyframes in track named "+r);this.name=r,this.times=Jn.convertArray(e,this.TimeBufferType),this.values=Jn.convertArray(t,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function by(r,e,t,i){im.call(this,r,e,t,i)}function uC(r,e,t,i){ao.call(this,r,e,t,i)}function cM(r,e,t,i){im.call(this,r,e,t,i)}function wy(r,e,t,i){im.call(this,r,e,t,i)}function cC(r,e,t,i){im.call(this,r,e,t,i)}function fC(r,e,t){im.call(this,r,e,t)}function hC(r,e,t,i){im.call(this,r,e,t,i)}function jd(r,e,t,i){im.apply(this,arguments)}function No(r,e,t){this.name=r,this.tracks=t,this.duration=e!==void 0?e:-1,this.uuid=cr.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function AC(r){this.manager=r!==void 0?r:Fo,this.textures={}}function nB(r){this.manager=r!==void 0?r:Fo}function Dd(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function aB(r){typeof r=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),r=void 0),this.manager=r!==void 0?r:Fo,this.withCredentials=!1}function Zne(r){this.manager=r!==void 0?r:Fo,this.texturePath=""}function ea(){}function uu(r,e){this.v1=r,this.v2=e}function fM(){this.curves=[],this.autoClose=!1}function sc(r,e,t,i,n,a,o,s){this.aX=r,this.aY=e,this.xRadius=t,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function Kd(r){this.points=r===void 0?[]:r}function Jd(r,e,t,i){this.v0=r,this.v1=e,this.v2=t,this.v3=i}function $d(r,e,t){this.v0=r,this.v1=e,this.v2=t}function Id(){SM.apply(this,arguments),this.holes=[]}function SM(r){fM.call(this),this.currentPoint=new St,r&&this.fromPoints(r)}function sB(){this.subPaths=[],this.currentPath=null}function lB(r){this.data=r}function jne(r){this.manager=r!==void 0?r:Fo}function cB(r){this.manager=r!==void 0?r:Fo}function bF(r,e,t,i){Ui.call(this,r,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=t!==void 0?t:10,this.height=i!==void 0?i:10}function Kne(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function pC(r,e,t){At.call(this),this.type="CubeCamera";var i=90,n=1,a=new Kn(i,n,r,e);a.up.set(0,-1,0),a.lookAt(new oe(1,0,0)),this.add(a);var o=new Kn(i,n,r,e);o.up.set(0,-1,0),o.lookAt(new oe(-1,0,0)),this.add(o);var s=new Kn(i,n,r,e);s.up.set(0,0,1),s.lookAt(new oe(0,1,0)),this.add(s);var l=new Kn(i,n,r,e);l.up.set(0,0,-1),l.lookAt(new oe(0,-1,0)),this.add(l);var u=new Kn(i,n,r,e);u.up.set(0,-1,0),u.lookAt(new oe(0,0,1)),this.add(u);var c=new Kn(i,n,r,e);c.up.set(0,-1,0),c.lookAt(new oe(0,0,-1)),this.add(c);var f={format:$g,magFilter:no,minFilter:no};this.renderTarget=new ey(t,t,f),this.updateCubeMap=function(h,p){this.parent===null&&this.updateMatrixWorld();var d=this.renderTarget,g=d.texture.generateMipmaps;d.texture.generateMipmaps=!1,d.activeCubeFace=0,h.render(p,a,d),d.activeCubeFace=1,h.render(p,o,d),d.activeCubeFace=2,h.render(p,s,d),d.activeCubeFace=3,h.render(p,l,d),d.activeCubeFace=4,h.render(p,u,d),d.texture.generateMipmaps=g,d.activeCubeFace=5,h.render(p,c,d),h.setRenderTarget(null)}}function wF(){At.call(this),this.type="AudioListener",this.context=uB.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Ty(r){At.call(this),this.type="Audio",this.context=r.context,this.gain=this.context.createGain(),this.gain.connect(r.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function TF(r){Ty.call(this,r),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function fB(r,e){this.analyser=r.context.createAnalyser(),this.analyser.fftSize=e!==void 0?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),r.getOutput().connect(this.analyser)}function dC(r,e,t){this.binding=r,this.valueSize=t;var i=Float64Array,n;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":i=Array,n=this._select;break;default:n=this._lerp}this.buffer=new i(t*4),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Ri(r,e,t){this.path=e,this.parsedPath=t||Ri.parseTrackName(e),this.node=Ri.findNode(r,this.parsedPath.nodeName)||r,this.rootNode=r}function EF(r){this.uuid=cr.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,i=arguments.length;t!==i;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function AF(r,e,t){this._mixer=r,this._clip=e,this._localRoot=t||null;for(var i=e.tracks,n=i.length,a=new Array(n),o={endingStart:Ud,endingEnd:Ud},s=0;s!==n;++s){var l=i[s].createInterpolant(null);a[s]=l,l.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Tne,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function hB(r){this._root=r,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function mC(r){typeof r=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),r=arguments[1]),this.value=r}function Qd(){Bt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function CF(r,e,t,i){this.uuid=cr.generateUUID(),this.data=r,this.itemSize=e,this.offset=t,this.normalized=i===!0}function Ey(r,e){this.uuid=cr.generateUUID(),this.array=r,this.stride=e,this.count=r!==void 0?r.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Ay(r,e,t){Ey.call(this,r,e),this.meshPerAttribute=t||1}function Cy(r,e,t){gt.call(this,r,e),this.meshPerAttribute=t||1}function RF(r,e,t,i){this.ray=new wh(r,e),this.near=t||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Fie(r,e){return r.distance-e.distance}function LF(r,e,t,i){if(r.visible!==!1&&(r.raycast(e,t),i===!0))for(var n=r.children,a=0,o=n.length;a<o;a++)LF(n[a],e,t,!0)}function PF(r){this.autoStart=r!==void 0?r:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function tLe(r){this.points=r;var e=[],t={x:0,y:0,z:0},i,n,a,o,s,l,u,c,f;this.initFromArray=function(p){this.points=[];for(var d=0;d<p.length;d++)this.points[d]={x:p[d][0],y:p[d][1],z:p[d][2]}},this.getPoint=function(p){return i=(this.points.length-1)*p,n=Math.floor(i),a=i-n,e[0]=n===0?n:n-1,e[1]=n,e[2]=n>this.points.length-2?this.points.length-1:n+1,e[3]=n>this.points.length-3?this.points.length-1:n+2,l=this.points[e[0]],u=this.points[e[1]],c=this.points[e[2]],f=this.points[e[3]],o=a*a,s=a*o,t.x=h(l.x,u.x,c.x,f.x,a,o,s),t.y=h(l.y,u.y,c.y,f.y,a,o,s),t.z=h(l.z,u.z,c.z,f.z,a,o,s),t},this.getControlPointsArray=function(){var p,d,g=this.points.length,m=[];for(p=0;p<g;p++)d=this.points[p],m[p]=[d.x,d.y,d.z];return m},this.getLength=function(p){var d,g,m,v,_=0,y=0,x=0,M=new oe,S=new oe,w=[],T=0;for(w[0]=0,p||(p=100),m=this.points.length*p,M.copy(this.points[0]),d=1;d<m;d++)g=d/m,v=this.getPoint(g),S.copy(v),T+=S.distanceTo(M),M.copy(v),_=(this.points.length-1)*g,y=Math.floor(_),y!==x&&(w[y]=T,x=y);return w[w.length]=T,{chunks:w,total:T}},this.reparametrizeByArcLength=function(p){var d,g,m,v,_,y,x,M,S=[],w=new oe,T=this.getLength();for(S.push(w.copy(this.points[0]).clone()),d=1;d<this.points.length;d++){for(y=T.chunks[d]-T.chunks[d-1],x=Math.ceil(p*y/T.total),v=(d-1)/(this.points.length-1),_=d/(this.points.length-1),g=1;g<x-1;g++)m=v+g*(1/x)*(_-v),M=this.getPoint(m),S.push(w.copy(M).clone());S.push(w.copy(this.points[d]).clone())}this.points=S};function h(p,d,g,m,v,_,y){var x=(g-p)*.5,M=(m-d)*.5;return(2*(d-g)+x+M)*y+(-3*(d-g)-2*x-M)*_+x*v+d}}function DF(r,e,t){return this.radius=r!==void 0?r:1,this.phi=e!==void 0?e:0,this.theta=t!==void 0?t:0,this}function IF(r,e,t){return this.radius=r!==void 0?r:1,this.theta=e!==void 0?e:0,this.y=t!==void 0?t:0,this}function Pn(r,e){mn.call(this,r,e),this.animationsMap={},this.animationsList=[];var t=this.geometry.morphTargets.length,i="__default",n=0,a=t-1,o=t/1;this.createAnimation(i,n,a,o),this.setAnimationWeight(i,1)}function hM(r){At.call(this),this.material=r,this.render=function(e){}}function pM(r,e,t,i){this.object=r,this.size=e!==void 0?e:1;var n=t!==void 0?t:16711680,a=i!==void 0?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length*3:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var l=new Bt,u=new gr(o*2*3,3);l.addAttribute("position",u),di.call(this,l,new Ni({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Ry(r){At.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Bt,t=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,n=1,a=32;i<a;i++,n++){var o=i/a*Math.PI*2,s=n/a*Math.PI*2;t.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}e.addAttribute("position",new gr(t,3));var l=new Ni({fog:!1});this.cone=new di(e,l),this.add(this.cone),this.update()}function Ly(r){this.bones=this.getBoneList(r);for(var e=new Bt,t=[],i=[],n=new Gt(0,0,1),a=new Gt(0,1,0),o=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(t.push(0,0,0),t.push(0,0,0),i.push(n.r,n.g,n.b),i.push(a.r,a.g,a.b))}e.addAttribute("position",new gr(t,3)),e.addAttribute("color",new gr(i,3));var l=new Ni({vertexColors:tm,depthTest:!1,depthWrite:!1,transparent:!0});di.call(this,e,l),this.root=r,this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Py(r,e){this.light=r,this.light.updateMatrixWorld();var t=new Gd(e,4,2),i=new oo({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),mn.call(this,t,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function Dy(r){At.call(this),this.light=r,this.light.updateMatrixWorld();var e=new oo({color:r.color,fog:!1}),t=new oo({color:r.color,fog:!1,wireframe:!0}),i=new Bt;i.addAttribute("position",new gt(new Float32Array(6*3),3)),this.add(new mn(i,e)),this.add(new mn(i,t)),this.update()}function Iy(r,e){At.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1;var t=new Vd(e);t.rotateY(Math.PI*.5);var i=new oo({vertexColors:tm,wireframe:!0}),n=t.getAttribute("position"),a=new Float32Array(n.count*3);t.addAttribute("color",new gt(a,3)),this.add(new mn(t,i)),this.update()}function dM(r,e,t,i){r=r||10,e=e||10,t=new Gt(t!==void 0?t:4473924),i=new Gt(i!==void 0?i:8947848);for(var n=e/2,a=r*2/e,o=[],s=[],l=0,u=0,c=-r;l<=e;l++,c+=a){o.push(-r,0,c,r,0,c),o.push(c,0,-r,c,0,r);var f=l===n?t:i;f.toArray(s,u),u+=3,f.toArray(s,u),u+=3,f.toArray(s,u),u+=3,f.toArray(s,u),u+=3}var h=new Bt;h.addAttribute("position",new gr(o,3)),h.addAttribute("color",new gr(s,3));var p=new Ni({vertexColors:tm});di.call(this,h,p)}function vC(r,e,t,i,n,a){r=r||10,e=e||16,t=t||8,i=i||64,n=new Gt(n!==void 0?n:4473924),a=new Gt(a!==void 0?a:8947848);var o=[],s=[],l,u,c,f,h,p,d;for(f=0;f<=e;f++)c=f/e*(Math.PI*2),l=Math.sin(c)*r,u=Math.cos(c)*r,o.push(0,0,0),o.push(l,0,u),d=f&1?n:a,s.push(d.r,d.g,d.b),s.push(d.r,d.g,d.b);for(f=0;f<=t;f++)for(d=f&1?n:a,p=r-r/t*f,h=0;h<i;h++)c=h/i*(Math.PI*2),l=Math.sin(c)*p,u=Math.cos(c)*p,o.push(l,0,u),s.push(d.r,d.g,d.b),c=(h+1)/i*(Math.PI*2),l=Math.sin(c)*p,u=Math.cos(c)*p,o.push(l,0,u),s.push(d.r,d.g,d.b);var g=new Bt;g.addAttribute("position",new gr(o,3)),g.addAttribute("color",new gr(s,3));var m=new Ni({vertexColors:tm});di.call(this,g,m)}function mM(r,e,t,i){this.object=r,this.size=e!==void 0?e:1;var n=t!==void 0?t:16776960,a=i!==void 0?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var l=new Bt,u=new gr(o*2*3,3);l.addAttribute("position",u),di.call(this,l,new Ni({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Ny(r,e){At.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,e===void 0&&(e=1);var t=new Bt;t.addAttribute("position",new gr([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new Ni({fog:!1});this.add(new ac(t,i)),t=new Bt,t.addAttribute("position",new gr([0,0,0,0,0,1],3)),this.add(new ac(t,i)),this.update()}function vM(r){var e=new Bt,t=new Ni({color:16777215,vertexColors:FF}),i=[],n=[],a={},o=new Gt(16755200),s=new Gt(16711680),l=new Gt(43775),u=new Gt(16777215),c=new Gt(3355443);f("n1","n2",o),f("n2","n4",o),f("n4","n3",o),f("n3","n1",o),f("f1","f2",o),f("f2","f4",o),f("f4","f3",o),f("f3","f1",o),f("n1","f1",o),f("n2","f2",o),f("n3","f3",o),f("n4","f4",o),f("p","n1",s),f("p","n2",s),f("p","n3",s),f("p","n4",s),f("u1","u2",l),f("u2","u3",l),f("u3","u1",l),f("c","t",u),f("p","c",c),f("cn1","cn2",c),f("cn3","cn4",c),f("cf1","cf2",c),f("cf3","cf4",c);function f(p,d,g){h(p,g),h(d,g)}function h(p,d){i.push(0,0,0),n.push(d.r,d.g,d.b),a[p]===void 0&&(a[p]=[]),a[p].push(i.length/3-1)}e.addAttribute("position",new gr(i,3)),e.addAttribute("color",new gr(n,3)),di.call(this,e,t),this.camera=r,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Uy(r,e){e===void 0&&(e=16776960);var t=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(8*3),n=new Bt;n.setIndex(new gt(t,1)),n.addAttribute("position",new gt(i,3)),di.call(this,n,new Ni({color:e})),r!==void 0&&this.update(r)}function em(r,e,t,i,n,a){At.call(this),i===void 0&&(i=16776960),t===void 0&&(t=1),n===void 0&&(n=.2*t),a===void 0&&(a=.2*n),this.position.copy(e),this.line=new ac(Jne,new Ni({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new mn($ne,new oo({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(t,n,a)}function gC(r){r=r||1;var e=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],t=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Bt;i.addAttribute("position",new gr(e,3)),i.addAttribute("color",new gr(t,3));var n=new Ni({vertexColors:tm});di.call(this,i,n)}function yC(r,e,t,i,n,a){sc.call(this,r,e,t,t,i,n,a)}function sLe(r,e,t,i,n,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new zo(r,e,t,n,a,o)}function cLe(r){return console.warn("THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial."),new lM(r)}function fLe(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ay(r,e)}function hLe(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new kS(r)}function pLe(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ay(r,e)}function dLe(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ml(r)}function mLe(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ml(r)}function vLe(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ml(r)}function gLe(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new oe(r,e,t)}function yLe(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new gt(r,e).setDynamic(!0)}function _Le(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new NS(r,e)}function xLe(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new US(r,e)}function SLe(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new OS(r,e)}function MLe(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new zS(r,e)}function bLe(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ic(r,e)}function wLe(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new FS(r,e)}function TLe(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new nc(r,e)}function ELe(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new gr(r,e)}function ALe(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new BS(r,e)}function Qne(r){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),pB.call(this,r),this.type="catmullrom",this.closed=!0}function CLe(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Uy(r,e)}function RLe(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new di(new _y(r.geometry),new Ni({color:e!==void 0?e:16777215}))}function LLe(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new di(new sy(r.geometry),new Ni({color:e!==void 0?e:16777215}))}function PLe(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Es(r)}function NLe(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(r,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),r.project(e)},this.unprojectVector=function(r,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),r.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function ULe(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}var Bie,JEe,kie,TS,NF,$Ee,Vie,QEe,eAe,UF,Gie,Kg,xh,Oy,OF,zF,_C,FF,tm,ES,zy,BF,kF,VF,GF,Hie,HF,Wie,Xie,lF,uF,Yie,qie,Zie,jie,WF,XF,Kie,Jie,$ie,Qie,ene,tne,rne,ine,HA,nne,ane,one,sne,gM,lne,une,VA,YF,cne,fne,hne,xC,SC,WA,qF,XA,ZF,MC,bC,pne,rc,Uo,Nd,cF,Oo,wC,TC,no,jF,yM,fF,YA,dne,mne,AS,vne,KF,Jg,qA,gne,yne,_ne,CS,xne,$g,ou,Sne,Mne,tAe,Ld,Qg,hF,pF,dF,mF,vF,gF,yF,_F,bne,wne,Tne,Ene,RS,wS,GA,Ud,Rd,LS,JF,Ane,Cne,PS,Rne,$F,Lne,rAe,Pne,Dne,Ine,Nne,Une,cr,iAe,One,zne,Die,Iie,oF,io,RAe,LAe,PAe,DAe,IAe,NAe,UAe,OAe,zAe,FAe,BAe,kAe,VAe,GAe,HAe,WAe,XAe,YAe,qAe,ZAe,jAe,KAe,JAe,$Ae,QAe,eCe,tCe,rCe,iCe,nCe,aCe,oCe,sCe,lCe,uCe,cCe,fCe,hCe,pCe,dCe,mCe,vCe,gCe,yCe,_Ce,xCe,SCe,MCe,bCe,wCe,TCe,ECe,ACe,CCe,RCe,LCe,PCe,DCe,ICe,NCe,UCe,OCe,zCe,FCe,BCe,kCe,VCe,GCe,HCe,WCe,XCe,YCe,qCe,ZCe,jCe,KCe,JCe,$Ce,QCe,eRe,tRe,rRe,iRe,nRe,aRe,oRe,sRe,lRe,uRe,cRe,fRe,hRe,pRe,dRe,mRe,vRe,gRe,yRe,_Re,xRe,SRe,MRe,bRe,wRe,TRe,ERe,Xr,ARe,hr,ty,LRe,PRe,DRe,zRe,Ln,dl,QRe,MF,Fo,eLe,Jn,lc,xM,oB,kA,uB,Jne,$ne,pB,rLe,iLe,nLe,aLe,oLe,lLe,uLe,DLe,ILe,tae=Use(()=>{"use strict";Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52));Math.sign===void 0&&(Math.sign=function(r){return r<0?-1:r>0?1:+r});Function.prototype.name===void 0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});Object.assign===void 0&&function(){Object.assign=function(r){"use strict";if(r==null)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(r),t=1;t<arguments.length;t++){var i=arguments[t];if(i!=null)for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}}();Object.assign(bs.prototype,{addEventListener:function(r,e){this._listeners===void 0&&(this._listeners={});var t=this._listeners;t[r]===void 0&&(t[r]=[]),t[r].indexOf(e)===-1&&t[r].push(e)},hasEventListener:function(r,e){if(this._listeners===void 0)return!1;var t=this._listeners;return t[r]!==void 0&&t[r].indexOf(e)!==-1},removeEventListener:function(r,e){if(this._listeners!==void 0){var t=this._listeners,i=t[r];if(i!==void 0){var n=i.indexOf(e);n!==-1&&i.splice(n,1)}}},dispatchEvent:function(r){if(this._listeners!==void 0){var e=this._listeners,t=e[r.type];if(t!==void 0){r.target=this;var i=[],n=0,a=t.length;for(n=0;n<a;n++)i[n]=t[n];for(n=0;n<a;n++)i[n].call(this,r)}}}});Bie="83",JEe={LEFT:0,MIDDLE:1,RIGHT:2},kie=0,TS=1,NF=2,$Ee=3,Vie=0,QEe=1,eAe=0,UF=1,Gie=2,Kg=0,xh=1,Oy=2,OF=1,zF=2,_C=0,FF=1,tm=2,ES=0,zy=1,BF=2,kF=3,VF=4,GF=5,Hie={NoBlending:ES,NormalBlending:zy,AdditiveBlending:BF,SubtractiveBlending:kF,MultiplyBlending:VF,CustomBlending:GF},HF=100,Wie=101,Xie=102,lF=103,uF=104,Yie=200,qie=201,Zie=202,jie=203,WF=204,XF=205,Kie=206,Jie=207,$ie=208,Qie=209,ene=210,tne=0,rne=1,ine=2,HA=3,nne=4,ane=5,one=6,sne=7,gM=0,lne=1,une=2,VA=0,YF=1,cne=2,fne=3,hne=4,xC=300,SC=301,WA=302,qF=303,XA=304,ZF=305,MC=306,bC=307,pne={UVMapping:xC,CubeReflectionMapping:SC,CubeRefractionMapping:WA,EquirectangularReflectionMapping:qF,EquirectangularRefractionMapping:XA,SphericalReflectionMapping:ZF,CubeUVReflectionMapping:MC,CubeUVRefractionMapping:bC},rc=1e3,Uo=1001,Nd=1002,cF={RepeatWrapping:rc,ClampToEdgeWrapping:Uo,MirroredRepeatWrapping:Nd},Oo=1003,wC=1004,TC=1005,no=1006,jF=1007,yM=1008,fF={NearestFilter:Oo,NearestMipMapNearestFilter:wC,NearestMipMapLinearFilter:TC,LinearFilter:no,LinearMipMapNearestFilter:jF,LinearMipMapLinearFilter:yM},YA=1009,dne=1010,mne=1011,AS=1012,vne=1013,KF=1014,Jg=1015,qA=1016,gne=1017,yne=1018,_ne=1019,CS=1020,xne=1021,$g=1022,ou=1023,Sne=1024,Mne=1025,tAe=ou,Ld=1026,Qg=1027,hF=2001,pF=2002,dF=2003,mF=2004,vF=2100,gF=2101,yF=2102,_F=2103,bne=2151,wne=2200,Tne=2201,Ene=2202,RS=2300,wS=2301,GA=2302,Ud=2400,Rd=2401,LS=2402,JF=0,Ane=1,Cne=2,PS=3e3,Rne=3001,$F=3007,Lne=3002,rAe=3003,Pne=3004,Dne=3005,Ine=3006,Nne=3200,Une=3201,cr={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),t=0,i;return function(){for(var a=0;a<36;a++)a===8||a===13||a===18||a===23?e[a]="-":a===14?e[a]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),i=t&15,t=t>>4,e[a]=r[a===19?i&3|8:i]);return e.join("")}}(),clamp:function(r,e,t){return Math.max(e,Math.min(t,r))},euclideanModulo:function(r,e){return(r%e+e)%e},mapLinear:function(r,e,t,i,n){return i+(r-e)*(n-i)/(t-e)},lerp:function(r,e,t){return(1-t)*r+t*e},smoothstep:function(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))},smootherstep:function(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))},randInt:function(r,e){return r+Math.floor(Math.random()*(e-r+1))},randFloat:function(r,e){return r+Math.random()*(e-r)},randFloatSpread:function(r){return r*(.5-Math.random())},degToRad:function(r){return r*cr.DEG2RAD},radToDeg:function(r){return r*cr.RAD2DEG},isPowerOfTwo:function(r){return(r&r-1)===0&&r!==0},nearestPowerOfTwo:function(r){return Math.pow(2,Math.round(Math.log(r)/Math.LN2))},nextPowerOfTwo:function(r){return r--,r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,r++,r}};St.prototype={constructor:St,isVector2:!0,get width(){return this.x},set width(r){this.x=r},get height(){return this.y},set height(r){this.y=r},set:function(r,e){return this.x=r,this.y=e,this},setScalar:function(r){return this.x=r,this.y=r,this},setX:function(r){return this.x=r,this},setY:function(r){return this.y=r,this},setComponent:function(r,e){switch(r){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+r)}return this},getComponent:function(r){switch(r){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+r)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(r){return this.x=r.x,this.y=r.y,this},add:function(r,e){return e!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(r,e)):(this.x+=r.x,this.y+=r.y,this)},addScalar:function(r){return this.x+=r,this.y+=r,this},addVectors:function(r,e){return this.x=r.x+e.x,this.y=r.y+e.y,this},addScaledVector:function(r,e){return this.x+=r.x*e,this.y+=r.y*e,this},sub:function(r,e){return e!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(r,e)):(this.x-=r.x,this.y-=r.y,this)},subScalar:function(r){return this.x-=r,this.y-=r,this},subVectors:function(r,e){return this.x=r.x-e.x,this.y=r.y-e.y,this},multiply:function(r){return this.x*=r.x,this.y*=r.y,this},multiplyScalar:function(r){return isFinite(r)?(this.x*=r,this.y*=r):(this.x=0,this.y=0),this},divide:function(r){return this.x/=r.x,this.y/=r.y,this},divideScalar:function(r){return this.multiplyScalar(1/r)},min:function(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this},max:function(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this},clamp:function(r,e){return this.x=Math.max(r.x,Math.min(e.x,this.x)),this.y=Math.max(r.y,Math.min(e.y,this.y)),this},clampScalar:function(){var r,e;return function(i,n){return r===void 0&&(r=new St,e=new St),r.set(i,i),e.set(n,n),this.clamp(r,e)}}(),clampLength:function(r,e){var t=this.length();return this.multiplyScalar(Math.max(r,Math.min(e,t))/t)},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(r){return this.x*r.x+this.y*r.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var r=Math.atan2(this.y,this.x);return r<0&&(r+=2*Math.PI),r},distanceTo:function(r){return Math.sqrt(this.distanceToSquared(r))},distanceToSquared:function(r){var e=this.x-r.x,t=this.y-r.y;return e*e+t*t},distanceToManhattan:function(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)},setLength:function(r){return this.multiplyScalar(r/this.length())},lerp:function(r,e){return this.x+=(r.x-this.x)*e,this.y+=(r.y-this.y)*e,this},lerpVectors:function(r,e,t){return this.subVectors(e,r).multiplyScalar(t).add(r)},equals:function(r){return r.x===this.x&&r.y===this.y},fromArray:function(r,e){return e===void 0&&(e=0),this.x=r[e],this.y=r[e+1],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.x,r[e+1]=this.y,r},fromAttribute:function(r,e,t){return t!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromAttribute()."),this.x=r.getX(e),this.y=r.getY(e),this},rotateAround:function(r,e){var t=Math.cos(e),i=Math.sin(e),n=this.x-r.x,a=this.y-r.y;return this.x=n*t-a*i+r.x,this.y=n*i+a*t+r.y,this}};iAe=0;ai.DEFAULT_IMAGE=void 0;ai.DEFAULT_MAPPING=xC;ai.prototype={constructor:ai,isTexture:!0,set needsUpdate(r){r===!0&&this.version++},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.image=r.image,this.mipmaps=r.mipmaps.slice(0),this.mapping=r.mapping,this.wrapS=r.wrapS,this.wrapT=r.wrapT,this.magFilter=r.magFilter,this.minFilter=r.minFilter,this.anisotropy=r.anisotropy,this.format=r.format,this.type=r.type,this.offset.copy(r.offset),this.repeat.copy(r.repeat),this.generateMipmaps=r.generateMipmaps,this.premultiplyAlpha=r.premultiplyAlpha,this.flipY=r.flipY,this.unpackAlignment=r.unpackAlignment,this.encoding=r.encoding,this},toJSON:function(r){if(r.textures[this.uuid]!==void 0)return r.textures[this.uuid];function e(n){var a;return n.toDataURL!==void 0?a=n:(a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),a.width=n.width,a.height=n.height,a.getContext("2d").drawImage(n,0,0,n.width,n.height)),a.width>2048||a.height>2048?a.toDataURL("image/jpeg",.6):a.toDataURL("image/png")}var t={metadata:{version:4.4,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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(this.image!==void 0){var i=this.image;i.uuid===void 0&&(i.uuid=cr.generateUUID()),r.images[i.uuid]===void 0&&(r.images[i.uuid]={uuid:i.uuid,url:e(i)}),t.image=i.uuid}return r.textures[this.uuid]=t,t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(r){if(this.mapping===xC){if(r.multiply(this.repeat),r.add(this.offset),r.x<0||r.x>1)switch(this.wrapS){case rc:r.x=r.x-Math.floor(r.x);break;case Uo:r.x=r.x<0?0:1;break;case Nd:Math.abs(Math.floor(r.x)%2)===1?r.x=Math.ceil(r.x)-r.x:r.x=r.x-Math.floor(r.x);break}if(r.y<0||r.y>1)switch(this.wrapT){case rc:r.y=r.y-Math.floor(r.y);break;case Uo:r.y=r.y<0?0:1;break;case Nd:Math.abs(Math.floor(r.y)%2)===1?r.y=Math.ceil(r.y)-r.y:r.y=r.y-Math.floor(r.y);break}this.flipY&&(r.y=1-r.y)}}};Object.assign(ai.prototype,bs.prototype);ei.prototype={constructor:ei,isVector4:!0,set:function(r,e,t,i){return this.x=r,this.y=e,this.z=t,this.w=i,this},setScalar:function(r){return this.x=r,this.y=r,this.z=r,this.w=r,this},setX:function(r){return this.x=r,this},setY:function(r){return this.y=r,this},setZ:function(r){return this.z=r,this},setW:function(r){return this.w=r,this},setComponent:function(r,e){switch(r){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 new Error("index is out of range: "+r)}return this},getComponent:function(r){switch(r){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+r)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this.w=r.w!==void 0?r.w:1,this},add:function(r,e){return e!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(r,e)):(this.x+=r.x,this.y+=r.y,this.z+=r.z,this.w+=r.w,this)},addScalar:function(r){return this.x+=r,this.y+=r,this.z+=r,this.w+=r,this},addVectors:function(r,e){return this.x=r.x+e.x,this.y=r.y+e.y,this.z=r.z+e.z,this.w=r.w+e.w,this},addScaledVector:function(r,e){return this.x+=r.x*e,this.y+=r.y*e,this.z+=r.z*e,this.w+=r.w*e,this},sub:function(r,e){return e!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(r,e)):(this.x-=r.x,this.y-=r.y,this.z-=r.z,this.w-=r.w,this)},subScalar:function(r){return this.x-=r,this.y-=r,this.z-=r,this.w-=r,this},subVectors:function(r,e){return this.x=r.x-e.x,this.y=r.y-e.y,this.z=r.z-e.z,this.w=r.w-e.w,this},multiplyScalar:function(r){return isFinite(r)?(this.x*=r,this.y*=r,this.z*=r,this.w*=r):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(r){var e=this.x,t=this.y,i=this.z,n=this.w,a=r.elements;return this.x=a[0]*e+a[4]*t+a[8]*i+a[12]*n,this.y=a[1]*e+a[5]*t+a[9]*i+a[13]*n,this.z=a[2]*e+a[6]*t+a[10]*i+a[14]*n,this.w=a[3]*e+a[7]*t+a[11]*i+a[15]*n,this},divideScalar:function(r){return this.multiplyScalar(1/r)},setAxisAngleFromQuaternion:function(r){this.w=2*Math.acos(r.w);var e=Math.sqrt(1-r.w*r.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=r.x/e,this.y=r.y/e,this.z=r.z/e),this},setAxisAngleFromRotationMatrix:function(r){var e,t,i,n,a=.01,o=.1,s=r.elements,l=s[0],u=s[4],c=s[8],f=s[1],h=s[5],p=s[9],d=s[2],g=s[6],m=s[10];if(Math.abs(u-f)<a&&Math.abs(c-d)<a&&Math.abs(p-g)<a){if(Math.abs(u+f)<o&&Math.abs(c+d)<o&&Math.abs(p+g)<o&&Math.abs(l+h+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var v=(l+1)/2,_=(h+1)/2,y=(m+1)/2,x=(u+f)/4,M=(c+d)/4,S=(p+g)/4;return v>_&&v>y?v<a?(t=0,i=.707106781,n=.707106781):(t=Math.sqrt(v),i=x/t,n=M/t):_>y?_<a?(t=.707106781,i=0,n=.707106781):(i=Math.sqrt(_),t=x/i,n=S/i):y<a?(t=.707106781,i=.707106781,n=0):(n=Math.sqrt(y),t=M/n,i=S/n),this.set(t,i,n,e),this}var w=Math.sqrt((g-p)*(g-p)+(c-d)*(c-d)+(f-u)*(f-u));return Math.abs(w)<.001&&(w=1),this.x=(g-p)/w,this.y=(c-d)/w,this.z=(f-u)/w,this.w=Math.acos((l+h+m-1)/2),this},min:function(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this.w=Math.min(this.w,r.w),this},max:function(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this.w=Math.max(this.w,r.w),this},clamp:function(r,e){return this.x=Math.max(r.x,Math.min(e.x,this.x)),this.y=Math.max(r.y,Math.min(e.y,this.y)),this.z=Math.max(r.z,Math.min(e.z,this.z)),this.w=Math.max(r.w,Math.min(e.w,this.w)),this},clampScalar:function(){var r,e;return function(i,n){return r===void 0&&(r=new ei,e=new ei),r.set(i,i,i,i),e.set(n,n,n,n),this.clamp(r,e)}}(),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(r){return this.x*r.x+this.y*r.y+this.z*r.z+this.w*r.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)},lengthManhattan: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())},setLength:function(r){return this.multiplyScalar(r/this.length())},lerp:function(r,e){return this.x+=(r.x-this.x)*e,this.y+=(r.y-this.y)*e,this.z+=(r.z-this.z)*e,this.w+=(r.w-this.w)*e,this},lerpVectors:function(r,e,t){return this.subVectors(e,r).multiplyScalar(t).add(r)},equals:function(r){return r.x===this.x&&r.y===this.y&&r.z===this.z&&r.w===this.w},fromArray:function(r,e){return e===void 0&&(e=0),this.x=r[e],this.y=r[e+1],this.z=r[e+2],this.w=r[e+3],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.x,r[e+1]=this.y,r[e+2]=this.z,r[e+3]=this.w,r},fromAttribute:function(r,e,t){return t!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromAttribute()."),this.x=r.getX(e),this.y=r.getY(e),this.z=r.getZ(e),this.w=r.getW(e),this}};Object.assign(Fy.prototype,bs.prototype,{isWebGLRenderTarget:!0,setSize:function(r,e){(this.width!==r||this.height!==e)&&(this.width=r,this.height=e,this.dispose()),this.viewport.set(0,0,r,e),this.scissor.set(0,0,r,e)},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.width=r.width,this.height=r.height,this.viewport.copy(r.viewport),this.texture=r.texture.clone(),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.depthTexture=r.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});ey.prototype=Object.create(Fy.prototype);ey.prototype.constructor=ey;ey.prototype.isWebGLRenderTargetCube=!0;on.prototype={constructor:on,get x(){return this._x},set x(r){this._x=r,this.onChangeCallback()},get y(){return this._y},set y(r){this._y=r,this.onChangeCallback()},get z(){return this._z},set z(r){this._z=r,this.onChangeCallback()},get w(){return this._w},set w(r){this._w=r,this.onChangeCallback()},set:function(r,e,t,i){return this._x=r,this._y=e,this._z=t,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(r){return this._x=r.x,this._y=r.y,this._z=r.z,this._w=r.w,this.onChangeCallback(),this},setFromEuler:function(r,e){if((r&&r.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var t=Math.cos(r._x/2),i=Math.cos(r._y/2),n=Math.cos(r._z/2),a=Math.sin(r._x/2),o=Math.sin(r._y/2),s=Math.sin(r._z/2),l=r.order;return l==="XYZ"?(this._x=a*i*n+t*o*s,this._y=t*o*n-a*i*s,this._z=t*i*s+a*o*n,this._w=t*i*n-a*o*s):l==="YXZ"?(this._x=a*i*n+t*o*s,this._y=t*o*n-a*i*s,this._z=t*i*s-a*o*n,this._w=t*i*n+a*o*s):l==="ZXY"?(this._x=a*i*n-t*o*s,this._y=t*o*n+a*i*s,this._z=t*i*s+a*o*n,this._w=t*i*n-a*o*s):l==="ZYX"?(this._x=a*i*n-t*o*s,this._y=t*o*n+a*i*s,this._z=t*i*s-a*o*n,this._w=t*i*n+a*o*s):l==="YZX"?(this._x=a*i*n+t*o*s,this._y=t*o*n+a*i*s,this._z=t*i*s-a*o*n,this._w=t*i*n-a*o*s):l==="XZY"&&(this._x=a*i*n-t*o*s,this._y=t*o*n-a*i*s,this._z=t*i*s+a*o*n,this._w=t*i*n+a*o*s),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(r,e){var t=e/2,i=Math.sin(t);return this._x=r.x*i,this._y=r.y*i,this._z=r.z*i,this._w=Math.cos(t),this.onChangeCallback(),this},setFromRotationMatrix:function(r){var e=r.elements,t=e[0],i=e[4],n=e[8],a=e[1],o=e[5],s=e[9],l=e[2],u=e[6],c=e[10],f=t+o+c,h;return f>0?(h=.5/Math.sqrt(f+1),this._w=.25/h,this._x=(u-s)*h,this._y=(n-l)*h,this._z=(a-i)*h):t>o&&t>c?(h=2*Math.sqrt(1+t-o-c),this._w=(u-s)/h,this._x=.25*h,this._y=(i+a)/h,this._z=(n+l)/h):o>c?(h=2*Math.sqrt(1+o-t-c),this._w=(n-l)/h,this._x=(i+a)/h,this._y=.25*h,this._z=(s+u)/h):(h=2*Math.sqrt(1+c-t-o),this._w=(a-i)/h,this._x=(n+l)/h,this._y=(s+u)/h,this._z=.25*h),this.onChangeCallback(),this},setFromUnitVectors:function(){var r,e,t=1e-6;return function(n,a){return r===void 0&&(r=new oe),e=n.dot(a)+1,e<t?(e=0,Math.abs(n.x)>Math.abs(n.z)?r.set(-n.y,n.x,0):r.set(0,-n.z,n.y)):r.crossVectors(n,a),this._x=r.x,this._y=r.y,this._z=r.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(r){return this._x*r._x+this._y*r._y+this._z*r._z+this._w*r._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 r=this.length();return r===0?(this._x=0,this._y=0,this._z=0,this._w=1):(r=1/r,this._x=this._x*r,this._y=this._y*r,this._z=this._z*r,this._w=this._w*r),this.onChangeCallback(),this},multiply:function(r,e){return e!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(r,e)):this.multiplyQuaternions(this,r)},premultiply:function(r){return this.multiplyQuaternions(r,this)},multiplyQuaternions:function(r,e){var t=r._x,i=r._y,n=r._z,a=r._w,o=e._x,s=e._y,l=e._z,u=e._w;return this._x=t*u+a*o+i*l-n*s,this._y=i*u+a*s+n*o-t*l,this._z=n*u+a*l+t*s-i*o,this._w=a*u-t*o-i*s-n*l,this.onChangeCallback(),this},slerp:function(r,e){if(e===0)return this;if(e===1)return this.copy(r);var t=this._x,i=this._y,n=this._z,a=this._w,o=a*r._w+t*r._x+i*r._y+n*r._z;if(o<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,o=-o):this.copy(r),o>=1)return this._w=a,this._x=t,this._y=i,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(t+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var l=Math.atan2(s,o),u=Math.sin((1-e)*l)/s,c=Math.sin(e*l)/s;return this._w=a*u+this._w*c,this._x=t*u+this._x*c,this._y=i*u+this._y*c,this._z=n*u+this._z*c,this.onChangeCallback(),this},equals:function(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._w===this._w},fromArray:function(r,e){return e===void 0&&(e=0),this._x=r[e],this._y=r[e+1],this._z=r[e+2],this._w=r[e+3],this.onChangeCallback(),this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this._x,r[e+1]=this._y,r[e+2]=this._z,r[e+3]=this._w,r},onChange:function(r){return this.onChangeCallback=r,this},onChangeCallback:function(){}};Object.assign(on,{slerp:function(r,e,t,i){return t.copy(r).slerp(e,i)},slerpFlat:function(r,e,t,i,n,a,o){var s=t[i+0],l=t[i+1],u=t[i+2],c=t[i+3],f=n[a+0],h=n[a+1],p=n[a+2],d=n[a+3];if(c!==d||s!==f||l!==h||u!==p){var g=1-o,m=s*f+l*h+u*p+c*d,v=m>=0?1:-1,_=1-m*m;if(_>Number.EPSILON){var y=Math.sqrt(_),x=Math.atan2(y,m*v);g=Math.sin(g*x)/y,o=Math.sin(o*x)/y}var M=o*v;if(s=s*g+f*M,l=l*g+h*M,u=u*g+p*M,c=c*g+d*M,g===1-o){var S=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=S,l*=S,u*=S,c*=S}}r[e]=s,r[e+1]=l,r[e+2]=u,r[e+3]=c}});oe.prototype={constructor:oe,isVector3:!0,set:function(r,e,t){return this.x=r,this.y=e,this.z=t,this},setScalar:function(r){return this.x=r,this.y=r,this.z=r,this},setX:function(r){return this.x=r,this},setY:function(r){return this.y=r,this},setZ:function(r){return this.z=r,this},setComponent:function(r,e){switch(r){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+r)}return this},getComponent:function(r){switch(r){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+r)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},add:function(r,e){return e!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(r,e)):(this.x+=r.x,this.y+=r.y,this.z+=r.z,this)},addScalar:function(r){return this.x+=r,this.y+=r,this.z+=r,this},addVectors:function(r,e){return this.x=r.x+e.x,this.y=r.y+e.y,this.z=r.z+e.z,this},addScaledVector:function(r,e){return this.x+=r.x*e,this.y+=r.y*e,this.z+=r.z*e,this},sub:function(r,e){return e!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(r,e)):(this.x-=r.x,this.y-=r.y,this.z-=r.z,this)},subScalar:function(r){return this.x-=r,this.y-=r,this.z-=r,this},subVectors:function(r,e){return this.x=r.x-e.x,this.y=r.y-e.y,this.z=r.z-e.z,this},multiply:function(r,e){return e!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(r,e)):(this.x*=r.x,this.y*=r.y,this.z*=r.z,this)},multiplyScalar:function(r){return isFinite(r)?(this.x*=r,this.y*=r,this.z*=r):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(r,e){return this.x=r.x*e.x,this.y=r.y*e.y,this.z=r.z*e.z,this},applyEuler:function(){var r;return function(t){return(t&&t.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),r===void 0&&(r=new on),this.applyQuaternion(r.setFromEuler(t))}}(),applyAxisAngle:function(){var r;return function(t,i){return r===void 0&&(r=new on),this.applyQuaternion(r.setFromAxisAngle(t,i))}}(),applyMatrix3:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements;return this.x=n[0]*e+n[3]*t+n[6]*i,this.y=n[1]*e+n[4]*t+n[7]*i,this.z=n[2]*e+n[5]*t+n[8]*i,this},applyMatrix4:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements;return this.x=n[0]*e+n[4]*t+n[8]*i+n[12],this.y=n[1]*e+n[5]*t+n[9]*i+n[13],this.z=n[2]*e+n[6]*t+n[10]*i+n[14],this},applyProjection:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements,a=1/(n[3]*e+n[7]*t+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*t+n[8]*i+n[12])*a,this.y=(n[1]*e+n[5]*t+n[9]*i+n[13])*a,this.z=(n[2]*e+n[6]*t+n[10]*i+n[14])*a,this},applyQuaternion:function(r){var e=this.x,t=this.y,i=this.z,n=r.x,a=r.y,o=r.z,s=r.w,l=s*e+a*i-o*t,u=s*t+o*e-n*i,c=s*i+n*t-a*e,f=-n*e-a*t-o*i;return this.x=l*s+f*-n+u*-o-c*-a,this.y=u*s+f*-a+c*-n-l*-o,this.z=c*s+f*-o+l*-a-u*-n,this},project:function(){var r;return function(t){return r===void 0&&(r=new qt),r.multiplyMatrices(t.projectionMatrix,r.getInverse(t.matrixWorld)),this.applyProjection(r)}}(),unproject:function(){var r;return function(t){return r===void 0&&(r=new qt),r.multiplyMatrices(t.matrixWorld,r.getInverse(t.projectionMatrix)),this.applyProjection(r)}}(),transformDirection:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements;return this.x=n[0]*e+n[4]*t+n[8]*i,this.y=n[1]*e+n[5]*t+n[9]*i,this.z=n[2]*e+n[6]*t+n[10]*i,this.normalize()},divide:function(r){return this.x/=r.x,this.y/=r.y,this.z/=r.z,this},divideScalar:function(r){return this.multiplyScalar(1/r)},min:function(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this},max:function(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this},clamp:function(r,e){return this.x=Math.max(r.x,Math.min(e.x,this.x)),this.y=Math.max(r.y,Math.min(e.y,this.y)),this.z=Math.max(r.z,Math.min(e.z,this.z)),this},clampScalar:function(){var r,e;return function(i,n){return r===void 0&&(r=new oe,e=new oe),r.set(i,i,i),e.set(n,n,n),this.clamp(r,e)}}(),clampLength:function(r,e){var t=this.length();return this.multiplyScalar(Math.max(r,Math.min(e,t))/t)},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(r){return this.x*r.x+this.y*r.y+this.z*r.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(r){return this.multiplyScalar(r/this.length())},lerp:function(r,e){return this.x+=(r.x-this.x)*e,this.y+=(r.y-this.y)*e,this.z+=(r.z-this.z)*e,this},lerpVectors:function(r,e,t){return this.subVectors(e,r).multiplyScalar(t).add(r)},cross:function(r,e){if(e!==void 0)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(r,e);var t=this.x,i=this.y,n=this.z;return this.x=i*r.z-n*r.y,this.y=n*r.x-t*r.z,this.z=t*r.y-i*r.x,this},crossVectors:function(r,e){var t=r.x,i=r.y,n=r.z,a=e.x,o=e.y,s=e.z;return this.x=i*s-n*o,this.y=n*a-t*s,this.z=t*o-i*a,this},projectOnVector:function(r){var e=r.dot(this)/r.lengthSq();return this.copy(r).multiplyScalar(e)},projectOnPlane:function(){var r;return function(t){return r===void 0&&(r=new oe),r.copy(this).projectOnVector(t),this.sub(r)}}(),reflect:function(){var r;return function(t){return r===void 0&&(r=new oe),this.sub(r.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(r){var e=this.dot(r)/Math.sqrt(this.lengthSq()*r.lengthSq());return Math.acos(cr.clamp(e,-1,1))},distanceTo:function(r){return Math.sqrt(this.distanceToSquared(r))},distanceToSquared:function(r){var e=this.x-r.x,t=this.y-r.y,i=this.z-r.z;return e*e+t*t+i*i},distanceToManhattan:function(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)+Math.abs(this.z-r.z)},setFromSpherical:function(r){var e=Math.sin(r.phi)*r.radius;return this.x=e*Math.sin(r.theta),this.y=Math.cos(r.phi)*r.radius,this.z=e*Math.cos(r.theta),this},setFromCylindrical:function(r){return this.x=r.radius*Math.sin(r.theta),this.y=r.y,this.z=r.radius*Math.cos(r.theta),this},setFromMatrixPosition:function(r){return this.setFromMatrixColumn(r,3)},setFromMatrixScale:function(r){var e=this.setFromMatrixColumn(r,0).length(),t=this.setFromMatrixColumn(r,1).length(),i=this.setFromMatrixColumn(r,2).length();return this.x=e,this.y=t,this.z=i,this},setFromMatrixColumn:function(r,e){if(typeof r=="number"){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var t=r;r=e,e=t}return this.fromArray(r.elements,e*4)},equals:function(r){return r.x===this.x&&r.y===this.y&&r.z===this.z},fromArray:function(r,e){return e===void 0&&(e=0),this.x=r[e],this.y=r[e+1],this.z=r[e+2],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.x,r[e+1]=this.y,r[e+2]=this.z,r},fromAttribute:function(r,e,t){return t!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromAttribute()."),this.x=r.getX(e),this.y=r.getY(e),this.z=r.getZ(e),this}};qt.prototype={constructor:qt,isMatrix4:!0,set:function(r,e,t,i,n,a,o,s,l,u,c,f,h,p,d,g){var m=this.elements;return m[0]=r,m[4]=e,m[8]=t,m[12]=i,m[1]=n,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=f,m[3]=h,m[7]=p,m[11]=d,m[15]=g,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 qt().fromArray(this.elements)},copy:function(r){return this.elements.set(r.elements),this},copyPosition:function(r){var e=this.elements,t=r.elements;return e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(r,e,t){return r.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),t.setFromMatrixColumn(this,2),this},makeBasis:function(r,e,t){return this.set(r.x,e.x,t.x,0,r.y,e.y,t.y,0,r.z,e.z,t.z,0,0,0,0,1),this},extractRotation:function(){var r;return function(t){r===void 0&&(r=new oe);var i=this.elements,n=t.elements,a=1/r.setFromMatrixColumn(t,0).length(),o=1/r.setFromMatrixColumn(t,1).length(),s=1/r.setFromMatrixColumn(t,2).length();return i[0]=n[0]*a,i[1]=n[1]*a,i[2]=n[2]*a,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*s,i[9]=n[9]*s,i[10]=n[10]*s,this}}(),makeRotationFromEuler:function(r){(r&&r.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,t=r.x,i=r.y,n=r.z,a=Math.cos(t),o=Math.sin(t),s=Math.cos(i),l=Math.sin(i),u=Math.cos(n),c=Math.sin(n);if(r.order==="XYZ"){var f=a*u,h=a*c,p=o*u,d=o*c;e[0]=s*u,e[4]=-s*c,e[8]=l,e[1]=h+p*l,e[5]=f-d*l,e[9]=-o*s,e[2]=d-f*l,e[6]=p+h*l,e[10]=a*s}else if(r.order==="YXZ"){var g=s*u,m=s*c,v=l*u,_=l*c;e[0]=g+_*o,e[4]=v*o-m,e[8]=a*l,e[1]=a*c,e[5]=a*u,e[9]=-o,e[2]=m*o-v,e[6]=_+g*o,e[10]=a*s}else if(r.order==="ZXY"){var g=s*u,m=s*c,v=l*u,_=l*c;e[0]=g-_*o,e[4]=-a*c,e[8]=v+m*o,e[1]=m+v*o,e[5]=a*u,e[9]=_-g*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if(r.order==="ZYX"){var f=a*u,h=a*c,p=o*u,d=o*c;e[0]=s*u,e[4]=p*l-h,e[8]=f*l+d,e[1]=s*c,e[5]=d*l+f,e[9]=h*l-p,e[2]=-l,e[6]=o*s,e[10]=a*s}else if(r.order==="YZX"){var y=a*s,x=a*l,M=o*s,S=o*l;e[0]=s*u,e[4]=S-y*c,e[8]=M*c+x,e[1]=c,e[5]=a*u,e[9]=-o*u,e[2]=-l*u,e[6]=x*c+M,e[10]=y-S*c}else if(r.order==="XZY"){var y=a*s,x=a*l,M=o*s,S=o*l;e[0]=s*u,e[4]=-c,e[8]=l*u,e[1]=y*c+S,e[5]=a*u,e[9]=x*c-M,e[2]=M*c-x,e[6]=o*u,e[10]=S*c+y}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(r){var e=this.elements,t=r.x,i=r.y,n=r.z,a=r.w,o=t+t,s=i+i,l=n+n,u=t*o,c=t*s,f=t*l,h=i*s,p=i*l,d=n*l,g=a*o,m=a*s,v=a*l;return e[0]=1-(h+d),e[4]=c-v,e[8]=f+m,e[1]=c+v,e[5]=1-(u+d),e[9]=p-g,e[2]=f-m,e[6]=p+g,e[10]=1-(u+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var r,e,t;return function(n,a,o){r===void 0&&(r=new oe,e=new oe,t=new oe);var s=this.elements;return t.subVectors(n,a).normalize(),t.lengthSq()===0&&(t.z=1),r.crossVectors(o,t).normalize(),r.lengthSq()===0&&(t.z+=1e-4,r.crossVectors(o,t).normalize()),e.crossVectors(t,r),s[0]=r.x,s[4]=e.x,s[8]=t.x,s[1]=r.y,s[5]=e.y,s[9]=t.y,s[2]=r.z,s[6]=e.z,s[10]=t.z,this}}(),multiply:function(r,e){return e!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(r,e)):this.multiplyMatrices(this,r)},premultiply:function(r){return this.multiplyMatrices(r,this)},multiplyMatrices:function(r,e){var t=r.elements,i=e.elements,n=this.elements,a=t[0],o=t[4],s=t[8],l=t[12],u=t[1],c=t[5],f=t[9],h=t[13],p=t[2],d=t[6],g=t[10],m=t[14],v=t[3],_=t[7],y=t[11],x=t[15],M=i[0],S=i[4],w=i[8],T=i[12],C=i[1],b=i[5],E=i[9],I=i[13],R=i[2],A=i[6],D=i[10],U=i[14],B=i[3],z=i[7],k=i[11],G=i[15];return n[0]=a*M+o*C+s*R+l*B,n[4]=a*S+o*b+s*A+l*z,n[8]=a*w+o*E+s*D+l*k,n[12]=a*T+o*I+s*U+l*G,n[1]=u*M+c*C+f*R+h*B,n[5]=u*S+c*b+f*A+h*z,n[9]=u*w+c*E+f*D+h*k,n[13]=u*T+c*I+f*U+h*G,n[2]=p*M+d*C+g*R+m*B,n[6]=p*S+d*b+g*A+m*z,n[10]=p*w+d*E+g*D+m*k,n[14]=p*T+d*I+g*U+m*G,n[3]=v*M+_*C+y*R+x*B,n[7]=v*S+_*b+y*A+x*z,n[11]=v*w+_*E+y*D+x*k,n[15]=v*T+_*I+y*U+x*G,this},multiplyToArray:function(r,e,t){var i=this.elements;return this.multiplyMatrices(r,e),t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this},multiplyScalar:function(r){var e=this.elements;return e[0]*=r,e[4]*=r,e[8]*=r,e[12]*=r,e[1]*=r,e[5]*=r,e[9]*=r,e[13]*=r,e[2]*=r,e[6]*=r,e[10]*=r,e[14]*=r,e[3]*=r,e[7]*=r,e[11]*=r,e[15]*=r,this},applyToVector3Array:function(){var r;return function(t,i,n){r===void 0&&(r=new oe),i===void 0&&(i=0),n===void 0&&(n=t.length);for(var a=0,o=i;a<n;a+=3,o+=3)r.fromArray(t,o),r.applyMatrix4(this),r.toArray(t,o);return t}}(),applyToBufferAttribute:function(){var r;return function(t){r===void 0&&(r=new oe);for(var i=0,n=t.count;i<n;i++)r.x=t.getX(i),r.y=t.getY(i),r.z=t.getZ(i),r.applyMatrix4(this),t.setXYZ(i,r.x,r.y,r.z);return t}}(),determinant:function(){var r=this.elements,e=r[0],t=r[4],i=r[8],n=r[12],a=r[1],o=r[5],s=r[9],l=r[13],u=r[2],c=r[6],f=r[10],h=r[14],p=r[3],d=r[7],g=r[11],m=r[15];return p*(+n*s*c-i*l*c-n*o*f+t*l*f+i*o*h-t*s*h)+d*(+e*s*h-e*l*f+n*a*f-i*a*h+i*l*u-n*s*u)+g*(+e*l*c-e*o*h-n*a*c+t*a*h+n*o*u-t*l*u)+m*(-i*o*u-e*s*c+e*o*f+i*a*c-t*a*f+t*s*u)},transpose:function(){var r=this.elements,e;return e=r[1],r[1]=r[4],r[4]=e,e=r[2],r[2]=r[8],r[8]=e,e=r[6],r[6]=r[9],r[9]=e,e=r[3],r[3]=r[12],r[12]=e,e=r[7],r[7]=r[13],r[13]=e,e=r[11],r[11]=r[14],r[14]=e,this},setPosition:function(r){var e=this.elements;return e[12]=r.x,e[13]=r.y,e[14]=r.z,this},getInverse:function(r,e){var t=this.elements,i=r.elements,n=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=i[6],f=i[7],h=i[8],p=i[9],d=i[10],g=i[11],m=i[12],v=i[13],_=i[14],y=i[15],x=p*_*f-v*d*f+v*c*g-u*_*g-p*c*y+u*d*y,M=m*d*f-h*_*f-m*c*g+l*_*g+h*c*y-l*d*y,S=h*v*f-m*p*f+m*u*g-l*v*g-h*u*y+l*p*y,w=m*p*c-h*v*c-m*u*d+l*v*d+h*u*_-l*p*_,T=n*x+a*M+o*S+s*w;if(T===0){var C="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(C);return console.warn(C),this.identity()}var b=1/T;return t[0]=x*b,t[1]=(v*d*s-p*_*s-v*o*g+a*_*g+p*o*y-a*d*y)*b,t[2]=(u*_*s-v*c*s+v*o*f-a*_*f-u*o*y+a*c*y)*b,t[3]=(p*c*s-u*d*s-p*o*f+a*d*f+u*o*g-a*c*g)*b,t[4]=M*b,t[5]=(h*_*s-m*d*s+m*o*g-n*_*g-h*o*y+n*d*y)*b,t[6]=(m*c*s-l*_*s-m*o*f+n*_*f+l*o*y-n*c*y)*b,t[7]=(l*d*s-h*c*s+h*o*f-n*d*f-l*o*g+n*c*g)*b,t[8]=S*b,t[9]=(m*p*s-h*v*s-m*a*g+n*v*g+h*a*y-n*p*y)*b,t[10]=(l*v*s-m*u*s+m*a*f-n*v*f-l*a*y+n*u*y)*b,t[11]=(h*u*s-l*p*s-h*a*f+n*p*f+l*a*g-n*u*g)*b,t[12]=w*b,t[13]=(h*v*o-m*p*o+m*a*d-n*v*d-h*a*_+n*p*_)*b,t[14]=(m*u*o-l*v*o-m*a*c+n*v*c+l*a*_-n*u*_)*b,t[15]=(l*p*o-h*u*o+h*a*c-n*p*c-l*a*d+n*u*d)*b,this},scale:function(r){var e=this.elements,t=r.x,i=r.y,n=r.z;return e[0]*=t,e[4]*=i,e[8]*=n,e[1]*=t,e[5]*=i,e[9]*=n,e[2]*=t,e[6]*=i,e[10]*=n,e[3]*=t,e[7]*=i,e[11]*=n,this},getMaxScaleOnAxis:function(){var r=this.elements,e=r[0]*r[0]+r[1]*r[1]+r[2]*r[2],t=r[4]*r[4]+r[5]*r[5]+r[6]*r[6],i=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(e,t,i))},makeTranslation:function(r,e,t){return this.set(1,0,0,r,0,1,0,e,0,0,1,t,0,0,0,1),this},makeRotationX:function(r){var e=Math.cos(r),t=Math.sin(r);return this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(r){var e=Math.cos(r),t=Math.sin(r);return this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(r){var e=Math.cos(r),t=Math.sin(r);return this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(r,e){var t=Math.cos(e),i=Math.sin(e),n=1-t,a=r.x,o=r.y,s=r.z,l=n*a,u=n*o;return this.set(l*a+t,l*o-i*s,l*s+i*o,0,l*o+i*s,u*o+t,u*s-i*a,0,l*s-i*o,u*s+i*a,n*s*s+t,0,0,0,0,1),this},makeScale:function(r,e,t){return this.set(r,0,0,0,0,e,0,0,0,0,t,0,0,0,0,1),this},makeShear:function(r,e,t){return this.set(1,e,t,0,r,1,t,0,r,e,1,0,0,0,0,1),this},compose:function(r,e,t){return this.makeRotationFromQuaternion(e),this.scale(t),this.setPosition(r),this},decompose:function(){var r,e;return function(i,n,a){r===void 0&&(r=new oe,e=new qt);var o=this.elements,s=r.set(o[0],o[1],o[2]).length(),l=r.set(o[4],o[5],o[6]).length(),u=r.set(o[8],o[9],o[10]).length(),c=this.determinant();c<0&&(s=-s),i.x=o[12],i.y=o[13],i.z=o[14],e.elements.set(this.elements);var f=1/s,h=1/l,p=1/u;return e.elements[0]*=f,e.elements[1]*=f,e.elements[2]*=f,e.elements[4]*=h,e.elements[5]*=h,e.elements[6]*=h,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,n.setFromRotationMatrix(e),a.x=s,a.y=l,a.z=u,this}}(),makeFrustum:function(r,e,t,i,n,a){var o=this.elements,s=2*n/(e-r),l=2*n/(i-t),u=(e+r)/(e-r),c=(i+t)/(i-t),f=-(a+n)/(a-n),h=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=h,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(r,e,t,i){var n=t*Math.tan(cr.DEG2RAD*r*.5),a=-n,o=a*e,s=n*e;return this.makeFrustum(o,s,a,n,t,i)},makeOrthographic:function(r,e,t,i,n,a){var o=this.elements,s=1/(e-r),l=1/(t-i),u=1/(a-n),c=(e+r)*s,f=(t+i)*l,h=(a+n)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-f,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-h,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(r){for(var e=this.elements,t=r.elements,i=0;i<16;i++)if(e[i]!==t[i])return!1;return!0},fromArray:function(r,e){e===void 0&&(e=0);for(var t=0;t<16;t++)this.elements[t]=r[t+e];return this},toArray:function(r,e){r===void 0&&(r=[]),e===void 0&&(e=0);var t=this.elements;return r[e]=t[0],r[e+1]=t[1],r[e+2]=t[2],r[e+3]=t[3],r[e+4]=t[4],r[e+5]=t[5],r[e+6]=t[6],r[e+7]=t[7],r[e+8]=t[8],r[e+9]=t[9],r[e+10]=t[10],r[e+11]=t[11],r[e+12]=t[12],r[e+13]=t[13],r[e+14]=t[14],r[e+15]=t[15],r}};Sh.prototype=Object.create(ai.prototype);Sh.prototype.constructor=Sh;Sh.prototype.isCubeTexture=!0;Object.defineProperty(Sh.prototype,"images",{get:function(){return this.image},set:function(r){this.image=r}});One=new ai,zne=new Sh;Die=[],Iie=[];Hne.prototype.setValue=function(r,e){for(var t=this.seq,i=0,n=t.length;i!==n;++i){var a=t[i];a.setValue(r,e[a.id])}};oF=/([\w\d_]+)(\])?(\[|\.)?/g;Mh.prototype.setValue=function(r,e,t){var i=this.map[e];i!==void 0&&i.setValue(r,t,this.renderer)};Mh.prototype.set=function(r,e,t){var i=this.map[t];i!==void 0&&i.setValue(r,e[t],this.renderer)};Mh.prototype.setOptional=function(r,e,t){var i=e[t];i!==void 0&&this.setValue(r,t,i)};Mh.upload=function(r,e,t,i){for(var n=0,a=e.length;n!==a;++n){var o=e[n],s=t[o.id];s.needsUpdate!==!1&&o.setValue(r,s.value,i)}};Mh.seqWithValue=function(r,e){for(var t=[],i=0,n=r.length;i!==n;++i){var a=r[i];a.id in e&&t.push(a)}return t};io={merge:function(r){for(var e={},t=0;t<r.length;t++){var i=this.clone(r[t]);for(var n in i)e[n]=i[n]}return e},clone:function(r){var e={};for(var t in r){e[t]={};for(var i in r[t]){var n=r[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture)?e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}},RAe=`#ifdef USE_ALPHAMAP
  23. diffuseColor.a *= texture2D( alphaMap, vUv ).g;
  24. #endif
  25. `,LAe=`#ifdef USE_ALPHAMAP
  26. uniform sampler2D alphaMap;
  27. #endif
  28. `,PAe=`#ifdef ALPHATEST
  29. if ( diffuseColor.a < ALPHATEST ) discard;
  30. #endif
  31. `,DAe=`#ifdef USE_AOMAP
  32. float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
  33. reflectedLight.indirectDiffuse *= ambientOcclusion;
  34. #if defined( USE_ENVMAP ) && defined( PHYSICAL )
  35. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  36. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
  37. #endif
  38. #endif
  39. `,IAe=`#ifdef USE_AOMAP
  40. uniform sampler2D aoMap;
  41. uniform float aoMapIntensity;
  42. #endif`,NAe=`
  43. vec3 transformed = vec3( position );
  44. `,UAe=`
  45. vec3 objectNormal = vec3( normal );
  46. `,OAe=`float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  47. if( decayExponent > 0.0 ) {
  48. #if defined ( PHYSICALLY_CORRECT_LIGHTS )
  49. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  50. float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  51. return distanceFalloff * maxDistanceCutoffFactor;
  52. #else
  53. return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
  54. #endif
  55. }
  56. return 1.0;
  57. }
  58. vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
  59. return RECIPROCAL_PI * diffuseColor;
  60. }
  61. vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
  62. float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
  63. return ( 1.0 - specularColor ) * fresnel + specularColor;
  64. }
  65. float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
  66. float a2 = pow2( alpha );
  67. float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  68. float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  69. return 1.0 / ( gl * gv );
  70. }
  71. float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  72. float a2 = pow2( alpha );
  73. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  74. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  75. return 0.5 / max( gv + gl, EPSILON );
  76. }
  77. float D_GGX( const in float alpha, const in float dotNH ) {
  78. float a2 = pow2( alpha );
  79. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  80. return RECIPROCAL_PI * a2 / pow2( denom );
  81. }
  82. vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
  83. float alpha = pow2( roughness );
  84. vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
  85. float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );
  86. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  87. float dotNH = saturate( dot( geometry.normal, halfDir ) );
  88. float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
  89. vec3 F = F_Schlick( specularColor, dotLH );
  90. float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  91. float D = D_GGX( alpha, dotNH );
  92. return F * ( G * D );
  93. }
  94. vec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {
  95. const float LUT_SIZE = 64.0;
  96. const float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;
  97. const float LUT_BIAS = 0.5/LUT_SIZE;
  98. vec3 N = geometry.normal;
  99. vec3 V = geometry.viewDir;
  100. vec3 P = geometry.position;
  101. float theta = acos( dot( N, V ) );
  102. vec2 uv = vec2(
  103. sqrt( saturate( roughness ) ),
  104. saturate( theta / ( 0.5 * PI ) ) );
  105. uv = uv * LUT_SCALE + LUT_BIAS;
  106. return uv;
  107. }
  108. void clipQuadToHorizon( inout vec3 L[5], out int n ) {
  109. int config = 0;
  110. if ( L[0].z > 0.0 ) config += 1;
  111. if ( L[1].z > 0.0 ) config += 2;
  112. if ( L[2].z > 0.0 ) config += 4;
  113. if ( L[3].z > 0.0 ) config += 8;
  114. n = 0;
  115. if ( config == 0 ) {
  116. } else if ( config == 1 ) {
  117. n = 3;
  118. L[1] = -L[1].z * L[0] + L[0].z * L[1];
  119. L[2] = -L[3].z * L[0] + L[0].z * L[3];
  120. } else if ( config == 2 ) {
  121. n = 3;
  122. L[0] = -L[0].z * L[1] + L[1].z * L[0];
  123. L[2] = -L[2].z * L[1] + L[1].z * L[2];
  124. } else if ( config == 3 ) {
  125. n = 4;
  126. L[2] = -L[2].z * L[1] + L[1].z * L[2];
  127. L[3] = -L[3].z * L[0] + L[0].z * L[3];
  128. } else if ( config == 4 ) {
  129. n = 3;
  130. L[0] = -L[3].z * L[2] + L[2].z * L[3];
  131. L[1] = -L[1].z * L[2] + L[2].z * L[1];
  132. } else if ( config == 5 ) {
  133. n = 0;
  134. } else if ( config == 6 ) {
  135. n = 4;
  136. L[0] = -L[0].z * L[1] + L[1].z * L[0];
  137. L[3] = -L[3].z * L[2] + L[2].z * L[3];
  138. } else if ( config == 7 ) {
  139. n = 5;
  140. L[4] = -L[3].z * L[0] + L[0].z * L[3];
  141. L[3] = -L[3].z * L[2] + L[2].z * L[3];
  142. } else if ( config == 8 ) {
  143. n = 3;
  144. L[0] = -L[0].z * L[3] + L[3].z * L[0];
  145. L[1] = -L[2].z * L[3] + L[3].z * L[2];
  146. L[2] = L[3];
  147. } else if ( config == 9 ) {
  148. n = 4;
  149. L[1] = -L[1].z * L[0] + L[0].z * L[1];
  150. L[2] = -L[2].z * L[3] + L[3].z * L[2];
  151. } else if ( config == 10 ) {
  152. n = 0;
  153. } else if ( config == 11 ) {
  154. n = 5;
  155. L[4] = L[3];
  156. L[3] = -L[2].z * L[3] + L[3].z * L[2];
  157. L[2] = -L[2].z * L[1] + L[1].z * L[2];
  158. } else if ( config == 12 ) {
  159. n = 4;
  160. L[1] = -L[1].z * L[2] + L[2].z * L[1];
  161. L[0] = -L[0].z * L[3] + L[3].z * L[0];
  162. } else if ( config == 13 ) {
  163. n = 5;
  164. L[4] = L[3];
  165. L[3] = L[2];
  166. L[2] = -L[1].z * L[2] + L[2].z * L[1];
  167. L[1] = -L[1].z * L[0] + L[0].z * L[1];
  168. } else if ( config == 14 ) {
  169. n = 5;
  170. L[4] = -L[0].z * L[3] + L[3].z * L[0];
  171. L[0] = -L[0].z * L[1] + L[1].z * L[0];
  172. } else if ( config == 15 ) {
  173. n = 4;
  174. }
  175. if ( n == 3 )
  176. L[3] = L[0];
  177. if ( n == 4 )
  178. L[4] = L[0];
  179. }
  180. float integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {
  181. float cosTheta = dot( v1, v2 );
  182. float theta = acos( cosTheta );
  183. float res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );
  184. return res;
  185. }
  186. void initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {
  187. rectPoints[0] = pos - halfWidth - halfHeight;
  188. rectPoints[1] = pos + halfWidth - halfHeight;
  189. rectPoints[2] = pos + halfWidth + halfHeight;
  190. rectPoints[3] = pos - halfWidth + halfHeight;
  191. }
  192. vec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {
  193. vec3 N = geometry.normal;
  194. vec3 V = geometry.viewDir;
  195. vec3 P = geometry.position;
  196. vec3 T1, T2;
  197. T1 = normalize(V - N * dot( V, N ));
  198. T2 = - cross( N, T1 );
  199. mat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );
  200. vec3 clippedRect[5];
  201. clippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );
  202. clippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );
  203. clippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );
  204. clippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );
  205. int n;
  206. clipQuadToHorizon(clippedRect, n);
  207. if ( n == 0 )
  208. return vec3( 0, 0, 0 );
  209. clippedRect[0] = normalize( clippedRect[0] );
  210. clippedRect[1] = normalize( clippedRect[1] );
  211. clippedRect[2] = normalize( clippedRect[2] );
  212. clippedRect[3] = normalize( clippedRect[3] );
  213. clippedRect[4] = normalize( clippedRect[4] );
  214. float sum = 0.0;
  215. sum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );
  216. sum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );
  217. sum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );
  218. if (n >= 4)
  219. sum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );
  220. if (n == 5)
  221. sum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );
  222. sum = max( 0.0, sum );
  223. vec3 Lo_i = vec3( sum, sum, sum );
  224. return Lo_i;
  225. }
  226. vec3 Rect_Area_Light_Specular_Reflectance(
  227. const in GeometricContext geometry,
  228. const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,
  229. const in float roughness,
  230. const in sampler2D ltcMat, const in sampler2D ltcMag ) {
  231. vec3 rectPoints[4];
  232. initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );
  233. vec2 uv = ltcTextureCoords( geometry, roughness );
  234. vec4 brdfLtcApproxParams, t;
  235. brdfLtcApproxParams = texture2D( ltcMat, uv );
  236. t = texture2D( ltcMat, uv );
  237. float brdfLtcScalar = texture2D( ltcMag, uv ).a;
  238. mat3 brdfLtcApproxMat = mat3(
  239. vec3( 1, 0, t.y ),
  240. vec3( 0, t.z, 0 ),
  241. vec3( t.w, 0, t.x )
  242. );
  243. vec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );
  244. specularReflectance *= brdfLtcScalar;
  245. return specularReflectance;
  246. }
  247. vec3 Rect_Area_Light_Diffuse_Reflectance(
  248. const in GeometricContext geometry,
  249. const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {
  250. vec3 rectPoints[4];
  251. initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );
  252. mat3 diffuseBrdfMat = mat3(1);
  253. vec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );
  254. return diffuseReflectance;
  255. }
  256. vec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
  257. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  258. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  259. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  260. vec4 r = roughness * c0 + c1;
  261. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  262. vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
  263. return specularColor * AB.x + AB.y;
  264. }
  265. float G_BlinnPhong_Implicit( ) {
  266. return 0.25;
  267. }
  268. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  269. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  270. }
  271. vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
  272. vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
  273. float dotNH = saturate( dot( geometry.normal, halfDir ) );
  274. float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
  275. vec3 F = F_Schlick( specularColor, dotLH );
  276. float G = G_BlinnPhong_Implicit( );
  277. float D = D_BlinnPhong( shininess, dotNH );
  278. return F * ( G * D );
  279. }
  280. float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
  281. return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
  282. }
  283. float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
  284. return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
  285. }
  286. `,zAe=`#ifdef USE_BUMPMAP
  287. uniform sampler2D bumpMap;
  288. uniform float bumpScale;
  289. vec2 dHdxy_fwd() {
  290. vec2 dSTdx = dFdx( vUv );
  291. vec2 dSTdy = dFdy( vUv );
  292. float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
  293. float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
  294. float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
  295. return vec2( dBx, dBy );
  296. }
  297. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
  298. vec3 vSigmaX = dFdx( surf_pos );
  299. vec3 vSigmaY = dFdy( surf_pos );
  300. vec3 vN = surf_norm;
  301. vec3 R1 = cross( vSigmaY, vN );
  302. vec3 R2 = cross( vN, vSigmaX );
  303. float fDet = dot( vSigmaX, R1 );
  304. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  305. return normalize( abs( fDet ) * surf_norm - vGrad );
  306. }
  307. #endif
  308. `,FAe=`#if NUM_CLIPPING_PLANES > 0
  309. for ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {
  310. vec4 plane = clippingPlanes[ i ];
  311. if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;
  312. }
  313. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  314. bool clipped = true;
  315. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {
  316. vec4 plane = clippingPlanes[ i ];
  317. clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;
  318. }
  319. if ( clipped ) discard;
  320. #endif
  321. #endif
  322. `,BAe=`#if NUM_CLIPPING_PLANES > 0
  323. #if ! defined( PHYSICAL ) && ! defined( PHONG )
  324. varying vec3 vViewPosition;
  325. #endif
  326. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  327. #endif
  328. `,kAe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )
  329. varying vec3 vViewPosition;
  330. #endif
  331. `,VAe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )
  332. vViewPosition = - mvPosition.xyz;
  333. #endif
  334. `,GAe=`#ifdef USE_COLOR
  335. diffuseColor.rgb *= vColor;
  336. #endif`,HAe=`#ifdef USE_COLOR
  337. varying vec3 vColor;
  338. #endif
  339. `,WAe=`#ifdef USE_COLOR
  340. varying vec3 vColor;
  341. #endif`,XAe=`#ifdef USE_COLOR
  342. vColor.xyz = color.xyz;
  343. #endif`,YAe=`#define PI 3.14159265359
  344. #define PI2 6.28318530718
  345. #define PI_HALF 1.5707963267949
  346. #define RECIPROCAL_PI 0.31830988618
  347. #define RECIPROCAL_PI2 0.15915494
  348. #define LOG2 1.442695
  349. #define EPSILON 1e-6
  350. #define saturate(a) clamp( a, 0.0, 1.0 )
  351. #define whiteCompliment(a) ( 1.0 - saturate( a ) )
  352. float pow2( const in float x ) { return x*x; }
  353. float pow3( const in float x ) { return x*x*x; }
  354. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  355. float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
  356. highp float rand( const in vec2 uv ) {
  357. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  358. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  359. return fract(sin(sn) * c);
  360. }
  361. struct IncidentLight {
  362. vec3 color;
  363. vec3 direction;
  364. bool visible;
  365. };
  366. struct ReflectedLight {
  367. vec3 directDiffuse;
  368. vec3 directSpecular;
  369. vec3 indirectDiffuse;
  370. vec3 indirectSpecular;
  371. };
  372. struct GeometricContext {
  373. vec3 position;
  374. vec3 normal;
  375. vec3 viewDir;
  376. };
  377. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  378. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  379. }
  380. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  381. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  382. }
  383. vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  384. float distance = dot( planeNormal, point - pointOnPlane );
  385. return - distance * planeNormal + point;
  386. }
  387. float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  388. return sign( dot( point - pointOnPlane, planeNormal ) );
  389. }
  390. vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
  391. return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
  392. }
  393. mat3 transpose( const in mat3 v ) {
  394. mat3 tmp;
  395. tmp[0] = vec3(v[0].x, v[1].x, v[2].x);
  396. tmp[1] = vec3(v[0].y, v[1].y, v[2].y);
  397. tmp[2] = vec3(v[0].z, v[1].z, v[2].z);
  398. return tmp;
  399. }
  400. `,qAe=`#ifdef ENVMAP_TYPE_CUBE_UV
  401. #define cubeUV_textureSize (1024.0)
  402. int getFaceFromDirection(vec3 direction) {
  403. vec3 absDirection = abs(direction);
  404. int face = -1;
  405. if( absDirection.x > absDirection.z ) {
  406. if(absDirection.x > absDirection.y )
  407. face = direction.x > 0.0 ? 0 : 3;
  408. else
  409. face = direction.y > 0.0 ? 1 : 4;
  410. }
  411. else {
  412. if(absDirection.z > absDirection.y )
  413. face = direction.z > 0.0 ? 2 : 5;
  414. else
  415. face = direction.y > 0.0 ? 1 : 4;
  416. }
  417. return face;
  418. }
  419. #define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)
  420. #define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))
  421. vec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {
  422. float scale = exp2(cubeUV_maxLods1 - roughnessLevel);
  423. float dxRoughness = dFdx(roughness);
  424. float dyRoughness = dFdy(roughness);
  425. vec3 dx = dFdx( vec * scale * dxRoughness );
  426. vec3 dy = dFdy( vec * scale * dyRoughness );
  427. float d = max( dot( dx, dx ), dot( dy, dy ) );
  428. d = clamp(d, 1.0, cubeUV_rangeClamp);
  429. float mipLevel = 0.5 * log2(d);
  430. return vec2(floor(mipLevel), fract(mipLevel));
  431. }
  432. #define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)
  433. #define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)
  434. vec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {
  435. mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;
  436. float a = 16.0 * cubeUV_rcpTextureSize;
  437. vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );
  438. vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;
  439. float powScale = exp2_packed.x * exp2_packed.y;
  440. float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;
  441. float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;
  442. bool bRes = mipLevel == 0.0;
  443. scale = bRes && (scale < a) ? a : scale;
  444. vec3 r;
  445. vec2 offset;
  446. int face = getFaceFromDirection(direction);
  447. float rcpPowScale = 1.0 / powScale;
  448. if( face == 0) {
  449. r = vec3(direction.x, -direction.z, direction.y);
  450. offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);
  451. offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
  452. }
  453. else if( face == 1) {
  454. r = vec3(direction.y, direction.x, direction.z);
  455. offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);
  456. offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
  457. }
  458. else if( face == 2) {
  459. r = vec3(direction.z, direction.x, direction.y);
  460. offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);
  461. offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
  462. }
  463. else if( face == 3) {
  464. r = vec3(direction.x, direction.z, direction.y);
  465. offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);
  466. offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
  467. }
  468. else if( face == 4) {
  469. r = vec3(direction.y, direction.x, -direction.z);
  470. offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);
  471. offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
  472. }
  473. else {
  474. r = vec3(direction.z, -direction.x, direction.y);
  475. offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);
  476. offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
  477. }
  478. r = normalize(r);
  479. float texelOffset = 0.5 * cubeUV_rcpTextureSize;
  480. vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;
  481. vec2 base = offset + vec2( texelOffset );
  482. return base + s * ( scale - 2.0 * texelOffset );
  483. }
  484. #define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)
  485. vec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {
  486. float roughnessVal = roughness* cubeUV_maxLods3;
  487. float r1 = floor(roughnessVal);
  488. float r2 = r1 + 1.0;
  489. float t = fract(roughnessVal);
  490. vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);
  491. float s = mipInfo.y;
  492. float level0 = mipInfo.x;
  493. float level1 = level0 + 1.0;
  494. level1 = level1 > 5.0 ? 5.0 : level1;
  495. level0 += min( floor( s + 0.5 ), 5.0 );
  496. vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);
  497. vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));
  498. vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);
  499. vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));
  500. vec4 result = mix(color10, color20, t);
  501. return vec4(result.rgb, 1.0);
  502. }
  503. #endif
  504. `,ZAe=`#ifdef FLIP_SIDED
  505. objectNormal = -objectNormal;
  506. #endif
  507. vec3 transformedNormal = normalMatrix * objectNormal;
  508. `,jAe=`#ifdef USE_DISPLACEMENTMAP
  509. uniform sampler2D displacementMap;
  510. uniform float displacementScale;
  511. uniform float displacementBias;
  512. #endif
  513. `,KAe=`#ifdef USE_DISPLACEMENTMAP
  514. transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );
  515. #endif
  516. `,JAe=`#ifdef USE_EMISSIVEMAP
  517. vec4 emissiveColor = texture2D( emissiveMap, vUv );
  518. emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
  519. totalEmissiveRadiance *= emissiveColor.rgb;
  520. #endif
  521. `,$Ae=`#ifdef USE_EMISSIVEMAP
  522. uniform sampler2D emissiveMap;
  523. #endif
  524. `,QAe=` gl_FragColor = linearToOutputTexel( gl_FragColor );
  525. `,eCe=`
  526. vec4 LinearToLinear( in vec4 value ) {
  527. return value;
  528. }
  529. vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
  530. return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );
  531. }
  532. vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
  533. return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );
  534. }
  535. vec4 sRGBToLinear( in vec4 value ) {
  536. return 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.w );
  537. }
  538. vec4 LinearTosRGB( in vec4 value ) {
  539. return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );
  540. }
  541. vec4 RGBEToLinear( in vec4 value ) {
  542. return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
  543. }
  544. vec4 LinearToRGBE( in vec4 value ) {
  545. float maxComponent = max( max( value.r, value.g ), value.b );
  546. float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
  547. return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
  548. }
  549. vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
  550. return vec4( value.xyz * value.w * maxRange, 1.0 );
  551. }
  552. vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
  553. float maxRGB = max( value.x, max( value.g, value.b ) );
  554. float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
  555. M = ceil( M * 255.0 ) / 255.0;
  556. return vec4( value.rgb / ( M * maxRange ), M );
  557. }
  558. vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
  559. return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
  560. }
  561. vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
  562. float maxRGB = max( value.x, max( value.g, value.b ) );
  563. float D = max( maxRange / maxRGB, 1.0 );
  564. D = min( floor( D ) / 255.0, 1.0 );
  565. return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
  566. }
  567. const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
  568. vec4 LinearToLogLuv( in vec4 value ) {
  569. vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;
  570. Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));
  571. vec4 vResult;
  572. vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
  573. float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
  574. vResult.w = fract(Le);
  575. vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;
  576. return vResult;
  577. }
  578. const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
  579. vec4 LogLuvToLinear( in vec4 value ) {
  580. float Le = value.z * 255.0 + value.w;
  581. vec3 Xp_Y_XYZp;
  582. Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);
  583. Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
  584. Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
  585. vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;
  586. return vec4( max(vRGB, 0.0), 1.0 );
  587. }
  588. `,tCe=`#ifdef USE_ENVMAP
  589. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
  590. vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );
  591. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  592. #ifdef ENVMAP_MODE_REFLECTION
  593. vec3 reflectVec = reflect( cameraToVertex, worldNormal );
  594. #else
  595. vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );
  596. #endif
  597. #else
  598. vec3 reflectVec = vReflect;
  599. #endif
  600. #ifdef ENVMAP_TYPE_CUBE
  601. vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  602. #elif defined( ENVMAP_TYPE_EQUIREC )
  603. vec2 sampleUV;
  604. sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
  605. sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
  606. vec4 envColor = texture2D( envMap, sampleUV );
  607. #elif defined( ENVMAP_TYPE_SPHERE )
  608. vec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );
  609. vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
  610. #else
  611. vec4 envColor = vec4( 0.0 );
  612. #endif
  613. envColor = envMapTexelToLinear( envColor );
  614. #ifdef ENVMAP_BLENDING_MULTIPLY
  615. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  616. #elif defined( ENVMAP_BLENDING_MIX )
  617. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  618. #elif defined( ENVMAP_BLENDING_ADD )
  619. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  620. #endif
  621. #endif
  622. `,rCe=`#if defined( USE_ENVMAP ) || defined( PHYSICAL )
  623. uniform float reflectivity;
  624. uniform float envMapIntensity;
  625. #endif
  626. #ifdef USE_ENVMAP
  627. #if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )
  628. varying vec3 vWorldPosition;
  629. #endif
  630. #ifdef ENVMAP_TYPE_CUBE
  631. uniform samplerCube envMap;
  632. #else
  633. uniform sampler2D envMap;
  634. #endif
  635. uniform float flipEnvMap;
  636. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )
  637. uniform float refractionRatio;
  638. #else
  639. varying vec3 vReflect;
  640. #endif
  641. #endif
  642. `,iCe=`#ifdef USE_ENVMAP
  643. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
  644. varying vec3 vWorldPosition;
  645. #else
  646. varying vec3 vReflect;
  647. uniform float refractionRatio;
  648. #endif
  649. #endif
  650. `,nCe=`#ifdef USE_ENVMAP
  651. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
  652. vWorldPosition = worldPosition.xyz;
  653. #else
  654. vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  655. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  656. #ifdef ENVMAP_MODE_REFLECTION
  657. vReflect = reflect( cameraToVertex, worldNormal );
  658. #else
  659. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  660. #endif
  661. #endif
  662. #endif
  663. `,aCe=`#ifdef USE_FOG
  664. #ifdef USE_LOGDEPTHBUF_EXT
  665. float depth = gl_FragDepthEXT / gl_FragCoord.w;
  666. #else
  667. float depth = gl_FragCoord.z / gl_FragCoord.w;
  668. #endif
  669. #ifdef FOG_EXP2
  670. float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );
  671. #else
  672. float fogFactor = smoothstep( fogNear, fogFar, depth );
  673. #endif
  674. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  675. #endif
  676. `,oCe=`#ifdef USE_FOG
  677. uniform vec3 fogColor;
  678. #ifdef FOG_EXP2
  679. uniform float fogDensity;
  680. #else
  681. uniform float fogNear;
  682. uniform float fogFar;
  683. #endif
  684. #endif`,sCe=`#ifdef TOON
  685. uniform sampler2D gradientMap;
  686. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  687. float dotNL = dot( normal, lightDirection );
  688. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  689. #ifdef USE_GRADIENTMAP
  690. return texture2D( gradientMap, coord ).rgb;
  691. #else
  692. return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
  693. #endif
  694. }
  695. #endif
  696. `,lCe=`#ifdef USE_LIGHTMAP
  697. reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
  698. #endif
  699. `,uCe=`#ifdef USE_LIGHTMAP
  700. uniform sampler2D lightMap;
  701. uniform float lightMapIntensity;
  702. #endif`,cCe=`vec3 diffuse = vec3( 1.0 );
  703. GeometricContext geometry;
  704. geometry.position = mvPosition.xyz;
  705. geometry.normal = normalize( transformedNormal );
  706. geometry.viewDir = normalize( -mvPosition.xyz );
  707. GeometricContext backGeometry;
  708. backGeometry.position = geometry.position;
  709. backGeometry.normal = -geometry.normal;
  710. backGeometry.viewDir = geometry.viewDir;
  711. vLightFront = vec3( 0.0 );
  712. #ifdef DOUBLE_SIDED
  713. vLightBack = vec3( 0.0 );
  714. #endif
  715. IncidentLight directLight;
  716. float dotNL;
  717. vec3 directLightColor_Diffuse;
  718. #if NUM_POINT_LIGHTS > 0
  719. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  720. getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
  721. dotNL = dot( geometry.normal, directLight.direction );
  722. directLightColor_Diffuse = PI * directLight.color;
  723. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  724. #ifdef DOUBLE_SIDED
  725. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  726. #endif
  727. }
  728. #endif
  729. #if NUM_SPOT_LIGHTS > 0
  730. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  731. getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
  732. dotNL = dot( geometry.normal, directLight.direction );
  733. directLightColor_Diffuse = PI * directLight.color;
  734. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  735. #ifdef DOUBLE_SIDED
  736. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  737. #endif
  738. }
  739. #endif
  740. #if NUM_RECT_AREA_LIGHTS > 0
  741. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  742. }
  743. #endif
  744. #if NUM_DIR_LIGHTS > 0
  745. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  746. getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
  747. dotNL = dot( geometry.normal, directLight.direction );
  748. directLightColor_Diffuse = PI * directLight.color;
  749. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  750. #ifdef DOUBLE_SIDED
  751. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  752. #endif
  753. }
  754. #endif
  755. #if NUM_HEMI_LIGHTS > 0
  756. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  757. vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
  758. #ifdef DOUBLE_SIDED
  759. vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
  760. #endif
  761. }
  762. #endif
  763. `,fCe=`uniform vec3 ambientLightColor;
  764. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  765. vec3 irradiance = ambientLightColor;
  766. #ifndef PHYSICALLY_CORRECT_LIGHTS
  767. irradiance *= PI;
  768. #endif
  769. return irradiance;
  770. }
  771. #if NUM_DIR_LIGHTS > 0
  772. struct DirectionalLight {
  773. vec3 direction;
  774. vec3 color;
  775. int shadow;
  776. float shadowBias;
  777. float shadowRadius;
  778. vec2 shadowMapSize;
  779. };
  780. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  781. void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  782. directLight.color = directionalLight.color;
  783. directLight.direction = directionalLight.direction;
  784. directLight.visible = true;
  785. }
  786. #endif
  787. #if NUM_POINT_LIGHTS > 0
  788. struct PointLight {
  789. vec3 position;
  790. vec3 color;
  791. float distance;
  792. float decay;
  793. int shadow;
  794. float shadowBias;
  795. float shadowRadius;
  796. vec2 shadowMapSize;
  797. };
  798. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  799. void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  800. vec3 lVector = pointLight.position - geometry.position;
  801. directLight.direction = normalize( lVector );
  802. float lightDistance = length( lVector );
  803. directLight.color = pointLight.color;
  804. directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
  805. directLight.visible = ( directLight.color != vec3( 0.0 ) );
  806. }
  807. #endif
  808. #if NUM_SPOT_LIGHTS > 0
  809. struct SpotLight {
  810. vec3 position;
  811. vec3 direction;
  812. vec3 color;
  813. float distance;
  814. float decay;
  815. float coneCos;
  816. float penumbraCos;
  817. int shadow;
  818. float shadowBias;
  819. float shadowRadius;
  820. vec2 shadowMapSize;
  821. };
  822. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  823. void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  824. vec3 lVector = spotLight.position - geometry.position;
  825. directLight.direction = normalize( lVector );
  826. float lightDistance = length( lVector );
  827. float angleCos = dot( directLight.direction, spotLight.direction );
  828. if ( angleCos > spotLight.coneCos ) {
  829. float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  830. directLight.color = spotLight.color;
  831. directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
  832. directLight.visible = true;
  833. } else {
  834. directLight.color = vec3( 0.0 );
  835. directLight.visible = false;
  836. }
  837. }
  838. #endif
  839. #if NUM_RECT_AREA_LIGHTS > 0
  840. struct RectAreaLight {
  841. vec3 color;
  842. vec3 position;
  843. vec3 halfWidth;
  844. vec3 halfHeight;
  845. };
  846. uniform sampler2D ltcMat; uniform sampler2D ltcMag;
  847. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  848. #endif
  849. #if NUM_HEMI_LIGHTS > 0
  850. struct HemisphereLight {
  851. vec3 direction;
  852. vec3 skyColor;
  853. vec3 groundColor;
  854. };
  855. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  856. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
  857. float dotNL = dot( geometry.normal, hemiLight.direction );
  858. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  859. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  860. #ifndef PHYSICALLY_CORRECT_LIGHTS
  861. irradiance *= PI;
  862. #endif
  863. return irradiance;
  864. }
  865. #endif
  866. #if defined( USE_ENVMAP ) && defined( PHYSICAL )
  867. vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
  868. vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
  869. #ifdef ENVMAP_TYPE_CUBE
  870. vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
  871. #ifdef TEXTURE_LOD_EXT
  872. vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
  873. #else
  874. vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
  875. #endif
  876. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  877. #elif defined( ENVMAP_TYPE_CUBE_UV )
  878. vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
  879. vec4 envMapColor = textureCubeUV( queryVec, 1.0 );
  880. #else
  881. vec4 envMapColor = vec4( 0.0 );
  882. #endif
  883. return PI * envMapColor.rgb * envMapIntensity;
  884. }
  885. float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {
  886. float maxMIPLevelScalar = float( maxMIPLevel );
  887. float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );
  888. return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
  889. }
  890. vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {
  891. #ifdef ENVMAP_MODE_REFLECTION
  892. vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );
  893. #else
  894. vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );
  895. #endif
  896. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  897. float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );
  898. #ifdef ENVMAP_TYPE_CUBE
  899. vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
  900. #ifdef TEXTURE_LOD_EXT
  901. vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
  902. #else
  903. vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
  904. #endif
  905. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  906. #elif defined( ENVMAP_TYPE_CUBE_UV )
  907. vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
  908. vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));
  909. #elif defined( ENVMAP_TYPE_EQUIREC )
  910. vec2 sampleUV;
  911. sampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );
  912. sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
  913. #ifdef TEXTURE_LOD_EXT
  914. vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );
  915. #else
  916. vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );
  917. #endif
  918. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  919. #elif defined( ENVMAP_TYPE_SPHERE )
  920. vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );
  921. #ifdef TEXTURE_LOD_EXT
  922. vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
  923. #else
  924. vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
  925. #endif
  926. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  927. #endif
  928. return envMapColor.rgb * envMapIntensity;
  929. }
  930. #endif
  931. `,hCe=`BlinnPhongMaterial material;
  932. material.diffuseColor = diffuseColor.rgb;
  933. material.specularColor = specular;
  934. material.specularShininess = shininess;
  935. material.specularStrength = specularStrength;
  936. `,pCe=`varying vec3 vViewPosition;
  937. #ifndef FLAT_SHADED
  938. varying vec3 vNormal;
  939. #endif
  940. struct BlinnPhongMaterial {
  941. vec3 diffuseColor;
  942. vec3 specularColor;
  943. float specularShininess;
  944. float specularStrength;
  945. };
  946. #if NUM_RECT_AREA_LIGHTS > 0
  947. void RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  948. vec3 matDiffColor = material.diffuseColor;
  949. vec3 matSpecColor = material.specularColor;
  950. vec3 lightColor = rectAreaLight.color;
  951. float roughness = BlinnExponentToGGXRoughness( material.specularShininess );
  952. vec3 spec = Rect_Area_Light_Specular_Reflectance(
  953. geometry,
  954. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,
  955. roughness,
  956. ltcMat, ltcMag );
  957. vec3 diff = Rect_Area_Light_Diffuse_Reflectance(
  958. geometry,
  959. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );
  960. reflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;
  961. reflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;
  962. }
  963. #endif
  964. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  965. #ifdef TOON
  966. vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
  967. #else
  968. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  969. vec3 irradiance = dotNL * directLight.color;
  970. #endif
  971. #ifndef PHYSICALLY_CORRECT_LIGHTS
  972. irradiance *= PI;
  973. #endif
  974. reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  975. reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
  976. }
  977. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  978. reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  979. }
  980. #define RE_Direct RE_Direct_BlinnPhong
  981. #define RE_Direct_RectArea RE_Direct_RectArea_BlinnPhong
  982. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
  983. #define Material_LightProbeLOD( material ) (0)
  984. `,dCe=`PhysicalMaterial material;
  985. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  986. material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );
  987. #ifdef STANDARD
  988. material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
  989. #else
  990. material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
  991. material.clearCoat = saturate( clearCoat ); material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );
  992. #endif
  993. `,mCe=`struct PhysicalMaterial {
  994. vec3 diffuseColor;
  995. float specularRoughness;
  996. vec3 specularColor;
  997. #ifndef STANDARD
  998. float clearCoat;
  999. float clearCoatRoughness;
  1000. #endif
  1001. };
  1002. #define MAXIMUM_SPECULAR_COEFFICIENT 0.16
  1003. #define DEFAULT_SPECULAR_COEFFICIENT 0.04
  1004. float clearCoatDHRApprox( const in float roughness, const in float dotNL ) {
  1005. return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
  1006. }
  1007. #if NUM_RECT_AREA_LIGHTS > 0
  1008. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1009. vec3 matDiffColor = material.diffuseColor;
  1010. vec3 matSpecColor = material.specularColor;
  1011. vec3 lightColor = rectAreaLight.color;
  1012. float roughness = material.specularRoughness;
  1013. vec3 spec = Rect_Area_Light_Specular_Reflectance(
  1014. geometry,
  1015. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,
  1016. roughness,
  1017. ltcMat, ltcMag );
  1018. vec3 diff = Rect_Area_Light_Diffuse_Reflectance(
  1019. geometry,
  1020. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );
  1021. reflectedLight.directSpecular += lightColor * matSpecColor * spec;
  1022. reflectedLight.directDiffuse += lightColor * matDiffColor * diff;
  1023. }
  1024. #endif
  1025. void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1026. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  1027. vec3 irradiance = dotNL * directLight.color;
  1028. #ifndef PHYSICALLY_CORRECT_LIGHTS
  1029. irradiance *= PI;
  1030. #endif
  1031. #ifndef STANDARD
  1032. float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );
  1033. #else
  1034. float clearCoatDHR = 0.0;
  1035. #endif
  1036. reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );
  1037. reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  1038. #ifndef STANDARD
  1039. reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
  1040. #endif
  1041. }
  1042. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1043. reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  1044. }
  1045. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1046. #ifndef STANDARD
  1047. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  1048. float dotNL = dotNV;
  1049. float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );
  1050. #else
  1051. float clearCoatDHR = 0.0;
  1052. #endif
  1053. reflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );
  1054. #ifndef STANDARD
  1055. reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
  1056. #endif
  1057. }
  1058. #define RE_Direct RE_Direct_Physical
  1059. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  1060. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  1061. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  1062. #define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )
  1063. #define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )
  1064. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  1065. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  1066. }
  1067. `,vCe=`
  1068. GeometricContext geometry;
  1069. geometry.position = - vViewPosition;
  1070. geometry.normal = normal;
  1071. geometry.viewDir = normalize( vViewPosition );
  1072. IncidentLight directLight;
  1073. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  1074. PointLight pointLight;
  1075. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1076. pointLight = pointLights[ i ];
  1077. getPointDirectLightIrradiance( pointLight, geometry, directLight );
  1078. #ifdef USE_SHADOWMAP
  1079. directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;
  1080. #endif
  1081. RE_Direct( directLight, geometry, material, reflectedLight );
  1082. }
  1083. #endif
  1084. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  1085. SpotLight spotLight;
  1086. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1087. spotLight = spotLights[ i ];
  1088. getSpotDirectLightIrradiance( spotLight, geometry, directLight );
  1089. #ifdef USE_SHADOWMAP
  1090. directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
  1091. #endif
  1092. RE_Direct( directLight, geometry, material, reflectedLight );
  1093. }
  1094. #endif
  1095. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  1096. DirectionalLight directionalLight;
  1097. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1098. directionalLight = directionalLights[ i ];
  1099. getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
  1100. #ifdef USE_SHADOWMAP
  1101. directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1102. #endif
  1103. RE_Direct( directLight, geometry, material, reflectedLight );
  1104. }
  1105. #endif
  1106. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  1107. RectAreaLight rectAreaLight;
  1108. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  1109. rectAreaLight = rectAreaLights[ i ];
  1110. RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
  1111. }
  1112. #endif
  1113. #if defined( RE_IndirectDiffuse )
  1114. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  1115. #ifdef USE_LIGHTMAP
  1116. vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
  1117. #ifndef PHYSICALLY_CORRECT_LIGHTS
  1118. lightMapIrradiance *= PI;
  1119. #endif
  1120. irradiance += lightMapIrradiance;
  1121. #endif
  1122. #if ( NUM_HEMI_LIGHTS > 0 )
  1123. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  1124. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
  1125. }
  1126. #endif
  1127. #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )
  1128. irradiance += getLightProbeIndirectIrradiance( geometry, 8 );
  1129. #endif
  1130. RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
  1131. #endif
  1132. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  1133. vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );
  1134. #ifndef STANDARD
  1135. vec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );
  1136. #else
  1137. vec3 clearCoatRadiance = vec3( 0.0 );
  1138. #endif
  1139. RE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );
  1140. #endif
  1141. `,gCe=`#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)
  1142. gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;
  1143. #endif`,yCe=`#ifdef USE_LOGDEPTHBUF
  1144. uniform float logDepthBufFC;
  1145. #ifdef USE_LOGDEPTHBUF_EXT
  1146. varying float vFragDepth;
  1147. #endif
  1148. #endif
  1149. `,_Ce=`#ifdef USE_LOGDEPTHBUF
  1150. #ifdef USE_LOGDEPTHBUF_EXT
  1151. varying float vFragDepth;
  1152. #endif
  1153. uniform float logDepthBufFC;
  1154. #endif`,xCe=`#ifdef USE_LOGDEPTHBUF
  1155. gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
  1156. #ifdef USE_LOGDEPTHBUF_EXT
  1157. vFragDepth = 1.0 + gl_Position.w;
  1158. #else
  1159. gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
  1160. #endif
  1161. #endif
  1162. `,SCe=`#ifdef USE_MAP
  1163. vec4 texelColor = texture2D( map, vUv );
  1164. texelColor = mapTexelToLinear( texelColor );
  1165. diffuseColor *= texelColor;
  1166. #endif
  1167. `,MCe=`#ifdef USE_MAP
  1168. uniform sampler2D map;
  1169. #endif
  1170. `,bCe=`#ifdef USE_MAP
  1171. vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );
  1172. diffuseColor *= mapTexelToLinear( mapTexel );
  1173. #endif
  1174. `,wCe=`#ifdef USE_MAP
  1175. uniform vec4 offsetRepeat;
  1176. uniform sampler2D map;
  1177. #endif
  1178. `,TCe=`float metalnessFactor = metalness;
  1179. #ifdef USE_METALNESSMAP
  1180. vec4 texelMetalness = texture2D( metalnessMap, vUv );
  1181. metalnessFactor *= texelMetalness.r;
  1182. #endif
  1183. `,ECe=`#ifdef USE_METALNESSMAP
  1184. uniform sampler2D metalnessMap;
  1185. #endif`,ACe=`#ifdef USE_MORPHNORMALS
  1186. objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
  1187. objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
  1188. objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
  1189. objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
  1190. #endif
  1191. `,CCe=`#ifdef USE_MORPHTARGETS
  1192. #ifndef USE_MORPHNORMALS
  1193. uniform float morphTargetInfluences[ 8 ];
  1194. #else
  1195. uniform float morphTargetInfluences[ 4 ];
  1196. #endif
  1197. #endif`,RCe=`#ifdef USE_MORPHTARGETS
  1198. transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
  1199. transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
  1200. transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
  1201. transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
  1202. #ifndef USE_MORPHNORMALS
  1203. transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
  1204. transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
  1205. transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
  1206. transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
  1207. #endif
  1208. #endif
  1209. `,LCe=`#ifdef DOUBLE_SIDED
  1210. float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1211. #else
  1212. float flipNormal = 1.0;
  1213. #endif
  1214. `,PCe=`#ifdef FLAT_SHADED
  1215. vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
  1216. vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
  1217. vec3 normal = normalize( cross( fdx, fdy ) );
  1218. #else
  1219. vec3 normal = normalize( vNormal ) * flipNormal;
  1220. #endif
  1221. #ifdef USE_NORMALMAP
  1222. normal = perturbNormal2Arb( -vViewPosition, normal );
  1223. #elif defined( USE_BUMPMAP )
  1224. normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
  1225. #endif
  1226. `,DCe=`#ifdef USE_NORMALMAP
  1227. uniform sampler2D normalMap;
  1228. uniform vec2 normalScale;
  1229. vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
  1230. vec3 q0 = dFdx( eye_pos.xyz );
  1231. vec3 q1 = dFdy( eye_pos.xyz );
  1232. vec2 st0 = dFdx( vUv.st );
  1233. vec2 st1 = dFdy( vUv.st );
  1234. vec3 S = normalize( q0 * st1.t - q1 * st0.t );
  1235. vec3 T = normalize( -q0 * st1.s + q1 * st0.s );
  1236. vec3 N = normalize( surf_norm );
  1237. vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
  1238. mapN.xy = normalScale * mapN.xy;
  1239. mat3 tsn = mat3( S, T, N );
  1240. return normalize( tsn * mapN );
  1241. }
  1242. #endif
  1243. `,ICe=`vec3 packNormalToRGB( const in vec3 normal ) {
  1244. return normalize( normal ) * 0.5 + 0.5;
  1245. }
  1246. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  1247. return 1.0 - 2.0 * rgb.xyz;
  1248. }
  1249. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
  1250. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  1251. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  1252. const float ShiftRight8 = 1. / 256.;
  1253. vec4 packDepthToRGBA( const in float v ) {
  1254. vec4 r = vec4( fract( v * PackFactors ), v );
  1255. r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
  1256. }
  1257. float unpackRGBAToDepth( const in vec4 v ) {
  1258. return dot( v, UnpackFactors );
  1259. }
  1260. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  1261. return ( viewZ + near ) / ( near - far );
  1262. }
  1263. float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
  1264. return linearClipZ * ( near - far ) - near;
  1265. }
  1266. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  1267. return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
  1268. }
  1269. float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
  1270. return ( near * far ) / ( ( far - near ) * invClipZ - far );
  1271. }
  1272. `,NCe=`#ifdef PREMULTIPLIED_ALPHA
  1273. gl_FragColor.rgb *= gl_FragColor.a;
  1274. #endif
  1275. `,UCe=`#ifdef USE_SKINNING
  1276. vec4 mvPosition = modelViewMatrix * skinned;
  1277. #else
  1278. vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
  1279. #endif
  1280. gl_Position = projectionMatrix * mvPosition;
  1281. `,OCe=`float roughnessFactor = roughness;
  1282. #ifdef USE_ROUGHNESSMAP
  1283. vec4 texelRoughness = texture2D( roughnessMap, vUv );
  1284. roughnessFactor *= texelRoughness.r;
  1285. #endif
  1286. `,zCe=`#ifdef USE_ROUGHNESSMAP
  1287. uniform sampler2D roughnessMap;
  1288. #endif`,FCe=`#ifdef USE_SHADOWMAP
  1289. #if NUM_DIR_LIGHTS > 0
  1290. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];
  1291. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];
  1292. #endif
  1293. #if NUM_SPOT_LIGHTS > 0
  1294. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];
  1295. varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];
  1296. #endif
  1297. #if NUM_POINT_LIGHTS > 0
  1298. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];
  1299. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];
  1300. #endif
  1301. #if NUM_RECT_AREA_LIGHTS > 0
  1302. #endif
  1303. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  1304. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  1305. }
  1306. float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {
  1307. const vec2 offset = vec2( 0.0, 1.0 );
  1308. vec2 texelSize = vec2( 1.0 ) / size;
  1309. vec2 centroidUV = floor( uv * size + 0.5 ) / size;
  1310. float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );
  1311. float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );
  1312. float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );
  1313. float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );
  1314. vec2 f = fract( uv * size + 0.5 );
  1315. float a = mix( lb, lt, f.y );
  1316. float b = mix( rb, rt, f.y );
  1317. float c = mix( a, b, f.x );
  1318. return c;
  1319. }
  1320. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  1321. shadowCoord.xyz /= shadowCoord.w;
  1322. shadowCoord.z += shadowBias;
  1323. bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
  1324. bool inFrustum = all( inFrustumVec );
  1325. bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
  1326. bool frustumTest = all( frustumTestVec );
  1327. if ( frustumTest ) {
  1328. #if defined( SHADOWMAP_TYPE_PCF )
  1329. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1330. float dx0 = - texelSize.x * shadowRadius;
  1331. float dy0 = - texelSize.y * shadowRadius;
  1332. float dx1 = + texelSize.x * shadowRadius;
  1333. float dy1 = + texelSize.y * shadowRadius;
  1334. return (
  1335. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  1336. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  1337. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  1338. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  1339. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  1340. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  1341. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  1342. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  1343. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  1344. ) * ( 1.0 / 9.0 );
  1345. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  1346. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1347. float dx0 = - texelSize.x * shadowRadius;
  1348. float dy0 = - texelSize.y * shadowRadius;
  1349. float dx1 = + texelSize.x * shadowRadius;
  1350. float dy1 = + texelSize.y * shadowRadius;
  1351. return (
  1352. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  1353. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  1354. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  1355. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  1356. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +
  1357. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  1358. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  1359. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  1360. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  1361. ) * ( 1.0 / 9.0 );
  1362. #else
  1363. return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  1364. #endif
  1365. }
  1366. return 1.0;
  1367. }
  1368. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  1369. vec3 absV = abs( v );
  1370. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  1371. absV *= scaleToCube;
  1372. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  1373. vec2 planar = v.xy;
  1374. float almostATexel = 1.5 * texelSizeY;
  1375. float almostOne = 1.0 - almostATexel;
  1376. if ( absV.z >= almostOne ) {
  1377. if ( v.z > 0.0 )
  1378. planar.x = 4.0 - v.x;
  1379. } else if ( absV.x >= almostOne ) {
  1380. float signX = sign( v.x );
  1381. planar.x = v.z * signX + 2.0 * signX;
  1382. } else if ( absV.y >= almostOne ) {
  1383. float signY = sign( v.y );
  1384. planar.x = v.x + 2.0 * signY + 2.0;
  1385. planar.y = v.z * signY - 2.0;
  1386. }
  1387. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  1388. }
  1389. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  1390. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  1391. vec3 lightToPosition = shadowCoord.xyz;
  1392. vec3 bd3D = normalize( lightToPosition );
  1393. float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;
  1394. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )
  1395. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  1396. return (
  1397. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  1398. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  1399. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  1400. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  1401. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  1402. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  1403. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  1404. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  1405. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  1406. ) * ( 1.0 / 9.0 );
  1407. #else
  1408. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  1409. #endif
  1410. }
  1411. #endif
  1412. `,BCe=`#ifdef USE_SHADOWMAP
  1413. #if NUM_DIR_LIGHTS > 0
  1414. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];
  1415. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];
  1416. #endif
  1417. #if NUM_SPOT_LIGHTS > 0
  1418. uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];
  1419. varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];
  1420. #endif
  1421. #if NUM_POINT_LIGHTS > 0
  1422. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];
  1423. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];
  1424. #endif
  1425. #if NUM_RECT_AREA_LIGHTS > 0
  1426. #endif
  1427. #endif
  1428. `,kCe=`#ifdef USE_SHADOWMAP
  1429. #if NUM_DIR_LIGHTS > 0
  1430. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1431. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;
  1432. }
  1433. #endif
  1434. #if NUM_SPOT_LIGHTS > 0
  1435. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1436. vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;
  1437. }
  1438. #endif
  1439. #if NUM_POINT_LIGHTS > 0
  1440. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1441. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;
  1442. }
  1443. #endif
  1444. #if NUM_RECT_AREA_LIGHTS > 0
  1445. #endif
  1446. #endif
  1447. `,VCe=`float getShadowMask() {
  1448. float shadow = 1.0;
  1449. #ifdef USE_SHADOWMAP
  1450. #if NUM_DIR_LIGHTS > 0
  1451. DirectionalLight directionalLight;
  1452. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1453. directionalLight = directionalLights[ i ];
  1454. shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1455. }
  1456. #endif
  1457. #if NUM_SPOT_LIGHTS > 0
  1458. SpotLight spotLight;
  1459. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1460. spotLight = spotLights[ i ];
  1461. shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
  1462. }
  1463. #endif
  1464. #if NUM_POINT_LIGHTS > 0
  1465. PointLight pointLight;
  1466. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1467. pointLight = pointLights[ i ];
  1468. shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;
  1469. }
  1470. #endif
  1471. #if NUM_RECT_AREA_LIGHTS > 0
  1472. #endif
  1473. #endif
  1474. return shadow;
  1475. }
  1476. `,GCe=`#ifdef USE_SKINNING
  1477. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  1478. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  1479. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  1480. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  1481. #endif`,HCe=`#ifdef USE_SKINNING
  1482. uniform mat4 bindMatrix;
  1483. uniform mat4 bindMatrixInverse;
  1484. #ifdef BONE_TEXTURE
  1485. uniform sampler2D boneTexture;
  1486. uniform int boneTextureWidth;
  1487. uniform int boneTextureHeight;
  1488. mat4 getBoneMatrix( const in float i ) {
  1489. float j = i * 4.0;
  1490. float x = mod( j, float( boneTextureWidth ) );
  1491. float y = floor( j / float( boneTextureWidth ) );
  1492. float dx = 1.0 / float( boneTextureWidth );
  1493. float dy = 1.0 / float( boneTextureHeight );
  1494. y = dy * ( y + 0.5 );
  1495. vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
  1496. vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
  1497. vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
  1498. vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
  1499. mat4 bone = mat4( v1, v2, v3, v4 );
  1500. return bone;
  1501. }
  1502. #else
  1503. uniform mat4 boneMatrices[ MAX_BONES ];
  1504. mat4 getBoneMatrix( const in float i ) {
  1505. mat4 bone = boneMatrices[ int(i) ];
  1506. return bone;
  1507. }
  1508. #endif
  1509. #endif
  1510. `,WCe=`#ifdef USE_SKINNING
  1511. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  1512. vec4 skinned = vec4( 0.0 );
  1513. skinned += boneMatX * skinVertex * skinWeight.x;
  1514. skinned += boneMatY * skinVertex * skinWeight.y;
  1515. skinned += boneMatZ * skinVertex * skinWeight.z;
  1516. skinned += boneMatW * skinVertex * skinWeight.w;
  1517. skinned = bindMatrixInverse * skinned;
  1518. #endif
  1519. `,XCe=`#ifdef USE_SKINNING
  1520. mat4 skinMatrix = mat4( 0.0 );
  1521. skinMatrix += skinWeight.x * boneMatX;
  1522. skinMatrix += skinWeight.y * boneMatY;
  1523. skinMatrix += skinWeight.z * boneMatZ;
  1524. skinMatrix += skinWeight.w * boneMatW;
  1525. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  1526. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  1527. #endif
  1528. `,YCe=`float specularStrength;
  1529. #ifdef USE_SPECULARMAP
  1530. vec4 texelSpecular = texture2D( specularMap, vUv );
  1531. specularStrength = texelSpecular.r;
  1532. #else
  1533. specularStrength = 1.0;
  1534. #endif`,qCe=`#ifdef USE_SPECULARMAP
  1535. uniform sampler2D specularMap;
  1536. #endif`,ZCe=`#if defined( TONE_MAPPING )
  1537. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  1538. #endif
  1539. `,jCe=`#define saturate(a) clamp( a, 0.0, 1.0 )
  1540. uniform float toneMappingExposure;
  1541. uniform float toneMappingWhitePoint;
  1542. vec3 LinearToneMapping( vec3 color ) {
  1543. return toneMappingExposure * color;
  1544. }
  1545. vec3 ReinhardToneMapping( vec3 color ) {
  1546. color *= toneMappingExposure;
  1547. return saturate( color / ( vec3( 1.0 ) + color ) );
  1548. }
  1549. #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 ) )
  1550. vec3 Uncharted2ToneMapping( vec3 color ) {
  1551. color *= toneMappingExposure;
  1552. return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
  1553. }
  1554. vec3 OptimizedCineonToneMapping( vec3 color ) {
  1555. color *= toneMappingExposure;
  1556. color = max( vec3( 0.0 ), color - 0.004 );
  1557. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  1558. }
  1559. `,KCe=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
  1560. varying vec2 vUv;
  1561. #endif`,JCe=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
  1562. varying vec2 vUv;
  1563. uniform vec4 offsetRepeat;
  1564. #endif
  1565. `,$Ce=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
  1566. vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
  1567. #endif`,QCe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1568. varying vec2 vUv2;
  1569. #endif`,eRe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1570. attribute vec2 uv2;
  1571. varying vec2 vUv2;
  1572. #endif`,tRe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1573. vUv2 = uv2;
  1574. #endif`,rRe=`#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
  1575. #ifdef USE_SKINNING
  1576. vec4 worldPosition = modelMatrix * skinned;
  1577. #else
  1578. vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
  1579. #endif
  1580. #endif
  1581. `,iRe=`uniform samplerCube tCube;
  1582. uniform float tFlip;
  1583. uniform float opacity;
  1584. varying vec3 vWorldPosition;
  1585. #include <common>
  1586. void main() {
  1587. gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );
  1588. gl_FragColor.a *= opacity;
  1589. }
  1590. `,nRe=`varying vec3 vWorldPosition;
  1591. #include <common>
  1592. void main() {
  1593. vWorldPosition = transformDirection( position, modelMatrix );
  1594. #include <begin_vertex>
  1595. #include <project_vertex>
  1596. }
  1597. `,aRe=`#if DEPTH_PACKING == 3200
  1598. uniform float opacity;
  1599. #endif
  1600. #include <common>
  1601. #include <packing>
  1602. #include <uv_pars_fragment>
  1603. #include <map_pars_fragment>
  1604. #include <alphamap_pars_fragment>
  1605. #include <logdepthbuf_pars_fragment>
  1606. #include <clipping_planes_pars_fragment>
  1607. void main() {
  1608. #include <clipping_planes_fragment>
  1609. vec4 diffuseColor = vec4( 1.0 );
  1610. #if DEPTH_PACKING == 3200
  1611. diffuseColor.a = opacity;
  1612. #endif
  1613. #include <map_fragment>
  1614. #include <alphamap_fragment>
  1615. #include <alphatest_fragment>
  1616. #include <logdepthbuf_fragment>
  1617. #if DEPTH_PACKING == 3200
  1618. gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );
  1619. #elif DEPTH_PACKING == 3201
  1620. gl_FragColor = packDepthToRGBA( gl_FragCoord.z );
  1621. #endif
  1622. }
  1623. `,oRe=`#include <common>
  1624. #include <uv_pars_vertex>
  1625. #include <displacementmap_pars_vertex>
  1626. #include <morphtarget_pars_vertex>
  1627. #include <skinning_pars_vertex>
  1628. #include <logdepthbuf_pars_vertex>
  1629. #include <clipping_planes_pars_vertex>
  1630. void main() {
  1631. #include <uv_vertex>
  1632. #include <skinbase_vertex>
  1633. #include <begin_vertex>
  1634. #include <displacementmap_vertex>
  1635. #include <morphtarget_vertex>
  1636. #include <skinning_vertex>
  1637. #include <project_vertex>
  1638. #include <logdepthbuf_vertex>
  1639. #include <clipping_planes_vertex>
  1640. }
  1641. `,sRe=`uniform vec3 lightPos;
  1642. varying vec4 vWorldPosition;
  1643. #include <common>
  1644. #include <packing>
  1645. #include <clipping_planes_pars_fragment>
  1646. void main () {
  1647. #include <clipping_planes_fragment>
  1648. gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );
  1649. }
  1650. `,lRe=`varying vec4 vWorldPosition;
  1651. #include <common>
  1652. #include <morphtarget_pars_vertex>
  1653. #include <skinning_pars_vertex>
  1654. #include <clipping_planes_pars_vertex>
  1655. void main() {
  1656. #include <skinbase_vertex>
  1657. #include <begin_vertex>
  1658. #include <morphtarget_vertex>
  1659. #include <skinning_vertex>
  1660. #include <project_vertex>
  1661. #include <worldpos_vertex>
  1662. #include <clipping_planes_vertex>
  1663. vWorldPosition = worldPosition;
  1664. }
  1665. `,uRe=`uniform sampler2D tEquirect;
  1666. uniform float tFlip;
  1667. varying vec3 vWorldPosition;
  1668. #include <common>
  1669. void main() {
  1670. vec3 direction = normalize( vWorldPosition );
  1671. vec2 sampleUV;
  1672. sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );
  1673. sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;
  1674. gl_FragColor = texture2D( tEquirect, sampleUV );
  1675. }
  1676. `,cRe=`varying vec3 vWorldPosition;
  1677. #include <common>
  1678. void main() {
  1679. vWorldPosition = transformDirection( position, modelMatrix );
  1680. #include <begin_vertex>
  1681. #include <project_vertex>
  1682. }
  1683. `,fRe=`uniform vec3 diffuse;
  1684. uniform float opacity;
  1685. uniform float dashSize;
  1686. uniform float totalSize;
  1687. varying float vLineDistance;
  1688. #include <common>
  1689. #include <color_pars_fragment>
  1690. #include <fog_pars_fragment>
  1691. #include <logdepthbuf_pars_fragment>
  1692. #include <clipping_planes_pars_fragment>
  1693. void main() {
  1694. #include <clipping_planes_fragment>
  1695. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  1696. discard;
  1697. }
  1698. vec3 outgoingLight = vec3( 0.0 );
  1699. vec4 diffuseColor = vec4( diffuse, opacity );
  1700. #include <logdepthbuf_fragment>
  1701. #include <color_fragment>
  1702. outgoingLight = diffuseColor.rgb;
  1703. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1704. #include <premultiplied_alpha_fragment>
  1705. #include <tonemapping_fragment>
  1706. #include <encodings_fragment>
  1707. #include <fog_fragment>
  1708. }
  1709. `,hRe=`uniform float scale;
  1710. attribute float lineDistance;
  1711. varying float vLineDistance;
  1712. #include <common>
  1713. #include <color_pars_vertex>
  1714. #include <logdepthbuf_pars_vertex>
  1715. #include <clipping_planes_pars_vertex>
  1716. void main() {
  1717. #include <color_vertex>
  1718. vLineDistance = scale * lineDistance;
  1719. vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
  1720. gl_Position = projectionMatrix * mvPosition;
  1721. #include <logdepthbuf_vertex>
  1722. #include <clipping_planes_vertex>
  1723. }
  1724. `,pRe=`uniform vec3 diffuse;
  1725. uniform float opacity;
  1726. #ifndef FLAT_SHADED
  1727. varying vec3 vNormal;
  1728. #endif
  1729. #include <common>
  1730. #include <color_pars_fragment>
  1731. #include <uv_pars_fragment>
  1732. #include <uv2_pars_fragment>
  1733. #include <map_pars_fragment>
  1734. #include <alphamap_pars_fragment>
  1735. #include <aomap_pars_fragment>
  1736. #include <lightmap_pars_fragment>
  1737. #include <envmap_pars_fragment>
  1738. #include <fog_pars_fragment>
  1739. #include <specularmap_pars_fragment>
  1740. #include <logdepthbuf_pars_fragment>
  1741. #include <clipping_planes_pars_fragment>
  1742. void main() {
  1743. #include <clipping_planes_fragment>
  1744. vec4 diffuseColor = vec4( diffuse, opacity );
  1745. #include <logdepthbuf_fragment>
  1746. #include <map_fragment>
  1747. #include <color_fragment>
  1748. #include <alphamap_fragment>
  1749. #include <alphatest_fragment>
  1750. #include <specularmap_fragment>
  1751. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  1752. #ifdef USE_LIGHTMAP
  1753. reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
  1754. #else
  1755. reflectedLight.indirectDiffuse += vec3( 1.0 );
  1756. #endif
  1757. #include <aomap_fragment>
  1758. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  1759. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  1760. #include <normal_flip>
  1761. #include <envmap_fragment>
  1762. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1763. #include <premultiplied_alpha_fragment>
  1764. #include <tonemapping_fragment>
  1765. #include <encodings_fragment>
  1766. #include <fog_fragment>
  1767. }
  1768. `,dRe=`#include <common>
  1769. #include <uv_pars_vertex>
  1770. #include <uv2_pars_vertex>
  1771. #include <envmap_pars_vertex>
  1772. #include <color_pars_vertex>
  1773. #include <morphtarget_pars_vertex>
  1774. #include <skinning_pars_vertex>
  1775. #include <logdepthbuf_pars_vertex>
  1776. #include <clipping_planes_pars_vertex>
  1777. void main() {
  1778. #include <uv_vertex>
  1779. #include <uv2_vertex>
  1780. #include <color_vertex>
  1781. #include <skinbase_vertex>
  1782. #ifdef USE_ENVMAP
  1783. #include <beginnormal_vertex>
  1784. #include <morphnormal_vertex>
  1785. #include <skinnormal_vertex>
  1786. #include <defaultnormal_vertex>
  1787. #endif
  1788. #include <begin_vertex>
  1789. #include <morphtarget_vertex>
  1790. #include <skinning_vertex>
  1791. #include <project_vertex>
  1792. #include <logdepthbuf_vertex>
  1793. #include <worldpos_vertex>
  1794. #include <clipping_planes_vertex>
  1795. #include <envmap_vertex>
  1796. }
  1797. `,mRe=`uniform vec3 diffuse;
  1798. uniform vec3 emissive;
  1799. uniform float opacity;
  1800. varying vec3 vLightFront;
  1801. #ifdef DOUBLE_SIDED
  1802. varying vec3 vLightBack;
  1803. #endif
  1804. #include <common>
  1805. #include <packing>
  1806. #include <color_pars_fragment>
  1807. #include <uv_pars_fragment>
  1808. #include <uv2_pars_fragment>
  1809. #include <map_pars_fragment>
  1810. #include <alphamap_pars_fragment>
  1811. #include <aomap_pars_fragment>
  1812. #include <lightmap_pars_fragment>
  1813. #include <emissivemap_pars_fragment>
  1814. #include <envmap_pars_fragment>
  1815. #include <bsdfs>
  1816. #include <lights_pars>
  1817. #include <fog_pars_fragment>
  1818. #include <shadowmap_pars_fragment>
  1819. #include <shadowmask_pars_fragment>
  1820. #include <specularmap_pars_fragment>
  1821. #include <logdepthbuf_pars_fragment>
  1822. #include <clipping_planes_pars_fragment>
  1823. void main() {
  1824. #include <clipping_planes_fragment>
  1825. vec4 diffuseColor = vec4( diffuse, opacity );
  1826. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  1827. vec3 totalEmissiveRadiance = emissive;
  1828. #include <logdepthbuf_fragment>
  1829. #include <map_fragment>
  1830. #include <color_fragment>
  1831. #include <alphamap_fragment>
  1832. #include <alphatest_fragment>
  1833. #include <specularmap_fragment>
  1834. #include <emissivemap_fragment>
  1835. reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
  1836. #include <lightmap_fragment>
  1837. reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
  1838. #ifdef DOUBLE_SIDED
  1839. reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
  1840. #else
  1841. reflectedLight.directDiffuse = vLightFront;
  1842. #endif
  1843. reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
  1844. #include <aomap_fragment>
  1845. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  1846. #include <normal_flip>
  1847. #include <envmap_fragment>
  1848. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1849. #include <premultiplied_alpha_fragment>
  1850. #include <tonemapping_fragment>
  1851. #include <encodings_fragment>
  1852. #include <fog_fragment>
  1853. }
  1854. `,vRe=`#define LAMBERT
  1855. varying vec3 vLightFront;
  1856. #ifdef DOUBLE_SIDED
  1857. varying vec3 vLightBack;
  1858. #endif
  1859. #include <common>
  1860. #include <uv_pars_vertex>
  1861. #include <uv2_pars_vertex>
  1862. #include <envmap_pars_vertex>
  1863. #include <bsdfs>
  1864. #include <lights_pars>
  1865. #include <color_pars_vertex>
  1866. #include <morphtarget_pars_vertex>
  1867. #include <skinning_pars_vertex>
  1868. #include <shadowmap_pars_vertex>
  1869. #include <logdepthbuf_pars_vertex>
  1870. #include <clipping_planes_pars_vertex>
  1871. void main() {
  1872. #include <uv_vertex>
  1873. #include <uv2_vertex>
  1874. #include <color_vertex>
  1875. #include <beginnormal_vertex>
  1876. #include <morphnormal_vertex>
  1877. #include <skinbase_vertex>
  1878. #include <skinnormal_vertex>
  1879. #include <defaultnormal_vertex>
  1880. #include <begin_vertex>
  1881. #include <morphtarget_vertex>
  1882. #include <skinning_vertex>
  1883. #include <project_vertex>
  1884. #include <logdepthbuf_vertex>
  1885. #include <clipping_planes_vertex>
  1886. #include <worldpos_vertex>
  1887. #include <envmap_vertex>
  1888. #include <lights_lambert_vertex>
  1889. #include <shadowmap_vertex>
  1890. }
  1891. `,gRe=`#define PHONG
  1892. uniform vec3 diffuse;
  1893. uniform vec3 emissive;
  1894. uniform vec3 specular;
  1895. uniform float shininess;
  1896. uniform float opacity;
  1897. #include <common>
  1898. #include <packing>
  1899. #include <color_pars_fragment>
  1900. #include <uv_pars_fragment>
  1901. #include <uv2_pars_fragment>
  1902. #include <map_pars_fragment>
  1903. #include <alphamap_pars_fragment>
  1904. #include <aomap_pars_fragment>
  1905. #include <lightmap_pars_fragment>
  1906. #include <emissivemap_pars_fragment>
  1907. #include <envmap_pars_fragment>
  1908. #include <gradientmap_pars_fragment>
  1909. #include <fog_pars_fragment>
  1910. #include <bsdfs>
  1911. #include <lights_pars>
  1912. #include <lights_phong_pars_fragment>
  1913. #include <shadowmap_pars_fragment>
  1914. #include <bumpmap_pars_fragment>
  1915. #include <normalmap_pars_fragment>
  1916. #include <specularmap_pars_fragment>
  1917. #include <logdepthbuf_pars_fragment>
  1918. #include <clipping_planes_pars_fragment>
  1919. void main() {
  1920. #include <clipping_planes_fragment>
  1921. vec4 diffuseColor = vec4( diffuse, opacity );
  1922. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  1923. vec3 totalEmissiveRadiance = emissive;
  1924. #include <logdepthbuf_fragment>
  1925. #include <map_fragment>
  1926. #include <color_fragment>
  1927. #include <alphamap_fragment>
  1928. #include <alphatest_fragment>
  1929. #include <specularmap_fragment>
  1930. #include <normal_flip>
  1931. #include <normal_fragment>
  1932. #include <emissivemap_fragment>
  1933. #include <lights_phong_fragment>
  1934. #include <lights_template>
  1935. #include <aomap_fragment>
  1936. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  1937. #include <envmap_fragment>
  1938. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1939. #include <premultiplied_alpha_fragment>
  1940. #include <tonemapping_fragment>
  1941. #include <encodings_fragment>
  1942. #include <fog_fragment>
  1943. }
  1944. `,yRe=`#define PHONG
  1945. varying vec3 vViewPosition;
  1946. #ifndef FLAT_SHADED
  1947. varying vec3 vNormal;
  1948. #endif
  1949. #include <common>
  1950. #include <uv_pars_vertex>
  1951. #include <uv2_pars_vertex>
  1952. #include <displacementmap_pars_vertex>
  1953. #include <envmap_pars_vertex>
  1954. #include <color_pars_vertex>
  1955. #include <morphtarget_pars_vertex>
  1956. #include <skinning_pars_vertex>
  1957. #include <shadowmap_pars_vertex>
  1958. #include <logdepthbuf_pars_vertex>
  1959. #include <clipping_planes_pars_vertex>
  1960. void main() {
  1961. #include <uv_vertex>
  1962. #include <uv2_vertex>
  1963. #include <color_vertex>
  1964. #include <beginnormal_vertex>
  1965. #include <morphnormal_vertex>
  1966. #include <skinbase_vertex>
  1967. #include <skinnormal_vertex>
  1968. #include <defaultnormal_vertex>
  1969. #ifndef FLAT_SHADED
  1970. vNormal = normalize( transformedNormal );
  1971. #endif
  1972. #include <begin_vertex>
  1973. #include <displacementmap_vertex>
  1974. #include <morphtarget_vertex>
  1975. #include <skinning_vertex>
  1976. #include <project_vertex>
  1977. #include <logdepthbuf_vertex>
  1978. #include <clipping_planes_vertex>
  1979. vViewPosition = - mvPosition.xyz;
  1980. #include <worldpos_vertex>
  1981. #include <envmap_vertex>
  1982. #include <shadowmap_vertex>
  1983. }
  1984. `,_Re=`#define PHYSICAL
  1985. uniform vec3 diffuse;
  1986. uniform vec3 emissive;
  1987. uniform float roughness;
  1988. uniform float metalness;
  1989. uniform float opacity;
  1990. #ifndef STANDARD
  1991. uniform float clearCoat;
  1992. uniform float clearCoatRoughness;
  1993. #endif
  1994. varying vec3 vViewPosition;
  1995. #ifndef FLAT_SHADED
  1996. varying vec3 vNormal;
  1997. #endif
  1998. #include <common>
  1999. #include <packing>
  2000. #include <color_pars_fragment>
  2001. #include <uv_pars_fragment>
  2002. #include <uv2_pars_fragment>
  2003. #include <map_pars_fragment>
  2004. #include <alphamap_pars_fragment>
  2005. #include <aomap_pars_fragment>
  2006. #include <lightmap_pars_fragment>
  2007. #include <emissivemap_pars_fragment>
  2008. #include <envmap_pars_fragment>
  2009. #include <fog_pars_fragment>
  2010. #include <bsdfs>
  2011. #include <cube_uv_reflection_fragment>
  2012. #include <lights_pars>
  2013. #include <lights_physical_pars_fragment>
  2014. #include <shadowmap_pars_fragment>
  2015. #include <bumpmap_pars_fragment>
  2016. #include <normalmap_pars_fragment>
  2017. #include <roughnessmap_pars_fragment>
  2018. #include <metalnessmap_pars_fragment>
  2019. #include <logdepthbuf_pars_fragment>
  2020. #include <clipping_planes_pars_fragment>
  2021. void main() {
  2022. #include <clipping_planes_fragment>
  2023. vec4 diffuseColor = vec4( diffuse, opacity );
  2024. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2025. vec3 totalEmissiveRadiance = emissive;
  2026. #include <logdepthbuf_fragment>
  2027. #include <map_fragment>
  2028. #include <color_fragment>
  2029. #include <alphamap_fragment>
  2030. #include <alphatest_fragment>
  2031. #include <specularmap_fragment>
  2032. #include <roughnessmap_fragment>
  2033. #include <metalnessmap_fragment>
  2034. #include <normal_flip>
  2035. #include <normal_fragment>
  2036. #include <emissivemap_fragment>
  2037. #include <lights_physical_fragment>
  2038. #include <lights_template>
  2039. #include <aomap_fragment>
  2040. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  2041. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2042. #include <premultiplied_alpha_fragment>
  2043. #include <tonemapping_fragment>
  2044. #include <encodings_fragment>
  2045. #include <fog_fragment>
  2046. }
  2047. `,xRe=`#define PHYSICAL
  2048. varying vec3 vViewPosition;
  2049. #ifndef FLAT_SHADED
  2050. varying vec3 vNormal;
  2051. #endif
  2052. #include <common>
  2053. #include <uv_pars_vertex>
  2054. #include <uv2_pars_vertex>
  2055. #include <displacementmap_pars_vertex>
  2056. #include <color_pars_vertex>
  2057. #include <morphtarget_pars_vertex>
  2058. #include <skinning_pars_vertex>
  2059. #include <shadowmap_pars_vertex>
  2060. #include <specularmap_pars_fragment>
  2061. #include <logdepthbuf_pars_vertex>
  2062. #include <clipping_planes_pars_vertex>
  2063. void main() {
  2064. #include <uv_vertex>
  2065. #include <uv2_vertex>
  2066. #include <color_vertex>
  2067. #include <beginnormal_vertex>
  2068. #include <morphnormal_vertex>
  2069. #include <skinbase_vertex>
  2070. #include <skinnormal_vertex>
  2071. #include <defaultnormal_vertex>
  2072. #ifndef FLAT_SHADED
  2073. vNormal = normalize( transformedNormal );
  2074. #endif
  2075. #include <begin_vertex>
  2076. #include <displacementmap_vertex>
  2077. #include <morphtarget_vertex>
  2078. #include <skinning_vertex>
  2079. #include <project_vertex>
  2080. #include <logdepthbuf_vertex>
  2081. #include <clipping_planes_vertex>
  2082. vViewPosition = - mvPosition.xyz;
  2083. #include <worldpos_vertex>
  2084. #include <shadowmap_vertex>
  2085. }
  2086. `,SRe=`#define NORMAL
  2087. uniform float opacity;
  2088. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )
  2089. varying vec3 vViewPosition;
  2090. #endif
  2091. #ifndef FLAT_SHADED
  2092. varying vec3 vNormal;
  2093. #endif
  2094. #include <packing>
  2095. #include <uv_pars_fragment>
  2096. #include <bumpmap_pars_fragment>
  2097. #include <normalmap_pars_fragment>
  2098. #include <logdepthbuf_pars_fragment>
  2099. void main() {
  2100. #include <logdepthbuf_fragment>
  2101. #include <normal_flip>
  2102. #include <normal_fragment>
  2103. gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
  2104. #include <premultiplied_alpha_fragment>
  2105. #include <encodings_fragment>
  2106. }
  2107. `,MRe=`#define NORMAL
  2108. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )
  2109. varying vec3 vViewPosition;
  2110. #endif
  2111. #ifndef FLAT_SHADED
  2112. varying vec3 vNormal;
  2113. #endif
  2114. #include <uv_pars_vertex>
  2115. #include <displacementmap_pars_vertex>
  2116. #include <morphtarget_pars_vertex>
  2117. #include <skinning_pars_vertex>
  2118. #include <logdepthbuf_pars_vertex>
  2119. void main() {
  2120. #include <uv_vertex>
  2121. #include <beginnormal_vertex>
  2122. #include <morphnormal_vertex>
  2123. #include <skinbase_vertex>
  2124. #include <skinnormal_vertex>
  2125. #include <defaultnormal_vertex>
  2126. #ifndef FLAT_SHADED
  2127. vNormal = normalize( transformedNormal );
  2128. #endif
  2129. #include <begin_vertex>
  2130. #include <displacementmap_vertex>
  2131. #include <morphtarget_vertex>
  2132. #include <skinning_vertex>
  2133. #include <project_vertex>
  2134. #include <logdepthbuf_vertex>
  2135. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )
  2136. vViewPosition = - mvPosition.xyz;
  2137. #endif
  2138. }
  2139. `,bRe=`uniform vec3 diffuse;
  2140. uniform float opacity;
  2141. #include <common>
  2142. #include <packing>
  2143. #include <color_pars_fragment>
  2144. #include <map_particle_pars_fragment>
  2145. #include <fog_pars_fragment>
  2146. #include <shadowmap_pars_fragment>
  2147. #include <logdepthbuf_pars_fragment>
  2148. #include <clipping_planes_pars_fragment>
  2149. void main() {
  2150. #include <clipping_planes_fragment>
  2151. vec3 outgoingLight = vec3( 0.0 );
  2152. vec4 diffuseColor = vec4( diffuse, opacity );
  2153. #include <logdepthbuf_fragment>
  2154. #include <map_particle_fragment>
  2155. #include <color_fragment>
  2156. #include <alphatest_fragment>
  2157. outgoingLight = diffuseColor.rgb;
  2158. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2159. #include <premultiplied_alpha_fragment>
  2160. #include <tonemapping_fragment>
  2161. #include <encodings_fragment>
  2162. #include <fog_fragment>
  2163. }
  2164. `,wRe=`uniform float size;
  2165. uniform float scale;
  2166. #include <common>
  2167. #include <color_pars_vertex>
  2168. #include <shadowmap_pars_vertex>
  2169. #include <logdepthbuf_pars_vertex>
  2170. #include <clipping_planes_pars_vertex>
  2171. void main() {
  2172. #include <color_vertex>
  2173. #include <begin_vertex>
  2174. #include <project_vertex>
  2175. #ifdef USE_SIZEATTENUATION
  2176. gl_PointSize = size * ( scale / - mvPosition.z );
  2177. #else
  2178. gl_PointSize = size;
  2179. #endif
  2180. #include <logdepthbuf_vertex>
  2181. #include <clipping_planes_vertex>
  2182. #include <worldpos_vertex>
  2183. #include <shadowmap_vertex>
  2184. }
  2185. `,TRe=`uniform float opacity;
  2186. #include <common>
  2187. #include <packing>
  2188. #include <bsdfs>
  2189. #include <lights_pars>
  2190. #include <shadowmap_pars_fragment>
  2191. #include <shadowmask_pars_fragment>
  2192. void main() {
  2193. gl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );
  2194. }
  2195. `,ERe=`#include <shadowmap_pars_vertex>
  2196. void main() {
  2197. #include <begin_vertex>
  2198. #include <project_vertex>
  2199. #include <worldpos_vertex>
  2200. #include <shadowmap_vertex>
  2201. }
  2202. `,Xr={alphamap_fragment:RAe,alphamap_pars_fragment:LAe,alphatest_fragment:PAe,aomap_fragment:DAe,aomap_pars_fragment:IAe,begin_vertex:NAe,beginnormal_vertex:UAe,bsdfs:OAe,bumpmap_pars_fragment:zAe,clipping_planes_fragment:FAe,clipping_planes_pars_fragment:BAe,clipping_planes_pars_vertex:kAe,clipping_planes_vertex:VAe,color_fragment:GAe,color_pars_fragment:HAe,color_pars_vertex:WAe,color_vertex:XAe,common:YAe,cube_uv_reflection_fragment:qAe,defaultnormal_vertex:ZAe,displacementmap_pars_vertex:jAe,displacementmap_vertex:KAe,emissivemap_fragment:JAe,emissivemap_pars_fragment:$Ae,encodings_fragment:QAe,encodings_pars_fragment:eCe,envmap_fragment:tCe,envmap_pars_fragment:rCe,envmap_pars_vertex:iCe,envmap_vertex:nCe,fog_fragment:aCe,fog_pars_fragment:oCe,gradientmap_pars_fragment:sCe,lightmap_fragment:lCe,lightmap_pars_fragment:uCe,lights_lambert_vertex:cCe,lights_pars:fCe,lights_phong_fragment:hCe,lights_phong_pars_fragment:pCe,lights_physical_fragment:dCe,lights_physical_pars_fragment:mCe,lights_template:vCe,logdepthbuf_fragment:gCe,logdepthbuf_pars_fragment:yCe,logdepthbuf_pars_vertex:_Ce,logdepthbuf_vertex:xCe,map_fragment:SCe,map_pars_fragment:MCe,map_particle_fragment:bCe,map_particle_pars_fragment:wCe,metalnessmap_fragment:TCe,metalnessmap_pars_fragment:ECe,morphnormal_vertex:ACe,morphtarget_pars_vertex:CCe,morphtarget_vertex:RCe,normal_flip:LCe,normal_fragment:PCe,normalmap_pars_fragment:DCe,packing:ICe,premultiplied_alpha_fragment:NCe,project_vertex:UCe,roughnessmap_fragment:OCe,roughnessmap_pars_fragment:zCe,shadowmap_pars_fragment:FCe,shadowmap_pars_vertex:BCe,shadowmap_vertex:kCe,shadowmask_pars_fragment:VCe,skinbase_vertex:GCe,skinning_pars_vertex:HCe,skinning_vertex:WCe,skinnormal_vertex:XCe,specularmap_fragment:YCe,specularmap_pars_fragment:qCe,tonemapping_fragment:ZCe,tonemapping_pars_fragment:jCe,uv_pars_fragment:KCe,uv_pars_vertex:JCe,uv_vertex:$Ce,uv2_pars_fragment:QCe,uv2_pars_vertex:eRe,uv2_vertex:tRe,worldpos_vertex:rRe,cube_frag:iRe,cube_vert:nRe,depth_frag:aRe,depth_vert:oRe,distanceRGBA_frag:sRe,distanceRGBA_vert:lRe,equirect_frag:uRe,equirect_vert:cRe,linedashed_frag:fRe,linedashed_vert:hRe,meshbasic_frag:pRe,meshbasic_vert:dRe,meshlambert_frag:mRe,meshlambert_vert:vRe,meshphong_frag:gRe,meshphong_vert:yRe,meshphysical_frag:_Re,meshphysical_vert:xRe,normal_frag:SRe,normal_vert:MRe,points_frag:bRe,points_vert:wRe,shadow_frag:TRe,shadow_vert:ERe};Gt.prototype={constructor:Gt,isColor:!0,r:1,g:1,b:1,set:function(r){return r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r),this},setScalar:function(r){return this.r=r,this.g=r,this.b=r,this},setHex:function(r){return r=Math.floor(r),this.r=(r>>16&255)/255,this.g=(r>>8&255)/255,this.b=(r&255)/255,this},setRGB:function(r,e,t){return this.r=r,this.g=e,this.b=t,this},setHSL:function(){function r(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*6*(2/3-i):e}return function(t,i,n){if(t=cr.euclideanModulo(t,1),i=cr.clamp(i,0,1),n=cr.clamp(n,0,1),i===0)this.r=this.g=this.b=n;else{var a=n<=.5?n*(1+i):n+i-n*i,o=2*n-a;this.r=r(o,a,t+1/3),this.g=r(o,a,t),this.b=r(o,a,t-1/3)}return this}}(),setStyle:function(r){function e(f){f!==void 0&&parseFloat(f)<1&&console.warn("THREE.Color: Alpha component of "+r+" will be ignored.")}var t;if(t=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(r)){var i,n=t[1],a=t[2];switch(n){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(o,s,l)}break}}else if(t=/^\#([A-Fa-f0-9]+)$/.exec(r)){var u=t[1],c=u.length;if(c===3)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(c===6)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(r&&r.length>0){var u=ARe[r];u!==void 0?this.setHex(u):console.warn("THREE.Color: Unknown color "+r)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(r){return this.r=r.r,this.g=r.g,this.b=r.b,this},copyGammaToLinear:function(r,e){return e===void 0&&(e=2),this.r=Math.pow(r.r,e),this.g=Math.pow(r.g,e),this.b=Math.pow(r.b,e),this},copyLinearToGamma:function(r,e){e===void 0&&(e=2);var t=e>0?1/e:1;return this.r=Math.pow(r.r,t),this.g=Math.pow(r.g,t),this.b=Math.pow(r.b,t),this},convertGammaToLinear:function(){var r=this.r,e=this.g,t=this.b;return this.r=r*r,this.g=e*e,this.b=t*t,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(r){var e=r||{h:0,s:0,l:0},t=this.r,i=this.g,n=this.b,a=Math.max(t,i,n),o=Math.min(t,i,n),s,l,u=(o+a)/2;if(o===a)s=0,l=0;else{var c=a-o;switch(l=u<=.5?c/(a+o):c/(2-a-o),a){case t:s=(i-n)/c+(i<n?6:0);break;case i:s=(n-t)/c+2;break;case n:s=(t-i)/c+4;break}s/=6}return e.h=s,e.s=l,e.l=u,e},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(r,e,t){var i=this.getHSL();return i.h+=r,i.s+=e,i.l+=t,this.setHSL(i.h,i.s,i.l),this},add:function(r){return this.r+=r.r,this.g+=r.g,this.b+=r.b,this},addColors:function(r,e){return this.r=r.r+e.r,this.g=r.g+e.g,this.b=r.b+e.b,this},addScalar:function(r){return this.r+=r,this.g+=r,this.b+=r,this},sub:function(r){return this.r=Math.max(0,this.r-r.r),this.g=Math.max(0,this.g-r.g),this.b=Math.max(0,this.b-r.b),this},multiply:function(r){return this.r*=r.r,this.g*=r.g,this.b*=r.b,this},multiplyScalar:function(r){return this.r*=r,this.g*=r,this.b*=r,this},lerp:function(r,e){return this.r+=(r.r-this.r)*e,this.g+=(r.g-this.g)*e,this.b+=(r.b-this.b)*e,this},equals:function(r){return r.r===this.r&&r.g===this.g&&r.b===this.b},fromArray:function(r,e){return e===void 0&&(e=0),this.r=r[e],this.g=r[e+1],this.b=r[e+2],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.r,r[e+1]=this.g,r[e+2]=this.b,r},toJSON:function(){return this.getHex()}};ARe={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,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};Od.prototype=Object.create(ai.prototype);Od.prototype.constructor=Od;Od.prototype.isDataTexture=!0;hr={common:{diffuse:{value:new Gt(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new ei(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},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 St(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 Gt(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Gt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new ei(0,0,1,1)}}},ty={basic:{uniforms:io.merge([hr.common,hr.aomap,hr.lightmap,hr.fog]),vertexShader:Xr.meshbasic_vert,fragmentShader:Xr.meshbasic_frag},lambert:{uniforms:io.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.fog,hr.lights,{emissive:{value:new Gt(0)}}]),vertexShader:Xr.meshlambert_vert,fragmentShader:Xr.meshlambert_frag},phong:{uniforms:io.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.bumpmap,hr.normalmap,hr.displacementmap,hr.gradientmap,hr.fog,hr.lights,{emissive:{value:new Gt(0)},specular:{value:new Gt(1118481)},shininess:{value:30}}]),vertexShader:Xr.meshphong_vert,fragmentShader:Xr.meshphong_frag},standard:{uniforms:io.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.bumpmap,hr.normalmap,hr.displacementmap,hr.roughnessmap,hr.metalnessmap,hr.fog,hr.lights,{emissive:{value:new Gt(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Xr.meshphysical_vert,fragmentShader:Xr.meshphysical_frag},points:{uniforms:io.merge([hr.points,hr.fog]),vertexShader:Xr.points_vert,fragmentShader:Xr.points_frag},dashed:{uniforms:io.merge([hr.common,hr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Xr.linedashed_vert,fragmentShader:Xr.linedashed_frag},depth:{uniforms:io.merge([hr.common,hr.displacementmap]),vertexShader:Xr.depth_vert,fragmentShader:Xr.depth_frag},normal:{uniforms:io.merge([hr.common,hr.bumpmap,hr.normalmap,hr.displacementmap,{opacity:{value:1}}]),vertexShader:Xr.normal_vert,fragmentShader:Xr.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Xr.cube_vert,fragmentShader:Xr.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Xr.equirect_vert,fragmentShader:Xr.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new oe}},vertexShader:Xr.distanceRGBA_vert,fragmentShader:Xr.distanceRGBA_frag}};ty.physical={uniforms:io.merge([ty.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Xr.meshphysical_vert,fragmentShader:Xr.meshphysical_frag};DS.prototype={constructor:DS,set:function(r,e){return this.min.copy(r),this.max.copy(e),this},setFromPoints:function(r){this.makeEmpty();for(var e=0,t=r.length;e<t;e++)this.expandByPoint(r[e]);return this},setFromCenterAndSize:function(){var r=new St;return function(t,i){var n=r.copy(i).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(r){return this.min.copy(r.min),this.max.copy(r.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(r){var e=r||new St;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(r){var e=r||new St;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(r){return this.min.min(r),this.max.max(r),this},expandByVector:function(r){return this.min.sub(r),this.max.add(r),this},expandByScalar:function(r){return this.min.addScalar(-r),this.max.addScalar(r),this},containsPoint:function(r){return!(r.x<this.min.x||r.x>this.max.x||r.y<this.min.y||r.y>this.max.y)},containsBox:function(r){return this.min.x<=r.min.x&&r.max.x<=this.max.x&&this.min.y<=r.min.y&&r.max.y<=this.max.y},getParameter:function(r,e){var t=e||new St;return t.set((r.x-this.min.x)/(this.max.x-this.min.x),(r.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(r){return!(r.max.x<this.min.x||r.min.x>this.max.x||r.max.y<this.min.y||r.min.y>this.max.y)},clampPoint:function(r,e){var t=e||new St;return t.copy(r).clamp(this.min,this.max)},distanceToPoint:function(){var r=new St;return function(t){var i=r.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),intersect:function(r){return this.min.max(r.min),this.max.min(r.max),this},union:function(r){return this.min.min(r.min),this.max.max(r.max),this},translate:function(r){return this.min.add(r),this.max.add(r),this},equals:function(r){return r.min.equals(this.min)&&r.max.equals(this.max)}};LRe=0;mr.prototype={constructor:mr,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(r){r===!0&&this.update(),this._needsUpdate=r},setValues:function(r){if(r!==void 0)for(var e in r){var t=r[e];if(t===void 0){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}var i=this[e];if(i===void 0){console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.");continue}i&&i.isColor?i.set(t):i&&i.isVector3&&t&&t.isVector3?i.copy(t):e==="overdraw"?this[e]=Number(t):this[e]=t}},toJSON:function(r){var e=r===void 0;e&&(r={textures:{},images:{}});var t={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.color&&this.color.isColor&&(t.color=this.color.getHex()),this.roughness!==void 0&&(t.roughness=this.roughness),this.metalness!==void 0&&(t.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(t.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(t.specular=this.specular.getHex()),this.shininess!==void 0&&(t.shininess=this.shininess),this.clearCoat!==void 0&&(t.clearCoat=this.clearCoat),this.clearCoatRoughness!==void 0&&(t.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(t.map=this.map.toJSON(r).uuid),this.alphaMap&&this.alphaMap.isTexture&&(t.alphaMap=this.alphaMap.toJSON(r).uuid),this.lightMap&&this.lightMap.isTexture&&(t.lightMap=this.lightMap.toJSON(r).uuid),this.bumpMap&&this.bumpMap.isTexture&&(t.bumpMap=this.bumpMap.toJSON(r).uuid,t.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(t.normalMap=this.normalMap.toJSON(r).uuid,t.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(t.displacementMap=this.displacementMap.toJSON(r).uuid,t.displacementScale=this.displacementScale,t.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(t.roughnessMap=this.roughnessMap.toJSON(r).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(t.metalnessMap=this.metalnessMap.toJSON(r).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(t.emissiveMap=this.emissiveMap.toJSON(r).uuid),this.specularMap&&this.specularMap.isTexture&&(t.specularMap=this.specularMap.toJSON(r).uuid),this.envMap&&this.envMap.isTexture&&(t.envMap=this.envMap.toJSON(r).uuid,t.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(t.gradientMap=this.gradientMap.toJSON(r).uuid),this.size!==void 0&&(t.size=this.size),this.sizeAttenuation!==void 0&&(t.sizeAttenuation=this.sizeAttenuation),this.blending!==zy&&(t.blending=this.blending),this.shading!==zF&&(t.shading=this.shading),this.side!==Kg&&(t.side=this.side),this.vertexColors!==_C&&(t.vertexColors=this.vertexColors),this.opacity<1&&(t.opacity=this.opacity),this.transparent===!0&&(t.transparent=this.transparent),t.depthFunc=this.depthFunc,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,this.alphaTest>0&&(t.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(t.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(t.wireframe=this.wireframe),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(t.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(t.wireframeLinejoin=this.wireframeLinejoin),t.skinning=this.skinning,t.morphTargets=this.morphTargets;function i(o){var s=[];for(var l in o){var u=o[l];delete u.metadata,s.push(u)}return s}if(e){var n=i(r.textures),a=i(r.images);n.length>0&&(t.textures=n),a.length>0&&(t.images=a)}return t},clone:function(){return new this.constructor().copy(this)},copy:function(r){this.name=r.name,this.fog=r.fog,this.lights=r.lights,this.blending=r.blending,this.side=r.side,this.shading=r.shading,this.vertexColors=r.vertexColors,this.opacity=r.opacity,this.transparent=r.transparent,this.blendSrc=r.blendSrc,this.blendDst=r.blendDst,this.blendEquation=r.blendEquation,this.blendSrcAlpha=r.blendSrcAlpha,this.blendDstAlpha=r.blendDstAlpha,this.blendEquationAlpha=r.blendEquationAlpha,this.depthFunc=r.depthFunc,this.depthTest=r.depthTest,this.depthWrite=r.depthWrite,this.colorWrite=r.colorWrite,this.precision=r.precision,this.polygonOffset=r.polygonOffset,this.polygonOffsetFactor=r.polygonOffsetFactor,this.polygonOffsetUnits=r.polygonOffsetUnits,this.alphaTest=r.alphaTest,this.premultipliedAlpha=r.premultipliedAlpha,this.overdraw=r.overdraw,this.visible=r.visible,this.clipShadows=r.clipShadows,this.clipIntersection=r.clipIntersection;var e=r.clippingPlanes,t=null;if(e!==null){var i=e.length;t=new Array(i);for(var n=0;n!==i;++n)t[n]=e[n].clone()}return this.clippingPlanes=t,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};Object.assign(mr.prototype,bs.prototype);Ma.prototype=Object.create(mr.prototype);Ma.prototype.constructor=Ma;Ma.prototype.isShaderMaterial=!0;Ma.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.fragmentShader=r.fragmentShader,this.vertexShader=r.vertexShader,this.uniforms=io.clone(r.uniforms),this.defines=r.defines,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.lights=r.lights,this.clipping=r.clipping,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this.extensions=r.extensions,this};Ma.prototype.toJSON=function(r){var e=mr.prototype.toJSON.call(this,r);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e};bh.prototype=Object.create(mr.prototype);bh.prototype.constructor=bh;bh.prototype.isMeshDepthMaterial=!0;bh.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.depthPacking=r.depthPacking,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.map=r.map,this.alphaMap=r.alphaMap,this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this};su.prototype={constructor:su,isBox3:!0,set:function(r,e){return this.min.copy(r),this.max.copy(e),this},setFromArray:function(r){for(var e=1/0,t=1/0,i=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,l=r.length;s<l;s+=3){var u=r[s],c=r[s+1],f=r[s+2];u<e&&(e=u),c<t&&(t=c),f<i&&(i=f),u>n&&(n=u),c>a&&(a=c),f>o&&(o=f)}this.min.set(e,t,i),this.max.set(n,a,o)},setFromBufferAttribute:function(r){for(var e=1/0,t=1/0,i=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,l=r.count;s<l;s++){var u=r.getX(s),c=r.getY(s),f=r.getZ(s);u<e&&(e=u),c<t&&(t=c),f<i&&(i=f),u>n&&(n=u),c>a&&(a=c),f>o&&(o=f)}this.min.set(e,t,i),this.max.set(n,a,o)},setFromPoints:function(r){this.makeEmpty();for(var e=0,t=r.length;e<t;e++)this.expandByPoint(r[e]);return this},setFromCenterAndSize:function(){var r=new oe;return function(t,i){var n=r.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),setFromObject:function(){var r=new oe;return function(t){var i=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(n){var a,o,s=n.geometry;if(s!==void 0){if(s.isGeometry){var l=s.vertices;for(a=0,o=l.length;a<o;a++)r.copy(l[a]),r.applyMatrix4(n.matrixWorld),i.expandByPoint(r)}else if(s.isBufferGeometry){var u=s.attributes.position;if(u!==void 0)for(a=0,o=u.count;a<o;a++)r.fromAttribute(u,a).applyMatrix4(n.matrixWorld),i.expandByPoint(r)}}}),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.min.copy(r.min),this.max.copy(r.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(r){var e=r||new oe;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(r){var e=r||new oe;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(r){return this.min.min(r),this.max.max(r),this},expandByVector:function(r){return this.min.sub(r),this.max.add(r),this},expandByScalar:function(r){return this.min.addScalar(-r),this.max.addScalar(r),this},containsPoint:function(r){return!(r.x<this.min.x||r.x>this.max.x||r.y<this.min.y||r.y>this.max.y||r.z<this.min.z||r.z>this.max.z)},containsBox:function(r){return this.min.x<=r.min.x&&r.max.x<=this.max.x&&this.min.y<=r.min.y&&r.max.y<=this.max.y&&this.min.z<=r.min.z&&r.max.z<=this.max.z},getParameter:function(r,e){var t=e||new oe;return t.set((r.x-this.min.x)/(this.max.x-this.min.x),(r.y-this.min.y)/(this.max.y-this.min.y),(r.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(r){return!(r.max.x<this.min.x||r.min.x>this.max.x||r.max.y<this.min.y||r.min.y>this.max.y||r.max.z<this.min.z||r.min.z>this.max.z)},intersectsSphere:function(){var r;return function(t){return r===void 0&&(r=new oe),this.clampPoint(t.center,r),r.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(r){var e,t;return r.normal.x>0?(e=r.normal.x*this.min.x,t=r.normal.x*this.max.x):(e=r.normal.x*this.max.x,t=r.normal.x*this.min.x),r.normal.y>0?(e+=r.normal.y*this.min.y,t+=r.normal.y*this.max.y):(e+=r.normal.y*this.max.y,t+=r.normal.y*this.min.y),r.normal.z>0?(e+=r.normal.z*this.min.z,t+=r.normal.z*this.max.z):(e+=r.normal.z*this.max.z,t+=r.normal.z*this.min.z),e<=r.constant&&t>=r.constant},clampPoint:function(r,e){var t=e||new oe;return t.copy(r).clamp(this.min,this.max)},distanceToPoint:function(){var r=new oe;return function(t){var i=r.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),getBoundingSphere:function(){var r=new oe;return function(t){var i=t||new $n;return this.getCenter(i.center),i.radius=this.getSize(r).length()*.5,i}}(),intersect:function(r){return this.min.max(r.min),this.max.min(r.max),this.isEmpty()&&this.makeEmpty(),this},union:function(r){return this.min.min(r.min),this.max.max(r.max),this},applyMatrix4:function(){var r=[new oe,new oe,new oe,new oe,new oe,new oe,new oe,new oe];return function(t){return this.isEmpty()?this:(r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(r),this)}}(),translate:function(r){return this.min.add(r),this.max.add(r),this},equals:function(r){return r.min.equals(this.min)&&r.max.equals(this.max)}};$n.prototype={constructor:$n,set:function(r,e){return this.center.copy(r),this.radius=e,this},setFromPoints:function(){var r=new su;return function(t,i){var n=this.center;i!==void 0?n.copy(i):r.setFromPoints(t).getCenter(n);for(var a=0,o=0,s=t.length;o<s;o++)a=Math.max(a,n.distanceToSquared(t[o]));return this.radius=Math.sqrt(a),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.center.copy(r.center),this.radius=r.radius,this},empty:function(){return this.radius<=0},containsPoint:function(r){return r.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(r){return r.distanceTo(this.center)-this.radius},intersectsSphere:function(r){var e=this.radius+r.radius;return r.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(r){return r.intersectsSphere(this)},intersectsPlane:function(r){return Math.abs(this.center.dot(r.normal)-r.constant)<=this.radius},clampPoint:function(r,e){var t=this.center.distanceToSquared(r),i=e||new oe;return i.copy(r),t>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(r){var e=r||new su;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(r){return this.center.applyMatrix4(r),this.radius=this.radius*r.getMaxScaleOnAxis(),this},translate:function(r){return this.center.add(r),this},equals:function(r){return r.center.equals(this.center)&&r.radius===this.radius}};ws.prototype={constructor:ws,isMatrix3:!0,set:function(r,e,t,i,n,a,o,s,l){var u=this.elements;return u[0]=r,u[1]=i,u[2]=o,u[3]=e,u[4]=n,u[5]=s,u[6]=t,u[7]=a,u[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(r){var e=r.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(r){var e=r.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var r;return function(t,i,n){r===void 0&&(r=new oe),i===void 0&&(i=0),n===void 0&&(n=t.length);for(var a=0,o=i;a<n;a+=3,o+=3)r.fromArray(t,o),r.applyMatrix3(this),r.toArray(t,o);return t}}(),applyToBufferAttribute:function(){var r;return function(t){r===void 0&&(r=new oe);for(var i=0,n=t.count;i<n;i++)r.x=t.getX(i),r.y=t.getY(i),r.z=t.getZ(i),r.applyMatrix3(this),t.setXYZ(i,r.x,r.y,r.z);return t}}(),multiplyScalar:function(r){var e=this.elements;return e[0]*=r,e[3]*=r,e[6]*=r,e[1]*=r,e[4]*=r,e[7]*=r,e[2]*=r,e[5]*=r,e[8]*=r,this},determinant:function(){var r=this.elements,e=r[0],t=r[1],i=r[2],n=r[3],a=r[4],o=r[5],s=r[6],l=r[7],u=r[8];return e*a*u-e*o*l-t*n*u+t*o*s+i*n*l-i*a*s},getInverse:function(r,e){r&&r.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var t=r.elements,i=this.elements,n=t[0],a=t[1],o=t[2],s=t[3],l=t[4],u=t[5],c=t[6],f=t[7],h=t[8],p=h*l-u*f,d=u*c-h*s,g=f*s-l*c,m=n*p+a*d+o*g;if(m===0){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(v);return console.warn(v),this.identity()}var _=1/m;return i[0]=p*_,i[1]=(o*f-h*a)*_,i[2]=(u*a-o*l)*_,i[3]=d*_,i[4]=(h*n-o*c)*_,i[5]=(o*s-u*n)*_,i[6]=g*_,i[7]=(a*c-f*n)*_,i[8]=(l*n-a*s)*_,this},transpose:function(){var r,e=this.elements;return r=e[1],e[1]=e[3],e[3]=r,r=e[2],e[2]=e[6],e[6]=r,r=e[5],e[5]=e[7],e[7]=r,this},getNormalMatrix:function(r){return this.setFromMatrix4(r).getInverse(this).transpose()},transposeIntoArray:function(r){var e=this.elements;return r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8],this},fromArray:function(r,e){e===void 0&&(e=0);for(var t=0;t<9;t++)this.elements[t]=r[t+e];return this},toArray:function(r,e){r===void 0&&(r=[]),e===void 0&&(e=0);var t=this.elements;return r[e]=t[0],r[e+1]=t[1],r[e+2]=t[2],r[e+3]=t[3],r[e+4]=t[4],r[e+5]=t[5],r[e+6]=t[6],r[e+7]=t[7],r[e+8]=t[8],r}};Io.prototype={constructor:Io,set:function(r,e){return this.normal.copy(r),this.constant=e,this},setComponents:function(r,e,t,i){return this.normal.set(r,e,t),this.constant=i,this},setFromNormalAndCoplanarPoint:function(r,e){return this.normal.copy(r),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var r=new oe,e=new oe;return function(i,n,a){var o=r.subVectors(a,n).cross(e.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(o,i),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.normal.copy(r.normal),this.constant=r.constant,this},normalize:function(){var r=1/this.normal.length();return this.normal.multiplyScalar(r),this.constant*=r,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(r){return this.normal.dot(r)+this.constant},distanceToSphere:function(r){return this.distanceToPoint(r.center)-r.radius},projectPoint:function(r,e){return this.orthoPoint(r,e).sub(r).negate()},orthoPoint:function(r,e){var t=this.distanceToPoint(r),i=e||new oe;return i.copy(this.normal).multiplyScalar(t)},intersectLine:function(){var r=new oe;return function(t,i){var n=i||new oe,a=t.delta(r),o=this.normal.dot(a);if(o===0)return this.distanceToPoint(t.start)===0?n.copy(t.start):void 0;var s=-(t.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return n.copy(a).multiplyScalar(s).add(t.start)}}(),intersectsLine:function(r){var e=this.distanceToPoint(r.start),t=this.distanceToPoint(r.end);return e<0&&t>0||t<0&&e>0},intersectsBox:function(r){return r.intersectsPlane(this)},intersectsSphere:function(r){return r.intersectsPlane(this)},coplanarPoint:function(r){var e=r||new oe;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var r=new oe,e=new ws;return function(i,n){var a=this.coplanarPoint(r).applyMatrix4(i),o=n||e.getNormalMatrix(i),s=this.normal.applyMatrix3(o).normalize();return this.constant=-a.dot(s),this}}(),translate:function(r){return this.constant=this.constant-r.dot(this.normal),this},equals:function(r){return r.normal.equals(this.normal)&&r.constant===this.constant}};IS.prototype={constructor:IS,set:function(r,e,t,i,n,a){var o=this.planes;return o[0].copy(r),o[1].copy(e),o[2].copy(t),o[3].copy(i),o[4].copy(n),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){for(var e=this.planes,t=0;t<6;t++)e[t].copy(r.planes[t]);return this},setFromMatrix:function(r){var e=this.planes,t=r.elements,i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],f=t[8],h=t[9],p=t[10],d=t[11],g=t[12],m=t[13],v=t[14],_=t[15];return e[0].setComponents(o-i,c-s,d-f,_-g).normalize(),e[1].setComponents(o+i,c+s,d+f,_+g).normalize(),e[2].setComponents(o+n,c+l,d+h,_+m).normalize(),e[3].setComponents(o-n,c-l,d-h,_-m).normalize(),e[4].setComponents(o-a,c-u,d-p,_-v).normalize(),e[5].setComponents(o+a,c+u,d+p,_+v).normalize(),this},intersectsObject:function(){var r=new $n;return function(t){var i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),r.copy(i.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(r)}}(),intersectsSprite:function(){var r=new $n;return function(t){return r.center.set(0,0,0),r.radius=.7071067811865476,r.applyMatrix4(t.matrixWorld),this.intersectsSphere(r)}}(),intersectsSphere:function(r){for(var e=this.planes,t=r.center,i=-r.radius,n=0;n<6;n++){var a=e[n].distanceToPoint(t);if(a<i)return!1}return!0},intersectsBox:function(){var r=new oe,e=new oe;return function(i){for(var n=this.planes,a=0;a<6;a++){var o=n[a];r.x=o.normal.x>0?i.min.x:i.max.x,e.x=o.normal.x>0?i.max.x:i.min.x,r.y=o.normal.y>0?i.min.y:i.max.y,e.y=o.normal.y>0?i.max.y:i.min.y,r.z=o.normal.z>0?i.min.z:i.max.z,e.z=o.normal.z>0?i.max.z:i.min.z;var s=o.distanceToPoint(r),l=o.distanceToPoint(e);if(s<0&&l<0)return!1}return!0}}(),containsPoint:function(r){for(var e=this.planes,t=0;t<6;t++)if(e[t].distanceToPoint(r)<0)return!1;return!0}};wh.prototype={constructor:wh,set:function(r,e){return this.origin.copy(r),this.direction.copy(e),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.origin.copy(r.origin),this.direction.copy(r.direction),this},at:function(r,e){var t=e||new oe;return t.copy(this.direction).multiplyScalar(r).add(this.origin)},lookAt:function(r){return this.direction.copy(r).sub(this.origin).normalize(),this},recast:function(){var r=new oe;return function(t){return this.origin.copy(this.at(t,r)),this}}(),closestPointToPoint:function(r,e){var t=e||new oe;t.subVectors(r,this.origin);var i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(r){return Math.sqrt(this.distanceSqToPoint(r))},distanceSqToPoint:function(){var r=new oe;return function(t){var i=r.subVectors(t,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(t):(r.copy(this.direction).multiplyScalar(i).add(this.origin),r.distanceToSquared(t))}}(),distanceSqToSegment:function(){var r=new oe,e=new oe,t=new oe;return function(n,a,o,s){r.copy(n).add(a).multiplyScalar(.5),e.copy(a).sub(n).normalize(),t.copy(this.origin).sub(r);var l=n.distanceTo(a)*.5,u=-this.direction.dot(e),c=t.dot(this.direction),f=-t.dot(e),h=t.lengthSq(),p=Math.abs(1-u*u),d,g,m,v;if(p>0)if(d=u*f-c,g=u*c-f,v=l*p,d>=0)if(g>=-v)if(g<=v){var _=1/p;d*=_,g*=_,m=d*(d+u*g+2*c)+g*(u*d+g+2*f)+h}else g=l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*f)+h;else g=-l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*f)+h;else g<=-v?(d=Math.max(0,-(-u*l+c)),g=d>0?-l:Math.min(Math.max(-l,-f),l),m=-d*d+g*(g+2*f)+h):g<=v?(d=0,g=Math.min(Math.max(-l,-f),l),m=g*(g+2*f)+h):(d=Math.max(0,-(u*l+c)),g=d>0?l:Math.min(Math.max(-l,-f),l),m=-d*d+g*(g+2*f)+h);else g=u>0?-l:l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*f)+h;return o&&o.copy(this.direction).multiplyScalar(d).add(this.origin),s&&s.copy(e).multiplyScalar(g).add(r),m}}(),intersectSphere:function(){var r=new oe;return function(t,i){r.subVectors(t.center,this.origin);var n=r.dot(this.direction),a=r.dot(r)-n*n,o=t.radius*t.radius;if(a>o)return null;var s=Math.sqrt(o-a),l=n-s,u=n+s;return l<0&&u<0?null:l<0?this.at(u,i):this.at(l,i)}}(),intersectsSphere:function(r){return this.distanceToPoint(r.center)<=r.radius},distanceToPlane:function(r){var e=r.normal.dot(this.direction);if(e===0)return r.distanceToPoint(this.origin)===0?0:null;var t=-(this.origin.dot(r.normal)+r.constant)/e;return t>=0?t:null},intersectPlane:function(r,e){var t=this.distanceToPlane(r);return t===null?null:this.at(t,e)},intersectsPlane:function(r){var e=r.distanceToPoint(this.origin);if(e===0)return!0;var t=r.normal.dot(this.direction);return t*e<0},intersectBox:function(r,e){var t,i,n,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,f=this.origin;return l>=0?(t=(r.min.x-f.x)*l,i=(r.max.x-f.x)*l):(t=(r.max.x-f.x)*l,i=(r.min.x-f.x)*l),u>=0?(n=(r.min.y-f.y)*u,a=(r.max.y-f.y)*u):(n=(r.max.y-f.y)*u,a=(r.min.y-f.y)*u),t>a||n>i||((n>t||t!==t)&&(t=n),(a<i||i!==i)&&(i=a),c>=0?(o=(r.min.z-f.z)*c,s=(r.max.z-f.z)*c):(o=(r.max.z-f.z)*c,s=(r.min.z-f.z)*c),t>s||o>i)||((o>t||t!==t)&&(t=o),(s<i||i!==i)&&(i=s),i<0)?null:this.at(t>=0?t:i,e)},intersectsBox:function(){var r=new oe;return function(t){return this.intersectBox(t,r)!==null}}(),intersectTriangle:function(){var r=new oe,e=new oe,t=new oe,i=new oe;return function(a,o,s,l,u){e.subVectors(o,a),t.subVectors(s,a),i.crossVectors(e,t);var c=this.direction.dot(i),f;if(c>0){if(l)return null;f=1}else if(c<0)f=-1,c=-c;else return null;r.subVectors(this.origin,a);var h=f*this.direction.dot(t.crossVectors(r,t));if(h<0)return null;var p=f*this.direction.dot(e.cross(r));if(p<0||h+p>c)return null;var d=-f*r.dot(i);return d<0?null:this.at(d/c,u)}}(),applyMatrix4:function(r){return this.direction.add(this.origin).applyMatrix4(r),this.origin.applyMatrix4(r),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(r){return r.origin.equals(this.origin)&&r.direction.equals(this.direction)}};Th.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];Th.DefaultOrder="XYZ";Th.prototype={constructor:Th,isEuler:!0,get x(){return this._x},set x(r){this._x=r,this.onChangeCallback()},get y(){return this._y},set y(r){this._y=r,this.onChangeCallback()},get z(){return this._z},set z(r){this._z=r,this.onChangeCallback()},get order(){return this._order},set order(r){this._order=r,this.onChangeCallback()},set:function(r,e,t,i){return this._x=r,this._y=e,this._z=t,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(r){return this._x=r._x,this._y=r._y,this._z=r._z,this._order=r._order,this.onChangeCallback(),this},setFromRotationMatrix:function(r,e,t){var i=cr.clamp,n=r.elements,a=n[0],o=n[4],s=n[8],l=n[1],u=n[5],c=n[9],f=n[2],h=n[6],p=n[10];return e=e||this._order,e==="XYZ"?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(h,u),this._z=0)):e==="YXZ"?(this._x=Math.asin(-i(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-f,a),this._z=0)):e==="ZXY"?(this._x=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,a))):e==="ZYX"?(this._y=Math.asin(-i(f,-1,1)),Math.abs(f)<.99999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,u))):e==="YZX"?(this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-f,a)):(this._x=0,this._y=Math.atan2(s,p))):e==="XZY"?(this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(h,u),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,t!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeRotationFromQuaternion(t),this.setFromRotationMatrix(r,i,n)}}(),setFromVector3:function(r,e){return this.set(r.x,r.y,r.z,e||this._order)},reorder:function(){var r=new on;return function(t){return r.setFromEuler(this),this.setFromQuaternion(r,t)}}(),equals:function(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._order===this._order},fromArray:function(r){return this._x=r[0],this._y=r[1],this._z=r[2],r[3]!==void 0&&(this._order=r[3]),this.onChangeCallback(),this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this._x,r[e+1]=this._y,r[e+2]=this._z,r[e+3]=this._order,r},toVector3:function(r){return r?r.set(this._x,this._y,this._z):new oe(this._x,this._y,this._z)},onChange:function(r){return this.onChangeCallback=r,this},onChangeCallback:function(){}};ZA.prototype={constructor:ZA,set:function(r){this.mask=1<<r},enable:function(r){this.mask|=1<<r},toggle:function(r){this.mask^=1<<r},disable:function(r){this.mask&=~(1<<r)},test:function(r){return(this.mask&r.mask)!==0}};PRe=0;At.DefaultUp=new oe(0,1,0);At.DefaultMatrixAutoUpdate=!0;Object.assign(At.prototype,bs.prototype,{isObject3D:!0,applyMatrix:function(r){this.matrix.multiplyMatrices(r,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(r,e){this.quaternion.setFromAxisAngle(r,e)},setRotationFromEuler:function(r){this.quaternion.setFromEuler(r,!0)},setRotationFromMatrix:function(r){this.quaternion.setFromRotationMatrix(r)},setRotationFromQuaternion:function(r){this.quaternion.copy(r)},rotateOnAxis:function(){var r=new on;return function(t,i){return r.setFromAxisAngle(t,i),this.quaternion.multiply(r),this}}(),rotateX:function(){var r=new oe(1,0,0);return function(t){return this.rotateOnAxis(r,t)}}(),rotateY:function(){var r=new oe(0,1,0);return function(t){return this.rotateOnAxis(r,t)}}(),rotateZ:function(){var r=new oe(0,0,1);return function(t){return this.rotateOnAxis(r,t)}}(),translateOnAxis:function(){var r=new oe;return function(t,i){return r.copy(t).applyQuaternion(this.quaternion),this.position.add(r.multiplyScalar(i)),this}}(),translateX:function(){var r=new oe(1,0,0);return function(t){return this.translateOnAxis(r,t)}}(),translateY:function(){var r=new oe(0,1,0);return function(t){return this.translateOnAxis(r,t)}}(),translateZ:function(){var r=new oe(0,0,1);return function(t){return this.translateOnAxis(r,t)}}(),localToWorld:function(r){return r.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var r=new qt;return function(t){return t.applyMatrix4(r.getInverse(this.matrixWorld))}}(),lookAt:function(){var r=new qt;return function(t){r.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(r)}}(),add:function(r){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return r===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",r),this):(r&&r.isObject3D?(r.parent!==null&&r.parent.remove(r),r.parent=this,r.dispatchEvent({type:"added"}),this.children.push(r)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",r),this)},remove:function(r){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var t=this.children.indexOf(r);t!==-1&&(r.parent=null,r.dispatchEvent({type:"removed"}),this.children.splice(t,1))},getObjectById:function(r){return this.getObjectByProperty("id",r)},getObjectByName:function(r){return this.getObjectByProperty("name",r)},getObjectByProperty:function(r,e){if(this[r]===e)return this;for(var t=0,i=this.children.length;t<i;t++){var n=this.children[t],a=n.getObjectByProperty(r,e);if(a!==void 0)return a}},getWorldPosition:function(r){var e=r||new oe;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var r=new oe,e=new oe;return function(i){var n=i||new on;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,n,e),n}}(),getWorldRotation:function(){var r=new on;return function(t){var i=t||new Th;return this.getWorldQuaternion(r),i.setFromQuaternion(r,this.rotation.order,!1)}}(),getWorldScale:function(){var r=new oe,e=new on;return function(i){var n=i||new oe;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,e,n),n}}(),getWorldDirection:function(){var r=new on;return function(t){var i=t||new oe;return this.getWorldQuaternion(r),i.set(0,0,1).applyQuaternion(r)}}(),raycast:function(){},traverse:function(r){r(this);for(var e=this.children,t=0,i=e.length;t<i;t++)e[t].traverse(r)},traverseVisible:function(r){if(this.visible!==!1){r(this);for(var e=this.children,t=0,i=e.length;t<i;t++)e[t].traverseVisible(r)}},traverseAncestors:function(r){var e=this.parent;e!==null&&(r(e),e.traverseAncestors(r))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(r){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||r===!0)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,r=!0);for(var e=this.children,t=0,i=e.length;t<i;t++)e[t].updateMatrixWorld(r)},toJSON:function(r){var e=r===void 0||r==="",t={};e&&(r={geometries:{},materials:{},textures:{},images:{}},t.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),i.matrix=this.matrix.toArray(),this.geometry!==void 0&&(r.geometries[this.geometry.uuid]===void 0&&(r.geometries[this.geometry.uuid]=this.geometry.toJSON(r)),i.geometry=this.geometry.uuid),this.material!==void 0&&(r.materials[this.material.uuid]===void 0&&(r.materials[this.material.uuid]=this.material.toJSON(r)),i.material=this.material.uuid),this.children.length>0){i.children=[];for(var n=0;n<this.children.length;n++)i.children.push(this.children[n].toJSON(r).object)}if(e){var a=u(r.geometries),o=u(r.materials),s=u(r.textures),l=u(r.images);a.length>0&&(t.geometries=a),o.length>0&&(t.materials=o),s.length>0&&(t.textures=s),l.length>0&&(t.images=l)}return t.object=i,t;function u(c){var f=[];for(var h in c){var p=c[h];delete p.metadata,f.push(p)}return f}},clone:function(r){return new this.constructor().copy(this,r)},copy:function(r,e){if(e===void 0&&(e=!0),this.name=r.name,this.up.copy(r.up),this.position.copy(r.position),this.quaternion.copy(r.quaternion),this.scale.copy(r.scale),this.matrix.copy(r.matrix),this.matrixWorld.copy(r.matrixWorld),this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrixWorldNeedsUpdate=r.matrixWorldNeedsUpdate,this.layers.mask=r.layers.mask,this.visible=r.visible,this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.frustumCulled=r.frustumCulled,this.renderOrder=r.renderOrder,this.userData=JSON.parse(JSON.stringify(r.userData)),e===!0)for(var t=0;t<r.children.length;t++){var i=r.children[t];this.add(i.clone())}return this}});Pd.prototype={constructor:Pd,set:function(r,e){return this.start.copy(r),this.end.copy(e),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.start.copy(r.start),this.end.copy(r.end),this},getCenter:function(r){var e=r||new oe;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(r){var e=r||new oe;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(r,e){var t=e||new oe;return this.delta(t).multiplyScalar(r).add(this.start)},closestPointToPointParameter:function(){var r=new oe,e=new oe;return function(i,n){r.subVectors(i,this.start),e.subVectors(this.end,this.start);var a=e.dot(e),o=e.dot(r),s=o/a;return n&&(s=cr.clamp(s,0,1)),s}}(),closestPointToPoint:function(r,e,t){var i=this.closestPointToPointParameter(r,e),n=t||new oe;return this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(r){return this.start.applyMatrix4(r),this.end.applyMatrix4(r),this},equals:function(r){return r.start.equals(this.start)&&r.end.equals(this.end)}};Ms.normal=function(){var r=new oe;return function(t,i,n,a){var o=a||new oe;o.subVectors(n,i),r.subVectors(t,i),o.cross(r);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}();Ms.barycoordFromPoint=function(){var r=new oe,e=new oe,t=new oe;return function(n,a,o,s,l){r.subVectors(s,a),e.subVectors(o,a),t.subVectors(n,a);var u=r.dot(r),c=r.dot(e),f=r.dot(t),h=e.dot(e),p=e.dot(t),d=u*h-c*c,g=l||new oe;if(d===0)return g.set(-2,-1,-1);var m=1/d,v=(h*f-c*p)*m,_=(u*p-c*f)*m;return g.set(1-v-_,_,v)}}();Ms.containsPoint=function(){var r=new oe;return function(t,i,n,a){var o=Ms.barycoordFromPoint(t,i,n,a,r);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}();Ms.prototype={constructor:Ms,set:function(r,e,t){return this.a.copy(r),this.b.copy(e),this.c.copy(t),this},setFromPointsAndIndices:function(r,e,t,i){return this.a.copy(r[e]),this.b.copy(r[t]),this.c.copy(r[i]),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.a.copy(r.a),this.b.copy(r.b),this.c.copy(r.c),this},area:function(){var r=new oe,e=new oe;return function(){return r.subVectors(this.c,this.b),e.subVectors(this.a,this.b),r.cross(e).length()*.5}}(),midpoint:function(r){var e=r||new oe;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(r){return Ms.normal(this.a,this.b,this.c,r)},plane:function(r){var e=r||new Io;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(r,e){return Ms.barycoordFromPoint(r,this.a,this.b,this.c,e)},containsPoint:function(r){return Ms.containsPoint(r,this.a,this.b,this.c)},closestPointToPoint:function(){var r,e,t,i;return function(a,o){r===void 0&&(r=new Io,e=[new Pd,new Pd,new Pd],t=new oe,i=new oe);var s=o||new oe,l=1/0;if(r.setFromCoplanarPoints(this.a,this.b,this.c),r.projectPoint(a,t),this.containsPoint(t)===!0)s.copy(t);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;u<e.length;u++){e[u].closestPointToPoint(t,!0,i);var c=t.distanceToSquared(i);c<l&&(l=c,s.copy(i))}}return s}}(),equals:function(r){return r.a.equals(this.a)&&r.b.equals(this.b)&&r.c.equals(this.c)}};zo.prototype={constructor:zo,clone:function(){return new this.constructor().copy(this)},copy:function(r){this.a=r.a,this.b=r.b,this.c=r.c,this.normal.copy(r.normal),this.color.copy(r.color),this.materialIndex=r.materialIndex;for(var e=0,t=r.vertexNormals.length;e<t;e++)this.vertexNormals[e]=r.vertexNormals[e].clone();for(var e=0,t=r.vertexColors.length;e<t;e++)this.vertexColors[e]=r.vertexColors[e].clone();return this}};oo.prototype=Object.create(mr.prototype);oo.prototype.constructor=oo;oo.prototype.isMeshBasicMaterial=!0;oo.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this};gt.prototype={constructor:gt,isBufferAttribute:!0,set needsUpdate(r){r===!0&&this.version++},setArray:function(r){if(Array.isArray(r))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=r!==void 0?r.length/this.itemSize:0,this.array=r},setDynamic:function(r){return this.dynamic=r,this},copy:function(r){return this.array=new r.array.constructor(r.array),this.itemSize=r.itemSize,this.count=r.count,this.normalized=r.normalized,this.dynamic=r.dynamic,this},copyAt:function(r,e,t){r*=this.itemSize,t*=e.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[r+i]=e.array[t+i];return this},copyArray:function(r){return this.array.set(r),this},copyColorsArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new Gt),e[t++]=a.r,e[t++]=a.g,e[t++]=a.b}return this},copyIndicesArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];e[t++]=a.a,e[t++]=a.b,e[t++]=a.c}return this},copyVector2sArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new St),e[t++]=a.x,e[t++]=a.y}return this},copyVector3sArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new oe),e[t++]=a.x,e[t++]=a.y,e[t++]=a.z}return this},copyVector4sArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new ei),e[t++]=a.x,e[t++]=a.y,e[t++]=a.z,e[t++]=a.w}return this},set:function(r,e){return e===void 0&&(e=0),this.array.set(r,e),this},getX:function(r){return this.array[r*this.itemSize]},setX:function(r,e){return this.array[r*this.itemSize]=e,this},getY:function(r){return this.array[r*this.itemSize+1]},setY:function(r,e){return this.array[r*this.itemSize+1]=e,this},getZ:function(r){return this.array[r*this.itemSize+2]},setZ:function(r,e){return this.array[r*this.itemSize+2]=e,this},getW:function(r){return this.array[r*this.itemSize+3]},setW:function(r,e){return this.array[r*this.itemSize+3]=e,this},setXY:function(r,e,t){return r*=this.itemSize,this.array[r+0]=e,this.array[r+1]=t,this},setXYZ:function(r,e,t,i){return r*=this.itemSize,this.array[r+0]=e,this.array[r+1]=t,this.array[r+2]=i,this},setXYZW:function(r,e,t,i,n){return r*=this.itemSize,this.array[r+0]=e,this.array[r+1]=t,this.array[r+2]=i,this.array[r+3]=n,this},onUpload:function(r){return this.onUploadCallback=r,this},clone:function(){return new this.constructor().copy(this)}};NS.prototype=Object.create(gt.prototype);NS.prototype.constructor=NS;US.prototype=Object.create(gt.prototype);US.prototype.constructor=US;OS.prototype=Object.create(gt.prototype);OS.prototype.constructor=OS;zS.prototype=Object.create(gt.prototype);zS.prototype.constructor=zS;ic.prototype=Object.create(gt.prototype);ic.prototype.constructor=ic;FS.prototype=Object.create(gt.prototype);FS.prototype.constructor=FS;nc.prototype=Object.create(gt.prototype);nc.prototype.constructor=nc;gr.prototype=Object.create(gt.prototype);gr.prototype.constructor=gr;BS.prototype=Object.create(gt.prototype);BS.prototype.constructor=BS;Object.assign(Xne.prototype,{computeGroups:function(r){for(var e,t=[],i=void 0,n=r.faces,a=0;a<n.length;a++){var o=n[a];o.materialIndex!==i&&(i=o.materialIndex,e!==void 0&&(e.count=a*3-e.start,t.push(e)),e={start:a*3,materialIndex:i})}e!==void 0&&(e.count=a*3-e.start,t.push(e)),this.groups=t},fromGeometry:function(r){var e=r.faces,t=r.vertices,i=r.faceVertexUvs,n=i[0]&&i[0].length>0,a=i[1]&&i[1].length>0,o=r.morphTargets,s=o.length,l;if(s>0){l=[];for(var u=0;u<s;u++)l[u]=[];this.morphTargets.position=l}var c=r.morphNormals,f=c.length,h;if(f>0){h=[];for(var u=0;u<f;u++)h[u]=[];this.morphTargets.normal=h}for(var p=r.skinIndices,d=r.skinWeights,g=p.length===t.length,m=d.length===t.length,u=0;u<e.length;u++){var v=e[u];this.vertices.push(t[v.a],t[v.b],t[v.c]);var _=v.vertexNormals;if(_.length===3)this.normals.push(_[0],_[1],_[2]);else{var y=v.normal;this.normals.push(y,y,y)}var x=v.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var M=v.color;this.colors.push(M,M,M)}if(n===!0){var S=i[0][u];S!==void 0?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",u),this.uvs.push(new St,new St,new St))}if(a===!0){var S=i[1][u];S!==void 0?this.uvs2.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",u),this.uvs2.push(new St,new St,new St))}for(var w=0;w<s;w++){var T=o[w].vertices;l[w].push(T[v.a],T[v.b],T[v.c])}for(var w=0;w<f;w++){var C=c[w].vertexNormals[u];h[w].push(C.a,C.b,C.c)}g&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),m&&this.skinWeights.push(d[v.a],d[v.b],d[v.c])}return this.computeGroups(r),this.verticesNeedUpdate=r.verticesNeedUpdate,this.normalsNeedUpdate=r.normalsNeedUpdate,this.colorsNeedUpdate=r.colorsNeedUpdate,this.uvsNeedUpdate=r.uvsNeedUpdate,this.groupsNeedUpdate=r.groupsNeedUpdate,this}});Object.assign(sr.prototype,bs.prototype,{isGeometry:!0,applyMatrix:function(r){for(var e=new ws().getNormalMatrix(r),t=0,i=this.vertices.length;t<i;t++){var n=this.vertices[t];n.applyMatrix4(r)}for(var t=0,i=this.faces.length;t<i;t++){var a=this.faces[t];a.normal.applyMatrix3(e).normalize();for(var o=0,s=a.vertexNormals.length;o<s;o++)a.vertexNormals[o].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationX(t),this.applyMatrix(r),this}}(),rotateY:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationY(t),this.applyMatrix(r),this}}(),rotateZ:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationZ(t),this.applyMatrix(r),this}}(),translate:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeTranslation(t,i,n),this.applyMatrix(r),this}}(),scale:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeScale(t,i,n),this.applyMatrix(r),this}}(),lookAt:function(){var r;return function(t){r===void 0&&(r=new At),r.lookAt(t),r.updateMatrix(),this.applyMatrix(r.matrix)}}(),fromBufferGeometry:function(r){var e=this,t=r.index!==null?r.index.array:void 0,i=r.attributes,n=i.position.array,a=i.normal!==void 0?i.normal.array:void 0,o=i.color!==void 0?i.color.array:void 0,s=i.uv!==void 0?i.uv.array:void 0,l=i.uv2!==void 0?i.uv2.array:void 0;l!==void 0&&(this.faceVertexUvs[1]=[]);for(var u=[],c=[],f=[],h=0,p=0;h<n.length;h+=3,p+=2)e.vertices.push(new oe(n[h],n[h+1],n[h+2])),a!==void 0&&u.push(new oe(a[h],a[h+1],a[h+2])),o!==void 0&&e.colors.push(new Gt(o[h],o[h+1],o[h+2])),s!==void 0&&c.push(new St(s[p],s[p+1])),l!==void 0&&f.push(new St(l[p],l[p+1]));function d(x,M,S,w){var T=a!==void 0?[u[x].clone(),u[M].clone(),u[S].clone()]:[],C=o!==void 0?[e.colors[x].clone(),e.colors[M].clone(),e.colors[S].clone()]:[],b=new zo(x,M,S,T,C,w);e.faces.push(b),s!==void 0&&e.faceVertexUvs[0].push([c[x].clone(),c[M].clone(),c[S].clone()]),l!==void 0&&e.faceVertexUvs[1].push([f[x].clone(),f[M].clone(),f[S].clone()])}if(t!==void 0){var g=r.groups;if(g.length>0)for(var h=0;h<g.length;h++)for(var m=g[h],v=m.start,_=m.count,p=v,y=v+_;p<y;p+=3)d(t[p],t[p+1],t[p+2],m.materialIndex);else for(var h=0;h<t.length;h+=3)d(t[h],t[h+1],t[h+2])}else for(var h=0;h<n.length/3;h+=3)d(h,h+1,h+2);return this.computeFaceNormals(),r.boundingBox!==null&&(this.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(this.boundingSphere=r.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var r=this.boundingBox.getCenter().negate();return this.translate(r.x,r.y,r.z),r},normalize:function(){this.computeBoundingSphere();var r=this.boundingSphere.center,e=this.boundingSphere.radius,t=e===0?1:1/e,i=new qt;return i.set(t,0,0,-t*r.x,0,t,0,-t*r.y,0,0,t,-t*r.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var r=new oe,e=new oe,t=0,i=this.faces.length;t<i;t++){var n=this.faces[t],a=this.vertices[n.a],o=this.vertices[n.b],s=this.vertices[n.c];r.subVectors(s,o),e.subVectors(a,o),r.cross(e),r.normalize(),n.normal.copy(r)}},computeVertexNormals:function(r){r===void 0&&(r=!0);var e,t,i,n,a,o;for(o=new Array(this.vertices.length),e=0,t=this.vertices.length;e<t;e++)o[e]=new oe;if(r){var s,l,u,c=new oe,f=new oe;for(i=0,n=this.faces.length;i<n;i++)a=this.faces[i],s=this.vertices[a.a],l=this.vertices[a.b],u=this.vertices[a.c],c.subVectors(u,l),f.subVectors(s,l),c.cross(f),o[a.a].add(c),o[a.b].add(c),o[a.c].add(c)}else for(this.computeFaceNormals(),i=0,n=this.faces.length;i<n;i++)a=this.faces[i],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,t=this.vertices.length;e<t;e++)o[e].normalize();for(i=0,n=this.faces.length;i<n;i++){a=this.faces[i];var h=a.vertexNormals;h.length===3?(h[0].copy(o[a.a]),h[1].copy(o[a.b]),h[2].copy(o[a.c])):(h[0]=o[a.a].clone(),h[1]=o[a.b].clone(),h[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var r,e,t;for(this.computeFaceNormals(),r=0,e=this.faces.length;r<e;r++){t=this.faces[r];var i=t.vertexNormals;i.length===3?(i[0].copy(t.normal),i[1].copy(t.normal),i[2].copy(t.normal)):(i[0]=t.normal.clone(),i[1]=t.normal.clone(),i[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var r,e,t,i,n;for(t=0,i=this.faces.length;t<i;t++)for(n=this.faces[t],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),r=0,e=n.vertexNormals.length;r<e;r++)n.__originalVertexNormals[r]?n.__originalVertexNormals[r].copy(n.vertexNormals[r]):n.__originalVertexNormals[r]=n.vertexNormals[r].clone();var a=new sr;for(a.faces=this.faces,r=0,e=this.morphTargets.length;r<e;r++){if(!this.morphNormals[r]){this.morphNormals[r]={},this.morphNormals[r].faceNormals=[],this.morphNormals[r].vertexNormals=[];var o=this.morphNormals[r].faceNormals,s=this.morphNormals[r].vertexNormals,u,c;for(t=0,i=this.faces.length;t<i;t++)u=new oe,c={a:new oe,b:new oe,c:new oe},o.push(u),s.push(c)}var l=this.morphNormals[r];a.vertices=this.morphTargets[r].vertices,a.computeFaceNormals(),a.computeVertexNormals();var u,c;for(t=0,i=this.faces.length;t<i;t++)n=this.faces[t],u=l.faceNormals[t],c=l.vertexNormals[t],u.copy(n.normal),c.a.copy(n.vertexNormals[0]),c.b.copy(n.vertexNormals[1]),c.c.copy(n.vertexNormals[2])}for(t=0,i=this.faces.length;t<i;t++)n=this.faces[t],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeLineDistances:function(){for(var r=0,e=this.vertices,t=0,i=e.length;t<i;t++)t>0&&(r+=e[t].distanceTo(e[t-1])),this.lineDistances[t]=r},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new su),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new $n),this.boundingSphere.setFromPoints(this.vertices)},merge:function(r,e,t){if((r&&r.isGeometry)===!1){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",r);return}var i,n=this.vertices.length,a=this.vertices,o=r.vertices,s=this.faces,l=r.faces,u=this.faceVertexUvs[0],c=r.faceVertexUvs[0],f=this.colors,h=r.colors;t===void 0&&(t=0),e!==void 0&&(i=new ws().getNormalMatrix(e));for(var p=0,d=o.length;p<d;p++){var g=o[p],m=g.clone();e!==void 0&&m.applyMatrix4(e),a.push(m)}for(var p=0,d=h.length;p<d;p++)f.push(h[p].clone());for(p=0,d=l.length;p<d;p++){var v=l[p],_,y,x,M=v.vertexNormals,S=v.vertexColors;_=new zo(v.a+n,v.b+n,v.c+n),_.normal.copy(v.normal),i!==void 0&&_.normal.applyMatrix3(i).normalize();for(var w=0,T=M.length;w<T;w++)y=M[w].clone(),i!==void 0&&y.applyMatrix3(i).normalize(),_.vertexNormals.push(y);_.color.copy(v.color);for(var w=0,T=S.length;w<T;w++)x=S[w],_.vertexColors.push(x.clone());_.materialIndex=v.materialIndex+t,s.push(_)}for(p=0,d=c.length;p<d;p++){var C=c[p],b=[];if(C!==void 0){for(var w=0,T=C.length;w<T;w++)b.push(C[w].clone());u.push(b)}}},mergeMesh:function(r){if((r&&r.isMesh)===!1){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",r);return}r.matrixAutoUpdate&&r.updateMatrix(),this.merge(r.geometry,r.matrix)},mergeVertices:function(){var r={},e=[],t=[],i,n,a=4,o=Math.pow(10,a),s,l,u,c,f,h;for(s=0,l=this.vertices.length;s<l;s++)i=this.vertices[s],n=Math.round(i.x*o)+"_"+Math.round(i.y*o)+"_"+Math.round(i.z*o),r[n]===void 0?(r[n]=s,e.push(this.vertices[s]),t[s]=e.length-1):t[s]=t[r[n]];var p=[];for(s=0,l=this.faces.length;s<l;s++){u=this.faces[s],u.a=t[u.a],u.b=t[u.b],u.c=t[u.c],c=[u.a,u.b,u.c];for(var d=-1,g=0;g<3;g++)if(c[g]===c[(g+1)%3]){d=g,p.push(s);break}}for(s=p.length-1;s>=0;s--){var m=p[s];for(this.faces.splice(m,1),f=0,h=this.faceVertexUvs.length;f<h;f++)this.faceVertexUvs[f].splice(m,1)}var v=this.vertices.length-e.length;return this.vertices=e,v},sortFacesByMaterialIndex:function(){for(var r=this.faces,e=r.length,t=0;t<e;t++)r[t]._id=t;function i(u,c){return u.materialIndex-c.materialIndex}r.sort(i);var n=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;n&&n.length===e&&(o=[]),a&&a.length===e&&(s=[]);for(var t=0;t<e;t++){var l=r[t]._id;o&&o.push(n[l]),s&&s.push(a[l])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.parameters!==void 0){var e=this.parameters;for(var t in e)e[t]!==void 0&&(r[t]=e[t]);return r}for(var i=[],n=0;n<this.vertices.length;n++){var a=this.vertices[n];i.push(a.x,a.y,a.z)}for(var o=[],s=[],l={},u=[],c={},f=[],h={},n=0;n<this.faces.length;n++){var p=this.faces[n],d=!0,g=!1,m=this.faceVertexUvs[0][n]!==void 0,v=p.normal.length()>0,_=p.vertexNormals.length>0,y=p.color.r!==1||p.color.g!==1||p.color.b!==1,x=p.vertexColors.length>0,M=0;if(M=C(M,0,0),M=C(M,1,d),M=C(M,2,g),M=C(M,3,m),M=C(M,4,v),M=C(M,5,_),M=C(M,6,y),M=C(M,7,x),o.push(M),o.push(p.a,p.b,p.c),o.push(p.materialIndex),m){var S=this.faceVertexUvs[0][n];o.push(I(S[0]),I(S[1]),I(S[2]))}if(v&&o.push(b(p.normal)),_){var w=p.vertexNormals;o.push(b(w[0]),b(w[1]),b(w[2]))}if(y&&o.push(E(p.color)),x){var T=p.vertexColors;o.push(E(T[0]),E(T[1]),E(T[2]))}}function C(R,A,D){return D?R|1<<A:R&~(1<<A)}function b(R){var A=R.x.toString()+R.y.toString()+R.z.toString();return l[A]!==void 0||(l[A]=s.length/3,s.push(R.x,R.y,R.z)),l[A]}function E(R){var A=R.r.toString()+R.g.toString()+R.b.toString();return c[A]!==void 0||(c[A]=u.length,u.push(R.getHex())),c[A]}function I(R){var A=R.x.toString()+R.y.toString();return h[A]!==void 0||(h[A]=f.length/2,f.push(R.x,R.y)),h[A]}return r.data={},r.data.vertices=i,r.data.normals=s,u.length>0&&(r.data.colors=u),f.length>0&&(r.data.uvs=[f]),r.data.faces=o,r},clone:function(){return new sr().copy(this)},copy:function(r){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var e=r.vertices,t=0,i=e.length;t<i;t++)this.vertices.push(e[t].clone());for(var n=r.colors,t=0,i=n.length;t<i;t++)this.colors.push(n[t].clone());for(var a=r.faces,t=0,i=a.length;t<i;t++)this.faces.push(a[t].clone());for(var t=0,i=r.faceVertexUvs.length;t<i;t++){var o=r.faceVertexUvs[t];this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]);for(var s=0,l=o.length;s<l;s++){for(var u=o[s],c=[],f=0,h=u.length;f<h;f++){var p=u[f];c.push(p.clone())}this.faceVertexUvs[t].push(c)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});DRe=0;Object.assign(Bt.prototype,bs.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(r){this.index=r},addAttribute:function(r,e){if((e&&e.isBufferAttribute)===!1&&(e&&e.isInterleavedBufferAttribute)===!1){console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(r,new gt(arguments[1],arguments[2]));return}if(r==="index"){console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e);return}return this.attributes[r]=e,this},getAttribute:function(r){return this.attributes[r]},removeAttribute:function(r){return delete this.attributes[r],this},addGroup:function(r,e,t){this.groups.push({start:r,count:e,materialIndex:t!==void 0?t:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(r,e){this.drawRange.start=r,this.drawRange.count=e},applyMatrix:function(r){var e=this.attributes.position;e!==void 0&&(r.applyToVector3Array(e.array),e.needsUpdate=!0);var t=this.attributes.normal;if(t!==void 0){var i=new ws().getNormalMatrix(r);i.applyToVector3Array(t.array),t.needsUpdate=!0}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationX(t),this.applyMatrix(r),this}}(),rotateY:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationY(t),this.applyMatrix(r),this}}(),rotateZ:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationZ(t),this.applyMatrix(r),this}}(),translate:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeTranslation(t,i,n),this.applyMatrix(r),this}}(),scale:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeScale(t,i,n),this.applyMatrix(r),this}}(),lookAt:function(){var r;return function(t){r===void 0&&(r=new At),r.lookAt(t),r.updateMatrix(),this.applyMatrix(r.matrix)}}(),center:function(){this.computeBoundingBox();var r=this.boundingBox.getCenter().negate();return this.translate(r.x,r.y,r.z),r},setFromObject:function(r){var e=r.geometry;if(r.isPoints||r.isLine){var t=new gr(e.vertices.length*3,3),i=new gr(e.colors.length*3,3);if(this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var n=new gr(e.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(e.lineDistances))}e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone())}else r.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(r){var e=r.geometry;if(r.isMesh){var t=e.__directGeometry;if(e.elementsNeedUpdate===!0&&(t=void 0,e.elementsNeedUpdate=!1),t===void 0)return this.fromGeometry(e);t.verticesNeedUpdate=e.verticesNeedUpdate,t.normalsNeedUpdate=e.normalsNeedUpdate,t.colorsNeedUpdate=e.colorsNeedUpdate,t.uvsNeedUpdate=e.uvsNeedUpdate,t.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=t}var i;return e.verticesNeedUpdate===!0&&(i=this.attributes.position,i!==void 0&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),e.normalsNeedUpdate===!0&&(i=this.attributes.normal,i!==void 0&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),e.colorsNeedUpdate===!0&&(i=this.attributes.color,i!==void 0&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(i=this.attributes.uv,i!==void 0&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(i=this.attributes.lineDistance,i!==void 0&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(r.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(r){return r.__directGeometry=new Xne().fromGeometry(r),this.fromDirectGeometry(r.__directGeometry)},fromDirectGeometry:function(r){var e=new Float32Array(r.vertices.length*3);if(this.addAttribute("position",new gt(e,3).copyVector3sArray(r.vertices)),r.normals.length>0){var t=new Float32Array(r.normals.length*3);this.addAttribute("normal",new gt(t,3).copyVector3sArray(r.normals))}if(r.colors.length>0){var i=new Float32Array(r.colors.length*3);this.addAttribute("color",new gt(i,3).copyColorsArray(r.colors))}if(r.uvs.length>0){var n=new Float32Array(r.uvs.length*2);this.addAttribute("uv",new gt(n,2).copyVector2sArray(r.uvs))}if(r.uvs2.length>0){var a=new Float32Array(r.uvs2.length*2);this.addAttribute("uv2",new gt(a,2).copyVector2sArray(r.uvs2))}if(r.indices.length>0){var o=r.vertices.length>65535?Uint32Array:Uint16Array,s=new o(r.indices.length*3);this.setIndex(new gt(s,1).copyIndicesArray(r.indices))}this.groups=r.groups;for(var l in r.morphTargets){for(var u=[],c=r.morphTargets[l],f=0,h=c.length;f<h;f++){var p=c[f],d=new gr(p.length*3,3);u.push(d.copyVector3sArray(p))}this.morphAttributes[l]=u}if(r.skinIndices.length>0){var g=new gr(r.skinIndices.length*4,4);this.addAttribute("skinIndex",g.copyVector4sArray(r.skinIndices))}if(r.skinWeights.length>0){var m=new gr(r.skinWeights.length*4,4);this.addAttribute("skinWeight",m.copyVector4sArray(r.skinWeights))}return r.boundingSphere!==null&&(this.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(this.boundingBox=r.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new su);var r=this.attributes.position;r!==void 0?this.boundingBox.setFromBufferAttribute(r):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var r=new su,e=new oe;return function(){this.boundingSphere===null&&(this.boundingSphere=new $n);var i=this.attributes.position;if(i){var n=this.boundingSphere.center;r.setFromBufferAttribute(i),r.getCenter(n);for(var a=0,o=0,s=i.count;o<s;o++)e.x=i.getX(o),e.y=i.getY(o),e.z=i.getZ(o),a=Math.max(a,n.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var r=this.index,e=this.attributes,t=this.groups;if(e.position){var i=e.position.array;if(e.normal===void 0)this.addAttribute("normal",new gt(new Float32Array(i.length),3));else for(var n=e.normal.array,a=0,o=n.length;a<o;a++)n[a]=0;var s=e.normal.array,l,u,c,f=new oe,h=new oe,p=new oe,d=new oe,g=new oe;if(r){var m=r.array;t.length===0&&this.addGroup(0,m.length);for(var v=0,_=t.length;v<_;++v)for(var y=t[v],x=y.start,M=y.count,a=x,o=x+M;a<o;a+=3)l=m[a+0]*3,u=m[a+1]*3,c=m[a+2]*3,f.fromArray(i,l),h.fromArray(i,u),p.fromArray(i,c),d.subVectors(p,h),g.subVectors(f,h),d.cross(g),s[l]+=d.x,s[l+1]+=d.y,s[l+2]+=d.z,s[u]+=d.x,s[u+1]+=d.y,s[u+2]+=d.z,s[c]+=d.x,s[c+1]+=d.y,s[c+2]+=d.z}else for(var a=0,o=i.length;a<o;a+=9)f.fromArray(i,a),h.fromArray(i,a+3),p.fromArray(i,a+6),d.subVectors(p,h),g.subVectors(f,h),d.cross(g),s[a]=d.x,s[a+1]=d.y,s[a+2]=d.z,s[a+3]=d.x,s[a+4]=d.y,s[a+5]=d.z,s[a+6]=d.x,s[a+7]=d.y,s[a+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(r,e){if((r&&r.isBufferGeometry)===!1){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",r);return}e===void 0&&(e=0);var t=this.attributes;for(var i in t)if(r.attributes[i]!==void 0)for(var n=t[i],a=n.array,o=r.attributes[i],s=o.array,l=o.itemSize,u=0,c=l*e;u<s.length;u++,c++)a[c]=s[u];return this},normalizeNormals:function(){for(var r=this.attributes.normal.array,e,t,i,n,a=0,o=r.length;a<o;a+=3)e=r[a],t=r[a+1],i=r[a+2],n=1/Math.sqrt(e*e+t*t+i*i),r[a]*=n,r[a+1]*=n,r[a+2]*=n},toNonIndexed:function(){if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var r=new Bt,e=this.index.array,t=this.attributes;for(var i in t){for(var n=t[i],a=n.array,o=n.itemSize,s=new a.constructor(e.length*o),l=0,u=0,c=0,f=e.length;c<f;c++){l=e[c]*o;for(var h=0;h<o;h++)s[u++]=a[l++]}r.addAttribute(i,new gt(s,o))}return r},toJSON:function(){var r={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.parameters!==void 0){var e=this.parameters;for(var t in e)e[t]!==void 0&&(r[t]=e[t]);return r}r.data={attributes:{}};var i=this.index;if(i!==null){var n=Array.prototype.slice.call(i.array);r.data.index={type:i.array.constructor.name,array:n}}var a=this.attributes;for(var t in a){var o=a[t],n=Array.prototype.slice.call(o.array);r.data.attributes[t]={itemSize:o.itemSize,type:o.array.constructor.name,array:n,normalized:o.normalized}}var s=this.groups;s.length>0&&(r.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return l!==null&&(r.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),r},clone:function(){return new Bt().copy(this)},copy:function(r){var e=r.index;e!==null&&this.setIndex(e.clone());var t=r.attributes;for(var i in t){var n=t[i];this.addAttribute(i,n.clone())}for(var a=r.groups,o=0,s=a.length;o<s;o++){var l=a[o];this.addGroup(l.start,l.count,l.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Bt.MaxIndex=65535;mn.prototype=Object.assign(Object.create(At.prototype),{constructor:mn,isMesh:!0,setDrawMode:function(r){this.drawMode=r},copy:function(r){return At.prototype.copy.call(this,r),this.drawMode=r.drawMode,this},updateMorphTargets:function(){var r=this.geometry.morphTargets;if(r!==void 0&&r.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=r.length;e<t;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[r[e].name]=e}},raycast:function(){var r=new qt,e=new wh,t=new $n,i=new oe,n=new oe,a=new oe,o=new oe,s=new oe,l=new oe,u=new St,c=new St,f=new St,h=new oe,p=new oe,d=new oe;function g(_,y,x,M,S,w,T){return Ms.barycoordFromPoint(_,y,x,M,h),S.multiplyScalar(h.x),w.multiplyScalar(h.y),T.multiplyScalar(h.z),S.add(w).add(T),S.clone()}function m(_,y,x,M,S,w,T){var C,b=_.material;if(b.side===xh?C=x.intersectTriangle(w,S,M,!0,T):C=x.intersectTriangle(M,S,w,b.side!==Oy,T),C===null)return null;d.copy(T),d.applyMatrix4(_.matrixWorld);var E=y.ray.origin.distanceTo(d);return E<y.near||E>y.far?null:{distance:E,point:d.clone(),object:_}}function v(_,y,x,M,S,w,T,C){i.fromArray(M,w*3),n.fromArray(M,T*3),a.fromArray(M,C*3);var b=m(_,y,x,i,n,a,p);return b&&(S&&(u.fromArray(S,w*2),c.fromArray(S,T*2),f.fromArray(S,C*2),b.uv=g(p,i,n,a,u,c,f)),b.face=new zo(w,T,C,Ms.normal(i,n,a)),b.faceIndex=w),b}return function(y,x){var M=this.geometry,S=this.material,w=this.matrixWorld;if(S!==void 0&&(M.boundingSphere===null&&M.computeBoundingSphere(),t.copy(M.boundingSphere),t.applyMatrix4(w),y.ray.intersectsSphere(t)!==!1&&(r.getInverse(w),e.copy(y.ray).applyMatrix4(r),!(M.boundingBox!==null&&e.intersectsBox(M.boundingBox)===!1)))){var T,C;if(M.isBufferGeometry){var b,E,I,R=M.index,A=M.attributes,D=A.position.array;if(A.uv!==void 0&&(T=A.uv.array),R!==null)for(var U=R.array,B=0,z=U.length;B<z;B+=3)b=U[B],E=U[B+1],I=U[B+2],C=v(this,y,e,D,T,b,E,I),C&&(C.faceIndex=Math.floor(B/3),x.push(C));else for(var B=0,z=D.length;B<z;B+=9)b=B/3,E=b+1,I=b+2,C=v(this,y,e,D,T,b,E,I),C&&(C.index=b,x.push(C))}else if(M.isGeometry){var k,G,Y,J=S&&S.isMultiMaterial,Q=J===!0?S.materials:null,V=M.vertices,K=M.faces,ae=M.faceVertexUvs[0];ae.length>0&&(T=ae);for(var ve=0,ue=K.length;ve<ue;ve++){var se=K[ve],Ee=J===!0?Q[se.materialIndex]:S;if(Ee!==void 0){if(k=V[se.a],G=V[se.b],Y=V[se.c],Ee.morphTargets===!0){var q=M.morphTargets,H=this.morphTargetInfluences;i.set(0,0,0),n.set(0,0,0),a.set(0,0,0);for(var We=0,_e=q.length;We<_e;We++){var xe=H[We];if(xe!==0){var Le=q[We].vertices;i.addScaledVector(o.subVectors(Le[se.a],k),xe),n.addScaledVector(s.subVectors(Le[se.b],G),xe),a.addScaledVector(l.subVectors(Le[se.c],Y),xe)}}i.add(k),n.add(G),a.add(Y),k=i,G=n,Y=a}if(C=m(this,y,e,k,G,Y,p),C){if(T){var Ue=T[ve];u.copy(Ue[0]),c.copy(Ue[1]),f.copy(Ue[2]),C.uv=g(p,k,G,Y,u,c,f)}C.face=se,C.faceIndex=ve,x.push(C)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});zd.prototype=Object.create(Bt.prototype);zd.prototype.constructor=zd;Fd.prototype=Object.create(Bt.prototype);Fd.prototype.constructor=Fd;Qn.prototype=Object.create(At.prototype);Qn.prototype.constructor=Qn;Qn.prototype.isCamera=!0;Qn.prototype.getWorldDirection=function(){var r=new on;return function(t){var i=t||new oe;return this.getWorldQuaternion(r),i.set(0,0,-1).applyQuaternion(r)}}();Qn.prototype.lookAt=function(){var r=new qt;return function(t){r.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(r)}}();Qn.prototype.clone=function(){return new this.constructor().copy(this)};Qn.prototype.copy=function(r){return At.prototype.copy.call(this,r),this.matrixWorldInverse.copy(r.matrixWorldInverse),this.projectionMatrix.copy(r.projectionMatrix),this};Kn.prototype=Object.assign(Object.create(Qn.prototype),{constructor:Kn,isPerspectiveCamera:!0,copy:function(r){return Qn.prototype.copy.call(this,r),this.fov=r.fov,this.zoom=r.zoom,this.near=r.near,this.far=r.far,this.focus=r.focus,this.aspect=r.aspect,this.view=r.view===null?null:Object.assign({},r.view),this.filmGauge=r.filmGauge,this.filmOffset=r.filmOffset,this},setFocalLength:function(r){var e=.5*this.getFilmHeight()/r;this.fov=cr.RAD2DEG*2*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var r=Math.tan(cr.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/r},getEffectiveFOV:function(){return cr.RAD2DEG*2*Math.atan(Math.tan(cr.DEG2RAD*.5*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(r,e,t,i,n,a){this.aspect=r/e,this.view={fullWidth:r,fullHeight:e,offsetX:t,offsetY:i,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var r=this.near,e=r*Math.tan(cr.DEG2RAD*.5*this.fov)/this.zoom,t=2*e,i=this.aspect*t,n=-.5*i,a=this.view;if(a!==null){var o=a.fullWidth,s=a.fullHeight;n+=a.offsetX*i/o,e-=a.offsetY*t/s,i*=a.width/o,t*=a.height/s}var l=this.filmOffset;l!==0&&(n+=r*l/this.getFilmWidth()),this.projectionMatrix.makeFrustum(n,n+i,e-t,e,r,this.far)},toJSON:function(r){var e=At.prototype.toJSON.call(this,r);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,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});ry.prototype=Object.assign(Object.create(Qn.prototype),{constructor:ry,isOrthographicCamera:!0,copy:function(r){return Qn.prototype.copy.call(this,r),this.left=r.left,this.right=r.right,this.top=r.top,this.bottom=r.bottom,this.near=r.near,this.far=r.far,this.zoom=r.zoom,this.view=r.view===null?null:Object.assign({},r.view),this},setViewOffset:function(r,e,t,i,n,a){this.view={fullWidth:r,fullHeight:e,offsetX:t,offsetY:i,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var r=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),t=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=t-r,a=t+r,o=i+e,s=i-e;if(this.view!==null){var l=this.zoom/(this.view.width/this.view.fullWidth),u=this.zoom/(this.view.height/this.view.fullHeight),c=(this.right-this.left)/this.view.width,f=(this.top-this.bottom)/this.view.height;n+=c*(this.view.offsetX/l),a=n+c*(this.view.width/l),o-=f*(this.view.offsetY/u),s=o-f*(this.view.height/u)}this.projectionMatrix.makeOrthographic(n,a,o,s,this.near,this.far)},toJSON:function(r){var e=At.prototype.toJSON.call(this,r);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,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}});zRe=0;iy.prototype.isFogExp2=!0;iy.prototype.clone=function(){return new iy(this.color.getHex(),this.density)};iy.prototype.toJSON=function(r){return{type:"FogExp2",color:this.color.getHex(),density:this.density}};ny.prototype.isFog=!0;ny.prototype.clone=function(){return new ny(this.color.getHex(),this.near,this.far)};ny.prototype.toJSON=function(r){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}};Bd.prototype=Object.create(At.prototype);Bd.prototype.constructor=Bd;Bd.prototype.copy=function(r,e){return At.prototype.copy.call(this,r,e),r.background!==null&&(this.background=r.background.clone()),r.fog!==null&&(this.fog=r.fog.clone()),r.overrideMaterial!==null&&(this.overrideMaterial=r.overrideMaterial.clone()),this.autoUpdate=r.autoUpdate,this.matrixAutoUpdate=r.matrixAutoUpdate,this};Bd.prototype.toJSON=function(r){var e=At.prototype.toJSON.call(this,r);return this.background!==null&&(e.object.background=this.background.toJSON(r)),this.fog!==null&&(e.object.fog=this.fog.toJSON()),e};SF.prototype=Object.assign(Object.create(At.prototype),{constructor:SF,isLensFlare:!0,copy:function(r){At.prototype.copy.call(this,r),this.positionScreen.copy(r.positionScreen),this.customUpdateCallback=r.customUpdateCallback;for(var e=0,t=r.lensFlares.length;e<t;e++)this.lensFlares.push(r.lensFlares[e]);return this},add:function(r,e,t,i,n,a){e===void 0&&(e=-1),t===void 0&&(t=0),a===void 0&&(a=1),n===void 0&&(n=new Gt(16777215)),i===void 0&&(i=zy),t=Math.min(t,Math.max(0,t)),this.lensFlares.push({texture:r,size:e,distance:t,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:n,blending:i})},updateLensFlares:function(){var r,e=this.lensFlares.length,t,i=-this.positionScreen.x*2,n=-this.positionScreen.y*2;for(r=0;r<e;r++)t=this.lensFlares[r],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=(t.wantedRotation-t.rotation)*.25}});kd.prototype=Object.create(mr.prototype);kd.prototype.constructor=kd;kd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.rotation=r.rotation,this};kS.prototype=Object.assign(Object.create(At.prototype),{constructor:kS,isSprite:!0,raycast:function(){var r=new oe;return function(t,i){r.setFromMatrixPosition(this.matrixWorld);var n=t.ray.distanceSqToPoint(r),a=this.scale.x*this.scale.y/4;n>a||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}});VS.prototype=Object.assign(Object.create(At.prototype),{constructor:VS,copy:function(r){At.prototype.copy.call(this,r,!1);for(var e=r.levels,t=0,i=e.length;t<i;t++){var n=e[t];this.addLevel(n.object.clone(),n.distance)}return this},addLevel:function(r,e){e===void 0&&(e=0),e=Math.abs(e);for(var t=this.levels,i=0;i<t.length&&!(e<t[i].distance);i++);t.splice(i,0,{distance:e,object:r}),this.add(r)},getObjectForDistance:function(r){for(var e=this.levels,t=1,i=e.length;t<i&&!(r<e[t].distance);t++);return e[t-1].object},raycast:function(){var r=new oe;return function(t,i){r.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(r);this.getObjectForDistance(n).raycast(t,i)}}(),update:function(){var r=new oe,e=new oe;return function(i){var n=this.levels;if(n.length>1){r.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var a=r.distanceTo(e);n[0].object.visible=!0;for(var o=1,s=n.length;o<s&&a>=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;o<s;o++)n[o].object.visible=!1}}}(),toJSON:function(r){var e=At.prototype.toJSON.call(this,r);e.object.levels=[];for(var t=this.levels,i=0,n=t.length;i<n;i++){var a=t[i];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}});Object.assign(jA.prototype,{calculateInverses:function(){this.boneInverses=[];for(var r=0,e=this.bones.length;r<e;r++){var t=new qt;this.bones[r]&&t.getInverse(this.bones[r].matrixWorld),this.boneInverses.push(t)}},pose:function(){for(var r,e=0,t=this.bones.length;e<t;e++)r=this.bones[e],r&&r.matrixWorld.getInverse(this.boneInverses[e]);for(var e=0,t=this.bones.length;e<t;e++)r=this.bones[e],r&&(r.parent&&r.parent.isBone?(r.matrix.getInverse(r.parent.matrixWorld),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))},update:function(){var r=new qt;return function(){for(var t=0,i=this.bones.length;t<i;t++){var n=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;r.multiplyMatrices(n,this.boneInverses[t]),r.toArray(this.boneMatrices,t*16)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new jA(this.bones,this.boneInverses,this.useVertexTexture)}});KA.prototype=Object.assign(Object.create(At.prototype),{constructor:KA,isBone:!0});JA.prototype=Object.assign(Object.create(mn.prototype),{constructor:JA,isSkinnedMesh:!0,bind:function(r,e){this.skeleton=r,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var r=0;r<this.geometry.skinWeights.length;r++){var e=this.geometry.skinWeights[r],t=1/e.lengthManhattan();t!==1/0?e.multiplyScalar(t):e.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var i=new ei,n=this.geometry.attributes.skinWeight,r=0;r<n.count;r++){i.x=n.getX(r),i.y=n.getY(r),i.z=n.getZ(r),i.w=n.getW(r);var t=1/i.lengthManhattan();t!==1/0?i.multiplyScalar(t):i.set(1,0,0,0),n.setXYZW(r,i.x,i.y,i.z,i.w)}},updateMatrixWorld:function(r){mn.prototype.updateMatrixWorld.call(this,!0),this.bindMode==="attached"?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode==="detached"?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material,this.skeleton.useVertexTexture).copy(this)}});Ni.prototype=Object.create(mr.prototype);Ni.prototype.constructor=Ni;Ni.prototype.isLineBasicMaterial=!0;Ni.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.linewidth=r.linewidth,this.linecap=r.linecap,this.linejoin=r.linejoin,this};ac.prototype=Object.assign(Object.create(At.prototype),{constructor:ac,isLine:!0,raycast:function(){var r=new qt,e=new wh,t=new $n;return function(n,a){var o=n.linePrecision,s=o*o,l=this.geometry,u=this.matrixWorld;if(l.boundingSphere===null&&l.computeBoundingSphere(),t.copy(l.boundingSphere),t.applyMatrix4(u),n.ray.intersectsSphere(t)!==!1){r.getInverse(u),e.copy(n.ray).applyMatrix4(r);var c=new oe,f=new oe,h=new oe,p=new oe,d=this&&this.isLineSegments?2:1;if(l.isBufferGeometry){var g=l.index,m=l.attributes,v=m.position.array;if(g!==null)for(var _=g.array,y=0,x=_.length-1;y<x;y+=d){var M=_[y],S=_[y+1];c.fromArray(v,M*3),f.fromArray(v,S*3);var w=e.distanceSqToSegment(c,f,p,h);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);T<n.near||T>n.far||a.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,x=v.length/3-1;y<x;y+=d){c.fromArray(v,3*y),f.fromArray(v,3*y+3);var w=e.distanceSqToSegment(c,f,p,h);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);T<n.near||T>n.far||a.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(l.isGeometry)for(var C=l.vertices,b=C.length,y=0;y<b-1;y+=d){var w=e.distanceSqToSegment(C[y],C[y+1],p,h);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);T<n.near||T>n.far||a.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});di.prototype=Object.assign(Object.create(ac.prototype),{constructor:di,isLineSegments:!0});ml.prototype=Object.create(mr.prototype);ml.prototype.constructor=ml;ml.prototype.isPointsMaterial=!0;ml.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.size=r.size,this.sizeAttenuation=r.sizeAttenuation,this};ay.prototype=Object.assign(Object.create(At.prototype),{constructor:ay,isPoints:!0,raycast:function(){var r=new qt,e=new wh,t=new $n;return function(n,a){var o=this,s=this.geometry,l=this.matrixWorld,u=n.params.Points.threshold;if(s.boundingSphere===null&&s.computeBoundingSphere(),t.copy(s.boundingSphere),t.applyMatrix4(l),n.ray.intersectsSphere(t)===!1)return;r.getInverse(l),e.copy(n.ray).applyMatrix4(r);var c=u/((this.scale.x+this.scale.y+this.scale.z)/3),f=c*c,h=new oe;function p(w,T){var C=e.distanceSqToPoint(w);if(C<f){var b=e.closestPointToPoint(w);b.applyMatrix4(l);var E=n.ray.origin.distanceTo(b);if(E<n.near||E>n.far)return;a.push({distance:E,distanceToRay:Math.sqrt(C),point:b.clone(),index:T,face:null,object:o})}}if(s.isBufferGeometry){var d=s.index,g=s.attributes,m=g.position.array;if(d!==null)for(var v=d.array,_=0,y=v.length;_<y;_++){var x=v[_];h.fromArray(m,x*3),p(h,x)}else for(var _=0,M=m.length/3;_<M;_++)h.fromArray(m,_*3),p(h,_)}else for(var S=s.vertices,_=0,M=S.length;_<M;_++)p(S[_],_)}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});GS.prototype=Object.assign(Object.create(At.prototype),{constructor:GS});$A.prototype=Object.create(ai.prototype);$A.prototype.constructor=$A;oy.prototype=Object.create(ai.prototype);oy.prototype.constructor=oy;oy.prototype.isCompressedTexture=!0;QA.prototype=Object.create(ai.prototype);QA.prototype.constructor=QA;HS.prototype=Object.create(ai.prototype);HS.prototype.constructor=HS;HS.prototype.isDepthTexture=!0;sy.prototype=Object.create(Bt.prototype);sy.prototype.constructor=sy;ly.prototype=Object.create(Bt.prototype);ly.prototype.constructor=ly;WS.prototype=Object.create(sr.prototype);WS.prototype.constructor=WS;so.prototype=Object.create(Bt.prototype);so.prototype.constructor=so;uy.prototype=Object.create(so.prototype);uy.prototype.constructor=uy;XS.prototype=Object.create(sr.prototype);XS.prototype.constructor=XS;Vd.prototype=Object.create(so.prototype);Vd.prototype.constructor=Vd;YS.prototype=Object.create(sr.prototype);YS.prototype.constructor=YS;cy.prototype=Object.create(so.prototype);cy.prototype.constructor=cy;qS.prototype=Object.create(sr.prototype);qS.prototype.constructor=qS;fy.prototype=Object.create(so.prototype);fy.prototype.constructor=fy;ZS.prototype=Object.create(sr.prototype);ZS.prototype.constructor=ZS;jS.prototype=Object.create(sr.prototype);jS.prototype.constructor=jS;hy.prototype=Object.create(Bt.prototype);hy.prototype.constructor=hy;KS.prototype=Object.create(sr.prototype);KS.prototype.constructor=KS;py.prototype=Object.create(Bt.prototype);py.prototype.constructor=py;JS.prototype=Object.create(sr.prototype);JS.prototype.constructor=JS;dy.prototype=Object.create(Bt.prototype);dy.prototype.constructor=dy;$S.prototype=Object.create(sr.prototype);$S.prototype.constructor=$S;Ln={area:function(r){for(var e=r.length,t=0,i=e-1,n=0;n<e;i=n++)t+=r[i].x*r[n].y-r[n].x*r[i].y;return t*.5},triangulate:function(){function r(e,t,i,n,a,o){var s,l,u,c,f,h,p,d,g;if(l=e[o[t]].x,u=e[o[t]].y,c=e[o[i]].x,f=e[o[i]].y,h=e[o[n]].x,p=e[o[n]].y,(c-l)*(p-u)-(f-u)*(h-l)<=0)return!1;var m,v,_,y,x,M,S,w,T,C,b,E,I,R,A;for(m=h-c,v=p-f,_=l-h,y=u-p,x=c-l,M=f-u,s=0;s<a;s++)if(d=e[o[s]].x,g=e[o[s]].y,!(d===l&&g===u||d===c&&g===f||d===h&&g===p)&&(S=d-l,w=g-u,T=d-c,C=g-f,b=d-h,E=g-p,A=m*C-v*T,I=x*w-M*S,R=_*E-y*b,A>=-Number.EPSILON&&R>=-Number.EPSILON&&I>=-Number.EPSILON))return!1;return!0}return function(t,i){var n=t.length;if(n<3)return null;var a=[],o=[],s=[],l,u,c;if(Ln.area(t)>0)for(u=0;u<n;u++)o[u]=u;else for(u=0;u<n;u++)o[u]=n-1-u;var f=n,h=2*f;for(u=f-1;f>2;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?s:a;if(l=u,f<=l&&(l=0),u=l+1,f<=u&&(u=0),c=u+1,f<=c&&(c=0),r(t,l,u,c,f,o)){var p,d,g,m,v;for(p=o[l],d=o[u],g=o[c],a.push([t[p],t[d],t[g]]),s.push([o[l],o[u],o[c]]),m=u,v=u+1;v<f;m++,v++)o[m]=o[v];f--,h=2*f}}return i?s:a}}(),triangulateShape:function(r,e){function t(y){var x=y.length;x>2&&y[x-1].equals(y[0])&&y.pop()}t(r),e.forEach(t);function i(y,x,M){return y.x!==x.x?y.x<x.x?y.x<=M.x&&M.x<=x.x:x.x<=M.x&&M.x<=y.x:y.y<x.y?y.y<=M.y&&M.y<=x.y:x.y<=M.y&&M.y<=y.y}function n(y,x,M,S,w){var T=x.x-y.x,C=x.y-y.y,b=S.x-M.x,E=S.y-M.y,I=y.x-M.x,R=y.y-M.y,A=C*b-T*E,D=C*I-T*R;if(Math.abs(A)>Number.EPSILON){var U;if(A>0){if(D<0||D>A)return[];if(U=E*I-b*R,U<0||U>A)return[]}else{if(D>0||D<A)return[];if(U=E*I-b*R,U>0||U<A)return[]}if(U===0)return w&&(D===0||D===A)?[]:[y];if(U===A)return w&&(D===0||D===A)?[]:[x];if(D===0)return[M];if(D===A)return[S];var B=U/A;return[{x:y.x+B*T,y:y.y+B*C}]}else{if(D!==0||E*I!==b*R)return[];var z=T===0&&C===0,k=b===0&&E===0;if(z&&k)return y.x!==M.x||y.y!==M.y?[]:[y];if(z)return i(M,S,y)?[y]:[];if(k)return i(y,x,M)?[M]:[];var G,Y,J,Q,V,K,ae,ve;return T!==0?(y.x<x.x?(G=y,J=y.x,Y=x,Q=x.x):(G=x,J=x.x,Y=y,Q=y.x),M.x<S.x?(V=M,ae=M.x,K=S,ve=S.x):(V=S,ae=S.x,K=M,ve=M.x)):(y.y<x.y?(G=y,J=y.y,Y=x,Q=x.y):(G=x,J=x.y,Y=y,Q=y.y),M.y<S.y?(V=M,ae=M.y,K=S,ve=S.y):(V=S,ae=S.y,K=M,ve=M.y)),J<=ae?Q<ae?[]:Q===ae?w?[]:[V]:Q<=ve?[V,Y]:[V,K]:J>ve?[]:J===ve?w?[]:[G]:Q<=ve?[G,Y]:[G,K]}}function a(y,x,M,S){var w=x.x-y.x,T=x.y-y.y,C=M.x-y.x,b=M.y-y.y,E=S.x-y.x,I=S.y-y.y,R=w*b-T*C,A=w*I-T*E;if(Math.abs(R)>Number.EPSILON){var D=E*b-I*C;return R>0?A>=0&&D>=0:A>=0||D>=0}else return A>0}function o(y,x){var M=y.concat(),S;function w(ve,ue){var se=M.length-1,Ee=ve-1;Ee<0&&(Ee=se);var q=ve+1;q>se&&(q=0);var H=a(M[ve],M[Ee],M[q],S[ue]);if(!H)return!1;var We=S.length-1,_e=ue-1;_e<0&&(_e=We);var xe=ue+1;return xe>We&&(xe=0),H=a(S[ue],S[_e],S[xe],M[ve]),!!H}function T(ve,ue){var se,Ee,q;for(se=0;se<M.length;se++)if(Ee=se+1,Ee%=M.length,q=n(ve,ue,M[se],M[Ee],!0),q.length>0)return!0;return!1}var C=[];function b(ve,ue){var se,Ee,q,H,We;for(se=0;se<C.length;se++)for(Ee=x[C[se]],q=0;q<Ee.length;q++)if(H=q+1,H%=Ee.length,We=n(ve,ue,Ee[q],Ee[H],!0),We.length>0)return!0;return!1}for(var E,I,R,A,D,U,B=[],z,k,G,Y,J=0,Q=x.length;J<Q;J++)C.push(J);for(var V=0,K=C.length*2;C.length>0;){if(K--,K<0){console.log("Infinite Loop! Holes left:"+C.length+", Probably Hole outside Shape!");break}for(I=V;I<M.length;I++){R=M[I],E=-1;for(var J=0;J<C.length;J++)if(D=C[J],U=R.x+":"+R.y+":"+D,B[U]===void 0){S=x[D];for(var ae=0;ae<S.length;ae++)if(A=S[ae],!!w(I,ae)&&!T(R,A)&&!b(R,A)){E=ae,C.splice(J,1),z=M.slice(0,I+1),k=M.slice(I),G=S.slice(E),Y=S.slice(0,E+1),M=z.concat(G).concat(Y).concat(k),V=I;break}if(E>=0)break;B[U]=!0}if(E>=0)break}}return M}for(var s,l,u,c,f,h,p={},d=r.concat(),g=0,m=e.length;g<m;g++)Array.prototype.push.apply(d,e[g]);for(s=0,l=d.length;s<l;s++)f=d[s].x+":"+d[s].y,p[f]!==void 0&&console.warn("THREE.ShapeUtils: Duplicate point",f,s),p[f]=s;var v=o(r,e),_=Ln.triangulate(v,!1);for(s=0,l=_.length;s<l;s++)for(c=_[s],u=0;u<3;u++)f=c[u].x+":"+c[u].y,h=p[f],h!==void 0&&(c[u]=h);return _.concat()},isClockWise:function(r){return Ln.area(r)<0},b2:function(){function r(i,n){var a=1-i;return a*a*n}function e(i,n){return 2*(1-i)*i*n}function t(i,n){return i*i*n}return function(n,a,o,s){return r(n,a)+e(n,o)+t(n,s)}}(),b3:function(){function r(n,a){var o=1-n;return o*o*o*a}function e(n,a){var o=1-n;return 3*o*o*n*a}function t(n,a){var o=1-n;return 3*o*n*n*a}function i(n,a){return n*n*n*a}return function(a,o,s,l,u){return r(a,o)+e(a,s)+t(a,l)+i(a,u)}}()};Ts.prototype=Object.create(sr.prototype);Ts.prototype.constructor=Ts;Ts.prototype.addShapeList=function(r,e){for(var t=r.length,i=0;i<t;i++){var n=r[i];this.addShape(n,e)}};Ts.prototype.addShape=function(r,e){var t=e.amount!==void 0?e.amount:100,i=e.bevelThickness!==void 0?e.bevelThickness:6,n=e.bevelSize!==void 0?e.bevelSize:i-2,a=e.bevelSegments!==void 0?e.bevelSegments:3,o=e.bevelEnabled!==void 0?e.bevelEnabled:!0,s=e.curveSegments!==void 0?e.curveSegments:12,l=e.steps!==void 0?e.steps:1,u=e.extrudePath,c,f=!1,h=e.UVGenerator!==void 0?e.UVGenerator:Ts.WorldUVGenerator,p,d,g,m;u&&(c=u.getSpacedPoints(l),f=!0,o=!1,p=e.frames!==void 0?e.frames:u.computeFrenetFrames(l,!1),d=new oe,g=new oe,m=new oe),o||(a=0,i=0,n=0);var v,_,y,x=this,M=this.vertices.length,S=r.extractPoints(s),w=S.shape,T=S.holes,C=!Ln.isClockWise(w);if(C){for(w=w.reverse(),_=0,y=T.length;_<y;_++)v=T[_],Ln.isClockWise(v)&&(T[_]=v.reverse());C=!1}var b=Ln.triangulateShape(w,T),E=w;for(_=0,y=T.length;_<y;_++)v=T[_],w=w.concat(v);function I(Ue,Ne,Ve){return Ne||console.error("THREE.ExtrudeGeometry: vec does not exist"),Ne.clone().multiplyScalar(Ve).add(Ue)}var R,A,D,U,B,z=w.length,k,G=b.length;function Y(Ue,Ne,Ve){var ct,F,L=1,ne=Ue.x-Ne.x,le=Ue.y-Ne.y,me=Ve.x-Ue.x,he=Ve.y-Ue.y,et=ne*ne+le*le,Ke=ne*he-le*me;if(Math.abs(Ke)>Number.EPSILON){var Se=Math.sqrt(et),Ae=Math.sqrt(me*me+he*he),nt=Ne.x-le/Se,$=Ne.y+ne/Se,it=Ve.x-he/Ae,Xe=Ve.y+me/Ae,Fe=((it-nt)*he-(Xe-$)*me)/(ne*he-le*me);ct=nt+ne*Fe-Ue.x,F=$+le*Fe-Ue.y;var we=ct*ct+F*F;if(we<=2)return new St(ct,F);L=Math.sqrt(we/2)}else{var Ie=!1;ne>Number.EPSILON?me>Number.EPSILON&&(Ie=!0):ne<-Number.EPSILON?me<-Number.EPSILON&&(Ie=!0):Math.sign(le)===Math.sign(he)&&(Ie=!0),Ie?(ct=-le,F=ne,L=Math.sqrt(et)):(ct=ne,F=le,L=Math.sqrt(et/2))}return new St(ct/L,F/L)}for(var J=[],Q=0,V=E.length,K=V-1,ae=Q+1;Q<V;Q++,K++,ae++)K===V&&(K=0),ae===V&&(ae=0),J[Q]=Y(E[Q],E[K],E[ae]);var ve=[],ue,se=J.concat();for(_=0,y=T.length;_<y;_++){for(v=T[_],ue=[],Q=0,V=v.length,K=V-1,ae=Q+1;Q<V;Q++,K++,ae++)K===V&&(K=0),ae===V&&(ae=0),ue[Q]=Y(v[Q],v[K],v[ae]);ve.push(ue),se=se.concat(ue)}for(R=0;R<a;R++){for(D=R/a,U=i*Math.cos(D*Math.PI/2),A=n*Math.sin(D*Math.PI/2),Q=0,V=E.length;Q<V;Q++)B=I(E[Q],J[Q],A),_e(B.x,B.y,-U);for(_=0,y=T.length;_<y;_++)for(v=T[_],ue=ve[_],Q=0,V=v.length;Q<V;Q++)B=I(v[Q],ue[Q],A),_e(B.x,B.y,-U)}for(A=n,Q=0;Q<z;Q++)B=o?I(w[Q],se[Q],A):w[Q],f?(g.copy(p.normals[0]).multiplyScalar(B.x),d.copy(p.binormals[0]).multiplyScalar(B.y),m.copy(c[0]).add(g).add(d),_e(m.x,m.y,m.z)):_e(B.x,B.y,0);var Ee;for(Ee=1;Ee<=l;Ee++)for(Q=0;Q<z;Q++)B=o?I(w[Q],se[Q],A):w[Q],f?(g.copy(p.normals[Ee]).multiplyScalar(B.x),d.copy(p.binormals[Ee]).multiplyScalar(B.y),m.copy(c[Ee]).add(g).add(d),_e(m.x,m.y,m.z)):_e(B.x,B.y,t/l*Ee);for(R=a-1;R>=0;R--){for(D=R/a,U=i*Math.cos(D*Math.PI/2),A=n*Math.sin(D*Math.PI/2),Q=0,V=E.length;Q<V;Q++)B=I(E[Q],J[Q],A),_e(B.x,B.y,t+U);for(_=0,y=T.length;_<y;_++)for(v=T[_],ue=ve[_],Q=0,V=v.length;Q<V;Q++)B=I(v[Q],ue[Q],A),f?_e(B.x,B.y+c[l-1].y,c[l-1].x+U):_e(B.x,B.y,t+U)}q(),H();function q(){if(o){var Ue=0,Ne=z*Ue;for(Q=0;Q<G;Q++)k=b[Q],xe(k[2]+Ne,k[1]+Ne,k[0]+Ne);for(Ue=l+a*2,Ne=z*Ue,Q=0;Q<G;Q++)k=b[Q],xe(k[0]+Ne,k[1]+Ne,k[2]+Ne)}else{for(Q=0;Q<G;Q++)k=b[Q],xe(k[2],k[1],k[0]);for(Q=0;Q<G;Q++)k=b[Q],xe(k[0]+z*l,k[1]+z*l,k[2]+z*l)}}function H(){var Ue=0;for(We(E,Ue),Ue+=E.length,_=0,y=T.length;_<y;_++)v=T[_],We(v,Ue),Ue+=v.length}function We(Ue,Ne){var Ve,ct;for(Q=Ue.length;--Q>=0;){Ve=Q,ct=Q-1,ct<0&&(ct=Ue.length-1);var F=0,L=l+a*2;for(F=0;F<L;F++){var ne=z*F,le=z*(F+1),me=Ne+Ve+ne,he=Ne+ct+ne,et=Ne+ct+le,Ke=Ne+Ve+le;Le(me,he,et,Ke,Ue,F,L,Ve,ct)}}}function _e(Ue,Ne,Ve){x.vertices.push(new oe(Ue,Ne,Ve))}function xe(Ue,Ne,Ve){Ue+=M,Ne+=M,Ve+=M,x.faces.push(new zo(Ue,Ne,Ve,null,null,0));var ct=h.generateTopUV(x,Ue,Ne,Ve);x.faceVertexUvs[0].push(ct)}function Le(Ue,Ne,Ve,ct,F,L,ne,le,me){Ue+=M,Ne+=M,Ve+=M,ct+=M,x.faces.push(new zo(Ue,Ne,ct,null,null,1)),x.faces.push(new zo(Ne,Ve,ct,null,null,1));var he=h.generateSideWallUV(x,Ue,Ne,Ve,ct);x.faceVertexUvs[0].push([he[0],he[1],he[3]]),x.faceVertexUvs[0].push([he[1],he[2],he[3]])}};Ts.WorldUVGenerator={generateTopUV:function(r,e,t,i){var n=r.vertices,a=n[e],o=n[t],s=n[i];return[new St(a.x,a.y),new St(o.x,o.y),new St(s.x,s.y)]},generateSideWallUV:function(r,e,t,i,n){var a=r.vertices,o=a[e],s=a[t],l=a[i],u=a[n];return Math.abs(o.y-s.y)<.01?[new St(o.x,1-o.z),new St(s.x,1-s.z),new St(l.x,1-l.z),new St(u.x,1-u.z)]:[new St(o.y,1-o.z),new St(s.y,1-s.z),new St(l.y,1-l.z),new St(u.y,1-u.z)]}};QS.prototype=Object.create(Ts.prototype);QS.prototype.constructor=QS;Gd.prototype=Object.create(Bt.prototype);Gd.prototype.constructor=Gd;eM.prototype=Object.create(sr.prototype);eM.prototype.constructor=eM;my.prototype=Object.create(Bt.prototype);my.prototype.constructor=my;tM.prototype=Object.create(sr.prototype);tM.prototype.constructor=tM;rM.prototype=Object.create(sr.prototype);rM.prototype.constructor=rM;vy.prototype=Object.create(Bt.prototype);vy.prototype.constructor=vy;iM.prototype=Object.create(sr.prototype);iM.prototype.constructor=iM;gy.prototype=Object.create(Bt.prototype);gy.prototype.constructor=gy;yy.prototype=Object.create(sr.prototype);yy.prototype.constructor=yy;_y.prototype=Object.create(Bt.prototype);_y.prototype.constructor=_y;oc.prototype=Object.create(Bt.prototype);oc.prototype.constructor=oc;Hd.prototype=Object.create(sr.prototype);Hd.prototype.constructor=Hd;nM.prototype=Object.create(Hd.prototype);nM.prototype.constructor=nM;aM.prototype=Object.create(oc.prototype);aM.prototype.constructor=aM;xy.prototype=Object.create(Bt.prototype);xy.prototype.constructor=xy;oM.prototype=Object.create(sr.prototype);oM.prototype.constructor=oM;sM.prototype=Object.create(sr.prototype);sM.prototype.constructor=sM;dl=Object.freeze({WireframeGeometry:sy,ParametricGeometry:WS,ParametricBufferGeometry:ly,TetrahedronGeometry:XS,TetrahedronBufferGeometry:uy,OctahedronGeometry:YS,OctahedronBufferGeometry:Vd,IcosahedronGeometry:qS,IcosahedronBufferGeometry:cy,DodecahedronGeometry:ZS,DodecahedronBufferGeometry:fy,PolyhedronGeometry:jS,PolyhedronBufferGeometry:so,TubeGeometry:KS,TubeBufferGeometry:hy,TorusKnotGeometry:JS,TorusKnotBufferGeometry:py,TorusGeometry:$S,TorusBufferGeometry:dy,TextGeometry:QS,SphereBufferGeometry:Gd,SphereGeometry:eM,RingGeometry:tM,RingBufferGeometry:my,PlaneBufferGeometry:Fd,PlaneGeometry:rM,LatheGeometry:iM,LatheBufferGeometry:vy,ShapeGeometry:yy,ShapeBufferGeometry:gy,ExtrudeGeometry:Ts,EdgesGeometry:_y,ConeGeometry:nM,ConeBufferGeometry:aM,CylinderGeometry:Hd,CylinderBufferGeometry:oc,CircleBufferGeometry:xy,CircleGeometry:oM,BoxBufferGeometry:zd,BoxGeometry:sM});Sy.prototype=Object.create(Ma.prototype);Sy.prototype.constructor=Sy;Sy.prototype.isShadowMaterial=!0;My.prototype=Object.create(Ma.prototype);My.prototype.constructor=My;My.prototype.isRawShaderMaterial=!0;lM.prototype={constructor:lM,isMultiMaterial:!0,toJSON:function(r){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},t=this.materials,i=0,n=t.length;i<n;i++){var a=t[i].toJSON(r);delete a.metadata,e.materials.push(a)}return e.visible=this.visible,e},clone:function(){for(var r=new this.constructor,e=0;e<this.materials.length;e++)r.materials.push(this.materials[e].clone());return r.visible=this.visible,r}};lu.prototype=Object.create(mr.prototype);lu.prototype.constructor=lu;lu.prototype.isMeshStandardMaterial=!0;lu.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.defines={STANDARD:""},this.color.copy(r.color),this.roughness=r.roughness,this.metalness=r.metalness,this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.roughnessMap=r.roughnessMap,this.metalnessMap=r.metalnessMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.envMapIntensity=r.envMapIntensity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};Wd.prototype=Object.create(lu.prototype);Wd.prototype.constructor=Wd;Wd.prototype.isMeshPhysicalMaterial=!0;Wd.prototype.copy=function(r){return lu.prototype.copy.call(this,r),this.defines={PHYSICAL:""},this.reflectivity=r.reflectivity,this.clearCoat=r.clearCoat,this.clearCoatRoughness=r.clearCoatRoughness,this};vl.prototype=Object.create(mr.prototype);vl.prototype.constructor=vl;vl.prototype.isMeshPhongMaterial=!0;vl.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.specular.copy(r.specular),this.shininess=r.shininess,this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};Xd.prototype=Object.create(vl.prototype);Xd.prototype.constructor=Xd;Xd.prototype.isMeshToonMaterial=!0;Xd.prototype.copy=function(r){return vl.prototype.copy.call(this,r),this.gradientMap=r.gradientMap,this};Yd.prototype=Object.create(mr.prototype);Yd.prototype.constructor=Yd;Yd.prototype.isMeshNormalMaterial=!0;Yd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};qd.prototype=Object.create(mr.prototype);qd.prototype.constructor=qd;qd.prototype.isMeshLambertMaterial=!0;qd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};Zd.prototype=Object.create(mr.prototype);Zd.prototype.constructor=Zd;Zd.prototype.isLineDashedMaterial=!0;Zd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.linewidth=r.linewidth,this.scale=r.scale,this.dashSize=r.dashSize,this.gapSize=r.gapSize,this};QRe=Object.freeze({ShadowMaterial:Sy,SpriteMaterial:kd,RawShaderMaterial:My,ShaderMaterial:Ma,PointsMaterial:ml,MultiMaterial:lM,MeshPhysicalMaterial:Wd,MeshStandardMaterial:lu,MeshPhongMaterial:vl,MeshToonMaterial:Xd,MeshNormalMaterial:Yd,MeshLambertMaterial:qd,MeshDepthMaterial:bh,MeshBasicMaterial:oo,LineDashedMaterial:Zd,LineBasicMaterial:Ni,Material:mr}),MF={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};Fo=new tB;Object.assign(Es.prototype,{load:function(r,e,t,i){r===void 0&&(r=""),this.path!==void 0&&(r=this.path+r);var n=this,a=MF.get(r);if(a!==void 0)return n.manager.itemStart(r),setTimeout(function(){e&&e(a),n.manager.itemEnd(r)},0),a;var o=/^data:(.*?)(;base64)?,(.*)$/,s=r.match(o);if(s){var l=s[1],u=!!s[2],c=s[3];c=window.decodeURIComponent(c),u&&(c=window.atob(c));try{var f,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":f=new ArrayBuffer(c.length);for(var p=new Uint8Array(f),d=0;d<c.length;d++)p[d]=c.charCodeAt(d);h==="blob"&&(f=new Blob([f],{type:l}));break;case"document":var g=new DOMParser;f=g.parseFromString(c,l);break;case"json":f=JSON.parse(c);break;default:f=c;break}window.setTimeout(function(){e&&e(f),n.manager.itemEnd(r)},0)}catch(v){window.setTimeout(function(){i&&i(v),n.manager.itemError(r)},0)}}else{var m=new XMLHttpRequest;m.open("GET",r,!0),m.addEventListener("load",function(v){var _=v.target.response;MF.add(r,_),this.status===200?(e&&e(_),n.manager.itemEnd(r)):this.status===0?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(_),n.manager.itemEnd(r)):(i&&i(v),n.manager.itemError(r))},!1),t!==void 0&&m.addEventListener("progress",function(v){t(v)},!1),m.addEventListener("error",function(v){i&&i(v),n.manager.itemError(r)},!1),this.responseType!==void 0&&(m.responseType=this.responseType),this.withCredentials!==void 0&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain"),m.send(null)}return n.manager.itemStart(r),m},setPath:function(r){return this.path=r,this},setResponseType:function(r){return this.responseType=r,this},setWithCredentials:function(r){return this.withCredentials=r,this},setMimeType:function(r){return this.mimeType=r,this}});Object.assign(qne.prototype,{load:function(r,e,t,i){var n=this,a=[],o=new oy;o.image=a;var s=new Es(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer");function l(h){s.load(r[h],function(p){var d=n._parser(p,!0);a[h]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},u+=1,u===6&&(d.mipmapCount===1&&(o.minFilter=no),o.format=d.format,o.needsUpdate=!0,e&&e(o))},t,i)}if(Array.isArray(r))for(var u=0,c=0,f=r.length;c<f;++c)l(c);else s.load(r,function(h){var p=n._parser(h,!0);if(p.isCubemap)for(var d=p.mipmaps.length/p.mipmapCount,g=0;g<d;g++){a[g]={mipmaps:[]};for(var m=0;m<p.mipmapCount;m++)a[g].mipmaps.push(p.mipmaps[g*p.mipmapCount+m]),a[g].format=p.format,a[g].width=p.width,a[g].height=p.height}else o.image.width=p.width,o.image.height=p.height,o.mipmaps=p.mipmaps;p.mipmapCount===1&&(o.minFilter=no),o.format=p.format,o.needsUpdate=!0,e&&e(o)},t,i);return o},setPath:function(r){return this.path=r,this}});eLe=rB;Object.assign(rB.prototype,{load:function(r,e,t,i){var n=this,a=new Od,o=new Es(this.manager);return o.setResponseType("arraybuffer"),o.load(r,function(s){var l=n._parser(s);l&&(l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:Uo,a.wrapT=l.wrapT!==void 0?l.wrapT:Uo,a.magFilter=l.magFilter!==void 0?l.magFilter:no,a.minFilter=l.minFilter!==void 0?l.minFilter:yM,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps),l.mipmapCount===1&&(a.minFilter=no),a.needsUpdate=!0,e&&e(a,l))},t,i),a}});Object.assign(_M.prototype,{load:function(r,e,t,i){var n=this,a=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(a.onload=function(){a.onload=null,URL.revokeObjectURL(a.src),e&&e(a),n.manager.itemEnd(r)},a.onerror=i,r.indexOf("data:")===0)a.src=r;else if(this.crossOrigin!==void 0)a.crossOrigin=this.crossOrigin,a.src=r;else{var o=new Es;o.setPath(this.path),o.setResponseType("blob"),o.setWithCredentials(this.withCredentials),o.load(r,function(s){a.src=URL.createObjectURL(s)},t,i)}return n.manager.itemStart(r),a},setCrossOrigin:function(r){return this.crossOrigin=r,this},setWithCredentials:function(r){return this.withCredentials=r,this},setPath:function(r){return this.path=r,this}});Object.assign(iB.prototype,{load:function(r,e,t,i){var n=new Sh,a=new _M(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(u){a.load(r[u],function(c){n.images[u]=c,o++,o===6&&(n.needsUpdate=!0,e&&e(n))},void 0,i)}for(var l=0;l<r.length;++l)s(l);return n},setCrossOrigin:function(r){return this.crossOrigin=r,this},setPath:function(r){return this.path=r,this}});Object.assign(EC.prototype,{load:function(r,e,t,i){var n=new ai,a=new _M(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setWithCredentials(this.withCredentials),a.setPath(this.path),a.load(r,function(o){var s=r.search(/\.(jpg|jpeg)$/)>0||r.search(/^data\:image\/jpeg/)===0;n.format=s?$g:ou,n.image=o,n.needsUpdate=!0,e!==void 0&&e(n)},t,i),n},setCrossOrigin:function(r){return this.crossOrigin=r,this},setWithCredentials:function(r){return this.withCredentials=r,this},setPath:function(r){return this.path=r,this}});Ui.prototype=Object.assign(Object.create(At.prototype),{constructor:Ui,isLight:!0,copy:function(r){return At.prototype.copy.call(this,r),this.color.copy(r.color),this.intensity=r.intensity,this},toJSON:function(r){var e=At.prototype.toJSON.call(this,r);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),e}});eC.prototype=Object.assign(Object.create(Ui.prototype),{constructor:eC,isHemisphereLight:!0,copy:function(r){return Ui.prototype.copy.call(this,r),this.groundColor.copy(r.groundColor),this}});Object.assign(rm.prototype,{copy:function(r){return this.camera=r.camera.clone(),this.bias=r.bias,this.radius=r.radius,this.mapSize.copy(r.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var r={};return this.bias!==0&&(r.bias=this.bias),this.radius!==1&&(r.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(r.mapSize=this.mapSize.toArray()),r.camera=this.camera.toJSON(!1).object,delete r.camera.matrix,r}});tC.prototype=Object.assign(Object.create(rm.prototype),{constructor:tC,isSpotLightShadow:!0,update:function(r){var e=cr.RAD2DEG*2*r.angle,t=this.mapSize.width/this.mapSize.height,i=r.distance||500,n=this.camera;(e!==n.fov||t!==n.aspect||i!==n.far)&&(n.fov=e,n.aspect=t,n.far=i,n.updateProjectionMatrix())}});rC.prototype=Object.assign(Object.create(Ui.prototype),{constructor:rC,isSpotLight:!0,copy:function(r){return Ui.prototype.copy.call(this,r),this.distance=r.distance,this.angle=r.angle,this.penumbra=r.penumbra,this.decay=r.decay,this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}});iC.prototype=Object.assign(Object.create(Ui.prototype),{constructor:iC,isPointLight:!0,copy:function(r){return Ui.prototype.copy.call(this,r),this.distance=r.distance,this.decay=r.decay,this.shadow=r.shadow.clone(),this}});nC.prototype=Object.assign(Object.create(rm.prototype),{constructor:nC});aC.prototype=Object.assign(Object.create(Ui.prototype),{constructor:aC,isDirectionalLight:!0,copy:function(r){return Ui.prototype.copy.call(this,r),this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}});oC.prototype=Object.assign(Object.create(Ui.prototype),{constructor:oC,isAmbientLight:!0});Jn={arraySlice:function(r,e,t){return Jn.isTypedArray(r)?new r.constructor(r.subarray(e,t)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(a,o){return r[a]-r[o]}for(var t=r.length,i=new Array(t),n=0;n!==t;++n)i[n]=n;return i.sort(e),i},sortedArray:function(r,e,t){for(var i=r.length,n=new r.constructor(i),a=0,o=0;o!==i;++a)for(var s=t[a]*e,l=0;l!==e;++l)n[o++]=r[s+l];return n},flattenJSON:function(r,e,t,i){for(var n=1,a=r[0];a!==void 0&&a[i]===void 0;)a=r[n++];if(a!==void 0){var o=a[i];if(o!==void 0)if(Array.isArray(o))do o=a[i],o!==void 0&&(e.push(a.time),t.push.apply(t,o)),a=r[n++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[i],o!==void 0&&(e.push(a.time),o.toArray(t,t.length)),a=r[n++];while(a!==void 0);else do o=a[i],o!==void 0&&(e.push(a.time),t.push(o)),a=r[n++];while(a!==void 0)}}};ao.prototype={constructor:ao,evaluate:function(r){var e=this.parameterPositions,t=this._cachedIndex,i=e[t],n=e[t-1];e:{t:{var a;r:{i:if(!(r<i)){for(var o=t+2;;){if(i===void 0){if(r<n)break i;return t=e.length,this._cachedIndex=t,this.afterEnd_(t-1,r,n)}if(t===o)break;if(n=i,i=e[++t],r<i)break t}a=e.length;break r}if(!(r>=n)){var s=e[1];r<s&&(t=2,n=s);for(var o=t-2;;){if(n===void 0)return this._cachedIndex=0,this.beforeStart_(0,r,i);if(t===o)break;if(i=n,n=e[--t-1],r>=n)break t}a=t,t=0;break r}break e}for(;t<a;){var l=t+a>>>1;r<e[l]?a=l:t=l+1}if(i=e[t],n=e[t-1],n===void 0)return this._cachedIndex=0,this.beforeStart_(0,r,i);if(i===void 0)return t=e.length,this._cachedIndex=t,this.afterEnd_(t-1,n,r)}this._cachedIndex=t,this.intervalChanged_(t,n,i)}return this.interpolate_(t,n,r,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(r){for(var e=this.resultBuffer,t=this.sampleValues,i=this.valueSize,n=r*i,a=0;a!==i;++a)e[a]=t[n+a];return e},interpolate_:function(r,e,t,i){throw new Error("call to abstract method")},intervalChanged_:function(r,e,t){}};Object.assign(ao.prototype,{beforeStart_:ao.prototype.copySampleValue_,afterEnd_:ao.prototype.copySampleValue_});sC.prototype=Object.assign(Object.create(ao.prototype),{constructor:sC,DefaultSettings_:{endingStart:Ud,endingEnd:Ud},intervalChanged_:function(r,e,t){var i=this.parameterPositions,n=r-2,a=r+1,o=i[n],s=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Rd:n=r,o=2*e-t;break;case LS:n=i.length-2,o=e+i[n]-i[n+1];break;default:n=r,o=t}if(s===void 0)switch(this.getSettings_().endingEnd){case Rd:a=r,s=2*t-e;break;case LS:a=1,s=t+i[1]-i[0];break;default:a=r-1,s=e}var l=(t-e)*.5,u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(s-t),this._offsetPrev=n*u,this._offsetNext=a*u},interpolate_:function(r,e,t,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=r*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,f=this._weightPrev,h=this._weightNext,p=(t-e)/(i-e),d=p*p,g=d*p,m=-f*g+2*f*d-f*p,v=(1+f)*g+(-1.5-2*f)*d+(-.5+f)*p+1,_=(-1-h)*g+(1.5+h)*d+.5*p,y=h*g-h*d,x=0;x!==o;++x)n[x]=m*a[u+x]+v*a[l+x]+_*a[s+x]+y*a[c+x];return n}});uM.prototype=Object.assign(Object.create(ao.prototype),{constructor:uM,interpolate_:function(r,e,t,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=r*o,l=s-o,u=(t-e)/(i-e),c=1-u,f=0;f!==o;++f)n[f]=a[l+f]*c+a[s+f]*u;return n}});lC.prototype=Object.assign(Object.create(ao.prototype),{constructor:lC,interpolate_:function(r,e,t,i){return this.copySampleValue_(r-1)}});lc={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:wS,InterpolantFactoryMethodDiscrete:function(r){return new lC(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodLinear:function(r){return new uM(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodSmooth:function(r){return new sC(this.times,this.values,this.getValueSize(),r)},setInterpolation:function(r){var e;switch(r){case RS:e=this.InterpolantFactoryMethodDiscrete;break;case wS:e=this.InterpolantFactoryMethodLinear;break;case GA:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){var t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(r!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(t);console.warn(t);return}this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return RS;case this.InterpolantFactoryMethodLinear:return wS;case this.InterpolantFactoryMethodSmooth:return GA}},getValueSize:function(){return this.values.length/this.times.length},shift:function(r){if(r!==0)for(var e=this.times,t=0,i=e.length;t!==i;++t)e[t]+=r;return this},scale:function(r){if(r!==1)for(var e=this.times,t=0,i=e.length;t!==i;++t)e[t]*=r;return this},trim:function(r,e){for(var t=this.times,i=t.length,n=0,a=i-1;n!==i&&t[n]<r;)++n;for(;a!==-1&&t[a]>e;)--a;if(++a,n!==0||a!==i){n>=a&&(a=Math.max(a,1),n=a-1);var o=this.getValueSize();this.times=Jn.arraySlice(t,n,a),this.values=Jn.arraySlice(this.values,n*o,a*o)}return this},validate:function(){var r=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),r=!1);var t=this.times,i=this.values,n=t.length;n===0&&(console.error("track is empty",this),r=!1);for(var a=null,o=0;o!==n;o++){var s=t[o];if(typeof s=="number"&&isNaN(s)){console.error("time is not a valid number",this,o,s),r=!1;break}if(a!==null&&a>s){console.error("out of order keys",this,o,s,a),r=!1;break}a=s}if(i!==void 0&&Jn.isTypedArray(i))for(var o=0,l=i.length;o!==l;++o){var u=i[o];if(isNaN(u)){console.error("value is not a valid number",this,o,u),r=!1;break}}return r},optimize:function(){for(var r=this.times,e=this.values,t=this.getValueSize(),i=this.getInterpolation()===GA,n=1,a=r.length-1,o=1;o<a;++o){var s=!1,l=r[o],u=r[o+1];if(l!==u&&(o!==1||l!==l[0]))if(i)s=!0;else for(var c=o*t,f=c-t,h=c+t,p=0;p!==t;++p){var d=e[c+p];if(d!==e[f+p]||d!==e[h+p]){s=!0;break}}if(s){if(o!==n){r[n]=r[o];for(var g=o*t,m=n*t,p=0;p!==t;++p)e[m+p]=e[g+p]}++n}}if(a>0){r[n]=r[a];for(var g=a*t,m=n*t,p=0;p!==t;++p)e[m+p]=e[g+p];++n}return n!==r.length&&(this.times=Jn.arraySlice(r,0,n),this.values=Jn.arraySlice(e,0,n*t)),this}};by.prototype=Object.assign(Object.create(lc),{constructor:by,ValueTypeName:"vector"});uC.prototype=Object.assign(Object.create(ao.prototype),{constructor:uC,interpolate_:function(r,e,t,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=r*o,l=(t-e)/(i-e),u=s+o;s!==u;s+=4)on.slerpFlat(n,0,a,s-o,a,s,l);return n}});cM.prototype=Object.assign(Object.create(lc),{constructor:cM,ValueTypeName:"quaternion",DefaultInterpolation:wS,InterpolantFactoryMethodLinear:function(r){return new uC(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodSmooth:void 0});wy.prototype=Object.assign(Object.create(lc),{constructor:wy,ValueTypeName:"number"});cC.prototype=Object.assign(Object.create(lc),{constructor:cC,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:RS,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});fC.prototype=Object.assign(Object.create(lc),{constructor:fC,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:RS,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});hC.prototype=Object.assign(Object.create(lc),{constructor:hC,ValueTypeName:"color"});jd.prototype=lc;lc.constructor=jd;Object.assign(jd,{parse:function(r){if(r.type===void 0)throw new Error("track type undefined, can not parse");var e=jd._getTrackTypeForValueTypeName(r.type);if(r.times===void 0){var t=[],i=[];Jn.flattenJSON(r.keys,t,i,"value"),r.times=t,r.values=i}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)},toJSON:function(r){var e=r.constructor,t;if(e.toJSON!==void 0)t=e.toJSON(r);else{t={name:r.name,times:Jn.convertArray(r.times,Array),values:Jn.convertArray(r.values,Array)};var i=r.getInterpolation();i!==r.DefaultInterpolation&&(t.interpolation=i)}return t.type=r.ValueTypeName,t},_getTrackTypeForValueTypeName:function(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return wy;case"vector":case"vector2":case"vector3":case"vector4":return by;case"color":return hC;case"quaternion":return cM;case"bool":case"boolean":return fC;case"string":return cC}throw new Error("Unsupported typeName: "+r)}});No.prototype={constructor:No,resetDuration:function(){for(var r=this.tracks,e=0,t=0,i=r.length;t!==i;++t){var n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}this.duration=e},trim:function(){for(var r=0;r<this.tracks.length;r++)this.tracks[r].trim(0,this.duration);return this},optimize:function(){for(var r=0;r<this.tracks.length;r++)this.tracks[r].optimize();return this}};Object.assign(No,{parse:function(r){for(var e=[],t=r.tracks,i=1/(r.fps||1),n=0,a=t.length;n!==a;++n)e.push(jd.parse(t[n]).scale(i));return new No(r.name,r.duration,e)},toJSON:function(r){for(var e=[],t=r.tracks,i={name:r.name,duration:r.duration,tracks:e},n=0,a=t.length;n!==a;++n)e.push(jd.toJSON(t[n]));return i},CreateFromMorphTargetSequence:function(r,e,t,i){for(var n=e.length,a=[],o=0;o<n;o++){var s=[],l=[];s.push((o+n-1)%n,o,(o+1)%n),l.push(0,1,0);var u=Jn.getKeyframeOrder(s);s=Jn.sortedArray(s,1,u),l=Jn.sortedArray(l,1,u),!i&&s[0]===0&&(s.push(n),l.push(l[0])),a.push(new wy(".morphTargetInfluences["+e[o].name+"]",s,l).scale(1/t))}return new No(r,-1,a)},findByName:function(r,e){var t=r;if(!Array.isArray(r)){var i=r;t=i.geometry&&i.geometry.animations||i.animations}for(var n=0;n<t.length;n++)if(t[n].name===e)return t[n];return null},CreateClipsFromMorphTargetSequences:function(r,e,t){for(var i={},n=/^([\w-]*?)([\d]+)$/,a=0,o=r.length;a<o;a++){var s=r[a],l=s.name.match(n);if(l&&l.length>1){var u=l[1],c=i[u];c||(i[u]=c=[]),c.push(s)}}var f=[];for(var u in i)f.push(No.CreateFromMorphTargetSequence(u,i[u],e,t));return f},parseAnimation:function(r,e){if(!r)return console.error(" no animation in JSONLoader data"),null;for(var t=function(y,x,M,S,w){if(M.length!==0){var T=[],C=[];Jn.flattenJSON(M,T,C,S),T.length!==0&&w.push(new y(x,T,C))}},i=[],n=r.name||"default",a=r.length||-1,o=r.fps||30,s=r.hierarchy||[],l=0;l<s.length;l++){var u=s[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var c={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var h=0;h<u[f].morphTargets.length;h++)c[u[f].morphTargets[h]]=-1;for(var p in c){for(var d=[],g=[],h=0;h!==u[f].morphTargets.length;++h){var m=u[f];d.push(m.time),g.push(m.morphTarget===p?1:0)}i.push(new wy(".morphTargetInfluence["+p+"]",d,g))}a=c.length*(o||1)}else{var v=".bones["+e[l].name+"]";t(by,v+".position",u,"pos",i),t(cM,v+".quaternion",u,"rot",i),t(by,v+".scale",u,"scl",i)}}if(i.length===0)return null;var _=new No(n,a,i);return _}});Object.assign(AC.prototype,{load:function(r,e,t,i){var n=this,a=new Es(n.manager);a.load(r,function(o){e(n.parse(JSON.parse(o)))},t,i)},setTextures:function(r){this.textures=r},parse:function(r){var e=this.textures;function t(s){return e[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),e[s]}var i=new QRe[r.type];if(r.uuid!==void 0&&(i.uuid=r.uuid),r.name!==void 0&&(i.name=r.name),r.color!==void 0&&i.color.setHex(r.color),r.roughness!==void 0&&(i.roughness=r.roughness),r.metalness!==void 0&&(i.metalness=r.metalness),r.emissive!==void 0&&i.emissive.setHex(r.emissive),r.specular!==void 0&&i.specular.setHex(r.specular),r.shininess!==void 0&&(i.shininess=r.shininess),r.clearCoat!==void 0&&(i.clearCoat=r.clearCoat),r.clearCoatRoughness!==void 0&&(i.clearCoatRoughness=r.clearCoatRoughness),r.uniforms!==void 0&&(i.uniforms=r.uniforms),r.vertexShader!==void 0&&(i.vertexShader=r.vertexShader),r.fragmentShader!==void 0&&(i.fragmentShader=r.fragmentShader),r.vertexColors!==void 0&&(i.vertexColors=r.vertexColors),r.fog!==void 0&&(i.fog=r.fog),r.shading!==void 0&&(i.shading=r.shading),r.blending!==void 0&&(i.blending=r.blending),r.side!==void 0&&(i.side=r.side),r.opacity!==void 0&&(i.opacity=r.opacity),r.transparent!==void 0&&(i.transparent=r.transparent),r.alphaTest!==void 0&&(i.alphaTest=r.alphaTest),r.depthTest!==void 0&&(i.depthTest=r.depthTest),r.depthWrite!==void 0&&(i.depthWrite=r.depthWrite),r.colorWrite!==void 0&&(i.colorWrite=r.colorWrite),r.wireframe!==void 0&&(i.wireframe=r.wireframe),r.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=r.wireframeLinewidth),r.wireframeLinecap!==void 0&&(i.wireframeLinecap=r.wireframeLinecap),r.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=r.wireframeLinejoin),r.skinning!==void 0&&(i.skinning=r.skinning),r.morphTargets!==void 0&&(i.morphTargets=r.morphTargets),r.size!==void 0&&(i.size=r.size),r.sizeAttenuation!==void 0&&(i.sizeAttenuation=r.sizeAttenuation),r.map!==void 0&&(i.map=t(r.map)),r.alphaMap!==void 0&&(i.alphaMap=t(r.alphaMap),i.transparent=!0),r.bumpMap!==void 0&&(i.bumpMap=t(r.bumpMap)),r.bumpScale!==void 0&&(i.bumpScale=r.bumpScale),r.normalMap!==void 0&&(i.normalMap=t(r.normalMap)),r.normalScale!==void 0){var n=r.normalScale;Array.isArray(n)===!1&&(n=[n,n]),i.normalScale=new St().fromArray(n)}if(r.displacementMap!==void 0&&(i.displacementMap=t(r.displacementMap)),r.displacementScale!==void 0&&(i.displacementScale=r.displacementScale),r.displacementBias!==void 0&&(i.displacementBias=r.displacementBias),r.roughnessMap!==void 0&&(i.roughnessMap=t(r.roughnessMap)),r.metalnessMap!==void 0&&(i.metalnessMap=t(r.metalnessMap)),r.emissiveMap!==void 0&&(i.emissiveMap=t(r.emissiveMap)),r.emissiveIntensity!==void 0&&(i.emissiveIntensity=r.emissiveIntensity),r.specularMap!==void 0&&(i.specularMap=t(r.specularMap)),r.envMap!==void 0&&(i.envMap=t(r.envMap)),r.reflectivity!==void 0&&(i.reflectivity=r.reflectivity),r.lightMap!==void 0&&(i.lightMap=t(r.lightMap)),r.lightMapIntensity!==void 0&&(i.lightMapIntensity=r.lightMapIntensity),r.aoMap!==void 0&&(i.aoMap=t(r.aoMap)),r.aoMapIntensity!==void 0&&(i.aoMapIntensity=r.aoMapIntensity),r.gradientMap!==void 0&&(i.gradientMap=t(r.gradientMap)),r.materials!==void 0)for(var a=0,o=r.materials.length;a<o;a++)i.materials.push(this.parse(r.materials[a]));return i}});Object.assign(nB.prototype,{load:function(r,e,t,i){var n=this,a=new Es(n.manager);a.load(r,function(o){e(n.parse(JSON.parse(o)))},t,i)},parse:function(r){var e=new Bt,t=r.data.index,i={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};if(t!==void 0){var n=new i[t.type](t.array);e.setIndex(new gt(n,1))}var a=r.data.attributes;for(var o in a){var s=a[o],n=new i[s.type](s.array);e.addAttribute(o,new gt(n,s.itemSize,s.normalized))}var l=r.data.groups||r.data.drawcalls||r.data.offsets;if(l!==void 0)for(var u=0,c=l.length;u!==c;++u){var f=l[u];e.addGroup(f.start,f.count,f.materialIndex)}var h=r.data.boundingSphere;if(h!==void 0){var p=new oe;h.center!==void 0&&p.fromArray(h.center),e.boundingSphere=new $n(p,h.radius)}return e}});Dd.prototype={constructor:Dd,crossOrigin:void 0,extractUrlBase:function(r){var e=r.split("/");return e.length===1?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(r,e,t){for(var i=[],n=0;n<r.length;++n)i[n]=this.createMaterial(r[n],e,t);return i},createMaterial:function(){var r,e,t;return function(n,a,o){r===void 0&&(r=new Gt),e===void 0&&(e=new EC),t===void 0&&(t=new AC);var s={};function l(h,p,d,g,m){var v=a+h,_=Dd.Handlers.get(v),y;_!==null?y=_.load(v):(e.setCrossOrigin(o),y=e.load(v)),p!==void 0&&(y.repeat.fromArray(p),p[0]!==1&&(y.wrapS=rc),p[1]!==1&&(y.wrapT=rc)),d!==void 0&&y.offset.fromArray(d),g!==void 0&&(g[0]==="repeat"&&(y.wrapS=rc),g[0]==="mirror"&&(y.wrapS=Nd),g[1]==="repeat"&&(y.wrapT=rc),g[1]==="mirror"&&(y.wrapT=Nd)),m!==void 0&&(y.anisotropy=m);var x=cr.generateUUID();return s[x]=y,x}var u={uuid:cr.generateUUID(),type:"MeshLambertMaterial"};for(var c in n){var f=n[c];switch(c){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=f;break;case"blending":u.blending=Hie[f];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",c,"is no longer supported.");break;case"colorDiffuse":u.color=r.fromArray(f).getHex();break;case"colorSpecular":u.specular=r.fromArray(f).getHex();break;case"colorEmissive":u.emissive=r.fromArray(f).getHex();break;case"specularCoef":u.shininess=f;break;case"shading":f.toLowerCase()==="basic"&&(u.type="MeshBasicMaterial"),f.toLowerCase()==="phong"&&(u.type="MeshPhongMaterial"),f.toLowerCase()==="standard"&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=l(f,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=l(f,n.mapEmissiveRepeat,n.mapEmissiveOffset,n.mapEmissiveWrap,n.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=l(f,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=l(f,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=l(f,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=f;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=l(f,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=[f,f];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=l(f,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=l(f,n.mapMetalnessRepeat,n.mapMetalnessOffset,n.mapMetalnessWrap,n.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=l(f,n.mapRoughnessRepeat,n.mapRoughnessOffset,n.mapRoughnessWrap,n.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=l(f,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=xh;break;case"doubleSided":u.side=Oy;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=f;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[c]=f;break;case"vertexColors":f===!0&&(u.vertexColors=tm),f==="face"&&(u.vertexColors=FF);break;default:console.error("THREE.Loader.createMaterial: Unsupported",c,f);break}}return u.type==="MeshBasicMaterial"&&delete u.emissive,u.type!=="MeshPhongMaterial"&&delete u.specular,u.opacity<1&&(u.transparent=!0),t.setTextures(s),t.parse(u)}}()};Dd.Handlers={handlers:[],add:function(r,e){this.handlers.push(r,e)},get:function(r){for(var e=this.handlers,t=0,i=e.length;t<i;t+=2){var n=e[t],a=e[t+1];if(n.test(r))return a}return null}};Object.assign(aB.prototype,{load:function(r,e,t,i){var n=this,a=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:Dd.prototype.extractUrlBase(r),o=new Es(this.manager);o.setWithCredentials(this.withCredentials),o.load(r,function(s){var l=JSON.parse(s),u=l.metadata;if(u!==void 0){var c=u.type;if(c!==void 0){if(c.toLowerCase()==="object"){console.error("THREE.JSONLoader: "+r+" should be loaded with THREE.ObjectLoader instead.");return}if(c.toLowerCase()==="scene"){console.error("THREE.JSONLoader: "+r+" should be loaded with THREE.SceneLoader instead.");return}}}var f=n.parse(l,a);e(f.geometry,f.materials)},t,i)},setTexturePath:function(r){this.texturePath=r},parse:function(r,e){var t=new sr,i=r.scale!==void 0?1/r.scale:1;n(i),a(),o(i),s(),t.computeFaceNormals(),t.computeBoundingSphere();function n(u){function c(ve,ue){return ve&1<<ue}var f,h,p,d,g,m,v,_,y,x,M,S,w,T,C,b,E,I,R,A,D,U,B,z,k,G,Y,J=r.faces,Q=r.vertices,V=r.normals,K=r.colors,ae=0;if(r.uvs!==void 0){for(f=0;f<r.uvs.length;f++)r.uvs[f].length&&ae++;for(f=0;f<ae;f++)t.faceVertexUvs[f]=[]}for(d=0,g=Q.length;d<g;)I=new oe,I.x=Q[d++]*u,I.y=Q[d++]*u,I.z=Q[d++]*u,t.vertices.push(I);for(d=0,g=J.length;d<g;)if(x=J[d++],M=c(x,0),S=c(x,1),w=c(x,3),T=c(x,4),C=c(x,5),b=c(x,6),E=c(x,7),M){if(A=new zo,A.a=J[d],A.b=J[d+1],A.c=J[d+3],D=new zo,D.a=J[d+1],D.b=J[d+2],D.c=J[d+3],d+=4,S&&(y=J[d++],A.materialIndex=y,D.materialIndex=y),p=t.faces.length,w)for(f=0;f<ae;f++)for(z=r.uvs[f],t.faceVertexUvs[f][p]=[],t.faceVertexUvs[f][p+1]=[],h=0;h<4;h++)_=J[d++],G=z[_*2],Y=z[_*2+1],k=new St(G,Y),h!==2&&t.faceVertexUvs[f][p].push(k),h!==0&&t.faceVertexUvs[f][p+1].push(k);if(T&&(v=J[d++]*3,A.normal.set(V[v++],V[v++],V[v]),D.normal.copy(A.normal)),C)for(f=0;f<4;f++)v=J[d++]*3,B=new oe(V[v++],V[v++],V[v]),f!==2&&A.vertexNormals.push(B),f!==0&&D.vertexNormals.push(B);if(b&&(m=J[d++],U=K[m],A.color.setHex(U),D.color.setHex(U)),E)for(f=0;f<4;f++)m=J[d++],U=K[m],f!==2&&A.vertexColors.push(new Gt(U)),f!==0&&D.vertexColors.push(new Gt(U));t.faces.push(A),t.faces.push(D)}else{if(R=new zo,R.a=J[d++],R.b=J[d++],R.c=J[d++],S&&(y=J[d++],R.materialIndex=y),p=t.faces.length,w)for(f=0;f<ae;f++)for(z=r.uvs[f],t.faceVertexUvs[f][p]=[],h=0;h<3;h++)_=J[d++],G=z[_*2],Y=z[_*2+1],k=new St(G,Y),t.faceVertexUvs[f][p].push(k);if(T&&(v=J[d++]*3,R.normal.set(V[v++],V[v++],V[v])),C)for(f=0;f<3;f++)v=J[d++]*3,B=new oe(V[v++],V[v++],V[v]),R.vertexNormals.push(B);if(b&&(m=J[d++],R.color.setHex(K[m])),E)for(f=0;f<3;f++)m=J[d++],R.vertexColors.push(new Gt(K[m]));t.faces.push(R)}}function a(){var u=r.influencesPerVertex!==void 0?r.influencesPerVertex:2;if(r.skinWeights)for(var c=0,f=r.skinWeights.length;c<f;c+=u){var h=r.skinWeights[c],p=u>1?r.skinWeights[c+1]:0,d=u>2?r.skinWeights[c+2]:0,g=u>3?r.skinWeights[c+3]:0;t.skinWeights.push(new ei(h,p,d,g))}if(r.skinIndices)for(var c=0,f=r.skinIndices.length;c<f;c+=u){var m=r.skinIndices[c],v=u>1?r.skinIndices[c+1]:0,_=u>2?r.skinIndices[c+2]:0,y=u>3?r.skinIndices[c+3]:0;t.skinIndices.push(new ei(m,v,_,y))}t.bones=r.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}function o(u){if(r.morphTargets!==void 0)for(var c=0,f=r.morphTargets.length;c<f;c++){t.morphTargets[c]={},t.morphTargets[c].name=r.morphTargets[c].name,t.morphTargets[c].vertices=[];for(var h=t.morphTargets[c].vertices,p=r.morphTargets[c].vertices,d=0,g=p.length;d<g;d+=3){var m=new oe;m.x=p[d]*u,m.y=p[d+1]*u,m.z=p[d+2]*u,h.push(m)}}if(r.morphColors!==void 0&&r.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var v=t.faces,_=r.morphColors[0].colors,c=0,f=v.length;c<f;c++)v[c].color.fromArray(_,c*3)}}function s(){var u=[],c=[];r.animation!==void 0&&c.push(r.animation),r.animations!==void 0&&(r.animations.length?c=c.concat(r.animations):c.push(r.animations));for(var f=0;f<c.length;f++){var h=No.parseAnimation(c[f],t.bones);h&&u.push(h)}if(t.morphTargets){var p=No.CreateClipsFromMorphTargetSequences(t.morphTargets,10);u=u.concat(p)}u.length>0&&(t.animations=u)}if(r.materials===void 0||r.materials.length===0)return{geometry:t};var l=Dd.prototype.initMaterials(r.materials,e,this.crossOrigin);return{geometry:t,materials:l}}});Object.assign(Zne.prototype,{load:function(r,e,t,i){this.texturePath===""&&(this.texturePath=r.substring(0,r.lastIndexOf("/")+1));var n=this,a=new Es(n.manager);a.load(r,function(o){var s=null;try{s=JSON.parse(o)}catch(u){console.error("THREE:ObjectLoader: Can't parse "+r+".",u.message);return}var l=s.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+r+". Use THREE.JSONLoader instead.");return}n.parse(s,e)},t,i)},setTexturePath:function(r){this.texturePath=r},setCrossOrigin:function(r){this.crossOrigin=r},parse:function(r,e){var t=this.parseGeometries(r.geometries),i=this.parseImages(r.images,function(){e!==void 0&&e(o)}),n=this.parseTextures(r.textures,i),a=this.parseMaterials(r.materials,n),o=this.parseObject(r.object,t,a);return r.animations&&(o.animations=this.parseAnimations(r.animations)),(r.images===void 0||r.images.length===0)&&e!==void 0&&e(o),o},parseGeometries:function(r){var e={};if(r!==void 0)for(var t=new aB,i=new nB,n=0,a=r.length;n<a;n++){var o,s=r[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new dl[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new dl[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new dl[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new dl[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new dl[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new dl[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new dl[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new dl[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new dl[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new dl[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new dl[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=i.parse(s);break;case"Geometry":o=t.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),e[s.uuid]=o}return e},parseMaterials:function(r,e){var t={};if(r!==void 0){var i=new AC;i.setTextures(e);for(var n=0,a=r.length;n<a;n++){var o=i.parse(r[n]);t[o.uuid]=o}}return t},parseAnimations:function(r){for(var e=[],t=0;t<r.length;t++){var i=No.parse(r[t]);e.push(i)}return e},parseImages:function(r,e){var t=this,i={};function n(f){return t.manager.itemStart(f),o.load(f,function(){t.manager.itemEnd(f)},void 0,function(){t.manager.itemError(f)})}if(r!==void 0&&r.length>0){var a=new tB(e),o=new _M(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,l=r.length;s<l;s++){var u=r[s],c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(u.url)?u.url:t.texturePath+u.url;i[u.uuid]=n(c)}}return i},parseTextures:function(r,e){function t(l,u){return typeof l=="number"?l:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",l),u[l])}var i={};if(r!==void 0)for(var n=0,a=r.length;n<a;n++){var o=r[n];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),e[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=new ai(e[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=t(o.mapping,pne)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.wrap!==void 0&&(s.wrapS=t(o.wrap[0],cF),s.wrapT=t(o.wrap[1],cF)),o.minFilter!==void 0&&(s.minFilter=t(o.minFilter,fF)),o.magFilter!==void 0&&(s.magFilter=t(o.magFilter,fF)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),i[o.uuid]=s}return i},parseObject:function(){var r=new qt;return function(t,i,n){var a;function o(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),i[d]}function s(d){if(d!==void 0)return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}switch(t.type){case"Scene":a=new Bd,t.background!==void 0&&Number.isInteger(t.background)&&(a.background=new Gt(t.background)),t.fog!==void 0&&(t.fog.type==="Fog"?a.fog=new ny(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(a.fog=new iy(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":a=new Kn(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(a.focus=t.focus),t.zoom!==void 0&&(a.zoom=t.zoom),t.filmGauge!==void 0&&(a.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(a.filmOffset=t.filmOffset),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new ry(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":a=new oC(t.color,t.intensity);break;case"DirectionalLight":a=new aC(t.color,t.intensity);break;case"PointLight":a=new iC(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":a=new rC(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new eC(t.color,t.groundColor,t.intensity);break;case"Mesh":var l=o(t.geometry),u=s(t.material);l.bones&&l.bones.length>0?a=new JA(l,u):a=new mn(l,u);break;case"LOD":a=new VS;break;case"Line":a=new ac(o(t.geometry),s(t.material),t.mode);break;case"LineSegments":a=new di(o(t.geometry),s(t.material));break;case"PointCloud":case"Points":a=new ay(o(t.geometry),s(t.material));break;case"Sprite":a=new kS(s(t.material));break;case"Group":a=new GS;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new At}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.matrix!==void 0?(r.fromArray(t.matrix),r.decompose(a.position,a.quaternion,a.scale)):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.userData!==void 0&&(a.userData=t.userData),t.children!==void 0)for(var c in t.children)a.add(this.parseObject(t.children[c],i,n));if(t.type==="LOD")for(var f=t.levels,h=0;h<f.length;h++){var p=f[h],c=a.getObjectByProperty("uuid",p.object);c!==void 0&&a.addLevel(c,p.distance)}return a}}()});ea.prototype={constructor:ea,getPoint:function(r){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(r){var e=this.getUtoTmapping(r);return this.getPoint(e)},getPoints:function(r){r||(r=5);for(var e=[],t=0;t<=r;t++)e.push(this.getPoint(t/r));return e},getSpacedPoints:function(r){r||(r=5);for(var e=[],t=0;t<=r;t++)e.push(this.getPointAt(t/r));return e},getLength:function(){var r=this.getLengths();return r[r.length-1]},getLengths:function(r){if(r||(r=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===r+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e=[],t,i=this.getPoint(0),n,a=0;for(e.push(0),n=1;n<=r;n++)t=this.getPoint(n/r),a+=t.distanceTo(i),e.push(a),i=t;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(r,e){var t=this.getLengths(),i=0,n=t.length,a;e?a=e:a=r*t[n-1];for(var o=0,s=n-1,l;o<=s;)if(i=Math.floor(o+(s-o)/2),l=t[i]-a,l<0)o=i+1;else if(l>0)s=i-1;else{s=i;break}if(i=s,t[i]===a){var p=i/(n-1);return p}var u=t[i],c=t[i+1],f=c-u,h=(a-u)/f,p=(i+h)/(n-1);return p},getTangent:function(r){var e=1e-4,t=r-e,i=r+e;t<0&&(t=0),i>1&&(i=1);var n=this.getPoint(t),a=this.getPoint(i),o=a.clone().sub(n);return o.normalize()},getTangentAt:function(r){var e=this.getUtoTmapping(r);return this.getTangent(e)},computeFrenetFrames:function(r,e){var t=new oe,i=[],n=[],a=[],o=new oe,s=new qt,l,u,c;for(l=0;l<=r;l++)u=l/r,i[l]=this.getTangentAt(u),i[l].normalize();n[0]=new oe,a[0]=new oe;var f=Number.MAX_VALUE,h=Math.abs(i[0].x),p=Math.abs(i[0].y),d=Math.abs(i[0].z);for(h<=f&&(f=h,t.set(1,0,0)),p<=f&&(f=p,t.set(0,1,0)),d<=f&&t.set(0,0,1),o.crossVectors(i[0],t).normalize(),n[0].crossVectors(i[0],o),a[0].crossVectors(i[0],n[0]),l=1;l<=r;l++)n[l]=n[l-1].clone(),a[l]=a[l-1].clone(),o.crossVectors(i[l-1],i[l]),o.length()>Number.EPSILON&&(o.normalize(),c=Math.acos(cr.clamp(i[l-1].dot(i[l]),-1,1)),n[l].applyMatrix4(s.makeRotationAxis(o,c))),a[l].crossVectors(i[l],n[l]);if(e===!0)for(c=Math.acos(cr.clamp(n[0].dot(n[r]),-1,1)),c/=r,i[0].dot(o.crossVectors(n[0],n[r]))>0&&(c=-c),l=1;l<=r;l++)n[l].applyMatrix4(s.makeRotationAxis(i[l],c*l)),a[l].crossVectors(i[l],n[l]);return{tangents:i,normals:n,binormals:a}}};ea.create=function(r,e){return r.prototype=Object.create(ea.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};uu.prototype=Object.create(ea.prototype);uu.prototype.constructor=uu;uu.prototype.isLineCurve=!0;uu.prototype.getPoint=function(r){if(r===1)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(r).add(this.v1),e};uu.prototype.getPointAt=function(r){return this.getPoint(r)};uu.prototype.getTangent=function(r){var e=this.v2.clone().sub(this.v1);return e.normalize()};fM.prototype=Object.assign(Object.create(ea.prototype),{constructor:fM,add:function(r){this.curves.push(r)},closePath:function(){var r=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);r.equals(e)||this.curves.push(new uu(e,r))},getPoint:function(r){for(var e=r*this.getLength(),t=this.getCurveLengths(),i=0;i<t.length;){if(t[i]>=e){var n=t[i]-e,a=this.curves[i],o=a.getLength(),s=o===0?0:1-n/o;return a.getPointAt(s)}i++}return null},getLength:function(){var r=this.getCurveLengths();return r[r.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var r=[],e=0,t=0,i=this.curves.length;t<i;t++)e+=this.curves[t].getLength(),r.push(e);return this.cacheLengths=r,r},getSpacedPoints:function(r){r||(r=40);for(var e=[],t=0;t<=r;t++)e.push(this.getPoint(t/r));return this.autoClose&&e.push(e[0]),e},getPoints:function(r){r=r||12;for(var e=[],t,i=0,n=this.curves;i<n.length;i++)for(var a=n[i],o=a&&a.isEllipseCurve?r*2:a&&a.isLineCurve?1:a&&a.isSplineCurve?r*a.points.length:r,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];t&&t.equals(u)||(e.push(u),t=u)}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},createPointsGeometry:function(r){var e=this.getPoints(r);return this.createGeometry(e)},createSpacedPointsGeometry:function(r){var e=this.getSpacedPoints(r);return this.createGeometry(e)},createGeometry:function(r){for(var e=new sr,t=0,i=r.length;t<i;t++){var n=r[t];e.vertices.push(new oe(n.x,n.y,n.z||0))}return e}});sc.prototype=Object.create(ea.prototype);sc.prototype.constructor=sc;sc.prototype.isEllipseCurve=!0;sc.prototype.getPoint=function(r){for(var e=Math.PI*2,t=this.aEndAngle-this.aStartAngle,i=Math.abs(t)<Number.EPSILON;t<0;)t+=e;for(;t>e;)t-=e;t<Number.EPSILON&&(i?t=0:t=e),this.aClockwise===!0&&!i&&(t===e?t=-e:t=t-e);var n=this.aStartAngle+r*t,a=this.aX+this.xRadius*Math.cos(n),o=this.aY+this.yRadius*Math.sin(n);if(this.aRotation!==0){var s=Math.cos(this.aRotation),l=Math.sin(this.aRotation),u=a-this.aX,c=o-this.aY;a=u*s-c*l+this.aX,o=u*l+c*s+this.aY}return new St(a,o)};xM={tangentQuadraticBezier:function(r,e,t,i){return 2*(1-r)*(t-e)+2*r*(i-t)},tangentCubicBezier:function(r,e,t,i,n){return-3*e*(1-r)*(1-r)+3*t*(1-r)*(1-r)-6*r*t*(1-r)+6*r*i*(1-r)-3*r*r*i+3*r*r*n},tangentSpline:function(r,e,t,i,n){var a=6*r*r-6*r,o=3*r*r-4*r+1,s=-6*r*r+6*r,l=3*r*r-2*r;return a+o+s+l},interpolate:function(r,e,t,i,n){var a=(t-r)*.5,o=(i-e)*.5,s=n*n,l=n*s;return(2*e-2*t+a+o)*l+(-3*e+3*t-2*a-o)*s+a*n+e}};Kd.prototype=Object.create(ea.prototype);Kd.prototype.constructor=Kd;Kd.prototype.isSplineCurve=!0;Kd.prototype.getPoint=function(r){var e=this.points,t=(e.length-1)*r,i=Math.floor(t),n=t-i,a=e[i===0?i:i-1],o=e[i],s=e[i>e.length-2?e.length-1:i+1],l=e[i>e.length-3?e.length-1:i+2],u=xM.interpolate;return new St(u(a.x,o.x,s.x,l.x,n),u(a.y,o.y,s.y,l.y,n))};Jd.prototype=Object.create(ea.prototype);Jd.prototype.constructor=Jd;Jd.prototype.getPoint=function(r){var e=Ln.b3;return new St(e(r,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(r,this.v0.y,this.v1.y,this.v2.y,this.v3.y))};Jd.prototype.getTangent=function(r){var e=xM.tangentCubicBezier;return new St(e(r,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(r,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()};$d.prototype=Object.create(ea.prototype);$d.prototype.constructor=$d;$d.prototype.getPoint=function(r){var e=Ln.b2;return new St(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y))};$d.prototype.getTangent=function(r){var e=xM.tangentQuadraticBezier;return new St(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y)).normalize()};oB=Object.assign(Object.create(fM.prototype),{fromPoints:function(r){this.moveTo(r[0].x,r[0].y);for(var e=1,t=r.length;e<t;e++)this.lineTo(r[e].x,r[e].y)},moveTo:function(r,e){this.currentPoint.set(r,e)},lineTo:function(r,e){var t=new uu(this.currentPoint.clone(),new St(r,e));this.curves.push(t),this.currentPoint.set(r,e)},quadraticCurveTo:function(r,e,t,i){var n=new $d(this.currentPoint.clone(),new St(r,e),new St(t,i));this.curves.push(n),this.currentPoint.set(t,i)},bezierCurveTo:function(r,e,t,i,n,a){var o=new Jd(this.currentPoint.clone(),new St(r,e),new St(t,i),new St(n,a));this.curves.push(o),this.currentPoint.set(n,a)},splineThru:function(r){var e=[this.currentPoint.clone()].concat(r),t=new Kd(e);this.curves.push(t),this.currentPoint.copy(r[r.length-1])},arc:function(r,e,t,i,n,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(r+o,e+s,t,i,n,a)},absarc:function(r,e,t,i,n,a){this.absellipse(r,e,t,t,i,n,a)},ellipse:function(r,e,t,i,n,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;this.absellipse(r+l,e+u,t,i,n,a,o,s)},absellipse:function(r,e,t,i,n,a,o,s){var l=new sc(r,e,t,i,n,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);this.currentPoint.copy(c)}});Id.prototype=Object.assign(Object.create(oB),{constructor:Id,getPointsHoles:function(r){for(var e=[],t=0,i=this.holes.length;t<i;t++)e[t]=this.holes[t].getPoints(r);return e},extractAllPoints:function(r){return{shape:this.getPoints(r),holes:this.getPointsHoles(r)}},extractPoints:function(r){return this.extractAllPoints(r)}});SM.prototype=oB;oB.constructor=SM;sB.prototype={moveTo:function(r,e){this.currentPath=new SM,this.subPaths.push(this.currentPath),this.currentPath.moveTo(r,e)},lineTo:function(r,e){this.currentPath.lineTo(r,e)},quadraticCurveTo:function(r,e,t,i){this.currentPath.quadraticCurveTo(r,e,t,i)},bezierCurveTo:function(r,e,t,i,n,a){this.currentPath.bezierCurveTo(r,e,t,i,n,a)},splineThru:function(r){this.currentPath.splineThru(r)},toShapes:function(r,e){function t(D){for(var U=[],B=0,z=D.length;B<z;B++){var k=D[B],G=new Id;G.curves=k.curves,U.push(G)}return U}function i(D,U){for(var B=U.length,z=!1,k=B-1,G=0;G<B;k=G++){var Y=U[k],J=U[G],Q=J.x-Y.x,V=J.y-Y.y;if(Math.abs(V)>Number.EPSILON){if(V<0&&(Y=U[G],Q=-Q,J=U[k],V=-V),D.y<Y.y||D.y>J.y)continue;if(D.y===Y.y){if(D.x===Y.x)return!0}else{var K=V*(D.x-Y.x)-Q*(D.y-Y.y);if(K===0)return!0;if(K<0)continue;z=!z}}else{if(D.y!==Y.y)continue;if(J.x<=D.x&&D.x<=Y.x||Y.x<=D.x&&D.x<=J.x)return!0}}return z}var n=Ln.isClockWise,a=this.subPaths;if(a.length===0)return[];if(e===!0)return t(a);var o,s,l,u=[];if(a.length===1)return s=a[0],l=new Id,l.curves=s.curves,u.push(l),u;var c=!n(a[0].getPoints());c=r?!c:c;var f=[],h=[],p=[],d=0,g;h[d]=void 0,p[d]=[];for(var m=0,v=a.length;m<v;m++)s=a[m],g=s.getPoints(),o=n(g),o=r?!o:o,o?(!c&&h[d]&&d++,h[d]={s:new Id,p:g},h[d].s.curves=s.curves,c&&d++,p[d]=[]):p[d].push({h:s,p:g[0]});if(!h[0])return t(a);if(h.length>1){for(var _=!1,y=[],x=0,M=h.length;x<M;x++)f[x]=[];for(var x=0,M=h.length;x<M;x++)for(var S=p[x],w=0;w<S.length;w++){for(var T=S[w],C=!0,b=0;b<h.length;b++)i(T.p,h[b].p)&&(x!==b&&y.push({froms:x,tos:b,hole:w}),C?(C=!1,f[b].push(T)):_=!0);C&&f[x].push(T)}y.length>0&&(_||(p=f))}for(var E,m=0,I=h.length;m<I;m++){l=h[m].s,u.push(l),E=p[m];for(var R=0,A=E.length;R<A;R++)l.holes.push(E[R].h)}return u}};Object.assign(lB.prototype,{isFont:!0,generateShapes:function(r,e,t){function i(c){for(var f=String(c).split(""),h=e/a.resolution,p=0,d=[],g=0;g<f.length;g++){var m=n(f[g],h,p);p+=m.offset,d.push(m.path)}return d}function n(c,f,h){var p=a.glyphs[c]||a.glyphs["?"];if(p){var d=new sB,g=[],m=Ln.b2,v=Ln.b3,_,y,x,M,S,w,T,C,b,E,I;if(p.o)for(var R=p._cachedOutline||(p._cachedOutline=p.o.split(" ")),A=0,D=R.length;A<D;){var U=R[A++];switch(U){case"m":_=R[A++]*f+h,y=R[A++]*f,d.moveTo(_,y);break;case"l":_=R[A++]*f+h,y=R[A++]*f,d.lineTo(_,y);break;case"q":if(x=R[A++]*f+h,M=R[A++]*f,T=R[A++]*f+h,C=R[A++]*f,d.quadraticCurveTo(T,C,x,M),I=g[g.length-1],I){S=I.x,w=I.y;for(var B=1;B<=t;B++){var z=B/t;m(z,S,T,x),m(z,w,C,M)}}break;case"b":if(x=R[A++]*f+h,M=R[A++]*f,T=R[A++]*f+h,C=R[A++]*f,b=R[A++]*f+h,E=R[A++]*f,d.bezierCurveTo(T,C,b,E,x,M),I=g[g.length-1],I){S=I.x,w=I.y;for(var B=1;B<=t;B++){var z=B/t;v(z,S,T,b,x),v(z,w,C,E,M)}}break}}return{offset:p.ha*f,path:d}}}e===void 0&&(e=100),t===void 0&&(t=4);for(var a=this.data,o=i(r),s=[],l=0,u=o.length;l<u;l++)Array.prototype.push.apply(s,o[l].toShapes());return s}});Object.assign(jne.prototype,{load:function(r,e,t,i){var n=this,a=new Es(this.manager);a.load(r,function(o){var s;try{s=JSON.parse(o)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),s=JSON.parse(o.substring(65,o.length-2))}var l=n.parse(s);e&&e(l)},t,i)},parse:function(r){return new lB(r)}});uB={getContext:function(){return kA===void 0&&(kA=new(window.AudioContext||window.webkitAudioContext)),kA},setContext:function(r){kA=r}};Object.assign(cB.prototype,{load:function(r,e,t,i){var n=new Es(this.manager);n.setResponseType("arraybuffer"),n.load(r,function(a){var o=uB.getContext();o.decodeAudioData(a,function(s){e(s)})},t,i)}});bF.prototype=Object.assign(Object.create(Ui.prototype),{constructor:bF,isRectAreaLight:!0,copy:function(r){return Ui.prototype.copy.call(this,r),this.width=r.width,this.height=r.height,this}});Object.assign(Kne.prototype,{update:function(){var r,e,t,i,n,a,o,s=new qt,l=new qt;return function(c){var f=r!==this||e!==c.focus||t!==c.fov||i!==c.aspect*this.aspect||n!==c.near||a!==c.far||o!==c.zoom;if(f){r=this,e=c.focus,t=c.fov,i=c.aspect*this.aspect,n=c.near,a=c.far,o=c.zoom;var h=c.projectionMatrix.clone(),p=this.eyeSep/2,d=p*n/e,g=n*Math.tan(cr.DEG2RAD*t*.5)/o,m,v;l.elements[12]=-p,s.elements[12]=p,m=-g*i+d,v=g*i+d,h.elements[0]=2*n/(v-m),h.elements[8]=(v+m)/(v-m),this.cameraL.projectionMatrix.copy(h),m=-g*i-d,v=g*i-d,h.elements[0]=2*n/(v-m),h.elements[8]=(v+m)/(v-m),this.cameraR.projectionMatrix.copy(h)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(l),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(s)}}()});pC.prototype=Object.create(At.prototype);pC.prototype.constructor=pC;wF.prototype=Object.assign(Object.create(At.prototype),{constructor:wF,getInput:function(){return this.gain},removeFilter:function(){this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(r){this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=r,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(r){this.gain.gain.value=r},updateMatrixWorld:function(){var r=new oe,e=new on,t=new oe,i=new oe;return function(a){At.prototype.updateMatrixWorld.call(this,a);var o=this.context.listener,s=this.up;this.matrixWorld.decompose(r,e,t),i.set(0,0,-1).applyQuaternion(e),o.positionX?(o.positionX.setValueAtTime(r.x,this.context.currentTime),o.positionY.setValueAtTime(r.y,this.context.currentTime),o.positionZ.setValueAtTime(r.z,this.context.currentTime),o.forwardX.setValueAtTime(i.x,this.context.currentTime),o.forwardY.setValueAtTime(i.y,this.context.currentTime),o.forwardZ.setValueAtTime(i.z,this.context.currentTime),o.upX.setValueAtTime(s.x,this.context.currentTime),o.upY.setValueAtTime(s.y,this.context.currentTime),o.upZ.setValueAtTime(s.z,this.context.currentTime)):(o.setPosition(r.x,r.y,r.z),o.setOrientation(i.x,i.y,i.z,s.x,s.y,s.z))}}()});Ty.prototype=Object.assign(Object.create(At.prototype),{constructor:Ty,getOutput:function(){return this.gain},setNodeSource:function(r){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=r,this.connect(),this},setBuffer:function(r){return this.buffer=r,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}var r=this.context.createBufferSource();return r.buffer=this.buffer,r.loop=this.loop,r.onended=this.onEnded.bind(this),r.playbackRate.setValueAtTime(this.playbackRate,this.startTime),r.start(0,this.startTime),this.isPlaying=!0,this.source=r,this.connect()},pause:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this},stop:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.source.stop(),this.startTime=0,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var r=1,e=this.filters.length;r<e;r++)this.filters[r-1].connect(this.filters[r]);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 r=1,e=this.filters.length;r<e;r++)this.filters[r-1].disconnect(this.filters[r]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(r){return r||(r=[]),this.isPlaying===!0?(this.disconnect(),this.filters=r,this.connect()):this.filters=r,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(r){return this.setFilters(r?[r]:[])},setPlaybackRate:function(r){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=r,this.isPlaying===!0&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(r){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=r,this.isPlaying===!0&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(r){return this.gain.gain.value=r,this}});TF.prototype=Object.assign(Object.create(Ty.prototype),{constructor:TF,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(r){this.panner.refDistance=r},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(r){this.panner.rolloffFactor=r},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(r){this.panner.distanceModel=r},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(r){this.panner.maxDistance=r},updateMatrixWorld:function(){var r=new oe;return function(t){At.prototype.updateMatrixWorld.call(this,t),r.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(r.x,r.y,r.z)}}()});Object.assign(fB.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var r=0,e=this.getFrequencyData(),t=0;t<e.length;t++)r+=e[t];return r/e.length}});dC.prototype={constructor:dC,accumulate:function(r,e){var t=this.buffer,i=this.valueSize,n=r*i+i,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==i;++o)t[n+o]=t[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(t,n,0,s,i)}this.cumulativeWeight=a},apply:function(r){var e=this.valueSize,t=this.buffer,i=r*e+e,n=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,n<1){var o=e*3;this._mixBufferRegion(t,i,o,1-n,e)}for(var s=e,l=e+e;s!==l;++s)if(t[s]!==t[s+e]){a.setValue(t,i);break}},saveOriginalState:function(){var r=this.binding,e=this.buffer,t=this.valueSize,i=t*3;r.getValue(e,i);for(var n=t,a=i;n!==a;++n)e[n]=e[i+n%t];this.cumulativeWeight=0},restoreOriginalState:function(){var r=this.valueSize*3;this.binding.setValue(this.buffer,r)},_select:function(r,e,t,i,n){if(i>=.5)for(var a=0;a!==n;++a)r[e+a]=r[t+a]},_slerp:function(r,e,t,i,n){on.slerpFlat(r,e,r,e,r,t,i)},_lerp:function(r,e,t,i,n){for(var a=1-i,o=0;o!==n;++o){var s=e+o;r[s]=r[s]*a+r[t+o]*i}}};Ri.prototype={constructor:Ri,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var r=this.node,e=this.parsedPath,t=e.objectName,i=e.propertyName,n=e.propertyIndex;if(r||(r=Ri.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=r),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!r){console.error(" trying to update node for track: "+this.path+" but it wasn't found.");return}if(t){var a=e.objectIndex;switch(t){case"materials":if(!r.material){console.error(" can not bind to material as node does not have a material",this);return}if(!r.material.materials){console.error(" can not bind to material.materials as node.material does not have a materials array",this);return}r=r.material.materials;break;case"bones":if(!r.skeleton){console.error(" can not bind to bones as node does not have a skeleton",this);return}r=r.skeleton.bones;for(var o=0;o<r.length;o++)if(r[o].name===a){a=o;break}break;default:if(r[t]===void 0){console.error(" can not bind to objectName of node, undefined",this);return}r=r[t]}if(a!==void 0){if(r[a]===void 0){console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,r);return}r=r[a]}}var s=r[i];if(s===void 0){var l=e.nodeName;console.error(" trying to update property for track: "+l+"."+i+" but it wasn't found.",r);return}var u=this.Versioning.None;r.needsUpdate!==void 0?(u=this.Versioning.NeedsUpdate,this.targetObject=r):r.matrixWorldNeedsUpdate!==void 0&&(u=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=r);var c=this.BindingType.Direct;if(n!==void 0){if(i==="morphTargetInfluences"){if(!r.geometry){console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);return}if(!r.geometry.morphTargets){console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);return}for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(r.geometry.morphTargets[o].name===n){n=o;break}}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=n}else s.fromArray!==void 0&&s.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):s.length!==void 0?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Object.assign(Ri.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:Ri.prototype.getValue,_setValue_unbound:Ri.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)e[t++]=i[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)i[n]=e[t++]},function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]});Ri.Composite=function(r,e,t){var i=t||Ri.parseTrackName(e);this._targetGroup=r,this._bindings=r.subscribe_(e,i)};Ri.Composite.prototype={constructor:Ri.Composite,getValue:function(r,e){this.bind();var t=this._targetGroup.nCachedObjects_,i=this._bindings[t];i!==void 0&&i.getValue(r,e)},setValue:function(r,e){for(var t=this._bindings,i=this._targetGroup.nCachedObjects_,n=t.length;i!==n;++i)t[i].setValue(r,e)},bind:function(){for(var r=this._bindings,e=this._targetGroup.nCachedObjects_,t=r.length;e!==t;++e)r[e].bind()},unbind:function(){for(var r=this._bindings,e=this._targetGroup.nCachedObjects_,t=r.length;e!==t;++e)r[e].unbind()}};Ri.create=function(r,e,t){return r&&r.isAnimationObjectGroup?new Ri.Composite(r,e,t):new Ri(r,e,t)};Ri.parseTrackName=function(r){var e=/^((?:[\w-]+[\/:])*)([\w-]+)?(?:\.([\w-]+)(?:\[(.+)\])?)?\.([\w-]+)(?:\[(.+)\])?$/,t=e.exec(r);if(!t)throw new Error("cannot parse trackName at all: "+r);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]};if(i.propertyName===null||i.propertyName.length===0)throw new Error("can not parse propertyName from trackName: "+r);return i};Ri.findNode=function(r,e){if(!e||e===""||e==="root"||e==="."||e===-1||e===r.name||e===r.uuid)return r;if(r.skeleton){var t=function(o){for(var s=0;s<o.bones.length;s++){var l=o.bones[s];if(l.name===e)return l}return null},i=t(r.skeleton);if(i)return i}if(r.children){var n=function(o){for(var s=0;s<o.length;s++){var l=o[s];if(l.name===e||l.uuid===e)return l;var u=n(l.children);if(u)return u}return null},a=n(r.children);if(a)return a}return null};EF.prototype={constructor:EF,isAnimationObjectGroup:!0,add:function(r){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,l=s.length,u=0,c=arguments.length;u!==c;++u){var f=arguments[u],h=f.uuid,p=n[h],d=void 0;if(p===void 0){p=t++,n[h]=p,e.push(f);for(var g=0,m=l;g!==m;++g)s[g].push(new Ri(f,a[g],o[g]))}else if(p<i){d=e[p];var v=--i,_=e[v];n[_.uuid]=p,e[p]=_,n[h]=v,e[v]=f;for(var g=0,m=l;g!==m;++g){var y=s[g],x=y[v],M=y[p];y[p]=x,M===void 0&&(M=new Ri(f,a[g],o[g])),y[v]=M}}else e[p]!==d&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(r){for(var e=this._objects,t=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,a=n.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],u=l.uuid,c=i[u];if(c!==void 0&&c>=t){var f=t++,h=e[f];i[h.uuid]=c,e[c]=h,i[u]=f,e[f]=l;for(var p=0,d=a;p!==d;++p){var g=n[p],m=g[f],v=g[c];g[c]=m,g[f]=v}}}this.nCachedObjects_=t},uncache:function(r){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,a=this._bindings,o=a.length,s=0,l=arguments.length;s!==l;++s){var u=arguments[s],c=u.uuid,f=n[c];if(f!==void 0)if(delete n[c],f<i){var h=--i,p=e[h],d=--t,g=e[d];n[p.uuid]=f,e[f]=p,n[g.uuid]=h,e[h]=g,e.pop();for(var m=0,v=o;m!==v;++m){var _=a[m],y=_[h],x=_[d];_[f]=y,_[h]=x,_.pop()}}else{var d=--t,g=e[d];n[g.uuid]=f,e[f]=g,e.pop();for(var m=0,v=o;m!==v;++m){var _=a[m];_[f]=_[d],_.pop()}}}this.nCachedObjects_=i},subscribe_:function(r,e){var t=this._bindingsIndicesByPath,i=t[r],n=this._bindings;if(i!==void 0)return n[i];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,u=this.nCachedObjects_,c=new Array(l);i=n.length,t[r]=i,a.push(r),o.push(e),n.push(c);for(var f=u,h=s.length;f!==h;++f){var p=s[f];c[f]=new Ri(p,r,e)}return c},unsubscribe_:function(r){var e=this._bindingsIndicesByPath,t=e[r];if(t!==void 0){var i=this._paths,n=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],l=r[o];e[l]=t,a[t]=s,a.pop(),n[t]=n[o],n.pop(),i[t]=i[o],i.pop()}}};AF.prototype={constructor:AF,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(r){return this._startTime=r,this},setLoop:function(r,e){return this.loop=r,this.repetitions=e,this},setEffectiveWeight:function(r){return this.weight=r,this._effectiveWeight=this.enabled?r:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(r){return this._scheduleFading(r,0,1)},fadeOut:function(r){return this._scheduleFading(r,1,0)},crossFadeFrom:function(r,e,t){if(r.fadeOut(e),this.fadeIn(e),t){var i=this._clip.duration,n=r._clip.duration,a=n/i,o=i/n;r.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(r,e,t){return r.crossFadeFrom(this,e,t)},stopFading:function(){var r=this._weightInterpolant;return r!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(r)),this},setEffectiveTimeScale:function(r){return this.timeScale=r,this._effectiveTimeScale=this.paused?0:r,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(r){return this.timeScale=this._clip.duration/r,this.stopWarping()},syncWith:function(r){return this.time=r.time,this.timeScale=r.timeScale,this.stopWarping()},halt:function(r){return this.warp(this._effectiveTimeScale,0,r)},warp:function(r,e,t){var i=this._mixer,n=i.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=n,s[1]=n+t,l[0]=r/o,l[1]=e/o,this},stopWarping:function(){var r=this._timeScaleInterpolant;return r!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(r)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(r,e,t,i){var n=this._startTime;if(n!==null){var a=(r-n)*t;if(a<0||t===0)return;this._startTime=null,e=t*a}e*=this._updateTimeScale(r);var o=this._updateTime(e),s=this._updateWeight(r);if(s>0)for(var l=this._interpolants,u=this._propertyBindings,c=0,f=l.length;c!==f;++c)l[c].evaluate(o),u[c].accumulate(i,s)},_updateWeight:function(r){var e=0;if(this.enabled){e=this.weight;var t=this._weightInterpolant;if(t!==null){var i=t.evaluate(r)[0];e*=i,r>t.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(r){var e=0;if(!this.paused){e=this.timeScale;var t=this._timeScaleInterpolant;if(t!==null){var i=t.evaluate(r)[0];e*=i,r>t.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(r){var e=this.time+r;if(r===0)return e;var t=this._clip.duration,i=this.loop,n=this._loopCount;if(i===wne){n===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(e>=t)e=t;else if(e<0)e=0;else break e;this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:r<0?-1:1})}}else{var a=i===Ene;if(n===-1&&(r>=0?(n=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),e>=t||e<0){var o=Math.floor(e/t);e-=t*o,n+=Math.abs(o);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=r>0?t:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:r>0?1:-1});else{if(s===0){var l=r<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&(n&1)===1)return this.time=e,t-e}return this.time=e,e},_setEndings:function(r,e,t){var i=this._interpolantSettings;t?(i.endingStart=Rd,i.endingEnd=Rd):(r?i.endingStart=this.zeroSlopeAtStart?Rd:Ud:i.endingStart=LS,e?i.endingEnd=this.zeroSlopeAtEnd?Rd:Ud:i.endingEnd=LS)},_scheduleFading:function(r,e,t){var i=this._mixer,n=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=n,s[0]=e,o[1]=n+r,s[1]=t,this}};Object.assign(hB.prototype,bs.prototype,{clipAction:function(r,e){var t=e||this._root,i=t.uuid,n=typeof r=="string"?No.findByName(t,r):r,a=n!==null?n.uuid:r,o=this._actionsByClip[a],s=null;if(o!==void 0){var l=o.actionByRoot[i];if(l!==void 0)return l;s=o.knownActions[0],n===null&&(n=s._clip)}if(n===null)return null;var u=new AF(this,n,e);return this._bindAction(u,s),this._addInactiveAction(u,a,i),u},existingAction:function(r,e){var t=e||this._root,i=t.uuid,n=typeof r=="string"?No.findByName(t,r):r,a=n?n.uuid:r,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null},stopAllAction:function(){var r=this._actions,e=this._nActiveActions,t=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var n=0;n!==e;++n)r[n].reset();for(var n=0;n!==i;++n)t[n].useCount=0;return this},update:function(r){r*=this.timeScale;for(var e=this._actions,t=this._nActiveActions,i=this.time+=r,n=Math.sign(r),a=this._accuIndex^=1,o=0;o!==t;++o){var s=e[o];s.enabled&&s._update(i,r,n,a)}for(var l=this._bindings,u=this._nActiveBindings,o=0;o!==u;++o)l[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(r){var e=this._actions,t=r.uuid,i=this._actionsByClip,n=i[t];if(n!==void 0){for(var a=n.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var u=l._cacheIndex,c=e[e.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,e[u]=c,e.pop(),this._removeInactiveBindingsForAction(l)}delete i[t]}},uncacheRoot:function(r){var e=r.uuid,t=this._actionsByClip;for(var i in t){var n=t[i].actionByRoot,a=n[e];a!==void 0&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[e];if(s!==void 0)for(var l in s){var u=s[l];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(r,e){var t=this.existingAction(r,e);t!==null&&(this._deactivateAction(t),this._removeInactiveAction(t))}});Object.assign(hB.prototype,{_bindAction:function(r,e){var t=r._localRoot||this._root,i=r._clip.tracks,n=i.length,a=r._propertyBindings,o=r._interpolants,s=t.uuid,l=this._bindingsByRootAndName,u=l[s];u===void 0&&(u={},l[s]=u);for(var c=0;c!==n;++c){var f=i[c],h=f.name,p=u[h];if(p!==void 0)a[c]=p;else{if(p=a[c],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,s,h));continue}var d=e&&e._propertyBindings[c].binding.parsedPath;p=new dC(Ri.create(t,h,d),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,h),a[c]=p}o[c].resultBuffer=p.buffer}},_activateAction:function(r){if(!this._isActiveAction(r)){if(r._cacheIndex===null){var e=(r._localRoot||this._root).uuid,t=r._clip.uuid,i=this._actionsByClip[t];this._bindAction(r,i&&i.knownActions[0]),this._addInactiveAction(r,t,e)}for(var n=r._propertyBindings,a=0,o=n.length;a!==o;++a){var s=n[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(r)}},_deactivateAction:function(r){if(this._isActiveAction(r)){for(var e=r._propertyBindings,t=0,i=e.length;t!==i;++t){var n=e[t];--n.useCount===0&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(r)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var r=this;this.stats={actions:{get total(){return r._actions.length},get inUse(){return r._nActiveActions}},bindings:{get total(){return r._bindings.length},get inUse(){return r._nActiveBindings}},controlInterpolants:{get total(){return r._controlInterpolants.length},get inUse(){return r._nActiveControlInterpolants}}}},_isActiveAction:function(r){var e=r._cacheIndex;return e!==null&&e<this._nActiveActions},_addInactiveAction:function(r,e,t){var i=this._actions,n=this._actionsByClip,a=n[e];if(a===void 0)a={knownActions:[r],actionByRoot:{}},r._byClipCacheIndex=0,n[e]=a;else{var o=a.knownActions;r._byClipCacheIndex=o.length,o.push(r)}r._cacheIndex=i.length,i.push(r),a.actionByRoot[t]=r},_removeInactiveAction:function(r){var e=this._actions,t=e[e.length-1],i=r._cacheIndex;t._cacheIndex=i,e[i]=t,e.pop(),r._cacheIndex=null;var n=r._clip.uuid,a=this._actionsByClip,o=a[n],s=o.knownActions,l=s[s.length-1],u=r._byClipCacheIndex;l._byClipCacheIndex=u,s[u]=l,s.pop(),r._byClipCacheIndex=null;var c=o.actionByRoot,f=(e._localRoot||this._root).uuid;delete c[f],s.length===0&&delete a[n],this._removeInactiveBindingsForAction(r)},_removeInactiveBindingsForAction:function(r){for(var e=r._propertyBindings,t=0,i=e.length;t!==i;++t){var n=e[t];--n.referenceCount===0&&this._removeInactiveBinding(n)}},_lendAction:function(r){var e=this._actions,t=r._cacheIndex,i=this._nActiveActions++,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_takeBackAction:function(r){var e=this._actions,t=r._cacheIndex,i=--this._nActiveActions,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_addInactiveBinding:function(r,e,t){var i=this._bindingsByRootAndName,n=i[e],a=this._bindings;n===void 0&&(n={},i[e]=n),n[t]=r,r._cacheIndex=a.length,a.push(r)},_removeInactiveBinding:function(r){var e=this._bindings,t=r.binding,i=t.rootNode.uuid,n=t.path,a=this._bindingsByRootAndName,o=a[i],s=e[e.length-1],l=r._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete o[n];e:{for(var u in o)break e;delete a[i]}},_lendBinding:function(r){var e=this._bindings,t=r._cacheIndex,i=this._nActiveBindings++,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_takeBackBinding:function(r){var e=this._bindings,t=r._cacheIndex,i=--this._nActiveBindings,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_lendControlInterpolant:function(){var r=this._controlInterpolants,e=this._nActiveControlInterpolants++,t=r[e];return t===void 0&&(t=new uM(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),t.__cacheIndex=e,r[e]=t),t},_takeBackControlInterpolant:function(r){var e=this._controlInterpolants,t=r.__cacheIndex,i=--this._nActiveControlInterpolants,n=e[i];r.__cacheIndex=i,e[i]=r,n.__cacheIndex=t,e[t]=n},_controlInterpolantsResultBuffer:new Float32Array(1)});mC.prototype.clone=function(){return new mC(this.value.clone===void 0?this.value:this.value.clone())};Qd.prototype=Object.create(Bt.prototype);Qd.prototype.constructor=Qd;Qd.prototype.isInstancedBufferGeometry=!0;Qd.prototype.addGroup=function(r,e,t){this.groups.push({start:r,count:e,materialIndex:t})};Qd.prototype.copy=function(r){var e=r.index;e!==null&&this.setIndex(e.clone());var t=r.attributes;for(var i in t){var n=t[i];this.addAttribute(i,n.clone())}for(var a=r.groups,o=0,s=a.length;o<s;o++){var l=a[o];this.addGroup(l.start,l.count,l.materialIndex)}return this};CF.prototype={constructor:CF,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(r,e){return this.data.array[r*this.data.stride+this.offset]=e,this},setY:function(r,e){return this.data.array[r*this.data.stride+this.offset+1]=e,this},setZ:function(r,e){return this.data.array[r*this.data.stride+this.offset+2]=e,this},setW:function(r,e){return this.data.array[r*this.data.stride+this.offset+3]=e,this},getX:function(r){return this.data.array[r*this.data.stride+this.offset]},getY:function(r){return this.data.array[r*this.data.stride+this.offset+1]},getZ:function(r){return this.data.array[r*this.data.stride+this.offset+2]},getW:function(r){return this.data.array[r*this.data.stride+this.offset+3]},setXY:function(r,e,t){return r=r*this.data.stride+this.offset,this.data.array[r+0]=e,this.data.array[r+1]=t,this},setXYZ:function(r,e,t,i){return r=r*this.data.stride+this.offset,this.data.array[r+0]=e,this.data.array[r+1]=t,this.data.array[r+2]=i,this},setXYZW:function(r,e,t,i,n){return r=r*this.data.stride+this.offset,this.data.array[r+0]=e,this.data.array[r+1]=t,this.data.array[r+2]=i,this.data.array[r+3]=n,this}};Ey.prototype={constructor:Ey,isInterleavedBuffer:!0,set needsUpdate(r){r===!0&&this.version++},setArray:function(r){if(Array.isArray(r))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=r!==void 0?r.length/this.stride:0,this.array=r},setDynamic:function(r){return this.dynamic=r,this},copy:function(r){return this.array=new r.array.constructor(r.array),this.count=r.count,this.stride=r.stride,this.dynamic=r.dynamic,this},copyAt:function(r,e,t){r*=this.stride,t*=e.stride;for(var i=0,n=this.stride;i<n;i++)this.array[r+i]=e.array[t+i];return this},set:function(r,e){return e===void 0&&(e=0),this.array.set(r,e),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(r){return this.onUploadCallback=r,this}};Ay.prototype=Object.create(Ey.prototype);Ay.prototype.constructor=Ay;Ay.prototype.isInstancedInterleavedBuffer=!0;Ay.prototype.copy=function(r){return Ey.prototype.copy.call(this,r),this.meshPerAttribute=r.meshPerAttribute,this};Cy.prototype=Object.create(gt.prototype);Cy.prototype.constructor=Cy;Cy.prototype.isInstancedBufferAttribute=!0;Cy.prototype.copy=function(r){return gt.prototype.copy.call(this,r),this.meshPerAttribute=r.meshPerAttribute,this};RF.prototype={constructor:RF,linePrecision:1,set:function(r,e){this.ray.set(r,e)},setFromCamera:function(r,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(r.x,r.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(r.x,r.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(r,e){var t=[];return LF(r,this,t,e),t.sort(Fie),t},intersectObjects:function(r,e){var t=[];if(Array.isArray(r)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),t;for(var i=0,n=r.length;i<n;i++)LF(r[i],this,t,e);return t.sort(Fie),t}};PF.prototype={constructor:PF,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var r=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=(performance||Date).now();r=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=r}return r}};DF.prototype={constructor:DF,set:function(r,e,t){return this.radius=r,this.phi=e,this.theta=t,this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.radius=r.radius,this.phi=r.phi,this.theta=r.theta,this},makeSafe:function(){var r=1e-6;return this.phi=Math.max(r,Math.min(Math.PI-r,this.phi)),this},setFromVector3:function(r){return this.radius=r.length(),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(r.x,r.z),this.phi=Math.acos(cr.clamp(r.y/this.radius,-1,1))),this}};IF.prototype={constructor:IF,set:function(r,e,t){return this.radius=r,this.theta=e,this.y=t,this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.radius=r.radius,this.theta=r.theta,this.y=r.y,this},setFromVector3:function(r){return this.radius=Math.sqrt(r.x*r.x+r.z*r.z),this.theta=Math.atan2(r.x,r.z),this.y=r.y,this}};Pn.prototype=Object.create(mn.prototype);Pn.prototype.constructor=Pn;Pn.prototype.createAnimation=function(r,e,t,i){var n={start:e,end:t,length:t-e+1,fps:i,duration:(t-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[r]=n,this.animationsList.push(n)};Pn.prototype.autoCreateAnimations=function(r){for(var e=/([a-z]+)_?(\d+)/i,t,i={},n=this.geometry,a=0,o=n.morphTargets.length;a<o;a++){var s=n.morphTargets[a],l=s.name.match(e);if(l&&l.length>1){var u=l[1];i[u]||(i[u]={start:1/0,end:-1/0});var c=i[u];a<c.start&&(c.start=a),a>c.end&&(c.end=a),t||(t=u)}}for(var u in i){var c=i[u];this.createAnimation(u,c.start,c.end,r)}this.firstAnimation=t};Pn.prototype.setAnimationDirectionForward=function(r){var e=this.animationsMap[r];e&&(e.direction=1,e.directionBackwards=!1)};Pn.prototype.setAnimationDirectionBackward=function(r){var e=this.animationsMap[r];e&&(e.direction=-1,e.directionBackwards=!0)};Pn.prototype.setAnimationFPS=function(r,e){var t=this.animationsMap[r];t&&(t.fps=e,t.duration=(t.end-t.start)/t.fps)};Pn.prototype.setAnimationDuration=function(r,e){var t=this.animationsMap[r];t&&(t.duration=e,t.fps=(t.end-t.start)/t.duration)};Pn.prototype.setAnimationWeight=function(r,e){var t=this.animationsMap[r];t&&(t.weight=e)};Pn.prototype.setAnimationTime=function(r,e){var t=this.animationsMap[r];t&&(t.time=e)};Pn.prototype.getAnimationTime=function(r){var e=0,t=this.animationsMap[r];return t&&(e=t.time),e};Pn.prototype.getAnimationDuration=function(r){var e=-1,t=this.animationsMap[r];return t&&(e=t.duration),e};Pn.prototype.playAnimation=function(r){var e=this.animationsMap[r];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+r+"] undefined in .playAnimation()")};Pn.prototype.stopAnimation=function(r){var e=this.animationsMap[r];e&&(e.active=!1)};Pn.prototype.update=function(r){for(var e=0,t=this.animationsList.length;e<t;e++){var i=this.animationsList[e];if(i.active){var n=i.duration/i.length;i.time+=i.direction*r,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var a=i.start+cr.clamp(Math.floor(i.time/n),0,i.length-1),o=i.weight;a!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*o,this.morphTargetInfluences[a]=0,i.lastFrame=i.currentFrame,i.currentFrame=a);var s=i.time%n/n;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*o,this.morphTargetInfluences[i.lastFrame]=(1-s)*o):this.morphTargetInfluences[i.currentFrame]=o}}};hM.prototype=Object.create(At.prototype);hM.prototype.constructor=hM;hM.prototype.isImmediateRenderObject=!0;pM.prototype=Object.create(di.prototype);pM.prototype.constructor=pM;pM.prototype.update=function(){var r=new oe,e=new oe,t=new ws;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),t.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,o=this.geometry.attributes.position,s=this.object.geometry;if(s&&s.isGeometry)for(var l=s.vertices,u=s.faces,c=0,f=0,h=u.length;f<h;f++)for(var p=u[f],d=0,g=p.vertexNormals.length;d<g;d++){var m=l[p[n[d]]],v=p.vertexNormals[d];r.copy(m).applyMatrix4(a),e.copy(v).applyMatrix3(t).normalize().multiplyScalar(this.size).add(r),o.setXYZ(c,r.x,r.y,r.z),c=c+1,o.setXYZ(c,e.x,e.y,e.z),c=c+1}else if(s&&s.isBufferGeometry)for(var _=s.attributes.position,y=s.attributes.normal,c=0,d=0,g=_.count;d<g;d++)r.set(_.getX(d),_.getY(d),_.getZ(d)).applyMatrix4(a),e.set(y.getX(d),y.getY(d),y.getZ(d)),e.applyMatrix3(t).normalize().multiplyScalar(this.size).add(r),o.setXYZ(c,r.x,r.y,r.z),c=c+1,o.setXYZ(c,e.x,e.y,e.z),c=c+1;return o.needsUpdate=!0,this}}();Ry.prototype=Object.create(At.prototype);Ry.prototype.constructor=Ry;Ry.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()};Ry.prototype.update=function(){var r=new oe,e=new oe;return function(){var i=this.light.distance?this.light.distance:1e3,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),r.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(r)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();Ly.prototype=Object.create(di.prototype);Ly.prototype.constructor=Ly;Ly.prototype.getBoneList=function(r){var e=[];r&&r.isBone&&e.push(r);for(var t=0;t<r.children.length;t++)e.push.apply(e,this.getBoneList(r.children[t]));return e};Ly.prototype.update=function(){var r=new oe,e=new qt,t=new qt;return function(){var n=this.geometry,a=n.getAttribute("position");t.getInverse(this.root.matrixWorld);for(var o=0,s=0;o<this.bones.length;o++){var l=this.bones[o];l.parent&&l.parent.isBone&&(e.multiplyMatrices(t,l.matrixWorld),r.setFromMatrixPosition(e),a.setXYZ(s,r.x,r.y,r.z),e.multiplyMatrices(t,l.parent.matrixWorld),r.setFromMatrixPosition(e),a.setXYZ(s+1,r.x,r.y,r.z),s+=2)}n.getAttribute("position").needsUpdate=!0}}();Py.prototype=Object.create(mn.prototype);Py.prototype.constructor=Py;Py.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()};Py.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};Dy.prototype=Object.create(At.prototype);Dy.prototype.constructor=Dy;Dy.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose(),this.children[1].geometry.dispose(),this.children[1].material.dispose()};Dy.prototype.update=function(){var r=new oe,e=new oe;return function(){var i=this.children[0],n=this.children[1];if(this.light.target){r.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld);var a=e.clone().sub(r);i.lookAt(a),n.lookAt(a)}i.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var o=this.light.width*.5,s=this.light.height*.5,l=i.geometry.getAttribute("position"),u=l.array;u[0]=o,u[1]=-s,u[2]=0,u[3]=o,u[4]=s,u[5]=0,u[6]=-o,u[7]=s,u[8]=0,u[9]=-o,u[10]=s,u[11]=0,u[12]=-o,u[13]=-s,u[14]=0,u[15]=o,u[16]=-s,u[17]=0,l.needsUpdate=!0}}();Iy.prototype=Object.create(At.prototype);Iy.prototype.constructor=Iy;Iy.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()};Iy.prototype.update=function(){var r=new oe,e=new Gt,t=new Gt;return function(){var n=this.children[0],a=n.geometry.getAttribute("color");e.copy(this.light.color).multiplyScalar(this.light.intensity),t.copy(this.light.groundColor).multiplyScalar(this.light.intensity);for(var o=0,s=a.count;o<s;o++){var l=o<s/2?e:t;a.setXYZ(o,l.r,l.g,l.b)}n.lookAt(r.setFromMatrixPosition(this.light.matrixWorld).negate()),a.needsUpdate=!0}}();dM.prototype=Object.create(di.prototype);dM.prototype.constructor=dM;vC.prototype=Object.create(di.prototype);vC.prototype.constructor=vC;mM.prototype=Object.create(di.prototype);mM.prototype.constructor=mM;mM.prototype.update=function(){var r=new oe,e=new oe,t=new ws;return function(){this.object.updateMatrixWorld(!0),t.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry,s=o.vertices,l=o.faces,u=0,c=0,f=l.length;c<f;c++){var h=l[c],p=h.normal;r.copy(s[h.a]).add(s[h.b]).add(s[h.c]).divideScalar(3).applyMatrix4(n),e.copy(p).applyMatrix3(t).normalize().multiplyScalar(this.size).add(r),a.setXYZ(u,r.x,r.y,r.z),u=u+1,a.setXYZ(u,e.x,e.y,e.z),u=u+1}return a.needsUpdate=!0,this}}();Ny.prototype=Object.create(At.prototype);Ny.prototype.constructor=Ny;Ny.prototype.dispose=function(){var r=this.children[0],e=this.children[1];r.geometry.dispose(),r.material.dispose(),e.geometry.dispose(),e.material.dispose()};Ny.prototype.update=function(){var r=new oe,e=new oe,t=new oe;return function(){r.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),t.subVectors(e,r);var n=this.children[0],a=this.children[1];n.lookAt(t),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),a.lookAt(t),a.scale.z=t.length()}}();vM.prototype=Object.create(di.prototype);vM.prototype.constructor=vM;vM.prototype.update=function(){var r,e,t=new oe,i=new Qn;function n(a,o,s,l){t.set(o,s,l).unproject(i);var u=e[a];if(u!==void 0)for(var c=r.getAttribute("position"),f=0,h=u.length;f<h;f++)c.setXYZ(u[f],t.x,t.y,t.z)}return function(){r=this.geometry,e=this.pointMap;var o=1,s=1;i.projectionMatrix.copy(this.camera.projectionMatrix),n("c",0,0,-1),n("t",0,0,1),n("n1",-o,-s,-1),n("n2",o,-s,-1),n("n3",-o,s,-1),n("n4",o,s,-1),n("f1",-o,-s,1),n("f2",o,-s,1),n("f3",-o,s,1),n("f4",o,s,1),n("u1",o*.7,s*1.1,-1),n("u2",-o*.7,s*1.1,-1),n("u3",0,s*2,-1),n("cf1",-o,0,1),n("cf2",o,0,1),n("cf3",0,-s,1),n("cf4",0,s,1),n("cn1",-o,0,-1),n("cn2",o,0,-1),n("cn3",0,-s,-1),n("cn4",0,s,-1),r.getAttribute("position").needsUpdate=!0}}();Uy.prototype=Object.create(di.prototype);Uy.prototype.constructor=Uy;Uy.prototype.update=function(){var r=new su;return function(t){if(t&&t.isBox3?r.copy(t):r.setFromObject(t),!r.isEmpty()){var i=r.min,n=r.max,a=this.geometry.attributes.position,o=a.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=i.x,o[4]=n.y,o[5]=n.z,o[6]=i.x,o[7]=i.y,o[8]=n.z,o[9]=n.x,o[10]=i.y,o[11]=n.z,o[12]=n.x,o[13]=n.y,o[14]=i.z,o[15]=i.x,o[16]=n.y,o[17]=i.z,o[18]=i.x,o[19]=i.y,o[20]=i.z,o[21]=n.x,o[22]=i.y,o[23]=i.z,a.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();Jne=new Bt;Jne.addAttribute("position",new gr([0,0,0,0,1,0],3));$ne=new oc(0,.5,1,5,1);$ne.translate(0,-.5,0);em.prototype=Object.create(At.prototype);em.prototype.constructor=em;em.prototype.setDirection=function(){var r=new oe,e;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(r.set(i.z,0,-i.x).normalize(),e=Math.acos(i.y),this.quaternion.setFromAxisAngle(r,e))}}();em.prototype.setLength=function(r,e,t){e===void 0&&(e=.2*r),t===void 0&&(t=.2*e),this.line.scale.set(1,Math.max(0,r-e),1),this.line.updateMatrix(),this.cone.scale.set(t,e,t),this.cone.position.y=r,this.cone.updateMatrix()};em.prototype.setColor=function(r){this.line.material.color.copy(r),this.cone.material.color.copy(r)};gC.prototype=Object.create(di.prototype);gC.prototype.constructor=gC;pB=function(){var r=new oe,e=new n,t=new n,i=new n;function n(){}return n.prototype.init=function(a,o,s,l){this.c0=a,this.c1=s,this.c2=-3*a+3*o-2*s-l,this.c3=2*a-2*o+s+l},n.prototype.initNonuniformCatmullRom=function(a,o,s,l,u,c,f){var h=(o-a)/u-(s-a)/(u+c)+(s-o)/c,p=(s-o)/c-(l-o)/(c+f)+(l-s)/f;h*=c,p*=c,this.init(o,s,h,p)},n.prototype.initCatmullRom=function(a,o,s,l,u){this.init(o,s,u*(s-a),u*(l-o))},n.prototype.calc=function(a){var o=a*a,s=o*a;return this.c0+this.c1*a+this.c2*o+this.c3*s},ea.create(function(a){this.points=a||[],this.closed=!1},function(a){var o=this.points,s,l,u,c;c=o.length,c<2&&console.log("duh, you need at least 2 points"),s=(c-(this.closed?0:1))*a,l=Math.floor(s),u=s-l,this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o.length)+1)*o.length:u===0&&l===c-1&&(l=c-2,u=1);var f,h,p,d;if(this.closed||l>0?f=o[(l-1)%c]:(r.subVectors(o[0],o[1]).add(o[0]),f=r),h=o[l%c],p=o[(l+1)%c],this.closed||l+2<c?d=o[(l+2)%c]:(r.subVectors(o[c-1],o[c-2]).add(o[c-1]),d=r),this.type===void 0||this.type==="centripetal"||this.type==="chordal"){var g=this.type==="chordal"?.5:.25,m=Math.pow(f.distanceToSquared(h),g),v=Math.pow(h.distanceToSquared(p),g),_=Math.pow(p.distanceToSquared(d),g);v<1e-4&&(v=1),m<1e-4&&(m=v),_<1e-4&&(_=v),e.initNonuniformCatmullRom(f.x,h.x,p.x,d.x,m,v,_),t.initNonuniformCatmullRom(f.y,h.y,p.y,d.y,m,v,_),i.initNonuniformCatmullRom(f.z,h.z,p.z,d.z,m,v,_)}else if(this.type==="catmullrom"){var y=this.tension!==void 0?this.tension:.5;e.initCatmullRom(f.x,h.x,p.x,d.x,y),t.initCatmullRom(f.y,h.y,p.y,d.y,y),i.initCatmullRom(f.z,h.z,p.z,d.z,y)}var x=new oe(e.calc(u),t.calc(u),i.calc(u));return x})}(),rLe=ea.create(function(r){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=r===void 0?[]:r},function(r){var e=this.points,t=(e.length-1)*r,i=Math.floor(t),n=t-i,a=e[i==0?i:i-1],o=e[i],s=e[i>e.length-2?e.length-1:i+1],l=e[i>e.length-3?e.length-1:i+2],u=xM.interpolate;return new oe(u(a.x,o.x,s.x,l.x,n),u(a.y,o.y,s.y,l.y,n),u(a.z,o.z,s.z,l.z,n))}),iLe=ea.create(function(r,e,t,i){this.v0=r,this.v1=e,this.v2=t,this.v3=i},function(r){var e=Ln.b3;return new oe(e(r,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(r,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(r,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),nLe=ea.create(function(r,e,t){this.v0=r,this.v1=e,this.v2=t},function(r){var e=Ln.b2;return new oe(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y),e(r,this.v0.z,this.v1.z,this.v2.z))}),aLe=ea.create(function(r,e){this.v1=r,this.v2=e},function(r){if(r===1)return this.v2.clone();var e=new oe;return e.subVectors(this.v2,this.v1),e.multiplyScalar(r),e.add(this.v1),e});yC.prototype=Object.create(sc.prototype);yC.prototype.constructor=yC;oLe={createMultiMaterialObject:function(r,e){for(var t=new GS,i=0,n=e.length;i<n;i++)t.add(new mn(r,e[i]));return t},detach:function(r,e,t){r.applyMatrix(e.matrixWorld),e.remove(r),t.add(r)},attach:function(r,e,t){var i=new qt;i.getInverse(t.matrixWorld),r.applyMatrix(i),e.remove(r),t.add(r)}};lLe=0,uLe=1;Qne.prototype=Object.create(pB.prototype);dM.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Object.assign(DS.prototype,{center:function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},size:function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)}});Object.assign(su.prototype,{center:function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},isIntersectionSphere:function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},size:function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)}});Pd.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)};cr.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()};Object.assign(ws.prototype,{flattenToArrayOffset:function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},multiplyVector3:function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},multiplyVector3Array:function(r){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(r)},applyToBuffer:function(r,e,t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(r)}});Object.assign(qt.prototype,{extractPosition:function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)},flattenToArrayOffset:function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},getPosition:function(){var r;return function(){return r===void 0&&(r=new oe),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),r.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)},multiplyVector3:function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),r.applyProjection(this)},multiplyVector4:function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},multiplyVector3Array:function(r){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(r)},rotateAxis:function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)},crossVector:function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(r,e,t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(r)}});Io.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};on.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)};Object.assign(wh.prototype,{isIntersectionBox:function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},isIntersectionPlane:function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)},isIntersectionSphere:function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)}});Object.assign(Id.prototype,{extrude:function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ts(this,r)},makeGeometry:function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new yy(this,r)}});Object.assign(oe.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)},getScaleFromMatrix:function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)},getColumnFromMatrix:function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)}});sr.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")};Object.assign(At.prototype,{getChildByName:function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)}});Object.defineProperties(At.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.defineProperties(VS.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});Kn.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)};Object.defineProperties(Ui.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}});Object.defineProperties(gt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}});Object.assign(Bt.prototype,{addIndex:function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)},addDrawCall:function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}});Object.defineProperties(Bt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Object.defineProperties(mC.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}});Object.defineProperties(mr.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new Gt}}});Object.defineProperties(vl.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(Ma.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}});bs.prototype=Object.assign(Object.create({constructor:bs,apply:function(r){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(r,this)}}),bs.prototype);Object.assign(eB.prototype,{supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}});Object.defineProperties(eB.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=r}}});Object.defineProperties(Wne.prototype,{cullFace:{get:function(){return this.renderReverseSided?NF:TS},set:function(r){var e=r!==TS;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}});Object.defineProperties(Fy.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}});Ty.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this,t=new cB;return t.load(r,function(i){e.setBuffer(i)}),this};fB.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};DLe={merge:function(r,e,t){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),r.merge(e,i,t)},center:function(r){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),r.center()}},ILe={crossOrigin:void 0,loadTexture:function(r,e,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new EC;n.setCrossOrigin(this.crossOrigin);var a=n.load(r,t,void 0,i);return e&&(a.mapping=e),a},loadTextureCube:function(r,e,t,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new iB;n.setCrossOrigin(this.crossOrigin);var a=n.load(r,t,void 0,i);return e&&(a.mapping=e),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}}});var nae=Ose(CC=>{"use strict";var OLe=CC&&CC.__extends||function(r,e){for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);function i(){this.constructor=r}r.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)},zr=(tae(),Fse(eae)),xi={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},rae={type:"change"},dB={type:"start"},mB={type:"end"},iae=1e-6,zLe=function(r){OLe(e,r);function e(t,i,n){var a=r.call(this)||this;return a.object=t,a.domElement=i!==void 0?i:document,a.window=n!==void 0?n:window,a.enabled=!0,a.target=new zr.Vector3,a.minDistance=0,a.maxDistance=1/0,a.minZoom=0,a.maxZoom=1/0,a.minPolarAngle=0,a.maxPolarAngle=Math.PI,a.minAzimuthAngle=-1/0,a.maxAzimuthAngle=1/0,a.enableDamping=!1,a.dampingFactor=.25,a.enableZoom=!0,a.zoomSpeed=1,a.enableRotate=!0,a.rotateSpeed=1,a.enablePan=!0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.enableKeys=!0,a.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},a.mouseButtons={ORBIT:zr.MOUSE.LEFT,ZOOM:zr.MOUSE.MIDDLE,PAN:zr.MOUSE.RIGHT},a.target0=a.target.clone(),a.position0=a.object.position.clone(),a.zoom0=a.object.zoom,a.updateOffset=new zr.Vector3,a.updateQuat=new zr.Quaternion().setFromUnitVectors(t.up,new zr.Vector3(0,1,0)),a.updateQuatInverse=a.updateQuat.clone().inverse(),a.updateLastPosition=new zr.Vector3,a.updateLastQuaternion=new zr.Quaternion,a.state=xi.NONE,a.scale=1,a.spherical=new zr.Spherical,a.sphericalDelta=new zr.Spherical,a.panOffset=new zr.Vector3,a.zoomChanged=!1,a.rotateStart=new zr.Vector2,a.rotateEnd=new zr.Vector2,a.rotateDelta=new zr.Vector2,a.panStart=new zr.Vector2,a.panEnd=new zr.Vector2,a.panDelta=new zr.Vector2,a.dollyStart=new zr.Vector2,a.dollyEnd=new zr.Vector2,a.dollyDelta=new zr.Vector2,a.panLeftV=new zr.Vector3,a.panUpV=new zr.Vector3,a.panInternalOffset=new zr.Vector3,a.onMouseDown=function(o){if(a.enabled!==!1){if(o.preventDefault(),o.button===a.mouseButtons.ORBIT){if(a.enableRotate===!1)return;a.rotateStart.set(o.clientX,o.clientY),a.state=xi.ROTATE}else if(o.button===a.mouseButtons.ZOOM){if(a.enableZoom===!1)return;a.dollyStart.set(o.clientX,o.clientY),a.state=xi.DOLLY}else if(o.button===a.mouseButtons.PAN){if(a.enablePan===!1)return;a.panStart.set(o.clientX,o.clientY),a.state=xi.PAN}a.state!==xi.NONE&&(document.addEventListener("mousemove",a.onMouseMove,!1),document.addEventListener("mouseup",a.onMouseUp,!1),a.dispatchEvent(dB))}},a.onMouseMove=function(o){if(a.enabled!==!1){if(o.preventDefault(),a.state===xi.ROTATE){if(a.enableRotate===!1)return;a.rotateEnd.set(o.clientX,o.clientY),a.rotateDelta.subVectors(a.rotateEnd,a.rotateStart);var s=a.domElement===document?a.domElement.body:a.domElement;a.rotateLeft(2*Math.PI*a.rotateDelta.x/s.clientWidth*a.rotateSpeed),a.rotateUp(2*Math.PI*a.rotateDelta.y/s.clientHeight*a.rotateSpeed),a.rotateStart.copy(a.rotateEnd),a.update()}else if(a.state===xi.DOLLY){if(a.enableZoom===!1)return;a.dollyEnd.set(o.clientX,o.clientY),a.dollyDelta.subVectors(a.dollyEnd,a.dollyStart),a.dollyDelta.y>0?a.dollyIn(a.getZoomScale()):a.dollyDelta.y<0&&a.dollyOut(a.getZoomScale()),a.dollyStart.copy(a.dollyEnd),a.update()}else if(a.state===xi.PAN){if(a.enablePan===!1)return;a.panEnd.set(o.clientX,o.clientY),a.panDelta.subVectors(a.panEnd,a.panStart),a.pan(a.panDelta.x,a.panDelta.y),a.panStart.copy(a.panEnd),a.update()}}},a.onMouseUp=function(o){a.enabled!==!1&&(document.removeEventListener("mousemove",a.onMouseMove,!1),document.removeEventListener("mouseup",a.onMouseUp,!1),a.dispatchEvent(mB),a.state=xi.NONE)},a.onMouseWheel=function(o){a.enabled===!1||a.enableZoom===!1||a.state!==xi.NONE&&a.state!==xi.ROTATE||(o.preventDefault(),o.stopPropagation(),o.deltaY<0?a.dollyOut(a.getZoomScale()):o.deltaY>0&&a.dollyIn(a.getZoomScale()),a.update(),a.dispatchEvent(dB),a.dispatchEvent(mB))},a.onKeyDown=function(o){if(!(a.enabled===!1||a.enableKeys===!1||a.enablePan===!1))switch(o.keyCode){case a.keys.UP:a.pan(0,a.keyPanSpeed),a.update();break;case a.keys.BOTTOM:a.pan(0,-a.keyPanSpeed),a.update();break;case a.keys.LEFT:a.pan(a.keyPanSpeed,0),a.update();break;case a.keys.RIGHT:a.pan(-a.keyPanSpeed,0),a.update();break}},a.onTouchStart=function(o){if(a.enabled!==!1){switch(o.touches.length){case 1:{if(a.enableRotate===!1)return;a.rotateStart.set(o.touches[0].pageX,o.touches[0].pageY),a.state=xi.TOUCH_ROTATE}break;case 2:{if(a.enableZoom===!1)return;var s=o.touches[0].pageX-o.touches[1].pageX,l=o.touches[0].pageY-o.touches[1].pageY,u=Math.sqrt(s*s+l*l);a.dollyStart.set(0,u),a.state=xi.TOUCH_DOLLY}break;case 3:{if(a.enablePan===!1)return;a.panStart.set(o.touches[0].pageX,o.touches[0].pageY),a.state=xi.TOUCH_PAN}break;default:a.state=xi.NONE}a.state!==xi.NONE&&a.dispatchEvent(dB)}},a.onTouchMove=function(o){if(a.enabled!==!1)switch(o.preventDefault(),o.stopPropagation(),o.touches.length){case 1:{if(a.enableRotate===!1||a.state!==xi.TOUCH_ROTATE)return;a.rotateEnd.set(o.touches[0].pageX,o.touches[0].pageY),a.rotateDelta.subVectors(a.rotateEnd,a.rotateStart);var s=a.domElement===document?a.domElement.body:a.domElement;a.rotateLeft(2*Math.PI*a.rotateDelta.x/s.clientWidth*a.rotateSpeed),a.rotateUp(2*Math.PI*a.rotateDelta.y/s.clientHeight*a.rotateSpeed),a.rotateStart.copy(a.rotateEnd),a.update()}break;case 2:{if(a.enableZoom===!1||a.state!==xi.TOUCH_DOLLY)return;var l=o.touches[0].pageX-o.touches[1].pageX,u=o.touches[0].pageY-o.touches[1].pageY,c=Math.sqrt(l*l+u*u);a.dollyEnd.set(0,c),a.dollyDelta.subVectors(a.dollyEnd,a.dollyStart),a.dollyDelta.y>0?a.dollyOut(a.getZoomScale()):a.dollyDelta.y<0&&a.dollyIn(a.getZoomScale()),a.dollyStart.copy(a.dollyEnd),a.update()}break;case 3:{if(a.enablePan===!1||a.state!==xi.TOUCH_PAN)return;a.panEnd.set(o.touches[0].pageX,o.touches[0].pageY),a.panDelta.subVectors(a.panEnd,a.panStart),a.pan(a.panDelta.x,a.panDelta.y),a.panStart.copy(a.panEnd),a.update()}break;default:a.state=xi.NONE}},a.onTouchEnd=function(o){a.enabled!==!1&&(a.dispatchEvent(mB),a.state=xi.NONE)},a.onContextMenu=function(o){o.preventDefault()},a.domElement.addEventListener("contextmenu",a.onContextMenu,!1),a.domElement.addEventListener("mousedown",a.onMouseDown,!1),a.domElement.addEventListener("wheel",a.onMouseWheel,!1),a.domElement.addEventListener("touchstart",a.onTouchStart,!1),a.domElement.addEventListener("touchend",a.onTouchEnd,!1),a.domElement.addEventListener("touchmove",a.onTouchMove,!1),a.window.addEventListener("keydown",a.onKeyDown,!1),a.update(),a}return e.prototype.update=function(){var t=this.object.position;return this.updateOffset.copy(t).sub(this.target),this.updateOffset.applyQuaternion(this.updateQuat),this.spherical.setFromVector3(this.updateOffset),this.autoRotate&&this.state===xi.NONE&&this.rotateLeft(this.getAutoRotationAngle()),this.spherical.theta+=this.sphericalDelta.theta,this.spherical.phi+=this.sphericalDelta.phi,this.spherical.theta=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this.spherical.theta)),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),this.spherical.radius*=this.scale,this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius)),this.target.add(this.panOffset),this.updateOffset.setFromSpherical(this.spherical),this.updateOffset.applyQuaternion(this.updateQuatInverse),t.copy(this.target).add(this.updateOffset),this.object.lookAt(this.target),this.enableDamping===!0?(this.sphericalDelta.theta*=1-this.dampingFactor,this.sphericalDelta.phi*=1-this.dampingFactor):this.sphericalDelta.set(0,0,0),this.scale=1,this.panOffset.set(0,0,0),this.zoomChanged||this.updateLastPosition.distanceToSquared(this.object.position)>iae||8*(1-this.updateLastQuaternion.dot(this.object.quaternion))>iae?(this.dispatchEvent(rae),this.updateLastPosition.copy(this.object.position),this.updateLastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):!1},e.prototype.panLeft=function(t,i){this.panLeftV.setFromMatrixColumn(i,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)},e.prototype.panUp=function(t,i){this.panUpV.setFromMatrixColumn(i,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)},e.prototype.pan=function(t,i){var n=this.domElement===document?this.domElement.body:this.domElement;if(this.object instanceof zr.PerspectiveCamera){var a=this.object.position;this.panInternalOffset.copy(a).sub(this.target);var o=this.panInternalOffset.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*i*o/n.clientHeight,this.object.matrix)}else this.object instanceof zr.OrthographicCamera?(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(i*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)},e.prototype.dollyIn=function(t){this.object instanceof zr.PerspectiveCamera?this.scale/=t:this.object instanceof zr.OrthographicCamera?(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*t)),this.object.updateProjectionMatrix(),this.zoomChanged=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)},e.prototype.dollyOut=function(t){this.object instanceof zr.PerspectiveCamera?this.scale*=t:this.object instanceof zr.OrthographicCamera?(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/t)),this.object.updateProjectionMatrix(),this.zoomChanged=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)},e.prototype.getAutoRotationAngle=function(){return 2*Math.PI/60/60*this.autoRotateSpeed},e.prototype.getZoomScale=function(){return Math.pow(.95,this.zoomSpeed)},e.prototype.rotateLeft=function(t){this.sphericalDelta.theta-=t},e.prototype.rotateUp=function(t){this.sphericalDelta.phi-=t},e.prototype.getPolarAngle=function(){return this.spherical.phi},e.prototype.getAzimuthalAngle=function(){return this.spherical.theta},e.prototype.dispose=function(){this.domElement.removeEventListener("contextmenu",this.onContextMenu,!1),this.domElement.removeEventListener("mousedown",this.onMouseDown,!1),this.domElement.removeEventListener("wheel",this.onMouseWheel,!1),this.domElement.removeEventListener("touchstart",this.onTouchStart,!1),this.domElement.removeEventListener("touchend",this.onTouchEnd,!1),this.domElement.removeEventListener("touchmove",this.onTouchMove,!1),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.window.removeEventListener("keydown",this.onKeyDown,!1)},e.prototype.reset=function(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(rae),this.update(),this.state=xi.NONE},Object.defineProperty(e.prototype,"center",{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"noZoom",{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(t){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!t},enumerable:!0,configurable:!0}),e}(zr.EventDispatcher);CC.OrbitControls=zLe});var aL=function(r,e){return aL=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},aL(r,e)};function Z(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");aL(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Bse=function(){function r(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return r}(),kse=function(){function r(){this.browser=new Bse,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<"u"}return r}(),Qh=new kse;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(Qh.wxa=!0,Qh.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?Qh.worker=!0:typeof navigator>"u"||navigator.userAgent.indexOf("Node.js")===0?(Qh.node=!0,Qh.svgSupported=!0):Vse(navigator.userAgent,Qh);function Vse(r,e){var t=e.browser,i=r.match(/Firefox\/([\d.]+)/),n=r.match(/MSIE\s([\d.]+)/)||r.match(/Trident\/.+?rv:(([\d.]+))/),a=r.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(r);i&&(t.firefox=!0,t.version=i[1]),n&&(t.ie=!0,t.version=n[1]),a&&(t.edge=!0,t.version=a[1],t.newEdge=+a[1].split(".")[0]>18),o&&(t.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!t.ie&&!t.edge,e.pointerEventsSupported="onpointerdown"in window&&(t.edge||t.ie&&+t.version>=11),e.domSupported=typeof document<"u";var s=document.documentElement.style;e.transform3dSupported=(t.ie&&"transition"in s||t.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||t.ie&&+t.version>=9}var zt=Qh;var eb=12,oL="sans-serif",ho=eb+"px "+oL,Gse=20,Hse=100,Wse="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function Xse(r){var e={};if(typeof JSON>"u")return e;for(var t=0;t<r.length;t++){var i=String.fromCharCode(t+32),n=(r.charCodeAt(t)-Gse)/Hse;e[i]=n}return e}var Yse=Xse(Wse),Fn={createCanvas:function(){return typeof document<"u"&&document.createElement("canvas")},measureText:function(){var r,e;return function(t,i){if(!r){var n=Fn.createCanvas();r=n&&n.getContext("2d")}if(r)return e!==i&&(e=r.font=i||ho),r.measureText(t);t=t||"",i=i||ho;var a=/(\d+)px/.exec(i),o=a&&+a[1]||eb,s=0;if(i.indexOf("mono")>=0)s=o*t.length;else for(var l=0;l<t.length;l++){var u=Yse[t[l]];s+=u==null?o:u*o}return{width:s}}}(),loadImage:function(r,e,t){var i=new Image;return i.onload=e,i.onerror=t,i.src=r,i}};var IV=gn(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(r,e){return r["[object "+e+"]"]=!0,r},{}),NV=gn(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(r,e){return r["[object "+e+"Array]"]=!0,r},{}),Mm=Object.prototype.toString,rb=Array.prototype,qse=rb.forEach,Zse=rb.filter,sL=rb.slice,jse=rb.map,PV=(function(){}).constructor,tb=PV?PV.prototype:null,lL="__proto__",Kse=2311;function ib(){return Kse++}function ep(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];typeof console<"u"&&console.error.apply(console,r)}function Qe(r){if(r==null||typeof r!="object")return r;var e=r,t=Mm.call(r);if(t==="[object Array]"){if(!I0(r)){e=[];for(var i=0,n=r.length;i<n;i++)e[i]=Qe(r[i])}}else if(NV[t]){if(!I0(r)){var a=r.constructor;if(a.from)e=a.from(r);else{e=new a(r.length);for(var i=0,n=r.length;i<n;i++)e[i]=r[i]}}}else if(!IV[t]&&!I0(r)&&!sf(r)){e={};for(var o in r)r.hasOwnProperty(o)&&o!==lL&&(e[o]=Qe(r[o]))}return e}function _t(r,e,t){if(!qe(e)||!qe(r))return t?Qe(e):r;for(var i in e)if(e.hasOwnProperty(i)&&i!==lL){var n=r[i],a=e[i];qe(a)&&qe(n)&&!pe(a)&&!pe(n)&&!sf(a)&&!sf(n)&&!DV(a)&&!DV(n)&&!I0(a)&&!I0(n)?_t(n,a,t):(t||!(i in r))&&(r[i]=Qe(e[i]))}return r}function bm(r,e){for(var t=r[0],i=1,n=r.length;i<n;i++)t=_t(t,r[i],e);return t}function fe(r,e){if(Object.assign)Object.assign(r,e);else for(var t in e)e.hasOwnProperty(t)&&t!==lL&&(r[t]=e[t]);return r}function Ye(r,e,t){for(var i=bt(e),n=0;n<i.length;n++){var a=i[n];(t?e[a]!=null:r[a]==null)&&(r[a]=e[a])}return r}var s3e=Fn.createCanvas;function dt(r,e){if(r){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t}return-1}function UV(r,e){var t=r.prototype;function i(){}i.prototype=e.prototype,r.prototype=new i;for(var n in t)t.hasOwnProperty(n)&&(r.prototype[n]=t[n]);r.prototype.constructor=r,r.superClass=e}function br(r,e,t){if(r="prototype"in r?r.prototype:r,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var i=Object.getOwnPropertyNames(e),n=0;n<i.length;n++){var a=i[n];a!=="constructor"&&(t?e[a]!=null:r[a]==null)&&(r[a]=e[a])}else Ye(r,e,t)}function ci(r){return!r||typeof r=="string"?!1:typeof r.length=="number"}function N(r,e,t){if(r&&e)if(r.forEach&&r.forEach===qse)r.forEach(e,t);else if(r.length===+r.length)for(var i=0,n=r.length;i<n;i++)e.call(t,r[i],i,r);else for(var a in r)r.hasOwnProperty(a)&&e.call(t,r[a],a,r)}function de(r,e,t){if(!r)return[];if(!e)return nb(r);if(r.map&&r.map===jse)return r.map(e,t);for(var i=[],n=0,a=r.length;n<a;n++)i.push(e.call(t,r[n],n,r));return i}function gn(r,e,t,i){if(r&&e){for(var n=0,a=r.length;n<a;n++)t=e.call(i,t,r[n],n,r);return t}}function Wt(r,e,t){if(!r)return[];if(!e)return nb(r);if(r.filter&&r.filter===Zse)return r.filter(e,t);for(var i=[],n=0,a=r.length;n<a;n++)e.call(t,r[n],n,r)&&i.push(r[n]);return i}function OV(r,e,t){if(r&&e){for(var i=0,n=r.length;i<n;i++)if(e.call(t,r[i],i,r))return r[i]}}function bt(r){if(!r)return[];if(Object.keys)return Object.keys(r);var e=[];for(var t in r)r.hasOwnProperty(t)&&e.push(t);return e}function Jse(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];return function(){return r.apply(e,t.concat(sL.call(arguments)))}}var Be=tb&&He(tb.bind)?tb.call.bind(tb.bind):Jse;function ot(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return function(){return r.apply(this,e.concat(sL.call(arguments)))}}function pe(r){return Array.isArray?Array.isArray(r):Mm.call(r)==="[object Array]"}function He(r){return typeof r=="function"}function Ce(r){return typeof r=="string"}function N0(r){return Mm.call(r)==="[object String]"}function Ct(r){return typeof r=="number"}function qe(r){var e=typeof r;return e==="function"||!!r&&e==="object"}function DV(r){return!!IV[Mm.call(r)]}function bi(r){return!!NV[Mm.call(r)]}function sf(r){return typeof r=="object"&&typeof r.nodeType=="number"&&typeof r.ownerDocument=="object"}function lf(r){return r.colorStops!=null}function zV(r){return r.image!=null}function FV(r){return Mm.call(r)==="[object RegExp]"}function uf(r){return r!==r}function Br(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=0,i=r.length;t<i;t++)if(r[t]!=null)return r[t]}function ft(r,e){return r??e}function Xi(r,e,t){return r??e??t}function nb(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return sL.apply(r,e)}function wm(r){if(typeof r=="number")return[r,r,r,r];var e=r.length;return e===2?[r[0],r[1],r[0],r[1]]:e===3?[r[0],r[1],r[2],r[1]]:r}function kr(r,e){if(!r)throw new Error(e)}function Yi(r){return r==null?null:typeof r.trim=="function"?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var BV="__ec_primitive__";function tp(r){r[BV]=!0}function I0(r){return r[BV]}var $se=function(){function r(){this.data={}}return r.prototype.delete=function(e){var t=this.has(e);return t&&delete this.data[e],t},r.prototype.has=function(e){return this.data.hasOwnProperty(e)},r.prototype.get=function(e){return this.data[e]},r.prototype.set=function(e,t){return this.data[e]=t,this},r.prototype.keys=function(){return bt(this.data)},r.prototype.forEach=function(e){var t=this.data;for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},r}(),kV=typeof Map=="function";function Qse(){return kV?new Map:new $se}var ele=function(){function r(e){var t=pe(e);this.data=Qse();var i=this;e instanceof r?e.each(n):e&&N(e,n);function n(a,o){t?i.set(a,o):i.set(o,a)}}return r.prototype.hasKey=function(e){return this.data.has(e)},r.prototype.get=function(e){return this.data.get(e)},r.prototype.set=function(e,t){return this.data.set(e,t),t},r.prototype.each=function(e,t){this.data.forEach(function(i,n){e.call(t,i,n)})},r.prototype.keys=function(){var e=this.data.keys();return kV?Array.from(e):e},r.prototype.removeKey=function(e){this.data.delete(e)},r}();function ke(r){return new ele(r)}function rp(r,e){for(var t=new r.constructor(r.length+e.length),i=0;i<r.length;i++)t[i]=r[i];for(var n=r.length,i=0;i<e.length;i++)t[i+n]=e[i];return t}function cf(r,e){var t;if(Object.create)t=Object.create(r);else{var i=function(){};i.prototype=r,t=new i}return e&&fe(t,e),t}function ab(r){var e=r.style;e.webkitUserSelect="none",e.userSelect="none",e.webkitTapHighlightColor="rgba(0,0,0,0)",e["-webkit-touch-callout"]="none"}function tt(r,e){return r.hasOwnProperty(e)}function Dr(){}var Tm=180/Math.PI;var uL=function(r,e){return uL=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},uL(r,e)};function Xt(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");uL(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function El(r,e){return r==null&&(r=0),e==null&&(e=0),[r,e]}function qi(r,e){return r[0]=e[0],r[1]=e[1],r}function Aa(r){return[r[0],r[1]]}function VV(r,e,t){return r[0]=e,r[1]=t,r}function cL(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function U0(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r}function Ns(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function ob(r){return Math.sqrt(tle(r))}function tle(r){return r[0]*r[0]+r[1]*r[1]}function Em(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function Xo(r,e){var t=ob(e);return t===0?(r[0]=0,r[1]=0):(r[0]=e[0]/t,r[1]=e[1]/t),r}function sb(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}var Yo=sb;function rle(r,e){return(r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1])}var gu=rle;function Am(r,e,t,i){return r[0]=e[0]+i*(t[0]-e[0]),r[1]=e[1]+i*(t[1]-e[1]),r}function fi(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n+t[4],r[1]=t[1]*i+t[3]*n+t[5],r}function po(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function mo(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}var Cm=function(){function r(e,t){this.target=e,this.topTarget=t&&t.topTarget}return r}(),ile=function(){function r(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return r.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new Cm(t,e),"dragstart",e.event))},r.prototype._drag=function(e){var t=this._draggingTarget;if(t){var i=e.offsetX,n=e.offsetY,a=i-this._x,o=n-this._y;this._x=i,this._y=n,t.drift(a,o,e),this.handler.dispatchToElement(new Cm(t,e),"drag",e.event);var s=this.handler.findHover(i,n,t).target,l=this._dropTarget;this._dropTarget=s,t!==s&&(l&&s!==l&&this.handler.dispatchToElement(new Cm(l,e),"dragleave",e.event),s&&s!==l&&this.handler.dispatchToElement(new Cm(s,e),"dragenter",e.event))}},r.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new Cm(t,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new Cm(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},r}(),GV=ile;var nle=function(){function r(e){e&&(this._$eventProcessor=e)}return r.prototype.on=function(e,t,i,n){this._$handlers||(this._$handlers={});var a=this._$handlers;if(typeof t=="function"&&(n=i,i=t,t=null),!i||!e)return this;var o=this._$eventProcessor;t!=null&&o&&o.normalizeQuery&&(t=o.normalizeQuery(t)),a[e]||(a[e]=[]);for(var s=0;s<a[e].length;s++)if(a[e][s].h===i)return this;var l={h:i,query:t,ctx:n||this,callAtLast:i.zrEventfulCallAtLast},u=a[e].length-1,c=a[e][u];return c&&c.callAtLast?a[e].splice(u,0,l):a[e].push(l),this},r.prototype.isSilent=function(e){var t=this._$handlers;return!t||!t[e]||!t[e].length},r.prototype.off=function(e,t){var i=this._$handlers;if(!i)return this;if(!e)return this._$handlers={},this;if(t){if(i[e]){for(var n=[],a=0,o=i[e].length;a<o;a++)i[e][a].h!==t&&n.push(i[e][a]);i[e]=n}i[e]&&i[e].length===0&&delete i[e]}else delete i[e];return this},r.prototype.trigger=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(!this._$handlers)return this;var n=this._$handlers[e],a=this._$eventProcessor;if(n)for(var o=t.length,s=n.length,l=0;l<s;l++){var u=n[l];if(!(a&&a.filter&&u.query!=null&&!a.filter(e,u.query)))switch(o){case 0:u.h.call(u.ctx);break;case 1:u.h.call(u.ctx,t[0]);break;case 2:u.h.call(u.ctx,t[0],t[1]);break;default:u.h.apply(u.ctx,t);break}}return a&&a.afterTrigger&&a.afterTrigger(e),this},r.prototype.triggerWithContext=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(!this._$handlers)return this;var n=this._$handlers[e],a=this._$eventProcessor;if(n)for(var o=t.length,s=t[o-1],l=n.length,u=0;u<l;u++){var c=n[u];if(!(a&&a.filter&&c.query!=null&&!a.filter(e,c.query)))switch(o){case 0:c.h.call(s);break;case 1:c.h.call(s,t[0]);break;case 2:c.h.call(s,t[0],t[1]);break;default:c.h.apply(s,t.slice(1,o-1));break}}return a&&a.afterTrigger&&a.afterTrigger(e),this},r}(),Pi=nle;var ale=Math.log(2);function fL(r,e,t,i,n,a){var o=i+"-"+n,s=r.length;if(a.hasOwnProperty(o))return a[o];if(e===1){var l=Math.round(Math.log((1<<s)-1&~n)/ale);return r[t][l]}for(var u=i|1<<t,c=t+1;i&1<<c;)c++;for(var f=0,h=0,p=0;h<s;h++){var d=1<<h;d&n||(f+=(p%2?-1:1)*r[t][h]*fL(r,e-1,c,u,n|d,a),p++)}return a[o]=f,f}function hL(r,e){var t=[[r[0],r[1],1,0,0,0,-e[0]*r[0],-e[0]*r[1]],[0,0,0,r[0],r[1],1,-e[1]*r[0],-e[1]*r[1]],[r[2],r[3],1,0,0,0,-e[2]*r[2],-e[2]*r[3]],[0,0,0,r[2],r[3],1,-e[3]*r[2],-e[3]*r[3]],[r[4],r[5],1,0,0,0,-e[4]*r[4],-e[4]*r[5]],[0,0,0,r[4],r[5],1,-e[5]*r[4],-e[5]*r[5]],[r[6],r[7],1,0,0,0,-e[6]*r[6],-e[6]*r[7]],[0,0,0,r[6],r[7],1,-e[7]*r[6],-e[7]*r[7]]],i={},n=fL(t,8,0,0,0,i);if(n!==0){for(var a=[],o=0;o<8;o++)for(var s=0;s<8;s++)a[s]==null&&(a[s]=0),a[s]+=((o+s)%2?-1:1)*fL(t,7,o===0?1:0,1<<o,1<<s,i)/n*e[o];return function(l,u,c){var f=u*a[6]+c*a[7]+1;l[0]=(u*a[0]+c*a[1]+a[2])/f,l[1]=(u*a[3]+c*a[4]+a[5])/f}}}var HV="___zrEVENTSAVED",pL=[];function WV(r,e,t,i,n){return lb(pL,e,i,n,!0)&&lb(r,t,pL[0],pL[1])}function lb(r,e,t,i,n){if(e.getBoundingClientRect&&zt.domSupported&&!dL(e)){var a=e[HV]||(e[HV]={}),o=ole(e,a),s=sle(o,a,n);if(s)return s(r,t,i),!0}return!1}function ole(r,e){var t=e.markers;if(t)return t;t=e.markers=[];for(var i=["left","right"],n=["top","bottom"],a=0;a<4;a++){var o=document.createElement("div"),s=o.style,l=a%2,u=(a>>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[l]+":0",n[u]+":0",i[1-l]+":auto",n[1-u]+":auto",""].join("!important;"),r.appendChild(o),t.push(o)}return t}function sle(r,e,t){for(var i=t?"invTrans":"trans",n=e[i],a=e.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var c=r[u].getBoundingClientRect(),f=2*u,h=c.left,p=c.top;o.push(h,p),l=l&&a&&h===a[f]&&p===a[f+1],s.push(r[u].offsetLeft,r[u].offsetTop)}return l&&n?n:(e.srcCoords=o,e[i]=t?hL(s,o):hL(o,s))}function dL(r){return r.nodeName.toUpperCase()==="CANVAS"}var lle=/([&<>"'])/g,ule={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function yn(r){return r==null?"":(r+"").replace(lle,function(e,t){return ule[t]})}var cle=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,mL=[],fle=zt.browser.firefox&&+zt.browser.version.split(".")[0]<39;function ub(r,e,t,i){return t=t||{},i?XV(r,e,t):fle&&e.layerX!=null&&e.layerX!==e.offsetX?(t.zrX=e.layerX,t.zrY=e.layerY):e.offsetX!=null?(t.zrX=e.offsetX,t.zrY=e.offsetY):XV(r,e,t),t}function XV(r,e,t){if(zt.domSupported&&r.getBoundingClientRect){var i=e.clientX,n=e.clientY;if(dL(r)){var a=r.getBoundingClientRect();t.zrX=i-a.left,t.zrY=n-a.top;return}else if(lb(mL,r,i,n)){t.zrX=mL[0],t.zrY=mL[1];return}}t.zrX=t.zrY=0}function cb(r){return r||window.event}function Ca(r,e,t){if(e=cb(e),e.zrX!=null)return e;var i=e.type,n=i&&i.indexOf("touch")>=0;if(n){var o=i!=="touchend"?e.targetTouches[0]:e.changedTouches[0];o&&ub(r,o,e,t)}else{ub(r,e,e,t);var a=hle(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&cle.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function hle(r){var e=r.wheelDelta;if(e)return e;var t=r.deltaX,i=r.deltaY;if(t==null||i==null)return e;var n=Math.abs(i!==0?i:t),a=i>0?-1:i<0?1:t>0?-1:1;return 3*n*a}function O0(r,e,t,i){r.addEventListener(e,t,i)}function YV(r,e,t,i){r.removeEventListener(e,t,i)}var Ra=function(r){r.preventDefault(),r.stopPropagation(),r.cancelBubble=!0};function vL(r){return r.which===2||r.which===3}var ZV=function(){function r(){this._track=[]}return r.prototype.recognize=function(e,t,i){return this._doTrack(e,t,i),this._recognize(e)},r.prototype.clear=function(){return this._track.length=0,this},r.prototype._doTrack=function(e,t,i){var n=e.touches;if(n){for(var a={points:[],touches:[],target:t,event:e},o=0,s=n.length;o<s;o++){var l=n[o],u=ub(i,l,{});a.points.push([u.zrX,u.zrY]),a.touches.push(l)}this._track.push(a)}},r.prototype._recognize=function(e){for(var t in gL)if(gL.hasOwnProperty(t)){var i=gL[t](this._track,e);if(i)return i}},r}();function qV(r){var e=r[1][0]-r[0][0],t=r[1][1]-r[0][1];return Math.sqrt(e*e+t*t)}function ple(r){return[(r[0][0]+r[1][0])/2,(r[0][1]+r[1][1])/2]}var gL={pinch:function(r,e){var t=r.length;if(t){var i=(r[t-1]||{}).points,n=(r[t-2]||{}).points||i;if(n&&n.length>1&&i&&i.length>1){var a=qV(i)/qV(n);!isFinite(a)&&(a=1),e.pinchScale=a;var o=ple(i);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:r[0].target,event:e}}}}};function wi(){return[1,0,0,1,0,0]}function ff(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function z0(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r}function La(r,e,t){var i=e[0]*t[0]+e[2]*t[1],n=e[1]*t[0]+e[3]*t[1],a=e[0]*t[2]+e[2]*t[3],o=e[1]*t[2]+e[3]*t[3],s=e[0]*t[4]+e[2]*t[5]+e[4],l=e[1]*t[4]+e[3]*t[5]+e[5];return r[0]=i,r[1]=n,r[2]=a,r[3]=o,r[4]=s,r[5]=l,r}function _n(r,e,t){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4]+t[0],r[5]=e[5]+t[1],r}function Pa(r,e,t,i){i===void 0&&(i=[0,0]);var n=e[0],a=e[2],o=e[4],s=e[1],l=e[3],u=e[5],c=Math.sin(t),f=Math.cos(t);return r[0]=n*f+s*c,r[1]=-n*c+s*f,r[2]=a*f+l*c,r[3]=-a*c+f*l,r[4]=f*(o-i[0])+c*(u-i[1])+i[0],r[5]=f*(u-i[1])-c*(o-i[0])+i[1],r}function Lm(r,e,t){var i=t[0],n=t[1];return r[0]=e[0]*i,r[1]=e[1]*n,r[2]=e[2]*i,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*n,r}function qo(r,e){var t=e[0],i=e[2],n=e[4],a=e[1],o=e[3],s=e[5],l=t*o-a*i;return l?(l=1/l,r[0]=o*l,r[1]=-a*l,r[2]=-i*l,r[3]=t*l,r[4]=(i*s-o*n)*l,r[5]=(a*n-t*s)*l,r):null}function jV(r){var e=wi();return z0(e,r),e}var dle=function(){function r(e,t){this.x=e||0,this.y=t||0}return r.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.set=function(e,t){return this.x=e,this.y=t,this},r.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},r.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},r.prototype.scale=function(e){this.x*=e,this.y*=e},r.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},r.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},r.prototype.dot=function(e){return this.x*e.x+this.y*e.y},r.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},r.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},r.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},r.prototype.distance=function(e){var t=this.x-e.x,i=this.y-e.y;return Math.sqrt(t*t+i*i)},r.prototype.distanceSquare=function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},r.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},r.prototype.transform=function(e){if(e){var t=this.x,i=this.y;return this.x=e[0]*t+e[2]*i+e[4],this.y=e[1]*t+e[3]*i+e[5],this}},r.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},r.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},r.set=function(e,t,i){e.x=t,e.y=i},r.copy=function(e,t){e.x=t.x,e.y=t.y},r.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},r.lenSquare=function(e){return e.x*e.x+e.y*e.y},r.dot=function(e,t){return e.x*t.x+e.y*t.y},r.add=function(e,t,i){e.x=t.x+i.x,e.y=t.y+i.y},r.sub=function(e,t,i){e.x=t.x-i.x,e.y=t.y-i.y},r.scale=function(e,t,i){e.x=t.x*i,e.y=t.y*i},r.scaleAndAdd=function(e,t,i,n){e.x=t.x+i.x*n,e.y=t.y+i.y*n},r.lerp=function(e,t,i,n){var a=1-n;e.x=a*t.x+n*i.x,e.y=a*t.y+n*i.y},r}(),Nt=dle;var fb=Math.min,hb=Math.max,ip=new Nt,np=new Nt,ap=new Nt,op=new Nt,F0=new Nt,B0=new Nt,mle=function(){function r(e,t,i,n){i<0&&(e=e+i,i=-i),n<0&&(t=t+n,n=-n),this.x=e,this.y=t,this.width=i,this.height=n}return r.prototype.union=function(e){var t=fb(e.x,this.x),i=fb(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=hb(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=hb(e.y+e.height,this.y+this.height)-i:this.height=e.height,this.x=t,this.y=i},r.prototype.applyTransform=function(e){r.applyTransform(this,this,e)},r.prototype.calculateTransform=function(e){var t=this,i=e.width/t.width,n=e.height/t.height,a=wi();return _n(a,a,[-t.x,-t.y]),Lm(a,a,[i,n]),_n(a,a,[e.x,e.y]),a},r.prototype.intersect=function(e,t){if(!e)return!1;e instanceof r||(e=r.create(e));var i=this,n=i.x,a=i.x+i.width,o=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,c=e.y,f=e.y+e.height,h=!(a<l||u<n||s<c||f<o);if(t){var p=1/0,d=0,g=Math.abs(a-l),m=Math.abs(u-n),v=Math.abs(s-c),_=Math.abs(f-o),y=Math.min(g,m),x=Math.min(v,_);a<l||u<n?y>d&&(d=y,g<m?Nt.set(B0,-g,0):Nt.set(B0,m,0)):y<p&&(p=y,g<m?Nt.set(F0,g,0):Nt.set(F0,-m,0)),s<c||f<o?x>d&&(d=x,v<_?Nt.set(B0,0,-v):Nt.set(B0,0,_)):y<p&&(p=y,v<_?Nt.set(F0,0,v):Nt.set(F0,0,-_))}return t&&Nt.copy(t,h?F0:B0),h},r.prototype.contain=function(e,t){var i=this;return e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height},r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copy=function(e){r.copy(this,e)},r.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},r.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},r.prototype.isZero=function(){return this.width===0||this.height===0},r.create=function(e){return new r(e.x,e.y,e.width,e.height)},r.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},r.applyTransform=function(e,t,i){if(!i){e!==t&&r.copy(e,t);return}if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var n=i[0],a=i[3],o=i[4],s=i[5];e.x=t.x*n+o,e.y=t.y*a+s,e.width=t.width*n,e.height=t.height*a,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}ip.x=ap.x=t.x,ip.y=op.y=t.y,np.x=op.x=t.x+t.width,np.y=ap.y=t.y+t.height,ip.transform(i),op.transform(i),np.transform(i),ap.transform(i),e.x=fb(ip.x,np.x,ap.x,op.x),e.y=fb(ip.y,np.y,ap.y,op.y);var l=hb(ip.x,np.x,ap.x,op.x),u=hb(ip.y,np.y,ap.y,op.y);e.width=l-e.x,e.height=u-e.y},r}(),lt=mle;var JV="silent";function vle(r,e,t){return{type:r,event:t,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:t.zrX,offsetY:t.zrY,gestureEvent:t.gestureEvent,pinchX:t.pinchX,pinchY:t.pinchY,pinchScale:t.pinchScale,wheelDelta:t.zrDelta,zrByTouch:t.zrByTouch,which:t.which,stop:gle}}function gle(){Ra(this.event)}var yle=function(r){Xt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.handler=null,t}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(Pi),k0=function(){function r(e,t){this.x=e,this.y=t}return r}(),_le=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],yL=new lt(0,0,0,0),$V=function(r){Xt(e,r);function e(t,i,n,a,o){var s=r.call(this)||this;return s._hovered=new k0(0,0),s.storage=t,s.painter=i,s.painterRoot=a,s._pointerSize=o,n=n||new yle,s.proxy=null,s.setHandlerProxy(n),s._draggingMgr=new GV(s),s}return e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(N(_le,function(i){t.on&&t.on(i,this[i],this)},this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var i=t.zrX,n=t.zrY,a=QV(this,i,n),o=this._hovered,s=o.target;s&&!s.__zr&&(o=this.findHover(o.x,o.y),s=o.target);var l=this._hovered=a?new k0(i,n):this.findHover(i,n),u=l.target,c=this.proxy;c.setCursor&&c.setCursor(u?u.cursor:"default"),s&&u!==s&&this.dispatchToElement(o,"mouseout",t),this.dispatchToElement(l,"mousemove",t),u&&u!==s&&this.dispatchToElement(l,"mouseover",t)},e.prototype.mouseout=function(t){var i=t.zrEventControl;i!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",t),i!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new k0(0,0)},e.prototype.dispatch=function(t,i){var n=this[t];n&&n.call(this,i)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var i=this.proxy;i.setCursor&&i.setCursor(t)},e.prototype.dispatchToElement=function(t,i,n){t=t||{};var a=t.target;if(!(a&&a.silent)){for(var o="on"+i,s=vle(i,t,n);a&&(a[o]&&(s.cancelBubble=!!a[o].call(a,s)),a.trigger(i,s),a=a.__hostTarget?a.__hostTarget:a.parent,!s.cancelBubble););s.cancelBubble||(this.trigger(i,s),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(l){typeof l[o]=="function"&&l[o].call(l,s),l.trigger&&l.trigger(i,s)}))}},e.prototype.findHover=function(t,i,n){var a=this.storage.getDisplayList(),o=new k0(t,i);if(KV(a,o,t,i,n),this._pointerSize&&!o.target){for(var s=[],l=this._pointerSize,u=l/2,c=new lt(t-u,i-u,l,l),f=a.length-1;f>=0;f--){var h=a[f];h!==n&&!h.ignore&&!h.ignoreCoarsePointer&&(!h.parent||!h.parent.ignoreCoarsePointer)&&(yL.copy(h.getBoundingRect()),h.transform&&yL.applyTransform(h.transform),yL.intersect(c)&&s.push(h))}if(s.length)for(var p=4,d=Math.PI/12,g=Math.PI*2,m=0;m<u;m+=p)for(var v=0;v<g;v+=d){var _=t+m*Math.cos(v),y=i+m*Math.sin(v);if(KV(s,o,_,y,n),o.target)return o}}return o},e.prototype.processGesture=function(t,i){this._gestureMgr||(this._gestureMgr=new ZV);var n=this._gestureMgr;i==="start"&&n.clear();var a=n.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if(i==="end"&&n.clear(),a){var o=a.type;t.gestureEvent=o;var s=new k0;s.target=a.target,this.dispatchToElement(s,o,a.event)}},e}(Pi);N(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(r){$V.prototype[r]=function(e){var t=e.zrX,i=e.zrY,n=QV(this,t,i),a,o;if((r!=="mouseup"||!n)&&(a=this.findHover(t,i),o=a.target),r==="mousedown")this._downEl=o,this._downPoint=[e.zrX,e.zrY],this._upEl=o;else if(r==="mouseup")this._upEl=o;else if(r==="click"){if(this._downEl!==this._upEl||!this._downPoint||Yo(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(a,r,e)}});function xle(r,e,t){if(r[r.rectHover?"rectContain":"contain"](e,t)){for(var i=r,n=void 0,a=!1;i;){if(i.ignoreClip&&(a=!0),!a){var o=i.getClipPath();if(o&&!o.contain(e,t))return!1}i.silent&&(n=!0);var s=i.__hostTarget;i=s||i.parent}return n?JV:!0}return!1}function KV(r,e,t,i,n){for(var a=r.length-1;a>=0;a--){var o=r[a],s=void 0;if(o!==n&&!o.ignore&&(s=xle(o,t,i))&&(!e.topTarget&&(e.topTarget=o),s!==JV)){e.target=o;break}}}function QV(r,e,t){var i=r.painter;return e<0||e>i.getWidth()||t<0||t>i.getHeight()}var eG=$V;var iG=32,V0=7;function Sle(r){for(var e=0;r>=iG;)e|=r&1,r>>=1;return r+e}function tG(r,e,t,i){var n=e+1;if(n===t)return 1;if(i(r[n++],r[e])<0){for(;n<t&&i(r[n],r[n-1])<0;)n++;Mle(r,e,n)}else for(;n<t&&i(r[n],r[n-1])>=0;)n++;return n-e}function Mle(r,e,t){for(t--;e<t;){var i=r[e];r[e++]=r[t],r[t--]=i}}function rG(r,e,t,i,n){for(i===e&&i++;i<t;i++){for(var a=r[i],o=e,s=i,l;o<s;)l=o+s>>>1,n(a,r[l])<0?s=l:o=l+1;var u=i-o;switch(u){case 3:r[o+3]=r[o+2];case 2:r[o+2]=r[o+1];case 1:r[o+1]=r[o];break;default:for(;u>0;)r[o+u]=r[o+u-1],u--}r[o]=a}}function _L(r,e,t,i,n,a){var o=0,s=0,l=1;if(a(r,e[t+n])>0){for(s=i-n;l<s&&a(r,e[t+n+l])>0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}else{for(s=n+1;l<s&&a(r,e[t+n-l])<=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var u=o;o=n-l,l=n-u}for(o++;o<l;){var c=o+(l-o>>>1);a(r,e[t+c])>0?o=c+1:l=c}return l}function xL(r,e,t,i,n,a){var o=0,s=0,l=1;if(a(r,e[t+n])<0){for(s=n+1;l<s&&a(r,e[t+n-l])<0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var u=o;o=n-l,l=n-u}else{for(s=i-n;l<s&&a(r,e[t+n+l])>=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}for(o++;o<l;){var c=o+(l-o>>>1);a(r,e[t+c])<0?l=c:o=c+1}return l}function ble(r,e){var t=V0,i,n,a=0,o=[];i=[],n=[];function s(p,d){i[a]=p,n[a]=d,a+=1}function l(){for(;a>1;){var p=a-2;if(p>=1&&n[p-1]<=n[p]+n[p+1]||p>=2&&n[p-2]<=n[p]+n[p-1])n[p-1]<n[p+1]&&p--;else if(n[p]>n[p+1])break;c(p)}}function u(){for(;a>1;){var p=a-2;p>0&&n[p-1]<n[p+1]&&p--,c(p)}}function c(p){var d=i[p],g=n[p],m=i[p+1],v=n[p+1];n[p]=g+v,p===a-3&&(i[p+1]=i[p+2],n[p+1]=n[p+2]),a--;var _=xL(r[m],r,d,g,0,e);d+=_,g-=_,g!==0&&(v=_L(r[d+g-1],r,m,v,v-1,e),v!==0&&(g<=v?f(d,g,m,v):h(d,g,m,v)))}function f(p,d,g,m){var v=0;for(v=0;v<d;v++)o[v]=r[p+v];var _=0,y=g,x=p;if(r[x++]=r[y++],--m===0){for(v=0;v<d;v++)r[x+v]=o[_+v];return}if(d===1){for(v=0;v<m;v++)r[x+v]=r[y+v];r[x+m]=o[_];return}for(var M=t,S,w,T;;){S=0,w=0,T=!1;do if(e(r[y],o[_])<0){if(r[x++]=r[y++],w++,S=0,--m===0){T=!0;break}}else if(r[x++]=o[_++],S++,w=0,--d===1){T=!0;break}while((S|w)<M);if(T)break;do{if(S=xL(r[y],o,_,d,0,e),S!==0){for(v=0;v<S;v++)r[x+v]=o[_+v];if(x+=S,_+=S,d-=S,d<=1){T=!0;break}}if(r[x++]=r[y++],--m===0){T=!0;break}if(w=_L(o[_],r,y,m,0,e),w!==0){for(v=0;v<w;v++)r[x+v]=r[y+v];if(x+=w,y+=w,m-=w,m===0){T=!0;break}}if(r[x++]=o[_++],--d===1){T=!0;break}M--}while(S>=V0||w>=V0);if(T)break;M<0&&(M=0),M+=2}if(t=M,t<1&&(t=1),d===1){for(v=0;v<m;v++)r[x+v]=r[y+v];r[x+m]=o[_]}else{if(d===0)throw new Error;for(v=0;v<d;v++)r[x+v]=o[_+v]}}function h(p,d,g,m){var v=0;for(v=0;v<m;v++)o[v]=r[g+v];var _=p+d-1,y=m-1,x=g+m-1,M=0,S=0;if(r[x--]=r[_--],--d===0){for(M=x-(m-1),v=0;v<m;v++)r[M+v]=o[v];return}if(m===1){for(x-=d,_-=d,S=x+1,M=_+1,v=d-1;v>=0;v--)r[S+v]=r[M+v];r[x]=o[y];return}for(var w=t;;){var T=0,C=0,b=!1;do if(e(o[y],r[_])<0){if(r[x--]=r[_--],T++,C=0,--d===0){b=!0;break}}else if(r[x--]=o[y--],C++,T=0,--m===1){b=!0;break}while((T|C)<w);if(b)break;do{if(T=d-xL(o[y],r,p,d,d-1,e),T!==0){for(x-=T,_-=T,d-=T,S=x+1,M=_+1,v=T-1;v>=0;v--)r[S+v]=r[M+v];if(d===0){b=!0;break}}if(r[x--]=o[y--],--m===1){b=!0;break}if(C=m-_L(r[_],o,0,m,m-1,e),C!==0){for(x-=C,y-=C,m-=C,S=x+1,M=y+1,v=0;v<C;v++)r[S+v]=o[M+v];if(m<=1){b=!0;break}}if(r[x--]=r[_--],--d===0){b=!0;break}w--}while(T>=V0||C>=V0);if(b)break;w<0&&(w=0),w+=2}if(t=w,t<1&&(t=1),m===1){for(x-=d,_-=d,S=x+1,M=_+1,v=d-1;v>=0;v--)r[S+v]=r[M+v];r[x]=o[y]}else{if(m===0)throw new Error;for(M=x-(m-1),v=0;v<m;v++)r[M+v]=o[v]}}return{mergeRuns:l,forceMergeRuns:u,pushRun:s}}function sp(r,e,t,i){t||(t=0),i||(i=r.length);var n=i-t;if(!(n<2)){var a=0;if(n<iG){a=tG(r,t,i,e),rG(r,t,i,t+a,e);return}var o=ble(r,e),s=Sle(n);do{if(a=tG(r,t,i,e),a<s){var l=n;l>s&&(l=s),rG(r,t,t+l,t+a,e),a=l}o.pushRun(t,a),o.mergeRuns(),n-=a,t+=a}while(n!==0);o.forceMergeRuns()}}var zi=1,lp=2,hf=4;var nG=!1;function SL(){nG||(nG=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function aG(r,e){return r.zlevel===e.zlevel?r.z===e.z?r.z2-e.z2:r.z-e.z:r.zlevel-e.zlevel}var wle=function(){function r(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=aG}return r.prototype.traverse=function(e,t){for(var i=0;i<this._roots.length;i++)this._roots[i].traverse(e,t)},r.prototype.getDisplayList=function(e,t){t=t||!1;var i=this._displayList;return(e||!i.length)&&this.updateDisplayList(t),i},r.prototype.updateDisplayList=function(e){this._displayListLen=0;for(var t=this._roots,i=this._displayList,n=0,a=t.length;n<a;n++)this._updateAndAddDisplayable(t[n],null,e);i.length=this._displayListLen,sp(i,aG)},r.prototype._updateAndAddDisplayable=function(e,t,i){if(!(e.ignore&&!i)){e.beforeUpdate(),e.update(),e.afterUpdate();var n=e.getClipPath();if(e.ignoreClip)t=null;else if(n){t?t=t.slice():t=[];for(var a=n,o=e;a;)a.parent=o,a.updateTransform(),t.push(a),o=a,a=a.getClipPath()}if(e.childrenRef){for(var s=e.childrenRef(),l=0;l<s.length;l++){var u=s[l];e.__dirty&&(u.__dirty|=zi),this._updateAndAddDisplayable(u,t,i)}e.__dirty=0}else{var c=e;t&&t.length?c.__clipPaths=t:c.__clipPaths&&c.__clipPaths.length>0&&(c.__clipPaths=[]),isNaN(c.z)&&(SL(),c.z=0),isNaN(c.z2)&&(SL(),c.z2=0),isNaN(c.zlevel)&&(SL(),c.zlevel=0),this._displayList[this._displayListLen++]=c}var f=e.getDecalElement&&e.getDecalElement();f&&this._updateAndAddDisplayable(f,t,i);var h=e.getTextGuideLine();h&&this._updateAndAddDisplayable(h,t,i);var p=e.getTextContent();p&&this._updateAndAddDisplayable(p,t,i)}},r.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},r.prototype.delRoot=function(e){if(e instanceof Array){for(var t=0,i=e.length;t<i;t++)this.delRoot(e[t]);return}var n=dt(this._roots,e);n>=0&&this._roots.splice(n,1)},r.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},r.prototype.getRoots=function(){return this._roots},r.prototype.dispose=function(){this._displayList=null,this._roots=null},r}(),oG=wle;var sG;sG=zt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(r){return setTimeout(r,16)};var G0=sG;var pb={linear:function(r){return r},quadraticIn:function(r){return r*r},quadraticOut:function(r){return r*(2-r)},quadraticInOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)},cubicIn:function(r){return r*r*r},cubicOut:function(r){return--r*r*r+1},cubicInOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)},quarticIn:function(r){return r*r*r*r},quarticOut:function(r){return 1- --r*r*r*r},quarticInOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)},quinticIn:function(r){return r*r*r*r*r},quinticOut:function(r){return--r*r*r*r*r+1},quinticInOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)},sinusoidalIn:function(r){return 1-Math.cos(r*Math.PI/2)},sinusoidalOut:function(r){return Math.sin(r*Math.PI/2)},sinusoidalInOut:function(r){return .5*(1-Math.cos(Math.PI*r))},exponentialIn:function(r){return r===0?0:Math.pow(1024,r-1)},exponentialOut:function(r){return r===1?1:1-Math.pow(2,-10*r)},exponentialInOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)},circularIn:function(r){return 1-Math.sqrt(1-r*r)},circularOut:function(r){return Math.sqrt(1- --r*r)},circularInOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)},elasticIn:function(r){var e,t=.1,i=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=i/4):e=i*Math.asin(1/t)/(2*Math.PI),-(t*Math.pow(2,10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/i)))},elasticOut:function(r){var e,t=.1,i=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=i/4):e=i*Math.asin(1/t)/(2*Math.PI),t*Math.pow(2,-10*r)*Math.sin((r-e)*(2*Math.PI)/i)+1)},elasticInOut:function(r){var e,t=.1,i=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=i/4):e=i*Math.asin(1/t)/(2*Math.PI),(r*=2)<1?-.5*(t*Math.pow(2,10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/i)):t*Math.pow(2,-10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/i)*.5+1)},backIn:function(r){var e=1.70158;return r*r*((e+1)*r-e)},backOut:function(r){var e=1.70158;return--r*r*((e+1)*r+e)+1},backInOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)},bounceIn:function(r){return 1-pb.bounceOut(1-r)},bounceOut:function(r){return r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375},bounceInOut:function(r){return r<.5?pb.bounceIn(r*2)*.5:pb.bounceOut(r*2-1)*.5+.5}},db=pb;var mb=Math.pow,df=Math.sqrt,gb=1e-8,uG=1e-4,lG=df(3),vb=1/3,Al=El(),Zo=El(),Pm=El();function pf(r){return r>-gb&&r<gb}function cG(r){return r>gb||r<-gb}function hi(r,e,t,i,n){var a=1-n;return a*a*(a*r+3*n*e)+n*n*(n*i+3*a*t)}function ML(r,e,t,i,n){var a=1-n;return 3*(((e-r)*a+2*(t-e)*n)*a+(i-t)*n*n)}function up(r,e,t,i,n,a){var o=i+3*(e-t)-r,s=3*(t-e*2+r),l=3*(e-r),u=r-n,c=s*s-3*o*l,f=s*l-9*o*u,h=l*l-3*s*u,p=0;if(pf(c)&&pf(f))if(pf(s))a[0]=0;else{var d=-l/s;d>=0&&d<=1&&(a[p++]=d)}else{var g=f*f-4*c*h;if(pf(g)){var m=f/c,d=-s/o+m,v=-m/2;d>=0&&d<=1&&(a[p++]=d),v>=0&&v<=1&&(a[p++]=v)}else if(g>0){var _=df(g),y=c*s+1.5*o*(-f+_),x=c*s+1.5*o*(-f-_);y<0?y=-mb(-y,vb):y=mb(y,vb),x<0?x=-mb(-x,vb):x=mb(x,vb);var d=(-s-(y+x))/(3*o);d>=0&&d<=1&&(a[p++]=d)}else{var M=(2*c*s-3*o*f)/(2*df(c*c*c)),S=Math.acos(M)/3,w=df(c),T=Math.cos(S),d=(-s-2*w*T)/(3*o),v=(-s+w*(T+lG*Math.sin(S)))/(3*o),C=(-s+w*(T-lG*Math.sin(S)))/(3*o);d>=0&&d<=1&&(a[p++]=d),v>=0&&v<=1&&(a[p++]=v),C>=0&&C<=1&&(a[p++]=C)}}return p}function yb(r,e,t,i,n){var a=6*t-12*e+6*r,o=9*e+3*i-3*r-9*t,s=3*e-3*r,l=0;if(pf(o)){if(cG(a)){var u=-s/a;u>=0&&u<=1&&(n[l++]=u)}}else{var c=a*a-4*o*s;if(pf(c))n[0]=-a/(2*o);else if(c>0){var f=df(c),u=(-a+f)/(2*o),h=(-a-f)/(2*o);u>=0&&u<=1&&(n[l++]=u),h>=0&&h<=1&&(n[l++]=h)}}return l}function jo(r,e,t,i,n,a){var o=(e-r)*n+r,s=(t-e)*n+e,l=(i-t)*n+t,u=(s-o)*n+o,c=(l-s)*n+s,f=(c-u)*n+u;a[0]=r,a[1]=o,a[2]=u,a[3]=f,a[4]=f,a[5]=c,a[6]=l,a[7]=i}function _b(r,e,t,i,n,a,o,s,l,u,c){var f,h=.005,p=1/0,d,g,m,v;Al[0]=l,Al[1]=u;for(var _=0;_<1;_+=.05)Zo[0]=hi(r,t,n,o,_),Zo[1]=hi(e,i,a,s,_),m=gu(Al,Zo),m<p&&(f=_,p=m);p=1/0;for(var y=0;y<32&&!(h<uG);y++)d=f-h,g=f+h,Zo[0]=hi(r,t,n,o,d),Zo[1]=hi(e,i,a,s,d),m=gu(Zo,Al),d>=0&&m<p?(f=d,p=m):(Pm[0]=hi(r,t,n,o,g),Pm[1]=hi(e,i,a,s,g),v=gu(Pm,Al),g<=1&&v<p?(f=g,p=v):h*=.5);return c&&(c[0]=hi(r,t,n,o,f),c[1]=hi(e,i,a,s,f)),df(p)}function fG(r,e,t,i,n,a,o,s,l){for(var u=r,c=e,f=0,h=1/l,p=1;p<=l;p++){var d=p*h,g=hi(r,t,n,o,d),m=hi(e,i,a,s,d),v=g-u,_=m-c;f+=Math.sqrt(v*v+_*_),u=g,c=m}return f}function vi(r,e,t,i){var n=1-i;return n*(n*r+2*i*e)+i*i*t}function H0(r,e,t,i){return 2*((1-i)*(e-r)+i*(t-e))}function hG(r,e,t,i,n){var a=r-2*e+t,o=2*(e-r),s=r-i,l=0;if(pf(a)){if(cG(o)){var u=-s/o;u>=0&&u<=1&&(n[l++]=u)}}else{var c=o*o-4*a*s;if(pf(c)){var u=-o/(2*a);u>=0&&u<=1&&(n[l++]=u)}else if(c>0){var f=df(c),u=(-o+f)/(2*a),h=(-o-f)/(2*a);u>=0&&u<=1&&(n[l++]=u),h>=0&&h<=1&&(n[l++]=h)}}return l}function xb(r,e,t){var i=r+t-2*e;return i===0?.5:(r-e)/i}function mf(r,e,t,i,n){var a=(e-r)*i+r,o=(t-e)*i+e,s=(o-a)*i+a;n[0]=r,n[1]=a,n[2]=s,n[3]=s,n[4]=o,n[5]=t}function Sb(r,e,t,i,n,a,o,s,l){var u,c=.005,f=1/0;Al[0]=o,Al[1]=s;for(var h=0;h<1;h+=.05){Zo[0]=vi(r,t,n,h),Zo[1]=vi(e,i,a,h);var p=gu(Al,Zo);p<f&&(u=h,f=p)}f=1/0;for(var d=0;d<32&&!(c<uG);d++){var g=u-c,m=u+c;Zo[0]=vi(r,t,n,g),Zo[1]=vi(e,i,a,g);var p=gu(Zo,Al);if(g>=0&&p<f)u=g,f=p;else{Pm[0]=vi(r,t,n,m),Pm[1]=vi(e,i,a,m);var v=gu(Pm,Al);m<=1&&v<f?(u=m,f=v):c*=.5}}return l&&(l[0]=vi(r,t,n,u),l[1]=vi(e,i,a,u)),df(f)}function pG(r,e,t,i,n,a,o){for(var s=r,l=e,u=0,c=1/o,f=1;f<=o;f++){var h=f*c,p=vi(r,t,n,h),d=vi(e,i,a,h),g=p-s,m=d-l;u+=Math.sqrt(g*g+m*m),s=p,l=d}return u}var Tle=/cubic-bezier\(([0-9,\.e ]+)\)/;function Dm(r){var e=r&&Tle.exec(r);if(e){var t=e[1].split(","),i=+Yi(t[0]),n=+Yi(t[1]),a=+Yi(t[2]),o=+Yi(t[3]);if(isNaN(i+n+a+o))return;var s=[];return function(l){return l<=0?0:l>=1?1:up(0,i,a,1,l,s)&&hi(0,n,o,1,s[0])}}}var Ele=function(){function r(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Dr,this.ondestroy=e.ondestroy||Dr,this.onrestart=e.onrestart||Dr,e.easing&&this.setEasing(e.easing)}return r.prototype.step=function(e,t){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=t;return}var i=this._life,n=e-this._startTime-this._pausedTime,a=n/i;a<0&&(a=0),a=Math.min(a,1);var o=this.easingFunc,s=o?o(a):a;if(this.onframe(s),a===1)if(this.loop){var l=n%i;this._startTime=e-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){this._paused=!1},r.prototype.setEasing=function(e){this.easing=e,this.easingFunc=He(e)?e:db[e]||Dm(e)},r}(),dG=Ele;var mG=function(){function r(e){this.value=e}return r}();var Ale=function(){function r(){this._len=0}return r.prototype.insert=function(e){var t=new mG(e);return this.insertEntry(t),t},r.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},r.prototype.remove=function(e){var t=e.prev,i=e.next;t?t.next=i:this.head=i,i?i.prev=t:this.tail=t,e.next=e.prev=null,this._len--},r.prototype.len=function(){return this._len},r.prototype.clear=function(){this.head=this.tail=null,this._len=0},r}();var Cle=function(){function r(e){this._list=new Ale,this._maxSize=10,this._map={},this._maxSize=e}return r.prototype.put=function(e,t){var i=this._list,n=this._map,a=null;if(n[e]==null){var o=i.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=i.head;i.remove(l),delete n[l.key],a=l.value,this._lastRemovedEntry=l}s?s.value=t:s=new mG(t),s.key=e,i.insertEntry(s),n[e]=s}return a},r.prototype.get=function(e){var t=this._map[e],i=this._list;if(t!=null)return t!==i.tail&&(i.remove(t),i.insertEntry(t)),t.value},r.prototype.clear=function(){this._list.clear(),this._map={}},r.prototype.len=function(){return this._list.len()},r}(),yu=Cle;var vG={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Us(r){return r=Math.round(r),r<0?0:r>255?255:r}function Rle(r){return r=Math.round(r),r<0?0:r>360?360:r}function X0(r){return r<0?0:r>1?1:r}function bL(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?Us(parseFloat(e)/100*255):Us(parseInt(e,10))}function cp(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?X0(parseFloat(e)/100):X0(parseFloat(e))}function wL(r,e,t){return t<0?t+=1:t>1&&(t-=1),t*6<1?r+(e-r)*t*6:t*2<1?e:t*3<2?r+(e-r)*(2/3-t)*6:r}function vf(r,e,t){return r+(e-r)*t}function Ko(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function TL(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}var yG=new yu(20),Mb=null;function Im(r,e){Mb&&TL(Mb,e),Mb=yG.put(r,Mb||e.slice())}function cn(r,e){if(r){e=e||[];var t=yG.get(r);if(t)return TL(e,t);r=r+"";var i=r.replace(/ /g,"").toLowerCase();if(i in vG)return TL(e,vG[i]),Im(r,e),e;var n=i.length;if(i.charAt(0)==="#"){if(n===4||n===5){var a=parseInt(i.slice(1,4),16);if(!(a>=0&&a<=4095)){Ko(e,0,0,0,1);return}return Ko(e,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,n===5?parseInt(i.slice(4),16)/15:1),Im(r,e),e}else if(n===7||n===9){var a=parseInt(i.slice(1,7),16);if(!(a>=0&&a<=16777215)){Ko(e,0,0,0,1);return}return Ko(e,(a&16711680)>>16,(a&65280)>>8,a&255,n===9?parseInt(i.slice(7),16)/255:1),Im(r,e),e}return}var o=i.indexOf("("),s=i.indexOf(")");if(o!==-1&&s+1===n){var l=i.substr(0,o),u=i.substr(o+1,s-(o+1)).split(","),c=1;switch(l){case"rgba":if(u.length!==4)return u.length===3?Ko(e,+u[0],+u[1],+u[2],1):Ko(e,0,0,0,1);c=cp(u.pop());case"rgb":if(u.length>=3)return Ko(e,bL(u[0]),bL(u[1]),bL(u[2]),u.length===3?c:cp(u[3])),Im(r,e),e;Ko(e,0,0,0,1);return;case"hsla":if(u.length!==4){Ko(e,0,0,0,1);return}return u[3]=cp(u[3]),EL(u,e),Im(r,e),e;case"hsl":if(u.length!==3){Ko(e,0,0,0,1);return}return EL(u,e),Im(r,e),e;default:return}}Ko(e,0,0,0,1)}}function EL(r,e){var t=(parseFloat(r[0])%360+360)%360/360,i=cp(r[1]),n=cp(r[2]),a=n<=.5?n*(i+1):n+i-n*i,o=n*2-a;return e=e||[],Ko(e,Us(wL(o,a,t+1/3)*255),Us(wL(o,a,t)*255),Us(wL(o,a,t-1/3)*255),1),r.length===4&&(e[3]=r[3]),e}function Lle(r){if(r){var e=r[0]/255,t=r[1]/255,i=r[2]/255,n=Math.min(e,t,i),a=Math.max(e,t,i),o=a-n,s=(a+n)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(a+n):u=o/(2-a-n);var c=((a-e)/6+o/2)/o,f=((a-t)/6+o/2)/o,h=((a-i)/6+o/2)/o;e===a?l=h-f:t===a?l=1/3+c-h:i===a&&(l=2/3+f-c),l<0&&(l+=1),l>1&&(l-=1)}var p=[l*360,u,s];return r[3]!=null&&p.push(r[3]),p}}function bb(r,e){var t=cn(r);if(t){for(var i=0;i<3;i++)e<0?t[i]=t[i]*(1-e)|0:t[i]=(255-t[i])*e+t[i]|0,t[i]>255?t[i]=255:t[i]<0&&(t[i]=0);return Jo(t,t.length===4?"rgba":"rgb")}}function wb(r,e,t){if(!(!(e&&e.length)||!(r>=0&&r<=1))){t=t||[];var i=r*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=e[n],s=e[a],l=i-n;return t[0]=Us(vf(o[0],s[0],l)),t[1]=Us(vf(o[1],s[1],l)),t[2]=Us(vf(o[2],s[2],l)),t[3]=X0(vf(o[3],s[3],l)),t}}function _G(r,e,t){if(!(!(e&&e.length)||!(r>=0&&r<=1))){var i=r*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=cn(e[n]),s=cn(e[a]),l=i-n,u=Jo([Us(vf(o[0],s[0],l)),Us(vf(o[1],s[1],l)),Us(vf(o[2],s[2],l)),X0(vf(o[3],s[3],l))],"rgba");return t?{color:u,leftIndex:n,rightIndex:a,value:i}:u}}function fp(r,e,t,i){var n=cn(r);if(r)return n=Lle(n),e!=null&&(n[0]=Rle(e)),t!=null&&(n[1]=cp(t)),i!=null&&(n[2]=cp(i)),Jo(EL(n),"rgba")}function hp(r,e){var t=cn(r);if(t&&e!=null)return t[3]=X0(e),Jo(t,"rgba")}function Jo(r,e){if(!(!r||!r.length)){var t=r[0]+","+r[1]+","+r[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(t+=","+r[3]),e+"("+t+")"}}function Nm(r,e){var t=cn(r);return t?(.299*t[0]+.587*t[1]+.114*t[2])*t[3]/255+(1-t[3])*e:0}var gG=new yu(100);function Y0(r){if(Ce(r)){var e=gG.get(r);return e||(e=bb(r,-.1),gG.put(r,e)),e}else if(lf(r)){var t=fe({},r);return t.colorStops=de(r.colorStops,function(i){return{offset:i.offset,color:bb(i.color,-.1)}}),t}return r}var Eb=Math.round;function gf(r){var e;if(!r||r==="transparent")r="none";else if(typeof r=="string"&&r.indexOf("rgba")>-1){var t=cn(r);t&&(r="rgb("+t[0]+","+t[1]+","+t[2]+")",e=t[3])}return{color:r,opacity:e??1}}var xG=1e-4;function Cl(r){return r<xG&&r>-xG}function Tb(r){return Eb(r*1e3)/1e3}function Ab(r){return Eb(r*1e4)/1e4}function SG(r){return"matrix("+Tb(r[0])+","+Tb(r[1])+","+Tb(r[2])+","+Tb(r[3])+","+Ab(r[4])+","+Ab(r[5])+")"}var MG={left:"start",right:"end",center:"middle",middle:"middle"};function bG(r,e,t){return t==="top"?r+=e/2:t==="bottom"&&(r-=e/2),r}function wG(r){return r&&(r.shadowBlur||r.shadowOffsetX||r.shadowOffsetY)}function TG(r){var e=r.style,t=r.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),t[0],t[1]].join(",")}function CL(r){return r&&!!r.image}function Ple(r){return r&&!!r.svgElement}function q0(r){return CL(r)||Ple(r)}function Cb(r){return r.type==="linear"}function Rb(r){return r.type==="radial"}function Lb(r){return r&&(r.type==="linear"||r.type==="radial")}function Z0(r){return"url(#"+r+")"}function Pb(r){var e=r.getGlobalScale(),t=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(t)/Math.log(10)),1)}function Db(r){var e=r.x||0,t=r.y||0,i=(r.rotation||0)*Tm,n=ft(r.scaleX,1),a=ft(r.scaleY,1),o=r.skewX||0,s=r.skewY||0,l=[];return(e||t)&&l.push("translate("+e+"px,"+t+"px)"),i&&l.push("rotate("+i+")"),(n!==1||a!==1)&&l.push("scale("+n+","+a+")"),(o||s)&&l.push("skew("+Eb(o*Tm)+"deg, "+Eb(s*Tm)+"deg)"),l.join(" ")}var EG=function(){return zt.hasGlobalWindow&&He(window.btoa)?function(r){return window.btoa(unescape(encodeURIComponent(r)))}:typeof Buffer<"u"?function(r){return Buffer.from(r).toString("base64")}:function(r){return null}}();var LL=Array.prototype.slice;function _u(r,e,t){return(e-r)*t+r}function RL(r,e,t,i){for(var n=e.length,a=0;a<n;a++)r[a]=_u(e[a],t[a],i);return r}function Dle(r,e,t,i){for(var n=e.length,a=n&&e[0].length,o=0;o<n;o++){r[o]||(r[o]=[]);for(var s=0;s<a;s++)r[o][s]=_u(e[o][s],t[o][s],i)}return r}function Ib(r,e,t,i){for(var n=e.length,a=0;a<n;a++)r[a]=e[a]+t[a]*i;return r}function AG(r,e,t,i){for(var n=e.length,a=n&&e[0].length,o=0;o<n;o++){r[o]||(r[o]=[]);for(var s=0;s<a;s++)r[o][s]=e[o][s]+t[o][s]*i}return r}function Ile(r,e){for(var t=r.length,i=e.length,n=t>i?e:r,a=Math.min(t,i),o=n[a-1]||{color:[0,0,0,0],offset:0},s=a;s<Math.max(t,i);s++)n.push({offset:o.offset,color:o.color.slice()})}function Nle(r,e,t){var i=r,n=e;if(!(!i.push||!n.push)){var a=i.length,o=n.length;if(a!==o){var s=a>o;if(s)i.length=o;else for(var l=a;l<o;l++)i.push(t===1?n[l]:LL.call(n[l]))}for(var u=i[0]&&i[0].length,l=0;l<i.length;l++)if(t===1)isNaN(i[l])&&(i[l]=n[l]);else for(var c=0;c<u;c++)isNaN(i[l][c])&&(i[l][c]=n[l][c])}}function pp(r){if(ci(r)){var e=r.length;if(ci(r[0])){for(var t=[],i=0;i<e;i++)t.push(LL.call(r[i]));return t}return LL.call(r)}return r}function Ob(r){return r[0]=Math.floor(r[0])||0,r[1]=Math.floor(r[1])||0,r[2]=Math.floor(r[2])||0,r[3]=r[3]==null?1:r[3],"rgba("+r.join(",")+")"}function Ule(r){return ci(r&&r[0])?2:1}var Nb=0,zb=1,LG=2,K0=3,PL=4,DL=5,CG=6;function RG(r){return r===PL||r===DL}function Ub(r){return r===zb||r===LG}var j0=[0,0,0,0],Ole=function(){function r(e){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=e}return r.prototype.isFinished=function(){return this._finished},r.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},r.prototype.needsAnimate=function(){return this.keyframes.length>=1},r.prototype.getAdditiveTrack=function(){return this._additiveTrack},r.prototype.addKeyframe=function(e,t,i){this._needsSort=!0;var n=this.keyframes,a=n.length,o=!1,s=CG,l=t;if(ci(t)){var u=Ule(t);s=u,(u===1&&!Ct(t[0])||u===2&&!Ct(t[0][0]))&&(o=!0)}else if(Ct(t)&&!uf(t))s=Nb;else if(Ce(t))if(!isNaN(+t))s=Nb;else{var c=cn(t);c&&(l=c,s=K0)}else if(lf(t)){var f=fe({},l);f.colorStops=de(t.colorStops,function(p){return{offset:p.offset,color:cn(p.color)}}),Cb(t)?s=PL:Rb(t)&&(s=DL),l=f}a===0?this.valType=s:(s!==this.valType||s===CG)&&(o=!0),this.discrete=this.discrete||o;var h={time:e,value:l,rawValue:t,percent:0};return i&&(h.easing=i,h.easingFunc=He(i)?i:db[i]||Dm(i)),n.push(h),h},r.prototype.prepare=function(e,t){var i=this.keyframes;this._needsSort&&i.sort(function(g,m){return g.time-m.time});for(var n=this.valType,a=i.length,o=i[a-1],s=this.discrete,l=Ub(n),u=RG(n),c=0;c<a;c++){var f=i[c],h=f.value,p=o.value;f.percent=f.time/e,s||(l&&c!==a-1?Nle(h,p,n):u&&Ile(h.colorStops,p.colorStops))}if(!s&&n!==DL&&t&&this.needsAnimate()&&t.needsAnimate()&&n===t.valType&&!t._finished){this._additiveTrack=t;for(var d=i[0].value,c=0;c<a;c++)n===Nb?i[c].additiveValue=i[c].value-d:n===K0?i[c].additiveValue=Ib([],i[c].value,d,-1):Ub(n)&&(i[c].additiveValue=n===zb?Ib([],i[c].value,d,-1):AG([],i[c].value,d,-1))}},r.prototype.step=function(e,t){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var i=this._additiveTrack!=null,n=i?"additiveValue":"value",a=this.valType,o=this.keyframes,s=o.length,l=this.propName,u=a===K0,c,f=this._lastFr,h=Math.min,p,d;if(s===1)p=d=o[0];else{if(t<0)c=0;else if(t<this._lastFrP){var g=h(f+1,s-1);for(c=g;c>=0&&!(o[c].percent<=t);c--);c=h(c,s-2)}else{for(c=f;c<s&&!(o[c].percent>t);c++);c=h(c-1,s-2)}d=o[c+1],p=o[c]}if(p&&d){this._lastFr=c,this._lastFrP=t;var m=d.percent-p.percent,v=m===0?1:h((t-p.percent)/m,1);d.easingFunc&&(v=d.easingFunc(v));var _=i?this._additiveValue:u?j0:e[l];if((Ub(a)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)e[l]=v<1?p.rawValue:d.rawValue;else if(Ub(a))a===zb?RL(_,p[n],d[n],v):Dle(_,p[n],d[n],v);else if(RG(a)){var y=p[n],x=d[n],M=a===PL;e[l]={type:M?"linear":"radial",x:_u(y.x,x.x,v),y:_u(y.y,x.y,v),colorStops:de(y.colorStops,function(w,T){var C=x.colorStops[T];return{offset:_u(w.offset,C.offset,v),color:Ob(RL([],w.color,C.color,v))}}),global:x.global},M?(e[l].x2=_u(y.x2,x.x2,v),e[l].y2=_u(y.y2,x.y2,v)):e[l].r=_u(y.r,x.r,v)}else if(u)RL(_,p[n],d[n],v),i||(e[l]=Ob(_));else{var S=_u(p[n],d[n],v);i?this._additiveValue=S:e[l]=S}i&&this._addToTarget(e)}}},r.prototype._addToTarget=function(e){var t=this.valType,i=this.propName,n=this._additiveValue;t===Nb?e[i]=e[i]+n:t===K0?(cn(e[i],j0),Ib(j0,j0,n,1),e[i]=Ob(j0)):t===zb?Ib(e[i],e[i],n,1):t===LG&&AG(e[i],e[i],n,1)},r}(),zle=function(){function r(e,t,i,n){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&n){ep("Can' use additive animation on looped animation.");return}this._additiveAnimators=n,this._allowDiscrete=i}return r.prototype.getMaxTime=function(){return this._maxTime},r.prototype.getDelay=function(){return this._delay},r.prototype.getLoop=function(){return this._loop},r.prototype.getTarget=function(){return this._target},r.prototype.changeTarget=function(e){this._target=e},r.prototype.when=function(e,t,i){return this.whenWithKeys(e,t,bt(t),i)},r.prototype.whenWithKeys=function(e,t,i,n){for(var a=this._tracks,o=0;o<i.length;o++){var s=i[o],l=a[s];if(!l){l=a[s]=new Ole(s);var u=void 0,c=this._getAdditiveTrack(s);if(c){var f=c.keyframes,h=f[f.length-1];u=h&&h.value,c.valType===K0&&u&&(u=Ob(u))}else u=this._target[s];if(u==null)continue;e>0&&l.addKeyframe(0,pp(u),n),this._trackKeys.push(s)}l.addKeyframe(e,pp(t[s]),n)}return this._maxTime=Math.max(this._maxTime,e),this},r.prototype.pause=function(){this._clip.pause(),this._paused=!0},r.prototype.resume=function(){this._clip.resume(),this._paused=!1},r.prototype.isPaused=function(){return!!this._paused},r.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},r.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,i=0;i<t;i++)e[i].call(this)},r.prototype._abortedCallback=function(){this._setTracksFinished();var e=this.animation,t=this._abortedCbs;if(e&&e.removeClip(this._clip),this._clip=null,t)for(var i=0;i<t.length;i++)t[i].call(this)},r.prototype._setTracksFinished=function(){for(var e=this._tracks,t=this._trackKeys,i=0;i<t.length;i++)e[t[i]].setFinished()},r.prototype._getAdditiveTrack=function(e){var t,i=this._additiveAnimators;if(i)for(var n=0;n<i.length;n++){var a=i[n].getTrack(e);a&&(t=a)}return t},r.prototype.start=function(e){if(!(this._started>0)){this._started=1;for(var t=this,i=[],n=this._maxTime||0,a=0;a<this._trackKeys.length;a++){var o=this._trackKeys[a],s=this._tracks[o],l=this._getAdditiveTrack(o),u=s.keyframes,c=u.length;if(s.prepare(n,l),s.needsAnimate())if(!this._allowDiscrete&&s.discrete){var f=u[c-1];f&&(t._target[s.propName]=f.rawValue),s.setFinished()}else i.push(s)}if(i.length||this._force){var h=new dG({life:n,loop:this._loop,delay:this._delay||0,onframe:function(p){t._started=2;var d=t._additiveAnimators;if(d){for(var g=!1,m=0;m<d.length;m++)if(d[m]._clip){g=!0;break}g||(t._additiveAnimators=null)}for(var m=0;m<i.length;m++)i[m].step(t._target,p);var v=t._onframeCbs;if(v)for(var m=0;m<v.length;m++)v[m](t._target,p)},ondestroy:function(){t._doneCallback()}});this._clip=h,this.animation&&this.animation.addClip(h),e&&h.setEasing(e)}else this._doneCallback();return this}},r.prototype.stop=function(e){if(this._clip){var t=this._clip;e&&t.onframe(1),this._abortedCallback()}},r.prototype.delay=function(e){return this._delay=e,this},r.prototype.during=function(e){return e&&(this._onframeCbs||(this._onframeCbs=[]),this._onframeCbs.push(e)),this},r.prototype.done=function(e){return e&&(this._doneCbs||(this._doneCbs=[]),this._doneCbs.push(e)),this},r.prototype.aborted=function(e){return e&&(this._abortedCbs||(this._abortedCbs=[]),this._abortedCbs.push(e)),this},r.prototype.getClip=function(){return this._clip},r.prototype.getTrack=function(e){return this._tracks[e]},r.prototype.getTracks=function(){var e=this;return de(this._trackKeys,function(t){return e._tracks[t]})},r.prototype.stopTracks=function(e,t){if(!e.length||!this._clip)return!0;for(var i=this._tracks,n=this._trackKeys,a=0;a<e.length;a++){var o=i[e[a]];o&&!o.isFinished()&&(t?o.step(this._target,1):this._started===1&&o.step(this._target,0),o.setFinished())}for(var s=!0,a=0;a<n.length;a++)if(!i[n[a]].isFinished()){s=!1;break}return s&&this._abortedCallback(),s},r.prototype.saveTo=function(e,t,i){if(e){t=t||this._trackKeys;for(var n=0;n<t.length;n++){var a=t[n],o=this._tracks[a];if(!(!o||o.isFinished())){var s=o.keyframes,l=s[i?0:s.length-1];l&&(e[a]=pp(l.rawValue))}}}},r.prototype.__changeFinalValue=function(e,t){t=t||bt(e);for(var i=0;i<t.length;i++){var n=t[i],a=this._tracks[n];if(a){var o=a.keyframes;if(o.length>1){var s=o.pop();a.addKeyframe(s.time,e[n]),a.prepare(this._maxTime,a.getAdditiveTrack())}}}},r}(),J0=zle;function dp(){return new Date().getTime()}var Fle=function(r){Xt(e,r);function e(t){var i=r.call(this)||this;return i._running=!1,i._time=0,i._pausedTime=0,i._pauseStart=0,i._paused=!1,t=t||{},i.stage=t.stage||{},i}return e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var i=t.getClip();i&&this.addClip(i)},e.prototype.removeClip=function(t){if(t.animation){var i=t.prev,n=t.next;i?i.next=n:this._head=n,n?n.prev=i:this._tail=i,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var i=t.getClip();i&&this.removeClip(i),t.animation=null},e.prototype.update=function(t){for(var i=dp()-this._pausedTime,n=i-this._time,a=this._head;a;){var o=a.next,s=a.step(i,n);s&&(a.ondestroy(),this.removeClip(a)),a=o}this._time=i,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0;function i(){t._running&&(G0(i),!t._paused&&t.update())}G0(i)},e.prototype.start=function(){this._running||(this._time=dp(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=dp(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=dp()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var i=t.next;t.prev=t.next=t.animation=null,t=i}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(t,i){i=i||{},this.start();var n=new J0(t,i.loop);return this.addAnimator(n),n},e}(Pi),PG=Fle;var Ble=300,IL=zt.domSupported,NL=function(){var r=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],t={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},i=de(r,function(n){var a=n.replace("mouse","pointer");return t.hasOwnProperty(a)?a:n});return{mouse:r,touch:e,pointer:i}}(),DG={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},IG=!1;function zL(r){var e=r.pointerType;return e==="pen"||e==="touch"}function kle(r){r.touching=!0,r.touchTimer!=null&&(clearTimeout(r.touchTimer),r.touchTimer=null),r.touchTimer=setTimeout(function(){r.touching=!1,r.touchTimer=null},700)}function UL(r){r&&(r.zrByTouch=!0)}function Vle(r,e){return Ca(r.dom,new Gle(r,e),!0)}function UG(r,e){for(var t=e,i=!1;t&&t.nodeType!==9&&!(i=t.domBelongToZr||t!==e&&t===r.painterRoot);)t=t.parentNode;return i}var Gle=function(){function r(e,t){this.stopPropagation=Dr,this.stopImmediatePropagation=Dr,this.preventDefault=Dr,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return r}(),Os={mousedown:function(r){r=Ca(this.dom,r),this.__mayPointerCapture=[r.zrX,r.zrY],this.trigger("mousedown",r)},mousemove:function(r){r=Ca(this.dom,r);var e=this.__mayPointerCapture;e&&(r.zrX!==e[0]||r.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",r)},mouseup:function(r){r=Ca(this.dom,r),this.__togglePointerCapture(!1),this.trigger("mouseup",r)},mouseout:function(r){r=Ca(this.dom,r);var e=r.toElement||r.relatedTarget;UG(this,e)||(this.__pointerCapturing&&(r.zrEventControl="no_globalout"),this.trigger("mouseout",r))},wheel:function(r){IG=!0,r=Ca(this.dom,r),this.trigger("mousewheel",r)},mousewheel:function(r){IG||(r=Ca(this.dom,r),this.trigger("mousewheel",r))},touchstart:function(r){r=Ca(this.dom,r),UL(r),this.__lastTouchMoment=new Date,this.handler.processGesture(r,"start"),Os.mousemove.call(this,r),Os.mousedown.call(this,r)},touchmove:function(r){r=Ca(this.dom,r),UL(r),this.handler.processGesture(r,"change"),Os.mousemove.call(this,r)},touchend:function(r){r=Ca(this.dom,r),UL(r),this.handler.processGesture(r,"end"),Os.mouseup.call(this,r),+new Date-+this.__lastTouchMoment<Ble&&Os.click.call(this,r)},pointerdown:function(r){Os.mousedown.call(this,r)},pointermove:function(r){zL(r)||Os.mousemove.call(this,r)},pointerup:function(r){Os.mouseup.call(this,r)},pointerout:function(r){zL(r)||Os.mouseout.call(this,r)}};N(["click","dblclick","contextmenu"],function(r){Os[r]=function(e){e=Ca(this.dom,e),this.trigger(r,e)}});var FL={pointermove:function(r){zL(r)||FL.mousemove.call(this,r)},pointerup:function(r){FL.mouseup.call(this,r)},mousemove:function(r){this.trigger("mousemove",r)},mouseup:function(r){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",r),e&&(r.zrEventControl="only_globalout",this.trigger("mouseout",r))}};function Hle(r,e){var t=e.domHandlers;zt.pointerEventsSupported?N(NL.pointer,function(i){Fb(e,i,function(n){t[i].call(r,n)})}):(zt.touchEventsSupported&&N(NL.touch,function(i){Fb(e,i,function(n){t[i].call(r,n),kle(e)})}),N(NL.mouse,function(i){Fb(e,i,function(n){n=cb(n),e.touching||t[i].call(r,n)})}))}function Wle(r,e){zt.pointerEventsSupported?N(DG.pointer,t):zt.touchEventsSupported||N(DG.mouse,t);function t(i){function n(a){a=cb(a),UG(r,a.target)||(a=Vle(r,a),e.domHandlers[i].call(r,a))}Fb(e,i,n,{capture:!0})}}function Fb(r,e,t,i){r.mounted[e]=t,r.listenerOpts[e]=i,O0(r.domTarget,e,t,i)}function OL(r){var e=r.mounted;for(var t in e)e.hasOwnProperty(t)&&YV(r.domTarget,t,e[t],r.listenerOpts[t]);r.mounted={}}var NG=function(){function r(e,t){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=t}return r}(),Xle=function(r){Xt(e,r);function e(t,i){var n=r.call(this)||this;return n.__pointerCapturing=!1,n.dom=t,n.painterRoot=i,n._localHandlerScope=new NG(t,Os),IL&&(n._globalHandlerScope=new NG(document,FL)),Hle(n,n._localHandlerScope),n}return e.prototype.dispose=function(){OL(this._localHandlerScope),IL&&OL(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,IL&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var i=this._globalHandlerScope;t?Wle(this,i):OL(i)}},e}(Pi),OG=Xle;var zG=1;zt.hasGlobalWindow&&(zG=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var mp=zG,$0=.4,Q0="#333",e_="#ccc",FG="#eee";var BG=ff,kG=5e-5;function vp(r){return r>kG||r<-kG}var gp=[],Um=[],BL=wi(),kL=Math.abs,Yle=function(){function r(){}return r.prototype.getLocalTransform=function(e){return r.getLocalTransform(this,e)},r.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},r.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},r.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},r.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},r.prototype.needLocalTransform=function(){return vp(this.rotation)||vp(this.x)||vp(this.y)||vp(this.scaleX-1)||vp(this.scaleY-1)||vp(this.skewX)||vp(this.skewY)},r.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),i=this.transform;if(!(t||e)){i&&(BG(i),this.invTransform=null);return}i=i||wi(),t?this.getLocalTransform(i):BG(i),e&&(t?La(i,e,i):z0(i,e)),this.transform=i,this._resolveGlobalScaleRatio(i)},r.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(gp);var i=gp[0]<0?-1:1,n=gp[1]<0?-1:1,a=((gp[0]-i)*t+i)/gp[0]||0,o=((gp[1]-n)*t+n)/gp[1]||0;e[0]*=a,e[1]*=a,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||wi(),qo(this.invTransform,e)},r.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},r.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],i=e[2]*e[2]+e[3]*e[3],n=Math.atan2(e[1],e[0]),a=Math.PI/2+n-Math.atan2(e[3],e[2]);i=Math.sqrt(i)*Math.cos(a),t=Math.sqrt(t),this.skewX=a,this.skewY=0,this.rotation=-n,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=i,this.originX=0,this.originY=0}},r.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||wi(),La(Um,e.invTransform,t),t=Um);var i=this.originX,n=this.originY;(i||n)&&(BL[4]=i,BL[5]=n,La(Um,t,BL),Um[4]-=i,Um[5]-=n,t=Um),this.setLocalTransform(t)}},r.prototype.getGlobalScale=function(e){var t=this.transform;return e=e||[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},r.prototype.transformCoordToLocal=function(e,t){var i=[e,t],n=this.invTransform;return n&&fi(i,i,n),i},r.prototype.transformCoordToGlobal=function(e,t){var i=[e,t],n=this.transform;return n&&fi(i,i,n),i},r.prototype.getLineScale=function(){var e=this.transform;return e&&kL(e[0]-1)>1e-10&&kL(e[3]-1)>1e-10?Math.sqrt(kL(e[0]*e[3]-e[2]*e[1])):1},r.prototype.copyTransform=function(e){VL(this,e)},r.getLocalTransform=function(e,t){t=t||[];var i=e.originX||0,n=e.originY||0,a=e.scaleX,o=e.scaleY,s=e.anchorX,l=e.anchorY,u=e.rotation||0,c=e.x,f=e.y,h=e.skewX?Math.tan(e.skewX):0,p=e.skewY?Math.tan(-e.skewY):0;if(i||n||s||l){var d=i+s,g=n+l;t[4]=-d*a-h*g*o,t[5]=-g*o-p*d*a}else t[4]=t[5]=0;return t[0]=a,t[3]=o,t[1]=p*a,t[2]=h*o,u&&Pa(t,t,u),t[4]+=i+c,t[5]+=n+f,t},r.initDefaultProps=function(){var e=r.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),r}(),go=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function VL(r,e){for(var t=0;t<go.length;t++){var i=go[t];r[i]=e[i]}}var Da=Yle;var VG={};function Ia(r,e){e=e||ho;var t=VG[e];t||(t=VG[e]=new yu(500));var i=t.get(r);return i==null&&(i=Fn.measureText(r,e).width,t.put(r,i)),i}function GG(r,e,t,i){var n=Ia(r,e),a=zm(e),o=Om(0,n,t),s=yp(0,a,i),l=new lt(o,s,n,a);return l}function Rl(r,e,t,i){var n=((r||"")+"").split(`
  2203. `),a=n.length;if(a===1)return GG(n[0],e,t,i);for(var o=new lt(0,0,0,0),s=0;s<n.length;s++){var l=GG(n[s],e,t,i);s===0?o.copy(l):o.union(l)}return o}function Om(r,e,t){return t==="right"?r-=e:t==="center"&&(r-=e/2),r}function yp(r,e,t){return t==="middle"?r-=e/2:t==="bottom"&&(r-=e),r}function zm(r){return Ia("\u56FD",r)}function xn(r,e){return typeof r=="string"?r.lastIndexOf("%")>=0?parseFloat(r)/100*e:parseFloat(r):r}function _p(r,e,t){var i=e.position||"inside",n=e.distance!=null?e.distance:5,a=t.height,o=t.width,s=a/2,l=t.x,u=t.y,c="left",f="top";if(i instanceof Array)l+=xn(i[0],t.width),u+=xn(i[1],t.height),c=null,f=null;else switch(i){case"left":l-=n,u+=s,c="right",f="middle";break;case"right":l+=n+o,u+=s,f="middle";break;case"top":l+=o/2,u-=n,c="center",f="bottom";break;case"bottom":l+=o/2,u+=a+n,c="center";break;case"inside":l+=o/2,u+=s,c="center",f="middle";break;case"insideLeft":l+=n,u+=s,f="middle";break;case"insideRight":l+=o-n,u+=s,c="right",f="middle";break;case"insideTop":l+=o/2,u+=n,c="center";break;case"insideBottom":l+=o/2,u+=a-n,c="center",f="bottom";break;case"insideTopLeft":l+=n,u+=n;break;case"insideTopRight":l+=o-n,u+=n,c="right";break;case"insideBottomLeft":l+=n,u+=a-n,f="bottom";break;case"insideBottomRight":l+=o-n,u+=a-n,c="right",f="bottom";break}return r=r||{},r.x=l,r.y=u,r.align=c,r.verticalAlign=f,r}var GL="__zr_normal__",HL=go.concat(["ignore"]),qle=gn(go,function(r,e){return r[e]=!0,r},{ignore:!1}),Fm={},Zle=new lt(0,0,0,0),YL=function(){function r(e){this.id=ib(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return r.prototype._init=function(e){this.attr(e)},r.prototype.drift=function(e,t,i){switch(this.draggable){case"horizontal":t=0;break;case"vertical":e=0;break}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=e,n[5]+=t,this.decomposeTransform(),this.markRedraw()},r.prototype.beforeUpdate=function(){},r.prototype.afterUpdate=function(){},r.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},r.prototype.updateInnerText=function(e){var t=this._textContent;if(t&&(!t.ignore||e)){this.textConfig||(this.textConfig={});var i=this.textConfig,n=i.local,a=t.innerTransformable,o=void 0,s=void 0,l=!1;a.parent=n?this:null;var u=!1;if(a.copyTransform(t),i.position!=null){var c=Zle;i.layoutRect?c.copy(i.layoutRect):c.copy(this.getBoundingRect()),n||c.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Fm,i,c):_p(Fm,i,c),a.x=Fm.x,a.y=Fm.y,o=Fm.align,s=Fm.verticalAlign;var f=i.origin;if(f&&i.rotation!=null){var h=void 0,p=void 0;f==="center"?(h=c.width*.5,p=c.height*.5):(h=xn(f[0],c.width),p=xn(f[1],c.height)),u=!0,a.originX=-a.x+h+(n?0:c.x),a.originY=-a.y+p+(n?0:c.y)}}i.rotation!=null&&(a.rotation=i.rotation);var d=i.offset;d&&(a.x+=d[0],a.y+=d[1],u||(a.originX=-d[0],a.originY=-d[1]));var g=i.inside==null?typeof i.position=="string"&&i.position.indexOf("inside")>=0:i.inside,m=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),v=void 0,_=void 0,y=void 0;g&&this.canBeInsideText()?(v=i.insideFill,_=i.insideStroke,(v==null||v==="auto")&&(v=this.getInsideTextFill()),(_==null||_==="auto")&&(_=this.getInsideTextStroke(v),y=!0)):(v=i.outsideFill,_=i.outsideStroke,(v==null||v==="auto")&&(v=this.getOutsideFill()),(_==null||_==="auto")&&(_=this.getOutsideStroke(v),y=!0)),v=v||"#000",(v!==m.fill||_!==m.stroke||y!==m.autoStroke||o!==m.align||s!==m.verticalAlign)&&(l=!0,m.fill=v,m.stroke=_,m.autoStroke=y,m.align=o,m.verticalAlign=s,t.setDefaultTextStyle(m)),t.__dirty|=zi,l&&t.dirtyStyle(!0)}},r.prototype.canBeInsideText=function(){return!0},r.prototype.getInsideTextFill=function(){return"#fff"},r.prototype.getInsideTextStroke=function(e){return"#000"},r.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?e_:Q0},r.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),i=typeof t=="string"&&cn(t);i||(i=[255,255,255,1]);for(var n=i[3],a=this.__zr.isDarkMode(),o=0;o<3;o++)i[o]=i[o]*n+(a?0:255)*(1-n);return i[3]=1,Jo(i,"rgba")},r.prototype.traverse=function(e,t){},r.prototype.attrKV=function(e,t){e==="textConfig"?this.setTextConfig(t):e==="textContent"?this.setTextContent(t):e==="clipPath"?this.setClipPath(t):e==="extra"?(this.extra=this.extra||{},fe(this.extra,t)):this[e]=t},r.prototype.hide=function(){this.ignore=!0,this.markRedraw()},r.prototype.show=function(){this.ignore=!1,this.markRedraw()},r.prototype.attr=function(e,t){if(typeof e=="string")this.attrKV(e,t);else if(qe(e))for(var i=e,n=bt(i),a=0;a<n.length;a++){var o=n[a];this.attrKV(o,e[o])}return this.markRedraw(),this},r.prototype.saveCurrentToNormalState=function(e){this._innerSaveToNormal(e);for(var t=this._normalState,i=0;i<this.animators.length;i++){var n=this.animators[i],a=n.__fromStateTransition;if(!(n.getLoop()||a&&a!==GL)){var o=n.targetName,s=o?t[o]:t;n.saveTo(s)}}},r.prototype._innerSaveToNormal=function(e){var t=this._normalState;t||(t=this._normalState={}),e.textConfig&&!t.textConfig&&(t.textConfig=this.textConfig),this._savePrimaryToNormal(e,t,HL)},r.prototype._savePrimaryToNormal=function(e,t,i){for(var n=0;n<i.length;n++){var a=i[n];e[a]!=null&&!(a in t)&&(t[a]=this[a])}},r.prototype.hasState=function(){return this.currentStates.length>0},r.prototype.getState=function(e){return this.states[e]},r.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},r.prototype.clearStates=function(e){this.useState(GL,!1,e)},r.prototype.useState=function(e,t,i,n){var a=e===GL,o=this.hasState();if(!(!o&&a)){var s=this.currentStates,l=this.stateTransition;if(!(dt(s,e)>=0&&(t||s.length===1))){var u;if(this.stateProxy&&!a&&(u=this.stateProxy(e)),u||(u=this.states&&this.states[e]),!u&&!a){ep("State "+e+" not exists.");return}a||this.saveCurrentToNormalState(u);var c=!!(u&&u.hoverLayer||n);c&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,u,this._normalState,t,!i&&!this.__inHover&&l&&l.duration>0,l);var f=this._textContent,h=this._textGuide;return f&&f.useState(e,t,i,c),h&&h.useState(e,t,i,c),a?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~zi),u}}},r.prototype.useStates=function(e,t,i){if(!e.length)this.clearStates();else{var n=[],a=this.currentStates,o=e.length,s=o===a.length;if(s){for(var l=0;l<o;l++)if(e[l]!==a[l]){s=!1;break}}if(s)return;for(var l=0;l<o;l++){var u=e[l],c=void 0;this.stateProxy&&(c=this.stateProxy(u,e)),c||(c=this.states[u]),c&&n.push(c)}var f=n[o-1],h=!!(f&&f.hoverLayer||i);h&&this._toggleHoverLayerFlag(!0);var p=this._mergeStates(n),d=this.stateTransition;this.saveCurrentToNormalState(p),this._applyStateObj(e.join(","),p,this._normalState,!1,!t&&!this.__inHover&&d&&d.duration>0,d);var g=this._textContent,m=this._textGuide;g&&g.useStates(e,t,h),m&&m.useStates(e,t,h),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~zi)}},r.prototype.isSilent=function(){for(var e=this.silent,t=this.parent;!e&&t;){if(t.silent){e=!0;break}t=t.parent}return e},r.prototype._updateAnimationTargets=function(){for(var e=0;e<this.animators.length;e++){var t=this.animators[e];t.targetName&&t.changeTarget(this[t.targetName])}},r.prototype.removeState=function(e){var t=dt(this.currentStates,e);if(t>=0){var i=this.currentStates.slice();i.splice(t,1),this.useStates(i)}},r.prototype.replaceState=function(e,t,i){var n=this.currentStates.slice(),a=dt(n,e),o=dt(n,t)>=0;a>=0?o?n.splice(a,1):n[a]=t:i&&!o&&n.push(t),this.useStates(n)},r.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},r.prototype._mergeStates=function(e){for(var t={},i,n=0;n<e.length;n++){var a=e[n];fe(t,a),a.textConfig&&(i=i||{},fe(i,a.textConfig))}return i&&(t.textConfig=i),t},r.prototype._applyStateObj=function(e,t,i,n,a,o){var s=!(t&&n);t&&t.textConfig?(this.textConfig=fe({},n?this.textConfig:i.textConfig),fe(this.textConfig,t.textConfig)):s&&i.textConfig&&(this.textConfig=i.textConfig);for(var l={},u=!1,c=0;c<HL.length;c++){var f=HL[c],h=a&&qle[f];t&&t[f]!=null?h?(u=!0,l[f]=t[f]):this[f]=t[f]:s&&i[f]!=null&&(h?(u=!0,l[f]=i[f]):this[f]=i[f])}if(!a)for(var c=0;c<this.animators.length;c++){var p=this.animators[c],d=p.targetName;p.getLoop()||p.__changeFinalValue(d?(t||i)[d]:t||i)}u&&this._transitionState(e,l,o)},r.prototype._attachComponent=function(e){if(!(e.__zr&&!e.__hostTarget)&&e!==this){var t=this.__zr;t&&e.addSelfToZr(t),e.__zr=t,e.__hostTarget=this}},r.prototype._detachComponent=function(e){e.__zr&&e.removeSelfFromZr(e.__zr),e.__zr=null,e.__hostTarget=null},r.prototype.getClipPath=function(){return this._clipPath},r.prototype.setClipPath=function(e){this._clipPath&&this._clipPath!==e&&this.removeClipPath(),this._attachComponent(e),this._clipPath=e,this.markRedraw()},r.prototype.removeClipPath=function(){var e=this._clipPath;e&&(this._detachComponent(e),this._clipPath=null,this.markRedraw())},r.prototype.getTextContent=function(){return this._textContent},r.prototype.setTextContent=function(e){var t=this._textContent;t!==e&&(t&&t!==e&&this.removeTextContent(),e.innerTransformable=new Da,this._attachComponent(e),this._textContent=e,this.markRedraw())},r.prototype.setTextConfig=function(e){this.textConfig||(this.textConfig={}),fe(this.textConfig,e),this.markRedraw()},r.prototype.removeTextConfig=function(){this.textConfig=null,this.markRedraw()},r.prototype.removeTextContent=function(){var e=this._textContent;e&&(e.innerTransformable=null,this._detachComponent(e),this._textContent=null,this._innerTextDefaultStyle=null,this.markRedraw())},r.prototype.getTextGuideLine=function(){return this._textGuide},r.prototype.setTextGuideLine=function(e){this._textGuide&&this._textGuide!==e&&this.removeTextGuideLine(),this._attachComponent(e),this._textGuide=e,this.markRedraw()},r.prototype.removeTextGuideLine=function(){var e=this._textGuide;e&&(this._detachComponent(e),this._textGuide=null,this.markRedraw())},r.prototype.markRedraw=function(){this.__dirty|=zi;var e=this.__zr;e&&(this.__inHover?e.refreshHover():e.refresh()),this.__hostTarget&&this.__hostTarget.markRedraw()},r.prototype.dirty=function(){this.markRedraw()},r.prototype._toggleHoverLayerFlag=function(e){this.__inHover=e;var t=this._textContent,i=this._textGuide;t&&(t.__inHover=e),i&&(i.__inHover=e)},r.prototype.addSelfToZr=function(e){if(this.__zr!==e){this.__zr=e;var t=this.animators;if(t)for(var i=0;i<t.length;i++)e.animation.addAnimator(t[i]);this._clipPath&&this._clipPath.addSelfToZr(e),this._textContent&&this._textContent.addSelfToZr(e),this._textGuide&&this._textGuide.addSelfToZr(e)}},r.prototype.removeSelfFromZr=function(e){if(this.__zr){this.__zr=null;var t=this.animators;if(t)for(var i=0;i<t.length;i++)e.animation.removeAnimator(t[i]);this._clipPath&&this._clipPath.removeSelfFromZr(e),this._textContent&&this._textContent.removeSelfFromZr(e),this._textGuide&&this._textGuide.removeSelfFromZr(e)}},r.prototype.animate=function(e,t,i){var n=e?this[e]:this,a=new J0(n,t,i);return e&&(a.targetName=e),this.addAnimator(a,e),a},r.prototype.addAnimator=function(e,t){var i=this.__zr,n=this;e.during(function(){n.updateDuringAnimation(t)}).done(function(){var a=n.animators,o=dt(a,e);o>=0&&a.splice(o,1)}),this.animators.push(e),i&&i.animation.addAnimator(e),i&&i.wakeUp()},r.prototype.updateDuringAnimation=function(e){this.markRedraw()},r.prototype.stopAnimation=function(e,t){for(var i=this.animators,n=i.length,a=[],o=0;o<n;o++){var s=i[o];!e||e===s.scope?s.stop(t):a.push(s)}return this.animators=a,this},r.prototype.animateTo=function(e,t,i){WL(this,e,t,i)},r.prototype.animateFrom=function(e,t,i){WL(this,e,t,i,!0)},r.prototype._transitionState=function(e,t,i,n){for(var a=WL(this,t,i,n),o=0;o<a.length;o++)a[o].__fromStateTransition=e},r.prototype.getBoundingRect=function(){return null},r.prototype.getPaintRect=function(){return null},r.initDefaultProps=function(){var e=r.prototype;e.type="element",e.name="",e.ignore=e.silent=e.isGroup=e.draggable=e.dragging=e.ignoreClip=e.__inHover=!1,e.__dirty=zi;var t={};function i(a,o,s){t[a+o+s]||(console.warn("DEPRECATED: '"+a+"' has been deprecated. use '"+o+"', '"+s+"' instead"),t[a+o+s]=!0)}function n(a,o,s,l){Object.defineProperty(e,a,{get:function(){if(!this[o]){var c=this[o]=[];u(this,c)}return this[o]},set:function(c){this[s]=c[0],this[l]=c[1],this[o]=c,u(this,c)}});function u(c,f){Object.defineProperty(f,0,{get:function(){return c[s]},set:function(h){c[s]=h}}),Object.defineProperty(f,1,{get:function(){return c[l]},set:function(h){c[l]=h}})}}Object.defineProperty&&(n("position","_legacyPos","x","y"),n("scale","_legacyScale","scaleX","scaleY"),n("origin","_legacyOrigin","originX","originY"))}(),r}();br(YL,Pi);br(YL,Da);function WL(r,e,t,i,n){t=t||{};var a=[];HG(r,"",r,e,t,i,a,n);var o=a.length,s=!1,l=t.done,u=t.aborted,c=function(){s=!0,o--,o<=0&&(s?l&&l():u&&u())},f=function(){o--,o<=0&&(s?l&&l():u&&u())};o||l&&l(),a.length>0&&t.during&&a[0].during(function(d,g){t.during(g)});for(var h=0;h<a.length;h++){var p=a[h];c&&p.done(c),f&&p.aborted(f),t.force&&p.duration(t.duration),p.start(t.easing)}return a}function XL(r,e,t){for(var i=0;i<t;i++)r[i]=e[i]}function jle(r){return ci(r[0])}function Kle(r,e,t){if(ci(e[t]))if(ci(r[t])||(r[t]=[]),bi(e[t])){var i=e[t].length;r[t].length!==i&&(r[t]=new e[t].constructor(i),XL(r[t],e[t],i))}else{var n=e[t],a=r[t],o=n.length;if(jle(n))for(var s=n[0].length,l=0;l<o;l++)a[l]?XL(a[l],n[l],s):a[l]=Array.prototype.slice.call(n[l]);else XL(a,n,o);a.length=n.length}else r[t]=e[t]}function Jle(r,e){return r===e||ci(r)&&ci(e)&&$le(r,e)}function $le(r,e){var t=r.length;if(t!==e.length)return!1;for(var i=0;i<t;i++)if(r[i]!==e[i])return!1;return!0}function HG(r,e,t,i,n,a,o,s){for(var l=bt(i),u=n.duration,c=n.delay,f=n.additive,h=n.setToFinal,p=!qe(a),d=r.animators,g=[],m=0;m<l.length;m++){var v=l[m],_=i[v];if(_!=null&&t[v]!=null&&(p||a[v]))if(qe(_)&&!ci(_)&&!lf(_)){if(e){s||(t[v]=_,r.updateDuringAnimation(e));continue}HG(r,v,t[v],_,n,a&&a[v],o,s)}else g.push(v);else s||(t[v]=_,r.updateDuringAnimation(e),g.push(v))}var y=g.length;if(!f&&y)for(var x=0;x<d.length;x++){var M=d[x];if(M.targetName===e){var S=M.stopTracks(g);if(S){var w=dt(d,M);d.splice(w,1)}}}if(n.force||(g=Wt(g,function(E){return!Jle(i[E],t[E])}),y=g.length),y>0||n.force&&!o.length){var T=void 0,C=void 0,b=void 0;if(s){C={},h&&(T={});for(var x=0;x<y;x++){var v=g[x];C[v]=t[v],h?T[v]=i[v]:t[v]=i[v]}}else if(h){b={};for(var x=0;x<y;x++){var v=g[x];b[v]=pp(t[v]),Kle(t,i,v)}}var M=new J0(t,!1,!1,f?Wt(d,function(I){return I.targetName===e}):null);M.targetName=e,n.scope&&(M.scope=n.scope),h&&T&&M.whenWithKeys(0,T,g),b&&M.whenWithKeys(0,b,g),M.whenWithKeys(u??500,s?C:i,g).delay(c||0),r.addAnimator(M,e),o.push(M)}}var kb=YL;var WG=function(r){Xt(e,r);function e(t){var i=r.call(this)||this;return i.isGroup=!0,i._children=[],i.attr(t),i}return e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(t){return this._children[t]},e.prototype.childOfName=function(t){for(var i=this._children,n=0;n<i.length;n++)if(i[n].name===t)return i[n]},e.prototype.childCount=function(){return this._children.length},e.prototype.add=function(t){return t&&t!==this&&t.parent!==this&&(this._children.push(t),this._doAdd(t)),this},e.prototype.addBefore=function(t,i){if(t&&t!==this&&t.parent!==this&&i&&i.parent===this){var n=this._children,a=n.indexOf(i);a>=0&&(n.splice(a,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,i){var n=dt(this._children,t);return n>=0&&this.replaceAt(i,n),this},e.prototype.replaceAt=function(t,i){var n=this._children,a=n[i];if(t&&t!==this&&t.parent!==this&&t!==a){n[i]=t,a.parent=null;var o=this.__zr;o&&a.removeSelfFromZr(o),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var i=this.__zr;i&&i!==t.__zr&&t.addSelfToZr(i),i&&i.refresh()},e.prototype.remove=function(t){var i=this.__zr,n=this._children,a=dt(n,t);return a<0?this:(n.splice(a,1),t.parent=null,i&&t.removeSelfFromZr(i),i&&i.refresh(),this)},e.prototype.removeAll=function(){for(var t=this._children,i=this.__zr,n=0;n<t.length;n++){var a=t[n];i&&a.removeSelfFromZr(i),a.parent=null}return t.length=0,this},e.prototype.eachChild=function(t,i){for(var n=this._children,a=0;a<n.length;a++){var o=n[a];t.call(i,o,a)}return this},e.prototype.traverse=function(t,i){for(var n=0;n<this._children.length;n++){var a=this._children[n],o=t.call(i,a);a.isGroup&&!o&&a.traverse(t,i)}return this},e.prototype.addSelfToZr=function(t){r.prototype.addSelfToZr.call(this,t);for(var i=0;i<this._children.length;i++){var n=this._children[i];n.addSelfToZr(t)}},e.prototype.removeSelfFromZr=function(t){r.prototype.removeSelfFromZr.call(this,t);for(var i=0;i<this._children.length;i++){var n=this._children[i];n.removeSelfFromZr(t)}},e.prototype.getBoundingRect=function(t){for(var i=new lt(0,0,0,0),n=t||this._children,a=[],o=null,s=0;s<n.length;s++){var l=n[s];if(!(l.ignore||l.invisible)){var u=l.getBoundingRect(),c=l.getLocalTransform(a);c?(lt.applyTransform(i,u,c),o=o||i.clone(),o.union(i)):(o=o||u.clone(),o.union(u))}}return o||i},e}(kb);WG.prototype.type="group";var Ze=WG;var Vb={},XG={};function Qle(r){delete XG[r]}function eue(r){if(!r)return!1;if(typeof r=="string")return Nm(r,1)<$0;if(r.colorStops){for(var e=r.colorStops,t=0,i=e.length,n=0;n<i;n++)t+=Nm(e[n].color,1);return t/=i,t<$0}return!1}var tue=function(){function r(e,t,i){var n=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,i=i||{},this.dom=t,this.id=e;var a=new oG,o=i.renderer||"canvas";Vb[o]||(o=bt(Vb)[0]),i.useDirtyRect=i.useDirtyRect==null?!1:i.useDirtyRect;var s=new Vb[o](t,a,i,e),l=i.ssr||s.ssrOnly;this.storage=a,this.painter=s;var u=!zt.node&&!zt.worker&&!l?new OG(s.getViewportRoot(),s.root):null,c=i.useCoarsePointer,f=c==null||c==="auto"?zt.touchEventsSupported:!!c,h=44,p;f&&(p=ft(i.pointerSize,h)),this.handler=new eG(a,s,u,s.root,p),this.animation=new PG({stage:{update:l?null:function(){return n._flush(!0)}}}),l||this.animation.start()}return r.prototype.add=function(e){this._disposed||!e||(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},r.prototype.remove=function(e){this._disposed||!e||(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},r.prototype.configLayer=function(e,t){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,t),this.refresh())},r.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=eue(e))},r.prototype.getBackgroundColor=function(){return this._backgroundColor},r.prototype.setDarkMode=function(e){this._darkMode=e},r.prototype.isDarkMode=function(){return this._darkMode},r.prototype.refreshImmediately=function(e){this._disposed||(e||this.animation.update(!0),this._needsRefresh=!1,this.painter.refresh(),this._needsRefresh=!1)},r.prototype.refresh=function(){this._disposed||(this._needsRefresh=!0,this.animation.start())},r.prototype.flush=function(){this._disposed||this._flush(!1)},r.prototype._flush=function(e){var t,i=dp();this._needsRefresh&&(t=!0,this.refreshImmediately(e)),this._needsRefreshHover&&(t=!0,this.refreshHoverImmediately());var n=dp();t?(this._stillFrameAccum=0,this.trigger("rendered",{elapsedTime:n-i})):this._sleepAfterStill>0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},r.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},r.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},r.prototype.refreshHover=function(){this._needsRefreshHover=!0},r.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&this.painter.getType()==="canvas"&&this.painter.refreshHover())},r.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},r.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},r.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},r.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},r.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},r.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},r.prototype.on=function(e,t,i){return this._disposed||this.handler.on(e,t,i),this},r.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},r.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},r.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t<e.length;t++)e[t]instanceof Ze&&e[t].removeSelfFromZr(this);this.storage.delAllRoots(),this.painter.clear()}},r.prototype.dispose=function(){this._disposed||(this.animation.stop(),this.clear(),this.storage.dispose(),this.painter.dispose(),this.handler.dispose(),this.animation=this.storage=this.painter=this.handler=null,this._disposed=!0,Qle(this.id))},r}();function ZL(r,e){var t=new tue(ib(),r,e);return XG[t.id]=t,t}function YG(r,e){Vb[r]=e}var qL;function qG(r){if(typeof qL=="function")return qL(r)}function ZG(r){qL=r}var jG=1e-4,KG=20;function iue(r){return r.replace(/^\s+|\s+$/g,"")}function rr(r,e,t,i){var n=e[0],a=e[1],o=t[0],s=t[1],l=a-n,u=s-o;if(l===0)return u===0?o:(o+s)/2;if(i)if(l>0){if(r<=n)return o;if(r>=a)return s}else{if(r>=n)return o;if(r<=a)return s}else{if(r===n)return o;if(r===a)return s}return(r-n)/l*u+o}function ze(r,e){switch(r){case"center":case"middle":r="50%";break;case"left":case"top":r="0%";break;case"right":case"bottom":r="100%";break}return Ce(r)?iue(r).match(/%$/)?parseFloat(r)/100*e:parseFloat(r):r==null?NaN:+r}function Er(r,e,t){return e==null&&(e=10),e=Math.min(Math.max(0,e),KG),r=(+r).toFixed(e),t?r:+r}function Ti(r){return r.sort(function(e,t){return e-t}),r}function Sn(r){if(r=+r,isNaN(r))return 0;if(r>1e-14){for(var e=1,t=0;t<15;t++,e*=10)if(Math.round(r*e)/e===r)return t}return jL(r)}function jL(r){var e=r.toString().toLowerCase(),t=e.indexOf("e"),i=t>0?+e.slice(t+1):0,n=t>0?t:e.length,a=e.indexOf("."),o=a<0?0:n-1-a;return Math.max(0,o-i)}function Bm(r,e){var t=Math.log,i=Math.LN10,n=Math.floor(t(r[1]-r[0])/i),a=Math.round(t(Math.abs(e[1]-e[0]))/i),o=Math.min(Math.max(-n+a,0),20);return isFinite(o)?o:20}function JG(r,e,t){if(!r[e])return 0;var i=KL(r,t);return i[e]||0}function KL(r,e){var t=gn(r,function(p,d){return p+(isNaN(d)?0:d)},0);if(t===0)return[];for(var i=Math.pow(10,e),n=de(r,function(p){return(isNaN(p)?0:p)/t*i*100}),a=i*100,o=de(n,function(p){return Math.floor(p)}),s=gn(o,function(p,d){return p+d},0),l=de(n,function(p,d){return p-o[d]});s<a;){for(var u=Number.NEGATIVE_INFINITY,c=null,f=0,h=l.length;f<h;++f)l[f]>u&&(u=l[f],c=f);++o[c],l[c]=0,++s}return de(o,function(p){return p/i})}function $G(r,e){var t=Math.max(Sn(r),Sn(e)),i=r+e;return t>KG?i:Er(i,t)}var t_=9007199254740991;function r_(r){var e=Math.PI*2;return(r%e+e)%e}function xu(r){return r>-jG&&r<jG}var nue=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function Mn(r){if(r instanceof Date)return r;if(Ce(r)){var e=nue.exec(r);if(!e)return new Date(NaN);if(e[8]){var t=+e[4]||0;return e[8].toUpperCase()!=="Z"&&(t-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,t,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}else return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0)}else if(r==null)return new Date(NaN);return new Date(Math.round(r))}function Gb(r){return Math.pow(10,km(r))}function km(r){if(r===0)return 0;var e=Math.floor(Math.log(r)/Math.LN10);return r/Math.pow(10,e)>=10&&e++,e}function Vm(r,e){var t=km(r),i=Math.pow(10,t),n=r/i,a;return e?n<1.5?a=1:n<2.5?a=2:n<4?a=3:n<7?a=5:a=10:n<1?a=1:n<2?a=2:n<3?a=3:n<5?a=5:a=10,r=a*i,t>=-20?+r.toFixed(t<0?-t:0):r}function Gm(r,e){var t=(r.length-1)*e+1,i=Math.floor(t),n=+r[i-1],a=t-i;return a?n+a*(r[i]-n):n}function i_(r){r.sort(function(l,u){return s(l,u,0)?-1:1});for(var e=-1/0,t=1,i=0;i<r.length;){for(var n=r[i].interval,a=r[i].close,o=0;o<2;o++)n[o]<=e&&(n[o]=e,a[o]=o?1:1-t),e=n[o],t=a[o];n[0]===n[1]&&a[0]*a[1]!==1?r.splice(i,1):i++}return r;function s(l,u,c){return l.interval[c]<u.interval[c]||l.interval[c]===u.interval[c]&&(l.close[c]-u.close[c]===(c?-1:1)||!c&&s(l,u,1))}}function Na(r){var e=parseFloat(r);return e==r&&(e!==0||!Ce(r)||r.indexOf("x")<=0)?e:NaN}function xp(r){return!isNaN(Na(r))}function Hb(){return Math.round(Math.random()*9)}function QG(r,e){return e===0?r:QG(e,r%e)}function JL(r,e){return r==null?e:e==null?r:r*e/QG(r,e)}var aue="[ECharts] ",eH={},oue=typeof console<"u"&&console.warn&&console.log;function sue(r,e,t){if(oue){if(t){if(eH[e])return;eH[e]=!0}console[r](aue+e)}}function tH(r,e){sue("warn",r,e)}function ur(r){throw new Error(r)}function rH(r,e,t){return(e-r)*t+r}var iH="series\0",nH="\0_ec_\0";function $t(r){return r instanceof Array?r:r==null?[]:[r]}function yo(r,e,t){if(r){r[e]=r[e]||{},r.emphasis=r.emphasis||{},r.emphasis[e]=r.emphasis[e]||{};for(var i=0,n=t.length;i<n;i++){var a=t[i];!r.emphasis[e].hasOwnProperty(a)&&r[e].hasOwnProperty(a)&&(r.emphasis[e][a]=r[e][a])}}}var $L=["fontStyle","fontWeight","fontSize","fontFamily","rich","tag","color","textBorderColor","textBorderWidth","width","height","lineHeight","align","verticalAlign","baseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function zs(r){return qe(r)&&!pe(r)&&!(r instanceof Date)?r.value:r}function aH(r){return qe(r)&&!(r instanceof Array)}function Wb(r,e,t){var i=t==="normalMerge",n=t==="replaceMerge",a=t==="replaceAll";r=r||[],e=(e||[]).slice();var o=ke();N(e,function(l,u){if(!qe(l)){e[u]=null;return}});var s=lue(r,o,t);return(i||n)&&uue(s,r,o,e),i&&cue(s,e),i||n?fue(s,e,n):a&&hue(s,e),pue(s),s}function lue(r,e,t){var i=[];if(t==="replaceAll")return i;for(var n=0;n<r.length;n++){var a=r[n];a&&a.id!=null&&e.set(a.id,n),i.push({existing:t==="replaceMerge"||Hm(a)?null:a,newOption:null,keyInfo:null,brandNew:null})}return i}function uue(r,e,t,i){N(i,function(n,a){if(!(!n||n.id==null)){var o=n_(n.id),s=t.get(o);if(s!=null){var l=r[s];kr(!l.newOption,'Duplicated option on id "'+o+'".'),l.newOption=n,l.existing=e[s],i[a]=null}}})}function cue(r,e){N(e,function(t,i){if(!(!t||t.name==null))for(var n=0;n<r.length;n++){var a=r[n].existing;if(!r[n].newOption&&a&&(a.id==null||t.id==null)&&!Hm(t)&&!Hm(a)&&oH("name",a,t)){r[n].newOption=t,e[i]=null;return}}})}function fue(r,e,t){N(e,function(i){if(i){for(var n,a=0;(n=r[a])&&(n.newOption||Hm(n.existing)||n.existing&&i.id!=null&&!oH("id",i,n.existing));)a++;n?(n.newOption=i,n.brandNew=t):r.push({newOption:i,brandNew:t,existing:null,keyInfo:null}),a++}})}function hue(r,e){N(e,function(t){r.push({newOption:t,brandNew:!0,existing:null,keyInfo:null})})}function pue(r){var e=ke();N(r,function(t){var i=t.existing;i&&e.set(i.id,t)}),N(r,function(t){var i=t.newOption;kr(!i||i.id==null||!e.get(i.id)||e.get(i.id)===t,"id duplicates: "+(i&&i.id)),i&&i.id!=null&&e.set(i.id,t),!t.keyInfo&&(t.keyInfo={})}),N(r,function(t,i){var n=t.existing,a=t.newOption,o=t.keyInfo;if(qe(a)){if(o.name=a.name!=null?n_(a.name):n?n.name:iH+i,n)o.id=n_(n.id);else if(a.id!=null)o.id=n_(a.id);else{var s=0;do o.id="\0"+o.name+"\0"+s++;while(e.get(o.id))}e.set(o.id,t)}})}function oH(r,e,t){var i=qr(e[r],null),n=qr(t[r],null);return i!=null&&n!=null&&i===n}function n_(r){return qr(r,"")}function qr(r,e){return r==null?e:Ce(r)?r:Ct(r)||N0(r)?r+"":e}function Wm(r){var e=r.name;return!!(e&&e.indexOf(iH))}function Hm(r){return r&&r.id!=null&&n_(r.id).indexOf(nH)===0}function sH(r){return nH+r}function lH(r,e,t){N(r,function(i){var n=i.newOption;qe(n)&&(i.keyInfo.mainType=e,i.keyInfo.subType=due(e,n,i.existing,t))})}function due(r,e,t,i){var n=e.type?e.type:t?t.subType:i.determineSubType(r,e);return n}function uH(r,e){var t={},i={};return n(r||[],t),n(e||[],i,t),[a(t),a(i)];function n(o,s,l){for(var u=0,c=o.length;u<c;u++){var f=qr(o[u].seriesId,null);if(f==null)return;for(var h=$t(o[u].dataIndex),p=l&&l[f],d=0,g=h.length;d<g;d++){var m=h[d];p&&p[m]?p[m]=null:(s[f]||(s[f]={}))[m]=1}}}function a(o,s){var l=[];for(var u in o)if(o.hasOwnProperty(u)&&o[u]!=null)if(s)l.push(+u);else{var c=a(o[u],!0);c.length&&l.push({seriesId:u,dataIndex:c})}return l}}function $o(r,e){if(e.dataIndexInside!=null)return e.dataIndexInside;if(e.dataIndex!=null)return pe(e.dataIndex)?de(e.dataIndex,function(t){return r.indexOfRawIndex(t)}):r.indexOfRawIndex(e.dataIndex);if(e.name!=null)return pe(e.name)?de(e.name,function(t){return r.indexOfName(t)}):r.indexOfName(e.name)}function vt(){var r="__ec_inner_"+mue++;return function(e){return e[r]||(e[r]={})}}var mue=Hb();function yf(r,e,t){var i=a_(e,t),n=i.mainTypeSpecified,a=i.queryOptionMap,o=i.others,s=o,l=t?t.defaultMainType:null;return!n&&l&&a.set(l,{}),a.each(function(u,c){var f=_f(r,c,u,{useDefault:l===c,enableAll:t&&t.enableAll!=null?t.enableAll:!0,enableNone:t&&t.enableNone!=null?t.enableNone:!0});s[c+"Models"]=f.models,s[c+"Model"]=f.models[0]}),s}function a_(r,e){var t;if(Ce(r)){var i={};i[r+"Index"]=0,t=i}else t=r;var n=ke(),a={},o=!1;return N(t,function(s,l){if(l==="dataIndex"||l==="dataIndexInside"){a[l]=s;return}var u=l.match(/^(\w+)(Index|Id|Name)$/)||[],c=u[1],f=(u[2]||"").toLowerCase();if(!(!c||!f||e&&e.includeMainTypes&&dt(e.includeMainTypes,c)<0)){o=o||!!c;var h=n.get(c)||n.set(c,{});h[f]=s}}),{mainTypeSpecified:o,queryOptionMap:n,others:a}}var Ar={useDefault:!0,enableAll:!1,enableNone:!1},cH={useDefault:!1,enableAll:!0,enableNone:!0};function _f(r,e,t,i){i=i||Ar;var n=t.index,a=t.id,o=t.name,s={models:null,specified:n!=null||a!=null||o!=null};if(!s.specified){var l=void 0;return s.models=i.useDefault&&(l=r.getComponent(e))?[l]:[],s}return n==="none"||n===!1?(kr(i.enableNone,'`"none"` or `false` is not a valid value on index option.'),s.models=[],s):(n==="all"&&(kr(i.enableAll,'`"all"` is not a valid value on index option.'),n=a=o=null),s.models=r.queryComponents({mainType:e,index:n,id:a,name:o}),s)}function QL(r,e,t){r.setAttribute?r.setAttribute(e,t):r[e]=t}function fH(r,e){return r.getAttribute?r.getAttribute(e):r[e]}function hH(r){return r==="auto"?zt.domSupported?"html":"richText":r||"html"}function o_(r,e){var t=ke(),i=[];return N(r,function(n){var a=e(n);(t.get(a)||(i.push(a),t.set(a,[]))).push(n)}),{keys:i,buckets:t}}function Xb(r,e,t,i,n){var a=e==null||e==="auto";if(i==null)return i;if(Ct(i)){var o=rH(t||0,i,n);return Er(o,a?Math.max(Sn(t||0),Sn(i)):e)}else{if(Ce(i))return n<1?t:i;for(var s=[],l=t,u=i,c=Math.max(l?l.length:0,u.length),f=0;f<c;++f){var h=r.getDimensionInfo(f);if(h&&h.type==="ordinal")s[f]=(n<1&&l?l:u)[f];else{var p=l&&l[f]?l[f]:0,d=u[f],o=rH(p,d,n);s[f]=Er(o,a?Math.max(Sn(p),Sn(d)):e)}}return s}}var vue=".",Sp="___EC__COMPONENT__CONTAINER___",pH="___EC__EXTENDED_CLASS___";function Oa(r){var e={main:"",sub:""};if(r){var t=r.split(vue);e.main=t[0]||"",e.sub=t[1]||""}return e}function gue(r){kr(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(r),'componentType "'+r+'" illegal')}function dH(r){return!!(r&&r[pH])}function Xm(r,e){r.$constructor=r,r.extend=function(t){var i=this,n;return yue(i)?n=function(a){Z(o,a);function o(){return a.apply(this,arguments)||this}return o}(i):(n=function(){(t.$constructor||i).apply(this,arguments)},UV(n,this)),fe(n.prototype,t),n[pH]=!0,n.extend=this.extend,n.superCall=xue,n.superApply=Sue,n.superClass=i,n}}function yue(r){return He(r)&&/^class\s/.test(Function.prototype.toString.call(r))}function Yb(r,e){r.extend=e.extend}var _ue=Math.round(Math.random()*10);function mH(r){var e=["__\0is_clz",_ue++].join("_");r.prototype[e]=!0,r.isInstance=function(t){return!!(t&&t[e])}}function xue(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];return this.superClass.prototype[e].apply(r,t)}function Sue(r,e,t){return this.superClass.prototype[e].apply(r,t)}function xf(r){var e={};r.registerClass=function(i){var n=i.type||i.prototype.type;if(n){gue(n),i.prototype.type=n;var a=Oa(n);if(!a.sub)e[a.main]=i;else if(a.sub!==Sp){var o=t(a);o[a.sub]=i}}return i},r.getClass=function(i,n,a){var o=e[i];if(o&&o[Sp]&&(o=n?o[n]:null),a&&!o)throw new Error(n?"Component "+i+"."+(n||"")+" is used but not imported.":i+".type should be specified.");return o},r.getClassesByMainType=function(i){var n=Oa(i),a=[],o=e[n.main];return o&&o[Sp]?N(o,function(s,l){l!==Sp&&a.push(s)}):a.push(o),a},r.hasClass=function(i){var n=Oa(i);return!!e[n.main]},r.getAllClassMainTypes=function(){var i=[];return N(e,function(n,a){i.push(a)}),i},r.hasSubTypes=function(i){var n=Oa(i),a=e[n.main];return a&&a[Sp]};function t(i){var n=e[i.main];return(!n||!n[Sp])&&(n=e[i.main]={},n[Sp]=!0),n}}function za(r,e){for(var t=0;t<r.length;t++)r[t][1]||(r[t][1]=r[t][0]);return e=e||!1,function(i,n,a){for(var o={},s=0;s<r.length;s++){var l=r[s][1];if(!(n&&dt(n,l)>=0||a&&dt(a,l)<0)){var u=i.getShallow(l,e);u!=null&&(o[r[s][0]]=u)}}return o}}var Mue=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],bue=za(Mue),vH=function(){function r(){}return r.prototype.getAreaStyle=function(e,t){return bue(this,e,t)},r}();var tP=new yu(50);function yH(r){if(typeof r=="string"){var e=tP.get(r);return e&&e.image}else return r}function s_(r,e,t,i,n){if(r)if(typeof r=="string"){if(e&&e.__zrImageSrc===r||!t)return e;var a=tP.get(r),o={hostEl:t,cb:i,cbPayload:n};return a?(e=a.image,!Ym(e)&&a.pending.push(o)):(e=Fn.loadImage(r,gH,gH),e.__zrImageSrc=r,tP.put(r,e.__cachedImgObj={image:e,pending:[o]})),e}else return r;else return e}function gH(){var r=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e<r.pending.length;e++){var t=r.pending[e],i=t.cb;i&&i(this,t.cbPayload),t.hostEl.dirty()}r.pending.length=0}function Ym(r){return r&&r.width&&r.height}var rP=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function Tue(r,e,t,i,n){if(!e)return"";var a=(r+"").split(`
  2204. `);n=xH(e,t,i,n);for(var o=0,s=a.length;o<s;o++)a[o]=SH(a[o],n);return a.join(`
  2205. `)}function xH(r,e,t,i){i=i||{};var n=fe({},i);n.font=e,t=ft(t,"..."),n.maxIterations=ft(i.maxIterations,2);var a=n.minChar=ft(i.minChar,0);n.cnCharWidth=Ia("\u56FD",e);var o=n.ascCharWidth=Ia("a",e);n.placeholder=ft(i.placeholder,"");for(var s=r=Math.max(0,r-1),l=0;l<a&&s>=o;l++)s-=o;var u=Ia(t,e);return u>s&&(t="",u=0),s=r-u,n.ellipsis=t,n.ellipsisWidth=u,n.contentWidth=s,n.containerWidth=r,n}function SH(r,e){var t=e.containerWidth,i=e.font,n=e.contentWidth;if(!t)return"";var a=Ia(r,i);if(a<=t)return r;for(var o=0;;o++){if(a<=n||o>=e.maxIterations){r+=e.ellipsis;break}var s=o===0?Eue(r,n,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(r.length*n/a):0;r=r.substr(0,s),a=Ia(r,i)}return r===""&&(r=e.placeholder),r}function Eue(r,e,t,i){for(var n=0,a=0,o=r.length;a<o&&n<e;a++){var s=r.charCodeAt(a);n+=0<=s&&s<=127?t:i}return a}function MH(r,e){r!=null&&(r+="");var t=e.overflow,i=e.padding,n=e.font,a=t==="truncate",o=zm(n),s=ft(e.lineHeight,o),l=!!e.backgroundColor,u=e.lineOverflow==="truncate",c=e.width,f;c!=null&&(t==="break"||t==="breakAll")?f=r?wH(r,e.font,c,t==="breakAll",0).lines:[]:f=r?r.split(`
  2206. `):[];var h=f.length*s,p=ft(e.height,h);if(h>p&&u){var d=Math.floor(p/s);f=f.slice(0,d)}if(r&&a&&c!=null)for(var g=xH(c,n,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),m=0;m<f.length;m++)f[m]=SH(f[m],g);for(var v=p,_=0,m=0;m<f.length;m++)_=Math.max(Ia(f[m],n),_);c==null&&(c=_);var y=_;return i&&(v+=i[0]+i[2],y+=i[1]+i[3],c+=i[1]+i[3]),l&&(y=c),{lines:f,height:p,outerWidth:y,outerHeight:v,lineHeight:s,calculatedLineHeight:o,contentWidth:_,contentHeight:h,width:c}}var Aue=function(){function r(){}return r}(),_H=function(){function r(e){this.tokens=[],e&&(this.tokens=e)}return r}(),Cue=function(){function r(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[]}return r}();function bH(r,e){var t=new Cue;if(r!=null&&(r+=""),!r)return t;for(var i=e.width,n=e.height,a=e.overflow,o=(a==="break"||a==="breakAll")&&i!=null?{width:i,accumWidth:0,breakAll:a==="breakAll"}:null,s=rP.lastIndex=0,l;(l=rP.exec(r))!=null;){var u=l.index;u>s&&iP(t,r.substring(s,u),e,o),iP(t,l[2],e,o,l[1]),s=rP.lastIndex}s<r.length&&iP(t,r.substring(s,r.length),e,o);var c=[],f=0,h=0,p=e.padding,d=a==="truncate",g=e.lineOverflow==="truncate";function m(z,k,G){z.width=k,z.lineHeight=G,f+=G,h=Math.max(h,k)}e:for(var v=0;v<t.lines.length;v++){for(var _=t.lines[v],y=0,x=0,M=0;M<_.tokens.length;M++){var S=_.tokens[M],w=S.styleName&&e.rich[S.styleName]||{},T=S.textPadding=w.padding,C=T?T[1]+T[3]:0,b=S.font=w.font||e.font;S.contentHeight=zm(b);var E=ft(w.height,S.contentHeight);if(S.innerHeight=E,T&&(E+=T[0]+T[2]),S.height=E,S.lineHeight=Xi(w.lineHeight,e.lineHeight,E),S.align=w&&w.align||e.align,S.verticalAlign=w&&w.verticalAlign||"middle",g&&n!=null&&f+S.lineHeight>n){M>0?(_.tokens=_.tokens.slice(0,M),m(_,x,y),t.lines=t.lines.slice(0,v+1)):t.lines=t.lines.slice(0,v);break e}var I=w.width,R=I==null||I==="auto";if(typeof I=="string"&&I.charAt(I.length-1)==="%")S.percentWidth=I,c.push(S),S.contentWidth=Ia(S.text,b);else{if(R){var A=w.backgroundColor,D=A&&A.image;D&&(D=yH(D),Ym(D)&&(S.width=Math.max(S.width,D.width*E/D.height)))}var U=d&&i!=null?i-x:null;U!=null&&U<S.width?!R||U<C?(S.text="",S.width=S.contentWidth=0):(S.text=Tue(S.text,U-C,b,e.ellipsis,{minChar:e.truncateMinChar}),S.width=S.contentWidth=Ia(S.text,b)):S.contentWidth=Ia(S.text,b)}S.width+=C,x+=S.width,w&&(y=Math.max(y,S.lineHeight))}m(_,x,y)}t.outerWidth=t.width=ft(i,h),t.outerHeight=t.height=ft(n,f),t.contentHeight=f,t.contentWidth=h,p&&(t.outerWidth+=p[1]+p[3],t.outerHeight+=p[0]+p[2]);for(var v=0;v<c.length;v++){var S=c[v],B=S.percentWidth;S.width=parseInt(B,10)/100*t.width}return t}function iP(r,e,t,i,n){var a=e==="",o=n&&t.rich[n]||{},s=r.lines,l=o.font||t.font,u=!1,c,f;if(i){var h=o.padding,p=h?h[1]+h[3]:0;if(o.width!=null&&o.width!=="auto"){var d=xn(o.width,i.width)+p;s.length>0&&d+i.accumWidth>i.width&&(c=e.split(`
  2207. `),u=!0),i.accumWidth=d}else{var g=wH(e,l,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+p,f=g.linesWidths,c=g.lines}}else c=e.split(`
  2208. `);for(var m=0;m<c.length;m++){var v=c[m],_=new Aue;if(_.styleName=n,_.text=v,_.isLineHolder=!v&&!a,typeof o.width=="number"?_.width=o.width:_.width=f?f[m]:Ia(v,l),!m&&!u){var y=(s[s.length-1]||(s[0]=new _H)).tokens,x=y.length;x===1&&y[0].isLineHolder?y[0]=_:(v||!x||a)&&y.push(_)}else s.push(new _H([_]))}}function Rue(r){var e=r.charCodeAt(0);return e>=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var Lue=gn(",&?/;] ".split(""),function(r,e){return r[e]=!0,r},{});function Pue(r){return Rue(r)?!!Lue[r]:!0}function wH(r,e,t,i,n){for(var a=[],o=[],s="",l="",u=0,c=0,f=0;f<r.length;f++){var h=r.charAt(f);if(h===`
  2209. `){l&&(s+=l,c+=u),a.push(s),o.push(c),s="",l="",u=0,c=0;continue}var p=Ia(h,e),d=i?!1:!Pue(h);if(a.length?c+p>t:n+c+p>t){c?(s||l)&&(d?(s||(s=l,l="",u=0,c=u),a.push(s),o.push(c-u),l+=h,u+=p,s="",c=u):(l&&(s+=l,l="",u=0),a.push(s),o.push(c),s=h,c=p)):d?(a.push(l),o.push(u),l=h,u=p):(a.push(h),o.push(p));continue}c+=p,d?(l+=h,u+=p):(l&&(s+=l,l="",u=0),s+=h)}return!a.length&&!s&&(s=r,l="",u=0),l&&(s+=l),s&&(a.push(s),o.push(c)),a.length===1&&(c+=n),{accumWidth:c,lines:a,linesWidths:o}}var oP="__zr_style_"+Math.round(Math.random()*10),Ll={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},Mp={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Ll[oP]=!0;var TH=["z","z2","invisible"],Due=["invisible"],Iue=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype._init=function(t){for(var i=bt(t),n=0;n<i.length;n++){var a=i[n];a==="style"?this.useStyle(t[a]):r.prototype.attrKV.call(this,a,t[a])}this.style||this.useStyle({})},e.prototype.beforeBrush=function(){},e.prototype.afterBrush=function(){},e.prototype.innerBeforeBrush=function(){},e.prototype.innerAfterBrush=function(){},e.prototype.shouldBePainted=function(t,i,n,a){var o=this.transform;if(this.ignore||this.invisible||this.style.opacity===0||this.culling&&Nue(this,t,i)||o&&!o[0]&&!o[3])return!1;if(n&&this.__clipPaths){for(var s=0;s<this.__clipPaths.length;++s)if(this.__clipPaths[s].isZeroArea())return!1}if(a&&this.parent)for(var l=this.parent;l;){if(l.ignore)return!1;l=l.parent}return!0},e.prototype.contain=function(t,i){return this.rectContain(t,i)},e.prototype.traverse=function(t,i){t.call(i,this)},e.prototype.rectContain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();return a.contain(n[0],n[1])},e.prototype.getPaintRect=function(){var t=this._paintRect;if(!this._paintRect||this.__dirty){var i=this.transform,n=this.getBoundingRect(),a=this.style,o=a.shadowBlur||0,s=a.shadowOffsetX||0,l=a.shadowOffsetY||0;t=this._paintRect||(this._paintRect=new lt(0,0,0,0)),i?lt.applyTransform(t,n,i):t.copy(n),(o||s||l)&&(t.width+=o*2+Math.abs(s),t.height+=o*2+Math.abs(l),t.x=Math.min(t.x,t.x+s-o),t.y=Math.min(t.y,t.y+l-o));var u=this.dirtyRectTolerance;t.isZero()||(t.x=Math.floor(t.x-u),t.y=Math.floor(t.y-u),t.width=Math.ceil(t.width+1+u*2),t.height=Math.ceil(t.height+1+u*2))}return t},e.prototype.setPrevPaintRect=function(t){t?(this._prevPaintRect=this._prevPaintRect||new lt(0,0,0,0),this._prevPaintRect.copy(t)):this._prevPaintRect=null},e.prototype.getPrevPaintRect=function(){return this._prevPaintRect},e.prototype.animateStyle=function(t){return this.animate("style",t)},e.prototype.updateDuringAnimation=function(t){t==="style"?this.dirtyStyle():this.markRedraw()},e.prototype.attrKV=function(t,i){t!=="style"?r.prototype.attrKV.call(this,t,i):this.style?this.setStyle(i):this.useStyle(i)},e.prototype.setStyle=function(t,i){return typeof t=="string"?this.style[t]=i:fe(this.style,t),this.dirtyStyle(),this},e.prototype.dirtyStyle=function(t){t||this.markRedraw(),this.__dirty|=lp,this._rect&&(this._rect=null)},e.prototype.dirty=function(){this.dirtyStyle()},e.prototype.styleChanged=function(){return!!(this.__dirty&lp)},e.prototype.styleUpdated=function(){this.__dirty&=~lp},e.prototype.createStyle=function(t){return cf(Ll,t)},e.prototype.useStyle=function(t){t[oP]||(t=this.createStyle(t)),this.__inHover?this.__hoverStyle=t:this.style=t,this.dirtyStyle()},e.prototype.isStyleObject=function(t){return t[oP]},e.prototype._innerSaveToNormal=function(t){r.prototype._innerSaveToNormal.call(this,t);var i=this._normalState;t.style&&!i.style&&(i.style=this._mergeStyle(this.createStyle(),this.style)),this._savePrimaryToNormal(t,i,TH)},e.prototype._applyStateObj=function(t,i,n,a,o,s){r.prototype._applyStateObj.call(this,t,i,n,a,o,s);var l=!(i&&a),u;if(i&&i.style?o?a?u=i.style:(u=this._mergeStyle(this.createStyle(),n.style),this._mergeStyle(u,i.style)):(u=this._mergeStyle(this.createStyle(),a?this.style:n.style),this._mergeStyle(u,i.style)):l&&(u=n.style),u)if(o){var c=this.style;if(this.style=this.createStyle(l?{}:c),l)for(var f=bt(c),h=0;h<f.length;h++){var p=f[h];p in u&&(u[p]=u[p],this.style[p]=c[p])}for(var d=bt(u),h=0;h<d.length;h++){var p=d[h];this.style[p]=this.style[p]}this._transitionState(t,{style:u},s,this.getAnimationStyleProps())}else this.useStyle(u);for(var g=this.__inHover?Due:TH,h=0;h<g.length;h++){var p=g[h];i&&i[p]!=null?this[p]=i[p]:l&&n[p]!=null&&(this[p]=n[p])}},e.prototype._mergeStates=function(t){for(var i=r.prototype._mergeStates.call(this,t),n,a=0;a<t.length;a++){var o=t[a];o.style&&(n=n||{},this._mergeStyle(n,o.style))}return n&&(i.style=n),i},e.prototype._mergeStyle=function(t,i){return fe(t,i),t},e.prototype.getAnimationStyleProps=function(){return Mp},e.initDefaultProps=function(){var t=e.prototype;t.type="displayable",t.invisible=!1,t.z=0,t.z2=0,t.zlevel=0,t.culling=!1,t.cursor="pointer",t.rectHover=!1,t.incremental=!1,t._rect=null,t.dirtyRectTolerance=0,t.__dirty=zi|lp}(),e}(kb),nP=new lt(0,0,0,0),aP=new lt(0,0,0,0);function Nue(r,e,t){return nP.copy(r.getBoundingRect()),r.transform&&nP.applyTransform(r.transform),aP.width=e,aP.height=t,!nP.intersect(aP)}var gi=Iue;var Fa=Math.min,Ba=Math.max,sP=Math.sin,lP=Math.cos,bp=Math.PI*2,qb=El(),Zb=El(),jb=El();function wp(r,e,t){if(r.length!==0){for(var i=r[0],n=i[0],a=i[0],o=i[1],s=i[1],l=1;l<r.length;l++)i=r[l],n=Fa(n,i[0]),a=Ba(a,i[0]),o=Fa(o,i[1]),s=Ba(s,i[1]);e[0]=n,e[1]=o,t[0]=a,t[1]=s}}function uP(r,e,t,i,n,a){n[0]=Fa(r,t),n[1]=Fa(e,i),a[0]=Ba(r,t),a[1]=Ba(e,i)}var EH=[],AH=[];function CH(r,e,t,i,n,a,o,s,l,u){var c=yb,f=hi,h=c(r,t,n,o,EH);l[0]=1/0,l[1]=1/0,u[0]=-1/0,u[1]=-1/0;for(var p=0;p<h;p++){var d=f(r,t,n,o,EH[p]);l[0]=Fa(d,l[0]),u[0]=Ba(d,u[0])}h=c(e,i,a,s,AH);for(var p=0;p<h;p++){var g=f(e,i,a,s,AH[p]);l[1]=Fa(g,l[1]),u[1]=Ba(g,u[1])}l[0]=Fa(r,l[0]),u[0]=Ba(r,u[0]),l[0]=Fa(o,l[0]),u[0]=Ba(o,u[0]),l[1]=Fa(e,l[1]),u[1]=Ba(e,u[1]),l[1]=Fa(s,l[1]),u[1]=Ba(s,u[1])}function RH(r,e,t,i,n,a,o,s){var l=xb,u=vi,c=Ba(Fa(l(r,t,n),1),0),f=Ba(Fa(l(e,i,a),1),0),h=u(r,t,n,c),p=u(e,i,a,f);o[0]=Fa(r,n,h),o[1]=Fa(e,a,p),s[0]=Ba(r,n,h),s[1]=Ba(e,a,p)}function LH(r,e,t,i,n,a,o,s,l){var u=po,c=mo,f=Math.abs(n-a);if(f%bp<1e-4&&f>1e-4){s[0]=r-t,s[1]=e-i,l[0]=r+t,l[1]=e+i;return}if(qb[0]=lP(n)*t+r,qb[1]=sP(n)*i+e,Zb[0]=lP(a)*t+r,Zb[1]=sP(a)*i+e,u(s,qb,Zb),c(l,qb,Zb),n=n%bp,n<0&&(n=n+bp),a=a%bp,a<0&&(a=a+bp),n>a&&!o?a+=bp:n<a&&o&&(n+=bp),o){var h=a;a=n,n=h}for(var p=0;p<a;p+=Math.PI/2)p>n&&(jb[0]=lP(p)*t+r,jb[1]=sP(p)*i+e,u(s,jb,s),c(l,jb,l))}var Vr={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Tp=[],Ep=[],Pl=[],Sf=[],Dl=[],Il=[],cP=Math.min,fP=Math.max,Ap=Math.cos,Cp=Math.sin,Su=Math.abs,dP=Math.PI,Mf=dP*2,hP=typeof Float32Array<"u",l_=[];function pP(r){var e=Math.round(r/dP*1e8)/1e8;return e%2*dP}function u_(r,e){var t=pP(r[0]);t<0&&(t+=Mf);var i=t-r[0],n=r[1];n+=i,!e&&n-t>=Mf?n=t+Mf:e&&t-n>=Mf?n=t-Mf:!e&&t>n?n=t+(Mf-pP(t-n)):e&&t<n&&(n=t-(Mf-pP(n-t))),r[0]=t,r[1]=n}var Uue=function(){function r(e){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,e&&(this._saveData=!1),this._saveData&&(this.data=[])}return r.prototype.increaseVersion=function(){this._version++},r.prototype.getVersion=function(){return this._version},r.prototype.setScale=function(e,t,i){i=i||0,i>0&&(this._ux=Su(i/mp/e)||0,this._uy=Su(i/mp/t)||0)},r.prototype.setDPR=function(e){this.dpr=e},r.prototype.setContext=function(e){this._ctx=e},r.prototype.getContext=function(){return this._ctx},r.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},r.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},r.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(Vr.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},r.prototype.lineTo=function(e,t){var i=Su(e-this._xi),n=Su(t-this._yi),a=i>this._ux||n>this._uy;if(this.addData(Vr.L,e,t),this._ctx&&a&&this._ctx.lineTo(e,t),a)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var o=i*i+n*n;o>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=o)}return this},r.prototype.bezierCurveTo=function(e,t,i,n,a,o){return this._drawPendingPt(),this.addData(Vr.C,e,t,i,n,a,o),this._ctx&&this._ctx.bezierCurveTo(e,t,i,n,a,o),this._xi=a,this._yi=o,this},r.prototype.quadraticCurveTo=function(e,t,i,n){return this._drawPendingPt(),this.addData(Vr.Q,e,t,i,n),this._ctx&&this._ctx.quadraticCurveTo(e,t,i,n),this._xi=i,this._yi=n,this},r.prototype.arc=function(e,t,i,n,a,o){this._drawPendingPt(),l_[0]=n,l_[1]=a,u_(l_,o),n=l_[0],a=l_[1];var s=a-n;return this.addData(Vr.A,e,t,i,i,n,s,0,o?0:1),this._ctx&&this._ctx.arc(e,t,i,n,a,o),this._xi=Ap(a)*i+e,this._yi=Cp(a)*i+t,this},r.prototype.arcTo=function(e,t,i,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,i,n,a),this},r.prototype.rect=function(e,t,i,n){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,i,n),this.addData(Vr.R,e,t,i,n),this},r.prototype.closePath=function(){this._drawPendingPt(),this.addData(Vr.Z);var e=this._ctx,t=this._x0,i=this._y0;return e&&e.closePath(),this._xi=t,this._yi=i,this},r.prototype.fill=function(e){e&&e.fill(),this.toStatic()},r.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},r.prototype.len=function(){return this._len},r.prototype.setData=function(e){var t=e.length;!(this.data&&this.data.length===t)&&hP&&(this.data=new Float32Array(t));for(var i=0;i<t;i++)this.data[i]=e[i];this._len=t},r.prototype.appendPath=function(e){e instanceof Array||(e=[e]);for(var t=e.length,i=0,n=this._len,a=0;a<t;a++)i+=e[a].len();hP&&this.data instanceof Float32Array&&(this.data=new Float32Array(n+i));for(var a=0;a<t;a++)for(var o=e[a].data,s=0;s<o.length;s++)this.data[n++]=o[s];this._len=n},r.prototype.addData=function(e,t,i,n,a,o,s,l,u){if(this._saveData){var c=this.data;this._len+arguments.length>c.length&&(this._expandData(),c=this.data);for(var f=0;f<arguments.length;f++)c[this._len++]=arguments[f]}},r.prototype._drawPendingPt=function(){this._pendingPtDist>0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},r.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t<this._len;t++)e[t]=this.data[t];this.data=e}},r.prototype.toStatic=function(){if(this._saveData){this._drawPendingPt();var e=this.data;e instanceof Array&&(e.length=this._len,hP&&this._len>11&&(this.data=new Float32Array(e)))}},r.prototype.getBoundingRect=function(){Pl[0]=Pl[1]=Dl[0]=Dl[1]=Number.MAX_VALUE,Sf[0]=Sf[1]=Il[0]=Il[1]=-Number.MAX_VALUE;var e=this.data,t=0,i=0,n=0,a=0,o;for(o=0;o<this._len;){var s=e[o++],l=o===1;switch(l&&(t=e[o],i=e[o+1],n=t,a=i),s){case Vr.M:t=n=e[o++],i=a=e[o++],Dl[0]=n,Dl[1]=a,Il[0]=n,Il[1]=a;break;case Vr.L:uP(t,i,e[o],e[o+1],Dl,Il),t=e[o++],i=e[o++];break;case Vr.C:CH(t,i,e[o++],e[o++],e[o++],e[o++],e[o],e[o+1],Dl,Il),t=e[o++],i=e[o++];break;case Vr.Q:RH(t,i,e[o++],e[o++],e[o],e[o+1],Dl,Il),t=e[o++],i=e[o++];break;case Vr.A:var u=e[o++],c=e[o++],f=e[o++],h=e[o++],p=e[o++],d=e[o++]+p;o+=1;var g=!e[o++];l&&(n=Ap(p)*f+u,a=Cp(p)*h+c),LH(u,c,f,h,p,d,g,Dl,Il),t=Ap(d)*f+u,i=Cp(d)*h+c;break;case Vr.R:n=t=e[o++],a=i=e[o++];var m=e[o++],v=e[o++];uP(n,a,n+m,a+v,Dl,Il);break;case Vr.Z:t=n,i=a;break}po(Pl,Pl,Dl),mo(Sf,Sf,Il)}return o===0&&(Pl[0]=Pl[1]=Sf[0]=Sf[1]=0),new lt(Pl[0],Pl[1],Sf[0]-Pl[0],Sf[1]-Pl[1])},r.prototype._calculateLength=function(){var e=this.data,t=this._len,i=this._ux,n=this._uy,a=0,o=0,s=0,l=0;this._pathSegLen||(this._pathSegLen=[]);for(var u=this._pathSegLen,c=0,f=0,h=0;h<t;){var p=e[h++],d=h===1;d&&(a=e[h],o=e[h+1],s=a,l=o);var g=-1;switch(p){case Vr.M:a=s=e[h++],o=l=e[h++];break;case Vr.L:{var m=e[h++],v=e[h++],_=m-a,y=v-o;(Su(_)>i||Su(y)>n||h===t-1)&&(g=Math.sqrt(_*_+y*y),a=m,o=v);break}case Vr.C:{var x=e[h++],M=e[h++],m=e[h++],v=e[h++],S=e[h++],w=e[h++];g=fG(a,o,x,M,m,v,S,w,10),a=S,o=w;break}case Vr.Q:{var x=e[h++],M=e[h++],m=e[h++],v=e[h++];g=pG(a,o,x,M,m,v,10),a=m,o=v;break}case Vr.A:var T=e[h++],C=e[h++],b=e[h++],E=e[h++],I=e[h++],R=e[h++],A=R+I;h+=1,d&&(s=Ap(I)*b+T,l=Cp(I)*E+C),g=fP(b,E)*cP(Mf,Math.abs(R)),a=Ap(A)*b+T,o=Cp(A)*E+C;break;case Vr.R:{s=a=e[h++],l=o=e[h++];var D=e[h++],U=e[h++];g=D*2+U*2;break}case Vr.Z:{var _=s-a,y=l-o;g=Math.sqrt(_*_+y*y),a=s,o=l;break}}g>=0&&(u[f++]=g,c+=g)}return this._pathLen=c,c},r.prototype.rebuildPath=function(e,t){var i=this.data,n=this._ux,a=this._uy,o=this._len,s,l,u,c,f,h,p=t<1,d,g,m=0,v=0,_,y=0,x,M;if(!(p&&(this._pathSegLen||this._calculateLength(),d=this._pathSegLen,g=this._pathLen,_=t*g,!_)))e:for(var S=0;S<o;){var w=i[S++],T=S===1;switch(T&&(u=i[S],c=i[S+1],s=u,l=c),w!==Vr.L&&y>0&&(e.lineTo(x,M),y=0),w){case Vr.M:s=u=i[S++],l=c=i[S++],e.moveTo(u,c);break;case Vr.L:{f=i[S++],h=i[S++];var C=Su(f-u),b=Su(h-c);if(C>n||b>a){if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;e.lineTo(u*(1-I)+f*I,c*(1-I)+h*I);break e}m+=E}e.lineTo(f,h),u=f,c=h,y=0}else{var R=C*C+b*b;R>y&&(x=f,M=h,y=R)}break}case Vr.C:{var A=i[S++],D=i[S++],U=i[S++],B=i[S++],z=i[S++],k=i[S++];if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;jo(u,A,U,z,I,Tp),jo(c,D,B,k,I,Ep),e.bezierCurveTo(Tp[1],Ep[1],Tp[2],Ep[2],Tp[3],Ep[3]);break e}m+=E}e.bezierCurveTo(A,D,U,B,z,k),u=z,c=k;break}case Vr.Q:{var A=i[S++],D=i[S++],U=i[S++],B=i[S++];if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;mf(u,A,U,I,Tp),mf(c,D,B,I,Ep),e.quadraticCurveTo(Tp[1],Ep[1],Tp[2],Ep[2]);break e}m+=E}e.quadraticCurveTo(A,D,U,B),u=U,c=B;break}case Vr.A:var G=i[S++],Y=i[S++],J=i[S++],Q=i[S++],V=i[S++],K=i[S++],ae=i[S++],ve=!i[S++],ue=J>Q?J:Q,se=Su(J-Q)>.001,Ee=V+K,q=!1;if(p){var E=d[v++];m+E>_&&(Ee=V+K*(_-m)/E,q=!0),m+=E}if(se&&e.ellipse?e.ellipse(G,Y,J,Q,ae,V,Ee,ve):e.arc(G,Y,ue,V,Ee,ve),q)break e;T&&(s=Ap(V)*J+G,l=Cp(V)*Q+Y),u=Ap(Ee)*J+G,c=Cp(Ee)*Q+Y;break;case Vr.R:s=u=i[S],l=c=i[S+1],f=i[S++],h=i[S++];var H=i[S++],We=i[S++];if(p){var E=d[v++];if(m+E>_){var _e=_-m;e.moveTo(f,h),e.lineTo(f+cP(_e,H),h),_e-=H,_e>0&&e.lineTo(f+H,h+cP(_e,We)),_e-=We,_e>0&&e.lineTo(f+fP(H-_e,0),h+We),_e-=H,_e>0&&e.lineTo(f,h+fP(We-_e,0));break e}m+=E}e.rect(f,h,H,We);break;case Vr.Z:if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;e.lineTo(u*(1-I)+s*I,c*(1-I)+l*I);break e}m+=E}e.closePath(),u=s,c=l}}},r.prototype.clone=function(){var e=new r,t=this.data;return e.data=t.slice?t.slice():Array.prototype.slice.call(t),e._len=this._len,e},r.CMD=Vr,r.initDefaultProps=function(){var e=r.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),r}(),Ki=Uue;function Nl(r,e,t,i,n,a,o){if(n===0)return!1;var s=n,l=0,u=r;if(o>e+s&&o>i+s||o<e-s&&o<i-s||a>r+s&&a>t+s||a<r-s&&a<t-s)return!1;if(r!==t)l=(e-i)/(r-t),u=(r*i-t*e)/(r-t);else return Math.abs(a-r)<=s/2;var c=l*a-o+u,f=c*c/(l*l+1);return f<=s/2*s/2}function IH(r,e,t,i,n,a,o,s,l,u,c){if(l===0)return!1;var f=l;if(c>e+f&&c>i+f&&c>a+f&&c>s+f||c<e-f&&c<i-f&&c<a-f&&c<s-f||u>r+f&&u>t+f&&u>n+f&&u>o+f||u<r-f&&u<t-f&&u<n-f&&u<o-f)return!1;var h=_b(r,e,t,i,n,a,o,s,u,c,null);return h<=f/2}function Kb(r,e,t,i,n,a,o,s,l){if(o===0)return!1;var u=o;if(l>e+u&&l>i+u&&l>a+u||l<e-u&&l<i-u&&l<a-u||s>r+u&&s>t+u&&s>n+u||s<r-u&&s<t-u&&s<n-u)return!1;var c=Sb(r,e,t,i,n,a,s,l,null);return c<=u/2}var UH=Math.PI*2;function bn(r){return r%=UH,r<0&&(r+=UH),r}var c_=Math.PI*2;function OH(r,e,t,i,n,a,o,s,l){if(o===0)return!1;var u=o;s-=r,l-=e;var c=Math.sqrt(s*s+l*l);if(c-u>t||c+u<t)return!1;if(Math.abs(i-n)%c_<1e-4)return!0;if(a){var f=i;i=bn(n),n=bn(f)}else i=bn(i),n=bn(n);i>n&&(n+=c_);var h=Math.atan2(l,s);return h<0&&(h+=c_),h>=i&&h<=n||h+c_>=i&&h+c_<=n}function Qo(r,e,t,i,n,a){if(a>e&&a>i||a<e&&a<i||i===e)return 0;var o=(a-e)/(i-e),s=i<e?1:-1;(o===1||o===0)&&(s=i<e?.5:-.5);var l=o*(t-r)+r;return l===n?1/0:l>n?s:0}var bf=Ki.CMD,Rp=Math.PI*2,Fue=1e-4;function Bue(r,e){return Math.abs(r-e)<Fue}var la=[-1,-1,-1],es=[-1,-1];function kue(){var r=es[0];es[0]=es[1],es[1]=r}function Vue(r,e,t,i,n,a,o,s,l,u){if(u>e&&u>i&&u>a&&u>s||u<e&&u<i&&u<a&&u<s)return 0;var c=up(e,i,a,s,u,la);if(c===0)return 0;for(var f=0,h=-1,p=void 0,d=void 0,g=0;g<c;g++){var m=la[g],v=m===0||m===1?.5:1,_=hi(r,t,n,o,m);_<l||(h<0&&(h=yb(e,i,a,s,es),es[1]<es[0]&&h>1&&kue(),p=hi(e,i,a,s,es[0]),h>1&&(d=hi(e,i,a,s,es[1]))),h===2?m<es[0]?f+=p<e?v:-v:m<es[1]?f+=d<p?v:-v:f+=s<d?v:-v:m<es[0]?f+=p<e?v:-v:f+=s<p?v:-v)}return f}function Gue(r,e,t,i,n,a,o,s){if(s>e&&s>i&&s>a||s<e&&s<i&&s<a)return 0;var l=hG(e,i,a,s,la);if(l===0)return 0;var u=xb(e,i,a);if(u>=0&&u<=1){for(var c=0,f=vi(e,i,a,u),h=0;h<l;h++){var p=la[h]===0||la[h]===1?.5:1,d=vi(r,t,n,la[h]);d<o||(la[h]<u?c+=f<e?p:-p:c+=a<f?p:-p)}return c}else{var p=la[0]===0||la[0]===1?.5:1,d=vi(r,t,n,la[0]);return d<o?0:a<e?p:-p}}function Hue(r,e,t,i,n,a,o,s){if(s-=e,s>t||s<-t)return 0;var l=Math.sqrt(t*t-s*s);la[0]=-l,la[1]=l;var u=Math.abs(i-n);if(u<1e-4)return 0;if(u>=Rp-1e-4){i=0,n=Rp;var c=a?1:-1;return o>=la[0]+r&&o<=la[1]+r?c:0}if(i>n){var f=i;i=n,n=f}i<0&&(i+=Rp,n+=Rp);for(var h=0,p=0;p<2;p++){var d=la[p];if(d+r>o){var g=Math.atan2(s,d),c=a?1:-1;g<0&&(g=Rp+g),(g>=i&&g<=n||g+Rp>=i&&g+Rp<=n)&&(g>Math.PI/2&&g<Math.PI*1.5&&(c=-c),h+=c)}}return h}function zH(r,e,t,i,n){for(var a=r.data,o=r.len(),s=0,l=0,u=0,c=0,f=0,h,p,d=0;d<o;){var g=a[d++],m=d===1;switch(g===bf.M&&d>1&&(t||(s+=Qo(l,u,c,f,i,n))),m&&(l=a[d],u=a[d+1],c=l,f=u),g){case bf.M:c=a[d++],f=a[d++],l=c,u=f;break;case bf.L:if(t){if(Nl(l,u,a[d],a[d+1],e,i,n))return!0}else s+=Qo(l,u,a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case bf.C:if(t){if(IH(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=Vue(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case bf.Q:if(t){if(Kb(l,u,a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=Gue(l,u,a[d++],a[d++],a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case bf.A:var v=a[d++],_=a[d++],y=a[d++],x=a[d++],M=a[d++],S=a[d++];d+=1;var w=!!(1-a[d++]);h=Math.cos(M)*y+v,p=Math.sin(M)*x+_,m?(c=h,f=p):s+=Qo(l,u,h,p,i,n);var T=(i-v)*x/y+v;if(t){if(OH(v,_,x,M,M+S,w,e,T,n))return!0}else s+=Hue(v,_,x,M,M+S,w,T,n);l=Math.cos(M+S)*y+v,u=Math.sin(M+S)*x+_;break;case bf.R:c=l=a[d++],f=u=a[d++];var C=a[d++],b=a[d++];if(h=c+C,p=f+b,t){if(Nl(c,f,h,f,e,i,n)||Nl(h,f,h,p,e,i,n)||Nl(h,p,c,p,e,i,n)||Nl(c,p,c,f,e,i,n))return!0}else s+=Qo(h,f,h,p,i,n),s+=Qo(c,p,c,f,i,n);break;case bf.Z:if(t){if(Nl(l,u,c,f,e,i,n))return!0}else s+=Qo(l,u,c,f,i,n);l=c,u=f;break}}return!t&&!Bue(u,f)&&(s+=Qo(l,u,c,f,i,n)||0),s!==0}function FH(r,e,t){return zH(r,0,!1,e,t)}function BH(r,e,t,i){return zH(r,e,!0,t,i)}var qm=Ye({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Ll),Xue={style:Ye({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},Mp.style)},mP=go.concat(["invisible","culling","z","z2","zlevel","parent"]),Yue=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.update=function(){var t=this;r.prototype.update.call(this);var i=this.style;if(i.decal){var n=this._decalEl=this._decalEl||new e;n.buildPath===e.prototype.buildPath&&(n.buildPath=function(l){t.buildPath(l,t.shape)}),n.silent=!0;var a=n.style;for(var o in i)a[o]!==i[o]&&(a[o]=i[o]);a.fill=i.fill?i.decal:null,a.decal=null,a.shadowColor=null,i.strokeFirst&&(a.stroke=null);for(var s=0;s<mP.length;++s)n[mP[s]]=this[mP[s]];n.__dirty|=zi}else this._decalEl&&(this._decalEl=null)},e.prototype.getDecalElement=function(){return this._decalEl},e.prototype._init=function(t){var i=bt(t);this.shape=this.getDefaultShape();var n=this.getDefaultStyle();n&&this.useStyle(n);for(var a=0;a<i.length;a++){var o=i[a],s=t[o];o==="style"?this.style?fe(this.style,s):this.useStyle(s):o==="shape"?fe(this.shape,s):r.prototype.attrKV.call(this,o,s)}this.style||this.useStyle({})},e.prototype.getDefaultStyle=function(){return null},e.prototype.getDefaultShape=function(){return{}},e.prototype.canBeInsideText=function(){return this.hasFill()},e.prototype.getInsideTextFill=function(){var t=this.style.fill;if(t!=="none"){if(Ce(t)){var i=Nm(t,0);return i>.5?Q0:i>.2?FG:e_}else if(t)return e_}return Q0},e.prototype.getInsideTextStroke=function(t){var i=this.style.fill;if(Ce(i)){var n=this.__zr,a=!!(n&&n.isDarkMode()),o=Nm(t,0)<$0;if(a===o)return i}},e.prototype.buildPath=function(t,i,n){},e.prototype.pathUpdated=function(){this.__dirty&=~hf},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new Ki(!1)},e.prototype.hasStroke=function(){var t=this.style,i=t.stroke;return!(i==null||i==="none"||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style,i=t.fill;return i!=null&&i!=="none"},e.prototype.getBoundingRect=function(){var t=this._rect,i=this.style,n=!t;if(n){var a=!1;this.path||(a=!0,this.createPathProxy());var o=this.path;(a||this.__dirty&hf)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),t=o.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){s.copy(t);var l=i.strokeNoScale?this.getLineScale():1,u=i.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;u=Math.max(u,c??4)}l>1e-10&&(s.width+=u/l,s.height+=u/l,s.x-=u/l/2,s.y-=u/l/2)}return s}return t},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect(),o=this.style;if(t=n[0],i=n[1],a.contain(t,i)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,u=o.strokeNoScale?this.getLineScale():1;if(u>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),BH(s,l/u,t,i)))return!0}if(this.hasFill())return FH(s,t,i)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=hf,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){t==="style"?this.dirtyStyle():t==="shape"?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(t,i){t==="shape"?this.setShape(i):r.prototype.attrKV.call(this,t,i)},e.prototype.setShape=function(t,i){var n=this.shape;return n||(n=this.shape={}),typeof t=="string"?n[t]=i:fe(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&hf)},e.prototype.createStyle=function(t){return cf(qm,t)},e.prototype._innerSaveToNormal=function(t){r.prototype._innerSaveToNormal.call(this,t);var i=this._normalState;t.shape&&!i.shape&&(i.shape=fe({},this.shape))},e.prototype._applyStateObj=function(t,i,n,a,o,s){r.prototype._applyStateObj.call(this,t,i,n,a,o,s);var l=!(i&&a),u;if(i&&i.shape?o?a?u=i.shape:(u=fe({},n.shape),fe(u,i.shape)):(u=fe({},a?this.shape:n.shape),fe(u,i.shape)):l&&(u=n.shape),u)if(o){this.shape=fe({},this.shape);for(var c={},f=bt(u),h=0;h<f.length;h++){var p=f[h];typeof u[p]=="object"?this.shape[p]=u[p]:c[p]=u[p]}this._transitionState(t,{shape:c},s)}else this.shape=u,this.dirtyShape()},e.prototype._mergeStates=function(t){for(var i=r.prototype._mergeStates.call(this,t),n,a=0;a<t.length;a++){var o=t[a];o.shape&&(n=n||{},this._mergeStyle(n,o.shape))}return n&&(i.shape=n),i},e.prototype.getAnimationStyleProps=function(){return Xue},e.prototype.isZeroArea=function(){return!1},e.extend=function(t){var i=function(a){Xt(o,a);function o(s){var l=a.call(this,s)||this;return t.init&&t.init.call(l,s),l}return o.prototype.getDefaultStyle=function(){return Qe(t.style)},o.prototype.getDefaultShape=function(){return Qe(t.shape)},o}(e);for(var n in t)typeof t[n]=="function"&&(i.prototype[n]=t[n]);return i},e.initDefaultProps=function(){var t=e.prototype;t.type="path",t.strokeContainThreshold=5,t.segmentIgnoreThreshold=0,t.subPixelOptimize=!1,t.autoBatch=!1,t.__dirty=zi|lp|hf}(),e}(gi),ut=Yue;var que=Ye({strokeFirst:!0,font:ho,x:0,y:0,textAlign:"left",textBaseline:"top",miterLimit:2},qm),kH=function(r){Xt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.hasStroke=function(){var t=this.style,i=t.stroke;return i!=null&&i!=="none"&&t.lineWidth>0},e.prototype.hasFill=function(){var t=this.style,i=t.fill;return i!=null&&i!=="none"},e.prototype.createStyle=function(t){return cf(que,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var i=t.text;i!=null?i+="":i="";var n=Rl(i,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var a=t.lineWidth;n.x-=a/2,n.y-=a/2,n.width+=a,n.height+=a}this._rect=n}return this._rect},e.initDefaultProps=function(){var t=e.prototype;t.dirtyRectTolerance=10}(),e}(gi);kH.prototype.type="tspan";var Mu=kH;var Zue=Ye({x:0,y:0},Ll),jue={style:Ye({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},Mp.style)};function Kue(r){return!!(r&&typeof r!="string"&&r.width&&r.height)}var VH=function(r){Xt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.createStyle=function(t){return cf(Zue,t)},e.prototype._getSize=function(t){var i=this.style,n=i[t];if(n!=null)return n;var a=Kue(i.image)?i.image:this.__image;if(!a)return 0;var o=t==="width"?"height":"width",s=i[o];return s==null?a[t]:a[t]/a[o]*s},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return jue},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new lt(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(gi);VH.prototype.type="image";var Ur=VH;function GH(r,e){var t=e.x,i=e.y,n=e.width,a=e.height,o=e.r,s,l,u,c;n<0&&(t=t+n,n=-n),a<0&&(i=i+a,a=-a),typeof o=="number"?s=l=u=c=o:o instanceof Array?o.length===1?s=l=u=c=o[0]:o.length===2?(s=u=o[0],l=c=o[1]):o.length===3?(s=o[0],l=c=o[1],u=o[2]):(s=o[0],l=o[1],u=o[2],c=o[3]):s=l=u=c=0;var f;s+l>n&&(f=s+l,s*=n/f,l*=n/f),u+c>n&&(f=u+c,u*=n/f,c*=n/f),l+u>a&&(f=l+u,l*=a/f,u*=a/f),s+c>a&&(f=s+c,s*=a/f,c*=a/f),r.moveTo(t+s,i),r.lineTo(t+n-l,i),l!==0&&r.arc(t+n-l,i+l,l,-Math.PI/2,0),r.lineTo(t+n,i+a-u),u!==0&&r.arc(t+n-u,i+a-u,u,0,Math.PI/2),r.lineTo(t+c,i+a),c!==0&&r.arc(t+c,i+a-c,c,Math.PI/2,Math.PI),r.lineTo(t,i+s),s!==0&&r.arc(t+s,i+s,s,Math.PI,Math.PI*1.5)}var Zm=Math.round;function Jb(r,e,t){if(e){var i=e.x1,n=e.x2,a=e.y1,o=e.y2;r.x1=i,r.x2=n,r.y1=a,r.y2=o;var s=t&&t.lineWidth;return s&&(Zm(i*2)===Zm(n*2)&&(r.x1=r.x2=wf(i,s,!0)),Zm(a*2)===Zm(o*2)&&(r.y1=r.y2=wf(a,s,!0))),r}}function $b(r,e,t){if(e){var i=e.x,n=e.y,a=e.width,o=e.height;r.x=i,r.y=n,r.width=a,r.height=o;var s=t&&t.lineWidth;return s&&(r.x=wf(i,s,!0),r.y=wf(n,s,!0),r.width=Math.max(wf(i+a,s,!1)-r.x,a===0?0:1),r.height=Math.max(wf(n+o,s,!1)-r.y,o===0?0:1)),r}}function wf(r,e,t){if(!e)return r;var i=Zm(r*2);return(i+Zm(e))%2===0?i/2:(i+(t?1:-1))/2}var Que=function(){function r(){this.x=0,this.y=0,this.width=0,this.height=0}return r}();var ece={},HH=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Que},e.prototype.buildPath=function(t,i){var n,a,o,s;if(this.subPixelOptimize){var l=$b(ece,i,this.style);n=l.x,a=l.y,o=l.width,s=l.height,l.r=i.r,i=l}else n=i.x,a=i.y,o=i.width,s=i.height;i.r?GH(t,i):t.rect(n,a,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(ut);HH.prototype.type="rect";var Et=HH;var WH={fill:"#000"},XH=2,tce={style:Ye({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},Mp.style)},QH=function(r){Xt(e,r);function e(t){var i=r.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=WH,i.attr(t),i}return e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){r.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;t<this._children.length;t++){var i=this._children[t];i.zlevel=this.zlevel,i.z=this.z,i.z2=this.z2,i.culling=this.culling,i.cursor=this.cursor,i.invisible=this.invisible}},e.prototype.updateTransform=function(){var t=this.innerTransformable;t?(t.updateTransform(),t.transform&&(this.transform=t.transform)):r.prototype.updateTransform.call(this)},e.prototype.getLocalTransform=function(t){var i=this.innerTransformable;return i?i.getLocalTransform(t):r.prototype.getLocalTransform.call(this,t)},e.prototype.getComputedTransform=function(){return this.__hostTarget&&(this.__hostTarget.getComputedTransform(),this.__hostTarget.updateInnerText(!0)),r.prototype.getComputedTransform.call(this)},e.prototype._updateSubTexts=function(){this._childCursor=0,nce(this.style),this.style.rich?this._updateRichTexts():this._updatePlainTexts(),this._children.length=this._childCursor,this.styleUpdated()},e.prototype.addSelfToZr=function(t){r.prototype.addSelfToZr.call(this,t);for(var i=0;i<this._children.length;i++)this._children[i].__zr=t},e.prototype.removeSelfFromZr=function(t){r.prototype.removeSelfFromZr.call(this,t);for(var i=0;i<this._children.length;i++)this._children[i].__zr=null},e.prototype.getBoundingRect=function(){if(this.styleChanged()&&this._updateSubTexts(),!this._rect){for(var t=new lt(0,0,0,0),i=this._children,n=[],a=null,o=0;o<i.length;o++){var s=i[o],l=s.getBoundingRect(),u=s.getLocalTransform(n);u?(t.copy(l),t.applyTransform(u),a=a||t.clone(),a.union(t)):(a=a||l.clone(),a.union(l))}this._rect=a||t}return this._rect},e.prototype.setDefaultTextStyle=function(t){this._defaultStyle=t||WH},e.prototype.setTextContent=function(t){},e.prototype._mergeStyle=function(t,i){if(!i)return t;var n=i.rich,a=t.rich||n&&{};return fe(t,i),n&&a?(this._mergeRich(a,n),t.rich=a):a&&(t.rich=a),t},e.prototype._mergeRich=function(t,i){for(var n=bt(i),a=0;a<n.length;a++){var o=n[a];t[o]=t[o]||{},fe(t[o],i[o])}},e.prototype.getAnimationStyleProps=function(){return tce},e.prototype._getOrCreateChild=function(t){var i=this._children[this._childCursor];return(!i||!(i instanceof t))&&(i=new t),this._children[this._childCursor++]=i,i.__zr=this.__zr,i.parent=this,i},e.prototype._updatePlainTexts=function(){var t=this.style,i=t.font||ho,n=t.padding,a=$H(t),o=MH(a,t),s=vP(t),l=!!t.backgroundColor,u=o.outerHeight,c=o.outerWidth,f=o.contentWidth,h=o.lines,p=o.lineHeight,d=this._defaultStyle,g=t.x||0,m=t.y||0,v=t.align||d.align||"left",_=t.verticalAlign||d.verticalAlign||"top",y=g,x=yp(m,o.contentHeight,_);if(s||n){var M=Om(g,c,v),S=yp(m,u,_);s&&this._renderBackground(t,t,M,S,c,u)}x+=p/2,n&&(y=JH(g,v,n),_==="top"?x+=n[0]:_==="bottom"&&(x-=n[2]));for(var w=0,T=!1,C=KH("fill"in t?t.fill:(T=!0,d.fill)),b=jH("stroke"in t?t.stroke:!l&&(!d.autoStroke||T)?(w=XH,d.stroke):null),E=t.textShadowBlur>0,I=t.width!=null&&(t.overflow==="truncate"||t.overflow==="break"||t.overflow==="breakAll"),R=o.calculatedLineHeight,A=0;A<h.length;A++){var D=this._getOrCreateChild(Mu),U=D.createStyle();D.useStyle(U),U.text=h[A],U.x=y,U.y=x,v&&(U.textAlign=v),U.textBaseline="middle",U.opacity=t.opacity,U.strokeFirst=!0,E&&(U.shadowBlur=t.textShadowBlur||0,U.shadowColor=t.textShadowColor||"transparent",U.shadowOffsetX=t.textShadowOffsetX||0,U.shadowOffsetY=t.textShadowOffsetY||0),U.stroke=b,U.fill=C,b&&(U.lineWidth=t.lineWidth||w,U.lineDash=t.lineDash,U.lineDashOffset=t.lineDashOffset||0),U.font=i,qH(U,t),x+=p,I&&D.setBoundingRect(new lt(Om(U.x,t.width,U.textAlign),yp(U.y,R,U.textBaseline),f,R))}},e.prototype._updateRichTexts=function(){var t=this.style,i=$H(t),n=bH(i,t),a=n.width,o=n.outerWidth,s=n.outerHeight,l=t.padding,u=t.x||0,c=t.y||0,f=this._defaultStyle,h=t.align||f.align,p=t.verticalAlign||f.verticalAlign,d=Om(u,o,h),g=yp(c,s,p),m=d,v=g;l&&(m+=l[3],v+=l[0]);var _=m+a;vP(t)&&this._renderBackground(t,t,d,g,o,s);for(var y=!!t.backgroundColor,x=0;x<n.lines.length;x++){for(var M=n.lines[x],S=M.tokens,w=S.length,T=M.lineHeight,C=M.width,b=0,E=m,I=_,R=w-1,A=void 0;b<w&&(A=S[b],!A.align||A.align==="left");)this._placeToken(A,t,T,v,E,"left",y),C-=A.width,E+=A.width,b++;for(;R>=0&&(A=S[R],A.align==="right");)this._placeToken(A,t,T,v,I,"right",y),C-=A.width,I-=A.width,R--;for(E+=(a-(E-m)-(_-I)-C)/2;b<=R;)A=S[b],this._placeToken(A,t,T,v,E+A.width/2,"center",y),E+=A.width,b++;v+=T}},e.prototype._placeToken=function(t,i,n,a,o,s,l){var u=i.rich[t.styleName]||{};u.text=t.text;var c=t.verticalAlign,f=a+n/2;c==="top"?f=a+t.height/2:c==="bottom"&&(f=a+n-t.height/2);var h=!t.isLineHolder&&vP(u);h&&this._renderBackground(u,i,s==="right"?o-t.width:s==="center"?o-t.width/2:o,f-t.height/2,t.width,t.height);var p=!!u.backgroundColor,d=t.textPadding;d&&(o=JH(o,s,d),f-=t.height/2-d[0]-t.innerHeight/2);var g=this._getOrCreateChild(Mu),m=g.createStyle();g.useStyle(m);var v=this._defaultStyle,_=!1,y=0,x=KH("fill"in u?u.fill:"fill"in i?i.fill:(_=!0,v.fill)),M=jH("stroke"in u?u.stroke:"stroke"in i?i.stroke:!p&&!l&&(!v.autoStroke||_)?(y=XH,v.stroke):null),S=u.textShadowBlur>0||i.textShadowBlur>0;m.text=t.text,m.x=o,m.y=f,S&&(m.shadowBlur=u.textShadowBlur||i.textShadowBlur||0,m.shadowColor=u.textShadowColor||i.textShadowColor||"transparent",m.shadowOffsetX=u.textShadowOffsetX||i.textShadowOffsetX||0,m.shadowOffsetY=u.textShadowOffsetY||i.textShadowOffsetY||0),m.textAlign=s,m.textBaseline="middle",m.font=t.font||ho,m.opacity=Xi(u.opacity,i.opacity,1),qH(m,u),M&&(m.lineWidth=Xi(u.lineWidth,i.lineWidth,y),m.lineDash=ft(u.lineDash,i.lineDash),m.lineDashOffset=i.lineDashOffset||0,m.stroke=M),x&&(m.fill=x);var w=t.contentWidth,T=t.contentHeight;g.setBoundingRect(new lt(Om(m.x,w,m.textAlign),yp(m.y,T,m.textBaseline),w,T))},e.prototype._renderBackground=function(t,i,n,a,o,s){var l=t.backgroundColor,u=t.borderWidth,c=t.borderColor,f=l&&l.image,h=l&&!f,p=t.borderRadius,d=this,g,m;if(h||t.lineHeight||u&&c){g=this._getOrCreateChild(Et),g.useStyle(g.createStyle()),g.style.fill=null;var v=g.shape;v.x=n,v.y=a,v.width=o,v.height=s,v.r=p,g.dirtyShape()}if(h){var _=g.style;_.fill=l||null,_.fillOpacity=ft(t.fillOpacity,1)}else if(f){m=this._getOrCreateChild(Ur),m.onload=function(){d.dirtyStyle()};var y=m.style;y.image=l.image,y.x=n,y.y=a,y.width=o,y.height=s}if(u&&c){var _=g.style;_.lineWidth=u,_.stroke=c,_.strokeOpacity=ft(t.strokeOpacity,1),_.lineDash=t.borderDash,_.lineDashOffset=t.borderDashOffset||0,g.strokeContainThreshold=0,g.hasFill()&&g.hasStroke()&&(_.strokeFirst=!0,_.lineWidth*=2)}var x=(g||m).style;x.shadowBlur=t.shadowBlur||0,x.shadowColor=t.shadowColor||"transparent",x.shadowOffsetX=t.shadowOffsetX||0,x.shadowOffsetY=t.shadowOffsetY||0,x.opacity=Xi(t.opacity,i.opacity,1)},e.makeFont=function(t){var i="";return yP(t)&&(i=[t.fontStyle,t.fontWeight,gP(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),i&&Yi(i)||t.textFont||t.font},e}(gi),rce={left:!0,right:1,center:1},ice={top:1,bottom:1,middle:1},YH=["fontStyle","fontWeight","fontSize","fontFamily"];function gP(r){return typeof r=="string"&&(r.indexOf("px")!==-1||r.indexOf("rem")!==-1||r.indexOf("em")!==-1)?r:isNaN(+r)?eb+"px":r+"px"}function qH(r,e){for(var t=0;t<YH.length;t++){var i=YH[t],n=e[i];n!=null&&(r[i]=n)}}function yP(r){return r.fontSize!=null||r.fontFamily||r.fontWeight}function nce(r){return ZH(r),N(r.rich,ZH),r}function ZH(r){if(r){r.font=QH.makeFont(r);var e=r.align;e==="middle"&&(e="center"),r.align=e==null||rce[e]?e:"left";var t=r.verticalAlign;t==="center"&&(t="middle"),r.verticalAlign=t==null||ice[t]?t:"top";var i=r.padding;i&&(r.padding=wm(r.padding))}}function jH(r,e){return r==null||e<=0||r==="transparent"||r==="none"?null:r.image||r.colorStops?"#000":r}function KH(r){return r==null||r==="none"?null:r.image||r.colorStops?"#000":r}function JH(r,e,t){return e==="right"?r-t[1]:e==="center"?r+t[3]/2-t[1]/2:r+t[3]}function $H(r){var e=r.text;return e!=null&&(e+=""),e}function vP(r){return!!(r.backgroundColor||r.lineHeight||r.borderWidth&&r.borderColor)}var Lt=QH;var rt=vt(),f_=function(r,e,t,i){if(i){var n=rt(i);n.dataIndex=t,n.dataType=e,n.seriesIndex=r,n.ssrType="chart",i.type==="group"&&i.traverse(function(a){var o=rt(a);o.seriesIndex=r,o.dataIndex=t,o.dataType=e,o.ssrType="chart"})}};var e4=1,t4={},o4=vt(),SP=vt(),MP=0,Lp=1,h_=2,Fi=["emphasis","blur","select"],Tf=["normal","emphasis","blur","select"],bu=10,ace=9,Ef="highlight",p_="downplay",Km="select",d_="unselect",Jm="toggleSelect";function jm(r){return r!=null&&r!=="none"}function ew(r,e,t){r.onHoverStateChange&&(r.hoverState||0)!==t&&r.onHoverStateChange(e),r.hoverState=t}function s4(r){ew(r,"emphasis",h_)}function l4(r){r.hoverState===h_&&ew(r,"normal",MP)}function bP(r){ew(r,"blur",Lp)}function u4(r){r.hoverState===Lp&&ew(r,"normal",MP)}function oce(r){r.selected=!0}function sce(r){r.selected=!1}function r4(r,e,t){e(r,t)}function wu(r,e,t){r4(r,e,t),r.isGroup&&r.traverse(function(i){r4(i,e,t)})}function Pp(r,e){switch(e){case"emphasis":r.hoverState=h_;break;case"normal":r.hoverState=MP;break;case"blur":r.hoverState=Lp;break;case"select":r.selected=!0}}function lce(r,e,t,i){for(var n=r.style,a={},o=0;o<e.length;o++){var s=e[o],l=n[s];a[s]=l??(i&&i[s])}for(var o=0;o<r.animators.length;o++){var u=r.animators[o];u.__fromStateTransition&&u.__fromStateTransition.indexOf(t)<0&&u.targetName==="style"&&u.saveTo(a,e)}return a}function uce(r,e,t,i){var n=t&&dt(t,"select")>=0,a=!1;if(r instanceof ut){var o=o4(r),s=n&&o.selectFill||o.normalFill,l=n&&o.selectStroke||o.normalStroke;if(jm(s)||jm(l)){i=i||{};var u=i.style||{};u.fill==="inherit"?(a=!0,i=fe({},i),u=fe({},u),u.fill=s):!jm(u.fill)&&jm(s)?(a=!0,i=fe({},i),u=fe({},u),u.fill=Y0(s)):!jm(u.stroke)&&jm(l)&&(a||(i=fe({},i),u=fe({},u)),u.stroke=Y0(l)),i.style=u}}if(i&&i.z2==null){a||(i=fe({},i));var c=r.z2EmphasisLift;i.z2=r.z2+(c??bu)}return i}function cce(r,e,t){if(t&&t.z2==null){t=fe({},t);var i=r.z2SelectLift;t.z2=r.z2+(i??ace)}return t}function fce(r,e,t){var i=dt(r.currentStates,e)>=0,n=r.style.opacity,a=i?null:lce(r,["opacity"],e,{opacity:1});t=t||{};var o=t.style||{};return o.opacity==null&&(t=fe({},t),o=fe({opacity:i?n:a.opacity*.1},o),t.style=o),t}function _P(r,e){var t=this.states[r];if(this.style){if(r==="emphasis")return uce(this,r,e,t);if(r==="blur")return fce(this,r,t);if(r==="select")return cce(this,r,t)}return t}function Fs(r){r.stateProxy=_P;var e=r.getTextContent(),t=r.getTextGuideLine();e&&(e.stateProxy=_P),t&&(t.stateProxy=_P)}function i4(r,e){!c4(r,e)&&!r.__highByOuter&&wu(r,s4)}function n4(r,e){!c4(r,e)&&!r.__highByOuter&&wu(r,l4)}function Bn(r,e){r.__highByOuter|=1<<(e||0),wu(r,s4)}function kn(r,e){!(r.__highByOuter&=~(1<<(e||0)))&&wu(r,l4)}function tw(r){wu(r,bP)}function m_(r){wu(r,u4)}function wP(r){wu(r,oce)}function TP(r){wu(r,sce)}function c4(r,e){return r.__highDownSilentOnTouch&&e.zrByTouch}function EP(r){var e=r.getModel(),t=[],i=[];e.eachComponent(function(n,a){var o=SP(a),s=n==="series",l=s?r.getViewOfSeriesModel(a):r.getViewOfComponentModel(a);!s&&i.push(l),o.isBlured&&(l.group.traverse(function(u){u4(u)}),s&&t.push(a)),o.isBlured=!1}),N(i,function(n){n&&n.toggleBlurSeries&&n.toggleBlurSeries(t,!1,e)})}function xP(r,e,t,i){var n=i.getModel();t=t||"coordinateSystem";function a(u,c){for(var f=0;f<c.length;f++){var h=u.getItemGraphicEl(c[f]);h&&m_(h)}}if(r!=null&&!(!e||e==="none")){var o=n.getSeriesByIndex(r),s=o.coordinateSystem;s&&s.master&&(s=s.master);var l=[];n.eachSeries(function(u){var c=o===u,f=u.coordinateSystem;f&&f.master&&(f=f.master);var h=f&&s?f===s:c;if(!(t==="series"&&!c||t==="coordinateSystem"&&!h||e==="series"&&c)){var p=i.getViewOfSeriesModel(u);if(p.group.traverse(function(m){m.__highByOuter&&c&&e==="self"||bP(m)}),ci(e))a(u.getData(),e);else if(qe(e))for(var d=bt(e),g=0;g<d.length;g++)a(u.getData(d[g]),e[d[g]]);l.push(u),SP(u).isBlured=!0}}),n.eachComponent(function(u,c){if(u!=="series"){var f=i.getViewOfComponentModel(c);f&&f.toggleBlurSeries&&f.toggleBlurSeries(l,!0,n)}})}}function Qb(r,e,t){if(!(r==null||e==null)){var i=t.getModel().getComponent(r,e);if(i){SP(i).isBlured=!0;var n=t.getViewOfComponentModel(i);!n||!n.focusBlurEnabled||n.group.traverse(function(a){bP(a)})}}}function f4(r,e,t){var i=r.seriesIndex,n=r.getData(e.dataType);if(n){var a=$o(n,e);a=(pe(a)?a[0]:a)||0;var o=n.getItemGraphicEl(a);if(!o)for(var s=n.count(),l=0;!o&&l<s;)o=n.getItemGraphicEl(l++);if(o){var u=rt(o);xP(i,u.focus,u.blurScope,t)}else{var c=r.get(["emphasis","focus"]),f=r.get(["emphasis","blurScope"]);c!=null&&xP(i,c,f,t)}}}function rw(r,e,t,i){var n={focusSelf:!1,dispatchers:null};if(r==null||r==="series"||e==null||t==null)return n;var a=i.getModel().getComponent(r,e);if(!a)return n;var o=i.getViewOfComponentModel(a);if(!o||!o.findHighDownDispatchers)return n;for(var s=o.findHighDownDispatchers(t),l,u=0;u<s.length;u++)if(rt(s[u]).focus==="self"){l=!0;break}return{focusSelf:l,dispatchers:s}}function h4(r,e,t){var i=rt(r),n=rw(i.componentMainType,i.componentIndex,i.componentHighDownName,t),a=n.dispatchers,o=n.focusSelf;a?(o&&Qb(i.componentMainType,i.componentIndex,t),N(a,function(s){return i4(s,e)})):(xP(i.seriesIndex,i.focus,i.blurScope,t),i.focus==="self"&&Qb(i.componentMainType,i.componentIndex,t),i4(r,e))}function p4(r,e,t){EP(t);var i=rt(r),n=rw(i.componentMainType,i.componentIndex,i.componentHighDownName,t).dispatchers;n?N(n,function(a){return n4(a,e)}):n4(r,e)}function d4(r,e,t){if(nw(e)){var i=e.dataType,n=r.getData(i),a=$o(n,e);pe(a)||(a=[a]),r[e.type===Jm?"toggleSelect":e.type===Km?"select":"unselect"](a,i)}}function AP(r){var e=r.getAllData();N(e,function(t){var i=t.data,n=t.type;i.eachItemGraphicEl(function(a,o){r.isSelected(o,n)?wP(a):TP(a)})})}function m4(r){var e=[];return r.eachSeries(function(t){var i=t.getAllData();N(i,function(n){var a=n.data,o=n.type,s=t.getSelectedDataIndices();if(s.length>0){var l={dataIndex:s,seriesIndex:t.seriesIndex};o!=null&&(l.dataType=o),e.push(l)}})}),e}function Ul(r,e,t){Tu(r,!0),wu(r,Fs),iw(r,e,t)}function hce(r){Tu(r,!1)}function ar(r,e,t,i){i?hce(r):Ul(r,e,t)}function iw(r,e,t){var i=rt(r);e!=null?(i.focus=e,i.blurScope=t):i.focus&&(i.focus=null)}var a4=["emphasis","blur","select"],pce={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Gr(r,e,t,i){t=t||"itemStyle";for(var n=0;n<a4.length;n++){var a=a4[n],o=e.getModel([a,t]),s=r.ensureState(a);s.style=i?i(o):o[pce[t]]()}}function Tu(r,e){var t=e===!1,i=r;r.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=r.highDownSilentOnTouch),(!t||i.__highDownDispatcher)&&(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!t)}function Af(r){return!!(r&&r.__highDownDispatcher)}function v4(r,e,t){var i=rt(r);i.componentMainType=e.mainType,i.componentIndex=e.componentIndex,i.componentHighDownName=t}function g4(r){var e=t4[r];return e==null&&e4<=32&&(e=t4[r]=e4++),e}function nw(r){var e=r.type;return e===Km||e===d_||e===Jm}function CP(r){var e=r.type;return e===Ef||e===p_}function y4(r){var e=o4(r);e.normalFill=r.style.fill,e.normalStroke=r.style.stroke;var t=r.states.select||{};e.selectFill=t.style&&t.style.fill||null,e.selectStroke=t.style&&t.style.stroke||null}var Rt={};qR(Rt,{Arc:()=>x_,BezierCurve:()=>Np,BoundingRect:()=>lt,Circle:()=>ua,CompoundPath:()=>tv,Ellipse:()=>g_,Group:()=>Ze,Image:()=>Ur,IncrementalDisplayable:()=>G4,Line:()=>Jr,LinearGradient:()=>zl,OrientedBoundingRect:()=>rv,Path:()=>ut,Point:()=>Nt,Polygon:()=>ti,Polyline:()=>Qr,RadialGradient:()=>hw,Rect:()=>Et,Ring:()=>Ip,Sector:()=>yi,Text:()=>Lt,applyTransform:()=>wn,clipPointsByRect:()=>zP,clipRectByRect:()=>Yce,createIcon:()=>Lu,extendPath:()=>Hce,extendShape:()=>Vce,getShapeClass:()=>S_,getTransform:()=>Vs,groupTransition:()=>Ru,initProps:()=>or,isElementRemoved:()=>Eu,lineLineIntersect:()=>K4,linePolygonIntersect:()=>nv,makeImage:()=>OP,makePath:()=>iv,mergePath:()=>Gn,registerShape:()=>ks,removeElement:()=>ts,removeElementWithFadeOut:()=>Au,resizePath:()=>j4,setTooltipConfig:()=>Gs,subPixelOptimize:()=>M_,subPixelOptimizeLine:()=>Cu,subPixelOptimizeRect:()=>Wce,transformDirection:()=>zp,traverseElements:()=>ca,updateProps:()=>Dt});var $m=Ki.CMD,dce=[[],[],[]],_4=Math.sqrt,mce=Math.atan2;function aw(r,e){if(e){var t=r.data,i=r.len(),n,a,o,s,l,u,c=$m.M,f=$m.C,h=$m.L,p=$m.R,d=$m.A,g=$m.Q;for(o=0,s=0;o<i;){switch(n=t[o++],s=o,a=0,n){case c:a=1;break;case h:a=1;break;case f:a=3;break;case g:a=2;break;case d:var m=e[4],v=e[5],_=_4(e[0]*e[0]+e[1]*e[1]),y=_4(e[2]*e[2]+e[3]*e[3]),x=mce(-e[1]/y,e[0]/_);t[o]*=_,t[o++]+=m,t[o]*=y,t[o++]+=v,t[o++]*=_,t[o++]*=y,t[o++]+=x,t[o++]+=x,o+=2,s=o;break;case p:u[0]=t[o++],u[1]=t[o++],fi(u,u,e),t[s++]=u[0],t[s++]=u[1],u[0]+=t[o++],u[1]+=t[o++],fi(u,u,e),t[s++]=u[0],t[s++]=u[1]}for(l=0;l<a;l++){var M=dce[l];M[0]=t[o++],M[1]=t[o++],fi(M,M,e),t[s++]=M[0],t[s++]=M[1]}}r.increaseVersion()}}var RP=Math.sqrt,ow=Math.sin,sw=Math.cos,v_=Math.PI;function x4(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function LP(r,e){return(r[0]*e[0]+r[1]*e[1])/(x4(r)*x4(e))}function S4(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(LP(r,e))}function M4(r,e,t,i,n,a,o,s,l,u,c){var f=l*(v_/180),h=sw(f)*(r-t)/2+ow(f)*(e-i)/2,p=-1*ow(f)*(r-t)/2+sw(f)*(e-i)/2,d=h*h/(o*o)+p*p/(s*s);d>1&&(o*=RP(d),s*=RP(d));var g=(n===a?-1:1)*RP((o*o*(s*s)-o*o*(p*p)-s*s*(h*h))/(o*o*(p*p)+s*s*(h*h)))||0,m=g*o*p/s,v=g*-s*h/o,_=(r+t)/2+sw(f)*m-ow(f)*v,y=(e+i)/2+ow(f)*m+sw(f)*v,x=S4([1,0],[(h-m)/o,(p-v)/s]),M=[(h-m)/o,(p-v)/s],S=[(-1*h-m)/o,(-1*p-v)/s],w=S4(M,S);if(LP(M,S)<=-1&&(w=v_),LP(M,S)>=1&&(w=0),w<0){var T=Math.round(w/v_*1e6)/1e6;w=v_*2+T%2*v_}c.addData(u,_,y,o,s,x,w,f,a)}var vce=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,gce=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function yce(r){var e=new Ki;if(!r)return e;var t=0,i=0,n=t,a=i,o,s=Ki.CMD,l=r.match(vce);if(!l)return e;for(var u=0;u<l.length;u++){for(var c=l[u],f=c.charAt(0),h=void 0,p=c.match(gce)||[],d=p.length,g=0;g<d;g++)p[g]=parseFloat(p[g]);for(var m=0;m<d;){var v=void 0,_=void 0,y=void 0,x=void 0,M=void 0,S=void 0,w=void 0,T=t,C=i,b=void 0,E=void 0;switch(f){case"l":t+=p[m++],i+=p[m++],h=s.L,e.addData(h,t,i);break;case"L":t=p[m++],i=p[m++],h=s.L,e.addData(h,t,i);break;case"m":t+=p[m++],i+=p[m++],h=s.M,e.addData(h,t,i),n=t,a=i,f="l";break;case"M":t=p[m++],i=p[m++],h=s.M,e.addData(h,t,i),n=t,a=i,f="L";break;case"h":t+=p[m++],h=s.L,e.addData(h,t,i);break;case"H":t=p[m++],h=s.L,e.addData(h,t,i);break;case"v":i+=p[m++],h=s.L,e.addData(h,t,i);break;case"V":i=p[m++],h=s.L,e.addData(h,t,i);break;case"C":h=s.C,e.addData(h,p[m++],p[m++],p[m++],p[m++],p[m++],p[m++]),t=p[m-2],i=p[m-1];break;case"c":h=s.C,e.addData(h,p[m++]+t,p[m++]+i,p[m++]+t,p[m++]+i,p[m++]+t,p[m++]+i),t+=p[m-2],i+=p[m-1];break;case"S":v=t,_=i,b=e.len(),E=e.data,o===s.C&&(v+=t-E[b-4],_+=i-E[b-3]),h=s.C,T=p[m++],C=p[m++],t=p[m++],i=p[m++],e.addData(h,v,_,T,C,t,i);break;case"s":v=t,_=i,b=e.len(),E=e.data,o===s.C&&(v+=t-E[b-4],_+=i-E[b-3]),h=s.C,T=t+p[m++],C=i+p[m++],t+=p[m++],i+=p[m++],e.addData(h,v,_,T,C,t,i);break;case"Q":T=p[m++],C=p[m++],t=p[m++],i=p[m++],h=s.Q,e.addData(h,T,C,t,i);break;case"q":T=p[m++]+t,C=p[m++]+i,t+=p[m++],i+=p[m++],h=s.Q,e.addData(h,T,C,t,i);break;case"T":v=t,_=i,b=e.len(),E=e.data,o===s.Q&&(v+=t-E[b-4],_+=i-E[b-3]),t=p[m++],i=p[m++],h=s.Q,e.addData(h,v,_,t,i);break;case"t":v=t,_=i,b=e.len(),E=e.data,o===s.Q&&(v+=t-E[b-4],_+=i-E[b-3]),t+=p[m++],i+=p[m++],h=s.Q,e.addData(h,v,_,t,i);break;case"A":y=p[m++],x=p[m++],M=p[m++],S=p[m++],w=p[m++],T=t,C=i,t=p[m++],i=p[m++],h=s.A,M4(T,C,t,i,S,w,y,x,M,h,e);break;case"a":y=p[m++],x=p[m++],M=p[m++],S=p[m++],w=p[m++],T=t,C=i,t+=p[m++],i+=p[m++],h=s.A,M4(T,C,t,i,S,w,y,x,M,h,e);break}}(f==="z"||f==="Z")&&(h=s.Z,e.addData(h),t=n,i=a),o=h}return e.toStatic(),e}var b4=function(r){Xt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.applyTransform=function(t){},e}(ut);function w4(r){return r.setData!=null}function T4(r,e){var t=yce(r),i=fe({},e);return i.buildPath=function(n){if(w4(n)){n.setData(t.data);var a=n.getContext();a&&n.rebuildPath(a,1)}else{var a=n;t.rebuildPath(a,1)}},i.applyTransform=function(n){aw(t,n),this.dirtyShape()},i}function lw(r,e){return new b4(T4(r,e))}function E4(r,e){var t=T4(r,e),i=function(n){Xt(a,n);function a(o){var s=n.call(this,o)||this;return s.applyTransform=t.applyTransform,s.buildPath=t.buildPath,s}return a}(b4);return i}function A4(r,e){for(var t=[],i=r.length,n=0;n<i;n++){var a=r[n];t.push(a.getUpdatedPathProxy(!0))}var o=new ut(e);return o.createPathProxy(),o.buildPath=function(s){if(w4(s)){s.appendPath(t);var l=s.getContext();l&&s.rebuildPath(l,1)}},o}function Qm(r,e){e=e||{};var t=new ut;return r.shape&&t.setShape(r.shape),t.setStyle(r.style),e.bakeTransform?aw(t.path,r.getComputedTransform()):e.toLocal?t.setLocalTransform(r.getComputedTransform()):t.copyTransform(r),t.buildPath=r.buildPath,t.applyTransform=t.applyTransform,t.z=r.z,t.z2=r.z2,t.zlevel=r.zlevel,t}var xce=function(){function r(){this.cx=0,this.cy=0,this.r=0}return r}();var C4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new xce},e.prototype.buildPath=function(t,i){t.moveTo(i.cx+i.r,i.cy),t.arc(i.cx,i.cy,i.r,0,Math.PI*2)},e}(ut);C4.prototype.type="circle";var ua=C4;var Sce=function(){function r(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return r}();var R4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Sce},e.prototype.buildPath=function(t,i){var n=.5522848,a=i.cx,o=i.cy,s=i.rx,l=i.ry,u=s*n,c=l*n;t.moveTo(a-s,o),t.bezierCurveTo(a-s,o-c,a-u,o-l,a,o-l),t.bezierCurveTo(a+u,o-l,a+s,o-c,a+s,o),t.bezierCurveTo(a+s,o+c,a+u,o+l,a,o+l),t.bezierCurveTo(a-u,o+l,a-s,o+c,a-s,o),t.closePath()},e}(ut);R4.prototype.type="ellipse";var g_=R4;var P4=Math.PI,PP=P4*2,Dp=Math.sin,ev=Math.cos,Mce=Math.acos,Vn=Math.atan2,L4=Math.abs,__=Math.sqrt,y_=Math.max,Ol=Math.min,Bs=1e-4;function bce(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=f*l-c*u;if(!(h*h<Bs))return h=(c*(e-a)-f*(r-n))/h,[r+h*l,e+h*u]}function uw(r,e,t,i,n,a,o){var s=r-t,l=e-i,u=(o?a:-a)/__(s*s+l*l),c=u*l,f=-u*s,h=r+c,p=e+f,d=t+c,g=i+f,m=(h+d)/2,v=(p+g)/2,_=d-h,y=g-p,x=_*_+y*y,M=n-a,S=h*g-d*p,w=(y<0?-1:1)*__(y_(0,M*M*x-S*S)),T=(S*y-_*w)/x,C=(-S*_-y*w)/x,b=(S*y+_*w)/x,E=(-S*_+y*w)/x,I=T-m,R=C-v,A=b-m,D=E-v;return I*I+R*R>A*A+D*D&&(T=b,C=E),{cx:T,cy:C,x0:-c,y0:-f,x1:T*(n/M-1),y1:C*(n/M-1)}}function wce(r){var e;if(pe(r)){var t=r.length;if(!t)return r;t===1?e=[r[0],r[0],0,0]:t===2?e=[r[0],r[0],r[1],r[1]]:t===3?e=r.concat(r[2]):e=r}else e=[r,r,r,r];return e}function D4(r,e){var t,i=y_(e.r,0),n=y_(e.r0||0,0),a=i>0,o=n>0;if(!(!a&&!o)){if(a||(i=n,n=0),n>i){var s=i;i=n,n=s}var l=e.startAngle,u=e.endAngle;if(!(isNaN(l)||isNaN(u))){var c=e.cx,f=e.cy,h=!!e.clockwise,p=L4(u-l),d=p>PP&&p%PP;if(d>Bs&&(p=d),!(i>Bs))r.moveTo(c,f);else if(p>PP-Bs)r.moveTo(c+i*ev(l),f+i*Dp(l)),r.arc(c,f,i,l,u,!h),n>Bs&&(r.moveTo(c+n*ev(u),f+n*Dp(u)),r.arc(c,f,n,u,l,h));else{var g=void 0,m=void 0,v=void 0,_=void 0,y=void 0,x=void 0,M=void 0,S=void 0,w=void 0,T=void 0,C=void 0,b=void 0,E=void 0,I=void 0,R=void 0,A=void 0,D=i*ev(l),U=i*Dp(l),B=n*ev(u),z=n*Dp(u),k=p>Bs;if(k){var G=e.cornerRadius;G&&(t=wce(G),g=t[0],m=t[1],v=t[2],_=t[3]);var Y=L4(i-n)/2;if(y=Ol(Y,v),x=Ol(Y,_),M=Ol(Y,g),S=Ol(Y,m),C=w=y_(y,x),b=T=y_(M,S),(w>Bs||T>Bs)&&(E=i*ev(u),I=i*Dp(u),R=n*ev(l),A=n*Dp(l),p<P4)){var J=bce(D,U,R,A,E,I,B,z);if(J){var Q=D-J[0],V=U-J[1],K=E-J[0],ae=I-J[1],ve=1/Dp(Mce((Q*K+V*ae)/(__(Q*Q+V*V)*__(K*K+ae*ae)))/2),ue=__(J[0]*J[0]+J[1]*J[1]);C=Ol(w,(i-ue)/(ve+1)),b=Ol(T,(n-ue)/(ve-1))}}}if(!k)r.moveTo(c+D,f+U);else if(C>Bs){var se=Ol(v,C),Ee=Ol(_,C),q=uw(R,A,D,U,i,se,h),H=uw(E,I,B,z,i,Ee,h);r.moveTo(c+q.cx+q.x0,f+q.cy+q.y0),C<w&&se===Ee?r.arc(c+q.cx,f+q.cy,C,Vn(q.y0,q.x0),Vn(H.y0,H.x0),!h):(se>0&&r.arc(c+q.cx,f+q.cy,se,Vn(q.y0,q.x0),Vn(q.y1,q.x1),!h),r.arc(c,f,i,Vn(q.cy+q.y1,q.cx+q.x1),Vn(H.cy+H.y1,H.cx+H.x1),!h),Ee>0&&r.arc(c+H.cx,f+H.cy,Ee,Vn(H.y1,H.x1),Vn(H.y0,H.x0),!h))}else r.moveTo(c+D,f+U),r.arc(c,f,i,l,u,!h);if(!(n>Bs)||!k)r.lineTo(c+B,f+z);else if(b>Bs){var se=Ol(g,b),Ee=Ol(m,b),q=uw(B,z,E,I,n,-Ee,h),H=uw(D,U,R,A,n,-se,h);r.lineTo(c+q.cx+q.x0,f+q.cy+q.y0),b<T&&se===Ee?r.arc(c+q.cx,f+q.cy,b,Vn(q.y0,q.x0),Vn(H.y0,H.x0),!h):(Ee>0&&r.arc(c+q.cx,f+q.cy,Ee,Vn(q.y0,q.x0),Vn(q.y1,q.x1),!h),r.arc(c,f,n,Vn(q.cy+q.y1,q.cx+q.x1),Vn(H.cy+H.y1,H.cx+H.x1),h),se>0&&r.arc(c+H.cx,f+H.cy,se,Vn(H.y1,H.x1),Vn(H.y0,H.x0),!h))}else r.lineTo(c+B,f+z),r.arc(c,f,n,u,l,h)}r.closePath()}}}var Ece=function(){function r(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return r}();var I4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Ece},e.prototype.buildPath=function(t,i){D4(t,i)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(ut);I4.prototype.type="sector";var yi=I4;var Ace=function(){function r(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return r}();var N4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Ace},e.prototype.buildPath=function(t,i){var n=i.cx,a=i.cy,o=Math.PI*2;t.moveTo(n+i.r,a),t.arc(n,a,i.r,0,o,!1),t.moveTo(n+i.r0,a),t.arc(n,a,i.r0,0,o,!0)},e}(ut);N4.prototype.type="ring";var Ip=N4;function DP(r,e,t,i){var n=[],a=[],o=[],s=[],l,u,c,f;if(i){c=[1/0,1/0],f=[-1/0,-1/0];for(var h=0,p=r.length;h<p;h++)po(c,c,r[h]),mo(f,f,r[h]);po(c,c,i[0]),mo(f,f,i[1])}for(var h=0,p=r.length;h<p;h++){var d=r[h];if(t)l=r[h?h-1:p-1],u=r[(h+1)%p];else if(h===0||h===p-1){n.push(Aa(r[h]));continue}else l=r[h-1],u=r[h+1];Ns(a,u,l),Em(a,a,e);var g=sb(d,l),m=sb(d,u),v=g+m;v!==0&&(g/=v,m/=v),Em(o,a,-g),Em(s,a,m);var _=cL([],d,o),y=cL([],d,s);i&&(mo(_,_,c),po(_,_,f),mo(y,y,c),po(y,y,f)),n.push(_),n.push(y)}return t&&n.push(n.shift()),n}function cw(r,e,t){var i=e.smooth,n=e.points;if(n&&n.length>=2){if(i){var a=DP(n,i,t,e.smoothConstraint);r.moveTo(n[0][0],n[0][1]);for(var o=n.length,s=0;s<(t?o:o-1);s++){var l=a[s*2],u=a[s*2+1],c=n[(s+1)%o];r.bezierCurveTo(l[0],l[1],u[0],u[1],c[0],c[1])}}else{r.moveTo(n[0][0],n[0][1]);for(var s=1,f=n.length;s<f;s++)r.lineTo(n[s][0],n[s][1])}t&&r.closePath()}}var Cce=function(){function r(){this.points=null,this.smooth=0,this.smoothConstraint=null}return r}();var O4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Cce},e.prototype.buildPath=function(t,i){cw(t,i,!0)},e}(ut);O4.prototype.type="polygon";var ti=O4;var Rce=function(){function r(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return r}();var z4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Rce},e.prototype.buildPath=function(t,i){cw(t,i,!1)},e}(ut);z4.prototype.type="polyline";var Qr=z4;var Lce={},Pce=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return r}();var F4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Pce},e.prototype.buildPath=function(t,i){var n,a,o,s;if(this.subPixelOptimize){var l=Jb(Lce,i,this.style);n=l.x1,a=l.y1,o=l.x2,s=l.y2}else n=i.x1,a=i.y1,o=i.x2,s=i.y2;var u=i.percent;u!==0&&(t.moveTo(n,a),u<1&&(o=n*(1-u)+o*u,s=a*(1-u)+s*u),t.lineTo(o,s))},e.prototype.pointAt=function(t){var i=this.shape;return[i.x1*(1-t)+i.x2*t,i.y1*(1-t)+i.y2*t]},e}(ut);F4.prototype.type="line";var Jr=F4;var ka=[],Dce=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1}return r}();function B4(r,e,t){var i=r.cpx2,n=r.cpy2;return i!=null||n!=null?[(t?ML:hi)(r.x1,r.cpx1,r.cpx2,r.x2,e),(t?ML:hi)(r.y1,r.cpy1,r.cpy2,r.y2,e)]:[(t?H0:vi)(r.x1,r.cpx1,r.x2,e),(t?H0:vi)(r.y1,r.cpy1,r.y2,e)]}var k4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Dce},e.prototype.buildPath=function(t,i){var n=i.x1,a=i.y1,o=i.x2,s=i.y2,l=i.cpx1,u=i.cpy1,c=i.cpx2,f=i.cpy2,h=i.percent;h!==0&&(t.moveTo(n,a),c==null||f==null?(h<1&&(mf(n,l,o,h,ka),l=ka[1],o=ka[2],mf(a,u,s,h,ka),u=ka[1],s=ka[2]),t.quadraticCurveTo(l,u,o,s)):(h<1&&(jo(n,l,c,o,h,ka),l=ka[1],c=ka[2],o=ka[3],jo(a,u,f,s,h,ka),u=ka[1],f=ka[2],s=ka[3]),t.bezierCurveTo(l,u,c,f,o,s)))},e.prototype.pointAt=function(t){return B4(this.shape,t,!1)},e.prototype.tangentAt=function(t){var i=B4(this.shape,t,!0);return Xo(i,i)},e}(ut);k4.prototype.type="bezier-curve";var Np=k4;var Ice=function(){function r(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return r}();var V4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Ice},e.prototype.buildPath=function(t,i){var n=i.cx,a=i.cy,o=Math.max(i.r,0),s=i.startAngle,l=i.endAngle,u=i.clockwise,c=Math.cos(s),f=Math.sin(s);t.moveTo(c*o+n,f*o+a),t.arc(n,a,o,s,l,!u)},e}(ut);V4.prototype.type="arc";var x_=V4;var Nce=function(r){Xt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="compound",t}return e.prototype._updatePathDirty=function(){for(var t=this.shape.paths,i=this.shapeChanged(),n=0;n<t.length;n++)i=i||t[n].shapeChanged();i&&this.dirtyShape()},e.prototype.beforeBrush=function(){this._updatePathDirty();for(var t=this.shape.paths||[],i=this.getGlobalScale(),n=0;n<t.length;n++)t[n].path||t[n].createPathProxy(),t[n].path.setScale(i[0],i[1],t[n].segmentIgnoreThreshold)},e.prototype.buildPath=function(t,i){for(var n=i.paths||[],a=0;a<n.length;a++)n[a].buildPath(t,n[a].shape,!0)},e.prototype.afterBrush=function(){for(var t=this.shape.paths||[],i=0;i<t.length;i++)t[i].pathUpdated()},e.prototype.getBoundingRect=function(){return this._updatePathDirty.call(this),ut.prototype.getBoundingRect.call(this)},e}(ut),tv=Nce;var Uce=function(){function r(e){this.colorStops=e||[]}return r.prototype.addColorStop=function(e,t){this.colorStops.push({offset:e,color:t})},r}(),fw=Uce;var Oce=function(r){Xt(e,r);function e(t,i,n,a,o,s){var l=r.call(this,o)||this;return l.x=t??0,l.y=i??0,l.x2=n??1,l.y2=a??0,l.type="linear",l.global=s||!1,l}return e}(fw),zl=Oce;var zce=function(r){Xt(e,r);function e(t,i,n,a,o){var s=r.call(this,a)||this;return s.x=t??.5,s.y=i??.5,s.r=n??.5,s.type="radial",s.global=o||!1,s}return e}(fw),hw=zce;var Up=[0,0],Op=[0,0],pw=new Nt,dw=new Nt,Fce=function(){function r(e,t){this._corners=[],this._axes=[],this._origin=[0,0];for(var i=0;i<4;i++)this._corners[i]=new Nt;for(var i=0;i<2;i++)this._axes[i]=new Nt;e&&this.fromBoundingRect(e,t)}return r.prototype.fromBoundingRect=function(e,t){var i=this._corners,n=this._axes,a=e.x,o=e.y,s=a+e.width,l=o+e.height;if(i[0].set(a,o),i[1].set(s,o),i[2].set(s,l),i[3].set(a,l),t)for(var u=0;u<4;u++)i[u].transform(t);Nt.sub(n[0],i[1],i[0]),Nt.sub(n[1],i[3],i[0]),n[0].normalize(),n[1].normalize();for(var u=0;u<2;u++)this._origin[u]=n[u].dot(i[0])},r.prototype.intersect=function(e,t){var i=!0,n=!t;return pw.set(1/0,1/0),dw.set(0,0),!this._intersectCheckOneSide(this,e,pw,dw,n,1)&&(i=!1,n)||!this._intersectCheckOneSide(e,this,pw,dw,n,-1)&&(i=!1,n)||n||Nt.copy(t,i?pw:dw),i},r.prototype._intersectCheckOneSide=function(e,t,i,n,a,o){for(var s=!0,l=0;l<2;l++){var u=this._axes[l];if(this._getProjMinMaxOnAxis(l,e._corners,Up),this._getProjMinMaxOnAxis(l,t._corners,Op),Up[1]<Op[0]||Up[0]>Op[1]){if(s=!1,a)return s;var c=Math.abs(Op[0]-Up[1]),f=Math.abs(Up[0]-Op[1]);Math.min(c,f)>n.len()&&(c<f?Nt.scale(n,u,-c*o):Nt.scale(n,u,f*o))}else if(i){var c=Math.abs(Op[0]-Up[1]),f=Math.abs(Up[0]-Op[1]);Math.min(c,f)<i.len()&&(c<f?Nt.scale(i,u,c*o):Nt.scale(i,u,-f*o))}}return s},r.prototype._getProjMinMaxOnAxis=function(e,t,i){for(var n=this._axes[e],a=this._origin,o=t[0].dot(n)+a[e],s=o,l=o,u=1;u<t.length;u++){var c=t[u].dot(n)+a[e];s=Math.min(c,s),l=Math.max(c,l)}i[0]=s,i[1]=l},r}(),rv=Fce;var Bce=[],kce=function(r){Xt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.notClear=!0,t.incremental=!0,t._displayables=[],t._temporaryDisplayables=[],t._cursor=0,t}return e.prototype.traverse=function(t,i){t.call(i,this)},e.prototype.useStyle=function(){this.style={}},e.prototype.getCursor=function(){return this._cursor},e.prototype.innerAfterBrush=function(){this._cursor=this._displayables.length},e.prototype.clearDisplaybles=function(){this._displayables=[],this._temporaryDisplayables=[],this._cursor=0,this.markRedraw(),this.notClear=!1},e.prototype.clearTemporalDisplayables=function(){this._temporaryDisplayables=[]},e.prototype.addDisplayable=function(t,i){i?this._temporaryDisplayables.push(t):this._displayables.push(t),this.markRedraw()},e.prototype.addDisplayables=function(t,i){i=i||!1;for(var n=0;n<t.length;n++)this.addDisplayable(t[n],i)},e.prototype.getDisplayables=function(){return this._displayables},e.prototype.getTemporalDisplayables=function(){return this._temporaryDisplayables},e.prototype.eachPendingDisplayable=function(t){for(var i=this._cursor;i<this._displayables.length;i++)t&&t(this._displayables[i]);for(var i=0;i<this._temporaryDisplayables.length;i++)t&&t(this._temporaryDisplayables[i])},e.prototype.update=function(){this.updateTransform();for(var t=this._cursor;t<this._displayables.length;t++){var i=this._displayables[t];i.parent=this,i.update(),i.parent=null}for(var t=0;t<this._temporaryDisplayables.length;t++){var i=this._temporaryDisplayables[t];i.parent=this,i.update(),i.parent=null}},e.prototype.getBoundingRect=function(){if(!this._rect){for(var t=new lt(1/0,1/0,-1/0,-1/0),i=0;i<this._displayables.length;i++){var n=this._displayables[i],a=n.getBoundingRect().clone();n.needLocalTransform()&&a.applyTransform(n.getLocalTransform(Bce)),t.union(a)}this._rect=t}return this._rect},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();if(a.contain(n[0],n[1]))for(var o=0;o<this._displayables.length;o++){var s=this._displayables[o];if(s.contain(t,i))return!0}return!1},e}(gi),G4=kce;var W4=vt();function Fl(r,e,t,i,n){var a;if(e&&e.ecModel){var o=e.ecModel.getUpdatePayload();a=o&&o.animation}var s=e&&e.isAnimationEnabled(),l=r==="update";if(s){var u=void 0,c=void 0,f=void 0;i?(u=ft(i.duration,200),c=ft(i.easing,"cubicOut"),f=0):(u=e.getShallow(l?"animationDurationUpdate":"animationDuration"),c=e.getShallow(l?"animationEasingUpdate":"animationEasing"),f=e.getShallow(l?"animationDelayUpdate":"animationDelay")),a&&(a.duration!=null&&(u=a.duration),a.easing!=null&&(c=a.easing),a.delay!=null&&(f=a.delay)),He(f)&&(f=f(t,n)),He(u)&&(u=u(t));var h={duration:u||0,delay:f,easing:c};return h}else return null}function IP(r,e,t,i,n,a,o){var s=!1,l;He(n)?(o=a,a=n,n=null):qe(n)&&(a=n.cb,o=n.during,s=n.isFrom,l=n.removeOpt,n=n.dataIndex);var u=r==="leave";u||e.stopAnimation("leave");var c=Fl(r,i,n,u?l||{}:null,i&&i.getAnimationDelayParams?i.getAnimationDelayParams(e,n):null);if(c&&c.duration>0){var f=c.duration,h=c.delay,p=c.easing,d={duration:f,delay:h||0,easing:p,done:a,force:!!a||!!o,setToFinal:!u,scope:r,during:o};s?e.animateFrom(t,d):e.animateTo(t,d)}else e.stopAnimation(),!s&&e.attr(t),o&&o(1),a&&a()}function Dt(r,e,t,i,n,a){IP("update",r,e,t,i,n,a)}function or(r,e,t,i,n,a){IP("enter",r,e,t,i,n,a)}function Eu(r){if(!r.__zr)return!0;for(var e=0;e<r.animators.length;e++){var t=r.animators[e];if(t.scope==="leave")return!0}return!1}function ts(r,e,t,i,n,a){Eu(r)||IP("leave",r,e,t,i,n,a)}function H4(r,e,t,i){r.removeTextContent(),r.removeTextGuideLine(),ts(r,{style:{opacity:0}},e,t,i)}function Au(r,e,t){function i(){r.parent&&r.parent.remove(r)}r.isGroup?r.traverse(function(n){n.isGroup||H4(n,e,t,i)}):H4(r,e,t,i)}function Di(r){W4(r).oldStyle=r.style}function X4(r){return W4(r).oldStyle}var mw=Math.max,vw=Math.min,UP={};function Vce(r){return ut.extend(r)}var Gce=E4;function Hce(r,e){return Gce(r,e)}function ks(r,e){UP[r]=e}function S_(r){if(UP.hasOwnProperty(r))return UP[r]}function iv(r,e,t,i){var n=lw(r,e);return t&&(i==="center"&&(t=Z4(t,n.getBoundingRect())),j4(n,t)),n}function OP(r,e,t){var i=new Ur({style:{image:r,x:e.x,y:e.y,width:e.width,height:e.height},onload:function(n){if(t==="center"){var a={width:n.width,height:n.height};i.setStyle(Z4(e,a))}}});return i}function Z4(r,e){var t=e.width/e.height,i=r.height*t,n;i<=r.width?n=r.height:(i=r.width,n=i/t);var a=r.x+r.width/2,o=r.y+r.height/2;return{x:a-i/2,y:o-n/2,width:i,height:n}}var Gn=A4;function j4(r,e){if(r.applyTransform){var t=r.getBoundingRect(),i=t.calculateTransform(e);r.applyTransform(i)}}function Cu(r,e){return Jb(r,r,{lineWidth:e}),r}function Wce(r){return $b(r.shape,r.shape,r.style),r}var M_=wf;function Vs(r,e){for(var t=ff([]);r&&r!==e;)La(t,r.getLocalTransform(),t),r=r.parent;return t}function wn(r,e,t){return e&&!ci(e)&&(e=Da.getLocalTransform(e)),t&&(e=qo([],e)),fi([],r,e)}function zp(r,e,t){var i=e[4]===0||e[5]===0||e[0]===0?1:Math.abs(2*e[4]/e[0]),n=e[4]===0||e[5]===0||e[2]===0?1:Math.abs(2*e[4]/e[2]),a=[r==="left"?-i:r==="right"?i:0,r==="top"?-n:r==="bottom"?n:0];return a=wn(a,e,t),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function Y4(r){return!r.isGroup}function Xce(r){return r.shape!=null}function Ru(r,e,t){if(!r||!e)return;function i(o){var s={};return o.traverse(function(l){Y4(l)&&l.anid&&(s[l.anid]=l)}),s}function n(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Xce(o)&&(s.shape=fe({},o.shape)),s}var a=i(r);e.traverse(function(o){if(Y4(o)&&o.anid){var s=a[o.anid];if(s){var l=n(o);o.attr(n(s)),Dt(o,l,t,rt(o).dataIndex)}}})}function zP(r,e){return de(r,function(t){var i=t[0];i=mw(i,e.x),i=vw(i,e.x+e.width);var n=t[1];return n=mw(n,e.y),n=vw(n,e.y+e.height),[i,n]})}function Yce(r,e){var t=mw(r.x,e.x),i=vw(r.x+r.width,e.x+e.width),n=mw(r.y,e.y),a=vw(r.y+r.height,e.y+e.height);if(i>=t&&a>=n)return{x:t,y:n,width:i-t,height:a-n}}function Lu(r,e,t){var i=fe({rectHover:!0},e),n=i.style={strokeNoScale:!0};if(t=t||{x:-1,y:-1,width:2,height:2},r)return r.indexOf("image://")===0?(n.image=r.slice(8),Ye(n,t),new Ur(i)):iv(r.replace("path://",""),i,t,"center")}function nv(r,e,t,i,n){for(var a=0,o=n[n.length-1];a<n.length;a++){var s=n[a];if(K4(r,e,t,i,s[0],s[1],o[0],o[1]))return!0;o=s}}function K4(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=NP(c,f,l,u);if(qce(h))return!1;var p=r-n,d=e-a,g=NP(p,d,l,u)/h;if(g<0||g>1)return!1;var m=NP(p,d,c,f)/h;return!(m<0||m>1)}function NP(r,e,t,i){return r*i-t*e}function qce(r){return r<=1e-6&&r>=-1e-6}function Gs(r){var e=r.itemTooltipOption,t=r.componentModel,i=r.itemName,n=Ce(e)?{formatter:e}:e,a=t.mainType,o=t.componentIndex,s={componentType:a,name:i,$vars:["name"]};s[a+"Index"]=o;var l=r.formatterParamsExtra;l&&N(bt(l),function(c){tt(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=rt(r.el);u.componentMainType=a,u.componentIndex=o,u.tooltipConfig={name:i,option:Ye({content:i,formatterParams:s},n)}}function q4(r,e){var t;r.isGroup&&(t=e(r)),t||r.traverse(e)}function ca(r,e){if(r)if(pe(r))for(var t=0;t<r.length;t++)q4(r[t],e);else q4(r,e)}ks("circle",ua);ks("ellipse",g_);ks("sector",yi);ks("ring",Ip);ks("polygon",ti);ks("polyline",Qr);ks("rect",Et);ks("line",Jr);ks("bezierCurve",Np);ks("arc",x_);var gw={};function t5(r,e){for(var t=0;t<Fi.length;t++){var i=Fi[t],n=e[i],a=r.ensureState(i);a.style=a.style||{},a.style.text=n}var o=r.currentStates.slice();r.clearStates(!0),r.setStyle({text:e.normal}),r.useStates(o,!0)}function FP(r,e,t){var i=r.labelFetcher,n=r.labelDataIndex,a=r.labelDimIndex,o=e.normal,s;i&&(s=i.getFormattedLabel(n,"normal",null,a,o&&o.get("formatter"),t!=null?{interpolatedValue:t}:null)),s==null&&(s=He(r.defaultText)?r.defaultText(n,r,t):r.defaultText);for(var l={normal:s},u=0;u<Fi.length;u++){var c=Fi[u],f=e[c];l[c]=ft(i?i.getFormattedLabel(n,c,null,a,f&&f.get("formatter")):null,s)}return l}function Ir(r,e,t,i){t=t||gw;for(var n=r instanceof Lt,a=!1,o=0;o<Tf.length;o++){var s=e[Tf[o]];if(s&&s.getShallow("show")){a=!0;break}}var l=n?r:r.getTextContent();if(a){n||(l||(l=new Lt,r.setTextContent(l)),r.stateProxy&&(l.stateProxy=r.stateProxy));var u=FP(t,e),c=e.normal,f=!!c.getShallow("show"),h=fr(c,i&&i.normal,t,!1,!n);h.text=u.normal,n||r.setTextConfig(b_(c,t,!1));for(var o=0;o<Fi.length;o++){var p=Fi[o],s=e[p];if(s){var d=l.ensureState(p),g=!!ft(s.getShallow("show"),f);if(g!==f&&(d.ignore=!g),d.style=fr(s,i&&i[p],t,!0,!n),d.style.text=u[p],!n){var m=r.ensureState(p);m.textConfig=b_(s,t,!0)}}}l.silent=!!c.getShallow("silent"),l.style.x!=null&&(h.x=l.style.x),l.style.y!=null&&(h.y=l.style.y),l.ignore=!f,l.useStyle(h),l.dirty(),t.enableTextSetter&&(Pu(l).setLabelText=function(v){var _=FP(t,e,v);t5(l,_)})}else l&&(l.ignore=!0);r.dirty()}function wr(r,e){e=e||"label";for(var t={normal:r.getModel(e)},i=0;i<Fi.length;i++){var n=Fi[i];t[n]=r.getModel([n,e])}return t}function fr(r,e,t,i,n){var a={};return Zce(a,r,t,i,n),e&&fe(a,e),a}function b_(r,e,t){e=e||{};var i={},n,a=r.getShallow("rotate"),o=ft(r.getShallow("distance"),t?null:5),s=r.getShallow("offset");return n=r.getShallow("position")||(t?null:"inside"),n==="outside"&&(n=e.defaultOutsidePosition||"top"),n!=null&&(i.position=n),s!=null&&(i.offset=s),a!=null&&(a*=Math.PI/180,i.rotation=a),o!=null&&(i.distance=o),i.outsideFill=r.get("color")==="inherit"?e.inheritColor||null:"auto",i}function Zce(r,e,t,i,n){t=t||gw;var a=e.ecModel,o=a&&a.option.textStyle,s=jce(e),l;if(s){l={};for(var u in s)if(s.hasOwnProperty(u)){var c=e.getModel(["rich",u]);e5(l[u]={},c,o,t,i,n,!1,!0)}}l&&(r.rich=l);var f=e.get("overflow");f&&(r.overflow=f);var h=e.get("minMargin");h!=null&&(r.margin=h),e5(r,e,o,t,i,n,!0,!1)}function jce(r){for(var e;r&&r!==r.ecModel;){var t=(r.option||gw).rich;if(t){e=e||{};for(var i=bt(t),n=0;n<i.length;n++){var a=i[n];e[a]=1}}r=r.parentModel}return e}var J4=["fontStyle","fontWeight","fontSize","fontFamily","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY"],$4=["align","lineHeight","width","height","tag","verticalAlign","ellipsis"],Q4=["padding","borderWidth","borderRadius","borderDashOffset","backgroundColor","borderColor","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];function e5(r,e,t,i,n,a,o,s){t=!n&&t||gw;var l=i&&i.inheritColor,u=e.getShallow("color"),c=e.getShallow("textBorderColor"),f=ft(e.getShallow("opacity"),t.opacity);(u==="inherit"||u==="auto")&&(l?u=l:u=null),(c==="inherit"||c==="auto")&&(l?c=l:c=null),a||(u=u||t.color,c=c||t.textBorderColor),u!=null&&(r.fill=u),c!=null&&(r.stroke=c);var h=ft(e.getShallow("textBorderWidth"),t.textBorderWidth);h!=null&&(r.lineWidth=h);var p=ft(e.getShallow("textBorderType"),t.textBorderType);p!=null&&(r.lineDash=p);var d=ft(e.getShallow("textBorderDashOffset"),t.textBorderDashOffset);d!=null&&(r.lineDashOffset=d),!n&&f==null&&!s&&(f=i&&i.defaultOpacity),f!=null&&(r.opacity=f),!n&&!a&&r.fill==null&&i.inheritColor&&(r.fill=i.inheritColor);for(var g=0;g<J4.length;g++){var m=J4[g],v=ft(e.getShallow(m),t[m]);v!=null&&(r[m]=v)}for(var g=0;g<$4.length;g++){var m=$4[g],v=e.getShallow(m);v!=null&&(r[m]=v)}if(r.verticalAlign==null){var _=e.getShallow("baseline");_!=null&&(r.verticalAlign=_)}if(!o||!i.disableBox){for(var g=0;g<Q4.length;g++){var m=Q4[g],v=e.getShallow(m);v!=null&&(r[m]=v)}var y=e.getShallow("borderType");y!=null&&(r.borderDash=y),(r.backgroundColor==="auto"||r.backgroundColor==="inherit")&&l&&(r.backgroundColor=l),(r.borderColor==="auto"||r.borderColor==="inherit")&&l&&(r.borderColor=l)}}function av(r,e){var t=e&&e.getModel("textStyle");return Yi([r.fontStyle||t&&t.getShallow("fontStyle")||"",r.fontWeight||t&&t.getShallow("fontWeight")||"",(r.fontSize||t&&t.getShallow("fontSize")||12)+"px",r.fontFamily||t&&t.getShallow("fontFamily")||"sans-serif"].join(" "))}var Pu=vt();function yw(r,e,t,i){if(r){var n=Pu(r);n.prevValue=n.value,n.value=t;var a=e.normal;n.valueAnimation=a.get("valueAnimation"),n.valueAnimation&&(n.precision=a.get("precision"),n.defaultInterpolatedText=i,n.statesModels=e)}}function _w(r,e,t,i,n){var a=Pu(r);if(!a.valueAnimation||a.prevValue===a.value)return;var o=a.defaultInterpolatedText,s=ft(a.interpolatedValue,a.prevValue),l=a.value;function u(c){var f=Xb(t,a.precision,s,l,c);a.interpolatedValue=c===1?null:f;var h=FP({labelDataIndex:e,labelFetcher:n,defaultText:o?o(f):f+""},a.statesModels,f);t5(r,h)}r.percent=0,(a.prevValue==null?or:Dt)(r,{percent:1},i,e,null,u)}var Jce=["textStyle","color"],BP=["fontStyle","fontWeight","fontSize","fontFamily","padding","lineHeight","rich","width","height","overflow"],kP=new Lt,$ce=function(){function r(){}return r.prototype.getTextColor=function(e){var t=this.ecModel;return this.getShallow("color")||(!e&&t?t.get(Jce):null)},r.prototype.getFont=function(){return av({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},r.prototype.getTextRect=function(e){for(var t={text:e,verticalAlign:this.getShallow("verticalAlign")||this.getShallow("baseline")},i=0;i<BP.length;i++)t[BP[i]]=this.getShallow(BP[i]);return kP.useStyle(t),kP.update(),kP.getBoundingRect()},r}(),r5=$ce;var VP=[["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","type"],["lineDashOffset","dashOffset"],["lineCap","cap"],["lineJoin","join"],["miterLimit"]],Qce=za(VP),i5=function(){function r(){}return r.prototype.getLineStyle=function(e){return Qce(this,e)},r}();var GP=[["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","borderType"],["lineDashOffset","borderDashOffset"],["lineCap","borderCap"],["lineJoin","borderJoin"],["miterLimit","borderMiterLimit"]],efe=za(GP),n5=function(){function r(){}return r.prototype.getItemStyle=function(e,t){return efe(this,e,t)},r}();var Fp=function(){function r(e,t,i){this.parentModel=t,this.ecModel=i,this.option=e}return r.prototype.init=function(e,t,i){for(var n=[],a=3;a<arguments.length;a++)n[a-3]=arguments[a]},r.prototype.mergeOption=function(e,t){_t(this.option,e,!0)},r.prototype.get=function(e,t){return e==null?this.option:this._doGet(this.parsePath(e),!t&&this.parentModel)},r.prototype.getShallow=function(e,t){var i=this.option,n=i==null?i:i[e];if(n==null&&!t){var a=this.parentModel;a&&(n=a.getShallow(e))}return n},r.prototype.getModel=function(e,t){var i=e!=null,n=i?this.parsePath(e):null,a=i?this._doGet(n):this.option;return t=t||this.parentModel&&this.parentModel.getModel(this.resolveParentPath(n)),new r(a,t,this.ecModel)},r.prototype.isEmpty=function(){return this.option==null},r.prototype.restoreData=function(){},r.prototype.clone=function(){var e=this.constructor;return new e(Qe(this.option))},r.prototype.parsePath=function(e){return typeof e=="string"?e.split("."):e},r.prototype.resolveParentPath=function(e){return e},r.prototype.isAnimationEnabled=function(){if(!zt.node&&this.option){if(this.option.animation!=null)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}},r.prototype._doGet=function(e,t){var i=this.option;if(!e)return i;for(var n=0;n<e.length&&!(e[n]&&(i=i&&typeof i=="object"?i[e[n]]:null,i==null));n++);return i==null&&t&&(i=t._doGet(this.resolveParentPath(e),t.parentModel)),i},r}();Xm(Fp);mH(Fp);br(Fp,i5);br(Fp,n5);br(Fp,vH);br(Fp,r5);var Zt=Fp;var tfe=Math.round(Math.random()*10);function rs(r){return[r||"",tfe++].join("_")}function a5(r){var e={};r.registerSubTypeDefaulter=function(t,i){var n=Oa(t);e[n.main]=i},r.determineSubType=function(t,i){var n=i.type;if(!n){var a=Oa(t).main;r.hasSubTypes(t)&&e[a]&&(n=e[a](i))}return n}}function o5(r,e){r.topologicalTravel=function(a,o,s,l){if(!a.length)return;var u=t(o),c=u.graph,f=u.noEntryList,h={};for(N(a,function(_){h[_]=!0});f.length;){var p=f.pop(),d=c[p],g=!!h[p];g&&(s.call(l,p,d.originalDeps.slice()),delete h[p]),N(d.successor,g?v:m)}N(h,function(){var _="";throw new Error(_)});function m(_){c[_].entryCount--,c[_].entryCount===0&&f.push(_)}function v(_){h[_]=!0,m(_)}};function t(a){var o={},s=[];return N(a,function(l){var u=i(o,l),c=u.originalDeps=e(l),f=n(c,a);u.entryCount=f.length,u.entryCount===0&&s.push(l),N(f,function(h){dt(u.predecessor,h)<0&&u.predecessor.push(h);var p=i(o,h);dt(p.successor,h)<0&&p.successor.push(l)})}),{graph:o,noEntryList:s}}function i(a,o){return a[o]||(a[o]={predecessor:[],successor:[]}),a[o]}function n(a,o){var s=[];return N(a,function(l){dt(o,l)>=0&&s.push(l)}),s}}function Hn(r,e){return _t(_t({},r,!0),e,!0)}var s5={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}};var l5={time:{month:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthAbbr:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],dayOfWeek:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],dayOfWeekAbbr:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"]},legend:{selector:{all:"\u5168\u9009",inverse:"\u53CD\u9009"}},toolbox:{brush:{title:{rect:"\u77E9\u5F62\u9009\u62E9",polygon:"\u5708\u9009",lineX:"\u6A2A\u5411\u9009\u62E9",lineY:"\u7EB5\u5411\u9009\u62E9",keep:"\u4FDD\u6301\u9009\u62E9",clear:"\u6E05\u9664\u9009\u62E9"}},dataView:{title:"\u6570\u636E\u89C6\u56FE",lang:["\u6570\u636E\u89C6\u56FE","\u5173\u95ED","\u5237\u65B0"]},dataZoom:{title:{zoom:"\u533A\u57DF\u7F29\u653E",back:"\u533A\u57DF\u7F29\u653E\u8FD8\u539F"}},magicType:{title:{line:"\u5207\u6362\u4E3A\u6298\u7EBF\u56FE",bar:"\u5207\u6362\u4E3A\u67F1\u72B6\u56FE",stack:"\u5207\u6362\u4E3A\u5806\u53E0",tiled:"\u5207\u6362\u4E3A\u5E73\u94FA"}},restore:{title:"\u8FD8\u539F"},saveAsImage:{title:"\u4FDD\u5B58\u4E3A\u56FE\u7247",lang:["\u53F3\u952E\u53E6\u5B58\u4E3A\u56FE\u7247"]}},series:{typeNames:{pie:"\u997C\u56FE",bar:"\u67F1\u72B6\u56FE",line:"\u6298\u7EBF\u56FE",scatter:"\u6563\u70B9\u56FE",effectScatter:"\u6D9F\u6F2A\u6563\u70B9\u56FE",radar:"\u96F7\u8FBE\u56FE",tree:"\u6811\u56FE",treemap:"\u77E9\u5F62\u6811\u56FE",boxplot:"\u7BB1\u578B\u56FE",candlestick:"K\u7EBF\u56FE",k:"K\u7EBF\u56FE",heatmap:"\u70ED\u529B\u56FE",map:"\u5730\u56FE",parallel:"\u5E73\u884C\u5750\u6807\u56FE",lines:"\u7EBF\u56FE",graph:"\u5173\u7CFB\u56FE",sankey:"\u6851\u57FA\u56FE",funnel:"\u6F0F\u6597\u56FE",gauge:"\u4EEA\u8868\u76D8\u56FE",pictorialBar:"\u8C61\u5F62\u67F1\u56FE",themeRiver:"\u4E3B\u9898\u6CB3\u6D41\u56FE",sunburst:"\u65ED\u65E5\u56FE",custom:"\u81EA\u5B9A\u4E49\u56FE\u8868",chart:"\u56FE\u8868"}},aria:{general:{withTitle:"\u8FD9\u662F\u4E00\u4E2A\u5173\u4E8E\u201C{title}\u201D\u7684\u56FE\u8868\u3002",withoutTitle:"\u8FD9\u662F\u4E00\u4E2A\u56FE\u8868\uFF0C"},series:{single:{prefix:"",withName:"\u56FE\u8868\u7C7B\u578B\u662F{seriesType}\uFF0C\u8868\u793A{seriesName}\u3002",withoutName:"\u56FE\u8868\u7C7B\u578B\u662F{seriesType}\u3002"},multiple:{prefix:"\u5B83\u7531{seriesCount}\u4E2A\u56FE\u8868\u7CFB\u5217\u7EC4\u6210\u3002",withName:"\u7B2C{seriesId}\u4E2A\u7CFB\u5217\u662F\u4E00\u4E2A\u8868\u793A{seriesName}\u7684{seriesType}\uFF0C",withoutName:"\u7B2C{seriesId}\u4E2A\u7CFB\u5217\u662F\u4E00\u4E2A{seriesType}\uFF0C",separator:{middle:"\uFF1B",end:"\u3002"}}},data:{allData:"\u5176\u6570\u636E\u662F\u2014\u2014",partialData:"\u5176\u4E2D\uFF0C\u524D{displayCnt}\u9879\u662F\u2014\u2014",withName:"{name}\u7684\u6570\u636E\u662F{value}",withoutName:"{value}",separator:{middle:"\uFF0C",end:""}}}};var Sw="ZH",WP="EN",ov=WP,xw={},XP={},Mw=zt.domSupported?function(){var r=(document.documentElement.lang||navigator.language||navigator.browserLanguage||ov).toUpperCase();return r.indexOf(Sw)>-1?Sw:ov}():ov;function u5(r,e){r=r.toUpperCase(),XP[r]=new Zt(e),xw[r]=e}function c5(r){if(Ce(r)){var e=xw[r.toUpperCase()]||{};return r===Sw||r===WP?Qe(e):_t(Qe(e),Qe(xw[ov]),!1)}else return _t(Qe(r),Qe(xw[ov]),!1)}function w_(r){return XP[r]}function f5(){return XP[ov]}u5(WP,s5);u5(Sw,l5);var ww=1e3,Tw=ww*60,lv=Tw*60,_o=lv*24,qP=_o*365,T_={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},bw="{yyyy}-{MM}-{dd}",ZP={year:"{yyyy}",month:"{yyyy}-{MM}",day:bw,hour:bw+" "+T_.hour,minute:bw+" "+T_.minute,second:bw+" "+T_.second,millisecond:T_.none},YP=["year","month","day","hour","minute","second","millisecond"],jP=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Du(r,e){return r+="","0000".substr(0,e-r.length)+r}function kp(r){switch(r){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return r}}function h5(r){return r===kp(r)}function p5(r){switch(r){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Vp(r,e,t,i){var n=Mn(r),a=n[Ew(t)](),o=n[Bp(t)]()+1,s=Math.floor((o-1)/3)+1,l=n[E_(t)](),u=n["get"+(t?"UTC":"")+"Day"](),c=n[sv(t)](),f=(c-1)%12+1,h=n[A_(t)](),p=n[C_(t)](),d=n[R_(t)](),g=i instanceof Zt?i:w_(i||Mw)||f5(),m=g.getModel("time"),v=m.get("month"),_=m.get("monthAbbr"),y=m.get("dayOfWeek"),x=m.get("dayOfWeekAbbr");return(e||"").replace(/{yyyy}/g,a+"").replace(/{yy}/g,Du(a%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,_[o-1]).replace(/{MM}/g,Du(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Du(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,y[u]).replace(/{ee}/g,x[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Du(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,Du(f+"",2)).replace(/{h}/g,f+"").replace(/{mm}/g,Du(h,2)).replace(/{m}/g,h+"").replace(/{ss}/g,Du(p,2)).replace(/{s}/g,p+"").replace(/{SSS}/g,Du(d,3)).replace(/{S}/g,d+"")}function d5(r,e,t,i,n){var a=null;if(Ce(t))a=t;else if(He(t))a=t(r.value,e,{level:r.level});else{var o=fe({},T_);if(r.level>0)for(var s=0;s<YP.length;++s)o[YP[s]]="{primary|"+o[YP[s]]+"}";var l=t?t.inherit===!1?t:Ye(t,o):o,u=m5(r.value,n);if(l[u])a=l[u];else if(l.inherit){for(var c=jP.indexOf(u),s=c-1;s>=0;--s)if(l[u]){a=l[u];break}a=a||o.none}if(pe(a)){var f=r.level==null?0:r.level>=0?r.level:a.length+r.level;f=Math.min(f,a.length-1),a=a[f]}}return Vp(new Date(r.value),a,n,i)}function m5(r,e){var t=Mn(r),i=t[Bp(e)]()+1,n=t[E_(e)](),a=t[sv(e)](),o=t[A_(e)](),s=t[C_(e)](),l=t[R_(e)](),u=l===0,c=u&&s===0,f=c&&o===0,h=f&&a===0,p=h&&n===1,d=p&&i===1;return d?"year":p?"month":h?"day":f?"hour":c?"minute":u?"second":"millisecond"}function KP(r,e,t){var i=Ct(r)?Mn(r):r;switch(e=e||m5(r,t),e){case"year":return i[Ew(t)]();case"half-year":return i[Bp(t)]()>=6?1:0;case"quarter":return Math.floor((i[Bp(t)]()+1)/4);case"month":return i[Bp(t)]();case"day":return i[E_(t)]();case"half-day":return i[sv(t)]()/24;case"hour":return i[sv(t)]();case"minute":return i[A_(t)]();case"second":return i[C_(t)]();case"millisecond":return i[R_(t)]()}}function Ew(r){return r?"getUTCFullYear":"getFullYear"}function Bp(r){return r?"getUTCMonth":"getMonth"}function E_(r){return r?"getUTCDate":"getDate"}function sv(r){return r?"getUTCHours":"getHours"}function A_(r){return r?"getUTCMinutes":"getMinutes"}function C_(r){return r?"getUTCSeconds":"getSeconds"}function R_(r){return r?"getUTCMilliseconds":"getMilliseconds"}function v5(r){return r?"setUTCFullYear":"setFullYear"}function JP(r){return r?"setUTCMonth":"setMonth"}function $P(r){return r?"setUTCDate":"setDate"}function QP(r){return r?"setUTCHours":"setHours"}function eD(r){return r?"setUTCMinutes":"setMinutes"}function tD(r){return r?"setUTCSeconds":"setSeconds"}function rD(r){return r?"setUTCMilliseconds":"setMilliseconds"}function nD(r){if(!xp(r))return Ce(r)?r:"-";var e=(r+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function Aw(r,e){return r=(r||"").toLowerCase().replace(/-(.)/g,function(t,i){return i.toUpperCase()}),e&&r&&(r=r.charAt(0).toUpperCase()+r.slice(1)),r}var Hs=wm;function Cw(r,e,t){var i="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function n(c){return c&&Yi(c)?c:"-"}function a(c){return!!(c!=null&&!isNaN(c)&&isFinite(c))}var o=e==="time",s=r instanceof Date;if(o||s){var l=o?Mn(r):r;if(isNaN(+l)){if(s)return"-"}else return Vp(l,i,t)}if(e==="ordinal")return N0(r)?n(r):Ct(r)&&a(r)?r+"":"-";var u=Na(r);return a(u)?nD(u):N0(r)?n(r):typeof r=="boolean"?r+"":"-"}var g5=["a","b","c","d","e","f","g"],iD=function(r,e){return"{"+r+(e??"")+"}"};function Rw(r,e,t){pe(e)||(e=[e]);var i=e.length;if(!i)return"";for(var n=e[0].$vars||[],a=0;a<n.length;a++){var o=g5[a];r=r.replace(iD(o),iD(o,0))}for(var s=0;s<i;s++)for(var l=0;l<n.length;l++){var u=e[s][n[l]];r=r.replace(iD(g5[l],s),t?yn(u):u)}return r}function y5(r,e,t){return N(e,function(i,n){r=r.replace("{"+n+"}",t?yn(i):i)}),r}function _5(r,e){var t=Ce(r)?{color:r,extraCssText:e}:r||{},i=t.color,n=t.type;e=t.extraCssText;var a=t.renderMode||"html";if(!i)return"";if(a==="html")return n==="subItem"?'<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;border-radius:4px;width:4px;height:4px;background-color:'+yn(i)+";"+(e||"")+'"></span>':'<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:'+yn(i)+";"+(e||"")+'"></span>';var o=t.markerId||"markerX";return{renderMode:a,content:"{"+o+"|} ",style:n==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}}function Ws(r,e){return e=e||"transparent",Ce(r)?r:qe(r)&&r.colorStops&&(r.colorStops[0]||{}).color||e}function Gp(r,e){if(e==="_blank"||e==="blank"){var t=window.open();t.opener=null,t.location.href=r}else window.open(r,e)}var Lw=N,aD=["left","right","top","bottom","width","height"],Hp=[["width","left","right"],["height","top","bottom"]];function oD(r,e,t,i,n){var a=0,o=0;i==null&&(i=1/0),n==null&&(n=1/0);var s=0;e.eachChild(function(l,u){var c=l.getBoundingRect(),f=e.childAt(u+1),h=f&&f.getBoundingRect(),p,d;if(r==="horizontal"){var g=c.width+(h?-h.x+c.x:0);p=a+g,p>i||l.newline?(a=0,p=g,o+=s+t,s=c.height):s=Math.max(s,c.height)}else{var m=c.height+(h?-h.y+c.y:0);d=o+m,d>n||l.newline?(a+=s+t,o=0,d=m,s=c.width):s=Math.max(s,c.width)}l.newline||(l.x=a,l.y=o,l.markRedraw(),r==="horizontal"?a=p+t:o=d+t)})}var Xs=oD,SVe=ot(oD,"vertical"),MVe=ot(oD,"horizontal");function x5(r,e,t){var i=e.width,n=e.height,a=ze(r.left,i),o=ze(r.top,n),s=ze(r.right,i),l=ze(r.bottom,n);return(isNaN(a)||isNaN(parseFloat(r.left)))&&(a=0),(isNaN(s)||isNaN(parseFloat(r.right)))&&(s=i),(isNaN(o)||isNaN(parseFloat(r.top)))&&(o=0),(isNaN(l)||isNaN(parseFloat(r.bottom)))&&(l=n),t=Hs(t||0),{width:Math.max(s-a-t[1]-t[3],0),height:Math.max(l-o-t[0]-t[2],0)}}function xr(r,e,t){t=Hs(t||0);var i=e.width,n=e.height,a=ze(r.left,i),o=ze(r.top,n),s=ze(r.right,i),l=ze(r.bottom,n),u=ze(r.width,i),c=ze(r.height,n),f=t[2]+t[0],h=t[1]+t[3],p=r.aspect;switch(isNaN(u)&&(u=i-s-h-a),isNaN(c)&&(c=n-l-f-o),p!=null&&(isNaN(u)&&isNaN(c)&&(p>i/n?u=i*.8:c=n*.8),isNaN(u)&&(u=p*c),isNaN(c)&&(c=u/p)),isNaN(a)&&(a=i-s-u-h),isNaN(o)&&(o=n-l-c-f),r.left||r.right){case"center":a=i/2-u/2-t[3];break;case"right":a=i-u-h;break}switch(r.top||r.bottom){case"middle":case"center":o=n/2-c/2-t[0];break;case"bottom":o=n-c-f;break}a=a||0,o=o||0,isNaN(u)&&(u=i-h-a-(s||0)),isNaN(c)&&(c=n-f-o-(l||0));var d=new lt(a+t[3],o+t[0],u,c);return d.margin=t,d}function Cf(r,e,t,i,n,a){var o=!n||!n.hv||n.hv[0],s=!n||!n.hv||n.hv[1],l=n&&n.boundingMode||"all";if(a=a||r,a.x=r.x,a.y=r.y,!o&&!s)return!1;var u;if(l==="raw")u=r.type==="group"?new lt(0,0,+e.width||0,+e.height||0):r.getBoundingRect();else if(u=r.getBoundingRect(),r.needLocalTransform()){var c=r.getLocalTransform();u=u.clone(),u.applyTransform(c)}var f=xr(Ye({width:u.width,height:u.height},e),t,i),h=o?f.x-u.x:0,p=s?f.y-u.y:0;return l==="raw"?(a.x=h,a.y=p):(a.x+=h,a.y+=p),a===r&&r.markRedraw(),!0}function S5(r,e){return r[Hp[e][0]]!=null||r[Hp[e][1]]!=null&&r[Hp[e][2]]!=null}function Rf(r){var e=r.layoutMode||r.constructor.layoutMode;return qe(e)?e:e?{type:e}:null}function Va(r,e,t){var i=t&&t.ignoreSize;!pe(i)&&(i=[i,i]);var n=o(Hp[0],0),a=o(Hp[1],1);u(Hp[0],r,n),u(Hp[1],r,a);function o(c,f){var h={},p=0,d={},g=0,m=2;if(Lw(c,function(y){d[y]=r[y]}),Lw(c,function(y){s(e,y)&&(h[y]=d[y]=e[y]),l(h,y)&&p++,l(d,y)&&g++}),i[f])return l(e,c[1])?d[c[2]]=null:l(e,c[2])&&(d[c[1]]=null),d;if(g===m||!p)return d;if(p>=m)return h;for(var v=0;v<c.length;v++){var _=c[v];if(!s(h,_)&&s(r,_)){h[_]=r[_];break}}return h}function s(c,f){return c.hasOwnProperty(f)}function l(c,f){return c[f]!=null&&c[f]!=="auto"}function u(c,f,h){Lw(c,function(p){f[p]=h[p]})}}function is(r){return sD({},r)}function sD(r,e){return e&&r&&Lw(aD,function(t){e.hasOwnProperty(t)&&(r[t]=e[t])}),r}var rfe=vt(),uv=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t,i,n)||this;return a.uid=rs("ec_cpt_model"),a}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n)},e.prototype.mergeDefaultAndTheme=function(t,i){var n=Rf(this),a=n?is(t):{},o=i.getTheme();_t(t,o.get(this.mainType)),_t(t,this.getDefaultOption()),n&&Va(t,a,n)},e.prototype.mergeOption=function(t,i){_t(this.option,t,!0);var n=Rf(this);n&&Va(this.option,t,n)},e.prototype.optionUpdated=function(t,i){},e.prototype.getDefaultOption=function(){var t=this.constructor;if(!dH(t))return t.defaultOption;var i=rfe(this);if(!i.defaultOption){for(var n=[],a=t;a;){var o=a.prototype.defaultOption;o&&n.push(o),a=a.superClass}for(var s={},l=n.length-1;l>=0;l--)s=_t(s,n[l],!0);i.defaultOption=s}return i.defaultOption},e.prototype.getReferringComponents=function(t,i){var n=t+"Index",a=t+"Id";return _f(this.ecModel,t,{index:this.get(n,!0),id:this.get(a,!0)},i)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(Zt);Yb(uv,Zt);xf(uv);a5(uv);o5(uv,ife);function ife(r){var e=[];return N(uv.getClassesByMainType(r),function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])}),e=de(e,function(t){return Oa(t).main}),r!=="dataset"&&dt(e,"dataset")<=0&&e.unshift("dataset"),e}var Pt=uv;var M5="";typeof navigator<"u"&&(M5=navigator.platform||"");var cv="rgba(0, 0, 0, 0.2)",b5={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:cv,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:cv,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:cv,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:cv,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:cv,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:cv,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:M5.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var Pw=ke(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),fn="original",Ei="arrayRows",En="objectRows",xo="keyedColumns",So="typedArray",lD="unknown",Ga="column",Iu="row";var Ji={Must:1,Might:2,Not:3},w5=vt();function T5(r){w5(r).datasetMap=ke()}function Dw(r,e,t){var i={},n=Iw(e);if(!n||!r)return i;var a=[],o=[],s=e.ecModel,l=w5(s).datasetMap,u=n.uid+"_"+t.seriesLayoutBy,c,f;r=r.slice(),N(r,function(g,m){var v=qe(g)?g:r[m]={name:g};v.type==="ordinal"&&c==null&&(c=m,f=d(v)),i[v.name]=[]});var h=l.get(u)||l.set(u,{categoryWayDim:f,valueWayDim:0});N(r,function(g,m){var v=g.name,_=d(g);if(c==null){var y=h.valueWayDim;p(i[v],y,_),p(o,y,_),h.valueWayDim+=_}else if(c===m)p(i[v],0,_),p(a,0,_);else{var y=h.categoryWayDim;p(i[v],y,_),p(o,y,_),h.categoryWayDim+=_}});function p(g,m,v){for(var _=0;_<v;_++)g.push(m+_)}function d(g){var m=g.dimsDef;return m?m.length:1}return a.length&&(i.itemName=a),o.length&&(i.seriesName=o),i}function fv(r,e,t){var i={},n=Iw(r);if(!n)return i;var a=e.sourceFormat,o=e.dimensionsDefine,s;(a===En||a===xo)&&N(o,function(c,f){(qe(c)?c.name:c)==="name"&&(s=f)});var l=function(){for(var c={},f={},h=[],p=0,d=Math.min(5,t);p<d;p++){var g=A5(e.data,a,e.seriesLayoutBy,o,e.startIndex,p);h.push(g);var m=g===Ji.Not;if(m&&c.v==null&&p!==s&&(c.v=p),(c.n==null||c.n===c.v||!m&&h[c.n]===Ji.Not)&&(c.n=p),v(c)&&h[c.n]!==Ji.Not)return c;m||(g===Ji.Might&&f.v==null&&p!==s&&(f.v=p),(f.n==null||f.n===f.v)&&(f.n=p))}function v(_){return _.v!=null&&_.n!=null}return v(c)?c:v(f)?f:null}();if(l){i.value=[l.v];var u=s??l.n;i.itemName=[u],i.seriesName=[u]}return i}function Iw(r){var e=r.get("data",!0);if(!e)return _f(r.ecModel,"dataset",{index:r.get("datasetIndex",!0),id:r.get("datasetId",!0)},Ar).models[0]}function E5(r){return!r.get("transform",!0)&&!r.get("fromTransformResult",!0)?[]:_f(r.ecModel,"dataset",{index:r.get("fromDatasetIndex",!0),id:r.get("fromDatasetId",!0)},Ar).models}function Nw(r,e){return A5(r.data,r.sourceFormat,r.seriesLayoutBy,r.dimensionsDefine,r.startIndex,e)}function A5(r,e,t,i,n,a){var o,s=5;if(bi(r))return Ji.Not;var l,u;if(i){var c=i[a];qe(c)?(l=c.name,u=c.type):Ce(c)&&(l=c)}if(u!=null)return u==="ordinal"?Ji.Must:Ji.Not;if(e===Ei){var f=r;if(t===Iu){for(var h=f[a],p=0;p<(h||[]).length&&p<s;p++)if((o=x(h[n+p]))!=null)return o}else for(var p=0;p<f.length&&p<s;p++){var d=f[n+p];if(d&&(o=x(d[a]))!=null)return o}}else if(e===En){var g=r;if(!l)return Ji.Not;for(var p=0;p<g.length&&p<s;p++){var m=g[p];if(m&&(o=x(m[l]))!=null)return o}}else if(e===xo){var v=r;if(!l)return Ji.Not;var h=v[l];if(!h||bi(h))return Ji.Not;for(var p=0;p<h.length&&p<s;p++)if((o=x(h[p]))!=null)return o}else if(e===fn)for(var _=r,p=0;p<_.length&&p<s;p++){var m=_[p],y=zs(m);if(!pe(y))return Ji.Not;if((o=x(y[a]))!=null)return o}function x(M){var S=Ce(M);if(M!=null&&isFinite(M)&&M!=="")return S?Ji.Might:Ji.Not;if(S&&M!=="-")return Ji.Must}return Ji.Not}var uD=ke();function C5(r,e){kr(uD.get(r)==null&&e),uD.set(r,e)}function R5(r,e,t){var i=uD.get(e);if(!i)return t;var n=i(r);if(!n)return t;if(0)for(var a;a<n.length;a++);return t.concat(n)}var L5=vt(),nfe=vt(),P_=function(){function r(){}return r.prototype.getColorFromPalette=function(e,t,i){var n=$t(this.get("color",!0)),a=this.get("colorLayer",!0);return P5(this,L5,n,a,e,t,i)},r.prototype.clearColorPalette=function(){ofe(this,L5)},r}();function D_(r,e,t,i){var n=$t(r.get(["aria","decal","decals"]));return P5(r,nfe,n,null,e,t,i)}function afe(r,e){for(var t=r.length,i=0;i<t;i++)if(r[i].length>e)return r[i];return r[t-1]}function P5(r,e,t,i,n,a,o){a=a||r;var s=e(a),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(n))return u[n];var c=o==null||!i?t:afe(i,o);if(c=c||t,!(!c||!c.length)){var f=c[l];return n&&(u[n]=f),s.paletteIdx=(l+1)%c.length,f}}function ofe(r,e){e(r).paletteIdx=0,e(r).paletteNameMap={}}var Uw,I_,D5,I5="\0_ec_inner",sfe=1;var z5=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(t,i,n,a,o,s){a=a||{},this.option=null,this._theme=new Zt(a),this._locale=new Zt(o),this._optionManager=s},e.prototype.setOption=function(t,i,n){var a=O5(i);this._optionManager.setOption(t,n,a),this._resetOption(null,a)},e.prototype.resetOption=function(t,i){return this._resetOption(t,O5(i))},e.prototype._resetOption=function(t,i){var n=!1,a=this._optionManager;if(!t||t==="recreate"){var o=a.mountOption(t==="recreate");!this.option||t==="recreate"?D5(this,o):(this.restoreData(),this._mergeOption(o,i)),n=!0}if((t==="timeline"||t==="media")&&this.restoreData(),!t||t==="recreate"||t==="timeline"){var s=a.getTimelineOption(this);s&&(n=!0,this._mergeOption(s,i))}if(!t||t==="recreate"||t==="media"){var l=a.getMediaOption(this);l.length&&N(l,function(u){n=!0,this._mergeOption(u,i)},this)}return n},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,i){var n=this.option,a=this._componentsMap,o=this._componentsCount,s=[],l=ke(),u=i&&i.replaceMergeMainTypeMap;T5(this),N(t,function(f,h){f!=null&&(Pt.hasClass(h)?h&&(s.push(h),l.set(h,!0)):n[h]=n[h]==null?Qe(f):_t(n[h],f,!0))}),u&&u.each(function(f,h){Pt.hasClass(h)&&!l.get(h)&&(s.push(h),l.set(h,!0))}),Pt.topologicalTravel(s,Pt.getAllClassMainTypes(),c,this);function c(f){var h=R5(this,f,$t(t[f])),p=a.get(f),d=p?u&&u.get(f)?"replaceMerge":"normalMerge":"replaceAll",g=Wb(p,h,d);lH(g,f,Pt),n[f]=null,a.set(f,null),o.set(f,0);var m=[],v=[],_=0,y,x;N(g,function(M,S){var w=M.existing,T=M.newOption;if(!T)w&&(w.mergeOption({},this),w.optionUpdated({},!1));else{var C=f==="series",b=Pt.getClass(f,M.keyInfo.subType,!C);if(!b){if(0)var E,I;return}if(f==="tooltip"){if(y)return;y=!0}if(w&&w.constructor===b)w.name=M.keyInfo.name,w.mergeOption(T,this),w.optionUpdated(T,!1);else{var R=fe({componentIndex:S},M.keyInfo);w=new b(T,this,this,R),fe(w,R),M.brandNew&&(w.__requireNewView=!0),w.init(T,this,this),w.optionUpdated(null,!0)}}w?(m.push(w.option),v.push(w),_++):(m.push(void 0),v.push(void 0))},this),n[f]=m,a.set(f,v),o.set(f,_),f==="series"&&Uw(this)}this._seriesIndices||Uw(this)},e.prototype.getOption=function(){var t=Qe(this.option);return N(t,function(i,n){if(Pt.hasClass(n)){for(var a=$t(i),o=a.length,s=!1,l=o-1;l>=0;l--)a[l]&&!Hm(a[l])?s=!0:(a[l]=null,!s&&o--);a.length=o,t[n]=a}}),delete t[I5],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,i){var n=this._componentsMap.get(t);if(n){var a=n[i||0];if(a)return a;if(i==null){for(var o=0;o<n.length;o++)if(n[o])return n[o]}}},e.prototype.queryComponents=function(t){var i=t.mainType;if(!i)return[];var n=t.index,a=t.id,o=t.name,s=this._componentsMap.get(i);if(!s||!s.length)return[];var l;return n!=null?(l=[],N($t(n),function(u){s[u]&&l.push(s[u])})):a!=null?l=N5("id",a,s):o!=null?l=N5("name",o,s):l=Wt(s,function(u){return!!u}),U5(l,t)},e.prototype.findComponents=function(t){var i=t.query,n=t.mainType,a=s(i),o=a?this.queryComponents(a):Wt(this._componentsMap.get(n),function(u){return!!u});return l(U5(o,t));function s(u){var c=n+"Index",f=n+"Id",h=n+"Name";return u&&(u[c]!=null||u[f]!=null||u[h]!=null)?{mainType:n,index:u[c],id:u[f],name:u[h]}:null}function l(u){return t.filter?Wt(u,t.filter):u}},e.prototype.eachComponent=function(t,i,n){var a=this._componentsMap;if(He(t)){var o=i,s=t;a.each(function(f,h){for(var p=0;f&&p<f.length;p++){var d=f[p];d&&s.call(o,h,d,d.componentIndex)}})}else for(var l=Ce(t)?a.get(t):qe(t)?this.findComponents(t):null,u=0;l&&u<l.length;u++){var c=l[u];c&&i.call(n,c,c.componentIndex)}},e.prototype.getSeriesByName=function(t){var i=qr(t,null);return Wt(this._componentsMap.get("series"),function(n){return!!n&&i!=null&&n.name===i})},e.prototype.getSeriesByIndex=function(t){return this._componentsMap.get("series")[t]},e.prototype.getSeriesByType=function(t){return Wt(this._componentsMap.get("series"),function(i){return!!i&&i.subType===t})},e.prototype.getSeries=function(){return Wt(this._componentsMap.get("series"),function(t){return!!t})},e.prototype.getSeriesCount=function(){return this._componentsCount.get("series")},e.prototype.eachSeries=function(t,i){I_(this),N(this._seriesIndices,function(n){var a=this._componentsMap.get("series")[n];t.call(i,a,n)},this)},e.prototype.eachRawSeries=function(t,i){N(this._componentsMap.get("series"),function(n){n&&t.call(i,n,n.componentIndex)})},e.prototype.eachSeriesByType=function(t,i,n){I_(this),N(this._seriesIndices,function(a){var o=this._componentsMap.get("series")[a];o.subType===t&&i.call(n,o,a)},this)},e.prototype.eachRawSeriesByType=function(t,i,n){return N(this.getSeriesByType(t),i,n)},e.prototype.isSeriesFiltered=function(t){return I_(this),this._seriesIndicesMap.get(t.componentIndex)==null},e.prototype.getCurrentSeriesIndices=function(){return(this._seriesIndices||[]).slice()},e.prototype.filterSeries=function(t,i){I_(this);var n=[];N(this._seriesIndices,function(a){var o=this._componentsMap.get("series")[a];t.call(i,o,a)&&n.push(a)},this),this._seriesIndices=n,this._seriesIndicesMap=ke(n)},e.prototype.restoreData=function(t){Uw(this);var i=this._componentsMap,n=[];i.each(function(a,o){Pt.hasClass(o)&&n.push(o)}),Pt.topologicalTravel(n,Pt.getAllClassMainTypes(),function(a){N(i.get(a),function(o){o&&(a!=="series"||!lfe(o,t))&&o.restoreData()})})},e.internalField=function(){Uw=function(t){var i=t._seriesIndices=[];N(t._componentsMap.get("series"),function(n){n&&i.push(n.componentIndex)}),t._seriesIndicesMap=ke(i)},I_=function(t){},D5=function(t,i){t.option={},t.option[I5]=sfe,t._componentsMap=ke({series:[]}),t._componentsCount=ke();var n=i.aria;qe(n)&&n.enabled==null&&(n.enabled=!0),ufe(i,t._theme.option),_t(i,b5,!1),t._mergeOption(i,null)}}(),e}(Zt);function lfe(r,e){if(e){var t=e.seriesIndex,i=e.seriesId,n=e.seriesName;return t!=null&&r.componentIndex!==t||i!=null&&r.id!==i||n!=null&&r.name!==n}}function ufe(r,e){var t=r.color&&!r.colorLayer;N(e,function(i,n){n==="colorLayer"&&t||Pt.hasClass(n)||(typeof i=="object"?r[n]=r[n]?_t(r[n],i,!1):Qe(i):r[n]==null&&(r[n]=i))})}function N5(r,e,t){if(pe(e)){var i=ke();return N(e,function(a){if(a!=null){var o=qr(a,null);o!=null&&i.set(a,!0)}}),Wt(t,function(a){return a&&i.get(a[r])})}else{var n=qr(e,null);return Wt(t,function(a){return a&&n!=null&&a[r]===n})}}function U5(r,e){return e.hasOwnProperty("subType")?Wt(r,function(t){return t&&t.subType===e.subType}):r}function O5(r){var e=ke();return r&&N($t(r.replaceMerge),function(t){e.set(t,!0)}),{replaceMergeMainTypeMap:e}}br(z5,P_);var Ow=z5;var cfe=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isSSR","isDisposed","on","off","getDataURL","getConnectedDataURL","getOption","getId","updateLabelLayout"],ffe=function(){function r(e){N(cfe,function(t){this[t]=Be(e[t],e)},this)}return r}(),zw=ffe;var cD={},hfe=function(){function r(){this._coordinateSystems=[]}return r.prototype.create=function(e,t){var i=[];N(cD,function(n,a){var o=n.create(e,t);i=i.concat(o||[])}),this._coordinateSystems=i},r.prototype.update=function(e,t){N(this._coordinateSystems,function(i){i.update&&i.update(e,t)})},r.prototype.getCoordinateSystems=function(){return this._coordinateSystems.slice()},r.register=function(e,t){cD[e]=t},r.get=function(e){return cD[e]},r}(),Nu=hfe;var pfe=/^(min|max)?(.+)$/,dfe=function(){function r(e){this._timelineOptions=[],this._mediaList=[],this._currentMediaIndices=[],this._api=e}return r.prototype.setOption=function(e,t,i){e&&(N($t(e.series),function(o){o&&o.data&&bi(o.data)&&tp(o.data)}),N($t(e.dataset),function(o){o&&o.source&&bi(o.source)&&tp(o.source)})),e=Qe(e);var n=this._optionBackup,a=mfe(e,t,!n);this._newBaseOption=a.baseOption,n?(a.timelineOptions.length&&(n.timelineOptions=a.timelineOptions),a.mediaList.length&&(n.mediaList=a.mediaList),a.mediaDefault&&(n.mediaDefault=a.mediaDefault)):this._optionBackup=a},r.prototype.mountOption=function(e){var t=this._optionBackup;return this._timelineOptions=t.timelineOptions,this._mediaList=t.mediaList,this._mediaDefault=t.mediaDefault,this._currentMediaIndices=[],Qe(e?t.baseOption:this._newBaseOption)},r.prototype.getTimelineOption=function(e){var t,i=this._timelineOptions;if(i.length){var n=e.getComponent("timeline");n&&(t=Qe(i[n.getCurrentIndex()]))}return t},r.prototype.getMediaOption=function(e){var t=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,a=this._mediaDefault,o=[],s=[];if(!n.length&&!a)return s;for(var l=0,u=n.length;l<u;l++)vfe(n[l].query,t,i)&&o.push(l);return!o.length&&a&&(o=[-1]),o.length&&!yfe(o,this._currentMediaIndices)&&(s=de(o,function(c){return Qe(c===-1?a.option:n[c].option)})),this._currentMediaIndices=o,s},r}();function mfe(r,e,t){var i=[],n,a,o=r.baseOption,s=r.timeline,l=r.options,u=r.media,c=!!r.media,f=!!(l||s||o&&o.timeline);o?(a=o,a.timeline||(a.timeline=s)):((f||c)&&(r.options=r.media=null),a=r),c&&pe(u)&&N(u,function(p){p&&p.option&&(p.query?i.push(p):n||(n=p))}),h(a),N(l,function(p){return h(p)}),N(i,function(p){return h(p.option)});function h(p){N(e,function(d){d(p,t)})}return{baseOption:a,timelineOptions:l||[],mediaDefault:n,mediaList:i}}function vfe(r,e,t){var i={width:e,height:t,aspectratio:e/t},n=!0;return N(r,function(a,o){var s=o.match(pfe);if(!(!s||!s[1]||!s[2])){var l=s[1],u=s[2].toLowerCase();gfe(i[u],a,l)||(n=!1)}}),n}function gfe(r,e,t){return t==="min"?r>=e:t==="max"?r<=e:r===e}function yfe(r,e){return r.join(",")===e.join(",")}var F5=dfe;var Ys=N,U_=qe,B5=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function fD(r){var e=r&&r.itemStyle;if(e)for(var t=0,i=B5.length;t<i;t++){var n=B5[t],a=e.normal,o=e.emphasis;a&&a[n]&&(r[n]=r[n]||{},r[n].normal?_t(r[n].normal,a[n]):r[n].normal=a[n],a[n]=null),o&&o[n]&&(r[n]=r[n]||{},r[n].emphasis?_t(r[n].emphasis,o[n]):r[n].emphasis=o[n],o[n]=null)}}function Wn(r,e,t){if(r&&r[e]&&(r[e].normal||r[e].emphasis)){var i=r[e].normal,n=r[e].emphasis;i&&(t?(r[e].normal=r[e].emphasis=null,Ye(r[e],i)):r[e]=i),n&&(r.emphasis=r.emphasis||{},r.emphasis[e]=n,n.focus&&(r.emphasis.focus=n.focus),n.blurScope&&(r.emphasis.blurScope=n.blurScope))}}function N_(r){Wn(r,"itemStyle"),Wn(r,"lineStyle"),Wn(r,"areaStyle"),Wn(r,"label"),Wn(r,"labelLine"),Wn(r,"upperLabel"),Wn(r,"edgeLabel")}function Ii(r,e){var t=U_(r)&&r[e],i=U_(t)&&t.textStyle;if(i)for(var n=0,a=$L.length;n<a;n++){var o=$L[n];i.hasOwnProperty(o)&&(t[o]=i[o])}}function ns(r){r&&(N_(r),Ii(r,"label"),r.emphasis&&Ii(r.emphasis,"label"))}function _fe(r){if(U_(r)){fD(r),N_(r),Ii(r,"label"),Ii(r,"upperLabel"),Ii(r,"edgeLabel"),r.emphasis&&(Ii(r.emphasis,"label"),Ii(r.emphasis,"upperLabel"),Ii(r.emphasis,"edgeLabel"));var e=r.markPoint;e&&(fD(e),ns(e));var t=r.markLine;t&&(fD(t),ns(t));var i=r.markArea;i&&ns(i);var n=r.data;if(r.type==="graph"){n=n||r.nodes;var a=r.links||r.edges;if(a&&!bi(a))for(var o=0;o<a.length;o++)ns(a[o]);N(r.categories,function(u){N_(u)})}if(n&&!bi(n))for(var o=0;o<n.length;o++)ns(n[o]);if(e=r.markPoint,e&&e.data)for(var s=e.data,o=0;o<s.length;o++)ns(s[o]);if(t=r.markLine,t&&t.data)for(var l=t.data,o=0;o<l.length;o++)pe(l[o])?(ns(l[o][0]),ns(l[o][1])):ns(l[o]);r.type==="gauge"?(Ii(r,"axisLabel"),Ii(r,"title"),Ii(r,"detail")):r.type==="treemap"?(Wn(r.breadcrumb,"itemStyle"),N(r.levels,function(u){N_(u)})):r.type==="tree"&&N_(r.leaves)}}function Uu(r){return pe(r)?r:r?[r]:[]}function k5(r){return(pe(r)?r[0]:r)||{}}function hD(r,e){Ys(Uu(r.series),function(i){U_(i)&&_fe(i)});var t=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","parallelAxis","radar"];e&&t.push("valueAxis","categoryAxis","logAxis","timeAxis"),Ys(t,function(i){Ys(Uu(r[i]),function(n){n&&(Ii(n,"axisLabel"),Ii(n.axisPointer,"label"))})}),Ys(Uu(r.parallel),function(i){var n=i&&i.parallelAxisDefault;Ii(n,"axisLabel"),Ii(n&&n.axisPointer,"label")}),Ys(Uu(r.calendar),function(i){Wn(i,"itemStyle"),Ii(i,"dayLabel"),Ii(i,"monthLabel"),Ii(i,"yearLabel")}),Ys(Uu(r.radar),function(i){Ii(i,"name"),i.name&&i.axisName==null&&(i.axisName=i.name,delete i.name),i.nameGap!=null&&i.axisNameGap==null&&(i.axisNameGap=i.nameGap,delete i.nameGap)}),Ys(Uu(r.geo),function(i){U_(i)&&(ns(i),Ys(Uu(i.regions),function(n){ns(n)}))}),Ys(Uu(r.timeline),function(i){ns(i),Wn(i,"label"),Wn(i,"itemStyle"),Wn(i,"controlStyle",!0);var n=i.data;pe(n)&&N(n,function(a){qe(a)&&(Wn(a,"label"),Wn(a,"itemStyle"))})}),Ys(Uu(r.toolbox),function(i){Wn(i,"iconStyle"),Ys(i.feature,function(n){Wn(n,"iconStyle")})}),Ii(k5(r.axisPointer),"label"),Ii(k5(r.tooltip).axisPointer,"label")}function xfe(r,e){for(var t=e.split(","),i=r,n=0;n<t.length&&(i=i&&i[t[n]],i!=null);n++);return i}function Sfe(r,e,t,i){for(var n=e.split(","),a=r,o,s=0;s<n.length-1;s++)o=n[s],a[o]==null&&(a[o]={}),a=a[o];(i||a[n[s]]==null)&&(a[n[s]]=t)}function V5(r){r&&N(Mfe,function(e){e[0]in r&&!(e[1]in r)&&(r[e[1]]=r[e[0]])})}var Mfe=[["x","left"],["y","top"],["x2","right"],["y2","bottom"]],bfe=["grid","geo","parallel","legend","toolbox","title","visualMap","dataZoom","timeline"],pD=[["borderRadius","barBorderRadius"],["borderColor","barBorderColor"],["borderWidth","barBorderWidth"]];function O_(r){var e=r&&r.itemStyle;if(e)for(var t=0;t<pD.length;t++){var i=pD[t][1],n=pD[t][0];e[i]!=null&&(e[n]=e[i])}}function G5(r){r&&r.alignTo==="edge"&&r.margin!=null&&r.edgeDistance==null&&(r.edgeDistance=r.margin)}function H5(r){r&&r.downplay&&!r.blur&&(r.blur=r.downplay)}function wfe(r){r&&r.focusNodeAdjacency!=null&&(r.emphasis=r.emphasis||{},r.emphasis.focus==null&&(r.emphasis.focus="adjacency"))}function W5(r,e){if(r)for(var t=0;t<r.length;t++)e(r[t]),r[t]&&W5(r[t].children,e)}function Fw(r,e){hD(r,e),r.series=$t(r.series),N(r.series,function(t){if(qe(t)){var i=t.type;if(i==="line")t.clipOverflow!=null&&(t.clip=t.clipOverflow);else if(i==="pie"||i==="gauge"){t.clockWise!=null&&(t.clockwise=t.clockWise),G5(t.label);var n=t.data;if(n&&!bi(n))for(var a=0;a<n.length;a++)G5(n[a]);t.hoverOffset!=null&&(t.emphasis=t.emphasis||{},(t.emphasis.scaleSize=null)&&(t.emphasis.scaleSize=t.hoverOffset))}else if(i==="gauge"){var o=xfe(t,"pointer.color");o!=null&&Sfe(t,"itemStyle.color",o)}else if(i==="bar"){O_(t),O_(t.backgroundStyle),O_(t.emphasis);var n=t.data;if(n&&!bi(n))for(var a=0;a<n.length;a++)typeof n[a]=="object"&&(O_(n[a]),O_(n[a]&&n[a].emphasis))}else if(i==="sunburst"){var s=t.highlightPolicy;s&&(t.emphasis=t.emphasis||{},t.emphasis.focus||(t.emphasis.focus=s)),H5(t),W5(t.data,H5)}else i==="graph"||i==="sankey"?wfe(t):i==="map"&&(t.mapType&&!t.map&&(t.map=t.mapType),t.mapLocation&&Ye(t,t.mapLocation));t.hoverAnimation!=null&&(t.emphasis=t.emphasis||{},t.emphasis&&t.emphasis.scale==null&&(t.emphasis.scale=t.hoverAnimation)),V5(t)}}),r.dataRange&&(r.visualMap=r.dataRange),N(bfe,function(t){var i=r[t];i&&(pe(i)||(i=[i]),N(i,function(n){V5(n)}))})}function dD(r){var e=ke();r.eachSeries(function(t){var i=t.get("stack");if(i){var n=e.get(i)||e.set(i,[]),a=t.getData(),o={stackResultDimension:a.getCalculationInfo("stackResultDimension"),stackedOverDimension:a.getCalculationInfo("stackedOverDimension"),stackedDimension:a.getCalculationInfo("stackedDimension"),stackedByDimension:a.getCalculationInfo("stackedByDimension"),isStackedByIndex:a.getCalculationInfo("isStackedByIndex"),data:a,seriesModel:t};if(!o.stackedDimension||!(o.isStackedByIndex||o.stackedByDimension))return;n.length&&a.setCalculationInfo("stackedOnSeries",n[n.length-1].seriesModel),n.push(o)}}),e.each(Tfe)}function Tfe(r){N(r,function(e,t){var i=[],n=[NaN,NaN],a=[e.stackResultDimension,e.stackedOverDimension],o=e.data,s=e.isStackedByIndex,l=e.seriesModel.get("stackStrategy")||"samesign";o.modify(a,function(u,c,f){var h=o.get(e.stackedDimension,f);if(isNaN(h))return n;var p,d;s?d=o.getRawIndex(f):p=o.get(e.stackedByDimension,f);for(var g=NaN,m=t-1;m>=0;m--){var v=r[m];if(s||(d=v.data.rawIndexOf(v.stackedByDimension,p)),d>=0){var _=v.data.getByRawIndex(v.stackResultDimension,d);if(l==="all"||l==="positive"&&_>0||l==="negative"&&_<0||l==="samesign"&&h>=0&&_>0||l==="samesign"&&h<=0&&_<0){h=$G(h,_),g=_;break}}}return i[0]=h,i[1]=g,i})})}var Bw=function(){function r(e){this.data=e.data||(e.sourceFormat===xo?{}:[]),this.sourceFormat=e.sourceFormat||lD,this.seriesLayoutBy=e.seriesLayoutBy||Ga,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var t=this.dimensionsDefine=e.dimensionsDefine;if(t)for(var i=0;i<t.length;i++){var n=t[i];n.type==null&&Nw(this,i)===Ji.Must&&(n.type="ordinal")}}return r}();function hv(r){return r instanceof Bw}function z_(r,e,t){t=t||mD(r);var i=e.seriesLayoutBy,n=Efe(r,t,i,e.sourceHeader,e.dimensions),a=new Bw({data:r,sourceFormat:t,seriesLayoutBy:i,dimensionsDefine:n.dimensionsDefine,startIndex:n.startIndex,dimensionsDetectedCount:n.dimensionsDetectedCount,metaRawOption:Qe(e)});return a}function pv(r){return new Bw({data:r,sourceFormat:bi(r)?So:fn})}function q5(r){return new Bw({data:r.data,sourceFormat:r.sourceFormat,seriesLayoutBy:r.seriesLayoutBy,dimensionsDefine:Qe(r.dimensionsDefine),startIndex:r.startIndex,dimensionsDetectedCount:r.dimensionsDetectedCount})}function mD(r){var e=lD;if(bi(r))e=So;else if(pe(r)){r.length===0&&(e=Ei);for(var t=0,i=r.length;t<i;t++){var n=r[t];if(n!=null){if(pe(n)||bi(n)){e=Ei;break}else if(qe(n)){e=En;break}}}}else if(qe(r)){for(var a in r)if(tt(r,a)&&ci(r[a])){e=xo;break}}return e}function Efe(r,e,t,i,n){var a,o;if(!r)return{dimensionsDefine:X5(n),startIndex:o,dimensionsDetectedCount:a};if(e===Ei){var s=r;i==="auto"||i==null?Y5(function(u){u!=null&&u!=="-"&&(Ce(u)?o==null&&(o=1):o=0)},t,s,10):o=Ct(i)?i:i?1:0,!n&&o===1&&(n=[],Y5(function(u,c){n[c]=u!=null?u+"":""},t,s,1/0)),a=n?n.length:t===Iu?s.length:s[0]?s[0].length:null}else if(e===En)n||(n=Afe(r));else if(e===xo)n||(n=[],N(r,function(u,c){n.push(c)}));else if(e===fn){var l=zs(r[0]);a=pe(l)&&l.length||1}return{startIndex:o,dimensionsDefine:X5(n),dimensionsDetectedCount:a}}function Afe(r){for(var e=0,t;e<r.length&&!(t=r[e++]););if(t)return bt(t)}function X5(r){if(r){var e=ke();return de(r,function(t,i){t=qe(t)?t:{name:t};var n={name:t.name,displayName:t.displayName,type:t.type};if(n.name==null)return n;n.name+="",n.displayName==null&&(n.displayName=n.name);var a=e.get(n.name);return a?n.name+="-"+a.count++:e.set(n.name,{count:1}),n})}}function Y5(r,e,t,i){if(e===Iu)for(var n=0;n<t.length&&n<i;n++)r(t[n]?t[n][0]:null,n);else for(var a=t[0]||[],n=0;n<a.length&&n<i;n++)r(a[n],n)}function kw(r){var e=r.sourceFormat;return e===En||e===xo}var Wp,Xp,Yp,Z5,j5,Vw=function(){function r(e,t){var i=hv(e)?e:pv(e);this._source=i;var n=this._data=i.data;i.sourceFormat===So&&(this._offset=0,this._dimSize=t,this._data=n),j5(this,n,i)}return r.prototype.getSource=function(){return this._source},r.prototype.count=function(){return 0},r.prototype.getItem=function(e,t){},r.prototype.appendData=function(e){},r.prototype.clean=function(){},r.protoInitialize=function(){var e=r.prototype;e.pure=!1,e.persistent=!0}(),r.internalField=function(){var e;j5=function(o,s,l){var u=l.sourceFormat,c=l.seriesLayoutBy,f=l.startIndex,h=l.dimensionsDefine,p=Z5[xD(u,c)];if(fe(o,p),u===So)o.getItem=t,o.count=n,o.fillStorage=i;else{var d=gD(u,c);o.getItem=Be(d,null,s,f,h);var g=yD(u,c);o.count=Be(g,null,s,f,h)}};var t=function(o,s){o=o-this._offset,s=s||[];for(var l=this._data,u=this._dimSize,c=u*o,f=0;f<u;f++)s[f]=l[c+f];return s},i=function(o,s,l,u){for(var c=this._data,f=this._dimSize,h=0;h<f;h++){for(var p=u[h],d=p[0]==null?1/0:p[0],g=p[1]==null?-1/0:p[1],m=s-o,v=l[h],_=0;_<m;_++){var y=c[_*f+h];v[o+_]=y,y<d&&(d=y),y>g&&(g=y)}p[0]=d,p[1]=g}},n=function(){return this._data?this._data.length/this._dimSize:0};Z5=(e={},e[Ei+"_"+Ga]={pure:!0,appendData:a},e[Ei+"_"+Iu]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[En]={pure:!0,appendData:a},e[xo]={pure:!0,appendData:function(o){var s=this._data;N(o,function(l,u){for(var c=s[u]||(s[u]=[]),f=0;f<(l||[]).length;f++)c.push(l[f])})}},e[fn]={appendData:a},e[So]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},e);function a(o){for(var s=0;s<o.length;s++)this._data.push(o[s])}}(),r}();var K5=function(r,e,t,i){return r[i]},Cfe=(Wp={},Wp[Ei+"_"+Ga]=function(r,e,t,i){return r[i+e]},Wp[Ei+"_"+Iu]=function(r,e,t,i,n){i+=e;for(var a=n||[],o=r,s=0;s<o.length;s++){var l=o[s];a[s]=l?l[i]:null}return a},Wp[En]=K5,Wp[xo]=function(r,e,t,i,n){for(var a=n||[],o=0;o<t.length;o++){var s=t[o].name,l=r[s];a[o]=l?l[i]:null}return a},Wp[fn]=K5,Wp);function gD(r,e){var t=Cfe[xD(r,e)];return t}var J5=function(r,e,t){return r.length},Rfe=(Xp={},Xp[Ei+"_"+Ga]=function(r,e,t){return Math.max(0,r.length-e)},Xp[Ei+"_"+Iu]=function(r,e,t){var i=r[0];return i?Math.max(0,i.length-e):0},Xp[En]=J5,Xp[xo]=function(r,e,t){var i=t[0].name,n=r[i];return n?n.length:0},Xp[fn]=J5,Xp);function yD(r,e){var t=Rfe[xD(r,e)];return t}var vD=function(r,e,t){return r[e]},Lfe=(Yp={},Yp[Ei]=vD,Yp[En]=function(r,e,t){return r[t]},Yp[xo]=vD,Yp[fn]=function(r,e,t){var i=zs(r);return i instanceof Array?i[e]:i},Yp[So]=vD,Yp);function _D(r){var e=Lfe[r];return e}function xD(r,e){return r===Ei?r+"_"+e:r}function Ou(r,e,t){if(r){var i=r.getRawDataItem(e);if(i!=null){var n=r.getStore(),a=n.getSource().sourceFormat;if(t!=null){var o=r.getDimensionIndex(t),s=n.getDimensionProperty(o);return _D(a)(i,o,s)}else{var l=i;return a===fn&&(l=zs(i)),l}}}}var Pfe=/\{@(.+?)\}/g,dv=function(){function r(){}return r.prototype.getDataParams=function(e,t){var i=this.getData(t),n=this.getRawValue(e,t),a=i.getRawIndex(e),o=i.getName(e),s=i.getRawDataItem(e),l=i.getItemVisual(e,"style"),u=l&&l[i.getItemVisual(e,"drawType")||"fill"],c=l&&l.stroke,f=this.mainType,h=f==="series",p=i.userOutput&&i.userOutput.get();return{componentType:f,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:h?this.subType:null,seriesIndex:this.seriesIndex,seriesId:h?this.id:null,seriesName:h?this.name:null,name:o,dataIndex:a,data:s,dataType:t,value:n,color:u,borderColor:c,dimensionNames:p?p.fullDimensions:null,encode:p?p.encode:null,$vars:["seriesName","name","value"]}},r.prototype.getFormattedLabel=function(e,t,i,n,a,o){t=t||"normal";var s=this.getData(i),l=this.getDataParams(e,i);if(o&&(l.value=o.interpolatedValue),n!=null&&pe(l.value)&&(l.value=l.value[n]),!a){var u=s.getItemModel(e);a=u.get(t==="normal"?["label","formatter"]:[t,"label","formatter"])}if(He(a))return l.status=t,l.dimensionIndex=n,a(l);if(Ce(a)){var c=Rw(a,l);return c.replace(Pfe,function(f,h){var p=h.length,d=h;d.charAt(0)==="["&&d.charAt(p-1)==="]"&&(d=+d.slice(1,p-1));var g=Ou(s,e,d);if(o&&pe(o.interpolatedValue)){var m=s.getDimensionIndex(d);m>=0&&(g=o.interpolatedValue[m])}return g!=null?g+"":""})}},r.prototype.getRawValue=function(e,t){return Ou(this.getData(t),e)},r.prototype.formatTooltip=function(e,t,i){},r}();function SD(r){var e,t;return qe(r)?r.type&&(t=r):e=r,{text:e,frag:t}}function Lf(r){return new Dfe(r)}var Dfe=function(){function r(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return r.prototype.perform=function(e){var t=this._upstream,i=e&&e.skip;if(this._dirty&&t){var n=this.context;n.data=n.outputData=t.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var a;this._plan&&!i&&(a=this._plan(this.context));var o=c(this._modBy),s=this._modDataCount||0,l=c(e&&e.modBy),u=e&&e.modDataCount||0;(o!==l||s!==u)&&(a="reset");function c(_){return!(_>=1)&&(_=1),_}var f;(this._dirty||a==="reset")&&(this._dirty=!1,f=this._doReset(i)),this._modBy=l,this._modDataCount=u;var h=e&&e.step;if(t?this._dueEnd=t._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var p=this._dueIndex,d=Math.min(h!=null?this._dueIndex+h:1/0,this._dueEnd);if(!i&&(f||p<d)){var g=this._progress;if(pe(g))for(var m=0;m<g.length;m++)this._doProgress(g[m],p,d,l,u);else this._doProgress(g,p,d,l,u)}this._dueIndex=d;var v=this._settedOutputEnd!=null?this._settedOutputEnd:d;this._outputDueEnd=v}else this._dueIndex=this._outputDueEnd=this._settedOutputEnd!=null?this._settedOutputEnd:this._dueEnd;return this.unfinished()},r.prototype.dirty=function(){this._dirty=!0,this._onDirty&&this._onDirty(this.context)},r.prototype._doProgress=function(e,t,i,n,a){$5.reset(t,i,n,a),this._callingProgress=e,this._callingProgress({start:t,end:i,count:i-t,next:$5.next},this.context)},r.prototype._doReset=function(e){this._dueIndex=this._outputDueEnd=this._dueEnd=0,this._settedOutputEnd=null;var t,i;!e&&this._reset&&(t=this._reset(this.context),t&&t.progress&&(i=t.forceFirstProgress,t=t.progress),pe(t)&&!t.length&&(t=null)),this._progress=t,this._modBy=this._modDataCount=null;var n=this._downstream;return n&&n.dirty(),i},r.prototype.unfinished=function(){return this._progress&&this._dueIndex<this._dueEnd},r.prototype.pipe=function(e){(this._downstream!==e||this._dirty)&&(this._downstream=e,e._upstream=this,e.dirty())},r.prototype.dispose=function(){this._disposed||(this._upstream&&(this._upstream._downstream=null),this._downstream&&(this._downstream._upstream=null),this._dirty=!1,this._disposed=!0)},r.prototype.getUpstream=function(){return this._upstream},r.prototype.getDownstream=function(){return this._downstream},r.prototype.setOutputEnd=function(e){this._outputDueEnd=this._settedOutputEnd=e},r}();var $5=function(){var r,e,t,i,n,a={reset:function(l,u,c,f){e=l,r=u,t=c,i=f,n=Math.ceil(i/t),a.next=t>1&&i>0?s:o}};return a;function o(){return e<r?e++:null}function s(){var l=e%n*t+Math.ceil(e/n),u=e>=r?null:l<i?l:e;return e++,u}}();function as(r,e){var t=e&&e.type;return t==="ordinal"?r:(t==="time"&&!Ct(r)&&r!=null&&r!=="-"&&(r=+Mn(r)),r==null||r===""?NaN:+r)}var Ife=ke({number:function(r){return parseFloat(r)},time:function(r){return+Mn(r)},trim:function(r){return Ce(r)?Yi(r):r}});function Gw(r){return Ife.get(r)}var Q5={lt:function(r,e){return r<e},lte:function(r,e){return r<=e},gt:function(r,e){return r>e},gte:function(r,e){return r>=e}},Nfe=function(){function r(e,t){if(!Ct(t)){var i="";ur(i)}this._opFn=Q5[e],this._rvalFloat=Na(t)}return r.prototype.evaluate=function(e){return Ct(e)?this._opFn(e,this._rvalFloat):this._opFn(Na(e),this._rvalFloat)},r}(),Hw=function(){function r(e,t){var i=e==="desc";this._resultLT=i?1:-1,t==null&&(t=i?"min":"max"),this._incomparable=t==="min"?-1/0:1/0}return r.prototype.evaluate=function(e,t){var i=Ct(e)?e:Na(e),n=Ct(t)?t:Na(t),a=isNaN(i),o=isNaN(n);if(a&&(i=this._incomparable),o&&(n=this._incomparable),a&&o){var s=Ce(e),l=Ce(t);s&&(i=l?e:0),l&&(n=s?t:0)}return i<n?this._resultLT:i>n?-this._resultLT:0},r}();var Ufe=function(){function r(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=Na(t)}return r.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var i=typeof e;i!==this._rvalTypeof&&(i==="number"||this._rvalTypeof==="number")&&(t=Na(e)===this._rvalFloat)}return this._isEQ?t:!t},r}();function eW(r,e){return r==="eq"||r==="ne"?new Ufe(r==="eq",e):tt(Q5,r)?new Nfe(r,e):null}var Ofe=function(){function r(){}return r.prototype.getRawData=function(){throw new Error("not supported")},r.prototype.getRawDataItem=function(e){throw new Error("not supported")},r.prototype.cloneRawData=function(){},r.prototype.getDimensionInfo=function(e){},r.prototype.cloneAllDimensionInfo=function(){},r.prototype.count=function(){},r.prototype.retrieveValue=function(e,t){},r.prototype.retrieveValueFromItem=function(e,t){},r.prototype.convertValue=function(e,t){return as(e,t)},r}();function zfe(r,e){var t=new Ofe,i=r.data,n=t.sourceFormat=r.sourceFormat,a=r.startIndex,o="";r.seriesLayoutBy!==Ga&&ur(o);var s=[],l={},u=r.dimensionsDefine;if(u)N(u,function(g,m){var v=g.name,_={index:m,name:v,displayName:g.displayName};if(s.push(_),v!=null){var y="";tt(l,v)&&ur(y),l[v]=_}});else for(var c=0;c<r.dimensionsDetectedCount;c++)s.push({index:c});var f=gD(n,Ga);e.__isBuiltIn&&(t.getRawDataItem=function(g){return f(i,a,s,g)},t.getRawData=Be(Ffe,null,r)),t.cloneRawData=Be(Bfe,null,r);var h=yD(n,Ga);t.count=Be(h,null,i,a,s);var p=_D(n);t.retrieveValue=function(g,m){var v=f(i,a,s,g);return d(v,m)};var d=t.retrieveValueFromItem=function(g,m){if(g!=null){var v=s[m];if(v)return p(g,m,v.name)}};return t.getDimensionInfo=Be(kfe,null,s,l),t.cloneAllDimensionInfo=Be(Vfe,null,s),t}function Ffe(r){var e=r.sourceFormat;if(!MD(e)){var t="";ur(t)}return r.data}function Bfe(r){var e=r.sourceFormat,t=r.data;if(!MD(e)){var i="";ur(i)}if(e===Ei){for(var n=[],a=0,o=t.length;a<o;a++)n.push(t[a].slice());return n}else if(e===En){for(var n=[],a=0,o=t.length;a<o;a++)n.push(fe({},t[a]));return n}}function kfe(r,e,t){if(t!=null){if(Ct(t)||!isNaN(t)&&!tt(e,t))return r[t];if(tt(e,t))return e[t]}}function Vfe(r){return Qe(r)}var tW=ke();function rW(r){r=Qe(r);var e=r.type,t="";e||ur(t);var i=e.split(":");i.length!==2&&ur(t);var n=!1;i[0]==="echarts"&&(e=i[1],n=!0),r.__isBuiltIn=n,tW.set(e,r)}function iW(r,e,t){var i=$t(r),n=i.length,a="";n||ur(a);for(var o=0,s=n;o<s;o++){var l=i[o];e=Gfe(l,e,t,n===1?null:o),o!==s-1&&(e.length=Math.max(e.length,1))}return e}function Gfe(r,e,t,i){var n="";e.length||ur(n),qe(r)||ur(n);var a=r.type,o=tW.get(a);o||ur(n);var s=de(e,function(c){return zfe(c,o)}),l=$t(o.transform({upstream:s[0],upstreamList:s,config:Qe(r.config)}));if(0&&r.print)var u;return de(l,function(c,f){var h="";qe(c)||ur(h),c.data||ur(h);var p=mD(c.data);MD(p)||ur(h);var d,g=e[0];if(g&&f===0&&!c.dimensions){var m=g.startIndex;m&&(c.data=g.data.slice(0,m).concat(c.data)),d={seriesLayoutBy:Ga,sourceHeader:m,dimensions:g.metaRawOption.dimensions}}else d={seriesLayoutBy:Ga,sourceHeader:0,dimensions:c.dimensions};return z_(c.data,d,null)})}function MD(r){return r===Ei||r===En}var Ww="undefined",Hfe=typeof Uint32Array===Ww?Array:Uint32Array,Wfe=typeof Uint16Array===Ww?Array:Uint16Array,wD=typeof Int32Array===Ww?Array:Int32Array,nW=typeof Float64Array===Ww?Array:Float64Array,oW={float:nW,int:wD,ordinal:Array,number:Array,time:nW},bD;function F_(r){return r>65535?Hfe:Wfe}function mv(){return[1/0,-1/0]}function Xfe(r){var e=r.constructor;return e===Array?r.slice():new e(r)}function aW(r,e,t,i,n){var a=oW[t||"float"];if(n){var o=r[e],s=o&&o.length;if(s!==i){for(var l=new a(i),u=0;u<s;u++)l[u]=o[u];r[e]=l}}else r[e]=new a(i)}var Yfe=function(){function r(){this._chunks=[],this._rawExtent=[],this._extent=[],this._count=0,this._rawCount=0,this._calcDimNameToIdx=ke()}return r.prototype.initData=function(e,t,i){this._provider=e,this._chunks=[],this._indices=null,this.getRawIndex=this._getRawIdxIdentity;var n=e.getSource(),a=this.defaultDimValueGetter=bD[n.sourceFormat];this._dimValueGetter=i||a,this._rawExtent=[];var o=kw(n);this._dimensions=de(t,function(s){return{type:s.type,property:s.property}}),this._initDataFromProvider(0,e.count())},r.prototype.getProvider=function(){return this._provider},r.prototype.getSource=function(){return this._provider.getSource()},r.prototype.ensureCalculationDimension=function(e,t){var i=this._calcDimNameToIdx,n=this._dimensions,a=i.get(e);if(a!=null){if(n[a].type===t)return a}else a=n.length;return n[a]={type:t},i.set(e,a),this._chunks[a]=new oW[t||"float"](this._rawCount),this._rawExtent[a]=mv(),a},r.prototype.collectOrdinalMeta=function(e,t){var i=this._chunks[e],n=this._dimensions[e],a=this._rawExtent,o=n.ordinalOffset||0,s=i.length;o===0&&(a[e]=mv());for(var l=a[e],u=o;u<s;u++){var c=i[u]=t.parseAndCollect(i[u]);isNaN(c)||(l[0]=Math.min(c,l[0]),l[1]=Math.max(c,l[1]))}n.ordinalMeta=t,n.ordinalOffset=s,n.type="ordinal"},r.prototype.getOrdinalMeta=function(e){var t=this._dimensions[e],i=t.ordinalMeta;return i},r.prototype.getDimensionProperty=function(e){var t=this._dimensions[e];return t&&t.property},r.prototype.appendData=function(e){var t=this._provider,i=this.count();t.appendData(e);var n=t.count();return t.persistent||(n+=i),i<n&&this._initDataFromProvider(i,n,!0),[i,n]},r.prototype.appendValues=function(e,t){for(var i=this._chunks,n=this._dimensions,a=n.length,o=this._rawExtent,s=this.count(),l=s+Math.max(e.length,t||0),u=0;u<a;u++){var c=n[u];aW(i,u,c.type,l,!0)}for(var f=[],h=s;h<l;h++)for(var p=h-s,d=0;d<a;d++){var c=n[d],g=bD.arrayRows.call(this,e[p]||f,c.property,p,d);i[d][h]=g;var m=o[d];g<m[0]&&(m[0]=g),g>m[1]&&(m[1]=g)}return this._rawCount=this._count=l,{start:s,end:l}},r.prototype._initDataFromProvider=function(e,t,i){for(var n=this._provider,a=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=de(o,function(_){return _.property}),c=0;c<s;c++){var f=o[c];l[c]||(l[c]=mv()),aW(a,c,f.type,t,i)}if(n.fillStorage)n.fillStorage(e,t,a,l);else for(var h=[],p=e;p<t;p++){h=n.getItem(p,h);for(var d=0;d<s;d++){var g=a[d],m=this._dimValueGetter(h,u[d],p,d);g[p]=m;var v=l[d];m<v[0]&&(v[0]=m),m>v[1]&&(v[1]=m)}}!n.persistent&&n.clean&&n.clean(),this._rawCount=this._count=t,this._extent=[]},r.prototype.count=function(){return this._count},r.prototype.get=function(e,t){if(!(t>=0&&t<this._count))return NaN;var i=this._chunks[e];return i?i[this.getRawIndex(t)]:NaN},r.prototype.getValues=function(e,t){var i=[],n=[];if(t==null){t=e,e=[];for(var a=0;a<this._dimensions.length;a++)n.push(a)}else n=e;for(var a=0,o=n.length;a<o;a++)i.push(this.get(n[a],t));return i},r.prototype.getByRawIndex=function(e,t){if(!(t>=0&&t<this._rawCount))return NaN;var i=this._chunks[e];return i?i[t]:NaN},r.prototype.getSum=function(e){var t=this._chunks[e],i=0;if(t)for(var n=0,a=this.count();n<a;n++){var o=this.get(e,n);isNaN(o)||(i+=o)}return i},r.prototype.getMedian=function(e){var t=[];this.each([e],function(a){isNaN(a)||t.push(a)});var i=t.sort(function(a,o){return a-o}),n=this.count();return n===0?0:n%2===1?i[(n-1)/2]:(i[n/2]+i[n/2-1])/2},r.prototype.indexOfRawIndex=function(e){if(e>=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,i=t[e];if(i!=null&&i<this._count&&i===e)return e;for(var n=0,a=this._count-1;n<=a;){var o=(n+a)/2|0;if(t[o]<e)n=o+1;else if(t[o]>e)a=o-1;else return o}return-1},r.prototype.indicesOfNearest=function(e,t,i){var n=this._chunks,a=n[e],o=[];if(!a)return o;i==null&&(i=1/0);for(var s=1/0,l=-1,u=0,c=0,f=this.count();c<f;c++){var h=this.getRawIndex(c),p=t-a[h],d=Math.abs(p);d<=i&&((d<s||d===s&&p>=0&&l<0)&&(s=d,l=p,u=0),p===l&&(o[u++]=c))}return o.length=u,o},r.prototype.getIndices=function(){var e,t=this._indices;if(t){var i=t.constructor,n=this._count;if(i===Array){e=new i(n);for(var a=0;a<n;a++)e[a]=t[a]}else e=new i(t.buffer,0,n)}else{var i=F_(this._rawCount);e=new i(this.count());for(var a=0;a<e.length;a++)e[a]=a}return e},r.prototype.filter=function(e,t){if(!this._count)return this;for(var i=this.clone(),n=i.count(),a=F_(i._rawCount),o=new a(n),s=[],l=e.length,u=0,c=e[0],f=i._chunks,h=0;h<n;h++){var p=void 0,d=i.getRawIndex(h);if(l===0)p=t(h);else if(l===1){var g=f[c][d];p=t(g,h)}else{for(var m=0;m<l;m++)s[m]=f[e[m]][d];s[m]=h,p=t.apply(null,s)}p&&(o[u++]=d)}return u<n&&(i._indices=o),i._count=u,i._extent=[],i._updateGetRawIdx(),i},r.prototype.selectRange=function(e){var t=this.clone(),i=t._count;if(!i)return this;var n=bt(e),a=n.length;if(!a)return this;var o=t.count(),s=F_(t._rawCount),l=new s(o),u=0,c=n[0],f=e[c][0],h=e[c][1],p=t._chunks,d=!1;if(!t._indices){var g=0;if(a===1){for(var m=p[n[0]],v=0;v<i;v++){var _=m[v];(_>=f&&_<=h||isNaN(_))&&(l[u++]=g),g++}d=!0}else if(a===2){for(var m=p[n[0]],y=p[n[1]],x=e[n[1]][0],M=e[n[1]][1],v=0;v<i;v++){var _=m[v],S=y[v];(_>=f&&_<=h||isNaN(_))&&(S>=x&&S<=M||isNaN(S))&&(l[u++]=g),g++}d=!0}}if(!d)if(a===1)for(var v=0;v<o;v++){var w=t.getRawIndex(v),_=p[n[0]][w];(_>=f&&_<=h||isNaN(_))&&(l[u++]=w)}else for(var v=0;v<o;v++){for(var T=!0,w=t.getRawIndex(v),C=0;C<a;C++){var b=n[C],_=p[b][w];(_<e[b][0]||_>e[b][1])&&(T=!1)}T&&(l[u++]=t.getRawIndex(v))}return u<o&&(t._indices=l),t._count=u,t._extent=[],t._updateGetRawIdx(),t},r.prototype.map=function(e,t){var i=this.clone(e);return this._updateDims(i,e,t),i},r.prototype.modify=function(e,t){this._updateDims(this,e,t)},r.prototype._updateDims=function(e,t,i){for(var n=e._chunks,a=[],o=t.length,s=e.count(),l=[],u=e._rawExtent,c=0;c<t.length;c++)u[t[c]]=mv();for(var f=0;f<s;f++){for(var h=e.getRawIndex(f),p=0;p<o;p++)l[p]=n[t[p]][h];l[o]=f;var d=i&&i.apply(null,l);if(d!=null){typeof d!="object"&&(a[0]=d,d=a);for(var c=0;c<d.length;c++){var g=t[c],m=d[c],v=u[g],_=n[g];_&&(_[h]=m),m<v[0]&&(v[0]=m),m>v[1]&&(v[1]=m)}}}},r.prototype.lttbDownSample=function(e,t){var i=this.clone([e],!0),n=i._chunks,a=n[e],o=this.count(),s=0,l=Math.floor(1/t),u=this.getRawIndex(0),c,f,h,p=new(F_(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));p[s++]=u;for(var d=1;d<o-1;d+=l){for(var g=Math.min(d+l,o-1),m=Math.min(d+l*2,o),v=(m+g)/2,_=0,y=g;y<m;y++){var x=this.getRawIndex(y),M=a[x];isNaN(M)||(_+=M)}_/=m-g;var S=d,w=Math.min(d+l,o),T=d-1,C=a[u];c=-1,h=S;for(var b=-1,E=0,y=S;y<w;y++){var x=this.getRawIndex(y),M=a[x];if(isNaN(M)){E++,b<0&&(b=x);continue}f=Math.abs((T-v)*(M-C)-(T-y)*(_-C)),f>c&&(c=f,h=x)}E>0&&E<w-S&&(p[s++]=Math.min(b,h),h=Math.max(b,h)),p[s++]=h,u=h}return p[s++]=this.getRawIndex(o-1),i._count=s,i._indices=p,i.getRawIndex=this._getRawIdx,i},r.prototype.downSample=function(e,t,i,n){for(var a=this.clone([e],!0),o=a._chunks,s=[],l=Math.floor(1/t),u=o[e],c=this.count(),f=a._rawExtent[e]=mv(),h=new(F_(this._rawCount))(Math.ceil(c/l)),p=0,d=0;d<c;d+=l){l>c-d&&(l=c-d,s.length=l);for(var g=0;g<l;g++){var m=this.getRawIndex(d+g);s[g]=u[m]}var v=i(s),_=this.getRawIndex(Math.min(d+n(s,v)||0,c-1));u[_]=v,v<f[0]&&(f[0]=v),v>f[1]&&(f[1]=v),h[p++]=_}return a._count=p,a._indices=h,a._updateGetRawIdx(),a},r.prototype.each=function(e,t){if(this._count)for(var i=e.length,n=this._chunks,a=0,o=this.count();a<o;a++){var s=this.getRawIndex(a);switch(i){case 0:t(a);break;case 1:t(n[e[0]][s],a);break;case 2:t(n[e[0]][s],n[e[1]][s],a);break;default:for(var l=0,u=[];l<i;l++)u[l]=n[e[l]][s];u[l]=a,t.apply(null,u)}}},r.prototype.getDataExtent=function(e){var t=this._chunks[e],i=mv();if(!t)return i;var n=this.count(),a=!this._indices,o;if(a)return this._rawExtent[e].slice();if(o=this._extent[e],o)return o.slice();o=i;for(var s=o[0],l=o[1],u=0;u<n;u++){var c=this.getRawIndex(u),f=t[c];f<s&&(s=f),f>l&&(l=f)}return o=[s,l],this._extent[e]=o,o},r.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var i=[],n=this._chunks,a=0;a<n.length;a++)i.push(n[a][t]);return i},r.prototype.clone=function(e,t){var i=new r,n=this._chunks,a=e&&gn(e,function(s,l){return s[l]=!0,s},{});if(a)for(var o=0;o<n.length;o++)i._chunks[o]=a[o]?Xfe(n[o]):n[o];else i._chunks=n;return this._copyCommonProps(i),t||(i._indices=this._cloneIndices()),i._updateGetRawIdx(),i},r.prototype._copyCommonProps=function(e){e._count=this._count,e._rawCount=this._rawCount,e._provider=this._provider,e._dimensions=this._dimensions,e._extent=Qe(this._extent),e._rawExtent=Qe(this._rawExtent)},r.prototype._cloneIndices=function(){if(this._indices){var e=this._indices.constructor,t=void 0;if(e===Array){var i=this._indices.length;t=new e(i);for(var n=0;n<i;n++)t[n]=this._indices[n]}else t=new e(this._indices);return t}return null},r.prototype._getRawIdxIdentity=function(e){return e},r.prototype._getRawIdx=function(e){return e<this._count&&e>=0?this._indices[e]:-1},r.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},r.internalField=function(){function e(t,i,n,a){return as(t[a],this._dimensions[a])}bD={arrayRows:e,objectRows:function(t,i,n,a){return as(t[i],this._dimensions[a])},keyedColumns:e,original:function(t,i,n,a){var o=t&&(t.value==null?t:t.value);return as(o instanceof Array?o[a]:o,this._dimensions[a])},typedArray:function(t,i,n,a){return t[a]}}}(),r}(),B_=Yfe;var Yw=function(){function r(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return r.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},r.prototype._setLocalSource=function(e,t){this._sourceList=e,this._upstreamSignList=t,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},r.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},r.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},r.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,t=this._getUpstreamSourceManagers(),i=!!t.length,n,a;if(Xw(e)){var o=e,s=void 0,l=void 0,u=void 0;if(i){var c=t[0];c.prepareSource(),u=c.getSource(),s=u.data,l=u.sourceFormat,a=[c._getVersionSign()]}else s=o.get("data",!0),l=bi(s)?So:fn,a=[];var f=this._getSourceMetaRawOption()||{},h=u&&u.metaRawOption||{},p=ft(f.seriesLayoutBy,h.seriesLayoutBy)||null,d=ft(f.sourceHeader,h.sourceHeader),g=ft(f.dimensions,h.dimensions),m=p!==h.seriesLayoutBy||!!d!=!!h.sourceHeader||g;n=m?[z_(s,{seriesLayoutBy:p,sourceHeader:d,dimensions:g},l)]:[]}else{var v=e;if(i){var _=this._applyTransform(t);n=_.sourceList,a=_.upstreamSignList}else{var y=v.get("source",!0);n=[z_(y,this._getSourceMetaRawOption(),null)],a=[]}}this._setLocalSource(n,a)},r.prototype._applyTransform=function(e){var t=this._sourceHost,i=t.get("transform",!0),n=t.get("fromTransformResult",!0);if(n!=null){var a="";e.length!==1&&sW(a)}var o,s=[],l=[];return N(e,function(u){u.prepareSource();var c=u.getSource(n||0),f="";n!=null&&!c&&sW(f),s.push(c),l.push(u._getVersionSign())}),i?o=iW(i,s,{datasetIndex:t.componentIndex}):n!=null&&(o=[q5(s[0])]),{sourceList:o,upstreamSignList:l}},r.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;t<e.length;t++){var i=e[t];if(i._isDirty()||this._upstreamSignList[t]!==i._getVersionSign())return!0}},r.prototype.getSource=function(e){e=e||0;var t=this._sourceList[e];if(!t){var i=this._getUpstreamSourceManagers();return i[0]&&i[0].getSource(e)}return t},r.prototype.getSharedDataStore=function(e){var t=e.makeStoreSchema();return this._innerGetDataStore(t.dimensions,e.source,t.hash)},r.prototype._innerGetDataStore=function(e,t,i){var n=0,a=this._storeList,o=a[n];o||(o=a[n]={});var s=o[i];if(!s){var l=this._getUpstreamSourceManagers()[0];Xw(this._sourceHost)&&l?s=l._innerGetDataStore(e,t,i):(s=new B_,s.initData(new Vw(t,e.length),e)),o[i]=s}return s},r.prototype._getUpstreamSourceManagers=function(){var e=this._sourceHost;if(Xw(e)){var t=Iw(e);return t?[t.getSourceManager()]:[]}else return de(E5(e),function(i){return i.getSourceManager()})},r.prototype._getSourceMetaRawOption=function(){var e=this._sourceHost,t,i,n;if(Xw(e))t=e.get("seriesLayoutBy",!0),i=e.get("sourceHeader",!0),n=e.get("dimensions",!0);else if(!this._getUpstreamSourceManagers().length){var a=e;t=a.get("seriesLayoutBy",!0),i=a.get("sourceHeader",!0),n=a.get("dimensions",!0)}return{seriesLayoutBy:t,sourceHeader:i,dimensions:n}},r}();function TD(r){var e=r.option.transform;e&&tp(r.option.transform)}function Xw(r){return r.mainType==="series"}function sW(r){throw new Error(r)}var lW="line-height:1";function uW(r,e){var t=r.color||"#6e7079",i=r.fontSize||12,n=r.fontWeight||"400",a=r.color||"#464646",o=r.fontSize||14,s=r.fontWeight||"900";return e==="html"?{nameStyle:"font-size:"+yn(i+"")+"px;color:"+yn(t)+";font-weight:"+yn(n+""),valueStyle:"font-size:"+yn(o+"")+"px;color:"+yn(a)+";font-weight:"+yn(s+"")}:{nameStyle:{fontSize:i,fill:t,fontWeight:n},valueStyle:{fontSize:o,fill:a,fontWeight:s}}}var qfe=[0,10,20,30],Zfe=["",`
  2210. `,`
  2211. `,`
  2212. `];function Or(r,e){return e.type=r,e}function ED(r){return r.type==="section"}function cW(r){return ED(r)?jfe:Kfe}function fW(r){if(ED(r)){var e=0,t=r.blocks.length,i=t>1||t>0&&!r.noHeader;return N(r.blocks,function(n){var a=fW(n);a>=e&&(e=a+ +(i&&(!a||ED(n)&&!n.noHeader)))}),e}return 0}function jfe(r,e,t,i){var n=e.noHeader,a=Jfe(fW(e)),o=[],s=e.blocks||[];kr(!s||pe(s)),s=s||[];var l=r.orderMode;if(e.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(tt(u,l)){var c=new Hw(u[l],null);s.sort(function(d,g){return c.evaluate(d.sortParam,g.sortParam)})}else l==="seriesDesc"&&s.reverse()}N(s,function(d,g){var m=e.valueFormatter,v=cW(d)(m?fe(fe({},r),{valueFormatter:m}):r,d,g>0?a.html:0,i);v!=null&&o.push(v)});var f=r.renderMode==="richText"?o.join(a.richText):AD(o.join(""),n?t:a.html);if(n)return f;var h=Cw(e.header,"ordinal",r.useUTC),p=uW(i,r.renderMode).nameStyle;return r.renderMode==="richText"?hW(r,h,p)+a.richText+f:AD('<div style="'+p+";"+lW+';">'+yn(h)+"</div>"+f,t)}function Kfe(r,e,t,i){var n=r.renderMode,a=e.noName,o=e.noValue,s=!e.markerType,l=e.name,u=r.useUTC,c=e.valueFormatter||r.valueFormatter||function(x){return x=pe(x)?x:[x],de(x,function(M,S){return Cw(M,pe(p)?p[S]:p,u)})};if(!(a&&o)){var f=s?"":r.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",n),h=a?"":Cw(l,"ordinal",u),p=e.valueType,d=o?[]:c(e.value,e.dataIndex),g=!s||!a,m=!s&&a,v=uW(i,n),_=v.nameStyle,y=v.valueStyle;return n==="richText"?(s?"":f)+(a?"":hW(r,h,_))+(o?"":ehe(r,d,g,m,y)):AD((s?"":f)+(a?"":$fe(h,!s,_))+(o?"":Qfe(d,g,m,y)),t)}}function CD(r,e,t,i,n,a){if(r){var o=cW(r),s={useUTC:n,renderMode:t,orderMode:i,markupStyleCreator:e,valueFormatter:r.valueFormatter};return o(s,r,0,a)}}function Jfe(r){return{html:qfe[r],richText:Zfe[r]}}function AD(r,e){var t='<div style="clear:both"></div>',i="margin: "+e+"px 0 0";return'<div style="'+i+";"+lW+';">'+r+t+"</div>"}function $fe(r,e,t){var i=e?"margin-left:2px":"";return'<span style="'+t+";"+i+'">'+yn(r)+"</span>"}function Qfe(r,e,t,i){var n=t?"10px":"20px",a=e?"float:right;margin-left:"+n:"";return r=pe(r)?r:[r],'<span style="'+a+";"+i+'">'+de(r,function(o){return yn(o)}).join("&nbsp;&nbsp;")+"</span>"}function hW(r,e,t){return r.markupStyleCreator.wrapRichTextStyle(e,t)}function ehe(r,e,t,i,n){var a=[n],o=i?10:20;return t&&a.push({padding:[0,0,0,o],align:"right"}),r.markupStyleCreator.wrapRichTextStyle(pe(e)?e.join(" "):e,a)}function qw(r,e){var t=r.getData().getItemVisual(e,"style"),i=t[r.visualDrawType];return Ws(i)}function Zw(r,e){var t=r.get("padding");return t??(e==="richText"?[8,10]:10)}var jw=function(){function r(){this.richTextStyles={},this._nextStyleNameId=Hb()}return r.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},r.prototype.makeTooltipMarker=function(e,t,i){var n=i==="richText"?this._generateStyleName():null,a=_5({color:t,type:e,renderMode:i,markerId:n});return Ce(a)?a:(this.richTextStyles[n]=a.style,a.content)},r.prototype.wrapRichTextStyle=function(e,t){var i={};pe(t)?N(t,function(a){return fe(i,a)}):fe(i,t);var n=this._generateStyleName();return this.richTextStyles[n]=i,"{"+n+"|"+e+"}"},r}();function Kw(r){var e=r.series,t=r.dataIndex,i=r.multipleSeries,n=e.getData(),a=n.mapDimensionsAll("defaultedTooltip"),o=a.length,s=e.getRawValue(t),l=pe(s),u=qw(e,t),c,f,h,p;if(o>1||l&&!o){var d=the(s,e,t,a,u);c=d.inlineValues,f=d.inlineValueTypes,h=d.blocks,p=d.inlineValues[0]}else if(o){var g=n.getDimensionInfo(a[0]);p=c=Ou(n,t,a[0]),f=g.type}else p=c=l?s[0]:s;var m=Wm(e),v=m&&e.name||"",_=n.getName(t),y=i?v:_;return Or("section",{header:v,noHeader:i||!m,sortParam:p,blocks:[Or("nameValue",{markerType:"item",markerColor:u,name:y,noName:!Yi(y),value:c,valueType:f,dataIndex:t})].concat(h||[])})}function the(r,e,t,i,n){var a=e.getData(),o=gn(r,function(f,h,p){var d=a.getDimensionInfo(p);return f=f||d&&d.tooltip!==!1&&d.displayName!=null},!1),s=[],l=[],u=[];i.length?N(i,function(f){c(Ou(a,t,f),f)}):N(r,c);function c(f,h){var p=a.getDimensionInfo(h);!p||p.otherDims.tooltip===!1||(o?u.push(Or("nameValue",{markerType:"subItem",markerColor:n,name:p.displayName,value:f,valueType:p.type})):(s.push(f),l.push(p.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var Pf=vt();function Jw(r,e){return r.getName(e)||r.getId(e)}var k_="__universalTransitionEnabled",$w=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return e.prototype.init=function(t,i,n){this.seriesIndex=this.componentIndex,this.dataTask=Lf({count:ihe,reset:nhe}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n);var a=Pf(this).sourceManager=new Yw(this);a.prepareSource();var o=this.getInitialData(t,n);dW(o,this),this.dataTask.context.data=o,Pf(this).dataBeforeProcessed=o,pW(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(t,i){var n=Rf(this),a=n?is(t):{},o=this.subType;Pt.hasClass(o)&&(o+="Series"),_t(t,i.getTheme().get(this.subType)),_t(t,this.getDefaultOption()),yo(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&Va(t,a,n)},e.prototype.mergeOption=function(t,i){t=_t(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Rf(this);n&&Va(this.option,t,n);var a=Pf(this).sourceManager;a.dirty(),a.prepareSource();var o=this.getInitialData(t,i);dW(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,Pf(this).dataBeforeProcessed=o,pW(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(t){if(t&&!bi(t))for(var i=["show"],n=0;n<t.length;n++)t[n]&&t[n].label&&yo(t[n],"label",i)},e.prototype.getInitialData=function(t,i){},e.prototype.appendData=function(t){var i=this.getRawData();i.appendData(t.data)},e.prototype.getData=function(t){var i=RD(this);if(i){var n=i.context.data;return t==null?n:n.getLinkedData(t)}else return Pf(this).data},e.prototype.getAllData=function(){var t=this.getData();return t&&t.getLinkedDataAll?t.getLinkedDataAll():[{data:t}]},e.prototype.setData=function(t){var i=RD(this);if(i){var n=i.context;n.outputData=t,i!==this.dataTask&&(n.data=t)}Pf(this).data=t},e.prototype.getEncode=function(){var t=this.get("encode",!0);if(t)return ke(t)},e.prototype.getSourceManager=function(){return Pf(this).sourceManager},e.prototype.getSource=function(){return this.getSourceManager().getSource()},e.prototype.getRawData=function(){return Pf(this).dataBeforeProcessed},e.prototype.getColorBy=function(){var t=this.get("colorBy");return t||"series"},e.prototype.isColorBySeries=function(){return this.getColorBy()==="series"},e.prototype.getBaseAxis=function(){var t=this.coordinateSystem;return t&&t.getBaseAxis&&t.getBaseAxis()},e.prototype.formatTooltip=function(t,i,n){return Kw({series:this,dataIndex:t,multipleSeries:i})},e.prototype.isAnimationEnabled=function(){var t=this.ecModel;if(zt.node&&!(t&&t.ssr))return!1;var i=this.getShallow("animation");return i&&this.getData().count()>this.getShallow("animationThreshold")&&(i=!1),!!i},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,i,n){var a=this.ecModel,o=P_.prototype.getColorFromPalette.call(this,t,i,n);return o||(o=a.getColorFromPalette(t,i,n)),o},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,i){this._innerSelect(this.getData(i),t)},e.prototype.unselect=function(t,i){var n=this.option.selectedMap;if(n){var a=this.option.selectedMode,o=this.getData(i);if(a==="series"||n==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s<t.length;s++){var l=t[s],u=Jw(o,l);n[u]=!1,this._selectedDataIndicesMap[u]=-1}}},e.prototype.toggleSelect=function(t,i){for(var n=[],a=0;a<t.length;a++)n[0]=t[a],this.isSelected(t[a],i)?this.unselect(n,i):this.select(n,i)},e.prototype.getSelectedDataIndices=function(){if(this.option.selectedMap==="all")return[].slice.call(this.getData().getIndices());for(var t=this._selectedDataIndicesMap,i=bt(t),n=[],a=0;a<i.length;a++){var o=t[i[a]];o>=0&&n.push(o)}return n},e.prototype.isSelected=function(t,i){var n=this.option.selectedMap;if(!n)return!1;var a=this.getData(i);return(n==="all"||n[Jw(a,t)])&&!a.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[k_])return!0;var t=this.option.universalTransition;return t?t===!0?!0:t&&t.enabled:!1},e.prototype._innerSelect=function(t,i){var n,a,o=this.option,s=o.selectedMode,l=i.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){qe(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,c=0;c<l;c++){var f=i[c],h=Jw(t,f);u[h]=!0,this._selectedDataIndicesMap[h]=t.getRawIndex(f)}}else if(s==="single"||s===!0){var p=i[l-1],h=Jw(t,p);o.selectedMap=(n={},n[h]=!0,n),this._selectedDataIndicesMap=(a={},a[h]=t.getRawIndex(p),a)}}},e.prototype._initSelectedMapFromData=function(t){if(!this.option.selectedMap){var i=[];t.hasItemOption&&t.each(function(n){var a=t.getRawDataItem(n);a&&a.selected&&i.push(n)}),i.length>0&&this._innerSelect(t,i)}},e.registerClass=function(t){return Pt.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(Pt);br($w,dv);br($w,P_);Yb($w,Pt);function pW(r){var e=r.name;Wm(r)||(r.name=rhe(r)||e)}function rhe(r){var e=r.getRawData(),t=e.mapDimensionsAll("seriesName"),i=[];return N(t,function(n){var a=e.getDimensionInfo(n);a.displayName&&i.push(a.displayName)}),i.join(" ")}function ihe(r){return r.model.getRawData().count()}function nhe(r){var e=r.model;return e.setData(e.getRawData().cloneShallow()),ahe}function ahe(r,e){e.outputData&&r.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function dW(r,e){N(rp(r.CHANGABLE_METHODS,r.DOWNSAMPLE_METHODS),function(t){r.wrapMethod(t,ot(ohe,e))})}function ohe(r,e){var t=RD(r);return t&&t.setOutputEnd((e||this).count()),e}function RD(r){var e=(r.ecModel||{}).scheduler,t=e&&e.getPipeline(r.uid);if(t){var i=t.currentTask;if(i){var n=i.agentStubMap;n&&(i=n.get(r.uid))}return i}}var jt=$w;var LD=function(){function r(){this.group=new Ze,this.uid=rs("viewComponent")}return r.prototype.init=function(e,t){},r.prototype.render=function(e,t,i,n){},r.prototype.dispose=function(e,t){},r.prototype.updateView=function(e,t,i,n){},r.prototype.updateLayout=function(e,t,i,n){},r.prototype.updateVisual=function(e,t,i,n){},r.prototype.toggleBlurSeries=function(e,t,i){},r.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},r}();Xm(LD);xf(LD);var er=LD;function Mo(){var r=vt();return function(e){var t=r(e),i=e.pipelineContext,n=!!t.large,a=!!t.progressiveRender,o=t.large=!!(i&&i.large),s=t.progressiveRender=!!(i&&i.progressiveRender);return(n!==o||a!==s)&&"reset"}}var gW=vt(),she=Mo(),PD=function(){function r(){this.group=new Ze,this.uid=rs("viewChart"),this.renderTask=Lf({plan:lhe,reset:uhe}),this.renderTask.context={view:this}}return r.prototype.init=function(e,t){},r.prototype.render=function(e,t,i,n){},r.prototype.highlight=function(e,t,i,n){var a=e.getData(n&&n.dataType);a&&vW(a,n,"emphasis")},r.prototype.downplay=function(e,t,i,n){var a=e.getData(n&&n.dataType);a&&vW(a,n,"normal")},r.prototype.remove=function(e,t){this.group.removeAll()},r.prototype.dispose=function(e,t){},r.prototype.updateView=function(e,t,i,n){this.render(e,t,i,n)},r.prototype.updateLayout=function(e,t,i,n){this.render(e,t,i,n)},r.prototype.updateVisual=function(e,t,i,n){this.render(e,t,i,n)},r.prototype.eachRendered=function(e){ca(this.group,e)},r.markUpdateMethod=function(e,t){gW(e).updateMethod=t},r.protoInitialize=function(){var e=r.prototype;e.type="chart"}(),r}();function mW(r,e,t){r&&Af(r)&&(e==="emphasis"?Bn:kn)(r,t)}function vW(r,e,t){var i=$o(r,e),n=e&&e.highlightKey!=null?g4(e.highlightKey):null;i!=null?N($t(i),function(a){mW(r.getItemGraphicEl(a),t,n)}):r.eachItemGraphicEl(function(a){mW(a,t,n)})}Xm(PD,["dispose"]);xf(PD);function lhe(r){return she(r.model)}function uhe(r){var e=r.model,t=r.ecModel,i=r.api,n=r.payload,a=e.pipelineContext.progressiveRender,o=r.view,s=n&&gW(n).updateMethod,l=a?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,t,i,n),che[l]}var che={incrementalPrepareRender:{progress:function(r,e){e.view.incrementalRender(r,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(r,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},Yt=PD;var Qw="\0__throttleOriginMethod",yW="\0__throttleRate",_W="\0__throttleType";function V_(r,e,t){var i,n=0,a=0,o=null,s,l,u,c;e=e||0;function f(){a=new Date().getTime(),o=null,r.apply(l,u||[])}var h=function(){for(var p=[],d=0;d<arguments.length;d++)p[d]=arguments[d];i=new Date().getTime(),l=this,u=p;var g=c||e,m=c||t;c=null,s=i-(m?n:a)-g,clearTimeout(o),m?o=setTimeout(f,g):s>=0?f():o=setTimeout(f,-s),n=i};return h.clear=function(){o&&(clearTimeout(o),o=null)},h.debounceNextCall=function(p){c=p},h}function os(r,e,t,i){var n=r[e];if(n){var a=n[Qw]||n,o=n[_W],s=n[yW];if(s!==t||o!==i){if(t==null||!i)return r[e]=a;n=r[e]=V_(a,t,i==="debounce"),n[Qw]=a,n[_W]=i,n[yW]=t}return n}}function zu(r,e){var t=r[e];t&&t[Qw]&&(t.clear&&t.clear(),r[e]=t[Qw])}var xW=vt(),SW={itemStyle:za(GP,!0),lineStyle:za(VP,!0)},fhe={lineStyle:"stroke",itemStyle:"fill"};function MW(r,e){var t=r.visualStyleMapper||SW[e];return t||(console.warn("Unknown style type '"+e+"'."),SW.itemStyle)}function bW(r,e){var t=r.visualDrawType||fhe[e];return t||(console.warn("Unknown style type '"+e+"'."),"fill")}var wW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=r.getModel(i),a=MW(r,i),o=a(n),s=n.getShallow("decal");s&&(t.setVisual("decal",s),s.dirty=!0);var l=bW(r,i),u=o[l],c=He(u)?u:null,f=o.fill==="auto"||o.stroke==="auto";if(!o[l]||c||f){var h=r.getColorFromPalette(r.name,null,e.getSeriesCount());o[l]||(o[l]=h,t.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||He(o.fill)?h:o.fill,o.stroke=o.stroke==="auto"||He(o.stroke)?h:o.stroke}if(t.setVisual("style",o),t.setVisual("drawType",l),!e.isSeriesFiltered(r)&&c)return t.setVisual("colorFromPalette",!1),{dataEach:function(p,d){var g=r.getDataParams(d),m=fe({},o);m[l]=c(g),p.setItemVisual(d,"style",m)}}}},G_=new Zt,TW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){if(!(r.ignoreStyleOnData||e.isSeriesFiltered(r))){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=MW(r,i),a=t.getVisual("drawType");return{dataEach:t.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[i]){G_.option=l[i];var u=n(G_),c=o.ensureUniqueItemVisual(s,"style");fe(c,u),G_.option.decal&&(o.setItemVisual(s,"decal",G_.option.decal),G_.option.decal.dirty=!0),a in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},EW={performRawSeries:!0,overallReset:function(r){var e=ke();r.eachSeries(function(t){var i=t.getColorBy();if(!t.isColorBySeries()){var n=t.type+"-"+i,a=e.get(n);a||(a={},e.set(n,a)),xW(t).scope=a}}),r.eachSeries(function(t){if(!(t.isColorBySeries()||r.isSeriesFiltered(t))){var i=t.getRawData(),n={},a=t.getData(),o=xW(t).scope,s=t.visualStyleAccessPath||"itemStyle",l=bW(t,s);a.each(function(u){var c=a.getRawIndex(u);n[c]=u}),i.each(function(u){var c=n[u],f=a.getItemVisual(c,"colorFromPalette");if(f){var h=a.ensureUniqueItemVisual(c,"style"),p=i.getName(u)||u+"",d=i.count();h[l]=t.getColorFromPalette(p,o,d)}})}})}};var t1=Math.PI;function DD(r,e){e=e||{},Ye(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var t=new Ze,i=new Et({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});t.add(i);var n=new Lt({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new Et({style:{fill:"none"},textContent:n,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});t.add(a);var o;return e.showSpinner&&(o=new x_({shape:{startAngle:-t1/2,endAngle:-t1/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:t1*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:t1*3/2}).delay(300).start("circularInOut"),t.add(o)),t.resize=function(){var s=n.getBoundingRect().width,l=e.showSpinner?e.spinnerRadius:0,u=(r.getWidth()-l*2-(e.showSpinner&&s?10:0)-s)/2-(e.showSpinner&&s?0:5+s/2)+(e.showSpinner?0:s/2)+(s?0:l),c=r.getHeight()/2;e.showSpinner&&o.setShape({cx:u,cy:c}),a.setShape({x:u-l,y:c-l,width:l*2,height:l*2}),i.setShape({x:0,y:0,width:r.getWidth(),height:r.getHeight()})},t.resize(),t}var hhe=function(){function r(e,t,i,n){this._stageTaskMap=ke(),this.ecInstance=e,this.api=t,i=this._dataProcessorHandlers=i.slice(),n=this._visualHandlers=n.slice(),this._allHandlers=i.concat(n)}return r.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(i){var n=i.overallTask;n&&n.dirty()})},r.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var i=this._pipelineMap.get(e.__pipeline.id),n=i.context,a=!t&&i.progressiveEnabled&&(!n||n.progressiveRender)&&e.__idxInPipeline>i.blockIndex,o=a?i.step:null,s=n&&n.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},r.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},r.prototype.updateStreamModes=function(e,t){var i=this._pipelineMap.get(e.uid),n=e.getData(),a=n.count(),o=i.progressiveEnabled&&t.incrementalPrepareRender&&a>=i.threshold,s=e.get("large")&&a>=e.get("largeThreshold"),l=e.get("progressiveChunkMode")==="mod"?a:null;e.pipelineContext=i.context={progressiveRender:o,modDataCount:l,large:s}},r.prototype.restorePipelines=function(e){var t=this,i=t._pipelineMap=ke();e.eachSeries(function(n){var a=n.getProgressive(),o=n.uid;i.set(o,{id:o,head:null,tail:null,threshold:n.getProgressiveThreshold(),progressiveEnabled:a&&!(n.preventIncremental&&n.preventIncremental()),blockIndex:-1,step:Math.round(a||700),count:0}),t._pipe(n,n.dataTask)})},r.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),i=this.api;N(this._allHandlers,function(n){var a=e.get(n.uid)||e.set(n.uid,{}),o="";kr(!(n.reset&&n.overallReset),o),n.reset&&this._createSeriesStageTask(n,a,t,i),n.overallReset&&this._createOverallStageTask(n,a,t,i)},this)},r.prototype.prepareView=function(e,t,i,n){var a=e.renderTask,o=a.context;o.model=t,o.ecModel=i,o.api=n,a.__block=!e.incrementalPrepareRender,this._pipe(t,a)},r.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},r.prototype.performVisualTasks=function(e,t,i){this._performStageTasks(this._visualHandlers,e,t,i)},r.prototype._performStageTasks=function(e,t,i,n){n=n||{};var a=!1,o=this;N(e,function(l,u){if(!(n.visualType&&n.visualType!==l.visualType)){var c=o._stageTaskMap.get(l.uid),f=c.seriesTaskMap,h=c.overallTask;if(h){var p,d=h.agentStubMap;d.each(function(m){s(n,m)&&(m.dirty(),p=!0)}),p&&h.dirty(),o.updatePayload(h,i);var g=o.getPerformArgs(h,n.block);d.each(function(m){m.perform(g)}),h.perform(g)&&(a=!0)}else f&&f.each(function(m,v){s(n,m)&&m.dirty();var _=o.getPerformArgs(m,n.block);_.skip=!l.performRawSeries&&t.isSeriesFiltered(m.context.model),o.updatePayload(m,i),m.perform(_)&&(a=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=a||this.unfinished},r.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(i){t=i.dataTask.perform()||t}),this.unfinished=t||this.unfinished},r.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},r.prototype.updatePayload=function(e,t){t!=="remain"&&(e.context.payload=t)},r.prototype._createSeriesStageTask=function(e,t,i,n){var a=this,o=t.seriesTaskMap,s=t.seriesTaskMap=ke(),l=e.seriesType,u=e.getTargetSeries;e.createOnAllSeries?i.eachRawSeries(c):l?i.eachRawSeriesByType(l,c):u&&u(i,n).each(c);function c(f){var h=f.uid,p=s.set(h,o&&o.get(h)||Lf({plan:ghe,reset:yhe,count:xhe}));p.context={model:f,ecModel:i,api:n,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:a},a._pipe(f,p)}},r.prototype._createOverallStageTask=function(e,t,i,n){var a=this,o=t.overallTask=t.overallTask||Lf({reset:phe});o.context={ecModel:i,api:n,overallReset:e.overallReset,scheduler:a};var s=o.agentStubMap,l=o.agentStubMap=ke(),u=e.seriesType,c=e.getTargetSeries,f=!0,h=!1,p="";kr(!e.createOnAllSeries,p),u?i.eachRawSeriesByType(u,d):c?c(i,n).each(d):(f=!1,N(i.getSeries(),d));function d(g){var m=g.uid,v=l.set(m,s&&s.get(m)||(h=!0,Lf({reset:dhe,onDirty:vhe})));v.context={model:g,overallProgress:f},v.agent=o,v.__block=f,a._pipe(g,v)}h&&o.dirty()},r.prototype._pipe=function(e,t){var i=e.uid,n=this._pipelineMap.get(i);!n.head&&(n.head=t),n.tail&&n.tail.pipe(t),n.tail=t,t.__idxInPipeline=n.count++,t.__pipeline=n},r.wrapStageHandler=function(e,t){return He(e)&&(e={overallReset:e,seriesType:She(e)}),e.uid=rs("stageHandler"),t&&(e.visualType=t),e},r}();function phe(r){r.overallReset(r.ecModel,r.api,r.payload)}function dhe(r){return r.overallProgress&&mhe}function mhe(){this.agent.dirty(),this.getDownstream().dirty()}function vhe(){this.agent&&this.agent.dirty()}function ghe(r){return r.plan?r.plan(r.model,r.ecModel,r.api,r.payload):null}function yhe(r){r.useClearVisual&&r.data.clearAllVisual();var e=r.resetDefines=$t(r.reset(r.model,r.ecModel,r.api,r.payload));return e.length>1?de(e,function(t,i){return AW(i)}):_he}var _he=AW(0);function AW(r){return function(e,t){var i=t.data,n=t.resetDefines[r];if(n&&n.dataEach)for(var a=e.start;a<e.end;a++)n.dataEach(i,a);else n&&n.progress&&n.progress(e,i)}}function xhe(r){return r.data.count()}function She(r){r1=null;try{r(H_,CW)}catch{}return r1}var H_={},CW={},r1;RW(H_,Ow);RW(CW,zw);H_.eachSeriesByType=H_.eachRawSeriesByType=function(r){r1=r};H_.eachComponent=function(r){r.mainType==="series"&&r.subType&&(r1=r.subType)};function RW(r,e){for(var t in e.prototype)r[t]=Dr}var ID=hhe;var LW=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"],PW={color:LW,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],LW]};var fa="#B9B8CE",DW="#100C2A",i1=function(){return{axisLine:{lineStyle:{color:fa}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},IW=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],NW={darkMode:!0,color:IW,backgroundColor:DW,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:fa}},textStyle:{color:fa},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:fa}},dataZoom:{borderColor:"#71708A",textStyle:{color:fa},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:fa}},timeline:{lineStyle:{color:fa},label:{color:fa},controlStyle:{color:fa,borderColor:fa}},calendar:{itemStyle:{color:DW},dayLabel:{color:fa},monthLabel:{color:fa},yearLabel:{color:fa}},timeAxis:i1(),logAxis:i1(),valueAxis:i1(),categoryAxis:i1(),line:{symbol:"circle"},graph:{color:IW},gauge:{title:{color:fa},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:fa},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};NW.categoryAxis.splitLine.show=!1;var UW=NW;var OW=function(){function r(){}return r.prototype.normalizeQuery=function(e){var t={},i={},n={};if(Ce(e)){var a=Oa(e);t.mainType=a.main||null,t.subType=a.sub||null}else{var o=["Index","Name","Id"],s={name:1,dataIndex:1,dataType:1};N(e,function(l,u){for(var c=!1,f=0;f<o.length;f++){var h=o[f],p=u.lastIndexOf(h);if(p>0&&p===u.length-h.length){var d=u.slice(0,p);d!=="data"&&(t.mainType=d,t[h.toLowerCase()]=l,c=!0)}}s.hasOwnProperty(u)&&(i[u]=l,c=!0),c||(n[u]=l)})}return{cptQuery:t,dataQuery:i,otherQuery:n}},r.prototype.filter=function(e,t){var i=this.eventInfo;if(!i)return!0;var n=i.targetEl,a=i.packedEvent,o=i.model,s=i.view;if(!o||!s)return!0;var l=t.cptQuery,u=t.dataQuery;return c(l,o,"mainType")&&c(l,o,"subType")&&c(l,o,"index","componentIndex")&&c(l,o,"name")&&c(l,o,"id")&&c(u,a,"name")&&c(u,a,"dataIndex")&&c(u,a,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(e,t.otherQuery,n,a));function c(f,h,p,d){return f[p]==null||h[d||p]===f[p]}},r.prototype.afterTrigger=function(){this.eventInfo=null},r}();var ND=["symbol","symbolSize","symbolRotate","symbolOffset"],zW=ND.concat(["symbolKeepAspect"]),FW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData();if(r.legendIcon&&t.setVisual("legendIcon",r.legendIcon),!r.hasSymbolVisual)return;for(var i={},n={},a=!1,o=0;o<ND.length;o++){var s=ND[o],l=r.get(s);He(l)?(a=!0,n[s]=l):i[s]=l}if(i.symbol=i.symbol||r.defaultSymbol,t.setVisual(fe({legendIcon:r.legendIcon||i.symbol,symbolKeepAspect:r.get("symbolKeepAspect")},i)),e.isSeriesFiltered(r))return;var u=bt(n);function c(f,h){for(var p=r.getRawValue(h),d=r.getDataParams(h),g=0;g<u.length;g++){var m=u[g];f.setItemVisual(h,m,n[m](p,d))}}return{dataEach:a?c:null}}},BW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){if(!r.hasSymbolVisual||e.isSeriesFiltered(r))return;var t=r.getData();function i(n,a){for(var o=n.getItemModel(a),s=0;s<zW.length;s++){var l=zW[s],u=o.getShallow(l,!0);u!=null&&n.setItemVisual(a,l,u)}}return{dataEach:t.hasItemOption?i:null}}};function W_(r,e,t){switch(t){case"color":var i=r.getItemVisual(e,"style");return i[r.getVisual("drawType")];case"opacity":return r.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return r.getItemVisual(e,t);default:}}function Bl(r,e){switch(e){case"color":var t=r.getVisual("style");return t[r.getVisual("drawType")];case"opacity":return r.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return r.getVisual(e);default:}}function UD(r,e,t,i){switch(t){case"color":var n=r.ensureUniqueItemVisual(e,"style");n[r.getVisual("drawType")]=i,r.setItemVisual(e,"colorFromPalette",!1);break;case"opacity":r.ensureUniqueItemVisual(e,"style").opacity=i;break;case"symbol":case"symbolSize":case"liftZ":r.setItemVisual(e,t,i);break;default:}}function n1(r,e){function t(i,n){var a=[];return i.eachComponent({mainType:"series",subType:r,query:n},function(o){a.push(o.seriesIndex)}),a}N([[r+"ToggleSelect","toggleSelect"],[r+"Select","select"],[r+"UnSelect","unselect"]],function(i){e(i[0],function(n,a,o){n=fe({},n),o.dispatchAction(fe(n,{type:i[1],seriesIndex:t(a,n)}))})})}function vv(r,e,t,i,n){var a=r+e;t.isSilent(a)||i.eachComponent({mainType:"series",subType:"pie"},function(o){for(var s=o.seriesIndex,l=o.option.selectedMap,u=n.selected,c=0;c<u.length;c++)if(u[c].seriesIndex===s){var f=o.getData(),h=$o(f,n.fromActionPayload);t.trigger(a,{type:a,seriesId:o.id,name:pe(h)?f.getName(h[0]):f.getName(h),selected:Ce(l)?l:fe({},l)})}})}function kW(r,e,t){r.on("selectchanged",function(i){var n=t.getModel();i.isFromClick?(vv("map","selectchanged",e,n,i),vv("pie","selectchanged",e,n,i)):i.fromAction==="select"?(vv("map","selected",e,n,i),vv("pie","selected",e,n,i)):i.fromAction==="unselect"&&(vv("map","unselected",e,n,i),vv("pie","unselected",e,n,i))})}function qs(r,e,t){for(var i;r&&!(e(r)&&(i=r,t));)r=r.__hostTarget||r.parent;return i}var Mhe=Math.round(Math.random()*9),bhe=typeof Object.defineProperty=="function",whe=function(){function r(){this._id="__ec_inner_"+Mhe++}return r.prototype.get=function(e){return this._guard(e)[this._id]},r.prototype.set=function(e,t){var i=this._guard(e);return bhe?Object.defineProperty(i,this._id,{value:t,enumerable:!1,configurable:!0}):i[this._id]=t,this},r.prototype.delete=function(e){return this.has(e)?(delete this._guard(e)[this._id],!0):!1},r.prototype.has=function(e){return!!this._guard(e)[this._id]},r.prototype._guard=function(e){if(e!==Object(e))throw TypeError("Value of WeakMap is not a non-null object.");return e},r}(),VW=whe;var The=ut.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(r,e){var t=e.cx,i=e.cy,n=e.width/2,a=e.height/2;r.moveTo(t,i-a),r.lineTo(t+n,i+a),r.lineTo(t-n,i+a),r.closePath()}}),Ehe=ut.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(r,e){var t=e.cx,i=e.cy,n=e.width/2,a=e.height/2;r.moveTo(t,i-a),r.lineTo(t+n,i),r.lineTo(t,i+a),r.lineTo(t-n,i),r.closePath()}}),Ahe=ut.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(r,e){var t=e.x,i=e.y,n=e.width/5*3,a=Math.max(n,e.height),o=n/2,s=o*o/(a-o),l=i-a+o+s,u=Math.asin(s/o),c=Math.cos(u)*o,f=Math.sin(u),h=Math.cos(u),p=o*.6,d=o*.7;r.moveTo(t-c,l+s),r.arc(t,l,o,Math.PI-u,Math.PI*2+u),r.bezierCurveTo(t+c-f*p,l+s+h*p,t,i-d,t,i),r.bezierCurveTo(t,i-d,t-c+f*p,l+s+h*p,t-c,l+s),r.closePath()}}),Che=ut.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(r,e){var t=e.height,i=e.width,n=e.x,a=e.y,o=i/3*2;r.moveTo(n,a),r.lineTo(n+o,a+t),r.lineTo(n,a+t/4*3),r.lineTo(n-o,a+t),r.lineTo(n,a),r.closePath()}}),Rhe={line:Jr,rect:Et,roundRect:Et,square:Et,circle:ua,diamond:Ehe,pin:Ahe,arrow:Che,triangle:The},Lhe={line:function(r,e,t,i,n){n.x1=r,n.y1=e+i/2,n.x2=r+t,n.y2=e+i/2},rect:function(r,e,t,i,n){n.x=r,n.y=e,n.width=t,n.height=i},roundRect:function(r,e,t,i,n){n.x=r,n.y=e,n.width=t,n.height=i,n.r=Math.min(t,i)/4},square:function(r,e,t,i,n){var a=Math.min(t,i);n.x=r,n.y=e,n.width=a,n.height=a},circle:function(r,e,t,i,n){n.cx=r+t/2,n.cy=e+i/2,n.r=Math.min(t,i)/2},diamond:function(r,e,t,i,n){n.cx=r+t/2,n.cy=e+i/2,n.width=t,n.height=i},pin:function(r,e,t,i,n){n.x=r+t/2,n.y=e+i/2,n.width=t,n.height=i},arrow:function(r,e,t,i,n){n.x=r+t/2,n.y=e+i/2,n.width=t,n.height=i},triangle:function(r,e,t,i,n){n.cx=r+t/2,n.cy=e+i/2,n.width=t,n.height=i}},X_={};N(Rhe,function(r,e){X_[e]=new r});var Phe=ut.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(r,e,t){var i=_p(r,e,t),n=this.shape;return n&&n.symbolType==="pin"&&e.position==="inside"&&(i.y=t.y+t.height*.4),i},buildPath:function(r,e,t){var i=e.symbolType;if(i!=="none"){var n=X_[i];n||(i="rect",n=X_[i]),Lhe[i](e.x,e.y,e.width,e.height,n.shape),n.buildPath(r,n.shape,t)}}});function Dhe(r,e){if(this.type!=="image"){var t=this.style;this.__isEmptyBrush?(t.stroke=r,t.fill=e||"#fff",t.lineWidth=2):this.shape.symbolType==="line"?t.stroke=r:t.fill=r,this.markRedraw()}}function Sr(r,e,t,i,n,a,o){var s=r.indexOf("empty")===0;s&&(r=r.substr(5,1).toLowerCase()+r.substr(6));var l;return r.indexOf("image://")===0?l=OP(r.slice(8),new lt(e,t,i,n),o?"center":"cover"):r.indexOf("path://")===0?l=iv(r.slice(7),{},new lt(e,t,i,n),o?"center":"cover"):l=new Phe({shape:{symbolType:r,x:e,y:t,width:i,height:n}}),l.__isEmptyBrush=s,l.setColor=Dhe,a&&l.setColor(a),l}function Zs(r){return pe(r)||(r=[+r,+r]),[r[0]||0,r[1]||0]}function bo(r,e){if(r!=null)return pe(r)||(r=[r,r]),[ze(r[0],e[0])||0,ze(ft(r[1],r[0]),e[1])||0]}function qp(r){return isFinite(r)}function Ihe(r,e,t){var i=e.x==null?0:e.x,n=e.x2==null?1:e.x2,a=e.y==null?0:e.y,o=e.y2==null?0:e.y2;e.global||(i=i*t.width+t.x,n=n*t.width+t.x,a=a*t.height+t.y,o=o*t.height+t.y),i=qp(i)?i:0,n=qp(n)?n:1,a=qp(a)?a:0,o=qp(o)?o:0;var s=r.createLinearGradient(i,a,n,o);return s}function Nhe(r,e,t){var i=t.width,n=t.height,a=Math.min(i,n),o=e.x==null?.5:e.x,s=e.y==null?.5:e.y,l=e.r==null?.5:e.r;e.global||(o=o*i+t.x,s=s*n+t.y,l=l*a),o=qp(o)?o:.5,s=qp(s)?s:.5,l=l>=0&&qp(l)?l:.5;var u=r.createRadialGradient(o,s,0,o,s,l);return u}function Y_(r,e,t){for(var i=e.type==="radial"?Nhe(r,e,t):Ihe(r,e,t),n=e.colorStops,a=0;a<n.length;a++)i.addColorStop(n[a].offset,n[a].color);return i}function HW(r,e){if(r===e||!r&&!e)return!1;if(!r||!e||r.length!==e.length)return!0;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!0;return!1}function a1(r){return parseInt(r,10)}function Df(r,e,t){var i=["width","height"][e],n=["clientWidth","clientHeight"][e],a=["paddingLeft","paddingTop"][e],o=["paddingRight","paddingBottom"][e];if(t[i]!=null&&t[i]!=="auto")return parseFloat(t[i]);var s=document.defaultView.getComputedStyle(r);return(r[n]||a1(s[i])||a1(r.style[i]))-(a1(s[a])||0)-(a1(s[o])||0)|0}function Uhe(r,e){return!r||r==="solid"||!(e>0)?null:r==="dashed"?[4*e,2*e]:r==="dotted"?[e]:Ct(r)?[r]:pe(r)?r:null}function q_(r){var e=r.style,t=e.lineDash&&e.lineWidth>0&&Uhe(e.lineDash,e.lineWidth),i=e.lineDashOffset;if(t){var n=e.strokeNoScale&&r.getLineScale?r.getLineScale():1;n&&n!==1&&(t=de(t,function(a){return a/n}),i/=n)}return[t,i]}var Ohe=new Ki(!0);function o1(r){var e=r.stroke;return!(e==null||e==="none"||!(r.lineWidth>0))}function WW(r){return typeof r=="string"&&r!=="none"}function s1(r){var e=r.fill;return e!=null&&e!=="none"}function XW(r,e){if(e.fillOpacity!=null&&e.fillOpacity!==1){var t=r.globalAlpha;r.globalAlpha=e.fillOpacity*e.opacity,r.fill(),r.globalAlpha=t}else r.fill()}function YW(r,e){if(e.strokeOpacity!=null&&e.strokeOpacity!==1){var t=r.globalAlpha;r.globalAlpha=e.strokeOpacity*e.opacity,r.stroke(),r.globalAlpha=t}else r.stroke()}function l1(r,e,t){var i=s_(e.image,e.__image,t);if(Ym(i)){var n=r.createPattern(i,e.repeat||"repeat");if(typeof DOMMatrix=="function"&&n&&n.setTransform){var a=new DOMMatrix;a.translateSelf(e.x||0,e.y||0),a.rotateSelf(0,0,(e.rotation||0)*Tm),a.scaleSelf(e.scaleX||1,e.scaleY||1),n.setTransform(a)}return n}}function zhe(r,e,t,i){var n,a=o1(t),o=s1(t),s=t.strokePercent,l=s<1,u=!e.path;(!e.silent||l)&&u&&e.createPathProxy();var c=e.path||Ohe,f=e.__dirty;if(!i){var h=t.fill,p=t.stroke,d=o&&!!h.colorStops,g=a&&!!p.colorStops,m=o&&!!h.image,v=a&&!!p.image,_=void 0,y=void 0,x=void 0,M=void 0,S=void 0;(d||g)&&(S=e.getBoundingRect()),d&&(_=f?Y_(r,h,S):e.__canvasFillGradient,e.__canvasFillGradient=_),g&&(y=f?Y_(r,p,S):e.__canvasStrokeGradient,e.__canvasStrokeGradient=y),m&&(x=f||!e.__canvasFillPattern?l1(r,h,e):e.__canvasFillPattern,e.__canvasFillPattern=x),v&&(M=f||!e.__canvasStrokePattern?l1(r,p,e):e.__canvasStrokePattern,e.__canvasStrokePattern=x),d?r.fillStyle=_:m&&(x?r.fillStyle=x:o=!1),g?r.strokeStyle=y:v&&(M?r.strokeStyle=M:a=!1)}var w=e.getGlobalScale();c.setScale(w[0],w[1],e.segmentIgnoreThreshold);var T,C;r.setLineDash&&t.lineDash&&(n=q_(e),T=n[0],C=n[1]);var b=!0;(u||f&hf)&&(c.setDPR(r.dpr),l?c.setContext(null):(c.setContext(r),b=!1),c.reset(),e.buildPath(c,e.shape,i),c.toStatic(),e.pathUpdated()),b&&c.rebuildPath(r,l?s:1),T&&(r.setLineDash(T),r.lineDashOffset=C),i||(t.strokeFirst?(a&&YW(r,t),o&&XW(r,t)):(o&&XW(r,t),a&&YW(r,t))),T&&r.setLineDash([])}function Fhe(r,e,t){var i=e.__image=s_(t.image,e.__image,e,e.onload);if(!(!i||!Ym(i))){var n=t.x||0,a=t.y||0,o=e.getWidth(),s=e.getHeight(),l=i.width/i.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=i.width,s=i.height),t.sWidth&&t.sHeight){var u=t.sx||0,c=t.sy||0;r.drawImage(i,u,c,t.sWidth,t.sHeight,n,a,o,s)}else if(t.sx&&t.sy){var u=t.sx,c=t.sy,f=o-u,h=s-c;r.drawImage(i,u,c,f,h,n,a,o,s)}else r.drawImage(i,n,a,o,s)}}function Bhe(r,e,t){var i,n=t.text;if(n!=null&&(n+=""),n){r.font=t.font||ho,r.textAlign=t.textAlign,r.textBaseline=t.textBaseline;var a=void 0,o=void 0;r.setLineDash&&t.lineDash&&(i=q_(e),a=i[0],o=i[1]),a&&(r.setLineDash(a),r.lineDashOffset=o),t.strokeFirst?(o1(t)&&r.strokeText(n,t.x,t.y),s1(t)&&r.fillText(n,t.x,t.y)):(s1(t)&&r.fillText(n,t.x,t.y),o1(t)&&r.strokeText(n,t.x,t.y)),a&&r.setLineDash([])}}var qW=["shadowBlur","shadowOffsetX","shadowOffsetY"],ZW=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function e6(r,e,t,i,n){var a=!1;if(!i&&(t=t||{},e===t))return!1;if(i||e.opacity!==t.opacity){Ha(r,n),a=!0;var o=Math.max(Math.min(e.opacity,1),0);r.globalAlpha=isNaN(o)?Ll.opacity:o}(i||e.blend!==t.blend)&&(a||(Ha(r,n),a=!0),r.globalCompositeOperation=e.blend||Ll.blend);for(var s=0;s<qW.length;s++){var l=qW[s];(i||e[l]!==t[l])&&(a||(Ha(r,n),a=!0),r[l]=r.dpr*(e[l]||0))}return(i||e.shadowColor!==t.shadowColor)&&(a||(Ha(r,n),a=!0),r.shadowColor=e.shadowColor||Ll.shadowColor),a}function jW(r,e,t,i,n){var a=Z_(e,n.inHover),o=i?null:t&&Z_(t,n.inHover)||{};if(a===o)return!1;var s=e6(r,a,o,i,n);if((i||a.fill!==o.fill)&&(s||(Ha(r,n),s=!0),WW(a.fill)&&(r.fillStyle=a.fill)),(i||a.stroke!==o.stroke)&&(s||(Ha(r,n),s=!0),WW(a.stroke)&&(r.strokeStyle=a.stroke)),(i||a.opacity!==o.opacity)&&(s||(Ha(r,n),s=!0),r.globalAlpha=a.opacity==null?1:a.opacity),e.hasStroke()){var l=a.lineWidth,u=l/(a.strokeNoScale&&e.getLineScale?e.getLineScale():1);r.lineWidth!==u&&(s||(Ha(r,n),s=!0),r.lineWidth=u)}for(var c=0;c<ZW.length;c++){var f=ZW[c],h=f[0];(i||a[h]!==o[h])&&(s||(Ha(r,n),s=!0),r[h]=a[h]||f[1])}return s}function khe(r,e,t,i,n){return e6(r,Z_(e,n.inHover),t&&Z_(t,n.inHover),i,n)}function t6(r,e){var t=e.transform,i=r.dpr||1;t?r.setTransform(i*t[0],i*t[1],i*t[2],i*t[3],i*t[4],i*t[5]):r.setTransform(i,0,0,i,0,0)}function Vhe(r,e,t){for(var i=!1,n=0;n<r.length;n++){var a=r[n];i=i||a.isZeroArea(),t6(e,a),e.beginPath(),a.buildPath(e,a.shape),e.clip()}t.allClipped=i}function Ghe(r,e){return r&&e?r[0]!==e[0]||r[1]!==e[1]||r[2]!==e[2]||r[3]!==e[3]||r[4]!==e[4]||r[5]!==e[5]:!(!r&&!e)}var KW=1,JW=2,$W=3,QW=4;function Hhe(r){var e=s1(r),t=o1(r);return!(r.lineDash||!(+e^+t)||e&&typeof r.fill!="string"||t&&typeof r.stroke!="string"||r.strokePercent<1||r.strokeOpacity<1||r.fillOpacity<1)}function Ha(r,e){e.batchFill&&r.fill(),e.batchStroke&&r.stroke(),e.batchFill="",e.batchStroke=""}function Z_(r,e){return e&&r.__hoverStyle||r.style}function u1(r,e){If(r,e,{inHover:!1,viewWidth:0,viewHeight:0},!0)}function If(r,e,t,i){var n=e.transform;if(!e.shouldBePainted(t.viewWidth,t.viewHeight,!1,!1)){e.__dirty&=~zi,e.__isRendered=!1;return}var a=e.__clipPaths,o=t.prevElClipPaths,s=!1,l=!1;if((!o||HW(a,o))&&(o&&o.length&&(Ha(r,t),r.restore(),l=s=!0,t.prevElClipPaths=null,t.allClipped=!1,t.prevEl=null),a&&a.length&&(Ha(r,t),r.save(),Vhe(a,r,t),s=!0),t.prevElClipPaths=a),t.allClipped){e.__isRendered=!1;return}e.beforeBrush&&e.beforeBrush(),e.innerBeforeBrush();var u=t.prevEl;u||(l=s=!0);var c=e instanceof ut&&e.autoBatch&&Hhe(e.style);s||Ghe(n,u.transform)?(Ha(r,t),t6(r,e)):c||Ha(r,t);var f=Z_(e,t.inHover);e instanceof ut?(t.lastDrawType!==KW&&(l=!0,t.lastDrawType=KW),jW(r,e,u,l,t),(!c||!t.batchFill&&!t.batchStroke)&&r.beginPath(),zhe(r,e,f,c),c&&(t.batchFill=f.fill||"",t.batchStroke=f.stroke||"")):e instanceof Mu?(t.lastDrawType!==$W&&(l=!0,t.lastDrawType=$W),jW(r,e,u,l,t),Bhe(r,e,f)):e instanceof Ur?(t.lastDrawType!==JW&&(l=!0,t.lastDrawType=JW),khe(r,e,u,l,t),Fhe(r,e,f)):e.getTemporalDisplayables&&(t.lastDrawType!==QW&&(l=!0,t.lastDrawType=QW),Whe(r,e,t)),c&&i&&Ha(r,t),e.innerAfterBrush(),e.afterBrush&&e.afterBrush(),t.prevEl=e,e.__dirty=0,e.__isRendered=!0}function Whe(r,e,t){var i=e.getDisplayables(),n=e.getTemporalDisplayables();r.save();var a={prevElClipPaths:null,prevEl:null,allClipped:!1,viewWidth:t.viewWidth,viewHeight:t.viewHeight,inHover:t.inHover},o,s;for(o=e.getCursor(),s=i.length;o<s;o++){var l=i[o];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),If(r,l,a,o===s-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),a.prevEl=l}for(var u=0,c=n.length;u<c;u++){var l=n[u];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),If(r,l,a,u===c-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),a.prevEl=l}e.clearTemporalDisplayables(),e.notClear=!0,r.restore()}var OD=new VW,r6=new yu(100),i6=["symbol","symbolSize","symbolKeepAspect","color","backgroundColor","dashArrayX","dashArrayY","maxTileWidth","maxTileHeight"];function js(r,e){if(r==="none")return null;var t=e.getDevicePixelRatio(),i=e.getZr(),n=i.painter.type==="svg";r.dirty&&OD.delete(r);var a=OD.get(r);if(a)return a;var o=Ye(r,{symbol:"rect",symbolSize:1,symbolKeepAspect:!0,color:"rgba(0, 0, 0, 0.2)",backgroundColor:null,dashArrayX:5,dashArrayY:5,rotation:0,maxTileWidth:512,maxTileHeight:512});o.backgroundColor==="none"&&(o.backgroundColor=null);var s={repeat:"repeat"};return l(s),s.rotation=o.rotation,s.scaleX=s.scaleY=n?1:1/t,OD.set(r,s),r.dirty=!1,s;function l(u){for(var c=[t],f=!0,h=0;h<i6.length;++h){var p=o[i6[h]];if(p!=null&&!pe(p)&&!Ce(p)&&!Ct(p)&&typeof p!="boolean"){f=!1;break}c.push(p)}var d;if(f){d=c.join(",")+(n?"-svg":"");var g=r6.get(d);g&&(n?u.svgElement=g:u.image=g)}var m=a6(o.dashArrayX),v=Xhe(o.dashArrayY),_=n6(o.symbol),y=Yhe(m),x=o6(v),M=!n&&Fn.createCanvas(),S=n&&{tag:"g",attrs:{},key:"dcl",children:[]},w=C(),T;M&&(M.width=w.width*t,M.height=w.height*t,T=M.getContext("2d")),b(),f&&r6.put(d,M||S),u.image=M,u.svgElement=S,u.svgWidth=w.width,u.svgHeight=w.height;function C(){for(var E=1,I=0,R=y.length;I<R;++I)E=JL(E,y[I]);for(var A=1,I=0,R=_.length;I<R;++I)A=JL(A,_[I].length);E*=A;var D=x*y.length*_.length;if(0)var U;return{width:Math.max(1,Math.min(E,o.maxTileWidth)),height:Math.max(1,Math.min(D,o.maxTileHeight))}}function b(){T&&(T.clearRect(0,0,M.width,M.height),o.backgroundColor&&(T.fillStyle=o.backgroundColor,T.fillRect(0,0,M.width,M.height)));for(var E=0,I=0;I<v.length;++I)E+=v[I];if(E<=0)return;for(var R=-x,A=0,D=0,U=0;R<w.height;){if(A%2===0){for(var B=D/2%_.length,z=0,k=0,G=0;z<w.width*2;){for(var Y=0,I=0;I<m[U].length;++I)Y+=m[U][I];if(Y<=0)break;if(k%2===0){var J=(1-o.symbolSize)*.5,Q=z+m[U][k]*J,V=R+v[A]*J,K=m[U][k]*o.symbolSize,ae=v[A]*o.symbolSize,ve=G/2%_[B].length;ue(Q,V,K,ae,_[B][ve])}z+=m[U][k],++G,++k,k===m[U].length&&(k=0)}++U,U===m.length&&(U=0)}R+=v[A],++D,++A,A===v.length&&(A=0)}function ue(se,Ee,q,H,We){var _e=n?1:t,xe=Sr(We,se*_e,Ee*_e,q*_e,H*_e,o.color,o.symbolKeepAspect);if(n){var Le=i.painter.renderOneToVNode(xe);Le&&S.children.push(Le)}else u1(T,xe)}}}}function n6(r){if(!r||r.length===0)return[["rect"]];if(Ce(r))return[[r]];for(var e=!0,t=0;t<r.length;++t)if(!Ce(r[t])){e=!1;break}if(e)return n6([r]);for(var i=[],t=0;t<r.length;++t)Ce(r[t])?i.push([r[t]]):i.push(r[t]);return i}function a6(r){if(!r||r.length===0)return[[0,0]];if(Ct(r)){var e=Math.ceil(r);return[[e,e]]}for(var t=!0,i=0;i<r.length;++i)if(!Ct(r[i])){t=!1;break}if(t)return a6([r]);for(var n=[],i=0;i<r.length;++i)if(Ct(r[i])){var e=Math.ceil(r[i]);n.push([e,e])}else{var e=de(r[i],function(s){return Math.ceil(s)});e.length%2===1?n.push(e.concat(e)):n.push(e)}return n}function Xhe(r){if(!r||typeof r=="object"&&r.length===0)return[0,0];if(Ct(r)){var e=Math.ceil(r);return[e,e]}var t=de(r,function(i){return Math.ceil(i)});return r.length%2?t.concat(t):t}function Yhe(r){return de(r,function(e){return o6(e)})}function o6(r){for(var e=0,t=0;t<r.length;++t)e+=r[t];return r.length%2===1?e*2:e}function zD(r,e){r.eachRawSeries(function(t){if(!r.isSeriesFiltered(t)){var i=t.getData();i.hasItemVisual()&&i.each(function(o){var s=i.getItemVisual(o,"decal");if(s){var l=i.ensureUniqueItemVisual(o,"style");l.decal=js(s,e)}});var n=i.getVisual("decal");if(n){var a=i.getVisual("style");a.decal=js(n,e)}}})}var qhe=new Pi,ss=qhe;var s6={};function l6(r,e){s6[r]=e}function u6(r){return s6[r]}var Zhe=1,jhe=800,Khe=900,Jhe=1e3,$he=2e3,Qhe=5e3,_6=1e3,epe=1100,ZD=2e3,x6=3e3,tpe=4e3,d1=4500,rpe=4600,ipe=5e3,npe=6e3,S6=7e3,M6={PROCESSOR:{FILTER:Jhe,SERIES_FILTER:jhe,STATISTIC:Qhe},VISUAL:{LAYOUT:_6,PROGRESSIVE_LAYOUT:epe,GLOBAL:ZD,CHART:x6,POST_CHART_LAYOUT:rpe,COMPONENT:tpe,BRUSH:ipe,CHART_ITEM:d1,ARIA:npe,DECAL:S6}},Xn="__flagInMainProcess",Wa="__pendingUpdate",FD="__needsUpdateStatus",c6=/^[a-zA-Z0-9_]+$/,BD="__connectUpdateStatus",f6=0,ape=1,ope=2;function b6(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.isDisposed()){this.id;return}return T6(this,r,e)}}function w6(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return T6(this,r,e)}}function T6(r,e,t){return t[0]=t[0]&&t[0].toLowerCase(),Pi.prototype[e].apply(r,t)}var E6=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Pi),A6=E6.prototype;A6.on=w6("on");A6.off=w6("off");var gv,kD,c1,Nf,VD,GD,HD,j_,K_,h6,p6,WD,d6,f1,m6,C6,ls,v6,R6=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,new OW)||this;a._chartsViews=[],a._chartsMap={},a._componentsViews=[],a._componentsMap={},a._pendingActions=[],n=n||{},Ce(i)&&(i=L6[i]),a._dom=t;var o="canvas",s="auto",l=!1;if(0)var u;n.ssr&&ZG(function(p){var d=rt(p),g=d.dataIndex;if(g!=null){var m=ke();return m.set("series_index",d.seriesIndex),m.set("data_index",g),d.ssrType&&m.set("ssr_type",d.ssrType),m}});var c=a._zr=ZL(t,{renderer:n.renderer||o,devicePixelRatio:n.devicePixelRatio,width:n.width,height:n.height,ssr:n.ssr,useDirtyRect:ft(n.useDirtyRect,l),useCoarsePointer:ft(n.useCoarsePointer,s),pointerSize:n.pointerSize});a._ssr=n.ssr,a._throttledZrFlush=V_(Be(c.flush,c),17),i=Qe(i),i&&Fw(i,!0),a._theme=i,a._locale=c5(n.locale||Mw),a._coordSysMgr=new Nu;var f=a._api=m6(a);function h(p,d){return p.__prio-d.__prio}return sp(p1,h),sp(XD,h),a._scheduler=new ID(a,f,XD,p1),a._messageCenter=new E6,a._initEvents(),a.resize=Be(a.resize,a),c.animation.on("frame",a._onframe,a),h6(c,a),p6(c,a),tp(a),a}return e.prototype._onframe=function(){if(!this._disposed){v6(this);var t=this._scheduler;if(this[Wa]){var i=this[Wa].silent;this[Xn]=!0;try{gv(this),Nf.update.call(this,null,this[Wa].updateParams)}catch(l){throw this[Xn]=!1,this[Wa]=null,l}this._zr.flush(),this[Xn]=!1,this[Wa]=null,j_.call(this,i),K_.call(this,i)}else if(t.unfinished){var n=Zhe,a=this._model,o=this._api;t.unfinished=!1;do{var s=+new Date;t.performSeriesTasks(a),t.performDataProcessorTasks(a),GD(this,a),t.performVisualTasks(a),f1(this,this._model,o,"remain",{}),n-=+new Date-s}while(n>0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,i,n){if(!this[Xn]){if(this._disposed){this.id;return}var a,o,s;if(qe(i)&&(n=i.lazyUpdate,a=i.silent,o=i.replaceMerge,s=i.transition,i=i.notMerge),this[Xn]=!0,!this._model||i){var l=new F5(this._api),u=this._theme,c=this._model=new Ow;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(t,{replaceMerge:o},YD);var f={seriesTransition:s,optionChanged:!0};if(n)this[Wa]={silent:a,updateParams:f},this[Xn]=!1,this.getZr().wakeUp();else{try{gv(this),Nf.update.call(this,null,f)}catch(h){throw this[Wa]=null,this[Xn]=!1,h}this._ssr||this._zr.flush(),this[Wa]=null,this[Xn]=!1,j_.call(this,a),K_.call(this,a)}}},e.prototype.setTheme=function(){},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||zt.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){t=t||{};var i=this._zr.painter;return i.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){t=t||{};var i=this._zr.painter;return i.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(zt.svgSupported){var t=this._zr,i=t.storage.getDisplayList();return N(i,function(n){n.stopAnimation(null,!0)}),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(this._disposed){this.id;return}t=t||{};var i=t.excludeComponents,n=this._model,a=[],o=this;N(i,function(l){n.eachComponent({mainType:l},function(u){var c=o._componentsMap[u.__viewId];c.group.ignore||(a.push(c),c.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return N(a,function(l){l.group.ignore=!1}),s},e.prototype.getConnectedDataURL=function(t){if(this._disposed){this.id;return}var i=t.type==="svg",n=this.group,a=Math.min,o=Math.max,s=1/0;if(g6[n]){var l=s,u=s,c=-s,f=-s,h=[],p=t&&t.pixelRatio||this.getDevicePixelRatio();N($_,function(y,x){if(y.group===n){var M=i?y.getZr().painter.getSvgDom().innerHTML:y.renderToCanvas(Qe(t)),S=y.getDom().getBoundingClientRect();l=a(S.left,l),u=a(S.top,u),c=o(S.right,c),f=o(S.bottom,f),h.push({dom:M,left:S.left,top:S.top})}}),l*=p,u*=p,c*=p,f*=p;var d=c-l,g=f-u,m=Fn.createCanvas(),v=ZL(m,{renderer:i?"svg":"canvas"});if(v.resize({width:d,height:g}),i){var _="";return N(h,function(y){var x=y.left-l,M=y.top-u;_+='<g transform="translate('+x+","+M+')">'+y.dom+"</g>"}),v.painter.getSvgRoot().innerHTML=_,t.connectedBackgroundColor&&v.painter.setBackgroundColor(t.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}else return t.connectedBackgroundColor&&v.add(new Et({shape:{x:0,y:0,width:d,height:g},style:{fill:t.connectedBackgroundColor}})),N(h,function(y){var x=new Ur({style:{x:y.left*p-l,y:y.top*p-u,image:y.dom}});v.add(x)}),v.refreshImmediately(),m.toDataURL("image/"+(t&&t.type||"png"))}else return this.getDataURL(t)},e.prototype.convertToPixel=function(t,i){return VD(this,"convertToPixel",t,i)},e.prototype.convertFromPixel=function(t,i){return VD(this,"convertFromPixel",t,i)},e.prototype.containPixel=function(t,i){if(this._disposed){this.id;return}var n=this._model,a,o=yf(n,t);return N(o,function(s,l){l.indexOf("Models")>=0&&N(s,function(u){var c=u.coordinateSystem;if(c&&c.containPoint)a=a||!!c.containPoint(i);else if(l==="seriesModels"){var f=this._chartsMap[u.__viewId];f&&f.containPoint&&(a=a||f.containPoint(i,u))}},this)},this),!!a},e.prototype.getVisual=function(t,i){var n=this._model,a=yf(n,t,{defaultMainType:"series"}),o=a.seriesModel,s=o.getData(),l=a.hasOwnProperty("dataIndexInside")?a.dataIndexInside:a.hasOwnProperty("dataIndex")?s.indexOfRawIndex(a.dataIndex):null;return l!=null?W_(s,l,i):Bl(s,i)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t=this;N(spe,function(i){var n=function(a){var o=t.getModel(),s=a.target,l,u=i==="globalout";if(u?l={}:s&&qs(s,function(d){var g=rt(d);if(g&&g.dataIndex!=null){var m=g.dataModel||o.getSeriesByIndex(g.seriesIndex);return l=m&&m.getDataParams(g.dataIndex,g.dataType,s)||{},!0}else if(g.eventData)return l=fe({},g.eventData),!0},!0),l){var c=l.componentType,f=l.componentIndex;(c==="markLine"||c==="markPoint"||c==="markArea")&&(c="series",f=l.seriesIndex);var h=c&&f!=null&&o.getComponent(c,f),p=h&&t[h.mainType==="series"?"_chartsMap":"_componentsMap"][h.__viewId];l.event=a,l.type=i,t._$eventProcessor.eventInfo={targetEl:s,packedEvent:l,model:h,view:p},t.trigger(i,l)}};n.zrEventfulCallAtLast=!0,t._zr.on(i,n,t)}),N(J_,function(i,n){t._messageCenter.on(n,function(a){this.trigger(n,a)},t)}),N(["selectchanged"],function(i){t._messageCenter.on(i,function(n){this.trigger(i,n)},t)}),kW(this._messageCenter,this,this._api)},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var t=this.getDom();t&&QL(this.getDom(),KD,"");var i=this,n=i._api,a=i._model;N(i._componentsViews,function(o){o.dispose(a,n)}),N(i._chartsViews,function(o){o.dispose(a,n)}),i._zr.dispose(),i._dom=i._model=i._chartsMap=i._componentsMap=i._chartsViews=i._componentsViews=i._scheduler=i._api=i._zr=i._throttledZrFlush=i._theme=i._coordSysMgr=i._messageCenter=null,delete $_[i.id]},e.prototype.resize=function(t){if(!this[Xn]){if(this._disposed){this.id;return}this._zr.resize(t);var i=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!i){var n=i.resetOption("media"),a=t&&t.silent;this[Wa]&&(a==null&&(a=this[Wa].silent),n=!0,this[Wa]=null),this[Xn]=!0;try{n&&gv(this),Nf.update.call(this,{type:"resize",animation:fe({duration:0},t&&t.animation)})}catch(o){throw this[Xn]=!1,o}this[Xn]=!1,j_.call(this,a),K_.call(this,a)}}},e.prototype.showLoading=function(t,i){if(this._disposed){this.id;return}if(qe(t)&&(i=t,t=""),t=t||"default",this.hideLoading(),!!qD[t]){var n=qD[t](this._api,i),a=this._zr;this._loadingFX=n,a.add(n)}},e.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},e.prototype.makeActionFromEvent=function(t){var i=fe({},t);return i.type=J_[t.type],i},e.prototype.dispatchAction=function(t,i){if(this._disposed){this.id;return}if(qe(i)||(i={silent:!!i}),!!h1[t.type]&&this._model){if(this[Xn]){this._pendingActions.push(t);return}var n=i.silent;HD.call(this,t,n);var a=i.flush;a?this._zr.flush():a!==!1&&zt.browser.weChat&&this._throttledZrFlush(),j_.call(this,n),K_.call(this,n)}},e.prototype.updateLabelLayout=function(){ss.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed){this.id;return}var i=t.seriesIndex,n=this.getModel(),a=n.getSeriesByIndex(i);a.appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()},e.internalField=function(){gv=function(f){var h=f._scheduler;h.restorePipelines(f._model),h.prepareStageTasks(),kD(f,!0),kD(f,!1),h.plan()},kD=function(f,h){for(var p=f._model,d=f._scheduler,g=h?f._componentsViews:f._chartsViews,m=h?f._componentsMap:f._chartsMap,v=f._zr,_=f._api,y=0;y<g.length;y++)g[y].__alive=!1;h?p.eachComponent(function(S,w){S!=="series"&&x(w)}):p.eachSeries(x);function x(S){var w=S.__requireNewView;S.__requireNewView=!1;var T="_ec_"+S.id+"_"+S.type,C=!w&&m[T];if(!C){var b=Oa(S.type),E=h?er.getClass(b.main,b.sub):Yt.getClass(b.sub);C=new E,C.init(p,_),m[T]=C,g.push(C),v.add(C.group)}S.__viewId=C.__id=T,C.__alive=!0,C.__model=S,C.group.__ecComponentInfo={mainType:S.mainType,index:S.componentIndex},!h&&d.prepareView(C,S,p,_)}for(var y=0;y<g.length;){var M=g[y];M.__alive?y++:(!h&&M.renderTask.dispose(),v.remove(M.group),M.dispose(p,_),g.splice(y,1),m[M.__id]===M&&delete m[M.__id],M.__id=M.group.__ecComponentInfo=null)}},c1=function(f,h,p,d,g){var m=f._model;if(m.setUpdatePayload(p),!d){N([].concat(f._componentsViews).concat(f._chartsViews),M);return}var v={};v[d+"Id"]=p[d+"Id"],v[d+"Index"]=p[d+"Index"],v[d+"Name"]=p[d+"Name"];var _={mainType:d,query:v};g&&(_.subType=g);var y=p.excludeSeriesId,x;y!=null&&(x=ke(),N($t(y),function(S){var w=qr(S,null);w!=null&&x.set(w,!0)})),m&&m.eachComponent(_,function(S){var w=x&&x.get(S.id)!=null;if(!w)if(CP(p))if(S instanceof jt)p.type===Ef&&!p.notBlur&&!S.get(["emphasis","disabled"])&&f4(S,p,f._api);else{var T=rw(S.mainType,S.componentIndex,p.name,f._api),C=T.focusSelf,b=T.dispatchers;p.type===Ef&&C&&!p.notBlur&&Qb(S.mainType,S.componentIndex,f._api),b&&N(b,function(E){p.type===Ef?Bn(E):kn(E)})}else nw(p)&&S instanceof jt&&(d4(S,p,f._api),AP(S),ls(f))},f),m&&m.eachComponent(_,function(S){var w=x&&x.get(S.id)!=null;w||M(f[d==="series"?"_chartsMap":"_componentsMap"][S.__viewId])},f);function M(S){S&&S.__alive&&S[h]&&S[h](S.__model,m,f._api,p)}},Nf={prepareAndUpdate:function(f){gv(this),Nf.update.call(this,f,{optionChanged:f.newOption!=null})},update:function(f,h){var p=this._model,d=this._api,g=this._zr,m=this._coordSysMgr,v=this._scheduler;if(p){p.setUpdatePayload(f),v.restoreData(p,f),v.performSeriesTasks(p),m.create(p,d),v.performDataProcessorTasks(p,f),GD(this,p),m.update(p,d),t(p),v.performVisualTasks(p,f),WD(this,p,d,f,h);var _=p.get("backgroundColor")||"transparent",y=p.get("darkMode");g.setBackgroundColor(_),y!=null&&y!=="auto"&&g.setDarkMode(y),ss.trigger("afterupdate",p,d)}},updateTransform:function(f){var h=this,p=this._model,d=this._api;if(p){p.setUpdatePayload(f);var g=[];p.eachComponent(function(v,_){if(v!=="series"){var y=h.getViewOfComponentModel(_);if(y&&y.__alive)if(y.updateTransform){var x=y.updateTransform(_,p,d,f);x&&x.update&&g.push(y)}else g.push(y)}});var m=ke();p.eachSeries(function(v){var _=h._chartsMap[v.__viewId];if(_.updateTransform){var y=_.updateTransform(v,p,d,f);y&&y.update&&m.set(v.uid,1)}else m.set(v.uid,1)}),t(p),this._scheduler.performVisualTasks(p,f,{setDirty:!0,dirtyMap:m}),f1(this,p,d,f,{},m),ss.trigger("afterupdate",p,d)}},updateView:function(f){var h=this._model;h&&(h.setUpdatePayload(f),Yt.markUpdateMethod(f,"updateView"),t(h),this._scheduler.performVisualTasks(h,f,{setDirty:!0}),WD(this,h,this._api,f,{}),ss.trigger("afterupdate",h,this._api))},updateVisual:function(f){var h=this,p=this._model;p&&(p.setUpdatePayload(f),p.eachSeries(function(d){d.getData().clearAllVisual()}),Yt.markUpdateMethod(f,"updateVisual"),t(p),this._scheduler.performVisualTasks(p,f,{visualType:"visual",setDirty:!0}),p.eachComponent(function(d,g){if(d!=="series"){var m=h.getViewOfComponentModel(g);m&&m.__alive&&m.updateVisual(g,p,h._api,f)}}),p.eachSeries(function(d){var g=h._chartsMap[d.__viewId];g.updateVisual(d,p,h._api,f)}),ss.trigger("afterupdate",p,this._api))},updateLayout:function(f){Nf.update.call(this,f)}},VD=function(f,h,p,d){if(f._disposed){f.id;return}for(var g=f._model,m=f._coordSysMgr.getCoordinateSystems(),v,_=yf(g,p),y=0;y<m.length;y++){var x=m[y];if(x[h]&&(v=x[h](g,_,d))!=null)return v}},GD=function(f,h){var p=f._chartsMap,d=f._scheduler;h.eachSeries(function(g){d.updateStreamModes(g,p[g.__viewId])})},HD=function(f,h){var p=this,d=this.getModel(),g=f.type,m=f.escapeConnect,v=h1[g],_=v.actionInfo,y=(_.update||"update").split(":"),x=y.pop(),M=y[0]!=null&&Oa(y[0]);this[Xn]=!0;var S=[f],w=!1;f.batch&&(w=!0,S=de(f.batch,function(A){return A=Ye(fe({},A),f),A.batch=null,A}));var T=[],C,b=nw(f),E=CP(f);if(E&&EP(this._api),N(S,function(A){if(C=v.action(A,p._model,p._api),C=C||fe({},A),C.type=_.event||C.type,T.push(C),E){var D=a_(f),U=D.queryOptionMap,B=D.mainTypeSpecified,z=B?U.keys()[0]:"series";c1(p,x,A,z),ls(p)}else b?(c1(p,x,A,"series"),ls(p)):M&&c1(p,x,A,M.main,M.sub)}),x!=="none"&&!E&&!b&&!M)try{this[Wa]?(gv(this),Nf.update.call(this,f),this[Wa]=null):Nf[x].call(this,f)}catch(A){throw this[Xn]=!1,A}if(w?C={type:_.event||g,escapeConnect:m,batch:T}:C=T[0],this[Xn]=!1,!h){var I=this._messageCenter;if(I.trigger(C.type,C),b){var R={type:"selectchanged",escapeConnect:m,selected:m4(d),isFromClick:f.isFromClick||!1,fromAction:f.type,fromActionPayload:f};I.trigger(R.type,R)}}},j_=function(f){for(var h=this._pendingActions;h.length;){var p=h.shift();HD.call(this,p,f)}},K_=function(f){!f&&this.trigger("updated")},h6=function(f,h){f.on("rendered",function(p){h.trigger("rendered",p),f.animation.isFinished()&&!h[Wa]&&!h._scheduler.unfinished&&!h._pendingActions.length&&h.trigger("finished")})},p6=function(f,h){f.on("mouseover",function(p){var d=p.target,g=qs(d,Af);g&&(h4(g,p,h._api),ls(h))}).on("mouseout",function(p){var d=p.target,g=qs(d,Af);g&&(p4(g,p,h._api),ls(h))}).on("click",function(p){var d=p.target,g=qs(d,function(_){return rt(_).dataIndex!=null},!0);if(g){var m=g.selected?"unselect":"select",v=rt(g);h._api.dispatchAction({type:m,dataType:v.dataType,dataIndexInside:v.dataIndex,seriesIndex:v.seriesIndex,isFromClick:!0})}})};function t(f){f.clearColorPalette(),f.eachSeries(function(h){h.clearColorPalette()})}function i(f){var h=[],p=[],d=!1;if(f.eachComponent(function(_,y){var x=y.get("zlevel")||0,M=y.get("z")||0,S=y.getZLevelKey();d=d||!!S,(_==="series"?p:h).push({zlevel:x,z:M,idx:y.componentIndex,type:_,key:S})}),d){var g=h.concat(p),m,v;sp(g,function(_,y){return _.zlevel===y.zlevel?_.z-y.z:_.zlevel-y.zlevel}),N(g,function(_){var y=f.getComponent(_.type,_.idx),x=_.zlevel,M=_.key;m!=null&&(x=Math.max(m,x)),M?(x===m&&M!==v&&x++,v=M):v&&(x===m&&x++,v=""),m=x,y.setZLevel(x)})}}WD=function(f,h,p,d,g){i(h),d6(f,h,p,d,g),N(f._chartsViews,function(m){m.__alive=!1}),f1(f,h,p,d,g),N(f._chartsViews,function(m){m.__alive||m.remove(h,p)})},d6=function(f,h,p,d,g,m){N(m||f._componentsViews,function(v){var _=v.__model;u(_,v),v.render(_,h,p,d),s(_,v),c(_,v)})},f1=function(f,h,p,d,g,m){var v=f._scheduler;g=fe(g||{},{updatedSeries:h.getSeries()}),ss.trigger("series:beforeupdate",h,p,g);var _=!1;h.eachSeries(function(y){var x=f._chartsMap[y.__viewId];x.__alive=!0;var M=x.renderTask;v.updatePayload(M,d),u(y,x),m&&m.get(y.uid)&&M.dirty(),M.perform(v.getPerformArgs(M))&&(_=!0),x.group.silent=!!y.get("silent"),o(y,x),AP(y)}),v.unfinished=_||v.unfinished,ss.trigger("series:layoutlabels",h,p,g),ss.trigger("series:transition",h,p,g),h.eachSeries(function(y){var x=f._chartsMap[y.__viewId];s(y,x),c(y,x)}),a(f,h),ss.trigger("series:afterupdate",h,p,g)},ls=function(f){f[FD]=!0,f.getZr().wakeUp()},v6=function(f){f[FD]&&(f.getZr().storage.traverse(function(h){Eu(h)||n(h)}),f[FD]=!1)};function n(f){for(var h=[],p=f.currentStates,d=0;d<p.length;d++){var g=p[d];g==="emphasis"||g==="blur"||g==="select"||h.push(g)}f.selected&&f.states.select&&h.push("select"),f.hoverState===h_&&f.states.emphasis?h.push("emphasis"):f.hoverState===Lp&&f.states.blur&&h.push("blur"),f.useStates(h)}function a(f,h){var p=f._zr,d=p.storage,g=0;d.traverse(function(m){m.isGroup||g++}),g>h.get("hoverLayerThreshold")&&!zt.node&&!zt.worker&&h.eachSeries(function(m){if(!m.preventUsingHoverLayer){var v=f._chartsMap[m.__viewId];v.__alive&&v.eachRendered(function(_){_.states.emphasis&&(_.states.emphasis.hoverLayer=!0)})}})}function o(f,h){var p=f.get("blendMode")||null;h.eachRendered(function(d){d.isGroup||(d.style.blend=p)})}function s(f,h){if(!f.preventAutoZ){var p=f.get("z")||0,d=f.get("zlevel")||0;h.eachRendered(function(g){return l(g,p,d,-1/0),!0})}}function l(f,h,p,d){var g=f.getTextContent(),m=f.getTextGuideLine(),v=f.isGroup;if(v)for(var _=f.childrenRef(),y=0;y<_.length;y++)d=Math.max(l(_[y],h,p,d),d);else f.z=h,f.zlevel=p,d=Math.max(f.z2,d);if(g&&(g.z=h,g.zlevel=p,isFinite(d)&&(g.z2=d+2)),m){var x=f.textGuideLineConfig;m.z=h,m.zlevel=p,isFinite(d)&&(m.z2=d+(x&&x.showAbove?1:-1))}return d}function u(f,h){h.eachRendered(function(p){if(!Eu(p)){var d=p.getTextContent(),g=p.getTextGuideLine();p.stateTransition&&(p.stateTransition=null),d&&d.stateTransition&&(d.stateTransition=null),g&&g.stateTransition&&(g.stateTransition=null),p.hasState()?(p.prevStates=p.currentStates,p.clearStates()):p.prevStates&&(p.prevStates=null)}})}function c(f,h){var p=f.getModel("stateAnimation"),d=f.isAnimationEnabled(),g=p.get("duration"),m=g>0?{duration:g,delay:p.get("delay"),easing:p.get("easing")}:null;h.eachRendered(function(v){if(v.states&&v.states.emphasis){if(Eu(v))return;if(v instanceof ut&&y4(v),v.__dirty){var _=v.prevStates;_&&v.useStates(_)}if(d){v.stateTransition=m;var y=v.getTextContent(),x=v.getTextGuideLine();y&&(y.stateTransition=m),x&&(x.stateTransition=m)}v.__dirty&&n(v)}})}m6=function(f){return new(function(h){Z(p,h);function p(){return h!==null&&h.apply(this,arguments)||this}return p.prototype.getCoordinateSystems=function(){return f._coordSysMgr.getCoordinateSystems()},p.prototype.getComponentByElement=function(d){for(;d;){var g=d.__ecComponentInfo;if(g!=null)return f._model.getComponent(g.mainType,g.index);d=d.parent}},p.prototype.enterEmphasis=function(d,g){Bn(d,g),ls(f)},p.prototype.leaveEmphasis=function(d,g){kn(d,g),ls(f)},p.prototype.enterBlur=function(d){tw(d),ls(f)},p.prototype.leaveBlur=function(d){m_(d),ls(f)},p.prototype.enterSelect=function(d){wP(d),ls(f)},p.prototype.leaveSelect=function(d){TP(d),ls(f)},p.prototype.getModel=function(){return f.getModel()},p.prototype.getViewOfComponentModel=function(d){return f.getViewOfComponentModel(d)},p.prototype.getViewOfSeriesModel=function(d){return f.getViewOfSeriesModel(d)},p}(zw))(f)},C6=function(f){function h(p,d){for(var g=0;g<p.length;g++){var m=p[g];m[BD]=d}}N(J_,function(p,d){f._messageCenter.on(d,function(g){if(g6[f.group]&&f[BD]!==f6){if(g&&g.escapeConnect)return;var m=f.makeActionFromEvent(g),v=[];N($_,function(_){_!==f&&_.group===f.group&&v.push(_)}),h(v,f6),N(v,function(_){_[BD]!==ape&&_.dispatchAction(m)}),h(v,ope)}})})}}(),e}(Pi),jD=R6.prototype;jD.on=b6("on");jD.off=b6("off");jD.one=function(r,e,t){var i=this;function n(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];e&&e.apply&&e.apply(this,a),i.off(r,n)}this.on.call(this,r,n,t)};var spe=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];var h1={},J_={},XD=[],YD=[],p1=[],L6={},qD={},$_={},g6={},lpe=+new Date-0,M5e=+new Date-0,KD="_echarts_instance_";function P6(r,e,t){var i=!(t&&t.ssr);if(i){var n=upe(r);if(n)return n}var a=new R6(r,e,t);return a.id="ec_"+lpe++,$_[a.id]=a,i&&QL(r,KD,a.id),C6(a),ss.trigger("afterinit",a),a}function upe(r){return $_[fH(r,KD)]}function D6(r,e){L6[r]=e}function JD(r){dt(YD,r)<0&&YD.push(r)}function $D(r,e){QD(XD,r,e,$he)}function I6(r){m1("afterinit",r)}function N6(r){m1("afterupdate",r)}function m1(r,e){ss.on(r,e)}function ha(r,e,t){He(e)&&(t=e,e="");var i=qe(r)?r.type:[r,r={event:e}][0];r.event=(r.event||i).toLowerCase(),e=r.event,!J_[e]&&(kr(c6.test(i)&&c6.test(e)),h1[i]||(h1[i]={action:t,actionInfo:r}),J_[e]=i)}function U6(r,e){Nu.register(r,e)}function O6(r,e){QD(p1,r,e,_6,"layout")}function Uf(r,e){QD(p1,r,e,x6,"visual")}var y6=[];function QD(r,e,t,i,n){if((He(e)||qe(e))&&(t=e,e=i),!(dt(y6,t)>=0)){y6.push(t);var a=ID.wrapStageHandler(t,n);a.__prio=e,a.__raw=t,r.push(a)}}function e2(r,e){qD[r]=e}function z6(r,e,t){var i=u6("registerMap");i&&i(r,e,t)}var F6=rW;Uf(ZD,wW);Uf(d1,TW);Uf(d1,EW);Uf(ZD,FW);Uf(d1,BW);Uf(S6,zD);JD(Fw);$D(Khe,dD);e2("default",DD);ha({type:Ef,event:Ef,update:Ef},Dr);ha({type:p_,event:p_,update:p_},Dr);ha({type:Km,event:Km,update:Km},Dr);ha({type:d_,event:d_,update:d_},Dr);ha({type:Jm,event:Jm,update:Jm},Dr);D6("light",PW);D6("dark",UW);var B6=[],cpe={registerPreprocessor:JD,registerProcessor:$D,registerPostInit:I6,registerPostUpdate:N6,registerUpdateLifecycle:m1,registerAction:ha,registerCoordinateSystem:U6,registerLayout:O6,registerVisual:Uf,registerTransform:F6,registerLoading:e2,registerMap:z6,registerImpl:l6,PRIORITY:M6,ComponentModel:Pt,ComponentView:er,SeriesModel:jt,ChartView:Yt,registerComponentModel:function(r){Pt.registerClass(r)},registerComponentView:function(r){er.registerClass(r)},registerSeriesModel:function(r){jt.registerClass(r)},registerChartView:function(r){Yt.registerClass(r)},registerSubTypeDefaulter:function(r,e){Pt.registerSubTypeDefaulter(r,e)},registerPainter:function(r,e){YG(r,e)}};function It(r){if(pe(r)){N(r,function(e){It(e)});return}dt(B6,r)>=0||(B6.push(r),He(r)&&(r={install:r}),r.install(cpe))}function Q_(r){return r==null?0:r.length||1}function k6(r){return r}var fpe=function(){function r(e,t,i,n,a,o){this._old=e,this._new=t,this._oldKeyGetter=i||k6,this._newKeyGetter=n||k6,this.context=a,this._diffModeMultiple=o==="multiple"}return r.prototype.add=function(e){return this._add=e,this},r.prototype.update=function(e){return this._update=e,this},r.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},r.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},r.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},r.prototype.remove=function(e){return this._remove=e,this},r.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},r.prototype._executeOneToOne=function(){var e=this._old,t=this._new,i={},n=new Array(e.length),a=new Array(t.length);this._initIndexMap(e,null,n,"_oldKeyGetter"),this._initIndexMap(t,i,a,"_newKeyGetter");for(var o=0;o<e.length;o++){var s=n[o],l=i[s],u=Q_(l);if(u>1){var c=l.shift();l.length===1&&(i[s]=l[0]),this._update&&this._update(c,o)}else u===1?(i[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(a,i)},r.prototype._executeMultiple=function(){var e=this._old,t=this._new,i={},n={},a=[],o=[];this._initIndexMap(e,i,a,"_oldKeyGetter"),this._initIndexMap(t,n,o,"_newKeyGetter");for(var s=0;s<a.length;s++){var l=a[s],u=i[l],c=n[l],f=Q_(u),h=Q_(c);if(f>1&&h===1)this._updateManyToOne&&this._updateManyToOne(c,u),n[l]=null;else if(f===1&&h>1)this._updateOneToMany&&this._updateOneToMany(c,u),n[l]=null;else if(f===1&&h===1)this._update&&this._update(c,u),n[l]=null;else if(f>1&&h>1)this._updateManyToMany&&this._updateManyToMany(c,u),n[l]=null;else if(f>1)for(var p=0;p<f;p++)this._remove&&this._remove(u[p]);else this._remove&&this._remove(u)}this._performRestAdd(o,n)},r.prototype._performRestAdd=function(e,t){for(var i=0;i<e.length;i++){var n=e[i],a=t[n],o=Q_(a);if(o>1)for(var s=0;s<o;s++)this._add&&this._add(a[s]);else o===1&&this._add&&this._add(a);t[n]=null}},r.prototype._initIndexMap=function(e,t,i,n){for(var a=this._diffModeMultiple,o=0;o<e.length;o++){var s="_ec_"+this[n](e[o],o);if(a||(i[o]=s),!!t){var l=t[s],u=Q_(l);u===0?(t[s]=o,a&&i.push(s)):u===1?t[s]=[l,o]:l.push(o)}}},r}(),An=fpe;var hpe=function(){function r(e,t){this._encode=e,this._schema=t}return r.prototype.get=function(){return{fullDimensions:this._getFullDimensionNames(),encode:this._encode}},r.prototype._getFullDimensionNames=function(){return this._cachedDimNames||(this._cachedDimNames=this._schema?this._schema.makeOutputDimensionNames():[]),this._cachedDimNames},r}();function V6(r,e){var t={},i=t.encode={},n=ke(),a=[],o=[],s={};N(r.dimensions,function(h){var p=r.getDimensionInfo(h),d=p.coordDim;if(d){var g=p.coordDimIndex;t2(i,d)[g]=h,p.isExtraCoord||(n.set(d,1),ppe(p.type)&&(a[0]=h),t2(s,d)[g]=r.getDimensionIndex(p.name)),p.defaultTooltip&&o.push(h)}Pw.each(function(m,v){var _=t2(i,v),y=p.otherDims[v];y!=null&&y!==!1&&(_[y]=p.name)})});var l=[],u={};n.each(function(h,p){var d=i[p];u[p]=d[0],l=l.concat(d)}),t.dataDimsOnCoord=l,t.dataDimIndicesOnCoord=de(l,function(h){return r.getDimensionInfo(h).storeDimIndex}),t.encodeFirstDimNotExtra=u;var c=i.label;c&&c.length&&(a=c.slice());var f=i.tooltip;return f&&f.length?o=f.slice():o.length||(o=a.slice()),i.defaultedLabel=a,i.defaultedTooltip=o,t.userOutput=new hpe(s,e),t}function t2(r,e){return r.hasOwnProperty(e)||(r[e]=[]),r[e]}function Zp(r){return r==="category"?"ordinal":r==="time"?"time":"float"}function ppe(r){return!(r==="ordinal"||r==="time")}var dpe=function(){function r(e){this.otherDims={},e!=null&&fe(this,e)}return r}(),yv=dpe;var mpe=vt(),vpe={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},r2=function(){function r(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return r.prototype.isDimensionOmitted=function(){return this._dimOmitted},r.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||(this._dimNameMap=n2(this.source)))},r.prototype.getSourceDimensionIndex=function(e){return ft(this._dimNameMap.get(e),-1)},r.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},r.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=kw(this.source),i=!a2(e),n="",a=[],o=0,s=0;o<e;o++){var l=void 0,u=void 0,c=void 0,f=this.dimensions[s];if(f&&f.storeDimIndex===o)l=t?f.name:null,u=f.type,c=f.ordinalMeta,s++;else{var h=this.getSourceDimension(o);h&&(l=t?h.name:null,u=h.type)}a.push({property:l,type:u,ordinalMeta:c}),t&&l!=null&&(!f||!f.isCalculationCoord)&&(n+=i?l.replace(/\`/g,"`1").replace(/\$/g,"`2"):l),n+="$",n+=vpe[u]||"f",c&&(n+=c.uid),n+="$"}var p=this.source,d=[p.seriesLayoutBy,p.startIndex,n].join("$$");return{dimensions:a,hash:d}},r.prototype.makeOutputDimensionNames=function(){for(var e=[],t=0,i=0;t<this._fullDimCount;t++){var n=void 0,a=this.dimensions[i];if(a&&a.storeDimIndex===t)a.isCalculationCoord||(n=a.name),i++;else{var o=this.getSourceDimension(t);o&&(n=o.name)}e.push(n)}return e},r.prototype.appendCalculationDimension=function(e){this.dimensions.push(e),e.isCalculationCoord=!0,this._fullDimCount++,this._updateDimOmitted(!0)},r}();function g1(r){return r instanceof r2}function i2(r){for(var e=ke(),t=0;t<(r||[]).length;t++){var i=r[t],n=qe(i)?i.name:i;n!=null&&e.get(n)==null&&e.set(n,t)}return e}function n2(r){var e=mpe(r);return e.dimNameMap||(e.dimNameMap=i2(r.dimensionsDefine))}function a2(r){return r>30}var ex=qe,Of=de,gpe=typeof Int32Array>"u"?Array:Int32Array,ype="e\0\0",G6=-1,_pe=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],xpe=["_approximateExtent"],H6,y1,tx,rx,o2,_1,s2,Spe=function(){function r(e,t){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","lttbDownSample"];var i,n=!1;g1(e)?(i=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(n=!0,i=e),i=i||["x","y"];for(var a={},o=[],s={},l=!1,u={},c=0;c<i.length;c++){var f=i[c],h=Ce(f)?new yv({name:f}):f instanceof yv?f:new yv(f),p=h.name;h.type=h.type||"float",h.coordDim||(h.coordDim=p,h.coordDimIndex=0);var d=h.otherDims=h.otherDims||{};o.push(p),a[p]=h,u[p]!=null&&(l=!0),h.createInvertedIndices&&(s[p]=[]),d.itemName===0&&(this._nameDimIdx=c),d.itemId===0&&(this._idDimIdx=c),n&&(h.storeDimIndex=c)}if(this.dimensions=o,this._dimInfos=a,this._initGetDimensionInfo(l),this.hostModel=t,this._invertedIndicesMap=s,this._dimOmitted){var g=this._dimIdxToName=ke();N(o,function(m){g.set(a[m].storeDimIndex,m)})}}return r.prototype.getDimension=function(e){var t=this._recognizeDimIndex(e);if(t==null)return e;if(t=e,!this._dimOmitted)return this.dimensions[t];var i=this._dimIdxToName.get(t);if(i!=null)return i;var n=this._schema.getSourceDimension(t);if(n)return n.name},r.prototype.getDimensionIndex=function(e){var t=this._recognizeDimIndex(e);if(t!=null)return t;if(e==null)return-1;var i=this._getDimInfo(e);return i?i.storeDimIndex:this._dimOmitted?this._schema.getSourceDimensionIndex(e):-1},r.prototype._recognizeDimIndex=function(e){if(Ct(e)||e!=null&&!isNaN(e)&&!this._getDimInfo(e)&&(!this._dimOmitted||this._schema.getSourceDimensionIndex(e)<0))return+e},r.prototype._getStoreDimIndex=function(e){var t=this.getDimensionIndex(e);return t},r.prototype.getDimensionInfo=function(e){return this._getDimInfo(this.getDimension(e))},r.prototype._initGetDimensionInfo=function(e){var t=this._dimInfos;this._getDimInfo=e?function(i){return t.hasOwnProperty(i)?t[i]:void 0}:function(i){return t[i]}},r.prototype.getDimensionsOnCoord=function(){return this._dimSummary.dataDimsOnCoord.slice()},r.prototype.mapDimension=function(e,t){var i=this._dimSummary;if(t==null)return i.encodeFirstDimNotExtra[e];var n=i.encode[e];return n?n[t]:null},r.prototype.mapDimensionsAll=function(e){var t=this._dimSummary,i=t.encode[e];return(i||[]).slice()},r.prototype.getStore=function(){return this._store},r.prototype.initData=function(e,t,i){var n=this,a;if(e instanceof B_&&(a=e),!a){var o=this.dimensions,s=hv(e)||ci(e)?new Vw(e,o.length):e;a=new B_;var l=Of(o,function(u){return{type:n._dimInfos[u].type,property:u}});a.initData(s,l,i)}this._store=a,this._nameList=(t||[]).slice(),this._idList=[],this._nameRepeatCount={},this._doInit(0,a.count()),this._dimSummary=V6(this,this._schema),this.userOutput=this._dimSummary.userOutput},r.prototype.appendData=function(e){var t=this._store.appendData(e);this._doInit(t[0],t[1])},r.prototype.appendValues=function(e,t){var i=this._store.appendValues(e,t.length),n=i.start,a=i.end,o=this._shouldMakeIdFromName();if(this._updateOrdinalMeta(),t)for(var s=n;s<a;s++){var l=s-n;this._nameList[s]=t[l],o&&s2(this,s)}},r.prototype._updateOrdinalMeta=function(){for(var e=this._store,t=this.dimensions,i=0;i<t.length;i++){var n=this._dimInfos[t[i]];n.ordinalMeta&&e.collectOrdinalMeta(n.storeDimIndex,n.ordinalMeta)}},r.prototype._shouldMakeIdFromName=function(){var e=this._store.getProvider();return this._idDimIdx==null&&e.getSource().sourceFormat!==So&&!e.fillStorage},r.prototype._doInit=function(e,t){if(!(e>=t)){var i=this._store,n=i.getProvider();this._updateOrdinalMeta();var a=this._nameList,o=this._idList,s=n.getSource().sourceFormat,l=s===fn;if(l&&!n.pure)for(var u=[],c=e;c<t;c++){var f=n.getItem(c,u);if(!this.hasItemOption&&aH(f)&&(this.hasItemOption=!0),f){var h=f.name;a[c]==null&&h!=null&&(a[c]=qr(h,null));var p=f.id;o[c]==null&&p!=null&&(o[c]=qr(p,null))}}if(this._shouldMakeIdFromName())for(var c=e;c<t;c++)s2(this,c);H6(this)}},r.prototype.getApproximateExtent=function(e){return this._approximateExtent[e]||this._store.getDataExtent(this._getStoreDimIndex(e))},r.prototype.setApproximateExtent=function(e,t){t=this.getDimension(t),this._approximateExtent[t]=e.slice()},r.prototype.getCalculationInfo=function(e){return this._calculationInfo[e]},r.prototype.setCalculationInfo=function(e,t){ex(e)?fe(this._calculationInfo,e):this._calculationInfo[e]=t},r.prototype.getName=function(e){var t=this.getRawIndex(e),i=this._nameList[t];return i==null&&this._nameDimIdx!=null&&(i=tx(this,this._nameDimIdx,t)),i==null&&(i=""),i},r.prototype._getCategory=function(e,t){var i=this._store.get(e,t),n=this._store.getOrdinalMeta(e);return n?n.categories[i]:i},r.prototype.getId=function(e){return y1(this,this.getRawIndex(e))},r.prototype.count=function(){return this._store.count()},r.prototype.get=function(e,t){var i=this._store,n=this._dimInfos[e];if(n)return i.get(n.storeDimIndex,t)},r.prototype.getByRawIndex=function(e,t){var i=this._store,n=this._dimInfos[e];if(n)return i.getByRawIndex(n.storeDimIndex,t)},r.prototype.getIndices=function(){return this._store.getIndices()},r.prototype.getDataExtent=function(e){return this._store.getDataExtent(this._getStoreDimIndex(e))},r.prototype.getSum=function(e){return this._store.getSum(this._getStoreDimIndex(e))},r.prototype.getMedian=function(e){return this._store.getMedian(this._getStoreDimIndex(e))},r.prototype.getValues=function(e,t){var i=this,n=this._store;return pe(e)?n.getValues(Of(e,function(a){return i._getStoreDimIndex(a)}),t):n.getValues(e)},r.prototype.hasValue=function(e){for(var t=this._dimSummary.dataDimIndicesOnCoord,i=0,n=t.length;i<n;i++)if(isNaN(this._store.get(t[i],e)))return!1;return!0},r.prototype.indexOfName=function(e){for(var t=0,i=this._store.count();t<i;t++)if(this.getName(t)===e)return t;return-1},r.prototype.getRawIndex=function(e){return this._store.getRawIndex(e)},r.prototype.indexOfRawIndex=function(e){return this._store.indexOfRawIndex(e)},r.prototype.rawIndexOf=function(e,t){var i=e&&this._invertedIndicesMap[e],n=i[t];return n==null||isNaN(n)?G6:n},r.prototype.indicesOfNearest=function(e,t,i){return this._store.indicesOfNearest(this._getStoreDimIndex(e),t,i)},r.prototype.each=function(e,t,i){"use strict";He(e)&&(i=t,t=e,e=[]);var n=i||this,a=Of(rx(e),this._getStoreDimIndex,this);this._store.each(a,n?Be(t,n):t)},r.prototype.filterSelf=function(e,t,i){"use strict";He(e)&&(i=t,t=e,e=[]);var n=i||this,a=Of(rx(e),this._getStoreDimIndex,this);return this._store=this._store.filter(a,n?Be(t,n):t),this},r.prototype.selectRange=function(e){"use strict";var t=this,i={},n=bt(e),a=[];return N(n,function(o){var s=t._getStoreDimIndex(o);i[s]=e[o],a.push(s)}),this._store=this._store.selectRange(i),this},r.prototype.mapArray=function(e,t,i){"use strict";He(e)&&(i=t,t=e,e=[]),i=i||this;var n=[];return this.each(e,function(){n.push(t&&t.apply(this,arguments))},i),n},r.prototype.map=function(e,t,i,n){"use strict";var a=i||n||this,o=Of(rx(e),this._getStoreDimIndex,this),s=_1(this);return s._store=this._store.map(o,a?Be(t,a):t),s},r.prototype.modify=function(e,t,i,n){var a=this,o=i||n||this,s=Of(rx(e),this._getStoreDimIndex,this);this._store.modify(s,o?Be(t,o):t)},r.prototype.downSample=function(e,t,i,n){var a=_1(this);return a._store=this._store.downSample(this._getStoreDimIndex(e),t,i,n),a},r.prototype.lttbDownSample=function(e,t){var i=_1(this);return i._store=this._store.lttbDownSample(this._getStoreDimIndex(e),t),i},r.prototype.getRawDataItem=function(e){return this._store.getRawDataItem(e)},r.prototype.getItemModel=function(e){var t=this.hostModel,i=this.getRawDataItem(e);return new Zt(i,t,t&&t.ecModel)},r.prototype.diff=function(e){var t=this;return new An(e?e.getStore().getIndices():[],this.getStore().getIndices(),function(i){return y1(e,i)},function(i){return y1(t,i)})},r.prototype.getVisual=function(e){var t=this._visual;return t&&t[e]},r.prototype.setVisual=function(e,t){this._visual=this._visual||{},ex(e)?fe(this._visual,e):this._visual[e]=t},r.prototype.getItemVisual=function(e,t){var i=this._itemVisuals[e],n=i&&i[t];return n??this.getVisual(t)},r.prototype.hasItemVisual=function(){return this._itemVisuals.length>0},r.prototype.ensureUniqueItemVisual=function(e,t){var i=this._itemVisuals,n=i[e];n||(n=i[e]={});var a=n[t];return a==null&&(a=this.getVisual(t),pe(a)?a=a.slice():ex(a)&&(a=fe({},a)),n[t]=a),a},r.prototype.setItemVisual=function(e,t,i){var n=this._itemVisuals[e]||{};this._itemVisuals[e]=n,ex(t)?fe(n,t):n[t]=i},r.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},r.prototype.setLayout=function(e,t){ex(e)?fe(this._layout,e):this._layout[e]=t},r.prototype.getLayout=function(e){return this._layout[e]},r.prototype.getItemLayout=function(e){return this._itemLayouts[e]},r.prototype.setItemLayout=function(e,t,i){this._itemLayouts[e]=i?fe(this._itemLayouts[e]||{},t):t},r.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},r.prototype.setItemGraphicEl=function(e,t){var i=this.hostModel&&this.hostModel.seriesIndex;f_(i,this.dataType,e,t),this._graphicEls[e]=t},r.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},r.prototype.eachItemGraphicEl=function(e,t){N(this._graphicEls,function(i,n){i&&e&&e.call(t,i,n)})},r.prototype.cloneShallow=function(e){return e||(e=new r(this._schema?this._schema:Of(this.dimensions,this._getDimInfo,this),this.hostModel)),o2(e,this),e._store=this._store,e},r.prototype.wrapMethod=function(e,t){var i=this[e];He(i)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var n=i.apply(this,arguments);return t.apply(this,[n].concat(nb(arguments)))})},r.internalField=function(){H6=function(e){var t=e._invertedIndicesMap;N(t,function(i,n){var a=e._dimInfos[n],o=a.ordinalMeta,s=e._store;if(o){i=t[n]=new gpe(o.categories.length);for(var l=0;l<i.length;l++)i[l]=G6;for(var l=0;l<s.count();l++)i[s.get(a.storeDimIndex,l)]=l}})},tx=function(e,t,i){return qr(e._getCategory(t,i),null)},y1=function(e,t){var i=e._idList[t];return i==null&&e._idDimIdx!=null&&(i=tx(e,e._idDimIdx,t)),i==null&&(i=ype+t),i},rx=function(e){return pe(e)||(e=e!=null?[e]:[]),e},_1=function(e){var t=new r(e._schema?e._schema:Of(e.dimensions,e._getDimInfo,e),e.hostModel);return o2(t,e),t},o2=function(e,t){N(_pe.concat(t.__wrappedMethods||[]),function(i){t.hasOwnProperty(i)&&(e[i]=t[i])}),e.__wrappedMethods=t.__wrappedMethods,N(xpe,function(i){e[i]=Qe(t[i])}),e._calculationInfo=fe({},t._calculationInfo)},s2=function(e,t){var i=e._nameList,n=e._idList,a=e._nameDimIdx,o=e._idDimIdx,s=i[t],l=n[t];if(s==null&&a!=null&&(i[t]=s=tx(e,a,t)),l==null&&o!=null&&(n[t]=l=tx(e,o,t)),l==null&&s!=null){var u=e._nameRepeatCount,c=u[s]=(u[s]||0)+1;l=s,c>1&&(l+="__ec__"+c),n[t]=l}}}(),r}(),ri=Spe;function Ks(r,e){hv(r)||(r=pv(r)),e=e||{};var t=e.coordDimensions||[],i=e.dimensionsDefine||r.dimensionsDefine||[],n=ke(),a=[],o=bpe(r,t,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&a2(o),l=i===r.dimensionsDefine,u=l?n2(r):i2(i),c=e.encodeDefine;!c&&e.encodeDefaulter&&(c=e.encodeDefaulter(r,o));for(var f=ke(c),h=new wD(o),p=0;p<h.length;p++)h[p]=-1;function d(C){var b=h[C];if(b<0){var E=i[C],I=qe(E)?E:{name:E},R=new yv,A=I.name;A!=null&&u.get(A)!=null&&(R.name=R.displayName=A),I.type!=null&&(R.type=I.type),I.displayName!=null&&(R.displayName=I.displayName);var D=a.length;return h[C]=D,R.storeDimIndex=C,a.push(R),R}return a[b]}if(!s)for(var p=0;p<o;p++)d(p);f.each(function(C,b){var E=$t(C).slice();if(E.length===1&&!Ce(E[0])&&E[0]<0){f.set(b,!1);return}var I=f.set(b,[]);N(E,function(R,A){var D=Ce(R)?u.get(R):R;D!=null&&D<o&&(I[A]=D,m(d(D),b,A))})});var g=0;N(t,function(C){var b,E,I,R;if(Ce(C))b=C,R={};else{R=C,b=R.name;var A=R.ordinalMeta;R.ordinalMeta=null,R=fe({},R),R.ordinalMeta=A,E=R.dimsDef,I=R.otherDims,R.name=R.coordDim=R.coordDimIndex=R.dimsDef=R.otherDims=null}var D=f.get(b);if(D!==!1){if(D=$t(D),!D.length)for(var U=0;U<(E&&E.length||1);U++){for(;g<o&&d(g).coordDim!=null;)g++;g<o&&D.push(g++)}N(D,function(B,z){var k=d(B);if(l&&R.type!=null&&(k.type=R.type),m(Ye(k,R),b,z),k.name==null&&E){var G=E[z];!qe(G)&&(G={name:G}),k.name=k.displayName=G.name,k.defaultTooltip=G.defaultTooltip}I&&Ye(k.otherDims,I)})}});function m(C,b,E){Pw.get(b)!=null?C.otherDims[b]=E:(C.coordDim=b,C.coordDimIndex=E,n.set(b,!0))}var v=e.generateCoord,_=e.generateCoordCount,y=_!=null;_=v?_||1:0;var x=v||"value";function M(C){C.name==null&&(C.name=C.coordDim)}if(s)N(a,function(C){M(C)}),a.sort(function(C,b){return C.storeDimIndex-b.storeDimIndex});else for(var S=0;S<o;S++){var w=d(S),T=w.coordDim;T==null&&(w.coordDim=wpe(x,n,y),w.coordDimIndex=0,(!v||_<=0)&&(w.isExtraCoord=!0),_--),M(w),w.type==null&&(Nw(r,S)===Ji.Must||w.isExtraCoord&&(w.otherDims.itemName!=null||w.otherDims.seriesName!=null))&&(w.type="ordinal")}return Mpe(a),new r2({source:r,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function Mpe(r){for(var e=ke(),t=0;t<r.length;t++){var i=r[t],n=i.name,a=e.get(n)||0;a>0&&(i.name=n+(a-1)),a++,e.set(n,a)}}function bpe(r,e,t,i){var n=Math.max(r.dimensionsDetectedCount||1,e.length,t.length,i||0);return N(e,function(a){var o;qe(a)&&(o=a.dimsDef)&&(n=Math.max(n,o.length))}),n}function wpe(r,e,t){if(t||e.hasKey(r)){for(var i=0;e.hasKey(r+i);)i++;r+=i}return e.set(r,!0),r}var Tpe=function(){function r(e){this.coordSysDims=[],this.axisMap=ke(),this.categoryAxisMap=ke(),this.coordSysName=e}return r}();function W6(r){var e=r.get("coordinateSystem"),t=new Tpe(e),i=Epe[e];if(i)return i(r,t,t.axisMap,t.categoryAxisMap),t}var Epe={cartesian2d:function(r,e,t,i){var n=r.getReferringComponents("xAxis",Ar).models[0],a=r.getReferringComponents("yAxis",Ar).models[0];e.coordSysDims=["x","y"],t.set("x",n),t.set("y",a),_v(n)&&(i.set("x",n),e.firstCategoryDimIndex=0),_v(a)&&(i.set("y",a),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(r,e,t,i){var n=r.getReferringComponents("singleAxis",Ar).models[0];e.coordSysDims=["single"],t.set("single",n),_v(n)&&(i.set("single",n),e.firstCategoryDimIndex=0)},polar:function(r,e,t,i){var n=r.getReferringComponents("polar",Ar).models[0],a=n.findAxisModel("radiusAxis"),o=n.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],t.set("radius",a),t.set("angle",o),_v(a)&&(i.set("radius",a),e.firstCategoryDimIndex=0),_v(o)&&(i.set("angle",o),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},geo:function(r,e,t,i){e.coordSysDims=["lng","lat"]},parallel:function(r,e,t,i){var n=r.ecModel,a=n.getComponent("parallel",r.get("parallelIndex")),o=e.coordSysDims=a.dimensions.slice();N(a.parallelAxisIndex,function(s,l){var u=n.getComponent("parallelAxis",s),c=o[l];t.set(c,u),_v(u)&&(i.set(c,u),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function _v(r){return r.get("type")==="category"}function X6(r,e,t){t=t||{};var i=t.byIndex,n=t.stackedCoordDimension,a,o,s;Ape(e)?a=e:(o=e.schema,a=o.dimensions,s=e.store);var l=!!(r&&r.get("stack")),u,c,f,h;if(N(a,function(_,y){Ce(_)&&(a[y]=_={name:_}),l&&!_.isExtraCoord&&(!i&&!u&&_.ordinalMeta&&(u=_),!c&&_.type!=="ordinal"&&_.type!=="time"&&(!n||n===_.coordDim)&&(c=_))}),c&&!i&&!u&&(i=!0),c){f="__\0ecstackresult_"+r.id,h="__\0ecstackedover_"+r.id,u&&(u.createInvertedIndices=!0);var p=c.coordDim,d=c.type,g=0;N(a,function(_){_.coordDim===p&&g++});var m={name:f,coordDim:p,coordDimIndex:g,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},v={name:h,coordDim:h,coordDimIndex:g+1,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(m.storeDimIndex=s.ensureCalculationDimension(h,d),v.storeDimIndex=s.ensureCalculationDimension(f,d)),o.appendCalculationDimension(m),o.appendCalculationDimension(v)):(a.push(m),a.push(v))}return{stackedDimension:c&&c.name,stackedByDimension:u&&u.name,isStackedByIndex:i,stackedOverDimension:h,stackResultDimension:f}}function Ape(r){return!g1(r.schema)}function wo(r,e){return!!e&&e===r.getCalculationInfo("stackedDimension")}function x1(r,e){return wo(r,e)?r.getCalculationInfo("stackResultDimension"):e}function Cpe(r,e){var t=r.get("coordinateSystem"),i=Nu.get(t),n;return e&&e.coordSysDims&&(n=de(e.coordSysDims,function(a){var o={name:a},s=e.axisMap.get(a);if(s){var l=s.get("type");o.type=Zp(l)}return o})),n||(n=i&&(i.getDimensionsInfo?i.getDimensionsInfo():i.dimensions.slice())||["x","y"]),n}function Rpe(r,e,t){var i,n;return t&&N(r,function(a,o){var s=a.coordDim,l=t.categoryAxisMap.get(s);l&&(i==null&&(i=o),a.ordinalMeta=l.getOrdinalMeta(),e&&(a.createInvertedIndices=!0)),a.otherDims.itemName!=null&&(n=!0)}),!n&&i!=null&&(r[i].otherDims.itemName=0),i}function Lpe(r,e,t){t=t||{};var i=e.getSourceManager(),n,a=!1;r?(a=!0,n=pv(r)):(n=i.getSource(),a=n.sourceFormat===fn);var o=W6(e),s=Cpe(e,o),l=t.useEncodeDefaulter,u=He(l)?l:l?ot(Dw,s,e):null,c={coordDimensions:s,generateCoord:t.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!a},f=Ks(n,c),h=Rpe(f.dimensions,t.createInvertedIndices,o),p=a?null:i.getSharedDataStore(f),d=X6(e,{schema:f,store:p}),g=new ri(f,e);g.setCalculationInfo(d);var m=h!=null&&Ppe(n)?function(v,_,y,x){return x===h?y:this.defaultDimValueGetter(v,_,y,x)}:null;return g.hasItemOption=!1,g.initData(a?n:p,null,m),g}function Ppe(r){if(r.sourceFormat===fn){var e=Dpe(r.data||[]);return!pe(zs(e))}}function Dpe(r){for(var e=0;e<r.length&&r[e]==null;)e++;return r[e]}var hn=Lpe;var Y6=function(){function r(e){this._setting=e||{},this._extent=[1/0,-1/0]}return r.prototype.getSetting=function(e){return this._setting[e]},r.prototype.unionExtent=function(e){var t=this._extent;e[0]<t[0]&&(t[0]=e[0]),e[1]>t[1]&&(t[1]=e[1])},r.prototype.unionExtentFromData=function(e,t){this.unionExtent(e.getApproximateExtent(t))},r.prototype.getExtent=function(){return this._extent.slice()},r.prototype.setExtent=function(e,t){var i=this._extent;isNaN(e)||(i[0]=e),isNaN(t)||(i[1]=t)},r.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},r.prototype.isBlank=function(){return this._isBlank},r.prototype.setBlank=function(e){this._isBlank=e},r}();xf(Y6);var Xa=Y6;var Ipe=0,Npe=function(){function r(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++Ipe}return r.createByAxisModel=function(e){var t=e.option,i=t.data,n=i&&de(i,Upe);return new r({categories:n,needCollect:!n,deduplication:t.dedplication!==!1})},r.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},r.prototype.parseAndCollect=function(e){var t,i=this._needCollect;if(!Ce(e)&&!i)return e;if(i&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,t;var n=this._getOrCreateMap();return t=n.get(e),t==null&&(i?(t=this.categories.length,this.categories[t]=e,n.set(e,t)):t=NaN),t},r.prototype._getOrCreateMap=function(){return this._map||(this._map=ke(this.categories))},r}();function Upe(r){return qe(r)&&r.value!=null?r.value:r+""}var ix=Npe;function nx(r){return r.type==="interval"||r.type==="log"}function Z6(r,e,t,i){var n={},a=r[1]-r[0],o=n.interval=Vm(a/e,!0);t!=null&&o<t&&(o=n.interval=t),i!=null&&o>i&&(o=n.interval=i);var s=n.intervalPrecision=l2(o),l=n.niceTickExtent=[Er(Math.ceil(r[0]/o)*o,s),Er(Math.floor(r[1]/o)*o,s)];return Ope(l,r),n}function S1(r){var e=Math.pow(10,km(r)),t=r/e;return t?t===2?t=3:t===3?t=5:t*=2:t=1,Er(t*e)}function l2(r){return Sn(r)+2}function q6(r,e,t){r[e]=Math.max(Math.min(r[e],t[1]),t[0])}function Ope(r,e){!isFinite(r[0])&&(r[0]=e[0]),!isFinite(r[1])&&(r[1]=e[1]),q6(r,0,e),q6(r,1,e),r[0]>r[1]&&(r[0]=r[1])}function zf(r,e){return r>=e[0]&&r<=e[1]}function Ff(r,e){return e[1]===e[0]?.5:(r-e[0])/(e[1]-e[0])}function Bf(r,e){return r*(e[1]-e[0])+e[0]}var j6=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;i.type="ordinal";var n=i.getSetting("ordinalMeta");return n||(n=new ix({})),pe(n)&&(n=new ix({categories:de(n,function(a){return qe(a)?a.value:a})})),i._ordinalMeta=n,i._extent=i.getSetting("extent")||[0,n.categories.length-1],i}return e.prototype.parse=function(t){return t==null?NaN:Ce(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return t=this.parse(t),zf(t,this._extent)&&this._ordinalMeta.categories[t]!=null},e.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),Ff(t,this._extent)},e.prototype.scale=function(t){return t=Math.round(Bf(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],i=this._extent,n=i[0];n<=i[1];)t.push({value:n}),n++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(t==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var i=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],a=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Math.min(s,i.length);o<l;++o){var u=i[o];n[o]=u,a[u]=o}for(var c=0;o<s;++o){for(;a[c]!=null;)c++;n.push(c),a[c]=o}},e.prototype._getTickNumber=function(t){var i=this._ticksByOrdinalNumber;return i&&t>=0&&t<i.length?i[t]:t},e.prototype.getRawOrdinalNumber=function(t){var i=this._ordinalNumbersByTick;return i&&t>=0&&t<i.length?i[t]:t},e.prototype.getLabel=function(t){if(!this.isBlank()){var i=this.getRawOrdinalNumber(t.value),n=this._ordinalMeta.categories[i];return n==null?"":n+""}},e.prototype.count=function(){return this._extent[1]-this._extent[0]+1},e.prototype.unionExtentFromData=function(t,i){this.unionExtent(t.getApproximateExtent(i))},e.prototype.isInExtentRange=function(t){return t=this._getTickNumber(t),this._extent[0]<=t&&this._extent[1]>=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(Xa);Xa.registerClass(j6);var ax=j6;var jp=Er,K6=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="interval",t._interval=0,t._intervalPrecision=2,t}return e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return zf(t,this._extent)},e.prototype.normalize=function(t){return Ff(t,this._extent)},e.prototype.scale=function(t){return Bf(t,this._extent)},e.prototype.setExtent=function(t,i){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(i)||(n[1]=parseFloat(i))},e.prototype.unionExtent=function(t){var i=this._extent;t[0]<i[0]&&(i[0]=t[0]),t[1]>i[1]&&(i[1]=t[1]),this.setExtent(i[0],i[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=l2(t)},e.prototype.getTicks=function(t){var i=this._interval,n=this._extent,a=this._niceExtent,o=this._intervalPrecision,s=[];if(!i)return s;var l=1e4;n[0]<a[0]&&(t?s.push({value:jp(a[0]-i,o)}):s.push({value:n[0]}));for(var u=a[0];u<=a[1]&&(s.push({value:u}),u=jp(u+i,o),u!==s[s.length-1].value);)if(s.length>l)return[];var c=s.length?s[s.length-1].value:a[1];return n[1]>c&&(t?s.push({value:jp(c+i,o)}):s.push({value:n[1]})),s},e.prototype.getMinorTicks=function(t){for(var i=this.getTicks(!0),n=[],a=this.getExtent(),o=1;o<i.length;o++){for(var s=i[o],l=i[o-1],u=0,c=[],f=s.value-l.value,h=f/t;u<t-1;){var p=jp(l.value+(u+1)*h);p>a[0]&&p<a[1]&&c.push(p),u++}n.push(c)}return n},e.prototype.getLabel=function(t,i){if(t==null)return"";var n=i&&i.precision;n==null?n=Sn(t.value)||0:n==="auto"&&(n=this._intervalPrecision);var a=jp(t.value,n,!0);return nD(a)},e.prototype.calcNiceTicks=function(t,i,n){t=t||5;var a=this._extent,o=a[1]-a[0];if(isFinite(o)){o<0&&(o=-o,a.reverse());var s=Z6(a,t,i,n);this._intervalPrecision=s.intervalPrecision,this._interval=s.interval,this._niceExtent=s.niceTickExtent}},e.prototype.calcNiceExtent=function(t){var i=this._extent;if(i[0]===i[1])if(i[0]!==0){var n=Math.abs(i[0]);t.fixMax||(i[1]+=n/2),i[0]-=n/2}else i[1]=1;var a=i[1]-i[0];isFinite(a)||(i[0]=0,i[1]=1),this.calcNiceTicks(t.splitNumber,t.minInterval,t.maxInterval);var o=this._interval;t.fixMin||(i[0]=jp(Math.floor(i[0]/o)*o)),t.fixMax||(i[1]=jp(Math.ceil(i[1]/o)*o))},e.prototype.setNiceExtent=function(t,i){this._niceExtent=[t,i]},e.type="interval",e}(Xa);Xa.registerClass(K6);var Ya=K6;var J6=typeof Float32Array<"u",zpe=J6?Float32Array:Array;function pa(r){return pe(r)?J6?new Float32Array(r):r:new zpe(r)}var u2="__ec_stack_";function c2(r){return r.get("stack")||u2+r.seriesIndex}function f2(r){return r.dim+r.index}function $6(r){var e=[],t=r.axis,i="axis0";if(t.type==="category"){for(var n=t.getBandWidth(),a=0;a<r.count;a++)e.push(Ye({bandWidth:n,axisKey:i,stackId:u2+a},r));for(var o=Q6(e),s=[],a=0;a<r.count;a++){var l=o[i][u2+a];l.offsetCenter=l.offset+l.width/2,s.push(l)}return s}}function h2(r,e){var t=[];return e.eachSeriesByType(r,function(i){t8(i)&&t.push(i)}),t}function Fpe(r){var e={};N(r,function(l){var u=l.coordinateSystem,c=u.getBaseAxis();if(!(c.type!=="time"&&c.type!=="value"))for(var f=l.getData(),h=c.dim+"_"+c.index,p=f.getDimensionIndex(f.mapDimension(c.dim)),d=f.getStore(),g=0,m=d.count();g<m;++g){var v=d.get(p,g);e[h]?e[h].push(v):e[h]=[v]}});var t={};for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(n){n.sort(function(l,u){return l-u});for(var a=null,o=1;o<n.length;++o){var s=n[o]-n[o-1];s>0&&(a=a===null?s:Math.min(a,s))}t[i]=a}}return t}function p2(r){var e=Fpe(r),t=[];return N(r,function(i){var n=i.coordinateSystem,a=n.getBaseAxis(),o=a.getExtent(),s;if(a.type==="category")s=a.getBandWidth();else if(a.type==="value"||a.type==="time"){var l=a.dim+"_"+a.index,u=e[l],c=Math.abs(o[1]-o[0]),f=a.scale.getExtent(),h=Math.abs(f[1]-f[0]);s=u?c/h*u:c}else{var p=i.getData();s=Math.abs(o[1]-o[0])/p.count()}var d=ze(i.get("barWidth"),s),g=ze(i.get("barMaxWidth"),s),m=ze(i.get("barMinWidth")||(r8(i)?.5:1),s),v=i.get("barGap"),_=i.get("barCategoryGap");t.push({bandWidth:s,barWidth:d,barMaxWidth:g,barMinWidth:m,barGap:v,barCategoryGap:_,axisKey:f2(a),stackId:c2(i)})}),Q6(t)}function Q6(r){var e={};N(r,function(i,n){var a=i.axisKey,o=i.bandWidth,s=e[a]||{bandWidth:o,remainedWidth:o,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},l=s.stacks;e[a]=s;var u=i.stackId;l[u]||s.autoWidthCount++,l[u]=l[u]||{width:0,maxWidth:0};var c=i.barWidth;c&&!l[u].width&&(l[u].width=c,c=Math.min(s.remainedWidth,c),s.remainedWidth-=c);var f=i.barMaxWidth;f&&(l[u].maxWidth=f);var h=i.barMinWidth;h&&(l[u].minWidth=h);var p=i.barGap;p!=null&&(s.gap=p);var d=i.barCategoryGap;d!=null&&(s.categoryGap=d)});var t={};return N(e,function(i,n){t[n]={};var a=i.stacks,o=i.bandWidth,s=i.categoryGap;if(s==null){var l=bt(a).length;s=Math.max(35-l*4,15)+"%"}var u=ze(s,o),c=ze(i.gap,1),f=i.remainedWidth,h=i.autoWidthCount,p=(f-u)/(h+(h-1)*c);p=Math.max(p,0),N(a,function(v){var _=v.maxWidth,y=v.minWidth;if(v.width){var x=v.width;_&&(x=Math.min(x,_)),y&&(x=Math.max(x,y)),v.width=x,f-=x+c*x,h--}else{var x=p;_&&_<x&&(x=Math.min(_,f)),y&&y>x&&(x=y),x!==p&&(v.width=x,f-=x+c*x,h--)}}),p=(f-u)/(h+(h-1)*c),p=Math.max(p,0);var d=0,g;N(a,function(v,_){v.width||(v.width=p),g=v,d+=v.width*(1+c)}),g&&(d-=g.width*c);var m=-d/2;N(a,function(v,_){t[n][_]=t[n][_]||{bandWidth:o,offset:m,width:v.width},m+=v.width*(1+c)})}),t}function e8(r,e,t){if(r&&e){var i=r[f2(e)];return i!=null&&t!=null?i[c2(t)]:i}}function b1(r,e){var t=h2(r,e),i=p2(t);N(t,function(n){var a=n.getData(),o=n.coordinateSystem,s=o.getBaseAxis(),l=c2(n),u=i[f2(s)][l],c=u.offset,f=u.width;a.setLayout({bandWidth:u.bandWidth,offset:c,size:f})})}function w1(r){return{seriesType:r,plan:Mo(),reset:function(e){if(t8(e)){var t=e.getData(),i=e.coordinateSystem,n=i.getBaseAxis(),a=i.getOtherAxis(n),o=t.getDimensionIndex(t.mapDimension(a.dim)),s=t.getDimensionIndex(t.mapDimension(n.dim)),l=e.get("showBackground",!0),u=t.mapDimension(a.dim),c=t.getCalculationInfo("stackResultDimension"),f=wo(t,u)&&!!t.getCalculationInfo("stackedOnSeries"),h=a.isHorizontal(),p=Bpe(n,a),d=r8(e),g=e.get("barMinHeight")||0,m=c&&t.getDimensionIndex(c),v=t.getLayout("size"),_=t.getLayout("offset");return{progress:function(y,x){for(var M=y.count,S=d&&pa(M*3),w=d&&l&&pa(M*3),T=d&&pa(M),C=i.master.getRect(),b=h?C.width:C.height,E,I=x.getStore(),R=0;(E=y.next())!=null;){var A=I.get(f?m:o,E),D=I.get(s,E),U=p,B=void 0;f&&(B=+A-I.get(o,E));var z=void 0,k=void 0,G=void 0,Y=void 0;if(h){var J=i.dataToPoint([A,D]);if(f){var Q=i.dataToPoint([B,D]);U=Q[0]}z=U,k=J[1]+_,G=J[0]-U,Y=v,Math.abs(G)<g&&(G=(G<0?-1:1)*g)}else{var J=i.dataToPoint([D,A]);if(f){var Q=i.dataToPoint([D,B]);U=Q[1]}z=J[0]+_,k=U,G=v,Y=J[1]-U,Math.abs(Y)<g&&(Y=(Y<=0?-1:1)*g)}d?(S[R]=z,S[R+1]=k,S[R+2]=h?G:Y,w&&(w[R]=h?C.x:z,w[R+1]=h?k:C.y,w[R+2]=b),T[E]=E):x.setItemLayout(E,{x:z,y:k,width:G,height:Y}),R+=3}d&&x.setLayout({largePoints:S,largeDataIndices:T,largeBackgroundPoints:w,valueAxisHorizontal:h})}}}}}}function t8(r){return r.coordinateSystem&&r.coordinateSystem.type==="cartesian2d"}function r8(r){return r.pipelineContext&&r.pipelineContext.large}function Bpe(r,e){return e.toGlobalCoord(e.dataToCoord(e.type==="log"?1:0))}var kpe=function(r,e,t,i){for(;t<i;){var n=t+i>>>1;r[n][1]<e?t=n+1:i=n}return t},n8=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="time",i}return e.prototype.getLabel=function(t){var i=this.getSetting("useUTC");return Vp(t.value,ZP[p5(kp(this._minLevelUnit))]||ZP.second,i,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,i,n){var a=this.getSetting("useUTC"),o=this.getSetting("locale");return d5(t,i,n,o,a)},e.prototype.getTicks=function(){var t=this._interval,i=this._extent,n=[];if(!t)return n;n.push({value:i[0],level:0});var a=this.getSetting("useUTC"),o=qpe(this._minLevelUnit,this._approxInterval,a,i);return n=n.concat(o),n.push({value:i[1],level:0}),n},e.prototype.calcNiceExtent=function(t){var i=this._extent;if(i[0]===i[1]&&(i[0]-=_o,i[1]+=_o),i[1]===-1/0&&i[0]===1/0){var n=new Date;i[1]=+new Date(n.getFullYear(),n.getMonth(),n.getDate()),i[0]=i[1]-_o}this.calcNiceTicks(t.splitNumber,t.minInterval,t.maxInterval)},e.prototype.calcNiceTicks=function(t,i,n){t=t||10;var a=this._extent,o=a[1]-a[0];this._approxInterval=o/t,i!=null&&this._approxInterval<i&&(this._approxInterval=i),n!=null&&this._approxInterval>n&&(this._approxInterval=n);var s=T1.length,l=Math.min(kpe(T1,this._approxInterval,0,s),s-1);this._interval=T1[l][1],this._minLevelUnit=T1[Math.max(l-1,0)][0]},e.prototype.parse=function(t){return Ct(t)?t:+Mn(t)},e.prototype.contain=function(t){return zf(this.parse(t),this._extent)},e.prototype.normalize=function(t){return Ff(this.parse(t),this._extent)},e.prototype.scale=function(t){return Bf(t,this._extent)},e.type="time",e}(Ya),T1=[["second",ww],["minute",Tw],["hour",lv],["quarter-day",lv*6],["half-day",lv*12],["day",_o*1.2],["half-week",_o*3.5],["week",_o*7],["month",_o*31],["quarter",_o*95],["half-year",qP/2],["year",qP]];function Vpe(r,e,t,i){var n=Mn(e),a=Mn(t),o=function(d){return KP(n,d,i)===KP(a,d,i)},s=function(){return o("year")},l=function(){return s()&&o("month")},u=function(){return l()&&o("day")},c=function(){return u()&&o("hour")},f=function(){return c()&&o("minute")},h=function(){return f()&&o("second")},p=function(){return h()&&o("millisecond")};switch(r){case"year":return s();case"month":return l();case"day":return u();case"hour":return c();case"minute":return f();case"second":return h();case"millisecond":return p()}}function Gpe(r,e){return r/=_o,r>16?16:r>7.5?7:r>3.5?4:r>1.5?2:1}function Hpe(r){var e=30*_o;return r/=e,r>6?6:r>3?3:r>2?2:1}function Wpe(r){return r/=lv,r>12?12:r>6?6:r>3.5?4:r>2?2:1}function i8(r,e){return r/=e?Tw:ww,r>30?30:r>20?20:r>15?15:r>10?10:r>5?5:r>2?2:1}function Xpe(r){return Vm(r,!0)}function Ype(r,e,t){var i=new Date(r);switch(kp(e)){case"year":case"month":i[JP(t)](0);case"day":i[$P(t)](1);case"hour":i[QP(t)](0);case"minute":i[eD(t)](0);case"second":i[tD(t)](0),i[rD(t)](0)}return i.getTime()}function qpe(r,e,t,i){var n=1e4,a=jP,o=0;function s(b,E,I,R,A,D,U){for(var B=new Date(E),z=E,k=B[R]();z<I&&z<=i[1];)U.push({value:z}),k+=b,B[A](k),z=B.getTime();U.push({value:z,notAdd:!0})}function l(b,E,I){var R=[],A=!E.length;if(!Vpe(kp(b),i[0],i[1],t)){A&&(E=[{value:Ype(new Date(i[0]),b,t)},{value:i[1]}]);for(var D=0;D<E.length-1;D++){var U=E[D].value,B=E[D+1].value;if(U!==B){var z=void 0,k=void 0,G=void 0,Y=!1;switch(b){case"year":z=Math.max(1,Math.round(e/_o/365)),k=Ew(t),G=v5(t);break;case"half-year":case"quarter":case"month":z=Hpe(e),k=Bp(t),G=JP(t);break;case"week":case"half-week":case"day":z=Gpe(e,31),k=E_(t),G=$P(t),Y=!0;break;case"half-day":case"quarter-day":case"hour":z=Wpe(e),k=sv(t),G=QP(t);break;case"minute":z=i8(e,!0),k=A_(t),G=eD(t);break;case"second":z=i8(e,!1),k=C_(t),G=tD(t);break;case"millisecond":z=Xpe(e),k=R_(t),G=rD(t);break}s(z,U,B,k,G,Y,R),b==="year"&&I.length>1&&D===0&&I.unshift({value:I[0].value-z})}}for(var D=0;D<R.length;D++)I.push(R[D]);return R}}for(var u=[],c=[],f=0,h=0,p=0;p<a.length&&o++<n;++p){var d=kp(a[p]);if(h5(a[p])){l(a[p],u[u.length-1]||[],c);var g=a[p+1]?kp(a[p+1]):null;if(d!==g){if(c.length){h=f,c.sort(function(b,E){return b.value-E.value});for(var m=[],v=0;v<c.length;++v){var _=c[v].value;(v===0||c[v-1].value!==_)&&(m.push(c[v]),_>=i[0]&&_<=i[1]&&f++)}var y=(i[1]-i[0])/e;if(f>y*1.5&&h>y/1.5||(u.push(m),f>y||r===a[p]))break}c=[]}}}for(var x=Wt(de(u,function(b){return Wt(b,function(E){return E.value>=i[0]&&E.value<=i[1]&&!E.notAdd})}),function(b){return b.length>0}),M=[],S=x.length-1,p=0;p<x.length;++p)for(var w=x[p],T=0;T<w.length;++T)M.push({value:w[T].value,level:S-p});M.sort(function(b,E){return b.value-E.value});for(var C=[],p=0;p<M.length;++p)(p===0||M[p].value!==M[p-1].value)&&C.push(M[p]);return C}Xa.registerClass(n8);var E1=n8;var a8=Xa.prototype,ox=Ya.prototype,Zpe=Er,jpe=Math.floor,Kpe=Math.ceil,A1=Math.pow,Js=Math.log,d2=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="log",t.base=10,t._originalScale=new Ya,t._interval=0,t}return e.prototype.getTicks=function(t){var i=this._originalScale,n=this._extent,a=i.getExtent(),o=ox.getTicks.call(this,t);return de(o,function(s){var l=s.value,u=Er(A1(this.base,l));return u=l===n[0]&&this._fixMin?C1(u,a[0]):u,u=l===n[1]&&this._fixMax?C1(u,a[1]):u,{value:u}},this)},e.prototype.setExtent=function(t,i){var n=Js(this.base);t=Js(Math.max(0,t))/n,i=Js(Math.max(0,i))/n,ox.setExtent.call(this,t,i)},e.prototype.getExtent=function(){var t=this.base,i=a8.getExtent.call(this);i[0]=A1(t,i[0]),i[1]=A1(t,i[1]);var n=this._originalScale,a=n.getExtent();return this._fixMin&&(i[0]=C1(i[0],a[0])),this._fixMax&&(i[1]=C1(i[1],a[1])),i},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var i=this.base;t[0]=Js(t[0])/Js(i),t[1]=Js(t[1])/Js(i),a8.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,i){this.unionExtent(t.getApproximateExtent(i))},e.prototype.calcNiceTicks=function(t){t=t||10;var i=this._extent,n=i[1]-i[0];if(!(n===1/0||n<=0)){var a=Gb(n),o=t/n*a;for(o<=.5&&(a*=10);!isNaN(a)&&Math.abs(a)<1&&Math.abs(a)>0;)a*=10;var s=[Er(Kpe(i[0]/a)*a),Er(jpe(i[1]/a)*a)];this._interval=a,this._niceExtent=s}},e.prototype.calcNiceExtent=function(t){ox.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return t=Js(t)/Js(this.base),zf(t,this._extent)},e.prototype.normalize=function(t){return t=Js(t)/Js(this.base),Ff(t,this._extent)},e.prototype.scale=function(t){return t=Bf(t,this._extent),A1(this.base,t)},e.type="log",e}(Xa),o8=d2.prototype;o8.getMinorTicks=ox.getMinorTicks;o8.getLabel=ox.getLabel;function C1(r,e){return Zpe(r,Sn(e))}Xa.registerClass(d2);var s8=d2;var Jpe=function(){function r(e,t,i){this._prepareParams(e,t,i)}return r.prototype._prepareParams=function(e,t,i){i[1]<i[0]&&(i=[NaN,NaN]),this._dataMin=i[0],this._dataMax=i[1];var n=this._isOrdinal=e.type==="ordinal";this._needCrossZero=e.type==="interval"&&t.getNeedCrossZero&&t.getNeedCrossZero();var a=this._modelMinRaw=t.get("min",!0);He(a)?this._modelMinNum=R1(e,a({min:i[0],max:i[1]})):a!=="dataMin"&&(this._modelMinNum=R1(e,a));var o=this._modelMaxRaw=t.get("max",!0);if(He(o)?this._modelMaxNum=R1(e,o({min:i[0],max:i[1]})):o!=="dataMax"&&(this._modelMaxNum=R1(e,o)),n)this._axisDataLen=t.getCategories().length;else{var s=t.get("boundaryGap"),l=pe(s)?s:[s||0,s||0];typeof l[0]=="boolean"||typeof l[1]=="boolean"?this._boundaryGapInner=[0,0]:this._boundaryGapInner=[xn(l[0],1),xn(l[1],1)]}},r.prototype.calculate=function(){var e=this._isOrdinal,t=this._dataMin,i=this._dataMax,n=this._axisDataLen,a=this._boundaryGapInner,o=e?null:i-t||Math.abs(t),s=this._modelMinRaw==="dataMin"?t:this._modelMinNum,l=this._modelMaxRaw==="dataMax"?i:this._modelMaxNum,u=s!=null,c=l!=null;s==null&&(s=e?n?0:NaN:t-a[0]*o),l==null&&(l=e?n?n-1:NaN:i+a[1]*o),(s==null||!isFinite(s))&&(s=NaN),(l==null||!isFinite(l))&&(l=NaN);var f=uf(s)||uf(l)||e&&!n;this._needCrossZero&&(s>0&&l>0&&!u&&(s=0),s<0&&l<0&&!c&&(l=0));var h=this._determinedMin,p=this._determinedMax;return h!=null&&(s=h,u=!0),p!=null&&(l=p,c=!0),{min:s,max:l,minFixed:u,maxFixed:c,isBlank:f}},r.prototype.modifyDataMinMax=function(e,t){this[Qpe[e]]=t},r.prototype.setDeterminedMinMax=function(e,t){var i=$pe[e];this[i]=t},r.prototype.freeze=function(){this.frozen=!0},r}();var $pe={min:"_determinedMin",max:"_determinedMax"},Qpe={min:"_dataMin",max:"_dataMax"};function L1(r,e,t){var i=r.rawExtentInfo;return i||(i=new Jpe(r,e,t),r.rawExtentInfo=i,i)}function R1(r,e){return e==null?null:uf(e)?NaN:r.parse(e)}function m2(r,e){var t=r.type,i=L1(r,e,r.getExtent()).calculate();r.setBlank(i.isBlank);var n=i.min,a=i.max,o=e.ecModel;if(o&&t==="time"){var s=h2("bar",o),l=!1;if(N(s,function(f){l=l||f.getBaseAxis()===e.axis}),l){var u=p2(s),c=ede(n,a,e,u);n=c.min,a=c.max}}return{extent:[n,a],fixMin:i.minFixed,fixMax:i.maxFixed}}function ede(r,e,t,i){var n=t.axis.getExtent(),a=n[1]-n[0],o=e8(i,t.axis);if(o===void 0)return{min:r,max:e};var s=1/0;N(o,function(p){s=Math.min(p.offset,s)});var l=-1/0;N(o,function(p){l=Math.max(p.offset+p.width,l)}),s=Math.abs(s),l=Math.abs(l);var u=s+l,c=e-r,f=1-(s+l)/a,h=c/f-c;return e+=h*(l/u),r-=h*(s/u),{min:r,max:e}}function kl(r,e){var t=e,i=m2(r,t),n=i.extent,a=t.get("splitNumber");r instanceof s8&&(r.base=t.get("logBase"));var o=r.type,s=t.get("interval"),l=o==="interval"||o==="time";r.setExtent(n[0],n[1]),r.calcNiceExtent({splitNumber:a,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?t.get("minInterval"):null,maxInterval:l?t.get("maxInterval"):null}),s!=null&&r.setInterval&&r.setInterval(s)}function kf(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new ax({ordinalMeta:r.getOrdinalMeta?r.getOrdinalMeta():r.getCategories(),extent:[1/0,-1/0]});case"time":return new E1({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new(Xa.getClass(e)||Ya)}}function l8(r){var e=r.scale.getExtent(),t=e[0],i=e[1];return!(t>0&&i>0||t<0&&i<0)}function xv(r){var e=r.getLabelModel().get("formatter"),t=r.type==="category"?r.scale.getExtent()[0]:null;return r.scale.type==="time"?function(i){return function(n,a){return r.scale.getFormattedLabel(n,a,i)}}(e):Ce(e)?function(i){return function(n){var a=r.scale.getLabel(n),o=i.replace("{value}",a??"");return o}}(e):He(e)?function(i){return function(n,a){return t!=null&&(a=n.value-t),i(sx(r,n),a,n.level!=null?{level:n.level}:null)}}(e):function(i){return r.scale.getLabel(i)}}function sx(r,e){return r.type==="category"?r.scale.getLabel(e):e.value}function u8(r){var e=r.model,t=r.scale;if(!(!e.get(["axisLabel","show"])||t.isBlank())){var i,n,a=t.getExtent();t instanceof ax?n=t.count():(i=t.getTicks(),n=i.length);var o=r.getLabelModel(),s=xv(r),l,u=1;n>40&&(u=Math.ceil(n/40));for(var c=0;c<n;c+=u){var f=i?i[c]:{value:a[0]+c},h=s(f,c),p=o.getTextRect(h),d=tde(p,o.get("rotate")||0);l?l.union(d):l=d}return l}}function tde(r,e){var t=e*Math.PI/180,i=r.width,n=r.height,a=i*Math.abs(Math.cos(t))+Math.abs(n*Math.sin(t)),o=i*Math.abs(Math.sin(t))+Math.abs(n*Math.cos(t)),s=new lt(r.x,r.y,a,o);return s}function P1(r){var e=r.get("interval");return e??"auto"}function D1(r){return r.type==="category"&&P1(r.getLabelModel())===0}function Sv(r,e){var t={};return N(r.mapDimensionsAll(e),function(i){t[x1(r,i)]=!0}),bt(t)}function c8(r,e,t){e&&N(Sv(e,t),function(i){var n=e.getApproximateExtent(i);n[0]<r[0]&&(r[0]=n[0]),n[1]>r[1]&&(r[1]=n[1])})}var Vl=function(){function r(){}return r.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},r.prototype.getCoordSysModel=function(){},r}();var rde=1e-8;function f8(r,e){return Math.abs(r-e)<rde}function Fu(r,e,t){var i=0,n=r[0];if(!n)return!1;for(var a=1;a<r.length;a++){var o=r[a];i+=Qo(n[0],n[1],o[0],o[1],e,t),n=o}var s=r[0];return(!f8(n[0],s[0])||!f8(n[1],s[1]))&&(i+=Qo(n[0],n[1],s[0],s[1],e,t)),i!==0}var ide=[];function v2(r,e){for(var t=0;t<r.length;t++)fi(r[t],r[t],e)}function p8(r,e,t,i){for(var n=0;n<r.length;n++){var a=r[n];i&&(a=i.project(a)),a&&isFinite(a[0])&&isFinite(a[1])&&(po(e,e,a),mo(t,t,a))}}function nde(r){for(var e=0,t=0,i=0,n=r.length,a=r[n-1][0],o=r[n-1][1],s=0;s<n;s++){var l=r[s][0],u=r[s][1],c=a*u-l*o;e+=c,t+=(a+l)*c,i+=(o+u)*c,a=l,o=u}return e?[t/e/3,i/e/3,e]:[r[0][0]||0,r[0][1]||0]}var d8=function(){function r(e){this.name=e}return r.prototype.setCenter=function(e){this._center=e},r.prototype.getCenter=function(){var e=this._center;return e||(e=this._center=this.calcCenter()),e},r}();var g2=function(){function r(e,t){this.type="polygon",this.exterior=e,this.interiors=t}return r}();var y2=function(){function r(e){this.type="linestring",this.points=e}return r}();var N1=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t)||this;return a.type="geoJSON",a.geometries=i,a._center=n&&[n[0],n[1]],a}return e.prototype.calcCenter=function(){for(var t=this.geometries,i,n=0,a=0;a<t.length;a++){var o=t[a],s=o.exterior,l=s&&s.length;l>n&&(i=o,n=l)}if(i)return nde(i.exterior);var u=this.getBoundingRect();return[u.x+u.width/2,u.y+u.height/2]},e.prototype.getBoundingRect=function(t){var i=this._rect;if(i&&!t)return i;var n=[1/0,1/0],a=[-1/0,-1/0],o=this.geometries;return N(o,function(s){s.type==="polygon"?p8(s.exterior,n,a,t):N(s.points,function(l){p8(l,n,a,t)})}),isFinite(n[0])&&isFinite(n[1])&&isFinite(a[0])&&isFinite(a[1])||(n[0]=n[1]=a[0]=a[1]=0),i=new lt(n[0],n[1],a[0]-n[0],a[1]-n[1]),t||(this._rect=i),i},e.prototype.contain=function(t){var i=this.getBoundingRect(),n=this.geometries;if(!i.contain(t[0],t[1]))return!1;e:for(var a=0,o=n.length;a<o;a++){var s=n[a];if(s.type==="polygon"){var l=s.exterior,u=s.interiors;if(Fu(l,t[0],t[1])){for(var c=0;c<(u?u.length:0);c++)if(Fu(u[c],t[0],t[1]))continue e;return!0}}}return!1},e.prototype.transformTo=function(t,i,n,a){var o=this.getBoundingRect(),s=o.width/o.height;n?a||(a=n/s):n=s*a;for(var l=new lt(t,i,n,a),u=o.calculateTransform(l),c=this.geometries,f=0;f<c.length;f++){var h=c[f];h.type==="polygon"?(v2(h.exterior,u),N(h.interiors,function(p){v2(p,u)})):N(h.points,function(p){v2(p,u)})}o=this._rect,o.copy(l),this._center=[o.x+o.width/2,o.y+o.height/2]},e.prototype.cloneShallow=function(t){t==null&&(t=this.name);var i=new e(t,this.geometries,this._center);return i._rect=this._rect,i.transformTo=null,i},e}(d8);var m8=function(r){Z(e,r);function e(t,i){var n=r.call(this,t)||this;return n.type="geoSVG",n._elOnlyForCalculate=i,n}return e.prototype.calcCenter=function(){for(var t=this._elOnlyForCalculate,i=t.getBoundingRect(),n=[i.x+i.width/2,i.y+i.height/2],a=ff(ide),o=t;o&&!o.isGeoSVGGraphicRoot;)La(a,o.getLocalTransform(),a),o=o.parent;return qo(a,a),fi(n,n,a),n},e}(d8);function ade(r){if(!r.UTF8Encoding)return r;var e=r,t=e.UTF8Scale;t==null&&(t=1024);var i=e.features;return N(i,function(n){var a=n.geometry,o=a.encodeOffsets,s=a.coordinates;if(o)switch(a.type){case"LineString":a.coordinates=v8(s,o,t);break;case"Polygon":_2(s,o,t);break;case"MultiLineString":_2(s,o,t);break;case"MultiPolygon":N(s,function(l,u){return _2(l,o[u],t)})}}),e.UTF8Encoding=!1,e}function _2(r,e,t){for(var i=0;i<r.length;i++)r[i]=v8(r[i],e[i],t)}function v8(r,e,t){for(var i=[],n=e[0],a=e[1],o=0;o<r.length;o+=2){var s=r.charCodeAt(o)-64,l=r.charCodeAt(o+1)-64;s=s>>1^-(s&1),l=l>>1^-(l&1),s+=n,l+=a,n=s,a=l,i.push([s/t,l/t])}return i}function x2(r,e){return r=ade(r),de(Wt(r.features,function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0}),function(t){var i=t.properties,n=t.geometry,a=[];switch(n.type){case"Polygon":var o=n.coordinates;a.push(new g2(o[0],o.slice(1)));break;case"MultiPolygon":N(n.coordinates,function(l){l[0]&&a.push(new g2(l[0],l.slice(1)))});break;case"LineString":a.push(new y2([n.coordinates]));break;case"MultiLineString":a.push(new y2(n.coordinates))}var s=new N1(i[e||"name"],a,i.cp);return s.properties=i,s})}var Mv={};qR(Mv,{MAX_SAFE_INTEGER:()=>t_,asc:()=>Ti,getPercentWithPrecision:()=>JG,getPixelPrecision:()=>Bm,getPrecision:()=>Sn,getPrecisionSafe:()=>jL,isNumeric:()=>xp,isRadianAroundZero:()=>xu,linearMap:()=>rr,nice:()=>Vm,numericToNumber:()=>Na,parseDate:()=>Mn,quantile:()=>Gm,quantity:()=>Gb,quantityExponent:()=>km,reformIntervals:()=>i_,remRadian:()=>r_,round:()=>Er});var lx=vt();function g8(r){return r.type==="category"?ode(r):lde(r)}function y8(r,e){return r.type==="category"?sde(r,e):{ticks:de(r.scale.getTicks(),function(t){return t.value})}}function ode(r){var e=r.getLabelModel(),t=_8(r,e);return!e.get("show")||r.scale.isBlank()?{labels:[],labelCategoryInterval:t.labelCategoryInterval}:t}function _8(r,e){var t=x8(r,"labels"),i=P1(e),n=S8(t,i);if(n)return n;var a,o;return He(i)?a=T8(r,i):(o=i==="auto"?ude(r):i,a=w8(r,o)),M8(t,i,{labels:a,labelCategoryInterval:o})}function sde(r,e){var t=x8(r,"ticks"),i=P1(e),n=S8(t,i);if(n)return n;var a,o;if((!e.get("show")||r.scale.isBlank())&&(a=[]),He(i))a=T8(r,i,!0);else if(i==="auto"){var s=_8(r,r.getLabelModel());o=s.labelCategoryInterval,a=de(s.labels,function(l){return l.tickValue})}else o=i,a=w8(r,o,!0);return M8(t,i,{ticks:a,tickCategoryInterval:o})}function lde(r){var e=r.scale.getTicks(),t=xv(r);return{labels:de(e,function(i,n){return{level:i.level,formattedLabel:t(i,n),rawLabel:r.scale.getLabel(i),tickValue:i.value}})}}function x8(r,e){return lx(r)[e]||(lx(r)[e]=[])}function S8(r,e){for(var t=0;t<r.length;t++)if(r[t].key===e)return r[t].value}function M8(r,e,t){return r.push({key:e,value:t}),t}function ude(r){var e=lx(r).autoInterval;return e??(lx(r).autoInterval=r.calculateCategoryInterval())}function b8(r){var e=cde(r),t=xv(r),i=(e.axisRotate-e.labelRotate)/180*Math.PI,n=r.scale,a=n.getExtent(),o=n.count();if(a[1]-a[0]<1)return 0;var s=1;o>40&&(s=Math.max(1,Math.floor(o/40)));for(var l=a[0],u=r.dataToCoord(l+1)-r.dataToCoord(l),c=Math.abs(u*Math.cos(i)),f=Math.abs(u*Math.sin(i)),h=0,p=0;l<=a[1];l+=s){var d=0,g=0,m=Rl(t({value:l}),e.font,"center","top");d=m.width*1.3,g=m.height*1.3,h=Math.max(h,d,7),p=Math.max(p,g,7)}var v=h/c,_=p/f;isNaN(v)&&(v=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(v,_))),x=lx(r.model),M=r.getExtent(),S=x.lastAutoInterval,w=x.lastTickCount;return S!=null&&w!=null&&Math.abs(S-y)<=1&&Math.abs(w-o)<=1&&S>y&&x.axisExtent0===M[0]&&x.axisExtent1===M[1]?y=S:(x.lastTickCount=o,x.lastAutoInterval=y,x.axisExtent0=M[0],x.axisExtent1=M[1]),y}function cde(r){var e=r.getLabelModel();return{axisRotate:r.getRotate?r.getRotate():r.isHorizontal&&!r.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function w8(r,e,t){var i=xv(r),n=r.scale,a=n.getExtent(),o=r.getLabelModel(),s=[],l=Math.max((e||0)+1,1),u=a[0],c=n.count();u!==0&&l>1&&c/l>2&&(u=Math.round(Math.ceil(u/l)*l));var f=D1(r),h=o.get("showMinLabel")||f,p=o.get("showMaxLabel")||f;h&&u!==a[0]&&g(a[0]);for(var d=u;d<=a[1];d+=l)g(d);p&&d-l!==a[1]&&g(a[1]);function g(m){var v={value:m};s.push(t?m:{formattedLabel:i(v),rawLabel:n.getLabel(v),tickValue:m})}return s}function T8(r,e,t){var i=r.scale,n=xv(r),a=[];return N(i.getTicks(),function(o){var s=i.getLabel(o),l=o.value;e(o.value,s)&&a.push(t?l:{formattedLabel:n(o),rawLabel:s,tickValue:l})}),a}var E8=[0,1],fde=function(){function r(e,t,i){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=i||[0,0]}return r.prototype.contain=function(e){var t=this._extent,i=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]);return e>=i&&e<=n},r.prototype.containData=function(e){return this.scale.contain(e)},r.prototype.getExtent=function(){return this._extent.slice()},r.prototype.getPixelPrecision=function(e){return Bm(e||this.scale.getExtent(),this._extent)},r.prototype.setExtent=function(e,t){var i=this._extent;i[0]=e,i[1]=t},r.prototype.dataToCoord=function(e,t){var i=this._extent,n=this.scale;return e=n.normalize(e),this.onBand&&n.type==="ordinal"&&(i=i.slice(),A8(i,n.count())),rr(e,E8,i,t)},r.prototype.coordToData=function(e,t){var i=this._extent,n=this.scale;this.onBand&&n.type==="ordinal"&&(i=i.slice(),A8(i,n.count()));var a=rr(e,i,E8,t);return this.scale.scale(a)},r.prototype.pointToData=function(e,t){},r.prototype.getTicksCoords=function(e){e=e||{};var t=e.tickModel||this.getTickModel(),i=y8(this,t),n=i.ticks,a=de(n,function(s){return{coord:this.dataToCoord(this.scale.type==="ordinal"?this.scale.getRawOrdinalNumber(s):s),tickValue:s}},this),o=t.get("alignWithLabel");return hde(this,a,o,e.clamp),a},r.prototype.getMinorTicksCoords=function(){if(this.scale.type==="ordinal")return[];var e=this.model.getModel("minorTick"),t=e.get("splitNumber");t>0&&t<100||(t=5);var i=this.scale.getMinorTicks(t),n=de(i,function(a){return de(a,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return n},r.prototype.getViewLabels=function(){return g8(this).labels},r.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},r.prototype.getTickModel=function(){return this.model.getModel("axisTick")},r.prototype.getBandWidth=function(){var e=this._extent,t=this.scale.getExtent(),i=t[1]-t[0]+(this.onBand?1:0);i===0&&(i=1);var n=Math.abs(e[1]-e[0]);return Math.abs(n)/i},r.prototype.calculateCategoryInterval=function(){return b8(this)},r}();function A8(r,e){var t=r[1]-r[0],i=e,n=t/i/2;r[0]+=n,r[1]-=n}function hde(r,e,t,i){var n=e.length;if(!r.onBand||t||!n)return;var a=r.getExtent(),o,s;if(n===1)e[0].coord=a[0],o=e[1]={coord:a[1]};else{var l=e[n-1].tickValue-e[0].tickValue,u=(e[n-1].coord-e[0].coord)/l;N(e,function(p){p.coord-=u/2});var c=r.scale.getExtent();s=1+c[1]-e[n-1].tickValue,o={coord:e[n-1].coord+u*s},e.push(o)}var f=a[0]>a[1];h(e[0].coord,a[0])&&(i?e[0].coord=a[0]:e.shift()),i&&h(a[0],e[0].coord)&&e.unshift({coord:a[0]}),h(a[1],o.coord)&&(i?o.coord=a[1]:e.pop()),i&&h(o.coord,a[1])&&e.push({coord:a[1]});function h(p,d){return p=Er(p),d=Er(d),f?p>d:p<d}}var pn=fde;var ux=Math.PI*2,Kp=Ki.CMD,pde=["top","right","bottom","left"];function dde(r,e,t,i,n){var a=t.width,o=t.height;switch(r){case"top":i.set(t.x+a/2,t.y-e),n.set(0,-1);break;case"bottom":i.set(t.x+a/2,t.y+o+e),n.set(0,1);break;case"left":i.set(t.x-e,t.y+o/2),n.set(-1,0);break;case"right":i.set(t.x+a+e,t.y+o/2),n.set(1,0);break}}function mde(r,e,t,i,n,a,o,s,l){o-=r,s-=e;var u=Math.sqrt(o*o+s*s);o/=u,s/=u;var c=o*t+r,f=s*t+e;if(Math.abs(i-n)%ux<1e-4)return l[0]=c,l[1]=f,u-t;if(a){var h=i;i=bn(n),n=bn(h)}else i=bn(i),n=bn(n);i>n&&(n+=ux);var p=Math.atan2(s,o);if(p<0&&(p+=ux),p>=i&&p<=n||p+ux>=i&&p+ux<=n)return l[0]=c,l[1]=f,u-t;var d=t*Math.cos(i)+r,g=t*Math.sin(i)+e,m=t*Math.cos(n)+r,v=t*Math.sin(n)+e,_=(d-o)*(d-o)+(g-s)*(g-s),y=(m-o)*(m-o)+(v-s)*(v-s);return _<y?(l[0]=d,l[1]=g,Math.sqrt(_)):(l[0]=m,l[1]=v,Math.sqrt(y))}function U1(r,e,t,i,n,a,o,s){var l=n-r,u=a-e,c=t-r,f=i-e,h=Math.sqrt(c*c+f*f);c/=h,f/=h;var p=l*c+u*f,d=p/h;s&&(d=Math.min(Math.max(d,0),1)),d*=h;var g=o[0]=r+d*c,m=o[1]=e+d*f;return Math.sqrt((g-n)*(g-n)+(m-a)*(m-a))}function C8(r,e,t,i,n,a,o){t<0&&(r=r+t,t=-t),i<0&&(e=e+i,i=-i);var s=r+t,l=e+i,u=o[0]=Math.min(Math.max(n,r),s),c=o[1]=Math.min(Math.max(a,e),l);return Math.sqrt((u-n)*(u-n)+(c-a)*(c-a))}var $s=[];function vde(r,e,t){var i=C8(e.x,e.y,e.width,e.height,r.x,r.y,$s);return t.set($s[0],$s[1]),i}function gde(r,e,t){for(var i=0,n=0,a=0,o=0,s,l,u=1/0,c=e.data,f=r.x,h=r.y,p=0;p<c.length;){var d=c[p++];p===1&&(i=c[p],n=c[p+1],a=i,o=n);var g=u;switch(d){case Kp.M:a=c[p++],o=c[p++],i=a,n=o;break;case Kp.L:g=U1(i,n,c[p],c[p+1],f,h,$s,!0),i=c[p++],n=c[p++];break;case Kp.C:g=_b(i,n,c[p++],c[p++],c[p++],c[p++],c[p],c[p+1],f,h,$s),i=c[p++],n=c[p++];break;case Kp.Q:g=Sb(i,n,c[p++],c[p++],c[p],c[p+1],f,h,$s),i=c[p++],n=c[p++];break;case Kp.A:var m=c[p++],v=c[p++],_=c[p++],y=c[p++],x=c[p++],M=c[p++];p+=1;var S=!!(1-c[p++]);s=Math.cos(x)*_+m,l=Math.sin(x)*y+v,p<=1&&(a=s,o=l);var w=(f-m)*y/_+m;g=mde(m,v,y,x,x+M,S,w,h,$s),i=Math.cos(x+M)*_+m,n=Math.sin(x+M)*y+v;break;case Kp.R:a=i=c[p++],o=n=c[p++];var T=c[p++],C=c[p++];g=C8(a,o,T,C,f,h,$s);break;case Kp.Z:g=U1(i,n,a,o,f,h,$s,!0),i=a,n=o;break}g<u&&(u=g,t.set($s[0],$s[1]))}return u}var Qs=new Nt,Zr=new Nt,Ai=new Nt,Hl=new Nt,Gl=new Nt;function M2(r,e){if(r){var t=r.getTextGuideLine(),i=r.getTextContent();if(i&&t){var n=r.textGuideLineConfig||{},a=[[0,0],[0,0],[0,0]],o=n.candidates||pde,s=i.getBoundingRect().clone();s.applyTransform(i.getComputedTransform());var l=1/0,u=n.anchor,c=r.getComputedTransform(),f=c&&qo([],c),h=e.get("length2")||0;u&&Ai.copy(u);for(var p=0;p<o.length;p++){var d=o[p];dde(d,0,s,Qs,Hl),Nt.scaleAndAdd(Zr,Qs,Hl,h),Zr.transform(f);var g=r.getBoundingRect(),m=u?u.distance(Zr):r instanceof ut?gde(Zr,r.path,Ai):vde(Zr,g,Ai);m<l&&(l=m,Zr.transform(c),Ai.transform(c),Ai.toArray(a[0]),Zr.toArray(a[1]),Qs.toArray(a[2]))}b2(a,e.get("minTurnAngle")),t.setShape({points:a})}}}var O1=[],da=new Nt;function b2(r,e){if(e<=180&&e>0){e=e/180*Math.PI,Qs.fromArray(r[0]),Zr.fromArray(r[1]),Ai.fromArray(r[2]),Nt.sub(Hl,Qs,Zr),Nt.sub(Gl,Ai,Zr);var t=Hl.len(),i=Gl.len();if(!(t<.001||i<.001)){Hl.scale(1/t),Gl.scale(1/i);var n=Hl.dot(Gl),a=Math.cos(e);if(a<n){var o=U1(Zr.x,Zr.y,Ai.x,Ai.y,Qs.x,Qs.y,O1,!1);da.fromArray(O1),da.scaleAndAdd(Gl,o/Math.tan(Math.PI-e));var s=Ai.x!==Zr.x?(da.x-Zr.x)/(Ai.x-Zr.x):(da.y-Zr.y)/(Ai.y-Zr.y);if(isNaN(s))return;s<0?Nt.copy(da,Zr):s>1&&Nt.copy(da,Ai),da.toArray(r[1])}}}}function R8(r,e,t){if(t<=180&&t>0){t=t/180*Math.PI,Qs.fromArray(r[0]),Zr.fromArray(r[1]),Ai.fromArray(r[2]),Nt.sub(Hl,Zr,Qs),Nt.sub(Gl,Ai,Zr);var i=Hl.len(),n=Gl.len();if(!(i<.001||n<.001)){Hl.scale(1/i),Gl.scale(1/n);var a=Hl.dot(e),o=Math.cos(t);if(a<o){var s=U1(Zr.x,Zr.y,Ai.x,Ai.y,Qs.x,Qs.y,O1,!1);da.fromArray(O1);var l=Math.PI/2,u=Math.acos(Gl.dot(e)),c=l+u-t;if(c>=l)Nt.copy(da,Ai);else{da.scaleAndAdd(Gl,s/Math.tan(Math.PI/2-c));var f=Ai.x!==Zr.x?(da.x-Zr.x)/(Ai.x-Zr.x):(da.y-Zr.y)/(Ai.y-Zr.y);if(isNaN(f))return;f<0?Nt.copy(da,Zr):f>1&&Nt.copy(da,Ai)}da.toArray(r[1])}}}}function S2(r,e,t,i){var n=t==="normal",a=n?r:r.ensureState(t);a.ignore=e;var o=i.get("smooth");o&&o===!0&&(o=.3),a.shape=a.shape||{},o>0&&(a.shape.smooth=o);var s=i.getModel("lineStyle").getLineStyle();n?r.useStyle(s):a.style=s}function yde(r,e){var t=e.smooth,i=e.points;if(i)if(r.moveTo(i[0][0],i[0][1]),t>0&&i.length>=3){var n=Yo(i[0],i[1]),a=Yo(i[1],i[2]);if(!n||!a){r.lineTo(i[1][0],i[1][1]),r.lineTo(i[2][0],i[2][1]);return}var o=Math.min(n,a)*t,s=Am([],i[1],i[0],o/n),l=Am([],i[1],i[2],o/a),u=Am([],s,l,.5);r.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),r.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var c=1;c<i.length;c++)r.lineTo(i[c][0],i[c][1])}function bv(r,e,t){var i=r.getTextGuideLine(),n=r.getTextContent();if(!n){i&&r.removeTextGuideLine();return}for(var a=e.normal,o=a.get("show"),s=n.ignore,l=0;l<Tf.length;l++){var u=Tf[l],c=e[u],f=u==="normal";if(c){var h=c.get("show"),p=f?s:ft(n.states[u]&&n.states[u].ignore,s);if(p||!ft(h,o)){var d=f?i:i&&i.states[u];d&&(d.ignore=!0),i&&S2(i,!0,u,c);continue}i||(i=new Qr,r.setTextGuideLine(i),!f&&(s||!o)&&S2(i,!0,"normal",e.normal),r.stateProxy&&(i.stateProxy=r.stateProxy)),S2(i,!1,u,c)}}if(i){Ye(i.style,t),i.style.fill=null;var g=a.get("showAbove"),m=r.textGuideLineConfig=r.textGuideLineConfig||{};m.showAbove=g||!1,i.buildPath=yde}}function wv(r,e){e=e||"labelLine";for(var t={normal:r.getModel(e)},i=0;i<Fi.length;i++){var n=Fi[i];t[n]=r.getModel([n,e])}return t}function z1(r){for(var e=[],t=0;t<r.length;t++){var i=r[t];if(!i.defaultAttr.ignore){var n=i.label,a=n.getComputedTransform(),o=n.getBoundingRect(),s=!a||a[1]<1e-5&&a[2]<1e-5,l=n.style.margin||0,u=o.clone();u.applyTransform(a),u.x-=l/2,u.y-=l/2,u.width+=l,u.height+=l;var c=s?new rv(o,a):null;e.push({label:n,labelLine:i.labelLine,rect:u,localRect:o,obb:c,priority:i.priority,defaultAttr:i.defaultAttr,layoutOption:i.computedLayoutOption,axisAligned:s,transform:a})}}return e}function L8(r,e,t,i,n,a){var o=r.length;if(o<2)return;r.sort(function(C,b){return C.rect[e]-b.rect[e]});for(var s=0,l,u=!1,c=[],f=0,h=0;h<o;h++){var p=r[h],d=p.rect;l=d[e]-s,l<0&&(d[e]-=l,p.label[e]-=l,u=!0);var g=Math.max(-l,0);c.push(g),f+=g,s=d[e]+d[t]}f>0&&a&&S(-f/o,0,o);var m=r[0],v=r[o-1],_,y;x(),_<0&&w(-_,.8),y<0&&w(y,.8),x(),M(_,y,1),M(y,_,-1),x(),_<0&&T(-_),y<0&&T(y);function x(){_=m.rect[e]-i,y=n-v.rect[e]-v.rect[t]}function M(C,b,E){if(C<0){var I=Math.min(b,-C);if(I>0){S(I*E,0,o);var R=I+C;R<0&&w(-R*E,1)}else w(-C*E,1)}}function S(C,b,E){C!==0&&(u=!0);for(var I=b;I<E;I++){var R=r[I],A=R.rect;A[e]+=C,R.label[e]+=C}}function w(C,b){for(var E=[],I=0,R=1;R<o;R++){var A=r[R-1].rect,D=Math.max(r[R].rect[e]-A[e]-A[t],0);E.push(D),I+=D}if(I){var U=Math.min(Math.abs(C)/I,b);if(C>0)for(var R=0;R<o-1;R++){var B=E[R]*U;S(B,0,R+1)}else for(var R=o-1;R>0;R--){var B=E[R-1]*U;S(-B,R,o)}}}function T(C){var b=C<0?-1:1;C=Math.abs(C);for(var E=Math.ceil(C/(o-1)),I=0;I<o-1;I++)if(b>0?S(E,0,I+1):S(-E,o-I-1,o),C-=E,C<=0)return}return u}function P8(r,e,t,i){return L8(r,"x","width",e,t,i)}function F1(r,e,t,i){return L8(r,"y","height",e,t,i)}function B1(r){var e=[];r.sort(function(g,m){return m.priority-g.priority});var t=new lt(0,0,0,0);function i(g){if(!g.ignore){var m=g.ensureState("emphasis");m.ignore==null&&(m.ignore=!1)}g.ignore=!0}for(var n=0;n<r.length;n++){var a=r[n],o=a.axisAligned,s=a.localRect,l=a.transform,u=a.label,c=a.labelLine;t.copy(a.rect),t.width-=.1,t.height-=.1,t.x+=.05,t.y+=.05;for(var f=a.obb,h=!1,p=0;p<e.length;p++){var d=e[p];if(t.intersect(d.rect)){if(o&&d.axisAligned){h=!0;break}if(d.obb||(d.obb=new rv(d.localRect,d.transform)),f||(f=new rv(s,l)),f.intersect(d.obb)){h=!0;break}}}h?(i(u),c&&i(c)):(u.attr("ignore",a.defaultAttr.ignore),c&&c.attr("ignore",a.defaultAttr.labelGuideIgnore),e.push(a))}}function _de(r){if(r){for(var e=[],t=0;t<r.length;t++)e.push(r[t].slice());return e}}function xde(r,e){var t=r.label,i=e&&e.getTextGuideLine();return{dataIndex:r.dataIndex,dataType:r.dataType,seriesIndex:r.seriesModel.seriesIndex,text:r.label.style.text,rect:r.hostRect,labelRect:r.rect,align:t.style.align,verticalAlign:t.style.verticalAlign,labelLinePoints:_de(i&&i.shape.points)}}var D8=["align","verticalAlign","width","height","fontSize"],ma=new Da,w2=vt(),Sde=vt();function k1(r,e,t){for(var i=0;i<t.length;i++){var n=t[i];e[n]!=null&&(r[n]=e[n])}}var V1=["x","y","rotation"],Mde=function(){function r(){this._labelList=[],this._chartViewList=[]}return r.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},r.prototype._addLabel=function(e,t,i,n,a){var o=n.style,s=n.__hostTarget,l=s.textConfig||{},u=n.getComputedTransform(),c=n.getBoundingRect().plain();lt.applyTransform(c,c,u),u?ma.setLocalTransform(u):(ma.x=ma.y=ma.rotation=ma.originX=ma.originY=0,ma.scaleX=ma.scaleY=1),ma.rotation=bn(ma.rotation);var f=n.__hostTarget,h;if(f){h=f.getBoundingRect().plain();var p=f.getComputedTransform();lt.applyTransform(h,h,p)}var d=h&&f.getTextGuideLine();this._labelList.push({label:n,labelLine:d,seriesModel:i,dataIndex:e,dataType:t,layoutOption:a,computedLayoutOption:null,rect:c,hostRect:h,priority:h?h.width*h.height:0,defaultAttr:{ignore:n.ignore,labelGuideIgnore:d&&d.ignore,x:ma.x,y:ma.y,scaleX:ma.scaleX,scaleY:ma.scaleY,rotation:ma.rotation,style:{x:o.x,y:o.y,align:o.align,verticalAlign:o.verticalAlign,width:o.width,height:o.height,fontSize:o.fontSize},cursor:n.cursor,attachedPos:l.position,attachedRot:l.rotation}})},r.prototype.addLabelsOfSeries=function(e){var t=this;this._chartViewList.push(e);var i=e.__model,n=i.get("labelLayout");(He(n)||bt(n).length)&&e.group.traverse(function(a){if(a.ignore)return!0;var o=a.getTextContent(),s=rt(a);o&&!o.disableLabelLayout&&t._addLabel(s.dataIndex,s.dataType,i,o,n)})},r.prototype.updateLayoutConfig=function(e){var t=e.getWidth(),i=e.getHeight();function n(y,x){return function(){M2(y,x)}}for(var a=0;a<this._labelList.length;a++){var o=this._labelList[a],s=o.label,l=s.__hostTarget,u=o.defaultAttr,c=void 0;He(o.layoutOption)?c=o.layoutOption(xde(o,l)):c=o.layoutOption,c=c||{},o.computedLayoutOption=c;var f=Math.PI/180;l&&l.setTextConfig({local:!1,position:c.x!=null||c.y!=null?null:u.attachedPos,rotation:c.rotate!=null?c.rotate*f:u.attachedRot,offset:[c.dx||0,c.dy||0]});var h=!1;if(c.x!=null?(s.x=ze(c.x,t),s.setStyle("x",0),h=!0):(s.x=u.x,s.setStyle("x",u.style.x)),c.y!=null?(s.y=ze(c.y,i),s.setStyle("y",0),h=!0):(s.y=u.y,s.setStyle("y",u.style.y)),c.labelLinePoints){var p=l.getTextGuideLine();p&&(p.setShape({points:c.labelLinePoints}),h=!1)}var d=w2(s);d.needsUpdateLabelLine=h,s.rotation=c.rotate!=null?c.rotate*f:u.rotation,s.scaleX=u.scaleX,s.scaleY=u.scaleY;for(var g=0;g<D8.length;g++){var m=D8[g];s.setStyle(m,c[m]!=null?c[m]:u.style[m])}if(c.draggable){if(s.draggable=!0,s.cursor="move",l){var v=o.seriesModel;if(o.dataIndex!=null){var _=o.seriesModel.getData(o.dataType);v=_.getItemModel(o.dataIndex)}s.on("drag",n(l,v.getModel("labelLine")))}}else s.off("drag"),s.cursor=u.cursor}},r.prototype.layout=function(e){var t=e.getWidth(),i=e.getHeight(),n=z1(this._labelList),a=Wt(n,function(l){return l.layoutOption.moveOverlap==="shiftX"}),o=Wt(n,function(l){return l.layoutOption.moveOverlap==="shiftY"});P8(a,0,t),F1(o,0,i);var s=Wt(n,function(l){return l.layoutOption.hideOverlap});B1(s)},r.prototype.processLabelsOverall=function(){var e=this;N(this._chartViewList,function(t){var i=t.__model,n=t.ignoreLabelLineUpdate,a=i.isAnimationEnabled();t.group.traverse(function(o){if(o.ignore&&!o.forceLabelAnimation)return!0;var s=!n,l=o.getTextContent();!s&&l&&(s=w2(l).needsUpdateLabelLine),s&&e._updateLabelLine(o,i),a&&e._animateLabels(o,i)})})},r.prototype._updateLabelLine=function(e,t){var i=e.getTextContent(),n=rt(e),a=n.dataIndex;if(i&&a!=null){var o=t.getData(n.dataType),s=o.getItemModel(a),l={},u=o.getItemVisual(a,"style");if(u){var c=o.getVisual("drawType");l.stroke=u[c]}var f=s.getModel("labelLine");bv(e,wv(s),l),M2(e,f)}},r.prototype._animateLabels=function(e,t){var i=e.getTextContent(),n=e.getTextGuideLine();if(i&&(e.forceLabelAnimation||!i.ignore&&!i.invisible&&!e.disableLabelAnimation&&!Eu(e))){var a=w2(i),o=a.oldLayout,s=rt(e),l=s.dataIndex,u={x:i.x,y:i.y,rotation:i.rotation},c=t.getData(s.dataType);if(o){i.attr(o);var h=e.prevStates;h&&(dt(h,"select")>=0&&i.attr(a.oldLayoutSelect),dt(h,"emphasis")>=0&&i.attr(a.oldLayoutEmphasis)),Dt(i,u,t,l)}else if(i.attr(u),!Pu(i).valueAnimation){var f=ft(i.style.opacity,1);i.style.opacity=0,or(i,{style:{opacity:f}},t,l)}if(a.oldLayout=u,i.states.select){var p=a.oldLayoutSelect={};k1(p,u,V1),k1(p,i.states.select,V1)}if(i.states.emphasis){var d=a.oldLayoutEmphasis={};k1(d,u,V1),k1(d,i.states.emphasis,V1)}_w(i,l,c,t,t)}if(n&&!n.ignore&&!n.invisible){var a=Sde(n),o=a.oldLayout,g={points:n.shape.points};o?(n.attr({shape:o}),Dt(n,{shape:g},t)):(n.setShape(g),n.style.strokePercent=0,or(n,{style:{strokePercent:1}},t)),a.oldLayout=g}},r}(),I8=Mde;var T2=vt();function E2(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){var n=T2(t).labelManager;n||(n=T2(t).labelManager=new I8),n.clearLabels()}),r.registerUpdateLifecycle("series:layoutlabels",function(e,t,i){var n=T2(t).labelManager;i.updatedSeries.forEach(function(a){n.addLabelsOfSeries(t.getViewOfSeriesModel(a))}),n.updateLayoutConfig(t),n.layout(t),n.processLabelsOverall()})}var A2=Math.sin,C2=Math.cos,N8=Math.PI,Jp=Math.PI*2,bde=180/N8,wde=function(){function r(){}return r.prototype.reset=function(e){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,e||4)},r.prototype.moveTo=function(e,t){this._add("M",e,t)},r.prototype.lineTo=function(e,t){this._add("L",e,t)},r.prototype.bezierCurveTo=function(e,t,i,n,a,o){this._add("C",e,t,i,n,a,o)},r.prototype.quadraticCurveTo=function(e,t,i,n){this._add("Q",e,t,i,n)},r.prototype.arc=function(e,t,i,n,a,o){this.ellipse(e,t,i,i,0,n,a,o)},r.prototype.ellipse=function(e,t,i,n,a,o,s,l){var u=s-o,c=!l,f=Math.abs(u),h=Cl(f-Jp)||(c?u>=Jp:-u>=Jp),p=u>0?u%Jp:u%Jp+Jp,d=!1;h?d=!0:Cl(f)?d=!1:d=p>=N8==!!c;var g=e+i*C2(o),m=t+n*A2(o);this._start&&this._add("M",g,m);var v=Math.round(a*bde);if(h){var _=1/this._p,y=(c?1:-1)*(Jp-_);this._add("A",i,n,v,1,+c,e+i*C2(o+y),t+n*A2(o+y)),_>.01&&this._add("A",i,n,v,0,+c,g,m)}else{var x=e+i*C2(s),M=t+n*A2(s);this._add("A",i,n,v,+d,+c,x,M)}},r.prototype.rect=function(e,t,i,n){this._add("M",e,t),this._add("l",i,0),this._add("l",0,n),this._add("l",-i,0),this._add("Z")},r.prototype.closePath=function(){this._d.length>0&&this._add("Z")},r.prototype._add=function(e,t,i,n,a,o,s,l,u){for(var c=[],f=this._p,h=1;h<arguments.length;h++){var p=arguments[h];if(isNaN(p)){this._invalid=!0;return}c.push(Math.round(p*f)/f)}this._d.push(e+c.join(" ")),this._start=e==="Z"},r.prototype.generateStr=function(){this._str=this._invalid?"":this._d.join(""),this._d=[]},r.prototype.getStr=function(){return this._str},r}(),G1=wde;var cx="none",Tde=Math.round;function Ede(r){var e=r.fill;return e!=null&&e!==cx}function Ade(r){var e=r.stroke;return e!=null&&e!==cx}var R2=["lineCap","miterLimit","lineJoin"],Cde=de(R2,function(r){return"stroke-"+r.toLowerCase()});function L2(r,e,t,i){var n=e.opacity==null?1:e.opacity;if(t instanceof Ur){r("opacity",n);return}if(Ede(e)){var a=gf(e.fill);r("fill",a.color);var o=e.fillOpacity!=null?e.fillOpacity*a.opacity*n:a.opacity*n;(i||o<1)&&r("fill-opacity",o)}else r("fill",cx);if(Ade(e)){var s=gf(e.stroke);r("stroke",s.color);var l=e.strokeNoScale?t.getLineScale():1,u=l?(e.lineWidth||0)/l:0,c=e.strokeOpacity!=null?e.strokeOpacity*s.opacity*n:s.opacity*n,f=e.strokeFirst;if((i||u!==1)&&r("stroke-width",u),(i||f)&&r("paint-order",f?"stroke":"fill"),(i||c<1)&&r("stroke-opacity",c),e.lineDash){var h=q_(t),p=h[0],d=h[1];p&&(d=Tde(d||0),r("stroke-dasharray",p.join(",")),(d||i)&&r("stroke-dashoffset",d))}else i&&r("stroke-dasharray",cx);for(var g=0;g<R2.length;g++){var m=R2[g];if(i||e[m]!==qm[m]){var v=e[m]||qm[m];v&&r(Cde[g],v)}}}else i&&r("stroke",cx)}var U8="http://www.w3.org/2000/svg",P2="http://www.w3.org/1999/xlink",O8="http://www.w3.org/2000/xmlns/",z8="http://www.w3.org/XML/1998/namespace",D2="ecmeta_";function H1(r){return document.createElementNS(U8,r)}function Ci(r,e,t,i,n){return{tag:r,attrs:t||{},children:i,text:n,key:e}}function Rde(r,e){var t=[];if(e)for(var i in e){var n=e[i],a=i;n!==!1&&(n!==!0&&n!=null&&(a+='="'+n+'"'),t.push(a))}return"<"+r+" "+t.join(" ")+">"}function Lde(r){return"</"+r+">"}function fx(r,e){e=e||{};var t=e.newline?`
  2213. `:"";function i(n){var a=n.children,o=n.tag,s=n.attrs,l=n.text;return Rde(o,s)+(o!=="style"?yn(l):l||"")+(a?""+t+de(a,function(u){return i(u)}).join(t)+t:"")+Lde(o)}return i(r)}function F8(r,e,t){t=t||{};var i=t.newline?`
  2214. `:"",n=" {"+i,a=i+"}",o=de(bt(r),function(l){return l+n+de(bt(r[l]),function(u){return u+":"+r[l][u]+";"}).join(i)+a}).join(i),s=de(bt(e),function(l){return"@keyframes "+l+n+de(bt(e[l]),function(u){return u+n+de(bt(e[l][u]),function(c){var f=e[l][u][c];return c==="d"&&(f='path("'+f+'")'),c+":"+f+";"}).join(i)+a}).join(i)+a}).join(i);return!o&&!s?"":["<![CDATA[",o,s,"]]>"].join(i)}function hx(r){return{zrId:r,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function I2(r,e,t,i){return Ci("svg","root",{width:r,height:e,xmlns:U8,"xmlns:xlink":P2,version:"1.1",baseProfile:"full",viewBox:i?"0 0 "+r+" "+e:!1},t)}var Pde=0;function W1(){return Pde++}var B8={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},$p="transform-origin";function Dde(r,e,t){var i=fe({},r.shape);fe(i,e),r.buildPath(t,i);var n=new G1;return n.reset(Pb(r)),t.rebuildPath(n,1),n.generateStr(),n.getStr()}function Ide(r,e){var t=e.originX,i=e.originY;(t||i)&&(r[$p]=t+"px "+i+"px")}var Nde={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function V8(r,e){var t=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[t]=r,t}function Ude(r,e,t){var i=r.shape.paths,n={},a,o;if(N(i,function(l){var u=hx(t.zrId);u.animation=!0,px(l,{},u,!0);var c=u.cssAnims,f=u.cssNodes,h=bt(c),p=h.length;if(p){o=h[p-1];var d=c[o];for(var g in d){var m=d[g];n[g]=n[g]||{d:""},n[g].d+=m.d||""}for(var v in f){var _=f[v].animation;_.indexOf(o)>=0&&(a=_)}}}),!!a){e.d=!1;var s=V8(n,t);return a.replace(o,s)}}function k8(r){return Ce(r)?B8[r]?"cubic-bezier("+B8[r]+")":Dm(r)?r:"":""}function px(r,e,t,i){var n=r.animators,a=n.length,o=[];if(r instanceof tv){var s=Ude(r,e,t);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var l={},u=0;u<a;u++){var c=n[u],f=[c.getMaxTime()/1e3+"s"],h=k8(c.getClip().easing),p=c.getDelay();h?f.push(h):f.push("linear"),p&&f.push(p/1e3+"s"),c.getLoop()&&f.push("infinite");var d=f.join(" ");l[d]=l[d]||[d,[]],l[d][1].push(c)}function g(_){var y=_[1],x=y.length,M={},S={},w={},T="animation-timing-function";function C(ue,se,Ee){for(var q=ue.getTracks(),H=ue.getMaxTime(),We=0;We<q.length;We++){var _e=q[We];if(_e.needsAnimate()){var xe=_e.keyframes,Le=_e.propName;if(Ee&&(Le=Ee(Le)),Le)for(var Ue=0;Ue<xe.length;Ue++){var Ne=xe[Ue],Ve=Math.round(Ne.time/H*100)+"%",ct=k8(Ne.easing),F=Ne.rawValue;(Ce(F)||Ct(F))&&(se[Ve]=se[Ve]||{},se[Ve][Le]=Ne.rawValue,ct&&(se[Ve][T]=ct))}}}}for(var b=0;b<x;b++){var E=y[b],I=E.targetName;I?I==="shape"&&C(E,S):!i&&C(E,M)}for(var R in M){var A={};VL(A,r),fe(A,M[R]);var D=Db(A),U=M[R][T];w[R]=D?{transform:D}:{},Ide(w[R],A),U&&(w[R][T]=U)}var B,z=!0;for(var R in S){w[R]=w[R]||{};var k=!B,U=S[R][T];k&&(B=new Ki);var G=B.len();B.reset(),w[R].d=Dde(r,S[R],B);var Y=B.len();if(!k&&G!==Y){z=!1;break}U&&(w[R][T]=U)}if(!z)for(var R in w)delete w[R].d;if(!i)for(var b=0;b<x;b++){var E=y[b],I=E.targetName;I==="style"&&C(E,w,function(q){return Nde[q]})}for(var J=bt(w),Q=!0,V,b=1;b<J.length;b++){var K=J[b-1],ae=J[b];if(w[K][$p]!==w[ae][$p]){Q=!1;break}V=w[K][$p]}if(Q&&V){for(var R in w)w[R][$p]&&delete w[R][$p];e[$p]=V}if(Wt(J,function(ue){return bt(w[ue]).length>0}).length){var ve=V8(w,t);return ve+" "+_[0]+" both"}}for(var m in l){var s=g(l[m]);s&&o.push(s)}if(o.length){var v=t.zrId+"-cls-"+W1();t.cssNodes["."+v]={animation:o.join(",")},e.class=v}}function H8(r,e,t){if(!r.ignore)if(r.isSilent()){var i={"pointer-events":"none"};G8(i,e,t,!0)}else{var n=r.states.emphasis&&r.states.emphasis.style?r.states.emphasis.style:{},a=n.fill;if(!a){var o=r.style&&r.style.fill,s=r.states.select&&r.states.select.style&&r.states.select.style.fill,l=r.currentStates.indexOf("select")>=0&&s||o;l&&(a=Y0(l))}var u=n.lineWidth;if(u){var c=!n.strokeNoScale&&r.transform?r.transform[0]:1;u=u/c}var i={cursor:"pointer"};a&&(i.fill=a),n.stroke&&(i.stroke=n.stroke),u&&(i["stroke-width"]=u),G8(i,e,t,!0)}}function G8(r,e,t,i){var n=JSON.stringify(r),a=t.cssStyleCache[n];a||(a=t.zrId+"-cls-"+W1(),t.cssStyleCache[n]=a,t.cssNodes["."+a+(i?":hover":"")]=r),e.class=e.class?e.class+" "+a:a}var dx=Math.round;function q8(r){return r&&Ce(r.src)}function Z8(r){return r&&He(r.toDataURL)}function N2(r,e,t,i){L2(function(n,a){var o=n==="fill"||n==="stroke";o&&Lb(a)?F2(e,r,n,i):o&&q0(a)?B2(t,r,n,i):o&&a==="none"?r[n]="transparent":r[n]=a},e,t,!1),Gde(t,r,i)}function U2(r,e){var t=qG(e);t&&(t.each(function(i,n){i!=null&&(r[(D2+n).toLowerCase()]=i+"")}),e.isSilent()&&(r[D2+"silent"]="true"))}function W8(r){return Cl(r[0]-1)&&Cl(r[1])&&Cl(r[2])&&Cl(r[3]-1)}function Ode(r){return Cl(r[4])&&Cl(r[5])}function O2(r,e,t){if(e&&!(Ode(e)&&W8(e))){var i=t?10:1e4;r.transform=W8(e)?"translate("+dx(e[4]*i)/i+" "+dx(e[5]*i)/i+")":SG(e)}}function X8(r,e,t){for(var i=r.points,n=[],a=0;a<i.length;a++)n.push(dx(i[a][0]*t)/t),n.push(dx(i[a][1]*t)/t);e.points=n.join(" ")}function Y8(r){return!r.smooth}function zde(r){var e=de(r,function(t){return typeof t=="string"?[t,t]:t});return function(t,i,n){for(var a=0;a<e.length;a++){var o=e[a],s=t[o[0]];s!=null&&(i[o[1]]=dx(s*n)/n)}}}var Fde={circle:[zde(["cx","cy","r"])],polyline:[X8,Y8],polygon:[X8,Y8]};function Bde(r){for(var e=r.animators,t=0;t<e.length;t++)if(e[t].targetName==="shape")return!0;return!1}function j8(r,e){var t=r.style,i=r.shape,n=Fde[r.type],a={},o=e.animation,s="path",l=r.style.strokePercent,u=e.compress&&Pb(r)||4;if(n&&!e.willUpdate&&!(n[1]&&!n[1](i))&&!(o&&Bde(r))&&!(l<1)){s=r.type;var c=Math.pow(10,u);n[0](i,a,c)}else{var f=!r.path||r.shapeChanged();r.path||r.createPathProxy();var h=r.path;f&&(h.beginPath(),r.buildPath(h,r.shape),r.pathUpdated());var p=h.getVersion(),d=r,g=d.__svgPathBuilder;(d.__svgPathVersion!==p||!g||l!==d.__svgPathStrokePercent)&&(g||(g=d.__svgPathBuilder=new G1),g.reset(u),h.rebuildPath(g,l),g.generateStr(),d.__svgPathVersion=p,d.__svgPathStrokePercent=l),a.d=g.getStr()}return O2(a,r.transform),N2(a,t,r,e),U2(a,r),e.animation&&px(r,a,e),e.emphasis&&H8(r,a,e),Ci(s,r.id+"",a)}function kde(r,e){var t=r.style,i=t.image;if(i&&!Ce(i)&&(q8(i)?i=i.src:Z8(i)&&(i=i.toDataURL())),!!i){var n=t.x||0,a=t.y||0,o=t.width,s=t.height,l={href:i,width:o,height:s};return n&&(l.x=n),a&&(l.y=a),O2(l,r.transform),N2(l,t,r,e),U2(l,r),e.animation&&px(r,l,e),Ci("image",r.id+"",l)}}function Vde(r,e){var t=r.style,i=t.text;if(i!=null&&(i+=""),!(!i||isNaN(t.x)||isNaN(t.y))){var n=t.font||ho,a=t.x||0,o=bG(t.y||0,zm(n),t.textBaseline),s=MG[t.textAlign]||t.textAlign,l={"dominant-baseline":"central","text-anchor":s};if(yP(t)){var u="",c=t.fontStyle,f=gP(t.fontSize);if(!parseFloat(f))return;var h=t.fontFamily||oL,p=t.fontWeight;u+="font-size:"+f+";font-family:"+h+";",c&&c!=="normal"&&(u+="font-style:"+c+";"),p&&p!=="normal"&&(u+="font-weight:"+p+";"),l.style=u}else l.style="font: "+n;return i.match(/\s/)&&(l["xml:space"]="preserve"),a&&(l.x=a),o&&(l.y=o),O2(l,r.transform),N2(l,t,r,e),U2(l,r),e.animation&&px(r,l,e),Ci("text",r.id+"",l,void 0,i)}}function z2(r,e){if(r instanceof ut)return j8(r,e);if(r instanceof Ur)return kde(r,e);if(r instanceof Mu)return Vde(r,e)}function Gde(r,e,t){var i=r.style;if(wG(i)){var n=TG(r),a=t.shadowCache,o=a[n];if(!o){var s=r.getGlobalScale(),l=s[0],u=s[1];if(!l||!u)return;var c=i.shadowOffsetX||0,f=i.shadowOffsetY||0,h=i.shadowBlur,p=gf(i.shadowColor),d=p.opacity,g=p.color,m=h/2/l,v=h/2/u,_=m+" "+v;o=t.zrId+"-s"+t.shadowIdx++,t.defs[o]=Ci("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[Ci("feDropShadow","",{dx:c/l,dy:f/u,stdDeviation:_,"flood-color":g,"flood-opacity":d})]),a[n]=o}e.filter=Z0(o)}}function F2(r,e,t,i){var n=r[t],a,o={gradientUnits:n.global?"userSpaceOnUse":"objectBoundingBox"};if(Cb(n))a="linearGradient",o.x1=n.x,o.y1=n.y,o.x2=n.x2,o.y2=n.y2;else if(Rb(n))a="radialGradient",o.cx=ft(n.x,.5),o.cy=ft(n.y,.5),o.r=ft(n.r,.5);else return;for(var s=n.colorStops,l=[],u=0,c=s.length;u<c;++u){var f=Ab(s[u].offset)*100+"%",h=s[u].color,p=gf(h),d=p.color,g=p.opacity,m={offset:f};m["stop-color"]=d,g<1&&(m["stop-opacity"]=g),l.push(Ci("stop",u+"",m))}var v=Ci(a,"",o,l),_=fx(v),y=i.gradientCache,x=y[_];x||(x=i.zrId+"-g"+i.gradientIdx++,y[_]=x,o.id=x,i.defs[x]=Ci(a,x,o,l)),e[t]=Z0(x)}function B2(r,e,t,i){var n=r.style[t],a=r.getBoundingRect(),o={},s=n.repeat,l=s==="no-repeat",u=s==="repeat-x",c=s==="repeat-y",f;if(CL(n)){var h=n.imageWidth,p=n.imageHeight,d=void 0,g=n.image;if(Ce(g)?d=g:q8(g)?d=g.src:Z8(g)&&(d=g.toDataURL()),typeof Image>"u"){var m="Image width/height must been given explictly in svg-ssr renderer.";kr(h,m),kr(p,m)}else if(h==null||p==null){var v=function(b,E){if(b){var I=b.elm,R=h||E.width,A=p||E.height;b.tag==="pattern"&&(u?(A=1,R/=a.width):c&&(R=1,A/=a.height)),b.attrs.width=R,b.attrs.height=A,I&&(I.setAttribute("width",R),I.setAttribute("height",A))}},_=s_(d,null,r,function(b){l||v(S,b),v(f,b)});_&&_.width&&_.height&&(h=h||_.width,p=p||_.height)}f=Ci("image","img",{href:d,width:h,height:p}),o.width=h,o.height=p}else n.svgElement&&(f=Qe(n.svgElement),o.width=n.svgWidth,o.height=n.svgHeight);if(f){var y,x;l?y=x=1:u?(x=1,y=o.width/a.width):c?(y=1,x=o.height/a.height):o.patternUnits="userSpaceOnUse",y!=null&&!isNaN(y)&&(o.width=y),x!=null&&!isNaN(x)&&(o.height=x);var M=Db(n);M&&(o.patternTransform=M);var S=Ci("pattern","",o,[f]),w=fx(S),T=i.patternCache,C=T[w];C||(C=i.zrId+"-p"+i.patternIdx++,T[w]=C,o.id=C,S=i.defs[C]=Ci("pattern",C,o,[f])),e[t]=Z0(C)}}function K8(r,e,t){var i=t.clipPathCache,n=t.defs,a=i[r.id];if(!a){a=t.zrId+"-c"+t.clipPathIdx++;var o={id:a};i[r.id]=a,n[a]=Ci("clipPath",a,o,[j8(r,t)])}e["clip-path"]=Z0(a)}function k2(r){return document.createTextNode(r)}function Vf(r,e,t){r.insertBefore(e,t)}function V2(r,e){r.removeChild(e)}function G2(r,e){r.appendChild(e)}function H2(r){return r.parentNode}function W2(r){return r.nextSibling}function X1(r,e){r.textContent=e}var J8=58,Wde=120,Xde=Ci("","");function X2(r){return r===void 0}function Wl(r){return r!==void 0}function Yde(r,e,t){for(var i={},n=e;n<=t;++n){var a=r[n].key;a!==void 0&&(i[a]=n)}return i}function mx(r,e){var t=r.key===e.key,i=r.tag===e.tag;return i&&t}function vx(r){var e,t=r.children,i=r.tag;if(Wl(i)){var n=r.elm=H1(i);if(q1(Xde,r),pe(t))for(e=0;e<t.length;++e){var a=t[e];a!=null&&G2(n,vx(a))}else Wl(r.text)&&!qe(r.text)&&G2(n,k2(r.text))}else r.elm=k2(r.text);return r.elm}function $8(r,e,t,i,n){for(;i<=n;++i){var a=t[i];a!=null&&Vf(r,vx(a),e)}}function Y1(r,e,t,i){for(;t<=i;++t){var n=e[t];if(n!=null)if(Wl(n.tag)){var a=H2(n.elm);V2(a,n.elm)}else V2(r,n.elm)}}function q1(r,e){var t,i=e.elm,n=r&&r.attrs||{},a=e.attrs||{};if(n!==a){for(t in a){var o=a[t],s=n[t];s!==o&&(o===!0?i.setAttribute(t,""):o===!1?i.removeAttribute(t):t==="style"?i.style.cssText=o:t.charCodeAt(0)!==Wde?i.setAttribute(t,o):t==="xmlns:xlink"||t==="xmlns"?i.setAttributeNS(O8,t,o):t.charCodeAt(3)===J8?i.setAttributeNS(z8,t,o):t.charCodeAt(5)===J8?i.setAttributeNS(P2,t,o):i.setAttribute(t,o))}for(t in n)t in a||i.removeAttribute(t)}}function qde(r,e,t){for(var i=0,n=0,a=e.length-1,o=e[0],s=e[a],l=t.length-1,u=t[0],c=t[l],f,h,p,d;i<=a&&n<=l;)o==null?o=e[++i]:s==null?s=e[--a]:u==null?u=t[++n]:c==null?c=t[--l]:mx(o,u)?(Tv(o,u),o=e[++i],u=t[++n]):mx(s,c)?(Tv(s,c),s=e[--a],c=t[--l]):mx(o,c)?(Tv(o,c),Vf(r,o.elm,W2(s.elm)),o=e[++i],c=t[--l]):mx(s,u)?(Tv(s,u),Vf(r,s.elm,o.elm),s=e[--a],u=t[++n]):(X2(f)&&(f=Yde(e,i,a)),h=f[u.key],X2(h)?Vf(r,vx(u),o.elm):(p=e[h],p.tag!==u.tag?Vf(r,vx(u),o.elm):(Tv(p,u),e[h]=void 0,Vf(r,p.elm,o.elm))),u=t[++n]);(i<=a||n<=l)&&(i>a?(d=t[l+1]==null?null:t[l+1].elm,$8(r,d,t,n,l)):Y1(r,e,i,a))}function Tv(r,e){var t=e.elm=r.elm,i=r.children,n=e.children;r!==e&&(q1(r,e),X2(e.text)?Wl(i)&&Wl(n)?i!==n&&qde(t,i,n):Wl(n)?(Wl(r.text)&&X1(t,""),$8(t,null,n,0,n.length-1)):Wl(i)?Y1(t,i,0,i.length-1):Wl(r.text)&&X1(t,""):r.text!==e.text&&(Wl(i)&&Y1(t,i,0,i.length-1),X1(t,e.text)))}function Y2(r,e){if(mx(r,e))Tv(r,e);else{var t=r.elm,i=H2(t);vx(e),i!==null&&(Vf(i,e.elm,W2(t)),Y1(i,[r],0,0))}return e}var Zde=0,jde=function(){function r(e,t,i){if(this.type="svg",this.refreshHover=Q8("refreshHover"),this.configLayer=Q8("configLayer"),this.storage=t,this._opts=i=fe({},i),this.root=e,this._id="zr"+Zde++,this._oldVNode=I2(i.width,i.height),e&&!i.ssr){var n=this._viewport=document.createElement("div");n.style.cssText="position:relative;overflow:hidden";var a=this._svgDom=this._oldVNode.elm=H1("svg");q1(null,this._oldVNode),n.appendChild(a),e.appendChild(n)}this.resize(i.width,i.height)}return r.prototype.getType=function(){return this.type},r.prototype.getViewportRoot=function(){return this._viewport},r.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},r.prototype.getSvgDom=function(){return this._svgDom},r.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style="position:absolute;left:0;top:0;user-select:none",Y2(this._oldVNode,e),this._oldVNode=e}},r.prototype.renderOneToVNode=function(e){return z2(e,hx(this._id))},r.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),i=this._width,n=this._height,a=hx(this._id);a.animation=e.animation,a.willUpdate=e.willUpdate,a.compress=e.compress,a.emphasis=e.emphasis;var o=[],s=this._bgVNode=Kde(i,n,this._backgroundColor,a);s&&o.push(s);var l=e.compress?null:this._mainVNode=Ci("g","main",{},[]);this._paintList(t,a,l?l.children:o),l&&o.push(l);var u=de(bt(a.defs),function(h){return a.defs[h]});if(u.length&&o.push(Ci("defs","defs",{},u)),e.animation){var c=F8(a.cssNodes,a.cssAnims,{newline:!0});if(c){var f=Ci("style","stl",{},[],c);o.push(f)}}return I2(i,n,o,e.useViewBox)},r.prototype.renderToString=function(e){return e=e||{},fx(this.renderToVNode({animation:ft(e.cssAnimation,!0),emphasis:ft(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:ft(e.useViewBox,!0)}),{newline:!0})},r.prototype.setBackgroundColor=function(e){this._backgroundColor=e},r.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},r.prototype._paintList=function(e,t,i){for(var n=e.length,a=[],o=0,s,l,u=0,c=0;c<n;c++){var f=e[c];if(!f.invisible){var h=f.__clipPaths,p=h&&h.length||0,d=l&&l.length||0,g=void 0;for(g=Math.max(p-1,d-1);g>=0&&!(h&&l&&h[g]===l[g]);g--);for(var m=d-1;m>g;m--)o--,s=a[o-1];for(var v=g+1;v<p;v++){var _={};K8(h[v],_,t);var y=Ci("g","clip-g-"+u++,_,[]);(s?s.children:i).push(y),a[o++]=y,s=y}l=h;var x=z2(f,t);x&&(s?s.children:i).push(x)}}},r.prototype.resize=function(e,t){var i=this._opts,n=this.root,a=this._viewport;if(e!=null&&(i.width=e),t!=null&&(i.height=t),n&&a&&(a.style.display="none",e=Df(n,0,i),t=Df(n,1,i),a.style.display=""),this._width!==e||this._height!==t){if(this._width=e,this._height=t,a){var o=a.style;o.width=e+"px",o.height=t+"px"}if(q0(this._backgroundColor))this.refresh();else{var s=this._svgDom;s&&(s.setAttribute("width",e),s.setAttribute("height",t));var l=this._bgVNode&&this._bgVNode.elm;l&&(l.setAttribute("width",e),l.setAttribute("height",t))}}},r.prototype.getWidth=function(){return this._width},r.prototype.getHeight=function(){return this._height},r.prototype.dispose=function(){this.root&&(this.root.innerHTML=""),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},r.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},r.prototype.toDataURL=function(e){var t=this.renderToString(),i="data:image/svg+xml;";return e?(t=EG(t),t&&i+"base64,"+t):i+"charset=UTF-8,"+encodeURIComponent(t)},r}();function Q8(r){return function(){}}function Kde(r,e,t,i){var n;if(t&&t!=="none")if(n=Ci("rect","bg",{width:r,height:e,x:"0",y:"0"}),Lb(t))F2({fill:t},n.attrs,"fill",i);else if(q0(t))B2({style:{fill:t},dirty:Dr,getBoundingRect:function(){return{width:r,height:e}}},n.attrs,"fill",i);else{var a=gf(t),o=a.color,s=a.opacity;n.attrs.fill=o,s<1&&(n.attrs["fill-opacity"]=s)}return n}var eX=jde;function q2(r){r.registerPainter("svg",eX)}function tX(r,e,t){var i=Fn.createCanvas(),n=e.getWidth(),a=e.getHeight(),o=i.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=n+"px",o.height=a+"px",i.setAttribute("data-zr-dom-id",r)),i.width=n*t,i.height=a*t,i}var Jde=function(r){Xt(e,r);function e(t,i,n){var a=r.call(this)||this;a.motionBlur=!1,a.lastFrameAlpha=.7,a.dpr=1,a.virtual=!1,a.config={},a.incremental=!1,a.zlevel=0,a.maxRepaintRectCount=5,a.__dirty=!0,a.__firstTimePaint=!0,a.__used=!1,a.__drawIndex=0,a.__startIndex=0,a.__endIndex=0,a.__prevStartIndex=null,a.__prevEndIndex=null;var o;n=n||mp,typeof t=="string"?o=tX(t,i,n):qe(t)&&(o=t,t=o.id),a.id=t,a.dom=o;var s=o.style;return s&&(ab(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),a.painter=i,a.dpr=n,a}return e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var t=this.dpr;this.domBack=tX("back-"+this.id,this.painter,t),this.ctxBack=this.domBack.getContext("2d"),t!==1&&this.ctxBack.scale(t,t)},e.prototype.createRepaintRects=function(t,i,n,a){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,u=new lt(0,0,0,0);function c(_){if(!(!_.isFinite()||_.isZero()))if(o.length===0){var y=new lt(0,0,0,0);y.copy(_),o.push(y)}else{for(var x=!1,M=1/0,S=0,w=0;w<o.length;++w){var T=o[w];if(T.intersect(_)){var C=new lt(0,0,0,0);C.copy(T),C.union(_),o[w]=C,x=!0;break}else if(l){u.copy(_),u.union(T);var b=_.width*_.height,E=T.width*T.height,I=u.width*u.height,R=I-b-E;R<M&&(M=R,S=w)}}if(l&&(o[S].union(_),x=!0),!x){var y=new lt(0,0,0,0);y.copy(_),o.push(y)}l||(l=o.length>=s)}}for(var f=this.__startIndex;f<this.__endIndex;++f){var h=t[f];if(h){var p=h.shouldBePainted(n,a,!0,!0),d=h.__isRendered&&(h.__dirty&zi||!p)?h.getPrevPaintRect():null;d&&c(d);var g=p&&(h.__dirty&zi||!h.__isRendered)?h.getPaintRect():null;g&&c(g)}}for(var f=this.__prevStartIndex;f<this.__prevEndIndex;++f){var h=i[f],p=h&&h.shouldBePainted(n,a,!0,!0);if(h&&(!p||!h.__zr)&&h.__isRendered){var d=h.getPrevPaintRect();d&&c(d)}}var m;do{m=!1;for(var f=0;f<o.length;){if(o[f].isZero()){o.splice(f,1);continue}for(var v=f+1;v<o.length;)o[f].intersect(o[v])?(m=!0,o[f].union(o[v]),o.splice(v,1)):v++;f++}}while(m);return this._paintRects=o,o},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(t,i){var n=this.dpr,a=this.dom,o=a.style,s=this.domBack;o&&(o.width=t+"px",o.height=i+"px"),a.width=t*n,a.height=i*n,s&&(s.width=t*n,s.height=i*n,n!==1&&this.ctxBack.scale(n,n))},e.prototype.clear=function(t,i,n){var a=this.dom,o=this.ctx,s=a.width,l=a.height;i=i||this.clearColor;var u=this.motionBlur&&!t,c=this.lastFrameAlpha,f=this.dpr,h=this;u&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(a,0,0,s/f,l/f));var p=this.domBack;function d(g,m,v,_){if(o.clearRect(g,m,v,_),i&&i!=="transparent"){var y=void 0;if(lf(i)){var x=i.global||i.__width===v&&i.__height===_;y=x&&i.__canvasGradient||Y_(o,i,{x:0,y:0,width:v,height:_}),i.__canvasGradient=y,i.__width=v,i.__height=_}else zV(i)&&(i.scaleX=i.scaleX||f,i.scaleY=i.scaleY||f,y=l1(o,i,{dirty:function(){h.setUnpainted(),h.painter.refresh()}}));o.save(),o.fillStyle=y||i,o.fillRect(g,m,v,_),o.restore()}u&&(o.save(),o.globalAlpha=c,o.drawImage(p,g,m,v,_),o.restore())}!n||u?d(0,0,s,l):n.length&&N(n,function(g){d(g.x*f,g.y*f,g.width*f,g.height*f)})},e}(Pi),Z1=Jde;var rX=1e5,Qp=314159,j1=.01,$de=.001;function Qde(r){return r?r.__builtin__?!0:!(typeof r.resize!="function"||typeof r.refresh!="function"):!1}function eme(r,e){var t=document.createElement("div");return t.style.cssText=["position:relative","width:"+r+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",t}var tme=function(){function r(e,t,i,n){this.type="canvas",this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type="canvas";var a=!e.nodeName||e.nodeName.toUpperCase()==="CANVAS";this._opts=i=fe({},i||{}),this.dpr=i.devicePixelRatio||mp,this._singleCanvas=a,this.root=e;var o=e.style;o&&(ab(e),e.innerHTML=""),this.storage=t;var s=this._zlevelList;this._prevDisplayList=[];var l=this._layers;if(a){var c=e,f=c.width,h=c.height;i.width!=null&&(f=i.width),i.height!=null&&(h=i.height),this.dpr=i.devicePixelRatio||1,c.width=f*this.dpr,c.height=h*this.dpr,this._width=f,this._height=h;var p=new Z1(c,this,this.dpr);p.__builtin__=!0,p.initContext(),l[Qp]=p,p.zlevel=Qp,s.push(Qp),this._domRoot=e}else{this._width=Df(e,0,i),this._height=Df(e,1,i);var u=this._domRoot=eme(this._width,this._height);e.appendChild(u)}}return r.prototype.getType=function(){return"canvas"},r.prototype.isSingleCanvas=function(){return this._singleCanvas},r.prototype.getViewportRoot=function(){return this._domRoot},r.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},r.prototype.refresh=function(e){var t=this.storage.getDisplayList(!0),i=this._prevDisplayList,n=this._zlevelList;this._redrawId=Math.random(),this._paintList(t,i,e,this._redrawId);for(var a=0;a<n.length;a++){var o=n[a],s=this._layers[o];if(!s.__builtin__&&s.refresh){var l=a===0?this._backgroundColor:null;s.refresh(l)}}return this._opts.useDirtyRect&&(this._prevDisplayList=t.slice()),this},r.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},r.prototype._paintHoverList=function(e){var t=e.length,i=this._hoverlayer;if(i&&i.clear(),!!t){for(var n={inHover:!0,viewWidth:this._width,viewHeight:this._height},a,o=0;o<t;o++){var s=e[o];s.__inHover&&(i||(i=this._hoverlayer=this.getLayer(rX)),a||(a=i.ctx,a.save()),If(a,s,n,o===t-1))}a&&a.restore()}},r.prototype.getHoverLayer=function(){return this.getLayer(rX)},r.prototype.paintOne=function(e,t){u1(e,t)},r.prototype._paintList=function(e,t,i,n){if(this._redrawId===n){i=i||!1,this._updateLayerStatus(e);var a=this._doPaintList(e,t,i),o=a.finished,s=a.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),s&&this._paintHoverList(e),o)this.eachLayer(function(u){u.afterBrush&&u.afterBrush()});else{var l=this;G0(function(){l._paintList(e,t,i,n)})}}},r.prototype._compositeManually=function(){var e=this.getLayer(Qp).ctx,t=this._domRoot.width,i=this._domRoot.height;e.clearRect(0,0,t,i),this.eachBuiltinLayer(function(n){n.virtual&&e.drawImage(n.dom,0,0,t,i)})},r.prototype._doPaintList=function(e,t,i){for(var n=this,a=[],o=this._opts.useDirtyRect,s=0;s<this._zlevelList.length;s++){var l=this._zlevelList[s],u=this._layers[l];u.__builtin__&&u!==this._hoverlayer&&(u.__dirty||i)&&a.push(u)}for(var c=!0,f=!1,h=function(g){var m=a[g],v=m.ctx,_=o&&m.createRepaintRects(e,t,p._width,p._height),y=i?m.__startIndex:m.__drawIndex,x=!i&&m.incremental&&Date.now,M=x&&Date.now(),S=m.zlevel===p._zlevelList[0]?p._backgroundColor:null;if(m.__startIndex===m.__endIndex)m.clear(!1,S,_);else if(y===m.__startIndex){var w=e[y];(!w.incremental||!w.notClear||i)&&m.clear(!1,S,_)}y===-1&&(console.error("For some unknown reason. drawIndex is -1"),y=m.__startIndex);var T,C=function(R){var A={inHover:!1,allClipped:!1,prevEl:null,viewWidth:n._width,viewHeight:n._height};for(T=y;T<m.__endIndex;T++){var D=e[T];if(D.__inHover&&(f=!0),n._doPaintEl(D,m,o,R,A,T===m.__endIndex-1),x){var U=Date.now()-M;if(U>15)break}}A.prevElClipPaths&&v.restore()};if(_)if(_.length===0)T=m.__endIndex;else for(var b=p.dpr,E=0;E<_.length;++E){var I=_[E];v.save(),v.beginPath(),v.rect(I.x*b,I.y*b,I.width*b,I.height*b),v.clip(),C(I),v.restore()}else v.save(),C(),v.restore();m.__drawIndex=T,m.__drawIndex<m.__endIndex&&(c=!1)},p=this,d=0;d<a.length;d++)h(d);return zt.wxa&&N(this._layers,function(g){g&&g.ctx&&g.ctx.draw&&g.ctx.draw()}),{finished:c,needsRefreshHover:f}},r.prototype._doPaintEl=function(e,t,i,n,a,o){var s=t.ctx;if(i){var l=e.getPaintRect();(!n||l&&l.intersect(n))&&(If(s,e,a,o),e.setPrevPaintRect(l))}else If(s,e,a,o)},r.prototype.getLayer=function(e,t){this._singleCanvas&&!this._needsManuallyCompositing&&(e=Qp);var i=this._layers[e];return i||(i=new Z1("zr_"+e,this,this.dpr),i.zlevel=e,i.__builtin__=!0,this._layerConfig[e]?_t(i,this._layerConfig[e],!0):this._layerConfig[e-j1]&&_t(i,this._layerConfig[e-j1],!0),t&&(i.virtual=t),this.insertLayer(e,i),i.initContext()),i},r.prototype.insertLayer=function(e,t){var i=this._layers,n=this._zlevelList,a=n.length,o=this._domRoot,s=null,l=-1;if(!i[e]&&Qde(t)){if(a>0&&e>n[0]){for(l=0;l<a-1&&!(n[l]<e&&n[l+1]>e);l++);s=i[n[l]]}if(n.splice(l+1,0,e),i[e]=t,!t.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(t.dom,u.nextSibling):o.appendChild(t.dom)}else o.firstChild?o.insertBefore(t.dom,o.firstChild):o.appendChild(t.dom);t.painter||(t.painter=this)}},r.prototype.eachLayer=function(e,t){for(var i=this._zlevelList,n=0;n<i.length;n++){var a=i[n];e.call(t,this._layers[a],a)}},r.prototype.eachBuiltinLayer=function(e,t){for(var i=this._zlevelList,n=0;n<i.length;n++){var a=i[n],o=this._layers[a];o.__builtin__&&e.call(t,o,a)}},r.prototype.eachOtherLayer=function(e,t){for(var i=this._zlevelList,n=0;n<i.length;n++){var a=i[n],o=this._layers[a];o.__builtin__||e.call(t,o,a)}},r.prototype.getLayers=function(){return this._layers},r.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(f,h){f.__dirty=f.__used=!1});function t(f){a&&(a.__endIndex!==f&&(a.__dirty=!0),a.__endIndex=f)}if(this._singleCanvas)for(var i=1;i<e.length;i++){var n=e[i];if(n.zlevel!==e[i-1].zlevel||n.incremental){this._needsManuallyCompositing=!0;break}}var a=null,o=0,s,l;for(l=0;l<e.length;l++){var n=e[l],u=n.zlevel,c=void 0;s!==u&&(s=u,o=0),n.incremental?(c=this.getLayer(u+$de,this._needsManuallyCompositing),c.incremental=!0,o=1):c=this.getLayer(u+(o>0?j1:0),this._needsManuallyCompositing),c.__builtin__||ep("ZLevel "+u+" has been used by unkown layer "+c.id),c!==a&&(c.__used=!0,c.__startIndex!==l&&(c.__dirty=!0),c.__startIndex=l,c.incremental?c.__drawIndex=-1:c.__drawIndex=l,t(l),a=c),n.__dirty&zi&&!n.__inHover&&(c.__dirty=!0,c.incremental&&c.__drawIndex<0&&(c.__drawIndex=l))}t(l),this.eachBuiltinLayer(function(f,h){!f.__used&&f.getElementCount()>0&&(f.__dirty=!0,f.__startIndex=f.__endIndex=f.__drawIndex=0),f.__dirty&&f.__drawIndex<0&&(f.__drawIndex=f.__startIndex)})},r.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},r.prototype._clearLayer=function(e){e.clear()},r.prototype.setBackgroundColor=function(e){this._backgroundColor=e,N(this._layers,function(t){t.setUnpainted()})},r.prototype.configLayer=function(e,t){if(t){var i=this._layerConfig;i[e]?_t(i[e],t,!0):i[e]=t;for(var n=0;n<this._zlevelList.length;n++){var a=this._zlevelList[n];if(a===e||a===e+j1){var o=this._layers[a];_t(o,i[e],!0)}}}},r.prototype.delLayer=function(e){var t=this._layers,i=this._zlevelList,n=t[e];n&&(n.dom.parentNode.removeChild(n.dom),delete t[e],i.splice(dt(i,e),1))},r.prototype.resize=function(e,t){if(this._domRoot.style){var i=this._domRoot;i.style.display="none";var n=this._opts,a=this.root;if(e!=null&&(n.width=e),t!=null&&(n.height=t),e=Df(a,0,n),t=Df(a,1,n),i.style.display="",this._width!==e||t!==this._height){i.style.width=e+"px",i.style.height=t+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(e,t);this.refresh(!0)}this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this.getLayer(Qp).resize(e,t)}return this},r.prototype.clearLayer=function(e){var t=this._layers[e];t&&t.clear()},r.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},r.prototype.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas&&!this._compositeManually)return this._layers[Qp].dom;var t=new Z1("image",this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var i=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var n=t.dom.width,a=t.dom.height;this.eachLayer(function(f){f.__builtin__?i.drawImage(f.dom,0,0,n,a):f.renderToCanvas&&(i.save(),f.renderToCanvas(i),i.restore())})}else for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height},s=this.storage.getDisplayList(!0),l=0,u=s.length;l<u;l++){var c=s[l];If(i,c,o,l===u-1)}return t.dom},r.prototype.getWidth=function(){return this._width},r.prototype.getHeight=function(){return this._height},r}(),iX=tme;function Z2(r){r.registerPainter("canvas",iX)}var rme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t){if(0)var i;return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.getLegendIcon=function(t){var i=new Ze,n=Sr("line",0,t.itemHeight/2,t.itemWidth,0,t.lineStyle.stroke,!1);i.add(n),n.setStyle(t.lineStyle);var a=this.getData().getVisual("symbol"),o=this.getData().getVisual("symbolRotate"),s=a==="none"?"circle":a,l=t.itemHeight*.8,u=Sr(s,(t.itemWidth-l)/2,(t.itemHeight-l)/2,l,l,t.itemStyle.fill);i.add(u),u.setStyle(t.itemStyle);var c=t.iconRotate==="inherit"?o:t.iconRotate||0;return u.rotation=c*Math.PI/180,u.setOrigin([t.itemWidth/2,t.itemHeight/2]),s.indexOf("empty")>-1&&(u.style.stroke=u.style.fill,u.style.fill="#fff",u.style.lineWidth=2),i},e.type="series.line",e.dependencies=["grid","polar"],e.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},e}(jt),nX=rme;function el(r,e){var t=r.mapDimensionsAll("defaultedLabel"),i=t.length;if(i===1){var n=Ou(r,e,t[0]);return n!=null?n+"":null}else if(i){for(var a=[],o=0;o<t.length;o++)a.push(Ou(r,e,t[o]));return a.join(" ")}}function K1(r,e){var t=r.mapDimensionsAll("defaultedLabel");if(!pe(e))return e+"";for(var i=[],n=0;n<t.length;n++){var a=r.getDimensionIndex(t[n]);a>=0&&i.push(e[a])}return i.join(" ")}var ime=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this)||this;return o.updateData(t,i,n,a),o}return e.prototype._createSymbol=function(t,i,n,a,o){this.removeAll();var s=Sr(t,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:a[0]/2,scaleY:a[1]/2}),s.drift=nme,this._symbolType=t,this.add(s)},e.prototype.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(null,t)},e.prototype.getSymbolType=function(){return this._symbolType},e.prototype.getSymbolPath=function(){return this.childAt(0)},e.prototype.highlight=function(){Bn(this.childAt(0))},e.prototype.downplay=function(){kn(this.childAt(0))},e.prototype.setZ=function(t,i){var n=this.childAt(0);n.zlevel=t,n.z=i},e.prototype.setDraggable=function(t,i){var n=this.childAt(0);n.draggable=t,n.cursor=!i&&t?"move":n.cursor},e.prototype.updateData=function(t,i,n,a){this.silent=!1;var o=t.getItemVisual(i,"symbol")||"circle",s=t.hostModel,l=e.getSymbolSize(t,i),u=o!==this._symbolType,c=a&&a.disableAnimation;if(u){var f=t.getItemVisual(i,"symbolKeepAspect");this._createSymbol(o,t,i,l,f)}else{var h=this.childAt(0);h.silent=!1;var p={scaleX:l[0]/2,scaleY:l[1]/2};c?h.attr(p):Dt(h,p,s,i),Di(h)}if(this._updateCommon(t,i,l,n,a),u){var h=this.childAt(0);if(!c){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:h.style.opacity}};h.scaleX=h.scaleY=0,h.style.opacity=0,or(h,p,s,i)}}c&&this.childAt(0).stopAnimation("leave")},e.prototype._updateCommon=function(t,i,n,a,o){var s=this.childAt(0),l=t.hostModel,u,c,f,h,p,d,g,m,v;if(a&&(u=a.emphasisItemStyle,c=a.blurItemStyle,f=a.selectItemStyle,h=a.focus,p=a.blurScope,g=a.labelStatesModels,m=a.hoverScale,v=a.cursorStyle,d=a.emphasisDisabled),!a||t.hasItemOption){var _=a&&a.itemModel?a.itemModel:t.getItemModel(i),y=_.getModel("emphasis");u=y.getModel("itemStyle").getItemStyle(),f=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),h=y.get("focus"),p=y.get("blurScope"),d=y.get("disabled"),g=wr(_),m=y.getShallow("scale"),v=_.getShallow("cursor")}var x=t.getItemVisual(i,"symbolRotate");s.attr("rotation",(x||0)*Math.PI/180||0);var M=bo(t.getItemVisual(i,"symbolOffset"),n);M&&(s.x=M[0],s.y=M[1]),v&&s.attr("cursor",v);var S=t.getItemVisual(i,"style"),w=S.fill;if(s instanceof Ur){var T=s.style;s.useStyle(fe({image:T.image,x:T.x,y:T.y,width:T.width,height:T.height},S))}else s.__isEmptyBrush?s.useStyle(fe({},S)):s.useStyle(S),s.style.decal=null,s.setColor(w,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var C=t.getItemVisual(i,"liftZ"),b=this._z2;C!=null?b==null&&(this._z2=s.z2,s.z2+=C):b!=null&&(s.z2=b,this._z2=null);var E=o&&o.useNameLabel;Ir(s,g,{labelFetcher:l,labelDataIndex:i,defaultText:I,inheritColor:w,defaultOpacity:S.opacity});function I(D){return E?t.getName(D):el(t,D)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var R=s.ensureState("emphasis");R.style=u,s.ensureState("select").style=f,s.ensureState("blur").style=c;var A=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;R.scaleX=this._sizeX*A,R.scaleY=this._sizeY*A,this.setSymbolScale(1),ar(this,h,p,d)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,i,n){var a=this.childAt(0),o=rt(this).dataIndex,s=n&&n.animation;if(this.silent=a.silent=!0,n&&n.fadeLabel){var l=a.getTextContent();l&&ts(l,{style:{opacity:0}},i,{dataIndex:o,removeOpt:s,cb:function(){a.removeTextContent()}})}else a.removeTextContent();ts(a,{style:{opacity:0},scaleX:0,scaleY:0},i,{dataIndex:o,cb:t,removeOpt:s})},e.getSymbolSize=function(t,i){return Zs(t.getItemVisual(i,"symbolSize"))},e}(Ze);function nme(r,e){this.parent.drift(r,e)}var Bu=ime;function j2(r,e,t,i){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(i.isIgnore&&i.isIgnore(t))&&!(i.clipShape&&!i.clipShape.contain(e[0],e[1]))&&r.getItemVisual(t,"symbol")!=="none"}function aX(r){return r!=null&&!qe(r)&&(r={isIgnore:r}),r||{}}function oX(r){var e=r.hostModel,t=e.getModel("emphasis");return{emphasisItemStyle:t.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:t.get("focus"),blurScope:t.get("blurScope"),emphasisDisabled:t.get("disabled"),hoverScale:t.get("scale"),labelStatesModels:wr(e),cursorStyle:e.get("cursor")}}var ame=function(){function r(e){this.group=new Ze,this._SymbolCtor=e||Bu}return r.prototype.updateData=function(e,t){this._progressiveEls=null,t=aX(t);var i=this.group,n=e.hostModel,a=this._data,o=this._SymbolCtor,s=t.disableAnimation,l=oX(e),u={disableAnimation:s},c=t.getSymbolPoint||function(f){return e.getItemLayout(f)};a||i.removeAll(),e.diff(a).add(function(f){var h=c(f);if(j2(e,h,f,t)){var p=new o(e,f,l,u);p.setPosition(h),e.setItemGraphicEl(f,p),i.add(p)}}).update(function(f,h){var p=a.getItemGraphicEl(h),d=c(f);if(!j2(e,d,f,t)){i.remove(p);return}var g=e.getItemVisual(f,"symbol")||"circle",m=p&&p.getSymbolType&&p.getSymbolType();if(!p||m&&m!==g)i.remove(p),p=new o(e,f,l,u),p.setPosition(d);else{p.updateData(e,f,l,u);var v={x:d[0],y:d[1]};s?p.attr(v):Dt(p,v,n)}i.add(p),e.setItemGraphicEl(f,p)}).remove(function(f){var h=a.getItemGraphicEl(f);h&&h.fadeOut(function(){i.remove(h)},n)}).execute(),this._getSymbolPoint=c,this._data=e},r.prototype.updateLayout=function(){var e=this,t=this._data;t&&t.eachItemGraphicEl(function(i,n){var a=e._getSymbolPoint(n);i.setPosition(a),i.markRedraw()})},r.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=oX(e),this._data=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t,i){this._progressiveEls=[],i=aX(i);function n(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var a=e.start;a<e.end;a++){var o=t.getItemLayout(a);if(j2(t,o,a,i)){var s=new this._SymbolCtor(t,a,this._seriesScope);s.traverse(n),s.setPosition(o),this.group.add(s),t.setItemGraphicEl(a,s),this._progressiveEls.push(s)}}},r.prototype.eachRendered=function(e){ca(this._progressiveEls||this.group,e)},r.prototype.remove=function(e){var t=this.group,i=this._data;i&&e?i.eachItemGraphicEl(function(n){n.fadeOut(function(){t.remove(n)},i.hostModel)}):t.removeAll()},r}(),Xl=ame;function J1(r,e,t){var i=r.getBaseAxis(),n=r.getOtherAxis(i),a=ome(n,t),o=i.dim,s=n.dim,l=e.mapDimension(s),u=e.mapDimension(o),c=s==="x"||s==="radius"?1:0,f=de(r.dimensions,function(d){return e.mapDimension(d)}),h=!1,p=e.getCalculationInfo("stackResultDimension");return wo(e,f[0])&&(h=!0,f[0]=p),wo(e,f[1])&&(h=!0,f[1]=p),{dataDimsForPoint:f,valueStart:a,valueAxisDim:s,baseAxisDim:o,stacked:!!h,valueDim:l,baseDim:u,baseDataOffset:c,stackedOverDimension:e.getCalculationInfo("stackedOverDimension")}}function ome(r,e){var t=0,i=r.scale.getExtent();return e==="start"?t=i[0]:e==="end"?t=i[1]:Ct(e)&&!isNaN(e)?t=e:i[0]>0?t=i[0]:i[1]<0&&(t=i[1]),t}function $1(r,e,t,i){var n=NaN;r.stacked&&(n=t.get(t.getCalculationInfo("stackedOverDimension"),i)),isNaN(n)&&(n=r.valueStart);var a=r.baseDataOffset,o=[];return o[a]=t.get(r.baseDim,i),o[1-a]=n,e.dataToPoint(o)}function sme(r,e){var t=[];return e.diff(r).add(function(i){t.push({cmd:"+",idx:i})}).update(function(i,n){t.push({cmd:"=",idx:n,idx1:i})}).remove(function(i){t.push({cmd:"-",idx:i})}).execute(),t}function K2(r,e,t,i,n,a,o,s){for(var l=sme(r,e),u=[],c=[],f=[],h=[],p=[],d=[],g=[],m=J1(n,e,o),v=r.getLayout("points")||[],_=e.getLayout("points")||[],y=0;y<l.length;y++){var x=l[y],M=!0,S=void 0,w=void 0;switch(x.cmd){case"=":S=x.idx*2,w=x.idx1*2;var T=v[S],C=v[S+1],b=_[w],E=_[w+1];(isNaN(T)||isNaN(C))&&(T=b,C=E),u.push(T,C),c.push(b,E),f.push(t[S],t[S+1]),h.push(i[w],i[w+1]),g.push(e.getRawIndex(x.idx1));break;case"+":var I=x.idx,R=m.dataDimsForPoint,A=n.dataToPoint([e.get(R[0],I),e.get(R[1],I)]);w=I*2,u.push(A[0],A[1]),c.push(_[w],_[w+1]);var D=$1(m,n,e,I);f.push(D[0],D[1]),h.push(i[w],i[w+1]),g.push(e.getRawIndex(I));break;case"-":M=!1}M&&(p.push(x),d.push(d.length))}d.sort(function(K,ae){return g[K]-g[ae]});for(var U=u.length,B=pa(U),z=pa(U),k=pa(U),G=pa(U),Y=[],y=0;y<d.length;y++){var J=d[y],Q=y*2,V=J*2;B[Q]=u[V],B[Q+1]=u[V+1],z[Q]=c[V],z[Q+1]=c[V+1],k[Q]=f[V],k[Q+1]=f[V+1],G[Q]=h[V],G[Q+1]=h[V+1],Y[y]=p[J]}return{current:B,next:z,stackedOnCurrent:k,stackedOnNext:G,status:Y}}var Gf=Math.min,Hf=Math.max;function ed(r,e){return isNaN(r)||isNaN(e)}function J2(r,e,t,i,n,a,o,s,l){for(var u,c,f,h,p,d,g=t,m=0;m<i;m++){var v=e[g*2],_=e[g*2+1];if(g>=n||g<0)break;if(ed(v,_)){if(l){g+=a;continue}break}if(g===t)r[a>0?"moveTo":"lineTo"](v,_),f=v,h=_;else{var y=v-u,x=_-c;if(y*y+x*x<.5){g+=a;continue}if(o>0){for(var M=g+a,S=e[M*2],w=e[M*2+1];S===v&&w===_&&m<i;)m++,M+=a,g+=a,S=e[M*2],w=e[M*2+1],v=e[g*2],_=e[g*2+1],y=v-u,x=_-c;var T=m+1;if(l)for(;ed(S,w)&&T<i;)T++,M+=a,S=e[M*2],w=e[M*2+1];var C=.5,b=0,E=0,I=void 0,R=void 0;if(T>=i||ed(S,w))p=v,d=_;else{b=S-u,E=w-c;var A=v-u,D=S-v,U=_-c,B=w-_,z=void 0,k=void 0;if(s==="x"){z=Math.abs(A),k=Math.abs(D);var G=b>0?1:-1;p=v-G*z*o,d=_,I=v+G*k*o,R=_}else if(s==="y"){z=Math.abs(U),k=Math.abs(B);var Y=E>0?1:-1;p=v,d=_-Y*z*o,I=v,R=_+Y*k*o}else z=Math.sqrt(A*A+U*U),k=Math.sqrt(D*D+B*B),C=k/(k+z),p=v-b*o*(1-C),d=_-E*o*(1-C),I=v+b*o*C,R=_+E*o*C,I=Gf(I,Hf(S,v)),R=Gf(R,Hf(w,_)),I=Hf(I,Gf(S,v)),R=Hf(R,Gf(w,_)),b=I-v,E=R-_,p=v-b*z/k,d=_-E*z/k,p=Gf(p,Hf(u,v)),d=Gf(d,Hf(c,_)),p=Hf(p,Gf(u,v)),d=Hf(d,Gf(c,_)),b=v-p,E=_-d,I=v+b*k/z,R=_+E*k/z}r.bezierCurveTo(f,h,p,d,v,_),f=I,h=R}else r.lineTo(v,_)}u=v,c=_,g+=a}return m}var sX=function(){function r(){this.smooth=0,this.smoothConstraint=!0}return r}(),lX=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="ec-polyline",i}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new sX},e.prototype.buildPath=function(t,i){var n=i.points,a=0,o=n.length/2;if(i.connectNulls){for(;o>0&&ed(n[o*2-2],n[o*2-1]);o--);for(;a<o&&ed(n[a*2],n[a*2+1]);a++);}for(;a<o;)a+=J2(t,n,a,o,o,1,i.smooth,i.smoothMonotone,i.connectNulls)+1},e.prototype.getPointOn=function(t,i){this.path||(this.createPathProxy(),this.buildPath(this.path,this.shape));for(var n=this.path,a=n.data,o=Ki.CMD,s,l,u=i==="x",c=[],f=0;f<a.length;){var h=a[f++],p=void 0,d=void 0,g=void 0,m=void 0,v=void 0,_=void 0,y=void 0;switch(h){case o.M:s=a[f++],l=a[f++];break;case o.L:if(p=a[f++],d=a[f++],y=u?(t-s)/(p-s):(t-l)/(d-l),y<=1&&y>=0){var x=u?(d-l)*y+l:(p-s)*y+s;return u?[t,x]:[x,t]}s=p,l=d;break;case o.C:p=a[f++],d=a[f++],g=a[f++],m=a[f++],v=a[f++],_=a[f++];var M=u?up(s,p,g,v,t,c):up(l,d,m,_,t,c);if(M>0)for(var S=0;S<M;S++){var w=c[S];if(w<=1&&w>=0){var x=u?hi(l,d,m,_,w):hi(s,p,g,v,w);return u?[t,x]:[x,t]}}s=v,l=_;break}}},e}(ut);var lme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(sX),Q1=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="ec-polygon",i}return e.prototype.getDefaultShape=function(){return new lme},e.prototype.buildPath=function(t,i){var n=i.points,a=i.stackedOnPoints,o=0,s=n.length/2,l=i.smoothMonotone;if(i.connectNulls){for(;s>0&&ed(n[s*2-2],n[s*2-1]);s--);for(;o<s&&ed(n[o*2],n[o*2+1]);o++);}for(;o<s;){var u=J2(t,n,o,s,s,1,i.smooth,l,i.connectNulls);J2(t,a,o+u-1,u,s,-1,i.stackedOnSmooth,l,i.connectNulls),o+=u+1,t.closePath()}},e}(ut);function $2(r,e,t,i,n){var a=r.getArea(),o=a.x,s=a.y,l=a.width,u=a.height,c=t.get(["lineStyle","width"])||2;o-=c/2,s-=c/2,l+=c,u+=c,l=Math.ceil(l),o!==Math.floor(o)&&(o=Math.floor(o),l++);var f=new Et({shape:{x:o,y:s,width:l,height:u}});if(e){var h=r.getBaseAxis(),p=h.isHorizontal(),d=h.inverse;p?(d&&(f.shape.x+=l),f.shape.width=0):(d||(f.shape.y+=u),f.shape.height=0);var g=He(n)?function(m){n(m,f)}:null;or(f,{shape:{width:l,height:u,x:o,y:s}},t,null,i,g)}return f}function Q2(r,e,t){var i=r.getArea(),n=Er(i.r0,1),a=Er(i.r,1),o=new yi({shape:{cx:Er(r.cx,1),cy:Er(r.cy,1),r0:n,r:a,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}});if(e){var s=r.getBaseAxis().dim==="angle";s?o.shape.endAngle=i.startAngle:o.shape.r=n,or(o,{shape:{endAngle:i.endAngle,r:a}},t)}return o}function Yl(r,e,t,i,n){if(r){if(r.type==="polar")return Q2(r,e,t);if(r.type==="cartesian2d")return $2(r,e,t,i,n)}else return null;return null}function us(r,e){return r.type===e}function uX(r,e){if(r.length===e.length){for(var t=0;t<r.length;t++)if(r[t]!==e[t])return;return!0}}function cX(r){for(var e=1/0,t=1/0,i=-1/0,n=-1/0,a=0;a<r.length;){var o=r[a++],s=r[a++];isNaN(o)||(e=Math.min(o,e),i=Math.max(o,i)),isNaN(s)||(t=Math.min(s,t),n=Math.max(s,n))}return[[e,t],[i,n]]}function fX(r,e){var t=cX(r),i=t[0],n=t[1],a=cX(e),o=a[0],s=a[1];return Math.max(Math.abs(i[0]-o[0]),Math.abs(i[1]-o[1]),Math.abs(n[0]-s[0]),Math.abs(n[1]-s[1]))}function hX(r){return Ct(r)?r:r?.5:0}function ume(r,e,t){if(!t.valueDim)return[];for(var i=e.count(),n=pa(i*2),a=0;a<i;a++){var o=$1(t,r,e,a);n[a*2]=o[0],n[a*2+1]=o[1]}return n}function Wf(r,e,t,i){var n=e.getBaseAxis(),a=n.dim==="x"||n.dim==="radius"?0:1,o=[],s=0,l=[],u=[],c=[],f=[];if(i){for(s=0;s<r.length;s+=2)!isNaN(r[s])&&!isNaN(r[s+1])&&f.push(r[s],r[s+1]);r=f}for(s=0;s<r.length-2;s+=2)switch(c[0]=r[s+2],c[1]=r[s+3],u[0]=r[s],u[1]=r[s+1],o.push(u[0],u[1]),t){case"end":l[a]=c[a],l[1-a]=u[1-a],o.push(l[0],l[1]);break;case"middle":var h=(u[a]+c[a])/2,p=[];l[a]=p[a]=h,l[1-a]=u[1-a],p[1-a]=c[1-a],o.push(l[0],l[1]),o.push(p[0],p[1]);break;default:l[a]=u[a],l[1-a]=c[1-a],o.push(l[0],l[1])}return o.push(r[s++],r[s++]),o}function cme(r,e){var t=[],i=r.length,n,a;function o(c,f,h){var p=c.coord,d=(h-p)/(f.coord-p),g=_G(d,[c.color,f.color]);return{coord:h,color:g}}for(var s=0;s<i;s++){var l=r[s],u=l.coord;if(u<0)n=l;else if(u>e){a?t.push(o(a,l,e)):n&&t.push(o(n,l,0),o(n,l,e));break}else n&&(t.push(o(n,l,0)),n=null),t.push(l),a=l}return t}function fme(r,e,t){var i=r.getVisual("visualMeta");if(!(!i||!i.length||!r.count())&&e.type==="cartesian2d"){for(var n,a,o=i.length-1;o>=0;o--){var s=r.getDimensionInfo(i[o].dimension);if(n=s&&s.coordDim,n==="x"||n==="y"){a=i[o];break}}if(a){var l=e.getAxis(n),u=de(a.stops,function(y){return{coord:l.toGlobalCoord(l.dataToCoord(y.value)),color:y.color}}),c=u.length,f=a.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),f.reverse());var h=cme(u,n==="x"?t.getWidth():t.getHeight()),p=h.length;if(!p&&c)return u[0].coord<0?f[1]?f[1]:u[c-1].color:f[0]?f[0]:u[0].color;var d=10,g=h[0].coord-d,m=h[p-1].coord+d,v=m-g;if(v<.001)return"transparent";N(h,function(y){y.offset=(y.coord-g)/v}),h.push({offset:p?h[p-1].offset:.5,color:f[1]||"transparent"}),h.unshift({offset:p?h[0].offset:.5,color:f[0]||"transparent"});var _=new zl(0,0,0,0,h,!0);return _[n]=g,_[n+"2"]=m,_}}}function hme(r,e,t){var i=r.get("showAllSymbol"),n=i==="auto";if(!(i&&!n)){var a=t.getAxesByScale("ordinal")[0];if(a&&!(n&&pme(a,e))){var o=e.mapDimension(a.dim),s={};return N(a.getViewLabels(),function(l){var u=a.scale.getRawOrdinalNumber(l.tickValue);s[u]=1}),function(l){return!s.hasOwnProperty(e.get(o,l))}}}}function pme(r,e){var t=r.getExtent(),i=Math.abs(t[1]-t[0])/r.scale.count();isNaN(i)&&(i=0);for(var n=e.count(),a=Math.max(1,Math.round(n/5)),o=0;o<n;o+=a)if(Bu.getSymbolSize(e,o)[r.isHorizontal()?1:0]*1.5>i)return!1;return!0}function dme(r,e){return isNaN(r)||isNaN(e)}function mme(r){for(var e=r.length/2;e>0&&dme(r[e*2-2],r[e*2-1]);e--);return e-1}function pX(r,e){return[r[e*2],r[e*2+1]]}function vme(r,e,t){for(var i=r.length/2,n=t==="x"?0:1,a,o,s=0,l=-1,u=0;u<i;u++)if(o=r[u*2+n],!(isNaN(o)||isNaN(r[u*2+1-n]))){if(u===0){a=o;continue}if(a<=e&&o>=e||a>=e&&o<=e){l=u;break}s=u,a=o}return{range:[s,l],t:(e-a)/(o-a)}}function dX(r){if(r.get(["endLabel","show"]))return!0;for(var e=0;e<Fi.length;e++)if(r.get([Fi[e],"endLabel","show"]))return!0;return!1}function eI(r,e,t,i){if(us(e,"cartesian2d")){var n=i.getModel("endLabel"),a=n.get("valueAnimation"),o=i.getData(),s={lastFrameIndex:0},l=dX(i)?function(p,d){r._endLabelOnDuring(p,d,o,s,a,n,e)}:null,u=e.getBaseAxis().isHorizontal(),c=$2(e,t,i,function(){var p=r._endLabel;p&&t&&s.originalX!=null&&p.attr({x:s.originalX,y:s.originalY})},l);if(!i.get("clip",!0)){var f=c.shape,h=Math.max(f.width,f.height);u?(f.y-=h,f.height+=h*2):(f.x-=h,f.width+=h*2)}return l&&l(1,c),c}else return Q2(e,t,i)}function gme(r,e){var t=e.getBaseAxis(),i=t.isHorizontal(),n=t.inverse,a=i?n?"right":"left":"center",o=i?"middle":n?"top":"bottom";return{normal:{align:r.get("align")||a,verticalAlign:r.get("verticalAlign")||o}}}var yme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(){var t=new Ze,i=new Xl;this.group.add(i.group),this._symbolDraw=i,this._lineGroup=t},e.prototype.render=function(t,i,n){var a=this,o=t.coordinateSystem,s=this.group,l=t.getData(),u=t.getModel("lineStyle"),c=t.getModel("areaStyle"),f=l.getLayout("points")||[],h=o.type==="polar",p=this._coordSys,d=this._symbolDraw,g=this._polyline,m=this._polygon,v=this._lineGroup,_=!i.ssr&&t.get("animation"),y=!c.isEmpty(),x=c.get("origin"),M=J1(o,l,x),S=y&&ume(o,l,M),w=t.get("showSymbol"),T=t.get("connectNulls"),C=w&&!h&&hme(t,l,o),b=this._data;b&&b.eachItemGraphicEl(function(ae,ve){ae.__temp&&(s.remove(ae),b.setItemGraphicEl(ve,null))}),w||d.remove(),s.add(v);var E=h?!1:t.get("step"),I;o&&o.getArea&&t.get("clip",!0)&&(I=o.getArea(),I.width!=null?(I.x-=.1,I.y-=.1,I.width+=.2,I.height+=.2):I.r0&&(I.r0-=.5,I.r+=.5)),this._clipShapeForSymbol=I;var R=fme(l,o,n)||l.getVisual("style")[l.getVisual("drawType")];if(!(g&&p.type===o.type&&E===this._step))w&&d.updateData(l,{isIgnore:C,clipShape:I,disableAnimation:!0,getSymbolPoint:function(ae){return[f[ae*2],f[ae*2+1]]}}),_&&this._initSymbolLabelAnimation(l,o,I),E&&(f=Wf(f,o,E,T),S&&(S=Wf(S,o,E,T))),g=this._newPolyline(f),y?m=this._newPolygon(f,S):m&&(v.remove(m),m=this._polygon=null),h||this._initOrUpdateEndLabel(t,o,Ws(R)),v.setClipPath(eI(this,o,!0,t));else{y&&!m?m=this._newPolygon(f,S):m&&!y&&(v.remove(m),m=this._polygon=null),h||this._initOrUpdateEndLabel(t,o,Ws(R));var A=v.getClipPath();if(A){var D=eI(this,o,!1,t);or(A,{shape:D.shape},t)}else v.setClipPath(eI(this,o,!0,t));w&&d.updateData(l,{isIgnore:C,clipShape:I,disableAnimation:!0,getSymbolPoint:function(ae){return[f[ae*2],f[ae*2+1]]}}),(!uX(this._stackedOnPoints,S)||!uX(this._points,f))&&(_?this._doUpdateAnimation(l,S,o,n,E,x,T):(E&&(f=Wf(f,o,E,T),S&&(S=Wf(S,o,E,T))),g.setShape({points:f}),m&&m.setShape({points:f,stackedOnPoints:S})))}var U=t.getModel("emphasis"),B=U.get("focus"),z=U.get("blurScope"),k=U.get("disabled");if(g.useStyle(Ye(u.getLineStyle(),{fill:"none",stroke:R,lineJoin:"bevel"})),Gr(g,t,"lineStyle"),g.style.lineWidth>0&&t.get(["emphasis","lineStyle","width"])==="bolder"){var G=g.getState("emphasis").style;G.lineWidth=+g.style.lineWidth+1}rt(g).seriesIndex=t.seriesIndex,ar(g,B,z,k);var Y=hX(t.get("smooth")),J=t.get("smoothMonotone");if(g.setShape({smooth:Y,smoothMonotone:J,connectNulls:T}),m){var Q=l.getCalculationInfo("stackedOnSeries"),V=0;m.useStyle(Ye(c.getAreaStyle(),{fill:R,opacity:.7,lineJoin:"bevel",decal:l.getVisual("style").decal})),Q&&(V=hX(Q.get("smooth"))),m.setShape({smooth:Y,stackedOnSmooth:V,smoothMonotone:J,connectNulls:T}),Gr(m,t,"areaStyle"),rt(m).seriesIndex=t.seriesIndex,ar(m,B,z,k)}var K=function(ae){a._changePolyState(ae)};l.eachItemGraphicEl(function(ae){ae&&(ae.onHoverStateChange=K)}),this._polyline.onHoverStateChange=K,this._data=l,this._coordSys=o,this._stackedOnPoints=S,this._points=f,this._step=E,this._valueOrigin=x,t.get("triggerLineEvent")&&(this.packEventData(t,g),m&&this.packEventData(t,m))},e.prototype.packEventData=function(t,i){rt(i).eventData={componentType:"series",componentSubType:"line",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"line"}},e.prototype.highlight=function(t,i,n,a){var o=t.getData(),s=$o(o,a);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var c=l[s*2],f=l[s*2+1];if(isNaN(c)||isNaN(f)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,f))return;var h=t.get("zlevel")||0,p=t.get("z")||0;u=new Bu(o,s),u.x=c,u.y=f,u.setZ(h,p);var d=u.getSymbolPath().getTextContent();d&&(d.zlevel=h,d.z=p,d.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else Yt.prototype.highlight.call(this,t,i,n,a)},e.prototype.downplay=function(t,i,n,a){var o=t.getData(),s=$o(o,a);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else Yt.prototype.downplay.call(this,t,i,n,a)},e.prototype._changePolyState=function(t){var i=this._polygon;Pp(this._polyline,t),i&&Pp(i,t)},e.prototype._newPolyline=function(t){var i=this._polyline;return i&&this._lineGroup.remove(i),i=new lX({shape:{points:t},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(i),this._polyline=i,i},e.prototype._newPolygon=function(t,i){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new Q1({shape:{points:t,stackedOnPoints:i},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},e.prototype._initSymbolLabelAnimation=function(t,i,n){var a,o,s=i.getBaseAxis(),l=s.inverse;i.type==="cartesian2d"?(a=s.isHorizontal(),o=!1):i.type==="polar"&&(a=s.dim==="angle",o=!0);var u=t.hostModel,c=u.get("animationDuration");He(c)&&(c=c(null));var f=u.get("animationDelay")||0,h=He(f)?f(null):f;t.eachItemGraphicEl(function(p,d){var g=p;if(g){var m=[p.x,p.y],v=void 0,_=void 0,y=void 0;if(n)if(o){var x=n,M=i.pointToCoord(m);a?(v=x.startAngle,_=x.endAngle,y=-M[1]/180*Math.PI):(v=x.r0,_=x.r,y=M[0])}else{var S=n;a?(v=S.x,_=S.x+S.width,y=p.x):(v=S.y+S.height,_=S.y,y=p.y)}var w=_===v?0:(y-v)/(_-v);l&&(w=1-w);var T=He(f)?f(d):c*w+h,C=g.getSymbolPath(),b=C.getTextContent();g.attr({scaleX:0,scaleY:0}),g.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:T}),b&&b.animateFrom({style:{opacity:0}},{duration:300,delay:T}),C.disableLabelAnimation=!0}})},e.prototype._initOrUpdateEndLabel=function(t,i,n){var a=t.getModel("endLabel");if(dX(t)){var o=t.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new Lt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=mme(l);c>=0&&(Ir(s,wr(t,"endLabel"),{inheritColor:n,labelFetcher:t,labelDataIndex:c,defaultText:function(f,h,p){return p!=null?K1(o,p):el(o,f)},enableTextSetter:!0},gme(a,i)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},e.prototype._endLabelOnDuring=function(t,i,n,a,o,s,l){var u=this._endLabel,c=this._polyline;if(u){t<1&&a.originalX==null&&(a.originalX=u.x,a.originalY=u.y);var f=n.getLayout("points"),h=n.hostModel,p=h.get("connectNulls"),d=s.get("precision"),g=s.get("distance")||0,m=l.getBaseAxis(),v=m.isHorizontal(),_=m.inverse,y=i.shape,x=_?v?y.x:y.y+y.height:v?y.x+y.width:y.y,M=(v?g:0)*(_?-1:1),S=(v?0:-g)*(_?-1:1),w=v?"x":"y",T=vme(f,x,w),C=T.range,b=C[1]-C[0],E=void 0;if(b>=1){if(b>1&&!p){var I=pX(f,C[0]);u.attr({x:I[0]+M,y:I[1]+S}),o&&(E=h.getRawValue(C[0]))}else{var I=c.getPointOn(x,w);I&&u.attr({x:I[0]+M,y:I[1]+S});var R=h.getRawValue(C[0]),A=h.getRawValue(C[1]);o&&(E=Xb(n,d,R,A,T.t))}a.lastFrameIndex=C[0]}else{var D=t===1||a.lastFrameIndex>0?C[0]:0,I=pX(f,D);o&&(E=h.getRawValue(D)),u.attr({x:I[0]+M,y:I[1]+S})}if(o){var U=Pu(u);typeof U.setLabelText=="function"&&U.setLabelText(E)}}},e.prototype._doUpdateAnimation=function(t,i,n,a,o,s,l){var u=this._polyline,c=this._polygon,f=t.hostModel,h=K2(this._data,t,this._stackedOnPoints,i,this._coordSys,n,this._valueOrigin,s),p=h.current,d=h.stackedOnCurrent,g=h.next,m=h.stackedOnNext;if(o&&(p=Wf(h.current,n,o,l),d=Wf(h.stackedOnCurrent,n,o,l),g=Wf(h.next,n,o,l),m=Wf(h.stackedOnNext,n,o,l)),fX(p,g)>3e3||c&&fX(d,m)>3e3){u.stopAnimation(),u.setShape({points:g}),c&&(c.stopAnimation(),c.setShape({points:g,stackedOnPoints:m}));return}u.shape.__points=h.current,u.shape.points=p;var v={shape:{points:g}};h.current!==p&&(v.shape.__points=h.next),u.stopAnimation(),Dt(u,v,f),c&&(c.setShape({points:p,stackedOnPoints:d}),c.stopAnimation(),Dt(c,{shape:{stackedOnPoints:m}},f),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],y=h.status,x=0;x<y.length;x++){var M=y[x].cmd;if(M==="="){var S=t.getItemGraphicEl(y[x].idx1);S&&_.push({el:S,ptIdx:x})}}u.animators&&u.animators.length&&u.animators[0].during(function(){c&&c.dirtyShape();for(var w=u.shape.__points,T=0;T<_.length;T++){var C=_[T].el,b=_[T].ptIdx*2;C.x=w[b],C.y=w[b+1],C.markRedraw()}})},e.prototype.remove=function(t){var i=this.group,n=this._data;this._lineGroup.removeAll(),this._symbolDraw.remove(!0),n&&n.eachItemGraphicEl(function(a,o){a.__temp&&(i.remove(a),n.setItemGraphicEl(o,null))}),this._polyline=this._polygon=this._coordSys=this._points=this._stackedOnPoints=this._endLabel=this._data=null},e.type="line",e}(Yt),mX=yme;function tl(r,e){return{seriesType:r,plan:Mo(),reset:function(t){var i=t.getData(),n=t.coordinateSystem,a=t.pipelineContext,o=e||a.large;if(n){var s=de(n.dimensions,function(p){return i.mapDimension(p)}).slice(0,2),l=s.length,u=i.getCalculationInfo("stackResultDimension");wo(i,s[0])&&(s[0]=u),wo(i,s[1])&&(s[1]=u);var c=i.getStore(),f=i.getDimensionIndex(s[0]),h=i.getDimensionIndex(s[1]);return l&&{progress:function(p,d){for(var g=p.end-p.start,m=o&&pa(g*l),v=[],_=[],y=p.start,x=0;y<p.end;y++){var M=void 0;if(l===1){var S=c.get(f,y);M=n.dataToPoint(S,null,_)}else v[0]=c.get(f,y),v[1]=c.get(h,y),M=n.dataToPoint(v,null,_);o?(m[x++]=M[0],m[x++]=M[1]):d.setItemLayout(y,M.slice())}o&&d.setLayout("points",m)}}}}}}var _me={average:function(r){for(var e=0,t=0,i=0;i<r.length;i++)isNaN(r[i])||(e+=r[i],t++);return t===0?NaN:e/t},sum:function(r){for(var e=0,t=0;t<r.length;t++)e+=r[t]||0;return e},max:function(r){for(var e=-1/0,t=0;t<r.length;t++)r[t]>e&&(e=r[t]);return isFinite(e)?e:NaN},min:function(r){for(var e=1/0,t=0;t<r.length;t++)r[t]<e&&(e=r[t]);return isFinite(e)?e:NaN},minmax:function(r){for(var e=-1/0,t=-1/0,i=0;i<r.length;i++){var n=r[i],a=Math.abs(n);a>e&&(e=a,t=n)}return isFinite(t)?t:NaN},nearest:function(r){return r[0]}},xme=function(r){return Math.round(r.length/2)};function gx(r){return{seriesType:r,reset:function(e,t,i){var n=e.getData(),a=e.get("sampling"),o=e.coordinateSystem,s=n.count();if(s>10&&o.type==="cartesian2d"&&a){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),f=i.getDevicePixelRatio(),h=Math.abs(c[1]-c[0])*(f||1),p=Math.round(s/h);if(isFinite(p)&&p>1){a==="lttb"&&e.setData(n.lttbDownSample(n.mapDimension(u.dim),1/p));var d=void 0;Ce(a)?d=_me[a]:He(a)&&(d=a),d&&e.setData(n.downSample(n.mapDimension(u.dim),1/p,d,xme))}}}}}function tI(r){r.registerChartView(mX),r.registerSeriesModel(nX),r.registerLayout(tl("line",!0)),r.registerVisual({seriesType:"line",reset:function(e){var t=e.getData(),i=e.getModel("lineStyle").getLineStyle();i&&!i.stroke&&(i.stroke=t.getVisual("style").fill),t.setVisual("legendLineStyle",i)}}),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,gx("line"))}var vX=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.getMarkerPosition=function(t,i,n){var a=this.coordinateSystem;if(a&&a.clampData){var o=a.clampData(t),s=a.dataToPoint(o);if(n)N(a.getAxes(),function(h,p){if(h.type==="category"&&i!=null){var d=h.getTicksCoords(),g=h.getTickModel().get("alignWithLabel"),m=o[p],v=i[p]==="x1"||i[p]==="y1";if(v&&!g&&(m+=1),d.length<2)return;if(d.length===2){s[p]=h.toGlobalCoord(h.getExtent()[v?1:0]);return}for(var _=void 0,y=void 0,x=1,M=0;M<d.length;M++){var S=d[M].coord,w=M===d.length-1?d[M-1].tickValue+x:d[M].tickValue;if(w===m){y=S;break}else if(w<m)_=S;else if(_!=null&&w>m){y=(S+_)/2;break}M===1&&(x=w-d[0].tickValue)}y==null&&(_?_&&(y=d[d.length-1].coord):y=d[0].coord),s[p]=h.toGlobalCoord(y)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),f=a.getBaseAxis().isHorizontal()?0:1;s[f]+=u+c/2}return s}return[NaN,NaN]},e.type="series.__base_bar__",e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},e}(jt);jt.registerClass(vX);var Ev=vX;var Sme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(){return hn(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},e.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},e.prototype.getProgressiveThreshold=function(){var t=this.get("progressiveThreshold"),i=this.get("largeThreshold");return i>t&&(t=i),t},e.prototype.brushSelector=function(t,i,n){return n.rect(i.getItemLayout(t))},e.type="series.bar",e.dependencies=["grid","polar"],e.defaultOption=Hn(Ev.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),e}(Ev),gX=Sme;var Mme=function(){function r(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return r}(),bme=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="sausage",i}return e.prototype.getDefaultShape=function(){return new Mme},e.prototype.buildPath=function(t,i){var n=i.cx,a=i.cy,o=Math.max(i.r0||0,0),s=Math.max(i.r,0),l=(s-o)*.5,u=o+l,c=i.startAngle,f=i.endAngle,h=i.clockwise,p=Math.PI*2,d=h?f-c<p:c-f<p;d||(c=f-(h?p:-p));var g=Math.cos(c),m=Math.sin(c),v=Math.cos(f),_=Math.sin(f);d?(t.moveTo(g*o+n,m*o+a),t.arc(g*u+n,m*u+a,l,-Math.PI+c,c,!h)):t.moveTo(g*s+n,m*s+a),t.arc(n,a,s,c,f,!h),t.arc(v*u+n,_*u+a,l,f-Math.PI*2,f-Math.PI,!h),o!==0&&t.arc(n,a,o,f,c,h)},e}(ut),Av=bme;function yX(r,e){e=e||{};var t=e.isRoundCap;return function(i,n,a){var o=n.position;if(!o||o instanceof Array)return _p(i,n,a);var s=r(o),l=n.distance!=null?n.distance:5,u=this.shape,c=u.cx,f=u.cy,h=u.r,p=u.r0,d=(h+p)/2,g=u.startAngle,m=u.endAngle,v=(g+m)/2,_=t?Math.abs(h-p)/2:0,y=Math.cos,x=Math.sin,M=c+h*y(g),S=f+h*x(g),w="left",T="top";switch(s){case"startArc":M=c+(p-l)*y(v),S=f+(p-l)*x(v),w="center",T="top";break;case"insideStartArc":M=c+(p+l)*y(v),S=f+(p+l)*x(v),w="center",T="bottom";break;case"startAngle":M=c+d*y(g)+eT(g,l+_,!1),S=f+d*x(g)+tT(g,l+_,!1),w="right",T="middle";break;case"insideStartAngle":M=c+d*y(g)+eT(g,-l+_,!1),S=f+d*x(g)+tT(g,-l+_,!1),w="left",T="middle";break;case"middle":M=c+d*y(v),S=f+d*x(v),w="center",T="middle";break;case"endArc":M=c+(h+l)*y(v),S=f+(h+l)*x(v),w="center",T="bottom";break;case"insideEndArc":M=c+(h-l)*y(v),S=f+(h-l)*x(v),w="center",T="top";break;case"endAngle":M=c+d*y(m)+eT(m,l+_,!0),S=f+d*x(m)+tT(m,l+_,!0),w="left",T="middle";break;case"insideEndAngle":M=c+d*y(m)+eT(m,-l+_,!0),S=f+d*x(m)+tT(m,-l+_,!0),w="right",T="middle";break;default:return _p(i,n,a)}return i=i||{},i.x=M,i.y=S,i.align=w,i.verticalAlign=T,i}}function _X(r,e,t,i){if(Ct(i)){r.setTextConfig({rotation:i});return}else if(pe(e)){r.setTextConfig({rotation:0});return}var n=r.shape,a=n.clockwise?n.startAngle:n.endAngle,o=n.clockwise?n.endAngle:n.startAngle,s=(a+o)/2,l,u=t(e);switch(u){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":l=s;break;case"startAngle":case"insideStartAngle":l=a;break;case"endAngle":case"insideEndAngle":l=o;break;default:r.setTextConfig({rotation:0});return}var c=Math.PI*1.5-l;u==="middle"&&c>Math.PI/2&&c<Math.PI*1.5&&(c-=Math.PI),r.setTextConfig({rotation:c})}function eT(r,e,t){return e*Math.sin(r)*(t?-1:1)}function tT(r,e,t){return e*Math.cos(r)*(t?1:-1)}function ql(r,e,t){var i=r.get("borderRadius");if(i==null)return t?{cornerRadius:0}:null;pe(i)||(i=[i,i,i,i]);var n=Math.abs(e.r||0-e.r0||0);return{cornerRadius:de(i,function(a){return xn(a,n)})}}var rI=Math.max,iI=Math.min;function wme(r,e){var t=r.getArea&&r.getArea();if(us(r,"cartesian2d")){var i=r.getBaseAxis();if(i.type!=="category"||!i.onBand){var n=e.getLayout("bandWidth");i.isHorizontal()?(t.x-=n,t.width+=n*2):(t.y-=n,t.height+=n*2)}}return t}var Tme=function(r){Z(e,r);function e(){var t=r.call(this)||this;return t.type=e.type,t._isFirstFrame=!0,t}return e.prototype.render=function(t,i,n,a){this._model=t,this._removeOnRenderedListener(n),this._updateDrawMode(t);var o=t.get("coordinateSystem");(o==="cartesian2d"||o==="polar")&&(this._progressiveEls=null,this._isLargeDraw?this._renderLarge(t,i,n):this._renderNormal(t,i,n,a))},e.prototype.incrementalPrepareRender=function(t){this._clear(),this._updateDrawMode(t),this._updateLargeClip(t)},e.prototype.incrementalRender=function(t,i){this._progressiveEls=[],this._incrementalRenderLarge(t,i)},e.prototype.eachRendered=function(t){ca(this._progressiveEls||this.group,t)},e.prototype._updateDrawMode=function(t){var i=t.pipelineContext.large;(this._isLargeDraw==null||i!==this._isLargeDraw)&&(this._isLargeDraw=i,this._clear())},e.prototype._renderNormal=function(t,i,n,a){var o=this.group,s=t.getData(),l=this._data,u=t.coordinateSystem,c=u.getBaseAxis(),f;u.type==="cartesian2d"?f=c.isHorizontal():u.type==="polar"&&(f=c.dim==="angle");var h=t.isAnimationEnabled()?t:null,p=Eme(t,u);p&&this._enableRealtimeSort(p,s,n);var d=t.get("clip",!0)||p,g=wme(u,s);o.removeClipPath();var m=t.get("roundCap",!0),v=t.get("showBackground",!0),_=t.getModel("backgroundStyle"),y=_.get("borderRadius")||0,x=[],M=this._backgroundEls,S=a&&a.isInitSort,w=a&&a.type==="changeAxisOrder";function T(E){var I=rT[u.type](s,E),R=Ime(u,f,I);return R.useStyle(_.getItemStyle()),u.type==="cartesian2d"?R.setShape("r",y):R.setShape("cornerRadius",y),x[E]=R,R}s.diff(l).add(function(E){var I=s.getItemModel(E),R=rT[u.type](s,E,I);if(v&&T(E),!(!s.hasValue(E)||!wX[u.type](R))){var A=!1;d&&(A=xX[u.type](g,R));var D=SX[u.type](t,s,E,R,f,h,c.model,!1,m);p&&(D.forceLabelAnimation=!0),TX(D,s,E,I,R,t,f,u.type==="polar"),S?D.attr({shape:R}):p?MX(p,h,D,R,E,f,!1,!1):or(D,{shape:R},t,E),s.setItemGraphicEl(E,D),o.add(D),D.ignore=A}}).update(function(E,I){var R=s.getItemModel(E),A=rT[u.type](s,E,R);if(v){var D=void 0;M.length===0?D=T(I):(D=M[I],D.useStyle(_.getItemStyle()),u.type==="cartesian2d"?D.setShape("r",y):D.setShape("cornerRadius",y),x[E]=D);var U=rT[u.type](s,E),B=LX(f,U,u);Dt(D,{shape:B},h,E)}var z=l.getItemGraphicEl(I);if(!s.hasValue(E)||!wX[u.type](A)){o.remove(z);return}var k=!1;if(d&&(k=xX[u.type](g,A),k&&o.remove(z)),z?Di(z):z=SX[u.type](t,s,E,A,f,h,c.model,!!z,m),p&&(z.forceLabelAnimation=!0),w){var G=z.getTextContent();if(G){var Y=Pu(G);Y.prevValue!=null&&(Y.prevValue=Y.value)}}else TX(z,s,E,R,A,t,f,u.type==="polar");S?z.attr({shape:A}):p?MX(p,h,z,A,E,f,!0,w):Dt(z,{shape:A},t,E,null),s.setItemGraphicEl(E,z),z.ignore=k,o.add(z)}).remove(function(E){var I=l.getItemGraphicEl(E);I&&Au(I,t,E)}).execute();var C=this._backgroundGroup||(this._backgroundGroup=new Ze);C.removeAll();for(var b=0;b<x.length;++b)C.add(x[b]);o.add(C),this._backgroundEls=x,this._data=s},e.prototype._renderLarge=function(t,i,n){this._clear(),AX(t,this.group),this._updateLargeClip(t)},e.prototype._incrementalRenderLarge=function(t,i){this._removeBackground(),AX(i,this.group,this._progressiveEls,!0)},e.prototype._updateLargeClip=function(t){var i=t.get("clip",!0)&&Yl(t.coordinateSystem,!1,t),n=this.group;i?n.setClipPath(i):n.removeClipPath()},e.prototype._enableRealtimeSort=function(t,i,n){var a=this;if(i.count()){var o=t.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(i,t,n),this._isFirstFrame=!1;else{var s=function(l){var u=i.getItemGraphicEl(l),c=u&&u.shape;return c&&Math.abs(o.isHorizontal()?c.height:c.width)||0};this._onRendered=function(){a._updateSortWithinSameData(i,s,o,n)},n.getZr().on("rendered",this._onRendered)}}},e.prototype._dataSort=function(t,i,n){var a=[];return t.each(t.mapDimension(i.dim),function(o,s){var l=n(s);l=l??NaN,a.push({dataIndex:s,mappedValue:l,ordinalNumber:o})}),a.sort(function(o,s){return s.mappedValue-o.mappedValue}),{ordinalNumbers:de(a,function(o){return o.ordinalNumber})}},e.prototype._isOrderChangedWithinSameData=function(t,i,n){for(var a=n.scale,o=t.mapDimension(n.dim),s=Number.MAX_VALUE,l=0,u=a.getOrdinalMeta().categories.length;l<u;++l){var c=t.rawIndexOf(o,a.getRawOrdinalNumber(l)),f=c<0?Number.MIN_VALUE:i(t.indexOfRawIndex(c));if(f>s)return!0;s=f}return!1},e.prototype._isOrderDifferentInView=function(t,i){for(var n=i.scale,a=n.getExtent(),o=Math.max(0,a[0]),s=Math.min(a[1],n.getOrdinalMeta().categories.length-1);o<=s;++o)if(t.ordinalNumbers[o]!==n.getRawOrdinalNumber(o))return!0},e.prototype._updateSortWithinSameData=function(t,i,n,a){if(this._isOrderChangedWithinSameData(t,i,n)){var o=this._dataSort(t,n,i);this._isOrderDifferentInView(o,n)&&(this._removeOnRenderedListener(a),a.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",axisId:n.index,sortInfo:o}))}},e.prototype._dispatchInitSort=function(t,i,n){var a=i.baseAxis,o=this._dataSort(t,a,function(s){return t.get(t.mapDimension(i.otherAxis.dim),s)});n.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",isInitSort:!0,axisId:a.index,sortInfo:o})},e.prototype.remove=function(t,i){this._clear(this._model),this._removeOnRenderedListener(i)},e.prototype.dispose=function(t,i){this._removeOnRenderedListener(i)},e.prototype._removeOnRenderedListener=function(t){this._onRendered&&(t.getZr().off("rendered",this._onRendered),this._onRendered=null)},e.prototype._clear=function(t){var i=this.group,n=this._data;t&&t.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(a){Au(a,t,rt(a).dataIndex)})):i.removeAll(),this._data=null,this._isFirstFrame=!0},e.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},e.type="bar",e}(Yt),xX={cartesian2d:function(r,e){var t=e.width<0?-1:1,i=e.height<0?-1:1;t<0&&(e.x+=e.width,e.width=-e.width),i<0&&(e.y+=e.height,e.height=-e.height);var n=r.x+r.width,a=r.y+r.height,o=rI(e.x,r.x),s=iI(e.x+e.width,n),l=rI(e.y,r.y),u=iI(e.y+e.height,a),c=s<o,f=u<l;return e.x=c&&o>n?s:o,e.y=f&&l>a?u:l,e.width=c?0:s-o,e.height=f?0:u-l,t<0&&(e.x+=e.width,e.width=-e.width),i<0&&(e.y+=e.height,e.height=-e.height),c||f},polar:function(r,e){var t=e.r0<=e.r?1:-1;if(t<0){var i=e.r;e.r=e.r0,e.r0=i}var n=iI(e.r,r.r),a=rI(e.r0,r.r0);e.r=n,e.r0=a;var o=n-a<0;if(t<0){var i=e.r;e.r=e.r0,e.r0=i}return o}},SX={cartesian2d:function(r,e,t,i,n,a,o,s,l){var u=new Et({shape:fe({},i),z2:1});if(u.__dataIndex=t,u.name="item",a){var c=u.shape,f=n?"height":"width";c[f]=0}return u},polar:function(r,e,t,i,n,a,o,s,l){var u=!n&&l?Av:yi,c=new u({shape:i,z2:1});c.name="item";var f=RX(n);if(c.calculateTextPosition=yX(f,{isRoundCap:u===Av}),a){var h=c.shape,p=n?"r":"endAngle",d={};h[p]=n?i.r0:i.startAngle,d[p]=i[p],(s?Dt:or)(c,{shape:d},a)}return c}};function Eme(r,e){var t=r.get("realtimeSort",!0),i=e.getBaseAxis();if(t&&i.type==="category"&&e.type==="cartesian2d")return{baseAxis:i,otherAxis:e.getOtherAxis(i)}}function MX(r,e,t,i,n,a,o,s){var l,u;a?(u={x:i.x,width:i.width},l={y:i.y,height:i.height}):(u={y:i.y,height:i.height},l={x:i.x,width:i.width}),s||(o?Dt:or)(t,{shape:l},e,n,null);var c=e?r.baseAxis.model:null;(o?Dt:or)(t,{shape:u},c,n)}function bX(r,e){for(var t=0;t<e.length;t++)if(!isFinite(r[e[t]]))return!0;return!1}var Ame=["x","y","width","height"],Cme=["cx","cy","r","startAngle","endAngle"],wX={cartesian2d:function(r){return!bX(r,Ame)},polar:function(r){return!bX(r,Cme)}},rT={cartesian2d:function(r,e,t){var i=r.getItemLayout(e),n=t?Lme(t,i):0,a=i.width>0?1:-1,o=i.height>0?1:-1;return{x:i.x+a*n/2,y:i.y+o*n/2,width:i.width-a*n,height:i.height-o*n}},polar:function(r,e,t){var i=r.getItemLayout(e);return{cx:i.cx,cy:i.cy,r0:i.r0,r:i.r,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}}};function Rme(r){return r.startAngle!=null&&r.endAngle!=null&&r.startAngle===r.endAngle}function RX(r){return function(e){var t=e?"Arc":"Angle";return function(i){switch(i){case"start":case"insideStart":case"end":case"insideEnd":return i+t;default:return i}}}(r)}function TX(r,e,t,i,n,a,o,s){var l=e.getItemVisual(t,"style");if(s){if(!a.get("roundCap")){var c=r.shape,f=ql(i.getModel("itemStyle"),c,!0);fe(c,f),r.setShape(c)}}else{var u=i.get(["itemStyle","borderRadius"])||0;r.setShape("r",u)}r.useStyle(l);var h=i.getShallow("cursor");h&&r.attr("cursor",h);var p=s?o?n.r>=n.r0?"endArc":"startArc":n.endAngle>=n.startAngle?"endAngle":"startAngle":o?n.height>=0?"bottom":"top":n.width>=0?"right":"left",d=wr(i);Ir(r,d,{labelFetcher:a,labelDataIndex:t,defaultText:el(a.getData(),t),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:p});var g=r.getTextContent();if(s&&g){var m=i.get(["label","position"]);r.textConfig.inside=m==="middle"?!0:null,_X(r,m==="outside"?p:m,RX(o),i.get(["label","rotate"]))}yw(g,d,a.getRawValue(t),function(_){return K1(e,_)});var v=i.getModel(["emphasis"]);ar(r,v.get("focus"),v.get("blurScope"),v.get("disabled")),Gr(r,i),Rme(n)&&(r.style.fill="none",r.style.stroke="none",N(r.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function Lme(r,e){var t=r.get(["itemStyle","borderColor"]);if(!t||t==="none")return 0;var i=r.get(["itemStyle","borderWidth"])||0,n=isNaN(e.width)?Number.MAX_VALUE:Math.abs(e.width),a=isNaN(e.height)?Number.MAX_VALUE:Math.abs(e.height);return Math.min(i,n,a)}var Pme=function(){function r(){}return r}(),EX=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="largeBar",i}return e.prototype.getDefaultShape=function(){return new Pme},e.prototype.buildPath=function(t,i){for(var n=i.points,a=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c<n.length;c+=3)l[a]=u,l[o]=n[c+2],s[a]=n[c+a],s[o]=n[c+o],t.rect(s[0],s[1],l[0],l[1])},e}(ut);function AX(r,e,t,i){var n=r.getData(),a=n.getLayout("valueAxisHorizontal")?1:0,o=n.getLayout("largeDataIndices"),s=n.getLayout("size"),l=r.getModel("backgroundStyle"),u=n.getLayout("largeBackgroundPoints");if(u){var c=new EX({shape:{points:u},incremental:!!i,silent:!0,z2:0});c.baseDimIdx=a,c.largeDataIndices=o,c.barWidth=s,c.useStyle(l.getItemStyle()),e.add(c),t&&t.push(c)}var f=new EX({shape:{points:n.getLayout("largePoints")},incremental:!!i,ignoreCoarsePointer:!0,z2:1});f.baseDimIdx=a,f.largeDataIndices=o,f.barWidth=s,e.add(f),f.useStyle(n.getVisual("style")),rt(f).seriesIndex=r.seriesIndex,r.get("silent")||(f.on("mousedown",CX),f.on("mousemove",CX)),t&&t.push(f)}var CX=V_(function(r){var e=this,t=Dme(e,r.offsetX,r.offsetY);rt(e).dataIndex=t>=0?t:null},30,!1);function Dme(r,e,t){for(var i=r.baseDimIdx,n=1-i,a=r.shape.points,o=r.largeDataIndices,s=[],l=[],u=r.barWidth,c=0,f=a.length/3;c<f;c++){var h=c*3;if(l[i]=u,l[n]=a[h+2],s[i]=a[h+i],s[n]=a[h+n],l[n]<0&&(s[n]+=l[n],l[n]=-l[n]),e>=s[0]&&e<=s[0]+l[0]&&t>=s[1]&&t<=s[1]+l[1])return o[c]}return-1}function LX(r,e,t){if(us(t,"cartesian2d")){var i=e,n=t.getArea();return{x:r?i.x:n.x,y:r?n.y:i.y,width:r?i.width:n.width,height:r?n.height:i.height}}else{var n=t.getArea(),a=e;return{cx:n.cx,cy:n.cy,r0:r?n.r0:a.r0,r:r?n.r:a.r,startAngle:r?a.startAngle:0,endAngle:r?a.endAngle:Math.PI*2}}}function Ime(r,e,t){var i=r.type==="polar"?yi:Et;return new i({shape:LX(e,t,r),silent:!0,z2:0})}var PX=Tme;function nI(r){r.registerChartView(PX),r.registerSeriesModel(gX),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ot(b1,"bar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,w1("bar")),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,gx("bar")),r.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(e,t){var i=e.componentType||"series";t.eachComponent({mainType:i,query:e},function(n){e.sortInfo&&n.axis.setCategorySortInfo(e.sortInfo)})})}var DX=Math.PI*2,iT=Math.PI/180;function IX(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function aI(r,e){var t=IX(r,e),i=r.get("center"),n=r.get("radius");pe(n)||(n=[0,n]);var a=ze(t.width,e.getWidth()),o=ze(t.height,e.getHeight()),s=Math.min(a,o),l=ze(n[0],s/2),u=ze(n[1],s/2),c,f,h=r.coordinateSystem;if(h){var p=h.dataToPoint(i);c=p[0]||0,f=p[1]||0}else pe(i)||(i=[i,i]),c=ze(i[0],a)+t.x,f=ze(i[1],o)+t.y;return{cx:c,cy:f,r0:l,r:u}}function oI(r,e,t){e.eachSeriesByType(r,function(i){var n=i.getData(),a=n.mapDimension("value"),o=IX(i,t),s=aI(i,t),l=s.cx,u=s.cy,c=s.r,f=s.r0,h=-i.get("startAngle")*iT,p=i.get("endAngle"),d=i.get("padAngle")*iT;p=p==="auto"?h-DX:-p*iT;var g=i.get("minAngle")*iT,m=g+d,v=0;n.each(a,function(U){!isNaN(U)&&v++});var _=n.getSum(a),y=Math.PI/(_||v)*2,x=i.get("clockwise"),M=i.get("roseType"),S=i.get("stillShowZeroSum"),w=n.getDataExtent(a);w[0]=0;var T=x?1:-1,C=[h,p],b=T*d/2;u_(C,!x),h=C[0],p=C[1];var E=Math.abs(p-h),I=E,R=0,A=h;if(n.setLayout({viewRect:o,r:c}),n.each(a,function(U,B){var z;if(isNaN(U)){n.setItemLayout(B,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:x,cx:l,cy:u,r0:f,r:M?NaN:c});return}M!=="area"?z=_===0&&S?y:U*y:z=E/v,z<m?(z=m,I-=m):R+=U;var k=A+T*z,G=0,Y=0;d>z?(G=A+T*z/2,Y=G):(G=A+b,Y=k-b),n.setItemLayout(B,{angle:z,startAngle:G,endAngle:Y,clockwise:x,cx:l,cy:u,r0:f,r:M?rr(U,w,[f,c]):c}),A=k}),I<DX&&v)if(I<=.001){var D=E/v;n.each(a,function(U,B){if(!isNaN(U)){var z=n.getItemLayout(B);z.angle=D;var k=0,G=0;D<d?(k=h+T*(B+1/2)*D,G=k):(k=h+T*B*D+b,G=h+T*(B+1)*D-b),z.startAngle=k,z.endAngle=G}})}else y=I/R,A=h,n.each(a,function(U,B){if(!isNaN(U)){var z=n.getItemLayout(B),k=z.angle===m?m:U*y,G=0,Y=0;k<d?(G=A+T*k/2,Y=G):(G=A+b,Y=A+T*k-b),z.startAngle=G,z.endAngle=Y,A+=T*k}})})}function rl(r){return{seriesType:r,reset:function(e,t){var i=t.findComponents({mainType:"legend"});if(!(!i||!i.length)){var n=e.getData();n.filterSelf(function(a){for(var o=n.getName(a),s=0;s<i.length;s++)if(!i[s].isSelected(o))return!1;return!0})}}}}var Nme=Math.PI/180;function NX(r,e,t,i,n,a,o,s,l,u){if(r.length<2)return;function c(g){for(var m=g.rB,v=m*m,_=0;_<g.list.length;_++){var y=g.list[_],x=Math.abs(y.label.y-t),M=i+y.len,S=M*M,w=Math.sqrt((1-Math.abs(x*x/v))*S),T=e+(w+y.len2)*n,C=T-y.label.x,b=y.targetTextWidth-C*n;UX(y,b,!0),y.label.x=T}}function f(g){for(var m={list:[],maxY:0},v={list:[],maxY:0},_=0;_<g.length;_++)if(g[_].labelAlignTo==="none"){var y=g[_],x=y.label.y>t?v:m,M=Math.abs(y.label.y-t);if(M>=x.maxY){var S=y.label.x-e-y.len2*n,w=i+y.len,T=Math.abs(S)<w?Math.sqrt(M*M/(1-S*S/w/w)):w;x.rB=T,x.maxY=M}x.list.push(y)}c(m),c(v)}for(var h=r.length,p=0;p<h;p++)if(r[p].position==="outer"&&r[p].labelAlignTo==="labelLine"){var d=r[p].label.x-u;r[p].linePoints[1][0]+=d,r[p].label.x=u}F1(r,l,l+o)&&f(r)}function Ume(r,e,t,i,n,a,o,s){for(var l=[],u=[],c=Number.MAX_VALUE,f=-Number.MAX_VALUE,h=0;h<r.length;h++){var p=r[h].label;sI(r[h])||(p.x<e?(c=Math.min(c,p.x),l.push(r[h])):(f=Math.max(f,p.x),u.push(r[h])))}for(var h=0;h<r.length;h++){var d=r[h];if(!sI(d)&&d.linePoints){if(d.labelStyleWidth!=null)continue;var p=d.label,g=d.linePoints,m=void 0;d.labelAlignTo==="edge"?p.x<e?m=g[2][0]-d.labelDistance-o-d.edgeDistance:m=o+n-d.edgeDistance-g[2][0]-d.labelDistance:d.labelAlignTo==="labelLine"?p.x<e?m=c-o-d.bleedMargin:m=o+n-f-d.bleedMargin:p.x<e?m=p.x-o-d.bleedMargin:m=o+n-p.x-d.bleedMargin,d.targetTextWidth=m,UX(d,m)}}NX(u,e,t,i,1,n,a,o,s,f),NX(l,e,t,i,-1,n,a,o,s,c);for(var h=0;h<r.length;h++){var d=r[h];if(!sI(d)&&d.linePoints){var p=d.label,g=d.linePoints,v=d.labelAlignTo==="edge",_=p.style.padding,y=_?_[1]+_[3]:0,x=p.style.backgroundColor?0:y,M=d.rect.width+x,S=g[1][0]-g[2][0];v?p.x<e?g[2][0]=o+d.edgeDistance+M+d.labelDistance:g[2][0]=o+n-d.edgeDistance-M-d.labelDistance:(p.x<e?g[2][0]=p.x+d.labelDistance:g[2][0]=p.x-d.labelDistance,g[1][0]=g[2][0]+S),g[1][1]=g[2][1]=p.y}}}function UX(r,e,t){if(t===void 0&&(t=!1),r.labelStyleWidth==null){var i=r.label,n=i.style,a=r.rect,o=n.backgroundColor,s=n.padding,l=s?s[1]+s[3]:0,u=n.overflow,c=a.width+(o?0:l);if(e<c||t){var f=a.height;if(u&&u.match("break")){i.setStyle("backgroundColor",null),i.setStyle("width",e-l);var h=i.getBoundingRect();i.setStyle("width",Math.ceil(h.width)),i.setStyle("backgroundColor",o)}else{var p=e-l,d=e<c?p:t?p>r.unconstrainedWidth?null:p:null;i.setStyle("width",d)}var g=i.getBoundingRect();a.width=g.width;var m=(i.style.margin||0)+2.1;a.height=g.height+m,a.y-=(a.height-f)/2}}}function sI(r){return r.position==="center"}function lI(r){var e=r.getData(),t=[],i,n,a=!1,o=(r.get("minShowLabelAngle")||0)*Nme,s=e.getLayout("viewRect"),l=e.getLayout("r"),u=s.width,c=s.x,f=s.y,h=s.height;function p(S){S.ignore=!0}function d(S){if(!S.ignore)return!0;for(var w in S.states)if(S.states[w].ignore===!1)return!0;return!1}e.each(function(S){var w=e.getItemGraphicEl(S),T=w.shape,C=w.getTextContent(),b=w.getTextGuideLine(),E=e.getItemModel(S),I=E.getModel("label"),R=I.get("position")||E.get(["emphasis","label","position"]),A=I.get("distanceToLabelLine"),D=I.get("alignTo"),U=ze(I.get("edgeDistance"),u),B=I.get("bleedMargin"),z=E.getModel("labelLine"),k=z.get("length");k=ze(k,u);var G=z.get("length2");if(G=ze(G,u),Math.abs(T.endAngle-T.startAngle)<o){N(C.states,p),C.ignore=!0,b&&(N(b.states,p),b.ignore=!0);return}if(d(C)){var Y=(T.startAngle+T.endAngle)/2,J=Math.cos(Y),Q=Math.sin(Y),V,K,ae,ve;i=T.cx,n=T.cy;var ue=R==="inside"||R==="inner";if(R==="center")V=T.cx,K=T.cy,ve="center";else{var se=(ue?(T.r+T.r0)/2*J:T.r*J)+i,Ee=(ue?(T.r+T.r0)/2*Q:T.r*Q)+n;if(V=se+J*3,K=Ee+Q*3,!ue){var q=se+J*(k+l-T.r),H=Ee+Q*(k+l-T.r),We=q+(J<0?-1:1)*G,_e=H;D==="edge"?V=J<0?c+U:c+u-U:V=We+(J<0?-A:A),K=_e,ae=[[se,Ee],[q,H],[We,_e]]}ve=ue?"center":D==="edge"?J>0?"right":"left":J>0?"left":"right"}var xe=Math.PI,Le=0,Ue=I.get("rotate");if(Ct(Ue))Le=Ue*(xe/180);else if(R==="center")Le=0;else if(Ue==="radial"||Ue===!0){var Ne=J<0?-Y+xe:-Y;Le=Ne}else if(Ue==="tangential"&&R!=="outside"&&R!=="outer"){var Ve=Math.atan2(J,Q);Ve<0&&(Ve=xe*2+Ve);var ct=Q>0;ct&&(Ve=xe+Ve),Le=Ve-xe}if(a=!!Le,C.x=V,C.y=K,C.rotation=Le,C.setStyle({verticalAlign:"middle"}),ue){C.setStyle({align:ve});var ne=C.states.select;ne&&(ne.x+=C.x,ne.y+=C.y)}else{var F=C.getBoundingRect().clone();F.applyTransform(C.getComputedTransform());var L=(C.style.margin||0)+2.1;F.y-=L/2,F.height+=L,t.push({label:C,labelLine:b,position:R,len:k,len2:G,minTurnAngle:z.get("minTurnAngle"),maxSurfaceAngle:z.get("maxSurfaceAngle"),surfaceNormal:new Nt(J,Q),linePoints:ae,textAlign:ve,labelDistance:A,labelAlignTo:D,edgeDistance:U,bleedMargin:B,rect:F,unconstrainedWidth:F.width,labelStyleWidth:C.style.width})}w.setTextConfig({inside:ue})}}),!a&&r.get("avoidLabelOverlap")&&Ume(t,i,n,l,u,h,c,f);for(var g=0;g<t.length;g++){var m=t[g],v=m.label,_=m.labelLine,y=isNaN(v.x)||isNaN(v.y);if(v){v.setStyle({align:m.textAlign}),y&&(N(v.states,p),v.ignore=!0);var x=v.states.select;x&&(x.x+=v.x,x.y+=v.y)}if(_){var M=m.linePoints;y||!M?(N(_.states,p),_.ignore=!0):(b2(M,m.minTurnAngle),R8(M,m.surfaceNormal,m.maxSurfaceAngle),_.setShape({points:M}),v.__hostTarget.textGuideLineConfig={anchor:new Nt(M[0][0],M[0][1])})}}}var Ome=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;a.z2=2;var o=new Lt;return a.setTextContent(o),a.updateData(t,i,n,!0),a}return e.prototype.updateData=function(t,i,n,a){var o=this,s=t.hostModel,l=t.getItemModel(i),u=l.getModel("emphasis"),c=t.getItemLayout(i),f=fe(ql(l.getModel("itemStyle"),c,!0),c);if(isNaN(f.startAngle)){o.setShape(f);return}if(a){o.setShape(f);var h=s.getShallow("animationType");s.ecModel.ssr?(or(o,{scaleX:0,scaleY:0},s,{dataIndex:i,isFrom:!0}),o.originX=f.cx,o.originY=f.cy):h==="scale"?(o.shape.r=c.r0,or(o,{shape:{r:c.r}},s,i)):n!=null?(o.setShape({startAngle:n,endAngle:n}),or(o,{shape:{startAngle:c.startAngle,endAngle:c.endAngle}},s,i)):(o.shape.endAngle=c.startAngle,Dt(o,{shape:{endAngle:c.endAngle}},s,i))}else Di(o),Dt(o,{shape:f},s,i);o.useStyle(t.getItemVisual(i,"style")),Gr(o,l);var p=(c.startAngle+c.endAngle)/2,d=s.get("selectedOffset"),g=Math.cos(p)*d,m=Math.sin(p)*d,v=l.getShallow("cursor");v&&o.attr("cursor",v),this._updateLabel(s,t,i),o.ensureState("emphasis").shape=fe({r:c.r+(u.get("scale")&&u.get("scaleSize")||0)},ql(u.getModel("itemStyle"),c)),fe(o.ensureState("select"),{x:g,y:m,shape:ql(l.getModel(["select","itemStyle"]),c)}),fe(o.ensureState("blur"),{shape:ql(l.getModel(["blur","itemStyle"]),c)});var _=o.getTextGuideLine(),y=o.getTextContent();_&&fe(_.ensureState("select"),{x:g,y:m}),fe(y.ensureState("select"),{x:g,y:m}),ar(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t,i,n){var a=this,o=i.getItemModel(n),s=o.getModel("labelLine"),l=i.getItemVisual(n,"style"),u=l&&l.fill,c=l&&l.opacity;Ir(a,wr(o),{labelFetcher:i.hostModel,labelDataIndex:n,inheritColor:u,defaultOpacity:c,defaultText:t.getFormattedLabel(n,"normal")||i.getName(n)});var f=a.getTextContent();a.setTextConfig({position:null,rotation:null}),f.attr({z2:10});var h=t.get(["label","position"]);if(h!=="outside"&&h!=="outer")a.removeTextGuideLine();else{var p=this.getTextGuideLine();p||(p=new Qr,this.setTextGuideLine(p)),bv(this,wv(o),{stroke:u,opacity:Xi(s.get(["lineStyle","opacity"]),c,1)})}},e}(yi),zme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.ignoreLabelLineUpdate=!0,t}return e.prototype.render=function(t,i,n,a){var o=t.getData(),s=this._data,l=this.group,u;if(!s&&o.count()>0){for(var c=o.getItemLayout(0),f=1;isNaN(c&&c.startAngle)&&f<o.count();++f)c=o.getItemLayout(f);c&&(u=c.startAngle)}if(this._emptyCircleSector&&l.remove(this._emptyCircleSector),o.count()===0&&t.get("showEmptyCircle")){var h=new yi({shape:aI(t,n)});h.useStyle(t.getModel("emptyCircleStyle").getItemStyle()),this._emptyCircleSector=h,l.add(h)}o.diff(s).add(function(p){var d=new Ome(o,p,u);o.setItemGraphicEl(p,d),l.add(d)}).update(function(p,d){var g=s.getItemGraphicEl(d);g.updateData(o,p,u),g.off("click"),l.add(g),o.setItemGraphicEl(p,g)}).remove(function(p){var d=s.getItemGraphicEl(p);Au(d,t,p)}).execute(),lI(t),t.get("animationTypeUpdate")!=="expansion"&&(this._data=o)},e.prototype.dispose=function(){},e.prototype.containPoint=function(t,i){var n=i.getData(),a=n.getItemLayout(0);if(a){var o=t[0]-a.cx,s=t[1]-a.cy,l=Math.sqrt(o*o+s*s);return l<=a.r&&l>=a.r0}},e.type="pie",e}(Yt),OX=zme;function To(r,e,t){e=pe(e)&&{coordDimensions:e}||fe({encodeDefine:r.getEncode()},e);var i=r.getSource(),n=Ks(i,e).dimensions,a=new ri(n,r);return a.initData(i,t),a}var Fme=function(){function r(e,t){this._getDataWithEncodedVisual=e,this._getRawData=t}return r.prototype.getAllNames=function(){var e=this._getRawData();return e.mapArray(e.getName)},r.prototype.containName=function(e){var t=this._getRawData();return t.indexOfName(e)>=0},r.prototype.indexOfName=function(e){var t=this._getDataWithEncodedVisual();return t.indexOfName(e)},r.prototype.getItemVisual=function(e,t){var i=this._getDataWithEncodedVisual();return i.getItemVisual(e,t)},r}(),Zl=Fme;var Bme=vt(),kme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new Zl(Be(this.getData,this),Be(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.mergeOption=function(){r.prototype.mergeOption.apply(this,arguments)},e.prototype.getInitialData=function(){return To(this,{coordDimensions:["value"],encodeDefaulter:ot(fv,this)})},e.prototype.getDataParams=function(t){var i=this.getData(),n=Bme(i),a=n.seats;if(!a){var o=[];i.each(i.mapDimension("value"),function(l){o.push(l)}),a=n.seats=KL(o,i.hostModel.get("percentPrecision"))}var s=r.prototype.getDataParams.call(this,t);return s.percent=a[t]||0,s.$vars.push("percent"),s},e.prototype._defaultLabelLine=function(t){yo(t,"labelLine",["show"]);var i=t.labelLine,n=t.emphasis.labelLine;i.show=i.show&&t.label.show,n.show=n.show&&t.emphasis.label.show},e.type="series.pie",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",bleedMargin:10,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:15,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},e}(jt),zX=kme;function uI(r){return{seriesType:r,reset:function(e,t){var i=e.getData();i.filterSelf(function(n){var a=i.mapDimension("value"),o=i.get(a,n);return!(Ct(o)&&!isNaN(o)&&o<0)})}}}function cI(r){r.registerChartView(OX),r.registerSeriesModel(zX),n1("pie",r.registerAction),r.registerLayout(ot(oI,"pie")),r.registerProcessor(rl("pie")),r.registerProcessor(uI("pie"))}var Vme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return t??(this.option.large?5e3:this.get("progressive"))},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return t??(this.option.large?1e4:this.get("progressiveThreshold"))},e.prototype.brushSelector=function(t,i,n){return n.point(i.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(jt),FX=Vme;var BX=4,Gme=function(){function r(){}return r}(),Hme=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i._off=0,i.hoverDataIdx=-1,i}return e.prototype.getDefaultShape=function(){return new Gme},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,i){var n=i.points,a=i.size,o=this.symbolProxy,s=o.shape,l=t.getContext?t.getContext():t,u=l&&a[0]<BX,c=this.softClipShape,f;if(u){this._ctx=l;return}for(this._ctx=null,f=this._off;f<n.length;){var h=n[f++],p=n[f++];isNaN(h)||isNaN(p)||c&&!c.contain(h,p)||(s.x=h-a[0]/2,s.y=p-a[1]/2,s.width=a[0],s.height=a[1],o.buildPath(t,s,!0))}this.incremental&&(this._off=f,this.notClear=!0)},e.prototype.afterBrush=function(){var t=this.shape,i=t.points,n=t.size,a=this._ctx,o=this.softClipShape,s;if(a){for(s=this._off;s<i.length;){var l=i[s++],u=i[s++];isNaN(l)||isNaN(u)||o&&!o.contain(l,u)||a.fillRect(l-n[0]/2,u-n[1]/2,n[0],n[1])}this.incremental&&(this._off=s,this.notClear=!0)}},e.prototype.findDataIndex=function(t,i){for(var n=this.shape,a=n.points,o=n.size,s=Math.max(o[0],4),l=Math.max(o[1],4),u=a.length/2-1;u>=0;u--){var c=u*2,f=a[c]-s/2,h=a[c+1]-l/2;if(t>=f&&i>=h&&t<=f+s&&i<=h+l)return u}return-1},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();if(t=n[0],i=n[1],a.contain(t,i)){var o=this.hoverDataIdx=this.findDataIndex(t,i);return o>=0}return this.hoverDataIdx=-1,!1},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var i=this.shape,n=i.points,a=i.size,o=a[0],s=a[1],l=1/0,u=1/0,c=-1/0,f=-1/0,h=0;h<n.length;){var p=n[h++],d=n[h++];l=Math.min(p,l),c=Math.max(p,c),u=Math.min(d,u),f=Math.max(d,f)}t=this._rect=new lt(l-o/2,u-s/2,c-l+o,f-u+s)}return t},e}(ut),Wme=function(){function r(){this.group=new Ze}return r.prototype.updateData=function(e,t){this._clear();var i=this._create();i.setShape({points:e.getLayout("points")}),this._setCommon(i,e,t)},r.prototype.updateLayout=function(e){var t=e.getLayout("points");this.group.eachChild(function(i){if(i.startIndex!=null){var n=(i.endIndex-i.startIndex)*2,a=i.startIndex*4*2;t=new Float32Array(t.buffer,a,n)}i.setShape("points",t),i.reset()})},r.prototype.incrementalPrepareUpdate=function(e){this._clear()},r.prototype.incrementalUpdate=function(e,t,i){var n=this._newAdded[0],a=t.getLayout("points"),o=n&&n.shape.points;if(o&&o.length<2e4){var s=o.length,l=new Float32Array(s+a.length);l.set(o),l.set(a,s),n.endIndex=e.end,n.setShape({points:l})}else{this._newAdded=[];var u=this._create();u.startIndex=e.start,u.endIndex=e.end,u.incremental=!0,u.setShape({points:a}),this._setCommon(u,t,i)}},r.prototype.eachRendered=function(e){this._newAdded[0]&&e(this._newAdded[0])},r.prototype._create=function(){var e=new Hme({cursor:"default"});return e.ignoreCoarsePointer=!0,this.group.add(e),this._newAdded.push(e),e},r.prototype._setCommon=function(e,t,i){var n=t.hostModel;i=i||{};var a=t.getVisual("symbolSize");e.setShape("size",a instanceof Array?a:[a,a]),e.softClipShape=i.clipShape||null,e.symbolProxy=Sr(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor;var o=e.shape.size[0]<BX;e.useStyle(n.getModel("itemStyle").getItemStyle(o?["color","shadowBlur","shadowColor"]:["color"]));var s=t.getVisual("style"),l=s&&s.fill;l&&e.setColor(l);var u=rt(e);u.seriesIndex=n.seriesIndex,e.on("mousemove",function(c){u.dataIndex=null;var f=e.hoverDataIdx;f>=0&&(u.dataIndex=f+(e.startIndex||0))})},r.prototype.remove=function(){this._clear()},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),kX=Wme;var Xme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this._updateSymbolDraw(a,t);o.updateData(a,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,i,n){var a=t.getData(),o=this._updateSymbolDraw(a,t);o.incrementalPrepareUpdate(a),this._finished=!1},e.prototype.incrementalRender=function(t,i,n){this._symbolDraw.incrementalUpdate(t,i.getData(),{clipShape:this._getClipShape(i)}),this._finished=t.end===i.getData().count()},e.prototype.updateTransform=function(t,i,n){var a=t.getData();if(this.group.dirty(),!this._finished||a.count()>1e4)return{update:!0};var o=tl("").reset(t,i,n);o.progress&&o.progress({start:0,end:a.count(),count:a.count()},a),this._symbolDraw.updateLayout(a)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){if(t.get("clip",!0)){var i=t.coordinateSystem;return i&&i.getArea&&i.getArea(.1)}},e.prototype._updateSymbolDraw=function(t,i){var n=this._symbolDraw,a=i.pipelineContext,o=a.large;return(!n||o!==this._isLargeDraw)&&(n&&n.remove(),n=this._symbolDraw=o?new kX:new Xl,this._isLargeDraw=o,this.group.removeAll()),this.group.add(n.group),n},e.prototype.remove=function(t,i){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(Yt),VX=Xme;var Yme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Pt),GX=Yme;var nT=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Ar).models[0]},e.type="cartesian2dAxis",e}(Pt);br(nT,Vl);var HX={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},qme=_t({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},HX),fI=_t({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},HX),Zme=_t({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},fI),jme=Ye({logBase:10},fI),aT={category:qme,value:fI,time:Zme,log:jme};var WX={value:1,category:1,time:1,log:1};function il(r,e,t,i){N(WX,function(n,a){var o=_t(_t({},aT[a],!0),i,!0),s=function(l){Z(u,l);function u(){var c=l!==null&&l.apply(this,arguments)||this;return c.type=e+"Axis."+a,c}return u.prototype.mergeDefaultAndTheme=function(c,f){var h=Rf(this),p=h?is(c):{},d=f.getTheme();_t(c,d.get(a+"Axis")),_t(c,this.getDefaultOption()),c.type=XX(c),h&&Va(c,p,h)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=ix.createByAxisModel(this))},u.prototype.getCategories=function(c){var f=this.option;if(f.type==="category")return c?f.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.type=e+"Axis."+a,u.defaultOption=o,u}(t);r.registerComponentModel(s)}),r.registerSubTypeDefaulter(e+"Axis",XX)}function XX(r){return r.type||(r.data?"category":"value")}var Kme=function(){function r(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return r.prototype.getAxis=function(e){return this._axes[e]},r.prototype.getAxes=function(){return de(this._dimList,function(e){return this._axes[e]},this)},r.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Wt(this.getAxes(),function(t){return t.scale.type===e})},r.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},r}(),YX=Kme;var oT=["x","y"];function qX(r){return r.type==="interval"||r.type==="time"}var Jme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=oT,t}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,i=this.getAxis("y").scale;if(!(!qX(t)||!qX(i))){var n=t.getExtent(),a=i.getExtent(),o=this.dataToPoint([n[0],a[0]]),s=this.dataToPoint([n[1],a[1]]),l=n[1]-n[0],u=a[1]-a[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,f=(s[1]-o[1])/u,h=o[0]-n[0]*c,p=o[1]-a[0]*f,d=this._transform=[c,0,0,f,h,p];this._invTransform=qo([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var i=this.getAxis("x"),n=this.getAxis("y");return i.contain(i.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,i){var n=this.dataToPoint(t),a=this.dataToPoint(i),o=this.getArea(),s=new lt(n[0],n[1],a[0]-n[0],a[1]-n[1]);return o.intersect(s)},e.prototype.dataToPoint=function(t,i,n){n=n||[];var a=t[0],o=t[1];if(this._transform&&a!=null&&isFinite(a)&&o!=null&&isFinite(o))return fi(n,t,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return n[0]=s.toGlobalCoord(s.dataToCoord(a,i)),n[1]=l.toGlobalCoord(l.dataToCoord(o,i)),n},e.prototype.clampData=function(t,i){var n=this.getAxis("x").scale,a=this.getAxis("y").scale,o=n.getExtent(),s=a.getExtent(),l=n.parse(t[0]),u=a.parse(t[1]);return i=i||[],i[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),i[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),i},e.prototype.pointToData=function(t,i){var n=[];if(this._invTransform)return fi(n,t,this._invTransform);var a=this.getAxis("x"),o=this.getAxis("y");return n[0]=a.coordToData(a.toLocalCoord(t[0]),i),n[1]=o.coordToData(o.toLocalCoord(t[1]),i),n},e.prototype.getOtherAxis=function(t){return this.getAxis(t.dim==="x"?"y":"x")},e.prototype.getArea=function(t){t=t||0;var i=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),a=Math.min(i[0],i[1])-t,o=Math.min(n[0],n[1])-t,s=Math.max(i[0],i[1])-a+t,l=Math.max(n[0],n[1])-o+t;return new lt(a,o,s,l)},e}(YX),ZX=Jme;var $me=function(r){Z(e,r);function e(t,i,n,a,o){var s=r.call(this,t,i,n)||this;return s.index=0,s.type=a||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var t=this.position;return t==="top"||t==="bottom"},e.prototype.getGlobalExtent=function(t){var i=this.getExtent();return i[0]=this.toGlobalCoord(i[0]),i[1]=this.toGlobalCoord(i[1]),t&&i[0]>i[1]&&i.reverse(),i},e.prototype.pointToData=function(t,i){return this.coordToData(this.toLocalCoord(t[this.dim==="x"?0:1]),i)},e.prototype.setCategorySortInfo=function(t){if(this.type!=="category")return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(pn),jX=$me;function yx(r,e,t){t=t||{};var i=r.coordinateSystem,n=e.axis,a={},o=n.getAxesOnZeroOf()[0],s=n.position,l=o?"onZero":s,u=n.dim,c=i.getRect(),f=[c.x,c.x+c.width,c.y,c.y+c.height],h={left:0,right:1,top:0,bottom:1,onZero:2},p=e.get("offset")||0,d=u==="x"?[f[2]-p,f[3]+p]:[f[0]-p,f[1]+p];if(o){var g=o.toGlobalCoord(o.dataToCoord(0));d[h.onZero]=Math.max(Math.min(g,d[1]),d[0])}a.position=[u==="y"?d[h[l]]:f[0],u==="x"?d[h[l]]:f[3]],a.rotation=Math.PI/2*(u==="x"?0:1);var m={top:-1,bottom:1,left:-1,right:1};a.labelDirection=a.tickDirection=a.nameDirection=m[s],a.labelOffset=o?d[h[s]]-d[h.onZero]:0,e.get(["axisTick","inside"])&&(a.tickDirection=-a.tickDirection),Br(t.labelInside,e.get(["axisLabel","inside"]))&&(a.labelDirection=-a.labelDirection);var v=e.get(["axisLabel","rotate"]);return a.labelRotate=l==="top"?-v:v,a.z2=1,a}function hI(r){return r.get("coordinateSystem")==="cartesian2d"}function pI(r){var e={xAxisModel:null,yAxisModel:null};return N(e,function(t,i){var n=i.replace(/Model$/,""),a=r.getReferringComponents(n,Ar).models[0];e[i]=a}),e}var dI=Math.log;function sT(r,e,t){var i=Ya.prototype,n=i.getTicks.call(t),a=i.getTicks.call(t,!0),o=n.length-1,s=i.getInterval.call(t),l=m2(r,e),u=l.extent,c=l.fixMin,f=l.fixMax;if(r.type==="log"){var h=dI(r.base);u=[dI(u[0])/h,dI(u[1])/h]}r.setExtent(u[0],u[1]),r.calcNiceExtent({splitNumber:o,fixMin:c,fixMax:f});var p=i.getExtent.call(r);c&&(u[0]=p[0]),f&&(u[1]=p[1]);var d=i.getInterval.call(r),g=u[0],m=u[1];if(c&&f)d=(m-g)/o;else if(c)for(m=u[0]+d*o;m<u[1]&&isFinite(m)&&isFinite(u[1]);)d=S1(d),m=u[0]+d*o;else if(f)for(g=u[1]-d*o;g>u[0]&&isFinite(g)&&isFinite(u[0]);)d=S1(d),g=u[1]-d*o;else{var v=r.getTicks().length-1;v>o&&(d=S1(d));var _=d*o;m=Math.ceil(u[1]/d)*d,g=Er(m-_),g<0&&u[0]>=0?(g=0,m=Er(_)):m>0&&u[1]<=0&&(m=0,g=-Er(_))}var y=(n[0].value-a[0].value)/s,x=(n[o].value-a[o].value)/s;if(i.setExtent.call(r,g+d*y,m+d*x),i.setInterval.call(r,d),(y||x)&&i.setNiceExtent.call(r,g+d,m-d),0)var M}var Qme=function(){function r(e,t,i){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=oT,this._initCartesian(e,t,i),this.model=e}return r.prototype.getRect=function(){return this._rect},r.prototype.update=function(e,t){var i=this._axesMap;this._updateScale(e,this.model);function n(o){var s,l=bt(o),u=l.length;if(u){for(var c=[],f=u-1;f>=0;f--){var h=+l[f],p=o[h],d=p.model,g=p.scale;nx(g)&&d.get("alignTicks")&&d.get("interval")==null?c.push(p):(kl(g,d),nx(g)&&(s=p))}c.length&&(s||(s=c.pop(),kl(s.scale,s.model)),N(c,function(m){sT(m.scale,m.model,s.scale)}))}}n(i.x),n(i.y);var a={};N(i.x,function(o){JX(i,"y",o,a)}),N(i.y,function(o){JX(i,"x",o,a)}),this.resize(this.model,t)},r.prototype.resize=function(e,t,i){var n=e.getBoxLayoutParams(),a=!i&&e.get("containLabel"),o=xr(n,{width:t.getWidth(),height:t.getHeight()});this._rect=o;var s=this._axesList;l(),a&&(N(s,function(u){if(!u.model.get(["axisLabel","inside"])){var c=u8(u);if(c){var f=u.isHorizontal()?"height":"width",h=u.model.get(["axisLabel","margin"]);o[f]-=c[f]+h,u.position==="top"?o.y+=c.height+h:u.position==="left"&&(o.x+=c.width+h)}}}),l()),N(this._coordsList,function(u){u.calcAffineTransform()});function l(){N(s,function(u){var c=u.isHorizontal(),f=c?[0,o.width]:[0,o.height],h=u.inverse?1:0;u.setExtent(f[h],f[1-h]),eve(u,c?o.x:o.y)})}},r.prototype.getAxis=function(e,t){var i=this._axesMap[e];if(i!=null)return i[t||0]},r.prototype.getAxes=function(){return this._axesList.slice()},r.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var i="x"+e+"y"+t;return this._coordsMap[i]}qe(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var n=0,a=this._coordsList;n<a.length;n++)if(a[n].getAxis("x").index===e||a[n].getAxis("y").index===t)return a[n]},r.prototype.getCartesians=function(){return this._coordsList.slice()},r.prototype.convertToPixel=function(e,t,i){var n=this._findConvertTarget(t);return n.cartesian?n.cartesian.dataToPoint(i):n.axis?n.axis.toGlobalCoord(n.axis.dataToCoord(i)):null},r.prototype.convertFromPixel=function(e,t,i){var n=this._findConvertTarget(t);return n.cartesian?n.cartesian.pointToData(i):n.axis?n.axis.coordToData(n.axis.toLocalCoord(i)):null},r.prototype._findConvertTarget=function(e){var t=e.seriesModel,i=e.xAxisModel||t&&t.getReferringComponents("xAxis",Ar).models[0],n=e.yAxisModel||t&&t.getReferringComponents("yAxis",Ar).models[0],a=e.gridModel,o=this._coordsList,s,l;if(t)s=t.coordinateSystem,dt(o,s)<0&&(s=null);else if(i&&n)s=this.getCartesian(i.componentIndex,n.componentIndex);else if(i)l=this.getAxis("x",i.componentIndex);else if(n)l=this.getAxis("y",n.componentIndex);else if(a){var u=a.coordinateSystem;u===this&&(s=this._coordsList[0])}return{cartesian:s,axis:l}},r.prototype.containPoint=function(e){var t=this._coordsList[0];if(t)return t.containPoint(e)},r.prototype._initCartesian=function(e,t,i){var n=this,a=this,o={left:!1,right:!1,top:!1,bottom:!1},s={x:{},y:{}},l={x:0,y:0};if(t.eachComponent("xAxis",u("x"),this),t.eachComponent("yAxis",u("y"),this),!l.x||!l.y){this._axesMap={},this._axesList=[];return}this._axesMap=s,N(s.x,function(c,f){N(s.y,function(h,p){var d="x"+f+"y"+p,g=new ZX(d);g.master=n,g.model=e,n._coordsMap[d]=g,n._coordsList.push(g),g.addAxis(c),g.addAxis(h)})});function u(c){return function(f,h){if(mI(f,e)){var p=f.get("position");c==="x"?p!=="top"&&p!=="bottom"&&(p=o.bottom?"top":"bottom"):p!=="left"&&p!=="right"&&(p=o.left?"right":"left"),o[p]=!0;var d=new jX(c,kf(f),[0,0],f.get("type"),p),g=d.type==="category";d.onBand=g&&f.get("boundaryGap"),d.inverse=f.get("inverse"),f.axis=d,d.model=f,d.grid=a,d.index=h,a._axesList.push(d),s[c][h]=d,l[c]++}}}},r.prototype._updateScale=function(e,t){N(this._axesList,function(n){if(n.scale.setExtent(1/0,-1/0),n.type==="category"){var a=n.model.get("categorySortInfo");n.scale.setSortInfo(a)}}),e.eachSeries(function(n){if(hI(n)){var a=pI(n),o=a.xAxisModel,s=a.yAxisModel;if(!mI(o,t)||!mI(s,t))return;var l=this.getCartesian(o.componentIndex,s.componentIndex),u=n.getData(),c=l.getAxis("x"),f=l.getAxis("y");i(u,c),i(u,f)}},this);function i(n,a){N(Sv(n,a.dim),function(o){a.scale.unionExtentFromData(n,o)})}},r.prototype.getTooltipAxes=function(e){var t=[],i=[];return N(this.getCartesians(),function(n){var a=e!=null&&e!=="auto"?n.getAxis(e):n.getBaseAxis(),o=n.getOtherAxis(a);dt(t,a)<0&&t.push(a),dt(i,o)<0&&i.push(o)}),{baseAxes:t,otherAxes:i}},r.create=function(e,t){var i=[];return e.eachComponent("grid",function(n,a){var o=new r(n,e,t);o.name="grid_"+a,o.resize(n,t,!0),n.coordinateSystem=o,i.push(o)}),e.eachSeries(function(n){if(hI(n)){var a=pI(n),o=a.xAxisModel,s=a.yAxisModel,l=o.getCoordSysModel(),u=l.coordinateSystem;n.coordinateSystem=u.getCartesian(o.componentIndex,s.componentIndex)}}),i},r.dimensions=oT,r}();function mI(r,e){return r.getCoordSysModel()===e}function JX(r,e,t,i){t.getAxesOnZeroOf=function(){return a?[a]:[]};var n=r[e],a,o=t.model,s=o.get(["axisLine","onZero"]),l=o.get(["axisLine","onZeroAxisIndex"]);if(!s)return;if(l!=null)$X(n[l])&&(a=n[l]);else for(var u in n)if(n.hasOwnProperty(u)&&$X(n[u])&&!i[c(n[u])]){a=n[u];break}a&&(i[c(a)]=!0);function c(f){return f.dim+"_"+f.index}}function $X(r){return r&&r.type!=="category"&&r.type!=="time"&&l8(r)}function eve(r,e){var t=r.getExtent(),i=t[0]+t[1];r.toGlobalCoord=r.dim==="x"?function(n){return n+e}:function(n){return i-n+e},r.toLocalCoord=r.dim==="x"?function(n){return n-e}:function(n){return i-n+e}}var QX=Qme;var Xf=Math.PI,td=function(){function r(e,t){this.group=new Ze,this.opt=t,this.axisModel=e,Ye(t,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var i=new Ze({x:t.position[0],y:t.position[1],rotation:t.rotation});i.updateTransform(),this._transformGroup=i}return r.prototype.hasBuilder=function(e){return!!e9[e]},r.prototype.add=function(e){e9[e](this.opt,this.axisModel,this.group,this._transformGroup)},r.prototype.getGroup=function(){return this.group},r.innerTextLayout=function(e,t,i){var n=r_(t-e),a,o;return xu(n)?(o=i>0?"top":"bottom",a="center"):xu(n-Xf)?(o=i>0?"bottom":"top",a="center"):(o="middle",n>0&&n<Xf?a=i>0?"right":"left":a=i>0?"left":"right"),{rotation:n,textAlign:a,textVerticalAlign:o}},r.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+"Index"]=e.componentIndex,t},r.isLabelSilent=function(e){var t=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||t&&t.show)},r}(),e9={axisLine:function(r,e,t,i){var n=e.get(["axisLine","show"]);if(n==="auto"&&r.handleAutoShown&&(n=r.handleAutoShown("axisLine")),!!n){var a=e.axis.getExtent(),o=i.transform,s=[a[0],0],l=[a[1],0],u=s[0]>l[0];o&&(fi(s,s,o),fi(l,l,o));var c=fe({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),f=new Jr({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:r.strokeContainThreshold||5,silent:!0,z2:1});Cu(f.shape,f.style.lineWidth),f.anid="line",t.add(f);var h=e.get(["axisLine","symbol"]);if(h!=null){var p=e.get(["axisLine","symbolSize"]);Ce(h)&&(h=[h,h]),(Ce(p)||Ct(p))&&(p=[p,p]);var d=bo(e.get(["axisLine","symbolOffset"])||0,p),g=p[0],m=p[1];N([{rotate:r.rotation+Math.PI/2,offset:d[0],r:0},{rotate:r.rotation-Math.PI/2,offset:d[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(v,_){if(h[_]!=="none"&&h[_]!=null){var y=Sr(h[_],-g/2,-m/2,g,m,c.stroke,!0),x=v.r+v.offset,M=u?l:s;y.attr({rotation:v.rotate,x:M[0]+x*Math.cos(r.rotation),y:M[1]-x*Math.sin(r.rotation),silent:!0,z2:11}),t.add(y)}})}}},axisTickLabel:function(r,e,t,i){var n=ive(t,i,e,r),a=ave(t,i,e,r);if(rve(e,a,n),nve(t,i,e,r.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=z1(de(a,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));B1(o)}},axisName:function(r,e,t,i){var n=Br(r.axisName,e.get("name"));if(n){var a=e.get("nameLocation"),o=r.nameDirection,s=e.getModel("nameTextStyle"),l=e.get("nameGap")||0,u=e.axis.getExtent(),c=u[0]>u[1]?-1:1,f=[a==="start"?u[0]-c*l:a==="end"?u[1]+c*l:(u[0]+u[1])/2,r9(a)?r.labelOffset+o*l:0],h,p=e.get("nameRotate");p!=null&&(p=p*Xf/180);var d;r9(a)?h=td.innerTextLayout(r.rotation,p??r.rotation,o):(h=tve(r.rotation,a,p||0,u),d=r.axisNameAvailableWidth,d!=null&&(d=Math.abs(d/Math.sin(h.rotation)),!isFinite(d)&&(d=null)));var g=s.getFont(),m=e.get("nameTruncate",!0)||{},v=m.ellipsis,_=Br(r.nameTruncateMaxWidth,m.maxWidth,d),y=new Lt({x:f[0],y:f[1],rotation:h.rotation,silent:td.isLabelSilent(e),style:fr(s,{text:n,font:g,overflow:"truncate",width:_,ellipsis:v,fill:s.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:s.get("align")||h.textAlign,verticalAlign:s.get("verticalAlign")||h.textVerticalAlign}),z2:1});if(Gs({el:y,componentModel:e,itemName:n}),y.__fullText=n,y.anid="name",e.get("triggerEvent")){var x=td.makeAxisEventDataBase(e);x.targetType="axisName",x.name=n,rt(y).eventData=x}i.add(y),y.updateTransform(),t.add(y),y.decomposeTransform()}}};function tve(r,e,t,i){var n=r_(t-r),a,o,s=i[0]>i[1],l=e==="start"&&!s||e!=="start"&&s;return xu(n-Xf/2)?(o=l?"bottom":"top",a="center"):xu(n-Xf*1.5)?(o=l?"top":"bottom",a="center"):(o="middle",n<Xf*1.5&&n>Xf/2?a=l?"left":"right":a=l?"right":"left"),{rotation:n,textAlign:a,textVerticalAlign:o}}function rve(r,e,t){if(!D1(r.axis)){var i=r.get(["axisLabel","showMinLabel"]),n=r.get(["axisLabel","showMaxLabel"]);e=e||[],t=t||[];var a=e[0],o=e[1],s=e[e.length-1],l=e[e.length-2],u=t[0],c=t[1],f=t[t.length-1],h=t[t.length-2];i===!1?(cs(a),cs(u)):t9(a,o)&&(i?(cs(o),cs(c)):(cs(a),cs(u))),n===!1?(cs(s),cs(f)):t9(l,s)&&(n?(cs(l),cs(h)):(cs(s),cs(f)))}}function cs(r){r&&(r.ignore=!0)}function t9(r,e){var t=r&&r.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(!(!t||!i)){var n=ff([]);return Pa(n,n,-r.rotation),t.applyTransform(La([],n,r.getLocalTransform())),i.applyTransform(La([],n,e.getLocalTransform())),t.intersect(i)}}function r9(r){return r==="middle"||r==="center"}function i9(r,e,t,i,n){for(var a=[],o=[],s=[],l=0;l<r.length;l++){var u=r[l].coord;o[0]=u,o[1]=0,s[0]=u,s[1]=t,e&&(fi(o,o,e),fi(s,s,e));var c=new Jr({shape:{x1:o[0],y1:o[1],x2:s[0],y2:s[1]},style:i,z2:2,autoBatch:!0,silent:!0});Cu(c.shape,c.style.lineWidth),c.anid=n+"_"+r[l].tickValue,a.push(c)}return a}function ive(r,e,t,i){var n=t.axis,a=t.getModel("axisTick"),o=a.get("show");if(o==="auto"&&i.handleAutoShown&&(o=i.handleAutoShown("axisTick")),!(!o||n.scale.isBlank())){for(var s=a.getModel("lineStyle"),l=i.tickDirection*a.get("length"),u=n.getTicksCoords(),c=i9(u,e.transform,l,Ye(s.getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])}),"ticks"),f=0;f<c.length;f++)r.add(c[f]);return c}}function nve(r,e,t,i){var n=t.axis,a=t.getModel("minorTick");if(!(!a.get("show")||n.scale.isBlank())){var o=n.getMinorTicksCoords();if(o.length)for(var s=a.getModel("lineStyle"),l=i*a.get("length"),u=Ye(s.getLineStyle(),Ye(t.getModel("axisTick").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})),c=0;c<o.length;c++)for(var f=i9(o[c],e.transform,l,u,"minorticks_"+c),h=0;h<f.length;h++)r.add(f[h])}}function ave(r,e,t,i){var n=t.axis,a=Br(i.axisLabelShow,t.get(["axisLabel","show"]));if(!(!a||n.scale.isBlank())){var o=t.getModel("axisLabel"),s=o.get("margin"),l=n.getViewLabels(),u=(Br(i.labelRotate,o.get("rotate"))||0)*Xf/180,c=td.innerTextLayout(i.rotation,u,i.labelDirection),f=t.getCategories&&t.getCategories(!0),h=[],p=td.isLabelSilent(t),d=t.get("triggerEvent");return N(l,function(g,m){var v=n.scale.type==="ordinal"?n.scale.getRawOrdinalNumber(g.tickValue):g.tickValue,_=g.formattedLabel,y=g.rawLabel,x=o;if(f&&f[v]){var M=f[v];qe(M)&&M.textStyle&&(x=new Zt(M.textStyle,o,t.ecModel))}var S=x.getTextColor()||t.get(["axisLine","lineStyle","color"]),w=n.dataToCoord(v),T=x.getShallow("align",!0)||c.textAlign,C=ft(x.getShallow("alignMinLabel",!0),T),b=ft(x.getShallow("alignMaxLabel",!0),T),E=x.getShallow("verticalAlign",!0)||x.getShallow("baseline",!0)||c.textVerticalAlign,I=ft(x.getShallow("verticalAlignMinLabel",!0),E),R=ft(x.getShallow("verticalAlignMaxLabel",!0),E),A=new Lt({x:w,y:i.labelOffset+i.labelDirection*s,rotation:c.rotation,silent:p,z2:10+(g.level||0),style:fr(x,{text:_,align:m===0?C:m===l.length-1?b:T,verticalAlign:m===0?I:m===l.length-1?R:E,fill:He(S)?S(n.type==="category"?y:n.type==="value"?v+"":v,m):S})});if(A.anid="label_"+v,d){var D=td.makeAxisEventDataBase(t);D.targetType="axisLabel",D.value=y,D.tickIndex=m,n.type==="category"&&(D.dataIndex=v),rt(A).eventData=D}e.add(A),A.updateTransform(),h.push(A),r.add(A),A.decomposeTransform()}),h}}var Cn=td;function n9(r,e){var t={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return ove(t,r,e),t.seriesInvolved&&lve(t,r),t}function ove(r,e,t){var i=e.getComponent("tooltip"),n=e.getComponent("axisPointer"),a=n.get("link",!0)||[],o=[];N(t.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=Cv(s.model),u=r.coordSysAxesInfo[l]={};r.coordSysMap[l]=s;var c=s.model,f=c.getModel("tooltip",i);if(N(s.getAxes(),ot(g,!1,null)),s.getTooltipAxes&&i&&f.get("show")){var h=f.get("trigger")==="axis",p=f.get(["axisPointer","type"])==="cross",d=s.getTooltipAxes(f.get(["axisPointer","axis"]));(h||p)&&N(d.baseAxes,ot(g,p?"cross":!0,h)),p&&N(d.otherAxes,ot(g,"cross",!1))}function g(m,v,_){var y=_.model.getModel("axisPointer",n),x=y.get("show");if(!(!x||x==="auto"&&!m&&!gI(y))){v==null&&(v=y.get("triggerTooltip")),y=m?sve(_,f,n,e,m,v):y;var M=y.get("snap"),S=y.get("triggerEmphasis"),w=Cv(_.model),T=v||M||_.type==="category",C=r.axesInfo[w]={key:w,axis:_,coordSys:s,axisPointerModel:y,triggerTooltip:v,triggerEmphasis:S,involveSeries:T,snap:M,useHandle:gI(y),seriesModels:[],linkGroup:null};u[w]=C,r.seriesInvolved=r.seriesInvolved||T;var b=uve(a,_);if(b!=null){var E=o[b]||(o[b]={axesInfo:{}});E.axesInfo[w]=C,E.mapper=a[b].mapper,C.linkGroup=E}}}})}function sve(r,e,t,i,n,a){var o=e.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};N(s,function(h){l[h]=Qe(o.get(h))}),l.snap=r.type!=="category"&&!!a,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),n==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!a){var f=l.lineStyle=o.get("crossStyle");f&&Ye(u,f.textStyle)}}return r.model.getModel("axisPointer",new Zt(l,t,i))}function lve(r,e){e.eachSeries(function(t){var i=t.coordinateSystem,n=t.get(["tooltip","trigger"],!0),a=t.get(["tooltip","show"],!0);!i||n==="none"||n===!1||n==="item"||a===!1||t.get(["axisPointer","show"],!0)===!1||N(r.coordSysAxesInfo[Cv(i.model)],function(o){var s=o.axis;i.getAxis(s.dim)===s&&(o.seriesModels.push(t),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=t.getData().count())})})}function uve(r,e){for(var t=e.model,i=e.dim,n=0;n<r.length;n++){var a=r[n]||{};if(vI(a[i+"AxisId"],t.id)||vI(a[i+"AxisIndex"],t.componentIndex)||vI(a[i+"AxisName"],t.name))return n}}function vI(r,e){return r==="all"||pe(r)&&dt(r,e)>=0||r===e}function a9(r){var e=lT(r);if(e){var t=e.axisPointerModel,i=e.axis.scale,n=t.option,a=t.get("status"),o=t.get("value");o!=null&&(o=i.parse(o));var s=gI(t);a==null&&(n.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(o==null||o>l[1])&&(o=l[1]),o<l[0]&&(o=l[0]),n.value=o,s&&(n.status=e.axis.scale.isBlank()?"hide":"show")}}function lT(r){var e=(r.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[Cv(r)]}function o9(r){var e=lT(r);return e&&e.axisPointerModel}function gI(r){return!!r.get(["handle","show"])}function Cv(r){return r.type+"||"+r.id}var s9={},cve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){this.axisPointerClass&&a9(t),r.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(t,n,!0)},e.prototype.updateAxisPointer=function(t,i,n,a){this._doUpdateAxisPointerClass(t,n,!1)},e.prototype.remove=function(t,i){var n=this._axisPointer;n&&n.remove(i)},e.prototype.dispose=function(t,i){this._disposeAxisPointer(i),r.prototype.dispose.apply(this,arguments)},e.prototype._doUpdateAxisPointerClass=function(t,i,n){var a=e.getAxisPointerClass(this.axisPointerClass);if(a){var o=o9(t);o?(this._axisPointer||(this._axisPointer=new a)).render(t,o,i,n):this._disposeAxisPointer(i)}},e.prototype._disposeAxisPointer=function(t){this._axisPointer&&this._axisPointer.dispose(t),this._axisPointer=null},e.registerAxisPointerClass=function(t,i){s9[t]=i},e.getAxisPointerClass=function(t){return t&&s9[t]},e.type="axis",e}(er),qa=cve;var _I=vt();function uT(r,e,t,i){var n=t.axis;if(!n.scale.isBlank()){var a=t.getModel("splitArea"),o=a.getModel("areaStyle"),s=o.get("color"),l=i.coordinateSystem.getRect(),u=n.getTicksCoords({tickModel:a,clamp:!0});if(u.length){var c=s.length,f=_I(r).splitAreaColors,h=ke(),p=0;if(f)for(var d=0;d<u.length;d++){var g=f.get(u[d].tickValue);if(g!=null){p=(g+(c-1)*d)%c;break}}var m=n.toGlobalCoord(u[0].coord),v=o.getAreaStyle();s=pe(s)?s:[s];for(var d=1;d<u.length;d++){var _=n.toGlobalCoord(u[d].coord),y=void 0,x=void 0,M=void 0,S=void 0;n.isHorizontal()?(y=m,x=l.y,M=_-y,S=l.height,m=y+M):(y=l.x,x=m,M=l.width,S=_-x,m=x+S);var w=u[d-1].tickValue;w!=null&&h.set(w,p),e.add(new Et({anid:w!=null?"area_"+w:null,shape:{x:y,y:x,width:M,height:S},style:Ye({fill:s[p]},v),autoBatch:!0,silent:!0})),p=(p+1)%c}_I(r).splitAreaColors=h}}}function cT(r){_I(r).splitAreaColors=null}var fve=["axisLine","axisTickLabel","axisName"],hve=["splitArea","splitLine","minorSplitLine"],l9=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="CartesianAxisPointer",t}return e.prototype.render=function(t,i,n,a){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Ze,this.group.add(this._axisGroup),!!t.get("show")){var s=t.getCoordSysModel(),l=yx(s,t),u=new Cn(t,fe({handleAutoShown:function(f){for(var h=s.coordinateSystem.getCartesians(),p=0;p<h.length;p++)if(nx(h[p].getOtherAxis(t.axis).scale))return!0;return!1}},l));N(fve,u.add,u),this._axisGroup.add(u.getGroup()),N(hve,function(f){t.get([f,"show"])&&pve[f](this,this._axisGroup,t,s)},this);var c=a&&a.type==="changeAxisOrder"&&a.isInitSort;c||Ru(o,this._axisGroup,t),r.prototype.render.call(this,t,i,n,a)}},e.prototype.remove=function(){cT(this)},e.type="cartesianAxis",e}(qa),pve={splitLine:function(r,e,t,i){var n=t.axis;if(!n.scale.isBlank()){var a=t.getModel("splitLine"),o=a.getModel("lineStyle"),s=o.get("color");s=pe(s)?s:[s];for(var l=i.coordinateSystem.getRect(),u=n.isHorizontal(),c=0,f=n.getTicksCoords({tickModel:a}),h=[],p=[],d=o.getLineStyle(),g=0;g<f.length;g++){var m=n.toGlobalCoord(f[g].coord);u?(h[0]=m,h[1]=l.y,p[0]=m,p[1]=l.y+l.height):(h[0]=l.x,h[1]=m,p[0]=l.x+l.width,p[1]=m);var v=c++%s.length,_=f[g].tickValue,y=new Jr({anid:_!=null?"line_"+f[g].tickValue:null,autoBatch:!0,shape:{x1:h[0],y1:h[1],x2:p[0],y2:p[1]},style:Ye({stroke:s[v]},d),silent:!0});Cu(y.shape,d.lineWidth),e.add(y)}}},minorSplitLine:function(r,e,t,i){var n=t.axis,a=t.getModel("minorSplitLine"),o=a.getModel("lineStyle"),s=i.coordinateSystem.getRect(),l=n.isHorizontal(),u=n.getMinorTicksCoords();if(u.length)for(var c=[],f=[],h=o.getLineStyle(),p=0;p<u.length;p++)for(var d=0;d<u[p].length;d++){var g=n.toGlobalCoord(u[p][d].coord);l?(c[0]=g,c[1]=s.y,f[0]=g,f[1]=s.y+s.height):(c[0]=s.x,c[1]=g,f[0]=s.x+s.width,f[1]=g);var m=new Jr({anid:"minor_line_"+u[p][d].tickValue,autoBatch:!0,shape:{x1:c[0],y1:c[1],x2:f[0],y2:f[1]},style:h,silent:!0});Cu(m.shape,h.lineWidth),e.add(m)}},splitArea:function(r,e,t,i){uT(r,e,t,i)}},xI=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="xAxis",e}(l9);var u9=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=xI.type,t}return e.type="yAxis",e}(l9);var dve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="grid",t}return e.prototype.render=function(t,i){this.group.removeAll(),t.get("show")&&this.group.add(new Et({shape:t.coordinateSystem.getRect(),style:Ye({fill:t.get("backgroundColor")},t.getItemStyle()),silent:!0,z2:-1}))},e.type="grid",e}(er),c9={offset:0};function fT(r){r.registerComponentView(dve),r.registerComponentModel(GX),r.registerCoordinateSystem("cartesian2d",QX),il(r,"x",nT,c9),il(r,"y",nT,c9),r.registerComponentView(xI),r.registerComponentView(u9),r.registerPreprocessor(function(e){e.xAxis&&e.yAxis&&!e.grid&&(e.grid={})})}function SI(r){It(fT),r.registerSeriesModel(FX),r.registerChartView(VX),r.registerLayout(tl("scatter"))}function MI(r){r.eachSeriesByType("radar",function(e){var t=e.getData(),i=[],n=e.coordinateSystem;if(n){var a=n.getIndicatorAxes();N(a,function(o,s){t.each(t.mapDimension(a[s].dim),function(l,u){i[u]=i[u]||[];var c=n.dataToPoint(l,s);i[u][s]=f9(c)?c:h9(n)})}),t.each(function(o){var s=OV(i[o],function(l){return f9(l)})||h9(n);i[o].push(s.slice()),t.setItemLayout(o,i[o])})}})}function f9(r){return!isNaN(r[0])&&!isNaN(r[1])}function h9(r){return[r.cx,r.cy]}function bI(r){var e=r.polar;if(e){pe(e)||(e=[e]);var t=[];N(e,function(i,n){i.indicator?(i.type&&!i.shape&&(i.shape=i.type),r.radar=r.radar||[],pe(r.radar)||(r.radar=[r.radar]),r.radar.push(i)):t.push(i)}),r.polar=t}N(r.series,function(i){i&&i.type==="radar"&&i.polarIndex&&(i.radarIndex=i.polarIndex)})}var mve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.coordinateSystem,o=this.group,s=t.getData(),l=this._data;function u(h,p){var d=h.getItemVisual(p,"symbol")||"circle";if(d!=="none"){var g=Zs(h.getItemVisual(p,"symbolSize")),m=Sr(d,-1,-1,2,2),v=h.getItemVisual(p,"symbolRotate")||0;return m.attr({style:{strokeNoScale:!0},z2:100,scaleX:g[0]/2,scaleY:g[1]/2,rotation:v*Math.PI/180||0}),m}}function c(h,p,d,g,m,v){d.removeAll();for(var _=0;_<p.length-1;_++){var y=u(g,m);y&&(y.__dimIdx=_,h[_]?(y.setPosition(h[_]),Rt[v?"initProps":"updateProps"](y,{x:p[_][0],y:p[_][1]},t,m)):y.setPosition(p[_]),d.add(y))}}function f(h){return de(h,function(p){return[a.cx,a.cy]})}s.diff(l).add(function(h){var p=s.getItemLayout(h);if(p){var d=new ti,g=new Qr,m={shape:{points:p}};d.shape.points=f(p),g.shape.points=f(p),or(d,m,t,h),or(g,m,t,h);var v=new Ze,_=new Ze;v.add(g),v.add(d),v.add(_),c(g.shape.points,p,_,s,h,!0),s.setItemGraphicEl(h,v)}}).update(function(h,p){var d=l.getItemGraphicEl(p),g=d.childAt(0),m=d.childAt(1),v=d.childAt(2),_={shape:{points:s.getItemLayout(h)}};_.shape.points&&(c(g.shape.points,_.shape.points,v,s,h,!1),Di(m),Di(g),Dt(g,_,t),Dt(m,_,t),s.setItemGraphicEl(h,d))}).remove(function(h){o.remove(l.getItemGraphicEl(h))}).execute(),s.eachItemGraphicEl(function(h,p){var d=s.getItemModel(p),g=h.childAt(0),m=h.childAt(1),v=h.childAt(2),_=s.getItemVisual(p,"style"),y=_.fill;o.add(h),g.useStyle(Ye(d.getModel("lineStyle").getLineStyle(),{fill:"none",stroke:y})),Gr(g,d,"lineStyle"),Gr(m,d,"areaStyle");var x=d.getModel("areaStyle"),M=x.isEmpty()&&x.parentModel.isEmpty();m.ignore=M,N(["emphasis","select","blur"],function(T){var C=d.getModel([T,"areaStyle"]),b=C.isEmpty()&&C.parentModel.isEmpty();m.ensureState(T).ignore=b&&M}),m.useStyle(Ye(x.getAreaStyle(),{fill:y,opacity:.7,decal:_.decal}));var S=d.getModel("emphasis"),w=S.getModel("itemStyle").getItemStyle();v.eachChild(function(T){if(T instanceof Ur){var C=T.style;T.useStyle(fe({image:C.image,x:C.x,y:C.y,width:C.width,height:C.height},_))}else T.useStyle(_),T.setColor(y),T.style.strokeNoScale=!0;var b=T.ensureState("emphasis");b.style=Qe(w);var E=s.getStore().get(s.getDimensionIndex(T.__dimIdx),p);(E==null||isNaN(E))&&(E=""),Ir(T,wr(d),{labelFetcher:s.hostModel,labelDataIndex:p,labelDimIndex:T.__dimIdx,defaultText:E,inheritColor:y,defaultOpacity:_.opacity})}),ar(h,S.get("focus"),S.get("blurScope"),S.get("disabled"))}),this._data=s},e.prototype.remove=function(){this.group.removeAll(),this._data=null},e.type="radar",e}(Yt),p9=mve;var vve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new Zl(Be(this.getData,this),Be(this.getRawData,this))},e.prototype.getInitialData=function(t,i){return To(this,{generateCoord:"indicator_",generateCoordCount:1/0})},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=this.coordinateSystem,s=o.getIndicatorAxes(),l=this.getData().getName(t),u=l===""?this.name:l,c=qw(this,t);return Or("section",{header:u,sortBlocks:!0,blocks:de(s,function(f){var h=a.get(a.mapDimension(f.dim),t);return Or("nameValue",{markerType:"subItem",markerColor:c,name:f.name,value:h,sortParam:h})})})},e.prototype.getTooltipPosition=function(t){if(t!=null){for(var i=this.getData(),n=this.coordinateSystem,a=i.getValues(de(n.dimensions,function(u){return i.mapDimension(u)}),t),o=0,s=a.length;o<s;o++)if(!isNaN(a[o])){var l=n.getIndicatorAxes();return n.coordToPoint(l[o].dataToCoord(a[o]),o)}}},e.type="series.radar",e.dependencies=["radar"],e.defaultOption={z:2,colorBy:"data",coordinateSystem:"radar",legendHoverLink:!0,radarIndex:0,lineStyle:{width:2,type:"solid",join:"round"},label:{position:"top"},symbolSize:8},e}(jt),d9=vve;var _x=aT.value;function hT(r,e){return Ye({show:e},r)}var gve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){var t=this.get("boundaryGap"),i=this.get("splitNumber"),n=this.get("scale"),a=this.get("axisLine"),o=this.get("axisTick"),s=this.get("axisLabel"),l=this.get("axisName"),u=this.get(["axisName","show"]),c=this.get(["axisName","formatter"]),f=this.get("axisNameGap"),h=this.get("triggerEvent"),p=de(this.get("indicator")||[],function(d){d.max!=null&&d.max>0&&!d.min?d.min=0:d.min!=null&&d.min<0&&!d.max&&(d.max=0);var g=l;d.color!=null&&(g=Ye({color:d.color},l));var m=_t(Qe(d),{boundaryGap:t,splitNumber:i,scale:n,axisLine:a,axisTick:o,axisLabel:s,name:d.text,showName:u,nameLocation:"end",nameGap:f,nameTextStyle:g,triggerEvent:h},!1);if(Ce(c)){var v=m.name;m.name=c.replace("{value}",v??"")}else He(c)&&(m.name=c(m.name,m));var _=new Zt(m,null,this.ecModel);return br(_,Vl.prototype),_.mainType="radar",_.componentIndex=this.componentIndex,_},this);this._indicatorModels=p},e.prototype.getIndicatorModels=function(){return this._indicatorModels},e.type="radar",e.defaultOption={z:0,center:["50%","50%"],radius:"75%",startAngle:90,axisName:{show:!0},boundaryGap:[0,0],splitNumber:5,axisNameGap:15,scale:!1,shape:"polygon",axisLine:_t({lineStyle:{color:"#bbb"}},_x.axisLine),axisLabel:hT(_x.axisLabel,!1),axisTick:hT(_x.axisTick,!1),splitLine:hT(_x.splitLine,!0),splitArea:hT(_x.splitArea,!0),indicator:[]},e}(Pt),m9=gve;var yve=["axisLine","axisTickLabel","axisName"],_ve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=this.group;a.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},e.prototype._buildAxes=function(t){var i=t.coordinateSystem,n=i.getIndicatorAxes(),a=de(n,function(o){var s=o.model.get("showName")?o.name:"",l=new Cn(o.model,{axisName:s,position:[i.cx,i.cy],rotation:o.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return l});N(a,function(o){N(yve,o.add,o),this.group.add(o.getGroup())},this)},e.prototype._buildSplitLineAndArea=function(t){var i=t.coordinateSystem,n=i.getIndicatorAxes();if(!n.length)return;var a=t.get("shape"),o=t.getModel("splitLine"),s=t.getModel("splitArea"),l=o.getModel("lineStyle"),u=s.getModel("areaStyle"),c=o.get("show"),f=s.get("show"),h=l.get("color"),p=u.get("color"),d=pe(h)?h:[h],g=pe(p)?p:[p],m=[],v=[];function _(D,U,B){var z=B%U.length;return D[z]=D[z]||[],z}if(a==="circle")for(var y=n[0].getTicksCoords(),x=i.cx,M=i.cy,S=0;S<y.length;S++){if(c){var w=_(m,d,S);m[w].push(new ua({shape:{cx:x,cy:M,r:y[S].coord}}))}if(f&&S<y.length-1){var w=_(v,g,S);v[w].push(new Ip({shape:{cx:x,cy:M,r0:y[S].coord,r:y[S+1].coord}}))}}else for(var T,C=de(n,function(D,U){var B=D.getTicksCoords();return T=T==null?B.length-1:Math.min(B.length-1,T),de(B,function(z){return i.coordToPoint(z.coord,U)})}),b=[],S=0;S<=T;S++){for(var E=[],I=0;I<n.length;I++)E.push(C[I][S]);if(E[0]&&E.push(E[0].slice()),c){var w=_(m,d,S);m[w].push(new Qr({shape:{points:E}}))}if(f&&b){var w=_(v,g,S-1);v[w].push(new ti({shape:{points:E.concat(b)}}))}b=E.slice().reverse()}var R=l.getLineStyle(),A=u.getAreaStyle();N(v,function(D,U){this.group.add(Gn(D,{style:Ye({stroke:"none",fill:g[U%g.length]},A),silent:!0}))},this),N(m,function(D,U){this.group.add(Gn(D,{style:Ye({fill:"none",stroke:d[U%d.length]},R),silent:!0}))},this)},e.type="radar",e}(er),v9=_ve;var xve=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t,i,n)||this;return a.type="value",a.angle=0,a.name="",a}return e}(pn),g9=xve;var Sve=function(){function r(e,t,i){this.dimensions=[],this._model=e,this._indicatorAxes=de(e.getIndicatorModels(),function(n,a){var o="indicator_"+a,s=new g9(o,new Ya);return s.name=n.get("name"),s.model=n,n.axis=s,this.dimensions.push(o),s},this),this.resize(e,i)}return r.prototype.getIndicatorAxes=function(){return this._indicatorAxes},r.prototype.dataToPoint=function(e,t){var i=this._indicatorAxes[t];return this.coordToPoint(i.dataToCoord(e),t)},r.prototype.coordToPoint=function(e,t){var i=this._indicatorAxes[t],n=i.angle,a=this.cx+e*Math.cos(n),o=this.cy-e*Math.sin(n);return[a,o]},r.prototype.pointToData=function(e){var t=e[0]-this.cx,i=e[1]-this.cy,n=Math.sqrt(t*t+i*i);t/=n,i/=n;for(var a=Math.atan2(-i,t),o=1/0,s,l=-1,u=0;u<this._indicatorAxes.length;u++){var c=this._indicatorAxes[u],f=Math.abs(a-c.angle);f<o&&(s=c,l=u,o=f)}return[l,+(s&&s.coordToData(n))]},r.prototype.resize=function(e,t){var i=e.get("center"),n=t.getWidth(),a=t.getHeight(),o=Math.min(n,a)/2;this.cx=ze(i[0],n),this.cy=ze(i[1],a),this.startAngle=e.get("startAngle")*Math.PI/180;var s=e.get("radius");(Ce(s)||Ct(s))&&(s=[0,s]),this.r0=ze(s[0],o),this.r=ze(s[1],o),N(this._indicatorAxes,function(l,u){l.setExtent(this.r0,this.r);var c=this.startAngle+u*Math.PI*2/this._indicatorAxes.length;c=Math.atan2(Math.sin(c),Math.cos(c)),l.angle=c},this)},r.prototype.update=function(e,t){var i=this._indicatorAxes,n=this._model;N(i,function(s){s.scale.setExtent(1/0,-1/0)}),e.eachSeriesByType("radar",function(s,l){if(!(s.get("coordinateSystem")!=="radar"||e.getComponent("radar",s.get("radarIndex"))!==n)){var u=s.getData();N(i,function(c){c.scale.unionExtentFromData(u,u.mapDimension(c.dim))})}},this);var a=n.get("splitNumber"),o=new Ya;o.setExtent(0,a),o.setInterval(1),N(i,function(s,l){sT(s.scale,s.model,o)})},r.prototype.convertToPixel=function(e,t,i){return console.warn("Not implemented."),null},r.prototype.convertFromPixel=function(e,t,i){return console.warn("Not implemented."),null},r.prototype.containPoint=function(e){return console.warn("Not implemented."),!1},r.create=function(e,t){var i=[];return e.eachComponent("radar",function(n){var a=new r(n,e,t);i.push(a),n.coordinateSystem=a}),e.eachSeriesByType("radar",function(n){n.get("coordinateSystem")==="radar"&&(n.coordinateSystem=i[n.get("radarIndex")||0])}),i},r.dimensions=[],r}(),y9=Sve;function _9(r){r.registerCoordinateSystem("radar",y9),r.registerComponentModel(m9),r.registerComponentView(v9),r.registerVisual({seriesType:"radar",reset:function(e){var t=e.getData();t.each(function(i){t.setItemVisual(i,"legendIcon","roundRect")}),t.setVisual("legendIcon","roundRect")}})}function wI(r){It(_9),r.registerChartView(p9),r.registerSeriesModel(d9),r.registerLayout(MI),r.registerProcessor(rl("radar")),r.registerPreprocessor(bI)}var x9="\0_ec_interaction_mutex";function S9(r,e,t){var i=EI(r);i[e]=t}function M9(r,e,t){var i=EI(r),n=i[e];n===t&&(i[e]=null)}function TI(r,e){return!!EI(r)[e]}function EI(r){return r[x9]||(r[x9]={})}ha({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},Dr);var Mve=function(r){Z(e,r);function e(t){var i=r.call(this)||this;i._zr=t;var n=Be(i._mousedownHandler,i),a=Be(i._mousemoveHandler,i),o=Be(i._mouseupHandler,i),s=Be(i._mousewheelHandler,i),l=Be(i._pinchHandler,i);return i.enable=function(u,c){this.disable(),this._opt=Ye(Qe(c)||{},{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),u==null&&(u=!0),(u===!0||u==="move"||u==="pan")&&(t.on("mousedown",n),t.on("mousemove",a),t.on("mouseup",o)),(u===!0||u==="scale"||u==="zoom")&&(t.on("mousewheel",s),t.on("pinch",l))},i.disable=function(){t.off("mousedown",n),t.off("mousemove",a),t.off("mouseup",o),t.off("mousewheel",s),t.off("pinch",l)},i}return e.prototype.isDragging=function(){return this._dragging},e.prototype.isPinching=function(){return this._pinching},e.prototype.setPointerChecker=function(t){this.pointerChecker=t},e.prototype.dispose=function(){this.disable()},e.prototype._mousedownHandler=function(t){if(!vL(t)){for(var i=t.target;i;){if(i.draggable)return;i=i.__hostTarget||i.parent}var n=t.offsetX,a=t.offsetY;this.pointerChecker&&this.pointerChecker(t,n,a)&&(this._x=n,this._y=a,this._dragging=!0)}},e.prototype._mousemoveHandler=function(t){if(!(!this._dragging||!pT("moveOnMouseMove",t,this._opt)||t.gestureEvent==="pinch"||TI(this._zr,"globalPan"))){var i=t.offsetX,n=t.offsetY,a=this._x,o=this._y,s=i-a,l=n-o;this._x=i,this._y=n,this._opt.preventDefaultMouseMove&&Ra(t.event),w9(this,"pan","moveOnMouseMove",t,{dx:s,dy:l,oldX:a,oldY:o,newX:i,newY:n,isAvailableBehavior:null})}},e.prototype._mouseupHandler=function(t){vL(t)||(this._dragging=!1)},e.prototype._mousewheelHandler=function(t){var i=pT("zoomOnMouseWheel",t,this._opt),n=pT("moveOnMouseWheel",t,this._opt),a=t.wheelDelta,o=Math.abs(a),s=t.offsetX,l=t.offsetY;if(!(a===0||!i&&!n)){if(i){var u=o>3?1.4:o>1?1.2:1.1,c=a>0?u:1/u;AI(this,"zoom","zoomOnMouseWheel",t,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(n){var f=Math.abs(a),h=(a>0?1:-1)*(f>3?.4:f>1?.15:.05);AI(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:h,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){if(!TI(this._zr,"globalPan")){var i=t.pinchScale>1?1.1:1/1.1;AI(this,"zoom",null,t,{scale:i,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})}},e}(Pi);function AI(r,e,t,i,n){r.pointerChecker&&r.pointerChecker(i,n.originX,n.originY)&&(Ra(i.event),w9(r,e,t,i,n))}function w9(r,e,t,i,n){n.isAvailableBehavior=Be(pT,null,t,i),r.trigger(e,n)}function pT(r,e,t){var i=t[r];return!r||i&&(!Ce(i)||e.event[i+"Key"])}var jl=Mve;function Rv(r,e,t){var i=r.target;i.x+=e,i.y+=t,i.dirty()}function Lv(r,e,t,i){var n=r.target,a=r.zoomLimit,o=r.zoom=r.zoom||1;if(o*=e,a){var s=a.min||0,l=a.max||1/0;o=Math.max(Math.min(l,o),s)}var u=o/r.zoom;r.zoom=o,n.x-=(t-n.x)*(u-1),n.y-=(i-n.y)*(u-1),n.scaleX*=u,n.scaleY*=u,n.dirty()}var bve={axisPointer:1,tooltip:1,brush:1};function Yf(r,e,t){var i=e.getComponentByElement(r.topTarget),n=i&&i.coordinateSystem;return i&&i!==t&&!bve.hasOwnProperty(i.mainType)&&n&&n.model!==t}function dT(r){if(Ce(r)){var e=new DOMParser;r=e.parseFromString(r,"text/xml")}var t=r;for(t.nodeType===9&&(t=t.firstChild);t.nodeName.toLowerCase()!=="svg"||t.nodeType!==1;)t=t.nextSibling;return t}var RI,mT={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-anchor":"textAlign",visibility:"visibility",display:"display"},T9=bt(mT),vT={"alignment-baseline":"textBaseline","stop-color":"stopColor"},E9=bt(vT),wve=function(){function r(){this._defs={},this._root=null}return r.prototype.parse=function(e,t){t=t||{};var i=dT(e);this._defsUsePending=[];var n=new Ze;this._root=n;var a=[],o=i.getAttribute("viewBox")||"",s=parseFloat(i.getAttribute("width")||t.width),l=parseFloat(i.getAttribute("height")||t.height);isNaN(s)&&(s=null),isNaN(l)&&(l=null),Eo(i,n,null,!0,!1);for(var u=i.firstChild;u;)this._parseNode(u,n,a,null,!1,!1),u=u.nextSibling;Ave(this._defs,this._defsUsePending),this._defsUsePending=[];var c,f;if(o){var h=gT(o);h.length>=4&&(c={x:parseFloat(h[0]||0),y:parseFloat(h[1]||0),width:parseFloat(h[2]),height:parseFloat(h[3])})}if(c&&s!=null&&l!=null&&(f=PI(c,{x:0,y:0,width:s,height:l}),!t.ignoreViewBox)){var p=n;n=new Ze,n.add(p),p.scaleX=p.scaleY=f.scale,p.x=f.x,p.y=f.y}return!t.ignoreRootClip&&s!=null&&l!=null&&n.setClipPath(new Et({shape:{x:0,y:0,width:s,height:l}})),{root:n,width:s,height:l,viewBoxRect:c,viewBoxTransform:f,named:a}},r.prototype._parseNode=function(e,t,i,n,a,o){var s=e.nodeName.toLowerCase(),l,u=n;if(s==="defs"&&(a=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=t;else{if(!a){var c=RI[s];if(c&&tt(RI,s)){l=c.call(this,e,t);var f=e.getAttribute("name");if(f){var h={name:f,namedFrom:null,svgNodeTagLower:s,el:l};i.push(h),s==="g"&&(u=h)}else n&&i.push({name:n.name,namedFrom:n,svgNodeTagLower:s,el:l});t.add(l)}}var p=A9[s];if(p&&tt(A9,s)){var d=p.call(this,e),g=e.getAttribute("id");g&&(this._defs[g]=d)}}if(l&&l.isGroup)for(var m=e.firstChild;m;)m.nodeType===1?this._parseNode(m,l,i,u,a,o):m.nodeType===3&&o&&this._parseText(m,l),m=m.nextSibling},r.prototype._parseText=function(e,t){var i=new Mu({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});fs(t,i),Eo(e,i,this._defsUsePending,!1,!1),Tve(i,t);var n=i.style,a=n.fontSize;a&&a<9&&(n.fontSize=9,i.scaleX*=a/9,i.scaleY*=a/9);var o=(n.fontSize||n.fontFamily)&&[n.fontStyle,n.fontWeight,(n.fontSize||12)+"px",n.fontFamily||"sans-serif"].join(" ");n.font=o;var s=i.getBoundingRect();return this._textX+=s.width,t.add(i),i},r.internalField=function(){RI={g:function(e,t){var i=new Ze;return fs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i},rect:function(e,t){var i=new Et;return fs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({x:parseFloat(e.getAttribute("x")||"0"),y:parseFloat(e.getAttribute("y")||"0"),width:parseFloat(e.getAttribute("width")||"0"),height:parseFloat(e.getAttribute("height")||"0")}),i.silent=!0,i},circle:function(e,t){var i=new ua;return fs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),r:parseFloat(e.getAttribute("r")||"0")}),i.silent=!0,i},line:function(e,t){var i=new Jr;return fs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({x1:parseFloat(e.getAttribute("x1")||"0"),y1:parseFloat(e.getAttribute("y1")||"0"),x2:parseFloat(e.getAttribute("x2")||"0"),y2:parseFloat(e.getAttribute("y2")||"0")}),i.silent=!0,i},ellipse:function(e,t){var i=new g_;return fs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),rx:parseFloat(e.getAttribute("rx")||"0"),ry:parseFloat(e.getAttribute("ry")||"0")}),i.silent=!0,i},polygon:function(e,t){var i=e.getAttribute("points"),n;i&&(n=L9(i));var a=new ti({shape:{points:n||[]},silent:!0});return fs(t,a),Eo(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var i=e.getAttribute("points"),n;i&&(n=L9(i));var a=new Qr({shape:{points:n||[]},silent:!0});return fs(t,a),Eo(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var i=new Ur;return fs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setStyle({image:e.getAttribute("xlink:href")||e.getAttribute("href"),x:+e.getAttribute("x"),y:+e.getAttribute("y"),width:+e.getAttribute("width"),height:+e.getAttribute("height")}),i.silent=!0,i},text:function(e,t){var i=e.getAttribute("x")||"0",n=e.getAttribute("y")||"0",a=e.getAttribute("dx")||"0",o=e.getAttribute("dy")||"0";this._textX=parseFloat(i)+parseFloat(a),this._textY=parseFloat(n)+parseFloat(o);var s=new Ze;return fs(t,s),Eo(e,s,this._defsUsePending,!1,!0),s},tspan:function(e,t){var i=e.getAttribute("x"),n=e.getAttribute("y");i!=null&&(this._textX=parseFloat(i)),n!=null&&(this._textY=parseFloat(n));var a=e.getAttribute("dx")||"0",o=e.getAttribute("dy")||"0",s=new Ze;return fs(t,s),Eo(e,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(o),s},path:function(e,t){var i=e.getAttribute("d")||"",n=lw(i);return fs(t,n),Eo(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}}(),r}(),A9={lineargradient:function(r){var e=parseInt(r.getAttribute("x1")||"0",10),t=parseInt(r.getAttribute("y1")||"0",10),i=parseInt(r.getAttribute("x2")||"10",10),n=parseInt(r.getAttribute("y2")||"0",10),a=new zl(e,t,i,n);return C9(r,a),R9(r,a),a},radialgradient:function(r){var e=parseInt(r.getAttribute("cx")||"0",10),t=parseInt(r.getAttribute("cy")||"0",10),i=parseInt(r.getAttribute("r")||"0",10),n=new hw(e,t,i);return C9(r,n),R9(r,n),n}};function C9(r,e){var t=r.getAttribute("gradientUnits");t==="userSpaceOnUse"&&(e.global=!0)}function R9(r,e){for(var t=r.firstChild;t;){if(t.nodeType===1&&t.nodeName.toLocaleLowerCase()==="stop"){var i=t.getAttribute("offset"),n=void 0;i&&i.indexOf("%")>0?n=parseInt(i,10)/100:i?n=parseFloat(i):n=0;var a={};I9(t,a,a);var o=a.stopColor||t.getAttribute("stop-color")||"#000000";e.colorStops.push({offset:n,color:o})}t=t.nextSibling}}function fs(r,e){r&&r.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),Ye(e.__inheritedStyle,r.__inheritedStyle))}function L9(r){for(var e=gT(r),t=[],i=0;i<e.length;i+=2){var n=parseFloat(e[i]),a=parseFloat(e[i+1]);t.push([n,a])}return t}function Eo(r,e,t,i,n){var a=e,o=a.__inheritedStyle=a.__inheritedStyle||{},s={};r.nodeType===1&&(Lve(r,e),I9(r,o,s),i||Pve(r,o,s)),a.style=a.style||{},o.fill!=null&&(a.style.fill=P9(a,"fill",o.fill,t)),o.stroke!=null&&(a.style.stroke=P9(a,"stroke",o.stroke,t)),N(["lineWidth","opacity","fillOpacity","strokeOpacity","miterLimit","fontSize"],function(l){o[l]!=null&&(a.style[l]=parseFloat(o[l]))}),N(["lineDashOffset","lineCap","lineJoin","fontWeight","fontFamily","fontStyle","textAlign"],function(l){o[l]!=null&&(a.style[l]=o[l])}),n&&(a.__selfStyle=s),o.lineDash&&(a.style.lineDash=de(gT(o.lineDash),function(l){return parseFloat(l)})),(o.visibility==="hidden"||o.visibility==="collapse")&&(a.invisible=!0),o.display==="none"&&(a.ignore=!0)}function Tve(r,e){var t=e.__selfStyle;if(t){var i=t.textBaseline,n=i;!i||i==="auto"||i==="baseline"?n="alphabetic":i==="before-edge"||i==="text-before-edge"?n="top":i==="after-edge"||i==="text-after-edge"?n="bottom":(i==="central"||i==="mathematical")&&(n="middle"),r.style.textBaseline=n}var a=e.__inheritedStyle;if(a){var o=a.textAlign,s=o;o&&(o==="middle"&&(s="center"),r.style.textAlign=s)}}var Eve=/^url\(\s*#(.*?)\)/;function P9(r,e,t,i){var n=t&&t.match(Eve);if(n){var a=Yi(n[1]);i.push([r,e,a]);return}return t==="none"&&(t=null),t}function Ave(r,e){for(var t=0;t<e.length;t++){var i=e[t];i[0].style[i[1]]=r[i[2]]}}var Cve=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function gT(r){return r.match(Cve)||[]}var Rve=/(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g,LI=Math.PI/180;function Lve(r,e){var t=r.getAttribute("transform");if(t){t=t.replace(/,/g," ");var i=[],n=null;t.replace(Rve,function(f,h,p){return i.push(h,p),""});for(var a=i.length-1;a>0;a-=2){var o=i[a],s=i[a-1],l=gT(o);switch(n=n||wi(),s){case"translate":_n(n,n,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Lm(n,n,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Pa(n,n,-parseFloat(l[0])*LI,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*LI);La(n,[1,0,u,1,0,0],n);break;case"skewY":var c=Math.tan(parseFloat(l[0])*LI);La(n,[1,c,0,1,0,0],n);break;case"matrix":n[0]=parseFloat(l[0]),n[1]=parseFloat(l[1]),n[2]=parseFloat(l[2]),n[3]=parseFloat(l[3]),n[4]=parseFloat(l[4]),n[5]=parseFloat(l[5]);break}}e.setLocalTransform(n)}}var D9=/([^\s:;]+)\s*:\s*([^:;]+)/g;function I9(r,e,t){var i=r.getAttribute("style");if(i){D9.lastIndex=0;for(var n;(n=D9.exec(i))!=null;){var a=n[1],o=tt(mT,a)?mT[a]:null;o&&(e[o]=n[2]);var s=tt(vT,a)?vT[a]:null;s&&(t[s]=n[2])}}}function Pve(r,e,t){for(var i=0;i<T9.length;i++){var n=T9[i],a=r.getAttribute(n);a!=null&&(e[mT[n]]=a)}for(var i=0;i<E9.length;i++){var n=E9[i],a=r.getAttribute(n);a!=null&&(t[vT[n]]=a)}}function PI(r,e){var t=e.width/r.width,i=e.height/r.height,n=Math.min(t,i);return{scale:n,x:-(r.x+r.width/2)*n+(e.x+e.width/2),y:-(r.y+r.height/2)*n+(e.y+e.height/2)}}function N9(r,e){var t=new wve;return t.parse(r,e)}var Dve=ke(["rect","circle","line","ellipse","polygon","polyline","path","text","tspan","g"]),U9=function(){function r(e,t){this.type="geoSVG",this._usedGraphicMap=ke(),this._freedGraphics=[],this._mapName=e,this._parsedXML=dT(t)}return r.prototype.load=function(){var e=this._firstGraphic;if(!e){e=this._firstGraphic=this._buildGraphic(this._parsedXML),this._freedGraphics.push(e),this._boundingRect=this._firstGraphic.boundingRect.clone();var t=Nve(e.named),i=t.regions,n=t.regionsMap;this._regions=i,this._regionsMap=n}return{boundingRect:this._boundingRect,regions:this._regions,regionsMap:this._regionsMap}},r.prototype._buildGraphic=function(e){var t,i;try{t=e&&N9(e,{ignoreViewBox:!0,ignoreRootClip:!0})||{},i=t.root,kr(i!=null)}catch(m){throw new Error(`Invalid svg format
  2215. `+m.message)}var n=new Ze;n.add(i),n.isGeoSVGGraphicRoot=!0;var a=t.width,o=t.height,s=t.viewBoxRect,l=this._boundingRect;if(!l){var u=void 0,c=void 0,f=void 0,h=void 0;if(a!=null?(u=0,f=a):s&&(u=s.x,f=s.width),o!=null?(c=0,h=o):s&&(c=s.y,h=s.height),u==null||c==null){var p=i.getBoundingRect();u==null&&(u=p.x,f=p.width),c==null&&(c=p.y,h=p.height)}l=this._boundingRect=new lt(u,c,f,h)}if(s){var d=PI(s,l);i.scaleX=i.scaleY=d.scale,i.x=d.x,i.y=d.y}n.setClipPath(new Et({shape:l.plain()}));var g=[];return N(t.named,function(m){Dve.get(m.svgNodeTagLower)!=null&&(g.push(m),Ive(m.el))}),{root:n,boundingRect:l,named:g}},r.prototype.useGraphic=function(e){var t=this._usedGraphicMap,i=t.get(e);return i||(i=this._freedGraphics.pop()||this._buildGraphic(this._parsedXML),t.set(e,i),i)},r.prototype.freeGraphic=function(e){var t=this._usedGraphicMap,i=t.get(e);i&&(t.removeKey(e),this._freedGraphics.push(i))},r}();function Ive(r){r.silent=!1,r.isGroup&&r.traverse(function(e){e.silent=!1})}function Nve(r){var e=[],t=ke();return N(r,function(i){if(i.namedFrom==null){var n=new m8(i.name,i.el);e.push(n),t.set(i.name,n)}}),{regions:e,regionsMap:t}}var DI=[126,25],O9="\u5357\u6D77\u8BF8\u5C9B",id=[[[0,3.5],[7,11.2],[15,11.9],[30,7],[42,.7],[52,.7],[56,7.7],[59,.7],[64,.7],[64,0],[5,0],[0,3.5]],[[13,16.1],[19,14.7],[16,21.7],[11,23.1],[13,16.1]],[[12,32.2],[14,38.5],[15,38.5],[13,32.2],[12,32.2]],[[16,47.6],[12,53.2],[13,53.2],[18,47.6],[16,47.6]],[[6,64.4],[8,70],[9,70],[8,64.4],[6,64.4]],[[23,82.6],[29,79.8],[30,79.8],[25,82.6],[23,82.6]],[[37,70.7],[43,62.3],[44,62.3],[39,70.7],[37,70.7]],[[48,51.1],[51,45.5],[53,45.5],[50,51.1],[48,51.1]],[[51,35],[51,28.7],[53,28.7],[53,35],[51,35]],[[52,22.4],[55,17.5],[56,17.5],[53,22.4],[52,22.4]],[[58,12.6],[62,7],[63,7],[60,12.6],[58,12.6]],[[0,3.5],[0,93.1],[64,93.1],[64,0],[63,0],[63,92.4],[1,92.4],[1,3.5],[0,3.5]]];for(qf=0;qf<id.length;qf++)for(rd=0;rd<id[qf].length;rd++)id[qf][rd][0]/=10.5,id[qf][rd][1]/=-10.5/.75,id[qf][rd][0]+=DI[0],id[qf][rd][1]+=DI[1];var rd,qf;function II(r,e){if(r==="china"){for(var t=0;t<e.length;t++)if(e[t].name===O9)return;e.push(new N1(O9,de(id,function(i){return{type:"polygon",exterior:i}}),DI))}}var Uve={\u5357\u6D77\u8BF8\u5C9B:[32,80],\u5E7F\u4E1C:[0,-10],\u9999\u6E2F:[10,5],\u6FB3\u95E8:[-10,10],\u5929\u6D25:[5,5]};function NI(r,e){if(r==="china"){var t=Uve[e.name];if(t){var i=e.getCenter();i[0]+=t[0]/10.5,i[1]+=-t[1]/(10.5/.75),e.setCenter(i)}}}var Ove=[[[123.45165252685547,25.73527164402261],[123.49731445312499,25.73527164402261],[123.49731445312499,25.750734064600884],[123.45165252685547,25.750734064600884],[123.45165252685547,25.73527164402261]]];function UI(r,e){r==="china"&&e.name==="\u53F0\u6E7E"&&e.geometries.push({type:"polygon",exterior:Ove[0]})}var zve="name",z9=function(){function r(e,t,i){this.type="geoJSON",this._parsedMap=ke(),this._mapName=e,this._specialAreas=i,this._geoJSON=Bve(t)}return r.prototype.load=function(e,t){t=t||zve;var i=this._parsedMap.get(t);if(!i){var n=this._parseToRegions(t);i=this._parsedMap.set(t,{regions:n,boundingRect:Fve(n)})}var a=ke(),o=[];return N(i.regions,function(s){var l=s.name;e&&tt(e,l)&&(s=s.cloneShallow(l=e[l])),o.push(s),a.set(l,s)}),{regions:o,boundingRect:i.boundingRect||new lt(0,0,0,0),regionsMap:a}},r.prototype._parseToRegions=function(e){var t=this._mapName,i=this._geoJSON,n;try{n=i?x2(i,e):[]}catch(a){throw new Error(`Invalid geoJson format
  2216. `+a.message)}return II(t,n),N(n,function(a){var o=a.name;NI(t,a),UI(t,a);var s=this._specialAreas&&this._specialAreas[o];s&&a.transformTo(s.left,s.top,s.width,s.height)},this),n},r.prototype.getMapForUser=function(){return{geoJson:this._geoJSON,geoJSON:this._geoJSON,specialAreas:this._specialAreas}},r}();function Fve(r){for(var e,t=0;t<r.length;t++){var i=r[t].getBoundingRect();e=e||i.clone(),e.union(i)}return e}function Bve(r){return Ce(r)?typeof JSON<"u"&&JSON.parse?JSON.parse(r):new Function("return ("+r+");")():r}var xx=ke(),va={registerMap:function(r,e,t){if(e.svg){var i=new U9(r,e.svg);xx.set(r,i)}else{var n=e.geoJson||e.geoJSON;n&&!e.features?t=e.specialAreas:n=e;var i=new z9(r,n,t);xx.set(r,i)}},getGeoResource:function(r){return xx.get(r)},getMapForUser:function(r){var e=xx.get(r);return e&&e.type==="geoJSON"&&e.getMapForUser()},load:function(r,e,t){var i=xx.get(r);if(i)return i.load(e,t)}};var OI=["rect","circle","line","ellipse","polygon","polyline","path"],kve=ke(OI),Vve=ke(OI.concat(["g"])),Gve=ke(OI.concat(["g"])),X9=vt();function yT(r){var e=r.getItemStyle(),t=r.get("areaColor");return t!=null&&(e.fill=t),e}function F9(r){var e=r.style;e&&(e.stroke=e.stroke||e.fill,e.fill=null)}var Hve=function(){function r(e){var t=new Ze;this.uid=rs("ec_map_draw"),this._controller=new jl(e.getZr()),this._controllerHost={target:t},this.group=t,t.add(this._regionsGroup=new Ze),t.add(this._svgGroup=new Ze)}return r.prototype.draw=function(e,t,i,n,a){var o=e.mainType==="geo",s=e.getData&&e.getData();o&&t.eachComponent({mainType:"series",subType:"map"},function(v){!s&&v.getHostGeoModel()===e&&(s=v.getData())});var l=e.coordinateSystem,u=this._regionsGroup,c=this.group,f=l.getTransformInfo(),h=f.raw,p=f.roam,d=!u.childAt(0)||a;d?(c.x=p.x,c.y=p.y,c.scaleX=p.scaleX,c.scaleY=p.scaleY,c.dirty()):Dt(c,p,e);var g=s&&s.getVisual("visualMeta")&&s.getVisual("visualMeta").length>0,m={api:i,geo:l,mapOrGeoModel:e,data:s,isVisualEncodedByVisualMap:g,isGeo:o,transformInfoRaw:h};l.resourceType==="geoJSON"?this._buildGeoJSON(m):l.resourceType==="geoSVG"&&this._buildSVG(m),this._updateController(e,t,i),this._updateMapSelectHandler(e,u,i,n)},r.prototype._buildGeoJSON=function(e){var t=this._regionsGroupByName=ke(),i=ke(),n=this._regionsGroup,a=e.transformInfoRaw,o=e.mapOrGeoModel,s=e.data,l=e.geo.projection,u=l&&l.stream;function c(p,d){return d&&(p=d(p)),p&&[p[0]*a.scaleX+a.x,p[1]*a.scaleY+a.y]}function f(p){for(var d=[],g=!u&&l&&l.project,m=0;m<p.length;++m){var v=c(p[m],g);v&&d.push(v)}return d}function h(p){return{shape:{points:f(p)}}}n.removeAll(),N(e.geo.regions,function(p){var d=p.name,g=t.get(d),m=i.get(d)||{},v=m.dataIdx,_=m.regionModel;g||(g=t.set(d,new Ze),n.add(g),v=s?s.indexOfName(d):null,_=e.isGeo?o.getRegionModel(d):s?s.getItemModel(v):null,i.set(d,{dataIdx:v,regionModel:_}));var y=[],x=[];N(p.geometries,function(w){if(w.type==="polygon"){var T=[w.exterior].concat(w.interiors||[]);u&&(T=W9(T,u)),N(T,function(b){y.push(new ti(h(b)))})}else{var C=w.points;u&&(C=W9(C,u,!0)),N(C,function(b){x.push(new Qr(h(b)))})}});var M=c(p.getCenter(),l&&l.project);function S(w,T){if(w.length){var C=new tv({culling:!0,segmentIgnoreThreshold:1,shape:{paths:w}});g.add(C),B9(e,C,v,_),k9(e,C,d,_,o,v,M),T&&(F9(C),N(C.states,F9))}}S(y),S(x,!0)}),t.each(function(p,d){var g=i.get(d),m=g.dataIdx,v=g.regionModel;V9(e,p,d,v,o,m),G9(e,p,d,v,o),H9(e,p,d,v,o)},this)},r.prototype._buildSVG=function(e){var t=e.geo.map,i=e.transformInfoRaw;this._svgGroup.x=i.x,this._svgGroup.y=i.y,this._svgGroup.scaleX=i.scaleX,this._svgGroup.scaleY=i.scaleY,this._svgResourceChanged(t)&&(this._freeSVG(),this._useSVG(t));var n=this._svgDispatcherMap=ke(),a=!1;N(this._svgGraphicRecord.named,function(o){var s=o.name,l=e.mapOrGeoModel,u=e.data,c=o.svgNodeTagLower,f=o.el,h=u?u.indexOfName(s):null,p=l.getRegionModel(s);if(kve.get(c)!=null&&f instanceof gi&&B9(e,f,h,p),f instanceof gi&&(f.culling=!0),f.z2EmphasisLift=0,!o.namedFrom&&(Gve.get(c)!=null&&k9(e,f,s,p,l,h,null),V9(e,f,s,p,l,h),G9(e,f,s,p,l),Vve.get(c)!=null)){var d=H9(e,f,s,p,l);d==="self"&&(a=!0);var g=n.get(s)||n.set(s,[]);g.push(f)}},this),this._enableBlurEntireSVG(a,e)},r.prototype._enableBlurEntireSVG=function(e,t){if(e&&t.isGeo){var i=t.mapOrGeoModel.getModel(["blur","itemStyle"]).getItemStyle(),n=i.opacity;this._svgGraphicRecord.root.traverse(function(a){if(!a.isGroup){Fs(a);var o=a.ensureState("blur").style||{};o.opacity==null&&n!=null&&(o.opacity=n),a.ensureState("emphasis")}})}},r.prototype.remove=function(){this._regionsGroup.removeAll(),this._regionsGroupByName=null,this._svgGroup.removeAll(),this._freeSVG(),this._controller.dispose(),this._controllerHost=null},r.prototype.findHighDownDispatchers=function(e,t){if(e==null)return[];var i=t.coordinateSystem;if(i.resourceType==="geoJSON"){var n=this._regionsGroupByName;if(n){var a=n.get(e);return a?[a]:[]}}else if(i.resourceType==="geoSVG")return this._svgDispatcherMap&&this._svgDispatcherMap.get(e)||[]},r.prototype._svgResourceChanged=function(e){return this._svgMapName!==e},r.prototype._useSVG=function(e){var t=va.getGeoResource(e);if(t&&t.type==="geoSVG"){var i=t.useGraphic(this.uid);this._svgGroup.add(i.root),this._svgGraphicRecord=i,this._svgMapName=e}},r.prototype._freeSVG=function(){var e=this._svgMapName;if(e!=null){var t=va.getGeoResource(e);t&&t.type==="geoSVG"&&t.freeGraphic(this.uid),this._svgGraphicRecord=null,this._svgDispatcherMap=null,this._svgGroup.removeAll(),this._svgMapName=null}},r.prototype._updateController=function(e,t,i){var n=e.coordinateSystem,a=this._controller,o=this._controllerHost;o.zoomLimit=e.get("scaleLimit"),o.zoom=n.getZoom(),a.enable(e.get("roam")||!1);var s=e.mainType;function l(){var u={type:"geoRoam",componentType:s};return u[s+"Id"]=e.id,u}a.off("pan").on("pan",function(u){this._mouseDownFlag=!1,Rv(o,u.dx,u.dy),i.dispatchAction(fe(l(),{dx:u.dx,dy:u.dy,animation:{duration:0}}))},this),a.off("zoom").on("zoom",function(u){this._mouseDownFlag=!1,Lv(o,u.scale,u.originX,u.originY),i.dispatchAction(fe(l(),{zoom:u.scale,originX:u.originX,originY:u.originY,animation:{duration:0}}))},this),a.setPointerChecker(function(u,c,f){return n.containPoint([c,f])&&!Yf(u,i,e)})},r.prototype.resetForLabelLayout=function(){this.group.traverse(function(e){var t=e.getTextContent();t&&(t.ignore=X9(t).ignore)})},r.prototype._updateMapSelectHandler=function(e,t,i,n){var a=this;t.off("mousedown"),t.off("click"),e.get("selectedMode")&&(t.on("mousedown",function(){a._mouseDownFlag=!0}),t.on("click",function(o){a._mouseDownFlag&&(a._mouseDownFlag=!1)}))},r}();function B9(r,e,t,i){var n=i.getModel("itemStyle"),a=i.getModel(["emphasis","itemStyle"]),o=i.getModel(["blur","itemStyle"]),s=i.getModel(["select","itemStyle"]),l=yT(n),u=yT(a),c=yT(s),f=yT(o),h=r.data;if(h){var p=h.getItemVisual(t,"style"),d=h.getItemVisual(t,"decal");r.isVisualEncodedByVisualMap&&p.fill&&(l.fill=p.fill),d&&(l.decal=js(d,r.api))}e.setStyle(l),e.style.strokeNoScale=!0,e.ensureState("emphasis").style=u,e.ensureState("select").style=c,e.ensureState("blur").style=f,Fs(e)}function k9(r,e,t,i,n,a,o){var s=r.data,l=r.isGeo,u=s&&isNaN(s.get(s.mapDimension("value"),a)),c=s&&s.getItemLayout(a);if(l||u||c&&c.showLabel){var f=l?t:a,h=void 0;(!s||a>=0)&&(h=n);var p=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Ir(e,wr(i),{labelFetcher:h,labelDataIndex:f,defaultText:t},p);var d=e.getTextContent();if(d&&(X9(d).ignore=d.ignore,e.textConfig&&o)){var g=e.getBoundingRect().clone();e.textConfig.layoutRect=g,e.textConfig.position=[(o[0]-g.x)/g.width*100+"%",(o[1]-g.y)/g.height*100+"%"]}e.disableLabelAnimation=!0}else e.removeTextContent(),e.removeTextConfig(),e.disableLabelAnimation=null}function V9(r,e,t,i,n,a){r.data?r.data.setItemGraphicEl(a,e):rt(e).eventData={componentType:"geo",componentIndex:n.componentIndex,geoIndex:n.componentIndex,name:t,region:i&&i.option||{}}}function G9(r,e,t,i,n){r.data||Gs({el:e,componentModel:n,itemName:t,itemTooltipOption:i.get("tooltip")})}function H9(r,e,t,i,n){e.highDownSilentOnTouch=!!n.get("selectedMode");var a=i.getModel("emphasis"),o=a.get("focus");return ar(e,o,a.get("blurScope"),a.get("disabled")),r.isGeo&&v4(e,n,t),o}function W9(r,e,t){var i=[],n;function a(){n=[]}function o(){n.length&&(i.push(n),n=[])}var s=e({polygonStart:a,polygonEnd:o,lineStart:a,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&n.push([l,u])},sphere:function(){}});return!t&&s.polygonStart(),N(r,function(l){s.lineStart();for(var u=0;u<l.length;u++)s.point(l[u][0],l[u][1]);s.lineEnd()}),!t&&s.polygonEnd(),i}var _T=Hve;var Wve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){if(!(a&&a.type==="mapToggleSelect"&&a.from===this.uid)){var o=this.group;if(o.removeAll(),!t.getHostGeoModel()){if(this._mapDraw&&a&&a.type==="geoRoam"&&this._mapDraw.resetForLabelLayout(),a&&a.type==="geoRoam"&&a.componentType==="series"&&a.seriesId===t.id){var s=this._mapDraw;s&&o.add(s.group)}else if(t.needsDrawMap){var s=this._mapDraw||new _T(n);o.add(s.group),s.draw(t,i,n,this,a),this._mapDraw=s}else this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;t.get("showLegendSymbol")&&i.getComponent("legend")&&this._renderSymbols(t,i,n)}}},e.prototype.remove=function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null,this.group.removeAll()},e.prototype.dispose=function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},e.prototype._renderSymbols=function(t,i,n){var a=t.originalData,o=this.group;a.each(a.mapDimension("value"),function(s,l){if(!isNaN(s)){var u=a.getItemLayout(l);if(!(!u||!u.point)){var c=u.point,f=u.offset,h=new ua({style:{fill:t.getData().getVisual("style").fill},shape:{cx:c[0]+f*9,cy:c[1],r:3},silent:!0,z2:8+(f?0:bu+1)});if(!f){var p=t.mainSeries.getData(),d=a.getName(l),g=p.indexOfName(d),m=a.getItemModel(l),v=m.getModel("label"),_=p.getItemGraphicEl(g);Ir(h,wr(m),{labelFetcher:{getFormattedLabel:function(y,x){return t.getFormattedLabel(g,x)}},defaultText:d}),h.disableLabelAnimation=!0,v.get("position")||h.setTextConfig({position:"bottom"}),_.onHoverStateChange=function(y){Pp(h,y)}}o.add(h)}}})},e.type="map",e}(Yt),Y9=Wve;var Xve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.needsDrawMap=!1,t.seriesGroup=[],t.getTooltipPosition=function(i){if(i!=null){var n=this.getData().getName(i),a=this.coordinateSystem,o=a.getRegion(n);return o&&a.dataToPoint(o.getCenter())}},t}return e.prototype.getInitialData=function(t){for(var i=To(this,{coordDimensions:["value"],encodeDefaulter:ot(fv,this)}),n=ke(),a=[],o=0,s=i.count();o<s;o++){var l=i.getName(o);n.set(l,!0)}var u=va.load(this.getMapType(),this.option.nameMap,this.option.nameProperty);return N(u.regions,function(c){var f=c.name;n.get(f)||a.push(f)}),i.appendValues([],a),i},e.prototype.getHostGeoModel=function(){var t=this.option.geoIndex;return t!=null?this.ecModel.getComponent("geo",t):null},e.prototype.getMapType=function(){return(this.getHostGeoModel()||this).option.map},e.prototype.getRawValue=function(t){var i=this.getData();return i.get(i.mapDimension("value"),t)},e.prototype.getRegionModel=function(t){var i=this.getData();return i.getItemModel(i.indexOfName(t))},e.prototype.formatTooltip=function(t,i,n){for(var a=this.getData(),o=this.getRawValue(t),s=a.getName(t),l=this.seriesGroup,u=[],c=0;c<l.length;c++){var f=l[c].originalData.indexOfName(s),h=a.mapDimension("value");isNaN(l[c].originalData.get(h,f))||u.push(l[c].name)}return Or("section",{header:u.join(", "),noHeader:!u.length,blocks:[Or("nameValue",{name:s,value:o})]})},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.getLegendIcon=function(t){var i=t.icon||"roundRect",n=Sr(i,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill);return n.setStyle(t.itemStyle),n.style.stroke="none",i.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n},e.type="series.map",e.dependencies=["geo"],e.layoutMode="box",e.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},nameProperty:"name"},e}(jt),q9=Xve;function Yve(r,e){var t={};return N(r,function(i){i.each(i.mapDimension("value"),function(n,a){var o="ec-"+i.getName(a);t[o]=t[o]||[],isNaN(n)||t[o].push(n)})}),r[0].map(r[0].mapDimension("value"),function(i,n){for(var a="ec-"+r[0].getName(n),o=0,s=1/0,l=-1/0,u=t[a].length,c=0;c<u;c++)s=Math.min(s,t[a][c]),l=Math.max(l,t[a][c]),o+=t[a][c];var f;return e==="min"?f=s:e==="max"?f=l:e==="average"?f=o/u:f=o,u===0?NaN:f})}function zI(r){var e={};r.eachSeriesByType("map",function(t){var i=t.getHostGeoModel(),n=i?"o"+i.id:"i"+t.getMapType();(e[n]=e[n]||[]).push(t)}),N(e,function(t,i){for(var n=Yve(de(t,function(o){return o.getData()}),t[0].get("mapValueCalculation")),a=0;a<t.length;a++)t[a].originalData=t[a].getData();for(var a=0;a<t.length;a++)t[a].seriesGroup=t,t[a].needsDrawMap=a===0&&!t[a].getHostGeoModel(),t[a].setData(n.cloneShallow()),t[a].mainSeries=t[0]})}function FI(r){var e={};r.eachSeriesByType("map",function(t){var i=t.getMapType();if(!(t.getHostGeoModel()||e[i])){var n={};N(t.seriesGroup,function(o){var s=o.coordinateSystem,l=o.originalData;o.get("showLegendSymbol")&&r.getComponent("legend")&&l.each(l.mapDimension("value"),function(u,c){var f=l.getName(c),h=s.getRegion(f);if(!(!h||isNaN(u))){var p=n[f]||0,d=s.dataToPoint(h.getCenter());n[f]=p+1,l.setItemLayout(c,{point:d,offset:p})}})});var a=t.getData();a.each(function(o){var s=a.getName(o),l=a.getItemLayout(o)||{};l.showLabel=!n[s],a.setItemLayout(o,l)}),e[i]=!0}})}var Z9=fi,qve=function(r){Z(e,r);function e(t){var i=r.call(this)||this;return i.type="view",i.dimensions=["x","y"],i._roamTransformable=new Da,i._rawTransformable=new Da,i.name=t,i}return e.prototype.setBoundingRect=function(t,i,n,a){return this._rect=new lt(t,i,n,a),this._rect},e.prototype.getBoundingRect=function(){return this._rect},e.prototype.setViewRect=function(t,i,n,a){this._transformTo(t,i,n,a),this._viewRect=new lt(t,i,n,a)},e.prototype._transformTo=function(t,i,n,a){var o=this.getBoundingRect(),s=this._rawTransformable;s.transform=o.calculateTransform(new lt(t,i,n,a));var l=s.parent;s.parent=null,s.decomposeTransform(),s.parent=l,this._updateTransform()},e.prototype.setCenter=function(t,i){t&&(this._center=[ze(t[0],i.getWidth()),ze(t[1],i.getHeight())],this._updateCenterAndZoom())},e.prototype.setZoom=function(t){t=t||1;var i=this.zoomLimit;i&&(i.max!=null&&(t=Math.min(i.max,t)),i.min!=null&&(t=Math.max(i.min,t))),this._zoom=t,this._updateCenterAndZoom()},e.prototype.getDefaultCenter=function(){var t=this.getBoundingRect(),i=t.x+t.width/2,n=t.y+t.height/2;return[i,n]},e.prototype.getCenter=function(){return this._center||this.getDefaultCenter()},e.prototype.getZoom=function(){return this._zoom||1},e.prototype.getRoamTransform=function(){return this._roamTransformable.getLocalTransform()},e.prototype._updateCenterAndZoom=function(){var t=this._rawTransformable.getLocalTransform(),i=this._roamTransformable,n=this.getDefaultCenter(),a=this.getCenter(),o=this.getZoom();a=fi([],a,t),n=fi([],n,t),i.originX=a[0],i.originY=a[1],i.x=n[0]-a[0],i.y=n[1]-a[1],i.scaleX=i.scaleY=o,this._updateTransform()},e.prototype._updateTransform=function(){var t=this._roamTransformable,i=this._rawTransformable;i.parent=t,t.updateTransform(),i.updateTransform(),z0(this.transform||(this.transform=[]),i.transform||wi()),this._rawTransform=i.getLocalTransform(),this.invTransform=this.invTransform||[],qo(this.invTransform,this.transform),this.decomposeTransform()},e.prototype.getTransformInfo=function(){var t=this._rawTransformable,i=this._roamTransformable,n=new Da;return n.transform=i.transform,n.decomposeTransform(),{roam:{x:n.x,y:n.y,scaleX:n.scaleX,scaleY:n.scaleY},raw:{x:t.x,y:t.y,scaleX:t.scaleX,scaleY:t.scaleY}}},e.prototype.getViewRect=function(){return this._viewRect},e.prototype.getViewRectAfterRoam=function(){var t=this.getBoundingRect().clone();return t.applyTransform(this.transform),t},e.prototype.dataToPoint=function(t,i,n){var a=i?this._rawTransform:this.transform;return n=n||[],a?Z9(n,t,a):qi(n,t)},e.prototype.pointToData=function(t){var i=this.invTransform;return i?Z9([],t,i):[t[0],t[1]]},e.prototype.convertToPixel=function(t,i,n){var a=j9(i);return a===this?a.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,i,n){var a=j9(i);return a===this?a.pointToData(n):null},e.prototype.containPoint=function(t){return this.getViewRectAfterRoam().contain(t[0],t[1])},e.dimensions=["x","y"],e}(Da);function j9(r){var e=r.seriesModel;return e?e.coordinateSystem:null}var ku=qve;var Zve={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},BI=["lng","lat"],J9=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t)||this;a.dimensions=BI,a.type="geo",a._nameCoordMap=ke(),a.map=i;var o=n.projection,s=va.load(i,n.nameMap,n.nameProperty),l=va.getGeoResource(i),u=a.resourceType=l?l.type:null,c=a.regions=s.regions,f=Zve[l.type];a._regionsMap=s.regionsMap,a.regions=s.regions,a.projection=o;var h;if(o)for(var p=0;p<c.length;p++){var d=c[p].getBoundingRect(o);h=h||d.clone(),h.union(d)}else h=s.boundingRect;return a.setBoundingRect(h.x,h.y,h.width,h.height),a.aspectScale=o?1:ft(n.aspectScale,f.aspectScale),a._invertLongitute=o?!1:f.invertLongitute,a}return e.prototype._transformTo=function(t,i,n,a){var o=this.getBoundingRect(),s=this._invertLongitute;o=o.clone(),s&&(o.y=-o.y-o.height);var l=this._rawTransformable;l.transform=o.calculateTransform(new lt(t,i,n,a));var u=l.parent;l.parent=null,l.decomposeTransform(),l.parent=u,s&&(l.scaleY=-l.scaleY),this._updateTransform()},e.prototype.getRegion=function(t){return this._regionsMap.get(t)},e.prototype.getRegionByCoord=function(t){for(var i=this.regions,n=0;n<i.length;n++){var a=i[n];if(a.type==="geoJSON"&&a.contain(t))return i[n]}},e.prototype.addGeoCoord=function(t,i){this._nameCoordMap.set(t,i)},e.prototype.getGeoCoord=function(t){var i=this._regionsMap.get(t);return this._nameCoordMap.get(t)||i&&i.getCenter()},e.prototype.dataToPoint=function(t,i,n){if(Ce(t)&&(t=this.getGeoCoord(t)),t){var a=this.projection;return a&&(t=a.project(t)),t&&this.projectedToPoint(t,i,n)}},e.prototype.pointToData=function(t){var i=this.projection;return i&&(t=i.unproject(t)),t&&this.pointToProjected(t)},e.prototype.pointToProjected=function(t){return r.prototype.pointToData.call(this,t)},e.prototype.projectedToPoint=function(t,i,n){return r.prototype.dataToPoint.call(this,t,i,n)},e.prototype.convertToPixel=function(t,i,n){var a=K9(i);return a===this?a.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,i,n){var a=K9(i);return a===this?a.pointToData(n):null},e}(ku);br(J9,ku);function K9(r){var e=r.geoModel,t=r.seriesModel;return e?e.coordinateSystem:t?t.coordinateSystem||(t.getReferringComponents("geo",Ar).models[0]||{}).coordinateSystem:null}var kI=J9;function $9(r,e){var t=r.get("boundingCoords");if(t!=null){var i=t[0],n=t[1];if(isFinite(i[0])&&isFinite(i[1])&&isFinite(n[0])&&isFinite(n[1])){var a=this.projection;if(a){var o=i[0],s=i[1],l=n[0],u=n[1];i=[1/0,1/0],n=[-1/0,-1/0];var c=function(S,w,T,C){for(var b=T-S,E=C-w,I=0;I<=100;I++){var R=I/100,A=a.project([S+b*R,w+E*R]);po(i,i,A),mo(n,n,A)}};c(o,s,l,s),c(l,s,l,u),c(l,u,o,u),c(o,u,l,s)}this.setBoundingRect(i[0],i[1],n[0]-i[0],n[1]-i[1])}}var f=this.getBoundingRect(),h=r.get("layoutCenter"),p=r.get("layoutSize"),d=e.getWidth(),g=e.getHeight(),m=f.width/f.height*this.aspectScale,v=!1,_,y;h&&p&&(_=[ze(h[0],d),ze(h[1],g)],y=ze(p,Math.min(d,g)),!isNaN(_[0])&&!isNaN(_[1])&&!isNaN(y)&&(v=!0));var x;if(v)x={},m>1?(x.width=y,x.height=y/m):(x.height=y,x.width=y*m),x.y=_[1]-x.height/2,x.x=_[0]-x.width/2;else{var M=r.getBoxLayoutParams();M.aspect=m,x=xr(M,{width:d,height:g})}this.setViewRect(x.x,x.y,x.width,x.height),this.setCenter(r.get("center"),e),this.setZoom(r.get("zoom"))}function jve(r,e){N(e.get("geoCoord"),function(t,i){r.addGeoCoord(i,t)})}var Kve=function(){function r(){this.dimensions=BI}return r.prototype.create=function(e,t){var i=[];function n(o){return{nameProperty:o.get("nameProperty"),aspectScale:o.get("aspectScale"),projection:o.get("projection")}}e.eachComponent("geo",function(o,s){var l=o.get("map"),u=new kI(l+s,l,fe({nameMap:o.get("nameMap")},n(o)));u.zoomLimit=o.get("scaleLimit"),i.push(u),o.coordinateSystem=u,u.model=o,u.resize=$9,u.resize(o,t)}),e.eachSeries(function(o){var s=o.get("coordinateSystem");if(s==="geo"){var l=o.get("geoIndex")||0;o.coordinateSystem=i[l]}});var a={};return e.eachSeriesByType("map",function(o){if(!o.getHostGeoModel()){var s=o.getMapType();a[s]=a[s]||[],a[s].push(o)}}),N(a,function(o,s){var l=de(o,function(c){return c.get("nameMap")}),u=new kI(s,s,fe({nameMap:bm(l)},n(o[0])));u.zoomLimit=Br.apply(null,de(o,function(c){return c.get("scaleLimit")})),i.push(u),u.resize=$9,u.resize(o[0],t),N(o,function(c){c.coordinateSystem=u,jve(u,c)})}),i},r.prototype.getFilledRegions=function(e,t,i,n){for(var a=(e||[]).slice(),o=ke(),s=0;s<a.length;s++)o.set(a[s].name,a[s]);var l=va.load(t,i,n);return N(l.regions,function(u){var c=u.name;!o.get(c)&&a.push({name:c})}),a},r}(),Jve=new Kve,xT=Jve;var $ve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i,n){var a=va.getGeoResource(t.map);if(a&&a.type==="geoJSON"){var o=t.itemStyle=t.itemStyle||{};"color"in o||(o.color="#eee")}this.mergeDefaultAndTheme(t,n),yo(t,"label",["show"])},e.prototype.optionUpdated=function(){var t=this,i=this.option;i.regions=xT.getFilledRegions(i.regions,i.map,i.nameMap,i.nameProperty);var n={};this._optionModelMap=gn(i.regions||[],function(a,o){var s=o.name;return s&&(a.set(s,new Zt(o,t,t.ecModel)),o.selected&&(n[s]=!0)),a},ke()),i.selectedMap||(i.selectedMap=n)},e.prototype.getRegionModel=function(t){return this._optionModelMap.get(t)||new Zt(null,this,this.ecModel)},e.prototype.getFormattedLabel=function(t,i){var n=this.getRegionModel(t),a=i==="normal"?n.get(["label","formatter"]):n.get(["emphasis","label","formatter"]),o={name:t};if(He(a))return o.status=i,a(o);if(Ce(a))return a.replace("{a}",t??"")},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.select=function(t){var i=this.option,n=i.selectedMode;if(n){n!=="multiple"&&(i.selectedMap=null);var a=i.selectedMap||(i.selectedMap={});a[t]=!0}},e.prototype.unSelect=function(t){var i=this.option.selectedMap;i&&(i[t]=!1)},e.prototype.toggleSelected=function(t){this[this.isSelected(t)?"unSelect":"select"](t)},e.prototype.isSelected=function(t){var i=this.option.selectedMap;return!!(i&&i[t])},e.type="geo",e.layoutMode="box",e.defaultOption={z:0,show:!0,left:"center",top:"center",aspectScale:null,silent:!1,map:"",boundingCoords:null,center:null,zoom:1,scaleLimit:null,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},regions:[]},e}(Pt),Q9=$ve;function e7(r,e){return r.pointToProjected?r.pointToProjected(e):r.pointToData(e)}function Pv(r,e,t,i){var n=r.getZoom(),a=r.getCenter(),o=e.zoom,s=r.projectedToPoint?r.projectedToPoint(a):r.dataToPoint(a);if(e.dx!=null&&e.dy!=null&&(s[0]-=e.dx,s[1]-=e.dy,r.setCenter(e7(r,s),i)),o!=null){if(t){var l=t.min||0,u=t.max||1/0;o=Math.max(Math.min(n*o,u),l)/n}r.scaleX*=o,r.scaleY*=o;var c=(e.originX-r.x)*(o-1),f=(e.originY-r.y)*(o-1);r.x-=c,r.y-=f,r.updateTransform(),r.setCenter(e7(r,s),i),r.setZoom(o*n)}return{center:r.getCenter(),zoom:r.getZoom()}}var Qve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.focusBlurEnabled=!0,t}return e.prototype.init=function(t,i){this._api=i},e.prototype.render=function(t,i,n,a){if(this._model=t,!t.get("show")){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;return}this._mapDraw||(this._mapDraw=new _T(n));var o=this._mapDraw;o.draw(t,i,n,this,a),o.group.on("click",this._handleRegionClick,this),o.group.silent=t.get("silent"),this.group.add(o.group),this.updateSelectStatus(t,i,n)},e.prototype._handleRegionClick=function(t){var i;qs(t.target,function(n){return(i=rt(n).eventData)!=null},!0),i&&this._api.dispatchAction({type:"geoToggleSelect",geoId:this._model.id,name:i.name})},e.prototype.updateSelectStatus=function(t,i,n){var a=this;this._mapDraw.group.traverse(function(o){var s=rt(o).eventData;if(s)return a._model.isSelected(s.name)?n.enterSelect(o):n.leaveSelect(o),!0})},e.prototype.findHighDownDispatchers=function(t){return this._mapDraw&&this._mapDraw.findHighDownDispatchers(t,this._model)},e.prototype.dispose=function(){this._mapDraw&&this._mapDraw.remove()},e.type="geo",e}(er),t7=Qve;function ege(r,e,t){va.registerMap(r,e,t)}function Sx(r){r.registerCoordinateSystem("geo",xT),r.registerComponentModel(Q9),r.registerComponentView(t7),r.registerImpl("registerMap",ege),r.registerImpl("getMap",function(t){return va.getMapForUser(t)});function e(t,i){i.update="geo:updateSelectStatus",r.registerAction(i,function(n,a){var o={},s=[];return a.eachComponent({mainType:"geo",query:n},function(l){l[t](n.name);var u=l.coordinateSystem;N(u.regions,function(f){o[f.name]=l.isSelected(f.name)||!1});var c=[];N(o,function(f,h){o[h]&&c.push(h)}),s.push({geoIndex:l.componentIndex,name:c})}),{selected:o,allSelected:s,name:n.name}})}e("toggleSelected",{type:"geoToggleSelect",event:"geoselectchanged"}),e("select",{type:"geoSelect",event:"geoselected"}),e("unSelect",{type:"geoUnSelect",event:"geounselected"}),r.registerAction({type:"geoRoam",event:"geoRoam",update:"updateTransform"},function(t,i,n){var a=t.componentType||"series";i.eachComponent({mainType:a,query:t},function(o){var s=o.coordinateSystem;if(s.type==="geo"){var l=Pv(s,t,o.get("scaleLimit"),n);o.setCenter&&o.setCenter(l.center),o.setZoom&&o.setZoom(l.zoom),a==="series"&&N(o.seriesGroup,function(u){u.setCenter(l.center),u.setZoom(l.zoom)})}})})}function VI(r){It(Sx),r.registerChartView(Y9),r.registerSeriesModel(q9),r.registerLayout(FI),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,zI),n1("map",r.registerAction)}function r7(r){var e=r;e.hierNode={defaultAncestor:null,ancestor:e,prelim:0,modifier:0,change:0,shift:0,i:0,thread:null};for(var t=[e],i,n;i=t.pop();)if(n=i.children,i.isExpand&&n.length)for(var a=n.length,o=a-1;o>=0;o--){var s=n[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},t.push(s)}}function i7(r,e){var t=r.isExpand?r.children:[],i=r.parentNode.children,n=r.hierNode.i?i[r.hierNode.i-1]:null;if(t.length){tge(r);var a=(t[0].hierNode.prelim+t[t.length-1].hierNode.prelim)/2;n?(r.hierNode.prelim=n.hierNode.prelim+e(r,n),r.hierNode.modifier=r.hierNode.prelim-a):r.hierNode.prelim=a}else n&&(r.hierNode.prelim=n.hierNode.prelim+e(r,n));r.parentNode.hierNode.defaultAncestor=rge(r,n,r.parentNode.hierNode.defaultAncestor||i[0],e)}function n7(r){var e=r.hierNode.prelim+r.parentNode.hierNode.modifier;r.setLayout({x:e},!0),r.hierNode.modifier+=r.parentNode.hierNode.modifier}function WI(r){return arguments.length?r:age}function nd(r,e){return r-=Math.PI/2,{x:e*Math.cos(r),y:e*Math.sin(r)}}function a7(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function tge(r){for(var e=r.children,t=e.length,i=0,n=0;--t>=0;){var a=e[t];a.hierNode.prelim+=i,a.hierNode.modifier+=i,n+=a.hierNode.change,i+=a.hierNode.shift+n}}function rge(r,e,t,i){if(e){for(var n=r,a=r,o=a.parentNode.children[0],s=e,l=n.hierNode.modifier,u=a.hierNode.modifier,c=o.hierNode.modifier,f=s.hierNode.modifier;s=GI(s),a=HI(a),s&&a;){n=GI(n),o=HI(o),n.hierNode.ancestor=r;var h=s.hierNode.prelim+f-a.hierNode.prelim-u+i(s,a);h>0&&(nge(ige(s,r,t),r,h),u+=h,l+=h),f+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=n.hierNode.modifier,c+=o.hierNode.modifier}s&&!GI(n)&&(n.hierNode.thread=s,n.hierNode.modifier+=f-l),a&&!HI(o)&&(o.hierNode.thread=a,o.hierNode.modifier+=u-c,t=r)}return t}function GI(r){var e=r.children;return e.length&&r.isExpand?e[e.length-1]:r.hierNode.thread}function HI(r){var e=r.children;return e.length&&r.isExpand?e[0]:r.hierNode.thread}function ige(r,e,t){return r.hierNode.ancestor.parentNode===e.parentNode?r.hierNode.ancestor:t}function nge(r,e,t){var i=t/(e.hierNode.i-r.hierNode.i);e.hierNode.change-=i,e.hierNode.shift+=t,e.hierNode.modifier+=t,e.hierNode.prelim+=t,r.hierNode.change+=i}function age(r,e){return r.parentNode===e.parentNode?1:2}var oge=function(){function r(){this.parentPoint=[],this.childPoints=[]}return r}(),sge=function(r){Z(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new oge},e.prototype.buildPath=function(t,i){var n=i.childPoints,a=n.length,o=i.parentPoint,s=n[0],l=n[a-1];if(a===1){t.moveTo(o[0],o[1]),t.lineTo(s[0],s[1]);return}var u=i.orient,c=u==="TB"||u==="BT"?0:1,f=1-c,h=ze(i.forkPosition,1),p=[];p[c]=o[c],p[f]=o[f]+(l[f]-o[f])*h,t.moveTo(o[0],o[1]),t.lineTo(p[0],p[1]),t.moveTo(s[0],s[1]),p[c]=s[c],t.lineTo(p[0],p[1]),p[c]=l[c],t.lineTo(p[0],p[1]),t.lineTo(l[0],l[1]);for(var d=1;d<a-1;d++){var g=n[d];t.moveTo(g[0],g[1]),p[c]=g[c],t.lineTo(p[0],p[1])}},e}(ut),lge=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._mainGroup=new Ze,t}return e.prototype.init=function(t,i){this._controller=new jl(i.getZr()),this._controllerHost={target:this.group},this.group.add(this._mainGroup)},e.prototype.render=function(t,i,n){var a=t.getData(),o=t.layoutInfo,s=this._mainGroup,l=t.get("layout");l==="radial"?(s.x=o.x+o.width/2,s.y=o.y+o.height/2):(s.x=o.x,s.y=o.y),this._updateViewCoordSys(t,n),this._updateController(t,i,n);var u=this._data;a.diff(u).add(function(c){o7(a,c)&&s7(a,c,null,s,t)}).update(function(c,f){var h=u.getItemGraphicEl(f);if(!o7(a,c)){h&&u7(u,f,h,s,t);return}s7(a,c,h,s,t)}).remove(function(c){var f=u.getItemGraphicEl(c);f&&u7(u,c,f,s,t)}).execute(),this._nodeScaleRatio=t.get("nodeScaleRatio"),this._updateNodeAndLinkScale(t),t.get("expandAndCollapse")===!0&&a.eachItemGraphicEl(function(c,f){c.off("click").on("click",function(){n.dispatchAction({type:"treeExpandAndCollapse",seriesId:t.id,dataIndex:f})})}),this._data=a},e.prototype._updateViewCoordSys=function(t,i){var n=t.getData(),a=[];n.each(function(f){var h=n.getItemLayout(f);h&&!isNaN(h.x)&&!isNaN(h.y)&&a.push([+h.x,+h.y])});var o=[],s=[];wp(a,o,s);var l=this._min,u=this._max;s[0]-o[0]===0&&(o[0]=l?l[0]:o[0]-1,s[0]=u?u[0]:s[0]+1),s[1]-o[1]===0&&(o[1]=l?l[1]:o[1]-1,s[1]=u?u[1]:s[1]+1);var c=t.coordinateSystem=new ku;c.zoomLimit=t.get("scaleLimit"),c.setBoundingRect(o[0],o[1],s[0]-o[0],s[1]-o[1]),c.setCenter(t.get("center"),i),c.setZoom(t.get("zoom")),this.group.attr({x:c.x,y:c.y,scaleX:c.scaleX,scaleY:c.scaleY}),this._min=o,this._max=s},e.prototype._updateController=function(t,i,n){var a=this,o=this._controller,s=this._controllerHost,l=this.group;o.setPointerChecker(function(u,c,f){var h=l.getBoundingRect();return h.applyTransform(l.transform),h.contain(c,f)&&!Yf(u,n,t)}),o.enable(t.get("roam")),s.zoomLimit=t.get("scaleLimit"),s.zoom=t.coordinateSystem.getZoom(),o.off("pan").off("zoom").on("pan",function(u){Rv(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"treeRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){Lv(s,u.scale,u.originX,u.originY),n.dispatchAction({seriesId:t.id,type:"treeRoam",zoom:u.scale,originX:u.originX,originY:u.originY}),a._updateNodeAndLinkScale(t),n.updateLabelLayout()})},e.prototype._updateNodeAndLinkScale=function(t){var i=t.getData(),n=this._getNodeGlobalScale(t);i.eachItemGraphicEl(function(a,o){a.setSymbolScale(n)})},e.prototype._getNodeGlobalScale=function(t){var i=t.coordinateSystem;if(i.type!=="view")return 1;var n=this._nodeScaleRatio,a=i.scaleX||1,o=i.getZoom(),s=(o-1)*n+1;return s/a},e.prototype.dispose=function(){this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype.remove=function(){this._mainGroup.removeAll(),this._data=null},e.type="tree",e}(Yt);function o7(r,e){var t=r.getItemLayout(e);return t&&!isNaN(t.x)&&!isNaN(t.y)}function s7(r,e,t,i,n){var a=!t,o=r.tree.getNodeByDataIndex(e),s=o.getModel(),l=o.getVisual("style").fill,u=o.isExpand===!1&&o.children.length!==0?l:"#fff",c=r.tree.root,f=o.parentNode===c?o:o.parentNode||o,h=r.getItemGraphicEl(f.dataIndex),p=f.getLayout(),d=h?{x:h.__oldX,y:h.__oldY,rawX:h.__radialOldRawX,rawY:h.__radialOldRawY}:p,g=o.getLayout();a?(t=new Bu(r,e,null,{symbolInnerColor:u,useNameLabel:!0}),t.x=d.x,t.y=d.y):t.updateData(r,e,null,{symbolInnerColor:u,useNameLabel:!0}),t.__radialOldRawX=t.__radialRawX,t.__radialOldRawY=t.__radialRawY,t.__radialRawX=g.rawX,t.__radialRawY=g.rawY,i.add(t),r.setItemGraphicEl(e,t),t.__oldX=t.x,t.__oldY=t.y,Dt(t,{x:g.x,y:g.y},n);var m=t.getSymbolPath();if(n.get("layout")==="radial"){var v=c.children[0],_=v.getLayout(),y=v.children.length,x=void 0,M=void 0;if(g.x===_.x&&o.isExpand===!0&&v.children.length){var S={x:(v.children[0].getLayout().x+v.children[y-1].getLayout().x)/2,y:(v.children[0].getLayout().y+v.children[y-1].getLayout().y)/2};x=Math.atan2(S.y-_.y,S.x-_.x),x<0&&(x=Math.PI*2+x),M=S.x<_.x,M&&(x=x-Math.PI)}else x=Math.atan2(g.y-_.y,g.x-_.x),x<0&&(x=Math.PI*2+x),o.children.length===0||o.children.length!==0&&o.isExpand===!1?(M=g.x<_.x,M&&(x=x-Math.PI)):(M=g.x>_.x,M||(x=x-Math.PI));var w=M?"left":"right",T=s.getModel("label"),C=T.get("rotate"),b=C*(Math.PI/180),E=m.getTextContent();E&&(m.setTextConfig({position:T.get("position")||w,rotation:C==null?-x:b,origin:"center"}),E.setStyle("verticalAlign","middle"))}var I=s.get(["emphasis","focus"]),R=I==="relative"?rp(o.getAncestorsIndices(),o.getDescendantIndices()):I==="ancestor"?o.getAncestorsIndices():I==="descendant"?o.getDescendantIndices():null;R&&(rt(t).focus=R),uge(n,o,c,t,d,p,g,i),t.__edge&&(t.onHoverStateChange=function(A){if(A!=="blur"){var D=o.parentNode&&r.getItemGraphicEl(o.parentNode.dataIndex);D&&D.hoverState===Lp||Pp(t.__edge,A)}})}function uge(r,e,t,i,n,a,o,s){var l=e.getModel(),u=r.get("edgeShape"),c=r.get("layout"),f=r.getOrient(),h=r.get(["lineStyle","curveness"]),p=r.get("edgeForkPosition"),d=l.getModel("lineStyle").getLineStyle(),g=i.__edge;if(u==="curve")e.parentNode&&e.parentNode!==t&&(g||(g=i.__edge=new Np({shape:XI(c,f,h,n,n)})),Dt(g,{shape:XI(c,f,h,a,o)},r));else if(u==="polyline"&&c==="orthogonal"&&e!==t&&e.children&&e.children.length!==0&&e.isExpand===!0){for(var m=e.children,v=[],_=0;_<m.length;_++){var y=m[_].getLayout();v.push([y.x,y.y])}g||(g=i.__edge=new sge({shape:{parentPoint:[o.x,o.y],childPoints:[[o.x,o.y]],orient:f,forkPosition:p}})),Dt(g,{shape:{parentPoint:[o.x,o.y],childPoints:v}},r)}g&&!(u==="polyline"&&!e.isExpand)&&(g.useStyle(Ye({strokeNoScale:!0,fill:null},d)),Gr(g,l,"lineStyle"),Fs(g),s.add(g))}function l7(r,e,t,i,n){var a=e.tree.root,o=c7(a,r),s=o.source,l=o.sourceLayout,u=e.getItemGraphicEl(r.dataIndex);if(u){var c=e.getItemGraphicEl(s.dataIndex),f=c.__edge,h=u.__edge||(s.isExpand===!1||s.children.length===1?f:void 0),p=i.get("edgeShape"),d=i.get("layout"),g=i.get("orient"),m=i.get(["lineStyle","curveness"]);h&&(p==="curve"?ts(h,{shape:XI(d,g,m,l,l),style:{opacity:0}},i,{cb:function(){t.remove(h)},removeOpt:n}):p==="polyline"&&i.get("layout")==="orthogonal"&&ts(h,{shape:{parentPoint:[l.x,l.y],childPoints:[[l.x,l.y]]},style:{opacity:0}},i,{cb:function(){t.remove(h)},removeOpt:n}))}}function c7(r,e){for(var t=e.parentNode===r?e:e.parentNode||e,i;i=t.getLayout(),i==null;)t=t.parentNode===r?t:t.parentNode||t;return{source:t,sourceLayout:i}}function u7(r,e,t,i,n){var a=r.tree.getNodeByDataIndex(e),o=r.tree.root,s=c7(o,a).sourceLayout,l={duration:n.get("animationDurationUpdate"),easing:n.get("animationEasingUpdate")};ts(t,{x:s.x+1,y:s.y+1},n,{cb:function(){i.remove(t),r.setItemGraphicEl(e,null)},removeOpt:l}),t.fadeOut(null,r.hostModel,{fadeLabel:!0,animation:l}),a.children.forEach(function(u){l7(u,r,i,n,l)}),l7(a,r,i,n,l)}function XI(r,e,t,i,n){var a,o,s,l,u,c,f,h;if(r==="radial"){u=i.rawX,f=i.rawY,c=n.rawX,h=n.rawY;var p=nd(u,f),d=nd(u,f+(h-f)*t),g=nd(c,h+(f-h)*t),m=nd(c,h);return{x1:p.x||0,y1:p.y||0,x2:m.x||0,y2:m.y||0,cpx1:d.x||0,cpy1:d.y||0,cpx2:g.x||0,cpy2:g.y||0}}else u=i.x,f=i.y,c=n.x,h=n.y,(e==="LR"||e==="RL")&&(a=u+(c-u)*t,o=f,s=c+(u-c)*t,l=h),(e==="TB"||e==="BT")&&(a=u,o=f+(h-f)*t,s=c,l=h+(f-h)*t);return{x1:u,y1:f,x2:c,y2:h,cpx1:a,cpy1:o,cpx2:s,cpy2:l}}var f7=lge;var hs=vt();function cge(r){var e=r.mainData,t=r.datas;t||(t={main:e},r.datasAttr={main:"data"}),r.datas=r.mainData=null,h7(e,t,r),N(t,function(i){N(e.TRANSFERABLE_METHODS,function(n){i.wrapMethod(n,ot(fge,r))})}),e.wrapMethod("cloneShallow",ot(pge,r)),N(e.CHANGABLE_METHODS,function(i){e.wrapMethod(i,ot(hge,r))}),kr(t[e.dataType]===e)}function fge(r,e){if(vge(this)){var t=fe({},hs(this).datas);t[this.dataType]=e,h7(e,t,r)}else YI(e,this.dataType,hs(this).mainData,r);return e}function hge(r,e){return r.struct&&r.struct.update(),e}function pge(r,e){return N(hs(e).datas,function(t,i){t!==e&&YI(t.cloneShallow(),i,e,r)}),e}function dge(r){var e=hs(this).mainData;return r==null||e==null?e:hs(e).datas[r]}function mge(){var r=hs(this).mainData;return r==null?[{data:r}]:de(bt(hs(r).datas),function(e){return{type:e,data:hs(r).datas[e]}})}function vge(r){return hs(r).mainData===r}function h7(r,e,t){hs(r).datas={},N(e,function(i,n){YI(i,n,r,t)})}function YI(r,e,t,i){hs(t).datas[e]=r,hs(r).mainData=t,r.dataType=e,i.struct&&(r[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=r),r.getLinkedData=dge,r.getLinkedDataAll=mge}var ST=cge;var gge=function(){function r(e,t){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=e||"",this.hostTree=t}return r.prototype.isRemoved=function(){return this.dataIndex<0},r.prototype.eachNode=function(e,t,i){He(e)&&(i=t,t=e,e=null),e=e||{},Ce(e)&&(e={order:e});var n=e.order||"preorder",a=this[e.attr||"children"],o;n==="preorder"&&(o=t.call(i,this));for(var s=0;!o&&s<a.length;s++)a[s].eachNode(e,t,i);n==="postorder"&&t.call(i,this)},r.prototype.updateDepthAndHeight=function(e){var t=0;this.depth=e;for(var i=0;i<this.children.length;i++){var n=this.children[i];n.updateDepthAndHeight(e+1),n.height>t&&(t=n.height)}this.height=t+1},r.prototype.getNodeById=function(e){if(this.getId()===e)return this;for(var t=0,i=this.children,n=i.length;t<n;t++){var a=i[t].getNodeById(e);if(a)return a}},r.prototype.contains=function(e){if(e===this)return!0;for(var t=0,i=this.children,n=i.length;t<n;t++){var a=i[t].contains(e);if(a)return a}},r.prototype.getAncestors=function(e){for(var t=[],i=e?this:this.parentNode;i;)t.push(i),i=i.parentNode;return t.reverse(),t},r.prototype.getAncestorsIndices=function(){for(var e=[],t=this;t;)e.push(t.dataIndex),t=t.parentNode;return e.reverse(),e},r.prototype.getDescendantIndices=function(){var e=[];return this.eachNode(function(t){e.push(t.dataIndex)}),e},r.prototype.getValue=function(e){var t=this.hostTree.data;return t.getStore().get(t.getDimensionIndex(e||"value"),this.dataIndex)},r.prototype.setLayout=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemLayout(this.dataIndex,e,t)},r.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},r.prototype.getModel=function(e){if(!(this.dataIndex<0)){var t=this.hostTree,i=t.data.getItemModel(this.dataIndex);return i.getModel(e)}},r.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},r.prototype.setVisual=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,e,t)},r.prototype.getVisual=function(e){return this.hostTree.data.getItemVisual(this.dataIndex,e)},r.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},r.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},r.prototype.getChildIndex=function(){if(this.parentNode){for(var e=this.parentNode.children,t=0;t<e.length;++t)if(e[t]===this)return t;return-1}return-1},r.prototype.isAncestorOf=function(e){for(var t=e.parentNode;t;){if(t===this)return!0;t=t.parentNode}return!1},r.prototype.isDescendantOf=function(e){return e!==this&&e.isAncestorOf(this)},r}();var yge=function(){function r(e){this.type="tree",this._nodes=[],this.hostModel=e}return r.prototype.eachNode=function(e,t,i){this.root.eachNode(e,t,i)},r.prototype.getNodeByDataIndex=function(e){var t=this.data.getRawIndex(e);return this._nodes[t]},r.prototype.getNodeById=function(e){return this.root.getNodeById(e)},r.prototype.update=function(){for(var e=this.data,t=this._nodes,i=0,n=t.length;i<n;i++)t[i].dataIndex=-1;for(var i=0,n=e.count();i<n;i++)t[e.getRawIndex(i)].dataIndex=i},r.prototype.clearLayouts=function(){this.data.clearItemLayouts()},r.createTree=function(e,t,i){var n=new r(t),a=[],o=1;s(e);function s(c,f){var h=c.value;o=Math.max(o,pe(h)?h.length:1),a.push(c);var p=new gge(qr(c.name,""),n);f?_ge(p,f):n.root=p,n._nodes.push(p);var d=c.children;if(d)for(var g=0;g<d.length;g++)s(d[g],p)}n.root.updateDepthAndHeight(0);var l=Ks(a,{coordDimensions:["value"],dimensionsCount:o}).dimensions,u=new ri(l,t);return u.initData(a),i&&i(u),ST({mainData:u,struct:n,structAttr:"tree"}),n.update(),n},r}();function _ge(r,e){var t=e.children;r.parentNode!==e&&(t.push(r),r.parentNode=e)}var Dv=yge;function Vu(r,e,t){if(r&&dt(e,r.type)>=0){var i=t.getData().tree.root,n=r.targetNode;if(Ce(n)&&(n=i.getNodeById(n)),n&&i.contains(n))return{node:n};var a=r.targetNodeId;if(a!=null&&(n=i.getNodeById(a)))return{node:n}}}function qI(r){for(var e=[];r;)r=r.parentNode,r&&e.push(r);return e.reverse()}function Iv(r,e){var t=qI(r);return dt(t,e)>=0}function Zf(r,e){for(var t=[];r;){var i=r.dataIndex;t.push({name:r.name,dataIndex:i,value:e.getRawValue(i)}),r=r.parentNode}return t.reverse(),t}var xge=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.hasSymbolVisual=!0,t.ignoreStyleOnData=!0,t}return e.prototype.getInitialData=function(t){var i={name:t.name,children:t.data},n=t.leaves||{},a=new Zt(n,this,this.ecModel),o=Dv.createTree(i,this,s);function s(f){f.wrapMethod("getItemModel",function(h,p){var d=o.getNodeByDataIndex(p);return d&&d.children.length&&d.isExpand||(h.parentModel=a),h})}var l=0;o.eachNode("preorder",function(f){f.depth>l&&(l=f.depth)});var u=t.expandAndCollapse,c=u&&t.initialTreeDepth>=0?t.initialTreeDepth:l;return o.root.eachNode("preorder",function(f){var h=f.hostTree.data.getRawDataItem(f.dataIndex);f.isExpand=h&&h.collapsed!=null?!h.collapsed:f.depth<=c}),o.data},e.prototype.getOrient=function(){var t=this.get("orient");return t==="horizontal"?t="LR":t==="vertical"&&(t="TB"),t},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.formatTooltip=function(t,i,n){for(var a=this.getData().tree,o=a.root.children[0],s=a.getNodeByDataIndex(t),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return Or("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},e.prototype.getDataParams=function(t){var i=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return i.treeAncestors=Zf(n,this),i.collapsed=!n.isExpand,i},e.type="series.tree",e.layoutMode="box",e.defaultOption={z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},e}(jt),p7=xge;function d7(r,e,t){for(var i=[r],n=[],a;a=i.pop();)if(n.push(a),a.isExpand){var o=a.children;if(o.length)for(var s=0;s<o.length;s++)i.push(o[s])}for(;a=n.pop();)e(a,t)}function Nv(r,e){for(var t=[r],i;i=t.pop();)if(e(i),i.isExpand){var n=i.children;if(n.length)for(var a=n.length-1;a>=0;a--)t.push(n[a])}}function jI(r,e){r.eachSeriesByType("tree",function(t){Sge(t,e)})}function Sge(r,e){var t=a7(r,e);r.layoutInfo=t;var i=r.get("layout"),n=0,a=0,o=null;i==="radial"?(n=2*Math.PI,a=Math.min(t.height,t.width)/2,o=WI(function(y,x){return(y.parentNode===x.parentNode?1:2)/y.depth})):(n=t.width,a=t.height,o=WI());var s=r.getData().tree.root,l=s.children[0];if(l){r7(s),d7(l,i7,o),s.hierNode.modifier=-l.hierNode.prelim,Nv(l,n7);var u=l,c=l,f=l;Nv(l,function(y){var x=y.getLayout().x;x<u.getLayout().x&&(u=y),x>c.getLayout().x&&(c=y),y.depth>f.depth&&(f=y)});var h=u===c?1:o(u,c)/2,p=h-u.getLayout().x,d=0,g=0,m=0,v=0;if(i==="radial")d=n/(c.getLayout().x+h+p),g=a/(f.depth-1||1),Nv(l,function(y){m=(y.getLayout().x+p)*d,v=(y.depth-1)*g;var x=nd(m,v);y.setLayout({x:x.x,y:x.y,rawX:m,rawY:v},!0)});else{var _=r.getOrient();_==="RL"||_==="LR"?(g=a/(c.getLayout().x+h+p),d=n/(f.depth-1||1),Nv(l,function(y){v=(y.getLayout().x+p)*g,m=_==="LR"?(y.depth-1)*d:n-(y.depth-1)*d,y.setLayout({x:m,y:v},!0)})):(_==="TB"||_==="BT")&&(d=n/(c.getLayout().x+h+p),g=a/(f.depth-1||1),Nv(l,function(y){m=(y.getLayout().x+p)*d,v=_==="TB"?(y.depth-1)*g:a-(y.depth-1)*g,y.setLayout({x:m,y:v},!0)}))}}}function KI(r){r.eachSeriesByType("tree",function(e){var t=e.getData(),i=t.tree;i.eachNode(function(n){var a=n.getModel(),o=a.getModel("itemStyle").getItemStyle(),s=t.ensureUniqueItemVisual(n.dataIndex,"style");fe(s,o)})})}function m7(r){r.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(e,t){t.eachComponent({mainType:"series",subType:"tree",query:e},function(i){var n=e.dataIndex,a=i.getData().tree,o=a.getNodeByDataIndex(n);o.isExpand=!o.isExpand})}),r.registerAction({type:"treeRoam",event:"treeRoam",update:"none"},function(e,t,i){t.eachComponent({mainType:"series",subType:"tree",query:e},function(n){var a=n.coordinateSystem,o=Pv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}function JI(r){r.registerChartView(f7),r.registerSeriesModel(p7),r.registerLayout(jI),r.registerVisual(KI),m7(r)}var v7=["treemapZoomToNode","treemapRender","treemapMove"];function g7(r){for(var e=0;e<v7.length;e++)r.registerAction({type:v7[e],update:"updateView"},Dr);r.registerAction({type:"treemapRootToNode",update:"updateView"},function(t,i){i.eachComponent({mainType:"series",subType:"treemap",query:t},n);function n(a,o){var s=["treemapZoomToNode","treemapRootToNode"],l=Vu(t,s,a);if(l){var u=a.getViewRoot();u&&(t.direction=Iv(u,l.node)?"rollUp":"drillDown"),a.resetViewRoot(l.node)}}})}function Mx(r){var e=r.getData(),t=e.tree,i={};t.eachNode(function(n){for(var a=n;a&&a.depth>1;)a=a.parentNode;var o=D_(r.ecModel,a.name||a.dataIndex+"",i);n.setVisual("decal",o)})}var Mge=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.preventUsingHoverLayer=!0,t}return e.prototype.getInitialData=function(t,i){var n={name:t.name,children:t.data};y7(n);var a=t.levels||[],o=this.designatedVisualItemStyle={},s=new Zt({itemStyle:o},this,i);a=t.levels=bge(a,i);var l=de(a||[],function(f){return new Zt(f,s,i)},this),u=Dv.createTree(n,this,c);function c(f){f.wrapMethod("getItemModel",function(h,p){var d=u.getNodeByDataIndex(p),g=d?l[d.depth]:null;return h.parentModel=g||s,h})}return u.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=this.getRawValue(t),s=a.getName(t);return Or("nameValue",{name:s,value:o})},e.prototype.getDataParams=function(t){var i=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return i.treeAncestors=Zf(n,this),i.treePathInfo=i.treeAncestors,i},e.prototype.setLayoutInfo=function(t){this.layoutInfo=this.layoutInfo||{},fe(this.layoutInfo,t)},e.prototype.mapIdToIndex=function(t){var i=this._idIndexMap;i||(i=this._idIndexMap=ke(),this._idIndexMapCount=0);var n=i.get(t);return n==null&&i.set(t,n=this._idIndexMapCount++),n},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var i=this.getRawData().tree.root;(!t||t!==i&&!i.contains(t))&&(this._viewRoot=i)},e.prototype.enableAriaDecal=function(){Mx(this)},e.type="series.treemap",e.layoutMode="box",e.defaultOption={progressive:0,left:"center",top:"middle",width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"\u25B6",zoomToNodeRatio:.32*.32,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",textStyle:{color:"#fff"}},emphasis:{itemStyle:{color:"rgba(0,0,0,0.9)"}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},e}(jt);function y7(r){var e=0;N(r.children,function(i){y7(i);var n=i.value;pe(n)&&(n=n[0]),e+=n});var t=r.value;pe(t)&&(t=t[0]),(t==null||isNaN(t))&&(t=e),t<0&&(t=0),pe(r.value)?r.value[0]=t:r.value=t}function bge(r,e){var t=$t(e.get("color")),i=$t(e.get(["aria","decal","decals"]));if(t){r=r||[];var n,a;N(r,function(s){var l=new Zt(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(n=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(a=!0)});var o=r[0]||(r[0]={});return n||(o.color=t.slice()),!a&&i&&(o.decal=i.slice()),r}}var _7=Mge;var wge=8,x7=8,$I=5,Tge=function(){function r(e){this.group=new Ze,e.add(this.group)}return r.prototype.render=function(e,t,i,n){var a=e.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!a.get("show")||!i)){var s=a.getModel("itemStyle"),l=a.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),f={pos:{left:a.get("left"),right:a.get("right"),top:a.get("top"),bottom:a.get("bottom")},box:{width:t.getWidth(),height:t.getHeight()},emptyItemWidth:a.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,f,u),this._renderContent(e,f,s,l,u,c,n),Cf(o,f.pos,f.box)}},r.prototype._prepare=function(e,t,i){for(var n=e;n;n=n.parentNode){var a=qr(n.getModel().get("name"),""),o=i.getTextRect(a),s=Math.max(o.width+wge*2,t.emptyItemWidth);t.totalWidth+=s+x7,t.renderList.push({node:n,text:a,width:s})}},r.prototype._renderContent=function(e,t,i,n,a,o,s){for(var l=0,u=t.emptyItemWidth,c=e.get(["breadcrumb","height"]),f=x5(t.pos,t.box),h=t.totalWidth,p=t.renderList,d=n.getModel("itemStyle").getItemStyle(),g=p.length-1;g>=0;g--){var m=p[g],v=m.node,_=m.width,y=m.text;h>f.width&&(h-=_-u,_=u,y=null);var x=new ti({shape:{points:Ege(l,0,_,c,g===p.length-1,g===0)},style:Ye(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new Lt({style:fr(a,{text:y})}),textConfig:{position:"inside"},z2:bu*1e4,onclick:ot(s,v)});x.disableLabelAnimation=!0,x.getTextContent().ensureState("emphasis").style=fr(o,{text:y}),x.ensureState("emphasis").style=d,ar(x,n.get("focus"),n.get("blurScope"),n.get("disabled")),this.group.add(x),Age(x,e,v),l+=_+x7}},r.prototype.remove=function(){this.group.removeAll()},r}();function Ege(r,e,t,i,n,a){var o=[[n?r:r-$I,e],[r+t,e],[r+t,e+i],[n?r:r-$I,e+i]];return!a&&o.splice(2,0,[r+t+$I,e+i/2]),!n&&o.push([r,e+i/2]),o}function Age(r,e,t){rt(r).eventData={componentType:"series",componentSubType:"treemap",componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:t&&t.dataIndex,name:t&&t.name},treePathInfo:t&&Zf(t,e)}}var S7=Tge;var Cge=function(){function r(){this._storage=[],this._elExistsMap={}}return r.prototype.add=function(e,t,i,n,a){return this._elExistsMap[e.id]?!1:(this._elExistsMap[e.id]=!0,this._storage.push({el:e,target:t,duration:i,delay:n,easing:a}),!0)},r.prototype.finished=function(e){return this._finishedCallback=e,this},r.prototype.start=function(){for(var e=this,t=this._storage.length,i=function(){t--,t<=0&&(e._storage.length=0,e._elExistsMap={},e._finishedCallback&&e._finishedCallback())},n=0,a=this._storage.length;n<a;n++){var o=this._storage[n];o.el.animateTo(o.target,{duration:o.duration,delay:o.delay,easing:o.easing,setToFinal:!0,done:i,aborted:i})}return this},r}();function M7(){return new Cge}var QI=Ze,b7=Et,w7=3,T7="label",E7="upperLabel",Lge=bu*10,Pge=bu*2,Dge=bu*3,ad=za([["fill","color"],["stroke","strokeColor"],["lineWidth","strokeWidth"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),A7=function(r){var e=ad(r);return e.stroke=e.fill=e.lineWidth=null,e},MT=vt(),Ige=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._state="ready",t._storage=bx(),t}return e.prototype.render=function(t,i,n,a){var o=i.findComponents({mainType:"series",subType:"treemap",query:a});if(!(dt(o,t)<0)){this.seriesModel=t,this.api=n,this.ecModel=i;var s=["treemapZoomToNode","treemapRootToNode"],l=Vu(a,s,t),u=a&&a.type,c=t.layoutInfo,f=!this._oldTree,h=this._storage,p=u==="treemapRootToNode"&&l&&h?{rootNodeGroup:h.nodeGroup[l.node.getRawIndex()],direction:a.direction}:null,d=this._giveContainerGroup(c),g=t.get("animation"),m=this._doRender(d,t,p);g&&!f&&(!u||u==="treemapZoomToNode"||u==="treemapRootToNode")?this._doAnimation(d,m,t,p):m.renderFinally(),this._resetController(n),this._renderBreadcrumb(t,n,l)}},e.prototype._giveContainerGroup=function(t){var i=this._containerGroup;return i||(i=this._containerGroup=new QI,this._initEvents(i),this.group.add(i)),i.x=t.x,i.y=t.y,i},e.prototype._doRender=function(t,i,n){var a=i.getData().tree,o=this._oldTree,s=bx(),l=bx(),u=this._storage,c=[];function f(m,v,_,y){return Nge(i,l,u,n,s,c,m,v,_,y)}p(a.root?[a.root]:[],o&&o.root?[o.root]:[],t,a===o||!o,0);var h=d(u);return this._oldTree=a,this._storage=l,{lastsForAnimation:s,willDeleteEls:h,renderFinally:g};function p(m,v,_,y,x){y?(v=m,N(m,function(w,T){!w.isRemoved()&&S(T,T)})):new An(v,m,M,M).add(S).update(S).remove(ot(S,null)).execute();function M(w){return w.getId()}function S(w,T){var C=w!=null?m[w]:null,b=T!=null?v[T]:null,E=f(C,b,_,x);E&&p(C&&C.viewChildren||[],b&&b.viewChildren||[],E,y,x+1)}}function d(m){var v=bx();return m&&N(m,function(_,y){var x=v[y];N(_,function(M){M&&(x.push(M),MT(M).willDelete=!0)})}),v}function g(){N(h,function(m){N(m,function(v){v.parent&&v.parent.remove(v)})}),N(c,function(m){m.invisible=!0,m.dirty()})}},e.prototype._doAnimation=function(t,i,n,a){var o=n.get("animationDurationUpdate"),s=n.get("animationEasing"),l=(He(o)?0:o)||0,u=(He(s)?null:s)||"cubicOut",c=M7();N(i.willDeleteEls,function(f,h){N(f,function(p,d){if(!p.invisible){var g=p.parent,m,v=MT(g);if(a&&a.direction==="drillDown")m=g===a.rootNodeGroup?{shape:{x:0,y:0,width:v.nodeWidth,height:v.nodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var _=0,y=0;v.willDelete||(_=v.nodeWidth/2,y=v.nodeHeight/2),m=h==="nodeGroup"?{x:_,y,style:{opacity:0}}:{shape:{x:_,y,width:0,height:0},style:{opacity:0}}}m&&c.add(p,m,l,0,u)}})}),N(this._storage,function(f,h){N(f,function(p,d){var g=i.lastsForAnimation[h][d],m={};g&&(p instanceof Ze?g.oldX!=null&&(m.x=p.x,m.y=p.y,p.x=g.oldX,p.y=g.oldY):(g.oldShape&&(m.shape=fe({},p.shape),p.setShape(g.oldShape)),g.fadein?(p.setStyle("opacity",0),m.style={opacity:1}):p.style.opacity!==1&&(m.style={opacity:1})),c.add(p,m,l,0,u))})},this),this._state="animating",c.finished(Be(function(){this._state="ready",i.renderFinally()},this)).start()},e.prototype._resetController=function(t){var i=this._controller;i||(i=this._controller=new jl(t.getZr()),i.enable(this.seriesModel.get("roam")),i.on("pan",Be(this._onPan,this)),i.on("zoom",Be(this._onZoom,this)));var n=new lt(0,0,t.getWidth(),t.getHeight());i.setPointerChecker(function(a,o,s){return n.contain(o,s)})},e.prototype._clearController=function(){var t=this._controller;t&&(t.dispose(),t=null)},e.prototype._onPan=function(t){if(this._state!=="animating"&&(Math.abs(t.dx)>w7||Math.abs(t.dy)>w7)){var i=this.seriesModel.getData().tree.root;if(!i)return;var n=i.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+t.dx,y:n.y+t.dy,width:n.width,height:n.height}})}},e.prototype._onZoom=function(t){var i=t.originX,n=t.originY;if(this._state!=="animating"){var a=this.seriesModel.getData().tree.root;if(!a)return;var o=a.getLayout();if(!o)return;var s=new lt(o.x,o.y,o.width,o.height),l=this.seriesModel.layoutInfo;i-=l.x,n-=l.y;var u=wi();_n(u,u,[-i,-n]),Lm(u,u,[t.scale,t.scale]),_n(u,u,[i,n]),s.applyTransform(u),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:s.x,y:s.y,width:s.width,height:s.height}})}},e.prototype._initEvents=function(t){var i=this;t.on("click",function(n){if(i._state==="ready"){var a=i.seriesModel.get("nodeClick",!0);if(a){var o=i.findTarget(n.offsetX,n.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)i._rootToNode(o);else if(a==="zoomToNode")i._zoomToNode(o);else if(a==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&Gp(u,c)}}}}},this)},e.prototype._renderBreadcrumb=function(t,i,n){var a=this;n||(n=t.get("leafDepth",!0)!=null?{node:t.getViewRoot()}:this.findTarget(i.getWidth()/2,i.getHeight()/2),n||(n={node:t.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new S7(this.group))).render(t,i,n.node,function(o){a._state!=="animating"&&(Iv(t.getViewRoot(),o)?a._rootToNode({node:o}):a._zoomToNode({node:o}))})},e.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=bx(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},e.prototype.dispose=function(){this._clearController()},e.prototype._zoomToNode=function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype._rootToNode=function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype.findTarget=function(t,i){var n,a=this.seriesModel.getViewRoot();return a.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(t,i),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)n={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),n},e.type="treemap",e}(Yt);function bx(){return{nodeGroup:[],background:[],content:[]}}function Nge(r,e,t,i,n,a,o,s,l,u){if(!o)return;var c=o.getLayout(),f=r.getData(),h=o.getModel();if(f.setItemGraphicEl(o.dataIndex,null),!c||!c.isInView)return;var p=c.width,d=c.height,g=c.borderWidth,m=c.invisible,v=o.getRawIndex(),_=s&&s.getRawIndex(),y=o.viewChildren,x=c.upperHeight,M=y&&y.length,S=h.getModel("itemStyle"),w=h.getModel(["emphasis","itemStyle"]),T=h.getModel(["blur","itemStyle"]),C=h.getModel(["select","itemStyle"]),b=S.get("borderRadius")||0,E=V("nodeGroup",QI);if(!E)return;if(l.add(E),E.x=c.x||0,E.y=c.y||0,E.markRedraw(),MT(E).nodeWidth=p,MT(E).nodeHeight=d,c.isAboveViewRoot)return E;var I=V("background",b7,u,Pge);I&&k(E,I,M&&c.upperLabelHeight);var R=h.getModel("emphasis"),A=R.get("focus"),D=R.get("blurScope"),U=R.get("disabled"),B=A==="ancestor"?o.getAncestorsIndices():A==="descendant"?o.getDescendantIndices():A;if(M)Af(E)&&Tu(E,!1),I&&(Tu(I,!U),f.setItemGraphicEl(o.dataIndex,I),iw(I,B,D));else{var z=V("content",b7,u,Dge);z&&G(E,z),I.disableMorphing=!0,I&&Af(I)&&Tu(I,!1),Tu(E,!U),f.setItemGraphicEl(o.dataIndex,E),iw(E,B,D)}return E;function k(ve,ue,se){var Ee=rt(ue);if(Ee.dataIndex=o.dataIndex,Ee.seriesIndex=r.seriesIndex,ue.setShape({x:0,y:0,width:p,height:d,r:b}),m)Y(ue);else{ue.invisible=!1;var q=o.getVisual("style"),H=q.stroke,We=A7(S);We.fill=H;var _e=ad(w);_e.fill=w.get("borderColor");var xe=ad(T);xe.fill=T.get("borderColor");var Le=ad(C);if(Le.fill=C.get("borderColor"),se){var Ue=p-2*g;J(ue,H,q.opacity,{x:g,y:0,width:Ue,height:x})}else ue.removeTextContent();ue.setStyle(We),ue.ensureState("emphasis").style=_e,ue.ensureState("blur").style=xe,ue.ensureState("select").style=Le,Fs(ue)}ve.add(ue)}function G(ve,ue){var se=rt(ue);se.dataIndex=o.dataIndex,se.seriesIndex=r.seriesIndex;var Ee=Math.max(p-2*g,0),q=Math.max(d-2*g,0);if(ue.culling=!0,ue.setShape({x:g,y:g,width:Ee,height:q,r:b}),m)Y(ue);else{ue.invisible=!1;var H=o.getVisual("style"),We=H.fill,_e=A7(S);_e.fill=We,_e.decal=H.decal;var xe=ad(w),Le=ad(T),Ue=ad(C);J(ue,We,H.opacity,null),ue.setStyle(_e),ue.ensureState("emphasis").style=xe,ue.ensureState("blur").style=Le,ue.ensureState("select").style=Ue,Fs(ue)}ve.add(ue)}function Y(ve){!ve.invisible&&a.push(ve)}function J(ve,ue,se,Ee){var q=h.getModel(Ee?E7:T7),H=qr(h.get("name"),null),We=q.getShallow("show");Ir(ve,wr(h,Ee?E7:T7),{defaultText:We?H:null,inheritColor:ue,defaultOpacity:se,labelFetcher:r,labelDataIndex:o.dataIndex});var _e=ve.getTextContent();if(_e){var xe=_e.style,Le=wm(xe.padding||0);Ee&&(ve.setTextConfig({layoutRect:Ee}),_e.disableLabelLayout=!0),_e.beforeUpdate=function(){var Ne=Math.max((Ee?Ee.width:ve.shape.width)-Le[1]-Le[3],0),Ve=Math.max((Ee?Ee.height:ve.shape.height)-Le[0]-Le[2],0);(xe.width!==Ne||xe.height!==Ve)&&_e.setStyle({width:Ne,height:Ve})},xe.truncateMinChar=2,xe.lineOverflow="truncate",Q(xe,Ee,c);var Ue=_e.getState("emphasis");Q(Ue?Ue.style:null,Ee,c)}}function Q(ve,ue,se){var Ee=ve?ve.text:null;if(!ue&&se.isLeafRoot&&Ee!=null){var q=r.get("drillDownIcon",!0);ve.text=q?q+" "+Ee:Ee}}function V(ve,ue,se,Ee){var q=_!=null&&t[ve][_],H=n[ve];return q?(t[ve][_]=null,K(H,q)):m||(q=new ue,q instanceof gi&&(q.z2=Uge(se,Ee)),ae(H,q)),e[ve][v]=q}function K(ve,ue){var se=ve[v]={};ue instanceof QI?(se.oldX=ue.x,se.oldY=ue.y):se.oldShape=fe({},ue.shape)}function ae(ve,ue){var se=ve[v]={},Ee=o.parentNode,q=ue instanceof Ze;if(Ee&&(!i||i.direction==="drillDown")){var H=0,We=0,_e=n.background[Ee.getRawIndex()];!i&&_e&&_e.oldShape&&(H=_e.oldShape.width,We=_e.oldShape.height),q?(se.oldX=0,se.oldY=We):se.oldShape={x:H,y:We,width:0,height:0}}se.fadein=!q}}function Uge(r,e){return r*Lge+e}var C7=Ige;var Ax=N,Oge=qe,TT=-1,iN=function(){function r(e){var t=e.mappingMethod,i=e.type,n=this.option=Qe(e);this.type=i,this.mappingMethod=t,this._normalizeData=Bge[t];var a=r.visualHandlers[i];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[t],t==="piecewise"?(eN(n),zge(n)):t==="category"?n.categories?Fge(n):eN(n,!0):(kr(t!=="linear"||n.dataExtent),eN(n))}return r.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},r.prototype.getNormalizer=function(){return Be(this._normalizeData,this)},r.listVisualTypes=function(){return bt(r.visualHandlers)},r.isValidType=function(e){return r.visualHandlers.hasOwnProperty(e)},r.eachVisual=function(e,t,i){qe(e)?N(e,t,i):t.call(i,e)},r.mapVisual=function(e,t,i){var n,a=pe(e)?[]:qe(e)?{}:(n=!0,null);return r.eachVisual(e,function(o,s){var l=t.call(i,o,s);n?a=l:a[s]=l}),a},r.retrieveVisuals=function(e){var t={},i;return e&&Ax(r.visualHandlers,function(n,a){e.hasOwnProperty(a)&&(t[a]=e[a],i=!0)}),i?t:null},r.prepareVisualTypes=function(e){if(pe(e))e=e.slice();else if(Oge(e)){var t=[];Ax(e,function(i,n){t.push(n)}),e=t}else return[];return e.sort(function(i,n){return n==="color"&&i!=="color"&&i.indexOf("color")===0?1:-1}),e},r.dependsOn=function(e,t){return t==="color"?!!(e&&e.indexOf(t)===0):e===t},r.findPieceIndex=function(e,t,i){for(var n,a=1/0,o=0,s=t.length;o<s;o++){var l=t[o].value;if(l!=null){if(l===e||Ce(l)&&l===e+"")return o;i&&h(l,o)}}for(var o=0,s=t.length;o<s;o++){var u=t[o],c=u.interval,f=u.close;if(c){if(c[0]===-1/0){if(wT(f[1],e,c[1]))return o}else if(c[1]===1/0){if(wT(f[0],c[0],e))return o}else if(wT(f[0],c[0],e)&&wT(f[1],e,c[1]))return o;i&&h(c[0],o),i&&h(c[1],o)}}if(i)return e===1/0?t.length-1:e===-1/0?0:n;function h(p,d){var g=Math.abs(p-e);g<a&&(a=g,n=d)}},r.visualHandlers={color:{applyVisual:Tx("color"),getColorMapper:function(){var e=this.option;return Be(e.mappingMethod==="category"?function(t,i){return!i&&(t=this._normalizeData(t)),Ex.call(this,t)}:function(t,i,n){var a=!!n;return!i&&(t=this._normalizeData(t)),n=wb(t,e.parsedVisual,n),a?n:Jo(n,"rgba")},this)},_normalizedToVisual:{linear:function(e){return Jo(wb(e,this.option.parsedVisual),"rgba")},category:Ex,piecewise:function(e,t){var i=rN.call(this,t);return i==null&&(i=Jo(wb(e,this.option.parsedVisual),"rgba")),i},fixed:od}},colorHue:bT(function(e,t){return fp(e,t)}),colorSaturation:bT(function(e,t){return fp(e,null,t)}),colorLightness:bT(function(e,t){return fp(e,null,null,t)}),colorAlpha:bT(function(e,t){return hp(e,t)}),decal:{applyVisual:Tx("decal"),_normalizedToVisual:{linear:null,category:Ex,piecewise:null,fixed:null}},opacity:{applyVisual:Tx("opacity"),_normalizedToVisual:tN([0,1])},liftZ:{applyVisual:Tx("liftZ"),_normalizedToVisual:{linear:od,category:od,piecewise:od,fixed:od}},symbol:{applyVisual:function(e,t,i){var n=this.mapValueToVisual(e);i("symbol",n)},_normalizedToVisual:{linear:R7,category:Ex,piecewise:function(e,t){var i=rN.call(this,t);return i==null&&(i=R7.call(this,e)),i},fixed:od}},symbolSize:{applyVisual:Tx("symbolSize"),_normalizedToVisual:tN([0,1])}},r}();function zge(r){var e=r.pieceList;r.hasSpecialVisual=!1,N(e,function(t,i){t.originIndex=i,t.visual!=null&&(r.hasSpecialVisual=!0)})}function Fge(r){var e=r.categories,t=r.categoryMap={},i=r.visual;if(Ax(e,function(o,s){t[o]=s}),!pe(i)){var n=[];qe(i)?Ax(i,function(o,s){var l=t[s];n[l??TT]=o}):n[TT]=i,i=L7(r,n)}for(var a=e.length-1;a>=0;a--)i[a]==null&&(delete t[e[a]],e.pop())}function eN(r,e){var t=r.visual,i=[];qe(t)?Ax(t,function(a){i.push(a)}):t!=null&&i.push(t);var n={color:1,symbol:1};!e&&i.length===1&&!n.hasOwnProperty(r.type)&&(i[1]=i[0]),L7(r,i)}function bT(r){return{applyVisual:function(e,t,i){var n=this.mapValueToVisual(e);i("color",r(t("color"),n))},_normalizedToVisual:tN([0,1])}}function R7(r){var e=this.option.visual;return e[Math.round(rr(r,[0,1],[0,e.length-1],!0))]||{}}function Tx(r){return function(e,t,i){i(r,this.mapValueToVisual(e))}}function Ex(r){var e=this.option.visual;return e[this.option.loop&&r!==TT?r%e.length:r]}function od(){return this.option.visual[0]}function tN(r){return{linear:function(e){return rr(e,r,this.option.visual,!0)},category:Ex,piecewise:function(e,t){var i=rN.call(this,t);return i==null&&(i=rr(e,r,this.option.visual,!0)),i},fixed:od}}function rN(r){var e=this.option,t=e.pieceList;if(e.hasSpecialVisual){var i=iN.findPieceIndex(r,t),n=t[i];if(n&&n.visual)return n.visual[this.type]}}function L7(r,e){return r.visual=e,r.type==="color"&&(r.parsedVisual=de(e,function(t){var i=cn(t);return i||[0,0,0,1]})),e}var Bge={linear:function(r){return rr(r,this.option.dataExtent,[0,1],!0)},piecewise:function(r){var e=this.option.pieceList,t=iN.findPieceIndex(r,e,!0);if(t!=null)return rr(t,[0,e.length-1],[0,1],!0)},category:function(r){var e=this.option.categories?this.option.categoryMap[r]:r;return e??TT},fixed:Dr};function wT(r,e,t){return r?e<=t:e<t}var pi=iN;var kge="itemStyle",D7=vt(),I7={seriesType:"treemap",reset:function(r){var e=r.getData().tree,t=e.root;t.isRemoved()||N7(t,{},r.getViewRoot().getAncestors(),r)}};function N7(r,e,t,i){var n=r.getModel(),a=r.getLayout(),o=r.hostTree.data;if(!(!a||a.invisible||!a.isInView)){var s=n.getModel(kge),l=Vge(s,e,i),u=o.ensureUniqueItemVisual(r.dataIndex,"style"),c=s.get("borderColor"),f=s.get("borderColorSaturation"),h;f!=null&&(h=P7(l),c=Gge(f,h)),u.stroke=c;var p=r.viewChildren;if(!p||!p.length)h=P7(l),u.fill=h;else{var d=Hge(r,n,a,s,l,p);N(p,function(g,m){if(g.depth>=t.length||g===t[g.depth]){var v=Wge(n,l,g,m,d,i);N7(g,v,t,i)}})}}}function Vge(r,e,t){var i=fe({},e),n=t.designatedVisualItemStyle;return N(["color","colorAlpha","colorSaturation"],function(a){n[a]=e[a];var o=r.get(a);n[a]=null,o!=null&&(i[a]=o)}),i}function P7(r){var e=nN(r,"color");if(e){var t=nN(r,"colorAlpha"),i=nN(r,"colorSaturation");return i&&(e=fp(e,null,null,i)),t&&(e=hp(e,t)),e}}function Gge(r,e){return e!=null?fp(e,null,null,r):null}function nN(r,e){var t=r[e];if(t!=null&&t!=="none")return t}function Hge(r,e,t,i,n,a){if(!(!a||!a.length)){var o=aN(e,"color")||n.color!=null&&n.color!=="none"&&(aN(e,"colorAlpha")||aN(e,"colorSaturation"));if(o){var s=e.get("visualMin"),l=e.get("visualMax"),u=t.dataExtent.slice();s!=null&&s<u[0]&&(u[0]=s),l!=null&&l>u[1]&&(u[1]=l);var c=e.get("colorMappingBy"),f={type:o.name,dataExtent:u,visual:o.range};f.type==="color"&&(c==="index"||c==="id")?(f.mappingMethod="category",f.loop=!0):f.mappingMethod="linear";var h=new pi(f);return D7(h).drColorMappingBy=c,h}}}function aN(r,e){var t=r.get(e);return pe(t)&&t.length?{name:e,range:t}:null}function Wge(r,e,t,i,n,a){var o=fe({},e);if(n){var s=n.type,l=s==="color"&&D7(n).drColorMappingBy,u=l==="index"?i:l==="id"?a.mapIdToIndex(t.getId()):t.getValue(r.get("visualDimension"));o[s]=n.mapValueToVisual(u)}return o}var Cx=Math.max,ET=Math.min,U7=Br,oN=N,z7=["itemStyle","borderWidth"],Xge=["itemStyle","gapWidth"],Yge=["upperLabel","show"],qge=["upperLabel","height"],F7={seriesType:"treemap",reset:function(r,e,t,i){var n=t.getWidth(),a=t.getHeight(),o=r.option,s=xr(r.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),l=o.size||[],u=ze(U7(s.width,l[0]),n),c=ze(U7(s.height,l[1]),a),f=i&&i.type,h=["treemapZoomToNode","treemapRootToNode"],p=Vu(i,h,r),d=f==="treemapRender"||f==="treemapMove"?i.rootRect:null,g=r.getViewRoot(),m=qI(g);if(f!=="treemapMove"){var v=f==="treemapZoomToNode"?Qge(r,p,g,u,c):d?[d.width,d.height]:[u,c],_=o.sort;_&&_!=="asc"&&_!=="desc"&&(_="desc");var y={squareRatio:o.squareRatio,sort:_,leafDepth:o.leafDepth};g.hostTree.clearLayouts();var x={x:0,y:0,width:v[0],height:v[1],area:v[0]*v[1]};g.setLayout(x),B7(g,y,!1,0),x=g.getLayout(),oN(m,function(S,w){var T=(m[w+1]||g).getValue();S.setLayout(fe({dataExtent:[T,T],borderWidth:0,upperHeight:0},x))})}var M=r.getData().tree.root;M.setLayout(eye(s,d,p),!0),r.setLayoutInfo(s),k7(M,new lt(-s.x,-s.y,n,a),m,g,0)}};function B7(r,e,t,i){var n,a;if(!r.isRemoved()){var o=r.getLayout();n=o.width,a=o.height;var s=r.getModel(),l=s.get(z7),u=s.get(Xge)/2,c=V7(s),f=Math.max(l,c),h=l-u,p=f-u;r.setLayout({borderWidth:l,upperHeight:f,upperLabelHeight:c},!0),n=Cx(n-2*h,0),a=Cx(a-h-p,0);var d=n*a,g=Zge(r,s,d,e,t,i);if(g.length){var m={x:h,y:p,width:n,height:a},v=ET(n,a),_=1/0,y=[];y.area=0;for(var x=0,M=g.length;x<M;){var S=g[x];y.push(S),y.area+=S.getLayout().area;var w=$ge(y,v,e.squareRatio);w<=_?(x++,_=w):(y.area-=y.pop().getLayout().area,O7(y,v,m,u,!1),v=ET(m.width,m.height),y.length=y.area=0,_=1/0)}if(y.length&&O7(y,v,m,u,!0),!t){var T=s.get("childrenVisibleMin");T!=null&&d<T&&(t=!0)}for(var x=0,M=g.length;x<M;x++)B7(g[x],e,t,i+1)}}}function Zge(r,e,t,i,n,a){var o=r.children||[],s=i.sort;s!=="asc"&&s!=="desc"&&(s=null);var l=i.leafDepth!=null&&i.leafDepth<=a;if(n&&!l)return r.viewChildren=[];o=Wt(o,function(p){return!p.isRemoved()}),Kge(o,s);var u=Jge(e,o,s);if(u.sum===0)return r.viewChildren=[];if(u.sum=jge(e,t,u.sum,s,o),u.sum===0)return r.viewChildren=[];for(var c=0,f=o.length;c<f;c++){var h=o[c].getValue()/u.sum*t;o[c].setLayout({area:h})}return l&&(o.length&&r.setLayout({isLeafRoot:!0},!0),o.length=0),r.viewChildren=o,r.setLayout({dataExtent:u.dataExtent},!0),o}function jge(r,e,t,i,n){if(!i)return t;for(var a=r.get("visibleMin"),o=n.length,s=o,l=o-1;l>=0;l--){var u=n[i==="asc"?o-l-1:l].getValue();u/t*e<a&&(s=l,t-=u)}return i==="asc"?n.splice(0,o-s):n.splice(s,o-s),t}function Kge(r,e){return e&&r.sort(function(t,i){var n=e==="asc"?t.getValue()-i.getValue():i.getValue()-t.getValue();return n===0?e==="asc"?t.dataIndex-i.dataIndex:i.dataIndex-t.dataIndex:n}),r}function Jge(r,e,t){for(var i=0,n=0,a=e.length;n<a;n++)i+=e[n].getValue();var o=r.get("visualDimension"),s;return!e||!e.length?s=[NaN,NaN]:o==="value"&&t?(s=[e[e.length-1].getValue(),e[0].getValue()],t==="asc"&&s.reverse()):(s=[1/0,-1/0],oN(e,function(l){var u=l.getValue(o);u<s[0]&&(s[0]=u),u>s[1]&&(s[1]=u)})),{sum:i,dataExtent:s}}function $ge(r,e,t){for(var i=0,n=1/0,a=0,o=void 0,s=r.length;a<s;a++)o=r[a].getLayout().area,o&&(o<n&&(n=o),o>i&&(i=o));var l=r.area*r.area,u=e*e*t;return l?Cx(u*i/l,l/(u*n)):1/0}function O7(r,e,t,i,n){var a=e===t.width?0:1,o=1-a,s=["x","y"],l=["width","height"],u=t[s[a]],c=e?r.area/e:0;(n||c>t[l[o]])&&(c=t[l[o]]);for(var f=0,h=r.length;f<h;f++){var p=r[f],d={},g=c?p.getLayout().area/c:0,m=d[l[o]]=Cx(c-2*i,0),v=t[s[a]]+t[l[a]]-u,_=f===h-1||v<g?v:g,y=d[l[a]]=Cx(_-2*i,0);d[s[o]]=t[s[o]]+ET(i,m/2),d[s[a]]=u+ET(i,y/2),u+=_,p.setLayout(d,!0)}t[s[o]]+=c,t[l[o]]-=c}function Qge(r,e,t,i,n){var a=(e||{}).node,o=[i,n];if(!a||a===t)return o;for(var s,l=i*n,u=l*r.option.zoomToNodeRatio;s=a.parentNode;){for(var c=0,f=s.children,h=0,p=f.length;h<p;h++)c+=f[h].getValue();var d=a.getValue();if(d===0)return o;u*=c/d;var g=s.getModel(),m=g.get(z7),v=Math.max(m,V7(g));u+=4*m*m+(3*m+v)*Math.pow(u,.5),u>t_&&(u=t_),a=s}u<l&&(u=l);var _=Math.pow(u/l,.5);return[i*_,n*_]}function eye(r,e,t){if(e)return{x:e.x,y:e.y};var i={x:0,y:0};if(!t)return i;var n=t.node,a=n.getLayout();if(!a)return i;for(var o=[a.width/2,a.height/2],s=n;s;){var l=s.getLayout();o[0]+=l.x,o[1]+=l.y,s=s.parentNode}return{x:r.width/2-o[0],y:r.height/2-o[1]}}function k7(r,e,t,i,n){var a=r.getLayout(),o=t[n],s=o&&o===r;if(!(o&&!s||n===t.length&&r!==i)){r.setLayout({isInView:!0,invisible:!s&&!e.intersect(a),isAboveViewRoot:s},!0);var l=new lt(e.x-a.x,e.y-a.y,e.width,e.height);oN(r.viewChildren||[],function(u){k7(u,l,t,i,n+1)})}}function V7(r){return r.get(Yge)?r.get(qge):0}function sN(r){r.registerSeriesModel(_7),r.registerChartView(C7),r.registerVisual(I7),r.registerLayout(F7),g7(r)}function lN(r){var e=r.findComponents({mainType:"legend"});!e||!e.length||r.eachSeriesByType("graph",function(t){var i=t.getCategoriesData(),n=t.getGraph(),a=n.data,o=i.mapArray(i.getName);a.filterSelf(function(s){var l=a.getItemModel(s),u=l.getShallow("category");if(u!=null){Ct(u)&&(u=o[u]);for(var c=0;c<e.length;c++)if(!e[c].isSelected(u))return!1}return!0})})}function uN(r){var e={};r.eachSeriesByType("graph",function(t){var i=t.getCategoriesData(),n=t.getData(),a={};i.each(function(o){var s=i.getName(o);a["ec-"+s]=o;var l=i.getItemModel(o),u=l.getModel("itemStyle").getItemStyle();u.fill||(u.fill=t.getColorFromPalette(s,e)),i.setItemVisual(o,"style",u);for(var c=["symbol","symbolSize","symbolKeepAspect"],f=0;f<c.length;f++){var h=l.getShallow(c[f],!0);h!=null&&i.setItemVisual(o,c[f],h)}}),i.count()&&n.each(function(o){var s=n.getItemModel(o),l=s.getShallow("category");if(l!=null){Ce(l)&&(l=a["ec-"+l]);var u=i.getItemVisual(l,"style"),c=n.ensureUniqueItemVisual(o,"style");fe(c,u);for(var f=["symbol","symbolSize","symbolKeepAspect"],h=0;h<f.length;h++)n.setItemVisual(o,f[h],i.getItemVisual(l,f[h]))}})})}function AT(r){return r instanceof Array||(r=[r,r]),r}function cN(r){r.eachSeriesByType("graph",function(e){var t=e.getGraph(),i=e.getEdgeData(),n=AT(e.get("edgeSymbol")),a=AT(e.get("edgeSymbolSize"));i.setVisual("fromSymbol",n&&n[0]),i.setVisual("toSymbol",n&&n[1]),i.setVisual("fromSymbolSize",a&&a[0]),i.setVisual("toSymbolSize",a&&a[1]),i.setVisual("style",e.getModel("lineStyle").getLineStyle()),i.each(function(o){var s=i.getItemModel(o),l=t.getEdgeByIndex(o),u=AT(s.getShallow("symbol",!0)),c=AT(s.getShallow("symbolSize",!0)),f=s.getModel("lineStyle").getLineStyle(),h=i.ensureUniqueItemVisual(o,"style");switch(fe(h,f),h.stroke){case"source":{var p=l.node1.getVisual("style");h.stroke=p&&p.fill;break}case"target":{var p=l.node2.getVisual("style");h.stroke=p&&p.fill;break}}u[0]&&l.setVisual("fromSymbol",u[0]),u[1]&&l.setVisual("toSymbol",u[1]),c[0]&&l.setVisual("fromSymbolSize",c[0]),c[1]&&l.setVisual("toSymbolSize",c[1])})})}var fN="-->",CT=function(r){return r.get("autoCurveness")||null},G7=function(r,e){var t=CT(r),i=20,n=[];if(Ct(t))i=t;else if(pe(t)){r.__curvenessList=t;return}e>i&&(i=e);var a=i%2?i+2:i+3;n=[];for(var o=0;o<a;o++)n.push((o%2?o+1:o)/10*(o%2?-1:1));r.__curvenessList=n},Rx=function(r,e,t){var i=[r.id,r.dataIndex].join("."),n=[e.id,e.dataIndex].join(".");return[t.uid,i,n].join(fN)},H7=function(r){var e=r.split(fN);return[e[0],e[2],e[1]].join(fN)},tye=function(r,e){var t=Rx(r.node1,r.node2,e);return e.__edgeMap[t]},rye=function(r,e){var t=hN(Rx(r.node1,r.node2,e),e),i=hN(Rx(r.node2,r.node1,e),e);return t+i},hN=function(r,e){var t=e.__edgeMap;return t[r]?t[r].length:0};function W7(r){CT(r)&&(r.__curvenessList=[],r.__edgeMap={},G7(r))}function X7(r,e,t,i){if(CT(t)){var n=Rx(r,e,t),a=t.__edgeMap,o=a[H7(n)];a[n]&&!o?a[n].isForward=!0:o&&a[n]&&(o.isForward=!0,a[n].isForward=!1),a[n]=a[n]||[],a[n].push(i)}}function Uv(r,e,t,i){var n=CT(e),a=pe(n);if(!n)return null;var o=tye(r,e);if(!o)return null;for(var s=-1,l=0;l<o.length;l++)if(o[l]===t){s=l;break}var u=rye(r,e);G7(e,u),r.lineStyle=r.lineStyle||{};var c=Rx(r.node1,r.node2,e),f=e.__curvenessList,h=a||u%2?0:1;if(o.isForward)return f[h+s];var p=H7(c),d=hN(p,e),g=f[s+d+h];return i?a?n&&n[0]===0?(d+h)%2?g:-g:((d%2?0:1)+h)%2?g:-g:(d+h)%2?g:-g:f[s+d+h]}function RT(r){var e=r.coordinateSystem;if(!(e&&e.type!=="view")){var t=r.getGraph();t.eachNode(function(i){var n=i.getModel();i.setLayout([+n.get("x"),+n.get("y")])}),Lx(t,r)}}function Lx(r,e){r.eachEdge(function(t,i){var n=Xi(t.getModel().get(["lineStyle","curveness"]),-Uv(t,e,i,!0),0),a=Aa(t.node1.getLayout()),o=Aa(t.node2.getLayout()),s=[a,o];+n&&s.push([(a[0]+o[0])/2-(a[1]-o[1])*n,(a[1]+o[1])/2-(o[0]-a[0])*n]),t.setLayout(s)})}function pN(r,e){r.eachSeriesByType("graph",function(t){var i=t.get("layout"),n=t.coordinateSystem;if(n&&n.type!=="view"){var a=t.getData(),o=[];N(n.dimensions,function(h){o=o.concat(a.mapDimensionsAll(h))});for(var s=0;s<a.count();s++){for(var l=[],u=!1,c=0;c<o.length;c++){var f=a.get(o[c],s);isNaN(f)||(u=!0),l.push(f)}u?a.setItemLayout(s,n.dataToPoint(l)):a.setItemLayout(s,[NaN,NaN])}Lx(a.graph,t)}else(!i||i==="none")&&RT(t)})}function sd(r){var e=r.coordinateSystem;if(e.type!=="view")return 1;var t=r.option.nodeScaleRatio,i=e.scaleX,n=e.getZoom(),a=(n-1)*t+1;return a/i}function ld(r){var e=r.getVisual("symbolSize");return e instanceof Array&&(e=(e[0]+e[1])/2),+e}var Y7=Math.PI,dN=[];function Ov(r,e,t,i){var n=r.coordinateSystem;if(!(n&&n.type!=="view")){var a=n.getBoundingRect(),o=r.getData(),s=o.graph,l=a.width/2+a.x,u=a.height/2+a.y,c=Math.min(a.width,a.height)/2,f=o.count();if(o.setLayout({cx:l,cy:u}),!!f){if(t){var h=n.pointToData(i),p=h[0],d=h[1],g=[p-l,d-u];Xo(g,g),Em(g,g,c),t.setLayout([l+g[0],u+g[1]],!0);var m=r.get(["circular","rotateLabel"]);mN(t,m,l,u)}iye[e](r,s,o,c,l,u,f),s.eachEdge(function(v,_){var y=Xi(v.getModel().get(["lineStyle","curveness"]),Uv(v,r,_),0),x=Aa(v.node1.getLayout()),M=Aa(v.node2.getLayout()),S,w=(x[0]+M[0])/2,T=(x[1]+M[1])/2;+y&&(y*=3,S=[l*y+w*(1-y),u*y+T*(1-y)]),v.setLayout([x,M,S])})}}}var iye={value:function(r,e,t,i,n,a,o){var s=0,l=t.getSum("value"),u=Math.PI*2/(l||o);e.eachNode(function(c){var f=c.getValue("value"),h=u*(l?f:1)/2;s+=h,c.setLayout([i*Math.cos(s)+n,i*Math.sin(s)+a]),s+=h})},symbolSize:function(r,e,t,i,n,a,o){var s=0;dN.length=o;var l=sd(r);e.eachNode(function(f){var h=ld(f);isNaN(h)&&(h=2),h<0&&(h=0),h*=l;var p=Math.asin(h/2/i);isNaN(p)&&(p=Y7/2),dN[f.dataIndex]=p,s+=p*2});var u=(2*Y7-s)/o/2,c=0;e.eachNode(function(f){var h=u+dN[f.dataIndex];c+=h,(!f.getLayout()||!f.getLayout().fixed)&&f.setLayout([i*Math.cos(c)+n,i*Math.sin(c)+a]),c+=h})}};function mN(r,e,t,i){var n=r.getGraphicEl();if(n){var a=r.getModel(),o=a.get(["label","rotate"])||0,s=n.getSymbolPath();if(e){var l=r.getLayout(),u=Math.atan2(l[1]-i,l[0]-t);u<0&&(u=Math.PI*2+u);var c=l[0]<t;c&&(u=u-Math.PI);var f=c?"left":"right";s.setTextConfig({rotation:-u,position:f,origin:"center"});var h=s.ensureState("emphasis");fe(h.textConfig||(h.textConfig={}),{position:f})}else s.setTextConfig({rotation:o*=Math.PI/180})}}function vN(r){r.eachSeriesByType("graph",function(e){e.get("layout")==="circular"&&Ov(e,"symbolSize")})}var zv=U0;function q7(r,e,t){for(var i=r,n=e,a=t.rect,o=a.width,s=a.height,l=[a.x+o/2,a.y+s/2],u=t.gravity==null?.1:t.gravity,c=0;c<i.length;c++){var f=i[c];f.p||(f.p=El(o*(Math.random()-.5)+l[0],s*(Math.random()-.5)+l[1])),f.pp=Aa(f.p),f.edges=null}var h=t.friction==null?.6:t.friction,p=h,d,g;return{warmUp:function(){p=h*.8},setFixed:function(m){i[m].fixed=!0},setUnfixed:function(m){i[m].fixed=!1},beforeStep:function(m){d=m},afterStep:function(m){g=m},step:function(m){d&&d(i,n);for(var v=[],_=i.length,y=0;y<n.length;y++){var x=n[y];if(!x.ignoreForceLayout){var M=x.n1,S=x.n2;Ns(v,S.p,M.p);var w=ob(v)-x.d,T=S.w/(M.w+S.w);isNaN(T)&&(T=0),Xo(v,v),!M.fixed&&zv(M.p,M.p,v,T*w*p),!S.fixed&&zv(S.p,S.p,v,-(1-T)*w*p)}}for(var y=0;y<_;y++){var C=i[y];C.fixed||(Ns(v,l,C.p),zv(C.p,C.p,v,u*p))}for(var y=0;y<_;y++)for(var M=i[y],b=y+1;b<_;b++){var S=i[b];Ns(v,S.p,M.p);var w=ob(v);w===0&&(VV(v,Math.random()-.5,Math.random()-.5),w=1);var E=(M.rep+S.rep)/w/w;!M.fixed&&zv(M.pp,M.pp,v,E),!S.fixed&&zv(S.pp,S.pp,v,-E)}for(var I=[],y=0;y<_;y++){var C=i[y];C.fixed||(Ns(I,C.p,C.pp),zv(C.p,C.p,I,p),qi(C.pp,C.p))}p=p*.992;var R=p<.01;g&&g(i,n,R),m&&m(R)}}}function gN(r){r.eachSeriesByType("graph",function(e){var t=e.coordinateSystem;if(!(t&&t.type!=="view"))if(e.get("layout")==="force"){var i=e.preservedPoints||{},n=e.getGraph(),a=n.data,o=n.edgeData,s=e.getModel("force"),l=s.get("initLayout");e.preservedPoints?a.each(function(y){var x=a.getId(y);a.setItemLayout(y,i[x]||[NaN,NaN])}):!l||l==="none"?RT(e):l==="circular"&&Ov(e,"value");var u=a.getDataExtent("value"),c=o.getDataExtent("value"),f=s.get("repulsion"),h=s.get("edgeLength"),p=pe(f)?f:[f,f],d=pe(h)?h:[h,h];d=[d[1],d[0]];var g=a.mapArray("value",function(y,x){var M=a.getItemLayout(x),S=rr(y,u,p);return isNaN(S)&&(S=(p[0]+p[1])/2),{w:S,rep:S,fixed:a.getItemModel(x).get("fixed"),p:!M||isNaN(M[0])||isNaN(M[1])?null:M}}),m=o.mapArray("value",function(y,x){var M=n.getEdgeByIndex(x),S=rr(y,c,d);isNaN(S)&&(S=(d[0]+d[1])/2);var w=M.getModel(),T=Xi(M.getModel().get(["lineStyle","curveness"]),-Uv(M,e,x,!0),0);return{n1:g[M.node1.dataIndex],n2:g[M.node2.dataIndex],d:S,curveness:T,ignoreForceLayout:w.get("ignoreForceLayout")}}),v=t.getBoundingRect(),_=q7(g,m,{rect:v,gravity:s.get("gravity"),friction:s.get("friction")});_.beforeStep(function(y,x){for(var M=0,S=y.length;M<S;M++)y[M].fixed&&qi(y[M].p,n.getNodeByIndex(M).getLayout())}),_.afterStep(function(y,x,M){for(var S=0,w=y.length;S<w;S++)y[S].fixed||n.getNodeByIndex(S).setLayout(y[S].p),i[a.getId(S)]=y[S].p;for(var S=0,w=x.length;S<w;S++){var T=x[S],C=n.getEdgeByIndex(S),b=T.n1.p,E=T.n2.p,I=C.getLayout();I=I?I.slice():[],I[0]=I[0]||[],I[1]=I[1]||[],qi(I[0],b),qi(I[1],E),+T.curveness&&(I[2]=[(b[0]+E[0])/2-(b[1]-E[1])*T.curveness,(b[1]+E[1])/2-(E[0]-b[0])*T.curveness]),C.setLayout(I)}}),e.forceLayout=_,e.preservedPoints=i,_.step()}else e.forceLayout=null})}function nye(r,e,t){var i=fe(r.getBoxLayoutParams(),{aspect:t});return xr(i,{width:e.getWidth(),height:e.getHeight()})}function yN(r,e){var t=[];return r.eachSeriesByType("graph",function(i){var n=i.get("coordinateSystem");if(!n||n==="view"){var a=i.getData(),o=a.mapArray(function(m){var v=a.getItemModel(m);return[+v.get("x"),+v.get("y")]}),s=[],l=[];wp(o,s,l),l[0]-s[0]===0&&(l[0]+=1,s[0]-=1),l[1]-s[1]===0&&(l[1]+=1,s[1]-=1);var u=(l[0]-s[0])/(l[1]-s[1]),c=nye(i,e,u);isNaN(u)&&(s=[c.x,c.y],l=[c.x+c.width,c.y+c.height]);var f=l[0]-s[0],h=l[1]-s[1],p=c.width,d=c.height,g=i.coordinateSystem=new ku;g.zoomLimit=i.get("scaleLimit"),g.setBoundingRect(s[0],s[1],f,h),g.setViewRect(c.x,c.y,p,d),g.setCenter(i.get("center"),e),g.setZoom(i.get("zoom")),t.push(g)}}),t}var Z7=Jr.prototype,_N=Np.prototype,j7=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return r}(),xQe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(j7);function xN(r){return isNaN(+r.cpx1)||isNaN(+r.cpy1)}var aye=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="ec-line",i}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new j7},e.prototype.buildPath=function(t,i){xN(i)?Z7.buildPath.call(this,t,i):_N.buildPath.call(this,t,i)},e.prototype.pointAt=function(t){return xN(this.shape)?Z7.pointAt.call(this,t):_N.pointAt.call(this,t)},e.prototype.tangentAt=function(t){var i=this.shape,n=xN(i)?[i.x2-i.x1,i.y2-i.y1]:_N.tangentAt.call(this,t);return Xo(n,n)},e}(ut),K7=aye;var SN=["fromSymbol","toSymbol"];function J7(r){return"_"+r+"Type"}function $7(r,e,t){var i=e.getItemVisual(t,r);if(!i||i==="none")return i;var n=e.getItemVisual(t,r+"Size"),a=e.getItemVisual(t,r+"Rotate"),o=e.getItemVisual(t,r+"Offset"),s=e.getItemVisual(t,r+"KeepAspect"),l=Zs(n),u=bo(o||0,l);return i+l+u+(a||"")+(s||"")}function Q7(r,e,t){var i=e.getItemVisual(t,r);if(!(!i||i==="none")){var n=e.getItemVisual(t,r+"Size"),a=e.getItemVisual(t,r+"Rotate"),o=e.getItemVisual(t,r+"Offset"),s=e.getItemVisual(t,r+"KeepAspect"),l=Zs(n),u=bo(o||0,l),c=Sr(i,-l[0]/2+u[0],-l[1]/2+u[1],l[0],l[1],null,s);return c.__specifiedRotation=a==null||isNaN(a)?void 0:+a*Math.PI/180||0,c.name=r,c}}function oye(r){var e=new K7({name:"line",subPixelOptimize:!0});return MN(e.shape,r),e}function MN(r,e){r.x1=e[0][0],r.y1=e[0][1],r.x2=e[1][0],r.y2=e[1][1],r.percent=1;var t=e[2];t?(r.cpx1=t[0],r.cpy1=t[1]):(r.cpx1=NaN,r.cpy1=NaN)}var sye=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;return a._createLine(t,i,n),a}return e.prototype._createLine=function(t,i,n){var a=t.hostModel,o=t.getItemLayout(i),s=oye(o);s.shape.percent=0,or(s,{shape:{percent:1}},a,i),this.add(s),N(SN,function(l){var u=Q7(l,t,i);this.add(u),this[J7(l)]=$7(l,t,i)},this),this._updateCommonStl(t,i,n)},e.prototype.updateData=function(t,i,n){var a=t.hostModel,o=this.childOfName("line"),s=t.getItemLayout(i),l={shape:{}};MN(l.shape,s),Dt(o,l,a,i),N(SN,function(u){var c=$7(u,t,i),f=J7(u);if(this[f]!==c){this.remove(this.childOfName(u));var h=Q7(u,t,i);this.add(h)}this[f]=c},this),this._updateCommonStl(t,i,n)},e.prototype.getLinePath=function(){return this.childAt(0)},e.prototype._updateCommonStl=function(t,i,n){var a=t.hostModel,o=this.childOfName("line"),s=n&&n.emphasisLineStyle,l=n&&n.blurLineStyle,u=n&&n.selectLineStyle,c=n&&n.labelStatesModels,f=n&&n.emphasisDisabled,h=n&&n.focus,p=n&&n.blurScope;if(!n||t.hasItemOption){var d=t.getItemModel(i),g=d.getModel("emphasis");s=g.getModel("lineStyle").getLineStyle(),l=d.getModel(["blur","lineStyle"]).getLineStyle(),u=d.getModel(["select","lineStyle"]).getLineStyle(),f=g.get("disabled"),h=g.get("focus"),p=g.get("blurScope"),c=wr(d)}var m=t.getItemVisual(i,"style"),v=m.stroke;o.useStyle(m),o.style.fill=null,o.style.strokeNoScale=!0,o.ensureState("emphasis").style=s,o.ensureState("blur").style=l,o.ensureState("select").style=u,N(SN,function(S){var w=this.childOfName(S);if(w){w.setColor(v),w.style.opacity=m.opacity;for(var T=0;T<Fi.length;T++){var C=Fi[T],b=o.getState(C);if(b){var E=b.style||{},I=w.ensureState(C),R=I.style||(I.style={});E.stroke!=null&&(R[w.__isEmptyBrush?"stroke":"fill"]=E.stroke),E.opacity!=null&&(R.opacity=E.opacity)}}w.markRedraw()}},this);var _=a.getRawValue(i);Ir(this,c,{labelDataIndex:i,labelFetcher:{getFormattedLabel:function(S,w){return a.getFormattedLabel(S,w,t.dataType)}},inheritColor:v||"#000",defaultOpacity:m.opacity,defaultText:(_==null?t.getName(i):isFinite(_)?Er(_):_)+""});var y=this.getTextContent();if(y){var x=c.normal;y.__align=y.style.align,y.__verticalAlign=y.style.verticalAlign,y.__position=x.get("position")||"middle";var M=x.get("distance");pe(M)||(M=[M,M]),y.__labelDistance=M}this.setTextConfig({position:null,local:!0,inside:!1}),ar(this,h,p,f)},e.prototype.highlight=function(){Bn(this)},e.prototype.downplay=function(){kn(this)},e.prototype.updateLayout=function(t,i){this.setLinePoints(t.getItemLayout(i))},e.prototype.setLinePoints=function(t){var i=this.childOfName("line");MN(i.shape,t),i.dirty()},e.prototype.beforeUpdate=function(){var t=this,i=t.childOfName("fromSymbol"),n=t.childOfName("toSymbol"),a=t.getTextContent();if(!i&&!n&&(!a||a.ignore))return;for(var o=1,s=this.parent;s;)s.scaleX&&(o/=s.scaleX),s=s.parent;var l=t.childOfName("line");if(!this.__dirty&&!l.__dirty)return;var u=l.shape.percent,c=l.pointAt(0),f=l.pointAt(u),h=Ns([],f,c);Xo(h,h);function p(b,E){var I=b.__specifiedRotation;if(I==null){var R=l.tangentAt(E);b.attr("rotation",(E===1?-1:1)*Math.PI/2-Math.atan2(R[1],R[0]))}else b.attr("rotation",I)}if(i&&(i.setPosition(c),p(i,0),i.scaleX=i.scaleY=o*u,i.markRedraw()),n&&(n.setPosition(f),p(n,1),n.scaleX=n.scaleY=o*u,n.markRedraw()),a&&!a.ignore){a.x=a.y=0,a.originX=a.originY=0;var d=void 0,g=void 0,m=a.__labelDistance,v=m[0]*o,_=m[1]*o,y=u/2,x=l.tangentAt(y),M=[x[1],-x[0]],S=l.pointAt(y);M[1]>0&&(M[0]=-M[0],M[1]=-M[1]);var w=x[0]<0?-1:1;if(a.__position!=="start"&&a.__position!=="end"){var T=-Math.atan2(x[1],x[0]);f[0]<c[0]&&(T=Math.PI+T),a.rotation=T}var C=void 0;switch(a.__position){case"insideStartTop":case"insideMiddleTop":case"insideEndTop":case"middle":C=-_,g="bottom";break;case"insideStartBottom":case"insideMiddleBottom":case"insideEndBottom":C=_,g="top";break;default:C=0,g="middle"}switch(a.__position){case"end":a.x=h[0]*v+f[0],a.y=h[1]*_+f[1],d=h[0]>.8?"left":h[0]<-.8?"right":"center",g=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";break;case"start":a.x=-h[0]*v+c[0],a.y=-h[1]*_+c[1],d=h[0]>.8?"right":h[0]<-.8?"left":"center",g=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":a.x=v*w+c[0],a.y=c[1]+C,d=x[0]<0?"right":"left",a.originX=-v*w,a.originY=-C;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":a.x=S[0],a.y=S[1]+C,d="center",a.originY=-C;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":a.x=-v*w+f[0],a.y=f[1]+C,d=x[0]>=0?"right":"left",a.originX=v*w,a.originY=-C;break}a.scaleX=a.scaleY=o,a.setStyle({verticalAlign:a.__verticalAlign||g,align:a.__align||d})}},e}(Ze),Fv=sye;var lye=function(){function r(e){this.group=new Ze,this._LineCtor=e||Fv}return r.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var i=this,n=i.group,a=i._lineData;i._lineData=e,a||n.removeAll();var o=eY(e);e.diff(a).add(function(s){t._doAdd(e,s,o)}).update(function(s,l){t._doUpdate(a,e,l,s,o)}).remove(function(s){n.remove(a.getItemGraphicEl(s))}).execute()},r.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,i){t.updateLayout(e,i)},this)},r.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=eY(e),this._lineData=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t){this._progressiveEls=[];function i(s){!s.isGroup&&!uye(s)&&(s.incremental=!0,s.ensureState("emphasis").hoverLayer=!0)}for(var n=e.start;n<e.end;n++){var a=t.getItemLayout(n);if(bN(a)){var o=new this._LineCtor(t,n,this._seriesScope);o.traverse(i),this.group.add(o),t.setItemGraphicEl(n,o),this._progressiveEls.push(o)}}},r.prototype.remove=function(){this.group.removeAll()},r.prototype.eachRendered=function(e){ca(this._progressiveEls||this.group,e)},r.prototype._doAdd=function(e,t,i){var n=e.getItemLayout(t);if(bN(n)){var a=new this._LineCtor(e,t,i);e.setItemGraphicEl(t,a),this.group.add(a)}},r.prototype._doUpdate=function(e,t,i,n,a){var o=e.getItemGraphicEl(i);if(!bN(t.getItemLayout(n))){this.group.remove(o);return}o?o.updateData(t,n,a):o=new this._LineCtor(t,n,a),t.setItemGraphicEl(n,o),this.group.add(o)},r}();function uye(r){return r.animators&&r.animators.length>0}function eY(r){var e=r.hostModel,t=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:t.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:t.get("disabled"),blurScope:t.get("blurScope"),focus:t.get("focus"),labelStatesModels:wr(e)}}function tY(r){return isNaN(r[0])||isNaN(r[1])}function bN(r){return r&&!tY(r[0])&&!tY(r[1])}var Bv=lye;var wN=[],TN=[],EN=[],kv=vi,AN=gu,rY=Math.abs;function iY(r,e,t){for(var i=r[0],n=r[1],a=r[2],o=1/0,s,l=t*t,u=.1,c=.1;c<=.9;c+=.1){wN[0]=kv(i[0],n[0],a[0],c),wN[1]=kv(i[1],n[1],a[1],c);var f=rY(AN(wN,e)-l);f<o&&(o=f,s=c)}for(var h=0;h<32;h++){var p=s+u;TN[0]=kv(i[0],n[0],a[0],s),TN[1]=kv(i[1],n[1],a[1],s),EN[0]=kv(i[0],n[0],a[0],p),EN[1]=kv(i[1],n[1],a[1],p);var f=AN(TN,e)-l;if(rY(f)<.01)break;var d=AN(EN,e)-l;u/=2,f<0?d>=0?s=s+u:s=s-u:d>=0?s=s-u:s=s+u}return s}function Px(r,e){var t=[],i=mf,n=[[],[],[]],a=[[],[]],o=[];e/=2,r.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),f=s.getVisual("toSymbol");u.__original||(u.__original=[Aa(u[0]),Aa(u[1])],u[2]&&u.__original.push(Aa(u[2])));var h=u.__original;if(u[2]!=null){if(qi(n[0],h[0]),qi(n[1],h[2]),qi(n[2],h[1]),c&&c!=="none"){var p=ld(s.node1),d=iY(n,h[0],p*e);i(n[0][0],n[1][0],n[2][0],d,t),n[0][0]=t[3],n[1][0]=t[4],i(n[0][1],n[1][1],n[2][1],d,t),n[0][1]=t[3],n[1][1]=t[4]}if(f&&f!=="none"){var p=ld(s.node2),d=iY(n,h[1],p*e);i(n[0][0],n[1][0],n[2][0],d,t),n[1][0]=t[1],n[2][0]=t[2],i(n[0][1],n[1][1],n[2][1],d,t),n[1][1]=t[1],n[2][1]=t[2]}qi(u[0],n[0]),qi(u[1],n[2]),qi(u[2],n[1])}else{if(qi(a[0],h[0]),qi(a[1],h[1]),Ns(o,a[1],a[0]),Xo(o,o),c&&c!=="none"){var p=ld(s.node1);U0(a[0],a[0],o,p*e)}if(f&&f!=="none"){var p=ld(s.node2);U0(a[1],a[1],o,-p*e)}qi(u[0],a[0]),qi(u[1],a[1])}})}function nY(r){return r.type==="view"}var cye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){var n=new Xl,a=new Bv,o=this.group;this._controller=new jl(i.getZr()),this._controllerHost={target:o},o.add(n.group),o.add(a.group),this._symbolDraw=n,this._lineDraw=a,this._firstRender=!0},e.prototype.render=function(t,i,n){var a=this,o=t.coordinateSystem;this._model=t;var s=this._symbolDraw,l=this._lineDraw,u=this.group;if(nY(o)){var c={x:o.x,y:o.y,scaleX:o.scaleX,scaleY:o.scaleY};this._firstRender?u.attr(c):Dt(u,c,t)}Px(t.getGraph(),sd(t));var f=t.getData();s.updateData(f);var h=t.getEdgeData();l.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,i,n),clearTimeout(this._layoutTimeout);var p=t.forceLayout,d=t.get(["force","layoutAnimation"]);p&&this._startForceLayoutIteration(p,d);var g=t.get("layout");f.graph.eachNode(function(y){var x=y.dataIndex,M=y.getGraphicEl(),S=y.getModel();if(M){M.off("drag").off("dragend");var w=S.get("draggable");w&&M.on("drag",function(C){switch(g){case"force":p.warmUp(),!a._layouting&&a._startForceLayoutIteration(p,d),p.setFixed(x),f.setItemLayout(x,[M.x,M.y]);break;case"circular":f.setItemLayout(x,[M.x,M.y]),y.setLayout({fixed:!0},!0),Ov(t,"symbolSize",y,[C.offsetX,C.offsetY]),a.updateLayout(t);break;case"none":default:f.setItemLayout(x,[M.x,M.y]),Lx(t.getGraph(),t),a.updateLayout(t);break}}).on("dragend",function(){p&&p.setUnfixed(x)}),M.setDraggable(w,!!S.get("cursor"));var T=S.get(["emphasis","focus"]);T==="adjacency"&&(rt(M).focus=y.getAdjacentDataIndices())}}),f.graph.eachEdge(function(y){var x=y.getGraphicEl(),M=y.getModel().get(["emphasis","focus"]);x&&M==="adjacency"&&(rt(x).focus={edge:[y.dataIndex],node:[y.node1.dataIndex,y.node2.dataIndex]})});var m=t.get("layout")==="circular"&&t.get(["circular","rotateLabel"]),v=f.getLayout("cx"),_=f.getLayout("cy");f.graph.eachNode(function(y){mN(y,m,v,_)}),this._firstRender=!1},e.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,i){var n=this;(function a(){t.step(function(o){n.updateLayout(n._model),(n._layouting=!o)&&(i?n._layoutTimeout=setTimeout(a,16):a())})})()},e.prototype._updateController=function(t,i,n){var a=this,o=this._controller,s=this._controllerHost,l=this.group;if(o.setPointerChecker(function(u,c,f){var h=l.getBoundingRect();return h.applyTransform(l.transform),h.contain(c,f)&&!Yf(u,n,t)}),!nY(t.coordinateSystem)){o.disable();return}o.enable(t.get("roam")),s.zoomLimit=t.get("scaleLimit"),s.zoom=t.coordinateSystem.getZoom(),o.off("pan").off("zoom").on("pan",function(u){Rv(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){Lv(s,u.scale,u.originX,u.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:u.scale,originX:u.originX,originY:u.originY}),a._updateNodeAndLinkScale(),Px(t.getGraph(),sd(t)),a._lineDraw.updateLayout(),n.updateLabelLayout()})},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,i=t.getData(),n=sd(t);i.eachItemGraphicEl(function(a,o){a&&a.setSymbolScale(n)})},e.prototype.updateLayout=function(t){Px(t.getGraph(),sd(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(Yt),aY=cye;function Vv(r){return"_EC_"+r}var fye=function(){function r(e){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=e||!1}return r.prototype.isDirected=function(){return this._directed},r.prototype.addNode=function(e,t){e=e==null?""+t:""+e;var i=this._nodesMap;if(!i[Vv(e)]){var n=new ud(e,t);return n.hostGraph=this,this.nodes.push(n),i[Vv(e)]=n,n}},r.prototype.getNodeByIndex=function(e){var t=this.data.getRawIndex(e);return this.nodes[t]},r.prototype.getNodeById=function(e){return this._nodesMap[Vv(e)]},r.prototype.addEdge=function(e,t,i){var n=this._nodesMap,a=this._edgesMap;if(Ct(e)&&(e=this.nodes[e]),Ct(t)&&(t=this.nodes[t]),e instanceof ud||(e=n[Vv(e)]),t instanceof ud||(t=n[Vv(t)]),!(!e||!t)){var o=e.id+"-"+t.id,s=new oY(e,t,i);return s.hostGraph=this,this._directed&&(e.outEdges.push(s),t.inEdges.push(s)),e.edges.push(s),e!==t&&t.edges.push(s),this.edges.push(s),a[o]=s,s}},r.prototype.getEdgeByIndex=function(e){var t=this.edgeData.getRawIndex(e);return this.edges[t]},r.prototype.getEdge=function(e,t){e instanceof ud&&(e=e.id),t instanceof ud&&(t=t.id);var i=this._edgesMap;return this._directed?i[e+"-"+t]:i[e+"-"+t]||i[t+"-"+e]},r.prototype.eachNode=function(e,t){for(var i=this.nodes,n=i.length,a=0;a<n;a++)i[a].dataIndex>=0&&e.call(t,i[a],a)},r.prototype.eachEdge=function(e,t){for(var i=this.edges,n=i.length,a=0;a<n;a++)i[a].dataIndex>=0&&i[a].node1.dataIndex>=0&&i[a].node2.dataIndex>=0&&e.call(t,i[a],a)},r.prototype.breadthFirstTraverse=function(e,t,i,n){if(t instanceof ud||(t=this._nodesMap[Vv(t)]),!!t){for(var a=i==="out"?"outEdges":i==="in"?"inEdges":"edges",o=0;o<this.nodes.length;o++)this.nodes[o].__visited=!1;if(!e.call(n,t,null))for(var s=[t];s.length;)for(var l=s.shift(),u=l[a],o=0;o<u.length;o++){var c=u[o],f=c.node1===l?c.node2:c.node1;if(!f.__visited){if(e.call(n,f,l))return;s.push(f),f.__visited=!0}}}},r.prototype.update=function(){for(var e=this.data,t=this.edgeData,i=this.nodes,n=this.edges,a=0,o=i.length;a<o;a++)i[a].dataIndex=-1;for(var a=0,o=e.count();a<o;a++)i[e.getRawIndex(a)].dataIndex=a;t.filterSelf(function(s){var l=n[t.getRawIndex(s)];return l.node1.dataIndex>=0&&l.node2.dataIndex>=0});for(var a=0,o=n.length;a<o;a++)n[a].dataIndex=-1;for(var a=0,o=t.count();a<o;a++)n[t.getRawIndex(a)].dataIndex=a},r.prototype.clone=function(){for(var e=new r(this._directed),t=this.nodes,i=this.edges,n=0;n<t.length;n++)e.addNode(t[n].id,t[n].dataIndex);for(var n=0;n<i.length;n++){var a=i[n];e.addEdge(a.node1.id,a.node2.id,a.dataIndex)}return e},r}(),ud=function(){function r(e,t){this.inEdges=[],this.outEdges=[],this.edges=[],this.dataIndex=-1,this.id=e??"",this.dataIndex=t??-1}return r.prototype.degree=function(){return this.edges.length},r.prototype.inDegree=function(){return this.inEdges.length},r.prototype.outDegree=function(){return this.outEdges.length},r.prototype.getModel=function(e){if(!(this.dataIndex<0)){var t=this.hostGraph,i=t.data.getItemModel(this.dataIndex);return i.getModel(e)}},r.prototype.getAdjacentDataIndices=function(){for(var e={edge:[],node:[]},t=0;t<this.edges.length;t++){var i=this.edges[t];i.dataIndex<0||(e.edge.push(i.dataIndex),e.node.push(i.node1.dataIndex,i.node2.dataIndex))}return e},r.prototype.getTrajectoryDataIndices=function(){for(var e=ke(),t=ke(),i=0;i<this.edges.length;i++){var n=this.edges[i];if(!(n.dataIndex<0)){e.set(n.dataIndex,!0);for(var a=[n.node1],o=[n.node2],s=0;s<a.length;){var l=a[s];s++,t.set(l.dataIndex,!0);for(var u=0;u<l.inEdges.length;u++)e.set(l.inEdges[u].dataIndex,!0),a.push(l.inEdges[u].node1)}for(s=0;s<o.length;){var c=o[s];s++,t.set(c.dataIndex,!0);for(var u=0;u<c.outEdges.length;u++)e.set(c.outEdges[u].dataIndex,!0),o.push(c.outEdges[u].node2)}}}return{edge:e.keys(),node:t.keys()}},r}(),oY=function(){function r(e,t,i){this.dataIndex=-1,this.node1=e,this.node2=t,this.dataIndex=i??-1}return r.prototype.getModel=function(e){if(!(this.dataIndex<0)){var t=this.hostGraph,i=t.edgeData.getItemModel(this.dataIndex);return i.getModel(e)}},r.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},r.prototype.getTrajectoryDataIndices=function(){var e=ke(),t=ke();e.set(this.dataIndex,!0);for(var i=[this.node1],n=[this.node2],a=0;a<i.length;){var o=i[a];a++,t.set(o.dataIndex,!0);for(var s=0;s<o.inEdges.length;s++)e.set(o.inEdges[s].dataIndex,!0),i.push(o.inEdges[s].node1)}for(a=0;a<n.length;){var l=n[a];a++,t.set(l.dataIndex,!0);for(var s=0;s<l.outEdges.length;s++)e.set(l.outEdges[s].dataIndex,!0),n.push(l.outEdges[s].node2)}return{edge:e.keys(),node:t.keys()}},r}();function sY(r,e){return{getValue:function(t){var i=this[r][e];return i.getStore().get(i.getDimensionIndex(t||"value"),this.dataIndex)},setVisual:function(t,i){this.dataIndex>=0&&this[r][e].setItemVisual(this.dataIndex,t,i)},getVisual:function(t){return this[r][e].getItemVisual(this.dataIndex,t)},setLayout:function(t,i){this.dataIndex>=0&&this[r][e].setItemLayout(this.dataIndex,t,i)},getLayout:function(){return this[r][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[r][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[r][e].getRawIndex(this.dataIndex)}}}br(ud,sY("hostGraph","data"));br(oY,sY("hostGraph","edgeData"));var lY=fye;function Dx(r,e,t,i,n){for(var a=new lY(i),o=0;o<r.length;o++)a.addNode(Br(r[o].id,r[o].name,o),o);for(var s=[],l=[],u=0,o=0;o<e.length;o++){var c=e[o],f=c.source,h=c.target;a.addEdge(f,h,u)&&(l.push(c),s.push(Br(qr(c.id,null),f+" > "+h)),u++)}var p=t.get("coordinateSystem"),d;if(p==="cartesian2d"||p==="polar")d=hn(r,t);else{var g=Nu.get(p),m=g?g.dimensions||[]:[];dt(m,"value")<0&&m.concat(["value"]);var v=Ks(r,{coordDimensions:m,encodeDefine:t.getEncode()}).dimensions;d=new ri(v,t),d.initData(r)}var _=new ri(["value"],t);return _.initData(l,s),n&&n(d,_),ST({mainData:d,struct:a,structAttr:"graph",datas:{node:d,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a}var hye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments);var i=this;function n(){return i._categoriesData}this.legendVisualProvider=new Zl(n,n),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(t){r.prototype.mergeDefaultAndTheme.apply(this,arguments),yo(t,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,i){var n=t.edges||t.links||[],a=t.data||t.nodes||[],o=this;if(a&&n){W7(this);var s=Dx(a,n,this,!0,l);return N(s.edges,function(u){X7(u.node1,u.node2,this,u.dataIndex)},this),s.data}function l(u,c){u.wrapMethod("getItemModel",function(d){var g=o._categoriesModels,m=d.getShallow("category"),v=g[m];return v&&(v.parentModel=d.parentModel,d.parentModel=v),d});var f=Zt.prototype.getModel;function h(d,g){var m=f.call(this,d,g);return m.resolveParentPath=p,m}c.wrapMethod("getItemModel",function(d){return d.resolveParentPath=p,d.getModel=h,d});function p(d){if(d&&(d[0]==="label"||d[1]==="label")){var g=d.slice();return d[0]==="label"?g[0]="edgeLabel":d[1]==="label"&&(g[1]="edgeLabel"),g}return d}}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,i,n){if(n==="edge"){var a=this.getData(),o=this.getDataParams(t,n),s=a.graph.getEdgeByIndex(t),l=a.getName(s.node1.dataIndex),u=a.getName(s.node2.dataIndex),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),Or("nameValue",{name:c.join(" > "),value:o.value,noValue:o.value==null})}var f=Kw({series:this,dataIndex:t,multipleSeries:i});return f},e.prototype._updateCategoriesData=function(){var t=de(this.option.categories||[],function(n){return n.value!=null?n:fe({value:0},n)}),i=new ri(["value"],this);i.initData(t),this._categoriesData=i,this._categoriesModels=i.mapArray(function(n){return i.getItemModel(n)})},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return r.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(jt),uY=hye;var pye={type:"graphRoam",event:"graphRoam",update:"none"};function CN(r){r.registerChartView(aY),r.registerSeriesModel(uY),r.registerProcessor(lN),r.registerVisual(uN),r.registerVisual(cN),r.registerLayout(pN),r.registerLayout(r.PRIORITY.VISUAL.POST_CHART_LAYOUT,vN),r.registerLayout(gN),r.registerCoordinateSystem("graphView",{dimensions:ku.dimensions,create:yN}),r.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},Dr),r.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},Dr),r.registerAction(pye,function(e,t,i){t.eachComponent({mainType:"series",query:e},function(n){var a=n.coordinateSystem,o=Pv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}var dye=function(){function r(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return r}(),mye=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="pointer",i}return e.prototype.getDefaultShape=function(){return new dye},e.prototype.buildPath=function(t,i){var n=Math.cos,a=Math.sin,o=i.r,s=i.width,l=i.angle,u=i.x-n(l)*s*(s>=o/3?1:2),c=i.y-a(l)*s*(s>=o/3?1:2);l=i.angle-Math.PI/2,t.moveTo(u,c),t.lineTo(i.x+n(l)*s,i.y+a(l)*s),t.lineTo(i.x+n(i.angle)*o,i.y+a(i.angle)*o),t.lineTo(i.x-n(l)*s,i.y-a(l)*s),t.lineTo(u,c)},e}(ut),cY=mye;function vye(r,e){var t=r.get("center"),i=e.getWidth(),n=e.getHeight(),a=Math.min(i,n),o=ze(t[0],e.getWidth()),s=ze(t[1],e.getHeight()),l=ze(r.get("radius"),a/2);return{cx:o,cy:s,r:l}}function LT(r,e){var t=r==null?"":r+"";return e&&(Ce(e)?t=e.replace("{value}",t):He(e)&&(t=e(r))),t}var gye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){this.group.removeAll();var a=t.get(["axisLine","lineStyle","color"]),o=vye(t,n);this._renderMain(t,i,n,a,o),this._data=t.getData()},e.prototype.dispose=function(){},e.prototype._renderMain=function(t,i,n,a,o){var s=this.group,l=t.get("clockwise"),u=-t.get("startAngle")/180*Math.PI,c=-t.get("endAngle")/180*Math.PI,f=t.getModel("axisLine"),h=f.get("roundCap"),p=h?Av:yi,d=f.get("show"),g=f.getModel("lineStyle"),m=g.get("width"),v=[u,c];u_(v,!l),u=v[0],c=v[1];for(var _=c-u,y=u,x=[],M=0;d&&M<a.length;M++){var S=Math.min(Math.max(a[M][0],0),1);c=u+_*S;var w=new p({shape:{startAngle:y,endAngle:c,cx:o.cx,cy:o.cy,clockwise:l,r0:o.r-m,r:o.r},silent:!0});w.setStyle({fill:a[M][1]}),w.setStyle(g.getLineStyle(["color","width"])),x.push(w),y=c}x.reverse(),N(x,function(C){return s.add(C)});var T=function(C){if(C<=0)return a[0][1];var b;for(b=0;b<a.length;b++)if(a[b][0]>=C&&(b===0?0:a[b-1][0])<C)return a[b][1];return a[b-1][1]};this._renderTicks(t,i,n,T,o,u,c,l,m),this._renderTitleAndDetail(t,i,n,T,o),this._renderAnchor(t,o),this._renderPointer(t,i,n,T,o,u,c,l,m)},e.prototype._renderTicks=function(t,i,n,a,o,s,l,u,c){for(var f=this.group,h=o.cx,p=o.cy,d=o.r,g=+t.get("min"),m=+t.get("max"),v=t.getModel("splitLine"),_=t.getModel("axisTick"),y=t.getModel("axisLabel"),x=t.get("splitNumber"),M=_.get("splitNumber"),S=ze(v.get("length"),d),w=ze(_.get("length"),d),T=s,C=(l-s)/x,b=C/M,E=v.getModel("lineStyle").getLineStyle(),I=_.getModel("lineStyle").getLineStyle(),R=v.get("distance"),A,D,U=0;U<=x;U++){if(A=Math.cos(T),D=Math.sin(T),v.get("show")){var B=R?R+c:c,z=new Jr({shape:{x1:A*(d-B)+h,y1:D*(d-B)+p,x2:A*(d-S-B)+h,y2:D*(d-S-B)+p},style:E,silent:!0});E.stroke==="auto"&&z.setStyle({stroke:a(U/x)}),f.add(z)}if(y.get("show")){var B=y.get("distance")+R,k=LT(Er(U/x*(m-g)+g),y.get("formatter")),G=a(U/x),Y=A*(d-S-B)+h,J=D*(d-S-B)+p,Q=y.get("rotate"),V=0;Q==="radial"?(V=-T+2*Math.PI,V>Math.PI/2&&(V+=Math.PI)):Q==="tangential"?V=-T-Math.PI/2:Ct(Q)&&(V=Q*Math.PI/180),V===0?f.add(new Lt({style:fr(y,{text:k,x:Y,y:J,verticalAlign:D<-.8?"top":D>.8?"bottom":"middle",align:A<-.4?"left":A>.4?"right":"center"},{inheritColor:G}),silent:!0})):f.add(new Lt({style:fr(y,{text:k,x:Y,y:J,verticalAlign:"middle",align:"center"},{inheritColor:G}),silent:!0,originX:Y,originY:J,rotation:V}))}if(_.get("show")&&U!==x){var B=_.get("distance");B=B?B+c:c;for(var K=0;K<=M;K++){A=Math.cos(T),D=Math.sin(T);var ae=new Jr({shape:{x1:A*(d-B)+h,y1:D*(d-B)+p,x2:A*(d-w-B)+h,y2:D*(d-w-B)+p},silent:!0,style:I});I.stroke==="auto"&&ae.setStyle({stroke:a((U+K/M)/x)}),f.add(ae),T+=b}T-=b}else T+=C}},e.prototype._renderPointer=function(t,i,n,a,o,s,l,u,c){var f=this.group,h=this._data,p=this._progressEls,d=[],g=t.get(["pointer","show"]),m=t.getModel("progress"),v=m.get("show"),_=t.getData(),y=_.mapDimension("value"),x=+t.get("min"),M=+t.get("max"),S=[x,M],w=[s,l];function T(b,E){var I=_.getItemModel(b),R=I.getModel("pointer"),A=ze(R.get("width"),o.r),D=ze(R.get("length"),o.r),U=t.get(["pointer","icon"]),B=R.get("offsetCenter"),z=ze(B[0],o.r),k=ze(B[1],o.r),G=R.get("keepAspect"),Y;return U?Y=Sr(U,z-A/2,k-D,A,D,null,G):Y=new cY({shape:{angle:-Math.PI/2,width:A,r:D,x:z,y:k}}),Y.rotation=-(E+Math.PI/2),Y.x=o.cx,Y.y=o.cy,Y}function C(b,E){var I=m.get("roundCap"),R=I?Av:yi,A=m.get("overlap"),D=A?m.get("width"):c/_.count(),U=A?o.r-D:o.r-(b+1)*D,B=A?o.r:o.r-b*D,z=new R({shape:{startAngle:s,endAngle:E,cx:o.cx,cy:o.cy,clockwise:u,r0:U,r:B}});return A&&(z.z2=M-_.get(y,b)%M),z}(v||g)&&(_.diff(h).add(function(b){var E=_.get(y,b);if(g){var I=T(b,s);or(I,{rotation:-((isNaN(+E)?w[0]:rr(E,S,w,!0))+Math.PI/2)},t),f.add(I),_.setItemGraphicEl(b,I)}if(v){var R=C(b,s),A=m.get("clip");or(R,{shape:{endAngle:rr(E,S,w,A)}},t),f.add(R),f_(t.seriesIndex,_.dataType,b,R),d[b]=R}}).update(function(b,E){var I=_.get(y,b);if(g){var R=h.getItemGraphicEl(E),A=R?R.rotation:s,D=T(b,A);D.rotation=A,Dt(D,{rotation:-((isNaN(+I)?w[0]:rr(I,S,w,!0))+Math.PI/2)},t),f.add(D),_.setItemGraphicEl(b,D)}if(v){var U=p[E],B=U?U.shape.endAngle:s,z=C(b,B),k=m.get("clip");Dt(z,{shape:{endAngle:rr(I,S,w,k)}},t),f.add(z),f_(t.seriesIndex,_.dataType,b,z),d[b]=z}}).execute(),_.each(function(b){var E=_.getItemModel(b),I=E.getModel("emphasis"),R=I.get("focus"),A=I.get("blurScope"),D=I.get("disabled");if(g){var U=_.getItemGraphicEl(b),B=_.getItemVisual(b,"style"),z=B.fill;if(U instanceof Ur){var k=U.style;U.useStyle(fe({image:k.image,x:k.x,y:k.y,width:k.width,height:k.height},B))}else U.useStyle(B),U.type!=="pointer"&&U.setColor(z);U.setStyle(E.getModel(["pointer","itemStyle"]).getItemStyle()),U.style.fill==="auto"&&U.setStyle("fill",a(rr(_.get(y,b),S,[0,1],!0))),U.z2EmphasisLift=0,Gr(U,E),ar(U,R,A,D)}if(v){var G=d[b];G.useStyle(_.getItemVisual(b,"style")),G.setStyle(E.getModel(["progress","itemStyle"]).getItemStyle()),G.z2EmphasisLift=0,Gr(G,E),ar(G,R,A,D)}}),this._progressEls=d)},e.prototype._renderAnchor=function(t,i){var n=t.getModel("anchor"),a=n.get("show");if(a){var o=n.get("size"),s=n.get("icon"),l=n.get("offsetCenter"),u=n.get("keepAspect"),c=Sr(s,i.cx-o/2+ze(l[0],i.r),i.cy-o/2+ze(l[1],i.r),o,o,null,u);c.z2=n.get("showAbove")?1:0,c.setStyle(n.getModel("itemStyle").getItemStyle()),this.group.add(c)}},e.prototype._renderTitleAndDetail=function(t,i,n,a,o){var s=this,l=t.getData(),u=l.mapDimension("value"),c=+t.get("min"),f=+t.get("max"),h=new Ze,p=[],d=[],g=t.isAnimationEnabled(),m=t.get(["pointer","showAbove"]);l.diff(this._data).add(function(v){p[v]=new Lt({silent:!0}),d[v]=new Lt({silent:!0})}).update(function(v,_){p[v]=s._titleEls[_],d[v]=s._detailEls[_]}).execute(),l.each(function(v){var _=l.getItemModel(v),y=l.get(u,v),x=new Ze,M=a(rr(y,[c,f],[0,1],!0)),S=_.getModel("title");if(S.get("show")){var w=S.get("offsetCenter"),T=o.cx+ze(w[0],o.r),C=o.cy+ze(w[1],o.r),b=p[v];b.attr({z2:m?0:2,style:fr(S,{x:T,y:C,text:l.getName(v),align:"center",verticalAlign:"middle"},{inheritColor:M})}),x.add(b)}var E=_.getModel("detail");if(E.get("show")){var I=E.get("offsetCenter"),R=o.cx+ze(I[0],o.r),A=o.cy+ze(I[1],o.r),D=ze(E.get("width"),o.r),U=ze(E.get("height"),o.r),B=t.get(["progress","show"])?l.getItemVisual(v,"style").fill:M,b=d[v],z=E.get("formatter");b.attr({z2:m?0:2,style:fr(E,{x:R,y:A,text:LT(y,z),width:isNaN(D)?null:D,height:isNaN(U)?null:U,align:"center",verticalAlign:"middle"},{inheritColor:B})}),yw(b,{normal:E},y,function(G){return LT(G,z)}),g&&_w(b,v,l,t,{getFormattedLabel:function(G,Y,J,Q,V,K){return LT(K?K.interpolatedValue:y,z)}}),x.add(b)}h.add(x)}),this.group.add(h),this._titleEls=p,this._detailEls=d},e.type="gauge",e}(Yt),fY=gye;var yye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="itemStyle",t}return e.prototype.getInitialData=function(t,i){return To(this,["value"])},e.type="series.gauge",e.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,"#E6EBF8"]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:"#63677A",width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:"#63677A",width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:"#464646",fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:"#fff",borderWidth:0,borderColor:"#5470c6"}},title:{show:!0,offsetCenter:[0,"20%"],color:"#464646",fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc",width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:"#464646",fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},e}(jt),hY=yye;function RN(r){r.registerChartView(fY),r.registerSeriesModel(hY)}var _ye=["itemStyle","opacity"],xye=function(r){Z(e,r);function e(t,i){var n=r.call(this)||this,a=n,o=new Qr,s=new Lt;return a.setTextContent(s),n.setTextGuideLine(o),n.updateData(t,i,!0),n}return e.prototype.updateData=function(t,i,n){var a=this,o=t.hostModel,s=t.getItemModel(i),l=t.getItemLayout(i),u=s.getModel("emphasis"),c=s.get(_ye);c=c??1,n||Di(a),a.useStyle(t.getItemVisual(i,"style")),a.style.lineJoin="round",n?(a.setShape({points:l.points}),a.style.opacity=0,or(a,{style:{opacity:c}},o,i)):Dt(a,{style:{opacity:c},shape:{points:l.points}},o,i),Gr(a,s),this._updateLabel(t,i),ar(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t,i){var n=this,a=this.getTextGuideLine(),o=n.getTextContent(),s=t.hostModel,l=t.getItemModel(i),u=t.getItemLayout(i),c=u.label,f=t.getItemVisual(i,"style"),h=f.fill;Ir(o,wr(l),{labelFetcher:t.hostModel,labelDataIndex:i,defaultOpacity:f.opacity,defaultText:t.getName(i)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}}),n.setTextConfig({local:!0,inside:!!c.inside,insideStroke:h,outsideFill:h});var p=c.linePoints;a.setShape({points:p}),n.textGuideLineConfig={anchor:p?new Nt(p[0][0],p[0][1]):null},Dt(o,{style:{x:c.x,y:c.y}},s,i),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),bv(n,wv(l),{stroke:h})},e}(ti),Sye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.ignoreLabelLineUpdate=!0,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this._data,s=this.group;a.diff(o).add(function(l){var u=new xye(a,l);a.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,l),s.add(c),a.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Au(u,t,l)}).execute(),this._data=a},e.prototype.remove=function(){this.group.removeAll(),this._data=null},e.prototype.dispose=function(){},e.type="funnel",e}(Yt),pY=Sye;var Mye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new Zl(Be(this.getData,this),Be(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.getInitialData=function(t,i){return To(this,{coordDimensions:["value"],encodeDefaulter:ot(fv,this)})},e.prototype._defaultLabelLine=function(t){yo(t,"labelLine",["show"]);var i=t.labelLine,n=t.emphasis.labelLine;i.show=i.show&&t.label.show,n.show=n.show&&t.emphasis.label.show},e.prototype.getDataParams=function(t){var i=this.getData(),n=r.prototype.getDataParams.call(this,t),a=i.mapDimension("value"),o=i.getSum(a);return n.percent=o?+(i.get(a,t)/o*100).toFixed(2):0,n.$vars.push("percent"),n},e.type="series.funnel",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(jt),dY=Mye;function bye(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function wye(r,e){for(var t=r.mapDimension("value"),i=r.mapArray(t,function(l){return l}),n=[],a=e==="ascending",o=0,s=r.count();o<s;o++)n[o]=o;return He(e)?n.sort(e):e!=="none"&&n.sort(function(l,u){return a?i[l]-i[u]:i[u]-i[l]}),n}function Tye(r){var e=r.hostModel,t=e.get("orient");r.each(function(i){var n=r.getItemModel(i),a=n.getModel("label"),o=a.get("position"),s=n.getModel("labelLine"),l=r.getItemLayout(i),u=l.points,c=o==="inner"||o==="inside"||o==="center"||o==="insideLeft"||o==="insideRight",f,h,p,d;if(c)o==="insideLeft"?(h=(u[0][0]+u[3][0])/2+5,p=(u[0][1]+u[3][1])/2,f="left"):o==="insideRight"?(h=(u[1][0]+u[2][0])/2-5,p=(u[1][1]+u[2][1])/2,f="right"):(h=(u[0][0]+u[1][0]+u[2][0]+u[3][0])/4,p=(u[0][1]+u[1][1]+u[2][1]+u[3][1])/4,f="center"),d=[[h,p],[h,p]];else{var g=void 0,m=void 0,v=void 0,_=void 0,y=s.get("length");o==="left"?(g=(u[3][0]+u[0][0])/2,m=(u[3][1]+u[0][1])/2,v=g-y,h=v-5,f="right"):o==="right"?(g=(u[1][0]+u[2][0])/2,m=(u[1][1]+u[2][1])/2,v=g+y,h=v+5,f="left"):o==="top"?(g=(u[3][0]+u[0][0])/2,m=(u[3][1]+u[0][1])/2,_=m-y,p=_-5,f="center"):o==="bottom"?(g=(u[1][0]+u[2][0])/2,m=(u[1][1]+u[2][1])/2,_=m+y,p=_+5,f="center"):o==="rightTop"?(g=t==="horizontal"?u[3][0]:u[1][0],m=t==="horizontal"?u[3][1]:u[1][1],t==="horizontal"?(_=m-y,p=_-5,f="center"):(v=g+y,h=v+5,f="top")):o==="rightBottom"?(g=u[2][0],m=u[2][1],t==="horizontal"?(_=m+y,p=_+5,f="center"):(v=g+y,h=v+5,f="bottom")):o==="leftTop"?(g=u[0][0],m=t==="horizontal"?u[0][1]:u[1][1],t==="horizontal"?(_=m-y,p=_-5,f="center"):(v=g-y,h=v-5,f="right")):o==="leftBottom"?(g=t==="horizontal"?u[1][0]:u[3][0],m=t==="horizontal"?u[1][1]:u[2][1],t==="horizontal"?(_=m+y,p=_+5,f="center"):(v=g-y,h=v-5,f="right")):(g=(u[1][0]+u[2][0])/2,m=(u[1][1]+u[2][1])/2,t==="horizontal"?(_=m+y,p=_+5,f="center"):(v=g+y,h=v+5,f="left")),t==="horizontal"?(v=g,h=v):(_=m,p=_),d=[[g,m],[v,_]]}l.label={linePoints:d,x:h,y:p,verticalAlign:"middle",textAlign:f,inside:c}})}function LN(r,e){r.eachSeriesByType("funnel",function(t){var i=t.getData(),n=i.mapDimension("value"),a=t.get("sort"),o=bye(t,e),s=t.get("orient"),l=o.width,u=o.height,c=wye(i,a),f=o.x,h=o.y,p=s==="horizontal"?[ze(t.get("minSize"),u),ze(t.get("maxSize"),u)]:[ze(t.get("minSize"),l),ze(t.get("maxSize"),l)],d=i.getDataExtent(n),g=t.get("min"),m=t.get("max");g==null&&(g=Math.min(d[0],0)),m==null&&(m=d[1]);var v=t.get("funnelAlign"),_=t.get("gap"),y=s==="horizontal"?l:u,x=(y-_*(i.count()-1))/i.count(),M=function(A,D){if(s==="horizontal"){var U=i.get(n,A)||0,B=rr(U,[g,m],p,!0),z=void 0;switch(v){case"top":z=h;break;case"center":z=h+(u-B)/2;break;case"bottom":z=h+(u-B);break}return[[D,z],[D,z+B]]}var k=i.get(n,A)||0,G=rr(k,[g,m],p,!0),Y;switch(v){case"left":Y=f;break;case"center":Y=f+(l-G)/2;break;case"right":Y=f+l-G;break}return[[Y,D],[Y+G,D]]};a==="ascending"&&(x=-x,_=-_,s==="horizontal"?f+=l:h+=u,c=c.reverse());for(var S=0;S<c.length;S++){var w=c[S],T=c[S+1],C=i.getItemModel(w);if(s==="horizontal"){var b=C.get(["itemStyle","width"]);b==null?b=x:(b=ze(b,l),a==="ascending"&&(b=-b));var E=M(w,f),I=M(T,f+b);f+=b+_,i.setItemLayout(w,{points:E.concat(I.slice().reverse())})}else{var R=C.get(["itemStyle","height"]);R==null?R=x:(R=ze(R,u),a==="ascending"&&(R=-R));var E=M(w,h),I=M(T,h+R);h+=R+_,i.setItemLayout(w,{points:E.concat(I.slice().reverse())})}}Tye(i)})}function PN(r){r.registerChartView(pY),r.registerSeriesModel(dY),r.registerLayout(LN),r.registerProcessor(rl("funnel"))}var Eye=.3,Aye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._dataGroup=new Ze,t._initialized=!1,t}return e.prototype.init=function(){this.group.add(this._dataGroup)},e.prototype.render=function(t,i,n,a){this._progressiveEls=null;var o=this._dataGroup,s=t.getData(),l=this._data,u=t.coordinateSystem,c=u.dimensions,f=vY(t);s.diff(l).add(h).update(p).remove(d).execute();function h(m){var v=mY(s,o,m,c,u);DN(v,s,m,f)}function p(m,v){var _=l.getItemGraphicEl(v),y=gY(s,m,c,u);s.setItemGraphicEl(m,_),Dt(_,{shape:{points:y}},t,m),Di(_),DN(_,s,m,f)}function d(m){var v=l.getItemGraphicEl(m);o.remove(v)}if(!this._initialized){this._initialized=!0;var g=Cye(u,t,function(){setTimeout(function(){o.removeClipPath()})});o.setClipPath(g)}this._data=s},e.prototype.incrementalPrepareRender=function(t,i,n){this._initialized=!0,this._data=null,this._dataGroup.removeAll()},e.prototype.incrementalRender=function(t,i,n){for(var a=i.getData(),o=i.coordinateSystem,s=o.dimensions,l=vY(i),u=this._progressiveEls=[],c=t.start;c<t.end;c++){var f=mY(a,this._dataGroup,c,s,o);f.incremental=!0,DN(f,a,c,l),u.push(f)}},e.prototype.remove=function(){this._dataGroup&&this._dataGroup.removeAll(),this._data=null},e.type="parallel",e}(Yt);function Cye(r,e,t){var i=r.model,n=r.getRect(),a=new Et({shape:{x:n.x,y:n.y,width:n.width,height:n.height}}),o=i.get("layout")==="horizontal"?"width":"height";return a.setShape(o,0),or(a,{shape:{width:n.width,height:n.height}},e,t),a}function gY(r,e,t,i){for(var n=[],a=0;a<t.length;a++){var o=t[a],s=r.get(r.mapDimension(o),e);Rye(s,i.getAxis(o).type)||n.push(i.dataToPoint(s,o))}return n}function mY(r,e,t,i,n){var a=gY(r,t,i,n),o=new Qr({shape:{points:a},z2:10});return e.add(o),r.setItemGraphicEl(t,o),o}function vY(r){var e=r.get("smooth",!0);return e===!0&&(e=Eye),e=Na(e),uf(e)&&(e=0),{smooth:e}}function DN(r,e,t,i){r.useStyle(e.getItemVisual(t,"style")),r.style.fill=null,r.setShape("smooth",i.smooth);var n=e.getItemModel(t),a=n.getModel("emphasis");Gr(r,n,"lineStyle"),ar(r,a.get("focus"),a.get("blurScope"),a.get("disabled"))}function Rye(r,e){return e==="category"?r==null:r==null||isNaN(r)}var yY=Aye;var Lye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="lineStyle",t.visualDrawType="stroke",t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:Be(Pye,null,this)})},e.prototype.getRawIndicesByActiveState=function(t){var i=this.coordinateSystem,n=this.getData(),a=[];return i.eachActiveState(n,function(o,s){t===o&&a.push(n.getRawIndex(s))}),a},e.type="series.parallel",e.dependencies=["parallel"],e.defaultOption={z:2,coordinateSystem:"parallel",parallelIndex:0,label:{show:!1},inactiveOpacity:.05,activeOpacity:1,lineStyle:{width:1,opacity:.45,type:"solid"},emphasis:{label:{show:!1}},progressive:500,smooth:!1,animationEasing:"linear"},e}(jt);function Pye(r){var e=r.ecModel.getComponent("parallel",r.get("parallelIndex"));if(e){var t={};return N(e.dimensions,function(i){var n=Dye(i);t[i]=n}),t}}function Dye(r){return+r.replace("dim","")}var _Y=Lye;var Iye=["lineStyle","opacity"],Nye={seriesType:"parallel",reset:function(r,e){var t=r.coordinateSystem,i={normal:r.get(["lineStyle","opacity"]),active:r.get("activeOpacity"),inactive:r.get("inactiveOpacity")};return{progress:function(n,a){t.eachActiveState(a,function(o,s){var l=i[o];if(o==="normal"&&a.hasItemOption){var u=a.getItemModel(s).get(Iye,!0);u!=null&&(l=u)}var c=a.ensureUniqueItemVisual(s,"style");c.opacity=l},n.start,n.end)}}}},xY=Nye;function IN(r){Uye(r),Oye(r)}function Uye(r){if(!r.parallel){var e=!1;N(r.series,function(t){t&&t.type==="parallel"&&(e=!0)}),e&&(r.parallel=[{}])}}function Oye(r){var e=$t(r.parallelAxis);N(e,function(t){if(qe(t)){var i=t.parallelIndex||0,n=$t(r.parallel)[i];n&&n.parallelAxisDefault&&_t(t,n.parallelAxisDefault,!1)}})}var zye=5,Fye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){this._model=t,this._api=n,this._handlers||(this._handlers={},N(Bye,function(a,o){n.getZr().on(o,this._handlers[o]=Be(a,this))},this)),os(this,"_throttledDispatchExpand",t.get("axisExpandRate"),"fixRate")},e.prototype.dispose=function(t,i){zu(this,"_throttledDispatchExpand"),N(this._handlers,function(n,a){i.getZr().off(a,n)}),this._handlers=null},e.prototype._throttledDispatchExpand=function(t){this._dispatchExpand(t)},e.prototype._dispatchExpand=function(t){t&&this._api.dispatchAction(fe({type:"parallelAxisExpand"},t))},e.type="parallel",e}(er),Bye={mousedown:function(r){NN(this,"click")&&(this._mouseDownPoint=[r.offsetX,r.offsetY])},mouseup:function(r){var e=this._mouseDownPoint;if(NN(this,"click")&&e){var t=[r.offsetX,r.offsetY],i=Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2);if(i>zye)return;var n=this._model.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX,r.offsetY]);n.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:n.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(r){if(!(this._mouseDownPoint||!NN(this,"mousemove"))){var e=this._model,t=e.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX,r.offsetY]),i=t.behavior;i==="jump"&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand(i==="none"?null:{axisExpandWindow:t.axisExpandWindow,animation:i==="jump"?null:{duration:0}})}}};function NN(r,e){var t=r._model;return t.get("axisExpandable")&&t.get("axisExpandTriggerOn")===e}var SY=Fye;var kye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){r.prototype.init.apply(this,arguments),this.mergeOption({})},e.prototype.mergeOption=function(t){var i=this.option;t&&_t(i,t,!0),this._initDimensions()},e.prototype.contains=function(t,i){var n=t.get("parallelIndex");return n!=null&&i.getComponent("parallel",n)===this},e.prototype.setAxisExpand=function(t){N(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(i){t.hasOwnProperty(i)&&(this.option[i]=t[i])},this)},e.prototype._initDimensions=function(){var t=this.dimensions=[],i=this.parallelAxisIndex=[],n=Wt(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(a){return(a.get("parallelIndex")||0)===this.componentIndex},this);N(n,function(a){t.push("dim"+a.get("dim")),i.push(a.componentIndex)})},e.type="parallel",e.dependencies=["parallelAxis"],e.layoutMode="box",e.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},e}(Pt),MY=kye;var Vye=function(r){Z(e,r);function e(t,i,n,a,o){var s=r.call(this,t,i,n)||this;return s.type=a||"value",s.axisIndex=o,s}return e.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},e}(pn),bY=Vye;function Za(r,e,t,i,n,a){r=r||0;var o=t[1]-t[0];if(n!=null&&(n=Gv(n,[0,o])),a!=null&&(a=Math.max(a,n??0)),i==="all"){var s=Math.abs(e[1]-e[0]);s=Gv(s,[0,o]),n=a=Gv(s,[n,a]),i=0}e[0]=Gv(e[0],t),e[1]=Gv(e[1],t);var l=UN(e,i);e[i]+=r;var u=n||0,c=t.slice();l.sign<0?c[0]+=u:c[1]-=u,e[i]=Gv(e[i],c);var f;return f=UN(e,i),n!=null&&(f.sign!==l.sign||f.span<n)&&(e[1-i]=e[i]+l.sign*n),f=UN(e,i),a!=null&&f.span>a&&(e[1-i]=e[i]+f.sign*a),e}function UN(r,e){var t=r[e]-r[1-e];return{span:Math.abs(t),sign:t>0?-1:t<0?1:e?-1:1}}function Gv(r,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,r))}var ON=N,EY=Math.min,AY=Math.max,wY=Math.floor,Gye=Math.ceil,TY=Er,Hye=Math.PI,Wye=function(){function r(e,t,i){this.type="parallel",this._axesMap=ke(),this._axesLayout={},this.dimensions=e.dimensions,this._model=e,this._init(e,t,i)}return r.prototype._init=function(e,t,i){var n=e.dimensions,a=e.parallelAxisIndex;ON(n,function(o,s){var l=a[s],u=t.getComponent("parallelAxis",l),c=this._axesMap.set(o,new bY(o,kf(u),[0,0],u.get("type"),l)),f=c.type==="category";c.onBand=f&&u.get("boundaryGap"),c.inverse=u.get("inverse"),u.axis=c,c.model=u,c.coordinateSystem=u.coordinateSystem=this},this)},r.prototype.update=function(e,t){this._updateAxesFromSeries(this._model,e)},r.prototype.containPoint=function(e){var t=this._makeLayoutInfo(),i=t.axisBase,n=t.layoutBase,a=t.pixelDimIndex,o=e[1-a],s=e[a];return o>=i&&o<=i+t.axisLength&&s>=n&&s<=n+t.layoutLength},r.prototype.getModel=function(){return this._model},r.prototype._updateAxesFromSeries=function(e,t){t.eachSeries(function(i){if(e.contains(i,t)){var n=i.getData();ON(this.dimensions,function(a){var o=this._axesMap.get(a);o.scale.unionExtentFromData(n,n.mapDimension(a)),kl(o.scale,o.model)},this)}},this)},r.prototype.resize=function(e,t){this._rect=xr(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),this._layoutAxes()},r.prototype.getRect=function(){return this._rect},r.prototype._makeLayoutInfo=function(){var e=this._model,t=this._rect,i=["x","y"],n=["width","height"],a=e.get("layout"),o=a==="horizontal"?0:1,s=t[n[o]],l=[0,s],u=this.dimensions.length,c=PT(e.get("axisExpandWidth"),l),f=PT(e.get("axisExpandCount")||0,[0,u]),h=e.get("axisExpandable")&&u>3&&u>f&&f>1&&c>0&&s>0,p=e.get("axisExpandWindow"),d;if(p)d=PT(p[1]-p[0],l),p[1]=p[0]+d;else{d=PT(c*(f-1),l);var g=e.get("axisExpandCenter")||wY(u/2);p=[c*g-d/2],p[1]=p[0]+d}var m=(s-d)/(u-f);m<3&&(m=0);var v=[wY(TY(p[0]/c,1))+1,Gye(TY(p[1]/c,1))-1],_=m/c*p[0];return{layout:a,pixelDimIndex:o,layoutBase:t[i[o]],layoutLength:s,axisBase:t[i[1-o]],axisLength:t[n[1-o]],axisExpandable:h,axisExpandWidth:c,axisCollapseWidth:m,axisExpandWindow:p,axisCount:u,winInnerIndices:v,axisExpandWindow0Pos:_}},r.prototype._layoutAxes=function(){var e=this._rect,t=this._axesMap,i=this.dimensions,n=this._makeLayoutInfo(),a=n.layout;t.each(function(o){var s=[0,n.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),ON(i,function(o,s){var l=(n.axisExpandable?Yye:Xye)(s,n),u={horizontal:{x:l.position,y:n.axisLength},vertical:{x:0,y:l.position}},c={horizontal:Hye/2,vertical:0},f=[u[a].x+e.x,u[a].y+e.y],h=c[a],p=wi();Pa(p,p,h),_n(p,p,f),this._axesLayout[o]={position:f,rotation:h,transform:p,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},r.prototype.getAxis=function(e){return this._axesMap.get(e)},r.prototype.dataToPoint=function(e,t){return this.axisCoordToPoint(this._axesMap.get(t).dataToCoord(e),t)},r.prototype.eachActiveState=function(e,t,i,n){i==null&&(i=0),n==null&&(n=e.count());var a=this._axesMap,o=this.dimensions,s=[],l=[];N(o,function(m){s.push(e.mapDimension(m)),l.push(a.get(m).model)});for(var u=this.hasAxisBrushed(),c=i;c<n;c++){var f=void 0;if(!u)f="normal";else{f="active";for(var h=e.getValues(s,c),p=0,d=o.length;p<d;p++){var g=l[p].getActiveState(h[p]);if(g==="inactive"){f="inactive";break}}}t(f,c)}},r.prototype.hasAxisBrushed=function(){for(var e=this.dimensions,t=this._axesMap,i=!1,n=0,a=e.length;n<a;n++)t.get(e[n]).model.getActiveState()!=="normal"&&(i=!0);return i},r.prototype.axisCoordToPoint=function(e,t){var i=this._axesLayout[t];return wn([e,0],i.transform)},r.prototype.getAxisLayout=function(e){return Qe(this._axesLayout[e])},r.prototype.getSlidedAxisExpandWindow=function(e){var t=this._makeLayoutInfo(),i=t.pixelDimIndex,n=t.axisExpandWindow.slice(),a=n[1]-n[0],o=[0,t.axisExpandWidth*(t.axisCount-1)];if(!this.containPoint(e))return{behavior:"none",axisExpandWindow:n};var s=e[i]-t.layoutBase-t.axisExpandWindow0Pos,l,u="slide",c=t.axisCollapseWidth,f=this._model.get("axisExpandSlideTriggerArea"),h=f[0]!=null;if(c)h&&c&&s<a*f[0]?(u="jump",l=s-a*f[2]):h&&c&&s>a*(1-f[0])?(u="jump",l=s-a*(1-f[2])):(l=s-a*f[1])>=0&&(l=s-a*(1-f[1]))<=0&&(l=0),l*=t.axisExpandWidth/c,l?Za(l,n,o,"all"):u="none";else{var p=n[1]-n[0],d=o[1]*s/p;n=[AY(0,d-p/2)],n[1]=EY(o[1],n[0]+p),n[0]=n[1]-p}return{axisExpandWindow:n,behavior:u}},r}();function PT(r,e){return EY(AY(r,e[0]),e[1])}function Xye(r,e){var t=e.layoutLength/(e.axisCount-1);return{position:t*r,axisNameAvailableWidth:t,axisLabelShow:!0}}function Yye(r,e){var t=e.layoutLength,i=e.axisExpandWidth,n=e.axisCount,a=e.axisCollapseWidth,o=e.winInnerIndices,s,l=a,u=!1,c;return r<o[0]?(s=r*a,c=a):r<=o[1]?(s=e.axisExpandWindow0Pos+r*i-e.axisExpandWindow[0],l=i,u=!0):(s=t-(n-1-r)*a,c=a),{position:s,axisNameAvailableWidth:l,axisLabelShow:u,nameTruncateMaxWidth:c}}var CY=Wye;function qye(r,e){var t=[];return r.eachComponent("parallel",function(i,n){var a=new CY(i,r,e);a.name="parallel_"+n,a.resize(i,e),i.coordinateSystem=a,a.model=i,t.push(a)}),r.eachSeries(function(i){if(i.get("coordinateSystem")==="parallel"){var n=i.getReferringComponents("parallel",Ar).models[0];i.coordinateSystem=n.coordinateSystem}}),t}var Zye={create:qye},RY=Zye;var LY=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.activeIntervals=[],t}return e.prototype.getAreaSelectStyle=function(){return za([["fill","color"],["lineWidth","borderWidth"],["stroke","borderColor"],["width","width"],["opacity","opacity"]])(this.getModel("areaSelectStyle"))},e.prototype.setActiveIntervals=function(t){var i=this.activeIntervals=Qe(t);if(i)for(var n=i.length-1;n>=0;n--)Ti(i[n])},e.prototype.getActiveState=function(t){var i=this.activeIntervals;if(!i.length)return"normal";if(t==null||isNaN(+t))return"inactive";if(i.length===1){var n=i[0];if(n[0]<=t&&t<=n[1])return"active"}else for(var a=0,o=i.length;a<o;a++)if(i[a][0]<=t&&t<=i[a][1])return"active";return"inactive"},e}(Pt);br(LY,Vl);var zN=LY;var cd=!0,Ix=Math.min,Hv=Math.max,jye=Math.pow,Kye=1e4,Jye=6,$ye=6,PY="globalPan",Qye={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},e0e={w:"ew",e:"ew",n:"ns",s:"ns",ne:"nesw",sw:"nesw",nw:"nwse",se:"nwse"},DY={brushStyle:{lineWidth:2,stroke:"rgba(210,219,238,0.3)",fill:"#D2DBEE"},transformable:!0,brushMode:"single",removeOnClick:!1},t0e=0,r0e=function(r){Z(e,r);function e(t){var i=r.call(this)||this;return i._track=[],i._covers=[],i._handlers={},i._zr=t,i.group=new Ze,i._uid="brushController_"+t0e++,N(u0e,function(n,a){this._handlers[a]=Be(n,this)},i),i}return e.prototype.enableBrush=function(t){return this._brushType&&this._doDisableBrush(),t.brushType&&this._doEnableBrush(t),this},e.prototype._doEnableBrush=function(t){var i=this._zr;this._enableGlobalPan||S9(i,PY,this._uid),N(this._handlers,function(n,a){i.on(a,n)}),this._brushType=t.brushType,this._brushOption=_t(Qe(DY),t,!0)},e.prototype._doDisableBrush=function(){var t=this._zr;M9(t,PY,this._uid),N(this._handlers,function(i,n){t.off(n,i)}),this._brushType=this._brushOption=null},e.prototype.setPanels=function(t){if(t&&t.length){var i=this._panels={};N(t,function(n){i[n.panelId]=Qe(n)})}else this._panels=null;return this},e.prototype.mount=function(t){t=t||{},this._enableGlobalPan=t.enableGlobalPan;var i=this.group;return this._zr.add(i),i.attr({x:t.x||0,y:t.y||0,rotation:t.rotation||0,scaleX:t.scaleX||1,scaleY:t.scaleY||1}),this._transform=i.getLocalTransform(),this},e.prototype.updateCovers=function(t){t=de(t,function(h){return _t(Qe(DY),h,!0)});var i="\0-brush-index-",n=this._covers,a=this._covers=[],o=this,s=this._creatingCover;return new An(n,t,u,l).add(c).update(c).remove(f).execute(),this;function l(h,p){return(h.id!=null?h.id:i+p)+"-"+h.brushType}function u(h,p){return l(h.__brushOption,p)}function c(h,p){var d=t[h];if(p!=null&&n[p]===s)a[h]=n[p];else{var g=a[h]=p!=null?(n[p].__brushOption=d,n[p]):FY(o,zY(o,d));HN(o,g)}}function f(h){n[h]!==s&&o.group.remove(n[h])}},e.prototype.unmount=function(){return this.enableBrush(!1),FN(this),this._zr.remove(this.group),this},e.prototype.dispose=function(){this.unmount(),this.off()},e}(Pi);function zY(r,e){var t=DT[e.brushType].createCover(r,e);return t.__brushOption=e,kY(t,e),r.group.add(t),t}function FY(r,e){var t=WN(e);return t.endCreating&&(t.endCreating(r,e),kY(e,e.__brushOption)),e}function BY(r,e){var t=e.__brushOption;WN(e).updateCoverShape(r,e,t.range,t)}function kY(r,e){var t=e.z;t==null&&(t=Kye),r.traverse(function(i){i.z=t,i.z2=t})}function HN(r,e){WN(e).updateCommon(r,e),BY(r,e)}function WN(r){return DT[r.__brushOption.brushType]}function XN(r,e,t){var i=r._panels;if(!i)return cd;var n,a=r._transform;return N(i,function(o){o.isTargetByCursor(e,t,a)&&(n=o)}),n}function VY(r,e){var t=r._panels;if(!t)return cd;var i=e.__brushOption.panelId;return i!=null?t[i]:cd}function FN(r){var e=r._covers,t=e.length;return N(e,function(i){r.group.remove(i)},r),e.length=0,!!t}function fd(r,e){var t=de(r._covers,function(i){var n=i.__brushOption,a=Qe(n.range);return{brushType:n.brushType,panelId:n.panelId,range:a}});r.trigger("brush",{areas:t,isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function i0e(r){var e=r._track;if(!e.length)return!1;var t=e[e.length-1],i=e[0],n=t[0]-i[0],a=t[1]-i[1],o=jye(n*n+a*a,.5);return o>Jye}function GY(r){var e=r.length-1;return e<0&&(e=0),[r[0],r[e]]}function HY(r,e,t,i){var n=new Ze;return n.add(new Et({name:"main",style:YN(t),silent:!0,draggable:!0,cursor:"move",drift:ot(IY,r,e,n,["n","s","w","e"]),ondragend:ot(fd,e,{isEnd:!0})})),N(i,function(a){n.add(new Et({name:a.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:ot(IY,r,e,n,a),ondragend:ot(fd,e,{isEnd:!0})}))}),n}function WY(r,e,t,i){var n=i.brushStyle.lineWidth||0,a=Hv(n,$ye),o=t[0][0],s=t[1][0],l=o-n/2,u=s-n/2,c=t[0][1],f=t[1][1],h=c-a+n/2,p=f-a+n/2,d=c-o,g=f-s,m=d+n,v=g+n;Gu(r,e,"main",o,s,d,g),i.transformable&&(Gu(r,e,"w",l,u,a,v),Gu(r,e,"e",h,u,a,v),Gu(r,e,"n",l,u,m,a),Gu(r,e,"s",l,p,m,a),Gu(r,e,"nw",l,u,a,a),Gu(r,e,"ne",h,u,a,a),Gu(r,e,"sw",l,p,a,a),Gu(r,e,"se",h,p,a,a))}function BN(r,e){var t=e.__brushOption,i=t.transformable,n=e.childAt(0);n.useStyle(YN(t)),n.attr({silent:!i,cursor:i?"move":"default"}),N([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(a){var o=e.childOfName(a.join("")),s=a.length===1?kN(r,a[0]):a0e(r,a);o&&o.attr({silent:!i,invisible:!i,cursor:i?e0e[s]+"-resize":null})})}function Gu(r,e,t,i,n,a,o){var s=e.childOfName(t);s&&s.setShape(s0e(qN(r,e,[[i,n],[i+a,n+o]])))}function YN(r){return Ye({strokeNoScale:!0},r.brushStyle)}function XY(r,e,t,i){var n=[Ix(r,t),Ix(e,i)],a=[Hv(r,t),Hv(e,i)];return[[n[0],a[0]],[n[1],a[1]]]}function n0e(r){return Vs(r.group)}function kN(r,e){var t={w:"left",e:"right",n:"top",s:"bottom"},i={left:"w",right:"e",top:"n",bottom:"s"},n=zp(t[e],n0e(r));return i[n]}function a0e(r,e){var t=[kN(r,e[0]),kN(r,e[1])];return(t[0]==="e"||t[0]==="w")&&t.reverse(),t.join("")}function IY(r,e,t,i,n,a){var o=t.__brushOption,s=r.toRectRange(o.range),l=YY(e,n,a);N(i,function(u){var c=Qye[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=r.fromRectRange(XY(s[0][0],s[1][0],s[0][1],s[1][1])),HN(e,t),fd(e,{isEnd:!1})}function o0e(r,e,t,i){var n=e.__brushOption.range,a=YY(r,t,i);N(n,function(o){o[0]+=a[0],o[1]+=a[1]}),HN(r,e),fd(r,{isEnd:!1})}function YY(r,e,t){var i=r.group,n=i.transformCoordToLocal(e,t),a=i.transformCoordToLocal(0,0);return[n[0]-a[0],n[1]-a[1]]}function qN(r,e,t){var i=VY(r,e);return i&&i!==cd?i.clipPath(t,r._transform):Qe(t)}function s0e(r){var e=Ix(r[0][0],r[1][0]),t=Ix(r[0][1],r[1][1]),i=Hv(r[0][0],r[1][0]),n=Hv(r[0][1],r[1][1]);return{x:e,y:t,width:i-e,height:n-t}}function l0e(r,e,t){if(!(!r._brushType||c0e(r,e.offsetX,e.offsetY))){var i=r._zr,n=r._covers,a=XN(r,e,t);if(!r._dragging)for(var o=0;o<n.length;o++){var s=n[o].__brushOption;if(a&&(a===cd||s.panelId===a.panelId)&&DT[s.brushType].contain(n[o],t[0],t[1]))return}a&&i.setCursorStyle("crosshair")}}function VN(r){var e=r.event;e.preventDefault&&e.preventDefault()}function GN(r,e,t){return r.childOfName("main").contain(e,t)}function qY(r,e,t,i){var n=r._creatingCover,a=r._creatingPanel,o=r._brushOption,s;if(r._track.push(t.slice()),i0e(r)||n){if(a&&!n){o.brushMode==="single"&&FN(r);var l=Qe(o);l.brushType=NY(l.brushType,a),l.panelId=a===cd?null:a.panelId,n=r._creatingCover=zY(r,l),r._covers.push(n)}if(n){var u=DT[NY(r._brushType,a)],c=n.__brushOption;c.range=u.getCreatingRange(qN(r,n,r._track)),i&&(FY(r,n),u.updateCommon(r,n)),BY(r,n),s={isEnd:i}}}else i&&o.brushMode==="single"&&o.removeOnClick&&XN(r,e,t)&&FN(r)&&(s={isEnd:i,removeOnClick:!0});return s}function NY(r,e){return r==="auto"?e.defaultBrushType:r}var u0e={mousedown:function(r){if(this._dragging)UY(this,r);else if(!r.target||!r.target.draggable){VN(r);var e=this.group.transformCoordToLocal(r.offsetX,r.offsetY);this._creatingCover=null;var t=this._creatingPanel=XN(this,r,e);t&&(this._dragging=!0,this._track=[e.slice()])}},mousemove:function(r){var e=r.offsetX,t=r.offsetY,i=this.group.transformCoordToLocal(e,t);if(l0e(this,r,i),this._dragging){VN(r);var n=qY(this,r,i,!1);n&&fd(this,n)}},mouseup:function(r){UY(this,r)}};function UY(r,e){if(r._dragging){VN(e);var t=e.offsetX,i=e.offsetY,n=r.group.transformCoordToLocal(t,i),a=qY(r,e,n,!0);r._dragging=!1,r._track=[],r._creatingCover=null,a&&fd(r,a)}}function c0e(r,e,t){var i=r._zr;return e<0||e>i.getWidth()||t<0||t>i.getHeight()}var DT={lineX:OY(0),lineY:OY(1),rect:{createCover:function(r,e){function t(i){return i}return HY({toRectRange:t,fromRectRange:t},r,e,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(r){var e=GY(r);return XY(e[1][0],e[1][1],e[0][0],e[0][1])},updateCoverShape:function(r,e,t,i){WY(r,e,t,i)},updateCommon:BN,contain:GN},polygon:{createCover:function(r,e){var t=new Ze;return t.add(new Qr({name:"main",style:YN(e),silent:!0})),t},getCreatingRange:function(r){return r},endCreating:function(r,e){e.remove(e.childAt(0)),e.add(new ti({name:"main",draggable:!0,drift:ot(o0e,r,e),ondragend:ot(fd,r,{isEnd:!0})}))},updateCoverShape:function(r,e,t,i){e.childAt(0).setShape({points:qN(r,e,t)})},updateCommon:BN,contain:GN}};function OY(r){return{createCover:function(e,t){return HY({toRectRange:function(i){var n=[i,[0,100]];return r&&n.reverse(),n},fromRectRange:function(i){return i[r]}},e,t,[[["w"],["e"]],[["n"],["s"]]][r])},getCreatingRange:function(e){var t=GY(e),i=Ix(t[0][r],t[1][r]),n=Hv(t[0][r],t[1][r]);return[i,n]},updateCoverShape:function(e,t,i,n){var a,o=VY(e,t);if(o!==cd&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(r);else{var s=e._zr;a=[0,[s.getWidth(),s.getHeight()][1-r]]}var l=[i,a];r&&l.reverse(),WY(e,t,l,n)},updateCommon:BN,contain:GN}}var Wv=r0e;function IT(r){return r=ZN(r),function(e){return zP(e,r)}}function NT(r,e){return r=ZN(r),function(t){var i=e??t,n=i?r.width:r.height,a=i?r.x:r.y;return[a,a+(n||0)]}}function UT(r,e,t){var i=ZN(r);return function(n,a){return i.contain(a[0],a[1])&&!Yf(n,e,t)}}function ZN(r){return lt.create(r)}var f0e=["axisLine","axisTickLabel","axisName"],h0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){r.prototype.init.apply(this,arguments),(this._brushController=new Wv(i.getZr())).on("brush",Be(this._onBrush,this))},e.prototype.render=function(t,i,n,a){if(!p0e(t,i,a)){this.axisModel=t,this.api=n,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Ze,this.group.add(this._axisGroup),!!t.get("show")){var s=m0e(t,i),l=s.coordinateSystem,u=t.getAreaSelectStyle(),c=u.width,f=t.axis.dim,h=l.getAxisLayout(f),p=fe({strokeContainThreshold:c},h),d=new Cn(t,p);N(f0e,d.add,d),this._axisGroup.add(d.getGroup()),this._refreshBrushController(p,u,t,s,c,n),Ru(o,this._axisGroup,t)}}},e.prototype._refreshBrushController=function(t,i,n,a,o,s){var l=n.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),f=lt.create({x:l[0],y:-o/2,width:u,height:o});f.x-=c,f.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:t.rotation,x:t.position[0],y:t.position[1]}).setPanels([{panelId:"pl",clipPath:IT(f),isTargetByCursor:UT(f,s,a),getLinearBrushOtherExtent:NT(f,0)}]).enableBrush({brushType:"lineX",brushStyle:i,removeOnClick:!0}).updateCovers(d0e(n))},e.prototype._onBrush=function(t){var i=t.areas,n=this.axisModel,a=n.axis,o=de(i,function(s){return[a.coordToData(s.range[0],!0),a.coordToData(s.range[1],!0)]});(!n.option.realtime===t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:n.id,intervals:o})},e.prototype.dispose=function(){this._brushController.dispose()},e.type="parallelAxis",e}(er);function p0e(r,e,t){return t&&t.type==="axisAreaSelect"&&e.findComponents({mainType:"parallelAxis",query:t})[0]===r}function d0e(r){var e=r.axis;return de(r.activeIntervals,function(t){return{brushType:"lineX",panelId:"pl",range:[e.dataToCoord(t[0],!0),e.dataToCoord(t[1],!0)]}})}function m0e(r,e){return e.getComponent("parallel",r.get("parallelIndex"))}var jY=h0e;var v0e={type:"axisAreaSelect",event:"axisAreaSelected"};function KY(r){r.registerAction(v0e,function(e,t){t.eachComponent({mainType:"parallelAxis",query:e},function(i){i.axis.model.setActiveIntervals(e.intervals)})}),r.registerAction("parallelAxisExpand",function(e,t){t.eachComponent({mainType:"parallel",query:e},function(i){i.setAxisExpand(e)})})}var g0e={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function Nx(r){r.registerComponentView(SY),r.registerComponentModel(MY),r.registerCoordinateSystem("parallel",RY),r.registerPreprocessor(IN),r.registerComponentModel(zN),r.registerComponentView(jY),il(r,"parallel",zN,g0e),KY(r)}function jN(r){It(Nx),r.registerChartView(yY),r.registerSeriesModel(_Y),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,xY)}var y0e=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return r}(),_0e=function(r){Z(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new y0e},e.prototype.buildPath=function(t,i){var n=i.extent;t.moveTo(i.x1,i.y1),t.bezierCurveTo(i.cpx1,i.cpy1,i.cpx2,i.cpy2,i.x2,i.y2),i.orient==="vertical"?(t.lineTo(i.x2+n,i.y2),t.bezierCurveTo(i.cpx2+n,i.cpy2,i.cpx1+n,i.cpy1,i.x1+n,i.y1)):(t.lineTo(i.x2,i.y2+n),t.bezierCurveTo(i.cpx2,i.cpy2+n,i.cpx1,i.cpy1+n,i.x1,i.y1+n)),t.closePath()},e.prototype.highlight=function(){Bn(this)},e.prototype.downplay=function(){kn(this)},e}(ut),x0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._focusAdjacencyDisabled=!1,t}return e.prototype.render=function(t,i,n){var a=this,o=t.getGraph(),s=this.group,l=t.layoutInfo,u=l.width,c=l.height,f=t.getData(),h=t.getData("edge"),p=t.get("orient");this._model=t,s.removeAll(),s.x=l.x,s.y=l.y,o.eachEdge(function(d){var g=new _0e,m=rt(g);m.dataIndex=d.dataIndex,m.seriesIndex=t.seriesIndex,m.dataType="edge";var v=d.getModel(),_=v.getModel("lineStyle"),y=_.get("curveness"),x=d.node1.getLayout(),M=d.node1.getModel(),S=M.get("localX"),w=M.get("localY"),T=d.node2.getLayout(),C=d.node2.getModel(),b=C.get("localX"),E=C.get("localY"),I=d.getLayout(),R,A,D,U,B,z,k,G;g.shape.extent=Math.max(1,I.dy),g.shape.orient=p,p==="vertical"?(R=(S!=null?S*u:x.x)+I.sy,A=(w!=null?w*c:x.y)+x.dy,D=(b!=null?b*u:T.x)+I.ty,U=E!=null?E*c:T.y,B=R,z=A*(1-y)+U*y,k=D,G=A*y+U*(1-y)):(R=(S!=null?S*u:x.x)+x.dx,A=(w!=null?w*c:x.y)+I.sy,D=b!=null?b*u:T.x,U=(E!=null?E*c:T.y)+I.ty,B=R*(1-y)+D*y,z=A,k=R*y+D*(1-y),G=U),g.setShape({x1:R,y1:A,x2:D,y2:U,cpx1:B,cpy1:z,cpx2:k,cpy2:G}),g.useStyle(_.getItemStyle()),JY(g.style,p,d);var Y=""+v.get("value"),J=wr(v,"edgeLabel");Ir(g,J,{labelFetcher:{getFormattedLabel:function(K,ae,ve,ue,se,Ee){return t.getFormattedLabel(K,ae,"edge",ue,Xi(se,J.normal&&J.normal.get("formatter"),Y),Ee)}},labelDataIndex:d.dataIndex,defaultText:Y}),g.setTextConfig({position:"inside"});var Q=v.getModel("emphasis");Gr(g,v,"lineStyle",function(K){var ae=K.getItemStyle();return JY(ae,p,d),ae}),s.add(g),h.setItemGraphicEl(d.dataIndex,g);var V=Q.get("focus");ar(g,V==="adjacency"?d.getAdjacentDataIndices():V==="trajectory"?d.getTrajectoryDataIndices():V,Q.get("blurScope"),Q.get("disabled"))}),o.eachNode(function(d){var g=d.getLayout(),m=d.getModel(),v=m.get("localX"),_=m.get("localY"),y=m.getModel("emphasis"),x=new Et({shape:{x:v!=null?v*u:g.x,y:_!=null?_*c:g.y,width:g.dx,height:g.dy},style:m.getModel("itemStyle").getItemStyle(),z2:10});Ir(x,wr(m),{labelFetcher:{getFormattedLabel:function(S,w){return t.getFormattedLabel(S,w,"node")}},labelDataIndex:d.dataIndex,defaultText:d.id}),x.disableLabelAnimation=!0,x.setStyle("fill",d.getVisual("color")),x.setStyle("decal",d.getVisual("style").decal),Gr(x,m),s.add(x),f.setItemGraphicEl(d.dataIndex,x),rt(x).dataType="node";var M=y.get("focus");ar(x,M==="adjacency"?d.getAdjacentDataIndices():M==="trajectory"?d.getTrajectoryDataIndices():M,y.get("blurScope"),y.get("disabled"))}),f.eachItemGraphicEl(function(d,g){var m=f.getItemModel(g);m.get("draggable")&&(d.drift=function(v,_){a._focusAdjacencyDisabled=!0,this.shape.x+=v,this.shape.y+=_,this.dirty(),n.dispatchAction({type:"dragNode",seriesId:t.id,dataIndex:f.getRawIndex(g),localX:this.shape.x/u,localY:this.shape.y/c})},d.ondragend=function(){a._focusAdjacencyDisabled=!1},d.draggable=!0,d.cursor="move")}),!this._data&&t.isAnimationEnabled()&&s.setClipPath(S0e(s.getBoundingRect(),t,function(){s.removeClipPath()})),this._data=t.getData()},e.prototype.dispose=function(){},e.type="sankey",e}(Yt);function JY(r,e,t){switch(r.fill){case"source":r.fill=t.node1.getVisual("color"),r.decal=t.node1.getVisual("style").decal;break;case"target":r.fill=t.node2.getVisual("color"),r.decal=t.node2.getVisual("style").decal;break;case"gradient":var i=t.node1.getVisual("color"),n=t.node2.getVisual("color");Ce(i)&&Ce(n)&&(r.fill=new zl(0,0,+(e==="horizontal"),+(e==="vertical"),[{color:i,offset:0},{color:n,offset:1}]))}}function S0e(r,e,t){var i=new Et({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return or(i,{shape:{width:r.width+20}},e,t),i}var $Y=x0e;var M0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,i){var n=t.edges||t.links,a=t.data||t.nodes,o=t.levels;this.levelModels=[];for(var s=this.levelModels,l=0;l<o.length;l++)o[l].depth!=null&&o[l].depth>=0&&(s[o[l].depth]=new Zt(o[l],this,i));if(a&&n){var u=Dx(a,n,this,!0,c);return u.data}function c(f,h){f.wrapMethod("getItemModel",function(p,d){var g=p.parentModel,m=g.getData().getItemLayout(d);if(m){var v=m.depth,_=g.levelModels[v];_&&(p.parentModel=_)}return p}),h.wrapMethod("getItemModel",function(p,d){var g=p.parentModel,m=g.getGraph().getEdgeByIndex(d),v=m.node1.getLayout();if(v){var _=v.depth,y=g.levelModels[_];y&&(p.parentModel=y)}return p})}},e.prototype.setNodePosition=function(t,i){var n=this.option.data||this.option.nodes,a=n[t];a.localX=i[0],a.localY=i[1]},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.formatTooltip=function(t,i,n){function a(p){return isNaN(p)||p==null}if(n==="edge"){var o=this.getDataParams(t,n),s=o.data,l=o.value,u=s.source+" -- "+s.target;return Or("nameValue",{name:u,value:l,noValue:a(l)})}else{var c=this.getGraph().getNodeByIndex(t),f=c.getLayout().value,h=this.getDataParams(t,n).data.name;return Or("nameValue",{name:h!=null?h+"":null,value:f,noValue:a(f)})}},e.prototype.optionUpdated=function(){},e.prototype.getDataParams=function(t,i){var n=r.prototype.getDataParams.call(this,t,i);if(n.value==null&&i==="node"){var a=this.getGraph().getNodeByIndex(t),o=a.getLayout().value;n.value=o}return n},e.type="series.sankey",e.defaultOption={z:2,coordinateSystem:"view",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:"#314656",opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:"#212121"}},animationEasing:"linear",animationDuration:1e3},e}(jt),QY=M0e;function JN(r,e){r.eachSeriesByType("sankey",function(t){var i=t.get("nodeWidth"),n=t.get("nodeGap"),a=b0e(t,e);t.layoutInfo=a;var o=a.width,s=a.height,l=t.getGraph(),u=l.nodes,c=l.edges;T0e(u);var f=Wt(u,function(g){return g.getLayout().value===0}),h=f.length!==0?0:t.get("layoutIterations"),p=t.get("orient"),d=t.get("nodeAlign");w0e(u,c,i,n,o,s,h,p,d)})}function b0e(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function w0e(r,e,t,i,n,a,o,s,l){E0e(r,e,t,n,a,s,l),L0e(r,e,a,n,i,o,s),B0e(r,s)}function T0e(r){N(r,function(e){var t=jf(e.outEdges,OT),i=jf(e.inEdges,OT),n=e.getValue()||0,a=Math.max(t,i,n);e.setLayout({value:a},!0)})}function E0e(r,e,t,i,n,a,o){for(var s=[],l=[],u=[],c=[],f=0,h=0;h<e.length;h++)s[h]=1;for(var h=0;h<r.length;h++)l[h]=r[h].inEdges.length,l[h]===0&&u.push(r[h]);for(var p=-1;u.length;){for(var d=0;d<u.length;d++){var g=u[d],m=g.hostGraph.data.getRawDataItem(g.dataIndex),v=m.depth!=null&&m.depth>=0;v&&m.depth>p&&(p=m.depth),g.setLayout({depth:v?m.depth:f},!0),a==="vertical"?g.setLayout({dy:t},!0):g.setLayout({dx:t},!0);for(var _=0;_<g.outEdges.length;_++){var y=g.outEdges[_],x=e.indexOf(y);s[x]=0;var M=y.node2,S=r.indexOf(M);--l[S]===0&&c.indexOf(M)<0&&c.push(M)}}++f,u=c,c=[]}for(var h=0;h<s.length;h++)if(s[h]===1)throw new Error("Sankey is a DAG, the original data has cycle!");var w=p>f-1?p:f-1;o&&o!=="left"&&A0e(r,o,a,w);var T=a==="vertical"?(n-t)/w:(i-t)/w;R0e(r,T,a)}function eq(r){var e=r.hostGraph.data.getRawDataItem(r.dataIndex);return e.depth!=null&&e.depth>=0}function A0e(r,e,t,i){if(e==="right"){for(var n=[],a=r,o=0;a.length;){for(var s=0;s<a.length;s++){var l=a[s];l.setLayout({skNodeHeight:o},!0);for(var u=0;u<l.inEdges.length;u++){var c=l.inEdges[u];n.indexOf(c.node1)<0&&n.push(c.node1)}}a=n,n=[],++o}N(r,function(f){eq(f)||f.setLayout({depth:Math.max(0,i-f.getLayout().skNodeHeight)},!0)})}else e==="justify"&&C0e(r,i)}function C0e(r,e){N(r,function(t){!eq(t)&&!t.outEdges.length&&t.setLayout({depth:e},!0)})}function R0e(r,e,t){N(r,function(i){var n=i.getLayout().depth*e;t==="vertical"?i.setLayout({y:n},!0):i.setLayout({x:n},!0)})}function L0e(r,e,t,i,n,a,o){var s=P0e(r,o);D0e(s,e,t,i,n,o),KN(s,n,t,i,o);for(var l=1;a>0;a--)l*=.99,I0e(s,l,o),KN(s,n,t,i,o),F0e(s,l,o),KN(s,n,t,i,o)}function P0e(r,e){var t=[],i=e==="vertical"?"y":"x",n=o_(r,function(a){return a.getLayout()[i]});return n.keys.sort(function(a,o){return a-o}),N(n.keys,function(a){t.push(n.buckets.get(a))}),t}function D0e(r,e,t,i,n,a){var o=1/0;N(r,function(s){var l=s.length,u=0;N(s,function(f){u+=f.getLayout().value});var c=a==="vertical"?(i-(l-1)*n)/u:(t-(l-1)*n)/u;c<o&&(o=c)}),N(r,function(s){N(s,function(l,u){var c=l.getLayout().value*o;a==="vertical"?(l.setLayout({x:u},!0),l.setLayout({dx:c},!0)):(l.setLayout({y:u},!0),l.setLayout({dy:c},!0))})}),N(e,function(s){var l=+s.getValue()*o;s.setLayout({dy:l},!0)})}function KN(r,e,t,i,n){var a=n==="vertical"?"x":"y";N(r,function(o){o.sort(function(g,m){return g.getLayout()[a]-m.getLayout()[a]});for(var s,l,u,c=0,f=o.length,h=n==="vertical"?"dx":"dy",p=0;p<f;p++)l=o[p],u=c-l.getLayout()[a],u>0&&(s=l.getLayout()[a]+u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]+l.getLayout()[h]+e;var d=n==="vertical"?i:t;if(u=c-e-d,u>0){s=l.getLayout()[a]-u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var p=f-2;p>=0;--p)l=o[p],u=l.getLayout()[a]+l.getLayout()[h]+e-c,u>0&&(s=l.getLayout()[a]-u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]}})}function I0e(r,e,t){N(r.slice().reverse(),function(i){N(i,function(n){if(n.outEdges.length){var a=jf(n.outEdges,N0e,t)/jf(n.outEdges,OT);if(isNaN(a)){var o=n.outEdges.length;a=o?jf(n.outEdges,U0e,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(a-Kf(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(a-Kf(n,t))*e;n.setLayout({y:l},!0)}}})})}function N0e(r,e){return Kf(r.node2,e)*r.getValue()}function U0e(r,e){return Kf(r.node2,e)}function O0e(r,e){return Kf(r.node1,e)*r.getValue()}function z0e(r,e){return Kf(r.node1,e)}function Kf(r,e){return e==="vertical"?r.getLayout().x+r.getLayout().dx/2:r.getLayout().y+r.getLayout().dy/2}function OT(r){return r.getValue()}function jf(r,e,t){for(var i=0,n=r.length,a=-1;++a<n;){var o=+e(r[a],t);isNaN(o)||(i+=o)}return i}function F0e(r,e,t){N(r,function(i){N(i,function(n){if(n.inEdges.length){var a=jf(n.inEdges,O0e,t)/jf(n.inEdges,OT);if(isNaN(a)){var o=n.inEdges.length;a=o?jf(n.inEdges,z0e,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(a-Kf(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(a-Kf(n,t))*e;n.setLayout({y:l},!0)}}})})}function B0e(r,e){var t=e==="vertical"?"x":"y";N(r,function(i){i.outEdges.sort(function(n,a){return n.node2.getLayout()[t]-a.node2.getLayout()[t]}),i.inEdges.sort(function(n,a){return n.node1.getLayout()[t]-a.node1.getLayout()[t]})}),N(r,function(i){var n=0,a=0;N(i.outEdges,function(o){o.setLayout({sy:n},!0),n+=o.getLayout().dy}),N(i.inEdges,function(o){o.setLayout({ty:a},!0),a+=o.getLayout().dy})})}function $N(r){r.eachSeriesByType("sankey",function(e){var t=e.getGraph(),i=t.nodes,n=t.edges;if(i.length){var a=1/0,o=-1/0;N(i,function(s){var l=s.getLayout().value;l<a&&(a=l),l>o&&(o=l)}),N(i,function(s){var l=new pi({type:"color",mappingMethod:"linear",dataExtent:[a,o],visual:e.get("color")}),u=l.mapValueToVisual(s.getLayout().value),c=s.getModel().get(["itemStyle","color"]);c!=null?(s.setVisual("color",c),s.setVisual("style",{fill:c})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}n.length&&N(n,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function QN(r){r.registerChartView($Y),r.registerSeriesModel(QY),r.registerLayout(JN),r.registerVisual($N),r.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(e,t){t.eachComponent({mainType:"series",subType:"sankey",query:e},function(i){i.setNodePosition(e.dataIndex,[e.localX,e.localY])})})}var zT=function(){function r(){}return r.prototype.getInitialData=function(e,t){var i,n=t.getComponent("xAxis",this.get("xAxisIndex")),a=t.getComponent("yAxis",this.get("yAxisIndex")),o=n.get("type"),s=a.get("type"),l;o==="category"?(e.layout="horizontal",i=n.getOrdinalMeta(),l=!0):s==="category"?(e.layout="vertical",i=a.getOrdinalMeta(),l=!0):e.layout=e.layout||"horizontal";var u=["x","y"],c=e.layout==="horizontal"?0:1,f=this._baseAxisDim=u[c],h=u[1-c],p=[n,a],d=p[c].get("type"),g=p[1-c].get("type"),m=e.data;if(m&&l){var v=[];N(m,function(x,M){var S;pe(x)?(S=x.slice(),x.unshift(M)):pe(x.value)?(S=fe({},x),S.value=S.value.slice(),x.value.unshift(M)):S=x,v.push(S)}),e.data=v}var _=this.defaultValueDimensions,y=[{name:f,type:Zp(d),ordinalMeta:i,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:h,type:Zp(g),dimsDef:_.slice()}];return To(this,{coordDimensions:y,dimensionsCount:_.length+1,encodeDefaulter:ot(Dw,y,this)})},r.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},r}();var tq=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],t.visualDrawType="stroke",t}return e.type="series.boxplot",e.dependencies=["xAxis","yAxis","grid"],e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}},animationDuration:800},e}(jt);br(tq,zT,!0);var rq=tq;var k0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this.group,s=this._data;this._data||o.removeAll();var l=t.get("layout")==="horizontal"?1:0;a.diff(s).add(function(u){if(a.hasValue(u)){var c=a.getItemLayout(u),f=iq(c,a,u,l,!0);a.setItemGraphicEl(u,f),o.add(f)}}).update(function(u,c){var f=s.getItemGraphicEl(c);if(!a.hasValue(u)){o.remove(f);return}var h=a.getItemLayout(u);f?(Di(f),nq(h,f,a,u)):f=iq(h,a,u,l),o.add(f),a.setItemGraphicEl(u,f)}).remove(function(u){var c=s.getItemGraphicEl(u);c&&o.remove(c)}).execute(),this._data=a},e.prototype.remove=function(t){var i=this.group,n=this._data;this._data=null,n&&n.eachItemGraphicEl(function(a){a&&i.remove(a)})},e.type="boxplot",e}(Yt),V0e=function(){function r(){}return r}(),G0e=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="boxplotBoxPath",i}return e.prototype.getDefaultShape=function(){return new V0e},e.prototype.buildPath=function(t,i){var n=i.points,a=0;for(t.moveTo(n[a][0],n[a][1]),a++;a<4;a++)t.lineTo(n[a][0],n[a][1]);for(t.closePath();a<n.length;a++)t.moveTo(n[a][0],n[a][1]),a++,t.lineTo(n[a][0],n[a][1])},e}(ut);function iq(r,e,t,i,n){var a=r.ends,o=new G0e({shape:{points:n?H0e(a,i,r):a}});return nq(r,o,e,t,n),o}function nq(r,e,t,i,n){var a=t.hostModel,o=Rt[n?"initProps":"updateProps"];o(e,{shape:{points:r.ends}},a,i),e.useStyle(t.getItemVisual(i,"style")),e.style.strokeNoScale=!0,e.z2=100;var s=t.getItemModel(i),l=s.getModel("emphasis");Gr(e,s),ar(e,l.get("focus"),l.get("blurScope"),l.get("disabled"))}function H0e(r,e,t){return de(r,function(i){return i=i.slice(),i[e]=t.initBaseline,i})}var aq=k0e;var Ux=N;function eU(r){var e=W0e(r);Ux(e,function(t){var i=t.seriesModels;i.length&&(X0e(t),Ux(i,function(n,a){Y0e(n,t.boxOffsetList[a],t.boxWidthList[a])}))})}function W0e(r){var e=[],t=[];return r.eachSeriesByType("boxplot",function(i){var n=i.getBaseAxis(),a=dt(t,n);a<0&&(a=t.length,t[a]=n,e[a]={axis:n,seriesModels:[]}),e[a].seriesModels.push(i)}),e}function X0e(r){var e=r.axis,t=r.seriesModels,i=t.length,n=r.boxWidthList=[],a=r.boxOffsetList=[],o=[],s;if(e.type==="category")s=e.getBandWidth();else{var l=0;Ux(t,function(d){l=Math.max(l,d.getData().count())});var u=e.getExtent();s=Math.abs(u[1]-u[0])/l}Ux(t,function(d){var g=d.get("boxWidth");pe(g)||(g=[g,g]),o.push([ze(g[0],s)||0,ze(g[1],s)||0])});var c=s*.8-2,f=c/i*.3,h=(c-f*(i-1))/i,p=h/2-c/2;Ux(t,function(d,g){a.push(p),p+=f+h,n.push(Math.min(Math.max(h,o[g][0]),o[g][1]))})}function Y0e(r,e,t){var i=r.coordinateSystem,n=r.getData(),a=t/2,o=r.get("layout")==="horizontal"?0:1,s=1-o,l=["x","y"],u=n.mapDimension(l[o]),c=n.mapDimensionsAll(l[s]);if(u==null||c.length<5)return;for(var f=0;f<n.count();f++){var h=n.get(u,f),p=y(h,c[2],f),d=y(h,c[0],f),g=y(h,c[1],f),m=y(h,c[3],f),v=y(h,c[4],f),_=[];x(_,g,!1),x(_,m,!0),_.push(d,g,v,m),M(_,d),M(_,v),M(_,p),n.setItemLayout(f,{initBaseline:p[s],ends:_})}function y(S,w,T){var C=n.get(w,T),b=[];b[o]=S,b[s]=C;var E;return isNaN(S)||isNaN(C)?E=[NaN,NaN]:(E=i.dataToPoint(b),E[o]+=e),E}function x(S,w,T){var C=w.slice(),b=w.slice();C[o]+=a,b[o]-=a,T?S.push(C,b):S.push(b,C)}function M(S,w){var T=w.slice(),C=w.slice();T[o]-=a,C[o]+=a,S.push(T,C)}}function tU(r,e){e=e||{};for(var t=[],i=[],n=e.boundIQR,a=n==="none"||n===0,o=0;o<r.length;o++){var s=Ti(r[o].slice()),l=Gm(s,.25),u=Gm(s,.5),c=Gm(s,.75),f=s[0],h=s[s.length-1],p=(n??1.5)*(c-l),d=a?f:Math.max(f,l-p),g=a?h:Math.min(h,c+p),m=e.itemNameFormatter,v=He(m)?m({value:o}):Ce(m)?m.replace("{value}",o+""):o+"";t.push([v,d,l,u,c,g]);for(var _=0;_<s.length;_++){var y=s[_];if(y<d||y>g){var x=[v,y];i.push(x)}}}return{boxData:t,outliers:i}}var oq={type:"echarts:boxplot",transform:function(e){var t=e.upstream;if(t.sourceFormat!==Ei){var i="";ur(i)}var n=tU(t.getRawData(),e.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:n.boxData},{data:n.outliers}]}};function rU(r){r.registerSeriesModel(rq),r.registerChartView(aq),r.registerLayout(eU),r.registerTransform(oq)}var q0e=["color","borderColor"],Z0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(t),this._isLargeDraw?this._renderLarge(t):this._renderNormal(t)},e.prototype.incrementalPrepareRender=function(t,i,n){this._clear(),this._updateDrawMode(t)},e.prototype.incrementalRender=function(t,i,n,a){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(t,i):this._incrementalRenderNormal(t,i)},e.prototype.eachRendered=function(t){ca(this._progressiveEls||this.group,t)},e.prototype._updateDrawMode=function(t){var i=t.pipelineContext.large;(this._isLargeDraw==null||i!==this._isLargeDraw)&&(this._isLargeDraw=i,this._clear())},e.prototype._renderNormal=function(t){var i=t.getData(),n=this._data,a=this.group,o=i.getLayout("isSimpleBox"),s=t.get("clip",!0),l=t.coordinateSystem,u=l.getArea&&l.getArea();this._data||a.removeAll(),i.diff(n).add(function(c){if(i.hasValue(c)){var f=i.getItemLayout(c);if(s&&sq(u,f))return;var h=iU(f,c,!0);or(h,{shape:{points:f.ends}},t,c),nU(h,i,c,o),a.add(h),i.setItemGraphicEl(c,h)}}).update(function(c,f){var h=n.getItemGraphicEl(f);if(!i.hasValue(c)){a.remove(h);return}var p=i.getItemLayout(c);if(s&&sq(u,p)){a.remove(h);return}h?(Dt(h,{shape:{points:p.ends}},t,c),Di(h)):h=iU(p,c),nU(h,i,c,o),a.add(h),i.setItemGraphicEl(c,h)}).remove(function(c){var f=n.getItemGraphicEl(c);f&&a.remove(f)}).execute(),this._data=i},e.prototype._renderLarge=function(t){this._clear(),lq(t,this.group);var i=t.get("clip",!0)?Yl(t.coordinateSystem,!1,t):null;i?this.group.setClipPath(i):this.group.removeClipPath()},e.prototype._incrementalRenderNormal=function(t,i){for(var n=i.getData(),a=n.getLayout("isSimpleBox"),o;(o=t.next())!=null;){var s=n.getItemLayout(o),l=iU(s,o);nU(l,n,o,a),l.incremental=!0,this.group.add(l),this._progressiveEls.push(l)}},e.prototype._incrementalRenderLarge=function(t,i){lq(i,this.group,this._progressiveEls,!0)},e.prototype.remove=function(t){this._clear()},e.prototype._clear=function(){this.group.removeAll(),this._data=null},e.type="candlestick",e}(Yt),j0e=function(){function r(){}return r}(),K0e=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="normalCandlestickBox",i}return e.prototype.getDefaultShape=function(){return new j0e},e.prototype.buildPath=function(t,i){var n=i.points;this.__simpleBox?(t.moveTo(n[4][0],n[4][1]),t.lineTo(n[6][0],n[6][1])):(t.moveTo(n[0][0],n[0][1]),t.lineTo(n[1][0],n[1][1]),t.lineTo(n[2][0],n[2][1]),t.lineTo(n[3][0],n[3][1]),t.closePath(),t.moveTo(n[4][0],n[4][1]),t.lineTo(n[5][0],n[5][1]),t.moveTo(n[6][0],n[6][1]),t.lineTo(n[7][0],n[7][1]))},e}(ut);function iU(r,e,t){var i=r.ends;return new K0e({shape:{points:t?J0e(i,r):i},z2:100})}function sq(r,e){for(var t=!0,i=0;i<e.ends.length;i++)if(r.contain(e.ends[i][0],e.ends[i][1])){t=!1;break}return t}function nU(r,e,t,i){var n=e.getItemModel(t);r.useStyle(e.getItemVisual(t,"style")),r.style.strokeNoScale=!0,r.__simpleBox=i,Gr(r,n)}function J0e(r,e){return de(r,function(t){return t=t.slice(),t[1]=e.initBaseline,t})}var $0e=function(){function r(){}return r}(),aU=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="largeCandlestickBox",i}return e.prototype.getDefaultShape=function(){return new $0e},e.prototype.buildPath=function(t,i){for(var n=i.points,a=0;a<n.length;)if(this.__sign===n[a++]){var o=n[a++];t.moveTo(o,n[a++]),t.lineTo(o,n[a++])}else a+=3},e}(ut);function lq(r,e,t,i){var n=r.getData(),a=n.getLayout("largePoints"),o=new aU({shape:{points:a},__sign:1,ignoreCoarsePointer:!0});e.add(o);var s=new aU({shape:{points:a},__sign:-1,ignoreCoarsePointer:!0});e.add(s);var l=new aU({shape:{points:a},__sign:0,ignoreCoarsePointer:!0});e.add(l),oU(1,o,r,n),oU(-1,s,r,n),oU(0,l,r,n),i&&(o.incremental=!0,s.incremental=!0),t&&t.push(o,s)}function oU(r,e,t,i){var n=t.get(["itemStyle",r>0?"borderColor":"borderColor0"])||t.get(["itemStyle",r>0?"color":"color0"]);r===0&&(n=t.get(["itemStyle","borderColorDoji"]));var a=t.getModel("itemStyle").getItemStyle(q0e);e.useStyle(a),e.style.fill=null,e.style.stroke=n}var uq=Z0e;var cq=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],t}return e.prototype.getShadowDim=function(){return"open"},e.prototype.brushSelector=function(t,i,n){var a=i.getItemLayout(t);return a&&n.rect(a.brushRect)},e.type="series.candlestick",e.dependencies=["xAxis","yAxis","grid"],e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderColorDoji:null,borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},e}(jt);br(cq,zT,!0);var fq=cq;function sU(r){!r||!pe(r.series)||N(r.series,function(e){qe(e)&&e.type==="k"&&(e.type="candlestick")})}var Q0e=["itemStyle","borderColor"],e_e=["itemStyle","borderColor0"],t_e=["itemStyle","borderColorDoji"],r_e=["itemStyle","color"],i_e=["itemStyle","color0"],n_e={seriesType:"candlestick",plan:Mo(),performRawSeries:!0,reset:function(r,e){function t(a,o){return o.get(a>0?r_e:i_e)}function i(a,o){return o.get(a===0?t_e:a>0?Q0e:e_e)}if(!e.isSeriesFiltered(r)){var n=r.pipelineContext.large;return!n&&{progress:function(a,o){for(var s;(s=a.next())!=null;){var l=o.getItemModel(s),u=o.getItemLayout(s).sign,c=l.getItemStyle();c.fill=t(u,l),c.stroke=i(u,l)||c.fill;var f=o.ensureUniqueItemVisual(s,"style");fe(f,c)}}}}}},hq=n_e;var a_e={seriesType:"candlestick",plan:Mo(),reset:function(r){var e=r.coordinateSystem,t=r.getData(),i=o_e(r,t),n=0,a=1,o=["x","y"],s=t.getDimensionIndex(t.mapDimension(o[n])),l=de(t.mapDimensionsAll(o[a]),t.getDimensionIndex,t),u=l[0],c=l[1],f=l[2],h=l[3];if(t.setLayout({candleWidth:i,isSimpleBox:i<=1.3}),s<0||l.length<4)return;return{progress:r.pipelineContext.large?d:p};function p(g,m){for(var v,_=m.getStore();(v=g.next())!=null;){var y=_.get(s,v),x=_.get(u,v),M=_.get(c,v),S=_.get(f,v),w=_.get(h,v),T=Math.min(x,M),C=Math.max(x,M),b=B(T,y),E=B(C,y),I=B(S,y),R=B(w,y),A=[];z(A,E,0),z(A,b,1),A.push(G(R),G(E),G(I),G(b));var D=m.getItemModel(v),U=!!D.get(["itemStyle","borderColorDoji"]);m.setItemLayout(v,{sign:pq(_,v,x,M,c,U),initBaseline:x>M?E[a]:b[a],ends:A,brushRect:k(S,w,y)})}function B(Y,J){var Q=[];return Q[n]=J,Q[a]=Y,isNaN(J)||isNaN(Y)?[NaN,NaN]:e.dataToPoint(Q)}function z(Y,J,Q){var V=J.slice(),K=J.slice();V[n]=M_(V[n]+i/2,1,!1),K[n]=M_(K[n]-i/2,1,!0),Q?Y.push(V,K):Y.push(K,V)}function k(Y,J,Q){var V=B(Y,Q),K=B(J,Q);return V[n]-=i/2,K[n]-=i/2,{x:V[0],y:V[1],width:a?i:K[0]-V[0],height:a?K[1]-V[1]:i}}function G(Y){return Y[n]=M_(Y[n],1),Y}}function d(g,m){for(var v=pa(g.count*4),_=0,y,x=[],M=[],S,w=m.getStore(),T=!!r.get(["itemStyle","borderColorDoji"]);(S=g.next())!=null;){var C=w.get(s,S),b=w.get(u,S),E=w.get(c,S),I=w.get(f,S),R=w.get(h,S);if(isNaN(C)||isNaN(I)||isNaN(R)){v[_++]=NaN,_+=3;continue}v[_++]=pq(w,S,b,E,c,T),x[n]=C,x[a]=I,y=e.dataToPoint(x,null,M),v[_++]=y?y[0]:NaN,v[_++]=y?y[1]:NaN,x[a]=R,y=e.dataToPoint(x,null,M),v[_++]=y?y[1]:NaN}m.setLayout("largePoints",v)}}};function pq(r,e,t,i,n,a){var o;return t>i?o=-1:t<i?o=1:o=a?0:e>0?r.get(n,e-1)<=i?1:-1:1,o}function o_e(r,e){var t=r.getBaseAxis(),i,n=t.type==="category"?t.getBandWidth():(i=t.getExtent(),Math.abs(i[1]-i[0])/e.count()),a=ze(ft(r.get("barMaxWidth"),n),n),o=ze(ft(r.get("barMinWidth"),1),n),s=r.get("barWidth");return s!=null?ze(s,n):Math.max(Math.min(n/2,a),o)}var dq=a_e;function lU(r){r.registerChartView(uq),r.registerSeriesModel(fq),r.registerPreprocessor(sU),r.registerVisual(hq),r.registerLayout(dq)}function mq(r,e){var t=e.rippleEffectColor||e.color;r.eachChild(function(i){i.attr({z:e.z,zlevel:e.zlevel,style:{stroke:e.brushType==="stroke"?t:null,fill:e.brushType==="fill"?t:null}})})}var s_e=function(r){Z(e,r);function e(t,i){var n=r.call(this)||this,a=new Bu(t,i),o=new Ze;return n.add(a),n.add(o),n.updateData(t,i),n}return e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var i=t.symbolType,n=t.color,a=t.rippleNumber,o=this.childAt(1),s=0;s<a;s++){var l=Sr(i,-1,-1,2,2,n);l.attr({style:{strokeNoScale:!0},z2:99,silent:!0,scaleX:.5,scaleY:.5});var u=-s/a*t.period+t.effectOffset;l.animate("",!0).when(t.period,{scaleX:t.rippleScale/2,scaleY:t.rippleScale/2}).delay(u).start(),l.animateStyle(!0).when(t.period,{opacity:0}).delay(u).start(),o.add(l)}mq(o,t)},e.prototype.updateEffectAnimation=function(t){for(var i=this._effectCfg,n=this.childAt(1),a=["symbolType","period","rippleScale","rippleNumber"],o=0;o<a.length;o++){var s=a[o];if(i[s]!==t[s]){this.stopEffectAnimation(),this.startEffectAnimation(t);return}}mq(n,t)},e.prototype.highlight=function(){Bn(this)},e.prototype.downplay=function(){kn(this)},e.prototype.getSymbolType=function(){var t=this.childAt(0);return t&&t.getSymbolType()},e.prototype.updateData=function(t,i){var n=this,a=t.hostModel;this.childAt(0).updateData(t,i);var o=this.childAt(1),s=t.getItemModel(i),l=t.getItemVisual(i,"symbol"),u=Zs(t.getItemVisual(i,"symbolSize")),c=t.getItemVisual(i,"style"),f=c&&c.fill,h=s.getModel("emphasis");o.setScale(u),o.traverse(function(m){m.setStyle("fill",f)});var p=bo(t.getItemVisual(i,"symbolOffset"),u);p&&(o.x=p[0],o.y=p[1]);var d=t.getItemVisual(i,"symbolRotate");o.rotation=(d||0)*Math.PI/180||0;var g={};g.showEffectOn=a.get("showEffectOn"),g.rippleScale=s.get(["rippleEffect","scale"]),g.brushType=s.get(["rippleEffect","brushType"]),g.period=s.get(["rippleEffect","period"])*1e3,g.effectOffset=i/t.count(),g.z=a.getShallow("z")||0,g.zlevel=a.getShallow("zlevel")||0,g.symbolType=l,g.color=f,g.rippleEffectColor=s.get(["rippleEffect","color"]),g.rippleNumber=s.get(["rippleEffect","number"]),g.showEffectOn==="render"?(this._effectCfg?this.updateEffectAnimation(g):this.startEffectAnimation(g),this._effectCfg=g):(this._effectCfg=null,this.stopEffectAnimation(),this.onHoverStateChange=function(m){m==="emphasis"?g.showEffectOn!=="render"&&n.startEffectAnimation(g):m==="normal"&&g.showEffectOn!=="render"&&n.stopEffectAnimation()}),this._effectCfg=g,ar(this,h.get("focus"),h.get("blurScope"),h.get("disabled"))},e.prototype.fadeOut=function(t){t&&t()},e}(Ze),vq=s_e;var l_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this._symbolDraw=new Xl(vq)},e.prototype.render=function(t,i,n){var a=t.getData(),o=this._symbolDraw;o.updateData(a,{clipShape:this._getClipShape(t)}),this.group.add(o.group)},e.prototype._getClipShape=function(t){var i=t.coordinateSystem,n=i&&i.getArea&&i.getArea();return t.get("clip",!0)?n:null},e.prototype.updateTransform=function(t,i,n){var a=t.getData();this.group.dirty();var o=tl("").reset(t,i,n);o.progress&&o.progress({start:0,end:a.count(),count:a.count()},a),this._symbolDraw.updateLayout()},e.prototype._updateGroupTransform=function(t){var i=t.coordinateSystem;i&&i.getRoamTransform&&(this.group.transform=jV(i.getRoamTransform()),this.group.decomposeTransform())},e.prototype.remove=function(t,i){this._symbolDraw&&this._symbolDraw.remove(!0)},e.type="effectScatter",e}(Yt),gq=l_e;var u_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.brushSelector=function(t,i,n){return n.point(i.getItemLayout(t))},e.type="series.effectScatter",e.dependencies=["grid","polar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,effectType:"ripple",progressive:0,showEffectOn:"render",clip:!0,rippleEffect:{period:4,scale:2.5,brushType:"fill",number:3},universalTransition:{divideShape:"clone"},symbolSize:10},e}(jt),yq=u_e;function uU(r){r.registerChartView(gq),r.registerSeriesModel(yq),r.registerLayout(tl("effectScatter"))}var c_e=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;return a.add(a.createLine(t,i,n)),a._updateEffectSymbol(t,i),a}return e.prototype.createLine=function(t,i,n){return new Fv(t,i,n)},e.prototype._updateEffectSymbol=function(t,i){var n=t.getItemModel(i),a=n.getModel("effect"),o=a.get("symbolSize"),s=a.get("symbol");pe(o)||(o=[o,o]);var l=t.getItemVisual(i,"style"),u=a.get("color")||l&&l.stroke,c=this.childAt(1);this._symbolType!==s&&(this.remove(c),c=Sr(s,-.5,-.5,1,1,u),c.z2=100,c.culling=!0,this.add(c)),c&&(c.setStyle("shadowColor",u),c.setStyle(a.getItemStyle(["color"])),c.scaleX=o[0],c.scaleY=o[1],c.setColor(u),this._symbolType=s,this._symbolScale=o,this._updateEffectAnimation(t,a,i))},e.prototype._updateEffectAnimation=function(t,i,n){var a=this.childAt(1);if(a){var o=t.getItemLayout(n),s=i.get("period")*1e3,l=i.get("loop"),u=i.get("roundTrip"),c=i.get("constantSpeed"),f=Br(i.get("delay"),function(p){return p/t.count()*s/3});if(a.ignore=!0,this._updateAnimationPoints(a,o),c>0&&(s=this._getLineLength(a)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){a.stopAnimation();var h=void 0;He(f)?h=f(n):h=f,a.__t>0&&(h=-s*a.__t),this._animateSymbol(a,s,h,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},e.prototype._animateSymbol=function(t,i,n,a,o){if(i>0){t.__t=0;var s=this,l=t.animate("",a).when(o?i*2:i,{__t:o?2:1}).delay(n).during(function(){s._updateSymbolPosition(t)});a||l.done(function(){s.remove(t)}),l.start()}},e.prototype._getLineLength=function(t){return Yo(t.__p1,t.__cp1)+Yo(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,i){t.__p1=i[0],t.__p2=i[1],t.__cp1=i[2]||[(i[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2]},e.prototype.updateData=function(t,i,n){this.childAt(0).updateData(t,i,n),this._updateEffectSymbol(t,i)},e.prototype._updateSymbolPosition=function(t){var i=t.__p1,n=t.__p2,a=t.__cp1,o=t.__t<1?t.__t:2-t.__t,s=[t.x,t.y],l=s.slice(),u=vi,c=H0;s[0]=u(i[0],a[0],n[0],o),s[1]=u(i[1],a[1],n[1],o);var f=t.__t<1?c(i[0],a[0],n[0],o):c(n[0],a[0],i[0],1-o),h=t.__t<1?c(i[1],a[1],n[1],o):c(n[1],a[1],i[1],1-o);t.rotation=-Math.atan2(h,f)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(t.__lastT!==void 0&&t.__lastT<t.__t?(t.scaleY=Yo(l,s)*1.05,o===1&&(s[0]=l[0]+(s[0]-l[0])/2,s[1]=l[1]+(s[1]-l[1])/2)):t.__lastT===1?t.scaleY=2*Yo(i,s):t.scaleY=this._symbolScale[1]),t.__lastT=t.__t,t.ignore=!1,t.x=s[0],t.y=s[1]},e.prototype.updateLayout=function(t,i){this.childAt(0).updateLayout(t,i);var n=t.getItemModel(i).getModel("effect");this._updateEffectAnimation(t,n,i)},e}(Ze),FT=c_e;var f_e=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;return a._createPolyline(t,i,n),a}return e.prototype._createPolyline=function(t,i,n){var a=t.getItemLayout(i),o=new Qr({shape:{points:a}});this.add(o),this._updateCommonStl(t,i,n)},e.prototype.updateData=function(t,i,n){var a=t.hostModel,o=this.childAt(0),s={shape:{points:t.getItemLayout(i)}};Dt(o,s,a,i),this._updateCommonStl(t,i,n)},e.prototype._updateCommonStl=function(t,i,n){var a=this.childAt(0),o=t.getItemModel(i),s=n&&n.emphasisLineStyle,l=n&&n.focus,u=n&&n.blurScope,c=n&&n.emphasisDisabled;if(!n||t.hasItemOption){var f=o.getModel("emphasis");s=f.getModel("lineStyle").getLineStyle(),c=f.get("disabled"),l=f.get("focus"),u=f.get("blurScope")}a.useStyle(t.getItemVisual(i,"style")),a.style.fill=null,a.style.strokeNoScale=!0;var h=a.ensureState("emphasis");h.style=s,ar(this,l,u,c)},e.prototype.updateLayout=function(t,i){var n=this.childAt(0);n.setShape("points",t.getItemLayout(i))},e}(Ze),BT=f_e;var h_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._lastFrame=0,t._lastFramePercent=0,t}return e.prototype.createLine=function(t,i,n){return new BT(t,i,n)},e.prototype._updateAnimationPoints=function(t,i){this._points=i;for(var n=[0],a=0,o=1;o<i.length;o++){var s=i[o-1],l=i[o];a+=Yo(s,l),n.push(a)}if(a===0){this._length=0;return}for(var o=0;o<n.length;o++)n[o]/=a;this._offsets=n,this._length=a},e.prototype._getLineLength=function(){return this._length},e.prototype._updateSymbolPosition=function(t){var i=t.__t<1?t.__t:2-t.__t,n=this._points,a=this._offsets,o=n.length;if(a){var s=this._lastFrame,l;if(i<this._lastFramePercent){var u=Math.min(s+1,o-1);for(l=u;l>=0&&!(a[l]<=i);l--);l=Math.min(l,o-2)}else{for(l=s;l<o&&!(a[l]>i);l++);l=Math.min(l-1,o-2)}var c=(i-a[l])/(a[l+1]-a[l]),f=n[l],h=n[l+1];t.x=f[0]*(1-c)+c*h[0],t.y=f[1]*(1-c)+c*h[1];var p=t.__t<1?h[0]-f[0]:f[0]-h[0],d=t.__t<1?h[1]-f[1]:f[1]-h[1];t.rotation=-Math.atan2(d,p)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=i,t.ignore=!1}},e}(FT),_q=h_e;var p_e=function(){function r(){this.polyline=!1,this.curveness=0,this.segs=[]}return r}(),d_e=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i._off=0,i.hoverDataIdx=-1,i}return e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new p_e},e.prototype.buildPath=function(t,i){var n=i.segs,a=i.curveness,o;if(i.polyline)for(o=this._off;o<n.length;){var s=n[o++];if(s>0){t.moveTo(n[o++],n[o++]);for(var l=1;l<s;l++)t.lineTo(n[o++],n[o++])}}else for(o=this._off;o<n.length;){var u=n[o++],c=n[o++],f=n[o++],h=n[o++];if(t.moveTo(u,c),a>0){var p=(u+f)/2-(c-h)*a,d=(c+h)/2-(f-u)*a;t.quadraticCurveTo(p,d,f,h)}else t.lineTo(f,h)}this.incremental&&(this._off=o,this.notClear=!0)},e.prototype.findDataIndex=function(t,i){var n=this.shape,a=n.segs,o=n.curveness,s=this.style.lineWidth;if(n.polyline)for(var l=0,u=0;u<a.length;){var c=a[u++];if(c>0)for(var f=a[u++],h=a[u++],p=1;p<c;p++){var d=a[u++],g=a[u++];if(Nl(f,h,d,g,s,t,i))return l}l++}else for(var l=0,u=0;u<a.length;){var f=a[u++],h=a[u++],d=a[u++],g=a[u++];if(o>0){var m=(f+d)/2-(h-g)*o,v=(h+g)/2-(d-f)*o;if(Kb(f,h,m,v,d,g,s,t,i))return l}else if(Nl(f,h,d,g,s,t,i))return l;l++}return-1},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();if(t=n[0],i=n[1],a.contain(t,i)){var o=this.hoverDataIdx=this.findDataIndex(t,i);return o>=0}return this.hoverDataIdx=-1,!1},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var i=this.shape,n=i.segs,a=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u<n.length;){var c=n[u++],f=n[u++];a=Math.min(c,a),s=Math.max(c,s),o=Math.min(f,o),l=Math.max(f,l)}t=this._rect=new lt(a,o,s,l)}return t},e}(ut),m_e=function(){function r(){this.group=new Ze}return r.prototype.updateData=function(e){this._clear();var t=this._create();t.setShape({segs:e.getLayout("linesPoints")}),this._setCommon(t,e)},r.prototype.incrementalPrepareUpdate=function(e){this.group.removeAll(),this._clear()},r.prototype.incrementalUpdate=function(e,t){var i=this._newAdded[0],n=t.getLayout("linesPoints"),a=i&&i.shape.segs;if(a&&a.length<2e4){var o=a.length,s=new Float32Array(o+n.length);s.set(a),s.set(n,o),i.setShape({segs:s})}else{this._newAdded=[];var l=this._create();l.incremental=!0,l.setShape({segs:n}),this._setCommon(l,t),l.__startIndex=e.start}},r.prototype.remove=function(){this._clear()},r.prototype.eachRendered=function(e){this._newAdded[0]&&e(this._newAdded[0])},r.prototype._create=function(){var e=new d_e({cursor:"default",ignoreCoarsePointer:!0});return this._newAdded.push(e),this.group.add(e),e},r.prototype._setCommon=function(e,t,i){var n=t.hostModel;e.setShape({polyline:n.get("polyline"),curveness:n.get(["lineStyle","curveness"])}),e.useStyle(n.getModel("lineStyle").getLineStyle()),e.style.strokeNoScale=!0;var a=t.getVisual("style");a&&a.stroke&&e.setStyle("stroke",a.stroke),e.setStyle("fill",null);var o=rt(e);o.seriesIndex=n.seriesIndex,e.on("mousemove",function(s){o.dataIndex=null;var l=e.hoverDataIdx;l>0&&(o.dataIndex=l+e.__startIndex)})},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),xq=m_e;var v_e={seriesType:"lines",plan:Mo(),reset:function(r){var e=r.coordinateSystem;if(e){var t=r.get("polyline"),i=r.pipelineContext.large;return{progress:function(n,a){var o=[];if(i){var s=void 0,l=n.end-n.start;if(t){for(var u=0,c=n.start;c<n.end;c++)u+=r.getLineCoordsCount(c);s=new Float32Array(l+u*2)}else s=new Float32Array(l*4);for(var f=0,h=[],c=n.start;c<n.end;c++){var p=r.getLineCoords(c,o);t&&(s[f++]=p);for(var d=0;d<p;d++)h=e.dataToPoint(o[d],!1,h),s[f++]=h[0],s[f++]=h[1]}a.setLayout("linesPoints",s)}else for(var c=n.start;c<n.end;c++){var g=a.getItemModel(c),p=r.getLineCoords(c,o),m=[];if(t)for(var v=0;v<p;v++)m.push(e.dataToPoint(o[v]));else{m[0]=e.dataToPoint(o[0]),m[1]=e.dataToPoint(o[1]);var _=g.get(["lineStyle","curveness"]);+_&&(m[2]=[(m[0][0]+m[1][0])/2-(m[0][1]-m[1][1])*_,(m[0][1]+m[1][1])/2-(m[1][0]-m[0][0])*_])}a.setItemLayout(c,m)}}}}}},kT=v_e;var g_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this._updateLineDraw(a,t),s=t.get("zlevel"),l=t.get(["effect","trailLength"]),u=n.getZr(),c=u.painter.getType()==="svg";c||u.painter.getLayer(s).clear(!0),this._lastZlevel!=null&&!c&&u.configLayer(this._lastZlevel,{motionBlur:!1}),this._showEffect(t)&&l>0&&(c||u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)})),o.updateData(a);var f=t.get("clip",!0)&&Yl(t.coordinateSystem,!1,t);f?this.group.setClipPath(f):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,i,n){var a=t.getData(),o=this._updateLineDraw(a,t);o.incrementalPrepareUpdate(a),this._clearLayer(n),this._finished=!1},e.prototype.incrementalRender=function(t,i,n){this._lineDraw.incrementalUpdate(t,i.getData()),this._finished=t.end===i.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,i,n){var a=t.getData(),o=t.pipelineContext;if(!this._finished||o.large||o.progressiveRender)return{update:!0};var s=kT.reset(t,i,n);s.progress&&s.progress({start:0,end:a.count(),count:a.count()},a),this._lineDraw.updateLayout(),this._clearLayer(n)},e.prototype._updateLineDraw=function(t,i){var n=this._lineDraw,a=this._showEffect(i),o=!!i.get("polyline"),s=i.pipelineContext,l=s.large;return(!n||a!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(n&&n.remove(),n=this._lineDraw=l?new xq:new Bv(o?a?_q:BT:a?FT:Fv),this._hasEffet=a,this._isPolyline=o,this._isLargeDraw=l),this.group.add(n.group),n},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var i=t.getZr(),n=i.painter.getType()==="svg";!n&&this._lastZlevel!=null&&i.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,i){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(i)},e.prototype.dispose=function(t,i){this.remove(t,i)},e.type="lines",e}(Yt),Sq=g_e;var y_e=typeof Uint32Array>"u"?Array:Uint32Array,__e=typeof Float64Array>"u"?Array:Float64Array;function Mq(r){var e=r.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(r.data=de(e,function(t){var i=[t[0].coord,t[1].coord],n={coords:i};return t[0].name&&(n.fromName=t[0].name),t[1].name&&(n.toName=t[1].name),bm([n,t[0],t[1]])}))}var x_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="lineStyle",t.visualDrawType="stroke",t}return e.prototype.init=function(t){t.data=t.data||[],Mq(t);var i=this._processFlatCoordsArray(t.data);this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset,i.flatCoords&&(t.data=new Float32Array(i.count)),r.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(t){if(Mq(t),t.data){var i=this._processFlatCoordsArray(t.data);this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset,i.flatCoords&&(t.data=new Float32Array(i.count))}r.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var i=this._processFlatCoordsArray(t.data);i.flatCoords&&(this._flatCoords?(this._flatCoords=rp(this._flatCoords,i.flatCoords),this._flatCoordsOffset=rp(this._flatCoordsOffset,i.flatCoordsOffset)):(this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset),t.data=new Float32Array(i.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var i=this.getData().getItemModel(t),n=i.option instanceof Array?i.option:i.getShallow("coords");return n},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[t*2+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,i){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[t*2],a=this._flatCoordsOffset[t*2+1],o=0;o<a;o++)i[o]=i[o]||[],i[o][0]=this._flatCoords[n+o*2],i[o][1]=this._flatCoords[n+o*2+1];return a}else{for(var s=this._getCoordsFromItemModel(t),o=0;o<s.length;o++)i[o]=i[o]||[],i[o][0]=s[o][0],i[o][1]=s[o][1];return s.length}},e.prototype._processFlatCoordsArray=function(t){var i=0;if(this._flatCoords&&(i=this._flatCoords.length),Ct(t[0])){for(var n=t.length,a=new y_e(n),o=new __e(n),s=0,l=0,u=0,c=0;c<n;){u++;var f=t[c++];a[l++]=s+i,a[l++]=f;for(var h=0;h<f;h++){var p=t[c++],d=t[c++];o[s++]=p,o[s++]=d,c>n}}return{flatCoordsOffset:new Uint32Array(a.buffer,0,l),flatCoords:o,count:u}}return{flatCoordsOffset:null,flatCoords:null,count:t.length}},e.prototype.getInitialData=function(t,i){if(0)var n;var a=new ri(["value"],this);return a.hasItemOption=!1,a.initData(t.data,[],function(o,s,l,u){if(o instanceof Array)return NaN;a.hasItemOption=!0;var c=o.value;if(c!=null)return c instanceof Array?c[u]:c}),a},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=a.getItemModel(t),s=o.get("name");if(s)return s;var l=o.get("fromName"),u=o.get("toName"),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),Or("nameValue",{name:c.join(" > ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return t??(this.option.large?1e4:this.get("progressive"))},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return t??(this.option.large?2e4:this.get("progressiveThreshold"))},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),i=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&i>0?i+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},e}(jt),bq=x_e;function VT(r){return r instanceof Array||(r=[r,r]),r}var S_e={seriesType:"lines",reset:function(r){var e=VT(r.get("symbol")),t=VT(r.get("symbolSize")),i=r.getData();i.setVisual("fromSymbol",e&&e[0]),i.setVisual("toSymbol",e&&e[1]),i.setVisual("fromSymbolSize",t&&t[0]),i.setVisual("toSymbolSize",t&&t[1]);function n(a,o){var s=a.getItemModel(o),l=VT(s.getShallow("symbol",!0)),u=VT(s.getShallow("symbolSize",!0));l[0]&&a.setItemVisual(o,"fromSymbol",l[0]),l[1]&&a.setItemVisual(o,"toSymbol",l[1]),u[0]&&a.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&a.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:i.hasItemOption?n:null}}},wq=S_e;function cU(r){r.registerChartView(Sq),r.registerSeriesModel(bq),r.registerLayout(kT),r.registerVisual(wq)}var M_e=256,b_e=function(){function r(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=Fn.createCanvas();this.canvas=e}return r.prototype.update=function(e,t,i,n,a,o){var s=this._getBrush(),l=this._getGradient(a,"inRange"),u=this._getGradient(a,"outOfRange"),c=this.pointSize+this.blurSize,f=this.canvas,h=f.getContext("2d"),p=e.length;f.width=t,f.height=i;for(var d=0;d<p;++d){var g=e[d],m=g[0],v=g[1],_=g[2],y=n(_);h.globalAlpha=y,h.drawImage(s,m-c,v-c)}if(!f.width||!f.height)return f;for(var x=h.getImageData(0,0,f.width,f.height),M=x.data,S=0,w=M.length,T=this.minOpacity,C=this.maxOpacity,b=C-T;S<w;){var y=M[S+3]/256,E=Math.floor(y*(M_e-1))*4;if(y>0){var I=o(y)?l:u;y>0&&(y=y*b+T),M[S++]=I[E],M[S++]=I[E+1],M[S++]=I[E+2],M[S++]=I[E+3]*y*256}else S+=4}return h.putImageData(x,0,0),f},r.prototype._getBrush=function(){var e=this._brushCanvas||(this._brushCanvas=Fn.createCanvas()),t=this.pointSize+this.blurSize,i=t*2;e.width=i,e.height=i;var n=e.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-t,t,this.pointSize,0,Math.PI*2,!0),n.closePath(),n.fill(),e},r.prototype._getGradient=function(e,t){for(var i=this._gradientPixels,n=i[t]||(i[t]=new Uint8ClampedArray(256*4)),a=[0,0,0,0],o=0,s=0;s<256;s++)e[t](s/255,!0,a),n[o++]=a[0],n[o++]=a[1],n[o++]=a[2],n[o++]=a[3];return n},r}(),Tq=b_e;function w_e(r,e,t){var i=r[1]-r[0];e=de(e,function(o){return{interval:[(o.interval[0]-r[0])/i,(o.interval[1]-r[0])/i]}});var n=e.length,a=0;return function(o){var s;for(s=a;s<n;s++){var l=e[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}if(s===n)for(s=a-1;s>=0;s--){var l=e[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}return s>=0&&s<n&&t[s]}}function T_e(r,e){var t=r[1]-r[0];return e=[(e[0]-r[0])/t,(e[1]-r[0])/t],function(i){return i>=e[0]&&i<=e[1]}}function Eq(r){var e=r.dimensions;return e[0]==="lng"&&e[1]==="lat"}var E_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a;i.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===t&&(a=s)})}),this._progressiveEls=null,this.group.removeAll();var o=t.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"?this._renderOnCartesianAndCalendar(t,n,0,t.getData().count()):Eq(o)&&this._renderOnGeo(o,t,a,n)},e.prototype.incrementalPrepareRender=function(t,i,n){this.group.removeAll()},e.prototype.incrementalRender=function(t,i,n,a){var o=i.coordinateSystem;o&&(Eq(o)?this.render(i,n,a):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(i,a,t.start,t.end,!0)))},e.prototype.eachRendered=function(t){ca(this._progressiveEls||this.group,t)},e.prototype._renderOnCartesianAndCalendar=function(t,i,n,a,o){var s=t.coordinateSystem,l=us(s,"cartesian2d"),u,c,f,h;if(l){var p=s.getAxis("x"),d=s.getAxis("y");u=p.getBandWidth()+.5,c=d.getBandWidth()+.5,f=p.scale.getExtent(),h=d.scale.getExtent()}for(var g=this.group,m=t.getData(),v=t.getModel(["emphasis","itemStyle"]).getItemStyle(),_=t.getModel(["blur","itemStyle"]).getItemStyle(),y=t.getModel(["select","itemStyle"]).getItemStyle(),x=t.get(["itemStyle","borderRadius"]),M=wr(t),S=t.getModel("emphasis"),w=S.get("focus"),T=S.get("blurScope"),C=S.get("disabled"),b=l?[m.mapDimension("x"),m.mapDimension("y"),m.mapDimension("value")]:[m.mapDimension("time"),m.mapDimension("value")],E=n;E<a;E++){var I=void 0,R=m.getItemVisual(E,"style");if(l){var A=m.get(b[0],E),D=m.get(b[1],E);if(isNaN(m.get(b[2],E))||isNaN(A)||isNaN(D)||A<f[0]||A>f[1]||D<h[0]||D>h[1])continue;var U=s.dataToPoint([A,D]);I=new Et({shape:{x:U[0]-u/2,y:U[1]-c/2,width:u,height:c},style:R})}else{if(isNaN(m.get(b[1],E)))continue;I=new Et({z2:1,shape:s.dataToRect([m.get(b[0],E)]).contentShape,style:R})}if(m.hasItemOption){var B=m.getItemModel(E),z=B.getModel("emphasis");v=z.getModel("itemStyle").getItemStyle(),_=B.getModel(["blur","itemStyle"]).getItemStyle(),y=B.getModel(["select","itemStyle"]).getItemStyle(),x=B.get(["itemStyle","borderRadius"]),w=z.get("focus"),T=z.get("blurScope"),C=z.get("disabled"),M=wr(B)}I.shape.r=x;var k=t.getRawValue(E),G="-";k&&k[2]!=null&&(G=k[2]+""),Ir(I,M,{labelFetcher:t,labelDataIndex:E,defaultOpacity:R.opacity,defaultText:G}),I.ensureState("emphasis").style=v,I.ensureState("blur").style=_,I.ensureState("select").style=y,ar(I,w,T,C),I.incremental=o,o&&(I.states.emphasis.hoverLayer=!0),g.add(I),m.setItemGraphicEl(E,I),this._progressiveEls&&this._progressiveEls.push(I)}},e.prototype._renderOnGeo=function(t,i,n,a){var o=n.targetVisuals.inRange,s=n.targetVisuals.outOfRange,l=i.getData(),u=this._hmLayer||this._hmLayer||new Tq;u.blurSize=i.get("blurSize"),u.pointSize=i.get("pointSize"),u.minOpacity=i.get("minOpacity"),u.maxOpacity=i.get("maxOpacity");var c=t.getViewRect().clone(),f=t.getRoamTransform();c.applyTransform(f);var h=Math.max(c.x,0),p=Math.max(c.y,0),d=Math.min(c.width+c.x,a.getWidth()),g=Math.min(c.height+c.y,a.getHeight()),m=d-h,v=g-p,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],y=l.mapArray(_,function(w,T,C){var b=t.dataToPoint([w,T]);return b[0]-=h,b[1]-=p,b.push(C),b}),x=n.getExtent(),M=n.type==="visualMap.continuous"?T_e(x,n.option.range):w_e(x,n.getPieceList(),n.option.selected);u.update(y,m,v,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},M);var S=new Ur({style:{width:m,height:v,x:h,y:p,image:u.canvas},silent:!0});this.group.add(S)},e.type="heatmap",e}(Yt),Aq=E_e;var A_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{generateCoord:"value"})},e.prototype.preventIncremental=function(){var t=Nu.get(this.get("coordinateSystem"));if(t&&t.dimensions)return t.dimensions[0]==="lng"&&t.dimensions[1]==="lat"},e.type="series.heatmap",e.dependencies=["grid","geo","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:"#212121"}}},e}(jt),Cq=A_e;function fU(r){r.registerChartView(Aq),r.registerSeriesModel(Cq)}var C_e=["itemStyle","borderWidth"],Rq=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],hU=new ua,R_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=this.group,o=t.getData(),s=this._data,l=t.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),f=l.master.getRect(),h={ecSize:{width:n.getWidth(),height:n.getHeight()},seriesModel:t,coordSys:l,coordSysExtent:[[f.x,f.x+f.width],[f.y,f.y+f.height]],isHorizontal:c,valueDim:Rq[+c],categoryDim:Rq[1-+c]};o.diff(s).add(function(d){if(o.hasValue(d)){var g=Pq(o,d),m=Lq(o,d,g,h),v=Dq(o,h,m);o.setItemGraphicEl(d,v),a.add(v),Nq(v,h,m)}}).update(function(d,g){var m=s.getItemGraphicEl(g);if(!o.hasValue(d)){a.remove(m);return}var v=Pq(o,d),_=Lq(o,d,v,h),y=Vq(o,_);m&&y!==m.__pictorialShapeStr&&(a.remove(m),o.setItemGraphicEl(d,null),m=null),m?O_e(m,h,_):m=Dq(o,h,_,!0),o.setItemGraphicEl(d,m),m.__pictorialSymbolMeta=_,a.add(m),Nq(m,h,_)}).remove(function(d){var g=s.getItemGraphicEl(d);g&&Iq(s,d,g.__pictorialSymbolMeta.animationModel,g)}).execute();var p=t.get("clip",!0)?Yl(t.coordinateSystem,!1,t):null;return p?a.setClipPath(p):a.removeClipPath(),this._data=o,this.group},e.prototype.remove=function(t,i){var n=this.group,a=this._data;t.get("animation")?a&&a.eachItemGraphicEl(function(o){Iq(a,rt(o).dataIndex,t,o)}):n.removeAll()},e.type="pictorialBar",e}(Yt);function Lq(r,e,t,i){var n=r.getItemLayout(e),a=t.get("symbolRepeat"),o=t.get("symbolClip"),s=t.get("symbolPosition")||"start",l=t.get("symbolRotate"),u=(l||0)*Math.PI/180||0,c=t.get("symbolPatternSize")||2,f=t.isAnimationEnabled(),h={dataIndex:e,layout:n,itemModel:t,symbolType:r.getItemVisual(e,"symbol")||"circle",style:r.getItemVisual(e,"style"),symbolClip:o,symbolRepeat:a,symbolRepeatDirection:t.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:f?t:null,hoverScale:f&&t.get(["emphasis","scale"]),z2:t.getShallow("z",!0)||0};L_e(t,a,n,i,h),P_e(r,e,n,a,o,h.boundingLength,h.pxSign,c,i,h),D_e(t,h.symbolScale,u,i,h);var p=h.symbolSize,d=bo(t.get("symbolOffset"),p);return I_e(t,p,n,a,o,d,s,h.valueLineWidth,h.boundingLength,h.repeatCutLength,i,h),h}function L_e(r,e,t,i,n){var a=i.valueDim,o=r.get("symbolBoundingData"),s=i.coordSys.getOtherAxis(i.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(t[a.wh]<=0),c;if(pe(o)){var f=[pU(s,o[0])-l,pU(s,o[1])-l];f[1]<f[0]&&f.reverse(),c=f[u]}else o!=null?c=pU(s,o)-l:e?c=i.coordSysExtent[a.index][u]-l:c=t[a.wh];n.boundingLength=c,e&&(n.repeatCutLength=t[a.wh]),n.pxSign=c>0?1:-1}function pU(r,e){return r.toGlobalCoord(r.dataToCoord(r.scale.parse(e)))}function P_e(r,e,t,i,n,a,o,s,l,u){var c=l.valueDim,f=l.categoryDim,h=Math.abs(t[f.wh]),p=r.getItemVisual(e,"symbolSize"),d;pe(p)?d=p.slice():p==null?d=["100%","100%"]:d=[p,p],d[f.index]=ze(d[f.index],h),d[c.index]=ze(d[c.index],i?h:Math.abs(a)),u.symbolSize=d;var g=u.symbolScale=[d[0]/s,d[1]/s];g[c.index]*=(l.isHorizontal?-1:1)*o}function D_e(r,e,t,i,n){var a=r.get(C_e)||0;a&&(hU.attr({scaleX:e[0],scaleY:e[1],rotation:t}),hU.updateTransform(),a/=hU.getLineScale(),a*=e[i.valueDim.index]),n.valueLineWidth=a||0}function I_e(r,e,t,i,n,a,o,s,l,u,c,f){var h=c.categoryDim,p=c.valueDim,d=f.pxSign,g=Math.max(e[p.index]+s,0),m=g;if(i){var v=Math.abs(l),_=Br(r.get("symbolMargin"),"15%")+"",y=!1;_.lastIndexOf("!")===_.length-1&&(y=!0,_=_.slice(0,_.length-1));var x=ze(_,e[p.index]),M=Math.max(g+x*2,0),S=y?0:x*2,w=xp(i),T=w?i:Uq((v+S)/M),C=v-T*g;x=C/2/(y?T:Math.max(T-1,1)),M=g+x*2,S=y?0:x*2,!w&&i!=="fixed"&&(T=u?Uq((Math.abs(u)+S)/M):0),m=T*M-S,f.repeatTimes=T,f.symbolMargin=x}var b=d*(m/2),E=f.pathPosition=[];E[h.index]=t[h.wh]/2,E[p.index]=o==="start"?b:o==="end"?l-b:l/2,a&&(E[0]+=a[0],E[1]+=a[1]);var I=f.bundlePosition=[];I[h.index]=t[h.xy],I[p.index]=t[p.xy];var R=f.barRectShape=fe({},t);R[p.wh]=d*Math.max(Math.abs(t[p.wh]),Math.abs(E[p.index]+b)),R[h.wh]=t[h.wh];var A=f.clipShape={};A[h.xy]=-t[h.xy],A[h.wh]=c.ecSize[h.wh],A[p.xy]=0,A[p.wh]=t[p.wh]}function Oq(r){var e=r.symbolPatternSize,t=Sr(r.symbolType,-e/2,-e/2,e,e);return t.attr({culling:!0}),t.type!=="image"&&t.setStyle({strokeNoScale:!0}),t}function zq(r,e,t,i){var n=r.__pictorialBundle,a=t.symbolSize,o=t.valueLineWidth,s=t.pathPosition,l=e.valueDim,u=t.repeatTimes||0,c=0,f=a[e.valueDim.index]+o+t.symbolMargin*2;for(dU(r,function(g){g.__pictorialAnimationIndex=c,g.__pictorialRepeatTimes=u,c<u?Xv(g,null,d(c),t,i):Xv(g,null,{scaleX:0,scaleY:0},t,i,function(){n.remove(g)}),c++});c<u;c++){var h=Oq(t);h.__pictorialAnimationIndex=c,h.__pictorialRepeatTimes=u,n.add(h);var p=d(c);Xv(h,{x:p.x,y:p.y,scaleX:0,scaleY:0},{scaleX:p.scaleX,scaleY:p.scaleY,rotation:p.rotation},t,i)}function d(g){var m=s.slice(),v=t.pxSign,_=g;return(t.symbolRepeatDirection==="start"?v>0:v<0)&&(_=u-1-g),m[l.index]=f*(_-u/2+.5)+s[l.index],{x:m[0],y:m[1],scaleX:t.symbolScale[0],scaleY:t.symbolScale[1],rotation:t.rotation}}}function Fq(r,e,t,i){var n=r.__pictorialBundle,a=r.__pictorialMainPath;a?Xv(a,null,{x:t.pathPosition[0],y:t.pathPosition[1],scaleX:t.symbolScale[0],scaleY:t.symbolScale[1],rotation:t.rotation},t,i):(a=r.__pictorialMainPath=Oq(t),n.add(a),Xv(a,{x:t.pathPosition[0],y:t.pathPosition[1],scaleX:0,scaleY:0,rotation:t.rotation},{scaleX:t.symbolScale[0],scaleY:t.symbolScale[1]},t,i))}function Bq(r,e,t){var i=fe({},e.barRectShape),n=r.__pictorialBarRect;n?Xv(n,null,{shape:i},e,t):(n=r.__pictorialBarRect=new Et({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),n.disableMorphing=!0,r.add(n))}function kq(r,e,t,i){if(t.symbolClip){var n=r.__pictorialClipPath,a=fe({},t.clipShape),o=e.valueDim,s=t.animationModel,l=t.dataIndex;if(n)Dt(n,{shape:a},s,l);else{a[o.wh]=0,n=new Et({shape:a}),r.__pictorialBundle.setClipPath(n),r.__pictorialClipPath=n;var u={};u[o.wh]=t.clipShape[o.wh],Rt[i?"updateProps":"initProps"](n,{shape:u},s,l)}}}function Pq(r,e){var t=r.getItemModel(e);return t.getAnimationDelayParams=N_e,t.isAnimationEnabled=U_e,t}function N_e(r){return{index:r.__pictorialAnimationIndex,count:r.__pictorialRepeatTimes}}function U_e(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function Dq(r,e,t,i){var n=new Ze,a=new Ze;return n.add(a),n.__pictorialBundle=a,a.x=t.bundlePosition[0],a.y=t.bundlePosition[1],t.symbolRepeat?zq(n,e,t):Fq(n,e,t),Bq(n,t,i),kq(n,e,t,i),n.__pictorialShapeStr=Vq(r,t),n.__pictorialSymbolMeta=t,n}function O_e(r,e,t){var i=t.animationModel,n=t.dataIndex,a=r.__pictorialBundle;Dt(a,{x:t.bundlePosition[0],y:t.bundlePosition[1]},i,n),t.symbolRepeat?zq(r,e,t,!0):Fq(r,e,t,!0),Bq(r,t,!0),kq(r,e,t,!0)}function Iq(r,e,t,i){var n=i.__pictorialBarRect;n&&n.removeTextContent();var a=[];dU(i,function(o){a.push(o)}),i.__pictorialMainPath&&a.push(i.__pictorialMainPath),i.__pictorialClipPath&&(t=null),N(a,function(o){ts(o,{scaleX:0,scaleY:0},t,e,function(){i.parent&&i.parent.remove(i)})}),r.setItemGraphicEl(e,null)}function Vq(r,e){return[r.getItemVisual(e.dataIndex,"symbol")||"none",!!e.symbolRepeat,!!e.symbolClip].join(":")}function dU(r,e,t){N(r.__pictorialBundle.children(),function(i){i!==r.__pictorialBarRect&&e.call(t,i)})}function Xv(r,e,t,i,n,a){e&&r.attr(e),i.symbolClip&&!n?t&&r.attr(t):t&&Rt[n?"updateProps":"initProps"](r,t,i.animationModel,i.dataIndex,a)}function Nq(r,e,t){var i=t.dataIndex,n=t.itemModel,a=n.getModel("emphasis"),o=a.getModel("itemStyle").getItemStyle(),s=n.getModel(["blur","itemStyle"]).getItemStyle(),l=n.getModel(["select","itemStyle"]).getItemStyle(),u=n.getShallow("cursor"),c=a.get("focus"),f=a.get("blurScope"),h=a.get("scale");dU(r,function(g){if(g instanceof Ur){var m=g.style;g.useStyle(fe({image:m.image,x:m.x,y:m.y,width:m.width,height:m.height},t.style))}else g.useStyle(t.style);var v=g.ensureState("emphasis");v.style=o,h&&(v.scaleX=g.scaleX*1.1,v.scaleY=g.scaleY*1.1),g.ensureState("blur").style=s,g.ensureState("select").style=l,u&&(g.cursor=u),g.z2=t.z2});var p=e.valueDim.posDesc[+(t.boundingLength>0)],d=r.__pictorialBarRect;d.ignoreClip=!0,Ir(d,wr(n),{labelFetcher:e.seriesModel,labelDataIndex:i,defaultText:el(e.seriesModel.getData(),i),inheritColor:t.style.fill,defaultOpacity:t.style.opacity,defaultOutsidePosition:p}),ar(r,c,f,a.get("disabled"))}function Uq(r){var e=Math.round(r);return Math.abs(r-e)<1e-4?e:Math.ceil(r)}var Gq=R_e;var z_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t.defaultSymbol="roundRect",t}return e.prototype.getInitialData=function(t){return t.stack=null,r.prototype.getInitialData.apply(this,arguments)},e.type="series.pictorialBar",e.dependencies=["grid"],e.defaultOption=Hn(Ev.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:"#212121"}}}),e}(Ev),Hq=z_e;function mU(r){r.registerChartView(Gq),r.registerSeriesModel(Hq),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ot(b1,"pictorialBar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,w1("pictorialBar"))}var F_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._layers=[],t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this,s=this.group,l=t.getLayerSeries(),u=a.getLayout("layoutInfo"),c=u.rect,f=u.boundaryGap;s.x=0,s.y=c.y+f[0];function h(m){return m.name}var p=new An(this._layersSeries||[],l,h,h),d=[];p.add(Be(g,this,"add")).update(Be(g,this,"update")).remove(Be(g,this,"remove")).execute();function g(m,v,_){var y=o._layers;if(m==="remove"){s.remove(y[v]);return}for(var x=[],M=[],S,w=l[v].indices,T=0;T<w.length;T++){var C=a.getItemLayout(w[T]),b=C.x,E=C.y0,I=C.y;x.push(b,E),M.push(b,E+I),S=a.getItemVisual(w[T],"style")}var R,A=a.getItemLayout(w[0]),D=t.getModel("label"),U=D.get("margin"),B=t.getModel("emphasis");if(m==="add"){var z=d[v]=new Ze;R=new Q1({shape:{points:x,stackedOnPoints:M,smooth:.4,stackedOnSmooth:.4,smoothConstraint:!1},z2:0}),z.add(R),s.add(z),t.isAnimationEnabled()&&R.setClipPath(B_e(R.getBoundingRect(),t,function(){R.removeClipPath()}))}else{var z=y[_];R=z.childAt(0),s.add(z),d[v]=z,Dt(R,{shape:{points:x,stackedOnPoints:M}},t),Di(R)}Ir(R,wr(t),{labelDataIndex:w[T-1],defaultText:a.getName(w[T-1]),inheritColor:S.fill},{normal:{verticalAlign:"middle"}}),R.setTextConfig({position:null,local:!0});var k=R.getTextContent();k&&(k.x=A.x-U,k.y=A.y0+A.y/2),R.useStyle(S),a.setItemGraphicEl(v,R),Gr(R,t),ar(R,B.get("focus"),B.get("blurScope"),B.get("disabled"))}this._layersSeries=l,this._layers=d},e.type="themeRiver",e}(Yt);function B_e(r,e,t){var i=new Et({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return or(i,{shape:{x:r.x-50,width:r.width+100,height:r.height+20}},e,t),i}var Wq=F_e;var vU=2,k_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new Zl(Be(this.getData,this),Be(this.getRawData,this))},e.prototype.fixData=function(t){var i=t.length,n={},a=o_(t,function(h){return n.hasOwnProperty(h[0]+"")||(n[h[0]+""]=-1),h[2]}),o=[];a.buckets.each(function(h,p){o.push({name:p,dataList:h})});for(var s=o.length,l=0;l<s;++l){for(var u=o[l].name,c=0;c<o[l].dataList.length;++c){var f=o[l].dataList[c][0]+"";n[f]=l}for(var f in n)n.hasOwnProperty(f)&&n[f]!==l&&(n[f]=l,t[i]=[f,0,u],i++)}return t},e.prototype.getInitialData=function(t,i){for(var n=this.getReferringComponents("singleAxis",Ar).models[0],a=n.get("type"),o=Wt(t.data,function(d){return d[2]!==void 0}),s=this.fixData(o||[]),l=[],u=this.nameMap=ke(),c=0,f=0;f<s.length;++f)l.push(s[f][vU]),u.get(s[f][vU])||(u.set(s[f][vU],c),c++);var h=Ks(s,{coordDimensions:["single"],dimensionsDefine:[{name:"time",type:Zp(a)},{name:"value",type:"float"},{name:"name",type:"ordinal"}],encodeDefine:{single:0,value:1,itemName:2}}).dimensions,p=new ri(h,this);return p.initData(s),p},e.prototype.getLayerSeries=function(){for(var t=this.getData(),i=t.count(),n=[],a=0;a<i;++a)n[a]=a;var o=t.mapDimension("single"),s=o_(n,function(u){return t.get("name",u)}),l=[];return s.buckets.each(function(u,c){u.sort(function(f,h){return t.get(o,f)-t.get(o,h)}),l.push({name:c,indices:u})}),l},e.prototype.getAxisTooltipData=function(t,i,n){pe(t)||(t=t?[t]:[]);for(var a=this.getData(),o=this.getLayerSeries(),s=[],l=o.length,u,c=0;c<l;++c){for(var f=Number.MAX_VALUE,h=-1,p=o[c].indices.length,d=0;d<p;++d){var g=a.get(t[0],o[c].indices[d]),m=Math.abs(g-i);m<=f&&(u=g,f=m,h=o[c].indices[d])}s.push(h)}return{dataIndices:s,nestestValue:u}},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=a.getName(t),s=a.get(a.mapDimension("value"),t);return Or("nameValue",{name:o,value:s})},e.type="series.themeRiver",e.dependencies=["singleAxis"],e.defaultOption={z:2,colorBy:"data",coordinateSystem:"singleAxis",boundaryGap:["10%","10%"],singleAxisIndex:0,animationEasing:"linear",label:{margin:4,show:!0,position:"left",fontSize:11},emphasis:{label:{show:!0}}},e}(jt),Xq=k_e;function gU(r,e){r.eachSeriesByType("themeRiver",function(t){var i=t.getData(),n=t.coordinateSystem,a={},o=n.getRect();a.rect=o;var s=t.get("boundaryGap"),l=n.getAxis();if(a.boundaryGap=s,l.orient==="horizontal"){s[0]=ze(s[0],o.height),s[1]=ze(s[1],o.height);var u=o.height-s[0]-s[1];Yq(i,t,u)}else{s[0]=ze(s[0],o.width),s[1]=ze(s[1],o.width);var c=o.width-s[0]-s[1];Yq(i,t,c)}i.setLayout("layoutInfo",a)})}function Yq(r,e,t){if(r.count())for(var i=e.coordinateSystem,n=e.getLayerSeries(),a=r.mapDimension("single"),o=r.mapDimension("value"),s=de(n,function(m){return de(m.indices,function(v){var _=i.dataToPoint(r.get(a,v));return _[1]=r.get(o,v),_})}),l=V_e(s),u=l.y0,c=t/l.max,f=n.length,h=n[0].indices.length,p,d=0;d<h;++d){p=u[d]*c,r.setItemLayout(n[0].indices[d],{layerIndex:0,x:s[0][d][0],y0:p,y:s[0][d][1]*c});for(var g=1;g<f;++g)p+=s[g-1][d][1]*c,r.setItemLayout(n[g].indices[d],{layerIndex:g,x:s[g][d][0],y0:p,y:s[g][d][1]*c})}}function V_e(r){for(var e=r.length,t=r[0].length,i=[],n=[],a=0,o=0;o<t;++o){for(var s=0,l=0;l<e;++l)s+=r[l][o][1];s>a&&(a=s),i.push(s)}for(var u=0;u<t;++u)n[u]=(a-i[u])/2;a=0;for(var c=0;c<t;++c){var f=i[c]+n[c];f>a&&(a=f)}return{y0:n,max:a}}function yU(r){r.registerChartView(Wq),r.registerSeriesModel(Xq),r.registerLayout(gU),r.registerProcessor(rl("themeRiver"))}var G_e=2,H_e=4,W_e=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this)||this;o.z2=G_e,o.textConfig={inside:!0},rt(o).seriesIndex=i.seriesIndex;var s=new Lt({z2:H_e,silent:t.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,t,i,n,a),o}return e.prototype.updateData=function(t,i,n,a,o){this.node=i,i.piece=this,n=n||this._seriesModel,a=a||this._ecModel;var s=this;rt(s).dataIndex=i.dataIndex;var l=i.getModel(),u=l.getModel("emphasis"),c=i.getLayout(),f=fe({},c);f.label=null;var h=i.getVisual("style");h.lineJoin="bevel";var p=i.getVisual("decal");p&&(h.decal=js(p,o));var d=ql(l.getModel("itemStyle"),f,!0);fe(f,d),N(Fi,function(_){var y=s.ensureState(_),x=l.getModel([_,"itemStyle"]);y.style=x.getItemStyle();var M=ql(x,f);M&&(y.shape=M)}),t?(s.setShape(f),s.shape.r=c.r0,or(s,{shape:{r:c.r}},n,i.dataIndex)):(Dt(s,{shape:f},n),Di(s)),s.useStyle(h),this._updateLabel(n);var g=l.getShallow("cursor");g&&s.attr("cursor",g),this._seriesModel=n||this._seriesModel,this._ecModel=a||this._ecModel;var m=u.get("focus"),v=m==="ancestor"?i.getAncestorsIndices():m==="descendant"?i.getDescendantIndices():m;ar(this,v,u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t){var i=this,n=this.node.getModel(),a=n.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),c=Math.sin(l),f=this,h=f.getTextContent(),p=this.node.dataIndex,d=a.get("minAngle")/180*Math.PI,g=a.get("show")&&!(d!=null&&Math.abs(s)<d);h.ignore=!g,N(Tf,function(v){var _=v==="normal"?n.getModel("label"):n.getModel([v,"label"]),y=v==="normal",x=y?h:h.ensureState(v),M=t.getFormattedLabel(p,v);y&&(M=M||i.node.name),x.style=fr(_,{},null,v!=="normal",!0),M&&(x.style.text=M);var S=_.get("show");S!=null&&!y&&(x.ignore=!S);var w=m(_,"position"),T=y?f:f.states[v],C=T.style.fill;T.textConfig={outsideFill:_.get("color")==="inherit"?C:null,inside:w!=="outside"};var b,E=m(_,"distance")||0,I=m(_,"align"),R=m(_,"rotate"),A=Math.PI*.5,D=Math.PI*1.5,U=bn(R==="tangential"?Math.PI/2-l:l),B=U>A&&!xu(U-A)&&U<D;w==="outside"?(b=o.r+E,I=B?"right":"left"):!I||I==="center"?(s===2*Math.PI&&o.r0===0?b=0:b=(o.r+o.r0)/2,I="center"):I==="left"?(b=o.r0+E,I=B?"right":"left"):I==="right"&&(b=o.r-E,I=B?"left":"right"),x.style.align=I,x.style.verticalAlign=m(_,"verticalAlign")||"middle",x.x=b*u+o.cx,x.y=b*c+o.cy;var z=0;R==="radial"?z=bn(-l)+(B?Math.PI:0):R==="tangential"?z=bn(Math.PI/2-l)+(B?Math.PI:0):Ct(R)&&(z=R*Math.PI/180),x.rotation=bn(z)});function m(v,_){var y=v.get(_);return y??a.get(_)}h.dirtyStyle()},e}(yi),_U=W_e;var GT="sunburstRootToNode",qq="sunburstHighlight",X_e="sunburstUnhighlight";function Zq(r){r.registerAction({type:GT,update:"updateView"},function(e,t){t.eachComponent({mainType:"series",subType:"sunburst",query:e},i);function i(n,a){var o=Vu(e,[GT],n);if(o){var s=n.getViewRoot();s&&(e.direction=Iv(s,o.node)?"rollUp":"drillDown"),n.resetViewRoot(o.node)}}}),r.registerAction({type:qq,update:"none"},function(e,t,i){e=fe({},e),t.eachComponent({mainType:"series",subType:"sunburst",query:e},n);function n(a){var o=Vu(e,[qq],a);o&&(e.dataIndex=o.node.dataIndex)}i.dispatchAction(fe(e,{type:"highlight"}))}),r.registerAction({type:X_e,update:"updateView"},function(e,t,i){e=fe({},e),i.dispatchAction(fe(e,{type:"downplay"}))})}var Y_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){var o=this;this.seriesModel=t,this.api=n,this.ecModel=i;var s=t.getData(),l=s.tree.root,u=t.getViewRoot(),c=this.group,f=t.get("renderLabelForZeroData"),h=[];u.eachNode(function(_){h.push(_)});var p=this._oldChildren||[];d(h,p),v(l,u),this._initEvents(),this._oldChildren=h;function d(_,y){if(_.length===0&&y.length===0)return;new An(y,_,x,x).add(M).update(M).remove(ot(M,null)).execute();function x(S){return S.getId()}function M(S,w){var T=S==null?null:_[S],C=w==null?null:y[w];g(T,C)}}function g(_,y){if(!f&&_&&!_.getValue()&&(_=null),_!==l&&y!==l){if(y&&y.piece)_?(y.piece.updateData(!1,_,t,i,n),s.setItemGraphicEl(_.dataIndex,y.piece)):m(y);else if(_){var x=new _U(_,t,i,n);c.add(x),s.setItemGraphicEl(_.dataIndex,x)}}}function m(_){_&&_.piece&&(c.remove(_.piece),_.piece=null)}function v(_,y){y.depth>0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,t,i,n):(o.virtualPiece=new _U(_,t,i,n),c.add(o.virtualPiece)),y.piece.off("click"),o.virtualPiece.on("click",function(x){o._rootToNode(y.parentNode)})):o.virtualPiece&&(c.remove(o.virtualPiece),o.virtualPiece=null)}},e.prototype._initEvents=function(){var t=this;this.group.off("click"),this.group.on("click",function(i){var n=!1,a=t.seriesModel.getViewRoot();a.eachNode(function(o){if(!n&&o.piece&&o.piece===i.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")t._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var c=l.get("target",!0)||"_blank";Gp(u,c)}}n=!0}})})},e.prototype._rootToNode=function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:GT,from:this.uid,seriesId:this.seriesModel.id,targetNode:t})},e.prototype.containPoint=function(t,i){var n=i.getData(),a=n.getItemLayout(0);if(a){var o=t[0]-a.cx,s=t[1]-a.cy,l=Math.sqrt(o*o+s*s);return l<=a.r&&l>=a.r0}},e.type="sunburst",e}(Yt),jq=Y_e;var q_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.ignoreStyleOnData=!0,t}return e.prototype.getInitialData=function(t,i){var n={name:t.name,children:t.data};Kq(n);var a=this._levelModels=de(t.levels||[],function(l){return new Zt(l,this,i)},this),o=Dv.createTree(n,this,s);function s(l){l.wrapMethod("getItemModel",function(u,c){var f=o.getNodeByDataIndex(c),h=a[f.depth];return h&&(u.parentModel=h),u})}return o.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.getDataParams=function(t){var i=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return i.treePathInfo=Zf(n,this),i},e.prototype.getLevelModel=function(t){return this._levelModels&&this._levelModels[t.depth]},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var i=this.getRawData().tree.root;(!t||t!==i&&!i.contains(t))&&(this._viewRoot=i)},e.prototype.enableAriaDecal=function(){Mx(this)},e.type="series.sunburst",e.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"},e}(jt);function Kq(r){var e=0;N(r.children,function(i){Kq(i);var n=i.value;pe(n)&&(n=n[0]),e+=n});var t=r.value;pe(t)&&(t=t[0]),(t==null||isNaN(t))&&(t=e),t<0&&(t=0),pe(r.value)?r.value[0]=t:r.value=t}var Jq=q_e;var $q=Math.PI/180;function xU(r,e,t){e.eachSeriesByType(r,function(i){var n=i.get("center"),a=i.get("radius");pe(a)||(a=[0,a]),pe(n)||(n=[n,n]);var o=t.getWidth(),s=t.getHeight(),l=Math.min(o,s),u=ze(n[0],o),c=ze(n[1],s),f=ze(a[0],l/2),h=ze(a[1],l/2),p=-i.get("startAngle")*$q,d=i.get("minAngle")*$q,g=i.getData().tree.root,m=i.getViewRoot(),v=m.depth,_=i.get("sort");_!=null&&Qq(m,_);var y=0;N(m.children,function(U){!isNaN(U.getValue())&&y++});var x=m.getValue(),M=Math.PI/(x||y)*2,S=m.depth>0,w=m.height-(S?-1:1),T=(h-f)/(w||1),C=i.get("clockwise"),b=i.get("stillShowZeroSum"),E=C?1:-1,I=function(U,B){if(U){var z=B;if(U!==g){var k=U.getValue(),G=x===0&&b?M:k*M;G<d&&(G=d),z=B+E*G;var Y=U.depth-v-(S?-1:1),J=f+T*Y,Q=f+T*(Y+1),V=i.getLevelModel(U);if(V){var K=V.get("r0",!0),ae=V.get("r",!0),ve=V.get("radius",!0);ve!=null&&(K=ve[0],ae=ve[1]),K!=null&&(J=ze(K,l/2)),ae!=null&&(Q=ze(ae,l/2))}U.setLayout({angle:G,startAngle:B,endAngle:z,clockwise:C,cx:u,cy:c,r0:J,r:Q})}if(U.children&&U.children.length){var ue=0;N(U.children,function(se){ue+=I(se,B+ue)})}return z-B}};if(S){var R=f,A=f+T,D=Math.PI*2;g.setLayout({angle:D,startAngle:p,endAngle:p+D,clockwise:C,cx:u,cy:c,r0:R,r:A})}I(m,p)})}function Qq(r,e){var t=r.children||[];r.children=Z_e(t,e),t.length&&N(r.children,function(i){Qq(i,e)})}function Z_e(r,e){if(He(e)){var t=de(r,function(n,a){var o=n.getValue();return{params:{depth:n.depth,height:n.height,dataIndex:n.dataIndex,getValue:function(){return o}},index:a}});return t.sort(function(n,a){return e(n.params,a.params)}),de(t,function(n){return r[n.index]})}else{var i=e==="asc";return r.sort(function(n,a){var o=(n.getValue()-a.getValue())*(i?1:-1);return o===0?(n.dataIndex-a.dataIndex)*(i?-1:1):o})}}function SU(r){var e={};function t(i,n,a){for(var o=i;o&&o.depth>1;)o=o.parentNode;var s=n.getColorFromPalette(o.name||o.dataIndex+"",e);return i.depth>1&&Ce(s)&&(s=bb(s,(i.depth-1)/(a-1)*.5)),s}r.eachSeriesByType("sunburst",function(i){var n=i.getData(),a=n.tree;a.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=t(o,i,a.root.height));var u=n.ensureUniqueItemVisual(o.dataIndex,"style");fe(u,l)})})}function MU(r){r.registerChartView(jq),r.registerSeriesModel(Jq),r.registerLayout(ot(xU,"sunburst")),r.registerProcessor(ot(rl,"sunburst")),r.registerVisual(SU),Zq(r)}var bU={color:"fill",borderColor:"stroke"},eZ={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},Kl=vt(),j_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},e.prototype.getInitialData=function(t,i){return hn(null,this)},e.prototype.getDataParams=function(t,i,n){var a=r.prototype.getDataParams.call(this,t,i);return n&&(a.info=Kl(n).info),a},e.type="series.custom",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},e}(jt),tZ=j_e;function K_e(r,e){return e=e||[0,0],de(["x","y"],function(t,i){var n=this.getAxis(t),a=e[i],o=r[i]/2;return n.type==="category"?n.getBandWidth():Math.abs(n.dataToCoord(a-o)-n.dataToCoord(a+o))},this)}function wU(r){var e=r.master.getRect();return{coordSys:{type:"cartesian2d",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:function(t){return r.dataToPoint(t)},size:Be(K_e,r)}}}function J_e(r,e){return e=e||[0,0],de([0,1],function(t){var i=e[t],n=r[t]/2,a=[],o=[];return a[t]=i-n,o[t]=i+n,a[1-t]=o[1-t]=e[1-t],Math.abs(this.dataToPoint(a)[t]-this.dataToPoint(o)[t])},this)}function TU(r){var e=r.getBoundingRect();return{coordSys:{type:"geo",x:e.x,y:e.y,width:e.width,height:e.height,zoom:r.getZoom()},api:{coord:function(t){return r.dataToPoint(t)},size:Be(J_e,r)}}}function $_e(r,e){var t=this.getAxis(),i=e instanceof Array?e[0]:e,n=(r instanceof Array?r[0]:r)/2;return t.type==="category"?t.getBandWidth():Math.abs(t.dataToCoord(i-n)-t.dataToCoord(i+n))}function EU(r){var e=r.getRect();return{coordSys:{type:"singleAxis",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:function(t){return r.dataToPoint(t)},size:Be($_e,r)}}}function Q_e(r,e){return e=e||[0,0],de(["Radius","Angle"],function(t,i){var n="get"+t+"Axis",a=this[n](),o=e[i],s=r[i]/2,l=a.type==="category"?a.getBandWidth():Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return t==="Angle"&&(l=l*Math.PI/180),l},this)}function AU(r){var e=r.getRadiusAxis(),t=r.getAngleAxis(),i=e.getExtent();return i[0]>i[1]&&i.reverse(),{coordSys:{type:"polar",cx:r.cx,cy:r.cy,r:i[1],r0:i[0]},api:{coord:function(n){var a=e.dataToRadius(n[0]),o=t.dataToAngle(n[1]),s=r.coordToPoint([a,o]);return s.push(a,o*Math.PI/180),s},size:Be(Q_e,r)}}}function CU(r){var e=r.getRect(),t=r.getRangeInfo();return{coordSys:{type:"calendar",x:e.x,y:e.y,width:e.width,height:e.height,cellWidth:r.getCellWidth(),cellHeight:r.getCellHeight(),rangeInfo:{start:t.start,end:t.end,weeks:t.weeks,dayCount:t.allDay}},api:{coord:function(i,n){return r.dataToPoint(i,n)}}}}function HT(r,e,t,i){return r&&(r.legacy||r.legacy!==!1&&!t&&!i&&e!=="tspan"&&(e==="text"||tt(r,"text")))}function WT(r,e,t){var i=r,n,a,o;if(e==="text")o=i;else{o={},tt(i,"text")&&(o.text=i.text),tt(i,"rich")&&(o.rich=i.rich),tt(i,"textFill")&&(o.fill=i.textFill),tt(i,"textStroke")&&(o.stroke=i.textStroke),tt(i,"fontFamily")&&(o.fontFamily=i.fontFamily),tt(i,"fontSize")&&(o.fontSize=i.fontSize),tt(i,"fontStyle")&&(o.fontStyle=i.fontStyle),tt(i,"fontWeight")&&(o.fontWeight=i.fontWeight),a={type:"text",style:o,silent:!0},n={};var s=tt(i,"textPosition");t?n.position=s?i.textPosition:"inside":s&&(n.position=i.textPosition),tt(i,"textPosition")&&(n.position=i.textPosition),tt(i,"textOffset")&&(n.offset=i.textOffset),tt(i,"textRotation")&&(n.rotation=i.textRotation),tt(i,"textDistance")&&(n.distance=i.textDistance)}return rZ(o,r),N(o.rich,function(l){rZ(l,l)}),{textConfig:n,textContent:a}}function rZ(r,e){e&&(e.font=e.textFont||e.font,tt(e,"textStrokeWidth")&&(r.lineWidth=e.textStrokeWidth),tt(e,"textAlign")&&(r.align=e.textAlign),tt(e,"textVerticalAlign")&&(r.verticalAlign=e.textVerticalAlign),tt(e,"textLineHeight")&&(r.lineHeight=e.textLineHeight),tt(e,"textWidth")&&(r.width=e.textWidth),tt(e,"textHeight")&&(r.height=e.textHeight),tt(e,"textBackgroundColor")&&(r.backgroundColor=e.textBackgroundColor),tt(e,"textPadding")&&(r.padding=e.textPadding),tt(e,"textBorderColor")&&(r.borderColor=e.textBorderColor),tt(e,"textBorderWidth")&&(r.borderWidth=e.textBorderWidth),tt(e,"textBorderRadius")&&(r.borderRadius=e.textBorderRadius),tt(e,"textBoxShadowColor")&&(r.shadowColor=e.textBoxShadowColor),tt(e,"textBoxShadowBlur")&&(r.shadowBlur=e.textBoxShadowBlur),tt(e,"textBoxShadowOffsetX")&&(r.shadowOffsetX=e.textBoxShadowOffsetX),tt(e,"textBoxShadowOffsetY")&&(r.shadowOffsetY=e.textBoxShadowOffsetY))}function RU(r,e,t){var i=r;i.textPosition=i.textPosition||t.position||"inside",t.offset!=null&&(i.textOffset=t.offset),t.rotation!=null&&(i.textRotation=t.rotation),t.distance!=null&&(i.textDistance=t.distance);var n=i.textPosition.indexOf("inside")>=0,a=r.fill||"#000";iZ(i,e);var o=i.textFill==null;return n?o&&(i.textFill=t.insideFill||"#fff",!i.textStroke&&t.insideStroke&&(i.textStroke=t.insideStroke),!i.textStroke&&(i.textStroke=a),i.textStrokeWidth==null&&(i.textStrokeWidth=2)):(o&&(i.textFill=r.fill||t.outsideFill||"#000"),!i.textStroke&&t.outsideStroke&&(i.textStroke=t.outsideStroke)),i.text=e.text,i.rich=e.rich,N(e.rich,function(s){iZ(s,s)}),i}function iZ(r,e){e&&(tt(e,"fill")&&(r.textFill=e.fill),tt(e,"stroke")&&(r.textStroke=e.fill),tt(e,"lineWidth")&&(r.textStrokeWidth=e.lineWidth),tt(e,"font")&&(r.font=e.font),tt(e,"fontStyle")&&(r.fontStyle=e.fontStyle),tt(e,"fontWeight")&&(r.fontWeight=e.fontWeight),tt(e,"fontSize")&&(r.fontSize=e.fontSize),tt(e,"fontFamily")&&(r.fontFamily=e.fontFamily),tt(e,"align")&&(r.textAlign=e.align),tt(e,"verticalAlign")&&(r.textVerticalAlign=e.verticalAlign),tt(e,"lineHeight")&&(r.textLineHeight=e.lineHeight),tt(e,"width")&&(r.textWidth=e.width),tt(e,"height")&&(r.textHeight=e.height),tt(e,"backgroundColor")&&(r.textBackgroundColor=e.backgroundColor),tt(e,"padding")&&(r.textPadding=e.padding),tt(e,"borderColor")&&(r.textBorderColor=e.borderColor),tt(e,"borderWidth")&&(r.textBorderWidth=e.borderWidth),tt(e,"borderRadius")&&(r.textBorderRadius=e.borderRadius),tt(e,"shadowColor")&&(r.textBoxShadowColor=e.shadowColor),tt(e,"shadowBlur")&&(r.textBoxShadowBlur=e.shadowBlur),tt(e,"shadowOffsetX")&&(r.textBoxShadowOffsetX=e.shadowOffsetX),tt(e,"shadowOffsetY")&&(r.textBoxShadowOffsetY=e.shadowOffsetY),tt(e,"textShadowColor")&&(r.textShadowColor=e.textShadowColor),tt(e,"textShadowBlur")&&(r.textShadowBlur=e.textShadowBlur),tt(e,"textShadowOffsetX")&&(r.textShadowOffsetX=e.textShadowOffsetX),tt(e,"textShadowOffsetY")&&(r.textShadowOffsetY=e.textShadowOffsetY))}var sZ={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},nZ=bt(sZ),Mst=gn(go,function(r,e){return r[e]=1,r},{}),bst=go.join(", "),Ox=["","style","shape","extra"],Yv=vt();function LU(r,e,t,i,n){var a=r+"Animation",o=Fl(r,i,n)||{},s=Yv(e).userDuring;return o.duration>0&&(o.during=s?Be(nxe,{el:e,userDuring:s}):null,o.setToFinal=!0,o.scope=r),fe(o,t[a]),o}function qv(r,e,t,i){i=i||{};var n=i.dataIndex,a=i.isInit,o=i.clearStyle,s=t.isAnimationEnabled(),l=Yv(r),u=e.style;l.userDuring=e.during;var c={},f={};if(oxe(r,e,f),oZ("shape",e,f),oZ("extra",e,f),!a&&s&&(axe(r,e,c),aZ("shape",r,e,c),aZ("extra",r,e,c),sxe(r,e,u,c)),f.style=u,exe(r,f,o),rxe(r,e),s)if(a){var h={};N(Ox,function(d){var g=d?e[d]:e;g&&g.enterFrom&&(d&&(h[d]=h[d]||{}),fe(d?h[d]:h,g.enterFrom))});var p=LU("enter",r,e,t,n);p.duration>0&&r.animateFrom(h,p)}else txe(r,e,n||0,t,c);PU(r,e),u?r.dirty():r.markRedraw()}function PU(r,e){for(var t=Yv(r).leaveToProps,i=0;i<Ox.length;i++){var n=Ox[i],a=n?e[n]:e;a&&a.leaveTo&&(t||(t=Yv(r).leaveToProps={}),n&&(t[n]=t[n]||{}),fe(n?t[n]:t,a.leaveTo))}}function Zv(r,e,t,i){if(r){var n=r.parent,a=Yv(r).leaveToProps;if(a){var o=LU("update",r,e,t,0);o.done=function(){n.remove(r),i&&i()},r.animateTo(a,o)}else n.remove(r),i&&i()}}function Jf(r){return r==="all"}function exe(r,e,t){var i=e.style;if(!r.isGroup&&i){if(t){r.useStyle({});for(var n=r.animators,a=0;a<n.length;a++){var o=n[a];o.targetName==="style"&&o.changeTarget(r.style)}}r.setStyle(i)}e&&(e.style=null,e&&r.attr(e),e.style=i)}function txe(r,e,t,i,n){if(n){var a=LU("update",r,e,i,t);a.duration>0&&r.animateFrom(n,a)}}function rxe(r,e){tt(e,"silent")&&(r.silent=e.silent),tt(e,"ignore")&&(r.ignore=e.ignore),r instanceof gi&&tt(e,"invisible")&&(r.invisible=e.invisible),r instanceof ut&&tt(e,"autoBatch")&&(r.autoBatch=e.autoBatch)}var Jl={},ixe={setTransform:function(r,e){return Jl.el[r]=e,this},getTransform:function(r){return Jl.el[r]},setShape:function(r,e){var t=Jl.el,i=t.shape||(t.shape={});return i[r]=e,t.dirtyShape&&t.dirtyShape(),this},getShape:function(r){var e=Jl.el.shape;if(e)return e[r]},setStyle:function(r,e){var t=Jl.el,i=t.style;return i&&(i[r]=e,t.dirtyStyle&&t.dirtyStyle()),this},getStyle:function(r){var e=Jl.el.style;if(e)return e[r]},setExtra:function(r,e){var t=Jl.el.extra||(Jl.el.extra={});return t[r]=e,this},getExtra:function(r){var e=Jl.el.extra;if(e)return e[r]}};function nxe(){var r=this,e=r.el;if(e){var t=Yv(e).userDuring,i=r.userDuring;if(t!==i){r.el=r.userDuring=null;return}Jl.el=e,i(ixe)}}function aZ(r,e,t,i){var n=t[r];if(n){var a=e[r],o;if(a){var s=t.transition,l=n.transition;if(l)if(!o&&(o=i[r]={}),Jf(l))fe(o,a);else for(var u=$t(l),c=0;c<u.length;c++){var f=u[c],h=a[f];o[f]=h}else if(Jf(s)||dt(s,r)>=0){!o&&(o=i[r]={});for(var p=bt(a),c=0;c<p.length;c++){var f=p[c],h=a[f];lxe(n[f],h)&&(o[f]=h)}}}}}function oZ(r,e,t){var i=e[r];if(i)for(var n=t[r]={},a=bt(i),o=0;o<a.length;o++){var s=a[o];n[s]=pp(i[s])}}function axe(r,e,t){for(var i=e.transition,n=Jf(i)?go:$t(i||[]),a=0;a<n.length;a++){var o=n[a];if(!(o==="style"||o==="shape"||o==="extra")){var s=r[o];t[o]=s}}}function oxe(r,e,t){for(var i=0;i<nZ.length;i++){var n=nZ[i],a=sZ[n],o=e[n];o&&(t[a[0]]=o[0],t[a[1]]=o[1])}for(var i=0;i<go.length;i++){var s=go[i];e[s]!=null&&(t[s]=e[s])}}function sxe(r,e,t,i){if(t){var n=r.style,a;if(n){var o=t.transition,s=e.transition;if(o&&!Jf(o)){var l=$t(o);!a&&(a=i.style={});for(var u=0;u<l.length;u++){var c=l[u],f=n[c];a[c]=f}}else if(r.getAnimationStyleProps&&(Jf(s)||Jf(o)||dt(s,"style")>=0)){var h=r.getAnimationStyleProps(),p=h?h.style:null;if(p){!a&&(a=i.style={});for(var d=bt(t),u=0;u<d.length;u++){var c=d[u];if(p[c]){var f=n[c];a[c]=f}}}}}}}function lxe(r,e){return ci(r)?r!==e:r!=null&&isFinite(r)}var lZ=vt(),uxe=["percent","easing","shape","style","extra"];function XT(r){r.stopAnimation("keyframe"),r.attr(lZ(r))}function jv(r,e,t){if(!(!t.isAnimationEnabled()||!e)){if(pe(e)){N(e,function(s){jv(r,s,t)});return}var i=e.keyframes,n=e.duration;if(t&&n==null){var a=Fl("enter",t,0);n=a&&a.duration}if(!(!i||!n)){var o=lZ(r);N(Ox,function(s){if(!(s&&!r[s])){var l,u=!1;i.sort(function(c,f){return c.percent-f.percent}),N(i,function(c){var f=r.animators,h=s?c[s]:c;if(h){var p=bt(h);if(s||(p=Wt(p,function(m){return dt(uxe,m)<0})),!!p.length){l||(l=r.animate(s,e.loop,!0),l.scope="keyframe");for(var d=0;d<f.length;d++)f[d]!==l&&f[d].targetName===l.targetName&&f[d].stopTracks(p);s&&(o[s]=o[s]||{});var g=s?o[s]:o;N(p,function(m){g[m]=((s?r[s]:r)||{})[m]}),l.whenWithKeys(n*c.percent,h,p,c.easing)}}}),l&&l.delay(e.delay||0).duration(n).start(e.easing)}})}}}var Hu="emphasis",$f="normal",zU="blur",FU="select",Qf=[$f,Hu,zU,FU],DU={normal:["itemStyle"],emphasis:[Hu,"itemStyle"],blur:[zU,"itemStyle"],select:[FU,"itemStyle"]},IU={normal:["label"],emphasis:[Hu,"label"],blur:[zU,"label"],select:[FU,"label"]},cxe=["x","y"],fxe="e\0\0",ps={normal:{},emphasis:{},blur:{},select:{}},hxe={cartesian2d:wU,geo:TU,single:EU,polar:AU,calendar:CU};function UU(r){return r instanceof ut}function OU(r){return r instanceof gi}function pxe(r,e){e.copyTransform(r),OU(e)&&OU(r)&&(e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel,e.invisible=r.invisible,e.ignore=r.ignore,UU(e)&&UU(r)&&e.setShape(r.shape))}var dxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){this._progressiveEls=null;var o=this._data,s=t.getData(),l=this.group,u=uZ(t,s,i,n);o||l.removeAll(),s.diff(o).add(function(f){NU(n,null,f,u(f,a),t,l,s)}).remove(function(f){var h=o.getItemGraphicEl(f);h&&Zv(h,Kl(h).option,t)}).update(function(f,h){var p=o.getItemGraphicEl(h);NU(n,p,f,u(f,a),t,l,s)}).execute();var c=t.get("clip",!0)?Yl(t.coordinateSystem,!1,t):null;c?l.setClipPath(c):l.removeClipPath(),this._data=s},e.prototype.incrementalPrepareRender=function(t,i,n){this.group.removeAll(),this._data=null},e.prototype.incrementalRender=function(t,i,n,a,o){var s=i.getData(),l=uZ(i,s,n,a),u=this._progressiveEls=[];function c(p){p.isGroup||(p.incremental=!0,p.ensureState("emphasis").hoverLayer=!0)}for(var f=t.start;f<t.end;f++){var h=NU(null,null,f,l(f,o),i,this.group,s);h&&(h.traverse(c),u.push(h))}},e.prototype.eachRendered=function(t){ca(this._progressiveEls||this.group,t)},e.prototype.filterForExposedEvent=function(t,i,n,a){var o=i.element;if(o==null||n.name===o)return!0;for(;(n=n.__hostTarget||n.parent)&&n!==this.group;)if(n.name===o)return!0;return!1},e.type="custom",e}(Yt),pZ=dxe;function BU(r){var e=r.type,t;if(e==="path"){var i=r.shape,n=i.width!=null&&i.height!=null?{x:i.x||0,y:i.y||0,width:i.width,height:i.height}:null,a=vZ(i);t=iv(a,null,n,i.layout||"center"),Kl(t).customPathData=a}else if(e==="image")t=new Ur({}),Kl(t).customImagePath=r.style.image;else if(e==="text")t=new Lt({});else if(e==="group")t=new Ze;else{if(e==="compoundPath")throw new Error('"compoundPath" is not supported yet.');var o=S_(e);if(!o){var s="";ur(s)}t=new o}return Kl(t).customGraphicType=e,t.name=r.name,t.z2EmphasisLift=1,t.z2SelectLift=1,t}function kU(r,e,t,i,n,a,o){XT(e);var s=n&&n.normal.cfg;s&&e.setTextConfig(s),i&&i.transition==null&&(i.transition=cxe);var l=i&&i.style;if(l){if(e.type==="text"){var u=l;tt(u,"textFill")&&(u.fill=u.textFill),tt(u,"textStroke")&&(u.stroke=u.textStroke)}var c=void 0,f=UU(e)?l.decal:null;r&&f&&(f.dirty=!0,c=js(f,r)),l.__decalPattern=c}if(OU(e)&&l){var c=l.__decalPattern;c&&(l.decal=c)}qv(e,i,a,{dataIndex:t,isInit:o,clearStyle:!0}),jv(e,i.keyframeAnimation,a)}function dZ(r,e,t,i,n){var a=e.isGroup?null:e,o=n&&n[r].cfg;if(a){var s=a.ensureState(r);if(i===!1){var l=a.getState(r);l&&(l.style=null)}else s.style=i||null;o&&(s.textConfig=o),Fs(a)}}function mxe(r,e,t){if(!r.isGroup){var i=r,n=t.currentZ,a=t.currentZLevel;i.z=n,i.zlevel=a;var o=e.z2;o!=null&&(i.z2=o||0);for(var s=0;s<Qf.length;s++)vxe(i,e,Qf[s])}}function vxe(r,e,t){var i=t===$f,n=i?e:YT(e,t),a=n?n.z2:null,o;a!=null&&(o=i?r:r.ensureState(t),o.z2=a||0)}function uZ(r,e,t,i){var n=r.get("renderItem"),a=r.coordinateSystem,o={};a&&(o=a.prepareCustoms?a.prepareCustoms(a):hxe[a.type](a));for(var s=Ye({getWidth:i.getWidth,getHeight:i.getHeight,getZr:i.getZr,getDevicePixelRatio:i.getDevicePixelRatio,value:x,style:S,ordinalRawValue:M,styleEmphasis:w,visual:b,barLayout:E,currentSeriesIndices:I,font:R},o.api||{}),l={context:{},seriesId:r.id,seriesName:r.name,seriesIndex:r.seriesIndex,coordSys:o.coordSys,dataInsideLength:e.count(),encode:gxe(r.getData())},u,c,f={},h={},p={},d={},g=0;g<Qf.length;g++){var m=Qf[g];p[m]=r.getModel(DU[m]),d[m]=r.getModel(IU[m])}function v(A){return A===u?c||(c=e.getItemModel(A)):e.getItemModel(A)}function _(A,D){return e.hasItemOption?A===u?f[D]||(f[D]=v(A).getModel(DU[D])):v(A).getModel(DU[D]):p[D]}function y(A,D){return e.hasItemOption?A===u?h[D]||(h[D]=v(A).getModel(IU[D])):v(A).getModel(IU[D]):d[D]}return function(A,D){return u=A,c=null,f={},h={},n&&n(Ye({dataIndexInside:A,dataIndex:e.getRawIndex(A),actionType:D?D.type:null},l),s)};function x(A,D){return D==null&&(D=u),e.getStore().get(e.getDimensionIndex(A||0),D)}function M(A,D){D==null&&(D=u),A=A||0;var U=e.getDimensionInfo(A);if(!U){var B=e.getDimensionIndex(A);return B>=0?e.getStore().get(B,D):void 0}var z=e.get(U.name,D),k=U&&U.ordinalMeta;return k?k.categories[z]:z}function S(A,D){D==null&&(D=u);var U=e.getItemVisual(D,"style"),B=U&&U.fill,z=U&&U.opacity,k=_(D,$f).getItemStyle();B!=null&&(k.fill=B),z!=null&&(k.opacity=z);var G={inheritColor:Ce(B)?B:"#000"},Y=y(D,$f),J=fr(Y,null,G,!1,!0);J.text=Y.getShallow("show")?ft(r.getFormattedLabel(D,$f),el(e,D)):null;var Q=b_(Y,G,!1);return C(A,k),k=RU(k,J,Q),A&&T(k,A),k.legacy=!0,k}function w(A,D){D==null&&(D=u);var U=_(D,Hu).getItemStyle(),B=y(D,Hu),z=fr(B,null,null,!0,!0);z.text=B.getShallow("show")?Xi(r.getFormattedLabel(D,Hu),r.getFormattedLabel(D,$f),el(e,D)):null;var k=b_(B,null,!0);return C(A,U),U=RU(U,z,k),A&&T(U,A),U.legacy=!0,U}function T(A,D){for(var U in D)tt(D,U)&&(A[U]=D[U])}function C(A,D){A&&(A.textFill&&(D.textFill=A.textFill),A.textPosition&&(D.textPosition=A.textPosition))}function b(A,D){if(D==null&&(D=u),tt(bU,A)){var U=e.getItemVisual(D,"style");return U?U[bU[A]]:null}if(tt(eZ,A))return e.getItemVisual(D,A)}function E(A){if(a.type==="cartesian2d"){var D=a.getBaseAxis();return $6(Ye({axis:D},A))}}function I(){return t.getCurrentSeriesIndices()}function R(A){return av(A,t)}}function gxe(r){var e={};return N(r.dimensions,function(t){var i=r.getDimensionInfo(t);if(!i.isExtraCoord){var n=i.coordDim,a=e[n]=e[n]||[];a[i.coordDimIndex]=r.getDimensionIndex(t)}}),e}function NU(r,e,t,i,n,a,o){if(!i){a.remove(e);return}var s=VU(r,e,t,i,n,a);return s&&o.setItemGraphicEl(t,s),s&&ar(s,i.focus,i.blurScope,i.emphasisDisabled),s}function VU(r,e,t,i,n,a){var o=-1,s=e;e&&mZ(e,i,n)&&(o=dt(a.childrenRef(),e),e=null);var l=!e,u=e;u?u.clearStates():(u=BU(i),s&&pxe(s,u)),i.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),ps.normal.cfg=ps.normal.conOpt=ps.emphasis.cfg=ps.emphasis.conOpt=ps.blur.cfg=ps.blur.conOpt=ps.select.cfg=ps.select.conOpt=null,ps.isLegacy=!1,_xe(u,t,i,n,l,ps),yxe(u,t,i,n,l),kU(r,u,t,i,ps,n,l),tt(i,"info")&&(Kl(u).info=i.info);for(var c=0;c<Qf.length;c++){var f=Qf[c];if(f!==$f){var h=YT(i,f),p=GU(i,h,f);dZ(f,u,h,p,ps)}}return mxe(u,i,n),i.type==="group"&&xxe(r,u,t,i,n),o>=0?a.replaceAt(u,o):a.add(u),u}function mZ(r,e,t){var i=Kl(r),n=e.type,a=e.shape,o=e.style;return t.isUniversalTransitionEnabled()||n!=null&&n!==i.customGraphicType||n==="path"&&wxe(a)&&vZ(a)!==i.customPathData||n==="image"&&tt(o,"image")&&o.image!==i.customImagePath}function yxe(r,e,t,i,n){var a=t.clipPath;if(a===!1)r&&r.getClipPath()&&r.removeClipPath();else if(a){var o=r.getClipPath();o&&mZ(o,a,i)&&(o=null),o||(o=BU(a),r.setClipPath(o)),kU(null,o,e,a,null,i,n)}}function _xe(r,e,t,i,n,a){if(!r.isGroup){cZ(t,null,a),cZ(t,Hu,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,l=a.blur.conOpt,u=a.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=r.getTextContent();if(o===!1)c&&r.removeTextContent();else{o=a.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=BU(o),r.setTextContent(c)),kU(null,c,e,o,null,i,n);for(var f=o&&o.style,h=0;h<Qf.length;h++){var p=Qf[h];if(p!==$f){var d=a[p].conOpt;dZ(p,c,d,GU(o,d,p),null)}}f?c.dirty():c.markRedraw()}}}}function cZ(r,e,t){var i=e?YT(r,e):r,n=e?GU(r,i,Hu):r.style,a=r.type,o=i?i.textConfig:null,s=r.textContent,l=s?e?YT(s,e):s:null;if(n&&(t.isLegacy||HT(n,a,!!o,!!l))){t.isLegacy=!0;var u=WT(n,a,!e);!o&&u.textConfig&&(o=u.textConfig),!l&&u.textContent&&(l=u.textContent)}if(!e&&l){var c=l;!c.type&&(c.type="text")}var f=e?t[e]:t.normal;f.cfg=o,f.conOpt=l}function YT(r,e){return e?r?r[e]:null:r}function GU(r,e,t){var i=e&&e.style;return i==null&&t===Hu&&r&&(i=r.styleEmphasis),i}function xxe(r,e,t,i,n){var a=i.children,o=a?a.length:0,s=i.$mergeChildren,l=s==="byName"||i.diffChildrenByName,u=s===!1;if(!(!o&&!l&&!u)){if(l){Mxe({api:r,oldChildren:e.children()||[],newChildren:a||[],dataIndex:t,seriesModel:n,group:e});return}u&&e.removeAll();for(var c=0;c<o;c++){var f=a[c],h=e.childAt(c);f?(f.ignore==null&&(f.ignore=!1),VU(r,h,t,f,n,e)):h.ignore=!0}for(var p=e.childCount()-1;p>=c;p--){var d=e.childAt(p);Sxe(e,d,n)}}}function Sxe(r,e,t){e&&Zv(e,Kl(r).option,t)}function Mxe(r){new An(r.oldChildren,r.newChildren,fZ,fZ,r).add(hZ).update(hZ).remove(bxe).execute()}function fZ(r,e){var t=r&&r.name;return t??fxe+e}function hZ(r,e){var t=this.context,i=r!=null?t.newChildren[r]:null,n=e!=null?t.oldChildren[e]:null;VU(t.api,n,t.dataIndex,i,t.seriesModel,t.group)}function bxe(r){var e=this.context,t=e.oldChildren[r];t&&Zv(t,Kl(t).option,e.seriesModel)}function vZ(r){return r&&(r.pathData||r.d)}function wxe(r){return r&&(tt(r,"pathData")||tt(r,"d"))}function HU(r){r.registerChartView(pZ),r.registerSeriesModel(tZ)}var hd=vt(),gZ=Qe,WU=Be,Txe=function(){function r(){this._dragging=!1,this.animationThreshold=15}return r.prototype.render=function(e,t,i,n){var a=t.get("value"),o=t.get("status");if(this._axisModel=e,this._axisPointerModel=t,this._api=i,!(!n&&this._lastValue===a&&this._lastStatus===o)){this._lastValue=a,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,a,e,t,i);var c=u.graphicKey;c!==this._lastGraphicKey&&this.clear(i),this._lastGraphicKey=c;var f=this._moveAnimation=this.determineAnimation(e,t);if(!s)s=this._group=new Ze,this.createPointerEl(s,u,e,t),this.createLabelEl(s,u,e,t),i.getZr().add(s);else{var h=ot(yZ,t,f);this.updatePointerEl(s,u,h),this.updateLabelEl(s,u,h,t)}xZ(s,t,!0),this._renderHandle(a)}},r.prototype.remove=function(e){this.clear(e)},r.prototype.dispose=function(e){this.clear(e)},r.prototype.determineAnimation=function(e,t){var i=t.get("animation"),n=e.axis,a=n.type==="category",o=t.get("snap");if(!o&&!a)return!1;if(i==="auto"||i==null){var s=this.animationThreshold;if(a&&n.getBandWidth()>s)return!0;if(o){var l=lT(e).seriesDataCount,u=n.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return i===!0},r.prototype.makeElOption=function(e,t,i,n,a){},r.prototype.createPointerEl=function(e,t,i,n){var a=t.pointer;if(a){var o=hd(e).pointerEl=new Rt[a.type](gZ(t.pointer));e.add(o)}},r.prototype.createLabelEl=function(e,t,i,n){if(t.label){var a=hd(e).labelEl=new Lt(gZ(t.label));e.add(a),_Z(a,n)}},r.prototype.updatePointerEl=function(e,t,i){var n=hd(e).pointerEl;n&&t.pointer&&(n.setStyle(t.pointer.style),i(n,{shape:t.pointer.shape}))},r.prototype.updateLabelEl=function(e,t,i,n){var a=hd(e).labelEl;a&&(a.setStyle(t.label.style),i(a,{x:t.label.x,y:t.label.y}),_Z(a,n))},r.prototype._renderHandle=function(e){if(!(this._dragging||!this.updateHandleTransform)){var t=this._axisPointerModel,i=this._api.getZr(),n=this._handle,a=t.getModel("handle"),o=t.get("status");if(!a.get("show")||!o||o==="hide"){n&&i.remove(n),this._handle=null;return}var s;this._handle||(s=!0,n=this._handle=Lu(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Ra(u.event)},onmousedown:WU(this._onHandleDragMove,this,0,0),drift:WU(this._onHandleDragMove,this),ondragend:WU(this._onHandleDragEnd,this)}),i.add(n)),xZ(n,t,!1),n.setStyle(a.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=a.get("size");pe(l)||(l=[l,l]),n.scaleX=l[0]/2,n.scaleY=l[1]/2,os(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},r.prototype._moveHandleToValue=function(e,t){yZ(this._axisPointerModel,!t&&this._moveAnimation,this._handle,XU(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},r.prototype._onHandleDragMove=function(e,t){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(XU(i),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(XU(n)),hd(i).lastProp=null,this._doDispatchAxisPointer()}},r.prototype._doDispatchAxisPointer=function(){var e=this._handle;if(e){var t=this._payloadInfo,i=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:i.axis.dim,axisIndex:i.componentIndex}]})}},r.prototype._onHandleDragEnd=function(){this._dragging=!1;var e=this._handle;if(e){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},r.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),i=this._group,n=this._handle;t&&i&&(this._lastGraphicKey=null,i&&t.remove(i),n&&t.remove(n),this._group=null,this._handle=null,this._payloadInfo=null),zu(this,"_doDispatchAxisPointer")},r.prototype.doClear=function(){},r.prototype.buildLabel=function(e,t,i){return i=i||0,{x:e[i],y:e[1-i],width:t[i],height:t[1-i]}},r}();function yZ(r,e,t,i){SZ(hd(t).lastProp,i)||(hd(t).lastProp=i,e?Dt(t,i,r):(t.stopAnimation(),t.attr(i)))}function SZ(r,e){if(qe(r)&&qe(e)){var t=!0;return N(e,function(i,n){t=t&&SZ(r[n],i)}),!!t}else return r===e}function _Z(r,e){r[e.get(["label","show"])?"show":"hide"]()}function XU(r){return{x:r.x||0,y:r.y||0,rotation:r.rotation||0}}function xZ(r,e,t){var i=e.get("z"),n=e.get("zlevel");r&&r.traverse(function(a){a.type!=="group"&&(i!=null&&(a.z=i),n!=null&&(a.zlevel=n),a.silent=t)})}var Kv=Txe;function Jv(r){var e=r.get("type"),t=r.getModel(e+"Style"),i;return e==="line"?(i=t.getLineStyle(),i.fill=null):e==="shadow"&&(i=t.getAreaStyle(),i.stroke=null),i}function YU(r,e,t,i,n){var a=t.get("value"),o=qU(a,e.axis,e.ecModel,t.get("seriesDataIndices"),{precision:t.get(["label","precision"]),formatter:t.get(["label","formatter"])}),s=t.getModel("label"),l=Hs(s.get("padding")||0),u=s.getFont(),c=Rl(o,u),f=n.position,h=c.width+l[1]+l[3],p=c.height+l[0]+l[2],d=n.align;d==="right"&&(f[0]-=h),d==="center"&&(f[0]-=h/2);var g=n.verticalAlign;g==="bottom"&&(f[1]-=p),g==="middle"&&(f[1]-=p/2),Exe(f,h,p,i);var m=s.get("backgroundColor");(!m||m==="auto")&&(m=e.get(["axisLine","lineStyle","color"])),r.label={x:f[0],y:f[1],style:fr(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:m}),z2:10}}function Exe(r,e,t,i){var n=i.getWidth(),a=i.getHeight();r[0]=Math.min(r[0]+e,n)-e,r[1]=Math.min(r[1]+t,a)-t,r[0]=Math.max(r[0],0),r[1]=Math.max(r[1],0)}function qU(r,e,t,i,n){r=e.scale.parse(r);var a=e.scale.getLabel({value:r},{precision:n.precision}),o=n.formatter;if(o){var s={value:sx(e,{value:r}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};N(i,function(l){var u=t.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,f=u&&u.getDataParams(c);f&&s.seriesData.push(f)}),Ce(o)?a=o.replace("{value}",a):He(o)&&(a=o(s))}return a}function zx(r,e,t){var i=wi();return Pa(i,i,t.rotation),_n(i,i,t.position),wn([r.dataToCoord(e),(t.labelOffset||0)+(t.labelDirection||1)*(t.labelMargin||0)],i)}function qT(r,e,t,i,n,a){var o=Cn.innerTextLayout(t.rotation,0,t.labelDirection);t.labelMargin=n.get(["label","margin"]),YU(e,i,n,a,{position:zx(i.axis,r,t),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function $v(r,e,t){return t=t||0,{x1:r[t],y1:r[1-t],x2:e[t],y2:e[1-t]}}function ZT(r,e,t){return t=t||0,{x:r[t],y:r[1-t],width:e[t],height:e[1-t]}}function ZU(r,e,t,i,n,a){return{cx:r,cy:e,r0:t,r:i,startAngle:n,endAngle:a,clockwise:!0}}var Axe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,i,n,a,o){var s=n.axis,l=s.grid,u=a.get("type"),c=MZ(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(i,!0));if(u&&u!=="none"){var h=Jv(a),p=Cxe[u](s,f,c);p.style=h,t.graphicKey=p.type,t.pointer=p}var d=yx(l.model,n);qT(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=yx(i.axis.grid.model,i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=zx(i.axis,t,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,i,n,a){var o=n.axis,s=o.grid,l=o.getGlobalExtent(!0),u=MZ(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,f=[t.x,t.y];f[c]+=i[c],f[c]=Math.min(l[1],f[c]),f[c]=Math.max(l[0],f[c]);var h=(u[1]+u[0])/2,p=[h,h];p[c]=f[c];var d=[{verticalAlign:"middle"},{align:"center"}];return{x:f[0],y:f[1],rotation:t.rotation,cursorPoint:p,tooltipOption:d[c]}},e}(Kv);function MZ(r,e){var t={};return t[e.dim+"AxisIndex"]=e.index,r.getCartesian(t)}var Cxe={line:function(r,e,t){var i=$v([e,t[0]],[e,t[1]],bZ(r));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(r,e,t){var i=Math.max(1,r.getBandWidth()),n=t[1]-t[0];return{type:"Rect",shape:ZT([e-i/2,t[0]],[i,n],bZ(r))}}};function bZ(r){return r.dim==="x"?0:1}var wZ=Axe;var Rxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(Pt),TZ=Rxe;var Wu=vt(),Lxe=N;function KT(r,e,t){if(!zt.node){var i=e.getZr();Wu(i).records||(Wu(i).records={}),Pxe(i,e);var n=Wu(i).records[r]||(Wu(i).records[r]={});n.handler=t}}function Pxe(r,e){if(Wu(r).initialized)return;Wu(r).initialized=!0,t("click",ot(EZ,"click")),t("mousemove",ot(EZ,"mousemove")),t("globalout",Ixe);function t(i,n){r.on(i,function(a){var o=Nxe(e);Lxe(Wu(r).records,function(s){s&&n(s,a,o.dispatchAction)}),Dxe(o.pendings,e)})}}function Dxe(r,e){var t=r.showTip.length,i=r.hideTip.length,n;t?n=r.showTip[t-1]:i&&(n=r.hideTip[i-1]),n&&(n.dispatchAction=null,e.dispatchAction(n))}function Ixe(r,e,t){r.handler("leave",null,t)}function EZ(r,e,t,i){e.handler(r,t,i)}function Nxe(r){var e={showTip:[],hideTip:[]},t=function(i){var n=e[i.type];n?n.push(i):(i.dispatchAction=t,r.dispatchAction(i))};return{dispatchAction:t,pendings:e}}function Fx(r,e){if(!zt.node){var t=e.getZr(),i=(Wu(t).records||{})[r];i&&(Wu(t).records[r]=null)}}var Uxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=i.getComponent("tooltip"),o=t.get("triggerOn")||a&&a.get("triggerOn")||"mousemove|click";KT("axisPointer",n,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},e.prototype.remove=function(t,i){Fx("axisPointer",i)},e.prototype.dispose=function(t,i){Fx("axisPointer",i)},e.type="axisPointer",e}(er),CZ=Uxe;function Bx(r,e){var t=[],i=r.seriesIndex,n;if(i==null||!(n=e.getSeriesByIndex(i)))return{point:[]};var a=n.getData(),o=$o(a,r);if(o==null||o<0||pe(o))return{point:[]};var s=a.getItemGraphicEl(o),l=n.coordinateSystem;if(n.getTooltipPosition)t=n.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(r.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),f=c.dim,h=u.dim,p=f==="x"||f==="radius"?1:0,d=a.mapDimension(h),g=[];g[p]=a.get(d,o),g[1-p]=a.get(a.getCalculationInfo("stackResultDimension"),o),t=l.dataToPoint(g)||[]}else t=l.dataToPoint(a.getValues(de(l.dimensions,function(v){return a.mapDimension(v)}),o))||[];else if(s){var m=s.getBoundingRect().clone();m.applyTransform(s.transform),t=[m.x+m.width/2,m.y+m.height/2]}return{point:t,el:s}}var RZ=vt();function jU(r,e,t){var i=r.currTrigger,n=[r.x,r.y],a=r,o=r.dispatchAction||Be(t.dispatchAction,t),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){JT(n)&&(n=Bx({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=JT(n),u=a.axesInfo,c=s.axesInfo,f=i==="leave"||JT(n),h={},p={},d={list:[],map:{}},g={showPointer:ot(zxe,p),showTooltip:ot(Fxe,d)};N(s.coordSysMap,function(v,_){var y=l||v.containPoint(n);N(s.coordSysAxesInfo[_],function(x,M){var S=x.axis,w=Gxe(u,x);if(!f&&y&&(!u||w)){var T=w&&w.value;T==null&&!l&&(T=S.pointToData(n)),T!=null&&LZ(x,T,g,!1,h)}})});var m={};return N(c,function(v,_){var y=v.linkGroup;y&&!p[_]&&N(y.axesInfo,function(x,M){var S=p[M];if(x!==v&&S){var w=S.value;y.mapper&&(w=v.axis.scale.parse(y.mapper(w,PZ(x),PZ(v)))),m[v.key]=w}})}),N(m,function(v,_){LZ(c[_],v,g,!0,h)}),Bxe(p,c,h),kxe(d,n,r,o),Vxe(c,o,t),h}}function LZ(r,e,t,i,n){var a=r.axis;if(!(a.scale.isBlank()||!a.containData(e))){if(!r.involveSeries){t.showPointer(r,e);return}var o=Oxe(e,r),s=o.payloadBatch,l=o.snapToValue;s[0]&&n.seriesIndex==null&&fe(n,s[0]),!i&&r.snap&&a.containData(l)&&l!=null&&(e=l),t.showPointer(r,e,s),t.showTooltip(r,o,l)}}function Oxe(r,e){var t=e.axis,i=t.dim,n=r,a=[],o=Number.MAX_VALUE,s=-1;return N(e.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(i),f,h;if(l.getAxisTooltipData){var p=l.getAxisTooltipData(c,r,t);h=p.dataIndices,f=p.nestestValue}else{if(h=l.getData().indicesOfNearest(c[0],r,t.type==="category"?.5:null),!h.length)return;f=l.getData().get(c[0],h[0])}if(!(f==null||!isFinite(f))){var d=r-f,g=Math.abs(d);g<=o&&((g<o||d>=0&&s<0)&&(o=g,s=d,n=f,a.length=0),N(h,function(m){a.push({seriesIndex:l.seriesIndex,dataIndexInside:m,dataIndex:l.getData().getRawIndex(m)})}))}}),{payloadBatch:a,snapToValue:n}}function zxe(r,e,t,i){r[e.key]={value:t,payloadBatch:i}}function Fxe(r,e,t,i){var n=t.payloadBatch,a=e.axis,o=a.model,s=e.axisPointerModel;if(!(!e.triggerTooltip||!n.length)){var l=e.coordSys.model,u=Cv(l),c=r.map[u];c||(c=r.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},r.list.push(c)),c.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:n.slice()})}}function Bxe(r,e,t){var i=t.axesInfo=[];N(e,function(n,a){var o=n.axisPointerModel.option,s=r[a];s?(!n.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!n.useHandle&&(o.status="hide"),o.status==="show"&&i.push({axisDim:n.axis.dim,axisIndex:n.axis.model.componentIndex,value:o.value})})}function kxe(r,e,t,i){if(JT(e)||!r.list.length){i({type:"hideTip"});return}var n=((r.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:t.tooltipOption,position:t.position,dataIndexInside:n.dataIndexInside,dataIndex:n.dataIndex,seriesIndex:n.seriesIndex,dataByCoordSys:r.list})}function Vxe(r,e,t){var i=t.getZr(),n="axisPointerLastHighlights",a=RZ(i)[n]||{},o=RZ(i)[n]={};N(r,function(u,c){var f=u.axisPointerModel.option;f.status==="show"&&u.triggerEmphasis&&N(f.seriesDataIndices,function(h){var p=h.seriesIndex+" | "+h.dataIndex;o[p]=h})});var s=[],l=[];N(a,function(u,c){!o[c]&&l.push(u)}),N(o,function(u,c){!a[c]&&s.push(u)}),l.length&&t.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&t.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function Gxe(r,e){for(var t=0;t<(r||[]).length;t++){var i=r[t];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}function PZ(r){var e=r.axis.model,t={},i=t.axisDim=r.axis.dim;return t.axisIndex=t[i+"AxisIndex"]=e.componentIndex,t.axisName=t[i+"AxisName"]=e.name,t.axisId=t[i+"AxisId"]=e.id,t}function JT(r){return!r||r[0]==null||isNaN(r[0])||r[1]==null||isNaN(r[1])}function nl(r){qa.registerAxisPointerClass("CartesianAxisPointer",wZ),r.registerComponentModel(TZ),r.registerComponentView(CZ),r.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!pe(t)&&(e.axisPointer.link=[t])}}),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=n9(e,t)}),r.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},jU)}function KU(r){It(fT),It(nl)}var Hxe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,i,n,a,o){var s=n.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=l.getOtherAxis(s),c=u.getExtent(),f=s.dataToCoord(i),h=a.get("type");if(h&&h!=="none"){var p=Jv(a),d=Xxe[h](s,l,f,c);d.style=p,t.graphicKey=d.type,t.pointer=d}var g=a.get(["label","margin"]),m=Wxe(i,n,a,l,g);YU(t,n,a,o,m)},e}(Kv);function Wxe(r,e,t,i,n){var a=e.axis,o=a.dataToCoord(r),s=i.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=i.getRadiusAxis().getExtent(),u,c,f;if(a.dim==="radius"){var h=wi();Pa(h,h,s),_n(h,h,[i.cx,i.cy]),u=wn([o,-n],h);var p=e.getModel("axisLabel").get("rotate")||0,d=Cn.innerTextLayout(s,p*Math.PI/180,-1);c=d.textAlign,f=d.textVerticalAlign}else{var g=l[1];u=i.coordToPoint([g+n,o]);var m=i.cx,v=i.cy;c=Math.abs(u[0]-m)/g<.3?"center":u[0]>m?"left":"right",f=Math.abs(u[1]-v)/g<.3?"middle":u[1]>v?"top":"bottom"}return{position:u,align:c,verticalAlign:f}}var Xxe={line:function(r,e,t,i){return r.dim==="angle"?{type:"Line",shape:$v(e.coordToPoint([i[0],t]),e.coordToPoint([i[1],t]))}:{type:"Circle",shape:{cx:e.cx,cy:e.cy,r:t}}},shadow:function(r,e,t,i){var n=Math.max(1,r.getBandWidth()),a=Math.PI/180;return r.dim==="angle"?{type:"Sector",shape:ZU(e.cx,e.cy,i[0],i[1],(-t-n/2)*a,(-t+n/2)*a)}:{type:"Sector",shape:ZU(e.cx,e.cy,t-n/2,t+n/2,0,Math.PI*2)}}},DZ=Hxe;var Yxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.findAxisModel=function(t){var i,n=this.ecModel;return n.eachComponent(t,function(a){a.getCoordSysModel()===this&&(i=a)},this),i},e.type="polar",e.dependencies=["radiusAxis","angleAxis"],e.defaultOption={z:0,center:["50%","50%"],radius:"80%"},e}(Pt),IZ=Yxe;var JU=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Ar).models[0]},e.type="polarAxis",e}(Pt);br(JU,Vl);var NZ=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="angleAxis",e}(JU);var UZ=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="radiusAxis",e}(JU);var $U=function(r){Z(e,r);function e(t,i){return r.call(this,"radius",t,i)||this}return e.prototype.pointToData=function(t,i){return this.polar.pointToData(t,i)[this.dim==="radius"?0:1]},e}(pn);$U.prototype.dataToRadius=pn.prototype.dataToCoord;$U.prototype.radiusToData=pn.prototype.coordToData;var OZ=$U;var qxe=vt(),QU=function(r){Z(e,r);function e(t,i){return r.call(this,"angle",t,i||[0,360])||this}return e.prototype.pointToData=function(t,i){return this.polar.pointToData(t,i)[this.dim==="radius"?0:1]},e.prototype.calculateCategoryInterval=function(){var t=this,i=t.getLabelModel(),n=t.scale,a=n.getExtent(),o=n.count();if(a[1]-a[0]<1)return 0;var s=a[0],l=t.dataToCoord(s+1)-t.dataToCoord(s),u=Math.abs(l),c=Rl(s==null?"":s+"",i.getFont(),"center","top"),f=Math.max(c.height,7),h=f/u;isNaN(h)&&(h=1/0);var p=Math.max(0,Math.floor(h)),d=qxe(t.model),g=d.lastAutoInterval,m=d.lastTickCount;return g!=null&&m!=null&&Math.abs(g-p)<=1&&Math.abs(m-o)<=1&&g>p?p=g:(d.lastTickCount=o,d.lastAutoInterval=p),p},e}(pn);QU.prototype.dataToAngle=pn.prototype.dataToCoord;QU.prototype.angleToData=pn.prototype.coordToData;var zZ=QU;var eO=["radius","angle"],Zxe=function(){function r(e){this.dimensions=eO,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new OZ,this._angleAxis=new zZ,this.axisPointerEnabled=!0,this.name=e||"",this._radiusAxis.polar=this._angleAxis.polar=this}return r.prototype.containPoint=function(e){var t=this.pointToCoord(e);return this._radiusAxis.contain(t[0])&&this._angleAxis.contain(t[1])},r.prototype.containData=function(e){return this._radiusAxis.containData(e[0])&&this._angleAxis.containData(e[1])},r.prototype.getAxis=function(e){var t="_"+e+"Axis";return this[t]},r.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},r.prototype.getAxesByScale=function(e){var t=[],i=this._angleAxis,n=this._radiusAxis;return i.scale.type===e&&t.push(i),n.scale.type===e&&t.push(n),t},r.prototype.getAngleAxis=function(){return this._angleAxis},r.prototype.getRadiusAxis=function(){return this._radiusAxis},r.prototype.getOtherAxis=function(e){var t=this._angleAxis;return e===t?this._radiusAxis:t},r.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},r.prototype.getTooltipAxes=function(e){var t=e!=null&&e!=="auto"?this.getAxis(e):this.getBaseAxis();return{baseAxes:[t],otherAxes:[this.getOtherAxis(t)]}},r.prototype.dataToPoint=function(e,t){return this.coordToPoint([this._radiusAxis.dataToRadius(e[0],t),this._angleAxis.dataToAngle(e[1],t)])},r.prototype.pointToData=function(e,t){var i=this.pointToCoord(e);return[this._radiusAxis.radiusToData(i[0],t),this._angleAxis.angleToData(i[1],t)]},r.prototype.pointToCoord=function(e){var t=e[0]-this.cx,i=e[1]-this.cy,n=this.getAngleAxis(),a=n.getExtent(),o=Math.min(a[0],a[1]),s=Math.max(a[0],a[1]);n.inverse?o=s-360:s=o+360;var l=Math.sqrt(t*t+i*i);t/=l,i/=l;for(var u=Math.atan2(-i,t)/Math.PI*180,c=u<o?1:-1;u<o||u>s;)u+=c*360;return[l,u]},r.prototype.coordToPoint=function(e){var t=e[0],i=e[1]/180*Math.PI,n=Math.cos(i)*t+this.cx,a=-Math.sin(i)*t+this.cy;return[n,a]},r.prototype.getArea=function(){var e=this.getAngleAxis(),t=this.getRadiusAxis(),i=t.getExtent().slice();i[0]>i[1]&&i.reverse();var n=e.getExtent(),a=Math.PI/180;return{cx:this.cx,cy:this.cy,r0:i[0],r:i[1],startAngle:-n[0]*a,endAngle:-n[1]*a,clockwise:e.inverse,contain:function(o,s){var l=o-this.cx,u=s-this.cy,c=l*l+u*u-1e-4,f=this.r,h=this.r0;return c<=f*f&&c>=h*h}}},r.prototype.convertToPixel=function(e,t,i){var n=FZ(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=FZ(t);return n===this?this.pointToData(i):null},r}();function FZ(r){var e=r.seriesModel,t=r.polarModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var BZ=Zxe;function jxe(r,e,t){var i=e.get("center"),n=t.getWidth(),a=t.getHeight();r.cx=ze(i[0],n),r.cy=ze(i[1],a);var o=r.getRadiusAxis(),s=Math.min(n,a)/2,l=e.get("radius");l==null?l=[0,"100%"]:pe(l)||(l=[0,l]);var u=[ze(l[0],s),ze(l[1],s)];o.inverse?o.setExtent(u[1],u[0]):o.setExtent(u[0],u[1])}function Kxe(r,e){var t=this,i=t.getAngleAxis(),n=t.getRadiusAxis();if(i.scale.setExtent(1/0,-1/0),n.scale.setExtent(1/0,-1/0),r.eachSeries(function(s){if(s.coordinateSystem===t){var l=s.getData();N(Sv(l,"radius"),function(u){n.scale.unionExtentFromData(l,u)}),N(Sv(l,"angle"),function(u){i.scale.unionExtentFromData(l,u)})}}),kl(i.scale,i.model),kl(n.scale,n.model),i.type==="category"&&!i.onBand){var a=i.getExtent(),o=360/i.scale.count();i.inverse?a[1]+=o:a[1]-=o,i.setExtent(a[0],a[1])}}function Jxe(r){return r.mainType==="angleAxis"}function kZ(r,e){var t;if(r.type=e.get("type"),r.scale=kf(e),r.onBand=e.get("boundaryGap")&&r.type==="category",r.inverse=e.get("inverse"),Jxe(e)){r.inverse=r.inverse!==e.get("clockwise");var i=e.get("startAngle"),n=(t=e.get("endAngle"))!==null&&t!==void 0?t:i+(r.inverse?-360:360);r.setExtent(i,n)}e.axis=r,r.model=e}var $xe={dimensions:eO,create:function(r,e){var t=[];return r.eachComponent("polar",function(i,n){var a=new BZ(n+"");a.update=Kxe;var o=a.getRadiusAxis(),s=a.getAngleAxis(),l=i.findAxisModel("radiusAxis"),u=i.findAxisModel("angleAxis");kZ(o,l),kZ(s,u),jxe(a,i,e),t.push(a),i.coordinateSystem=a,a.model=i}),r.eachSeries(function(i){if(i.get("coordinateSystem")==="polar"){var n=i.getReferringComponents("polar",Ar).models[0];i.coordinateSystem=n.coordinateSystem}}),t}},VZ=$xe;var Qxe=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function $T(r,e,t){e[1]>e[0]&&(e=e.slice().reverse());var i=r.coordToPoint([e[0],t]),n=r.coordToPoint([e[1],t]);return{x1:i[0],y1:i[1],x2:n[0],y2:n[1]}}function QT(r){var e=r.getRadiusAxis();return e.inverse?0:1}function GZ(r){var e=r[0],t=r[r.length-1];e&&t&&Math.abs(Math.abs(e.coord-t.coord)-360)<1e-4&&r.pop()}var eSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="PolarAxisPointer",t}return e.prototype.render=function(t,i){if(this.group.removeAll(),!!t.get("show")){var n=t.axis,a=n.polar,o=a.getRadiusAxis().getExtent(),s=n.getTicksCoords(),l=n.getMinorTicksCoords(),u=de(n.getViewLabels(),function(c){c=Qe(c);var f=n.scale,h=f.type==="ordinal"?f.getRawOrdinalNumber(c.tickValue):c.tickValue;return c.coord=n.dataToCoord(h),c});GZ(u),GZ(s),N(Qxe,function(c){t.get([c,"show"])&&(!n.scale.isBlank()||c==="axisLine")&&tSe[c](this.group,t,a,s,l,o,u)},this)}},e.type="angleAxis",e}(qa),tSe={axisLine:function(r,e,t,i,n,a){var o=e.getModel(["axisLine","lineStyle"]),s=t.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=QT(t),f=c?0:1,h,p=Math.abs(u[1]-u[0])===360?"Circle":"Arc";a[f]===0?h=new Rt[p]({shape:{cx:t.cx,cy:t.cy,r:a[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):h=new Ip({shape:{cx:t.cx,cy:t.cy,r:a[c],r0:a[f]},style:o.getLineStyle(),z2:1,silent:!0}),h.style.fill=null,r.add(h)},axisTick:function(r,e,t,i,n,a){var o=e.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=a[QT(t)],u=de(i,function(c){return new Jr({shape:$T(t,[l,l+s],c.coord)})});r.add(Gn(u,{style:Ye(o.getModel("lineStyle").getLineStyle(),{stroke:e.get(["axisLine","lineStyle","color"])})}))},minorTick:function(r,e,t,i,n,a){if(n.length){for(var o=e.getModel("axisTick"),s=e.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=a[QT(t)],c=[],f=0;f<n.length;f++)for(var h=0;h<n[f].length;h++)c.push(new Jr({shape:$T(t,[u,u+l],n[f][h].coord)}));r.add(Gn(c,{style:Ye(s.getModel("lineStyle").getLineStyle(),Ye(o.getLineStyle(),{stroke:e.get(["axisLine","lineStyle","color"])}))}))}},axisLabel:function(r,e,t,i,n,a,o){var s=e.getCategories(!0),l=e.getModel("axisLabel"),u=l.get("margin"),c=e.get("triggerEvent");N(o,function(f,h){var p=l,d=f.tickValue,g=a[QT(t)],m=t.coordToPoint([g+u,f.coord]),v=t.cx,_=t.cy,y=Math.abs(m[0]-v)/g<.3?"center":m[0]>v?"left":"right",x=Math.abs(m[1]-_)/g<.3?"middle":m[1]>_?"top":"bottom";if(s&&s[d]){var M=s[d];qe(M)&&M.textStyle&&(p=new Zt(M.textStyle,l,l.ecModel))}var S=new Lt({silent:Cn.isLabelSilent(e),style:fr(p,{x:m[0],y:m[1],fill:p.getTextColor()||e.get(["axisLine","lineStyle","color"]),text:f.formattedLabel,align:y,verticalAlign:x})});if(r.add(S),c){var w=Cn.makeAxisEventDataBase(e);w.targetType="axisLabel",w.value=f.rawLabel,rt(S).eventData=w}},this)},splitLine:function(r,e,t,i,n,a){var o=e.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],f=0;f<i.length;f++){var h=u++%l.length;c[h]=c[h]||[],c[h].push(new Jr({shape:$T(t,a,i[f].coord)}))}for(var f=0;f<c.length;f++)r.add(Gn(c[f],{style:Ye({stroke:l[f%l.length]},s.getLineStyle()),silent:!0,z:e.get("z")}))},minorSplitLine:function(r,e,t,i,n,a){if(n.length){for(var o=e.getModel("minorSplitLine"),s=o.getModel("lineStyle"),l=[],u=0;u<n.length;u++)for(var c=0;c<n[u].length;c++)l.push(new Jr({shape:$T(t,a,n[u][c].coord)}));r.add(Gn(l,{style:s.getLineStyle(),silent:!0,z:e.get("z")}))}},splitArea:function(r,e,t,i,n,a){if(i.length){var o=e.getModel("splitArea"),s=o.getModel("areaStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],f=Math.PI/180,h=-i[0].coord*f,p=Math.min(a[0],a[1]),d=Math.max(a[0],a[1]),g=e.get("clockwise"),m=1,v=i.length;m<=v;m++){var _=m===v?i[0].coord:i[m].coord,y=u++%l.length;c[y]=c[y]||[],c[y].push(new yi({shape:{cx:t.cx,cy:t.cy,r0:p,r:d,startAngle:h,endAngle:-_*f,clockwise:g},silent:!0})),h=-_*f}for(var m=0;m<c.length;m++)r.add(Gn(c[m],{style:Ye({fill:l[m%l.length]},s.getAreaStyle()),silent:!0}))}}},HZ=eSe;var rSe=["axisLine","axisTickLabel","axisName"],iSe=["splitLine","splitArea","minorSplitLine"],nSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="PolarAxisPointer",t}return e.prototype.render=function(t,i){if(this.group.removeAll(),!!t.get("show")){var n=this._axisGroup,a=this._axisGroup=new Ze;this.group.add(a);var o=t.axis,s=o.polar,l=s.getAngleAxis(),u=o.getTicksCoords(),c=o.getMinorTicksCoords(),f=l.getExtent()[0],h=o.getExtent(),p=oSe(s,t,f),d=new Cn(t,p);N(rSe,d.add,d),a.add(d.getGroup()),Ru(n,a,t),N(iSe,function(g){t.get([g,"show"])&&!o.scale.isBlank()&&aSe[g](this.group,t,s,f,h,u,c)},this)}},e.type="radiusAxis",e}(qa),aSe={splitLine:function(r,e,t,i,n,a){var o=e.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0,c=t.getAngleAxis(),f=Math.PI/180,h=c.getExtent(),p=Math.abs(h[1]-h[0])===360?"Circle":"Arc";l=l instanceof Array?l:[l];for(var d=[],g=0;g<a.length;g++){var m=u++%l.length;d[m]=d[m]||[],d[m].push(new Rt[p]({shape:{cx:t.cx,cy:t.cy,r:Math.max(a[g].coord,0),startAngle:-h[0]*f,endAngle:-h[1]*f,clockwise:c.inverse}}))}for(var g=0;g<d.length;g++)r.add(Gn(d[g],{style:Ye({stroke:l[g%l.length],fill:null},s.getLineStyle()),silent:!0}))},minorSplitLine:function(r,e,t,i,n,a,o){if(o.length){for(var s=e.getModel("minorSplitLine"),l=s.getModel("lineStyle"),u=[],c=0;c<o.length;c++)for(var f=0;f<o[c].length;f++)u.push(new ua({shape:{cx:t.cx,cy:t.cy,r:o[c][f].coord}}));r.add(Gn(u,{style:Ye({fill:null},l.getLineStyle()),silent:!0}))}},splitArea:function(r,e,t,i,n,a){if(a.length){var o=e.getModel("splitArea"),s=o.getModel("areaStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],f=a[0].coord,h=1;h<a.length;h++){var p=u++%l.length;c[p]=c[p]||[],c[p].push(new yi({shape:{cx:t.cx,cy:t.cy,r0:f,r:a[h].coord,startAngle:0,endAngle:Math.PI*2},silent:!0})),f=a[h].coord}for(var h=0;h<c.length;h++)r.add(Gn(c[h],{style:Ye({fill:l[h%l.length]},s.getAreaStyle()),silent:!0}))}}};function oSe(r,e,t){return{position:[r.cx,r.cy],rotation:t/180*Math.PI,labelDirection:-1,tickDirection:-1,nameDirection:1,labelRotate:e.getModel("axisLabel").get("rotate"),z2:1}}var WZ=nSe;function XZ(r){return r.get("stack")||"__ec_stack_"+r.seriesIndex}function YZ(r,e){return e.dim+r.model.componentIndex}function sSe(r,e,t){var i={},n=lSe(Wt(e.getSeriesByType(r),function(a){return!e.isSeriesFiltered(a)&&a.coordinateSystem&&a.coordinateSystem.type==="polar"}));e.eachSeriesByType(r,function(a){if(a.coordinateSystem.type==="polar"){var o=a.getData(),s=a.coordinateSystem,l=s.getBaseAxis(),u=YZ(s,l),c=XZ(a),f=n[u][c],h=f.offset,p=f.width,d=s.getOtherAxis(l),g=a.coordinateSystem.cx,m=a.coordinateSystem.cy,v=a.get("barMinHeight")||0,_=a.get("barMinAngle")||0;i[c]=i[c]||[];for(var y=o.mapDimension(d.dim),x=o.mapDimension(l.dim),M=wo(o,y),S=l.dim!=="radius"||!a.get("roundCap",!0),w=d.dataToCoord(0),T=0,C=o.count();T<C;T++){var b=o.get(y,T),E=o.get(x,T),I=b>=0?"p":"n",R=w;M&&(i[c][E]||(i[c][E]={p:w,n:w}),R=i[c][E][I]);var A=void 0,D=void 0,U=void 0,B=void 0;if(d.dim==="radius"){var z=d.dataToCoord(b)-w,k=l.dataToCoord(E);Math.abs(z)<v&&(z=(z<0?-1:1)*v),A=R,D=R+z,U=k-h,B=U-p,M&&(i[c][E][I]=D)}else{var G=d.dataToCoord(b,S)-w,Y=l.dataToCoord(E);Math.abs(G)<_&&(G=(G<0?-1:1)*_),A=Y+h,D=A+p,U=R,B=R+G,M&&(i[c][E][I]=B)}o.setItemLayout(T,{cx:g,cy:m,r0:A,r:D,startAngle:-U*Math.PI/180,endAngle:-B*Math.PI/180,clockwise:U>=B})}}})}function lSe(r){var e={};N(r,function(i,n){var a=i.getData(),o=i.coordinateSystem,s=o.getBaseAxis(),l=YZ(o,s),u=s.getExtent(),c=s.type==="category"?s.getBandWidth():Math.abs(u[1]-u[0])/a.count(),f=e[l]||{bandWidth:c,remainedWidth:c,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},h=f.stacks;e[l]=f;var p=XZ(i);h[p]||f.autoWidthCount++,h[p]=h[p]||{width:0,maxWidth:0};var d=ze(i.get("barWidth"),c),g=ze(i.get("barMaxWidth"),c),m=i.get("barGap"),v=i.get("barCategoryGap");d&&!h[p].width&&(d=Math.min(f.remainedWidth,d),h[p].width=d,f.remainedWidth-=d),g&&(h[p].maxWidth=g),m!=null&&(f.gap=m),v!=null&&(f.categoryGap=v)});var t={};return N(e,function(i,n){t[n]={};var a=i.stacks,o=i.bandWidth,s=ze(i.categoryGap,o),l=ze(i.gap,1),u=i.remainedWidth,c=i.autoWidthCount,f=(u-s)/(c+(c-1)*l);f=Math.max(f,0),N(a,function(g,m){var v=g.maxWidth;v&&v<f&&(v=Math.min(v,u),g.width&&(v=Math.min(v,g.width)),u-=v,g.width=v,c--)}),f=(u-s)/(c+(c-1)*l),f=Math.max(f,0);var h=0,p;N(a,function(g,m){g.width||(g.width=f),p=g,h+=g.width*(1+l)}),p&&(h-=p.width*l);var d=-h/2;N(a,function(g,m){t[n][m]=t[n][m]||{offset:d,width:g.width},d+=g.width*(1+l)})}),t}var qZ=sSe;var uSe={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},cSe={splitNumber:5},fSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="polar",e}(er);function tO(r){It(nl),qa.registerAxisPointerClass("PolarAxisPointer",DZ),r.registerCoordinateSystem("polar",VZ),r.registerComponentModel(IZ),r.registerComponentView(fSe),il(r,"angle",NZ,uSe),il(r,"radius",UZ,cSe),r.registerComponentView(HZ),r.registerComponentView(WZ),r.registerLayout(ot(qZ,"bar"))}function kx(r,e){e=e||{};var t=r.coordinateSystem,i=r.axis,n={},a=i.position,o=i.orient,s=t.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],u={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};n.position=[o==="vertical"?u.vertical[a]:l[0],o==="horizontal"?u.horizontal[a]:l[3]];var c={horizontal:0,vertical:1};n.rotation=Math.PI/2*c[o];var f={top:-1,bottom:1,right:1,left:-1};n.labelDirection=n.tickDirection=n.nameDirection=f[a],r.get(["axisTick","inside"])&&(n.tickDirection=-n.tickDirection),Br(e.labelInside,r.get(["axisLabel","inside"]))&&(n.labelDirection=-n.labelDirection);var h=e.rotate;return h==null&&(h=r.get(["axisLabel","rotate"])),n.labelRotation=a==="top"?-h:h,n.z2=1,n}var hSe=["axisLine","axisTickLabel","axisName"],pSe=["splitArea","splitLine"],dSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="SingleAxisPointer",t}return e.prototype.render=function(t,i,n,a){var o=this.group;o.removeAll();var s=this._axisGroup;this._axisGroup=new Ze;var l=kx(t),u=new Cn(t,l);N(hSe,u.add,u),o.add(this._axisGroup),o.add(u.getGroup()),N(pSe,function(c){t.get([c,"show"])&&mSe[c](this,this.group,this._axisGroup,t)},this),Ru(s,this._axisGroup,t),r.prototype.render.call(this,t,i,n,a)},e.prototype.remove=function(){cT(this)},e.type="singleAxis",e}(qa),mSe={splitLine:function(r,e,t,i){var n=i.axis;if(!n.scale.isBlank()){var a=i.getModel("splitLine"),o=a.getModel("lineStyle"),s=o.get("color");s=s instanceof Array?s:[s];for(var l=o.get("width"),u=i.coordinateSystem.getRect(),c=n.isHorizontal(),f=[],h=0,p=n.getTicksCoords({tickModel:a}),d=[],g=[],m=0;m<p.length;++m){var v=n.toGlobalCoord(p[m].coord);c?(d[0]=v,d[1]=u.y,g[0]=v,g[1]=u.y+u.height):(d[0]=u.x,d[1]=v,g[0]=u.x+u.width,g[1]=v);var _=new Jr({shape:{x1:d[0],y1:d[1],x2:g[0],y2:g[1]},silent:!0});Cu(_.shape,l);var y=h++%s.length;f[y]=f[y]||[],f[y].push(_)}for(var x=o.getLineStyle(["color"]),m=0;m<f.length;++m)e.add(Gn(f[m],{style:Ye({stroke:s[m%s.length]},x),silent:!0}))}},splitArea:function(r,e,t,i){uT(r,t,i,i)}},jZ=dSe;var KZ=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getCoordSysModel=function(){return this},e.type="singleAxis",e.layoutMode="box",e.defaultOption={left:"5%",top:"5%",right:"5%",bottom:"5%",type:"value",position:"bottom",orient:"horizontal",axisLine:{show:!0,lineStyle:{width:1,type:"solid"}},tooltip:{show:!0},axisTick:{show:!0,length:6,lineStyle:{width:1}},axisLabel:{show:!0,interval:"auto"},splitLine:{show:!0,lineStyle:{type:"dashed",opacity:.2}}},e}(Pt);br(KZ,Vl.prototype);var eE=KZ;var vSe=function(r){Z(e,r);function e(t,i,n,a,o){var s=r.call(this,t,i,n)||this;return s.type=a||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var t=this.position;return t==="top"||t==="bottom"},e.prototype.pointToData=function(t,i){return this.coordinateSystem.pointToData(t)[0]},e}(pn),JZ=vSe;var rO=["single"],gSe=function(){function r(e,t,i){this.type="single",this.dimension="single",this.dimensions=rO,this.axisPointerEnabled=!0,this.model=e,this._init(e,t,i)}return r.prototype._init=function(e,t,i){var n=this.dimension,a=new JZ(n,kf(e),[0,0],e.get("type"),e.get("position")),o=a.type==="category";a.onBand=o&&e.get("boundaryGap"),a.inverse=e.get("inverse"),a.orient=e.get("orient"),e.axis=a,a.model=e,a.coordinateSystem=this,this._axis=a},r.prototype.update=function(e,t){e.eachSeries(function(i){if(i.coordinateSystem===this){var n=i.getData();N(n.mapDimensionsAll(this.dimension),function(a){this._axis.scale.unionExtentFromData(n,a)},this),kl(this._axis.scale,this._axis.model)}},this)},r.prototype.resize=function(e,t){this._rect=xr({left:e.get("left"),top:e.get("top"),right:e.get("right"),bottom:e.get("bottom"),width:e.get("width"),height:e.get("height")},{width:t.getWidth(),height:t.getHeight()}),this._adjustAxis()},r.prototype.getRect=function(){return this._rect},r.prototype._adjustAxis=function(){var e=this._rect,t=this._axis,i=t.isHorizontal(),n=i?[0,e.width]:[0,e.height],a=t.inverse?1:0;t.setExtent(n[a],n[1-a]),this._updateAxisTransform(t,i?e.x:e.y)},r.prototype._updateAxisTransform=function(e,t){var i=e.getExtent(),n=i[0]+i[1],a=e.isHorizontal();e.toGlobalCoord=a?function(o){return o+t}:function(o){return n-o+t},e.toLocalCoord=a?function(o){return o-t}:function(o){return n-o+t}},r.prototype.getAxis=function(){return this._axis},r.prototype.getBaseAxis=function(){return this._axis},r.prototype.getAxes=function(){return[this._axis]},r.prototype.getTooltipAxes=function(){return{baseAxes:[this.getAxis()],otherAxes:[]}},r.prototype.containPoint=function(e){var t=this.getRect(),i=this.getAxis(),n=i.orient;return n==="horizontal"?i.contain(i.toLocalCoord(e[0]))&&e[1]>=t.y&&e[1]<=t.y+t.height:i.contain(i.toLocalCoord(e[1]))&&e[0]>=t.y&&e[0]<=t.y+t.height},r.prototype.pointToData=function(e){var t=this.getAxis();return[t.coordToData(t.toLocalCoord(e[t.orient==="horizontal"?0:1]))]},r.prototype.dataToPoint=function(e){var t=this.getAxis(),i=this.getRect(),n=[],a=t.orient==="horizontal"?0:1;return e instanceof Array&&(e=e[0]),n[a]=t.toGlobalCoord(t.dataToCoord(+e)),n[1-a]=a===0?i.y+i.height/2:i.x+i.width/2,n},r.prototype.convertToPixel=function(e,t,i){var n=$Z(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=$Z(t);return n===this?this.pointToData(i):null},r}();function $Z(r){var e=r.seriesModel,t=r.singleAxisModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var QZ=gSe;function ySe(r,e){var t=[];return r.eachComponent("singleAxis",function(i,n){var a=new QZ(i,r,e);a.name="single_"+n,a.resize(i,e),i.coordinateSystem=a,t.push(a)}),r.eachSeries(function(i){if(i.get("coordinateSystem")==="singleAxis"){var n=i.getReferringComponents("singleAxis",Ar).models[0];i.coordinateSystem=n&&n.coordinateSystem}}),t}var _Se={create:ySe,dimensions:rO},ej=_Se;var tj=["x","y"],xSe=["width","height"],SSe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,i,n,a,o){var s=n.axis,l=s.coordinateSystem,u=iO(l,1-tE(s)),c=l.dataToPoint(i)[0],f=a.get("type");if(f&&f!=="none"){var h=Jv(a),p=MSe[f](s,c,u);p.style=h,t.graphicKey=p.type,t.pointer=p}var d=kx(n);qT(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=kx(i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=zx(i.axis,t,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,i,n,a){var o=n.axis,s=o.coordinateSystem,l=tE(o),u=iO(s,l),c=[t.x,t.y];c[l]+=i[l],c[l]=Math.min(u[1],c[l]),c[l]=Math.max(u[0],c[l]);var f=iO(s,1-l),h=(f[1]+f[0])/2,p=[h,h];return p[l]=c[l],{x:c[0],y:c[1],rotation:t.rotation,cursorPoint:p,tooltipOption:{verticalAlign:"middle"}}},e}(Kv),MSe={line:function(r,e,t){var i=$v([e,t[0]],[e,t[1]],tE(r));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(r,e,t){var i=r.getBandWidth(),n=t[1]-t[0];return{type:"Rect",shape:ZT([e-i/2,t[0]],[i,n],tE(r))}}};function tE(r){return r.isHorizontal()?0:1}function iO(r,e){var t=r.getRect();return[t[tj[e]],t[tj[e]]+t[xSe[e]]]}var rj=SSe;var bSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="single",e}(er);function nO(r){It(nl),qa.registerAxisPointerClass("SingleAxisPointer",rj),r.registerComponentView(bSe),r.registerComponentView(jZ),r.registerComponentModel(eE),il(r,"single",eE,eE.defaultOption),r.registerCoordinateSystem("single",ej)}var wSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i,n){var a=is(t);r.prototype.init.apply(this,arguments),ij(t,a)},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),ij(this.option,t)},e.prototype.getCellSize=function(){return this.option.cellSize},e.type="calendar",e.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},e}(Pt);function ij(r,e){var t=r.cellSize,i;pe(t)?i=t:i=r.cellSize=[t,t],i.length===1&&(i[1]=i[0]);var n=de([0,1],function(a){return S5(e,a)&&(i[a]="auto"),i[a]!=null&&i[a]!=="auto"});Va(r,e,{type:"box",ignoreSize:n})}var nj=wSe;var TSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=this.group;a.removeAll();var o=t.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=i.getLocaleModel();this._renderDayRect(t,s,a),this._renderLines(t,s,l,a),this._renderYearText(t,s,l,a),this._renderMonthText(t,u,l,a),this._renderWeekText(t,u,s,l,a)},e.prototype._renderDayRect=function(t,i,n){for(var a=t.coordinateSystem,o=t.getModel("itemStyle").getItemStyle(),s=a.getCellWidth(),l=a.getCellHeight(),u=i.start.time;u<=i.end.time;u=a.getNextNDay(u,1).time){var c=a.dataToRect([u],!1).tl,f=new Et({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});n.add(f)}},e.prototype._renderLines=function(t,i,n,a){var o=this,s=t.coordinateSystem,l=t.getModel(["splitLine","lineStyle"]).getLineStyle(),u=t.get(["splitLine","show"]),c=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var f=i.start,h=0;f.time<=i.end.time;h++){d(f.formatedDate),h===0&&(f=s.getDateInfo(i.start.y+"-"+i.start.m));var p=f.date;p.setMonth(p.getMonth()+1),f=s.getDateInfo(p)}d(s.getNextNDay(i.end.time,1).formatedDate);function d(g){o._firstDayOfMonth.push(s.getDateInfo(g)),o._firstDayPoints.push(s.dataToRect([g],!1).tl);var m=o._getLinePointsOfOneWeek(t,g,n);o._tlpoints.push(m[0]),o._blpoints.push(m[m.length-1]),u&&o._drawSplitline(m,l,a)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,n),l,a),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,n),l,a)},e.prototype._getEdgesPoints=function(t,i,n){var a=[t[0].slice(),t[t.length-1].slice()],o=n==="horizontal"?0:1;return a[0][o]=a[0][o]-i/2,a[1][o]=a[1][o]+i/2,a},e.prototype._drawSplitline=function(t,i,n){var a=new Qr({z2:20,shape:{points:t},style:i});n.add(a)},e.prototype._getLinePointsOfOneWeek=function(t,i,n){for(var a=t.coordinateSystem,o=a.getDateInfo(i),s=[],l=0;l<7;l++){var u=a.getNextNDay(o.time,l),c=a.dataToRect([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[n==="horizontal"?"bl":"tr"]}return s},e.prototype._formatterLabel=function(t,i){return Ce(t)&&t?y5(t,i):He(t)?t(i):i.nameMap},e.prototype._yearTextPositionControl=function(t,i,n,a,o){var s=i[0],l=i[1],u=["center","bottom"];a==="bottom"?(l+=o,u=["center","top"]):a==="left"?s-=o:a==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(a==="left"||a==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},e.prototype._renderYearText=function(t,i,n,a){var o=t.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=n!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(u[0][0]+u[1][0])/2,f=(u[0][1]+u[1][1])/2,h=n==="horizontal"?0:1,p={top:[c,u[h][1]],bottom:[c,u[1-h][1]],left:[u[1-h][0],f],right:[u[h][0],f]},d=i.start.y;+i.end.y>+i.start.y&&(d=d+"-"+i.end.y);var g=o.get("formatter"),m={start:i.start.y,end:i.end.y,nameMap:d},v=this._formatterLabel(g,m),_=new Lt({z2:30,style:fr(o,{text:v})});_.attr(this._yearTextPositionControl(_,p[l],n,l,s)),a.add(_)}},e.prototype._monthTextPositionControl=function(t,i,n,a,o){var s="left",l="top",u=t[0],c=t[1];return n==="horizontal"?(c=c+o,i&&(s="center"),a==="start"&&(l="bottom")):(u=u+o,i&&(l="middle"),a==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},e.prototype._renderMonthText=function(t,i,n,a){var o=t.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),c=o.get("align"),f=[this._tlpoints,this._blpoints];(!s||Ce(s))&&(s&&(i=w_(s)||i),s=i.get(["time","monthAbbr"])||[]);var h=u==="start"?0:1,p=n==="horizontal"?0:1;l=u==="start"?-l:l;for(var d=c==="center",g=0;g<f[h].length-1;g++){var m=f[h][g].slice(),v=this._firstDayOfMonth[g];if(d){var _=this._firstDayPoints[g];m[p]=(_[p]+f[0][g+1][p])/2}var y=o.get("formatter"),x=s[+v.m-1],M={yyyy:v.y,yy:(v.y+"").slice(2),MM:v.m,M:+v.m,nameMap:x},S=this._formatterLabel(y,M),w=new Lt({z2:30,style:fe(fr(o,{text:S}),this._monthTextPositionControl(m,d,n,u,l))});a.add(w)}}},e.prototype._weekTextPositionControl=function(t,i,n,a,o){var s="center",l="middle",u=t[0],c=t[1],f=n==="start";return i==="horizontal"?(u=u+a+(f?1:-1)*o[0]/2,s=f?"right":"left"):(c=c+a+(f?1:-1)*o[1]/2,l=f?"bottom":"top"),{x:u,y:c,align:s,verticalAlign:l}},e.prototype._renderWeekText=function(t,i,n,a,o){var s=t.getModel("dayLabel");if(s.get("show")){var l=t.coordinateSystem,u=s.get("position"),c=s.get("nameMap"),f=s.get("margin"),h=l.getFirstDayOfWeek();if(!c||Ce(c)){c&&(i=w_(c)||i);var p=i.get(["time","dayOfWeekShort"]);c=p||de(i.get(["time","dayOfWeekAbbr"]),function(M){return M[0]})}var d=l.getNextNDay(n.end.time,7-n.lweek).time,g=[l.getCellWidth(),l.getCellHeight()];f=ze(f,Math.min(g[1],g[0])),u==="start"&&(d=l.getNextNDay(n.start.time,-(7+n.fweek)).time,f=-f);for(var m=0;m<7;m++){var v=l.getNextNDay(d,m),_=l.dataToRect([v.time],!1).center,y=m;y=Math.abs((m+h)%7);var x=new Lt({z2:30,style:fe(fr(s,{text:c[y]}),this._weekTextPositionControl(_,a,u,f,g))});o.add(x)}}},e.type="calendar",e}(er),aj=TSe;var aO=864e5,ESe=function(){function r(e,t,i){this.type="calendar",this.dimensions=r.dimensions,this.getDimensionsInfo=r.getDimensionsInfo,this._model=e}return r.getDimensionsInfo=function(){return[{name:"time",type:"time"},"value"]},r.prototype.getRangeInfo=function(){return this._rangeInfo},r.prototype.getModel=function(){return this._model},r.prototype.getRect=function(){return this._rect},r.prototype.getCellWidth=function(){return this._sw},r.prototype.getCellHeight=function(){return this._sh},r.prototype.getOrient=function(){return this._orient},r.prototype.getFirstDayOfWeek=function(){return this._firstDayOfWeek},r.prototype.getDateInfo=function(e){e=Mn(e);var t=e.getFullYear(),i=e.getMonth()+1,n=i<10?"0"+i:""+i,a=e.getDate(),o=a<10?"0"+a:""+a,s=e.getDay();return s=Math.abs((s+7-this.getFirstDayOfWeek())%7),{y:t+"",m:n,d:o,day:s,time:e.getTime(),formatedDate:t+"-"+n+"-"+o,date:e}},r.prototype.getNextNDay=function(e,t){return t=t||0,t===0?this.getDateInfo(e):(e=new Date(this.getDateInfo(e).time),e.setDate(e.getDate()+t),this.getDateInfo(e))},r.prototype.update=function(e,t){this._firstDayOfWeek=+this._model.getModel("dayLabel").get("firstDay"),this._orient=this._model.get("orient"),this._lineWidth=this._model.getModel("itemStyle").getItemStyle().lineWidth||0,this._rangeInfo=this._getRangeInfo(this._initRangeOption());var i=this._rangeInfo.weeks||1,n=["width","height"],a=this._model.getCellSize().slice(),o=this._model.getBoxLayoutParams(),s=this._orient==="horizontal"?[i,7]:[7,i];N([0,1],function(f){c(a,f)&&(o[n[f]]=a[f]*s[f])});var l={width:t.getWidth(),height:t.getHeight()},u=this._rect=xr(o,l);N([0,1],function(f){c(a,f)||(a[f]=u[n[f]]/s[f])});function c(f,h){return f[h]!=null&&f[h]!=="auto"}this._sw=a[0],this._sh=a[1]},r.prototype.dataToPoint=function(e,t){pe(e)&&(e=e[0]),t==null&&(t=!0);var i=this.getDateInfo(e),n=this._rangeInfo,a=i.formatedDate;if(t&&!(i.time>=n.start.time&&i.time<n.end.time+aO))return[NaN,NaN];var o=i.day,s=this._getRangeInfo([n.start.time,a]).nthWeek;return this._orient==="vertical"?[this._rect.x+o*this._sw+this._sw/2,this._rect.y+s*this._sh+this._sh/2]:[this._rect.x+s*this._sw+this._sw/2,this._rect.y+o*this._sh+this._sh/2]},r.prototype.pointToData=function(e){var t=this.pointToDate(e);return t&&t.time},r.prototype.dataToRect=function(e,t){var i=this.dataToPoint(e,t);return{contentShape:{x:i[0]-(this._sw-this._lineWidth)/2,y:i[1]-(this._sh-this._lineWidth)/2,width:this._sw-this._lineWidth,height:this._sh-this._lineWidth},center:i,tl:[i[0]-this._sw/2,i[1]-this._sh/2],tr:[i[0]+this._sw/2,i[1]-this._sh/2],br:[i[0]+this._sw/2,i[1]+this._sh/2],bl:[i[0]-this._sw/2,i[1]+this._sh/2]}},r.prototype.pointToDate=function(e){var t=Math.floor((e[0]-this._rect.x)/this._sw)+1,i=Math.floor((e[1]-this._rect.y)/this._sh)+1,n=this._rangeInfo.range;return this._orient==="vertical"?this._getDateByWeeksAndDay(i,t-1,n):this._getDateByWeeksAndDay(t,i-1,n)},r.prototype.convertToPixel=function(e,t,i){var n=oj(t);return n===this?n.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=oj(t);return n===this?n.pointToData(i):null},r.prototype.containPoint=function(e){return console.warn("Not implemented."),!1},r.prototype._initRangeOption=function(){var e=this._model.get("range"),t;if(pe(e)&&e.length===1&&(e=e[0]),pe(e))t=e;else{var i=e.toString();if(/^\d{4}$/.test(i)&&(t=[i+"-01-01",i+"-12-31"]),/^\d{4}[\/|-]\d{1,2}$/.test(i)){var n=this.getDateInfo(i),a=n.date;a.setMonth(a.getMonth()+1);var o=this.getNextNDay(a,-1);t=[n.formatedDate,o.formatedDate]}/^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(i)&&(t=[i,i])}if(!t)return e;var s=this._getRangeInfo(t);return s.start.time>s.end.time&&t.reverse(),t},r.prototype._getRangeInfo=function(e){var t=[this.getDateInfo(e[0]),this.getDateInfo(e[1])],i;t[0].time>t[1].time&&(i=!0,t.reverse());var n=Math.floor(t[1].time/aO)-Math.floor(t[0].time/aO)+1,a=new Date(t[0].time),o=a.getDate(),s=t[1].date.getDate();a.setDate(o+n-1);var l=a.getDate();if(l!==s)for(var u=a.getTime()-t[1].time>0?1:-1;(l=a.getDate())!==s&&(a.getTime()-t[1].time)*u>0;)n-=u,a.setDate(l-u);var c=Math.floor((n+t[0].day+6)/7),f=i?-c+1:c-1;return i&&t.reverse(),{range:[t[0].formatedDate,t[1].formatedDate],start:t[0],end:t[1],allDay:n,weeks:c,nthWeek:f,fweek:t[0].day,lweek:t[1].day}},r.prototype._getDateByWeeksAndDay=function(e,t,i){var n=this._getRangeInfo(i);if(e>n.weeks||e===0&&t<n.fweek||e===n.weeks&&t>n.lweek)return null;var a=(e-1)*7-n.fweek+t,o=new Date(n.start.time);return o.setDate(+n.start.d+a),this.getDateInfo(o)},r.create=function(e,t){var i=[];return e.eachComponent("calendar",function(n){var a=new r(n,e,t);i.push(a),n.coordinateSystem=a}),e.eachSeries(function(n){n.get("coordinateSystem")==="calendar"&&(n.coordinateSystem=i[n.get("calendarIndex")||0])}),i},r.dimensions=["time","value"],r}();function oj(r){var e=r.calendarModel,t=r.seriesModel,i=e?e.coordinateSystem:t?t.coordinateSystem:null;return i}var sj=ESe;function oO(r){r.registerComponentModel(nj),r.registerComponentView(aj),r.registerCoordinateSystem("calendar",sj)}function ASe(r,e){var t=r.existing;if(e.id=r.keyInfo.id,!e.type&&t&&(e.type=t.type),e.parentId==null){var i=e.parentOption;i?e.parentId=i.id:t&&(e.parentId=t.parentId)}e.parentOption=null}function lj(r,e){var t;return N(e,function(i){r[i]!=null&&r[i]!=="auto"&&(t=!0)}),t}function CSe(r,e,t){var i=fe({},t),n=r[e],a=t.$action||"merge";if(a==="merge")if(n){if(0)var o;_t(n,i,!0),Va(n,i,{ignoreSize:!0}),sD(t,n),rE(t,n),rE(t,n,"shape"),rE(t,n,"style"),rE(t,n,"extra"),t.clipPath=n.clipPath}else r[e]=i;else a==="replace"?r[e]=i:a==="remove"&&n&&(r[e]=null)}var uj=["transition","enterFrom","leaveTo"],RSe=uj.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function rE(r,e,t){if(t&&(!r[t]&&e[t]&&(r[t]={}),r=r[t],e=e[t]),!(!r||!e))for(var i=t?uj:RSe,n=0;n<i.length;n++){var a=i[n];r[a]==null&&e[a]!=null&&(r[a]=e[a])}}function LSe(r,e){if(r&&(r.hv=e.hv=[lj(e,["left","right"]),lj(e,["top","bottom"])],r.type==="group")){var t=r,i=e;t.width==null&&(t.width=i.width=0),t.height==null&&(t.height=i.height=0)}}var cj=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.preventAutoZ=!0,t}return e.prototype.mergeOption=function(t,i){var n=this.option.elements;this.option.elements=null,r.prototype.mergeOption.call(this,t,i),this.option.elements=n},e.prototype.optionUpdated=function(t,i){var n=this.option,a=(i?n:t).elements,o=n.elements=i?[]:n.elements,s=[];this._flatten(a,s,null);var l=Wb(o,s,"normalMerge"),u=this._elOptionsToUpdate=[];N(l,function(c,f){var h=c.newOption;h&&(u.push(h),ASe(c,h),CSe(o,f,h),LSe(o[f],h))},this),n.elements=Wt(o,function(c){return c&&delete c.$action,c!=null})},e.prototype._flatten=function(t,i,n){N(t,function(a){if(a){n&&(a.parentOption=n),i.push(a);var o=a.children;o&&o.length&&this._flatten(o,i,a),delete a.children}},this)},e.prototype.useElOptionsToUpdate=function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t},e.type="graphic",e.defaultOption={elements:[]},e}(Pt);var fj={path:null,compoundPath:null,group:Ze,image:Ur,text:Lt},ds=vt(),dj=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this._elMap=ke()},e.prototype.render=function(t,i,n){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t),this._relocate(t,n)},e.prototype._updateElements=function(t){var i=t.useElOptionsToUpdate();if(i){var n=this._elMap,a=this.group,o=t.get("z"),s=t.get("zlevel");N(i,function(l){var u=qr(l.id,null),c=u!=null?n.get(u):null,f=qr(l.parentId,null),h=f!=null?n.get(f):a,p=l.type,d=l.style;p==="text"&&d&&l.hv&&l.hv[1]&&(d.textVerticalAlign=d.textBaseline=d.verticalAlign=d.align=null);var g=l.textContent,m=l.textConfig;if(d&&HT(d,p,!!m,!!g)){var v=WT(d,p,!0);!m&&v.textConfig&&(m=l.textConfig=v.textConfig),!g&&v.textContent&&(g=v.textContent)}var _=PSe(l),y=l.$action||"merge",x=y==="merge",M=y==="replace";if(x){var S=!c,w=c;S?w=hj(u,h,l.type,n):(w&&(ds(w).isNew=!1),XT(w)),w&&(qv(w,_,t,{isInit:S}),pj(w,l,o,s))}else if(M){iE(c,l,n,t);var T=hj(u,h,l.type,n);T&&(qv(T,_,t,{isInit:!0}),pj(T,l,o,s))}else y==="remove"&&(PU(c,l),iE(c,l,n,t));var C=n.get(u);if(C&&g)if(x){var b=C.getTextContent();b?b.attr(g):C.setTextContent(new Lt(g))}else M&&C.setTextContent(new Lt(g));if(C){var E=l.clipPath;if(E){var I=E.type,R=void 0,S=!1;if(x){var A=C.getClipPath();S=!A||ds(A).type!==I,R=S?sO(I):A}else M&&(S=!0,R=sO(I));C.setClipPath(R),qv(R,E,t,{isInit:S}),jv(R,E.keyframeAnimation,t)}var D=ds(C);C.setTextConfig(m),D.option=l,DSe(C,t,l),Gs({el:C,componentModel:t,itemName:C.name,itemTooltipOption:l.tooltip}),jv(C,l.keyframeAnimation,t)}})}},e.prototype._relocate=function(t,i){for(var n=t.option.elements,a=this.group,o=this._elMap,s=i.getWidth(),l=i.getHeight(),u=["x","y"],c=0;c<n.length;c++){var f=n[c],h=qr(f.id,null),p=h!=null?o.get(h):null;if(!(!p||!p.isGroup)){var d=p.parent,g=d===a,m=ds(p),v=ds(d);m.width=ze(m.option.width,g?s:v.width)||0,m.height=ze(m.option.height,g?l:v.height)||0}}for(var c=n.length-1;c>=0;c--){var f=n[c],h=qr(f.id,null),p=h!=null?o.get(h):null;if(p){var d=p.parent,v=ds(d),_=d===a?{width:s,height:l}:{width:v.width,height:v.height},y={},x=Cf(p,f,_,null,{hv:f.hv,boundingMode:f.bounding},y);if(!ds(p).isNew&&x){for(var M=f.transition,S={},w=0;w<u.length;w++){var T=u[w],C=y[T];M&&(Jf(M)||dt(M,T)>=0)?S[T]=C:p[T]=C}Dt(p,S,t,0)}else p.attr(y)}}},e.prototype._clear=function(){var t=this,i=this._elMap;i.each(function(n){iE(n,ds(n).option,i,t._lastGraphicModel)}),this._elMap=ke()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(er);function sO(r){var e=tt(fj,r)?fj[r]:S_(r),t=new e({});return ds(t).type=r,t}function hj(r,e,t,i){var n=sO(t);return e.add(n),i.set(r,n),ds(n).id=r,ds(n).isNew=!0,n}function iE(r,e,t,i){var n=r&&r.parent;n&&(r.type==="group"&&r.traverse(function(a){iE(a,e,t,i)}),Zv(r,e,i),t.removeKey(ds(r).id))}function pj(r,e,t,i){r.isGroup||N([["cursor",gi.prototype.cursor],["zlevel",i||0],["z",t||0],["z2",0]],function(n){var a=n[0];tt(e,a)?r[a]=ft(e[a],n[1]):r[a]==null&&(r[a]=n[1])}),N(bt(e),function(n){if(n.indexOf("on")===0){var a=e[n];r[n]=He(a)?a:null}}),tt(e,"draggable")&&(r.draggable=e.draggable),e.name!=null&&(r.name=e.name),e.id!=null&&(r.id=e.id)}function PSe(r){return r=fe({},r),N(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(aD),function(e){delete r[e]}),r}function DSe(r,e,t){var i=rt(r).eventData;!r.silent&&!r.ignore&&!i&&(i=rt(r).eventData={componentType:"graphic",componentIndex:e.componentIndex,name:r.name}),i&&(i.info=t.info)}function lO(r){r.registerComponentModel(cj),r.registerComponentView(dj),r.registerPreprocessor(function(e){var t=e.graphic;pe(t)?!t[0]||!t[0].elements?e.graphic=[{elements:t}]:e.graphic=[e.graphic[0]]:t&&!t.elements&&(e.graphic=[{elements:[t]}])})}var uO=["x","y","radius","angle","single"],ISe=["cartesian2d","polar","singleAxis"];function mj(r){var e=r.get("coordinateSystem");return dt(ISe,e)>=0}function ms(r){return r+"Axis"}function vj(r,e){var t=ke(),i=[],n=ke();r.eachComponent({mainType:"dataZoom",query:e},function(c){n.get(c.uid)||s(c)});var a;do a=!1,r.eachComponent("dataZoom",o);while(a);function o(c){!n.get(c.uid)&&l(c)&&(s(c),a=!0)}function s(c){n.set(c.uid,!0),i.push(c),u(c)}function l(c){var f=!1;return c.eachTargetAxis(function(h,p){var d=t.get(h);d&&d[p]&&(f=!0)}),f}function u(c){c.eachTargetAxis(function(f,h){(t.get(f)||t.set(f,[]))[h]=!0})}return i}function nE(r){var e=r.ecModel,t={infoList:[],infoMap:ke()};return r.eachTargetAxis(function(i,n){var a=e.getComponent(ms(i),n);if(a){var o=a.getCoordSysModel();if(o){var s=o.uid,l=t.infoMap.get(s);l||(l={model:o,axisModels:[]},t.infoList.push(l),t.infoMap.set(s,l)),l.axisModels.push(a)}}}),t}var cO=function(){function r(){this.indexList=[],this.indexMap=[]}return r.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},r}(),NSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._autoThrottle=!0,t._noTarget=!0,t._rangePropMode=["percent","percent"],t}return e.prototype.init=function(t,i,n){var a=gj(t);this.settledOption=a,this.mergeDefaultAndTheme(t,n),this._doInit(a)},e.prototype.mergeOption=function(t){var i=gj(t);_t(this.option,t,!0),_t(this.settledOption,i,!0),this._doInit(i)},e.prototype._doInit=function(t){var i=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;N([["start","startValue"],["end","endValue"]],function(a,o){this._rangePropMode[o]==="value"&&(i[a[0]]=n[a[0]]=null)},this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),i=this._targetAxisInfoMap=ke(),n=this._fillSpecifiedTargetAxis(i);n?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(i,this._orient)),this._noTarget=!0,i.each(function(a){a.indexList.length&&(this._noTarget=!1)},this)},e.prototype._fillSpecifiedTargetAxis=function(t){var i=!1;return N(uO,function(n){var a=this.getReferringComponents(ms(n),cH);if(a.specified){i=!0;var o=new cO;N(a.models,function(s){o.add(s.componentIndex)}),t.set(n,o)}},this),i},e.prototype._fillAutoTargetAxisByOrient=function(t,i){var n=this.ecModel,a=!0;if(a){var o=i==="vertical"?"y":"x",s=n.findComponents({mainType:o+"Axis"});l(s,o)}if(a){var s=n.findComponents({mainType:"singleAxis",filter:function(c){return c.get("orient",!0)===i}});l(s,"single")}function l(u,c){var f=u[0];if(f){var h=new cO;if(h.add(f.componentIndex),t.set(c,h),a=!1,c==="x"||c==="y"){var p=f.getReferringComponents("grid",Ar).models[0];p&&N(u,function(d){f.componentIndex!==d.componentIndex&&p===d.getReferringComponents("grid",Ar).models[0]&&h.add(d.componentIndex)})}}}a&&N(uO,function(u){if(a){var c=n.findComponents({mainType:ms(u),filter:function(h){return h.get("type",!0)==="category"}});if(c[0]){var f=new cO;f.add(c[0].componentIndex),t.set(u,f),a=!1}}},this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis(function(i){!t&&(t=i)},this),t==="y"?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var i=this.ecModel.option;this.option.throttle=i.animation&&i.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var i=this._rangePropMode,n=this.get("rangeMode");N([["start","startValue"],["end","endValue"]],function(a,o){var s=t[a[0]]!=null,l=t[a[1]]!=null;s&&!l?i[o]="percent":!s&&l?i[o]="value":n?i[o]=n[o]:s&&(i[o]="percent")})},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis(function(i,n){t==null&&(t=this.ecModel.getComponent(ms(i),n))},this),t},e.prototype.eachTargetAxis=function(t,i){this._targetAxisInfoMap.each(function(n,a){N(n.indexList,function(o){t.call(i,a,o)})})},e.prototype.getAxisProxy=function(t,i){var n=this.getAxisModel(t,i);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(t,i){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[i])return this.ecModel.getComponent(ms(t),i)},e.prototype.setRawRange=function(t){var i=this.option,n=this.settledOption;N([["start","startValue"],["end","endValue"]],function(a){(t[a[0]]!=null||t[a[1]]!=null)&&(i[a[0]]=n[a[0]]=t[a[0]],i[a[1]]=n[a[1]]=t[a[1]])},this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var i=this.option;N(["start","startValue","end","endValue"],function(n){i[n]=t[n]})},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,i){if(t==null&&i==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getDataValueWindow()}else return this.getAxisProxy(t,i).getDataValueWindow()},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var i,n=this._targetAxisInfoMap.keys(),a=0;a<n.length;a++)for(var o=n[a],s=this._targetAxisInfoMap.get(o),l=0;l<s.indexList.length;l++){var u=this.getAxisProxy(o,s.indexList[l]);if(u.hostedBy(this))return u;i||(i=u)}return i},e.prototype.getRangePropMode=function(){return this._rangePropMode.slice()},e.prototype.getOrient=function(){return this._orient},e.type="dataZoom",e.dependencies=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","series","toolbox"],e.defaultOption={z:4,filterMode:"filter",start:0,end:100},e}(Pt);function gj(r){var e={};return N(["start","end","startValue","endValue","throttle"],function(t){r.hasOwnProperty(t)&&(e[t]=r[t])}),e}var eh=NSe;var USe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.select",e}(eh),yj=USe;var OSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){this.dataZoomModel=t,this.ecModel=i,this.api=n},e.type="dataZoom",e}(er),Qv=OSe;var zSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.select",e}(Qv),_j=zSe;var eg=N,xj=Ti,FSe=function(){function r(e,t,i,n){this._dimName=e,this._axisIndex=t,this.ecModel=n,this._dataZoomModel=i}return r.prototype.hostedBy=function(e){return this._dataZoomModel===e},r.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},r.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},r.prototype.getTargetSeriesModels=function(){var e=[];return this.ecModel.eachSeries(function(t){if(mj(t)){var i=ms(this._dimName),n=t.getReferringComponents(i,Ar).models[0];n&&this._axisIndex===n.componentIndex&&e.push(t)}},this),e},r.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},r.prototype.getMinMaxSpan=function(){return Qe(this._minMaxSpan)},r.prototype.calculateDataWindow=function(e){var t=this._dataExtent,i=this.getAxisModel(),n=i.axis.scale,a=this._dataZoomModel.getRangePropMode(),o=[0,100],s=[],l=[],u;eg(["start","end"],function(h,p){var d=e[h],g=e[h+"Value"];a[p]==="percent"?(d==null&&(d=o[p]),g=n.parse(rr(d,o,t))):(u=!0,g=g==null?t[p]:n.parse(g),d=rr(g,t,o)),l[p]=g==null||isNaN(g)?t[p]:g,s[p]=d==null||isNaN(d)?o[p]:d}),xj(l),xj(s);var c=this._minMaxSpan;u?f(l,s,t,o,!1):f(s,l,o,t,!0);function f(h,p,d,g,m){var v=m?"Span":"ValueSpan";Za(0,h,d,"all",c["min"+v],c["max"+v]);for(var _=0;_<2;_++)p[_]=rr(h[_],d,g,!0),m&&(p[_]=n.parse(p[_]))}return{valueWindow:l,percentWindow:s}},r.prototype.reset=function(e){if(e===this._dataZoomModel){var t=this.getTargetSeriesModels();this._dataExtent=BSe(this,this._dimName,t),this._updateMinMaxSpan();var i=this.calculateDataWindow(e.settledOption);this._valueWindow=i.valueWindow,this._percentWindow=i.percentWindow,this._setAxisModel()}},r.prototype.filterData=function(e,t){if(e!==this._dataZoomModel)return;var i=this._dimName,n=this.getTargetSeriesModels(),a=e.get("filterMode"),o=this._valueWindow;if(a==="none")return;eg(n,function(l){var u=l.getData(),c=u.mapDimensionsAll(i);if(c.length){if(a==="weakFilter"){var f=u.getStore(),h=de(c,function(p){return u.getDimensionIndex(p)},u);u.filterSelf(function(p){for(var d,g,m,v=0;v<c.length;v++){var _=f.get(h[v],p),y=!isNaN(_),x=_<o[0],M=_>o[1];if(y&&!x&&!M)return!0;y&&(m=!0),x&&(d=!0),M&&(g=!0)}return m&&d&&g})}else eg(c,function(p){if(a==="empty")l.setData(u=u.map(p,function(g){return s(g)?g:NaN}));else{var d={};d[p]=o,u.selectRange(d)}});eg(c,function(p){u.setApproximateExtent(o,p)})}});function s(l){return l>=o[0]&&l<=o[1]}},r.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,i=this._dataExtent;eg(["min","max"],function(n){var a=t.get(n+"Span"),o=t.get(n+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?a=rr(i[0]+o,i,[0,100],!0):a!=null&&(o=rr(a,[0,100],i,!0)-i[0]),e[n+"Span"]=a,e[n+"ValueSpan"]=o},this)},r.prototype._setAxisModel=function(){var e=this.getAxisModel(),t=this._percentWindow,i=this._valueWindow;if(t){var n=Bm(i,[0,500]);n=Math.min(n,20);var a=e.axis.scale.rawExtentInfo;t[0]!==0&&a.setDeterminedMinMax("min",+i[0].toFixed(n)),t[1]!==100&&a.setDeterminedMinMax("max",+i[1].toFixed(n)),a.freeze()}},r}();function BSe(r,e,t){var i=[1/0,-1/0];eg(t,function(o){c8(i,o.getData(),e)});var n=r.getAxisModel(),a=L1(n.axis.scale,n,i).calculate();return[a.min,a.max]}var Sj=FSe;var kSe={getTargetSeries:function(r){function e(n){r.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=r.getComponent(ms(o),s);n(o,s,l,a)})})}e(function(n,a,o,s){o.__dzAxisProxy=null});var t=[];e(function(n,a,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new Sj(n,a,s,r),t.push(o.__dzAxisProxy))});var i=ke();return N(t,function(n){N(n.getTargetSeriesModels(),function(a){i.set(a.uid,a)})}),i},overallReset:function(r,e){r.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(i,n){t.getAxisProxy(i,n).reset(t)}),t.eachTargetAxis(function(i,n){t.getAxisProxy(i,n).filterData(t,e)})}),r.eachComponent("dataZoom",function(t){var i=t.findRepresentativeAxisProxy();if(i){var n=i.getDataPercentWindow(),a=i.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:a[0],endValue:a[1]})}})}},Mj=kSe;function fO(r){r.registerAction("dataZoom",function(e,t){var i=vj(t,e);N(i,function(n){n.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var bj=!1;function pd(r){bj||(bj=!0,r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,Mj),fO(r),r.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function wj(r){r.registerComponentModel(yj),r.registerComponentView(_j),pd(r)}var $i=function(){function r(){}return r}();var Tj={};function th(r,e){Tj[r]=e}function aE(r){return Tj[r]}var GSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){r.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;N(this.option.feature,function(i,n){var a=aE(n);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(t)),_t(i,a.defaultOption))})},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(Pt),Ej=GSe;function Aj(r,e,t){var i=e.getBoxLayoutParams(),n=e.get("padding"),a={width:t.getWidth(),height:t.getHeight()},o=xr(i,a,n);Xs(e.get("orient"),r,e.get("itemGap"),o.width,o.height),Cf(r,i,a,n)}function oE(r,e){var t=Hs(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),r=new Et({shape:{x:r.x-t[3],y:r.y-t[0],width:r.width+t[1]+t[3],height:r.height+t[0]+t[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1}),r}var WSe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,i,n,a){var o=this.group;if(o.removeAll(),!t.get("show"))return;var s=+t.get("itemSize"),l=t.get("orient")==="vertical",u=t.get("feature")||{},c=this._features||(this._features={}),f=[];N(u,function(d,g){f.push(g)}),new An(this._featureNames||[],f).add(h).update(h).remove(ot(h,null)).execute(),this._featureNames=f;function h(d,g){var m=f[d],v=f[g],_=u[m],y=new Zt(_,t,t.ecModel),x;if(a&&a.newTitle!=null&&a.featureName===m&&(_.title=a.newTitle),m&&!v){if(XSe(m))x={onclick:y.option.onclick,featureName:m};else{var M=aE(m);if(!M)return;x=new M}c[m]=x}else if(x=c[v],!x)return;x.uid=rs("toolbox-feature"),x.model=y,x.ecModel=i,x.api=n;var S=x instanceof $i;if(!m&&v){S&&x.dispose&&x.dispose(i,n);return}if(!y.get("show")||S&&x.unusable){S&&x.remove&&x.remove(i,n);return}p(y,x,m),y.setIconStatus=function(w,T){var C=this.option,b=this.iconPaths;C.iconStatus=C.iconStatus||{},C.iconStatus[w]=T,b[w]&&(T==="emphasis"?Bn:kn)(b[w])},x instanceof $i&&x.render&&x.render(y,i,n,a)}function p(d,g,m){var v=d.getModel("iconStyle"),_=d.getModel(["emphasis","iconStyle"]),y=g instanceof $i&&g.getIcons?g.getIcons():d.get("icon"),x=d.get("title")||{},M,S;Ce(y)?(M={},M[m]=y):M=y,Ce(x)?(S={},S[m]=x):S=x;var w=d.iconPaths={};N(M,function(T,C){var b=Lu(T,{},{x:-s/2,y:-s/2,width:s,height:s});b.setStyle(v.getItemStyle());var E=b.ensureState("emphasis");E.style=_.getItemStyle();var I=new Lt({style:{text:S[C],align:_.get("textAlign"),borderRadius:_.get("textBorderRadius"),padding:_.get("textPadding"),fill:null,font:av({fontStyle:_.get("textFontStyle"),fontFamily:_.get("textFontFamily"),fontSize:_.get("textFontSize"),fontWeight:_.get("textFontWeight")},i)},ignore:!0});b.setTextContent(I),Gs({el:b,componentModel:t,itemName:C,formatterParamsExtra:{title:S[C]}}),b.__title=S[C],b.on("mouseover",function(){var R=_.getItemStyle(),A=l?t.get("right")==null&&t.get("left")!=="right"?"right":"left":t.get("bottom")==null&&t.get("top")!=="bottom"?"bottom":"top";I.setStyle({fill:_.get("textFill")||R.fill||R.stroke||"#000",backgroundColor:_.get("textBackgroundColor")}),b.setTextConfig({position:_.get("textPosition")||A}),I.ignore=!t.get("showTitle"),n.enterEmphasis(this)}).on("mouseout",function(){d.get(["iconStatus",C])!=="emphasis"&&n.leaveEmphasis(this),I.hide()}),(d.get(["iconStatus",C])==="emphasis"?Bn:kn)(b),o.add(b),b.on("click",Be(g.onclick,g,i,n,C)),w[C]=b})}Aj(o,t,n),o.add(oE(o.getBoundingRect(),t)),l||o.eachChild(function(d){var g=d.__title,m=d.ensureState("emphasis"),v=m.textConfig||(m.textConfig={}),_=d.getTextContent(),y=_&&_.ensureState("emphasis");if(y&&!He(y)&&g){var x=y.style||(y.style={}),M=Rl(g,Lt.makeFont(x)),S=d.x+o.x,w=d.y+o.y+s,T=!1;w+M.height>n.getHeight()&&(v.position="top",T=!0);var C=T?-5-M.height:s+10;S+M.width/2>n.getWidth()?(v.position=["100%",C],x.align="right"):S-M.width/2<0&&(v.position=[0,C],x.align="left")}})},e.prototype.updateView=function(t,i,n,a){N(this._features,function(o){o instanceof $i&&o.updateView&&o.updateView(o.model,i,n,a)})},e.prototype.remove=function(t,i){N(this._features,function(n){n instanceof $i&&n.remove&&n.remove(t,i)}),this.group.removeAll()},e.prototype.dispose=function(t,i){N(this._features,function(n){n instanceof $i&&n.dispose&&n.dispose(t,i)})},e.type="toolbox",e}(er);function XSe(r){return r.indexOf("my")===0}var Cj=WSe;var YSe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){var n=this.model,a=n.get("name")||t.get("title.0.text")||"echarts",o=i.getZr().painter.getType()==="svg",s=o?"svg":n.get("type",!0)||"png",l=i.getConnectedDataURL({type:s,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),u=zt.browser;if(He(MouseEvent)&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=a+"."+s,c.target="_blank",c.href=l;var f=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(f)}else if(window.navigator.msSaveOrOpenBlob||o){var h=l.split(","),p=h[0].indexOf("base64")>-1,d=o?decodeURIComponent(h[1]):h[1];p&&(d=window.atob(d));var g=a+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var m=d.length,v=new Uint8Array(m);m--;)v[m]=d.charCodeAt(m);var _=new Blob([v]);window.navigator.msSaveOrOpenBlob(_,g)}else{var y=document.createElement("iframe");document.body.appendChild(y);var x=y.contentWindow,M=x.document;M.open("image/svg+xml","replace"),M.write(d),M.close(),x.focus(),M.execCommand("SaveAs",!0,g),document.body.removeChild(y)}}else{var S=n.get("lang"),w='<body style="margin:0;"><img src="'+l+'" style="max-width:100%;" title="'+(S&&S[0]||"")+'" /></body>',T=window.open();T.document.write(w),T.document.title=a}},e.getDefaultOption=function(t){var i={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return i},e}($i),Rj=YSe;var Lj="__ec_magicType_stack__";var qSe=[["line","bar"],["stack"]],ZSe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getIcons=function(){var t=this.model,i=t.get("icon"),n={};return N(t.get("type"),function(a){i[a]&&(n[a]=i[a])}),n},e.getDefaultOption=function(t){var i={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return i},e.prototype.onclick=function(t,i,n){var a=this.model,o=a.get(["seriesIndex",n]);if(Pj[n]){var s={series:[]},l=function(f){var h=f.subType,p=f.id,d=Pj[n](h,p,f,a);d&&(Ye(d,f.option),s.series.push(d));var g=f.coordinateSystem;if(g&&g.type==="cartesian2d"&&(n==="line"||n==="bar")){var m=g.getAxesByScale("ordinal")[0];if(m){var v=m.dim,_=v+"Axis",y=f.getReferringComponents(_,Ar).models[0],x=y.componentIndex;s[_]=s[_]||[];for(var M=0;M<=x;M++)s[_][x]=s[_][x]||{};s[_][x].boundaryGap=n==="bar"}}};N(qSe,function(f){dt(f,n)>=0&&N(f,function(h){a.setIconStatus(h,"normal")})}),a.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=n;n==="stack"&&(u=_t({stack:a.option.title.tiled,tiled:a.option.title.stack},a.option.title),a.get(["iconStatus",n])!=="emphasis"&&(c="tiled")),i.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},e}($i),Pj={line:function(r,e,t,i){if(r==="bar")return _t({id:e,type:"line",data:t.get("data"),stack:t.get("stack"),markPoint:t.get("markPoint"),markLine:t.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(r,e,t,i){if(r==="line")return _t({id:e,type:"bar",data:t.get("data"),stack:t.get("stack"),markPoint:t.get("markPoint"),markLine:t.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(r,e,t,i){var n=t.get("stack")===Lj;if(r==="line"||r==="bar")return i.setIconStatus("stack",n?"normal":"emphasis"),_t({id:e,stack:n?"":Lj},i.get(["option","stack"])||{},!0)}};ha({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(r,e){e.mergeOption(r.newOption)});var Dj=ZSe;var lE=new Array(60).join("-"),tg=" ";function jSe(r){var e={},t=[],i=[];return r.eachRawSeries(function(n){var a=n.coordinateSystem;if(a&&(a.type==="cartesian2d"||a.type==="polar")){var o=a.getBaseAxis();if(o.type==="category"){var s=o.dim+"_"+o.index;e[s]||(e[s]={categoryAxis:o,valueAxis:a.getOtherAxis(o),series:[]},i.push({axisDim:o.dim,axisIndex:o.index})),e[s].series.push(n)}else t.push(n)}else t.push(n)}),{seriesGroupByCategoryAxis:e,other:t,meta:i}}function KSe(r){var e=[];return N(r,function(t,i){var n=t.categoryAxis,a=t.valueAxis,o=a.dim,s=[" "].concat(de(t.series,function(p){return p.name})),l=[n.model.getCategories()];N(t.series,function(p){var d=p.getRawData();l.push(p.getRawData().mapArray(d.mapDimension(o),function(g){return g}))});for(var u=[s.join(tg)],c=0;c<l[0].length;c++){for(var f=[],h=0;h<l.length;h++)f.push(l[h][c]);u.push(f.join(tg))}e.push(u.join(`
  2217. `))}),e.join(`
  2218. `+lE+`
  2219. `)}function JSe(r){return de(r,function(e){var t=e.getRawData(),i=[e.name],n=[];return t.each(t.dimensions,function(){for(var a=arguments.length,o=arguments[a-1],s=t.getName(o),l=0;l<a-1;l++)n[l]=arguments[l];i.push((s?s+tg:"")+n.join(tg))}),i.join(`
  2220. `)}).join(`
  2221. `+lE+`
  2222. `)}function $Se(r){var e=jSe(r);return{value:Wt([KSe(e.seriesGroupByCategoryAxis),JSe(e.other)],function(t){return!!t.replace(/[\n\t\s]/g,"")}).join(`
  2223. `+lE+`
  2224. `),meta:e.meta}}function sE(r){return r.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function QSe(r){var e=r.slice(0,r.indexOf(`
  2225. `));if(e.indexOf(tg)>=0)return!0}var hO=new RegExp("["+tg+"]+","g");function eMe(r){for(var e=r.split(/\n+/g),t=sE(e.shift()).split(hO),i=[],n=de(t,function(l){return{name:l,data:[]}}),a=0;a<e.length;a++){var o=sE(e[a]).split(hO);i.push(o.shift());for(var s=0;s<o.length;s++)n[s]&&(n[s].data[a]=o[s])}return{series:n,categories:i}}function tMe(r){for(var e=r.split(/\n+/g),t=sE(e.shift()),i=[],n=0;n<e.length;n++){var a=sE(e[n]);if(a){var o=a.split(hO),s="",l=void 0,u=!1;isNaN(o[0])?(u=!0,s=o[0],o=o.slice(1),i[n]={name:s,value:[]},l=i[n].value):l=i[n]=[];for(var c=0;c<o.length;c++)l.push(+o[c]);l.length===1&&(u?i[n].value=l[0]:i[n]=l[0])}}return{name:t,data:i}}function rMe(r,e){var t=r.split(new RegExp(`
  2226. *`+lE+`
  2227. *`,"g")),i={series:[]};return N(t,function(n,a){if(QSe(n)){var o=eMe(n),s=e[a],l=s.axisDim+"Axis";s&&(i[l]=i[l]||[],i[l][s.axisIndex]={data:o.categories},i.series=i.series.concat(o.series))}else{var o=tMe(n);i.series.push(o)}}),i}var iMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){setTimeout(function(){i.dispatchAction({type:"hideTip"})});var n=i.getDom(),a=this.model;this._dom&&n.removeChild(this._dom);var o=document.createElement("div");o.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;padding:5px",o.style.backgroundColor=a.get("backgroundColor")||"#fff";var s=document.createElement("h4"),l=a.get("lang")||[];s.innerHTML=l[0]||a.get("title"),s.style.cssText="margin:10px 20px",s.style.color=a.get("textColor");var u=document.createElement("div"),c=document.createElement("textarea");u.style.cssText="overflow:auto";var f=a.get("optionToContent"),h=a.get("contentToOption"),p=$Se(t);if(He(f)){var d=f(i.getOption());Ce(d)?u.innerHTML=d:sf(d)&&u.appendChild(d)}else{c.readOnly=a.get("readOnly");var g=c.style;g.cssText="display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none",g.color=a.get("textColor"),g.borderColor=a.get("textareaBorderColor"),g.backgroundColor=a.get("textareaColor"),c.value=p.value,u.appendChild(c)}var m=p.meta,v=document.createElement("div");v.style.cssText="position:absolute;bottom:5px;left:0;right:0";var _="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",y=document.createElement("div"),x=document.createElement("div");_+=";background-color:"+a.get("buttonColor"),_+=";color:"+a.get("buttonTextColor");var M=this;function S(){n.removeChild(o),M._dom=null}O0(y,"click",S),O0(x,"click",function(){if(h==null&&f!=null||h!=null&&f==null){S();return}var w;try{He(h)?w=h(u,i.getOption()):w=rMe(c.value,m)}catch(T){throw S(),new Error("Data view format error "+T)}w&&i.dispatchAction({type:"changeDataView",newOption:w}),S()}),y.innerHTML=l[1],x.innerHTML=l[2],x.style.cssText=y.style.cssText=_,!a.get("readOnly")&&v.appendChild(x),v.appendChild(y),o.appendChild(s),o.appendChild(u),o.appendChild(v),u.style.height=n.clientHeight-80+"px",n.appendChild(o),this._dom=o},e.prototype.remove=function(t,i){this._dom&&i.getDom().removeChild(this._dom)},e.prototype.dispose=function(t,i){this.remove(t,i)},e.getDefaultOption=function(t){var i={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:t.getLocaleModel().get(["toolbox","dataView","title"]),lang:t.getLocaleModel().get(["toolbox","dataView","lang"]),backgroundColor:"#fff",textColor:"#000",textareaColor:"#fff",textareaBorderColor:"#333",buttonColor:"#c23531",buttonTextColor:"#fff"};return i},e}($i);function nMe(r,e){return de(r,function(t,i){var n=e&&e[i];if(qe(n)&&!pe(n)){var a=qe(t)&&!pe(t);a||(t={value:t});var o=n.name!=null&&t.name==null;return t=Ye(t,n),o&&delete t.name,t}else return t})}ha({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(r,e){var t=[];N(r.newOption.series,function(i){var n=e.getSeriesByName(i.name)[0];if(!n)t.push(fe({type:"scatter"},i));else{var a=n.get("data");t.push({name:i.name,data:nMe(i.data,a)})}}),e.mergeOption(Ye({series:t},r.newOption))});var Ij=iMe;var Nj=N,Uj=vt();function Oj(r,e){var t=pO(r);Nj(e,function(i,n){for(var a=t.length-1;a>=0;a--){var o=t[a];if(o[n])break}if(a<0){var s=r.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(s){var l=s.getPercentRange();t[0][n]={dataZoomId:n,start:l[0],end:l[1]}}}}),t.push(e)}function zj(r){var e=pO(r),t=e[e.length-1];e.length>1&&e.pop();var i={};return Nj(t,function(n,a){for(var o=e.length-1;o>=0;o--)if(n=e[o][a],n){i[a]=n;break}}),i}function Fj(r){Uj(r).snapshots=null}function Bj(r){return pO(r).length}function pO(r){var e=Uj(r);return e.snapshots||(e.snapshots=[{}]),e.snapshots}var aMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){Fj(t),i.dispatchAction({type:"restore",from:this.uid})},e.getDefaultOption=function(t){var i={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:t.getLocaleModel().get(["toolbox","restore","title"])};return i},e}($i);ha({type:"restore",event:"restore",update:"prepareAndUpdate"},function(r,e){e.resetOption("recreate")});var Vj=aMe;var oMe=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],sMe=function(){function r(e,t,i){var n=this;this._targetInfoList=[];var a=Gj(t,e);N(lMe,function(o,s){(!i||!i.include||dt(i.include,s)>=0)&&o(a,n._targetInfoList)})}return r.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(i,n,a){if((i.coordRanges||(i.coordRanges=[])).push(n),!i.coordRange){i.coordRange=n;var o=dO[i.brushType](0,a,n);i.__rangeOffset={offset:Yj[i.brushType](o.values,i.range,[1,1]),xyMinMax:o.xyMinMax}}}),e},r.prototype.matchOutputRanges=function(e,t,i){N(e,function(n){var a=this.findTargetInfo(n,t);a&&a!==!0&&N(a.coordSyses,function(o){var s=dO[n.brushType](1,o,n.range,!0);i(n,s.values,o,t)})},this)},r.prototype.setInputRanges=function(e,t){N(e,function(i){var n=this.findTargetInfo(i,t);if(i.range=i.range||[],n&&n!==!0){i.panelId=n.panelId;var a=dO[i.brushType](0,n.coordSys,i.coordRange),o=i.__rangeOffset;i.range=o?Yj[i.brushType](a.values,o.offset,uMe(a.xyMinMax,o.xyMinMax)):a.values}},this)},r.prototype.makePanelOpts=function(e,t){return de(this._targetInfoList,function(i){var n=i.getPanelRect();return{panelId:i.panelId,defaultBrushType:t?t(i):null,clipPath:IT(n),isTargetByCursor:UT(n,e,i.coordSysModel),getLinearBrushOtherExtent:NT(n)}})},r.prototype.controlSeries=function(e,t,i){var n=this.findTargetInfo(e,i);return n===!0||n&&dt(n.coordSyses,t.coordinateSystem)>=0},r.prototype.findTargetInfo=function(e,t){for(var i=this._targetInfoList,n=Gj(t,e),a=0;a<i.length;a++){var o=i[a],s=e.panelId;if(s){if(o.panelId===s)return o}else for(var l=0;l<Hj.length;l++)if(Hj[l](n,o))return o}return!0},r}();function mO(r){return r[0]>r[1]&&r.reverse(),r}function Gj(r,e){return yf(r,e,{includeMainTypes:oMe})}var lMe={grid:function(r,e){var t=r.xAxisModels,i=r.yAxisModels,n=r.gridModels,a=ke(),o={},s={};!t&&!i&&!n||(N(t,function(l){var u=l.axis.grid.model;a.set(u.id,u),o[u.id]=!0}),N(i,function(l){var u=l.axis.grid.model;a.set(u.id,u),s[u.id]=!0}),N(n,function(l){a.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),a.each(function(l){var u=l.coordinateSystem,c=[];N(u.getCartesians(),function(f,h){(dt(t,f.getAxis("x").model)>=0||dt(i,f.getAxis("y").model)>=0)&&c.push(f)}),e.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:Wj.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(r,e){N(r.geoModels,function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:i,coordSyses:[i],getPanelRect:Wj.geo})})}},Hj=[function(r,e){var t=r.xAxisModel,i=r.yAxisModel,n=r.gridModel;return!n&&t&&(n=t.axis.grid.model),!n&&i&&(n=i.axis.grid.model),n&&n===e.gridModel},function(r,e){var t=r.geoModel;return t&&t===e.geoModel}],Wj={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var r=this.coordSys,e=r.getBoundingRect().clone();return e.applyTransform(Vs(r)),e}},dO={lineX:ot(Xj,0),lineY:ot(Xj,1),rect:function(r,e,t,i){var n=r?e.pointToData([t[0][0],t[1][0]],i):e.dataToPoint([t[0][0],t[1][0]],i),a=r?e.pointToData([t[0][1],t[1][1]],i):e.dataToPoint([t[0][1],t[1][1]],i),o=[mO([n[0],a[0]]),mO([n[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(r,e,t,i){var n=[[1/0,-1/0],[1/0,-1/0]],a=de(t,function(o){var s=r?e.pointToData(o,i):e.dataToPoint(o,i);return n[0][0]=Math.min(n[0][0],s[0]),n[1][0]=Math.min(n[1][0],s[1]),n[0][1]=Math.max(n[0][1],s[0]),n[1][1]=Math.max(n[1][1],s[1]),s});return{values:a,xyMinMax:n}}};function Xj(r,e,t,i){var n=t.getAxis(["x","y"][r]),a=mO(de([0,1],function(s){return e?n.coordToData(n.toLocalCoord(i[s]),!0):n.toGlobalCoord(n.dataToCoord(i[s]))})),o=[];return o[r]=a,o[1-r]=[NaN,NaN],{values:a,xyMinMax:o}}var Yj={lineX:ot(qj,0),lineY:ot(qj,1),rect:function(r,e,t){return[[r[0][0]-t[0]*e[0][0],r[0][1]-t[0]*e[0][1]],[r[1][0]-t[1]*e[1][0],r[1][1]-t[1]*e[1][1]]]},polygon:function(r,e,t){return de(r,function(i,n){return[i[0]-t[0]*e[n][0],i[1]-t[1]*e[n][1]]})}};function qj(r,e,t,i){return[e[0]-i[r]*t[0],e[1]-i[r]*t[1]]}function uMe(r,e){var t=Zj(r),i=Zj(e),n=[t[0]/i[0],t[1]/i[1]];return isNaN(n[0])&&(n[0]=1),isNaN(n[1])&&(n[1]=1),n}function Zj(r){return r?[r[0][1]-r[0][0],r[1][1]-r[1][0]]:[NaN,NaN]}var Vx=sMe;var vO=N,cMe=sH("toolbox-dataZoom_");var fMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,i,n,a){this._brushController||(this._brushController=new Wv(n.getZr()),this._brushController.on("brush",Be(this._onBrush,this)).mount()),dMe(t,i,this,a,n),pMe(t,i)},e.prototype.onclick=function(t,i,n){hMe[n].call(this)},e.prototype.remove=function(t,i){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,i){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var i=t.areas;if(!t.isEnd||!i.length)return;var n={},a=this.ecModel;this._brushController.updateCovers([]);var o=new Vx(gO(this.model),a,{include:["grid"]});o.matchOutputRanges(i,a,function(u,c,f){if(f.type==="cartesian2d"){var h=u.brushType;h==="rect"?(s("x",f,c[0]),s("y",f,c[1])):s({lineX:"x",lineY:"y"}[h],f,c)}}),Oj(a,n),this._dispatchZoomAction(n);function s(u,c,f){var h=c.getAxis(u),p=h.model,d=l(u,p,a),g=d.findRepresentativeAxisProxy(p).getMinMaxSpan();(g.minValueSpan!=null||g.maxValueSpan!=null)&&(f=Za(0,f.slice(),h.scale.getExtent(),0,g.minValueSpan,g.maxValueSpan)),d&&(n[d.id]={dataZoomId:d.id,startValue:f[0],endValue:f[1]})}function l(u,c,f){var h;return f.eachComponent({mainType:"dataZoom",subType:"select"},function(p){var d=p.getAxisModel(u,c.componentIndex);d&&(h=p)}),h}},e.prototype._dispatchZoomAction=function(t){var i=[];vO(t,function(n,a){i.push(Qe(n))}),i.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:i})},e.getDefaultOption=function(t){var i={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}};return i},e}($i),hMe={zoom:function(){var r=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:r})},back:function(){this._dispatchZoomAction(zj(this.ecModel))}};function gO(r){var e={xAxisIndex:r.get("xAxisIndex",!0),yAxisIndex:r.get("yAxisIndex",!0),xAxisId:r.get("xAxisId",!0),yAxisId:r.get("yAxisId",!0)};return e.xAxisIndex==null&&e.xAxisId==null&&(e.xAxisIndex="all"),e.yAxisIndex==null&&e.yAxisId==null&&(e.yAxisIndex="all"),e}function pMe(r,e){r.setIconStatus("back",Bj(e)>1?"emphasis":"normal")}function dMe(r,e,t,i,n){var a=t._isZoomActive;i&&i.type==="takeGlobalCursor"&&(a=i.key==="dataZoomSelect"?i.dataZoomSelectActive:!1),t._isZoomActive=a,r.setIconStatus("zoom",a?"emphasis":"normal");var o=new Vx(gO(r),e,{include:["grid"]}),s=o.makePanelOpts(n,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});t._brushController.setPanels(s).enableBrush(a&&s.length?{brushType:"auto",brushStyle:r.getModel("brushStyle").getItemStyle()}:!1)}C5("dataZoom",function(r){var e=r.getComponent("toolbox",0),t=["feature","dataZoom"];if(!e||e.get(t)==null)return;var i=e.getModel(t),n=[],a=gO(i),o=yf(r,a);vO(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),vO(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var f=l.componentIndex,h={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:cMe+u+f};h[c]=f,n.push(h)}return n});var jj=fMe;function yO(r){r.registerComponentModel(Ej),r.registerComponentView(Cj),th("saveAsImage",Rj),th("magicType",Dj),th("dataView",Ij),th("dataZoom",jj),th("restore",Vj),It(wj)}var mMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(Pt),Kj=mMe;function uE(r){var e=r.get("confine");return e!=null?!!e:r.get("renderMode")==="richText"}function Jj(r){if(zt.domSupported){for(var e=document.documentElement.style,t=0,i=r.length;t<i;t++)if(r[t]in e)return r[t]}}var _O=Jj(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),$j=Jj(["webkitTransition","transition","OTransition","MozTransition","msTransition"]);function xO(r,e){if(!r)return e;e=Aw(e,!0);var t=r.indexOf(e);return r=t===-1?e:"-"+r.slice(0,t)+"-"+e,r.toLowerCase()}function Qj(r,e){var t=r.currentStyle||document.defaultView&&document.defaultView.getComputedStyle(r);return t?e?t[e]:t:null}var vMe=xO($j,"transition"),SO=xO(_O,"transform"),gMe="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(zt.transform3dSupported?"will-change:transform;":"");function yMe(r){return r=r==="left"?"right":r==="right"?"left":r==="top"?"bottom":"top",r}function _Me(r,e,t){if(!Ce(t)||t==="inside")return"";var i=r.get("backgroundColor"),n=r.get("borderWidth");e=Ws(e);var a=yMe(t),o=Math.max(Math.round(n)*1.5,6),s="",l=SO+":",u;dt(["left","right"],a)>-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=a==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=a==="top"?225:45)+"deg)");var c=u*Math.PI/180,f=o+n,h=f*Math.abs(Math.cos(c))+f*Math.abs(Math.sin(c)),p=Math.round(((h-Math.SQRT2*n)/2+Math.SQRT2*n-(h-f)/2)*100)/100;s+=";"+a+":-"+p+"px";var d=e+" solid "+n+"px;",g=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+d,"border-right:"+d,"background-color:"+i+";"];return'<div style="'+g.join("")+'"></div>'}function xMe(r,e){var t="cubic-bezier(0.23,1,0.32,1)",i=" "+r/2+"s "+t,n="opacity"+i+",visibility"+i;return e||(i=" "+r+"s "+t,n+=zt.transformSupported?","+SO+i:",left"+i+",top"+i),vMe+":"+n}function eK(r,e,t){var i=r.toFixed(0)+"px",n=e.toFixed(0)+"px";if(!zt.transformSupported)return t?"top:"+n+";left:"+i+";":[["top",n],["left",i]];var a=zt.transform3dSupported,o="translate"+(a?"3d":"")+"("+i+","+n+(a?",0":"")+")";return t?"top:0;left:0;"+SO+":"+o+";":[["top",0],["left",0],[_O,o]]}function SMe(r){var e=[],t=r.get("fontSize"),i=r.getTextColor();i&&e.push("color:"+i),e.push("font:"+r.getFont()),t&&e.push("line-height:"+Math.round(t*3/2)+"px");var n=r.get("textShadowColor"),a=r.get("textShadowBlur")||0,o=r.get("textShadowOffsetX")||0,s=r.get("textShadowOffsetY")||0;return n&&a&&e.push("text-shadow:"+o+"px "+s+"px "+a+"px "+n),N(["decoration","align"],function(l){var u=r.get(l);u&&e.push("text-"+l+":"+u)}),e.join(";")}function MMe(r,e,t){var i=[],n=r.get("transitionDuration"),a=r.get("backgroundColor"),o=r.get("shadowBlur"),s=r.get("shadowColor"),l=r.get("shadowOffsetX"),u=r.get("shadowOffsetY"),c=r.getModel("textStyle"),f=Zw(r,"html"),h=l+"px "+u+"px "+o+"px "+s;return i.push("box-shadow:"+h),e&&n&&i.push(xMe(n,t)),a&&i.push("background-color:"+a),N(["width","color","radius"],function(p){var d="border-"+p,g=Aw(d),m=r.get(g);m!=null&&i.push(d+":"+m+(p==="color"?"":"px"))}),i.push(SMe(c)),f!=null&&i.push("padding:"+Hs(f).join("px ")+"px"),i.join(";")+";"}function tK(r,e,t,i,n){var a=e&&e.painter;if(t){var o=a&&a.getViewportRoot();o&&WV(r,o,t,i,n)}else{r[0]=i,r[1]=n;var s=a&&a.getViewportRootOffset();s&&(r[0]+=s.offsetLeft,r[1]+=s.offsetTop)}r[2]=r[0]/e.getWidth(),r[3]=r[1]/e.getHeight()}var bMe=function(){function r(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,zt.wxa)return null;var i=document.createElement("div");i.domBelongToZr=!0,this.el=i;var n=this._zr=e.getZr(),a=t.appendTo,o=a&&(Ce(a)?document.querySelector(a):sf(a)?a:He(a)&&a(e.getDom()));tK(this._styleCoord,n,o,e.getWidth()/2,e.getHeight()/2),(o||e.getDom()).appendChild(i),this._api=e,this._container=o;var s=this;i.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},i.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=n.handler,c=n.painter.getViewportRoot();Ca(c,l,!0),u.dispatch("mousemove",l)}},i.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return r.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),i=Qj(t,"position"),n=t.style;n.position!=="absolute"&&i!=="absolute"&&(n.position="relative")}var a=e.get("alwaysShowContent");a&&this._moveIfResized(),this._alwaysShowContent=a,this.el.className=e.get("className")||""},r.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var i=this.el,n=i.style,a=this._styleCoord;i.innerHTML?n.cssText=gMe+MMe(e,!this._firstShow,this._longHide)+eK(a[0],a[1],!0)+("border-color:"+Ws(t)+";")+(e.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):n.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},r.prototype.setContent=function(e,t,i,n,a){var o=this.el;if(e==null){o.innerHTML="";return}var s="";if(Ce(a)&&i.get("trigger")==="item"&&!uE(i)&&(s=_Me(i,n,a)),Ce(e))o.innerHTML=e+s;else if(e){o.innerHTML="",pe(e)||(e=[e]);for(var l=0;l<e.length;l++)sf(e[l])&&e[l].parentNode!==o&&o.appendChild(e[l]);if(s&&o.childNodes.length){var u=document.createElement("div");u.innerHTML=s,o.appendChild(u)}}},r.prototype.setEnterable=function(e){this._enterable=e},r.prototype.getSize=function(){var e=this.el;return[e.offsetWidth,e.offsetHeight]},r.prototype.moveTo=function(e,t){var i=this._styleCoord;if(tK(i,this._zr,this._container,e,t),i[0]!=null&&i[1]!=null){var n=this.el.style,a=eK(i[0],i[1]);N(a,function(o){n[o[0]]=o[1]})}},r.prototype._moveIfResized=function(){var e=this._styleCoord[2],t=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),t*this._zr.getHeight())},r.prototype.hide=function(){var e=this,t=this.el.style;t.visibility="hidden",t.opacity="0",zt.transform3dSupported&&(t.willChange=""),this._show=!1,this._longHideTimeout=setTimeout(function(){return e._longHide=!0},500)},r.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Be(this.hide,this),e)):this.hide())},r.prototype.isShow=function(){return this._show},r.prototype.dispose=function(){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var e=this.el.parentNode;e&&e.removeChild(this.el),this.el=this._container=null},r}(),rK=bMe;var wMe=function(){function r(e){this._show=!1,this._styleCoord=[0,0,0,0],this._alwaysShowContent=!1,this._enterable=!0,this._zr=e.getZr(),nK(this._styleCoord,this._zr,e.getWidth()/2,e.getHeight()/2)}return r.prototype.update=function(e){var t=e.get("alwaysShowContent");t&&this._moveIfResized(),this._alwaysShowContent=t},r.prototype.show=function(){this._hideTimeout&&clearTimeout(this._hideTimeout),this.el.show(),this._show=!0},r.prototype.setContent=function(e,t,i,n,a){var o=this;qe(e)&&ur(""),this.el&&this._zr.remove(this.el);var s=i.getModel("textStyle");this.el=new Lt({style:{rich:t.richTextStyles,text:e,lineHeight:22,borderWidth:1,borderColor:n,textShadowColor:s.get("textShadowColor"),fill:i.get(["textStyle","color"]),padding:Zw(i,"richText"),verticalAlign:"top",align:"left"},z:i.get("z")}),N(["backgroundColor","borderRadius","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"],function(u){o.el.style[u]=i.get(u)}),N(["textShadowBlur","textShadowOffsetX","textShadowOffsetY"],function(u){o.el.style[u]=s.get(u)||0}),this._zr.add(this.el);var l=this;this.el.on("mouseover",function(){l._enterable&&(clearTimeout(l._hideTimeout),l._show=!0),l._inContent=!0}),this.el.on("mouseout",function(){l._enterable&&l._show&&l.hideLater(l._hideDelay),l._inContent=!1})},r.prototype.setEnterable=function(e){this._enterable=e},r.prototype.getSize=function(){var e=this.el,t=this.el.getBoundingRect(),i=iK(e.style);return[t.width+i.left+i.right,t.height+i.top+i.bottom]},r.prototype.moveTo=function(e,t){var i=this.el;if(i){var n=this._styleCoord;nK(n,this._zr,e,t),e=n[0],t=n[1];var a=i.style,o=rh(a.borderWidth||0),s=iK(a);i.x=e+o+s.left,i.y=t+o+s.top,i.markRedraw()}},r.prototype._moveIfResized=function(){var e=this._styleCoord[2],t=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),t*this._zr.getHeight())},r.prototype.hide=function(){this.el&&this.el.hide(),this._show=!1},r.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Be(this.hide,this),e)):this.hide())},r.prototype.isShow=function(){return this._show},r.prototype.dispose=function(){this._zr.remove(this.el)},r}();function rh(r){return Math.max(0,r)}function iK(r){var e=rh(r.shadowBlur||0),t=rh(r.shadowOffsetX||0),i=rh(r.shadowOffsetY||0);return{left:rh(e-t),right:rh(e+t),top:rh(e-i),bottom:rh(e+i)}}function nK(r,e,t,i){r[0]=t,r[1]=i,r[2]=r[0]/e.getWidth(),r[3]=r[1]/e.getHeight()}var aK=wMe;var TMe=new Et({shape:{x:-1,y:-1,width:2,height:2}}),EMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){if(!(zt.node||!i.getDom())){var n=t.getComponent("tooltip"),a=this._renderMode=hH(n.get("renderMode"));this._tooltipContent=a==="richText"?new aK(i):new rK(i,{appendTo:n.get("appendToBody",!0)?"body":n.get("appendTo",!0)})}},e.prototype.render=function(t,i,n){if(!(zt.node||!n.getDom())){this.group.removeAll(),this._tooltipModel=t,this._ecModel=i,this._api=n;var a=this._tooltipContent;a.update(t),a.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow(),this._renderMode!=="richText"&&t.get("transitionDuration")?os(this,"_updatePosition",50,"fixRate"):zu(this,"_updatePosition")}},e.prototype._initGlobalListener=function(){var t=this._tooltipModel,i=t.get("triggerOn");KT("itemTooltip",this._api,Be(function(n,a,o){i!=="none"&&(i.indexOf(n)>=0?this._tryShow(a,o):n==="leave"&&this._hide(o))},this))},e.prototype._keepShow=function(){var t=this._tooltipModel,i=this._ecModel,n=this._api,a=t.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&a!=="none"&&a!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&o.manuallyShowTip(t,i,n,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},e.prototype.manuallyShowTip=function(t,i,n,a){if(!(a.from===this.uid||zt.node||!n.getDom())){var o=oK(a,n);this._ticket="";var s=a.dataByCoordSys,l=LMe(a,i,n);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:a.position,positionDefault:"bottom"},o)}else if(a.tooltip&&a.x!=null&&a.y!=null){var c=TMe;c.x=a.x,c.y=a.y,c.update(),rt(c).tooltipConfig={name:null,option:a.tooltip},this._tryShow({offsetX:a.x,offsetY:a.y,target:c},o)}else if(s)this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,dataByCoordSys:s,tooltipOption:a.tooltipOption},o);else if(a.seriesIndex!=null){if(this._manuallyAxisShowTip(t,i,n,a))return;var f=Bx(a,i),h=f.point[0],p=f.point[1];h!=null&&p!=null&&this._tryShow({offsetX:h,offsetY:p,target:f.el,position:a.position,positionDefault:"bottom"},o)}else a.x!=null&&a.y!=null&&(n.dispatchAction({type:"updateAxisPointer",x:a.x,y:a.y}),this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,target:n.getZr().findHover(a.x,a.y).target},o))}},e.prototype.manuallyHideTip=function(t,i,n,a){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,a.from!==this.uid&&this._hide(oK(a,n))},e.prototype._manuallyAxisShowTip=function(t,i,n,a){var o=a.seriesIndex,s=a.dataIndex,l=i.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=i.getSeriesByIndex(o);if(u){var c=u.getData(),f=Gx([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(f.get("trigger")==="axis")return n.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:a.position}),!0}}},e.prototype._tryShow=function(t,i){var n=t.target,a=this._tooltipModel;if(a){this._lastX=t.offsetX,this._lastY=t.offsetY;var o=t.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,t);else if(n){var s=rt(n);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,u;qs(n,function(c){if(rt(c).dataIndex!=null)return l=c,!0;if(rt(c).tooltipConfig!=null)return u=c,!0},!0),l?this._showSeriesItemTooltip(t,l,i):u?this._showComponentItemTooltip(t,u,i):this._hide(i)}else this._lastDataByCoordSys=null,this._hide(i)}},e.prototype._showOrMove=function(t,i){var n=t.get("showDelay");i=Be(i,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(i,n):i()},e.prototype._showAxisTooltip=function(t,i){var n=this._ecModel,a=this._tooltipModel,o=[i.offsetX,i.offsetY],s=Gx([i.tooltipOption],a),l=this._renderMode,u=[],c=Or("section",{blocks:[],noHeader:!0}),f=[],h=new jw;N(t,function(_){N(_.dataByAxis,function(y){var x=n.getComponent(y.axisDim+"Axis",y.axisIndex),M=y.value;if(!(!x||M==null)){var S=qU(M,x.axis,n,y.seriesDataIndices,y.valueLabelOpt),w=Or("section",{header:S,noHeader:!Yi(S),sortBlocks:!0,blocks:[]});c.blocks.push(w),N(y.seriesDataIndices,function(T){var C=n.getSeriesByIndex(T.seriesIndex),b=T.dataIndexInside,E=C.getDataParams(b);if(!(E.dataIndex<0)){E.axisDim=y.axisDim,E.axisIndex=y.axisIndex,E.axisType=y.axisType,E.axisId=y.axisId,E.axisValue=sx(x.axis,{value:M}),E.axisValueLabel=S,E.marker=h.makeTooltipMarker("item",Ws(E.color),l);var I=SD(C.formatTooltip(b,!0,null)),R=I.frag;if(R){var A=Gx([C],a).get("valueFormatter");w.blocks.push(A?fe({valueFormatter:A},R):R)}I.text&&f.push(I.text),u.push(E)}})}})}),c.blocks.reverse(),f.reverse();var p=i.position,d=s.get("order"),g=CD(c,h,l,d,n.get("useUTC"),s.get("textStyle"));g&&f.unshift(g);var m=l==="richText"?`
  2228. `:"<br/>",v=f.join(m);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(t,u)?this._updatePosition(s,p,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,v,u,Math.random()+"",o[0],o[1],p,null,h)})},e.prototype._showSeriesItemTooltip=function(t,i,n){var a=this._ecModel,o=rt(i),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,f=o.dataType,h=u.getData(f),p=this._renderMode,d=t.positionDefault,g=Gx([h.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),m=g.get("trigger");if(!(m!=null&&m!=="item")){var v=u.getDataParams(c,f),_=new jw;v.marker=_.makeTooltipMarker("item",Ws(v.color),p);var y=SD(u.formatTooltip(c,!1,f)),x=g.get("order"),M=g.get("valueFormatter"),S=y.frag,w=S?CD(M?fe({valueFormatter:M},S):S,_,p,x,a.get("useUTC"),g.get("textStyle")):y.text,T="item_"+u.name+"_"+c;this._showOrMove(g,function(){this._showTooltipContent(g,w,v,T,t.offsetX,t.offsetY,t.position,t.target,_)}),n({type:"showTip",dataIndexInside:c,dataIndex:h.getRawIndex(c),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,i,n){var a=rt(i),o=a.tooltipConfig,s=o.option||{};if(Ce(s)){var l=s;s={content:l,formatter:l}}var u=[s],c=this._ecModel.getComponent(a.componentMainType,a.componentIndex);c&&u.push(c),u.push({formatter:s.content});var f=t.positionDefault,h=Gx(u,this._tooltipModel,f?{position:f}:null),p=h.get("content"),d=Math.random()+"",g=new jw;this._showOrMove(h,function(){var m=Qe(h.get("formatterParams")||{});this._showTooltipContent(h,p,m,d,t.offsetX,t.offsetY,t.position,i,g)}),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,i,n,a,o,s,l,u,c){if(this._ticket="",!(!t.get("showContent")||!t.get("show"))){var f=this._tooltipContent;f.setEnterable(t.get("enterable"));var h=t.get("formatter");l=l||t.get("position");var p=i,d=this._getNearestPoint([o,s],n,t.get("trigger"),t.get("borderColor")),g=d.color;if(h)if(Ce(h)){var m=t.ecModel.get("useUTC"),v=pe(n)?n[0]:n,_=v&&v.axisType&&v.axisType.indexOf("time")>=0;p=h,_&&(p=Vp(v.axisValue,p,m)),p=Rw(p,n,!0)}else if(He(h)){var y=Be(function(x,M){x===this._ticket&&(f.setContent(M,c,t,g,l),this._updatePosition(t,l,o,s,f,n,u))},this);this._ticket=a,p=h(n,a,y)}else p=h;f.setContent(p,c,t,g,l),f.show(t,g),this._updatePosition(t,l,o,s,f,n,u)}},e.prototype._getNearestPoint=function(t,i,n,a){if(n==="axis"||pe(i))return{color:a||(this._renderMode==="html"?"#fff":"none")};if(!pe(i))return{color:a||i.color||i.borderColor}},e.prototype._updatePosition=function(t,i,n,a,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();i=i||t.get("position");var f=o.getSize(),h=t.get("align"),p=t.get("verticalAlign"),d=l&&l.getBoundingRect().clone();if(l&&d.applyTransform(l.transform),He(i)&&(i=i([n,a],s,o.el,d,{viewSize:[u,c],contentSize:f.slice()})),pe(i))n=ze(i[0],u),a=ze(i[1],c);else if(qe(i)){var g=i;g.width=f[0],g.height=f[1];var m=xr(g,{width:u,height:c});n=m.x,a=m.y,h=null,p=null}else if(Ce(i)&&l){var v=RMe(i,d,f,t.get("borderWidth"));n=v[0],a=v[1]}else{var v=AMe(n,a,o,u,c,h?null:20,p?null:20);n=v[0],a=v[1]}if(h&&(n-=sK(h)?f[0]/2:h==="right"?f[0]:0),p&&(a-=sK(p)?f[1]/2:p==="bottom"?f[1]:0),uE(t)){var v=CMe(n,a,o,u,c);n=v[0],a=v[1]}o.moveTo(n,a)},e.prototype._updateContentNotChangedOnAxis=function(t,i){var n=this._lastDataByCoordSys,a=this._cbParamsList,o=!!n&&n.length===t.length;return o&&N(n,function(s,l){var u=s.dataByAxis||[],c=t[l]||{},f=c.dataByAxis||[];o=o&&u.length===f.length,o&&N(u,function(h,p){var d=f[p]||{},g=h.seriesDataIndices||[],m=d.seriesDataIndices||[];o=o&&h.value===d.value&&h.axisType===d.axisType&&h.axisId===d.axisId&&g.length===m.length,o&&N(g,function(v,_){var y=m[_];o=o&&v.seriesIndex===y.seriesIndex&&v.dataIndex===y.dataIndex}),a&&N(h.seriesDataIndices,function(v){var _=v.seriesIndex,y=i[_],x=a[_];y&&x&&x.data!==y.data&&(o=!1)})})}),this._lastDataByCoordSys=t,this._cbParamsList=i,!!o},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,i){zt.node||!i.getDom()||(zu(this,"_updatePosition"),this._tooltipContent.dispose(),Fx("itemTooltip",i))},e.type="tooltip",e}(er);function Gx(r,e,t){var i=e.ecModel,n;t?(n=new Zt(t,i,i),n=new Zt(e.option,n,i)):n=e;for(var a=r.length-1;a>=0;a--){var o=r[a];o&&(o instanceof Zt&&(o=o.get("tooltip",!0)),Ce(o)&&(o={formatter:o}),o&&(n=new Zt(o,n,i)))}return n}function oK(r,e){return r.dispatchAction||Be(e.dispatchAction,e)}function AMe(r,e,t,i,n,a,o){var s=t.getSize(),l=s[0],u=s[1];return a!=null&&(r+l+a+2>i?r-=l+a:r+=a),o!=null&&(e+u+o>n?e-=u+o:e+=o),[r,e]}function CMe(r,e,t,i,n){var a=t.getSize(),o=a[0],s=a[1];return r=Math.min(r+o,i)-o,e=Math.min(e+s,n)-s,r=Math.max(r,0),e=Math.max(e,0),[r,e]}function RMe(r,e,t,i){var n=t[0],a=t[1],o=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,c=e.height;switch(r){case"inside":s=e.x+u/2-n/2,l=e.y+c/2-a/2;break;case"top":s=e.x+u/2-n/2,l=e.y-a-o;break;case"bottom":s=e.x+u/2-n/2,l=e.y+c+o;break;case"left":s=e.x-n-o,l=e.y+c/2-a/2;break;case"right":s=e.x+u+o,l=e.y+c/2-a/2}return[s,l]}function sK(r){return r==="center"||r==="middle"}function LMe(r,e,t){var i=a_(r).queryOptionMap,n=i.keys()[0];if(!(!n||n==="series")){var a=_f(e,n,i.get(n),{useDefault:!1,enableAll:!1,enableNone:!1}),o=a.models[0];if(o){var s=t.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=rt(u).tooltipConfig;if(c&&c.name===r.name)return l=u,!0}),l)return{componentMainType:n,componentIndex:o.componentIndex,el:l}}}}var lK=EMe;function MO(r){It(nl),r.registerComponentModel(Kj),r.registerComponentView(lK),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Dr),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Dr)}var PMe=["rect","polygon","keep","clear"];function bO(r,e){var t=$t(r?r.brush:[]);if(t.length){var i=[];N(t,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(i=i.concat(u))});var n=r&&r.toolbox;pe(n)&&(n=n[0]),n||(n={feature:{}},r.toolbox=[n]);var a=n.feature||(n.feature={}),o=a.brush||(a.brush={}),s=o.type||(o.type=[]);s.push.apply(s,i),DMe(s),e&&!s.length&&s.push.apply(s,PMe)}}function DMe(r){var e={};N(r,function(t){e[t]=1}),r.length=0,N(e,function(t,i){r.push(i)})}var uK=N;function cK(r){if(r){for(var e in r)if(r.hasOwnProperty(e))return!0}}function Hx(r,e,t){var i={};return uK(e,function(a){var o=i[a]=n();uK(r[a],function(s,l){if(pi.isValidType(l)){var u={type:l,visual:s};t&&t(u,a),o[l]=new pi(u),l==="opacity"&&(u=Qe(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new pi(u))}})}),i;function n(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function cE(r,e,t){var i;N(t,function(n){e.hasOwnProperty(n)&&cK(e[n])&&(i=!0)}),i&&N(t,function(n){e.hasOwnProperty(n)&&cK(e[n])?r[n]=Qe(e[n]):delete r[n]})}function fK(r,e,t,i,n,a){var o={};N(r,function(f){var h=pi.prepareVisualTypes(e[f]);o[f]=h});var s;function l(f){return W_(t,s,f)}function u(f,h){UD(t,s,f,h)}a==null?t.each(c):t.each([a],c);function c(f,h){s=a==null?f:h;var p=t.getRawDataItem(s);if(!(p&&p.visualMap===!1))for(var d=i.call(n,f),g=e[d],m=o[d],v=0,_=m.length;v<_;v++){var y=m[v];g[y]&&g[y].applyVisual(f,l,u)}}}function hK(r,e,t,i){var n={};return N(r,function(a){var o=pi.prepareVisualTypes(e[a]);n[a]=o}),{progress:function(o,s){var l;i!=null&&(l=s.getDimensionIndex(i));function u(M){return W_(s,f,M)}function c(M,S){UD(s,f,M,S)}for(var f,h=s.getStore();(f=o.next())!=null;){var p=s.getRawDataItem(f);if(!(p&&p.visualMap===!1))for(var d=i!=null?h.get(l,f):f,g=t(d),m=e[g],v=n[g],_=0,y=v.length;_<y;_++){var x=v[_];m[x]&&m[x].applyVisual(d,u,c)}}}}}function mK(r){var e=r.brushType,t={point:function(i){return pK[e].point(i,t,r)},rect:function(i){return pK[e].rect(i,t,r)}};return t}var pK={lineX:dK(0),lineY:dK(1),rect:{point:function(r,e,t){return r&&t.boundingRect.contain(r[0],r[1])},rect:function(r,e,t){return r&&t.boundingRect.intersect(r)}},polygon:{point:function(r,e,t){return r&&t.boundingRect.contain(r[0],r[1])&&Fu(t.range,r[0],r[1])},rect:function(r,e,t){var i=t.range;if(!r||i.length<=1)return!1;var n=r.x,a=r.y,o=r.width,s=r.height,l=i[0];if(Fu(i,n,a)||Fu(i,n+o,a)||Fu(i,n,a+s)||Fu(i,n+o,a+s)||lt.create(r).contain(l[0],l[1])||nv(n,a,n+o,a,i)||nv(n,a,n,a+s,i)||nv(n+o,a,n+o,a+s,i)||nv(n,a+s,n+o,a+s,i))return!0}}};function dK(r){var e=["x","y"],t=["width","height"];return{point:function(i,n,a){if(i){var o=a.range,s=i[r];return Wx(s,o)}},rect:function(i,n,a){if(i){var o=a.range,s=[i[e[r]],i[e[r]]+i[t[r]]];return s[1]<s[0]&&s.reverse(),Wx(s[0],o)||Wx(s[1],o)||Wx(o[0],s)||Wx(o[1],s)}}}}function Wx(r,e){return e[0]<=r&&r<=e[1]}var vK=["inBrush","outOfBrush"],wO="__ecBrushSelect",TO="__ecInBrushSelectEvent";function EO(r){r.eachComponent({mainType:"brush"},function(e){var t=e.brushTargetManager=new Vx(e.option,r);t.setInputRanges(e.areas,r)})}function AO(r,e,t){var i=[],n,a;r.eachComponent({mainType:"brush"},function(o){t&&t.type==="takeGlobalCursor"&&o.setBrushOption(t.key==="brush"?t.brushOption:{brushType:!1})}),EO(r),r.eachComponent({mainType:"brush"},function(o,s){var l={brushId:o.id,brushIndex:s,brushName:o.name,areas:Qe(o.areas),selected:[]};i.push(l);var u=o.option,c=u.brushLink,f=[],h=[],p=[],d=!1;s||(n=u.throttleType,a=u.throttleDelay);var g=de(o.areas,function(M){var S=OMe[M.brushType],w=Ye({boundingRect:S?S(M):void 0},M);return w.selectors=mK(w),w}),m=Hx(o.option,vK,function(M){M.mappingMethod="fixed"});pe(c)&&N(c,function(M){f[M]=1});function v(M){return c==="all"||!!f[M]}function _(M){return!!M.length}r.eachSeries(function(M,S){var w=p[S]=[];M.subType==="parallel"?y(M,S):x(M,S,w)});function y(M,S){var w=M.coordinateSystem;d=d||w.hasAxisBrushed(),v(S)&&w.eachActiveState(M.getData(),function(T,C){T==="active"&&(h[C]=1)})}function x(M,S,w){if(!(!M.brushSelector||UMe(o,S))&&(N(g,function(C){o.brushTargetManager.controlSeries(C,M,r)&&w.push(C),d=d||_(w)}),v(S)&&_(w))){var T=M.getData();T.each(function(C){gK(M,w,T,C)&&(h[C]=1)})}}r.eachSeries(function(M,S){var w={seriesId:M.id,seriesIndex:S,seriesName:M.name,dataIndex:[]};l.selected.push(w);var T=p[S],C=M.getData(),b=v(S)?function(E){return h[E]?(w.dataIndex.push(C.getRawIndex(E)),"inBrush"):"outOfBrush"}:function(E){return gK(M,T,C,E)?(w.dataIndex.push(C.getRawIndex(E)),"inBrush"):"outOfBrush"};(v(S)?d:_(T))&&fK(vK,m,C,b)})}),IMe(e,n,a,i,t)}function IMe(r,e,t,i,n){if(n){var a=r.getZr();if(!a[TO]){a[wO]||(a[wO]=NMe);var o=os(a,wO,t,e);o(r,i)}}}function NMe(r,e){if(!r.isDisposed()){var t=r.getZr();t[TO]=!0,r.dispatchAction({type:"brushSelect",batch:e}),t[TO]=!1}}function gK(r,e,t,i){for(var n=0,a=e.length;n<a;n++){var o=e[n];if(r.brushSelector(i,t,o.selectors,o))return!0}}function UMe(r,e){var t=r.option.seriesIndex;return t!=null&&t!=="all"&&(pe(t)?dt(t,e)<0:e!==t)}var OMe={rect:function(r){return yK(r.range)},polygon:function(r){for(var e,t=r.range,i=0,n=t.length;i<n;i++){e=e||[[1/0,-1/0],[1/0,-1/0]];var a=t[i];a[0]<e[0][0]&&(e[0][0]=a[0]),a[0]>e[0][1]&&(e[0][1]=a[0]),a[1]<e[1][0]&&(e[1][0]=a[1]),a[1]>e[1][1]&&(e[1][1]=a[1])}return e&&yK(e)}};function yK(r){return new lt(r[0][0],r[1][0],r[0][1]-r[0][0],r[1][1]-r[1][0])}var zMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){this.ecModel=t,this.api=i,this.model,(this._brushController=new Wv(i.getZr())).on("brush",Be(this._onBrush,this)).mount()},e.prototype.render=function(t,i,n,a){this.model=t,this._updateController(t,i,n,a)},e.prototype.updateTransform=function(t,i,n,a){EO(i),this._updateController(t,i,n,a)},e.prototype.updateVisual=function(t,i,n,a){this.updateTransform(t,i,n,a)},e.prototype.updateView=function(t,i,n,a){this._updateController(t,i,n,a)},e.prototype._updateController=function(t,i,n,a){(!a||a.$from!==t.id)&&this._brushController.setPanels(t.brushTargetManager.makePanelOpts(n)).enableBrush(t.brushOption).updateCovers(t.areas.slice())},e.prototype.dispose=function(){this._brushController.dispose()},e.prototype._onBrush=function(t){var i=this.model.id,n=this.model.brushTargetManager.setOutputRanges(t.areas,this.ecModel);(!t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:i,areas:Qe(n),$from:i}),t.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:i,areas:Qe(n),$from:i})},e.type="brush",e}(er),_K=zMe;var FMe="#ddd",BMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.areas=[],t.brushOption={},t}return e.prototype.optionUpdated=function(t,i){var n=this.option;!i&&cE(n,t,["inBrush","outOfBrush"]);var a=n.inBrush=n.inBrush||{};n.outOfBrush=n.outOfBrush||{color:FMe},a.hasOwnProperty("liftZ")||(a.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=de(t,function(i){return xK(this.option,i)},this))},e.prototype.setBrushOption=function(t){this.brushOption=xK(this.option,t),this.brushType=this.brushOption.brushType},e.type="brush",e.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],e.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(210,219,238,0.3)",borderColor:"#D2DBEE"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},e}(Pt);function xK(r,e){return _t({brushType:r.brushType,brushMode:r.brushMode,transformable:r.transformable,brushStyle:new Zt(r.brushStyle).getItemStyle(),removeOnClick:r.removeOnClick,z:r.z},e,!0)}var SK=BMe;var kMe=["rect","polygon","lineX","lineY","keep","clear"],VMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,i,n){var a,o,s;i.eachComponent({mainType:"brush"},function(l){a=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=a,this._brushMode=o,N(t.get("type",!0),function(l){t.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===a)?"emphasis":"normal")})},e.prototype.updateView=function(t,i,n){this.render(t,i,n)},e.prototype.getIcons=function(){var t=this.model,i=t.get("icon",!0),n={};return N(t.get("type",!0),function(a){i[a]&&(n[a]=i[a])}),n},e.prototype.onclick=function(t,i,n){var a=this._brushType,o=this._brushMode;n==="clear"?(i.dispatchAction({type:"axisAreaSelect",intervals:[]}),i.dispatchAction({type:"brush",command:"clear",areas:[]})):i.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:n==="keep"?a:a===n?!1:n,brushMode:n==="keep"?o==="multiple"?"single":"multiple":o}})},e.getDefaultOption=function(t){var i={show:!0,type:kMe.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:t.getLocaleModel().get(["toolbox","brush","title"])};return i},e}($i),MK=VMe;function CO(r){r.registerComponentView(_K),r.registerComponentModel(SK),r.registerPreprocessor(bO),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,AO),r.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(e,t){t.eachComponent({mainType:"brush",query:e},function(i){i.setAreas(e.areas)})}),r.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},Dr),r.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},Dr),th("brush",MK)}var GMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(Pt),HMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){if(this.group.removeAll(),!!t.get("show")){var a=this.group,o=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=ft(t.get("textBaseline"),t.get("textVerticalAlign")),c=new Lt({style:fr(o,{text:t.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),f=c.getBoundingRect(),h=t.get("subtext"),p=new Lt({style:fr(s,{text:h,fill:s.getTextColor(),y:f.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),d=t.get("link"),g=t.get("sublink"),m=t.get("triggerEvent",!0);c.silent=!d&&!m,p.silent=!g&&!m,d&&c.on("click",function(){Gp(d,"_"+t.get("target"))}),g&&p.on("click",function(){Gp(g,"_"+t.get("subtarget"))}),rt(c).eventData=rt(p).eventData=m?{componentType:"title",componentIndex:t.componentIndex}:null,a.add(c),h&&a.add(p);var v=a.getBoundingRect(),_=t.getBoxLayoutParams();_.width=v.width,_.height=v.height;var y=xr(_,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),l==="middle"&&(l="center"),l==="right"?y.x+=y.width:l==="center"&&(y.x+=y.width/2)),u||(u=t.get("top")||t.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?y.y+=y.height:u==="middle"&&(y.y+=y.height/2),u=u||"top"),a.x=y.x,a.y=y.y,a.markRedraw();var x={align:l,verticalAlign:u};c.setStyle(x),p.setStyle(x),v=a.getBoundingRect();var M=y.margin,S=t.getItemStyle(["color","opacity"]);S.fill=t.get("backgroundColor");var w=new Et({shape:{x:v.x-M[3],y:v.y-M[0],width:v.width+M[1]+M[3],height:v.height+M[0]+M[2],r:t.get("borderRadius")},style:S,subPixelOptimize:!0,silent:!0});a.add(w)}},e.type="title",e}(er);function RO(r){r.registerComponentModel(GMe),r.registerComponentView(HMe)}var WMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode="box",t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n),this._initData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this._initData()},e.prototype.setCurrentIndex=function(t){t==null&&(t=this.option.currentIndex);var i=this._data.count();this.option.loop?t=(t%i+i)%i:(t>=i&&(t=i-1),t<0&&(t=0)),this.option.currentIndex=t},e.prototype.getCurrentIndex=function(){return this.option.currentIndex},e.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},e.prototype.setPlayState=function(t){this.option.autoPlay=!!t},e.prototype.getPlayState=function(){return!!this.option.autoPlay},e.prototype._initData=function(){var t=this.option,i=t.data||[],n=t.axisType,a=this._names=[],o;n==="category"?(o=[],N(i,function(u,c){var f=qr(zs(u),""),h;qe(u)?(h=Qe(u),h.value=c):h=c,o.push(h),a.push(f)})):o=i;var s={category:"ordinal",time:"time",value:"number"}[n]||"number",l=this._data=new ri([{name:"value",type:s}],this);l.initData(o,a)},e.prototype.getData=function(){return this._data},e.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},e.type="timeline",e.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},e}(Pt),LO=WMe;var bK=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline.slider",e.defaultOption=Hn(LO.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),e}(LO);br(bK,dv.prototype);var wK=bK;var XMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline",e}(er),TK=XMe;var YMe=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this,t,i,n)||this;return o.type=a||"value",o}return e.prototype.getLabelModel=function(){return this.model.getModel("label")},e.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},e}(pn),EK=YMe;var PO=Math.PI,AK=vt(),qMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){this.api=i},e.prototype.render=function(t,i,n){if(this.model=t,this.api=n,this.ecModel=i,this.group.removeAll(),t.get("show",!0)){var a=this._layout(t,n),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(a,t);t.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return Or("nameValue",{noName:!0,value:c})},N(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](a,o,l,t)},this),this._renderAxisLabel(a,s,l,t),this._position(a,t)}this._doPlayStop(),this._updateTicksStatus()},e.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},e.prototype.dispose=function(){this._clearTimer()},e.prototype._layout=function(t,i){var n=t.get(["label","position"]),a=t.get("orient"),o=jMe(t,i),s;n==null||n==="auto"?s=a==="horizontal"?o.y+o.height/2<i.getHeight()/2?"-":"+":o.x+o.width/2<i.getWidth()/2?"+":"-":Ce(n)?s={horizontal:{top:"-",bottom:"+"},vertical:{left:"-",right:"+"}}[a][n]:s=n;var l={horizontal:"center",vertical:s>=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:PO/2},f=a==="vertical"?o.height:o.width,h=t.getModel("controlStyle"),p=h.get("show",!0),d=p?h.get("itemSize"):0,g=p?h.get("itemGap"):0,m=d+g,v=t.get(["label","rotate"])||0;v=v*PO/180;var _,y,x,M=h.get("position",!0),S=p&&h.get("showPlayBtn",!0),w=p&&h.get("showPrevBtn",!0),T=p&&h.get("showNextBtn",!0),C=0,b=f;M==="left"||M==="bottom"?(S&&(_=[0,0],C+=m),w&&(y=[C,0],C+=m),T&&(x=[b-d,0],b-=m)):(S&&(_=[b-d,0],b-=m),w&&(y=[0,0],C+=m),T&&(x=[b-d,0],b-=m));var E=[C,b];return t.get("inverse")&&E.reverse(),{viewRect:o,mainLength:f,orient:a,rotation:c[a],labelRotation:v,labelPosOpt:s,labelAlign:t.get(["label","align"])||l[a],labelBaseline:t.get(["label","verticalAlign"])||t.get(["label","baseline"])||u[a],playPosition:_,prevBtnPosition:y,nextBtnPosition:x,axisExtent:E,controlSize:d,controlGap:g}},e.prototype._position=function(t,i){var n=this._mainGroup,a=this._labelGroup,o=t.viewRect;if(t.orient==="vertical"){var s=wi(),l=o.x,u=o.y+o.height;_n(s,s,[-l,-u]),Pa(s,s,-PO/2),_n(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),f=_(n.getBoundingRect()),h=_(a.getBoundingRect()),p=[n.x,n.y],d=[a.x,a.y];d[0]=p[0]=c[0][0];var g=t.labelPosOpt;if(g==null||Ce(g)){var m=g==="+"?0:1;y(p,f,c,1,m),y(d,h,c,1,1-m)}else{var m=g>=0?0:1;y(p,f,c,1,m),d[1]=p[1]+g}n.setPosition(p),a.setPosition(d),n.rotation=a.rotation=t.rotation,v(n),v(a);function v(x){x.originX=c[0][0]-x.x,x.originY=c[1][0]-x.y}function _(x){return[[x.x,x.x+x.width],[x.y,x.y+x.height]]}function y(x,M,S,w,T){x[w]+=S[w][T]-M[w][T]}},e.prototype._createAxis=function(t,i){var n=i.getData(),a=i.get("axisType"),o=ZMe(i,a);o.getTicks=function(){return n.mapArray(["value"],function(u){return{value:u}})};var s=n.getDataExtent("value");o.setExtent(s[0],s[1]),o.calcNiceTicks();var l=new EK("value",o,t.axisExtent,a);return l.model=i,l},e.prototype._createGroup=function(t){var i=this[t]=new Ze;return this.group.add(i),i},e.prototype._renderAxisLine=function(t,i,n,a){var o=n.getExtent();if(a.get(["lineStyle","show"])){var s=new Jr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:fe({lineCap:"round"},a.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});i.add(s);var l=this._progressLine=new Jr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ye({lineCap:"round",lineWidth:s.style.lineWidth},a.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});i.add(l)}},e.prototype._renderAxisTick=function(t,i,n,a){var o=this,s=a.getData(),l=n.scale.getTicks();this._tickSymbols=[],N(l,function(u){var c=n.dataToCoord(u.value),f=s.getItemModel(u.value),h=f.getModel("itemStyle"),p=f.getModel(["emphasis","itemStyle"]),d=f.getModel(["progress","itemStyle"]),g={x:c,y:0,onclick:Be(o._changeTimeline,o,u.value)},m=CK(f,h,i,g);m.ensureState("emphasis").style=p.getItemStyle(),m.ensureState("progress").style=d.getItemStyle(),Ul(m);var v=rt(m);f.get("tooltip")?(v.dataIndex=u.value,v.dataModel=a):v.dataIndex=v.dataModel=null,o._tickSymbols.push(m)})},e.prototype._renderAxisLabel=function(t,i,n,a){var o=this,s=n.getLabelModel();if(s.get("show")){var l=a.getData(),u=n.getViewLabels();this._tickLabels=[],N(u,function(c){var f=c.tickValue,h=l.getItemModel(f),p=h.getModel("label"),d=h.getModel(["emphasis","label"]),g=h.getModel(["progress","label"]),m=n.dataToCoord(c.tickValue),v=new Lt({x:m,y:0,rotation:t.labelRotation-t.rotation,onclick:Be(o._changeTimeline,o,f),silent:!1,style:fr(p,{text:c.formattedLabel,align:t.labelAlign,verticalAlign:t.labelBaseline})});v.ensureState("emphasis").style=fr(d),v.ensureState("progress").style=fr(g),i.add(v),Ul(v),AK(v).dataIndex=f,o._tickLabels.push(v)})}},e.prototype._renderControl=function(t,i,n,a){var o=t.controlSize,s=t.rotation,l=a.getModel("controlStyle").getItemStyle(),u=a.getModel(["emphasis","controlStyle"]).getItemStyle(),c=a.getPlayState(),f=a.get("inverse",!0);h(t.nextBtnPosition,"next",Be(this._changeTimeline,this,f?"-":"+")),h(t.prevBtnPosition,"prev",Be(this._changeTimeline,this,f?"+":"-")),h(t.playPosition,c?"stop":"play",Be(this._handlePlayClick,this,!c),!0);function h(p,d,g,m){if(p){var v=xn(ft(a.get(["controlStyle",d+"BtnSize"]),o),o),_=[0,-v/2,v,v],y=KMe(a,d+"Icon",_,{x:p[0],y:p[1],originX:o/2,originY:0,rotation:m?-s:0,rectHover:!0,style:l,onclick:g});y.ensureState("emphasis").style=u,i.add(y),Ul(y)}}},e.prototype._renderCurrentPointer=function(t,i,n,a){var o=a.getData(),s=a.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(f){f.draggable=!0,f.drift=Be(u._handlePointerDrag,u),f.ondragend=Be(u._handlePointerDragend,u),RK(f,u._progressLine,s,n,a,!0)},onUpdate:function(f){RK(f,u._progressLine,s,n,a)}};this._currentPointer=CK(l,l,this._mainGroup,{},this._currentPointer,c)},e.prototype._handlePlayClick=function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},e.prototype._handlePointerDrag=function(t,i,n){this._clearTimer(),this._pointerChangeTimeline([n.offsetX,n.offsetY])},e.prototype._handlePointerDragend=function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},e.prototype._pointerChangeTimeline=function(t,i){var n=this._toAxisCoord(t)[0],a=this._axis,o=Ti(a.getExtent().slice());n>o[1]&&(n=o[1]),n<o[0]&&(n=o[0]),this._currentPointer.x=n,this._currentPointer.markRedraw();var s=this._progressLine;s&&(s.shape.x2=n,s.dirty());var l=this._findNearestTick(n),u=this.model;(i||l!==u.getCurrentIndex()&&u.get("realtime"))&&this._changeTimeline(l)},e.prototype._doPlayStop=function(){var t=this;this._clearTimer(),this.model.getPlayState()&&(this._timer=setTimeout(function(){var i=t.model;t._changeTimeline(i.getCurrentIndex()+(i.get("rewind",!0)?-1:1))},this.model.get("playInterval")))},e.prototype._toAxisCoord=function(t){var i=this._mainGroup.getLocalTransform();return wn(t,i,!0)},e.prototype._findNearestTick=function(t){var i=this.model.getData(),n=1/0,a,o=this._axis;return i.each(["value"],function(s,l){var u=o.dataToCoord(s),c=Math.abs(u-t);c<n&&(n=c,a=l)}),a},e.prototype._clearTimer=function(){this._timer&&(clearTimeout(this._timer),this._timer=null)},e.prototype._changeTimeline=function(t){var i=this.model.getCurrentIndex();t==="+"?t=i+1:t==="-"&&(t=i-1),this.api.dispatchAction({type:"timelineChange",currentIndex:t,from:this.uid})},e.prototype._updateTicksStatus=function(){var t=this.model.getCurrentIndex(),i=this._tickSymbols,n=this._tickLabels;if(i)for(var a=0;a<i.length;a++)i&&i[a]&&i[a].toggleState("progress",a<t);if(n)for(var a=0;a<n.length;a++)n&&n[a]&&n[a].toggleState("progress",AK(n[a]).dataIndex<=t)},e.type="timeline.slider",e}(TK);function ZMe(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new ax({ordinalMeta:r.getCategories(),extent:[1/0,-1/0]});case"time":return new E1({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new Ya}}function jMe(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()},r.get("padding"))}function KMe(r,e,t,i){var n=i.style,a=Lu(r.get(["controlStyle",e]),i||{},new lt(t[0],t[1],t[2],t[3]));return n&&a.setStyle(n),a}function CK(r,e,t,i,n,a){var o=e.get("color");if(n)n.setColor(o),t.add(n),a&&a.onUpdate(n);else{var s=r.get("symbol");n=Sr(s,-1,-1,2,2,o),n.setStyle("strokeNoScale",!0),t.add(n),a&&a.onCreate(n)}var l=e.getItemStyle(["color"]);n.setStyle(l),i=_t({rectHover:!0,z2:100},i,!0);var u=Zs(r.get("symbolSize"));i.scaleX=u[0]/2,i.scaleY=u[1]/2;var c=bo(r.get("symbolOffset"),u);c&&(i.x=(i.x||0)+c[0],i.y=(i.y||0)+c[1]);var f=r.get("symbolRotate");return i.rotation=(f||0)*Math.PI/180||0,n.attr(i),n.updateTransform(),n}function RK(r,e,t,i,n,a){if(!r.dragging){var o=n.getModel("checkpointStyle"),s=i.dataToCoord(n.getData().get("value",t));if(a||!o.get("animation",!0))r.attr({x:s,y:0}),e&&e.attr({shape:{x2:s}});else{var l={duration:o.get("animationDuration",!0),easing:o.get("animationEasing",!0)};r.stopAnimation(null,!0),r.animateTo({x:s,y:0},l),e&&e.animateTo({shape:{x2:s}},l)}}}var LK=qMe;function PK(r){r.registerAction({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(e,t,i){var n=t.getComponent("timeline");return n&&e.currentIndex!=null&&(n.setCurrentIndex(e.currentIndex),!n.get("loop",!0)&&n.isIndexMax()&&n.getPlayState()&&(n.setPlayState(!1),i.dispatchAction({type:"timelinePlayChange",playState:!1,from:e.from}))),t.resetOption("timeline",{replaceMerge:n.get("replaceMerge",!0)}),Ye({currentIndex:n.option.currentIndex},e)}),r.registerAction({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(e,t){var i=t.getComponent("timeline");i&&e.playState!=null&&i.setPlayState(e.playState)})}function DO(r){var e=r&&r.timeline;pe(e)||(e=e?[e]:[]),N(e,function(t){t&&JMe(t)})}function JMe(r){var e=r.type,t={number:"value",time:"time"};if(t[e]&&(r.axisType=t[e],delete r.type),DK(r),dd(r,"controlPosition")){var i=r.controlStyle||(r.controlStyle={});dd(i,"position")||(i.position=r.controlPosition),i.position==="none"&&!dd(i,"show")&&(i.show=!1,delete i.position),delete r.controlPosition}N(r.data||[],function(n){qe(n)&&!pe(n)&&(!dd(n,"value")&&dd(n,"name")&&(n.value=n.name),DK(n))})}function DK(r){var e=r.itemStyle||(r.itemStyle={}),t=e.emphasis||(e.emphasis={}),i=r.label||r.label||{},n=i.normal||(i.normal={}),a={normal:1,emphasis:1};N(i,function(o,s){!a[s]&&!dd(n,s)&&(n[s]=o)}),t.label&&!dd(i,"emphasis")&&(i.emphasis=t.label,delete t.label)}function dd(r,e){return r.hasOwnProperty(e)}function IO(r){r.registerComponentModel(wK),r.registerComponentView(LK),r.registerSubTypeDefaulter("timeline",function(){return"slider"}),PK(r),r.registerPreprocessor(DO)}function md(r,e){if(!r)return!1;for(var t=pe(r)?r:[r],i=0;i<t.length;i++)if(t[i]&&t[i][e])return!0;return!1}function hE(r){yo(r,"label",["show"])}var pE=vt(),IK=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.createdBySelf=!1,t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n),this._mergeOption(t,n,!1,!0)},e.prototype.isAnimationEnabled=function(){if(zt.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},e.prototype.mergeOption=function(t,i){this._mergeOption(t,i,!1,!1)},e.prototype._mergeOption=function(t,i,n,a){var o=this.mainType;n||i.eachSeries(function(s){var l=s.get(this.mainType,!0),u=pE(s)[o];if(!l||!l.data){pE(s)[o]=null;return}u?u._mergeOption(l,i,!0):(a&&hE(l),N(l.data,function(c){c instanceof Array?(hE(c[0]),hE(c[1])):hE(c)}),u=this.createMarkerModelFromSeries(l,this,i),fe(u,{mainType:this.mainType,seriesIndex:s.seriesIndex,name:s.name,createdBySelf:!0}),u.__hostSeries=s),pE(s)[o]=u},this)},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=this.getRawValue(t),s=a.getName(t);return Or("section",{header:this.name,blocks:[Or("nameValue",{name:s,value:o,noName:!s,noValue:o==null})]})},e.prototype.getData=function(){return this._data},e.prototype.setData=function(t){this._data=t},e.getMarkerModelFromSeries=function(t,i){return pE(t)[i]},e.type="marker",e.dependencies=["series","grid","polar","geo"],e}(Pt);br(IK,dv.prototype);var ga=IK;var $Me=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markPoint",e.defaultOption={z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{show:!0,position:"inside"},itemStyle:{borderWidth:2},emphasis:{label:{show:!0}}},e}(ga),NK=$Me;function UO(r){return!(isNaN(parseFloat(r.x))&&isNaN(parseFloat(r.y)))}function QMe(r){return!isNaN(parseFloat(r.x))&&!isNaN(parseFloat(r.y))}function dE(r,e,t,i,n,a){var o=[],s=wo(e,i),l=s?e.getCalculationInfo("stackResultDimension"):i,u=vE(e,l,r),c=e.indicesOfNearest(l,u)[0];o[n]=e.get(t,c),o[a]=e.get(l,c);var f=e.get(i,c),h=Sn(e.get(i,c));return h=Math.min(h,20),h>=0&&(o[a]=+o[a].toFixed(h)),[o,f]}var NO={min:ot(dE,"min"),max:ot(dE,"max"),average:ot(dE,"average"),median:ot(dE,"median")};function ih(r,e){if(e){var t=r.getData(),i=r.coordinateSystem,n=i&&i.dimensions;if(!QMe(e)&&!pe(e.coord)&&pe(n)){var a=OO(e,t,i,r);if(e=Qe(e),e.type&&NO[e.type]&&a.baseAxis&&a.valueAxis){var o=dt(n,a.baseAxis.dim),s=dt(n,a.valueAxis.dim),l=NO[e.type](t,a.baseDataDim,a.valueDataDim,o,s);e.coord=l[0],e.value=l[1]}else e.coord=[e.xAxis!=null?e.xAxis:e.radiusAxis,e.yAxis!=null?e.yAxis:e.angleAxis]}if(e.coord==null||!pe(n))e.coord=[];else for(var u=e.coord,c=0;c<2;c++)NO[u[c]]&&(u[c]=vE(t,t.mapDimension(n[c]),u[c]));return e}}function OO(r,e,t,i){var n={};return r.valueIndex!=null||r.valueDim!=null?(n.valueDataDim=r.valueIndex!=null?e.getDimension(r.valueIndex):r.valueDim,n.valueAxis=t.getAxis(ebe(i,n.valueDataDim)),n.baseAxis=t.getOtherAxis(n.valueAxis),n.baseDataDim=e.mapDimension(n.baseAxis.dim)):(n.baseAxis=i.getBaseAxis(),n.valueAxis=t.getOtherAxis(n.baseAxis),n.baseDataDim=e.mapDimension(n.baseAxis.dim),n.valueDataDim=e.mapDimension(n.valueAxis.dim)),n}function ebe(r,e){var t=r.getData().getDimensionInfo(e);return t&&t.coordDim}function nh(r,e){return r&&r.containData&&e.coord&&!UO(e)?r.containData(e.coord):!0}function UK(r,e,t){return r&&r.containZone&&e.coord&&t.coord&&!UO(e)&&!UO(t)?r.containZone(e.coord,t.coord):!0}function mE(r,e){return r?function(t,i,n,a){var o=a<2?t.coord&&t.coord[a]:t.value;return as(o,e[a])}:function(t,i,n,a){return as(t.value,e[a])}}function vE(r,e,t){if(t==="average"){var i=0,n=0;return r.each(e,function(a,o){isNaN(a)||(i+=a,n++)}),i/n}else return t==="median"?r.getMedian(e):r.getDataExtent(e)[t==="max"?1:0]}var FO=vt(),tbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this.markerGroupMap=ke()},e.prototype.render=function(t,i,n){var a=this,o=this.markerGroupMap;o.each(function(s){FO(s).keep=!1}),i.eachSeries(function(s){var l=ga.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,i,n)}),o.each(function(s){!FO(s).keep&&a.group.remove(s.group)})},e.prototype.markKeep=function(t){FO(t).keep=!0},e.prototype.toggleBlurSeries=function(t,i){var n=this;N(t,function(a){var o=ga.getMarkerModelFromSeries(a,n.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(i?tw(l):m_(l))})}})},e.type="marker",e}(er),rg=tbe;function OK(r,e,t){var i=e.coordinateSystem;r.each(function(n){var a=r.getItemModel(n),o,s=ze(a.get("x"),t.getWidth()),l=ze(a.get("y"),t.getHeight());if(!isNaN(s)&&!isNaN(l))o=[s,l];else if(e.getMarkerPosition)o=e.getMarkerPosition(r.getValues(r.dimensions,n));else if(i){var u=r.get(i.dimensions[0],n),c=r.get(i.dimensions[1],n);o=i.dataToPoint([u,c])}isNaN(s)||(o[0]=s),isNaN(l)||(o[1]=l),r.setItemLayout(n,o)})}var rbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,n){i.eachSeries(function(a){var o=ga.getMarkerModelFromSeries(a,"markPoint");o&&(OK(o.getData(),a,n),this.markerGroupMap.get(a.id).updateLayout())},this)},e.prototype.renderSeries=function(t,i,n,a){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Xl),f=ibe(o,t,i);i.setData(f),OK(i.getData(),t,a),f.each(function(h){var p=f.getItemModel(h),d=p.getShallow("symbol"),g=p.getShallow("symbolSize"),m=p.getShallow("symbolRotate"),v=p.getShallow("symbolOffset"),_=p.getShallow("symbolKeepAspect");if(He(d)||He(g)||He(m)||He(v)){var y=i.getRawValue(h),x=i.getDataParams(h);He(d)&&(d=d(y,x)),He(g)&&(g=g(y,x)),He(m)&&(m=m(y,x)),He(v)&&(v=v(y,x))}var M=p.getModel("itemStyle").getItemStyle(),S=Bl(l,"color");M.fill||(M.fill=S),f.setItemVisual(h,{symbol:d,symbolSize:g,symbolRotate:m,symbolOffset:v,symbolKeepAspect:_,style:M})}),c.updateData(f),this.group.add(c.group),f.eachItemGraphicEl(function(h){h.traverse(function(p){rt(p).dataModel=i})}),this.markKeep(c),c.group.silent=i.get("silent")||t.get("silent")},e.type="markPoint",e}(rg);function ibe(r,e,t){var i;r?i=de(r&&r.dimensions,function(s){var l=e.getData().getDimensionInfo(e.getData().mapDimension(s))||{};return fe(fe({},l),{name:s,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var n=new ri(i,t),a=de(t.get("data"),ot(ih,e));r&&(a=Wt(a,ot(nh,r)));var o=mE(!!r,i);return n.initData(a,null,o),n}var zK=rbe;function BO(r){r.registerComponentModel(NK),r.registerComponentView(zK),r.registerPreprocessor(function(e){md(e.series,"markPoint")&&(e.markPoint=e.markPoint||{})})}var nbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markLine",e.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},e}(ga),FK=nbe;var gE=vt(),abe=function(r,e,t,i){var n=r.getData(),a;if(pe(i))a=i;else{var o=i.type;if(o==="min"||o==="max"||o==="average"||o==="median"||i.xAxis!=null||i.yAxis!=null){var s=void 0,l=void 0;if(i.yAxis!=null||i.xAxis!=null)s=e.getAxis(i.yAxis!=null?"y":"x"),l=Br(i.yAxis,i.xAxis);else{var u=OO(i,n,e,r);s=u.valueAxis;var c=x1(n,u.valueDataDim);l=vE(n,c,o)}var f=s.dim==="x"?0:1,h=1-f,p=Qe(i),d={coord:[]};p.type=null,p.coord=[],p.coord[h]=-1/0,d.coord[h]=1/0;var g=t.get("precision");g>=0&&Ct(l)&&(l=+l.toFixed(Math.min(g,20))),p.coord[f]=d.coord[f]=l,a=[p,d,{type:o,valueIndex:i.valueIndex,value:l}]}else a=[]}var m=[ih(r,a[0]),ih(r,a[1]),fe({},a[2])];return m[2].type=m[2].type||null,_t(m[2],m[0]),_t(m[2],m[1]),m};function yE(r){return!isNaN(r)&&!isFinite(r)}function BK(r,e,t,i){var n=1-r,a=i.dimensions[r];return yE(e[n])&&yE(t[n])&&e[r]===t[r]&&i.getAxis(a).containData(e[r])}function obe(r,e){if(r.type==="cartesian2d"){var t=e[0].coord,i=e[1].coord;if(t&&i&&(BK(1,t,i,r)||BK(0,t,i,r)))return!0}return nh(r,e[0])&&nh(r,e[1])}function kO(r,e,t,i,n){var a=i.coordinateSystem,o=r.getItemModel(e),s,l=ze(o.get("x"),n.getWidth()),u=ze(o.get("y"),n.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(i.getMarkerPosition)s=i.getMarkerPosition(r.getValues(r.dimensions,e));else{var c=a.dimensions,f=r.get(c[0],e),h=r.get(c[1],e);s=a.dataToPoint([f,h])}if(us(a,"cartesian2d")){var p=a.getAxis("x"),d=a.getAxis("y"),c=a.dimensions;yE(r.get(c[0],e))?s[0]=p.toGlobalCoord(p.getExtent()[t?0:1]):yE(r.get(c[1],e))&&(s[1]=d.toGlobalCoord(d.getExtent()[t?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}r.setItemLayout(e,s)}var sbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,n){i.eachSeries(function(a){var o=ga.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=gE(o).from,u=gE(o).to;l.each(function(c){kO(l,c,!0,a,n),kO(u,c,!1,a,n)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(a.id).updateLayout()}},this)},e.prototype.renderSeries=function(t,i,n,a){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Bv);this.group.add(c.group);var f=lbe(o,t,i),h=f.from,p=f.to,d=f.line;gE(i).from=h,gE(i).to=p,i.setData(d);var g=i.get("symbol"),m=i.get("symbolSize"),v=i.get("symbolRotate"),_=i.get("symbolOffset");pe(g)||(g=[g,g]),pe(m)||(m=[m,m]),pe(v)||(v=[v,v]),pe(_)||(_=[_,_]),f.from.each(function(x){y(h,x,!0),y(p,x,!1)}),d.each(function(x){var M=d.getItemModel(x).getModel("lineStyle").getLineStyle();d.setItemLayout(x,[h.getItemLayout(x),p.getItemLayout(x)]),M.stroke==null&&(M.stroke=h.getItemVisual(x,"style").fill),d.setItemVisual(x,{fromSymbolKeepAspect:h.getItemVisual(x,"symbolKeepAspect"),fromSymbolOffset:h.getItemVisual(x,"symbolOffset"),fromSymbolRotate:h.getItemVisual(x,"symbolRotate"),fromSymbolSize:h.getItemVisual(x,"symbolSize"),fromSymbol:h.getItemVisual(x,"symbol"),toSymbolKeepAspect:p.getItemVisual(x,"symbolKeepAspect"),toSymbolOffset:p.getItemVisual(x,"symbolOffset"),toSymbolRotate:p.getItemVisual(x,"symbolRotate"),toSymbolSize:p.getItemVisual(x,"symbolSize"),toSymbol:p.getItemVisual(x,"symbol"),style:M})}),c.updateData(d),f.line.eachItemGraphicEl(function(x){rt(x).dataModel=i,x.traverse(function(M){rt(M).dataModel=i})});function y(x,M,S){var w=x.getItemModel(M);kO(x,M,S,t,a);var T=w.getModel("itemStyle").getItemStyle();T.fill==null&&(T.fill=Bl(l,"color")),x.setItemVisual(M,{symbolKeepAspect:w.get("symbolKeepAspect"),symbolOffset:ft(w.get("symbolOffset",!0),_[S?0:1]),symbolRotate:ft(w.get("symbolRotate",!0),v[S?0:1]),symbolSize:ft(w.get("symbolSize"),m[S?0:1]),symbol:ft(w.get("symbol",!0),g[S?0:1]),style:T})}this.markKeep(c),c.group.silent=i.get("silent")||t.get("silent")},e.type="markLine",e}(rg);function lbe(r,e,t){var i;r?i=de(r&&r.dimensions,function(u){var c=e.getData().getDimensionInfo(e.getData().mapDimension(u))||{};return fe(fe({},c),{name:u,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var n=new ri(i,t),a=new ri(i,t),o=new ri([],t),s=de(t.get("data"),ot(abe,e,r,t));r&&(s=Wt(s,ot(obe,r)));var l=mE(!!r,i);return n.initData(de(s,function(u){return u[0]}),null,l),a.initData(de(s,function(u){return u[1]}),null,l),o.initData(de(s,function(u){return u[2]})),o.hasItemOption=!0,{from:n,to:a,line:o}}var kK=sbe;function VO(r){r.registerComponentModel(FK),r.registerComponentView(kK),r.registerPreprocessor(function(e){md(e.series,"markLine")&&(e.markLine=e.markLine||{})})}var ube=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markArea",e.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},e}(ga),VK=ube;var _E=vt(),cbe=function(r,e,t,i){var n=i[0],a=i[1];if(!(!n||!a)){var o=ih(r,n),s=ih(r,a),l=o.coord,u=s.coord;l[0]=Br(l[0],-1/0),l[1]=Br(l[1],-1/0),u[0]=Br(u[0],1/0),u[1]=Br(u[1],1/0);var c=bm([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function xE(r){return!isNaN(r)&&!isFinite(r)}function GK(r,e,t,i){var n=1-r;return xE(e[n])&&xE(t[n])}function fbe(r,e){var t=e.coord[0],i=e.coord[1],n={coord:t,x:e.x0,y:e.y0},a={coord:i,x:e.x1,y:e.y1};return us(r,"cartesian2d")?t&&i&&(GK(1,t,i,r)||GK(0,t,i,r))?!0:UK(r,n,a):nh(r,n)||nh(r,a)}function HK(r,e,t,i,n){var a=i.coordinateSystem,o=r.getItemModel(e),s,l=ze(o.get(t[0]),n.getWidth()),u=ze(o.get(t[1]),n.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(i.getMarkerPosition){var c=r.getValues(["x0","y0"],e),f=r.getValues(["x1","y1"],e),h=a.clampData(c),p=a.clampData(f),d=[];t[0]==="x0"?d[0]=h[0]>p[0]?f[0]:c[0]:d[0]=h[0]>p[0]?c[0]:f[0],t[1]==="y0"?d[1]=h[1]>p[1]?f[1]:c[1]:d[1]=h[1]>p[1]?c[1]:f[1],s=i.getMarkerPosition(d,t,!0)}else{var g=r.get(t[0],e),m=r.get(t[1],e),v=[g,m];a.clampData&&a.clampData(v,v),s=a.dataToPoint(v,!0)}if(us(a,"cartesian2d")){var _=a.getAxis("x"),y=a.getAxis("y"),g=r.get(t[0],e),m=r.get(t[1],e);xE(g)?s[0]=_.toGlobalCoord(_.getExtent()[t[0]==="x0"?0:1]):xE(m)&&(s[1]=y.toGlobalCoord(y.getExtent()[t[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var WK=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],hbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,n){i.eachSeries(function(a){var o=ga.getMarkerModelFromSeries(a,"markArea");if(o){var s=o.getData();s.each(function(l){var u=de(WK,function(f){return HK(s,l,f,a,n)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},e.prototype.renderSeries=function(t,i,n,a){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new Ze});this.group.add(c.group),this.markKeep(c);var f=pbe(o,t,i);i.setData(f),f.each(function(h){var p=de(WK,function(T){return HK(f,h,T,t,a)}),d=o.getAxis("x").scale,g=o.getAxis("y").scale,m=d.getExtent(),v=g.getExtent(),_=[d.parse(f.get("x0",h)),d.parse(f.get("x1",h))],y=[g.parse(f.get("y0",h)),g.parse(f.get("y1",h))];Ti(_),Ti(y);var x=!(m[0]>_[1]||m[1]<_[0]||v[0]>y[1]||v[1]<y[0]),M=!x;f.setItemLayout(h,{points:p,allClipped:M});var S=f.getItemModel(h).getModel("itemStyle").getItemStyle(),w=Bl(l,"color");S.fill||(S.fill=w,Ce(S.fill)&&(S.fill=hp(S.fill,.4))),S.stroke||(S.stroke=w),f.setItemVisual(h,"style",S)}),f.diff(_E(c).data).add(function(h){var p=f.getItemLayout(h);if(!p.allClipped){var d=new ti({shape:{points:p.points}});f.setItemGraphicEl(h,d),c.group.add(d)}}).update(function(h,p){var d=_E(c).data.getItemGraphicEl(p),g=f.getItemLayout(h);g.allClipped?d&&c.group.remove(d):(d?Dt(d,{shape:{points:g.points}},i,h):d=new ti({shape:{points:g.points}}),f.setItemGraphicEl(h,d),c.group.add(d))}).remove(function(h){var p=_E(c).data.getItemGraphicEl(h);c.group.remove(p)}).execute(),f.eachItemGraphicEl(function(h,p){var d=f.getItemModel(p),g=f.getItemVisual(p,"style");h.useStyle(f.getItemVisual(p,"style")),Ir(h,wr(d),{labelFetcher:i,labelDataIndex:p,defaultText:f.getName(p)||"",inheritColor:Ce(g.fill)?hp(g.fill,1):"#000"}),Gr(h,d),ar(h,null,null,d.get(["emphasis","disabled"])),rt(h).dataModel=i}),_E(c).data=f,c.group.silent=i.get("silent")||t.get("silent")},e.type="markArea",e}(rg);function pbe(r,e,t){var i,n,a=["x0","y0","x1","y1"];if(r){var o=de(r&&r.dimensions,function(u){var c=e.getData(),f=c.getDimensionInfo(c.mapDimension(u))||{};return fe(fe({},f),{name:u,ordinalMeta:null})});n=de(a,function(u,c){return{name:u,type:o[c%2].type}}),i=new ri(n,t)}else n=[{name:"value",type:"float"}],i=new ri(n,t);var s=de(t.get("data"),ot(cbe,e,r,t));r&&(s=Wt(s,ot(fbe,r)));var l=r?function(u,c,f,h){var p=u.coord[Math.floor(h/2)][h%2];return as(p,n[h])}:function(u,c,f,h){return as(u.value,n[h])};return i.initData(s,null,l),i.hasItemOption=!0,i}var XK=hbe;function GO(r){r.registerComponentModel(VK),r.registerComponentView(XK),r.registerPreprocessor(function(e){md(e.series,"markArea")&&(e.markArea=e.markArea||{})})}var dbe=function(r,e){if(e==="all")return{type:"all",title:r.getLocaleModel().get(["legend","selector","all"])};if(e==="inverse")return{type:"inverse",title:r.getLocaleModel().get(["legend","selector","inverse"])}},mbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),this._updateSelector(t)},e.prototype._updateSelector=function(t){var i=t.selector,n=this.ecModel;i===!0&&(i=t.selector=["all","inverse"]),pe(i)&&N(i,function(a,o){Ce(a)&&(a={type:a}),i[o]=_t(a,dbe(n,a.type))})},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&this.get("selectedMode")==="single"){for(var i=!1,n=0;n<t.length;n++){var a=t[n].get("name");if(this.isSelected(a)){this.select(a),i=!0;break}}!i&&this.select(t[0].get("name"))}},e.prototype._updateData=function(t){var i=[],n=[];t.eachRawSeries(function(l){var u=l.name;n.push(u);var c;if(l.legendVisualProvider){var f=l.legendVisualProvider,h=f.getAllNames();t.isSeriesFiltered(l)||(n=n.concat(h)),h.length?i=i.concat(h):c=!0}else c=!0;c&&Wm(l)&&i.push(l.name)}),this._availableNames=n;var a=this.get("data")||i,o=ke(),s=de(a,function(l){return(Ce(l)||Ct(l))&&(l={name:l}),o.get(l.name)?null:(o.set(l.name,!0),new Zt(l,this,this.ecModel))},this);this._data=Wt(s,function(l){return!!l})},e.prototype.getData=function(){return this._data},e.prototype.select=function(t){var i=this.option.selected,n=this.get("selectedMode");if(n==="single"){var a=this._data;N(a,function(o){i[o.get("name")]=!1})}i[t]=!0},e.prototype.unSelect=function(t){this.get("selectedMode")!=="single"&&(this.option.selected[t]=!1)},e.prototype.toggleSelected=function(t){var i=this.option.selected;i.hasOwnProperty(t)||(i[t]=!0),this[i[t]?"unSelect":"select"](t)},e.prototype.allSelect=function(){var t=this._data,i=this.option.selected;N(t,function(n){i[n.get("name",!0)]=!0})},e.prototype.inverseSelect=function(){var t=this._data,i=this.option.selected;N(t,function(n){var a=n.get("name",!0);i.hasOwnProperty(a)||(i[a]=!0),i[a]=!i[a]})},e.prototype.isSelected=function(t){var i=this.option.selected;return!(i.hasOwnProperty(t)&&!i[t])&&dt(this._availableNames,t)>=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Pt),Xx=mbe;var ig=ot,HO=N,SE=Ze,vbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!1,t}return e.prototype.init=function(){this.group.add(this._contentGroup=new SE),this.group.add(this._selectorGroup=new SE),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,i,n){var a=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!t.get("show",!0)){var o=t.get("align"),s=t.get("orient");(!o||o==="auto")&&(o=t.get("left")==="right"&&s==="vertical"?"right":"left");var l=t.get("selector",!0),u=t.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,t,i,n,l,s,u);var c=t.getBoxLayoutParams(),f={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),p=xr(c,f,h),d=this.layoutInner(t,o,p,a,l,u),g=xr(Ye({width:d.width,height:d.height},c),f,h);this.group.x=g.x-d.x,this.group.y=g.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=oE(d,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,i,n,a,o,s,l){var u=this.getContentGroup(),c=ke(),f=i.get("selectedMode"),h=[];n.eachRawSeries(function(p){!p.get("legendHoverLink")&&h.push(p.id)}),HO(i.getData(),function(p,d){var g=p.get("name");if(!this.newlineDisabled&&(g===""||g===`
  2229. `)){var m=new SE;m.newline=!0,u.add(m);return}var v=n.getSeriesByName(g)[0];if(!c.get(g))if(v){var _=v.getData(),y=_.getVisual("legendLineStyle")||{},x=_.getVisual("legendIcon"),M=_.getVisual("style"),S=this._createItem(v,g,d,p,i,t,y,M,x,f,a);S.on("click",ig(YK,g,null,a,h)).on("mouseover",ig(WO,v.name,null,a,h)).on("mouseout",ig(XO,v.name,null,a,h)),n.ssr&&S.eachChild(function(w){var T=rt(w);T.seriesIndex=v.seriesIndex,T.dataIndex=d,T.ssrType="legend"}),c.set(g,!0)}else n.eachRawSeries(function(w){if(!c.get(g)&&w.legendVisualProvider){var T=w.legendVisualProvider;if(!T.containName(g))return;var C=T.indexOfName(g),b=T.getItemVisual(C,"style"),E=T.getItemVisual(C,"legendIcon"),I=cn(b.fill);I&&I[3]===0&&(I[3]=.2,b=fe(fe({},b),{fill:Jo(I,"rgba")}));var R=this._createItem(w,g,d,p,i,t,{},b,E,f,a);R.on("click",ig(YK,null,g,a,h)).on("mouseover",ig(WO,null,g,a,h)).on("mouseout",ig(XO,null,g,a,h)),n.ssr&&R.eachChild(function(A){var D=rt(A);D.seriesIndex=w.seriesIndex,D.dataIndex=d,D.ssrType="legend"}),c.set(g,!0)}},this)},this),o&&this._createSelector(o,i,a,s,l)},e.prototype._createSelector=function(t,i,n,a,o){var s=this.getSelectorGroup();HO(t,function(u){var c=u.type,f=new Lt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect"})}});s.add(f);var h=i.getModel("selectorLabel"),p=i.getModel(["emphasis","selectorLabel"]);Ir(f,{normal:h,emphasis:p},{defaultText:u.title}),Ul(f)})},e.prototype._createItem=function(t,i,n,a,o,s,l,u,c,f,h){var p=t.visualDrawType,d=o.get("itemWidth"),g=o.get("itemHeight"),m=o.isSelected(i),v=a.get("symbolRotate"),_=a.get("symbolKeepAspect"),y=a.get("icon");c=y||c||"roundRect";var x=gbe(c,a,l,u,p,m,h),M=new SE,S=a.getModel("textStyle");if(He(t.getLegendIcon)&&(!y||y==="inherit"))M.add(t.getLegendIcon({itemWidth:d,itemHeight:g,icon:c,iconRotate:v,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:_}));else{var w=y==="inherit"&&t.getData().getVisual("symbol")?v==="inherit"?t.getData().getVisual("symbolRotate"):v:0;M.add(ybe({itemWidth:d,itemHeight:g,icon:c,iconRotate:w,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:_}))}var T=s==="left"?d+5:-5,C=s,b=o.get("formatter"),E=i;Ce(b)&&b?E=b.replace("{name}",i??""):He(b)&&(E=b(i));var I=m?S.getTextColor():a.get("inactiveColor");M.add(new Lt({style:fr(S,{text:E,x:T,y:g/2,fill:I,align:C,verticalAlign:"middle"},{inheritColor:I})}));var R=new Et({shape:M.getBoundingRect(),style:{fill:"transparent"}}),A=a.getModel("tooltip");return A.get("show")&&Gs({el:R,componentModel:o,itemName:i,itemTooltipOption:A.option}),M.add(R),M.eachChild(function(D){D.silent=!0}),R.silent=!f,this.getContentGroup().add(M),Ul(M),M.__legendDataIndex=n,M},e.prototype.layoutInner=function(t,i,n,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Xs(t.get("orient"),l,t.get("itemGap"),n.width,n.height);var c=l.getBoundingRect(),f=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Xs("horizontal",u,t.get("selectorItemGap",!0));var h=u.getBoundingRect(),p=[-h.x,-h.y],d=t.get("selectorButtonGap",!0),g=t.getOrient().index,m=g===0?"width":"height",v=g===0?"height":"width",_=g===0?"y":"x";s==="end"?p[g]+=c[m]+d:f[g]+=h[m]+d,p[1-g]+=c[v]/2-h[v]/2,u.x=p[0],u.y=p[1],l.x=f[0],l.y=f[1];var y={x:0,y:0};return y[m]=c[m]+d+h[m],y[v]=Math.max(c[v],h[v]),y[_]=Math.min(0,h[_]+p[1-g]),y}else return l.x=f[0],l.y=f[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(er);function gbe(r,e,t,i,n,a,o){function s(m,v){m.lineWidth==="auto"&&(m.lineWidth=v.lineWidth>0?2:0),HO(m,function(_,y){m[y]==="inherit"&&(m[y]=v[y])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),c=r.lastIndexOf("empty",0)===0?"fill":"stroke",f=l.getShallow("decal");u.decal=!f||f==="inherit"?i.decal:js(f,o),u.fill==="inherit"&&(u.fill=i[n]),u.stroke==="inherit"&&(u.stroke=i[c]),u.opacity==="inherit"&&(u.opacity=(n==="fill"?i:t).opacity),s(u,i);var h=e.getModel("lineStyle"),p=h.getLineStyle();if(s(p,t),u.fill==="auto"&&(u.fill=i.fill),u.stroke==="auto"&&(u.stroke=i.fill),p.stroke==="auto"&&(p.stroke=i.fill),!a){var d=e.get("inactiveBorderWidth"),g=u[c];u.lineWidth=d==="auto"?i.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),p.stroke=h.get("inactiveColor"),p.lineWidth=h.get("inactiveWidth")}return{itemStyle:u,lineStyle:p}}function ybe(r){var e=r.icon||"roundRect",t=Sr(e,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return t.setStyle(r.itemStyle),t.rotation=(r.iconRotate||0)*Math.PI/180,t.setOrigin([r.itemWidth/2,r.itemHeight/2]),e.indexOf("empty")>-1&&(t.style.stroke=t.style.fill,t.style.fill="#fff",t.style.lineWidth=2),t}function YK(r,e,t,i){XO(r,e,t,i),t.dispatchAction({type:"legendToggleSelect",name:r??e}),WO(r,e,t,i)}function qK(r){for(var e=r.getZr().storage.getDisplayList(),t,i=0,n=e.length;i<n&&!(t=e[i].states.emphasis);)i++;return t&&t.hoverLayer}function WO(r,e,t,i){qK(t)||t.dispatchAction({type:"highlight",seriesName:r,name:e,excludeSeriesId:i})}function XO(r,e,t,i){qK(t)||t.dispatchAction({type:"downplay",seriesName:r,name:e,excludeSeriesId:i})}var ME=vbe;function YO(r){var e=r.findComponents({mainType:"legend"});e&&e.length&&r.filterSeries(function(t){for(var i=0;i<e.length;i++)if(!e[i].isSelected(t.name))return!1;return!0})}function Yx(r,e,t){var i={},n=r==="toggleSelected",a;return t.eachComponent("legend",function(o){n&&a!=null?o[a?"select":"unSelect"](e.name):r==="allSelect"||r==="inverseSelect"?o[r]():(o[r](e.name),a=o.isSelected(e.name));var s=o.getData();N(s,function(l){var u=l.get("name");if(!(u===`
  2230. `||u==="")){var c=o.isSelected(u);i.hasOwnProperty(u)?i[u]=i[u]&&c:i[u]=c}})}),r==="allSelect"||r==="inverseSelect"?{selected:i}:{name:e.name,selected:i}}function ZK(r){r.registerAction("legendToggleSelect","legendselectchanged",ot(Yx,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",ot(Yx,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",ot(Yx,"inverseSelect")),r.registerAction("legendSelect","legendselected",ot(Yx,"select")),r.registerAction("legendUnSelect","legendunselected",ot(Yx,"unSelect"))}function bE(r){r.registerComponentModel(Xx),r.registerComponentView(ME),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,YO),r.registerSubTypeDefaulter("legend",function(){return"plain"}),ZK(r)}var _be=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},e.prototype.init=function(t,i,n){var a=is(t);r.prototype.init.call(this,t,i,n),jK(this,t,a)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),jK(this,this.option,t)},e.type="legend.scroll",e.defaultOption=Hn(Xx.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),e}(Xx);function jK(r,e,t){var i=r.getOrient(),n=[1,1];n[i.index]=0,Va(e,t,{type:"box",ignoreSize:!!n})}var KK=_be;var JK=Ze,qO=["width","height"],ZO=["x","y"],xbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!0,t._currentIndex=0,t}return e.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new JK),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new JK)},e.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},e.prototype.renderInner=function(t,i,n,a,o,s,l){var u=this;r.prototype.renderInner.call(this,t,i,n,a,o,s,l);var c=this._controllerGroup,f=i.get("pageIconSize",!0),h=pe(f)?f:[f,f];d("pagePrev",0);var p=i.getModel("pageTextStyle");c.add(new Lt({name:"pageText",style:{text:"xx/xx",fill:p.getTextColor(),font:p.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),d("pageNext",1);function d(g,m){var v=g+"DataIndex",_=Lu(i.get("pageIcons",!0)[i.getOrient().name][m],{onclick:Be(u._pageGo,u,v,i,a)},{x:-h[0]/2,y:-h[1]/2,width:h[0],height:h[1]});_.name=g,c.add(_)}},e.prototype.layoutInner=function(t,i,n,a,o,s){var l=this.getSelectorGroup(),u=t.getOrient().index,c=qO[u],f=ZO[u],h=qO[1-u],p=ZO[1-u];o&&Xs("horizontal",l,t.get("selectorItemGap",!0));var d=t.get("selectorButtonGap",!0),g=l.getBoundingRect(),m=[-g.x,-g.y],v=Qe(n);o&&(v[c]=n[c]-g[c]-d);var _=this._layoutContentAndController(t,a,v,u,c,h,p,f);if(o){if(s==="end")m[u]+=_[c]+d;else{var y=g[c]+d;m[u]-=y,_[f]-=y}_[c]+=g[c]+d,m[1-u]+=_[p]+_[h]/2-g[h]/2,_[h]=Math.max(_[h],g[h]),_[p]=Math.min(_[p],g[p]+m[1-u]),l.x=m[0],l.y=m[1],l.markRedraw()}return _},e.prototype._layoutContentAndController=function(t,i,n,a,o,s,l,u){var c=this.getContentGroup(),f=this._containerGroup,h=this._controllerGroup;Xs(t.get("orient"),c,t.get("itemGap"),a?n.width:null,a?null:n.height),Xs("horizontal",h,t.get("pageButtonItemGap",!0));var p=c.getBoundingRect(),d=h.getBoundingRect(),g=this._showController=p[o]>n[o],m=[-p.x,-p.y];i||(m[a]=c[u]);var v=[0,0],_=[-d.x,-d.y],y=ft(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(g){var x=t.get("pageButtonPosition",!0);x==="end"?_[a]+=n[o]-d[o]:v[a]+=d[o]+y}_[1-a]+=p[s]/2-d[s]/2,c.setPosition(m),f.setPosition(v),h.setPosition(_);var M={x:0,y:0};if(M[o]=g?n[o]:p[o],M[s]=Math.max(p[s],d[s]),M[l]=Math.min(0,d[l]+_[1-a]),f.__rectSize=n[o],g){var S={x:0,y:0};S[o]=Math.max(n[o]-d[o]-y,0),S[s]=M[s],f.setClipPath(new Et({shape:S})),f.__rectSize=S[o]}else h.eachChild(function(T){T.attr({invisible:!0,silent:!0})});var w=this._getPageInfo(t);return w.pageIndex!=null&&Dt(c,{x:w.contentPosition[0],y:w.contentPosition[1]},g?t:null),this._updatePageInfoView(t,w),M},e.prototype._pageGo=function(t,i,n){var a=this._getPageInfo(i)[t];a!=null&&n.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:i.id})},e.prototype._updatePageInfoView=function(t,i){var n=this._controllerGroup;N(["pagePrev","pageNext"],function(c){var f=c+"DataIndex",h=i[f]!=null,p=n.childOfName(c);p&&(p.setStyle("fill",h?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),p.cursor=h?"pointer":"default")});var a=n.childOfName("pageText"),o=t.get("pageFormatter"),s=i.pageIndex,l=s!=null?s+1:0,u=i.pageCount;a&&o&&a.setStyle("text",Ce(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(t){var i=t.get("scrollDataIndex",!0),n=this.getContentGroup(),a=this._containerGroup.__rectSize,o=t.getOrient().index,s=qO[o],l=ZO[o],u=this._findTargetItemIndex(i),c=n.children(),f=c[u],h=c.length,p=h?1:0,d={contentPosition:[n.x,n.y],pageCount:p,pageIndex:p-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!f)return d;var g=x(f);d.contentPosition[o]=-g.s;for(var m=u+1,v=g,_=g,y=null;m<=h;++m)y=x(c[m]),(!y&&_.e>v.s+a||y&&!M(y,v.s))&&(_.i>v.i?v=_:v=y,v&&(d.pageNextDataIndex==null&&(d.pageNextDataIndex=v.i),++d.pageCount)),_=y;for(var m=u-1,v=g,_=g,y=null;m>=-1;--m)y=x(c[m]),(!y||!M(_,y.s))&&v.i<_.i&&(_=v,d.pagePrevDataIndex==null&&(d.pagePrevDataIndex=v.i),++d.pageCount,++d.pageIndex),v=y;return d;function x(S){if(S){var w=S.getBoundingRect(),T=w[l]+S[l];return{s:T,e:T+w[s],i:S.__legendDataIndex}}}function M(S,w){return S.e>=w&&S.s<=w+a}},e.prototype._findTargetItemIndex=function(t){if(!this._showController)return 0;var i,n=this.getContentGroup(),a;return n.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===t&&(i=s)}),i??a},e.type="legend.scroll",e}(ME),$K=xbe;function jO(r){r.registerAction("legendScroll","legendscroll",function(e,t){var i=e.scrollDataIndex;i!=null&&t.eachComponent({mainType:"legend",subType:"scroll",query:e},function(n){n.setScrollDataIndex(i)})})}function QK(r){It(bE),r.registerComponentModel(KK),r.registerComponentView($K),jO(r)}function KO(r){It(bE),It(QK)}var Sbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.inside",e.defaultOption=Hn(eh.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}(eh),eJ=Sbe;var JO=vt();function tJ(r,e,t){JO(r).coordSysRecordMap.each(function(i){var n=i.dataZoomInfoMap.get(e.uid);n&&(n.getRange=t)})}function rJ(r,e){for(var t=JO(r).coordSysRecordMap,i=t.keys(),n=0;n<i.length;n++){var a=i[n],o=t.get(a),s=o.dataZoomInfoMap;if(s){var l=e.uid,u=s.get(l);u&&(s.removeKey(l),s.keys().length||iJ(t,o))}}}function iJ(r,e){if(e){r.removeKey(e.model.uid);var t=e.controller;t&&t.dispose()}}function Mbe(r,e){var t={model:e,containsPoint:ot(wbe,e),dispatchAction:ot(bbe,r),dataZoomInfoMap:null,controller:null},i=t.controller=new jl(r.getZr());return N(["pan","zoom","scrollMove"],function(n){i.on(n,function(a){var o=[];t.dataZoomInfoMap.each(function(s){if(a.isAvailableBehavior(s.model.option)){var l=(s.getRange||{})[n],u=l&&l(s.dzReferCoordSysInfo,t.model.mainType,t.controller,a);!s.model.get("disabled",!0)&&u&&o.push({dataZoomId:s.model.id,start:u[0],end:u[1]})}}),o.length&&t.dispatchAction(o)})}),t}function bbe(r,e){r.isDisposed()||r.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:e})}function wbe(r,e,t,i){return r.coordinateSystem.containPoint([t,i])}function Tbe(r){var e,t="type_",i={type_true:2,type_move:1,type_false:0,type_undefined:-1},n=!0;return r.each(function(a){var o=a.model,s=o.get("disabled",!0)?!1:o.get("zoomLock",!0)?"move":!0;i[t+s]>i[t+e]&&(e=s),n=n&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!n}}}function nJ(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var i=JO(t),n=i.coordSysRecordMap||(i.coordSysRecordMap=ke());n.each(function(a){a.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=nE(a);N(o.infoList,function(s){var l=s.model.uid,u=n.get(l)||n.set(l,Mbe(t,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=ke());c.set(a.uid,{dzReferCoordSysInfo:s,model:a,getRange:null})})}),n.each(function(a){var o=a.controller,s,l=a.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){iJ(n,a);return}var c=Tbe(l);o.enable(c.controlType,c.opt),o.setPointerChecker(a.containsPoint),os(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var Abe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return e.prototype.render=function(t,i,n){if(r.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),tJ(n,t,{pan:Be($O.pan,this),zoom:Be($O.zoom,this),scrollMove:Be($O.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){rJ(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(Qv),$O={zoom:function(r,e,t,i){var n=this.range,a=n.slice(),o=r.axisModels[0];if(o){var s=QO[e](null,[i.originX,i.originY],o,t,r),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/i.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Za(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,n[0]!==a[0]||n[1]!==a[1])return a}},pan:aJ(function(r,e,t,i,n,a){var o=QO[i]([a.oldX,a.oldY],[a.newX,a.newY],e,n,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:aJ(function(r,e,t,i,n,a){var o=QO[i]([0,0],[a.scrollDelta,a.scrollDelta],e,n,t);return o.signal*(r[1]-r[0])*a.scrollDelta})};function aJ(r){return function(e,t,i,n){var a=this.range,o=a.slice(),s=e.axisModels[0];if(s){var l=r(o,s,e,t,i,n);if(Za(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var QO={grid:function(r,e,t,i,n){var a=t.axis,o={},s=n.model.coordinateSystem.getRect();return r=r||[0,0],a.dim==="x"?(o.pixel=e[0]-r[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(r,e,t,i,n){var a=t.axis,o={},s=n.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return r=r?s.pointToCoord(r):[0,0],e=s.pointToCoord(e),t.mainType==="radiusAxis"?(o.pixel=e[0]-r[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=a.inverse?-1:1),o},singleAxis:function(r,e,t,i,n){var a=t.axis,o=n.model.coordinateSystem.getRect(),s={};return r=r||[0,0],a.orient==="horizontal"?(s.pixel=e[0]-r[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=e[1]-r[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}},oJ=Abe;function qx(r){pd(r),r.registerComponentModel(eJ),r.registerComponentView(oJ),nJ(r)}var Cbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=Hn(eh.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),e}(eh),sJ=Cbe;var Zx=Et,lJ=7,Rbe=1,e3=30,Lbe=7,jx="horizontal",uJ="vertical",Pbe=5,Dbe=["line","bar","candlestick","scatter"],Ibe={easing:"cubicOut",duration:100,delay:0},Nbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._displayables={},t}return e.prototype.init=function(t,i){this.api=i,this._onBrush=Be(this._onBrush,this),this._onBrushEnd=Be(this._onBrushEnd,this)},e.prototype.render=function(t,i,n,a){if(r.prototype.render.apply(this,arguments),os(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),t.get("show")===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){zu(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var i=this._displayables.sliderGroup=new Ze;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(i),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,i=this.api,n=t.get("brushSelect"),a=n?Lbe:0,o=this._findCoordRect(),s={width:i.getWidth(),height:i.getHeight()},l=this._orient===jx?{right:s.width-o.x-o.width,top:s.height-e3-lJ-a,width:o.width,height:e3}:{right:lJ,top:o.y,width:e3,height:o.height},u=is(t.option);N(["right","top","width","height"],function(f){u[f]==="ph"&&(u[f]=l[f])});var c=xr(u,s);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===uJ&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,i=this._location,n=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(n===jx&&!o?{scaleY:l?1:-1,scaleX:1}:n===jx&&o?{scaleY:l?1:-1,scaleX:-1}:n===uJ&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=t.getBoundingRect([s]);t.x=i.x-u.x,t.y=i.y-u.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,i=this._size,n=this._displayables.sliderGroup,a=t.get("brushSelect");n.add(new Zx({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new Zx({shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:"transparent"},z2:0,onclick:Be(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),n.add(o)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!t)return;var i=this._size,n=this._shadowSize||[],a=t.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():t.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||i[0]!==n[0]||i[1]!==n[1]){var f=o.getDataExtent(l),h=(f[1]-f[0])*.3;f=[f[0]-h,f[1]+h];var p=[0,i[1]],d=[0,i[0]],g=[[i[0],0],[0,0]],m=[],v=d[1]/(o.count()-1),_=0,y=Math.round(o.count()/i[0]),x;o.each([l],function(C,b){if(y>0&&b%y){_+=v;return}var E=C==null||isNaN(C)||C==="",I=E?0:rr(C,f,p,!0);E&&!x&&b?(g.push([g[g.length-1][0],0]),m.push([m[m.length-1][0],0])):!E&&x&&(g.push([_,0]),m.push([_,0])),g.push([_,I]),m.push([_,I]),_+=v,x=E}),u=this._shadowPolygonPts=g,c=this._shadowPolylinePts=m}this._shadowData=o,this._shadowDim=l,this._shadowSize=[i[0],i[1]];var M=this.dataZoomModel;function S(C){var b=M.getModel(C?"selectedDataBackground":"dataBackground"),E=new Ze,I=new ti({shape:{points:u},segmentIgnoreThreshold:1,style:b.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),R=new Qr({shape:{points:c},segmentIgnoreThreshold:1,style:b.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return E.add(I),E.add(R),E}for(var w=0;w<3;w++){var T=S(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,i=t.get("showDataShadow");if(i!==!1){var n,a=this.ecModel;return t.eachTargetAxis(function(o,s){var l=t.getAxisProxy(o,s).getTargetSeriesModels();N(l,function(u){if(!n&&!(i!==!0&&dt(Dbe,u.get("type"))<0)){var c=a.getComponent(ms(o),s).axis,f=Ube(o),h,p=u.coordinateSystem;f!=null&&p.getOtherAxis&&(h=p.getOtherAxis(c).inverse),f=u.getData().mapDimension(f),n={thisAxis:c,series:u,thisDim:o,otherDim:f,otherAxisInverse:h}}},this)},this),n}},e.prototype._renderHandle=function(){var t=this.group,i=this._displayables,n=i.handles=[null,null],a=i.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,f=l.get("brushSelect"),h=i.filler=new Zx({silent:f,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(h),o.add(new Zx({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:Rbe,fill:"rgba(0,0,0,0)"}})),N([0,1],function(y){var x=l.get("handleIcon");!X_[x]&&x.indexOf("path://")<0&&x.indexOf("image://")<0&&(x="path://"+x);var M=Sr(x,-1,0,2,2,null,!0);M.attr({cursor:cJ(this._orient),draggable:!0,drift:Be(this._onDragMove,this,y),ondragend:Be(this._onDragEnd,this),onmouseover:Be(this._showDataInfo,this,!0),onmouseout:Be(this._showDataInfo,this,!1),z2:5});var S=M.getBoundingRect(),w=l.get("handleSize");this._handleHeight=ze(w,this._size[1]),this._handleWidth=S.width/S.height*this._handleHeight,M.setStyle(l.getModel("handleStyle").getItemStyle()),M.style.strokeNoScale=!0,M.rectHover=!0,M.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Ul(M);var T=l.get("handleColor");T!=null&&(M.style.fill=T),o.add(n[y]=M);var C=l.getModel("textStyle");t.add(a[y]=new Lt({silent:!0,invisible:!0,style:fr(C,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:C.getTextColor(),font:C.getFont()}),z2:10}))},this);var p=h;if(f){var d=ze(l.get("moveHandleSize"),s[1]),g=i.moveHandle=new Et({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:d}}),m=d*.8,v=i.moveHandleIcon=Sr(l.get("moveHandleIcon"),-m/2,-m/2,m,m,"#fff",!0);v.silent=!0,v.y=s[1]+d/2-.5,g.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(d,10));p=i.moveZone=new Et({invisible:!0,shape:{y:s[1]-_,height:d+_}}),p.on("mouseover",function(){u.enterEmphasis(g)}).on("mouseout",function(){u.leaveEmphasis(g)}),o.add(g),o.add(v),o.add(p)}p.attr({draggable:!0,cursor:cJ(this._orient),drift:Be(this._onDragMove,this,"all"),ondragstart:Be(this._showDataInfo,this,!0),ondragend:Be(this._onDragEnd,this),onmouseover:Be(this._showDataInfo,this,!0),onmouseout:Be(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),i=this._getViewExtent();this._handleEnds=[rr(t[0],[0,100],i,!0),rr(t[1],[0,100],i,!0)]},e.prototype._updateInterval=function(t,i){var n=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=n.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Za(i,a,o,n.get("zoomLock")?"all":t,s.minSpan!=null?rr(s.minSpan,l,o,!0):null,s.maxSpan!=null?rr(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Ti([rr(a[0],o,l,!0),rr(a[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},e.prototype._updateView=function(t){var i=this._displayables,n=this._handleEnds,a=Ti(n.slice()),o=this._size;N([0,1],function(p){var d=i.handles[p],g=this._handleHeight;d.attr({scaleX:g/2,scaleY:g/2,x:n[p]+(p?-1:1),y:o[1]/2-g/2})},this),i.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};i.moveHandle&&(i.moveHandle.setShape(s),i.moveZone.setShape(s),i.moveZone.getBoundingRect(),i.moveHandleIcon&&i.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=i.dataShadowSegs,u=[0,a[0],a[1],o[0]],c=0;c<l.length;c++){var f=l[c],h=f.getClipPath();h||(h=new Et,f.setClipPath(h)),h.setShape({x:u[c],y:0,width:u[c+1]-u[c],height:o[1]})}this._updateDataInfo(t)},e.prototype._updateDataInfo=function(t){var i=this.dataZoomModel,n=this._displayables,a=n.handleLabels,o=this._orient,s=["",""];if(i.get("showDetail")){var l=i.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,c=this._range,f=t?l.calculateDataWindow({start:c[0],end:c[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(f[0],u),this._formatLabel(f[1],u)]}}var h=Ti(this._handleEnds.slice());p.call(this,0),p.call(this,1);function p(d){var g=Vs(n.handles[d].parent,this.group),m=zp(d===0?"right":"left",g),v=this._handleWidth/2+Pbe,_=wn([h[d]+(d===0?-v:v),this._size[1]/2],g);a[d].setStyle({x:_[0],y:_[1],verticalAlign:o===jx?"middle":m,align:o===jx?m:"center",text:s[d]})}},e.prototype._formatLabel=function(t,i){var n=this.dataZoomModel,a=n.get("labelFormatter"),o=n.get("labelPrecision");(o==null||o==="auto")&&(o=i.getPixelPrecision());var s=t==null||isNaN(t)?"":i.type==="category"||i.type==="time"?i.scale.getLabel({value:Math.round(t)}):t.toFixed(Math.min(o,20));return He(a)?a(t,s):Ce(a)?a.replace("{value}",s):s},e.prototype._showDataInfo=function(t){t=this._dragging||t;var i=this._displayables,n=i.handleLabels;n[0].attr("invisible",!t),n[1].attr("invisible",!t),i.moveHandle&&this.api[t?"enterEmphasis":"leaveEmphasis"](i.moveHandle,1)},e.prototype._onDragMove=function(t,i,n,a){this._dragging=!0,Ra(a.event);var o=this._displayables.sliderGroup.getLocalTransform(),s=wn([i,n],o,!0),l=this._updateInterval(t,s[0]),u=this.dataZoomModel.get("realtime");this._updateView(!u),l&&u&&this._dispatchZoomAction(!0)},e.prototype._onDragEnd=function(){this._dragging=!1,this._showDataInfo(!1);var t=this.dataZoomModel.get("realtime");!t&&this._dispatchZoomAction(!1)},e.prototype._onClickPanel=function(t){var i=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(t.offsetX,t.offsetY);if(!(n[0]<0||n[0]>i[0]||n[1]<0||n[1]>i[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",n[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var i=t.offsetX,n=t.offsetY;this._brushStart=new Nt(i,n),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var i=this._displayables.brushRect;if(this._brushing=!1,!!i){i.attr("ignore",!0);var n=i.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(n.width)<5)){var o=this._getViewExtent(),s=[0,100];this._range=Ti([rr(n.x,o,s,!0),rr(n.x+n.width,o,s,!0)]),this._handleEnds=[n.x,n.x+n.width],this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(Ra(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,i){var n=this._displayables,a=this.dataZoomModel,o=n.brushRect;o||(o=n.brushRect=new Zx({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(t,i),c=l.transformCoordToLocal(s.x,s.y),f=this._size;u[0]=Math.max(Math.min(f[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:f[1]})},e.prototype._dispatchZoomAction=function(t){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?Ibe:null,start:i[0],end:i[1]})},e.prototype._findCoordRect=function(){var t,i=nE(this.dataZoomModel).infoList;if(!t&&i.length){var n=i[0].model.coordinateSystem;t=n.getRect&&n.getRect()}if(!t){var a=this.api.getWidth(),o=this.api.getHeight();t={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return t},e.type="dataZoom.slider",e}(Qv);function Ube(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function cJ(r){return r==="vertical"?"ns-resize":"ew-resize"}var fJ=Nbe;function Kx(r){r.registerComponentModel(sJ),r.registerComponentView(fJ),pd(r)}function t3(r){It(qx),It(Kx)}var Obe={get:function(r,e,t){var i=Qe((zbe[r]||{})[e]);return t&&pe(i)?i[i.length-1]:i}},zbe={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},wE=Obe;var hJ=pi.mapVisual,Fbe=pi.eachVisual,Bbe=pe,pJ=N,kbe=Ti,Vbe=rr,Gbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.stateList=["inRange","outOfRange"],t.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],t.layoutMode={type:"box",ignoreSize:!0},t.dataBound=[-1/0,1/0],t.targetVisuals={},t.controllerVisuals={},t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n)},e.prototype.optionUpdated=function(t,i){var n=this.option;!i&&cE(n,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var i=this.stateList;t=Be(t,this),this.controllerVisuals=Hx(this.option.controller,i,t),this.targetVisuals=Hx(this.option.target,i,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesIndex,i=[];return t==null||t==="all"?this.ecModel.eachSeries(function(n,a){i.push(a)}):i=$t(t),i},e.prototype.eachTargetSeries=function(t,i){N(this.getTargetSeriesIndices(),function(n){var a=this.ecModel.getSeriesByIndex(n);a&&t.call(i,a)},this)},e.prototype.isTargetSeries=function(t){var i=!1;return this.eachTargetSeries(function(n){n===t&&(i=!0)}),i},e.prototype.formatValueText=function(t,i,n){var a=this.option,o=a.precision,s=this.dataBound,l=a.formatter,u;n=n||["<",">"],pe(t)&&(t=t.slice(),u=!0);var c=i?t:u?[f(t[0]),f(t[1])]:f(t);if(Ce(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(He(l))return u?l(t[0],t[1]):l(t);if(u)return t[0]===s[0]?n[0]+" "+c[1]:t[1]===s[1]?n[1]+" "+c[0]:c[0]+" - "+c[1];return c;function f(h){return h===s[0]?"min":h===s[1]?"max":(+h).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,i=kbe([t.min,t.max]);this._dataExtent=i},e.prototype.getDataDimensionIndex=function(t){var i=this.option.dimension;if(i!=null)return t.getDimensionIndex(i);for(var n=t.dimensions,a=n.length-1;a>=0;a--){var o=n[a],s=t.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,i=this.option,n={inRange:i.inRange,outOfRange:i.outOfRange},a=i.target||(i.target={}),o=i.controller||(i.controller={});_t(a,n),_t(o,n);var s=this.isCategory();l.call(this,a),l.call(this,o),u.call(this,a,"inRange","outOfRange"),c.call(this,o);function l(f){Bbe(i.color)&&!f.inRange&&(f.inRange={color:i.color.slice().reverse()}),f.inRange=f.inRange||{color:t.get("gradientColor")}}function u(f,h,p){var d=f[h],g=f[p];d&&!g&&(g=f[p]={},pJ(d,function(m,v){if(pi.isValidType(v)){var _=wE.get(v,"inactive",s);_!=null&&(g[v]=_,v==="color"&&!g.hasOwnProperty("opacity")&&!g.hasOwnProperty("colorAlpha")&&(g.opacity=[0,0]))}}))}function c(f){var h=(f.inRange||{}).symbol||(f.outOfRange||{}).symbol,p=(f.inRange||{}).symbolSize||(f.outOfRange||{}).symbolSize,d=this.get("inactiveColor"),g=this.getItemSymbol(),m=g||"roundRect";pJ(this.stateList,function(v){var _=this.itemSize,y=f[v];y||(y=f[v]={color:s?d:[d]}),y.symbol==null&&(y.symbol=h&&Qe(h)||(s?m:[m])),y.symbolSize==null&&(y.symbolSize=p&&Qe(p)||(s?_[0]:[_[0],_[0]])),y.symbol=hJ(y.symbol,function(S){return S==="none"?m:S});var x=y.symbolSize;if(x!=null){var M=-1/0;Fbe(x,function(S){S>M&&(M=S)}),y.symbolSize=hJ(x,function(S){return Vbe(S,[0,M],[0,_[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},e}(Pt),ng=Gbe;var dJ=[20,140],Hbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(n){n.mappingMethod="linear",n.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){r.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=dJ[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=dJ[1])},e.prototype._resetRange=function(){var t=this.getExtent(),i=this.option.range;!i||i.auto?(t.auto=1,this.option.range=t):pe(i)&&(i[0]>i[1]&&i.reverse(),i[0]=Math.max(i[0],t[0]),i[1]=Math.min(i[1],t[1]))},e.prototype.completeVisualOption=function(){r.prototype.completeVisualOption.apply(this,arguments),N(this.stateList,function(t){var i=this.option.controller[t].symbolSize;i&&i[0]!==i[1]&&(i[0]=i[1]/3)},this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),i=Ti((this.get("range")||[]).slice());return i[0]>t[1]&&(i[0]=t[1]),i[1]>t[1]&&(i[1]=t[1]),i[0]<t[0]&&(i[0]=t[0]),i[1]<t[0]&&(i[1]=t[0]),i},e.prototype.getValueState=function(t){var i=this.option.range,n=this.getExtent();return(i[0]<=n[0]||i[0]<=t)&&(i[1]>=n[1]||t<=i[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[];return this.eachTargetSeries(function(n){var a=[],o=n.getData();o.each(this.getDataDimensionIndex(o),function(s,l){t[0]<=s&&s<=t[1]&&a.push(l)},this),i.push({seriesId:n.id,dataIndex:a})},this),i},e.prototype.getVisualMeta=function(t){var i=mJ(this,"outOfRange",this.getExtent()),n=mJ(this,"inRange",this.option.range.slice()),a=[];function o(p,d){a.push({value:p,color:t(p,d)})}for(var s=0,l=0,u=n.length,c=i.length;l<c&&(!n.length||i[l]<=n[0]);l++)i[l]<n[s]&&o(i[l],"outOfRange");for(var f=1;s<u;s++,f=0)f&&a.length&&o(n[s],"outOfRange"),o(n[s],"inRange");for(var f=1;l<c;l++)(!n.length||n[n.length-1]<i[l])&&(f&&(a.length&&o(a[a.length-1].value,"outOfRange"),f=0),o(i[l],"outOfRange"));var h=a.length;return{stops:a,outerColors:[h?a[0].color:"transparent",h?a[h-1].color:"transparent"]}},e.type="visualMap.continuous",e.defaultOption=Hn(ng.defaultOption,{align:"auto",calculable:!1,hoverLink:!0,realtime:!0,handleIcon:"path://M-11.39,9.77h0a3.5,3.5,0,0,1-3.5,3.5h-22a3.5,3.5,0,0,1-3.5-3.5h0a3.5,3.5,0,0,1,3.5-3.5h22A3.5,3.5,0,0,1-11.39,9.77Z",handleSize:"120%",handleStyle:{borderColor:"#fff",borderWidth:1},indicatorIcon:"circle",indicatorSize:"50%",indicatorStyle:{borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}}),e}(ng);function mJ(r,e,t){if(t[0]===t[1])return t.slice();for(var i=200,n=(t[1]-t[0])/i,a=t[0],o=[],s=0;s<=i&&a<t[1];s++)o.push(a),a+=n;return o.push(t[1]),o}var vJ=Hbe;var Wbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.autoPositionValues={left:1,right:1,top:1,bottom:1},t}return e.prototype.init=function(t,i){this.ecModel=t,this.api=i},e.prototype.render=function(t,i,n,a){if(this.visualMapModel=t,t.get("show")===!1){this.group.removeAll();return}this.doRender(t,i,n,a)},e.prototype.renderBackground=function(t){var i=this.visualMapModel,n=Hs(i.get("padding")||0),a=t.getBoundingRect();t.add(new Et({z2:-1,silent:!0,shape:{x:a.x-n[3],y:a.y-n[0],width:a.width+n[3]+n[1],height:a.height+n[0]+n[2]},style:{fill:i.get("backgroundColor"),stroke:i.get("borderColor"),lineWidth:i.get("borderWidth")}}))},e.prototype.getControllerVisual=function(t,i,n){n=n||{};var a=n.forceState,o=this.visualMapModel,s={};if(i==="color"){var l=o.get("contentColor");s.color=l}function u(p){return s[p]}function c(p,d){s[p]=d}var f=o.controllerVisuals[a||o.getValueState(t)],h=pi.prepareVisualTypes(f);return N(h,function(p){var d=f[p];n.convertOpacityToAlpha&&p==="opacity"&&(p="colorAlpha",d=f.__alphaForOpacity),pi.dependsOn(p,i)&&d&&d.applyVisual(t,u,c)}),s[i]},e.prototype.positionGroup=function(t){var i=this.visualMapModel,n=this.api;Cf(t,i.getBoxLayoutParams(),{width:n.getWidth(),height:n.getHeight()})},e.prototype.doRender=function(t,i,n,a){},e.type="visualMap",e}(er),TE=Wbe;var gJ=[["left","right","width"],["top","bottom","height"]];function EE(r,e,t){var i=r.option,n=i.align;if(n!=null&&n!=="auto")return n;for(var a={width:e.getWidth(),height:e.getHeight()},o=i.orient==="horizontal"?1:0,s=gJ[o],l=[0,null,10],u={},c=0;c<3;c++)u[gJ[1-o][c]]=l[c],u[s[c]]=c===2?t[0]:i[s[c]];var f=[["x","width",3],["y","height",0]][o],h=xr(u,a,i.padding);return s[(h.margin[f[2]]||0)+h[f[0]]+h[f[1]]*.5<a[f[1]]*.5?0:1]}function ag(r,e){return N(r||[],function(t){t.dataIndex!=null&&(t.dataIndexInside=t.dataIndex,t.dataIndex=null),t.highlightKey="visualMap"+(e?e.componentIndex:"")}),r}var $l=rr,Xbe=N,_J=Math.min,r3=Math.max,Ybe=12,qbe=6,Zbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._shapes={},t._dataInterval=[],t._handleEnds=[],t._hoverLinkDataIndices=[],t}return e.prototype.init=function(t,i){r.prototype.init.call(this,t,i),this._hoverLinkFromSeriesMouseOver=Be(this._hoverLinkFromSeriesMouseOver,this),this._hideIndicator=Be(this._hideIndicator,this)},e.prototype.doRender=function(t,i,n,a){(!a||a.type!=="selectDataRange"||a.from!==this.uid)&&this._buildView()},e.prototype._buildView=function(){this.group.removeAll();var t=this.visualMapModel,i=this.group;this._orient=t.get("orient"),this._useHandle=t.get("calculable"),this._resetInterval(),this._renderBar(i);var n=t.get("text");this._renderEndsText(i,n,0),this._renderEndsText(i,n,1),this._updateView(!0),this.renderBackground(i),this._updateView(),this._enableHoverLinkToSeries(),this._enableHoverLinkFromSeries(),this.positionGroup(i)},e.prototype._renderEndsText=function(t,i,n){if(i){var a=i[1-n];a=a!=null?a+"":"";var o=this.visualMapModel,s=o.get("textGap"),l=o.itemSize,u=this._shapes.mainGroup,c=this._applyTransform([l[0]/2,n===0?-s:l[1]+s],u),f=this._applyTransform(n===0?"bottom":"top",u),h=this._orient,p=this.visualMapModel.textStyleModel;this.group.add(new Lt({style:fr(p,{x:c[0],y:c[1],verticalAlign:h==="horizontal"?"middle":f,align:h==="horizontal"?f:"center",text:a})}))}},e.prototype._renderBar=function(t){var i=this.visualMapModel,n=this._shapes,a=i.itemSize,o=this._orient,s=this._useHandle,l=EE(i,this.api,a),u=n.mainGroup=this._createBarGroup(l),c=new Ze;u.add(c),c.add(n.outOfRange=xJ()),c.add(n.inRange=xJ(null,s?MJ(this._orient):null,Be(this._dragHandle,this,"all",!1),Be(this._dragHandle,this,"all",!0))),c.setClipPath(new Et({shape:{x:0,y:0,width:a[0],height:a[1],r:3}}));var f=i.textStyleModel.getTextRect("\u56FD"),h=r3(f.width,f.height);s&&(n.handleThumbs=[],n.handleLabels=[],n.handleLabelPoints=[],this._createHandle(i,u,0,a,h,o),this._createHandle(i,u,1,a,h,o)),this._createIndicator(i,u,a,h,o),t.add(u)},e.prototype._createHandle=function(t,i,n,a,o,s){var l=Be(this._dragHandle,this,n,!1),u=Be(this._dragHandle,this,n,!0),c=xn(t.get("handleSize"),a[0]),f=Sr(t.get("handleIcon"),-c/2,-c/2,c,c,null,!0),h=MJ(this._orient);f.attr({cursor:h,draggable:!0,drift:l,ondragend:u,onmousemove:function(v){Ra(v.event)}}),f.x=a[0]/2,f.useStyle(t.getModel("handleStyle").getItemStyle()),f.setStyle({strokeNoScale:!0,strokeFirst:!0}),f.style.lineWidth*=2,f.ensureState("emphasis").style=t.getModel(["emphasis","handleStyle"]).getItemStyle(),Tu(f,!0),i.add(f);var p=this.visualMapModel.textStyleModel,d=new Lt({cursor:h,draggable:!0,drift:l,onmousemove:function(v){Ra(v.event)},ondragend:u,style:fr(p,{x:0,y:0,text:""})});d.ensureState("blur").style={opacity:.1},d.stateTransition={duration:200},this.group.add(d);var g=[c,0],m=this._shapes;m.handleThumbs[n]=f,m.handleLabelPoints[n]=g,m.handleLabels[n]=d},e.prototype._createIndicator=function(t,i,n,a,o){var s=xn(t.get("indicatorSize"),n[0]),l=Sr(t.get("indicatorIcon"),-s/2,-s/2,s,s,null,!0);l.attr({cursor:"move",invisible:!0,silent:!0,x:n[0]/2});var u=t.getModel("indicatorStyle").getItemStyle();if(l instanceof Ur){var c=l.style;l.useStyle(fe({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},u))}else l.useStyle(u);i.add(l);var f=this.visualMapModel.textStyleModel,h=new Lt({silent:!0,invisible:!0,style:fr(f,{x:0,y:0,text:""})});this.group.add(h);var p=[(o==="horizontal"?a/2:qbe)+n[0]/2,0],d=this._shapes;d.indicator=l,d.indicatorLabel=h,d.indicatorLabelPoint=p,this._firstShowIndicator=!0},e.prototype._dragHandle=function(t,i,n,a){if(this._useHandle){if(this._dragging=!i,!i){var o=this._applyTransform([n,a],this._shapes.mainGroup,!0);this._updateInterval(t,o[1]),this._hideIndicator(),this._updateView()}i===!this.visualMapModel.get("realtime")&&this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:this._dataInterval.slice()}),i?!this._hovering&&this._clearHoverLinkToSeries():SJ(this.visualMapModel)&&this._doHoverLinkToSeries(this._handleEnds[t],!1)}},e.prototype._resetInterval=function(){var t=this.visualMapModel,i=this._dataInterval=t.getSelected(),n=t.getExtent(),a=[0,t.itemSize[1]];this._handleEnds=[$l(i[0],n,a,!0),$l(i[1],n,a,!0)]},e.prototype._updateInterval=function(t,i){i=i||0;var n=this.visualMapModel,a=this._handleEnds,o=[0,n.itemSize[1]];Za(i,a,o,t,0);var s=n.getExtent();this._dataInterval=[$l(a[0],o,s,!0),$l(a[1],o,s,!0)]},e.prototype._updateView=function(t){var i=this.visualMapModel,n=i.getExtent(),a=this._shapes,o=[0,i.itemSize[1]],s=t?o:this._handleEnds,l=this._createBarVisual(this._dataInterval,n,s,"inRange"),u=this._createBarVisual(n,n,o,"outOfRange");a.inRange.setStyle({fill:l.barColor}).setShape("points",l.barPoints),a.outOfRange.setStyle({fill:u.barColor}).setShape("points",u.barPoints),this._updateHandle(s,l)},e.prototype._createBarVisual=function(t,i,n,a){var o={forceState:a,convertOpacityToAlpha:!0},s=this._makeColorGradient(t,o),l=[this.getControllerVisual(t[0],"symbolSize",o),this.getControllerVisual(t[1],"symbolSize",o)],u=this._createBarPoints(n,l);return{barColor:new zl(0,0,0,1,s),barPoints:u,handlesColor:[s[0].color,s[s.length-1].color]}},e.prototype._makeColorGradient=function(t,i){var n=100,a=[],o=(t[1]-t[0])/n;a.push({color:this.getControllerVisual(t[0],"color",i),offset:0});for(var s=1;s<n;s++){var l=t[0]+o*s;if(l>t[1])break;a.push({color:this.getControllerVisual(l,"color",i),offset:s/n})}return a.push({color:this.getControllerVisual(t[1],"color",i),offset:1}),a},e.prototype._createBarPoints=function(t,i){var n=this.visualMapModel.itemSize;return[[n[0]-i[0],t[0]],[n[0],t[0]],[n[0],t[1]],[n[0]-i[1],t[1]]]},e.prototype._createBarGroup=function(t){var i=this._orient,n=this.visualMapModel.get("inverse");return new Ze(i==="horizontal"&&!n?{scaleX:t==="bottom"?1:-1,rotation:Math.PI/2}:i==="horizontal"&&n?{scaleX:t==="bottom"?-1:1,rotation:-Math.PI/2}:i==="vertical"&&!n?{scaleX:t==="left"?1:-1,scaleY:-1}:{scaleX:t==="left"?1:-1})},e.prototype._updateHandle=function(t,i){if(this._useHandle){var n=this._shapes,a=this.visualMapModel,o=n.handleThumbs,s=n.handleLabels,l=a.itemSize,u=a.getExtent();Xbe([0,1],function(c){var f=o[c];f.setStyle("fill",i.handlesColor[c]),f.y=t[c];var h=$l(t[c],[0,l[1]],u,!0),p=this.getControllerVisual(h,"symbolSize");f.scaleX=f.scaleY=p/l[0],f.x=l[0]-p/2;var d=wn(n.handleLabelPoints[c],Vs(f,this.group));s[c].setStyle({x:d[0],y:d[1],text:a.formatValueText(this._dataInterval[c]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",n.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(t,i,n,a){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,f=c.indicator;if(f){f.attr("invisible",!1);var h={convertOpacityToAlpha:!0},p=this.getControllerVisual(t,"color",h),d=this.getControllerVisual(t,"symbolSize"),g=$l(t,s,u,!0),m=l[0]-d/2,v={x:f.x,y:f.y};f.y=g,f.x=m;var _=wn(c.indicatorLabelPoint,Vs(f,this.group)),y=c.indicatorLabel;y.attr("invisible",!1);var x=this._applyTransform("left",c.mainGroup),M=this._orient,S=M==="horizontal";y.setStyle({text:(n||"")+o.formatValueText(i),verticalAlign:S?x:"middle",align:S?"center":x});var w={x:m,y:g,style:{fill:p}},T={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var C={duration:100,easing:"cubicInOut",additive:!0};f.x=v.x,f.y=v.y,f.animateTo(w,C),y.animateTo(T,C)}else f.attr(w),y.attr(T);this._firstShowIndicator=!1;var b=this._shapes.handleLabels;if(b)for(var E=0;E<b.length;E++)this.api.enterBlur(b[E])}},e.prototype._enableHoverLinkToSeries=function(){var t=this;this._shapes.mainGroup.on("mousemove",function(i){if(t._hovering=!0,!t._dragging){var n=t.visualMapModel.itemSize,a=t._applyTransform([i.offsetX,i.offsetY],t._shapes.mainGroup,!0,!0);a[1]=_J(r3(0,a[1]),n[1]),t._doHoverLinkToSeries(a[1],0<=a[0]&&a[0]<=n[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},e.prototype._enableHoverLinkFromSeries=function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},e.prototype._doHoverLinkToSeries=function(t,i){var n=this.visualMapModel,a=n.itemSize;if(n.option.hoverLink){var o=[0,a[1]],s=n.getExtent();t=_J(r3(o[0],t),o[1]);var l=jbe(n,s,o),u=[t-l,t+l],c=$l(t,o,s,!0),f=[$l(u[0],o,s,!0),$l(u[1],o,s,!0)];u[0]<o[0]&&(f[0]=-1/0),u[1]>o[1]&&(f[1]=1/0),i&&(f[0]===-1/0?this._showIndicator(c,f[1],"< ",l):f[1]===1/0?this._showIndicator(c,f[0],"> ",l):this._showIndicator(c,c,"\u2248 ",l));var h=this._hoverLinkDataIndices,p=[];(i||SJ(n))&&(p=this._hoverLinkDataIndices=n.findTargetDataIndices(f));var d=uH(h,p);this._dispatchHighDown("downplay",ag(d[0],n)),this._dispatchHighDown("highlight",ag(d[1],n))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var i;if(qs(t.target,function(l){var u=rt(l);if(u.dataIndex!=null)return i=u,!0},!0),!!i){var n=this.ecModel.getSeriesByIndex(i.seriesIndex),a=this.visualMapModel;if(a.isTargetSeries(n)){var o=n.getData(i.dataType),s=o.getStore().get(a.getDataDimensionIndex(o),i.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var i=this._shapes.handleLabels;if(i)for(var n=0;n<i.length;n++)this.api.leaveBlur(i[n])},e.prototype._clearHoverLinkToSeries=function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",ag(t,this.visualMapModel)),t.length=0},e.prototype._clearHoverLinkFromSeries=function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},e.prototype._applyTransform=function(t,i,n,a){var o=Vs(i,a?null:this.group);return pe(t)?wn(t,o,n):zp(t,o,n)},e.prototype._dispatchHighDown=function(t,i){i&&i.length&&this.api.dispatchAction({type:t,batch:i})},e.prototype.dispose=function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},e.type="visualMap.continuous",e}(TE);function xJ(r,e,t,i){return new ti({shape:{points:r},draggable:!!t,cursor:e,drift:t,onmousemove:function(n){Ra(n.event)},ondragend:i})}function jbe(r,e,t){var i=Ybe/2,n=r.get("hoverLinkDataSize");return n&&(i=$l(n,e,t,!0)/2),i}function SJ(r){var e=r.get("hoverLinkOnHandle");return!!(e??r.get("realtime"))}function MJ(r){return r==="vertical"?"ns-resize":"ew-resize"}var bJ=Zbe;var wJ={type:"selectDataRange",event:"dataRangeSelected",update:"update"},TJ=function(r,e){e.eachComponent({mainType:"visualMap",query:r},function(t){t.setSelected(r.selected)})};var EJ=[{createOnAllSeries:!0,reset:function(r,e){var t=[];return e.eachComponent("visualMap",function(i){var n=r.pipelineContext;!i.isTargetSeries(r)||n&&n.large||t.push(hK(i.stateList,i.targetVisuals,Be(i.getValueState,i),i.getDataDimensionIndex(r.getData())))}),t}},{createOnAllSeries:!0,reset:function(r,e){var t=r.getData(),i=[];e.eachComponent("visualMap",function(n){if(n.isTargetSeries(r)){var a=n.getVisualMeta(Be(Kbe,null,r,n))||{stops:[],outerColors:[]},o=n.getDataDimensionIndex(t);o>=0&&(a.dimension=o,i.push(a))}}),r.getData().setVisual("visualMeta",i)}}];function Kbe(r,e,t,i){for(var n=e.targetVisuals[i],a=pi.prepareVisualTypes(n),o={color:Bl(r.getData(),"color")},s=0,l=a.length;s<l;s++){var u=a[s],c=n[u==="opacity"?"__alphaForOpacity":u];c&&c.applyVisual(t,f,h)}return o.color;function f(p){return o[p]}function h(p,d){o[p]=d}}var AJ=N;function i3(r){var e=r&&r.visualMap;pe(e)||(e=e?[e]:[]),AJ(e,function(t){if(t){og(t,"splitList")&&!og(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var i=t.pieces;i&&pe(i)&&AJ(i,function(n){qe(n)&&(og(n,"start")&&!og(n,"min")&&(n.min=n.start),og(n,"end")&&!og(n,"max")&&(n.max=n.end))})}})}function og(r,e){return r&&r.hasOwnProperty&&r.hasOwnProperty(e)}var CJ=!1;function Jx(r){CJ||(CJ=!0,r.registerSubTypeDefaulter("visualMap",function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(wJ,TJ),N(EJ,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor(i3))}function $x(r){r.registerComponentModel(vJ),r.registerComponentView(bJ),Jx(r)}var Jbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._pieceList=[],t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var n=this._mode=this._determineMode();this._pieceList=[],$be[this._mode].call(this,this._pieceList),this._resetSelected(t,i);var a=this.option.categories;this.resetVisual(function(o,s){n==="categories"?(o.mappingMethod="category",o.categories=Qe(a)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=de(this._pieceList,function(l){return l=Qe(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var t=this.option,i={},n=pi.listVisualTypes(),a=this.isCategory();N(t.pieces,function(s){N(n,function(l){s.hasOwnProperty(l)&&(i[l]=1)})}),N(i,function(s,l){var u=!1;N(this.stateList,function(c){u=u||o(t,c,l)||o(t.target,c,l)},this),!u&&N(this.stateList,function(c){(t[c]||(t[c]={}))[l]=wE.get(l,c==="inRange"?"active":"inactive",a)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}r.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,i){var n=this.option,a=this._pieceList,o=(i?n:t).selected||{};if(n.selected=o,N(a,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),n.selectedMode==="single"){var s=!1;N(a,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return this._mode==="categories"?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=Qe(t)},e.prototype.getValueState=function(t){var i=pi.findPieceIndex(t,this._pieceList);return i!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[i])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[],n=this._pieceList;return this.eachTargetSeries(function(a){var o=[],s=a.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=pi.findPieceIndex(l,n);c===t&&o.push(u)},this),i.push({seriesId:a.id,dataIndex:o})},this),i},e.prototype.getRepresentValue=function(t){var i;if(this.isCategory())i=t.value;else if(t.value!=null)i=t.value;else{var n=t.interval||[];i=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return i},e.prototype.getVisualMeta=function(t){if(this.isCategory())return;var i=[],n=["",""],a=this;function o(c,f){var h=a.getRepresentValue({interval:c});f||(f=a.getValueState(h));var p=t(h,f);c[0]===-1/0?n[0]=p:c[1]===1/0?n[1]=p:i.push({value:c[0],color:p},{value:c[1],color:p})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return N(s,function(c){var f=c.interval;f&&(f[0]>u&&o([u,f[0]],"outOfRange"),o(f.slice()),u=f[1])},this),{stops:i,outerColors:n}},e.type="visualMap.piecewise",e.defaultOption=Hn(ng.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e}(ng),$be={splitNumber:function(r){var e=this.option,t=Math.min(e.precision,20),i=this.getExtent(),n=e.splitNumber;n=Math.max(parseInt(n,10),1),e.splitNumber=n;for(var a=(i[1]-i[0])/n;+a.toFixed(t)!==a&&t<5;)t++;e.precision=t,a=+a.toFixed(t),e.minOpen&&r.push({interval:[-1/0,i[0]],close:[0,0]});for(var o=0,s=i[0];o<n;s+=a,o++){var l=o===n-1?i[1]:s+a;r.push({interval:[s,l],close:[1,1]})}e.maxOpen&&r.push({interval:[i[1],1/0],close:[0,0]}),i_(r),N(r,function(u,c){u.index=c,u.text=this.formatValueText(u.interval)},this)},categories:function(r){var e=this.option;N(e.categories,function(t){r.push({text:this.formatValueText(t,!0),value:t})},this),RJ(e,r)},pieces:function(r){var e=this.option;N(e.pieces,function(t,i){qe(t)||(t={value:t});var n={text:"",index:i};if(t.label!=null&&(n.text=t.label),t.hasOwnProperty("value")){var a=n.value=t.value;n.interval=[a,a],n.close=[1,1]}else{for(var o=n.interval=[],s=n.close=[0,0],l=[1,0,1],u=[-1/0,1/0],c=[],f=0;f<2;f++){for(var h=[["gte","gt","min"],["lte","lt","max"]][f],p=0;p<3&&o[f]==null;p++)o[f]=t[h[p]],s[f]=l[p],c[f]=p===2;o[f]==null&&(o[f]=u[f])}c[0]&&o[1]===1/0&&(s[0]=0),c[1]&&o[0]===-1/0&&(s[1]=0),o[0]===o[1]&&s[0]&&s[1]&&(n.value=o[0])}n.visual=pi.retrieveVisuals(t),r.push(n)},this),RJ(e,r),i_(r),N(r,function(t){var i=t.close,n=[["<","\u2264"][i[1]],[">","\u2265"][i[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,n)},this)}};function RJ(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var LJ=Jbe;var Qbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.doRender=function(){var t=this.group;t.removeAll();var i=this.visualMapModel,n=i.get("textGap"),a=i.textStyleModel,o=a.getFont(),s=a.getTextColor(),l=this._getItemAlign(),u=i.itemSize,c=this._getViewData(),f=c.endsText,h=Br(i.get("showLabel",!0),!f);f&&this._renderEndsText(t,f[0],u,h,l),N(c.viewPieceList,function(p){var d=p.piece,g=new Ze;g.onclick=Be(this._onItemClick,this,d),this._enableHoverLink(g,p.indexInModelPieceList);var m=i.getRepresentValue(d);if(this._createItemSymbol(g,m,[0,0,u[0],u[1]]),h){var v=this.visualMapModel.getValueState(m);g.add(new Lt({style:{x:l==="right"?-n:u[0]+n,y:u[1]/2,text:d.text,verticalAlign:"middle",align:l,font:o,fill:s,opacity:v==="outOfRange"?.5:1}}))}t.add(g)},this),f&&this._renderEndsText(t,f[1],u,h,l),Xs(i.get("orient"),t,i.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,i){var n=this;t.on("mouseover",function(){return a("highlight")}).on("mouseout",function(){return a("downplay")});var a=function(o){var s=n.visualMapModel;s.option.hoverLink&&n.api.dispatchAction({type:o,batch:ag(s.findTargetDataIndices(i),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,i=t.option;if(i.orient==="vertical")return EE(t,this.api,t.itemSize);var n=i.align;return(!n||n==="auto")&&(n="left"),n},e.prototype._renderEndsText=function(t,i,n,a,o){if(i){var s=new Ze,l=this.visualMapModel.textStyleModel;s.add(new Lt({style:fr(l,{x:a?o==="right"?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:"middle",align:a?o:"center",text:i})})),t.add(s)}},e.prototype._getViewData=function(){var t=this.visualMapModel,i=de(t.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),n=t.get("text"),a=t.get("orient"),o=t.get("inverse");return(a==="horizontal"?o:!o)?i.reverse():n&&(n=n.slice().reverse()),{viewPieceList:i,endsText:n}},e.prototype._createItemSymbol=function(t,i,n){t.add(Sr(this.getControllerVisual(i,"symbol"),n[0],n[1],n[2],n[3],this.getControllerVisual(i,"color")))},e.prototype._onItemClick=function(t){var i=this.visualMapModel,n=i.option,a=n.selectedMode;if(a){var o=Qe(n.selected),s=i.getSelectedMapKey(t);a==="single"||a===!0?(o[s]=!0,N(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e}(TE),PJ=Qbe;function Qx(r){r.registerComponentModel(LJ),r.registerComponentView(PJ),Jx(r)}function n3(r){It($x),It(Qx)}var ewe={label:{enabled:!0},decal:{show:!1}},DJ=vt(),twe={};function a3(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var i=Qe(ewe);_t(i.label,r.getLocaleModel().get("aria"),!1),_t(t.option,i,!1),n(),a();function n(){var u=t.getModel("decal"),c=u.get("show");if(c){var f=ke();r.eachSeries(function(h){if(!h.isColorBySeries()){var p=f.get(h.type);p||(p={},f.set(h.type,p)),DJ(h).scope=p}}),r.eachRawSeries(function(h){if(r.isSeriesFiltered(h))return;if(He(h.enableAriaDecal)){h.enableAriaDecal();return}var p=h.getData();if(h.isColorBySeries()){var _=D_(h.ecModel,h.name,twe,r.getSeriesCount()),y=p.getVisual("decal");p.setVisual("decal",x(y,_))}else{var d=h.getRawData(),g={},m=DJ(h).scope;p.each(function(M){var S=p.getRawIndex(M);g[S]=M});var v=d.count();d.each(function(M){var S=g[M],w=d.getName(M)||M+"",T=D_(h.ecModel,w,m,v),C=p.getItemVisual(S,"decal");p.setItemVisual(S,"decal",x(C,T))})}function x(M,S){var w=M?fe(fe({},S),M):S;return w.dirty=!0,w}})}}function a(){var u=r.getLocaleModel().get("aria"),c=t.getModel("label");if(c.option=Ye(c.option,u),!!c.get("enabled")){var f=e.getZr().dom;if(c.get("description")){f.setAttribute("aria-label",c.get("description"));return}var h=r.getSeriesCount(),p=c.get(["data","maxCount"])||10,d=c.get(["series","maxCount"])||10,g=Math.min(h,d),m;if(!(h<1)){var v=s();if(v){var _=c.get(["general","withTitle"]);m=o(_,{title:v})}else m=c.get(["general","withoutTitle"]);var y=[],x=h>1?c.get(["series","multiple","prefix"]):c.get(["series","single","prefix"]);m+=o(x,{seriesCount:h}),r.eachSeries(function(T,C){if(C<g){var b=void 0,E=T.get("name"),I=E?"withName":"withoutName";b=h>1?c.get(["series","multiple",I]):c.get(["series","single",I]),b=o(b,{seriesId:T.seriesIndex,seriesName:T.get("name"),seriesType:l(T.subType)});var R=T.getData();if(R.count()>p){var A=c.get(["data","partialData"]);b+=o(A,{displayCnt:p})}else b+=c.get(["data","allData"]);for(var D=c.get(["data","separator","middle"]),U=c.get(["data","separator","end"]),B=[],z=0;z<R.count();z++)if(z<p){var k=R.getName(z),G=R.getValues(z),Y=c.get(["data",k?"withName":"withoutName"]);B.push(o(Y,{name:k,value:G.join(D)}))}b+=B.join(D)+U,y.push(b)}});var M=c.getModel(["series","multiple","separator"]),S=M.get("middle"),w=M.get("end");m+=y.join(S)+w,f.setAttribute("aria-label",m)}}}function o(u,c){if(!Ce(u))return u;var f=u;return N(c,function(h,p){f=f.replace(new RegExp("\\{\\s*"+p+"\\s*\\}","g"),h)}),f}function s(){var u=r.get("title");return u&&u.length&&(u=u[0]),u&&u.text}function l(u){var c=r.getLocaleModel().get(["series","typeNames"]);return c[u]||c.chart}}function o3(r){if(!(!r||!r.aria)){var e=r.aria;e.show!=null&&(e.enabled=e.show),e.label=e.label||{},N(["description","general","series","data"],function(t){e[t]!=null&&(e.label[t]=e[t])})}}function s3(r){r.registerPreprocessor(o3),r.registerVisual(r.PRIORITY.VISUAL.ARIA,a3)}var IJ={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},rwe=function(){function r(e){var t=this._condVal=Ce(e)?new RegExp(e):FV(e)?e:null;if(t==null){var i="";ur(i)}}return r.prototype.evaluate=function(e){var t=typeof e;return Ce(t)?this._condVal.test(e):Ct(t)?this._condVal.test(e+""):!1},r}(),iwe=function(){function r(){}return r.prototype.evaluate=function(){return this.value},r}(),nwe=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(!e[t].evaluate())return!1;return!0},r}(),awe=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(e[t].evaluate())return!0;return!1},r}(),owe=function(){function r(){}return r.prototype.evaluate=function(){return!this.child.evaluate()},r}(),swe=function(){function r(){}return r.prototype.evaluate=function(){for(var e=!!this.valueParser,t=this.getValue,i=t(this.valueGetterParam),n=e?this.valueParser(i):null,a=0;a<this.subCondList.length;a++)if(!this.subCondList[a].evaluate(e?n:i))return!1;return!0},r}();function l3(r,e){if(r===!0||r===!1){var t=new iwe;return t.value=r,t}var i="";return UJ(r)||ur(i),r.and?NJ("and",r,e):r.or?NJ("or",r,e):r.not?lwe(r,e):uwe(r,e)}function NJ(r,e,t){var i=e[r],n="";pe(i)||ur(n),i.length||ur(n);var a=r==="and"?new nwe:new awe;return a.children=de(i,function(o){return l3(o,t)}),a.children.length||ur(n),a}function lwe(r,e){var t=r.not,i="";UJ(t)||ur(i);var n=new owe;return n.child=l3(t,e),n.child||ur(i),n}function uwe(r,e){for(var t="",i=e.prepareGetValue(r),n=[],a=bt(r),o=r.parser,s=o?Gw(o):null,l=0;l<a.length;l++){var u=a[l];if(!(u==="parser"||e.valueGetterAttrMap.get(u))){var c=tt(IJ,u)?IJ[u]:u,f=r[u],h=s?s(f):f,p=eW(c,h)||c==="reg"&&new rwe(h);p||ur(t),n.push(p)}}n.length||ur(t);var d=new swe;return d.valueGetterParam=i,d.valueParser=s,d.getValue=e.getValue,d.subCondList=n,d}function UJ(r){return qe(r)&&!ci(r)}var cwe=function(){function r(e,t){this._cond=l3(e,t)}return r.prototype.evaluate=function(){return this._cond.evaluate()},r}();function OJ(r,e){return new cwe(r,e)}var zJ={type:"echarts:filter",transform:function(r){for(var e=r.upstream,t,i=OJ(r.config,{valueGetterAttrMap:ke({dimension:!0}),prepareGetValue:function(s){var l="",u=s.dimension;tt(s,"dimension")||ur(l);var c=e.getDimensionInfo(u);return c||ur(l),{dimIdx:c.index}},getValue:function(s){return e.retrieveValueFromItem(t,s.dimIdx)}}),n=[],a=0,o=e.count();a<o;a++)t=e.getRawDataItem(a),i.evaluate()&&n.push(t);return{data:n}}};var FJ={type:"echarts:sort",transform:function(r){var e=r.upstream,t=r.config,i="",n=$t(t);n.length||ur(i);var a=[];N(n,function(c){var f=c.dimension,h=c.order,p=c.parser,d=c.incomparable;if(f==null&&ur(i),h!=="asc"&&h!=="desc"&&ur(i),d&&d!=="min"&&d!=="max"){var g="";ur(g)}if(h!=="asc"&&h!=="desc"){var m="";ur(m)}var v=e.getDimensionInfo(f);v||ur(i);var _=p?Gw(p):null;p&&!_&&ur(i),a.push({dimIdx:v.index,parser:_,comparator:new Hw(h,d)})});var o=e.sourceFormat;o!==Ei&&o!==En&&ur(i);for(var s=[],l=0,u=e.count();l<u;l++)s.push(e.getRawDataItem(l));return s.sort(function(c,f){for(var h=0;h<a.length;h++){var p=a[h],d=e.retrieveValueFromItem(c,p.dimIdx),g=e.retrieveValueFromItem(f,p.dimIdx);p.parser&&(d=p.parser(d),g=p.parser(g));var m=p.comparator.evaluate(d,g);if(m!==0)return m}return 0}),{data:s}}};function u3(r){r.registerTransform(zJ),r.registerTransform(FJ)}var fwe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.prototype.init=function(t,i,n){r.prototype.init.call(this,t,i,n),this._sourceManager=new Yw(this),TD(this)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),TD(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:Ga},e}(Pt);var hwe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.type="dataset",e}(er);function c3(r){r.registerComponentModel(fwe),r.registerComponentView(hwe)}var Ql=Ki.CMD;function sg(r,e){return Math.abs(r-e)<1e-5}function AE(r){var e=r.data,t=r.len(),i=[],n,a=0,o=0,s=0,l=0;function u(R,A){n&&n.length>2&&i.push(n),n=[R,A]}function c(R,A,D,U){sg(R,D)&&sg(A,U)||n.push(R,A,D,U,D,U)}function f(R,A,D,U,B,z){var k=Math.abs(A-R),G=Math.tan(k/4)*4/3,Y=A<R?-1:1,J=Math.cos(R),Q=Math.sin(R),V=Math.cos(A),K=Math.sin(A),ae=J*B+D,ve=Q*z+U,ue=V*B+D,se=K*z+U,Ee=B*G*Y,q=z*G*Y;n.push(ae-Ee*Q,ve+q*J,ue+Ee*K,se-q*V,ue,se)}for(var h,p,d,g,m=0;m<t;){var v=e[m++],_=m===1;switch(_&&(a=e[m],o=e[m+1],s=a,l=o,(v===Ql.L||v===Ql.C||v===Ql.Q)&&(n=[s,l])),v){case Ql.M:a=s=e[m++],o=l=e[m++],u(s,l);break;case Ql.L:h=e[m++],p=e[m++],c(a,o,h,p),a=h,o=p;break;case Ql.C:n.push(e[m++],e[m++],e[m++],e[m++],a=e[m++],o=e[m++]);break;case Ql.Q:h=e[m++],p=e[m++],d=e[m++],g=e[m++],n.push(a+2/3*(h-a),o+2/3*(p-o),d+2/3*(h-d),g+2/3*(p-g),d,g),a=d,o=g;break;case Ql.A:var y=e[m++],x=e[m++],M=e[m++],S=e[m++],w=e[m++],T=e[m++]+w;m+=1;var C=!e[m++];h=Math.cos(w)*M+y,p=Math.sin(w)*S+x,_?(s=h,l=p,u(s,l)):c(a,o,h,p),a=Math.cos(T)*M+y,o=Math.sin(T)*S+x;for(var b=(C?-1:1)*Math.PI/2,E=w;C?E>T:E<T;E+=b){var I=C?Math.max(E+b,T):Math.min(E+b,T);f(E,I,y,x,M,S)}break;case Ql.R:s=a=e[m++],l=o=e[m++],h=s+e[m++],p=l+e[m++],u(h,l),c(h,l,h,p),c(h,p,s,p),c(s,p,s,l),c(s,l,h,l);break;case Ql.Z:n&&c(a,o,s,l),a=s,o=l;break}}return n&&n.length>2&&i.push(n),i}function f3(r,e,t,i,n,a,o,s,l,u){if(sg(r,t)&&sg(e,i)&&sg(n,o)&&sg(a,s)){l.push(o,s);return}var c=2/u,f=c*c,h=o-r,p=s-e,d=Math.sqrt(h*h+p*p);h/=d,p/=d;var g=t-r,m=i-e,v=n-o,_=a-s,y=g*g+m*m,x=v*v+_*_;if(y<f&&x<f){l.push(o,s);return}var M=h*g+p*m,S=-h*v-p*_,w=y-M*M,T=x-S*S;if(w<f&&M>=0&&T<f&&S>=0){l.push(o,s);return}var C=[],b=[];jo(r,t,n,o,.5,C),jo(e,i,a,s,.5,b),f3(C[0],b[0],C[1],b[1],C[2],b[2],C[3],b[3],l,u),f3(C[4],b[4],C[5],b[5],C[6],b[6],C[7],b[7],l,u)}function BJ(r,e){var t=AE(r),i=[];e=e||1;for(var n=0;n<t.length;n++){var a=t[n],o=[],s=a[0],l=a[1];o.push(s,l);for(var u=2;u<a.length;){var c=a[u++],f=a[u++],h=a[u++],p=a[u++],d=a[u++],g=a[u++];f3(s,l,c,f,h,p,d,g,o,e),s=d,l=g}i.push(o)}return i}function HJ(r,e,t){var i=r[e],n=r[1-e],a=Math.abs(i/n),o=Math.ceil(Math.sqrt(a*t)),s=Math.floor(t/o);s===0&&(s=1,o=t);for(var l=[],u=0;u<o;u++)l.push(s);var c=o*s,f=t-c;if(f>0)for(var u=0;u<f;u++)l[u%o]+=1;return l}function kJ(r,e,t){for(var i=r.r0,n=r.r,a=r.startAngle,o=r.endAngle,s=Math.abs(o-a),l=s*n,u=n-i,c=l>Math.abs(u),f=HJ([l,u],c?0:1,e),h=(c?s:u)/f.length,p=0;p<f.length;p++)for(var d=(c?u:s)/f[p],g=0;g<f[p];g++){var m={};c?(m.startAngle=a+h*p,m.endAngle=a+h*(p+1),m.r0=i+d*g,m.r=i+d*(g+1)):(m.startAngle=a+d*g,m.endAngle=a+d*(g+1),m.r0=i+h*p,m.r=i+h*(p+1)),m.clockwise=r.clockwise,m.cx=r.cx,m.cy=r.cy,t.push(m)}}function pwe(r,e,t){for(var i=r.width,n=r.height,a=i>n,o=HJ([i,n],a?0:1,e),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",c=a?"y":"x",f=r[s]/o.length,h=0;h<o.length;h++)for(var p=r[l]/o[h],d=0;d<o[h];d++){var g={};g[u]=h*f,g[c]=d*p,g[s]=f,g[l]=p,g.x+=r.x,g.y+=r.y,t.push(g)}}function VJ(r,e,t,i){return r*i-t*e}function dwe(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=VJ(c,f,l,u);if(Math.abs(h)<1e-6)return null;var p=r-n,d=e-a,g=VJ(p,d,c,f)/h;return g<0||g>1?null:new Nt(g*l+r,g*u+e)}function mwe(r,e,t){var i=new Nt;Nt.sub(i,t,e),i.normalize();var n=new Nt;Nt.sub(n,r,e);var a=n.dot(i);return a}function lg(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function vwe(r,e,t){for(var i=r.length,n=[],a=0;a<i;a++){var o=r[a],s=r[(a+1)%i],l=dwe(o[0],o[1],s[0],s[1],e.x,e.y,t.x,t.y);l&&n.push({projPt:mwe(l,e,t),pt:l,idx:a})}if(n.length<2)return[{points:r},{points:r}];n.sort(function(m,v){return m.projPt-v.projPt});var u=n[0],c=n[n.length-1];if(c.idx<u.idx){var f=u;u=c,c=f}for(var h=[u.pt.x,u.pt.y],p=[c.pt.x,c.pt.y],d=[h],g=[p],a=u.idx+1;a<=c.idx;a++)lg(d,r[a].slice());lg(d,p),lg(d,h);for(var a=c.idx+1;a<=u.idx+i;a++)lg(g,r[a%i].slice());return lg(g,h),lg(g,p),[{points:d},{points:g}]}function GJ(r){var e=r.points,t=[],i=[];wp(e,t,i);var n=new lt(t[0],t[1],i[0]-t[0],i[1]-t[1]),a=n.width,o=n.height,s=n.x,l=n.y,u=new Nt,c=new Nt;return a>o?(u.x=c.x=s+a/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+a),vwe(e,u,c)}function CE(r,e,t,i){if(t===1)i.push(e);else{var n=Math.floor(t/2),a=r(e);CE(r,a[0],n,i),CE(r,a[1],t-n,i)}return i}function gwe(r,e){for(var t=[],i=0;i<e;i++)t.push(Qm(r));return t}function ywe(r,e){e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel}function _we(r){for(var e=[],t=0;t<r.length;)e.push([r[t++],r[t++]]);return e}function WJ(r,e){var t=[],i=r.shape,n;switch(r.type){case"rect":pwe(i,e,t),n=Et;break;case"sector":kJ(i,e,t),n=yi;break;case"circle":kJ({r0:0,r:i.r,startAngle:0,endAngle:Math.PI*2,cx:i.cx,cy:i.cy},e,t),n=yi;break;default:var a=r.getComputedTransform(),o=a?Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1],a[2]*a[2]+a[3]*a[3])):1,s=de(BJ(r.getUpdatedPathProxy(),o),function(v){return _we(v)}),l=s.length;if(l===0)CE(GJ,{points:s[0]},e,t);else if(l===e)for(var u=0;u<l;u++)t.push({points:s[u]});else{var c=0,f=de(s,function(v){var _=[],y=[];wp(v,_,y);var x=(y[1]-_[1])*(y[0]-_[0]);return c+=x,{poly:v,area:x}});f.sort(function(v,_){return _.area-v.area});for(var h=e,u=0;u<l;u++){var p=f[u];if(h<=0)break;var d=u===l-1?h:Math.ceil(p.area/c*e);d<0||(CE(GJ,{points:p.poly},d,t),h-=d)}}n=ti;break}if(!n)return gwe(r,e);for(var g=[],u=0;u<t.length;u++){var m=new n;m.setShape(t[u]),ywe(r,m),g.push(m)}return g}function xwe(r,e){var t=r.length,i=e.length;if(t===i)return[r,e];for(var n=[],a=[],o=t<i?r:e,s=Math.min(t,i),l=Math.abs(i-t)/6,u=(s-2)/6,c=Math.ceil(l/u)+1,f=[o[0],o[1]],h=l,p=2;p<s;){var d=o[p-2],g=o[p-1],m=o[p++],v=o[p++],_=o[p++],y=o[p++],x=o[p++],M=o[p++];if(h<=0){f.push(m,v,_,y,x,M);continue}for(var S=Math.min(h,c-1)+1,w=1;w<=S;w++){var T=w/S;jo(d,m,_,x,T,n),jo(g,v,y,M,T,a),d=n[3],g=a[3],f.push(n[1],a[1],n[2],a[2],d,g),m=n[5],v=a[5],_=n[6],y=a[6]}h-=S-1}return o===r?[f,e]:[r,f]}function XJ(r,e){for(var t=r.length,i=r[t-2],n=r[t-1],a=[],o=0;o<e.length;)a[o++]=i,a[o++]=n;return a}function Swe(r,e){for(var t,i,n,a=[],o=[],s=0;s<Math.max(r.length,e.length);s++){var l=r[s],u=e[s],c=void 0,f=void 0;l?u?(t=xwe(l,u),c=t[0],f=t[1],i=c,n=f):(f=XJ(n||l,l),c=l):(c=XJ(i||u,u),f=u),a.push(c),o.push(f)}return[a,o]}function YJ(r){for(var e=0,t=0,i=0,n=r.length,a=0,o=n-2;a<n;o=a,a+=2){var s=r[o],l=r[o+1],u=r[a],c=r[a+1],f=s*c-u*l;e+=f,t+=(s+u)*f,i+=(l+c)*f}return e===0?[r[0]||0,r[1]||0]:[t/e/3,i/e/3,e]}function Mwe(r,e,t,i){for(var n=(r.length-2)/6,a=1/0,o=0,s=r.length,l=s-2,u=0;u<n;u++){for(var c=u*6,f=0,h=0;h<s;h+=2){var p=h===0?c:(c+h-2)%l+2,d=r[p]-t[0],g=r[p+1]-t[1],m=e[h]-i[0],v=e[h+1]-i[1],_=m-d,y=v-g;f+=_*_+y*y}f<a&&(a=f,o=u)}return o}function bwe(r){for(var e=[],t=r.length,i=0;i<t;i+=2)e[i]=r[t-i-2],e[i+1]=r[t-i-1];return e}function wwe(r,e,t,i){for(var n=[],a,o=0;o<r.length;o++){var s=r[o],l=e[o],u=YJ(s),c=YJ(l);a==null&&(a=u[2]<0!=c[2]<0);var f=[],h=[],p=0,d=1/0,g=[],m=s.length;a&&(s=bwe(s));for(var v=Mwe(s,l,u,c)*6,_=m-2,y=0;y<_;y+=2){var x=(v+y)%_+2;f[y+2]=s[x]-u[0],f[y+3]=s[x+1]-u[1]}if(f[0]=s[v]-u[0],f[1]=s[v+1]-u[1],t>0)for(var M=i/t,S=-i/2;S<=i/2;S+=M){for(var w=Math.sin(S),T=Math.cos(S),C=0,y=0;y<s.length;y+=2){var b=f[y],E=f[y+1],I=l[y]-c[0],R=l[y+1]-c[1],A=I*T-R*w,D=I*w+R*T;g[y]=A,g[y+1]=D;var U=A-b,B=D-E;C+=U*U+B*B}if(C<d){d=C,p=S;for(var z=0;z<g.length;z++)h[z]=g[z]}}else for(var k=0;k<m;k+=2)h[k]=l[k]-c[0],h[k+1]=l[k+1]-c[1];n.push({from:f,to:h,fromCp:u,toCp:c,rotation:-p})}return n}function tS(r){return r.__isCombineMorphing}var ZJ="__mOriginal_";function RE(r,e,t){var i=ZJ+e,n=r[i]||r[e];r[i]||(r[i]=r[e]);var a=t.replace,o=t.after,s=t.before;r[e]=function(){var l=arguments,u;return s&&s.apply(this,l),a?u=a.apply(this,l):u=n.apply(this,l),o&&o.apply(this,l),u}}function eS(r,e){var t=ZJ+e;r[t]&&(r[e]=r[t],r[t]=null)}function qJ(r,e){for(var t=0;t<r.length;t++)for(var i=r[t],n=0;n<i.length;){var a=i[n],o=i[n+1];i[n++]=e[0]*a+e[2]*o+e[4],i[n++]=e[1]*a+e[3]*o+e[5]}}function jJ(r,e){var t=r.getUpdatedPathProxy(),i=e.getUpdatedPathProxy(),n=Swe(AE(t),AE(i)),a=n[0],o=n[1],s=r.getComputedTransform(),l=e.getComputedTransform();function u(){this.transform=null}s&&qJ(a,s),l&&qJ(o,l),RE(e,"updateTransform",{replace:u}),e.transform=null;var c=wwe(a,o,10,Math.PI),f=[];RE(e,"buildPath",{replace:function(h){for(var p=e.__morphT,d=1-p,g=[],m=0;m<c.length;m++){var v=c[m],_=v.from,y=v.to,x=v.rotation*p,M=v.fromCp,S=v.toCp,w=Math.sin(x),T=Math.cos(x);Am(g,M,S,p);for(var C=0;C<_.length;C+=2){var b=_[C],E=_[C+1],I=y[C],R=y[C+1],A=b*d+I*p,D=E*d+R*p;f[C]=A*T-D*w+g[0],f[C+1]=A*w+D*T+g[1]}var U=f[0],B=f[1];h.moveTo(U,B);for(var C=2;C<_.length;){var I=f[C++],R=f[C++],z=f[C++],k=f[C++],G=f[C++],Y=f[C++];U===I&&B===R&&z===G&&k===Y?h.lineTo(G,Y):h.bezierCurveTo(I,R,z,k,G,Y),U=G,B=Y}}}})}function PE(r,e,t){if(!r||!e)return e;var i=t.done,n=t.during;jJ(r,e),e.__morphT=0;function a(){eS(e,"buildPath"),eS(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Ye({during:function(o){e.dirtyShape(),n&&n(o)},done:function(){a(),i&&i()}},t)),e}function Twe(r,e,t,i,n,a){var o=16;r=n===t?0:Math.round(32767*(r-t)/(n-t)),e=a===i?0:Math.round(32767*(e-i)/(a-i));for(var s=0,l,u=(1<<o)/2;u>0;u/=2){var c=0,f=0;(r&u)>0&&(c=1),(e&u)>0&&(f=1),s+=u*u*(3*c^f),f===0&&(c===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function LE(r){var e=1/0,t=1/0,i=-1/0,n=-1/0,a=de(r,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),f=l.y+l.height/2+(u?u[5]:0);return e=Math.min(c,e),t=Math.min(f,t),i=Math.max(c,i),n=Math.max(f,n),[c,f]}),o=de(a,function(s,l){return{cp:s,z:Twe(s[0],s[1],e,t,i,n),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function KJ(r){return WJ(r.path,r.count)}function h3(){return{fromIndividuals:[],toIndividuals:[],count:0}}function JJ(r,e,t){var i=[];function n(M){for(var S=0;S<M.length;S++){var w=M[S];tS(w)?n(w.childrenRef()):w instanceof ut&&i.push(w)}}n(r);var a=i.length;if(!a)return h3();var o=t.dividePath||KJ,s=o({path:e,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),h3();i=LE(i),s=LE(s);for(var l=t.done,u=t.during,c=t.individualDelay,f=new Da,h=0;h<a;h++){var p=i[h],d=s[h];d.parent=e,d.copyTransform(f),c||jJ(p,d)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function g(M){for(var S=0;S<s.length;S++)s[S].addSelfToZr(M)}RE(e,"addSelfToZr",{after:function(M){g(M)}}),RE(e,"removeSelfFromZr",{after:function(M){for(var S=0;S<s.length;S++)s[S].removeSelfFromZr(M)}});function m(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,eS(e,"addSelfToZr"),eS(e,"removeSelfFromZr")}var v=s.length;if(c)for(var _=v,y=function(){_--,_===0&&(m(),l&&l())},h=0;h<v;h++){var x=c?Ye({delay:(t.delay||0)+c(h,v,i[h],s[h]),done:y},t):t;PE(i[h],s[h],x)}else e.__morphT=0,e.animateTo({__morphT:1},Ye({during:function(M){for(var S=0;S<v;S++){var w=s[S];w.__morphT=e.__morphT,w.dirtyShape()}u&&u(M)},done:function(){m();for(var M=0;M<r.length;M++)eS(r[M],"updateTransform");l&&l()}},t));return e.__zr&&g(e.__zr),{fromIndividuals:i,toIndividuals:s,count:v}}function $J(r,e,t){var i=e.length,n=[],a=t.dividePath||KJ;function o(p){for(var d=0;d<p.length;d++){var g=p[d];tS(g)?o(g.childrenRef()):g instanceof ut&&n.push(g)}}if(tS(r)){o(r.childrenRef());var s=n.length;if(s<i)for(var l=0,u=s;u<i;u++)n.push(Qm(n[l++%s]));n.length=i}else{n=a({path:r,count:i});for(var c=r.getComputedTransform(),u=0;u<n.length;u++)n[u].setLocalTransform(c);if(n.length!==i)return console.error("Invalid morphing: unmatched splitted path"),h3()}n=LE(n),e=LE(e);for(var f=t.individualDelay,u=0;u<i;u++){var h=f?Ye({delay:(t.delay||0)+f(u,i,n[u],e[u])},t):t;PE(n[u],e[u],h)}return{fromIndividuals:n,toIndividuals:e,count:e.length}}function QJ(r){return pe(r[0])}function e$(r,e){for(var t=[],i=r.length,n=0;n<i;n++)t.push({one:r[n],many:[]});for(var n=0;n<e.length;n++){var a=e[n].length,o=void 0;for(o=0;o<a;o++)t[o%i].many.push(e[n][o])}for(var s=0,n=i-1;n>=0;n--)if(!t[n].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var a=l.length,u=Math.ceil(a/2);t[n].many=l.slice(u,a),t[s].many=l.slice(0,u),s++}return t}var Ewe={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),i=0;i<r.count;i++){var n=Qm(r.path);n.setStyle("opacity",t),e.push(n)}return e},split:null};function DE(r,e,t,i,n,a){if(!r.length||!e.length)return;var o=Fl("update",i,n);if(!(o&&o.duration>0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;QJ(r)&&(u=r,c=e),QJ(e)&&(u=e,c=r);function f(v,_,y,x,M){var S=v.many,w=v.one;if(S.length===1&&!M){var T=_?S[0]:w,C=_?w:S[0];if(tS(T))f({many:[T],one:C},!0,y,x,!0);else{var b=s?Ye({delay:s(y,x)},l):l;PE(T,C,b),a(T,C,T,C,b)}}else for(var E=Ye({dividePath:Ewe[t],individualDelay:s&&function(B,z,k,G){return s(B+y,x)}},l),I=_?JJ(S,w,E):$J(w,S,E),R=I.fromIndividuals,A=I.toIndividuals,D=R.length,U=0;U<D;U++){var b=s?Ye({delay:s(U,D)},l):l;a(R[U],A[U],_?S[U]:v.one,_?v.one:S[U],b)}}for(var h=u?u===r:r.length>e.length,p=u?e$(c,u):e$(h?e:r,[h?r:e]),d=0,g=0;g<p.length;g++)d+=p[g].many.length;for(var m=0,g=0;g<p.length;g++)f(p[g],h,m,d),m+=p[g].many.length}function ah(r){if(!r)return[];if(pe(r)){for(var e=[],t=0;t<r.length;t++)e.push(ah(r[t]));return e}var i=[];return r.traverse(function(n){n instanceof ut&&!n.disableMorphing&&!n.invisible&&!n.ignore&&i.push(n)}),i}var l$=1e4,Awe=0,t$=1,r$=2,Cwe=vt();function Rwe(r,e){for(var t=r.dimensions,i=0;i<t.length;i++){var n=r.getDimensionInfo(t[i]);if(n&&n.otherDims[e]===0)return t[i]}}function Lwe(r,e,t){var i=r.getDimensionInfo(t),n=i&&i.ordinalMeta;if(i){var a=r.get(i.name,e);return n&&n.categories[a]||a+""}}function i$(r,e,t,i){var n=i?"itemChildGroupId":"itemGroupId",a=Rwe(r,n);if(a){var o=Lwe(r,e,a);return o}var s=r.getRawDataItem(e),l=i?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!i)return t||r.getId(e)}function n$(r){var e=[];return N(r,function(t){var i=t.data,n=t.dataGroupId;if(!(i.count()>l$))for(var a=i.getIndices(),o=0;o<a.length;o++)e.push({data:i,groupId:i$(i,o,n,!1),childGroupId:i$(i,o,n,!0),divide:t.divide,dataIndex:o})}),e}function p3(r,e,t){r.traverse(function(i){i instanceof ut&&or(i,{style:{opacity:0}},e,{dataIndex:t,isFrom:!0})})}function d3(r){if(r.parent){var e=r.getComputedTransform();r.setLocalTransform(e),r.parent.remove(r)}}function ug(r){r.stopAnimation(),r.isGroup&&r.traverse(function(e){e.stopAnimation()})}function Pwe(r,e,t){var i=Fl("update",t,e);i&&r.traverse(function(n){if(n instanceof gi){var a=X4(n);a&&n.animateFrom({style:a},i)}})}function Dwe(r,e){var t=r.length;if(t!==e.length)return!1;for(var i=0;i<t;i++){var n=r[i],a=e[i];if(n.data.getId(n.dataIndex)!==a.data.getId(a.dataIndex))return!1}return!0}function u$(r,e,t){var i=n$(r),n=n$(e);function a(y,x,M,S,w){(M||y)&&x.animateFrom({style:M&&M!==y?fe(fe({},M.style),y.style):y.style},w)}var o=!1,s=Awe,l=ke(),u=ke();i.forEach(function(y){y.groupId&&l.set(y.groupId,!0),y.childGroupId&&u.set(y.childGroupId,!0)});for(var c=0;c<n.length;c++){var f=n[c].groupId;if(u.get(f)){s=t$;break}var h=n[c].childGroupId;if(h&&l.get(h)){s=r$;break}}function p(y,x){return function(M){var S=M.data,w=M.dataIndex;return x?S.getId(w):y?s===t$?M.childGroupId:M.groupId:s===r$?M.childGroupId:M.groupId}}var d=Dwe(i,n),g={};if(!d)for(var c=0;c<n.length;c++){var m=n[c],v=m.data.getItemGraphicEl(m.dataIndex);v&&(g[v.id]=!0)}function _(y,x){var M=i[x],S=n[y],w=S.data.hostModel,T=M.data.getItemGraphicEl(M.dataIndex),C=S.data.getItemGraphicEl(S.dataIndex);if(T===C){C&&Pwe(C,S.dataIndex,w);return}T&&g[T.id]||C&&(ug(C),T?(ug(T),d3(T),o=!0,DE(ah(T),ah(C),S.divide,w,y,a)):p3(C,w,y))}new An(i,n,p(!0,d),p(!1,d),null,"multiple").update(_).updateManyToOne(function(y,x){var M=n[y],S=M.data,w=S.hostModel,T=S.getItemGraphicEl(M.dataIndex),C=Wt(de(x,function(b){return i[b].data.getItemGraphicEl(i[b].dataIndex)}),function(b){return b&&b!==T&&!g[b.id]});T&&(ug(T),C.length?(N(C,function(b){ug(b),d3(b)}),o=!0,DE(ah(C),ah(T),M.divide,w,y,a)):p3(T,w,M.dataIndex))}).updateOneToMany(function(y,x){var M=i[x],S=M.data.getItemGraphicEl(M.dataIndex);if(!(S&&g[S.id])){var w=Wt(de(y,function(C){return n[C].data.getItemGraphicEl(n[C].dataIndex)}),function(C){return C&&C!==S}),T=n[y[0]].data.hostModel;w.length&&(N(w,function(C){return ug(C)}),S?(ug(S),d3(S),o=!0,DE(ah(S),ah(w),M.divide,T,y[0],a)):N(w,function(C){return p3(C,T,y[0])}))}}).updateManyToMany(function(y,x){new An(x,y,function(M){return i[M].data.getId(i[M].dataIndex)},function(M){return n[M].data.getId(n[M].dataIndex)}).update(function(M,S){_(y[M],x[S])}).execute()}).execute(),o&&N(e,function(y){var x=y.data,M=x.hostModel,S=M&&t.getViewOfSeriesModel(M),w=Fl("update",M,0);S&&M.isAnimationEnabled()&&w&&w.duration>0&&S.group.traverse(function(T){T instanceof ut&&!T.animators.length&&T.animateFrom({style:{opacity:0}},w)})})}function a$(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function o$(r){return pe(r)?r.sort().join(","):r}function oh(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function Iwe(r,e){var t=ke(),i=ke(),n=ke();N(r.oldSeries,function(o,s){var l=r.oldDataGroupIds[s],u=r.oldData[s],c=a$(o),f=o$(c);i.set(f,{dataGroupId:l,data:u}),pe(c)&&N(c,function(h){n.set(h,{key:f,dataGroupId:l,data:u})})});function a(o){t.get(o)&&tH("Duplicated seriesKey in universalTransition "+o)}return N(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),u=a$(o),c=o$(u),f=i.get(c);if(f)t.set(c,{oldSeries:[{dataGroupId:f.dataGroupId,divide:oh(f.data),data:f.data}],newSeries:[{dataGroupId:s,divide:oh(l),data:l}]});else if(pe(u)){var h=[];N(u,function(g){var m=i.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:oh(m.data),data:m.data})}),h.length&&t.set(c,{oldSeries:h,newSeries:[{dataGroupId:s,data:l,divide:oh(l)}]})}else{var p=n.get(u);if(p){var d=t.get(p.key);d||(d={oldSeries:[{dataGroupId:p.dataGroupId,data:p.data,divide:oh(p.data)}],newSeries:[]},t.set(p.key,d)),d.newSeries.push({dataGroupId:s,data:l,divide:oh(l)})}}}}),t}function s$(r,e){for(var t=0;t<r.length;t++){var i=e.seriesIndex!=null&&e.seriesIndex===r[t].seriesIndex||e.seriesId!=null&&e.seriesId===r[t].id;if(i)return t}}function Nwe(r,e,t,i){var n=[],a=[];N($t(r.from),function(o){var s=s$(e.oldSeries,o);s>=0&&n.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:oh(e.oldData[s]),groupIdDim:o.dimension})}),N($t(r.to),function(o){var s=s$(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:oh(l),groupIdDim:o.dimension})}}),n.length>0&&a.length>0&&u$(n,a,i)}function m3(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){N($t(i.seriesTransition),function(n){N($t(n.to),function(a){for(var o=i.updatedSeries,s=0;s<o.length;s++)(a.seriesIndex!=null&&a.seriesIndex===o[s].seriesIndex||a.seriesId!=null&&a.seriesId===o[s].id)&&(o[s][k_]=!0)})})}),r.registerUpdateLifecycle("series:transition",function(e,t,i){var n=Cwe(t);if(n.oldSeries&&i.updatedSeries&&i.optionChanged){var a=i.seriesTransition;if(a)N($t(a),function(p){Nwe(p,n,i,t)});else{var o=Iwe(n,i);N(o.keys(),function(p){var d=o.get(p);u$(d.oldSeries,d.newSeries,t)})}N(i.updatedSeries,function(p){p[k_]&&(p[k_]=!1)})}for(var s=e.getSeries(),l=n.oldSeries=[],u=n.oldDataGroupIds=[],c=n.oldData=[],f=0;f<s.length;f++){var h=s[f].getData();h.count()<l$&&(l.push(s[f]),u.push(s[f].get("dataGroupId")),c.push(h))}})}It([Z2]);It([q2]);It([tI,nI,cI,SI,wI,VI,JI,sN,CN,RN,PN,jN,QN,rU,lU,uU,cU,fU,mU,yU,MU,HU]);It(KU);It(tO);It(Sx);It(nO);It(Nx);It(oO);It(lO);It(yO);It(MO);It(nl);It(CO);It(RO);It(IO);It(BO);It(VO);It(GO);It(KO);It(t3);It(qx);It(Kx);It(n3);It($x);It(Qx);It(s3);It(u3);It(c3);It(m3);It(E2);var Uwe=["chart"],f$=(()=>{let e=class e{constructor(){this.chartInstance=null,this.options={},this.defaultTooltipOptions={tooltip:{trigger:"item",borderColor:"#00eff8",backgroundColor:"#12192C",padding:[6,14,6,14],textStyle:{fontSize:14,color:"#74FAFB"},position:"top",axisPointer:{type:"shadow"}},series:[{type:"gauge",startAngle:180,endAngle:0,center:["50%","75%"],radius:"90%",min:0,max:1,splitNumber:8,axisLine:{lineStyle:{width:6,color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},pointer:{icon:"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",length:"12%",width:20,offsetCenter:[0,"-60%"],itemStyle:{color:"auto"}},axisTick:{length:12,lineStyle:{color:"auto",width:2}},splitLine:{length:20,lineStyle:{color:"auto",width:5}},axisLabel:{color:"#464646",fontSize:20,distance:-60,rotate:"tangential",formatter:function(i){return""}},title:{offsetCenter:[0,"-10%"],fontSize:20},tooltip:{trigger:"item",borderColor:"#00eff8",backgroundColor:"#12192C",padding:[6,14,6,14],textStyle:{fontSize:14,color:"#74FAFB"},position:"top",axisPointer:{type:"shadow"}},detail:{fontSize:30,offsetCenter:[0,"-5%"],valueAnimation:!0,formatter:function(i){return Math.round(i*100)+""},color:"inherit"}}]}}ngOnInit(){console.log("ChartComponentComponent ngOnInit"),this.initEcharts()}ngOnChanges(i){i.options&&!i.options.isFirstChange()&&(console.log("ChartComponentComponent ngOnChanges"),this.updateChartOptions())}ngOnDestroy(){this.chartInstance&&(console.log("ChartComponentComponent ngOnInit"),this.chartInstance.dispose())}initEcharts(){let i=this.chartContainer.nativeElement;this.chartInstance=P6(i,"dark");let n=XM(XM({},this.defaultTooltipOptions),this.options);this.chartInstance.setOption(n)}updateChartOptions(){this.chartInstance&&this.chartInstance.setOption(this.options)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["app-chart-component"]],viewQuery:function(n,a){if(n&1&&Tc(Uwe,7),n&2){let o;oa(o=sa())&&(a.chartContainer=o.first)}},inputs:{options:"options"},standalone:!0,features:[R0,ui],decls:2,vars:0,consts:[[2,"width","100%","height","100%"],["chart",""]],template:function(n,a){n&1&&Yr(0,"div",0,1)}});let r=e;return r})();var sh=["*"];function Owe(r,e){if(r&1&&Yr(0,"nz-avatar",3),r&2){let t=Nr();Tt("nzSrc",t.nzSrc)}}function zwe(r,e){r&1&&Li(0,0,["*ngIf","!nzSrc"])}function Fwe(r,e){if(r&1&&Yr(0,"nz-list-item-meta-avatar",3),r&2){let t=Nr();Tt("nzSrc",t.avatarStr)}}function Bwe(r,e){if(r&1&&(Jt(0,"nz-list-item-meta-avatar"),dV(1,4),nr()),r&2){let t=Nr();Ot(),Tt("ngTemplateOutlet",t.avatarTpl)}}function kwe(r,e){if(r&1&&(Sl(0),Wi(1),Ml()),r&2){let t=Nr(3);Ot(),ym(t.nzTitle)}}function Vwe(r,e){if(r&1&&(Jt(0,"nz-list-item-meta-title"),Pr(1,kwe,2,1,"ng-container",6),nr()),r&2){let t=Nr(2);Ot(),Tt("nzStringTemplateOutlet",t.nzTitle)}}function Gwe(r,e){if(r&1&&(Sl(0),Wi(1),Ml()),r&2){let t=Nr(3);Ot(),ym(t.nzDescription)}}function Hwe(r,e){if(r&1&&(Jt(0,"nz-list-item-meta-description"),Pr(1,Gwe,2,1,"ng-container",6),nr()),r&2){let t=Nr(2);Ot(),Tt("nzStringTemplateOutlet",t.nzDescription)}}function Wwe(r,e){if(r&1&&(Jt(0,"div",5),Pr(1,Vwe,2,1,"nz-list-item-meta-title",1)(2,Hwe,2,1,"nz-list-item-meta-description",1),Li(3,1),Li(4,2),nr()),r&2){let t=Nr();Ot(),Tt("ngIf",t.nzTitle&&!t.titleComponent),Ot(),Tt("ngIf",t.nzDescription&&!t.descriptionComponent)}}var Xwe=[[["nz-list-item-meta-avatar"]],[["nz-list-item-meta-title"]],[["nz-list-item-meta-description"]]],Ywe=["nz-list-item-meta-avatar","nz-list-item-meta-title","nz-list-item-meta-description"];function qwe(r,e){r&1&&Li(0)}var Zwe=["nz-list-item-actions",""];function jwe(r,e){}function Kwe(r,e){r&1&&Yr(0,"em",3)}function Jwe(r,e){if(r&1&&(Jt(0,"li"),Pr(1,jwe,0,0,"ng-template",1)(2,Kwe,1,0,"em",2),nr()),r&2){let t=e.$implicit,i=e.last;Ot(),Tt("ngTemplateOutlet",t),Ot(),Tt("ngIf",!i)}}function $we(r,e){}var g$=(r,e)=>({$implicit:r,index:e});function Qwe(r,e){if(r&1&&(Sl(0),Pr(1,$we,0,0,"ng-template",9),Ml()),r&2){let t=e.$implicit,i=e.index,n=Nr(2);Ot(),Tt("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",rL(2,g$,t,i))}}function e1e(r,e){if(r&1&&(Jt(0,"div",7),Pr(1,Qwe,2,5,"ng-container",8),Li(2,4),nr()),r&2){let t=Nr();Ot(),Tt("ngForOf",t.nzDataSource)}}function t1e(r,e){if(r&1&&(Sl(0),Wi(1),Ml()),r&2){let t=Nr(2);Ot(),ym(t.nzHeader)}}function r1e(r,e){if(r&1&&(Jt(0,"nz-list-header"),Pr(1,t1e,2,1,"ng-container",10),nr()),r&2){let t=Nr();Ot(),Tt("nzStringTemplateOutlet",t.nzHeader)}}function i1e(r,e){r&1&&Yr(0,"div"),r&2&&hV("min-height",53,"px")}function n1e(r,e){}function a1e(r,e){if(r&1&&(Jt(0,"div",13),Pr(1,n1e,0,0,"ng-template",9),nr()),r&2){let t=e.$implicit,i=e.index,n=Nr(2);Tt("nzSpan",n.nzGrid.span||null)("nzXs",n.nzGrid.xs||null)("nzSm",n.nzGrid.sm||null)("nzMd",n.nzGrid.md||null)("nzLg",n.nzGrid.lg||null)("nzXl",n.nzGrid.xl||null)("nzXXl",n.nzGrid.xxl||null),Ot(),Tt("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",rL(9,g$,t,i))}}function o1e(r,e){if(r&1&&(Jt(0,"div",11),Pr(1,a1e,2,12,"div",12),nr()),r&2){let t=Nr();Tt("nzGutter",t.nzGrid.gutter||null),Ot(),Tt("ngForOf",t.nzDataSource)}}function s1e(r,e){if(r&1&&Yr(0,"nz-list-empty",14),r&2){let t=Nr();Tt("nzNoResult",t.nzNoResult)}}function l1e(r,e){if(r&1&&(Sl(0),Wi(1),Ml()),r&2){let t=Nr(2);Ot(),ym(t.nzFooter)}}function u1e(r,e){if(r&1&&(Jt(0,"nz-list-footer"),Pr(1,l1e,2,1,"ng-container",10),nr()),r&2){let t=Nr();Ot(),Tt("nzStringTemplateOutlet",t.nzFooter)}}function c1e(r,e){}function f1e(r,e){}function h1e(r,e){if(r&1&&(Jt(0,"nz-list-pagination"),Pr(1,f1e,0,0,"ng-template",6),nr()),r&2){let t=Nr();Ot(),Tt("ngTemplateOutlet",t.nzPagination)}}var p1e=[[["nz-list-header"]],[["nz-list-footer"],["","nz-list-footer",""]],[["nz-list-load-more"],["","nz-list-load-more",""]],[["nz-list-pagination"],["","nz-list-pagination",""]],"*"],d1e=["nz-list-header","nz-list-footer, [nz-list-footer]","nz-list-load-more, [nz-list-load-more]","nz-list-pagination, [nz-list-pagination]","*"];function m1e(r,e){if(r&1&&Yr(0,"ul",6),r&2){let t=Nr(2);Tt("nzActions",t.nzActions)}}function v1e(r,e){if(r&1&&(Pr(0,m1e,1,1,"ul",5),Li(1)),r&2){let t=Nr();Tt("ngIf",t.nzActions&&t.nzActions.length>0)}}function g1e(r,e){if(r&1&&(Sl(0),Wi(1),Ml()),r&2){let t=Nr(3);Ot(),ym(t.nzContent)}}function y1e(r,e){if(r&1&&(Sl(0),Pr(1,g1e,2,1,"ng-container",8),Ml()),r&2){let t=Nr(2);Ot(),Tt("nzStringTemplateOutlet",t.nzContent)}}function _1e(r,e){if(r&1&&(Li(0,1),Li(1,2),Pr(2,y1e,2,1,"ng-container",7)),r&2){let t=Nr();Ot(2),Tt("ngIf",t.nzContent)}}function x1e(r,e){r&1&&Li(0,3)}function S1e(r,e){}function M1e(r,e){}function b1e(r,e){}function w1e(r,e){}function T1e(r,e){if(r&1&&Pr(0,S1e,0,0,"ng-template",9)(1,M1e,0,0,"ng-template",9)(2,b1e,0,0,"ng-template",9)(3,w1e,0,0,"ng-template",9),r&2){let t=Nr(),i=vu(3),n=vu(5),a=vu(1);Tt("ngTemplateOutlet",i),Ot(),Tt("ngTemplateOutlet",t.nzExtra),Ot(),Tt("ngTemplateOutlet",n),Ot(),Tt("ngTemplateOutlet",a)}}function E1e(r,e){}function A1e(r,e){}function C1e(r,e){}function R1e(r,e){if(r&1&&(Jt(0,"nz-list-item-extra"),Pr(1,C1e,0,0,"ng-template",9),nr()),r&2){let t=Nr(2);Ot(),Tt("ngTemplateOutlet",t.nzExtra)}}function L1e(r,e){}function P1e(r,e){if(r&1&&(Sl(0),Jt(1,"div",10),Pr(2,E1e,0,0,"ng-template",9)(3,A1e,0,0,"ng-template",9),nr(),Pr(4,R1e,2,1,"nz-list-item-extra",7)(5,L1e,0,0,"ng-template",9),Ml()),r&2){let t=Nr(),i=vu(3),n=vu(1),a=vu(5);Ot(2),Tt("ngTemplateOutlet",i),Ot(),Tt("ngTemplateOutlet",n),Ot(),Tt("ngIf",t.nzExtra),Ot(),Tt("ngTemplateOutlet",a)}}var D1e=[[["nz-list-item-actions"],["","nz-list-item-actions",""]],[["nz-list-item-meta"],["","nz-list-item-meta",""]],"*",[["nz-list-item-extra"],["","nz-list-item-extra",""]]],I1e=["nz-list-item-actions, [nz-list-item-actions]","nz-list-item-meta, [nz-list-item-meta]","*","nz-list-item-extra, [nz-list-item-extra]"],h$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-item-meta-title"]],exportAs:["nzListItemMetaTitle"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:2,vars:0,consts:[[1,"ant-list-item-meta-title"]],template:function(n,a){n&1&&(Wo(),Jt(0,"h4",0),Li(1),nr())},encapsulation:2,changeDetection:0});let r=e;return r})(),p$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-item-meta-description"]],exportAs:["nzListItemMetaDescription"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:2,vars:0,consts:[[1,"ant-list-item-meta-description"]],template:function(n,a){n&1&&(Wo(),Jt(0,"div",0),Li(1),nr())},encapsulation:2,changeDetection:0});let r=e;return r})(),y$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-item-meta-avatar"]],inputs:{nzSrc:"nzSrc"},exportAs:["nzListItemMetaAvatar"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:3,vars:2,consts:[[1,"ant-list-item-meta-avatar"],[3,"nzSrc",4,"ngIf"],[4,"ngIf"],[3,"nzSrc"]],template:function(n,a){n&1&&(Wo(),Jt(0,"div",0),Pr(1,Owe,1,1,"nz-avatar",1)(2,zwe,1,0,"ng-content",2),nr()),n&2&&(Ot(),Tt("ngIf",a.nzSrc),Ot(),Tt("ngIf",!a.nzSrc))},dependencies:[Tl,EV,Ec],encapsulation:2,changeDetection:0});let r=e;return r})(),N1e=(()=>{let e=class e{set nzAvatar(i){i instanceof tL?(this.avatarStr="",this.avatarTpl=i):this.avatarStr=i}constructor(i){this.elementRef=i,this.avatarStr=""}};e.\u0275fac=function(n){return new(n||e)(Ho(qM))},e.\u0275cmp=li({type:e,selectors:[["nz-list-item-meta"],["","nz-list-item-meta",""]],contentQueries:function(n,a,o){if(n&1&&(wc(o,p$,5),wc(o,h$,5)),n&2){let s;oa(s=sa())&&(a.descriptionComponent=s.first),oa(s=sa())&&(a.titleComponent=s.first)}},hostAttrs:[1,"ant-list-item-meta"],inputs:{nzAvatar:"nzAvatar",nzTitle:"nzTitle",nzDescription:"nzDescription"},exportAs:["nzListItemMeta"],standalone:!0,features:[ui],ngContentSelectors:Ywe,decls:4,vars:3,consts:[[3,"nzSrc",4,"ngIf"],[4,"ngIf"],["class","ant-list-item-meta-content",4,"ngIf"],[3,"nzSrc"],[3,"ngTemplateOutlet"],[1,"ant-list-item-meta-content"],[4,"nzStringTemplateOutlet"]],template:function(n,a){n&1&&(Wo(Xwe),Pr(0,Fwe,1,1,"nz-list-item-meta-avatar",0)(1,Bwe,2,1,"nz-list-item-meta-avatar",1),Li(2),Pr(3,Wwe,5,2,"div",2)),n&2&&(Tt("ngIf",a.avatarStr),Ot(),Tt("ngIf",a.avatarTpl),Ot(2),Tt("ngIf",a.nzTitle||a.nzDescription||a.descriptionComponent||a.titleComponent))},dependencies:[y$,Ec,L0,h$,jM,ZM,p$],encapsulation:2,changeDetection:0});let r=e;return r})(),d$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-item-extra"],["","nz-list-item-extra",""]],hostAttrs:[1,"ant-list-item-extra"],exportAs:["nzListItemExtra"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:1,vars:0,template:function(n,a){n&1&&(Wo(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),U1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-item-action"]],viewQuery:function(n,a){if(n&1&&Tc(tL,5),n&2){let o;oa(o=sa())&&(a.templateRef=o.first)}},exportAs:["nzListItemAction"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:1,vars:0,template:function(n,a){n&1&&(Wo(),Pr(0,qwe,1,0,"ng-template"))},encapsulation:2,changeDetection:0});let r=e;return r})(),O1e=(()=>{let e=class e{constructor(i,n,a){this.ngZone=i,this.nzActions=[],this.actions=[],this.inputActionChanges$=new ZR,this.contentChildrenChanges$=iV(()=>this.nzListItemActions?rV(null):this.ngZone.onStable.pipe(aV(1),this.enterZone(),oV(()=>this.nzListItemActions.changes.pipe(sV(this.nzListItemActions))))),nV(this.contentChildrenChanges$,this.inputActionChanges$).pipe(jR(a)).subscribe(()=>{this.nzActions.length?this.actions=this.nzActions:this.actions=this.nzListItemActions.map(o=>o.templateRef),n.detectChanges()})}ngOnChanges(){this.inputActionChanges$.next(null)}enterZone(){return i=>new eV(n=>i.subscribe({next:a=>this.ngZone.run(()=>n.next(a))}))}};e.\u0275fac=function(n){return new(n||e)(Ho(fV),Ho(KR),Ho(JM))},e.\u0275cmp=li({type:e,selectors:[["ul","nz-list-item-actions",""]],contentQueries:function(n,a,o){if(n&1&&wc(o,U1e,4),n&2){let s;oa(s=sa())&&(a.nzListItemActions=s)}},hostAttrs:[1,"ant-list-item-action"],inputs:{nzActions:"nzActions"},exportAs:["nzListItemActions"],standalone:!0,features:[vV([JM]),R0,ui],attrs:Zwe,decls:1,vars:1,consts:[[4,"ngFor","ngForOf"],[3,"ngTemplateOutlet"],["class","ant-list-item-action-split",4,"ngIf"],[1,"ant-list-item-action-split"]],template:function(n,a){n&1&&Pr(0,Jwe,3,2,"li",0),n&2&&Tt("ngForOf",a.actions)},dependencies:[iL,L0,Ec],encapsulation:2,changeDetection:0});let r=e;return r})(),_$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-empty"]],hostAttrs:[1,"ant-list-empty-text"],inputs:{nzNoResult:"nzNoResult"},exportAs:["nzListHeader"],standalone:!0,features:[ui],decls:1,vars:2,consts:[[3,"nzComponentName","specificContent"]],template:function(n,a){n&1&&Yr(0,"nz-embed-empty",0),n&2&&Tt("nzComponentName","list")("specificContent",a.nzNoResult)},dependencies:[bV,MV],encapsulation:2,changeDetection:0});let r=e;return r})(),z1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-header"]],hostAttrs:[1,"ant-list-header"],exportAs:["nzListHeader"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:1,vars:0,template:function(n,a){n&1&&(Wo(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),m$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-footer"]],hostAttrs:[1,"ant-list-footer"],exportAs:["nzListFooter"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:1,vars:0,template:function(n,a){n&1&&(Wo(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),v$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["nz-list-pagination"]],hostAttrs:[1,"ant-list-pagination"],exportAs:["nzListPagination"],standalone:!0,features:[ui],ngContentSelectors:sh,decls:1,vars:0,template:function(n,a){n&1&&(Wo(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),F1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=cV({type:e,selectors:[["nz-list-load-more"]],exportAs:["nzListLoadMoreDirective"],standalone:!0});let r=e;return r})();var x$=(()=>{let e=class e{get itemLayoutNotify$(){return this.itemLayoutNotifySource.asObservable()}constructor(i){this.directionality=i,this.nzBordered=!1,this.nzGrid="",this.nzItemLayout="horizontal",this.nzRenderItem=null,this.nzLoading=!1,this.nzLoadMore=null,this.nzSize="default",this.nzSplit=!0,this.hasSomethingAfterLastItem=!1,this.dir="ltr",this.itemLayoutNotifySource=new tV(this.nzItemLayout),this.destroy$=new ZR}ngOnInit(){this.dir=this.directionality.value,this.directionality.change?.pipe(jR(this.destroy$)).subscribe(i=>{this.dir=i})}getSomethingAfterLastItem(){return!!(this.nzLoadMore||this.nzPagination||this.nzFooter||this.nzListFooterComponent||this.nzListPaginationComponent||this.nzListLoadMoreDirective)}ngOnChanges(i){i.nzItemLayout&&this.itemLayoutNotifySource.next(this.nzItemLayout)}ngOnDestroy(){this.itemLayoutNotifySource.unsubscribe(),this.destroy$.next(),this.destroy$.complete()}ngAfterContentInit(){this.hasSomethingAfterLastItem=this.getSomethingAfterLastItem()}};e.\u0275fac=function(n){return new(n||e)(Ho(xV,8))},e.\u0275cmp=li({type:e,selectors:[["nz-list"],["","nz-list",""]],contentQueries:function(n,a,o){if(n&1&&(wc(o,m$,5),wc(o,v$,5),wc(o,F1e,5)),n&2){let s;oa(s=sa())&&(a.nzListFooterComponent=s.first),oa(s=sa())&&(a.nzListPaginationComponent=s.first),oa(s=sa())&&(a.nzListLoadMoreDirective=s.first)}},hostAttrs:[1,"ant-list"],hostVars:16,hostBindings:function(n,a){n&2&&JR("ant-list-rtl",a.dir==="rtl")("ant-list-vertical",a.nzItemLayout==="vertical")("ant-list-lg",a.nzSize==="large")("ant-list-sm",a.nzSize==="small")("ant-list-split",a.nzSplit)("ant-list-bordered",a.nzBordered)("ant-list-loading",a.nzLoading)("ant-list-something-after-last-item",a.hasSomethingAfterLastItem)},inputs:{nzDataSource:"nzDataSource",nzBordered:"nzBordered",nzGrid:"nzGrid",nzHeader:"nzHeader",nzFooter:"nzFooter",nzItemLayout:"nzItemLayout",nzRenderItem:"nzRenderItem",nzLoading:"nzLoading",nzLoadMore:"nzLoadMore",nzPagination:"nzPagination",nzSize:"nzSize",nzSplit:"nzSplit",nzNoResult:"nzNoResult"},exportAs:["nzList"],standalone:!0,features:[R0,ui],ngContentSelectors:d1e,decls:15,vars:9,consts:[["itemsTpl",""],[4,"ngIf"],[3,"nzSpinning"],[3,"min-height",4,"ngIf"],["nz-row","",3,"nzGutter",4,"ngIf","ngIfElse"],[3,"nzNoResult",4,"ngIf"],[3,"ngTemplateOutlet"],[1,"ant-list-items"],[4,"ngFor","ngForOf"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"nzStringTemplateOutlet"],["nz-row","",3,"nzGutter"],["nz-col","",3,"nzSpan","nzXs","nzSm","nzMd","nzLg","nzXl","nzXXl",4,"ngFor","ngForOf"],["nz-col","",3,"nzSpan","nzXs","nzSm","nzMd","nzLg","nzXl","nzXXl"],[3,"nzNoResult"]],template:function(n,a){if(n&1&&(Wo(p1e),Pr(0,e1e,3,1,"ng-template",null,0,_m)(2,r1e,2,1,"nz-list-header",1),Li(3),Jt(4,"nz-spin",2),Sl(5),Pr(6,i1e,1,2,"div",3)(7,o1e,2,2,"div",4)(8,s1e,1,1,"nz-list-empty",5),Ml(),nr(),Pr(9,u1e,2,1,"nz-list-footer",1),Li(10,1),Pr(11,c1e,0,0,"ng-template",6),Li(12,2),Pr(13,h1e,2,1,"nz-list-pagination",1),Li(14,3)),n&2){let o=vu(1);Ot(2),Tt("ngIf",a.nzHeader),Ot(2),Tt("nzSpinning",a.nzLoading),Ot(2),Tt("ngIf",a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),Ot(),Tt("ngIf",a.nzGrid&&a.nzDataSource)("ngIfElse",o),Ot(),Tt("ngIf",!a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),Ot(),Tt("ngIf",a.nzFooter),Ot(2),Tt("ngTemplateOutlet",a.nzLoadMore),Ot(2),Tt("ngIf",a.nzPagination)}},dependencies:[L0,iL,z1e,Ec,jM,ZM,bl,TV,wl,Sm,xm,_$,m$,v$],encapsulation:2,changeDetection:0});let r=e;return C0([P0()],r.prototype,"nzBordered",void 0),C0([P0()],r.prototype,"nzLoading",void 0),C0([P0()],r.prototype,"nzSplit",void 0),r})(),B1e=(()=>{let e=class e{get isVerticalAndExtra(){return this.itemLayout==="vertical"&&(!!this.listItemExtraDirective||!!this.nzExtra)}constructor(i,n){this.parentComp=i,this.cdr=n,this.nzActions=[],this.nzExtra=null,this.nzNoFlex=!1}ngAfterViewInit(){this.itemLayout$=this.parentComp.itemLayoutNotify$.subscribe(i=>{this.itemLayout=i,this.cdr.detectChanges()})}ngOnDestroy(){this.itemLayout$&&this.itemLayout$.unsubscribe()}};e.\u0275fac=function(n){return new(n||e)(Ho(x$),Ho(KR))},e.\u0275cmp=li({type:e,selectors:[["nz-list-item"],["","nz-list-item",""]],contentQueries:function(n,a,o){if(n&1&&wc(o,d$,5),n&2){let s;oa(s=sa())&&(a.listItemExtraDirective=s.first)}},hostAttrs:[1,"ant-list-item"],hostVars:2,hostBindings:function(n,a){n&2&&JR("ant-list-item-no-flex",a.nzNoFlex)},inputs:{nzActions:"nzActions",nzContent:"nzContent",nzExtra:"nzExtra",nzNoFlex:"nzNoFlex"},exportAs:["nzListItem"],standalone:!0,features:[ui],ngContentSelectors:I1e,decls:9,vars:2,consts:[["actionsTpl",""],["contentTpl",""],["extraTpl",""],["simpleTpl",""],[4,"ngIf","ngIfElse"],["nz-list-item-actions","",3,"nzActions",4,"ngIf"],["nz-list-item-actions","",3,"nzActions"],[4,"ngIf"],[4,"nzStringTemplateOutlet"],[3,"ngTemplateOutlet"],[1,"ant-list-item-main"]],template:function(n,a){if(n&1&&(Wo(D1e),Pr(0,v1e,2,1,"ng-template",null,0,_m)(2,_1e,3,1,"ng-template",null,1,_m)(4,x1e,1,0,"ng-template",null,2,_m)(6,T1e,4,4,"ng-template",null,3,_m)(8,P1e,6,4,"ng-container",4)),n&2){let o=vu(7);Ot(8),Tt("ngIf",a.isVerticalAndExtra)("ngIfElse",o)}},dependencies:[O1e,Ec,jM,ZM,L0,d$],encapsulation:2,changeDetection:0});let r=e;return C0([P0()],r.prototype,"nzNoFlex",void 0),r})();var S$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=uV({type:e}),e.\u0275inj=lV({imports:[x$,_$,B1e,N1e,y$]});let r=e;return r})();var V1e=r=>({margin:r,width:"100%",height:"16rem"});function G1e(r,e){if(r&1&&Yr(0,"app-chart-component",28),r&2){let t=Nr(2).$implicit,i=Nr();pV(yV(3,V1e,"20px "+20/i.chartConfig.rowNumber+"px")),Tt("options",t.options)}}function H1e(r,e){if(r&1&&(Jt(0,"div",26),Pr(1,G1e,1,5,"app-chart-component",27),nr()),r&2){let t=Nr().$implicit,i=Nr();Tt("nzSpan",24/i.chartConfig.rowNumber),Ot(),Tt("ngIf",t.checked)}}function W1e(r,e){if(r&1&&Pr(0,H1e,2,2,"div",25),r&2){let t=e.$implicit;Tt("ngIf",t.checked)}}function X1e(r,e){if(r&1&&(Jt(0,"div",4)(1,"div",29),Yr(2,"app-chart-component",30),nr()()),r&2){let t=e.$implicit;Ot(2),Tt("options",t)}}var M$=(()=>{let e=class e{handleCheckedItems(i){console.log("\u5F53\u524D\u9009\u4E2D\u7684\u9879\u76EE:",i)}constructor(i){this._mqttService=i,this.http=aa(Dc),this.modal=aa(Pc),this.chartConfig={rowNumber:1,optionsCheckList:[{label:"\u5168\u6C34",options:{},checked:!0},{label:"\u70ED\u503C",options:{},checked:!0},{label:"\u5168\u786B",options:{},checked:!1},{label:"\u5185\u6C34",options:{},checked:!1},{label:"\u7070\u5206",options:{},checked:!1},{label:"\u6325\u53D1\u5206",options:{},checked:!1}],optionBottomList:[{}],optionsList:[{label:"\u5168\u6C34",options:{},checked:!0},{label:"\u70ED\u503C",options:{},checked:!0}],tableList:[{coldef:[{headerName:"\u65F6\u95F4",field:"rwmc",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u7CFB\u7EDF/\u8BBE\u5907",field:"rwms",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u64CD\u4F5C\u63CF\u8FF0",field:"kssj",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u64CD\u4F5C\u4EBA\u5458",field:"jhwcsj",unSortIcon:!0,minWidth:void 0,flex:1}],rowData:[]},{coldef:[{headerName:"\u5E8F\u53F7",field:"rwmc",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u65F6\u95F4",field:"kssj",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",field:"rwms",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u7B49\u7EA7",field:"dqzt",unSortIcon:!0,minWidth:void 0,flex:1}],rowData:[]}]},this.chart_options={},this.chart_options0={},this.chart_options1={},this.chart_options2={},this.chart_options3={},this.chart_options4={},this.rowData=[],this.colDefs1=[{headerName:"\u65F6\u95F4",field:"rwmc",flex:1},{headerName:"\u7CFB\u7EDF/\u8BBE\u5907",field:"rwms",flex:1},{headerName:"\u64CD\u4F5C\u63CF\u8FF0",field:"kssj",flex:1},{headerName:"\u64CD\u4F5C\u4EBA\u5458",field:"jhwcsj",flex:1}],this.colDefs2=[{headerName:"\u5E8F\u53F7",field:"rwmc",flex:1},{headerName:"\u65F6\u95F4",field:"kssj",flex:2},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",field:"rwms",flex:1},{headerName:"\u7B49\u7EA7",field:"dqzt",flex:1.5}],this.subscription=this._mqttService.observe("s1").subscribe(n=>{let a=JSON.parse(n.payload.toString());console.log("Received message as object: ",a.msg),this.chart_options0=a.msg})}ngOnInit(){this.getServerConfig();for(var i=1;i<30;i++)this.rowData.push({rwmc:"\u4EFB\u52A1"+i,rwms:"\u4EFB\u52A1\u63CF\u8FF0"+i,kssj:"2024-1-"+i+" 13:38:"+i*11,jhwcsj:"2024-1-"+i+" 13:38:"+i*10,sfcq:"\u5426",dqzt:"\u6B63\u5E38",dqjd:"\u8282\u70B9"+i,sjwcsj:"2024-1-"+i+" 13:38:"+i*27,bjmc:"\u62A5\u8B665",bjms:"\u62A5\u8B66\u63CF\u8FF05",bjsj:"2024-1-"+i+" 13:38:"+i*12,gzyy:"-",clff:"-",tzsj:"2024-1-"+i+" 13:38:"+i*19,zycd:"\u4E00\u822C",tzmc:"\u7CFB\u7EDF\u63D0\u793A",tznr:"\u8D26\u6237\u767B\u5F55",fj:"-",cz:"\u64CD\u4F5C"});for(var n=[],a=[],o=[],s=100,i=0;i<s;i++){var l=Math.random()*1e3;a.push("category"+i),n.push([i,Mv.round(Math.max(0,l-Math.random()*100)),Mv.round(l+Math.random()*80)]),o.push(Mv.round(l,2))}this.chart_options={backgroundColor:"transparent",series:[{type:"gauge",startAngle:180,endAngle:0,center:["50%","75%"],radius:"90%",min:0,max:1,splitNumber:8,axisLine:{lineStyle:{width:6,color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},pointer:{icon:"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",length:"12%",width:20,offsetCenter:[0,"-60%"],itemStyle:{color:"auto"}},axisTick:{length:12,lineStyle:{color:"auto",width:2}},splitLine:{length:20,lineStyle:{color:"auto",width:5}},axisLabel:{color:"#464646",fontSize:20,distance:-60,rotate:"tangential",formatter:function(u){return""}},title:{offsetCenter:[0,"-10%"],fontSize:20},detail:{fontSize:30,offsetCenter:[0,"-5%"],valueAnimation:!0,formatter:function(u){return Math.round(u*100)+""},color:"inherit"},data:[{value:.9,name:""}]}]},this.chart_options0={backgroundColor:"transparent",series:[{type:"gauge",startAngle:180,endAngle:0,center:["50%","75%"],radius:"90%",min:0,max:1,splitNumber:8,axisLine:{lineStyle:{width:6,color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},pointer:{icon:"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",length:"12%",width:20,offsetCenter:[0,"-60%"],itemStyle:{color:"auto"}},axisTick:{length:12,lineStyle:{color:"auto",width:2}},splitLine:{length:20,lineStyle:{color:"auto",width:5}},axisLabel:{color:"#464646",fontSize:20,distance:-60,rotate:"tangential",formatter:function(u){return""}},title:{offsetCenter:[0,"0%"],fontSize:20},detail:{fontSize:30,offsetCenter:[0,"-5%"],valueAnimation:!0,formatter:function(u){return Math.round(u*100)+""},color:"inherit"},data:[{value:.97,name:""}]}]},this.chart_options1={title:{textStyle:{color:"#ffffff"},text:"\u5168\u6C34",subtext:"(kg/kg)"},legend:{data:["\u6D4B\u91CF\u503C","\u4E0A\u9650\u503C","\u4E0B\u9650\u503C"]},calculable:!0,xAxis:[{axisLine:{lineStyle:{color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},position:"bottom",type:"category",data:["1","2","3","4","5","6","7","8","9","10","11","12"]}],yAxis:[{type:"value"}],series:[{name:"\u6D4B\u91CF\u503C",type:"line",data:[100,155,139,199,220,160,120,182.2,150,155,160,180],markPoint:{data:[{name:"\u6700\u5927\u503C",value:220,xAxis:4,yAxis:220},{name:"\u6700\u5C0F\u503C",value:100,xAxis:0,yAxis:100}]},markLine:{data:[{type:"average",name:"\u5E73\u5747\u503C"}]}},{type:"custom",name:"error",itemStyle:{borderWidth:1.5},renderItem:function(u,c){var f=c.value(0),h=c.coord([f,c.value(1)]),p=c.coord([f,c.value(2)]),d=c.size([1,0])[0]*.1,g=c.style({stroke:c.visual("color"),fill:void 0});return{type:"group",children:[{type:"line",transition:["shape"],shape:{x1:h[0]-d,y1:h[1],x2:h[0]+d,y2:h[1]},style:g},{type:"line",transition:["shape"],shape:{x1:h[0],y1:h[1],x2:p[0],y2:p[1]},style:g},{type:"line",transition:["shape"],shape:{x1:p[0]-d,y1:p[1],x2:p[0]+d,y2:p[1]},style:g}]}},encode:{x:0,y:[1,2]},data:n,z:100}]},this.chart_options2={title:{text:"\u70ED\u503C",subtext:"(kg/kg)"},legend:{data:["\u8D85\u5DEE\u6837\u6570\u91CF","\u4E0D\u5408\u683C\u6837\u6570\u91CF"]},xAxis:[{type:"category",data:["1","2","3","4","5","6","7","8","9","10","11","12"]}],yAxis:[{type:"value"}],series:[{name:"\u8D85\u5DEE\u6837\u6570\u91CF",type:"line",data:[2,4.9,7,23.2,25.6,76.7,135.6,162.2,32.6,20,6.4,3.3],markPoint:{data:[{type:"max",name:"Max"},{type:"min",name:"Min"}]}},{name:"\u4E0D\u5408\u683C\u6837\u6570\u91CF",type:"bar",data:[2.6,5.9,9,26.4,28.7,70.7,175.6,182.2,48.7,18.8,6,2.3],markPoint:{data:[{name:"Max",value:182.2,xAxis:7,yAxis:183},{name:"Min",value:2.3,xAxis:11,yAxis:3}]},markLine:{data:[{type:"average",name:"Avg"}]}}],grid:{left:"3%",right:"3%",bottom:"3%",containLabel:!0},toolbox:{show:!1,feature:{dataView:{show:!0,readOnly:!1},magicType:{show:!0,type:["line","bar"]},restore:{show:!0},saveAsImage:{show:!0}}},calculable:!0},this.chart_options3={title:{text:"\u7164\u6837\u8D85\u5DEE\u7387"},grid:{top:"10%",left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:["\u8D85\u5DEE\u6837\u91CF","\u603B\u6837\u91CF"]},yAxis:{type:"value"},series:[{data:[3,16],label:{show:!0,position:"top",formatter:function(u){return u.value}},type:"bar"}]},this.chart_options4={title:{text:"\u7164\u6837\u5408\u683C\u7387",left:"center"},grid:{top:"10%",left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:["\u8D85\u5DEE\u6837\u91CF","\u603B\u6837\u91CF"]},yAxis:{type:"value"},series:[{data:[15,16],type:"bar",label:{show:!0,position:"top",formatter:function(u){return u.value}}}]},this.chartConfig.optionsCheckList[1].options=this.chart_options2,this.chartConfig.optionsCheckList[2].options=this.chart_options3,this.chartConfig.optionsCheckList[3].options=this.chart_options4,this.chartConfig.optionBottomList[0]=this.chart_options3,this.chartConfig.optionBottomList[1]=this.chart_options4}unsafePublish(i,n){this._mqttService.unsafePublish(i,n,{qos:1,retain:!0})}ngOnDestroy(){this.subscription.unsubscribe()}getServerConfig(){this.http.get("http://localhost:5006/api/config/s1").subscribe(i=>{this.chartConfig.optionsCheckList[0].options=i.data,console.log(i)})}};e.\u0275fac=function(n){return new(n||e)(Ho(QM))},e.\u0275cmp=li({type:e,selectors:[["app-data-v-s1"]],standalone:!0,features:[ui],decls:56,vars:13,consts:[["nz-row","",1,"s1-container",3,"nzGutter"],["nz-col","","nzSpan","8"],["title","\u7CFB\u7EDF\u72B6\u6001"],["nz-row","",2,"justify-content","center","align-items","center"],["nz-col","","nzSpan","12"],[1,"centered-element"],[2,"width","26rem","height","11rem",3,"options"],[1,"sys-status-title"],["title","\u7CFB\u7EDF\u64CD\u4F5C\u8BB0\u5F55",2,"margin-top","1rem"],[1,"ag-theme-datav",3,"rowData","columnDefs"],["title","\u7CFB\u7EDF\u62A5\u8B66\u4FE1\u606F",2,"margin-top","1rem"],["title","",2,"margin-top","1rem"],[1,"progress-container"],[1,"status-text"],[2,"width","100%",3,"nzPercent","nzStrokeColor"],[1,"status-ext-text"],[1,"progress-container","mt-sm"],["title",""],[2,"height","34.6rem"],["src","assets/dashboard/dashboard_ws_demo1.png",2,"width","100%"],["nz-row","",2,"justify-content","center","align-items","center","margin-top","0.5rem"],["nz-col","","nzSpan","12",1,"sys-status-title"],["title","\u5316\u9A8C\u7ED3\u679C",3,"showSetting","optionsList","onCheckedItemsChange"],["nz-row","",1,"scrollable-container"],["nz-row",""],["nz-col","","class","centered-element",3,"nzSpan",4,"ngIf"],["nz-col","",1,"centered-element",3,"nzSpan"],[3,"options","style",4,"ngIf"],[3,"options"],[1,"centered-element",2,"margin","2px"],[2,"width","26rem","height","11rem","margin-left","0.4rem",3,"options"],["nz-col","","class","centered-element",3,"nzSpan"]],template:function(n,a){n&1&&(Jt(0,"div",0)(1,"div",1)(2,"data-v-card",2)(3,"div",3)(4,"div",4)(5,"div",5),Yr(6,"app-chart-component",6),nr(),Jt(7,"div",7),Wi(8,"\u7CFB\u7EDF\u5065\u5EB7\u5EA6"),nr()(),Jt(9,"div",4)(10,"div",5),Yr(11,"app-chart-component",6),nr(),Jt(12,"div",7),Wi(13,"\u8BBE\u5907\u6295\u8FD0\u5EA6"),nr()()()(),Jt(14,"data-v-card",8),Yr(15,"ag-grid-angular",9),nr(),Jt(16,"data-v-card",10),Yr(17,"ag-grid-angular",9),nr(),Jt(18,"data-v-card",11)(19,"div",12)(20,"span",13),Wi(21,"\u5316\u9A8C\u6548\u7387\uFF1A"),nr(),Yr(22,"nz-progress",14),Jt(23,"span",15),Wi(24,"\uFF0816/25\uFF09"),nr()(),Jt(25,"div",16)(26,"span",13),Wi(27,"\u5B8C \u6210 \u7387 \uFF1A"),nr(),Yr(28,"nz-progress",14),Jt(29,"span",15),Wi(30,"\uFF0812/20\uFF09"),nr()()()(),Jt(31,"div",1)(32,"data-v-card",17)(33,"div",18),Yr(34,"img",19),Jt(35,"div",20)(36,"div",21),Wi(37," \u673A\u5668\u4EBA "),nr(),Jt(38,"div",21),Wi(39," \u5168\u786B\u4EEA "),nr(),Jt(40,"div",21),Wi(41," \u5168\u6C34\u5206\u6790\u4EEA "),nr(),Jt(42,"div",21),Wi(43," \u6325\u53D1\u5206\u4EEA "),nr(),Jt(44,"div",21),Wi(45," \u91CF\u70ED\u4EEA "),nr(),Jt(46,"div",21),Wi(47," \u78B3\u6C22\u6C2E\u5143\u7D20 "),nr()()()()(),Jt(48,"div",1)(49,"data-v-card",22),mV("onCheckedItemsChange",function(s){return a.handleCheckedItems(s)}),Jt(50,"div",23),QR(51,W1e,1,1,"div",31,$R),nr(),Jt(53,"div",24),QR(54,X1e,3,1,"div",4,$R),nr()()()()),n&2&&(Tt("nzGutter",16),Ot(6),Tt("options",a.chart_options),Ot(5),Tt("options",a.chart_options0),Ot(4),Tt("rowData",a.rowData)("columnDefs",a.colDefs1),Ot(2),Tt("rowData",a.rowData)("columnDefs",a.colDefs2),Ot(5),Tt("nzPercent",64)("nzStrokeColor","#74FAFB"),Ot(6),Tt("nzPercent",60)("nzStrokeColor","#74FAFB"),Ot(21),Tt("showSetting",!0)("optionsList",a.chartConfig.optionsCheckList),Ot(2),eL(a.chartConfig.optionsCheckList),Ot(3),eL(a.chartConfig.optionBottomList))},dependencies:[_V,Ec,SV,af,AV,CV,$M,S$,Nc,Uc,$c,Yc,ef,tf,Qc,Kc,Ic,Hc,Xc,of,jc,qc,Sm,xm,wl,Cc,Vc,Gc,rf,Bc,Tl,Zc,Fc,Wc,kc,nf,Lc,Rc,Jc,zc,Ac,Oc,bl,f$],styles:[".dashboard-container[_ngcontent-%COMP%]{width:20rem;height:10rem;margin-top:-3rem;margin-bottom:-2rem}.sys-status-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600;color:#94ddf3;text-align:center}.ag-theme-datav[_ngcontent-%COMP%]{--ag-border-color: #74FAFB;--ag-foreground-color: #74FAFB;--ag-background-color: #0A1632;--ag-header-foreground-color: #74FAFB;--ag-header-background-color: #0A1632;--ag-odd-row-background-color: #0A1632;--ag-header-column-resize-handle-color: #7e2e84;--ag-font-size: 17px;--ag-font-family: monospace;height:5rem}.centered-element[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:100%}.status-container[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.5rem}.status-circle[_ngcontent-%COMP%]{width:18px;height:18px;border-radius:50%}.status-circle.red[_ngcontent-%COMP%]{background-color:red}.status-circle.green[_ngcontent-%COMP%]{background-color:green}.progress-container[_ngcontent-%COMP%]{display:flex;color:#fff}.progress-container[_ngcontent-%COMP%] .status-text[_ngcontent-%COMP%]{width:8rem;margin-left:6px;font-size:16px;font-weight:600;color:#74fafb}.progress-container[_ngcontent-%COMP%] .status-ext-text[_ngcontent-%COMP%]{margin-top:3px;font-size:12px}.progress-display[_ngcontent-%COMP%]{color:#fff;text-align:right}.statistic-item-container[_ngcontent-%COMP%]{display:flex;padding:1rem 0;color:#fff}.white-color-theme[_ngcontent-%COMP%]{color:#74fafb}.scrollable-container[_ngcontent-%COMP%]{scrollbar-color:auto;overflow-y:auto;width:100%;height:20rem} ::-webkit-scrollbar{width:10px} ::-webkit-scrollbar-track{background-color:#0a1632} ::-webkit-scrollbar-thumb{background-color:#74fafb;border-radius:2px} ::-webkit-scrollbar-thumb:hover{background-color:#74fafb}"]});let r=e;return r})();var Y1e=["myGrid"],q1e=()=>[12,12],b$=(()=>{let e=class e{constructor(i){this._mqttService=i,this.http=aa(Dc),this.modal=aa(Pc),this.elementRef=aa(qM),this.titleService=aa(KM),this.defaultColDef={width:170,editable:!1},this.gridThemedClass="ag-theme-quartz ag-theme-datav",this.rowData=[],this.colDefs1=[{headerName:"\u5E8F\u53F7",valueGetter:function(n){return parseInt(n.node.id)+1},width:90,sortable:!0,unSortIcon:!0,field:"xh"},{headerName:"\u4EFB\u52A1\u540D\u79F0",unSortIcon:!0,width:120,field:"rwmc"},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",unSortIcon:!0,field:"rwms",width:120},{headerName:"\u5F00\u59CB\u65F6\u95F4",headerClass:"ag-header-center",unSortIcon:!0,field:"kssj",width:180},{headerName:"\u8BA1\u5212\u5B8C\u6210\u65F6\u95F4",unSortIcon:!0,field:"jhwcsj",width:180},{headerName:"\u8D85\u671F",width:70,field:"sfcq"},{headerName:"\u64CD\u4F5C",width:90,autoHeaderHeight:!0,field:"cz",cellRenderer:D0}],this.colDefs2=[{headerName:"\u5E8F\u53F7",valueGetter:function(n){return parseInt(n.node.id)+1},width:90,unSortIcon:!0,field:"xh"},{headerName:"\u4EFB\u52A1\u540D\u79F0",unSortIcon:!0,field:"rwmc"},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",unSortIcon:!0,field:"rwms",minWidth:170,flex:1},{headerName:"\u5F00\u59CB\u65F6\u95F4",unSortIcon:!0,field:"kssj",minWidth:170,flex:1},{headerName:"\u5F53\u524D\u72B6\u6001",field:"dqzt"},{headerName:"\u5F53\u524D\u8282\u70B9",field:"dqjd"},{headerName:"\u5B9E\u9645\u5B8C\u6210\u65F6\u95F4",field:"sjwcsj",minWidth:170,flex:1},{headerName:"\u64CD\u4F5C",autoHeight:!0,width:110,field:"cz",cellRenderer:D0}],this.colDefs3=[{headerName:"\u5E8F\u53F7",valueGetter:function(n){return parseInt(n.node.id)+1},width:90,unSortIcon:!0,field:"xh"},{headerName:"\u62A5\u8B66\u540D\u79F0",unSortIcon:!0,field:"bjmc"},{headerName:"\u62A5\u8B66\u7B49\u7EA7",unSortIcon:!0,field:"bjdg"},{headerName:"\u62A5\u8B66\u63CF\u8FF0",unSortIcon:!0,field:"bjms",minWidth:170,flex:1},{headerName:"\u62A5\u8B66\u65F6\u95F4",unSortIcon:!0,field:"bjsj",minWidth:170,flex:1},{headerName:"\u64CD\u4F5C",autoHeight:!0,width:110,field:"cz",cellRenderer:D0},{headerName:"\u6545\u969C\u539F\u56E0",field:"gzyy"},{headerName:"\u5904\u7406\u65B9\u6CD5",field:"clff"},{headerName:"\u6CE8\u610F\u4E8B\u9879",field:"clff"}],this.colDefs4=[{headerName:"\u5E8F\u53F7",valueGetter:function(n){return parseInt(n.node.id)+1},width:90,unSortIcon:!0,field:"xh"},{headerName:"\u901A\u77E5\u65F6\u95F4",unSortIcon:!0,field:"tzsj",minWidth:170,flex:1},{headerName:"\u91CD\u8981\u7A0B\u5EA6",unSortIcon:!0,field:"zycd"},{headerName:"\u901A\u77E5\u540D\u79F0",unSortIcon:!0,field:"tzmc"},{headerName:"\u901A\u77E5\u5185\u5BB9",unSortIcon:!0,field:"tznr",minWidth:170,flex:1},{headerName:"\u9644\u4EF6",field:"fj"},{headerName:"\u64CD\u4F5C",autoHeight:!0,width:110,field:"cz",cellRenderer:D0}],this.client=i}ngOnInit(){this.titleService.setTitle("\u6211\u7684\u5DE5\u4F5C\u7AD9");for(var i=1;i<30;i++)this.rowData.push({rwmc:`\u4EFB\u52A1${i}`,rwms:`\u4EFB\u52A1\u63CF\u8FF0${i}`,kssj:`2024-1-${i} 13:38:${i*11}`,jhwcsj:`2024-1-${i} 13:38:${i*10}`,sfcq:"\u5426",dqzt:"\u6B63\u5E38",dqjd:`\u8282\u70B9${i}`,sjwcsj:`2024-1-${i} 13:38:${i*27}`,bjmc:"\u62A5\u8B665",bjms:"\u62A5\u8B66\u63CF\u8FF05",bjsj:`2024-1-${i} 13:38:${i*12}`,gzyy:"-",clff:"-",tzsj:`2024-1-${i} 13:38:${i*19}`,zycd:"\u4E00\u822C",tzmc:"\u7CFB\u7EDF\u63D0\u793A",tznr:"\u8D26\u6237\u767B\u5F55",fj:"-",cz:"\u64CD\u4F5C"})}ngAfterViewInit(){let i=this.elementRef.nativeElement.querySelector(".ag-theme-datav"),n=i.querySelector(".ag-body-viewport"),a=i.querySelector(".ag-scroller")}add(){}};e.\u0275fac=function(n){return new(n||e)(Ho(QM))},e.\u0275cmp=li({type:e,selectors:[["app-data-v-s1"]],viewQuery:function(n,a){if(n&1&&Tc(Y1e,5),n&2){let o;oa(o=sa())&&(a.grid=o.first)}},standalone:!0,features:[ui],decls:8,vars:15,consts:[["nz-row","",3,"nzGutter"],["title","\u5F85\u529E\u4EFB\u52A1",2,"width","50%",3,"defaultColDef","rowData","columnDefs","gridThemeClass"],["nz-col","","nzSpan","24","nzXs","24","nzSm","24","nzMd","12","nzLg","12","nzXl","12","nzXXl","12","title","\u5DF2\u529E\u4EFB\u52A1"],["gridThemeClass","ag-theme-quartz ag-theme-datav",2,"width","100%",3,"defaultColDef","rowData","columnDefs"],["nz-col","","nzSpan","24","nzXs","24","nzSm","24","nzMd","12","nzLg","12","nzXl","12","nzXXl","12","title","\u62A5\u8B66\u4FE1\u606F"],["nz-col","","nzSpan","24","nzXs","24","nzSm","24","nzMd","12","nzLg","12","nzXl","12","nzXXl","12","title","\u901A\u77E5"]],template:function(n,a){n&1&&(Jt(0,"div",0),Yr(1,"lj-app-ag-grid-component",1),Jt(2,"data-v-card",2),Yr(3,"app-ag-grid-component",3),nr(),Jt(4,"data-v-card",4),Yr(5,"app-ag-grid-component",3),nr(),Jt(6,"data-v-card",5),Yr(7,"app-ag-grid-component",3),nr()()),n&2&&(Tt("nzGutter",gV(14,q1e)),Ot(),Tt("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs1)("gridThemeClass",a.gridThemedClass),Ot(2),Tt("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs2),Ot(2),Tt("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs3),Ot(2),Tt("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs4))},dependencies:[RV,LV,wV,$M,Nc,Uc,$c,Yc,ef,tf,Qc,Kc,Ic,Hc,Xc,of,jc,qc,Sm,xm,wl,Cc,Vc,Gc,rf,af,Bc,Tl,Zc,Fc,Wc,kc,nf,Lc,Rc,Jc,zc,Ac,Oc,bl],styles:[".ag-header-center[_ngcontent-%COMP%] .ag-header-group-cell-label[_ngcontent-%COMP%], .ag-header-center[_ngcontent-%COMP%] .ag-header-cell-label[_ngcontent-%COMP%]{display:grid;justify-content:center;color:#000;text-align:center;background:#000} .ag-theme-datav .ag-row-selected .ag-ltr .ag-cell{color:red!important} .ag-theme-datav .ag-ltr .ag-row-focus{font-weight:600;color:red} .ag-theme-datav .ag-ltr .ag-row-focus .ag-cell-focus{border:#74FAFB} .ag-theme-datav .ag-ltr .ag-row-focus .ag-grid-button-style{color:red;border-color:red} .ag-theme-datav{--ag-border-color: #74FAFB;--ag-foreground-color: #74FAFB;--ag-background-color: #0A1632;--ag-header-foreground-color: #74FAFB;--ag-header-background-color: #0A1632;--ag-odd-row-background-color: #0A1632;--ag-header-column-resize-handle-color: #7e2e84;--ag-font-size: 12px;--ag-font-family: monospace;height:17rem;font-weight:700;border-width:3px} .ag-theme-datav .ag-header-cell-resize{--ag-header-column-resize-handle-color: #00eff8} .ag-theme-datav .ag-header-row{font-size:14px;font-weight:700} .ag-theme-datav .ag-root-wrapper{border-radius:0} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar{width:12em} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb{margin-left:40px;background-color:#00eff8;border:2px solid #00eff8} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-track{background-color:transparent;border-color:#00eff8} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb:hover{margin-left:40px;background-color:#00eff8} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb:active{background-color:#00eff8} .ag-body-vertical-scroll-viewport{scrollbar-color:auto} .ag-body-horizontal-scroll-viewport{scrollbar-color:auto} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar{height:14em;color:#000} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-track{background-color:transparent;border-color:#00eff8} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb:hover{background-color:#00eff8} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb:active{background-color:#00eff8} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb{background-color:#00eff8}"]});let r=e;return r})();var iS="162";var w$=0,Y3=1,T$=2;var OE=1,E$=2,al=3,Ao=0,_i=1,Co=2,vs=0,Xu=1,q3=2,Z3=3,j3=4,A$=5,Yu=100,C$=101,R$=102,K3=103,J3=104,L$=200,P$=201,D$=202,I$=203,nS=204,aS=205,N$=206,U$=207,O$=208,z$=209,F$=210,B$=211,k$=212,V$=213,G$=214,H$=0,W$=1,X$=2,cg=3,Y$=4,q$=5,Z$=6,j$=7,zE=0,K$=1,J$=2,gs=0,$$=1,Q$=2,eQ=3,tQ=4,rQ=5,iQ=6,nQ=7;var $3=300,ol=301,eu=302,oS=303,sS=304,lh=306,lS=1e3,ya=1001,uS=1002,Bi=1003,Q3=1004;var fg=1005;var Qi=1006,FE=1007;var sl=1008;var Ro=1009,aQ=1010,oQ=1011,hg=1012,BE=1013,Lo=1014,ja=1015,qu=1016,kE=1017,VE=1018,ys=1020,sQ=1021,Rn=1023,lQ=1024,uQ=1025,ll=1026,tu=1027,cQ=1028,GE=1029,fQ=1030,HE=1031,WE=1033,XE=33776,YE=33777,qE=33778,ZE=33779,ez=35840,tz=35841,rz=35842,iz=35843,jE=36196,nz=37492,az=37496,oz=37808,sz=37809,lz=37810,uz=37811,cz=37812,fz=37813,hz=37814,pz=37815,dz=37816,mz=37817,vz=37818,gz=37819,yz=37820,_z=37821,KE=36492,xz=36494,Sz=36495,hQ=36283,Mz=36284,bz=36285,wz=36286;var pQ=3200,dQ=3201,mQ=0,vQ=1,_s="",Ka="srgb",Ja="srgb-linear",pg="display-p3",vd="display-p3-linear",dg="linear",Hr="srgb",mg="rec709",vg="p3";var gd=7680;var Tz=519,gQ=512,yQ=513,_Q=514,JE=515,xQ=516,SQ=517,MQ=518,bQ=519,Ez=35044;var Az="300 es",cS=1035,$a=2e3,yd=2001;var Qa=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let a=0,o=n.length;a<o;a++)n[a].call(this,e);e.target=null}}};var Yn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var $E=Math.PI/180,fS=180/Math.PI;function ru(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Yn[r&255]+Yn[r>>8&255]+Yn[r>>16&255]+Yn[r>>24&255]+"-"+Yn[e&255]+Yn[e>>8&255]+"-"+Yn[e>>16&15|64]+Yn[e>>24&255]+"-"+Yn[t&63|128]+Yn[t>>8&255]+"-"+Yn[t>>16&255]+Yn[t>>24&255]+Yn[i&255]+Yn[i>>8&255]+Yn[i>>16&255]+Yn[i>>24&255]).toLowerCase()}function en(r,e,t){return Math.max(e,Math.min(t,r))}function wQ(r,e){return(r%e+e)%e}function QE(r,e,t){return(1-t)*r+t*e}function Cz(r){return(r&r-1)===0&&r!==0}function hS(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function gg(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function _a(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var Kt=class r{constructor(e=0,t=0){r.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(en(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*i-o*n+e.x,this.y=a*n+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};var Qt=class r{constructor(e,t,i,n,a,o,s,l,u){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u)}set(e,t,i,n,a,o,s,l,u){let c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=a,c[5]=l,c[6]=i,c[7]=o,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[3],l=i[6],u=i[1],c=i[4],f=i[7],h=i[2],p=i[5],d=i[8],g=n[0],m=n[3],v=n[6],_=n[1],y=n[4],x=n[7],M=n[2],S=n[5],w=n[8];return a[0]=o*g+s*_+l*M,a[3]=o*m+s*y+l*S,a[6]=o*v+s*x+l*w,a[1]=u*g+c*_+f*M,a[4]=u*m+c*y+f*S,a[7]=u*v+c*x+f*w,a[2]=h*g+p*_+d*M,a[5]=h*m+p*y+d*S,a[8]=h*v+p*x+d*w,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return t*o*c-t*s*u-i*a*c+i*s*l+n*a*u-n*o*l}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=c*o-s*u,h=s*l-c*a,p=u*a-o*l,d=t*f+i*h+n*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=f*g,e[1]=(n*u-c*i)*g,e[2]=(s*i-n*o)*g,e[3]=h*g,e[4]=(c*t-n*l)*g,e[5]=(n*a-s*t)*g,e[6]=p*g,e[7]=(i*l-u*t)*g,e[8]=(o*t-i*a)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,a,o,s){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*o+u*s)+o+e,-n*u,n*l,-n*(-u*o+l*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(Rz.makeScale(e,t)),this}rotate(e){return this.premultiply(Rz.makeRotation(-e)),this}translate(e,t){return this.premultiply(Rz.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Rz=new Qt;function eA(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function yg(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function EQ(){let r=yg("canvas");return r.style.display="block",r}var TQ={};function AQ(r){r in TQ||(TQ[r]=!0,console.warn(r))}var CQ=new Qt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),RQ=new Qt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),tA={[Ja]:{transfer:dg,primaries:mg,toReference:r=>r,fromReference:r=>r},[Ka]:{transfer:Hr,primaries:mg,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[vd]:{transfer:dg,primaries:vg,toReference:r=>r.applyMatrix3(RQ),fromReference:r=>r.applyMatrix3(CQ)},[pg]:{transfer:Hr,primaries:vg,toReference:r=>r.convertSRGBToLinear().applyMatrix3(RQ),fromReference:r=>r.applyMatrix3(CQ).convertLinearToSRGB()}},Z1e=new Set([Ja,vd]),Tr={enabled:!0,_workingColorSpace:Ja,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!Z1e.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;let i=tA[e].toReference,n=tA[t].fromReference;return n(i(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return tA[r].primaries},getTransfer:function(r){return r===_s?dg:tA[r].transfer}};function uh(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function rA(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var _g,xg=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{_g===void 0&&(_g=yg("canvas")),_g.width=e.width,_g.height=e.height;let i=_g.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=_g}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=yg("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),a=n.data;for(let o=0;o<a.length;o++)a[o]=uh(a[o]/255)*255;return i.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(uh(t[i]/255)*255):t[i]=uh(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}};var j1e=0,Sg=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:j1e++}),this.uuid=ru(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(n!==null){let a;if(Array.isArray(n)){a=[];for(let o=0,s=n.length;o<s;o++)n[o].isDataTexture?a.push(Lz(n[o].image)):a.push(Lz(n[o]))}else a=Lz(n);i.url=a}return t||(e.images[this.uuid]=i),i}};function Lz(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?xg.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var K1e=0,eo=(()=>{class r extends Qa{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=ya,a=ya,o=Qi,s=sl,l=Rn,u=Ro,c=r.DEFAULT_ANISOTROPY,f=_s){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:K1e++}),this.uuid=ru(),this.name="",this.source=new Sg(t),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=a,this.magFilter=o,this.minFilter=s,this.anisotropy=c,this.format=l,this.internalFormat=null,this.type=u,this.offset=new Kt(0,0),this.repeat=new Kt(1,1),this.center=new Kt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,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.internalFormat=t.internalFormat,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.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let i=t===void 0||typeof t=="string";if(!i&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),i||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==$3)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case lS:t.x=t.x-Math.floor(t.x);break;case ya:t.x=t.x<0?0:1;break;case uS:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case lS:t.y=t.y-Math.floor(t.y);break;case ya:t.y=t.y<0?0:1;break;case uS:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}}return r.DEFAULT_IMAGE=null,r.DEFAULT_MAPPING=$3,r.DEFAULT_ANISOTROPY=1,r})();var ni=class r{constructor(e=0,t=0,i=0,n=1){r.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*n+o[12]*a,this.y=o[1]*t+o[5]*i+o[9]*n+o[13]*a,this.z=o[2]*t+o[6]*i+o[10]*n+o[14]*a,this.w=o[3]*t+o[7]*i+o[11]*n+o[15]*a,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,a,l=e.elements,u=l[0],c=l[4],f=l[8],h=l[1],p=l[5],d=l[9],g=l[2],m=l[6],v=l[10];if(Math.abs(c-h)<.01&&Math.abs(f-g)<.01&&Math.abs(d-m)<.01){if(Math.abs(c+h)<.1&&Math.abs(f+g)<.1&&Math.abs(d+m)<.1&&Math.abs(u+p+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let y=(u+1)/2,x=(p+1)/2,M=(v+1)/2,S=(c+h)/4,w=(f+g)/4,T=(d+m)/4;return y>x&&y>M?y<.01?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(y),n=S/i,a=w/i):x>M?x<.01?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(x),i=S/n,a=T/n):M<.01?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(M),i=w/a,n=T/a),this.set(i,n,a,t),this}let _=Math.sqrt((m-d)*(m-d)+(f-g)*(f-g)+(h-c)*(h-c));return Math.abs(_)<.001&&(_=1),this.x=(m-d)/_,this.y=(f-g)/_,this.z=(h-c)/_,this.w=Math.acos((u+p+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var iA=class extends Qa{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ni(0,0,e,t),this.scissorTest=!1,this.viewport=new ni(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qi,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new eo(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);a.flipY=!1,a.generateMipmaps=i.generateMipmaps,a.internalFormat=i.internalFormat,this.textures=[];let o=i.count;for(let s=0;s<o;s++)this.textures[s]=a.clone(),this.textures[s].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,a=this.textures.length;n<a;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,n=e.textures.length;i<n;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new Sg(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}};var to=class extends iA{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}};var Mg=class extends eo{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=Bi,this.minFilter=Bi,this.wrapR=ya,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var nA=class extends eo{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=Bi,this.minFilter=Bi,this.wrapR=ya,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var nu=class{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,a,o,s){let l=i[n+0],u=i[n+1],c=i[n+2],f=i[n+3],h=a[o+0],p=a[o+1],d=a[o+2],g=a[o+3];if(s===0){e[t+0]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f;return}if(s===1){e[t+0]=h,e[t+1]=p,e[t+2]=d,e[t+3]=g;return}if(f!==g||l!==h||u!==p||c!==d){let m=1-s,v=l*h+u*p+c*d+f*g,_=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){let M=Math.sqrt(y),S=Math.atan2(M,v*_);m=Math.sin(m*S)/M,s=Math.sin(s*S)/M}let x=s*_;if(l=l*m+h*x,u=u*m+p*x,c=c*m+d*x,f=f*m+g*x,m===1-s){let M=1/Math.sqrt(l*l+u*u+c*c+f*f);l*=M,u*=M,c*=M,f*=M}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,n,a,o){let s=i[n],l=i[n+1],u=i[n+2],c=i[n+3],f=a[o],h=a[o+1],p=a[o+2],d=a[o+3];return e[t]=s*d+c*f+l*p-u*h,e[t+1]=l*d+c*h+u*f-s*p,e[t+2]=u*d+c*p+s*h-l*f,e[t+3]=c*d-s*f-l*h-u*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,n=e._y,a=e._z,o=e._order,s=Math.cos,l=Math.sin,u=s(i/2),c=s(n/2),f=s(a/2),h=l(i/2),p=l(n/2),d=l(a/2);switch(o){case"XYZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"YXZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"ZXY":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"ZYX":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"YZX":this._x=h*c*f+u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f-h*p*d;break;case"XZY":this._x=h*c*f-u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],a=t[8],o=t[1],s=t[5],l=t[9],u=t[2],c=t[6],f=t[10],h=i+s+f;if(h>0){let p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(c-l)*p,this._y=(a-u)*p,this._z=(o-n)*p}else if(i>s&&i>f){let p=2*Math.sqrt(1+i-s-f);this._w=(c-l)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(a+u)/p}else if(s>f){let p=2*Math.sqrt(1+s-i-f);this._w=(a-u)/p,this._x=(n+o)/p,this._y=.25*p,this._z=(l+c)/p}else{let p=2*Math.sqrt(1+f-i-s);this._w=(o-n)/p,this._x=(a+u)/p,this._y=(l+c)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(en(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,a=e._z,o=e._w,s=t._x,l=t._y,u=t._z,c=t._w;return this._x=i*c+o*s+n*u-a*l,this._y=n*c+o*l+a*s-i*u,this._z=a*c+o*u+i*l-n*s,this._w=o*c-i*s-n*l-a*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,a=this._z,o=this._w,s=o*e._w+i*e._x+n*e._y+a*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=i,this._y=n,this._z=a,this;let l=1-s*s;if(l<=Number.EPSILON){let p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*n+t*this._y,this._z=p*a+t*this._z,this.normalize(),this}let u=Math.sqrt(l),c=Math.atan2(u,s),f=Math.sin((1-t)*c)/u,h=Math.sin(t*c)/u;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=n*f+this._y*h,this._z=a*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),a=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),a*Math.sin(t),a*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};var be=class r{constructor(e=0,t=0,i=0){r.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(LQ.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(LQ.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6]*n,this.y=a[1]*t+a[4]*i+a[7]*n,this.z=a[2]*t+a[5]*i+a[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=e.elements,o=1/(a[3]*t+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*t+a[4]*i+a[8]*n+a[12])*o,this.y=(a[1]*t+a[5]*i+a[9]*n+a[13])*o,this.z=(a[2]*t+a[6]*i+a[10]*n+a[14])*o,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,a=e.x,o=e.y,s=e.z,l=e.w,u=2*(o*n-s*i),c=2*(s*t-a*n),f=2*(a*i-o*t);return this.x=t+l*u+o*f-s*c,this.y=i+l*c+s*u-a*f,this.z=n+l*f+a*c-o*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n,this.y=a[1]*t+a[5]*i+a[9]*n,this.z=a[2]*t+a[6]*i+a[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,a=e.z,o=t.x,s=t.y,l=t.z;return this.x=n*l-a*s,this.y=a*o-i*l,this.z=i*s-n*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Pz.copy(this).projectOnVector(e),this.sub(Pz)}reflect(e){return this.sub(Pz.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(en(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Pz=new be,LQ=new nu;var ju=class{constructor(e=new be(1/0,1/0,1/0),t=new be(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(ul.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(ul.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=ul.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){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(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let a=i.getAttribute("position");if(t===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let o=0,s=a.count;o<s;o++)e.isMesh===!0?e.getVertexPosition(o,ul):ul.fromBufferAttribute(a,o),ul.applyMatrix4(e.matrixWorld),this.expandByPoint(ul);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),aA.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),aA.copy(i.boundingBox)),aA.applyMatrix4(e.matrixWorld),this.union(aA)}let n=e.children;for(let a=0,o=n.length;a<o;a++)this.expandByObject(n[a],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ul),ul.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(pS),oA.subVectors(this.max,pS),bg.subVectors(e.a,pS),wg.subVectors(e.b,pS),Tg.subVectors(e.c,pS),ch.subVectors(wg,bg),fh.subVectors(Tg,wg),_d.subVectors(bg,Tg);let t=[0,-ch.z,ch.y,0,-fh.z,fh.y,0,-_d.z,_d.y,ch.z,0,-ch.x,fh.z,0,-fh.x,_d.z,0,-_d.x,-ch.y,ch.x,0,-fh.y,fh.x,0,-_d.y,_d.x,0];return!Dz(t,bg,wg,Tg,oA)||(t=[1,0,0,0,1,0,0,0,1],!Dz(t,bg,wg,Tg,oA))?!1:(sA.crossVectors(ch,fh),t=[sA.x,sA.y,sA.z],Dz(t,bg,wg,Tg,oA))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ul).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ul).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Zu[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zu[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zu[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zu[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zu[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zu[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zu[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zu[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zu),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Zu=[new be,new be,new be,new be,new be,new be,new be,new be],ul=new be,aA=new ju,bg=new be,wg=new be,Tg=new be,ch=new be,fh=new be,_d=new be,pS=new be,oA=new be,sA=new be,xd=new be;function Dz(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){xd.fromArray(r,a);let s=n.x*Math.abs(xd.x)+n.y*Math.abs(xd.y)+n.z*Math.abs(xd.z),l=e.dot(xd),u=t.dot(xd),c=i.dot(xd);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var J1e=new ju,dS=new be,Iz=new be,hh=class{constructor(e=new be,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):J1e.setFromPoints(e).getCenter(i);let n=0;for(let a=0,o=e.length;a<o;a++)n=Math.max(n,i.distanceToSquared(e[a]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;dS.subVectors(e,this.center);let t=dS.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(dS,n/i),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Iz.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(dS.copy(e.center).add(Iz)),this.expandByPoint(dS.copy(e.center).sub(Iz))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var Ku=new be,Nz=new be,lA=new be,ph=new be,Uz=new be,uA=new be,Oz=new be,cA=class{constructor(e=new be,t=new be(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ku)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Ku.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ku.copy(this.origin).addScaledVector(this.direction,t),Ku.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){Nz.copy(e).add(t).multiplyScalar(.5),lA.copy(t).sub(e).normalize(),ph.copy(this.origin).sub(Nz);let a=e.distanceTo(t)*.5,o=-this.direction.dot(lA),s=ph.dot(this.direction),l=-ph.dot(lA),u=ph.lengthSq(),c=Math.abs(1-o*o),f,h,p,d;if(c>0)if(f=o*l-s,h=o*s-l,d=a*c,f>=0)if(h>=-d)if(h<=d){let g=1/c;f*=g,h*=g,p=f*(f+o*h+2*s)+h*(o*f+h+2*l)+u}else h=a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h=-a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h<=-d?(f=Math.max(0,-(-o*a+s)),h=f>0?-a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u):h<=d?(f=0,h=Math.min(Math.max(-a,-l),a),p=h*(h+2*l)+u):(f=Math.max(0,-(o*a+s)),h=f>0?a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u);else h=o>0?-a:a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,f),n&&n.copy(Nz).addScaledVector(lA,h),p}intersectSphere(e,t){Ku.subVectors(e.center,this.origin);let i=Ku.dot(this.direction),n=Ku.dot(Ku)-i*i,a=e.radius*e.radius;if(n>a)return null;let o=Math.sqrt(a-n),s=i-o,l=i+o;return l<0?null:s<0?this.at(l,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,a,o,s,l,u=1/this.direction.x,c=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(i=(e.min.x-h.x)*u,n=(e.max.x-h.x)*u):(i=(e.max.x-h.x)*u,n=(e.min.x-h.x)*u),c>=0?(a=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(a=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),i>o||a>n||((a>i||isNaN(i))&&(i=a),(o<n||isNaN(n))&&(n=o),f>=0?(s=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(s=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||s>n)||((s>i||i!==i)&&(i=s),(l<n||n!==n)&&(n=l),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,Ku)!==null}intersectTriangle(e,t,i,n,a){Uz.subVectors(t,e),uA.subVectors(i,e),Oz.crossVectors(Uz,uA);let o=this.direction.dot(Oz),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;ph.subVectors(this.origin,e);let l=s*this.direction.dot(uA.crossVectors(ph,uA));if(l<0)return null;let u=s*this.direction.dot(Uz.cross(ph));if(u<0||l+u>o)return null;let c=-s*ph.dot(Oz);return c<0?null:this.at(c/o,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}};var Wr=class r{constructor(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m)}set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){let v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=n,v[1]=a,v[5]=o,v[9]=s,v[13]=l,v[2]=u,v[6]=c,v[10]=f,v[14]=h,v[3]=p,v[7]=d,v[11]=g,v[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new r().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/Eg.setFromMatrixColumn(e,0).length(),a=1/Eg.setFromMatrixColumn(e,1).length(),o=1/Eg.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*a,t[5]=i[5]*a,t[6]=i[6]*a,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,a=e.z,o=Math.cos(i),s=Math.sin(i),l=Math.cos(n),u=Math.sin(n),c=Math.cos(a),f=Math.sin(a);if(e.order==="XYZ"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=-l*f,t[8]=u,t[1]=p+d*u,t[5]=h-g*u,t[9]=-s*l,t[2]=g-h*u,t[6]=d+p*u,t[10]=o*l}else if(e.order==="YXZ"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h+g*s,t[4]=d*s-p,t[8]=o*u,t[1]=o*f,t[5]=o*c,t[9]=-s,t[2]=p*s-d,t[6]=g+h*s,t[10]=o*l}else if(e.order==="ZXY"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h-g*s,t[4]=-o*f,t[8]=d+p*s,t[1]=p+d*s,t[5]=o*c,t[9]=g-h*s,t[2]=-o*u,t[6]=s,t[10]=o*l}else if(e.order==="ZYX"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=d*u-p,t[8]=h*u+g,t[1]=l*f,t[5]=g*u+h,t[9]=p*u-d,t[2]=-u,t[6]=s*l,t[10]=o*l}else if(e.order==="YZX"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=g-h*f,t[8]=d*f+p,t[1]=f,t[5]=o*c,t[9]=-s*c,t[2]=-u*c,t[6]=p*f+d,t[10]=h-g*f}else if(e.order==="XZY"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=-f,t[8]=u*c,t[1]=h*f+g,t[5]=o*c,t[9]=p*f-d,t[2]=d*f-p,t[6]=s*c,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose($1e,e,Q1e)}lookAt(e,t,i){let n=this.elements;return Po.subVectors(e,t),Po.lengthSq()===0&&(Po.z=1),Po.normalize(),dh.crossVectors(i,Po),dh.lengthSq()===0&&(Math.abs(i.z)===1?Po.x+=1e-4:Po.z+=1e-4,Po.normalize(),dh.crossVectors(i,Po)),dh.normalize(),fA.crossVectors(Po,dh),n[0]=dh.x,n[4]=fA.x,n[8]=Po.x,n[1]=dh.y,n[5]=fA.y,n[9]=Po.y,n[2]=dh.z,n[6]=fA.z,n[10]=Po.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[4],l=i[8],u=i[12],c=i[1],f=i[5],h=i[9],p=i[13],d=i[2],g=i[6],m=i[10],v=i[14],_=i[3],y=i[7],x=i[11],M=i[15],S=n[0],w=n[4],T=n[8],C=n[12],b=n[1],E=n[5],I=n[9],R=n[13],A=n[2],D=n[6],U=n[10],B=n[14],z=n[3],k=n[7],G=n[11],Y=n[15];return a[0]=o*S+s*b+l*A+u*z,a[4]=o*w+s*E+l*D+u*k,a[8]=o*T+s*I+l*U+u*G,a[12]=o*C+s*R+l*B+u*Y,a[1]=c*S+f*b+h*A+p*z,a[5]=c*w+f*E+h*D+p*k,a[9]=c*T+f*I+h*U+p*G,a[13]=c*C+f*R+h*B+p*Y,a[2]=d*S+g*b+m*A+v*z,a[6]=d*w+g*E+m*D+v*k,a[10]=d*T+g*I+m*U+v*G,a[14]=d*C+g*R+m*B+v*Y,a[3]=_*S+y*b+x*A+M*z,a[7]=_*w+y*E+x*D+M*k,a[11]=_*T+y*I+x*U+M*G,a[15]=_*C+y*R+x*B+M*Y,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],a=e[12],o=e[1],s=e[5],l=e[9],u=e[13],c=e[2],f=e[6],h=e[10],p=e[14],d=e[3],g=e[7],m=e[11],v=e[15];return d*(+a*l*f-n*u*f-a*s*h+i*u*h+n*s*p-i*l*p)+g*(+t*l*p-t*u*h+a*o*h-n*o*p+n*u*c-a*l*c)+m*(+t*u*f-t*s*p-a*o*f+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-t*l*f+t*s*h+n*o*f-i*o*h+i*l*c)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],g=e[13],m=e[14],v=e[15],_=f*m*u-g*h*u+g*l*p-s*m*p-f*l*v+s*h*v,y=d*h*u-c*m*u-d*l*p+o*m*p+c*l*v-o*h*v,x=c*g*u-d*f*u+d*s*p-o*g*p-c*s*v+o*f*v,M=d*f*l-c*g*l-d*s*h+o*g*h+c*s*m-o*f*m,S=t*_+i*y+n*x+a*M;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/S;return e[0]=_*w,e[1]=(g*h*a-f*m*a-g*n*p+i*m*p+f*n*v-i*h*v)*w,e[2]=(s*m*a-g*l*a+g*n*u-i*m*u-s*n*v+i*l*v)*w,e[3]=(f*l*a-s*h*a-f*n*u+i*h*u+s*n*p-i*l*p)*w,e[4]=y*w,e[5]=(c*m*a-d*h*a+d*n*p-t*m*p-c*n*v+t*h*v)*w,e[6]=(d*l*a-o*m*a-d*n*u+t*m*u+o*n*v-t*l*v)*w,e[7]=(o*h*a-c*l*a+c*n*u-t*h*u-o*n*p+t*l*p)*w,e[8]=x*w,e[9]=(d*f*a-c*g*a-d*i*p+t*g*p+c*i*v-t*f*v)*w,e[10]=(o*g*a-d*s*a+d*i*u-t*g*u-o*i*v+t*s*v)*w,e[11]=(c*s*a-o*f*a-c*i*u+t*f*u+o*i*p-t*s*p)*w,e[12]=M*w,e[13]=(c*g*n-d*f*n+d*i*h-t*g*h-c*i*m+t*f*m)*w,e[14]=(d*s*n-o*g*n-d*i*l+t*g*l+o*i*m-t*s*m)*w,e[15]=(o*f*n-c*s*n+c*i*l-t*f*l-o*i*h+t*s*h)*w,this}scale(e){let t=this.elements,i=e.x,n=e.y,a=e.z;return t[0]*=i,t[4]*=n,t[8]*=a,t[1]*=i,t[5]*=n,t[9]*=a,t[2]*=i,t[6]*=n,t[10]*=a,t[3]*=i,t[7]*=n,t[11]*=a,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),a=1-i,o=e.x,s=e.y,l=e.z,u=a*o,c=a*s;return this.set(u*o+i,u*s-n*l,u*l+n*s,0,u*s+n*l,c*s+i,c*l-n*o,0,u*l-n*s,c*l+n*o,a*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,a,o){return this.set(1,i,a,0,e,1,o,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,a=t._x,o=t._y,s=t._z,l=t._w,u=a+a,c=o+o,f=s+s,h=a*u,p=a*c,d=a*f,g=o*c,m=o*f,v=s*f,_=l*u,y=l*c,x=l*f,M=i.x,S=i.y,w=i.z;return n[0]=(1-(g+v))*M,n[1]=(p+x)*M,n[2]=(d-y)*M,n[3]=0,n[4]=(p-x)*S,n[5]=(1-(h+v))*S,n[6]=(m+_)*S,n[7]=0,n[8]=(d+y)*w,n[9]=(m-_)*w,n[10]=(1-(h+g))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,a=Eg.set(n[0],n[1],n[2]).length(),o=Eg.set(n[4],n[5],n[6]).length(),s=Eg.set(n[8],n[9],n[10]).length();this.determinant()<0&&(a=-a),e.x=n[12],e.y=n[13],e.z=n[14],cl.copy(this);let u=1/a,c=1/o,f=1/s;return cl.elements[0]*=u,cl.elements[1]*=u,cl.elements[2]*=u,cl.elements[4]*=c,cl.elements[5]*=c,cl.elements[6]*=c,cl.elements[8]*=f,cl.elements[9]*=f,cl.elements[10]*=f,t.setFromRotationMatrix(cl),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=$a){let l=this.elements,u=2*a/(t-e),c=2*a/(i-n),f=(t+e)/(t-e),h=(i+n)/(i-n),p,d;if(s===$a)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===yd)p=-o/(o-a),d=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return l[0]=u,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=c,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,n,a,o,s=$a){let l=this.elements,u=1/(t-e),c=1/(i-n),f=1/(o-a),h=(t+e)*u,p=(i+n)*c,d,g;if(s===$a)d=(o+a)*f,g=-2*f;else if(s===yd)d=a*f,g=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=g,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},Eg=new be,cl=new Wr,$1e=new be(0,0,0),Q1e=new be(1,1,1),dh=new be,fA=new be,Po=new be;var PQ=new Wr,DQ=new nu,fl=(()=>{class r{constructor(t=0,i=0,n=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=i,this._z=n,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,i,n,a=this._order){return this._x=t,this._y=i,this._z=n,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,i=this._order,n=!0){let a=t.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],f=a[9],h=a[2],p=a[6],d=a[10];switch(i){case"XYZ":this._y=Math.asin(en(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-en(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,d),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(en(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-en(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(en(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(l,d));break;case"XZY":this._z=Math.asin(-en(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-f,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,i,n){return PQ.makeRotationFromQuaternion(t),this.setFromRotationMatrix(PQ,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return DQ.setFromEuler(this),this.setFromQuaternion(DQ,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}return r.DEFAULT_ORDER="XYZ",r})();var Ag=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}};var eTe=0,IQ=new be,Cg=new nu,Ju=new Wr,hA=new be,mS=new be,tTe=new be,rTe=new nu,NQ=new be(1,0,0),UQ=new be(0,1,0),OQ=new be(0,0,1),iTe={type:"added"},nTe={type:"removed"},zz={type:"childadded",child:null},Fz={type:"childremoved",child:null},tn=(()=>{class r extends Qa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:eTe++}),this.uuid=ru(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new be,i=new fl,n=new nu,a=new be(1,1,1);function o(){n.setFromEuler(i,!1)}function s(){i.setFromQuaternion(n,void 0,!1)}i._onChange(o),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new Wr},normalMatrix:{value:new Qt}}),this.matrix=new Wr,this.matrixWorld=new Wr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ag,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,i){this.quaternion.setFromAxisAngle(t,i)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,i){return Cg.setFromAxisAngle(t,i),this.quaternion.multiply(Cg),this}rotateOnWorldAxis(t,i){return Cg.setFromAxisAngle(t,i),this.quaternion.premultiply(Cg),this}rotateX(t){return this.rotateOnAxis(NQ,t)}rotateY(t){return this.rotateOnAxis(UQ,t)}rotateZ(t){return this.rotateOnAxis(OQ,t)}translateOnAxis(t,i){return IQ.copy(t).applyQuaternion(this.quaternion),this.position.add(IQ.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(NQ,t)}translateY(t){return this.translateOnAxis(UQ,t)}translateZ(t){return this.translateOnAxis(OQ,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ju.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?hA.copy(t):hA.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),mS.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ju.lookAt(mS,hA,this.up):Ju.lookAt(hA,mS,this.up),this.quaternion.setFromRotationMatrix(Ju),a&&(Ju.extractRotation(a.matrixWorld),Cg.setFromRotationMatrix(Ju),this.quaternion.premultiply(Cg.invert()))}add(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(iTe),zz.child=t,this.dispatchEvent(zz),zz.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let i=this.children.indexOf(t);return i!==-1&&(t.parent=null,this.children.splice(i,1),t.dispatchEvent(nTe),Fz.child=t,this.dispatchEvent(Fz),Fz.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ju.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Ju.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ju),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,i){if(this[t]===i)return this;for(let n=0,a=this.children.length;n<a;n++){let s=this.children[n].getObjectByProperty(t,i);if(s!==void 0)return s}}getObjectsByProperty(t,i,n=[]){this[t]===i&&n.push(this);let a=this.children;for(let o=0,s=a.length;o<s;o++)a[o].getObjectsByProperty(t,i,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mS,t,tTe),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mS,rTe,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let i=this.matrixWorld.elements;return t.set(i[8],i[9],i[10]).normalize()}raycast(){}traverse(t){t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverseVisible(t)}traverseAncestors(t){let i=this.parent;i!==null&&(t(i),i.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let i=this.children;for(let n=0,a=i.length;n<a;n++){let o=i[n];(o.matrixWorldAutoUpdate===!0||t===!0)&&o.updateMatrixWorld(t)}}updateWorldMatrix(t,i){let n=this.parent;if(t===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),i===!0){let a=this.children;for(let o=0,s=a.length;o<s;o++){let l=a[o];l.matrixWorldAutoUpdate===!0&&l.updateWorldMatrix(!1,!0)}}}toJSON(t){let i=t===void 0||typeof t=="string",n={};i&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),a.maxGeometryCount=this._maxGeometryCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function o(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(t)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=o(t.geometries,this.geometry);let l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){let u=l.shapes;if(Array.isArray(u))for(let c=0,f=u.length;c<f;c++){let h=u[c];o(t.shapes,h)}else o(t.shapes,u)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let l=[];for(let u=0,c=this.material.length;u<c;u++)l.push(o(t.materials,this.material[u]));a.material=l}else a.material=o(t.materials,this.material);if(this.children.length>0){a.children=[];for(let l=0;l<this.children.length;l++)a.children.push(this.children[l].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let l=0;l<this.animations.length;l++){let u=this.animations[l];a.animations.push(o(t.animations,u))}}if(i){let l=s(t.geometries),u=s(t.materials),c=s(t.textures),f=s(t.images),h=s(t.shapes),p=s(t.skeletons),d=s(t.animations),g=s(t.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),c.length>0&&(n.textures=c),f.length>0&&(n.images=f),h.length>0&&(n.shapes=h),p.length>0&&(n.skeletons=p),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=a,n;function s(l){let u=[];for(let c in l){let f=l[c];delete f.metadata,u.push(f)}return u}}clone(t){return new this.constructor().copy(this,t)}copy(t,i=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),i===!0)for(let n=0;n<t.children.length;n++){let a=t.children[n];this.add(a.clone())}return this}}return r.DEFAULT_UP=new be(0,1,0),r.DEFAULT_MATRIX_AUTO_UPDATE=!0,r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,r})();var hl=new be,$u=new be,Bz=new be,Qu=new be,Rg=new be,Lg=new be,zQ=new be,kz=new be,Vz=new be,Gz=new be,Sd=class r{constructor(e=new be,t=new be,i=new be){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),hl.subVectors(e,t),n.cross(hl);let a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){hl.subVectors(n,t),$u.subVectors(i,t),Bz.subVectors(e,t);let o=hl.dot(hl),s=hl.dot($u),l=hl.dot(Bz),u=$u.dot($u),c=$u.dot(Bz),f=o*u-s*s;if(f===0)return a.set(0,0,0),null;let h=1/f,p=(u*l-s*c)*h,d=(o*c-s*l)*h;return a.set(1-p-d,d,p)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,Qu)===null?!1:Qu.x>=0&&Qu.y>=0&&Qu.x+Qu.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,Qu)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,Qu.x),l.addScaledVector(o,Qu.y),l.addScaledVector(s,Qu.z),l)}static isFrontFacing(e,t,i,n){return hl.subVectors(i,t),$u.subVectors(e,t),hl.cross($u).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return hl.subVectors(this.c,this.b),$u.subVectors(this.a,this.b),hl.cross($u).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return r.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return r.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,a){return r.getInterpolation(e,this.a,this.b,this.c,t,i,n,a)}containsPoint(e){return r.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return r.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,a=this.c,o,s;Rg.subVectors(n,i),Lg.subVectors(a,i),kz.subVectors(e,i);let l=Rg.dot(kz),u=Lg.dot(kz);if(l<=0&&u<=0)return t.copy(i);Vz.subVectors(e,n);let c=Rg.dot(Vz),f=Lg.dot(Vz);if(c>=0&&f<=c)return t.copy(n);let h=l*f-c*u;if(h<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(Rg,o);Gz.subVectors(e,a);let p=Rg.dot(Gz),d=Lg.dot(Gz);if(d>=0&&p<=d)return t.copy(a);let g=p*u-l*d;if(g<=0&&u>=0&&d<=0)return s=u/(u-d),t.copy(i).addScaledVector(Lg,s);let m=c*d-p*f;if(m<=0&&f-c>=0&&p-d>=0)return zQ.subVectors(a,n),s=(f-c)/(f-c+(p-d)),t.copy(n).addScaledVector(zQ,s);let v=1/(m+g+h);return o=g*v,s=h*v,t.copy(i).addScaledVector(Rg,o).addScaledVector(Lg,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var FQ={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},mh={h:0,s:0,l:0},pA={h:0,s:0,l:0};function Hz(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}var ir=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ka){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Tr.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=Tr.workingColorSpace){return this.r=e,this.g=t,this.b=i,Tr.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=Tr.workingColorSpace){if(e=wQ(e,1),t=en(t,0,1),i=en(i,0,1),t===0)this.r=this.g=this.b=i;else{let a=i<=.5?i*(1+t):i+t-i*t,o=2*i-a;this.r=Hz(o,a,e+1/3),this.g=Hz(o,a,e),this.b=Hz(o,a,e-1/3)}return Tr.toWorkingColorSpace(this,n),this}setStyle(e,t=Ka){function i(a){a!==void 0&&parseFloat(a)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let a,o=n[1],s=n[2];switch(o){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let a=n[1],o=a.length;if(o===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(a,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ka){let i=FQ[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=uh(e.r),this.g=uh(e.g),this.b=uh(e.b),this}copyLinearToSRGB(e){return this.r=rA(e.r),this.g=rA(e.g),this.b=rA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ka){return Tr.fromWorkingColorSpace(qn.copy(this),e),Math.round(en(qn.r*255,0,255))*65536+Math.round(en(qn.g*255,0,255))*256+Math.round(en(qn.b*255,0,255))}getHexString(e=Ka){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Tr.workingColorSpace){Tr.fromWorkingColorSpace(qn.copy(this),t);let i=qn.r,n=qn.g,a=qn.b,o=Math.max(i,n,a),s=Math.min(i,n,a),l,u,c=(s+o)/2;if(s===o)l=0,u=0;else{let f=o-s;switch(u=c<=.5?f/(o+s):f/(2-o-s),o){case i:l=(n-a)/f+(n<a?6:0);break;case n:l=(a-i)/f+2;break;case a:l=(i-n)/f+4;break}l/=6}return e.h=l,e.s=u,e.l=c,e}getRGB(e,t=Tr.workingColorSpace){return Tr.fromWorkingColorSpace(qn.copy(this),t),e.r=qn.r,e.g=qn.g,e.b=qn.b,e}getStyle(e=Ka){Tr.fromWorkingColorSpace(qn.copy(this),e);let t=qn.r,i=qn.g,n=qn.b;return e!==Ka?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(n*255)})`}offsetHSL(e,t,i){return this.getHSL(mh),this.setHSL(mh.h+e,mh.s+t,mh.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(mh),e.getHSL(pA);let i=QE(mh.h,pA.h,t),n=QE(mh.s,pA.s,t),a=QE(mh.l,pA.l,t);return this.setHSL(i,n,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,a=e.elements;return this.r=a[0]*t+a[3]*i+a[6]*n,this.g=a[1]*t+a[4]*i+a[7]*n,this.b=a[2]*t+a[5]*i+a[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},qn=new ir;ir.NAMES=FQ;var aTe=0,au=class extends Qa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:aTe++}),this.uuid=ru(),this.name="",this.type="Material",this.blending=Xu,this.side=Ao,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=nS,this.blendDst=aS,this.blendEquation=Yu,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ir(0,0,0),this.blendAlpha=0,this.depthFunc=cg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Tz,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gd,this.stencilZFail=gd,this.stencilZPass=gd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(n===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Xu&&(i.blending=this.blending),this.side!==Ao&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==nS&&(i.blendSrc=this.blendSrc),this.blendDst!==aS&&(i.blendDst=this.blendDst),this.blendEquation!==Yu&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==cg&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Tz&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==gd&&(i.stencilFail=this.stencilFail),this.stencilZFail!==gd&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==gd&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function n(a){let o=[];for(let s in a){let l=a[s];delete l.metadata,o.push(l)}return o}if(t){let a=n(e.textures),o=n(e.images);a.length>0&&(i.textures=a),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let a=0;a!==n;++a)i[a]=t[a].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var ec=class extends au{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ir(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.envMapRotation=new fl,this.combine=zE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};var ki=new be,dA=new Kt,xa=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ez,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ja,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return AQ("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,a=this.itemSize;n<a;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)dA.fromBufferAttribute(this,t),dA.applyMatrix3(e),this.setXY(t,dA.x,dA.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)ki.fromBufferAttribute(this,t),ki.applyMatrix3(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)ki.fromBufferAttribute(this,t),ki.applyMatrix4(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ki.fromBufferAttribute(this,t),ki.applyNormalMatrix(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ki.fromBufferAttribute(this,t),ki.transformDirection(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=gg(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=_a(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=gg(t,this.array)),t}setX(e,t){return this.normalized&&(t=_a(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=gg(t,this.array)),t}setY(e,t){return this.normalized&&(t=_a(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=gg(t,this.array)),t}setZ(e,t){return this.normalized&&(t=_a(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=gg(t,this.array)),t}setW(e,t){return this.normalized&&(t=_a(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=_a(t,this.array),i=_a(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=_a(t,this.array),i=_a(i,this.array),n=_a(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,a){return e*=this.itemSize,this.normalized&&(t=_a(t,this.array),i=_a(i,this.array),n=_a(n,this.array),a=_a(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ez&&(e.usage=this.usage),e}};var Pg=class extends xa{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var Dg=class extends xa{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var Zn=class extends xa{constructor(e,t,i){super(new Float32Array(e),t,i)}};var oTe=0,xs=new Wr,Wz=new tn,Ig=new be,Do=new ju,vS=new ju,dn=new be,ro=class r extends Qa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:oTe++}),this.uuid=ru(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(eA(e)?Dg:Pg)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let a=new Qt().getNormalMatrix(e);i.applyNormalMatrix(a),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return xs.makeRotationFromQuaternion(e),this.applyMatrix4(xs),this}rotateX(e){return xs.makeRotationX(e),this.applyMatrix4(xs),this}rotateY(e){return xs.makeRotationY(e),this.applyMatrix4(xs),this}rotateZ(e){return xs.makeRotationZ(e),this.applyMatrix4(xs),this}translate(e,t,i){return xs.makeTranslation(e,t,i),this.applyMatrix4(xs),this}scale(e,t,i){return xs.makeScale(e,t,i),this.applyMatrix4(xs),this}lookAt(e){return Wz.lookAt(e),Wz.updateMatrix(),this.applyMatrix4(Wz.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ig).negate(),this.translate(Ig.x,Ig.y,Ig.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let a=e[i];t.push(a.x,a.y,a.z||0)}return this.setAttribute("position",new Zn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ju);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new be(-1/0,-1/0,-1/0),new be(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){let a=t[i];Do.setFromBufferAttribute(a),this.morphTargetsRelative?(dn.addVectors(this.boundingBox.min,Do.min),this.boundingBox.expandByPoint(dn),dn.addVectors(this.boundingBox.max,Do.max),this.boundingBox.expandByPoint(dn)):(this.boundingBox.expandByPoint(Do.min),this.boundingBox.expandByPoint(Do.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new hh);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new be,1/0);return}if(e){let i=this.boundingSphere.center;if(Do.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){let s=t[a];vS.setFromBufferAttribute(s),this.morphTargetsRelative?(dn.addVectors(Do.min,vS.min),Do.expandByPoint(dn),dn.addVectors(Do.max,vS.max),Do.expandByPoint(dn)):(Do.expandByPoint(vS.min),Do.expandByPoint(vS.max))}Do.getCenter(i);let n=0;for(let a=0,o=e.count;a<o;a++)dn.fromBufferAttribute(e,a),n=Math.max(n,i.distanceToSquared(dn));if(t)for(let a=0,o=t.length;a<o;a++){let s=t[a],l=this.morphTargetsRelative;for(let u=0,c=s.count;u<c;u++)dn.fromBufferAttribute(s,u),l&&(Ig.fromBufferAttribute(e,u),dn.add(Ig)),n=Math.max(n,i.distanceToSquared(dn))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,n=t.normal,a=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new xa(new Float32Array(4*i.count),4));let o=this.getAttribute("tangent"),s=[],l=[];for(let T=0;T<i.count;T++)s[T]=new be,l[T]=new be;let u=new be,c=new be,f=new be,h=new Kt,p=new Kt,d=new Kt,g=new be,m=new be;function v(T,C,b){u.fromBufferAttribute(i,T),c.fromBufferAttribute(i,C),f.fromBufferAttribute(i,b),h.fromBufferAttribute(a,T),p.fromBufferAttribute(a,C),d.fromBufferAttribute(a,b),c.sub(u),f.sub(u),p.sub(h),d.sub(h);let E=1/(p.x*d.y-d.x*p.y);isFinite(E)&&(g.copy(c).multiplyScalar(d.y).addScaledVector(f,-p.y).multiplyScalar(E),m.copy(f).multiplyScalar(p.x).addScaledVector(c,-d.x).multiplyScalar(E),s[T].add(g),s[C].add(g),s[b].add(g),l[T].add(m),l[C].add(m),l[b].add(m))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)v(e.getX(R+0),e.getX(R+1),e.getX(R+2))}let y=new be,x=new be,M=new be,S=new be;function w(T){M.fromBufferAttribute(n,T),S.copy(M);let C=s[T];y.copy(C),y.sub(M.multiplyScalar(M.dot(C))).normalize(),x.crossVectors(S,C);let E=x.dot(l[T])<0?-1:1;o.setXYZW(T,y.x,y.y,y.z,E)}for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)w(e.getX(R+0)),w(e.getX(R+1)),w(e.getX(R+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new xa(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);let n=new be,a=new be,o=new be,s=new be,l=new be,u=new be,c=new be,f=new be;if(e)for(let h=0,p=e.count;h<p;h+=3){let d=e.getX(h+0),g=e.getX(h+1),m=e.getX(h+2);n.fromBufferAttribute(t,d),a.fromBufferAttribute(t,g),o.fromBufferAttribute(t,m),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),s.fromBufferAttribute(i,d),l.fromBufferAttribute(i,g),u.fromBufferAttribute(i,m),s.add(c),l.add(c),u.add(c),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(g,l.x,l.y,l.z),i.setXYZ(m,u.x,u.y,u.z)}else for(let h=0,p=t.count;h<p;h+=3)n.fromBufferAttribute(t,h+0),a.fromBufferAttribute(t,h+1),o.fromBufferAttribute(t,h+2),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),i.setXYZ(h+0,c.x,c.y,c.z),i.setXYZ(h+1,c.x,c.y,c.z),i.setXYZ(h+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)dn.fromBufferAttribute(e,t),dn.normalize(),e.setXYZ(t,dn.x,dn.y,dn.z)}toNonIndexed(){function e(s,l){let u=s.array,c=s.itemSize,f=s.normalized,h=new u.constructor(l.length*c),p=0,d=0;for(let g=0,m=l.length;g<m;g++){s.isInterleavedBufferAttribute?p=l[g]*s.data.stride+s.offset:p=l[g]*c;for(let v=0;v<c;v++)h[d++]=u[p++]}return new xa(h,c,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new r,i=this.index.array,n=this.attributes;for(let s in n){let l=n[s],u=e(l,i);t.setAttribute(s,u)}let a=this.morphAttributes;for(let s in a){let l=[],u=a[s];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=e(h,i);l.push(p)}t.morphAttributes[s]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let s=0,l=o.length;s<l;s++){let u=o[s];t.addGroup(u.start,u.count,u.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let l in i){let u=i[l];e.data.attributes[l]=u.toJSON(e.data)}let n={},a=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let f=0,h=u.length;f<h;f++){let p=u[f];c.push(p.toJSON(e.data))}c.length>0&&(n[l]=c,a=!0)}a&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let s=this.boundingSphere;return s!==null&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let u in n){let c=n[u];this.setAttribute(u,c.clone(t))}let a=e.morphAttributes;for(let u in a){let c=[],f=a[u];for(let h=0,p=f.length;h<p;h++)c.push(f[h].clone(t));this.morphAttributes[u]=c}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let u=0,c=o.length;u<c;u++){let f=o[u];this.addGroup(f.start,f.count,f.materialIndex)}let s=e.boundingBox;s!==null&&(this.boundingBox=s.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var BQ=new Wr,Md=new cA,mA=new hh,kQ=new be,Ng=new be,Ug=new be,Og=new be,Xz=new be,vA=new be,gA=new Kt,yA=new Kt,_A=new Kt,VQ=new be,GQ=new be,HQ=new be,xA=new be,SA=new be,rn=class extends tn{constructor(e=new ro,t=new ec){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a<o;a++){let s=n[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=a}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,a=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(a&&s){vA.set(0,0,0);for(let l=0,u=a.length;l<u;l++){let c=s[l],f=a[l];c!==0&&(Xz.fromBufferAttribute(f,e),o?vA.addScaledVector(Xz,c):vA.addScaledVector(Xz.sub(t),c))}t.add(vA)}return t}raycast(e,t){let i=this.geometry,n=this.material,a=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),mA.copy(i.boundingSphere),mA.applyMatrix4(a),Md.copy(e.ray).recast(e.near),!(mA.containsPoint(Md.origin)===!1&&(Md.intersectSphere(mA,kQ)===null||Md.origin.distanceToSquared(kQ)>(e.far-e.near)**2))&&(BQ.copy(a).invert(),Md.copy(e.ray).applyMatrix4(BQ),!(i.boundingBox!==null&&Md.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Md)))}_computeIntersections(e,t,i){let n,a=this.geometry,o=this.material,s=a.index,l=a.attributes.position,u=a.attributes.uv,c=a.attributes.uv1,f=a.attributes.normal,h=a.groups,p=a.drawRange;if(s!==null)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(s.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=s.getX(x),w=s.getX(x+1),T=s.getX(x+2);n=MA(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(s.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=s.getX(m),y=s.getX(m+1),x=s.getX(m+2);n=MA(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}else if(l!==void 0)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=x,w=x+1,T=x+2;n=MA(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(l.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=m,y=m+1,x=m+2;n=MA(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}}};function sTe(r,e,t,i,n,a,o,s){let l;if(e.side===_i?l=i.intersectTriangle(o,a,n,!0,s):l=i.intersectTriangle(n,a,o,e.side===Ao,s),l===null)return null;SA.copy(s),SA.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(SA);return u<t.near||u>t.far?null:{distance:u,point:SA.clone(),object:r}}function MA(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,Ng),r.getVertexPosition(l,Ug),r.getVertexPosition(u,Og);let c=sTe(r,e,t,i,Ng,Ug,Og,xA);if(c){n&&(gA.fromBufferAttribute(n,s),yA.fromBufferAttribute(n,l),_A.fromBufferAttribute(n,u),c.uv=Sd.getInterpolation(xA,Ng,Ug,Og,gA,yA,_A,new Kt)),a&&(gA.fromBufferAttribute(a,s),yA.fromBufferAttribute(a,l),_A.fromBufferAttribute(a,u),c.uv1=Sd.getInterpolation(xA,Ng,Ug,Og,gA,yA,_A,new Kt)),o&&(VQ.fromBufferAttribute(o,s),GQ.fromBufferAttribute(o,l),HQ.fromBufferAttribute(o,u),c.normal=Sd.getInterpolation(xA,Ng,Ug,Og,VQ,GQ,HQ,new be),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let f={a:s,b:l,c:u,normal:new be,materialIndex:0};Sd.getNormal(Ng,Ug,Og,f.normal),c.face=f}return c}var vh=class r extends ro{constructor(e=1,t=1,i=1,n=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:a,depthSegments:o};let s=this;n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let l=[],u=[],c=[],f=[],h=0,p=0;d("z","y","x",-1,-1,i,t,e,o,a,0),d("z","y","x",1,-1,i,t,-e,o,a,1),d("x","z","y",1,1,e,i,t,n,o,2),d("x","z","y",1,-1,e,i,-t,n,o,3),d("x","y","z",1,-1,e,t,i,n,a,4),d("x","y","z",-1,-1,e,t,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new Zn(u,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(f,2));function d(g,m,v,_,y,x,M,S,w,T,C){let b=x/w,E=M/T,I=x/2,R=M/2,A=S/2,D=w+1,U=T+1,B=0,z=0,k=new be;for(let G=0;G<U;G++){let Y=G*E-R;for(let J=0;J<D;J++){let Q=J*b-I;k[g]=Q*_,k[m]=Y*y,k[v]=A,u.push(k.x,k.y,k.z),k[g]=0,k[m]=0,k[v]=S>0?1:-1,c.push(k.x,k.y,k.z),f.push(J/w),f.push(1-G/T),B+=1}}for(let G=0;G<T;G++)for(let Y=0;Y<w;Y++){let J=h+Y+D*G,Q=h+Y+D*(G+1),V=h+(Y+1)+D*(G+1),K=h+(Y+1)+D*G;l.push(J,Q,K),l.push(Q,V,K),z+=6}s.addGroup(p,z,C),p+=z,h+=B}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function tc(r){let e={};for(let t in r){e[t]={};for(let i in r[t]){let n=r[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}function jn(r){let e={};for(let t=0;t<r.length;t++){let i=tc(r[t]);for(let n in i)e[n]=i[n]}return e}function WQ(r){let e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function bA(r){return r.getRenderTarget()===null?r.outputColorSpace:Tr.workingColorSpace}var XQ={clone:tc,merge:jn};var YQ=`
  2231. void main() {
  2232. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  2233. }
  2234. `;var qQ=`
  2235. void main() {
  2236. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  2237. }
  2238. `;var Sa=class extends au{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=YQ,this.fragmentShader=qQ,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=tc(e.uniforms),this.uniformsGroups=WQ(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let o=this.uniforms[n].value;o&&o.isTexture?t.uniforms[n]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[n]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[n]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[n]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[n]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[n]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[n]={type:"m4",value:o.toArray()}:t.uniforms[n]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let n in this.extensions)this.extensions[n]===!0&&(i[n]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}};var zg=class extends tn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Wr,this.projectionMatrix=new Wr,this.projectionMatrixInverse=new Wr,this.coordinateSystem=$a}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};var gh=new be,ZQ=new Kt,jQ=new Kt,Vi=class extends zg{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=fS*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan($E*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return fS*2*Math.atan(Math.tan($E*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){gh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(gh.x,gh.y).multiplyScalar(-e/gh.z),gh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(gh.x,gh.y).multiplyScalar(-e/gh.z)}getViewSize(e,t){return this.getViewBounds(e,ZQ,jQ),t.subVectors(jQ,ZQ)}setViewOffset(e,t,i,n,a,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan($E*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,a=-.5*n,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,u=o.fullHeight;a+=o.offsetX*n/l,t-=o.offsetY*i/u,n*=o.width/l,i*=o.height/u}let s=this.filmOffset;s!==0&&(a+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};var Fg=-90,Bg=1,wA=class extends tn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Vi(Fg,Bg,e,t);n.layers=this.layers,this.add(n);let a=new Vi(Fg,Bg,e,t);a.layers=this.layers,this.add(a);let o=new Vi(Fg,Bg,e,t);o.layers=this.layers,this.add(o);let s=new Vi(Fg,Bg,e,t);s.layers=this.layers,this.add(s);let l=new Vi(Fg,Bg,e,t);l.layers=this.layers,this.add(l);let u=new Vi(Fg,Bg,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,a,o,s,l]=t;for(let u of t)this.remove(u);if(e===$a)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===yd)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[a,o,s,l,u,c]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let g=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,n),e.render(t,a),e.setRenderTarget(i,1,n),e.render(t,o),e.setRenderTarget(i,2,n),e.render(t,s),e.setRenderTarget(i,3,n),e.render(t,l),e.setRenderTarget(i,4,n),e.render(t,u),i.texture.generateMipmaps=g,e.setRenderTarget(i,5,n),e.render(t,c),e.setRenderTarget(f,h,p),e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}};var kg=class extends eo{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:ol,super(e,t,i,n,a,o,s,l,u,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var TA=class extends to{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},n=[i,i,i,i,i,i];this.texture=new kg(n,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Qi}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
  2239. varying vec3 vWorldDirection;
  2240. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  2241. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  2242. }
  2243. void main() {
  2244. vWorldDirection = transformDirection( position, modelMatrix );
  2245. #include <begin_vertex>
  2246. #include <project_vertex>
  2247. }
  2248. `,fragmentShader:`
  2249. uniform sampler2D tEquirect;
  2250. varying vec3 vWorldDirection;
  2251. #include <common>
  2252. void main() {
  2253. vec3 direction = normalize( vWorldDirection );
  2254. vec2 sampleUV = equirectUv( direction );
  2255. gl_FragColor = texture2D( tEquirect, sampleUV );
  2256. }
  2257. `},n=new vh(5,5,5),a=new Sa({name:"CubemapFromEquirect",uniforms:tc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:_i,blending:vs});a.uniforms.tEquirect.value=t;let o=new rn(n,a),s=t.minFilter;return t.minFilter===sl&&(t.minFilter=Qi),new wA(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,n){let a=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,n);e.setRenderTarget(a)}};var Yz=new be,lTe=new be,uTe=new Qt,pl=class{constructor(e=new be(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=Yz.subVectors(i,t).cross(lTe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(Yz),n=this.normal.dot(i);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/n;return a<0||a>1?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||uTe.getNormalMatrix(e),n=this.coplanarPoint(Yz).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};var bd=new hh,EA=new be,yh=class{constructor(e=new pl,t=new pl,i=new pl,n=new pl,a=new pl,o=new pl){this.planes=[e,t,i,n,a,o]}set(e,t,i,n,a,o){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(a),s[5].copy(o),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=$a){let i=this.planes,n=e.elements,a=n[0],o=n[1],s=n[2],l=n[3],u=n[4],c=n[5],f=n[6],h=n[7],p=n[8],d=n[9],g=n[10],m=n[11],v=n[12],_=n[13],y=n[14],x=n[15];if(i[0].setComponents(l-a,h-u,m-p,x-v).normalize(),i[1].setComponents(l+a,h+u,m+p,x+v).normalize(),i[2].setComponents(l+o,h+c,m+d,x+_).normalize(),i[3].setComponents(l-o,h-c,m-d,x-_).normalize(),i[4].setComponents(l-s,h-f,m-g,x-y).normalize(),t===$a)i[5].setComponents(l+s,h+f,m+g,x+y).normalize();else if(t===yd)i[5].setComponents(s,f,g,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),bd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),bd.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bd)}intersectsSprite(e){return bd.center.set(0,0,0),bd.radius=.7071067811865476,bd.applyMatrix4(e.matrixWorld),this.intersectsSphere(bd)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(EA.x=n.normal.x>0?e.max.x:e.min.x,EA.y=n.normal.y>0?e.max.y:e.min.y,EA.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(EA)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function AA(){let r=null,e=!1,t=null,i=null;function n(a,o){t(a,o),i=r.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&(i=r.requestAnimationFrame(n),e=!0)},stop:function(){r.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(a){t=a},setContext:function(a){r=a}}}function KQ(r,e){let t=e.isWebGL2,i=new WeakMap;function n(u,c){let f=u.array,h=u.usage,p=f.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,f,h),u.onUploadCallback();let g;if(f instanceof Float32Array)g=r.FLOAT;else if(f instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(t)g=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)g=r.SHORT;else if(f instanceof Uint32Array)g=r.UNSIGNED_INT;else if(f instanceof Int32Array)g=r.INT;else if(f instanceof Int8Array)g=r.BYTE;else if(f instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:d,type:g,bytesPerElement:f.BYTES_PER_ELEMENT,version:u.version,size:p}}function a(u,c,f){let h=c.array,p=c._updateRange,d=c.updateRanges;if(r.bindBuffer(f,u),p.count===-1&&d.length===0&&r.bufferSubData(f,0,h),d.length!==0){for(let g=0,m=d.length;g<m;g++){let v=d[g];t?r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count):r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h.subarray(v.start,v.start+v.count))}c.clearUpdateRanges()}p.count!==-1&&(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1),c.onUploadCallback()}function o(u){return u.isInterleavedBufferAttribute&&(u=u.data),i.get(u)}function s(u){u.isInterleavedBufferAttribute&&(u=u.data);let c=i.get(u);c&&(r.deleteBuffer(c.buffer),i.delete(u))}function l(u,c){if(u.isGLBufferAttribute){let h=i.get(u);(!h||h.version<u.version)&&i.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}u.isInterleavedBufferAttribute&&(u=u.data);let f=i.get(u);if(f===void 0)i.set(u,n(u,c));else if(f.version<u.version){if(f.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");a(f.buffer,u,c),f.version=u.version}}return{get:o,remove:s,update:l}}var Vg=class r extends ro{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let a=e/2,o=t/2,s=Math.floor(i),l=Math.floor(n),u=s+1,c=l+1,f=e/s,h=t/l,p=[],d=[],g=[],m=[];for(let v=0;v<c;v++){let _=v*h-o;for(let y=0;y<u;y++){let x=y*f-a;d.push(x,-_,0),g.push(0,0,1),m.push(y/s),m.push(1-v/l)}}for(let v=0;v<l;v++)for(let _=0;_<s;_++){let y=_+u*v,x=_+u*(v+1),M=_+1+u*(v+1),S=_+1+u*v;p.push(y,x,S),p.push(x,M,S)}this.setIndex(p),this.setAttribute("position",new Zn(d,3)),this.setAttribute("normal",new Zn(g,3)),this.setAttribute("uv",new Zn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.widthSegments,e.heightSegments)}};var JQ=`
  2258. #ifdef USE_ALPHAHASH
  2259. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  2260. #endif
  2261. `;var $Q=`
  2262. #ifdef USE_ALPHAHASH
  2263. /**
  2264. * See: https://casual-effects.com/research/Wyman2017Hashed/index.html
  2265. */
  2266. const float ALPHA_HASH_SCALE = 0.05; // Derived from trials only, and may be changed.
  2267. float hash2D( vec2 value ) {
  2268. return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
  2269. }
  2270. float hash3D( vec3 value ) {
  2271. return hash2D( vec2( hash2D( value.xy ), value.z ) );
  2272. }
  2273. float getAlphaHashThreshold( vec3 position ) {
  2274. // Find the discretized derivatives of our coordinates
  2275. float maxDeriv = max(
  2276. length( dFdx( position.xyz ) ),
  2277. length( dFdy( position.xyz ) )
  2278. );
  2279. float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
  2280. // Find two nearest log-discretized noise scales
  2281. vec2 pixScales = vec2(
  2282. exp2( floor( log2( pixScale ) ) ),
  2283. exp2( ceil( log2( pixScale ) ) )
  2284. );
  2285. // Compute alpha thresholds at our two noise scales
  2286. vec2 alpha = vec2(
  2287. hash3D( floor( pixScales.x * position.xyz ) ),
  2288. hash3D( floor( pixScales.y * position.xyz ) )
  2289. );
  2290. // Factor to interpolate lerp with
  2291. float lerpFactor = fract( log2( pixScale ) );
  2292. // Interpolate alpha threshold from noise at two scales
  2293. float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
  2294. // Pass into CDF to compute uniformly distrib threshold
  2295. float a = min( lerpFactor, 1.0 - lerpFactor );
  2296. vec3 cases = vec3(
  2297. x * x / ( 2.0 * a * ( 1.0 - a ) ),
  2298. ( x - 0.5 * a ) / ( 1.0 - a ),
  2299. 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
  2300. );
  2301. // Find our final, uniformly distributed alpha threshold (\u03B1\u03C4)
  2302. float threshold = ( x < ( 1.0 - a ) )
  2303. ? ( ( x < a ) ? cases.x : cases.y )
  2304. : cases.z;
  2305. // Avoids \u03B1\u03C4 == 0. Could also do \u03B1\u03C4 =1-\u03B1\u03C4
  2306. return clamp( threshold , 1.0e-6, 1.0 );
  2307. }
  2308. #endif
  2309. `;var QQ=`
  2310. #ifdef USE_ALPHAMAP
  2311. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  2312. #endif
  2313. `;var eee=`
  2314. #ifdef USE_ALPHAMAP
  2315. uniform sampler2D alphaMap;
  2316. #endif
  2317. `;var tee=`
  2318. #ifdef USE_ALPHATEST
  2319. #ifdef ALPHA_TO_COVERAGE
  2320. diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
  2321. if ( diffuseColor.a == 0.0 ) discard;
  2322. #else
  2323. if ( diffuseColor.a < alphaTest ) discard;
  2324. #endif
  2325. #endif
  2326. `;var ree=`
  2327. #ifdef USE_ALPHATEST
  2328. uniform float alphaTest;
  2329. #endif
  2330. `;var iee=`
  2331. #ifdef USE_AOMAP
  2332. // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
  2333. float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
  2334. reflectedLight.indirectDiffuse *= ambientOcclusion;
  2335. #if defined( USE_CLEARCOAT )
  2336. clearcoatSpecularIndirect *= ambientOcclusion;
  2337. #endif
  2338. #if defined( USE_SHEEN )
  2339. sheenSpecularIndirect *= ambientOcclusion;
  2340. #endif
  2341. #if defined( USE_ENVMAP ) && defined( STANDARD )
  2342. float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
  2343. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  2344. #endif
  2345. #endif
  2346. `;var nee=`
  2347. #ifdef USE_AOMAP
  2348. uniform sampler2D aoMap;
  2349. uniform float aoMapIntensity;
  2350. #endif
  2351. `;var aee=`
  2352. #ifdef USE_BATCHING
  2353. attribute float batchId;
  2354. uniform highp sampler2D batchingTexture;
  2355. mat4 getBatchingMatrix( const in float i ) {
  2356. int size = textureSize( batchingTexture, 0 ).x;
  2357. int j = int( i ) * 4;
  2358. int x = j % size;
  2359. int y = j / size;
  2360. vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
  2361. vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
  2362. vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
  2363. vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
  2364. return mat4( v1, v2, v3, v4 );
  2365. }
  2366. #endif
  2367. `;var oee=`
  2368. #ifdef USE_BATCHING
  2369. mat4 batchingMatrix = getBatchingMatrix( batchId );
  2370. #endif
  2371. `;var see=`
  2372. vec3 transformed = vec3( position );
  2373. #ifdef USE_ALPHAHASH
  2374. vPosition = vec3( position );
  2375. #endif
  2376. `;var lee=`
  2377. vec3 objectNormal = vec3( normal );
  2378. #ifdef USE_TANGENT
  2379. vec3 objectTangent = vec3( tangent.xyz );
  2380. #endif
  2381. `;var uee=`
  2382. float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {
  2383. // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)
  2384. return 0.25;
  2385. }
  2386. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  2387. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  2388. }
  2389. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  2390. vec3 halfDir = normalize( lightDir + viewDir );
  2391. float dotNH = saturate( dot( normal, halfDir ) );
  2392. float dotVH = saturate( dot( viewDir, halfDir ) );
  2393. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  2394. float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );
  2395. float D = D_BlinnPhong( shininess, dotNH );
  2396. return F * ( G * D );
  2397. } // validated
  2398. `;var cee=`
  2399. #ifdef USE_IRIDESCENCE
  2400. // XYZ to linear-sRGB color space
  2401. const mat3 XYZ_TO_REC709 = mat3(
  2402. 3.2404542, -0.9692660, 0.0556434,
  2403. -1.5371385, 1.8760108, -0.2040259,
  2404. -0.4985314, 0.0415560, 1.0572252
  2405. );
  2406. // Assume air interface for top
  2407. // Note: We don't handle the case fresnel0 == 1
  2408. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  2409. vec3 sqrtF0 = sqrt( fresnel0 );
  2410. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  2411. }
  2412. // Conversion FO/IOR
  2413. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  2414. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  2415. }
  2416. // ior is a value between 1.0 and 3.0. 1.0 is air interface
  2417. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  2418. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  2419. }
  2420. // Fresnel equations for dielectric/dielectric interfaces.
  2421. // Ref: https://belcour.github.io/blog/research/2017/05/01/brdf-thin-film.html
  2422. // Evaluation XYZ sensitivity curves in Fourier space
  2423. vec3 evalSensitivity( float OPD, vec3 shift ) {
  2424. float phase = 2.0 * PI * OPD * 1.0e-9;
  2425. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  2426. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  2427. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  2428. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  2429. xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
  2430. xyz /= 1.0685e-7;
  2431. vec3 rgb = XYZ_TO_REC709 * xyz;
  2432. return rgb;
  2433. }
  2434. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  2435. vec3 I;
  2436. // Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0
  2437. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  2438. // Evaluate the cosTheta on the base layer (Snell law)
  2439. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  2440. // Handle TIR:
  2441. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  2442. if ( cosTheta2Sq < 0.0 ) {
  2443. return vec3( 1.0 );
  2444. }
  2445. float cosTheta2 = sqrt( cosTheta2Sq );
  2446. // First interface
  2447. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  2448. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  2449. float T121 = 1.0 - R12;
  2450. float phi12 = 0.0;
  2451. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  2452. float phi21 = PI - phi12;
  2453. // Second interface
  2454. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0
  2455. vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  2456. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  2457. vec3 phi23 = vec3( 0.0 );
  2458. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  2459. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  2460. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  2461. // Phase shift
  2462. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  2463. vec3 phi = vec3( phi21 ) + phi23;
  2464. // Compound terms
  2465. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  2466. vec3 r123 = sqrt( R123 );
  2467. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  2468. // Reflectance term for m = 0 (DC term amplitude)
  2469. vec3 C0 = R12 + Rs;
  2470. I = C0;
  2471. // Reflectance term for m > 0 (pairs of diracs)
  2472. vec3 Cm = Rs - T121;
  2473. for ( int m = 1; m <= 2; ++ m ) {
  2474. Cm *= r123;
  2475. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  2476. I += Cm * Sm;
  2477. }
  2478. // Since out of gamut colors might be produced, negative color values are clamped to 0.
  2479. return max( I, vec3( 0.0 ) );
  2480. }
  2481. #endif
  2482. `;var fee=`
  2483. #ifdef USE_BUMPMAP
  2484. uniform sampler2D bumpMap;
  2485. uniform float bumpScale;
  2486. // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen
  2487. // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf
  2488. // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
  2489. vec2 dHdxy_fwd() {
  2490. vec2 dSTdx = dFdx( vBumpMapUv );
  2491. vec2 dSTdy = dFdy( vBumpMapUv );
  2492. float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
  2493. float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
  2494. float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
  2495. return vec2( dBx, dBy );
  2496. }
  2497. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  2498. // normalize is done to ensure that the bump map looks the same regardless of the texture's scale
  2499. vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
  2500. vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
  2501. vec3 vN = surf_norm; // normalized
  2502. vec3 R1 = cross( vSigmaY, vN );
  2503. vec3 R2 = cross( vN, vSigmaX );
  2504. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  2505. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  2506. return normalize( abs( fDet ) * surf_norm - vGrad );
  2507. }
  2508. #endif
  2509. `;var hee=`
  2510. #if NUM_CLIPPING_PLANES > 0
  2511. vec4 plane;
  2512. #ifdef ALPHA_TO_COVERAGE
  2513. float distanceToPlane, distanceGradient;
  2514. float clipOpacity = 1.0;
  2515. #pragma unroll_loop_start
  2516. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  2517. plane = clippingPlanes[ i ];
  2518. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  2519. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  2520. clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  2521. if ( clipOpacity == 0.0 ) discard;
  2522. }
  2523. #pragma unroll_loop_end
  2524. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  2525. float unionClipOpacity = 1.0;
  2526. #pragma unroll_loop_start
  2527. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  2528. plane = clippingPlanes[ i ];
  2529. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  2530. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  2531. unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  2532. }
  2533. #pragma unroll_loop_end
  2534. clipOpacity *= 1.0 - unionClipOpacity;
  2535. #endif
  2536. diffuseColor.a *= clipOpacity;
  2537. if ( diffuseColor.a == 0.0 ) discard;
  2538. #else
  2539. #pragma unroll_loop_start
  2540. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  2541. plane = clippingPlanes[ i ];
  2542. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  2543. }
  2544. #pragma unroll_loop_end
  2545. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  2546. bool clipped = true;
  2547. #pragma unroll_loop_start
  2548. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  2549. plane = clippingPlanes[ i ];
  2550. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  2551. }
  2552. #pragma unroll_loop_end
  2553. if ( clipped ) discard;
  2554. #endif
  2555. #endif
  2556. #endif
  2557. `;var pee=`
  2558. #if NUM_CLIPPING_PLANES > 0
  2559. varying vec3 vClipPosition;
  2560. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  2561. #endif
  2562. `;var dee=`
  2563. #if NUM_CLIPPING_PLANES > 0
  2564. varying vec3 vClipPosition;
  2565. #endif
  2566. `;var mee=`
  2567. #if NUM_CLIPPING_PLANES > 0
  2568. vClipPosition = - mvPosition.xyz;
  2569. #endif
  2570. `;var vee=`
  2571. #if defined( USE_COLOR_ALPHA )
  2572. diffuseColor *= vColor;
  2573. #elif defined( USE_COLOR )
  2574. diffuseColor.rgb *= vColor;
  2575. #endif
  2576. `;var gee=`
  2577. #if defined( USE_COLOR_ALPHA )
  2578. varying vec4 vColor;
  2579. #elif defined( USE_COLOR )
  2580. varying vec3 vColor;
  2581. #endif
  2582. `;var yee=`
  2583. #if defined( USE_COLOR_ALPHA )
  2584. varying vec4 vColor;
  2585. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  2586. varying vec3 vColor;
  2587. #endif
  2588. `;var _ee=`
  2589. #if defined( USE_COLOR_ALPHA )
  2590. vColor = vec4( 1.0 );
  2591. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  2592. vColor = vec3( 1.0 );
  2593. #endif
  2594. #ifdef USE_COLOR
  2595. vColor *= color;
  2596. #endif
  2597. #ifdef USE_INSTANCING_COLOR
  2598. vColor.xyz *= instanceColor.xyz;
  2599. #endif
  2600. `;var xee=`
  2601. #define PI 3.141592653589793
  2602. #define PI2 6.283185307179586
  2603. #define PI_HALF 1.5707963267948966
  2604. #define RECIPROCAL_PI 0.3183098861837907
  2605. #define RECIPROCAL_PI2 0.15915494309189535
  2606. #define EPSILON 1e-6
  2607. #ifndef saturate
  2608. // <tonemapping_pars_fragment> may have defined saturate() already
  2609. #define saturate( a ) clamp( a, 0.0, 1.0 )
  2610. #endif
  2611. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  2612. float pow2( const in float x ) { return x*x; }
  2613. vec3 pow2( const in vec3 x ) { return x*x; }
  2614. float pow3( const in float x ) { return x*x*x; }
  2615. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  2616. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  2617. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  2618. // expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.
  2619. // do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
  2620. highp float rand( const in vec2 uv ) {
  2621. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  2622. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  2623. return fract( sin( sn ) * c );
  2624. }
  2625. #ifdef HIGH_PRECISION
  2626. float precisionSafeLength( vec3 v ) { return length( v ); }
  2627. #else
  2628. float precisionSafeLength( vec3 v ) {
  2629. float maxComponent = max3( abs( v ) );
  2630. return length( v / maxComponent ) * maxComponent;
  2631. }
  2632. #endif
  2633. struct IncidentLight {
  2634. vec3 color;
  2635. vec3 direction;
  2636. bool visible;
  2637. };
  2638. struct ReflectedLight {
  2639. vec3 directDiffuse;
  2640. vec3 directSpecular;
  2641. vec3 indirectDiffuse;
  2642. vec3 indirectSpecular;
  2643. };
  2644. #ifdef USE_ALPHAHASH
  2645. varying vec3 vPosition;
  2646. #endif
  2647. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  2648. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  2649. }
  2650. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  2651. // dir can be either a direction vector or a normal vector
  2652. // upper-left 3x3 of matrix is assumed to be orthogonal
  2653. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  2654. }
  2655. mat3 transposeMat3( const in mat3 m ) {
  2656. mat3 tmp;
  2657. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  2658. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  2659. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  2660. return tmp;
  2661. }
  2662. float luminance( const in vec3 rgb ) {
  2663. // assumes rgb is in linear color space with sRGB primaries and D65 white point
  2664. const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
  2665. return dot( weights, rgb );
  2666. }
  2667. bool isPerspectiveMatrix( mat4 m ) {
  2668. return m[ 2 ][ 3 ] == - 1.0;
  2669. }
  2670. vec2 equirectUv( in vec3 dir ) {
  2671. // dir is assumed to be unit length
  2672. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  2673. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  2674. return vec2( u, v );
  2675. }
  2676. vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  2677. return RECIPROCAL_PI * diffuseColor;
  2678. } // validated
  2679. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  2680. // Original approximation by Christophe Schlick '94
  2681. // float fresnel = pow( 1.0 - dotVH, 5.0 );
  2682. // Optimized variant (presented by Epic at SIGGRAPH '13)
  2683. // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
  2684. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  2685. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  2686. } // validated
  2687. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  2688. // Original approximation by Christophe Schlick '94
  2689. // float fresnel = pow( 1.0 - dotVH, 5.0 );
  2690. // Optimized variant (presented by Epic at SIGGRAPH '13)
  2691. // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
  2692. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  2693. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  2694. } // validated
  2695. `;var See=`
  2696. #ifdef ENVMAP_TYPE_CUBE_UV
  2697. #define cubeUV_minMipLevel 4.0
  2698. #define cubeUV_minTileSize 16.0
  2699. // These shader functions convert between the UV coordinates of a single face of
  2700. // a cubemap, the 0-5 integer index of a cube face, and the direction vector for
  2701. // sampling a textureCube (not generally normalized ).
  2702. float getFace( vec3 direction ) {
  2703. vec3 absDirection = abs( direction );
  2704. float face = - 1.0;
  2705. if ( absDirection.x > absDirection.z ) {
  2706. if ( absDirection.x > absDirection.y )
  2707. face = direction.x > 0.0 ? 0.0 : 3.0;
  2708. else
  2709. face = direction.y > 0.0 ? 1.0 : 4.0;
  2710. } else {
  2711. if ( absDirection.z > absDirection.y )
  2712. face = direction.z > 0.0 ? 2.0 : 5.0;
  2713. else
  2714. face = direction.y > 0.0 ? 1.0 : 4.0;
  2715. }
  2716. return face;
  2717. }
  2718. // RH coordinate system; PMREM face-indexing convention
  2719. vec2 getUV( vec3 direction, float face ) {
  2720. vec2 uv;
  2721. if ( face == 0.0 ) {
  2722. uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x
  2723. } else if ( face == 1.0 ) {
  2724. uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y
  2725. } else if ( face == 2.0 ) {
  2726. uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z
  2727. } else if ( face == 3.0 ) {
  2728. uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x
  2729. } else if ( face == 4.0 ) {
  2730. uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y
  2731. } else {
  2732. uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z
  2733. }
  2734. return 0.5 * ( uv + 1.0 );
  2735. }
  2736. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  2737. float face = getFace( direction );
  2738. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  2739. mipInt = max( mipInt, cubeUV_minMipLevel );
  2740. float faceSize = exp2( mipInt );
  2741. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071
  2742. if ( face > 2.0 ) {
  2743. uv.y += faceSize;
  2744. face -= 3.0;
  2745. }
  2746. uv.x += face * faceSize;
  2747. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  2748. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  2749. uv.x *= CUBEUV_TEXEL_WIDTH;
  2750. uv.y *= CUBEUV_TEXEL_HEIGHT;
  2751. #ifdef texture2DGradEXT
  2752. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering
  2753. #else
  2754. return texture2D( envMap, uv ).rgb;
  2755. #endif
  2756. }
  2757. // These defines must match with PMREMGenerator
  2758. #define cubeUV_r0 1.0
  2759. #define cubeUV_m0 - 2.0
  2760. #define cubeUV_r1 0.8
  2761. #define cubeUV_m1 - 1.0
  2762. #define cubeUV_r4 0.4
  2763. #define cubeUV_m4 2.0
  2764. #define cubeUV_r5 0.305
  2765. #define cubeUV_m5 3.0
  2766. #define cubeUV_r6 0.21
  2767. #define cubeUV_m6 4.0
  2768. float roughnessToMip( float roughness ) {
  2769. float mip = 0.0;
  2770. if ( roughness >= cubeUV_r1 ) {
  2771. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  2772. } else if ( roughness >= cubeUV_r4 ) {
  2773. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  2774. } else if ( roughness >= cubeUV_r5 ) {
  2775. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  2776. } else if ( roughness >= cubeUV_r6 ) {
  2777. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  2778. } else {
  2779. mip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25
  2780. }
  2781. return mip;
  2782. }
  2783. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  2784. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  2785. float mipF = fract( mip );
  2786. float mipInt = floor( mip );
  2787. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  2788. if ( mipF == 0.0 ) {
  2789. return vec4( color0, 1.0 );
  2790. } else {
  2791. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  2792. return vec4( mix( color0, color1, mipF ), 1.0 );
  2793. }
  2794. }
  2795. #endif
  2796. `;var Mee=`
  2797. vec3 transformedNormal = objectNormal;
  2798. #ifdef USE_TANGENT
  2799. vec3 transformedTangent = objectTangent;
  2800. #endif
  2801. #ifdef USE_BATCHING
  2802. // this is in lieu of a per-instance normal-matrix
  2803. // shear transforms in the instance matrix are not supported
  2804. mat3 bm = mat3( batchingMatrix );
  2805. transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
  2806. transformedNormal = bm * transformedNormal;
  2807. #ifdef USE_TANGENT
  2808. transformedTangent = bm * transformedTangent;
  2809. #endif
  2810. #endif
  2811. #ifdef USE_INSTANCING
  2812. // this is in lieu of a per-instance normal-matrix
  2813. // shear transforms in the instance matrix are not supported
  2814. mat3 im = mat3( instanceMatrix );
  2815. transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
  2816. transformedNormal = im * transformedNormal;
  2817. #ifdef USE_TANGENT
  2818. transformedTangent = im * transformedTangent;
  2819. #endif
  2820. #endif
  2821. transformedNormal = normalMatrix * transformedNormal;
  2822. #ifdef FLIP_SIDED
  2823. transformedNormal = - transformedNormal;
  2824. #endif
  2825. #ifdef USE_TANGENT
  2826. transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
  2827. #ifdef FLIP_SIDED
  2828. transformedTangent = - transformedTangent;
  2829. #endif
  2830. #endif
  2831. `;var bee=`
  2832. #ifdef USE_DISPLACEMENTMAP
  2833. uniform sampler2D displacementMap;
  2834. uniform float displacementScale;
  2835. uniform float displacementBias;
  2836. #endif
  2837. `;var wee=`
  2838. #ifdef USE_DISPLACEMENTMAP
  2839. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  2840. #endif
  2841. `;var Tee=`
  2842. #ifdef USE_EMISSIVEMAP
  2843. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  2844. totalEmissiveRadiance *= emissiveColor.rgb;
  2845. #endif
  2846. `;var Eee=`
  2847. #ifdef USE_EMISSIVEMAP
  2848. uniform sampler2D emissiveMap;
  2849. #endif
  2850. `;var Aee=`
  2851. gl_FragColor = linearToOutputTexel( gl_FragColor );
  2852. `;var Cee=`
  2853. // http://www.russellcottrell.com/photo/matrixCalculator.htm
  2854. // Linear sRGB => XYZ => Linear Display P3
  2855. const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
  2856. vec3( 0.8224621, 0.177538, 0.0 ),
  2857. vec3( 0.0331941, 0.9668058, 0.0 ),
  2858. vec3( 0.0170827, 0.0723974, 0.9105199 )
  2859. );
  2860. // Linear Display P3 => XYZ => Linear sRGB
  2861. const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
  2862. vec3( 1.2249401, - 0.2249404, 0.0 ),
  2863. vec3( - 0.0420569, 1.0420571, 0.0 ),
  2864. vec3( - 0.0196376, - 0.0786361, 1.0982735 )
  2865. );
  2866. vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
  2867. return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
  2868. }
  2869. vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
  2870. return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
  2871. }
  2872. vec4 LinearTransferOETF( in vec4 value ) {
  2873. return value;
  2874. }
  2875. vec4 sRGBTransferOETF( in vec4 value ) {
  2876. return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
  2877. }
  2878. // @deprecated, r156
  2879. vec4 LinearToLinear( in vec4 value ) {
  2880. return value;
  2881. }
  2882. // @deprecated, r156
  2883. vec4 LinearTosRGB( in vec4 value ) {
  2884. return sRGBTransferOETF( value );
  2885. }
  2886. `;var Ree=`
  2887. #ifdef USE_ENVMAP
  2888. #ifdef ENV_WORLDPOS
  2889. vec3 cameraToFrag;
  2890. if ( isOrthographic ) {
  2891. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  2892. } else {
  2893. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  2894. }
  2895. // Transforming Normal Vectors with the Inverse Transformation
  2896. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  2897. #ifdef ENVMAP_MODE_REFLECTION
  2898. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  2899. #else
  2900. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  2901. #endif
  2902. #else
  2903. vec3 reflectVec = vReflect;
  2904. #endif
  2905. #ifdef ENVMAP_TYPE_CUBE
  2906. vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  2907. #else
  2908. vec4 envColor = vec4( 0.0 );
  2909. #endif
  2910. #ifdef ENVMAP_BLENDING_MULTIPLY
  2911. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  2912. #elif defined( ENVMAP_BLENDING_MIX )
  2913. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  2914. #elif defined( ENVMAP_BLENDING_ADD )
  2915. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  2916. #endif
  2917. #endif
  2918. `;var Lee=`
  2919. #ifdef USE_ENVMAP
  2920. uniform float envMapIntensity;
  2921. uniform float flipEnvMap;
  2922. uniform mat3 envMapRotation;
  2923. #ifdef ENVMAP_TYPE_CUBE
  2924. uniform samplerCube envMap;
  2925. #else
  2926. uniform sampler2D envMap;
  2927. #endif
  2928. #endif
  2929. `;var Pee=`
  2930. #ifdef USE_ENVMAP
  2931. uniform float reflectivity;
  2932. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  2933. #define ENV_WORLDPOS
  2934. #endif
  2935. #ifdef ENV_WORLDPOS
  2936. varying vec3 vWorldPosition;
  2937. uniform float refractionRatio;
  2938. #else
  2939. varying vec3 vReflect;
  2940. #endif
  2941. #endif
  2942. `;var Dee=`
  2943. #ifdef USE_ENVMAP
  2944. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  2945. #define ENV_WORLDPOS
  2946. #endif
  2947. #ifdef ENV_WORLDPOS
  2948. varying vec3 vWorldPosition;
  2949. #else
  2950. varying vec3 vReflect;
  2951. uniform float refractionRatio;
  2952. #endif
  2953. #endif
  2954. `;var Iee=`
  2955. #ifdef USE_ENVMAP
  2956. #ifdef ENV_WORLDPOS
  2957. vWorldPosition = worldPosition.xyz;
  2958. #else
  2959. vec3 cameraToVertex;
  2960. if ( isOrthographic ) {
  2961. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  2962. } else {
  2963. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  2964. }
  2965. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  2966. #ifdef ENVMAP_MODE_REFLECTION
  2967. vReflect = reflect( cameraToVertex, worldNormal );
  2968. #else
  2969. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  2970. #endif
  2971. #endif
  2972. #endif
  2973. `;var Nee=`
  2974. #ifdef USE_FOG
  2975. vFogDepth = - mvPosition.z;
  2976. #endif
  2977. `;var Uee=`
  2978. #ifdef USE_FOG
  2979. varying float vFogDepth;
  2980. #endif
  2981. `;var Oee=`
  2982. #ifdef USE_FOG
  2983. #ifdef FOG_EXP2
  2984. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  2985. #else
  2986. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  2987. #endif
  2988. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  2989. #endif
  2990. `;var zee=`
  2991. #ifdef USE_FOG
  2992. uniform vec3 fogColor;
  2993. varying float vFogDepth;
  2994. #ifdef FOG_EXP2
  2995. uniform float fogDensity;
  2996. #else
  2997. uniform float fogNear;
  2998. uniform float fogFar;
  2999. #endif
  3000. #endif
  3001. `;var Fee=`
  3002. #ifdef USE_GRADIENTMAP
  3003. uniform sampler2D gradientMap;
  3004. #endif
  3005. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  3006. // dotNL will be from -1.0 to 1.0
  3007. float dotNL = dot( normal, lightDirection );
  3008. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  3009. #ifdef USE_GRADIENTMAP
  3010. return vec3( texture2D( gradientMap, coord ).r );
  3011. #else
  3012. vec2 fw = fwidth( coord ) * 0.5;
  3013. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  3014. #endif
  3015. }
  3016. `;var Bee=`
  3017. #ifdef USE_LIGHTMAP
  3018. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  3019. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  3020. reflectedLight.indirectDiffuse += lightMapIrradiance;
  3021. #endif
  3022. `;var kee=`
  3023. #ifdef USE_LIGHTMAP
  3024. uniform sampler2D lightMap;
  3025. uniform float lightMapIntensity;
  3026. #endif
  3027. `;var Vee=`
  3028. LambertMaterial material;
  3029. material.diffuseColor = diffuseColor.rgb;
  3030. material.specularStrength = specularStrength;
  3031. `;var Gee=`
  3032. varying vec3 vViewPosition;
  3033. struct LambertMaterial {
  3034. vec3 diffuseColor;
  3035. float specularStrength;
  3036. };
  3037. void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  3038. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  3039. vec3 irradiance = dotNL * directLight.color;
  3040. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3041. }
  3042. void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  3043. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3044. }
  3045. #define RE_Direct RE_Direct_Lambert
  3046. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert
  3047. `;var Hee=`
  3048. uniform bool receiveShadow;
  3049. uniform vec3 ambientLightColor;
  3050. #if defined( USE_LIGHT_PROBES )
  3051. uniform vec3 lightProbe[ 9 ];
  3052. #endif
  3053. // get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere
  3054. // source: https://graphics.stanford.edu/papers/envmap/envmap.pdf
  3055. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  3056. // normal is assumed to have unit length
  3057. float x = normal.x, y = normal.y, z = normal.z;
  3058. // band 0
  3059. vec3 result = shCoefficients[ 0 ] * 0.886227;
  3060. // band 1
  3061. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  3062. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  3063. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  3064. // band 2
  3065. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  3066. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  3067. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  3068. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  3069. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  3070. return result;
  3071. }
  3072. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  3073. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  3074. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  3075. return irradiance;
  3076. }
  3077. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  3078. vec3 irradiance = ambientLightColor;
  3079. return irradiance;
  3080. }
  3081. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  3082. #if defined ( LEGACY_LIGHTS )
  3083. if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
  3084. return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
  3085. }
  3086. return 1.0;
  3087. #else
  3088. // based upon Frostbite 3 Moving to Physically-based Rendering
  3089. // page 32, equation 26: E[window1]
  3090. // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
  3091. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  3092. if ( cutoffDistance > 0.0 ) {
  3093. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  3094. }
  3095. return distanceFalloff;
  3096. #endif
  3097. }
  3098. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  3099. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  3100. }
  3101. #if NUM_DIR_LIGHTS > 0
  3102. struct DirectionalLight {
  3103. vec3 direction;
  3104. vec3 color;
  3105. };
  3106. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  3107. void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
  3108. light.color = directionalLight.color;
  3109. light.direction = directionalLight.direction;
  3110. light.visible = true;
  3111. }
  3112. #endif
  3113. #if NUM_POINT_LIGHTS > 0
  3114. struct PointLight {
  3115. vec3 position;
  3116. vec3 color;
  3117. float distance;
  3118. float decay;
  3119. };
  3120. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  3121. // light is an out parameter as having it as a return value caused compiler errors on some devices
  3122. void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
  3123. vec3 lVector = pointLight.position - geometryPosition;
  3124. light.direction = normalize( lVector );
  3125. float lightDistance = length( lVector );
  3126. light.color = pointLight.color;
  3127. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  3128. light.visible = ( light.color != vec3( 0.0 ) );
  3129. }
  3130. #endif
  3131. #if NUM_SPOT_LIGHTS > 0
  3132. struct SpotLight {
  3133. vec3 position;
  3134. vec3 direction;
  3135. vec3 color;
  3136. float distance;
  3137. float decay;
  3138. float coneCos;
  3139. float penumbraCos;
  3140. };
  3141. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  3142. // light is an out parameter as having it as a return value caused compiler errors on some devices
  3143. void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
  3144. vec3 lVector = spotLight.position - geometryPosition;
  3145. light.direction = normalize( lVector );
  3146. float angleCos = dot( light.direction, spotLight.direction );
  3147. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  3148. if ( spotAttenuation > 0.0 ) {
  3149. float lightDistance = length( lVector );
  3150. light.color = spotLight.color * spotAttenuation;
  3151. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  3152. light.visible = ( light.color != vec3( 0.0 ) );
  3153. } else {
  3154. light.color = vec3( 0.0 );
  3155. light.visible = false;
  3156. }
  3157. }
  3158. #endif
  3159. #if NUM_RECT_AREA_LIGHTS > 0
  3160. struct RectAreaLight {
  3161. vec3 color;
  3162. vec3 position;
  3163. vec3 halfWidth;
  3164. vec3 halfHeight;
  3165. };
  3166. // Pre-computed values of LinearTransformedCosine approximation of BRDF
  3167. // BRDF approximation Texture is 64x64
  3168. uniform sampler2D ltc_1; // RGBA Float
  3169. uniform sampler2D ltc_2; // RGBA Float
  3170. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  3171. #endif
  3172. #if NUM_HEMI_LIGHTS > 0
  3173. struct HemisphereLight {
  3174. vec3 direction;
  3175. vec3 skyColor;
  3176. vec3 groundColor;
  3177. };
  3178. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  3179. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  3180. float dotNL = dot( normal, hemiLight.direction );
  3181. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  3182. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  3183. return irradiance;
  3184. }
  3185. #endif
  3186. `;var Wee=`
  3187. #ifdef USE_ENVMAP
  3188. vec3 getIBLIrradiance( const in vec3 normal ) {
  3189. #ifdef ENVMAP_TYPE_CUBE_UV
  3190. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  3191. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
  3192. return PI * envMapColor.rgb * envMapIntensity;
  3193. #else
  3194. return vec3( 0.0 );
  3195. #endif
  3196. }
  3197. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  3198. #ifdef ENVMAP_TYPE_CUBE_UV
  3199. vec3 reflectVec = reflect( - viewDir, normal );
  3200. // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.
  3201. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  3202. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  3203. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
  3204. return envMapColor.rgb * envMapIntensity;
  3205. #else
  3206. return vec3( 0.0 );
  3207. #endif
  3208. }
  3209. #ifdef USE_ANISOTROPY
  3210. vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
  3211. #ifdef ENVMAP_TYPE_CUBE_UV
  3212. // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy
  3213. vec3 bentNormal = cross( bitangent, viewDir );
  3214. bentNormal = normalize( cross( bentNormal, bitangent ) );
  3215. bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
  3216. return getIBLRadiance( viewDir, bentNormal, roughness );
  3217. #else
  3218. return vec3( 0.0 );
  3219. #endif
  3220. }
  3221. #endif
  3222. #endif
  3223. `;var Xee=`
  3224. ToonMaterial material;
  3225. material.diffuseColor = diffuseColor.rgb;
  3226. `;var Yee=`
  3227. varying vec3 vViewPosition;
  3228. struct ToonMaterial {
  3229. vec3 diffuseColor;
  3230. };
  3231. void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  3232. vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
  3233. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3234. }
  3235. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  3236. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3237. }
  3238. #define RE_Direct RE_Direct_Toon
  3239. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
  3240. `;var qee=`
  3241. BlinnPhongMaterial material;
  3242. material.diffuseColor = diffuseColor.rgb;
  3243. material.specularColor = specular;
  3244. material.specularShininess = shininess;
  3245. material.specularStrength = specularStrength;
  3246. `;var Zee=`
  3247. varying vec3 vViewPosition;
  3248. struct BlinnPhongMaterial {
  3249. vec3 diffuseColor;
  3250. vec3 specularColor;
  3251. float specularShininess;
  3252. float specularStrength;
  3253. };
  3254. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  3255. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  3256. vec3 irradiance = dotNL * directLight.color;
  3257. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3258. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
  3259. }
  3260. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  3261. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3262. }
  3263. #define RE_Direct RE_Direct_BlinnPhong
  3264. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
  3265. `;var jee=`
  3266. PhysicalMaterial material;
  3267. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  3268. vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
  3269. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  3270. material.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.
  3271. material.roughness += geometryRoughness;
  3272. material.roughness = min( material.roughness, 1.0 );
  3273. #ifdef IOR
  3274. material.ior = ior;
  3275. #ifdef USE_SPECULAR
  3276. float specularIntensityFactor = specularIntensity;
  3277. vec3 specularColorFactor = specularColor;
  3278. #ifdef USE_SPECULAR_COLORMAP
  3279. specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
  3280. #endif
  3281. #ifdef USE_SPECULAR_INTENSITYMAP
  3282. specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
  3283. #endif
  3284. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  3285. #else
  3286. float specularIntensityFactor = 1.0;
  3287. vec3 specularColorFactor = vec3( 1.0 );
  3288. material.specularF90 = 1.0;
  3289. #endif
  3290. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  3291. #else
  3292. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  3293. material.specularF90 = 1.0;
  3294. #endif
  3295. #ifdef USE_CLEARCOAT
  3296. material.clearcoat = clearcoat;
  3297. material.clearcoatRoughness = clearcoatRoughness;
  3298. material.clearcoatF0 = vec3( 0.04 );
  3299. material.clearcoatF90 = 1.0;
  3300. #ifdef USE_CLEARCOATMAP
  3301. material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
  3302. #endif
  3303. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  3304. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
  3305. #endif
  3306. material.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model
  3307. material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  3308. material.clearcoatRoughness += geometryRoughness;
  3309. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  3310. #endif
  3311. #ifdef USE_IRIDESCENCE
  3312. material.iridescence = iridescence;
  3313. material.iridescenceIOR = iridescenceIOR;
  3314. #ifdef USE_IRIDESCENCEMAP
  3315. material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
  3316. #endif
  3317. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  3318. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
  3319. #else
  3320. material.iridescenceThickness = iridescenceThicknessMaximum;
  3321. #endif
  3322. #endif
  3323. #ifdef USE_SHEEN
  3324. material.sheenColor = sheenColor;
  3325. #ifdef USE_SHEEN_COLORMAP
  3326. material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
  3327. #endif
  3328. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  3329. #ifdef USE_SHEEN_ROUGHNESSMAP
  3330. material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
  3331. #endif
  3332. #endif
  3333. #ifdef USE_ANISOTROPY
  3334. #ifdef USE_ANISOTROPYMAP
  3335. mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
  3336. vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
  3337. vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
  3338. #else
  3339. vec2 anisotropyV = anisotropyVector;
  3340. #endif
  3341. material.anisotropy = length( anisotropyV );
  3342. if( material.anisotropy == 0.0 ) {
  3343. anisotropyV = vec2( 1.0, 0.0 );
  3344. } else {
  3345. anisotropyV /= material.anisotropy;
  3346. material.anisotropy = saturate( material.anisotropy );
  3347. }
  3348. // Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy.
  3349. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
  3350. material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
  3351. material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
  3352. #endif
  3353. `;var Kee=`
  3354. struct PhysicalMaterial {
  3355. vec3 diffuseColor;
  3356. float roughness;
  3357. vec3 specularColor;
  3358. float specularF90;
  3359. #ifdef USE_CLEARCOAT
  3360. float clearcoat;
  3361. float clearcoatRoughness;
  3362. vec3 clearcoatF0;
  3363. float clearcoatF90;
  3364. #endif
  3365. #ifdef USE_IRIDESCENCE
  3366. float iridescence;
  3367. float iridescenceIOR;
  3368. float iridescenceThickness;
  3369. vec3 iridescenceFresnel;
  3370. vec3 iridescenceF0;
  3371. #endif
  3372. #ifdef USE_SHEEN
  3373. vec3 sheenColor;
  3374. float sheenRoughness;
  3375. #endif
  3376. #ifdef IOR
  3377. float ior;
  3378. #endif
  3379. #ifdef USE_TRANSMISSION
  3380. float transmission;
  3381. float transmissionAlpha;
  3382. float thickness;
  3383. float attenuationDistance;
  3384. vec3 attenuationColor;
  3385. #endif
  3386. #ifdef USE_ANISOTROPY
  3387. float anisotropy;
  3388. float alphaT;
  3389. vec3 anisotropyT;
  3390. vec3 anisotropyB;
  3391. #endif
  3392. };
  3393. // temporary
  3394. vec3 clearcoatSpecularDirect = vec3( 0.0 );
  3395. vec3 clearcoatSpecularIndirect = vec3( 0.0 );
  3396. vec3 sheenSpecularDirect = vec3( 0.0 );
  3397. vec3 sheenSpecularIndirect = vec3(0.0 );
  3398. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  3399. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  3400. float x2 = x * x;
  3401. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  3402. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  3403. }
  3404. // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
  3405. // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
  3406. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  3407. float a2 = pow2( alpha );
  3408. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  3409. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  3410. return 0.5 / max( gv + gl, EPSILON );
  3411. }
  3412. // Microfacet Models for Refraction through Rough Surfaces - equation (33)
  3413. // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
  3414. // alpha is "roughness squared" in Disney\u2019s reparameterization
  3415. float D_GGX( const in float alpha, const in float dotNH ) {
  3416. float a2 = pow2( alpha );
  3417. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1
  3418. return RECIPROCAL_PI * a2 / pow2( denom );
  3419. }
  3420. // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
  3421. #ifdef USE_ANISOTROPY
  3422. float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
  3423. float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
  3424. float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
  3425. float v = 0.5 / ( gv + gl );
  3426. return saturate(v);
  3427. }
  3428. float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
  3429. float a2 = alphaT * alphaB;
  3430. highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
  3431. highp float v2 = dot( v, v );
  3432. float w2 = a2 / v2;
  3433. return RECIPROCAL_PI * a2 * pow2 ( w2 );
  3434. }
  3435. #endif
  3436. #ifdef USE_CLEARCOAT
  3437. // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
  3438. vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
  3439. vec3 f0 = material.clearcoatF0;
  3440. float f90 = material.clearcoatF90;
  3441. float roughness = material.clearcoatRoughness;
  3442. float alpha = pow2( roughness ); // UE4's roughness
  3443. vec3 halfDir = normalize( lightDir + viewDir );
  3444. float dotNL = saturate( dot( normal, lightDir ) );
  3445. float dotNV = saturate( dot( normal, viewDir ) );
  3446. float dotNH = saturate( dot( normal, halfDir ) );
  3447. float dotVH = saturate( dot( viewDir, halfDir ) );
  3448. vec3 F = F_Schlick( f0, f90, dotVH );
  3449. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  3450. float D = D_GGX( alpha, dotNH );
  3451. return F * ( V * D );
  3452. }
  3453. #endif
  3454. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  3455. vec3 f0 = material.specularColor;
  3456. float f90 = material.specularF90;
  3457. float roughness = material.roughness;
  3458. float alpha = pow2( roughness ); // UE4's roughness
  3459. vec3 halfDir = normalize( lightDir + viewDir );
  3460. float dotNL = saturate( dot( normal, lightDir ) );
  3461. float dotNV = saturate( dot( normal, viewDir ) );
  3462. float dotNH = saturate( dot( normal, halfDir ) );
  3463. float dotVH = saturate( dot( viewDir, halfDir ) );
  3464. vec3 F = F_Schlick( f0, f90, dotVH );
  3465. #ifdef USE_IRIDESCENCE
  3466. F = mix( F, material.iridescenceFresnel, material.iridescence );
  3467. #endif
  3468. #ifdef USE_ANISOTROPY
  3469. float dotTL = dot( material.anisotropyT, lightDir );
  3470. float dotTV = dot( material.anisotropyT, viewDir );
  3471. float dotTH = dot( material.anisotropyT, halfDir );
  3472. float dotBL = dot( material.anisotropyB, lightDir );
  3473. float dotBV = dot( material.anisotropyB, viewDir );
  3474. float dotBH = dot( material.anisotropyB, halfDir );
  3475. float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
  3476. float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
  3477. #else
  3478. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  3479. float D = D_GGX( alpha, dotNH );
  3480. #endif
  3481. return F * ( V * D );
  3482. }
  3483. // Rect Area Light
  3484. // Real-Time Polygonal-Light Shading with Linearly Transformed Cosines
  3485. // by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
  3486. // code: https://github.com/selfshadow/ltc_code/
  3487. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  3488. const float LUT_SIZE = 64.0;
  3489. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  3490. const float LUT_BIAS = 0.5 / LUT_SIZE;
  3491. float dotNV = saturate( dot( N, V ) );
  3492. // texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )
  3493. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  3494. uv = uv * LUT_SCALE + LUT_BIAS;
  3495. return uv;
  3496. }
  3497. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  3498. // Real-Time Area Lighting: a Journey from Research to Production (p.102)
  3499. // An approximation of the form factor of a horizon-clipped rectangle.
  3500. float l = length( f );
  3501. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  3502. }
  3503. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  3504. float x = dot( v1, v2 );
  3505. float y = abs( x );
  3506. // rational polynomial approximation to theta / sin( theta ) / 2PI
  3507. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  3508. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  3509. float v = a / b;
  3510. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  3511. return cross( v1, v2 ) * theta_sintheta;
  3512. }
  3513. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  3514. // bail if point is on back side of plane of light
  3515. // assumes ccw winding order of light vertices
  3516. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  3517. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  3518. vec3 lightNormal = cross( v1, v2 );
  3519. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  3520. // construct orthonormal basis around N
  3521. vec3 T1, T2;
  3522. T1 = normalize( V - N * dot( V, N ) );
  3523. T2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system
  3524. // compute transform
  3525. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  3526. // transform rect
  3527. vec3 coords[ 4 ];
  3528. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  3529. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  3530. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  3531. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  3532. // project rect onto sphere
  3533. coords[ 0 ] = normalize( coords[ 0 ] );
  3534. coords[ 1 ] = normalize( coords[ 1 ] );
  3535. coords[ 2 ] = normalize( coords[ 2 ] );
  3536. coords[ 3 ] = normalize( coords[ 3 ] );
  3537. // calculate vector form factor
  3538. vec3 vectorFormFactor = vec3( 0.0 );
  3539. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  3540. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  3541. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  3542. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  3543. // adjust for horizon clipping
  3544. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  3545. /*
  3546. // alternate method of adjusting for horizon clipping (see referece)
  3547. // refactoring required
  3548. float len = length( vectorFormFactor );
  3549. float z = vectorFormFactor.z / len;
  3550. const float LUT_SIZE = 64.0;
  3551. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  3552. const float LUT_BIAS = 0.5 / LUT_SIZE;
  3553. // tabulated horizon-clipped sphere, apparently...
  3554. vec2 uv = vec2( z * 0.5 + 0.5, len );
  3555. uv = uv * LUT_SCALE + LUT_BIAS;
  3556. float scale = texture2D( ltc_2, uv ).w;
  3557. float result = len * scale;
  3558. */
  3559. return vec3( result );
  3560. }
  3561. // End Rect Area Light
  3562. #if defined( USE_SHEEN )
  3563. // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
  3564. float D_Charlie( float roughness, float dotNH ) {
  3565. float alpha = pow2( roughness );
  3566. // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
  3567. float invAlpha = 1.0 / alpha;
  3568. float cos2h = dotNH * dotNH;
  3569. float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16
  3570. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  3571. }
  3572. // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
  3573. float V_Neubelt( float dotNV, float dotNL ) {
  3574. // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
  3575. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  3576. }
  3577. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  3578. vec3 halfDir = normalize( lightDir + viewDir );
  3579. float dotNL = saturate( dot( normal, lightDir ) );
  3580. float dotNV = saturate( dot( normal, viewDir ) );
  3581. float dotNH = saturate( dot( normal, halfDir ) );
  3582. float D = D_Charlie( sheenRoughness, dotNH );
  3583. float V = V_Neubelt( dotNV, dotNL );
  3584. return sheenColor * ( D * V );
  3585. }
  3586. #endif
  3587. // This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from
  3588. // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found
  3589. // in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
  3590. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  3591. float dotNV = saturate( dot( normal, viewDir ) );
  3592. float r2 = roughness * roughness;
  3593. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  3594. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  3595. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  3596. return saturate( DG * RECIPROCAL_PI );
  3597. }
  3598. // Analytical approximation of the DFG LUT, one half of the
  3599. // split-sum approximation used in indirect specular lighting.
  3600. // via 'environmentBRDF' from "Physically Based Shading on Mobile"
  3601. // https://www.unrealengine.com/blog/physically-based-shading-on-mobile
  3602. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  3603. float dotNV = saturate( dot( normal, viewDir ) );
  3604. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  3605. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  3606. vec4 r = roughness * c0 + c1;
  3607. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  3608. vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
  3609. return fab;
  3610. }
  3611. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  3612. vec2 fab = DFGApprox( normal, viewDir, roughness );
  3613. return specularColor * fab.x + specularF90 * fab.y;
  3614. }
  3615. // Fdez-Ag\xFCera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"
  3616. // Approximates multiscattering in order to preserve energy.
  3617. // http://www.jcgt.org/published/0008/01/03/
  3618. #ifdef USE_IRIDESCENCE
  3619. void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  3620. #else
  3621. void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  3622. #endif
  3623. vec2 fab = DFGApprox( normal, viewDir, roughness );
  3624. #ifdef USE_IRIDESCENCE
  3625. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  3626. #else
  3627. vec3 Fr = specularColor;
  3628. #endif
  3629. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  3630. float Ess = fab.x + fab.y;
  3631. float Ems = 1.0 - Ess;
  3632. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21
  3633. vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  3634. singleScatter += FssEss;
  3635. multiScatter += Fms * Ems;
  3636. }
  3637. #if NUM_RECT_AREA_LIGHTS > 0
  3638. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  3639. vec3 normal = geometryNormal;
  3640. vec3 viewDir = geometryViewDir;
  3641. vec3 position = geometryPosition;
  3642. vec3 lightPos = rectAreaLight.position;
  3643. vec3 halfWidth = rectAreaLight.halfWidth;
  3644. vec3 halfHeight = rectAreaLight.halfHeight;
  3645. vec3 lightColor = rectAreaLight.color;
  3646. float roughness = material.roughness;
  3647. vec3 rectCoords[ 4 ];
  3648. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction
  3649. rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  3650. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  3651. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  3652. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  3653. vec4 t1 = texture2D( ltc_1, uv );
  3654. vec4 t2 = texture2D( ltc_2, uv );
  3655. mat3 mInv = mat3(
  3656. vec3( t1.x, 0, t1.y ),
  3657. vec3( 0, 1, 0 ),
  3658. vec3( t1.z, 0, t1.w )
  3659. );
  3660. // LTC Fresnel Approximation by Stephen Hill
  3661. // http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf
  3662. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  3663. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  3664. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  3665. }
  3666. #endif
  3667. void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  3668. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  3669. vec3 irradiance = dotNL * directLight.color;
  3670. #ifdef USE_CLEARCOAT
  3671. float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
  3672. vec3 ccIrradiance = dotNLcc * directLight.color;
  3673. clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
  3674. #endif
  3675. #ifdef USE_SHEEN
  3676. sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
  3677. #endif
  3678. reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
  3679. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3680. }
  3681. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  3682. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3683. }
  3684. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  3685. #ifdef USE_CLEARCOAT
  3686. clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  3687. #endif
  3688. #ifdef USE_SHEEN
  3689. sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
  3690. #endif
  3691. // Both indirect specular and indirect diffuse light accumulate here
  3692. vec3 singleScattering = vec3( 0.0 );
  3693. vec3 multiScattering = vec3( 0.0 );
  3694. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  3695. #ifdef USE_IRIDESCENCE
  3696. computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  3697. #else
  3698. computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  3699. #endif
  3700. vec3 totalScattering = singleScattering + multiScattering;
  3701. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  3702. reflectedLight.indirectSpecular += radiance * singleScattering;
  3703. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  3704. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  3705. }
  3706. #define RE_Direct RE_Direct_Physical
  3707. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  3708. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  3709. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  3710. // ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
  3711. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  3712. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  3713. }
  3714. `;var Jee=`
  3715. /**
  3716. * This is a template that can be used to light a material, it uses pluggable
  3717. * RenderEquations (RE)for specific lighting scenarios.
  3718. *
  3719. * Instructions for use:
  3720. * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined
  3721. * - Create a material parameter that is to be passed as the third parameter to your lighting functions.
  3722. *
  3723. * TODO:
  3724. * - Add area light support.
  3725. * - Add sphere light support.
  3726. * - Add diffuse light probe (irradiance cubemap) support.
  3727. */
  3728. vec3 geometryPosition = - vViewPosition;
  3729. vec3 geometryNormal = normal;
  3730. vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  3731. vec3 geometryClearcoatNormal = vec3( 0.0 );
  3732. #ifdef USE_CLEARCOAT
  3733. geometryClearcoatNormal = clearcoatNormal;
  3734. #endif
  3735. #ifdef USE_IRIDESCENCE
  3736. float dotNVi = saturate( dot( normal, geometryViewDir ) );
  3737. if ( material.iridescenceThickness == 0.0 ) {
  3738. material.iridescence = 0.0;
  3739. } else {
  3740. material.iridescence = saturate( material.iridescence );
  3741. }
  3742. if ( material.iridescence > 0.0 ) {
  3743. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  3744. // Iridescence F0 approximation
  3745. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  3746. }
  3747. #endif
  3748. IncidentLight directLight;
  3749. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  3750. PointLight pointLight;
  3751. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  3752. PointLightShadow pointLightShadow;
  3753. #endif
  3754. #pragma unroll_loop_start
  3755. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  3756. pointLight = pointLights[ i ];
  3757. getPointLightInfo( pointLight, geometryPosition, directLight );
  3758. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  3759. pointLightShadow = pointLightShadows[ i ];
  3760. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  3761. #endif
  3762. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3763. }
  3764. #pragma unroll_loop_end
  3765. #endif
  3766. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  3767. SpotLight spotLight;
  3768. vec4 spotColor;
  3769. vec3 spotLightCoord;
  3770. bool inSpotLightMap;
  3771. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  3772. SpotLightShadow spotLightShadow;
  3773. #endif
  3774. #pragma unroll_loop_start
  3775. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  3776. spotLight = spotLights[ i ];
  3777. getSpotLightInfo( spotLight, geometryPosition, directLight );
  3778. // spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]
  3779. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  3780. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  3781. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  3782. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  3783. #else
  3784. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  3785. #endif
  3786. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  3787. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  3788. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  3789. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  3790. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  3791. #endif
  3792. #undef SPOT_LIGHT_MAP_INDEX
  3793. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  3794. spotLightShadow = spotLightShadows[ i ];
  3795. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  3796. #endif
  3797. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3798. }
  3799. #pragma unroll_loop_end
  3800. #endif
  3801. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  3802. DirectionalLight directionalLight;
  3803. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  3804. DirectionalLightShadow directionalLightShadow;
  3805. #endif
  3806. #pragma unroll_loop_start
  3807. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  3808. directionalLight = directionalLights[ i ];
  3809. getDirectionalLightInfo( directionalLight, directLight );
  3810. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  3811. directionalLightShadow = directionalLightShadows[ i ];
  3812. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  3813. #endif
  3814. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3815. }
  3816. #pragma unroll_loop_end
  3817. #endif
  3818. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  3819. RectAreaLight rectAreaLight;
  3820. #pragma unroll_loop_start
  3821. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  3822. rectAreaLight = rectAreaLights[ i ];
  3823. RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3824. }
  3825. #pragma unroll_loop_end
  3826. #endif
  3827. #if defined( RE_IndirectDiffuse )
  3828. vec3 iblIrradiance = vec3( 0.0 );
  3829. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  3830. #if defined( USE_LIGHT_PROBES )
  3831. irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
  3832. #endif
  3833. #if ( NUM_HEMI_LIGHTS > 0 )
  3834. #pragma unroll_loop_start
  3835. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  3836. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
  3837. }
  3838. #pragma unroll_loop_end
  3839. #endif
  3840. #endif
  3841. #if defined( RE_IndirectSpecular )
  3842. vec3 radiance = vec3( 0.0 );
  3843. vec3 clearcoatRadiance = vec3( 0.0 );
  3844. #endif
  3845. `;var $ee=`
  3846. #if defined( RE_IndirectDiffuse )
  3847. #ifdef USE_LIGHTMAP
  3848. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  3849. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  3850. irradiance += lightMapIrradiance;
  3851. #endif
  3852. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  3853. iblIrradiance += getIBLIrradiance( geometryNormal );
  3854. #endif
  3855. #endif
  3856. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  3857. #ifdef USE_ANISOTROPY
  3858. radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
  3859. #else
  3860. radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
  3861. #endif
  3862. #ifdef USE_CLEARCOAT
  3863. clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
  3864. #endif
  3865. #endif
  3866. `;var Qee=`
  3867. #if defined( RE_IndirectDiffuse )
  3868. RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3869. #endif
  3870. #if defined( RE_IndirectSpecular )
  3871. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3872. #endif
  3873. `;var ete=`
  3874. #if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  3875. // Doing a strict comparison with == 1.0 can cause noise artifacts
  3876. // on some platforms. See issue #17623.
  3877. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  3878. #endif
  3879. `;var tte=`
  3880. #if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  3881. uniform float logDepthBufFC;
  3882. varying float vFragDepth;
  3883. varying float vIsPerspective;
  3884. #endif
  3885. `;var rte=`
  3886. #ifdef USE_LOGDEPTHBUF
  3887. #ifdef USE_LOGDEPTHBUF_EXT
  3888. varying float vFragDepth;
  3889. varying float vIsPerspective;
  3890. #else
  3891. uniform float logDepthBufFC;
  3892. #endif
  3893. #endif
  3894. `;var ite=`
  3895. #ifdef USE_LOGDEPTHBUF
  3896. #ifdef USE_LOGDEPTHBUF_EXT
  3897. vFragDepth = 1.0 + gl_Position.w;
  3898. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  3899. #else
  3900. if ( isPerspectiveMatrix( projectionMatrix ) ) {
  3901. gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
  3902. gl_Position.z *= gl_Position.w;
  3903. }
  3904. #endif
  3905. #endif
  3906. `;var nte=`
  3907. #ifdef USE_MAP
  3908. vec4 sampledDiffuseColor = texture2D( map, vMapUv );
  3909. #ifdef DECODE_VIDEO_TEXTURE
  3910. // use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)
  3911. sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
  3912. #endif
  3913. diffuseColor *= sampledDiffuseColor;
  3914. #endif
  3915. `;var ate=`
  3916. #ifdef USE_MAP
  3917. uniform sampler2D map;
  3918. #endif
  3919. `;var ote=`
  3920. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  3921. #if defined( USE_POINTS_UV )
  3922. vec2 uv = vUv;
  3923. #else
  3924. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  3925. #endif
  3926. #endif
  3927. #ifdef USE_MAP
  3928. diffuseColor *= texture2D( map, uv );
  3929. #endif
  3930. #ifdef USE_ALPHAMAP
  3931. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  3932. #endif
  3933. `;var ste=`
  3934. #if defined( USE_POINTS_UV )
  3935. varying vec2 vUv;
  3936. #else
  3937. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  3938. uniform mat3 uvTransform;
  3939. #endif
  3940. #endif
  3941. #ifdef USE_MAP
  3942. uniform sampler2D map;
  3943. #endif
  3944. #ifdef USE_ALPHAMAP
  3945. uniform sampler2D alphaMap;
  3946. #endif
  3947. `;var lte=`
  3948. float metalnessFactor = metalness;
  3949. #ifdef USE_METALNESSMAP
  3950. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  3951. // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
  3952. metalnessFactor *= texelMetalness.b;
  3953. #endif
  3954. `;var ute=`
  3955. #ifdef USE_METALNESSMAP
  3956. uniform sampler2D metalnessMap;
  3957. #endif
  3958. `;var cte=`
  3959. #ifdef USE_INSTANCING_MORPH
  3960. float morphTargetInfluences[MORPHTARGETS_COUNT];
  3961. float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
  3962. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  3963. morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
  3964. }
  3965. #endif
  3966. `;var fte=`
  3967. #if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
  3968. // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
  3969. // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)
  3970. // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
  3971. vColor *= morphTargetBaseInfluence;
  3972. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  3973. #if defined( USE_COLOR_ALPHA )
  3974. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  3975. #elif defined( USE_COLOR )
  3976. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  3977. #endif
  3978. }
  3979. #endif
  3980. `;var hte=`
  3981. #ifdef USE_MORPHNORMALS
  3982. // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
  3983. // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)
  3984. // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
  3985. objectNormal *= morphTargetBaseInfluence;
  3986. #ifdef MORPHTARGETS_TEXTURE
  3987. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  3988. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  3989. }
  3990. #else
  3991. objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
  3992. objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
  3993. objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
  3994. objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
  3995. #endif
  3996. #endif
  3997. `;var pte=`
  3998. #ifdef USE_MORPHTARGETS
  3999. #ifndef USE_INSTANCING_MORPH
  4000. uniform float morphTargetBaseInfluence;
  4001. #endif
  4002. #ifdef MORPHTARGETS_TEXTURE
  4003. #ifndef USE_INSTANCING_MORPH
  4004. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  4005. #endif
  4006. uniform sampler2DArray morphTargetsTexture;
  4007. uniform ivec2 morphTargetsTextureSize;
  4008. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  4009. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  4010. int y = texelIndex / morphTargetsTextureSize.x;
  4011. int x = texelIndex - y * morphTargetsTextureSize.x;
  4012. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  4013. return texelFetch( morphTargetsTexture, morphUV, 0 );
  4014. }
  4015. #else
  4016. #ifndef USE_MORPHNORMALS
  4017. uniform float morphTargetInfluences[ 8 ];
  4018. #else
  4019. uniform float morphTargetInfluences[ 4 ];
  4020. #endif
  4021. #endif
  4022. #endif
  4023. `;var dte=`
  4024. #ifdef USE_MORPHTARGETS
  4025. // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
  4026. // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)
  4027. // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
  4028. transformed *= morphTargetBaseInfluence;
  4029. #ifdef MORPHTARGETS_TEXTURE
  4030. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  4031. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  4032. }
  4033. #else
  4034. transformed += morphTarget0 * morphTargetInfluences[ 0 ];
  4035. transformed += morphTarget1 * morphTargetInfluences[ 1 ];
  4036. transformed += morphTarget2 * morphTargetInfluences[ 2 ];
  4037. transformed += morphTarget3 * morphTargetInfluences[ 3 ];
  4038. #ifndef USE_MORPHNORMALS
  4039. transformed += morphTarget4 * morphTargetInfluences[ 4 ];
  4040. transformed += morphTarget5 * morphTargetInfluences[ 5 ];
  4041. transformed += morphTarget6 * morphTargetInfluences[ 6 ];
  4042. transformed += morphTarget7 * morphTargetInfluences[ 7 ];
  4043. #endif
  4044. #endif
  4045. #endif
  4046. `;var mte=`
  4047. float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  4048. #ifdef FLAT_SHADED
  4049. vec3 fdx = dFdx( vViewPosition );
  4050. vec3 fdy = dFdy( vViewPosition );
  4051. vec3 normal = normalize( cross( fdx, fdy ) );
  4052. #else
  4053. vec3 normal = normalize( vNormal );
  4054. #ifdef DOUBLE_SIDED
  4055. normal *= faceDirection;
  4056. #endif
  4057. #endif
  4058. #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
  4059. #ifdef USE_TANGENT
  4060. mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  4061. #else
  4062. mat3 tbn = getTangentFrame( - vViewPosition, normal,
  4063. #if defined( USE_NORMALMAP )
  4064. vNormalMapUv
  4065. #elif defined( USE_CLEARCOAT_NORMALMAP )
  4066. vClearcoatNormalMapUv
  4067. #else
  4068. vUv
  4069. #endif
  4070. );
  4071. #endif
  4072. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  4073. tbn[0] *= faceDirection;
  4074. tbn[1] *= faceDirection;
  4075. #endif
  4076. #endif
  4077. #ifdef USE_CLEARCOAT_NORMALMAP
  4078. #ifdef USE_TANGENT
  4079. mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  4080. #else
  4081. mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
  4082. #endif
  4083. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  4084. tbn2[0] *= faceDirection;
  4085. tbn2[1] *= faceDirection;
  4086. #endif
  4087. #endif
  4088. // non perturbed normal for clearcoat among others
  4089. vec3 nonPerturbedNormal = normal;
  4090. `;var vte=`
  4091. #ifdef USE_NORMALMAP_OBJECTSPACE
  4092. normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals
  4093. #ifdef FLIP_SIDED
  4094. normal = - normal;
  4095. #endif
  4096. #ifdef DOUBLE_SIDED
  4097. normal = normal * faceDirection;
  4098. #endif
  4099. normal = normalize( normalMatrix * normal );
  4100. #elif defined( USE_NORMALMAP_TANGENTSPACE )
  4101. vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  4102. mapN.xy *= normalScale;
  4103. normal = normalize( tbn * mapN );
  4104. #elif defined( USE_BUMPMAP )
  4105. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  4106. #endif
  4107. `;var gte=`
  4108. #ifndef FLAT_SHADED
  4109. varying vec3 vNormal;
  4110. #ifdef USE_TANGENT
  4111. varying vec3 vTangent;
  4112. varying vec3 vBitangent;
  4113. #endif
  4114. #endif
  4115. `;var yte=`
  4116. #ifndef FLAT_SHADED
  4117. varying vec3 vNormal;
  4118. #ifdef USE_TANGENT
  4119. varying vec3 vTangent;
  4120. varying vec3 vBitangent;
  4121. #endif
  4122. #endif
  4123. `;var _te=`
  4124. #ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED
  4125. vNormal = normalize( transformedNormal );
  4126. #ifdef USE_TANGENT
  4127. vTangent = normalize( transformedTangent );
  4128. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  4129. #endif
  4130. #endif
  4131. `;var xte=`
  4132. #ifdef USE_NORMALMAP
  4133. uniform sampler2D normalMap;
  4134. uniform vec2 normalScale;
  4135. #endif
  4136. #ifdef USE_NORMALMAP_OBJECTSPACE
  4137. uniform mat3 normalMatrix;
  4138. #endif
  4139. #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
  4140. // Normal Mapping Without Precomputed Tangents
  4141. // http://www.thetenthplanet.de/archives/1180
  4142. mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
  4143. vec3 q0 = dFdx( eye_pos.xyz );
  4144. vec3 q1 = dFdy( eye_pos.xyz );
  4145. vec2 st0 = dFdx( uv.st );
  4146. vec2 st1 = dFdy( uv.st );
  4147. vec3 N = surf_norm; // normalized
  4148. vec3 q1perp = cross( q1, N );
  4149. vec3 q0perp = cross( N, q0 );
  4150. vec3 T = q1perp * st0.x + q0perp * st1.x;
  4151. vec3 B = q1perp * st0.y + q0perp * st1.y;
  4152. float det = max( dot( T, T ), dot( B, B ) );
  4153. float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
  4154. return mat3( T * scale, B * scale, N );
  4155. }
  4156. #endif
  4157. `;var Ste=`
  4158. #ifdef USE_CLEARCOAT
  4159. vec3 clearcoatNormal = nonPerturbedNormal;
  4160. #endif
  4161. `;var Mte=`
  4162. #ifdef USE_CLEARCOAT_NORMALMAP
  4163. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
  4164. clearcoatMapN.xy *= clearcoatNormalScale;
  4165. clearcoatNormal = normalize( tbn2 * clearcoatMapN );
  4166. #endif
  4167. `;var bte=`
  4168. #ifdef USE_CLEARCOATMAP
  4169. uniform sampler2D clearcoatMap;
  4170. #endif
  4171. #ifdef USE_CLEARCOAT_NORMALMAP
  4172. uniform sampler2D clearcoatNormalMap;
  4173. uniform vec2 clearcoatNormalScale;
  4174. #endif
  4175. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  4176. uniform sampler2D clearcoatRoughnessMap;
  4177. #endif
  4178. `;var wte=`
  4179. #ifdef USE_IRIDESCENCEMAP
  4180. uniform sampler2D iridescenceMap;
  4181. #endif
  4182. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  4183. uniform sampler2D iridescenceThicknessMap;
  4184. #endif
  4185. `;var Tte=`
  4186. #ifdef OPAQUE
  4187. diffuseColor.a = 1.0;
  4188. #endif
  4189. #ifdef USE_TRANSMISSION
  4190. diffuseColor.a *= material.transmissionAlpha;
  4191. #endif
  4192. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  4193. `;var Ete=`
  4194. vec3 packNormalToRGB( const in vec3 normal ) {
  4195. return normalize( normal ) * 0.5 + 0.5;
  4196. }
  4197. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  4198. return 2.0 * rgb.xyz - 1.0;
  4199. }
  4200. const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)
  4201. const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)
  4202. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  4203. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  4204. const float ShiftRight8 = 1. / 256.;
  4205. vec4 packDepthToRGBA( const in float v ) {
  4206. vec4 r = vec4( fract( v * PackFactors ), v );
  4207. r.yzw -= r.xyz * ShiftRight8; // tidy overflow
  4208. return r * PackUpscale;
  4209. }
  4210. float unpackRGBAToDepth( const in vec4 v ) {
  4211. return dot( v, UnpackFactors );
  4212. }
  4213. vec2 packDepthToRG( in highp float v ) {
  4214. return packDepthToRGBA( v ).yx;
  4215. }
  4216. float unpackRGToDepth( const in highp vec2 v ) {
  4217. return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
  4218. }
  4219. vec4 pack2HalfToRGBA( vec2 v ) {
  4220. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  4221. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  4222. }
  4223. vec2 unpackRGBATo2Half( vec4 v ) {
  4224. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  4225. }
  4226. // NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera
  4227. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  4228. // -near maps to 0; -far maps to 1
  4229. return ( viewZ + near ) / ( near - far );
  4230. }
  4231. float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
  4232. // maps orthographic depth in [ 0, 1 ] to viewZ
  4233. return depth * ( near - far ) - near;
  4234. }
  4235. // NOTE: https://twitter.com/gonnavis/status/1377183786949959682
  4236. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  4237. // -near maps to 0; -far maps to 1
  4238. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  4239. }
  4240. float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
  4241. // maps perspective depth in [ 0, 1 ] to viewZ
  4242. return ( near * far ) / ( ( far - near ) * depth - far );
  4243. }
  4244. `;var Ate=`
  4245. #ifdef PREMULTIPLIED_ALPHA
  4246. // Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.
  4247. gl_FragColor.rgb *= gl_FragColor.a;
  4248. #endif
  4249. `;var Cte=`
  4250. vec4 mvPosition = vec4( transformed, 1.0 );
  4251. #ifdef USE_BATCHING
  4252. mvPosition = batchingMatrix * mvPosition;
  4253. #endif
  4254. #ifdef USE_INSTANCING
  4255. mvPosition = instanceMatrix * mvPosition;
  4256. #endif
  4257. mvPosition = modelViewMatrix * mvPosition;
  4258. gl_Position = projectionMatrix * mvPosition;
  4259. `;var Rte=`
  4260. #ifdef DITHERING
  4261. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  4262. #endif
  4263. `;var Lte=`
  4264. #ifdef DITHERING
  4265. // based on https://www.shadertoy.com/view/MslGR8
  4266. vec3 dithering( vec3 color ) {
  4267. //Calculate grid position
  4268. float grid_position = rand( gl_FragCoord.xy );
  4269. //Shift the individual colors differently, thus making it even harder to see the dithering pattern
  4270. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  4271. //modify shift according to grid position.
  4272. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  4273. //shift the color by dither_shift
  4274. return color + dither_shift_RGB;
  4275. }
  4276. #endif
  4277. `;var Pte=`
  4278. float roughnessFactor = roughness;
  4279. #ifdef USE_ROUGHNESSMAP
  4280. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  4281. // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
  4282. roughnessFactor *= texelRoughness.g;
  4283. #endif
  4284. `;var Dte=`
  4285. #ifdef USE_ROUGHNESSMAP
  4286. uniform sampler2D roughnessMap;
  4287. #endif
  4288. `;var Ite=`
  4289. #if NUM_SPOT_LIGHT_COORDS > 0
  4290. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  4291. #endif
  4292. #if NUM_SPOT_LIGHT_MAPS > 0
  4293. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  4294. #endif
  4295. #ifdef USE_SHADOWMAP
  4296. #if NUM_DIR_LIGHT_SHADOWS > 0
  4297. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  4298. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  4299. struct DirectionalLightShadow {
  4300. float shadowBias;
  4301. float shadowNormalBias;
  4302. float shadowRadius;
  4303. vec2 shadowMapSize;
  4304. };
  4305. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  4306. #endif
  4307. #if NUM_SPOT_LIGHT_SHADOWS > 0
  4308. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  4309. struct SpotLightShadow {
  4310. float shadowBias;
  4311. float shadowNormalBias;
  4312. float shadowRadius;
  4313. vec2 shadowMapSize;
  4314. };
  4315. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  4316. #endif
  4317. #if NUM_POINT_LIGHT_SHADOWS > 0
  4318. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  4319. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  4320. struct PointLightShadow {
  4321. float shadowBias;
  4322. float shadowNormalBias;
  4323. float shadowRadius;
  4324. vec2 shadowMapSize;
  4325. float shadowCameraNear;
  4326. float shadowCameraFar;
  4327. };
  4328. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  4329. #endif
  4330. /*
  4331. #if NUM_RECT_AREA_LIGHTS > 0
  4332. // TODO (abelnation): create uniforms for area light shadows
  4333. #endif
  4334. */
  4335. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  4336. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  4337. }
  4338. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  4339. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  4340. }
  4341. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  4342. float occlusion = 1.0;
  4343. vec2 distribution = texture2DDistribution( shadow, uv );
  4344. float hard_shadow = step( compare , distribution.x ); // Hard Shadow
  4345. if (hard_shadow != 1.0 ) {
  4346. float distance = compare - distribution.x ;
  4347. float variance = max( 0.00000, distribution.y * distribution.y );
  4348. float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality
  4349. softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed
  4350. occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
  4351. }
  4352. return occlusion;
  4353. }
  4354. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  4355. float shadow = 1.0;
  4356. shadowCoord.xyz /= shadowCoord.w;
  4357. shadowCoord.z += shadowBias;
  4358. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  4359. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  4360. if ( frustumTest ) {
  4361. #if defined( SHADOWMAP_TYPE_PCF )
  4362. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  4363. float dx0 = - texelSize.x * shadowRadius;
  4364. float dy0 = - texelSize.y * shadowRadius;
  4365. float dx1 = + texelSize.x * shadowRadius;
  4366. float dy1 = + texelSize.y * shadowRadius;
  4367. float dx2 = dx0 / 2.0;
  4368. float dy2 = dy0 / 2.0;
  4369. float dx3 = dx1 / 2.0;
  4370. float dy3 = dy1 / 2.0;
  4371. shadow = (
  4372. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  4373. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  4374. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  4375. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  4376. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  4377. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  4378. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  4379. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  4380. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  4381. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  4382. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  4383. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  4384. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  4385. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  4386. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  4387. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  4388. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  4389. ) * ( 1.0 / 17.0 );
  4390. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  4391. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  4392. float dx = texelSize.x;
  4393. float dy = texelSize.y;
  4394. vec2 uv = shadowCoord.xy;
  4395. vec2 f = fract( uv * shadowMapSize + 0.5 );
  4396. uv -= f * texelSize;
  4397. shadow = (
  4398. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  4399. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  4400. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  4401. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  4402. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  4403. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  4404. f.x ) +
  4405. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  4406. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  4407. f.x ) +
  4408. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  4409. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  4410. f.y ) +
  4411. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  4412. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  4413. f.y ) +
  4414. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  4415. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  4416. f.x ),
  4417. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  4418. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  4419. f.x ),
  4420. f.y )
  4421. ) * ( 1.0 / 9.0 );
  4422. #elif defined( SHADOWMAP_TYPE_VSM )
  4423. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  4424. #else // no percentage-closer filtering:
  4425. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  4426. #endif
  4427. }
  4428. return shadow;
  4429. }
  4430. // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D
  4431. // vector suitable for 2D texture mapping. This code uses the following layout for the
  4432. // 2D texture:
  4433. //
  4434. // xzXZ
  4435. // y Y
  4436. //
  4437. // Y - Positive y direction
  4438. // y - Negative y direction
  4439. // X - Positive x direction
  4440. // x - Negative x direction
  4441. // Z - Positive z direction
  4442. // z - Negative z direction
  4443. //
  4444. // Source and test bed:
  4445. // https://gist.github.com/tschw/da10c43c467ce8afd0c4
  4446. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  4447. // Number of texels to avoid at the edge of each square
  4448. vec3 absV = abs( v );
  4449. // Intersect unit cube
  4450. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  4451. absV *= scaleToCube;
  4452. // Apply scale to avoid seams
  4453. // two texels less per square (one texel will do for NEAREST)
  4454. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  4455. // Unwrap
  4456. // space: -1 ... 1 range for each square
  4457. //
  4458. // #X## dim := ( 4 , 2 )
  4459. // # # center := ( 1 , 1 )
  4460. vec2 planar = v.xy;
  4461. float almostATexel = 1.5 * texelSizeY;
  4462. float almostOne = 1.0 - almostATexel;
  4463. if ( absV.z >= almostOne ) {
  4464. if ( v.z > 0.0 )
  4465. planar.x = 4.0 - v.x;
  4466. } else if ( absV.x >= almostOne ) {
  4467. float signX = sign( v.x );
  4468. planar.x = v.z * signX + 2.0 * signX;
  4469. } else if ( absV.y >= almostOne ) {
  4470. float signY = sign( v.y );
  4471. planar.x = v.x + 2.0 * signY + 2.0;
  4472. planar.y = v.z * signY - 2.0;
  4473. }
  4474. // Transform to UV space
  4475. // scale := 0.5 / dim
  4476. // translate := ( center + 0.5 ) / dim
  4477. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  4478. }
  4479. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  4480. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  4481. // for point lights, the uniform @vShadowCoord is re-purposed to hold
  4482. // the vector from the light to the world-space position of the fragment.
  4483. vec3 lightToPosition = shadowCoord.xyz;
  4484. // dp = normalized distance from light to fragment position
  4485. float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?
  4486. dp += shadowBias;
  4487. // bd3D = base direction 3D
  4488. vec3 bd3D = normalize( lightToPosition );
  4489. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  4490. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  4491. return (
  4492. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  4493. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  4494. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  4495. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  4496. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  4497. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  4498. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  4499. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  4500. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  4501. ) * ( 1.0 / 9.0 );
  4502. #else // no percentage-closer filtering
  4503. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  4504. #endif
  4505. }
  4506. #endif
  4507. `;var Nte=`
  4508. #if NUM_SPOT_LIGHT_COORDS > 0
  4509. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  4510. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  4511. #endif
  4512. #ifdef USE_SHADOWMAP
  4513. #if NUM_DIR_LIGHT_SHADOWS > 0
  4514. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  4515. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  4516. struct DirectionalLightShadow {
  4517. float shadowBias;
  4518. float shadowNormalBias;
  4519. float shadowRadius;
  4520. vec2 shadowMapSize;
  4521. };
  4522. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  4523. #endif
  4524. #if NUM_SPOT_LIGHT_SHADOWS > 0
  4525. struct SpotLightShadow {
  4526. float shadowBias;
  4527. float shadowNormalBias;
  4528. float shadowRadius;
  4529. vec2 shadowMapSize;
  4530. };
  4531. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  4532. #endif
  4533. #if NUM_POINT_LIGHT_SHADOWS > 0
  4534. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  4535. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  4536. struct PointLightShadow {
  4537. float shadowBias;
  4538. float shadowNormalBias;
  4539. float shadowRadius;
  4540. vec2 shadowMapSize;
  4541. float shadowCameraNear;
  4542. float shadowCameraFar;
  4543. };
  4544. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  4545. #endif
  4546. /*
  4547. #if NUM_RECT_AREA_LIGHTS > 0
  4548. // TODO (abelnation): uniforms for area light shadows
  4549. #endif
  4550. */
  4551. #endif
  4552. `;var Ute=`
  4553. #if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  4554. // Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.
  4555. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  4556. vec4 shadowWorldPosition;
  4557. #endif
  4558. #if defined( USE_SHADOWMAP )
  4559. #if NUM_DIR_LIGHT_SHADOWS > 0
  4560. #pragma unroll_loop_start
  4561. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  4562. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  4563. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  4564. }
  4565. #pragma unroll_loop_end
  4566. #endif
  4567. #if NUM_POINT_LIGHT_SHADOWS > 0
  4568. #pragma unroll_loop_start
  4569. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  4570. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  4571. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  4572. }
  4573. #pragma unroll_loop_end
  4574. #endif
  4575. /*
  4576. #if NUM_RECT_AREA_LIGHTS > 0
  4577. // TODO (abelnation): update vAreaShadowCoord with area light info
  4578. #endif
  4579. */
  4580. #endif
  4581. // spot lights can be evaluated without active shadow mapping (when SpotLight.map is used)
  4582. #if NUM_SPOT_LIGHT_COORDS > 0
  4583. #pragma unroll_loop_start
  4584. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  4585. shadowWorldPosition = worldPosition;
  4586. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  4587. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  4588. #endif
  4589. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  4590. }
  4591. #pragma unroll_loop_end
  4592. #endif
  4593. `;var Ote=`
  4594. float getShadowMask() {
  4595. float shadow = 1.0;
  4596. #ifdef USE_SHADOWMAP
  4597. #if NUM_DIR_LIGHT_SHADOWS > 0
  4598. DirectionalLightShadow directionalLight;
  4599. #pragma unroll_loop_start
  4600. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  4601. directionalLight = directionalLightShadows[ i ];
  4602. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  4603. }
  4604. #pragma unroll_loop_end
  4605. #endif
  4606. #if NUM_SPOT_LIGHT_SHADOWS > 0
  4607. SpotLightShadow spotLight;
  4608. #pragma unroll_loop_start
  4609. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  4610. spotLight = spotLightShadows[ i ];
  4611. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  4612. }
  4613. #pragma unroll_loop_end
  4614. #endif
  4615. #if NUM_POINT_LIGHT_SHADOWS > 0
  4616. PointLightShadow pointLight;
  4617. #pragma unroll_loop_start
  4618. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  4619. pointLight = pointLightShadows[ i ];
  4620. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  4621. }
  4622. #pragma unroll_loop_end
  4623. #endif
  4624. /*
  4625. #if NUM_RECT_AREA_LIGHTS > 0
  4626. // TODO (abelnation): update shadow for Area light
  4627. #endif
  4628. */
  4629. #endif
  4630. return shadow;
  4631. }
  4632. `;var zte=`
  4633. #ifdef USE_SKINNING
  4634. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  4635. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  4636. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  4637. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  4638. #endif
  4639. `;var Fte=`
  4640. #ifdef USE_SKINNING
  4641. uniform mat4 bindMatrix;
  4642. uniform mat4 bindMatrixInverse;
  4643. uniform highp sampler2D boneTexture;
  4644. mat4 getBoneMatrix( const in float i ) {
  4645. int size = textureSize( boneTexture, 0 ).x;
  4646. int j = int( i ) * 4;
  4647. int x = j % size;
  4648. int y = j / size;
  4649. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  4650. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  4651. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  4652. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  4653. return mat4( v1, v2, v3, v4 );
  4654. }
  4655. #endif
  4656. `;var Bte=`
  4657. #ifdef USE_SKINNING
  4658. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  4659. vec4 skinned = vec4( 0.0 );
  4660. skinned += boneMatX * skinVertex * skinWeight.x;
  4661. skinned += boneMatY * skinVertex * skinWeight.y;
  4662. skinned += boneMatZ * skinVertex * skinWeight.z;
  4663. skinned += boneMatW * skinVertex * skinWeight.w;
  4664. transformed = ( bindMatrixInverse * skinned ).xyz;
  4665. #endif
  4666. `;var kte=`
  4667. #ifdef USE_SKINNING
  4668. mat4 skinMatrix = mat4( 0.0 );
  4669. skinMatrix += skinWeight.x * boneMatX;
  4670. skinMatrix += skinWeight.y * boneMatY;
  4671. skinMatrix += skinWeight.z * boneMatZ;
  4672. skinMatrix += skinWeight.w * boneMatW;
  4673. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  4674. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  4675. #ifdef USE_TANGENT
  4676. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  4677. #endif
  4678. #endif
  4679. `;var Vte=`
  4680. float specularStrength;
  4681. #ifdef USE_SPECULARMAP
  4682. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  4683. specularStrength = texelSpecular.r;
  4684. #else
  4685. specularStrength = 1.0;
  4686. #endif
  4687. `;var Gte=`
  4688. #ifdef USE_SPECULARMAP
  4689. uniform sampler2D specularMap;
  4690. #endif
  4691. `;var Hte=`
  4692. #if defined( TONE_MAPPING )
  4693. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  4694. #endif
  4695. `;var Wte=`
  4696. #ifndef saturate
  4697. // <common> may have defined saturate() already
  4698. #define saturate( a ) clamp( a, 0.0, 1.0 )
  4699. #endif
  4700. uniform float toneMappingExposure;
  4701. // exposure only
  4702. vec3 LinearToneMapping( vec3 color ) {
  4703. return saturate( toneMappingExposure * color );
  4704. }
  4705. // source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
  4706. vec3 ReinhardToneMapping( vec3 color ) {
  4707. color *= toneMappingExposure;
  4708. return saturate( color / ( vec3( 1.0 ) + color ) );
  4709. }
  4710. // source: http://filmicworlds.com/blog/filmic-tonemapping-operators/
  4711. vec3 OptimizedCineonToneMapping( vec3 color ) {
  4712. // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson
  4713. color *= toneMappingExposure;
  4714. color = max( vec3( 0.0 ), color - 0.004 );
  4715. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  4716. }
  4717. // source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
  4718. vec3 RRTAndODTFit( vec3 v ) {
  4719. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  4720. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  4721. return a / b;
  4722. }
  4723. // this implementation of ACES is modified to accommodate a brighter viewing environment.
  4724. // the scale factor of 1/0.6 is subjective. see discussion in #19621.
  4725. vec3 ACESFilmicToneMapping( vec3 color ) {
  4726. // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
  4727. const mat3 ACESInputMat = mat3(
  4728. vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source
  4729. vec3( 0.35458, 0.90834, 0.13383 ),
  4730. vec3( 0.04823, 0.01566, 0.83777 )
  4731. );
  4732. // ODT_SAT => XYZ => D60_2_D65 => sRGB
  4733. const mat3 ACESOutputMat = mat3(
  4734. vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source
  4735. vec3( -0.53108, 1.10813, -0.07276 ),
  4736. vec3( -0.07367, -0.00605, 1.07602 )
  4737. );
  4738. color *= toneMappingExposure / 0.6;
  4739. color = ACESInputMat * color;
  4740. // Apply RRT and ODT
  4741. color = RRTAndODTFit( color );
  4742. color = ACESOutputMat * color;
  4743. // Clamp to [0, 1]
  4744. return saturate( color );
  4745. }
  4746. // Matrices for rec 2020 <> rec 709 color space conversion
  4747. // matrix provided in row-major order so it has been transposed
  4748. // https://www.itu.int/pub/R-REP-BT.2407-2017
  4749. const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
  4750. vec3( 1.6605, - 0.1246, - 0.0182 ),
  4751. vec3( - 0.5876, 1.1329, - 0.1006 ),
  4752. vec3( - 0.0728, - 0.0083, 1.1187 )
  4753. );
  4754. const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
  4755. vec3( 0.6274, 0.0691, 0.0164 ),
  4756. vec3( 0.3293, 0.9195, 0.0880 ),
  4757. vec3( 0.0433, 0.0113, 0.8956 )
  4758. );
  4759. // https://iolite-engine.com/blog_posts/minimal_agx_implementation
  4760. // Mean error^2: 3.6705141e-06
  4761. vec3 agxDefaultContrastApprox( vec3 x ) {
  4762. vec3 x2 = x * x;
  4763. vec3 x4 = x2 * x2;
  4764. return + 15.5 * x4 * x2
  4765. - 40.14 * x4 * x
  4766. + 31.96 * x4
  4767. - 6.868 * x2 * x
  4768. + 0.4298 * x2
  4769. + 0.1191 * x
  4770. - 0.00232;
  4771. }
  4772. // AgX Tone Mapping implementation based on Filament, which in turn is based
  4773. // on Blender's implementation using rec 2020 primaries
  4774. // https://github.com/google/filament/pull/7236
  4775. // Inputs and outputs are encoded as Linear-sRGB.
  4776. vec3 AgXToneMapping( vec3 color ) {
  4777. // AgX constants
  4778. const mat3 AgXInsetMatrix = mat3(
  4779. vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
  4780. vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
  4781. vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
  4782. );
  4783. // explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv
  4784. const mat3 AgXOutsetMatrix = mat3(
  4785. vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
  4786. vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
  4787. vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
  4788. );
  4789. // LOG2_MIN = -10.0
  4790. // LOG2_MAX = +6.5
  4791. // MIDDLE_GRAY = 0.18
  4792. const float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY )
  4793. const float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY )
  4794. color *= toneMappingExposure;
  4795. color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
  4796. color = AgXInsetMatrix * color;
  4797. // Log2 encoding
  4798. color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2
  4799. color = log2( color );
  4800. color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
  4801. color = clamp( color, 0.0, 1.0 );
  4802. // Apply sigmoid
  4803. color = agxDefaultContrastApprox( color );
  4804. // Apply AgX look
  4805. // v = agxLook(v, look);
  4806. color = AgXOutsetMatrix * color;
  4807. // Linearize
  4808. color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
  4809. color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
  4810. // Gamut mapping. Simple clamp for now.
  4811. color = clamp( color, 0.0, 1.0 );
  4812. return color;
  4813. }
  4814. // https://modelviewer.dev/examples/tone-mapping
  4815. vec3 NeutralToneMapping( vec3 color ) {
  4816. float startCompression = 0.8 - 0.04;
  4817. float desaturation = 0.15;
  4818. color *= toneMappingExposure;
  4819. float x = min(color.r, min(color.g, color.b));
  4820. float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
  4821. color -= offset;
  4822. float peak = max(color.r, max(color.g, color.b));
  4823. if (peak < startCompression) return color;
  4824. float d = 1. - startCompression;
  4825. float newPeak = 1. - d * d / (peak + d - startCompression);
  4826. color *= newPeak / peak;
  4827. float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
  4828. return mix(color, vec3(1, 1, 1), g);
  4829. }
  4830. vec3 CustomToneMapping( vec3 color ) { return color; }
  4831. `;var Xte=`
  4832. #ifdef USE_TRANSMISSION
  4833. material.transmission = transmission;
  4834. material.transmissionAlpha = 1.0;
  4835. material.thickness = thickness;
  4836. material.attenuationDistance = attenuationDistance;
  4837. material.attenuationColor = attenuationColor;
  4838. #ifdef USE_TRANSMISSIONMAP
  4839. material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
  4840. #endif
  4841. #ifdef USE_THICKNESSMAP
  4842. material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
  4843. #endif
  4844. vec3 pos = vWorldPosition;
  4845. vec3 v = normalize( cameraPosition - pos );
  4846. vec3 n = inverseTransformDirection( normal, viewMatrix );
  4847. vec4 transmitted = getIBLVolumeRefraction(
  4848. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  4849. pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
  4850. material.attenuationColor, material.attenuationDistance );
  4851. material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
  4852. totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
  4853. #endif
  4854. `;var Yte=`
  4855. #ifdef USE_TRANSMISSION
  4856. // Transmission code is based on glTF-Sampler-Viewer
  4857. // https://github.com/KhronosGroup/glTF-Sample-Viewer
  4858. uniform float transmission;
  4859. uniform float thickness;
  4860. uniform float attenuationDistance;
  4861. uniform vec3 attenuationColor;
  4862. #ifdef USE_TRANSMISSIONMAP
  4863. uniform sampler2D transmissionMap;
  4864. #endif
  4865. #ifdef USE_THICKNESSMAP
  4866. uniform sampler2D thicknessMap;
  4867. #endif
  4868. uniform vec2 transmissionSamplerSize;
  4869. uniform sampler2D transmissionSamplerMap;
  4870. uniform mat4 modelMatrix;
  4871. uniform mat4 projectionMatrix;
  4872. varying vec3 vWorldPosition;
  4873. // Mipped Bicubic Texture Filtering by N8
  4874. // https://www.shadertoy.com/view/Dl2SDW
  4875. float w0( float a ) {
  4876. return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
  4877. }
  4878. float w1( float a ) {
  4879. return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
  4880. }
  4881. float w2( float a ){
  4882. return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
  4883. }
  4884. float w3( float a ) {
  4885. return ( 1.0 / 6.0 ) * ( a * a * a );
  4886. }
  4887. // g0 and g1 are the two amplitude functions
  4888. float g0( float a ) {
  4889. return w0( a ) + w1( a );
  4890. }
  4891. float g1( float a ) {
  4892. return w2( a ) + w3( a );
  4893. }
  4894. // h0 and h1 are the two offset functions
  4895. float h0( float a ) {
  4896. return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
  4897. }
  4898. float h1( float a ) {
  4899. return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
  4900. }
  4901. vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
  4902. uv = uv * texelSize.zw + 0.5;
  4903. vec2 iuv = floor( uv );
  4904. vec2 fuv = fract( uv );
  4905. float g0x = g0( fuv.x );
  4906. float g1x = g1( fuv.x );
  4907. float h0x = h0( fuv.x );
  4908. float h1x = h1( fuv.x );
  4909. float h0y = h0( fuv.y );
  4910. float h1y = h1( fuv.y );
  4911. vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  4912. vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  4913. vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  4914. vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  4915. return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
  4916. g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
  4917. }
  4918. vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
  4919. vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
  4920. vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
  4921. vec2 fLodSizeInv = 1.0 / fLodSize;
  4922. vec2 cLodSizeInv = 1.0 / cLodSize;
  4923. vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
  4924. vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
  4925. return mix( fSample, cSample, fract( lod ) );
  4926. }
  4927. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  4928. // Direction of refracted light.
  4929. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  4930. // Compute rotation-independant scaling of the model matrix.
  4931. vec3 modelScale;
  4932. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  4933. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  4934. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  4935. // The thickness is specified in local space.
  4936. return normalize( refractionVector ) * thickness * modelScale;
  4937. }
  4938. float applyIorToRoughness( const in float roughness, const in float ior ) {
  4939. // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
  4940. // an IOR of 1.5 results in the default amount of microfacet refraction.
  4941. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  4942. }
  4943. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  4944. float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  4945. return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
  4946. }
  4947. vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  4948. if ( isinf( attenuationDistance ) ) {
  4949. // Attenuation distance is +\u221E, i.e. the transmitted color is not attenuated at all.
  4950. return vec3( 1.0 );
  4951. } else {
  4952. // Compute light attenuation using Beer's law.
  4953. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  4954. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law
  4955. return transmittance;
  4956. }
  4957. }
  4958. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  4959. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  4960. const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
  4961. const in vec3 attenuationColor, const in float attenuationDistance ) {
  4962. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  4963. vec3 refractedRayExit = position + transmissionRay;
  4964. // Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
  4965. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  4966. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  4967. refractionCoords += 1.0;
  4968. refractionCoords /= 2.0;
  4969. // Sample framebuffer to get pixel the refracted ray hits.
  4970. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  4971. vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
  4972. vec3 attenuatedColor = transmittance * transmittedLight.rgb;
  4973. // Get the specular component.
  4974. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  4975. // As less light is transmitted, the opacity should be increased. This simple approximation does a decent job
  4976. // of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color.
  4977. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
  4978. return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
  4979. }
  4980. #endif
  4981. `;var qte=`
  4982. #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  4983. varying vec2 vUv;
  4984. #endif
  4985. #ifdef USE_MAP
  4986. varying vec2 vMapUv;
  4987. #endif
  4988. #ifdef USE_ALPHAMAP
  4989. varying vec2 vAlphaMapUv;
  4990. #endif
  4991. #ifdef USE_LIGHTMAP
  4992. varying vec2 vLightMapUv;
  4993. #endif
  4994. #ifdef USE_AOMAP
  4995. varying vec2 vAoMapUv;
  4996. #endif
  4997. #ifdef USE_BUMPMAP
  4998. varying vec2 vBumpMapUv;
  4999. #endif
  5000. #ifdef USE_NORMALMAP
  5001. varying vec2 vNormalMapUv;
  5002. #endif
  5003. #ifdef USE_EMISSIVEMAP
  5004. varying vec2 vEmissiveMapUv;
  5005. #endif
  5006. #ifdef USE_METALNESSMAP
  5007. varying vec2 vMetalnessMapUv;
  5008. #endif
  5009. #ifdef USE_ROUGHNESSMAP
  5010. varying vec2 vRoughnessMapUv;
  5011. #endif
  5012. #ifdef USE_ANISOTROPYMAP
  5013. varying vec2 vAnisotropyMapUv;
  5014. #endif
  5015. #ifdef USE_CLEARCOATMAP
  5016. varying vec2 vClearcoatMapUv;
  5017. #endif
  5018. #ifdef USE_CLEARCOAT_NORMALMAP
  5019. varying vec2 vClearcoatNormalMapUv;
  5020. #endif
  5021. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  5022. varying vec2 vClearcoatRoughnessMapUv;
  5023. #endif
  5024. #ifdef USE_IRIDESCENCEMAP
  5025. varying vec2 vIridescenceMapUv;
  5026. #endif
  5027. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5028. varying vec2 vIridescenceThicknessMapUv;
  5029. #endif
  5030. #ifdef USE_SHEEN_COLORMAP
  5031. varying vec2 vSheenColorMapUv;
  5032. #endif
  5033. #ifdef USE_SHEEN_ROUGHNESSMAP
  5034. varying vec2 vSheenRoughnessMapUv;
  5035. #endif
  5036. #ifdef USE_SPECULARMAP
  5037. varying vec2 vSpecularMapUv;
  5038. #endif
  5039. #ifdef USE_SPECULAR_COLORMAP
  5040. varying vec2 vSpecularColorMapUv;
  5041. #endif
  5042. #ifdef USE_SPECULAR_INTENSITYMAP
  5043. varying vec2 vSpecularIntensityMapUv;
  5044. #endif
  5045. #ifdef USE_TRANSMISSIONMAP
  5046. uniform mat3 transmissionMapTransform;
  5047. varying vec2 vTransmissionMapUv;
  5048. #endif
  5049. #ifdef USE_THICKNESSMAP
  5050. uniform mat3 thicknessMapTransform;
  5051. varying vec2 vThicknessMapUv;
  5052. #endif
  5053. `;var Zte=`
  5054. #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  5055. varying vec2 vUv;
  5056. #endif
  5057. #ifdef USE_MAP
  5058. uniform mat3 mapTransform;
  5059. varying vec2 vMapUv;
  5060. #endif
  5061. #ifdef USE_ALPHAMAP
  5062. uniform mat3 alphaMapTransform;
  5063. varying vec2 vAlphaMapUv;
  5064. #endif
  5065. #ifdef USE_LIGHTMAP
  5066. uniform mat3 lightMapTransform;
  5067. varying vec2 vLightMapUv;
  5068. #endif
  5069. #ifdef USE_AOMAP
  5070. uniform mat3 aoMapTransform;
  5071. varying vec2 vAoMapUv;
  5072. #endif
  5073. #ifdef USE_BUMPMAP
  5074. uniform mat3 bumpMapTransform;
  5075. varying vec2 vBumpMapUv;
  5076. #endif
  5077. #ifdef USE_NORMALMAP
  5078. uniform mat3 normalMapTransform;
  5079. varying vec2 vNormalMapUv;
  5080. #endif
  5081. #ifdef USE_DISPLACEMENTMAP
  5082. uniform mat3 displacementMapTransform;
  5083. varying vec2 vDisplacementMapUv;
  5084. #endif
  5085. #ifdef USE_EMISSIVEMAP
  5086. uniform mat3 emissiveMapTransform;
  5087. varying vec2 vEmissiveMapUv;
  5088. #endif
  5089. #ifdef USE_METALNESSMAP
  5090. uniform mat3 metalnessMapTransform;
  5091. varying vec2 vMetalnessMapUv;
  5092. #endif
  5093. #ifdef USE_ROUGHNESSMAP
  5094. uniform mat3 roughnessMapTransform;
  5095. varying vec2 vRoughnessMapUv;
  5096. #endif
  5097. #ifdef USE_ANISOTROPYMAP
  5098. uniform mat3 anisotropyMapTransform;
  5099. varying vec2 vAnisotropyMapUv;
  5100. #endif
  5101. #ifdef USE_CLEARCOATMAP
  5102. uniform mat3 clearcoatMapTransform;
  5103. varying vec2 vClearcoatMapUv;
  5104. #endif
  5105. #ifdef USE_CLEARCOAT_NORMALMAP
  5106. uniform mat3 clearcoatNormalMapTransform;
  5107. varying vec2 vClearcoatNormalMapUv;
  5108. #endif
  5109. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  5110. uniform mat3 clearcoatRoughnessMapTransform;
  5111. varying vec2 vClearcoatRoughnessMapUv;
  5112. #endif
  5113. #ifdef USE_SHEEN_COLORMAP
  5114. uniform mat3 sheenColorMapTransform;
  5115. varying vec2 vSheenColorMapUv;
  5116. #endif
  5117. #ifdef USE_SHEEN_ROUGHNESSMAP
  5118. uniform mat3 sheenRoughnessMapTransform;
  5119. varying vec2 vSheenRoughnessMapUv;
  5120. #endif
  5121. #ifdef USE_IRIDESCENCEMAP
  5122. uniform mat3 iridescenceMapTransform;
  5123. varying vec2 vIridescenceMapUv;
  5124. #endif
  5125. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5126. uniform mat3 iridescenceThicknessMapTransform;
  5127. varying vec2 vIridescenceThicknessMapUv;
  5128. #endif
  5129. #ifdef USE_SPECULARMAP
  5130. uniform mat3 specularMapTransform;
  5131. varying vec2 vSpecularMapUv;
  5132. #endif
  5133. #ifdef USE_SPECULAR_COLORMAP
  5134. uniform mat3 specularColorMapTransform;
  5135. varying vec2 vSpecularColorMapUv;
  5136. #endif
  5137. #ifdef USE_SPECULAR_INTENSITYMAP
  5138. uniform mat3 specularIntensityMapTransform;
  5139. varying vec2 vSpecularIntensityMapUv;
  5140. #endif
  5141. #ifdef USE_TRANSMISSIONMAP
  5142. uniform mat3 transmissionMapTransform;
  5143. varying vec2 vTransmissionMapUv;
  5144. #endif
  5145. #ifdef USE_THICKNESSMAP
  5146. uniform mat3 thicknessMapTransform;
  5147. varying vec2 vThicknessMapUv;
  5148. #endif
  5149. `;var jte=`
  5150. #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  5151. vUv = vec3( uv, 1 ).xy;
  5152. #endif
  5153. #ifdef USE_MAP
  5154. vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  5155. #endif
  5156. #ifdef USE_ALPHAMAP
  5157. vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  5158. #endif
  5159. #ifdef USE_LIGHTMAP
  5160. vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
  5161. #endif
  5162. #ifdef USE_AOMAP
  5163. vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
  5164. #endif
  5165. #ifdef USE_BUMPMAP
  5166. vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
  5167. #endif
  5168. #ifdef USE_NORMALMAP
  5169. vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
  5170. #endif
  5171. #ifdef USE_DISPLACEMENTMAP
  5172. vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
  5173. #endif
  5174. #ifdef USE_EMISSIVEMAP
  5175. vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
  5176. #endif
  5177. #ifdef USE_METALNESSMAP
  5178. vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
  5179. #endif
  5180. #ifdef USE_ROUGHNESSMAP
  5181. vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
  5182. #endif
  5183. #ifdef USE_ANISOTROPYMAP
  5184. vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
  5185. #endif
  5186. #ifdef USE_CLEARCOATMAP
  5187. vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
  5188. #endif
  5189. #ifdef USE_CLEARCOAT_NORMALMAP
  5190. vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
  5191. #endif
  5192. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  5193. vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
  5194. #endif
  5195. #ifdef USE_IRIDESCENCEMAP
  5196. vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
  5197. #endif
  5198. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5199. vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
  5200. #endif
  5201. #ifdef USE_SHEEN_COLORMAP
  5202. vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
  5203. #endif
  5204. #ifdef USE_SHEEN_ROUGHNESSMAP
  5205. vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
  5206. #endif
  5207. #ifdef USE_SPECULARMAP
  5208. vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
  5209. #endif
  5210. #ifdef USE_SPECULAR_COLORMAP
  5211. vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
  5212. #endif
  5213. #ifdef USE_SPECULAR_INTENSITYMAP
  5214. vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
  5215. #endif
  5216. #ifdef USE_TRANSMISSIONMAP
  5217. vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
  5218. #endif
  5219. #ifdef USE_THICKNESSMAP
  5220. vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
  5221. #endif
  5222. `;var Kte=`
  5223. #if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  5224. vec4 worldPosition = vec4( transformed, 1.0 );
  5225. #ifdef USE_BATCHING
  5226. worldPosition = batchingMatrix * worldPosition;
  5227. #endif
  5228. #ifdef USE_INSTANCING
  5229. worldPosition = instanceMatrix * worldPosition;
  5230. #endif
  5231. worldPosition = modelMatrix * worldPosition;
  5232. #endif
  5233. `;var Jte=`
  5234. varying vec2 vUv;
  5235. uniform mat3 uvTransform;
  5236. void main() {
  5237. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  5238. gl_Position = vec4( position.xy, 1.0, 1.0 );
  5239. }
  5240. `,$te=`
  5241. uniform sampler2D t2D;
  5242. uniform float backgroundIntensity;
  5243. varying vec2 vUv;
  5244. void main() {
  5245. vec4 texColor = texture2D( t2D, vUv );
  5246. #ifdef DECODE_VIDEO_TEXTURE
  5247. // use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures
  5248. texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
  5249. #endif
  5250. texColor.rgb *= backgroundIntensity;
  5251. gl_FragColor = texColor;
  5252. #include <tonemapping_fragment>
  5253. #include <colorspace_fragment>
  5254. }
  5255. `;var Qte=`
  5256. varying vec3 vWorldDirection;
  5257. #include <common>
  5258. void main() {
  5259. vWorldDirection = transformDirection( position, modelMatrix );
  5260. #include <begin_vertex>
  5261. #include <project_vertex>
  5262. gl_Position.z = gl_Position.w; // set z to camera.far
  5263. }
  5264. `,ere=`
  5265. #ifdef ENVMAP_TYPE_CUBE
  5266. uniform samplerCube envMap;
  5267. #elif defined( ENVMAP_TYPE_CUBE_UV )
  5268. uniform sampler2D envMap;
  5269. #endif
  5270. uniform float flipEnvMap;
  5271. uniform float backgroundBlurriness;
  5272. uniform float backgroundIntensity;
  5273. uniform mat3 backgroundRotation;
  5274. varying vec3 vWorldDirection;
  5275. #include <cube_uv_reflection_fragment>
  5276. void main() {
  5277. #ifdef ENVMAP_TYPE_CUBE
  5278. vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  5279. #elif defined( ENVMAP_TYPE_CUBE_UV )
  5280. vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
  5281. #else
  5282. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  5283. #endif
  5284. texColor.rgb *= backgroundIntensity;
  5285. gl_FragColor = texColor;
  5286. #include <tonemapping_fragment>
  5287. #include <colorspace_fragment>
  5288. }
  5289. `;var tre=`
  5290. varying vec3 vWorldDirection;
  5291. #include <common>
  5292. void main() {
  5293. vWorldDirection = transformDirection( position, modelMatrix );
  5294. #include <begin_vertex>
  5295. #include <project_vertex>
  5296. gl_Position.z = gl_Position.w; // set z to camera.far
  5297. }
  5298. `,rre=`
  5299. uniform samplerCube tCube;
  5300. uniform float tFlip;
  5301. uniform float opacity;
  5302. varying vec3 vWorldDirection;
  5303. void main() {
  5304. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  5305. gl_FragColor = texColor;
  5306. gl_FragColor.a *= opacity;
  5307. #include <tonemapping_fragment>
  5308. #include <colorspace_fragment>
  5309. }
  5310. `;var ire=`
  5311. #include <common>
  5312. #include <batching_pars_vertex>
  5313. #include <uv_pars_vertex>
  5314. #include <displacementmap_pars_vertex>
  5315. #include <morphtarget_pars_vertex>
  5316. #include <skinning_pars_vertex>
  5317. #include <logdepthbuf_pars_vertex>
  5318. #include <clipping_planes_pars_vertex>
  5319. // This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.
  5320. // Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for
  5321. // depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.
  5322. varying vec2 vHighPrecisionZW;
  5323. void main() {
  5324. #include <uv_vertex>
  5325. #include <batching_vertex>
  5326. #include <skinbase_vertex>
  5327. #include <morphinstance_vertex>
  5328. #ifdef USE_DISPLACEMENTMAP
  5329. #include <beginnormal_vertex>
  5330. #include <morphnormal_vertex>
  5331. #include <skinnormal_vertex>
  5332. #endif
  5333. #include <begin_vertex>
  5334. #include <morphtarget_vertex>
  5335. #include <skinning_vertex>
  5336. #include <displacementmap_vertex>
  5337. #include <project_vertex>
  5338. #include <logdepthbuf_vertex>
  5339. #include <clipping_planes_vertex>
  5340. vHighPrecisionZW = gl_Position.zw;
  5341. }
  5342. `,nre=`
  5343. #if DEPTH_PACKING == 3200
  5344. uniform float opacity;
  5345. #endif
  5346. #include <common>
  5347. #include <packing>
  5348. #include <uv_pars_fragment>
  5349. #include <map_pars_fragment>
  5350. #include <alphamap_pars_fragment>
  5351. #include <alphatest_pars_fragment>
  5352. #include <alphahash_pars_fragment>
  5353. #include <logdepthbuf_pars_fragment>
  5354. #include <clipping_planes_pars_fragment>
  5355. varying vec2 vHighPrecisionZW;
  5356. void main() {
  5357. vec4 diffuseColor = vec4( 1.0 );
  5358. #include <clipping_planes_fragment>
  5359. #if DEPTH_PACKING == 3200
  5360. diffuseColor.a = opacity;
  5361. #endif
  5362. #include <map_fragment>
  5363. #include <alphamap_fragment>
  5364. #include <alphatest_fragment>
  5365. #include <alphahash_fragment>
  5366. #include <logdepthbuf_fragment>
  5367. // Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.
  5368. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  5369. #if DEPTH_PACKING == 3200
  5370. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  5371. #elif DEPTH_PACKING == 3201
  5372. gl_FragColor = packDepthToRGBA( fragCoordZ );
  5373. #endif
  5374. }
  5375. `;var are=`
  5376. #define DISTANCE
  5377. varying vec3 vWorldPosition;
  5378. #include <common>
  5379. #include <batching_pars_vertex>
  5380. #include <uv_pars_vertex>
  5381. #include <displacementmap_pars_vertex>
  5382. #include <morphtarget_pars_vertex>
  5383. #include <skinning_pars_vertex>
  5384. #include <clipping_planes_pars_vertex>
  5385. void main() {
  5386. #include <uv_vertex>
  5387. #include <batching_vertex>
  5388. #include <skinbase_vertex>
  5389. #include <morphinstance_vertex>
  5390. #ifdef USE_DISPLACEMENTMAP
  5391. #include <beginnormal_vertex>
  5392. #include <morphnormal_vertex>
  5393. #include <skinnormal_vertex>
  5394. #endif
  5395. #include <begin_vertex>
  5396. #include <morphtarget_vertex>
  5397. #include <skinning_vertex>
  5398. #include <displacementmap_vertex>
  5399. #include <project_vertex>
  5400. #include <worldpos_vertex>
  5401. #include <clipping_planes_vertex>
  5402. vWorldPosition = worldPosition.xyz;
  5403. }
  5404. `,ore=`
  5405. #define DISTANCE
  5406. uniform vec3 referencePosition;
  5407. uniform float nearDistance;
  5408. uniform float farDistance;
  5409. varying vec3 vWorldPosition;
  5410. #include <common>
  5411. #include <packing>
  5412. #include <uv_pars_fragment>
  5413. #include <map_pars_fragment>
  5414. #include <alphamap_pars_fragment>
  5415. #include <alphatest_pars_fragment>
  5416. #include <alphahash_pars_fragment>
  5417. #include <clipping_planes_pars_fragment>
  5418. void main () {
  5419. vec4 diffuseColor = vec4( 1.0 );
  5420. #include <clipping_planes_fragment>
  5421. #include <map_fragment>
  5422. #include <alphamap_fragment>
  5423. #include <alphatest_fragment>
  5424. #include <alphahash_fragment>
  5425. float dist = length( vWorldPosition - referencePosition );
  5426. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  5427. dist = saturate( dist ); // clamp to [ 0, 1 ]
  5428. gl_FragColor = packDepthToRGBA( dist );
  5429. }
  5430. `;var sre=`
  5431. varying vec3 vWorldDirection;
  5432. #include <common>
  5433. void main() {
  5434. vWorldDirection = transformDirection( position, modelMatrix );
  5435. #include <begin_vertex>
  5436. #include <project_vertex>
  5437. }
  5438. `,lre=`
  5439. uniform sampler2D tEquirect;
  5440. varying vec3 vWorldDirection;
  5441. #include <common>
  5442. void main() {
  5443. vec3 direction = normalize( vWorldDirection );
  5444. vec2 sampleUV = equirectUv( direction );
  5445. gl_FragColor = texture2D( tEquirect, sampleUV );
  5446. #include <tonemapping_fragment>
  5447. #include <colorspace_fragment>
  5448. }
  5449. `;var ure=`
  5450. uniform float scale;
  5451. attribute float lineDistance;
  5452. varying float vLineDistance;
  5453. #include <common>
  5454. #include <uv_pars_vertex>
  5455. #include <color_pars_vertex>
  5456. #include <fog_pars_vertex>
  5457. #include <morphtarget_pars_vertex>
  5458. #include <logdepthbuf_pars_vertex>
  5459. #include <clipping_planes_pars_vertex>
  5460. void main() {
  5461. vLineDistance = scale * lineDistance;
  5462. #include <uv_vertex>
  5463. #include <color_vertex>
  5464. #include <morphinstance_vertex>
  5465. #include <morphcolor_vertex>
  5466. #include <begin_vertex>
  5467. #include <morphtarget_vertex>
  5468. #include <project_vertex>
  5469. #include <logdepthbuf_vertex>
  5470. #include <clipping_planes_vertex>
  5471. #include <fog_vertex>
  5472. }
  5473. `,cre=`
  5474. uniform vec3 diffuse;
  5475. uniform float opacity;
  5476. uniform float dashSize;
  5477. uniform float totalSize;
  5478. varying float vLineDistance;
  5479. #include <common>
  5480. #include <color_pars_fragment>
  5481. #include <uv_pars_fragment>
  5482. #include <map_pars_fragment>
  5483. #include <fog_pars_fragment>
  5484. #include <logdepthbuf_pars_fragment>
  5485. #include <clipping_planes_pars_fragment>
  5486. void main() {
  5487. vec4 diffuseColor = vec4( diffuse, opacity );
  5488. #include <clipping_planes_fragment>
  5489. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  5490. discard;
  5491. }
  5492. vec3 outgoingLight = vec3( 0.0 );
  5493. #include <logdepthbuf_fragment>
  5494. #include <map_fragment>
  5495. #include <color_fragment>
  5496. outgoingLight = diffuseColor.rgb; // simple shader
  5497. #include <opaque_fragment>
  5498. #include <tonemapping_fragment>
  5499. #include <colorspace_fragment>
  5500. #include <fog_fragment>
  5501. #include <premultiplied_alpha_fragment>
  5502. }
  5503. `;var fre=`
  5504. #include <common>
  5505. #include <batching_pars_vertex>
  5506. #include <uv_pars_vertex>
  5507. #include <envmap_pars_vertex>
  5508. #include <color_pars_vertex>
  5509. #include <fog_pars_vertex>
  5510. #include <morphtarget_pars_vertex>
  5511. #include <skinning_pars_vertex>
  5512. #include <logdepthbuf_pars_vertex>
  5513. #include <clipping_planes_pars_vertex>
  5514. void main() {
  5515. #include <uv_vertex>
  5516. #include <color_vertex>
  5517. #include <morphinstance_vertex>
  5518. #include <morphcolor_vertex>
  5519. #include <batching_vertex>
  5520. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  5521. #include <beginnormal_vertex>
  5522. #include <morphnormal_vertex>
  5523. #include <skinbase_vertex>
  5524. #include <skinnormal_vertex>
  5525. #include <defaultnormal_vertex>
  5526. #endif
  5527. #include <begin_vertex>
  5528. #include <morphtarget_vertex>
  5529. #include <skinning_vertex>
  5530. #include <project_vertex>
  5531. #include <logdepthbuf_vertex>
  5532. #include <clipping_planes_vertex>
  5533. #include <worldpos_vertex>
  5534. #include <envmap_vertex>
  5535. #include <fog_vertex>
  5536. }
  5537. `,hre=`
  5538. uniform vec3 diffuse;
  5539. uniform float opacity;
  5540. #ifndef FLAT_SHADED
  5541. varying vec3 vNormal;
  5542. #endif
  5543. #include <common>
  5544. #include <dithering_pars_fragment>
  5545. #include <color_pars_fragment>
  5546. #include <uv_pars_fragment>
  5547. #include <map_pars_fragment>
  5548. #include <alphamap_pars_fragment>
  5549. #include <alphatest_pars_fragment>
  5550. #include <alphahash_pars_fragment>
  5551. #include <aomap_pars_fragment>
  5552. #include <lightmap_pars_fragment>
  5553. #include <envmap_common_pars_fragment>
  5554. #include <envmap_pars_fragment>
  5555. #include <fog_pars_fragment>
  5556. #include <specularmap_pars_fragment>
  5557. #include <logdepthbuf_pars_fragment>
  5558. #include <clipping_planes_pars_fragment>
  5559. void main() {
  5560. vec4 diffuseColor = vec4( diffuse, opacity );
  5561. #include <clipping_planes_fragment>
  5562. #include <logdepthbuf_fragment>
  5563. #include <map_fragment>
  5564. #include <color_fragment>
  5565. #include <alphamap_fragment>
  5566. #include <alphatest_fragment>
  5567. #include <alphahash_fragment>
  5568. #include <specularmap_fragment>
  5569. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  5570. // accumulation (baked indirect lighting only)
  5571. #ifdef USE_LIGHTMAP
  5572. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  5573. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  5574. #else
  5575. reflectedLight.indirectDiffuse += vec3( 1.0 );
  5576. #endif
  5577. // modulation
  5578. #include <aomap_fragment>
  5579. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  5580. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  5581. #include <envmap_fragment>
  5582. #include <opaque_fragment>
  5583. #include <tonemapping_fragment>
  5584. #include <colorspace_fragment>
  5585. #include <fog_fragment>
  5586. #include <premultiplied_alpha_fragment>
  5587. #include <dithering_fragment>
  5588. }
  5589. `;var pre=`
  5590. #define LAMBERT
  5591. varying vec3 vViewPosition;
  5592. #include <common>
  5593. #include <batching_pars_vertex>
  5594. #include <uv_pars_vertex>
  5595. #include <displacementmap_pars_vertex>
  5596. #include <envmap_pars_vertex>
  5597. #include <color_pars_vertex>
  5598. #include <fog_pars_vertex>
  5599. #include <normal_pars_vertex>
  5600. #include <morphtarget_pars_vertex>
  5601. #include <skinning_pars_vertex>
  5602. #include <shadowmap_pars_vertex>
  5603. #include <logdepthbuf_pars_vertex>
  5604. #include <clipping_planes_pars_vertex>
  5605. void main() {
  5606. #include <uv_vertex>
  5607. #include <color_vertex>
  5608. #include <morphinstance_vertex>
  5609. #include <morphcolor_vertex>
  5610. #include <batching_vertex>
  5611. #include <beginnormal_vertex>
  5612. #include <morphnormal_vertex>
  5613. #include <skinbase_vertex>
  5614. #include <skinnormal_vertex>
  5615. #include <defaultnormal_vertex>
  5616. #include <normal_vertex>
  5617. #include <begin_vertex>
  5618. #include <morphtarget_vertex>
  5619. #include <skinning_vertex>
  5620. #include <displacementmap_vertex>
  5621. #include <project_vertex>
  5622. #include <logdepthbuf_vertex>
  5623. #include <clipping_planes_vertex>
  5624. vViewPosition = - mvPosition.xyz;
  5625. #include <worldpos_vertex>
  5626. #include <envmap_vertex>
  5627. #include <shadowmap_vertex>
  5628. #include <fog_vertex>
  5629. }
  5630. `,dre=`
  5631. #define LAMBERT
  5632. uniform vec3 diffuse;
  5633. uniform vec3 emissive;
  5634. uniform float opacity;
  5635. #include <common>
  5636. #include <packing>
  5637. #include <dithering_pars_fragment>
  5638. #include <color_pars_fragment>
  5639. #include <uv_pars_fragment>
  5640. #include <map_pars_fragment>
  5641. #include <alphamap_pars_fragment>
  5642. #include <alphatest_pars_fragment>
  5643. #include <alphahash_pars_fragment>
  5644. #include <aomap_pars_fragment>
  5645. #include <lightmap_pars_fragment>
  5646. #include <emissivemap_pars_fragment>
  5647. #include <envmap_common_pars_fragment>
  5648. #include <envmap_pars_fragment>
  5649. #include <fog_pars_fragment>
  5650. #include <bsdfs>
  5651. #include <lights_pars_begin>
  5652. #include <normal_pars_fragment>
  5653. #include <lights_lambert_pars_fragment>
  5654. #include <shadowmap_pars_fragment>
  5655. #include <bumpmap_pars_fragment>
  5656. #include <normalmap_pars_fragment>
  5657. #include <specularmap_pars_fragment>
  5658. #include <logdepthbuf_pars_fragment>
  5659. #include <clipping_planes_pars_fragment>
  5660. void main() {
  5661. vec4 diffuseColor = vec4( diffuse, opacity );
  5662. #include <clipping_planes_fragment>
  5663. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  5664. vec3 totalEmissiveRadiance = emissive;
  5665. #include <logdepthbuf_fragment>
  5666. #include <map_fragment>
  5667. #include <color_fragment>
  5668. #include <alphamap_fragment>
  5669. #include <alphatest_fragment>
  5670. #include <alphahash_fragment>
  5671. #include <specularmap_fragment>
  5672. #include <normal_fragment_begin>
  5673. #include <normal_fragment_maps>
  5674. #include <emissivemap_fragment>
  5675. // accumulation
  5676. #include <lights_lambert_fragment>
  5677. #include <lights_fragment_begin>
  5678. #include <lights_fragment_maps>
  5679. #include <lights_fragment_end>
  5680. // modulation
  5681. #include <aomap_fragment>
  5682. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  5683. #include <envmap_fragment>
  5684. #include <opaque_fragment>
  5685. #include <tonemapping_fragment>
  5686. #include <colorspace_fragment>
  5687. #include <fog_fragment>
  5688. #include <premultiplied_alpha_fragment>
  5689. #include <dithering_fragment>
  5690. }
  5691. `;var mre=`
  5692. #define MATCAP
  5693. varying vec3 vViewPosition;
  5694. #include <common>
  5695. #include <batching_pars_vertex>
  5696. #include <uv_pars_vertex>
  5697. #include <color_pars_vertex>
  5698. #include <displacementmap_pars_vertex>
  5699. #include <fog_pars_vertex>
  5700. #include <normal_pars_vertex>
  5701. #include <morphtarget_pars_vertex>
  5702. #include <skinning_pars_vertex>
  5703. #include <logdepthbuf_pars_vertex>
  5704. #include <clipping_planes_pars_vertex>
  5705. void main() {
  5706. #include <uv_vertex>
  5707. #include <color_vertex>
  5708. #include <morphinstance_vertex>
  5709. #include <morphcolor_vertex>
  5710. #include <batching_vertex>
  5711. #include <beginnormal_vertex>
  5712. #include <morphnormal_vertex>
  5713. #include <skinbase_vertex>
  5714. #include <skinnormal_vertex>
  5715. #include <defaultnormal_vertex>
  5716. #include <normal_vertex>
  5717. #include <begin_vertex>
  5718. #include <morphtarget_vertex>
  5719. #include <skinning_vertex>
  5720. #include <displacementmap_vertex>
  5721. #include <project_vertex>
  5722. #include <logdepthbuf_vertex>
  5723. #include <clipping_planes_vertex>
  5724. #include <fog_vertex>
  5725. vViewPosition = - mvPosition.xyz;
  5726. }
  5727. `,vre=`
  5728. #define MATCAP
  5729. uniform vec3 diffuse;
  5730. uniform float opacity;
  5731. uniform sampler2D matcap;
  5732. varying vec3 vViewPosition;
  5733. #include <common>
  5734. #include <dithering_pars_fragment>
  5735. #include <color_pars_fragment>
  5736. #include <uv_pars_fragment>
  5737. #include <map_pars_fragment>
  5738. #include <alphamap_pars_fragment>
  5739. #include <alphatest_pars_fragment>
  5740. #include <alphahash_pars_fragment>
  5741. #include <fog_pars_fragment>
  5742. #include <normal_pars_fragment>
  5743. #include <bumpmap_pars_fragment>
  5744. #include <normalmap_pars_fragment>
  5745. #include <logdepthbuf_pars_fragment>
  5746. #include <clipping_planes_pars_fragment>
  5747. void main() {
  5748. vec4 diffuseColor = vec4( diffuse, opacity );
  5749. #include <clipping_planes_fragment>
  5750. #include <logdepthbuf_fragment>
  5751. #include <map_fragment>
  5752. #include <color_fragment>
  5753. #include <alphamap_fragment>
  5754. #include <alphatest_fragment>
  5755. #include <alphahash_fragment>
  5756. #include <normal_fragment_begin>
  5757. #include <normal_fragment_maps>
  5758. vec3 viewDir = normalize( vViewPosition );
  5759. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  5760. vec3 y = cross( viewDir, x );
  5761. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks
  5762. #ifdef USE_MATCAP
  5763. vec4 matcapColor = texture2D( matcap, uv );
  5764. #else
  5765. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing
  5766. #endif
  5767. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  5768. #include <opaque_fragment>
  5769. #include <tonemapping_fragment>
  5770. #include <colorspace_fragment>
  5771. #include <fog_fragment>
  5772. #include <premultiplied_alpha_fragment>
  5773. #include <dithering_fragment>
  5774. }
  5775. `;var gre=`
  5776. #define NORMAL
  5777. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  5778. varying vec3 vViewPosition;
  5779. #endif
  5780. #include <common>
  5781. #include <batching_pars_vertex>
  5782. #include <uv_pars_vertex>
  5783. #include <displacementmap_pars_vertex>
  5784. #include <normal_pars_vertex>
  5785. #include <morphtarget_pars_vertex>
  5786. #include <skinning_pars_vertex>
  5787. #include <logdepthbuf_pars_vertex>
  5788. #include <clipping_planes_pars_vertex>
  5789. void main() {
  5790. #include <uv_vertex>
  5791. #include <batching_vertex>
  5792. #include <beginnormal_vertex>
  5793. #include <morphinstance_vertex>
  5794. #include <morphnormal_vertex>
  5795. #include <skinbase_vertex>
  5796. #include <skinnormal_vertex>
  5797. #include <defaultnormal_vertex>
  5798. #include <normal_vertex>
  5799. #include <begin_vertex>
  5800. #include <morphtarget_vertex>
  5801. #include <skinning_vertex>
  5802. #include <displacementmap_vertex>
  5803. #include <project_vertex>
  5804. #include <logdepthbuf_vertex>
  5805. #include <clipping_planes_vertex>
  5806. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  5807. vViewPosition = - mvPosition.xyz;
  5808. #endif
  5809. }
  5810. `,yre=`
  5811. #define NORMAL
  5812. uniform float opacity;
  5813. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  5814. varying vec3 vViewPosition;
  5815. #endif
  5816. #include <packing>
  5817. #include <uv_pars_fragment>
  5818. #include <normal_pars_fragment>
  5819. #include <bumpmap_pars_fragment>
  5820. #include <normalmap_pars_fragment>
  5821. #include <logdepthbuf_pars_fragment>
  5822. #include <clipping_planes_pars_fragment>
  5823. void main() {
  5824. vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
  5825. #include <clipping_planes_fragment>
  5826. #include <logdepthbuf_fragment>
  5827. #include <normal_fragment_begin>
  5828. #include <normal_fragment_maps>
  5829. gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
  5830. #ifdef OPAQUE
  5831. gl_FragColor.a = 1.0;
  5832. #endif
  5833. }
  5834. `;var _re=`
  5835. #define PHONG
  5836. varying vec3 vViewPosition;
  5837. #include <common>
  5838. #include <batching_pars_vertex>
  5839. #include <uv_pars_vertex>
  5840. #include <displacementmap_pars_vertex>
  5841. #include <envmap_pars_vertex>
  5842. #include <color_pars_vertex>
  5843. #include <fog_pars_vertex>
  5844. #include <normal_pars_vertex>
  5845. #include <morphtarget_pars_vertex>
  5846. #include <skinning_pars_vertex>
  5847. #include <shadowmap_pars_vertex>
  5848. #include <logdepthbuf_pars_vertex>
  5849. #include <clipping_planes_pars_vertex>
  5850. void main() {
  5851. #include <uv_vertex>
  5852. #include <color_vertex>
  5853. #include <morphcolor_vertex>
  5854. #include <batching_vertex>
  5855. #include <beginnormal_vertex>
  5856. #include <morphinstance_vertex>
  5857. #include <morphnormal_vertex>
  5858. #include <skinbase_vertex>
  5859. #include <skinnormal_vertex>
  5860. #include <defaultnormal_vertex>
  5861. #include <normal_vertex>
  5862. #include <begin_vertex>
  5863. #include <morphtarget_vertex>
  5864. #include <skinning_vertex>
  5865. #include <displacementmap_vertex>
  5866. #include <project_vertex>
  5867. #include <logdepthbuf_vertex>
  5868. #include <clipping_planes_vertex>
  5869. vViewPosition = - mvPosition.xyz;
  5870. #include <worldpos_vertex>
  5871. #include <envmap_vertex>
  5872. #include <shadowmap_vertex>
  5873. #include <fog_vertex>
  5874. }
  5875. `,xre=`
  5876. #define PHONG
  5877. uniform vec3 diffuse;
  5878. uniform vec3 emissive;
  5879. uniform vec3 specular;
  5880. uniform float shininess;
  5881. uniform float opacity;
  5882. #include <common>
  5883. #include <packing>
  5884. #include <dithering_pars_fragment>
  5885. #include <color_pars_fragment>
  5886. #include <uv_pars_fragment>
  5887. #include <map_pars_fragment>
  5888. #include <alphamap_pars_fragment>
  5889. #include <alphatest_pars_fragment>
  5890. #include <alphahash_pars_fragment>
  5891. #include <aomap_pars_fragment>
  5892. #include <lightmap_pars_fragment>
  5893. #include <emissivemap_pars_fragment>
  5894. #include <envmap_common_pars_fragment>
  5895. #include <envmap_pars_fragment>
  5896. #include <fog_pars_fragment>
  5897. #include <bsdfs>
  5898. #include <lights_pars_begin>
  5899. #include <normal_pars_fragment>
  5900. #include <lights_phong_pars_fragment>
  5901. #include <shadowmap_pars_fragment>
  5902. #include <bumpmap_pars_fragment>
  5903. #include <normalmap_pars_fragment>
  5904. #include <specularmap_pars_fragment>
  5905. #include <logdepthbuf_pars_fragment>
  5906. #include <clipping_planes_pars_fragment>
  5907. void main() {
  5908. vec4 diffuseColor = vec4( diffuse, opacity );
  5909. #include <clipping_planes_fragment>
  5910. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  5911. vec3 totalEmissiveRadiance = emissive;
  5912. #include <logdepthbuf_fragment>
  5913. #include <map_fragment>
  5914. #include <color_fragment>
  5915. #include <alphamap_fragment>
  5916. #include <alphatest_fragment>
  5917. #include <alphahash_fragment>
  5918. #include <specularmap_fragment>
  5919. #include <normal_fragment_begin>
  5920. #include <normal_fragment_maps>
  5921. #include <emissivemap_fragment>
  5922. // accumulation
  5923. #include <lights_phong_fragment>
  5924. #include <lights_fragment_begin>
  5925. #include <lights_fragment_maps>
  5926. #include <lights_fragment_end>
  5927. // modulation
  5928. #include <aomap_fragment>
  5929. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  5930. #include <envmap_fragment>
  5931. #include <opaque_fragment>
  5932. #include <tonemapping_fragment>
  5933. #include <colorspace_fragment>
  5934. #include <fog_fragment>
  5935. #include <premultiplied_alpha_fragment>
  5936. #include <dithering_fragment>
  5937. }
  5938. `;var Sre=`
  5939. #define STANDARD
  5940. varying vec3 vViewPosition;
  5941. #ifdef USE_TRANSMISSION
  5942. varying vec3 vWorldPosition;
  5943. #endif
  5944. #include <common>
  5945. #include <batching_pars_vertex>
  5946. #include <uv_pars_vertex>
  5947. #include <displacementmap_pars_vertex>
  5948. #include <color_pars_vertex>
  5949. #include <fog_pars_vertex>
  5950. #include <normal_pars_vertex>
  5951. #include <morphtarget_pars_vertex>
  5952. #include <skinning_pars_vertex>
  5953. #include <shadowmap_pars_vertex>
  5954. #include <logdepthbuf_pars_vertex>
  5955. #include <clipping_planes_pars_vertex>
  5956. void main() {
  5957. #include <uv_vertex>
  5958. #include <color_vertex>
  5959. #include <morphinstance_vertex>
  5960. #include <morphcolor_vertex>
  5961. #include <batching_vertex>
  5962. #include <beginnormal_vertex>
  5963. #include <morphnormal_vertex>
  5964. #include <skinbase_vertex>
  5965. #include <skinnormal_vertex>
  5966. #include <defaultnormal_vertex>
  5967. #include <normal_vertex>
  5968. #include <begin_vertex>
  5969. #include <morphtarget_vertex>
  5970. #include <skinning_vertex>
  5971. #include <displacementmap_vertex>
  5972. #include <project_vertex>
  5973. #include <logdepthbuf_vertex>
  5974. #include <clipping_planes_vertex>
  5975. vViewPosition = - mvPosition.xyz;
  5976. #include <worldpos_vertex>
  5977. #include <shadowmap_vertex>
  5978. #include <fog_vertex>
  5979. #ifdef USE_TRANSMISSION
  5980. vWorldPosition = worldPosition.xyz;
  5981. #endif
  5982. }
  5983. `,Mre=`
  5984. #define STANDARD
  5985. #ifdef PHYSICAL
  5986. #define IOR
  5987. #define USE_SPECULAR
  5988. #endif
  5989. uniform vec3 diffuse;
  5990. uniform vec3 emissive;
  5991. uniform float roughness;
  5992. uniform float metalness;
  5993. uniform float opacity;
  5994. #ifdef IOR
  5995. uniform float ior;
  5996. #endif
  5997. #ifdef USE_SPECULAR
  5998. uniform float specularIntensity;
  5999. uniform vec3 specularColor;
  6000. #ifdef USE_SPECULAR_COLORMAP
  6001. uniform sampler2D specularColorMap;
  6002. #endif
  6003. #ifdef USE_SPECULAR_INTENSITYMAP
  6004. uniform sampler2D specularIntensityMap;
  6005. #endif
  6006. #endif
  6007. #ifdef USE_CLEARCOAT
  6008. uniform float clearcoat;
  6009. uniform float clearcoatRoughness;
  6010. #endif
  6011. #ifdef USE_IRIDESCENCE
  6012. uniform float iridescence;
  6013. uniform float iridescenceIOR;
  6014. uniform float iridescenceThicknessMinimum;
  6015. uniform float iridescenceThicknessMaximum;
  6016. #endif
  6017. #ifdef USE_SHEEN
  6018. uniform vec3 sheenColor;
  6019. uniform float sheenRoughness;
  6020. #ifdef USE_SHEEN_COLORMAP
  6021. uniform sampler2D sheenColorMap;
  6022. #endif
  6023. #ifdef USE_SHEEN_ROUGHNESSMAP
  6024. uniform sampler2D sheenRoughnessMap;
  6025. #endif
  6026. #endif
  6027. #ifdef USE_ANISOTROPY
  6028. uniform vec2 anisotropyVector;
  6029. #ifdef USE_ANISOTROPYMAP
  6030. uniform sampler2D anisotropyMap;
  6031. #endif
  6032. #endif
  6033. varying vec3 vViewPosition;
  6034. #include <common>
  6035. #include <packing>
  6036. #include <dithering_pars_fragment>
  6037. #include <color_pars_fragment>
  6038. #include <uv_pars_fragment>
  6039. #include <map_pars_fragment>
  6040. #include <alphamap_pars_fragment>
  6041. #include <alphatest_pars_fragment>
  6042. #include <alphahash_pars_fragment>
  6043. #include <aomap_pars_fragment>
  6044. #include <lightmap_pars_fragment>
  6045. #include <emissivemap_pars_fragment>
  6046. #include <iridescence_fragment>
  6047. #include <cube_uv_reflection_fragment>
  6048. #include <envmap_common_pars_fragment>
  6049. #include <envmap_physical_pars_fragment>
  6050. #include <fog_pars_fragment>
  6051. #include <lights_pars_begin>
  6052. #include <normal_pars_fragment>
  6053. #include <lights_physical_pars_fragment>
  6054. #include <transmission_pars_fragment>
  6055. #include <shadowmap_pars_fragment>
  6056. #include <bumpmap_pars_fragment>
  6057. #include <normalmap_pars_fragment>
  6058. #include <clearcoat_pars_fragment>
  6059. #include <iridescence_pars_fragment>
  6060. #include <roughnessmap_pars_fragment>
  6061. #include <metalnessmap_pars_fragment>
  6062. #include <logdepthbuf_pars_fragment>
  6063. #include <clipping_planes_pars_fragment>
  6064. void main() {
  6065. vec4 diffuseColor = vec4( diffuse, opacity );
  6066. #include <clipping_planes_fragment>
  6067. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6068. vec3 totalEmissiveRadiance = emissive;
  6069. #include <logdepthbuf_fragment>
  6070. #include <map_fragment>
  6071. #include <color_fragment>
  6072. #include <alphamap_fragment>
  6073. #include <alphatest_fragment>
  6074. #include <alphahash_fragment>
  6075. #include <roughnessmap_fragment>
  6076. #include <metalnessmap_fragment>
  6077. #include <normal_fragment_begin>
  6078. #include <normal_fragment_maps>
  6079. #include <clearcoat_normal_fragment_begin>
  6080. #include <clearcoat_normal_fragment_maps>
  6081. #include <emissivemap_fragment>
  6082. // accumulation
  6083. #include <lights_physical_fragment>
  6084. #include <lights_fragment_begin>
  6085. #include <lights_fragment_maps>
  6086. #include <lights_fragment_end>
  6087. // modulation
  6088. #include <aomap_fragment>
  6089. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  6090. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  6091. #include <transmission_fragment>
  6092. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  6093. #ifdef USE_SHEEN
  6094. // Sheen energy compensation approximation calculation can be found at the end of
  6095. // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
  6096. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  6097. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
  6098. #endif
  6099. #ifdef USE_CLEARCOAT
  6100. float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
  6101. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  6102. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
  6103. #endif
  6104. #include <opaque_fragment>
  6105. #include <tonemapping_fragment>
  6106. #include <colorspace_fragment>
  6107. #include <fog_fragment>
  6108. #include <premultiplied_alpha_fragment>
  6109. #include <dithering_fragment>
  6110. }
  6111. `;var bre=`
  6112. #define TOON
  6113. varying vec3 vViewPosition;
  6114. #include <common>
  6115. #include <batching_pars_vertex>
  6116. #include <uv_pars_vertex>
  6117. #include <displacementmap_pars_vertex>
  6118. #include <color_pars_vertex>
  6119. #include <fog_pars_vertex>
  6120. #include <normal_pars_vertex>
  6121. #include <morphtarget_pars_vertex>
  6122. #include <skinning_pars_vertex>
  6123. #include <shadowmap_pars_vertex>
  6124. #include <logdepthbuf_pars_vertex>
  6125. #include <clipping_planes_pars_vertex>
  6126. void main() {
  6127. #include <uv_vertex>
  6128. #include <color_vertex>
  6129. #include <morphinstance_vertex>
  6130. #include <morphcolor_vertex>
  6131. #include <batching_vertex>
  6132. #include <beginnormal_vertex>
  6133. #include <morphnormal_vertex>
  6134. #include <skinbase_vertex>
  6135. #include <skinnormal_vertex>
  6136. #include <defaultnormal_vertex>
  6137. #include <normal_vertex>
  6138. #include <begin_vertex>
  6139. #include <morphtarget_vertex>
  6140. #include <skinning_vertex>
  6141. #include <displacementmap_vertex>
  6142. #include <project_vertex>
  6143. #include <logdepthbuf_vertex>
  6144. #include <clipping_planes_vertex>
  6145. vViewPosition = - mvPosition.xyz;
  6146. #include <worldpos_vertex>
  6147. #include <shadowmap_vertex>
  6148. #include <fog_vertex>
  6149. }
  6150. `,wre=`
  6151. #define TOON
  6152. uniform vec3 diffuse;
  6153. uniform vec3 emissive;
  6154. uniform float opacity;
  6155. #include <common>
  6156. #include <packing>
  6157. #include <dithering_pars_fragment>
  6158. #include <color_pars_fragment>
  6159. #include <uv_pars_fragment>
  6160. #include <map_pars_fragment>
  6161. #include <alphamap_pars_fragment>
  6162. #include <alphatest_pars_fragment>
  6163. #include <alphahash_pars_fragment>
  6164. #include <aomap_pars_fragment>
  6165. #include <lightmap_pars_fragment>
  6166. #include <emissivemap_pars_fragment>
  6167. #include <gradientmap_pars_fragment>
  6168. #include <fog_pars_fragment>
  6169. #include <bsdfs>
  6170. #include <lights_pars_begin>
  6171. #include <normal_pars_fragment>
  6172. #include <lights_toon_pars_fragment>
  6173. #include <shadowmap_pars_fragment>
  6174. #include <bumpmap_pars_fragment>
  6175. #include <normalmap_pars_fragment>
  6176. #include <logdepthbuf_pars_fragment>
  6177. #include <clipping_planes_pars_fragment>
  6178. void main() {
  6179. vec4 diffuseColor = vec4( diffuse, opacity );
  6180. #include <clipping_planes_fragment>
  6181. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6182. vec3 totalEmissiveRadiance = emissive;
  6183. #include <logdepthbuf_fragment>
  6184. #include <map_fragment>
  6185. #include <color_fragment>
  6186. #include <alphamap_fragment>
  6187. #include <alphatest_fragment>
  6188. #include <alphahash_fragment>
  6189. #include <normal_fragment_begin>
  6190. #include <normal_fragment_maps>
  6191. #include <emissivemap_fragment>
  6192. // accumulation
  6193. #include <lights_toon_fragment>
  6194. #include <lights_fragment_begin>
  6195. #include <lights_fragment_maps>
  6196. #include <lights_fragment_end>
  6197. // modulation
  6198. #include <aomap_fragment>
  6199. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  6200. #include <opaque_fragment>
  6201. #include <tonemapping_fragment>
  6202. #include <colorspace_fragment>
  6203. #include <fog_fragment>
  6204. #include <premultiplied_alpha_fragment>
  6205. #include <dithering_fragment>
  6206. }
  6207. `;var Tre=`
  6208. uniform float size;
  6209. uniform float scale;
  6210. #include <common>
  6211. #include <color_pars_vertex>
  6212. #include <fog_pars_vertex>
  6213. #include <morphtarget_pars_vertex>
  6214. #include <logdepthbuf_pars_vertex>
  6215. #include <clipping_planes_pars_vertex>
  6216. #ifdef USE_POINTS_UV
  6217. varying vec2 vUv;
  6218. uniform mat3 uvTransform;
  6219. #endif
  6220. void main() {
  6221. #ifdef USE_POINTS_UV
  6222. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  6223. #endif
  6224. #include <color_vertex>
  6225. #include <morphinstance_vertex>
  6226. #include <morphcolor_vertex>
  6227. #include <begin_vertex>
  6228. #include <morphtarget_vertex>
  6229. #include <project_vertex>
  6230. gl_PointSize = size;
  6231. #ifdef USE_SIZEATTENUATION
  6232. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  6233. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  6234. #endif
  6235. #include <logdepthbuf_vertex>
  6236. #include <clipping_planes_vertex>
  6237. #include <worldpos_vertex>
  6238. #include <fog_vertex>
  6239. }
  6240. `,Ere=`
  6241. uniform vec3 diffuse;
  6242. uniform float opacity;
  6243. #include <common>
  6244. #include <color_pars_fragment>
  6245. #include <map_particle_pars_fragment>
  6246. #include <alphatest_pars_fragment>
  6247. #include <alphahash_pars_fragment>
  6248. #include <fog_pars_fragment>
  6249. #include <logdepthbuf_pars_fragment>
  6250. #include <clipping_planes_pars_fragment>
  6251. void main() {
  6252. vec4 diffuseColor = vec4( diffuse, opacity );
  6253. #include <clipping_planes_fragment>
  6254. vec3 outgoingLight = vec3( 0.0 );
  6255. #include <logdepthbuf_fragment>
  6256. #include <map_particle_fragment>
  6257. #include <color_fragment>
  6258. #include <alphatest_fragment>
  6259. #include <alphahash_fragment>
  6260. outgoingLight = diffuseColor.rgb;
  6261. #include <opaque_fragment>
  6262. #include <tonemapping_fragment>
  6263. #include <colorspace_fragment>
  6264. #include <fog_fragment>
  6265. #include <premultiplied_alpha_fragment>
  6266. }
  6267. `;var Are=`
  6268. #include <common>
  6269. #include <batching_pars_vertex>
  6270. #include <fog_pars_vertex>
  6271. #include <morphtarget_pars_vertex>
  6272. #include <skinning_pars_vertex>
  6273. #include <logdepthbuf_pars_vertex>
  6274. #include <shadowmap_pars_vertex>
  6275. void main() {
  6276. #include <batching_vertex>
  6277. #include <beginnormal_vertex>
  6278. #include <morphinstance_vertex>
  6279. #include <morphnormal_vertex>
  6280. #include <skinbase_vertex>
  6281. #include <skinnormal_vertex>
  6282. #include <defaultnormal_vertex>
  6283. #include <begin_vertex>
  6284. #include <morphtarget_vertex>
  6285. #include <skinning_vertex>
  6286. #include <project_vertex>
  6287. #include <logdepthbuf_vertex>
  6288. #include <worldpos_vertex>
  6289. #include <shadowmap_vertex>
  6290. #include <fog_vertex>
  6291. }
  6292. `,Cre=`
  6293. uniform vec3 color;
  6294. uniform float opacity;
  6295. #include <common>
  6296. #include <packing>
  6297. #include <fog_pars_fragment>
  6298. #include <bsdfs>
  6299. #include <lights_pars_begin>
  6300. #include <logdepthbuf_pars_fragment>
  6301. #include <shadowmap_pars_fragment>
  6302. #include <shadowmask_pars_fragment>
  6303. void main() {
  6304. #include <logdepthbuf_fragment>
  6305. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  6306. #include <tonemapping_fragment>
  6307. #include <colorspace_fragment>
  6308. #include <fog_fragment>
  6309. }
  6310. `;var Rre=`
  6311. uniform float rotation;
  6312. uniform vec2 center;
  6313. #include <common>
  6314. #include <uv_pars_vertex>
  6315. #include <fog_pars_vertex>
  6316. #include <logdepthbuf_pars_vertex>
  6317. #include <clipping_planes_pars_vertex>
  6318. void main() {
  6319. #include <uv_vertex>
  6320. vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
  6321. vec2 scale;
  6322. scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
  6323. scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
  6324. #ifndef USE_SIZEATTENUATION
  6325. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  6326. if ( isPerspective ) scale *= - mvPosition.z;
  6327. #endif
  6328. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  6329. vec2 rotatedPosition;
  6330. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  6331. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  6332. mvPosition.xy += rotatedPosition;
  6333. gl_Position = projectionMatrix * mvPosition;
  6334. #include <logdepthbuf_vertex>
  6335. #include <clipping_planes_vertex>
  6336. #include <fog_vertex>
  6337. }
  6338. `,Lre=`
  6339. uniform vec3 diffuse;
  6340. uniform float opacity;
  6341. #include <common>
  6342. #include <uv_pars_fragment>
  6343. #include <map_pars_fragment>
  6344. #include <alphamap_pars_fragment>
  6345. #include <alphatest_pars_fragment>
  6346. #include <alphahash_pars_fragment>
  6347. #include <fog_pars_fragment>
  6348. #include <logdepthbuf_pars_fragment>
  6349. #include <clipping_planes_pars_fragment>
  6350. void main() {
  6351. vec4 diffuseColor = vec4( diffuse, opacity );
  6352. #include <clipping_planes_fragment>
  6353. vec3 outgoingLight = vec3( 0.0 );
  6354. #include <logdepthbuf_fragment>
  6355. #include <map_fragment>
  6356. #include <alphamap_fragment>
  6357. #include <alphatest_fragment>
  6358. #include <alphahash_fragment>
  6359. outgoingLight = diffuseColor.rgb;
  6360. #include <opaque_fragment>
  6361. #include <tonemapping_fragment>
  6362. #include <colorspace_fragment>
  6363. #include <fog_fragment>
  6364. }
  6365. `;var pr={alphahash_fragment:JQ,alphahash_pars_fragment:$Q,alphamap_fragment:QQ,alphamap_pars_fragment:eee,alphatest_fragment:tee,alphatest_pars_fragment:ree,aomap_fragment:iee,aomap_pars_fragment:nee,batching_pars_vertex:aee,batching_vertex:oee,begin_vertex:see,beginnormal_vertex:lee,bsdfs:uee,iridescence_fragment:cee,bumpmap_pars_fragment:fee,clipping_planes_fragment:hee,clipping_planes_pars_fragment:pee,clipping_planes_pars_vertex:dee,clipping_planes_vertex:mee,color_fragment:vee,color_pars_fragment:gee,color_pars_vertex:yee,color_vertex:_ee,common:xee,cube_uv_reflection_fragment:See,defaultnormal_vertex:Mee,displacementmap_pars_vertex:bee,displacementmap_vertex:wee,emissivemap_fragment:Tee,emissivemap_pars_fragment:Eee,colorspace_fragment:Aee,colorspace_pars_fragment:Cee,envmap_fragment:Ree,envmap_common_pars_fragment:Lee,envmap_pars_fragment:Pee,envmap_pars_vertex:Dee,envmap_physical_pars_fragment:Wee,envmap_vertex:Iee,fog_vertex:Nee,fog_pars_vertex:Uee,fog_fragment:Oee,fog_pars_fragment:zee,gradientmap_pars_fragment:Fee,lightmap_fragment:Bee,lightmap_pars_fragment:kee,lights_lambert_fragment:Vee,lights_lambert_pars_fragment:Gee,lights_pars_begin:Hee,lights_toon_fragment:Xee,lights_toon_pars_fragment:Yee,lights_phong_fragment:qee,lights_phong_pars_fragment:Zee,lights_physical_fragment:jee,lights_physical_pars_fragment:Kee,lights_fragment_begin:Jee,lights_fragment_maps:$ee,lights_fragment_end:Qee,logdepthbuf_fragment:ete,logdepthbuf_pars_fragment:tte,logdepthbuf_pars_vertex:rte,logdepthbuf_vertex:ite,map_fragment:nte,map_pars_fragment:ate,map_particle_fragment:ote,map_particle_pars_fragment:ste,metalnessmap_fragment:lte,metalnessmap_pars_fragment:ute,morphinstance_vertex:cte,morphcolor_vertex:fte,morphnormal_vertex:hte,morphtarget_pars_vertex:pte,morphtarget_vertex:dte,normal_fragment_begin:mte,normal_fragment_maps:vte,normal_pars_fragment:gte,normal_pars_vertex:yte,normal_vertex:_te,normalmap_pars_fragment:xte,clearcoat_normal_fragment_begin:Ste,clearcoat_normal_fragment_maps:Mte,clearcoat_pars_fragment:bte,iridescence_pars_fragment:wte,opaque_fragment:Tte,packing:Ete,premultiplied_alpha_fragment:Ate,project_vertex:Cte,dithering_fragment:Rte,dithering_pars_fragment:Lte,roughnessmap_fragment:Pte,roughnessmap_pars_fragment:Dte,shadowmap_pars_fragment:Ite,shadowmap_pars_vertex:Nte,shadowmap_vertex:Ute,shadowmask_pars_fragment:Ote,skinbase_vertex:zte,skinning_pars_vertex:Fte,skinning_vertex:Bte,skinnormal_vertex:kte,specularmap_fragment:Vte,specularmap_pars_fragment:Gte,tonemapping_fragment:Hte,tonemapping_pars_fragment:Wte,transmission_fragment:Xte,transmission_pars_fragment:Yte,uv_pars_fragment:qte,uv_pars_vertex:Zte,uv_vertex:jte,worldpos_vertex:Kte,background_vert:Jte,background_frag:$te,backgroundCube_vert:Qte,backgroundCube_frag:ere,cube_vert:tre,cube_frag:rre,depth_vert:ire,depth_frag:nre,distanceRGBA_vert:are,distanceRGBA_frag:ore,equirect_vert:sre,equirect_frag:lre,linedashed_vert:ure,linedashed_frag:cre,meshbasic_vert:fre,meshbasic_frag:hre,meshlambert_vert:pre,meshlambert_frag:dre,meshmatcap_vert:mre,meshmatcap_frag:vre,meshnormal_vert:gre,meshnormal_frag:yre,meshphong_vert:_re,meshphong_frag:xre,meshphysical_vert:Sre,meshphysical_frag:Mre,meshtoon_vert:bre,meshtoon_frag:wre,points_vert:Tre,points_frag:Ere,shadow_vert:Are,shadow_frag:Cre,sprite_vert:Rre,sprite_frag:Lre};var ht={common:{diffuse:{value:new ir(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qt}},envmap:{envMap:{value:null},envMapRotation:{value:new Qt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qt},normalScale:{value:new Kt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ir(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ir(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0},uvTransform:{value:new Qt}},sprite:{diffuse:{value:new ir(16777215)},opacity:{value:1},center:{value:new Kt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}}};var Ss={basic:{uniforms:jn([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:pr.meshbasic_vert,fragmentShader:pr.meshbasic_frag},lambert:{uniforms:jn([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ir(0)}}]),vertexShader:pr.meshlambert_vert,fragmentShader:pr.meshlambert_frag},phong:{uniforms:jn([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ir(0)},specular:{value:new ir(1118481)},shininess:{value:30}}]),vertexShader:pr.meshphong_vert,fragmentShader:pr.meshphong_frag},standard:{uniforms:jn([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new ir(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pr.meshphysical_vert,fragmentShader:pr.meshphysical_frag},toon:{uniforms:jn([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new ir(0)}}]),vertexShader:pr.meshtoon_vert,fragmentShader:pr.meshtoon_frag},matcap:{uniforms:jn([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:pr.meshmatcap_vert,fragmentShader:pr.meshmatcap_frag},points:{uniforms:jn([ht.points,ht.fog]),vertexShader:pr.points_vert,fragmentShader:pr.points_frag},dashed:{uniforms:jn([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pr.linedashed_vert,fragmentShader:pr.linedashed_frag},depth:{uniforms:jn([ht.common,ht.displacementmap]),vertexShader:pr.depth_vert,fragmentShader:pr.depth_frag},normal:{uniforms:jn([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:pr.meshnormal_vert,fragmentShader:pr.meshnormal_frag},sprite:{uniforms:jn([ht.sprite,ht.fog]),vertexShader:pr.sprite_vert,fragmentShader:pr.sprite_frag},background:{uniforms:{uvTransform:{value:new Qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pr.background_vert,fragmentShader:pr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qt}},vertexShader:pr.backgroundCube_vert,fragmentShader:pr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pr.cube_vert,fragmentShader:pr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pr.equirect_vert,fragmentShader:pr.equirect_frag},distanceRGBA:{uniforms:jn([ht.common,ht.displacementmap,{referencePosition:{value:new be},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pr.distanceRGBA_vert,fragmentShader:pr.distanceRGBA_frag},shadow:{uniforms:jn([ht.lights,ht.fog,{color:{value:new ir(0)},opacity:{value:1}}]),vertexShader:pr.shadow_vert,fragmentShader:pr.shadow_frag}};Ss.physical={uniforms:jn([Ss.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qt},clearcoatNormalScale:{value:new Kt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qt},sheen:{value:0},sheenColor:{value:new ir(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qt},transmissionSamplerSize:{value:new Kt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qt},attenuationDistance:{value:0},attenuationColor:{value:new ir(0)},specularColor:{value:new ir(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qt},anisotropyVector:{value:new Kt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qt}}]),vertexShader:pr.meshphysical_vert,fragmentShader:pr.meshphysical_frag};var CA={r:0,b:0,g:0},wd=new fl,ATe=new Wr;function Pre(r,e,t,i,n,a,o){let s=new ir(0),l=a===!0?0:1,u,c,f=null,h=0,p=null;function d(m,v){let _=!1,y=v.isScene===!0?v.background:null;y&&y.isTexture&&(y=(v.backgroundBlurriness>0?t:e).get(y)),y===null?g(s,l):y&&y.isColor&&(g(y,1),_=!0);let x=r.xr.getEnvironmentBlendMode();x==="additive"?i.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(r.autoClear||_)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===lh)?(c===void 0&&(c=new rn(new vh(1,1,1),new Sa({name:"BackgroundCubeMaterial",uniforms:tc(Ss.backgroundCube.uniforms),vertexShader:Ss.backgroundCube.vertexShader,fragmentShader:Ss.backgroundCube.fragmentShader,side:_i,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(M,S,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),wd.copy(v.backgroundRotation),wd.x*=-1,wd.y*=-1,wd.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(wd.y*=-1,wd.z*=-1),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(ATe.makeRotationFromEuler(wd)),c.material.toneMapped=Tr.getTransfer(y.colorSpace)!==Hr,(f!==y||h!==y.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(u===void 0&&(u=new rn(new Vg(2,2),new Sa({name:"BackgroundMaterial",uniforms:tc(Ss.background.uniforms),vertexShader:Ss.background.vertexShader,fragmentShader:Ss.background.fragmentShader,side:Ao,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=y,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=Tr.getTransfer(y.colorSpace)!==Hr,y.matrixAutoUpdate===!0&&y.updateMatrix(),u.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null))}function g(m,v){m.getRGB(CA,bA(r)),i.buffers.color.setClear(CA.r,CA.g,CA.b,v,o)}return{getClearColor:function(){return s},setClearColor:function(m,v=1){s.set(m),l=v,g(s,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,g(s,l)},render:d}}function Dre(r,e,t,i){let n=r.getParameter(r.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||a!==null,s={},l=m(null),u=l,c=!1;function f(A,D,U,B,z){let k=!1;if(o){let G=g(B,U,D);u!==G&&(u=G,p(u.object)),k=v(A,B,U,z),k&&_(A,B,U,z)}else{let G=D.wireframe===!0;(u.geometry!==B.id||u.program!==U.id||u.wireframe!==G)&&(u.geometry=B.id,u.program=U.id,u.wireframe=G,k=!0)}z!==null&&t.update(z,r.ELEMENT_ARRAY_BUFFER),(k||c)&&(c=!1,T(A,D,U,B),z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function h(){return i.isWebGL2?r.createVertexArray():a.createVertexArrayOES()}function p(A){return i.isWebGL2?r.bindVertexArray(A):a.bindVertexArrayOES(A)}function d(A){return i.isWebGL2?r.deleteVertexArray(A):a.deleteVertexArrayOES(A)}function g(A,D,U){let B=U.wireframe===!0,z=s[A.id];z===void 0&&(z={},s[A.id]=z);let k=z[D.id];k===void 0&&(k={},z[D.id]=k);let G=k[B];return G===void 0&&(G=m(h()),k[B]=G),G}function m(A){let D=[],U=[],B=[];for(let z=0;z<n;z++)D[z]=0,U[z]=0,B[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:D,enabledAttributes:U,attributeDivisors:B,object:A,attributes:{},index:null}}function v(A,D,U,B){let z=u.attributes,k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=z[J],K=k[J];if(K===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(K=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(K=A.instanceColor)),V===void 0||V.attribute!==K||K&&V.data!==K.data)return!0;G++}return u.attributesNum!==G||u.index!==B}function _(A,D,U,B){let z={},k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=k[J];V===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(V=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(V=A.instanceColor));let K={};K.attribute=V,V&&V.data&&(K.data=V.data),z[J]=K,G++}u.attributes=z,u.attributesNum=G,u.index=B}function y(){let A=u.newAttributes;for(let D=0,U=A.length;D<U;D++)A[D]=0}function x(A){M(A,0)}function M(A,D){let U=u.newAttributes,B=u.enabledAttributes,z=u.attributeDivisors;U[A]=1,B[A]===0&&(r.enableVertexAttribArray(A),B[A]=1),z[A]!==D&&((i.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,D),z[A]=D)}function S(){let A=u.newAttributes,D=u.enabledAttributes;for(let U=0,B=D.length;U<B;U++)D[U]!==A[U]&&(r.disableVertexAttribArray(U),D[U]=0)}function w(A,D,U,B,z,k,G){G===!0?r.vertexAttribIPointer(A,D,U,z,k):r.vertexAttribPointer(A,D,U,B,z,k)}function T(A,D,U,B){if(i.isWebGL2===!1&&(A.isInstancedMesh||B.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();let z=B.attributes,k=U.getAttributes(),G=D.defaultAttributeValues;for(let Y in k){let J=k[Y];if(J.location>=0){let Q=z[Y];if(Q===void 0&&(Y==="instanceMatrix"&&A.instanceMatrix&&(Q=A.instanceMatrix),Y==="instanceColor"&&A.instanceColor&&(Q=A.instanceColor)),Q!==void 0){let V=Q.normalized,K=Q.itemSize,ae=t.get(Q);if(ae===void 0)continue;let ve=ae.buffer,ue=ae.type,se=ae.bytesPerElement,Ee=i.isWebGL2===!0&&(ue===r.INT||ue===r.UNSIGNED_INT||Q.gpuType===BE);if(Q.isInterleavedBufferAttribute){let q=Q.data,H=q.stride,We=Q.offset;if(q.isInstancedInterleavedBuffer){for(let _e=0;_e<J.locationSize;_e++)M(J.location+_e,q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=q.meshPerAttribute*q.count)}else for(let _e=0;_e<J.locationSize;_e++)x(J.location+_e);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let _e=0;_e<J.locationSize;_e++)w(J.location+_e,K/J.locationSize,ue,V,H*se,(We+K/J.locationSize*_e)*se,Ee)}else{if(Q.isInstancedBufferAttribute){for(let q=0;q<J.locationSize;q++)M(J.location+q,Q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=Q.meshPerAttribute*Q.count)}else for(let q=0;q<J.locationSize;q++)x(J.location+q);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let q=0;q<J.locationSize;q++)w(J.location+q,K/J.locationSize,ue,V,K*se,K/J.locationSize*q*se,Ee)}}else if(G!==void 0){let V=G[Y];if(V!==void 0)switch(V.length){case 2:r.vertexAttrib2fv(J.location,V);break;case 3:r.vertexAttrib3fv(J.location,V);break;case 4:r.vertexAttrib4fv(J.location,V);break;default:r.vertexAttrib1fv(J.location,V)}}}}S()}function C(){I();for(let A in s){let D=s[A];for(let U in D){let B=D[U];for(let z in B)d(B[z].object),delete B[z];delete D[U]}delete s[A]}}function b(A){if(s[A.id]===void 0)return;let D=s[A.id];for(let U in D){let B=D[U];for(let z in B)d(B[z].object),delete B[z];delete D[U]}delete s[A.id]}function E(A){for(let D in s){let U=s[D];if(U[A.id]===void 0)continue;let B=U[A.id];for(let z in B)d(B[z].object),delete B[z];delete U[A.id]}}function I(){R(),c=!0,u!==l&&(u=l,p(u.object))}function R(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:f,reset:I,resetDefaultState:R,dispose:C,releaseStatesOfGeometry:b,releaseStatesOfProgram:E,initAttributes:y,enableAttribute:x,disableUnusedAttributes:S}}function Ire(r,e,t,i){let n=i.isWebGL2,a;function o(c){a=c}function s(c,f){r.drawArrays(a,c,f),t.update(f,a,1)}function l(c,f,h){if(h===0)return;let p,d;if(n)p=r,d="drawArraysInstanced";else if(p=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[d](a,c,f,h),t.update(f,a,h)}function u(c,f,h){if(h===0)return;let p=e.get("WEBGL_multi_draw");if(p===null)for(let d=0;d<h;d++)this.render(c[d],f[d]);else{p.multiDrawArraysWEBGL(a,c,0,f,0,h);let d=0;for(let g=0;g<h;g++)d+=f[g];t.update(d,a,1)}}this.setMode=o,this.render=s,this.renderInstances=l,this.renderMultiDraw=u}function Nre(r,e,t){let i;function n(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let w=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(w){if(w==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext",s=t.precision!==void 0?t.precision:"highp",l=a(s);l!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",l,"instead."),s=l);let u=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),h=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_TEXTURE_SIZE),d=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),m=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),_=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,x=o||e.has("OES_texture_float"),M=y&&x,S=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:n,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:c,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:S}}function Ure(r){let e=this,t=null,i=0,n=!1,a=!1,o=new pl,s=new Qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){let p=f.length!==0||h||i!==0||n;return n=h,i=f.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,h){t=c(f,h,0)},this.setState=function(f,h,p){let d=f.clippingPlanes,g=f.clipIntersection,m=f.clipShadows,v=r.get(f);if(!n||d===null||d.length===0||a&&!m)a?c(null):u();else{let _=a?0:i,y=_*4,x=v.clippingState||null;l.value=x,x=c(d,h,y,p);for(let M=0;M!==y;++M)x[M]=t[M];v.clippingState=x,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=_}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(f,h,p,d){let g=f!==null?f.length:0,m=null;if(g!==0){if(m=l.value,d!==!0||m===null){let v=p+g*4,_=h.matrixWorldInverse;s.getNormalMatrix(_),(m===null||m.length<v)&&(m=new Float32Array(v));for(let y=0,x=p;y!==g;++y,x+=4)o.copy(f[y]).applyMatrix4(_,s),o.normal.toArray(m,x),m[x+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,m}}function Ore(r){let e=new WeakMap;function t(o,s){return s===oS?o.mapping=ol:s===sS&&(o.mapping=eu),o}function i(o){if(o&&o.isTexture){let s=o.mapping;if(s===oS||s===sS)if(e.has(o)){let l=e.get(o).texture;return t(l,o.mapping)}else{let l=o.image;if(l&&l.height>0){let u=new TA(l.height);return u.fromEquirectangularTexture(r,o),e.set(o,u),o.addEventListener("dispose",n),t(u.texture,o.mapping)}else return null}}return o}function n(o){let s=o.target;s.removeEventListener("dispose",n);let l=e.get(s);l!==void 0&&(e.delete(s),l.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}var Gg=class extends zg{constructor(e=-1,t=1,i=1,n=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=a,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,a,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,a=i-e,o=i+e,s=n+t,l=n-t;if(this.view!==null&&this.view.enabled){let u=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=u*this.view.offsetX,o=a+u*this.view.width,s-=c*this.view.offsetY,l=s-c*this.view.height}this.projectionMatrix.makeOrthographic(a,o,s,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};var Wg=4,zre=[.125,.215,.35,.446,.526,.582],Ed=20,qz=new Gg,Fre=new ir,Zz=null,jz=0,Kz=0,Td=(1+Math.sqrt(5))/2,Hg=1/Td,Bre=[new be(1,1,1),new be(-1,1,1),new be(1,1,-1),new be(-1,1,-1),new be(0,Td,Hg),new be(0,Td,-Hg),new be(Hg,0,Td),new be(-Hg,0,Td),new be(Td,Hg,0),new be(-Td,Hg,0)],gS=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){Zz=this._renderer.getRenderTarget(),jz=this._renderer.getActiveCubeFace(),Kz=this._renderer.getActiveMipmapLevel(),this._setSize(256);let a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,i,n,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Gre(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Vre(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Zz,jz,Kz),e.scissorTest=!1,RA(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ol||e.mapping===eu?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Zz=this._renderer.getRenderTarget(),jz=this._renderer.getActiveCubeFace(),Kz=this._renderer.getActiveMipmapLevel();let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Qi,minFilter:Qi,generateMipmaps:!1,type:qu,format:Rn,colorSpace:Ja,depthBuffer:!1},n=kre(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=kre(e,t,i);let{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=CTe(a)),this._blurMaterial=RTe(a,e,t)}return n}_compileMaterial(e){let t=new rn(this._lodPlanes[0],e);this._renderer.compile(t,qz)}_sceneToCubeUV(e,t,i,n){let s=new Vi(90,1,t,i),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],c=this._renderer,f=c.autoClear,h=c.toneMapping;c.getClearColor(Fre),c.toneMapping=gs,c.autoClear=!1;let p=new ec({name:"PMREM.Background",side:_i,depthWrite:!1,depthTest:!1}),d=new rn(new vh,p),g=!1,m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,g=!0):(p.color.copy(Fre),g=!0);for(let v=0;v<6;v++){let _=v%3;_===0?(s.up.set(0,l[v],0),s.lookAt(u[v],0,0)):_===1?(s.up.set(0,0,l[v]),s.lookAt(0,u[v],0)):(s.up.set(0,l[v],0),s.lookAt(0,0,u[v]));let y=this._cubeSize;RA(n,_*y,v>2?y:0,y,y),c.setRenderTarget(n),g&&c.render(d,s),c.render(e,s)}d.geometry.dispose(),d.material.dispose(),c.toneMapping=h,c.autoClear=f,e.background=m}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===ol||e.mapping===eu;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=Gre()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Vre());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new rn(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;RA(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,qz)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let a=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),o=Bre[(n-1)%Bre.length];this._blur(e,n-1,n,a,o)}t.autoClear=i}_blur(e,t,i,n,a){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,n,"latitudinal",a),this._halfBlur(o,e,i,i,n,"longitudinal",a)}_halfBlur(e,t,i,n,a,o,s){let l=this._renderer,u=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let c=3,f=new rn(this._lodPlanes[n],u),h=u.uniforms,p=this._sizeLods[i]-1,d=isFinite(a)?Math.PI/(2*p):2*Math.PI/(2*Ed-1),g=a/d,m=isFinite(a)?1+Math.floor(c*g):Ed;m>Ed&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ed}`);let v=[],_=0;for(let w=0;w<Ed;++w){let T=w/g,C=Math.exp(-T*T/2);v.push(C),w===0?_+=C:w<m&&(_+=2*C)}for(let w=0;w<v.length;w++)v[w]=v[w]/_;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=v,h.latitudinal.value=o==="latitudinal",s&&(h.poleAxis.value=s);let{_lodMax:y}=this;h.dTheta.value=d,h.mipInt.value=y-i;let x=this._sizeLods[n],M=3*x*(n>y-Wg?n-y+Wg:0),S=4*(this._cubeSize-x);RA(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(f,qz)}};function CTe(r){let e=[],t=[],i=[],n=r,a=r-Wg+1+zre.length;for(let o=0;o<a;o++){let s=Math.pow(2,n);t.push(s);let l=1/s;o>r-Wg?l=zre[o-r+Wg-1]:o===0&&(l=0),i.push(l);let u=1/(s-2),c=-u,f=1+u,h=[c,c,f,c,f,f,c,c,f,f,c,f],p=6,d=6,g=3,m=2,v=1,_=new Float32Array(g*d*p),y=new Float32Array(m*d*p),x=new Float32Array(v*d*p);for(let S=0;S<p;S++){let w=S%3*2/3-1,T=S>2?0:-1,C=[w,T,0,w+2/3,T,0,w+2/3,T+1,0,w,T,0,w+2/3,T+1,0,w,T+1,0];_.set(C,g*d*S),y.set(h,m*d*S);let b=[S,S,S,S,S,S];x.set(b,v*d*S)}let M=new ro;M.setAttribute("position",new xa(_,g)),M.setAttribute("uv",new xa(y,m)),M.setAttribute("faceIndex",new xa(x,v)),e.push(M),n>Wg&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function kre(r,e,t){let i=new to(r,e,t);return i.texture.mapping=lh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function RA(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function RTe(r,e,t){let i=new Float32Array(Ed),n=new be(0,1,0);return new Sa({name:"SphericalGaussianBlur",defines:{n:Ed,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:Jz(),fragmentShader:`
  6366. precision mediump float;
  6367. precision mediump int;
  6368. varying vec3 vOutputDirection;
  6369. uniform sampler2D envMap;
  6370. uniform int samples;
  6371. uniform float weights[ n ];
  6372. uniform bool latitudinal;
  6373. uniform float dTheta;
  6374. uniform float mipInt;
  6375. uniform vec3 poleAxis;
  6376. #define ENVMAP_TYPE_CUBE_UV
  6377. #include <cube_uv_reflection_fragment>
  6378. vec3 getSample( float theta, vec3 axis ) {
  6379. float cosTheta = cos( theta );
  6380. // Rodrigues' axis-angle rotation
  6381. vec3 sampleDirection = vOutputDirection * cosTheta
  6382. + cross( axis, vOutputDirection ) * sin( theta )
  6383. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  6384. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  6385. }
  6386. void main() {
  6387. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  6388. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  6389. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  6390. }
  6391. axis = normalize( axis );
  6392. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  6393. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  6394. for ( int i = 1; i < n; i++ ) {
  6395. if ( i >= samples ) {
  6396. break;
  6397. }
  6398. float theta = dTheta * float( i );
  6399. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  6400. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  6401. }
  6402. }
  6403. `,blending:vs,depthTest:!1,depthWrite:!1})}function Vre(){return new Sa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Jz(),fragmentShader:`
  6404. precision mediump float;
  6405. precision mediump int;
  6406. varying vec3 vOutputDirection;
  6407. uniform sampler2D envMap;
  6408. #include <common>
  6409. void main() {
  6410. vec3 outputDirection = normalize( vOutputDirection );
  6411. vec2 uv = equirectUv( outputDirection );
  6412. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  6413. }
  6414. `,blending:vs,depthTest:!1,depthWrite:!1})}function Gre(){return new Sa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Jz(),fragmentShader:`
  6415. precision mediump float;
  6416. precision mediump int;
  6417. uniform float flipEnvMap;
  6418. varying vec3 vOutputDirection;
  6419. uniform samplerCube envMap;
  6420. void main() {
  6421. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  6422. }
  6423. `,blending:vs,depthTest:!1,depthWrite:!1})}function Jz(){return`
  6424. precision mediump float;
  6425. precision mediump int;
  6426. attribute float faceIndex;
  6427. varying vec3 vOutputDirection;
  6428. // RH coordinate system; PMREM face-indexing convention
  6429. vec3 getDirection( vec2 uv, float face ) {
  6430. uv = 2.0 * uv - 1.0;
  6431. vec3 direction = vec3( uv, 1.0 );
  6432. if ( face == 0.0 ) {
  6433. direction = direction.zyx; // ( 1, v, u ) pos x
  6434. } else if ( face == 1.0 ) {
  6435. direction = direction.xzy;
  6436. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  6437. } else if ( face == 2.0 ) {
  6438. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  6439. } else if ( face == 3.0 ) {
  6440. direction = direction.zyx;
  6441. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  6442. } else if ( face == 4.0 ) {
  6443. direction = direction.xzy;
  6444. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  6445. } else if ( face == 5.0 ) {
  6446. direction.z *= -1.0; // ( u, v, -1 ) neg z
  6447. }
  6448. return direction;
  6449. }
  6450. void main() {
  6451. vOutputDirection = getDirection( uv, faceIndex );
  6452. gl_Position = vec4( position, 1.0 );
  6453. }
  6454. `}function Hre(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===oS||l===sS,c=l===ol||l===eu;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let f=e.get(s);return t===null&&(t=new gS(r)),f=u?t.fromEquirectangular(s,f):t.fromCubemap(s,f),e.set(s,f),f.texture}else{if(e.has(s))return e.get(s).texture;{let f=s.image;if(u&&f&&f.height>0||c&&f&&n(f)){t===null&&(t=new gS(r));let h=u?t.fromEquirectangular(s):t.fromCubemap(s);return e.set(s,h),s.addEventListener("dispose",a),h.texture}else return null}}}return s}function n(s){let l=0,u=6;for(let c=0;c<u;c++)s[c]!==void 0&&l++;return l===u}function a(s){let l=s.target;l.removeEventListener("dispose",a);let u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function Wre(r){let e={};function t(i){if(e[i]!==void 0)return e[i];let n;switch(i){case"WEBGL_depth_texture":n=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=r.getExtension(i)}return e[i]=n,n}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){let n=t(i);return n===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),n}}}function Xre(r,e,t,i){let n={},a=new WeakMap;function o(f){let h=f.target;h.index!==null&&e.remove(h.index);for(let d in h.attributes)e.remove(h.attributes[d]);for(let d in h.morphAttributes){let g=h.morphAttributes[d];for(let m=0,v=g.length;m<v;m++)e.remove(g[m])}h.removeEventListener("dispose",o),delete n[h.id];let p=a.get(h);p&&(e.remove(p),a.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function s(f,h){return n[h.id]===!0||(h.addEventListener("dispose",o),n[h.id]=!0,t.memory.geometries++),h}function l(f){let h=f.attributes;for(let d in h)e.update(h[d],r.ARRAY_BUFFER);let p=f.morphAttributes;for(let d in p){let g=p[d];for(let m=0,v=g.length;m<v;m++)e.update(g[m],r.ARRAY_BUFFER)}}function u(f){let h=[],p=f.index,d=f.attributes.position,g=0;if(p!==null){let _=p.array;g=p.version;for(let y=0,x=_.length;y<x;y+=3){let M=_[y+0],S=_[y+1],w=_[y+2];h.push(M,S,S,w,w,M)}}else if(d!==void 0){let _=d.array;g=d.version;for(let y=0,x=_.length/3-1;y<x;y+=3){let M=y+0,S=y+1,w=y+2;h.push(M,S,S,w,w,M)}}else return;let m=new(eA(h)?Dg:Pg)(h,1);m.version=g;let v=a.get(f);v&&e.remove(v),a.set(f,m)}function c(f){let h=a.get(f);if(h){let p=f.index;p!==null&&h.version<p.version&&u(f)}else u(f);return a.get(f)}return{get:s,update:l,getWireframeAttribute:c}}function Yre(r,e,t,i){let n=i.isWebGL2,a;function o(p){a=p}let s,l;function u(p){s=p.type,l=p.bytesPerElement}function c(p,d){r.drawElements(a,d,s,p*l),t.update(d,a,1)}function f(p,d,g){if(g===0)return;let m,v;if(n)m=r,v="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[v](a,d,s,p*l,g),t.update(d,a,g)}function h(p,d,g){if(g===0)return;let m=e.get("WEBGL_multi_draw");if(m===null)for(let v=0;v<g;v++)this.render(p[v]/l,d[v]);else{m.multiDrawElementsWEBGL(a,d,0,s,p,0,g);let v=0;for(let _=0;_<g;_++)v+=d[_];t.update(v,a,1)}}this.setMode=o,this.setIndex=u,this.render=c,this.renderInstances=f,this.renderMultiDraw=h}function qre(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,o,s){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=s*(a/3);break;case r.LINES:t.lines+=s*(a/2);break;case r.LINE_STRIP:t.lines+=s*(a-1);break;case r.LINE_LOOP:t.lines+=s*a;break;case r.POINTS:t.points+=s*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function n(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:i}}function LTe(r,e){return r[0]-e[0]}function PTe(r,e){return Math.abs(e[1])-Math.abs(r[1])}function Zre(r,e,t){let i={},n=new Float32Array(8),a=new WeakMap,o=new ni,s=[];for(let u=0;u<8;u++)s[u]=[u,0];function l(u,c,f){let h=u.morphTargetInfluences;if(e.isWebGL2===!0){let d=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,g=d!==void 0?d.length:0,m=a.get(c);if(m===void 0||m.count!==g){let R=function(){E.dispose(),a.delete(c),c.removeEventListener("dispose",R)};var p=R;m!==void 0&&m.texture.dispose();let v=c.morphAttributes.position!==void 0,_=c.morphAttributes.normal!==void 0,y=c.morphAttributes.color!==void 0,x=c.morphAttributes.position||[],M=c.morphAttributes.normal||[],S=c.morphAttributes.color||[],w=0;v===!0&&(w=1),_===!0&&(w=2),y===!0&&(w=3);let T=c.attributes.position.count*w,C=1;T>e.maxTextureSize&&(C=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);let b=new Float32Array(T*C*4*g),E=new Mg(b,T,C,g);E.type=ja,E.needsUpdate=!0;let I=w*4;for(let A=0;A<g;A++){let D=x[A],U=M[A],B=S[A],z=T*C*4*A;for(let k=0;k<D.count;k++){let G=k*I;v===!0&&(o.fromBufferAttribute(D,k),b[z+G+0]=o.x,b[z+G+1]=o.y,b[z+G+2]=o.z,b[z+G+3]=0),_===!0&&(o.fromBufferAttribute(U,k),b[z+G+4]=o.x,b[z+G+5]=o.y,b[z+G+6]=o.z,b[z+G+7]=0),y===!0&&(o.fromBufferAttribute(B,k),b[z+G+8]=o.x,b[z+G+9]=o.y,b[z+G+10]=o.z,b[z+G+11]=B.itemSize===4?o.w:1)}}m={count:g,texture:E,size:new Kt(T,C)},a.set(c,m),c.addEventListener("dispose",R)}if(u.isInstancedMesh===!0&&u.morphTexture!==null)f.getUniforms().setValue(r,"morphTexture",u.morphTexture,t);else{let v=0;for(let y=0;y<h.length;y++)v+=h[y];let _=c.morphTargetsRelative?1:1-v;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",h)}f.getUniforms().setValue(r,"morphTargetsTexture",m.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",m.size)}else{let d=h===void 0?0:h.length,g=i[c.id];if(g===void 0||g.length!==d){g=[];for(let x=0;x<d;x++)g[x]=[x,0];i[c.id]=g}for(let x=0;x<d;x++){let M=g[x];M[0]=x,M[1]=h[x]}g.sort(PTe);for(let x=0;x<8;x++)x<d&&g[x][1]?(s[x][0]=g[x][0],s[x][1]=g[x][1]):(s[x][0]=Number.MAX_SAFE_INTEGER,s[x][1]=0);s.sort(LTe);let m=c.morphAttributes.position,v=c.morphAttributes.normal,_=0;for(let x=0;x<8;x++){let M=s[x],S=M[0],w=M[1];S!==Number.MAX_SAFE_INTEGER&&w?(m&&c.getAttribute("morphTarget"+x)!==m[S]&&c.setAttribute("morphTarget"+x,m[S]),v&&c.getAttribute("morphNormal"+x)!==v[S]&&c.setAttribute("morphNormal"+x,v[S]),n[x]=w,_+=w):(m&&c.hasAttribute("morphTarget"+x)===!0&&c.deleteAttribute("morphTarget"+x),v&&c.hasAttribute("morphNormal"+x)===!0&&c.deleteAttribute("morphNormal"+x),n[x]=0)}let y=c.morphTargetsRelative?1:1-_;f.getUniforms().setValue(r,"morphTargetBaseInfluence",y),f.getUniforms().setValue(r,"morphTargetInfluences",n)}}return{update:l}}function jre(r,e,t,i){let n=new WeakMap;function a(l){let u=i.render.frame,c=l.geometry,f=e.get(l,c);if(n.get(f)!==u&&(e.update(f),n.set(f,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",s)===!1&&l.addEventListener("dispose",s),n.get(l)!==u&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),n.set(l,u))),l.isSkinnedMesh){let h=l.skeleton;n.get(h)!==u&&(h.update(),n.set(h,u))}return f}function o(){n=new WeakMap}function s(l){let u=l.target;u.removeEventListener("dispose",s),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}var Xg=class extends eo{constructor(e,t,i,n,a,o,s,l,u,c){if(c=c!==void 0?c:ll,c!==ll&&c!==tu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===ll&&(i=Lo),i===void 0&&c===tu&&(i=ys),super(null,n,a,o,s,l,c,i,u),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=s!==void 0?s:Bi,this.minFilter=l!==void 0?l:Bi,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}};var rie=new eo,iie=new Xg(1,1);iie.compareFunction=JE;var nie=new Mg,aie=new nA,oie=new kg,Kre=[],Jre=[],$re=new Float32Array(16),Qre=new Float32Array(9),eie=new Float32Array(4);function Yg(r,e,t){let i=r[0];if(i<=0||i>0)return r;let n=e*t,a=Kre[n];if(a===void 0&&(a=new Float32Array(n),Kre[n]=a),e!==0){i.toArray(a,0);for(let o=1,s=0;o!==e;++o)s+=t,r[o].toArray(a,s)}return a}function nn(r,e){if(r.length!==e.length)return!1;for(let t=0,i=r.length;t<i;t++)if(r[t]!==e[t])return!1;return!0}function an(r,e){for(let t=0,i=e.length;t<i;t++)r[t]=e[t]}function LA(r,e){let t=Jre[e];t===void 0&&(t=new Int32Array(e),Jre[e]=t);for(let i=0;i!==e;++i)t[i]=r.allocateTextureUnit();return t}function DTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function ITe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;r.uniform2fv(this.addr,e),an(t,e)}}function NTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(nn(t,e))return;r.uniform3fv(this.addr,e),an(t,e)}}function UTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(nn(t,e))return;r.uniform4fv(this.addr,e),an(t,e)}}function OTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(nn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),an(t,e)}else{if(nn(t,i))return;eie.set(i),r.uniformMatrix2fv(this.addr,!1,eie),an(t,i)}}function zTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(nn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),an(t,e)}else{if(nn(t,i))return;Qre.set(i),r.uniformMatrix3fv(this.addr,!1,Qre),an(t,i)}}function FTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(nn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),an(t,e)}else{if(nn(t,i))return;$re.set(i),r.uniformMatrix4fv(this.addr,!1,$re),an(t,i)}}function BTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function kTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;r.uniform2iv(this.addr,e),an(t,e)}}function VTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(nn(t,e))return;r.uniform3iv(this.addr,e),an(t,e)}}function GTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(nn(t,e))return;r.uniform4iv(this.addr,e),an(t,e)}}function HTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function WTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;r.uniform2uiv(this.addr,e),an(t,e)}}function XTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(nn(t,e))return;r.uniform3uiv(this.addr,e),an(t,e)}}function YTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(nn(t,e))return;r.uniform4uiv(this.addr,e),an(t,e)}}function qTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n);let a=this.type===r.SAMPLER_2D_SHADOW?iie:rie;t.setTexture2D(e||a,n)}function ZTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||aie,n)}function jTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTextureCube(e||oie,n)}function KTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||nie,n)}function JTe(r){switch(r){case 5126:return DTe;case 35664:return ITe;case 35665:return NTe;case 35666:return UTe;case 35674:return OTe;case 35675:return zTe;case 35676:return FTe;case 5124:case 35670:return BTe;case 35667:case 35671:return kTe;case 35668:case 35672:return VTe;case 35669:case 35673:return GTe;case 5125:return HTe;case 36294:return WTe;case 36295:return XTe;case 36296:return YTe;case 35678:case 36198:case 36298:case 36306:case 35682:return qTe;case 35679:case 36299:case 36307:return ZTe;case 35680:case 36300:case 36308:case 36293:return jTe;case 36289:case 36303:case 36311:case 36292:return KTe}}function $Te(r,e){r.uniform1fv(this.addr,e)}function QTe(r,e){let t=Yg(e,this.size,2);r.uniform2fv(this.addr,t)}function eEe(r,e){let t=Yg(e,this.size,3);r.uniform3fv(this.addr,t)}function tEe(r,e){let t=Yg(e,this.size,4);r.uniform4fv(this.addr,t)}function rEe(r,e){let t=Yg(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function iEe(r,e){let t=Yg(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function nEe(r,e){let t=Yg(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function aEe(r,e){r.uniform1iv(this.addr,e)}function oEe(r,e){r.uniform2iv(this.addr,e)}function sEe(r,e){r.uniform3iv(this.addr,e)}function lEe(r,e){r.uniform4iv(this.addr,e)}function uEe(r,e){r.uniform1uiv(this.addr,e)}function cEe(r,e){r.uniform2uiv(this.addr,e)}function fEe(r,e){r.uniform3uiv(this.addr,e)}function hEe(r,e){r.uniform4uiv(this.addr,e)}function pEe(r,e,t){let i=this.cache,n=e.length,a=LA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTexture2D(e[o]||rie,a[o])}function dEe(r,e,t){let i=this.cache,n=e.length,a=LA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTexture3D(e[o]||aie,a[o])}function mEe(r,e,t){let i=this.cache,n=e.length,a=LA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTextureCube(e[o]||oie,a[o])}function vEe(r,e,t){let i=this.cache,n=e.length,a=LA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||nie,a[o])}function gEe(r){switch(r){case 5126:return $Te;case 35664:return QTe;case 35665:return eEe;case 35666:return tEe;case 35674:return rEe;case 35675:return iEe;case 35676:return nEe;case 5124:case 35670:return aEe;case 35667:case 35671:return oEe;case 35668:case 35672:return sEe;case 35669:case 35673:return lEe;case 5125:return uEe;case 36294:return cEe;case 36295:return fEe;case 36296:return hEe;case 35678:case 36198:case 36298:case 36306:case 35682:return pEe;case 35679:case 36299:case 36307:return dEe;case 35680:case 36300:case 36308:case 36293:return mEe;case 36289:case 36303:case 36311:case 36292:return vEe}}var Qz=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=JTe(t.type)}},eF=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=gEe(t.type)}},tF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let a=0,o=n.length;a!==o;++a){let s=n[a];s.setValue(e,t[s.id],i)}}},$z=/(\w+)(\])?(\[|\.)?/g;function tie(r,e){r.seq.push(e),r.map[e.id]=e}function yEe(r,e,t){let i=r.name,n=i.length;for($z.lastIndex=0;;){let a=$z.exec(i),o=$z.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){tie(t,u===void 0?new Qz(s,r,e):new eF(s,r,e));break}else{let f=t.map[s];f===void 0&&(f=new tF(s),tie(t,f)),t=f}}}var _h=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){let a=e.getActiveUniform(t,n),o=e.getUniformLocation(t,a.name);yEe(a,o,this)}}setValue(e,t,i,n){let a=this.map[t];a!==void 0&&a.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];n!==void 0&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let a=0,o=t.length;a!==o;++a){let s=t[a],l=i[s.id];l.needsUpdate!==!1&&s.setValue(e,l.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,a=e.length;n!==a;++n){let o=e[n];o.id in t&&i.push(o)}return i}};function rF(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}var _Ee=37297,xEe=0;function SEe(r,e){let t=r.split(`
  6455. `),i=[],n=Math.max(e-6,0),a=Math.min(e+6,t.length);for(let o=n;o<a;o++){let s=o+1;i.push(`${s===e?">":" "} ${s}: ${t[o]}`)}return i.join(`
  6456. `)}function MEe(r){let e=Tr.getPrimaries(Tr.workingColorSpace),t=Tr.getPrimaries(r),i;switch(e===t?i="":e===vg&&t===mg?i="LinearDisplayP3ToLinearSRGB":e===mg&&t===vg&&(i="LinearSRGBToLinearDisplayP3"),r){case Ja:case vd:return[i,"LinearTransferOETF"];case Ka:case pg:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function sie(r,e,t){let i=r.getShaderParameter(e,r.COMPILE_STATUS),n=r.getShaderInfoLog(e).trim();if(i&&n==="")return"";let a=/ERROR: 0:(\d+)/.exec(n);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`
  6457. `+n+`
  6458. `+SEe(r.getShaderSource(e),o)}else return n}function bEe(r,e){let t=MEe(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function wEe(r,e){let t;switch(e){case $$:t="Linear";break;case Q$:t="Reinhard";break;case eQ:t="OptimizedCineon";break;case tQ:t="ACESFilmic";break;case iQ:t="AgX";break;case nQ:t="Neutral";break;case rQ:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function TEe(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.alphaToCoverage||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(qg).join(`
  6459. `)}function EEe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(qg).join(`
  6460. `)}function AEe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  6461. `)}function CEe(r,e){let t={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){let a=r.getActiveAttrib(e,n),o=a.name,s=1;a.type===r.FLOAT_MAT2&&(s=2),a.type===r.FLOAT_MAT3&&(s=3),a.type===r.FLOAT_MAT4&&(s=4),t[o]={type:a.type,location:r.getAttribLocation(e,o),locationSize:s}}return t}function qg(r){return r!==""}function lie(r,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).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_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function uie(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var REe=/^[ \t]*#include +<([\w\d./]+)>/gm;function iF(r){return r.replace(REe,PEe)}var LEe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function PEe(r,e){let t=pr[e];if(t===void 0){let i=LEe.get(e);if(i!==void 0)t=pr[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return iF(t)}var DEe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function cie(r){return r.replace(DEe,IEe)}function IEe(r,e,t,i){let n="";for(let a=parseInt(e);a<parseInt(t);a++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return n}function fie(r){let e=`precision ${r.precision} float;
  6462. precision ${r.precision} int;
  6463. precision ${r.precision} sampler2D;
  6464. precision ${r.precision} samplerCube;
  6465. `;return r.isWebGL2&&(e+=`precision ${r.precision} sampler3D;
  6466. precision ${r.precision} sampler2DArray;
  6467. precision ${r.precision} sampler2DShadow;
  6468. precision ${r.precision} samplerCubeShadow;
  6469. precision ${r.precision} sampler2DArrayShadow;
  6470. precision ${r.precision} isampler2D;
  6471. precision ${r.precision} isampler3D;
  6472. precision ${r.precision} isamplerCube;
  6473. precision ${r.precision} isampler2DArray;
  6474. precision ${r.precision} usampler2D;
  6475. precision ${r.precision} usampler3D;
  6476. precision ${r.precision} usamplerCube;
  6477. precision ${r.precision} usampler2DArray;
  6478. `),r.precision==="highp"?e+=`
  6479. #define HIGH_PRECISION`:r.precision==="mediump"?e+=`
  6480. #define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
  6481. #define LOW_PRECISION`),e}function NEe(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===OE?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===E$?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===al&&(e="SHADOWMAP_TYPE_VSM"),e}function UEe(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case ol:case eu:e="ENVMAP_TYPE_CUBE";break;case lh:e="ENVMAP_TYPE_CUBE_UV";break}return e}function OEe(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case eu:e="ENVMAP_MODE_REFRACTION";break}return e}function zEe(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case zE:e="ENVMAP_BLENDING_MULTIPLY";break;case K$:e="ENVMAP_BLENDING_MIX";break;case J$:e="ENVMAP_BLENDING_ADD";break}return e}function FEe(r){let e=r.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function hie(r,e,t,i){let n=r.getContext(),a=t.defines,o=t.vertexShader,s=t.fragmentShader,l=NEe(t),u=UEe(t),c=OEe(t),f=zEe(t),h=FEe(t),p=t.isWebGL2?"":TEe(t),d=EEe(t),g=AEe(a),m=n.createProgram(),v,_,y=t.glslVersion?"#version "+t.glslVersion+`
  6482. `:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(qg).join(`
  6483. `),v.length>0&&(v+=`
  6484. `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(qg).join(`
  6485. `),_.length>0&&(_+=`
  6486. `)):(v=[fie(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  6487. `].filter(qg).join(`
  6488. `),_=[p,fie(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+c:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==gs?"#define TONE_MAPPING":"",t.toneMapping!==gs?pr.tonemapping_pars_fragment:"",t.toneMapping!==gs?wEe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",pr.colorspace_pars_fragment,bEe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  6489. `].filter(qg).join(`
  6490. `)),o=iF(o),o=lie(o,t),o=uie(o,t),s=iF(s),s=lie(s,t),s=uie(s,t),o=cie(o),s=cie(s),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
  6491. `,v=[d,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  6492. `)+`
  6493. `+v,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===Az?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Az?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
  6494. `)+`
  6495. `+_);let x=y+v+o,M=y+_+s,S=rF(n,n.VERTEX_SHADER,x),w=rF(n,n.FRAGMENT_SHADER,M);n.attachShader(m,S),n.attachShader(m,w),t.index0AttributeName!==void 0?n.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&n.bindAttribLocation(m,0,"position"),n.linkProgram(m);function T(I){if(r.debug.checkShaderErrors){let R=n.getProgramInfoLog(m).trim(),A=n.getShaderInfoLog(S).trim(),D=n.getShaderInfoLog(w).trim(),U=!0,B=!0;if(n.getProgramParameter(m,n.LINK_STATUS)===!1)if(U=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(n,m,S,w);else{let z=sie(n,S,"vertex"),k=sie(n,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(m,n.VALIDATE_STATUS)+`
  6496. Material Name: `+I.name+`
  6497. Material Type: `+I.type+`
  6498. Program Info Log: `+R+`
  6499. `+z+`
  6500. `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||D==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:D,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new _h(n,m),b=CEe(n,m)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let b;this.getAttributes=function(){return b===void 0&&T(this),b};let E=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=n.getProgramParameter(m,_Ee)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=xEe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var BEe=0,PA=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),a=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(n)===!1&&(o.add(n),n.usedTimes++),o.has(a)===!1&&(o.add(a),a.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new nF(e),t.set(e,i)),i}},nF=class{constructor(e){this.id=BEe++,this.code=e,this.usedTimes=0}};function pie(r,e,t,i,n,a,o){let s=new Ag,l=new PA,u=new Set,c=[],f=n.isWebGL2,h=n.logarithmicDepthBuffer,p=n.vertexTextures,d=n.precision,g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(b){return u.add(b),b===0?"uv":`uv${b}`}function v(b,E,I,R,A){let D=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,z=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=z&&z.mapping===lh?z.image.height:null,G=g[b.type];b.precision!==null&&(d=n.getMaxPrecision(b.precision),d!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));let Y=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,J=Y!==void 0?Y.length:0,Q=0;U.morphAttributes.position!==void 0&&(Q=1),U.morphAttributes.normal!==void 0&&(Q=2),U.morphAttributes.color!==void 0&&(Q=3);let V,K,ae,ve;if(G){let Ft=Ss[G];V=Ft.vertexShader,K=Ft.fragmentShader}else V=b.vertexShader,K=b.fragmentShader,l.update(b),ae=l.getVertexShaderID(b),ve=l.getFragmentShaderID(b);let ue=r.getRenderTarget(),se=A.isInstancedMesh===!0,Ee=A.isBatchedMesh===!0,q=!!b.map,H=!!b.matcap,We=!!z,_e=!!b.aoMap,xe=!!b.lightMap,Le=!!b.bumpMap,Ue=!!b.normalMap,Ne=!!b.displacementMap,Ve=!!b.emissiveMap,ct=!!b.metalnessMap,F=!!b.roughnessMap,L=b.anisotropy>0,ne=b.clearcoat>0,le=b.iridescence>0,me=b.sheen>0,he=b.transmission>0,et=L&&!!b.anisotropyMap,Ke=ne&&!!b.clearcoatMap,Se=ne&&!!b.clearcoatNormalMap,Ae=ne&&!!b.clearcoatRoughnessMap,nt=le&&!!b.iridescenceMap,$=le&&!!b.iridescenceThicknessMap,it=me&&!!b.sheenColorMap,Xe=me&&!!b.sheenRoughnessMap,Fe=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,st=he&&!!b.transmissionMap,Je=he&&!!b.thicknessMap,kt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,Pe=gs;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(Pe=r.toneMapping);let xt={isWebGL2:f,shaderID:G,shaderType:b.type,shaderName:b.name,vertexShader:V,fragmentShader:K,defines:b.defines,customVertexShaderID:ae,customFragmentShaderID:ve,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,batching:Ee,instancing:se,instancingColor:se&&A.instanceColor!==null,instancingMorph:se&&A.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:ue===null?r.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:Ja,alphaToCoverage:!!b.alphaToCoverage,map:q,matcap:H,envMap:We,envMapMode:We&&z.mapping,envMapCubeUVHeight:k,aoMap:_e,lightMap:xe,bumpMap:Le,normalMap:Ue,displacementMap:p&&Ne,emissiveMap:Ve,normalMapObjectSpace:Ue&&b.normalMapType===vQ,normalMapTangentSpace:Ue&&b.normalMapType===mQ,metalnessMap:ct,roughnessMap:F,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:nt,iridescenceThicknessMap:$,sheen:me,sheenColorMap:it,sheenRoughnessMap:Xe,specularMap:Fe,specularColorMap:we,specularIntensityMap:Ie,transmission:he,transmissionMap:st,thicknessMap:Je,gradientMap:kt,opaque:b.transparent===!1&&b.blending===Xu&&b.alphaToCoverage===!1,alphaMap:X,alphaTest:Te,alphaHash:te,combine:b.combine,mapUv:q&&m(b.map.channel),aoMapUv:_e&&m(b.aoMap.channel),lightMapUv:xe&&m(b.lightMap.channel),bumpMapUv:Le&&m(b.bumpMap.channel),normalMapUv:Ue&&m(b.normalMap.channel),displacementMapUv:Ne&&m(b.displacementMap.channel),emissiveMapUv:Ve&&m(b.emissiveMap.channel),metalnessMapUv:ct&&m(b.metalnessMap.channel),roughnessMapUv:F&&m(b.roughnessMap.channel),anisotropyMapUv:et&&m(b.anisotropyMap.channel),clearcoatMapUv:Ke&&m(b.clearcoatMap.channel),clearcoatNormalMapUv:Se&&m(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&m(b.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&m(b.iridescenceMap.channel),iridescenceThicknessMapUv:$&&m(b.iridescenceThicknessMap.channel),sheenColorMapUv:it&&m(b.sheenColorMap.channel),sheenRoughnessMapUv:Xe&&m(b.sheenRoughnessMap.channel),specularMapUv:Fe&&m(b.specularMap.channel),specularColorMapUv:we&&m(b.specularColorMap.channel),specularIntensityMapUv:Ie&&m(b.specularIntensityMap.channel),transmissionMapUv:st&&m(b.transmissionMap.channel),thicknessMapUv:Je&&m(b.thicknessMap.channel),alphaMapUv:X&&m(b.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(Ue||L),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:A.isPoints===!0&&!!U.attributes.uv&&(q||X),fog:!!D,useFog:b.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:A.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:Q,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&I.length>0,shadowMapType:r.shadowMap.type,toneMapping:Pe,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&Tr.getTransfer(b.map.colorSpace)===Hr,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Co,flipSided:b.side===_i,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Me&&b.extensions.derivatives===!0,extensionFragDepth:Me&&b.extensions.fragDepth===!0,extensionDrawBuffers:Me&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Me&&b.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Me&&b.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Me&&b.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:f||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return xt.vertexUv1s=u.has(1),xt.vertexUv2s=u.has(2),xt.vertexUv3s=u.has(3),u.clear(),xt}function _(b){let E=[];if(b.shaderID?E.push(b.shaderID):(E.push(b.customVertexShaderID),E.push(b.customFragmentShaderID)),b.defines!==void 0)for(let I in b.defines)E.push(I),E.push(b.defines[I]);return b.isRawShaderMaterial===!1&&(y(E,b),x(E,b),E.push(r.outputColorSpace)),E.push(b.customProgramCacheKey),E.join()}function y(b,E){b.push(E.precision),b.push(E.outputColorSpace),b.push(E.envMapMode),b.push(E.envMapCubeUVHeight),b.push(E.mapUv),b.push(E.alphaMapUv),b.push(E.lightMapUv),b.push(E.aoMapUv),b.push(E.bumpMapUv),b.push(E.normalMapUv),b.push(E.displacementMapUv),b.push(E.emissiveMapUv),b.push(E.metalnessMapUv),b.push(E.roughnessMapUv),b.push(E.anisotropyMapUv),b.push(E.clearcoatMapUv),b.push(E.clearcoatNormalMapUv),b.push(E.clearcoatRoughnessMapUv),b.push(E.iridescenceMapUv),b.push(E.iridescenceThicknessMapUv),b.push(E.sheenColorMapUv),b.push(E.sheenRoughnessMapUv),b.push(E.specularMapUv),b.push(E.specularColorMapUv),b.push(E.specularIntensityMapUv),b.push(E.transmissionMapUv),b.push(E.thicknessMapUv),b.push(E.combine),b.push(E.fogExp2),b.push(E.sizeAttenuation),b.push(E.morphTargetsCount),b.push(E.morphAttributeCount),b.push(E.numDirLights),b.push(E.numPointLights),b.push(E.numSpotLights),b.push(E.numSpotLightMaps),b.push(E.numHemiLights),b.push(E.numRectAreaLights),b.push(E.numDirLightShadows),b.push(E.numPointLightShadows),b.push(E.numSpotLightShadows),b.push(E.numSpotLightShadowsWithMaps),b.push(E.numLightProbes),b.push(E.shadowMapType),b.push(E.toneMapping),b.push(E.numClippingPlanes),b.push(E.numClipIntersection),b.push(E.depthPacking)}function x(b,E){s.disableAll(),E.isWebGL2&&s.enable(0),E.supportsVertexTextures&&s.enable(1),E.instancing&&s.enable(2),E.instancingColor&&s.enable(3),E.instancingMorph&&s.enable(4),E.matcap&&s.enable(5),E.envMap&&s.enable(6),E.normalMapObjectSpace&&s.enable(7),E.normalMapTangentSpace&&s.enable(8),E.clearcoat&&s.enable(9),E.iridescence&&s.enable(10),E.alphaTest&&s.enable(11),E.vertexColors&&s.enable(12),E.vertexAlphas&&s.enable(13),E.vertexUv1s&&s.enable(14),E.vertexUv2s&&s.enable(15),E.vertexUv3s&&s.enable(16),E.vertexTangents&&s.enable(17),E.anisotropy&&s.enable(18),E.alphaHash&&s.enable(19),E.batching&&s.enable(20),b.push(s.mask),s.disableAll(),E.fog&&s.enable(0),E.useFog&&s.enable(1),E.flatShading&&s.enable(2),E.logarithmicDepthBuffer&&s.enable(3),E.skinning&&s.enable(4),E.morphTargets&&s.enable(5),E.morphNormals&&s.enable(6),E.morphColors&&s.enable(7),E.premultipliedAlpha&&s.enable(8),E.shadowMapEnabled&&s.enable(9),E.useLegacyLights&&s.enable(10),E.doubleSided&&s.enable(11),E.flipSided&&s.enable(12),E.useDepthPacking&&s.enable(13),E.dithering&&s.enable(14),E.transmission&&s.enable(15),E.sheen&&s.enable(16),E.opaque&&s.enable(17),E.pointsUvs&&s.enable(18),E.decodeVideoTexture&&s.enable(19),E.alphaToCoverage&&s.enable(20),b.push(s.mask)}function M(b){let E=g[b.type],I;if(E){let R=Ss[E];I=XQ.clone(R.uniforms)}else I=b.uniforms;return I}function S(b,E){let I;for(let R=0,A=c.length;R<A;R++){let D=c[R];if(D.cacheKey===E){I=D,++I.usedTimes;break}}return I===void 0&&(I=new hie(r,E,b,a),c.push(I)),I}function w(b){if(--b.usedTimes===0){let E=c.indexOf(b);c[E]=c[c.length-1],c.pop(),b.destroy()}}function T(b){l.remove(b)}function C(){l.dispose()}return{getParameters:v,getProgramCacheKey:_,getUniforms:M,acquireProgram:S,releaseProgram:w,releaseShaderCache:T,programs:c,dispose:C}}function die(){let r=new WeakMap;function e(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function t(a){r.delete(a)}function i(a,o,s){r.get(a)[o]=s}function n(){r=new WeakMap}return{get:e,remove:t,update:i,dispose:n}}function kEe(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function mie(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function vie(){let r=[],e=0,t=[],i=[],n=[];function a(){e=0,t.length=0,i.length=0,n.length=0}function o(f,h,p,d,g,m){let v=r[e];return v===void 0?(v={id:f.id,object:f,geometry:h,material:p,groupOrder:d,renderOrder:f.renderOrder,z:g,group:m},r[e]=v):(v.id=f.id,v.object=f,v.geometry=h,v.material=p,v.groupOrder=d,v.renderOrder=f.renderOrder,v.z=g,v.group=m),e++,v}function s(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.push(v):p.transparent===!0?n.push(v):t.push(v)}function l(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):t.unshift(v)}function u(f,h){t.length>1&&t.sort(f||kEe),i.length>1&&i.sort(h||mie),n.length>1&&n.sort(h||mie)}function c(){for(let f=e,h=r.length;f<h;f++){let p=r[f];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:n,init:a,push:s,unshift:l,finish:c,sort:u}}function gie(){let r=new WeakMap;function e(i,n){let a=r.get(i),o;return a===void 0?(o=new vie,r.set(i,[o])):n>=a.length?(o=new vie,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function VEe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new be,color:new ir};break;case"SpotLight":t={position:new be,direction:new be,color:new ir,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new be,color:new ir,distance:0,decay:0};break;case"HemisphereLight":t={direction:new be,skyColor:new ir,groundColor:new ir};break;case"RectAreaLight":t={color:new ir,position:new be,halfWidth:new be,halfHeight:new be};break}return r[e.id]=t,t}}}function GEe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var HEe=0;function WEe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function yie(r,e){let t=new VEe,i=GEe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new be);let a=new be,o=new Wr,s=new Wr;function l(c,f){let h=0,p=0,d=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let g=0,m=0,v=0,_=0,y=0,x=0,M=0,S=0,w=0,T=0,C=0;c.sort(WEe);let b=f===!0?Math.PI:1;for(let I=0,R=c.length;I<R;I++){let A=c[I],D=A.color,U=A.intensity,B=A.distance,z=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)h+=D.r*U*b,p+=D.g*U*b,d+=D.b*U*b;else if(A.isLightProbe){for(let k=0;k<9;k++)n.probe[k].addScaledVector(A.sh.coefficients[k],U);C++}else if(A.isDirectionalLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.directionalShadow[g]=Y,n.directionalShadowMap[g]=z,n.directionalShadowMatrix[g]=A.shadow.matrix,x++}n.directional[g]=k,g++}else if(A.isSpotLight){let k=t.get(A);k.position.setFromMatrixPosition(A.matrixWorld),k.color.copy(D).multiplyScalar(U*b),k.distance=B,k.coneCos=Math.cos(A.angle),k.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),k.decay=A.decay,n.spot[v]=k;let G=A.shadow;if(A.map&&(n.spotLightMap[w]=A.map,w++,G.updateMatrices(A),A.castShadow&&T++),n.spotLightMatrix[v]=G.matrix,A.castShadow){let Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.spotShadow[v]=Y,n.spotShadowMap[v]=z,S++}v++}else if(A.isRectAreaLight){let k=t.get(A);k.color.copy(D).multiplyScalar(U),k.halfWidth.set(A.width*.5,0,0),k.halfHeight.set(0,A.height*.5,0),n.rectArea[_]=k,_++}else if(A.isPointLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),k.distance=A.distance,k.decay=A.decay,A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,Y.shadowCameraNear=G.camera.near,Y.shadowCameraFar=G.camera.far,n.pointShadow[m]=Y,n.pointShadowMap[m]=z,n.pointShadowMatrix[m]=A.shadow.matrix,M++}n.point[m]=k,m++}else if(A.isHemisphereLight){let k=t.get(A);k.skyColor.copy(A.color).multiplyScalar(U*b),k.groundColor.copy(A.groundColor).multiplyScalar(U*b),n.hemi[y]=k,y++}}_>0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ht.LTC_FLOAT_1,n.rectAreaLTC2=ht.LTC_FLOAT_2):(n.rectAreaLTC1=ht.LTC_HALF_1,n.rectAreaLTC2=ht.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ht.LTC_FLOAT_1,n.rectAreaLTC2=ht.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=ht.LTC_HALF_1,n.rectAreaLTC2=ht.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=h,n.ambient[1]=p,n.ambient[2]=d;let E=n.hash;(E.directionalLength!==g||E.pointLength!==m||E.spotLength!==v||E.rectAreaLength!==_||E.hemiLength!==y||E.numDirectionalShadows!==x||E.numPointShadows!==M||E.numSpotShadows!==S||E.numSpotMaps!==w||E.numLightProbes!==C)&&(n.directional.length=g,n.spot.length=v,n.rectArea.length=_,n.point.length=m,n.hemi.length=y,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=M,n.pointShadowMap.length=M,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=M,n.spotLightMatrix.length=S+w-T,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=C,E.directionalLength=g,E.pointLength=m,E.spotLength=v,E.rectAreaLength=_,E.hemiLength=y,E.numDirectionalShadows=x,E.numPointShadows=M,E.numSpotShadows=S,E.numSpotMaps=w,E.numLightProbes=C,n.version=HEe++)}function u(c,f){let h=0,p=0,d=0,g=0,m=0,v=f.matrixWorldInverse;for(let _=0,y=c.length;_<y;_++){let x=c[_];if(x.isDirectionalLight){let M=n.directional[h];M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),h++}else if(x.isSpotLight){let M=n.spot[d];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),d++}else if(x.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),s.identity(),o.copy(x.matrixWorld),o.premultiply(v),s.extractRotation(o),M.halfWidth.set(x.width*.5,0,0),M.halfHeight.set(0,x.height*.5,0),M.halfWidth.applyMatrix4(s),M.halfHeight.applyMatrix4(s),g++}else if(x.isPointLight){let M=n.point[p];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),p++}else if(x.isHemisphereLight){let M=n.hemi[m];M.direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(v),m++}}}return{setup:l,setupView:u,state:n}}function _ie(r,e){let t=new yie(r,e),i=[],n=[];function a(){i.length=0,n.length=0}function o(f){i.push(f)}function s(f){n.push(f)}function l(f){t.setup(i,f)}function u(f){t.setupView(i,f)}return{init:a,state:{lightsArray:i,shadowsArray:n,lights:t},setupLights:l,setupLightsView:u,pushLight:o,pushShadow:s}}function xie(r,e){let t=new WeakMap;function i(a,o=0){let s=t.get(a),l;return s===void 0?(l=new _ie(r,e),t.set(a,[l])):o>=s.length?(l=new _ie(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var DA=class extends au{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=pQ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};var IA=class extends au{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};var Sie=`
  6501. void main() {
  6502. gl_Position = vec4( position, 1.0 );
  6503. }
  6504. `,Mie=`
  6505. uniform sampler2D shadow_pass;
  6506. uniform vec2 resolution;
  6507. uniform float radius;
  6508. #include <packing>
  6509. void main() {
  6510. const float samples = float( VSM_SAMPLES );
  6511. float mean = 0.0;
  6512. float squared_mean = 0.0;
  6513. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  6514. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  6515. for ( float i = 0.0; i < samples; i ++ ) {
  6516. float uvOffset = uvStart + i * uvStride;
  6517. #ifdef HORIZONTAL_PASS
  6518. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  6519. mean += distribution.x;
  6520. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  6521. #else
  6522. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  6523. mean += depth;
  6524. squared_mean += depth * depth;
  6525. #endif
  6526. }
  6527. mean = mean / samples;
  6528. squared_mean = squared_mean / samples;
  6529. float std_dev = sqrt( squared_mean - mean * mean );
  6530. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  6531. }
  6532. `;function bie(r,e,t){let i=new yh,n=new Kt,a=new Kt,o=new ni,s=new DA({depthPacking:dQ}),l=new IA,u={},c=t.maxTextureSize,f={[Ao]:_i,[_i]:Ao,[Co]:Co},h=new Sa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Kt},radius:{value:4}},vertexShader:Sie,fragmentShader:Mie}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new ro;d.setAttribute("position",new xa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new rn(d,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=OE;let v=this.type;this.render=function(S,w,T){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;let C=r.getRenderTarget(),b=r.getActiveCubeFace(),E=r.getActiveMipmapLevel(),I=r.state;I.setBlending(vs),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==al&&this.type===al,A=v===al&&this.type!==al;for(let D=0,U=S.length;D<U;D++){let B=S[D],z=B.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;n.copy(z.mapSize);let k=z.getFrameExtents();if(n.multiply(k),a.copy(z.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/k.x),n.x=a.x*k.x,z.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/k.y),n.y=a.y*k.y,z.mapSize.y=a.y)),z.map===null||R===!0||A===!0){let Y=this.type!==al?{minFilter:Bi,magFilter:Bi}:{};z.map!==null&&z.map.dispose(),z.map=new to(n.x,n.y,Y),z.map.texture.name=B.name+".shadowMap",z.camera.updateProjectionMatrix()}r.setRenderTarget(z.map),r.clear();let G=z.getViewportCount();for(let Y=0;Y<G;Y++){let J=z.getViewport(Y);o.set(a.x*J.x,a.y*J.y,a.x*J.z,a.y*J.w),I.viewport(o),z.updateMatrices(B,Y),i=z.getFrustum(),x(w,T,z.camera,B,this.type)}z.isPointLightShadow!==!0&&this.type===al&&_(z,T),z.needsUpdate=!1}v=this.type,m.needsUpdate=!1,r.setRenderTarget(C,b,E)};function _(S,w){let T=e.update(g);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,p.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new to(n.x,n.y)),h.uniforms.shadow_pass.value=S.map.texture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,r.setRenderTarget(S.mapPass),r.clear(),r.renderBufferDirect(w,null,T,h,g,null),p.uniforms.shadow_pass.value=S.mapPass.texture,p.uniforms.resolution.value=S.mapSize,p.uniforms.radius.value=S.radius,r.setRenderTarget(S.map),r.clear(),r.renderBufferDirect(w,null,T,p,g,null)}function y(S,w,T,C){let b=null,E=T.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(E!==void 0)b=E;else if(b=T.isPointLight===!0?l:s,r.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){let I=b.uuid,R=w.uuid,A=u[I];A===void 0&&(A={},u[I]=A);let D=A[R];D===void 0&&(D=b.clone(),A[R]=D,w.addEventListener("dispose",M)),b=D}if(b.visible=w.visible,b.wireframe=w.wireframe,C===al?b.side=w.shadowSide!==null?w.shadowSide:w.side:b.side=w.shadowSide!==null?w.shadowSide:f[w.side],b.alphaMap=w.alphaMap,b.alphaTest=w.alphaTest,b.map=w.map,b.clipShadows=w.clipShadows,b.clippingPlanes=w.clippingPlanes,b.clipIntersection=w.clipIntersection,b.displacementMap=w.displacementMap,b.displacementScale=w.displacementScale,b.displacementBias=w.displacementBias,b.wireframeLinewidth=w.wireframeLinewidth,b.linewidth=w.linewidth,T.isPointLight===!0&&b.isMeshDistanceMaterial===!0){let I=r.properties.get(b);I.light=T}return b}function x(S,w,T,C,b){if(S.visible===!1)return;if(S.layers.test(w.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&b===al)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,S.matrixWorld);let R=e.update(S),A=S.material;if(Array.isArray(A)){let D=R.groups;for(let U=0,B=D.length;U<B;U++){let z=D[U],k=A[z.materialIndex];if(k&&k.visible){let G=y(S,k,C,b);S.onBeforeShadow(r,S,w,T,R,G,z),r.renderBufferDirect(T,null,R,G,S,z),S.onAfterShadow(r,S,w,T,R,G,z)}}}else if(A.visible){let D=y(S,A,C,b);S.onBeforeShadow(r,S,w,T,R,D,null),r.renderBufferDirect(T,null,R,D,S,null),S.onAfterShadow(r,S,w,T,R,D,null)}}let I=S.children;for(let R=0,A=I.length;R<A;R++)x(I[R],w,T,C,b)}function M(S){S.target.removeEventListener("dispose",M);for(let T in u){let C=u[T],b=S.target.uuid;b in C&&(C[b].dispose(),delete C[b])}}}function wie(r,e,t){let i=t.isWebGL2;function n(){let X=!1,Te=new ni,te=null,Me=new ni(0,0,0,0);return{setMask:function(Pe){te!==Pe&&!X&&(r.colorMask(Pe,Pe,Pe,Pe),te=Pe)},setLocked:function(Pe){X=Pe},setClear:function(Pe,xt,Ft,Mr,jr){jr===!0&&(Pe*=Mr,xt*=Mr,Ft*=Mr),Te.set(Pe,xt,Ft,Mr),Me.equals(Te)===!1&&(r.clearColor(Pe,xt,Ft,Mr),Me.copy(Te))},reset:function(){X=!1,te=null,Me.set(-1,0,0,0)}}}function a(){let X=!1,Te=null,te=null,Me=null;return{setTest:function(Pe){Pe?se(r.DEPTH_TEST):Ee(r.DEPTH_TEST)},setMask:function(Pe){Te!==Pe&&!X&&(r.depthMask(Pe),Te=Pe)},setFunc:function(Pe){if(te!==Pe){switch(Pe){case H$:r.depthFunc(r.NEVER);break;case W$:r.depthFunc(r.ALWAYS);break;case X$:r.depthFunc(r.LESS);break;case cg:r.depthFunc(r.LEQUAL);break;case Y$:r.depthFunc(r.EQUAL);break;case q$:r.depthFunc(r.GEQUAL);break;case Z$:r.depthFunc(r.GREATER);break;case j$:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}te=Pe}},setLocked:function(Pe){X=Pe},setClear:function(Pe){Me!==Pe&&(r.clearDepth(Pe),Me=Pe)},reset:function(){X=!1,Te=null,te=null,Me=null}}}function o(){let X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,Ft=null,Mr=null,jr=null;return{setTest:function(Vt){X||(Vt?se(r.STENCIL_TEST):Ee(r.STENCIL_TEST))},setMask:function(Vt){Te!==Vt&&!X&&(r.stencilMask(Vt),Te=Vt)},setFunc:function(Vt,Lr,si){(te!==Vt||Me!==Lr||Pe!==si)&&(r.stencilFunc(Vt,Lr,si),te=Vt,Me=Lr,Pe=si)},setOp:function(Vt,Lr,si){(xt!==Vt||Ft!==Lr||Mr!==si)&&(r.stencilOp(Vt,Lr,si),xt=Vt,Ft=Lr,Mr=si)},setLocked:function(Vt){X=Vt},setClear:function(Vt){jr!==Vt&&(r.clearStencil(Vt),jr=Vt)},reset:function(){X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,Ft=null,Mr=null,jr=null}}}let s=new n,l=new a,u=new o,c=new WeakMap,f=new WeakMap,h={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new ir(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,B=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),z=!1,k=0,G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),z=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),z=k>=2);let Y=null,J={},Q=r.getParameter(r.SCISSOR_BOX),V=r.getParameter(r.VIEWPORT),K=new ni().fromArray(Q),ae=new ni().fromArray(V);function ve(X,Te,te,Me){let Pe=new Uint8Array(4),xt=r.createTexture();r.bindTexture(X,xt),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ft=0;Ft<te;Ft++)i&&(X===r.TEXTURE_3D||X===r.TEXTURE_2D_ARRAY)?r.texImage3D(Te,0,r.RGBA,1,1,Me,0,r.RGBA,r.UNSIGNED_BYTE,Pe):r.texImage2D(Te+Ft,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Pe);return xt}let ue={};ue[r.TEXTURE_2D]=ve(r.TEXTURE_2D,r.TEXTURE_2D,1),ue[r.TEXTURE_CUBE_MAP]=ve(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(ue[r.TEXTURE_2D_ARRAY]=ve(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ue[r.TEXTURE_3D]=ve(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),s.setClear(0,0,0,1),l.setClear(1),u.setClear(0),se(r.DEPTH_TEST),l.setFunc(cg),Ne(!1),Ve(Y3),se(r.CULL_FACE),Le(vs);function se(X){h[X]!==!0&&(r.enable(X),h[X]=!0)}function Ee(X){h[X]!==!1&&(r.disable(X),h[X]=!1)}function q(X,Te){return p[X]!==Te?(r.bindFramebuffer(X,Te),p[X]=Te,i&&(X===r.DRAW_FRAMEBUFFER&&(p[r.FRAMEBUFFER]=Te),X===r.FRAMEBUFFER&&(p[r.DRAW_FRAMEBUFFER]=Te)),!0):!1}function H(X,Te){let te=g,Me=!1;if(X){te=d.get(Te),te===void 0&&(te=[],d.set(Te,te));let Pe=X.textures;if(te.length!==Pe.length||te[0]!==r.COLOR_ATTACHMENT0){for(let xt=0,Ft=Pe.length;xt<Ft;xt++)te[xt]=r.COLOR_ATTACHMENT0+xt;te.length=Pe.length,Me=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,Me=!0);if(Me)if(t.isWebGL2)r.drawBuffers(te);else if(e.has("WEBGL_draw_buffers")===!0)e.get("WEBGL_draw_buffers").drawBuffersWEBGL(te);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function We(X){return m!==X?(r.useProgram(X),m=X,!0):!1}let _e={[Yu]:r.FUNC_ADD,[C$]:r.FUNC_SUBTRACT,[R$]:r.FUNC_REVERSE_SUBTRACT};if(i)_e[K3]=r.MIN,_e[J3]=r.MAX;else{let X=e.get("EXT_blend_minmax");X!==null&&(_e[K3]=X.MIN_EXT,_e[J3]=X.MAX_EXT)}let xe={[L$]:r.ZERO,[P$]:r.ONE,[D$]:r.SRC_COLOR,[nS]:r.SRC_ALPHA,[F$]:r.SRC_ALPHA_SATURATE,[O$]:r.DST_COLOR,[N$]:r.DST_ALPHA,[I$]:r.ONE_MINUS_SRC_COLOR,[aS]:r.ONE_MINUS_SRC_ALPHA,[z$]:r.ONE_MINUS_DST_COLOR,[U$]:r.ONE_MINUS_DST_ALPHA,[B$]:r.CONSTANT_COLOR,[k$]:r.ONE_MINUS_CONSTANT_COLOR,[V$]:r.CONSTANT_ALPHA,[G$]:r.ONE_MINUS_CONSTANT_ALPHA};function Le(X,Te,te,Me,Pe,xt,Ft,Mr,jr,Vt){if(X===vs){v===!0&&(Ee(r.BLEND),v=!1);return}if(v===!1&&(se(r.BLEND),v=!0),X!==A$){if(X!==_||Vt!==E){if((y!==Yu||S!==Yu)&&(r.blendEquation(r.FUNC_ADD),y=Yu,S=Yu),Vt)switch(X){case Xu:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case q3:r.blendFunc(r.ONE,r.ONE);break;case Z3:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case j3:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}else switch(X){case Xu:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case q3:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Z3:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case j3:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}x=null,M=null,w=null,T=null,C.set(0,0,0),b=0,_=X,E=Vt}return}Pe=Pe||Te,xt=xt||te,Ft=Ft||Me,(Te!==y||Pe!==S)&&(r.blendEquationSeparate(_e[Te],_e[Pe]),y=Te,S=Pe),(te!==x||Me!==M||xt!==w||Ft!==T)&&(r.blendFuncSeparate(xe[te],xe[Me],xe[xt],xe[Ft]),x=te,M=Me,w=xt,T=Ft),(Mr.equals(C)===!1||jr!==b)&&(r.blendColor(Mr.r,Mr.g,Mr.b,jr),C.copy(Mr),b=jr),_=X,E=!1}function Ue(X,Te){X.side===Co?Ee(r.CULL_FACE):se(r.CULL_FACE);let te=X.side===_i;Te&&(te=!te),Ne(te),X.blending===Xu&&X.transparent===!1?Le(vs):Le(X.blending,X.blendEquation,X.blendSrc,X.blendDst,X.blendEquationAlpha,X.blendSrcAlpha,X.blendDstAlpha,X.blendColor,X.blendAlpha,X.premultipliedAlpha),l.setFunc(X.depthFunc),l.setTest(X.depthTest),l.setMask(X.depthWrite),s.setMask(X.colorWrite);let Me=X.stencilWrite;u.setTest(Me),Me&&(u.setMask(X.stencilWriteMask),u.setFunc(X.stencilFunc,X.stencilRef,X.stencilFuncMask),u.setOp(X.stencilFail,X.stencilZFail,X.stencilZPass)),F(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),X.alphaToCoverage===!0?se(r.SAMPLE_ALPHA_TO_COVERAGE):Ee(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(X){I!==X&&(X?r.frontFace(r.CW):r.frontFace(r.CCW),I=X)}function Ve(X){X!==w$?(se(r.CULL_FACE),X!==R&&(X===Y3?r.cullFace(r.BACK):X===T$?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ee(r.CULL_FACE),R=X}function ct(X){X!==A&&(z&&r.lineWidth(X),A=X)}function F(X,Te,te){X?(se(r.POLYGON_OFFSET_FILL),(D!==Te||U!==te)&&(r.polygonOffset(Te,te),D=Te,U=te)):Ee(r.POLYGON_OFFSET_FILL)}function L(X){X?se(r.SCISSOR_TEST):Ee(r.SCISSOR_TEST)}function ne(X){X===void 0&&(X=r.TEXTURE0+B-1),Y!==X&&(r.activeTexture(X),Y=X)}function le(X,Te,te){te===void 0&&(Y===null?te=r.TEXTURE0+B-1:te=Y);let Me=J[te];Me===void 0&&(Me={type:void 0,texture:void 0},J[te]=Me),(Me.type!==X||Me.texture!==Te)&&(Y!==te&&(r.activeTexture(te),Y=te),r.bindTexture(X,Te||ue[X]),Me.type=X,Me.texture=Te)}function me(){let X=J[Y];X!==void 0&&X.type!==void 0&&(r.bindTexture(X.type,null),X.type=void 0,X.texture=void 0)}function he(){try{r.compressedTexImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function et(){try{r.compressedTexImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ke(){try{r.texSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Se(){try{r.texSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ae(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function nt(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function $(){try{r.texStorage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function it(){try{r.texStorage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Xe(){try{r.texImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Fe(){try{r.texImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function we(X){K.equals(X)===!1&&(r.scissor(X.x,X.y,X.z,X.w),K.copy(X))}function Ie(X){ae.equals(X)===!1&&(r.viewport(X.x,X.y,X.z,X.w),ae.copy(X))}function st(X,Te){let te=f.get(Te);te===void 0&&(te=new WeakMap,f.set(Te,te));let Me=te.get(X);Me===void 0&&(Me=r.getUniformBlockIndex(Te,X.name),te.set(X,Me))}function Je(X,Te){let Me=f.get(Te).get(X);c.get(Te)!==Me&&(r.uniformBlockBinding(Te,Me,X.__bindingPointIndex),c.set(Te,Me))}function kt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),i===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},Y=null,J={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new ir(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,K.set(0,0,r.canvas.width,r.canvas.height),ae.set(0,0,r.canvas.width,r.canvas.height),s.reset(),l.reset(),u.reset()}return{buffers:{color:s,depth:l,stencil:u},enable:se,disable:Ee,bindFramebuffer:q,drawBuffers:H,useProgram:We,setBlending:Le,setMaterial:Ue,setFlipSided:Ne,setCullFace:Ve,setLineWidth:ct,setPolygonOffset:F,setScissorTest:L,activeTexture:ne,bindTexture:le,unbindTexture:me,compressedTexImage2D:he,compressedTexImage3D:et,texImage2D:Xe,texImage3D:Fe,updateUBOMapping:st,uniformBlockBinding:Je,texStorage2D:$,texStorage3D:it,texSubImage2D:Ke,texSubImage3D:Se,compressedTexSubImage2D:Ae,compressedTexSubImage3D:nt,scissor:we,viewport:Ie,reset:kt}}function Tie(r,e,t,i,n,a,o){let s=n.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Kt,f=new WeakMap,h,p=new WeakMap,d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(F,L){return d?new OffscreenCanvas(F,L):yg("canvas")}function m(F,L,ne,le){let me=1,he=ct(F);if((he.width>le||he.height>le)&&(me=le/Math.max(he.width,he.height)),me<1||L===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){let et=L?hS:Math.floor,Ke=et(me*he.width),Se=et(me*he.height);h===void 0&&(h=g(Ke,Se));let Ae=ne?g(Ke,Se):h;return Ae.width=Ke,Ae.height=Se,Ae.getContext("2d").drawImage(F,0,0,Ke,Se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+Ke+"x"+Se+")."),Ae}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),F;return F}function v(F){let L=ct(F);return Cz(L.width)&&Cz(L.height)}function _(F){return s?!1:F.wrapS!==ya||F.wrapT!==ya||F.minFilter!==Bi&&F.minFilter!==Qi}function y(F,L){return F.generateMipmaps&&L&&F.minFilter!==Bi&&F.minFilter!==Qi}function x(F){r.generateMipmap(F)}function M(F,L,ne,le,me=!1){if(s===!1)return L;if(F!==null){if(r[F]!==void 0)return r[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let he=L;if(L===r.RED&&(ne===r.FLOAT&&(he=r.R32F),ne===r.HALF_FLOAT&&(he=r.R16F),ne===r.UNSIGNED_BYTE&&(he=r.R8)),L===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.R8UI),ne===r.UNSIGNED_SHORT&&(he=r.R16UI),ne===r.UNSIGNED_INT&&(he=r.R32UI),ne===r.BYTE&&(he=r.R8I),ne===r.SHORT&&(he=r.R16I),ne===r.INT&&(he=r.R32I)),L===r.RG&&(ne===r.FLOAT&&(he=r.RG32F),ne===r.HALF_FLOAT&&(he=r.RG16F),ne===r.UNSIGNED_BYTE&&(he=r.RG8)),L===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.RG8UI),ne===r.UNSIGNED_SHORT&&(he=r.RG16UI),ne===r.UNSIGNED_INT&&(he=r.RG32UI),ne===r.BYTE&&(he=r.RG8I),ne===r.SHORT&&(he=r.RG16I),ne===r.INT&&(he=r.RG32I)),L===r.RGBA){let et=me?dg:Tr.getTransfer(le);ne===r.FLOAT&&(he=r.RGBA32F),ne===r.HALF_FLOAT&&(he=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(he=et===Hr?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(he=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(he=r.RGB5_A1)}return(he===r.R16F||he===r.R32F||he===r.RG16F||he===r.RG32F||he===r.RGBA16F||he===r.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function S(F,L,ne){return y(F,ne)===!0||F.isFramebufferTexture&&F.minFilter!==Bi&&F.minFilter!==Qi?Math.log2(Math.max(L.width,L.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?L.mipmaps.length:1}function w(F){return F===Bi||F===Q3||F===fg?r.NEAREST:r.LINEAR}function T(F){let L=F.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&f.delete(L)}function C(F){let L=F.target;L.removeEventListener("dispose",C),I(L)}function b(F){let L=i.get(F);if(L.__webglInit===void 0)return;let ne=F.source,le=p.get(ne);if(le){let me=le[L.__cacheKey];me.usedTimes--,me.usedTimes===0&&E(F),Object.keys(le).length===0&&p.delete(ne)}i.remove(F)}function E(F){let L=i.get(F);r.deleteTexture(L.__webglTexture);let ne=F.source,le=p.get(ne);delete le[L.__cacheKey],o.memory.textures--}function I(F){let L=i.get(F);if(F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let le=0;le<6;le++){if(Array.isArray(L.__webglFramebuffer[le]))for(let me=0;me<L.__webglFramebuffer[le].length;me++)r.deleteFramebuffer(L.__webglFramebuffer[le][me]);else r.deleteFramebuffer(L.__webglFramebuffer[le]);L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer[le])}else{if(Array.isArray(L.__webglFramebuffer))for(let le=0;le<L.__webglFramebuffer.length;le++)r.deleteFramebuffer(L.__webglFramebuffer[le]);else r.deleteFramebuffer(L.__webglFramebuffer);if(L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&r.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer)for(let le=0;le<L.__webglColorRenderbuffer.length;le++)L.__webglColorRenderbuffer[le]&&r.deleteRenderbuffer(L.__webglColorRenderbuffer[le]);L.__webglDepthRenderbuffer&&r.deleteRenderbuffer(L.__webglDepthRenderbuffer)}let ne=F.textures;for(let le=0,me=ne.length;le<me;le++){let he=i.get(ne[le]);he.__webglTexture&&(r.deleteTexture(he.__webglTexture),o.memory.textures--),i.remove(ne[le])}i.remove(F)}let R=0;function A(){R=0}function D(){let F=R;return F>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+n.maxTextures),R+=1,F}function U(F){let L=[];return L.push(F.wrapS),L.push(F.wrapT),L.push(F.wrapR||0),L.push(F.magFilter),L.push(F.minFilter),L.push(F.anisotropy),L.push(F.internalFormat),L.push(F.format),L.push(F.type),L.push(F.generateMipmaps),L.push(F.premultiplyAlpha),L.push(F.flipY),L.push(F.unpackAlignment),L.push(F.colorSpace),L.join()}function B(F,L){let ne=i.get(F);if(F.isVideoTexture&&Ne(F),F.isRenderTargetTexture===!1&&F.version>0&&ne.__version!==F.version){let le=F.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ae(ne,F,L);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+L)}function z(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+L)}function k(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+L)}function G(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ve(ne,F,L);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+L)}let Y={[lS]:r.REPEAT,[ya]:r.CLAMP_TO_EDGE,[uS]:r.MIRRORED_REPEAT},J={[Bi]:r.NEAREST,[Q3]:r.NEAREST_MIPMAP_NEAREST,[fg]:r.NEAREST_MIPMAP_LINEAR,[Qi]:r.LINEAR,[FE]:r.LINEAR_MIPMAP_NEAREST,[sl]:r.LINEAR_MIPMAP_LINEAR},Q={[gQ]:r.NEVER,[bQ]:r.ALWAYS,[yQ]:r.LESS,[JE]:r.LEQUAL,[_Q]:r.EQUAL,[MQ]:r.GEQUAL,[xQ]:r.GREATER,[SQ]:r.NOTEQUAL};function V(F,L,ne){if(L.type===ja&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===Qi||L.magFilter===FE||L.magFilter===fg||L.magFilter===sl||L.minFilter===Qi||L.minFilter===FE||L.minFilter===fg||L.minFilter===sl)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),ne?(r.texParameteri(F,r.TEXTURE_WRAP_S,Y[L.wrapS]),r.texParameteri(F,r.TEXTURE_WRAP_T,Y[L.wrapT]),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,Y[L.wrapR]),r.texParameteri(F,r.TEXTURE_MAG_FILTER,J[L.magFilter]),r.texParameteri(F,r.TEXTURE_MIN_FILTER,J[L.minFilter])):(r.texParameteri(F,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(F,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(L.wrapS!==ya||L.wrapT!==ya)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(F,r.TEXTURE_MAG_FILTER,w(L.magFilter)),r.texParameteri(F,r.TEXTURE_MIN_FILTER,w(L.minFilter)),L.minFilter!==Bi&&L.minFilter!==Qi&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),L.compareFunction&&(r.texParameteri(F,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(F,r.TEXTURE_COMPARE_FUNC,Q[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===Bi||L.minFilter!==fg&&L.minFilter!==sl||L.type===ja&&e.has("OES_texture_float_linear")===!1||s===!1&&L.type===qu&&e.has("OES_texture_half_float_linear")===!1)return;if(L.anisotropy>1||i.get(L).__currentAnisotropy){let le=e.get("EXT_texture_filter_anisotropic");r.texParameterf(F,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy}}}function K(F,L){let ne=!1;F.__webglInit===void 0&&(F.__webglInit=!0,L.addEventListener("dispose",T));let le=L.source,me=p.get(le);me===void 0&&(me={},p.set(le,me));let he=U(L);if(he!==F.__cacheKey){me[he]===void 0&&(me[he]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[he].usedTimes++;let et=me[F.__cacheKey];et!==void 0&&(me[F.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),F.__cacheKey=he,F.__webglTexture=me[he].texture}return ne}function ae(F,L,ne){let le=r.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(le=r.TEXTURE_2D_ARRAY),L.isData3DTexture&&(le=r.TEXTURE_3D);let me=K(F,L),he=L.source;t.bindTexture(le,F.__webglTexture,r.TEXTURE0+ne);let et=i.get(he);if(he.version!==et.__version||me===!0){t.activeTexture(r.TEXTURE0+ne);let Ke=Tr.getPrimaries(Tr.workingColorSpace),Se=L.colorSpace===_s?null:Tr.getPrimaries(L.colorSpace),Ae=L.colorSpace===_s||Ke===Se?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let nt=_(L)&&v(L.image)===!1,$=m(L.image,nt,!1,n.maxTextureSize);$=Ve(L,$);let it=v($)||s,Xe=a.convert(L.format,L.colorSpace),Fe=a.convert(L.type),we=M(L.internalFormat,Xe,Fe,L.colorSpace,L.isVideoTexture);V(le,L,it);let Ie,st=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==jE,kt=et.__version===void 0||me===!0,X=he.dataReady,Te=S(L,$,it);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===ja?we=r.DEPTH_COMPONENT32F:L.type===Lo?we=r.DEPTH_COMPONENT24:L.type===ys?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===ja&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===ll&&we===r.DEPTH_COMPONENT&&L.type!==hg&&L.type!==Lo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Lo,Fe=a.convert(L.type)),L.format===tu&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==ys&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=ys,Fe=a.convert(L.type))),kt&&(Je?t.texStorage2D(r.TEXTURE_2D,1,we,$.width,$.height):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,null));else if(L.isDataTexture)if(st.length>0&&it){Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data);L.generateMipmaps=!1}else Je?(kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height),X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,$.width,$.height,Xe,Fe,$.data)):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,$.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){Je&&kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,st[0].width,st[0].height,$.depth);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==Rn?Xe!==null?Je?X&&t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,Ie.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Ie.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,Fe,Ie.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Xe,Fe,Ie.data)}else{Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==Rn?Xe!==null?Je?X&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Ie.data):t.compressedTexImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data)}else if(L.isDataArrayTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,Xe,Fe,$.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isData3DTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_3D,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,Xe,Fe,$.data)):t.texImage3D(r.TEXTURE_3D,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isFramebufferTexture){if(kt)if(Je)t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height);else{let te=$.width,Me=$.height;for(let Pe=0;Pe<Te;Pe++)t.texImage2D(r.TEXTURE_2D,Pe,we,te,Me,0,Xe,Fe,null),te>>=1,Me>>=1}}else if(st.length>0&&it){if(Je&&kt){let te=ct(st[0]);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Xe,Fe,Ie):t.texImage2D(r.TEXTURE_2D,te,we,Xe,Fe,Ie);L.generateMipmaps=!1}else if(Je){if(kt){let te=ct($);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Xe,Fe,$)}else t.texImage2D(r.TEXTURE_2D,0,we,Xe,Fe,$);y(L,it)&&x(le),et.__version=he.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ve(F,L,ne){if(L.image.length!==6)return;let le=K(F,L),me=L.source;t.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+ne);let he=i.get(me);if(me.version!==he.__version||le===!0){t.activeTexture(r.TEXTURE0+ne);let et=Tr.getPrimaries(Tr.workingColorSpace),Ke=L.colorSpace===_s?null:Tr.getPrimaries(L.colorSpace),Se=L.colorSpace===_s||et===Ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);let Ae=L.isCompressedTexture||L.image[0].isCompressedTexture,nt=L.image[0]&&L.image[0].isDataTexture,$=[];for(let te=0;te<6;te++)!Ae&&!nt?$[te]=m(L.image[te],!1,!0,n.maxCubemapSize):$[te]=nt?L.image[te].image:L.image[te],$[te]=Ve(L,$[te]);let it=$[0],Xe=v(it)||s,Fe=a.convert(L.format,L.colorSpace),we=a.convert(L.type),Ie=M(L.internalFormat,Fe,we,L.colorSpace),st=s&&L.isVideoTexture!==!0,Je=he.__version===void 0||le===!0,kt=me.dataReady,X=S(L,it,Xe);V(r.TEXTURE_CUBE_MAP,L,Xe);let Te;if(Ae){st&&Je&&t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,it.width,it.height);for(let te=0;te<6;te++){Te=$[te].mipmaps;for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];L.format!==Rn?Fe!==null?st?kt&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,Fe,Pe.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,Pe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,Fe,we,Pe.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,Fe,we,Pe.data)}}}else{if(Te=L.mipmaps,st&&Je){Te.length>0&&X++;let te=ct($[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,te.width,te.height)}for(let te=0;te<6;te++)if(nt){st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,$[te].width,$[te].height,Fe,we,$[te].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,$[te].width,$[te].height,0,Fe,we,$[te].data);for(let Me=0;Me<Te.length;Me++){let xt=Te[Me].image[te].image;st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,xt.width,xt.height,Fe,we,xt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,xt.width,xt.height,0,Fe,we,xt.data)}}else{st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Fe,we,$[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,Fe,we,$[te]);for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,Fe,we,Pe.image[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,Fe,we,Pe.image[te])}}}y(L,Xe)&&x(r.TEXTURE_CUBE_MAP),he.__version=me.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ue(F,L,ne,le,me,he){let et=a.convert(ne.format,ne.colorSpace),Ke=a.convert(ne.type),Se=M(ne.internalFormat,et,Ke,ne.colorSpace);if(!i.get(L).__hasExternalTextures){let nt=Math.max(1,L.width>>he),$=Math.max(1,L.height>>he);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,he,Se,nt,$,L.depth,0,et,Ke,null):t.texImage2D(me,he,Se,nt,$,0,et,Ke,null)}t.bindFramebuffer(r.FRAMEBUFFER,F),Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,0,Le(L)):(me===r.TEXTURE_2D||me>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&me<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,he),t.bindFramebuffer(r.FRAMEBUFFER,null)}function se(F,L,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,F),L.depthBuffer&&!L.stencilBuffer){let le=s===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(ne||Ue(L)){let me=L.depthTexture;me&&me.isDepthTexture&&(me.type===ja?le=r.DEPTH_COMPONENT32F:me.type===Lo&&(le=r.DEPTH_COMPONENT24));let he=Le(L);Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,he,le,L.width,L.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,he,le,L.width,L.height)}else r.renderbufferStorage(r.RENDERBUFFER,le,L.width,L.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,F)}else if(L.depthBuffer&&L.stencilBuffer){let le=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,L.width,L.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,F)}else{let le=L.textures;for(let me=0;me<le.length;me++){let he=le[me],et=a.convert(he.format,he.colorSpace),Ke=a.convert(he.type),Se=M(he.internalFormat,et,Ke,he.colorSpace),Ae=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Ae,Se,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Ae,Se,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,Se,L.width,L.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ee(F,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,F),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),B(L.depthTexture,0);let le=i.get(L.depthTexture).__webglTexture,me=Le(L);if(L.depthTexture.format===ll)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0);else if(L.depthTexture.format===tu)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0);else throw new Error("Unknown depthTexture format")}function q(F){let L=i.get(F),ne=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!L.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");Ee(L.__webglFramebuffer,F)}else if(ne){L.__webglDepthbuffer=[];for(let le=0;le<6;le++)t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer[le]),L.__webglDepthbuffer[le]=r.createRenderbuffer(),se(L.__webglDepthbuffer[le],F,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),se(L.__webglDepthbuffer,F,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function H(F,L,ne){let le=i.get(F);L!==void 0&&ue(le.__webglFramebuffer,F,F.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&q(F)}function We(F){let L=F.texture,ne=i.get(F),le=i.get(L);F.addEventListener("dispose",C);let me=F.textures,he=F.isWebGLCubeRenderTarget===!0,et=me.length>1,Ke=v(F)||s;if(et||(le.__webglTexture===void 0&&(le.__webglTexture=r.createTexture()),le.__version=L.version,o.memory.textures++),he){ne.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer[Se]=[];for(let Ae=0;Ae<L.mipmaps.length;Ae++)ne.__webglFramebuffer[Se][Ae]=r.createFramebuffer()}else ne.__webglFramebuffer[Se]=r.createFramebuffer()}else{if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer=[];for(let Se=0;Se<L.mipmaps.length;Se++)ne.__webglFramebuffer[Se]=r.createFramebuffer()}else ne.__webglFramebuffer=r.createFramebuffer();if(et)if(n.drawBuffers)for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=i.get(me[Se]);nt.__webglTexture===void 0&&(nt.__webglTexture=r.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&F.samples>0&&Ue(F)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Se=0;Se<me.length;Se++){let Ae=me[Se];ne.__webglColorRenderbuffer[Se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se]);let nt=a.convert(Ae.format,Ae.colorSpace),$=a.convert(Ae.type),it=M(Ae.internalFormat,nt,$,Ae.colorSpace,F.isXRRenderTarget===!0),Xe=Le(F);r.renderbufferStorageMultisample(r.RENDERBUFFER,Xe,it,F.width,F.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),F.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),se(ne.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(he){t.bindTexture(r.TEXTURE_CUBE_MAP,le.__webglTexture),V(r.TEXTURE_CUBE_MAP,L,Ke);for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Se][Ae],F,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ae);else ue(ne.__webglFramebuffer[Se],F,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0);y(L,Ke)&&x(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(et){for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=me[Se],$=i.get(nt);t.bindTexture(r.TEXTURE_2D,$.__webglTexture),V(r.TEXTURE_2D,nt,Ke),ue(ne.__webglFramebuffer,F,nt,r.COLOR_ATTACHMENT0+Se,r.TEXTURE_2D,0),y(nt,Ke)&&x(r.TEXTURE_2D)}t.unbindTexture()}else{let Se=r.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(s?Se=F.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Se,le.__webglTexture),V(Se,L,Ke),s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Ae],F,L,r.COLOR_ATTACHMENT0,Se,Ae);else ue(ne.__webglFramebuffer,F,L,r.COLOR_ATTACHMENT0,Se,0);y(L,Ke)&&x(Se),t.unbindTexture()}F.depthBuffer&&q(F)}function _e(F){let L=v(F)||s,ne=F.textures;for(let le=0,me=ne.length;le<me;le++){let he=ne[le];if(y(he,L)){let et=F.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ke=i.get(he).__webglTexture;t.bindTexture(et,Ke),x(et),t.unbindTexture()}}}function xe(F){if(s&&F.samples>0&&Ue(F)===!1){let L=F.textures,ne=F.width,le=F.height,me=r.COLOR_BUFFER_BIT,he=[],et=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(F),Se=L.length>1;if(Se)for(let Ae=0;Ae<L.length;Ae++)t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let Ae=0;Ae<L.length;Ae++){he.push(r.COLOR_ATTACHMENT0+Ae),F.depthBuffer&&he.push(et);let nt=Ke.__ignoreDepthValues!==void 0?Ke.__ignoreDepthValues:!1;if(nt===!1&&(F.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),F.stencilBuffer&&(me|=r.STENCIL_BUFFER_BIT)),Se&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]),nt===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[et]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[et])),Se){let $=i.get(L[Ae]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,$,0)}r.blitFramebuffer(0,0,ne,le,0,0,ne,le,me,r.NEAREST),u&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,he)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Se)for(let Ae=0;Ae<L.length;Ae++){t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]);let nt=i.get(L[Ae]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,nt,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}}function Le(F){return Math.min(n.maxSamples,F.samples)}function Ue(F){let L=i.get(F);return s&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(F){let L=o.render.frame;f.get(F)!==L&&(f.set(F,L),F.update())}function Ve(F,L){let ne=F.colorSpace,le=F.format,me=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===cS||ne!==Ja&&ne!==_s&&(Tr.getTransfer(ne)===Hr?s===!1?e.has("EXT_sRGB")===!0&&le===Rn?(F.format=cS,F.minFilter=Qi,F.generateMipmaps=!1):L=xg.sRGBToLinear(L):(le!==Rn||me!==Ro)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),L}function ct(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=D,this.resetTextureUnits=A,this.setTexture2D=B,this.setTexture2DArray=z,this.setTexture3D=k,this.setTextureCube=G,this.rebindTextures=H,this.setupRenderTarget=We,this.updateRenderTargetMipmap=_e,this.updateMultisampleRenderTarget=xe,this.setupDepthRenderbuffer=q,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=Ue}function Eie(r,e,t){let i=t.isWebGL2;function n(a,o=_s){let s,l=Tr.getTransfer(o);if(a===Ro)return r.UNSIGNED_BYTE;if(a===kE)return r.UNSIGNED_SHORT_4_4_4_4;if(a===VE)return r.UNSIGNED_SHORT_5_5_5_1;if(a===aQ)return r.BYTE;if(a===oQ)return r.SHORT;if(a===hg)return r.UNSIGNED_SHORT;if(a===BE)return r.INT;if(a===Lo)return r.UNSIGNED_INT;if(a===ja)return r.FLOAT;if(a===qu)return i?r.HALF_FLOAT:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(a===sQ)return r.ALPHA;if(a===Rn)return r.RGBA;if(a===lQ)return r.LUMINANCE;if(a===uQ)return r.LUMINANCE_ALPHA;if(a===ll)return r.DEPTH_COMPONENT;if(a===tu)return r.DEPTH_STENCIL;if(a===cS)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===cQ)return r.RED;if(a===GE)return r.RED_INTEGER;if(a===fQ)return r.RG;if(a===HE)return r.RG_INTEGER;if(a===WE)return r.RGBA_INTEGER;if(a===XE||a===YE||a===qE||a===ZE)if(l===Hr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===XE)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===YE)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===qE)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===ZE)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===XE)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===YE)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===qE)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===ZE)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===ez||a===tz||a===rz||a===iz)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===ez)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===tz)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===rz)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===iz)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===jE)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===nz||a===az)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===nz)return l===Hr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===az)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===oz||a===sz||a===lz||a===uz||a===cz||a===fz||a===hz||a===pz||a===dz||a===mz||a===vz||a===gz||a===yz||a===_z)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===oz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===sz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===lz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===uz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===cz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===fz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===hz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===pz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===dz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===mz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===vz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===gz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===yz)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===_z)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===KE||a===xz||a===Sz)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===KE)return l===Hr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===xz)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===Sz)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===hQ||a===Mz||a===bz||a===wz)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===KE)return s.COMPRESSED_RED_RGTC1_EXT;if(a===Mz)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===bz)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===wz)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===ys?i?r.UNSIGNED_INT_24_8:(s=e.get("WEBGL_depth_texture"),s!==null?s.UNSIGNED_INT_24_8_WEBGL:null):r[a]!==void 0?r[a]:null}return{convert:n}}var NA=class extends Vi{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};var Ad=class extends tn{constructor(){super(),this.isGroup=!0,this.type="Group"}};var YEe={type:"move"},Zg=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ad,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ad,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new be,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new be),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ad,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new be,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new be),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let n=null,a=null,o=null,s=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(let g of e.hand.values()){let m=t.getJointPose(g,i),v=this._getHandJoint(u,g);m!==null&&(v.matrix.fromArray(m.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=m.radius),v.visible=m!==null}let c=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=c.position.distanceTo(f.position),p=.02,d=.005;u.inputState.pinching&&h>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=p-d&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(a=t.getPose(e.gripSpace,i),a!==null&&(l.matrix.fromArray(a.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,a.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(a.linearVelocity)):l.hasLinearVelocity=!1,a.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(a.angularVelocity)):l.hasAngularVelocity=!1));s!==null&&(n=t.getPose(e.targetRaySpace,i),n===null&&a!==null&&(n=a),n!==null&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(YEe)))}return s!==null&&(s.visible=n!==null),l!==null&&(l.visible=a!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new Ad;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}};var qEe=`
  6533. void main() {
  6534. gl_Position = vec4( position, 1.0 );
  6535. }`,ZEe=`
  6536. uniform sampler2DArray depthColor;
  6537. uniform float depthWidth;
  6538. uniform float depthHeight;
  6539. void main() {
  6540. vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
  6541. if ( coord.x >= 1.0 ) {
  6542. gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
  6543. } else {
  6544. gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
  6545. }
  6546. }`,UA=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let n=new eo,a=e.properties.get(n);a.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}render(e,t){if(this.texture!==null){if(this.mesh===null){let i=t.cameras[0].viewport,n=new Sa({extensions:{fragDepth:!0},vertexShader:qEe,fragmentShader:ZEe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new rn(new Vg(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}};var OA=class extends Qa{constructor(e,t){super();let i=this,n=null,a=1,o=null,s="local-floor",l=1,u=null,c=null,f=null,h=null,p=null,d=null,g=new UA,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new Kt,S=null,w=new Vi;w.layers.enable(1),w.viewport=new ni;let T=new Vi;T.layers.enable(2),T.viewport=new ni;let C=[w,T],b=new NA;b.layers.enable(1),b.layers.enable(2);let E=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let K=y[V];return K===void 0&&(K=new Zg,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new Zg,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new Zg,y[V]=K),K.getHandSpace()};function R(V){let K=x.indexOf(V.inputSource);if(K===-1)return;let ae=y[K];ae!==void 0&&(ae.update(V.inputSource,V.frame,u||o),ae.dispatchEvent({type:V.type,data:V.inputSource}))}function A(){n.removeEventListener("select",R),n.removeEventListener("selectstart",R),n.removeEventListener("selectend",R),n.removeEventListener("squeeze",R),n.removeEventListener("squeezestart",R),n.removeEventListener("squeezeend",R),n.removeEventListener("end",A),n.removeEventListener("inputsourceschange",D);for(let V=0;V<y.length;V++){let K=x[V];K!==null&&(x[V]=null,y[V].disconnect(K))}E=null,I=null,g.reset(),e.setRenderTarget(v),p=null,h=null,f=null,n=null,_=null,Q.stop(),i.isPresenting=!1,e.setPixelRatio(S),e.setSize(M.width,M.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){a=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){s=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||o},this.setReferenceSpace=function(V){u=V},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return f},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=function(V){return YM(this,null,function*(){if(n=V,n!==null){if(v=e.getRenderTarget(),n.addEventListener("select",R),n.addEventListener("selectstart",R),n.addEventListener("selectend",R),n.addEventListener("squeeze",R),n.addEventListener("squeezestart",R),n.addEventListener("squeezeend",R),n.addEventListener("end",A),n.addEventListener("inputsourceschange",D),m.xrCompatible!==!0&&(yield t.makeXRCompatible()),S=e.getPixelRatio(),e.getSize(M),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let K={antialias:n.renderState.layers===void 0?m.antialias:!0,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:a};p=new XRWebGLLayer(n,t,K),n.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),_=new to(p.framebufferWidth,p.framebufferHeight,{format:Rn,type:Ro,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let K=null,ae=null,ve=null;m.depth&&(ve=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,K=m.stencil?tu:ll,ae=m.stencil?ys:Lo);let ue={colorFormat:t.RGBA8,depthFormat:ve,scaleFactor:a};f=new XRWebGLBinding(n,t),h=f.createProjectionLayer(ue),n.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new to(h.textureWidth,h.textureHeight,{format:Rn,type:Ro,depthTexture:new Xg(h.textureWidth,h.textureHeight,ae,void 0,void 0,void 0,void 0,void 0,void 0,K),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});let se=e.properties.get(_);se.__ignoreDepthValues=h.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(l),u=null,o=yield n.requestReferenceSpace(s),Q.setContext(n),Q.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(n!==null)return n.environmentBlendMode};function D(V){for(let K=0;K<V.removed.length;K++){let ae=V.removed[K],ve=x.indexOf(ae);ve>=0&&(x[ve]=null,y[ve].disconnect(ae))}for(let K=0;K<V.added.length;K++){let ae=V.added[K],ve=x.indexOf(ae);if(ve===-1){for(let se=0;se<y.length;se++)if(se>=x.length){x.push(ae),ve=se;break}else if(x[se]===null){x[se]=ae,ve=se;break}if(ve===-1)break}let ue=y[ve];ue&&ue.connect(ae)}}let U=new be,B=new be;function z(V,K,ae){U.setFromMatrixPosition(K.matrixWorld),B.setFromMatrixPosition(ae.matrixWorld);let ve=U.distanceTo(B),ue=K.projectionMatrix.elements,se=ae.projectionMatrix.elements,Ee=ue[14]/(ue[10]-1),q=ue[14]/(ue[10]+1),H=(ue[9]+1)/ue[5],We=(ue[9]-1)/ue[5],_e=(ue[8]-1)/ue[0],xe=(se[8]+1)/se[0],Le=Ee*_e,Ue=Ee*xe,Ne=ve/(-_e+xe),Ve=Ne*-_e;K.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(Ve),V.translateZ(Ne),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();let ct=Ee+Ne,F=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/F*ct,me=We*q/F*ct;V.projectionMatrix.makePerspective(L,ne,le,me,ct,F),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function k(V,K){K===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(K.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(n===null)return;g.texture!==null&&(V.near=g.depthNear,V.far=g.depthFar),b.near=T.near=w.near=V.near,b.far=T.far=w.far=V.far,(E!==b.near||I!==b.far)&&(n.updateRenderState({depthNear:b.near,depthFar:b.far}),E=b.near,I=b.far,w.near=E,w.far=I,T.near=E,T.far=I,w.updateProjectionMatrix(),T.updateProjectionMatrix(),V.updateProjectionMatrix());let K=V.parent,ae=b.cameras;k(b,K);for(let ve=0;ve<ae.length;ve++)k(ae[ve],K);ae.length===2?z(b,w,T):b.projectionMatrix.copy(w.projectionMatrix),G(V,b,K)};function G(V,K,ae){ae===null?V.matrix.copy(K.matrixWorld):(V.matrix.copy(ae.matrixWorld),V.matrix.invert(),V.matrix.multiply(K.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0),V.projectionMatrix.copy(K.projectionMatrix),V.projectionMatrixInverse.copy(K.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=fS*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return b},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(V){l=V,h!==null&&(h.fixedFoveation=V),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=V)},this.hasDepthSensing=function(){return g.texture!==null};let Y=null;function J(V,K){if(c=K.getViewerPose(u||o),d=K,c!==null){let ae=c.views;p!==null&&(e.setRenderTargetFramebuffer(_,p.framebuffer),e.setRenderTarget(_));let ve=!1;ae.length!==b.cameras.length&&(b.cameras.length=0,ve=!0);for(let se=0;se<ae.length;se++){let Ee=ae[se],q=null;if(p!==null)q=p.getViewport(Ee);else{let We=f.getViewSubImage(h,Ee);q=We.viewport,se===0&&(e.setRenderTargetTextures(_,We.colorTexture,h.ignoreDepthValues?void 0:We.depthStencilTexture),e.setRenderTarget(_))}let H=C[se];H===void 0&&(H=new Vi,H.layers.enable(se),H.viewport=new ni,C[se]=H),H.matrix.fromArray(Ee.transform.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale),H.projectionMatrix.fromArray(Ee.projectionMatrix),H.projectionMatrixInverse.copy(H.projectionMatrix).invert(),H.viewport.set(q.x,q.y,q.width,q.height),se===0&&(b.matrix.copy(H.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale)),ve===!0&&b.cameras.push(H)}let ue=n.enabledFeatures;if(ue&&ue.includes("depth-sensing")){let se=f.getDepthInformation(ae[0]);se&&se.isValid&&se.texture&&g.init(e,se,n.renderState)}}for(let ae=0;ae<y.length;ae++){let ve=x[ae],ue=y[ae];ve!==null&&ue!==void 0&&ue.update(ve,K,u||o)}g.render(e,b),Y&&Y(V,K),K.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:K}),d=null}let Q=new AA;Q.setAnimationLoop(J),this.setAnimationLoop=function(V){Y=V},this.dispose=function(){}}};var Cd=new fl,jEe=new Wr;function Aie(r,e){function t(m,v){m.matrixAutoUpdate===!0&&m.updateMatrix(),v.value.copy(m.matrix)}function i(m,v){v.color.getRGB(m.fogColor.value,bA(r)),v.isFog?(m.fogNear.value=v.near,m.fogFar.value=v.far):v.isFogExp2&&(m.fogDensity.value=v.density)}function n(m,v,_,y,x){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(m,v):v.isMeshToonMaterial?(a(m,v),f(m,v)):v.isMeshPhongMaterial?(a(m,v),c(m,v)):v.isMeshStandardMaterial?(a(m,v),h(m,v),v.isMeshPhysicalMaterial&&p(m,v,x)):v.isMeshMatcapMaterial?(a(m,v),d(m,v)):v.isMeshDepthMaterial?a(m,v):v.isMeshDistanceMaterial?(a(m,v),g(m,v)):v.isMeshNormalMaterial?a(m,v):v.isLineBasicMaterial?(o(m,v),v.isLineDashedMaterial&&s(m,v)):v.isPointsMaterial?l(m,v,_,y):v.isSpriteMaterial?u(m,v):v.isShadowMaterial?(m.color.value.copy(v.color),m.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(m,v){m.opacity.value=v.opacity,v.color&&m.diffuse.value.copy(v.color),v.emissive&&m.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.bumpMap&&(m.bumpMap.value=v.bumpMap,t(v.bumpMap,m.bumpMapTransform),m.bumpScale.value=v.bumpScale,v.side===_i&&(m.bumpScale.value*=-1)),v.normalMap&&(m.normalMap.value=v.normalMap,t(v.normalMap,m.normalMapTransform),m.normalScale.value.copy(v.normalScale),v.side===_i&&m.normalScale.value.negate()),v.displacementMap&&(m.displacementMap.value=v.displacementMap,t(v.displacementMap,m.displacementMapTransform),m.displacementScale.value=v.displacementScale,m.displacementBias.value=v.displacementBias),v.emissiveMap&&(m.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,m.emissiveMapTransform)),v.specularMap&&(m.specularMap.value=v.specularMap,t(v.specularMap,m.specularMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest);let _=e.get(v),y=_.envMap,x=_.envMapRotation;if(y&&(m.envMap.value=y,Cd.copy(x),Cd.x*=-1,Cd.y*=-1,Cd.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Cd.y*=-1,Cd.z*=-1),m.envMapRotation.value.setFromMatrix4(jEe.makeRotationFromEuler(Cd)),m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=v.reflectivity,m.ior.value=v.ior,m.refractionRatio.value=v.refractionRatio),v.lightMap){m.lightMap.value=v.lightMap;let M=r._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=v.lightMapIntensity*M,t(v.lightMap,m.lightMapTransform)}v.aoMap&&(m.aoMap.value=v.aoMap,m.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,m.aoMapTransform))}function o(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform))}function s(m,v){m.dashSize.value=v.dashSize,m.totalSize.value=v.dashSize+v.gapSize,m.scale.value=v.scale}function l(m,v,_,y){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.size.value=v.size*_,m.scale.value=y*.5,v.map&&(m.map.value=v.map,t(v.map,m.uvTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function u(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.rotation.value=v.rotation,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function c(m,v){m.specular.value.copy(v.specular),m.shininess.value=Math.max(v.shininess,1e-4)}function f(m,v){v.gradientMap&&(m.gradientMap.value=v.gradientMap)}function h(m,v){m.metalness.value=v.metalness,v.metalnessMap&&(m.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,m.metalnessMapTransform)),m.roughness.value=v.roughness,v.roughnessMap&&(m.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,m.roughnessMapTransform)),e.get(v).envMap&&(m.envMapIntensity.value=v.envMapIntensity)}function p(m,v,_){m.ior.value=v.ior,v.sheen>0&&(m.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),m.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(m.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,m.sheenColorMapTransform)),v.sheenRoughnessMap&&(m.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,m.sheenRoughnessMapTransform))),v.clearcoat>0&&(m.clearcoat.value=v.clearcoat,m.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(m.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,m.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(m.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===_i&&m.clearcoatNormalScale.value.negate())),v.iridescence>0&&(m.iridescence.value=v.iridescence,m.iridescenceIOR.value=v.iridescenceIOR,m.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(m.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,m.iridescenceMapTransform)),v.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),v.transmission>0&&(m.transmission.value=v.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(m.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,m.transmissionMapTransform)),m.thickness.value=v.thickness,v.thicknessMap&&(m.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=v.attenuationDistance,m.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(m.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(m.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=v.specularIntensity,m.specularColor.value.copy(v.specularColor),v.specularColorMap&&(m.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,m.specularColorMapTransform)),v.specularIntensityMap&&(m.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,m.specularIntensityMapTransform))}function d(m,v){v.matcap&&(m.matcap.value=v.matcap)}function g(m,v){let _=e.get(v).light;m.referencePosition.value.setFromMatrixPosition(_.matrixWorld),m.nearDistance.value=_.shadow.camera.near,m.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function Cie(r,e,t,i){let n={},a={},o=[],s=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,y){let x=y.program;i.uniformBlockBinding(_,x)}function u(_,y){let x=n[_.id];x===void 0&&(d(_),x=c(_),n[_.id]=x,_.addEventListener("dispose",m));let M=y.program;i.updateUBOMapping(_,M);let S=e.render.frame;a[_.id]!==S&&(h(_),a[_.id]=S)}function c(_){let y=f();_.__bindingPointIndex=y;let x=r.createBuffer(),M=_.__size,S=_.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,M,S),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function f(){for(let _=0;_<s;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(_){let y=n[_.id],x=_.uniforms,M=_.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let S=0,w=x.length;S<w;S++){let T=Array.isArray(x[S])?x[S]:[x[S]];for(let C=0,b=T.length;C<b;C++){let E=T[C];if(p(E,S,C,M)===!0){let I=E.__offset,R=Array.isArray(E.value)?E.value:[E.value],A=0;for(let D=0;D<R.length;D++){let U=R[D],B=g(U);typeof U=="number"||typeof U=="boolean"?(E.__data[0]=U,r.bufferSubData(r.UNIFORM_BUFFER,I+A,E.__data)):U.isMatrix3?(E.__data[0]=U.elements[0],E.__data[1]=U.elements[1],E.__data[2]=U.elements[2],E.__data[3]=0,E.__data[4]=U.elements[3],E.__data[5]=U.elements[4],E.__data[6]=U.elements[5],E.__data[7]=0,E.__data[8]=U.elements[6],E.__data[9]=U.elements[7],E.__data[10]=U.elements[8],E.__data[11]=0):(U.toArray(E.__data,A),A+=B.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,I,E.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function p(_,y,x,M){let S=_.value,w=y+"_"+x;if(M[w]===void 0)return typeof S=="number"||typeof S=="boolean"?M[w]=S:M[w]=S.clone(),!0;{let T=M[w];if(typeof S=="number"||typeof S=="boolean"){if(T!==S)return M[w]=S,!0}else if(T.equals(S)===!1)return T.copy(S),!0}return!1}function d(_){let y=_.uniforms,x=0,M=16;for(let w=0,T=y.length;w<T;w++){let C=Array.isArray(y[w])?y[w]:[y[w]];for(let b=0,E=C.length;b<E;b++){let I=C[b],R=Array.isArray(I.value)?I.value:[I.value];for(let A=0,D=R.length;A<D;A++){let U=R[A],B=g(U),z=x%M;z!==0&&M-z<B.boundary&&(x+=M-z),I.__data=new Float32Array(B.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=x,x+=B.storage}}}let S=x%M;return S>0&&(x+=M-S),_.__size=x,_.__cache={},this}function g(_){let y={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(y.boundary=4,y.storage=4):_.isVector2?(y.boundary=8,y.storage=8):_.isVector3||_.isColor?(y.boundary=16,y.storage=12):_.isVector4?(y.boundary=16,y.storage=16):_.isMatrix3?(y.boundary=48,y.storage=48):_.isMatrix4?(y.boundary=64,y.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),y}function m(_){let y=_.target;y.removeEventListener("dispose",m);let x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(n[y.id]),delete n[y.id],delete a[y.id]}function v(){for(let _ in n)r.deleteBuffer(n[_]);o=[],n={},a={}}return{bind:l,update:u,dispose:v}}var yS=class{constructor(e={}){let{canvas:t=EQ(),context:i=null,depth:n=!0,stencil:a=!0,alpha:o=!1,antialias:s=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;i!==null?h=i.getContextAttributes().alpha:h=o;let p=new Uint32Array(4),d=new Int32Array(4),g=null,m=null,v=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ka,this._useLegacyLights=!1,this.toneMapping=gs,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new ni,E=new ni,I=null,R=new ir(0),A=0,D=t.width,U=t.height,B=1,z=null,k=null,G=new ni(0,0,D,U),Y=new ni(0,0,D,U),J=!1,Q=new yh,V=!1,K=!1,ae=null,ve=new Wr,ue=new Kt,se=new be,Ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return w===null?B:1}let H=i;function We(O,j){for(let re=0;re<O.length;re++){let ie=O[re],P=t.getContext(ie,j);if(P!==null)return P}return null}try{let O={alpha:!0,depth:n,stencil:a,antialias:s,premultipliedAlpha:l,preserveDrawingBuffer:u,powerPreference:c,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${iS}`),t.addEventListener("webglcontextlost",kt,!1),t.addEventListener("webglcontextrestored",X,!1),t.addEventListener("webglcontextcreationerror",Te,!1),H===null){let j=["webgl2","webgl","experimental-webgl"];if(y.isWebGL1Renderer===!0&&j.shift(),H=We(j,O),H===null)throw We(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&H instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),H.getShaderPrecisionFormat===void 0&&(H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(O){throw console.error("THREE.WebGLRenderer: "+O.message),O}let _e,xe,Le,Ue,Ne,Ve,ct,F,L,ne,le,me,he,et,Ke,Se,Ae,nt,$,it,Xe,Fe,we,Ie;function st(){_e=new Wre(H),xe=new Nre(H,_e,e),_e.init(xe),Fe=new Eie(H,_e,xe),Le=new wie(H,_e,xe),Ue=new qre(H),Ne=new die,Ve=new Tie(H,_e,Le,Ne,xe,Fe,Ue),ct=new Ore(y),F=new Hre(y),L=new KQ(H,xe),we=new Dre(H,_e,L,xe),ne=new Xre(H,L,Ue,we),le=new jre(H,ne,L,Ue),$=new Zre(H,xe,Ve),Se=new Ure(Ne),me=new pie(y,ct,F,_e,xe,we,Se),he=new Aie(y,Ne),et=new gie,Ke=new xie(_e,xe),nt=new Pre(y,ct,F,Le,le,h,l),Ae=new bie(y,le,xe),Ie=new Cie(H,Ue,xe,Le),it=new Ire(H,_e,Ue,xe),Xe=new Yre(H,_e,Ue,xe),Ue.programs=me.programs,y.capabilities=xe,y.extensions=_e,y.properties=Ne,y.renderLists=et,y.shadowMap=Ae,y.state=Le,y.info=Ue}st();let Je=new OA(y,H);this.xr=Je,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){let O=_e.get("WEBGL_lose_context");O&&O.loseContext()},this.forceContextRestore=function(){let O=_e.get("WEBGL_lose_context");O&&O.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(O){O!==void 0&&(B=O,this.setSize(D,U,!1))},this.getSize=function(O){return O.set(D,U)},this.setSize=function(O,j,re=!0){if(Je.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}D=O,U=j,t.width=Math.floor(O*B),t.height=Math.floor(j*B),re===!0&&(t.style.width=O+"px",t.style.height=j+"px"),this.setViewport(0,0,O,j)},this.getDrawingBufferSize=function(O){return O.set(D*B,U*B).floor()},this.setDrawingBufferSize=function(O,j,re){D=O,U=j,B=re,t.width=Math.floor(O*re),t.height=Math.floor(j*re),this.setViewport(0,0,O,j)},this.getCurrentViewport=function(O){return O.copy(b)},this.getViewport=function(O){return O.copy(G)},this.setViewport=function(O,j,re,ie){O.isVector4?G.set(O.x,O.y,O.z,O.w):G.set(O,j,re,ie),Le.viewport(b.copy(G).multiplyScalar(B).round())},this.getScissor=function(O){return O.copy(Y)},this.setScissor=function(O,j,re,ie){O.isVector4?Y.set(O.x,O.y,O.z,O.w):Y.set(O,j,re,ie),Le.scissor(E.copy(Y).multiplyScalar(B).round())},this.getScissorTest=function(){return J},this.setScissorTest=function(O){Le.setScissorTest(J=O)},this.setOpaqueSort=function(O){z=O},this.setTransparentSort=function(O){k=O},this.getClearColor=function(O){return O.copy(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(O=!0,j=!0,re=!0){let ie=0;if(O){let P=!1;if(w!==null){let W=w.texture.format;P=W===WE||W===HE||W===GE}if(P){let W=w.texture.type,ee=W===Ro||W===Lo||W===hg||W===ys||W===kE||W===VE,ge=nt.getClearColor(),ce=nt.getClearAlpha(),Oe=ge.r,Ge=ge.g,Re=ge.b;ee?(p[0]=Oe,p[1]=Ge,p[2]=Re,p[3]=ce,H.clearBufferuiv(H.COLOR,0,p)):(d[0]=Oe,d[1]=Ge,d[2]=Re,d[3]=ce,H.clearBufferiv(H.COLOR,0,d))}else ie|=H.COLOR_BUFFER_BIT}j&&(ie|=H.DEPTH_BUFFER_BIT),re&&(ie|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",kt,!1),t.removeEventListener("webglcontextrestored",X,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),et.dispose(),Ke.dispose(),Ne.dispose(),ct.dispose(),F.dispose(),le.dispose(),we.dispose(),Ie.dispose(),me.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",jr),Je.removeEventListener("sessionend",Vt),ae&&(ae.dispose(),ae=null),Lr.stop()};function kt(O){O.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function X(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let O=Ue.autoReset,j=Ae.enabled,re=Ae.autoUpdate,ie=Ae.needsUpdate,P=Ae.type;st(),Ue.autoReset=O,Ae.enabled=j,Ae.autoUpdate=re,Ae.needsUpdate=ie,Ae.type=P}function Te(O){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",O.statusMessage)}function te(O){let j=O.target;j.removeEventListener("dispose",te),Me(j)}function Me(O){Pe(O),Ne.remove(O)}function Pe(O){let j=Ne.get(O).programs;j!==void 0&&(j.forEach(function(re){me.releaseProgram(re)}),O.isShaderMaterial&&me.releaseShaderCache(O))}this.renderBufferDirect=function(O,j,re,ie,P,W){j===null&&(j=Ee);let ee=P.isMesh&&P.matrixWorld.determinant()<0,ge=T0(O,j,re,ie,P);Le.setMaterial(ie,ee);let ce=re.index,Oe=1;if(ie.wireframe===!0){if(ce=ne.getWireframeAttribute(re),ce===void 0)return;Oe=2}let Ge=re.drawRange,Re=re.attributes.position,pt=Ge.start*Oe,mt=(Ge.start+Ge.count)*Oe;W!==null&&(pt=Math.max(pt,W.start*Oe),mt=Math.min(mt,(W.start+W.count)*Oe)),ce!==null?(pt=Math.max(pt,0),mt=Math.min(mt,ce.count)):Re!=null&&(pt=Math.max(pt,0),mt=Math.min(mt,Re.count));let $e=mt-pt;if($e<0||$e===1/0)return;we.setup(P,ie,ge,re,ce);let at,wt=it;if(ce!==null&&(at=L.get(ce),wt=Xe,wt.setIndex(at)),P.isMesh)ie.wireframe===!0?(Le.setLineWidth(ie.wireframeLinewidth*q()),wt.setMode(H.LINES)):wt.setMode(H.TRIANGLES);else if(P.isLine){let je=ie.linewidth;je===void 0&&(je=1),Le.setLineWidth(je*q()),P.isLineSegments?wt.setMode(H.LINES):P.isLineLoop?wt.setMode(H.LINE_LOOP):wt.setMode(H.LINE_STRIP)}else P.isPoints?wt.setMode(H.POINTS):P.isSprite&&wt.setMode(H.TRIANGLES);if(P.isBatchedMesh)wt.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else if(P.isInstancedMesh)wt.renderInstances(pt,$e,P.count);else if(re.isInstancedBufferGeometry){let je=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,mi=Math.min(re.instanceCount,je);wt.renderInstances(pt,$e,mi)}else wt.render(pt,$e)};function xt(O,j,re){O.transparent===!0&&O.side===Co&&O.forceSinglePass===!1?(O.side=_i,O.needsUpdate=!0,Go(O,j,re),O.side=Ao,O.needsUpdate=!0,Go(O,j,re),O.side=Co):Go(O,j,re)}this.compile=function(O,j,re=null){re===null&&(re=O),m=Ke.get(re),m.init(),_.push(m),re.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),O!==re&&O.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),m.setupLights(y._useLegacyLights);let ie=new Set;return O.traverse(function(P){let W=P.material;if(W)if(Array.isArray(W))for(let ee=0;ee<W.length;ee++){let ge=W[ee];xt(ge,re,P),ie.add(ge)}else xt(W,re,P),ie.add(W)}),_.pop(),m=null,ie},this.compileAsync=function(O,j,re=null){let ie=this.compile(O,j,re);return new Promise(P=>{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){P(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let Ft=null;function Mr(O){Ft&&Ft(O)}function jr(){Lr.stop()}function Vt(){Lr.start()}let Lr=new AA;Lr.setAnimationLoop(Mr),typeof self<"u"&&Lr.setContext(self),this.setAnimationLoop=function(O){Ft=O,Je.setAnimationLoop(O),O===null?Lr.stop():Lr.start()},Je.addEventListener("sessionstart",jr),Je.addEventListener("sessionend",Vt),this.render=function(O,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),Je.enabled===!0&&Je.isPresenting===!0&&(Je.cameraAutoUpdate===!0&&Je.updateCamera(j),j=Je.getCamera()),O.isScene===!0&&O.onBeforeRender(y,O,j,w),m=Ke.get(O,_.length),m.init(),_.push(m),ve.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),Q.setFromProjectionMatrix(ve),K=this.localClippingEnabled,V=Se.init(this.clippingPlanes,K),g=et.get(O,v.length),g.init(),v.push(g),si(O,j,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(z,k),this.info.render.frame++,V===!0&&Se.beginShadows();let re=m.state.shadowsArray;if(Ae.render(re,O,j),V===!0&&Se.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Je.enabled===!1||Je.isPresenting===!1||Je.hasDepthSensing()===!1)&&nt.render(g,O),m.setupLights(y._useLegacyLights),j.isArrayCamera){let ie=j.cameras;for(let P=0,W=ie.length;P<W;P++){let ee=ie[P];Zh(g,O,ee,ee.viewport)}}else Zh(g,O,j);w!==null&&(Ve.updateMultisampleRenderTarget(w),Ve.updateRenderTargetMipmap(w)),O.isScene===!0&&O.onAfterRender(y,O,j),we.resetDefaultState(),T=-1,C=null,_.pop(),_.length>0?m=_[_.length-1]:m=null,v.pop(),v.length>0?g=v[v.length-1]:g=null};function si(O,j,re,ie){if(O.visible===!1)return;if(O.layers.test(j.layers)){if(O.isGroup)re=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update(j);else if(O.isLight)m.pushLight(O),O.castShadow&&m.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||Q.intersectsSprite(O)){ie&&se.setFromMatrixPosition(O.matrixWorld).applyMatrix4(ve);let ee=le.update(O),ge=O.material;ge.visible&&g.push(O,ee,ge,re,se.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(!O.frustumCulled||Q.intersectsObject(O))){let ee=le.update(O),ge=O.material;if(ie&&(O.boundingSphere!==void 0?(O.boundingSphere===null&&O.computeBoundingSphere(),se.copy(O.boundingSphere.center)):(ee.boundingSphere===null&&ee.computeBoundingSphere(),se.copy(ee.boundingSphere.center)),se.applyMatrix4(O.matrixWorld).applyMatrix4(ve)),Array.isArray(ge)){let ce=ee.groups;for(let Oe=0,Ge=ce.length;Oe<Ge;Oe++){let Re=ce[Oe],pt=ge[Re.materialIndex];pt&&pt.visible&&g.push(O,ee,pt,re,se.z,Re)}}else ge.visible&&g.push(O,ee,ge,re,se.z,null)}}let W=O.children;for(let ee=0,ge=W.length;ee<ge;ee++)si(W[ee],j,re,ie)}function Zh(O,j,re,ie){let P=O.opaque,W=O.transmissive,ee=O.transparent;m.setupLightsView(re),V===!0&&Se.setGlobalState(y.clippingPlanes,re),W.length>0&&w0(P,W,j,re),ie&&Le.viewport(b.copy(ie)),P.length>0&&Is(P,j,re),W.length>0&&Is(W,j,re),ee.length>0&&Is(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function w0(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new to(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?qu:Ro,minFilter:sl,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(hS(ue.x),hS(ue.y));let ee=y.getRenderTarget();y.setRenderTarget(ae),y.getClearColor(R),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear();let ge=y.toneMapping;y.toneMapping=gs,Is(O,re,ie),Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae);let ce=!1;for(let Oe=0,Ge=j.length;Oe<Ge;Oe++){let Re=j[Oe],pt=Re.object,mt=Re.geometry,$e=Re.material,at=Re.group;if($e.side===Co&&pt.layers.test(ie.layers)){let wt=$e.side;$e.side=_i,$e.needsUpdate=!0,jh(pt,re,ie,mt,$e,at),$e.side=wt,$e.needsUpdate=!0,ce=!0}}ce===!0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),y.setRenderTarget(ee),y.setClearColor(R,A),y.toneMapping=ge}function Is(O,j,re){let ie=j.isScene===!0?j.overrideMaterial:null;for(let P=0,W=O.length;P<W;P++){let ee=O[P],ge=ee.object,ce=ee.geometry,Oe=ie===null?ee.material:ie,Ge=ee.group;ge.layers.test(re.layers)&&jh(ge,j,re,ce,Oe,Ge)}}function jh(O,j,re,ie,P,W){O.onBeforeRender(y,j,re,ie,P,W),O.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),P.onBeforeRender(y,j,re,ie,O,W),P.transparent===!0&&P.side===Co&&P.forceSinglePass===!1?(P.side=_i,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=Ao,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=Co):y.renderBufferDirect(re,j,ie,P,O,W),O.onAfterRender(y,j,re,ie,P,W)}function Go(O,j,re){j.isScene!==!0&&(j=Ee);let ie=Ne.get(O),P=m.state.lights,W=m.state.shadowsArray,ee=P.state.version,ge=me.getParameters(O,P.state,W,j,re),ce=me.getProgramCacheKey(ge),Oe=ie.programs;ie.environment=O.isMeshStandardMaterial?j.environment:null,ie.fog=j.fog,ie.envMap=(O.isMeshStandardMaterial?F:ct).get(O.envMap||ie.environment),ie.envMapRotation=ie.environment!==null&&O.envMap===null?j.environmentRotation:O.envMapRotation,Oe===void 0&&(O.addEventListener("dispose",te),Oe=new Map,ie.programs=Oe);let Ge=Oe.get(ce);if(Ge!==void 0){if(ie.currentProgram===Ge&&ie.lightsStateVersion===ee)return bc(O,ge),Ge}else ge.uniforms=me.getUniforms(O),O.onBuild(re,ge,y),O.onBeforeCompile(ge,y),Ge=me.acquireProgram(ge,ce),Oe.set(ce,Ge),ie.uniforms=ge.uniforms;let Re=ie.uniforms;return(!O.isShaderMaterial&&!O.isRawShaderMaterial||O.clipping===!0)&&(Re.clippingPlanes=Se.uniform),bc(O,ge),ie.needsLights=A0(O),ie.lightsStateVersion=ee,ie.needsLights&&(Re.ambientLightColor.value=P.state.ambient,Re.lightProbe.value=P.state.probe,Re.directionalLights.value=P.state.directional,Re.directionalLightShadows.value=P.state.directionalShadow,Re.spotLights.value=P.state.spot,Re.spotLightShadows.value=P.state.spotShadow,Re.rectAreaLights.value=P.state.rectArea,Re.ltc_1.value=P.state.rectAreaLTC1,Re.ltc_2.value=P.state.rectAreaLTC2,Re.pointLights.value=P.state.point,Re.pointLightShadows.value=P.state.pointShadow,Re.hemisphereLights.value=P.state.hemi,Re.directionalShadowMap.value=P.state.directionalShadowMap,Re.directionalShadowMatrix.value=P.state.directionalShadowMatrix,Re.spotShadowMap.value=P.state.spotShadowMap,Re.spotLightMatrix.value=P.state.spotLightMatrix,Re.spotLightMap.value=P.state.spotLightMap,Re.pointShadowMap.value=P.state.pointShadowMap,Re.pointShadowMatrix.value=P.state.pointShadowMatrix),ie.currentProgram=Ge,ie.uniformsList=null,Ge}function Kh(O){if(O.uniformsList===null){let j=O.currentProgram.getUniforms();O.uniformsList=_h.seqWithValue(j.seq,O.uniforms)}return O.uniformsList}function bc(O,j){let re=Ne.get(O);re.outputColorSpace=j.outputColorSpace,re.batching=j.batching,re.instancing=j.instancing,re.instancingColor=j.instancingColor,re.instancingMorph=j.instancingMorph,re.skinning=j.skinning,re.morphTargets=j.morphTargets,re.morphNormals=j.morphNormals,re.morphColors=j.morphColors,re.morphTargetsCount=j.morphTargetsCount,re.numClippingPlanes=j.numClippingPlanes,re.numIntersection=j.numClipIntersection,re.vertexAlphas=j.vertexAlphas,re.vertexTangents=j.vertexTangents,re.toneMapping=j.toneMapping}function T0(O,j,re,ie,P){j.isScene!==!0&&(j=Ee),Ve.resetTextureUnits();let W=j.fog,ee=ie.isMeshStandardMaterial?j.environment:null,ge=w===null?y.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:Ja,ce=(ie.isMeshStandardMaterial?F:ct).get(ie.envMap||ee),Oe=ie.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,Ge=!!re.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),Re=!!re.morphAttributes.position,pt=!!re.morphAttributes.normal,mt=!!re.morphAttributes.color,$e=gs;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let at=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,wt=at!==void 0?at.length:0,je=Ne.get(ie),mi=m.state.lights;if(V===!0&&(K===!0||O!==C)){let Kr=O===C&&ie.id===T;Se.setState(ie,O,Kr)}let Ut=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==mi.state.version||je.outputColorSpace!==ge||P.isBatchedMesh&&je.batching===!1||!P.isBatchedMesh&&je.batching===!0||P.isInstancedMesh&&je.instancing===!1||!P.isInstancedMesh&&je.instancing===!0||P.isSkinnedMesh&&je.skinning===!1||!P.isSkinnedMesh&&je.skinning===!0||P.isInstancedMesh&&je.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&je.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&je.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&je.instancingMorph===!1&&P.morphTexture!==null||je.envMap!==ce||ie.fog===!0&&je.fog!==W||je.numClippingPlanes!==void 0&&(je.numClippingPlanes!==Se.numPlanes||je.numIntersection!==Se.numIntersection)||je.vertexAlphas!==Oe||je.vertexTangents!==Ge||je.morphTargets!==Re||je.morphNormals!==pt||je.morphColors!==mt||je.toneMapping!==$e||xe.isWebGL2===!0&&je.morphTargetsCount!==wt)&&(Ut=!0):(Ut=!0,je.__version=ie.version);let Cr=je.currentProgram;Ut===!0&&(Cr=Go(ie,j,P));let Hi=!1,Mt=!1,Mi=!1,lr=Cr.getUniforms(),un=je.uniforms;if(Le.useProgram(Cr.program)&&(Hi=!0,Mt=!0,Mi=!0),ie.id!==T&&(T=ie.id,Mt=!0),Hi||C!==O){lr.setValue(H,"projectionMatrix",O.projectionMatrix),lr.setValue(H,"viewMatrix",O.matrixWorldInverse);let Kr=lr.map.cameraPosition;Kr!==void 0&&Kr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&lr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&lr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,Mt=!0,Mi=!0)}if(P.isSkinnedMesh){lr.setOptional(H,P,"bindMatrix"),lr.setOptional(H,P,"bindMatrixInverse");let Kr=P.skeleton;Kr&&(xe.floatVertexTextures?(Kr.boneTexture===null&&Kr.computeBoneTexture(),lr.setValue(H,"boneTexture",Kr.boneTexture,Ve)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}P.isBatchedMesh&&(lr.setOptional(H,P,"batchingTexture"),lr.setValue(H,"batchingTexture",P._matricesTexture,Ve));let du=re.morphAttributes;if((du.position!==void 0||du.normal!==void 0||du.color!==void 0&&xe.isWebGL2===!0)&&$.update(P,re,Cr),(Mt||je.receiveShadow!==P.receiveShadow)&&(je.receiveShadow=P.receiveShadow,lr.setValue(H,"receiveShadow",P.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(un.envMap.value=ce,un.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),Mt&&(lr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&E0(un,Mi),W&&ie.fog===!0&&he.refreshFogUniforms(un,W),he.refreshMaterialUniforms(un,ie,B,U,ae),_h.upload(H,Kh(je),un,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(_h.upload(H,Kh(je),un,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&lr.setValue(H,"center",P.center),lr.setValue(H,"modelViewMatrix",P.modelViewMatrix),lr.setValue(H,"normalMatrix",P.normalMatrix),lr.setValue(H,"modelMatrix",P.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let Kr=ie.uniformsGroups;for(let mu=0,Jh=Kr.length;mu<Jh;mu++)if(xe.isWebGL2){let $h=Kr[mu];Ie.update($h,Cr),Ie.bind($h,Cr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Cr}function E0(O,j){O.ambientLightColor.needsUpdate=j,O.lightProbe.needsUpdate=j,O.directionalLights.needsUpdate=j,O.directionalLightShadows.needsUpdate=j,O.pointLights.needsUpdate=j,O.pointLightShadows.needsUpdate=j,O.spotLights.needsUpdate=j,O.spotLightShadows.needsUpdate=j,O.rectAreaLights.needsUpdate=j,O.hemisphereLights.needsUpdate=j}function A0(O){return O.isMeshLambertMaterial||O.isMeshToonMaterial||O.isMeshPhongMaterial||O.isMeshStandardMaterial||O.isShadowMaterial||O.isShaderMaterial&&O.lights===!0}this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(O,j,re){Ne.get(O.texture).__webglTexture=j,Ne.get(O.depthTexture).__webglTexture=re;let ie=Ne.get(O);ie.__hasExternalTextures=!0,ie.__autoAllocateDepthBuffer=re===void 0,ie.__autoAllocateDepthBuffer||_e.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ie.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(O,j){let re=Ne.get(O);re.__webglFramebuffer=j,re.__useDefaultFramebuffer=j===void 0},this.setRenderTarget=function(O,j=0,re=0){w=O,M=j,S=re;let ie=!0,P=null,W=!1,ee=!1;if(O){let ce=Ne.get(O);ce.__useDefaultFramebuffer!==void 0?(Le.bindFramebuffer(H.FRAMEBUFFER,null),ie=!1):ce.__webglFramebuffer===void 0?Ve.setupRenderTarget(O):ce.__hasExternalTextures&&Ve.rebindTextures(O,Ne.get(O.texture).__webglTexture,Ne.get(O.depthTexture).__webglTexture);let Oe=O.texture;(Oe.isData3DTexture||Oe.isDataArrayTexture||Oe.isCompressedArrayTexture)&&(ee=!0);let Ge=Ne.get(O).__webglFramebuffer;O.isWebGLCubeRenderTarget?(Array.isArray(Ge[j])?P=Ge[j][re]:P=Ge[j],W=!0):xe.isWebGL2&&O.samples>0&&Ve.useMultisampledRTT(O)===!1?P=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?P=Ge[re]:P=Ge,b.copy(O.viewport),E.copy(O.scissor),I=O.scissorTest}else b.copy(G).multiplyScalar(B).floor(),E.copy(Y).multiplyScalar(B).floor(),I=J;if(Le.bindFramebuffer(H.FRAMEBUFFER,P)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,P),Le.viewport(b),Le.scissor(E),Le.setScissorTest(I),W){let ce=Ne.get(O.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+j,ce.__webglTexture,re)}else if(ee){let ce=Ne.get(O.texture),Oe=j||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,ce.__webglTexture,re||0,Oe)}T=-1},this.readRenderTargetPixels=function(O,j,re,ie,P,W,ee){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Ne.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&ee!==void 0&&(ge=ge[ee]),ge){Le.bindFramebuffer(H.FRAMEBUFFER,ge);try{let ce=O.texture,Oe=ce.format,Ge=ce.type;if(Oe!==Rn&&Fe.convert(Oe)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Re=Ge===qu&&(_e.has("EXT_color_buffer_half_float")||xe.isWebGL2&&_e.has("EXT_color_buffer_float"));if(Ge!==Ro&&Fe.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===ja&&(xe.isWebGL2||_e.has("OES_texture_float")||_e.has("WEBGL_color_buffer_float")))&&!Re){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=O.width-ie&&re>=0&&re<=O.height-P&&H.readPixels(j,re,ie,P,Fe.convert(Oe),Fe.convert(Ge),W)}finally{let ce=w!==null?Ne.get(w).__webglFramebuffer:null;Le.bindFramebuffer(H.FRAMEBUFFER,ce)}}},this.copyFramebufferToTexture=function(O,j,re=0){let ie=Math.pow(2,-re),P=Math.floor(j.image.width*ie),W=Math.floor(j.image.height*ie);Ve.setTexture2D(j,0),H.copyTexSubImage2D(H.TEXTURE_2D,re,0,0,O.x,O.y,P,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let P=j.image.width,W=j.image.height,ee=Fe.convert(re.format),ge=Fe.convert(re.type);Ve.setTexture2D(re,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,re.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,re.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,re.unpackAlignment),j.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,P,W,ee,ge,j.image.data):j.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,j.mipmaps[0].width,j.mipmaps[0].height,ee,j.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,ee,ge,j.image),ie===0&&re.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),Le.unbindTexture()},this.copyTextureToTexture3D=function(O,j,re,ie,P=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let W=Math.round(O.max.x-O.min.x),ee=Math.round(O.max.y-O.min.y),ge=O.max.z-O.min.z+1,ce=Fe.convert(ie.format),Oe=Fe.convert(ie.type),Ge;if(ie.isData3DTexture)Ve.setTexture3D(ie,0),Ge=H.TEXTURE_3D;else if(ie.isDataArrayTexture||ie.isCompressedArrayTexture)Ve.setTexture2DArray(ie,0),Ge=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ie.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ie.unpackAlignment);let Re=H.getParameter(H.UNPACK_ROW_LENGTH),pt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),mt=H.getParameter(H.UNPACK_SKIP_PIXELS),$e=H.getParameter(H.UNPACK_SKIP_ROWS),at=H.getParameter(H.UNPACK_SKIP_IMAGES),wt=re.isCompressedTexture?re.mipmaps[P]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,wt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,wt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,O.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,O.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,O.min.z),re.isDataTexture||re.isData3DTexture?H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,wt.data):H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt),H.pixelStorei(H.UNPACK_ROW_LENGTH,Re),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,pt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,mt),H.pixelStorei(H.UNPACK_SKIP_ROWS,$e),H.pixelStorei(H.UNPACK_SKIP_IMAGES,at),P===0&&ie.generateMipmaps&&H.generateMipmap(Ge),Le.unbindTexture()},this.initTexture=function(O){O.isCubeTexture?Ve.setTextureCube(O,0):O.isData3DTexture?Ve.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?Ve.setTexture2DArray(O,0):Ve.setTexture2D(O,0),Le.unbindTexture()},this.resetState=function(){M=0,S=0,w=null,Le.reset(),we.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return $a}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===pg?"display-p3":"srgb",t.unpackColorSpace=Tr.workingColorSpace===vd?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}};var _S=class extends tn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new fl,this.environmentRotation=new fl,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentRotation=this.environmentRotation.toArray(),t}};var zA=class r extends ro{constructor(e=1,t=32,i=0,n=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},t=Math.max(3,t);let a=[],o=[],s=[],l=[],u=new be,c=new Kt;o.push(0,0,0),s.push(0,0,1),l.push(.5,.5);for(let f=0,h=3;f<=t;f++,h+=3){let p=i+f/t*n;u.x=e*Math.cos(p),u.y=e*Math.sin(p),o.push(u.x,u.y,u.z),s.push(0,0,1),c.x=(o[h]/e+1)/2,c.y=(o[h+1]/e+1)/2,l.push(c.x,c.y)}for(let f=1;f<=t;f++)a.push(f,f+1,0);this.setIndex(a),this.setAttribute("position",new Zn(o,3)),this.setAttribute("normal",new Zn(s,3)),this.setAttribute("uv",new Zn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.radius,e.segments,e.thetaStart,e.thetaLength)}};var jg=class extends tn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ir(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};var xS=class extends jg{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(tn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ir(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}};var aF=new Wr,Rie=new be,Lie=new be,FA=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Kt(512,512),this.map=null,this.mapPass=null,this.matrix=new Wr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new yh,this._frameExtents=new Kt(1,1),this._viewportCount=1,this._viewports=[new ni(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Rie.setFromMatrixPosition(e.matrixWorld),t.position.copy(Rie),Lie.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Lie),t.updateMatrixWorld(),aF.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(aF),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(aF)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}};var BA=class extends FA{constructor(){super(new Gg(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}};var SS=class extends jg{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(tn.DEFAULT_UP),this.updateMatrix(),this.target=new tn,this.shadow=new BA}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};var MS=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Pie(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=Pie();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Pie(){return(typeof performance>"u"?Date:performance).now()}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:iS}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=iS);var Dse=zse(nae());var Uk="162";var FLe=0,aae=1,BLe=2;var qoe=1,kLe=2,mc=3,zh=0,fo=1,gc=2,Nh=0,s0=1,oae=2,sae=3,lae=4,VLe=5,fm=100,GLe=101,HLe=102,uae=103,cae=104,WLe=200,XLe=201,YLe=202,qLe=203,$B=204,QB=205,ZLe=206,jLe=207,KLe=208,JLe=209,$Le=210,QLe=211,ePe=212,tPe=213,rPe=214,iPe=0,nPe=1,aPe=2,tR=3,oPe=4,sPe=5,lPe=6,uPe=7,UR=0,cPe=1,fPe=2,Uh=0,hPe=1,pPe=2,dPe=3,mPe=4,vPe=5,gPe=6,yPe=7,fae="attached",_Pe="detached",hae=300,c0=301,f0=302,PM=303,ek=304,OR=306,h0=1e3,uo=1001,tk=1002,Dn=1003,pae=1004;var MM=1005;var lo=1006,vB=1007;var pm=1008;var Oh=1009,xPe=1010,SPe=1011,Ok=1012,Zoe=1013,Ih=1014,fu=1015,DM=1016,joe=1017,Koe=1018,dm=1020,MPe=1021,Cs=1023,bPe=1024,wPe=1025,mm=1026,p0=1027,TPe=1028,Joe=1029,EPe=1030,$oe=1031,Qoe=1033,gB=33776,yB=33777,_B=33778,xB=33779,dae=35840,mae=35841,vae=35842,gae=35843,ese=36196,yae=37492,_ae=37496,xae=37808,Sae=37809,Mae=37810,bae=37811,wae=37812,Tae=37813,Eae=37814,Aae=37815,Cae=37816,Rae=37817,Lae=37818,Pae=37819,Dae=37820,Iae=37821,SB=36492,Nae=36494,Uae=36495,APe=36283,Oae=36284,zae=36285,Fae=36286;var rR=2300,iR=2301,MB=2302,Bae=2400,kae=2401,Vae=2402,CPe=2500;var RPe=3200,LPe=3201,zk=0,PPe=1,Dh="",Ta="srgb",Xh="srgb-linear",Fk="display-p3",zR="display-p3-linear",nR="linear",oi="srgb",aR="rec709",oR="p3";var ky=7680;var Gae=519,DPe=512,IPe=513,NPe=514,tse=515,UPe=516,OPe=517,zPe=518,FPe=519,Hae=35044;var Wae="300 es",rk=1035,yc=2e3,sR=2001,Fh=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let a=0,o=n.length;a<o;a++)n[a].call(this,e);e.target=null}}},ta=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Xae=1234567,CM=Math.PI/180,d0=180/Math.PI;function Yh(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ta[r&255]+ta[r>>8&255]+ta[r>>16&255]+ta[r>>24&255]+"-"+ta[e&255]+ta[e>>8&255]+"-"+ta[e>>16&15|64]+ta[e>>24&255]+"-"+ta[t&63|128]+ta[t>>8&255]+"-"+ta[t>>16&255]+ta[t>>24&255]+ta[i&255]+ta[i>>8&255]+ta[i>>16&255]+ta[i>>24&255]).toLowerCase()}function In(r,e,t){return Math.max(e,Math.min(t,r))}function Bk(r,e){return(r%e+e)%e}function BPe(r,e,t,i,n){return i+(r-e)*(n-i)/(t-e)}function kPe(r,e,t){return r!==e?(t-r)/(e-r):0}function RM(r,e,t){return(1-t)*r+t*e}function VPe(r,e,t,i){return RM(r,e,1-Math.exp(-t*i))}function GPe(r,e=1){return e-Math.abs(Bk(r,e*2)-e)}function HPe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function WPe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function XPe(r,e){return r+Math.floor(Math.random()*(e-r+1))}function YPe(r,e){return r+Math.random()*(e-r)}function qPe(r){return r*(.5-Math.random())}function ZPe(r){r!==void 0&&(Xae=r);let e=Xae+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function jPe(r){return r*CM}function KPe(r){return r*d0}function ik(r){return(r&r-1)===0&&r!==0}function JPe(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function lR(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function $Pe(r,e,t,i,n){let a=Math.cos,o=Math.sin,s=a(t/2),l=o(t/2),u=a((e+i)/2),c=o((e+i)/2),f=a((e-i)/2),h=o((e-i)/2),p=a((i-e)/2),d=o((i-e)/2);switch(n){case"XYX":r.set(s*c,l*f,l*h,s*u);break;case"YZY":r.set(l*h,s*c,l*f,s*u);break;case"ZXZ":r.set(l*f,l*h,s*c,s*u);break;case"XZX":r.set(s*c,l*d,l*p,s*u);break;case"YXY":r.set(l*p,s*c,l*d,s*u);break;case"ZYZ":r.set(l*d,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function r0(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function ba(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var na={DEG2RAD:CM,RAD2DEG:d0,generateUUID:Yh,clamp:In,euclideanModulo:Bk,mapLinear:BPe,inverseLerp:kPe,lerp:RM,damp:VPe,pingpong:GPe,smoothstep:HPe,smootherstep:WPe,randInt:XPe,randFloat:YPe,randFloatSpread:qPe,seededRandom:ZPe,degToRad:jPe,radToDeg:KPe,isPowerOfTwo:ik,ceilPowerOfTwo:JPe,floorPowerOfTwo:lR,setQuaternionFromProperEuler:$Pe,normalize:ba,denormalize:r0},yr=class r{constructor(e=0,t=0){r.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(In(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*i-o*n+e.x,this.y=a*n+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},dr=class r{constructor(e,t,i,n,a,o,s,l,u){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u)}set(e,t,i,n,a,o,s,l,u){let c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=a,c[5]=l,c[6]=i,c[7]=o,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[3],l=i[6],u=i[1],c=i[4],f=i[7],h=i[2],p=i[5],d=i[8],g=n[0],m=n[3],v=n[6],_=n[1],y=n[4],x=n[7],M=n[2],S=n[5],w=n[8];return a[0]=o*g+s*_+l*M,a[3]=o*m+s*y+l*S,a[6]=o*v+s*x+l*w,a[1]=u*g+c*_+f*M,a[4]=u*m+c*y+f*S,a[7]=u*v+c*x+f*w,a[2]=h*g+p*_+d*M,a[5]=h*m+p*y+d*S,a[8]=h*v+p*x+d*w,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return t*o*c-t*s*u-i*a*c+i*s*l+n*a*u-n*o*l}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=c*o-s*u,h=s*l-c*a,p=u*a-o*l,d=t*f+i*h+n*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=f*g,e[1]=(n*u-c*i)*g,e[2]=(s*i-n*o)*g,e[3]=h*g,e[4]=(c*t-n*l)*g,e[5]=(n*a-s*t)*g,e[6]=p*g,e[7]=(i*l-u*t)*g,e[8]=(o*t-i*a)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,a,o,s){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*o+u*s)+o+e,-n*u,n*l,-n*(-u*o+l*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(bB.makeScale(e,t)),this}rotate(e){return this.premultiply(bB.makeRotation(-e)),this}translate(e,t){return this.premultiply(bB.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},bB=new dr;function rse(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function IM(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function QPe(){let r=IM("canvas");return r.style.display="block",r}var Yae={};function eDe(r){r in Yae||(Yae[r]=!0,console.warn(r))}var qae=new dr().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Zae=new dr().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),RC={[Xh]:{transfer:nR,primaries:aR,toReference:r=>r,fromReference:r=>r},[Ta]:{transfer:oi,primaries:aR,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[zR]:{transfer:nR,primaries:oR,toReference:r=>r.applyMatrix3(Zae),fromReference:r=>r.applyMatrix3(qae)},[Fk]:{transfer:oi,primaries:oR,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Zae),fromReference:r=>r.applyMatrix3(qae).convertLinearToSRGB()}},tDe=new Set([Xh,zR]),$r={enabled:!0,_workingColorSpace:Xh,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!tDe.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;let i=RC[e].toReference,n=RC[t].fromReference;return n(i(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return RC[r].primaries},getTransfer:function(r){return r===Dh?nR:RC[r].transfer}};function l0(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function wB(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Vy,uR=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Vy===void 0&&(Vy=IM("canvas")),Vy.width=e.width,Vy.height=e.height;let i=Vy.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Vy}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=IM("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),a=n.data;for(let o=0;o<a.length;o++)a[o]=l0(a[o]/255)*255;return i.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(l0(t[i]/255)*255):t[i]=l0(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},rDe=0,cR=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:rDe++}),this.uuid=Yh(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(n!==null){let a;if(Array.isArray(n)){a=[];for(let o=0,s=n.length;o<s;o++)n[o].isDataTexture?a.push(TB(n[o].image)):a.push(TB(n[o]))}else a=TB(n);i.url=a}return t||(e.images[this.uuid]=i),i}};function TB(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?uR.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var iDe=0,Vo=(()=>{class r extends Fh{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=uo,a=uo,o=lo,s=pm,l=Cs,u=Oh,c=r.DEFAULT_ANISOTROPY,f=Dh){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:iDe++}),this.uuid=Yh(),this.name="",this.source=new cR(t),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=a,this.magFilter=o,this.minFilter=s,this.anisotropy=c,this.format=l,this.internalFormat=null,this.type=u,this.offset=new yr(0,0),this.repeat=new yr(1,1),this.center=new yr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new dr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,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.internalFormat=t.internalFormat,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.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let i=t===void 0||typeof t=="string";if(!i&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),i||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==hae)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case h0:t.x=t.x-Math.floor(t.x);break;case uo:t.x=t.x<0?0:1;break;case tk:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case h0:t.y=t.y-Math.floor(t.y);break;case uo:t.y=t.y<0?0:1;break;case tk:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}}return r.DEFAULT_IMAGE=null,r.DEFAULT_MAPPING=hae,r.DEFAULT_ANISOTROPY=1,r})(),Rr=class r{constructor(e=0,t=0,i=0,n=1){r.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*n+o[12]*a,this.y=o[1]*t+o[5]*i+o[9]*n+o[13]*a,this.z=o[2]*t+o[6]*i+o[10]*n+o[14]*a,this.w=o[3]*t+o[7]*i+o[11]*n+o[15]*a,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,a,l=e.elements,u=l[0],c=l[4],f=l[8],h=l[1],p=l[5],d=l[9],g=l[2],m=l[6],v=l[10];if(Math.abs(c-h)<.01&&Math.abs(f-g)<.01&&Math.abs(d-m)<.01){if(Math.abs(c+h)<.1&&Math.abs(f+g)<.1&&Math.abs(d+m)<.1&&Math.abs(u+p+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let y=(u+1)/2,x=(p+1)/2,M=(v+1)/2,S=(c+h)/4,w=(f+g)/4,T=(d+m)/4;return y>x&&y>M?y<.01?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(y),n=S/i,a=w/i):x>M?x<.01?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(x),i=S/n,a=T/n):M<.01?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(M),i=w/a,n=T/a),this.set(i,n,a,t),this}let _=Math.sqrt((m-d)*(m-d)+(f-g)*(f-g)+(h-c)*(h-c));return Math.abs(_)<.001&&(_=1),this.x=(m-d)/_,this.y=(f-g)/_,this.z=(h-c)/_,this.w=Math.acos((u+p+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},nk=class extends Fh{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Rr(0,0,e,t),this.scissorTest=!1,this.viewport=new Rr(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:lo,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new Vo(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);a.flipY=!1,a.generateMipmaps=i.generateMipmaps,a.internalFormat=i.internalFormat,this.textures=[];let o=i.count;for(let s=0;s<o;s++)this.textures[s]=a.clone(),this.textures[s].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,a=this.textures.length;n<a;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,n=e.textures.length;i<n;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new cR(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},xc=class extends nk{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},fR=class extends Vo{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=uo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ak=class extends Vo{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=uo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var On=class{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,a,o,s){let l=i[n+0],u=i[n+1],c=i[n+2],f=i[n+3],h=a[o+0],p=a[o+1],d=a[o+2],g=a[o+3];if(s===0){e[t+0]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f;return}if(s===1){e[t+0]=h,e[t+1]=p,e[t+2]=d,e[t+3]=g;return}if(f!==g||l!==h||u!==p||c!==d){let m=1-s,v=l*h+u*p+c*d+f*g,_=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){let M=Math.sqrt(y),S=Math.atan2(M,v*_);m=Math.sin(m*S)/M,s=Math.sin(s*S)/M}let x=s*_;if(l=l*m+h*x,u=u*m+p*x,c=c*m+d*x,f=f*m+g*x,m===1-s){let M=1/Math.sqrt(l*l+u*u+c*c+f*f);l*=M,u*=M,c*=M,f*=M}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,n,a,o){let s=i[n],l=i[n+1],u=i[n+2],c=i[n+3],f=a[o],h=a[o+1],p=a[o+2],d=a[o+3];return e[t]=s*d+c*f+l*p-u*h,e[t+1]=l*d+c*h+u*f-s*p,e[t+2]=u*d+c*p+s*h-l*f,e[t+3]=c*d-s*f-l*h-u*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,n=e._y,a=e._z,o=e._order,s=Math.cos,l=Math.sin,u=s(i/2),c=s(n/2),f=s(a/2),h=l(i/2),p=l(n/2),d=l(a/2);switch(o){case"XYZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"YXZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"ZXY":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"ZYX":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"YZX":this._x=h*c*f+u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f-h*p*d;break;case"XZY":this._x=h*c*f-u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],a=t[8],o=t[1],s=t[5],l=t[9],u=t[2],c=t[6],f=t[10],h=i+s+f;if(h>0){let p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(c-l)*p,this._y=(a-u)*p,this._z=(o-n)*p}else if(i>s&&i>f){let p=2*Math.sqrt(1+i-s-f);this._w=(c-l)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(a+u)/p}else if(s>f){let p=2*Math.sqrt(1+s-i-f);this._w=(a-u)/p,this._x=(n+o)/p,this._y=.25*p,this._z=(l+c)/p}else{let p=2*Math.sqrt(1+f-i-s);this._w=(o-n)/p,this._x=(a+u)/p,this._y=(l+c)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(In(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,a=e._z,o=e._w,s=t._x,l=t._y,u=t._z,c=t._w;return this._x=i*c+o*s+n*u-a*l,this._y=n*c+o*l+a*s-i*u,this._z=a*c+o*u+i*l-n*s,this._w=o*c-i*s-n*l-a*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,a=this._z,o=this._w,s=o*e._w+i*e._x+n*e._y+a*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=i,this._y=n,this._z=a,this;let l=1-s*s;if(l<=Number.EPSILON){let p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*n+t*this._y,this._z=p*a+t*this._z,this.normalize(),this}let u=Math.sqrt(l),c=Math.atan2(u,s),f=Math.sin((1-t)*c)/u,h=Math.sin(t*c)/u;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=n*f+this._y*h,this._z=a*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),a=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),a*Math.sin(t),a*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},ye=class r{constructor(e=0,t=0,i=0){r.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(jae.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(jae.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6]*n,this.y=a[1]*t+a[4]*i+a[7]*n,this.z=a[2]*t+a[5]*i+a[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=e.elements,o=1/(a[3]*t+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*t+a[4]*i+a[8]*n+a[12])*o,this.y=(a[1]*t+a[5]*i+a[9]*n+a[13])*o,this.z=(a[2]*t+a[6]*i+a[10]*n+a[14])*o,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,a=e.x,o=e.y,s=e.z,l=e.w,u=2*(o*n-s*i),c=2*(s*t-a*n),f=2*(a*i-o*t);return this.x=t+l*u+o*f-s*c,this.y=i+l*c+s*u-a*f,this.z=n+l*f+a*c-o*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n,this.y=a[1]*t+a[5]*i+a[9]*n,this.z=a[2]*t+a[6]*i+a[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,a=e.z,o=t.x,s=t.y,l=t.z;return this.x=n*l-a*s,this.y=a*o-i*l,this.z=i*s-n*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return EB.copy(this).projectOnVector(e),this.sub(EB)}reflect(e){return this.sub(EB.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(In(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},EB=new ye,jae=new On,Bh=class{constructor(e=new ye(1/0,1/0,1/0),t=new ye(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(gl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(gl.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=gl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){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(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let a=i.getAttribute("position");if(t===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let o=0,s=a.count;o<s;o++)e.isMesh===!0?e.getVertexPosition(o,gl):gl.fromBufferAttribute(a,o),gl.applyMatrix4(e.matrixWorld),this.expandByPoint(gl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),LC.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),LC.copy(i.boundingBox)),LC.applyMatrix4(e.matrixWorld),this.union(LC)}let n=e.children;for(let a=0,o=n.length;a<o;a++)this.expandByObject(n[a],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,gl),gl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(bM),PC.subVectors(this.max,bM),Gy.subVectors(e.a,bM),Hy.subVectors(e.b,bM),Wy.subVectors(e.c,bM),Eh.subVectors(Hy,Gy),Ah.subVectors(Wy,Hy),nm.subVectors(Gy,Wy);let t=[0,-Eh.z,Eh.y,0,-Ah.z,Ah.y,0,-nm.z,nm.y,Eh.z,0,-Eh.x,Ah.z,0,-Ah.x,nm.z,0,-nm.x,-Eh.y,Eh.x,0,-Ah.y,Ah.x,0,-nm.y,nm.x,0];return!AB(t,Gy,Hy,Wy,PC)||(t=[1,0,0,0,1,0,0,0,1],!AB(t,Gy,Hy,Wy,PC))?!1:(DC.crossVectors(Eh,Ah),t=[DC.x,DC.y,DC.z],AB(t,Gy,Hy,Wy,PC))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,gl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(gl).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(uc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),uc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),uc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),uc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),uc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),uc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),uc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),uc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(uc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},uc=[new ye,new ye,new ye,new ye,new ye,new ye,new ye,new ye],gl=new ye,LC=new Bh,Gy=new ye,Hy=new ye,Wy=new ye,Eh=new ye,Ah=new ye,nm=new ye,bM=new ye,PC=new ye,DC=new ye,am=new ye;function AB(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){am.fromArray(r,a);let s=n.x*Math.abs(am.x)+n.y*Math.abs(am.y)+n.z*Math.abs(am.z),l=e.dot(am),u=t.dot(am),c=i.dot(am);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var nDe=new Bh,wM=new ye,CB=new ye,kh=class{constructor(e=new ye,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):nDe.setFromPoints(e).getCenter(i);let n=0;for(let a=0,o=e.length;a<o;a++)n=Math.max(n,i.distanceToSquared(e[a]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;wM.subVectors(e,this.center);let t=wM.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(wM,n/i),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(CB.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(wM.copy(e.center).add(CB)),this.expandByPoint(wM.copy(e.center).sub(CB))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},cc=new ye,RB=new ye,IC=new ye,Ch=new ye,LB=new ye,NC=new ye,PB=new ye,NM=class{constructor(e=new ye,t=new ye(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,cc)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=cc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(cc.copy(this.origin).addScaledVector(this.direction,t),cc.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){RB.copy(e).add(t).multiplyScalar(.5),IC.copy(t).sub(e).normalize(),Ch.copy(this.origin).sub(RB);let a=e.distanceTo(t)*.5,o=-this.direction.dot(IC),s=Ch.dot(this.direction),l=-Ch.dot(IC),u=Ch.lengthSq(),c=Math.abs(1-o*o),f,h,p,d;if(c>0)if(f=o*l-s,h=o*s-l,d=a*c,f>=0)if(h>=-d)if(h<=d){let g=1/c;f*=g,h*=g,p=f*(f+o*h+2*s)+h*(o*f+h+2*l)+u}else h=a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h=-a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h<=-d?(f=Math.max(0,-(-o*a+s)),h=f>0?-a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u):h<=d?(f=0,h=Math.min(Math.max(-a,-l),a),p=h*(h+2*l)+u):(f=Math.max(0,-(o*a+s)),h=f>0?a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u);else h=o>0?-a:a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,f),n&&n.copy(RB).addScaledVector(IC,h),p}intersectSphere(e,t){cc.subVectors(e.center,this.origin);let i=cc.dot(this.direction),n=cc.dot(cc)-i*i,a=e.radius*e.radius;if(n>a)return null;let o=Math.sqrt(a-n),s=i-o,l=i+o;return l<0?null:s<0?this.at(l,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,a,o,s,l,u=1/this.direction.x,c=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(i=(e.min.x-h.x)*u,n=(e.max.x-h.x)*u):(i=(e.max.x-h.x)*u,n=(e.min.x-h.x)*u),c>=0?(a=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(a=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),i>o||a>n||((a>i||isNaN(i))&&(i=a),(o<n||isNaN(n))&&(n=o),f>=0?(s=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(s=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||s>n)||((s>i||i!==i)&&(i=s),(l<n||n!==n)&&(n=l),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,cc)!==null}intersectTriangle(e,t,i,n,a){LB.subVectors(t,e),NC.subVectors(i,e),PB.crossVectors(LB,NC);let o=this.direction.dot(PB),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;Ch.subVectors(this.origin,e);let l=s*this.direction.dot(NC.crossVectors(Ch,NC));if(l<0)return null;let u=s*this.direction.dot(LB.cross(Ch));if(u<0||l+u>o)return null;let c=-s*Ch.dot(PB);return c<0?null:this.at(c/o,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ht=class r{constructor(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m)}set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){let v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=n,v[1]=a,v[5]=o,v[9]=s,v[13]=l,v[2]=u,v[6]=c,v[10]=f,v[14]=h,v[3]=p,v[7]=d,v[11]=g,v[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new r().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/Xy.setFromMatrixColumn(e,0).length(),a=1/Xy.setFromMatrixColumn(e,1).length(),o=1/Xy.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*a,t[5]=i[5]*a,t[6]=i[6]*a,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,a=e.z,o=Math.cos(i),s=Math.sin(i),l=Math.cos(n),u=Math.sin(n),c=Math.cos(a),f=Math.sin(a);if(e.order==="XYZ"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=-l*f,t[8]=u,t[1]=p+d*u,t[5]=h-g*u,t[9]=-s*l,t[2]=g-h*u,t[6]=d+p*u,t[10]=o*l}else if(e.order==="YXZ"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h+g*s,t[4]=d*s-p,t[8]=o*u,t[1]=o*f,t[5]=o*c,t[9]=-s,t[2]=p*s-d,t[6]=g+h*s,t[10]=o*l}else if(e.order==="ZXY"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h-g*s,t[4]=-o*f,t[8]=d+p*s,t[1]=p+d*s,t[5]=o*c,t[9]=g-h*s,t[2]=-o*u,t[6]=s,t[10]=o*l}else if(e.order==="ZYX"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=d*u-p,t[8]=h*u+g,t[1]=l*f,t[5]=g*u+h,t[9]=p*u-d,t[2]=-u,t[6]=s*l,t[10]=o*l}else if(e.order==="YZX"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=g-h*f,t[8]=d*f+p,t[1]=f,t[5]=o*c,t[9]=-s*c,t[2]=-u*c,t[6]=p*f+d,t[10]=h-g*f}else if(e.order==="XZY"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=-f,t[8]=u*c,t[1]=h*f+g,t[5]=o*c,t[9]=p*f-d,t[2]=d*f-p,t[6]=s*c,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(aDe,e,oDe)}lookAt(e,t,i){let n=this.elements;return Bo.subVectors(e,t),Bo.lengthSq()===0&&(Bo.z=1),Bo.normalize(),Rh.crossVectors(i,Bo),Rh.lengthSq()===0&&(Math.abs(i.z)===1?Bo.x+=1e-4:Bo.z+=1e-4,Bo.normalize(),Rh.crossVectors(i,Bo)),Rh.normalize(),UC.crossVectors(Bo,Rh),n[0]=Rh.x,n[4]=UC.x,n[8]=Bo.x,n[1]=Rh.y,n[5]=UC.y,n[9]=Bo.y,n[2]=Rh.z,n[6]=UC.z,n[10]=Bo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[4],l=i[8],u=i[12],c=i[1],f=i[5],h=i[9],p=i[13],d=i[2],g=i[6],m=i[10],v=i[14],_=i[3],y=i[7],x=i[11],M=i[15],S=n[0],w=n[4],T=n[8],C=n[12],b=n[1],E=n[5],I=n[9],R=n[13],A=n[2],D=n[6],U=n[10],B=n[14],z=n[3],k=n[7],G=n[11],Y=n[15];return a[0]=o*S+s*b+l*A+u*z,a[4]=o*w+s*E+l*D+u*k,a[8]=o*T+s*I+l*U+u*G,a[12]=o*C+s*R+l*B+u*Y,a[1]=c*S+f*b+h*A+p*z,a[5]=c*w+f*E+h*D+p*k,a[9]=c*T+f*I+h*U+p*G,a[13]=c*C+f*R+h*B+p*Y,a[2]=d*S+g*b+m*A+v*z,a[6]=d*w+g*E+m*D+v*k,a[10]=d*T+g*I+m*U+v*G,a[14]=d*C+g*R+m*B+v*Y,a[3]=_*S+y*b+x*A+M*z,a[7]=_*w+y*E+x*D+M*k,a[11]=_*T+y*I+x*U+M*G,a[15]=_*C+y*R+x*B+M*Y,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],a=e[12],o=e[1],s=e[5],l=e[9],u=e[13],c=e[2],f=e[6],h=e[10],p=e[14],d=e[3],g=e[7],m=e[11],v=e[15];return d*(+a*l*f-n*u*f-a*s*h+i*u*h+n*s*p-i*l*p)+g*(+t*l*p-t*u*h+a*o*h-n*o*p+n*u*c-a*l*c)+m*(+t*u*f-t*s*p-a*o*f+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-t*l*f+t*s*h+n*o*f-i*o*h+i*l*c)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],g=e[13],m=e[14],v=e[15],_=f*m*u-g*h*u+g*l*p-s*m*p-f*l*v+s*h*v,y=d*h*u-c*m*u-d*l*p+o*m*p+c*l*v-o*h*v,x=c*g*u-d*f*u+d*s*p-o*g*p-c*s*v+o*f*v,M=d*f*l-c*g*l-d*s*h+o*g*h+c*s*m-o*f*m,S=t*_+i*y+n*x+a*M;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/S;return e[0]=_*w,e[1]=(g*h*a-f*m*a-g*n*p+i*m*p+f*n*v-i*h*v)*w,e[2]=(s*m*a-g*l*a+g*n*u-i*m*u-s*n*v+i*l*v)*w,e[3]=(f*l*a-s*h*a-f*n*u+i*h*u+s*n*p-i*l*p)*w,e[4]=y*w,e[5]=(c*m*a-d*h*a+d*n*p-t*m*p-c*n*v+t*h*v)*w,e[6]=(d*l*a-o*m*a-d*n*u+t*m*u+o*n*v-t*l*v)*w,e[7]=(o*h*a-c*l*a+c*n*u-t*h*u-o*n*p+t*l*p)*w,e[8]=x*w,e[9]=(d*f*a-c*g*a-d*i*p+t*g*p+c*i*v-t*f*v)*w,e[10]=(o*g*a-d*s*a+d*i*u-t*g*u-o*i*v+t*s*v)*w,e[11]=(c*s*a-o*f*a-c*i*u+t*f*u+o*i*p-t*s*p)*w,e[12]=M*w,e[13]=(c*g*n-d*f*n+d*i*h-t*g*h-c*i*m+t*f*m)*w,e[14]=(d*s*n-o*g*n-d*i*l+t*g*l+o*i*m-t*s*m)*w,e[15]=(o*f*n-c*s*n+c*i*l-t*f*l-o*i*h+t*s*h)*w,this}scale(e){let t=this.elements,i=e.x,n=e.y,a=e.z;return t[0]*=i,t[4]*=n,t[8]*=a,t[1]*=i,t[5]*=n,t[9]*=a,t[2]*=i,t[6]*=n,t[10]*=a,t[3]*=i,t[7]*=n,t[11]*=a,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),a=1-i,o=e.x,s=e.y,l=e.z,u=a*o,c=a*s;return this.set(u*o+i,u*s-n*l,u*l+n*s,0,u*s+n*l,c*s+i,c*l-n*o,0,u*l-n*s,c*l+n*o,a*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,a,o){return this.set(1,i,a,0,e,1,o,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,a=t._x,o=t._y,s=t._z,l=t._w,u=a+a,c=o+o,f=s+s,h=a*u,p=a*c,d=a*f,g=o*c,m=o*f,v=s*f,_=l*u,y=l*c,x=l*f,M=i.x,S=i.y,w=i.z;return n[0]=(1-(g+v))*M,n[1]=(p+x)*M,n[2]=(d-y)*M,n[3]=0,n[4]=(p-x)*S,n[5]=(1-(h+v))*S,n[6]=(m+_)*S,n[7]=0,n[8]=(d+y)*w,n[9]=(m-_)*w,n[10]=(1-(h+g))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,a=Xy.set(n[0],n[1],n[2]).length(),o=Xy.set(n[4],n[5],n[6]).length(),s=Xy.set(n[8],n[9],n[10]).length();this.determinant()<0&&(a=-a),e.x=n[12],e.y=n[13],e.z=n[14],yl.copy(this);let u=1/a,c=1/o,f=1/s;return yl.elements[0]*=u,yl.elements[1]*=u,yl.elements[2]*=u,yl.elements[4]*=c,yl.elements[5]*=c,yl.elements[6]*=c,yl.elements[8]*=f,yl.elements[9]*=f,yl.elements[10]*=f,t.setFromRotationMatrix(yl),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=yc){let l=this.elements,u=2*a/(t-e),c=2*a/(i-n),f=(t+e)/(t-e),h=(i+n)/(i-n),p,d;if(s===yc)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===sR)p=-o/(o-a),d=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return l[0]=u,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=c,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,n,a,o,s=yc){let l=this.elements,u=1/(t-e),c=1/(i-n),f=1/(o-a),h=(t+e)*u,p=(i+n)*c,d,g;if(s===yc)d=(o+a)*f,g=-2*f;else if(s===sR)d=a*f,g=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=g,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},Xy=new ye,yl=new Ht,aDe=new ye(0,0,0),oDe=new ye(1,1,1),Rh=new ye,UC=new ye,Bo=new ye,Kae=new Ht,Jae=new On,zn=(()=>{class r{constructor(t=0,i=0,n=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=i,this._z=n,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,i,n,a=this._order){return this._x=t,this._y=i,this._z=n,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,i=this._order,n=!0){let a=t.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],f=a[9],h=a[2],p=a[6],d=a[10];switch(i){case"XYZ":this._y=Math.asin(In(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-In(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,d),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(In(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-In(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(In(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(l,d));break;case"XZY":this._z=Math.asin(-In(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-f,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,i,n){return Kae.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Kae,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return Jae.setFromEuler(this),this.setFromQuaternion(Jae,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}return r.DEFAULT_ORDER="XYZ",r})(),hR=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},sDe=0,$ae=new ye,Yy=new On,fc=new Ht,OC=new ye,TM=new ye,lDe=new ye,uDe=new On,Qae=new ye(1,0,0),eoe=new ye(0,1,0),toe=new ye(0,0,1),cDe={type:"added"},fDe={type:"removed"},DB={type:"childadded",child:null},IB={type:"childremoved",child:null},ia=(()=>{class r extends Fh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:sDe++}),this.uuid=Yh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new ye,i=new zn,n=new On,a=new ye(1,1,1);function o(){n.setFromEuler(i,!1)}function s(){i.setFromQuaternion(n,void 0,!1)}i._onChange(o),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new Ht},normalMatrix:{value:new dr}}),this.matrix=new Ht,this.matrixWorld=new Ht,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new hR,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,i){this.quaternion.setFromAxisAngle(t,i)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,i){return Yy.setFromAxisAngle(t,i),this.quaternion.multiply(Yy),this}rotateOnWorldAxis(t,i){return Yy.setFromAxisAngle(t,i),this.quaternion.premultiply(Yy),this}rotateX(t){return this.rotateOnAxis(Qae,t)}rotateY(t){return this.rotateOnAxis(eoe,t)}rotateZ(t){return this.rotateOnAxis(toe,t)}translateOnAxis(t,i){return $ae.copy(t).applyQuaternion(this.quaternion),this.position.add($ae.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(Qae,t)}translateY(t){return this.translateOnAxis(eoe,t)}translateZ(t){return this.translateOnAxis(toe,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(fc.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?OC.copy(t):OC.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),TM.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?fc.lookAt(TM,OC,this.up):fc.lookAt(OC,TM,this.up),this.quaternion.setFromRotationMatrix(fc),a&&(fc.extractRotation(a.matrixWorld),Yy.setFromRotationMatrix(fc),this.quaternion.premultiply(Yy.invert()))}add(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(cDe),DB.child=t,this.dispatchEvent(DB),DB.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let i=this.children.indexOf(t);return i!==-1&&(t.parent=null,this.children.splice(i,1),t.dispatchEvent(fDe),IB.child=t,this.dispatchEvent(IB),IB.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),fc.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),fc.multiply(t.parent.matrixWorld)),t.applyMatrix4(fc),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,i){if(this[t]===i)return this;for(let n=0,a=this.children.length;n<a;n++){let s=this.children[n].getObjectByProperty(t,i);if(s!==void 0)return s}}getObjectsByProperty(t,i,n=[]){this[t]===i&&n.push(this);let a=this.children;for(let o=0,s=a.length;o<s;o++)a[o].getObjectsByProperty(t,i,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(TM,t,lDe),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(TM,uDe,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let i=this.matrixWorld.elements;return t.set(i[8],i[9],i[10]).normalize()}raycast(){}traverse(t){t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverseVisible(t)}traverseAncestors(t){let i=this.parent;i!==null&&(t(i),i.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let i=this.children;for(let n=0,a=i.length;n<a;n++){let o=i[n];(o.matrixWorldAutoUpdate===!0||t===!0)&&o.updateMatrixWorld(t)}}updateWorldMatrix(t,i){let n=this.parent;if(t===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),i===!0){let a=this.children;for(let o=0,s=a.length;o<s;o++){let l=a[o];l.matrixWorldAutoUpdate===!0&&l.updateWorldMatrix(!1,!0)}}}toJSON(t){let i=t===void 0||typeof t=="string",n={};i&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),a.maxGeometryCount=this._maxGeometryCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function o(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(t)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=o(t.geometries,this.geometry);let l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){let u=l.shapes;if(Array.isArray(u))for(let c=0,f=u.length;c<f;c++){let h=u[c];o(t.shapes,h)}else o(t.shapes,u)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let l=[];for(let u=0,c=this.material.length;u<c;u++)l.push(o(t.materials,this.material[u]));a.material=l}else a.material=o(t.materials,this.material);if(this.children.length>0){a.children=[];for(let l=0;l<this.children.length;l++)a.children.push(this.children[l].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let l=0;l<this.animations.length;l++){let u=this.animations[l];a.animations.push(o(t.animations,u))}}if(i){let l=s(t.geometries),u=s(t.materials),c=s(t.textures),f=s(t.images),h=s(t.shapes),p=s(t.skeletons),d=s(t.animations),g=s(t.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),c.length>0&&(n.textures=c),f.length>0&&(n.images=f),h.length>0&&(n.shapes=h),p.length>0&&(n.skeletons=p),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=a,n;function s(l){let u=[];for(let c in l){let f=l[c];delete f.metadata,u.push(f)}return u}}clone(t){return new this.constructor().copy(this,t)}copy(t,i=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),i===!0)for(let n=0;n<t.children.length;n++){let a=t.children[n];this.add(a.clone())}return this}}return r.DEFAULT_UP=new ye(0,1,0),r.DEFAULT_MATRIX_AUTO_UPDATE=!0,r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,r})(),_l=new ye,hc=new ye,NB=new ye,pc=new ye,qy=new ye,Zy=new ye,roe=new ye,UB=new ye,OB=new ye,zB=new ye,i0=class r{constructor(e=new ye,t=new ye,i=new ye){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),_l.subVectors(e,t),n.cross(_l);let a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){_l.subVectors(n,t),hc.subVectors(i,t),NB.subVectors(e,t);let o=_l.dot(_l),s=_l.dot(hc),l=_l.dot(NB),u=hc.dot(hc),c=hc.dot(NB),f=o*u-s*s;if(f===0)return a.set(0,0,0),null;let h=1/f,p=(u*l-s*c)*h,d=(o*c-s*l)*h;return a.set(1-p-d,d,p)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,pc)===null?!1:pc.x>=0&&pc.y>=0&&pc.x+pc.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,pc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,pc.x),l.addScaledVector(o,pc.y),l.addScaledVector(s,pc.z),l)}static isFrontFacing(e,t,i,n){return _l.subVectors(i,t),hc.subVectors(e,t),_l.cross(hc).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _l.subVectors(this.c,this.b),hc.subVectors(this.a,this.b),_l.cross(hc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return r.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return r.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,a){return r.getInterpolation(e,this.a,this.b,this.c,t,i,n,a)}containsPoint(e){return r.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return r.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,a=this.c,o,s;qy.subVectors(n,i),Zy.subVectors(a,i),UB.subVectors(e,i);let l=qy.dot(UB),u=Zy.dot(UB);if(l<=0&&u<=0)return t.copy(i);OB.subVectors(e,n);let c=qy.dot(OB),f=Zy.dot(OB);if(c>=0&&f<=c)return t.copy(n);let h=l*f-c*u;if(h<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(qy,o);zB.subVectors(e,a);let p=qy.dot(zB),d=Zy.dot(zB);if(d>=0&&p<=d)return t.copy(a);let g=p*u-l*d;if(g<=0&&u>=0&&d<=0)return s=u/(u-d),t.copy(i).addScaledVector(Zy,s);let m=c*d-p*f;if(m<=0&&f-c>=0&&p-d>=0)return roe.subVectors(a,n),s=(f-c)/(f-c+(p-d)),t.copy(n).addScaledVector(roe,s);let v=1/(m+g+h);return o=g*v,s=h*v,t.copy(i).addScaledVector(qy,o).addScaledVector(Zy,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ise={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},Lh={h:0,s:0,l:0},zC={h:0,s:0,l:0};function FB(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}var tr=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ta){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$r.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=$r.workingColorSpace){return this.r=e,this.g=t,this.b=i,$r.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=$r.workingColorSpace){if(e=Bk(e,1),t=In(t,0,1),i=In(i,0,1),t===0)this.r=this.g=this.b=i;else{let a=i<=.5?i*(1+t):i+t-i*t,o=2*i-a;this.r=FB(o,a,e+1/3),this.g=FB(o,a,e),this.b=FB(o,a,e-1/3)}return $r.toWorkingColorSpace(this,n),this}setStyle(e,t=Ta){function i(a){a!==void 0&&parseFloat(a)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let a,o=n[1],s=n[2];switch(o){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let a=n[1],o=a.length;if(o===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(a,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ta){let i=ise[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=l0(e.r),this.g=l0(e.g),this.b=l0(e.b),this}copyLinearToSRGB(e){return this.r=wB(e.r),this.g=wB(e.g),this.b=wB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ta){return $r.fromWorkingColorSpace(ra.copy(this),e),Math.round(In(ra.r*255,0,255))*65536+Math.round(In(ra.g*255,0,255))*256+Math.round(In(ra.b*255,0,255))}getHexString(e=Ta){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$r.workingColorSpace){$r.fromWorkingColorSpace(ra.copy(this),t);let i=ra.r,n=ra.g,a=ra.b,o=Math.max(i,n,a),s=Math.min(i,n,a),l,u,c=(s+o)/2;if(s===o)l=0,u=0;else{let f=o-s;switch(u=c<=.5?f/(o+s):f/(2-o-s),o){case i:l=(n-a)/f+(n<a?6:0);break;case n:l=(a-i)/f+2;break;case a:l=(i-n)/f+4;break}l/=6}return e.h=l,e.s=u,e.l=c,e}getRGB(e,t=$r.workingColorSpace){return $r.fromWorkingColorSpace(ra.copy(this),t),e.r=ra.r,e.g=ra.g,e.b=ra.b,e}getStyle(e=Ta){$r.fromWorkingColorSpace(ra.copy(this),e);let t=ra.r,i=ra.g,n=ra.b;return e!==Ta?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(n*255)})`}offsetHSL(e,t,i){return this.getHSL(Lh),this.setHSL(Lh.h+e,Lh.s+t,Lh.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Lh),e.getHSL(zC);let i=RM(Lh.h,zC.h,t),n=RM(Lh.s,zC.s,t),a=RM(Lh.l,zC.l,t);return this.setHSL(i,n,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,a=e.elements;return this.r=a[0]*t+a[3]*i+a[6]*n,this.g=a[1]*t+a[4]*i+a[7]*n,this.b=a[2]*t+a[5]*i+a[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},ra=new tr;tr.NAMES=ise;var hDe=0,Sc=class extends Fh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hDe++}),this.uuid=Yh(),this.name="",this.type="Material",this.blending=s0,this.side=zh,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=$B,this.blendDst=QB,this.blendEquation=fm,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tr(0,0,0),this.blendAlpha=0,this.depthFunc=tR,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Gae,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ky,this.stencilZFail=ky,this.stencilZPass=ky,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(n===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==s0&&(i.blending=this.blending),this.side!==zh&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==$B&&(i.blendSrc=this.blendSrc),this.blendDst!==QB&&(i.blendDst=this.blendDst),this.blendEquation!==fm&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==tR&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Gae&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ky&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ky&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ky&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function n(a){let o=[];for(let s in a){let l=a[s];delete l.metadata,o.push(l)}return o}if(t){let a=n(e.textures),o=n(e.images);a.length>0&&(i.textures=a),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let a=0;a!==n;++a)i[a]=t[a].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},pR=class extends Sc{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tr(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.envMapRotation=new zn,this.combine=UR,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};var Gi=new ye,FC=new yr,Rs=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Hae,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=fu,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return eDe("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,a=this.itemSize;n<a;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)FC.fromBufferAttribute(this,t),FC.applyMatrix3(e),this.setXY(t,FC.x,FC.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Gi.fromBufferAttribute(this,t),Gi.applyMatrix3(e),this.setXYZ(t,Gi.x,Gi.y,Gi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Gi.fromBufferAttribute(this,t),Gi.applyMatrix4(e),this.setXYZ(t,Gi.x,Gi.y,Gi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Gi.fromBufferAttribute(this,t),Gi.applyNormalMatrix(e),this.setXYZ(t,Gi.x,Gi.y,Gi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Gi.fromBufferAttribute(this,t),Gi.transformDirection(e),this.setXYZ(t,Gi.x,Gi.y,Gi.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=r0(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=ba(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=r0(t,this.array)),t}setX(e,t){return this.normalized&&(t=ba(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=r0(t,this.array)),t}setY(e,t){return this.normalized&&(t=ba(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=r0(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ba(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=r0(t,this.array)),t}setW(e,t){return this.normalized&&(t=ba(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=ba(t,this.array),i=ba(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=ba(t,this.array),i=ba(i,this.array),n=ba(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,a){return e*=this.itemSize,this.normalized&&(t=ba(t,this.array),i=ba(i,this.array),n=ba(n,this.array),a=ba(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Hae&&(e.usage=this.usage),e}};var m0=class extends Rs{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var dR=class extends Rs{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var Un=class extends Rs{constructor(e,t,i){super(new Float32Array(e),t,i)}},pDe=0,As=new Ht,BB=new ia,jy=new ye,ko=new Bh,EM=new Bh,vn=new ye,Ls=class r extends Fh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:pDe++}),this.uuid=Yh(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(rse(e)?dR:m0)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let a=new dr().getNormalMatrix(e);i.applyNormalMatrix(a),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return As.makeRotationFromQuaternion(e),this.applyMatrix4(As),this}rotateX(e){return As.makeRotationX(e),this.applyMatrix4(As),this}rotateY(e){return As.makeRotationY(e),this.applyMatrix4(As),this}rotateZ(e){return As.makeRotationZ(e),this.applyMatrix4(As),this}translate(e,t,i){return As.makeTranslation(e,t,i),this.applyMatrix4(As),this}scale(e,t,i){return As.makeScale(e,t,i),this.applyMatrix4(As),this}lookAt(e){return BB.lookAt(e),BB.updateMatrix(),this.applyMatrix4(BB.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(jy).negate(),this.translate(jy.x,jy.y,jy.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let a=e[i];t.push(a.x,a.y,a.z||0)}return this.setAttribute("position",new Un(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Bh);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ye(-1/0,-1/0,-1/0),new ye(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){let a=t[i];ko.setFromBufferAttribute(a),this.morphTargetsRelative?(vn.addVectors(this.boundingBox.min,ko.min),this.boundingBox.expandByPoint(vn),vn.addVectors(this.boundingBox.max,ko.max),this.boundingBox.expandByPoint(vn)):(this.boundingBox.expandByPoint(ko.min),this.boundingBox.expandByPoint(ko.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new kh);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ye,1/0);return}if(e){let i=this.boundingSphere.center;if(ko.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){let s=t[a];EM.setFromBufferAttribute(s),this.morphTargetsRelative?(vn.addVectors(ko.min,EM.min),ko.expandByPoint(vn),vn.addVectors(ko.max,EM.max),ko.expandByPoint(vn)):(ko.expandByPoint(EM.min),ko.expandByPoint(EM.max))}ko.getCenter(i);let n=0;for(let a=0,o=e.count;a<o;a++)vn.fromBufferAttribute(e,a),n=Math.max(n,i.distanceToSquared(vn));if(t)for(let a=0,o=t.length;a<o;a++){let s=t[a],l=this.morphTargetsRelative;for(let u=0,c=s.count;u<c;u++)vn.fromBufferAttribute(s,u),l&&(jy.fromBufferAttribute(e,u),vn.add(jy)),n=Math.max(n,i.distanceToSquared(vn))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,n=t.normal,a=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Rs(new Float32Array(4*i.count),4));let o=this.getAttribute("tangent"),s=[],l=[];for(let T=0;T<i.count;T++)s[T]=new ye,l[T]=new ye;let u=new ye,c=new ye,f=new ye,h=new yr,p=new yr,d=new yr,g=new ye,m=new ye;function v(T,C,b){u.fromBufferAttribute(i,T),c.fromBufferAttribute(i,C),f.fromBufferAttribute(i,b),h.fromBufferAttribute(a,T),p.fromBufferAttribute(a,C),d.fromBufferAttribute(a,b),c.sub(u),f.sub(u),p.sub(h),d.sub(h);let E=1/(p.x*d.y-d.x*p.y);isFinite(E)&&(g.copy(c).multiplyScalar(d.y).addScaledVector(f,-p.y).multiplyScalar(E),m.copy(f).multiplyScalar(p.x).addScaledVector(c,-d.x).multiplyScalar(E),s[T].add(g),s[C].add(g),s[b].add(g),l[T].add(m),l[C].add(m),l[b].add(m))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)v(e.getX(R+0),e.getX(R+1),e.getX(R+2))}let y=new ye,x=new ye,M=new ye,S=new ye;function w(T){M.fromBufferAttribute(n,T),S.copy(M);let C=s[T];y.copy(C),y.sub(M.multiplyScalar(M.dot(C))).normalize(),x.crossVectors(S,C);let E=x.dot(l[T])<0?-1:1;o.setXYZW(T,y.x,y.y,y.z,E)}for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)w(e.getX(R+0)),w(e.getX(R+1)),w(e.getX(R+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Rs(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);let n=new ye,a=new ye,o=new ye,s=new ye,l=new ye,u=new ye,c=new ye,f=new ye;if(e)for(let h=0,p=e.count;h<p;h+=3){let d=e.getX(h+0),g=e.getX(h+1),m=e.getX(h+2);n.fromBufferAttribute(t,d),a.fromBufferAttribute(t,g),o.fromBufferAttribute(t,m),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),s.fromBufferAttribute(i,d),l.fromBufferAttribute(i,g),u.fromBufferAttribute(i,m),s.add(c),l.add(c),u.add(c),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(g,l.x,l.y,l.z),i.setXYZ(m,u.x,u.y,u.z)}else for(let h=0,p=t.count;h<p;h+=3)n.fromBufferAttribute(t,h+0),a.fromBufferAttribute(t,h+1),o.fromBufferAttribute(t,h+2),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),i.setXYZ(h+0,c.x,c.y,c.z),i.setXYZ(h+1,c.x,c.y,c.z),i.setXYZ(h+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)vn.fromBufferAttribute(e,t),vn.normalize(),e.setXYZ(t,vn.x,vn.y,vn.z)}toNonIndexed(){function e(s,l){let u=s.array,c=s.itemSize,f=s.normalized,h=new u.constructor(l.length*c),p=0,d=0;for(let g=0,m=l.length;g<m;g++){s.isInterleavedBufferAttribute?p=l[g]*s.data.stride+s.offset:p=l[g]*c;for(let v=0;v<c;v++)h[d++]=u[p++]}return new Rs(h,c,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new r,i=this.index.array,n=this.attributes;for(let s in n){let l=n[s],u=e(l,i);t.setAttribute(s,u)}let a=this.morphAttributes;for(let s in a){let l=[],u=a[s];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=e(h,i);l.push(p)}t.morphAttributes[s]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let s=0,l=o.length;s<l;s++){let u=o[s];t.addGroup(u.start,u.count,u.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let l in i){let u=i[l];e.data.attributes[l]=u.toJSON(e.data)}let n={},a=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let f=0,h=u.length;f<h;f++){let p=u[f];c.push(p.toJSON(e.data))}c.length>0&&(n[l]=c,a=!0)}a&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let s=this.boundingSphere;return s!==null&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let u in n){let c=n[u];this.setAttribute(u,c.clone(t))}let a=e.morphAttributes;for(let u in a){let c=[],f=a[u];for(let h=0,p=f.length;h<p;h++)c.push(f[h].clone(t));this.morphAttributes[u]=c}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let u=0,c=o.length;u<c;u++){let f=o[u];this.addGroup(f.start,f.count,f.materialIndex)}let s=e.boundingBox;s!==null&&(this.boundingBox=s.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},ioe=new Ht,om=new NM,BC=new kh,noe=new ye,Ky=new ye,Jy=new ye,$y=new ye,kB=new ye,kC=new ye,VC=new yr,GC=new yr,HC=new yr,aoe=new ye,ooe=new ye,soe=new ye,WC=new ye,XC=new ye,co=class extends ia{constructor(e=new Ls,t=new pR){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a<o;a++){let s=n[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=a}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,a=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(a&&s){kC.set(0,0,0);for(let l=0,u=a.length;l<u;l++){let c=s[l],f=a[l];c!==0&&(kB.fromBufferAttribute(f,e),o?kC.addScaledVector(kB,c):kC.addScaledVector(kB.sub(t),c))}t.add(kC)}return t}raycast(e,t){let i=this.geometry,n=this.material,a=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),BC.copy(i.boundingSphere),BC.applyMatrix4(a),om.copy(e.ray).recast(e.near),!(BC.containsPoint(om.origin)===!1&&(om.intersectSphere(BC,noe)===null||om.origin.distanceToSquared(noe)>(e.far-e.near)**2))&&(ioe.copy(a).invert(),om.copy(e.ray).applyMatrix4(ioe),!(i.boundingBox!==null&&om.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,om)))}_computeIntersections(e,t,i){let n,a=this.geometry,o=this.material,s=a.index,l=a.attributes.position,u=a.attributes.uv,c=a.attributes.uv1,f=a.attributes.normal,h=a.groups,p=a.drawRange;if(s!==null)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(s.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=s.getX(x),w=s.getX(x+1),T=s.getX(x+2);n=YC(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(s.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=s.getX(m),y=s.getX(m+1),x=s.getX(m+2);n=YC(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}else if(l!==void 0)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=x,w=x+1,T=x+2;n=YC(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(l.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=m,y=m+1,x=m+2;n=YC(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}}};function dDe(r,e,t,i,n,a,o,s){let l;if(e.side===fo?l=i.intersectTriangle(o,a,n,!0,s):l=i.intersectTriangle(n,a,o,e.side===zh,s),l===null)return null;XC.copy(s),XC.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(XC);return u<t.near||u>t.far?null:{distance:u,point:XC.clone(),object:r}}function YC(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,Ky),r.getVertexPosition(l,Jy),r.getVertexPosition(u,$y);let c=dDe(r,e,t,i,Ky,Jy,$y,WC);if(c){n&&(VC.fromBufferAttribute(n,s),GC.fromBufferAttribute(n,l),HC.fromBufferAttribute(n,u),c.uv=i0.getInterpolation(WC,Ky,Jy,$y,VC,GC,HC,new yr)),a&&(VC.fromBufferAttribute(a,s),GC.fromBufferAttribute(a,l),HC.fromBufferAttribute(a,u),c.uv1=i0.getInterpolation(WC,Ky,Jy,$y,VC,GC,HC,new yr)),o&&(aoe.fromBufferAttribute(o,s),ooe.fromBufferAttribute(o,l),soe.fromBufferAttribute(o,u),c.normal=i0.getInterpolation(WC,Ky,Jy,$y,aoe,ooe,soe,new ye),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let f={a:s,b:l,c:u,normal:new ye,materialIndex:0};i0.getNormal(Ky,Jy,$y,f.normal),c.face=f}return c}var UM=class r extends Ls{constructor(e=1,t=1,i=1,n=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:a,depthSegments:o};let s=this;n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let l=[],u=[],c=[],f=[],h=0,p=0;d("z","y","x",-1,-1,i,t,e,o,a,0),d("z","y","x",1,-1,i,t,-e,o,a,1),d("x","z","y",1,1,e,i,t,n,o,2),d("x","z","y",1,-1,e,i,-t,n,o,3),d("x","y","z",1,-1,e,t,i,n,a,4),d("x","y","z",-1,-1,e,t,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new Un(u,3)),this.setAttribute("normal",new Un(c,3)),this.setAttribute("uv",new Un(f,2));function d(g,m,v,_,y,x,M,S,w,T,C){let b=x/w,E=M/T,I=x/2,R=M/2,A=S/2,D=w+1,U=T+1,B=0,z=0,k=new ye;for(let G=0;G<U;G++){let Y=G*E-R;for(let J=0;J<D;J++){let Q=J*b-I;k[g]=Q*_,k[m]=Y*y,k[v]=A,u.push(k.x,k.y,k.z),k[g]=0,k[m]=0,k[v]=S>0?1:-1,c.push(k.x,k.y,k.z),f.push(J/w),f.push(1-G/T),B+=1}}for(let G=0;G<T;G++)for(let Y=0;Y<w;Y++){let J=h+Y+D*G,Q=h+Y+D*(G+1),V=h+(Y+1)+D*(G+1),K=h+(Y+1)+D*G;l.push(J,Q,K),l.push(Q,V,K),z+=6}s.addGroup(p,z,C),p+=z,h+=B}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function v0(r){let e={};for(let t in r){e[t]={};for(let i in r[t]){let n=r[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}function wa(r){let e={};for(let t=0;t<r.length;t++){let i=v0(r[t]);for(let n in i)e[n]=i[n]}return e}function mDe(r){let e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function nse(r){return r.getRenderTarget()===null?r.outputColorSpace:$r.workingColorSpace}var vDe={clone:v0,merge:wa},gDe=`void main() {
  6547. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  6548. }`,yDe=`void main() {
  6549. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  6550. }`,hu=class extends Sc{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=gDe,this.fragmentShader=yDe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=v0(e.uniforms),this.uniformsGroups=mDe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let o=this.uniforms[n].value;o&&o.isTexture?t.uniforms[n]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[n]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[n]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[n]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[n]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[n]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[n]={type:"m4",value:o.toArray()}:t.uniforms[n]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let n in this.extensions)this.extensions[n]===!0&&(i[n]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},mR=class extends ia{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ht,this.projectionMatrix=new Ht,this.projectionMatrixInverse=new Ht,this.coordinateSystem=yc}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Ph=new ye,loe=new yr,uoe=new yr,Nn=class extends mR{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=d0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(CM*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return d0*2*Math.atan(Math.tan(CM*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Ph.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ph.x,Ph.y).multiplyScalar(-e/Ph.z),Ph.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ph.x,Ph.y).multiplyScalar(-e/Ph.z)}getViewSize(e,t){return this.getViewBounds(e,loe,uoe),t.subVectors(uoe,loe)}setViewOffset(e,t,i,n,a,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(CM*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,a=-.5*n,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,u=o.fullHeight;a+=o.offsetX*n/l,t-=o.offsetY*i/u,n*=o.width/l,i*=o.height/u}let s=this.filmOffset;s!==0&&(a+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Qy=-90,e0=1,ok=class extends ia{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Nn(Qy,e0,e,t);n.layers=this.layers,this.add(n);let a=new Nn(Qy,e0,e,t);a.layers=this.layers,this.add(a);let o=new Nn(Qy,e0,e,t);o.layers=this.layers,this.add(o);let s=new Nn(Qy,e0,e,t);s.layers=this.layers,this.add(s);let l=new Nn(Qy,e0,e,t);l.layers=this.layers,this.add(l);let u=new Nn(Qy,e0,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,a,o,s,l]=t;for(let u of t)this.remove(u);if(e===yc)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===sR)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[a,o,s,l,u,c]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let g=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,n),e.render(t,a),e.setRenderTarget(i,1,n),e.render(t,o),e.setRenderTarget(i,2,n),e.render(t,s),e.setRenderTarget(i,3,n),e.render(t,l),e.setRenderTarget(i,4,n),e.render(t,u),i.texture.generateMipmaps=g,e.setRenderTarget(i,5,n),e.render(t,c),e.setRenderTarget(f,h,p),e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}},vR=class extends Vo{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:c0,super(e,t,i,n,a,o,s,l,u,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},sk=class extends xc{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},n=[i,i,i,i,i,i];this.texture=new vR(n,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:lo}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
  6551. varying vec3 vWorldDirection;
  6552. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  6553. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  6554. }
  6555. void main() {
  6556. vWorldDirection = transformDirection( position, modelMatrix );
  6557. #include <begin_vertex>
  6558. #include <project_vertex>
  6559. }
  6560. `,fragmentShader:`
  6561. uniform sampler2D tEquirect;
  6562. varying vec3 vWorldDirection;
  6563. #include <common>
  6564. void main() {
  6565. vec3 direction = normalize( vWorldDirection );
  6566. vec2 sampleUV = equirectUv( direction );
  6567. gl_FragColor = texture2D( tEquirect, sampleUV );
  6568. }
  6569. `},n=new UM(5,5,5),a=new hu({name:"CubemapFromEquirect",uniforms:v0(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:fo,blending:Nh});a.uniforms.tEquirect.value=t;let o=new co(n,a),s=t.minFilter;return t.minFilter===pm&&(t.minFilter=lo),new ok(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,n){let a=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,n);e.setRenderTarget(a)}},VB=new ye,_De=new ye,xDe=new dr,vc=class{constructor(e=new ye(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=VB.subVectors(i,t).cross(_De.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(VB),n=this.normal.dot(i);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/n;return a<0||a>1?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||xDe.getNormalMatrix(e),n=this.coplanarPoint(VB).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},sm=new kh,qC=new ye,OM=class{constructor(e=new vc,t=new vc,i=new vc,n=new vc,a=new vc,o=new vc){this.planes=[e,t,i,n,a,o]}set(e,t,i,n,a,o){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(a),s[5].copy(o),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=yc){let i=this.planes,n=e.elements,a=n[0],o=n[1],s=n[2],l=n[3],u=n[4],c=n[5],f=n[6],h=n[7],p=n[8],d=n[9],g=n[10],m=n[11],v=n[12],_=n[13],y=n[14],x=n[15];if(i[0].setComponents(l-a,h-u,m-p,x-v).normalize(),i[1].setComponents(l+a,h+u,m+p,x+v).normalize(),i[2].setComponents(l+o,h+c,m+d,x+_).normalize(),i[3].setComponents(l-o,h-c,m-d,x-_).normalize(),i[4].setComponents(l-s,h-f,m-g,x-y).normalize(),t===yc)i[5].setComponents(l+s,h+f,m+g,x+y).normalize();else if(t===sR)i[5].setComponents(s,f,g,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),sm.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),sm.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(sm)}intersectsSprite(e){return sm.center.set(0,0,0),sm.radius=.7071067811865476,sm.applyMatrix4(e.matrixWorld),this.intersectsSphere(sm)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(qC.x=n.normal.x>0?e.max.x:e.min.x,qC.y=n.normal.y>0?e.max.y:e.min.y,qC.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(qC)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function ase(){let r=null,e=!1,t=null,i=null;function n(a,o){t(a,o),i=r.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&(i=r.requestAnimationFrame(n),e=!0)},stop:function(){r.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(a){t=a},setContext:function(a){r=a}}}function SDe(r,e){let t=e.isWebGL2,i=new WeakMap;function n(u,c){let f=u.array,h=u.usage,p=f.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,f,h),u.onUploadCallback();let g;if(f instanceof Float32Array)g=r.FLOAT;else if(f instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(t)g=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)g=r.SHORT;else if(f instanceof Uint32Array)g=r.UNSIGNED_INT;else if(f instanceof Int32Array)g=r.INT;else if(f instanceof Int8Array)g=r.BYTE;else if(f instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:d,type:g,bytesPerElement:f.BYTES_PER_ELEMENT,version:u.version,size:p}}function a(u,c,f){let h=c.array,p=c._updateRange,d=c.updateRanges;if(r.bindBuffer(f,u),p.count===-1&&d.length===0&&r.bufferSubData(f,0,h),d.length!==0){for(let g=0,m=d.length;g<m;g++){let v=d[g];t?r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count):r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h.subarray(v.start,v.start+v.count))}c.clearUpdateRanges()}p.count!==-1&&(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1),c.onUploadCallback()}function o(u){return u.isInterleavedBufferAttribute&&(u=u.data),i.get(u)}function s(u){u.isInterleavedBufferAttribute&&(u=u.data);let c=i.get(u);c&&(r.deleteBuffer(c.buffer),i.delete(u))}function l(u,c){if(u.isGLBufferAttribute){let h=i.get(u);(!h||h.version<u.version)&&i.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}u.isInterleavedBufferAttribute&&(u=u.data);let f=i.get(u);if(f===void 0)i.set(u,n(u,c));else if(f.version<u.version){if(f.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");a(f.buffer,u,c),f.version=u.version}}return{get:o,remove:s,update:l}}var gR=class r extends Ls{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let a=e/2,o=t/2,s=Math.floor(i),l=Math.floor(n),u=s+1,c=l+1,f=e/s,h=t/l,p=[],d=[],g=[],m=[];for(let v=0;v<c;v++){let _=v*h-o;for(let y=0;y<u;y++){let x=y*f-a;d.push(x,-_,0),g.push(0,0,1),m.push(y/s),m.push(1-v/l)}}for(let v=0;v<l;v++)for(let _=0;_<s;_++){let y=_+u*v,x=_+u*(v+1),M=_+1+u*(v+1),S=_+1+u*v;p.push(y,x,S),p.push(x,M,S)}this.setIndex(p),this.setAttribute("position",new Un(d,3)),this.setAttribute("normal",new Un(g,3)),this.setAttribute("uv",new Un(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.widthSegments,e.heightSegments)}},MDe=`#ifdef USE_ALPHAHASH
  6570. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  6571. #endif`,bDe=`#ifdef USE_ALPHAHASH
  6572. const float ALPHA_HASH_SCALE = 0.05;
  6573. float hash2D( vec2 value ) {
  6574. return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
  6575. }
  6576. float hash3D( vec3 value ) {
  6577. return hash2D( vec2( hash2D( value.xy ), value.z ) );
  6578. }
  6579. float getAlphaHashThreshold( vec3 position ) {
  6580. float maxDeriv = max(
  6581. length( dFdx( position.xyz ) ),
  6582. length( dFdy( position.xyz ) )
  6583. );
  6584. float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
  6585. vec2 pixScales = vec2(
  6586. exp2( floor( log2( pixScale ) ) ),
  6587. exp2( ceil( log2( pixScale ) ) )
  6588. );
  6589. vec2 alpha = vec2(
  6590. hash3D( floor( pixScales.x * position.xyz ) ),
  6591. hash3D( floor( pixScales.y * position.xyz ) )
  6592. );
  6593. float lerpFactor = fract( log2( pixScale ) );
  6594. float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
  6595. float a = min( lerpFactor, 1.0 - lerpFactor );
  6596. vec3 cases = vec3(
  6597. x * x / ( 2.0 * a * ( 1.0 - a ) ),
  6598. ( x - 0.5 * a ) / ( 1.0 - a ),
  6599. 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
  6600. );
  6601. float threshold = ( x < ( 1.0 - a ) )
  6602. ? ( ( x < a ) ? cases.x : cases.y )
  6603. : cases.z;
  6604. return clamp( threshold , 1.0e-6, 1.0 );
  6605. }
  6606. #endif`,wDe=`#ifdef USE_ALPHAMAP
  6607. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  6608. #endif`,TDe=`#ifdef USE_ALPHAMAP
  6609. uniform sampler2D alphaMap;
  6610. #endif`,EDe=`#ifdef USE_ALPHATEST
  6611. #ifdef ALPHA_TO_COVERAGE
  6612. diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
  6613. if ( diffuseColor.a == 0.0 ) discard;
  6614. #else
  6615. if ( diffuseColor.a < alphaTest ) discard;
  6616. #endif
  6617. #endif`,ADe=`#ifdef USE_ALPHATEST
  6618. uniform float alphaTest;
  6619. #endif`,CDe=`#ifdef USE_AOMAP
  6620. float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
  6621. reflectedLight.indirectDiffuse *= ambientOcclusion;
  6622. #if defined( USE_CLEARCOAT )
  6623. clearcoatSpecularIndirect *= ambientOcclusion;
  6624. #endif
  6625. #if defined( USE_SHEEN )
  6626. sheenSpecularIndirect *= ambientOcclusion;
  6627. #endif
  6628. #if defined( USE_ENVMAP ) && defined( STANDARD )
  6629. float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
  6630. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  6631. #endif
  6632. #endif`,RDe=`#ifdef USE_AOMAP
  6633. uniform sampler2D aoMap;
  6634. uniform float aoMapIntensity;
  6635. #endif`,LDe=`#ifdef USE_BATCHING
  6636. attribute float batchId;
  6637. uniform highp sampler2D batchingTexture;
  6638. mat4 getBatchingMatrix( const in float i ) {
  6639. int size = textureSize( batchingTexture, 0 ).x;
  6640. int j = int( i ) * 4;
  6641. int x = j % size;
  6642. int y = j / size;
  6643. vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
  6644. vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
  6645. vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
  6646. vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
  6647. return mat4( v1, v2, v3, v4 );
  6648. }
  6649. #endif`,PDe=`#ifdef USE_BATCHING
  6650. mat4 batchingMatrix = getBatchingMatrix( batchId );
  6651. #endif`,DDe=`vec3 transformed = vec3( position );
  6652. #ifdef USE_ALPHAHASH
  6653. vPosition = vec3( position );
  6654. #endif`,IDe=`vec3 objectNormal = vec3( normal );
  6655. #ifdef USE_TANGENT
  6656. vec3 objectTangent = vec3( tangent.xyz );
  6657. #endif`,NDe=`float G_BlinnPhong_Implicit( ) {
  6658. return 0.25;
  6659. }
  6660. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  6661. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  6662. }
  6663. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  6664. vec3 halfDir = normalize( lightDir + viewDir );
  6665. float dotNH = saturate( dot( normal, halfDir ) );
  6666. float dotVH = saturate( dot( viewDir, halfDir ) );
  6667. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  6668. float G = G_BlinnPhong_Implicit( );
  6669. float D = D_BlinnPhong( shininess, dotNH );
  6670. return F * ( G * D );
  6671. } // validated`,UDe=`#ifdef USE_IRIDESCENCE
  6672. const mat3 XYZ_TO_REC709 = mat3(
  6673. 3.2404542, -0.9692660, 0.0556434,
  6674. -1.5371385, 1.8760108, -0.2040259,
  6675. -0.4985314, 0.0415560, 1.0572252
  6676. );
  6677. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  6678. vec3 sqrtF0 = sqrt( fresnel0 );
  6679. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  6680. }
  6681. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  6682. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  6683. }
  6684. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  6685. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  6686. }
  6687. vec3 evalSensitivity( float OPD, vec3 shift ) {
  6688. float phase = 2.0 * PI * OPD * 1.0e-9;
  6689. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  6690. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  6691. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  6692. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  6693. xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
  6694. xyz /= 1.0685e-7;
  6695. vec3 rgb = XYZ_TO_REC709 * xyz;
  6696. return rgb;
  6697. }
  6698. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  6699. vec3 I;
  6700. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  6701. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  6702. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  6703. if ( cosTheta2Sq < 0.0 ) {
  6704. return vec3( 1.0 );
  6705. }
  6706. float cosTheta2 = sqrt( cosTheta2Sq );
  6707. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  6708. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  6709. float T121 = 1.0 - R12;
  6710. float phi12 = 0.0;
  6711. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  6712. float phi21 = PI - phi12;
  6713. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  6714. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  6715. vec3 phi23 = vec3( 0.0 );
  6716. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  6717. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  6718. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  6719. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  6720. vec3 phi = vec3( phi21 ) + phi23;
  6721. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  6722. vec3 r123 = sqrt( R123 );
  6723. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  6724. vec3 C0 = R12 + Rs;
  6725. I = C0;
  6726. vec3 Cm = Rs - T121;
  6727. for ( int m = 1; m <= 2; ++ m ) {
  6728. Cm *= r123;
  6729. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  6730. I += Cm * Sm;
  6731. }
  6732. return max( I, vec3( 0.0 ) );
  6733. }
  6734. #endif`,ODe=`#ifdef USE_BUMPMAP
  6735. uniform sampler2D bumpMap;
  6736. uniform float bumpScale;
  6737. vec2 dHdxy_fwd() {
  6738. vec2 dSTdx = dFdx( vBumpMapUv );
  6739. vec2 dSTdy = dFdy( vBumpMapUv );
  6740. float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
  6741. float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
  6742. float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
  6743. return vec2( dBx, dBy );
  6744. }
  6745. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  6746. vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
  6747. vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
  6748. vec3 vN = surf_norm;
  6749. vec3 R1 = cross( vSigmaY, vN );
  6750. vec3 R2 = cross( vN, vSigmaX );
  6751. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  6752. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  6753. return normalize( abs( fDet ) * surf_norm - vGrad );
  6754. }
  6755. #endif`,zDe=`#if NUM_CLIPPING_PLANES > 0
  6756. vec4 plane;
  6757. #ifdef ALPHA_TO_COVERAGE
  6758. float distanceToPlane, distanceGradient;
  6759. float clipOpacity = 1.0;
  6760. #pragma unroll_loop_start
  6761. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  6762. plane = clippingPlanes[ i ];
  6763. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  6764. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  6765. clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  6766. if ( clipOpacity == 0.0 ) discard;
  6767. }
  6768. #pragma unroll_loop_end
  6769. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  6770. float unionClipOpacity = 1.0;
  6771. #pragma unroll_loop_start
  6772. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  6773. plane = clippingPlanes[ i ];
  6774. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  6775. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  6776. unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  6777. }
  6778. #pragma unroll_loop_end
  6779. clipOpacity *= 1.0 - unionClipOpacity;
  6780. #endif
  6781. diffuseColor.a *= clipOpacity;
  6782. if ( diffuseColor.a == 0.0 ) discard;
  6783. #else
  6784. #pragma unroll_loop_start
  6785. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  6786. plane = clippingPlanes[ i ];
  6787. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  6788. }
  6789. #pragma unroll_loop_end
  6790. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  6791. bool clipped = true;
  6792. #pragma unroll_loop_start
  6793. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  6794. plane = clippingPlanes[ i ];
  6795. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  6796. }
  6797. #pragma unroll_loop_end
  6798. if ( clipped ) discard;
  6799. #endif
  6800. #endif
  6801. #endif`,FDe=`#if NUM_CLIPPING_PLANES > 0
  6802. varying vec3 vClipPosition;
  6803. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  6804. #endif`,BDe=`#if NUM_CLIPPING_PLANES > 0
  6805. varying vec3 vClipPosition;
  6806. #endif`,kDe=`#if NUM_CLIPPING_PLANES > 0
  6807. vClipPosition = - mvPosition.xyz;
  6808. #endif`,VDe=`#if defined( USE_COLOR_ALPHA )
  6809. diffuseColor *= vColor;
  6810. #elif defined( USE_COLOR )
  6811. diffuseColor.rgb *= vColor;
  6812. #endif`,GDe=`#if defined( USE_COLOR_ALPHA )
  6813. varying vec4 vColor;
  6814. #elif defined( USE_COLOR )
  6815. varying vec3 vColor;
  6816. #endif`,HDe=`#if defined( USE_COLOR_ALPHA )
  6817. varying vec4 vColor;
  6818. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  6819. varying vec3 vColor;
  6820. #endif`,WDe=`#if defined( USE_COLOR_ALPHA )
  6821. vColor = vec4( 1.0 );
  6822. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  6823. vColor = vec3( 1.0 );
  6824. #endif
  6825. #ifdef USE_COLOR
  6826. vColor *= color;
  6827. #endif
  6828. #ifdef USE_INSTANCING_COLOR
  6829. vColor.xyz *= instanceColor.xyz;
  6830. #endif`,XDe=`#define PI 3.141592653589793
  6831. #define PI2 6.283185307179586
  6832. #define PI_HALF 1.5707963267948966
  6833. #define RECIPROCAL_PI 0.3183098861837907
  6834. #define RECIPROCAL_PI2 0.15915494309189535
  6835. #define EPSILON 1e-6
  6836. #ifndef saturate
  6837. #define saturate( a ) clamp( a, 0.0, 1.0 )
  6838. #endif
  6839. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  6840. float pow2( const in float x ) { return x*x; }
  6841. vec3 pow2( const in vec3 x ) { return x*x; }
  6842. float pow3( const in float x ) { return x*x*x; }
  6843. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  6844. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  6845. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  6846. highp float rand( const in vec2 uv ) {
  6847. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  6848. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  6849. return fract( sin( sn ) * c );
  6850. }
  6851. #ifdef HIGH_PRECISION
  6852. float precisionSafeLength( vec3 v ) { return length( v ); }
  6853. #else
  6854. float precisionSafeLength( vec3 v ) {
  6855. float maxComponent = max3( abs( v ) );
  6856. return length( v / maxComponent ) * maxComponent;
  6857. }
  6858. #endif
  6859. struct IncidentLight {
  6860. vec3 color;
  6861. vec3 direction;
  6862. bool visible;
  6863. };
  6864. struct ReflectedLight {
  6865. vec3 directDiffuse;
  6866. vec3 directSpecular;
  6867. vec3 indirectDiffuse;
  6868. vec3 indirectSpecular;
  6869. };
  6870. #ifdef USE_ALPHAHASH
  6871. varying vec3 vPosition;
  6872. #endif
  6873. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  6874. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  6875. }
  6876. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  6877. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  6878. }
  6879. mat3 transposeMat3( const in mat3 m ) {
  6880. mat3 tmp;
  6881. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  6882. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  6883. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  6884. return tmp;
  6885. }
  6886. float luminance( const in vec3 rgb ) {
  6887. const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
  6888. return dot( weights, rgb );
  6889. }
  6890. bool isPerspectiveMatrix( mat4 m ) {
  6891. return m[ 2 ][ 3 ] == - 1.0;
  6892. }
  6893. vec2 equirectUv( in vec3 dir ) {
  6894. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  6895. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  6896. return vec2( u, v );
  6897. }
  6898. vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  6899. return RECIPROCAL_PI * diffuseColor;
  6900. }
  6901. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  6902. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  6903. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  6904. }
  6905. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  6906. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  6907. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  6908. } // validated`,YDe=`#ifdef ENVMAP_TYPE_CUBE_UV
  6909. #define cubeUV_minMipLevel 4.0
  6910. #define cubeUV_minTileSize 16.0
  6911. float getFace( vec3 direction ) {
  6912. vec3 absDirection = abs( direction );
  6913. float face = - 1.0;
  6914. if ( absDirection.x > absDirection.z ) {
  6915. if ( absDirection.x > absDirection.y )
  6916. face = direction.x > 0.0 ? 0.0 : 3.0;
  6917. else
  6918. face = direction.y > 0.0 ? 1.0 : 4.0;
  6919. } else {
  6920. if ( absDirection.z > absDirection.y )
  6921. face = direction.z > 0.0 ? 2.0 : 5.0;
  6922. else
  6923. face = direction.y > 0.0 ? 1.0 : 4.0;
  6924. }
  6925. return face;
  6926. }
  6927. vec2 getUV( vec3 direction, float face ) {
  6928. vec2 uv;
  6929. if ( face == 0.0 ) {
  6930. uv = vec2( direction.z, direction.y ) / abs( direction.x );
  6931. } else if ( face == 1.0 ) {
  6932. uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
  6933. } else if ( face == 2.0 ) {
  6934. uv = vec2( - direction.x, direction.y ) / abs( direction.z );
  6935. } else if ( face == 3.0 ) {
  6936. uv = vec2( - direction.z, direction.y ) / abs( direction.x );
  6937. } else if ( face == 4.0 ) {
  6938. uv = vec2( - direction.x, direction.z ) / abs( direction.y );
  6939. } else {
  6940. uv = vec2( direction.x, direction.y ) / abs( direction.z );
  6941. }
  6942. return 0.5 * ( uv + 1.0 );
  6943. }
  6944. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  6945. float face = getFace( direction );
  6946. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  6947. mipInt = max( mipInt, cubeUV_minMipLevel );
  6948. float faceSize = exp2( mipInt );
  6949. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
  6950. if ( face > 2.0 ) {
  6951. uv.y += faceSize;
  6952. face -= 3.0;
  6953. }
  6954. uv.x += face * faceSize;
  6955. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  6956. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  6957. uv.x *= CUBEUV_TEXEL_WIDTH;
  6958. uv.y *= CUBEUV_TEXEL_HEIGHT;
  6959. #ifdef texture2DGradEXT
  6960. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
  6961. #else
  6962. return texture2D( envMap, uv ).rgb;
  6963. #endif
  6964. }
  6965. #define cubeUV_r0 1.0
  6966. #define cubeUV_m0 - 2.0
  6967. #define cubeUV_r1 0.8
  6968. #define cubeUV_m1 - 1.0
  6969. #define cubeUV_r4 0.4
  6970. #define cubeUV_m4 2.0
  6971. #define cubeUV_r5 0.305
  6972. #define cubeUV_m5 3.0
  6973. #define cubeUV_r6 0.21
  6974. #define cubeUV_m6 4.0
  6975. float roughnessToMip( float roughness ) {
  6976. float mip = 0.0;
  6977. if ( roughness >= cubeUV_r1 ) {
  6978. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  6979. } else if ( roughness >= cubeUV_r4 ) {
  6980. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  6981. } else if ( roughness >= cubeUV_r5 ) {
  6982. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  6983. } else if ( roughness >= cubeUV_r6 ) {
  6984. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  6985. } else {
  6986. mip = - 2.0 * log2( 1.16 * roughness ); }
  6987. return mip;
  6988. }
  6989. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  6990. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  6991. float mipF = fract( mip );
  6992. float mipInt = floor( mip );
  6993. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  6994. if ( mipF == 0.0 ) {
  6995. return vec4( color0, 1.0 );
  6996. } else {
  6997. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  6998. return vec4( mix( color0, color1, mipF ), 1.0 );
  6999. }
  7000. }
  7001. #endif`,qDe=`vec3 transformedNormal = objectNormal;
  7002. #ifdef USE_TANGENT
  7003. vec3 transformedTangent = objectTangent;
  7004. #endif
  7005. #ifdef USE_BATCHING
  7006. mat3 bm = mat3( batchingMatrix );
  7007. transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
  7008. transformedNormal = bm * transformedNormal;
  7009. #ifdef USE_TANGENT
  7010. transformedTangent = bm * transformedTangent;
  7011. #endif
  7012. #endif
  7013. #ifdef USE_INSTANCING
  7014. mat3 im = mat3( instanceMatrix );
  7015. transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
  7016. transformedNormal = im * transformedNormal;
  7017. #ifdef USE_TANGENT
  7018. transformedTangent = im * transformedTangent;
  7019. #endif
  7020. #endif
  7021. transformedNormal = normalMatrix * transformedNormal;
  7022. #ifdef FLIP_SIDED
  7023. transformedNormal = - transformedNormal;
  7024. #endif
  7025. #ifdef USE_TANGENT
  7026. transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
  7027. #ifdef FLIP_SIDED
  7028. transformedTangent = - transformedTangent;
  7029. #endif
  7030. #endif`,ZDe=`#ifdef USE_DISPLACEMENTMAP
  7031. uniform sampler2D displacementMap;
  7032. uniform float displacementScale;
  7033. uniform float displacementBias;
  7034. #endif`,jDe=`#ifdef USE_DISPLACEMENTMAP
  7035. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  7036. #endif`,KDe=`#ifdef USE_EMISSIVEMAP
  7037. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  7038. totalEmissiveRadiance *= emissiveColor.rgb;
  7039. #endif`,JDe=`#ifdef USE_EMISSIVEMAP
  7040. uniform sampler2D emissiveMap;
  7041. #endif`,$De="gl_FragColor = linearToOutputTexel( gl_FragColor );",QDe=`
  7042. const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
  7043. vec3( 0.8224621, 0.177538, 0.0 ),
  7044. vec3( 0.0331941, 0.9668058, 0.0 ),
  7045. vec3( 0.0170827, 0.0723974, 0.9105199 )
  7046. );
  7047. const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
  7048. vec3( 1.2249401, - 0.2249404, 0.0 ),
  7049. vec3( - 0.0420569, 1.0420571, 0.0 ),
  7050. vec3( - 0.0196376, - 0.0786361, 1.0982735 )
  7051. );
  7052. vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
  7053. return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
  7054. }
  7055. vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
  7056. return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
  7057. }
  7058. vec4 LinearTransferOETF( in vec4 value ) {
  7059. return value;
  7060. }
  7061. vec4 sRGBTransferOETF( in vec4 value ) {
  7062. return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
  7063. }
  7064. vec4 LinearToLinear( in vec4 value ) {
  7065. return value;
  7066. }
  7067. vec4 LinearTosRGB( in vec4 value ) {
  7068. return sRGBTransferOETF( value );
  7069. }`,e2e=`#ifdef USE_ENVMAP
  7070. #ifdef ENV_WORLDPOS
  7071. vec3 cameraToFrag;
  7072. if ( isOrthographic ) {
  7073. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  7074. } else {
  7075. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  7076. }
  7077. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  7078. #ifdef ENVMAP_MODE_REFLECTION
  7079. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  7080. #else
  7081. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  7082. #endif
  7083. #else
  7084. vec3 reflectVec = vReflect;
  7085. #endif
  7086. #ifdef ENVMAP_TYPE_CUBE
  7087. vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  7088. #else
  7089. vec4 envColor = vec4( 0.0 );
  7090. #endif
  7091. #ifdef ENVMAP_BLENDING_MULTIPLY
  7092. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  7093. #elif defined( ENVMAP_BLENDING_MIX )
  7094. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  7095. #elif defined( ENVMAP_BLENDING_ADD )
  7096. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  7097. #endif
  7098. #endif`,t2e=`#ifdef USE_ENVMAP
  7099. uniform float envMapIntensity;
  7100. uniform float flipEnvMap;
  7101. uniform mat3 envMapRotation;
  7102. #ifdef ENVMAP_TYPE_CUBE
  7103. uniform samplerCube envMap;
  7104. #else
  7105. uniform sampler2D envMap;
  7106. #endif
  7107. #endif`,r2e=`#ifdef USE_ENVMAP
  7108. uniform float reflectivity;
  7109. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  7110. #define ENV_WORLDPOS
  7111. #endif
  7112. #ifdef ENV_WORLDPOS
  7113. varying vec3 vWorldPosition;
  7114. uniform float refractionRatio;
  7115. #else
  7116. varying vec3 vReflect;
  7117. #endif
  7118. #endif`,i2e=`#ifdef USE_ENVMAP
  7119. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  7120. #define ENV_WORLDPOS
  7121. #endif
  7122. #ifdef ENV_WORLDPOS
  7123. varying vec3 vWorldPosition;
  7124. #else
  7125. varying vec3 vReflect;
  7126. uniform float refractionRatio;
  7127. #endif
  7128. #endif`,n2e=`#ifdef USE_ENVMAP
  7129. #ifdef ENV_WORLDPOS
  7130. vWorldPosition = worldPosition.xyz;
  7131. #else
  7132. vec3 cameraToVertex;
  7133. if ( isOrthographic ) {
  7134. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  7135. } else {
  7136. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  7137. }
  7138. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  7139. #ifdef ENVMAP_MODE_REFLECTION
  7140. vReflect = reflect( cameraToVertex, worldNormal );
  7141. #else
  7142. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  7143. #endif
  7144. #endif
  7145. #endif`,a2e=`#ifdef USE_FOG
  7146. vFogDepth = - mvPosition.z;
  7147. #endif`,o2e=`#ifdef USE_FOG
  7148. varying float vFogDepth;
  7149. #endif`,s2e=`#ifdef USE_FOG
  7150. #ifdef FOG_EXP2
  7151. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  7152. #else
  7153. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  7154. #endif
  7155. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  7156. #endif`,l2e=`#ifdef USE_FOG
  7157. uniform vec3 fogColor;
  7158. varying float vFogDepth;
  7159. #ifdef FOG_EXP2
  7160. uniform float fogDensity;
  7161. #else
  7162. uniform float fogNear;
  7163. uniform float fogFar;
  7164. #endif
  7165. #endif`,u2e=`#ifdef USE_GRADIENTMAP
  7166. uniform sampler2D gradientMap;
  7167. #endif
  7168. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  7169. float dotNL = dot( normal, lightDirection );
  7170. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  7171. #ifdef USE_GRADIENTMAP
  7172. return vec3( texture2D( gradientMap, coord ).r );
  7173. #else
  7174. vec2 fw = fwidth( coord ) * 0.5;
  7175. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  7176. #endif
  7177. }`,c2e=`#ifdef USE_LIGHTMAP
  7178. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  7179. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  7180. reflectedLight.indirectDiffuse += lightMapIrradiance;
  7181. #endif`,f2e=`#ifdef USE_LIGHTMAP
  7182. uniform sampler2D lightMap;
  7183. uniform float lightMapIntensity;
  7184. #endif`,h2e=`LambertMaterial material;
  7185. material.diffuseColor = diffuseColor.rgb;
  7186. material.specularStrength = specularStrength;`,p2e=`varying vec3 vViewPosition;
  7187. struct LambertMaterial {
  7188. vec3 diffuseColor;
  7189. float specularStrength;
  7190. };
  7191. void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  7192. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  7193. vec3 irradiance = dotNL * directLight.color;
  7194. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7195. }
  7196. void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  7197. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7198. }
  7199. #define RE_Direct RE_Direct_Lambert
  7200. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,d2e=`uniform bool receiveShadow;
  7201. uniform vec3 ambientLightColor;
  7202. #if defined( USE_LIGHT_PROBES )
  7203. uniform vec3 lightProbe[ 9 ];
  7204. #endif
  7205. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  7206. float x = normal.x, y = normal.y, z = normal.z;
  7207. vec3 result = shCoefficients[ 0 ] * 0.886227;
  7208. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  7209. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  7210. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  7211. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  7212. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  7213. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  7214. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  7215. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  7216. return result;
  7217. }
  7218. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  7219. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  7220. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  7221. return irradiance;
  7222. }
  7223. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  7224. vec3 irradiance = ambientLightColor;
  7225. return irradiance;
  7226. }
  7227. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  7228. #if defined ( LEGACY_LIGHTS )
  7229. if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
  7230. return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
  7231. }
  7232. return 1.0;
  7233. #else
  7234. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  7235. if ( cutoffDistance > 0.0 ) {
  7236. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  7237. }
  7238. return distanceFalloff;
  7239. #endif
  7240. }
  7241. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  7242. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  7243. }
  7244. #if NUM_DIR_LIGHTS > 0
  7245. struct DirectionalLight {
  7246. vec3 direction;
  7247. vec3 color;
  7248. };
  7249. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  7250. void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
  7251. light.color = directionalLight.color;
  7252. light.direction = directionalLight.direction;
  7253. light.visible = true;
  7254. }
  7255. #endif
  7256. #if NUM_POINT_LIGHTS > 0
  7257. struct PointLight {
  7258. vec3 position;
  7259. vec3 color;
  7260. float distance;
  7261. float decay;
  7262. };
  7263. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  7264. void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
  7265. vec3 lVector = pointLight.position - geometryPosition;
  7266. light.direction = normalize( lVector );
  7267. float lightDistance = length( lVector );
  7268. light.color = pointLight.color;
  7269. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  7270. light.visible = ( light.color != vec3( 0.0 ) );
  7271. }
  7272. #endif
  7273. #if NUM_SPOT_LIGHTS > 0
  7274. struct SpotLight {
  7275. vec3 position;
  7276. vec3 direction;
  7277. vec3 color;
  7278. float distance;
  7279. float decay;
  7280. float coneCos;
  7281. float penumbraCos;
  7282. };
  7283. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  7284. void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
  7285. vec3 lVector = spotLight.position - geometryPosition;
  7286. light.direction = normalize( lVector );
  7287. float angleCos = dot( light.direction, spotLight.direction );
  7288. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  7289. if ( spotAttenuation > 0.0 ) {
  7290. float lightDistance = length( lVector );
  7291. light.color = spotLight.color * spotAttenuation;
  7292. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  7293. light.visible = ( light.color != vec3( 0.0 ) );
  7294. } else {
  7295. light.color = vec3( 0.0 );
  7296. light.visible = false;
  7297. }
  7298. }
  7299. #endif
  7300. #if NUM_RECT_AREA_LIGHTS > 0
  7301. struct RectAreaLight {
  7302. vec3 color;
  7303. vec3 position;
  7304. vec3 halfWidth;
  7305. vec3 halfHeight;
  7306. };
  7307. uniform sampler2D ltc_1; uniform sampler2D ltc_2;
  7308. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  7309. #endif
  7310. #if NUM_HEMI_LIGHTS > 0
  7311. struct HemisphereLight {
  7312. vec3 direction;
  7313. vec3 skyColor;
  7314. vec3 groundColor;
  7315. };
  7316. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  7317. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  7318. float dotNL = dot( normal, hemiLight.direction );
  7319. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  7320. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  7321. return irradiance;
  7322. }
  7323. #endif`,m2e=`#ifdef USE_ENVMAP
  7324. vec3 getIBLIrradiance( const in vec3 normal ) {
  7325. #ifdef ENVMAP_TYPE_CUBE_UV
  7326. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  7327. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
  7328. return PI * envMapColor.rgb * envMapIntensity;
  7329. #else
  7330. return vec3( 0.0 );
  7331. #endif
  7332. }
  7333. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  7334. #ifdef ENVMAP_TYPE_CUBE_UV
  7335. vec3 reflectVec = reflect( - viewDir, normal );
  7336. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  7337. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  7338. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
  7339. return envMapColor.rgb * envMapIntensity;
  7340. #else
  7341. return vec3( 0.0 );
  7342. #endif
  7343. }
  7344. #ifdef USE_ANISOTROPY
  7345. vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
  7346. #ifdef ENVMAP_TYPE_CUBE_UV
  7347. vec3 bentNormal = cross( bitangent, viewDir );
  7348. bentNormal = normalize( cross( bentNormal, bitangent ) );
  7349. bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
  7350. return getIBLRadiance( viewDir, bentNormal, roughness );
  7351. #else
  7352. return vec3( 0.0 );
  7353. #endif
  7354. }
  7355. #endif
  7356. #endif`,v2e=`ToonMaterial material;
  7357. material.diffuseColor = diffuseColor.rgb;`,g2e=`varying vec3 vViewPosition;
  7358. struct ToonMaterial {
  7359. vec3 diffuseColor;
  7360. };
  7361. void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  7362. vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
  7363. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7364. }
  7365. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  7366. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7367. }
  7368. #define RE_Direct RE_Direct_Toon
  7369. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,y2e=`BlinnPhongMaterial material;
  7370. material.diffuseColor = diffuseColor.rgb;
  7371. material.specularColor = specular;
  7372. material.specularShininess = shininess;
  7373. material.specularStrength = specularStrength;`,_2e=`varying vec3 vViewPosition;
  7374. struct BlinnPhongMaterial {
  7375. vec3 diffuseColor;
  7376. vec3 specularColor;
  7377. float specularShininess;
  7378. float specularStrength;
  7379. };
  7380. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  7381. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  7382. vec3 irradiance = dotNL * directLight.color;
  7383. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7384. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
  7385. }
  7386. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  7387. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7388. }
  7389. #define RE_Direct RE_Direct_BlinnPhong
  7390. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,x2e=`PhysicalMaterial material;
  7391. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  7392. vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
  7393. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  7394. material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
  7395. material.roughness = min( material.roughness, 1.0 );
  7396. #ifdef IOR
  7397. material.ior = ior;
  7398. #ifdef USE_SPECULAR
  7399. float specularIntensityFactor = specularIntensity;
  7400. vec3 specularColorFactor = specularColor;
  7401. #ifdef USE_SPECULAR_COLORMAP
  7402. specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
  7403. #endif
  7404. #ifdef USE_SPECULAR_INTENSITYMAP
  7405. specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
  7406. #endif
  7407. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  7408. #else
  7409. float specularIntensityFactor = 1.0;
  7410. vec3 specularColorFactor = vec3( 1.0 );
  7411. material.specularF90 = 1.0;
  7412. #endif
  7413. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  7414. #else
  7415. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  7416. material.specularF90 = 1.0;
  7417. #endif
  7418. #ifdef USE_CLEARCOAT
  7419. material.clearcoat = clearcoat;
  7420. material.clearcoatRoughness = clearcoatRoughness;
  7421. material.clearcoatF0 = vec3( 0.04 );
  7422. material.clearcoatF90 = 1.0;
  7423. #ifdef USE_CLEARCOATMAP
  7424. material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
  7425. #endif
  7426. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  7427. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
  7428. #endif
  7429. material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  7430. material.clearcoatRoughness += geometryRoughness;
  7431. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  7432. #endif
  7433. #ifdef USE_IRIDESCENCE
  7434. material.iridescence = iridescence;
  7435. material.iridescenceIOR = iridescenceIOR;
  7436. #ifdef USE_IRIDESCENCEMAP
  7437. material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
  7438. #endif
  7439. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  7440. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
  7441. #else
  7442. material.iridescenceThickness = iridescenceThicknessMaximum;
  7443. #endif
  7444. #endif
  7445. #ifdef USE_SHEEN
  7446. material.sheenColor = sheenColor;
  7447. #ifdef USE_SHEEN_COLORMAP
  7448. material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
  7449. #endif
  7450. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  7451. #ifdef USE_SHEEN_ROUGHNESSMAP
  7452. material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
  7453. #endif
  7454. #endif
  7455. #ifdef USE_ANISOTROPY
  7456. #ifdef USE_ANISOTROPYMAP
  7457. mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
  7458. vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
  7459. vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
  7460. #else
  7461. vec2 anisotropyV = anisotropyVector;
  7462. #endif
  7463. material.anisotropy = length( anisotropyV );
  7464. if( material.anisotropy == 0.0 ) {
  7465. anisotropyV = vec2( 1.0, 0.0 );
  7466. } else {
  7467. anisotropyV /= material.anisotropy;
  7468. material.anisotropy = saturate( material.anisotropy );
  7469. }
  7470. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
  7471. material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
  7472. material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
  7473. #endif`,S2e=`struct PhysicalMaterial {
  7474. vec3 diffuseColor;
  7475. float roughness;
  7476. vec3 specularColor;
  7477. float specularF90;
  7478. #ifdef USE_CLEARCOAT
  7479. float clearcoat;
  7480. float clearcoatRoughness;
  7481. vec3 clearcoatF0;
  7482. float clearcoatF90;
  7483. #endif
  7484. #ifdef USE_IRIDESCENCE
  7485. float iridescence;
  7486. float iridescenceIOR;
  7487. float iridescenceThickness;
  7488. vec3 iridescenceFresnel;
  7489. vec3 iridescenceF0;
  7490. #endif
  7491. #ifdef USE_SHEEN
  7492. vec3 sheenColor;
  7493. float sheenRoughness;
  7494. #endif
  7495. #ifdef IOR
  7496. float ior;
  7497. #endif
  7498. #ifdef USE_TRANSMISSION
  7499. float transmission;
  7500. float transmissionAlpha;
  7501. float thickness;
  7502. float attenuationDistance;
  7503. vec3 attenuationColor;
  7504. #endif
  7505. #ifdef USE_ANISOTROPY
  7506. float anisotropy;
  7507. float alphaT;
  7508. vec3 anisotropyT;
  7509. vec3 anisotropyB;
  7510. #endif
  7511. };
  7512. vec3 clearcoatSpecularDirect = vec3( 0.0 );
  7513. vec3 clearcoatSpecularIndirect = vec3( 0.0 );
  7514. vec3 sheenSpecularDirect = vec3( 0.0 );
  7515. vec3 sheenSpecularIndirect = vec3(0.0 );
  7516. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  7517. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  7518. float x2 = x * x;
  7519. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  7520. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  7521. }
  7522. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  7523. float a2 = pow2( alpha );
  7524. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  7525. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  7526. return 0.5 / max( gv + gl, EPSILON );
  7527. }
  7528. float D_GGX( const in float alpha, const in float dotNH ) {
  7529. float a2 = pow2( alpha );
  7530. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  7531. return RECIPROCAL_PI * a2 / pow2( denom );
  7532. }
  7533. #ifdef USE_ANISOTROPY
  7534. float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
  7535. float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
  7536. float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
  7537. float v = 0.5 / ( gv + gl );
  7538. return saturate(v);
  7539. }
  7540. float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
  7541. float a2 = alphaT * alphaB;
  7542. highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
  7543. highp float v2 = dot( v, v );
  7544. float w2 = a2 / v2;
  7545. return RECIPROCAL_PI * a2 * pow2 ( w2 );
  7546. }
  7547. #endif
  7548. #ifdef USE_CLEARCOAT
  7549. vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
  7550. vec3 f0 = material.clearcoatF0;
  7551. float f90 = material.clearcoatF90;
  7552. float roughness = material.clearcoatRoughness;
  7553. float alpha = pow2( roughness );
  7554. vec3 halfDir = normalize( lightDir + viewDir );
  7555. float dotNL = saturate( dot( normal, lightDir ) );
  7556. float dotNV = saturate( dot( normal, viewDir ) );
  7557. float dotNH = saturate( dot( normal, halfDir ) );
  7558. float dotVH = saturate( dot( viewDir, halfDir ) );
  7559. vec3 F = F_Schlick( f0, f90, dotVH );
  7560. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  7561. float D = D_GGX( alpha, dotNH );
  7562. return F * ( V * D );
  7563. }
  7564. #endif
  7565. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  7566. vec3 f0 = material.specularColor;
  7567. float f90 = material.specularF90;
  7568. float roughness = material.roughness;
  7569. float alpha = pow2( roughness );
  7570. vec3 halfDir = normalize( lightDir + viewDir );
  7571. float dotNL = saturate( dot( normal, lightDir ) );
  7572. float dotNV = saturate( dot( normal, viewDir ) );
  7573. float dotNH = saturate( dot( normal, halfDir ) );
  7574. float dotVH = saturate( dot( viewDir, halfDir ) );
  7575. vec3 F = F_Schlick( f0, f90, dotVH );
  7576. #ifdef USE_IRIDESCENCE
  7577. F = mix( F, material.iridescenceFresnel, material.iridescence );
  7578. #endif
  7579. #ifdef USE_ANISOTROPY
  7580. float dotTL = dot( material.anisotropyT, lightDir );
  7581. float dotTV = dot( material.anisotropyT, viewDir );
  7582. float dotTH = dot( material.anisotropyT, halfDir );
  7583. float dotBL = dot( material.anisotropyB, lightDir );
  7584. float dotBV = dot( material.anisotropyB, viewDir );
  7585. float dotBH = dot( material.anisotropyB, halfDir );
  7586. float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
  7587. float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
  7588. #else
  7589. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  7590. float D = D_GGX( alpha, dotNH );
  7591. #endif
  7592. return F * ( V * D );
  7593. }
  7594. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  7595. const float LUT_SIZE = 64.0;
  7596. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  7597. const float LUT_BIAS = 0.5 / LUT_SIZE;
  7598. float dotNV = saturate( dot( N, V ) );
  7599. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  7600. uv = uv * LUT_SCALE + LUT_BIAS;
  7601. return uv;
  7602. }
  7603. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  7604. float l = length( f );
  7605. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  7606. }
  7607. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  7608. float x = dot( v1, v2 );
  7609. float y = abs( x );
  7610. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  7611. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  7612. float v = a / b;
  7613. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  7614. return cross( v1, v2 ) * theta_sintheta;
  7615. }
  7616. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  7617. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  7618. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  7619. vec3 lightNormal = cross( v1, v2 );
  7620. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  7621. vec3 T1, T2;
  7622. T1 = normalize( V - N * dot( V, N ) );
  7623. T2 = - cross( N, T1 );
  7624. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  7625. vec3 coords[ 4 ];
  7626. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  7627. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  7628. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  7629. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  7630. coords[ 0 ] = normalize( coords[ 0 ] );
  7631. coords[ 1 ] = normalize( coords[ 1 ] );
  7632. coords[ 2 ] = normalize( coords[ 2 ] );
  7633. coords[ 3 ] = normalize( coords[ 3 ] );
  7634. vec3 vectorFormFactor = vec3( 0.0 );
  7635. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  7636. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  7637. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  7638. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  7639. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  7640. return vec3( result );
  7641. }
  7642. #if defined( USE_SHEEN )
  7643. float D_Charlie( float roughness, float dotNH ) {
  7644. float alpha = pow2( roughness );
  7645. float invAlpha = 1.0 / alpha;
  7646. float cos2h = dotNH * dotNH;
  7647. float sin2h = max( 1.0 - cos2h, 0.0078125 );
  7648. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  7649. }
  7650. float V_Neubelt( float dotNV, float dotNL ) {
  7651. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  7652. }
  7653. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  7654. vec3 halfDir = normalize( lightDir + viewDir );
  7655. float dotNL = saturate( dot( normal, lightDir ) );
  7656. float dotNV = saturate( dot( normal, viewDir ) );
  7657. float dotNH = saturate( dot( normal, halfDir ) );
  7658. float D = D_Charlie( sheenRoughness, dotNH );
  7659. float V = V_Neubelt( dotNV, dotNL );
  7660. return sheenColor * ( D * V );
  7661. }
  7662. #endif
  7663. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  7664. float dotNV = saturate( dot( normal, viewDir ) );
  7665. float r2 = roughness * roughness;
  7666. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  7667. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  7668. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  7669. return saturate( DG * RECIPROCAL_PI );
  7670. }
  7671. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  7672. float dotNV = saturate( dot( normal, viewDir ) );
  7673. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  7674. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  7675. vec4 r = roughness * c0 + c1;
  7676. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  7677. vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
  7678. return fab;
  7679. }
  7680. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  7681. vec2 fab = DFGApprox( normal, viewDir, roughness );
  7682. return specularColor * fab.x + specularF90 * fab.y;
  7683. }
  7684. #ifdef USE_IRIDESCENCE
  7685. void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  7686. #else
  7687. void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  7688. #endif
  7689. vec2 fab = DFGApprox( normal, viewDir, roughness );
  7690. #ifdef USE_IRIDESCENCE
  7691. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  7692. #else
  7693. vec3 Fr = specularColor;
  7694. #endif
  7695. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  7696. float Ess = fab.x + fab.y;
  7697. float Ems = 1.0 - Ess;
  7698. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  7699. singleScatter += FssEss;
  7700. multiScatter += Fms * Ems;
  7701. }
  7702. #if NUM_RECT_AREA_LIGHTS > 0
  7703. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  7704. vec3 normal = geometryNormal;
  7705. vec3 viewDir = geometryViewDir;
  7706. vec3 position = geometryPosition;
  7707. vec3 lightPos = rectAreaLight.position;
  7708. vec3 halfWidth = rectAreaLight.halfWidth;
  7709. vec3 halfHeight = rectAreaLight.halfHeight;
  7710. vec3 lightColor = rectAreaLight.color;
  7711. float roughness = material.roughness;
  7712. vec3 rectCoords[ 4 ];
  7713. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  7714. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  7715. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  7716. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  7717. vec4 t1 = texture2D( ltc_1, uv );
  7718. vec4 t2 = texture2D( ltc_2, uv );
  7719. mat3 mInv = mat3(
  7720. vec3( t1.x, 0, t1.y ),
  7721. vec3( 0, 1, 0 ),
  7722. vec3( t1.z, 0, t1.w )
  7723. );
  7724. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  7725. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  7726. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  7727. }
  7728. #endif
  7729. void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  7730. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  7731. vec3 irradiance = dotNL * directLight.color;
  7732. #ifdef USE_CLEARCOAT
  7733. float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
  7734. vec3 ccIrradiance = dotNLcc * directLight.color;
  7735. clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
  7736. #endif
  7737. #ifdef USE_SHEEN
  7738. sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
  7739. #endif
  7740. reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
  7741. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7742. }
  7743. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  7744. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7745. }
  7746. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  7747. #ifdef USE_CLEARCOAT
  7748. clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  7749. #endif
  7750. #ifdef USE_SHEEN
  7751. sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
  7752. #endif
  7753. vec3 singleScattering = vec3( 0.0 );
  7754. vec3 multiScattering = vec3( 0.0 );
  7755. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  7756. #ifdef USE_IRIDESCENCE
  7757. computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  7758. #else
  7759. computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  7760. #endif
  7761. vec3 totalScattering = singleScattering + multiScattering;
  7762. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  7763. reflectedLight.indirectSpecular += radiance * singleScattering;
  7764. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  7765. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  7766. }
  7767. #define RE_Direct RE_Direct_Physical
  7768. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  7769. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  7770. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  7771. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  7772. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  7773. }`,M2e=`
  7774. vec3 geometryPosition = - vViewPosition;
  7775. vec3 geometryNormal = normal;
  7776. vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  7777. vec3 geometryClearcoatNormal = vec3( 0.0 );
  7778. #ifdef USE_CLEARCOAT
  7779. geometryClearcoatNormal = clearcoatNormal;
  7780. #endif
  7781. #ifdef USE_IRIDESCENCE
  7782. float dotNVi = saturate( dot( normal, geometryViewDir ) );
  7783. if ( material.iridescenceThickness == 0.0 ) {
  7784. material.iridescence = 0.0;
  7785. } else {
  7786. material.iridescence = saturate( material.iridescence );
  7787. }
  7788. if ( material.iridescence > 0.0 ) {
  7789. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  7790. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  7791. }
  7792. #endif
  7793. IncidentLight directLight;
  7794. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  7795. PointLight pointLight;
  7796. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  7797. PointLightShadow pointLightShadow;
  7798. #endif
  7799. #pragma unroll_loop_start
  7800. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  7801. pointLight = pointLights[ i ];
  7802. getPointLightInfo( pointLight, geometryPosition, directLight );
  7803. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  7804. pointLightShadow = pointLightShadows[ i ];
  7805. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  7806. #endif
  7807. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7808. }
  7809. #pragma unroll_loop_end
  7810. #endif
  7811. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  7812. SpotLight spotLight;
  7813. vec4 spotColor;
  7814. vec3 spotLightCoord;
  7815. bool inSpotLightMap;
  7816. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  7817. SpotLightShadow spotLightShadow;
  7818. #endif
  7819. #pragma unroll_loop_start
  7820. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  7821. spotLight = spotLights[ i ];
  7822. getSpotLightInfo( spotLight, geometryPosition, directLight );
  7823. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  7824. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  7825. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  7826. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  7827. #else
  7828. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  7829. #endif
  7830. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  7831. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  7832. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  7833. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  7834. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  7835. #endif
  7836. #undef SPOT_LIGHT_MAP_INDEX
  7837. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  7838. spotLightShadow = spotLightShadows[ i ];
  7839. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  7840. #endif
  7841. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7842. }
  7843. #pragma unroll_loop_end
  7844. #endif
  7845. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  7846. DirectionalLight directionalLight;
  7847. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  7848. DirectionalLightShadow directionalLightShadow;
  7849. #endif
  7850. #pragma unroll_loop_start
  7851. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  7852. directionalLight = directionalLights[ i ];
  7853. getDirectionalLightInfo( directionalLight, directLight );
  7854. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  7855. directionalLightShadow = directionalLightShadows[ i ];
  7856. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  7857. #endif
  7858. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7859. }
  7860. #pragma unroll_loop_end
  7861. #endif
  7862. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  7863. RectAreaLight rectAreaLight;
  7864. #pragma unroll_loop_start
  7865. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  7866. rectAreaLight = rectAreaLights[ i ];
  7867. RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7868. }
  7869. #pragma unroll_loop_end
  7870. #endif
  7871. #if defined( RE_IndirectDiffuse )
  7872. vec3 iblIrradiance = vec3( 0.0 );
  7873. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  7874. #if defined( USE_LIGHT_PROBES )
  7875. irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
  7876. #endif
  7877. #if ( NUM_HEMI_LIGHTS > 0 )
  7878. #pragma unroll_loop_start
  7879. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  7880. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
  7881. }
  7882. #pragma unroll_loop_end
  7883. #endif
  7884. #endif
  7885. #if defined( RE_IndirectSpecular )
  7886. vec3 radiance = vec3( 0.0 );
  7887. vec3 clearcoatRadiance = vec3( 0.0 );
  7888. #endif`,b2e=`#if defined( RE_IndirectDiffuse )
  7889. #ifdef USE_LIGHTMAP
  7890. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  7891. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  7892. irradiance += lightMapIrradiance;
  7893. #endif
  7894. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  7895. iblIrradiance += getIBLIrradiance( geometryNormal );
  7896. #endif
  7897. #endif
  7898. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  7899. #ifdef USE_ANISOTROPY
  7900. radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
  7901. #else
  7902. radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
  7903. #endif
  7904. #ifdef USE_CLEARCOAT
  7905. clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
  7906. #endif
  7907. #endif`,w2e=`#if defined( RE_IndirectDiffuse )
  7908. RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7909. #endif
  7910. #if defined( RE_IndirectSpecular )
  7911. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7912. #endif`,T2e=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  7913. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  7914. #endif`,E2e=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  7915. uniform float logDepthBufFC;
  7916. varying float vFragDepth;
  7917. varying float vIsPerspective;
  7918. #endif`,A2e=`#ifdef USE_LOGDEPTHBUF
  7919. #ifdef USE_LOGDEPTHBUF_EXT
  7920. varying float vFragDepth;
  7921. varying float vIsPerspective;
  7922. #else
  7923. uniform float logDepthBufFC;
  7924. #endif
  7925. #endif`,C2e=`#ifdef USE_LOGDEPTHBUF
  7926. #ifdef USE_LOGDEPTHBUF_EXT
  7927. vFragDepth = 1.0 + gl_Position.w;
  7928. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  7929. #else
  7930. if ( isPerspectiveMatrix( projectionMatrix ) ) {
  7931. gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
  7932. gl_Position.z *= gl_Position.w;
  7933. }
  7934. #endif
  7935. #endif`,R2e=`#ifdef USE_MAP
  7936. vec4 sampledDiffuseColor = texture2D( map, vMapUv );
  7937. #ifdef DECODE_VIDEO_TEXTURE
  7938. sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
  7939. #endif
  7940. diffuseColor *= sampledDiffuseColor;
  7941. #endif`,L2e=`#ifdef USE_MAP
  7942. uniform sampler2D map;
  7943. #endif`,P2e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  7944. #if defined( USE_POINTS_UV )
  7945. vec2 uv = vUv;
  7946. #else
  7947. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  7948. #endif
  7949. #endif
  7950. #ifdef USE_MAP
  7951. diffuseColor *= texture2D( map, uv );
  7952. #endif
  7953. #ifdef USE_ALPHAMAP
  7954. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  7955. #endif`,D2e=`#if defined( USE_POINTS_UV )
  7956. varying vec2 vUv;
  7957. #else
  7958. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  7959. uniform mat3 uvTransform;
  7960. #endif
  7961. #endif
  7962. #ifdef USE_MAP
  7963. uniform sampler2D map;
  7964. #endif
  7965. #ifdef USE_ALPHAMAP
  7966. uniform sampler2D alphaMap;
  7967. #endif`,I2e=`float metalnessFactor = metalness;
  7968. #ifdef USE_METALNESSMAP
  7969. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  7970. metalnessFactor *= texelMetalness.b;
  7971. #endif`,N2e=`#ifdef USE_METALNESSMAP
  7972. uniform sampler2D metalnessMap;
  7973. #endif`,U2e=`#ifdef USE_INSTANCING_MORPH
  7974. float morphTargetInfluences[MORPHTARGETS_COUNT];
  7975. float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
  7976. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  7977. morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
  7978. }
  7979. #endif`,O2e=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
  7980. vColor *= morphTargetBaseInfluence;
  7981. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  7982. #if defined( USE_COLOR_ALPHA )
  7983. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  7984. #elif defined( USE_COLOR )
  7985. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  7986. #endif
  7987. }
  7988. #endif`,z2e=`#ifdef USE_MORPHNORMALS
  7989. objectNormal *= morphTargetBaseInfluence;
  7990. #ifdef MORPHTARGETS_TEXTURE
  7991. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  7992. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  7993. }
  7994. #else
  7995. objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
  7996. objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
  7997. objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
  7998. objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
  7999. #endif
  8000. #endif`,F2e=`#ifdef USE_MORPHTARGETS
  8001. #ifndef USE_INSTANCING_MORPH
  8002. uniform float morphTargetBaseInfluence;
  8003. #endif
  8004. #ifdef MORPHTARGETS_TEXTURE
  8005. #ifndef USE_INSTANCING_MORPH
  8006. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  8007. #endif
  8008. uniform sampler2DArray morphTargetsTexture;
  8009. uniform ivec2 morphTargetsTextureSize;
  8010. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  8011. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  8012. int y = texelIndex / morphTargetsTextureSize.x;
  8013. int x = texelIndex - y * morphTargetsTextureSize.x;
  8014. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  8015. return texelFetch( morphTargetsTexture, morphUV, 0 );
  8016. }
  8017. #else
  8018. #ifndef USE_MORPHNORMALS
  8019. uniform float morphTargetInfluences[ 8 ];
  8020. #else
  8021. uniform float morphTargetInfluences[ 4 ];
  8022. #endif
  8023. #endif
  8024. #endif`,B2e=`#ifdef USE_MORPHTARGETS
  8025. transformed *= morphTargetBaseInfluence;
  8026. #ifdef MORPHTARGETS_TEXTURE
  8027. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  8028. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  8029. }
  8030. #else
  8031. transformed += morphTarget0 * morphTargetInfluences[ 0 ];
  8032. transformed += morphTarget1 * morphTargetInfluences[ 1 ];
  8033. transformed += morphTarget2 * morphTargetInfluences[ 2 ];
  8034. transformed += morphTarget3 * morphTargetInfluences[ 3 ];
  8035. #ifndef USE_MORPHNORMALS
  8036. transformed += morphTarget4 * morphTargetInfluences[ 4 ];
  8037. transformed += morphTarget5 * morphTargetInfluences[ 5 ];
  8038. transformed += morphTarget6 * morphTargetInfluences[ 6 ];
  8039. transformed += morphTarget7 * morphTargetInfluences[ 7 ];
  8040. #endif
  8041. #endif
  8042. #endif`,k2e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  8043. #ifdef FLAT_SHADED
  8044. vec3 fdx = dFdx( vViewPosition );
  8045. vec3 fdy = dFdy( vViewPosition );
  8046. vec3 normal = normalize( cross( fdx, fdy ) );
  8047. #else
  8048. vec3 normal = normalize( vNormal );
  8049. #ifdef DOUBLE_SIDED
  8050. normal *= faceDirection;
  8051. #endif
  8052. #endif
  8053. #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
  8054. #ifdef USE_TANGENT
  8055. mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  8056. #else
  8057. mat3 tbn = getTangentFrame( - vViewPosition, normal,
  8058. #if defined( USE_NORMALMAP )
  8059. vNormalMapUv
  8060. #elif defined( USE_CLEARCOAT_NORMALMAP )
  8061. vClearcoatNormalMapUv
  8062. #else
  8063. vUv
  8064. #endif
  8065. );
  8066. #endif
  8067. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  8068. tbn[0] *= faceDirection;
  8069. tbn[1] *= faceDirection;
  8070. #endif
  8071. #endif
  8072. #ifdef USE_CLEARCOAT_NORMALMAP
  8073. #ifdef USE_TANGENT
  8074. mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  8075. #else
  8076. mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
  8077. #endif
  8078. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  8079. tbn2[0] *= faceDirection;
  8080. tbn2[1] *= faceDirection;
  8081. #endif
  8082. #endif
  8083. vec3 nonPerturbedNormal = normal;`,V2e=`#ifdef USE_NORMALMAP_OBJECTSPACE
  8084. normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  8085. #ifdef FLIP_SIDED
  8086. normal = - normal;
  8087. #endif
  8088. #ifdef DOUBLE_SIDED
  8089. normal = normal * faceDirection;
  8090. #endif
  8091. normal = normalize( normalMatrix * normal );
  8092. #elif defined( USE_NORMALMAP_TANGENTSPACE )
  8093. vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  8094. mapN.xy *= normalScale;
  8095. normal = normalize( tbn * mapN );
  8096. #elif defined( USE_BUMPMAP )
  8097. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  8098. #endif`,G2e=`#ifndef FLAT_SHADED
  8099. varying vec3 vNormal;
  8100. #ifdef USE_TANGENT
  8101. varying vec3 vTangent;
  8102. varying vec3 vBitangent;
  8103. #endif
  8104. #endif`,H2e=`#ifndef FLAT_SHADED
  8105. varying vec3 vNormal;
  8106. #ifdef USE_TANGENT
  8107. varying vec3 vTangent;
  8108. varying vec3 vBitangent;
  8109. #endif
  8110. #endif`,W2e=`#ifndef FLAT_SHADED
  8111. vNormal = normalize( transformedNormal );
  8112. #ifdef USE_TANGENT
  8113. vTangent = normalize( transformedTangent );
  8114. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  8115. #endif
  8116. #endif`,X2e=`#ifdef USE_NORMALMAP
  8117. uniform sampler2D normalMap;
  8118. uniform vec2 normalScale;
  8119. #endif
  8120. #ifdef USE_NORMALMAP_OBJECTSPACE
  8121. uniform mat3 normalMatrix;
  8122. #endif
  8123. #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
  8124. mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
  8125. vec3 q0 = dFdx( eye_pos.xyz );
  8126. vec3 q1 = dFdy( eye_pos.xyz );
  8127. vec2 st0 = dFdx( uv.st );
  8128. vec2 st1 = dFdy( uv.st );
  8129. vec3 N = surf_norm;
  8130. vec3 q1perp = cross( q1, N );
  8131. vec3 q0perp = cross( N, q0 );
  8132. vec3 T = q1perp * st0.x + q0perp * st1.x;
  8133. vec3 B = q1perp * st0.y + q0perp * st1.y;
  8134. float det = max( dot( T, T ), dot( B, B ) );
  8135. float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
  8136. return mat3( T * scale, B * scale, N );
  8137. }
  8138. #endif`,Y2e=`#ifdef USE_CLEARCOAT
  8139. vec3 clearcoatNormal = nonPerturbedNormal;
  8140. #endif`,q2e=`#ifdef USE_CLEARCOAT_NORMALMAP
  8141. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
  8142. clearcoatMapN.xy *= clearcoatNormalScale;
  8143. clearcoatNormal = normalize( tbn2 * clearcoatMapN );
  8144. #endif`,Z2e=`#ifdef USE_CLEARCOATMAP
  8145. uniform sampler2D clearcoatMap;
  8146. #endif
  8147. #ifdef USE_CLEARCOAT_NORMALMAP
  8148. uniform sampler2D clearcoatNormalMap;
  8149. uniform vec2 clearcoatNormalScale;
  8150. #endif
  8151. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8152. uniform sampler2D clearcoatRoughnessMap;
  8153. #endif`,j2e=`#ifdef USE_IRIDESCENCEMAP
  8154. uniform sampler2D iridescenceMap;
  8155. #endif
  8156. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8157. uniform sampler2D iridescenceThicknessMap;
  8158. #endif`,K2e=`#ifdef OPAQUE
  8159. diffuseColor.a = 1.0;
  8160. #endif
  8161. #ifdef USE_TRANSMISSION
  8162. diffuseColor.a *= material.transmissionAlpha;
  8163. #endif
  8164. gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,J2e=`vec3 packNormalToRGB( const in vec3 normal ) {
  8165. return normalize( normal ) * 0.5 + 0.5;
  8166. }
  8167. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  8168. return 2.0 * rgb.xyz - 1.0;
  8169. }
  8170. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
  8171. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  8172. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  8173. const float ShiftRight8 = 1. / 256.;
  8174. vec4 packDepthToRGBA( const in float v ) {
  8175. vec4 r = vec4( fract( v * PackFactors ), v );
  8176. r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
  8177. }
  8178. float unpackRGBAToDepth( const in vec4 v ) {
  8179. return dot( v, UnpackFactors );
  8180. }
  8181. vec2 packDepthToRG( in highp float v ) {
  8182. return packDepthToRGBA( v ).yx;
  8183. }
  8184. float unpackRGToDepth( const in highp vec2 v ) {
  8185. return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
  8186. }
  8187. vec4 pack2HalfToRGBA( vec2 v ) {
  8188. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  8189. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  8190. }
  8191. vec2 unpackRGBATo2Half( vec4 v ) {
  8192. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  8193. }
  8194. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  8195. return ( viewZ + near ) / ( near - far );
  8196. }
  8197. float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
  8198. return depth * ( near - far ) - near;
  8199. }
  8200. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  8201. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  8202. }
  8203. float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
  8204. return ( near * far ) / ( ( far - near ) * depth - far );
  8205. }`,$2e=`#ifdef PREMULTIPLIED_ALPHA
  8206. gl_FragColor.rgb *= gl_FragColor.a;
  8207. #endif`,Q2e=`vec4 mvPosition = vec4( transformed, 1.0 );
  8208. #ifdef USE_BATCHING
  8209. mvPosition = batchingMatrix * mvPosition;
  8210. #endif
  8211. #ifdef USE_INSTANCING
  8212. mvPosition = instanceMatrix * mvPosition;
  8213. #endif
  8214. mvPosition = modelViewMatrix * mvPosition;
  8215. gl_Position = projectionMatrix * mvPosition;`,eIe=`#ifdef DITHERING
  8216. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  8217. #endif`,tIe=`#ifdef DITHERING
  8218. vec3 dithering( vec3 color ) {
  8219. float grid_position = rand( gl_FragCoord.xy );
  8220. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  8221. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  8222. return color + dither_shift_RGB;
  8223. }
  8224. #endif`,rIe=`float roughnessFactor = roughness;
  8225. #ifdef USE_ROUGHNESSMAP
  8226. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  8227. roughnessFactor *= texelRoughness.g;
  8228. #endif`,iIe=`#ifdef USE_ROUGHNESSMAP
  8229. uniform sampler2D roughnessMap;
  8230. #endif`,nIe=`#if NUM_SPOT_LIGHT_COORDS > 0
  8231. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  8232. #endif
  8233. #if NUM_SPOT_LIGHT_MAPS > 0
  8234. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  8235. #endif
  8236. #ifdef USE_SHADOWMAP
  8237. #if NUM_DIR_LIGHT_SHADOWS > 0
  8238. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  8239. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  8240. struct DirectionalLightShadow {
  8241. float shadowBias;
  8242. float shadowNormalBias;
  8243. float shadowRadius;
  8244. vec2 shadowMapSize;
  8245. };
  8246. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  8247. #endif
  8248. #if NUM_SPOT_LIGHT_SHADOWS > 0
  8249. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  8250. struct SpotLightShadow {
  8251. float shadowBias;
  8252. float shadowNormalBias;
  8253. float shadowRadius;
  8254. vec2 shadowMapSize;
  8255. };
  8256. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  8257. #endif
  8258. #if NUM_POINT_LIGHT_SHADOWS > 0
  8259. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  8260. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  8261. struct PointLightShadow {
  8262. float shadowBias;
  8263. float shadowNormalBias;
  8264. float shadowRadius;
  8265. vec2 shadowMapSize;
  8266. float shadowCameraNear;
  8267. float shadowCameraFar;
  8268. };
  8269. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  8270. #endif
  8271. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  8272. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  8273. }
  8274. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  8275. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  8276. }
  8277. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  8278. float occlusion = 1.0;
  8279. vec2 distribution = texture2DDistribution( shadow, uv );
  8280. float hard_shadow = step( compare , distribution.x );
  8281. if (hard_shadow != 1.0 ) {
  8282. float distance = compare - distribution.x ;
  8283. float variance = max( 0.00000, distribution.y * distribution.y );
  8284. float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
  8285. }
  8286. return occlusion;
  8287. }
  8288. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  8289. float shadow = 1.0;
  8290. shadowCoord.xyz /= shadowCoord.w;
  8291. shadowCoord.z += shadowBias;
  8292. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  8293. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  8294. if ( frustumTest ) {
  8295. #if defined( SHADOWMAP_TYPE_PCF )
  8296. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  8297. float dx0 = - texelSize.x * shadowRadius;
  8298. float dy0 = - texelSize.y * shadowRadius;
  8299. float dx1 = + texelSize.x * shadowRadius;
  8300. float dy1 = + texelSize.y * shadowRadius;
  8301. float dx2 = dx0 / 2.0;
  8302. float dy2 = dy0 / 2.0;
  8303. float dx3 = dx1 / 2.0;
  8304. float dy3 = dy1 / 2.0;
  8305. shadow = (
  8306. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  8307. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  8308. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  8309. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  8310. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  8311. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  8312. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  8313. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  8314. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  8315. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  8316. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  8317. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  8318. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  8319. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  8320. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  8321. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  8322. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  8323. ) * ( 1.0 / 17.0 );
  8324. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  8325. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  8326. float dx = texelSize.x;
  8327. float dy = texelSize.y;
  8328. vec2 uv = shadowCoord.xy;
  8329. vec2 f = fract( uv * shadowMapSize + 0.5 );
  8330. uv -= f * texelSize;
  8331. shadow = (
  8332. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  8333. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  8334. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  8335. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  8336. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  8337. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  8338. f.x ) +
  8339. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  8340. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  8341. f.x ) +
  8342. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  8343. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  8344. f.y ) +
  8345. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  8346. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  8347. f.y ) +
  8348. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  8349. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  8350. f.x ),
  8351. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  8352. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  8353. f.x ),
  8354. f.y )
  8355. ) * ( 1.0 / 9.0 );
  8356. #elif defined( SHADOWMAP_TYPE_VSM )
  8357. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  8358. #else
  8359. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  8360. #endif
  8361. }
  8362. return shadow;
  8363. }
  8364. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  8365. vec3 absV = abs( v );
  8366. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  8367. absV *= scaleToCube;
  8368. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  8369. vec2 planar = v.xy;
  8370. float almostATexel = 1.5 * texelSizeY;
  8371. float almostOne = 1.0 - almostATexel;
  8372. if ( absV.z >= almostOne ) {
  8373. if ( v.z > 0.0 )
  8374. planar.x = 4.0 - v.x;
  8375. } else if ( absV.x >= almostOne ) {
  8376. float signX = sign( v.x );
  8377. planar.x = v.z * signX + 2.0 * signX;
  8378. } else if ( absV.y >= almostOne ) {
  8379. float signY = sign( v.y );
  8380. planar.x = v.x + 2.0 * signY + 2.0;
  8381. planar.y = v.z * signY - 2.0;
  8382. }
  8383. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  8384. }
  8385. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  8386. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  8387. vec3 lightToPosition = shadowCoord.xyz;
  8388. float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
  8389. vec3 bd3D = normalize( lightToPosition );
  8390. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  8391. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  8392. return (
  8393. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  8394. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  8395. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  8396. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  8397. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  8398. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  8399. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  8400. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  8401. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  8402. ) * ( 1.0 / 9.0 );
  8403. #else
  8404. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  8405. #endif
  8406. }
  8407. #endif`,aIe=`#if NUM_SPOT_LIGHT_COORDS > 0
  8408. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  8409. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  8410. #endif
  8411. #ifdef USE_SHADOWMAP
  8412. #if NUM_DIR_LIGHT_SHADOWS > 0
  8413. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  8414. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  8415. struct DirectionalLightShadow {
  8416. float shadowBias;
  8417. float shadowNormalBias;
  8418. float shadowRadius;
  8419. vec2 shadowMapSize;
  8420. };
  8421. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  8422. #endif
  8423. #if NUM_SPOT_LIGHT_SHADOWS > 0
  8424. struct SpotLightShadow {
  8425. float shadowBias;
  8426. float shadowNormalBias;
  8427. float shadowRadius;
  8428. vec2 shadowMapSize;
  8429. };
  8430. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  8431. #endif
  8432. #if NUM_POINT_LIGHT_SHADOWS > 0
  8433. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  8434. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  8435. struct PointLightShadow {
  8436. float shadowBias;
  8437. float shadowNormalBias;
  8438. float shadowRadius;
  8439. vec2 shadowMapSize;
  8440. float shadowCameraNear;
  8441. float shadowCameraFar;
  8442. };
  8443. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  8444. #endif
  8445. #endif`,oIe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  8446. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  8447. vec4 shadowWorldPosition;
  8448. #endif
  8449. #if defined( USE_SHADOWMAP )
  8450. #if NUM_DIR_LIGHT_SHADOWS > 0
  8451. #pragma unroll_loop_start
  8452. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  8453. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  8454. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  8455. }
  8456. #pragma unroll_loop_end
  8457. #endif
  8458. #if NUM_POINT_LIGHT_SHADOWS > 0
  8459. #pragma unroll_loop_start
  8460. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  8461. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  8462. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  8463. }
  8464. #pragma unroll_loop_end
  8465. #endif
  8466. #endif
  8467. #if NUM_SPOT_LIGHT_COORDS > 0
  8468. #pragma unroll_loop_start
  8469. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  8470. shadowWorldPosition = worldPosition;
  8471. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  8472. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  8473. #endif
  8474. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  8475. }
  8476. #pragma unroll_loop_end
  8477. #endif`,sIe=`float getShadowMask() {
  8478. float shadow = 1.0;
  8479. #ifdef USE_SHADOWMAP
  8480. #if NUM_DIR_LIGHT_SHADOWS > 0
  8481. DirectionalLightShadow directionalLight;
  8482. #pragma unroll_loop_start
  8483. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  8484. directionalLight = directionalLightShadows[ i ];
  8485. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  8486. }
  8487. #pragma unroll_loop_end
  8488. #endif
  8489. #if NUM_SPOT_LIGHT_SHADOWS > 0
  8490. SpotLightShadow spotLight;
  8491. #pragma unroll_loop_start
  8492. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  8493. spotLight = spotLightShadows[ i ];
  8494. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  8495. }
  8496. #pragma unroll_loop_end
  8497. #endif
  8498. #if NUM_POINT_LIGHT_SHADOWS > 0
  8499. PointLightShadow pointLight;
  8500. #pragma unroll_loop_start
  8501. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  8502. pointLight = pointLightShadows[ i ];
  8503. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  8504. }
  8505. #pragma unroll_loop_end
  8506. #endif
  8507. #endif
  8508. return shadow;
  8509. }`,lIe=`#ifdef USE_SKINNING
  8510. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  8511. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  8512. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  8513. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  8514. #endif`,uIe=`#ifdef USE_SKINNING
  8515. uniform mat4 bindMatrix;
  8516. uniform mat4 bindMatrixInverse;
  8517. uniform highp sampler2D boneTexture;
  8518. mat4 getBoneMatrix( const in float i ) {
  8519. int size = textureSize( boneTexture, 0 ).x;
  8520. int j = int( i ) * 4;
  8521. int x = j % size;
  8522. int y = j / size;
  8523. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  8524. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  8525. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  8526. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  8527. return mat4( v1, v2, v3, v4 );
  8528. }
  8529. #endif`,cIe=`#ifdef USE_SKINNING
  8530. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  8531. vec4 skinned = vec4( 0.0 );
  8532. skinned += boneMatX * skinVertex * skinWeight.x;
  8533. skinned += boneMatY * skinVertex * skinWeight.y;
  8534. skinned += boneMatZ * skinVertex * skinWeight.z;
  8535. skinned += boneMatW * skinVertex * skinWeight.w;
  8536. transformed = ( bindMatrixInverse * skinned ).xyz;
  8537. #endif`,fIe=`#ifdef USE_SKINNING
  8538. mat4 skinMatrix = mat4( 0.0 );
  8539. skinMatrix += skinWeight.x * boneMatX;
  8540. skinMatrix += skinWeight.y * boneMatY;
  8541. skinMatrix += skinWeight.z * boneMatZ;
  8542. skinMatrix += skinWeight.w * boneMatW;
  8543. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  8544. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  8545. #ifdef USE_TANGENT
  8546. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  8547. #endif
  8548. #endif`,hIe=`float specularStrength;
  8549. #ifdef USE_SPECULARMAP
  8550. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  8551. specularStrength = texelSpecular.r;
  8552. #else
  8553. specularStrength = 1.0;
  8554. #endif`,pIe=`#ifdef USE_SPECULARMAP
  8555. uniform sampler2D specularMap;
  8556. #endif`,dIe=`#if defined( TONE_MAPPING )
  8557. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  8558. #endif`,mIe=`#ifndef saturate
  8559. #define saturate( a ) clamp( a, 0.0, 1.0 )
  8560. #endif
  8561. uniform float toneMappingExposure;
  8562. vec3 LinearToneMapping( vec3 color ) {
  8563. return saturate( toneMappingExposure * color );
  8564. }
  8565. vec3 ReinhardToneMapping( vec3 color ) {
  8566. color *= toneMappingExposure;
  8567. return saturate( color / ( vec3( 1.0 ) + color ) );
  8568. }
  8569. vec3 OptimizedCineonToneMapping( vec3 color ) {
  8570. color *= toneMappingExposure;
  8571. color = max( vec3( 0.0 ), color - 0.004 );
  8572. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  8573. }
  8574. vec3 RRTAndODTFit( vec3 v ) {
  8575. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  8576. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  8577. return a / b;
  8578. }
  8579. vec3 ACESFilmicToneMapping( vec3 color ) {
  8580. const mat3 ACESInputMat = mat3(
  8581. vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
  8582. vec3( 0.04823, 0.01566, 0.83777 )
  8583. );
  8584. const mat3 ACESOutputMat = mat3(
  8585. vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
  8586. vec3( -0.07367, -0.00605, 1.07602 )
  8587. );
  8588. color *= toneMappingExposure / 0.6;
  8589. color = ACESInputMat * color;
  8590. color = RRTAndODTFit( color );
  8591. color = ACESOutputMat * color;
  8592. return saturate( color );
  8593. }
  8594. const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
  8595. vec3( 1.6605, - 0.1246, - 0.0182 ),
  8596. vec3( - 0.5876, 1.1329, - 0.1006 ),
  8597. vec3( - 0.0728, - 0.0083, 1.1187 )
  8598. );
  8599. const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
  8600. vec3( 0.6274, 0.0691, 0.0164 ),
  8601. vec3( 0.3293, 0.9195, 0.0880 ),
  8602. vec3( 0.0433, 0.0113, 0.8956 )
  8603. );
  8604. vec3 agxDefaultContrastApprox( vec3 x ) {
  8605. vec3 x2 = x * x;
  8606. vec3 x4 = x2 * x2;
  8607. return + 15.5 * x4 * x2
  8608. - 40.14 * x4 * x
  8609. + 31.96 * x4
  8610. - 6.868 * x2 * x
  8611. + 0.4298 * x2
  8612. + 0.1191 * x
  8613. - 0.00232;
  8614. }
  8615. vec3 AgXToneMapping( vec3 color ) {
  8616. const mat3 AgXInsetMatrix = mat3(
  8617. vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
  8618. vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
  8619. vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
  8620. );
  8621. const mat3 AgXOutsetMatrix = mat3(
  8622. vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
  8623. vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
  8624. vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
  8625. );
  8626. const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
  8627. color *= toneMappingExposure;
  8628. color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
  8629. color = AgXInsetMatrix * color;
  8630. color = max( color, 1e-10 ); color = log2( color );
  8631. color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
  8632. color = clamp( color, 0.0, 1.0 );
  8633. color = agxDefaultContrastApprox( color );
  8634. color = AgXOutsetMatrix * color;
  8635. color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
  8636. color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
  8637. color = clamp( color, 0.0, 1.0 );
  8638. return color;
  8639. }
  8640. vec3 NeutralToneMapping( vec3 color ) {
  8641. float startCompression = 0.8 - 0.04;
  8642. float desaturation = 0.15;
  8643. color *= toneMappingExposure;
  8644. float x = min(color.r, min(color.g, color.b));
  8645. float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
  8646. color -= offset;
  8647. float peak = max(color.r, max(color.g, color.b));
  8648. if (peak < startCompression) return color;
  8649. float d = 1. - startCompression;
  8650. float newPeak = 1. - d * d / (peak + d - startCompression);
  8651. color *= newPeak / peak;
  8652. float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
  8653. return mix(color, vec3(1, 1, 1), g);
  8654. }
  8655. vec3 CustomToneMapping( vec3 color ) { return color; }`,vIe=`#ifdef USE_TRANSMISSION
  8656. material.transmission = transmission;
  8657. material.transmissionAlpha = 1.0;
  8658. material.thickness = thickness;
  8659. material.attenuationDistance = attenuationDistance;
  8660. material.attenuationColor = attenuationColor;
  8661. #ifdef USE_TRANSMISSIONMAP
  8662. material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
  8663. #endif
  8664. #ifdef USE_THICKNESSMAP
  8665. material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
  8666. #endif
  8667. vec3 pos = vWorldPosition;
  8668. vec3 v = normalize( cameraPosition - pos );
  8669. vec3 n = inverseTransformDirection( normal, viewMatrix );
  8670. vec4 transmitted = getIBLVolumeRefraction(
  8671. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  8672. pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
  8673. material.attenuationColor, material.attenuationDistance );
  8674. material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
  8675. totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
  8676. #endif`,gIe=`#ifdef USE_TRANSMISSION
  8677. uniform float transmission;
  8678. uniform float thickness;
  8679. uniform float attenuationDistance;
  8680. uniform vec3 attenuationColor;
  8681. #ifdef USE_TRANSMISSIONMAP
  8682. uniform sampler2D transmissionMap;
  8683. #endif
  8684. #ifdef USE_THICKNESSMAP
  8685. uniform sampler2D thicknessMap;
  8686. #endif
  8687. uniform vec2 transmissionSamplerSize;
  8688. uniform sampler2D transmissionSamplerMap;
  8689. uniform mat4 modelMatrix;
  8690. uniform mat4 projectionMatrix;
  8691. varying vec3 vWorldPosition;
  8692. float w0( float a ) {
  8693. return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
  8694. }
  8695. float w1( float a ) {
  8696. return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
  8697. }
  8698. float w2( float a ){
  8699. return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
  8700. }
  8701. float w3( float a ) {
  8702. return ( 1.0 / 6.0 ) * ( a * a * a );
  8703. }
  8704. float g0( float a ) {
  8705. return w0( a ) + w1( a );
  8706. }
  8707. float g1( float a ) {
  8708. return w2( a ) + w3( a );
  8709. }
  8710. float h0( float a ) {
  8711. return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
  8712. }
  8713. float h1( float a ) {
  8714. return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
  8715. }
  8716. vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
  8717. uv = uv * texelSize.zw + 0.5;
  8718. vec2 iuv = floor( uv );
  8719. vec2 fuv = fract( uv );
  8720. float g0x = g0( fuv.x );
  8721. float g1x = g1( fuv.x );
  8722. float h0x = h0( fuv.x );
  8723. float h1x = h1( fuv.x );
  8724. float h0y = h0( fuv.y );
  8725. float h1y = h1( fuv.y );
  8726. vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  8727. vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  8728. vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  8729. vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  8730. return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
  8731. g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
  8732. }
  8733. vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
  8734. vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
  8735. vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
  8736. vec2 fLodSizeInv = 1.0 / fLodSize;
  8737. vec2 cLodSizeInv = 1.0 / cLodSize;
  8738. vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
  8739. vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
  8740. return mix( fSample, cSample, fract( lod ) );
  8741. }
  8742. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  8743. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  8744. vec3 modelScale;
  8745. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  8746. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  8747. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  8748. return normalize( refractionVector ) * thickness * modelScale;
  8749. }
  8750. float applyIorToRoughness( const in float roughness, const in float ior ) {
  8751. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  8752. }
  8753. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  8754. float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  8755. return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
  8756. }
  8757. vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  8758. if ( isinf( attenuationDistance ) ) {
  8759. return vec3( 1.0 );
  8760. } else {
  8761. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  8762. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
  8763. }
  8764. }
  8765. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  8766. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  8767. const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
  8768. const in vec3 attenuationColor, const in float attenuationDistance ) {
  8769. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  8770. vec3 refractedRayExit = position + transmissionRay;
  8771. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  8772. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  8773. refractionCoords += 1.0;
  8774. refractionCoords /= 2.0;
  8775. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  8776. vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
  8777. vec3 attenuatedColor = transmittance * transmittedLight.rgb;
  8778. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  8779. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
  8780. return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
  8781. }
  8782. #endif`,yIe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  8783. varying vec2 vUv;
  8784. #endif
  8785. #ifdef USE_MAP
  8786. varying vec2 vMapUv;
  8787. #endif
  8788. #ifdef USE_ALPHAMAP
  8789. varying vec2 vAlphaMapUv;
  8790. #endif
  8791. #ifdef USE_LIGHTMAP
  8792. varying vec2 vLightMapUv;
  8793. #endif
  8794. #ifdef USE_AOMAP
  8795. varying vec2 vAoMapUv;
  8796. #endif
  8797. #ifdef USE_BUMPMAP
  8798. varying vec2 vBumpMapUv;
  8799. #endif
  8800. #ifdef USE_NORMALMAP
  8801. varying vec2 vNormalMapUv;
  8802. #endif
  8803. #ifdef USE_EMISSIVEMAP
  8804. varying vec2 vEmissiveMapUv;
  8805. #endif
  8806. #ifdef USE_METALNESSMAP
  8807. varying vec2 vMetalnessMapUv;
  8808. #endif
  8809. #ifdef USE_ROUGHNESSMAP
  8810. varying vec2 vRoughnessMapUv;
  8811. #endif
  8812. #ifdef USE_ANISOTROPYMAP
  8813. varying vec2 vAnisotropyMapUv;
  8814. #endif
  8815. #ifdef USE_CLEARCOATMAP
  8816. varying vec2 vClearcoatMapUv;
  8817. #endif
  8818. #ifdef USE_CLEARCOAT_NORMALMAP
  8819. varying vec2 vClearcoatNormalMapUv;
  8820. #endif
  8821. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8822. varying vec2 vClearcoatRoughnessMapUv;
  8823. #endif
  8824. #ifdef USE_IRIDESCENCEMAP
  8825. varying vec2 vIridescenceMapUv;
  8826. #endif
  8827. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8828. varying vec2 vIridescenceThicknessMapUv;
  8829. #endif
  8830. #ifdef USE_SHEEN_COLORMAP
  8831. varying vec2 vSheenColorMapUv;
  8832. #endif
  8833. #ifdef USE_SHEEN_ROUGHNESSMAP
  8834. varying vec2 vSheenRoughnessMapUv;
  8835. #endif
  8836. #ifdef USE_SPECULARMAP
  8837. varying vec2 vSpecularMapUv;
  8838. #endif
  8839. #ifdef USE_SPECULAR_COLORMAP
  8840. varying vec2 vSpecularColorMapUv;
  8841. #endif
  8842. #ifdef USE_SPECULAR_INTENSITYMAP
  8843. varying vec2 vSpecularIntensityMapUv;
  8844. #endif
  8845. #ifdef USE_TRANSMISSIONMAP
  8846. uniform mat3 transmissionMapTransform;
  8847. varying vec2 vTransmissionMapUv;
  8848. #endif
  8849. #ifdef USE_THICKNESSMAP
  8850. uniform mat3 thicknessMapTransform;
  8851. varying vec2 vThicknessMapUv;
  8852. #endif`,_Ie=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  8853. varying vec2 vUv;
  8854. #endif
  8855. #ifdef USE_MAP
  8856. uniform mat3 mapTransform;
  8857. varying vec2 vMapUv;
  8858. #endif
  8859. #ifdef USE_ALPHAMAP
  8860. uniform mat3 alphaMapTransform;
  8861. varying vec2 vAlphaMapUv;
  8862. #endif
  8863. #ifdef USE_LIGHTMAP
  8864. uniform mat3 lightMapTransform;
  8865. varying vec2 vLightMapUv;
  8866. #endif
  8867. #ifdef USE_AOMAP
  8868. uniform mat3 aoMapTransform;
  8869. varying vec2 vAoMapUv;
  8870. #endif
  8871. #ifdef USE_BUMPMAP
  8872. uniform mat3 bumpMapTransform;
  8873. varying vec2 vBumpMapUv;
  8874. #endif
  8875. #ifdef USE_NORMALMAP
  8876. uniform mat3 normalMapTransform;
  8877. varying vec2 vNormalMapUv;
  8878. #endif
  8879. #ifdef USE_DISPLACEMENTMAP
  8880. uniform mat3 displacementMapTransform;
  8881. varying vec2 vDisplacementMapUv;
  8882. #endif
  8883. #ifdef USE_EMISSIVEMAP
  8884. uniform mat3 emissiveMapTransform;
  8885. varying vec2 vEmissiveMapUv;
  8886. #endif
  8887. #ifdef USE_METALNESSMAP
  8888. uniform mat3 metalnessMapTransform;
  8889. varying vec2 vMetalnessMapUv;
  8890. #endif
  8891. #ifdef USE_ROUGHNESSMAP
  8892. uniform mat3 roughnessMapTransform;
  8893. varying vec2 vRoughnessMapUv;
  8894. #endif
  8895. #ifdef USE_ANISOTROPYMAP
  8896. uniform mat3 anisotropyMapTransform;
  8897. varying vec2 vAnisotropyMapUv;
  8898. #endif
  8899. #ifdef USE_CLEARCOATMAP
  8900. uniform mat3 clearcoatMapTransform;
  8901. varying vec2 vClearcoatMapUv;
  8902. #endif
  8903. #ifdef USE_CLEARCOAT_NORMALMAP
  8904. uniform mat3 clearcoatNormalMapTransform;
  8905. varying vec2 vClearcoatNormalMapUv;
  8906. #endif
  8907. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8908. uniform mat3 clearcoatRoughnessMapTransform;
  8909. varying vec2 vClearcoatRoughnessMapUv;
  8910. #endif
  8911. #ifdef USE_SHEEN_COLORMAP
  8912. uniform mat3 sheenColorMapTransform;
  8913. varying vec2 vSheenColorMapUv;
  8914. #endif
  8915. #ifdef USE_SHEEN_ROUGHNESSMAP
  8916. uniform mat3 sheenRoughnessMapTransform;
  8917. varying vec2 vSheenRoughnessMapUv;
  8918. #endif
  8919. #ifdef USE_IRIDESCENCEMAP
  8920. uniform mat3 iridescenceMapTransform;
  8921. varying vec2 vIridescenceMapUv;
  8922. #endif
  8923. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8924. uniform mat3 iridescenceThicknessMapTransform;
  8925. varying vec2 vIridescenceThicknessMapUv;
  8926. #endif
  8927. #ifdef USE_SPECULARMAP
  8928. uniform mat3 specularMapTransform;
  8929. varying vec2 vSpecularMapUv;
  8930. #endif
  8931. #ifdef USE_SPECULAR_COLORMAP
  8932. uniform mat3 specularColorMapTransform;
  8933. varying vec2 vSpecularColorMapUv;
  8934. #endif
  8935. #ifdef USE_SPECULAR_INTENSITYMAP
  8936. uniform mat3 specularIntensityMapTransform;
  8937. varying vec2 vSpecularIntensityMapUv;
  8938. #endif
  8939. #ifdef USE_TRANSMISSIONMAP
  8940. uniform mat3 transmissionMapTransform;
  8941. varying vec2 vTransmissionMapUv;
  8942. #endif
  8943. #ifdef USE_THICKNESSMAP
  8944. uniform mat3 thicknessMapTransform;
  8945. varying vec2 vThicknessMapUv;
  8946. #endif`,xIe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  8947. vUv = vec3( uv, 1 ).xy;
  8948. #endif
  8949. #ifdef USE_MAP
  8950. vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  8951. #endif
  8952. #ifdef USE_ALPHAMAP
  8953. vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  8954. #endif
  8955. #ifdef USE_LIGHTMAP
  8956. vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
  8957. #endif
  8958. #ifdef USE_AOMAP
  8959. vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
  8960. #endif
  8961. #ifdef USE_BUMPMAP
  8962. vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
  8963. #endif
  8964. #ifdef USE_NORMALMAP
  8965. vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
  8966. #endif
  8967. #ifdef USE_DISPLACEMENTMAP
  8968. vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
  8969. #endif
  8970. #ifdef USE_EMISSIVEMAP
  8971. vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
  8972. #endif
  8973. #ifdef USE_METALNESSMAP
  8974. vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
  8975. #endif
  8976. #ifdef USE_ROUGHNESSMAP
  8977. vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
  8978. #endif
  8979. #ifdef USE_ANISOTROPYMAP
  8980. vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
  8981. #endif
  8982. #ifdef USE_CLEARCOATMAP
  8983. vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
  8984. #endif
  8985. #ifdef USE_CLEARCOAT_NORMALMAP
  8986. vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
  8987. #endif
  8988. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8989. vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
  8990. #endif
  8991. #ifdef USE_IRIDESCENCEMAP
  8992. vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
  8993. #endif
  8994. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8995. vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
  8996. #endif
  8997. #ifdef USE_SHEEN_COLORMAP
  8998. vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
  8999. #endif
  9000. #ifdef USE_SHEEN_ROUGHNESSMAP
  9001. vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
  9002. #endif
  9003. #ifdef USE_SPECULARMAP
  9004. vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
  9005. #endif
  9006. #ifdef USE_SPECULAR_COLORMAP
  9007. vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
  9008. #endif
  9009. #ifdef USE_SPECULAR_INTENSITYMAP
  9010. vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
  9011. #endif
  9012. #ifdef USE_TRANSMISSIONMAP
  9013. vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
  9014. #endif
  9015. #ifdef USE_THICKNESSMAP
  9016. vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
  9017. #endif`,SIe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  9018. vec4 worldPosition = vec4( transformed, 1.0 );
  9019. #ifdef USE_BATCHING
  9020. worldPosition = batchingMatrix * worldPosition;
  9021. #endif
  9022. #ifdef USE_INSTANCING
  9023. worldPosition = instanceMatrix * worldPosition;
  9024. #endif
  9025. worldPosition = modelMatrix * worldPosition;
  9026. #endif`,MIe=`varying vec2 vUv;
  9027. uniform mat3 uvTransform;
  9028. void main() {
  9029. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  9030. gl_Position = vec4( position.xy, 1.0, 1.0 );
  9031. }`,bIe=`uniform sampler2D t2D;
  9032. uniform float backgroundIntensity;
  9033. varying vec2 vUv;
  9034. void main() {
  9035. vec4 texColor = texture2D( t2D, vUv );
  9036. #ifdef DECODE_VIDEO_TEXTURE
  9037. texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
  9038. #endif
  9039. texColor.rgb *= backgroundIntensity;
  9040. gl_FragColor = texColor;
  9041. #include <tonemapping_fragment>
  9042. #include <colorspace_fragment>
  9043. }`,wIe=`varying vec3 vWorldDirection;
  9044. #include <common>
  9045. void main() {
  9046. vWorldDirection = transformDirection( position, modelMatrix );
  9047. #include <begin_vertex>
  9048. #include <project_vertex>
  9049. gl_Position.z = gl_Position.w;
  9050. }`,TIe=`#ifdef ENVMAP_TYPE_CUBE
  9051. uniform samplerCube envMap;
  9052. #elif defined( ENVMAP_TYPE_CUBE_UV )
  9053. uniform sampler2D envMap;
  9054. #endif
  9055. uniform float flipEnvMap;
  9056. uniform float backgroundBlurriness;
  9057. uniform float backgroundIntensity;
  9058. uniform mat3 backgroundRotation;
  9059. varying vec3 vWorldDirection;
  9060. #include <cube_uv_reflection_fragment>
  9061. void main() {
  9062. #ifdef ENVMAP_TYPE_CUBE
  9063. vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  9064. #elif defined( ENVMAP_TYPE_CUBE_UV )
  9065. vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
  9066. #else
  9067. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  9068. #endif
  9069. texColor.rgb *= backgroundIntensity;
  9070. gl_FragColor = texColor;
  9071. #include <tonemapping_fragment>
  9072. #include <colorspace_fragment>
  9073. }`,EIe=`varying vec3 vWorldDirection;
  9074. #include <common>
  9075. void main() {
  9076. vWorldDirection = transformDirection( position, modelMatrix );
  9077. #include <begin_vertex>
  9078. #include <project_vertex>
  9079. gl_Position.z = gl_Position.w;
  9080. }`,AIe=`uniform samplerCube tCube;
  9081. uniform float tFlip;
  9082. uniform float opacity;
  9083. varying vec3 vWorldDirection;
  9084. void main() {
  9085. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  9086. gl_FragColor = texColor;
  9087. gl_FragColor.a *= opacity;
  9088. #include <tonemapping_fragment>
  9089. #include <colorspace_fragment>
  9090. }`,CIe=`#include <common>
  9091. #include <batching_pars_vertex>
  9092. #include <uv_pars_vertex>
  9093. #include <displacementmap_pars_vertex>
  9094. #include <morphtarget_pars_vertex>
  9095. #include <skinning_pars_vertex>
  9096. #include <logdepthbuf_pars_vertex>
  9097. #include <clipping_planes_pars_vertex>
  9098. varying vec2 vHighPrecisionZW;
  9099. void main() {
  9100. #include <uv_vertex>
  9101. #include <batching_vertex>
  9102. #include <skinbase_vertex>
  9103. #include <morphinstance_vertex>
  9104. #ifdef USE_DISPLACEMENTMAP
  9105. #include <beginnormal_vertex>
  9106. #include <morphnormal_vertex>
  9107. #include <skinnormal_vertex>
  9108. #endif
  9109. #include <begin_vertex>
  9110. #include <morphtarget_vertex>
  9111. #include <skinning_vertex>
  9112. #include <displacementmap_vertex>
  9113. #include <project_vertex>
  9114. #include <logdepthbuf_vertex>
  9115. #include <clipping_planes_vertex>
  9116. vHighPrecisionZW = gl_Position.zw;
  9117. }`,RIe=`#if DEPTH_PACKING == 3200
  9118. uniform float opacity;
  9119. #endif
  9120. #include <common>
  9121. #include <packing>
  9122. #include <uv_pars_fragment>
  9123. #include <map_pars_fragment>
  9124. #include <alphamap_pars_fragment>
  9125. #include <alphatest_pars_fragment>
  9126. #include <alphahash_pars_fragment>
  9127. #include <logdepthbuf_pars_fragment>
  9128. #include <clipping_planes_pars_fragment>
  9129. varying vec2 vHighPrecisionZW;
  9130. void main() {
  9131. vec4 diffuseColor = vec4( 1.0 );
  9132. #include <clipping_planes_fragment>
  9133. #if DEPTH_PACKING == 3200
  9134. diffuseColor.a = opacity;
  9135. #endif
  9136. #include <map_fragment>
  9137. #include <alphamap_fragment>
  9138. #include <alphatest_fragment>
  9139. #include <alphahash_fragment>
  9140. #include <logdepthbuf_fragment>
  9141. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  9142. #if DEPTH_PACKING == 3200
  9143. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  9144. #elif DEPTH_PACKING == 3201
  9145. gl_FragColor = packDepthToRGBA( fragCoordZ );
  9146. #endif
  9147. }`,LIe=`#define DISTANCE
  9148. varying vec3 vWorldPosition;
  9149. #include <common>
  9150. #include <batching_pars_vertex>
  9151. #include <uv_pars_vertex>
  9152. #include <displacementmap_pars_vertex>
  9153. #include <morphtarget_pars_vertex>
  9154. #include <skinning_pars_vertex>
  9155. #include <clipping_planes_pars_vertex>
  9156. void main() {
  9157. #include <uv_vertex>
  9158. #include <batching_vertex>
  9159. #include <skinbase_vertex>
  9160. #include <morphinstance_vertex>
  9161. #ifdef USE_DISPLACEMENTMAP
  9162. #include <beginnormal_vertex>
  9163. #include <morphnormal_vertex>
  9164. #include <skinnormal_vertex>
  9165. #endif
  9166. #include <begin_vertex>
  9167. #include <morphtarget_vertex>
  9168. #include <skinning_vertex>
  9169. #include <displacementmap_vertex>
  9170. #include <project_vertex>
  9171. #include <worldpos_vertex>
  9172. #include <clipping_planes_vertex>
  9173. vWorldPosition = worldPosition.xyz;
  9174. }`,PIe=`#define DISTANCE
  9175. uniform vec3 referencePosition;
  9176. uniform float nearDistance;
  9177. uniform float farDistance;
  9178. varying vec3 vWorldPosition;
  9179. #include <common>
  9180. #include <packing>
  9181. #include <uv_pars_fragment>
  9182. #include <map_pars_fragment>
  9183. #include <alphamap_pars_fragment>
  9184. #include <alphatest_pars_fragment>
  9185. #include <alphahash_pars_fragment>
  9186. #include <clipping_planes_pars_fragment>
  9187. void main () {
  9188. vec4 diffuseColor = vec4( 1.0 );
  9189. #include <clipping_planes_fragment>
  9190. #include <map_fragment>
  9191. #include <alphamap_fragment>
  9192. #include <alphatest_fragment>
  9193. #include <alphahash_fragment>
  9194. float dist = length( vWorldPosition - referencePosition );
  9195. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  9196. dist = saturate( dist );
  9197. gl_FragColor = packDepthToRGBA( dist );
  9198. }`,DIe=`varying vec3 vWorldDirection;
  9199. #include <common>
  9200. void main() {
  9201. vWorldDirection = transformDirection( position, modelMatrix );
  9202. #include <begin_vertex>
  9203. #include <project_vertex>
  9204. }`,IIe=`uniform sampler2D tEquirect;
  9205. varying vec3 vWorldDirection;
  9206. #include <common>
  9207. void main() {
  9208. vec3 direction = normalize( vWorldDirection );
  9209. vec2 sampleUV = equirectUv( direction );
  9210. gl_FragColor = texture2D( tEquirect, sampleUV );
  9211. #include <tonemapping_fragment>
  9212. #include <colorspace_fragment>
  9213. }`,NIe=`uniform float scale;
  9214. attribute float lineDistance;
  9215. varying float vLineDistance;
  9216. #include <common>
  9217. #include <uv_pars_vertex>
  9218. #include <color_pars_vertex>
  9219. #include <fog_pars_vertex>
  9220. #include <morphtarget_pars_vertex>
  9221. #include <logdepthbuf_pars_vertex>
  9222. #include <clipping_planes_pars_vertex>
  9223. void main() {
  9224. vLineDistance = scale * lineDistance;
  9225. #include <uv_vertex>
  9226. #include <color_vertex>
  9227. #include <morphinstance_vertex>
  9228. #include <morphcolor_vertex>
  9229. #include <begin_vertex>
  9230. #include <morphtarget_vertex>
  9231. #include <project_vertex>
  9232. #include <logdepthbuf_vertex>
  9233. #include <clipping_planes_vertex>
  9234. #include <fog_vertex>
  9235. }`,UIe=`uniform vec3 diffuse;
  9236. uniform float opacity;
  9237. uniform float dashSize;
  9238. uniform float totalSize;
  9239. varying float vLineDistance;
  9240. #include <common>
  9241. #include <color_pars_fragment>
  9242. #include <uv_pars_fragment>
  9243. #include <map_pars_fragment>
  9244. #include <fog_pars_fragment>
  9245. #include <logdepthbuf_pars_fragment>
  9246. #include <clipping_planes_pars_fragment>
  9247. void main() {
  9248. vec4 diffuseColor = vec4( diffuse, opacity );
  9249. #include <clipping_planes_fragment>
  9250. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  9251. discard;
  9252. }
  9253. vec3 outgoingLight = vec3( 0.0 );
  9254. #include <logdepthbuf_fragment>
  9255. #include <map_fragment>
  9256. #include <color_fragment>
  9257. outgoingLight = diffuseColor.rgb;
  9258. #include <opaque_fragment>
  9259. #include <tonemapping_fragment>
  9260. #include <colorspace_fragment>
  9261. #include <fog_fragment>
  9262. #include <premultiplied_alpha_fragment>
  9263. }`,OIe=`#include <common>
  9264. #include <batching_pars_vertex>
  9265. #include <uv_pars_vertex>
  9266. #include <envmap_pars_vertex>
  9267. #include <color_pars_vertex>
  9268. #include <fog_pars_vertex>
  9269. #include <morphtarget_pars_vertex>
  9270. #include <skinning_pars_vertex>
  9271. #include <logdepthbuf_pars_vertex>
  9272. #include <clipping_planes_pars_vertex>
  9273. void main() {
  9274. #include <uv_vertex>
  9275. #include <color_vertex>
  9276. #include <morphinstance_vertex>
  9277. #include <morphcolor_vertex>
  9278. #include <batching_vertex>
  9279. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  9280. #include <beginnormal_vertex>
  9281. #include <morphnormal_vertex>
  9282. #include <skinbase_vertex>
  9283. #include <skinnormal_vertex>
  9284. #include <defaultnormal_vertex>
  9285. #endif
  9286. #include <begin_vertex>
  9287. #include <morphtarget_vertex>
  9288. #include <skinning_vertex>
  9289. #include <project_vertex>
  9290. #include <logdepthbuf_vertex>
  9291. #include <clipping_planes_vertex>
  9292. #include <worldpos_vertex>
  9293. #include <envmap_vertex>
  9294. #include <fog_vertex>
  9295. }`,zIe=`uniform vec3 diffuse;
  9296. uniform float opacity;
  9297. #ifndef FLAT_SHADED
  9298. varying vec3 vNormal;
  9299. #endif
  9300. #include <common>
  9301. #include <dithering_pars_fragment>
  9302. #include <color_pars_fragment>
  9303. #include <uv_pars_fragment>
  9304. #include <map_pars_fragment>
  9305. #include <alphamap_pars_fragment>
  9306. #include <alphatest_pars_fragment>
  9307. #include <alphahash_pars_fragment>
  9308. #include <aomap_pars_fragment>
  9309. #include <lightmap_pars_fragment>
  9310. #include <envmap_common_pars_fragment>
  9311. #include <envmap_pars_fragment>
  9312. #include <fog_pars_fragment>
  9313. #include <specularmap_pars_fragment>
  9314. #include <logdepthbuf_pars_fragment>
  9315. #include <clipping_planes_pars_fragment>
  9316. void main() {
  9317. vec4 diffuseColor = vec4( diffuse, opacity );
  9318. #include <clipping_planes_fragment>
  9319. #include <logdepthbuf_fragment>
  9320. #include <map_fragment>
  9321. #include <color_fragment>
  9322. #include <alphamap_fragment>
  9323. #include <alphatest_fragment>
  9324. #include <alphahash_fragment>
  9325. #include <specularmap_fragment>
  9326. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9327. #ifdef USE_LIGHTMAP
  9328. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  9329. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  9330. #else
  9331. reflectedLight.indirectDiffuse += vec3( 1.0 );
  9332. #endif
  9333. #include <aomap_fragment>
  9334. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  9335. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  9336. #include <envmap_fragment>
  9337. #include <opaque_fragment>
  9338. #include <tonemapping_fragment>
  9339. #include <colorspace_fragment>
  9340. #include <fog_fragment>
  9341. #include <premultiplied_alpha_fragment>
  9342. #include <dithering_fragment>
  9343. }`,FIe=`#define LAMBERT
  9344. varying vec3 vViewPosition;
  9345. #include <common>
  9346. #include <batching_pars_vertex>
  9347. #include <uv_pars_vertex>
  9348. #include <displacementmap_pars_vertex>
  9349. #include <envmap_pars_vertex>
  9350. #include <color_pars_vertex>
  9351. #include <fog_pars_vertex>
  9352. #include <normal_pars_vertex>
  9353. #include <morphtarget_pars_vertex>
  9354. #include <skinning_pars_vertex>
  9355. #include <shadowmap_pars_vertex>
  9356. #include <logdepthbuf_pars_vertex>
  9357. #include <clipping_planes_pars_vertex>
  9358. void main() {
  9359. #include <uv_vertex>
  9360. #include <color_vertex>
  9361. #include <morphinstance_vertex>
  9362. #include <morphcolor_vertex>
  9363. #include <batching_vertex>
  9364. #include <beginnormal_vertex>
  9365. #include <morphnormal_vertex>
  9366. #include <skinbase_vertex>
  9367. #include <skinnormal_vertex>
  9368. #include <defaultnormal_vertex>
  9369. #include <normal_vertex>
  9370. #include <begin_vertex>
  9371. #include <morphtarget_vertex>
  9372. #include <skinning_vertex>
  9373. #include <displacementmap_vertex>
  9374. #include <project_vertex>
  9375. #include <logdepthbuf_vertex>
  9376. #include <clipping_planes_vertex>
  9377. vViewPosition = - mvPosition.xyz;
  9378. #include <worldpos_vertex>
  9379. #include <envmap_vertex>
  9380. #include <shadowmap_vertex>
  9381. #include <fog_vertex>
  9382. }`,BIe=`#define LAMBERT
  9383. uniform vec3 diffuse;
  9384. uniform vec3 emissive;
  9385. uniform float opacity;
  9386. #include <common>
  9387. #include <packing>
  9388. #include <dithering_pars_fragment>
  9389. #include <color_pars_fragment>
  9390. #include <uv_pars_fragment>
  9391. #include <map_pars_fragment>
  9392. #include <alphamap_pars_fragment>
  9393. #include <alphatest_pars_fragment>
  9394. #include <alphahash_pars_fragment>
  9395. #include <aomap_pars_fragment>
  9396. #include <lightmap_pars_fragment>
  9397. #include <emissivemap_pars_fragment>
  9398. #include <envmap_common_pars_fragment>
  9399. #include <envmap_pars_fragment>
  9400. #include <fog_pars_fragment>
  9401. #include <bsdfs>
  9402. #include <lights_pars_begin>
  9403. #include <normal_pars_fragment>
  9404. #include <lights_lambert_pars_fragment>
  9405. #include <shadowmap_pars_fragment>
  9406. #include <bumpmap_pars_fragment>
  9407. #include <normalmap_pars_fragment>
  9408. #include <specularmap_pars_fragment>
  9409. #include <logdepthbuf_pars_fragment>
  9410. #include <clipping_planes_pars_fragment>
  9411. void main() {
  9412. vec4 diffuseColor = vec4( diffuse, opacity );
  9413. #include <clipping_planes_fragment>
  9414. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9415. vec3 totalEmissiveRadiance = emissive;
  9416. #include <logdepthbuf_fragment>
  9417. #include <map_fragment>
  9418. #include <color_fragment>
  9419. #include <alphamap_fragment>
  9420. #include <alphatest_fragment>
  9421. #include <alphahash_fragment>
  9422. #include <specularmap_fragment>
  9423. #include <normal_fragment_begin>
  9424. #include <normal_fragment_maps>
  9425. #include <emissivemap_fragment>
  9426. #include <lights_lambert_fragment>
  9427. #include <lights_fragment_begin>
  9428. #include <lights_fragment_maps>
  9429. #include <lights_fragment_end>
  9430. #include <aomap_fragment>
  9431. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  9432. #include <envmap_fragment>
  9433. #include <opaque_fragment>
  9434. #include <tonemapping_fragment>
  9435. #include <colorspace_fragment>
  9436. #include <fog_fragment>
  9437. #include <premultiplied_alpha_fragment>
  9438. #include <dithering_fragment>
  9439. }`,kIe=`#define MATCAP
  9440. varying vec3 vViewPosition;
  9441. #include <common>
  9442. #include <batching_pars_vertex>
  9443. #include <uv_pars_vertex>
  9444. #include <color_pars_vertex>
  9445. #include <displacementmap_pars_vertex>
  9446. #include <fog_pars_vertex>
  9447. #include <normal_pars_vertex>
  9448. #include <morphtarget_pars_vertex>
  9449. #include <skinning_pars_vertex>
  9450. #include <logdepthbuf_pars_vertex>
  9451. #include <clipping_planes_pars_vertex>
  9452. void main() {
  9453. #include <uv_vertex>
  9454. #include <color_vertex>
  9455. #include <morphinstance_vertex>
  9456. #include <morphcolor_vertex>
  9457. #include <batching_vertex>
  9458. #include <beginnormal_vertex>
  9459. #include <morphnormal_vertex>
  9460. #include <skinbase_vertex>
  9461. #include <skinnormal_vertex>
  9462. #include <defaultnormal_vertex>
  9463. #include <normal_vertex>
  9464. #include <begin_vertex>
  9465. #include <morphtarget_vertex>
  9466. #include <skinning_vertex>
  9467. #include <displacementmap_vertex>
  9468. #include <project_vertex>
  9469. #include <logdepthbuf_vertex>
  9470. #include <clipping_planes_vertex>
  9471. #include <fog_vertex>
  9472. vViewPosition = - mvPosition.xyz;
  9473. }`,VIe=`#define MATCAP
  9474. uniform vec3 diffuse;
  9475. uniform float opacity;
  9476. uniform sampler2D matcap;
  9477. varying vec3 vViewPosition;
  9478. #include <common>
  9479. #include <dithering_pars_fragment>
  9480. #include <color_pars_fragment>
  9481. #include <uv_pars_fragment>
  9482. #include <map_pars_fragment>
  9483. #include <alphamap_pars_fragment>
  9484. #include <alphatest_pars_fragment>
  9485. #include <alphahash_pars_fragment>
  9486. #include <fog_pars_fragment>
  9487. #include <normal_pars_fragment>
  9488. #include <bumpmap_pars_fragment>
  9489. #include <normalmap_pars_fragment>
  9490. #include <logdepthbuf_pars_fragment>
  9491. #include <clipping_planes_pars_fragment>
  9492. void main() {
  9493. vec4 diffuseColor = vec4( diffuse, opacity );
  9494. #include <clipping_planes_fragment>
  9495. #include <logdepthbuf_fragment>
  9496. #include <map_fragment>
  9497. #include <color_fragment>
  9498. #include <alphamap_fragment>
  9499. #include <alphatest_fragment>
  9500. #include <alphahash_fragment>
  9501. #include <normal_fragment_begin>
  9502. #include <normal_fragment_maps>
  9503. vec3 viewDir = normalize( vViewPosition );
  9504. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  9505. vec3 y = cross( viewDir, x );
  9506. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
  9507. #ifdef USE_MATCAP
  9508. vec4 matcapColor = texture2D( matcap, uv );
  9509. #else
  9510. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
  9511. #endif
  9512. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  9513. #include <opaque_fragment>
  9514. #include <tonemapping_fragment>
  9515. #include <colorspace_fragment>
  9516. #include <fog_fragment>
  9517. #include <premultiplied_alpha_fragment>
  9518. #include <dithering_fragment>
  9519. }`,GIe=`#define NORMAL
  9520. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  9521. varying vec3 vViewPosition;
  9522. #endif
  9523. #include <common>
  9524. #include <batching_pars_vertex>
  9525. #include <uv_pars_vertex>
  9526. #include <displacementmap_pars_vertex>
  9527. #include <normal_pars_vertex>
  9528. #include <morphtarget_pars_vertex>
  9529. #include <skinning_pars_vertex>
  9530. #include <logdepthbuf_pars_vertex>
  9531. #include <clipping_planes_pars_vertex>
  9532. void main() {
  9533. #include <uv_vertex>
  9534. #include <batching_vertex>
  9535. #include <beginnormal_vertex>
  9536. #include <morphinstance_vertex>
  9537. #include <morphnormal_vertex>
  9538. #include <skinbase_vertex>
  9539. #include <skinnormal_vertex>
  9540. #include <defaultnormal_vertex>
  9541. #include <normal_vertex>
  9542. #include <begin_vertex>
  9543. #include <morphtarget_vertex>
  9544. #include <skinning_vertex>
  9545. #include <displacementmap_vertex>
  9546. #include <project_vertex>
  9547. #include <logdepthbuf_vertex>
  9548. #include <clipping_planes_vertex>
  9549. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  9550. vViewPosition = - mvPosition.xyz;
  9551. #endif
  9552. }`,HIe=`#define NORMAL
  9553. uniform float opacity;
  9554. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  9555. varying vec3 vViewPosition;
  9556. #endif
  9557. #include <packing>
  9558. #include <uv_pars_fragment>
  9559. #include <normal_pars_fragment>
  9560. #include <bumpmap_pars_fragment>
  9561. #include <normalmap_pars_fragment>
  9562. #include <logdepthbuf_pars_fragment>
  9563. #include <clipping_planes_pars_fragment>
  9564. void main() {
  9565. vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
  9566. #include <clipping_planes_fragment>
  9567. #include <logdepthbuf_fragment>
  9568. #include <normal_fragment_begin>
  9569. #include <normal_fragment_maps>
  9570. gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
  9571. #ifdef OPAQUE
  9572. gl_FragColor.a = 1.0;
  9573. #endif
  9574. }`,WIe=`#define PHONG
  9575. varying vec3 vViewPosition;
  9576. #include <common>
  9577. #include <batching_pars_vertex>
  9578. #include <uv_pars_vertex>
  9579. #include <displacementmap_pars_vertex>
  9580. #include <envmap_pars_vertex>
  9581. #include <color_pars_vertex>
  9582. #include <fog_pars_vertex>
  9583. #include <normal_pars_vertex>
  9584. #include <morphtarget_pars_vertex>
  9585. #include <skinning_pars_vertex>
  9586. #include <shadowmap_pars_vertex>
  9587. #include <logdepthbuf_pars_vertex>
  9588. #include <clipping_planes_pars_vertex>
  9589. void main() {
  9590. #include <uv_vertex>
  9591. #include <color_vertex>
  9592. #include <morphcolor_vertex>
  9593. #include <batching_vertex>
  9594. #include <beginnormal_vertex>
  9595. #include <morphinstance_vertex>
  9596. #include <morphnormal_vertex>
  9597. #include <skinbase_vertex>
  9598. #include <skinnormal_vertex>
  9599. #include <defaultnormal_vertex>
  9600. #include <normal_vertex>
  9601. #include <begin_vertex>
  9602. #include <morphtarget_vertex>
  9603. #include <skinning_vertex>
  9604. #include <displacementmap_vertex>
  9605. #include <project_vertex>
  9606. #include <logdepthbuf_vertex>
  9607. #include <clipping_planes_vertex>
  9608. vViewPosition = - mvPosition.xyz;
  9609. #include <worldpos_vertex>
  9610. #include <envmap_vertex>
  9611. #include <shadowmap_vertex>
  9612. #include <fog_vertex>
  9613. }`,XIe=`#define PHONG
  9614. uniform vec3 diffuse;
  9615. uniform vec3 emissive;
  9616. uniform vec3 specular;
  9617. uniform float shininess;
  9618. uniform float opacity;
  9619. #include <common>
  9620. #include <packing>
  9621. #include <dithering_pars_fragment>
  9622. #include <color_pars_fragment>
  9623. #include <uv_pars_fragment>
  9624. #include <map_pars_fragment>
  9625. #include <alphamap_pars_fragment>
  9626. #include <alphatest_pars_fragment>
  9627. #include <alphahash_pars_fragment>
  9628. #include <aomap_pars_fragment>
  9629. #include <lightmap_pars_fragment>
  9630. #include <emissivemap_pars_fragment>
  9631. #include <envmap_common_pars_fragment>
  9632. #include <envmap_pars_fragment>
  9633. #include <fog_pars_fragment>
  9634. #include <bsdfs>
  9635. #include <lights_pars_begin>
  9636. #include <normal_pars_fragment>
  9637. #include <lights_phong_pars_fragment>
  9638. #include <shadowmap_pars_fragment>
  9639. #include <bumpmap_pars_fragment>
  9640. #include <normalmap_pars_fragment>
  9641. #include <specularmap_pars_fragment>
  9642. #include <logdepthbuf_pars_fragment>
  9643. #include <clipping_planes_pars_fragment>
  9644. void main() {
  9645. vec4 diffuseColor = vec4( diffuse, opacity );
  9646. #include <clipping_planes_fragment>
  9647. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9648. vec3 totalEmissiveRadiance = emissive;
  9649. #include <logdepthbuf_fragment>
  9650. #include <map_fragment>
  9651. #include <color_fragment>
  9652. #include <alphamap_fragment>
  9653. #include <alphatest_fragment>
  9654. #include <alphahash_fragment>
  9655. #include <specularmap_fragment>
  9656. #include <normal_fragment_begin>
  9657. #include <normal_fragment_maps>
  9658. #include <emissivemap_fragment>
  9659. #include <lights_phong_fragment>
  9660. #include <lights_fragment_begin>
  9661. #include <lights_fragment_maps>
  9662. #include <lights_fragment_end>
  9663. #include <aomap_fragment>
  9664. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  9665. #include <envmap_fragment>
  9666. #include <opaque_fragment>
  9667. #include <tonemapping_fragment>
  9668. #include <colorspace_fragment>
  9669. #include <fog_fragment>
  9670. #include <premultiplied_alpha_fragment>
  9671. #include <dithering_fragment>
  9672. }`,YIe=`#define STANDARD
  9673. varying vec3 vViewPosition;
  9674. #ifdef USE_TRANSMISSION
  9675. varying vec3 vWorldPosition;
  9676. #endif
  9677. #include <common>
  9678. #include <batching_pars_vertex>
  9679. #include <uv_pars_vertex>
  9680. #include <displacementmap_pars_vertex>
  9681. #include <color_pars_vertex>
  9682. #include <fog_pars_vertex>
  9683. #include <normal_pars_vertex>
  9684. #include <morphtarget_pars_vertex>
  9685. #include <skinning_pars_vertex>
  9686. #include <shadowmap_pars_vertex>
  9687. #include <logdepthbuf_pars_vertex>
  9688. #include <clipping_planes_pars_vertex>
  9689. void main() {
  9690. #include <uv_vertex>
  9691. #include <color_vertex>
  9692. #include <morphinstance_vertex>
  9693. #include <morphcolor_vertex>
  9694. #include <batching_vertex>
  9695. #include <beginnormal_vertex>
  9696. #include <morphnormal_vertex>
  9697. #include <skinbase_vertex>
  9698. #include <skinnormal_vertex>
  9699. #include <defaultnormal_vertex>
  9700. #include <normal_vertex>
  9701. #include <begin_vertex>
  9702. #include <morphtarget_vertex>
  9703. #include <skinning_vertex>
  9704. #include <displacementmap_vertex>
  9705. #include <project_vertex>
  9706. #include <logdepthbuf_vertex>
  9707. #include <clipping_planes_vertex>
  9708. vViewPosition = - mvPosition.xyz;
  9709. #include <worldpos_vertex>
  9710. #include <shadowmap_vertex>
  9711. #include <fog_vertex>
  9712. #ifdef USE_TRANSMISSION
  9713. vWorldPosition = worldPosition.xyz;
  9714. #endif
  9715. }`,qIe=`#define STANDARD
  9716. #ifdef PHYSICAL
  9717. #define IOR
  9718. #define USE_SPECULAR
  9719. #endif
  9720. uniform vec3 diffuse;
  9721. uniform vec3 emissive;
  9722. uniform float roughness;
  9723. uniform float metalness;
  9724. uniform float opacity;
  9725. #ifdef IOR
  9726. uniform float ior;
  9727. #endif
  9728. #ifdef USE_SPECULAR
  9729. uniform float specularIntensity;
  9730. uniform vec3 specularColor;
  9731. #ifdef USE_SPECULAR_COLORMAP
  9732. uniform sampler2D specularColorMap;
  9733. #endif
  9734. #ifdef USE_SPECULAR_INTENSITYMAP
  9735. uniform sampler2D specularIntensityMap;
  9736. #endif
  9737. #endif
  9738. #ifdef USE_CLEARCOAT
  9739. uniform float clearcoat;
  9740. uniform float clearcoatRoughness;
  9741. #endif
  9742. #ifdef USE_IRIDESCENCE
  9743. uniform float iridescence;
  9744. uniform float iridescenceIOR;
  9745. uniform float iridescenceThicknessMinimum;
  9746. uniform float iridescenceThicknessMaximum;
  9747. #endif
  9748. #ifdef USE_SHEEN
  9749. uniform vec3 sheenColor;
  9750. uniform float sheenRoughness;
  9751. #ifdef USE_SHEEN_COLORMAP
  9752. uniform sampler2D sheenColorMap;
  9753. #endif
  9754. #ifdef USE_SHEEN_ROUGHNESSMAP
  9755. uniform sampler2D sheenRoughnessMap;
  9756. #endif
  9757. #endif
  9758. #ifdef USE_ANISOTROPY
  9759. uniform vec2 anisotropyVector;
  9760. #ifdef USE_ANISOTROPYMAP
  9761. uniform sampler2D anisotropyMap;
  9762. #endif
  9763. #endif
  9764. varying vec3 vViewPosition;
  9765. #include <common>
  9766. #include <packing>
  9767. #include <dithering_pars_fragment>
  9768. #include <color_pars_fragment>
  9769. #include <uv_pars_fragment>
  9770. #include <map_pars_fragment>
  9771. #include <alphamap_pars_fragment>
  9772. #include <alphatest_pars_fragment>
  9773. #include <alphahash_pars_fragment>
  9774. #include <aomap_pars_fragment>
  9775. #include <lightmap_pars_fragment>
  9776. #include <emissivemap_pars_fragment>
  9777. #include <iridescence_fragment>
  9778. #include <cube_uv_reflection_fragment>
  9779. #include <envmap_common_pars_fragment>
  9780. #include <envmap_physical_pars_fragment>
  9781. #include <fog_pars_fragment>
  9782. #include <lights_pars_begin>
  9783. #include <normal_pars_fragment>
  9784. #include <lights_physical_pars_fragment>
  9785. #include <transmission_pars_fragment>
  9786. #include <shadowmap_pars_fragment>
  9787. #include <bumpmap_pars_fragment>
  9788. #include <normalmap_pars_fragment>
  9789. #include <clearcoat_pars_fragment>
  9790. #include <iridescence_pars_fragment>
  9791. #include <roughnessmap_pars_fragment>
  9792. #include <metalnessmap_pars_fragment>
  9793. #include <logdepthbuf_pars_fragment>
  9794. #include <clipping_planes_pars_fragment>
  9795. void main() {
  9796. vec4 diffuseColor = vec4( diffuse, opacity );
  9797. #include <clipping_planes_fragment>
  9798. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9799. vec3 totalEmissiveRadiance = emissive;
  9800. #include <logdepthbuf_fragment>
  9801. #include <map_fragment>
  9802. #include <color_fragment>
  9803. #include <alphamap_fragment>
  9804. #include <alphatest_fragment>
  9805. #include <alphahash_fragment>
  9806. #include <roughnessmap_fragment>
  9807. #include <metalnessmap_fragment>
  9808. #include <normal_fragment_begin>
  9809. #include <normal_fragment_maps>
  9810. #include <clearcoat_normal_fragment_begin>
  9811. #include <clearcoat_normal_fragment_maps>
  9812. #include <emissivemap_fragment>
  9813. #include <lights_physical_fragment>
  9814. #include <lights_fragment_begin>
  9815. #include <lights_fragment_maps>
  9816. #include <lights_fragment_end>
  9817. #include <aomap_fragment>
  9818. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  9819. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  9820. #include <transmission_fragment>
  9821. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  9822. #ifdef USE_SHEEN
  9823. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  9824. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
  9825. #endif
  9826. #ifdef USE_CLEARCOAT
  9827. float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
  9828. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  9829. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
  9830. #endif
  9831. #include <opaque_fragment>
  9832. #include <tonemapping_fragment>
  9833. #include <colorspace_fragment>
  9834. #include <fog_fragment>
  9835. #include <premultiplied_alpha_fragment>
  9836. #include <dithering_fragment>
  9837. }`,ZIe=`#define TOON
  9838. varying vec3 vViewPosition;
  9839. #include <common>
  9840. #include <batching_pars_vertex>
  9841. #include <uv_pars_vertex>
  9842. #include <displacementmap_pars_vertex>
  9843. #include <color_pars_vertex>
  9844. #include <fog_pars_vertex>
  9845. #include <normal_pars_vertex>
  9846. #include <morphtarget_pars_vertex>
  9847. #include <skinning_pars_vertex>
  9848. #include <shadowmap_pars_vertex>
  9849. #include <logdepthbuf_pars_vertex>
  9850. #include <clipping_planes_pars_vertex>
  9851. void main() {
  9852. #include <uv_vertex>
  9853. #include <color_vertex>
  9854. #include <morphinstance_vertex>
  9855. #include <morphcolor_vertex>
  9856. #include <batching_vertex>
  9857. #include <beginnormal_vertex>
  9858. #include <morphnormal_vertex>
  9859. #include <skinbase_vertex>
  9860. #include <skinnormal_vertex>
  9861. #include <defaultnormal_vertex>
  9862. #include <normal_vertex>
  9863. #include <begin_vertex>
  9864. #include <morphtarget_vertex>
  9865. #include <skinning_vertex>
  9866. #include <displacementmap_vertex>
  9867. #include <project_vertex>
  9868. #include <logdepthbuf_vertex>
  9869. #include <clipping_planes_vertex>
  9870. vViewPosition = - mvPosition.xyz;
  9871. #include <worldpos_vertex>
  9872. #include <shadowmap_vertex>
  9873. #include <fog_vertex>
  9874. }`,jIe=`#define TOON
  9875. uniform vec3 diffuse;
  9876. uniform vec3 emissive;
  9877. uniform float opacity;
  9878. #include <common>
  9879. #include <packing>
  9880. #include <dithering_pars_fragment>
  9881. #include <color_pars_fragment>
  9882. #include <uv_pars_fragment>
  9883. #include <map_pars_fragment>
  9884. #include <alphamap_pars_fragment>
  9885. #include <alphatest_pars_fragment>
  9886. #include <alphahash_pars_fragment>
  9887. #include <aomap_pars_fragment>
  9888. #include <lightmap_pars_fragment>
  9889. #include <emissivemap_pars_fragment>
  9890. #include <gradientmap_pars_fragment>
  9891. #include <fog_pars_fragment>
  9892. #include <bsdfs>
  9893. #include <lights_pars_begin>
  9894. #include <normal_pars_fragment>
  9895. #include <lights_toon_pars_fragment>
  9896. #include <shadowmap_pars_fragment>
  9897. #include <bumpmap_pars_fragment>
  9898. #include <normalmap_pars_fragment>
  9899. #include <logdepthbuf_pars_fragment>
  9900. #include <clipping_planes_pars_fragment>
  9901. void main() {
  9902. vec4 diffuseColor = vec4( diffuse, opacity );
  9903. #include <clipping_planes_fragment>
  9904. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9905. vec3 totalEmissiveRadiance = emissive;
  9906. #include <logdepthbuf_fragment>
  9907. #include <map_fragment>
  9908. #include <color_fragment>
  9909. #include <alphamap_fragment>
  9910. #include <alphatest_fragment>
  9911. #include <alphahash_fragment>
  9912. #include <normal_fragment_begin>
  9913. #include <normal_fragment_maps>
  9914. #include <emissivemap_fragment>
  9915. #include <lights_toon_fragment>
  9916. #include <lights_fragment_begin>
  9917. #include <lights_fragment_maps>
  9918. #include <lights_fragment_end>
  9919. #include <aomap_fragment>
  9920. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  9921. #include <opaque_fragment>
  9922. #include <tonemapping_fragment>
  9923. #include <colorspace_fragment>
  9924. #include <fog_fragment>
  9925. #include <premultiplied_alpha_fragment>
  9926. #include <dithering_fragment>
  9927. }`,KIe=`uniform float size;
  9928. uniform float scale;
  9929. #include <common>
  9930. #include <color_pars_vertex>
  9931. #include <fog_pars_vertex>
  9932. #include <morphtarget_pars_vertex>
  9933. #include <logdepthbuf_pars_vertex>
  9934. #include <clipping_planes_pars_vertex>
  9935. #ifdef USE_POINTS_UV
  9936. varying vec2 vUv;
  9937. uniform mat3 uvTransform;
  9938. #endif
  9939. void main() {
  9940. #ifdef USE_POINTS_UV
  9941. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  9942. #endif
  9943. #include <color_vertex>
  9944. #include <morphinstance_vertex>
  9945. #include <morphcolor_vertex>
  9946. #include <begin_vertex>
  9947. #include <morphtarget_vertex>
  9948. #include <project_vertex>
  9949. gl_PointSize = size;
  9950. #ifdef USE_SIZEATTENUATION
  9951. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  9952. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  9953. #endif
  9954. #include <logdepthbuf_vertex>
  9955. #include <clipping_planes_vertex>
  9956. #include <worldpos_vertex>
  9957. #include <fog_vertex>
  9958. }`,JIe=`uniform vec3 diffuse;
  9959. uniform float opacity;
  9960. #include <common>
  9961. #include <color_pars_fragment>
  9962. #include <map_particle_pars_fragment>
  9963. #include <alphatest_pars_fragment>
  9964. #include <alphahash_pars_fragment>
  9965. #include <fog_pars_fragment>
  9966. #include <logdepthbuf_pars_fragment>
  9967. #include <clipping_planes_pars_fragment>
  9968. void main() {
  9969. vec4 diffuseColor = vec4( diffuse, opacity );
  9970. #include <clipping_planes_fragment>
  9971. vec3 outgoingLight = vec3( 0.0 );
  9972. #include <logdepthbuf_fragment>
  9973. #include <map_particle_fragment>
  9974. #include <color_fragment>
  9975. #include <alphatest_fragment>
  9976. #include <alphahash_fragment>
  9977. outgoingLight = diffuseColor.rgb;
  9978. #include <opaque_fragment>
  9979. #include <tonemapping_fragment>
  9980. #include <colorspace_fragment>
  9981. #include <fog_fragment>
  9982. #include <premultiplied_alpha_fragment>
  9983. }`,$Ie=`#include <common>
  9984. #include <batching_pars_vertex>
  9985. #include <fog_pars_vertex>
  9986. #include <morphtarget_pars_vertex>
  9987. #include <skinning_pars_vertex>
  9988. #include <logdepthbuf_pars_vertex>
  9989. #include <shadowmap_pars_vertex>
  9990. void main() {
  9991. #include <batching_vertex>
  9992. #include <beginnormal_vertex>
  9993. #include <morphinstance_vertex>
  9994. #include <morphnormal_vertex>
  9995. #include <skinbase_vertex>
  9996. #include <skinnormal_vertex>
  9997. #include <defaultnormal_vertex>
  9998. #include <begin_vertex>
  9999. #include <morphtarget_vertex>
  10000. #include <skinning_vertex>
  10001. #include <project_vertex>
  10002. #include <logdepthbuf_vertex>
  10003. #include <worldpos_vertex>
  10004. #include <shadowmap_vertex>
  10005. #include <fog_vertex>
  10006. }`,QIe=`uniform vec3 color;
  10007. uniform float opacity;
  10008. #include <common>
  10009. #include <packing>
  10010. #include <fog_pars_fragment>
  10011. #include <bsdfs>
  10012. #include <lights_pars_begin>
  10013. #include <logdepthbuf_pars_fragment>
  10014. #include <shadowmap_pars_fragment>
  10015. #include <shadowmask_pars_fragment>
  10016. void main() {
  10017. #include <logdepthbuf_fragment>
  10018. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  10019. #include <tonemapping_fragment>
  10020. #include <colorspace_fragment>
  10021. #include <fog_fragment>
  10022. }`,eNe=`uniform float rotation;
  10023. uniform vec2 center;
  10024. #include <common>
  10025. #include <uv_pars_vertex>
  10026. #include <fog_pars_vertex>
  10027. #include <logdepthbuf_pars_vertex>
  10028. #include <clipping_planes_pars_vertex>
  10029. void main() {
  10030. #include <uv_vertex>
  10031. vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
  10032. vec2 scale;
  10033. scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
  10034. scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
  10035. #ifndef USE_SIZEATTENUATION
  10036. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  10037. if ( isPerspective ) scale *= - mvPosition.z;
  10038. #endif
  10039. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  10040. vec2 rotatedPosition;
  10041. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  10042. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  10043. mvPosition.xy += rotatedPosition;
  10044. gl_Position = projectionMatrix * mvPosition;
  10045. #include <logdepthbuf_vertex>
  10046. #include <clipping_planes_vertex>
  10047. #include <fog_vertex>
  10048. }`,tNe=`uniform vec3 diffuse;
  10049. uniform float opacity;
  10050. #include <common>
  10051. #include <uv_pars_fragment>
  10052. #include <map_pars_fragment>
  10053. #include <alphamap_pars_fragment>
  10054. #include <alphatest_pars_fragment>
  10055. #include <alphahash_pars_fragment>
  10056. #include <fog_pars_fragment>
  10057. #include <logdepthbuf_pars_fragment>
  10058. #include <clipping_planes_pars_fragment>
  10059. void main() {
  10060. vec4 diffuseColor = vec4( diffuse, opacity );
  10061. #include <clipping_planes_fragment>
  10062. vec3 outgoingLight = vec3( 0.0 );
  10063. #include <logdepthbuf_fragment>
  10064. #include <map_fragment>
  10065. #include <alphamap_fragment>
  10066. #include <alphatest_fragment>
  10067. #include <alphahash_fragment>
  10068. outgoingLight = diffuseColor.rgb;
  10069. #include <opaque_fragment>
  10070. #include <tonemapping_fragment>
  10071. #include <colorspace_fragment>
  10072. #include <fog_fragment>
  10073. }`,vr={alphahash_fragment:MDe,alphahash_pars_fragment:bDe,alphamap_fragment:wDe,alphamap_pars_fragment:TDe,alphatest_fragment:EDe,alphatest_pars_fragment:ADe,aomap_fragment:CDe,aomap_pars_fragment:RDe,batching_pars_vertex:LDe,batching_vertex:PDe,begin_vertex:DDe,beginnormal_vertex:IDe,bsdfs:NDe,iridescence_fragment:UDe,bumpmap_pars_fragment:ODe,clipping_planes_fragment:zDe,clipping_planes_pars_fragment:FDe,clipping_planes_pars_vertex:BDe,clipping_planes_vertex:kDe,color_fragment:VDe,color_pars_fragment:GDe,color_pars_vertex:HDe,color_vertex:WDe,common:XDe,cube_uv_reflection_fragment:YDe,defaultnormal_vertex:qDe,displacementmap_pars_vertex:ZDe,displacementmap_vertex:jDe,emissivemap_fragment:KDe,emissivemap_pars_fragment:JDe,colorspace_fragment:$De,colorspace_pars_fragment:QDe,envmap_fragment:e2e,envmap_common_pars_fragment:t2e,envmap_pars_fragment:r2e,envmap_pars_vertex:i2e,envmap_physical_pars_fragment:m2e,envmap_vertex:n2e,fog_vertex:a2e,fog_pars_vertex:o2e,fog_fragment:s2e,fog_pars_fragment:l2e,gradientmap_pars_fragment:u2e,lightmap_fragment:c2e,lightmap_pars_fragment:f2e,lights_lambert_fragment:h2e,lights_lambert_pars_fragment:p2e,lights_pars_begin:d2e,lights_toon_fragment:v2e,lights_toon_pars_fragment:g2e,lights_phong_fragment:y2e,lights_phong_pars_fragment:_2e,lights_physical_fragment:x2e,lights_physical_pars_fragment:S2e,lights_fragment_begin:M2e,lights_fragment_maps:b2e,lights_fragment_end:w2e,logdepthbuf_fragment:T2e,logdepthbuf_pars_fragment:E2e,logdepthbuf_pars_vertex:A2e,logdepthbuf_vertex:C2e,map_fragment:R2e,map_pars_fragment:L2e,map_particle_fragment:P2e,map_particle_pars_fragment:D2e,metalnessmap_fragment:I2e,metalnessmap_pars_fragment:N2e,morphinstance_vertex:U2e,morphcolor_vertex:O2e,morphnormal_vertex:z2e,morphtarget_pars_vertex:F2e,morphtarget_vertex:B2e,normal_fragment_begin:k2e,normal_fragment_maps:V2e,normal_pars_fragment:G2e,normal_pars_vertex:H2e,normal_vertex:W2e,normalmap_pars_fragment:X2e,clearcoat_normal_fragment_begin:Y2e,clearcoat_normal_fragment_maps:q2e,clearcoat_pars_fragment:Z2e,iridescence_pars_fragment:j2e,opaque_fragment:K2e,packing:J2e,premultiplied_alpha_fragment:$2e,project_vertex:Q2e,dithering_fragment:eIe,dithering_pars_fragment:tIe,roughnessmap_fragment:rIe,roughnessmap_pars_fragment:iIe,shadowmap_pars_fragment:nIe,shadowmap_pars_vertex:aIe,shadowmap_vertex:oIe,shadowmask_pars_fragment:sIe,skinbase_vertex:lIe,skinning_pars_vertex:uIe,skinning_vertex:cIe,skinnormal_vertex:fIe,specularmap_fragment:hIe,specularmap_pars_fragment:pIe,tonemapping_fragment:dIe,tonemapping_pars_fragment:mIe,transmission_fragment:vIe,transmission_pars_fragment:gIe,uv_pars_fragment:yIe,uv_pars_vertex:_Ie,uv_vertex:xIe,worldpos_vertex:SIe,background_vert:MIe,background_frag:bIe,backgroundCube_vert:wIe,backgroundCube_frag:TIe,cube_vert:EIe,cube_frag:AIe,depth_vert:CIe,depth_frag:RIe,distanceRGBA_vert:LIe,distanceRGBA_frag:PIe,equirect_vert:DIe,equirect_frag:IIe,linedashed_vert:NIe,linedashed_frag:UIe,meshbasic_vert:OIe,meshbasic_frag:zIe,meshlambert_vert:FIe,meshlambert_frag:BIe,meshmatcap_vert:kIe,meshmatcap_frag:VIe,meshnormal_vert:GIe,meshnormal_frag:HIe,meshphong_vert:WIe,meshphong_frag:XIe,meshphysical_vert:YIe,meshphysical_frag:qIe,meshtoon_vert:ZIe,meshtoon_frag:jIe,points_vert:KIe,points_frag:JIe,shadow_vert:$Ie,shadow_frag:QIe,sprite_vert:eNe,sprite_frag:tNe},yt={common:{diffuse:{value:new tr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new dr},alphaMap:{value:null},alphaMapTransform:{value:new dr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new dr}},envmap:{envMap:{value:null},envMapRotation:{value:new dr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new dr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new dr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new dr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new dr},normalScale:{value:new yr(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new dr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new dr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new dr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new dr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new tr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new dr},alphaTest:{value:0},uvTransform:{value:new dr}},sprite:{diffuse:{value:new tr(16777215)},opacity:{value:1},center:{value:new yr(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new dr},alphaMap:{value:null},alphaMapTransform:{value:new dr},alphaTest:{value:0}}},cu={basic:{uniforms:wa([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.fog]),vertexShader:vr.meshbasic_vert,fragmentShader:vr.meshbasic_frag},lambert:{uniforms:wa([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new tr(0)}}]),vertexShader:vr.meshlambert_vert,fragmentShader:vr.meshlambert_frag},phong:{uniforms:wa([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new tr(0)},specular:{value:new tr(1118481)},shininess:{value:30}}]),vertexShader:vr.meshphong_vert,fragmentShader:vr.meshphong_frag},standard:{uniforms:wa([yt.common,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.roughnessmap,yt.metalnessmap,yt.fog,yt.lights,{emissive:{value:new tr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:vr.meshphysical_vert,fragmentShader:vr.meshphysical_frag},toon:{uniforms:wa([yt.common,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.gradientmap,yt.fog,yt.lights,{emissive:{value:new tr(0)}}]),vertexShader:vr.meshtoon_vert,fragmentShader:vr.meshtoon_frag},matcap:{uniforms:wa([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,{matcap:{value:null}}]),vertexShader:vr.meshmatcap_vert,fragmentShader:vr.meshmatcap_frag},points:{uniforms:wa([yt.points,yt.fog]),vertexShader:vr.points_vert,fragmentShader:vr.points_frag},dashed:{uniforms:wa([yt.common,yt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vr.linedashed_vert,fragmentShader:vr.linedashed_frag},depth:{uniforms:wa([yt.common,yt.displacementmap]),vertexShader:vr.depth_vert,fragmentShader:vr.depth_frag},normal:{uniforms:wa([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,{opacity:{value:1}}]),vertexShader:vr.meshnormal_vert,fragmentShader:vr.meshnormal_frag},sprite:{uniforms:wa([yt.sprite,yt.fog]),vertexShader:vr.sprite_vert,fragmentShader:vr.sprite_frag},background:{uniforms:{uvTransform:{value:new dr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:vr.background_vert,fragmentShader:vr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new dr}},vertexShader:vr.backgroundCube_vert,fragmentShader:vr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vr.cube_vert,fragmentShader:vr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vr.equirect_vert,fragmentShader:vr.equirect_frag},distanceRGBA:{uniforms:wa([yt.common,yt.displacementmap,{referencePosition:{value:new ye},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vr.distanceRGBA_vert,fragmentShader:vr.distanceRGBA_frag},shadow:{uniforms:wa([yt.lights,yt.fog,{color:{value:new tr(0)},opacity:{value:1}}]),vertexShader:vr.shadow_vert,fragmentShader:vr.shadow_frag}};cu.physical={uniforms:wa([cu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new dr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new dr},clearcoatNormalScale:{value:new yr(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new dr},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new dr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new dr},sheen:{value:0},sheenColor:{value:new tr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new dr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new dr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new dr},transmissionSamplerSize:{value:new yr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new dr},attenuationDistance:{value:0},attenuationColor:{value:new tr(0)},specularColor:{value:new tr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new dr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new dr},anisotropyVector:{value:new yr},anisotropyMap:{value:null},anisotropyMapTransform:{value:new dr}}]),vertexShader:vr.meshphysical_vert,fragmentShader:vr.meshphysical_frag};var ZC={r:0,b:0,g:0},lm=new zn,rNe=new Ht;function iNe(r,e,t,i,n,a,o){let s=new tr(0),l=a===!0?0:1,u,c,f=null,h=0,p=null;function d(m,v){let _=!1,y=v.isScene===!0?v.background:null;y&&y.isTexture&&(y=(v.backgroundBlurriness>0?t:e).get(y)),y===null?g(s,l):y&&y.isColor&&(g(y,1),_=!0);let x=r.xr.getEnvironmentBlendMode();x==="additive"?i.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(r.autoClear||_)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===OR)?(c===void 0&&(c=new co(new UM(1,1,1),new hu({name:"BackgroundCubeMaterial",uniforms:v0(cu.backgroundCube.uniforms),vertexShader:cu.backgroundCube.vertexShader,fragmentShader:cu.backgroundCube.fragmentShader,side:fo,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(M,S,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),lm.copy(v.backgroundRotation),lm.x*=-1,lm.y*=-1,lm.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(lm.y*=-1,lm.z*=-1),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(rNe.makeRotationFromEuler(lm)),c.material.toneMapped=$r.getTransfer(y.colorSpace)!==oi,(f!==y||h!==y.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(u===void 0&&(u=new co(new gR(2,2),new hu({name:"BackgroundMaterial",uniforms:v0(cu.background.uniforms),vertexShader:cu.background.vertexShader,fragmentShader:cu.background.fragmentShader,side:zh,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=y,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=$r.getTransfer(y.colorSpace)!==oi,y.matrixAutoUpdate===!0&&y.updateMatrix(),u.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null))}function g(m,v){m.getRGB(ZC,nse(r)),i.buffers.color.setClear(ZC.r,ZC.g,ZC.b,v,o)}return{getClearColor:function(){return s},setClearColor:function(m,v=1){s.set(m),l=v,g(s,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,g(s,l)},render:d}}function nNe(r,e,t,i){let n=r.getParameter(r.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||a!==null,s={},l=m(null),u=l,c=!1;function f(A,D,U,B,z){let k=!1;if(o){let G=g(B,U,D);u!==G&&(u=G,p(u.object)),k=v(A,B,U,z),k&&_(A,B,U,z)}else{let G=D.wireframe===!0;(u.geometry!==B.id||u.program!==U.id||u.wireframe!==G)&&(u.geometry=B.id,u.program=U.id,u.wireframe=G,k=!0)}z!==null&&t.update(z,r.ELEMENT_ARRAY_BUFFER),(k||c)&&(c=!1,T(A,D,U,B),z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function h(){return i.isWebGL2?r.createVertexArray():a.createVertexArrayOES()}function p(A){return i.isWebGL2?r.bindVertexArray(A):a.bindVertexArrayOES(A)}function d(A){return i.isWebGL2?r.deleteVertexArray(A):a.deleteVertexArrayOES(A)}function g(A,D,U){let B=U.wireframe===!0,z=s[A.id];z===void 0&&(z={},s[A.id]=z);let k=z[D.id];k===void 0&&(k={},z[D.id]=k);let G=k[B];return G===void 0&&(G=m(h()),k[B]=G),G}function m(A){let D=[],U=[],B=[];for(let z=0;z<n;z++)D[z]=0,U[z]=0,B[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:D,enabledAttributes:U,attributeDivisors:B,object:A,attributes:{},index:null}}function v(A,D,U,B){let z=u.attributes,k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=z[J],K=k[J];if(K===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(K=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(K=A.instanceColor)),V===void 0||V.attribute!==K||K&&V.data!==K.data)return!0;G++}return u.attributesNum!==G||u.index!==B}function _(A,D,U,B){let z={},k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=k[J];V===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(V=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(V=A.instanceColor));let K={};K.attribute=V,V&&V.data&&(K.data=V.data),z[J]=K,G++}u.attributes=z,u.attributesNum=G,u.index=B}function y(){let A=u.newAttributes;for(let D=0,U=A.length;D<U;D++)A[D]=0}function x(A){M(A,0)}function M(A,D){let U=u.newAttributes,B=u.enabledAttributes,z=u.attributeDivisors;U[A]=1,B[A]===0&&(r.enableVertexAttribArray(A),B[A]=1),z[A]!==D&&((i.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,D),z[A]=D)}function S(){let A=u.newAttributes,D=u.enabledAttributes;for(let U=0,B=D.length;U<B;U++)D[U]!==A[U]&&(r.disableVertexAttribArray(U),D[U]=0)}function w(A,D,U,B,z,k,G){G===!0?r.vertexAttribIPointer(A,D,U,z,k):r.vertexAttribPointer(A,D,U,B,z,k)}function T(A,D,U,B){if(i.isWebGL2===!1&&(A.isInstancedMesh||B.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();let z=B.attributes,k=U.getAttributes(),G=D.defaultAttributeValues;for(let Y in k){let J=k[Y];if(J.location>=0){let Q=z[Y];if(Q===void 0&&(Y==="instanceMatrix"&&A.instanceMatrix&&(Q=A.instanceMatrix),Y==="instanceColor"&&A.instanceColor&&(Q=A.instanceColor)),Q!==void 0){let V=Q.normalized,K=Q.itemSize,ae=t.get(Q);if(ae===void 0)continue;let ve=ae.buffer,ue=ae.type,se=ae.bytesPerElement,Ee=i.isWebGL2===!0&&(ue===r.INT||ue===r.UNSIGNED_INT||Q.gpuType===Zoe);if(Q.isInterleavedBufferAttribute){let q=Q.data,H=q.stride,We=Q.offset;if(q.isInstancedInterleavedBuffer){for(let _e=0;_e<J.locationSize;_e++)M(J.location+_e,q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=q.meshPerAttribute*q.count)}else for(let _e=0;_e<J.locationSize;_e++)x(J.location+_e);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let _e=0;_e<J.locationSize;_e++)w(J.location+_e,K/J.locationSize,ue,V,H*se,(We+K/J.locationSize*_e)*se,Ee)}else{if(Q.isInstancedBufferAttribute){for(let q=0;q<J.locationSize;q++)M(J.location+q,Q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=Q.meshPerAttribute*Q.count)}else for(let q=0;q<J.locationSize;q++)x(J.location+q);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let q=0;q<J.locationSize;q++)w(J.location+q,K/J.locationSize,ue,V,K*se,K/J.locationSize*q*se,Ee)}}else if(G!==void 0){let V=G[Y];if(V!==void 0)switch(V.length){case 2:r.vertexAttrib2fv(J.location,V);break;case 3:r.vertexAttrib3fv(J.location,V);break;case 4:r.vertexAttrib4fv(J.location,V);break;default:r.vertexAttrib1fv(J.location,V)}}}}S()}function C(){I();for(let A in s){let D=s[A];for(let U in D){let B=D[U];for(let z in B)d(B[z].object),delete B[z];delete D[U]}delete s[A]}}function b(A){if(s[A.id]===void 0)return;let D=s[A.id];for(let U in D){let B=D[U];for(let z in B)d(B[z].object),delete B[z];delete D[U]}delete s[A.id]}function E(A){for(let D in s){let U=s[D];if(U[A.id]===void 0)continue;let B=U[A.id];for(let z in B)d(B[z].object),delete B[z];delete U[A.id]}}function I(){R(),c=!0,u!==l&&(u=l,p(u.object))}function R(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:f,reset:I,resetDefaultState:R,dispose:C,releaseStatesOfGeometry:b,releaseStatesOfProgram:E,initAttributes:y,enableAttribute:x,disableUnusedAttributes:S}}function aNe(r,e,t,i){let n=i.isWebGL2,a;function o(c){a=c}function s(c,f){r.drawArrays(a,c,f),t.update(f,a,1)}function l(c,f,h){if(h===0)return;let p,d;if(n)p=r,d="drawArraysInstanced";else if(p=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[d](a,c,f,h),t.update(f,a,h)}function u(c,f,h){if(h===0)return;let p=e.get("WEBGL_multi_draw");if(p===null)for(let d=0;d<h;d++)this.render(c[d],f[d]);else{p.multiDrawArraysWEBGL(a,c,0,f,0,h);let d=0;for(let g=0;g<h;g++)d+=f[g];t.update(d,a,1)}}this.setMode=o,this.render=s,this.renderInstances=l,this.renderMultiDraw=u}function oNe(r,e,t){let i;function n(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let w=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(w){if(w==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext",s=t.precision!==void 0?t.precision:"highp",l=a(s);l!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",l,"instead."),s=l);let u=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),h=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_TEXTURE_SIZE),d=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),m=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),_=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,x=o||e.has("OES_texture_float"),M=y&&x,S=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:n,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:c,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:S}}function sNe(r){let e=this,t=null,i=0,n=!1,a=!1,o=new vc,s=new dr,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){let p=f.length!==0||h||i!==0||n;return n=h,i=f.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,h){t=c(f,h,0)},this.setState=function(f,h,p){let d=f.clippingPlanes,g=f.clipIntersection,m=f.clipShadows,v=r.get(f);if(!n||d===null||d.length===0||a&&!m)a?c(null):u();else{let _=a?0:i,y=_*4,x=v.clippingState||null;l.value=x,x=c(d,h,y,p);for(let M=0;M!==y;++M)x[M]=t[M];v.clippingState=x,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=_}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(f,h,p,d){let g=f!==null?f.length:0,m=null;if(g!==0){if(m=l.value,d!==!0||m===null){let v=p+g*4,_=h.matrixWorldInverse;s.getNormalMatrix(_),(m===null||m.length<v)&&(m=new Float32Array(v));for(let y=0,x=p;y!==g;++y,x+=4)o.copy(f[y]).applyMatrix4(_,s),o.normal.toArray(m,x),m[x+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,m}}function lNe(r){let e=new WeakMap;function t(o,s){return s===PM?o.mapping=c0:s===ek&&(o.mapping=f0),o}function i(o){if(o&&o.isTexture){let s=o.mapping;if(s===PM||s===ek)if(e.has(o)){let l=e.get(o).texture;return t(l,o.mapping)}else{let l=o.image;if(l&&l.height>0){let u=new sk(l.height);return u.fromEquirectangularTexture(r,o),e.set(o,u),o.addEventListener("dispose",n),t(u.texture,o.mapping)}else return null}}return o}function n(o){let s=o.target;s.removeEventListener("dispose",n);let l=e.get(s);l!==void 0&&(e.delete(s),l.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}var g0=class extends mR{constructor(e=-1,t=1,i=1,n=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=a,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,a,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,a=i-e,o=i+e,s=n+t,l=n-t;if(this.view!==null&&this.view.enabled){let u=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=u*this.view.offsetX,o=a+u*this.view.width,s-=c*this.view.offsetY,l=s-c*this.view.height}this.projectionMatrix.makeOrthographic(a,o,s,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},n0=4,coe=[.125,.215,.35,.446,.526,.582],hm=20,GB=new g0,foe=new tr,HB=null,WB=0,XB=0,cm=(1+Math.sqrt(5))/2,t0=1/cm,hoe=[new ye(1,1,1),new ye(-1,1,1),new ye(1,1,-1),new ye(-1,1,-1),new ye(0,cm,t0),new ye(0,cm,-t0),new ye(t0,0,cm),new ye(-t0,0,cm),new ye(cm,t0,0),new ye(-cm,t0,0)],yR=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){HB=this._renderer.getRenderTarget(),WB=this._renderer.getActiveCubeFace(),XB=this._renderer.getActiveMipmapLevel(),this._setSize(256);let a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,i,n,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=moe(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=doe(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(HB,WB,XB),e.scissorTest=!1,jC(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===c0||e.mapping===f0?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),HB=this._renderer.getRenderTarget(),WB=this._renderer.getActiveCubeFace(),XB=this._renderer.getActiveMipmapLevel();let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:lo,minFilter:lo,generateMipmaps:!1,type:DM,format:Cs,colorSpace:Xh,depthBuffer:!1},n=poe(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=poe(e,t,i);let{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=uNe(a)),this._blurMaterial=cNe(a,e,t)}return n}_compileMaterial(e){let t=new co(this._lodPlanes[0],e);this._renderer.compile(t,GB)}_sceneToCubeUV(e,t,i,n){let s=new Nn(90,1,t,i),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],c=this._renderer,f=c.autoClear,h=c.toneMapping;c.getClearColor(foe),c.toneMapping=Uh,c.autoClear=!1;let p=new pR({name:"PMREM.Background",side:fo,depthWrite:!1,depthTest:!1}),d=new co(new UM,p),g=!1,m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,g=!0):(p.color.copy(foe),g=!0);for(let v=0;v<6;v++){let _=v%3;_===0?(s.up.set(0,l[v],0),s.lookAt(u[v],0,0)):_===1?(s.up.set(0,0,l[v]),s.lookAt(0,u[v],0)):(s.up.set(0,l[v],0),s.lookAt(0,0,u[v]));let y=this._cubeSize;jC(n,_*y,v>2?y:0,y,y),c.setRenderTarget(n),g&&c.render(d,s),c.render(e,s)}d.geometry.dispose(),d.material.dispose(),c.toneMapping=h,c.autoClear=f,e.background=m}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===c0||e.mapping===f0;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=moe()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=doe());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new co(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;jC(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,GB)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let a=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),o=hoe[(n-1)%hoe.length];this._blur(e,n-1,n,a,o)}t.autoClear=i}_blur(e,t,i,n,a){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,n,"latitudinal",a),this._halfBlur(o,e,i,i,n,"longitudinal",a)}_halfBlur(e,t,i,n,a,o,s){let l=this._renderer,u=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let c=3,f=new co(this._lodPlanes[n],u),h=u.uniforms,p=this._sizeLods[i]-1,d=isFinite(a)?Math.PI/(2*p):2*Math.PI/(2*hm-1),g=a/d,m=isFinite(a)?1+Math.floor(c*g):hm;m>hm&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${hm}`);let v=[],_=0;for(let w=0;w<hm;++w){let T=w/g,C=Math.exp(-T*T/2);v.push(C),w===0?_+=C:w<m&&(_+=2*C)}for(let w=0;w<v.length;w++)v[w]=v[w]/_;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=v,h.latitudinal.value=o==="latitudinal",s&&(h.poleAxis.value=s);let{_lodMax:y}=this;h.dTheta.value=d,h.mipInt.value=y-i;let x=this._sizeLods[n],M=3*x*(n>y-n0?n-y+n0:0),S=4*(this._cubeSize-x);jC(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(f,GB)}};function uNe(r){let e=[],t=[],i=[],n=r,a=r-n0+1+coe.length;for(let o=0;o<a;o++){let s=Math.pow(2,n);t.push(s);let l=1/s;o>r-n0?l=coe[o-r+n0-1]:o===0&&(l=0),i.push(l);let u=1/(s-2),c=-u,f=1+u,h=[c,c,f,c,f,f,c,c,f,f,c,f],p=6,d=6,g=3,m=2,v=1,_=new Float32Array(g*d*p),y=new Float32Array(m*d*p),x=new Float32Array(v*d*p);for(let S=0;S<p;S++){let w=S%3*2/3-1,T=S>2?0:-1,C=[w,T,0,w+2/3,T,0,w+2/3,T+1,0,w,T,0,w+2/3,T+1,0,w,T+1,0];_.set(C,g*d*S),y.set(h,m*d*S);let b=[S,S,S,S,S,S];x.set(b,v*d*S)}let M=new Ls;M.setAttribute("position",new Rs(_,g)),M.setAttribute("uv",new Rs(y,m)),M.setAttribute("faceIndex",new Rs(x,v)),e.push(M),n>n0&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function poe(r,e,t){let i=new xc(r,e,t);return i.texture.mapping=OR,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function jC(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function cNe(r,e,t){let i=new Float32Array(hm),n=new ye(0,1,0);return new hu({name:"SphericalGaussianBlur",defines:{n:hm,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:kk(),fragmentShader:`
  10074. precision mediump float;
  10075. precision mediump int;
  10076. varying vec3 vOutputDirection;
  10077. uniform sampler2D envMap;
  10078. uniform int samples;
  10079. uniform float weights[ n ];
  10080. uniform bool latitudinal;
  10081. uniform float dTheta;
  10082. uniform float mipInt;
  10083. uniform vec3 poleAxis;
  10084. #define ENVMAP_TYPE_CUBE_UV
  10085. #include <cube_uv_reflection_fragment>
  10086. vec3 getSample( float theta, vec3 axis ) {
  10087. float cosTheta = cos( theta );
  10088. // Rodrigues' axis-angle rotation
  10089. vec3 sampleDirection = vOutputDirection * cosTheta
  10090. + cross( axis, vOutputDirection ) * sin( theta )
  10091. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  10092. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  10093. }
  10094. void main() {
  10095. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  10096. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  10097. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  10098. }
  10099. axis = normalize( axis );
  10100. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  10101. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  10102. for ( int i = 1; i < n; i++ ) {
  10103. if ( i >= samples ) {
  10104. break;
  10105. }
  10106. float theta = dTheta * float( i );
  10107. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  10108. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  10109. }
  10110. }
  10111. `,blending:Nh,depthTest:!1,depthWrite:!1})}function doe(){return new hu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:kk(),fragmentShader:`
  10112. precision mediump float;
  10113. precision mediump int;
  10114. varying vec3 vOutputDirection;
  10115. uniform sampler2D envMap;
  10116. #include <common>
  10117. void main() {
  10118. vec3 outputDirection = normalize( vOutputDirection );
  10119. vec2 uv = equirectUv( outputDirection );
  10120. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  10121. }
  10122. `,blending:Nh,depthTest:!1,depthWrite:!1})}function moe(){return new hu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:kk(),fragmentShader:`
  10123. precision mediump float;
  10124. precision mediump int;
  10125. uniform float flipEnvMap;
  10126. varying vec3 vOutputDirection;
  10127. uniform samplerCube envMap;
  10128. void main() {
  10129. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  10130. }
  10131. `,blending:Nh,depthTest:!1,depthWrite:!1})}function kk(){return`
  10132. precision mediump float;
  10133. precision mediump int;
  10134. attribute float faceIndex;
  10135. varying vec3 vOutputDirection;
  10136. // RH coordinate system; PMREM face-indexing convention
  10137. vec3 getDirection( vec2 uv, float face ) {
  10138. uv = 2.0 * uv - 1.0;
  10139. vec3 direction = vec3( uv, 1.0 );
  10140. if ( face == 0.0 ) {
  10141. direction = direction.zyx; // ( 1, v, u ) pos x
  10142. } else if ( face == 1.0 ) {
  10143. direction = direction.xzy;
  10144. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  10145. } else if ( face == 2.0 ) {
  10146. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  10147. } else if ( face == 3.0 ) {
  10148. direction = direction.zyx;
  10149. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  10150. } else if ( face == 4.0 ) {
  10151. direction = direction.xzy;
  10152. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  10153. } else if ( face == 5.0 ) {
  10154. direction.z *= -1.0; // ( u, v, -1 ) neg z
  10155. }
  10156. return direction;
  10157. }
  10158. void main() {
  10159. vOutputDirection = getDirection( uv, faceIndex );
  10160. gl_Position = vec4( position, 1.0 );
  10161. }
  10162. `}function fNe(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===PM||l===ek,c=l===c0||l===f0;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let f=e.get(s);return t===null&&(t=new yR(r)),f=u?t.fromEquirectangular(s,f):t.fromCubemap(s,f),e.set(s,f),f.texture}else{if(e.has(s))return e.get(s).texture;{let f=s.image;if(u&&f&&f.height>0||c&&f&&n(f)){t===null&&(t=new yR(r));let h=u?t.fromEquirectangular(s):t.fromCubemap(s);return e.set(s,h),s.addEventListener("dispose",a),h.texture}else return null}}}return s}function n(s){let l=0,u=6;for(let c=0;c<u;c++)s[c]!==void 0&&l++;return l===u}function a(s){let l=s.target;l.removeEventListener("dispose",a);let u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function hNe(r){let e={};function t(i){if(e[i]!==void 0)return e[i];let n;switch(i){case"WEBGL_depth_texture":n=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=r.getExtension(i)}return e[i]=n,n}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){let n=t(i);return n===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),n}}}function pNe(r,e,t,i){let n={},a=new WeakMap;function o(f){let h=f.target;h.index!==null&&e.remove(h.index);for(let d in h.attributes)e.remove(h.attributes[d]);for(let d in h.morphAttributes){let g=h.morphAttributes[d];for(let m=0,v=g.length;m<v;m++)e.remove(g[m])}h.removeEventListener("dispose",o),delete n[h.id];let p=a.get(h);p&&(e.remove(p),a.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function s(f,h){return n[h.id]===!0||(h.addEventListener("dispose",o),n[h.id]=!0,t.memory.geometries++),h}function l(f){let h=f.attributes;for(let d in h)e.update(h[d],r.ARRAY_BUFFER);let p=f.morphAttributes;for(let d in p){let g=p[d];for(let m=0,v=g.length;m<v;m++)e.update(g[m],r.ARRAY_BUFFER)}}function u(f){let h=[],p=f.index,d=f.attributes.position,g=0;if(p!==null){let _=p.array;g=p.version;for(let y=0,x=_.length;y<x;y+=3){let M=_[y+0],S=_[y+1],w=_[y+2];h.push(M,S,S,w,w,M)}}else if(d!==void 0){let _=d.array;g=d.version;for(let y=0,x=_.length/3-1;y<x;y+=3){let M=y+0,S=y+1,w=y+2;h.push(M,S,S,w,w,M)}}else return;let m=new(rse(h)?dR:m0)(h,1);m.version=g;let v=a.get(f);v&&e.remove(v),a.set(f,m)}function c(f){let h=a.get(f);if(h){let p=f.index;p!==null&&h.version<p.version&&u(f)}else u(f);return a.get(f)}return{get:s,update:l,getWireframeAttribute:c}}function dNe(r,e,t,i){let n=i.isWebGL2,a;function o(p){a=p}let s,l;function u(p){s=p.type,l=p.bytesPerElement}function c(p,d){r.drawElements(a,d,s,p*l),t.update(d,a,1)}function f(p,d,g){if(g===0)return;let m,v;if(n)m=r,v="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[v](a,d,s,p*l,g),t.update(d,a,g)}function h(p,d,g){if(g===0)return;let m=e.get("WEBGL_multi_draw");if(m===null)for(let v=0;v<g;v++)this.render(p[v]/l,d[v]);else{m.multiDrawElementsWEBGL(a,d,0,s,p,0,g);let v=0;for(let _=0;_<g;_++)v+=d[_];t.update(v,a,1)}}this.setMode=o,this.setIndex=u,this.render=c,this.renderInstances=f,this.renderMultiDraw=h}function mNe(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,o,s){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=s*(a/3);break;case r.LINES:t.lines+=s*(a/2);break;case r.LINE_STRIP:t.lines+=s*(a-1);break;case r.LINE_LOOP:t.lines+=s*a;break;case r.POINTS:t.points+=s*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function n(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:i}}function vNe(r,e){return r[0]-e[0]}function gNe(r,e){return Math.abs(e[1])-Math.abs(r[1])}function yNe(r,e,t){let i={},n=new Float32Array(8),a=new WeakMap,o=new Rr,s=[];for(let u=0;u<8;u++)s[u]=[u,0];function l(u,c,f){let h=u.morphTargetInfluences;if(e.isWebGL2===!0){let d=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,g=d!==void 0?d.length:0,m=a.get(c);if(m===void 0||m.count!==g){let R=function(){E.dispose(),a.delete(c),c.removeEventListener("dispose",R)};var p=R;m!==void 0&&m.texture.dispose();let v=c.morphAttributes.position!==void 0,_=c.morphAttributes.normal!==void 0,y=c.morphAttributes.color!==void 0,x=c.morphAttributes.position||[],M=c.morphAttributes.normal||[],S=c.morphAttributes.color||[],w=0;v===!0&&(w=1),_===!0&&(w=2),y===!0&&(w=3);let T=c.attributes.position.count*w,C=1;T>e.maxTextureSize&&(C=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);let b=new Float32Array(T*C*4*g),E=new fR(b,T,C,g);E.type=fu,E.needsUpdate=!0;let I=w*4;for(let A=0;A<g;A++){let D=x[A],U=M[A],B=S[A],z=T*C*4*A;for(let k=0;k<D.count;k++){let G=k*I;v===!0&&(o.fromBufferAttribute(D,k),b[z+G+0]=o.x,b[z+G+1]=o.y,b[z+G+2]=o.z,b[z+G+3]=0),_===!0&&(o.fromBufferAttribute(U,k),b[z+G+4]=o.x,b[z+G+5]=o.y,b[z+G+6]=o.z,b[z+G+7]=0),y===!0&&(o.fromBufferAttribute(B,k),b[z+G+8]=o.x,b[z+G+9]=o.y,b[z+G+10]=o.z,b[z+G+11]=B.itemSize===4?o.w:1)}}m={count:g,texture:E,size:new yr(T,C)},a.set(c,m),c.addEventListener("dispose",R)}if(u.isInstancedMesh===!0&&u.morphTexture!==null)f.getUniforms().setValue(r,"morphTexture",u.morphTexture,t);else{let v=0;for(let y=0;y<h.length;y++)v+=h[y];let _=c.morphTargetsRelative?1:1-v;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",h)}f.getUniforms().setValue(r,"morphTargetsTexture",m.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",m.size)}else{let d=h===void 0?0:h.length,g=i[c.id];if(g===void 0||g.length!==d){g=[];for(let x=0;x<d;x++)g[x]=[x,0];i[c.id]=g}for(let x=0;x<d;x++){let M=g[x];M[0]=x,M[1]=h[x]}g.sort(gNe);for(let x=0;x<8;x++)x<d&&g[x][1]?(s[x][0]=g[x][0],s[x][1]=g[x][1]):(s[x][0]=Number.MAX_SAFE_INTEGER,s[x][1]=0);s.sort(vNe);let m=c.morphAttributes.position,v=c.morphAttributes.normal,_=0;for(let x=0;x<8;x++){let M=s[x],S=M[0],w=M[1];S!==Number.MAX_SAFE_INTEGER&&w?(m&&c.getAttribute("morphTarget"+x)!==m[S]&&c.setAttribute("morphTarget"+x,m[S]),v&&c.getAttribute("morphNormal"+x)!==v[S]&&c.setAttribute("morphNormal"+x,v[S]),n[x]=w,_+=w):(m&&c.hasAttribute("morphTarget"+x)===!0&&c.deleteAttribute("morphTarget"+x),v&&c.hasAttribute("morphNormal"+x)===!0&&c.deleteAttribute("morphNormal"+x),n[x]=0)}let y=c.morphTargetsRelative?1:1-_;f.getUniforms().setValue(r,"morphTargetBaseInfluence",y),f.getUniforms().setValue(r,"morphTargetInfluences",n)}}return{update:l}}function _Ne(r,e,t,i){let n=new WeakMap;function a(l){let u=i.render.frame,c=l.geometry,f=e.get(l,c);if(n.get(f)!==u&&(e.update(f),n.set(f,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",s)===!1&&l.addEventListener("dispose",s),n.get(l)!==u&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),n.set(l,u))),l.isSkinnedMesh){let h=l.skeleton;n.get(h)!==u&&(h.update(),n.set(h,u))}return f}function o(){n=new WeakMap}function s(l){let u=l.target;u.removeEventListener("dispose",s),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}var _R=class extends Vo{constructor(e,t,i,n,a,o,s,l,u,c){if(c=c!==void 0?c:mm,c!==mm&&c!==p0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===mm&&(i=Ih),i===void 0&&c===p0&&(i=dm),super(null,n,a,o,s,l,c,i,u),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=s!==void 0?s:Dn,this.minFilter=l!==void 0?l:Dn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},ose=new Vo,sse=new _R(1,1);sse.compareFunction=tse;var lse=new fR,use=new ak,cse=new vR,voe=[],goe=[],yoe=new Float32Array(16),_oe=new Float32Array(9),xoe=new Float32Array(4);function M0(r,e,t){let i=r[0];if(i<=0||i>0)return r;let n=e*t,a=voe[n];if(a===void 0&&(a=new Float32Array(n),voe[n]=a),e!==0){i.toArray(a,0);for(let o=1,s=0;o!==e;++o)s+=t,r[o].toArray(a,s)}return a}function sn(r,e){if(r.length!==e.length)return!1;for(let t=0,i=r.length;t<i;t++)if(r[t]!==e[t])return!1;return!0}function ln(r,e){for(let t=0,i=e.length;t<i;t++)r[t]=e[t]}function FR(r,e){let t=goe[e];t===void 0&&(t=new Int32Array(e),goe[e]=t);for(let i=0;i!==e;++i)t[i]=r.allocateTextureUnit();return t}function xNe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function SNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sn(t,e))return;r.uniform2fv(this.addr,e),ln(t,e)}}function MNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(sn(t,e))return;r.uniform3fv(this.addr,e),ln(t,e)}}function bNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sn(t,e))return;r.uniform4fv(this.addr,e),ln(t,e)}}function wNe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(sn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),ln(t,e)}else{if(sn(t,i))return;xoe.set(i),r.uniformMatrix2fv(this.addr,!1,xoe),ln(t,i)}}function TNe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(sn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),ln(t,e)}else{if(sn(t,i))return;_oe.set(i),r.uniformMatrix3fv(this.addr,!1,_oe),ln(t,i)}}function ENe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(sn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),ln(t,e)}else{if(sn(t,i))return;yoe.set(i),r.uniformMatrix4fv(this.addr,!1,yoe),ln(t,i)}}function ANe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function CNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sn(t,e))return;r.uniform2iv(this.addr,e),ln(t,e)}}function RNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sn(t,e))return;r.uniform3iv(this.addr,e),ln(t,e)}}function LNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sn(t,e))return;r.uniform4iv(this.addr,e),ln(t,e)}}function PNe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function DNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sn(t,e))return;r.uniform2uiv(this.addr,e),ln(t,e)}}function INe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sn(t,e))return;r.uniform3uiv(this.addr,e),ln(t,e)}}function NNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sn(t,e))return;r.uniform4uiv(this.addr,e),ln(t,e)}}function UNe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n);let a=this.type===r.SAMPLER_2D_SHADOW?sse:ose;t.setTexture2D(e||a,n)}function ONe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||use,n)}function zNe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTextureCube(e||cse,n)}function FNe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||lse,n)}function BNe(r){switch(r){case 5126:return xNe;case 35664:return SNe;case 35665:return MNe;case 35666:return bNe;case 35674:return wNe;case 35675:return TNe;case 35676:return ENe;case 5124:case 35670:return ANe;case 35667:case 35671:return CNe;case 35668:case 35672:return RNe;case 35669:case 35673:return LNe;case 5125:return PNe;case 36294:return DNe;case 36295:return INe;case 36296:return NNe;case 35678:case 36198:case 36298:case 36306:case 35682:return UNe;case 35679:case 36299:case 36307:return ONe;case 35680:case 36300:case 36308:case 36293:return zNe;case 36289:case 36303:case 36311:case 36292:return FNe}}function kNe(r,e){r.uniform1fv(this.addr,e)}function VNe(r,e){let t=M0(e,this.size,2);r.uniform2fv(this.addr,t)}function GNe(r,e){let t=M0(e,this.size,3);r.uniform3fv(this.addr,t)}function HNe(r,e){let t=M0(e,this.size,4);r.uniform4fv(this.addr,t)}function WNe(r,e){let t=M0(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function XNe(r,e){let t=M0(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function YNe(r,e){let t=M0(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function qNe(r,e){r.uniform1iv(this.addr,e)}function ZNe(r,e){r.uniform2iv(this.addr,e)}function jNe(r,e){r.uniform3iv(this.addr,e)}function KNe(r,e){r.uniform4iv(this.addr,e)}function JNe(r,e){r.uniform1uiv(this.addr,e)}function $Ne(r,e){r.uniform2uiv(this.addr,e)}function QNe(r,e){r.uniform3uiv(this.addr,e)}function eUe(r,e){r.uniform4uiv(this.addr,e)}function tUe(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTexture2D(e[o]||ose,a[o])}function rUe(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTexture3D(e[o]||use,a[o])}function iUe(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTextureCube(e[o]||cse,a[o])}function nUe(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||lse,a[o])}function aUe(r){switch(r){case 5126:return kNe;case 35664:return VNe;case 35665:return GNe;case 35666:return HNe;case 35674:return WNe;case 35675:return XNe;case 35676:return YNe;case 5124:case 35670:return qNe;case 35667:case 35671:return ZNe;case 35668:case 35672:return jNe;case 35669:case 35673:return KNe;case 5125:return JNe;case 36294:return $Ne;case 36295:return QNe;case 36296:return eUe;case 35678:case 36198:case 36298:case 36306:case 35682:return tUe;case 35679:case 36299:case 36307:return rUe;case 35680:case 36300:case 36308:case 36293:return iUe;case 36289:case 36303:case 36311:case 36292:return nUe}}var lk=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=BNe(t.type)}},uk=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=aUe(t.type)}},ck=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let a=0,o=n.length;a!==o;++a){let s=n[a];s.setValue(e,t[s.id],i)}}},YB=/(\w+)(\])?(\[|\.)?/g;function Soe(r,e){r.seq.push(e),r.map[e.id]=e}function oUe(r,e,t){let i=r.name,n=i.length;for(YB.lastIndex=0;;){let a=YB.exec(i),o=YB.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){Soe(t,u===void 0?new lk(s,r,e):new uk(s,r,e));break}else{let f=t.map[s];f===void 0&&(f=new ck(s),Soe(t,f)),t=f}}}var u0=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){let a=e.getActiveUniform(t,n),o=e.getUniformLocation(t,a.name);oUe(a,o,this)}}setValue(e,t,i,n){let a=this.map[t];a!==void 0&&a.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];n!==void 0&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let a=0,o=t.length;a!==o;++a){let s=t[a],l=i[s.id];l.needsUpdate!==!1&&s.setValue(e,l.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,a=e.length;n!==a;++n){let o=e[n];o.id in t&&i.push(o)}return i}};function Moe(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}var sUe=37297,lUe=0;function uUe(r,e){let t=r.split(`
  10163. `),i=[],n=Math.max(e-6,0),a=Math.min(e+6,t.length);for(let o=n;o<a;o++){let s=o+1;i.push(`${s===e?">":" "} ${s}: ${t[o]}`)}return i.join(`
  10164. `)}function cUe(r){let e=$r.getPrimaries($r.workingColorSpace),t=$r.getPrimaries(r),i;switch(e===t?i="":e===oR&&t===aR?i="LinearDisplayP3ToLinearSRGB":e===aR&&t===oR&&(i="LinearSRGBToLinearDisplayP3"),r){case Xh:case zR:return[i,"LinearTransferOETF"];case Ta:case Fk:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function boe(r,e,t){let i=r.getShaderParameter(e,r.COMPILE_STATUS),n=r.getShaderInfoLog(e).trim();if(i&&n==="")return"";let a=/ERROR: 0:(\d+)/.exec(n);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`
  10165. `+n+`
  10166. `+uUe(r.getShaderSource(e),o)}else return n}function fUe(r,e){let t=cUe(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function hUe(r,e){let t;switch(e){case hPe:t="Linear";break;case pPe:t="Reinhard";break;case dPe:t="OptimizedCineon";break;case mPe:t="ACESFilmic";break;case gPe:t="AgX";break;case yPe:t="Neutral";break;case vPe:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function pUe(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.alphaToCoverage||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(a0).join(`
  10167. `)}function dUe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(a0).join(`
  10168. `)}function mUe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  10169. `)}function vUe(r,e){let t={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){let a=r.getActiveAttrib(e,n),o=a.name,s=1;a.type===r.FLOAT_MAT2&&(s=2),a.type===r.FLOAT_MAT3&&(s=3),a.type===r.FLOAT_MAT4&&(s=4),t[o]={type:a.type,location:r.getAttribLocation(e,o),locationSize:s}}return t}function a0(r){return r!==""}function woe(r,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).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_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Toe(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var gUe=/^[ \t]*#include +<([\w\d./]+)>/gm;function fk(r){return r.replace(gUe,_Ue)}var yUe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function _Ue(r,e){let t=vr[e];if(t===void 0){let i=yUe.get(e);if(i!==void 0)t=vr[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return fk(t)}var xUe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Eoe(r){return r.replace(xUe,SUe)}function SUe(r,e,t,i){let n="";for(let a=parseInt(e);a<parseInt(t);a++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return n}function Aoe(r){let e=`precision ${r.precision} float;
  10170. precision ${r.precision} int;
  10171. precision ${r.precision} sampler2D;
  10172. precision ${r.precision} samplerCube;
  10173. `;return r.isWebGL2&&(e+=`precision ${r.precision} sampler3D;
  10174. precision ${r.precision} sampler2DArray;
  10175. precision ${r.precision} sampler2DShadow;
  10176. precision ${r.precision} samplerCubeShadow;
  10177. precision ${r.precision} sampler2DArrayShadow;
  10178. precision ${r.precision} isampler2D;
  10179. precision ${r.precision} isampler3D;
  10180. precision ${r.precision} isamplerCube;
  10181. precision ${r.precision} isampler2DArray;
  10182. precision ${r.precision} usampler2D;
  10183. precision ${r.precision} usampler3D;
  10184. precision ${r.precision} usamplerCube;
  10185. precision ${r.precision} usampler2DArray;
  10186. `),r.precision==="highp"?e+=`
  10187. #define HIGH_PRECISION`:r.precision==="mediump"?e+=`
  10188. #define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
  10189. #define LOW_PRECISION`),e}function MUe(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===qoe?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===kLe?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===mc&&(e="SHADOWMAP_TYPE_VSM"),e}function bUe(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case c0:case f0:e="ENVMAP_TYPE_CUBE";break;case OR:e="ENVMAP_TYPE_CUBE_UV";break}return e}function wUe(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case f0:e="ENVMAP_MODE_REFRACTION";break}return e}function TUe(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case UR:e="ENVMAP_BLENDING_MULTIPLY";break;case cPe:e="ENVMAP_BLENDING_MIX";break;case fPe:e="ENVMAP_BLENDING_ADD";break}return e}function EUe(r){let e=r.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function AUe(r,e,t,i){let n=r.getContext(),a=t.defines,o=t.vertexShader,s=t.fragmentShader,l=MUe(t),u=bUe(t),c=wUe(t),f=TUe(t),h=EUe(t),p=t.isWebGL2?"":pUe(t),d=dUe(t),g=mUe(a),m=n.createProgram(),v,_,y=t.glslVersion?"#version "+t.glslVersion+`
  10190. `:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(a0).join(`
  10191. `),v.length>0&&(v+=`
  10192. `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(a0).join(`
  10193. `),_.length>0&&(_+=`
  10194. `)):(v=[Aoe(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  10195. `].filter(a0).join(`
  10196. `),_=[p,Aoe(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+c:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Uh?"#define TONE_MAPPING":"",t.toneMapping!==Uh?vr.tonemapping_pars_fragment:"",t.toneMapping!==Uh?hUe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",vr.colorspace_pars_fragment,fUe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  10197. `].filter(a0).join(`
  10198. `)),o=fk(o),o=woe(o,t),o=Toe(o,t),s=fk(s),s=woe(s,t),s=Toe(s,t),o=Eoe(o),s=Eoe(s),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
  10199. `,v=[d,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  10200. `)+`
  10201. `+v,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===Wae?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Wae?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
  10202. `)+`
  10203. `+_);let x=y+v+o,M=y+_+s,S=Moe(n,n.VERTEX_SHADER,x),w=Moe(n,n.FRAGMENT_SHADER,M);n.attachShader(m,S),n.attachShader(m,w),t.index0AttributeName!==void 0?n.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&n.bindAttribLocation(m,0,"position"),n.linkProgram(m);function T(I){if(r.debug.checkShaderErrors){let R=n.getProgramInfoLog(m).trim(),A=n.getShaderInfoLog(S).trim(),D=n.getShaderInfoLog(w).trim(),U=!0,B=!0;if(n.getProgramParameter(m,n.LINK_STATUS)===!1)if(U=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(n,m,S,w);else{let z=boe(n,S,"vertex"),k=boe(n,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(m,n.VALIDATE_STATUS)+`
  10204. Material Name: `+I.name+`
  10205. Material Type: `+I.type+`
  10206. Program Info Log: `+R+`
  10207. `+z+`
  10208. `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||D==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:D,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new u0(n,m),b=vUe(n,m)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let b;this.getAttributes=function(){return b===void 0&&T(this),b};let E=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=n.getProgramParameter(m,sUe)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=lUe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var CUe=0,hk=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),a=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(n)===!1&&(o.add(n),n.usedTimes++),o.has(a)===!1&&(o.add(a),a.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new pk(e),t.set(e,i)),i}},pk=class{constructor(e){this.id=CUe++,this.code=e,this.usedTimes=0}};function RUe(r,e,t,i,n,a,o){let s=new hR,l=new hk,u=new Set,c=[],f=n.isWebGL2,h=n.logarithmicDepthBuffer,p=n.vertexTextures,d=n.precision,g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(b){return u.add(b),b===0?"uv":`uv${b}`}function v(b,E,I,R,A){let D=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,z=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=z&&z.mapping===OR?z.image.height:null,G=g[b.type];b.precision!==null&&(d=n.getMaxPrecision(b.precision),d!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));let Y=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,J=Y!==void 0?Y.length:0,Q=0;U.morphAttributes.position!==void 0&&(Q=1),U.morphAttributes.normal!==void 0&&(Q=2),U.morphAttributes.color!==void 0&&(Q=3);let V,K,ae,ve;if(G){let Ft=cu[G];V=Ft.vertexShader,K=Ft.fragmentShader}else V=b.vertexShader,K=b.fragmentShader,l.update(b),ae=l.getVertexShaderID(b),ve=l.getFragmentShaderID(b);let ue=r.getRenderTarget(),se=A.isInstancedMesh===!0,Ee=A.isBatchedMesh===!0,q=!!b.map,H=!!b.matcap,We=!!z,_e=!!b.aoMap,xe=!!b.lightMap,Le=!!b.bumpMap,Ue=!!b.normalMap,Ne=!!b.displacementMap,Ve=!!b.emissiveMap,ct=!!b.metalnessMap,F=!!b.roughnessMap,L=b.anisotropy>0,ne=b.clearcoat>0,le=b.iridescence>0,me=b.sheen>0,he=b.transmission>0,et=L&&!!b.anisotropyMap,Ke=ne&&!!b.clearcoatMap,Se=ne&&!!b.clearcoatNormalMap,Ae=ne&&!!b.clearcoatRoughnessMap,nt=le&&!!b.iridescenceMap,$=le&&!!b.iridescenceThicknessMap,it=me&&!!b.sheenColorMap,Xe=me&&!!b.sheenRoughnessMap,Fe=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,st=he&&!!b.transmissionMap,Je=he&&!!b.thicknessMap,kt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,Pe=Uh;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(Pe=r.toneMapping);let xt={isWebGL2:f,shaderID:G,shaderType:b.type,shaderName:b.name,vertexShader:V,fragmentShader:K,defines:b.defines,customVertexShaderID:ae,customFragmentShaderID:ve,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,batching:Ee,instancing:se,instancingColor:se&&A.instanceColor!==null,instancingMorph:se&&A.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:ue===null?r.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:Xh,alphaToCoverage:!!b.alphaToCoverage,map:q,matcap:H,envMap:We,envMapMode:We&&z.mapping,envMapCubeUVHeight:k,aoMap:_e,lightMap:xe,bumpMap:Le,normalMap:Ue,displacementMap:p&&Ne,emissiveMap:Ve,normalMapObjectSpace:Ue&&b.normalMapType===PPe,normalMapTangentSpace:Ue&&b.normalMapType===zk,metalnessMap:ct,roughnessMap:F,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:nt,iridescenceThicknessMap:$,sheen:me,sheenColorMap:it,sheenRoughnessMap:Xe,specularMap:Fe,specularColorMap:we,specularIntensityMap:Ie,transmission:he,transmissionMap:st,thicknessMap:Je,gradientMap:kt,opaque:b.transparent===!1&&b.blending===s0&&b.alphaToCoverage===!1,alphaMap:X,alphaTest:Te,alphaHash:te,combine:b.combine,mapUv:q&&m(b.map.channel),aoMapUv:_e&&m(b.aoMap.channel),lightMapUv:xe&&m(b.lightMap.channel),bumpMapUv:Le&&m(b.bumpMap.channel),normalMapUv:Ue&&m(b.normalMap.channel),displacementMapUv:Ne&&m(b.displacementMap.channel),emissiveMapUv:Ve&&m(b.emissiveMap.channel),metalnessMapUv:ct&&m(b.metalnessMap.channel),roughnessMapUv:F&&m(b.roughnessMap.channel),anisotropyMapUv:et&&m(b.anisotropyMap.channel),clearcoatMapUv:Ke&&m(b.clearcoatMap.channel),clearcoatNormalMapUv:Se&&m(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&m(b.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&m(b.iridescenceMap.channel),iridescenceThicknessMapUv:$&&m(b.iridescenceThicknessMap.channel),sheenColorMapUv:it&&m(b.sheenColorMap.channel),sheenRoughnessMapUv:Xe&&m(b.sheenRoughnessMap.channel),specularMapUv:Fe&&m(b.specularMap.channel),specularColorMapUv:we&&m(b.specularColorMap.channel),specularIntensityMapUv:Ie&&m(b.specularIntensityMap.channel),transmissionMapUv:st&&m(b.transmissionMap.channel),thicknessMapUv:Je&&m(b.thicknessMap.channel),alphaMapUv:X&&m(b.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(Ue||L),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:A.isPoints===!0&&!!U.attributes.uv&&(q||X),fog:!!D,useFog:b.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:A.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:Q,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&I.length>0,shadowMapType:r.shadowMap.type,toneMapping:Pe,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&$r.getTransfer(b.map.colorSpace)===oi,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===gc,flipSided:b.side===fo,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Me&&b.extensions.derivatives===!0,extensionFragDepth:Me&&b.extensions.fragDepth===!0,extensionDrawBuffers:Me&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Me&&b.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Me&&b.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Me&&b.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:f||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return xt.vertexUv1s=u.has(1),xt.vertexUv2s=u.has(2),xt.vertexUv3s=u.has(3),u.clear(),xt}function _(b){let E=[];if(b.shaderID?E.push(b.shaderID):(E.push(b.customVertexShaderID),E.push(b.customFragmentShaderID)),b.defines!==void 0)for(let I in b.defines)E.push(I),E.push(b.defines[I]);return b.isRawShaderMaterial===!1&&(y(E,b),x(E,b),E.push(r.outputColorSpace)),E.push(b.customProgramCacheKey),E.join()}function y(b,E){b.push(E.precision),b.push(E.outputColorSpace),b.push(E.envMapMode),b.push(E.envMapCubeUVHeight),b.push(E.mapUv),b.push(E.alphaMapUv),b.push(E.lightMapUv),b.push(E.aoMapUv),b.push(E.bumpMapUv),b.push(E.normalMapUv),b.push(E.displacementMapUv),b.push(E.emissiveMapUv),b.push(E.metalnessMapUv),b.push(E.roughnessMapUv),b.push(E.anisotropyMapUv),b.push(E.clearcoatMapUv),b.push(E.clearcoatNormalMapUv),b.push(E.clearcoatRoughnessMapUv),b.push(E.iridescenceMapUv),b.push(E.iridescenceThicknessMapUv),b.push(E.sheenColorMapUv),b.push(E.sheenRoughnessMapUv),b.push(E.specularMapUv),b.push(E.specularColorMapUv),b.push(E.specularIntensityMapUv),b.push(E.transmissionMapUv),b.push(E.thicknessMapUv),b.push(E.combine),b.push(E.fogExp2),b.push(E.sizeAttenuation),b.push(E.morphTargetsCount),b.push(E.morphAttributeCount),b.push(E.numDirLights),b.push(E.numPointLights),b.push(E.numSpotLights),b.push(E.numSpotLightMaps),b.push(E.numHemiLights),b.push(E.numRectAreaLights),b.push(E.numDirLightShadows),b.push(E.numPointLightShadows),b.push(E.numSpotLightShadows),b.push(E.numSpotLightShadowsWithMaps),b.push(E.numLightProbes),b.push(E.shadowMapType),b.push(E.toneMapping),b.push(E.numClippingPlanes),b.push(E.numClipIntersection),b.push(E.depthPacking)}function x(b,E){s.disableAll(),E.isWebGL2&&s.enable(0),E.supportsVertexTextures&&s.enable(1),E.instancing&&s.enable(2),E.instancingColor&&s.enable(3),E.instancingMorph&&s.enable(4),E.matcap&&s.enable(5),E.envMap&&s.enable(6),E.normalMapObjectSpace&&s.enable(7),E.normalMapTangentSpace&&s.enable(8),E.clearcoat&&s.enable(9),E.iridescence&&s.enable(10),E.alphaTest&&s.enable(11),E.vertexColors&&s.enable(12),E.vertexAlphas&&s.enable(13),E.vertexUv1s&&s.enable(14),E.vertexUv2s&&s.enable(15),E.vertexUv3s&&s.enable(16),E.vertexTangents&&s.enable(17),E.anisotropy&&s.enable(18),E.alphaHash&&s.enable(19),E.batching&&s.enable(20),b.push(s.mask),s.disableAll(),E.fog&&s.enable(0),E.useFog&&s.enable(1),E.flatShading&&s.enable(2),E.logarithmicDepthBuffer&&s.enable(3),E.skinning&&s.enable(4),E.morphTargets&&s.enable(5),E.morphNormals&&s.enable(6),E.morphColors&&s.enable(7),E.premultipliedAlpha&&s.enable(8),E.shadowMapEnabled&&s.enable(9),E.useLegacyLights&&s.enable(10),E.doubleSided&&s.enable(11),E.flipSided&&s.enable(12),E.useDepthPacking&&s.enable(13),E.dithering&&s.enable(14),E.transmission&&s.enable(15),E.sheen&&s.enable(16),E.opaque&&s.enable(17),E.pointsUvs&&s.enable(18),E.decodeVideoTexture&&s.enable(19),E.alphaToCoverage&&s.enable(20),b.push(s.mask)}function M(b){let E=g[b.type],I;if(E){let R=cu[E];I=vDe.clone(R.uniforms)}else I=b.uniforms;return I}function S(b,E){let I;for(let R=0,A=c.length;R<A;R++){let D=c[R];if(D.cacheKey===E){I=D,++I.usedTimes;break}}return I===void 0&&(I=new AUe(r,E,b,a),c.push(I)),I}function w(b){if(--b.usedTimes===0){let E=c.indexOf(b);c[E]=c[c.length-1],c.pop(),b.destroy()}}function T(b){l.remove(b)}function C(){l.dispose()}return{getParameters:v,getProgramCacheKey:_,getUniforms:M,acquireProgram:S,releaseProgram:w,releaseShaderCache:T,programs:c,dispose:C}}function LUe(){let r=new WeakMap;function e(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function t(a){r.delete(a)}function i(a,o,s){r.get(a)[o]=s}function n(){r=new WeakMap}return{get:e,remove:t,update:i,dispose:n}}function PUe(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Coe(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Roe(){let r=[],e=0,t=[],i=[],n=[];function a(){e=0,t.length=0,i.length=0,n.length=0}function o(f,h,p,d,g,m){let v=r[e];return v===void 0?(v={id:f.id,object:f,geometry:h,material:p,groupOrder:d,renderOrder:f.renderOrder,z:g,group:m},r[e]=v):(v.id=f.id,v.object=f,v.geometry=h,v.material=p,v.groupOrder=d,v.renderOrder=f.renderOrder,v.z=g,v.group=m),e++,v}function s(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.push(v):p.transparent===!0?n.push(v):t.push(v)}function l(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):t.unshift(v)}function u(f,h){t.length>1&&t.sort(f||PUe),i.length>1&&i.sort(h||Coe),n.length>1&&n.sort(h||Coe)}function c(){for(let f=e,h=r.length;f<h;f++){let p=r[f];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:n,init:a,push:s,unshift:l,finish:c,sort:u}}function DUe(){let r=new WeakMap;function e(i,n){let a=r.get(i),o;return a===void 0?(o=new Roe,r.set(i,[o])):n>=a.length?(o=new Roe,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function IUe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ye,color:new tr};break;case"SpotLight":t={position:new ye,direction:new ye,color:new tr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ye,color:new tr,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ye,skyColor:new tr,groundColor:new tr};break;case"RectAreaLight":t={color:new tr,position:new ye,halfWidth:new ye,halfHeight:new ye};break}return r[e.id]=t,t}}}function NUe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var UUe=0;function OUe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function zUe(r,e){let t=new IUe,i=NUe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new ye);let a=new ye,o=new Ht,s=new Ht;function l(c,f){let h=0,p=0,d=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let g=0,m=0,v=0,_=0,y=0,x=0,M=0,S=0,w=0,T=0,C=0;c.sort(OUe);let b=f===!0?Math.PI:1;for(let I=0,R=c.length;I<R;I++){let A=c[I],D=A.color,U=A.intensity,B=A.distance,z=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)h+=D.r*U*b,p+=D.g*U*b,d+=D.b*U*b;else if(A.isLightProbe){for(let k=0;k<9;k++)n.probe[k].addScaledVector(A.sh.coefficients[k],U);C++}else if(A.isDirectionalLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.directionalShadow[g]=Y,n.directionalShadowMap[g]=z,n.directionalShadowMatrix[g]=A.shadow.matrix,x++}n.directional[g]=k,g++}else if(A.isSpotLight){let k=t.get(A);k.position.setFromMatrixPosition(A.matrixWorld),k.color.copy(D).multiplyScalar(U*b),k.distance=B,k.coneCos=Math.cos(A.angle),k.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),k.decay=A.decay,n.spot[v]=k;let G=A.shadow;if(A.map&&(n.spotLightMap[w]=A.map,w++,G.updateMatrices(A),A.castShadow&&T++),n.spotLightMatrix[v]=G.matrix,A.castShadow){let Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.spotShadow[v]=Y,n.spotShadowMap[v]=z,S++}v++}else if(A.isRectAreaLight){let k=t.get(A);k.color.copy(D).multiplyScalar(U),k.halfWidth.set(A.width*.5,0,0),k.halfHeight.set(0,A.height*.5,0),n.rectArea[_]=k,_++}else if(A.isPointLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),k.distance=A.distance,k.decay=A.decay,A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,Y.shadowCameraNear=G.camera.near,Y.shadowCameraFar=G.camera.far,n.pointShadow[m]=Y,n.pointShadowMap[m]=z,n.pointShadowMatrix[m]=A.shadow.matrix,M++}n.point[m]=k,m++}else if(A.isHemisphereLight){let k=t.get(A);k.skyColor.copy(A.color).multiplyScalar(U*b),k.groundColor.copy(A.groundColor).multiplyScalar(U*b),n.hemi[y]=k,y++}}_>0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=yt.LTC_FLOAT_1,n.rectAreaLTC2=yt.LTC_FLOAT_2):(n.rectAreaLTC1=yt.LTC_HALF_1,n.rectAreaLTC2=yt.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=yt.LTC_FLOAT_1,n.rectAreaLTC2=yt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=yt.LTC_HALF_1,n.rectAreaLTC2=yt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=h,n.ambient[1]=p,n.ambient[2]=d;let E=n.hash;(E.directionalLength!==g||E.pointLength!==m||E.spotLength!==v||E.rectAreaLength!==_||E.hemiLength!==y||E.numDirectionalShadows!==x||E.numPointShadows!==M||E.numSpotShadows!==S||E.numSpotMaps!==w||E.numLightProbes!==C)&&(n.directional.length=g,n.spot.length=v,n.rectArea.length=_,n.point.length=m,n.hemi.length=y,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=M,n.pointShadowMap.length=M,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=M,n.spotLightMatrix.length=S+w-T,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=C,E.directionalLength=g,E.pointLength=m,E.spotLength=v,E.rectAreaLength=_,E.hemiLength=y,E.numDirectionalShadows=x,E.numPointShadows=M,E.numSpotShadows=S,E.numSpotMaps=w,E.numLightProbes=C,n.version=UUe++)}function u(c,f){let h=0,p=0,d=0,g=0,m=0,v=f.matrixWorldInverse;for(let _=0,y=c.length;_<y;_++){let x=c[_];if(x.isDirectionalLight){let M=n.directional[h];M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),h++}else if(x.isSpotLight){let M=n.spot[d];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),d++}else if(x.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),s.identity(),o.copy(x.matrixWorld),o.premultiply(v),s.extractRotation(o),M.halfWidth.set(x.width*.5,0,0),M.halfHeight.set(0,x.height*.5,0),M.halfWidth.applyMatrix4(s),M.halfHeight.applyMatrix4(s),g++}else if(x.isPointLight){let M=n.point[p];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),p++}else if(x.isHemisphereLight){let M=n.hemi[m];M.direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(v),m++}}}return{setup:l,setupView:u,state:n}}function Loe(r,e){let t=new zUe(r,e),i=[],n=[];function a(){i.length=0,n.length=0}function o(f){i.push(f)}function s(f){n.push(f)}function l(f){t.setup(i,f)}function u(f){t.setupView(i,f)}return{init:a,state:{lightsArray:i,shadowsArray:n,lights:t},setupLights:l,setupLightsView:u,pushLight:o,pushShadow:s}}function FUe(r,e){let t=new WeakMap;function i(a,o=0){let s=t.get(a),l;return s===void 0?(l=new Loe(r,e),t.set(a,[l])):o>=s.length?(l=new Loe(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var dk=class extends Sc{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=RPe,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},mk=class extends Sc{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},BUe=`void main() {
  10209. gl_Position = vec4( position, 1.0 );
  10210. }`,kUe=`uniform sampler2D shadow_pass;
  10211. uniform vec2 resolution;
  10212. uniform float radius;
  10213. #include <packing>
  10214. void main() {
  10215. const float samples = float( VSM_SAMPLES );
  10216. float mean = 0.0;
  10217. float squared_mean = 0.0;
  10218. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  10219. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  10220. for ( float i = 0.0; i < samples; i ++ ) {
  10221. float uvOffset = uvStart + i * uvStride;
  10222. #ifdef HORIZONTAL_PASS
  10223. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  10224. mean += distribution.x;
  10225. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  10226. #else
  10227. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  10228. mean += depth;
  10229. squared_mean += depth * depth;
  10230. #endif
  10231. }
  10232. mean = mean / samples;
  10233. squared_mean = squared_mean / samples;
  10234. float std_dev = sqrt( squared_mean - mean * mean );
  10235. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  10236. }`;function VUe(r,e,t){let i=new OM,n=new yr,a=new yr,o=new Rr,s=new dk({depthPacking:LPe}),l=new mk,u={},c=t.maxTextureSize,f={[zh]:fo,[fo]:zh,[gc]:gc},h=new hu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new yr},radius:{value:4}},vertexShader:BUe,fragmentShader:kUe}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new Ls;d.setAttribute("position",new Rs(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new co(d,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=qoe;let v=this.type;this.render=function(S,w,T){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;let C=r.getRenderTarget(),b=r.getActiveCubeFace(),E=r.getActiveMipmapLevel(),I=r.state;I.setBlending(Nh),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==mc&&this.type===mc,A=v===mc&&this.type!==mc;for(let D=0,U=S.length;D<U;D++){let B=S[D],z=B.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;n.copy(z.mapSize);let k=z.getFrameExtents();if(n.multiply(k),a.copy(z.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/k.x),n.x=a.x*k.x,z.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/k.y),n.y=a.y*k.y,z.mapSize.y=a.y)),z.map===null||R===!0||A===!0){let Y=this.type!==mc?{minFilter:Dn,magFilter:Dn}:{};z.map!==null&&z.map.dispose(),z.map=new xc(n.x,n.y,Y),z.map.texture.name=B.name+".shadowMap",z.camera.updateProjectionMatrix()}r.setRenderTarget(z.map),r.clear();let G=z.getViewportCount();for(let Y=0;Y<G;Y++){let J=z.getViewport(Y);o.set(a.x*J.x,a.y*J.y,a.x*J.z,a.y*J.w),I.viewport(o),z.updateMatrices(B,Y),i=z.getFrustum(),x(w,T,z.camera,B,this.type)}z.isPointLightShadow!==!0&&this.type===mc&&_(z,T),z.needsUpdate=!1}v=this.type,m.needsUpdate=!1,r.setRenderTarget(C,b,E)};function _(S,w){let T=e.update(g);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,p.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new xc(n.x,n.y)),h.uniforms.shadow_pass.value=S.map.texture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,r.setRenderTarget(S.mapPass),r.clear(),r.renderBufferDirect(w,null,T,h,g,null),p.uniforms.shadow_pass.value=S.mapPass.texture,p.uniforms.resolution.value=S.mapSize,p.uniforms.radius.value=S.radius,r.setRenderTarget(S.map),r.clear(),r.renderBufferDirect(w,null,T,p,g,null)}function y(S,w,T,C){let b=null,E=T.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(E!==void 0)b=E;else if(b=T.isPointLight===!0?l:s,r.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){let I=b.uuid,R=w.uuid,A=u[I];A===void 0&&(A={},u[I]=A);let D=A[R];D===void 0&&(D=b.clone(),A[R]=D,w.addEventListener("dispose",M)),b=D}if(b.visible=w.visible,b.wireframe=w.wireframe,C===mc?b.side=w.shadowSide!==null?w.shadowSide:w.side:b.side=w.shadowSide!==null?w.shadowSide:f[w.side],b.alphaMap=w.alphaMap,b.alphaTest=w.alphaTest,b.map=w.map,b.clipShadows=w.clipShadows,b.clippingPlanes=w.clippingPlanes,b.clipIntersection=w.clipIntersection,b.displacementMap=w.displacementMap,b.displacementScale=w.displacementScale,b.displacementBias=w.displacementBias,b.wireframeLinewidth=w.wireframeLinewidth,b.linewidth=w.linewidth,T.isPointLight===!0&&b.isMeshDistanceMaterial===!0){let I=r.properties.get(b);I.light=T}return b}function x(S,w,T,C,b){if(S.visible===!1)return;if(S.layers.test(w.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&b===mc)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,S.matrixWorld);let R=e.update(S),A=S.material;if(Array.isArray(A)){let D=R.groups;for(let U=0,B=D.length;U<B;U++){let z=D[U],k=A[z.materialIndex];if(k&&k.visible){let G=y(S,k,C,b);S.onBeforeShadow(r,S,w,T,R,G,z),r.renderBufferDirect(T,null,R,G,S,z),S.onAfterShadow(r,S,w,T,R,G,z)}}}else if(A.visible){let D=y(S,A,C,b);S.onBeforeShadow(r,S,w,T,R,D,null),r.renderBufferDirect(T,null,R,D,S,null),S.onAfterShadow(r,S,w,T,R,D,null)}}let I=S.children;for(let R=0,A=I.length;R<A;R++)x(I[R],w,T,C,b)}function M(S){S.target.removeEventListener("dispose",M);for(let T in u){let C=u[T],b=S.target.uuid;b in C&&(C[b].dispose(),delete C[b])}}}function GUe(r,e,t){let i=t.isWebGL2;function n(){let X=!1,Te=new Rr,te=null,Me=new Rr(0,0,0,0);return{setMask:function(Pe){te!==Pe&&!X&&(r.colorMask(Pe,Pe,Pe,Pe),te=Pe)},setLocked:function(Pe){X=Pe},setClear:function(Pe,xt,Ft,Mr,jr){jr===!0&&(Pe*=Mr,xt*=Mr,Ft*=Mr),Te.set(Pe,xt,Ft,Mr),Me.equals(Te)===!1&&(r.clearColor(Pe,xt,Ft,Mr),Me.copy(Te))},reset:function(){X=!1,te=null,Me.set(-1,0,0,0)}}}function a(){let X=!1,Te=null,te=null,Me=null;return{setTest:function(Pe){Pe?se(r.DEPTH_TEST):Ee(r.DEPTH_TEST)},setMask:function(Pe){Te!==Pe&&!X&&(r.depthMask(Pe),Te=Pe)},setFunc:function(Pe){if(te!==Pe){switch(Pe){case iPe:r.depthFunc(r.NEVER);break;case nPe:r.depthFunc(r.ALWAYS);break;case aPe:r.depthFunc(r.LESS);break;case tR:r.depthFunc(r.LEQUAL);break;case oPe:r.depthFunc(r.EQUAL);break;case sPe:r.depthFunc(r.GEQUAL);break;case lPe:r.depthFunc(r.GREATER);break;case uPe:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}te=Pe}},setLocked:function(Pe){X=Pe},setClear:function(Pe){Me!==Pe&&(r.clearDepth(Pe),Me=Pe)},reset:function(){X=!1,Te=null,te=null,Me=null}}}function o(){let X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,Ft=null,Mr=null,jr=null;return{setTest:function(Vt){X||(Vt?se(r.STENCIL_TEST):Ee(r.STENCIL_TEST))},setMask:function(Vt){Te!==Vt&&!X&&(r.stencilMask(Vt),Te=Vt)},setFunc:function(Vt,Lr,si){(te!==Vt||Me!==Lr||Pe!==si)&&(r.stencilFunc(Vt,Lr,si),te=Vt,Me=Lr,Pe=si)},setOp:function(Vt,Lr,si){(xt!==Vt||Ft!==Lr||Mr!==si)&&(r.stencilOp(Vt,Lr,si),xt=Vt,Ft=Lr,Mr=si)},setLocked:function(Vt){X=Vt},setClear:function(Vt){jr!==Vt&&(r.clearStencil(Vt),jr=Vt)},reset:function(){X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,Ft=null,Mr=null,jr=null}}}let s=new n,l=new a,u=new o,c=new WeakMap,f=new WeakMap,h={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new tr(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,B=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),z=!1,k=0,G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),z=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),z=k>=2);let Y=null,J={},Q=r.getParameter(r.SCISSOR_BOX),V=r.getParameter(r.VIEWPORT),K=new Rr().fromArray(Q),ae=new Rr().fromArray(V);function ve(X,Te,te,Me){let Pe=new Uint8Array(4),xt=r.createTexture();r.bindTexture(X,xt),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ft=0;Ft<te;Ft++)i&&(X===r.TEXTURE_3D||X===r.TEXTURE_2D_ARRAY)?r.texImage3D(Te,0,r.RGBA,1,1,Me,0,r.RGBA,r.UNSIGNED_BYTE,Pe):r.texImage2D(Te+Ft,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Pe);return xt}let ue={};ue[r.TEXTURE_2D]=ve(r.TEXTURE_2D,r.TEXTURE_2D,1),ue[r.TEXTURE_CUBE_MAP]=ve(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(ue[r.TEXTURE_2D_ARRAY]=ve(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ue[r.TEXTURE_3D]=ve(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),s.setClear(0,0,0,1),l.setClear(1),u.setClear(0),se(r.DEPTH_TEST),l.setFunc(tR),Ne(!1),Ve(aae),se(r.CULL_FACE),Le(Nh);function se(X){h[X]!==!0&&(r.enable(X),h[X]=!0)}function Ee(X){h[X]!==!1&&(r.disable(X),h[X]=!1)}function q(X,Te){return p[X]!==Te?(r.bindFramebuffer(X,Te),p[X]=Te,i&&(X===r.DRAW_FRAMEBUFFER&&(p[r.FRAMEBUFFER]=Te),X===r.FRAMEBUFFER&&(p[r.DRAW_FRAMEBUFFER]=Te)),!0):!1}function H(X,Te){let te=g,Me=!1;if(X){te=d.get(Te),te===void 0&&(te=[],d.set(Te,te));let Pe=X.textures;if(te.length!==Pe.length||te[0]!==r.COLOR_ATTACHMENT0){for(let xt=0,Ft=Pe.length;xt<Ft;xt++)te[xt]=r.COLOR_ATTACHMENT0+xt;te.length=Pe.length,Me=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,Me=!0);if(Me)if(t.isWebGL2)r.drawBuffers(te);else if(e.has("WEBGL_draw_buffers")===!0)e.get("WEBGL_draw_buffers").drawBuffersWEBGL(te);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function We(X){return m!==X?(r.useProgram(X),m=X,!0):!1}let _e={[fm]:r.FUNC_ADD,[GLe]:r.FUNC_SUBTRACT,[HLe]:r.FUNC_REVERSE_SUBTRACT};if(i)_e[uae]=r.MIN,_e[cae]=r.MAX;else{let X=e.get("EXT_blend_minmax");X!==null&&(_e[uae]=X.MIN_EXT,_e[cae]=X.MAX_EXT)}let xe={[WLe]:r.ZERO,[XLe]:r.ONE,[YLe]:r.SRC_COLOR,[$B]:r.SRC_ALPHA,[$Le]:r.SRC_ALPHA_SATURATE,[KLe]:r.DST_COLOR,[ZLe]:r.DST_ALPHA,[qLe]:r.ONE_MINUS_SRC_COLOR,[QB]:r.ONE_MINUS_SRC_ALPHA,[JLe]:r.ONE_MINUS_DST_COLOR,[jLe]:r.ONE_MINUS_DST_ALPHA,[QLe]:r.CONSTANT_COLOR,[ePe]:r.ONE_MINUS_CONSTANT_COLOR,[tPe]:r.CONSTANT_ALPHA,[rPe]:r.ONE_MINUS_CONSTANT_ALPHA};function Le(X,Te,te,Me,Pe,xt,Ft,Mr,jr,Vt){if(X===Nh){v===!0&&(Ee(r.BLEND),v=!1);return}if(v===!1&&(se(r.BLEND),v=!0),X!==VLe){if(X!==_||Vt!==E){if((y!==fm||S!==fm)&&(r.blendEquation(r.FUNC_ADD),y=fm,S=fm),Vt)switch(X){case s0:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case oae:r.blendFunc(r.ONE,r.ONE);break;case sae:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case lae:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}else switch(X){case s0:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case oae:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case sae:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case lae:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}x=null,M=null,w=null,T=null,C.set(0,0,0),b=0,_=X,E=Vt}return}Pe=Pe||Te,xt=xt||te,Ft=Ft||Me,(Te!==y||Pe!==S)&&(r.blendEquationSeparate(_e[Te],_e[Pe]),y=Te,S=Pe),(te!==x||Me!==M||xt!==w||Ft!==T)&&(r.blendFuncSeparate(xe[te],xe[Me],xe[xt],xe[Ft]),x=te,M=Me,w=xt,T=Ft),(Mr.equals(C)===!1||jr!==b)&&(r.blendColor(Mr.r,Mr.g,Mr.b,jr),C.copy(Mr),b=jr),_=X,E=!1}function Ue(X,Te){X.side===gc?Ee(r.CULL_FACE):se(r.CULL_FACE);let te=X.side===fo;Te&&(te=!te),Ne(te),X.blending===s0&&X.transparent===!1?Le(Nh):Le(X.blending,X.blendEquation,X.blendSrc,X.blendDst,X.blendEquationAlpha,X.blendSrcAlpha,X.blendDstAlpha,X.blendColor,X.blendAlpha,X.premultipliedAlpha),l.setFunc(X.depthFunc),l.setTest(X.depthTest),l.setMask(X.depthWrite),s.setMask(X.colorWrite);let Me=X.stencilWrite;u.setTest(Me),Me&&(u.setMask(X.stencilWriteMask),u.setFunc(X.stencilFunc,X.stencilRef,X.stencilFuncMask),u.setOp(X.stencilFail,X.stencilZFail,X.stencilZPass)),F(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),X.alphaToCoverage===!0?se(r.SAMPLE_ALPHA_TO_COVERAGE):Ee(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(X){I!==X&&(X?r.frontFace(r.CW):r.frontFace(r.CCW),I=X)}function Ve(X){X!==FLe?(se(r.CULL_FACE),X!==R&&(X===aae?r.cullFace(r.BACK):X===BLe?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ee(r.CULL_FACE),R=X}function ct(X){X!==A&&(z&&r.lineWidth(X),A=X)}function F(X,Te,te){X?(se(r.POLYGON_OFFSET_FILL),(D!==Te||U!==te)&&(r.polygonOffset(Te,te),D=Te,U=te)):Ee(r.POLYGON_OFFSET_FILL)}function L(X){X?se(r.SCISSOR_TEST):Ee(r.SCISSOR_TEST)}function ne(X){X===void 0&&(X=r.TEXTURE0+B-1),Y!==X&&(r.activeTexture(X),Y=X)}function le(X,Te,te){te===void 0&&(Y===null?te=r.TEXTURE0+B-1:te=Y);let Me=J[te];Me===void 0&&(Me={type:void 0,texture:void 0},J[te]=Me),(Me.type!==X||Me.texture!==Te)&&(Y!==te&&(r.activeTexture(te),Y=te),r.bindTexture(X,Te||ue[X]),Me.type=X,Me.texture=Te)}function me(){let X=J[Y];X!==void 0&&X.type!==void 0&&(r.bindTexture(X.type,null),X.type=void 0,X.texture=void 0)}function he(){try{r.compressedTexImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function et(){try{r.compressedTexImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ke(){try{r.texSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Se(){try{r.texSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ae(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function nt(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function $(){try{r.texStorage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function it(){try{r.texStorage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Xe(){try{r.texImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Fe(){try{r.texImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function we(X){K.equals(X)===!1&&(r.scissor(X.x,X.y,X.z,X.w),K.copy(X))}function Ie(X){ae.equals(X)===!1&&(r.viewport(X.x,X.y,X.z,X.w),ae.copy(X))}function st(X,Te){let te=f.get(Te);te===void 0&&(te=new WeakMap,f.set(Te,te));let Me=te.get(X);Me===void 0&&(Me=r.getUniformBlockIndex(Te,X.name),te.set(X,Me))}function Je(X,Te){let Me=f.get(Te).get(X);c.get(Te)!==Me&&(r.uniformBlockBinding(Te,Me,X.__bindingPointIndex),c.set(Te,Me))}function kt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),i===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},Y=null,J={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new tr(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,K.set(0,0,r.canvas.width,r.canvas.height),ae.set(0,0,r.canvas.width,r.canvas.height),s.reset(),l.reset(),u.reset()}return{buffers:{color:s,depth:l,stencil:u},enable:se,disable:Ee,bindFramebuffer:q,drawBuffers:H,useProgram:We,setBlending:Le,setMaterial:Ue,setFlipSided:Ne,setCullFace:Ve,setLineWidth:ct,setPolygonOffset:F,setScissorTest:L,activeTexture:ne,bindTexture:le,unbindTexture:me,compressedTexImage2D:he,compressedTexImage3D:et,texImage2D:Xe,texImage3D:Fe,updateUBOMapping:st,uniformBlockBinding:Je,texStorage2D:$,texStorage3D:it,texSubImage2D:Ke,texSubImage3D:Se,compressedTexSubImage2D:Ae,compressedTexSubImage3D:nt,scissor:we,viewport:Ie,reset:kt}}function HUe(r,e,t,i,n,a,o){let s=n.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new yr,f=new WeakMap,h,p=new WeakMap,d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(F,L){return d?new OffscreenCanvas(F,L):IM("canvas")}function m(F,L,ne,le){let me=1,he=ct(F);if((he.width>le||he.height>le)&&(me=le/Math.max(he.width,he.height)),me<1||L===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){let et=L?lR:Math.floor,Ke=et(me*he.width),Se=et(me*he.height);h===void 0&&(h=g(Ke,Se));let Ae=ne?g(Ke,Se):h;return Ae.width=Ke,Ae.height=Se,Ae.getContext("2d").drawImage(F,0,0,Ke,Se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+Ke+"x"+Se+")."),Ae}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),F;return F}function v(F){let L=ct(F);return ik(L.width)&&ik(L.height)}function _(F){return s?!1:F.wrapS!==uo||F.wrapT!==uo||F.minFilter!==Dn&&F.minFilter!==lo}function y(F,L){return F.generateMipmaps&&L&&F.minFilter!==Dn&&F.minFilter!==lo}function x(F){r.generateMipmap(F)}function M(F,L,ne,le,me=!1){if(s===!1)return L;if(F!==null){if(r[F]!==void 0)return r[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let he=L;if(L===r.RED&&(ne===r.FLOAT&&(he=r.R32F),ne===r.HALF_FLOAT&&(he=r.R16F),ne===r.UNSIGNED_BYTE&&(he=r.R8)),L===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.R8UI),ne===r.UNSIGNED_SHORT&&(he=r.R16UI),ne===r.UNSIGNED_INT&&(he=r.R32UI),ne===r.BYTE&&(he=r.R8I),ne===r.SHORT&&(he=r.R16I),ne===r.INT&&(he=r.R32I)),L===r.RG&&(ne===r.FLOAT&&(he=r.RG32F),ne===r.HALF_FLOAT&&(he=r.RG16F),ne===r.UNSIGNED_BYTE&&(he=r.RG8)),L===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.RG8UI),ne===r.UNSIGNED_SHORT&&(he=r.RG16UI),ne===r.UNSIGNED_INT&&(he=r.RG32UI),ne===r.BYTE&&(he=r.RG8I),ne===r.SHORT&&(he=r.RG16I),ne===r.INT&&(he=r.RG32I)),L===r.RGBA){let et=me?nR:$r.getTransfer(le);ne===r.FLOAT&&(he=r.RGBA32F),ne===r.HALF_FLOAT&&(he=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(he=et===oi?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(he=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(he=r.RGB5_A1)}return(he===r.R16F||he===r.R32F||he===r.RG16F||he===r.RG32F||he===r.RGBA16F||he===r.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function S(F,L,ne){return y(F,ne)===!0||F.isFramebufferTexture&&F.minFilter!==Dn&&F.minFilter!==lo?Math.log2(Math.max(L.width,L.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?L.mipmaps.length:1}function w(F){return F===Dn||F===pae||F===MM?r.NEAREST:r.LINEAR}function T(F){let L=F.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&f.delete(L)}function C(F){let L=F.target;L.removeEventListener("dispose",C),I(L)}function b(F){let L=i.get(F);if(L.__webglInit===void 0)return;let ne=F.source,le=p.get(ne);if(le){let me=le[L.__cacheKey];me.usedTimes--,me.usedTimes===0&&E(F),Object.keys(le).length===0&&p.delete(ne)}i.remove(F)}function E(F){let L=i.get(F);r.deleteTexture(L.__webglTexture);let ne=F.source,le=p.get(ne);delete le[L.__cacheKey],o.memory.textures--}function I(F){let L=i.get(F);if(F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let le=0;le<6;le++){if(Array.isArray(L.__webglFramebuffer[le]))for(let me=0;me<L.__webglFramebuffer[le].length;me++)r.deleteFramebuffer(L.__webglFramebuffer[le][me]);else r.deleteFramebuffer(L.__webglFramebuffer[le]);L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer[le])}else{if(Array.isArray(L.__webglFramebuffer))for(let le=0;le<L.__webglFramebuffer.length;le++)r.deleteFramebuffer(L.__webglFramebuffer[le]);else r.deleteFramebuffer(L.__webglFramebuffer);if(L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&r.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer)for(let le=0;le<L.__webglColorRenderbuffer.length;le++)L.__webglColorRenderbuffer[le]&&r.deleteRenderbuffer(L.__webglColorRenderbuffer[le]);L.__webglDepthRenderbuffer&&r.deleteRenderbuffer(L.__webglDepthRenderbuffer)}let ne=F.textures;for(let le=0,me=ne.length;le<me;le++){let he=i.get(ne[le]);he.__webglTexture&&(r.deleteTexture(he.__webglTexture),o.memory.textures--),i.remove(ne[le])}i.remove(F)}let R=0;function A(){R=0}function D(){let F=R;return F>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+n.maxTextures),R+=1,F}function U(F){let L=[];return L.push(F.wrapS),L.push(F.wrapT),L.push(F.wrapR||0),L.push(F.magFilter),L.push(F.minFilter),L.push(F.anisotropy),L.push(F.internalFormat),L.push(F.format),L.push(F.type),L.push(F.generateMipmaps),L.push(F.premultiplyAlpha),L.push(F.flipY),L.push(F.unpackAlignment),L.push(F.colorSpace),L.join()}function B(F,L){let ne=i.get(F);if(F.isVideoTexture&&Ne(F),F.isRenderTargetTexture===!1&&F.version>0&&ne.__version!==F.version){let le=F.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ae(ne,F,L);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+L)}function z(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+L)}function k(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+L)}function G(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ve(ne,F,L);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+L)}let Y={[h0]:r.REPEAT,[uo]:r.CLAMP_TO_EDGE,[tk]:r.MIRRORED_REPEAT},J={[Dn]:r.NEAREST,[pae]:r.NEAREST_MIPMAP_NEAREST,[MM]:r.NEAREST_MIPMAP_LINEAR,[lo]:r.LINEAR,[vB]:r.LINEAR_MIPMAP_NEAREST,[pm]:r.LINEAR_MIPMAP_LINEAR},Q={[DPe]:r.NEVER,[FPe]:r.ALWAYS,[IPe]:r.LESS,[tse]:r.LEQUAL,[NPe]:r.EQUAL,[zPe]:r.GEQUAL,[UPe]:r.GREATER,[OPe]:r.NOTEQUAL};function V(F,L,ne){if(L.type===fu&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===lo||L.magFilter===vB||L.magFilter===MM||L.magFilter===pm||L.minFilter===lo||L.minFilter===vB||L.minFilter===MM||L.minFilter===pm)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),ne?(r.texParameteri(F,r.TEXTURE_WRAP_S,Y[L.wrapS]),r.texParameteri(F,r.TEXTURE_WRAP_T,Y[L.wrapT]),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,Y[L.wrapR]),r.texParameteri(F,r.TEXTURE_MAG_FILTER,J[L.magFilter]),r.texParameteri(F,r.TEXTURE_MIN_FILTER,J[L.minFilter])):(r.texParameteri(F,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(F,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(L.wrapS!==uo||L.wrapT!==uo)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(F,r.TEXTURE_MAG_FILTER,w(L.magFilter)),r.texParameteri(F,r.TEXTURE_MIN_FILTER,w(L.minFilter)),L.minFilter!==Dn&&L.minFilter!==lo&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),L.compareFunction&&(r.texParameteri(F,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(F,r.TEXTURE_COMPARE_FUNC,Q[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===Dn||L.minFilter!==MM&&L.minFilter!==pm||L.type===fu&&e.has("OES_texture_float_linear")===!1||s===!1&&L.type===DM&&e.has("OES_texture_half_float_linear")===!1)return;if(L.anisotropy>1||i.get(L).__currentAnisotropy){let le=e.get("EXT_texture_filter_anisotropic");r.texParameterf(F,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy}}}function K(F,L){let ne=!1;F.__webglInit===void 0&&(F.__webglInit=!0,L.addEventListener("dispose",T));let le=L.source,me=p.get(le);me===void 0&&(me={},p.set(le,me));let he=U(L);if(he!==F.__cacheKey){me[he]===void 0&&(me[he]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[he].usedTimes++;let et=me[F.__cacheKey];et!==void 0&&(me[F.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),F.__cacheKey=he,F.__webglTexture=me[he].texture}return ne}function ae(F,L,ne){let le=r.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(le=r.TEXTURE_2D_ARRAY),L.isData3DTexture&&(le=r.TEXTURE_3D);let me=K(F,L),he=L.source;t.bindTexture(le,F.__webglTexture,r.TEXTURE0+ne);let et=i.get(he);if(he.version!==et.__version||me===!0){t.activeTexture(r.TEXTURE0+ne);let Ke=$r.getPrimaries($r.workingColorSpace),Se=L.colorSpace===Dh?null:$r.getPrimaries(L.colorSpace),Ae=L.colorSpace===Dh||Ke===Se?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let nt=_(L)&&v(L.image)===!1,$=m(L.image,nt,!1,n.maxTextureSize);$=Ve(L,$);let it=v($)||s,Xe=a.convert(L.format,L.colorSpace),Fe=a.convert(L.type),we=M(L.internalFormat,Xe,Fe,L.colorSpace,L.isVideoTexture);V(le,L,it);let Ie,st=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==ese,kt=et.__version===void 0||me===!0,X=he.dataReady,Te=S(L,$,it);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===fu?we=r.DEPTH_COMPONENT32F:L.type===Ih?we=r.DEPTH_COMPONENT24:L.type===dm?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===fu&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===mm&&we===r.DEPTH_COMPONENT&&L.type!==Ok&&L.type!==Ih&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Ih,Fe=a.convert(L.type)),L.format===p0&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==dm&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=dm,Fe=a.convert(L.type))),kt&&(Je?t.texStorage2D(r.TEXTURE_2D,1,we,$.width,$.height):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,null));else if(L.isDataTexture)if(st.length>0&&it){Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data);L.generateMipmaps=!1}else Je?(kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height),X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,$.width,$.height,Xe,Fe,$.data)):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,$.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){Je&&kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,st[0].width,st[0].height,$.depth);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==Cs?Xe!==null?Je?X&&t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,Ie.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Ie.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,Fe,Ie.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Xe,Fe,Ie.data)}else{Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==Cs?Xe!==null?Je?X&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Ie.data):t.compressedTexImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data)}else if(L.isDataArrayTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,Xe,Fe,$.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isData3DTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_3D,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,Xe,Fe,$.data)):t.texImage3D(r.TEXTURE_3D,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isFramebufferTexture){if(kt)if(Je)t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height);else{let te=$.width,Me=$.height;for(let Pe=0;Pe<Te;Pe++)t.texImage2D(r.TEXTURE_2D,Pe,we,te,Me,0,Xe,Fe,null),te>>=1,Me>>=1}}else if(st.length>0&&it){if(Je&&kt){let te=ct(st[0]);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Xe,Fe,Ie):t.texImage2D(r.TEXTURE_2D,te,we,Xe,Fe,Ie);L.generateMipmaps=!1}else if(Je){if(kt){let te=ct($);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Xe,Fe,$)}else t.texImage2D(r.TEXTURE_2D,0,we,Xe,Fe,$);y(L,it)&&x(le),et.__version=he.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ve(F,L,ne){if(L.image.length!==6)return;let le=K(F,L),me=L.source;t.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+ne);let he=i.get(me);if(me.version!==he.__version||le===!0){t.activeTexture(r.TEXTURE0+ne);let et=$r.getPrimaries($r.workingColorSpace),Ke=L.colorSpace===Dh?null:$r.getPrimaries(L.colorSpace),Se=L.colorSpace===Dh||et===Ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);let Ae=L.isCompressedTexture||L.image[0].isCompressedTexture,nt=L.image[0]&&L.image[0].isDataTexture,$=[];for(let te=0;te<6;te++)!Ae&&!nt?$[te]=m(L.image[te],!1,!0,n.maxCubemapSize):$[te]=nt?L.image[te].image:L.image[te],$[te]=Ve(L,$[te]);let it=$[0],Xe=v(it)||s,Fe=a.convert(L.format,L.colorSpace),we=a.convert(L.type),Ie=M(L.internalFormat,Fe,we,L.colorSpace),st=s&&L.isVideoTexture!==!0,Je=he.__version===void 0||le===!0,kt=me.dataReady,X=S(L,it,Xe);V(r.TEXTURE_CUBE_MAP,L,Xe);let Te;if(Ae){st&&Je&&t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,it.width,it.height);for(let te=0;te<6;te++){Te=$[te].mipmaps;for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];L.format!==Cs?Fe!==null?st?kt&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,Fe,Pe.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,Pe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,Fe,we,Pe.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,Fe,we,Pe.data)}}}else{if(Te=L.mipmaps,st&&Je){Te.length>0&&X++;let te=ct($[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,te.width,te.height)}for(let te=0;te<6;te++)if(nt){st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,$[te].width,$[te].height,Fe,we,$[te].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,$[te].width,$[te].height,0,Fe,we,$[te].data);for(let Me=0;Me<Te.length;Me++){let xt=Te[Me].image[te].image;st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,xt.width,xt.height,Fe,we,xt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,xt.width,xt.height,0,Fe,we,xt.data)}}else{st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Fe,we,$[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,Fe,we,$[te]);for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,Fe,we,Pe.image[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,Fe,we,Pe.image[te])}}}y(L,Xe)&&x(r.TEXTURE_CUBE_MAP),he.__version=me.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ue(F,L,ne,le,me,he){let et=a.convert(ne.format,ne.colorSpace),Ke=a.convert(ne.type),Se=M(ne.internalFormat,et,Ke,ne.colorSpace);if(!i.get(L).__hasExternalTextures){let nt=Math.max(1,L.width>>he),$=Math.max(1,L.height>>he);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,he,Se,nt,$,L.depth,0,et,Ke,null):t.texImage2D(me,he,Se,nt,$,0,et,Ke,null)}t.bindFramebuffer(r.FRAMEBUFFER,F),Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,0,Le(L)):(me===r.TEXTURE_2D||me>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&me<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,he),t.bindFramebuffer(r.FRAMEBUFFER,null)}function se(F,L,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,F),L.depthBuffer&&!L.stencilBuffer){let le=s===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(ne||Ue(L)){let me=L.depthTexture;me&&me.isDepthTexture&&(me.type===fu?le=r.DEPTH_COMPONENT32F:me.type===Ih&&(le=r.DEPTH_COMPONENT24));let he=Le(L);Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,he,le,L.width,L.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,he,le,L.width,L.height)}else r.renderbufferStorage(r.RENDERBUFFER,le,L.width,L.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,F)}else if(L.depthBuffer&&L.stencilBuffer){let le=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,L.width,L.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,F)}else{let le=L.textures;for(let me=0;me<le.length;me++){let he=le[me],et=a.convert(he.format,he.colorSpace),Ke=a.convert(he.type),Se=M(he.internalFormat,et,Ke,he.colorSpace),Ae=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Ae,Se,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Ae,Se,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,Se,L.width,L.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ee(F,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,F),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),B(L.depthTexture,0);let le=i.get(L.depthTexture).__webglTexture,me=Le(L);if(L.depthTexture.format===mm)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0);else if(L.depthTexture.format===p0)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0);else throw new Error("Unknown depthTexture format")}function q(F){let L=i.get(F),ne=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!L.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");Ee(L.__webglFramebuffer,F)}else if(ne){L.__webglDepthbuffer=[];for(let le=0;le<6;le++)t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer[le]),L.__webglDepthbuffer[le]=r.createRenderbuffer(),se(L.__webglDepthbuffer[le],F,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),se(L.__webglDepthbuffer,F,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function H(F,L,ne){let le=i.get(F);L!==void 0&&ue(le.__webglFramebuffer,F,F.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&q(F)}function We(F){let L=F.texture,ne=i.get(F),le=i.get(L);F.addEventListener("dispose",C);let me=F.textures,he=F.isWebGLCubeRenderTarget===!0,et=me.length>1,Ke=v(F)||s;if(et||(le.__webglTexture===void 0&&(le.__webglTexture=r.createTexture()),le.__version=L.version,o.memory.textures++),he){ne.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer[Se]=[];for(let Ae=0;Ae<L.mipmaps.length;Ae++)ne.__webglFramebuffer[Se][Ae]=r.createFramebuffer()}else ne.__webglFramebuffer[Se]=r.createFramebuffer()}else{if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer=[];for(let Se=0;Se<L.mipmaps.length;Se++)ne.__webglFramebuffer[Se]=r.createFramebuffer()}else ne.__webglFramebuffer=r.createFramebuffer();if(et)if(n.drawBuffers)for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=i.get(me[Se]);nt.__webglTexture===void 0&&(nt.__webglTexture=r.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&F.samples>0&&Ue(F)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Se=0;Se<me.length;Se++){let Ae=me[Se];ne.__webglColorRenderbuffer[Se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se]);let nt=a.convert(Ae.format,Ae.colorSpace),$=a.convert(Ae.type),it=M(Ae.internalFormat,nt,$,Ae.colorSpace,F.isXRRenderTarget===!0),Xe=Le(F);r.renderbufferStorageMultisample(r.RENDERBUFFER,Xe,it,F.width,F.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),F.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),se(ne.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(he){t.bindTexture(r.TEXTURE_CUBE_MAP,le.__webglTexture),V(r.TEXTURE_CUBE_MAP,L,Ke);for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Se][Ae],F,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ae);else ue(ne.__webglFramebuffer[Se],F,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0);y(L,Ke)&&x(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(et){for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=me[Se],$=i.get(nt);t.bindTexture(r.TEXTURE_2D,$.__webglTexture),V(r.TEXTURE_2D,nt,Ke),ue(ne.__webglFramebuffer,F,nt,r.COLOR_ATTACHMENT0+Se,r.TEXTURE_2D,0),y(nt,Ke)&&x(r.TEXTURE_2D)}t.unbindTexture()}else{let Se=r.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(s?Se=F.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Se,le.__webglTexture),V(Se,L,Ke),s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Ae],F,L,r.COLOR_ATTACHMENT0,Se,Ae);else ue(ne.__webglFramebuffer,F,L,r.COLOR_ATTACHMENT0,Se,0);y(L,Ke)&&x(Se),t.unbindTexture()}F.depthBuffer&&q(F)}function _e(F){let L=v(F)||s,ne=F.textures;for(let le=0,me=ne.length;le<me;le++){let he=ne[le];if(y(he,L)){let et=F.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ke=i.get(he).__webglTexture;t.bindTexture(et,Ke),x(et),t.unbindTexture()}}}function xe(F){if(s&&F.samples>0&&Ue(F)===!1){let L=F.textures,ne=F.width,le=F.height,me=r.COLOR_BUFFER_BIT,he=[],et=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(F),Se=L.length>1;if(Se)for(let Ae=0;Ae<L.length;Ae++)t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let Ae=0;Ae<L.length;Ae++){he.push(r.COLOR_ATTACHMENT0+Ae),F.depthBuffer&&he.push(et);let nt=Ke.__ignoreDepthValues!==void 0?Ke.__ignoreDepthValues:!1;if(nt===!1&&(F.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),F.stencilBuffer&&(me|=r.STENCIL_BUFFER_BIT)),Se&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]),nt===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[et]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[et])),Se){let $=i.get(L[Ae]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,$,0)}r.blitFramebuffer(0,0,ne,le,0,0,ne,le,me,r.NEAREST),u&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,he)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Se)for(let Ae=0;Ae<L.length;Ae++){t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]);let nt=i.get(L[Ae]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,nt,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}}function Le(F){return Math.min(n.maxSamples,F.samples)}function Ue(F){let L=i.get(F);return s&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(F){let L=o.render.frame;f.get(F)!==L&&(f.set(F,L),F.update())}function Ve(F,L){let ne=F.colorSpace,le=F.format,me=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===rk||ne!==Xh&&ne!==Dh&&($r.getTransfer(ne)===oi?s===!1?e.has("EXT_sRGB")===!0&&le===Cs?(F.format=rk,F.minFilter=lo,F.generateMipmaps=!1):L=uR.sRGBToLinear(L):(le!==Cs||me!==Oh)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),L}function ct(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=D,this.resetTextureUnits=A,this.setTexture2D=B,this.setTexture2DArray=z,this.setTexture3D=k,this.setTextureCube=G,this.rebindTextures=H,this.setupRenderTarget=We,this.updateRenderTargetMipmap=_e,this.updateMultisampleRenderTarget=xe,this.setupDepthRenderbuffer=q,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=Ue}function WUe(r,e,t){let i=t.isWebGL2;function n(a,o=Dh){let s,l=$r.getTransfer(o);if(a===Oh)return r.UNSIGNED_BYTE;if(a===joe)return r.UNSIGNED_SHORT_4_4_4_4;if(a===Koe)return r.UNSIGNED_SHORT_5_5_5_1;if(a===xPe)return r.BYTE;if(a===SPe)return r.SHORT;if(a===Ok)return r.UNSIGNED_SHORT;if(a===Zoe)return r.INT;if(a===Ih)return r.UNSIGNED_INT;if(a===fu)return r.FLOAT;if(a===DM)return i?r.HALF_FLOAT:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(a===MPe)return r.ALPHA;if(a===Cs)return r.RGBA;if(a===bPe)return r.LUMINANCE;if(a===wPe)return r.LUMINANCE_ALPHA;if(a===mm)return r.DEPTH_COMPONENT;if(a===p0)return r.DEPTH_STENCIL;if(a===rk)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===TPe)return r.RED;if(a===Joe)return r.RED_INTEGER;if(a===EPe)return r.RG;if(a===$oe)return r.RG_INTEGER;if(a===Qoe)return r.RGBA_INTEGER;if(a===gB||a===yB||a===_B||a===xB)if(l===oi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===gB)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===yB)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===_B)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===xB)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===gB)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===yB)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===_B)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===xB)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===dae||a===mae||a===vae||a===gae)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===dae)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===mae)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===vae)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===gae)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===ese)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===yae||a===_ae)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===yae)return l===oi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===_ae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===xae||a===Sae||a===Mae||a===bae||a===wae||a===Tae||a===Eae||a===Aae||a===Cae||a===Rae||a===Lae||a===Pae||a===Dae||a===Iae)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===xae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===Sae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===Mae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===bae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===wae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===Tae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===Eae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===Aae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===Cae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===Rae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===Lae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===Pae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===Dae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===Iae)return l===oi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===SB||a===Nae||a===Uae)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===SB)return l===oi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===Nae)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===Uae)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===APe||a===Oae||a===zae||a===Fae)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===SB)return s.COMPRESSED_RED_RGTC1_EXT;if(a===Oae)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===zae)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===Fae)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===dm?i?r.UNSIGNED_INT_24_8:(s=e.get("WEBGL_depth_texture"),s!==null?s.UNSIGNED_INT_24_8_WEBGL:null):r[a]!==void 0?r[a]:null}return{convert:n}}var vk=class extends Nn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},_c=class extends ia{constructor(){super(),this.isGroup=!0,this.type="Group"}},XUe={type:"move"},LM=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new _c,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new _c,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ye,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ye),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new _c,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ye,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ye),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let n=null,a=null,o=null,s=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(let g of e.hand.values()){let m=t.getJointPose(g,i),v=this._getHandJoint(u,g);m!==null&&(v.matrix.fromArray(m.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=m.radius),v.visible=m!==null}let c=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=c.position.distanceTo(f.position),p=.02,d=.005;u.inputState.pinching&&h>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=p-d&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(a=t.getPose(e.gripSpace,i),a!==null&&(l.matrix.fromArray(a.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,a.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(a.linearVelocity)):l.hasLinearVelocity=!1,a.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(a.angularVelocity)):l.hasAngularVelocity=!1));s!==null&&(n=t.getPose(e.targetRaySpace,i),n===null&&a!==null&&(n=a),n!==null&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(XUe)))}return s!==null&&(s.visible=n!==null),l!==null&&(l.visible=a!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new _c;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},YUe=`
  10237. void main() {
  10238. gl_Position = vec4( position, 1.0 );
  10239. }`,qUe=`
  10240. uniform sampler2DArray depthColor;
  10241. uniform float depthWidth;
  10242. uniform float depthHeight;
  10243. void main() {
  10244. vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
  10245. if ( coord.x >= 1.0 ) {
  10246. gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
  10247. } else {
  10248. gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
  10249. }
  10250. }`,gk=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let n=new Vo,a=e.properties.get(n);a.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}render(e,t){if(this.texture!==null){if(this.mesh===null){let i=t.cameras[0].viewport,n=new hu({extensions:{fragDepth:!0},vertexShader:YUe,fragmentShader:qUe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new co(new gR(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},yk=class extends Fh{constructor(e,t){super();let i=this,n=null,a=1,o=null,s="local-floor",l=1,u=null,c=null,f=null,h=null,p=null,d=null,g=new gk,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new yr,S=null,w=new Nn;w.layers.enable(1),w.viewport=new Rr;let T=new Nn;T.layers.enable(2),T.viewport=new Rr;let C=[w,T],b=new vk;b.layers.enable(1),b.layers.enable(2);let E=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let K=y[V];return K===void 0&&(K=new LM,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new LM,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new LM,y[V]=K),K.getHandSpace()};function R(V){let K=x.indexOf(V.inputSource);if(K===-1)return;let ae=y[K];ae!==void 0&&(ae.update(V.inputSource,V.frame,u||o),ae.dispatchEvent({type:V.type,data:V.inputSource}))}function A(){n.removeEventListener("select",R),n.removeEventListener("selectstart",R),n.removeEventListener("selectend",R),n.removeEventListener("squeeze",R),n.removeEventListener("squeezestart",R),n.removeEventListener("squeezeend",R),n.removeEventListener("end",A),n.removeEventListener("inputsourceschange",D);for(let V=0;V<y.length;V++){let K=x[V];K!==null&&(x[V]=null,y[V].disconnect(K))}E=null,I=null,g.reset(),e.setRenderTarget(v),p=null,h=null,f=null,n=null,_=null,Q.stop(),i.isPresenting=!1,e.setPixelRatio(S),e.setSize(M.width,M.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){a=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){s=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||o},this.setReferenceSpace=function(V){u=V},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return f},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=function(V){return YM(this,null,function*(){if(n=V,n!==null){if(v=e.getRenderTarget(),n.addEventListener("select",R),n.addEventListener("selectstart",R),n.addEventListener("selectend",R),n.addEventListener("squeeze",R),n.addEventListener("squeezestart",R),n.addEventListener("squeezeend",R),n.addEventListener("end",A),n.addEventListener("inputsourceschange",D),m.xrCompatible!==!0&&(yield t.makeXRCompatible()),S=e.getPixelRatio(),e.getSize(M),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let K={antialias:n.renderState.layers===void 0?m.antialias:!0,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:a};p=new XRWebGLLayer(n,t,K),n.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),_=new xc(p.framebufferWidth,p.framebufferHeight,{format:Cs,type:Oh,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let K=null,ae=null,ve=null;m.depth&&(ve=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,K=m.stencil?p0:mm,ae=m.stencil?dm:Ih);let ue={colorFormat:t.RGBA8,depthFormat:ve,scaleFactor:a};f=new XRWebGLBinding(n,t),h=f.createProjectionLayer(ue),n.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new xc(h.textureWidth,h.textureHeight,{format:Cs,type:Oh,depthTexture:new _R(h.textureWidth,h.textureHeight,ae,void 0,void 0,void 0,void 0,void 0,void 0,K),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});let se=e.properties.get(_);se.__ignoreDepthValues=h.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(l),u=null,o=yield n.requestReferenceSpace(s),Q.setContext(n),Q.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(n!==null)return n.environmentBlendMode};function D(V){for(let K=0;K<V.removed.length;K++){let ae=V.removed[K],ve=x.indexOf(ae);ve>=0&&(x[ve]=null,y[ve].disconnect(ae))}for(let K=0;K<V.added.length;K++){let ae=V.added[K],ve=x.indexOf(ae);if(ve===-1){for(let se=0;se<y.length;se++)if(se>=x.length){x.push(ae),ve=se;break}else if(x[se]===null){x[se]=ae,ve=se;break}if(ve===-1)break}let ue=y[ve];ue&&ue.connect(ae)}}let U=new ye,B=new ye;function z(V,K,ae){U.setFromMatrixPosition(K.matrixWorld),B.setFromMatrixPosition(ae.matrixWorld);let ve=U.distanceTo(B),ue=K.projectionMatrix.elements,se=ae.projectionMatrix.elements,Ee=ue[14]/(ue[10]-1),q=ue[14]/(ue[10]+1),H=(ue[9]+1)/ue[5],We=(ue[9]-1)/ue[5],_e=(ue[8]-1)/ue[0],xe=(se[8]+1)/se[0],Le=Ee*_e,Ue=Ee*xe,Ne=ve/(-_e+xe),Ve=Ne*-_e;K.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(Ve),V.translateZ(Ne),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();let ct=Ee+Ne,F=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/F*ct,me=We*q/F*ct;V.projectionMatrix.makePerspective(L,ne,le,me,ct,F),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function k(V,K){K===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(K.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(n===null)return;g.texture!==null&&(V.near=g.depthNear,V.far=g.depthFar),b.near=T.near=w.near=V.near,b.far=T.far=w.far=V.far,(E!==b.near||I!==b.far)&&(n.updateRenderState({depthNear:b.near,depthFar:b.far}),E=b.near,I=b.far,w.near=E,w.far=I,T.near=E,T.far=I,w.updateProjectionMatrix(),T.updateProjectionMatrix(),V.updateProjectionMatrix());let K=V.parent,ae=b.cameras;k(b,K);for(let ve=0;ve<ae.length;ve++)k(ae[ve],K);ae.length===2?z(b,w,T):b.projectionMatrix.copy(w.projectionMatrix),G(V,b,K)};function G(V,K,ae){ae===null?V.matrix.copy(K.matrixWorld):(V.matrix.copy(ae.matrixWorld),V.matrix.invert(),V.matrix.multiply(K.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0),V.projectionMatrix.copy(K.projectionMatrix),V.projectionMatrixInverse.copy(K.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=d0*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return b},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(V){l=V,h!==null&&(h.fixedFoveation=V),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=V)},this.hasDepthSensing=function(){return g.texture!==null};let Y=null;function J(V,K){if(c=K.getViewerPose(u||o),d=K,c!==null){let ae=c.views;p!==null&&(e.setRenderTargetFramebuffer(_,p.framebuffer),e.setRenderTarget(_));let ve=!1;ae.length!==b.cameras.length&&(b.cameras.length=0,ve=!0);for(let se=0;se<ae.length;se++){let Ee=ae[se],q=null;if(p!==null)q=p.getViewport(Ee);else{let We=f.getViewSubImage(h,Ee);q=We.viewport,se===0&&(e.setRenderTargetTextures(_,We.colorTexture,h.ignoreDepthValues?void 0:We.depthStencilTexture),e.setRenderTarget(_))}let H=C[se];H===void 0&&(H=new Nn,H.layers.enable(se),H.viewport=new Rr,C[se]=H),H.matrix.fromArray(Ee.transform.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale),H.projectionMatrix.fromArray(Ee.projectionMatrix),H.projectionMatrixInverse.copy(H.projectionMatrix).invert(),H.viewport.set(q.x,q.y,q.width,q.height),se===0&&(b.matrix.copy(H.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale)),ve===!0&&b.cameras.push(H)}let ue=n.enabledFeatures;if(ue&&ue.includes("depth-sensing")){let se=f.getDepthInformation(ae[0]);se&&se.isValid&&se.texture&&g.init(e,se,n.renderState)}}for(let ae=0;ae<y.length;ae++){let ve=x[ae],ue=y[ae];ve!==null&&ue!==void 0&&ue.update(ve,K,u||o)}g.render(e,b),Y&&Y(V,K),K.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:K}),d=null}let Q=new ase;Q.setAnimationLoop(J),this.setAnimationLoop=function(V){Y=V},this.dispose=function(){}}},um=new zn,ZUe=new Ht;function jUe(r,e){function t(m,v){m.matrixAutoUpdate===!0&&m.updateMatrix(),v.value.copy(m.matrix)}function i(m,v){v.color.getRGB(m.fogColor.value,nse(r)),v.isFog?(m.fogNear.value=v.near,m.fogFar.value=v.far):v.isFogExp2&&(m.fogDensity.value=v.density)}function n(m,v,_,y,x){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(m,v):v.isMeshToonMaterial?(a(m,v),f(m,v)):v.isMeshPhongMaterial?(a(m,v),c(m,v)):v.isMeshStandardMaterial?(a(m,v),h(m,v),v.isMeshPhysicalMaterial&&p(m,v,x)):v.isMeshMatcapMaterial?(a(m,v),d(m,v)):v.isMeshDepthMaterial?a(m,v):v.isMeshDistanceMaterial?(a(m,v),g(m,v)):v.isMeshNormalMaterial?a(m,v):v.isLineBasicMaterial?(o(m,v),v.isLineDashedMaterial&&s(m,v)):v.isPointsMaterial?l(m,v,_,y):v.isSpriteMaterial?u(m,v):v.isShadowMaterial?(m.color.value.copy(v.color),m.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(m,v){m.opacity.value=v.opacity,v.color&&m.diffuse.value.copy(v.color),v.emissive&&m.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.bumpMap&&(m.bumpMap.value=v.bumpMap,t(v.bumpMap,m.bumpMapTransform),m.bumpScale.value=v.bumpScale,v.side===fo&&(m.bumpScale.value*=-1)),v.normalMap&&(m.normalMap.value=v.normalMap,t(v.normalMap,m.normalMapTransform),m.normalScale.value.copy(v.normalScale),v.side===fo&&m.normalScale.value.negate()),v.displacementMap&&(m.displacementMap.value=v.displacementMap,t(v.displacementMap,m.displacementMapTransform),m.displacementScale.value=v.displacementScale,m.displacementBias.value=v.displacementBias),v.emissiveMap&&(m.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,m.emissiveMapTransform)),v.specularMap&&(m.specularMap.value=v.specularMap,t(v.specularMap,m.specularMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest);let _=e.get(v),y=_.envMap,x=_.envMapRotation;if(y&&(m.envMap.value=y,um.copy(x),um.x*=-1,um.y*=-1,um.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(um.y*=-1,um.z*=-1),m.envMapRotation.value.setFromMatrix4(ZUe.makeRotationFromEuler(um)),m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=v.reflectivity,m.ior.value=v.ior,m.refractionRatio.value=v.refractionRatio),v.lightMap){m.lightMap.value=v.lightMap;let M=r._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=v.lightMapIntensity*M,t(v.lightMap,m.lightMapTransform)}v.aoMap&&(m.aoMap.value=v.aoMap,m.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,m.aoMapTransform))}function o(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform))}function s(m,v){m.dashSize.value=v.dashSize,m.totalSize.value=v.dashSize+v.gapSize,m.scale.value=v.scale}function l(m,v,_,y){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.size.value=v.size*_,m.scale.value=y*.5,v.map&&(m.map.value=v.map,t(v.map,m.uvTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function u(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.rotation.value=v.rotation,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function c(m,v){m.specular.value.copy(v.specular),m.shininess.value=Math.max(v.shininess,1e-4)}function f(m,v){v.gradientMap&&(m.gradientMap.value=v.gradientMap)}function h(m,v){m.metalness.value=v.metalness,v.metalnessMap&&(m.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,m.metalnessMapTransform)),m.roughness.value=v.roughness,v.roughnessMap&&(m.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,m.roughnessMapTransform)),e.get(v).envMap&&(m.envMapIntensity.value=v.envMapIntensity)}function p(m,v,_){m.ior.value=v.ior,v.sheen>0&&(m.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),m.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(m.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,m.sheenColorMapTransform)),v.sheenRoughnessMap&&(m.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,m.sheenRoughnessMapTransform))),v.clearcoat>0&&(m.clearcoat.value=v.clearcoat,m.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(m.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,m.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(m.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===fo&&m.clearcoatNormalScale.value.negate())),v.iridescence>0&&(m.iridescence.value=v.iridescence,m.iridescenceIOR.value=v.iridescenceIOR,m.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(m.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,m.iridescenceMapTransform)),v.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),v.transmission>0&&(m.transmission.value=v.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(m.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,m.transmissionMapTransform)),m.thickness.value=v.thickness,v.thicknessMap&&(m.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=v.attenuationDistance,m.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(m.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(m.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=v.specularIntensity,m.specularColor.value.copy(v.specularColor),v.specularColorMap&&(m.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,m.specularColorMapTransform)),v.specularIntensityMap&&(m.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,m.specularIntensityMapTransform))}function d(m,v){v.matcap&&(m.matcap.value=v.matcap)}function g(m,v){let _=e.get(v).light;m.referencePosition.value.setFromMatrixPosition(_.matrixWorld),m.nearDistance.value=_.shadow.camera.near,m.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function KUe(r,e,t,i){let n={},a={},o=[],s=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,y){let x=y.program;i.uniformBlockBinding(_,x)}function u(_,y){let x=n[_.id];x===void 0&&(d(_),x=c(_),n[_.id]=x,_.addEventListener("dispose",m));let M=y.program;i.updateUBOMapping(_,M);let S=e.render.frame;a[_.id]!==S&&(h(_),a[_.id]=S)}function c(_){let y=f();_.__bindingPointIndex=y;let x=r.createBuffer(),M=_.__size,S=_.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,M,S),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function f(){for(let _=0;_<s;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(_){let y=n[_.id],x=_.uniforms,M=_.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let S=0,w=x.length;S<w;S++){let T=Array.isArray(x[S])?x[S]:[x[S]];for(let C=0,b=T.length;C<b;C++){let E=T[C];if(p(E,S,C,M)===!0){let I=E.__offset,R=Array.isArray(E.value)?E.value:[E.value],A=0;for(let D=0;D<R.length;D++){let U=R[D],B=g(U);typeof U=="number"||typeof U=="boolean"?(E.__data[0]=U,r.bufferSubData(r.UNIFORM_BUFFER,I+A,E.__data)):U.isMatrix3?(E.__data[0]=U.elements[0],E.__data[1]=U.elements[1],E.__data[2]=U.elements[2],E.__data[3]=0,E.__data[4]=U.elements[3],E.__data[5]=U.elements[4],E.__data[6]=U.elements[5],E.__data[7]=0,E.__data[8]=U.elements[6],E.__data[9]=U.elements[7],E.__data[10]=U.elements[8],E.__data[11]=0):(U.toArray(E.__data,A),A+=B.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,I,E.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function p(_,y,x,M){let S=_.value,w=y+"_"+x;if(M[w]===void 0)return typeof S=="number"||typeof S=="boolean"?M[w]=S:M[w]=S.clone(),!0;{let T=M[w];if(typeof S=="number"||typeof S=="boolean"){if(T!==S)return M[w]=S,!0}else if(T.equals(S)===!1)return T.copy(S),!0}return!1}function d(_){let y=_.uniforms,x=0,M=16;for(let w=0,T=y.length;w<T;w++){let C=Array.isArray(y[w])?y[w]:[y[w]];for(let b=0,E=C.length;b<E;b++){let I=C[b],R=Array.isArray(I.value)?I.value:[I.value];for(let A=0,D=R.length;A<D;A++){let U=R[A],B=g(U),z=x%M;z!==0&&M-z<B.boundary&&(x+=M-z),I.__data=new Float32Array(B.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=x,x+=B.storage}}}let S=x%M;return S>0&&(x+=M-S),_.__size=x,_.__cache={},this}function g(_){let y={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(y.boundary=4,y.storage=4):_.isVector2?(y.boundary=8,y.storage=8):_.isVector3||_.isColor?(y.boundary=16,y.storage=12):_.isVector4?(y.boundary=16,y.storage=16):_.isMatrix3?(y.boundary=48,y.storage=48):_.isMatrix4?(y.boundary=64,y.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),y}function m(_){let y=_.target;y.removeEventListener("dispose",m);let x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(n[y.id]),delete n[y.id],delete a[y.id]}function v(){for(let _ in n)r.deleteBuffer(n[_]);o=[],n={},a={}}return{bind:l,update:u,dispose:v}}var _k=class{constructor(e={}){let{canvas:t=QPe(),context:i=null,depth:n=!0,stencil:a=!0,alpha:o=!1,antialias:s=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;i!==null?h=i.getContextAttributes().alpha:h=o;let p=new Uint32Array(4),d=new Int32Array(4),g=null,m=null,v=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ta,this._useLegacyLights=!1,this.toneMapping=Uh,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new Rr,E=new Rr,I=null,R=new tr(0),A=0,D=t.width,U=t.height,B=1,z=null,k=null,G=new Rr(0,0,D,U),Y=new Rr(0,0,D,U),J=!1,Q=new OM,V=!1,K=!1,ae=null,ve=new Ht,ue=new yr,se=new ye,Ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return w===null?B:1}let H=i;function We(O,j){for(let re=0;re<O.length;re++){let ie=O[re],P=t.getContext(ie,j);if(P!==null)return P}return null}try{let O={alpha:!0,depth:n,stencil:a,antialias:s,premultipliedAlpha:l,preserveDrawingBuffer:u,powerPreference:c,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Uk}`),t.addEventListener("webglcontextlost",kt,!1),t.addEventListener("webglcontextrestored",X,!1),t.addEventListener("webglcontextcreationerror",Te,!1),H===null){let j=["webgl2","webgl","experimental-webgl"];if(y.isWebGL1Renderer===!0&&j.shift(),H=We(j,O),H===null)throw We(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&H instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),H.getShaderPrecisionFormat===void 0&&(H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(O){throw console.error("THREE.WebGLRenderer: "+O.message),O}let _e,xe,Le,Ue,Ne,Ve,ct,F,L,ne,le,me,he,et,Ke,Se,Ae,nt,$,it,Xe,Fe,we,Ie;function st(){_e=new hNe(H),xe=new oNe(H,_e,e),_e.init(xe),Fe=new WUe(H,_e,xe),Le=new GUe(H,_e,xe),Ue=new mNe(H),Ne=new LUe,Ve=new HUe(H,_e,Le,Ne,xe,Fe,Ue),ct=new lNe(y),F=new fNe(y),L=new SDe(H,xe),we=new nNe(H,_e,L,xe),ne=new pNe(H,L,Ue,we),le=new _Ne(H,ne,L,Ue),$=new yNe(H,xe,Ve),Se=new sNe(Ne),me=new RUe(y,ct,F,_e,xe,we,Se),he=new jUe(y,Ne),et=new DUe,Ke=new FUe(_e,xe),nt=new iNe(y,ct,F,Le,le,h,l),Ae=new VUe(y,le,xe),Ie=new KUe(H,Ue,xe,Le),it=new aNe(H,_e,Ue,xe),Xe=new dNe(H,_e,Ue,xe),Ue.programs=me.programs,y.capabilities=xe,y.extensions=_e,y.properties=Ne,y.renderLists=et,y.shadowMap=Ae,y.state=Le,y.info=Ue}st();let Je=new yk(y,H);this.xr=Je,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){let O=_e.get("WEBGL_lose_context");O&&O.loseContext()},this.forceContextRestore=function(){let O=_e.get("WEBGL_lose_context");O&&O.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(O){O!==void 0&&(B=O,this.setSize(D,U,!1))},this.getSize=function(O){return O.set(D,U)},this.setSize=function(O,j,re=!0){if(Je.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}D=O,U=j,t.width=Math.floor(O*B),t.height=Math.floor(j*B),re===!0&&(t.style.width=O+"px",t.style.height=j+"px"),this.setViewport(0,0,O,j)},this.getDrawingBufferSize=function(O){return O.set(D*B,U*B).floor()},this.setDrawingBufferSize=function(O,j,re){D=O,U=j,B=re,t.width=Math.floor(O*re),t.height=Math.floor(j*re),this.setViewport(0,0,O,j)},this.getCurrentViewport=function(O){return O.copy(b)},this.getViewport=function(O){return O.copy(G)},this.setViewport=function(O,j,re,ie){O.isVector4?G.set(O.x,O.y,O.z,O.w):G.set(O,j,re,ie),Le.viewport(b.copy(G).multiplyScalar(B).round())},this.getScissor=function(O){return O.copy(Y)},this.setScissor=function(O,j,re,ie){O.isVector4?Y.set(O.x,O.y,O.z,O.w):Y.set(O,j,re,ie),Le.scissor(E.copy(Y).multiplyScalar(B).round())},this.getScissorTest=function(){return J},this.setScissorTest=function(O){Le.setScissorTest(J=O)},this.setOpaqueSort=function(O){z=O},this.setTransparentSort=function(O){k=O},this.getClearColor=function(O){return O.copy(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(O=!0,j=!0,re=!0){let ie=0;if(O){let P=!1;if(w!==null){let W=w.texture.format;P=W===Qoe||W===$oe||W===Joe}if(P){let W=w.texture.type,ee=W===Oh||W===Ih||W===Ok||W===dm||W===joe||W===Koe,ge=nt.getClearColor(),ce=nt.getClearAlpha(),Oe=ge.r,Ge=ge.g,Re=ge.b;ee?(p[0]=Oe,p[1]=Ge,p[2]=Re,p[3]=ce,H.clearBufferuiv(H.COLOR,0,p)):(d[0]=Oe,d[1]=Ge,d[2]=Re,d[3]=ce,H.clearBufferiv(H.COLOR,0,d))}else ie|=H.COLOR_BUFFER_BIT}j&&(ie|=H.DEPTH_BUFFER_BIT),re&&(ie|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",kt,!1),t.removeEventListener("webglcontextrestored",X,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),et.dispose(),Ke.dispose(),Ne.dispose(),ct.dispose(),F.dispose(),le.dispose(),we.dispose(),Ie.dispose(),me.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",jr),Je.removeEventListener("sessionend",Vt),ae&&(ae.dispose(),ae=null),Lr.stop()};function kt(O){O.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function X(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let O=Ue.autoReset,j=Ae.enabled,re=Ae.autoUpdate,ie=Ae.needsUpdate,P=Ae.type;st(),Ue.autoReset=O,Ae.enabled=j,Ae.autoUpdate=re,Ae.needsUpdate=ie,Ae.type=P}function Te(O){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",O.statusMessage)}function te(O){let j=O.target;j.removeEventListener("dispose",te),Me(j)}function Me(O){Pe(O),Ne.remove(O)}function Pe(O){let j=Ne.get(O).programs;j!==void 0&&(j.forEach(function(re){me.releaseProgram(re)}),O.isShaderMaterial&&me.releaseShaderCache(O))}this.renderBufferDirect=function(O,j,re,ie,P,W){j===null&&(j=Ee);let ee=P.isMesh&&P.matrixWorld.determinant()<0,ge=T0(O,j,re,ie,P);Le.setMaterial(ie,ee);let ce=re.index,Oe=1;if(ie.wireframe===!0){if(ce=ne.getWireframeAttribute(re),ce===void 0)return;Oe=2}let Ge=re.drawRange,Re=re.attributes.position,pt=Ge.start*Oe,mt=(Ge.start+Ge.count)*Oe;W!==null&&(pt=Math.max(pt,W.start*Oe),mt=Math.min(mt,(W.start+W.count)*Oe)),ce!==null?(pt=Math.max(pt,0),mt=Math.min(mt,ce.count)):Re!=null&&(pt=Math.max(pt,0),mt=Math.min(mt,Re.count));let $e=mt-pt;if($e<0||$e===1/0)return;we.setup(P,ie,ge,re,ce);let at,wt=it;if(ce!==null&&(at=L.get(ce),wt=Xe,wt.setIndex(at)),P.isMesh)ie.wireframe===!0?(Le.setLineWidth(ie.wireframeLinewidth*q()),wt.setMode(H.LINES)):wt.setMode(H.TRIANGLES);else if(P.isLine){let je=ie.linewidth;je===void 0&&(je=1),Le.setLineWidth(je*q()),P.isLineSegments?wt.setMode(H.LINES):P.isLineLoop?wt.setMode(H.LINE_LOOP):wt.setMode(H.LINE_STRIP)}else P.isPoints?wt.setMode(H.POINTS):P.isSprite&&wt.setMode(H.TRIANGLES);if(P.isBatchedMesh)wt.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else if(P.isInstancedMesh)wt.renderInstances(pt,$e,P.count);else if(re.isInstancedBufferGeometry){let je=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,mi=Math.min(re.instanceCount,je);wt.renderInstances(pt,$e,mi)}else wt.render(pt,$e)};function xt(O,j,re){O.transparent===!0&&O.side===gc&&O.forceSinglePass===!1?(O.side=fo,O.needsUpdate=!0,Go(O,j,re),O.side=zh,O.needsUpdate=!0,Go(O,j,re),O.side=gc):Go(O,j,re)}this.compile=function(O,j,re=null){re===null&&(re=O),m=Ke.get(re),m.init(),_.push(m),re.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),O!==re&&O.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),m.setupLights(y._useLegacyLights);let ie=new Set;return O.traverse(function(P){let W=P.material;if(W)if(Array.isArray(W))for(let ee=0;ee<W.length;ee++){let ge=W[ee];xt(ge,re,P),ie.add(ge)}else xt(W,re,P),ie.add(W)}),_.pop(),m=null,ie},this.compileAsync=function(O,j,re=null){let ie=this.compile(O,j,re);return new Promise(P=>{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){P(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let Ft=null;function Mr(O){Ft&&Ft(O)}function jr(){Lr.stop()}function Vt(){Lr.start()}let Lr=new ase;Lr.setAnimationLoop(Mr),typeof self<"u"&&Lr.setContext(self),this.setAnimationLoop=function(O){Ft=O,Je.setAnimationLoop(O),O===null?Lr.stop():Lr.start()},Je.addEventListener("sessionstart",jr),Je.addEventListener("sessionend",Vt),this.render=function(O,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),Je.enabled===!0&&Je.isPresenting===!0&&(Je.cameraAutoUpdate===!0&&Je.updateCamera(j),j=Je.getCamera()),O.isScene===!0&&O.onBeforeRender(y,O,j,w),m=Ke.get(O,_.length),m.init(),_.push(m),ve.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),Q.setFromProjectionMatrix(ve),K=this.localClippingEnabled,V=Se.init(this.clippingPlanes,K),g=et.get(O,v.length),g.init(),v.push(g),si(O,j,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(z,k),this.info.render.frame++,V===!0&&Se.beginShadows();let re=m.state.shadowsArray;if(Ae.render(re,O,j),V===!0&&Se.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Je.enabled===!1||Je.isPresenting===!1||Je.hasDepthSensing()===!1)&&nt.render(g,O),m.setupLights(y._useLegacyLights),j.isArrayCamera){let ie=j.cameras;for(let P=0,W=ie.length;P<W;P++){let ee=ie[P];Zh(g,O,ee,ee.viewport)}}else Zh(g,O,j);w!==null&&(Ve.updateMultisampleRenderTarget(w),Ve.updateRenderTargetMipmap(w)),O.isScene===!0&&O.onAfterRender(y,O,j),we.resetDefaultState(),T=-1,C=null,_.pop(),_.length>0?m=_[_.length-1]:m=null,v.pop(),v.length>0?g=v[v.length-1]:g=null};function si(O,j,re,ie){if(O.visible===!1)return;if(O.layers.test(j.layers)){if(O.isGroup)re=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update(j);else if(O.isLight)m.pushLight(O),O.castShadow&&m.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||Q.intersectsSprite(O)){ie&&se.setFromMatrixPosition(O.matrixWorld).applyMatrix4(ve);let ee=le.update(O),ge=O.material;ge.visible&&g.push(O,ee,ge,re,se.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(!O.frustumCulled||Q.intersectsObject(O))){let ee=le.update(O),ge=O.material;if(ie&&(O.boundingSphere!==void 0?(O.boundingSphere===null&&O.computeBoundingSphere(),se.copy(O.boundingSphere.center)):(ee.boundingSphere===null&&ee.computeBoundingSphere(),se.copy(ee.boundingSphere.center)),se.applyMatrix4(O.matrixWorld).applyMatrix4(ve)),Array.isArray(ge)){let ce=ee.groups;for(let Oe=0,Ge=ce.length;Oe<Ge;Oe++){let Re=ce[Oe],pt=ge[Re.materialIndex];pt&&pt.visible&&g.push(O,ee,pt,re,se.z,Re)}}else ge.visible&&g.push(O,ee,ge,re,se.z,null)}}let W=O.children;for(let ee=0,ge=W.length;ee<ge;ee++)si(W[ee],j,re,ie)}function Zh(O,j,re,ie){let P=O.opaque,W=O.transmissive,ee=O.transparent;m.setupLightsView(re),V===!0&&Se.setGlobalState(y.clippingPlanes,re),W.length>0&&w0(P,W,j,re),ie&&Le.viewport(b.copy(ie)),P.length>0&&Is(P,j,re),W.length>0&&Is(W,j,re),ee.length>0&&Is(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function w0(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new xc(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?DM:Oh,minFilter:pm,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(lR(ue.x),lR(ue.y));let ee=y.getRenderTarget();y.setRenderTarget(ae),y.getClearColor(R),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear();let ge=y.toneMapping;y.toneMapping=Uh,Is(O,re,ie),Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae);let ce=!1;for(let Oe=0,Ge=j.length;Oe<Ge;Oe++){let Re=j[Oe],pt=Re.object,mt=Re.geometry,$e=Re.material,at=Re.group;if($e.side===gc&&pt.layers.test(ie.layers)){let wt=$e.side;$e.side=fo,$e.needsUpdate=!0,jh(pt,re,ie,mt,$e,at),$e.side=wt,$e.needsUpdate=!0,ce=!0}}ce===!0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),y.setRenderTarget(ee),y.setClearColor(R,A),y.toneMapping=ge}function Is(O,j,re){let ie=j.isScene===!0?j.overrideMaterial:null;for(let P=0,W=O.length;P<W;P++){let ee=O[P],ge=ee.object,ce=ee.geometry,Oe=ie===null?ee.material:ie,Ge=ee.group;ge.layers.test(re.layers)&&jh(ge,j,re,ce,Oe,Ge)}}function jh(O,j,re,ie,P,W){O.onBeforeRender(y,j,re,ie,P,W),O.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),P.onBeforeRender(y,j,re,ie,O,W),P.transparent===!0&&P.side===gc&&P.forceSinglePass===!1?(P.side=fo,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=zh,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=gc):y.renderBufferDirect(re,j,ie,P,O,W),O.onAfterRender(y,j,re,ie,P,W)}function Go(O,j,re){j.isScene!==!0&&(j=Ee);let ie=Ne.get(O),P=m.state.lights,W=m.state.shadowsArray,ee=P.state.version,ge=me.getParameters(O,P.state,W,j,re),ce=me.getProgramCacheKey(ge),Oe=ie.programs;ie.environment=O.isMeshStandardMaterial?j.environment:null,ie.fog=j.fog,ie.envMap=(O.isMeshStandardMaterial?F:ct).get(O.envMap||ie.environment),ie.envMapRotation=ie.environment!==null&&O.envMap===null?j.environmentRotation:O.envMapRotation,Oe===void 0&&(O.addEventListener("dispose",te),Oe=new Map,ie.programs=Oe);let Ge=Oe.get(ce);if(Ge!==void 0){if(ie.currentProgram===Ge&&ie.lightsStateVersion===ee)return bc(O,ge),Ge}else ge.uniforms=me.getUniforms(O),O.onBuild(re,ge,y),O.onBeforeCompile(ge,y),Ge=me.acquireProgram(ge,ce),Oe.set(ce,Ge),ie.uniforms=ge.uniforms;let Re=ie.uniforms;return(!O.isShaderMaterial&&!O.isRawShaderMaterial||O.clipping===!0)&&(Re.clippingPlanes=Se.uniform),bc(O,ge),ie.needsLights=A0(O),ie.lightsStateVersion=ee,ie.needsLights&&(Re.ambientLightColor.value=P.state.ambient,Re.lightProbe.value=P.state.probe,Re.directionalLights.value=P.state.directional,Re.directionalLightShadows.value=P.state.directionalShadow,Re.spotLights.value=P.state.spot,Re.spotLightShadows.value=P.state.spotShadow,Re.rectAreaLights.value=P.state.rectArea,Re.ltc_1.value=P.state.rectAreaLTC1,Re.ltc_2.value=P.state.rectAreaLTC2,Re.pointLights.value=P.state.point,Re.pointLightShadows.value=P.state.pointShadow,Re.hemisphereLights.value=P.state.hemi,Re.directionalShadowMap.value=P.state.directionalShadowMap,Re.directionalShadowMatrix.value=P.state.directionalShadowMatrix,Re.spotShadowMap.value=P.state.spotShadowMap,Re.spotLightMatrix.value=P.state.spotLightMatrix,Re.spotLightMap.value=P.state.spotLightMap,Re.pointShadowMap.value=P.state.pointShadowMap,Re.pointShadowMatrix.value=P.state.pointShadowMatrix),ie.currentProgram=Ge,ie.uniformsList=null,Ge}function Kh(O){if(O.uniformsList===null){let j=O.currentProgram.getUniforms();O.uniformsList=u0.seqWithValue(j.seq,O.uniforms)}return O.uniformsList}function bc(O,j){let re=Ne.get(O);re.outputColorSpace=j.outputColorSpace,re.batching=j.batching,re.instancing=j.instancing,re.instancingColor=j.instancingColor,re.instancingMorph=j.instancingMorph,re.skinning=j.skinning,re.morphTargets=j.morphTargets,re.morphNormals=j.morphNormals,re.morphColors=j.morphColors,re.morphTargetsCount=j.morphTargetsCount,re.numClippingPlanes=j.numClippingPlanes,re.numIntersection=j.numClipIntersection,re.vertexAlphas=j.vertexAlphas,re.vertexTangents=j.vertexTangents,re.toneMapping=j.toneMapping}function T0(O,j,re,ie,P){j.isScene!==!0&&(j=Ee),Ve.resetTextureUnits();let W=j.fog,ee=ie.isMeshStandardMaterial?j.environment:null,ge=w===null?y.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:Xh,ce=(ie.isMeshStandardMaterial?F:ct).get(ie.envMap||ee),Oe=ie.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,Ge=!!re.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),Re=!!re.morphAttributes.position,pt=!!re.morphAttributes.normal,mt=!!re.morphAttributes.color,$e=Uh;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let at=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,wt=at!==void 0?at.length:0,je=Ne.get(ie),mi=m.state.lights;if(V===!0&&(K===!0||O!==C)){let Kr=O===C&&ie.id===T;Se.setState(ie,O,Kr)}let Ut=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==mi.state.version||je.outputColorSpace!==ge||P.isBatchedMesh&&je.batching===!1||!P.isBatchedMesh&&je.batching===!0||P.isInstancedMesh&&je.instancing===!1||!P.isInstancedMesh&&je.instancing===!0||P.isSkinnedMesh&&je.skinning===!1||!P.isSkinnedMesh&&je.skinning===!0||P.isInstancedMesh&&je.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&je.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&je.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&je.instancingMorph===!1&&P.morphTexture!==null||je.envMap!==ce||ie.fog===!0&&je.fog!==W||je.numClippingPlanes!==void 0&&(je.numClippingPlanes!==Se.numPlanes||je.numIntersection!==Se.numIntersection)||je.vertexAlphas!==Oe||je.vertexTangents!==Ge||je.morphTargets!==Re||je.morphNormals!==pt||je.morphColors!==mt||je.toneMapping!==$e||xe.isWebGL2===!0&&je.morphTargetsCount!==wt)&&(Ut=!0):(Ut=!0,je.__version=ie.version);let Cr=je.currentProgram;Ut===!0&&(Cr=Go(ie,j,P));let Hi=!1,Mt=!1,Mi=!1,lr=Cr.getUniforms(),un=je.uniforms;if(Le.useProgram(Cr.program)&&(Hi=!0,Mt=!0,Mi=!0),ie.id!==T&&(T=ie.id,Mt=!0),Hi||C!==O){lr.setValue(H,"projectionMatrix",O.projectionMatrix),lr.setValue(H,"viewMatrix",O.matrixWorldInverse);let Kr=lr.map.cameraPosition;Kr!==void 0&&Kr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&lr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&lr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,Mt=!0,Mi=!0)}if(P.isSkinnedMesh){lr.setOptional(H,P,"bindMatrix"),lr.setOptional(H,P,"bindMatrixInverse");let Kr=P.skeleton;Kr&&(xe.floatVertexTextures?(Kr.boneTexture===null&&Kr.computeBoneTexture(),lr.setValue(H,"boneTexture",Kr.boneTexture,Ve)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}P.isBatchedMesh&&(lr.setOptional(H,P,"batchingTexture"),lr.setValue(H,"batchingTexture",P._matricesTexture,Ve));let du=re.morphAttributes;if((du.position!==void 0||du.normal!==void 0||du.color!==void 0&&xe.isWebGL2===!0)&&$.update(P,re,Cr),(Mt||je.receiveShadow!==P.receiveShadow)&&(je.receiveShadow=P.receiveShadow,lr.setValue(H,"receiveShadow",P.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(un.envMap.value=ce,un.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),Mt&&(lr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&E0(un,Mi),W&&ie.fog===!0&&he.refreshFogUniforms(un,W),he.refreshMaterialUniforms(un,ie,B,U,ae),u0.upload(H,Kh(je),un,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(u0.upload(H,Kh(je),un,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&lr.setValue(H,"center",P.center),lr.setValue(H,"modelViewMatrix",P.modelViewMatrix),lr.setValue(H,"normalMatrix",P.normalMatrix),lr.setValue(H,"modelMatrix",P.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let Kr=ie.uniformsGroups;for(let mu=0,Jh=Kr.length;mu<Jh;mu++)if(xe.isWebGL2){let $h=Kr[mu];Ie.update($h,Cr),Ie.bind($h,Cr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Cr}function E0(O,j){O.ambientLightColor.needsUpdate=j,O.lightProbe.needsUpdate=j,O.directionalLights.needsUpdate=j,O.directionalLightShadows.needsUpdate=j,O.pointLights.needsUpdate=j,O.pointLightShadows.needsUpdate=j,O.spotLights.needsUpdate=j,O.spotLightShadows.needsUpdate=j,O.rectAreaLights.needsUpdate=j,O.hemisphereLights.needsUpdate=j}function A0(O){return O.isMeshLambertMaterial||O.isMeshToonMaterial||O.isMeshPhongMaterial||O.isMeshStandardMaterial||O.isShadowMaterial||O.isShaderMaterial&&O.lights===!0}this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(O,j,re){Ne.get(O.texture).__webglTexture=j,Ne.get(O.depthTexture).__webglTexture=re;let ie=Ne.get(O);ie.__hasExternalTextures=!0,ie.__autoAllocateDepthBuffer=re===void 0,ie.__autoAllocateDepthBuffer||_e.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ie.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(O,j){let re=Ne.get(O);re.__webglFramebuffer=j,re.__useDefaultFramebuffer=j===void 0},this.setRenderTarget=function(O,j=0,re=0){w=O,M=j,S=re;let ie=!0,P=null,W=!1,ee=!1;if(O){let ce=Ne.get(O);ce.__useDefaultFramebuffer!==void 0?(Le.bindFramebuffer(H.FRAMEBUFFER,null),ie=!1):ce.__webglFramebuffer===void 0?Ve.setupRenderTarget(O):ce.__hasExternalTextures&&Ve.rebindTextures(O,Ne.get(O.texture).__webglTexture,Ne.get(O.depthTexture).__webglTexture);let Oe=O.texture;(Oe.isData3DTexture||Oe.isDataArrayTexture||Oe.isCompressedArrayTexture)&&(ee=!0);let Ge=Ne.get(O).__webglFramebuffer;O.isWebGLCubeRenderTarget?(Array.isArray(Ge[j])?P=Ge[j][re]:P=Ge[j],W=!0):xe.isWebGL2&&O.samples>0&&Ve.useMultisampledRTT(O)===!1?P=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?P=Ge[re]:P=Ge,b.copy(O.viewport),E.copy(O.scissor),I=O.scissorTest}else b.copy(G).multiplyScalar(B).floor(),E.copy(Y).multiplyScalar(B).floor(),I=J;if(Le.bindFramebuffer(H.FRAMEBUFFER,P)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,P),Le.viewport(b),Le.scissor(E),Le.setScissorTest(I),W){let ce=Ne.get(O.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+j,ce.__webglTexture,re)}else if(ee){let ce=Ne.get(O.texture),Oe=j||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,ce.__webglTexture,re||0,Oe)}T=-1},this.readRenderTargetPixels=function(O,j,re,ie,P,W,ee){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Ne.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&ee!==void 0&&(ge=ge[ee]),ge){Le.bindFramebuffer(H.FRAMEBUFFER,ge);try{let ce=O.texture,Oe=ce.format,Ge=ce.type;if(Oe!==Cs&&Fe.convert(Oe)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Re=Ge===DM&&(_e.has("EXT_color_buffer_half_float")||xe.isWebGL2&&_e.has("EXT_color_buffer_float"));if(Ge!==Oh&&Fe.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===fu&&(xe.isWebGL2||_e.has("OES_texture_float")||_e.has("WEBGL_color_buffer_float")))&&!Re){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=O.width-ie&&re>=0&&re<=O.height-P&&H.readPixels(j,re,ie,P,Fe.convert(Oe),Fe.convert(Ge),W)}finally{let ce=w!==null?Ne.get(w).__webglFramebuffer:null;Le.bindFramebuffer(H.FRAMEBUFFER,ce)}}},this.copyFramebufferToTexture=function(O,j,re=0){let ie=Math.pow(2,-re),P=Math.floor(j.image.width*ie),W=Math.floor(j.image.height*ie);Ve.setTexture2D(j,0),H.copyTexSubImage2D(H.TEXTURE_2D,re,0,0,O.x,O.y,P,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let P=j.image.width,W=j.image.height,ee=Fe.convert(re.format),ge=Fe.convert(re.type);Ve.setTexture2D(re,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,re.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,re.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,re.unpackAlignment),j.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,P,W,ee,ge,j.image.data):j.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,j.mipmaps[0].width,j.mipmaps[0].height,ee,j.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,ee,ge,j.image),ie===0&&re.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),Le.unbindTexture()},this.copyTextureToTexture3D=function(O,j,re,ie,P=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let W=Math.round(O.max.x-O.min.x),ee=Math.round(O.max.y-O.min.y),ge=O.max.z-O.min.z+1,ce=Fe.convert(ie.format),Oe=Fe.convert(ie.type),Ge;if(ie.isData3DTexture)Ve.setTexture3D(ie,0),Ge=H.TEXTURE_3D;else if(ie.isDataArrayTexture||ie.isCompressedArrayTexture)Ve.setTexture2DArray(ie,0),Ge=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ie.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ie.unpackAlignment);let Re=H.getParameter(H.UNPACK_ROW_LENGTH),pt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),mt=H.getParameter(H.UNPACK_SKIP_PIXELS),$e=H.getParameter(H.UNPACK_SKIP_ROWS),at=H.getParameter(H.UNPACK_SKIP_IMAGES),wt=re.isCompressedTexture?re.mipmaps[P]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,wt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,wt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,O.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,O.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,O.min.z),re.isDataTexture||re.isData3DTexture?H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,wt.data):H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt),H.pixelStorei(H.UNPACK_ROW_LENGTH,Re),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,pt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,mt),H.pixelStorei(H.UNPACK_SKIP_ROWS,$e),H.pixelStorei(H.UNPACK_SKIP_IMAGES,at),P===0&&ie.generateMipmaps&&H.generateMipmap(Ge),Le.unbindTexture()},this.initTexture=function(O){O.isCubeTexture?Ve.setTextureCube(O,0):O.isData3DTexture?Ve.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?Ve.setTexture2DArray(O,0):Ve.setTexture2D(O,0),Le.unbindTexture()},this.resetState=function(){M=0,S=0,w=null,Le.reset(),we.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return yc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===Fk?"display-p3":"srgb",t.unpackColorSpace=$r.workingColorSpace===zR?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}},xk=class extends _k{};xk.prototype.isWebGL1Renderer=!0;var Poe=new ye,Doe=new Rr,Ioe=new Rr,JUe=new ye,Noe=new Ht,KC=new ye,qB=new kh,Uoe=new Ht,ZB=new NM,xR=class extends co{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fae,this.bindMatrix=new Ht,this.bindMatrixInverse=new Ht,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Bh),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,KC),this.boundingBox.expandByPoint(KC)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new kh),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,KC),this.boundingSphere.expandByPoint(KC)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let i=this.material,n=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),qB.copy(this.boundingSphere),qB.applyMatrix4(n),e.ray.intersectsSphere(qB)!==!1&&(Uoe.copy(n).invert(),ZB.copy(e.ray).applyMatrix4(Uoe),!(this.boundingBox!==null&&ZB.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,ZB)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Rr,t=this.geometry.attributes.skinWeight;for(let i=0,n=t.count;i<n;i++){e.fromBufferAttribute(t,i);let a=1/e.manhattanLength();a!==1/0?e.multiplyScalar(a):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===fae?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===_Pe?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let i=this.skeleton,n=this.geometry;Doe.fromBufferAttribute(n.attributes.skinIndex,e),Ioe.fromBufferAttribute(n.attributes.skinWeight,e),Poe.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let a=0;a<4;a++){let o=Ioe.getComponent(a);if(o!==0){let s=Doe.getComponent(a);Noe.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(JUe.copy(Poe).applyMatrix4(Noe),o)}}return t.applyMatrix4(this.bindMatrixInverse)}},y0=class extends ia{constructor(){super(),this.isBone=!0,this.type="Bone"}},Sk=class extends Vo{constructor(e=null,t=1,i=1,n,a,o,s,l,u=Dn,c=Dn,f,h){super(null,o,s,l,u,c,n,a,f,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Ooe=new Ht,$Ue=new Ht,SR=class r{constructor(e=[],t=[]){this.uuid=Yh(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new Ht)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let i=new Ht;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let a=0,o=e.length;a<o;a++){let s=e[a]?e[a].matrixWorld:$Ue;Ooe.multiplyMatrices(s,t[a]),Ooe.toArray(i,a*16)}n!==null&&(n.needsUpdate=!0)}clone(){return new r(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let i=new Sk(t,e,e,Cs,fu);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,n=e.bones.length;i<n;i++){let a=e.bones[i],o=t[a];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",a),o=new y0),this.bones.push(o),this.boneInverses.push(new Ht().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let n=0,a=t.length;n<a;n++){let o=t[n];e.bones.push(o.uuid);let s=i[n];e.boneInverses.push(s.toArray())}return e}};var zM=class extends Sc{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tr(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},zoe=new ye,Foe=new ye,Boe=new Ht,jB=new NM,JC=new kh,MR=class extends ia{constructor(e=new Ls,t=new zM){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[0];for(let n=1,a=t.count;n<a;n++)zoe.fromBufferAttribute(t,n-1),Foe.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=zoe.distanceTo(Foe);e.setAttribute("lineDistance",new Un(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,a=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),JC.copy(i.boundingSphere),JC.applyMatrix4(n),JC.radius+=a,e.ray.intersectsSphere(JC)===!1)return;Boe.copy(n).invert(),jB.copy(e.ray).applyMatrix4(Boe);let s=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=s*s,u=new ye,c=new ye,f=new ye,h=new ye,p=this.isLineSegments?2:1,d=i.index,m=i.attributes.position;if(d!==null){let v=Math.max(0,o.start),_=Math.min(d.count,o.start+o.count);for(let y=v,x=_-1;y<x;y+=p){let M=d.getX(y),S=d.getX(y+1);if(u.fromBufferAttribute(m,M),c.fromBufferAttribute(m,S),jB.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{let v=Math.max(0,o.start),_=Math.min(m.count,o.start+o.count);for(let y=v,x=_-1;y<x;y+=p){if(u.fromBufferAttribute(m,y),c.fromBufferAttribute(m,y+1),jB.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(h);S<e.near||S>e.far||t.push({distance:S,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a<o;a++){let s=n[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=a}}}}};var bR=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),a=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),a+=i.distanceTo(n),t.push(a),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),n=0,a=i.length,o;t?o=t:o=e*i[a-1];let s=0,l=a-1,u;for(;s<=l;)if(n=Math.floor(s+(l-s)/2),u=i[n]-o,u<0)s=n+1;else if(u>0)l=n-1;else{l=n;break}if(n=l,i[n]===o)return n/(a-1);let c=i[n],h=i[n+1]-c,p=(o-c)/h;return(n+p)/(a-1)}getTangent(e,t){let n=e-1e-4,a=e+1e-4;n<0&&(n=0),a>1&&(a=1);let o=this.getPoint(n),s=this.getPoint(a),l=t||(o.isVector2?new yr:new ye);return l.copy(s).sub(o).normalize(),l}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new ye,n=[],a=[],o=[],s=new ye,l=new Ht;for(let p=0;p<=e;p++){let d=p/e;n[p]=this.getTangentAt(d,new ye)}a[0]=new ye,o[0]=new ye;let u=Number.MAX_VALUE,c=Math.abs(n[0].x),f=Math.abs(n[0].y),h=Math.abs(n[0].z);c<=u&&(u=c,i.set(1,0,0)),f<=u&&(u=f,i.set(0,1,0)),h<=u&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),a[0].crossVectors(n[0],s),o[0].crossVectors(n[0],a[0]);for(let p=1;p<=e;p++){if(a[p]=a[p-1].clone(),o[p]=o[p-1].clone(),s.crossVectors(n[p-1],n[p]),s.length()>Number.EPSILON){s.normalize();let d=Math.acos(In(n[p-1].dot(n[p]),-1,1));a[p].applyMatrix4(l.makeRotationAxis(s,d))}o[p].crossVectors(n[p],a[p])}if(t===!0){let p=Math.acos(In(a[0].dot(a[e]),-1,1));p/=e,n[0].dot(s.crossVectors(a[0],a[e]))>0&&(p=-p);for(let d=1;d<=e;d++)a[d].applyMatrix4(l.makeRotationAxis(n[d],p*d)),o[d].crossVectors(n[d],a[d])}return{tangents:n,normals:a,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}};var QUe={triangulate:function(r,e,t=2){let i=e&&e.length,n=i?e[0]*t:r.length,a=fse(r,0,n,t,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u,c,f,h,p;if(i&&(a=nOe(r,e,a,t)),r.length>80*t){s=u=r[0],l=c=r[1];for(let d=t;d<n;d+=t)f=r[d],h=r[d+1],f<s&&(s=f),h<l&&(l=h),f>u&&(u=f),h>c&&(c=h);p=Math.max(u-s,c-l),p=p!==0?32767/p:0}return FM(a,o,t,s,l,p,0),o}};function fse(r,e,t,i,n){let a,o;if(n===mOe(r,e,t,i)>0)for(a=e;a<t;a+=i)o=koe(a,r[a],r[a+1],o);else for(a=t-i;a>=e;a-=i)o=koe(a,r[a],r[a+1],o);return o&&BR(o,o.next)&&(kM(o),o=o.next),o}function vm(r,e){if(!r)return r;e||(e=r);let t=r,i;do if(i=!1,!t.steiner&&(BR(t,t.next)||Si(t.prev,t,t.next)===0)){if(kM(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function FM(r,e,t,i,n,a,o){if(!r)return;!o&&a&&uOe(r,i,n,a);let s=r,l,u;for(;r.prev!==r.next;){if(l=r.prev,u=r.next,a?tOe(r,i,n,a):eOe(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),kM(r),r=u.next,s=u.next;continue}if(r=u,r===s){o?o===1?(r=rOe(vm(r),e,t),FM(r,e,t,i,n,a,2)):o===2&&iOe(r,e,t,i,n,a):FM(vm(r),e,t,i,n,a,1);break}}}function eOe(r){let e=r.prev,t=r,i=r.next;if(Si(e,t,i)>=0)return!1;let n=e.x,a=t.x,o=i.x,s=e.y,l=t.y,u=i.y,c=n<a?n<o?n:o:a<o?a:o,f=s<l?s<u?s:u:l<u?l:u,h=n>a?n>o?n:o:a>o?a:o,p=s>l?s>u?s:u:l>u?l:u,d=i.next;for(;d!==e;){if(d.x>=c&&d.x<=h&&d.y>=f&&d.y<=p&&o0(n,s,a,l,o,u,d.x,d.y)&&Si(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function tOe(r,e,t,i){let n=r.prev,a=r,o=r.next;if(Si(n,a,o)>=0)return!1;let s=n.x,l=a.x,u=o.x,c=n.y,f=a.y,h=o.y,p=s<l?s<u?s:u:l<u?l:u,d=c<f?c<h?c:h:f<h?f:h,g=s>l?s>u?s:u:l>u?l:u,m=c>f?c>h?c:h:f>h?f:h,v=Mk(p,d,e,t,i),_=Mk(g,m,e,t,i),y=r.prevZ,x=r.nextZ;for(;y&&y.z>=v&&x&&x.z<=_;){if(y.x>=p&&y.x<=g&&y.y>=d&&y.y<=m&&y!==n&&y!==o&&o0(s,c,l,f,u,h,y.x,y.y)&&Si(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=p&&x.x<=g&&x.y>=d&&x.y<=m&&x!==n&&x!==o&&o0(s,c,l,f,u,h,x.x,x.y)&&Si(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=v;){if(y.x>=p&&y.x<=g&&y.y>=d&&y.y<=m&&y!==n&&y!==o&&o0(s,c,l,f,u,h,y.x,y.y)&&Si(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=_;){if(x.x>=p&&x.x<=g&&x.y>=d&&x.y<=m&&x!==n&&x!==o&&o0(s,c,l,f,u,h,x.x,x.y)&&Si(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function rOe(r,e,t){let i=r;do{let n=i.prev,a=i.next.next;!BR(n,a)&&hse(n,i,i.next,a)&&BM(n,a)&&BM(a,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(a.i/t|0),kM(i),kM(i.next),i=r=a),i=i.next}while(i!==r);return vm(i)}function iOe(r,e,t,i,n,a){let o=r;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&hOe(o,s)){let l=pse(o,s);o=vm(o,o.next),l=vm(l,l.next),FM(o,e,t,i,n,a,0),FM(l,e,t,i,n,a,0);return}s=s.next}o=o.next}while(o!==r)}function nOe(r,e,t,i){let n=[],a,o,s,l,u;for(a=0,o=e.length;a<o;a++)s=e[a]*i,l=a<o-1?e[a+1]*i:r.length,u=fse(r,s,l,i,!1),u===u.next&&(u.steiner=!0),n.push(fOe(u));for(n.sort(aOe),a=0;a<n.length;a++)t=oOe(n[a],t);return t}function aOe(r,e){return r.x-e.x}function oOe(r,e){let t=sOe(r,e);if(!t)return e;let i=pse(t,r);return vm(i,i.next),vm(t,t.next)}function sOe(r,e){let t=e,i=-1/0,n,a=r.x,o=r.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){let h=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=a&&h>i&&(i=h,n=t.x<t.next.x?t:t.next,h===a))return n}t=t.next}while(t!==e);if(!n)return null;let s=n,l=n.x,u=n.y,c=1/0,f;t=n;do a>=t.x&&t.x>=l&&a!==t.x&&o0(o<u?a:i,o,l,u,o<u?i:a,o,t.x,t.y)&&(f=Math.abs(o-t.y)/(a-t.x),BM(t,r)&&(f<c||f===c&&(t.x>n.x||t.x===n.x&&lOe(n,t)))&&(n=t,c=f)),t=t.next;while(t!==s);return n}function lOe(r,e){return Si(r.prev,r,e.prev)<0&&Si(e.next,r,r.next)<0}function uOe(r,e,t,i){let n=r;do n.z===0&&(n.z=Mk(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,cOe(n)}function cOe(r){let e,t,i,n,a,o,s,l,u=1;do{for(t=r,r=null,a=null,o=0;t;){for(o++,i=t,s=0,e=0;e<u&&(s++,i=i.nextZ,!!i);e++);for(l=u;s>0||l>0&&i;)s!==0&&(l===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,s--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:r=n,n.prevZ=a,a=n;t=i}a.nextZ=null,u*=2}while(o>1);return r}function Mk(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function fOe(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function o0(r,e,t,i,n,a,o,s){return(n-o)*(e-s)>=(r-o)*(a-s)&&(r-o)*(i-s)>=(t-o)*(e-s)&&(t-o)*(a-s)>=(n-o)*(i-s)}function hOe(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!pOe(r,e)&&(BM(r,e)&&BM(e,r)&&dOe(r,e)&&(Si(r.prev,r,e.prev)||Si(r,e.prev,e))||BR(r,e)&&Si(r.prev,r,r.next)>0&&Si(e.prev,e,e.next)>0)}function Si(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function BR(r,e){return r.x===e.x&&r.y===e.y}function hse(r,e,t,i){let n=QC(Si(r,e,t)),a=QC(Si(r,e,i)),o=QC(Si(t,i,r)),s=QC(Si(t,i,e));return!!(n!==a&&o!==s||n===0&&$C(r,t,e)||a===0&&$C(r,i,e)||o===0&&$C(t,r,i)||s===0&&$C(t,e,i))}function $C(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function QC(r){return r>0?1:r<0?-1:0}function pOe(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&hse(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function BM(r,e){return Si(r.prev,r,r.next)<0?Si(r,e,r.next)>=0&&Si(r,r.prev,e)>=0:Si(r,e,r.prev)<0||Si(r,r.next,e)<0}function dOe(r,e){let t=r,i=!1,n=(r.x+e.x)/2,a=(r.y+e.y)/2;do t.y>a!=t.next.y>a&&t.next.y!==t.y&&n<(t.next.x-t.x)*(a-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function pse(r,e){let t=new bk(r.i,r.x,r.y),i=new bk(e.i,e.x,e.y),n=r.next,a=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,a.next=i,i.prev=a,i}function koe(r,e,t,i){let n=new bk(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function kM(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function bk(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function mOe(r,e,t,i){let n=0;for(let a=e,o=t-i;a<t;a+=i)n+=(r[o]-r[a])*(r[a+1]+r[o+1]),o=a;return n}var wR=class r{static area(e){let t=e.length,i=0;for(let n=t-1,a=0;a<t;n=a++)i+=e[n].x*e[a].y-e[a].x*e[n].y;return i*.5}static isClockWise(e){return r.area(e)<0}static triangulateShape(e,t){let i=[],n=[],a=[];Voe(e),Goe(i,e);let o=e.length;t.forEach(Voe);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,Goe(i,t[l]);let s=QUe.triangulate(i,n);for(let l=0;l<s.length;l+=3)a.push(s.slice(l,l+3));return a}};function Voe(r){let e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Goe(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}var _0=class extends Sc{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new tr(16777215),this.specular=new tr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zk,this.normalScale=new yr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new zn,this.combine=UR,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};var TR=class extends Sc{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new tr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zk,this.normalScale=new yr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new zn,this.combine=UR,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};function eR(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function vOe(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function gOe(r){function e(n,a){return r[n]-r[a]}let t=r.length,i=new Array(t);for(let n=0;n!==t;++n)i[n]=n;return i.sort(e),i}function Hoe(r,e,t){let i=r.length,n=new r.constructor(i);for(let a=0,o=0;o!==i;++a){let s=t[a]*e;for(let l=0;l!==e;++l)n[o++]=r[s+l]}return n}function dse(r,e,t,i){let n=1,a=r[0];for(;a!==void 0&&a[i]===void 0;)a=r[n++];if(a===void 0)return;let o=a[i];if(o!==void 0)if(Array.isArray(o))do o=a[i],o!==void 0&&(e.push(a.time),t.push.apply(t,o)),a=r[n++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[i],o!==void 0&&(e.push(a.time),o.toArray(t,t.length)),a=r[n++];while(a!==void 0);else do o=a[i],o!==void 0&&(e.push(a.time),t.push(o)),a=r[n++];while(a!==void 0)}var x0=class{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],a=t[i-1];e:{t:{let o;r:{i:if(!(e<n)){for(let s=i+2;;){if(n===void 0){if(e<a)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===s)break;if(a=n,n=t[++i],e<n)break t}o=t.length;break r}if(!(e>=a)){let s=t[1];e<s&&(i=2,a=s);for(let l=i-2;;){if(a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(n=a,a=t[--i-1],e>=a)break t}o=i,i=0;break r}break e}for(;i<o;){let s=i+o>>>1;e<t[s]?o=s:i=s+1}if(n=t[i],a=t[i-1],a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,a,n)}return this.interpolate_(i,a,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,a=e*n;for(let o=0;o!==n;++o)t[o]=i[a+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},wk=class extends x0{constructor(e,t,i,n){super(e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Bae,endingEnd:Bae}}intervalChanged_(e,t,i){let n=this.parameterPositions,a=e-2,o=e+1,s=n[a],l=n[o];if(s===void 0)switch(this.getSettings_().endingStart){case kae:a=e,s=2*t-i;break;case Vae:a=n.length-2,s=t+n[a]-n[a+1];break;default:a=e,s=i}if(l===void 0)switch(this.getSettings_().endingEnd){case kae:o=e,l=2*i-t;break;case Vae:o=1,l=i+n[1]-n[0];break;default:o=e-1,l=t}let u=(i-t)*.5,c=this.valueSize;this._weightPrev=u/(t-s),this._weightNext=u/(l-i),this._offsetPrev=a*c,this._offsetNext=o*c}interpolate_(e,t,i,n){let a=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=e*s,u=l-s,c=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(i-t)/(n-t),g=d*d,m=g*d,v=-h*m+2*h*g-h*d,_=(1+h)*m+(-1.5-2*h)*g+(-.5+h)*d+1,y=(-1-p)*m+(1.5+p)*g+.5*d,x=p*m-p*g;for(let M=0;M!==s;++M)a[M]=v*o[c+M]+_*o[u+M]+y*o[l+M]+x*o[f+M];return a}},Tk=class extends x0{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let a=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=e*s,u=l-s,c=(i-t)/(n-t),f=1-c;for(let h=0;h!==s;++h)a[h]=o[u+h]*f+o[l+h]*c;return a}},Ek=class extends x0{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}},Ps=class{constructor(e,t,i,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=eR(t,this.TimeBufferType),this.values=eR(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:eR(e.times,Array),values:eR(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(i.interpolation=n)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Ek(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Tk(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new wk(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case rR:t=this.InterpolantFactoryMethodDiscrete;break;case iR:t=this.InterpolantFactoryMethodLinear;break;case MB:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return rR;case this.InterpolantFactoryMethodLinear:return iR;case this.InterpolantFactoryMethodSmooth:return MB}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,a=0,o=n-1;for(;a!==n&&i[a]<e;)++a;for(;o!==-1&&i[o]>t;)--o;if(++o,a!==0||o!==n){a>=o&&(o=Math.max(o,1),a=o-1);let s=this.getValueSize();this.times=i.slice(a,o),this.values=this.values.slice(a*s,o*s)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,n=this.values,a=i.length;a===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let s=0;s!==a;s++){let l=i[s];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,l,o),e=!1;break}o=l}if(n!==void 0&&vOe(n))for(let s=0,l=n.length;s!==l;++s){let u=n[s];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,s,u),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===MB,a=e.length-1,o=1;for(let s=1;s<a;++s){let l=!1,u=e[s],c=e[s+1];if(u!==c&&(s!==1||u!==e[0]))if(n)l=!0;else{let f=s*i,h=f-i,p=f+i;for(let d=0;d!==i;++d){let g=t[f+d];if(g!==t[h+d]||g!==t[p+d]){l=!0;break}}}if(l){if(s!==o){e[o]=e[s];let f=s*i,h=o*i;for(let p=0;p!==i;++p)t[h+p]=t[f+p]}++o}}if(a>0){e[o]=e[a];for(let s=a*i,l=o*i,u=0;u!==i;++u)t[l+u]=t[s+u];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,n=new i(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};Ps.prototype.TimeBufferType=Float32Array;Ps.prototype.ValueBufferType=Float32Array;Ps.prototype.DefaultInterpolation=iR;var Vh=class extends Ps{};Vh.prototype.ValueTypeName="bool";Vh.prototype.ValueBufferType=Array;Vh.prototype.DefaultInterpolation=rR;Vh.prototype.InterpolantFactoryMethodLinear=void 0;Vh.prototype.InterpolantFactoryMethodSmooth=void 0;var ER=class extends Ps{};ER.prototype.ValueTypeName="color";var Gh=class extends Ps{};Gh.prototype.ValueTypeName="number";var Ak=class extends x0{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let a=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=(i-t)/(n-t),u=e*s;for(let c=u+s;u!==c;u+=4)On.slerpFlat(a,0,o,u-s,o,u,l);return a}},pu=class extends Ps{InterpolantFactoryMethodLinear(e){return new Ak(this.times,this.values,this.getValueSize(),e)}};pu.prototype.ValueTypeName="quaternion";pu.prototype.DefaultInterpolation=iR;pu.prototype.InterpolantFactoryMethodSmooth=void 0;var Hh=class extends Ps{};Hh.prototype.ValueTypeName="string";Hh.prototype.ValueBufferType=Array;Hh.prototype.DefaultInterpolation=rR;Hh.prototype.InterpolantFactoryMethodLinear=void 0;Hh.prototype.InterpolantFactoryMethodSmooth=void 0;var Wh=class extends Ps{};Wh.prototype.ValueTypeName="vector";var AR=class{constructor(e,t=-1,i,n=CPe){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=Yh(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,n=1/(e.fps||1);for(let o=0,s=i.length;o!==s;++o)t.push(_Oe(i[o]).scale(n));let a=new this(e.name,e.duration,t,e.blendMode);return a.uuid=e.uuid,a}static toJSON(e){let t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let a=0,o=i.length;a!==o;++a)t.push(Ps.toJSON(i[a]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let a=t.length,o=[];for(let s=0;s<a;s++){let l=[],u=[];l.push((s+a-1)%a,s,(s+1)%a),u.push(0,1,0);let c=gOe(l);l=Hoe(l,1,c),u=Hoe(u,1,c),!n&&l[0]===0&&(l.push(a),u.push(u[0])),o.push(new Gh(".morphTargetInfluences["+t[s].name+"]",l,u).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){let n=e;i=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<i.length;n++)if(i[n].name===t)return i[n];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let n={},a=/^([\w-]*?)([\d]+)$/;for(let s=0,l=e.length;s<l;s++){let u=e[s],c=u.name.match(a);if(c&&c.length>1){let f=c[1],h=n[f];h||(n[f]=h=[]),h.push(u)}}let o=[];for(let s in n)o.push(this.CreateFromMorphTargetSequence(s,n[s],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(f,h,p,d,g){if(p.length!==0){let m=[],v=[];dse(p,m,v,d),m.length!==0&&g.push(new f(h,m,v))}},n=[],a=e.name||"default",o=e.fps||30,s=e.blendMode,l=e.length||-1,u=e.hierarchy||[];for(let f=0;f<u.length;f++){let h=u[f].keys;if(!(!h||h.length===0))if(h[0].morphTargets){let p={},d;for(d=0;d<h.length;d++)if(h[d].morphTargets)for(let g=0;g<h[d].morphTargets.length;g++)p[h[d].morphTargets[g]]=-1;for(let g in p){let m=[],v=[];for(let _=0;_!==h[d].morphTargets.length;++_){let y=h[d];m.push(y.time),v.push(y.morphTarget===g?1:0)}n.push(new Gh(".morphTargetInfluence["+g+"]",m,v))}l=p.length*o}else{let p=".bones["+t[f].name+"]";i(Wh,p+".position",h,"pos",n),i(pu,p+".quaternion",h,"rot",n),i(Wh,p+".scale",h,"scl",n)}}return n.length===0?null:new this(a,l,n,s)}resetDuration(){let e=this.tracks,t=0;for(let i=0,n=e.length;i!==n;++i){let a=this.tracks[i];t=Math.max(t,a.times[a.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function yOe(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Gh;case"vector":case"vector2":case"vector3":case"vector4":return Wh;case"color":return ER;case"quaternion":return pu;case"bool":case"boolean":return Vh;case"string":return Hh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function _Oe(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=yOe(r.type);if(r.times===void 0){let t=[],i=[];dse(r.keys,t,i,"value"),r.times=t,r.values=i}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}var CR={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}},Ck=class{constructor(e,t,i){let n=this,a=!1,o=0,s=0,l,u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(c){s++,a===!1&&n.onStart!==void 0&&n.onStart(c,o,s),a=!0},this.itemEnd=function(c){o++,n.onProgress!==void 0&&n.onProgress(c,o,s),o===s&&(a=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(c){n.onError!==void 0&&n.onError(c)},this.resolveURL=function(c){return l?l(c):c},this.setURLModifier=function(c){return l=c,this},this.addHandler=function(c,f){return u.push(c,f),this},this.removeHandler=function(c){let f=u.indexOf(c);return f!==-1&&u.splice(f,2),this},this.getHandler=function(c){for(let f=0,h=u.length;f<h;f+=2){let p=u[f],d=u[f+1];if(p.global&&(p.lastIndex=0),p.test(c))return d}return null}}},xOe=new Ck,gm=(()=>{class r{constructor(t){this.manager=t!==void 0?t:xOe,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,i){let n=this;return new Promise(function(a,o){n.load(t,a,i,o)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}return r.DEFAULT_MATERIAL_NAME="__DEFAULT",r})(),dc={},Rk=class extends Error{constructor(e,t){super(e),this.response=t}},RR=class extends gm{constructor(e){super(e)}load(e,t,i,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let a=CR.get(e);if(a!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0),a;if(dc[e]!==void 0){dc[e].push({onLoad:t,onProgress:i,onError:n});return}dc[e]=[],dc[e].push({onLoad:t,onProgress:i,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,l=this.responseType;fetch(o).then(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;let c=dc[e],f=u.body.getReader(),h=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),p=h?parseInt(h):0,d=p!==0,g=0,m=new ReadableStream({start(v){_();function _(){f.read().then(({done:y,value:x})=>{if(y)v.close();else{g+=x.byteLength;let M=new ProgressEvent("progress",{lengthComputable:d,loaded:g,total:p});for(let S=0,w=c.length;S<w;S++){let T=c[S];T.onProgress&&T.onProgress(M)}v.enqueue(x),_()}})}}});return new Response(m)}else throw new Rk(`fetch for "${u.url}" responded with ${u.status}: ${u.statusText}`,u)}).then(u=>{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(c=>new DOMParser().parseFromString(c,s));case"json":return u.json();default:if(s===void 0)return u.text();{let f=/charset="?([^;"\s]*)"?/i.exec(s),h=f&&f[1]?f[1].toLowerCase():void 0,p=new TextDecoder(h);return u.arrayBuffer().then(d=>p.decode(d))}}}).then(u=>{CR.add(e,u);let c=dc[e];delete dc[e];for(let f=0,h=c.length;f<h;f++){let p=c[f];p.onLoad&&p.onLoad(u)}}).catch(u=>{let c=dc[e];if(c===void 0)throw this.manager.itemError(e),u;delete dc[e];for(let f=0,h=c.length;f<h;f++){let p=c[f];p.onError&&p.onError(u)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var Lk=class extends gm{constructor(e){super(e)}load(e,t,i,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let a=this,o=CR.get(e);if(o!==void 0)return a.manager.itemStart(e),setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0),o;let s=IM("img");function l(){c(),CR.add(e,this),t&&t(this),a.manager.itemEnd(e)}function u(f){c(),n&&n(f),a.manager.itemError(e),a.manager.itemEnd(e)}function c(){s.removeEventListener("load",l,!1),s.removeEventListener("error",u,!1)}return s.addEventListener("load",l,!1),s.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(s.crossOrigin=this.crossOrigin),a.manager.itemStart(e),s.src=e,s}};var LR=class extends gm{constructor(e){super(e)}load(e,t,i,n){let a=new Vo,o=new Lk(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(s){a.image=s,a.needsUpdate=!0,t!==void 0&&t(a)},i,n),a}},S0=class extends ia{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tr(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};var KB=new Ht,Woe=new ye,Xoe=new ye,VM=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new yr(512,512),this.map=null,this.mapPass=null,this.matrix=new Ht,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new OM,this._frameExtents=new yr(1,1),this._viewportCount=1,this._viewports=[new Rr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Woe.setFromMatrixPosition(e.matrixWorld),t.position.copy(Woe),Xoe.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Xoe),t.updateMatrixWorld(),KB.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(KB),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(KB)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},Pk=class extends VM{constructor(){super(new Nn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=d0*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;(i!==t.fov||n!==t.aspect||a!==t.far)&&(t.fov=i,t.aspect=n,t.far=a,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},PR=class extends S0{constructor(e,t,i=0,n=Math.PI/3,a=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.distance=i,this.angle=n,this.penumbra=a,this.decay=o,this.map=null,this.shadow=new Pk}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},Yoe=new Ht,AM=new ye,JB=new ye,Dk=class extends VM{constructor(){super(new Nn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new yr(4,2),this._viewportCount=6,this._viewports=[new Rr(2,1,1,1),new Rr(0,1,1,1),new Rr(3,1,1,1),new Rr(1,1,1,1),new Rr(3,0,1,1),new Rr(1,0,1,1)],this._cubeDirections=[new ye(1,0,0),new ye(-1,0,0),new ye(0,0,1),new ye(0,0,-1),new ye(0,1,0),new ye(0,-1,0)],this._cubeUps=[new ye(0,1,0),new ye(0,1,0),new ye(0,1,0),new ye(0,1,0),new ye(0,0,1),new ye(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,n=this.matrix,a=e.distance||i.far;a!==i.far&&(i.far=a,i.updateProjectionMatrix()),AM.setFromMatrixPosition(e.matrixWorld),i.position.copy(AM),JB.copy(i.position),JB.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(JB),i.updateMatrixWorld(),n.makeTranslation(-AM.x,-AM.y,-AM.z),Yoe.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Yoe)}},GM=class extends S0{constructor(e,t,i=0,n=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new Dk}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},Ik=class extends VM{constructor(){super(new g0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},DR=class extends S0{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.shadow=new Ik}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},IR=class extends S0{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var NR=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,n=e.length;i<n;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}};var Vk="\\[\\]\\.:\\/",SOe=new RegExp("["+Vk+"]","g"),Gk="[^"+Vk+"]",MOe="[^"+Vk.replace("\\.","")+"]",bOe=/((?:WC+[\/:])*)/.source.replace("WC",Gk),wOe=/(WCOD+)?/.source.replace("WCOD",MOe),TOe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Gk),EOe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Gk),AOe=new RegExp("^"+bOe+wOe+TOe+EOe+"$"),COe=["material","materials","bones","map"],Nk=class{constructor(e,t,i){let n=i||ii.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];n!==void 0&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,a=i.length;n!==a;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},ii=(()=>{class r{constructor(t,i,n){this.path=i,this.parsedPath=n||r.parseTrackName(i),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,i,n){return t&&t.isAnimationObjectGroup?new r.Composite(t,i,n):new r(t,i,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(SOe,"")}static parseTrackName(t){let i=AOe.exec(t);if(i===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},a=n.nodeName&&n.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let o=n.nodeName.substring(a+1);COe.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,a),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,i){if(i===void 0||i===""||i==="."||i===-1||i===t.name||i===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(i);if(n!==void 0)return n}if(t.children){let n=function(o){for(let s=0;s<o.length;s++){let l=o[s];if(l.name===i||l.uuid===i)return l;let u=n(l.children);if(u)return u}return null},a=n(t.children);if(a)return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,i){t[i]=this.targetObject[this.propertyName]}_getValue_array(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)t[i++]=n[a]}_getValue_arrayElement(t,i){t[i]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,i){this.resolvedProperty.toArray(t,i)}_setValue_direct(t,i){this.targetObject[this.propertyName]=t[i]}_setValue_direct_setNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)n[a]=t[i++]}_setValue_array_setNeedsUpdate(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)n[a]=t[i++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)n[a]=t[i++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,i){this.resolvedProperty[this.propertyIndex]=t[i]}_setValue_arrayElement_setNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,i){this.resolvedProperty.fromArray(t,i)}_setValue_fromArray_setNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,i){this.bind(),this.getValue(t,i)}_setValue_unbound(t,i){this.bind(),this.setValue(t,i)}bind(){let t=this.node,i=this.parsedPath,n=i.objectName,a=i.propertyName,o=i.propertyIndex;if(t||(t=r.findNode(this.rootNode,i.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=i.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let f=0;f<t.length;f++)if(t[f].name===c){c=f;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let s=t[a];if(s===void 0){let c=i.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+a+" but it wasn't found.",t);return}let l=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(o!==void 0){if(a==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[o]!==void 0&&(o=t.morphTargetDictionary[o])}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=o}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=a;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}return r.Composite=Nk,r})();ii.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ii.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ii.prototype.GetterByBindingType=[ii.prototype._getValue_direct,ii.prototype._getValue_array,ii.prototype._getValue_arrayElement,ii.prototype._getValue_toArray];ii.prototype.SetterByBindingTypeAndVersioning=[[ii.prototype._setValue_direct,ii.prototype._setValue_direct_setNeedsUpdate,ii.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ii.prototype._setValue_array,ii.prototype._setValue_array_setNeedsUpdate,ii.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ii.prototype._setValue_arrayElement,ii.prototype._setValue_arrayElement_setNeedsUpdate,ii.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ii.prototype._setValue_fromArray,ii.prototype._setValue_fromArray_setNeedsUpdate,ii.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var nDt=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Uk}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Uk);var mse=function(r){return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},ROe=function(r){return new Worker(r)};try{URL.revokeObjectURL(mse(""))}catch{mse=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},ROe=function(e){return new Worker(e,{type:"module"})}}var Ds=Uint8Array,qh=Uint16Array,Xk=Uint32Array,vse=new Ds([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gse=new Ds([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),LOe=new Ds([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yse=function(r,e){for(var t=new qh(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new Xk(t[30]),i=1;i<30;++i)for(var a=t[i];a<t[i+1];++a)n[a]=a-t[i]<<5|i;return[t,n]},_se=yse(vse,2),xse=_se[0],POe=_se[1];xse[28]=258,POe[258]=28;var Sse=yse(gse,0),DOe=Sse[0],sDt=Sse[1],Yk=new qh(32768);for(Fr=0;Fr<32768;++Fr)Mc=(Fr&43690)>>>1|(Fr&21845)<<1,Mc=(Mc&52428)>>>2|(Mc&13107)<<2,Mc=(Mc&61680)>>>4|(Mc&3855)<<4,Yk[Fr]=((Mc&65280)>>>8|(Mc&255)<<8)>>>1;var Mc,Fr,HM=function(r,e,t){for(var i=r.length,n=0,a=new qh(e);n<i;++n)++a[r[n]-1];var o=new qh(e);for(n=0;n<e;++n)o[n]=o[n-1]+a[n-1]<<1;var s;if(t){s=new qh(1<<e);var l=15-e;for(n=0;n<i;++n)if(r[n])for(var u=n<<4|r[n],c=e-r[n],f=o[r[n]-1]++<<c,h=f|(1<<c)-1;f<=h;++f)s[Yk[f]>>>l]=u}else for(s=new qh(i),n=0;n<i;++n)r[n]&&(s[n]=Yk[o[r[n]-1]++]>>>15-r[n]);return s},WM=new Ds(288);for(Fr=0;Fr<144;++Fr)WM[Fr]=8;var Fr;for(Fr=144;Fr<256;++Fr)WM[Fr]=9;var Fr;for(Fr=256;Fr<280;++Fr)WM[Fr]=7;var Fr;for(Fr=280;Fr<288;++Fr)WM[Fr]=8;var Fr,Mse=new Ds(32);for(Fr=0;Fr<32;++Fr)Mse[Fr]=5;var Fr;var IOe=HM(WM,9,1);var NOe=HM(Mse,5,1),Hk=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},xl=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Wk=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},UOe=function(r){return(r/8|0)+(r&7&&1)},OOe=function(r,e,t){(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof qh?qh:r instanceof Xk?Xk:Ds)(t-e);return i.set(r.subarray(e,t)),i},zOe=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new Ds(0);var n=!e||t,a=!t||t.i;t||(t={}),e||(e=new Ds(i*3));var o=function(ae){var ve=e.length;if(ae>ve){var ue=new Ds(Math.max(ve*2,ae));ue.set(e),e=ue}},s=t.f||0,l=t.p||0,u=t.b||0,c=t.l,f=t.d,h=t.m,p=t.n,d=i*8;do{if(!c){t.f=s=xl(r,l,1);var g=xl(r,l+1,3);if(l+=3,g)if(g==1)c=IOe,f=NOe,h=9,p=5;else if(g==2){var y=xl(r,l,31)+257,x=xl(r,l+10,15)+4,M=y+xl(r,l+5,31)+1;l+=14;for(var S=new Ds(M),w=new Ds(19),T=0;T<x;++T)w[LOe[T]]=xl(r,l+T*3,7);l+=x*3;for(var C=Hk(w),b=(1<<C)-1,E=HM(w,C,1),T=0;T<M;){var I=E[xl(r,l,b)];l+=I&15;var m=I>>>4;if(m<16)S[T++]=m;else{var R=0,A=0;for(m==16?(A=3+xl(r,l,3),l+=2,R=S[T-1]):m==17?(A=3+xl(r,l,7),l+=3):m==18&&(A=11+xl(r,l,127),l+=7);A--;)S[T++]=R}}var D=S.subarray(0,y),U=S.subarray(y);h=Hk(D),p=Hk(U),c=HM(D,h,1),f=HM(U,p,1)}else throw"invalid block type";else{var m=UOe(l)+4,v=r[m-4]|r[m-3]<<8,_=m+v;if(_>i){if(a)throw"unexpected EOF";break}n&&o(u+v),e.set(r.subarray(m,_),u),t.b=u+=v,t.p=l=_*8;continue}if(l>d){if(a)throw"unexpected EOF";break}}n&&o(u+131072);for(var B=(1<<h)-1,z=(1<<p)-1,k=l;;k=l){var R=c[Wk(r,l)&B],G=R>>>4;if(l+=R&15,l>d){if(a)throw"unexpected EOF";break}if(!R)throw"invalid length/literal";if(G<256)e[u++]=G;else if(G==256){k=l,c=null;break}else{var Y=G-254;if(G>264){var T=G-257,J=vse[T];Y=xl(r,l,(1<<J)-1)+xse[T],l+=J}var Q=f[Wk(r,l)&z],V=Q>>>4;if(!Q)throw"invalid distance";l+=Q&15;var U=DOe[V];if(V>3){var J=gse[V];U+=Wk(r,l)&(1<<J)-1,l+=J}if(l>d){if(a)throw"unexpected EOF";break}n&&o(u+131072);for(var K=u+Y;u<K;u+=4)e[u]=e[u-U],e[u+1]=e[u+1-U],e[u+2]=e[u+2-U],e[u+3]=e[u+3-U];u=K}}t.l=c,t.p=k,t.b=u,c&&(s=1,t.m=h,t.d=f,t.n=p)}while(!s);return u==e.length?e:OOe(e,0,u)};var FOe=new Ds(0);var BOe=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function bse(r,e){return zOe((BOe(r),r.subarray(2,-4)),e)}var kOe=typeof TextDecoder<"u"&&new TextDecoder,VOe=0;try{kOe.decode(FOe,{stream:!0}),VOe=1}catch{}function wse(r,e,t){let i=t.length-r-1;if(e>=t[i])return i-1;if(e<=t[r])return r;let n=r,a=i,o=Math.floor((n+a)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?a=o:n=o,o=Math.floor((n+a)/2);return o}function HOe(r,e,t,i){let n=[],a=[],o=[];n[0]=1;for(let s=1;s<=t;++s){a[s]=e-i[r+1-s],o[s]=i[r+s]-e;let l=0;for(let u=0;u<s;++u){let c=o[u+1],f=a[s-u],h=n[u]/(c+f);n[u]=l+c*h,l=f*h}n[s]=l}return n}function Tse(r,e,t,i){let n=wse(r,i,e),a=HOe(n,i,r,e),o=new Rr(0,0,0,0);for(let s=0;s<=r;++s){let l=t[n-r+s],u=a[s],c=l.w*u;o.x+=l.x*c,o.y+=l.y*c,o.z+=l.z*c,o.w+=l.w*u}return o}function WOe(r,e,t,i,n){let a=[];for(let f=0;f<=t;++f)a[f]=0;let o=[];for(let f=0;f<=i;++f)o[f]=a.slice(0);let s=[];for(let f=0;f<=t;++f)s[f]=a.slice(0);s[0][0]=1;let l=a.slice(0),u=a.slice(0);for(let f=1;f<=t;++f){l[f]=e-n[r+1-f],u[f]=n[r+f]-e;let h=0;for(let p=0;p<f;++p){let d=u[p+1],g=l[f-p];s[f][p]=d+g;let m=s[p][f-1]/s[f][p];s[p][f]=h+d*m,h=g*m}s[f][f]=h}for(let f=0;f<=t;++f)o[0][f]=s[f][t];for(let f=0;f<=t;++f){let h=0,p=1,d=[];for(let g=0;g<=t;++g)d[g]=a.slice(0);d[0][0]=1;for(let g=1;g<=i;++g){let m=0,v=f-g,_=t-g;f>=g&&(d[p][0]=d[h][0]/s[_+1][v],m=d[p][0]*s[v][_]);let y=v>=-1?1:-v,x=f-1<=_?g-1:t-f;for(let S=y;S<=x;++S)d[p][S]=(d[h][S]-d[h][S-1])/s[_+1][v+S],m+=d[p][S]*s[v+S][_];f<=_&&(d[p][g]=-d[h][g-1]/s[_+1][f],m+=d[p][g]*s[f][_]),o[g][f]=m;let M=h;h=p,p=M}}let c=t;for(let f=1;f<=i;++f){for(let h=0;h<=t;++h)o[f][h]*=c;c*=t-f}return o}function XOe(r,e,t,i,n){let a=n<r?n:r,o=[],s=wse(r,i,e),l=WOe(s,i,r,a,e),u=[];for(let c=0;c<t.length;++c){let f=t[c].clone(),h=f.w;f.x*=h,f.y*=h,f.z*=h,u[c]=f}for(let c=0;c<=a;++c){let f=u[s-r].clone().multiplyScalar(l[c][0]);for(let h=1;h<=r;++h)f.add(u[s-r+h].clone().multiplyScalar(l[c][h]));o[c]=f}for(let c=a+1;c<=n+1;++c)o[c]=new Rr(0,0,0);return o}function YOe(r,e){let t=1;for(let n=2;n<=r;++n)t*=n;let i=1;for(let n=2;n<=e;++n)i*=n;for(let n=2;n<=r-e;++n)i*=n;return t/i}function qOe(r){let e=r.length,t=[],i=[];for(let a=0;a<e;++a){let o=r[a];t[a]=new ye(o.x,o.y,o.z),i[a]=o.w}let n=[];for(let a=0;a<e;++a){let o=t[a].clone();for(let s=1;s<=a;++s)o.sub(n[a-s].clone().multiplyScalar(YOe(a,s)*i[s]));n[a]=o.divideScalar(i[0])}return n}function Ese(r,e,t,i,n){let a=XOe(r,e,t,i,n);return qOe(a)}var kR=class extends bR{constructor(e,t,i,n,a){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=a||this.knots.length-1;for(let o=0;o<i.length;++o){let s=i[o];this.controlPoints[o]=new Rr(s.x,s.y,s.z,s.w)}}getPoint(e,t=new ye){let i=t,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),a=Tse(this.degree,this.knots,this.controlPoints,n);return a.w!==1&&a.divideScalar(a.w),i.set(a.x,a.y,a.z)}getTangent(e,t=new ye){let i=t,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),a=Ese(this.degree,this.knots,this.controlPoints,n,1);return i.copy(a[1]).normalize(),i}};var _r,Oi,Ea,GR=class extends gm{constructor(e){super(e)}load(e,t,i,n){let a=this,o=a.path===""?NR.extractUrlBase(e):a.path,s=new RR(this.manager);s.setPath(a.path),s.setResponseType("arraybuffer"),s.setRequestHeader(a.requestHeader),s.setWithCredentials(a.withCredentials),s.load(e,function(l){try{t(a.parse(l,o))}catch(u){n?n(u):console.error(u),a.manager.itemError(e)}},i,n)}parse(e,t){if(jOe(e))_r=new Qk().parse(e);else{let n=Lse(e);if(!KOe(n))throw new Error("THREE.FBXLoader: Unknown format.");if(Ase(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ase(n));_r=new $k().parse(n)}let i=new LR(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new jk(i,this.manager).parse(_r)}},jk=class{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Oi=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),n=this.parseDeformers(),a=new Kk().parse(n);return this.parseScene(n,a,i),Ea}parseConnections(){let e=new Map;return"Connections"in _r&&_r.Connections.connections.forEach(function(i){let n=i[0],a=i[1],o=i[2];e.has(n)||e.set(n,{parents:[],children:[]});let s={ID:a,relationship:o};e.get(n).parents.push(s),e.has(a)||e.set(a,{parents:[],children:[]});let l={ID:n,relationship:o};e.get(a).children.push(l)}),e}parseImages(){let e={},t={};if("Video"in _r.Objects){let i=_r.Objects.Video;for(let n in i){let a=i[n],o=parseInt(n);if(e[o]=a.RelativeFilename||a.Filename,"Content"in a){let s=a.Content instanceof ArrayBuffer&&a.Content.byteLength>0,l=typeof a.Content=="string"&&a.Content!=="";if(s||l){let u=this.parseImage(i[n]);t[a.RelativeFilename||a.Filename]=u}}}}for(let i in e){let n=e[i];t[n]!==void 0?e[i]=t[n]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){let t=e.Content,i=e.RelativeFilename||e.Filename,n=i.slice(i.lastIndexOf(".")+1).toLowerCase(),a;switch(n){case"bmp":a="image/bmp";break;case"jpg":case"jpeg":a="image/jpeg";break;case"png":a="image/png";break;case"tif":a="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",i),a="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if(typeof t=="string")return"data:"+a+";base64,"+t;{let o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:a}))}}parseTextures(e){let t=new Map;if("Texture"in _r.Objects){let i=_r.Objects.Texture;for(let n in i){let a=this.parseTexture(i[n],e);t.set(parseInt(n),a)}}return t}parseTexture(e,t){let i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;let n=e.WrapModeU,a=e.WrapModeV,o=n!==void 0?n.value:0,s=a!==void 0?a.value:0;if(i.wrapS=o===0?h0:uo,i.wrapT=s===0?h0:uo,"Scaling"in e){let l=e.Scaling.value;i.repeat.x=l[0],i.repeat.y=l[1]}if("Translation"in e){let l=e.Translation.value;i.offset.x=l[0],i.offset.y=l[1]}return i}loadTexture(e,t){let i,n=this.textureLoader.path,a=Oi.get(e.id).children;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(i=t[a[0].ID],(i.indexOf("blob:")===0||i.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o,s=e.FileName.slice(-3).toLowerCase();if(s==="tga"){let l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new Vo):(l.setPath(this.textureLoader.path),o=l.load(i))}else if(s==="dds"){let l=this.manager.getHandler(".dds");l===null?(console.warn("FBXLoader: DDS loader not found, creating placeholder texture for",e.RelativeFilename),o=new Vo):(l.setPath(this.textureLoader.path),o=l.load(i))}else s==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new Vo):o=this.textureLoader.load(i);return this.textureLoader.setPath(n),o}parseMaterials(e){let t=new Map;if("Material"in _r.Objects){let i=_r.Objects.Material;for(let n in i){let a=this.parseMaterial(i[n],e);a!==null&&t.set(parseInt(n),a)}}return t}parseMaterial(e,t){let i=e.id,n=e.attrName,a=e.ShadingModel;if(typeof a=="object"&&(a=a.value),!Oi.has(i))return null;let o=this.parseParameters(e,t,i),s;switch(a.toLowerCase()){case"phong":s=new _0;break;case"lambert":s=new TR;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),s=new _0;break}return s.setValues(o),s.name=n,s}parseParameters(e,t,i){let n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=new tr().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new tr().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new tr().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new tr().fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=new tr().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new tr().fromArray(e.SpecularColor.value).convertSRGBToLinear());let a=this;return Oi.get(i).children.forEach(function(o){let s=o.relationship;switch(s){case"Bump":n.bumpMap=a.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,o.ID),n.map!==void 0&&(n.map.colorSpace=Ta);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,o.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,o.ID),n.emissiveMap!==void 0&&(n.emissiveMap.colorSpace=Ta);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,o.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,o.ID),n.envMap!==void 0&&(n.envMap.mapping=PM,n.envMap.colorSpace=Ta);break;case"SpecularColor":n.specularMap=a.getTexture(t,o.ID),n.specularMap!==void 0&&(n.specularMap.colorSpace=Ta);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,o.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",s);break}}),n}getTexture(e,t){return"LayeredTexture"in _r.Objects&&t in _r.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Oi.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in _r.Objects){let i=_r.Objects.Deformer;for(let n in i){let a=i[n],o=Oi.get(parseInt(n));if(a.attrType==="Skin"){let s=this.parseSkeleton(o,i);s.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=o.parents[0].ID,e[n]=s}else if(a.attrType==="BlendShape"){let s={id:n};s.rawTargets=this.parseMorphTargets(o,i),s.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=s}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let i=[];return e.children.forEach(function(n){let a=t[n.ID];if(a.attrType!=="Cluster")return;let o={ID:n.ID,indices:[],weights:[],transformLink:new Ht().fromArray(a.TransformLink.a)};"Indexes"in a&&(o.indices=a.Indexes.a,o.weights=a.Weights.a),i.push(o)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){let i=[];for(let n=0;n<e.children.length;n++){let a=e.children[n],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;s.geoID=Oi.get(parseInt(a.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,i.push(s)}return i}parseScene(e,t,i){Ea=new _c;let n=this.parseModels(e.skeletons,t,i),a=_r.Objects.Model,o=this;n.forEach(function(l){let u=a[l.ID];o.setLookAtProperties(l,u),Oi.get(l.ID).parents.forEach(function(f){let h=n.get(f.ID);h!==void 0&&h.add(l)}),l.parent===null&&Ea.add(l)}),this.bindSkeleton(e.skeletons,t,n),this.addGlobalSceneSettings(),Ea.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);let u=Cse(l.userData.transformData);l.applyMatrix4(u),l.updateWorldMatrix()}});let s=new Jk().parse();Ea.children.length===1&&Ea.children[0].isGroup&&(Ea.children[0].animations=s,Ea=Ea.children[0]),Ea.animations=s}parseModels(e,t,i){let n=new Map,a=_r.Objects.Model;for(let o in a){let s=parseInt(o),l=a[o],u=Oi.get(s),c=this.buildSkeleton(u,e,s,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,i);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new y0;break;case"Null":default:c=new _c;break}c.name=l.attrName?ii.sanitizeNodeName(l.attrName):"",c.userData.originalName=l.attrName,c.ID=s}this.getTransformData(c,l),n.set(s,c)}return n}buildSkeleton(e,t,i,n){let a=null;return e.parents.forEach(function(o){for(let s in t){let l=t[s];l.rawBones.forEach(function(u,c){if(u.ID===o.ID){let f=a;a=new y0,a.matrixWorld.copy(u.transformLink),a.name=n?ii.sanitizeNodeName(n):"",a.userData.originalName=n,a.ID=i,l.bones[c]=a,f!==null&&a.add(f)}})}}),a}createCamera(e){let t,i;if(e.children.forEach(function(n){let a=_r.Objects.NodeAttribute[n.ID];a!==void 0&&(i=a)}),i===void 0)t=new ia;else{let n=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(n=1);let a=1;i.NearPlane!==void 0&&(a=i.NearPlane.value/1e3);let o=1e3;i.FarPlane!==void 0&&(o=i.FarPlane.value/1e3);let s=window.innerWidth,l=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(s=i.AspectWidth.value,l=i.AspectHeight.value);let u=s/l,c=45;i.FieldOfView!==void 0&&(c=i.FieldOfView.value);let f=i.FocalLength?i.FocalLength.value:null;switch(n){case 0:t=new Nn(c,u,a,o),f!==null&&t.setFocalLength(f);break;case 1:t=new g0(-s/2,s/2,l/2,-l/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new ia;break}}return t}createLight(e){let t,i;if(e.children.forEach(function(n){let a=_r.Objects.NodeAttribute[n.ID];a!==void 0&&(i=a)}),i===void 0)t=new ia;else{let n;i.LightType===void 0?n=0:n=i.LightType.value;let a=16777215;i.Color!==void 0&&(a=new tr().fromArray(i.Color.value).convertSRGBToLinear());let o=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(o=0);let s=0;i.FarAttenuationEnd!==void 0&&(i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?s=0:s=i.FarAttenuationEnd.value);let l=1;switch(n){case 0:t=new GM(a,o,s,l);break;case 1:t=new DR(a,o);break;case 2:let u=Math.PI/3;i.InnerAngle!==void 0&&(u=na.degToRad(i.InnerAngle.value));let c=0;i.OuterAngle!==void 0&&(c=na.degToRad(i.OuterAngle.value),c=Math.max(c,1)),t=new PR(a,o,s,u,c,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new GM(a,o);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,i){let n,a=null,o=null,s=[];return e.children.forEach(function(l){t.has(l.ID)&&(a=t.get(l.ID)),i.has(l.ID)&&s.push(i.get(l.ID))}),s.length>1?o=s:s.length>0?o=s[0]:(o=new _0({name:gm.DEFAULT_MATERIAL_NAME,color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach(function(l){l.vertexColors=!0}),a.FBX_Deformer?(n=new xR(a,o),n.normalizeSkinWeights()):n=new co(a,o),n}createCurve(e,t){let i=e.children.reduce(function(a,o){return t.has(o.ID)&&(a=t.get(o.ID)),a},null),n=new zM({name:gm.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new MR(i,n)}getTransformData(e,t){let i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=Rse(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&Oi.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){let a=_r.Objects.Model[n.ID];if("Lcl_Translation"in a){let o=a.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Ea.add(e.target)):e.lookAt(new ye().fromArray(o))}}})}bindSkeleton(e,t,i){let n=this.parsePoseNodes();for(let a in e){let o=e[a];Oi.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){let u=l.ID;Oi.get(u).parents.forEach(function(f){i.has(f.ID)&&i.get(f.ID).bind(new SR(o.bones),n[f.ID])})}})}}parsePoseNodes(){let e={};if("Pose"in _r.Objects){let t=_r.Objects.Pose;for(let i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){let n=t[i].PoseNode;Array.isArray(n)?n.forEach(function(a){e[a.Node]=new Ht().fromArray(a.Matrix.a)}):e[n.Node]=new Ht().fromArray(n.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in _r){if("AmbientColor"in _r.GlobalSettings){let e=_r.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],n=e[2];if(t!==0||i!==0||n!==0){let a=new tr(t,i,n).convertSRGBToLinear();Ea.add(new IR(a,1))}}"UnitScaleFactor"in _r.GlobalSettings&&(Ea.userData.unitScaleFactor=_r.GlobalSettings.UnitScaleFactor.value)}}},Kk=class{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if("Geometry"in _r.Objects){let i=_r.Objects.Geometry;for(let n in i){let a=Oi.get(parseInt(n)),o=this.parseGeometry(a,i[n],e);t.set(parseInt(n),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){let n=i.skeletons,a=[],o=e.parents.map(function(f){return _r.Objects.Model[f.ID]});if(o.length===0)return;let s=e.children.reduce(function(f,h){return n[h.ID]!==void 0&&(f=n[h.ID]),f},null);e.children.forEach(function(f){i.morphTargets[f.ID]!==void 0&&a.push(i.morphTargets[f.ID])});let l=o[0],u={};"RotationOrder"in l&&(u.eulerOrder=Rse(l.RotationOrder.value)),"InheritType"in l&&(u.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(u.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(u.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(u.scale=l.GeometricScaling.value);let c=Cse(u);return this.genGeometry(t,s,a,c)}genGeometry(e,t,i,n){let a=new Ls;e.attrName&&(a.name=e.attrName);let o=this.parseGeoNode(e,t),s=this.genBuffers(o),l=new Un(s.vertex,3);if(l.applyMatrix4(n),a.setAttribute("position",l),s.colors.length>0&&a.setAttribute("color",new Un(s.colors,3)),t&&(a.setAttribute("skinIndex",new m0(s.weightsIndices,4)),a.setAttribute("skinWeight",new Un(s.vertexWeights,4)),a.FBX_Deformer=t),s.normal.length>0){let u=new dr().getNormalMatrix(n),c=new Un(s.normal,3);c.applyNormalMatrix(u),a.setAttribute("normal",c)}if(s.uvs.forEach(function(u,c){let f=c===0?"uv":`uv${c}`;a.setAttribute(f,new Un(s.uvs[c],2))}),o.material&&o.material.mappingType!=="AllSame"){let u=s.materialIndex[0],c=0;if(s.materialIndex.forEach(function(f,h){f!==u&&(a.addGroup(c,h-c,u),u=f,c=h)}),a.groups.length>0){let f=a.groups[a.groups.length-1],h=f.start+f.count;h!==s.materialIndex.length&&a.addGroup(h,s.materialIndex.length-h,u)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(a,e,i,n),a}parseGeoNode(e,t){let i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let n=0;for(;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(n,a){n.indices.forEach(function(o,s){i.weightTable[o]===void 0&&(i.weightTable[o]=[]),i.weightTable[o].push({id:a,weight:n.weights[s]})})})),i}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},i=0,n=0,a=!1,o=[],s=[],l=[],u=[],c=[],f=[],h=this;return e.vertexIndices.forEach(function(p,d){let g,m=!1;p<0&&(p=p^-1,m=!0);let v=[],_=[];if(o.push(p*3,p*3+1,p*3+2),e.color){let y=VR(d,i,p,e.color);l.push(y[0],y[1],y[2])}if(e.skeleton){if(e.weightTable[p]!==void 0&&e.weightTable[p].forEach(function(y){_.push(y.weight),v.push(y.id)}),_.length>4){a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0);let y=[0,0,0,0],x=[0,0,0,0];_.forEach(function(M,S){let w=M,T=v[S];x.forEach(function(C,b,E){if(w>C){E[b]=w,w=C;let I=y[b];y[b]=T,T=I}})}),v=y,_=x}for(;_.length<4;)_.push(0),v.push(0);for(let y=0;y<4;++y)c.push(_[y]),f.push(v[y])}if(e.normal){let y=VR(d,i,p,e.normal);s.push(y[0],y[1],y[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=VR(d,i,p,e.material)[0],g<0&&(h.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(y,x){let M=VR(d,i,p,y);u[x]===void 0&&(u[x]=[]),u[x].push(M[0]),u[x].push(M[1])}),n++,m&&(h.genFace(t,e,o,g,s,l,u,c,f,n),i++,n=0,o=[],s=[],l=[],u=[],c=[],f=[])}),t}getNormalNewell(e){let t=new ye(0,0,0);for(let i=0;i<e.length;i++){let n=e[i],a=e[(i+1)%e.length];t.x+=(n.y-a.y)*(n.z+a.z),t.y+=(n.z-a.z)*(n.x+a.x),t.z+=(n.x-a.x)*(n.y+a.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new ye(0,1,0):new ye(0,0,1)).cross(t).normalize(),a=t.clone().cross(n).normalize();return{normal:t,tangent:n,bitangent:a}}flattenVertex(e,t,i){return new yr(e.dot(t),e.dot(i))}genFace(e,t,i,n,a,o,s,l,u,c){let f;if(c>3){let h=[];for(let m=0;m<i.length;m+=3)h.push(new ye(t.vertexPositions[i[m]],t.vertexPositions[i[m+1]],t.vertexPositions[i[m+2]]));let{tangent:p,bitangent:d}=this.getNormalTangentAndBitangent(h),g=[];for(let m of h)g.push(this.flattenVertex(m,p,d));f=wR.triangulateShape(g,[])}else f=[[0,1,2]];for(let[h,p,d]of f)e.vertex.push(t.vertexPositions[i[h*3]]),e.vertex.push(t.vertexPositions[i[h*3+1]]),e.vertex.push(t.vertexPositions[i[h*3+2]]),e.vertex.push(t.vertexPositions[i[p*3]]),e.vertex.push(t.vertexPositions[i[p*3+1]]),e.vertex.push(t.vertexPositions[i[p*3+2]]),e.vertex.push(t.vertexPositions[i[d*3]]),e.vertex.push(t.vertexPositions[i[d*3+1]]),e.vertex.push(t.vertexPositions[i[d*3+2]]),t.skeleton&&(e.vertexWeights.push(l[h*4]),e.vertexWeights.push(l[h*4+1]),e.vertexWeights.push(l[h*4+2]),e.vertexWeights.push(l[h*4+3]),e.vertexWeights.push(l[p*4]),e.vertexWeights.push(l[p*4+1]),e.vertexWeights.push(l[p*4+2]),e.vertexWeights.push(l[p*4+3]),e.vertexWeights.push(l[d*4]),e.vertexWeights.push(l[d*4+1]),e.vertexWeights.push(l[d*4+2]),e.vertexWeights.push(l[d*4+3]),e.weightsIndices.push(u[h*4]),e.weightsIndices.push(u[h*4+1]),e.weightsIndices.push(u[h*4+2]),e.weightsIndices.push(u[h*4+3]),e.weightsIndices.push(u[p*4]),e.weightsIndices.push(u[p*4+1]),e.weightsIndices.push(u[p*4+2]),e.weightsIndices.push(u[p*4+3]),e.weightsIndices.push(u[d*4]),e.weightsIndices.push(u[d*4+1]),e.weightsIndices.push(u[d*4+2]),e.weightsIndices.push(u[d*4+3])),t.color&&(e.colors.push(o[h*3]),e.colors.push(o[h*3+1]),e.colors.push(o[h*3+2]),e.colors.push(o[p*3]),e.colors.push(o[p*3+1]),e.colors.push(o[p*3+2]),e.colors.push(o[d*3]),e.colors.push(o[d*3+1]),e.colors.push(o[d*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[h*3]),e.normal.push(a[h*3+1]),e.normal.push(a[h*3+2]),e.normal.push(a[p*3]),e.normal.push(a[p*3+1]),e.normal.push(a[p*3+2]),e.normal.push(a[d*3]),e.normal.push(a[d*3+1]),e.normal.push(a[d*3+2])),t.uv&&t.uv.forEach(function(g,m){e.uvs[m]===void 0&&(e.uvs[m]=[]),e.uvs[m].push(s[m][h*2]),e.uvs[m].push(s[m][h*2+1]),e.uvs[m].push(s[m][p*2]),e.uvs[m].push(s[m][p*2+1]),e.uvs[m].push(s[m][d*2]),e.uvs[m].push(s[m][d*2+1])})}addMorphTargets(e,t,i,n){if(i.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];let a=this;i.forEach(function(o){o.rawTargets.forEach(function(s){let l=_r.Objects.Geometry[s.geoID];l!==void 0&&a.genMorphGeometry(e,t,l,n,s.name)})})}genMorphGeometry(e,t,i,n,a){let o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],s=i.Vertices!==void 0?i.Vertices.a:[],l=i.Indexes!==void 0?i.Indexes.a:[],u=e.attributes.position.count*3,c=new Float32Array(u);for(let d=0;d<l.length;d++){let g=l[d]*3;c[g]=s[d*3],c[g+1]=s[d*3+1],c[g+2]=s[d*3+2]}let f={vertexIndices:o,vertexPositions:c},h=this.genBuffers(f),p=new Un(h.vertex,3);p.name=a||i.attrName,p.applyMatrix4(n),e.morphAttributes.position.push(p)}parseNormals(e){let t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Normals.a,a=[];return i==="IndexToDirect"&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:i}}parseUVs(e){let t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.UV.a,a=[];return i==="IndexToDirect"&&(a=e.UVIndex.a),{dataSize:2,buffer:n,indices:a,mappingType:t,referenceType:i}}parseVertexColors(e){let t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Colors.a,a=[];i==="IndexToDirect"&&(a=e.ColorIndex.a);for(let o=0,s=new tr;o<n.length;o+=4)s.fromArray(n,o).convertSRGBToLinear().toArray(n,o);return{dataSize:4,buffer:n,indices:a,mappingType:t,referenceType:i}}parseMaterialIndices(e){let t=e.MappingInformationType,i=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};let n=e.Materials.a,a=[];for(let o=0;o<n.length;++o)a.push(o);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:i}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Ls;let i=t-1,n=e.KnotVector.a,a=[],o=e.Points.a;for(let f=0,h=o.length;f<h;f+=4)a.push(new Rr().fromArray(o,f));let s,l;if(e.Form==="Closed")a.push(a[0]);else if(e.Form==="Periodic"){s=i,l=n.length-1-s;for(let f=0;f<i;++f)a.push(a[f])}let c=new kR(i,n,a,s,l).getPoints(a.length*12);return new Ls().setFromPoints(c)}},Jk=class{parse(){let e=[],t=this.parseClips();if(t!==void 0)for(let i in t){let n=t[i],a=this.addClip(n);e.push(a)}return e}parseClips(){if(_r.Objects.AnimationCurve===void 0)return;let e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);let t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){let e=_r.Objects.AnimationCurveNode,t=new Map;for(let i in e){let n=e[i];if(n.attrName.match(/S|R|T|DeformPercent/)!==null){let a={id:n.id,attr:n.attrName,curves:{}};t.set(a.id,a)}}return t}parseAnimationCurves(e){let t=_r.Objects.AnimationCurve;for(let i in t){let n={id:t[i].id,times:t[i].KeyTime.a.map(JOe),values:t[i].KeyValueFloat.a},a=Oi.get(n.id);if(a!==void 0){let o=a.parents[0].ID,s=a.parents[0].relationship;s.match(/X/)?e.get(o).curves.x=n:s.match(/Y/)?e.get(o).curves.y=n:s.match(/Z/)?e.get(o).curves.z=n:s.match(/DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=n)}}}parseAnimationLayers(e){let t=_r.Objects.AnimationLayer,i=new Map;for(let n in t){let a=[],o=Oi.get(parseInt(n));o!==void 0&&(o.children.forEach(function(l,u){if(e.has(l.ID)){let c=e.get(l.ID);if(c.curves.x!==void 0||c.curves.y!==void 0||c.curves.z!==void 0){if(a[u]===void 0){let f=Oi.get(l.ID).parents.filter(function(h){return h.relationship!==void 0})[0].ID;if(f!==void 0){let h=_r.Objects.Model[f.toString()];if(h===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}let p={modelName:h.attrName?ii.sanitizeNodeName(h.attrName):"",ID:h.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Ea.traverse(function(d){d.ID===h.id&&(p.transform=d.matrix,d.userData.transformData&&(p.eulerOrder=d.userData.transformData.eulerOrder))}),p.transform||(p.transform=new Ht),"PreRotation"in h&&(p.preRotation=h.PreRotation.value),"PostRotation"in h&&(p.postRotation=h.PostRotation.value),a[u]=p}}a[u]&&(a[u][c.attr]=c)}else if(c.curves.morph!==void 0){if(a[u]===void 0){let f=Oi.get(l.ID).parents.filter(function(v){return v.relationship!==void 0})[0].ID,h=Oi.get(f).parents[0].ID,p=Oi.get(h).parents[0].ID,d=Oi.get(p).parents[0].ID,g=_r.Objects.Model[d],m={modelName:g.attrName?ii.sanitizeNodeName(g.attrName):"",morphName:_r.Objects.Deformer[f].attrName};a[u]=m}a[u][c.attr]=c}}}),i.set(parseInt(n),a))}return i}parseAnimStacks(e){let t=_r.Objects.AnimationStack,i={};for(let n in t){let a=Oi.get(parseInt(n)).children;a.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");let o=e.get(a[0].ID);i[n]={name:t[n].attrName,layer:o}}return i}addClip(e){let t=[],i=this;return e.layer.forEach(function(n){t=t.concat(i.generateTracks(n))}),new AR(e.name,-1,t)}generateTracks(e){let t=[],i=new ye,n=new ye;if(e.transform&&e.transform.decompose(i,new On,n),i=i.toArray(),n=n.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){let a=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");a!==void 0&&t.push(a)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let a=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);a!==void 0&&t.push(a)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let a=this.generateVectorTrack(e.modelName,e.S.curves,n,"scale");a!==void 0&&t.push(a)}if(e.DeformPercent!==void 0){let a=this.generateMorphTrack(e);a!==void 0&&t.push(a)}return t}generateVectorTrack(e,t,i,n){let a=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(a,t,i);return new Wh(e+"."+n,a,o)}generateRotationTrack(e,t,i,n,a){let o,s;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let f=this.interpolateRotations(t.x,t.y,t.z,a);o=f[0],s=f[1]}i!==void 0&&(i=i.map(na.degToRad),i.push(a),i=new zn().fromArray(i),i=new On().setFromEuler(i)),n!==void 0&&(n=n.map(na.degToRad),n.push(a),n=new zn().fromArray(n),n=new On().setFromEuler(n).invert());let l=new On,u=new zn,c=[];if(!s||!o)return new pu(e+".quaternion",[],[]);for(let f=0;f<s.length;f+=3)u.set(s[f],s[f+1],s[f+2],a),l.setFromEuler(u),i!==void 0&&l.premultiply(i),n!==void 0&&l.multiply(n),f>2&&new On().fromArray(c,(f-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(c,f/3*4);return new pu(e+".quaternion",o,c)}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,i=t.values.map(function(a){return a/100}),n=Ea.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Gh(e.modelName+".morphTargetInfluences["+n+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,n){return i-n}),t.length>1){let i=1,n=t[0];for(let a=1;a<t.length;a++){let o=t[a];o!==n&&(t[i]=o,n=o,i++)}t=t.slice(0,i)}return t}getKeyframeTrackValues(e,t,i){let n=i,a=[],o=-1,s=-1,l=-1;return e.forEach(function(u){if(t.x&&(o=t.x.times.indexOf(u)),t.y&&(s=t.y.times.indexOf(u)),t.z&&(l=t.z.times.indexOf(u)),o!==-1){let c=t.x.values[o];a.push(c),n[0]=c}else a.push(n[0]);if(s!==-1){let c=t.y.values[s];a.push(c),n[1]=c}else a.push(n[1]);if(l!==-1){let c=t.z.values[l];a.push(c),n[2]=c}else a.push(n[2])}),a}interpolateRotations(e,t,i,n){let a=[],o=[];a.push(e.times[0]),o.push(na.degToRad(e.values[0])),o.push(na.degToRad(t.values[0])),o.push(na.degToRad(i.values[0]));for(let s=1;s<e.values.length;s++){let l=[e.values[s-1],t.values[s-1],i.values[s-1]];if(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))continue;let u=l.map(na.degToRad),c=[e.values[s],t.values[s],i.values[s]];if(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))continue;let f=c.map(na.degToRad),h=[c[0]-l[0],c[1]-l[1],c[2]-l[2]],p=[Math.abs(h[0]),Math.abs(h[1]),Math.abs(h[2])];if(p[0]>=180||p[1]>=180||p[2]>=180){let g=Math.max(...p)/180,m=new zn(...u,n),v=new zn(...f,n),_=new On().setFromEuler(m),y=new On().setFromEuler(v);_.dot(y)&&y.set(-y.x,-y.y,-y.z,-y.w);let x=e.times[s-1],M=e.times[s]-x,S=new On,w=new zn;for(let T=0;T<1;T+=1/g)S.copy(_.clone().slerp(y.clone(),T)),a.push(x+T*M),w.setFromQuaternion(S,n),o.push(w.x),o.push(w.y),o.push(w.z)}else a.push(e.times[s]),o.push(na.degToRad(e.values[s])),o.push(na.degToRad(t.values[s])),o.push(na.degToRad(i.values[s]))}return[a,o]}},$k=class{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new WR,this.nodeStack=[],this.currentProp=[],this.currentPropName="";let t=this,i=e.split(/[\r\n]+/);return i.forEach(function(n,a){let o=n.match(/^[\s\t]*;/),s=n.match(/^[\s\t]*$/);if(o||s)return;let l=n.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),u=n.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),c=n.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(n,l):u?t.parseNodeProperty(n,u,i[++a]):c?t.popStack():n.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(n)}),this.allNodes}parseNodeBegin(e,t){let i=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),a={name:i},o=this.parseNodeAttr(n),s=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,a):i in s?(i==="PoseNode"?s.PoseNode.push(a):s[i].id!==void 0&&(s[i]={},s[i][s[i].id]=s[i]),o.id!==""&&(s[i][o.id]=a)):typeof o.id=="number"?(s[i]={},s[i][o.id]=a):i!=="Properties70"&&(i==="PoseNode"?s[i]=[a]:s[i]=a),typeof o.id=="number"&&(a.id=o.id),o.name!==""&&(a.attrName=o.name),o.type!==""&&(a.attrType=o.type),this.pushStack(a)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",n="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:i,type:n}}parseNodeProperty(e,t,i){let n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),a=t[2].replace(/^"/,"").replace(/"$/,"").trim();n==="Content"&&a===","&&(a=i.replace(/"/g,"").replace(/,$/,"").trim());let o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,n,a);return}if(n==="C"){let l=a.split(",").slice(1),u=parseInt(l[0]),c=parseInt(l[1]),f=a.split(",").slice(3);f=f.map(function(h){return h.trim().replace(/^"/,"")}),n="connections",a=[u,c],QOe(a,f),o[n]===void 0&&(o[n]=[])}n==="Node"&&(o.id=a),n in o&&Array.isArray(o[n])?o[n].push(a):n!=="a"?o[n]=a:o.a=a,this.setCurrentProp(o,n),n==="a"&&a.slice(-1)!==","&&(o.a=Zk(a))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Zk(t.a))}parseNodeSpecialProperty(e,t,i){let n=i.split('",').map(function(c){return c.trim().replace(/^\"/,"").replace(/\s/,"_")}),a=n[0],o=n[1],s=n[2],l=n[3],u=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=Zk(u);break}this.getPrevNode()[a]={type:o,type2:s,flag:l,value:u},this.setCurrentProp(this.getPrevNode(),a)}},Qk=class{parse(e){let t=new HR(e);t.skip(23);let i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);let n=new WR;for(;!this.endOfContent(t);){let a=this.parseNode(t,i);a!==null&&n.add(a.name,a)}return n}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let i={},n=t>=7500?e.getUint64():e.getUint32(),a=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let o=e.getUint8(),s=e.getString(o);if(n===0)return null;let l=[];for(let h=0;h<a;h++)l.push(this.parseProperty(e));let u=l.length>0?l[0]:"",c=l.length>1?l[1]:"",f=l.length>2?l[2]:"";for(i.singleProperty=a===1&&e.getOffset()===n;n>e.getOffset();){let h=this.parseNode(e,t);h!==null&&this.parseSubNode(s,i,h)}return i.propertyList=l,typeof u=="number"&&(i.id=u),c!==""&&(i.attrName=c),f!==""&&(i.attrType=f),s!==""&&(i.name=s),i}parseSubNode(e,t,i){if(i.singleProperty===!0){let n=i.propertyList[0];Array.isArray(n)?(t[i.name]=i,i.a=n):t[i.name]=n}else if(e==="Connections"&&i.name==="C"){let n=[];i.propertyList.forEach(function(a,o){o!==0&&n.push(a)}),t.connections===void 0&&(t.connections=[]),t.connections.push(n)}else if(i.name==="Properties70")Object.keys(i).forEach(function(a){t[a]=i[a]});else if(e==="Properties70"&&i.name==="P"){let n=i.propertyList[0],a=i.propertyList[1],o=i.propertyList[2],s=i.propertyList[3],l;n.indexOf("Lcl ")===0&&(n=n.replace("Lcl ","Lcl_")),a.indexOf("Lcl ")===0&&(a=a.replace("Lcl ","Lcl_")),a==="Color"||a==="ColorRGB"||a==="Vector"||a==="Vector3D"||a.indexOf("Lcl_")===0?l=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:l=i.propertyList[4],t[n]={type:a,type2:o,flag:s,value:l}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){let t=e.getString(1),i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":let n=e.getUint32(),a=e.getUint32(),o=e.getUint32();if(a===0)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}let s=bse(new Uint8Array(e.getArrayBuffer(o))),l=new HR(s.buffer);switch(t){case"b":case"c":return l.getBooleanArray(n);case"d":return l.getFloat64Array(n);case"f":return l.getFloat32Array(n);case"i":return l.getInt32Array(n);case"l":return l.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},HR=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){let t=[];for(let i=0;i<e;i++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,i=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let n=i.indexOf(0);return n>=0&&(i=new Uint8Array(this.dv.buffer,t,n)),this._textDecoder.decode(i)}},WR=class{add(e,t){this[e]=t}};function jOe(r){let e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===Lse(r,0,e.length)}function KOe(r){let e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],t=0;function i(n){let a=r[n-1];return r=r.slice(t+n),t++,a}for(let n=0;n<e.length;++n)if(i(1)===e[n])return!1;return!0}function Ase(r){let e=/FBXVersion: (\d+)/,t=r.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function JOe(r){return r/46186158e3}var $Oe=[];function VR(r,e,t,i){let n;switch(i.mappingType){case"ByPolygonVertex":n=r;break;case"ByPolygon":n=e;break;case"ByVertice":n=t;break;case"AllSame":n=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}i.referenceType==="IndexToDirect"&&(n=i.indices[n]);let a=n*i.dataSize,o=a+i.dataSize;return e3e($Oe,i.buffer,a,o)}var qk=new zn,b0=new ye;function Cse(r){let e=new Ht,t=new Ht,i=new Ht,n=new Ht,a=new Ht,o=new Ht,s=new Ht,l=new Ht,u=new Ht,c=new Ht,f=new Ht,h=new Ht,p=r.inheritType?r.inheritType:0;if(r.translation&&e.setPosition(b0.fromArray(r.translation)),r.preRotation){let b=r.preRotation.map(na.degToRad);b.push(r.eulerOrder||zn.DEFAULT_ORDER),t.makeRotationFromEuler(qk.fromArray(b))}if(r.rotation){let b=r.rotation.map(na.degToRad);b.push(r.eulerOrder||zn.DEFAULT_ORDER),i.makeRotationFromEuler(qk.fromArray(b))}if(r.postRotation){let b=r.postRotation.map(na.degToRad);b.push(r.eulerOrder||zn.DEFAULT_ORDER),n.makeRotationFromEuler(qk.fromArray(b)),n.invert()}r.scale&&a.scale(b0.fromArray(r.scale)),r.scalingOffset&&s.setPosition(b0.fromArray(r.scalingOffset)),r.scalingPivot&&o.setPosition(b0.fromArray(r.scalingPivot)),r.rotationOffset&&l.setPosition(b0.fromArray(r.rotationOffset)),r.rotationPivot&&u.setPosition(b0.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(f.copy(r.parentMatrix),c.copy(r.parentMatrixWorld));let d=t.clone().multiply(i).multiply(n),g=new Ht;g.extractRotation(c);let m=new Ht;m.copyPosition(c);let v=m.clone().invert().multiply(c),_=g.clone().invert().multiply(v),y=a,x=new Ht;if(p===0)x.copy(g).multiply(d).multiply(_).multiply(y);else if(p===1)x.copy(g).multiply(_).multiply(d).multiply(y);else{let E=new Ht().scale(new ye().setFromMatrixScale(f)).clone().invert(),I=_.clone().multiply(E);x.copy(g).multiply(d).multiply(I).multiply(y)}let M=u.clone().invert(),S=o.clone().invert(),w=e.clone().multiply(l).multiply(u).multiply(t).multiply(i).multiply(n).multiply(M).multiply(s).multiply(o).multiply(a).multiply(S),T=new Ht().copyPosition(w),C=c.clone().multiply(T);return h.copyPosition(C),w=h.clone().multiply(x),w.premultiply(c.invert()),w}function Rse(r){r=r||0;let e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return r===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[r]}function Zk(r){return r.split(",").map(function(t){return parseFloat(t)})}function Lse(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=r.byteLength),new TextDecoder().decode(new Uint8Array(r,e,t))}function QOe(r,e){for(let t=0,i=r.length,n=e.length;t<n;t++,i++)r[i]=e[t]}function e3e(r,e,t,i){for(let n=t,a=0;n<i;n++,a++)r[a]=e[n];return r}var t3e=["Three"],r3e=new MS,Pse,Ise=(()=>{let e=class e{constructor(){this.http=aa(Dc),this.modal=aa(Pc),this.titleService=aa(KM),this.animate=()=>{requestAnimationFrame(this.animate);let i=r3e.getDelta();Pse&&Pse.update(i),this.renderer.render(this.scene,this.camera)}}ngOnInit(){this.titleService.setTitle("\u91CD\u78C53D"),this.initThreeJs(),this.animate()}initThreeJs(){this.camera=new Vi(40,window.innerWidth/window.innerHeight,1,2e4),this.camera.position.set(2200,300,-3100),this.scene=new _S,this.scene.background=new ir(263446);let i=new xS(16777215,4473924,5);i.position.set(0,200,0),this.scene.add(i);let n=new SS(16777215,5);n.position.set(0,200,100),n.castShadow=!0,n.shadow.camera.top=180,n.shadow.camera.bottom=-100,n.shadow.camera.left=-120,n.shadow.camera.right=120,this.scene.add(n);let a=this;new GR().load("assets/fbx/bb.fbx",function(p){p.traverse(function(d){}),a.scene.add(p)},p=>{},p=>{console.error("An error happened",p)}),this.renderer=new yS({antialias:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.shadowMap.enabled=!0,this.container.nativeElement.appendChild(this.renderer.domElement);let s=5,l=32,u=new zA(s,l),c=new ec({color:16711680}),f=new rn(u,c);f.position.set(850,100,-2e3),this.scene.add(f);let h=new Dse.OrbitControls(this.camera,this.renderer.domElement);h.target.set(850,100,-2e3),h.update(),window.addEventListener("resize",this.onWindowResize)}render(){this.cube.rotation.x+=.01,this.cube.rotation.y+=.01,this.renderer.render(this.scene,this.camera)}onWindowResize(){this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.updateProjectionMatrix(),this.renderer.setSize(window.innerWidth,window.innerHeight)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["app-data-v-t1"]],viewQuery:function(n,a){if(n&1&&Tc(t3e,7),n&2){let o;oa(o=sa())&&(a.container=o.first)}},standalone:!0,features:[ui],decls:3,vars:0,consts:[[2,"display","flex","flex-direction","column","height","100vh"],[2,"flex-grow","1"],["Three",""]],template:function(n,a){n&1&&(Jt(0,"div",0),Yr(1,"div",1,2),nr())},dependencies:[Nc,Uc,$c,Yc,ef,tf,Qc,Kc,Ic,Hc,Xc,of,jc,qc,wl,Cc,Vc,Gc,rf,af,Bc,Tl,Zc,Fc,Wc,kc,nf,Lc,Rc,Jc,zc,Ac,Oc,bl],encapsulation:2});let r=e;return r})();var Nse=(()=>{let e=class e{constructor(){this.http=aa(Dc),this.modal=aa(Pc)}ngOnInit(){}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=li({type:e,selectors:[["app-data-v-threejs"]],standalone:!0,features:[ui],decls:1,vars:0,consts:[["src","http://112.33.111.160:8083/","width","100%","height","650px",2,"border","0"]],template:function(n,a){n&1&&Yr(0,"iframe",0)},dependencies:[Nc,Uc,$c,Yc,ef,tf,Qc,Kc,Ic,Hc,Xc,of,jc,qc,wl,Cc,Vc,Gc,rf,af,Bc,Tl,Zc,Fc,Wc,kc,nf,Lc,Rc,Jc,zc,Ac,Oc,bl]});let r=e;return r})();var NDt=[{path:"s1/:id",component:M$,data:{menu:null}},{path:"second1/:id",component:b$,data:{menu:null}},{path:"threejs/:id",component:Nse},{path:"t1/:id",component:Ise},{path:"lj-table",component:nL},{path:"lj-table",component:nL}];export{NDt as routes};