import{b as jL,c as VV,d as GV,e as kb}from"./chunk-QH2ADUYX.js";import{$a as oo,A as Va,Aa as ch,Ba as hh,C as Ga,Ca as fn,Ga as $a,Ia as eo,La as to,Pa as ro,Sa as io,Ua as no,V as Ha,W as OV,X as zV,Xa as ao,_ as Wa,aa as Rm,b as Fb,ba as FV,bb as so,ca as Yn,cb as BV,db as qn,e as Fa,fb as lo,gb as kV,hb as uo,jb as co,kb as Bb,la as Xa,pa as Ya,ra as qa,ta as Za,u as Ba,ua as ja,v as ka,wa as Ka,y as UV,ya as Ja}from"./chunk-WD6SV3WH.js";import{$ as bV,Ab as Mn,Bb as fi,Cb as pi,D as _V,Db as su,Eb as jt,Fb as bn,Fe as IV,Ga as BL,Ge as Xn,Ha as p_,He as NV,I as xV,Ib as RV,Jb as Ar,Ka as at,Kb as LV,La as ma,Lb as qL,Le as Ua,Ma as Ib,Mb as ZL,Me as Ub,Ne as Ob,Nf as Qa,Oa as kL,Pa as VL,Q as SV,Sb as sp,Ta as gr,U as MV,Va as rt,Wa as TV,Xa as Nb,Ya as EV,Za as AV,a as Rb,ba as zL,cc as d_,cd as PV,db as GL,dc as As,e as jse,eb as HL,f as Kse,fb as WL,g as UL,gb as ht,h as Jse,hb as ot,hf as Oa,i as $se,ia as Db,ib as er,ic as m_,j as Lb,ja as wV,jb as au,kb as ou,la as xn,lb as CV,lf as za,m as vV,na as Er,nc as lh,o as OL,oa as Pb,p as gV,pa as FL,qb as XL,ra as sh,sb as Dr,tb as Sn,tf as zb,u as f_,ub as ni,vb as op,vf as uh,w as yV,xd as v_,xf as lu,yb as YL,yc as DV,zb as Qu}from"./chunk-VDRVUQCF.js";var Fse={};UL(Fse,{AddEquation:()=>Hk,AddOperation:()=>qoe,AdditiveBlending:()=>Bk,AlphaFormat:()=>nse,AlwaysDepth:()=>koe,AmbientLight:()=>cL,AnimationClip:()=>Ss,AnimationMixer:()=>fV,AnimationObjectGroup:()=>Ek,AnimationUtils:()=>ha,ArcCurve:()=>ML,ArrowHelper:()=>Tm,Audio:()=>q0,AudioAnalyser:()=>hV,AudioContext:()=>uV,AudioListener:()=>wk,AudioLoader:()=>cV,AxisHelper:()=>SL,BackSide:()=>jf,BasicDepthPacking:()=>yse,BasicShadowMap:()=>FIe,BinaryTextureLoader:()=>rV,BlendingMode:()=>Aoe,Bone:()=>eL,BooleanKeyframeTrack:()=>mL,BoundingBoxHelper:()=>f3e,Box2:()=>BM,Box3:()=>Zu,BoxBufferGeometry:()=>lm,BoxGeometry:()=>db,BoxHelper:()=>i_,BufferAttribute:()=>Mt,BufferGeometry:()=>Vt,BufferGeometryLoader:()=>nV,ByteType:()=>$oe,Cache:()=>Mk,Camera:()=>pa,CameraHelper:()=>bb,CanvasRenderer:()=>_3e,CanvasTexture:()=>iL,CatmullRomCurve3:()=>pV,CineonToneMapping:()=>Koe,CircleBufferGeometry:()=>G0,CircleGeometry:()=>pb,ClampToEdgeWrapping:()=>Ms,Clock:()=>Dk,ClosedSplineCurve3:()=>zse,Color:()=>Wt,ColorKeyframeTrack:()=>vL,CompressedTexture:()=>C0,CompressedTextureLoader:()=>Dse,ConeBufferGeometry:()=>fb,ConeGeometry:()=>hb,CubeCamera:()=>gL,CubeGeometry:()=>db,CubeReflectionMapping:()=>TL,CubeRefractionMapping:()=>ZR,CubeTexture:()=>Kf,CubeTextureLoader:()=>iV,CubeUVReflectionMapping:()=>EL,CubeUVRefractionMapping:()=>AL,CubicBezierCurve:()=>Mm,CubicBezierCurve3:()=>VOe,CubicInterpolant:()=>hL,CullFaceBack:()=>PM,CullFaceFront:()=>Nk,CullFaceFrontBack:()=>OIe,CullFaceNone:()=>woe,Curve:()=>da,CurvePath:()=>yb,CurveUtils:()=>Ab,CustomBlending:()=>Gk,CylinderBufferGeometry:()=>ih,CylinderGeometry:()=>dm,Cylindrical:()=>Ik,DataTexture:()=>sm,DataTextureLoader:()=>FOe,DefaultLoadingManager:()=>Ts,DepthFormat:()=>tm,DepthStencilFormat:()=>S0,DepthTexture:()=>KM,DirectionalLight:()=>uL,DirectionalLightHelper:()=>r_,DirectionalLightShadow:()=>lL,DiscreteInterpolant:()=>fL,DodecahedronBufferGeometry:()=>I0,DodecahedronGeometry:()=>tb,DoubleSide:()=>n_,DstAlphaFactor:()=>Noe,DstColorFactor:()=>Ooe,DynamicBufferAttribute:()=>r3e,EdgesGeometry:()=>V0,EdgesHelper:()=>p3e,EllipseCurve:()=>nh,EqualDepth:()=>Goe,EquirectangularReflectionMapping:()=>qk,EquirectangularRefractionMapping:()=>jR,Euler:()=>ep,EventDispatcher:()=>pl,ExtrudeGeometry:()=>ml,Face3:()=>ws,Face4:()=>XOe,FaceColors:()=>Fk,FaceNormalsHelper:()=>Mb,FileLoader:()=>vl,FlatShading:()=>Ok,Float32Attribute:()=>c3e,Float32BufferAttribute:()=>Mr,Float64Attribute:()=>h3e,Float64BufferAttribute:()=>YM,FloatType:()=>_0,Fog:()=>E0,FogExp2:()=>T0,Font:()=>lV,FontLoader:()=>Ise,FrontFaceDirectionCCW:()=>zIe,FrontFaceDirectionCW:()=>Toe,FrontSide:()=>y0,Frustum:()=>kM,GammaEncoding:()=>$k,Geometry:()=>ur,GeometryIdCount:()=>Qk,GeometryUtils:()=>v3e,GreaterDepth:()=>Woe,GreaterEqualDepth:()=>Hoe,GridHelper:()=>Sb,Group:()=>jM,HalfFloatType:()=>JR,HemisphereLight:()=>nL,HemisphereLightHelper:()=>t_,IcosahedronBufferGeometry:()=>P0,IcosahedronGeometry:()=>eb,ImageLoader:()=>Eb,ImageUtils:()=>g3e,ImmediateRenderObject:()=>_b,InstancedBufferAttribute:()=>K0,InstancedBufferGeometry:()=>wm,InstancedInterleavedBuffer:()=>j0,Int16Attribute:()=>o3e,Int16BufferAttribute:()=>WM,Int32Attribute:()=>l3e,Int32BufferAttribute:()=>XM,Int8Attribute:()=>i3e,Int8BufferAttribute:()=>VM,IntType:()=>ese,InterleavedBuffer:()=>Z0,InterleavedBufferAttribute:()=>Ck,Interpolant:()=>Zo,InterpolateDiscrete:()=>OM,InterpolateLinear:()=>DM,InterpolateSmooth:()=>YR,JSONLoader:()=>aV,KeyframeTrack:()=>xm,LOD:()=>ZM,LatheBufferGeometry:()=>F0,LatheGeometry:()=>cb,Layers:()=>$R,LensFlare:()=>Sk,LessDepth:()=>Voe,LessEqualDepth:()=>qR,Light:()=>Bi,LightShadow:()=>Am,Line:()=>rh,Line3:()=>rm,LineBasicMaterial:()=>Fi,LineCurve:()=>Ku,LineCurve3:()=>HOe,LineDashedMaterial:()=>_m,LinePieces:()=>qOe,LineSegments:()=>yi,LineStrip:()=>YOe,LinearEncoding:()=>FM,LinearFilter:()=>qo,LinearInterpolant:()=>vb,LinearMipMapLinearFilter:()=>Tb,LinearMipMapNearestFilter:()=>jk,LinearToneMapping:()=>Yk,Loader:()=>im,LoadingManager:()=>tV,LogLuvEncoding:()=>kIe,LoopOnce:()=>lse,LoopPingPong:()=>cse,LoopRepeat:()=>use,LuminanceAlphaFormat:()=>ose,LuminanceFormat:()=>ase,MOUSE:()=>UIe,Material:()=>_r,MaterialLoader:()=>DL,Math:()=>fr,Matrix3:()=>dl,Matrix4:()=>Kt,MaxEquation:()=>uk,Mesh:()=>_n,MeshBasicMaterial:()=>jo,MeshDepthMaterial:()=>$f,MeshFaceMaterial:()=>ZOe,MeshLambertMaterial:()=>ym,MeshNormalMaterial:()=>gm,MeshPhongMaterial:()=>nu,MeshPhysicalMaterial:()=>mm,MeshStandardMaterial:()=>ju,MeshToonMaterial:()=>vm,MinEquation:()=>lk,MirroredRepeatWrapping:()=>am,MixOperation:()=>Yoe,MorphBlendMesh:()=>Wn,MultiMaterial:()=>mb,MultiplyBlending:()=>Vk,MultiplyOperation:()=>wb,NearestFilter:()=>bs,NearestMipMapLinearFilter:()=>RL,NearestMipMapNearestFilter:()=>CL,NeverDepth:()=>Boe,NoBlending:()=>IM,NoColors:()=>bL,NoToneMapping:()=>XR,NormalBlending:()=>a_,NotEqualDepth:()=>Xoe,NumberKeyframeTrack:()=>Y0,Object3D:()=>Lt,ObjectLoader:()=>Pse,OctahedronBufferGeometry:()=>fm,OctahedronGeometry:()=>QM,OneFactor:()=>Doe,OneMinusDstAlphaFactor:()=>Uoe,OneMinusDstColorFactor:()=>zoe,OneMinusSrcAlphaFactor:()=>Xk,OneMinusSrcColorFactor:()=>Ioe,OrthographicCamera:()=>w0,PCFShadowMap:()=>Uk,PCFSoftShadowMap:()=>Eoe,ParametricBufferGeometry:()=>L0,ParametricGeometry:()=>JM,Particle:()=>KOe,ParticleBasicMaterial:()=>QOe,ParticleSystem:()=>JOe,ParticleSystemMaterial:()=>e3e,Path:()=>Cb,PerspectiveCamera:()=>ca,Plane:()=>xs,PlaneBufferGeometry:()=>um,PlaneGeometry:()=>ub,PointCloud:()=>jOe,PointCloudMaterial:()=>$Oe,PointLight:()=>sL,PointLightHelper:()=>Q0,Points:()=>A0,PointsMaterial:()=>iu,PolarGridHelper:()=>xL,PolyhedronBufferGeometry:()=>Ko,PolyhedronGeometry:()=>rb,PositionalAudio:()=>Tk,Projector:()=>y3e,PropertyBinding:()=>Ii,PropertyMixer:()=>yL,QuadraticBezierCurve:()=>bm,QuadraticBezierCurve3:()=>GOe,Quaternion:()=>cn,QuaternionKeyframeTrack:()=>gb,QuaternionLinearInterpolant:()=>pL,REVISION:()=>boe,RGBADepthPacking:()=>_se,RGBAFormat:()=>qu,RGBA_PVRTC_2BPPV1_Format:()=>_k,RGBA_PVRTC_4BPPV1_Format:()=>yk,RGBA_S3TC_DXT1_Format:()=>pk,RGBA_S3TC_DXT3_Format:()=>dk,RGBA_S3TC_DXT5_Format:()=>mk,RGBDEncoding:()=>gse,RGBEEncoding:()=>dse,RGBEFormat:()=>BIe,RGBFormat:()=>x0,RGBM16Encoding:()=>vse,RGBM7Encoding:()=>mse,RGB_ETC1_Format:()=>sse,RGB_PVRTC_2BPPV1_Format:()=>gk,RGB_PVRTC_4BPPV1_Format:()=>vk,RGB_S3TC_DXT1_Format:()=>fk,RawShaderMaterial:()=>W0,Ray:()=>Qf,Raycaster:()=>Rk,RectAreaLight:()=>bk,RectAreaLightHelper:()=>e_,ReinhardToneMapping:()=>Zoe,RepeatWrapping:()=>Qc,ReverseSubtractEquation:()=>Roe,RingBufferGeometry:()=>z0,RingGeometry:()=>lb,Scene:()=>cm,SceneUtils:()=>WOe,ShaderChunk:()=>jr,ShaderLib:()=>b0,ShaderMaterial:()=>Na,ShadowMaterial:()=>H0,Shape:()=>nm,ShapeBufferGeometry:()=>B0,ShapeGeometry:()=>k0,ShapePath:()=>sV,ShapeUtils:()=>Hn,ShortType:()=>Qoe,Skeleton:()=>QR,SkeletonHelper:()=>$0,SkinnedMesh:()=>tL,SmoothShading:()=>zk,Sphere:()=>fa,SphereBufferGeometry:()=>pm,SphereGeometry:()=>sb,Spherical:()=>Pk,SphericalReflectionMapping:()=>Zk,Spline:()=>BOe,SplineCurve:()=>Sm,SplineCurve3:()=>kOe,SpotLight:()=>oL,SpotLightHelper:()=>J0,SpotLightShadow:()=>aL,Sprite:()=>qM,SpriteMaterial:()=>hm,SrcAlphaFactor:()=>Wk,SrcAlphaSaturateFactor:()=>Foe,SrcColorFactor:()=>Poe,StereoCamera:()=>Nse,StringKeyframeTrack:()=>dL,SubtractEquation:()=>Coe,SubtractiveBlending:()=>kk,TetrahedronBufferGeometry:()=>D0,TetrahedronGeometry:()=>$M,TextGeometry:()=>ob,Texture:()=>ci,TextureFilter:()=>hk,TextureLoader:()=>LL,TextureMapping:()=>Joe,TextureWrapping:()=>ck,TorusBufferGeometry:()=>O0,TorusGeometry:()=>ab,TorusKnotBufferGeometry:()=>U0,TorusKnotGeometry:()=>nb,Triangle:()=>fl,TriangleFanDrawMode:()=>fse,TriangleStripDrawMode:()=>hse,TrianglesDrawMode:()=>Jk,TubeBufferGeometry:()=>N0,TubeGeometry:()=>ib,UVMapping:()=>wL,Uint16Attribute:()=>s3e,Uint16BufferAttribute:()=>eh,Uint32Attribute:()=>u3e,Uint32BufferAttribute:()=>th,Uint8Attribute:()=>n3e,Uint8BufferAttribute:()=>GM,Uint8ClampedAttribute:()=>a3e,Uint8ClampedBufferAttribute:()=>HM,Uncharted2ToneMapping:()=>joe,Uniform:()=>_L,UniformsLib:()=>dr,UniformsUtils:()=>Yo,UnsignedByteType:()=>KR,UnsignedInt248Type:()=>UM,UnsignedIntType:()=>Kk,UnsignedShort4444Type:()=>tse,UnsignedShort5551Type:()=>rse,UnsignedShort565Type:()=>ise,UnsignedShortType:()=>NM,Vector2:()=>Tt,Vector3:()=>oe,Vector4:()=>ii,VectorKeyframeTrack:()=>X0,Vertex:()=>t3e,VertexColors:()=>Em,VertexNormalsHelper:()=>xb,VideoTexture:()=>rL,WebGLRenderTarget:()=>o_,WebGLRenderTargetCube:()=>M0,WebGLRenderer:()=>eV,WireframeGeometry:()=>R0,WireframeHelper:()=>d3e,WrapAroundEnding:()=>zM,XHRLoader:()=>m3e,ZeroCurvatureEnding:()=>om,ZeroFactor:()=>Loe,ZeroSlopeEnding:()=>em,sRGBEncoding:()=>pse});function pl(){}function Tt(r,e){this.x=r||0,this.y=e||0}function ci(r,e,t,i,n,a,o,s,l,u){Object.defineProperty(this,"id",{value:VIe++}),this.uuid=fr.generateUUID(),this.name="",this.image=r!==void 0?r:ci.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=e!==void 0?e:ci.DEFAULT_MAPPING,this.wrapS=t!==void 0?t:Ms,this.wrapT=i!==void 0?i:Ms,this.magFilter=n!==void 0?n:qo,this.minFilter=a!==void 0?a:Tb,this.anisotropy=l!==void 0?l:1,this.format=o!==void 0?o:qu,this.type=s!==void 0?s:KR,this.offset=new Tt(0,0),this.repeat=new Tt(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u!==void 0?u:FM,this.version=0,this.onUpdate=null}function ii(r,e,t,i){this.x=r||0,this.y=e||0,this.z=t||0,this.w=i!==void 0?i:1}function o_(r,e,t){this.uuid=fr.generateUUID(),this.width=r,this.height=e,this.scissor=new ii(0,0,r,e),this.scissorTest=!1,this.viewport=new ii(0,0,r,e),t=t||{},t.minFilter===void 0&&(t.minFilter=qo),this.texture=new ci(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 M0(r,e,t){o_.call(this,r,e,t),this.activeCubeFace=0,this.activeMipMapLevel=0}function cn(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 Kt(){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 Kf(r,e,t,i,n,a,o,s,l,u){r=r!==void 0?r:[],e=e!==void 0?e:TL,ci.call(this,r,e,t,i,n,a,o,s,l,u),this.flipY=!1}function Mse(){this.seq=[],this.map={}}function s_(r,e,t){var i=r[0];if(i<=0||i>0)return r;var n=e*t,a=voe[n];if(a===void 0&&(a=new Float32Array(n),voe[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 bse(r,e){var t=goe[e];t===void 0&&(t=new Int32Array(e),goe[e]=t);for(var i=0;i!==e;++i)t[i]=r.allocTextureUnit();return t}function GIe(r,e){r.uniform1f(this.addr,e)}function HIe(r,e){r.uniform1i(this.addr,e)}function WIe(r,e){e.x===void 0?r.uniform2fv(this.addr,e):r.uniform2f(this.addr,e.x,e.y)}function XIe(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 YIe(r,e){e.x===void 0?r.uniform4fv(this.addr,e):r.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function qIe(r,e){r.uniformMatrix2fv(this.addr,!1,e.elements||e)}function ZIe(r,e){r.uniformMatrix3fv(this.addr,!1,e.elements||e)}function jIe(r,e){r.uniformMatrix4fv(this.addr,!1,e.elements||e)}function KIe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTexture2D(e||xse,i)}function JIe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTextureCube(e||Sse,i)}function wse(r,e){r.uniform2iv(this.addr,e)}function Tse(r,e){r.uniform3iv(this.addr,e)}function Ese(r,e){r.uniform4iv(this.addr,e)}function $Ie(r){switch(r){case 5126:return GIe;case 35664:return WIe;case 35665:return XIe;case 35666:return YIe;case 35674:return qIe;case 35675:return ZIe;case 35676:return jIe;case 35678:return KIe;case 35680:return JIe;case 5124:case 35670:return HIe;case 35667:case 35671:return wse;case 35668:case 35672:return Tse;case 35669:case 35673:return Ese}}function QIe(r,e){r.uniform1fv(this.addr,e)}function eNe(r,e){r.uniform1iv(this.addr,e)}function tNe(r,e){r.uniform2fv(this.addr,s_(e,this.size,2))}function rNe(r,e){r.uniform3fv(this.addr,s_(e,this.size,3))}function iNe(r,e){r.uniform4fv(this.addr,s_(e,this.size,4))}function nNe(r,e){r.uniformMatrix2fv(this.addr,!1,s_(e,this.size,4))}function aNe(r,e){r.uniformMatrix3fv(this.addr,!1,s_(e,this.size,9))}function oNe(r,e){r.uniformMatrix4fv(this.addr,!1,s_(e,this.size,16))}function sNe(r,e,t){var i=e.length,n=bse(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTexture2D(e[a]||xse,n[a])}function lNe(r,e,t){var i=e.length,n=bse(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTextureCube(e[a]||Sse,n[a])}function uNe(r){switch(r){case 5126:return QIe;case 35664:return tNe;case 35665:return rNe;case 35666:return iNe;case 35674:return nNe;case 35675:return aNe;case 35676:return oNe;case 35678:return sNe;case 35680:return lNe;case 5124:case 35670:return eNe;case 35667:case 35671:return wse;case 35668:case 35672:return Tse;case 35669:case 35673:return Ese}}function cNe(r,e,t){this.id=r,this.addr=t,this.setValue=$Ie(e.type)}function hNe(r,e,t){this.id=r,this.addr=t,this.size=e.size,this.setValue=uNe(e.type)}function Ase(r){this.id=r,Mse.call(this)}function yoe(r,e){r.seq.push(e),r.map[e.id]=e}function fNe(r,e,t){var i=r.name,n=i.length;for(ok.lastIndex=0;;){var a=ok.exec(i),o=ok.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){yoe(t,u===void 0?new cNe(s,r,e):new hNe(s,r,e));break}else{var c=t.map,h=c[s];h===void 0&&(h=new Ase(s),yoe(t,h)),t=h}}}function Jf(r,e,t){Mse.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);fNe(a,s,this)}}function Wt(r,e,t){return e===void 0&&t===void 0?this.set(r):this.setRGB(r,e,t)}function sm(r,e,t,i,n,a,o,s,l,u,c,h){ci.call(this,null,a,o,s,l,u,i,n,c,h),this.image={data:r,width:e,height:t},this.magFilter=l!==void 0?l:bs,this.minFilter=u!==void 0?u:bs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function BM(r,e){this.min=r!==void 0?r:new Tt(1/0,1/0),this.max=e!==void 0?e:new Tt(-1/0,-1/0)}function fOe(r,e){var t=r.context,i=r.state,n,a,o,s,l,u,c,h;function f(){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(),h=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,h),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(` `),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(` `)},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 Tt(M*_,M),w=new oe(1,1,0),T=new Tt(1,1),C=new BM;C.min.set(m.x,m.y),C.max.set(m.x+(m.z-16),m.y+(m.w-16)),s===void 0&&f(),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.001&&P.scale>.001&&(w.x=P.x,w.y=P.y,w.z=P.z,M=P.size*P.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,P.rotation),t.uniform1f(u.opacity,P.opacity),t.uniform3f(u.color,P.color.r,P.color.g,P.color.b),i.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),r.setTexture2D(P.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; `;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 pOe(r,e){var t=r.context,i=r.state,n,a,o,s,l,u,c=new oe,h=new cn,f=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 ci(_),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 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(` `)),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 _r(){Object.defineProperty(this,"id",{value:dOe++}),this.uuid=fr.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=a_,this.side=y0,this.shading=zk,this.vertexColors=bL,this.opacity=1,this.transparent=!1,this.blendSrc=Wk,this.blendDst=Xk,this.blendEquation=Hk,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=qR,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 Na(r){_r.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=`void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,this.fragmentShader=`void main() { gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); }`,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 $f(r){_r.call(this),this.type="MeshDepthMaterial",this.depthPacking=yse,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 Zu(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 fa(r,e){this.center=r!==void 0?r:new oe,this.radius=e!==void 0?e:0}function dl(){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 xs(r,e){this.normal=r!==void 0?r:new oe(1,0,0),this.constant=e!==void 0?e:0}function kM(r,e,t,i,n,a){this.planes=[r!==void 0?r:new xs,e!==void 0?e:new xs,t!==void 0?t:new xs,i!==void 0?i:new xs,n!==void 0?n:new xs,a!==void 0?a:new xs]}function Cse(r,e,t,i){var n=r.context,a=r.state,o=new kM,s=new Kt,l=e.shadows,u=new Tt,c=new Tt(i.maxTextureSize,i.maxTextureSize),h=new oe,f=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 ii,new ii,new ii,new ii,new ii,new ii],w=new $f;w.depthPacking=_se,w.clipping=!0;for(var T=b0.distanceRGBA,C=Yo.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 Na({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:T.vertexShader,fragmentShader:T.fragmentShader,morphTargets:E,skinning:I,clipping:!0});_[b]=A}var P=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Uk,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(z,k){if(P.enabled!==!1&&!(P.autoUpdate===!1&&P.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;J0: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 P.renderSingleSided&&We==n_&&(We=y0),P.renderReverseSided&&(We===y0?We=jf:We===jf&&(We=y0)),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;V65535?Uint32Array:Uint16Array)(l),c=new Float32Array(s*3),h=new Float32Array(s*3),f=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 Mt(u,1)),this.addAttribute("position",new Mt(c,3)),this.addAttribute("normal",new Mt(h,3)),this.addAttribute("uv",new Mt(f,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,P){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;ae0?1:-1,h[p]=K.x,h[p+1]=K.y,h[p+2]=K.z,f[d]=ue/R,f[d+1]=1-ae/A,p+=3,d+=2,Q+=1}for(ae=0;ae65535?Uint32Array:Uint16Array)(o*s*6),v=0;v/g;function t(i,n){var a=jr[n];if(a===void 0)throw new Error("Can not resolve #include <"+n+">");return xk(a)}return r.replace(e,t)}function Soe(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);l0?r.gammaFactor:1,d=wOe(a,i,r.extensions),g=TOe(o),m=n.createProgram(),v,_;t.isRawShaderMaterial?(v=[g,` `].filter(LM).join(` `),_=[d,g,` `].filter(LM).join(` `)):(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 "+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.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",` `].filter(LM).join(` `),_=[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 "+h:"",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.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!==XR?"#define TONE_MAPPING":"",i.toneMapping!==XR?jr.tonemapping_pars_fragment:"",i.toneMapping!==XR?bOe("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?jr.encodings_pars_fragment:"",i.mapEncoding?sk("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?sk("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?sk("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?MOe("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(LM).join(` `)),s=xk(s,i),s=xoe(s,i),l=xk(l,i),l=xoe(l,i),t.isShaderMaterial||(s=Soe(s),l=Soe(l));var y=v+s,x=_+l,M=_oe(n,n.VERTEX_SHADER,y),S=_oe(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 Jf(n,m,r)),I};var R;return this.getAttributes=function(){return R===void 0&&(R=EOe(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=SOe++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=M,this.fragmentShader=S,this}function COe(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),c0,shadowMapType:r.shadowMap.type,toneMapping:r.toneMapping,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,alphaTest:s.alphaTest,doubleSided:s.side===n_,flipSided:s.side===jf,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 h=0;h65535?Uint32Array:Uint16Array,C=new Mt(new T(p),1);return a(C,r.ELEMENT_ARRAY_BUFFER),f.wireframe=C,C}return{getAttributeBuffer:l,getAttributeProperties:u,getWireframeAttribute:c,update:n}}function DOe(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 P=A/Math.max(R.width,R.height),U=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");U.width=Math.floor(R.width*P),U.height=Math.floor(R.height*P);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 fr.isPowerOfTwo(R.width)&&fr.isPowerOfTwo(R.height)}function h(R){if(R instanceof HTMLImageElement||R instanceof HTMLCanvasElement){var A=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");A.width=fr.nearestPowerOfTwo(R.width),A.height=fr.nearestPowerOfTwo(R.height);var P=A.getContext("2d");return P.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 f(R){return R.wrapS!==Ms||R.wrapT!==Ms||R.minFilter!==bs&&R.minFilter!==qo}function p(R){return R===bs||R===CL||R===RL?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),P=i.get(R.texture);if(R){if(P.__webglTexture!==void 0&&r.deleteTexture(P.__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 P=i.get(R);if(R.version>0&&P.__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(P,R,A);return}}t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_2D,P.__webglTexture)}function y(R,A){var P=i.get(R);if(R.image.length===6)if(R.version>0&&P.__version!==R.version){P.__image__webglTextureCube||(R.addEventListener("dispose",d),P.__image__webglTextureCube=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,P.__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-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),P.__version=R.version,R.onUpdate&&R.onUpdate(R)}else t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,P.__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,P){var U;if(P?(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!==Ms||A.wrapT!==Ms)&&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!==bs&&A.minFilter!==qo&&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===_0&&e.get("OES_texture_float_linear")===null||A.type===JR&&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,P){R.__webglInit===void 0&&(R.__webglInit=!0,A.addEventListener("dispose",d),R.__webglTexture=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+P),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);f(A)&&c(U)===!1&&(U=h(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===_0){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===tm&&J===r.DEPTH_COMPONENT&&A.type!==NM&&A.type!==Kk&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),A.type=NM,k=a(A.type)),A.format===S0&&(J=r.DEPTH_STENCIL,A.type!==UM&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),A.type=UM,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-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=1,U=null,B={},z=new ii,k=new ii;function G($,nt,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;Ie0&&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),h=r.getParameter(r.MAX_TEXTURE_SIZE),f=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:h,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:d,maxVaryings:g,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:_,floatVertexTextures:y}}function UOe(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 OOe(){var r=this,e=null,t=0,i=!1,n=!1,a=new xs,o=new dl,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(c,h,f){var p=c.length!==0||h||t!==0||i;return i=h,e=u(c,f,0),t=c.length,p},this.beginShadows=function(){n=!0,u(null)},this.endShadows=function(){n=!1,l()},this.setState=function(c,h,f,p,d,g){if(!i||c===null||c.length===0||n&&!f)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=h?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,h,f,p){var d=c!==null?c.length:0,g=null;if(d!==0){if(g=s.value,p!==!0||g===null){var m=f+d*4,v=h.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length8&&($e.length=8);for(var _i=ee.morphAttributes,lt=0,Ct=$e.length;lt0&&Ei.renderInstances(ee,np,IL):Ei.render(np,IL)}};function ct(D,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=D.defaultAttributeValues;for(var gt in Ge){var _t=Ge[gt];if(_t>=0){var $e=Oe[gt];if($e!==void 0){var lt=$e.normalized,Ct=$e.itemSize,je=Ne.getAttributeProperties($e),_i=je.__webglBuffer,Ft=je.type,Nr=je.bytesPerElement;if($e.isInterleavedBufferAttribute){var Yi=$e.data,Et=Yi.stride,Ei=$e.offset;Yi&&Yi.isInstancedInterleavedBuffer?(xe.enableAttributeAndDivisor(_t,Yi.meshPerAttribute,ce),ee.maxInstancedCount===void 0&&(ee.maxInstancedCount=Yi.meshPerAttribute*Yi.count)):xe.enableAttribute(_t),q.bindBuffer(q.ARRAY_BUFFER,_i),q.vertexAttribPointer(_t,Ct,Ft,lt,Et*Nr,(ge*Et+Ei)*Nr)}else $e.isInstancedBufferAttribute?(xe.enableAttributeAndDivisor(_t,$e.meshPerAttribute,ce),ee.maxInstancedCount===void 0&&(ee.maxInstancedCount=$e.meshPerAttribute*$e.count)):xe.enableAttribute(_t),q.bindBuffer(q.ARRAY_BUFFER,_i),q.vertexAttribPointer(_t,Ct,Ft,lt,0,ge*Ct*Nr)}else if(Re!==void 0){var cr=Re[gt];if(cr!==void 0)switch(cr.length){case 2:q.vertexAttrib2fv(_t,cr);break;case 3:q.vertexAttrib3fv(_t,cr);break;case 4:q.vertexAttrib4fv(_t,cr);break;default:q.vertexAttrib1fv(_t,cr)}}}}xe.disableUnusedAttributes()}function Je(D,W){return Math.abs(W[0])-Math.abs(D[0])}function Gt(D,W){return D.object.renderOrder!==W.object.renderOrder?D.object.renderOrder-W.object.renderOrder:D.material.program&&W.material.program&&D.material.program!==W.material.program?D.material.program.id-W.material.program.id:D.material.id!==W.material.id?D.material.id-W.material.id:D.z!==W.z?D.z-W.z:D.id-W.id}function X(D,W){return D.object.renderOrder!==W.object.renderOrder?D.object.renderOrder-W.object.renderOrder:D.z!==W.z?W.z-D.z:D.id-W.id}this.render=function(D,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,D.autoUpdate===!0&&D.updateMatrixWorld(),W.parent===null&&W.updateMatrixWorld(),W.matrixWorldInverse.getInverse(W.matrixWorld),K.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),G.setFromMatrix(K),u.length=0,h=-1,p=-1,g.length=0,m.length=0,Q=this.localClippingEnabled,J=Y.init(this.clippingPlanes,Q,W),wt(D,W),c.length=h+1,f.length=p+1,v.sortObjects===!0&&(c.sort(Gt),f.sort(X)),J&&Y.beginShadows(),O(u),st.render(D,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=D.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)),D.overrideMaterial){var Oe=D.overrideMaterial;kt(c,D,W,Oe),kt(f,D,W,Oe)}else xe.setBlending(IM),kt(c,D,W),kt(f,D,W);$.render(D,W),nt.render(D,W,b),ee&&Ue.updateRenderTargetMipmap(ee),xe.setDepthTest(!0),xe.setDepthWrite(!0),xe.setColorWrite(!0)};function Te(D,W,ee,ge,ce){var Oe,Ge;ee.transparent?(Oe=f,Ge=++p):(Oe=c,Ge=++h);var Re=Oe[Ge];Re!==void 0?(Re.id=D.id,Re.object=D,Re.geometry=W,Re.material=ee,Re.z=ae.z,Re.group=ce):(Re={id:D.id,object:D,geometry:W,material:ee,z:ae.z,group:ce},Oe.push(Re))}function te(D){var W=D.geometry;return W.boundingSphere===null&&W.computeBoundingSphere(),V.copy(W.boundingSphere).applyMatrix4(D.matrixWorld),De(V)}function Me(D){return V.center.set(0,0,0),V.radius=.7071067811865476,V.applyMatrix4(D.matrixWorld),De(V)}function De(D){if(!G.intersectsSphere(D))return!1;var W=Y.numPlanes;if(W===0)return!0;var ee=v.clippingPlanes,ge=D.center,ce=-D.radius,Oe=0;do if(ee[Oe].distanceToPoint(ge)=0&&D.numSupportedMorphTargets++}if(D.morphNormals){D.numSupportedMorphNormals=0;for(var $e=0;$e=0&&D.numSupportedMorphNormals++}var lt=ge.__webglShader.uniforms;(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(ge.numClippingPlanes=Y.numPlanes,ge.numIntersection=Y.numIntersection,lt.clippingPlanes=Y.uniform),ge.fog=W,ge.lightsHash=se.hash,D.lights&&(lt.ambientLightColor.value=se.ambient,lt.directionalLights.value=se.directional,lt.spotLights.value=se.spot,lt.rectAreaLights.value=se.rectArea,lt.pointLights.value=se.point,lt.hemisphereLights.value=se.hemi,lt.directionalShadowMap.value=se.directionalShadowMap,lt.directionalShadowMatrix.value=se.directionalShadowMatrix,lt.spotShadowMap.value=se.spotShadowMap,lt.spotShadowMatrix.value=se.spotShadowMatrix,lt.pointShadowMap.value=se.pointShadowMap,lt.pointShadowMatrix.value=se.pointShadowMatrix);var Ct=ge.program.getUniforms(),je=Jf.seqWithValue(Ct.seq,lt);ge.uniformsList=je}function $r(D){D.side===n_?xe.disable(q.CULL_FACE):xe.enable(q.CULL_FACE),xe.setFlipSided(D.side===jf),D.transparent===!0?xe.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha):xe.setBlending(IM),xe.setDepthFunc(D.depthFunc),xe.setDepthTest(D.depthTest),xe.setDepthWrite(D.depthWrite),xe.setColorWrite(D.colorWrite),xe.setPolygonOffset(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits)}function Ht(D,W,ee,ge){E=0;var ce=Le.get(ee);if(J&&(Q||D!==w)){var Oe=D===w&&ee.id===M;Y.setState(ee.clippingPlanes,ee.clipIntersection,ee.clipShadows,D,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&&(Tr(ee,W,ge),ee.needsUpdate=!1);var Ge=!1,Re=!1,gt=!1,_t=ce.program,$e=_t.getUniforms(),lt=ce.__webglShader.uniforms;if(_t.id!==_&&(q.useProgram(_t.program),_=_t.id,Ge=!0,Re=!0,gt=!0),ee.id!==M&&(M=ee.id,Re=!0),Ge||D!==w){if($e.set(q,D,"projectionMatrix"),_e.logarithmicDepthBuffer&&$e.setValue(q,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),D!==w&&(w=D,Re=!0,gt=!0),ee.isShaderMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.envMap){var Ct=$e.map.cameraPosition;Ct!==void 0&&Ct.setValue(q,ae.setFromMatrixPosition(D.matrixWorld))}(ee.isMeshPhongMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial||ee.skinning)&&$e.setValue(q,"viewMatrix",D.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&&h_(lt,gt),W&&ee.fog&&gl(lt,W),(ee.isMeshBasicMaterial||ee.isMeshLambertMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.isMeshNormalMaterial||ee.isMeshDepthMaterial)&&Or(lt,ee),ee.isLineBasicMaterial?hi(lt,ee):ee.isLineDashedMaterial?(hi(lt,ee),tp(lt,ee)):ee.isPointsMaterial?l_(lt,ee):ee.isMeshLambertMaterial?rp(lt,ee):ee.isMeshToonMaterial?ip(lt,ee):ee.isMeshPhongMaterial?Es(lt,ee):ee.isMeshPhysicalMaterial?u_(lt,ee):ee.isMeshStandardMaterial?oh(lt,ee):ee.isMeshDepthMaterial?ee.displacementMap&&(lt.displacementMap.value=ee.displacementMap,lt.displacementScale.value=ee.displacementScale,lt.displacementBias.value=ee.displacementBias):ee.isMeshNormalMaterial&&c_(lt,ee),lt.ltcMat!==void 0&&(lt.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),lt.ltcMag!==void 0&&(lt.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),Jf.upload(q,ce.uniformsList,lt,v)),$e.set(q,ge,"modelViewMatrix"),$e.set(q,ge,"normalMatrix"),$e.setValue(q,"modelMatrix",ge.matrixWorld),_t}function Or(D,W){D.opacity.value=W.opacity,D.diffuse.value=W.color,W.emissive&&D.emissive.value.copy(W.emissive).multiplyScalar(W.emissiveIntensity),D.map.value=W.map,D.specularMap.value=W.specularMap,D.alphaMap.value=W.alphaMap,W.lightMap&&(D.lightMap.value=W.lightMap,D.lightMapIntensity.value=W.lightMapIntensity),W.aoMap&&(D.aoMap.value=W.aoMap,D.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;D.offsetRepeat.value.set(ge.x,ge.y,ce.x,ce.y)}D.envMap.value=W.envMap,D.flipEnvMap.value=W.envMap&&W.envMap.isCubeTexture?-1:1,D.reflectivity.value=W.reflectivity,D.refractionRatio.value=W.refractionRatio}function hi(D,W){D.diffuse.value=W.color,D.opacity.value=W.opacity}function tp(D,W){D.dashSize.value=W.dashSize,D.totalSize.value=W.dashSize+W.gapSize,D.scale.value=W.scale}function l_(D,W){if(D.diffuse.value=W.color,D.opacity.value=W.opacity,D.size.value=W.size*U,D.scale.value=P*.5,D.map.value=W.map,W.map!==null){var ee=W.map.offset,ge=W.map.repeat;D.offsetRepeat.value.set(ee.x,ee.y,ge.x,ge.y)}}function gl(D,W){D.fogColor.value=W.color,W.isFog?(D.fogNear.value=W.near,D.fogFar.value=W.far):W.isFogExp2&&(D.fogDensity.value=W.density)}function rp(D,W){W.emissiveMap&&(D.emissiveMap.value=W.emissiveMap)}function Es(D,W){D.specular.value=W.specular,D.shininess.value=Math.max(W.shininess,1e-4),W.emissiveMap&&(D.emissiveMap.value=W.emissiveMap),W.bumpMap&&(D.bumpMap.value=W.bumpMap,D.bumpScale.value=W.bumpScale),W.normalMap&&(D.normalMap.value=W.normalMap,D.normalScale.value.copy(W.normalScale)),W.displacementMap&&(D.displacementMap.value=W.displacementMap,D.displacementScale.value=W.displacementScale,D.displacementBias.value=W.displacementBias)}function ip(D,W){Es(D,W),W.gradientMap&&(D.gradientMap.value=W.gradientMap)}function oh(D,W){D.roughness.value=W.roughness,D.metalness.value=W.metalness,W.roughnessMap&&(D.roughnessMap.value=W.roughnessMap),W.metalnessMap&&(D.metalnessMap.value=W.metalnessMap),W.emissiveMap&&(D.emissiveMap.value=W.emissiveMap),W.bumpMap&&(D.bumpMap.value=W.bumpMap,D.bumpScale.value=W.bumpScale),W.normalMap&&(D.normalMap.value=W.normalMap,D.normalScale.value.copy(W.normalScale)),W.displacementMap&&(D.displacementMap.value=W.displacementMap,D.displacementScale.value=W.displacementScale,D.displacementBias.value=W.displacementBias),W.envMap&&(D.envMapIntensity.value=W.envMapIntensity)}function u_(D,W){D.clearCoat.value=W.clearCoat,D.clearCoatRoughness.value=W.clearCoatRoughness,oh(D,W)}function c_(D,W){W.bumpMap&&(D.bumpMap.value=W.bumpMap,D.bumpScale.value=W.bumpScale),W.normalMap&&(D.normalMap.value=W.normalMap,D.normalScale.value.copy(W.normalScale)),W.displacementMap&&(D.displacementMap.value=W.displacementMap,D.displacementScale.value=W.displacementScale,D.displacementBias.value=W.displacementBias)}function h_(D,W){D.ambientLightColor.needsUpdate=W,D.directionalLights.needsUpdate=W,D.pointLights.needsUpdate=W,D.spotLights.needsUpdate=W,D.rectAreaLights.needsUpdate=W,D.hemisphereLights.needsUpdate=W}function O(D){for(var W=0,ee=0,ge=D.length;ee=_e.maxTextures&&console.warn("WebGLRenderer: trying to use "+D+" texture units while this GPU supports only "+_e.maxTextures),E+=1,D}this.allocTextureUnit=re,this.setTexture2D=function(){var D=!1;return function(ee,ge){ee&&ee.isWebGLRenderTarget&&(D||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),D=!0),ee=ee.texture),Ue.setTexture2D(ee,ge)}}(),this.setTexture=function(){var D=!1;return function(ee,ge){D||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),D=!0),Ue.setTexture2D(ee,ge)}}(),this.setTextureCube=function(){var D=!1;return function(ee,ge){ee&&ee.isWebGLRenderTargetCube&&(D||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),D=!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(D){y=D,D&&Le.get(D).__webglFramebuffer===void 0&&Ue.setupRenderTarget(D);var W=D&&D.isWebGLRenderTargetCube,ee;if(D){var ge=Le.get(D);W?ee=ge.__webglFramebuffer[D.activeCubeFace]:ee=ge.__webglFramebuffer,T.copy(D.scissor),C=D.scissorTest,b.copy(D.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(D.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+D.activeCubeFace,ce.__webglTexture,D.activeMipMapLevel)}},this.readRenderTargetPixels=function(D,W,ee,ge,ce,Oe){if((D&&D.isWebGLRenderTarget)===!1){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}var Ge=Le.get(D).__webglFramebuffer;if(Ge){var Re=!1;Ge!==x&&(q.bindFramebuffer(q.FRAMEBUFFER,Ge),Re=!0);try{var gt=D.texture,_t=gt.format,$e=gt.type;if(_t!==qu&&ie(_t)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if($e!==KR&&ie($e)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_TYPE)&&!($e===_0&&(We.get("OES_texture_float")||We.get("WEBGL_color_buffer_float")))&&!($e===JR&&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<=D.width-ge&&ee>=0&&ee<=D.height-ce&&q.readPixels(W,ee,ge,ce,ie(_t),ie($e),Oe):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{Re&&q.bindFramebuffer(q.FRAMEBUFFER,x)}}};function ie(D){var W;if(D===Qc)return q.REPEAT;if(D===Ms)return q.CLAMP_TO_EDGE;if(D===am)return q.MIRRORED_REPEAT;if(D===bs)return q.NEAREST;if(D===CL)return q.NEAREST_MIPMAP_NEAREST;if(D===RL)return q.NEAREST_MIPMAP_LINEAR;if(D===qo)return q.LINEAR;if(D===jk)return q.LINEAR_MIPMAP_NEAREST;if(D===Tb)return q.LINEAR_MIPMAP_LINEAR;if(D===KR)return q.UNSIGNED_BYTE;if(D===tse)return q.UNSIGNED_SHORT_4_4_4_4;if(D===rse)return q.UNSIGNED_SHORT_5_5_5_1;if(D===ise)return q.UNSIGNED_SHORT_5_6_5;if(D===$oe)return q.BYTE;if(D===Qoe)return q.SHORT;if(D===NM)return q.UNSIGNED_SHORT;if(D===ese)return q.INT;if(D===Kk)return q.UNSIGNED_INT;if(D===_0)return q.FLOAT;if(D===JR&&(W=We.get("OES_texture_half_float"),W!==null))return W.HALF_FLOAT_OES;if(D===nse)return q.ALPHA;if(D===x0)return q.RGB;if(D===qu)return q.RGBA;if(D===ase)return q.LUMINANCE;if(D===ose)return q.LUMINANCE_ALPHA;if(D===tm)return q.DEPTH_COMPONENT;if(D===S0)return q.DEPTH_STENCIL;if(D===Hk)return q.FUNC_ADD;if(D===Coe)return q.FUNC_SUBTRACT;if(D===Roe)return q.FUNC_REVERSE_SUBTRACT;if(D===Loe)return q.ZERO;if(D===Doe)return q.ONE;if(D===Poe)return q.SRC_COLOR;if(D===Ioe)return q.ONE_MINUS_SRC_COLOR;if(D===Wk)return q.SRC_ALPHA;if(D===Xk)return q.ONE_MINUS_SRC_ALPHA;if(D===Noe)return q.DST_ALPHA;if(D===Uoe)return q.ONE_MINUS_DST_ALPHA;if(D===Ooe)return q.DST_COLOR;if(D===zoe)return q.ONE_MINUS_DST_COLOR;if(D===Foe)return q.SRC_ALPHA_SATURATE;if((D===fk||D===pk||D===dk||D===mk)&&(W=We.get("WEBGL_compressed_texture_s3tc"),W!==null)){if(D===fk)return W.COMPRESSED_RGB_S3TC_DXT1_EXT;if(D===pk)return W.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(D===dk)return W.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(D===mk)return W.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((D===vk||D===gk||D===yk||D===_k)&&(W=We.get("WEBGL_compressed_texture_pvrtc"),W!==null)){if(D===vk)return W.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(D===gk)return W.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(D===yk)return W.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(D===_k)return W.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(D===sse&&(W=We.get("WEBGL_compressed_texture_etc1"),W!==null))return W.COMPRESSED_RGB_ETC1_WEBGL;if((D===lk||D===uk)&&(W=We.get("EXT_blend_minmax"),W!==null)){if(D===lk)return W.MIN_EXT;if(D===uk)return W.MAX_EXT}return D===UM&&(W=We.get("WEBGL_depth_texture"),W!==null)?W.UNSIGNED_INT_24_8_WEBGL:0}}function T0(r,e){this.name="",this.color=new Wt(r),this.density=e!==void 0?e:25e-5}function E0(r,e,t){this.name="",this.color=new Wt(r),this.near=e!==void 0?e:1,this.far=t!==void 0?t:1e3}function cm(){Lt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Sk(r,e,t,i,n){Lt.call(this),this.lensFlares=[],this.positionScreen=new oe,this.customUpdateCallback=void 0,r!==void 0&&this.add(r,e,t,i,n)}function hm(r){_r.call(this),this.type="SpriteMaterial",this.color=new Wt(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(r)}function qM(r){Lt.call(this),this.type="Sprite",this.material=r!==void 0?r:new hm}function ZM(){Lt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function QR(r,e,t){if(this.useVertexTexture=t!==void 0?t:!0,this.identityMatrix=new Kt,r=r||[],this.bones=r.slice(0),this.useVertexTexture){var i=Math.sqrt(this.bones.length*4);i=fr.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 sm(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,qu,_0)}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=r.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}c()}function C0(r,e,t,i,n,a,o,s,l,u,c,h){ci.call(this,null,a,o,s,l,u,i,n,c,h),this.image={width:e,height:t},this.mipmaps=r,this.flipY=!1,this.generateMipmaps=!1}function iL(r,e,t,i,n,a,o,s,l){ci.call(this,r,e,t,i,n,a,o,s,l),this.needsUpdate=!0}function KM(r,e,t,i,n,a,o,s,l,u){if(u=u!==void 0?u:tm,u!==tm&&u!==S0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&u===tm&&(t=NM),t===void 0&&u===S0&&(t=UM),ci.call(this,null,i,n,a,o,s,u,t,l),this.image={width:r,height:e},this.magFilter=o!==void 0?o:bs,this.minFilter=s!==void 0?s:bs,this.flipY=!1,this.generateMipmaps=!1}function R0(r){Vt.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;u65535?th:eh)(h,1)),this.addAttribute("position",new Mr(i,3)),this.addAttribute("uv",new Mr(n,2)),this.computeVertexNormals()}function JM(r,e,t){ur.call(this),this.type="ParametricGeometry",this.parameters={func:r,slices:e,stacks:t},this.fromBufferGeometry(new L0(r,e,t)),this.mergeVertices()}function Ko(r,e,t,i){Vt.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 Mr(n,3)),this.addAttribute("normal",new Mr(n.slice(),3)),this.addAttribute("uv",new Mr(a,2)),this.normalizeNormals(),this.boundingSphere=new fa(new oe,t);function o(v){for(var _=new oe,y=new oe,x=new oe,M=0;M.9&&S<.1&&(_<.2&&(a[v+0]+=1),y<.2&&(a[v+2]+=1),x<.2&&(a[v+4]+=1))}}function h(v){n.push(v.x,v.y,v.z)}function f(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 Tt,S=new Tt,w=new Tt,T=0,C=0;T65535?th:eh)(d,1)),this.addAttribute("position",new Mr(h,3)),this.addAttribute("normal",new Mr(f,3)),this.addAttribute("uv",new Mr(p,2));function g(){for(u=0;u65535?Uint32Array:Uint16Array)(s),1),u=new Mt(new Float32Array(o*3),3),c=new Mt(new Float32Array(o*3),3),h=new Mt(new Float32Array(o*2),2),f,p,d=0,g=0,m=new oe,v=new oe,_=new Tt,y=new oe,x=new oe,M=new oe,S=new oe,w=new oe;for(f=0;f<=t;++f){var T=f/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=f/t,_.y=p/i,h.setXY(d,_.x,_.y),d++}}for(p=1;p<=t;p++)for(f=1;f<=i;f++){var I=(i+1)*(p-1)+(f-1),R=(i+1)*p+(f-1),A=(i+1)*p+f,P=(i+1)*(p-1)+f;l.setX(g,I),g++,l.setX(g,R),g++,l.setX(g,P),g++,l.setX(g,R),g++,l.setX(g,A),g++,l.setX(g,P),g++}this.setIndex(l),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",h);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 nb(r,e,t,i,n,a,o){ur.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 U0(r,e,t,i,n,a)),this.mergeVertices()}function O0(r,e,t,i,n){Vt.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),h=0,f=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[h]=g.x,l[h+1]=g.y,l[h+2]=g.z,d.x=r*Math.cos(y),d.y=r*Math.sin(y),m.subVectors(g,d).normalize(),u[h]=m.x,u[h+1]=m.y,u[h+2]=m.z,c[f]=_/i,c[f+1]=v/t,h+=3,f+=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 Mt(s,1)),this.addAttribute("position",new Mt(l,3)),this.addAttribute("normal",new Mt(u,3)),this.addAttribute("uv",new Mt(c,2))}function ab(r,e,t,i,n){ur.call(this),this.type="TorusGeometry",this.parameters={radius:r,tube:e,radialSegments:t,tubularSegments:i,arc:n},this.fromBufferGeometry(new O0(r,e,t,i,n))}function ml(r,e){if(typeof r>"u"){r=[];return}ur.call(this),this.type="ExtrudeGeometry",r=Array.isArray(r)?r:[r],this.addShapeList(r,e),this.computeFaceNormals()}function ob(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 ur;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),ml.call(this,i,e),this.type="TextGeometry"}function pm(r,e,t,i,n,a,o){Vt.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 Mt(new Float32Array(l*3),3),c=new Mt(new Float32Array(l*3),3),h=new Mt(new Float32Array(l*2),2),f=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(f,x,M,S),c.setXYZ(f,d.x,d.y,d.z),h.setXY(f,y,1-v),m.push(f),f++}p.push(m)}for(var w=[],g=0;g0)&&w.push(T,C,E),(g!==t-1||s65535?th:eh)(w,1)),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",h),this.boundingSphere=new fa(new oe,r)}function sb(r,e,t,i,n,a,o){ur.call(this),this.type="SphereGeometry",this.parameters={radius:r,widthSegments:e,heightSegments:t,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new pm(r,e,t,i,n,a,o))}function z0(r,e,t,i,n,a){Vt.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 Mt(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new Mt(new Float32Array(o*3),3),c=new Mt(new Float32Array(o*3),3),h=new Mt(new Float32Array(o*2),2),f=0,p=0,d,g=r,m=(e-r)/i,v=new oe,_=new Tt,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(f,v.x,v.y,v.z),c.setXYZ(f,0,0,1),_.x=(v.x/e+1)/2,_.y=(v.y/e+1)/2,h.setXY(f,_.x,_.y),f++;g+=m}for(y=0;y65535?Uint32Array:Uint16Array)(a),1),s=new Mt(new Float32Array(n*3),3),l=new Mt(new Float32Array(n*2),2),u=0,c=0,h,f=1/e,p=new oe,d=new Tt,g,m;for(g=0;g<=e;g++){var v=t+g*f*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;g65535?th:eh)(a,1)),this.addAttribute("position",new Mr(t,3)),this.addAttribute("normal",new Mr(i,3)),this.addAttribute("uv",new Mr(n,2));function u(c){var h,f,p,d=t.length/3,g=c.extractPoints(e),m=g.shape,v=g.holes;if(Hn.isClockWise(m)===!1)for(m=m.reverse(),h=0,f=v.length;h0&&u++,e>0&&u++);var c=M(),h=S(),f=new Mt(new(h>65535?Uint32Array:Uint16Array)(h),1),p=new Mt(new Float32Array(c*3),3),d=new Mt(new Float32Array(c*3),3),g=new Mt(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(f),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 P=[],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),P.push(m),m++}_.push(P)}for(C=0;Cthis.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]],h=this.points[e[3]],o=a*a,s=a*o,t.x=f(l.x,u.x,c.x,h.x,a,o,s),t.y=f(l.y,u.y,c.y,h.y,a,o,s),t.z=f(l.z,u.z,c.z,h.z,a,o,s),t},this.getControlPointsArray=function(){var p,d,g=this.points.length,m=[];for(p=0;p{"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>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*fr.DEG2RAD},radToDeg:function(r){return r*fr.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}};Tt.prototype={constructor:Tt,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 Tt,e=new Tt),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}};VIe=0;ci.DEFAULT_IMAGE=void 0;ci.DEFAULT_MAPPING=wL;ci.prototype={constructor:ci,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=fr.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===wL){if(r.multiply(this.repeat),r.add(this.offset),r.x<0||r.x>1)switch(this.wrapS){case Qc:r.x=r.x-Math.floor(r.x);break;case Ms:r.x=r.x<0?0:1;break;case am: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 Qc:r.y=r.y-Math.floor(r.y);break;case Ms:r.y=r.y<0?0:1;break;case am: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(ci.prototype,pl.prototype);ii.prototype={constructor:ii,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],h=s[1],f=s[5],p=s[9],d=s[2],g=s[6],m=s[10];if(Math.abs(u-h)_&&v>y?vy?_0?(f=.5/Math.sqrt(h+1),this._w=.25/f,this._x=(u-s)*f,this._y=(n-l)*f,this._z=(a-i)*f):t>o&&t>c?(f=2*Math.sqrt(1+t-o-c),this._w=(u-s)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(n+l)/f):o>c?(f=2*Math.sqrt(1+o-t-c),this._w=(n-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(s+u)/f):(f=2*Math.sqrt(1+c-t-o),this._w=(a-i)/f,this._x=(n+l)/f,this._y=(s+u)/f,this._z=.25*f),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,eMath.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(cn,{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],h=n[a+0],f=n[a+1],p=n[a+2],d=n[a+3];if(c!==d||s!==h||l!==f||u!==p){var g=1-o,m=s*h+l*f+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+h*M,l=l*g+f*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 cn),this.applyQuaternion(r.setFromEuler(t))}}(),applyAxisAngle:function(){var r;return function(t,i){return r===void 0&&(r=new cn),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,h=-n*e-a*t-o*i;return this.x=l*s+h*-n+u*-o-c*-a,this.y=u*s+h*-a+c*-n-l*-o,this.z=c*s+h*-o+l*-a-u*-n,this},project:function(){var r;return function(t){return r===void 0&&(r=new Kt),r.multiplyMatrices(t.projectionMatrix,r.getInverse(t.matrixWorld)),this.applyProjection(r)}}(),unproject:function(){var r;return function(t){return r===void 0&&(r=new Kt),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(fr.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}};Kt.prototype={constructor:Kt,isMatrix4:!0,set:function(r,e,t,i,n,a,o,s,l,u,c,h,f,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]=h,m[3]=f,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 Kt().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 h=a*u,f=a*c,p=o*u,d=o*c;e[0]=s*u,e[4]=-s*c,e[8]=l,e[1]=f+p*l,e[5]=h-d*l,e[9]=-o*s,e[2]=d-h*l,e[6]=p+f*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 h=a*u,f=a*c,p=o*u,d=o*c;e[0]=s*u,e[4]=p*l-f,e[8]=h*l+d,e[1]=s*c,e[5]=d*l+h,e[9]=f*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,h=t*l,f=i*s,p=i*l,d=n*l,g=a*o,m=a*s,v=a*l;return e[0]=1-(f+d),e[4]=c-v,e[8]=h+m,e[1]=c+v,e[5]=1-(u+d),e[9]=p-g,e[2]=h-m,e[6]=p+g,e[10]=1-(u+f),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],h=t[9],f=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],P=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*P+l*k,n[12]=a*T+o*I+s*U+l*G,n[1]=u*M+c*C+h*R+f*B,n[5]=u*S+c*b+h*A+f*z,n[9]=u*w+c*E+h*P+f*k,n[13]=u*T+c*I+h*U+f*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*P+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*P+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 0.0 ) { #if defined ( PHYSICALLY_CORRECT_LIGHTS ) float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); return distanceFalloff * maxDistanceCutoffFactor; #else return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent ); #endif } return 1.0; } vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) { float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH ); return ( 1.0 - specularColor ) * fresnel + specularColor; } float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); return 1.0 / ( gl * gv ); } float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) { float alpha = pow2( roughness ); vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir ); float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) ); float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); float dotNH = saturate( dot( geometry.normal, halfDir ) ); float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); vec3 F = F_Schlick( specularColor, dotLH ); float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( G * D ); } vec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE; const float LUT_BIAS = 0.5/LUT_SIZE; vec3 N = geometry.normal; vec3 V = geometry.viewDir; vec3 P = geometry.position; float theta = acos( dot( N, V ) ); vec2 uv = vec2( sqrt( saturate( roughness ) ), saturate( theta / ( 0.5 * PI ) ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } void clipQuadToHorizon( inout vec3 L[5], out int n ) { int config = 0; if ( L[0].z > 0.0 ) config += 1; if ( L[1].z > 0.0 ) config += 2; if ( L[2].z > 0.0 ) config += 4; if ( L[3].z > 0.0 ) config += 8; n = 0; if ( config == 0 ) { } else if ( config == 1 ) { n = 3; L[1] = -L[1].z * L[0] + L[0].z * L[1]; L[2] = -L[3].z * L[0] + L[0].z * L[3]; } else if ( config == 2 ) { n = 3; L[0] = -L[0].z * L[1] + L[1].z * L[0]; L[2] = -L[2].z * L[1] + L[1].z * L[2]; } else if ( config == 3 ) { n = 4; L[2] = -L[2].z * L[1] + L[1].z * L[2]; L[3] = -L[3].z * L[0] + L[0].z * L[3]; } else if ( config == 4 ) { n = 3; L[0] = -L[3].z * L[2] + L[2].z * L[3]; L[1] = -L[1].z * L[2] + L[2].z * L[1]; } else if ( config == 5 ) { n = 0; } else if ( config == 6 ) { n = 4; L[0] = -L[0].z * L[1] + L[1].z * L[0]; L[3] = -L[3].z * L[2] + L[2].z * L[3]; } else if ( config == 7 ) { n = 5; L[4] = -L[3].z * L[0] + L[0].z * L[3]; L[3] = -L[3].z * L[2] + L[2].z * L[3]; } else if ( config == 8 ) { n = 3; L[0] = -L[0].z * L[3] + L[3].z * L[0]; L[1] = -L[2].z * L[3] + L[3].z * L[2]; L[2] = L[3]; } else if ( config == 9 ) { n = 4; L[1] = -L[1].z * L[0] + L[0].z * L[1]; L[2] = -L[2].z * L[3] + L[3].z * L[2]; } else if ( config == 10 ) { n = 0; } else if ( config == 11 ) { n = 5; L[4] = L[3]; L[3] = -L[2].z * L[3] + L[3].z * L[2]; L[2] = -L[2].z * L[1] + L[1].z * L[2]; } else if ( config == 12 ) { n = 4; L[1] = -L[1].z * L[2] + L[2].z * L[1]; L[0] = -L[0].z * L[3] + L[3].z * L[0]; } else if ( config == 13 ) { n = 5; L[4] = L[3]; L[3] = L[2]; L[2] = -L[1].z * L[2] + L[2].z * L[1]; L[1] = -L[1].z * L[0] + L[0].z * L[1]; } else if ( config == 14 ) { n = 5; L[4] = -L[0].z * L[3] + L[3].z * L[0]; L[0] = -L[0].z * L[1] + L[1].z * L[0]; } else if ( config == 15 ) { n = 4; } if ( n == 3 ) L[3] = L[0]; if ( n == 4 ) L[4] = L[0]; } float integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) { float cosTheta = dot( v1, v2 ); float theta = acos( cosTheta ); float res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 ); return res; } void initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) { rectPoints[0] = pos - halfWidth - halfHeight; rectPoints[1] = pos + halfWidth - halfHeight; rectPoints[2] = pos + halfWidth + halfHeight; rectPoints[3] = pos - halfWidth + halfHeight; } vec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) { vec3 N = geometry.normal; vec3 V = geometry.viewDir; vec3 P = geometry.position; vec3 T1, T2; T1 = normalize(V - N * dot( V, N )); T2 = - cross( N, T1 ); mat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) ); vec3 clippedRect[5]; clippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P ); clippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P ); clippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P ); clippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P ); int n; clipQuadToHorizon(clippedRect, n); if ( n == 0 ) return vec3( 0, 0, 0 ); clippedRect[0] = normalize( clippedRect[0] ); clippedRect[1] = normalize( clippedRect[1] ); clippedRect[2] = normalize( clippedRect[2] ); clippedRect[3] = normalize( clippedRect[3] ); clippedRect[4] = normalize( clippedRect[4] ); float sum = 0.0; sum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] ); sum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] ); sum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] ); if (n >= 4) sum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] ); if (n == 5) sum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] ); sum = max( 0.0, sum ); vec3 Lo_i = vec3( sum, sum, sum ); return Lo_i; } vec3 Rect_Area_Light_Specular_Reflectance( const in GeometricContext geometry, const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight, const in float roughness, const in sampler2D ltcMat, const in sampler2D ltcMag ) { vec3 rectPoints[4]; initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints ); vec2 uv = ltcTextureCoords( geometry, roughness ); vec4 brdfLtcApproxParams, t; brdfLtcApproxParams = texture2D( ltcMat, uv ); t = texture2D( ltcMat, uv ); float brdfLtcScalar = texture2D( ltcMag, uv ).a; mat3 brdfLtcApproxMat = mat3( vec3( 1, 0, t.y ), vec3( 0, t.z, 0 ), vec3( t.w, 0, t.x ) ); vec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints ); specularReflectance *= brdfLtcScalar; return specularReflectance; } vec3 Rect_Area_Light_Diffuse_Reflectance( const in GeometricContext geometry, const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) { vec3 rectPoints[4]; initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints ); mat3 diffuseBrdfMat = mat3(1); vec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints ); return diffuseReflectance; } vec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) { float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw; return specularColor * AB.x + AB.y; } float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); } vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) { vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir ); float dotNH = saturate( dot( geometry.normal, halfDir ) ); float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); vec3 F = F_Schlick( specularColor, dotLH ); float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); } float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) { return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 ); } float BlinnExponentToGGXRoughness( const in float blinnExponent ) { return sqrt( 2.0 / ( blinnExponent + 2.0 ) ); } `,SNe=`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { vec2 dSTdx = dFdx( vUv ); vec2 dSTdy = dFdy( vUv ); float Hll = bumpScale * texture2D( bumpMap, vUv ).x; float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; return vec2( dBx, dBy ); } vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) { vec3 vSigmaX = dFdx( surf_pos ); vec3 vSigmaY = dFdy( surf_pos ); vec3 vN = surf_norm; vec3 R1 = cross( vSigmaY, vN ); vec3 R2 = cross( vN, vSigmaX ); float fDet = dot( vSigmaX, R1 ); vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } #endif `,MNe=`#if NUM_CLIPPING_PLANES > 0 for ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) { vec4 plane = clippingPlanes[ i ]; if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard; } #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) { vec4 plane = clippingPlanes[ i ]; clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped; } if ( clipped ) discard; #endif #endif `,bNe=`#if NUM_CLIPPING_PLANES > 0 #if ! defined( PHYSICAL ) && ! defined( PHONG ) varying vec3 vViewPosition; #endif uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif `,wNe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) varying vec3 vViewPosition; #endif `,TNe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) vViewPosition = - mvPosition.xyz; #endif `,ENe=`#ifdef USE_COLOR diffuseColor.rgb *= vColor; #endif`,ANe=`#ifdef USE_COLOR varying vec3 vColor; #endif `,CNe=`#ifdef USE_COLOR varying vec3 vColor; #endif`,RNe=`#ifdef USE_COLOR vColor.xyz = color.xyz; #endif`,LNe=`#define PI 3.14159265359 #define PI2 6.28318530718 #define PI_HALF 1.5707963267949 #define RECIPROCAL_PI 0.31830988618 #define RECIPROCAL_PI2 0.15915494 #define LOG2 1.442695 #define EPSILON 1e-6 #define saturate(a) clamp( a, 0.0, 1.0 ) #define whiteCompliment(a) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract(sin(sn) * c); } struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; struct GeometricContext { vec3 position; vec3 normal; vec3 viewDir; }; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { float distance = dot( planeNormal, point - pointOnPlane ); return - distance * planeNormal + point; } float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { return sign( dot( point - pointOnPlane, planeNormal ) ); } vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) { return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine; } mat3 transpose( const in mat3 v ) { mat3 tmp; tmp[0] = vec3(v[0].x, v[1].x, v[2].x); tmp[1] = vec3(v[0].y, v[1].y, v[2].y); tmp[2] = vec3(v[0].z, v[1].z, v[2].z); return tmp; } `,DNe=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_textureSize (1024.0) int getFaceFromDirection(vec3 direction) { vec3 absDirection = abs(direction); int face = -1; if( absDirection.x > absDirection.z ) { if(absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0 : 3; else face = direction.y > 0.0 ? 1 : 4; } else { if(absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2 : 5; else face = direction.y > 0.0 ? 1 : 4; } return face; } #define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0) #define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0)) vec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) { float scale = exp2(cubeUV_maxLods1 - roughnessLevel); float dxRoughness = dFdx(roughness); float dyRoughness = dFdy(roughness); vec3 dx = dFdx( vec * scale * dxRoughness ); vec3 dy = dFdy( vec * scale * dyRoughness ); float d = max( dot( dx, dx ), dot( dy, dy ) ); d = clamp(d, 1.0, cubeUV_rangeClamp); float mipLevel = 0.5 * log2(d); return vec2(floor(mipLevel), fract(mipLevel)); } #define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0) #define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize) vec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) { mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel; float a = 16.0 * cubeUV_rcpTextureSize; vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) ); vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed; float powScale = exp2_packed.x * exp2_packed.y; float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25; float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x; bool bRes = mipLevel == 0.0; scale = bRes && (scale < a) ? a : scale; vec3 r; vec2 offset; int face = getFaceFromDirection(direction); float rcpPowScale = 1.0 / powScale; if( face == 0) { r = vec3(direction.x, -direction.z, direction.y); offset = vec2(0.0+mipOffset,0.75 * rcpPowScale); offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y; } else if( face == 1) { r = vec3(direction.y, direction.x, direction.z); offset = vec2(scale+mipOffset, 0.75 * rcpPowScale); offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y; } else if( face == 2) { r = vec3(direction.z, direction.x, direction.y); offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale); offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y; } else if( face == 3) { r = vec3(direction.x, direction.z, direction.y); offset = vec2(0.0+mipOffset,0.5 * rcpPowScale); offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y; } else if( face == 4) { r = vec3(direction.y, direction.x, -direction.z); offset = vec2(scale+mipOffset, 0.5 * rcpPowScale); offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y; } else { r = vec3(direction.z, -direction.x, direction.y); offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale); offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y; } r = normalize(r); float texelOffset = 0.5 * cubeUV_rcpTextureSize; vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5; vec2 base = offset + vec2( texelOffset ); return base + s * ( scale - 2.0 * texelOffset ); } #define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0) vec4 textureCubeUV(vec3 reflectedDirection, float roughness ) { float roughnessVal = roughness* cubeUV_maxLods3; float r1 = floor(roughnessVal); float r2 = r1 + 1.0; float t = fract(roughnessVal); vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness); float s = mipInfo.y; float level0 = mipInfo.x; float level1 = level0 + 1.0; level1 = level1 > 5.0 ? 5.0 : level1; level0 += min( floor( s + 0.5 ), 5.0 ); vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0); vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10)); vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0); vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20)); vec4 result = mix(color10, color20, t); return vec4(result.rgb, 1.0); } #endif `,PNe=`#ifdef FLIP_SIDED objectNormal = -objectNormal; #endif vec3 transformedNormal = normalMatrix * objectNormal; `,INe=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif `,NNe=`#ifdef USE_DISPLACEMENTMAP transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias ); #endif `,UNe=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb; totalEmissiveRadiance *= emissiveColor.rgb; #endif `,ONe=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif `,zNe=` gl_FragColor = linearToOutputTexel( gl_FragColor ); `,FNe=` vec4 LinearToLinear( in vec4 value ) { return value; } vec4 GammaToLinear( in vec4 value, in float gammaFactor ) { return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w ); } vec4 LinearToGamma( in vec4 value, in float gammaFactor ) { return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w ); } vec4 sRGBToLinear( in vec4 value ) { 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 ); } vec4 LinearTosRGB( in vec4 value ) { 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 ); } vec4 RGBEToLinear( in vec4 value ) { return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 ); } vec4 LinearToRGBE( in vec4 value ) { float maxComponent = max( max( value.r, value.g ), value.b ); float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 ); return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 ); } vec4 RGBMToLinear( in vec4 value, in float maxRange ) { return vec4( value.xyz * value.w * maxRange, 1.0 ); } vec4 LinearToRGBM( in vec4 value, in float maxRange ) { float maxRGB = max( value.x, max( value.g, value.b ) ); float M = clamp( maxRGB / maxRange, 0.0, 1.0 ); M = ceil( M * 255.0 ) / 255.0; return vec4( value.rgb / ( M * maxRange ), M ); } vec4 RGBDToLinear( in vec4 value, in float maxRange ) { return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 ); } vec4 LinearToRGBD( in vec4 value, in float maxRange ) { float maxRGB = max( value.x, max( value.g, value.b ) ); float D = max( maxRange / maxRGB, 1.0 ); D = min( floor( D ) / 255.0, 1.0 ); return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D ); } const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 ); vec4 LinearToLogLuv( in vec4 value ) { vec3 Xp_Y_XYZp = value.rgb * cLogLuvM; Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6)); vec4 vResult; vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z; float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0; vResult.w = fract(Le); vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0; return vResult; } const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 ); vec4 LogLuvToLinear( in vec4 value ) { float Le = value.z * 255.0 + value.w; vec3 Xp_Y_XYZp; Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0); Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y; Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z; vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM; return vec4( max(vRGB, 0.0), 1.0 ); } `,BNe=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition ); vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToVertex, worldNormal ); #else vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #elif defined( ENVMAP_TYPE_EQUIREC ) vec2 sampleUV; sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 ); sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5; vec4 envColor = texture2D( envMap, sampleUV ); #elif defined( ENVMAP_TYPE_SPHERE ) vec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ); vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 ); #else vec4 envColor = vec4( 0.0 ); #endif envColor = envMapTexelToLinear( envColor ); #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif `,kNe=`#if defined( USE_ENVMAP ) || defined( PHYSICAL ) uniform float reflectivity; uniform float envMapIntensity; #endif #ifdef USE_ENVMAP #if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) ) varying vec3 vWorldPosition; #endif #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif uniform float flipEnvMap; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL ) uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif `,VNe=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif `,GNe=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif `,HNe=`#ifdef USE_FOG #ifdef USE_LOGDEPTHBUF_EXT float depth = gl_FragDepthEXT / gl_FragCoord.w; #else float depth = gl_FragCoord.z / gl_FragCoord.w; #endif #ifdef FOG_EXP2 float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) ); #else float fogFactor = smoothstep( fogNear, fogFar, depth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif `,WNe=`#ifdef USE_FOG uniform vec3 fogColor; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,XNe=`#ifdef TOON uniform sampler2D gradientMap; vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return texture2D( gradientMap, coord ).rgb; #else return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); #endif } #endif `,YNe=`#ifdef USE_LIGHTMAP reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; #endif `,qNe=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,ZNe=`vec3 diffuse = vec3( 1.0 ); GeometricContext geometry; geometry.position = mvPosition.xyz; geometry.normal = normalize( transformedNormal ); geometry.viewDir = normalize( -mvPosition.xyz ); GeometricContext backGeometry; backGeometry.position = geometry.position; backGeometry.normal = -geometry.normal; backGeometry.viewDir = geometry.viewDir; vLightFront = vec3( 0.0 ); #ifdef DOUBLE_SIDED vLightBack = vec3( 0.0 ); #endif IncidentLight directLight; float dotNL; vec3 directLightColor_Diffuse; #if NUM_POINT_LIGHTS > 0 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #endif #if NUM_SPOT_LIGHTS > 0 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #endif #if NUM_RECT_AREA_LIGHTS > 0 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { } #endif #if NUM_DIR_LIGHTS > 0 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #endif #if NUM_HEMI_LIGHTS > 0 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); #ifdef DOUBLE_SIDED vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry ); #endif } #endif `,jNe=`uniform vec3 ambientLightColor; vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) { directLight.color = directionalLight.color; directLight.direction = directionalLight.direction; directLight.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = pointLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); directLight.color = pointLight.color; directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay ); directLight.visible = ( directLight.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = spotLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); float angleCos = dot( directLight.direction, spotLight.direction ); if ( angleCos > spotLight.coneCos ) { float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos ); directLight.color = spotLight.color; directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay ); directLight.visible = true; } else { directLight.color = vec3( 0.0 ); directLight.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltcMat; uniform sampler2D ltcMag; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) { float dotNL = dot( geometry.normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #endif #if defined( USE_ENVMAP ) && defined( PHYSICAL ) vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) { vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); #ifdef ENVMAP_TYPE_CUBE vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) ); #else vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_CUBE_UV ) vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz ); vec4 envMapColor = textureCubeUV( queryVec, 1.0 ); #else vec4 envMapColor = vec4( 0.0 ); #endif return PI * envMapColor.rgb * envMapIntensity; } float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) { float maxMIPLevelScalar = float( maxMIPLevel ); float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 ); return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar ); } vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) { #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal ); #else vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio ); #endif reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel ); #ifdef ENVMAP_TYPE_CUBE vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel ); #else vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_CUBE_UV ) vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz ); vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent)); #elif defined( ENVMAP_TYPE_EQUIREC ) vec2 sampleUV; sampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 ); sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5; #ifdef TEXTURE_LOD_EXT vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel ); #else vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_SPHERE ) vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel ); #else vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #endif return envMapColor.rgb * envMapIntensity; } #endif `,KNe=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength; `,JNe=`varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { vec3 matDiffColor = material.diffuseColor; vec3 matSpecColor = material.specularColor; vec3 lightColor = rectAreaLight.color; float roughness = BlinnExponentToGGXRoughness( material.specularShininess ); vec3 spec = Rect_Area_Light_Specular_Reflectance( geometry, rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight, roughness, ltcMat, ltcMag ); vec3 diff = Rect_Area_Light_Diffuse_Reflectance( geometry, rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight ); reflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2; reflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2; } #endif void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { #ifdef TOON vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; #else float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #endif #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_Direct_RectArea RE_Direct_RectArea_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong #define Material_LightProbeLOD( material ) (0) `,$Ne=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 ); #ifdef STANDARD material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor ); material.clearCoat = saturate( clearCoat ); material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 ); #endif `,QNe=`struct PhysicalMaterial { vec3 diffuseColor; float specularRoughness; vec3 specularColor; #ifndef STANDARD float clearCoat; float clearCoatRoughness; #endif }; #define MAXIMUM_SPECULAR_COEFFICIENT 0.16 #define DEFAULT_SPECULAR_COEFFICIENT 0.04 float clearCoatDHRApprox( const in float roughness, const in float dotNL ) { return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) ); } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 matDiffColor = material.diffuseColor; vec3 matSpecColor = material.specularColor; vec3 lightColor = rectAreaLight.color; float roughness = material.specularRoughness; vec3 spec = Rect_Area_Light_Specular_Reflectance( geometry, rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight, roughness, ltcMat, ltcMag ); vec3 diff = Rect_Area_Light_Diffuse_Reflectance( geometry, rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight ); reflectedLight.directSpecular += lightColor * matSpecColor * spec; reflectedLight.directDiffuse += lightColor * matDiffColor * diff; } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif #ifndef STANDARD float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL ); #else float clearCoatDHR = 0.0; #endif reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness ); reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); #ifndef STANDARD reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness ); #endif } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { #ifndef STANDARD float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); float dotNL = dotNV; float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL ); #else float clearCoatDHR = 0.0; #endif reflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness ); #ifndef STANDARD reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness ); #endif } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical #define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness ) #define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness ) float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); } `,eUe=` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; geometry.viewDir = normalize( vViewPosition ); IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointDirectLightIrradiance( pointLight, geometry, directLight ); #ifdef USE_SHADOWMAP directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotDirectLightIrradiance( spotLight, geometry, directLight ); #ifdef USE_SHADOWMAP directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight ); #ifdef USE_SHADOWMAP directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); } #endif #if defined( RE_IndirectDiffuse ) vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #ifdef USE_LIGHTMAP vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; #ifndef PHYSICALLY_CORRECT_LIGHTS lightMapIrradiance *= PI; #endif irradiance += lightMapIrradiance; #endif #if ( NUM_HEMI_LIGHTS > 0 ) for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); } #endif #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV ) irradiance += getLightProbeIndirectIrradiance( geometry, 8 ); #endif RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 ); #ifndef STANDARD vec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 ); #else vec3 clearCoatRadiance = vec3( 0.0 ); #endif RE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight ); #endif `,tUe=`#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT) gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5; #endif`,rUe=`#ifdef USE_LOGDEPTHBUF uniform float logDepthBufFC; #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; #endif #endif `,iUe=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; #endif uniform float logDepthBufFC; #endif`,nUe=`#ifdef USE_LOGDEPTHBUF gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC; #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; #else gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w; #endif #endif `,aUe=`#ifdef USE_MAP vec4 texelColor = texture2D( map, vUv ); texelColor = mapTexelToLinear( texelColor ); diffuseColor *= texelColor; #endif `,oUe=`#ifdef USE_MAP uniform sampler2D map; #endif `,sUe=`#ifdef USE_MAP vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy ); diffuseColor *= mapTexelToLinear( mapTexel ); #endif `,lUe=`#ifdef USE_MAP uniform vec4 offsetRepeat; uniform sampler2D map; #endif `,uUe=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.r; #endif `,cUe=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,hUe=`#ifdef USE_MORPHNORMALS objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ]; objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ]; objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ]; objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ]; #endif `,fUe=`#ifdef USE_MORPHTARGETS #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif`,pUe=`#ifdef USE_MORPHTARGETS transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ]; transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ]; transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ]; transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ]; transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ]; transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ]; transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ]; #endif #endif `,dUe=`#ifdef DOUBLE_SIDED float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 ); #else float flipNormal = 1.0; #endif `,mUe=`#ifdef FLAT_SHADED vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ) * flipNormal; #endif #ifdef USE_NORMALMAP normal = perturbNormal2Arb( -vViewPosition, normal ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() ); #endif `,vUe=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( vUv.st ); vec2 st1 = dFdy( vUv.st ); vec3 S = normalize( q0 * st1.t - q1 * st0.t ); vec3 T = normalize( -q0 * st1.s + q1 * st0.s ); vec3 N = normalize( surf_norm ); vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; mapN.xy = normalScale * mapN.xy; mat3 tsn = mat3( S, T, N ); return normalize( tsn * mapN ); } #endif `,gUe=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 1.0 - 2.0 * rgb.xyz; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { return linearClipZ * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return (( near + viewZ ) * far ) / (( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * invClipZ - far ); } `,yUe=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif `,_Ue=`#ifdef USE_SKINNING vec4 mvPosition = modelViewMatrix * skinned; #else vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 ); #endif gl_Position = projectionMatrix * mvPosition; `,xUe=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.r; #endif `,SUe=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,MUe=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHTS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ]; #endif #if NUM_SPOT_LIGHTS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ]; #endif #if NUM_POINT_LIGHTS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ]; #endif #if NUM_RECT_AREA_LIGHTS > 0 #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) { const vec2 offset = vec2( 0.0, 1.0 ); vec2 texelSize = vec2( 1.0 ) / size; vec2 centroidUV = floor( uv * size + 0.5 ) / size; float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare ); float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare ); float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare ); float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare ); vec2 f = fract( uv * size + 0.5 ); float a = mix( lb, lt, f.y ); float b = mix( rb, rt, f.y ); float c = mix( a, b, f.x ); return c; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); bool inFrustum = all( inFrustumVec ); bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); bool frustumTest = all( frustumTestVec ); if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; return ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; return ( texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 9.0 ); #else return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return 1.0; } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); vec3 lightToPosition = shadowCoord.xyz; vec3 bd3D = normalize( lightToPosition ); float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0; #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif `,bUe=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHTS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ]; #endif #if NUM_SPOT_LIGHTS > 0 uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ]; #endif #if NUM_POINT_LIGHTS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ]; #endif #if NUM_RECT_AREA_LIGHTS > 0 #endif #endif `,wUe=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHTS > 0 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition; } #endif #if NUM_SPOT_LIGHTS > 0 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition; } #endif #if NUM_POINT_LIGHTS > 0 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition; } #endif #if NUM_RECT_AREA_LIGHTS > 0 #endif #endif `,TUe=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHTS > 0 DirectionalLight directionalLight; for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #endif #if NUM_SPOT_LIGHTS > 0 SpotLight spotLight; for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } #endif #if NUM_POINT_LIGHTS > 0 PointLight pointLight; for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0; } #endif #if NUM_RECT_AREA_LIGHTS > 0 #endif #endif return shadow; } `,EUe=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,AUe=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; #ifdef BONE_TEXTURE uniform sampler2D boneTexture; uniform int boneTextureWidth; uniform int boneTextureHeight; mat4 getBoneMatrix( const in float i ) { float j = i * 4.0; float x = mod( j, float( boneTextureWidth ) ); float y = floor( j / float( boneTextureWidth ) ); float dx = 1.0 / float( boneTextureWidth ); float dy = 1.0 / float( boneTextureHeight ); y = dy * ( y + 0.5 ); vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } #else uniform mat4 boneMatrices[ MAX_BONES ]; mat4 getBoneMatrix( const in float i ) { mat4 bone = boneMatrices[ int(i) ]; return bone; } #endif #endif `,CUe=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; skinned = bindMatrixInverse * skinned; #endif `,RUe=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #endif `,LUe=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,DUe=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,PUe=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif `,IUe=`#define saturate(a) clamp( a, 0.0, 1.0 ) uniform float toneMappingExposure; uniform float toneMappingWhitePoint; vec3 LinearToneMapping( vec3 color ) { return toneMappingExposure * color; } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } #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 ) ) vec3 Uncharted2ToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) ); } vec3 OptimizedCineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } `,NUe=`#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 ) varying vec2 vUv; #endif`,UUe=`#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 ) varying vec2 vUv; uniform vec4 offsetRepeat; #endif `,OUe=`#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 ) vUv = uv * offsetRepeat.zw + offsetRepeat.xy; #endif`,zUe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`,FUe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; #endif`,BUe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = uv2; #endif`,kUe=`#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP ) #ifdef USE_SKINNING vec4 worldPosition = modelMatrix * skinned; #else vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 ); #endif #endif `,VUe=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldPosition; #include void main() { gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) ); gl_FragColor.a *= opacity; } `,GUe=`varying vec3 vWorldPosition; #include void main() { vWorldPosition = transformDirection( position, modelMatrix ); #include #include } `,HUe=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( gl_FragCoord.z ); #endif } `,WUe=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include } `,XUe=`uniform vec3 lightPos; varying vec4 vWorldPosition; #include #include #include void main () { #include gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 ); } `,YUe=`varying vec4 vWorldPosition; #include #include #include #include void main() { #include #include #include #include #include #include #include vWorldPosition = worldPosition; } `,qUe=`uniform sampler2D tEquirect; uniform float tFlip; varying vec3 vWorldPosition; #include void main() { vec3 direction = normalize( vWorldPosition ); vec2 sampleUV; sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 ); sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5; gl_FragColor = texture2D( tEquirect, sampleUV ); } `,ZUe=`varying vec3 vWorldPosition; #include void main() { vWorldPosition = transformDirection( position, modelMatrix ); #include #include } `,jUe=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include } `,KUe=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include void main() { #include vLineDistance = scale * lineDistance; vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); gl_Position = projectionMatrix * mvPosition; #include #include } `,JUe=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include } `,$Ue=`#include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_ENVMAP #include #include #include #include #endif #include #include #include #include #include #include #include #include } `,QUe=`uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; varying vec3 vLightFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor ); #include reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ); #ifdef DOUBLE_SIDED reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; #else reflectedLight.directDiffuse = vLightFront; #endif reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask(); #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include } `,eOe=`#define LAMBERT varying vec3 vLightFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include } `,tOe=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include } `,rOe=`#define PHONG varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include } `,iOe=`#define PHYSICAL uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifndef STANDARD uniform float clearCoat; uniform float clearCoatRoughness; #endif varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include } `,nOe=`#define PHYSICAL varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include } `,aOe=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) varying vec3 vViewPosition; #endif #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include void main() { #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); #include #include } `,oOe=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) varying vec3 vViewPosition; #endif #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include void main() { #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif } `,sOe=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include } `,lOe=`uniform float size; uniform float scale; #include #include #include #include #include void main() { #include #include #include #ifdef USE_SIZEATTENUATION gl_PointSize = size * ( scale / - mvPosition.z ); #else gl_PointSize = size; #endif #include #include #include #include } `,uOe=`uniform float opacity; #include #include #include #include #include #include void main() { gl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) ); } `,cOe=`#include void main() { #include #include #include #include } `,jr={alphamap_fragment:pNe,alphamap_pars_fragment:dNe,alphatest_fragment:mNe,aomap_fragment:vNe,aomap_pars_fragment:gNe,begin_vertex:yNe,beginnormal_vertex:_Ne,bsdfs:xNe,bumpmap_pars_fragment:SNe,clipping_planes_fragment:MNe,clipping_planes_pars_fragment:bNe,clipping_planes_pars_vertex:wNe,clipping_planes_vertex:TNe,color_fragment:ENe,color_pars_fragment:ANe,color_pars_vertex:CNe,color_vertex:RNe,common:LNe,cube_uv_reflection_fragment:DNe,defaultnormal_vertex:PNe,displacementmap_pars_vertex:INe,displacementmap_vertex:NNe,emissivemap_fragment:UNe,emissivemap_pars_fragment:ONe,encodings_fragment:zNe,encodings_pars_fragment:FNe,envmap_fragment:BNe,envmap_pars_fragment:kNe,envmap_pars_vertex:VNe,envmap_vertex:GNe,fog_fragment:HNe,fog_pars_fragment:WNe,gradientmap_pars_fragment:XNe,lightmap_fragment:YNe,lightmap_pars_fragment:qNe,lights_lambert_vertex:ZNe,lights_pars:jNe,lights_phong_fragment:KNe,lights_phong_pars_fragment:JNe,lights_physical_fragment:$Ne,lights_physical_pars_fragment:QNe,lights_template:eUe,logdepthbuf_fragment:tUe,logdepthbuf_pars_fragment:rUe,logdepthbuf_pars_vertex:iUe,logdepthbuf_vertex:nUe,map_fragment:aUe,map_pars_fragment:oUe,map_particle_fragment:sUe,map_particle_pars_fragment:lUe,metalnessmap_fragment:uUe,metalnessmap_pars_fragment:cUe,morphnormal_vertex:hUe,morphtarget_pars_vertex:fUe,morphtarget_vertex:pUe,normal_flip:dUe,normal_fragment:mUe,normalmap_pars_fragment:vUe,packing:gUe,premultiplied_alpha_fragment:yUe,project_vertex:_Ue,roughnessmap_fragment:xUe,roughnessmap_pars_fragment:SUe,shadowmap_pars_fragment:MUe,shadowmap_pars_vertex:bUe,shadowmap_vertex:wUe,shadowmask_pars_fragment:TUe,skinbase_vertex:EUe,skinning_pars_vertex:AUe,skinning_vertex:CUe,skinnormal_vertex:RUe,specularmap_fragment:LUe,specularmap_pars_fragment:DUe,tonemapping_fragment:PUe,tonemapping_pars_fragment:IUe,uv_pars_fragment:NUe,uv_pars_vertex:UUe,uv_vertex:OUe,uv2_pars_fragment:zUe,uv2_pars_vertex:FUe,uv2_vertex:BUe,worldpos_vertex:kUe,cube_frag:VUe,cube_vert:GUe,depth_frag:HUe,depth_vert:WUe,distanceRGBA_frag:XUe,distanceRGBA_vert:YUe,equirect_frag:qUe,equirect_vert:ZUe,linedashed_frag:jUe,linedashed_vert:KUe,meshbasic_frag:JUe,meshbasic_vert:$Ue,meshlambert_frag:QUe,meshlambert_vert:eOe,meshphong_frag:tOe,meshphong_vert:rOe,meshphysical_frag:iOe,meshphysical_vert:nOe,normal_frag:aOe,normal_vert:oOe,points_frag:sOe,points_vert:lOe,shadow_frag:uOe,shadow_vert:cOe};Wt.prototype={constructor:Wt,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=fr.euclideanModulo(t,1),i=fr.clamp(i,0,1),n=fr.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(h){h!==void 0&&parseFloat(h)<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=hOe[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+(ithis.max.x||r.ythis.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 Tt;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.xthis.max.x||r.max.ythis.max.y)},clampPoint:function(r,e){var t=e||new Tt;return t.copy(r).clamp(this.min,this.max)},distanceToPoint:function(){var r=new Tt;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)}};dOe=0;_r.prototype={constructor:_r,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!==a_&&(t.blending=this.blending),this.shading!==zk&&(t.shading=this.shading),this.side!==y0&&(t.side=this.side),this.vertexColors!==bL&&(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(_r.prototype,pl.prototype);Na.prototype=Object.create(_r.prototype);Na.prototype.constructor=Na;Na.prototype.isShaderMaterial=!0;Na.prototype.copy=function(r){return _r.prototype.copy.call(this,r),this.fragmentShader=r.fragmentShader,this.vertexShader=r.vertexShader,this.uniforms=Yo.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};Na.prototype.toJSON=function(r){var e=_r.prototype.toJSON.call(this,r);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e};$f.prototype=Object.create(_r.prototype);$f.prototype.constructor=$f;$f.prototype.isMeshDepthMaterial=!0;$f.prototype.copy=function(r){return _r.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};Zu.prototype={constructor:Zu,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;sn&&(n=u),c>a&&(a=c),h>o&&(o=h)}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;sn&&(n=u),c>a&&(a=c),h>o&&(o=h)}this.min.set(e,t,i),this.max.set(n,a,o)},setFromPoints:function(r){this.makeEmpty();for(var e=0,t=r.length;ethis.max.x||r.ythis.max.y||r.zthis.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.xthis.max.x||r.max.ythis.max.y||r.max.zthis.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 fa;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)}};fa.prototype={constructor:fa,set:function(r,e){return this.center.copy(r),this.radius=e,this},setFromPoints:function(){var r=new Zu;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;othis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(r){var e=r||new Zu;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}};dl.prototype={constructor:dl,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;a1))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 dl;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}};kM.prototype={constructor:kM,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],h=t[8],f=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-h,_-g).normalize(),e[1].setComponents(o+i,c+s,d+h,_+g).normalize(),e[2].setComponents(o+n,c+l,d+f,_+m).normalize(),e[3].setComponents(o-n,c-l,d-f,_-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 fa;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 fa;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(a0?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}};Qf.prototype={constructor:Qf,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),h=-t.dot(e),f=t.lengthSq(),p=Math.abs(1-u*u),d,g,m,v;if(p>0)if(d=u*h-c,g=u*c-h,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*h)+f}else g=l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*h)+f;else g=-l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*h)+f;else g<=-v?(d=Math.max(0,-(-u*l+c)),g=d>0?-l:Math.min(Math.max(-l,-h),l),m=-d*d+g*(g+2*h)+f):g<=v?(d=0,g=Math.min(Math.max(-l,-h),l),m=g*(g+2*h)+f):(d=Math.max(0,-(u*l+c)),g=d>0?l:Math.min(Math.max(-l,-h),l),m=-d*d+g*(g+2*h)+f);else g=u>0?-l:l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*h)+f;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,h=this.origin;return l>=0?(t=(r.min.x-h.x)*l,i=(r.max.x-h.x)*l):(t=(r.max.x-h.x)*l,i=(r.min.x-h.x)*l),u>=0?(n=(r.min.y-h.y)*u,a=(r.max.y-h.y)*u):(n=(r.max.y-h.y)*u,a=(r.min.y-h.y)*u),t>a||n>i||((n>t||t!==t)&&(t=n),(a=0?(o=(r.min.z-h.z)*c,s=(r.max.z-h.z)*c):(o=(r.max.z-h.z)*c,s=(r.min.z-h.z)*c),t>s||o>i)||((o>t||t!==t)&&(t=o),(s=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),h;if(c>0){if(l)return null;h=1}else if(c<0)h=-1,c=-c;else return null;r.subVectors(this.origin,a);var f=h*this.direction.dot(t.crossVectors(r,t));if(f<0)return null;var p=h*this.direction.dot(e.cross(r));if(p<0||f+p>c)return null;var d=-h*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)}};ep.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];ep.DefaultOrder="XYZ";ep.prototype={constructor:ep,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=fr.clamp,n=r.elements,a=n[0],o=n[4],s=n[8],l=n[1],u=n[5],c=n[9],h=n[2],f=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(f,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(-h,a),this._z=0)):e==="ZXY"?(this._x=Math.asin(i(f,-1,1)),Math.abs(f)<.99999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,a))):e==="ZYX"?(this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(f,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(-h,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(f,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 Kt),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 cn;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(){}};$R.prototype={constructor:$R,set:function(r){this.mask=1<1){for(var e=0;e1)for(var e=0;e0){i.children=[];for(var n=0;n0&&(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 h=[];for(var f in c){var p=c[f];delete p.metadata,h.push(p)}return h}},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;t0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}();fl.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),h=r.dot(t),f=e.dot(e),p=e.dot(t),d=u*f-c*c,g=l||new oe;if(d===0)return g.set(-2,-1,-1);var m=1/d,v=(f*h-c*p)*m,_=(u*p-c*h)*m;return g.set(1-v-_,_,v)}}();fl.containsPoint=function(){var r=new oe;return function(t,i,n,a){var o=fl.barycoordFromPoint(t,i,n,a,r);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}();fl.prototype={constructor:fl,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 fl.normal(this.a,this.b,this.c,r)},plane:function(r){var e=r||new xs;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(r,e){return fl.barycoordFromPoint(r,this.a,this.b,this.c,e)},containsPoint:function(r){return fl.containsPoint(r,this.a,this.b,this.c)},closestPointToPoint:function(){var r,e,t,i;return function(a,o){r===void 0&&(r=new xs,e=[new rm,new rm,new rm],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;u0,a=i[1]&&i[1].length>0,o=r.morphTargets,s=o.length,l;if(s>0){l=[];for(var u=0;u0){f=[];for(var u=0;u0)for(var f=0;f0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var r,e,t;for(this.computeFaceNormals(),r=0,e=this.faces.length;r0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var r,e,t,i,n;for(t=0,i=this.faces.length;t0&&(r+=e[t].distanceTo(e[t-1])),this.lineDistances[t]=r},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new Zu),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new fa),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],h=this.colors,f=r.colors;t===void 0&&(t=0),e!==void 0&&(i=new dl().getNormalMatrix(e));for(var p=0,d=o.length;p=0;s--){var m=p[s];for(this.faces.splice(m,1),h=0,f=this.faceVertexUvs.length;h0,_=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,P){return P?R|1<0&&(r.data.colors=u),h.length>0&&(r.data.uvs=[h]),r.data.faces=o,r},clone:function(){return new ur().copy(this)},copy:function(r){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var e=r.vertices,t=0,i=e.length;t0){var t=new Float32Array(r.normals.length*3);this.addAttribute("normal",new Mt(t,3).copyVector3sArray(r.normals))}if(r.colors.length>0){var i=new Float32Array(r.colors.length*3);this.addAttribute("color",new Mt(i,3).copyColorsArray(r.colors))}if(r.uvs.length>0){var n=new Float32Array(r.uvs.length*2);this.addAttribute("uv",new Mt(n,2).copyVector2sArray(r.uvs))}if(r.uvs2.length>0){var a=new Float32Array(r.uvs2.length*2);this.addAttribute("uv2",new Mt(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 Mt(s,1).copyIndicesArray(r.indices))}this.groups=r.groups;for(var l in r.morphTargets){for(var u=[],c=r.morphTargets[l],h=0,f=c.length;h0){var g=new Mr(r.skinIndices.length*4,4);this.addAttribute("skinIndex",g.copyVector4sArray(r.skinIndices))}if(r.skinWeights.length>0){var m=new Mr(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 Zu);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 Zu,e=new oe;return function(){this.boundingSphere===null&&(this.boundingSphere=new fa);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;o0&&(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 Vt().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;o0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=r.length;ey.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),h.fromArray(S,C*2),b.uv=g(p,i,n,a,u,c,h)),b.face=new ws(w,T,C,fl.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,P=A.position.array;if(A.uv!==void 0&&(T=A.uv.array),R!==null)for(var U=R.array,B=0,z=U.length;B0&&(T=ae);for(var ve=0,ue=K.length;vea||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}});ZM.prototype=Object.assign(Object.create(Lt.prototype),{constructor:ZM,copy:function(r){Lt.prototype.copy.call(this,r,!1);for(var e=r.levels,t=0,i=e.length;t1){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=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;os)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);Tn.far||a.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,x=v.length/3-1;ys)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);Tn.far||a.push({distance:T,point:f.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;ys)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);Tn.far||a.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});yi.prototype=Object.assign(Object.create(rh.prototype),{constructor:yi,isLineSegments:!0});iu.prototype=Object.create(_r.prototype);iu.prototype.constructor=iu;iu.prototype.isPointsMaterial=!0;iu.prototype.copy=function(r){return _r.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.size=r.size,this.sizeAttenuation=r.sizeAttenuation,this};A0.prototype=Object.assign(Object.create(Lt.prototype),{constructor:A0,isPoints:!0,raycast:function(){var r=new Kt,e=new Qf,t=new fa;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),h=c*c,f=new oe;function p(w,T){var C=e.distanceSqToPoint(w);if(Cn.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;_=-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(Hn.area(t)>0)for(u=0;u2;){if(f--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?s:a;if(l=u,h<=l&&(l=0),u=l+1,h<=u&&(u=0),c=u+1,h<=c&&(c=0),r(t,l,u,c,h,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;v2&&y[x-1].equals(y[0])&&y.pop()}t(r),e.forEach(t);function i(y,x,M){return y.x!==x.x?y.xNumber.EPSILON){var U;if(A>0){if(P<0||P>A)return[];if(U=E*I-b*R,U<0||U>A)return[]}else{if(P>0||P0||Uve?[]: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 P=E*b-I*C;return R>0?A>=0&&P>=0:A>=0||P>=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;se0)return!0;return!1}var C=[];function b(ve,ue){var se,Ee,q,H,We;for(se=0;se0)return!0;return!1}for(var E,I,R,A,P,U,B=[],z,k,G,Y,J=0,Q=x.length;J0;){if(K--,K<0){console.log("Infinite Loop! Holes left:"+C.length+", Probably Hole outside Shape!");break}for(I=V;I=0)break;B[U]=!0}if(E>=0)break}}return M}for(var s,l,u,c,h,f,p={},d=r.concat(),g=0,m=e.length;gNumber.EPSILON){var Se=Math.sqrt(et),Ae=Math.sqrt(me*me+fe*fe),st=Ne.x-le/Se,$=Ne.y+ne/Se,nt=Ve.x-fe/Ae,Xe=Ve.y+me/Ae,Fe=((nt-st)*fe-(Xe-$)*me)/(ne*fe-le*me);dt=st+ne*Fe-Ue.x,F=$+le*Fe-Ue.y;var we=dt*dt+F*F;if(we<=2)return new Tt(dt,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(fe)&&(Ie=!0),Ie?(dt=-le,F=ne,L=Math.sqrt(et)):(dt=ne,F=le,L=Math.sqrt(et/2))}return new Tt(dt/L,F/L)}for(var J=[],Q=0,V=E.length,K=V-1,ae=Q+1;Q=0;R--){for(P=R/a,U=i*Math.cos(P*Math.PI/2),A=n*Math.sin(P*Math.PI/2),Q=0,V=E.length;Q=0;){Ve=Q,dt=Q-1,dt<0&&(dt=Ue.length-1);var F=0,L=l+a*2;for(F=0;F0||r.search(/^data\:image\/jpeg/)===0;n.format=s?x0:qu,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}});Bi.prototype=Object.assign(Object.create(Lt.prototype),{constructor:Bi,isLight:!0,copy:function(r){return Lt.prototype.copy.call(this,r),this.color.copy(r.color),this.intensity=r.intensity,this},toJSON:function(r){var e=Lt.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}});nL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:nL,isHemisphereLight:!0,copy:function(r){return Bi.prototype.copy.call(this,r),this.groundColor.copy(r.groundColor),this}});Object.assign(Am.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}});aL.prototype=Object.assign(Object.create(Am.prototype),{constructor:aL,isSpotLightShadow:!0,update:function(r){var e=fr.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())}});oL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:oL,isSpotLight:!0,copy:function(r){return Bi.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}});sL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:sL,isPointLight:!0,copy:function(r){return Bi.prototype.copy.call(this,r),this.distance=r.distance,this.decay=r.decay,this.shadow=r.shadow.clone(),this}});lL.prototype=Object.assign(Object.create(Am.prototype),{constructor:lL});uL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:uL,isDirectionalLight:!0,copy:function(r){return Bi.prototype.copy.call(this,r),this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}});cL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:cL,isAmbientLight:!0});ha={arraySlice:function(r,e,t){return ha.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)}}};Zo.prototype={constructor:Zo,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=n)){var s=e[1];r=n)break t}a=t,t=0;break r}break e}for(;t>>1;re;)--a;if(++a,n!==0||a!==i){n>=a&&(a=Math.max(a,1),n=a-1);var o=this.getValueSize();this.times=ha.arraySlice(t,n,a),this.values=ha.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&&ha.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()===YR,n=1,a=r.length-1,o=1;o0){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=ha.arraySlice(r,0,n),this.values=ha.arraySlice(e,0,n*t)),this}};X0.prototype=Object.assign(Object.create(ah),{constructor:X0,ValueTypeName:"vector"});pL.prototype=Object.assign(Object.create(Zo.prototype),{constructor:pL,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)cn.slerpFlat(n,0,a,s-o,a,s,l);return n}});gb.prototype=Object.assign(Object.create(ah),{constructor:gb,ValueTypeName:"quaternion",DefaultInterpolation:DM,InterpolantFactoryMethodLinear:function(r){return new pL(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodSmooth:void 0});Y0.prototype=Object.assign(Object.create(ah),{constructor:Y0,ValueTypeName:"number"});dL.prototype=Object.assign(Object.create(ah),{constructor:dL,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:OM,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});mL.prototype=Object.assign(Object.create(ah),{constructor:mL,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:OM,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});vL.prototype=Object.assign(Object.create(ah),{constructor:vL,ValueTypeName:"color"});xm.prototype=ah;ah.constructor=xm;Object.assign(xm,{parse:function(r){if(r.type===void 0)throw new Error("track type undefined, can not parse");var e=xm._getTrackTypeForValueTypeName(r.type);if(r.times===void 0){var t=[],i=[];ha.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:ha.convertArray(r.times,Array),values:ha.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 Y0;case"vector":case"vector2":case"vector3":case"vector4":return X0;case"color":return vL;case"quaternion":return gb;case"bool":case"boolean":return mL;case"string":return dL}throw new Error("Unsupported typeName: "+r)}});Ss.prototype={constructor:Ss,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;r1){var u=l[1],c=i[u];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var u in i)h.push(Ss.CreateFromMorphTargetSequence(u,i[u],e,t));return h},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=[];ha.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;l1?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 ii(f,p,d,g))}if(r.skinIndices)for(var c=0,h=r.skinIndices.length;c1?r.skinIndices[c+1]:0,_=u>2?r.skinIndices[c+2]:0,y=u>3?r.skinIndices[c+3]:0;t.skinIndices.push(new ii(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,h=r.morphTargets.length;c0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var v=t.faces,_=r.morphColors[0].colors,c=0,h=v.length;c0&&(t.animations=u)}if(r.materials===void 0||r.materials.length===0)return{geometry:t};var l=im.prototype.initMaterials(r.materials,e,this.crossOrigin);return{geometry:t,materials:l}}});Object.assign(Pse.prototype,{load:function(r,e,t,i){this.texturePath===""&&(this.texturePath=r.substring(0,r.lastIndexOf("/")+1));var n=this,a=new vl(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 aV,i=new nV,n=0,a=r.length;n0){var a=new tV(e),o=new Eb(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,l=r.length;s0?a=new tL(l,u):a=new _n(l,u);break;case"LOD":a=new ZM;break;case"Line":a=new rh(o(t.geometry),s(t.material),t.mode);break;case"LineSegments":a=new yi(o(t.geometry),s(t.material));break;case"PointCloud":case"Points":a=new A0(o(t.geometry),s(t.material));break;case"Sprite":a=new qM(s(t.material));break;case"Group":a=new jM;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new Lt}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 h=t.levels,f=0;f0)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],h=c-u,f=(a-u)/h,p=(i+f)/(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 Kt,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 h=Number.MAX_VALUE,f=Math.abs(i[0].x),p=Math.abs(i[0].y),d=Math.abs(i[0].z);for(f<=h&&(h=f,t.set(1,0,0)),p<=h&&(h=p,t.set(0,1,0)),d<=h&&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(fr.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(fr.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}}};da.create=function(r,e){return r.prototype=Object.create(da.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};Ku.prototype=Object.create(da.prototype);Ku.prototype.constructor=Ku;Ku.prototype.isLineCurve=!0;Ku.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};Ku.prototype.getPointAt=function(r){return this.getPoint(r)};Ku.prototype.getTangent=function(r){var e=this.v2.clone().sub(this.v1);return e.normalize()};yb.prototype=Object.assign(Object.create(da.prototype),{constructor:yb,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 Ku(e,r))},getPoint:function(r){for(var e=r*this.getLength(),t=this.getCurveLengths(),i=0;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;t1&&!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 ur,t=0,i=r.length;te;)t-=e;te.length-2?e.length-1:i+1],l=e[i>e.length-3?e.length-1:i+2],u=Ab.interpolate;return new Tt(u(a.x,o.x,s.x,l.x,n),u(a.y,o.y,s.y,l.y,n))};Mm.prototype=Object.create(da.prototype);Mm.prototype.constructor=Mm;Mm.prototype.getPoint=function(r){var e=Hn.b3;return new Tt(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))};Mm.prototype.getTangent=function(r){var e=Ab.tangentCubicBezier;return new Tt(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()};bm.prototype=Object.create(da.prototype);bm.prototype.constructor=bm;bm.prototype.getPoint=function(r){var e=Hn.b2;return new Tt(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y))};bm.prototype.getTangent=function(r){var e=Ab.tangentQuadraticBezier;return new Tt(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y)).normalize()};oV=Object.assign(Object.create(yb.prototype),{fromPoints:function(r){this.moveTo(r[0].x,r[0].y);for(var e=1,t=r.length;e0){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)}});nm.prototype=Object.assign(Object.create(oV),{constructor:nm,getPointsHoles:function(r){for(var e=[],t=0,i=this.holes.length;tNumber.EPSILON){if(V<0&&(Y=U[G],Q=-Q,J=U[k],V=-V),P.yJ.y)continue;if(P.y===Y.y){if(P.x===Y.x)return!0}else{var K=V*(P.x-Y.x)-Q*(P.y-Y.y);if(K===0)return!0;if(K<0)continue;z=!z}}else{if(P.y!==Y.y)continue;if(J.x<=P.x&&P.x<=Y.x||Y.x<=P.x&&P.x<=J.x)return!0}}return z}var n=Hn.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 nm,l.curves=s.curves,u.push(l),u;var c=!n(a[0].getPoints());c=r?!c:c;var h=[],f=[],p=[],d=0,g;f[d]=void 0,p[d]=[];for(var m=0,v=a.length;m1){for(var _=!1,y=[],x=0,M=f.length;x0&&(_||(p=h))}for(var E,m=0,I=f.length;m0){this.source.connect(this.filters[0]);for(var r=1,e=this.filters.length;r0){this.source.disconnect(this.filters[0]);for(var r=1,e=this.filters.length;r=.5)for(var a=0;a!==n;++a)r[e+a]=r[t+a]},_slerp:function(r,e,t,i,n){cn.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}}};Ii.prototype={constructor:Ii,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=Ii.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=t){var h=t++,f=e[h];i[f.uuid]=c,e[c]=f,i[u]=h,e[h]=l;for(var p=0,d=a;p!==d;++p){var g=n[p],m=g[h],v=g[c];g[c]=m,g[h]=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,h=n[c];if(h!==void 0)if(delete n[c],h0)for(var l=this._interpolants,u=this._propertyBindings,c=0,h=l.length;c!==h;++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===lse){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===cse;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=em,i.endingEnd=em):(r?i.endingStart=this.zeroSlopeAtStart?em:om:i.endingStart=zM,e?i.endingEnd=this.zeroSlopeAtEnd?em:om:i.endingEnd=zM)},_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(fV.prototype,pl.prototype,{clipAction:function(r,e){var t=e||this._root,i=t.uuid,n=typeof r=="string"?Ss.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 Ak(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"?Ss.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(fV.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 h=i[c],f=h.name,p=u[f];if(p!==void 0)a[c]=p;else{if(p=a[c],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,s,f));continue}var d=e&&e._propertyBindings[c].binding.parsedPath;p=new yL(Ii.create(t,f,d),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,f),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&&e1){var u=l[1];i[u]||(i[u]={start:1/0,end:-1/0});var c=i[u];ac.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};Wn.prototype.setAnimationDirectionForward=function(r){var e=this.animationsMap[r];e&&(e.direction=1,e.directionBackwards=!1)};Wn.prototype.setAnimationDirectionBackward=function(r){var e=this.animationsMap[r];e&&(e.direction=-1,e.directionBackwards=!0)};Wn.prototype.setAnimationFPS=function(r,e){var t=this.animationsMap[r];t&&(t.fps=e,t.duration=(t.end-t.start)/t.fps)};Wn.prototype.setAnimationDuration=function(r,e){var t=this.animationsMap[r];t&&(t.duration=e,t.fps=(t.end-t.start)/t.duration)};Wn.prototype.setAnimationWeight=function(r,e){var t=this.animationsMap[r];t&&(t.weight=e)};Wn.prototype.setAnimationTime=function(r,e){var t=this.animationsMap[r];t&&(t.time=e)};Wn.prototype.getAnimationTime=function(r){var e=0,t=this.animationsMap[r];return t&&(e=t.time),e};Wn.prototype.getAnimationDuration=function(r){var e=-1,t=this.animationsMap[r];return t&&(e=t.duration),e};Wn.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()")};Wn.prototype.stopAnimation=function(r){var e=this.animationsMap[r];e&&(e.active=!1)};Wn.prototype.update=function(r){for(var e=0,t=this.animationsList.length;ei.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+fr.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}}};_b.prototype=Object.create(Lt.prototype);_b.prototype.constructor=_b;_b.prototype.isImmediateRenderObject=!0;xb.prototype=Object.create(yi.prototype);xb.prototype.constructor=xb;xb.prototype.update=function(){var r=new oe,e=new oe,t=new dl;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,h=0,f=u.length;h.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))}}();Tm.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()};Tm.prototype.setColor=function(r){this.line.material.color.copy(r),this.cone.material.color.copy(r)};SL.prototype=Object.create(yi.prototype);SL.prototype.constructor=SL;pV=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,h){var f=(o-a)/u-(s-a)/(u+c)+(s-o)/c,p=(s-o)/c-(l-o)/(c+h)+(l-s)/h;f*=c,p*=c,this.init(o,s,f,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},da.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 h,f,p,d;if(this.closed||l>0?h=o[(l-1)%c]:(r.subVectors(o[0],o[1]).add(o[0]),h=r),f=o[l%c],p=o[(l+1)%c],this.closed||l+2e.length-2?e.length-1:i+1],l=e[i>e.length-3?e.length-1:i+2],u=Ab.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))}),VOe=da.create(function(r,e,t,i){this.v0=r,this.v1=e,this.v2=t,this.v3=i},function(r){var e=Hn.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))}),GOe=da.create(function(r,e,t){this.v0=r,this.v1=e,this.v2=t},function(r){var e=Hn.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))}),HOe=da.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});ML.prototype=Object.create(nh.prototype);ML.prototype.constructor=ML;WOe={createMultiMaterialObject:function(r,e){for(var t=new jM,i=0,n=e.length;i{"use strict";var x3e=PL&&PL.__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)},Gr=(Bse(),$se(Fse)),Ti={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},kse={type:"change"},dV={type:"start"},mV={type:"end"},Vse=1e-6,S3e=function(r){x3e(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 Gr.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:Gr.MOUSE.LEFT,ZOOM:Gr.MOUSE.MIDDLE,PAN:Gr.MOUSE.RIGHT},a.target0=a.target.clone(),a.position0=a.object.position.clone(),a.zoom0=a.object.zoom,a.updateOffset=new Gr.Vector3,a.updateQuat=new Gr.Quaternion().setFromUnitVectors(t.up,new Gr.Vector3(0,1,0)),a.updateQuatInverse=a.updateQuat.clone().inverse(),a.updateLastPosition=new Gr.Vector3,a.updateLastQuaternion=new Gr.Quaternion,a.state=Ti.NONE,a.scale=1,a.spherical=new Gr.Spherical,a.sphericalDelta=new Gr.Spherical,a.panOffset=new Gr.Vector3,a.zoomChanged=!1,a.rotateStart=new Gr.Vector2,a.rotateEnd=new Gr.Vector2,a.rotateDelta=new Gr.Vector2,a.panStart=new Gr.Vector2,a.panEnd=new Gr.Vector2,a.panDelta=new Gr.Vector2,a.dollyStart=new Gr.Vector2,a.dollyEnd=new Gr.Vector2,a.dollyDelta=new Gr.Vector2,a.panLeftV=new Gr.Vector3,a.panUpV=new Gr.Vector3,a.panInternalOffset=new Gr.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=Ti.ROTATE}else if(o.button===a.mouseButtons.ZOOM){if(a.enableZoom===!1)return;a.dollyStart.set(o.clientX,o.clientY),a.state=Ti.DOLLY}else if(o.button===a.mouseButtons.PAN){if(a.enablePan===!1)return;a.panStart.set(o.clientX,o.clientY),a.state=Ti.PAN}a.state!==Ti.NONE&&(document.addEventListener("mousemove",a.onMouseMove,!1),document.addEventListener("mouseup",a.onMouseUp,!1),a.dispatchEvent(dV))}},a.onMouseMove=function(o){if(a.enabled!==!1){if(o.preventDefault(),a.state===Ti.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===Ti.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===Ti.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(mV),a.state=Ti.NONE)},a.onMouseWheel=function(o){a.enabled===!1||a.enableZoom===!1||a.state!==Ti.NONE&&a.state!==Ti.ROTATE||(o.preventDefault(),o.stopPropagation(),o.deltaY<0?a.dollyOut(a.getZoomScale()):o.deltaY>0&&a.dollyIn(a.getZoomScale()),a.update(),a.dispatchEvent(dV),a.dispatchEvent(mV))},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=Ti.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=Ti.TOUCH_DOLLY}break;case 3:{if(a.enablePan===!1)return;a.panStart.set(o.touches[0].pageX,o.touches[0].pageY),a.state=Ti.TOUCH_PAN}break;default:a.state=Ti.NONE}a.state!==Ti.NONE&&a.dispatchEvent(dV)}},a.onTouchMove=function(o){if(a.enabled!==!1)switch(o.preventDefault(),o.stopPropagation(),o.touches.length){case 1:{if(a.enableRotate===!1||a.state!==Ti.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!==Ti.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!==Ti.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=Ti.NONE}},a.onTouchEnd=function(o){a.enabled!==!1&&(a.dispatchEvent(mV),a.state=Ti.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===Ti.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)>Vse||8*(1-this.updateLastQuaternion.dot(this.object.quaternion))>Vse?(this.dispatchEvent(kse),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 Gr.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 Gr.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 Gr.PerspectiveCamera?this.scale/=t:this.object instanceof Gr.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 Gr.PerspectiveCamera?this.scale*=t:this.object instanceof Gr.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(kse),this.update(),this.state=Ti.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}(Gr.EventDispatcher);PL.OrbitControls=S3e});var KL=function(r,e){return KL=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])},KL(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");KL(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Qse=function(){function r(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return r}(),ele=function(){function r(){this.browser=new Qse,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}(),lp=new ele;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(lp.wxa=!0,lp.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?lp.worker=!0:typeof navigator>"u"||navigator.userAgent.indexOf("Node.js")===0?(lp.node=!0,lp.svgSupported=!0):tle(navigator.userAgent,lp);function tle(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 Bt=lp;var Vb=12,JL="sans-serif",Jo=Vb+"px "+JL,rle=20,ile=100,nle="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function ale(r){var e={};if(typeof JSON>"u")return e;for(var t=0;t=0)s=o*t.length;else for(var l=0;l>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(),h=2*u,f=c.left,p=c.top;o.push(f,p),l=l&&a&&f===a[h]&&p===a[h+1],s.push(r[u].offsetLeft,r[u].offsetTop)}return l&&n?n:(e.srcCoords=o,e[i]=t?i2(s,o):i2(o,s))}function a2(r){return r.nodeName.toUpperCase()==="CANVAS"}var Mle=/([&<>"'])/g,ble={"&":"&","<":"<",">":">",'"':""","'":"'"};function Tn(r){return r==null?"":(r+"").replace(Mle,function(e,t){return ble[t]})}var wle=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,o2=[],Tle=Bt.browser.firefox&&+Bt.browser.version.split(".")[0]<39;function Kb(r,e,t,i){return t=t||{},i?iG(r,e,t):Tle&&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):iG(r,e,t),t}function iG(r,e,t){if(Bt.domSupported&&r.getBoundingClientRect){var i=e.clientX,n=e.clientY;if(a2(r)){var a=r.getBoundingClientRect();t.zrX=i-a.left,t.zrY=n-a.top;return}else if(jb(o2,r,i,n)){t.zrX=o2[0],t.zrY=o2[1];return}}t.zrX=t.zrY=0}function Jb(r){return r||window.event}function fo(r,e,t){if(e=Jb(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&&Kb(r,o,e,t)}else{Kb(r,e,e,t);var a=Ele(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&wle.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function Ele(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 x_(r,e,t,i){r.addEventListener(e,t,i)}function nG(r,e,t,i){r.removeEventListener(e,t,i)}var po=function(r){r.preventDefault(),r.stopPropagation(),r.cancelBubble=!0};function s2(r){return r.which===2||r.which===3}var oG=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;o1&&i&&i.length>1){var a=aG(i)/aG(n);!isFinite(a)&&(a=1),e.pinchScale=a;var o=Ale(i);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:r[0].target,event:e}}}}};function Ci(){return[1,0,0,1,0,0]}function vh(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function S_(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 mo(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 En(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 vo(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),h=Math.cos(t);return r[0]=n*h+s*c,r[1]=-n*c+s*h,r[2]=a*h+l*c,r[3]=-a*c+h*l,r[4]=h*(o-i[0])+c*(u-i[1])+i[0],r[5]=h*(u-i[1])-c*(o-i[0])+i[1],r}function Fm(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 Ls(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 sG(r){var e=Ci();return S_(e,r),e}var Cle=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}(),zt=Cle;var $b=Math.min,Qb=Math.max,fp=new zt,pp=new zt,dp=new zt,mp=new zt,M_=new zt,b_=new zt,Rle=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=$b(e.x,this.x),i=$b(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Qb(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Qb(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=Ci();return En(a,a,[-t.x,-t.y]),Fm(a,a,[i,n]),En(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,h=e.y+e.height,f=!(ad&&(d=y,gd&&(d=x,v<_?zt.set(b_,0,-v):zt.set(b_,0,_)):y=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}fp.x=dp.x=t.x,fp.y=mp.y=t.y,pp.x=mp.x=t.x+t.width,pp.y=dp.y=t.y+t.height,fp.transform(i),mp.transform(i),pp.transform(i),dp.transform(i),e.x=$b(fp.x,pp.x,dp.x,mp.x),e.y=$b(fp.y,pp.y,dp.y,mp.y);var l=Qb(fp.x,pp.x,dp.x,mp.x),u=Qb(fp.y,pp.y,dp.y,mp.y);e.width=l-e.x,e.height=u-e.y},r}(),ft=Rle;var uG="silent";function Lle(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:Dle}}function Dle(){po(this.event)}var Ple=function(r){qt(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}(Ni),w_=function(){function r(e,t){this.x=e,this.y=t}return r}(),Ile=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],u2=new ft(0,0,0,0),cG=function(r){qt(e,r);function e(t,i,n,a,o){var s=r.call(this)||this;return s._hovered=new w_(0,0),s.storage=t,s.painter=i,s.painterRoot=a,s._pointerSize=o,n=n||new Ple,s.proxy=null,s.setHandlerProxy(n),s._draggingMgr=new eG(s),s}return e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(N(Ile,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=hG(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 w_(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 w_(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=Lle(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 w_(t,i);if(lG(a,o,t,i,n),this._pointerSize&&!o.target){for(var s=[],l=this._pointerSize,u=l/2,c=new ft(t-u,i-u,l,l),h=a.length-1;h>=0;h--){var f=a[h];f!==n&&!f.ignore&&!f.ignoreCoarsePointer&&(!f.parent||!f.parent.ignoreCoarsePointer)&&(u2.copy(f.getBoundingRect()),f.transform&&u2.applyTransform(f.transform),u2.intersect(c)&&s.push(f))}if(s.length)for(var p=4,d=Math.PI/12,g=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,r,e)}});function Nle(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?uG:!0}return!1}function lG(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=Nle(o,t,i))&&(!e.topTarget&&(e.topTarget=o),s!==uG)){e.target=o;break}}}function hG(r,e,t){var i=r.painter;return e<0||e>i.getWidth()||t<0||t>i.getHeight()}var fG=cG;var mG=32,T_=7;function Ule(r){for(var e=0;r>=mG;)e|=r&1,r>>=1;return r+e}function pG(r,e,t,i){var n=e+1;if(n===t)return 1;if(i(r[n++],r[e])<0){for(;n=0;)n++;return n-e}function Ole(r,e,t){for(t--;e>>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 c2(r,e,t,i,n,a){var o=0,s=0,l=1;if(a(r,e[t+n])>0){for(s=i-n;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}else{for(s=n+1;ls&&(l=s);var u=o;o=n-l,l=n-u}for(o++;o>>1);a(r,e[t+c])>0?o=c+1:l=c}return l}function h2(r,e,t,i,n,a){var o=0,s=0,l=1;if(a(r,e[t+n])<0){for(s=n+1;ls&&(l=s);var u=o;o=n-l,l=n-u}else{for(s=i-n;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}for(o++;o>>1);a(r,e[t+c])<0?l=c:o=c+1}return l}function zle(r,e){var t=T_,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])break;c(p)}}function u(){for(;a>1;){var p=a-2;p>0&&n[p-1]=T_||w>=T_);if(T)break;M<0&&(M=0),M+=2}if(t=M,t<1&&(t=1),d===1){for(v=0;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)=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-c2(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=T_||C>=T_);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;vs&&(l=s),dG(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 ki=1,gp=2,gh=4;var vG=!1;function f2(){vG||(vG=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function gG(r,e){return r.zlevel===e.zlevel?r.z===e.z?r.z2-e.z2:r.z-e.z:r.zlevel-e.zlevel}var Fle=function(){function r(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=gG}return r.prototype.traverse=function(e,t){for(var i=0;i0&&(c.__clipPaths=[]),isNaN(c.z)&&(f2(),c.z=0),isNaN(c.z2)&&(f2(),c.z2=0),isNaN(c.zlevel)&&(f2(),c.zlevel=0),this._displayList[this._displayListLen++]=c}var h=e.getDecalElement&&e.getDecalElement();h&&this._updateAndAddDisplayable(h,t,i);var f=e.getTextGuideLine();f&&this._updateAndAddDisplayable(f,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=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}(),yG=Fle;var _G;_G=Bt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(r){return setTimeout(r,16)};var E_=_G;var ew={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-ew.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?ew.bounceIn(r*2)*.5:ew.bounceOut(r*2-1)*.5+.5}},tw=ew;var rw=Math.pow,_h=Math.sqrt,nw=1e-8,SG=1e-4,xG=_h(3),iw=1/3,cu=uu(),Ds=uu(),Bm=uu();function yh(r){return r>-nw&&rnw||r<-nw}function vi(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 p2(r,e,t,i,n){var a=1-n;return 3*(((e-r)*a+2*(t-e)*n)*a+(i-t)*n*n)}function yp(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,h=s*l-9*o*u,f=l*l-3*s*u,p=0;if(yh(c)&&yh(h))if(yh(s))a[0]=0;else{var d=-l/s;d>=0&&d<=1&&(a[p++]=d)}else{var g=h*h-4*c*f;if(yh(g)){var m=h/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 _=_h(g),y=c*s+1.5*o*(-h+_),x=c*s+1.5*o*(-h-_);y<0?y=-rw(-y,iw):y=rw(y,iw),x<0?x=-rw(-x,iw):x=rw(x,iw);var d=(-s-(y+x))/(3*o);d>=0&&d<=1&&(a[p++]=d)}else{var M=(2*c*s-3*o*h)/(2*_h(c*c*c)),S=Math.acos(M)/3,w=_h(c),T=Math.cos(S),d=(-s-2*w*T)/(3*o),v=(-s+w*(T+xG*Math.sin(S)))/(3*o),C=(-s+w*(T-xG*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 aw(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(yh(o)){if(MG(a)){var u=-s/a;u>=0&&u<=1&&(n[l++]=u)}}else{var c=a*a-4*o*s;if(yh(c))n[0]=-a/(2*o);else if(c>0){var h=_h(c),u=(-a+h)/(2*o),f=(-a-h)/(2*o);u>=0&&u<=1&&(n[l++]=u),f>=0&&f<=1&&(n[l++]=f)}}return l}function Ps(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,h=(c-u)*n+u;a[0]=r,a[1]=o,a[2]=u,a[3]=h,a[4]=h,a[5]=c,a[6]=l,a[7]=i}function ow(r,e,t,i,n,a,o,s,l,u,c){var h,f=.005,p=1/0,d,g,m,v;cu[0]=l,cu[1]=u;for(var _=0;_<1;_+=.05)Ds[0]=vi(r,t,n,o,_),Ds[1]=vi(e,i,a,s,_),m=ec(cu,Ds),m=0&&m=0&&u<=1&&(n[l++]=u)}}else{var c=o*o-4*a*s;if(yh(c)){var u=-o/(2*a);u>=0&&u<=1&&(n[l++]=u)}else if(c>0){var h=_h(c),u=(-o+h)/(2*a),f=(-o-h)/(2*a);u>=0&&u<=1&&(n[l++]=u),f>=0&&f<=1&&(n[l++]=f)}}return l}function sw(r,e,t){var i=r+t-2*e;return i===0?.5:(r-e)/i}function xh(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 lw(r,e,t,i,n,a,o,s,l){var u,c=.005,h=1/0;cu[0]=o,cu[1]=s;for(var f=0;f<1;f+=.05){Ds[0]=xi(r,t,n,f),Ds[1]=xi(e,i,a,f);var p=ec(cu,Ds);p=0&&p=1?1:yp(0,i,a,1,l,s)&&vi(0,n,o,1,s[0])}}}var kle=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||zr,this.ondestroy=e.ondestroy||zr,this.onrestart=e.onrestart||zr,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:tw[e]||km(e)},r}(),EG=kle;var AG=function(){function r(e){this.value=e}return r}();var Vle=function(){function r(){this._len=0}return r.prototype.insert=function(e){var t=new AG(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 Gle=function(){function r(e){this._list=new Vle,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 AG(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}(),tc=Gle;var CG={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 _l(r){return r=Math.round(r),r<0?0:r>255?255:r}function Hle(r){return r=Math.round(r),r<0?0:r>360?360:r}function R_(r){return r<0?0:r>1?1:r}function d2(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?_l(parseFloat(e)/100*255):_l(parseInt(e,10))}function _p(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?R_(parseFloat(e)/100):R_(parseFloat(e))}function m2(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 Sh(r,e,t){return r+(e-r)*t}function Is(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function v2(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}var LG=new tc(20),uw=null;function Vm(r,e){uw&&v2(uw,e),uw=LG.put(r,uw||e.slice())}function pn(r,e){if(r){e=e||[];var t=LG.get(r);if(t)return v2(e,t);r=r+"";var i=r.replace(/ /g,"").toLowerCase();if(i in CG)return v2(e,CG[i]),Vm(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)){Is(e,0,0,0,1);return}return Is(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),Vm(r,e),e}else if(n===7||n===9){var a=parseInt(i.slice(1,7),16);if(!(a>=0&&a<=16777215)){Is(e,0,0,0,1);return}return Is(e,(a&16711680)>>16,(a&65280)>>8,a&255,n===9?parseInt(i.slice(7),16)/255:1),Vm(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?Is(e,+u[0],+u[1],+u[2],1):Is(e,0,0,0,1);c=_p(u.pop());case"rgb":if(u.length>=3)return Is(e,d2(u[0]),d2(u[1]),d2(u[2]),u.length===3?c:_p(u[3])),Vm(r,e),e;Is(e,0,0,0,1);return;case"hsla":if(u.length!==4){Is(e,0,0,0,1);return}return u[3]=_p(u[3]),g2(u,e),Vm(r,e),e;case"hsl":if(u.length!==3){Is(e,0,0,0,1);return}return g2(u,e),Vm(r,e),e;default:return}}Is(e,0,0,0,1)}}function g2(r,e){var t=(parseFloat(r[0])%360+360)%360/360,i=_p(r[1]),n=_p(r[2]),a=n<=.5?n*(i+1):n+i-n*i,o=n*2-a;return e=e||[],Is(e,_l(m2(o,a,t+1/3)*255),_l(m2(o,a,t)*255),_l(m2(o,a,t-1/3)*255),1),r.length===4&&(e[3]=r[3]),e}function Wle(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,h=((a-t)/6+o/2)/o,f=((a-i)/6+o/2)/o;e===a?l=f-h:t===a?l=1/3+c-f:i===a&&(l=2/3+h-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 cw(r,e){var t=pn(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 Ns(t,t.length===4?"rgba":"rgb")}}function hw(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]=_l(Sh(o[0],s[0],l)),t[1]=_l(Sh(o[1],s[1],l)),t[2]=_l(Sh(o[2],s[2],l)),t[3]=R_(Sh(o[3],s[3],l)),t}}function DG(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=pn(e[n]),s=pn(e[a]),l=i-n,u=Ns([_l(Sh(o[0],s[0],l)),_l(Sh(o[1],s[1],l)),_l(Sh(o[2],s[2],l)),R_(Sh(o[3],s[3],l))],"rgba");return t?{color:u,leftIndex:n,rightIndex:a,value:i}:u}}function xp(r,e,t,i){var n=pn(r);if(r)return n=Wle(n),e!=null&&(n[0]=Hle(e)),t!=null&&(n[1]=_p(t)),i!=null&&(n[2]=_p(i)),Ns(g2(n),"rgba")}function Sp(r,e){var t=pn(r);if(t&&e!=null)return t[3]=R_(e),Ns(t,"rgba")}function Ns(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 Gm(r,e){var t=pn(r);return t?(.299*t[0]+.587*t[1]+.114*t[2])*t[3]/255+(1-t[3])*e:0}var RG=new tc(100);function L_(r){if(Ce(r)){var e=RG.get(r);return e||(e=cw(r,-.1),RG.put(r,e)),e}else if(ph(r)){var t=he({},r);return t.colorStops=de(r.colorStops,function(i){return{offset:i.offset,color:cw(i.color,-.1)}}),t}return r}var pw=Math.round;function Mh(r){var e;if(!r||r==="transparent")r="none";else if(typeof r=="string"&&r.indexOf("rgba")>-1){var t=pn(r);t&&(r="rgb("+t[0]+","+t[1]+","+t[2]+")",e=t[3])}return{color:r,opacity:e??1}}var PG=1e-4;function hu(r){return r-PG}function fw(r){return pw(r*1e3)/1e3}function dw(r){return pw(r*1e4)/1e4}function IG(r){return"matrix("+fw(r[0])+","+fw(r[1])+","+fw(r[2])+","+fw(r[3])+","+dw(r[4])+","+dw(r[5])+")"}var NG={left:"start",right:"end",center:"middle",middle:"middle"};function UG(r,e,t){return t==="top"?r+=e/2:t==="bottom"&&(r-=e/2),r}function OG(r){return r&&(r.shadowBlur||r.shadowOffsetX||r.shadowOffsetY)}function zG(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 _2(r){return r&&!!r.image}function Xle(r){return r&&!!r.svgElement}function D_(r){return _2(r)||Xle(r)}function mw(r){return r.type==="linear"}function vw(r){return r.type==="radial"}function gw(r){return r&&(r.type==="linear"||r.type==="radial")}function P_(r){return"url(#"+r+")"}function yw(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 _w(r){var e=r.x||0,t=r.y||0,i=(r.rotation||0)*Im,n=mt(r.scaleX,1),a=mt(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("+pw(o*Im)+"deg, "+pw(s*Im)+"deg)"),l.join(" ")}var FG=function(){return Bt.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 S2=Array.prototype.slice;function rc(r,e,t){return(e-r)*t+r}function x2(r,e,t,i){for(var n=e.length,a=0;ai?e:r,a=Math.min(t,i),o=n[a-1]||{color:[0,0,0,0],offset:0},s=a;so;if(s)i.length=o;else for(var l=a;l=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=kG,l=t;if(di(t)){var u=jle(t);s=u,(u===1&&!Dt(t[0])||u===2&&!Dt(t[0][0]))&&(o=!0)}else if(Dt(t)&&!dh(t))s=Sw;else if(Ce(t))if(!isNaN(+t))s=Sw;else{var c=pn(t);c&&(l=c,s=N_)}else if(ph(t)){var h=he({},l);h.colorStops=de(t.colorStops,function(p){return{offset:p.offset,color:pn(p.color)}}),mw(t)?s=M2:vw(t)&&(s=b2),l=h}a===0?this.valType=s:(s!==this.valType||s===kG)&&(o=!0),this.discrete=this.discrete||o;var f={time:e,value:l,rawValue:t,percent:0};return i&&(f.easing=i,f.easingFunc=He(i)?i:tw[i]||km(i)),n.push(f),f},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=Mw(n),u=VG(n),c=0;c=0&&!(o[c].percent<=t);c--);c=f(c,s-2)}else{for(c=h;ct);c++);c=f(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:f((t-p.percent)/m,1);d.easingFunc&&(v=d.easingFunc(v));var _=i?this._additiveValue:u?I_:e[l];if((Mw(a)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)e[l]=v<1?p.rawValue:d.rawValue;else if(Mw(a))a===ww?x2(_,p[n],d[n],v):Yle(_,p[n],d[n],v);else if(VG(a)){var y=p[n],x=d[n],M=a===M2;e[l]={type:M?"linear":"radial",x:rc(y.x,x.x,v),y:rc(y.y,x.y,v),colorStops:de(y.colorStops,function(w,T){var C=x.colorStops[T];return{offset:rc(w.offset,C.offset,v),color:bw(x2([],w.color,C.color,v))}}),global:x.global},M?(e[l].x2=rc(y.x2,x.x2,v),e[l].y2=rc(y.y2,x.y2,v)):e[l].r=rc(y.r,x.r,v)}else if(u)x2(_,p[n],d[n],v),i||(e[l]=bw(_));else{var S=rc(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===Sw?e[i]=e[i]+n:t===N_?(pn(e[i],I_),xw(I_,I_,n,1),e[i]=bw(I_)):t===ww?xw(e[i],e[i],n,1):t===GG&&BG(e[i],e[i],n,1)},r}(),Jle=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){up("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,At(t),i)},r.prototype.whenWithKeys=function(e,t,i,n){for(var a=this._tracks,o=0;o0&&l.addKeyframe(0,Mp(u),n),this._trackKeys.push(s)}l.addKeyframe(e,Mp(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;i0)){this._started=1;for(var t=this,i=[],n=this._maxTime||0,a=0;a1){var s=o.pop();a.addKeyframe(s.time,e[n]),a.prepare(this._maxTime,a.getAdditiveTrack())}}}},r}(),U_=Jle;function bp(){return new Date().getTime()}var $le=function(r){qt(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=bp()-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&&(E_(i),!t._paused&&t.update())}E_(i)},e.prototype.start=function(){this._running||(this._time=bp(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=bp(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=bp()-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 U_(t,i.loop);return this.addAnimator(n),n},e}(Ni),HG=$le;var Qle=300,w2=Bt.domSupported,T2=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}}(),WG={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},XG=!1;function C2(r){var e=r.pointerType;return e==="pen"||e==="touch"}function eue(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 E2(r){r&&(r.zrByTouch=!0)}function tue(r,e){return fo(r.dom,new rue(r,e),!0)}function qG(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 rue=function(){function r(e,t){this.stopPropagation=zr,this.stopImmediatePropagation=zr,this.preventDefault=zr,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return r}(),xl={mousedown:function(r){r=fo(this.dom,r),this.__mayPointerCapture=[r.zrX,r.zrY],this.trigger("mousedown",r)},mousemove:function(r){r=fo(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=fo(this.dom,r),this.__togglePointerCapture(!1),this.trigger("mouseup",r)},mouseout:function(r){r=fo(this.dom,r);var e=r.toElement||r.relatedTarget;qG(this,e)||(this.__pointerCapturing&&(r.zrEventControl="no_globalout"),this.trigger("mouseout",r))},wheel:function(r){XG=!0,r=fo(this.dom,r),this.trigger("mousewheel",r)},mousewheel:function(r){XG||(r=fo(this.dom,r),this.trigger("mousewheel",r))},touchstart:function(r){r=fo(this.dom,r),E2(r),this.__lastTouchMoment=new Date,this.handler.processGesture(r,"start"),xl.mousemove.call(this,r),xl.mousedown.call(this,r)},touchmove:function(r){r=fo(this.dom,r),E2(r),this.handler.processGesture(r,"change"),xl.mousemove.call(this,r)},touchend:function(r){r=fo(this.dom,r),E2(r),this.handler.processGesture(r,"end"),xl.mouseup.call(this,r),+new Date-+this.__lastTouchMoment$G||r<-$G}var Ep=[],Hm=[],L2=Ci(),D2=Math.abs,oue=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 Tp(this.rotation)||Tp(this.x)||Tp(this.y)||Tp(this.scaleX-1)||Tp(this.scaleY-1)||Tp(this.skewX)||Tp(this.skewY)},r.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),i=this.transform;if(!(t||e)){i&&(JG(i),this.invTransform=null);return}i=i||Ci(),t?this.getLocalTransform(i):JG(i),e&&(t?mo(i,e,i):S_(i,e)),this.transform=i,this._resolveGlobalScaleRatio(i)},r.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(Ep);var i=Ep[0]<0?-1:1,n=Ep[1]<0?-1:1,a=((Ep[0]-i)*t+i)/Ep[0]||0,o=((Ep[1]-n)*t+n)/Ep[1]||0;e[0]*=a,e[1]*=a,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||Ci(),Ls(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||Ci(),mo(Hm,e.invTransform,t),t=Hm);var i=this.originX,n=this.originY;(i||n)&&(L2[4]=i,L2[5]=n,mo(Hm,t,L2),Hm[4]-=i,Hm[5]-=n,t=Hm),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&&mi(i,i,n),i},r.prototype.transformCoordToGlobal=function(e,t){var i=[e,t],n=this.transform;return n&&mi(i,i,n),i},r.prototype.getLineScale=function(){var e=this.transform;return e&&D2(e[0]-1)>1e-10&&D2(e[3]-1)>1e-10?Math.sqrt(D2(e[0]*e[3]-e[2]*e[1])):1},r.prototype.copyTransform=function(e){P2(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,h=e.y,f=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-f*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]=f*o,u&&vo(t,t,u),t[4]+=i+c,t[5]+=n+h,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}(),ts=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function P2(r,e){for(var t=0;t=0?parseFloat(r)/100*e:parseFloat(r):r}function Cp(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",h="top";if(i instanceof Array)l+=An(i[0],t.width),u+=An(i[1],t.height),c=null,h=null;else switch(i){case"left":l-=n,u+=s,c="right",h="middle";break;case"right":l+=n+o,u+=s,h="middle";break;case"top":l+=o/2,u-=n,c="center",h="bottom";break;case"bottom":l+=o/2,u+=a+n,c="center";break;case"inside":l+=o/2,u+=s,c="center",h="middle";break;case"insideLeft":l+=n,u+=s,h="middle";break;case"insideRight":l+=o-n,u+=s,c="right",h="middle";break;case"insideTop":l+=o/2,u+=n,c="center";break;case"insideBottom":l+=o/2,u+=a-n,c="center",h="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,h="bottom";break;case"insideBottomRight":l+=o-n,u+=a-n,c="right",h="bottom";break}return r=r||{},r.x=l,r.y=u,r.align=c,r.verticalAlign=h,r}var I2="__zr_normal__",N2=ts.concat(["ignore"]),sue=wn(ts,function(r,e){return r[e]=!0,r},{ignore:!1}),Ym={},lue=new ft(0,0,0,0),z2=function(){function r(e){this.id=Wb(),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=lue;i.layoutRect?c.copy(i.layoutRect):c.copy(this.getBoundingRect()),n||c.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Ym,i,c):Cp(Ym,i,c),a.x=Ym.x,a.y=Ym.y,o=Ym.align,s=Ym.verticalAlign;var h=i.origin;if(h&&i.rotation!=null){var f=void 0,p=void 0;h==="center"?(f=c.width*.5,p=c.height*.5):(f=An(h[0],c.width),p=An(h[1],c.height)),u=!0,a.originX=-a.x+f+(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|=ki,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()?F_:z_},r.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),i=typeof t=="string"&&pn(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,Ns(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||{},he(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=At(i),a=0;a0},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(I2,!1,e)},r.prototype.useState=function(e,t,i,n){var a=e===I2,o=this.hasState();if(!(!o&&a)){var s=this.currentStates,l=this.stateTransition;if(!(yt(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){up("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 h=this._textContent,f=this._textGuide;return h&&h.useState(e,t,i,c),f&&f.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&=~ki),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;l0,d);var g=this._textContent,m=this._textGuide;g&&g.useStates(e,t,f),m&&m.useStates(e,t,f),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!f&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~ki)}},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=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=yt(n,e),o=yt(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=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;o0&&t.during&&a[0].during(function(d,g){t.during(g)});for(var f=0;f0||n.force&&!o.length){var T=void 0,C=void 0,b=void 0;if(s){C={},f&&(T={});for(var x=0;x=0&&(n.splice(a,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,i){var n=yt(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=yt(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;n0&&(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;t0){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)?gue(r).match(/%$/)?parseFloat(r)/100*e:parseFloat(r):r==null?NaN:+r}function Pr(r,e,t){return e==null&&(e=10),e=Math.min(Math.max(0,e),lH),r=(+r).toFixed(e),t?r:+r}function Ri(r){return r.sort(function(e,t){return e-t}),r}function Cn(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 k2(r)}function k2(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 qm(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 uH(r,e,t){if(!r[e])return 0;var i=V2(r,t);return i[e]||0}function V2(r,e){var t=wn(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=wn(o,function(p,d){return p+d},0),l=de(n,function(p,d){return p-o[d]});su&&(u=l[h],c=h);++o[c],l[c]=0,++s}return de(o,function(p){return p/i})}function cH(r,e){var t=Math.max(Cn(r),Cn(e)),i=r+e;return t>lH?i:Pr(i,t)}var B_=9007199254740991;function k_(r){var e=Math.PI*2;return(r%e+e)%e}function ic(r){return r>-sH&&r=10&&e++,e}function jm(r,e){var t=Zm(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 Km(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 V_(r){r.sort(function(l,u){return s(l,u,0)?-1:1});for(var e=-1/0,t=1,i=0;i=0||a&&yt(a,l)<0)){var u=i.getShallow(l,e);u!=null&&(o[r[s][0]]=u)}}return o}}var Oue=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],zue=Mo(Oue),CH=function(){function r(){}return r.prototype.getAreaStyle=function(e,t){return zue(this,e,t)},r}();var Y2=new tc(50);function LH(r){if(typeof r=="string"){var e=Y2.get(r);return e&&e.image}else return r}function X_(r,e,t,i,n){if(r)if(typeof r=="string"){if(e&&e.__zrImageSrc===r||!t)return e;var a=Y2.get(r),o={hostEl:t,cb:i,cbPayload:n};return a?(e=a.image,!ev(e)&&a.pending.push(o)):(e=Zn.loadImage(r,RH,RH),e.__zrImageSrc=r,Y2.put(r,e.__cachedImgObj={image:e,pending:[o]})),e}else return r;else return e}function RH(){var r=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=o;l++)s-=o;var u=yo(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 IH(r,e){var t=e.containerWidth,i=e.font,n=e.contentWidth;if(!t)return"";var a=yo(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?kue(r,n,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(r.length*n/a):0;r=r.substr(0,s),a=yo(r,i)}return r===""&&(r=e.placeholder),r}function kue(r,e,t,i){for(var n=0,a=0,o=r.length;ap&&u){var d=Math.floor(p/s);h=h.slice(0,d)}if(r&&a&&c!=null)for(var g=PH(c,n,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),m=0;ms&&Z2(t,r.substring(s,u),e,o),Z2(t,l[2],e,o,l[1]),s=q2.lastIndex}sn){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=yo(S.text,b);else{if(R){var A=w.backgroundColor,P=A&&A.image;P&&(P=LH(P),ev(P)&&(S.width=Math.max(S.width,P.width*E/P.height)))}var U=d&&i!=null?i-x:null;U!=null&&U0&&d+i.accumWidth>i.width&&(c=e.split(` `),u=!0),i.accumWidth=d}else{var g=OH(e,l,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+p,h=g.linesWidths,c=g.lines}}else c=e.split(` `);for(var m=0;m=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var Wue=wn(",&?/;] ".split(""),function(r,e){return r[e]=!0,r},{});function Xue(r){return Hue(r)?!!Wue[r]:!0}function OH(r,e,t,i,n){for(var a=[],o=[],s="",l="",u=0,c=0,h=0;ht:n+c+p>t){c?(s||l)&&(d?(s||(s=l,l="",u=0,c=u),a.push(s),o.push(c-u),l+=f,u+=p,s="",c=u):(l&&(s+=l,l="",u=0),a.push(s),o.push(c),s=f,c=p)):d?(a.push(l),o.push(u),l=f,u=p):(a.push(f),o.push(p));continue}c+=p,d?(l+=f,u+=p):(l&&(s+=l,l="",u=0),s+=f)}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 J2="__zr_style_"+Math.round(Math.random()*10),pu={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},Dp={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};pu[J2]=!0;var zH=["z","z2","invisible"],Yue=["invisible"],que=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype._init=function(t){for(var i=At(t),n=0;n1e-4){s[0]=r-t,s[1]=e-i,l[0]=r+t,l[1]=e+i;return}if(Nw[0]=Q2(n)*t+r,Nw[1]=$2(n)*i+e,Uw[0]=Q2(a)*t+r,Uw[1]=$2(a)*i+e,u(s,Nw,Uw),c(l,Nw,Uw),n=n%Pp,n<0&&(n=n+Pp),a=a%Pp,a<0&&(a=a+Pp),n>a&&!o?a+=Pp:nn&&(Ow[0]=Q2(p)*t+r,Ow[1]=$2(p)*i+e,u(s,Ow,s),c(l,Ow,l))}var Xr={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Np=[],Up=[],du=[],Eh=[],mu=[],vu=[],tD=Math.min,rD=Math.max,Op=Math.cos,zp=Math.sin,nc=Math.abs,aD=Math.PI,Ah=aD*2,iD=typeof Float32Array<"u",Y_=[];function nD(r){var e=Math.round(r/aD*1e8)/1e8;return e%2*aD}function q_(r,e){var t=nD(r[0]);t<0&&(t+=Ah);var i=t-r[0],n=r[1];n+=i,!e&&n-t>=Ah?n=t+Ah:e&&t-n>=Ah?n=t-Ah:!e&&t>n?n=t+(Ah-nD(t-n)):e&&t0&&(this._ux=nc(i/wp/e)||0,this._uy=nc(i/wp/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(Xr.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=nc(e-this._xi),n=nc(t-this._yi),a=i>this._ux||n>this._uy;if(this.addData(Xr.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(Xr.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(Xr.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(),Y_[0]=n,Y_[1]=a,q_(Y_,o),n=Y_[0],a=Y_[1];var s=a-n;return this.addData(Xr.A,e,t,i,i,n,s,0,o?0:1),this._ctx&&this._ctx.arc(e,t,i,n,a,o),this._xi=Op(a)*i+e,this._yi=zp(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(Xr.R,e,t,i,n),this},r.prototype.closePath=function(){this._drawPendingPt(),this.addData(Xr.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)&&iD&&(this.data=new Float32Array(t));for(var i=0;ic.length&&(this._expandData(),c=this.data);for(var h=0;h0&&(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;t11&&(this.data=new Float32Array(e)))}},r.prototype.getBoundingRect=function(){du[0]=du[1]=mu[0]=mu[1]=Number.MAX_VALUE,Eh[0]=Eh[1]=vu[0]=vu[1]=-Number.MAX_VALUE;var e=this.data,t=0,i=0,n=0,a=0,o;for(o=0;oi||nc(y)>n||f===t-1)&&(g=Math.sqrt(_*_+y*y),a=m,o=v);break}case Xr.C:{var x=e[f++],M=e[f++],m=e[f++],v=e[f++],S=e[f++],w=e[f++];g=bG(a,o,x,M,m,v,S,w,10),a=S,o=w;break}case Xr.Q:{var x=e[f++],M=e[f++],m=e[f++],v=e[f++];g=TG(a,o,x,M,m,v,10),a=m,o=v;break}case Xr.A:var T=e[f++],C=e[f++],b=e[f++],E=e[f++],I=e[f++],R=e[f++],A=R+I;f+=1,d&&(s=Op(I)*b+T,l=zp(I)*E+C),g=rD(b,E)*tD(Ah,Math.abs(R)),a=Op(A)*b+T,o=zp(A)*E+C;break;case Xr.R:{s=a=e[f++],l=o=e[f++];var P=e[f++],U=e[f++];g=P*2+U*2;break}case Xr.Z:{var _=s-a,y=l-o;g=Math.sqrt(_*_+y*y),a=s,o=l;break}}g>=0&&(u[h++]=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,h,f,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;S0&&(e.lineTo(x,M),y=0),w){case Xr.M:s=u=i[S++],l=c=i[S++],e.moveTo(u,c);break;case Xr.L:{h=i[S++],f=i[S++];var C=nc(h-u),b=nc(f-c);if(C>n||b>a){if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;e.lineTo(u*(1-I)+h*I,c*(1-I)+f*I);break e}m+=E}e.lineTo(h,f),u=h,c=f,y=0}else{var R=C*C+b*b;R>y&&(x=h,M=f,y=R)}break}case Xr.C:{var A=i[S++],P=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;Ps(u,A,U,z,I,Np),Ps(c,P,B,k,I,Up),e.bezierCurveTo(Np[1],Up[1],Np[2],Up[2],Np[3],Up[3]);break e}m+=E}e.bezierCurveTo(A,P,U,B,z,k),u=z,c=k;break}case Xr.Q:{var A=i[S++],P=i[S++],U=i[S++],B=i[S++];if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;xh(u,A,U,I,Np),xh(c,P,B,I,Up),e.quadraticCurveTo(Np[1],Up[1],Np[2],Up[2]);break e}m+=E}e.quadraticCurveTo(A,P,U,B),u=U,c=B;break}case Xr.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=nc(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=Op(V)*J+G,l=zp(V)*Q+Y),u=Op(Ee)*J+G,c=zp(Ee)*Q+Y;break;case Xr.R:s=u=i[S],l=c=i[S+1],h=i[S++],f=i[S++];var H=i[S++],We=i[S++];if(p){var E=d[v++];if(m+E>_){var _e=_-m;e.moveTo(h,f),e.lineTo(h+tD(_e,H),f),_e-=H,_e>0&&e.lineTo(h+H,f+tD(_e,We)),_e-=We,_e>0&&e.lineTo(h+rD(H-_e,0),f+We),_e-=H,_e>0&&e.lineTo(h,f+rD(We-_e,0));break e}m+=E}e.rect(h,f,H,We);break;case Xr.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=Xr,r.initDefaultProps=function(){var e=r.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),r}(),$i=jue;function gu(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||or+s&&a>t+s||ae+h&&c>i+h&&c>a+h&&c>s+h||cr+h&&u>t+h&&u>n+h&&u>o+h||ue+u&&l>i+u&&l>a+u||lr+u&&s>t+u&&s>n+u||st||c+un&&(n+=Z_);var f=Math.atan2(l,s);return f<0&&(f+=Z_),f>=i&&f<=n||f+Z_>=i&&f+Z_<=n}function Os(r,e,t,i,n,a){if(a>e&&a>i||an?s:0}var Ch=$i.CMD,Fp=Math.PI*2,$ue=1e-4;function Que(r,e){return Math.abs(r-e)<$ue}var va=[-1,-1,-1],zs=[-1,-1];function ece(){var r=zs[0];zs[0]=zs[1],zs[1]=r}function tce(r,e,t,i,n,a,o,s,l,u){if(u>e&&u>i&&u>a&&u>s||u1&&ece(),p=vi(e,i,a,s,zs[0]),f>1&&(d=vi(e,i,a,s,zs[1]))),f===2?me&&s>i&&s>a||s=0&&u<=1){for(var c=0,h=xi(e,i,a,u),f=0;ft||s<-t)return 0;var l=Math.sqrt(t*t-s*s);va[0]=-l,va[1]=l;var u=Math.abs(i-n);if(u<1e-4)return 0;if(u>=Fp-1e-4){i=0,n=Fp;var c=a?1:-1;return o>=va[0]+r&&o<=va[1]+r?c:0}if(i>n){var h=i;i=n,n=h}i<0&&(i+=Fp,n+=Fp);for(var f=0,p=0;p<2;p++){var d=va[p];if(d+r>o){var g=Math.atan2(s,d),c=a?1:-1;g<0&&(g=Fp+g),(g>=i&&g<=n||g+Fp>=i&&g+Fp<=n)&&(g>Math.PI/2&&g1&&(t||(s+=Os(l,u,c,h,i,n))),m&&(l=a[d],u=a[d+1],c=l,h=u),g){case Ch.M:c=a[d++],h=a[d++],l=c,u=h;break;case Ch.L:if(t){if(gu(l,u,a[d],a[d+1],e,i,n))return!0}else s+=Os(l,u,a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Ch.C:if(t){if(XH(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=tce(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 Ch.Q:if(t){if(zw(l,u,a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=rce(l,u,a[d++],a[d++],a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Ch.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++]);f=Math.cos(M)*y+v,p=Math.sin(M)*x+_,m?(c=f,h=p):s+=Os(l,u,f,p,i,n);var T=(i-v)*x/y+v;if(t){if(ZH(v,_,x,M,M+S,w,e,T,n))return!0}else s+=ice(v,_,x,M,M+S,w,T,n);l=Math.cos(M+S)*y+v,u=Math.sin(M+S)*x+_;break;case Ch.R:c=l=a[d++],h=u=a[d++];var C=a[d++],b=a[d++];if(f=c+C,p=h+b,t){if(gu(c,h,f,h,e,i,n)||gu(f,h,f,p,e,i,n)||gu(f,p,c,p,e,i,n)||gu(c,p,c,h,e,i,n))return!0}else s+=Os(f,h,f,p,i,n),s+=Os(c,p,c,h,i,n);break;case Ch.Z:if(t){if(gu(l,u,c,h,e,i,n))return!0}else s+=Os(l,u,c,h,i,n);l=c,u=h;break}}return!t&&!Que(u,h)&&(s+=Os(l,u,c,h,i,n)||0),s!==0}function KH(r,e,t){return jH(r,0,!1,e,t)}function JH(r,e,t,i){return jH(r,e,!0,t,i)}var tv=Ye({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},pu),ace={style:Ye({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},Dp.style)},oD=ts.concat(["invisible","culling","z","z2","zlevel","parent"]),oce=function(r){qt(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.5?z_:i>.2?KG:F_}else if(t)return F_}return z_},e.prototype.getInsideTextStroke=function(t){var i=this.style.fill;if(Ce(i)){var n=this.__zr,a=!!(n&&n.isDarkMode()),o=Gm(t,0)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&gh)&&(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)),JH(s,l/u,t,i)))return!0}if(this.hasFill())return KH(s,t,i)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=gh,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:he(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&gh)},e.prototype.createStyle=function(t){return mh(tv,t)},e.prototype._innerSaveToNormal=function(t){r.prototype._innerSaveToNormal.call(this,t);var i=this._normalState;t.shape&&!i.shape&&(i.shape=he({},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=he({},n.shape),he(u,i.shape)):(u=he({},a?this.shape:n.shape),he(u,i.shape)):l&&(u=n.shape),u)if(o){this.shape=he({},this.shape);for(var c={},h=At(u),f=0;f0},e.prototype.hasFill=function(){var t=this.style,i=t.fill;return i!=null&&i!=="none"},e.prototype.createStyle=function(t){return mh(sce,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=fu(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}(Si);$H.prototype.type="tspan";var ac=$H;var lce=Ye({x:0,y:0},pu),uce={style:Ye({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},Dp.style)};function cce(r){return!!(r&&typeof r!="string"&&r.width&&r.height)}var QH=function(r){qt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.createStyle=function(t){return mh(lce,t)},e.prototype._getSize=function(t){var i=this.style,n=i[t];if(n!=null)return n;var a=cce(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 uce},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new ft(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(Si);QH.prototype.type="image";var Br=QH;function e4(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 h;s+l>n&&(h=s+l,s*=n/h,l*=n/h),u+c>n&&(h=u+c,u*=n/h,c*=n/h),l+u>a&&(h=l+u,l*=a/h,u*=a/h),s+c>a&&(h=s+c,s*=a/h,c*=a/h),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 rv=Math.round;function Fw(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&&(rv(i*2)===rv(n*2)&&(r.x1=r.x2=Rh(i,s,!0)),rv(a*2)===rv(o*2)&&(r.y1=r.y2=Rh(a,s,!0))),r}}function Bw(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=Rh(i,s,!0),r.y=Rh(n,s,!0),r.width=Math.max(Rh(i+a,s,!1)-r.x,a===0?0:1),r.height=Math.max(Rh(n+o,s,!1)-r.y,o===0?0:1)),r}}function Rh(r,e,t){if(!e)return r;var i=rv(r*2);return(i+rv(e))%2===0?i/2:(i+(t?1:-1))/2}var pce=function(){function r(){this.x=0,this.y=0,this.width=0,this.height=0}return r}();var dce={},t4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new pce},e.prototype.buildPath=function(t,i){var n,a,o,s;if(this.subPixelOptimize){var l=Bw(dce,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?e4(t,i):t.rect(n,a,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(pt);t4.prototype.type="rect";var Rt=t4;var r4={fill:"#000"},i4=2,mce={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},Dp.style)},h4=function(r){qt(e,r);function e(t){var i=r.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=r4,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;t0,I=t.width!=null&&(t.overflow==="truncate"||t.overflow==="break"||t.overflow==="breakAll"),R=o.calculatedLineHeight,A=0;A=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,h=a+n/2;c==="top"?h=a+t.height/2:c==="bottom"&&(h=a+n-t.height/2);var f=!t.isLineHolder&&sD(u);f&&this._renderBackground(u,i,s==="right"?o-t.width:s==="center"?o-t.width/2:o,h-t.height/2,t.width,t.height);var p=!!u.backgroundColor,d=t.textPadding;d&&(o=u4(o,s,d),h-=t.height/2-d[0]-t.innerHeight/2);var g=this._getOrCreateChild(ac),m=g.createStyle();g.useStyle(m);var v=this._defaultStyle,_=!1,y=0,x=l4("fill"in u?u.fill:"fill"in i?i.fill:(_=!0,v.fill)),M=s4("stroke"in u?u.stroke:"stroke"in i?i.stroke:!p&&!l&&(!v.autoStroke||_)?(y=i4,v.stroke):null),S=u.textShadowBlur>0||i.textShadowBlur>0;m.text=t.text,m.x=o,m.y=h,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||Jo,m.opacity=qi(u.opacity,i.opacity,1),a4(m,u),M&&(m.lineWidth=qi(u.lineWidth,i.lineWidth,y),m.lineDash=mt(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 ft(Wm(m.x,w,m.textAlign),Ap(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,h=l&&l.image,f=l&&!h,p=t.borderRadius,d=this,g,m;if(f||t.lineHeight||u&&c){g=this._getOrCreateChild(Rt),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(f){var _=g.style;_.fill=l||null,_.fillOpacity=mt(t.fillOpacity,1)}else if(h){m=this._getOrCreateChild(Br),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=mt(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=qi(t.opacity,i.opacity,1)},e.makeFont=function(t){var i="";return uD(t)&&(i=[t.fontStyle,t.fontWeight,lD(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),i&&Zi(i)||t.textFont||t.font},e}(Si),vce={left:!0,right:1,center:1},gce={top:1,bottom:1,middle:1},n4=["fontStyle","fontWeight","fontSize","fontFamily"];function lD(r){return typeof r=="string"&&(r.indexOf("px")!==-1||r.indexOf("rem")!==-1||r.indexOf("em")!==-1)?r:isNaN(+r)?Vb+"px":r+"px"}function a4(r,e){for(var t=0;t=0,a=!1;if(r instanceof pt){var o=y4(r),s=n&&o.selectFill||o.normalFill,l=n&&o.selectStroke||o.normalStroke;if(iv(s)||iv(l)){i=i||{};var u=i.style||{};u.fill==="inherit"?(a=!0,i=he({},i),u=he({},u),u.fill=s):!iv(u.fill)&&iv(s)?(a=!0,i=he({},i),u=he({},u),u.fill=L_(s)):!iv(u.stroke)&&iv(l)&&(a||(i=he({},i),u=he({},u)),u.stroke=L_(l)),i.style=u}}if(i&&i.z2==null){a||(i=he({},i));var c=r.z2EmphasisLift;i.z2=r.z2+(c??oc)}return i}function wce(r,e,t){if(t&&t.z2==null){t=he({},t);var i=r.z2SelectLift;t.z2=r.z2+(i??_ce)}return t}function Tce(r,e,t){var i=yt(r.currentStates,e)>=0,n=r.style.opacity,a=i?null:Mce(r,["opacity"],e,{opacity:1});t=t||{};var o=t.style||{};return o.opacity==null&&(t=he({},t),o=he({opacity:i?n:a.opacity*.1},o),t.style=o),t}function cD(r,e){var t=this.states[r];if(this.style){if(r==="emphasis")return bce(this,r,e,t);if(r==="blur")return Tce(this,r,t);if(r==="select")return wce(this,r,t)}return t}function Ml(r){r.stateProxy=cD;var e=r.getTextContent(),t=r.getTextGuideLine();e&&(e.stateProxy=cD),t&&(t.stateProxy=cD)}function m4(r,e){!M4(r,e)&&!r.__highByOuter&&sc(r,_4)}function v4(r,e){!M4(r,e)&&!r.__highByOuter&&sc(r,x4)}function jn(r,e){r.__highByOuter|=1<<(e||0),sc(r,_4)}function Kn(r,e){!(r.__highByOuter&=~(1<<(e||0)))&&sc(r,x4)}function Gw(r){sc(r,dD)}function Q_(r){sc(r,S4)}function mD(r){sc(r,xce)}function vD(r){sc(r,Sce)}function M4(r,e){return r.__highDownSilentOnTouch&&e.zrByTouch}function gD(r){var e=r.getModel(),t=[],i=[];e.eachComponent(function(n,a){var o=fD(a),s=n==="series",l=s?r.getViewOfSeriesModel(a):r.getViewOfComponentModel(a);!s&&i.push(l),o.isBlured&&(l.group.traverse(function(u){S4(u)}),s&&t.push(a)),o.isBlured=!1}),N(i,function(n){n&&n.toggleBlurSeries&&n.toggleBlurSeries(t,!1,e)})}function hD(r,e,t,i){var n=i.getModel();t=t||"coordinateSystem";function a(u,c){for(var h=0;h0){var l={dataIndex:s,seriesIndex:t.seriesIndex};o!=null&&(l.dataType=o),e.push(l)}})}),e}function yu(r,e,t){lc(r,!0),sc(r,Ml),Ww(r,e,t)}function Ece(r){lc(r,!1)}function sr(r,e,t,i){i?Ece(r):yu(r,e,t)}function Ww(r,e,t){var i=it(r);e!=null?(i.focus=e,i.blurScope=t):i.focus&&(i.focus=null)}var g4=["emphasis","blur","select"],Ace={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Yr(r,e,t,i){t=t||"itemStyle";for(var n=0;nnx,BezierCurve:()=>Hp,BoundingRect:()=>ft,Circle:()=>ga,CompoundPath:()=>uv,Ellipse:()=>tx,Group:()=>Ze,Image:()=>Br,IncrementalDisplayable:()=>e5,Line:()=>ei,LinearGradient:()=>xu,OrientedBoundingRect:()=>cv,Path:()=>pt,Point:()=>zt,Polygon:()=>ai,Polyline:()=>ri,RadialGradient:()=>Qw,Rect:()=>Rt,Ring:()=>Gp,Sector:()=>Mi,Text:()=>It,applyTransform:()=>Dn,clipPointsByRect:()=>CD,clipRectByRect:()=>ohe,createIcon:()=>pc,extendPath:()=>ihe,extendShape:()=>the,getShapeClass:()=>ax,getTransform:()=>Tl,groupTransition:()=>fc,initProps:()=>lr,isElementRemoved:()=>uc,lineLineIntersect:()=>l5,linePolygonIntersect:()=>fv,makeImage:()=>AD,makePath:()=>hv,mergePath:()=>$n,registerShape:()=>wl,removeElement:()=>Fs,removeElementWithFadeOut:()=>cc,resizePath:()=>s5,setTooltipConfig:()=>El,subPixelOptimize:()=>ox,subPixelOptimizeLine:()=>hc,subPixelOptimizeRect:()=>nhe,transformDirection:()=>Yp,traverseElements:()=>ya,updateProps:()=>Ut});var ov=$i.CMD,Cce=[[],[],[]],D4=Math.sqrt,Rce=Math.atan2;function Yw(r,e){if(e){var t=r.data,i=r.len(),n,a,o,s,l,u,c=ov.M,h=ov.C,f=ov.L,p=ov.R,d=ov.A,g=ov.Q;for(o=0,s=0;o1&&(o*=xD(d),s*=xD(d));var g=(n===a?-1:1)*xD((o*o*(s*s)-o*o*(p*p)-s*s*(f*f))/(o*o*(p*p)+s*s*(f*f)))||0,m=g*o*p/s,v=g*-s*f/o,_=(r+t)/2+Zw(h)*m-qw(h)*v,y=(e+i)/2+qw(h)*m+Zw(h)*v,x=I4([1,0],[(f-m)/o,(p-v)/s]),M=[(f-m)/o,(p-v)/s],S=[(-1*f-m)/o,(-1*p-v)/s],w=I4(M,S);if(SD(M,S)<=-1&&(w=ex),SD(M,S)>=1&&(w=0),w<0){var T=Math.round(w/ex*1e6)/1e6;w=ex*2+T%2*ex}c.addData(u,_,y,o,s,x,w,h,a)}var Lce=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,Dce=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function Pce(r){var e=new $i;if(!r)return e;var t=0,i=0,n=t,a=i,o,s=$i.CMD,l=r.match(Lce);if(!l)return e;for(var u=0;uA*A+P*P&&(T=b,C=E),{cx:T,cy:C,x0:-c,y0:-h,x1:T*(n/M-1),y1:C*(n/M-1)}}function Fce(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 W4(r,e){var t,i=rx(e.r,0),n=rx(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,h=e.cy,f=!!e.clockwise,p=G4(u-l),d=p>MD&&p%MD;if(d>bl&&(p=d),!(i>bl))r.moveTo(c,h);else if(p>MD-bl)r.moveTo(c+i*lv(l),h+i*Vp(l)),r.arc(c,h,i,l,u,!f),n>bl&&(r.moveTo(c+n*lv(u),h+n*Vp(u)),r.arc(c,h,n,u,l,f));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,P=i*lv(l),U=i*Vp(l),B=n*lv(u),z=n*Vp(u),k=p>bl;if(k){var G=e.cornerRadius;G&&(t=Fce(G),g=t[0],m=t[1],v=t[2],_=t[3]);var Y=G4(i-n)/2;if(y=_u(Y,v),x=_u(Y,_),M=_u(Y,g),S=_u(Y,m),C=w=rx(y,x),b=T=rx(M,S),(w>bl||T>bl)&&(E=i*lv(u),I=i*Vp(u),R=n*lv(l),A=n*Vp(l),pbl){var se=_u(v,C),Ee=_u(_,C),q=Kw(R,A,P,U,i,se,f),H=Kw(E,I,B,z,i,Ee,f);r.moveTo(c+q.cx+q.x0,h+q.cy+q.y0),C0&&r.arc(c+q.cx,h+q.cy,se,Jn(q.y0,q.x0),Jn(q.y1,q.x1),!f),r.arc(c,h,i,Jn(q.cy+q.y1,q.cx+q.x1),Jn(H.cy+H.y1,H.cx+H.x1),!f),Ee>0&&r.arc(c+H.cx,h+H.cy,Ee,Jn(H.y1,H.x1),Jn(H.y0,H.x0),!f))}else r.moveTo(c+P,h+U),r.arc(c,h,i,l,u,!f);if(!(n>bl)||!k)r.lineTo(c+B,h+z);else if(b>bl){var se=_u(g,b),Ee=_u(m,b),q=Kw(B,z,E,I,n,-Ee,f),H=Kw(P,U,R,A,n,-se,f);r.lineTo(c+q.cx+q.x0,h+q.cy+q.y0),b0&&r.arc(c+q.cx,h+q.cy,Ee,Jn(q.y0,q.x0),Jn(q.y1,q.x1),!f),r.arc(c,h,n,Jn(q.cy+q.y1,q.cx+q.x1),Jn(H.cy+H.y1,H.cx+H.x1),f),se>0&&r.arc(c+H.cx,h+H.cy,se,Jn(H.y1,H.x1),Jn(H.y0,H.x0),!f))}else r.lineTo(c+B,h+z),r.arc(c,h,n,u,l,f)}r.closePath()}}}var kce=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 X4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new kce},e.prototype.buildPath=function(t,i){W4(t,i)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(pt);X4.prototype.type="sector";var Mi=X4;var Vce=function(){function r(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return r}();var Y4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Vce},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}(pt);Y4.prototype.type="ring";var Gp=Y4;function bD(r,e,t,i){var n=[],a=[],o=[],s=[],l,u,c,h;if(i){c=[1/0,1/0],h=[-1/0,-1/0];for(var f=0,p=r.length;f=2){if(i){var a=bD(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,h=n.length;sXp[1]){if(s=!1,a)return s;var c=Math.abs(Xp[0]-Wp[1]),h=Math.abs(Wp[0]-Xp[1]);Math.min(c,h)>n.len()&&(c0){var h=c.duration,f=c.delay,p=c.easing,d={duration:h,delay:f||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 Ut(r,e,t,i,n,a){wD("update",r,e,t,i,n,a)}function lr(r,e,t,i,n,a){wD("enter",r,e,t,i,n,a)}function uc(r){if(!r.__zr)return!0;for(var e=0;eMath.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function n5(r){return!r.isGroup}function ahe(r){return r.shape!=null}function fc(r,e,t){if(!r||!e)return;function i(o){var s={};return o.traverse(function(l){n5(l)&&l.anid&&(s[l.anid]=l)}),s}function n(o){var s={x:o.x,y:o.y,rotation:o.rotation};return ahe(o)&&(s.shape=he({},o.shape)),s}var a=i(r);e.traverse(function(o){if(n5(o)&&o.anid){var s=a[o.anid];if(s){var l=n(o);o.attr(n(s)),Ut(o,l,t,it(o).dataIndex)}}})}function CD(r,e){return de(r,function(t){var i=t[0];i=r1(i,e.x),i=i1(i,e.x+e.width);var n=t[1];return n=r1(n,e.y),n=i1(n,e.y+e.height),[i,n]})}function ohe(r,e){var t=r1(r.x,e.x),i=i1(r.x+r.width,e.x+e.width),n=r1(r.y,e.y),a=i1(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 pc(r,e,t){var i=he({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 Br(i)):hv(r.replace("path://",""),i,t,"center")}function fv(r,e,t,i,n){for(var a=0,o=n[n.length-1];a1)return!1;var m=TD(p,d,c,h)/f;return!(m<0||m>1)}function TD(r,e,t,i){return r*i-t*e}function she(r){return r<=1e-6&&r>=-1e-6}function El(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(At(l),function(c){tt(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=it(r.el);u.componentMainType=a,u.componentIndex=o,u.tooltipConfig={name:i,option:Ye({content:i,formatterParams:s},n)}}function a5(r,e){var t;r.isGroup&&(t=e(r)),t||r.traverse(e)}function ya(r,e){if(r)if(pe(r))for(var t=0;t=0&&s.push(l)}),s}}function Qn(r,e){return bt(bt({},r,!0),e,!0)}var _5={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 x5={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 l1="ZH",UD="EN",dv=UD,s1={},OD={},u1=Bt.domSupported?function(){var r=(document.documentElement.lang||navigator.language||navigator.browserLanguage||dv).toUpperCase();return r.indexOf(l1)>-1?l1:dv}():dv;function S5(r,e){r=r.toUpperCase(),OD[r]=new Jt(e),s1[r]=e}function M5(r){if(Ce(r)){var e=s1[r.toUpperCase()]||{};return r===l1||r===UD?Qe(e):bt(Qe(e),Qe(s1[dv]),!1)}else return bt(Qe(r),Qe(s1[dv]),!1)}function lx(r){return OD[r]}function b5(){return OD[dv]}S5(UD,_5);S5(l1,x5);var h1=1e3,f1=h1*60,vv=f1*60,is=vv*24,FD=is*365,ux={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}"},c1="{yyyy}-{MM}-{dd}",BD={year:"{yyyy}",month:"{yyyy}-{MM}",day:c1,hour:c1+" "+ux.hour,minute:c1+" "+ux.minute,second:c1+" "+ux.second,millisecond:ux.none},zD=["year","month","day","hour","minute","second","millisecond"],kD=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function mc(r,e){return r+="","0000".substr(0,e-r.length)+r}function jp(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 w5(r){return r===jp(r)}function T5(r){switch(r){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Kp(r,e,t,i){var n=Rn(r),a=n[p1(t)](),o=n[Zp(t)]()+1,s=Math.floor((o-1)/3)+1,l=n[cx(t)](),u=n["get"+(t?"UTC":"")+"Day"](),c=n[mv(t)](),h=(c-1)%12+1,f=n[hx(t)](),p=n[fx(t)](),d=n[px(t)](),g=i instanceof Jt?i:lx(i||u1)||b5(),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,mc(a%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,_[o-1]).replace(/{MM}/g,mc(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,mc(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,y[u]).replace(/{ee}/g,x[u]).replace(/{e}/g,u+"").replace(/{HH}/g,mc(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,mc(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,mc(f,2)).replace(/{m}/g,f+"").replace(/{ss}/g,mc(p,2)).replace(/{s}/g,p+"").replace(/{SSS}/g,mc(d,3)).replace(/{S}/g,d+"")}function E5(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=he({},ux);if(r.level>0)for(var s=0;s=0;--s)if(l[u]){a=l[u];break}a=a||o.none}if(pe(a)){var h=r.level==null?0:r.level>=0?r.level:a.length+r.level;h=Math.min(h,a.length-1),a=a[h]}}return Kp(new Date(r.value),a,n,i)}function A5(r,e){var t=Rn(r),i=t[Zp(e)]()+1,n=t[cx(e)](),a=t[mv(e)](),o=t[hx(e)](),s=t[fx(e)](),l=t[px(e)](),u=l===0,c=u&&s===0,h=c&&o===0,f=h&&a===0,p=f&&n===1,d=p&&i===1;return d?"year":p?"month":f?"day":h?"hour":c?"minute":u?"second":"millisecond"}function VD(r,e,t){var i=Dt(r)?Rn(r):r;switch(e=e||A5(r,t),e){case"year":return i[p1(t)]();case"half-year":return i[Zp(t)]()>=6?1:0;case"quarter":return Math.floor((i[Zp(t)]()+1)/4);case"month":return i[Zp(t)]();case"day":return i[cx(t)]();case"half-day":return i[mv(t)]()/24;case"hour":return i[mv(t)]();case"minute":return i[hx(t)]();case"second":return i[fx(t)]();case"millisecond":return i[px(t)]()}}function p1(r){return r?"getUTCFullYear":"getFullYear"}function Zp(r){return r?"getUTCMonth":"getMonth"}function cx(r){return r?"getUTCDate":"getDate"}function mv(r){return r?"getUTCHours":"getHours"}function hx(r){return r?"getUTCMinutes":"getMinutes"}function fx(r){return r?"getUTCSeconds":"getSeconds"}function px(r){return r?"getUTCMilliseconds":"getMilliseconds"}function C5(r){return r?"setUTCFullYear":"setFullYear"}function GD(r){return r?"setUTCMonth":"setMonth"}function HD(r){return r?"setUTCDate":"setDate"}function WD(r){return r?"setUTCHours":"setHours"}function XD(r){return r?"setUTCMinutes":"setMinutes"}function YD(r){return r?"setUTCSeconds":"setSeconds"}function qD(r){return r?"setUTCMilliseconds":"setMilliseconds"}function jD(r){if(!Rp(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 d1(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 Al=Pm;function m1(r,e,t){var i="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function n(c){return c&&Zi(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?Rn(r):r;if(isNaN(+l)){if(s)return"-"}else return Kp(l,i,t)}if(e==="ordinal")return y_(r)?n(r):Dt(r)&&a(r)?r+"":"-";var u=_o(r);return a(u)?jD(u):y_(r)?n(r):typeof r=="boolean"?r+"":"-"}var R5=["a","b","c","d","e","f","g"],ZD=function(r,e){return"{"+r+(e??"")+"}"};function v1(r,e,t){pe(e)||(e=[e]);var i=e.length;if(!i)return"";for(var n=e[0].$vars||[],a=0;a':'';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 Cl(r,e){return e=e||"transparent",Ce(r)?r:qe(r)&&r.colorStops&&(r.colorStops[0]||{}).color||e}function Jp(r,e){if(e==="_blank"||e==="blank"){var t=window.open();t.opener=null,t.location.href=r}else window.open(r,e)}var g1=N,KD=["left","right","top","bottom","width","height"],$p=[["width","left","right"],["height","top","bottom"]];function JD(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(),h=e.childAt(u+1),f=h&&h.getBoundingRect(),p,d;if(r==="horizontal"){var g=c.width+(f?-f.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+(f?-f.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 Rl=JD,YVe=ut(JD,"vertical"),qVe=ut(JD,"horizontal");function P5(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=Al(t||0),{width:Math.max(s-a-t[1]-t[3],0),height:Math.max(l-o-t[0]-t[2],0)}}function br(r,e,t){t=Al(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),h=t[2]+t[0],f=t[1]+t[3],p=r.aspect;switch(isNaN(u)&&(u=i-s-f-a),isNaN(c)&&(c=n-l-h-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-f),isNaN(o)&&(o=n-l-c-h),r.left||r.right){case"center":a=i/2-u/2-t[3];break;case"right":a=i-u-f;break}switch(r.top||r.bottom){case"middle":case"center":o=n/2-c/2-t[0];break;case"bottom":o=n-c-h;break}a=a||0,o=o||0,isNaN(u)&&(u=i-f-a-(s||0)),isNaN(c)&&(c=n-h-o-(l||0));var d=new ft(a+t[3],o+t[0],u,c);return d.margin=t,d}function Ih(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 ft(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 h=br(Ye({width:u.width,height:u.height},e),t,i),f=o?h.x-u.x:0,p=s?h.y-u.y:0;return l==="raw"?(a.x=f,a.y=p):(a.x+=f,a.y+=p),a===r&&r.markRedraw(),!0}function I5(r,e){return r[$p[e][0]]!=null||r[$p[e][1]]!=null&&r[$p[e][2]]!=null}function Nh(r){var e=r.layoutMode||r.constructor.layoutMode;return qe(e)?e:e?{type:e}:null}function Eo(r,e,t){var i=t&&t.ignoreSize;!pe(i)&&(i=[i,i]);var n=o($p[0],0),a=o($p[1],1);u($p[0],r,n),u($p[1],r,a);function o(c,h){var f={},p=0,d={},g=0,m=2;if(g1(c,function(y){d[y]=r[y]}),g1(c,function(y){s(e,y)&&(f[y]=d[y]=e[y]),l(f,y)&&p++,l(d,y)&&g++}),i[h])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 f;for(var v=0;v=0;l--)s=bt(s,n[l],!0);i.defaultOption=s}return i.defaultOption},e.prototype.getReferringComponents=function(t,i){var n=t+"Index",a=t+"Id";return wh(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}(Jt);Iw(gv,Jt);Th(gv);g5(gv);y5(gv,ghe);function ghe(r){var e=[];return N(gv.getClassesByMainType(r),function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])}),e=de(e,function(t){return So(t).main}),r!=="dataset"&&yt(e,"dataset")<=0&&e.unshift("dataset"),e}var Nt=gv;var N5="";typeof navigator<"u"&&(N5=navigator.platform||"");var yv="rgba(0, 0, 0, 0.2)",U5={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:yv,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:yv,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:yv,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:yv,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:yv,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:yv,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:N5.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 y1=ke(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),dn="original",Li="arrayRows",In="objectRows",ns="keyedColumns",as="typedArray",QD="unknown",Ao="column",vc="row";var Qi={Must:1,Might:2,Not:3},O5=xt();function z5(r){O5(r).datasetMap=ke()}function _1(r,e,t){var i={},n=x1(e);if(!n||!r)return i;var a=[],o=[],s=e.ecModel,l=O5(s).datasetMap,u=n.uid+"_"+t.seriesLayoutBy,c,h;r=r.slice(),N(r,function(g,m){var v=qe(g)?g:r[m]={name:g};v.type==="ordinal"&&c==null&&(c=m,h=d(v)),i[v.name]=[]});var f=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});N(r,function(g,m){var v=g.name,_=d(g);if(c==null){var y=f.valueWayDim;p(i[v],y,_),p(o,y,_),f.valueWayDim+=_}else if(c===m)p(i[v],0,_),p(a,0,_);else{var y=f.categoryWayDim;p(i[v],y,_),p(o,y,_),f.categoryWayDim+=_}});function p(g,m,v){for(var _=0;_e)return r[i];return r[t-1]}function H5(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:_he(i,o);if(c=c||t,!(!c||!c.length)){var h=c[l];return n&&(u[n]=h),s.paletteIdx=(l+1)%c.length,h}}function xhe(r,e){e(r).paletteIdx=0,e(r).paletteNameMap={}}var M1,gx,W5,X5="\0_ec_inner",She=1;var j5=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 Jt(a),this._locale=new Jt(o),this._optionManager=s},e.prototype.setOption=function(t,i,n){var a=Z5(i);this._optionManager.setOption(t,n,a),this._resetOption(null,a)},e.prototype.resetOption=function(t,i){return this._resetOption(t,Z5(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"?W5(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;z5(this),N(t,function(h,f){h!=null&&(Nt.hasClass(f)?f&&(s.push(f),l.set(f,!0)):n[f]=n[f]==null?Qe(h):bt(n[f],h,!0))}),u&&u.each(function(h,f){Nt.hasClass(f)&&!l.get(f)&&(s.push(f),l.set(f,!0))}),Nt.topologicalTravel(s,Nt.getAllClassMainTypes(),c,this);function c(h){var f=V5(this,h,tr(t[h])),p=a.get(h),d=p?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",g=Dw(p,f,d);xH(g,h,Nt),n[h]=null,a.set(h,null),o.set(h,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=h==="series",b=Nt.getClass(h,M.keyInfo.subType,!C);if(!b){if(0)var E,I;return}if(h==="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=he({componentIndex:S},M.keyInfo);w=new b(T,this,this,R),he(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[h]=m,a.set(h,v),o.set(h,_),h==="series"&&M1(this)}this._seriesIndices||M1(this)},e.prototype.getOption=function(){var t=Qe(this.option);return N(t,function(i,n){if(Nt.hasClass(n)){for(var a=tr(i),o=a.length,s=!1,l=o-1;l>=0;l--)a[l]&&!Jm(a[l])?s=!0:(a[l]=null,!s&&o--);a.length=o,t[n]=a}}),delete t[X5],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=e:t==="max"?r<=e:r===e}function Phe(r,e){return r.join(",")===e.join(",")}var K5=Che;var Ll=N,_x=qe,J5=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function rP(r){var e=r&&r.itemStyle;if(e)for(var t=0,i=J5.length;t=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"&&f>=0&&_>0||l==="samesign"&&f<=0&&_<0){f=cH(f,_),g=_;break}}}return i[0]=f,i[1]=g,i})})}var E1=function(){function r(e){this.data=e.data||(e.sourceFormat===ns?{}:[]),this.sourceFormat=e.sourceFormat||QD,this.seriesLayoutBy=e.seriesLayoutBy||Ao,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;ig&&(g=y)}p[0]=d,p[1]=g}},n=function(){return this._data?this._data.length/this._dimSize:0};oW=(e={},e[Li+"_"+Ao]={pure:!0,appendData:a},e[Li+"_"+vc]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[In]={pure:!0,appendData:a},e[ns]={pure:!0,appendData:function(o){var s=this._data;N(o,function(l,u){for(var c=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)c.push(l[h])})}},e[dn]={appendData:a},e[as]={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=0&&(g=o.interpolatedValue[m])}return g!=null?g+"":""})}},r.prototype.getRawValue=function(e,t){return _c(this.getData(t),e)},r.prototype.formatTooltip=function(e,t,i){},r}();function fP(r){var e,t;return qe(r)?r.type&&(t=r):e=r,{text:e,frag:t}}function Uh(r){return new Yhe(r)}var Yhe=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 h;(this._dirty||a==="reset")&&(this._dirty=!1,h=this._doReset(i)),this._modBy=l,this._modDataCount=u;var f=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(f!=null?this._dueIndex+f:1/0,this._dueEnd);if(!i&&(h||p1&&i>0?s:o}};return a;function o(){return e=r?null:le},gte:function(r,e){return r>=e}},Zhe=function(){function r(e,t){if(!Dt(t)){var i="";hr(i)}this._opFn=hW[e],this._rvalFloat=_o(t)}return r.prototype.evaluate=function(e){return Dt(e)?this._opFn(e,this._rvalFloat):this._opFn(_o(e),this._rvalFloat)},r}(),L1=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=Dt(e)?e:_o(e),n=Dt(t)?t:_o(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 in?-this._resultLT:0},r}();var jhe=function(){function r(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=_o(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=_o(e)===this._rvalFloat)}return this._isEQ?t:!t},r}();function fW(r,e){return r==="eq"||r==="ne"?new jhe(r==="eq",e):tt(hW,r)?new Zhe(r,e):null}var Khe=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 Gs(e,t)},r}();function Jhe(r,e){var t=new Khe,i=r.data,n=t.sourceFormat=r.sourceFormat,a=r.startIndex,o="";r.seriesLayoutBy!==Ao&&hr(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)&&hr(y),l[v]=_}});else for(var c=0;c65535?ife:nfe}function bv(){return[1/0,-1/0]}function afe(r){var e=r.constructor;return e===Array?r.slice():new e(r)}function gW(r,e,t,i,n){var a=yW[t||"float"];if(n){var o=r[e],s=o&&o.length;if(s!==i){for(var l=new a(i),u=0;um[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;cv[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=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,i=t[e];if(i!=null&&ie)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,h=this.count();c=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=h&&_<=f||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=h&&_<=f||isNaN(_))&&(S>=x&&S<=M||isNaN(S))&&(l[u++]=g),g++}d=!0}}if(!d)if(a===1)for(var v=0;v=h&&_<=f||isNaN(_))&&(l[u++]=w)}else for(var v=0;ve[b][1])&&(T=!1)}T&&(l[u++]=t.getRawIndex(v))}return uv[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,h,f,p=new(Mx(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));p[s++]=u;for(var d=1;dc&&(c=h,f=x)}E>0&&Ec-d&&(l=c-d,s.length=l);for(var g=0;gh[1]&&(h[1]=v),f[p++]=_}return a._count=p,a._indices=f,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();al&&(l=h)}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=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 Gs(t[a],this._dimensions[a])}dP={arrayRows:e,objectRows:function(t,i,n,a){return Gs(t[i],this._dimensions[a])},keyedColumns:e,original:function(t,i,n,a){var o=t&&(t.value==null?t:t.value);return Gs(o instanceof Array?o[a]:o,this._dimensions[a])},typedArray:function(t,i,n,a){return t[a]}}}(),r}(),bx=ofe;var I1=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(P1(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=Ai(s)?as:dn,a=[];var h=this._getSourceMetaRawOption()||{},f=u&&u.metaRawOption||{},p=mt(h.seriesLayoutBy,f.seriesLayoutBy)||null,d=mt(h.sourceHeader,f.sourceHeader),g=mt(h.dimensions,f.dimensions),m=p!==f.seriesLayoutBy||!!d!=!!f.sourceHeader||g;n=m?[Sx(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=[Sx(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&&_W(a)}var o,s=[],l=[];return N(e,function(u){u.prepareSource();var c=u.getSource(n||0),h="";n!=null&&!c&&_W(h),s.push(c),l.push(u._getVersionSign())}),i?o=mW(i,s,{datasetIndex:t.componentIndex}):n!=null&&(o=[aW(s[0])]),{sourceList:o,upstreamSignList:l}},r.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;t1||t>0&&!r.noHeader;return N(r.blocks,function(n){var a=bW(n);a>=e&&(e=a+ +(i&&(!a||gP(n)&&!n.noHeader)))}),e}return 0}function ufe(r,e,t,i){var n=e.noHeader,a=hfe(bW(e)),o=[],s=e.blocks||[];Wr(!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 L1(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=MW(d)(m?he(he({},r),{valueFormatter:m}):r,d,g>0?a.html:0,i);v!=null&&o.push(v)});var h=r.renderMode==="richText"?o.join(a.richText):yP(o.join(""),n?t:a.html);if(n)return h;var f=m1(e.header,"ordinal",r.useUTC),p=SW(i,r.renderMode).nameStyle;return r.renderMode==="richText"?wW(r,f,p)+a.richText+h:yP('
'+Tn(f)+"
"+h,t)}function cfe(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 m1(M,pe(p)?p[S]:p,u)})};if(!(a&&o)){var h=s?"":r.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",n),f=a?"":m1(l,"ordinal",u),p=e.valueType,d=o?[]:c(e.value,e.dataIndex),g=!s||!a,m=!s&&a,v=SW(i,n),_=v.nameStyle,y=v.valueStyle;return n==="richText"?(s?"":h)+(a?"":wW(r,f,_))+(o?"":dfe(r,d,g,m,y)):yP((s?"":h)+(a?"":ffe(f,!s,_))+(o?"":pfe(d,g,m,y)),t)}}function _P(r,e,t,i,n,a){if(r){var o=MW(r),s={useUTC:n,renderMode:t,orderMode:i,markupStyleCreator:e,valueFormatter:r.valueFormatter};return o(s,r,0,a)}}function hfe(r){return{html:sfe[r],richText:lfe[r]}}function yP(r,e){var t='
',i="margin: "+e+"px 0 0";return'
'+r+t+"
"}function ffe(r,e,t){var i=e?"margin-left:2px":"";return''+Tn(r)+""}function pfe(r,e,t,i){var n=t?"10px":"20px",a=e?"float:right;margin-left:"+n:"";return r=pe(r)?r:[r],''+de(r,function(o){return Tn(o)}).join("  ")+""}function wW(r,e,t){return r.markupStyleCreator.wrapRichTextStyle(e,t)}function dfe(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 N1(r,e){var t=r.getData().getItemVisual(e,"style"),i=t[r.visualDrawType];return Cl(i)}function U1(r,e){var t=r.get("padding");return t??(e==="richText"?[8,10]:10)}var O1=function(){function r(){this.richTextStyles={},this._nextStyleNameId=Lw()}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=D5({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 he(i,a)}):he(i,t);var n=this._generateStyleName();return this.richTextStyles[n]=i,"{"+n+"|"+e+"}"},r}();function z1(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=N1(e,t),c,h,f,p;if(o>1||l&&!o){var d=mfe(s,e,t,a,u);c=d.inlineValues,h=d.inlineValueTypes,f=d.blocks,p=d.inlineValues[0]}else if(o){var g=n.getDimensionInfo(a[0]);p=c=_c(n,t,a[0]),h=g.type}else p=c=l?s[0]:s;var m=$m(e),v=m&&e.name||"",_=n.getName(t),y=i?v:_;return kr("section",{header:v,noHeader:i||!m,sortParam:p,blocks:[kr("nameValue",{markerType:"item",markerColor:u,name:y,noName:!Zi(y),value:c,valueType:h,dataIndex:t})].concat(f||[])})}function mfe(r,e,t,i,n){var a=e.getData(),o=wn(r,function(h,f,p){var d=a.getDimensionInfo(p);return h=h||d&&d.tooltip!==!1&&d.displayName!=null},!1),s=[],l=[],u=[];i.length?N(i,function(h){c(_c(a,t,h),h)}):N(r,c);function c(h,f){var p=a.getDimensionInfo(f);!p||p.otherDims.tooltip===!1||(o?u.push(kr("nameValue",{markerType:"subItem",markerColor:n,name:p.displayName,value:h,valueType:p.type})):(s.push(h),l.push(p.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var Oh=xt();function F1(r,e){return r.getName(e)||r.getId(e)}var Tx="__universalTransitionEnabled",B1=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=Uh({count:gfe,reset:yfe}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n);var a=Oh(this).sourceManager=new I1(this);a.prepareSource();var o=this.getInitialData(t,n);EW(o,this),this.dataTask.context.data=o,Oh(this).dataBeforeProcessed=o,TW(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(t,i){var n=Nh(this),a=n?ks(t):{},o=this.subType;Nt.hasClass(o)&&(o+="Series"),bt(t,i.getTheme().get(this.subType)),bt(t,this.getDefaultOption()),rs(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&Eo(t,a,n)},e.prototype.mergeOption=function(t,i){t=bt(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Nh(this);n&&Eo(this.option,t,n);var a=Oh(this).sourceManager;a.dirty(),a.prepareSource();var o=this.getInitialData(t,i);EW(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,Oh(this).dataBeforeProcessed=o,TW(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(t){if(t&&!Ai(t))for(var i=["show"],n=0;nthis.getShallow("animationThreshold")&&(i=!1),!!i},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,i,n){var a=this.ecModel,o=mx.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=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[F1(a,t)])&&!a.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[Tx])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;c0&&this._innerSelect(t,i)}},e.registerClass=function(t){return Nt.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}(Nt);Cr(B1,Mv);Cr(B1,mx);Iw(B1,Nt);function TW(r){var e=r.name;$m(r)||(r.name=vfe(r)||e)}function vfe(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 gfe(r){return r.model.getRawData().count()}function yfe(r){var e=r.model;return e.setData(e.getRawData().cloneShallow()),_fe}function _fe(r,e){e.outputData&&r.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function EW(r,e){N(hp(r.CHANGABLE_METHODS,r.DOWNSAMPLE_METHODS),function(t){r.wrapMethod(t,ut(xfe,e))})}function xfe(r,e){var t=xP(r);return t&&t.setOutputEnd((e||this).count()),e}function xP(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 $t=B1;var SP=function(){function r(){this.group=new Ze,this.uid=Bs("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}();Qm(SP);Th(SP);var ir=SP;function os(){var r=xt();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 RW=xt(),Sfe=os(),MP=function(){function r(){this.group=new Ze,this.uid=Bs("viewChart"),this.renderTask=Uh({plan:Mfe,reset:bfe}),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&&CW(a,n,"emphasis")},r.prototype.downplay=function(e,t,i,n){var a=e.getData(n&&n.dataType);a&&CW(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){ya(this.group,e)},r.markUpdateMethod=function(e,t){RW(e).updateMethod=t},r.protoInitialize=function(){var e=r.prototype;e.type="chart"}(),r}();function AW(r,e,t){r&&Ph(r)&&(e==="emphasis"?jn:Kn)(r,t)}function CW(r,e,t){var i=Us(r,e),n=e&&e.highlightKey!=null?R4(e.highlightKey):null;i!=null?N(tr(i),function(a){AW(r.getItemGraphicEl(a),t,n)}):r.eachItemGraphicEl(function(a){AW(a,t,n)})}Qm(MP,["dispose"]);Th(MP);function Mfe(r){return Sfe(r.model)}function bfe(r){var e=r.model,t=r.ecModel,i=r.api,n=r.payload,a=e.pipelineContext.progressiveRender,o=r.view,s=n&&RW(n).updateMethod,l=a?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,t,i,n),wfe[l]}var wfe={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)}}},Zt=MP;var k1="\0__throttleOriginMethod",LW="\0__throttleRate",DW="\0__throttleType";function Ex(r,e,t){var i,n=0,a=0,o=null,s,l,u,c;e=e||0;function h(){a=new Date().getTime(),o=null,r.apply(l,u||[])}var f=function(){for(var p=[],d=0;d=0?h():o=setTimeout(h,-s),n=i};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.debounceNextCall=function(p){c=p},f}function Hs(r,e,t,i){var n=r[e];if(n){var a=n[k1]||n,o=n[DW],s=n[LW];if(s!==t||o!==i){if(t==null||!i)return r[e]=a;n=r[e]=Ex(a,t,i==="debounce"),n[k1]=a,n[DW]=i,n[LW]=t}return n}}function xc(r,e){var t=r[e];t&&t[k1]&&(t.clear&&t.clear(),r[e]=t[k1])}var PW=xt(),IW={itemStyle:Mo(ID,!0),lineStyle:Mo(PD,!0)},Tfe={lineStyle:"stroke",itemStyle:"fill"};function NW(r,e){var t=r.visualStyleMapper||IW[e];return t||(console.warn("Unknown style type '"+e+"'."),IW.itemStyle)}function UW(r,e){var t=r.visualDrawType||Tfe[e];return t||(console.warn("Unknown style type '"+e+"'."),"fill")}var OW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=r.getModel(i),a=NW(r,i),o=a(n),s=n.getShallow("decal");s&&(t.setVisual("decal",s),s.dirty=!0);var l=UW(r,i),u=o[l],c=He(u)?u:null,h=o.fill==="auto"||o.stroke==="auto";if(!o[l]||c||h){var f=r.getColorFromPalette(r.name,null,e.getSeriesCount());o[l]||(o[l]=f,t.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||He(o.fill)?f:o.fill,o.stroke=o.stroke==="auto"||He(o.stroke)?f: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=he({},o);m[l]=c(g),p.setItemVisual(d,"style",m)}}}},Ax=new Jt,zW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){if(!(r.ignoreStyleOnData||e.isSeriesFiltered(r))){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=NW(r,i),a=t.getVisual("drawType");return{dataEach:t.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[i]){Ax.option=l[i];var u=n(Ax),c=o.ensureUniqueItemVisual(s,"style");he(c,u),Ax.option.decal&&(o.setItemVisual(s,"decal",Ax.option.decal),Ax.option.decal.dirty=!0),a in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},FW={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)),PW(t).scope=a}}),r.eachSeries(function(t){if(!(t.isColorBySeries()||r.isSeriesFiltered(t))){var i=t.getRawData(),n={},a=t.getData(),o=PW(t).scope,s=t.visualStyleAccessPath||"itemStyle",l=UW(t,s);a.each(function(u){var c=a.getRawIndex(u);n[c]=u}),i.each(function(u){var c=n[u],h=a.getItemVisual(c,"colorFromPalette");if(h){var f=a.ensureUniqueItemVisual(c,"style"),p=i.getName(u)||u+"",d=i.count();f[l]=t.getColorFromPalette(p,o,d)}})}})}};var G1=Math.PI;function bP(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 Rt({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});t.add(i);var n=new It({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 Rt({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 nx({shape:{startAngle:-G1/2,endAngle:-G1/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:G1*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:G1*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 Efe=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="";Wr(!(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),h=c.seriesTaskMap,f=c.overallTask;if(f){var p,d=f.agentStubMap;d.each(function(m){s(n,m)&&(m.dirty(),p=!0)}),p&&f.dirty(),o.updatePayload(f,i);var g=o.getPerformArgs(f,n.block);d.each(function(m){m.perform(g)}),f.perform(g)&&(a=!0)}else h&&h.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(h){var f=h.uid,p=s.set(f,o&&o.get(f)||Uh({plan:Dfe,reset:Pfe,count:Nfe}));p.context={model:h,ecModel:i,api:n,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:a},a._pipe(h,p)}},r.prototype._createOverallStageTask=function(e,t,i,n){var a=this,o=t.overallTask=t.overallTask||Uh({reset:Afe});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,h=!0,f=!1,p="";Wr(!e.createOnAllSeries,p),u?i.eachRawSeriesByType(u,d):c?c(i,n).each(d):(h=!1,N(i.getSeries(),d));function d(g){var m=g.uid,v=l.set(m,s&&s.get(m)||(f=!0,Uh({reset:Cfe,onDirty:Lfe})));v.context={model:g,overallProgress:h},v.agent=o,v.__block=h,a._pipe(g,v)}f&&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:Ufe(e)}),e.uid=Bs("stageHandler"),t&&(e.visualType=t),e},r}();function Afe(r){r.overallReset(r.ecModel,r.api,r.payload)}function Cfe(r){return r.overallProgress&&Rfe}function Rfe(){this.agent.dirty(),this.getDownstream().dirty()}function Lfe(){this.agent&&this.agent.dirty()}function Dfe(r){return r.plan?r.plan(r.model,r.ecModel,r.api,r.payload):null}function Pfe(r){r.useClearVisual&&r.data.clearAllVisual();var e=r.resetDefines=tr(r.reset(r.model,r.ecModel,r.api,r.payload));return e.length>1?de(e,function(t,i){return BW(i)}):Ife}var Ife=BW(0);function BW(r){return function(e,t){var i=t.data,n=t.resetDefines[r];if(n&&n.dataEach)for(var a=e.start;a0&&p===u.length-f.length){var d=u.slice(0,p);d!=="data"&&(t.mainType=d,t[f.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(h,f,p,d){return h[p]==null||f[d||p]===h[p]}},r.prototype.afterTrigger=function(){this.eventInfo=null},r}();var TP=["symbol","symbolSize","symbolRotate","symbolOffset"],jW=TP.concat(["symbolKeepAspect"]),KW={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=0&&rd(l)?l:.5;var u=r.createRadialGradient(o,s,0,o,s,l);return u}function Dx(r,e,t){for(var i=e.type==="radial"?Zfe(r,e,t):qfe(r,e,t),n=e.colorStops,a=0;a0)?null:r==="dashed"?[4*e,2*e]:r==="dotted"?[e]:Dt(r)?[r]:pe(r)?r:null}function Px(r){var e=r.style,t=e.lineDash&&e.lineWidth>0&&jfe(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 Kfe=new $i(!0);function q1(r){var e=r.stroke;return!(e==null||e==="none"||!(r.lineWidth>0))}function r6(r){return typeof r=="string"&&r!=="none"}function Z1(r){var e=r.fill;return e!=null&&e!=="none"}function i6(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 n6(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 j1(r,e,t){var i=X_(e.image,e.__image,t);if(ev(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)*Im),a.scaleSelf(e.scaleX||1,e.scaleY||1),n.setTransform(a)}return n}}function Jfe(r,e,t,i){var n,a=q1(t),o=Z1(t),s=t.strokePercent,l=s<1,u=!e.path;(!e.silent||l)&&u&&e.createPathProxy();var c=e.path||Kfe,h=e.__dirty;if(!i){var f=t.fill,p=t.stroke,d=o&&!!f.colorStops,g=a&&!!p.colorStops,m=o&&!!f.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&&(_=h?Dx(r,f,S):e.__canvasFillGradient,e.__canvasFillGradient=_),g&&(y=h?Dx(r,p,S):e.__canvasStrokeGradient,e.__canvasStrokeGradient=y),m&&(x=h||!e.__canvasFillPattern?j1(r,f,e):e.__canvasFillPattern,e.__canvasFillPattern=x),v&&(M=h||!e.__canvasStrokePattern?j1(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=Px(e),T=n[0],C=n[1]);var b=!0;(u||h&gh)&&(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&&n6(r,t),o&&i6(r,t)):(o&&i6(r,t),a&&n6(r,t))),T&&r.setLineDash([])}function $fe(r,e,t){var i=e.__image=X_(t.image,e.__image,e,e.onload);if(!(!i||!ev(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,h=o-u,f=s-c;r.drawImage(i,u,c,h,f,n,a,o,s)}else r.drawImage(i,n,a,o,s)}}function Qfe(r,e,t){var i,n=t.text;if(n!=null&&(n+=""),n){r.font=t.font||Jo,r.textAlign=t.textAlign,r.textBaseline=t.textBaseline;var a=void 0,o=void 0;r.setLineDash&&t.lineDash&&(i=Px(e),a=i[0],o=i[1]),a&&(r.setLineDash(a),r.lineDashOffset=o),t.strokeFirst?(q1(t)&&r.strokeText(n,t.x,t.y),Z1(t)&&r.fillText(n,t.x,t.y)):(Z1(t)&&r.fillText(n,t.x,t.y),q1(t)&&r.strokeText(n,t.x,t.y)),a&&r.setLineDash([])}}var a6=["shadowBlur","shadowOffsetX","shadowOffsetY"],o6=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function f6(r,e,t,i,n){var a=!1;if(!i&&(t=t||{},e===t))return!1;if(i||e.opacity!==t.opacity){Co(r,n),a=!0;var o=Math.max(Math.min(e.opacity,1),0);r.globalAlpha=isNaN(o)?pu.opacity:o}(i||e.blend!==t.blend)&&(a||(Co(r,n),a=!0),r.globalCompositeOperation=e.blend||pu.blend);for(var s=0;s0&&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[ta]){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[ta]=!0,!this._model||i){var l=new K5(this._api),u=this._theme,c=this._model=new b1;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(t,{replaceMerge:o},zP);var h={seriesTransition:s,optionChanged:!0};if(n)this[Ro]={silent:a,updateParams:h},this[ta]=!1,this.getZr().wakeUp();else{try{Tv(this),Bh.update.call(this,null,h)}catch(f){throw this[Ro]=null,this[ta]=!1,f}this._ssr||this._zr.flush(),this[Ro]=null,this[ta]=!1,Nx.call(this,a),Ux.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||Bt.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(Bt.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(R6[n]){var l=s,u=s,c=-s,h=-s,f=[],p=t&&t.pixelRatio||this.getDevicePixelRatio();N(zx,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),h=o(S.bottom,h),f.push({dom:M,left:S.left,top:S.top})}}),l*=p,u*=p,c*=p,h*=p;var d=c-l,g=h-u,m=Zn.createCanvas(),v=B2(m,{renderer:i?"svg":"canvas"});if(v.resize({width:d,height:g}),i){var _="";return N(f,function(y){var x=y.left-l,M=y.top-u;_+=''+y.dom+""}),v.painter.getSvgRoot().innerHTML=_,t.connectedBackgroundColor&&v.painter.setBackgroundColor(t.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}else return t.connectedBackgroundColor&&v.add(new Rt({shape:{x:0,y:0,width:d,height:g},style:{fill:t.connectedBackgroundColor}})),N(f,function(y){var x=new Br({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 PP(this,"convertToPixel",t,i)},e.prototype.convertFromPixel=function(t,i){return PP(this,"convertFromPixel",t,i)},e.prototype.containPixel=function(t,i){if(this._disposed){this.id;return}var n=this._model,a,o=bh(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 h=this._chartsMap[u.__viewId];h&&h.containPoint&&(a=a||h.containPoint(i,u))}},this)},this),!!a},e.prototype.getVisual=function(t,i){var n=this._model,a=bh(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?Rx(s,l,i):Mu(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&&Dl(s,function(d){var g=it(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=he({},g.eventData),!0},!0),l){var c=l.componentType,h=l.componentIndex;(c==="markLine"||c==="markPoint"||c==="markArea")&&(c="series",h=l.seriesIndex);var f=c&&h!=null&&o.getComponent(c,h),p=f&&t[f.mainType==="series"?"_chartsMap":"_componentsMap"][f.__viewId];l.event=a,l.type=i,t._$eventProcessor.eventInfo={targetEl:s,packedEvent:l,model:f,view:p},t.trigger(i,l)}};n.zrEventfulCallAtLast=!0,t._zr.on(i,n,t)}),N(Ox,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)}),$W(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&&W2(this.getDom(),VP,"");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 zx[i.id]},e.prototype.resize=function(t){if(!this[ta]){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[Ro]&&(a==null&&(a=this[Ro].silent),n=!0,this[Ro]=null),this[ta]=!0;try{n&&Tv(this),Bh.update.call(this,{type:"resize",animation:he({duration:0},t&&t.animation)})}catch(o){throw this[ta]=!1,o}this[ta]=!1,Nx.call(this,a),Ux.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(),!!FP[t]){var n=FP[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=he({},t);return i.type=Ox[t.type],i},e.prototype.dispatchAction=function(t,i){if(this._disposed){this.id;return}if(qe(i)||(i={silent:!!i}),!!Q1[t.type]&&this._model){if(this[ta]){this._pendingActions.push(t);return}var n=i.silent;NP.call(this,t,n);var a=i.flush;a?this._zr.flush():a!==!1&&Bt.browser.weChat&&this._throttledZrFlush(),Nx.call(this,n),Ux.call(this,n)}},e.prototype.updateLabelLayout=function(){Ws.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(){Tv=function(h){var f=h._scheduler;f.restorePipelines(h._model),f.prepareStageTasks(),DP(h,!0),DP(h,!1),f.plan()},DP=function(h,f){for(var p=h._model,d=h._scheduler,g=f?h._componentsViews:h._chartsViews,m=f?h._componentsMap:h._chartsMap,v=h._zr,_=h._api,y=0;yf.get("hoverLayerThreshold")&&!Bt.node&&!Bt.worker&&f.eachSeries(function(m){if(!m.preventUsingHoverLayer){var v=h._chartsMap[m.__viewId];v.__alive&&v.eachRendered(function(_){_.states.emphasis&&(_.states.emphasis.hoverLayer=!0)})}})}function o(h,f){var p=h.get("blendMode")||null;f.eachRendered(function(d){d.isGroup||(d.style.blend=p)})}function s(h,f){if(!h.preventAutoZ){var p=h.get("z")||0,d=h.get("zlevel")||0;f.eachRendered(function(g){return l(g,p,d,-1/0),!0})}}function l(h,f,p,d){var g=h.getTextContent(),m=h.getTextGuideLine(),v=h.isGroup;if(v)for(var _=h.childrenRef(),y=0;y<_.length;y++)d=Math.max(l(_[y],f,p,d),d);else h.z=f,h.zlevel=p,d=Math.max(h.z2,d);if(g&&(g.z=f,g.zlevel=p,isFinite(d)&&(g.z2=d+2)),m){var x=h.textGuideLineConfig;m.z=f,m.zlevel=p,isFinite(d)&&(m.z2=d+(x&&x.showAbove?1:-1))}return d}function u(h,f){f.eachRendered(function(p){if(!uc(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(h,f){var p=h.getModel("stateAnimation"),d=h.isAnimationEnabled(),g=p.get("duration"),m=g>0?{duration:g,delay:p.get("delay"),easing:p.get("easing")}:null;f.eachRendered(function(v){if(v.states&&v.states.emphasis){if(uc(v))return;if(v instanceof pt&&L4(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)}})}A6=function(h){return new(function(f){Z(p,f);function p(){return f!==null&&f.apply(this,arguments)||this}return p.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},p.prototype.getComponentByElement=function(d){for(;d;){var g=d.__ecComponentInfo;if(g!=null)return h._model.getComponent(g.mainType,g.index);d=d.parent}},p.prototype.enterEmphasis=function(d,g){jn(d,g),Xs(h)},p.prototype.leaveEmphasis=function(d,g){Kn(d,g),Xs(h)},p.prototype.enterBlur=function(d){Gw(d),Xs(h)},p.prototype.leaveBlur=function(d){Q_(d),Xs(h)},p.prototype.enterSelect=function(d){mD(d),Xs(h)},p.prototype.leaveSelect=function(d){vD(d),Xs(h)},p.prototype.getModel=function(){return h.getModel()},p.prototype.getViewOfComponentModel=function(d){return h.getViewOfComponentModel(d)},p.prototype.getViewOfSeriesModel=function(d){return h.getViewOfSeriesModel(d)},p}(w1))(h)},k6=function(h){function f(p,d){for(var g=0;g=0)){L6.push(t);var a=wP.wrapStageHandler(t,n);a.__prio=e,a.__raw=t,r.push(a)}}function XP(r,e){FP[r]=e}function Z6(r,e,t){var i=S6("registerMap");i&&i(r,e,t)}var j6=dW;kh(BP,OW);kh(tT,zW);kh(tT,FW);kh(BP,KW);kh(tT,JW);kh(I6,CP);GP(T1);HP(cpe,aP);XP("default",bP);xa({type:Dh,event:Dh,update:Dh},zr);xa({type:J_,event:J_,update:J_},zr);xa({type:nv,event:nv,update:nv},zr);xa({type:$_,event:$_,update:$_},zr);xa({type:av,event:av,update:av},zr);H6("light",HW);H6("dark",qW);var K6=[],wpe={registerPreprocessor:GP,registerProcessor:HP,registerPostInit:W6,registerPostUpdate:X6,registerUpdateLifecycle:rT,registerAction:xa,registerCoordinateSystem:Y6,registerLayout:q6,registerVisual:kh,registerTransform:j6,registerLoading:XP,registerMap:Z6,registerImpl:x6,PRIORITY:N6,ComponentModel:Nt,ComponentView:ir,SeriesModel:$t,ChartView:Zt,registerComponentModel:function(r){Nt.registerClass(r)},registerComponentView:function(r){ir.registerClass(r)},registerSeriesModel:function(r){$t.registerClass(r)},registerChartView:function(r){Zt.registerClass(r)},registerSubTypeDefaulter:function(r,e){Nt.registerSubTypeDefaulter(r,e)},registerPainter:function(r,e){nH(r,e)}};function Ot(r){if(pe(r)){N(r,function(e){Ot(e)});return}yt(K6,r)>=0||(K6.push(r),He(r)&&(r={install:r}),r.install(wpe))}function Fx(r){return r==null?0:r.length||1}function J6(r){return r}var Tpe=function(){function r(e,t,i,n,a,o){this._old=e,this._new=t,this._oldKeyGetter=i||J6,this._newKeyGetter=n||J6,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;o1){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;s1&&f===1)this._updateManyToOne&&this._updateManyToOne(c,u),n[l]=null;else if(h===1&&f>1)this._updateOneToMany&&this._updateOneToMany(c,u),n[l]=null;else if(h===1&&f===1)this._update&&this._update(c,u),n[l]=null;else if(h>1&&f>1)this._updateManyToMany&&this._updateManyToMany(c,u),n[l]=null;else if(h>1)for(var p=0;p1)for(var s=0;s30}var Bx=qe,Vh=de,Dpe=typeof Int32Array>"u"?Array:Int32Array,Ppe="e\0\0",Q6=-1,Ipe=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Npe=["_approximateExtent"],e8,aT,kx,Vx,JP,oT,$P,Upe=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;nT(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=t)){var i=this._store,n=i.getProvider();this._updateOrdinalMeta();var a=this._nameList,o=this._idList,s=n.getSource().sourceFormat,l=s===dn;if(l&&!n.pure)for(var u=[],c=e;c0},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():Bx(a)&&(a=he({},a)),n[t]=a),a},r.prototype.setItemVisual=function(e,t,i){var n=this._itemVisuals[e]||{};this._itemVisuals[e]=n,Bx(t)?he(n,t):n[t]=i},r.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},r.prototype.setLayout=function(e,t){Bx(e)?he(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?he(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;j_(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:Vh(this.dimensions,this._getDimInfo,this),this.hostModel)),JP(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(Xb(arguments)))})},r.internalField=function(){e8=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 Dpe(o.categories.length);for(var l=0;l1&&(l+="__ec__"+c),n[t]=l}}}(),r}(),oi=Upe;function Nl(r,e){xv(r)||(r=Sv(r)),e=e||{};var t=e.coordDimensions||[],i=e.dimensionsDefine||r.dimensionsDefine||[],n=ke(),a=[],o=zpe(r,t,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&KP(o),l=i===r.dimensionsDefine,u=l?jP(r):ZP(i),c=e.encodeDefine;!c&&e.encodeDefaulter&&(c=e.encodeDefaulter(r,o));for(var h=ke(c),f=new mP(o),p=0;p0&&(i.name=n+(a-1)),a++,e.set(n,a)}}function zpe(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 Fpe(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 Bpe=function(){function r(e){this.coordSysDims=[],this.axisMap=ke(),this.categoryAxisMap=ke(),this.coordSysName=e}return r}();function t8(r){var e=r.get("coordinateSystem"),t=new Bpe(e),i=kpe[e];if(i)return i(r,t,t.axisMap,t.categoryAxisMap),t}var kpe={cartesian2d:function(r,e,t,i){var n=r.getReferringComponents("xAxis",Ir).models[0],a=r.getReferringComponents("yAxis",Ir).models[0];e.coordSysDims=["x","y"],t.set("x",n),t.set("y",a),Cv(n)&&(i.set("x",n),e.firstCategoryDimIndex=0),Cv(a)&&(i.set("y",a),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(r,e,t,i){var n=r.getReferringComponents("singleAxis",Ir).models[0];e.coordSysDims=["single"],t.set("single",n),Cv(n)&&(i.set("single",n),e.firstCategoryDimIndex=0)},polar:function(r,e,t,i){var n=r.getReferringComponents("polar",Ir).models[0],a=n.findAxisModel("radiusAxis"),o=n.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],t.set("radius",a),t.set("angle",o),Cv(a)&&(i.set("radius",a),e.firstCategoryDimIndex=0),Cv(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),Cv(u)&&(i.set(c,u),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function Cv(r){return r.get("type")==="category"}function r8(r,e,t){t=t||{};var i=t.byIndex,n=t.stackedCoordDimension,a,o,s;Vpe(e)?a=e:(o=e.schema,a=o.dimensions,s=e.store);var l=!!(r&&r.get("stack")),u,c,h,f;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){h="__\0ecstackresult_"+r.id,f="__\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:h,coordDim:p,coordDimIndex:g,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},v={name:f,coordDim:f,coordDimIndex:g+1,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(m.storeDimIndex=s.ensureCalculationDimension(f,d),v.storeDimIndex=s.ensureCalculationDimension(h,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:f,stackResultDimension:h}}function Vpe(r){return!nT(r.schema)}function ls(r,e){return!!e&&e===r.getCalculationInfo("stackedDimension")}function sT(r,e){return ls(r,e)?r.getCalculationInfo("stackResultDimension"):e}function Gpe(r,e){var t=r.get("coordinateSystem"),i=gc.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=id(l)}return o})),n||(n=i&&(i.getDimensionsInfo?i.getDimensionsInfo():i.dimensions.slice())||["x","y"]),n}function Hpe(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 Wpe(r,e,t){t=t||{};var i=e.getSourceManager(),n,a=!1;r?(a=!0,n=Sv(r)):(n=i.getSource(),a=n.sourceFormat===dn);var o=t8(e),s=Gpe(e,o),l=t.useEncodeDefaulter,u=He(l)?l:l?ut(_1,s,e):null,c={coordDimensions:s,generateCoord:t.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!a},h=Nl(n,c),f=Hpe(h.dimensions,t.createInvertedIndices,o),p=a?null:i.getSharedDataStore(h),d=r8(e,{schema:h,store:p}),g=new oi(h,e);g.setCalculationInfo(d);var m=f!=null&&Xpe(n)?function(v,_,y,x){return x===f?y:this.defaultDimValueGetter(v,_,y,x)}:null;return g.hasItemOption=!1,g.initData(a?n:p,null,m),g}function Xpe(r){if(r.sourceFormat===dn){var e=Ype(r.data||[]);return!pe(Sl(e))}}function Ype(r){for(var e=0;et[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}();Th(i8);var Lo=i8;var qpe=0,Zpe=function(){function r(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++qpe}return r.createByAxisModel=function(e){var t=e.option,i=t.data,n=i&&de(i,jpe);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 jpe(r){return qe(r)&&r.value!=null?r.value:r+""}var Gx=Zpe;function Hx(r){return r.type==="interval"||r.type==="log"}function a8(r,e,t,i){var n={},a=r[1]-r[0],o=n.interval=jm(a/e,!0);t!=null&&oi&&(o=n.interval=i);var s=n.intervalPrecision=QP(o),l=n.niceTickExtent=[Pr(Math.ceil(r[0]/o)*o,s),Pr(Math.floor(r[1]/o)*o,s)];return Kpe(l,r),n}function lT(r){var e=Math.pow(10,Zm(r)),t=r/e;return t?t===2?t=3:t===3?t=5:t*=2:t=1,Pr(t*e)}function QP(r){return Cn(r)+2}function n8(r,e,t){r[e]=Math.max(Math.min(r[e],t[1]),t[0])}function Kpe(r,e){!isFinite(r[0])&&(r[0]=e[0]),!isFinite(r[1])&&(r[1]=e[1]),n8(r,0,e),n8(r,1,e),r[0]>r[1]&&(r[0]=r[1])}function Gh(r,e){return r>=e[0]&&r<=e[1]}function Hh(r,e){return e[1]===e[0]?.5:(r-e[0])/(e[1]-e[0])}function Wh(r,e){return r*(e[1]-e[0])+e[0]}var o8=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 Gx({})),pe(n)&&(n=new Gx({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),Gh(t,this._extent)&&this._ordinalMeta.categories[t]!=null},e.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),Hh(t,this._extent)},e.prototype.scale=function(t){return t=Math.round(Wh(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=0&&t=0&&t=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(Lo);Lo.registerClass(o8);var Wx=o8;var nd=Pr,s8=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 Gh(t,this._extent)},e.prototype.normalize=function(t){return Hh(t,this._extent)},e.prototype.scale=function(t){return Wh(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[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=QP(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]l)return[];var c=s.length?s[s.length-1].value:a[1];return n[1]>c&&(t?s.push({value:nd(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;oa[0]&&p0&&(a=a===null?s:Math.min(a,s))}t[i]=a}}return t}function nI(r){var e=$pe(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]),h=a.scale.getExtent(),f=Math.abs(h[1]-h[0]);s=u?c/f*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")||(p8(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:rI(a),stackId:tI(i)})}),c8(t)}function c8(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 h=i.barMaxWidth;h&&(l[u].maxWidth=h);var f=i.barMinWidth;f&&(l[u].minWidth=f);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=At(a).length;s=Math.max(35-l*4,15)+"%"}var u=ze(s,o),c=ze(i.gap,1),h=i.remainedWidth,f=i.autoWidthCount,p=(h-u)/(f+(f-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,h-=x+c*x,f--}else{var x=p;_&&_x&&(x=y),x!==p&&(v.width=x,h-=x+c*x,f--)}}),p=(h-u)/(f+(f-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 h8(r,e,t){if(r&&e){var i=r[rI(e)];return i!=null&&t!=null?i[tI(t)]:i}}function cT(r,e){var t=iI(r,e),i=nI(t);N(t,function(n){var a=n.getData(),o=n.coordinateSystem,s=o.getBaseAxis(),l=tI(n),u=i[rI(s)][l],c=u.offset,h=u.width;a.setLayout({bandWidth:u.bandWidth,offset:c,size:h})})}function hT(r){return{seriesType:r,plan:os(),reset:function(e){if(f8(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"),h=ls(t,u)&&!!t.getCalculationInfo("stackedOnSeries"),f=a.isHorizontal(),p=Qpe(n,a),d=p8(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&&Sa(M*3),w=d&&l&&Sa(M*3),T=d&&Sa(M),C=i.master.getRect(),b=f?C.width:C.height,E,I=x.getStore(),R=0;(E=y.next())!=null;){var A=I.get(h?m:o,E),P=I.get(s,E),U=p,B=void 0;h&&(B=+A-I.get(o,E));var z=void 0,k=void 0,G=void 0,Y=void 0;if(f){var J=i.dataToPoint([A,P]);if(h){var Q=i.dataToPoint([B,P]);U=Q[0]}z=U,k=J[1]+_,G=J[0]-U,Y=v,Math.abs(G)>>1;r[n][1]n&&(this._approxInterval=n);var s=fT.length,l=Math.min(ede(fT,this._approxInterval,0,s),s-1);this._interval=fT[l][1],this._minLevelUnit=fT[Math.max(l-1,0)][0]},e.prototype.parse=function(t){return Dt(t)?t:+Rn(t)},e.prototype.contain=function(t){return Gh(this.parse(t),this._extent)},e.prototype.normalize=function(t){return Hh(this.parse(t),this._extent)},e.prototype.scale=function(t){return Wh(t,this._extent)},e.type="time",e}(Do),fT=[["second",h1],["minute",f1],["hour",vv],["quarter-day",vv*6],["half-day",vv*12],["day",is*1.2],["half-week",is*3.5],["week",is*7],["month",is*31],["quarter",is*95],["half-year",FD/2],["year",FD]];function tde(r,e,t,i){var n=Rn(e),a=Rn(t),o=function(d){return VD(n,d,i)===VD(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")},h=function(){return c()&&o("minute")},f=function(){return h()&&o("second")},p=function(){return f()&&o("millisecond")};switch(r){case"year":return s();case"month":return l();case"day":return u();case"hour":return c();case"minute":return h();case"second":return f();case"millisecond":return p()}}function rde(r,e){return r/=is,r>16?16:r>7.5?7:r>3.5?4:r>1.5?2:1}function ide(r){var e=30*is;return r/=e,r>6?6:r>3?3:r>2?2:1}function nde(r){return r/=vv,r>12?12:r>6?6:r>3.5?4:r>2?2:1}function d8(r,e){return r/=e?f1:h1,r>30?30:r>20?20:r>15?15:r>10?10:r>5?5:r>2?2:1}function ade(r){return jm(r,!0)}function ode(r,e,t){var i=new Date(r);switch(jp(e)){case"year":case"month":i[GD(t)](0);case"day":i[HD(t)](1);case"hour":i[WD(t)](0);case"minute":i[XD(t)](0);case"second":i[YD(t)](0),i[qD(t)](0)}return i.getTime()}function sde(r,e,t,i){var n=1e4,a=kD,o=0;function s(b,E,I,R,A,P,U){for(var B=new Date(E),z=E,k=B[R]();z1&&P===0&&I.unshift({value:I[0].value-z})}}for(var P=0;P=i[0]&&_<=i[1]&&h++)}var y=(i[1]-i[0])/e;if(h>y*1.5&&f>y/1.5||(u.push(m),h>y||r===a[p]))break}c=[]}}}for(var x=Yt(de(u,function(b){return Yt(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;p0;)a*=10;var s=[Pr(cde(i[0]/a)*a),Pr(ude(i[1]/a)*a)];this._interval=a,this._niceExtent=s}},e.prototype.calcNiceExtent=function(t){Xx.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=Ul(t)/Ul(this.base),Gh(t,this._extent)},e.prototype.normalize=function(t){return t=Ul(t)/Ul(this.base),Hh(t,this._extent)},e.prototype.scale=function(t){return t=Wh(t,this._extent),dT(this.base,t)},e.type="log",e}(Lo),g8=aI.prototype;g8.getMinorTicks=Xx.getMinorTicks;g8.getLabel=Xx.getLabel;function mT(r,e){return lde(r,Cn(e))}Lo.registerClass(aI);var y8=aI;var hde=function(){function r(e,t,i){this._prepareParams(e,t,i)}return r.prototype._prepareParams=function(e,t,i){i[1]0&&l>0&&!u&&(s=0),s<0&&l<0&&!c&&(l=0));var f=this._determinedMin,p=this._determinedMax;return f!=null&&(s=f,u=!0),p!=null&&(l=p,c=!0),{min:s,max:l,minFixed:u,maxFixed:c,isBlank:h}},r.prototype.modifyDataMinMax=function(e,t){this[pde[e]]=t},r.prototype.setDeterminedMinMax=function(e,t){var i=fde[e];this[i]=t},r.prototype.freeze=function(){this.frozen=!0},r}();var fde={min:"_determinedMin",max:"_determinedMax"},pde={min:"_dataMin",max:"_dataMax"};function gT(r,e,t){var i=r.rawExtentInfo;return i||(i=new hde(r,e,t),r.rawExtentInfo=i,i)}function vT(r,e){return e==null?null:dh(e)?NaN:r.parse(e)}function oI(r,e){var t=r.type,i=gT(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=iI("bar",o),l=!1;if(N(s,function(h){l=l||h.getBaseAxis()===e.axis}),l){var u=nI(s),c=dde(n,a,e,u);n=c.min,a=c.max}}return{extent:[n,a],fixMin:i.minFixed,fixMax:i.maxFixed}}function dde(r,e,t,i){var n=t.axis.getExtent(),a=n[1]-n[0],o=h8(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,h=1-(s+l)/a,f=c/h-c;return e+=f*(l/u),r-=f*(s/u),{min:r,max:e}}function bu(r,e){var t=e,i=oI(r,t),n=i.extent,a=t.get("splitNumber");r instanceof y8&&(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 Xh(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new Wx({ordinalMeta:r.getOrdinalMeta?r.getOrdinalMeta():r.getCategories(),extent:[1/0,-1/0]});case"time":return new pT({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new(Lo.getClass(e)||Do)}}function _8(r){var e=r.scale.getExtent(),t=e[0],i=e[1];return!(t>0&&i>0||t<0&&i<0)}function Rv(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(Yx(r,n),a,n.level!=null?{level:n.level}:null)}}(e):function(i){return r.scale.getLabel(i)}}function Yx(r,e){return r.type==="category"?r.scale.getLabel(e):e.value}function x8(r){var e=r.model,t=r.scale;if(!(!e.get(["axisLabel","show"])||t.isBlank())){var i,n,a=t.getExtent();t instanceof Wx?n=t.count():(i=t.getTicks(),n=i.length);var o=r.getLabelModel(),s=Rv(r),l,u=1;n>40&&(u=Math.ceil(n/40));for(var c=0;cr[1]&&(r[1]=n[1])})}var wu=function(){function r(){}return r.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},r.prototype.getCoordSysModel=function(){},r}();var vde=1e-8;function M8(r,e){return Math.abs(r-e)n&&(i=o,n=l)}if(i)return yde(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"?w8(s.exterior,n,a,t):N(s.points,function(l){w8(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 ft(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>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 hI(r,e){return r=_de(r),de(Yt(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 lI(o[0],o.slice(1)));break;case"MultiPolygon":N(n.coordinates,function(l){l[0]&&a.push(new lI(l[0],l.slice(1)))});break;case"LineString":a.push(new uI([n.coordinates]));break;case"MultiLineString":a.push(new uI(n.coordinates))}var s=new ST(i[e||"name"],a,i.cp);return s.properties=i,s})}var Dv={};UL(Dv,{MAX_SAFE_INTEGER:()=>B_,asc:()=>Ri,getPercentWithPrecision:()=>uH,getPixelPrecision:()=>qm,getPrecision:()=>Cn,getPrecisionSafe:()=>k2,isNumeric:()=>Rp,isRadianAroundZero:()=>ic,linearMap:()=>ar,nice:()=>jm,numericToNumber:()=>_o,parseDate:()=>Rn,quantile:()=>Km,quantity:()=>Rw,quantityExponent:()=>Zm,reformIntervals:()=>V_,remRadian:()=>k_,round:()=>Pr});var qx=xt();function C8(r){return r.type==="category"?xde(r):Mde(r)}function R8(r,e){return r.type==="category"?Sde(r,e):{ticks:de(r.scale.getTicks(),function(t){return t.value})}}function xde(r){var e=r.getLabelModel(),t=L8(r,e);return!e.get("show")||r.scale.isBlank()?{labels:[],labelCategoryInterval:t.labelCategoryInterval}:t}function L8(r,e){var t=D8(r,"labels"),i=yT(e),n=P8(t,i);if(n)return n;var a,o;return He(i)?a=O8(r,i):(o=i==="auto"?bde(r):i,a=U8(r,o)),I8(t,i,{labels:a,labelCategoryInterval:o})}function Sde(r,e){var t=D8(r,"ticks"),i=yT(e),n=P8(t,i);if(n)return n;var a,o;if((!e.get("show")||r.scale.isBlank())&&(a=[]),He(i))a=O8(r,i,!0);else if(i==="auto"){var s=L8(r,r.getLabelModel());o=s.labelCategoryInterval,a=de(s.labels,function(l){return l.tickValue})}else o=i,a=U8(r,o,!0);return I8(t,i,{ticks:a,tickCategoryInterval:o})}function Mde(r){var e=r.scale.getTicks(),t=Rv(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 D8(r,e){return qx(r)[e]||(qx(r)[e]=[])}function P8(r,e){for(var t=0;t40&&(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)),h=Math.abs(u*Math.sin(i)),f=0,p=0;l<=a[1];l+=s){var d=0,g=0,m=fu(t({value:l}),e.font,"center","top");d=m.width*1.3,g=m.height*1.3,f=Math.max(f,d,7),p=Math.max(p,g,7)}var v=f/c,_=p/h;isNaN(v)&&(v=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(v,_))),x=qx(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 wde(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 U8(r,e,t){var i=Rv(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 h=_T(r),f=o.get("showMinLabel")||h,p=o.get("showMaxLabel")||h;f&&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 O8(r,e,t){var i=r.scale,n=Rv(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 z8=[0,1],Tde=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 qm(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(),F8(i,n.count())),ar(e,z8,i,t)},r.prototype.coordToData=function(e,t){var i=this._extent,n=this.scale;this.onBand&&n.type==="ordinal"&&(i=i.slice(),F8(i,n.count()));var a=ar(e,i,z8,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=R8(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 Ede(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 C8(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 N8(this)},r}();function F8(r,e){var t=r[1]-r[0],i=e,n=t/i/2;r[0]+=n,r[1]-=n}function Ede(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 h=a[0]>a[1];f(e[0].coord,a[0])&&(i?e[0].coord=a[0]:e.shift()),i&&f(a[0],e[0].coord)&&e.unshift({coord:a[0]}),f(a[1],o.coord)&&(i?o.coord=a[1]:e.pop()),i&&f(o.coord,a[1])&&e.push({coord:a[1]});function f(p,d){return p=Pr(p),d=Pr(d),h?p>d:pn&&(n+=Zx);var p=Math.atan2(s,o);if(p<0&&(p+=Zx),p>=i&&p<=n||p+Zx>=i&&p+Zx<=n)return l[0]=c,l[1]=h,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 _0){e=e/180*Math.PI,zl.fromArray(r[0]),Jr.fromArray(r[1]),Di.fromArray(r[2]),zt.sub(Eu,zl,Jr),zt.sub(Tu,Di,Jr);var t=Eu.len(),i=Tu.len();if(!(t<.001||i<.001)){Eu.scale(1/t),Tu.scale(1/i);var n=Eu.dot(Tu),a=Math.cos(e);if(a1&&zt.copy(Ma,Di),Ma.toArray(r[1])}}}}function k8(r,e,t){if(t<=180&&t>0){t=t/180*Math.PI,zl.fromArray(r[0]),Jr.fromArray(r[1]),Di.fromArray(r[2]),zt.sub(Eu,Jr,zl),zt.sub(Tu,Di,Jr);var i=Eu.len(),n=Tu.len();if(!(i<.001||n<.001)){Eu.scale(1/i),Tu.scale(1/n);var a=Eu.dot(e),o=Math.cos(t);if(a=l)zt.copy(Ma,Di);else{Ma.scaleAndAdd(Tu,s/Math.tan(Math.PI/2-c));var h=Di.x!==Jr.x?(Ma.x-Jr.x)/(Di.x-Jr.x):(Ma.y-Jr.y)/(Di.y-Jr.y);if(isNaN(h))return;h<0?zt.copy(Ma,Jr):h>1&&zt.copy(Ma,Di)}Ma.toArray(r[1])}}}}function fI(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 Pde(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=Rs(i[0],i[1]),a=Rs(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=Um([],i[1],i[0],o/n),l=Um([],i[1],i[2],o/a),u=Um([],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;c0&&a&&S(-h/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;I0)for(var R=0;R0;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;I0?S(E,0,I+1):S(-E,o-I-1,o),C-=E,C<=0)return}return u}function G8(r,e,t,i){return V8(r,"x","width",e,t,i)}function TT(r,e,t,i){return V8(r,"y","height",e,t,i)}function ET(r){var e=[];r.sort(function(g,m){return m.priority-g.priority});var t=new ft(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=0&&i.attr(a.oldLayoutSelect),yt(f,"emphasis")>=0&&i.attr(a.oldLayoutEmphasis)),Ut(i,u,t,l)}else if(i.attr(u),!dc(i).valueAnimation){var h=mt(i.style.opacity,1);i.style.opacity=0,lr(i,{style:{opacity:h}},t,l)}if(a.oldLayout=u,i.states.select){var p=a.oldLayoutSelect={};AT(p,u,CT),AT(p,i.states.select,CT)}if(i.states.emphasis){var d=a.oldLayoutEmphasis={};AT(d,u,CT),AT(d,i.states.emphasis,CT)}o1(i,l,c,t,t)}if(n&&!n.ignore&&!n.invisible){var a=Ude(n),o=a.oldLayout,g={points:n.shape.points};o?(n.attr({shape:o}),Ut(n,{shape:g},t)):(n.setShape(g),n.style.strokePercent=0,lr(n,{style:{strokePercent:1}},t)),a.oldLayout=g}},r}(),W8=Ode;var vI=xt();function gI(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){var n=vI(t).labelManager;n||(n=vI(t).labelManager=new W8),n.clearLabels()}),r.registerUpdateLifecycle("series:layoutlabels",function(e,t,i){var n=vI(t).labelManager;i.updatedSeries.forEach(function(a){n.addLabelsOfSeries(t.getViewOfSeriesModel(a))}),n.updateLayoutConfig(t),n.layout(t),n.processLabelsOverall()})}var yI=Math.sin,_I=Math.cos,X8=Math.PI,od=Math.PI*2,zde=180/X8,Fde=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,h=Math.abs(u),f=hu(h-od)||(c?u>=od:-u>=od),p=u>0?u%od:u%od+od,d=!1;f?d=!0:hu(h)?d=!1:d=p>=X8==!!c;var g=e+i*_I(o),m=t+n*yI(o);this._start&&this._add("M",g,m);var v=Math.round(a*zde);if(f){var _=1/this._p,y=(c?1:-1)*(od-_);this._add("A",i,n,v,1,+c,e+i*_I(o+y),t+n*yI(o+y)),_>.01&&this._add("A",i,n,v,0,+c,g,m)}else{var x=e+i*_I(s),M=t+n*yI(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=[],h=this._p,f=1;f"}function Wde(r){return""}function Kx(r,e){e=e||{};var t=e.newline?` `:"";function i(n){var a=n.children,o=n.tag,s=n.attrs,l=n.text;return Hde(o,s)+(o!=="style"?Tn(l):l||"")+(a?""+t+de(a,function(u){return i(u)}).join(t)+t:"")+Wde(o)}return i(r)}function j8(r,e,t){t=t||{};var i=t.newline?` `:"",n=" {"+i,a=i+"}",o=de(At(r),function(l){return l+n+de(At(r[l]),function(u){return u+":"+r[l][u]+";"}).join(i)+a}).join(i),s=de(At(e),function(l){return"@keyframes "+l+n+de(At(e[l]),function(u){return u+n+de(At(e[l][u]),function(c){var h=e[l][u][c];return c==="d"&&(h='path("'+h+'")'),c+":"+h+";"}).join(i)+a}).join(i)+a}).join(i);return!o&&!s?"":[""].join(i)}function Jx(r){return{zrId:r,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function wI(r,e,t,i){return Pi("svg","root",{width:r,height:e,xmlns:Y8,"xmlns:xlink":MI,version:"1.1",baseProfile:"full",viewBox:i?"0 0 "+r+" "+e:!1},t)}var Xde=0;function DT(){return Xde++}var K8={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"},sd="transform-origin";function Yde(r,e,t){var i=he({},r.shape);he(i,e),r.buildPath(t,i);var n=new RT;return n.reset(yw(r)),t.rebuildPath(n,1),n.generateStr(),n.getStr()}function qde(r,e){var t=e.originX,i=e.originY;(t||i)&&(r[sd]=t+"px "+i+"px")}var Zde={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function $8(r,e){var t=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[t]=r,t}function jde(r,e,t){var i=r.shape.paths,n={},a,o;if(N(i,function(l){var u=Jx(t.zrId);u.animation=!0,$x(l,{},u,!0);var c=u.cssAnims,h=u.cssNodes,f=At(c),p=f.length;if(p){o=f[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 h){var _=h[v].animation;_.indexOf(o)>=0&&(a=_)}}}),!!a){e.d=!1;var s=$8(n,t);return a.replace(o,s)}}function J8(r){return Ce(r)?K8[r]?"cubic-bezier("+K8[r]+")":km(r)?r:"":""}function $x(r,e,t,i){var n=r.animators,a=n.length,o=[];if(r instanceof uv){var s=jde(r,e,t);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var l={},u=0;u0}).length){var ve=$8(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-"+DT();t.cssNodes["."+v]={animation:o.join(",")},e.class=v}}function eX(r,e,t){if(!r.ignore)if(r.isSilent()){var i={"pointer-events":"none"};Q8(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=L_(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),Q8(i,e,t,!0)}}function Q8(r,e,t,i){var n=JSON.stringify(r),a=t.cssStyleCache[n];a||(a=t.zrId+"-cls-"+DT(),t.cssStyleCache[n]=a,t.cssNodes["."+a+(i?":hover":"")]=r),e.class=e.class?e.class+" "+a:a}var Qx=Math.round;function nX(r){return r&&Ce(r.src)}function aX(r){return r&&He(r.toDataURL)}function TI(r,e,t,i){SI(function(n,a){var o=n==="fill"||n==="stroke";o&&gw(a)?RI(e,r,n,i):o&&D_(a)?LI(t,r,n,i):o&&a==="none"?r[n]="transparent":r[n]=a},e,t,!1),rme(t,r,i)}function EI(r,e){var t=aH(e);t&&(t.each(function(i,n){i!=null&&(r[(bI+n).toLowerCase()]=i+"")}),e.isSilent()&&(r[bI+"silent"]="true"))}function tX(r){return hu(r[0]-1)&&hu(r[1])&&hu(r[2])&&hu(r[3]-1)}function Kde(r){return hu(r[4])&&hu(r[5])}function AI(r,e,t){if(e&&!(Kde(e)&&tX(e))){var i=t?10:1e4;r.transform=tX(e)?"translate("+Qx(e[4]*i)/i+" "+Qx(e[5]*i)/i+")":IG(e)}}function rX(r,e,t){for(var i=r.points,n=[],a=0;a"u"){var m="Image width/height must been given explictly in svg-ssr renderer.";Wr(f,m),Wr(p,m)}else if(f==null||p==null){var v=function(b,E){if(b){var I=b.elm,R=f||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))}},_=X_(d,null,r,function(b){l||v(S,b),v(h,b)});_&&_.width&&_.height&&(f=f||_.width,p=p||_.height)}h=Pi("image","img",{href:d,width:f,height:p}),o.width=f,o.height=p}else n.svgElement&&(h=Qe(n.svgElement),o.width=n.svgWidth,o.height=n.svgHeight);if(h){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=_w(n);M&&(o.patternTransform=M);var S=Pi("pattern","",o,[h]),w=Kx(S),T=i.patternCache,C=T[w];C||(C=i.zrId+"-p"+i.patternIdx++,T[w]=C,o.id=C,S=i.defs[C]=Pi("pattern",C,o,[h])),e[t]=P_(C)}}function sX(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]=Pi("clipPath",a,o,[oX(r,t)])}e["clip-path"]=P_(a)}function DI(r){return document.createTextNode(r)}function Yh(r,e,t){r.insertBefore(e,t)}function PI(r,e){r.removeChild(e)}function II(r,e){r.appendChild(e)}function NI(r){return r.parentNode}function UI(r){return r.nextSibling}function PT(r,e){r.textContent=e}var lX=58,nme=120,ame=Pi("","");function OI(r){return r===void 0}function Au(r){return r!==void 0}function ome(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 eS(r,e){var t=r.key===e.key,i=r.tag===e.tag;return i&&t}function tS(r){var e,t=r.children,i=r.tag;if(Au(i)){var n=r.elm=LT(i);if(NT(ame,r),pe(t))for(e=0;ea?(d=t[l+1]==null?null:t[l+1].elm,uX(r,d,t,n,l)):IT(r,e,i,a))}function Nv(r,e){var t=e.elm=r.elm,i=r.children,n=e.children;r!==e&&(NT(r,e),OI(e.text)?Au(i)&&Au(n)?i!==n&&sme(t,i,n):Au(n)?(Au(r.text)&&PT(t,""),uX(t,null,n,0,n.length-1)):Au(i)?IT(t,i,0,i.length-1):Au(r.text)&&PT(t,""):r.text!==e.text&&(Au(i)&&IT(t,i,0,i.length-1),PT(t,e.text)))}function zI(r,e){if(eS(r,e))Nv(r,e);else{var t=r.elm,i=NI(t);tS(e),i!==null&&(Yh(i,e.elm,UI(t)),IT(i,[r],0,0))}return e}var lme=0,ume=function(){function r(e,t,i){if(this.type="svg",this.refreshHover=cX("refreshHover"),this.configLayer=cX("configLayer"),this.storage=t,this._opts=i=he({},i),this.root=e,this._id="zr"+lme++,this._oldVNode=wI(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=LT("svg");NT(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",zI(this._oldVNode,e),this._oldVNode=e}},r.prototype.renderOneToVNode=function(e){return CI(e,Jx(this._id))},r.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),i=this._width,n=this._height,a=Jx(this._id);a.animation=e.animation,a.willUpdate=e.willUpdate,a.compress=e.compress,a.emphasis=e.emphasis;var o=[],s=this._bgVNode=cme(i,n,this._backgroundColor,a);s&&o.push(s);var l=e.compress?null:this._mainVNode=Pi("g","main",{},[]);this._paintList(t,a,l?l.children:o),l&&o.push(l);var u=de(At(a.defs),function(f){return a.defs[f]});if(u.length&&o.push(Pi("defs","defs",{},u)),e.animation){var c=j8(a.cssNodes,a.cssAnims,{newline:!0});if(c){var h=Pi("style","stl",{},[],c);o.push(h)}}return wI(i,n,o,e.useViewBox)},r.prototype.renderToString=function(e){return e=e||{},Kx(this.renderToVNode({animation:mt(e.cssAnimation,!0),emphasis:mt(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:mt(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=0&&!(f&&l&&f[g]===l[g]);g--);for(var m=d-1;m>g;m--)o--,s=a[o-1];for(var v=g+1;v=s)}}for(var h=this.__startIndex;h15)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.__drawIndex0&&e>n[0]){for(l=0;le);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;n0?OT:0),this._needsManuallyCompositing),c.__builtin__||up("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&ki&&!n.__inHover&&(c.__dirty=!0,c.incremental&&c.__drawIndex<0&&(c.__drawIndex=l))}t(l),this.eachBuiltinLayer(function(h,f){!h.__used&&h.getElementCount()>0&&(h.__dirty=!0,h.__startIndex=h.__endIndex=h.__drawIndex=0),h.__dirty&&h.__drawIndex<0&&(h.__drawIndex=h.__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]?bt(i[e],t,!0):i[e]=t;for(var n=0;n-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}($t),mX=vme;function Fl(r,e){var t=r.mapDimensionsAll("defaultedLabel"),i=t.length;if(i===1){var n=_c(r,e,t[0]);return n!=null?n+"":null}else if(i){for(var a=[],o=0;o=0&&i.push(e[a])}return i.join(" ")}var gme=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=wr(t,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:a[0]/2,scaleY:a[1]/2}),s.drift=yme,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(){jn(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 h=t.getItemVisual(i,"symbolKeepAspect");this._createSymbol(o,t,i,l,h)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:l[0]/2,scaleY:l[1]/2};c?f.attr(p):Ut(f,p,s,i),Ui(f)}if(this._updateCommon(t,i,l,n,a),u){var f=this.childAt(0);if(!c){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,lr(f,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,h,f,p,d,g,m,v;if(a&&(u=a.emphasisItemStyle,c=a.blurItemStyle,h=a.selectItemStyle,f=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(),h=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),f=y.get("focus"),p=y.get("blurScope"),d=y.get("disabled"),g=Rr(_),m=y.getShallow("scale"),v=_.getShallow("cursor")}var x=t.getItemVisual(i,"symbolRotate");s.attr("rotation",(x||0)*Math.PI/180||0);var M=ss(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 Br){var T=s.style;s.useStyle(he({image:T.image,x:T.x,y:T.y,width:T.width,height:T.height},S))}else s.__isEmptyBrush?s.useStyle(he({},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;Fr(s,g,{labelFetcher:l,labelDataIndex:i,defaultText:I,inheritColor:w,defaultOpacity:S.opacity});function I(P){return E?t.getName(P):Fl(t,P)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var R=s.ensureState("emphasis");R.style=u,s.ensureState("select").style=h,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),sr(this,f,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=it(this).dataIndex,s=n&&n.animation;if(this.silent=a.silent=!0,n&&n.fadeLabel){var l=a.getTextContent();l&&Fs(l,{style:{opacity:0}},i,{dataIndex:o,removeOpt:s,cb:function(){a.removeTextContent()}})}else a.removeTextContent();Fs(a,{style:{opacity:0},scaleX:0,scaleY:0},i,{dataIndex:o,cb:t,removeOpt:s})},e.getSymbolSize=function(t,i){return Pl(t.getItemVisual(i,"symbolSize"))},e}(Ze);function yme(r,e){this.parent.drift(r,e)}var Mc=gme;function kI(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 vX(r){return r!=null&&!qe(r)&&(r={isIgnore:r}),r||{}}function gX(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:Rr(e),cursorStyle:e.get("cursor")}}var _me=function(){function r(e){this.group=new Ze,this._SymbolCtor=e||Mc}return r.prototype.updateData=function(e,t){this._progressiveEls=null,t=vX(t);var i=this.group,n=e.hostModel,a=this._data,o=this._SymbolCtor,s=t.disableAnimation,l=gX(e),u={disableAnimation:s},c=t.getSymbolPoint||function(h){return e.getItemLayout(h)};a||i.removeAll(),e.diff(a).add(function(h){var f=c(h);if(kI(e,f,h,t)){var p=new o(e,h,l,u);p.setPosition(f),e.setItemGraphicEl(h,p),i.add(p)}}).update(function(h,f){var p=a.getItemGraphicEl(f),d=c(h);if(!kI(e,d,h,t)){i.remove(p);return}var g=e.getItemVisual(h,"symbol")||"circle",m=p&&p.getSymbolType&&p.getSymbolType();if(!p||m&&m!==g)i.remove(p),p=new o(e,h,l,u),p.setPosition(d);else{p.updateData(e,h,l,u);var v={x:d[0],y:d[1]};s?p.attr(v):Ut(p,v,n)}i.add(p),e.setItemGraphicEl(h,p)}).remove(function(h){var f=a.getItemGraphicEl(h);f&&f.fadeOut(function(){i.remove(f)},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=gX(e),this._data=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t,i){this._progressiveEls=[],i=vX(i);function n(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var a=e.start;a0?t=i[0]:i[1]<0&&(t=i[1]),t}function BT(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 VI(r,e,t,i,n,a,o,s){for(var l=Sme(r,e),u=[],c=[],h=[],f=[],p=[],d=[],g=[],m=FT(n,e,o),v=r.getLayout("points")||[],_=e.getLayout("points")||[],y=0;y=n||g<0)break;if(ud(v,_)){if(l){g+=a;continue}break}if(g===t)r[a>0?"moveTo":"lineTo"](v,_),h=v,f=_;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||ud(S,w))p=v,d=_;else{b=S-u,E=w-c;var A=v-u,P=S-v,U=_-c,B=w-_,z=void 0,k=void 0;if(s==="x"){z=Math.abs(A),k=Math.abs(P);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(P*P+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=qh(I,Zh(S,v)),R=qh(R,Zh(w,_)),I=Zh(I,qh(S,v)),R=Zh(R,qh(w,_)),b=I-v,E=R-_,p=v-b*z/k,d=_-E*z/k,p=qh(p,Zh(u,v)),d=qh(d,Zh(c,_)),p=Zh(p,qh(u,v)),d=Zh(d,qh(c,_)),b=v-p,E=_-d,I=v+b*k/z,R=_+E*k/z}r.bezierCurveTo(h,f,p,d,v,_),h=I,f=R}else r.lineTo(v,_)}u=v,c=_,g+=a}return m}var yX=function(){function r(){this.smooth=0,this.smoothConstraint=!0}return r}(),_X=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 yX},e.prototype.buildPath=function(t,i){var n=i.points,a=0,o=n.length/2;if(i.connectNulls){for(;o>0&&ud(n[o*2-2],n[o*2-1]);o--);for(;a=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[h++],d=a[h++],g=a[h++],m=a[h++],v=a[h++],_=a[h++];var M=u?yp(s,p,g,v,t,c):yp(l,d,m,_,t,c);if(M>0)for(var S=0;S=0){var x=u?vi(l,d,m,_,w):vi(s,p,g,v,w);return u?[t,x]:[x,t]}}s=v,l=_;break}}},e}(pt);var Mme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(yX),kT=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 Mme},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&&ud(n[s*2-2],n[s*2-1]);s--);for(;oe){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 Tme(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,h=a.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),h.reverse());var f=wme(u,n==="x"?t.getWidth():t.getHeight()),p=f.length;if(!p&&c)return u[0].coord<0?h[1]?h[1]:u[c-1].color:h[0]?h[0]:u[0].color;var d=10,g=f[0].coord-d,m=f[p-1].coord+d,v=m-g;if(v<.001)return"transparent";N(f,function(y){y.offset=(y.coord-g)/v}),f.push({offset:p?f[p-1].offset:.5,color:h[1]||"transparent"}),f.unshift({offset:p?f[0].offset:.5,color:h[0]||"transparent"});var _=new xu(0,0,0,0,f,!0);return _[n]=g,_[n+"2"]=m,_}}}function Eme(r,e,t){var i=r.get("showAllSymbol"),n=i==="auto";if(!(i&&!n)){var a=t.getAxesByScale("ordinal")[0];if(a&&!(n&&Ame(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 Ame(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;oi)return!1;return!0}function Cme(r,e){return isNaN(r)||isNaN(e)}function Rme(r){for(var e=r.length/2;e>0&&Cme(r[e*2-2],r[e*2-1]);e--);return e-1}function wX(r,e){return[r[e*2],r[e*2+1]]}function Lme(r,e,t){for(var i=r.length/2,n=t==="x"?0:1,a,o,s=0,l=-1,u=0;u=e||a>=e&&o<=e){l=u;break}s=u,a=o}return{range:[s,l],t:(e-a)/(o-a)}}function TX(r){if(r.get(["endLabel","show"]))return!0;for(var e=0;e0&&t.get(["emphasis","lineStyle","width"])==="bolder"){var G=g.getState("emphasis").style;G.lineWidth=+g.style.lineWidth+1}it(g).seriesIndex=t.seriesIndex,sr(g,B,z,k);var Y=bX(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=bX(Q.get("smooth"))),m.setShape({smooth:Y,stackedOnSmooth:V,smoothMonotone:J,connectNulls:T}),Yr(m,t,"areaStyle"),it(m).seriesIndex=t.seriesIndex,sr(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=h,this._step=E,this._valueOrigin=x,t.get("triggerLineEvent")&&(this.packEventData(t,g),m&&this.packEventData(t,m))},e.prototype.packEventData=function(t,i){it(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=Us(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],h=l[s*2+1];if(isNaN(c)||isNaN(h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,h))return;var f=t.get("zlevel")||0,p=t.get("z")||0;u=new Mc(o,s),u.x=c,u.y=h,u.setZ(f,p);var d=u.getSymbolPath().getTextContent();d&&(d.zlevel=f,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 Zt.prototype.highlight.call(this,t,i,n,a)},e.prototype.downplay=function(t,i,n,a){var o=t.getData(),s=Us(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 Zt.prototype.downplay.call(this,t,i,n,a)},e.prototype._changePolyState=function(t){var i=this._polygon;kp(this._polyline,t),i&&kp(i,t)},e.prototype._newPolyline=function(t){var i=this._polyline;return i&&this._lineGroup.remove(i),i=new _X({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 kT({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 h=u.get("animationDelay")||0,f=He(h)?h(null):h;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(h)?h(d):c*w+f,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(TX(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 It({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=Rme(l);c>=0&&(Fr(s,Rr(t,"endLabel"),{inheritColor:n,labelFetcher:t,labelDataIndex:c,defaultText:function(h,f,p){return p!=null?zT(o,p):Fl(o,h)},enableTextSetter:!0},Dme(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 h=n.getLayout("points"),f=n.hostModel,p=f.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=Lme(h,x,w),C=T.range,b=C[1]-C[0],E=void 0;if(b>=1){if(b>1&&!p){var I=wX(h,C[0]);u.attr({x:I[0]+M,y:I[1]+S}),o&&(E=f.getRawValue(C[0]))}else{var I=c.getPointOn(x,w);I&&u.attr({x:I[0]+M,y:I[1]+S});var R=f.getRawValue(C[0]),A=f.getRawValue(C[1]);o&&(E=Pw(n,d,R,A,T.t))}a.lastFrameIndex=C[0]}else{var P=t===1||a.lastFrameIndex>0?C[0]:0,I=wX(h,P);o&&(E=f.getRawValue(P)),u.attr({x:I[0]+M,y:I[1]+S})}if(o){var U=dc(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,h=t.hostModel,f=VI(this._data,t,this._stackedOnPoints,i,this._coordSys,n,this._valueOrigin,s),p=f.current,d=f.stackedOnCurrent,g=f.next,m=f.stackedOnNext;if(o&&(p=jh(f.current,n,o,l),d=jh(f.stackedOnCurrent,n,o,l),g=jh(f.next,n,o,l),m=jh(f.stackedOnNext,n,o,l)),MX(p,g)>3e3||c&&MX(d,m)>3e3){u.stopAnimation(),u.setShape({points:g}),c&&(c.stopAnimation(),c.setShape({points:g,stackedOnPoints:m}));return}u.shape.__points=f.current,u.shape.points=p;var v={shape:{points:g}};f.current!==p&&(v.shape.__points=f.next),u.stopAnimation(),Ut(u,v,h),c&&(c.setShape({points:p,stackedOnPoints:d}),c.stopAnimation(),Ut(c,{shape:{stackedOnPoints:m}},h),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],y=f.status,x=0;xe&&(e=r[t]);return isFinite(e)?e:NaN},min:function(r){for(var e=1/0,t=0;te&&(e=a,t=n)}return isFinite(t)?t:NaN},nearest:function(r){return r[0]}},Nme=function(r){return Math.round(r.length/2)};function rS(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(),h=i.getDevicePixelRatio(),f=Math.abs(c[1]-c[0])*(h||1),p=Math.round(s/f);if(isFinite(p)&&p>1){a==="lttb"&&e.setData(n.lttbDownSample(n.mapDimension(u.dim),1/p));var d=void 0;Ce(a)?d=Ime[a]:He(a)&&(d=a),d&&e.setData(n.downSample(n.mapDimension(u.dim),1/p,d,Nme))}}}}}function YI(r){r.registerChartView(EX),r.registerSeriesModel(mX),r.registerLayout(Bl("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,rS("line"))}var AX=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 mn(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(f,p){if(f.type==="category"&&i!=null){var d=f.getTicksCoords(),g=f.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]=f.toGlobalCoord(f.getExtent()[v?1:0]);return}for(var _=void 0,y=void 0,x=1,M=0;Mm){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]=f.toGlobalCoord(y)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),h=a.getBaseAxis().isHorizontal()?0:1;s[h]+=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}($t);$t.registerClass(AX);var Uv=AX;var Ume=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 mn(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=Qn(Uv.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}(Uv),CX=Ume;var Ome=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}(),zme=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 Ome},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,h=i.endAngle,f=i.clockwise,p=Math.PI*2,d=f?h-cMath.PI/2&&cs)return!0;s=h}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){cc(a,t,it(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}(Zt),DX={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=qI(e.x,r.x),s=ZI(e.x+e.width,n),l=qI(e.y,r.y),u=ZI(e.y+e.height,a),c=sn?s:o,e.y=h&&l>a?u:l,e.width=c?0:s-o,e.height=h?0:u-l,t<0&&(e.x+=e.width,e.width=-e.width),i<0&&(e.y+=e.height,e.height=-e.height),c||h},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=ZI(e.r,r.r),a=qI(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}},PX={cartesian2d:function(r,e,t,i,n,a,o,s,l){var u=new Rt({shape:he({},i),z2:1});if(u.__dataIndex=t,u.name="item",a){var c=u.shape,h=n?"height":"width";c[h]=0}return u},polar:function(r,e,t,i,n,a,o,s,l){var u=!n&&l?Ov:Mi,c=new u({shape:i,z2:1});c.name="item";var h=kX(n);if(c.calculateTextPosition=RX(h,{isRoundCap:u===Ov}),a){var f=c.shape,p=n?"r":"endAngle",d={};f[p]=n?i.r0:i.startAngle,d[p]=i[p],(s?Ut:lr)(c,{shape:d},a)}return c}};function kme(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 IX(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?Ut:lr)(t,{shape:l},e,n,null);var c=e?r.baseAxis.model:null;(o?Ut:lr)(t,{shape:u},c,n)}function NX(r,e){for(var t=0;t0?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 Hme(r){return r.startAngle!=null&&r.endAngle!=null&&r.startAngle===r.endAngle}function kX(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 OX(r,e,t,i,n,a,o,s){var l=e.getItemVisual(t,"style");if(s){if(!a.get("roundCap")){var c=r.shape,h=Lu(i.getModel("itemStyle"),c,!0);he(c,h),r.setShape(c)}}else{var u=i.get(["itemStyle","borderRadius"])||0;r.setShape("r",u)}r.useStyle(l);var f=i.getShallow("cursor");f&&r.attr("cursor",f);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=Rr(i);Fr(r,d,{labelFetcher:a,labelDataIndex:t,defaultText:Fl(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,LX(r,m==="outside"?p:m,kX(o),i.get(["label","rotate"]))}a1(g,d,a.getRawValue(t),function(_){return zT(e,_)});var v=i.getModel(["emphasis"]);sr(r,v.get("focus"),v.get("blurScope"),v.get("disabled")),Yr(r,i),Hme(n)&&(r.style.fill="none",r.style.stroke="none",N(r.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function Wme(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 Xme=function(){function r(){}return r}(),zX=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 Xme},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=0?t:null},30,!1);function Yme(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,h=a.length/3;c=s[0]&&e<=s[0]+l[0]&&t>=s[1]&&t<=s[1]+l[1])return o[c]}return-1}function VX(r,e,t){if(Ys(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 qme(r,e,t){var i=r.type==="polar"?Mi:Rt;return new i({shape:VX(e,t,r),silent:!0,z2:0})}var GX=Bme;function jI(r){r.registerChartView(GX),r.registerSeriesModel(CX),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ut(cT,"bar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,hT("bar")),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,rS("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 HX=Math.PI*2,WT=Math.PI/180;function WX(r,e){return br(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function KI(r,e){var t=WX(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,h,f=r.coordinateSystem;if(f){var p=f.dataToPoint(i);c=p[0]||0,h=p[1]||0}else pe(i)||(i=[i,i]),c=ze(i[0],a)+t.x,h=ze(i[1],o)+t.y;return{cx:c,cy:h,r0:l,r:u}}function JI(r,e,t){e.eachSeriesByType(r,function(i){var n=i.getData(),a=n.mapDimension("value"),o=WX(i,t),s=KI(i,t),l=s.cx,u=s.cy,c=s.r,h=s.r0,f=-i.get("startAngle")*WT,p=i.get("endAngle"),d=i.get("padAngle")*WT;p=p==="auto"?f-HX:-p*WT;var g=i.get("minAngle")*WT,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=[f,p],b=T*d/2;q_(C,!x),f=C[0],p=C[1];var E=Math.abs(p-f),I=E,R=0,A=f;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:h,r:M?NaN:c});return}M!=="area"?z=_===0&&S?y:U*y:z=E/v,zz?(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:h,r:M?ar(U,w,[h,c]):c}),A=k}),It?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)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-h)/2}}}function $I(r){return r.position==="center"}function QI(r){var e=r.getData(),t=[],i,n,a=!1,o=(r.get("minShowLabelAngle")||0)*Zme,s=e.getLayout("viewRect"),l=e.getLayout("r"),u=s.width,c=s.x,h=s.y,f=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"),P=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)0?"right":"left":J>0?"left":"right"}var xe=Math.PI,Le=0,Ue=I.get("rotate");if(Dt(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 dt=Q>0;dt&&(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 zt(J,Q),linePoints:ae,textAlign:ve,labelDistance:A,labelAlignTo:P,edgeDistance:U,bleedMargin:B,rect:F,unconstrainedWidth:F.width,labelStyleWidth:C.style.width})}w.setTextConfig({inside:ue})}}),!a&&r.get("avoidLabelOverlap")&&jme(t,i,n,l,u,f,c,h);for(var g=0;g0){for(var c=o.getItemLayout(0),h=1;isNaN(c&&c.startAngle)&&h=a.r0}},e.type="pie",e}(Zt),qX=Jme;function us(r,e,t){e=pe(e)&&{coordDimensions:e}||he({encodeDefine:r.getEncode()},e);var i=r.getSource(),n=Nl(i,e).dimensions,a=new oi(n,r);return a.initData(i,t),a}var $me=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}(),Du=$me;var Qme=xt(),eve=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 Du(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 us(this,{coordDimensions:["value"],encodeDefaulter:ut(_v,this)})},e.prototype.getDataParams=function(t){var i=this.getData(),n=Qme(i),a=n.seats;if(!a){var o=[];i.each(i.mapDimension("value"),function(l){o.push(l)}),a=n.seats=V2(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){rs(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}($t),ZX=eve;function eN(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!(Dt(o)&&!isNaN(o)&&o<0)})}}}function tN(r){r.registerChartView(qX),r.registerSeriesModel(ZX),X1("pie",r.registerAction),r.registerLayout(ut(JI,"pie")),r.registerProcessor(kl("pie")),r.registerProcessor(eN("pie"))}var tve=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 mn(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}($t),jX=tve;var KX=4,rve=function(){function r(){}return r}(),ive=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 rve},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]=0;u--){var c=u*2,h=a[c]-s/2,f=a[c+1]-l/2;if(t>=h&&i>=f&&t<=h+s&&i<=f+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,h=-1/0,f=0;f=0&&(u.dataIndex=h+(e.startIndex||0))})},r.prototype.remove=function(){this._clear()},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),JX=nve;var ave=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=Bl("").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 JX:new Cu,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}(Zt),$X=ave;var ove=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}(Nt),QX=ove;var XT=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Ir).models[0]},e.type="cartesian2dAxis",e}(Nt);Cr(XT,wu);var e9={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)"]}}},sve=bt({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},e9),rN=bt({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}}},e9),lve=bt({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},rN),uve=Ye({logBase:10},rN),YT={category:sve,value:rN,time:lve,log:uve};var t9={value:1,category:1,time:1,log:1};function Vl(r,e,t,i){N(t9,function(n,a){var o=bt(bt({},YT[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,h){var f=Nh(this),p=f?ks(c):{},d=h.getTheme();bt(c,d.get(a+"Axis")),bt(c,this.getDefaultOption()),c.type=r9(c),f&&Eo(c,p,f)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=Gx.createByAxisModel(this))},u.prototype.getCategories=function(c){var h=this.option;if(h.type==="category")return c?h.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",r9)}function r9(r){return r.type||(r.data?"category":"value")}var cve=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(),Yt(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}(),i9=cve;var qT=["x","y"];function n9(r){return r.type==="interval"||r.type==="time"}var hve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=qT,t}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,i=this.getAxis("y").scale;if(!(!n9(t)||!n9(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,h=(s[1]-o[1])/u,f=o[0]-n[0]*c,p=o[1]-a[0]*h,d=this._transform=[c,0,0,h,f,p];this._invTransform=Ls([],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 ft(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 mi(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 mi(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 ft(a,o,s,l)},e}(i9),a9=hve;var fve=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}(vn),o9=fve;function iS(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(),h=[c.x,c.x+c.width,c.y,c.y+c.height],f={left:0,right:1,top:0,bottom:1,onZero:2},p=e.get("offset")||0,d=u==="x"?[h[2]-p,h[3]+p]:[h[0]-p,h[1]+p];if(o){var g=o.toGlobalCoord(o.dataToCoord(0));d[f.onZero]=Math.max(Math.min(g,d[1]),d[0])}a.position=[u==="y"?d[f[l]]:h[0],u==="x"?d[f[l]]:h[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[f[s]]-d[f.onZero]:0,e.get(["axisTick","inside"])&&(a.tickDirection=-a.tickDirection),Hr(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 iN(r){return r.get("coordinateSystem")==="cartesian2d"}function nN(r){var e={xAxisModel:null,yAxisModel:null};return N(e,function(t,i){var n=i.replace(/Model$/,""),a=r.getReferringComponents(n,Ir).models[0];e[i]=a}),e}var aN=Math.log;function ZT(r,e,t){var i=Do.prototype,n=i.getTicks.call(t),a=i.getTicks.call(t,!0),o=n.length-1,s=i.getInterval.call(t),l=oI(r,e),u=l.extent,c=l.fixMin,h=l.fixMax;if(r.type==="log"){var f=aN(r.base);u=[aN(u[0])/f,aN(u[1])/f]}r.setExtent(u[0],u[1]),r.calcNiceExtent({splitNumber:o,fixMin:c,fixMax:h});var p=i.getExtent.call(r);c&&(u[0]=p[0]),h&&(u[1]=p[1]);var d=i.getInterval.call(r),g=u[0],m=u[1];if(c&&h)d=(m-g)/o;else if(c)for(m=u[0]+d*o;mu[0]&&isFinite(g)&&isFinite(u[0]);)d=lT(d),g=u[1]-d*o;else{var v=r.getTicks().length-1;v>o&&(d=lT(d));var _=d*o;m=Math.ceil(u[1]/d)*d,g=Pr(m-_),g<0&&u[0]>=0?(g=0,m=Pr(_)):m>0&&u[1]<=0&&(m=0,g=-Pr(_))}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 pve=function(){function r(e,t,i){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=qT,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=At(o),u=l.length;if(u){for(var c=[],h=u-1;h>=0;h--){var f=+l[h],p=o[f],d=p.model,g=p.scale;Hx(g)&&d.get("alignTicks")&&d.get("interval")==null?c.push(p):(bu(g,d),Hx(g)&&(s=p))}c.length&&(s||(s=c.pop(),bu(s.scale,s.model)),N(c,function(m){ZT(m.scale,m.model,s.scale)}))}}n(i.x),n(i.y);var a={};N(i.x,function(o){l9(i,"y",o,a)}),N(i.y,function(o){l9(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=br(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=x8(u);if(c){var h=u.isHorizontal()?"height":"width",f=u.model.get(["axisLabel","margin"]);o[h]-=c[h]+f,u.position==="top"?o.y+=c.height+f:u.position==="left"&&(o.x+=c.width+f)}}}),l()),N(this._coordsList,function(u){u.calcAffineTransform()});function l(){N(s,function(u){var c=u.isHorizontal(),h=c?[0,o.width]:[0,o.height],f=u.inverse?1:0;u.setExtent(h[f],h[1-f]),dve(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;n0?"top":"bottom",a="center"):ic(n-Kh)?(o=i>0?"bottom":"top",a="center"):(o="middle",n>0&&n0?"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}(),h9={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&&(mi(s,s,o),mi(l,l,o));var c=he({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),h=new ei({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:r.strokeContainThreshold||5,silent:!0,z2:1});hc(h.shape,h.style.lineWidth),h.anid="line",t.add(h);var f=e.get(["axisLine","symbol"]);if(f!=null){var p=e.get(["axisLine","symbolSize"]);Ce(f)&&(f=[f,f]),(Ce(p)||Dt(p))&&(p=[p,p]);var d=ss(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(f[_]!=="none"&&f[_]!=null){var y=wr(f[_],-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=gve(t,i,e,r),a=_ve(t,i,e,r);if(vve(e,a,n),yve(t,i,e,r.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=wT(de(a,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));ET(o)}},axisName:function(r,e,t,i){var n=Hr(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,h=[a==="start"?u[0]-c*l:a==="end"?u[1]+c*l:(u[0]+u[1])/2,p9(a)?r.labelOffset+o*l:0],f,p=e.get("nameRotate");p!=null&&(p=p*Kh/180);var d;p9(a)?f=cd.innerTextLayout(r.rotation,p??r.rotation,o):(f=mve(r.rotation,a,p||0,u),d=r.axisNameAvailableWidth,d!=null&&(d=Math.abs(d/Math.sin(f.rotation)),!isFinite(d)&&(d=null)));var g=s.getFont(),m=e.get("nameTruncate",!0)||{},v=m.ellipsis,_=Hr(r.nameTruncateMaxWidth,m.maxWidth,d),y=new It({x:h[0],y:h[1],rotation:f.rotation,silent:cd.isLabelSilent(e),style:pr(s,{text:n,font:g,overflow:"truncate",width:_,ellipsis:v,fill:s.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:s.get("align")||f.textAlign,verticalAlign:s.get("verticalAlign")||f.textVerticalAlign}),z2:1});if(El({el:y,componentModel:e,itemName:n}),y.__fullText=n,y.anid="name",e.get("triggerEvent")){var x=cd.makeAxisEventDataBase(e);x.targetType="axisName",x.name=n,it(y).eventData=x}i.add(y),y.updateTransform(),t.add(y),y.decomposeTransform()}}};function mve(r,e,t,i){var n=k_(t-r),a,o,s=i[0]>i[1],l=e==="start"&&!s||e!=="start"&&s;return ic(n-Kh/2)?(o=l?"bottom":"top",a="center"):ic(n-Kh*1.5)?(o=l?"top":"bottom",a="center"):(o="middle",nKh/2?a=l?"left":"right":a=l?"right":"left"),{rotation:n,textAlign:a,textVerticalAlign:o}}function vve(r,e,t){if(!_T(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],h=t[t.length-1],f=t[t.length-2];i===!1?(qs(a),qs(u)):f9(a,o)&&(i?(qs(o),qs(c)):(qs(a),qs(u))),n===!1?(qs(s),qs(h)):f9(l,s)&&(n?(qs(l),qs(f)):(qs(s),qs(h)))}}function qs(r){r&&(r.ignore=!0)}function f9(r,e){var t=r&&r.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(!(!t||!i)){var n=vh([]);return vo(n,n,-r.rotation),t.applyTransform(mo([],n,r.getLocalTransform())),i.applyTransform(mo([],n,e.getLocalTransform())),t.intersect(i)}}function p9(r){return r==="middle"||r==="center"}function d9(r,e,t,i,n){for(var a=[],o=[],s=[],l=0;l=0||r===e}function v9(r){var e=jT(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=lN(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]),o0&&!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=bt(Qe(d),{boundaryGap:t,splitNumber:i,scale:n,axisLine:a,axisTick:o,axisLabel:s,name:d.text,showName:u,nameLocation:"end",nameGap:h,nameTextStyle:g,triggerEvent:f},!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 Jt(m,null,this.ecModel);return Cr(_,wu.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:bt({lineStyle:{color:"#bbb"}},nS.axisLine),axisLabel:QT(nS.axisLabel,!1),axisTick:QT(nS.axisTick,!1),splitLine:QT(nS.splitLine,!0),splitArea:QT(nS.splitArea,!0),indicator:[]},e}(Nt),E9=Dve;var Pve=["axisLine","axisTickLabel","axisName"],Ive=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 Un(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(Pve,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"),h=s.get("show"),f=l.get("color"),p=u.get("color"),d=pe(f)?f:[f],g=pe(p)?p:[p],m=[],v=[];function _(P,U,B){var z=B%U.length;return P[z]=P[z]||[],z}if(a==="circle")for(var y=n[0].getTicksCoords(),x=i.cx,M=i.cy,S=0;S3?1.4:o>1?1.2:1.1,c=a>0?u:1/u;yN(this,"zoom","zoomOnMouseWheel",t,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(n){var h=Math.abs(a),f=(a>0?1:-1)*(h>3?.4:h>1?.15:.05);yN(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:f,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){if(!vN(this._zr,"globalPan")){var i=t.pinchScale>1?1.1:1/1.1;yN(this,"zoom",null,t,{scale:i,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})}},e}(Ni);function yN(r,e,t,i,n){r.pointerChecker&&r.pointerChecker(i,n.originX,n.originY)&&(po(i.event),U9(r,e,t,i,n))}function U9(r,e,t,i,n){n.isAvailableBehavior=Be(eE,null,t,i),r.trigger(e,n)}function eE(r,e,t){var i=t[r];return!r||i&&(!Ce(i)||e.event[i+"Key"])}var Pu=Ove;function Fv(r,e,t){var i=r.target;i.x+=e,i.y+=t,i.dirty()}function Bv(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 zve={axisPointer:1,tooltip:1,brush:1};function Jh(r,e,t){var i=e.getComponentByElement(r.topTarget),n=i&&i.coordinateSystem;return i&&i!==t&&!zve.hasOwnProperty(i.mainType)&&n&&n.model!==t}function tE(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 xN,rE={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"},O9=At(rE),iE={"alignment-baseline":"textBaseline","stop-color":"stopColor"},z9=At(iE),Fve=function(){function r(){this._defs={},this._root=null}return r.prototype.parse=function(e,t){t=t||{};var i=tE(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),cs(i,n,null,!0,!1);for(var u=i.firstChild;u;)this._parseNode(u,n,a,null,!1,!1),u=u.nextSibling;Vve(this._defs,this._defsUsePending),this._defsUsePending=[];var c,h;if(o){var f=nE(o);f.length>=4&&(c={x:parseFloat(f[0]||0),y:parseFloat(f[1]||0),width:parseFloat(f[2]),height:parseFloat(f[3])})}if(c&&s!=null&&l!=null&&(h=MN(c,{x:0,y:0,width:s,height:l}),!t.ignoreViewBox)){var p=n;n=new Ze,n.add(p),p.scaleX=p.scaleY=h.scale,p.x=h.x,p.y=h.y}return!t.ignoreRootClip&&s!=null&&l!=null&&n.setClipPath(new Rt({shape:{x:0,y:0,width:s,height:l}})),{root:n,width:s,height:l,viewBoxRect:c,viewBoxTransform:h,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=xN[s];if(c&&tt(xN,s)){l=c.call(this,e,t);var h=e.getAttribute("name");if(h){var f={name:h,namedFrom:null,svgNodeTagLower:s,el:l};i.push(f),s==="g"&&(u=f)}else n&&i.push({name:n.name,namedFrom:n,svgNodeTagLower:s,el:l});t.add(l)}}var p=F9[s];if(p&&tt(F9,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 ac({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});Zs(t,i),cs(e,i,this._defsUsePending,!1,!1),Bve(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(){xN={g:function(e,t){var i=new Ze;return Zs(t,i),cs(e,i,this._defsUsePending,!1,!1),i},rect:function(e,t){var i=new Rt;return Zs(t,i),cs(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 ga;return Zs(t,i),cs(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 ei;return Zs(t,i),cs(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 tx;return Zs(t,i),cs(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=V9(i));var a=new ai({shape:{points:n||[]},silent:!0});return Zs(t,a),cs(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var i=e.getAttribute("points"),n;i&&(n=V9(i));var a=new ri({shape:{points:n||[]},silent:!0});return Zs(t,a),cs(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var i=new Br;return Zs(t,i),cs(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 Zs(t,s),cs(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 Zs(t,s),cs(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=jw(i);return Zs(t,n),cs(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}}(),r}(),F9={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 xu(e,t,i,n);return B9(r,a),k9(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 Qw(e,t,i);return B9(r,n),k9(r,n),n}};function B9(r,e){var t=r.getAttribute("gradientUnits");t==="userSpaceOnUse"&&(e.global=!0)}function k9(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={};W9(t,a,a);var o=a.stopColor||t.getAttribute("stop-color")||"#000000";e.colorStops.push({offset:n,color:o})}t=t.nextSibling}}function Zs(r,e){r&&r.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),Ye(e.__inheritedStyle,r.__inheritedStyle))}function V9(r){for(var e=nE(r),t=[],i=0;i0;a-=2){var o=i[a],s=i[a-1],l=nE(o);switch(n=n||Ci(),s){case"translate":En(n,n,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Fm(n,n,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":vo(n,n,-parseFloat(l[0])*SN,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*SN);mo(n,[1,0,u,1,0,0],n);break;case"skewY":var c=Math.tan(parseFloat(l[0])*SN);mo(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 H9=/([^\s:;]+)\s*:\s*([^:;]+)/g;function W9(r,e,t){var i=r.getAttribute("style");if(i){H9.lastIndex=0;for(var n;(n=H9.exec(i))!=null;){var a=n[1],o=tt(rE,a)?rE[a]:null;o&&(e[o]=n[2]);var s=tt(iE,a)?iE[a]:null;s&&(t[s]=n[2])}}}function Xve(r,e,t){for(var i=0;i0,m={api:i,geo:l,mapOrGeoModel:e,data:s,isVisualEncodedByVisualMap:g,isGeo:o,transformInfoRaw:f};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 h(p){for(var d=[],g=!u&&l&&l.project,m=0;m=0)&&(f=n);var p=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Fr(e,Rr(i),{labelFetcher:f,labelDataIndex:h,defaultText:t},p);var d=e.getTextContent();if(d&&(r7(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 $9(r,e,t,i,n,a){r.data?r.data.setItemGraphicEl(a,e):it(e).eventData={componentType:"geo",componentIndex:n.componentIndex,geoIndex:n.componentIndex,name:t,region:i&&i.option||{}}}function Q9(r,e,t,i,n){r.data||El({el:e,componentModel:n,itemName:t,itemTooltipOption:i.get("tooltip")})}function e7(r,e,t,i,n){e.highDownSilentOnTouch=!!n.get("selectedMode");var a=i.getModel("emphasis"),o=a.get("focus");return sr(e,o,a.get("blurScope"),a.get("disabled")),r.isGeo&&C4(e,n,t),o}function t7(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-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}($t),n7=age;function oge(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;c1?(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=br(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 uge(r,e){N(e.get("geoCoord"),function(t,i){r.addGeoCoord(i,t)})}var cge=function(){function r(){this.dimensions=LN}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 DN(l+s,l,he({nameMap:o.get("nameMap")},n(o)));u.zoomLimit=o.get("scaleLimit"),i.push(u),o.coordinateSystem=u,u.model=o,u.resize=u7,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 DN(s,s,he({nameMap:Dm(l)},n(o[0])));u.zoomLimit=Hr.apply(null,de(o,function(c){return c.get("scaleLimit")})),i.push(u),u.resize=u7,u.resize(o[0],t),N(o,function(c){c.coordinateSystem=u,uge(u,c)})}),i},r.prototype.getFilledRegions=function(e,t,i,n){for(var a=(e||[]).slice(),o=ke(),s=0;s=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 d7(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){mge(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=vge(r,n,r.parentNode.hierNode.defaultAncestor||i[0],e)}function m7(r){var e=r.hierNode.prelim+r.parentNode.hierNode.modifier;r.setLayout({x:e},!0),r.hierNode.modifier+=r.parentNode.hierNode.modifier}function UN(r){return arguments.length?r:_ge}function pd(r,e){return r-=Math.PI/2,{x:e*Math.cos(r),y:e*Math.sin(r)}}function v7(r,e){return br(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function mge(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 vge(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,h=s.hierNode.modifier;s=IN(s),a=NN(a),s&&a;){n=IN(n),o=NN(o),n.hierNode.ancestor=r;var f=s.hierNode.prelim+h-a.hierNode.prelim-u+i(s,a);f>0&&(yge(gge(s,r,t),r,f),u+=f,l+=f),h+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=n.hierNode.modifier,c+=o.hierNode.modifier}s&&!IN(n)&&(n.hierNode.thread=s,n.hierNode.modifier+=h-l),a&&!NN(o)&&(o.hierNode.thread=a,o.hierNode.modifier+=u-c,t=r)}return t}function IN(r){var e=r.children;return e.length&&r.isExpand?e[e.length-1]:r.hierNode.thread}function NN(r){var e=r.children;return e.length&&r.isExpand?e[0]:r.hierNode.thread}function gge(r,e,t){return r.hierNode.ancestor.parentNode===e.parentNode?r.hierNode.ancestor:t}function yge(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 _ge(r,e){return r.parentNode===e.parentNode?1:2}var xge=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 xge},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,h=1-c,f=ze(i.forkPosition,1),p=[];p[c]=o[c],p[h]=o[h]+(l[h]-o[h])*f,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_.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"?hp(o.getAncestorsIndices(),o.getDescendantIndices()):I==="ancestor"?o.getAncestorsIndices():I==="descendant"?o.getDescendantIndices():null;R&&(it(t).focus=R),bge(n,o,c,t,d,p,g,i),t.__edge&&(t.onHoverStateChange=function(A){if(A!=="blur"){var P=o.parentNode&&r.getItemGraphicEl(o.parentNode.dataIndex);P&&P.hoverState===Bp||kp(t.__edge,A)}})}function bge(r,e,t,i,n,a,o,s){var l=e.getModel(),u=r.get("edgeShape"),c=r.get("layout"),h=r.getOrient(),f=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 Hp({shape:ON(c,h,f,n,n)})),Ut(g,{shape:ON(c,h,f,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;_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=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=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 FN(r){for(var e=[];r;)r=r.parentNode,r&&e.push(r);return e.reverse()}function Gv(r,e){var t=FN(r);return yt(t,e)>=0}function Qh(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 Nge=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 Jt(n,this,this.ecModel),o=Vv.createTree(i,this,s);function s(h){h.wrapMethod("getItemModel",function(f,p){var d=o.getNodeByDataIndex(p);return d&&d.children.length&&d.isExpand||(f.parentModel=a),f})}var l=0;o.eachNode("preorder",function(h){h.depth>l&&(l=h.depth)});var u=t.expandAndCollapse,c=u&&t.initialTreeDepth>=0?t.initialTreeDepth:l;return o.root.eachNode("preorder",function(h){var f=h.hostTree.data.getRawDataItem(h.dataIndex);h.isExpand=f&&f.collapsed!=null?!f.collapsed:h.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 kr("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=Qh(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}($t),w7=Nge;function T7(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=0;a--)t.push(n[a])}}function kN(r,e){r.eachSeriesByType("tree",function(t){Uge(t,e)})}function Uge(r,e){var t=v7(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=UN(function(y,x){return(y.parentNode===x.parentNode?1:2)/y.depth})):(n=t.width,a=t.height,o=UN());var s=r.getData().tree.root,l=s.children[0];if(l){p7(s),T7(l,d7,o),s.hierNode.modifier=-l.hierNode.prelim,Hv(l,m7);var u=l,c=l,h=l;Hv(l,function(y){var x=y.getLayout().x;xc.getLayout().x&&(c=y),y.depth>h.depth&&(h=y)});var f=u===c?1:o(u,c)/2,p=f-u.getLayout().x,d=0,g=0,m=0,v=0;if(i==="radial")d=n/(c.getLayout().x+f+p),g=a/(h.depth-1||1),Hv(l,function(y){m=(y.getLayout().x+p)*d,v=(y.depth-1)*g;var x=pd(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+f+p),d=n/(h.depth-1||1),Hv(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+f+p),g=a/(h.depth-1||1),Hv(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 VN(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");he(s,o)})})}function E7(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=kv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}function GN(r){r.registerChartView(M7),r.registerSeriesModel(w7),r.registerLayout(kN),r.registerVisual(VN),E7(r)}var A7=["treemapZoomToNode","treemapRender","treemapMove"];function C7(r){for(var e=0;e1;)a=a.parentNode;var o=vx(r.ecModel,a.name||a.dataIndex+"",i);n.setVisual("decal",o)})}var Oge=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};R7(n);var a=t.levels||[],o=this.designatedVisualItemStyle={},s=new Jt({itemStyle:o},this,i);a=t.levels=zge(a,i);var l=de(a||[],function(h){return new Jt(h,s,i)},this),u=Vv.createTree(n,this,c);function c(h){h.wrapMethod("getItemModel",function(f,p){var d=u.getNodeByDataIndex(p),g=d?l[d.depth]:null;return f.parentModel=g||s,f})}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 kr("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=Qh(n,this),i.treePathInfo=i.treeAncestors,i},e.prototype.setLayoutInfo=function(t){this.layoutInfo=this.layoutInfo||{},he(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(){sS(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}($t);function R7(r){var e=0;N(r.children,function(i){R7(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 zge(r,e){var t=tr(e.get("color")),i=tr(e.get(["aria","decal","decals"]));if(t){r=r||[];var n,a;N(r,function(s){var l=new Jt(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 L7=Oge;var Fge=8,D7=8,HN=5,Bge=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"]),h={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,h,u),this._renderContent(e,h,s,l,u,c,n),Ih(o,h.pos,h.box)}},r.prototype._prepare=function(e,t,i){for(var n=e;n;n=n.parentNode){var a=Kr(n.getModel().get("name"),""),o=i.getTextRect(a),s=Math.max(o.width+Fge*2,t.emptyItemWidth);t.totalWidth+=s+D7,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"]),h=P5(t.pos,t.box),f=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;f>h.width&&(f-=_-u,_=u,y=null);var x=new ai({shape:{points:kge(l,0,_,c,g===p.length-1,g===0)},style:Ye(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new It({style:pr(a,{text:y})}),textConfig:{position:"inside"},z2:oc*1e4,onclick:ut(s,v)});x.disableLabelAnimation=!0,x.getTextContent().ensureState("emphasis").style=pr(o,{text:y}),x.ensureState("emphasis").style=d,sr(x,n.get("focus"),n.get("blurScope"),n.get("disabled")),this.group.add(x),Vge(x,e,v),l+=_+D7}},r.prototype.remove=function(){this.group.removeAll()},r}();function kge(r,e,t,i,n,a){var o=[[n?r:r-HN,e],[r+t,e],[r+t,e+i],[n?r:r-HN,e+i]];return!a&&o.splice(2,0,[r+t+HN,e+i/2]),!n&&o.push([r,e+i/2]),o}function Vge(r,e,t){it(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&&Qh(t,e)}}var P7=Bge;var Gge=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;nU7||Math.abs(t.dy)>U7)){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 ft(o.x,o.y,o.width,o.height),l=this.seriesModel.layoutInfo;i-=l.x,n-=l.y;var u=Ci();En(u,u,[-i,-n]),Fm(u,u,[t.scale,t.scale]),En(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&&Jp(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 P7(this.group))).render(t,i,n.node,function(o){a._state!=="animating"&&(Gv(t.getViewRoot(),o)?a._rootToNode({node:o}):a._zoomToNode({node:o}))})},e.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=lS(),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}(Zt);function lS(){return{nodeGroup:[],background:[],content:[]}}function Zge(r,e,t,i,n,a,o,s,l,u){if(!o)return;var c=o.getLayout(),h=r.getData(),f=o.getModel();if(h.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=f.getModel("itemStyle"),w=f.getModel(["emphasis","itemStyle"]),T=f.getModel(["blur","itemStyle"]),C=f.getModel(["select","itemStyle"]),b=S.get("borderRadius")||0,E=V("nodeGroup",WN);if(!E)return;if(l.add(E),E.x=c.x||0,E.y=c.y||0,E.markRedraw(),uE(E).nodeWidth=p,uE(E).nodeHeight=d,c.isAboveViewRoot)return E;var I=V("background",N7,u,Xge);I&&k(E,I,M&&c.upperLabelHeight);var R=f.getModel("emphasis"),A=R.get("focus"),P=R.get("blurScope"),U=R.get("disabled"),B=A==="ancestor"?o.getAncestorsIndices():A==="descendant"?o.getDescendantIndices():A;if(M)Ph(E)&&lc(E,!1),I&&(lc(I,!U),h.setItemGraphicEl(o.dataIndex,I),Ww(I,B,P));else{var z=V("content",N7,u,Yge);z&&G(E,z),I.disableMorphing=!0,I&&Ph(I)&&lc(I,!1),lc(E,!U),h.setItemGraphicEl(o.dataIndex,E),Ww(E,B,P)}return E;function k(ve,ue,se){var Ee=it(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=F7(S);We.fill=H;var _e=dd(w);_e.fill=w.get("borderColor");var xe=dd(T);xe.fill=T.get("borderColor");var Le=dd(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,Ml(ue)}ve.add(ue)}function G(ve,ue){var se=it(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=F7(S);_e.fill=We,_e.decal=H.decal;var xe=dd(w),Le=dd(T),Ue=dd(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,Ml(ue)}ve.add(ue)}function Y(ve){!ve.invisible&&a.push(ve)}function J(ve,ue,se,Ee){var q=f.getModel(Ee?z7:O7),H=Kr(f.get("name"),null),We=q.getShallow("show");Fr(ve,Rr(f,Ee?z7:O7),{defaultText:We?H:null,inheritColor:ue,defaultOpacity:se,labelFetcher:r,labelDataIndex:o.dataIndex});var _e=ve.getTextContent();if(_e){var xe=_e.style,Le=Pm(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 Si&&(q.z2=jge(se,Ee)),ae(H,q)),e[ve][v]=q}function K(ve,ue){var se=ve[v]={};ue instanceof WN?(se.oldX=ue.x,se.oldY=ue.y):se.oldShape=he({},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 jge(r,e){return r*Wge+e}var B7=qge;var hS=N,Kge=qe,fE=-1,ZN=function(){function r(e){var t=e.mappingMethod,i=e.type,n=this.option=Qe(e);this.type=i,this.mappingMethod=t,this._normalizeData=Qge[t];var a=r.visualHandlers[i];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[t],t==="piecewise"?(XN(n),Jge(n)):t==="category"?n.categories?$ge(n):XN(n,!0):(Wr(t!=="linear"||n.dataExtent),XN(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 At(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&&hS(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(Kge(e)){var t=[];hS(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=0;a--)i[a]==null&&(delete t[e[a]],e.pop())}function XN(r,e){var t=r.visual,i=[];qe(t)?hS(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]),V7(r,i)}function cE(r){return{applyVisual:function(e,t,i){var n=this.mapValueToVisual(e);i("color",r(t("color"),n))},_normalizedToVisual:YN([0,1])}}function k7(r){var e=this.option.visual;return e[Math.round(ar(r,[0,1],[0,e.length-1],!0))]||{}}function uS(r){return function(e,t,i){i(r,this.mapValueToVisual(e))}}function cS(r){var e=this.option.visual;return e[this.option.loop&&r!==fE?r%e.length:r]}function md(){return this.option.visual[0]}function YN(r){return{linear:function(e){return ar(e,r,this.option.visual,!0)},category:cS,piecewise:function(e,t){var i=qN.call(this,t);return i==null&&(i=ar(e,r,this.option.visual,!0)),i},fixed:md}}function qN(r){var e=this.option,t=e.pieceList;if(e.hasSpecialVisual){var i=ZN.findPieceIndex(r,t),n=t[i];if(n&&n.visual)return n.visual[this.type]}}function V7(r,e){return r.visual=e,r.type==="color"&&(r.parsedVisual=de(e,function(t){var i=pn(t);return i||[0,0,0,1]})),e}var Qge={linear:function(r){return ar(r,this.option.dataExtent,[0,1],!0)},piecewise:function(r){var e=this.option.pieceList,t=ZN.findPieceIndex(r,e,!0);if(t!=null)return ar(t,[0,e.length-1],[0,1],!0)},category:function(r){var e=this.option.categories?this.option.categoryMap[r]:r;return e??fE},fixed:zr};function hE(r,e,t){return r?e<=t:e=t.length||g===t[g.depth]){var v=nye(n,l,g,m,d,i);X7(g,v,t,i)}})}}}function tye(r,e,t){var i=he({},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 G7(r){var e=jN(r,"color");if(e){var t=jN(r,"colorAlpha"),i=jN(r,"colorSaturation");return i&&(e=xp(e,null,null,i)),t&&(e=Sp(e,t)),e}}function rye(r,e){return e!=null?xp(e,null,null,r):null}function jN(r,e){var t=r[e];if(t!=null&&t!=="none")return t}function iye(r,e,t,i,n,a){if(!(!a||!a.length)){var o=KN(e,"color")||n.color!=null&&n.color!=="none"&&(KN(e,"colorAlpha")||KN(e,"colorSaturation"));if(o){var s=e.get("visualMin"),l=e.get("visualMax"),u=t.dataExtent.slice();s!=null&&su[1]&&(u[1]=l);var c=e.get("colorMappingBy"),h={type:o.name,dataExtent:u,visual:o.range};h.type==="color"&&(c==="index"||c==="id")?(h.mappingMethod="category",h.loop=!0):h.mappingMethod="linear";var f=new gi(h);return H7(f).drColorMappingBy=c,f}}}function KN(r,e){var t=r.get(e);return pe(t)&&t.length?{name:e,range:t}:null}function nye(r,e,t,i,n,a){var o=he({},e);if(n){var s=n.type,l=s==="color"&&H7(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 fS=Math.max,pE=Math.min,Y7=Hr,JN=N,Z7=["itemStyle","borderWidth"],aye=["itemStyle","gapWidth"],oye=["upperLabel","show"],sye=["upperLabel","height"],j7={seriesType:"treemap",reset:function(r,e,t,i){var n=t.getWidth(),a=t.getHeight(),o=r.option,s=br(r.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),l=o.size||[],u=ze(Y7(s.width,l[0]),n),c=ze(Y7(s.height,l[1]),a),h=i&&i.type,f=["treemapZoomToNode","treemapRootToNode"],p=wc(i,f,r),d=h==="treemapRender"||h==="treemapMove"?i.rootRect:null,g=r.getViewRoot(),m=FN(g);if(h!=="treemapMove"){var v=h==="treemapZoomToNode"?pye(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),K7(g,y,!1,0),x=g.getLayout(),JN(m,function(S,w){var T=(m[w+1]||g).getValue();S.setLayout(he({dataExtent:[T,T],borderWidth:0,upperHeight:0},x))})}var M=r.getData().tree.root;M.setLayout(dye(s,d,p),!0),r.setLayoutInfo(s),J7(M,new ft(-s.x,-s.y,n,a),m,g,0)}};function K7(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(aye)/2,c=$7(s),h=Math.max(l,c),f=l-u,p=h-u;r.setLayout({borderWidth:l,upperHeight:h,upperLabelHeight:c},!0),n=fS(n-2*f,0),a=fS(a-f-p,0);var d=n*a,g=lye(r,s,d,e,t,i);if(g.length){var m={x:f,y:p,width:n,height:a},v=pE(n,a),_=1/0,y=[];y.area=0;for(var x=0,M=g.length;x=0;l--){var u=n[i==="asc"?o-l-1:l].getValue();u/t*es[1]&&(s[1]=u)})),{sum:i,dataExtent:s}}function fye(r,e,t){for(var i=0,n=1/0,a=0,o=void 0,s=r.length;ai&&(i=o));var l=r.area*r.area,u=e*e*t;return l?fS(u*i/l,l/(u*n)):1/0}function q7(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 h=0,f=r.length;hB_&&(u=B_),a=s}ui&&(i=e);var a=i%2?i+2:i+3;n=[];for(var o=0;o0&&(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]);h[0].8?"left":f[0]<-.8?"right":"center",g=f[1]>.8?"top":f[1]<-.8?"bottom":"middle";break;case"start":a.x=-f[0]*v+c[0],a.y=-f[1]*_+c[1],d=f[0]>.8?"right":f[0]<-.8?"left":"center",g=f[1]>.8?"bottom":f[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+h[0],a.y=h[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),qv=Sye;var Mye=function(){function r(e){this.group=new Ze,this._LineCtor=e||qv}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=hY(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=hY(e),this._lineData=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t){this._progressiveEls=[];function i(s){!s.isGroup&&!bye(s)&&(s.incremental=!0,s.ensureState("emphasis").hoverLayer=!0)}for(var n=e.start;n0}function hY(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:Rr(e)}}function fY(r){return isNaN(r[0])||isNaN(r[1])}function dU(r){return r&&!fY(r[0])&&!fY(r[1])}var Zv=Mye;var mU=[],vU=[],gU=[],jv=xi,yU=ec,pY=Math.abs;function dY(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){mU[0]=jv(i[0],n[0],a[0],c),mU[1]=jv(i[1],n[1],a[1],c);var h=pY(yU(mU,e)-l);h=0?s=s+u:s=s-u:d>=0?s=s-u:s=s+u}return s}function mS(r,e){var t=[],i=xh,n=[[],[],[]],a=[[],[]],o=[];e/=2,r.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[ho(u[0]),ho(u[1])],u[2]&&u.__original.push(ho(u[2])));var f=u.__original;if(u[2]!=null){if(ji(n[0],f[0]),ji(n[1],f[2]),ji(n[2],f[1]),c&&c!=="none"){var p=gd(s.node1),d=dY(n,f[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(h&&h!=="none"){var p=gd(s.node2),d=dY(n,f[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]}ji(u[0],n[0]),ji(u[1],n[2]),ji(u[2],n[1])}else{if(ji(a[0],f[0]),ji(a[1],f[1]),yl(o,a[1],a[0]),Cs(o,o),c&&c!=="none"){var p=gd(s.node1);__(a[0],a[0],o,p*e)}if(h&&h!=="none"){var p=gd(s.node2);__(a[1],a[1],o,-p*e)}ji(u[0],a[0]),ji(u[1],a[1])}})}function mY(r){return r.type==="view"}var wye=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 Cu,a=new Zv,o=this.group;this._controller=new Pu(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(mY(o)){var c={x:o.x,y:o.y,scaleX:o.scaleX,scaleY:o.scaleY};this._firstRender?u.attr(c):Ut(u,c,t)}mS(t.getGraph(),vd(t));var h=t.getData();s.updateData(h);var f=t.getEdgeData();l.updateData(f),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");h.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),h.setItemLayout(x,[M.x,M.y]);break;case"circular":h.setItemLayout(x,[M.x,M.y]),y.setLayout({fixed:!0},!0),Xv(t,"symbolSize",y,[C.offsetX,C.offsetY]),a.updateLayout(t);break;case"none":default:h.setItemLayout(x,[M.x,M.y]),dS(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"&&(it(M).focus=y.getAdjacentDataIndices())}}),h.graph.eachEdge(function(y){var x=y.getGraphicEl(),M=y.getModel().get(["emphasis","focus"]);x&&M==="adjacency"&&(it(x).focus={edge:[y.dataIndex],node:[y.node1.dataIndex,y.node2.dataIndex]})});var m=t.get("layout")==="circular"&&t.get(["circular","rotateLabel"]),v=h.getLayout("cx"),_=h.getLayout("cy");h.graph.eachNode(function(y){oU(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,h){var f=l.getBoundingRect();return f.applyTransform(l.transform),f.contain(c,h)&&!Jh(u,n,t)}),!mY(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){Fv(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){Bv(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(),mS(t.getGraph(),vd(t)),a._lineDraw.updateLayout(),n.updateLabelLayout()})},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,i=t.getData(),n=vd(t);i.eachItemGraphicEl(function(a,o){a&&a.setSymbolScale(n)})},e.prototype.updateLayout=function(t){mS(t.getGraph(),vd(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}(Zt),vY=wye;function Kv(r){return"_EC_"+r}var Tye=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[Kv(e)]){var n=new yd(e,t);return n.hostGraph=this,this.nodes.push(n),i[Kv(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[Kv(e)]},r.prototype.addEdge=function(e,t,i){var n=this._nodesMap,a=this._edgesMap;if(Dt(e)&&(e=this.nodes[e]),Dt(t)&&(t=this.nodes[t]),e instanceof yd||(e=n[Kv(e)]),t instanceof yd||(t=n[Kv(t)]),!(!e||!t)){var o=e.id+"-"+t.id,s=new gY(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 yd&&(e=e.id),t instanceof yd&&(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=0&&e.call(t,i[a],a)},r.prototype.eachEdge=function(e,t){for(var i=this.edges,n=i.length,a=0;a=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 yd||(t=this._nodesMap[Kv(t)]),!!t){for(var a=i==="out"?"outEdges":i==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var a=0,o=n.length;a=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)}}}Cr(yd,yY("hostGraph","data"));Cr(gY,yY("hostGraph","edgeData"));var _Y=Tye;function vS(r,e,t,i,n){for(var a=new _Y(i),o=0;o "+f)),u++)}var p=t.get("coordinateSystem"),d;if(p==="cartesian2d"||p==="polar")d=mn(r,t);else{var g=gc.get(p),m=g?g.dimensions||[]:[];yt(m,"value")<0&&m.concat(["value"]);var v=Nl(r,{coordDimensions:m,encodeDefine:t.getEncode()}).dimensions;d=new oi(v,t),d.initData(r)}var _=new oi(["value"],t);return _.initData(l,s),n&&n(d,_),lE({mainData:d,struct:a,structAttr:"graph",datas:{node:d,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a}var Eye=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 Du(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),rs(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){tY(this);var s=vS(a,n,this,!0,l);return N(s.edges,function(u){rY(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 h=Jt.prototype.getModel;function f(d,g){var m=h.call(this,d,g);return m.resolveParentPath=p,m}c.wrapMethod("getItemModel",function(d){return d.resolveParentPath=p,d.getModel=f,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),kr("nameValue",{name:c.join(" > "),value:o.value,noValue:o.value==null})}var h=z1({series:this,dataIndex:t,multipleSeries:i});return h},e.prototype._updateCategoriesData=function(){var t=de(this.option.categories||[],function(n){return n.value!=null?n:he({value:0},n)}),i=new oi(["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}($t),xY=Eye;var Aye={type:"graphRoam",event:"graphRoam",update:"none"};function _U(r){r.registerChartView(vY),r.registerSeriesModel(xY),r.registerProcessor(QN),r.registerVisual(eU),r.registerVisual(tU),r.registerLayout(nU),r.registerLayout(r.PRIORITY.VISUAL.POST_CHART_LAYOUT,sU),r.registerLayout(lU),r.registerCoordinateSystem("graphView",{dimensions:bc.dimensions,create:uU}),r.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},zr),r.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},zr),r.registerAction(Aye,function(e,t,i){t.eachComponent({mainType:"series",query:e},function(n){var a=n.coordinateSystem,o=kv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}var Cye=function(){function r(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return r}(),Rye=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 Cye},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}(pt),SY=Rye;function Lye(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 gE(r,e){var t=r==null?"":r+"";return e&&(Ce(e)?t=e.replace("{value}",t):He(e)&&(t=e(r))),t}var Dye=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=Lye(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,h=t.getModel("axisLine"),f=h.get("roundCap"),p=f?Ov:Mi,d=h.get("show"),g=h.getModel("lineStyle"),m=g.get("width"),v=[u,c];q_(v,!l),u=v[0],c=v[1];for(var _=c-u,y=u,x=[],M=0;d&&M=C&&(b===0?0:a[b-1][0])Math.PI/2&&(V+=Math.PI)):Q==="tangential"?V=-T-Math.PI/2:Dt(Q)&&(V=Q*Math.PI/180),V===0?h.add(new It({style:pr(y,{text:k,x:Y,y:J,verticalAlign:P<-.8?"top":P>.8?"bottom":"middle",align:A<-.4?"left":A>.4?"right":"center"},{inheritColor:G}),silent:!0})):h.add(new It({style:pr(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),P=Math.sin(T);var ae=new ei({shape:{x1:A*(d-B)+f,y1:P*(d-B)+p,x2:A*(d-w-B)+f,y2:P*(d-w-B)+p},silent:!0,style:I});I.stroke==="auto"&&ae.setStyle({stroke:a((U+K/M)/x)}),h.add(ae),T+=b}T-=b}else T+=C}},e.prototype._renderPointer=function(t,i,n,a,o,s,l,u,c){var h=this.group,f=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),P=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=wr(U,z-A/2,k-P,A,P,null,G):Y=new SY({shape:{angle:-Math.PI/2,width:A,r:P,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?Ov:Mi,A=m.get("overlap"),P=A?m.get("width"):c/_.count(),U=A?o.r-P:o.r-(b+1)*P,B=A?o.r:o.r-b*P,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(f).add(function(b){var E=_.get(y,b);if(g){var I=T(b,s);lr(I,{rotation:-((isNaN(+E)?w[0]:ar(E,S,w,!0))+Math.PI/2)},t),h.add(I),_.setItemGraphicEl(b,I)}if(v){var R=C(b,s),A=m.get("clip");lr(R,{shape:{endAngle:ar(E,S,w,A)}},t),h.add(R),j_(t.seriesIndex,_.dataType,b,R),d[b]=R}}).update(function(b,E){var I=_.get(y,b);if(g){var R=f.getItemGraphicEl(E),A=R?R.rotation:s,P=T(b,A);P.rotation=A,Ut(P,{rotation:-((isNaN(+I)?w[0]:ar(I,S,w,!0))+Math.PI/2)},t),h.add(P),_.setItemGraphicEl(b,P)}if(v){var U=p[E],B=U?U.shape.endAngle:s,z=C(b,B),k=m.get("clip");Ut(z,{shape:{endAngle:ar(I,S,w,k)}},t),h.add(z),j_(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"),P=I.get("disabled");if(g){var U=_.getItemGraphicEl(b),B=_.getItemVisual(b,"style"),z=B.fill;if(U instanceof Br){var k=U.style;U.useStyle(he({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(ar(_.get(y,b),S,[0,1],!0))),U.z2EmphasisLift=0,Yr(U,E),sr(U,R,A,P)}if(v){var G=d[b];G.useStyle(_.getItemVisual(b,"style")),G.setStyle(E.getModel(["progress","itemStyle"]).getItemStyle()),G.z2EmphasisLift=0,Yr(G,E),sr(G,R,A,P)}}),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=wr(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"),h=+t.get("max"),f=new Ze,p=[],d=[],g=t.isAnimationEnabled(),m=t.get(["pointer","showAbove"]);l.diff(this._data).add(function(v){p[v]=new It({silent:!0}),d[v]=new It({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(ar(y,[c,h],[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:pr(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),P=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:pr(E,{x:R,y:A,text:gE(y,z),width:isNaN(P)?null:P,height:isNaN(U)?null:U,align:"center",verticalAlign:"middle"},{inheritColor:B})}),a1(b,{normal:E},y,function(G){return gE(G,z)}),g&&o1(b,v,l,t,{getFormattedLabel:function(G,Y,J,Q,V,K){return gE(K?K.interpolatedValue:y,z)}}),x.add(b)}f.add(x)}),this.group.add(f),this._titleEls=p,this._detailEls=d},e.type="gauge",e}(Zt),MY=Dye;var Pye=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 us(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}($t),bY=Pye;function xU(r){r.registerChartView(MY),r.registerSeriesModel(bY)}var Iye=["itemStyle","opacity"],Nye=function(r){Z(e,r);function e(t,i){var n=r.call(this)||this,a=n,o=new ri,s=new It;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(Iye);c=c??1,n||Ui(a),a.useStyle(t.getItemVisual(i,"style")),a.style.lineJoin="round",n?(a.setShape({points:l.points}),a.style.opacity=0,lr(a,{style:{opacity:c}},o,i)):Ut(a,{style:{opacity:c},shape:{points:l.points}},o,i),Yr(a,s),this._updateLabel(t,i),sr(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,h=t.getItemVisual(i,"style"),f=h.fill;Fr(o,Rr(l),{labelFetcher:t.hostModel,labelDataIndex:i,defaultOpacity:h.opacity,defaultText:t.getName(i)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}}),n.setTextConfig({local:!0,inside:!!c.inside,insideStroke:f,outsideFill:f});var p=c.linePoints;a.setShape({points:p}),n.textGuideLineConfig={anchor:p?new zt(p[0][0],p[0][1]):null},Ut(o,{style:{x:c.x,y:c.y}},s,i),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),Pv(n,Iv(l),{stroke:f})},e}(ai),Uye=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 Nye(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);cc(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}(Zt),wY=Uye;var Oye=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 Du(Be(this.getData,this),Be(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.getInitialData=function(t,i){return us(this,{coordDimensions:["value"],encodeDefaulter:ut(_v,this)})},e.prototype._defaultLabelLine=function(t){rs(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}($t),TY=Oye;function zye(r,e){return br(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function Fye(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();oJye)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||!TU(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 TU(r,e){var t=r._model;return t.get("axisExpandable")&&t.get("axisExpandTriggerOn")===e}var PY=$ye;var e0e=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&&bt(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=Yt(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}(Nt),IY=e0e;var t0e=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}(vn),NY=t0e;function Io(r,e,t,i,n,a){r=r||0;var o=t[1]-t[0];if(n!=null&&(n=Jv(n,[0,o])),a!=null&&(a=Math.max(a,n??0)),i==="all"){var s=Math.abs(e[1]-e[0]);s=Jv(s,[0,o]),n=a=Jv(s,[n,a]),i=0}e[0]=Jv(e[0],t),e[1]=Jv(e[1],t);var l=EU(e,i);e[i]+=r;var u=n||0,c=t.slice();l.sign<0?c[0]+=u:c[1]-=u,e[i]=Jv(e[i],c);var h;return h=EU(e,i),n!=null&&(h.sign!==l.sign||h.spana&&(e[1-i]=e[i]+h.sign*a),e}function EU(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 Jv(r,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,r))}var AU=N,zY=Math.min,FY=Math.max,UY=Math.floor,r0e=Math.ceil,OY=Pr,i0e=Math.PI,n0e=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;AU(n,function(o,s){var l=a[s],u=t.getComponent("parallelAxis",l),c=this._axesMap.set(o,new NY(o,Xh(u),[0,0],u.get("type"),l)),h=c.type==="category";c.onBand=h&&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();AU(this.dimensions,function(a){var o=this._axesMap.get(a);o.scale.unionExtentFromData(n,n.mapDimension(a)),bu(o.scale,o.model)},this)}},this)},r.prototype.resize=function(e,t){this._rect=br(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=yE(e.get("axisExpandWidth"),l),h=yE(e.get("axisExpandCount")||0,[0,u]),f=e.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,p=e.get("axisExpandWindow"),d;if(p)d=yE(p[1]-p[0],l),p[1]=p[0]+d;else{d=yE(c*(h-1),l);var g=e.get("axisExpandCenter")||UY(u/2);p=[c*g-d/2],p[1]=p[0]+d}var m=(s-d)/(u-h);m<3&&(m=0);var v=[UY(OY(p[0]/c,1))+1,r0e(OY(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:f,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])}),AU(i,function(o,s){var l=(n.axisExpandable?o0e:a0e)(s,n),u={horizontal:{x:l.position,y:n.axisLength},vertical:{x:0,y:l.position}},c={horizontal:i0e/2,vertical:0},h=[u[a].x+e.x,u[a].y+e.y],f=c[a],p=Ci();vo(p,p,f),En(p,p,h),this._axesLayout[o]={position:h,rotation:f,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;ca*(1-h[0])?(u="jump",l=s-a*(1-h[2])):(l=s-a*h[1])>=0&&(l=s-a*(1-h[1]))<=0&&(l=0),l*=t.axisExpandWidth/c,l?Io(l,n,o,"all"):u="none";else{var p=n[1]-n[0],d=o[1]*s/p;n=[FY(0,d-p/2)],n[1]=zY(o[1],n[0]+p),n[0]=n[1]-p}return{axisExpandWindow:n,behavior:u}},r}();function yE(r,e){return zY(FY(r,e[0]),e[1])}function a0e(r,e){var t=e.layoutLength/(e.axisCount-1);return{position:t*r,axisNameAvailableWidth:t,axisLabelShow:!0}}function o0e(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=0;n--)Ri(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;ah0e}function QY(r){var e=r.length-1;return e<0&&(e=0),[r[0],r[e]]}function eq(r,e,t,i){var n=new Ze;return n.add(new Rt({name:"main",style:zU(t),silent:!0,draggable:!0,cursor:"move",drift:ut(WY,r,e,n,["n","s","w","e"]),ondragend:ut(xd,e,{isEnd:!0})})),N(i,function(a){n.add(new Rt({name:a.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:ut(WY,r,e,n,a),ondragend:ut(xd,e,{isEnd:!0})}))}),n}function tq(r,e,t,i){var n=i.brushStyle.lineWidth||0,a=$v(n,f0e),o=t[0][0],s=t[1][0],l=o-n/2,u=s-n/2,c=t[0][1],h=t[1][1],f=c-a+n/2,p=h-a+n/2,d=c-o,g=h-s,m=d+n,v=g+n;Tc(r,e,"main",o,s,d,g),i.transformable&&(Tc(r,e,"w",l,u,a,v),Tc(r,e,"e",f,u,a,v),Tc(r,e,"n",l,u,m,a),Tc(r,e,"s",l,p,m,a),Tc(r,e,"nw",l,u,a,a),Tc(r,e,"ne",f,u,a,a),Tc(r,e,"sw",l,p,a,a),Tc(r,e,"se",f,p,a,a))}function LU(r,e){var t=e.__brushOption,i=t.transformable,n=e.childAt(0);n.useStyle(zU(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?DU(r,a[0]):_0e(r,a);o&&o.attr({silent:!i,invisible:!i,cursor:i?d0e[s]+"-resize":null})})}function Tc(r,e,t,i,n,a,o){var s=e.childOfName(t);s&&s.setShape(S0e(FU(r,e,[[i,n],[i+a,n+o]])))}function zU(r){return Ye({strokeNoScale:!0},r.brushStyle)}function rq(r,e,t,i){var n=[gS(r,t),gS(e,i)],a=[$v(r,t),$v(e,i)];return[[n[0],a[0]],[n[1],a[1]]]}function y0e(r){return Tl(r.group)}function DU(r,e){var t={w:"left",e:"right",n:"top",s:"bottom"},i={left:"w",right:"e",top:"n",bottom:"s"},n=Yp(t[e],y0e(r));return i[n]}function _0e(r,e){var t=[DU(r,e[0]),DU(r,e[1])];return(t[0]==="e"||t[0]==="w")&&t.reverse(),t.join("")}function WY(r,e,t,i,n,a){var o=t.__brushOption,s=r.toRectRange(o.range),l=iq(e,n,a);N(i,function(u){var c=p0e[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=r.fromRectRange(rq(s[0][0],s[1][0],s[0][1],s[1][1])),NU(e,t),xd(e,{isEnd:!1})}function x0e(r,e,t,i){var n=e.__brushOption.range,a=iq(r,t,i);N(n,function(o){o[0]+=a[0],o[1]+=a[1]}),NU(r,e),xd(r,{isEnd:!1})}function iq(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 FU(r,e,t){var i=$Y(r,e);return i&&i!==_d?i.clipPath(t,r._transform):Qe(t)}function S0e(r){var e=gS(r[0][0],r[1][0]),t=gS(r[0][1],r[1][1]),i=$v(r[0][0],r[1][0]),n=$v(r[0][1],r[1][1]);return{x:e,y:t,width:i-e,height:n-t}}function M0e(r,e,t){if(!(!r._brushType||w0e(r,e.offsetX,e.offsetY))){var i=r._zr,n=r._covers,a=OU(r,e,t);if(!r._dragging)for(var o=0;oi.getWidth()||t<0||t>i.getHeight()}var _E={lineX:qY(0),lineY:qY(1),rect:{createCover:function(r,e){function t(i){return i}return eq({toRectRange:t,fromRectRange:t},r,e,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(r){var e=QY(r);return rq(e[1][0],e[1][1],e[0][0],e[0][1])},updateCoverShape:function(r,e,t,i){tq(r,e,t,i)},updateCommon:LU,contain:IU},polygon:{createCover:function(r,e){var t=new Ze;return t.add(new ri({name:"main",style:zU(e),silent:!0})),t},getCreatingRange:function(r){return r},endCreating:function(r,e){e.remove(e.childAt(0)),e.add(new ai({name:"main",draggable:!0,drift:ut(x0e,r,e),ondragend:ut(xd,r,{isEnd:!0})}))},updateCoverShape:function(r,e,t,i){e.childAt(0).setShape({points:FU(r,e,t)})},updateCommon:LU,contain:IU}};function qY(r){return{createCover:function(e,t){return eq({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=QY(e),i=gS(t[0][r],t[1][r]),n=$v(t[0][r],t[1][r]);return[i,n]},updateCoverShape:function(e,t,i,n){var a,o=$Y(e,t);if(o!==_d&&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(),tq(e,t,l,n)},updateCommon:LU,contain:IU}}var Qv=v0e;function xE(r){return r=BU(r),function(e){return CD(e,r)}}function SE(r,e){return r=BU(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 ME(r,e,t){var i=BU(r);return function(n,a){return i.contain(a[0],a[1])&&!Jh(n,e,t)}}function BU(r){return ft.create(r)}var T0e=["axisLine","axisTickLabel","axisName"],E0e=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 Qv(i.getZr())).on("brush",Be(this._onBrush,this))},e.prototype.render=function(t,i,n,a){if(!A0e(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=R0e(t,i),l=s.coordinateSystem,u=t.getAreaSelectStyle(),c=u.width,h=t.axis.dim,f=l.getAxisLayout(h),p=he({strokeContainThreshold:c},f),d=new Un(t,p);N(T0e,d.add,d),this._axisGroup.add(d.getGroup()),this._refreshBrushController(p,u,t,s,c,n),fc(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),h=ft.create({x:l[0],y:-o/2,width:u,height:o});h.x-=c,h.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:t.rotation,x:t.position[0],y:t.position[1]}).setPanels([{panelId:"pl",clipPath:xE(h),isTargetByCursor:ME(h,s,a),getLinearBrushOtherExtent:SE(h,0)}]).enableBrush({brushType:"lineX",brushStyle:i,removeOnClick:!0}).updateCovers(C0e(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}(ir);function A0e(r,e,t){return t&&t.type==="axisAreaSelect"&&e.findComponents({mainType:"parallelAxis",query:t})[0]===r}function C0e(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 R0e(r,e){return e.getComponent("parallel",r.get("parallelIndex"))}var oq=E0e;var L0e={type:"axisAreaSelect",event:"axisAreaSelected"};function sq(r){r.registerAction(L0e,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 D0e={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function yS(r){r.registerComponentView(PY),r.registerComponentModel(IY),r.registerCoordinateSystem("parallel",kY),r.registerPreprocessor(wU),r.registerComponentModel(CU),r.registerComponentView(oq),Vl(r,"parallel",CU,D0e),sq(r)}function kU(r){Ot(yS),r.registerChartView(RY),r.registerSeriesModel(LY),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,DY)}var P0e=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}(),I0e=function(r){Z(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new P0e},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(){jn(this)},e.prototype.downplay=function(){Kn(this)},e}(pt),N0e=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,h=t.getData(),f=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 I0e,m=it(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,P,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,P=(b!=null?b*u:T.x)+I.ty,U=E!=null?E*c:T.y,B=R,z=A*(1-y)+U*y,k=P,G=A*y+U*(1-y)):(R=(S!=null?S*u:x.x)+x.dx,A=(w!=null?w*c:x.y)+I.sy,P=b!=null?b*u:T.x,U=(E!=null?E*c:T.y)+I.ty,B=R*(1-y)+P*y,z=A,k=R*y+P*(1-y),G=U),g.setShape({x1:R,y1:A,x2:P,y2:U,cpx1:B,cpy1:z,cpx2:k,cpy2:G}),g.useStyle(_.getItemStyle()),lq(g.style,p,d);var Y=""+v.get("value"),J=Rr(v,"edgeLabel");Fr(g,J,{labelFetcher:{getFormattedLabel:function(K,ae,ve,ue,se,Ee){return t.getFormattedLabel(K,ae,"edge",ue,qi(se,J.normal&&J.normal.get("formatter"),Y),Ee)}},labelDataIndex:d.dataIndex,defaultText:Y}),g.setTextConfig({position:"inside"});var Q=v.getModel("emphasis");Yr(g,v,"lineStyle",function(K){var ae=K.getItemStyle();return lq(ae,p,d),ae}),s.add(g),f.setItemGraphicEl(d.dataIndex,g);var V=Q.get("focus");sr(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 Rt({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});Fr(x,Rr(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),Yr(x,m),s.add(x),h.setItemGraphicEl(d.dataIndex,x),it(x).dataType="node";var M=y.get("focus");sr(x,M==="adjacency"?d.getAdjacentDataIndices():M==="trajectory"?d.getTrajectoryDataIndices():M,y.get("blurScope"),y.get("disabled"))}),h.eachItemGraphicEl(function(d,g){var m=h.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:h.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(U0e(s.getBoundingRect(),t,function(){s.removeClipPath()})),this._data=t.getData()},e.prototype.dispose=function(){},e.type="sankey",e}(Zt);function lq(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 xu(0,0,+(e==="horizontal"),+(e==="vertical"),[{color:i,offset:0},{color:n,offset:1}]))}}function U0e(r,e,t){var i=new Rt({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return lr(i,{shape:{width:r.width+20}},e,t),i}var uq=N0e;var O0e=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=0&&(s[o[l].depth]=new Jt(o[l],this,i));if(a&&n){var u=vS(a,n,this,!0,c);return u.data}function c(h,f){h.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}),f.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 kr("nameValue",{name:u,value:l,noValue:a(l)})}else{var c=this.getGraph().getNodeByIndex(t),h=c.getLayout().value,f=this.getDataParams(t,n).data.name;return kr("nameValue",{name:f!=null?f+"":null,value:h,noValue:a(h)})}},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}($t),cq=O0e;function GU(r,e){r.eachSeriesByType("sankey",function(t){var i=t.get("nodeWidth"),n=t.get("nodeGap"),a=z0e(t,e);t.layoutInfo=a;var o=a.width,s=a.height,l=t.getGraph(),u=l.nodes,c=l.edges;B0e(u);var h=Yt(u,function(g){return g.getLayout().value===0}),f=h.length!==0?0:t.get("layoutIterations"),p=t.get("orient"),d=t.get("nodeAlign");F0e(u,c,i,n,o,s,f,p,d)})}function z0e(r,e){return br(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function F0e(r,e,t,i,n,a,o,s,l){k0e(r,e,t,n,a,s,l),W0e(r,e,a,n,i,o,s),Q0e(r,s)}function B0e(r){N(r,function(e){var t=ef(e.outEdges,bE),i=ef(e.inEdges,bE),n=e.getValue()||0,a=Math.max(t,i,n);e.setLayout({value:a},!0)})}function k0e(r,e,t,i,n,a,o){for(var s=[],l=[],u=[],c=[],h=0,f=0;f=0;v&&m.depth>p&&(p=m.depth),g.setLayout({depth:v?m.depth:h},!0),a==="vertical"?g.setLayout({dy:t},!0):g.setLayout({dx:t},!0);for(var _=0;_h-1?p:h-1;o&&o!=="left"&&V0e(r,o,a,w);var T=a==="vertical"?(n-t)/w:(i-t)/w;H0e(r,T,a)}function hq(r){var e=r.hostGraph.data.getRawDataItem(r.dataIndex);return e.depth!=null&&e.depth>=0}function V0e(r,e,t,i){if(e==="right"){for(var n=[],a=r,o=0;a.length;){for(var s=0;s0;a--)l*=.99,q0e(s,l,o),VU(s,n,t,i,o),$0e(s,l,o),VU(s,n,t,i,o)}function X0e(r,e){var t=[],i=e==="vertical"?"y":"x",n=W_(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 Y0e(r,e,t,i,n,a){var o=1/0;N(r,function(s){var l=s.length,u=0;N(s,function(h){u+=h.getLayout().value});var c=a==="vertical"?(i-(l-1)*n)/u:(t-(l-1)*n)/u;c0&&(s=l.getLayout()[a]+u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]+l.getLayout()[f]+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=h-2;p>=0;--p)l=o[p],u=l.getLayout()[a]+l.getLayout()[f]+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 q0e(r,e,t){N(r.slice().reverse(),function(i){N(i,function(n){if(n.outEdges.length){var a=ef(n.outEdges,Z0e,t)/ef(n.outEdges,bE);if(isNaN(a)){var o=n.outEdges.length;a=o?ef(n.outEdges,j0e,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(a-tf(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(a-tf(n,t))*e;n.setLayout({y:l},!0)}}})})}function Z0e(r,e){return tf(r.node2,e)*r.getValue()}function j0e(r,e){return tf(r.node2,e)}function K0e(r,e){return tf(r.node1,e)*r.getValue()}function J0e(r,e){return tf(r.node1,e)}function tf(r,e){return e==="vertical"?r.getLayout().x+r.getLayout().dx/2:r.getLayout().y+r.getLayout().dy/2}function bE(r){return r.getValue()}function ef(r,e,t){for(var i=0,n=r.length,a=-1;++ao&&(o=l)}),N(i,function(s){var l=new gi({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 WU(r){r.registerChartView(uq),r.registerSeriesModel(cq),r.registerLayout(GU),r.registerVisual(HU),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 wE=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,h=this._baseAxisDim=u[c],f=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=he({},x),S.value=S.value.slice(),x.value.unshift(M)):S=x,v.push(S)}),e.data=v}var _=this.defaultValueDimensions,y=[{name:h,type:id(d),ordinalMeta:i,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:f,type:id(g),dimsDef:_.slice()}];return us(this,{coordDimensions:y,dimensionsCount:_.length+1,encodeDefaulter:ut(_1,y,this)})},r.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},r}();var fq=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}($t);Cr(fq,wE,!0);var pq=fq;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=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),h=dq(c,a,u,l,!0);a.setItemGraphicEl(u,h),o.add(h)}}).update(function(u,c){var h=s.getItemGraphicEl(c);if(!a.hasValue(u)){o.remove(h);return}var f=a.getItemLayout(u);h?(Ui(h),mq(f,h,a,u)):h=dq(f,a,u,l),o.add(h),a.setItemGraphicEl(u,h)}).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}(Zt),t_e=function(){function r(){}return r}(),r_e=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 t_e},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();ag){var x=[v,y];i.push(x)}}}return{boxData:t,outliers:i}}var gq={type:"echarts:boxplot",transform:function(e){var t=e.upstream;if(t.sourceFormat!==Li){var i="";hr(i)}var n=YU(t.getRawData(),e.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:n.boxData},{data:n.outliers}]}};function qU(r){r.registerSeriesModel(pq),r.registerChartView(vq),r.registerLayout(XU),r.registerTransform(gq)}var s_e=["color","borderColor"],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.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){ya(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 h=i.getItemLayout(c);if(s&&yq(u,h))return;var f=ZU(h,c,!0);lr(f,{shape:{points:h.ends}},t,c),jU(f,i,c,o),a.add(f),i.setItemGraphicEl(c,f)}}).update(function(c,h){var f=n.getItemGraphicEl(h);if(!i.hasValue(c)){a.remove(f);return}var p=i.getItemLayout(c);if(s&&yq(u,p)){a.remove(f);return}f?(Ut(f,{shape:{points:p.ends}},t,c),Ui(f)):f=ZU(p,c),jU(f,i,c,o),a.add(f),i.setItemGraphicEl(c,f)}).remove(function(c){var h=n.getItemGraphicEl(c);h&&a.remove(h)}).execute(),this._data=i},e.prototype._renderLarge=function(t){this._clear(),_q(t,this.group);var i=t.get("clip",!0)?Ru(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=ZU(s,o);jU(l,n,o,a),l.incremental=!0,this.group.add(l),this._progressiveEls.push(l)}},e.prototype._incrementalRenderLarge=function(t,i){_q(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}(Zt),u_e=function(){function r(){}return r}(),c_e=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 u_e},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}(pt);function ZU(r,e,t){var i=r.ends;return new c_e({shape:{points:t?h_e(i,r):i},z2:100})}function yq(r,e){for(var t=!0,i=0;i0?"borderColor":"borderColor0"])||t.get(["itemStyle",r>0?"color":"color0"]);r===0&&(n=t.get(["itemStyle","borderColorDoji"]));var a=t.getModel("itemStyle").getItemStyle(s_e);e.useStyle(a),e.style.fill=null,e.style.stroke=n}var xq=l_e;var Sq=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}($t);Cr(Sq,wE,!0);var Mq=Sq;function $U(r){!r||!pe(r.series)||N(r.series,function(e){qe(e)&&e.type==="k"&&(e.type="candlestick")})}var p_e=["itemStyle","borderColor"],d_e=["itemStyle","borderColor0"],m_e=["itemStyle","borderColorDoji"],v_e=["itemStyle","color"],g_e=["itemStyle","color0"],y_e={seriesType:"candlestick",plan:os(),performRawSeries:!0,reset:function(r,e){function t(a,o){return o.get(a>0?v_e:g_e)}function i(a,o){return o.get(a===0?m_e:a>0?p_e:d_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 h=o.ensureUniqueItemVisual(s,"style");he(h,c)}}}}}},bq=y_e;var __e={seriesType:"candlestick",plan:os(),reset:function(r){var e=r.coordinateSystem,t=r.getData(),i=x_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],h=l[2],f=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(h,v),w=_.get(f,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 P=m.getItemModel(v),U=!!P.get(["itemStyle","borderColorDoji"]);m.setItemLayout(v,{sign:wq(_,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]=ox(V[n]+i/2,1,!1),K[n]=ox(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]=ox(Y[n],1),Y}}function d(g,m){for(var v=Sa(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(h,S),R=w.get(f,S);if(isNaN(C)||isNaN(I)||isNaN(R)){v[_++]=NaN,_+=3;continue}v[_++]=wq(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 wq(r,e,t,i,n,a){var o;return t>i?o=-1:t0?r.get(n,e-1)<=i?1:-1:1,o}function x_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(mt(r.get("barMaxWidth"),n),n),o=ze(mt(r.get("barMinWidth"),1),n),s=r.get("barWidth");return s!=null?ze(s,n):Math.max(Math.min(n/2,a),o)}var Tq=__e;function QU(r){r.registerChartView(xq),r.registerSeriesModel(Mq),r.registerPreprocessor($U),r.registerVisual(bq),r.registerLayout(Tq)}function Eq(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 Mc(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;s0&&(s=this._getLineLength(a)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){a.stopAnimation();var f=void 0;He(h)?f=h(n):f=h,a.__t>0&&(f=-s*a.__t),this._animateSymbol(a,s,f,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 Rs(t.__p1,t.__cp1)+Rs(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=xi,c=A_;s[0]=u(i[0],a[0],n[0],o),s[1]=u(i[1],a[1],n[1],o);var h=t.__t<1?c(i[0],a[0],n[0],o):c(n[0],a[0],i[0],1-o),f=t.__t<1?c(i[1],a[1],n[1],o):c(n[1],a[1],i[1],1-o);t.rotation=-Math.atan2(f,h)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(t.__lastT!==void 0&&t.__lastT=0&&!(a[l]<=i);l--);l=Math.min(l,o-2)}else{for(l=s;li);l++);l=Math.min(l-1,o-2)}var c=(i-a[l])/(a[l+1]-a[l]),h=n[l],f=n[l+1];t.x=h[0]*(1-c)+c*f[0],t.y=h[1]*(1-c)+c*f[1];var p=t.__t<1?f[0]-h[0]:h[0]-f[0],d=t.__t<1?f[1]-h[1]:h[1]-f[1];t.rotation=-Math.atan2(d,p)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=i,t.ignore=!1}},e}(TE),Lq=E_e;var A_e=function(){function r(){this.polyline=!1,this.curveness=0,this.segs=[]}return r}(),C_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 A_e},e.prototype.buildPath=function(t,i){var n=i.segs,a=i.curveness,o;if(i.polyline)for(o=this._off;o0){t.moveTo(n[o++],n[o++]);for(var l=1;l0){var p=(u+h)/2-(c-f)*a,d=(c+f)/2-(h-u)*a;t.quadraticCurveTo(p,d,h,f)}else t.lineTo(h,f)}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;u0)for(var h=a[u++],f=a[u++],p=1;p0){var m=(h+d)/2-(f-g)*o,v=(f+g)/2-(d-h)*o;if(zw(h,f,m,v,d,g,s,t,i))return l}else if(gu(h,f,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;u0&&(o.dataIndex=l+e.__startIndex)})},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),Dq=R_e;var L_e={seriesType:"lines",plan:os(),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;c0&&(c||u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)})),o.updateData(a);var h=t.get("clip",!0)&&Ru(t.coordinateSystem,!1,t);h?this.group.setClipPath(h):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=AE.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 Dq:new Zv(o?a?Lq:EE:a?TE:qv),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}(Zt),Pq=D_e;var P_e=typeof Uint32Array>"u"?Array:Uint32Array,I_e=typeof Float64Array>"u"?Array:Float64Array;function Iq(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),Dm([n,t[0],t[1]])}))}var N_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||[],Iq(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(Iq(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=hp(this._flatCoords,i.flatCoords),this._flatCoordsOffset=hp(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;on}}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 oi(["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),kr("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}($t),Nq=N_e;function CE(r){return r instanceof Array||(r=[r,r]),r}var U_e={seriesType:"lines",reset:function(r){var e=CE(r.get("symbol")),t=CE(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=CE(s.getShallow("symbol",!0)),u=CE(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}}},Uq=U_e;function tO(r){r.registerChartView(Pq),r.registerSeriesModel(Nq),r.registerLayout(AE),r.registerVisual(Uq)}var O_e=256,z_e=function(){function r(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=Zn.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,h=this.canvas,f=h.getContext("2d"),p=e.length;h.width=t,h.height=i;for(var d=0;d0){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 f.putImageData(x,0,0),h},r.prototype._getBrush=function(){var e=this._brushCanvas||(this._brushCanvas=Zn.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}(),Oq=z_e;function F_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=0;s--){var l=e[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}return s>=0&&s=e[0]&&i<=e[1]}}function zq(r){var e=r.dimensions;return e[0]==="lng"&&e[1]==="lat"}var 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.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()):zq(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&&(zq(o)?this.render(i,n,a):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(i,a,t.start,t.end,!0)))},e.prototype.eachRendered=function(t){ya(this._progressiveEls||this.group,t)},e.prototype._renderOnCartesianAndCalendar=function(t,i,n,a,o){var s=t.coordinateSystem,l=Ys(s,"cartesian2d"),u,c,h,f;if(l){var p=s.getAxis("x"),d=s.getAxis("y");u=p.getBandWidth()+.5,c=d.getBandWidth()+.5,h=p.scale.getExtent(),f=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=Rr(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;Eh[1]||Pf[1])continue;var U=s.dataToPoint([A,P]);I=new Rt({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 Rt({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=Rr(B)}I.shape.r=x;var k=t.getRawValue(E),G="-";k&&k[2]!=null&&(G=k[2]+""),Fr(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,sr(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 Oq;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(),h=t.getRoamTransform();c.applyTransform(h);var f=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-f,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]-=f,b[1]-=p,b.push(C),b}),x=n.getExtent(),M=n.type==="visualMap.continuous"?B_e(x,n.option.range):F_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 Br({style:{width:m,height:v,x:f,y:p,image:u.canvas},silent:!0});this.group.add(S)},e.type="heatmap",e}(Zt),Fq=k_e;var V_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 mn(null,this,{generateCoord:"value"})},e.prototype.preventIncremental=function(){var t=gc.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}($t),Bq=V_e;function rO(r){r.registerChartView(Fq),r.registerSeriesModel(Bq)}var G_e=["itemStyle","borderWidth"],kq=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],iO=new ga,H_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(),h=l.master.getRect(),f={ecSize:{width:n.getWidth(),height:n.getHeight()},seriesModel:t,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:kq[+c],categoryDim:kq[1-+c]};o.diff(s).add(function(d){if(o.hasValue(d)){var g=Gq(o,d),m=Vq(o,d,g,f),v=Hq(o,f,m);o.setItemGraphicEl(d,v),a.add(v),Xq(v,f,m)}}).update(function(d,g){var m=s.getItemGraphicEl(g);if(!o.hasValue(d)){a.remove(m);return}var v=Gq(o,d),_=Vq(o,d,v,f),y=$q(o,_);m&&y!==m.__pictorialShapeStr&&(a.remove(m),o.setItemGraphicEl(d,null),m=null),m?K_e(m,f,_):m=Hq(o,f,_,!0),o.setItemGraphicEl(d,m),m.__pictorialSymbolMeta=_,a.add(m),Xq(m,f,_)}).remove(function(d){var g=s.getItemGraphicEl(d);g&&Wq(s,d,g.__pictorialSymbolMeta.animationModel,g)}).execute();var p=t.get("clip",!0)?Ru(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){Wq(a,it(o).dataIndex,t,o)}):n.removeAll()},e.type="pictorialBar",e}(Zt);function Vq(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,h=t.isAnimationEnabled(),f={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:h?t:null,hoverScale:h&&t.get(["emphasis","scale"]),z2:t.getShallow("z",!0)||0};W_e(t,a,n,i,f),X_e(r,e,n,a,o,f.boundingLength,f.pxSign,c,i,f),Y_e(t,f.symbolScale,u,i,f);var p=f.symbolSize,d=ss(t.get("symbolOffset"),p);return q_e(t,p,n,a,o,d,s,f.valueLineWidth,f.boundingLength,f.repeatCutLength,i,f),f}function W_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 h=[nO(s,o[0])-l,nO(s,o[1])-l];h[1]0?1:-1}function nO(r,e){return r.toGlobalCoord(r.dataToCoord(r.scale.parse(e)))}function X_e(r,e,t,i,n,a,o,s,l,u){var c=l.valueDim,h=l.categoryDim,f=Math.abs(t[h.wh]),p=r.getItemVisual(e,"symbolSize"),d;pe(p)?d=p.slice():p==null?d=["100%","100%"]:d=[p,p],d[h.index]=ze(d[h.index],f),d[c.index]=ze(d[c.index],i?f: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 Y_e(r,e,t,i,n){var a=r.get(G_e)||0;a&&(iO.attr({scaleX:e[0],scaleY:e[1],rotation:t}),iO.updateTransform(),a/=iO.getLineScale(),a*=e[i.valueDim.index]),n.valueLineWidth=a||0}function q_e(r,e,t,i,n,a,o,s,l,u,c,h){var f=c.categoryDim,p=c.valueDim,d=h.pxSign,g=Math.max(e[p.index]+s,0),m=g;if(i){var v=Math.abs(l),_=Hr(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=Rp(i),T=w?i:Yq((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?Yq((Math.abs(u)+S)/M):0),m=T*M-S,h.repeatTimes=T,h.symbolMargin=x}var b=d*(m/2),E=h.pathPosition=[];E[f.index]=t[f.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=h.bundlePosition=[];I[f.index]=t[f.xy],I[p.index]=t[p.xy];var R=h.barRectShape=he({},t);R[p.wh]=d*Math.max(Math.abs(t[p.wh]),Math.abs(E[p.index]+b)),R[f.wh]=t[f.wh];var A=h.clipShape={};A[f.xy]=-t[f.xy],A[f.wh]=c.ecSize[f.wh],A[p.xy]=0,A[p.wh]=t[p.wh]}function qq(r){var e=r.symbolPatternSize,t=wr(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,h=a[e.valueDim.index]+o+t.symbolMargin*2;for(aO(r,function(g){g.__pictorialAnimationIndex=c,g.__pictorialRepeatTimes=u,c0:v<0)&&(_=u-1-g),m[l.index]=h*(_-u/2+.5)+s[l.index],{x:m[0],y:m[1],scaleX:t.symbolScale[0],scaleY:t.symbolScale[1],rotation:t.rotation}}}function jq(r,e,t,i){var n=r.__pictorialBundle,a=r.__pictorialMainPath;a?eg(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=qq(t),n.add(a),eg(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 Kq(r,e,t){var i=he({},e.barRectShape),n=r.__pictorialBarRect;n?eg(n,null,{shape:i},e,t):(n=r.__pictorialBarRect=new Rt({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),n.disableMorphing=!0,r.add(n))}function Jq(r,e,t,i){if(t.symbolClip){var n=r.__pictorialClipPath,a=he({},t.clipShape),o=e.valueDim,s=t.animationModel,l=t.dataIndex;if(n)Ut(n,{shape:a},s,l);else{a[o.wh]=0,n=new Rt({shape:a}),r.__pictorialBundle.setClipPath(n),r.__pictorialClipPath=n;var u={};u[o.wh]=t.clipShape[o.wh],Pt[i?"updateProps":"initProps"](n,{shape:u},s,l)}}}function Gq(r,e){var t=r.getItemModel(e);return t.getAnimationDelayParams=Z_e,t.isAnimationEnabled=j_e,t}function Z_e(r){return{index:r.__pictorialAnimationIndex,count:r.__pictorialRepeatTimes}}function j_e(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function Hq(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):jq(n,e,t),Kq(n,t,i),Jq(n,e,t,i),n.__pictorialShapeStr=$q(r,t),n.__pictorialSymbolMeta=t,n}function K_e(r,e,t){var i=t.animationModel,n=t.dataIndex,a=r.__pictorialBundle;Ut(a,{x:t.bundlePosition[0],y:t.bundlePosition[1]},i,n),t.symbolRepeat?Zq(r,e,t,!0):jq(r,e,t,!0),Kq(r,t,!0),Jq(r,e,t,!0)}function Wq(r,e,t,i){var n=i.__pictorialBarRect;n&&n.removeTextContent();var a=[];aO(i,function(o){a.push(o)}),i.__pictorialMainPath&&a.push(i.__pictorialMainPath),i.__pictorialClipPath&&(t=null),N(a,function(o){Fs(o,{scaleX:0,scaleY:0},t,e,function(){i.parent&&i.parent.remove(i)})}),r.setItemGraphicEl(e,null)}function $q(r,e){return[r.getItemVisual(e.dataIndex,"symbol")||"none",!!e.symbolRepeat,!!e.symbolClip].join(":")}function aO(r,e,t){N(r.__pictorialBundle.children(),function(i){i!==r.__pictorialBarRect&&e.call(t,i)})}function eg(r,e,t,i,n,a){e&&r.attr(e),i.symbolClip&&!n?t&&r.attr(t):t&&Pt[n?"updateProps":"initProps"](r,t,i.animationModel,i.dataIndex,a)}function Xq(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"),h=a.get("blurScope"),f=a.get("scale");aO(r,function(g){if(g instanceof Br){var m=g.style;g.useStyle(he({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,f&&(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,Fr(d,Rr(n),{labelFetcher:e.seriesModel,labelDataIndex:i,defaultText:Fl(e.seriesModel.getData(),i),inheritColor:t.style.fill,defaultOpacity:t.style.opacity,defaultOutsidePosition:p}),sr(r,c,h,a.get("disabled"))}function Yq(r){var e=Math.round(r);return Math.abs(r-e)<1e-4?e:Math.ceil(r)}var Qq=H_e;var J_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=Qn(Uv.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}(Uv),eZ=J_e;function oO(r){r.registerChartView(Qq),r.registerSeriesModel(eZ),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ut(cT,"pictorialBar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,hT("pictorialBar"))}var $_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,h=u.boundaryGap;s.x=0,s.y=c.y+h[0];function f(m){return m.name}var p=new Nn(this._layersSeries||[],l,f,f),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;Ta&&(a=s),i.push(s)}for(var u=0;ua&&(a=h)}return{y0:n,max:a}}function uO(r){r.registerChartView(tZ),r.registerSeriesModel(rZ),r.registerLayout(lO),r.registerProcessor(kl("themeRiver"))}var rxe=2,ixe=4,nxe=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this)||this;o.z2=rxe,o.textConfig={inside:!0},it(o).seriesIndex=i.seriesIndex;var s=new It({z2:ixe,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;it(s).dataIndex=i.dataIndex;var l=i.getModel(),u=l.getModel("emphasis"),c=i.getLayout(),h=he({},c);h.label=null;var f=i.getVisual("style");f.lineJoin="bevel";var p=i.getVisual("decal");p&&(f.decal=Il(p,o));var d=Lu(l.getModel("itemStyle"),h,!0);he(h,d),N(Vi,function(_){var y=s.ensureState(_),x=l.getModel([_,"itemStyle"]);y.style=x.getItemStyle();var M=Lu(x,h);M&&(y.shape=M)}),t?(s.setShape(h),s.shape.r=c.r0,lr(s,{shape:{r:c.r}},n,i.dataIndex)):(Ut(s,{shape:h},n),Ui(s)),s.useStyle(f),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;sr(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),h=this,f=h.getTextContent(),p=this.node.dataIndex,d=a.get("minAngle")/180*Math.PI,g=a.get("show")&&!(d!=null&&Math.abs(s)A&&!ic(U-A)&&U0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,t,i,n):(o.virtualPiece=new cO(_,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";Jp(u,c)}}n=!0}})})},e.prototype._rootToNode=function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:RE,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}(Zt),oZ=oxe;var sxe=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};sZ(n);var a=this._levelModels=de(t.levels||[],function(l){return new Jt(l,this,i)},this),o=Vv.createTree(n,this,s);function s(l){l.wrapMethod("getItemModel",function(u,c){var h=o.getNodeByDataIndex(c),f=a[h.depth];return f&&(u.parentModel=f),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=Qh(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(){sS(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}($t);function sZ(r){var e=0;N(r.children,function(i){sZ(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 lZ=sxe;var uZ=Math.PI/180;function hO(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),h=ze(a[0],l/2),f=ze(a[1],l/2),p=-i.get("startAngle")*uZ,d=i.get("minAngle")*uZ,g=i.getData().tree.root,m=i.getViewRoot(),v=m.depth,_=i.get("sort");_!=null&&cZ(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=(f-h)/(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;G1;)o=o.parentNode;var s=n.getColorFromPalette(o.name||o.dataIndex+"",e);return i.depth>1&&Ce(s)&&(s=cw(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");he(u,l)})})}function pO(r){r.registerChartView(oZ),r.registerSeriesModel(lZ),r.registerLayout(ut(hO,"sunburst")),r.registerProcessor(ut(kl,"sunburst")),r.registerVisual(fO),aZ(r)}var dO={color:"fill",borderColor:"stroke"},hZ={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},Iu=xt(),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.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},e.prototype.getInitialData=function(t,i){return mn(null,this)},e.prototype.getDataParams=function(t,i,n){var a=r.prototype.getDataParams.call(this,t,i);return n&&(a.info=Iu(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}($t),fZ=uxe;function cxe(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 mO(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(cxe,r)}}}function hxe(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 vO(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(hxe,r)}}}function fxe(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 gO(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(fxe,r)}}}function pxe(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 yO(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(pxe,r)}}}function _O(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 LE(r,e,t,i){return r&&(r.legacy||r.legacy!==!1&&!t&&!i&&e!=="tspan"&&(e==="text"||tt(r,"text")))}function DE(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 pZ(o,r),N(o.rich,function(l){pZ(l,l)}),{textConfig:n,textContent:a}}function pZ(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 xO(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";dZ(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){dZ(s,s)}),i}function dZ(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 yZ={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},mZ=At(yZ),qst=wn(ts,function(r,e){return r[e]=1,r},{}),Zst=ts.join(", "),xS=["","style","shape","extra"],tg=xt();function SO(r,e,t,i,n){var a=r+"Animation",o=Su(r,i,n)||{},s=tg(e).userDuring;return o.duration>0&&(o.during=s?Be(yxe,{el:e,userDuring:s}):null,o.setToFinal=!0,o.scope=r),he(o,t[a]),o}function rg(r,e,t,i){i=i||{};var n=i.dataIndex,a=i.isInit,o=i.clearStyle,s=t.isAnimationEnabled(),l=tg(r),u=e.style;l.userDuring=e.during;var c={},h={};if(xxe(r,e,h),gZ("shape",e,h),gZ("extra",e,h),!a&&s&&(_xe(r,e,c),vZ("shape",r,e,c),vZ("extra",r,e,c),Sxe(r,e,u,c)),h.style=u,dxe(r,h,o),vxe(r,e),s)if(a){var f={};N(xS,function(d){var g=d?e[d]:e;g&&g.enterFrom&&(d&&(f[d]=f[d]||{}),he(d?f[d]:f,g.enterFrom))});var p=SO("enter",r,e,t,n);p.duration>0&&r.animateFrom(f,p)}else mxe(r,e,n||0,t,c);MO(r,e),u?r.dirty():r.markRedraw()}function MO(r,e){for(var t=tg(r).leaveToProps,i=0;i0&&r.animateFrom(n,a)}}function vxe(r,e){tt(e,"silent")&&(r.silent=e.silent),tt(e,"ignore")&&(r.ignore=e.ignore),r instanceof Si&&tt(e,"invisible")&&(r.invisible=e.invisible),r instanceof pt&&tt(e,"autoBatch")&&(r.autoBatch=e.autoBatch)}var Nu={},gxe={setTransform:function(r,e){return Nu.el[r]=e,this},getTransform:function(r){return Nu.el[r]},setShape:function(r,e){var t=Nu.el,i=t.shape||(t.shape={});return i[r]=e,t.dirtyShape&&t.dirtyShape(),this},getShape:function(r){var e=Nu.el.shape;if(e)return e[r]},setStyle:function(r,e){var t=Nu.el,i=t.style;return i&&(i[r]=e,t.dirtyStyle&&t.dirtyStyle()),this},getStyle:function(r){var e=Nu.el.style;if(e)return e[r]},setExtra:function(r,e){var t=Nu.el.extra||(Nu.el.extra={});return t[r]=e,this},getExtra:function(r){var e=Nu.el.extra;if(e)return e[r]}};function yxe(){var r=this,e=r.el;if(e){var t=tg(e).userDuring,i=r.userDuring;if(t!==i){r.el=r.userDuring=null;return}Nu.el=e,i(gxe)}}function vZ(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]={}),rf(l))he(o,a);else for(var u=tr(l),c=0;c=0){!o&&(o=i[r]={});for(var p=At(a),c=0;c=0)){var f=r.getAnimationStyleProps(),p=f?f.style:null;if(p){!a&&(a=i.style={});for(var d=At(t),u=0;u=0?e.getStore().get(B,P):void 0}var z=e.get(U.name,P),k=U&&U.ordinalMeta;return k?k.categories[z]:z}function S(A,P){P==null&&(P=u);var U=e.getItemVisual(P,"style"),B=U&&U.fill,z=U&&U.opacity,k=_(P,nf).getItemStyle();B!=null&&(k.fill=B),z!=null&&(k.opacity=z);var G={inheritColor:Ce(B)?B:"#000"},Y=y(P,nf),J=pr(Y,null,G,!1,!0);J.text=Y.getShallow("show")?mt(r.getFormattedLabel(P,nf),Fl(e,P)):null;var Q=sx(Y,G,!1);return C(A,k),k=xO(k,J,Q),A&&T(k,A),k.legacy=!0,k}function w(A,P){P==null&&(P=u);var U=_(P,Ec).getItemStyle(),B=y(P,Ec),z=pr(B,null,null,!0,!0);z.text=B.getShallow("show")?qi(r.getFormattedLabel(P,Ec),r.getFormattedLabel(P,nf),Fl(e,P)):null;var k=sx(B,null,!0);return C(A,U),U=xO(U,z,k),A&&T(U,A),U.legacy=!0,U}function T(A,P){for(var U in P)tt(P,U)&&(A[U]=P[U])}function C(A,P){A&&(A.textFill&&(P.textFill=A.textFill),A.textPosition&&(P.textPosition=A.textPosition))}function b(A,P){if(P==null&&(P=u),tt(dO,A)){var U=e.getItemVisual(P,"style");return U?U[dO[A]]:null}if(tt(hZ,A))return e.getItemVisual(P,A)}function E(A){if(a.type==="cartesian2d"){var P=a.getBaseAxis();return u8(Ye({axis:P},A))}}function I(){return t.getCurrentSeriesIndices()}function R(A){return pv(A,t)}}function Dxe(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 TO(r,e,t,i,n,a,o){if(!i){a.remove(e);return}var s=PO(r,e,t,i,n,a);return s&&o.setItemGraphicEl(t,s),s&&sr(s,i.focus,i.blurScope,i.emphasisDisabled),s}function PO(r,e,t,i,n,a){var o=-1,s=e;e&&EZ(e,i,n)&&(o=yt(a.childrenRef(),e),e=null);var l=!e,u=e;u?u.clearStates():(u=LO(i),s&&Axe(s,u)),i.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),Ks.normal.cfg=Ks.normal.conOpt=Ks.emphasis.cfg=Ks.emphasis.conOpt=Ks.blur.cfg=Ks.blur.conOpt=Ks.select.cfg=Ks.select.conOpt=null,Ks.isLegacy=!1,Ixe(u,t,i,n,l,Ks),Pxe(u,t,i,n,l),DO(r,u,t,i,Ks,n,l),tt(i,"info")&&(Iu(u).info=i.info);for(var c=0;c=0?a.replaceAt(u,o):a.add(u),u}function EZ(r,e,t){var i=Iu(r),n=e.type,a=e.shape,o=e.style;return t.isUniversalTransitionEnabled()||n!=null&&n!==i.customGraphicType||n==="path"&&Fxe(a)&&AZ(a)!==i.customPathData||n==="image"&&tt(o,"image")&&o.image!==i.customImagePath}function Pxe(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&&EZ(o,a,i)&&(o=null),o||(o=LO(a),r.setClipPath(o)),DO(null,o,e,a,null,i,n)}}function Ixe(r,e,t,i,n,a){if(!r.isGroup){SZ(t,null,a),SZ(t,Ec,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=LO(o),r.setTextContent(c)),DO(null,c,e,o,null,i,n);for(var h=o&&o.style,f=0;f=c;p--){var d=e.childAt(p);Uxe(e,d,n)}}}function Uxe(r,e,t){e&&ig(e,Iu(r).option,t)}function Oxe(r){new Nn(r.oldChildren,r.newChildren,MZ,MZ,r).add(bZ).update(bZ).remove(zxe).execute()}function MZ(r,e){var t=r&&r.name;return t??Txe+e}function bZ(r,e){var t=this.context,i=r!=null?t.newChildren[r]:null,n=e!=null?t.oldChildren[e]:null;PO(t.api,n,t.dataIndex,i,t.seriesModel,t.group)}function zxe(r){var e=this.context,t=e.oldChildren[r];t&&ig(t,Iu(t).option,e.seriesModel)}function AZ(r){return r&&(r.pathData||r.d)}function Fxe(r){return r&&(tt(r,"pathData")||tt(r,"d"))}function NO(r){r.registerChartView(wZ),r.registerSeriesModel(fZ)}var Sd=xt(),CZ=Qe,UO=Be,Bxe=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 h=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 f=ut(RZ,t,h);this.updatePointerEl(s,u,f),this.updateLabelEl(s,u,f,t)}DZ(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=jT(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=Sd(e).pointerEl=new Pt[a.type](CZ(t.pointer));e.add(o)}},r.prototype.createLabelEl=function(e,t,i,n){if(t.label){var a=Sd(e).labelEl=new It(CZ(t.label));e.add(a),LZ(a,n)}},r.prototype.updatePointerEl=function(e,t,i){var n=Sd(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=Sd(e).labelEl;a&&(a.setStyle(t.label.style),i(a,{x:t.label.x,y:t.label.y}),LZ(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=pc(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){po(u.event)},onmousedown:UO(this._onHandleDragMove,this,0,0),drift:UO(this._onHandleDragMove,this),ondragend:UO(this._onHandleDragEnd,this)}),i.add(n)),DZ(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,Hs(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},r.prototype._moveHandleToValue=function(e,t){RZ(this._axisPointerModel,!t&&this._moveAnimation,this._handle,OO(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(OO(i),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(OO(n)),Sd(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),xc(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 RZ(r,e,t,i){PZ(Sd(t).lastProp,i)||(Sd(t).lastProp=i,e?Ut(t,i,r):(t.stopAnimation(),t.attr(i)))}function PZ(r,e){if(qe(r)&&qe(e)){var t=!0;return N(e,function(i,n){t=t&&PZ(r[n],i)}),!!t}else return r===e}function LZ(r,e){r[e.get(["label","show"])?"show":"hide"]()}function OO(r){return{x:r.x||0,y:r.y||0,rotation:r.rotation||0}}function DZ(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 ag=Bxe;function og(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 zO(r,e,t,i,n){var a=t.get("value"),o=FO(a,e.axis,e.ecModel,t.get("seriesDataIndices"),{precision:t.get(["label","precision"]),formatter:t.get(["label","formatter"])}),s=t.getModel("label"),l=Al(s.get("padding")||0),u=s.getFont(),c=fu(o,u),h=n.position,f=c.width+l[1]+l[3],p=c.height+l[0]+l[2],d=n.align;d==="right"&&(h[0]-=f),d==="center"&&(h[0]-=f/2);var g=n.verticalAlign;g==="bottom"&&(h[1]-=p),g==="middle"&&(h[1]-=p/2),kxe(h,f,p,i);var m=s.get("backgroundColor");(!m||m==="auto")&&(m=e.get(["axisLine","lineStyle","color"])),r.label={x:h[0],y:h[1],style:pr(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:m}),z2:10}}function kxe(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 FO(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:Yx(e,{value:r}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};N(i,function(l){var u=t.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),Ce(o)?a=o.replace("{value}",a):He(o)&&(a=o(s))}return a}function SS(r,e,t){var i=Ci();return vo(i,i,t.rotation),En(i,i,t.position),Dn([r.dataToCoord(e),(t.labelOffset||0)+(t.labelDirection||1)*(t.labelMargin||0)],i)}function NE(r,e,t,i,n,a){var o=Un.innerTextLayout(t.rotation,0,t.labelDirection);t.labelMargin=n.get(["label","margin"]),zO(e,i,n,a,{position:SS(i.axis,r,t),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function sg(r,e,t){return t=t||0,{x1:r[t],y1:r[1-t],x2:e[t],y2:e[1-t]}}function UE(r,e,t){return t=t||0,{x:r[t],y:r[1-t],width:e[t],height:e[1-t]}}function BO(r,e,t,i,n,a){return{cx:r,cy:e,r0:t,r:i,startAngle:n,endAngle:a,clockwise:!0}}var Vxe=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=IZ(l,s).getOtherAxis(s).getGlobalExtent(),h=s.toGlobalCoord(s.dataToCoord(i,!0));if(u&&u!=="none"){var f=og(a),p=Gxe[u](s,h,c);p.style=f,t.graphicKey=p.type,t.pointer=p}var d=iS(l.model,n);NE(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=iS(i.axis.grid.model,i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=SS(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=IZ(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[t.x,t.y];h[c]+=i[c],h[c]=Math.min(l[1],h[c]),h[c]=Math.max(l[0],h[c]);var f=(u[1]+u[0])/2,p=[f,f];p[c]=h[c];var d=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:t.rotation,cursorPoint:p,tooltipOption:d[c]}},e}(ag);function IZ(r,e){var t={};return t[e.dim+"AxisIndex"]=e.index,r.getCartesian(t)}var Gxe={line:function(r,e,t){var i=sg([e,t[0]],[e,t[1]],NZ(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:UE([e-i/2,t[0]],[i,n],NZ(r))}}};function NZ(r){return r.dim==="x"?0:1}var UZ=Vxe;var Hxe=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}(Nt),OZ=Hxe;var Ac=xt(),Wxe=N;function zE(r,e,t){if(!Bt.node){var i=e.getZr();Ac(i).records||(Ac(i).records={}),Xxe(i,e);var n=Ac(i).records[r]||(Ac(i).records[r]={});n.handler=t}}function Xxe(r,e){if(Ac(r).initialized)return;Ac(r).initialized=!0,t("click",ut(zZ,"click")),t("mousemove",ut(zZ,"mousemove")),t("globalout",qxe);function t(i,n){r.on(i,function(a){var o=Zxe(e);Wxe(Ac(r).records,function(s){s&&n(s,a,o.dispatchAction)}),Yxe(o.pendings,e)})}}function Yxe(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 qxe(r,e,t){r.handler("leave",null,t)}function zZ(r,e,t,i){e.handler(r,t,i)}function Zxe(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 MS(r,e){if(!Bt.node){var t=e.getZr(),i=(Ac(t).records||{})[r];i&&(Ac(t).records[r]=null)}}var jxe=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";zE("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){MS("axisPointer",i)},e.prototype.dispose=function(t,i){MS("axisPointer",i)},e.type="axisPointer",e}(ir),BZ=jxe;function bS(r,e){var t=[],i=r.seriesIndex,n;if(i==null||!(n=e.getSeriesByIndex(i)))return{point:[]};var a=n.getData(),o=Us(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),h=c.dim,f=u.dim,p=h==="x"||h==="radius"?1:0,d=a.mapDimension(f),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 kZ=xt();function kO(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){FE(n)&&(n=bS({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=FE(n),u=a.axesInfo,c=s.axesInfo,h=i==="leave"||FE(n),f={},p={},d={list:[],map:{}},g={showPointer:ut(Jxe,p),showTooltip:ut($xe,d)};N(s.coordSysMap,function(v,_){var y=l||v.containPoint(n);N(s.coordSysAxesInfo[_],function(x,M){var S=x.axis,w=rSe(u,x);if(!h&&y&&(!u||w)){var T=w&&w.value;T==null&&!l&&(T=S.pointToData(n)),T!=null&&VZ(x,T,g,!1,f)}})});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,GZ(x),GZ(v)))),m[v.key]=w}})}),N(m,function(v,_){VZ(c[_],v,g,!0,f)}),Qxe(p,c,f),eSe(d,n,r,o),tSe(c,o,t),f}}function VZ(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=Kxe(e,r),s=o.payloadBatch,l=o.snapToValue;s[0]&&n.seriesIndex==null&&he(n,s[0]),!i&&r.snap&&a.containData(l)&&l!=null&&(e=l),t.showPointer(r,e,s),t.showTooltip(r,o,l)}}function Kxe(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),h,f;if(l.getAxisTooltipData){var p=l.getAxisTooltipData(c,r,t);f=p.dataIndices,h=p.nestestValue}else{if(f=l.getData().indicesOfNearest(c[0],r,t.type==="category"?.5:null),!f.length)return;h=l.getData().get(c[0],f[0])}if(!(h==null||!isFinite(h))){var d=r-h,g=Math.abs(d);g<=o&&((g=0&&s<0)&&(o=g,s=d,n=h,a.length=0),N(f,function(m){a.push({seriesIndex:l.seriesIndex,dataIndexInside:m,dataIndex:l.getData().getRawIndex(m)})}))}}),{payloadBatch:a,snapToValue:n}}function Jxe(r,e,t,i){r[e.key]={value:t,payloadBatch:i}}function $xe(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=zv(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 Qxe(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 eSe(r,e,t,i){if(FE(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 tSe(r,e,t){var i=t.getZr(),n="axisPointerLastHighlights",a=kZ(i)[n]||{},o=kZ(i)[n]={};N(r,function(u,c){var h=u.axisPointerModel.option;h.status==="show"&&u.triggerEmphasis&&N(h.seriesDataIndices,function(f){var p=f.seriesIndex+" | "+f.dataIndex;o[p]=f})});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 rSe(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 GZ(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 FE(r){return!r||r[0]==null||isNaN(r[0])||r[1]==null||isNaN(r[1])}function Gl(r){Po.registerAxisPointerClass("CartesianAxisPointer",UZ),r.registerComponentModel(OZ),r.registerComponentView(BZ),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=m9(e,t)}),r.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},kO)}function VO(r){Ot($T),Ot(Gl)}var iSe=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(),h=s.dataToCoord(i),f=a.get("type");if(f&&f!=="none"){var p=og(a),d=aSe[f](s,l,h,c);d.style=p,t.graphicKey=d.type,t.pointer=d}var g=a.get(["label","margin"]),m=nSe(i,n,a,l,g);zO(t,n,a,o,m)},e}(ag);function nSe(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,h;if(a.dim==="radius"){var f=Ci();vo(f,f,s),En(f,f,[i.cx,i.cy]),u=Dn([o,-n],f);var p=e.getModel("axisLabel").get("rotate")||0,d=Un.innerTextLayout(s,p*Math.PI/180,-1);c=d.textAlign,h=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",h=Math.abs(u[1]-v)/g<.3?"middle":u[1]>v?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var aSe={line:function(r,e,t,i){return r.dim==="angle"?{type:"Line",shape:sg(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:BO(e.cx,e.cy,i[0],i[1],(-t-n/2)*a,(-t+n/2)*a)}:{type:"Sector",shape:BO(e.cx,e.cy,t-n/2,t+n/2,0,Math.PI*2)}}},HZ=iSe;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.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}(Nt),WZ=oSe;var GO=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Ir).models[0]},e.type="polarAxis",e}(Nt);Cr(GO,wu);var XZ=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}(GO);var YZ=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}(GO);var HO=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}(vn);HO.prototype.dataToRadius=vn.prototype.dataToCoord;HO.prototype.radiusToData=vn.prototype.coordToData;var qZ=HO;var sSe=xt(),WO=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=fu(s==null?"":s+"",i.getFont(),"center","top"),h=Math.max(c.height,7),f=h/u;isNaN(f)&&(f=1/0);var p=Math.max(0,Math.floor(f)),d=sSe(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}(vn);WO.prototype.dataToAngle=vn.prototype.dataToCoord;WO.prototype.angleToData=vn.prototype.coordToData;var ZZ=WO;var XO=["radius","angle"],lSe=function(){function r(e){this.dimensions=XO,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new qZ,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=us;)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,h=this.r,f=this.r0;return c<=h*h&&c>=f*f}}},r.prototype.convertToPixel=function(e,t,i){var n=jZ(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=jZ(t);return n===this?this.pointToData(i):null},r}();function jZ(r){var e=r.seriesModel,t=r.polarModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var KZ=lSe;function uSe(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 cSe(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(Lv(l,"radius"),function(u){n.scale.unionExtentFromData(l,u)}),N(Lv(l,"angle"),function(u){i.scale.unionExtentFromData(l,u)})}}),bu(i.scale,i.model),bu(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 hSe(r){return r.mainType==="angleAxis"}function JZ(r,e){var t;if(r.type=e.get("type"),r.scale=Xh(e),r.onBand=e.get("boundaryGap")&&r.type==="category",r.inverse=e.get("inverse"),hSe(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 fSe={dimensions:XO,create:function(r,e){var t=[];return r.eachComponent("polar",function(i,n){var a=new KZ(n+"");a.update=cSe;var o=a.getRadiusAxis(),s=a.getAngleAxis(),l=i.findAxisModel("radiusAxis"),u=i.findAxisModel("angleAxis");JZ(o,l),JZ(s,u),uSe(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",Ir).models[0];i.coordinateSystem=n.coordinateSystem}}),t}},$Z=fSe;var pSe=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function BE(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 kE(r){var e=r.getRadiusAxis();return e.inverse?0:1}function QZ(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 dSe=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 h=n.scale,f=h.type==="ordinal"?h.getRawOrdinalNumber(c.tickValue):c.tickValue;return c.coord=n.dataToCoord(f),c});QZ(u),QZ(s),N(pSe,function(c){t.get([c,"show"])&&(!n.scale.isBlank()||c==="axisLine")&&mSe[c](this.group,t,a,s,l,o,u)},this)}},e.type="angleAxis",e}(Po),mSe={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=kE(t),h=c?0:1,f,p=Math.abs(u[1]-u[0])===360?"Circle":"Arc";a[h]===0?f=new Pt[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}):f=new Gp({shape:{cx:t.cx,cy:t.cy,r:a[c],r0:a[h]},style:o.getLineStyle(),z2:1,silent:!0}),f.style.fill=null,r.add(f)},axisTick:function(r,e,t,i,n,a){var o=e.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=a[kE(t)],u=de(i,function(c){return new ei({shape:BE(t,[l,l+s],c.coord)})});r.add($n(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[kE(t)],c=[],h=0;hv?"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 Jt(M.textStyle,l,l.ecModel))}var S=new It({silent:Un.isLabelSilent(e),style:pr(p,{x:m[0],y:m[1],fill:p.getTextColor()||e.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:y,verticalAlign:x})});if(r.add(S),c){var w=Un.makeAxisEventDataBase(e);w.targetType="axisLabel",w.value=h.rawLabel,it(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=[],h=0;h=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,P=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)=B})}}})}function MSe(r){var e={};N(r,function(i,n){var a=i.getData(),o=i.coordinateSystem,s=o.getBaseAxis(),l=ij(o,s),u=s.getExtent(),c=s.type==="category"?s.getBandWidth():Math.abs(u[1]-u[0])/a.count(),h=e[l]||{bandWidth:c,remainedWidth:c,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},f=h.stacks;e[l]=h;var p=rj(i);f[p]||h.autoWidthCount++,f[p]=f[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&&!f[p].width&&(d=Math.min(h.remainedWidth,d),f[p].width=d,h.remainedWidth-=d),g&&(f[p].maxWidth=g),m!=null&&(h.gap=m),v!=null&&(h.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,h=(u-s)/(c+(c-1)*l);h=Math.max(h,0),N(a,function(g,m){var v=g.maxWidth;v&&v=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=uj(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=uj(t);return n===this?this.pointToData(i):null},r}();function uj(r){var e=r.seriesModel,t=r.singleAxisModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var cj=DSe;function PSe(r,e){var t=[];return r.eachComponent("singleAxis",function(i,n){var a=new cj(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",Ir).models[0];i.coordinateSystem=n&&n.coordinateSystem}}),t}var ISe={create:PSe,dimensions:qO},hj=ISe;var fj=["x","y"],NSe=["width","height"],USe=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=ZO(l,1-GE(s)),c=l.dataToPoint(i)[0],h=a.get("type");if(h&&h!=="none"){var f=og(a),p=OSe[h](s,c,u);p.style=f,t.graphicKey=p.type,t.pointer=p}var d=wS(n);NE(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=wS(i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=SS(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=GE(o),u=ZO(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 h=ZO(s,1-l),f=(h[1]+h[0])/2,p=[f,f];return p[l]=c[l],{x:c[0],y:c[1],rotation:t.rotation,cursorPoint:p,tooltipOption:{verticalAlign:"middle"}}},e}(ag),OSe={line:function(r,e,t){var i=sg([e,t[0]],[e,t[1]],GE(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:UE([e-i/2,t[0]],[i,n],GE(r))}}};function GE(r){return r.isHorizontal()?0:1}function ZO(r,e){var t=r.getRect();return[t[fj[e]],t[fj[e]]+t[NSe[e]]]}var pj=USe;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="single",e}(ir);function jO(r){Ot(Gl),Po.registerAxisPointerClass("SingleAxisPointer",pj),r.registerComponentView(zSe),r.registerComponentView(oj),r.registerComponentModel(VE),Vl(r,"single",VE,VE.defaultOption),r.registerCoordinateSystem("single",hj)}var 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.prototype.init=function(t,i,n){var a=ks(t);r.prototype.init.apply(this,arguments),dj(t,a)},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),dj(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}(Nt);function dj(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 I5(e,a)&&(i[a]="auto"),i[a]!=null&&i[a]!=="auto"});Eo(r,e,{type:"box",ignoreSize:n})}var mj=FSe;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.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,h=new Rt({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});n.add(h)}},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 h=i.start,f=0;h.time<=i.end.time;f++){d(h.formatedDate),f===0&&(h=s.getDateInfo(i.start.y+"-"+i.start.m));var p=h.date;p.setMonth(p.getMonth()+1),h=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 ri({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?L5(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,h=(u[0][1]+u[1][1])/2,f=n==="horizontal"?0:1,p={top:[c,u[f][1]],bottom:[c,u[1-f][1]],left:[u[1-f][0],h],right:[u[f][0],h]},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 It({z2:30,style:pr(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"),h=[this._tlpoints,this._blpoints];(!s||Ce(s))&&(s&&(i=lx(s)||i),s=i.get(["time","monthAbbr"])||[]);var f=u==="start"?0:1,p=n==="horizontal"?0:1;l=u==="start"?-l:l;for(var d=c==="center",g=0;g=n.start.time&&i.times.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/KO)-Math.floor(t[0].time/KO)+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),h=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:h,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&&tn.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 gj(r){var e=r.calendarModel,t=r.seriesModel,i=e?e.coordinateSystem:t?t.coordinateSystem:null;return i}var yj=kSe;function JO(r){r.registerComponentModel(mj),r.registerComponentView(vj),r.registerCoordinateSystem("calendar",yj)}function VSe(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 _j(r,e){var t;return N(e,function(i){r[i]!=null&&r[i]!=="auto"&&(t=!0)}),t}function GSe(r,e,t){var i=he({},t),n=r[e],a=t.$action||"merge";if(a==="merge")if(n){if(0)var o;bt(n,i,!0),Eo(n,i,{ignoreSize:!0}),$D(t,n),HE(t,n),HE(t,n,"shape"),HE(t,n,"style"),HE(t,n,"extra"),t.clipPath=n.clipPath}else r[e]=i;else a==="replace"?r[e]=i:a==="remove"&&n&&(r[e]=null)}var xj=["transition","enterFrom","leaveTo"],HSe=xj.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function HE(r,e,t){if(t&&(!r[t]&&e[t]&&(r[t]={}),r=r[t],e=e[t]),!(!r||!e))for(var i=t?xj:HSe,n=0;n=0;c--){var h=n[c],f=Kr(h.id,null),p=f!=null?o.get(f):null;if(p){var d=p.parent,v=Js(d),_=d===a?{width:s,height:l}:{width:v.width,height:v.height},y={},x=Ih(p,h,_,null,{hv:h.hv,boundingMode:h.bounding},y);if(!Js(p).isNew&&x){for(var M=h.transition,S={},w=0;w=0)?S[T]=C:p[T]=C}Ut(p,S,t,0)}else p.attr(y)}}},e.prototype._clear=function(){var t=this,i=this._elMap;i.each(function(n){WE(n,Js(n).option,i,t._lastGraphicModel)}),this._elMap=ke()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(ir);function $O(r){var e=tt(Mj,r)?Mj[r]:ax(r),t=new e({});return Js(t).type=r,t}function bj(r,e,t,i){var n=$O(t);return e.add(n),i.set(r,n),Js(n).id=r,Js(n).isNew=!0,n}function WE(r,e,t,i){var n=r&&r.parent;n&&(r.type==="group"&&r.traverse(function(a){WE(a,e,t,i)}),ig(r,e,i),t.removeKey(Js(r).id))}function wj(r,e,t,i){r.isGroup||N([["cursor",Si.prototype.cursor],["zlevel",i||0],["z",t||0],["z2",0]],function(n){var a=n[0];tt(e,a)?r[a]=mt(e[a],n[1]):r[a]==null&&(r[a]=n[1])}),N(At(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 XSe(r){return r=he({},r),N(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(KD),function(e){delete r[e]}),r}function YSe(r,e,t){var i=it(r).eventData;!r.silent&&!r.ignore&&!i&&(i=it(r).eventData={componentType:"graphic",componentIndex:e.componentIndex,name:r.name}),i&&(i.info=t.info)}function QO(r){r.registerComponentModel(Sj),r.registerComponentView(Tj),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 e3=["x","y","radius","angle","single"],qSe=["cartesian2d","polar","singleAxis"];function Ej(r){var e=r.get("coordinateSystem");return yt(qSe,e)>=0}function $s(r){return r+"Axis"}function Aj(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 h=!1;return c.eachTargetAxis(function(f,p){var d=t.get(f);d&&d[p]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,f){(t.get(h)||t.set(h,[]))[f]=!0})}return i}function XE(r){var e=r.ecModel,t={infoList:[],infoMap:ke()};return r.eachTargetAxis(function(i,n){var a=e.getComponent($s(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 t3=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}(),ZSe=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=Cj(t);this.settledOption=a,this.mergeDefaultAndTheme(t,n),this._doInit(a)},e.prototype.mergeOption=function(t){var i=Cj(t);bt(this.option,t,!0),bt(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(e3,function(n){var a=this.getReferringComponents($s(n),MH);if(a.specified){i=!0;var o=new t3;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 h=u[0];if(h){var f=new t3;if(f.add(h.componentIndex),t.set(c,f),a=!1,c==="x"||c==="y"){var p=h.getReferringComponents("grid",Ir).models[0];p&&N(u,function(d){h.componentIndex!==d.componentIndex&&p===d.getReferringComponents("grid",Ir).models[0]&&f.add(d.componentIndex)})}}}a&&N(e3,function(u){if(a){var c=n.findComponents({mainType:$s(u),filter:function(f){return f.get("type",!0)==="category"}});if(c[0]){var h=new t3;h.add(c[0].componentIndex),t.set(u,h),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($s(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($s(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;ao[1];if(y&&!x&&!M)return!0;y&&(m=!0),x&&(d=!0),M&&(g=!0)}return m&&d&&g})}else ug(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)}});ug(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;ug(["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=ar(i[0]+o,i,[0,100],!0):a!=null&&(o=ar(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=qm(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 QSe(r,e,t){var i=[1/0,-1/0];ug(t,function(o){S8(i,o.getData(),e)});var n=r.getAxisModel(),a=gT(n.axis.scale,n,i).calculate();return[a.min,a.max]}var Pj=$Se;var eMe={getTargetSeries:function(r){function e(n){r.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=r.getComponent($s(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 Pj(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]})}})}},Ij=eMe;function r3(r){r.registerAction("dataZoom",function(e,t){var i=Aj(t,e);N(i,function(n){n.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var Nj=!1;function Md(r){Nj||(Nj=!0,r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,Ij),r3(r),r.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function Uj(r){r.registerComponentModel(Rj),r.registerComponentView(Lj),Md(r)}var en=function(){function r(){}return r}();var Oj={};function sf(r,e){Oj[r]=e}function YE(r){return Oj[r]}var rMe=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=YE(n);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(t)),bt(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}(Nt),zj=rMe;function Fj(r,e,t){var i=e.getBoxLayoutParams(),n=e.get("padding"),a={width:t.getWidth(),height:t.getHeight()},o=br(i,a,n);Rl(e.get("orient"),r,e.get("itemGap"),o.width,o.height),Ih(r,i,a,n)}function qE(r,e){var t=Al(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),r=new Rt({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 nMe=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={}),h=[];N(u,function(d,g){h.push(g)}),new Nn(this._featureNames||[],h).add(f).update(f).remove(ut(f,null)).execute(),this._featureNames=h;function f(d,g){var m=h[d],v=h[g],_=u[m],y=new Jt(_,t,t.ecModel),x;if(a&&a.newTitle!=null&&a.featureName===m&&(_.title=a.newTitle),m&&!v){if(aMe(m))x={onclick:y.option.onclick,featureName:m};else{var M=YE(m);if(!M)return;x=new M}c[m]=x}else if(x=c[v],!x)return;x.uid=Bs("toolbox-feature"),x.model=y,x.ecModel=i,x.api=n;var S=x instanceof en;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"?jn:Kn)(b[w])},x instanceof en&&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 en&&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=pc(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 It({style:{text:S[C],align:_.get("textAlign"),borderRadius:_.get("textBorderRadius"),padding:_.get("textPadding"),fill:null,font:pv({fontStyle:_.get("textFontStyle"),fontFamily:_.get("textFontFamily"),fontSize:_.get("textFontSize"),fontWeight:_.get("textFontWeight")},i)},ignore:!0});b.setTextContent(I),El({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"?jn:Kn)(b),o.add(b),b.on("click",Be(g.onclick,g,i,n,C)),w[C]=b})}Fj(o,t,n),o.add(qE(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=fu(g,It.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 en&&o.updateView&&o.updateView(o.model,i,n,a)})},e.prototype.remove=function(t,i){N(this._features,function(n){n instanceof en&&n.remove&&n.remove(t,i)}),this.group.removeAll()},e.prototype.dispose=function(t,i){N(this._features,function(n){n instanceof en&&n.dispose&&n.dispose(t,i)})},e.type="toolbox",e}(ir);function aMe(r){return r.indexOf("my")===0}var Bj=nMe;var oMe=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=Bt.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 h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||o){var f=l.split(","),p=f[0].indexOf("base64")>-1,d=o?decodeURIComponent(f[1]):f[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='',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}(en),kj=oMe;var Vj="__ec_magicType_stack__";var sMe=[["line","bar"],["stack"]],lMe=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(Gj[n]){var s={series:[]},l=function(h){var f=h.subType,p=h.id,d=Gj[n](f,p,h,a);d&&(Ye(d,h.option),s.series.push(d));var g=h.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=h.getReferringComponents(_,Ir).models[0],x=y.componentIndex;s[_]=s[_]||[];for(var M=0;M<=x;M++)s[_][x]=s[_][x]||{};s[_][x].boundaryGap=n==="bar"}}};N(sMe,function(h){yt(h,n)>=0&&N(h,function(f){a.setIconStatus(f,"normal")})}),a.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=n;n==="stack"&&(u=bt({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}(en),Gj={line:function(r,e,t,i){if(r==="bar")return bt({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 bt({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")===Vj;if(r==="line"||r==="bar")return i.setIconStatus("stack",n?"normal":"emphasis"),bt({id:e,stack:n?"":Vj},i.get(["option","stack"])||{},!0)}};xa({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(r,e){e.mergeOption(r.newOption)});var Hj=lMe;var jE=new Array(60).join("-"),cg=" ";function uMe(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 cMe(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(cg)],c=0;c=0)return!0}var i3=new RegExp("["+cg+"]+","g");function dMe(r){for(var e=r.split(/\n+/g),t=ZE(e.shift()).split(i3),i=[],n=de(t,function(l){return{name:l,data:[]}}),a=0;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=n3(r),t=e[e.length-1];e.length>1&&e.pop();var i={};return Xj(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 jj(r){Yj(r).snapshots=null}function Kj(r){return n3(r).length}function n3(r){var e=Yj(r);return e.snapshots||(e.snapshots=[{}]),e.snapshots}var _Me=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){jj(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}(en);xa({type:"restore",event:"restore",update:"prepareAndUpdate"},function(r,e){e.resetOption("recreate")});var $j=_Me;var xMe=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],SMe=function(){function r(e,t,i){var n=this;this._targetInfoList=[];var a=Qj(t,e);N(MMe,function(o,s){(!i||!i.include||yt(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=a3[i.brushType](0,a,n);i.__rangeOffset={offset:iK[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=a3[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=a3[i.brushType](0,n.coordSys,i.coordRange),o=i.__rangeOffset;i.range=o?iK[i.brushType](a.values,o.offset,bMe(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:xE(n),isTargetByCursor:ME(n,e,i.coordSysModel),getLinearBrushOtherExtent:SE(n)}})},r.prototype.controlSeries=function(e,t,i){var n=this.findTargetInfo(e,i);return n===!0||n&&yt(n.coordSyses,t.coordinateSystem)>=0},r.prototype.findTargetInfo=function(e,t){for(var i=this._targetInfoList,n=Qj(t,e),a=0;ar[1]&&r.reverse(),r}function Qj(r,e){return bh(r,e,{includeMainTypes:xMe})}var MMe={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(h,f){(yt(t,h.getAxis("x").model)>=0||yt(i,h.getAxis("y").model)>=0)&&c.push(h)}),e.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:tK.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:tK.geo})})}},eK=[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}],tK={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var r=this.coordSys,e=r.getBoundingRect().clone();return e.applyTransform(Tl(r)),e}},a3={lineX:ut(rK,0),lineY:ut(rK,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=[o3([n[0],a[0]]),o3([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 rK(r,e,t,i){var n=t.getAxis(["x","y"][r]),a=o3(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 iK={lineX:ut(nK,0),lineY:ut(nK,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 nK(r,e,t,i){return[e[0]-i[r]*t[0],e[1]-i[r]*t[1]]}function bMe(r,e){var t=aK(r),i=aK(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 aK(r){return r?[r[0][1]-r[0][0],r[1][1]-r[1][0]]:[NaN,NaN]}var TS=SMe;var s3=N,wMe=_H("toolbox-dataZoom_");var TMe=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 Qv(n.getZr()),this._brushController.on("brush",Be(this._onBrush,this)).mount()),CMe(t,i,this,a,n),AMe(t,i)},e.prototype.onclick=function(t,i,n){EMe[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 TS(l3(this.model),a,{include:["grid"]});o.matchOutputRanges(i,a,function(u,c,h){if(h.type==="cartesian2d"){var f=u.brushType;f==="rect"?(s("x",h,c[0]),s("y",h,c[1])):s({lineX:"x",lineY:"y"}[f],h,c)}}),qj(a,n),this._dispatchZoomAction(n);function s(u,c,h){var f=c.getAxis(u),p=f.model,d=l(u,p,a),g=d.findRepresentativeAxisProxy(p).getMinMaxSpan();(g.minValueSpan!=null||g.maxValueSpan!=null)&&(h=Io(0,h.slice(),f.scale.getExtent(),0,g.minValueSpan,g.maxValueSpan)),d&&(n[d.id]={dataZoomId:d.id,startValue:h[0],endValue:h[1]})}function l(u,c,h){var f;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(p){var d=p.getAxisModel(u,c.componentIndex);d&&(f=p)}),f}},e.prototype._dispatchZoomAction=function(t){var i=[];s3(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}(en),EMe={zoom:function(){var r=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:r})},back:function(){this._dispatchZoomAction(Zj(this.ecModel))}};function l3(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 AMe(r,e){r.setIconStatus("back",Kj(e)>1?"emphasis":"normal")}function CMe(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 TS(l3(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)}k5("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=l3(i),o=bh(r,a);s3(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),s3(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var h=l.componentIndex,f={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:wMe+u+h};f[c]=h,n.push(f)}return n});var oK=TMe;function u3(r){r.registerComponentModel(zj),r.registerComponentView(Bj),sf("saveAsImage",kj),sf("magicType",Hj),sf("dataView",Wj),sf("dataZoom",oK),sf("restore",$j),Ot(Uj)}var RMe=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}(Nt),sK=RMe;function KE(r){var e=r.get("confine");return e!=null?!!e:r.get("renderMode")==="richText"}function lK(r){if(Bt.domSupported){for(var e=document.documentElement.style,t=0,i=r.length;t-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,h=o+n,f=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),p=Math.round(((f-Math.SQRT2*n)/2+Math.SQRT2*n-(f-h)/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'
'}function NMe(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+=Bt.transformSupported?","+f3+i:",left"+i+",top"+i),LMe+":"+n}function hK(r,e,t){var i=r.toFixed(0)+"px",n=e.toFixed(0)+"px";if(!Bt.transformSupported)return t?"top:"+n+";left:"+i+";":[["top",n],["left",i]];var a=Bt.transform3dSupported,o="translate"+(a?"3d":"")+"("+i+","+n+(a?",0":"")+")";return t?"top:0;left:0;"+f3+":"+o+";":[["top",0],["left",0],[c3,o]]}function UMe(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 OMe(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"),h=U1(r,"html"),f=l+"px "+u+"px "+o+"px "+s;return i.push("box-shadow:"+f),e&&n&&i.push(NMe(n,t)),a&&i.push("background-color:"+a),N(["width","color","radius"],function(p){var d="border-"+p,g=d1(d),m=r.get(g);m!=null&&i.push(d+":"+m+(p==="color"?"":"px"))}),i.push(UMe(c)),h!=null&&i.push("padding:"+Al(h).join("px ")+"px"),i.join(";")+";"}function fK(r,e,t,i,n){var a=e&&e.painter;if(t){var o=a&&a.getViewportRoot();o&&rG(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 zMe=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,Bt.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):fh(a)?a:He(a)&&a(e.getDom()));fK(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();fo(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=cK(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=DMe+OMe(e,!this._firstShow,this._longHide)+hK(a[0],a[1],!0)+("border-color:"+Cl(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"&&!KE(i)&&(s=IMe(i,n,a)),Ce(e))o.innerHTML=e+s;else if(e){o.innerHTML="",pe(e)||(e=[e]);for(var l=0;l=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||Bt.node||!n.getDom())){var o=gK(a,n);this._ticket="";var s=a.dataByCoordSys,l=WMe(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=BMe;c.x=a.x,c.y=a.y,c.update(),it(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 h=bS(a,i),f=h.point[0],p=h.point[1];f!=null&&p!=null&&this._tryShow({offsetX:f,offsetY:p,target:h.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(gK(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(),h=ES([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.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=it(n);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,u;Dl(n,function(c){if(it(c).dataIndex!=null)return l=c,!0;if(it(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=ES([i.tooltipOption],a),l=this._renderMode,u=[],c=kr("section",{blocks:[],noHeader:!0}),h=[],f=new O1;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=FO(M,x.axis,n,y.seriesDataIndices,y.valueLabelOpt),w=kr("section",{header:S,noHeader:!Zi(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=Yx(x.axis,{value:M}),E.axisValueLabel=S,E.marker=f.makeTooltipMarker("item",Cl(E.color),l);var I=fP(C.formatTooltip(b,!0,null)),R=I.frag;if(R){var A=ES([C],a).get("valueFormatter");w.blocks.push(A?he({valueFormatter:A},R):R)}I.text&&h.push(I.text),u.push(E)}})}})}),c.blocks.reverse(),h.reverse();var p=i.position,d=s.get("order"),g=_P(c,f,l,d,n.get("useUTC"),s.get("textStyle"));g&&h.unshift(g);var m=l==="richText"?` `:"
",v=h.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,f)})},e.prototype._showSeriesItemTooltip=function(t,i,n){var a=this._ecModel,o=it(i),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,f=u.getData(h),p=this._renderMode,d=t.positionDefault,g=ES([f.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,h),_=new O1;v.marker=_.makeTooltipMarker("item",Cl(v.color),p);var y=fP(u.formatTooltip(c,!1,h)),x=g.get("order"),M=g.get("valueFormatter"),S=y.frag,w=S?_P(M?he({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:f.getRawIndex(c),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,i,n){var a=it(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 h=t.positionDefault,f=ES(u,this._tooltipModel,h?{position:h}:null),p=f.get("content"),d=Math.random()+"",g=new O1;this._showOrMove(f,function(){var m=Qe(f.get("formatterParams")||{});this._showTooltipContent(f,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 h=this._tooltipContent;h.setEnterable(t.get("enterable"));var f=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(f)if(Ce(f)){var m=t.ecModel.get("useUTC"),v=pe(n)?n[0]:n,_=v&&v.axisType&&v.axisType.indexOf("time")>=0;p=f,_&&(p=Kp(v.axisValue,p,m)),p=v1(p,n,!0)}else if(He(f)){var y=Be(function(x,M){x===this._ticket&&(h.setContent(M,c,t,g,l),this._updatePosition(t,l,o,s,h,n,u))},this);this._ticket=a,p=f(n,a,y)}else p=f;h.setContent(p,c,t,g,l),h.show(t,g),this._updatePosition(t,l,o,s,h,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 h=o.getSize(),f=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:h.slice()})),pe(i))n=ze(i[0],u),a=ze(i[1],c);else if(qe(i)){var g=i;g.width=h[0],g.height=h[1];var m=br(g,{width:u,height:c});n=m.x,a=m.y,f=null,p=null}else if(Ce(i)&&l){var v=HMe(i,d,h,t.get("borderWidth"));n=v[0],a=v[1]}else{var v=VMe(n,a,o,u,c,f?null:20,p?null:20);n=v[0],a=v[1]}if(f&&(n-=yK(f)?h[0]/2:f==="right"?h[0]:0),p&&(a-=yK(p)?h[1]/2:p==="bottom"?h[1]:0),KE(t)){var v=GMe(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]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&N(u,function(f,p){var d=h[p]||{},g=f.seriesDataIndices||[],m=d.seriesDataIndices||[];o=o&&f.value===d.value&&f.axisType===d.axisType&&f.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(f.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){Bt.node||!i.getDom()||(xc(this,"_updatePosition"),this._tooltipContent.dispose(),MS("itemTooltip",i))},e.type="tooltip",e}(ir);function ES(r,e,t){var i=e.ecModel,n;t?(n=new Jt(t,i,i),n=new Jt(e.option,n,i)):n=e;for(var a=r.length-1;a>=0;a--){var o=r[a];o&&(o instanceof Jt&&(o=o.get("tooltip",!0)),Ce(o)&&(o={formatter:o}),o&&(n=new Jt(o,n,i)))}return n}function gK(r,e){return r.dispatchAction||Be(e.dispatchAction,e)}function VMe(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 GMe(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 HMe(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 yK(r){return r==="center"||r==="middle"}function WMe(r,e,t){var i=H_(r).queryOptionMap,n=i.keys()[0];if(!(!n||n==="series")){var a=wh(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=it(u).tooltipConfig;if(c&&c.name===r.name)return l=u,!0}),l)return{componentMainType:n,componentIndex:o.componentIndex,el:l}}}}var _K=kMe;function p3(r){Ot(Gl),r.registerComponentModel(sK),r.registerComponentView(_K),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},zr),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},zr)}var XMe=["rect","polygon","keep","clear"];function d3(r,e){var t=tr(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),YMe(s),e&&!s.length&&s.push.apply(s,XMe)}}function YMe(r){var e={};N(r,function(t){e[t]=1}),r.length=0,N(e,function(t,i){r.push(i)})}var xK=N;function SK(r){if(r){for(var e in r)if(r.hasOwnProperty(e))return!0}}function AS(r,e,t){var i={};return xK(e,function(a){var o=i[a]=n();xK(r[a],function(s,l){if(gi.isValidType(l)){var u={type:l,visual:s};t&&t(u,a),o[l]=new gi(u),l==="opacity"&&(u=Qe(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new gi(u))}})}),i;function n(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function JE(r,e,t){var i;N(t,function(n){e.hasOwnProperty(n)&&SK(e[n])&&(i=!0)}),i&&N(t,function(n){e.hasOwnProperty(n)&&SK(e[n])?r[n]=Qe(e[n]):delete r[n]})}function MK(r,e,t,i,n,a){var o={};N(r,function(h){var f=gi.prepareVisualTypes(e[h]);o[h]=f});var s;function l(h){return Rx(t,s,h)}function u(h,f){EP(t,s,h,f)}a==null?t.each(c):t.each([a],c);function c(h,f){s=a==null?h:f;var p=t.getRawDataItem(s);if(!(p&&p.visualMap===!1))for(var d=i.call(n,h),g=e[d],m=o[d],v=0,_=m.length;v<_;v++){var y=m[v];g[y]&&g[y].applyVisual(h,l,u)}}}function bK(r,e,t,i){var n={};return N(r,function(a){var o=gi.prepareVisualTypes(e[a]);n[a]=o}),{progress:function(o,s){var l;i!=null&&(l=s.getDimensionIndex(i));function u(M){return Rx(s,h,M)}function c(M,S){EP(s,h,M,S)}for(var h,f=s.getStore();(h=o.next())!=null;){var p=s.getRawDataItem(h);if(!(p&&p.visualMap===!1))for(var d=i!=null?f.get(l,h):h,g=t(d),m=e[g],v=n[g],_=0,y=v.length;_e[0][1]&&(e[0][1]=a[0]),a[1]e[1][1]&&(e[1][1]=a[1])}return e&&RK(e)}};function RK(r){return new ft(r[0][0],r[1][0],r[0][1]-r[0][0],r[1][1]-r[1][0])}var JMe=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 Qv(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){g3(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}(ir),LK=JMe;var $Me="#ddd",QMe=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&&JE(n,t,["inBrush","outOfBrush"]);var a=n.inBrush=n.inBrush||{};n.outOfBrush=n.outOfBrush||{color:$Me},a.hasOwnProperty("liftZ")||(a.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=de(t,function(i){return DK(this.option,i)},this))},e.prototype.setBrushOption=function(t){this.brushOption=DK(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}(Nt);function DK(r,e){return bt({brushType:r.brushType,brushMode:r.brushMode,transformable:r.transformable,brushStyle:new Jt(r.brushStyle).getItemStyle(),removeOnClick:r.removeOnClick,z:r.z},e,!0)}var PK=QMe;var ebe=["rect","polygon","lineX","lineY","keep","clear"],tbe=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:ebe.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}(en),IK=tbe;function _3(r){r.registerComponentView(LK),r.registerComponentModel(PK),r.registerPreprocessor(d3),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,y3),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"},zr),r.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},zr),sf("brush",IK)}var rbe=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}(Nt),ibe=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=mt(t.get("textBaseline"),t.get("textVerticalAlign")),c=new It({style:pr(o,{text:t.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),f=t.get("subtext"),p=new It({style:pr(s,{text:f,fill:s.getTextColor(),y:h.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(){Jp(d,"_"+t.get("target"))}),g&&p.on("click",function(){Jp(g,"_"+t.get("subtarget"))}),it(c).eventData=it(p).eventData=m?{componentType:"title",componentIndex:t.componentIndex}:null,a.add(c),f&&a.add(p);var v=a.getBoundingRect(),_=t.getBoxLayoutParams();_.width=v.width,_.height=v.height;var y=br(_,{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 Rt({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}(ir);function x3(r){r.registerComponentModel(rbe),r.registerComponentView(ibe)}var nbe=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 h=Kr(Sl(u),""),f;qe(u)?(f=Qe(u),f.value=c):f=c,o.push(f),a.push(h)})):o=i;var s={category:"ordinal",time:"time",value:"number"}[n]||"number",l=this._data=new oi([{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}(Nt),S3=nbe;var NK=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=Qn(S3.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}(S3);Cr(NK,Mv.prototype);var UK=NK;var abe=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}(ir),OK=abe;var obe=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}(vn),zK=obe;var M3=Math.PI,FK=xt(),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.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 kr("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=ube(t,i),s;n==null||n==="auto"?s=a==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:M3/2},h=a==="vertical"?o.height:o.width,f=t.getModel("controlStyle"),p=f.get("show",!0),d=p?f.get("itemSize"):0,g=p?f.get("itemGap"):0,m=d+g,v=t.get(["label","rotate"])||0;v=v*M3/180;var _,y,x,M=f.get("position",!0),S=p&&f.get("showPlayBtn",!0),w=p&&f.get("showPrevBtn",!0),T=p&&f.get("showNextBtn",!0),C=0,b=h;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:h,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=Ci(),l=o.x,u=o.y+o.height;En(s,s,[-l,-u]),vo(s,s,-M3/2),En(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),h=_(n.getBoundingRect()),f=_(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,h,c,1,m),y(d,f,c,1,1-m)}else{var m=g>=0?0:1;y(p,h,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=lbe(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 zK("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 ei({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:he({lineCap:"round"},a.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});i.add(s);var l=this._progressLine=new ei({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),h=s.getItemModel(u.value),f=h.getModel("itemStyle"),p=h.getModel(["emphasis","itemStyle"]),d=h.getModel(["progress","itemStyle"]),g={x:c,y:0,onclick:Be(o._changeTimeline,o,u.value)},m=BK(h,f,i,g);m.ensureState("emphasis").style=p.getItemStyle(),m.ensureState("progress").style=d.getItemStyle(),yu(m);var v=it(m);h.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 h=c.tickValue,f=l.getItemModel(h),p=f.getModel("label"),d=f.getModel(["emphasis","label"]),g=f.getModel(["progress","label"]),m=n.dataToCoord(c.tickValue),v=new It({x:m,y:0,rotation:t.labelRotation-t.rotation,onclick:Be(o._changeTimeline,o,h),silent:!1,style:pr(p,{text:c.formattedLabel,align:t.labelAlign,verticalAlign:t.labelBaseline})});v.ensureState("emphasis").style=pr(d),v.ensureState("progress").style=pr(g),i.add(v),yu(v),FK(v).dataIndex=h,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(),h=a.get("inverse",!0);f(t.nextBtnPosition,"next",Be(this._changeTimeline,this,h?"-":"+")),f(t.prevBtnPosition,"prev",Be(this._changeTimeline,this,h?"+":"-")),f(t.playPosition,c?"stop":"play",Be(this._handlePlayClick,this,!c),!0);function f(p,d,g,m){if(p){var v=An(mt(a.get(["controlStyle",d+"BtnSize"]),o),o),_=[0,-v/2,v,v],y=cbe(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),yu(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(h){h.draggable=!0,h.drift=Be(u._handlePointerDrag,u),h.ondragend=Be(u._handlePointerDragend,u),kK(h,u._progressLine,s,n,a,!0)},onUpdate:function(h){kK(h,u._progressLine,s,n,a)}};this._currentPointer=BK(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=Ri(a.getExtent().slice());n>o[1]&&(n=o[1]),n=0&&(o[a]=+o[a].toFixed(f)),[o,h]}var T3={min:ut(tA,"min"),max:ut(tA,"max"),average:ut(tA,"average"),median:ut(tA,"median")};function uf(r,e){if(e){var t=r.getData(),i=r.coordinateSystem,n=i&&i.dimensions;if(!pbe(e)&&!pe(e.coord)&&pe(n)){var a=A3(e,t,i,r);if(e=Qe(e),e.type&&T3[e.type]&&a.baseAxis&&a.valueAxis){var o=yt(n,a.baseAxis.dim),s=yt(n,a.valueAxis.dim),l=T3[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++)T3[u[c]]&&(u[c]=iA(t,t.mapDimension(n[c]),u[c]));return e}}function A3(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(dbe(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 dbe(r,e){var t=r.getData().getDimensionInfo(e);return t&&t.coordDim}function cf(r,e){return r&&r.containData&&e.coord&&!E3(e)?r.containData(e.coord):!0}function YK(r,e,t){return r&&r.containZone&&e.coord&&t.coord&&!E3(e)&&!E3(t)?r.containZone(e.coord,t.coord):!0}function rA(r,e){return r?function(t,i,n,a){var o=a<2?t.coord&&t.coord[a]:t.value;return Gs(o,e[a])}:function(t,i,n,a){return Gs(t.value,e[a])}}function iA(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 R3=xt(),mbe=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){R3(s).keep=!1}),i.eachSeries(function(s){var l=Ta.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,i,n)}),o.each(function(s){!R3(s).keep&&a.group.remove(s.group)})},e.prototype.markKeep=function(t){R3(t).keep=!0},e.prototype.toggleBlurSeries=function(t,i){var n=this;N(t,function(a){var o=Ta.getMarkerModelFromSeries(a,n.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(i?Gw(l):Q_(l))})}})},e.type="marker",e}(ir),hg=mbe;function qK(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 vbe=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=Ta.getMarkerModelFromSeries(a,"markPoint");o&&(qK(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 Cu),h=gbe(o,t,i);i.setData(h),qK(i.getData(),t,a),h.each(function(f){var p=h.getItemModel(f),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(f),x=i.getDataParams(f);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=Mu(l,"color");M.fill||(M.fill=S),h.setItemVisual(f,{symbol:d,symbolSize:g,symbolRotate:m,symbolOffset:v,symbolKeepAspect:_,style:M})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(f){f.traverse(function(p){it(p).dataModel=i})}),this.markKeep(c),c.group.silent=i.get("silent")||t.get("silent")},e.type="markPoint",e}(hg);function gbe(r,e,t){var i;r?i=de(r&&r.dimensions,function(s){var l=e.getData().getDimensionInfo(e.getData().mapDimension(s))||{};return he(he({},l),{name:s,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var n=new oi(i,t),a=de(t.get("data"),ut(uf,e));r&&(a=Yt(a,ut(cf,r)));var o=rA(!!r,i);return n.initData(a,null,o),n}var ZK=vbe;function L3(r){r.registerComponentModel(XK),r.registerComponentView(ZK),r.registerPreprocessor(function(e){wd(e.series,"markPoint")&&(e.markPoint=e.markPoint||{})})}var ybe=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}(Ta),jK=ybe;var nA=xt(),_be=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=Hr(i.yAxis,i.xAxis);else{var u=A3(i,n,e,r);s=u.valueAxis;var c=sT(n,u.valueDataDim);l=iA(n,c,o)}var h=s.dim==="x"?0:1,f=1-h,p=Qe(i),d={coord:[]};p.type=null,p.coord=[],p.coord[f]=-1/0,d.coord[f]=1/0;var g=t.get("precision");g>=0&&Dt(l)&&(l=+l.toFixed(Math.min(g,20))),p.coord[h]=d.coord[h]=l,a=[p,d,{type:o,valueIndex:i.valueIndex,value:l}]}else a=[]}var m=[uf(r,a[0]),uf(r,a[1]),he({},a[2])];return m[2].type=m[2].type||null,bt(m[2],m[0]),bt(m[2],m[1]),m};function aA(r){return!isNaN(r)&&!isFinite(r)}function KK(r,e,t,i){var n=1-r,a=i.dimensions[r];return aA(e[n])&&aA(t[n])&&e[r]===t[r]&&i.getAxis(a).containData(e[r])}function xbe(r,e){if(r.type==="cartesian2d"){var t=e[0].coord,i=e[1].coord;if(t&&i&&(KK(1,t,i,r)||KK(0,t,i,r)))return!0}return cf(r,e[0])&&cf(r,e[1])}function D3(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,h=r.get(c[0],e),f=r.get(c[1],e);s=a.dataToPoint([h,f])}if(Ys(a,"cartesian2d")){var p=a.getAxis("x"),d=a.getAxis("y"),c=a.dimensions;aA(r.get(c[0],e))?s[0]=p.toGlobalCoord(p.getExtent()[t?0:1]):aA(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=Ta.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=nA(o).from,u=nA(o).to;l.each(function(c){D3(l,c,!0,a,n),D3(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 Zv);this.group.add(c.group);var h=Mbe(o,t,i),f=h.from,p=h.to,d=h.line;nA(i).from=f,nA(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(_)||(_=[_,_]),h.from.each(function(x){y(f,x,!0),y(p,x,!1)}),d.each(function(x){var M=d.getItemModel(x).getModel("lineStyle").getLineStyle();d.setItemLayout(x,[f.getItemLayout(x),p.getItemLayout(x)]),M.stroke==null&&(M.stroke=f.getItemVisual(x,"style").fill),d.setItemVisual(x,{fromSymbolKeepAspect:f.getItemVisual(x,"symbolKeepAspect"),fromSymbolOffset:f.getItemVisual(x,"symbolOffset"),fromSymbolRotate:f.getItemVisual(x,"symbolRotate"),fromSymbolSize:f.getItemVisual(x,"symbolSize"),fromSymbol:f.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),h.line.eachItemGraphicEl(function(x){it(x).dataModel=i,x.traverse(function(M){it(M).dataModel=i})});function y(x,M,S){var w=x.getItemModel(M);D3(x,M,S,t,a);var T=w.getModel("itemStyle").getItemStyle();T.fill==null&&(T.fill=Mu(l,"color")),x.setItemVisual(M,{symbolKeepAspect:w.get("symbolKeepAspect"),symbolOffset:mt(w.get("symbolOffset",!0),_[S?0:1]),symbolRotate:mt(w.get("symbolRotate",!0),v[S?0:1]),symbolSize:mt(w.get("symbolSize"),m[S?0:1]),symbol:mt(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}(hg);function Mbe(r,e,t){var i;r?i=de(r&&r.dimensions,function(u){var c=e.getData().getDimensionInfo(e.getData().mapDimension(u))||{};return he(he({},c),{name:u,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var n=new oi(i,t),a=new oi(i,t),o=new oi([],t),s=de(t.get("data"),ut(_be,e,r,t));r&&(s=Yt(s,ut(xbe,r)));var l=rA(!!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 JK=Sbe;function P3(r){r.registerComponentModel(jK),r.registerComponentView(JK),r.registerPreprocessor(function(e){wd(e.series,"markLine")&&(e.markLine=e.markLine||{})})}var bbe=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}(Ta),$K=bbe;var oA=xt(),wbe=function(r,e,t,i){var n=i[0],a=i[1];if(!(!n||!a)){var o=uf(r,n),s=uf(r,a),l=o.coord,u=s.coord;l[0]=Hr(l[0],-1/0),l[1]=Hr(l[1],-1/0),u[0]=Hr(u[0],1/0),u[1]=Hr(u[1],1/0);var c=Dm([{},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 sA(r){return!isNaN(r)&&!isFinite(r)}function QK(r,e,t,i){var n=1-r;return sA(e[n])&&sA(t[n])}function Tbe(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 Ys(r,"cartesian2d")?t&&i&&(QK(1,t,i,r)||QK(0,t,i,r))?!0:YK(r,n,a):cf(r,n)||cf(r,a)}function eJ(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),h=r.getValues(["x1","y1"],e),f=a.clampData(c),p=a.clampData(h),d=[];t[0]==="x0"?d[0]=f[0]>p[0]?h[0]:c[0]:d[0]=f[0]>p[0]?c[0]:h[0],t[1]==="y0"?d[1]=f[1]>p[1]?h[1]:c[1]:d[1]=f[1]>p[1]?c[1]:h[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(Ys(a,"cartesian2d")){var _=a.getAxis("x"),y=a.getAxis("y"),g=r.get(t[0],e),m=r.get(t[1],e);sA(g)?s[0]=_.toGlobalCoord(_.getExtent()[t[0]==="x0"?0:1]):sA(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 tJ=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],Ebe=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=Ta.getMarkerModelFromSeries(a,"markArea");if(o){var s=o.getData();s.each(function(l){var u=de(tJ,function(h){return eJ(s,l,h,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 h=Abe(o,t,i);i.setData(h),h.each(function(f){var p=de(tJ,function(T){return eJ(h,f,T,t,a)}),d=o.getAxis("x").scale,g=o.getAxis("y").scale,m=d.getExtent(),v=g.getExtent(),_=[d.parse(h.get("x0",f)),d.parse(h.get("x1",f))],y=[g.parse(h.get("y0",f)),g.parse(h.get("y1",f))];Ri(_),Ri(y);var x=!(m[0]>_[1]||m[1]<_[0]||v[0]>y[1]||v[1]=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}(Nt),RS=Rbe;var fg=ut,N3=N,lA=Ze,Lbe=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 lA),this.group.add(this._selectorGroup=new lA),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(),h={width:n.getWidth(),height:n.getHeight()},f=t.get("padding"),p=br(c,h,f),d=this.layoutInner(t,o,p,a,l,u),g=br(Ye({width:d.width,height:d.height},c),h,f);this.group.x=g.x-d.x,this.group.y=g.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=qE(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(),h=i.get("selectedMode"),f=[];n.eachRawSeries(function(p){!p.get("legendHoverLink")&&f.push(p.id)}),N3(i.getData(),function(p,d){var g=p.get("name");if(!this.newlineDisabled&&(g===""||g===` `)){var m=new lA;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,h,a);S.on("click",fg(iJ,g,null,a,f)).on("mouseover",fg(U3,v.name,null,a,f)).on("mouseout",fg(O3,v.name,null,a,f)),n.ssr&&S.eachChild(function(w){var T=it(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=pn(b.fill);I&&I[3]===0&&(I[3]=.2,b=he(he({},b),{fill:Ns(I,"rgba")}));var R=this._createItem(w,g,d,p,i,t,{},b,E,h,a);R.on("click",fg(iJ,null,g,a,f)).on("mouseover",fg(U3,null,g,a,f)).on("mouseout",fg(O3,null,g,a,f)),n.ssr&&R.eachChild(function(A){var P=it(A);P.seriesIndex=w.seriesIndex,P.dataIndex=d,P.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();N3(t,function(u){var c=u.type,h=new It({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect"})}});s.add(h);var f=i.getModel("selectorLabel"),p=i.getModel(["emphasis","selectorLabel"]);Fr(h,{normal:f,emphasis:p},{defaultText:u.title}),yu(h)})},e.prototype._createItem=function(t,i,n,a,o,s,l,u,c,h,f){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=Dbe(c,a,l,u,p,m,f),M=new lA,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(Pbe({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 It({style:pr(S,{text:E,x:T,y:g/2,fill:I,align:C,verticalAlign:"middle"},{inheritColor:I})}));var R=new Rt({shape:M.getBoundingRect(),style:{fill:"transparent"}}),A=a.getModel("tooltip");return A.get("show")&&El({el:R,componentModel:o,itemName:i,itemTooltipOption:A.option}),M.add(R),M.eachChild(function(P){P.silent=!0}),R.silent=!h,this.getContentGroup().add(M),yu(M),M.__legendDataIndex=n,M},e.prototype.layoutInner=function(t,i,n,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Rl(t.get("orient"),l,t.get("itemGap"),n.width,n.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Rl("horizontal",u,t.get("selectorItemGap",!0));var f=u.getBoundingRect(),p=[-f.x,-f.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:h[g]+=f[m]+d,p[1-g]+=c[v]/2-f[v]/2,u.x=p[0],u.y=p[1],l.x=h[0],l.y=h[1];var y={x:0,y:0};return y[m]=c[m]+d+f[m],y[v]=Math.max(c[v],f[v]),y[_]=Math.min(0,f[_]+p[1-g]),y}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(ir);function Dbe(r,e,t,i,n,a,o){function s(m,v){m.lineWidth==="auto"&&(m.lineWidth=v.lineWidth>0?2:0),N3(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",h=l.getShallow("decal");u.decal=!h||h==="inherit"?i.decal:Il(h,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 f=e.getModel("lineStyle"),p=f.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=f.get("inactiveColor"),p.lineWidth=f.get("inactiveWidth")}return{itemStyle:u,lineStyle:p}}function Pbe(r){var e=r.icon||"roundRect",t=wr(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 iJ(r,e,t,i){O3(r,e,t,i),t.dispatchAction({type:"legendToggleSelect",name:r??e}),U3(r,e,t,i)}function nJ(r){for(var e=r.getZr().storage.getDisplayList(),t,i=0,n=e.length;in[o],m=[-p.x,-p.y];i||(m[a]=c[u]);var v=[0,0],_=[-d.x,-d.y],y=mt(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),h.setPosition(v),f.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]),h.__rectSize=n[o],g){var S={x:0,y:0};S[o]=Math.max(n[o]-d[o]-y,0),S[s]=M[s],h.setClipPath(new Rt({shape:S})),h.__rectSize=S[o]}else f.eachChild(function(T){T.attr({invisible:!0,silent:!0})});var w=this._getPageInfo(t);return w.pageIndex!=null&&Ut(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 h=c+"DataIndex",f=i[h]!=null,p=n.childOfName(c);p&&(p.setStyle("fill",f?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),p.cursor=f?"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=F3[o],l=B3[o],u=this._findTargetItemIndex(i),c=n.children(),h=c[u],f=c.length,p=f?1:0,d={contentPosition:[n.x,n.y],pageCount:p,pageIndex:p-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return d;var g=x(h);d.contentPosition[o]=-g.s;for(var m=u+1,v=g,_=g,y=null;m<=f;++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}(uA),uJ=Nbe;function k3(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 cJ(r){Ot(cA),r.registerComponentModel(sJ),r.registerComponentView(uJ),k3(r)}function V3(r){Ot(cA),Ot(cJ)}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.type="dataZoom.inside",e.defaultOption=Qn(of.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}(of),hJ=Ube;var G3=xt();function fJ(r,e,t){G3(r).coordSysRecordMap.each(function(i){var n=i.dataZoomInfoMap.get(e.uid);n&&(n.getRange=t)})}function pJ(r,e){for(var t=G3(r).coordSysRecordMap,i=t.keys(),n=0;ni[t+e]&&(e=s),n=n&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!n}}}function mJ(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var i=G3(t),n=i.coordSysRecordMap||(i.coordSysRecordMap=ke());n.each(function(a){a.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=XE(a);N(o.infoList,function(s){var l=s.model.uid,u=n.get(l)||n.set(l,Obe(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){dJ(n,a);return}var c=Bbe(l);o.enable(c.controlType,c.opt),o.setPointerChecker(a.containsPoint),Hs(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var Vbe=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(),fJ(n,t,{pan:Be(H3.pan,this),zoom:Be(H3.zoom,this),scrollMove:Be(H3.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){pJ(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(lg),H3={zoom:function(r,e,t,i){var n=this.range,a=n.slice(),o=r.axisModels[0];if(o){var s=W3[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(Io(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,n[0]!==a[0]||n[1]!==a[1])return a}},pan:vJ(function(r,e,t,i,n,a){var o=W3[i]([a.oldX,a.oldY],[a.newX,a.newY],e,n,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:vJ(function(r,e,t,i,n,a){var o=W3[i]([0,0],[a.scrollDelta,a.scrollDelta],e,n,t);return o.signal*(r[1]-r[0])*a.scrollDelta})};function vJ(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(Io(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var W3={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}},gJ=Vbe;function DS(r){Md(r),r.registerComponentModel(hJ),r.registerComponentView(gJ),mJ(r)}var Gbe=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=Qn(of.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}(of),yJ=Gbe;var PS=Rt,_J=7,Hbe=1,X3=30,Wbe=7,IS="horizontal",xJ="vertical",Xbe=5,Ybe=["line","bar","candlestick","scatter"],qbe={easing:"cubicOut",duration:100,delay:0},Zbe=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),Hs(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(){xc(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?Wbe:0,o=this._findCoordRect(),s={width:i.getWidth(),height:i.getHeight()},l=this._orient===IS?{right:s.width-o.x-o.width,top:s.height-X3-_J-a,width:o.width,height:X3}:{right:_J,top:o.y,width:X3,height:o.height},u=ks(t.option);N(["right","top","width","height"],function(h){u[h]==="ph"&&(u[h]=l[h])});var c=br(u,s);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===xJ&&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===IS&&!o?{scaleY:l?1:-1,scaleX:1}:n===IS&&o?{scaleY:l?1:-1,scaleX:-1}:n===xJ&&!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 PS({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new PS({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 h=o.getDataExtent(l),f=(h[1]-h[0])*.3;h=[h[0]-f,h[1]+f];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:ar(C,h,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 ai({shape:{points:u},segmentIgnoreThreshold:1,style:b.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),R=new ri({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&&yt(Ybe,u.get("type"))<0)){var c=a.getComponent($s(o),s).axis,h=jbe(o),f,p=u.coordinateSystem;h!=null&&p.getOtherAxis&&(f=p.getOtherAxis(c).inverse),h=u.getData().mapDimension(h),n={thisAxis:c,series:u,thisDim:o,otherDim:h,otherAxisInverse:f}}},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,h=l.get("brushSelect"),f=i.filler=new PS({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(f),o.add(new PS({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:Hbe,fill:"rgba(0,0,0,0)"}})),N([0,1],function(y){var x=l.get("handleIcon");!Lx[x]&&x.indexOf("path://")<0&&x.indexOf("image://")<0&&(x="path://"+x);var M=wr(x,-1,0,2,2,null,!0);M.attr({cursor:SJ(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(),yu(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 It({silent:!0,invisible:!0,style:pr(C,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:C.getTextColor(),font:C.getFont()}),z2:10}))},this);var p=f;if(h){var d=ze(l.get("moveHandleSize"),s[1]),g=i.moveHandle=new Rt({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=wr(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 Rt({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:SJ(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=[ar(t[0],[0,100],i,!0),ar(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];Io(i,a,o,n.get("zoomLock")?"all":t,s.minSpan!=null?ar(s.minSpan,l,o,!0):null,s.maxSpan!=null?ar(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Ri([ar(a[0],o,l,!0),ar(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=Ri(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;ci[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 zt(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=Ri([ar(n.x,o,s,!0),ar(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&&(po(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 PS({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),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:h[1]})},e.prototype._dispatchZoomAction=function(t){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?qbe:null,start:i[0],end:i[1]})},e.prototype._findCoordRect=function(){var t,i=XE(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}(lg);function jbe(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function SJ(r){return r==="vertical"?"ns-resize":"ew-resize"}var MJ=Zbe;function NS(r){r.registerComponentModel(yJ),r.registerComponentView(MJ),Md(r)}function Y3(r){Ot(DS),Ot(NS)}var Kbe={get:function(r,e,t){var i=Qe((Jbe[r]||{})[e]);return t&&pe(i)?i[i.length-1]:i}},Jbe={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]}},hA=Kbe;var bJ=gi.mapVisual,$be=gi.eachVisual,Qbe=pe,wJ=N,ewe=Ri,twe=ar,rwe=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&&JE(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=AS(this.option.controller,i,t),this.targetVisuals=AS(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=tr(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?[h(t[0]),h(t[1])]:h(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 h(f){return f===s[0]?"min":f===s[1]?"max":(+f).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,i=ewe([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={});bt(a,n),bt(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(h){Qbe(i.color)&&!h.inRange&&(h.inRange={color:i.color.slice().reverse()}),h.inRange=h.inRange||{color:t.get("gradientColor")}}function u(h,f,p){var d=h[f],g=h[p];d&&!g&&(g=h[p]={},wJ(d,function(m,v){if(gi.isValidType(v)){var _=hA.get(v,"inactive",s);_!=null&&(g[v]=_,v==="color"&&!g.hasOwnProperty("opacity")&&!g.hasOwnProperty("colorAlpha")&&(g.opacity=[0,0]))}}))}function c(h){var f=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,p=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,d=this.get("inactiveColor"),g=this.getItemSymbol(),m=g||"roundRect";wJ(this.stateList,function(v){var _=this.itemSize,y=h[v];y||(y=h[v]={color:s?d:[d]}),y.symbol==null&&(y.symbol=f&&Qe(f)||(s?m:[m])),y.symbolSize==null&&(y.symbolSize=p&&Qe(p)||(s?_[0]:[_[0],_[0]])),y.symbol=bJ(y.symbol,function(S){return S==="none"?m:S});var x=y.symbolSize;if(x!=null){var M=-1/0;$be(x,function(S){S>M&&(M=S)}),y.symbolSize=bJ(x,function(S){return twe(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}(Nt),pg=rwe;var TJ=[20,140],iwe=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]=TJ[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=TJ[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=Ri((this.get("range")||[]).slice());return i[0]>t[1]&&(i[0]=t[1]),i[1]>t[1]&&(i[1]=t[1]),i[0]=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=EJ(this,"outOfRange",this.getExtent()),n=EJ(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;lt[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();awe([0,1],function(c){var h=o[c];h.setStyle("fill",i.handlesColor[c]),h.y=t[c];var f=Uu(t[c],[0,l[1]],u,!0),p=this.getControllerVisual(f,"symbolSize");h.scaleX=h.scaleY=p/l[0],h.x=l[0]-p/2;var d=Dn(n.handleLabelPoints[c],Tl(h,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,h=c.indicator;if(h){h.attr("invisible",!1);var f={convertOpacityToAlpha:!0},p=this.getControllerVisual(t,"color",f),d=this.getControllerVisual(t,"symbolSize"),g=Uu(t,s,u,!0),m=l[0]-d/2,v={x:h.x,y:h.y};h.y=g,h.x=m;var _=Dn(c.indicatorLabelPoint,Tl(h,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};h.x=v.x,h.y=v.y,h.animateTo(w,C),y.animateTo(T,C)}else h.attr(w),y.attr(T);this._firstShowIndicator=!1;var b=this._shapes.handleLabels;if(b)for(var E=0;Eo[1]&&(h[1]=1/0),i&&(h[0]===-1/0?this._showIndicator(c,h[1],"< ",l):h[1]===1/0?this._showIndicator(c,h[0],"> ",l):this._showIndicator(c,c,"\u2248 ",l));var f=this._hoverLinkDataIndices,p=[];(i||PJ(n))&&(p=this._hoverLinkDataIndices=n.findTargetDataIndices(h));var d=SH(f,p);this._dispatchHighDown("downplay",dg(d[0],n)),this._dispatchHighDown("highlight",dg(d[1],n))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var i;if(Dl(t.target,function(l){var u=it(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=0&&(a.dimension=o,i.push(a))}}),r.getData().setVisual("visualMeta",i)}}];function cwe(r,e,t,i){for(var n=e.targetVisuals[i],a=gi.prepareVisualTypes(n),o={color:Mu(r.getData(),"color")},s=0,l=a.length;s0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(UJ,OJ),N(zJ,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor(Z3))}function OS(r){r.registerComponentModel(AJ),r.registerComponentView(NJ),US(r)}var hwe=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=[],fwe[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=gi.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]=hA.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=gi.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=gi.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,h){var f=a.getRepresentValue({interval:c});h||(h=a.getValueState(f));var p=t(f,h);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 h=c.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:i,outerColors:n}},e.type="visualMap.piecewise",e.defaultOption=Qn(pg.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}(pg),fwe={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","\u2265"][i[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,n)},this)}};function kJ(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var VJ=hwe;var pwe=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(),h=c.endsText,f=Hr(i.get("showLabel",!0),!h);h&&this._renderEndsText(t,h[0],u,f,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]]),f){var v=this.visualMapModel.getValueState(m);g.add(new It({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),h&&this._renderEndsText(t,h[1],u,f,l),Rl(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:dg(s.findTargetDataIndices(i),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,i=t.option;if(i.orient==="vertical")return pA(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 It({style:pr(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(wr(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}(fA),GJ=pwe;function zS(r){r.registerComponentModel(VJ),r.registerComponentView(GJ),US(r)}function j3(r){Ot(OS),Ot(zS)}var dwe={label:{enabled:!0},decal:{show:!1}},HJ=xt(),mwe={};function K3(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var i=Qe(dwe);bt(i.label,r.getLocaleModel().get("aria"),!1),bt(t.option,i,!1),n(),a();function n(){var u=t.getModel("decal"),c=u.get("show");if(c){var h=ke();r.eachSeries(function(f){if(!f.isColorBySeries()){var p=h.get(f.type);p||(p={},h.set(f.type,p)),HJ(f).scope=p}}),r.eachRawSeries(function(f){if(r.isSeriesFiltered(f))return;if(He(f.enableAriaDecal)){f.enableAriaDecal();return}var p=f.getData();if(f.isColorBySeries()){var _=vx(f.ecModel,f.name,mwe,r.getSeriesCount()),y=p.getVisual("decal");p.setVisual("decal",x(y,_))}else{var d=f.getRawData(),g={},m=HJ(f).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=vx(f.ecModel,w,m,v),C=p.getItemVisual(S,"decal");p.setItemVisual(S,"decal",x(C,T))})}function x(M,S){var w=M?he(he({},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 h=e.getZr().dom;if(c.get("description")){h.setAttribute("aria-label",c.get("description"));return}var f=r.getSeriesCount(),p=c.get(["data","maxCount"])||10,d=c.get(["series","maxCount"])||10,g=Math.min(f,d),m;if(!(f<1)){var v=s();if(v){var _=c.get(["general","withTitle"]);m=o(_,{title:v})}else m=c.get(["general","withoutTitle"]);var y=[],x=f>1?c.get(["series","multiple","prefix"]):c.get(["series","single","prefix"]);m+=o(x,{seriesCount:f}),r.eachSeries(function(T,C){if(C1?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 P=c.get(["data","separator","middle"]),U=c.get(["data","separator","end"]),B=[],z=0;z":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},vwe=function(){function r(e){var t=this._condVal=Ce(e)?new RegExp(e):KV(e)?e:null;if(t==null){var i="";hr(i)}}return r.prototype.evaluate=function(e){var t=typeof e;return Ce(t)?this._condVal.test(e):Dt(t)?this._condVal.test(e+""):!1},r}(),gwe=function(){function r(){}return r.prototype.evaluate=function(){return this.value},r}(),ywe=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t2&&i.push(n),n=[R,A]}function c(R,A,P,U){vg(R,P)&&vg(A,U)||n.push(R,A,P,U,P,U)}function h(R,A,P,U,B,z){var k=Math.abs(A-R),G=Math.tan(k/4)*4/3,Y=AT:E2&&i.push(n),i}function rz(r,e,t,i,n,a,o,s,l,u){if(vg(r,t)&&vg(e,i)&&vg(n,o)&&vg(a,s)){l.push(o,s);return}var c=2/u,h=c*c,f=o-r,p=s-e,d=Math.sqrt(f*f+p*p);f/=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=0&&T=0){l.push(o,s);return}var C=[],b=[];Ps(r,t,n,o,.5,C),Ps(e,i,a,s,.5,b),rz(C[0],b[0],C[1],b[1],C[2],b[2],C[3],b[3],l,u),rz(C[4],b[4],C[5],b[5],C[6],b[6],C[7],b[7],l,u)}function KJ(r,e){var t=dA(r),i=[];e=e||1;for(var n=0;n0)for(var u=0;uMath.abs(u),h=e$([l,u],c?0:1,e),f=(c?s:u)/h.length,p=0;pn,o=e$([i,n],a?0:1,e),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",c=a?"y":"x",h=r[s]/o.length,f=0;f1?null:new zt(g*l+r,g*u+e)}function Rwe(r,e,t){var i=new zt;zt.sub(i,t,e),i.normalize();var n=new zt;zt.sub(n,r,e);var a=n.dot(i);return a}function gg(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function Lwe(r,e,t){for(var i=r.length,n=[],a=0;ao?(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),Lwe(e,u,c)}function mA(r,e,t,i){if(t===1)i.push(e);else{var n=Math.floor(t/2),a=r(e);mA(r,a[0],n,i),mA(r,a[1],t-n,i)}return i}function Dwe(r,e){for(var t=[],i=0;i0)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;y0;u/=2){var c=0,h=0;(r&u)>0&&(c=1),(e&u)>0&&(h=1),s+=u*u*(3*c^h),h===0&&(c===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function gA(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),h=l.y+l.height/2+(u?u[5]:0);return e=Math.min(c,e),t=Math.min(h,t),i=Math.max(c,i),n=Math.max(h,n),[c,h]}),o=de(a,function(s,l){return{cp:s,z:Bwe(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 s$(r){return t$(r.path,r.count)}function iz(){return{fromIndividuals:[],toIndividuals:[],count:0}}function l$(r,e,t){var i=[];function n(M){for(var S=0;S=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 kwe={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),i=0;i0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;c$(r)&&(u=r,c=e),c$(e)&&(u=e,c=r);function h(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(BS(T))h({many:[T],one:C},!0,y,x,!0);else{var b=s?Ye({delay:s(y,x)},l):l;yA(T,C,b),a(T,C,T,C,b)}}else for(var E=Ye({dividePath:kwe[t],individualDelay:s&&function(B,z,k,G){return s(B+y,x)}},l),I=_?l$(S,w,E):u$(w,S,E),R=I.fromIndividuals,A=I.toIndividuals,P=R.length,U=0;Ue.length,p=u?h$(c,u):h$(f?e:r,[f?r:e]),d=0,g=0;g_$))for(var a=i.getIndices(),o=0;o0&&S.group.traverse(function(T){T instanceof pt&&!T.animators.length&&T.animateFrom({style:{opacity:0}},w)})})}function v$(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function g$(r){return pe(r)?r.sort().join(","):r}function ff(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function qwe(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=v$(o),h=g$(c);i.set(h,{dataGroupId:l,data:u}),pe(c)&&N(c,function(f){n.set(f,{key:h,dataGroupId:l,data:u})})});function a(o){t.get(o)&&pH("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=v$(o),c=g$(u),h=i.get(c);if(h)t.set(c,{oldSeries:[{dataGroupId:h.dataGroupId,divide:ff(h.data),data:h.data}],newSeries:[{dataGroupId:s,divide:ff(l),data:l}]});else if(pe(u)){var f=[];N(u,function(g){var m=i.get(g);m.data&&f.push({dataGroupId:m.dataGroupId,divide:ff(m.data),data:m.data})}),f.length&&t.set(c,{oldSeries:f,newSeries:[{dataGroupId:s,data:l,divide:ff(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:ff(p.data)}],newSeries:[]},t.set(p.key,d)),d.newSeries.push({dataGroupId:s,data:l,divide:ff(l)})}}}}),t}function y$(r,e){for(var t=0;t=0&&n.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:ff(e.oldData[s]),groupIdDim:o.dimension})}),N(tr(r.to),function(o){var s=y$(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:ff(l),groupIdDim:o.dimension})}}),n.length>0&&a.length>0&&x$(n,a,i)}function oz(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){N(tr(i.seriesTransition),function(n){N(tr(n.to),function(a){for(var o=i.updatedSeries,s=0;s({$implicit:r,index:e});function f1e(r,e){if(r&1&&(au(0),gr(1,h1e,0,0,"ng-template",9),ou()),r&2){let t=e.$implicit,i=e.index,n=Dr(2);at(),rt("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",ZL(2,E$,t,i))}}function p1e(r,e){if(r&1&&(ht(0,"div",7),gr(1,f1e,2,5,"ng-container",8),ni(2,4),ot()),r&2){let t=Dr();at(),rt("ngForOf",t.nzDataSource)}}function d1e(r,e){if(r&1&&(au(0),jt(1),ou()),r&2){let t=Dr(2);at(),bn(t.nzHeader)}}function m1e(r,e){if(r&1&&(ht(0,"nz-list-header"),gr(1,d1e,2,1,"ng-container",10),ot()),r&2){let t=Dr();at(),rt("nzStringTemplateOutlet",t.nzHeader)}}function v1e(r,e){r&1&&er(0,"div"),r&2&&TV("min-height",53,"px")}function g1e(r,e){}function y1e(r,e){if(r&1&&(ht(0,"div",13),gr(1,g1e,0,0,"ng-template",9),ot()),r&2){let t=e.$implicit,i=e.index,n=Dr(2);rt("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),at(),rt("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",ZL(9,E$,t,i))}}function _1e(r,e){if(r&1&&(ht(0,"div",11),gr(1,y1e,2,12,"div",12),ot()),r&2){let t=Dr();rt("nzGutter",t.nzGrid.gutter||null),at(),rt("ngForOf",t.nzDataSource)}}function x1e(r,e){if(r&1&&er(0,"nz-list-empty",14),r&2){let t=Dr();rt("nzNoResult",t.nzNoResult)}}function S1e(r,e){if(r&1&&(au(0),jt(1),ou()),r&2){let t=Dr(2);at(),bn(t.nzFooter)}}function M1e(r,e){if(r&1&&(ht(0,"nz-list-footer"),gr(1,S1e,2,1,"ng-container",10),ot()),r&2){let t=Dr();at(),rt("nzStringTemplateOutlet",t.nzFooter)}}function b1e(r,e){}function w1e(r,e){}function T1e(r,e){if(r&1&&(ht(0,"nz-list-pagination"),gr(1,w1e,0,0,"ng-template",6),ot()),r&2){let t=Dr();at(),rt("ngTemplateOutlet",t.nzPagination)}}var E1e=[[["nz-list-header"]],[["nz-list-footer"],["","nz-list-footer",""]],[["nz-list-load-more"],["","nz-list-load-more",""]],[["nz-list-pagination"],["","nz-list-pagination",""]],"*"],A1e=["nz-list-header","nz-list-footer, [nz-list-footer]","nz-list-load-more, [nz-list-load-more]","nz-list-pagination, [nz-list-pagination]","*"];function C1e(r,e){if(r&1&&er(0,"ul",6),r&2){let t=Dr(2);rt("nzActions",t.nzActions)}}function R1e(r,e){if(r&1&&(gr(0,C1e,1,1,"ul",5),ni(1)),r&2){let t=Dr();rt("ngIf",t.nzActions&&t.nzActions.length>0)}}function L1e(r,e){if(r&1&&(au(0),jt(1),ou()),r&2){let t=Dr(3);at(),bn(t.nzContent)}}function D1e(r,e){if(r&1&&(au(0),gr(1,L1e,2,1,"ng-container",8),ou()),r&2){let t=Dr(2);at(),rt("nzStringTemplateOutlet",t.nzContent)}}function P1e(r,e){if(r&1&&(ni(0,1),ni(1,2),gr(2,D1e,2,1,"ng-container",7)),r&2){let t=Dr();at(2),rt("ngIf",t.nzContent)}}function I1e(r,e){r&1&&ni(0,3)}function N1e(r,e){}function U1e(r,e){}function O1e(r,e){}function z1e(r,e){}function F1e(r,e){if(r&1&&gr(0,N1e,0,0,"ng-template",9)(1,U1e,0,0,"ng-template",9)(2,O1e,0,0,"ng-template",9)(3,z1e,0,0,"ng-template",9),r&2){let t=Dr(),i=su(3),n=su(5),a=su(1);rt("ngTemplateOutlet",i),at(),rt("ngTemplateOutlet",t.nzExtra),at(),rt("ngTemplateOutlet",n),at(),rt("ngTemplateOutlet",a)}}function B1e(r,e){}function k1e(r,e){}function V1e(r,e){}function G1e(r,e){if(r&1&&(ht(0,"nz-list-item-extra"),gr(1,V1e,0,0,"ng-template",9),ot()),r&2){let t=Dr(2);at(),rt("ngTemplateOutlet",t.nzExtra)}}function H1e(r,e){}function W1e(r,e){if(r&1&&(au(0),ht(1,"div",10),gr(2,B1e,0,0,"ng-template",9)(3,k1e,0,0,"ng-template",9),ot(),gr(4,G1e,2,1,"nz-list-item-extra",7)(5,H1e,0,0,"ng-template",9),ou()),r&2){let t=Dr(),i=su(3),n=su(1),a=su(5);at(2),rt("ngTemplateOutlet",i),at(),rt("ngTemplateOutlet",n),at(),rt("ngIf",t.nzExtra),at(),rt("ngTemplateOutlet",a)}}var X1e=[[["nz-list-item-actions"],["","nz-list-item-actions",""]],[["nz-list-item-meta"],["","nz-list-item-meta",""]],"*",[["nz-list-item-extra"],["","nz-list-item-extra",""]]],Y1e=["nz-list-item-actions, [nz-list-item-actions]","nz-list-item-meta, [nz-list-item-meta]","*","nz-list-item-extra, [nz-list-item-extra]"],S$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-item-meta-title"]],exportAs:["nzListItemMetaTitle"],standalone:!0,features:[Ar],ngContentSelectors:df,decls:2,vars:0,consts:[[1,"ant-list-item-meta-title"]],template:function(n,a){n&1&&(Sn(),ht(0,"h4",0),ni(1),ot())},encapsulation:2,changeDetection:0});let r=e;return r})(),M$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-item-meta-description"]],exportAs:["nzListItemMetaDescription"],standalone:!0,features:[Ar],ngContentSelectors:df,decls:2,vars:0,consts:[[1,"ant-list-item-meta-description"]],template:function(n,a){n&1&&(Sn(),ht(0,"div",0),ni(1),ot())},encapsulation:2,changeDetection:0});let r=e;return r})(),A$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-item-meta-avatar"]],inputs:{nzSrc:"nzSrc"},exportAs:["nzListItemMetaAvatar"],standalone:!0,features:[Ar],ngContentSelectors:df,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&&(Sn(),ht(0,"div",0),gr(1,jwe,1,1,"nz-avatar",1)(2,Kwe,1,0,"ng-content",2),ot()),n&2&&(at(),rt("ngIf",a.nzSrc),at(),rt("ngIf",!a.nzSrc))},dependencies:[qn,BV,As],encapsulation:2,changeDetection:0});let r=e;return r})(),q1e=(()=>{let e=class e{set nzAvatar(i){i instanceof YL?(this.avatarStr="",this.avatarTpl=i):this.avatarStr=i}constructor(i){this.elementRef=i,this.avatarStr=""}};e.\u0275fac=function(n){return new(n||e)(ma(p_))},e.\u0275cmp=Er({type:e,selectors:[["nz-list-item-meta"],["","nz-list-item-meta",""]],contentQueries:function(n,a,o){if(n&1&&(Qu(o,M$,5),Qu(o,S$,5)),n&2){let s;fi(s=pi())&&(a.descriptionComponent=s.first),fi(s=pi())&&(a.titleComponent=s.first)}},hostAttrs:[1,"ant-list-item-meta"],inputs:{nzAvatar:"nzAvatar",nzTitle:"nzTitle",nzDescription:"nzDescription"},exportAs:["nzListItemMeta"],standalone:!0,features:[Ar],ngContentSelectors:a1e,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&&(Sn(n1e),gr(0,Jwe,1,1,"nz-list-item-meta-avatar",0)(1,$we,2,1,"nz-list-item-meta-avatar",1),ni(2),gr(3,i1e,5,2,"div",2)),n&2&&(rt("ngIf",a.avatarStr),at(),rt("ngIf",a.avatarTpl),at(2),rt("ngIf",a.nzTitle||a.nzDescription||a.descriptionComponent||a.titleComponent))},dependencies:[A$,As,m_,S$,Ob,Ub,M$],encapsulation:2,changeDetection:0});let r=e;return r})(),b$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-item-extra"],["","nz-list-item-extra",""]],hostAttrs:[1,"ant-list-item-extra"],exportAs:["nzListItemExtra"],standalone:!0,features:[Ar],ngContentSelectors:df,decls:1,vars:0,template:function(n,a){n&1&&(Sn(),ni(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),Z1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-item-action"]],viewQuery:function(n,a){if(n&1&&Mn(YL,5),n&2){let o;fi(o=pi())&&(a.templateRef=o.first)}},exportAs:["nzListItemAction"],standalone:!0,features:[Ar],ngContentSelectors:df,decls:1,vars:0,template:function(n,a){n&1&&(Sn(),gr(0,o1e,1,0,"ng-template"))},encapsulation:2,changeDetection:0});let r=e;return r})(),j1e=(()=>{let e=class e{constructor(i,n,a){this.ngZone=i,this.nzActions=[],this.actions=[],this.inputActionChanges$=new OL,this.contentChildrenChanges$=_V(()=>this.nzListItemActions?yV(null):this.ngZone.onStable.pipe(SV(1),this.enterZone(),MV(()=>this.nzListItemActions.changes.pipe(bV(this.nzListItemActions))))),xV(this.contentChildrenChanges$,this.inputActionChanges$).pipe(zL(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 vV(n=>i.subscribe({next:a=>this.ngZone.run(()=>n.next(a))}))}};e.\u0275fac=function(n){return new(n||e)(ma(VL),ma(Ib),ma(Fb))},e.\u0275cmp=Er({type:e,selectors:[["ul","nz-list-item-actions",""]],contentQueries:function(n,a,o){if(n&1&&Qu(o,Z1e,4),n&2){let s;fi(s=pi())&&(a.nzListItemActions=s)}},hostAttrs:[1,"ant-list-item-action"],inputs:{nzActions:"nzActions"},exportAs:["nzListItemActions"],standalone:!0,features:[RV([Fb]),sh,Ar],attrs:s1e,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&&gr(0,c1e,3,2,"li",0),n&2&&rt("ngForOf",a.actions)},dependencies:[d_,m_,As],encapsulation:2,changeDetection:0});let r=e;return r})(),C$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-empty"]],hostAttrs:[1,"ant-list-empty-text"],inputs:{nzNoResult:"nzNoResult"},exportAs:["nzListHeader"],standalone:!0,features:[Ar],decls:1,vars:2,consts:[[3,"nzComponentName","specificContent"]],template:function(n,a){n&1&&er(0,"nz-embed-empty",0),n&2&&rt("nzComponentName","list")("specificContent",a.nzNoResult)},dependencies:[zV,OV],encapsulation:2,changeDetection:0});let r=e;return r})(),K1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-header"]],hostAttrs:[1,"ant-list-header"],exportAs:["nzListHeader"],standalone:!0,features:[Ar],ngContentSelectors:df,decls:1,vars:0,template:function(n,a){n&1&&(Sn(),ni(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),w$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-footer"]],hostAttrs:[1,"ant-list-footer"],exportAs:["nzListFooter"],standalone:!0,features:[Ar],ngContentSelectors:df,decls:1,vars:0,template:function(n,a){n&1&&(Sn(),ni(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),T$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["nz-list-pagination"]],hostAttrs:[1,"ant-list-pagination"],exportAs:["nzListPagination"],standalone:!0,features:[Ar],ngContentSelectors:df,decls:1,vars:0,template:function(n,a){n&1&&(Sn(),ni(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),J1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=FL({type:e,selectors:[["nz-list-load-more"]],exportAs:["nzListLoadMoreDirective"],standalone:!0});let r=e;return r})();var R$=(()=>{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 gV(this.nzItemLayout),this.destroy$=new OL}ngOnInit(){this.dir=this.directionality.value,this.directionality.change?.pipe(zL(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)(ma(PV,8))},e.\u0275cmp=Er({type:e,selectors:[["nz-list"],["","nz-list",""]],contentQueries:function(n,a,o){if(n&1&&(Qu(o,w$,5),Qu(o,T$,5),Qu(o,J1e,5)),n&2){let s;fi(s=pi())&&(a.nzListFooterComponent=s.first),fi(s=pi())&&(a.nzListPaginationComponent=s.first),fi(s=pi())&&(a.nzListLoadMoreDirective=s.first)}},hostAttrs:[1,"ant-list"],hostVars:16,hostBindings:function(n,a){n&2&&Nb("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:[sh,Ar],ngContentSelectors:A1e,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&&(Sn(E1e),gr(0,p1e,3,1,"ng-template",null,0,sp)(2,m1e,2,1,"nz-list-header",1),ni(3),ht(4,"nz-spin",2),au(5),gr(6,v1e,1,2,"div",3)(7,_1e,2,2,"div",4)(8,x1e,1,1,"nz-list-empty",5),ou(),ot(),gr(9,M1e,2,1,"nz-list-footer",1),ni(10,1),gr(11,b1e,0,0,"ng-template",6),ni(12,2),gr(13,T1e,2,1,"nz-list-pagination",1),ni(14,3)),n&2){let o=su(1);at(2),rt("ngIf",a.nzHeader),at(2),rt("nzSpinning",a.nzLoading),at(2),rt("ngIf",a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),at(),rt("ngIf",a.nzGrid&&a.nzDataSource)("ngIfElse",o),at(),rt("ngIf",!a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),at(),rt("ngIf",a.nzFooter),at(2),rt("ngTemplateOutlet",a.nzLoadMore),at(2),rt("ngIf",a.nzPagination)}},dependencies:[m_,d_,K1e,As,Ob,Ub,Yn,FV,fn,hh,ch,C$,w$,T$],encapsulation:2,changeDetection:0});let r=e;return f_([v_()],r.prototype,"nzBordered",void 0),f_([v_()],r.prototype,"nzLoading",void 0),f_([v_()],r.prototype,"nzSplit",void 0),r})(),$1e=(()=>{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)(ma(R$),ma(Ib))},e.\u0275cmp=Er({type:e,selectors:[["nz-list-item"],["","nz-list-item",""]],contentQueries:function(n,a,o){if(n&1&&Qu(o,b$,5),n&2){let s;fi(s=pi())&&(a.listItemExtraDirective=s.first)}},hostAttrs:[1,"ant-list-item"],hostVars:2,hostBindings:function(n,a){n&2&&Nb("ant-list-item-no-flex",a.nzNoFlex)},inputs:{nzActions:"nzActions",nzContent:"nzContent",nzExtra:"nzExtra",nzNoFlex:"nzNoFlex"},exportAs:["nzListItem"],standalone:!0,features:[Ar],ngContentSelectors:Y1e,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&&(Sn(X1e),gr(0,R1e,2,1,"ng-template",null,0,sp)(2,P1e,3,1,"ng-template",null,1,sp)(4,I1e,1,0,"ng-template",null,2,sp)(6,F1e,4,4,"ng-template",null,3,sp)(8,W1e,6,4,"ng-container",4)),n&2){let o=su(7);at(8),rt("ngIf",a.isVerticalAndExtra)("ngIfElse",o)}},dependencies:[j1e,As,Ob,Ub,m_,b$],encapsulation:2,changeDetection:0});let r=e;return f_([v_()],r.prototype,"nzNoFlex",void 0),r})();var L$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=Pb({type:e}),e.\u0275inj=Db({imports:[R$,C$,$1e,q1e,A$]});let r=e;return r})();var Q1e=["chart"],D$=(()=>{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=Ev(i,"dark");let n=Rb(Rb({},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=Er({type:e,selectors:[["app-chart-component"]],viewQuery:function(n,a){if(n&1&&Mn(Q1e,7),n&2){let o;fi(o=pi())&&(a.chartContainer=o.first)}},inputs:{options:"options"},standalone:!0,features:[sh,Ar],decls:2,vars:0,consts:[[2,"width","100%","height","100%"],["chart",""]],template:function(n,a){n&1&&er(0,"div",0,1)}});let r=e;return r})();var tTe=r=>({margin:r,width:"100%",height:"16rem"});function rTe(r,e){if(r&1&&er(0,"app-chart-component",28),r&2){let t=Dr(2).$implicit,i=Dr();EV(qL(3,tTe,"20px "+20/i.chartConfig.rowNumber+"px")),rt("options",t.options)}}function iTe(r,e){if(r&1&&(ht(0,"div",26),gr(1,rTe,1,5,"app-chart-component",27),ot()),r&2){let t=Dr().$implicit,i=Dr();rt("nzSpan",24/i.chartConfig.rowNumber),at(),rt("ngIf",t.checked)}}function nTe(r,e){if(r&1&&gr(0,iTe,2,2,"div",25),r&2){let t=e.$implicit;rt("ngIf",t.checked)}}function aTe(r,e){if(r&1&&(ht(0,"div",4)(1,"div",29),er(2,"app-chart-component",30),ot()()),r&2){let t=e.$implicit;at(2),rt("options",t)}}var P$=(()=>{let e=class e{handleCheckedItems(i){console.log("\u5F53\u524D\u9009\u4E2D\u7684\u9879\u76EE:",i)}constructor(i){this._mqttService=i,this.http=xn(lu),this.modal=xn(uh),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{this.chartConfig.optionsCheckList[0].options=i.data,console.log(i)})}};e.\u0275fac=function(n){return new(n||e)(ma(kb))},e.\u0275cmp=Er({type:e,selectors:[["app-data-v-s1"]],standalone:!0,features:[Ar],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&&(ht(0,"div",0)(1,"div",1)(2,"data-v-card",2)(3,"div",3)(4,"div",4)(5,"div",5),er(6,"app-chart-component",6),ot(),ht(7,"div",7),jt(8,"\u7CFB\u7EDF\u5065\u5EB7\u5EA6"),ot()(),ht(9,"div",4)(10,"div",5),er(11,"app-chart-component",6),ot(),ht(12,"div",7),jt(13,"\u8BBE\u5907\u6295\u8FD0\u5EA6"),ot()()()(),ht(14,"data-v-card",8),er(15,"ag-grid-angular",9),ot(),ht(16,"data-v-card",10),er(17,"ag-grid-angular",9),ot(),ht(18,"data-v-card",11)(19,"div",12)(20,"span",13),jt(21,"\u5316\u9A8C\u6548\u7387\uFF1A"),ot(),er(22,"nz-progress",14),ht(23,"span",15),jt(24,"\uFF0816/25\uFF09"),ot()(),ht(25,"div",16)(26,"span",13),jt(27,"\u5B8C \u6210 \u7387 \uFF1A"),ot(),er(28,"nz-progress",14),ht(29,"span",15),jt(30,"\uFF0812/20\uFF09"),ot()()()(),ht(31,"div",1)(32,"data-v-card",17)(33,"div",18),er(34,"img",19),ht(35,"div",20)(36,"div",21),jt(37," \u673A\u5668\u4EBA "),ot(),ht(38,"div",21),jt(39," \u5168\u786B\u4EEA "),ot(),ht(40,"div",21),jt(41," \u5168\u6C34\u5206\u6790\u4EEA "),ot(),ht(42,"div",21),jt(43," \u6325\u53D1\u5206\u4EEA "),ot(),ht(44,"div",21),jt(45," \u91CF\u70ED\u4EEA "),ot(),ht(46,"div",21),jt(47," \u78B3\u6C22\u6C2E\u5143\u7D20 "),ot()()()()(),ht(48,"div",1)(49,"data-v-card",22),XL("onCheckedItemsChange",function(s){return a.handleCheckedItems(s)}),ht(50,"div",23),HL(51,nTe,1,1,"div",31,GL),ot(),ht(53,"div",24),HL(54,aTe,3,1,"div",4,GL),ot()()()()),n&2&&(rt("nzGutter",16),at(6),rt("options",a.chart_options),at(5),rt("options",a.chart_options0),at(4),rt("rowData",a.rowData)("columnDefs",a.colDefs1),at(2),rt("rowData",a.rowData)("columnDefs",a.colDefs2),at(5),rt("nzPercent",64)("nzStrokeColor","#74FAFB"),at(6),rt("nzPercent",60)("nzStrokeColor","#74FAFB"),at(21),rt("showSetting",!0)("optionsList",a.chartConfig.optionsCheckList),at(2),WL(a.chartConfig.optionsCheckList),at(3),WL(a.chartConfig.optionBottomList))},dependencies:[lh,As,UV,uo,kV,Bb,GV,L$,Ba,ka,io,Ja,ao,oo,no,to,Fa,Za,Ka,co,eo,$a,hh,ch,fn,Ua,Ya,qa,so,Wa,qn,Qa,Ha,ja,Xa,lo,za,Oa,ro,Ga,Xn,Va,Yn,D$],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 nMt=new wV("nz-carousel-custom-strategies");var I$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=Pb({type:e}),e.\u0275inj=Db({});let r=e;return r})();var oTe=["myGrid"],N$=(()=>{let e=class e{constructor(){this.gridOptions={headerHeight:0,width:"100%"},this.defaultColDef={width:130,editable:!1},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz"}ngOnInit(){console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=10,this.pageIndex=1,this.pageRowTotal=this.rowData.length}nzPageSizeChange(i){this.pageSize=i}nzPageIndexChange(i){console.log(`nzPageIndexChange${i}`),this.grid.api&&(i==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(i))}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["lj-car-ag-grid-component"]],viewQuery:function(n,a){if(n&1&&Mn(oTe,5),n&2){let o;fi(o=pi())&&(a.grid=o.first)}},inputs:{defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Ar],decls:2,vars:11,consts:[[2,"height","100%",3,"pagination","suppressPaginationPanel","suppressScrollOnNewData","paginationPageSize","defaultColDef","rowData","columnDefs","gridOptions"],["myGrid",""]],template:function(n,a){n&1&&er(0,"ag-grid-angular",0,1),n&2&&(AV(a.gridThemeClass),rt("pagination",!0)("suppressPaginationPanel",!0)("suppressPaginationPanel",!0)("suppressScrollOnNewData",!0)("paginationPageSize",a.pageSize)("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.columnDefs)("gridOptions",a.gridOptions))},dependencies:[Bb,Rm],styles:[".grid-pagination[_ngcontent-%COMP%]{display:flex;justify-content:space-between;height:32px}.grid-pagination[_ngcontent-%COMP%] .ant-select-selection-item, .ant-select-selector[_ngcontent-%COMP%]{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .page-total-style{font-size:medium;font-weight:700;color:#00eff8} .ant-select-item-option{color:#00eff8!important} .ant-select-item-option-active div{font-weight:800!important;color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .anticon{color:#00eff8}.grid-pagination[_ngcontent-%COMP%] .ant-select-selector{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-prev .ant-pagination-item-link{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item a{color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active a{color:#000!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-next button, .ant-pagination-prev[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active:focus-visible, .ant-pagination-item-active[_ngcontent-%COMP%]:hover, .ant-pagination-next[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%], .ant-pagination-prev[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%]{border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active{font-weight:500;background-color:#00eff8;border-color:#00eff8;border-width:2px}"]});let r=e;return r})();var sTe=["myGrid"],lTe=["*"],SA=(()=>{let e=class e{constructor(){this.gridThemedClass="ag-theme-quartz ag-theme-datav",this.title="",this.defaultColDef={editable:!1,cellStyle:{"font-weight":"bold",textAlign:"center","justify-content":"center","line-height":"38px"}},this.columnDefs=[],this.rowData1=[],this.rowData2=[],this.rowData3=[],this.rowData4=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz",this.tableColumns=[{key:"sort",title:"\u5E8F\u53F7"},{key:"time",title:"\u65F6\u95F4"},{key:"option",title:"\u64CD\u4F5C"},{key:"optionDesc",title:"\u64CD\u4F5C\u63CF\u8FF0"},{key:"optionMan",title:"\u64CD\u4F5C\u4EBA\u5458"},{key:"mark",title:"\u5907\u6CE8"},{key:"edit",title:"\u7F16\u8F91"}],this.colDefs1=[{headerName:"\u5E8F\u53F7",valueGetter:function(i){return parseInt(i.node.id)+1},width:50,cellStyle:{"font-size":"13px"},field:"xh"},{headerName:"\u65F6\u95F4",field:"time",width:60,cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}},{headerName:"\u8F66\u724C",field:"carNo",width:50,cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}},{headerName:"\u8F66\u578B",field:"carType",width:50,cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}},{headerName:"\u5361\u53F7",field:"no",width:50,cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}},{headerName:"\u4F9B\u5E94\u5546",width:55,field:"supplier",cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}},{headerName:"\u6BDB\u91CD",width:55,field:"grossWeight",cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}},{headerName:"\u4E0A\u62A5\u70ED\u503C",width:55,field:"reportHotValue",cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}},{headerName:"\u4F30\u7B97\u70ED\u503C",width:55,field:"estimateValue",cellStyle:{"font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"}}]}ngOnInit(){this.rowData1.push({xh:1,time:"13:25",carNo:"A4132",carType:"\u91CD\u5361",no:"6-*",supplier:"\u5927\u540C",grossWeight:"7.15",reportHotValue:"7.6",estimateValue:"7.51"}),this.rowData1.push({xh:1,time:"13:25",carNo:"A4132",carType:"\u91CD\u5361",no:"6-*",supplier:"\u5927\u540C",grossWeight:"7.15",reportHotValue:"7.6",estimateValue:"7.51"}),this.rowData1.push({xh:1,time:"13:25",carNo:"A4132",carType:"\u91CD\u5361",no:"6-*",supplier:"\u5927\u540C",grossWeight:"7.15",reportHotValue:"7.6",estimateValue:"7.51"}),console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=5,this.pageIndex=1,this.pageRowTotal=this.rowData1.length}nzPageSizeChange(i){this.pageSize=i}nzPageIndexChange(i){console.log(`nzPageIndexChange${i}`),this.grid.api&&(i==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(i))}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["app-data-v-lj-car-info-table"]],viewQuery:function(n,a){if(n&1&&Mn(sTe,5),n&2){let o;fi(o=pi())&&(a.grid=o.first)}},inputs:{title:"title",defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData1:"rowData1",rowData2:"rowData2",rowData3:"rowData3",rowData4:"rowData4",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Ar],ngContentSelectors:lTe,decls:43,vars:12,consts:[[1,"card-content"],[1,"table-container"],[1,"table-header"],[1,"grid-container"],[1,"grid-item"],[1,"rounded-border",2,"color","#ff0200"],["gridThemeClass","ag-theme-quartz ag-theme-datav",2,"width","100%","height","120px",3,"defaultColDef","rowData","columnDefs"],[1,"rounded-border",2,"color","#25f551"],[1,"rounded-border",2,"color","#bbbbbb"]],template:function(n,a){n&1&&(Sn(),ht(0,"div",0)(1,"div",1)(2,"div",2)(3,"span"),jt(4,"\u5E8F\u53F7"),ot(),ht(5,"span"),jt(6,"\u65F6\u95F4"),ot(),ht(7,"span"),jt(8,"\u8F66\u724C"),ot(),ht(9,"span"),jt(10,"\u8F66\u578B"),ot(),ht(11,"span"),jt(12,"\u5361\u53F7"),ot(),ht(13,"span"),jt(14,"\u4F9B\u5E94\u5546"),ot(),ht(15,"span"),jt(16,"\u6BDB\u91CD"),ot(),ht(17,"span"),jt(18,"\u4E0A\u62A5"),er(19,"br"),jt(20,"\u70ED\u503C"),ot(),ht(21,"span"),jt(22,"\u4F30\u7B97"),er(23,"br"),jt(24,"\u70ED\u503C"),ot()()(),ht(25,"div",3)(26,"div",4)(27,"div",5),jt(28,"#1"),ot(),er(29,"lj-car-ag-grid-component",6),ot(),ht(30,"div",4)(31,"div",7),jt(32,"#2"),ot(),er(33,"lj-car-ag-grid-component",6),ot(),ht(34,"div",4)(35,"div",5),jt(36,"#3"),ot(),er(37,"lj-car-ag-grid-component",6),ot(),ht(38,"div",4)(39,"div",8),jt(40,"#4"),ot(),er(41,"lj-car-ag-grid-component",6),ot()(),ni(42),ot()),n&2&&(at(29),rt("defaultColDef",a.defaultColDef)("rowData",a.rowData1)("columnDefs",a.colDefs1),at(4),rt("defaultColDef",a.defaultColDef)("rowData",a.rowData1)("columnDefs",a.colDefs1),at(4),rt("defaultColDef",a.defaultColDef)("rowData",a.rowData1)("columnDefs",a.colDefs1),at(4),rt("defaultColDef",a.defaultColDef)("rowData",a.rowData1)("columnDefs",a.colDefs1))},dependencies:[Ba,ka,io,Ja,ao,oo,no,to,Fa,Za,Ka,co,eo,$a,fn,Ua,Ya,qa,so,uo,Wa,qn,Qa,Ha,ja,Xa,lo,za,Oa,ro,Ga,Xn,Va,Yn,N$],styles:['.card-top-content[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto auto;align-items:center;justify-content:space-between;margin-bottom:10px}.buttons-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}.card-button[_ngcontent-%COMP%], span[nz-icon][_ngcontent-%COMP%]{margin-left:.5rem}.card-button[_ngcontent-%COMP%]{cursor:pointer;width:82px;height:40px;font-size:26px;line-height:20px;color:#00eff8;text-align:center;background-color:#213069;border:none;border-radius:3px}.card-content[_ngcontent-%COMP%]{overflow:hidden;margin-bottom:.5rem;//height: 18rem;padding:1rem 1.5rem;padding:1rem;//position: relative;background-image:url("./media/dashboard_card_bg2-IIPDCMYC.png");background-repeat:no-repeat;background-position:center;// background-position: top;background-size:100% 100%}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%]{display:flex;flex-grow:1;align-items:center;justify-content:space-between;width:fit-content;height:fit-content;margin-bottom:.5rem;padding:5px 20px;font-size:28px;font-weight:600;line-height:22px;color:#74fafb;color:#00eff8;text-align:center;background-color:#19426e;border:1px solid #1f6f97;border-radius:10px 10px 0 0;box-shadow:inset 0 0 10px #1f6f97}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-l[_ngcontent-%COMP%]{flex:1;align-self:flex-start}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}.table-container[_ngcontent-%COMP%]{margin:10px 3px 20px 55px;padding:5px;border:1px solid #fff}.table-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.table-header[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;font-size:12px;color:#75f9fd;text-align:center}.grid-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;margin-bottom:20px}.rounded-border[_ngcontent-%COMP%]{display:flex;place-items:center center;justify-content:center;width:50px;height:40px;margin-right:10px;padding:3px;font-size:26px;font-weight:700;text-align:center;background-color:#21306a;border:1px solid #00EFF9;border-radius:2px}.ag-cell[_ngcontent-%COMP%]{padding-right:5px!important;padding-left:5px!important}']});let r=e;return r})();function uTe(r,e){r&1&&(ht(0,"button",7),jt(1,"\u63D0\u4EA4"),ot())}function cTe(r,e){r&1&&(ht(0,"button",7),jt(1,"\u6253\u5370"),ot())}function hTe(r,e){r&1&&er(0,"span",8)}var fTe=["*"],U$=(()=>{let e=class e{constructor(){this.showSetting=!1,this.divHeight=350,this.showEditButton=!1,this.optionsList=[],this.onCheckedItemsChange=new kL,this.title=""}getCheckedItems(){return this.optionsList.filter(i=>i.checked)}onCheckChange(){let i=this.getCheckedItems();this.onCheckedItemsChange.emit(i)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["lj-data-v-board-title"]],inputs:{showSetting:"showSetting",divHeight:"divHeight",showEditButton:"showEditButton",optionsList:"optionsList",title:"title"},outputs:{onCheckedItemsChange:"onCheckedItemsChange"},standalone:!0,features:[Ar],ngContentSelectors:fTe,decls:10,vars:4,consts:[[1,"card-content"],[1,"card-top-content"],[1,"card-content-title"],[1,"card-content-l"],[1,"buttons-container"],["class","card-button",4,"ngIf"],["nz-icon","","nzType","setting","nzTheme","outline",4,"ngIf"],[1,"card-button"],["nz-icon","","nzType","setting","nzTheme","outline"]],template:function(n,a){n&1&&(Sn(),ht(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),jt(4),ot()(),ht(5,"div",4),gr(6,uTe,2,0,"button",5)(7,cTe,2,0,"button",5)(8,hTe,1,0,"span",6),ot()(),ni(9),ot()),n&2&&(at(4),bn(a.title),at(2),rt("ngIf",a.showEditButton),at(),rt("ngIf",a.showEditButton),at(),rt("ngIf",a.showSetting))},dependencies:[Xn,IV,lh,As,Ha,Ba,ka,io,Ja,ao,oo,no,to,Fa,Za,Ka,co,eo,$a,fn,Ua,NV,Ya,qa,so,uo,Wa,qn,Qa,ja,Xa,lo,za,Oa,ro,Ga,Va,Yn],styles:['.card-top-content[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto auto;align-items:start;justify-content:space-between;margin-bottom:10px}.buttons-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}.card-button[_ngcontent-%COMP%], span[nz-icon][_ngcontent-%COMP%]{margin-left:.5rem}.card-button[_ngcontent-%COMP%]{cursor:pointer;width:72px;height:40px;font-size:24px;line-height:20px;color:#00eff8;text-align:center;background-color:#213069;border:none;border-radius:3px}.card-content[_ngcontent-%COMP%]{overflow:hidden;height:100%;margin-bottom:.5rem;padding:1rem 1.5rem;padding:1rem;background-image:url("./media/dashboard_card_bg-2QFDBQFD.jpg");background-repeat:no-repeat;background-position:center;background-size:100% 100%}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%]{display:flex;flex-grow:1;align-items:center;justify-content:space-between;width:fit-content;height:fit-content;margin-bottom:.5rem;padding:5px 20px;font-size:28px;font-weight:600;line-height:22px;color:#74fafb;color:#00eff8;text-align:center;background-color:#19426e;border:1px solid #1f6f97;border-radius:10px 10px 0 0;box-shadow:inset 0 0 10px #1f6f97}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-l[_ngcontent-%COMP%]{flex:1;align-self:flex-start}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}']});let r=e;return r})();function pTe(r,e){if(r&1&&er(0,"div",5),r&2){let t=Dr();op("id",t.chartId)}}var MA=(()=>{let e=class e{constructor(){this.chartId="",this.text="",this.locationTitle1="",this.locationTitle2=""}ngOnInit(){setTimeout(()=>this.initCharts(),0)}initCharts(){console.log("\u521D\u59CB\u5316\u56FE\u8868"),console.log(this,this.chartId),console.log(this,this.chartId.toString());let i=Ev(document.getElementById(this.chartId)),n={tooltip:{formatter:"{a}
{b} : {c}%"},series:[{name:"Pressure",type:"gauge",progress:{show:!0},detail:{valueAnimation:!0,formatter:"{value}"},data:[{value:50,name:"SCORE"}]}]};i.setOption(n)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["app-data-v-lj-text-dashboard"]],inputs:{chartId:"chartId",text:"text",locationTitle1:"locationTitle1",locationTitle2:"locationTitle2"},standalone:!0,features:[Ar],decls:9,vars:4,consts:[[1,"chart-card"],[1,"chart-container"],["class","chart-container",3,"id",4,"ngIf"],[1,"chart-text"],[1,"chart-button"],[1,"chart-container",3,"id"]],template:function(n,a){n&1&&(ht(0,"div",0)(1,"div",1),gr(2,pTe,1,1,"div",2),ot(),ht(3,"p",3),jt(4),ot(),ht(5,"button",4),jt(6),ot(),ht(7,"button",4),jt(8),ot()()),n&2&&(at(2),rt("ngIf",a.chartId),at(2),bn(a.text),at(2),bn(a.locationTitle1),at(2),bn(a.locationTitle2))},dependencies:[Ba,ka,io,Ja,ao,oo,no,to,Fa,Za,Ka,co,eo,$a,fn,Ua,Ya,qa,so,uo,Wa,qn,Qa,Ha,ja,Xa,lo,za,Oa,ro,Ga,Xn,Va,Yn,lh,As],styles:[".chart-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:space-around;text-align:center}.chart-text[_ngcontent-%COMP%]{margin:0;font-size:24px;color:#7eddf3}.chart-button[_ngcontent-%COMP%]{width:12rem;height:3rem;margin:5px;font-size:28px;line-height:22px;color:red;text-align:center;background-color:#06467800;background-image:url(/assets/dashboardButtonBg.png);background-repeat:no-repeat;background-position:center;background-size:contain;border-width:0}.chart-container[_ngcontent-%COMP%]{width:13rem;height:13rem}"]});let r=e;return r})();var dTe=["myGrid"],bA=(()=>{let e=class e{constructor(){this.title="",this.showSetting=!0,this.defaultColDef={width:130,editable:!1,headerClass:"ag-header-center",cellStyle:{"font-weight":"bold",textAlign:"center","justify-content":"center","line-height":"38px"}},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz"}ngOnInit(){}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["app-data-v-lj-dashboard"]],viewQuery:function(n,a){if(n&1&&Mn(dTe,5),n&2){let o;fi(o=pi())&&(a.grid=o.first)}},inputs:{title:"title",defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Ar],decls:4,vars:1,consts:[["nz-col","","nzSpan","24","nzXs","24","nzSm","24","nzMd","12","nzLg","12","nzXl","12","nzXXl","12",2,"height","400px",3,"title"],[2,"display","flex","justify-content","center","align-items","center"],["locationTitle1","1#\u91CD\u78C5","locationTitle2","3#\u91CD\u78C5","chartId","leftChart","text","\u91CD\u8861\u7CFB\u7EDF\u5065\u5EB7\u5EA6"],["locationTitle1","2#\u91CD\u78C5","locationTitle2","4#\u91CD\u78C5","chartId","rightChart","text","\u91CD\u8861\u7CFB\u7EDF\u6295\u8FD0\u7387"]],template:function(n,a){n&1&&(ht(0,"lj-data-v-board-title",0)(1,"div",1),er(2,"app-data-v-lj-text-dashboard",2)(3,"app-data-v-lj-text-dashboard",3),ot()()),n&2&&op("title",a.title)},dependencies:[Rm,MA,U$],encapsulation:2});let r=e;return r})();var VS="162";var O$=0,lz=1,z$=2;var wA=1,F$=2,Hl=3,hs=0,bi=1,fs=2,el=0,Cc=1,uz=2,cz=3,hz=4,B$=5,Rc=100,k$=101,V$=102,fz=103,pz=104,G$=200,H$=201,W$=202,X$=203,GS=204,HS=205,Y$=206,q$=207,Z$=208,j$=209,K$=210,J$=211,$$=212,Q$=213,eQ=214,tQ=0,rQ=1,iQ=2,Zg=3,nQ=4,aQ=5,oQ=6,sQ=7,TA=0,lQ=1,uQ=2,tl=0,cQ=1,hQ=2,fQ=3,pQ=4,dQ=5,mQ=6,vQ=7;var dz=300,Wl=301,zu=302,WS=303,XS=304,mf=306,YS=1e3,Ea=1001,qS=1002,Gi=1003,mz=1004;var jg=1005;var tn=1006,EA=1007;var Xl=1008;var ps=1009,gQ=1010,yQ=1011,Kg=1012,AA=1013,ds=1014,No=1015,Lc=1016,CA=1017,RA=1018,rl=1020,_Q=1021,On=1023,xQ=1024,SQ=1025,Yl=1026,Fu=1027,MQ=1028,LA=1029,bQ=1030,DA=1031,PA=1033,IA=33776,NA=33777,UA=33778,OA=33779,vz=35840,gz=35841,yz=35842,_z=35843,zA=36196,xz=37492,Sz=37496,Mz=37808,bz=37809,wz=37810,Tz=37811,Ez=37812,Az=37813,Cz=37814,Rz=37815,Lz=37816,Dz=37817,Pz=37818,Iz=37819,Nz=37820,Uz=37821,FA=36492,Oz=36494,zz=36495,wQ=36283,Fz=36284,Bz=36285,kz=36286;var TQ=3200,EQ=3201,AQ=0,CQ=1,il="",Uo="srgb",Oo="srgb-linear",Jg="display-p3",Ad="display-p3-linear",$g="linear",qr="srgb",Qg="rec709",ey="p3";var Cd=7680;var Vz=519,RQ=512,LQ=513,DQ=514,BA=515,PQ=516,IQ=517,NQ=518,UQ=519,Gz=35044;var Hz="300 es",ZS=1035,zo=2e3,Rd=2001;var Fo=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>8&255]+ra[r>>16&255]+ra[r>>24&255]+"-"+ra[e&255]+ra[e>>8&255]+"-"+ra[e>>16&15|64]+ra[e>>24&255]+"-"+ra[t&63|128]+ra[t>>8&255]+"-"+ra[t>>16&255]+ra[t>>24&255]+ra[i&255]+ra[i>>8&255]+ra[i>>16&255]+ra[i>>24&255]).toLowerCase()}function rn(r,e,t){return Math.max(e,Math.min(t,r))}function OQ(r,e){return(r%e+e)%e}function VA(r,e,t){return(1-t)*r+t*e}function Wz(r){return(r&r-1)===0&&r!==0}function KS(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function ty(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 Aa(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 Qt=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(rn(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 rr=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],h=i[7],f=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*_+h*M,a[4]=u*m+c*y+h*S,a[7]=u*v+c*x+h*w,a[2]=f*g+p*_+d*M,a[5]=f*m+p*y+d*S,a[8]=f*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],h=c*o-s*u,f=s*l-c*a,p=u*a-o*l,d=t*h+i*f+n*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=h*g,e[1]=(n*u-c*i)*g,e[2]=(s*i-n*o)*g,e[3]=f*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(Xz.makeScale(e,t)),this}rotate(e){return this.premultiply(Xz.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xz.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)}},Xz=new rr;function GA(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function ry(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function FQ(){let r=ry("canvas");return r.style.display="block",r}var zQ={};function BQ(r){r in zQ||(zQ[r]=!0,console.warn(r))}var kQ=new rr().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),VQ=new rr().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),HA={[Oo]:{transfer:$g,primaries:Qg,toReference:r=>r,fromReference:r=>r},[Uo]:{transfer:qr,primaries:Qg,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Ad]:{transfer:$g,primaries:ey,toReference:r=>r.applyMatrix3(VQ),fromReference:r=>r.applyMatrix3(kQ)},[Jg]:{transfer:qr,primaries:ey,toReference:r=>r.convertSRGBToLinear().applyMatrix3(VQ),fromReference:r=>r.applyMatrix3(kQ).convertLinearToSRGB()}},mTe=new Set([Oo,Ad]),Lr={enabled:!0,_workingColorSpace:Oo,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!mTe.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=HA[e].toReference,n=HA[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 HA[r].primaries},getTransfer:function(r){return r===il?$g:HA[r].transfer}};function vf(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function WA(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var iy,ny=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{iy===void 0&&(iy=ry("canvas")),iy.width=e.width,iy.height=e.height;let i=iy.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=iy}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=ry("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{class r extends Fo{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=Ea,a=Ea,o=tn,s=Xl,l=On,u=ps,c=r.DEFAULT_ANISOTROPY,h=il){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:gTe++}),this.uuid=Bu(),this.name="",this.source=new ay(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 Qt(0,0),this.repeat=new Qt(1,1),this.center=new Qt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new rr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,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!==dz)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case YS:t.x=t.x-Math.floor(t.x);break;case Ea:t.x=t.x<0?0:1;break;case qS: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 YS:t.y=t.y-Math.floor(t.y);break;case Ea:t.y=t.y<0?0:1;break;case qS: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=dz,r.DEFAULT_ANISOTROPY=1,r})();var li=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],h=l[8],f=l[1],p=l[5],d=l[9],g=l[2],m=l[6],v=l[10];if(Math.abs(c-f)<.01&&Math.abs(h-g)<.01&&Math.abs(d-m)<.01){if(Math.abs(c+f)<.1&&Math.abs(h+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+f)/4,w=(h+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)+(h-g)*(h-g)+(f-c)*(f-c));return Math.abs(_)<.001&&(_=1),this.x=(m-d)/_,this.y=(h-g)/_,this.z=(f-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 XA=class extends Fo{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new li(0,0,e,t),this.scissorTest=!1,this.viewport=new li(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:tn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new Bo(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=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+f*x,u=u*m+p*x,c=c*m+d*x,h=h*m+g*x,m===1-s){let M=1/Math.sqrt(l*l+u*u+c*c+h*h);l*=M,u*=M,c*=M,h*=M}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,n,a,o){let s=i[n],l=i[n+1],u=i[n+2],c=i[n+3],h=a[o],f=a[o+1],p=a[o+2],d=a[o+3];return e[t]=s*d+c*h+l*p-u*f,e[t+1]=l*d+c*f+u*h-s*p,e[t+2]=u*d+c*p+s*f-l*h,e[t+3]=c*d-s*h-l*f-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),h=s(a/2),f=l(i/2),p=l(n/2),d=l(a/2);switch(o){case"XYZ":this._x=f*c*h+u*p*d,this._y=u*p*h-f*c*d,this._z=u*c*d+f*p*h,this._w=u*c*h-f*p*d;break;case"YXZ":this._x=f*c*h+u*p*d,this._y=u*p*h-f*c*d,this._z=u*c*d-f*p*h,this._w=u*c*h+f*p*d;break;case"ZXY":this._x=f*c*h-u*p*d,this._y=u*p*h+f*c*d,this._z=u*c*d+f*p*h,this._w=u*c*h-f*p*d;break;case"ZYX":this._x=f*c*h-u*p*d,this._y=u*p*h+f*c*d,this._z=u*c*d-f*p*h,this._w=u*c*h+f*p*d;break;case"YZX":this._x=f*c*h+u*p*d,this._y=u*p*h+f*c*d,this._z=u*c*d-f*p*h,this._w=u*c*h-f*p*d;break;case"XZY":this._x=f*c*h-u*p*d,this._y=u*p*h-f*c*d,this._z=u*c*d+f*p*h,this._w=u*c*h+f*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],h=t[10],f=i+s+h;if(f>0){let p=.5/Math.sqrt(f+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>h){let p=2*Math.sqrt(1+i-s-h);this._w=(c-l)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(a+u)/p}else if(s>h){let p=2*Math.sqrt(1+s-i-h);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+h-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 iMath.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(rn(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),h=Math.sin((1-t)*c)/u,f=Math.sin(t*c)/u;return this._w=o*h+this._w*f,this._x=i*h+this._x*f,this._y=n*h+this._y*f,this._z=a*h+this._z*f,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(GQ.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(GQ.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),h=2*(a*i-o*t);return this.x=t+l*u+o*h-s*c,this.y=i+l*c+s*u-a*h,this.z=n+l*h+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 qz.copy(this).projectOnVector(e),this.sub(qz)}reflect(e){return this.sub(qz.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(rn(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}},qz=new be,GQ=new Vu;var Pc=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;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ql),ql.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(JS),ZA.subVectors(this.max,JS),sy.subVectors(e.a,JS),ly.subVectors(e.b,JS),uy.subVectors(e.c,JS),gf.subVectors(ly,sy),yf.subVectors(uy,ly),Ld.subVectors(sy,uy);let t=[0,-gf.z,gf.y,0,-yf.z,yf.y,0,-Ld.z,Ld.y,gf.z,0,-gf.x,yf.z,0,-yf.x,Ld.z,0,-Ld.x,-gf.y,gf.x,0,-yf.y,yf.x,0,-Ld.y,Ld.x,0];return!Zz(t,sy,ly,uy,ZA)||(t=[1,0,0,0,1,0,0,0,1],!Zz(t,sy,ly,uy,ZA))?!1:(jA.crossVectors(gf,yf),t=[jA.x,jA.y,jA.z],Zz(t,sy,ly,uy,ZA))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ql).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ql).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:(Dc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Dc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Dc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Dc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Dc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Dc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Dc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Dc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Dc),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)}},Dc=[new be,new be,new be,new be,new be,new be,new be,new be],ql=new be,qA=new Pc,sy=new be,ly=new be,uy=new be,gf=new be,yf=new be,Ld=new be,JS=new be,ZA=new be,jA=new be,Dd=new be;function Zz(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){Dd.fromArray(r,a);let s=n.x*Math.abs(Dd.x)+n.y*Math.abs(Dd.y)+n.z*Math.abs(Dd.z),l=e.dot(Dd),u=t.dot(Dd),c=i.dot(Dd);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var yTe=new Pc,$S=new be,jz=new be,_f=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):yTe.setFromPoints(e).getCenter(i);let n=0;for(let a=0,o=e.length;athis.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;$S.subVectors(e,this.center);let t=$S.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector($S,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):(jz.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint($S.copy(e.center).add(jz)),this.expandByPoint($S.copy(e.center).sub(jz))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var Ic=new be,Kz=new be,KA=new be,xf=new be,Jz=new be,JA=new be,$z=new be,$A=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,Ic)),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=Ic.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ic.copy(this.origin).addScaledVector(this.direction,t),Ic.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){Kz.copy(e).add(t).multiplyScalar(.5),KA.copy(t).sub(e).normalize(),xf.copy(this.origin).sub(Kz);let a=e.distanceTo(t)*.5,o=-this.direction.dot(KA),s=xf.dot(this.direction),l=-xf.dot(KA),u=xf.lengthSq(),c=Math.abs(1-o*o),h,f,p,d;if(c>0)if(h=o*l-s,f=o*s-l,d=a*c,h>=0)if(f>=-d)if(f<=d){let g=1/c;h*=g,f*=g,p=h*(h+o*f+2*s)+f*(o*h+f+2*l)+u}else f=a,h=Math.max(0,-(o*f+s)),p=-h*h+f*(f+2*l)+u;else f=-a,h=Math.max(0,-(o*f+s)),p=-h*h+f*(f+2*l)+u;else f<=-d?(h=Math.max(0,-(-o*a+s)),f=h>0?-a:Math.min(Math.max(-a,-l),a),p=-h*h+f*(f+2*l)+u):f<=d?(h=0,f=Math.min(Math.max(-a,-l),a),p=f*(f+2*l)+u):(h=Math.max(0,-(o*a+s)),f=h>0?a:Math.min(Math.max(-a,-l),a),p=-h*h+f*(f+2*l)+u);else f=o>0?-a:a,h=Math.max(0,-(o*f+s)),p=-h*h+f*(f+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,h),n&&n.copy(Kz).addScaledVector(KA,f),p}intersectSphere(e,t){Ic.subVectors(e.center,this.origin);let i=Ic.dot(this.direction),n=Ic.dot(Ic)-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,h=1/this.direction.z,f=this.origin;return u>=0?(i=(e.min.x-f.x)*u,n=(e.max.x-f.x)*u):(i=(e.max.x-f.x)*u,n=(e.min.x-f.x)*u),c>=0?(a=(e.min.y-f.y)*c,o=(e.max.y-f.y)*c):(a=(e.max.y-f.y)*c,o=(e.min.y-f.y)*c),i>o||a>n||((a>i||isNaN(i))&&(i=a),(o=0?(s=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(s=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||s>n)||((s>i||i!==i)&&(i=s),(l=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,Ic)!==null}intersectTriangle(e,t,i,n,a){Jz.subVectors(t,e),JA.subVectors(i,e),$z.crossVectors(Jz,JA);let o=this.direction.dot($z),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;xf.subVectors(this.origin,e);let l=s*this.direction.dot(JA.crossVectors(xf,JA));if(l<0)return null;let u=s*this.direction.dot(Jz.cross(xf));if(u<0||l+u>o)return null;let c=-s*xf.dot($z);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 Zr=class r{constructor(e,t,i,n,a,o,s,l,u,c,h,f,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,h,f,p,d,g,m)}set(e,t,i,n,a,o,s,l,u,c,h,f,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]=h,v[14]=f,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/cy.setFromMatrixColumn(e,0).length(),a=1/cy.setFromMatrixColumn(e,1).length(),o=1/cy.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),h=Math.sin(a);if(e.order==="XYZ"){let f=o*c,p=o*h,d=s*c,g=s*h;t[0]=l*c,t[4]=-l*h,t[8]=u,t[1]=p+d*u,t[5]=f-g*u,t[9]=-s*l,t[2]=g-f*u,t[6]=d+p*u,t[10]=o*l}else if(e.order==="YXZ"){let f=l*c,p=l*h,d=u*c,g=u*h;t[0]=f+g*s,t[4]=d*s-p,t[8]=o*u,t[1]=o*h,t[5]=o*c,t[9]=-s,t[2]=p*s-d,t[6]=g+f*s,t[10]=o*l}else if(e.order==="ZXY"){let f=l*c,p=l*h,d=u*c,g=u*h;t[0]=f-g*s,t[4]=-o*h,t[8]=d+p*s,t[1]=p+d*s,t[5]=o*c,t[9]=g-f*s,t[2]=-o*u,t[6]=s,t[10]=o*l}else if(e.order==="ZYX"){let f=o*c,p=o*h,d=s*c,g=s*h;t[0]=l*c,t[4]=d*u-p,t[8]=f*u+g,t[1]=l*h,t[5]=g*u+f,t[9]=p*u-d,t[2]=-u,t[6]=s*l,t[10]=o*l}else if(e.order==="YZX"){let f=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=g-f*h,t[8]=d*h+p,t[1]=h,t[5]=o*c,t[9]=-s*c,t[2]=-u*c,t[6]=p*h+d,t[10]=f-g*h}else if(e.order==="XZY"){let f=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=-h,t[8]=u*c,t[1]=f*h+g,t[5]=o*c,t[9]=p*h-d,t[2]=d*h-p,t[6]=s*c,t[10]=g*h+f}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(_Te,e,xTe)}lookAt(e,t,i){let n=this.elements;return ms.subVectors(e,t),ms.lengthSq()===0&&(ms.z=1),ms.normalize(),Sf.crossVectors(i,ms),Sf.lengthSq()===0&&(Math.abs(i.z)===1?ms.x+=1e-4:ms.z+=1e-4,ms.normalize(),Sf.crossVectors(i,ms)),Sf.normalize(),QA.crossVectors(ms,Sf),n[0]=Sf.x,n[4]=QA.x,n[8]=ms.x,n[1]=Sf.y,n[5]=QA.y,n[9]=ms.y,n[2]=Sf.z,n[6]=QA.z,n[10]=ms.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],h=i[5],f=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],P=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*P+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+h*b+f*A+p*z,a[5]=c*w+h*E+f*P+p*k,a[9]=c*T+h*I+f*U+p*G,a[13]=c*C+h*R+f*B+p*Y,a[2]=d*S+g*b+m*A+v*z,a[6]=d*w+g*E+m*P+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*P+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],h=e[6],f=e[10],p=e[14],d=e[3],g=e[7],m=e[11],v=e[15];return d*(+a*l*h-n*u*h-a*s*f+i*u*f+n*s*p-i*l*p)+g*(+t*l*p-t*u*f+a*o*f-n*o*p+n*u*c-a*l*c)+m*(+t*u*h-t*s*p-a*o*h+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-t*l*h+t*s*f+n*o*h-i*o*f+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],h=e[9],f=e[10],p=e[11],d=e[12],g=e[13],m=e[14],v=e[15],_=h*m*u-g*f*u+g*l*p-s*m*p-h*l*v+s*f*v,y=d*f*u-c*m*u-d*l*p+o*m*p+c*l*v-o*f*v,x=c*g*u-d*h*u+d*s*p-o*g*p-c*s*v+o*h*v,M=d*h*l-c*g*l-d*s*f+o*g*f+c*s*m-o*h*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*f*a-h*m*a-g*n*p+i*m*p+h*n*v-i*f*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]=(h*l*a-s*f*a-h*n*u+i*f*u+s*n*p-i*l*p)*w,e[4]=y*w,e[5]=(c*m*a-d*f*a+d*n*p-t*m*p-c*n*v+t*f*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*f*a-c*l*a+c*n*u-t*f*u-o*n*p+t*l*p)*w,e[8]=x*w,e[9]=(d*h*a-c*g*a-d*i*p+t*g*p+c*i*v-t*h*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*h*a-c*i*u+t*h*u+o*i*p-t*s*p)*w,e[12]=M*w,e[13]=(c*g*n-d*h*n+d*i*f-t*g*f-c*i*m+t*h*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*h*n-c*s*n+c*i*l-t*h*l-o*i*f+t*s*f)*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,h=s+s,f=a*u,p=a*c,d=a*h,g=o*c,m=o*h,v=s*h,_=l*u,y=l*c,x=l*h,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-(f+v))*S,n[6]=(m+_)*S,n[7]=0,n[8]=(d+y)*w,n[9]=(m-_)*w,n[10]=(1-(f+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=cy.set(n[0],n[1],n[2]).length(),o=cy.set(n[4],n[5],n[6]).length(),s=cy.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],Zl.copy(this);let u=1/a,c=1/o,h=1/s;return Zl.elements[0]*=u,Zl.elements[1]*=u,Zl.elements[2]*=u,Zl.elements[4]*=c,Zl.elements[5]*=c,Zl.elements[6]*=c,Zl.elements[8]*=h,Zl.elements[9]*=h,Zl.elements[10]*=h,t.setFromRotationMatrix(Zl),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=zo){let l=this.elements,u=2*a/(t-e),c=2*a/(i-n),h=(t+e)/(t-e),f=(i+n)/(i-n),p,d;if(s===zo)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===Rd)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]=h,l[12]=0,l[1]=0,l[5]=c,l[9]=f,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=zo){let l=this.elements,u=1/(t-e),c=1/(i-n),h=1/(o-a),f=(t+e)*u,p=(i+n)*c,d,g;if(s===zo)d=(o+a)*h,g=-2*h;else if(s===Rd)d=a*h,g=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-f,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}},cy=new be,Zl=new Zr,_Te=new be(0,0,0),xTe=new be(1,1,1),Sf=new be,QA=new be,ms=new be;var HQ=new Zr,WQ=new Vu,jl=(()=>{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],h=a[9],f=a[2],p=a[6],d=a[10];switch(i){case"XYZ":this._y=Math.asin(rn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-rn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(l,d),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-f,o),this._z=0);break;case"ZXY":this._x=Math.asin(rn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-rn(f,-1,1)),Math.abs(f)<.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(rn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(l,d));break;case"XZY":this._z=Math.asin(-rn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-h,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 HQ.makeRotationFromQuaternion(t),this.setFromRotationMatrix(HQ,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return WQ.setFromEuler(this),this.setFromQuaternion(WQ,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 hy=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<{class r extends Fo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:STe++}),this.uuid=Bu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new be,i=new jl,n=new Vu,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 Zr},normalMatrix:{value:new rr}}),this.matrix=new Zr,this.matrixWorld=new Zr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new hy,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 fy.setFromAxisAngle(t,i),this.quaternion.multiply(fy),this}rotateOnWorldAxis(t,i){return fy.setFromAxisAngle(t,i),this.quaternion.premultiply(fy),this}rotateX(t){return this.rotateOnAxis(YQ,t)}rotateY(t){return this.rotateOnAxis(qQ,t)}rotateZ(t){return this.rotateOnAxis(ZQ,t)}translateOnAxis(t,i){return XQ.copy(t).applyQuaternion(this.quaternion),this.position.add(XQ.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(YQ,t)}translateY(t){return this.translateOnAxis(qQ,t)}translateZ(t){return this.translateOnAxis(ZQ,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Nc.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?eC.copy(t):eC.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),QS.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Nc.lookAt(QS,eC,this.up):Nc.lookAt(eC,QS,this.up),this.quaternion.setFromRotationMatrix(Nc),a&&(Nc.extractRotation(a.matrixWorld),fy.setFromRotationMatrix(Nc),this.quaternion.premultiply(fy.invert()))}add(t){if(arguments.length>1){for(let i=0;i1){for(let n=0;n0&&(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,h=u.length;c0){a.children=[];for(let l=0;l0){a.animations=[];for(let l=0;l0&&(n.geometries=l),u.length>0&&(n.materials=u),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),f.length>0&&(n.shapes=f),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 h=l[c];delete h.metadata,u.push(h)}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;n0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){Kl.subVectors(n,t),Uc.subVectors(i,t),tF.subVectors(e,t);let o=Kl.dot(Kl),s=Kl.dot(Uc),l=Kl.dot(tF),u=Uc.dot(Uc),c=Uc.dot(tF),h=o*u-s*s;if(h===0)return a.set(0,0,0),null;let f=1/h,p=(u*l-s*c)*f,d=(o*c-s*l)*f;return a.set(1-p-d,d,p)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,Oc)===null?!1:Oc.x>=0&&Oc.y>=0&&Oc.x+Oc.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,Oc)===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,Oc.x),l.addScaledVector(o,Oc.y),l.addScaledVector(s,Oc.z),l)}static isFrontFacing(e,t,i,n){return Kl.subVectors(i,t),Uc.subVectors(e,t),Kl.cross(Uc).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 Kl.subVectors(this.c,this.b),Uc.subVectors(this.a,this.b),Kl.cross(Uc).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;py.subVectors(n,i),dy.subVectors(a,i),rF.subVectors(e,i);let l=py.dot(rF),u=dy.dot(rF);if(l<=0&&u<=0)return t.copy(i);iF.subVectors(e,n);let c=py.dot(iF),h=dy.dot(iF);if(c>=0&&h<=c)return t.copy(n);let f=l*h-c*u;if(f<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(py,o);nF.subVectors(e,a);let p=py.dot(nF),d=dy.dot(nF);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(dy,s);let m=c*d-p*h;if(m<=0&&h-c>=0&&p-d>=0)return jQ.subVectors(a,n),s=(h-c)/(h-c+(p-d)),t.copy(n).addScaledVector(jQ,s);let v=1/(m+g+f);return o=g*v,s=f*v,t.copy(i).addScaledVector(py,o).addScaledVector(dy,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var KQ={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},Mf={h:0,s:0,l:0},tC={h:0,s:0,l:0};function aF(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 or=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=Uo){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Lr.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=Lr.workingColorSpace){return this.r=e,this.g=t,this.b=i,Lr.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=Lr.workingColorSpace){if(e=OQ(e,1),t=rn(t,0,1),i=rn(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=aF(o,a,e+1/3),this.g=aF(o,a,e),this.b=aF(o,a,e-1/3)}return Lr.toWorkingColorSpace(this,n),this}setStyle(e,t=Uo){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=Uo){let i=KQ[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=vf(e.r),this.g=vf(e.g),this.b=vf(e.b),this}copyLinearToSRGB(e){return this.r=WA(e.r),this.g=WA(e.g),this.b=WA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Uo){return Lr.fromWorkingColorSpace(ia.copy(this),e),Math.round(rn(ia.r*255,0,255))*65536+Math.round(rn(ia.g*255,0,255))*256+Math.round(rn(ia.b*255,0,255))}getHexString(e=Uo){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Lr.workingColorSpace){Lr.fromWorkingColorSpace(ia.copy(this),t);let i=ia.r,n=ia.g,a=ia.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 h=o-s;switch(u=c<=.5?h/(o+s):h/(2-o-s),o){case i:l=(n-a)/h+(n0!=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!==Cc&&(i.blending=this.blending),this.side!==hs&&(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!==GS&&(i.blendSrc=this.blendSrc),this.blendDst!==HS&&(i.blendDst=this.blendDst),this.blendEquation!==Rc&&(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!==Zg&&(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!==Vz&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Cd&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Cd&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Cd&&(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 zc=class extends Gu{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new or(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 jl,this.combine=TA,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 Hi=new be,rC=new Qt,Ca=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=Gz,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=No,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return BQ("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;n0&&(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 h=0,f=u.length;h0&&(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=[],h=a[u];for(let f=0,p=h.length;f0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a(e.far-e.near)**2))&&(JQ.copy(a).invert(),Id.copy(e.ray).applyMatrix4(JQ),!(i.boundingBox!==null&&Id.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Id)))}_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,h=a.attributes.normal,f=a.groups,p=a.drawRange;if(s!==null)if(Array.isArray(o))for(let d=0,g=f.length;dt.far?null:{distance:u,point:uC.clone(),object:r}}function cC(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,yy),r.getVertexPosition(l,_y),r.getVertexPosition(u,xy);let c=CTe(r,e,t,i,yy,_y,xy,lC);if(c){n&&(aC.fromBufferAttribute(n,s),oC.fromBufferAttribute(n,l),sC.fromBufferAttribute(n,u),c.uv=Pd.getInterpolation(lC,yy,_y,xy,aC,oC,sC,new Qt)),a&&(aC.fromBufferAttribute(a,s),oC.fromBufferAttribute(a,l),sC.fromBufferAttribute(a,u),c.uv1=Pd.getInterpolation(lC,yy,_y,xy,aC,oC,sC,new Qt)),o&&(QQ.fromBufferAttribute(o,s),eee.fromBufferAttribute(o,l),tee.fromBufferAttribute(o,u),c.normal=Pd.getInterpolation(lC,yy,_y,xy,QQ,eee,tee,new be),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let h={a:s,b:l,c:u,normal:new be,materialIndex:0};Pd.getNormal(yy,_y,xy,h.normal),c.face=h}return c}var bf=class r extends Vo{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=[],h=[],f=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 na(u,3)),this.setAttribute("normal",new na(c,3)),this.setAttribute("uv",new na(h,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,P=w+1,U=T+1,B=0,z=0,k=new be;for(let G=0;G0?1:-1,c.push(k.x,k.y,k.z),h.push(J/w),h.push(1-G/T),B+=1}}for(let G=0;G0&&(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 Sy=class extends nn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Zr,this.projectionMatrix=new Zr,this.projectionMatrixInverse=new Zr,this.coordinateSystem=zo}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 wf=new be,oee=new Qt,see=new Qt,Wi=class extends Sy{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=jS*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(kA*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return jS*2*Math.atan(Math.tan(kA*.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){wf.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(wf.x,wf.y).multiplyScalar(-e/wf.z),wf.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(wf.x,wf.y).multiplyScalar(-e/wf.z)}getViewSize(e,t){return this.getViewBounds(e,oee,see),t.subVectors(see,oee)}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(kA*.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 My=-90,by=1,fC=class extends nn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Wi(My,by,e,t);n.layers=this.layers,this.add(n);let a=new Wi(My,by,e,t);a.layers=this.layers,this.add(a);let o=new Wi(My,by,e,t);o.layers=this.layers,this.add(o);let s=new Wi(My,by,e,t);s.layers=this.layers,this.add(s);let l=new Wi(My,by,e,t);l.layers=this.layers,this.add(l);let u=new Wi(My,by,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===zo)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===Rd)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,h=e.getRenderTarget(),f=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(h,f,p),e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}};var wy=class extends Bo{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:Wl,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 pC=class extends ko{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 wy(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:tn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},n=new bf(5,5,5),a=new Ra({name:"CubemapFromEquirect",uniforms:Fc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:bi,blending:el});a.uniforms.tEquirect.value=t;let o=new an(n,a),s=t.minFilter;return t.minFilter===Xl&&(t.minFilter=tn),new fC(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 lF=new be,RTe=new be,LTe=new rr,Jl=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=lF.subVectors(i,t).cross(RTe.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(lF),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||LTe.getNormalMatrix(e),n=this.coplanarPoint(lF).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 Nd=new _f,dC=new be,Tf=class{constructor(e=new Jl,t=new Jl,i=new Jl,n=new Jl,a=new Jl,o=new Jl){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=zo){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],h=n[6],f=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,f-u,m-p,x-v).normalize(),i[1].setComponents(l+a,f+u,m+p,x+v).normalize(),i[2].setComponents(l+o,f+c,m+d,x+_).normalize(),i[3].setComponents(l-o,f-c,m-d,x-_).normalize(),i[4].setComponents(l-s,f-h,m-g,x-y).normalize(),t===zo)i[5].setComponents(l+s,f+h,m+g,x+y).normalize();else if(t===Rd)i[5].setComponents(s,h,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(),Nd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Nd.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Nd)}intersectsSprite(e){return Nd.center.set(0,0,0),Nd.radius=.7071067811865476,Nd.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nd)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(i)0?e.max.x:e.min.x,dC.y=n.normal.y>0?e.max.y:e.min.y,dC.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(dC)<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 mC(){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 lee(r,e){let t=e.isWebGL2,i=new WeakMap;function n(u,c){let h=u.array,f=u.usage,p=h.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,h,f),u.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(h 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(h instanceof Int16Array)g=r.SHORT;else if(h instanceof Uint32Array)g=r.UNSIGNED_INT;else if(h instanceof Int32Array)g=r.INT;else if(h instanceof Int8Array)g=r.BYTE;else if(h instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:d,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version,size:p}}function a(u,c,h){let f=c.array,p=c._updateRange,d=c.updateRanges;if(r.bindBuffer(h,u),p.count===-1&&d.length===0&&r.bufferSubData(h,0,f),d.length!==0){for(let g=0,m=d.length;g outsideIOR when thinFilmThickness -> 0.0 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); // Evaluate the cosTheta on the base layer (Snell law) float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); // Handle TIR: float cosTheta2Sq = 1.0 - sinTheta2Sq; if ( cosTheta2Sq < 0.0 ) { return vec3( 1.0 ); } float cosTheta2 = sqrt( cosTheta2Sq ); // First interface float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); float R12 = F_Schlick( R0, 1.0, cosTheta1 ); float T121 = 1.0 - R12; float phi12 = 0.0; if ( iridescenceIOR < outsideIOR ) phi12 = PI; float phi21 = PI - phi12; // Second interface vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0 vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); vec3 phi23 = vec3( 0.0 ); if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; // Phase shift float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; vec3 phi = vec3( phi21 ) + phi23; // Compound terms vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); vec3 r123 = sqrt( R123 ); vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); // Reflectance term for m = 0 (DC term amplitude) vec3 C0 = R12 + Rs; I = C0; // Reflectance term for m > 0 (pairs of diracs) vec3 Cm = Rs - T121; for ( int m = 1; m <= 2; ++ m ) { Cm *= r123; vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); I += Cm * Sm; } // Since out of gamut colors might be produced, negative color values are clamped to 0. return max( I, vec3( 0.0 ) ); } #endif `;var bee=` #ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2) vec2 dHdxy_fwd() { vec2 dSTdx = dFdx( vBumpMapUv ); vec2 dSTdy = dFdy( vBumpMapUv ); float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; return vec2( dBx, dBy ); } vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { // normalize is done to ensure that the bump map looks the same regardless of the texture's scale vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); vec3 vN = surf_norm; // normalized vec3 R1 = cross( vSigmaY, vN ); vec3 R2 = cross( vN, vSigmaX ); float fDet = dot( vSigmaX, R1 ) * faceDirection; vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } #endif `;var wee=` #if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif `;var Tee=` #if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif `;var Eee=` #if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif `;var Aee=` #if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif `;var Cee=` #if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif `;var Ree=` #if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif `;var Lee=` #if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif `;var Dee=` #if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif `;var Pee=` #define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate // may have defined saturate() already #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } // expects values in the range of [0,1]x[0,1], returns values in the [0,1] range. // do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { // dir can be either a direction vector or a normal vector // upper-left 3x3 of matrix is assumed to be orthogonal return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } float luminance( const in vec3 rgb ) { // assumes rgb is in linear color space with sRGB primaries and D65 white point const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { // dir is assumed to be unit length float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } // validated vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { // Original approximation by Christophe Schlick '94 // float fresnel = pow( 1.0 - dotVH, 5.0 ); // Optimized variant (presented by Epic at SIGGRAPH '13) // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { // Original approximation by Christophe Schlick '94 // float fresnel = pow( 1.0 - dotVH, 5.0 ); // Optimized variant (presented by Epic at SIGGRAPH '13) // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated `;var Iee=` #ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 // These shader functions convert between the UV coordinates of a single face of // a cubemap, the 0-5 integer index of a cube face, and the direction vector for // sampling a textureCube (not generally normalized ). float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } // RH coordinate system; PMREM face-indexing convention vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071 if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering #else return texture2D( envMap, uv ).rgb; #endif } // These defines must match with PMREMGenerator #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25 } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif `;var Nee=` vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING // this is in lieu of a per-instance normal-matrix // shear transforms in the instance matrix are not supported mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING // this is in lieu of a per-instance normal-matrix // shear transforms in the instance matrix are not supported mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif `;var Uee=` #ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif `;var Oee=` #ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif `;var zee=` #ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif `;var Fee=` #ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif `;var Bee=` gl_FragColor = linearToOutputTexel( gl_FragColor ); `;var kee=` // http://www.russellcottrell.com/photo/matrixCalculator.htm // Linear sRGB => XYZ => Linear Display P3 const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), vec3( 0.0170827, 0.0723974, 0.9105199 ) ); // Linear Display P3 => XYZ => Linear sRGB const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( vec3( 1.2249401, - 0.2249404, 0.0 ), vec3( - 0.0420569, 1.0420571, 0.0 ), vec3( - 0.0196376, - 0.0786361, 1.0982735 ) ); vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); } vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); } vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferOETF( in vec4 value ) { 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 ); } // @deprecated, r156 vec4 LinearToLinear( in vec4 value ) { return value; } // @deprecated, r156 vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); } `;var Vee=` #ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } // Transforming Normal Vectors with the Inverse Transformation vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif `;var Gee=` #ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif `;var Hee=` #ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif `;var Wee=` #ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif `;var Xee=` #ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif `;var Yee=` #ifdef USE_FOG vFogDepth = - mvPosition.z; #endif `;var qee=` #ifdef USE_FOG varying float vFogDepth; #endif `;var Zee=` #ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif `;var jee=` #ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif `;var Kee=` #ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { // dotNL will be from -1.0 to 1.0 float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif } `;var Jee=` #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif `;var $ee=` #ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif `;var Qee=` LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength; `;var ete=` varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert `;var tte=` uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif // get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere // source: https://graphics.stanford.edu/papers/envmap/envmap.pdf vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { // normal is assumed to have unit length float x = normal.x, y = normal.y, z = normal.z; // band 0 vec3 result = shCoefficients[ 0 ] * 0.886227; // band 1 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; // band 2 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { #if defined ( LEGACY_LIGHTS ) if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #else // based upon Frostbite 3 Moving to Physically-based Rendering // page 32, equation 26: E[window1] // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #endif } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; // light is an out parameter as having it as a return value caused compiler errors on some devices void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; // light is an out parameter as having it as a return value caused compiler errors on some devices void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; // Pre-computed values of LinearTransformedCosine approximation of BRDF // BRDF approximation Texture is 64x64 uniform sampler2D ltc_1; // RGBA Float uniform sampler2D ltc_2; // RGBA Float uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif `;var rte=` #ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif `;var ite=` ToonMaterial material; material.diffuseColor = diffuseColor.rgb; `;var nte=` varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; 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 ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon `;var ate=` BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength; `;var ote=` varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong `;var ste=` PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap. material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } // Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif `;var lte=` struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; // temporary vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2 // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } // Microfacet Models for Refraction through Rough Surfaces - equation (33) // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html // alpha is "roughness squared" in Disney\u2019s reparameterization float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1 return RECIPROCAL_PI * a2 / pow2( denom ); } // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf #ifdef USE_ANISOTROPY 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 ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); // UE4's roughness vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); // UE4's roughness vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } // Rect Area Light // Real-Time Polygonal-Light Shading with Linearly Transformed Cosines // by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt // code: https://github.com/selfshadow/ltc_code/ vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); // texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) ) vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { // Real-Time Area Lighting: a Journey from Research to Production (p.102) // An approximation of the form factor of a horizon-clipped rectangle. float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); // rational polynomial approximation to theta / sin( theta ) / 2PI float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { // bail if point is on back side of plane of light // assumes ccw winding order of light vertices vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); // construct orthonormal basis around N vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system // compute transform mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); // transform rect vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); // project rect onto sphere coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); // calculate vector form factor vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); // adjust for horizon clipping float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); /* // alternate method of adjusting for horizon clipping (see referece) // refactoring required float len = length( vectorFormFactor ); float z = vectorFormFactor.z / len; const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; // tabulated horizon-clipped sphere, apparently... vec2 uv = vec2( z * 0.5 + 0.5, len ); uv = uv * LUT_SCALE + LUT_BIAS; float scale = texture2D( ltc_2, uv ).w; float result = len * scale; */ return vec3( result ); } // End Rect Area Light #if defined( USE_SHEEN ) // https://github.com/google/filament/blob/master/shaders/src/brdf.fs float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF" float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } // https://github.com/google/filament/blob/master/shaders/src/brdf.fs float V_Neubelt( float dotNV, float dotNL ) { // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif // This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found // in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } // Analytical approximation of the DFG LUT, one half of the // split-sum approximation used in indirect specular lighting. // via 'environmentBRDF' from "Physically Based Shading on Mobile" // https://www.unrealengine.com/blog/physically-based-shading-on-mobile vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } // Fdez-Ag\xFCera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting" // Approximates multiscattering in order to preserve energy. // http://www.jcgt.org/published/0008/01/03/ #ifdef USE_IRIDESCENCE 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 ) { #else 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 ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21 vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 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 ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); // LTC Fresnel Approximation by Stephen Hill // http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif // Both indirect specular and indirect diffuse light accumulate here vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical // ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); } `;var ute=` /** * This is a template that can be used to light a material, it uses pluggable * RenderEquations (RE)for specific lighting scenarios. * * Instructions for use: * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined * - Create a material parameter that is to be passed as the third parameter to your lighting functions. * * TODO: * - Add area light support. * - Add sphere light support. * - Add diffuse light probe (irradiance cubemap) support. */ vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); // Iridescence F0 approximation material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); // spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none] #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif `;var cte=` #if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif `;var hte=` #if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif `;var fte=` #if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) // Doing a strict comparison with == 1.0 can cause noise artifacts // on some platforms. See issue #17623. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif `;var pte=` #if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif `;var dte=` #ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif `;var mte=` #ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif `;var vte=` #ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE // use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516) 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 ); #endif diffuseColor *= sampledDiffuseColor; #endif `;var gte=` #ifdef USE_MAP uniform sampler2D map; #endif `;var yte=` #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif `;var _te=` #if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif `;var xte=` float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture metalnessFactor *= texelMetalness.b; #endif `;var Ste=` #ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif `;var Mte=` #ifdef USE_INSTANCING_MORPH float morphTargetInfluences[MORPHTARGETS_COUNT]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif `;var bte=` #if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence) // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif `;var wte=` #ifdef USE_MORPHNORMALS // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence) // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #else objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif #endif `;var Tte=` #ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; #endif #ifdef MORPHTARGETS_TEXTURE #ifndef USE_INSTANCING_MORPH uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #else #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif #endif `;var Ete=` #ifdef USE_MORPHTARGETS // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence) // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #else transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif #endif `;var Ate=` float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif // non perturbed normal for clearcoat among others vec3 nonPerturbedNormal = normal; `;var Cte=` #ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif `;var Rte=` #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif `;var Lte=` #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif `;var Dte=` #ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif `;var Pte=` #ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) // Normal Mapping Without Precomputed Tangents // http://www.thetenthplanet.de/archives/1180 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; // normalized vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif `;var Ite=` #ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif `;var Nte=` #ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif `;var Ute=` #ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif `;var Ote=` #ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif `;var zte=` #ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a ); `;var Fte=` vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1) const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1) const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; // tidy overflow return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec2 packDepthToRG( in highp float v ) { return packDepthToRGBA( v ).yx; } float unpackRGToDepth( const in highp vec2 v ) { return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); } vec4 pack2HalfToRGBA( vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } // NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { // -near maps to 0; -far maps to 1 return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { // maps orthographic depth in [ 0, 1 ] to viewZ return depth * ( near - far ) - near; } // NOTE: https://twitter.com/gonnavis/status/1377183786949959682 float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { // -near maps to 0; -far maps to 1 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { // maps perspective depth in [ 0, 1 ] to viewZ return ( near * far ) / ( ( far - near ) * depth - far ); } `;var Bte=` #ifdef PREMULTIPLIED_ALPHA // Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation. gl_FragColor.rgb *= gl_FragColor.a; #endif `;var kte=` vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition; `;var Vte=` #ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif `;var Gte=` #ifdef DITHERING // based on https://www.shadertoy.com/view/MslGR8 vec3 dithering( vec3 color ) { //Calculate grid position float grid_position = rand( gl_FragCoord.xy ); //Shift the individual colors differently, thus making it even harder to see the dithering pattern vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); //modify shift according to grid position. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); //shift the color by dither_shift return color + dither_shift_RGB; } #endif `;var Hte=` float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture roughnessFactor *= texelRoughness.g; #endif `;var Wte=` #ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif `;var Xte=` #if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif /* #if NUM_RECT_AREA_LIGHTS > 0 // TODO (abelnation): create uniforms for area light shadows #endif */ float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); // Hard Shadow if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else // no percentage-closer filtering: shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return shadow; } // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D // vector suitable for 2D texture mapping. This code uses the following layout for the // 2D texture: // // xzXZ // y Y // // Y - Positive y direction // y - Negative y direction // X - Positive x direction // x - Negative x direction // Z - Positive z direction // z - Negative z direction // // Source and test bed: // https://gist.github.com/tschw/da10c43c467ce8afd0c4 vec2 cubeToUV( vec3 v, float texelSizeY ) { // Number of texels to avoid at the edge of each square vec3 absV = abs( v ); // Intersect unit cube float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; // Apply scale to avoid seams // two texels less per square (one texel will do for NEAREST) v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); // Unwrap // space: -1 ... 1 range for each square // // #X## dim := ( 4 , 2 ) // # # center := ( 1 , 1 ) vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } // Transform to UV space // scale := 0.5 / dim // translate := ( center + 0.5 ) / dim return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); // for point lights, the uniform @vShadowCoord is re-purposed to hold // the vector from the light to the world-space position of the fragment. vec3 lightToPosition = shadowCoord.xyz; // dp = normalized distance from light to fragment position float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp? dp += shadowBias; // bd3D = base direction 3D vec3 bd3D = normalize( lightToPosition ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else // no percentage-closer filtering return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif `;var Yte=` #if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif /* #if NUM_RECT_AREA_LIGHTS > 0 // TODO (abelnation): uniforms for area light shadows #endif */ #endif `;var qte=` #if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) // Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif /* #if NUM_RECT_AREA_LIGHTS > 0 // TODO (abelnation): update vAreaShadowCoord with area light info #endif */ #endif // spot lights can be evaluated without active shadow mapping (when SpotLight.map is used) #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif `;var Zte=` float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif /* #if NUM_RECT_AREA_LIGHTS > 0 // TODO (abelnation): update shadow for Area light #endif */ #endif return shadow; } `;var jte=` #ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif `;var Kte=` #ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif `;var Jte=` #ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif `;var $te=` #ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif `;var Qte=` float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif `;var ere=` #ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif `;var tre=` #if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif `;var rre=` #ifndef saturate // may have defined saturate() already #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; // exposure only vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } // source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } // source: http://filmicworlds.com/blog/filmic-tonemapping-operators/ vec3 OptimizedCineonToneMapping( vec3 color ) { // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } // source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } // this implementation of ACES is modified to accommodate a brighter viewing environment. // the scale factor of 1/0.6 is subjective. see discussion in #19621. vec3 ACESFilmicToneMapping( vec3 color ) { // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); // ODT_SAT => XYZ => D60_2_D65 => sRGB const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; // Apply RRT and ODT color = RRTAndODTFit( color ); color = ACESOutputMat * color; // Clamp to [0, 1] return saturate( color ); } // Matrices for rec 2020 <> rec 709 color space conversion // matrix provided in row-major order so it has been transposed // https://www.itu.int/pub/R-REP-BT.2407-2017 const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); // https://iolite-engine.com/blog_posts/minimal_agx_implementation // Mean error^2: 3.6705141e-06 vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } // AgX Tone Mapping implementation based on Filament, which in turn is based // on Blender's implementation using rec 2020 primaries // https://github.com/google/filament/pull/7236 // Inputs and outputs are encoded as Linear-sRGB. vec3 AgXToneMapping( vec3 color ) { // AgX constants const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); // explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); // LOG2_MIN = -10.0 // LOG2_MAX = +6.5 // MIDDLE_GRAY = 0.18 const float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY ) const float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY ) color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; // Log2 encoding color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2 color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); // Apply sigmoid color = agxDefaultContrastApprox( color ); // Apply AgX look // v = agxLook(v, look); color = AgXOutsetMatrix * color; // Linearize color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; // Gamut mapping. Simple clamp for now. color = clamp( color, 0.0, 1.0 ); return color; } // https://modelviewer.dev/examples/tone-mapping vec3 NeutralToneMapping( vec3 color ) { float startCompression = 0.8 - 0.04; float desaturation = 0.15; color *= toneMappingExposure; float x = min(color.r, min(color.g, color.b)); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max(color.r, max(color.g, color.b)); if (peak < startCompression) return color; float d = 1. - startCompression; float newPeak = 1. - d * d / (peak + d - startCompression); color *= newPeak / peak; float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.); return mix(color, vec3(1, 1, 1), g); } vec3 CustomToneMapping( vec3 color ) { return color; } `;var ire=` #ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif `;var nre=` #ifdef USE_TRANSMISSION // Transmission code is based on glTF-Sampler-Viewer // https://github.com/KhronosGroup/glTF-Sample-Viewer uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; // Mipped Bicubic Texture Filtering by N8 // https://www.shadertoy.com/view/Dl2SDW float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } // g0 and g1 are the two amplitude functions float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } // h0 and h1 are the two offset functions float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { // Direction of refracted light. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); // Compute rotation-independant scaling of the model matrix. vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); // The thickness is specified in local space. return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and // an IOR of 1.5 results in the default amount of microfacet refraction. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { // Attenuation distance is +\u221E, i.e. the transmitted color is not attenuated at all. return vec3( 1.0 ); } else { // Compute light attenuation using Beer's law. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; // Sample framebuffer to get pixel the refracted ray hits. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); vec3 attenuatedColor = transmittance * transmittedLight.rgb; // Get the specular component. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); // As less light is transmitted, the opacity should be increased. This simple approximation does a decent job // of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif `;var are=` #if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif `;var ore=` #if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif `;var sre=` #if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif `;var lre=` #if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif `;var ure=` varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); } `,cre=` uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE // use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures 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 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include } `;var hre=` varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; // set z to camera.far } `,fre=` #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include } `;var pre=` varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; // set z to camera.far } `,dre=` uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include } `;var mre=` #include #include #include #include #include #include #include #include // This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible. // Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for // depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1. varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; } `,vre=` #if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include // Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif } `;var gre=` #define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; } `,yre=` #define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); // clamp to [ 0, 1 ] gl_FragColor = packDepthToRGBA( dist ); } `;var _re=` varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,xre=` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include } `;var Sre=` uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include } `,Mre=` uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; // simple shader #include #include #include #include #include } `;var bre=` #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include } `,wre=` uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); // accumulation (baked indirect lighting only) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif // modulation #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include } `;var Tre=` #define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include } `,Ere=` #define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include // accumulation #include #include #include #include // modulation #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include } `;var Are=` #define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; } `,Cre=` #define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include } `;var Rre=` #define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif } `,Lre=` #define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif } `;var Dre=` #define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include } `,Pre=` #define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include // accumulation #include #include #include #include // modulation #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include } `;var Ire=` #define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif } `,Nre=` #define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include // accumulation #include #include #include #include // modulation #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN // Sheen energy compensation approximation calculation can be found at the end of // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include } `;var Ure=` #define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include } `,Ore=` #define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include // accumulation #include #include #include #include // modulation #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include } `;var zre=` uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include } `,Fre=` uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include } `;var Bre=` #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include } `,kre=` uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include } `;var Vre=` uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include } `,Gre=` uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include } `;var mr={alphahash_fragment:uee,alphahash_pars_fragment:cee,alphamap_fragment:hee,alphamap_pars_fragment:fee,alphatest_fragment:pee,alphatest_pars_fragment:dee,aomap_fragment:mee,aomap_pars_fragment:vee,batching_pars_vertex:gee,batching_vertex:yee,begin_vertex:_ee,beginnormal_vertex:xee,bsdfs:See,iridescence_fragment:Mee,bumpmap_pars_fragment:bee,clipping_planes_fragment:wee,clipping_planes_pars_fragment:Tee,clipping_planes_pars_vertex:Eee,clipping_planes_vertex:Aee,color_fragment:Cee,color_pars_fragment:Ree,color_pars_vertex:Lee,color_vertex:Dee,common:Pee,cube_uv_reflection_fragment:Iee,defaultnormal_vertex:Nee,displacementmap_pars_vertex:Uee,displacementmap_vertex:Oee,emissivemap_fragment:zee,emissivemap_pars_fragment:Fee,colorspace_fragment:Bee,colorspace_pars_fragment:kee,envmap_fragment:Vee,envmap_common_pars_fragment:Gee,envmap_pars_fragment:Hee,envmap_pars_vertex:Wee,envmap_physical_pars_fragment:rte,envmap_vertex:Xee,fog_vertex:Yee,fog_pars_vertex:qee,fog_fragment:Zee,fog_pars_fragment:jee,gradientmap_pars_fragment:Kee,lightmap_fragment:Jee,lightmap_pars_fragment:$ee,lights_lambert_fragment:Qee,lights_lambert_pars_fragment:ete,lights_pars_begin:tte,lights_toon_fragment:ite,lights_toon_pars_fragment:nte,lights_phong_fragment:ate,lights_phong_pars_fragment:ote,lights_physical_fragment:ste,lights_physical_pars_fragment:lte,lights_fragment_begin:ute,lights_fragment_maps:cte,lights_fragment_end:hte,logdepthbuf_fragment:fte,logdepthbuf_pars_fragment:pte,logdepthbuf_pars_vertex:dte,logdepthbuf_vertex:mte,map_fragment:vte,map_pars_fragment:gte,map_particle_fragment:yte,map_particle_pars_fragment:_te,metalnessmap_fragment:xte,metalnessmap_pars_fragment:Ste,morphinstance_vertex:Mte,morphcolor_vertex:bte,morphnormal_vertex:wte,morphtarget_pars_vertex:Tte,morphtarget_vertex:Ete,normal_fragment_begin:Ate,normal_fragment_maps:Cte,normal_pars_fragment:Rte,normal_pars_vertex:Lte,normal_vertex:Dte,normalmap_pars_fragment:Pte,clearcoat_normal_fragment_begin:Ite,clearcoat_normal_fragment_maps:Nte,clearcoat_pars_fragment:Ute,iridescence_pars_fragment:Ote,opaque_fragment:zte,packing:Fte,premultiplied_alpha_fragment:Bte,project_vertex:kte,dithering_fragment:Vte,dithering_pars_fragment:Gte,roughnessmap_fragment:Hte,roughnessmap_pars_fragment:Wte,shadowmap_pars_fragment:Xte,shadowmap_pars_vertex:Yte,shadowmap_vertex:qte,shadowmask_pars_fragment:Zte,skinbase_vertex:jte,skinning_pars_vertex:Kte,skinning_vertex:Jte,skinnormal_vertex:$te,specularmap_fragment:Qte,specularmap_pars_fragment:ere,tonemapping_fragment:tre,tonemapping_pars_fragment:rre,transmission_fragment:ire,transmission_pars_fragment:nre,uv_pars_fragment:are,uv_pars_vertex:ore,uv_vertex:sre,worldpos_vertex:lre,background_vert:ure,background_frag:cre,backgroundCube_vert:hre,backgroundCube_frag:fre,cube_vert:pre,cube_frag:dre,depth_vert:mre,depth_frag:vre,distanceRGBA_vert:gre,distanceRGBA_frag:yre,equirect_vert:_re,equirect_frag:xre,linedashed_vert:Sre,linedashed_frag:Mre,meshbasic_vert:bre,meshbasic_frag:wre,meshlambert_vert:Tre,meshlambert_frag:Ere,meshmatcap_vert:Are,meshmatcap_frag:Cre,meshnormal_vert:Rre,meshnormal_frag:Lre,meshphong_vert:Dre,meshphong_frag:Pre,meshphysical_vert:Ire,meshphysical_frag:Nre,meshtoon_vert:Ure,meshtoon_frag:Ore,points_vert:zre,points_frag:Fre,shadow_vert:Bre,shadow_frag:kre,sprite_vert:Vre,sprite_frag:Gre};var vt={common:{diffuse:{value:new or(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rr},alphaMap:{value:null},alphaMapTransform:{value:new rr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rr}},envmap:{envMap:{value:null},envMapRotation:{value:new rr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new rr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rr},normalScale:{value:new Qt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new or(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 or(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rr},alphaTest:{value:0},uvTransform:{value:new rr}},sprite:{diffuse:{value:new or(16777215)},opacity:{value:1},center:{value:new Qt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rr},alphaMap:{value:null},alphaMapTransform:{value:new rr},alphaTest:{value:0}}};var al={basic:{uniforms:aa([vt.common,vt.specularmap,vt.envmap,vt.aomap,vt.lightmap,vt.fog]),vertexShader:mr.meshbasic_vert,fragmentShader:mr.meshbasic_frag},lambert:{uniforms:aa([vt.common,vt.specularmap,vt.envmap,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.fog,vt.lights,{emissive:{value:new or(0)}}]),vertexShader:mr.meshlambert_vert,fragmentShader:mr.meshlambert_frag},phong:{uniforms:aa([vt.common,vt.specularmap,vt.envmap,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.fog,vt.lights,{emissive:{value:new or(0)},specular:{value:new or(1118481)},shininess:{value:30}}]),vertexShader:mr.meshphong_vert,fragmentShader:mr.meshphong_frag},standard:{uniforms:aa([vt.common,vt.envmap,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.roughnessmap,vt.metalnessmap,vt.fog,vt.lights,{emissive:{value:new or(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:mr.meshphysical_vert,fragmentShader:mr.meshphysical_frag},toon:{uniforms:aa([vt.common,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.gradientmap,vt.fog,vt.lights,{emissive:{value:new or(0)}}]),vertexShader:mr.meshtoon_vert,fragmentShader:mr.meshtoon_frag},matcap:{uniforms:aa([vt.common,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.fog,{matcap:{value:null}}]),vertexShader:mr.meshmatcap_vert,fragmentShader:mr.meshmatcap_frag},points:{uniforms:aa([vt.points,vt.fog]),vertexShader:mr.points_vert,fragmentShader:mr.points_frag},dashed:{uniforms:aa([vt.common,vt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:mr.linedashed_vert,fragmentShader:mr.linedashed_frag},depth:{uniforms:aa([vt.common,vt.displacementmap]),vertexShader:mr.depth_vert,fragmentShader:mr.depth_frag},normal:{uniforms:aa([vt.common,vt.bumpmap,vt.normalmap,vt.displacementmap,{opacity:{value:1}}]),vertexShader:mr.meshnormal_vert,fragmentShader:mr.meshnormal_frag},sprite:{uniforms:aa([vt.sprite,vt.fog]),vertexShader:mr.sprite_vert,fragmentShader:mr.sprite_frag},background:{uniforms:{uvTransform:{value:new rr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:mr.background_vert,fragmentShader:mr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new rr}},vertexShader:mr.backgroundCube_vert,fragmentShader:mr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:mr.cube_vert,fragmentShader:mr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:mr.equirect_vert,fragmentShader:mr.equirect_frag},distanceRGBA:{uniforms:aa([vt.common,vt.displacementmap,{referencePosition:{value:new be},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:mr.distanceRGBA_vert,fragmentShader:mr.distanceRGBA_frag},shadow:{uniforms:aa([vt.lights,vt.fog,{color:{value:new or(0)},opacity:{value:1}}]),vertexShader:mr.shadow_vert,fragmentShader:mr.shadow_frag}};al.physical={uniforms:aa([al.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rr},clearcoatNormalScale:{value:new Qt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rr},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rr},sheen:{value:0},sheenColor:{value:new or(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rr},transmissionSamplerSize:{value:new Qt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rr},attenuationDistance:{value:0},attenuationColor:{value:new or(0)},specularColor:{value:new or(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rr},anisotropyVector:{value:new Qt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rr}}]),vertexShader:mr.meshphysical_vert,fragmentShader:mr.meshphysical_frag};var vC={r:0,b:0,g:0},Ud=new jl,ZTe=new Zr;function Hre(r,e,t,i,n,a,o){let s=new or(0),l=a===!0?0:1,u,c,h=null,f=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===mf)?(c===void 0&&(c=new an(new bf(1,1,1),new Ra({name:"BackgroundCubeMaterial",uniforms:Fc(al.backgroundCube.uniforms),vertexShader:al.backgroundCube.vertexShader,fragmentShader:al.backgroundCube.fragmentShader,side:bi,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)),Ud.copy(v.backgroundRotation),Ud.x*=-1,Ud.y*=-1,Ud.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ud.y*=-1,Ud.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(ZTe.makeRotationFromEuler(Ud)),c.material.toneMapped=Lr.getTransfer(y.colorSpace)!==qr,(h!==y||f!==y.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,h=y,f=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 an(new Ty(2,2),new Ra({name:"BackgroundMaterial",uniforms:Fc(al.background.uniforms),vertexShader:al.background.vertexShader,fragmentShader:al.background.fragmentShader,side:hs,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=Lr.getTransfer(y.colorSpace)!==qr,y.matrixAutoUpdate===!0&&y.updateMatrix(),u.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||f!==y.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,h=y,f=y.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null))}function g(m,v){m.getRGB(vC,hC(r)),i.buffers.color.setClear(vC.r,vC.g,vC.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 Wre(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 h(A,P,U,B,z){let k=!1;if(o){let G=g(B,U,P);u!==G&&(u=G,p(u.object)),k=v(A,B,U,z),k&&_(A,B,U,z)}else{let G=P.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,P,U,B),z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function f(){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,P,U){let B=U.wireframe===!0,z=s[A.id];z===void 0&&(z={},s[A.id]=z);let k=z[P.id];k===void 0&&(k={},z[P.id]=k);let G=k[B];return G===void 0&&(G=m(f()),k[B]=G),G}function m(A){let P=[],U=[],B=[];for(let z=0;z=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,P,U,B){let z={},k=P.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 P=0,U=A.length;P=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===AA);if(Q.isInterleavedBufferAttribute){let q=Q.data,H=q.stride,We=Q.offset;if(q.isInstancedInterleavedBuffer){for(let _e=0;_e0&&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,h=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=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=f>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:h,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:S}}function qre(r){let e=this,t=null,i=0,n=!1,a=!1,o=new Jl,s=new rr,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){let p=h.length!==0||f||i!==0||n;return n=f,i=h.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(h,f){t=c(h,f,0)},this.setState=function(h,f,p){let d=h.clippingPlanes,g=h.clipIntersection,m=h.clipShadows,v=r.get(h);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,f,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(h,f,p,d){let g=h!==null?h.length:0,m=null;if(g!==0){if(m=l.value,d!==!0||m===null){let v=p+g*4,_=f.matrixWorldInverse;s.getNormalMatrix(_),(m===null||m.length0){let u=new pC(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 Ey=class extends Sy{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 Cy=4,jre=[.125,.215,.35,.446,.526,.582],zd=20,uF=new Ey,Kre=new or,cF=null,hF=0,fF=0,Od=(1+Math.sqrt(5))/2,Ay=1/Od,Jre=[new be(1,1,1),new be(-1,1,1),new be(1,1,-1),new be(-1,1,-1),new be(0,Od,Ay),new be(0,Od,-Ay),new be(Ay,0,Od),new be(-Ay,0,Od),new be(Od,Ay,0),new be(-Od,Ay,0)],tM=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){cF=this._renderer.getRenderTarget(),hF=this._renderer.getActiveCubeFace(),fF=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=eie(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Qre(),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;e2?y:0,y,y),c.setRenderTarget(n),g&&c.render(d,s),c.render(e,s)}d.geometry.dispose(),d.material.dispose(),c.toneMapping=f,c.autoClear=h,e.background=m}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===Wl||e.mapping===zu;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=eie()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Qre());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new an(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;gC(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,uF)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;nzd&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${zd}`);let v=[],_=0;for(let w=0;wy-Cy?n-y+Cy:0),S=4*(this._cubeSize-x);gC(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(h,uF)}};function jTe(r){let e=[],t=[],i=[],n=r,a=r-Cy+1+jre.length;for(let o=0;or-Cy?l=jre[o-r+Cy-1]:o===0&&(l=0),i.push(l);let u=1/(s-2),c=-u,h=1+u,f=[c,c,h,c,h,h,c,c,h,h,c,h],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;S2?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(f,m*d*S);let b=[S,S,S,S,S,S];x.set(b,v*d*S)}let M=new Vo;M.setAttribute("position",new Ca(_,g)),M.setAttribute("uv",new Ca(y,m)),M.setAttribute("faceIndex",new Ca(x,v)),e.push(M),n>Cy&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function $re(r,e,t){let i=new ko(r,e,t);return i.texture.mapping=mf,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function gC(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function KTe(r,e,t){let i=new Float32Array(zd),n=new be(0,1,0);return new Ra({name:"SphericalGaussianBlur",defines:{n:zd,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:pF(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:el,depthTest:!1,depthWrite:!1})}function Qre(){return new Ra({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:pF(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:el,depthTest:!1,depthWrite:!1})}function eie(){return new Ra({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:pF(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:el,depthTest:!1,depthWrite:!1})}function pF(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function tie(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===WS||l===XS,c=l===Wl||l===zu;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let h=e.get(s);return t===null&&(t=new tM(r)),h=u?t.fromEquirectangular(s,h):t.fromCubemap(s,h),e.set(s,h),h.texture}else{if(e.has(s))return e.get(s).texture;{let h=s.image;if(u&&h&&h.height>0||c&&h&&n(h)){t===null&&(t=new tM(r));let f=u?t.fromEquirectangular(s):t.fromCubemap(s);return e.set(s,f),s.addEventListener("dispose",a),f.texture}else return null}}}return s}function n(s){let l=0,u=6;for(let c=0;ce.maxTextureSize&&(C=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);let b=new Float32Array(T*C*4*g),E=new oy(b,T,C,g);E.type=No,E.needsUpdate=!0;let I=w*4;for(let A=0;A0)return r;let n=e*t,a=lie[n];if(a===void 0&&(a=new Float32Array(n),lie[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 on(r,e){if(r.length!==e.length)return!1;for(let t=0,i=r.length;t":" "} ${s}: ${t[o]}`)}return i.join(` `)}function HEe(r){let e=Lr.getPrimaries(Lr.workingColorSpace),t=Lr.getPrimaries(r),i;switch(e===t?i="":e===ey&&t===Qg?i="LinearDisplayP3ToLinearSRGB":e===Qg&&t===ey&&(i="LinearSRGBToLinearDisplayP3"),r){case Oo:case Ad:return[i,"LinearTransferOETF"];case Uo:case Jg:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function _ie(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()+` `+n+` `+GEe(r.getShaderSource(e),o)}else return n}function WEe(r,e){let t=HEe(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function XEe(r,e){let t;switch(e){case cQ:t="Linear";break;case hQ:t="Reinhard";break;case fQ:t="OptimizedCineon";break;case pQ:t="ACESFilmic";break;case mQ:t="AgX";break;case vQ:t="Neutral";break;case dQ:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function YEe(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(Dy).join(` `)}function qEe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Dy).join(` `)}function ZEe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` `)}function jEe(r,e){let t={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let n=0;n/gm;function _F(r){return r.replace(KEe,$Ee)}var JEe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function $Ee(r,e){let t=mr[e];if(t===void 0){let i=JEe.get(e);if(i!==void 0)t=mr[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 _F(t)}var QEe=/#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 Mie(r){return r.replace(QEe,eAe)}function eAe(r,e,t,i){let n="";for(let a=parseInt(e);a0&&(v+=` `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Dy).join(` `),_.length>0&&(_+=` `)):(v=[bie(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",` `].filter(Dy).join(` `),_=[p,bie(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 "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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!==tl?"#define TONE_MAPPING":"",t.toneMapping!==tl?mr.tonemapping_pars_fragment:"",t.toneMapping!==tl?XEe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",mr.colorspace_pars_fragment,WEe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Dy).join(` `)),o=_F(o),o=xie(o,t),o=Sie(o,t),s=_F(s),s=xie(s,t),s=Sie(s,t),o=Mie(o),s=Mie(s),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,v=[d,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+v,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===Hz?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Hz?"":"#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(` `)+` `+_);let x=y+v+o,M=y+_+s,S=yF(n,n.VERTEX_SHADER,x),w=yF(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(),P=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=_ie(n,S,"vertex"),k=_ie(n,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(m,n.VALIDATE_STATUS)+` Material Name: `+I.name+` Material Type: `+I.type+` Program Info Log: `+R+` `+z+` `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||P==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:P,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new Ef(n,m),b=jEe(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,kEe)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=VEe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var oAe=0,_C=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 xF(e),t.set(e,i)),i}},xF=class{constructor(e){this.id=oAe++,this.code=e,this.usedTimes=0}};function Tie(r,e,t,i,n,a,o){let s=new hy,l=new _C,u=new Set,c=[],h=n.isWebGL2,f=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 P=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,z=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=z&&z.mapping===mf?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 kt=al[G];V=kt.vertexShader,K=kt.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,dt=!!b.metalnessMap,F=!!b.roughnessMap,L=b.anisotropy>0,ne=b.clearcoat>0,le=b.iridescence>0,me=b.sheen>0,fe=b.transmission>0,et=L&&!!b.anisotropyMap,Ke=ne&&!!b.clearcoatMap,Se=ne&&!!b.clearcoatNormalMap,Ae=ne&&!!b.clearcoatRoughnessMap,st=le&&!!b.iridescenceMap,$=le&&!!b.iridescenceThicknessMap,nt=me&&!!b.sheenColorMap,Xe=me&&!!b.sheenRoughnessMap,Fe=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,ct=fe&&!!b.transmissionMap,Je=fe&&!!b.thicknessMap,Gt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,De=tl;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(De=r.toneMapping);let wt={isWebGL2:h,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:Oo,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===CQ,normalMapTangentSpace:Ue&&b.normalMapType===AQ,metalnessMap:dt,roughnessMap:F,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:st,iridescenceThicknessMap:$,sheen:me,sheenColorMap:nt,sheenRoughnessMap:Xe,specularMap:Fe,specularColorMap:we,specularIntensityMap:Ie,transmission:fe,transmissionMap:ct,thicknessMap:Je,gradientMap:Gt,opaque:b.transparent===!1&&b.blending===Cc&&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:dt&&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:st&&m(b.iridescenceMap.channel),iridescenceThicknessMapUv:$&&m(b.iridescenceThicknessMap.channel),sheenColorMapUv:nt&&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:ct&&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:!!P,useFog:b.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:f,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:De,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&Lr.getTransfer(b.map.colorSpace)===qr,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===fs,flipSided:b.side===bi,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:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return wt.vertexUv1s=u.has(1),wt.vertexUv2s=u.has(2),wt.vertexUv3s=u.has(3),u.clear(),wt}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=al[E];I=iee.clone(R.uniforms)}else I=b.uniforms;return I}function S(b,E){let I;for(let R=0,A=c.length;R0?i.push(v):p.transparent===!0?n.push(v):t.push(v)}function l(h,f,p,d,g,m){let v=o(h,f,p,d,g,m);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):t.unshift(v)}function u(h,f){t.length>1&&t.sort(h||sAe),i.length>1&&i.sort(f||Aie),n.length>1&&n.sort(f||Aie)}function c(){for(let h=e,f=r.length;h=a.length?(o=new Cie,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function lAe(){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 or};break;case"SpotLight":t={position:new be,direction:new be,color:new or,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new be,color:new or,distance:0,decay:0};break;case"HemisphereLight":t={direction:new be,skyColor:new or,groundColor:new or};break;case"RectAreaLight":t={color:new or,position:new be,halfWidth:new be,halfHeight:new be};break}return r[e.id]=t,t}}}function uAe(){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 Qt};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qt};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qt,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var cAe=0;function hAe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Lie(r,e){let t=new lAe,i=uAe(),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 Zr,s=new Zr;function l(c,h){let f=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(hAe);let b=h===!0?Math.PI:1;for(let I=0,R=c.length;I0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=vt.LTC_FLOAT_1,n.rectAreaLTC2=vt.LTC_FLOAT_2):(n.rectAreaLTC1=vt.LTC_HALF_1,n.rectAreaLTC2=vt.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=vt.LTC_FLOAT_1,n.rectAreaLTC2=vt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=vt.LTC_HALF_1,n.rectAreaLTC2=vt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=f,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=cAe++)}function u(c,h){let f=0,p=0,d=0,g=0,m=0,v=h.matrixWorldInverse;for(let _=0,y=c.length;_=s.length?(l=new Die(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var xC=class extends Gu{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=TQ,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 SC=class extends Gu{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 Iie=` void main() { gl_Position = vec4( position, 1.0 ); } `,Nie=` uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); } `;function Uie(r,e,t){let i=new Tf,n=new Qt,a=new Qt,o=new li,s=new xC({depthPacking:EQ}),l=new SC,u={},c=t.maxTextureSize,h={[hs]:bi,[bi]:hs,[fs]:fs},f=new Ra({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Qt},radius:{value:4}},vertexShader:Iie,fragmentShader:Nie}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let d=new Vo;d.setAttribute("position",new Ca(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new an(d,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=wA;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(el),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==Hl&&this.type===Hl,A=v===Hl&&this.type!==Hl;for(let P=0,U=S.length;Pc||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!==Hl?{minFilter:Gi,magFilter:Gi}:{};z.map!==null&&z.map.dispose(),z.map=new ko(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;Y0||w.map&&w.alphaTest>0){let I=b.uuid,R=w.uuid,A=u[I];A===void 0&&(A={},u[I]=A);let P=A[R];P===void 0&&(P=b.clone(),A[R]=P,w.addEventListener("dispose",M)),b=P}if(b.visible=w.visible,b.wireframe=w.wireframe,C===Hl?b.side=w.shadowSide!==null?w.shadowSide:w.side:b.side=w.shadowSide!==null?w.shadowSide:h[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===Hl)&&(!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 P=R.groups;for(let U=0,B=P.length;U=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 li().fromArray(Q),ae=new li().fromArray(V);function ve(X,Te,te,Me){let De=new Uint8Array(4),wt=r.createTexture();r.bindTexture(X,wt),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let kt=0;kt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Qt,h=new WeakMap,f,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):ry("canvas")}function m(F,L,ne,le){let me=1,fe=dt(F);if((fe.width>le||fe.height>le)&&(me=le/Math.max(fe.width,fe.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?KS:Math.floor,Ke=et(me*fe.width),Se=et(me*fe.height);f===void 0&&(f=g(Ke,Se));let Ae=ne?g(Ke,Se):f;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 ("+fe.width+"x"+fe.height+") to ("+Ke+"x"+Se+")."),Ae}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+fe.width+"x"+fe.height+")."),F;return F}function v(F){let L=dt(F);return Wz(L.width)&&Wz(L.height)}function _(F){return s?!1:F.wrapS!==Ea||F.wrapT!==Ea||F.minFilter!==Gi&&F.minFilter!==tn}function y(F,L){return F.generateMipmaps&&L&&F.minFilter!==Gi&&F.minFilter!==tn}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 fe=L;if(L===r.RED&&(ne===r.FLOAT&&(fe=r.R32F),ne===r.HALF_FLOAT&&(fe=r.R16F),ne===r.UNSIGNED_BYTE&&(fe=r.R8)),L===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(fe=r.R8UI),ne===r.UNSIGNED_SHORT&&(fe=r.R16UI),ne===r.UNSIGNED_INT&&(fe=r.R32UI),ne===r.BYTE&&(fe=r.R8I),ne===r.SHORT&&(fe=r.R16I),ne===r.INT&&(fe=r.R32I)),L===r.RG&&(ne===r.FLOAT&&(fe=r.RG32F),ne===r.HALF_FLOAT&&(fe=r.RG16F),ne===r.UNSIGNED_BYTE&&(fe=r.RG8)),L===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(fe=r.RG8UI),ne===r.UNSIGNED_SHORT&&(fe=r.RG16UI),ne===r.UNSIGNED_INT&&(fe=r.RG32UI),ne===r.BYTE&&(fe=r.RG8I),ne===r.SHORT&&(fe=r.RG16I),ne===r.INT&&(fe=r.RG32I)),L===r.RGBA){let et=me?$g:Lr.getTransfer(le);ne===r.FLOAT&&(fe=r.RGBA32F),ne===r.HALF_FLOAT&&(fe=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(fe=et===qr?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(fe=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(fe=r.RGB5_A1)}return(fe===r.R16F||fe===r.R32F||fe===r.RG16F||fe===r.RG32F||fe===r.RGBA16F||fe===r.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function S(F,L,ne){return y(F,ne)===!0||F.isFramebufferTexture&&F.minFilter!==Gi&&F.minFilter!==tn?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===Gi||F===mz||F===jg?r.NEAREST:r.LINEAR}function T(F){let L=F.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&h.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=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={[YS]:r.REPEAT,[Ea]:r.CLAMP_TO_EDGE,[qS]:r.MIRRORED_REPEAT},J={[Gi]:r.NEAREST,[mz]:r.NEAREST_MIPMAP_NEAREST,[jg]:r.NEAREST_MIPMAP_LINEAR,[tn]:r.LINEAR,[EA]:r.LINEAR_MIPMAP_NEAREST,[Xl]:r.LINEAR_MIPMAP_LINEAR},Q={[RQ]:r.NEVER,[UQ]:r.ALWAYS,[LQ]:r.LESS,[BA]:r.LEQUAL,[DQ]:r.EQUAL,[NQ]:r.GEQUAL,[PQ]:r.GREATER,[IQ]:r.NOTEQUAL};function V(F,L,ne){if(L.type===No&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===tn||L.magFilter===EA||L.magFilter===jg||L.magFilter===Xl||L.minFilter===tn||L.minFilter===EA||L.minFilter===jg||L.minFilter===Xl)&&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!==Ea||L.wrapT!==Ea)&&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!==Gi&&L.minFilter!==tn&&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===Gi||L.minFilter!==jg&&L.minFilter!==Xl||L.type===No&&e.has("OES_texture_float_linear")===!1||s===!1&&L.type===Lc&&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 fe=U(L);if(fe!==F.__cacheKey){me[fe]===void 0&&(me[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[fe].usedTimes++;let et=me[F.__cacheKey];et!==void 0&&(me[F.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),F.__cacheKey=fe,F.__webglTexture=me[fe].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),fe=L.source;t.bindTexture(le,F.__webglTexture,r.TEXTURE0+ne);let et=i.get(fe);if(fe.version!==et.__version||me===!0){t.activeTexture(r.TEXTURE0+ne);let Ke=Lr.getPrimaries(Lr.workingColorSpace),Se=L.colorSpace===il?null:Lr.getPrimaries(L.colorSpace),Ae=L.colorSpace===il||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 st=_(L)&&v(L.image)===!1,$=m(L.image,st,!1,n.maxTextureSize);$=Ve(L,$);let nt=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,nt);let Ie,ct=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==zA,Gt=et.__version===void 0||me===!0,X=fe.dataReady,Te=S(L,$,nt);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===No?we=r.DEPTH_COMPONENT32F:L.type===ds?we=r.DEPTH_COMPONENT24:L.type===rl?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===No&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Yl&&we===r.DEPTH_COMPONENT&&L.type!==Kg&&L.type!==ds&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=ds,Fe=a.convert(L.type)),L.format===Fu&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==rl&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=rl,Fe=a.convert(L.type))),Gt&&(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(ct.length>0&&nt){Je&&Gt&&t.texStorage2D(r.TEXTURE_2D,Te,we,ct[0].width,ct[0].height);for(let te=0,Me=ct.length;te>=1,Me>>=1}}else if(ct.length>0&&nt){if(Je&&Gt){let te=dt(ct[0]);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}for(let te=0,Me=ct.length;te0&&X++;let te=dt($[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,te.width,te.height)}for(let te=0;te<6;te++)if(st){ct?Gt&&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>fe),$=Math.max(1,L.height>>fe);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,fe,Se,st,$,L.depth,0,et,Ke,null):t.texImage2D(me,fe,Se,st,$,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,fe),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===No?le=r.DEPTH_COMPONENT32F:me.type===ds&&(le=r.DEPTH_COMPONENT24));let fe=Le(L);Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,fe,le,L.width,L.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,fe,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;me1,Ke=v(F)||s;if(et||(le.__webglTexture===void 0&&(le.__webglTexture=r.createTexture()),le.__version=L.version,o.memory.textures++),fe){ne.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer[Se]=[];for(let Ae=0;Ae0){ne.__webglFramebuffer=[];for(let Se=0;Se0&&Ue(F)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Se=0;Se0)for(let Ae=0;Ae0)for(let Ae=0;Ae0&&Ue(F)===!1){let L=F.textures,ne=F.width,le=F.height,me=r.COLOR_BUFFER_BIT,fe=[],et=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(F),Se=L.length>1;if(Se)for(let Ae=0;Ae0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(F){let L=o.render.frame;h.get(F)!==L&&(h.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===ZS||ne!==Oo&&ne!==il&&(Lr.getTransfer(ne)===qr?s===!1?e.has("EXT_sRGB")===!0&&le===On?(F.format=ZS,F.minFilter=tn,F.generateMipmaps=!1):L=ny.sRGBToLinear(L):(le!==On||me!==ps)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),L}function dt(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=P,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 Fie(r,e,t){let i=t.isWebGL2;function n(a,o=il){let s,l=Lr.getTransfer(o);if(a===ps)return r.UNSIGNED_BYTE;if(a===CA)return r.UNSIGNED_SHORT_4_4_4_4;if(a===RA)return r.UNSIGNED_SHORT_5_5_5_1;if(a===gQ)return r.BYTE;if(a===yQ)return r.SHORT;if(a===Kg)return r.UNSIGNED_SHORT;if(a===AA)return r.INT;if(a===ds)return r.UNSIGNED_INT;if(a===No)return r.FLOAT;if(a===Lc)return i?r.HALF_FLOAT:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(a===_Q)return r.ALPHA;if(a===On)return r.RGBA;if(a===xQ)return r.LUMINANCE;if(a===SQ)return r.LUMINANCE_ALPHA;if(a===Yl)return r.DEPTH_COMPONENT;if(a===Fu)return r.DEPTH_STENCIL;if(a===ZS)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===MQ)return r.RED;if(a===LA)return r.RED_INTEGER;if(a===bQ)return r.RG;if(a===DA)return r.RG_INTEGER;if(a===PA)return r.RGBA_INTEGER;if(a===IA||a===NA||a===UA||a===OA)if(l===qr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===IA)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===NA)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===UA)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===OA)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===IA)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===NA)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===UA)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===OA)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===vz||a===gz||a===yz||a===_z)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===vz)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===gz)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===yz)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===_z)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===zA)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===xz||a===Sz)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===xz)return l===qr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===Sz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===Mz||a===bz||a===wz||a===Tz||a===Ez||a===Az||a===Cz||a===Rz||a===Lz||a===Dz||a===Pz||a===Iz||a===Nz||a===Uz)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===Mz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===bz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===wz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===Tz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===Ez)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===Az)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===Cz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===Rz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===Lz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===Dz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===Pz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===Iz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===Nz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===Uz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===FA||a===Oz||a===zz)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===FA)return l===qr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===Oz)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===zz)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===wQ||a===Fz||a===Bz||a===kz)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===FA)return s.COMPRESSED_RED_RGTC1_EXT;if(a===Fz)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===Bz)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===kz)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===rl?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 MC=class extends Wi{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};var Fd=class extends nn{constructor(){super(),this.isGroup=!0,this.type="Group"}};var pAe={type:"move"},Py=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fd,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 Fd,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 Fd,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"],h=u.joints["thumb-tip"],f=c.position.distanceTo(h.position),p=.02,d=.005;u.inputState.pinching&&f>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&f<=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(pAe)))}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 Fd;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}};var dAe=` void main() { gl_Position = vec4( position, 1.0 ); }`,mAe=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`,bC=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 Bo,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 Ra({extensions:{fragDepth:!0},vertexShader:dAe,fragmentShader:mAe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new an(new Ty(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}};var wC=class extends Fo{constructor(e,t){super();let i=this,n=null,a=1,o=null,s="local-floor",l=1,u=null,c=null,h=null,f=null,p=null,d=null,g=new bC,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new Qt,S=null,w=new Wi;w.layers.enable(1),w.viewport=new li;let T=new Wi;T.layers.enable(2),T.viewport=new li;let C=[w,T],b=new MC;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 Py,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new Py,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new Py,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",P);for(let V=0;V=0&&(x[ve]=null,y[ve].disconnect(ae))}for(let K=0;K=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 dt=Ee+Ne,F=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/F*dt,me=We*q/F*dt;V.projectionMatrix.makePerspective(L,ne,le,me,dt,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;ve0&&(m.alphaTest.value=v.alphaTest);let _=e.get(v),y=_.envMap,x=_.envMapRotation;if(y&&(m.envMap.value=y,Bd.copy(x),Bd.x*=-1,Bd.y*=-1,Bd.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Bd.y*=-1,Bd.z*=-1),m.envMapRotation.value.setFromMatrix4(vAe.makeRotationFromEuler(Bd)),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 h(m,v){v.gradientMap&&(m.gradientMap.value=v.gradientMap)}function f(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===bi&&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 kie(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&&(f(_),a[_.id]=S)}function c(_){let y=h();_.__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 h(){for(let _=0;_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 rM=class{constructor(e={}){let{canvas:t=FQ(),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:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=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=Uo,this._useLegacyLights=!1,this.toneMapping=tl,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new li,E=new li,I=null,R=new or(0),A=0,P=t.width,U=t.height,B=1,z=null,k=null,G=new li(0,0,P,U),Y=new li(0,0,P,U),J=!1,Q=new Tf,V=!1,K=!1,ae=null,ve=new Zr,ue=new Qt,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{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){D(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let kt=null;function Tr(O){kt&&kt(O)}function $r(){Or.stop()}function Ht(){Or.start()}let Or=new mC;Or.setAnimationLoop(Tr),typeof self<"u"&&Or.setContext(self),this.setAnimationLoop=function(O){kt=O,Je.setAnimationLoop(O),O===null?Or.stop():Or.start()},Je.addEventListener("sessionstart",$r),Je.addEventListener("sessionend",Ht),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),hi(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)&&st.render(g,O),m.setupLights(y._useLegacyLights),j.isArrayCamera){let ie=j.cameras;for(let D=0,W=ie.length;D0?m=_[_.length-1]:m=null,v.pop(),v.length>0?g=v[v.length-1]:g=null};function hi(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;Oe0&&l_(D,W,j,re),ie&&Le.viewport(b.copy(ie)),D.length>0&&gl(D,j,re),W.length>0&&gl(W,j,re),ee.length>0&&gl(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function l_(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new ko(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?Lc:ps,minFilter:Xl,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(KS(ue.x),KS(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=tl,gl(O,re,ie),Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae);let ce=!1;for(let Oe=0,Ge=j.length;Oe0),Re=!!re.morphAttributes.position,gt=!!re.morphAttributes.normal,_t=!!re.morphAttributes.color,$e=tl;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let lt=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Ct=lt!==void 0?lt.length:0,je=Ne.get(ie),_i=m.state.lights;if(V===!0&&(K===!0||O!==C)){let Qr=O===C&&ie.id===T;Se.setState(ie,O,Qr)}let Ft=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==_i.state.version||je.outputColorSpace!==ge||D.isBatchedMesh&&je.batching===!1||!D.isBatchedMesh&&je.batching===!0||D.isInstancedMesh&&je.instancing===!1||!D.isInstancedMesh&&je.instancing===!0||D.isSkinnedMesh&&je.skinning===!1||!D.isSkinnedMesh&&je.skinning===!0||D.isInstancedMesh&&je.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&je.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&je.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&je.instancingMorph===!1&&D.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!==gt||je.morphColors!==_t||je.toneMapping!==$e||xe.isWebGL2===!0&&je.morphTargetsCount!==Ct)&&(Ft=!0):(Ft=!0,je.__version=ie.version);let Nr=je.currentProgram;Ft===!0&&(Nr=Es(ie,j,D));let Yi=!1,Et=!1,Ei=!1,cr=Nr.getUniforms(),hn=je.uniforms;if(Le.useProgram(Nr.program)&&(Yi=!0,Et=!0,Ei=!0),ie.id!==T&&(T=ie.id,Et=!0),Yi||C!==O){cr.setValue(H,"projectionMatrix",O.projectionMatrix),cr.setValue(H,"viewMatrix",O.matrixWorldInverse);let Qr=cr.map.cameraPosition;Qr!==void 0&&Qr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&cr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&cr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,Et=!0,Ei=!0)}if(D.isSkinnedMesh){cr.setOptional(H,D,"bindMatrix"),cr.setOptional(H,D,"bindMatrixInverse");let Qr=D.skeleton;Qr&&(xe.floatVertexTextures?(Qr.boneTexture===null&&Qr.computeBoneTexture(),cr.setValue(H,"boneTexture",Qr.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."))}D.isBatchedMesh&&(cr.setOptional(H,D,"batchingTexture"),cr.setValue(H,"batchingTexture",D._matricesTexture,Ve));let Ju=re.morphAttributes;if((Ju.position!==void 0||Ju.normal!==void 0||Ju.color!==void 0&&xe.isWebGL2===!0)&&$.update(D,re,Nr),(Et||je.receiveShadow!==D.receiveShadow)&&(je.receiveShadow=D.receiveShadow,cr.setValue(H,"receiveShadow",D.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(hn.envMap.value=ce,hn.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),Et&&(cr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&c_(hn,Ei),W&&ie.fog===!0&&fe.refreshFogUniforms(hn,W),fe.refreshMaterialUniforms(hn,ie,B,U,ae),Ef.upload(H,ip(je),hn,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(Ef.upload(H,ip(je),hn,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&cr.setValue(H,"center",D.center),cr.setValue(H,"modelViewMatrix",D.modelViewMatrix),cr.setValue(H,"normalMatrix",D.normalMatrix),cr.setValue(H,"modelMatrix",D.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let Qr=ie.uniformsGroups;for(let $u=0,np=Qr.length;$u0&&Ve.useMultisampledRTT(O)===!1?D=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?D=Ge[re]:D=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,D)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,D),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,D,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!==On&&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===Lc&&(_e.has("EXT_color_buffer_half_float")||xe.isWebGL2&&_e.has("EXT_color_buffer_float"));if(Ge!==ps&&Fe.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===No&&(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-D&&H.readPixels(j,re,ie,D,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),D=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,D,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let D=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,D,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,D=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),gt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),_t=H.getParameter(H.UNPACK_SKIP_PIXELS),$e=H.getParameter(H.UNPACK_SKIP_ROWS),lt=H.getParameter(H.UNPACK_SKIP_IMAGES),Ct=re.isCompressedTexture?re.mipmaps[D]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,Ct.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Ct.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,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Ct.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Ct.data):H.texSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Ct),H.pixelStorei(H.UNPACK_ROW_LENGTH,Re),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,gt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,_t),H.pixelStorei(H.UNPACK_SKIP_ROWS,$e),H.pixelStorei(H.UNPACK_SKIP_IMAGES,lt),D===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 zo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===Jg?"display-p3":"srgb",t.unpackColorSpace=Lr.workingColorSpace===Ad?"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 iM=class extends nn{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 jl,this.environmentRotation=new jl,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 TC=class r extends Vo{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 Qt;o.push(0,0,0),s.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){let p=i+h/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[f]/e+1)/2,c.y=(o[f+1]/e+1)/2,l.push(c.x,c.y)}for(let h=1;h<=t;h++)a.push(h,h+1,0);this.setIndex(a),this.setAttribute("position",new na(o,3)),this.setAttribute("normal",new na(s,3)),this.setAttribute("uv",new na(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 Iy=class extends nn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new or(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 nM=class extends Iy{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new or(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}};var SF=new Zr,Vie=new be,Gie=new be,EC=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Qt(512,512),this.map=null,this.mapPass=null,this.matrix=new Zr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Tf,this._frameExtents=new Qt(1,1),this._viewportCount=1,this._viewports=[new li(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Vie.setFromMatrixPosition(e.matrixWorld),t.position.copy(Vie),Gie.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Gie),t.updateMatrixWorld(),SF.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(SF),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(SF)}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 AC=class extends EC{constructor(){super(new Ey(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}};var aM=class extends Iy{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nn.DEFAULT_UP),this.updateMatrix(),this.target=new nn,this.shadow=new AC}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};var oM=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Hie(),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=Hie();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Hie(){return(typeof performance>"u"?Date:performance).now()}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:VS}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=VS);var VB="162";var yAe=0,Wie=1,_Ae=2;var Pae=1,xAe=2,Xc=3,Ff=0,Xo=1,qc=2,Uf=0,t0=1,Xie=2,Yie=3,qie=4,SAe=5,qd=100,MAe=101,bAe=102,Zie=103,jie=104,wAe=200,TAe=201,EAe=202,AAe=203,nB=204,aB=205,CAe=206,RAe=207,LAe=208,DAe=209,PAe=210,IAe=211,NAe=212,UAe=213,OAe=214,zAe=0,FAe=1,BAe=2,eR=3,kAe=4,VAe=5,GAe=6,HAe=7,NR=0,WAe=1,XAe=2,Of=0,YAe=1,qAe=2,ZAe=3,jAe=4,KAe=5,JAe=6,$Ae=7,Kie="attached",QAe="detached",Jie=300,n0=301,a0=302,vM=303,oB=304,UR=306,o0=1e3,Ho=1001,sB=1002,zn=1003,$ie=1004;var sM=1005;var Go=1006,MF=1007;var jd=1008;var zf=1009,eCe=1010,tCe=1011,GB=1012,Iae=1013,Nf=1014,Wu=1015,gM=1016,Nae=1017,Uae=1018,Kd=1020,rCe=1021,sl=1023,iCe=1024,nCe=1025,Jd=1026,s0=1027,aCe=1028,Oae=1029,oCe=1030,zae=1031,Fae=1033,bF=33776,wF=33777,TF=33778,EF=33779,Qie=35840,ene=35841,tne=35842,rne=35843,Bae=36196,ine=37492,nne=37496,ane=37808,one=37809,sne=37810,lne=37811,une=37812,cne=37813,hne=37814,fne=37815,pne=37816,dne=37817,mne=37818,vne=37819,gne=37820,yne=37821,AF=36492,_ne=36494,xne=36495,sCe=36283,Sne=36284,Mne=36285,bne=36286;var tR=2300,rR=2301,CF=2302,wne=2400,Tne=2401,Ene=2402,lCe=2500;var uCe=3200,cCe=3201,HB=0,hCe=1,If="",Pa="srgb",Yf="srgb-linear",WB="display-p3",OR="display-p3-linear",iR="linear",ui="srgb",nR="rec709",aR="p3";var Ny=7680;var Ane=519,fCe=512,pCe=513,dCe=514,kae=515,mCe=516,vCe=517,gCe=518,yCe=519,Cne=35044;var Rne="300 es",lB=1035,Zc=2e3,oR=2001,Bf=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>8&255]+oa[r>>16&255]+oa[r>>24&255]+"-"+oa[e&255]+oa[e>>8&255]+"-"+oa[e>>16&15|64]+oa[e>>24&255]+"-"+oa[t&63|128]+oa[t>>8&255]+"-"+oa[t>>16&255]+oa[t>>24&255]+oa[i&255]+oa[i>>8&255]+oa[i>>16&255]+oa[i>>24&255]).toLowerCase()}function Fn(r,e,t){return Math.max(e,Math.min(t,r))}function XB(r,e){return(r%e+e)%e}function _Ce(r,e,t,i,n){return i+(r-e)*(n-i)/(t-e)}function xCe(r,e,t){return r!==e?(t-r)/(e-r):0}function dM(r,e,t){return(1-t)*r+t*e}function SCe(r,e,t,i){return dM(r,e,1-Math.exp(-t*i))}function MCe(r,e=1){return e-Math.abs(XB(r,e*2)-e)}function bCe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function wCe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function TCe(r,e){return r+Math.floor(Math.random()*(e-r+1))}function ECe(r,e){return r+Math.random()*(e-r)}function ACe(r){return r*(.5-Math.random())}function CCe(r){r!==void 0&&(Lne=r);let e=Lne+=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 RCe(r){return r*pM}function LCe(r){return r*l0}function uB(r){return(r&r-1)===0&&r!==0}function DCe(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function sR(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function PCe(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),h=a((e-i)/2),f=o((e-i)/2),p=a((i-e)/2),d=o((i-e)/2);switch(n){case"XYX":r.set(s*c,l*h,l*f,s*u);break;case"YZY":r.set(l*f,s*c,l*h,s*u);break;case"ZXZ":r.set(l*h,l*f,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 Ky(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 La(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 ua={DEG2RAD:pM,RAD2DEG:l0,generateUUID:qf,clamp:Fn,euclideanModulo:XB,mapLinear:_Ce,inverseLerp:xCe,lerp:dM,damp:SCe,pingpong:MCe,smoothstep:bCe,smootherstep:wCe,randInt:TCe,randFloat:ECe,randFloatSpread:ACe,seededRandom:CCe,degToRad:RCe,radToDeg:LCe,isPowerOfTwo:uB,ceilPowerOfTwo:DCe,floorPowerOfTwo:sR,setQuaternionFromProperEuler:PCe,normalize:La,denormalize:Ky},xr=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(Fn(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}},vr=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],h=i[7],f=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*_+h*M,a[4]=u*m+c*y+h*S,a[7]=u*v+c*x+h*w,a[2]=f*g+p*_+d*M,a[5]=f*m+p*y+d*S,a[8]=f*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],h=c*o-s*u,f=s*l-c*a,p=u*a-o*l,d=t*h+i*f+n*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=h*g,e[1]=(n*u-c*i)*g,e[2]=(s*i-n*o)*g,e[3]=f*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(RF.makeScale(e,t)),this}rotate(e){return this.premultiply(RF.makeRotation(-e)),this}translate(e,t){return this.premultiply(RF.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)}},RF=new vr;function Vae(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function yM(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function ICe(){let r=yM("canvas");return r.style.display="block",r}var Dne={};function NCe(r){r in Dne||(Dne[r]=!0,console.warn(r))}var Pne=new vr().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ine=new vr().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),CC={[Yf]:{transfer:iR,primaries:nR,toReference:r=>r,fromReference:r=>r},[Pa]:{transfer:ui,primaries:nR,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[OR]:{transfer:iR,primaries:aR,toReference:r=>r.applyMatrix3(Ine),fromReference:r=>r.applyMatrix3(Pne)},[WB]:{transfer:ui,primaries:aR,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Ine),fromReference:r=>r.applyMatrix3(Pne).convertLinearToSRGB()}},UCe=new Set([Yf,OR]),ti={enabled:!0,_workingColorSpace:Yf,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!UCe.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=CC[e].toReference,n=CC[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 CC[r].primaries},getTransfer:function(r){return r===If?iR:CC[r].transfer}};function r0(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function LF(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Uy,lR=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{Uy===void 0&&(Uy=yM("canvas")),Uy.width=e.width,Uy.height=e.height;let i=Uy.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Uy}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=yM("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{class r extends Bf{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=Ho,a=Ho,o=Go,s=jd,l=sl,u=zf,c=r.DEFAULT_ANISOTROPY,h=If){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:zCe++}),this.uuid=qf(),this.name="",this.source=new uR(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 xr(0,0),this.repeat=new xr(1,1),this.center=new xr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new vr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,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!==Jie)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case o0:t.x=t.x-Math.floor(t.x);break;case Ho:t.x=t.x<0?0:1;break;case sB: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 o0:t.y=t.y-Math.floor(t.y);break;case Ho:t.y=t.y<0?0:1;break;case sB: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=Jie,r.DEFAULT_ANISOTROPY=1,r})(),Ur=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],h=l[8],f=l[1],p=l[5],d=l[9],g=l[2],m=l[6],v=l[10];if(Math.abs(c-f)<.01&&Math.abs(h-g)<.01&&Math.abs(d-m)<.01){if(Math.abs(c+f)<.1&&Math.abs(h+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+f)/4,w=(h+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)+(h-g)*(h-g)+(f-c)*(f-c));return Math.abs(_)<.001&&(_=1),this.x=(m-d)/_,this.y=(h-g)/_,this.z=(f-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}},cB=class extends Bf{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ur(0,0,e,t),this.scissorTest=!1,this.viewport=new Ur(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Go,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new _s(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=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+f*x,u=u*m+p*x,c=c*m+d*x,h=h*m+g*x,m===1-s){let M=1/Math.sqrt(l*l+u*u+c*c+h*h);l*=M,u*=M,c*=M,h*=M}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,n,a,o){let s=i[n],l=i[n+1],u=i[n+2],c=i[n+3],h=a[o],f=a[o+1],p=a[o+2],d=a[o+3];return e[t]=s*d+c*h+l*p-u*f,e[t+1]=l*d+c*f+u*h-s*p,e[t+2]=u*d+c*p+s*f-l*h,e[t+3]=c*d-s*h-l*f-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),h=s(a/2),f=l(i/2),p=l(n/2),d=l(a/2);switch(o){case"XYZ":this._x=f*c*h+u*p*d,this._y=u*p*h-f*c*d,this._z=u*c*d+f*p*h,this._w=u*c*h-f*p*d;break;case"YXZ":this._x=f*c*h+u*p*d,this._y=u*p*h-f*c*d,this._z=u*c*d-f*p*h,this._w=u*c*h+f*p*d;break;case"ZXY":this._x=f*c*h-u*p*d,this._y=u*p*h+f*c*d,this._z=u*c*d+f*p*h,this._w=u*c*h-f*p*d;break;case"ZYX":this._x=f*c*h-u*p*d,this._y=u*p*h+f*c*d,this._z=u*c*d-f*p*h,this._w=u*c*h+f*p*d;break;case"YZX":this._x=f*c*h+u*p*d,this._y=u*p*h+f*c*d,this._z=u*c*d-f*p*h,this._w=u*c*h-f*p*d;break;case"XZY":this._x=f*c*h-u*p*d,this._y=u*p*h-f*c*d,this._z=u*c*d+f*p*h,this._w=u*c*h+f*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],h=t[10],f=i+s+h;if(f>0){let p=.5/Math.sqrt(f+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>h){let p=2*Math.sqrt(1+i-s-h);this._w=(c-l)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(a+u)/p}else if(s>h){let p=2*Math.sqrt(1+s-i-h);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+h-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 iMath.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(Fn(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),h=Math.sin((1-t)*c)/u,f=Math.sin(t*c)/u;return this._w=o*h+this._w*f,this._x=i*h+this._x*f,this._y=n*h+this._y*f,this._z=a*h+this._z*f,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(Nne.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nne.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),h=2*(a*i-o*t);return this.x=t+l*u+o*h-s*c,this.y=i+l*c+s*u-a*h,this.z=n+l*h+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 PF.copy(this).projectOnVector(e),this.sub(PF)}reflect(e){return this.sub(PF.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(Fn(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}},PF=new ye,Nne=new Vn,kf=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;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,$l),$l.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(lM),LC.subVectors(this.max,lM),Oy.subVectors(e.a,lM),zy.subVectors(e.b,lM),Fy.subVectors(e.c,lM),Af.subVectors(zy,Oy),Cf.subVectors(Fy,zy),kd.subVectors(Oy,Fy);let t=[0,-Af.z,Af.y,0,-Cf.z,Cf.y,0,-kd.z,kd.y,Af.z,0,-Af.x,Cf.z,0,-Cf.x,kd.z,0,-kd.x,-Af.y,Af.x,0,-Cf.y,Cf.x,0,-kd.y,kd.x,0];return!IF(t,Oy,zy,Fy,LC)||(t=[1,0,0,0,1,0,0,0,1],!IF(t,Oy,zy,Fy,LC))?!1:(DC.crossVectors(Af,Cf),t=[DC.x,DC.y,DC.z],IF(t,Oy,zy,Fy,LC))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,$l).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize($l).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:(Bc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Bc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Bc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Bc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Bc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Bc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Bc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Bc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Bc),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)}},Bc=[new ye,new ye,new ye,new ye,new ye,new ye,new ye,new ye],$l=new ye,RC=new kf,Oy=new ye,zy=new ye,Fy=new ye,Af=new ye,Cf=new ye,kd=new ye,lM=new ye,LC=new ye,DC=new ye,Vd=new ye;function IF(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){Vd.fromArray(r,a);let s=n.x*Math.abs(Vd.x)+n.y*Math.abs(Vd.y)+n.z*Math.abs(Vd.z),l=e.dot(Vd),u=t.dot(Vd),c=i.dot(Vd);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var FCe=new kf,uM=new ye,NF=new ye,Vf=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):FCe.setFromPoints(e).getCenter(i);let n=0;for(let a=0,o=e.length;athis.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;uM.subVectors(e,this.center);let t=uM.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(uM,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):(NF.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(uM.copy(e.center).add(NF)),this.expandByPoint(uM.copy(e.center).sub(NF))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},kc=new ye,UF=new ye,PC=new ye,Rf=new ye,OF=new ye,IC=new ye,zF=new ye,_M=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,kc)),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=kc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(kc.copy(this.origin).addScaledVector(this.direction,t),kc.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){UF.copy(e).add(t).multiplyScalar(.5),PC.copy(t).sub(e).normalize(),Rf.copy(this.origin).sub(UF);let a=e.distanceTo(t)*.5,o=-this.direction.dot(PC),s=Rf.dot(this.direction),l=-Rf.dot(PC),u=Rf.lengthSq(),c=Math.abs(1-o*o),h,f,p,d;if(c>0)if(h=o*l-s,f=o*s-l,d=a*c,h>=0)if(f>=-d)if(f<=d){let g=1/c;h*=g,f*=g,p=h*(h+o*f+2*s)+f*(o*h+f+2*l)+u}else f=a,h=Math.max(0,-(o*f+s)),p=-h*h+f*(f+2*l)+u;else f=-a,h=Math.max(0,-(o*f+s)),p=-h*h+f*(f+2*l)+u;else f<=-d?(h=Math.max(0,-(-o*a+s)),f=h>0?-a:Math.min(Math.max(-a,-l),a),p=-h*h+f*(f+2*l)+u):f<=d?(h=0,f=Math.min(Math.max(-a,-l),a),p=f*(f+2*l)+u):(h=Math.max(0,-(o*a+s)),f=h>0?a:Math.min(Math.max(-a,-l),a),p=-h*h+f*(f+2*l)+u);else f=o>0?-a:a,h=Math.max(0,-(o*f+s)),p=-h*h+f*(f+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,h),n&&n.copy(UF).addScaledVector(PC,f),p}intersectSphere(e,t){kc.subVectors(e.center,this.origin);let i=kc.dot(this.direction),n=kc.dot(kc)-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,h=1/this.direction.z,f=this.origin;return u>=0?(i=(e.min.x-f.x)*u,n=(e.max.x-f.x)*u):(i=(e.max.x-f.x)*u,n=(e.min.x-f.x)*u),c>=0?(a=(e.min.y-f.y)*c,o=(e.max.y-f.y)*c):(a=(e.max.y-f.y)*c,o=(e.min.y-f.y)*c),i>o||a>n||((a>i||isNaN(i))&&(i=a),(o=0?(s=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(s=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||s>n)||((s>i||i!==i)&&(i=s),(l=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,kc)!==null}intersectTriangle(e,t,i,n,a){OF.subVectors(t,e),IC.subVectors(i,e),zF.crossVectors(OF,IC);let o=this.direction.dot(zF),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;Rf.subVectors(this.origin,e);let l=s*this.direction.dot(IC.crossVectors(Rf,IC));if(l<0)return null;let u=s*this.direction.dot(OF.cross(Rf));if(u<0||l+u>o)return null;let c=-s*Rf.dot(zF);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)}},Xt=class r{constructor(e,t,i,n,a,o,s,l,u,c,h,f,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,h,f,p,d,g,m)}set(e,t,i,n,a,o,s,l,u,c,h,f,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]=h,v[14]=f,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/By.setFromMatrixColumn(e,0).length(),a=1/By.setFromMatrixColumn(e,1).length(),o=1/By.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),h=Math.sin(a);if(e.order==="XYZ"){let f=o*c,p=o*h,d=s*c,g=s*h;t[0]=l*c,t[4]=-l*h,t[8]=u,t[1]=p+d*u,t[5]=f-g*u,t[9]=-s*l,t[2]=g-f*u,t[6]=d+p*u,t[10]=o*l}else if(e.order==="YXZ"){let f=l*c,p=l*h,d=u*c,g=u*h;t[0]=f+g*s,t[4]=d*s-p,t[8]=o*u,t[1]=o*h,t[5]=o*c,t[9]=-s,t[2]=p*s-d,t[6]=g+f*s,t[10]=o*l}else if(e.order==="ZXY"){let f=l*c,p=l*h,d=u*c,g=u*h;t[0]=f-g*s,t[4]=-o*h,t[8]=d+p*s,t[1]=p+d*s,t[5]=o*c,t[9]=g-f*s,t[2]=-o*u,t[6]=s,t[10]=o*l}else if(e.order==="ZYX"){let f=o*c,p=o*h,d=s*c,g=s*h;t[0]=l*c,t[4]=d*u-p,t[8]=f*u+g,t[1]=l*h,t[5]=g*u+f,t[9]=p*u-d,t[2]=-u,t[6]=s*l,t[10]=o*l}else if(e.order==="YZX"){let f=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=g-f*h,t[8]=d*h+p,t[1]=h,t[5]=o*c,t[9]=-s*c,t[2]=-u*c,t[6]=p*h+d,t[10]=f-g*h}else if(e.order==="XZY"){let f=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=-h,t[8]=u*c,t[1]=f*h+g,t[5]=o*c,t[9]=p*h-d,t[2]=d*h-p,t[6]=s*c,t[10]=g*h+f}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(BCe,e,kCe)}lookAt(e,t,i){let n=this.elements;return gs.subVectors(e,t),gs.lengthSq()===0&&(gs.z=1),gs.normalize(),Lf.crossVectors(i,gs),Lf.lengthSq()===0&&(Math.abs(i.z)===1?gs.x+=1e-4:gs.z+=1e-4,gs.normalize(),Lf.crossVectors(i,gs)),Lf.normalize(),NC.crossVectors(gs,Lf),n[0]=Lf.x,n[4]=NC.x,n[8]=gs.x,n[1]=Lf.y,n[5]=NC.y,n[9]=gs.y,n[2]=Lf.z,n[6]=NC.z,n[10]=gs.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],h=i[5],f=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],P=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*P+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+h*b+f*A+p*z,a[5]=c*w+h*E+f*P+p*k,a[9]=c*T+h*I+f*U+p*G,a[13]=c*C+h*R+f*B+p*Y,a[2]=d*S+g*b+m*A+v*z,a[6]=d*w+g*E+m*P+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*P+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],h=e[6],f=e[10],p=e[14],d=e[3],g=e[7],m=e[11],v=e[15];return d*(+a*l*h-n*u*h-a*s*f+i*u*f+n*s*p-i*l*p)+g*(+t*l*p-t*u*f+a*o*f-n*o*p+n*u*c-a*l*c)+m*(+t*u*h-t*s*p-a*o*h+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-t*l*h+t*s*f+n*o*h-i*o*f+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],h=e[9],f=e[10],p=e[11],d=e[12],g=e[13],m=e[14],v=e[15],_=h*m*u-g*f*u+g*l*p-s*m*p-h*l*v+s*f*v,y=d*f*u-c*m*u-d*l*p+o*m*p+c*l*v-o*f*v,x=c*g*u-d*h*u+d*s*p-o*g*p-c*s*v+o*h*v,M=d*h*l-c*g*l-d*s*f+o*g*f+c*s*m-o*h*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*f*a-h*m*a-g*n*p+i*m*p+h*n*v-i*f*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]=(h*l*a-s*f*a-h*n*u+i*f*u+s*n*p-i*l*p)*w,e[4]=y*w,e[5]=(c*m*a-d*f*a+d*n*p-t*m*p-c*n*v+t*f*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*f*a-c*l*a+c*n*u-t*f*u-o*n*p+t*l*p)*w,e[8]=x*w,e[9]=(d*h*a-c*g*a-d*i*p+t*g*p+c*i*v-t*h*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*h*a-c*i*u+t*h*u+o*i*p-t*s*p)*w,e[12]=M*w,e[13]=(c*g*n-d*h*n+d*i*f-t*g*f-c*i*m+t*h*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*h*n-c*s*n+c*i*l-t*h*l-o*i*f+t*s*f)*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,h=s+s,f=a*u,p=a*c,d=a*h,g=o*c,m=o*h,v=s*h,_=l*u,y=l*c,x=l*h,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-(f+v))*S,n[6]=(m+_)*S,n[7]=0,n[8]=(d+y)*w,n[9]=(m-_)*w,n[10]=(1-(f+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=By.set(n[0],n[1],n[2]).length(),o=By.set(n[4],n[5],n[6]).length(),s=By.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],Ql.copy(this);let u=1/a,c=1/o,h=1/s;return Ql.elements[0]*=u,Ql.elements[1]*=u,Ql.elements[2]*=u,Ql.elements[4]*=c,Ql.elements[5]*=c,Ql.elements[6]*=c,Ql.elements[8]*=h,Ql.elements[9]*=h,Ql.elements[10]*=h,t.setFromRotationMatrix(Ql),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=Zc){let l=this.elements,u=2*a/(t-e),c=2*a/(i-n),h=(t+e)/(t-e),f=(i+n)/(i-n),p,d;if(s===Zc)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===oR)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]=h,l[12]=0,l[1]=0,l[5]=c,l[9]=f,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=Zc){let l=this.elements,u=1/(t-e),c=1/(i-n),h=1/(o-a),f=(t+e)*u,p=(i+n)*c,d,g;if(s===Zc)d=(o+a)*h,g=-2*h;else if(s===oR)d=a*h,g=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-f,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}},By=new ye,Ql=new Xt,BCe=new ye(0,0,0),kCe=new ye(1,1,1),Lf=new ye,NC=new ye,gs=new ye,Une=new Xt,One=new Vn,Gn=(()=>{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],h=a[9],f=a[2],p=a[6],d=a[10];switch(i){case"XYZ":this._y=Math.asin(Fn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Fn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(l,d),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-f,o),this._z=0);break;case"ZXY":this._x=Math.asin(Fn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-Fn(f,-1,1)),Math.abs(f)<.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(Fn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(l,d));break;case"XZY":this._z=Math.asin(-Fn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-h,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 Une.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Une,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return One.setFromEuler(this),this.setFromQuaternion(One,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<>>0}enable(e){this.mask|=1<{class r extends Bf{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:VCe++}),this.uuid=qf(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new ye,i=new Gn,n=new Vn,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 Xt},normalMatrix:{value:new vr}}),this.matrix=new Xt,this.matrixWorld=new Xt,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 ky.setFromAxisAngle(t,i),this.quaternion.multiply(ky),this}rotateOnWorldAxis(t,i){return ky.setFromAxisAngle(t,i),this.quaternion.premultiply(ky),this}rotateX(t){return this.rotateOnAxis(Fne,t)}rotateY(t){return this.rotateOnAxis(Bne,t)}rotateZ(t){return this.rotateOnAxis(kne,t)}translateOnAxis(t,i){return zne.copy(t).applyQuaternion(this.quaternion),this.position.add(zne.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(Fne,t)}translateY(t){return this.translateOnAxis(Bne,t)}translateZ(t){return this.translateOnAxis(kne,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Vc.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?UC.copy(t):UC.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),cM.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vc.lookAt(cM,UC,this.up):Vc.lookAt(UC,cM,this.up),this.quaternion.setFromRotationMatrix(Vc),a&&(Vc.extractRotation(a.matrixWorld),ky.setFromRotationMatrix(Vc),this.quaternion.premultiply(ky.invert()))}add(t){if(arguments.length>1){for(let i=0;i1){for(let n=0;n0&&(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,h=u.length;c0){a.children=[];for(let l=0;l0){a.animations=[];for(let l=0;l0&&(n.geometries=l),u.length>0&&(n.materials=u),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),f.length>0&&(n.shapes=f),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 h=l[c];delete h.metadata,u.push(h)}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;n0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){eu.subVectors(n,t),Gc.subVectors(i,t),kF.subVectors(e,t);let o=eu.dot(eu),s=eu.dot(Gc),l=eu.dot(kF),u=Gc.dot(Gc),c=Gc.dot(kF),h=o*u-s*s;if(h===0)return a.set(0,0,0),null;let f=1/h,p=(u*l-s*c)*f,d=(o*c-s*l)*f;return a.set(1-p-d,d,p)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,Hc)===null?!1:Hc.x>=0&&Hc.y>=0&&Hc.x+Hc.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,Hc)===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,Hc.x),l.addScaledVector(o,Hc.y),l.addScaledVector(s,Hc.z),l)}static isFrontFacing(e,t,i,n){return eu.subVectors(i,t),Gc.subVectors(e,t),eu.cross(Gc).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 eu.subVectors(this.c,this.b),Gc.subVectors(this.a,this.b),eu.cross(Gc).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;Vy.subVectors(n,i),Gy.subVectors(a,i),VF.subVectors(e,i);let l=Vy.dot(VF),u=Gy.dot(VF);if(l<=0&&u<=0)return t.copy(i);GF.subVectors(e,n);let c=Vy.dot(GF),h=Gy.dot(GF);if(c>=0&&h<=c)return t.copy(n);let f=l*h-c*u;if(f<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(Vy,o);HF.subVectors(e,a);let p=Vy.dot(HF),d=Gy.dot(HF);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(Gy,s);let m=c*d-p*h;if(m<=0&&h-c>=0&&p-d>=0)return Vne.subVectors(a,n),s=(h-c)/(h-c+(p-d)),t.copy(n).addScaledVector(Vne,s);let v=1/(m+g+f);return o=g*v,s=f*v,t.copy(i).addScaledVector(Vy,o).addScaledVector(Gy,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Gae={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},Df={h:0,s:0,l:0},OC={h:0,s:0,l:0};function WF(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 nr=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=Pa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ti.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=ti.workingColorSpace){return this.r=e,this.g=t,this.b=i,ti.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=ti.workingColorSpace){if(e=XB(e,1),t=Fn(t,0,1),i=Fn(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=WF(o,a,e+1/3),this.g=WF(o,a,e),this.b=WF(o,a,e-1/3)}return ti.toWorkingColorSpace(this,n),this}setStyle(e,t=Pa){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=Pa){let i=Gae[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=r0(e.r),this.g=r0(e.g),this.b=r0(e.b),this}copyLinearToSRGB(e){return this.r=LF(e.r),this.g=LF(e.g),this.b=LF(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Pa){return ti.fromWorkingColorSpace(sa.copy(this),e),Math.round(Fn(sa.r*255,0,255))*65536+Math.round(Fn(sa.g*255,0,255))*256+Math.round(Fn(sa.b*255,0,255))}getHexString(e=Pa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ti.workingColorSpace){ti.fromWorkingColorSpace(sa.copy(this),t);let i=sa.r,n=sa.g,a=sa.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 h=o-s;switch(u=c<=.5?h/(o+s):h/(2-o-s),o){case i:l=(n-a)/h+(n0!=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!==t0&&(i.blending=this.blending),this.side!==Ff&&(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!==nB&&(i.blendSrc=this.blendSrc),this.blendDst!==aB&&(i.blendDst=this.blendDst),this.blendEquation!==qd&&(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!==eR&&(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!==Ane&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ny&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ny&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ny&&(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++}},fR=class extends Jc{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new nr(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 Gn,this.combine=NR,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 Xi=new ye,zC=new xr,ll=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=Cne,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Wu,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return NCe("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;n0&&(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 h=0,f=u.length;h0&&(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=[],h=a[u];for(let f=0,p=h.length;f0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a(e.far-e.near)**2))&&(Gne.copy(a).invert(),Gd.copy(e.ray).applyMatrix4(Gne),!(i.boundingBox!==null&&Gd.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Gd)))}_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,h=a.attributes.normal,f=a.groups,p=a.drawRange;if(s!==null)if(Array.isArray(o))for(let d=0,g=f.length;dt.far?null:{distance:u,point:WC.clone(),object:r}}function XC(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,Wy),r.getVertexPosition(l,Xy),r.getVertexPosition(u,Yy);let c=ZCe(r,e,t,i,Wy,Xy,Yy,HC);if(c){n&&(kC.fromBufferAttribute(n,s),VC.fromBufferAttribute(n,l),GC.fromBufferAttribute(n,u),c.uv=Jy.getInterpolation(HC,Wy,Xy,Yy,kC,VC,GC,new xr)),a&&(kC.fromBufferAttribute(a,s),VC.fromBufferAttribute(a,l),GC.fromBufferAttribute(a,u),c.uv1=Jy.getInterpolation(HC,Wy,Xy,Yy,kC,VC,GC,new xr)),o&&(Wne.fromBufferAttribute(o,s),Xne.fromBufferAttribute(o,l),Yne.fromBufferAttribute(o,u),c.normal=Jy.getInterpolation(HC,Wy,Xy,Yy,Wne,Xne,Yne,new ye),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let h={a:s,b:l,c:u,normal:new ye,materialIndex:0};Jy.getNormal(Wy,Xy,Yy,h.normal),c.face=h}return c}var xM=class r extends ul{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=[],h=[],f=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 kn(u,3)),this.setAttribute("normal",new kn(c,3)),this.setAttribute("uv",new kn(h,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,P=w+1,U=T+1,B=0,z=0,k=new ye;for(let G=0;G0?1:-1,c.push(k.x,k.y,k.z),h.push(J/w),h.push(1-G/T),B+=1}}for(let G=0;G0&&(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}},dR=class extends la{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Xt,this.projectionMatrix=new Xt,this.projectionMatrixInverse=new Xt,this.coordinateSystem=Zc}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)}},Pf=new ye,qne=new xr,Zne=new xr,Bn=class extends dR{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=l0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(pM*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return l0*2*Math.atan(Math.tan(pM*.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){Pf.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Pf.x,Pf.y).multiplyScalar(-e/Pf.z),Pf.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Pf.x,Pf.y).multiplyScalar(-e/Pf.z)}getViewSize(e,t){return this.getViewBounds(e,qne,Zne),t.subVectors(Zne,qne)}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(pM*.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,Zy=1,fB=class extends la{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Bn(qy,Zy,e,t);n.layers=this.layers,this.add(n);let a=new Bn(qy,Zy,e,t);a.layers=this.layers,this.add(a);let o=new Bn(qy,Zy,e,t);o.layers=this.layers,this.add(o);let s=new Bn(qy,Zy,e,t);s.layers=this.layers,this.add(s);let l=new Bn(qy,Zy,e,t);l.layers=this.layers,this.add(l);let u=new Bn(qy,Zy,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===Zc)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===oR)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,h=e.getRenderTarget(),f=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(h,f,p),e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}},mR=class extends _s{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:n0,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}},pB=class extends Kc{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 mR(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:Go}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},n=new xM(5,5,5),a=new Xu({name:"CubemapFromEquirect",uniforms:c0(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Xo,blending:Uf});a.uniforms.tEquirect.value=t;let o=new Wo(n,a),s=t.minFilter;return t.minFilter===jd&&(t.minFilter=Go),new fB(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)}},qF=new ye,QCe=new ye,eRe=new vr,Yc=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=qF.subVectors(i,t).cross(QCe.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(qF),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||eRe.getNormalMatrix(e),n=this.coplanarPoint(qF).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)}},Hd=new Vf,YC=new ye,SM=class{constructor(e=new Yc,t=new Yc,i=new Yc,n=new Yc,a=new Yc,o=new Yc){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=Zc){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],h=n[6],f=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,f-u,m-p,x-v).normalize(),i[1].setComponents(l+a,f+u,m+p,x+v).normalize(),i[2].setComponents(l+o,f+c,m+d,x+_).normalize(),i[3].setComponents(l-o,f-c,m-d,x-_).normalize(),i[4].setComponents(l-s,f-h,m-g,x-y).normalize(),t===Zc)i[5].setComponents(l+s,f+h,m+g,x+y).normalize();else if(t===oR)i[5].setComponents(s,h,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(),Hd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Hd.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hd)}intersectsSprite(e){return Hd.center.set(0,0,0),Hd.radius=.7071067811865476,Hd.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hd)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(i)0?e.max.x:e.min.x,YC.y=n.normal.y>0?e.max.y:e.min.y,YC.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(YC)<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 Wae(){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 tRe(r,e){let t=e.isWebGL2,i=new WeakMap;function n(u,c){let h=u.array,f=u.usage,p=h.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,h,f),u.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(h 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(h instanceof Int16Array)g=r.SHORT;else if(h instanceof Uint32Array)g=r.UNSIGNED_INT;else if(h instanceof Int32Array)g=r.INT;else if(h instanceof Int8Array)g=r.BYTE;else if(h instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:d,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version,size:p}}function a(u,c,h){let f=c.array,p=c._updateRange,d=c.updateRanges;if(r.bindBuffer(h,u),p.count===-1&&d.length===0&&r.bufferSubData(h,0,f),d.length!==0){for(let g=0,m=d.length;g 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif`,yRe=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,_Re=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,xRe=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,SRe=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,MRe=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,bRe=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,wRe=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif`,TRe=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } float luminance( const in vec3 rgb ) { const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,ERe=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,ARe=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,CRe=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,RRe=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,LRe=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,DRe=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,PRe="gl_FragColor = linearToOutputTexel( gl_FragColor );",IRe=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), vec3( 0.0170827, 0.0723974, 0.9105199 ) ); const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( vec3( 1.2249401, - 0.2249404, 0.0 ), vec3( - 0.0420569, 1.0420571, 0.0 ), vec3( - 0.0196376, - 0.0786361, 1.0982735 ) ); vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); } vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); } vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferOETF( in vec4 value ) { 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 ); } vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); }`,NRe=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,URe=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,ORe=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,zRe=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,FRe=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,BRe=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,kRe=`#ifdef USE_FOG varying float vFogDepth; #endif`,VRe=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,GRe=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,HRe=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif }`,WRe=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,XRe=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,YRe=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,qRe=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,ZRe=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { #if defined ( LEGACY_LIGHTS ) if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #else float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #endif } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,jRe=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,KRe=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,JRe=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; 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 ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,$Re=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,QRe=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,eLe=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,tLe=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY 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 ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE 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 ) { #else 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 ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 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 ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,rLe=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,iLe=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,nLe=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,aLe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,oLe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,sLe=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,lLe=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif`,uLe=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE 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 ); #endif diffuseColor *= sampledDiffuseColor; #endif`,cLe=`#ifdef USE_MAP uniform sampler2D map; #endif`,hLe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,fLe=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,pLe=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,dLe=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,mLe=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[MORPHTARGETS_COUNT]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif`,vLe=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,gLe=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #else objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif #endif`,yLe=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; #endif #ifdef MORPHTARGETS_TEXTURE #ifndef USE_INSTANCING_MORPH uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #else #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif #endif`,_Le=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #else transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif #endif`,xLe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,SLe=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,MLe=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,bLe=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,wLe=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,TLe=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,ELe=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,ALe=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,CLe=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,RLe=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,LLe=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,DLe=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec2 packDepthToRG( in highp float v ) { return packDepthToRGBA( v ).yx; } float unpackRGToDepth( const in highp vec2 v ) { return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); } vec4 pack2HalfToRGBA( vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { return depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); }`,PLe=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,ILe=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,NLe=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,ULe=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,OLe=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,zLe=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,FLe=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); 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 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return shadow; } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); vec3 lightToPosition = shadowCoord.xyz; float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif`,BLe=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,kLe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,VLe=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,GLe=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,HLe=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif`,WLe=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,XLe=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,YLe=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,qLe=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,ZLe=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,jLe=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 OptimizedCineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } vec3 AgXToneMapping( vec3 color ) { const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; color = max( color, 1e-10 ); color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); color = agxDefaultContrastApprox( color ); color = AgXOutsetMatrix * color; color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; color = clamp( color, 0.0, 1.0 ); return color; } vec3 NeutralToneMapping( vec3 color ) { float startCompression = 0.8 - 0.04; float desaturation = 0.15; color *= toneMappingExposure; float x = min(color.r, min(color.g, color.b)); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max(color.r, max(color.g, color.b)); if (peak < startCompression) return color; float d = 1. - startCompression; float newPeak = 1. - d * d / (peak + d - startCompression); color *= newPeak / peak; float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.); return mix(color, vec3(1, 1, 1), g); } vec3 CustomToneMapping( vec3 color ) { return color; }`,KLe=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,JLe=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,$Le=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,QLe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,e2e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,t2e=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`,r2e=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,i2e=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE 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 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,n2e=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,a2e=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,o2e=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,s2e=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,l2e=`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,u2e=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif }`,c2e=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,h2e=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,f2e=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,p2e=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,d2e=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include }`,m2e=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,v2e=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,g2e=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,y2e=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,_2e=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,x2e=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,S2e=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,M2e=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,b2e=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,w2e=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,T2e=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,E2e=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,A2e=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,C2e=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,R2e=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,L2e=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,D2e=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,P2e=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,I2e=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,N2e=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,U2e=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,yr={alphahash_fragment:rRe,alphahash_pars_fragment:iRe,alphamap_fragment:nRe,alphamap_pars_fragment:aRe,alphatest_fragment:oRe,alphatest_pars_fragment:sRe,aomap_fragment:lRe,aomap_pars_fragment:uRe,batching_pars_vertex:cRe,batching_vertex:hRe,begin_vertex:fRe,beginnormal_vertex:pRe,bsdfs:dRe,iridescence_fragment:mRe,bumpmap_pars_fragment:vRe,clipping_planes_fragment:gRe,clipping_planes_pars_fragment:yRe,clipping_planes_pars_vertex:_Re,clipping_planes_vertex:xRe,color_fragment:SRe,color_pars_fragment:MRe,color_pars_vertex:bRe,color_vertex:wRe,common:TRe,cube_uv_reflection_fragment:ERe,defaultnormal_vertex:ARe,displacementmap_pars_vertex:CRe,displacementmap_vertex:RRe,emissivemap_fragment:LRe,emissivemap_pars_fragment:DRe,colorspace_fragment:PRe,colorspace_pars_fragment:IRe,envmap_fragment:NRe,envmap_common_pars_fragment:URe,envmap_pars_fragment:ORe,envmap_pars_vertex:zRe,envmap_physical_pars_fragment:jRe,envmap_vertex:FRe,fog_vertex:BRe,fog_pars_vertex:kRe,fog_fragment:VRe,fog_pars_fragment:GRe,gradientmap_pars_fragment:HRe,lightmap_fragment:WRe,lightmap_pars_fragment:XRe,lights_lambert_fragment:YRe,lights_lambert_pars_fragment:qRe,lights_pars_begin:ZRe,lights_toon_fragment:KRe,lights_toon_pars_fragment:JRe,lights_phong_fragment:$Re,lights_phong_pars_fragment:QRe,lights_physical_fragment:eLe,lights_physical_pars_fragment:tLe,lights_fragment_begin:rLe,lights_fragment_maps:iLe,lights_fragment_end:nLe,logdepthbuf_fragment:aLe,logdepthbuf_pars_fragment:oLe,logdepthbuf_pars_vertex:sLe,logdepthbuf_vertex:lLe,map_fragment:uLe,map_pars_fragment:cLe,map_particle_fragment:hLe,map_particle_pars_fragment:fLe,metalnessmap_fragment:pLe,metalnessmap_pars_fragment:dLe,morphinstance_vertex:mLe,morphcolor_vertex:vLe,morphnormal_vertex:gLe,morphtarget_pars_vertex:yLe,morphtarget_vertex:_Le,normal_fragment_begin:xLe,normal_fragment_maps:SLe,normal_pars_fragment:MLe,normal_pars_vertex:bLe,normal_vertex:wLe,normalmap_pars_fragment:TLe,clearcoat_normal_fragment_begin:ELe,clearcoat_normal_fragment_maps:ALe,clearcoat_pars_fragment:CLe,iridescence_pars_fragment:RLe,opaque_fragment:LLe,packing:DLe,premultiplied_alpha_fragment:PLe,project_vertex:ILe,dithering_fragment:NLe,dithering_pars_fragment:ULe,roughnessmap_fragment:OLe,roughnessmap_pars_fragment:zLe,shadowmap_pars_fragment:FLe,shadowmap_pars_vertex:BLe,shadowmap_vertex:kLe,shadowmask_pars_fragment:VLe,skinbase_vertex:GLe,skinning_pars_vertex:HLe,skinning_vertex:WLe,skinnormal_vertex:XLe,specularmap_fragment:YLe,specularmap_pars_fragment:qLe,tonemapping_fragment:ZLe,tonemapping_pars_fragment:jLe,transmission_fragment:KLe,transmission_pars_fragment:JLe,uv_pars_fragment:$Le,uv_pars_vertex:QLe,uv_vertex:e2e,worldpos_vertex:t2e,background_vert:r2e,background_frag:i2e,backgroundCube_vert:n2e,backgroundCube_frag:a2e,cube_vert:o2e,cube_frag:s2e,depth_vert:l2e,depth_frag:u2e,distanceRGBA_vert:c2e,distanceRGBA_frag:h2e,equirect_vert:f2e,equirect_frag:p2e,linedashed_vert:d2e,linedashed_frag:m2e,meshbasic_vert:v2e,meshbasic_frag:g2e,meshlambert_vert:y2e,meshlambert_frag:_2e,meshmatcap_vert:x2e,meshmatcap_frag:S2e,meshnormal_vert:M2e,meshnormal_frag:b2e,meshphong_vert:w2e,meshphong_frag:T2e,meshphysical_vert:E2e,meshphysical_frag:A2e,meshtoon_vert:C2e,meshtoon_frag:R2e,points_vert:L2e,points_frag:D2e,shadow_vert:P2e,shadow_frag:I2e,sprite_vert:N2e,sprite_frag:U2e},St={common:{diffuse:{value:new nr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new vr},alphaMap:{value:null},alphaMapTransform:{value:new vr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new vr}},envmap:{envMap:{value:null},envMapRotation:{value:new vr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new vr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new vr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new vr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new vr},normalScale:{value:new xr(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new vr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new vr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new vr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new vr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new nr(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 nr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new vr},alphaTest:{value:0},uvTransform:{value:new vr}},sprite:{diffuse:{value:new nr(16777215)},opacity:{value:1},center:{value:new xr(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new vr},alphaMap:{value:null},alphaMapTransform:{value:new vr},alphaTest:{value:0}}},Hu={basic:{uniforms:Da([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.fog]),vertexShader:yr.meshbasic_vert,fragmentShader:yr.meshbasic_frag},lambert:{uniforms:Da([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.fog,St.lights,{emissive:{value:new nr(0)}}]),vertexShader:yr.meshlambert_vert,fragmentShader:yr.meshlambert_frag},phong:{uniforms:Da([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.fog,St.lights,{emissive:{value:new nr(0)},specular:{value:new nr(1118481)},shininess:{value:30}}]),vertexShader:yr.meshphong_vert,fragmentShader:yr.meshphong_frag},standard:{uniforms:Da([St.common,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.roughnessmap,St.metalnessmap,St.fog,St.lights,{emissive:{value:new nr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:yr.meshphysical_vert,fragmentShader:yr.meshphysical_frag},toon:{uniforms:Da([St.common,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.gradientmap,St.fog,St.lights,{emissive:{value:new nr(0)}}]),vertexShader:yr.meshtoon_vert,fragmentShader:yr.meshtoon_frag},matcap:{uniforms:Da([St.common,St.bumpmap,St.normalmap,St.displacementmap,St.fog,{matcap:{value:null}}]),vertexShader:yr.meshmatcap_vert,fragmentShader:yr.meshmatcap_frag},points:{uniforms:Da([St.points,St.fog]),vertexShader:yr.points_vert,fragmentShader:yr.points_frag},dashed:{uniforms:Da([St.common,St.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:yr.linedashed_vert,fragmentShader:yr.linedashed_frag},depth:{uniforms:Da([St.common,St.displacementmap]),vertexShader:yr.depth_vert,fragmentShader:yr.depth_frag},normal:{uniforms:Da([St.common,St.bumpmap,St.normalmap,St.displacementmap,{opacity:{value:1}}]),vertexShader:yr.meshnormal_vert,fragmentShader:yr.meshnormal_frag},sprite:{uniforms:Da([St.sprite,St.fog]),vertexShader:yr.sprite_vert,fragmentShader:yr.sprite_frag},background:{uniforms:{uvTransform:{value:new vr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:yr.background_vert,fragmentShader:yr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new vr}},vertexShader:yr.backgroundCube_vert,fragmentShader:yr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:yr.cube_vert,fragmentShader:yr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:yr.equirect_vert,fragmentShader:yr.equirect_frag},distanceRGBA:{uniforms:Da([St.common,St.displacementmap,{referencePosition:{value:new ye},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:yr.distanceRGBA_vert,fragmentShader:yr.distanceRGBA_frag},shadow:{uniforms:Da([St.lights,St.fog,{color:{value:new nr(0)},opacity:{value:1}}]),vertexShader:yr.shadow_vert,fragmentShader:yr.shadow_frag}};Hu.physical={uniforms:Da([Hu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new vr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new vr},clearcoatNormalScale:{value:new xr(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new vr},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new vr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new vr},sheen:{value:0},sheenColor:{value:new nr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new vr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new vr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new vr},transmissionSamplerSize:{value:new xr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new vr},attenuationDistance:{value:0},attenuationColor:{value:new nr(0)},specularColor:{value:new nr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new vr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new vr},anisotropyVector:{value:new xr},anisotropyMap:{value:null},anisotropyMapTransform:{value:new vr}}]),vertexShader:yr.meshphysical_vert,fragmentShader:yr.meshphysical_frag};var qC={r:0,b:0,g:0},Wd=new Gn,O2e=new Xt;function z2e(r,e,t,i,n,a,o){let s=new nr(0),l=a===!0?0:1,u,c,h=null,f=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===UR)?(c===void 0&&(c=new Wo(new xM(1,1,1),new Xu({name:"BackgroundCubeMaterial",uniforms:c0(Hu.backgroundCube.uniforms),vertexShader:Hu.backgroundCube.vertexShader,fragmentShader:Hu.backgroundCube.fragmentShader,side:Xo,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(O2e.makeRotationFromEuler(Wd)),c.material.toneMapped=ti.getTransfer(y.colorSpace)!==ui,(h!==y||f!==y.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,h=y,f=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 Wo(new vR(2,2),new Xu({name:"BackgroundMaterial",uniforms:c0(Hu.background.uniforms),vertexShader:Hu.background.vertexShader,fragmentShader:Hu.background.fragmentShader,side:Ff,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=ti.getTransfer(y.colorSpace)!==ui,y.matrixAutoUpdate===!0&&y.updateMatrix(),u.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||f!==y.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,h=y,f=y.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null))}function g(m,v){m.getRGB(qC,Hae(r)),i.buffers.color.setClear(qC.r,qC.g,qC.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 F2e(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 h(A,P,U,B,z){let k=!1;if(o){let G=g(B,U,P);u!==G&&(u=G,p(u.object)),k=v(A,B,U,z),k&&_(A,B,U,z)}else{let G=P.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,P,U,B),z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function f(){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,P,U){let B=U.wireframe===!0,z=s[A.id];z===void 0&&(z={},s[A.id]=z);let k=z[P.id];k===void 0&&(k={},z[P.id]=k);let G=k[B];return G===void 0&&(G=m(f()),k[B]=G),G}function m(A){let P=[],U=[],B=[];for(let z=0;z=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,P,U,B){let z={},k=P.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 P=0,U=A.length;P=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===Iae);if(Q.isInterleavedBufferAttribute){let q=Q.data,H=q.stride,We=Q.offset;if(q.isInstancedInterleavedBuffer){for(let _e=0;_e0&&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,h=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=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=f>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:h,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:S}}function V2e(r){let e=this,t=null,i=0,n=!1,a=!1,o=new Yc,s=new vr,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){let p=h.length!==0||f||i!==0||n;return n=f,i=h.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(h,f){t=c(h,f,0)},this.setState=function(h,f,p){let d=h.clippingPlanes,g=h.clipIntersection,m=h.clipShadows,v=r.get(h);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,f,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(h,f,p,d){let g=h!==null?h.length:0,m=null;if(g!==0){if(m=l.value,d!==!0||m===null){let v=p+g*4,_=f.matrixWorldInverse;s.getNormalMatrix(_),(m===null||m.length0){let u=new pB(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 h0=class extends dR{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}},$y=4,jne=[.125,.215,.35,.446,.526,.582],Zd=20,ZF=new h0,Kne=new nr,jF=null,KF=0,JF=0,Yd=(1+Math.sqrt(5))/2,jy=1/Yd,Jne=[new ye(1,1,1),new ye(-1,1,1),new ye(1,1,-1),new ye(-1,1,-1),new ye(0,Yd,jy),new ye(0,Yd,-jy),new ye(jy,0,Yd),new ye(-jy,0,Yd),new ye(Yd,jy,0),new ye(-Yd,jy,0)],gR=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){jF=this._renderer.getRenderTarget(),KF=this._renderer.getActiveCubeFace(),JF=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=eae(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Qne(),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;e2?y:0,y,y),c.setRenderTarget(n),g&&c.render(d,s),c.render(e,s)}d.geometry.dispose(),d.material.dispose(),c.toneMapping=f,c.autoClear=h,e.background=m}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===n0||e.mapping===a0;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=eae()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Qne());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new Wo(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;ZC(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,ZF)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;nZd&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Zd}`);let v=[],_=0;for(let w=0;wy-$y?n-y+$y:0),S=4*(this._cubeSize-x);ZC(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(h,ZF)}};function H2e(r){let e=[],t=[],i=[],n=r,a=r-$y+1+jne.length;for(let o=0;or-$y?l=jne[o-r+$y-1]:o===0&&(l=0),i.push(l);let u=1/(s-2),c=-u,h=1+u,f=[c,c,h,c,h,h,c,c,h,h,c,h],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;S2?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(f,m*d*S);let b=[S,S,S,S,S,S];x.set(b,v*d*S)}let M=new ul;M.setAttribute("position",new ll(_,g)),M.setAttribute("uv",new ll(y,m)),M.setAttribute("faceIndex",new ll(x,v)),e.push(M),n>$y&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function $ne(r,e,t){let i=new Kc(r,e,t);return i.texture.mapping=UR,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ZC(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function W2e(r,e,t){let i=new Float32Array(Zd),n=new ye(0,1,0);return new Xu({name:"SphericalGaussianBlur",defines:{n:Zd,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:YB(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:Uf,depthTest:!1,depthWrite:!1})}function Qne(){return new Xu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:YB(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:Uf,depthTest:!1,depthWrite:!1})}function eae(){return new Xu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:YB(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:Uf,depthTest:!1,depthWrite:!1})}function YB(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function X2e(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===vM||l===oB,c=l===n0||l===a0;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let h=e.get(s);return t===null&&(t=new gR(r)),h=u?t.fromEquirectangular(s,h):t.fromCubemap(s,h),e.set(s,h),h.texture}else{if(e.has(s))return e.get(s).texture;{let h=s.image;if(u&&h&&h.height>0||c&&h&&n(h)){t===null&&(t=new gR(r));let f=u?t.fromEquirectangular(s):t.fromCubemap(s);return e.set(s,f),s.addEventListener("dispose",a),f.texture}else return null}}}return s}function n(s){let l=0,u=6;for(let c=0;ce.maxTextureSize&&(C=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);let b=new Float32Array(T*C*4*g),E=new cR(b,T,C,g);E.type=Wu,E.needsUpdate=!0;let I=w*4;for(let A=0;A0)return r;let n=e*t,a=tae[n];if(a===void 0&&(a=new Float32Array(n),tae[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 ln(r,e){if(r.length!==e.length)return!1;for(let t=0,i=r.length;t":" "} ${s}: ${t[o]}`)}return i.join(` `)}function WDe(r){let e=ti.getPrimaries(ti.workingColorSpace),t=ti.getPrimaries(r),i;switch(e===t?i="":e===aR&&t===nR?i="LinearDisplayP3ToLinearSRGB":e===nR&&t===aR&&(i="LinearSRGBToLinearDisplayP3"),r){case Yf:case OR:return[i,"LinearTransferOETF"];case Pa:case WB:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function lae(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()+` `+n+` `+HDe(r.getShaderSource(e),o)}else return n}function XDe(r,e){let t=WDe(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function YDe(r,e){let t;switch(e){case YAe:t="Linear";break;case qAe:t="Reinhard";break;case ZAe:t="OptimizedCineon";break;case jAe:t="ACESFilmic";break;case JAe:t="AgX";break;case $Ae:t="Neutral";break;case KAe:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function qDe(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(Qy).join(` `)}function ZDe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Qy).join(` `)}function jDe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` `)}function KDe(r,e){let t={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let n=0;n/gm;function gB(r){return r.replace(JDe,QDe)}var $De=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function QDe(r,e){let t=yr[e];if(t===void 0){let i=$De.get(e);if(i!==void 0)t=yr[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 gB(t)}var ePe=/#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 hae(r){return r.replace(ePe,tPe)}function tPe(r,e,t,i){let n="";for(let a=parseInt(e);a0&&(v+=` `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Qy).join(` `),_.length>0&&(_+=` `)):(v=[fae(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",` `].filter(Qy).join(` `),_=[p,fae(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 "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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!==Of?"#define TONE_MAPPING":"",t.toneMapping!==Of?yr.tonemapping_pars_fragment:"",t.toneMapping!==Of?YDe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",yr.colorspace_pars_fragment,XDe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Qy).join(` `)),o=gB(o),o=uae(o,t),o=cae(o,t),s=gB(s),s=uae(s,t),s=cae(s,t),o=hae(o),s=hae(s),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,v=[d,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+v,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===Rne?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Rne?"":"#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(` `)+` `+_);let x=y+v+o,M=y+_+s,S=sae(n,n.VERTEX_SHADER,x),w=sae(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(),P=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=lae(n,S,"vertex"),k=lae(n,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(m,n.VALIDATE_STATUS)+` Material Name: `+I.name+` Material Type: `+I.type+` Program Info Log: `+R+` `+z+` `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||P==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:P,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new i0(n,m),b=KDe(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,VDe)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=GDe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var lPe=0,yB=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 _B(e),t.set(e,i)),i}},_B=class{constructor(e){this.id=lPe++,this.code=e,this.usedTimes=0}};function uPe(r,e,t,i,n,a,o){let s=new hR,l=new yB,u=new Set,c=[],h=n.isWebGL2,f=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 P=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,z=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=z&&z.mapping===UR?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 kt=Hu[G];V=kt.vertexShader,K=kt.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,dt=!!b.metalnessMap,F=!!b.roughnessMap,L=b.anisotropy>0,ne=b.clearcoat>0,le=b.iridescence>0,me=b.sheen>0,fe=b.transmission>0,et=L&&!!b.anisotropyMap,Ke=ne&&!!b.clearcoatMap,Se=ne&&!!b.clearcoatNormalMap,Ae=ne&&!!b.clearcoatRoughnessMap,st=le&&!!b.iridescenceMap,$=le&&!!b.iridescenceThicknessMap,nt=me&&!!b.sheenColorMap,Xe=me&&!!b.sheenRoughnessMap,Fe=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,ct=fe&&!!b.transmissionMap,Je=fe&&!!b.thicknessMap,Gt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,De=Of;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(De=r.toneMapping);let wt={isWebGL2:h,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:Yf,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===hCe,normalMapTangentSpace:Ue&&b.normalMapType===HB,metalnessMap:dt,roughnessMap:F,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:st,iridescenceThicknessMap:$,sheen:me,sheenColorMap:nt,sheenRoughnessMap:Xe,specularMap:Fe,specularColorMap:we,specularIntensityMap:Ie,transmission:fe,transmissionMap:ct,thicknessMap:Je,gradientMap:Gt,opaque:b.transparent===!1&&b.blending===t0&&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:dt&&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:st&&m(b.iridescenceMap.channel),iridescenceThicknessMapUv:$&&m(b.iridescenceThicknessMap.channel),sheenColorMapUv:nt&&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:ct&&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:!!P,useFog:b.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:f,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:De,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&ti.getTransfer(b.map.colorSpace)===ui,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===qc,flipSided:b.side===Xo,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:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return wt.vertexUv1s=u.has(1),wt.vertexUv2s=u.has(2),wt.vertexUv3s=u.has(3),u.clear(),wt}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=Hu[E];I=KCe.clone(R.uniforms)}else I=b.uniforms;return I}function S(b,E){let I;for(let R=0,A=c.length;R0?i.push(v):p.transparent===!0?n.push(v):t.push(v)}function l(h,f,p,d,g,m){let v=o(h,f,p,d,g,m);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):t.unshift(v)}function u(h,f){t.length>1&&t.sort(h||hPe),i.length>1&&i.sort(f||pae),n.length>1&&n.sort(f||pae)}function c(){for(let h=e,f=r.length;h=a.length?(o=new dae,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function pPe(){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 nr};break;case"SpotLight":t={position:new ye,direction:new ye,color:new nr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ye,color:new nr,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ye,skyColor:new nr,groundColor:new nr};break;case"RectAreaLight":t={color:new nr,position:new ye,halfWidth:new ye,halfHeight:new ye};break}return r[e.id]=t,t}}}function dPe(){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 xr};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new xr};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new xr,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var mPe=0;function vPe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function gPe(r,e){let t=new pPe,i=dPe(),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 Xt,s=new Xt;function l(c,h){let f=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(vPe);let b=h===!0?Math.PI:1;for(let I=0,R=c.length;I0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=St.LTC_FLOAT_1,n.rectAreaLTC2=St.LTC_FLOAT_2):(n.rectAreaLTC1=St.LTC_HALF_1,n.rectAreaLTC2=St.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=St.LTC_FLOAT_1,n.rectAreaLTC2=St.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=St.LTC_HALF_1,n.rectAreaLTC2=St.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=f,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=mPe++)}function u(c,h){let f=0,p=0,d=0,g=0,m=0,v=h.matrixWorldInverse;for(let _=0,y=c.length;_=s.length?(l=new mae(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var xB=class extends Jc{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=uCe,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}},SB=class extends Jc{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}},_Pe=`void main() { gl_Position = vec4( position, 1.0 ); }`,xPe=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function SPe(r,e,t){let i=new SM,n=new xr,a=new xr,o=new Ur,s=new xB({depthPacking:cCe}),l=new SB,u={},c=t.maxTextureSize,h={[Ff]:Xo,[Xo]:Ff,[qc]:qc},f=new Xu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new xr},radius:{value:4}},vertexShader:_Pe,fragmentShader:xPe}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let d=new ul;d.setAttribute("position",new ll(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Wo(d,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Pae;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(Uf),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==Xc&&this.type===Xc,A=v===Xc&&this.type!==Xc;for(let P=0,U=S.length;Pc||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!==Xc?{minFilter:zn,magFilter:zn}:{};z.map!==null&&z.map.dispose(),z.map=new Kc(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;Y0||w.map&&w.alphaTest>0){let I=b.uuid,R=w.uuid,A=u[I];A===void 0&&(A={},u[I]=A);let P=A[R];P===void 0&&(P=b.clone(),A[R]=P,w.addEventListener("dispose",M)),b=P}if(b.visible=w.visible,b.wireframe=w.wireframe,C===Xc?b.side=w.shadowSide!==null?w.shadowSide:w.side:b.side=w.shadowSide!==null?w.shadowSide:h[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===Xc)&&(!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 P=R.groups;for(let U=0,B=P.length;U=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 Ur().fromArray(Q),ae=new Ur().fromArray(V);function ve(X,Te,te,Me){let De=new Uint8Array(4),wt=r.createTexture();r.bindTexture(X,wt),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let kt=0;kt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new xr,h=new WeakMap,f,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):yM("canvas")}function m(F,L,ne,le){let me=1,fe=dt(F);if((fe.width>le||fe.height>le)&&(me=le/Math.max(fe.width,fe.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?sR:Math.floor,Ke=et(me*fe.width),Se=et(me*fe.height);f===void 0&&(f=g(Ke,Se));let Ae=ne?g(Ke,Se):f;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 ("+fe.width+"x"+fe.height+") to ("+Ke+"x"+Se+")."),Ae}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+fe.width+"x"+fe.height+")."),F;return F}function v(F){let L=dt(F);return uB(L.width)&&uB(L.height)}function _(F){return s?!1:F.wrapS!==Ho||F.wrapT!==Ho||F.minFilter!==zn&&F.minFilter!==Go}function y(F,L){return F.generateMipmaps&&L&&F.minFilter!==zn&&F.minFilter!==Go}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 fe=L;if(L===r.RED&&(ne===r.FLOAT&&(fe=r.R32F),ne===r.HALF_FLOAT&&(fe=r.R16F),ne===r.UNSIGNED_BYTE&&(fe=r.R8)),L===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(fe=r.R8UI),ne===r.UNSIGNED_SHORT&&(fe=r.R16UI),ne===r.UNSIGNED_INT&&(fe=r.R32UI),ne===r.BYTE&&(fe=r.R8I),ne===r.SHORT&&(fe=r.R16I),ne===r.INT&&(fe=r.R32I)),L===r.RG&&(ne===r.FLOAT&&(fe=r.RG32F),ne===r.HALF_FLOAT&&(fe=r.RG16F),ne===r.UNSIGNED_BYTE&&(fe=r.RG8)),L===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(fe=r.RG8UI),ne===r.UNSIGNED_SHORT&&(fe=r.RG16UI),ne===r.UNSIGNED_INT&&(fe=r.RG32UI),ne===r.BYTE&&(fe=r.RG8I),ne===r.SHORT&&(fe=r.RG16I),ne===r.INT&&(fe=r.RG32I)),L===r.RGBA){let et=me?iR:ti.getTransfer(le);ne===r.FLOAT&&(fe=r.RGBA32F),ne===r.HALF_FLOAT&&(fe=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(fe=et===ui?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(fe=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(fe=r.RGB5_A1)}return(fe===r.R16F||fe===r.R32F||fe===r.RG16F||fe===r.RG32F||fe===r.RGBA16F||fe===r.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function S(F,L,ne){return y(F,ne)===!0||F.isFramebufferTexture&&F.minFilter!==zn&&F.minFilter!==Go?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===zn||F===$ie||F===sM?r.NEAREST:r.LINEAR}function T(F){let L=F.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&h.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=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={[o0]:r.REPEAT,[Ho]:r.CLAMP_TO_EDGE,[sB]:r.MIRRORED_REPEAT},J={[zn]:r.NEAREST,[$ie]:r.NEAREST_MIPMAP_NEAREST,[sM]:r.NEAREST_MIPMAP_LINEAR,[Go]:r.LINEAR,[MF]:r.LINEAR_MIPMAP_NEAREST,[jd]:r.LINEAR_MIPMAP_LINEAR},Q={[fCe]:r.NEVER,[yCe]:r.ALWAYS,[pCe]:r.LESS,[kae]:r.LEQUAL,[dCe]:r.EQUAL,[gCe]:r.GEQUAL,[mCe]:r.GREATER,[vCe]:r.NOTEQUAL};function V(F,L,ne){if(L.type===Wu&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===Go||L.magFilter===MF||L.magFilter===sM||L.magFilter===jd||L.minFilter===Go||L.minFilter===MF||L.minFilter===sM||L.minFilter===jd)&&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!==Ho||L.wrapT!==Ho)&&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!==zn&&L.minFilter!==Go&&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===zn||L.minFilter!==sM&&L.minFilter!==jd||L.type===Wu&&e.has("OES_texture_float_linear")===!1||s===!1&&L.type===gM&&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 fe=U(L);if(fe!==F.__cacheKey){me[fe]===void 0&&(me[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[fe].usedTimes++;let et=me[F.__cacheKey];et!==void 0&&(me[F.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),F.__cacheKey=fe,F.__webglTexture=me[fe].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),fe=L.source;t.bindTexture(le,F.__webglTexture,r.TEXTURE0+ne);let et=i.get(fe);if(fe.version!==et.__version||me===!0){t.activeTexture(r.TEXTURE0+ne);let Ke=ti.getPrimaries(ti.workingColorSpace),Se=L.colorSpace===If?null:ti.getPrimaries(L.colorSpace),Ae=L.colorSpace===If||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 st=_(L)&&v(L.image)===!1,$=m(L.image,st,!1,n.maxTextureSize);$=Ve(L,$);let nt=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,nt);let Ie,ct=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==Bae,Gt=et.__version===void 0||me===!0,X=fe.dataReady,Te=S(L,$,nt);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===Wu?we=r.DEPTH_COMPONENT32F:L.type===Nf?we=r.DEPTH_COMPONENT24:L.type===Kd?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===Wu&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Jd&&we===r.DEPTH_COMPONENT&&L.type!==GB&&L.type!==Nf&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Nf,Fe=a.convert(L.type)),L.format===s0&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==Kd&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=Kd,Fe=a.convert(L.type))),Gt&&(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(ct.length>0&&nt){Je&&Gt&&t.texStorage2D(r.TEXTURE_2D,Te,we,ct[0].width,ct[0].height);for(let te=0,Me=ct.length;te>=1,Me>>=1}}else if(ct.length>0&&nt){if(Je&&Gt){let te=dt(ct[0]);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}for(let te=0,Me=ct.length;te0&&X++;let te=dt($[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,te.width,te.height)}for(let te=0;te<6;te++)if(st){ct?Gt&&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>fe),$=Math.max(1,L.height>>fe);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,fe,Se,st,$,L.depth,0,et,Ke,null):t.texImage2D(me,fe,Se,st,$,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,fe),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===Wu?le=r.DEPTH_COMPONENT32F:me.type===Nf&&(le=r.DEPTH_COMPONENT24));let fe=Le(L);Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,fe,le,L.width,L.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,fe,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;me1,Ke=v(F)||s;if(et||(le.__webglTexture===void 0&&(le.__webglTexture=r.createTexture()),le.__version=L.version,o.memory.textures++),fe){ne.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer[Se]=[];for(let Ae=0;Ae0){ne.__webglFramebuffer=[];for(let Se=0;Se0&&Ue(F)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Se=0;Se0)for(let Ae=0;Ae0)for(let Ae=0;Ae0&&Ue(F)===!1){let L=F.textures,ne=F.width,le=F.height,me=r.COLOR_BUFFER_BIT,fe=[],et=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(F),Se=L.length>1;if(Se)for(let Ae=0;Ae0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(F){let L=o.render.frame;h.get(F)!==L&&(h.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===lB||ne!==Yf&&ne!==If&&(ti.getTransfer(ne)===ui?s===!1?e.has("EXT_sRGB")===!0&&le===sl?(F.format=lB,F.minFilter=Go,F.generateMipmaps=!1):L=lR.sRGBToLinear(L):(le!==sl||me!==zf)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),L}function dt(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=P,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 wPe(r,e,t){let i=t.isWebGL2;function n(a,o=If){let s,l=ti.getTransfer(o);if(a===zf)return r.UNSIGNED_BYTE;if(a===Nae)return r.UNSIGNED_SHORT_4_4_4_4;if(a===Uae)return r.UNSIGNED_SHORT_5_5_5_1;if(a===eCe)return r.BYTE;if(a===tCe)return r.SHORT;if(a===GB)return r.UNSIGNED_SHORT;if(a===Iae)return r.INT;if(a===Nf)return r.UNSIGNED_INT;if(a===Wu)return r.FLOAT;if(a===gM)return i?r.HALF_FLOAT:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(a===rCe)return r.ALPHA;if(a===sl)return r.RGBA;if(a===iCe)return r.LUMINANCE;if(a===nCe)return r.LUMINANCE_ALPHA;if(a===Jd)return r.DEPTH_COMPONENT;if(a===s0)return r.DEPTH_STENCIL;if(a===lB)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===aCe)return r.RED;if(a===Oae)return r.RED_INTEGER;if(a===oCe)return r.RG;if(a===zae)return r.RG_INTEGER;if(a===Fae)return r.RGBA_INTEGER;if(a===bF||a===wF||a===TF||a===EF)if(l===ui)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===bF)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===wF)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===TF)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===EF)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===bF)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===wF)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===TF)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===EF)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===Qie||a===ene||a===tne||a===rne)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===Qie)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===ene)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===tne)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===rne)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===Bae)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===ine||a===nne)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===ine)return l===ui?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===nne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===ane||a===one||a===sne||a===lne||a===une||a===cne||a===hne||a===fne||a===pne||a===dne||a===mne||a===vne||a===gne||a===yne)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===ane)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===one)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===sne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===lne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===une)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===cne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===hne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===fne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===pne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===dne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===mne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===vne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===gne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===yne)return l===ui?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===AF||a===_ne||a===xne)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===AF)return l===ui?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===_ne)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===xne)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===sCe||a===Sne||a===Mne||a===bne)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===AF)return s.COMPRESSED_RED_RGTC1_EXT;if(a===Sne)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===Mne)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===bne)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===Kd?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 MB=class extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},jc=class extends la{constructor(){super(),this.isGroup=!0,this.type="Group"}},TPe={type:"move"},mM=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new jc,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 jc,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 jc,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"],h=u.joints["thumb-tip"],f=c.position.distanceTo(h.position),p=.02,d=.005;u.inputState.pinching&&f>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&f<=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(TPe)))}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 jc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},EPe=` void main() { gl_Position = vec4( position, 1.0 ); }`,APe=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`,bB=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 _s,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 Xu({extensions:{fragDepth:!0},vertexShader:EPe,fragmentShader:APe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new Wo(new vR(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},wB=class extends Bf{constructor(e,t){super();let i=this,n=null,a=1,o=null,s="local-floor",l=1,u=null,c=null,h=null,f=null,p=null,d=null,g=new bB,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new xr,S=null,w=new Bn;w.layers.enable(1),w.viewport=new Ur;let T=new Bn;T.layers.enable(2),T.viewport=new Ur;let C=[w,T],b=new MB;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 mM,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new mM,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new mM,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",P);for(let V=0;V=0&&(x[ve]=null,y[ve].disconnect(ae))}for(let K=0;K=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 dt=Ee+Ne,F=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/F*dt,me=We*q/F*dt;V.projectionMatrix.makePerspective(L,ne,le,me,dt,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;ve0&&(m.alphaTest.value=v.alphaTest);let _=e.get(v),y=_.envMap,x=_.envMapRotation;if(y&&(m.envMap.value=y,Xd.copy(x),Xd.x*=-1,Xd.y*=-1,Xd.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Xd.y*=-1,Xd.z*=-1),m.envMapRotation.value.setFromMatrix4(CPe.makeRotationFromEuler(Xd)),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 h(m,v){v.gradientMap&&(m.gradientMap.value=v.gradientMap)}function f(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===Xo&&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 LPe(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&&(f(_),a[_.id]=S)}function c(_){let y=h();_.__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 h(){for(let _=0;_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 TB=class{constructor(e={}){let{canvas:t=ICe(),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:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=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=Pa,this._useLegacyLights=!1,this.toneMapping=Of,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new Ur,E=new Ur,I=null,R=new nr(0),A=0,P=t.width,U=t.height,B=1,z=null,k=null,G=new Ur(0,0,P,U),Y=new Ur(0,0,P,U),J=!1,Q=new SM,V=!1,K=!1,ae=null,ve=new Xt,ue=new xr,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{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){D(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let kt=null;function Tr(O){kt&&kt(O)}function $r(){Or.stop()}function Ht(){Or.start()}let Or=new Wae;Or.setAnimationLoop(Tr),typeof self<"u"&&Or.setContext(self),this.setAnimationLoop=function(O){kt=O,Je.setAnimationLoop(O),O===null?Or.stop():Or.start()},Je.addEventListener("sessionstart",$r),Je.addEventListener("sessionend",Ht),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),hi(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)&&st.render(g,O),m.setupLights(y._useLegacyLights),j.isArrayCamera){let ie=j.cameras;for(let D=0,W=ie.length;D0?m=_[_.length-1]:m=null,v.pop(),v.length>0?g=v[v.length-1]:g=null};function hi(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;Oe0&&l_(D,W,j,re),ie&&Le.viewport(b.copy(ie)),D.length>0&&gl(D,j,re),W.length>0&&gl(W,j,re),ee.length>0&&gl(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function l_(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new Kc(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?gM:zf,minFilter:jd,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(sR(ue.x),sR(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=Of,gl(O,re,ie),Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae);let ce=!1;for(let Oe=0,Ge=j.length;Oe0),Re=!!re.morphAttributes.position,gt=!!re.morphAttributes.normal,_t=!!re.morphAttributes.color,$e=Of;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let lt=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Ct=lt!==void 0?lt.length:0,je=Ne.get(ie),_i=m.state.lights;if(V===!0&&(K===!0||O!==C)){let Qr=O===C&&ie.id===T;Se.setState(ie,O,Qr)}let Ft=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==_i.state.version||je.outputColorSpace!==ge||D.isBatchedMesh&&je.batching===!1||!D.isBatchedMesh&&je.batching===!0||D.isInstancedMesh&&je.instancing===!1||!D.isInstancedMesh&&je.instancing===!0||D.isSkinnedMesh&&je.skinning===!1||!D.isSkinnedMesh&&je.skinning===!0||D.isInstancedMesh&&je.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&je.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&je.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&je.instancingMorph===!1&&D.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!==gt||je.morphColors!==_t||je.toneMapping!==$e||xe.isWebGL2===!0&&je.morphTargetsCount!==Ct)&&(Ft=!0):(Ft=!0,je.__version=ie.version);let Nr=je.currentProgram;Ft===!0&&(Nr=Es(ie,j,D));let Yi=!1,Et=!1,Ei=!1,cr=Nr.getUniforms(),hn=je.uniforms;if(Le.useProgram(Nr.program)&&(Yi=!0,Et=!0,Ei=!0),ie.id!==T&&(T=ie.id,Et=!0),Yi||C!==O){cr.setValue(H,"projectionMatrix",O.projectionMatrix),cr.setValue(H,"viewMatrix",O.matrixWorldInverse);let Qr=cr.map.cameraPosition;Qr!==void 0&&Qr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&cr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&cr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,Et=!0,Ei=!0)}if(D.isSkinnedMesh){cr.setOptional(H,D,"bindMatrix"),cr.setOptional(H,D,"bindMatrixInverse");let Qr=D.skeleton;Qr&&(xe.floatVertexTextures?(Qr.boneTexture===null&&Qr.computeBoneTexture(),cr.setValue(H,"boneTexture",Qr.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."))}D.isBatchedMesh&&(cr.setOptional(H,D,"batchingTexture"),cr.setValue(H,"batchingTexture",D._matricesTexture,Ve));let Ju=re.morphAttributes;if((Ju.position!==void 0||Ju.normal!==void 0||Ju.color!==void 0&&xe.isWebGL2===!0)&&$.update(D,re,Nr),(Et||je.receiveShadow!==D.receiveShadow)&&(je.receiveShadow=D.receiveShadow,cr.setValue(H,"receiveShadow",D.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(hn.envMap.value=ce,hn.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),Et&&(cr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&c_(hn,Ei),W&&ie.fog===!0&&fe.refreshFogUniforms(hn,W),fe.refreshMaterialUniforms(hn,ie,B,U,ae),i0.upload(H,ip(je),hn,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(i0.upload(H,ip(je),hn,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&cr.setValue(H,"center",D.center),cr.setValue(H,"modelViewMatrix",D.modelViewMatrix),cr.setValue(H,"normalMatrix",D.normalMatrix),cr.setValue(H,"modelMatrix",D.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let Qr=ie.uniformsGroups;for(let $u=0,np=Qr.length;$u0&&Ve.useMultisampledRTT(O)===!1?D=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?D=Ge[re]:D=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,D)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,D),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,D,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!==sl&&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===gM&&(_e.has("EXT_color_buffer_half_float")||xe.isWebGL2&&_e.has("EXT_color_buffer_float"));if(Ge!==zf&&Fe.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===Wu&&(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-D&&H.readPixels(j,re,ie,D,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),D=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,D,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let D=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,D,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,D=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),gt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),_t=H.getParameter(H.UNPACK_SKIP_PIXELS),$e=H.getParameter(H.UNPACK_SKIP_ROWS),lt=H.getParameter(H.UNPACK_SKIP_IMAGES),Ct=re.isCompressedTexture?re.mipmaps[D]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,Ct.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Ct.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,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Ct.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Ct.data):H.texSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Ct),H.pixelStorei(H.UNPACK_ROW_LENGTH,Re),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,gt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,_t),H.pixelStorei(H.UNPACK_SKIP_ROWS,$e),H.pixelStorei(H.UNPACK_SKIP_IMAGES,lt),D===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 Zc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===WB?"display-p3":"srgb",t.unpackColorSpace=ti.workingColorSpace===OR?"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}},EB=class extends TB{};EB.prototype.isWebGL1Renderer=!0;var vae=new ye,gae=new Ur,yae=new Ur,DPe=new ye,_ae=new Xt,jC=new ye,QF=new Vf,xae=new Xt,eB=new _M,_R=class extends Wo{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Kie,this.bindMatrix=new Xt,this.bindMatrixInverse=new Xt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new kf),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let i=0;il)continue;f.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(f);Te.far||t.push({distance:T,point:h.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;yl)continue;f.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(f);Se.far||t.push({distance:S,point:h.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;a0)l=n-1;else{l=n;break}if(n=l,i[n]===o)return n/(a-1);let c=i[n],f=i[n+1]-c,p=(o-c)/f;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 xr: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 Xt;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),h=Math.abs(n[0].y),f=Math.abs(n[0].z);c<=u&&(u=c,i.set(1,0,0)),h<=u&&(u=h,i.set(0,1,0)),f<=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(Fn(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(Fn(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 IPe={triangulate:function(r,e,t=2){let i=e&&e.length,n=i?e[0]*t:r.length,a=Kae(r,0,n,t,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u,c,h,f,p;if(i&&(a=FPe(r,e,a,t)),r.length>80*t){s=u=r[0],l=c=r[1];for(let d=t;du&&(u=h),f>c&&(c=f);p=Math.max(u-s,c-l),p=p!==0?32767/p:0}return bM(a,o,t,s,l,p,0),o}};function Kae(r,e,t,i,n){let a,o;if(n===jPe(r,e,t,i)>0)for(a=e;a=e;a-=i)o=Tae(a,r[a],r[a+1],o);return o&&FR(o,o.next)&&(TM(o),o=o.next),o}function $d(r,e){if(!r)return r;e||(e=r);let t=r,i;do if(i=!1,!t.steiner&&(FR(t,t.next)||wi(t.prev,t,t.next)===0)){if(TM(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function bM(r,e,t,i,n,a,o){if(!r)return;!o&&a&&HPe(r,i,n,a);let s=r,l,u;for(;r.prev!==r.next;){if(l=r.prev,u=r.next,a?UPe(r,i,n,a):NPe(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),TM(r),r=u.next,s=u.next;continue}if(r=u,r===s){o?o===1?(r=OPe($d(r),e,t),bM(r,e,t,i,n,a,2)):o===2&&zPe(r,e,t,i,n,a):bM($d(r),e,t,i,n,a,1);break}}}function NPe(r){let e=r.prev,t=r,i=r.next;if(wi(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=na?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<=f&&d.y>=h&&d.y<=p&&e0(n,s,a,l,o,u,d.x,d.y)&&wi(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function UPe(r,e,t,i){let n=r.prev,a=r,o=r.next;if(wi(n,a,o)>=0)return!1;let s=n.x,l=a.x,u=o.x,c=n.y,h=a.y,f=o.y,p=sl?s>u?s:u:l>u?l:u,m=c>h?c>f?c:f:h>f?h:f,v=CB(p,d,e,t,i),_=CB(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&&e0(s,c,l,h,u,f,y.x,y.y)&&wi(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&&e0(s,c,l,h,u,f,x.x,x.y)&&wi(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&&e0(s,c,l,h,u,f,y.x,y.y)&&wi(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&&e0(s,c,l,h,u,f,x.x,x.y)&&wi(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function OPe(r,e,t){let i=r;do{let n=i.prev,a=i.next.next;!FR(n,a)&&Jae(n,i,i.next,a)&&wM(n,a)&&wM(a,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(a.i/t|0),TM(i),TM(i.next),i=r=a),i=i.next}while(i!==r);return $d(i)}function zPe(r,e,t,i,n,a){let o=r;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&YPe(o,s)){let l=$ae(o,s);o=$d(o,o.next),l=$d(l,l.next),bM(o,e,t,i,n,a,0),bM(l,e,t,i,n,a,0);return}s=s.next}o=o.next}while(o!==r)}function FPe(r,e,t,i){let n=[],a,o,s,l,u;for(a=0,o=e.length;a=t.next.y&&t.next.y!==t.y){let f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=a&&f>i&&(i=f,n=t.x=t.x&&t.x>=l&&a!==t.x&&e0(on.x||t.x===n.x&&GPe(n,t)))&&(n=t,c=h)),t=t.next;while(t!==s);return n}function GPe(r,e){return wi(r.prev,r,e.prev)<0&&wi(e.next,r,r.next)<0}function HPe(r,e,t,i){let n=r;do n.z===0&&(n.z=CB(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,WPe(n)}function WPe(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;e0||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 CB(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 XPe(r){let e=r,t=r;do(e.x=(r-o)*(a-s)&&(r-o)*(i-s)>=(t-o)*(e-s)&&(t-o)*(a-s)>=(n-o)*(i-s)}function YPe(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!qPe(r,e)&&(wM(r,e)&&wM(e,r)&&ZPe(r,e)&&(wi(r.prev,r,e.prev)||wi(r,e.prev,e))||FR(r,e)&&wi(r.prev,r,r.next)>0&&wi(e.prev,e,e.next)>0)}function wi(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function FR(r,e){return r.x===e.x&&r.y===e.y}function Jae(r,e,t,i){let n=$C(wi(r,e,t)),a=$C(wi(r,e,i)),o=$C(wi(t,i,r)),s=$C(wi(t,i,e));return!!(n!==a&&o!==s||n===0&&JC(r,t,e)||a===0&&JC(r,i,e)||o===0&&JC(t,r,i)||s===0&&JC(t,e,i))}function JC(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 $C(r){return r>0?1:r<0?-1:0}function qPe(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&&Jae(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function wM(r,e){return wi(r.prev,r,r.next)<0?wi(r,e,r.next)>=0&&wi(r,r.prev,e)>=0:wi(r,e,r.prev)<0||wi(r,r.next,e)<0}function ZPe(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 $ae(r,e){let t=new RB(r.i,r.x,r.y),i=new RB(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 Tae(r,e,t,i){let n=new RB(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 TM(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 RB(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 jPe(r,e,t,i){let n=0;for(let a=e,o=t-i;a2&&r[e-1].equals(r[0])&&r.pop()}function Aae(r,e){for(let t=0;t=a)){let s=t[1];e=a)break t}o=i,i=0;break r}break e}for(;i>>1;et;)--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&&KPe(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()===CF,a=e.length-1,o=1;for(let s=1;s0){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}};cl.prototype.TimeBufferType=Float32Array;cl.prototype.ValueBufferType=Float32Array;cl.prototype.DefaultInterpolation=rR;var Gf=class extends cl{};Gf.prototype.ValueTypeName="bool";Gf.prototype.ValueBufferType=Array;Gf.prototype.DefaultInterpolation=tR;Gf.prototype.InterpolantFactoryMethodLinear=void 0;Gf.prototype.InterpolantFactoryMethodSmooth=void 0;var TR=class extends cl{};TR.prototype.ValueTypeName="color";var Hf=class extends cl{};Hf.prototype.ValueTypeName="number";var IB=class extends d0{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)Vn.slerpFlat(a,0,o,u-s,o,u,l);return a}},Yu=class extends cl{InterpolantFactoryMethodLinear(e){return new IB(this.times,this.values,this.getValueSize(),e)}};Yu.prototype.ValueTypeName="quaternion";Yu.prototype.DefaultInterpolation=rR;Yu.prototype.InterpolantFactoryMethodSmooth=void 0;var Wf=class extends cl{};Wf.prototype.ValueTypeName="string";Wf.prototype.ValueBufferType=Array;Wf.prototype.DefaultInterpolation=tR;Wf.prototype.InterpolantFactoryMethodLinear=void 0;Wf.prototype.InterpolantFactoryMethodSmooth=void 0;var Xf=class extends cl{};Xf.prototype.ValueTypeName="vector";var ER=class{constructor(e,t=-1,i,n=lCe){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=qf(),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(QPe(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(cl.toJSON(i[a]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let a=t.length,o=[];for(let s=0;s1){let h=c[1],f=n[h];f||(n[h]=f=[]),f.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(h,f,p,d,g){if(p.length!==0){let m=[],v=[];Qae(p,m,v,d),m.length!==0&&g.push(new h(f,m,v))}},n=[],a=e.name||"default",o=e.fps||30,s=e.blendMode,l=e.length||-1,u=e.hierarchy||[];for(let h=0;h{class r{constructor(t){this.manager=t!==void 0?t:eIe,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})(),Wc={},UB=class extends Error{constructor(e,t){super(e),this.response=t}},CR=class extends Qd{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=AR.get(e);if(a!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0),a;if(Wc[e]!==void 0){Wc[e].push({onLoad:t,onProgress:i,onError:n});return}Wc[e]=[],Wc[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=Wc[e],h=u.body.getReader(),f=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),p=f?parseInt(f):0,d=p!==0,g=0,m=new ReadableStream({start(v){_();function _(){h.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{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 h=/charset="?([^;"\s]*)"?/i.exec(s),f=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(f);return u.arrayBuffer().then(d=>p.decode(d))}}}).then(u=>{AR.add(e,u);let c=Wc[e];delete Wc[e];for(let h=0,f=c.length;h{let c=Wc[e];if(c===void 0)throw this.manager.itemError(e),u;delete Wc[e];for(let h=0,f=c.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var OB=class extends Qd{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=AR.get(e);if(o!==void 0)return a.manager.itemStart(e),setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0),o;let s=yM("img");function l(){c(),AR.add(e,this),t&&t(this),a.manager.itemEnd(e)}function u(h){c(),n&&n(h),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 RR=class extends Qd{constructor(e){super(e)}load(e,t,i,n){let a=new _s,o=new OB(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}},m0=class extends la{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new nr(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 rB=new Xt,Rae=new ye,Lae=new ye,EM=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new xr(512,512),this.map=null,this.mapPass=null,this.matrix=new Xt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new SM,this._frameExtents=new xr(1,1),this._viewportCount=1,this._viewports=[new Ur(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Rae.setFromMatrixPosition(e.matrixWorld),t.position.copy(Rae),Lae.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Lae),t.updateMatrixWorld(),rB.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rB),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(rB)}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}},zB=class extends EM{constructor(){super(new Bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=l0*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}},LR=class extends m0{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(la.DEFAULT_UP),this.updateMatrix(),this.target=new la,this.distance=i,this.angle=n,this.penumbra=a,this.decay=o,this.map=null,this.shadow=new zB}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}},Dae=new Xt,fM=new ye,iB=new ye,FB=class extends EM{constructor(){super(new Bn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new xr(4,2),this._viewportCount=6,this._viewports=[new Ur(2,1,1,1),new Ur(0,1,1,1),new Ur(3,1,1,1),new Ur(1,1,1,1),new Ur(3,0,1,1),new Ur(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()),fM.setFromMatrixPosition(e.matrixWorld),i.position.copy(fM),iB.copy(i.position),iB.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(iB),i.updateMatrixWorld(),n.makeTranslation(-fM.x,-fM.y,-fM.z),Dae.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Dae)}},AM=class extends m0{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 FB}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}},BB=class extends EM{constructor(){super(new h0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},DR=class extends m0{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(la.DEFAULT_UP),this.updateMatrix(),this.target=new la,this.shadow=new BB}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},PR=class extends m0{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var IR=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,n=e.length;i{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(tIe,"")}static parseTrackName(t){let i=sIe.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);lIe.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>>1|(Vr&21845)<<1,$c=($c&52428)>>>2|($c&13107)<<2,$c=($c&61680)>>>4|($c&3855)<<4,$B[Vr]=(($c&65280)>>>8|($c&255)<<8)>>>1;var $c,Vr,CM=function(r,e,t){for(var i=r.length,n=0,a=new Zf(e);n>>l]=u}else for(s=new Zf(i),n=0;n>>15-r[n]);return s},RM=new hl(288);for(Vr=0;Vr<144;++Vr)RM[Vr]=8;var Vr;for(Vr=144;Vr<256;++Vr)RM[Vr]=9;var Vr;for(Vr=256;Vr<280;++Vr)RM[Vr]=7;var Vr;for(Vr=280;Vr<288;++Vr)RM[Vr]=8;var Vr,soe=new hl(32);for(Vr=0;Vr<32;++Vr)soe[Vr]=5;var Vr;var pIe=CM(RM,9,1);var dIe=CM(soe,5,1),jB=function(r){for(var e=r[0],t=1;te&&(e=r[t]);return e},tu=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},KB=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},mIe=function(r){return(r/8|0)+(r&7&&1)},vIe=function(r,e,t){(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Zf?Zf:r instanceof JB?JB:hl)(t-e);return i.set(r.subarray(e,t)),i},gIe=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new hl(0);var n=!e||t,a=!t||t.i;t||(t={}),e||(e=new hl(i*3));var o=function(ae){var ve=e.length;if(ae>ve){var ue=new hl(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,h=t.d,f=t.m,p=t.n,d=i*8;do{if(!c){t.f=s=tu(r,l,1);var g=tu(r,l+1,3);if(l+=3,g)if(g==1)c=pIe,h=dIe,f=9,p=5;else if(g==2){var y=tu(r,l,31)+257,x=tu(r,l+10,15)+4,M=y+tu(r,l+5,31)+1;l+=14;for(var S=new hl(M),w=new hl(19),T=0;T>>4;if(m<16)S[T++]=m;else{var R=0,A=0;for(m==16?(A=3+tu(r,l,3),l+=2,R=S[T-1]):m==17?(A=3+tu(r,l,7),l+=3):m==18&&(A=11+tu(r,l,127),l+=7);A--;)S[T++]=R}}var P=S.subarray(0,y),U=S.subarray(y);f=jB(P),p=jB(U),c=CM(P,f,1),h=CM(U,p,1)}else throw"invalid block type";else{var m=mIe(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<>>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=toe[T];Y=tu(r,l,(1<>>4;if(!Q)throw"invalid distance";l+=Q&15;var U=fIe[V];if(V>3){var J=roe[V];U+=KB(r,l)&(1<d){if(a)throw"unexpected EOF";break}n&&o(u+131072);for(var K=u+Y;u>>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 loe(r,e){return gIe((_Ie(r),r.subarray(2,-4)),e)}var xIe=typeof TextDecoder<"u"&&new TextDecoder,SIe=0;try{xIe.decode(yIe,{stream:!0}),SIe=1}catch{}function uoe(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+1];)e=g&&(d[p][0]=d[f][0]/s[_+1][v],m=d[p][0]*s[v][_]);let y=v>=-1?1:-v,x=h-1<=_?g-1:t-h;for(let S=y;S<=x;++S)d[p][S]=(d[f][S]-d[f][S-1])/s[_+1][v+S],m+=d[p][S]*s[v+S][_];h<=_&&(d[p][g]=-d[f][g-1]/s[_+1][h],m+=d[p][g]*s[h][_]),o[g][h]=m;let M=f;f=p,p=M}}let c=t;for(let h=1;h<=i;++h){for(let f=0;f<=t;++f)o[h][f]*=c;c*=t-h}return o}function TIe(r,e,t,i,n){let a=n0,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 Sr.Objects){let i=Sr.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?o0:Ho,i.wrapT=s===0?o0:Ho,"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=zi.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 _s):(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 _s):(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 _s):o=this.textureLoader.load(i);return this.textureLoader.setPath(n),o}parseMaterials(e){let t=new Map;if("Material"in Sr.Objects){let i=Sr.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),!zi.has(i))return null;let o=this.parseParameters(e,t,i),s;switch(a.toLowerCase()){case"phong":s=new p0;break;case"lambert":s=new wR;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),s=new p0;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 nr().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new nr().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new nr().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new nr().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 nr().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new nr().fromArray(e.SpecularColor.value).convertSRGBToLinear());let a=this;return zi.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=Pa);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=Pa);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=vM,n.envMap.colorSpace=Pa);break;case"SpecularColor":n.specularMap=a.getTexture(t,o.ID),n.specularMap!==void 0&&(n.specularMap.colorSpace=Pa);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 Sr.Objects&&t in Sr.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=zi.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in Sr.Objects){let i=Sr.Objects.Deformer;for(let n in i){let a=i[n],o=zi.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 Xt().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;n1?o=s:s.length>0?o=s[0]:(o=new p0({name:Qd.DEFAULT_MATERIAL_NAME,color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach(function(l){l.vertexColors=!0}),a.FBX_Deformer?(n=new _R(a,o),n.normalizeSkinWeights()):n=new Wo(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 MM({name:Qd.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new SR(i,n)}getTransformData(e,t){let i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=doe(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&&zi.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){let a=Sr.Objects.Model[n.ID];if("Lcl_Translation"in a){let o=a.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Ia.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];zi.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){let u=l.ID;zi.get(u).parents.forEach(function(h){i.has(h.ID)&&i.get(h.ID).bind(new xR(o.bones),n[h.ID])})}})}}parsePoseNodes(){let e={};if("Pose"in Sr.Objects){let t=Sr.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 Xt().fromArray(a.Matrix.a)}):e[n.Node]=new Xt().fromArray(n.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in Sr){if("AmbientColor"in Sr.GlobalSettings){let e=Sr.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],n=e[2];if(t!==0||i!==0||n!==0){let a=new nr(t,i,n).convertSRGBToLinear();Ia.add(new PR(a,1))}}"UnitScaleFactor"in Sr.GlobalSettings&&(Ia.userData.unitScaleFactor=Sr.GlobalSettings.UnitScaleFactor.value)}}},rk=class{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if("Geometry"in Sr.Objects){let i=Sr.Objects.Geometry;for(let n in i){let a=zi.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(h){return Sr.Objects.Model[h.ID]});if(o.length===0)return;let s=e.children.reduce(function(h,f){return n[f.ID]!==void 0&&(h=n[f.ID]),h},null);e.children.forEach(function(h){i.morphTargets[h.ID]!==void 0&&a.push(i.morphTargets[h.ID])});let l=o[0],u={};"RotationOrder"in l&&(u.eulerOrder=doe(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=poe(u);return this.genGeometry(t,s,a,c)}genGeometry(e,t,i,n){let a=new ul;e.attrName&&(a.name=e.attrName);let o=this.parseGeoNode(e,t),s=this.genBuffers(o),l=new kn(s.vertex,3);if(l.applyMatrix4(n),a.setAttribute("position",l),s.colors.length>0&&a.setAttribute("color",new kn(s.colors,3)),t&&(a.setAttribute("skinIndex",new u0(s.weightsIndices,4)),a.setAttribute("skinWeight",new kn(s.vertexWeights,4)),a.FBX_Deformer=t),s.normal.length>0){let u=new vr().getNormalMatrix(n),c=new kn(s.normal,3);c.applyNormalMatrix(u),a.setAttribute("normal",c)}if(s.uvs.forEach(function(u,c){let h=c===0?"uv":`uv${c}`;a.setAttribute(h,new kn(s.uvs[c],2))}),o.material&&o.material.mappingType!=="AllSame"){let u=s.materialIndex[0],c=0;if(s.materialIndex.forEach(function(h,f){h!==u&&(a.addGroup(c,f-c,u),u=h,c=f)}),a.groups.length>0){let h=a.groups[a.groups.length-1],f=h.start+h.count;f!==s.materialIndex.length&&a.addGroup(f,s.materialIndex.length-f,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=[],h=[],f=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=kR(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]),h.push(v[y])}if(e.normal){let y=kR(d,i,p,e.normal);s.push(y[0],y[1],y[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=kR(d,i,p,e.material)[0],g<0&&(f.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(y,x){let M=kR(d,i,p,y);u[x]===void 0&&(u[x]=[]),u[x].push(M[0]),u[x].push(M[1])}),n++,m&&(f.genFace(t,e,o,g,s,l,u,c,h,n),i++,n=0,o=[],s=[],l=[],u=[],c=[],h=[])}),t}getNormalNewell(e){let t=new ye(0,0,0);for(let i=0;i.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 xr(e.dot(t),e.dot(i))}genFace(e,t,i,n,a,o,s,l,u,c){let h;if(c>3){let f=[];for(let m=0;m1&&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 ER(e.name,-1,t)}generateTracks(e){let t=[],i=new ye,n=new ye;if(e.transform&&e.transform.decompose(i,new Vn,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 Xf(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 h=this.interpolateRotations(t.x,t.y,t.z,a);o=h[0],s=h[1]}i!==void 0&&(i=i.map(ua.degToRad),i.push(a),i=new Gn().fromArray(i),i=new Vn().setFromEuler(i)),n!==void 0&&(n=n.map(ua.degToRad),n.push(a),n=new Gn().fromArray(n),n=new Vn().setFromEuler(n).invert());let l=new Vn,u=new Gn,c=[];if(!s||!o)return new Yu(e+".quaternion",[],[]);for(let h=0;h2&&new Vn().fromArray(c,(h-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(c,h/3*4);return new Yu(e+".quaternion",o,c)}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,i=t.values.map(function(a){return a/100}),n=Ia.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Hf(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=180||p[1]>=180||p[2]>=180){let g=Math.max(...p)/180,m=new Gn(...u,n),v=new Gn(...h,n),_=new Vn().setFromEuler(m),y=new Vn().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 Vn,w=new Gn;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(ua.degToRad(e.values[s])),o.push(ua.degToRad(t.values[s])),o.push(ua.degToRad(i.values[s]))}return[a,o]}},nk=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 HR,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]),h=a.split(",").slice(3);h=h.map(function(f){return f.trim().replace(/^"/,"")}),n="connections",a=[u,c],IIe(a,h),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=ek(a))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=ek(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=ek(u);break}this.getPrevNode()[a]={type:o,type2:s,flag:l,value:u},this.setCurrentProp(this.getPrevNode(),a)}},ak=class{parse(e){let t=new GR(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 HR;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 f=0;f0?l[0]:"",c=l.length>1?l[1]:"",h=l.length>2?l[2]:"";for(i.singleProperty=a===1&&e.getOffset()===n;n>e.getOffset();){let f=this.parseNode(e,t);f!==null&&this.parseSubNode(s,i,f)}return i.propertyList=l,typeof u=="number"&&(i.id=u),c!==""&&(i.attrName=c),h!==""&&(i.attrType=h),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=loe(new Uint8Array(e.getArrayBuffer(o))),l=new GR(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)}}},GR=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=0&&(i=new Uint8Array(this.dv.buffer,t,n)),this._textDecoder.decode(i)}},HR=class{add(e,t){this[e]=t}};function RIe(r){let e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===moe(r,0,e.length)}function LIe(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{let e=class e{constructor(){this.http=xn(lu),this.modal=xn(uh),this.titleService=xn(zb),this.animate=()=>{requestAnimationFrame(this.animate);let i=b3e.getDelta();Hse&&Hse.update(i),this.renderer.render(this.scene,this.camera)}}ngOnInit(){this.titleService.setTitle("\u91CD\u78C53D"),this.initThreeJs(),this.animate()}initThreeJs(){this.camera=new Wi(40,window.innerWidth/window.innerHeight,1,2e4),this.camera.position.set(2200,300,-3100),this.camera.fov=60,this.camera.updateProjectionMatrix(),this.scene=new iM,this.scene.background=new or(263446);let i=new nM(16777215,4473924,5);i.position.set(0,200,0),this.scene.add(i);let n=new aM(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 VR().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 rM({antialias:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(400,300),this.renderer.shadowMap.enabled=!0,this.container.nativeElement.appendChild(this.renderer.domElement);let s=5,l=32,u=new TC(s,l),c=new zc({color:16711680}),h=new an(u,c);h.position.set(850,100,-2e3),this.scene.add(h);let f=new Wse.OrbitControls(this.camera,this.renderer.domElement);f.target.set(850,100,-2e3),f.update()}render(){this.cube.rotation.x+=.01,this.cube.rotation.y+=.01,this.renderer.render(this.scene,this.camera)}onWindowResize(){}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["app-data-v-t1"]],viewQuery:function(n,a){if(n&1&&Mn(M3e,7),n&2){let o;fi(o=pi())&&(a.container=o.first)}},standalone:!0,features:[Ar],decls:3,vars:0,consts:[[2,"width","400vh","flex-direction","column","height","200vh"],[2,"flex-grow","1"],["Three",""]],template:function(n,a){n&1&&(ht(0,"div",0),er(1,"div",1,2),ot())},dependencies:[Ba,ka,io,Ja,ao,oo,no,to,Fa,Za,Ka,co,eo,$a,fn,Ua,Ya,qa,so,uo,Wa,qn,Qa,Ha,ja,Xa,lo,za,Oa,ro,Ga,Xn,Va,Yn],encapsulation:2});let r=e;return r})();var w3e=["canvas"],Yse=(()=>{let e=class e{constructor(i){this.sanitizer=i,this.http=xn(lu),this.defaultCarImage="/assets/blockbuster/tmp1.png",this.status=0}ngOnInit(){this.initSvg()}ngOnChanges(i){i.options&&!i.options.isFirstChange()&&console.log("ChartComponentComponent ngOnChanges")}ngOnDestroy(){}initSvg(){fetch("assets/blockbuster/wc.svg").then(n=>n.text()).then(n=>{this.drawSVGtoCanvas(n,0,0,1)}).catch(n=>{console.error("Failed to load SVG:",n)}),this.status==0&&fetch("assets/blockbuster/zcddxy.svg").then(a=>a.text()).then(a=>{this.drawSVGtoCanvas(a,70,22,.5)}).catch(a=>{console.error("Failed to load SVG:",a)})}drawSVGtoCanvas(i,n,a,o){let l=this.canvasRef.nativeElement.getContext("2d"),u=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(u),h=new Image;h.onload=()=>{let f=h.width*o,p=h.height*o;l.drawImage(h,n,a,f,p),URL.revokeObjectURL(c)},h.src=c}};e.\u0275fac=function(n){return new(n||e)(ma(DV))},e.\u0275cmp=Er({type:e,selectors:[["blockbuster-component"]],viewQuery:function(n,a){if(n&1&&Mn(w3e,5),n&2){let o;fi(o=pi())&&(a.canvasRef=o.first)}},inputs:{defaultCarImage:"defaultCarImage",status:"status"},standalone:!0,features:[sh,Ar],decls:8,vars:6,consts:[["nz-row","",2,"height","13rem",3,"nzGutter"],["nz-col","",1,"gutter-row",3,"nzSpan"],["alt","Car Image",2,"width","100%","height","100%",3,"src"],["nz-col","",1,"gutter-row",2,"text-align","center",3,"nzSpan"],[2,"border","5px solid #00EFF8","height","100%","width","100%"],["canvas",""]],template:function(n,a){n&1&&(ht(0,"div",0)(1,"div",1),er(2,"img",2),ot(),ht(3,"div",3),er(4,"canvas",4,5),ot(),ht(6,"div",1),er(7,"img",2),ot()()),n&2&&(rt("nzGutter",12),at(),rt("nzSpan",6),at(),op("src",a.defaultCarImage,BL),at(),rt("nzSpan",12),at(3),rt("nzSpan",6),at(),op("src",a.defaultCarImage,BL))},dependencies:[fn,hh,ch,Xn],styles:[".svg-container[_ngcontent-%COMP%]{position:relative}.svg-overlay[_ngcontent-%COMP%]{position:absolute;top:0;left:0}"]});let r=e;return r})();var T3e=["myGrid"];function E3e(r,e){if(r&1&&(ht(0,"div",19),er(1,"blockbuster-component",20),ot()),r&2){let t=e.$implicit;at(),rt("defaultCarImage",t.tmpimg)("status",t.status)}}var A3e=()=>[12,12],qse=(()=>{let e=class e{constructor(i){this._mqttService=i,this.http=xn(lu),this.modal=xn(uh),this.elementRef=xn(p_),this.titleService=xn(zb),this.items=[{tmpimg:"/assets/blockbuster/tmp1.png",status:0},{tmpimg:"/assets/blockbuster/tmp2.png",status:1},{tmpimg:"/assets/blockbuster/tmp3.png",status:0},{tmpimg:"/assets/blockbuster/tmp4.png",status:1}],this.chartDom=document.getElementById("main"),this.defaultColDef={editable:!1},this.gridThemedClass="ag-theme-quartz ag-theme-datav",this.rowData=[],this.todayRowData=[],this.runInfoRowData=[],this.systemWarnInfoRowData=[],this.array=[1,2,3,4],this.effect="scrollx",this.colDefs0=[{headerName:"\u65F6\u95F4",headerClass:"head-class",field:"time",autoHeaderHeight:!0,width:130,cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"\u64CD\u4F5C",field:"option",headerClass:"head-class",autoHeaderHeight:!0,width:70,cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"\u64CD\u4F5C\u63CF\u8FF0",width:130,autoHeaderHeight:!0,field:"optionDesc",cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"\u64CD\u4F5C\u4EBA\u5458",width:130,field:"optionMan",autoHeaderHeight:!0,cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}}],this.colDefs1=[{headerName:"\u5E8F\u53F7",field:"sort",width:70,cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"\u65F6\u95F4",field:"time",width:140,cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",width:130,field:"taskDesc",cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"\u7B49\u7EA7",width:70,field:"level",autoHeaderHeight:!0,cellStyle:{"text-align":"start","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}}],this.colDefs2=[{headerName:"",minWidth:130,field:"rwmc",flex:1,cellStyle:{"font-size":"13px","text-align":"center","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px",color:"#75F9FD"}},{headerName:"1#\u91CD\u78C5",minWidth:60,field:"one",flex:1,cellStyle:{"text-align":"center","font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px",color:"#75F9FD"}},{headerName:"2#\u91CD\u78C5",minWidth:60,field:"two",flex:1,cellStyle:{"text-align":"center","font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"3#\u91CD\u78C5",minWidth:60,field:"three",flex:1,cellStyle:{"text-align":"center","font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"4#\u91CD\u78C5",minWidth:60,field:"four",flex:1,cellStyle:{"text-align":"center","font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}},{headerName:"\u6C47\u603B",minWidth:60,autoHeaderHeight:!0,field:"all",flex:1,cellStyle:{"text-align":"center","font-size":"13px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"18px"}}],this.client=i}initCharts(){let i=Ev(document.getElementById("lineChart")),n={tooltip:{formatter:"{a}
{b} : {c}%"},series:[{name:"Pressure",type:"gauge",progress:{show:!0},detail:{valueAnimation:!0,formatter:"{value}"},data:[{value:50,name:"SCORE"}]}]};i.setOption(n)}ngOnInit(){this.todayRowData.push({rwmc:"\u8F66\u8F86\u6570",one:"4\uFF08\u8F86\uFF09",two:"6\uFF08\u8F86\uFF09",three:"9\uFF08\u8F86\uFF09",four:"3\uFF08\u8F86\uFF09",all:"22\uFF08\u8F86\uFF09"}),this.todayRowData.push({rwmc:"\u603B\u5428\u6570",one:"25.1\uFF08\u5428\uFF09",two:"45.2\uFF08\u5428\uFF09",three:"87.9\uFF08\u5428\uFF09",four:"15.5\uFF08\u5428\uFF09",all:"155\uFF08\u5428\uFF09"}),this.todayRowData.push({rwmc:"\u4E0A\u62A5\u70ED\u503C/\u4F30\u7B97\u70ED\u503C",one:"1/1 (MJ)",two:"2/1 (MJ)",three:"3/3 (MJ)",four:"4/3\uFF08MJ)",all:"10/8\uFF08MJ\uFF09"});for(var i=1;i<10;i++)this.runInfoRowData.push({time:"2024-09-09",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u91CD\u78C5",optionMan:"\u7532"}),this.runInfoRowData.push({time:"2024-09-19",option:"\u89E3\u9664",optionDesc:"\u63A5\u89E61\u53F7\u91CD\u78C5",optionMan:"\u7532"}),this.systemWarnInfoRowData.push({sort:1,time:"2024.01.25-18:32",taskDesc:"2#\u91CD\u78C5\u505C\u6B62",level:"1\u7EA7"}),this.systemWarnInfoRowData.push({sort:2,time:"2024.01.26-18:32",taskDesc:"4#\u91CD\u78C5\u505C\u6B62",level:"3\u7EA7"});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"});this.initCharts()}ngAfterViewInit(){let i=this.elementRef.nativeElement.querySelector(".ag-theme-datav"),n=i.querySelector(".ag-body-viewport"),a=i.querySelector(".ag-scroller");console.log("scrollBar"),console.log(a)}add(){}};e.\u0275fac=function(n){return new(n||e)(ma(kb))},e.\u0275cmp=Er({type:e,selectors:[["app-data-v-s1"]],viewQuery:function(n,a){if(n&1&&Mn(T3e,5),n&2){let o;fi(o=pi())&&(a.grid=o.first)}},standalone:!0,features:[Ar],decls:33,vars:25,consts:[["nz-row","",2,"display","flex","justify-content","space-between",3,"nzGutter"],[2,"display","flex","flex-direction","column","width","23%"],["title","\u7CFB\u7EDF\u72B6\u6001",2,"width","100%"],["title","\u8FD0\u884C\u4FE1\u606F",3,"defaultColDef","rowData","columnDefs","gridThemeClass"],["title","\u7CFB\u7EDF\u62A5\u8B66\u4FE1\u606F",2,"width","100%",3,"defaultColDef","rowData","columnDefs","gridThemeClass"],[2,"display","flex","flex-direction","column","width","43%"],[1,"button-container"],[1,"lock-button"],["src","./assets/lock.svg",1,"logo"],[1,"standard-button"],[1,"car-status-container"],["nz-row","",3,"nzGutter"],["nz-col","",1,"gutter-row",2,"text-align","center",3,"nzSpan"],[1,"card-content-title"],[1,"card-content-l"],["class","row",4,"ngFor","ngForOf"],[2,"display","flex","flex-direction","column","width","30%"],["title","\u4ECA\u65E5\u6C47\u603B",3,"heightNum","showPageTurning","showEditButton","defaultColDef","rowData","columnDefs","gridThemeClass"],[2,"width","100%","margin-top","30px"],[1,"row"],[2,"margin-bottom","0.5rem",3,"defaultCarImage","status"]],template:function(n,a){n&1&&(ht(0,"div",0)(1,"div",1),er(2,"app-data-v-lj-dashboard",2)(3,"lj-app-ag-grid-component",3)(4,"lj-app-ag-grid-component",4),ot(),ht(5,"div",5)(6,"div",6)(7,"button",7),er(8,"img",8),ot(),ht(9,"button",9),jt(10,"\u64CD\u4F5C"),ot(),ht(11,"button",9),jt(12,"\u6821\u78C5"),ot(),ht(13,"button",9),jt(14,"\u9632\u4F5C\u5F0A"),ot()(),ht(15,"div",10)(16,"div",11)(17,"div",12)(18,"div",13)(19,"div",14),jt(20),ot()()(),ht(21,"div",12)(22,"div",13)(23,"div",14),jt(24),ot()()(),ht(25,"div",12)(26,"div",13)(27,"div",14),jt(28),ot()()()(),gr(29,E3e,2,2,"div",15),ot()(),ht(30,"div",16),er(31,"lj-app-ag-grid-component",17)(32,"app-data-v-lj-car-info-table",18),ot()()),n&2&&(rt("nzGutter",LV(24,A3e)),at(3),rt("defaultColDef",a.defaultColDef)("rowData",a.runInfoRowData)("columnDefs",a.colDefs0)("gridThemeClass",a.gridThemedClass),at(),rt("defaultColDef",a.defaultColDef)("rowData",a.systemWarnInfoRowData)("columnDefs",a.colDefs1)("gridThemeClass",a.gridThemedClass),at(12),rt("nzGutter",12),at(),rt("nzSpan",6),at(3),bn("\u62AC\u6746\u76D1\u63A7"),at(),rt("nzSpan",12),at(3),bn("3D\u76D1\u63A7"),at(),rt("nzSpan",6),at(3),bn("\u843D\u6746\u76D1\u63A7"),at(),rt("ngForOf",a.items),at(2),rt("heightNum",146)("showPageTurning",!1)("showEditButton",!0)("defaultColDef",a.defaultColDef)("rowData",a.todayRowData)("columnDefs",a.colDefs2)("gridThemeClass",a.gridThemedClass))},dependencies:[I$,SA,VV,Rm,bA,lh,d_,Ba,ka,io,Ja,ao,oo,no,to,Fa,Za,Ka,co,eo,$a,hh,ch,fn,Ua,Ya,qa,so,uo,Wa,qn,Qa,Ha,ja,Xa,lo,za,Oa,ro,Ga,Xn,Va,Yn,Yse],styles:[".ag-header-center[_ngcontent-%COMP%] .ag-header-group-cell-label[_ngcontent-%COMP%], .ag-header-center[_ngcontent-%COMP%] .ag-header-cell-label[_ngcontent-%COMP%]{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: transparent} .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}.button-container[_ngcontent-%COMP%]{display:flex;align-items:center}.lock-button[_ngcontent-%COMP%], .standard-button[_ngcontent-%COMP%], .highlighted-button[_ngcontent-%COMP%]{margin:5px;padding:10px 15px;font-size:20px;color:#fff;border:none}.lock-button[_ngcontent-%COMP%]{background-color:transparent}.standard-button[_ngcontent-%COMP%]{font-size:20px;font-weight:700;line-height:20px;color:#6becf6;text-align:center;background-color:#213069;border-radius:3px}.highlighted-button[_ngcontent-%COMP%]{background-color:#3498db;border-radius:10px}.fa-lock[_ngcontent-%COMP%]{margin-right:5px}.logo[_ngcontent-%COMP%]{width:55px}.car-status-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;margin:1vw;margin-top:5px;padding:1rem;background-image:url(/assets/dashboard/dashboard_card_bg.jpg);background-repeat:no-repeat;background-position:center;background-size:cover}.row[_ngcontent-%COMP%]{display:flex;align-items:stretch;justify-content:space-between;margin-bottom:20px}.item[_ngcontent-%COMP%]{flex-basis:100px;flex-grow:1;margin:20px 10px 10px}.item[_ngcontent-%COMP%]:nth-child{flex-grow:6}.item[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:200px;height:200px;margin:10px;object-fit:contain}.info-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:space-around;margin:0 10px}.model-container[_ngcontent-%COMP%]{display:flex;flex:1;flex-direction:column;justify-content:space-around;margin:0 10px}.info-button[_ngcontent-%COMP%]{margin:5px 0;padding:10px;color:#fff;text-align:center;background-color:#007bff;border-radius:5px;box-shadow:0 2px 4px #0000001a}[nz-carousel-content][_ngcontent-%COMP%]{overflow:hidden;width:150px;height:80px;color:#fff;text-align:center;background:#364d79}h3[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none;margin-bottom:0;color:#fff}.card-content-title[_ngcontent-%COMP%]{align-items:center;width:fit-content;height:fit-content;margin-bottom:.5rem;padding:5px 20px;font-size:20px;font-weight:600;line-height:22px;color:#74fafb;color:#00eff8;text-align:center;background-color:#19426e;border:1px solid #1f6f97;border-radius:10px 10px 0 0;box-shadow:inset 0 0 10px #1f6f97}.card-content-title[_ngcontent-%COMP%] .card-content-l[_ngcontent-%COMP%]{flex:1;align-self:flex-start}.card-content-title[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none;margin-bottom:0;color:#fff}.card-content-title[_ngcontent-%COMP%] .head-class[_ngcontent-%COMP%], .card-content-title[_ngcontent-%COMP%] .ag-header-cell-label[_ngcontent-%COMP%]{text-align:center;justify-content:center}.card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}"]});let r=e;return r})();var Zse=(()=>{let e=class e{constructor(){this.http=xn(lu),this.modal=xn(uh)}ngOnInit(){}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=Er({type:e,selectors:[["app-data-v-threejs"]],standalone:!0,features:[Ar],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&&er(0,"iframe",0)},dependencies:[Ba,ka,io,Ja,ao,oo,no,to,Fa,Za,Ka,co,eo,$a,fn,Ua,Ya,qa,so,uo,Wa,qn,Qa,Ha,ja,Xa,lo,za,Oa,ro,Ga,Xn,Va,Yn]});let r=e;return r})();var TIt=[{path:"s1/:id",component:P$,data:{menu:null}},{path:"second1/:id",component:qse,data:{menu:null}},{path:"threejs/:id",component:Zse},{path:"t1/:id",component:Xse},{path:"lj-table",component:jL},{path:"lj-table",component:jL},{path:"lj-dashboard",component:bA},{path:"lj-textDashboard",component:MA},{path:"ljCarInfoTable",component:SA}];export{TIt as routes};