0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const u in c)c[u]!==void 0&&(e[u]=c[u]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const c in r){const u=r[c];e.data.attributes[c]=u.toJSON(e.data)}const a={};let s=!1;for(const c in this.morphAttributes){const u=this.morphAttributes[c],d=[];for(let m=0,p=u.length;m0&&(a[c]=d,s=!0)}s&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere=l.toJSON()),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;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const a=e.attributes;for(const u in a){const d=a[u];this.setAttribute(u,d.clone(n))}const s=e.morphAttributes;for(const u in s){const d=[],m=s[u];for(let p=0,f=m.length;p0){const a=n[r[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=a.length;s(e.far-e.near)**2))&&(y6.copy(s).invert(),bp.copy(e.ray).applyMatrix4(y6),!(r.boundingBox!==null&&bp.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,bp)))}_computeIntersections(e,n,r){let a;const s=this.geometry,o=this.material,l=s.index,c=s.attributes.position,u=s.attributes.uv,d=s.attributes.uv1,m=s.attributes.normal,p=s.groups,f=s.drawRange;if(l!==null)if(Array.isArray(o))for(let y=0,v=p.length;yn.far?null:{distance:u,point:S_.clone(),object:t}}function __(t,e,n,r,a,s,o,l,c,u){t.getVertexPosition(l,x_),t.getVertexPosition(c,y_),t.getVertexPosition(u,v_);const d=yye(t,e,n,r,x_,y_,v_,w6);if(d){const m=new Tt;Qy.getBarycoord(w6,x_,y_,v_,m),a&&(d.uv=Qy.getInterpolatedAttribute(a,l,c,u,m,new Yn)),s&&(d.uv1=Qy.getInterpolatedAttribute(s,l,c,u,m,new Yn)),o&&(d.normal=Qy.getInterpolatedAttribute(o,l,c,u,m,new Tt),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const p={a:l,b:c,c:u,normal:new Tt,materialIndex:0};Qy.getNormal(x_,y_,v_,p.normal),d.face=p,d.barycoord=m}return d}let oO=class DQ extends Ul{constructor(e=1,n=1,r=1,a=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:a,heightSegments:s,depthSegments:o};const l=this;a=Math.floor(a),s=Math.floor(s),o=Math.floor(o);const c=[],u=[],d=[],m=[];let p=0,f=0;y("z","y","x",-1,-1,r,n,e,o,s,0),y("z","y","x",1,-1,r,n,-e,o,s,1),y("x","z","y",1,1,e,r,n,a,o,2),y("x","z","y",1,-1,e,r,-n,a,o,3),y("x","y","z",1,-1,e,n,r,a,s,4),y("x","y","z",-1,-1,e,n,-r,a,s,5),this.setIndex(c),this.setAttribute("position",new qo(u,3)),this.setAttribute("normal",new qo(d,3)),this.setAttribute("uv",new qo(m,2));function y(v,x,g,_,N,T,C,A,k,R,P){const D=T/k,H=C/R,z=T/2,G=C/2,I=A/2,ee=k+1,ie=R+1;let X=0,me=0;const he=new Tt;for(let ge=0;ge0?1:-1,d.push(he.x,he.y,he.z),m.push(oe/k),m.push(1-ge/R),X+=1}}for(let ge=0;ge=0&&(A[E]=null,C[E].disconnect(j))}for(let Z=0;Z=A.length){A.push(j),E=K;break}else if(A[K]===null){A[K]=j,E=K;break}if(E===-1)break}const U=C[E];U&&U.connect(j)}}const me=new Tt,he=new Tt;function ge(q,Z,j){me.setFromMatrixPosition(Z.matrixWorld),he.setFromMatrixPosition(j.matrixWorld);const E=me.distanceTo(he),U=Z.projectionMatrix.elements,K=j.projectionMatrix.elements,$=U[14]/(U[10]-1),ne=U[14]/(U[10]+1),O=(U[9]+1)/U[5],V=(U[9]-1)/U[5],J=(U[8]-1)/U[0],W=(K[8]+1)/K[0],re=$*J,ue=$*W,fe=E/(-J+W),ye=fe*-J;if(Z.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(ye),q.translateZ(fe),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),U[10]===-1)q.projectionMatrix.copy(Z.projectionMatrix),q.projectionMatrixInverse.copy(Z.projectionMatrixInverse);else{const ae=$+fe,L=ne+fe,F=re-ye,te=ue+(E-ye),ve=O*ne/L*ae,pe=V*ne/L*ae;q.projectionMatrix.makePerspective(F,te,ve,pe,ae,L),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function Y(q,Z){Z===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(Z.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(a===null)return;let Z=q.near,j=q.far;x.texture!==null&&(x.depthNear>0&&(Z=x.depthNear),x.depthFar>0&&(j=x.depthFar)),z.near=D.near=P.near=Z,z.far=D.far=P.far=j,(G!==z.near||I!==z.far)&&(a.updateRenderState({depthNear:z.near,depthFar:z.far}),G=z.near,I=z.far),z.layers.mask=q.layers.mask|6,P.layers.mask=z.layers.mask&3,D.layers.mask=z.layers.mask&5;const E=q.parent,U=z.cameras;Y(z,E);for(let K=0;K0&&(x.alphaTest.value=g.alphaTest);const _=e.get(g),N=_.envMap,T=_.envMapRotation;N&&(x.envMap.value=N,vp.copy(T),vp.x*=-1,vp.y*=-1,vp.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(vp.y*=-1,vp.z*=-1),x.envMapRotation.value.setFromMatrix4(T_e.makeRotationFromEuler(vp)),x.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=g.reflectivity,x.ior.value=g.ior,x.refractionRatio.value=g.refractionRatio),g.lightMap&&(x.lightMap.value=g.lightMap,x.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,x.lightMapTransform)),g.aoMap&&(x.aoMap.value=g.aoMap,x.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,x.aoMapTransform))}function o(x,g){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,g.map&&(x.map.value=g.map,n(g.map,x.mapTransform))}function l(x,g){x.dashSize.value=g.dashSize,x.totalSize.value=g.dashSize+g.gapSize,x.scale.value=g.scale}function c(x,g,_,N){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,x.size.value=g.size*_,x.scale.value=N*.5,g.map&&(x.map.value=g.map,n(g.map,x.uvTransform)),g.alphaMap&&(x.alphaMap.value=g.alphaMap,n(g.alphaMap,x.alphaMapTransform)),g.alphaTest>0&&(x.alphaTest.value=g.alphaTest)}function u(x,g){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,x.rotation.value=g.rotation,g.map&&(x.map.value=g.map,n(g.map,x.mapTransform)),g.alphaMap&&(x.alphaMap.value=g.alphaMap,n(g.alphaMap,x.alphaMapTransform)),g.alphaTest>0&&(x.alphaTest.value=g.alphaTest)}function d(x,g){x.specular.value.copy(g.specular),x.shininess.value=Math.max(g.shininess,1e-4)}function m(x,g){g.gradientMap&&(x.gradientMap.value=g.gradientMap)}function p(x,g){x.metalness.value=g.metalness,g.metalnessMap&&(x.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,x.metalnessMapTransform)),x.roughness.value=g.roughness,g.roughnessMap&&(x.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,x.roughnessMapTransform)),g.envMap&&(x.envMapIntensity.value=g.envMapIntensity)}function f(x,g,_){x.ior.value=g.ior,g.sheen>0&&(x.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),x.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(x.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,x.sheenColorMapTransform)),g.sheenRoughnessMap&&(x.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,x.sheenRoughnessMapTransform))),g.clearcoat>0&&(x.clearcoat.value=g.clearcoat,x.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(x.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,x.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(x.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===uo&&x.clearcoatNormalScale.value.negate())),g.dispersion>0&&(x.dispersion.value=g.dispersion),g.iridescence>0&&(x.iridescence.value=g.iridescence,x.iridescenceIOR.value=g.iridescenceIOR,x.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(x.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,x.iridescenceMapTransform)),g.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),g.transmission>0&&(x.transmission.value=g.transmission,x.transmissionSamplerMap.value=_.texture,x.transmissionSamplerSize.value.set(_.width,_.height),g.transmissionMap&&(x.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,x.transmissionMapTransform)),x.thickness.value=g.thickness,g.thicknessMap&&(x.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=g.attenuationDistance,x.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(x.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(x.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=g.specularIntensity,x.specularColor.value.copy(g.specularColor),g.specularColorMap&&(x.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,x.specularColorMapTransform)),g.specularIntensityMap&&(x.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,g){g.matcap&&(x.matcap.value=g.matcap)}function v(x,g){const _=e.get(g).light;x.referencePosition.value.setFromMatrixPosition(_.matrixWorld),x.nearDistance.value=_.shadow.camera.near,x.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:a}}function P_e(t,e,n,r){let a={},s={},o=[];const l=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(_,N){const T=N.program;r.uniformBlockBinding(_,T)}function u(_,N){let T=a[_.id];T===void 0&&(y(_),T=d(_),a[_.id]=T,_.addEventListener("dispose",x));const C=N.program;r.updateUBOMapping(_,C);const A=e.render.frame;s[_.id]!==A&&(p(_),s[_.id]=A)}function d(_){const N=m();_.__bindingPointIndex=N;const T=t.createBuffer(),C=_.__size,A=_.usage;return t.bindBuffer(t.UNIFORM_BUFFER,T),t.bufferData(t.UNIFORM_BUFFER,C,A),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,N,T),T}function m(){for(let _=0;_0&&(T+=C-A),_.__size=T,_.__cache={},this}function v(_){const N={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(N.boundary=4,N.storage=4):_.isVector2?(N.boundary=8,N.storage=8):_.isVector3||_.isColor?(N.boundary=16,N.storage=12):_.isVector4?(N.boundary=16,N.storage=16):_.isMatrix3?(N.boundary=48,N.storage=48):_.isMatrix4?(N.boundary=64,N.storage=64):_.isTexture?Pn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Pn("WebGLRenderer: Unsupported uniform value type.",_),N}function x(_){const N=_.target;N.removeEventListener("dispose",x);const T=o.indexOf(N.__bindingPointIndex);o.splice(T,1),t.deleteBuffer(a[N.id]),delete a[N.id],delete s[N.id]}function g(){for(const _ in a)t.deleteBuffer(a[_]);o=[],a={},s={}}return{bind:c,update:u,dispose:g}}const M_e=new Uint16Array([11481,15204,11534,15171,11808,15015,12385,14843,12894,14716,13396,14600,13693,14483,13976,14366,14237,14171,14405,13961,14511,13770,14605,13598,14687,13444,14760,13305,14822,13066,14876,12857,14923,12675,14963,12517,14997,12379,15025,12230,15049,12023,15070,11843,15086,11687,15100,11551,15111,11433,15120,11330,15127,11217,15132,11060,15135,10922,15138,10801,15139,10695,15139,10600,13012,14923,13020,14917,13064,14886,13176,14800,13349,14666,13513,14526,13724,14398,13960,14230,14200,14020,14383,13827,14488,13651,14583,13491,14667,13348,14740,13132,14803,12908,14856,12713,14901,12542,14938,12394,14968,12241,14992,12017,15010,11822,15024,11654,15034,11507,15041,11380,15044,11269,15044,11081,15042,10913,15037,10764,15031,10635,15023,10520,15014,10419,15003,10330,13657,14676,13658,14673,13670,14660,13698,14622,13750,14547,13834,14442,13956,14317,14112,14093,14291,13889,14407,13704,14499,13538,14586,13389,14664,13201,14733,12966,14792,12758,14842,12577,14882,12418,14915,12272,14940,12033,14959,11826,14972,11646,14980,11490,14983,11355,14983,11212,14979,11008,14971,10830,14961,10675,14950,10540,14936,10420,14923,10315,14909,10204,14894,10041,14089,14460,14090,14459,14096,14452,14112,14431,14141,14388,14186,14305,14252,14130,14341,13941,14399,13756,14467,13585,14539,13430,14610,13272,14677,13026,14737,12808,14790,12617,14833,12449,14869,12303,14896,12065,14916,11845,14929,11655,14937,11490,14939,11347,14936,11184,14930,10970,14921,10783,14912,10621,14900,10480,14885,10356,14867,10247,14848,10062,14827,9894,14805,9745,14400,14208,14400,14206,14402,14198,14406,14174,14415,14122,14427,14035,14444,13913,14469,13767,14504,13613,14548,13463,14598,13324,14651,13082,14704,12858,14752,12658,14795,12483,14831,12330,14860,12106,14881,11875,14895,11675,14903,11501,14905,11351,14903,11178,14900,10953,14892,10757,14880,10589,14865,10442,14847,10313,14827,10162,14805,9965,14782,9792,14757,9642,14731,9507,14562,13883,14562,13883,14563,13877,14566,13862,14570,13830,14576,13773,14584,13689,14595,13582,14613,13461,14637,13336,14668,13120,14704,12897,14741,12695,14776,12516,14808,12358,14835,12150,14856,11910,14870,11701,14878,11519,14882,11361,14884,11187,14880,10951,14871,10748,14858,10572,14842,10418,14823,10286,14801,10099,14777,9897,14751,9722,14725,9567,14696,9430,14666,9309,14702,13604,14702,13604,14702,13600,14703,13591,14705,13570,14707,13533,14709,13477,14712,13400,14718,13305,14727,13106,14743,12907,14762,12716,14784,12539,14807,12380,14827,12190,14844,11943,14855,11727,14863,11539,14870,11376,14871,11204,14868,10960,14858,10748,14845,10565,14829,10406,14809,10269,14786,10058,14761,9852,14734,9671,14705,9512,14674,9374,14641,9253,14608,9076,14821,13366,14821,13365,14821,13364,14821,13358,14821,13344,14821,13320,14819,13252,14817,13145,14815,13011,14814,12858,14817,12698,14823,12539,14832,12389,14841,12214,14850,11968,14856,11750,14861,11558,14866,11390,14867,11226,14862,10972,14853,10754,14840,10565,14823,10401,14803,10259,14780,10032,14754,9820,14725,9635,14694,9473,14661,9333,14627,9203,14593,8988,14557,8798,14923,13014,14922,13014,14922,13012,14922,13004,14920,12987,14919,12957,14915,12907,14909,12834,14902,12738,14894,12623,14888,12498,14883,12370,14880,12203,14878,11970,14875,11759,14873,11569,14874,11401,14872,11243,14865,10986,14855,10762,14842,10568,14825,10401,14804,10255,14781,10017,14754,9799,14725,9611,14692,9445,14658,9301,14623,9139,14587,8920,14548,8729,14509,8562,15008,12672,15008,12672,15008,12671,15007,12667,15005,12656,15001,12637,14997,12605,14989,12556,14978,12490,14966,12407,14953,12313,14940,12136,14927,11934,14914,11742,14903,11563,14896,11401,14889,11247,14879,10992,14866,10767,14851,10570,14833,10400,14812,10252,14789,10007,14761,9784,14731,9592,14698,9424,14663,9279,14627,9088,14588,8868,14548,8676,14508,8508,14467,8360,15080,12386,15080,12386,15079,12385,15078,12383,15076,12378,15072,12367,15066,12347,15057,12315,15045,12253,15030,12138,15012,11998,14993,11845,14972,11685,14951,11530,14935,11383,14920,11228,14904,10981,14887,10762,14870,10567,14850,10397,14827,10248,14803,9997,14774,9771,14743,9578,14710,9407,14674,9259,14637,9048,14596,8826,14555,8632,14514,8464,14471,8317,14427,8182,15139,12008,15139,12008,15138,12008,15137,12007,15135,12003,15130,11990,15124,11969,15115,11929,15102,11872,15086,11794,15064,11693,15041,11581,15013,11459,14987,11336,14966,11170,14944,10944,14921,10738,14898,10552,14875,10387,14850,10239,14824,9983,14794,9758,14762,9563,14728,9392,14692,9244,14653,9014,14611,8791,14569,8597,14526,8427,14481,8281,14436,8110,14391,7885,15188,11617,15188,11617,15187,11617,15186,11618,15183,11617,15179,11612,15173,11601,15163,11581,15150,11546,15133,11495,15110,11427,15083,11346,15051,11246,15024,11057,14996,10868,14967,10687,14938,10517,14911,10362,14882,10206,14853,9956,14821,9737,14787,9543,14752,9375,14715,9228,14675,8980,14632,8760,14589,8565,14544,8395,14498,8248,14451,8049,14404,7824,14357,7630,15228,11298,15228,11298,15227,11299,15226,11301,15223,11303,15219,11302,15213,11299,15204,11290,15191,11271,15174,11217,15150,11129,15119,11015,15087,10886,15057,10744,15024,10599,14990,10455,14957,10318,14924,10143,14891,9911,14856,9701,14820,9516,14782,9352,14744,9200,14703,8946,14659,8725,14615,8533,14568,8366,14521,8220,14472,7992,14423,7770,14374,7578,14315,7408,15260,10819,15260,10819,15259,10822,15258,10826,15256,10832,15251,10836,15246,10841,15237,10838,15225,10821,15207,10788,15183,10734,15151,10660,15120,10571,15087,10469,15049,10359,15012,10249,14974,10041,14937,9837,14900,9647,14860,9475,14820,9320,14779,9147,14736,8902,14691,8688,14646,8499,14598,8335,14549,8189,14499,7940,14448,7720,14397,7529,14347,7363,14256,7218,15285,10410,15285,10411,15285,10413,15284,10418,15282,10425,15278,10434,15272,10442,15264,10449,15252,10445,15235,10433,15210,10403,15179,10358,15149,10301,15113,10218,15073,10059,15033,9894,14991,9726,14951,9565,14909,9413,14865,9273,14822,9073,14777,8845,14730,8641,14682,8459,14633,8300,14583,8129,14531,7883,14479,7670,14426,7482,14373,7321,14305,7176,14201,6939,15305,9939,15305,9940,15305,9945,15304,9955,15302,9967,15298,9989,15293,10010,15286,10033,15274,10044,15258,10045,15233,10022,15205,9975,15174,9903,15136,9808,15095,9697,15053,9578,15009,9451,14965,9327,14918,9198,14871,8973,14825,8766,14775,8579,14725,8408,14675,8259,14622,8058,14569,7821,14515,7615,14460,7435,14405,7276,14350,7108,14256,6866,14149,6653,15321,9444,15321,9445,15321,9448,15320,9458,15317,9470,15314,9490,15310,9515,15302,9540,15292,9562,15276,9579,15251,9577,15226,9559,15195,9519,15156,9463,15116,9389,15071,9304,15025,9208,14978,9023,14927,8838,14878,8661,14827,8496,14774,8344,14722,8206,14667,7973,14612,7749,14556,7555,14499,7382,14443,7229,14385,7025,14322,6791,14210,6588,14100,6409,15333,8920,15333,8921,15332,8927,15332,8943,15329,8965,15326,9002,15322,9048,15316,9106,15307,9162,15291,9204,15267,9221,15244,9221,15212,9196,15175,9134,15133,9043,15088,8930,15040,8801,14990,8665,14938,8526,14886,8391,14830,8261,14775,8087,14719,7866,14661,7664,14603,7482,14544,7322,14485,7178,14426,6936,14367,6713,14281,6517,14166,6348,14054,6198,15341,8360,15341,8361,15341,8366,15341,8379,15339,8399,15336,8431,15332,8473,15326,8527,15318,8585,15302,8632,15281,8670,15258,8690,15227,8690,15191,8664,15149,8612,15104,8543,15055,8456,15001,8360,14948,8259,14892,8122,14834,7923,14776,7734,14716,7558,14656,7397,14595,7250,14534,7070,14472,6835,14410,6628,14350,6443,14243,6283,14125,6135,14010,5889,15348,7715,15348,7717,15348,7725,15347,7745,15345,7780,15343,7836,15339,7905,15334,8e3,15326,8103,15310,8193,15293,8239,15270,8270,15240,8287,15204,8283,15163,8260,15118,8223,15067,8143,15014,8014,14958,7873,14899,7723,14839,7573,14778,7430,14715,7293,14652,7164,14588,6931,14524,6720,14460,6531,14396,6362,14330,6210,14207,6015,14086,5781,13969,5576,15352,7114,15352,7116,15352,7128,15352,7159,15350,7195,15348,7237,15345,7299,15340,7374,15332,7457,15317,7544,15301,7633,15280,7703,15251,7754,15216,7775,15176,7767,15131,7733,15079,7670,15026,7588,14967,7492,14906,7387,14844,7278,14779,7171,14714,6965,14648,6770,14581,6587,14515,6420,14448,6269,14382,6123,14299,5881,14172,5665,14049,5477,13929,5310,15355,6329,15355,6330,15355,6339,15355,6362,15353,6410,15351,6472,15349,6572,15344,6688,15337,6835,15323,6985,15309,7142,15287,7220,15260,7277,15226,7310,15188,7326,15142,7318,15090,7285,15036,7239,14976,7177,14914,7045,14849,6892,14782,6736,14714,6581,14645,6433,14576,6293,14506,6164,14438,5946,14369,5733,14270,5540,14140,5369,14014,5216,13892,5043,15357,5483,15357,5484,15357,5496,15357,5528,15356,5597,15354,5692,15351,5835,15347,6011,15339,6195,15328,6317,15314,6446,15293,6566,15268,6668,15235,6746,15197,6796,15152,6811,15101,6790,15046,6748,14985,6673,14921,6583,14854,6479,14785,6371,14714,6259,14643,6149,14571,5946,14499,5750,14428,5567,14358,5401,14242,5250,14109,5111,13980,4870,13856,4657,15359,4555,15359,4557,15358,4573,15358,4633,15357,4715,15355,4841,15353,5061,15349,5216,15342,5391,15331,5577,15318,5770,15299,5967,15274,6150,15243,6223,15206,6280,15161,6310,15111,6317,15055,6300,14994,6262,14928,6208,14860,6141,14788,5994,14715,5838,14641,5684,14566,5529,14492,5384,14418,5247,14346,5121,14216,4892,14079,4682,13948,4496,13822,4330,15359,3498,15359,3501,15359,3520,15359,3598,15358,3719,15356,3860,15355,4137,15351,4305,15344,4563,15334,4809,15321,5116,15303,5273,15280,5418,15250,5547,15214,5653,15170,5722,15120,5761,15064,5763,15002,5733,14935,5673,14865,5597,14792,5504,14716,5400,14640,5294,14563,5185,14486,5041,14410,4841,14335,4655,14191,4482,14051,4325,13918,4183,13790,4012,15360,2282,15360,2285,15360,2306,15360,2401,15359,2547,15357,2748,15355,3103,15352,3349,15345,3675,15336,4020,15324,4272,15307,4496,15285,4716,15255,4908,15220,5086,15178,5170,15128,5214,15072,5234,15010,5231,14943,5206,14871,5166,14796,5102,14718,4971,14639,4833,14559,4687,14480,4541,14402,4401,14315,4268,14167,4142,14025,3958,13888,3747,13759,3556,15360,923,15360,925,15360,946,15360,1052,15359,1214,15357,1494,15356,1892,15352,2274,15346,2663,15338,3099,15326,3393,15309,3679,15288,3980,15260,4183,15226,4325,15185,4437,15136,4517,15080,4570,15018,4591,14950,4581,14877,4545,14800,4485,14720,4411,14638,4325,14556,4231,14475,4136,14395,3988,14297,3803,14145,3628,13999,3465,13861,3314,13729,3177,15360,263,15360,264,15360,272,15360,325,15359,407,15358,548,15356,780,15352,1144,15347,1580,15339,2099,15328,2425,15312,2795,15292,3133,15264,3329,15232,3517,15191,3689,15143,3819,15088,3923,15025,3978,14956,3999,14882,3979,14804,3931,14722,3855,14639,3756,14554,3645,14470,3529,14388,3409,14279,3289,14124,3173,13975,3055,13834,2848,13701,2658,15360,49,15360,49,15360,52,15360,75,15359,111,15358,201,15356,283,15353,519,15348,726,15340,1045,15329,1415,15314,1795,15295,2173,15269,2410,15237,2649,15197,2866,15150,3054,15095,3140,15032,3196,14963,3228,14888,3236,14808,3224,14725,3191,14639,3146,14553,3088,14466,2976,14382,2836,14262,2692,14103,2549,13952,2409,13808,2278,13674,2154,15360,4,15360,4,15360,4,15360,13,15359,33,15358,59,15357,112,15353,199,15348,302,15341,456,15331,628,15316,827,15297,1082,15272,1332,15241,1601,15202,1851,15156,2069,15101,2172,15039,2256,14970,2314,14894,2348,14813,2358,14728,2344,14640,2311,14551,2263,14463,2203,14376,2133,14247,2059,14084,1915,13930,1761,13784,1609,13648,1464,15360,0,15360,0,15360,0,15360,3,15359,18,15358,26,15357,53,15354,80,15348,97,15341,165,15332,238,15318,326,15299,427,15275,529,15245,654,15207,771,15161,885,15108,994,15046,1089,14976,1170,14900,1229,14817,1266,14731,1284,14641,1282,14550,1260,14460,1223,14370,1174,14232,1116,14066,1050,13909,981,13761,910,13623,839]);let Xu=null;function E_e(){return Xu===null&&(Xu=new Aye(M_e,32,32,tO,Ix),Xu.minFilter=El,Xu.magFilter=El,Xu.wrapS=fd,Xu.wrapT=fd,Xu.generateMipmaps=!1,Xu.needsUpdate=!0),Xu}let j_e=class{constructor(e={}){const{canvas:n=Jxe(),context:r=null,depth:a=!0,stencil:s=!1,alpha:o=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const y=new Set([rO,nO,eO]),v=new Set([du,kf,v0,w0,ZL,JL]),x=new Uint32Array(4),g=new Int32Array(4);let _=null,N=null;const T=[],C=[];this.domElement=n,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.toneMapping=yh,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const A=this;let k=!1;this._outputColorSpace=Io;let R=0,P=0,D=null,H=-1,z=null;const G=new na,I=new na;let ee=null;const ie=new Zn(0);let X=0,me=n.width,he=n.height,ge=1,Y=null,oe=null;const le=new na(0,0,me,he),xe=new na(0,0,me,he);let Pe=!1;const q=new lO;let Z=!1,j=!1;const E=new sa,U=new Tt,K=new na,$={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ne=!1;function O(){return D===null?ge:1}let V=r;function J(se,He){return n.getContext(se,He)}try{const se={alpha:!0,depth:a,stencil:s,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:d,failIfMajorPerformanceCaveat:m};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${YL}`),n.addEventListener("webglcontextlost",$e,!1),n.addEventListener("webglcontextrestored",Ue,!1),n.addEventListener("webglcontextcreationerror",De,!1),V===null){const He="webgl2";if(V=J(He,se),V===null)throw J(He)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(se){throw se("WebGLRenderer: "+se.message),se}let W,re,ue,fe,ye,ae,L,F,te,ve,pe,de,Ne,Se,Le,qe,Ee,Te,Ae,Be,je,Xe,ce,Ie;function Ce(){W=new Uwe(V),W.init(),Xe=new S_e(V,W),re=new Ewe(V,W,e,Xe),ue=new v_e(V,W),re.reversedDepthBuffer&&p&&ue.buffers.depth.setReversed(!0),fe=new $we(V),ye=new o_e,ae=new w_e(V,W,ue,ye,re,Xe,fe),L=new Dwe(A),F=new zwe(A),te=new Wye(V),ce=new Pwe(V,te),ve=new Bwe(V,te,fe,ce),pe=new Vwe(V,ve,te,fe),Ae=new qwe(V,re,ae),qe=new jwe(ye),de=new s_e(A,L,F,W,re,ce,qe),Ne=new A_e(A,ye),Se=new c_e,Le=new f_e(W),Te=new Awe(A,L,F,ue,pe,f,c),Ee=new x_e(A,pe,re),Ie=new P_e(V,fe,re,ue),Be=new Mwe(V,W,fe),je=new Hwe(V,W,fe),fe.programs=de.programs,A.capabilities=re,A.extensions=W,A.properties=ye,A.renderLists=Se,A.shadowMap=Ee,A.state=ue,A.info=fe}Ce();const Ge=new C_e(A,V);this.xr=Ge,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const se=W.get("WEBGL_lose_context");se&&se.loseContext()},this.forceContextRestore=function(){const se=W.get("WEBGL_lose_context");se&&se.restoreContext()},this.getPixelRatio=function(){return ge},this.setPixelRatio=function(se){se!==void 0&&(ge=se,this.setSize(me,he,!1))},this.getSize=function(se){return se.set(me,he)},this.setSize=function(se,He,Ke=!0){if(Ge.isPresenting){Pn("WebGLRenderer: Can't change size while VR device is presenting.");return}me=se,he=He,n.width=Math.floor(se*ge),n.height=Math.floor(He*ge),Ke===!0&&(n.style.width=se+"px",n.style.height=He+"px"),this.setViewport(0,0,se,He)},this.getDrawingBufferSize=function(se){return se.set(me*ge,he*ge).floor()},this.setDrawingBufferSize=function(se,He,Ke){me=se,he=He,ge=Ke,n.width=Math.floor(se*Ke),n.height=Math.floor(He*Ke),this.setViewport(0,0,se,He)},this.getCurrentViewport=function(se){return se.copy(G)},this.getViewport=function(se){return se.copy(le)},this.setViewport=function(se,He,Ke,Ye){se.isVector4?le.set(se.x,se.y,se.z,se.w):le.set(se,He,Ke,Ye),ue.viewport(G.copy(le).multiplyScalar(ge).round())},this.getScissor=function(se){return se.copy(xe)},this.setScissor=function(se,He,Ke,Ye){se.isVector4?xe.set(se.x,se.y,se.z,se.w):xe.set(se,He,Ke,Ye),ue.scissor(I.copy(xe).multiplyScalar(ge).round())},this.getScissorTest=function(){return Pe},this.setScissorTest=function(se){ue.setScissorTest(Pe=se)},this.setOpaqueSort=function(se){Y=se},this.setTransparentSort=function(se){oe=se},this.getClearColor=function(se){return se.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor(...arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha(...arguments)},this.clear=function(se=!0,He=!0,Ke=!0){let Ye=0;if(se){let Me=!1;if(D!==null){const dt=D.texture.format;Me=y.has(dt)}if(Me){const dt=D.texture.type,ct=v.has(dt),nt=Te.getClearColor(),bt=Te.getClearAlpha(),Ut=nt.r,Et=nt.g,It=nt.b;ct?(x[0]=Ut,x[1]=Et,x[2]=It,x[3]=bt,V.clearBufferuiv(V.COLOR,0,x)):(g[0]=Ut,g[1]=Et,g[2]=It,g[3]=bt,V.clearBufferiv(V.COLOR,0,g))}else Ye|=V.COLOR_BUFFER_BIT}He&&(Ye|=V.DEPTH_BUFFER_BIT),Ke&&(Ye|=V.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),V.clear(Ye)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",$e,!1),n.removeEventListener("webglcontextrestored",Ue,!1),n.removeEventListener("webglcontextcreationerror",De,!1),Te.dispose(),Se.dispose(),Le.dispose(),ye.dispose(),L.dispose(),F.dispose(),pe.dispose(),ce.dispose(),Ie.dispose(),de.dispose(),Ge.dispose(),Ge.removeEventListener("sessionstart",yt),Ge.removeEventListener("sessionend",wt),_t.stop()};function $e(se){se.preventDefault(),o6("WebGLRenderer: Context Lost."),k=!0}function Ue(){o6("WebGLRenderer: Context Restored."),k=!1;const se=fe.autoReset,He=Ee.enabled,Ke=Ee.autoUpdate,Ye=Ee.needsUpdate,Me=Ee.type;Ce(),fe.autoReset=se,Ee.enabled=He,Ee.autoUpdate=Ke,Ee.needsUpdate=Ye,Ee.type=Me}function De(se){qi("WebGLRenderer: A WebGL context could not be created. Reason: ",se.statusMessage)}function Ve(se){const He=se.target;He.removeEventListener("dispose",Ve),it(He)}function it(se){xt(se),ye.remove(se)}function xt(se){const He=ye.get(se).programs;He!==void 0&&(He.forEach(function(Ke){de.releaseProgram(Ke)}),se.isShaderMaterial&&de.releaseShaderCache(se))}this.renderBufferDirect=function(se,He,Ke,Ye,Me,dt){He===null&&(He=$);const ct=Me.isMesh&&Me.matrixWorld.determinant()<0,nt=Fe(se,He,Ke,Ye,Me);ue.setMaterial(Ye,ct);let bt=Ke.index,Ut=1;if(Ye.wireframe===!0){if(bt=ve.getWireframeAttribute(Ke),bt===void 0)return;Ut=2}const Et=Ke.drawRange,It=Ke.attributes.position;let Zt=Et.start*Ut,tn=(Et.start+Et.count)*Ut;dt!==null&&(Zt=Math.max(Zt,dt.start*Ut),tn=Math.min(tn,(dt.start+dt.count)*Ut)),bt!==null?(Zt=Math.max(Zt,0),tn=Math.min(tn,bt.count)):It!=null&&(Zt=Math.max(Zt,0),tn=Math.min(tn,It.count));const yn=tn-Zt;if(yn<0||yn===1/0)return;ce.setup(Me,Ye,nt,Ke,bt);let _n,qn=Be;if(bt!==null&&(_n=te.get(bt),qn=je,qn.setIndex(_n)),Me.isMesh)Ye.wireframe===!0?(ue.setLineWidth(Ye.wireframeLinewidth*O()),qn.setMode(V.LINES)):qn.setMode(V.TRIANGLES);else if(Me.isLine){let sn=Ye.linewidth;sn===void 0&&(sn=1),ue.setLineWidth(sn*O()),Me.isLineSegments?qn.setMode(V.LINES):Me.isLineLoop?qn.setMode(V.LINE_LOOP):qn.setMode(V.LINE_STRIP)}else Me.isPoints?qn.setMode(V.POINTS):Me.isSprite&&qn.setMode(V.TRIANGLES);if(Me.isBatchedMesh)if(Me._multiDrawInstances!==null)N0("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),qn.renderMultiDrawInstances(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount,Me._multiDrawInstances);else if(W.get("WEBGL_multi_draw"))qn.renderMultiDraw(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount);else{const sn=Me._multiDrawStarts,Cn=Me._multiDrawCounts,gn=Me._multiDrawCount,Qr=bt?te.get(bt).bytesPerElement:1,Tn=ye.get(Ye).currentProgram.getUniforms();for(let hr=0;hr{function dt(){if(Ye.forEach(function(ct){ye.get(ct).currentProgram.isReady()&&Ye.delete(ct)}),Ye.size===0){Me(se);return}setTimeout(dt,10)}W.get("KHR_parallel_shader_compile")!==null?dt():setTimeout(dt,10)})};let kt=null;function We(se){kt&&kt(se)}function yt(){_t.stop()}function wt(){_t.start()}const _t=new qQ;_t.setAnimationLoop(We),typeof self<"u"&&_t.setContext(self),this.setAnimationLoop=function(se){kt=se,Ge.setAnimationLoop(se),se===null?_t.stop():_t.start()},Ge.addEventListener("sessionstart",yt),Ge.addEventListener("sessionend",wt),this.render=function(se,He){if(He!==void 0&&He.isCamera!==!0){qi("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(k===!0)return;if(se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),He.parent===null&&He.matrixWorldAutoUpdate===!0&&He.updateMatrixWorld(),Ge.enabled===!0&&Ge.isPresenting===!0&&(Ge.cameraAutoUpdate===!0&&Ge.updateCamera(He),He=Ge.getCamera()),se.isScene===!0&&se.onBeforeRender(A,se,He,D),N=Le.get(se,C.length),N.init(He),C.push(N),E.multiplyMatrices(He.projectionMatrix,He.matrixWorldInverse),q.setFromProjectionMatrix(E,eu,He.reversedDepth),j=this.localClippingEnabled,Z=qe.init(this.clippingPlanes,j),_=Se.get(se,T.length),_.init(),T.push(_),Ge.enabled===!0&&Ge.isPresenting===!0){const dt=A.xr.getDepthSensingMesh();dt!==null&&Ot(dt,He,-1/0,A.sortObjects)}Ot(se,He,0,A.sortObjects),_.finish(),A.sortObjects===!0&&_.sort(Y,oe),ne=Ge.enabled===!1||Ge.isPresenting===!1||Ge.hasDepthSensing()===!1,ne&&Te.addToRenderList(_,se),this.info.render.frame++,Z===!0&&qe.beginShadows();const Ke=N.state.shadowsArray;Ee.render(Ke,se,He),Z===!0&&qe.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ye=_.opaque,Me=_.transmissive;if(N.setupLights(),He.isArrayCamera){const dt=He.cameras;if(Me.length>0)for(let ct=0,nt=dt.length;ct0&&Xt(Ye,Me,se,He),ne&&Te.render(se),Vt(_,se,He);D!==null&&P===0&&(ae.updateMultisampleRenderTarget(D),ae.updateRenderTargetMipmap(D)),se.isScene===!0&&se.onAfterRender(A,se,He),ce.resetDefaultState(),H=-1,z=null,C.pop(),C.length>0?(N=C[C.length-1],Z===!0&&qe.setGlobalState(A.clippingPlanes,N.state.camera)):N=null,T.pop(),T.length>0?_=T[T.length-1]:_=null};function Ot(se,He,Ke,Ye){if(se.visible===!1)return;if(se.layers.test(He.layers)){if(se.isGroup)Ke=se.renderOrder;else if(se.isLOD)se.autoUpdate===!0&&se.update(He);else if(se.isLight)N.pushLight(se),se.castShadow&&N.pushShadow(se);else if(se.isSprite){if(!se.frustumCulled||q.intersectsSprite(se)){Ye&&K.setFromMatrixPosition(se.matrixWorld).applyMatrix4(E);const ct=pe.update(se),nt=se.material;nt.visible&&_.push(se,ct,nt,Ke,K.z,null)}}else if((se.isMesh||se.isLine||se.isPoints)&&(!se.frustumCulled||q.intersectsObject(se))){const ct=pe.update(se),nt=se.material;if(Ye&&(se.boundingSphere!==void 0?(se.boundingSphere===null&&se.computeBoundingSphere(),K.copy(se.boundingSphere.center)):(ct.boundingSphere===null&&ct.computeBoundingSphere(),K.copy(ct.boundingSphere.center)),K.applyMatrix4(se.matrixWorld).applyMatrix4(E)),Array.isArray(nt)){const bt=ct.groups;for(let Ut=0,Et=bt.length;Ut0&&Qe(Me,He,Ke),dt.length>0&&Qe(dt,He,Ke),ct.length>0&&Qe(ct,He,Ke),ue.buffers.depth.setTest(!0),ue.buffers.depth.setMask(!0),ue.buffers.color.setMask(!0),ue.setPolygonOffset(!1)}function Xt(se,He,Ke,Ye){if((Ke.isScene===!0?Ke.overrideMaterial:null)!==null)return;N.state.transmissionRenderTarget[Ye.id]===void 0&&(N.state.transmissionRenderTarget[Ye.id]=new Tf(1,1,{generateMipmaps:!0,type:W.has("EXT_color_buffer_half_float")||W.has("EXT_color_buffer_float")?Ix:du,minFilter:$p,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xr.workingColorSpace}));const dt=N.state.transmissionRenderTarget[Ye.id],ct=Ye.viewport||G;dt.setSize(ct.z*A.transmissionResolutionScale,ct.w*A.transmissionResolutionScale);const nt=A.getRenderTarget(),bt=A.getActiveCubeFace(),Ut=A.getActiveMipmapLevel();A.setRenderTarget(dt),A.getClearColor(ie),X=A.getClearAlpha(),X<1&&A.setClearColor(16777215,.5),A.clear(),ne&&Te.render(Ke);const Et=A.toneMapping;A.toneMapping=yh;const It=Ye.viewport;if(Ye.viewport!==void 0&&(Ye.viewport=void 0),N.setupLightsView(Ye),Z===!0&&qe.setGlobalState(A.clippingPlanes,Ye),Qe(se,Ke,Ye),ae.updateMultisampleRenderTarget(dt),ae.updateRenderTargetMipmap(dt),W.has("WEBGL_multisampled_render_to_texture")===!1){let Zt=!1;for(let tn=0,yn=He.length;tn0),It=!!Ke.morphAttributes.position,Zt=!!Ke.morphAttributes.normal,tn=!!Ke.morphAttributes.color;let yn=yh;Ye.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=A.toneMapping);const _n=Ke.morphAttributes.position||Ke.morphAttributes.normal||Ke.morphAttributes.color,qn=_n!==void 0?_n.length:0,sn=ye.get(Ye),Cn=N.state.lights;if(Z===!0&&(j===!0||se!==z)){const li=se===z&&Ye.id===H;qe.setState(Ye,se,li)}let gn=!1;Ye.version===sn.__version?(sn.needsLights&&sn.lightsStateVersion!==Cn.state.version||sn.outputColorSpace!==nt||Me.isBatchedMesh&&sn.batching===!1||!Me.isBatchedMesh&&sn.batching===!0||Me.isBatchedMesh&&sn.batchingColor===!0&&Me.colorTexture===null||Me.isBatchedMesh&&sn.batchingColor===!1&&Me.colorTexture!==null||Me.isInstancedMesh&&sn.instancing===!1||!Me.isInstancedMesh&&sn.instancing===!0||Me.isSkinnedMesh&&sn.skinning===!1||!Me.isSkinnedMesh&&sn.skinning===!0||Me.isInstancedMesh&&sn.instancingColor===!0&&Me.instanceColor===null||Me.isInstancedMesh&&sn.instancingColor===!1&&Me.instanceColor!==null||Me.isInstancedMesh&&sn.instancingMorph===!0&&Me.morphTexture===null||Me.isInstancedMesh&&sn.instancingMorph===!1&&Me.morphTexture!==null||sn.envMap!==bt||Ye.fog===!0&&sn.fog!==dt||sn.numClippingPlanes!==void 0&&(sn.numClippingPlanes!==qe.numPlanes||sn.numIntersection!==qe.numIntersection)||sn.vertexAlphas!==Ut||sn.vertexTangents!==Et||sn.morphTargets!==It||sn.morphNormals!==Zt||sn.morphColors!==tn||sn.toneMapping!==yn||sn.morphTargetsCount!==qn)&&(gn=!0):(gn=!0,sn.__version=Ye.version);let Qr=sn.currentProgram;gn===!0&&(Qr=hn(Ye,He,Me));let Tn=!1,hr=!1,_a=!1;const On=Qr.getUniforms(),qr=sn.uniforms;if(ue.useProgram(Qr.program)&&(Tn=!0,hr=!0,_a=!0),Ye.id!==H&&(H=Ye.id,hr=!0),Tn||z!==se){ue.buffers.depth.getReversed()&&se.reversedDepth!==!0&&(se._reversedDepth=!0,se.updateProjectionMatrix()),On.setValue(V,"projectionMatrix",se.projectionMatrix),On.setValue(V,"viewMatrix",se.matrixWorldInverse);const _i=On.map.cameraPosition;_i!==void 0&&_i.setValue(V,U.setFromMatrixPosition(se.matrixWorld)),re.logarithmicDepthBuffer&&On.setValue(V,"logDepthBufFC",2/(Math.log(se.far+1)/Math.LN2)),(Ye.isMeshPhongMaterial||Ye.isMeshToonMaterial||Ye.isMeshLambertMaterial||Ye.isMeshBasicMaterial||Ye.isMeshStandardMaterial||Ye.isShaderMaterial)&&On.setValue(V,"isOrthographic",se.isOrthographicCamera===!0),z!==se&&(z=se,hr=!0,_a=!0)}if(Me.isSkinnedMesh){On.setOptional(V,Me,"bindMatrix"),On.setOptional(V,Me,"bindMatrixInverse");const li=Me.skeleton;li&&(li.boneTexture===null&&li.computeBoneTexture(),On.setValue(V,"boneTexture",li.boneTexture,ae))}Me.isBatchedMesh&&(On.setOptional(V,Me,"batchingTexture"),On.setValue(V,"batchingTexture",Me._matricesTexture,ae),On.setOptional(V,Me,"batchingIdTexture"),On.setValue(V,"batchingIdTexture",Me._indirectTexture,ae),On.setOptional(V,Me,"batchingColorTexture"),Me._colorsTexture!==null&&On.setValue(V,"batchingColorTexture",Me._colorsTexture,ae));const cr=Ke.morphAttributes;if((cr.position!==void 0||cr.normal!==void 0||cr.color!==void 0)&&Ae.update(Me,Ke,Qr),(hr||sn.receiveShadow!==Me.receiveShadow)&&(sn.receiveShadow=Me.receiveShadow,On.setValue(V,"receiveShadow",Me.receiveShadow)),Ye.isMeshGouraudMaterial&&Ye.envMap!==null&&(qr.envMap.value=bt,qr.flipEnvMap.value=bt.isCubeTexture&&bt.isRenderTargetTexture===!1?-1:1),Ye.isMeshStandardMaterial&&Ye.envMap===null&&He.environment!==null&&(qr.envMapIntensity.value=He.environmentIntensity),qr.dfgLUT!==void 0&&(qr.dfgLUT.value=E_e()),hr&&(On.setValue(V,"toneMappingExposure",A.toneMappingExposure),sn.needsLights&&tt(qr,_a),dt&&Ye.fog===!0&&Ne.refreshFogUniforms(qr,dt),Ne.refreshMaterialUniforms(qr,Ye,ge,he,N.state.transmissionRenderTarget[se.id]),rN.upload(V,jn(sn),qr,ae)),Ye.isShaderMaterial&&Ye.uniformsNeedUpdate===!0&&(rN.upload(V,jn(sn),qr,ae),Ye.uniformsNeedUpdate=!1),Ye.isSpriteMaterial&&On.setValue(V,"center",Me.center),On.setValue(V,"modelViewMatrix",Me.modelViewMatrix),On.setValue(V,"normalMatrix",Me.normalMatrix),On.setValue(V,"modelMatrix",Me.matrixWorld),Ye.isShaderMaterial||Ye.isRawShaderMaterial){const li=Ye.uniformsGroups;for(let _i=0,Tr=li.length;_i0&&ae.useMultisampledRTT(se)===!1?Me=ye.get(se).__webglMultisampledFramebuffer:Array.isArray(Et)?Me=Et[Ke]:Me=Et,G.copy(se.viewport),I.copy(se.scissor),ee=se.scissorTest}else G.copy(le).multiplyScalar(ge).floor(),I.copy(xe).multiplyScalar(ge).floor(),ee=Pe;if(Ke!==0&&(Me=Ze),ue.bindFramebuffer(V.FRAMEBUFFER,Me)&&Ye&&ue.drawBuffers(se,Me),ue.viewport(G),ue.scissor(I),ue.setScissorTest(ee),dt){const bt=ye.get(se.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+He,bt.__webglTexture,Ke)}else if(ct){const bt=He;for(let Ut=0;Ut=0&&He<=se.width-Ye&&Ke>=0&&Ke<=se.height-Me&&(se.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+nt),V.readPixels(He,Ke,Ye,Me,Xe.convert(Et),Xe.convert(It),dt))}finally{const Ut=D!==null?ye.get(D).__webglFramebuffer:null;ue.bindFramebuffer(V.FRAMEBUFFER,Ut)}}},this.readRenderTargetPixelsAsync=async function(se,He,Ke,Ye,Me,dt,ct,nt=0){if(!(se&&se.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let bt=ye.get(se).__webglFramebuffer;if(se.isWebGLCubeRenderTarget&&ct!==void 0&&(bt=bt[ct]),bt)if(He>=0&&He<=se.width-Ye&&Ke>=0&&Ke<=se.height-Me){ue.bindFramebuffer(V.FRAMEBUFFER,bt);const Ut=se.textures[nt],Et=Ut.format,It=Ut.type;if(!re.textureFormatReadable(Et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!re.textureTypeReadable(It))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Zt=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,Zt),V.bufferData(V.PIXEL_PACK_BUFFER,dt.byteLength,V.STREAM_READ),se.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+nt),V.readPixels(He,Ke,Ye,Me,Xe.convert(Et),Xe.convert(It),0);const tn=D!==null?ye.get(D).__webglFramebuffer:null;ue.bindFramebuffer(V.FRAMEBUFFER,tn);const yn=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);return V.flush(),await eye(V,yn,4),V.bindBuffer(V.PIXEL_PACK_BUFFER,Zt),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,dt),V.deleteBuffer(Zt),V.deleteSync(yn),dt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(se,He=null,Ke=0){const Ye=Math.pow(2,-Ke),Me=Math.floor(se.image.width*Ye),dt=Math.floor(se.image.height*Ye),ct=He!==null?He.x:0,nt=He!==null?He.y:0;ae.setTexture2D(se,0),V.copyTexSubImage2D(V.TEXTURE_2D,Ke,0,0,ct,nt,Me,dt),ue.unbindTexture()};const ke=V.createFramebuffer(),ot=V.createFramebuffer();this.copyTextureToTexture=function(se,He,Ke=null,Ye=null,Me=0,dt=null){dt===null&&(Me!==0?(N0("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),dt=Me,Me=0):dt=0);let ct,nt,bt,Ut,Et,It,Zt,tn,yn;const _n=se.isCompressedTexture?se.mipmaps[dt]:se.image;if(Ke!==null)ct=Ke.max.x-Ke.min.x,nt=Ke.max.y-Ke.min.y,bt=Ke.isBox3?Ke.max.z-Ke.min.z:1,Ut=Ke.min.x,Et=Ke.min.y,It=Ke.isBox3?Ke.min.z:0;else{const cr=Math.pow(2,-Me);ct=Math.floor(_n.width*cr),nt=Math.floor(_n.height*cr),se.isDataArrayTexture?bt=_n.depth:se.isData3DTexture?bt=Math.floor(_n.depth*cr):bt=1,Ut=0,Et=0,It=0}Ye!==null?(Zt=Ye.x,tn=Ye.y,yn=Ye.z):(Zt=0,tn=0,yn=0);const qn=Xe.convert(He.format),sn=Xe.convert(He.type);let Cn;He.isData3DTexture?(ae.setTexture3D(He,0),Cn=V.TEXTURE_3D):He.isDataArrayTexture||He.isCompressedArrayTexture?(ae.setTexture2DArray(He,0),Cn=V.TEXTURE_2D_ARRAY):(ae.setTexture2D(He,0),Cn=V.TEXTURE_2D),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,He.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,He.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,He.unpackAlignment);const gn=V.getParameter(V.UNPACK_ROW_LENGTH),Qr=V.getParameter(V.UNPACK_IMAGE_HEIGHT),Tn=V.getParameter(V.UNPACK_SKIP_PIXELS),hr=V.getParameter(V.UNPACK_SKIP_ROWS),_a=V.getParameter(V.UNPACK_SKIP_IMAGES);V.pixelStorei(V.UNPACK_ROW_LENGTH,_n.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,_n.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,Ut),V.pixelStorei(V.UNPACK_SKIP_ROWS,Et),V.pixelStorei(V.UNPACK_SKIP_IMAGES,It);const On=se.isDataArrayTexture||se.isData3DTexture,qr=He.isDataArrayTexture||He.isData3DTexture;if(se.isDepthTexture){const cr=ye.get(se),li=ye.get(He),_i=ye.get(cr.__renderTarget),Tr=ye.get(li.__renderTarget);ue.bindFramebuffer(V.READ_FRAMEBUFFER,_i.__webglFramebuffer),ue.bindFramebuffer(V.DRAW_FRAMEBUFFER,Tr.__webglFramebuffer);for(let zi=0;ziMath.PI&&(r-=ro),a<-Math.PI?a+=ro:a>Math.PI&&(a-=ro),r<=a?this._spherical.theta=Math.max(r,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+a)/2?Math.max(r,this._spherical.theta):Math.min(a,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ua.setFromSpherical(this._spherical),ua.applyQuaternion(this._quatInverse),n.copy(this.target).add(ua),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const l=ua.length();o=this._clampDistance(l*this._scale);const c=l-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const l=new Tt(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const u=new Tt(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(l),this.object.updateMatrixWorld(),o=ua.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(P_.origin.copy(this.object.position),P_.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(P_.direction))wE||8*(1-this._lastQuaternion.dot(this.object.quaternion))>wE||this._lastTargetPosition.distanceToSquared(this.target)>wE?(this.dispatchEvent(rH),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ro/60*this.autoRotateSpeed*e:ro/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){ua.setFromMatrixColumn(n,0),ua.multiplyScalar(-e),this._panOffset.add(ua)}_panUp(e,n){this.screenSpacePanning===!0?ua.setFromMatrixColumn(n,1):(ua.setFromMatrixColumn(n,0),ua.crossVectors(this.object.up,ua)),ua.multiplyScalar(e),this._panOffset.add(ua)}_pan(e,n){const r=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;ua.copy(a).sub(this.target);let s=ua.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*n*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),a=e-r.left,s=n-r.top,o=r.width,l=r.height;this._mouse.x=a/o*2-1,this._mouse.y=-(s/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(ro*this._rotateDelta.x/n.clientHeight),this._rotateUp(ro*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._rotateStart.set(r,a)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._panStart.set(r,a)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),r=e.pageX-n.x,a=e.pageY-n.y,s=Math.sqrt(r*r+a*a);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),a=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(a,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(ro*this._rotateDelta.x/n.clientHeight),this._rotateUp(ro*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._panEnd.set(r,a)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),r=e.pageX-n.x,a=e.pageY-n.y,s=Math.sqrt(r*r+a*a);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+n.x)*.5,l=(e.pageY+n.y)*.5;this._updateZoomParameters(o,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n>5&31)/31,y=(ie>>10&31)/31):(p=g,f=_,y=N)}for(let ie=1;ie<=3;ie++){const X=z+ie*12,me=H*3*3+(ie-1)*3;R[me]=d.getFloat32(X,!0),R[me+1]=d.getFloat32(X+4,!0),R[me+2]=d.getFloat32(X+8,!0),P[me]=G,P[me+1]=I,P[me+2]=ee,v&&(D.setRGB(p,f,y,Io),x[me]=D.r,x[me+1]=D.g,x[me+2]=D.b)}}return k.setAttribute("position",new Us(R,3)),k.setAttribute("normal",new Us(P,3)),v&&(k.setAttribute("color",new Us(x,3)),k.hasColors=!0,k.alpha=T),k}function s(u){const d=new Ul,m=/solid([\s\S]*?)endsolid/g,p=/facet([\s\S]*?)endfacet/g,f=/solid\s(.+)/;let y=0;const v=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,x=new RegExp("vertex"+v+v+v,"g"),g=new RegExp("normal"+v+v+v,"g"),_=[],N=[],T=[],C=new Tt;let A,k=0,R=0,P=0;for(;(A=m.exec(u))!==null;){R=P;const D=A[0],H=(A=f.exec(D))!==null?A[1]:"";for(T.push(H);(A=p.exec(D))!==null;){let I=0,ee=0;const ie=A[0];for(;(A=g.exec(ie))!==null;)C.x=parseFloat(A[1]),C.y=parseFloat(A[2]),C.z=parseFloat(A[3]),ee++;for(;(A=x.exec(ie))!==null;)_.push(parseFloat(A[1]),parseFloat(A[2]),parseFloat(A[3])),N.push(C.x,C.y,C.z),I++,P++;ee!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+y),I!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+y),y++}const z=R,G=P-R;d.userData.groupNames=T,d.addGroup(z,G,k),k++}return d.setAttribute("position",new qo(_,3)),d.setAttribute("normal",new qo(N,3)),d}function o(u){return typeof u!="string"?new TextDecoder().decode(u):u}function l(u){if(typeof u=="string"){const d=new Uint8Array(u.length);for(let m=0;m>2,f=(3&u)<<4|d>>4,y=1>6:64,v=2>4,d=(15&p)<<4|(f=l.indexOf(c.charAt(v++)))>>2,m=(3&f)<<6|(y=l.indexOf(c.charAt(v++))),_[x++]=u,f!==64&&(_[x++]=d),y!==64&&(_[x++]=m);return _}},{"./support":30,"./utils":32}],2:[function(n,r,a){var s=n("./external"),o=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,m,p,f,y){this.compressedSize=d,this.uncompressedSize=m,this.crc32=p,this.compression=f,this.compressedContent=y}u.prototype={getContentWorker:function(){var d=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),m=this;return d.on("end",function(){if(this.streamInfo.data_length!==m.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,m,p){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(m.compressWorker(p)).pipe(new c("compressedSize")).withStreamInfo("compression",m)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,a){var s=n("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},a.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,a){var s=n("./utils"),o=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,m,p){var f=o,y=p+m;u^=-1;for(var v=p;v>>8^f[255&(u^d[v])];return-1^u})(0|c,l,l.length,0):(function(u,d,m,p){var f=o,y=p+m;u^=-1;for(var v=p;v>>8^f[255&(u^d.charCodeAt(v))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(n,r,a){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,a){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(m,p){c.call(this,"FlateWorker/"+m),this._pako=null,this._pakoAction=m,this._pakoOptions=p,this.meta={}}a.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(m){this.meta=m.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,m.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var m=this;this._pako.onData=function(p){m.push({data:p,meta:m.meta})}},a.compressWorker=function(m){return new d("Deflate",m)},a.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,a){function s(f,y){var v,x="";for(v=0;v>>=8;return x}function o(f,y,v,x,g,_){var N,T,C=f.file,A=f.compression,k=_!==u.utf8encode,R=l.transformTo("string",_(C.name)),P=l.transformTo("string",u.utf8encode(C.name)),D=C.comment,H=l.transformTo("string",_(D)),z=l.transformTo("string",u.utf8encode(D)),G=P.length!==C.name.length,I=z.length!==D.length,ee="",ie="",X="",me=C.dir,he=C.date,ge={crc32:0,compressedSize:0,uncompressedSize:0};y&&!v||(ge.crc32=f.crc32,ge.compressedSize=f.compressedSize,ge.uncompressedSize=f.uncompressedSize);var Y=0;y&&(Y|=8),k||!G&&!I||(Y|=2048);var oe=0,le=0;me&&(oe|=16),g==="UNIX"?(le=798,oe|=(function(Pe,q){var Z=Pe;return Pe||(Z=q?16893:33204),(65535&Z)<<16})(C.unixPermissions,me)):(le=20,oe|=(function(Pe){return 63&(Pe||0)})(C.dosPermissions)),N=he.getUTCHours(),N<<=6,N|=he.getUTCMinutes(),N<<=5,N|=he.getUTCSeconds()/2,T=he.getUTCFullYear()-1980,T<<=4,T|=he.getUTCMonth()+1,T<<=5,T|=he.getUTCDate(),G&&(ie=s(1,1)+s(d(R),4)+P,ee+="up"+s(ie.length,2)+ie),I&&(X=s(1,1)+s(d(H),4)+z,ee+="uc"+s(X.length,2)+X);var xe="";return xe+=`
+}`;class k_e{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new zQ(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new Ld({vertexShader:__e,fragmentShader:N_e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Bl(new cO(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}let C_e=class extends Kf{constructor(e,n){super();const r=this;let a=null,s=1,o=null,l="local-floor",c=1,u=null,d=null,m=null,p=null,f=null,y=null;const v=typeof XRWebGLBinding<"u",x=new k_e,g={},_=n.getContextAttributes();let N=null,T=null;const C=[],A=[],k=new Yn;let R=null;const P=new Cl;P.viewport=new na;const D=new Cl;D.viewport=new na;const H=[P,D],z=new $ye;let G=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let Z=C[q];return Z===void 0&&(Z=new mE,C[q]=Z),Z.getTargetRaySpace()},this.getControllerGrip=function(q){let Z=C[q];return Z===void 0&&(Z=new mE,C[q]=Z),Z.getGripSpace()},this.getHand=function(q){let Z=C[q];return Z===void 0&&(Z=new mE,C[q]=Z),Z.getHandSpace()};function ee(q){const Z=A.indexOf(q.inputSource);if(Z===-1)return;const j=C[Z];j!==void 0&&(j.update(q.inputSource,q.frame,u||o),j.dispatchEvent({type:q.type,data:q.inputSource}))}function ie(){a.removeEventListener("select",ee),a.removeEventListener("selectstart",ee),a.removeEventListener("selectend",ee),a.removeEventListener("squeeze",ee),a.removeEventListener("squeezestart",ee),a.removeEventListener("squeezeend",ee),a.removeEventListener("end",ie),a.removeEventListener("inputsourceschange",X);for(let q=0;q=0&&(A[E]=null,C[E].disconnect(j))}for(let Z=0;Z=A.length){A.push(j),E=K;break}else if(A[K]===null){A[K]=j,E=K;break}if(E===-1)break}const U=C[E];U&&U.connect(j)}}const me=new Tt,he=new Tt;function ge(q,Z,j){me.setFromMatrixPosition(Z.matrixWorld),he.setFromMatrixPosition(j.matrixWorld);const E=me.distanceTo(he),U=Z.projectionMatrix.elements,K=j.projectionMatrix.elements,$=U[14]/(U[10]-1),ne=U[14]/(U[10]+1),O=(U[9]+1)/U[5],V=(U[9]-1)/U[5],J=(U[8]-1)/U[0],W=(K[8]+1)/K[0],re=$*J,ue=$*W,fe=E/(-J+W),ye=fe*-J;if(Z.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(ye),q.translateZ(fe),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),U[10]===-1)q.projectionMatrix.copy(Z.projectionMatrix),q.projectionMatrixInverse.copy(Z.projectionMatrixInverse);else{const ae=$+fe,L=ne+fe,F=re-ye,te=ue+(E-ye),ve=O*ne/L*ae,pe=V*ne/L*ae;q.projectionMatrix.makePerspective(F,te,ve,pe,ae,L),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function Y(q,Z){Z===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(Z.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(a===null)return;let Z=q.near,j=q.far;x.texture!==null&&(x.depthNear>0&&(Z=x.depthNear),x.depthFar>0&&(j=x.depthFar)),z.near=D.near=P.near=Z,z.far=D.far=P.far=j,(G!==z.near||I!==z.far)&&(a.updateRenderState({depthNear:z.near,depthFar:z.far}),G=z.near,I=z.far),z.layers.mask=q.layers.mask|6,P.layers.mask=z.layers.mask&3,D.layers.mask=z.layers.mask&5;const E=q.parent,U=z.cameras;Y(z,E);for(let K=0;K0&&(x.alphaTest.value=g.alphaTest);const _=e.get(g),N=_.envMap,T=_.envMapRotation;N&&(x.envMap.value=N,vp.copy(T),vp.x*=-1,vp.y*=-1,vp.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(vp.y*=-1,vp.z*=-1),x.envMapRotation.value.setFromMatrix4(T_e.makeRotationFromEuler(vp)),x.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=g.reflectivity,x.ior.value=g.ior,x.refractionRatio.value=g.refractionRatio),g.lightMap&&(x.lightMap.value=g.lightMap,x.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,x.lightMapTransform)),g.aoMap&&(x.aoMap.value=g.aoMap,x.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,x.aoMapTransform))}function o(x,g){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,g.map&&(x.map.value=g.map,n(g.map,x.mapTransform))}function l(x,g){x.dashSize.value=g.dashSize,x.totalSize.value=g.dashSize+g.gapSize,x.scale.value=g.scale}function c(x,g,_,N){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,x.size.value=g.size*_,x.scale.value=N*.5,g.map&&(x.map.value=g.map,n(g.map,x.uvTransform)),g.alphaMap&&(x.alphaMap.value=g.alphaMap,n(g.alphaMap,x.alphaMapTransform)),g.alphaTest>0&&(x.alphaTest.value=g.alphaTest)}function u(x,g){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,x.rotation.value=g.rotation,g.map&&(x.map.value=g.map,n(g.map,x.mapTransform)),g.alphaMap&&(x.alphaMap.value=g.alphaMap,n(g.alphaMap,x.alphaMapTransform)),g.alphaTest>0&&(x.alphaTest.value=g.alphaTest)}function d(x,g){x.specular.value.copy(g.specular),x.shininess.value=Math.max(g.shininess,1e-4)}function m(x,g){g.gradientMap&&(x.gradientMap.value=g.gradientMap)}function p(x,g){x.metalness.value=g.metalness,g.metalnessMap&&(x.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,x.metalnessMapTransform)),x.roughness.value=g.roughness,g.roughnessMap&&(x.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,x.roughnessMapTransform)),g.envMap&&(x.envMapIntensity.value=g.envMapIntensity)}function f(x,g,_){x.ior.value=g.ior,g.sheen>0&&(x.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),x.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(x.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,x.sheenColorMapTransform)),g.sheenRoughnessMap&&(x.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,x.sheenRoughnessMapTransform))),g.clearcoat>0&&(x.clearcoat.value=g.clearcoat,x.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(x.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,x.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(x.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===uo&&x.clearcoatNormalScale.value.negate())),g.dispersion>0&&(x.dispersion.value=g.dispersion),g.iridescence>0&&(x.iridescence.value=g.iridescence,x.iridescenceIOR.value=g.iridescenceIOR,x.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(x.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,x.iridescenceMapTransform)),g.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),g.transmission>0&&(x.transmission.value=g.transmission,x.transmissionSamplerMap.value=_.texture,x.transmissionSamplerSize.value.set(_.width,_.height),g.transmissionMap&&(x.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,x.transmissionMapTransform)),x.thickness.value=g.thickness,g.thicknessMap&&(x.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=g.attenuationDistance,x.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(x.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(x.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=g.specularIntensity,x.specularColor.value.copy(g.specularColor),g.specularColorMap&&(x.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,x.specularColorMapTransform)),g.specularIntensityMap&&(x.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,g){g.matcap&&(x.matcap.value=g.matcap)}function v(x,g){const _=e.get(g).light;x.referencePosition.value.setFromMatrixPosition(_.matrixWorld),x.nearDistance.value=_.shadow.camera.near,x.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:a}}function P_e(t,e,n,r){let a={},s={},o=[];const l=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(_,N){const T=N.program;r.uniformBlockBinding(_,T)}function u(_,N){let T=a[_.id];T===void 0&&(y(_),T=d(_),a[_.id]=T,_.addEventListener("dispose",x));const C=N.program;r.updateUBOMapping(_,C);const A=e.render.frame;s[_.id]!==A&&(p(_),s[_.id]=A)}function d(_){const N=m();_.__bindingPointIndex=N;const T=t.createBuffer(),C=_.__size,A=_.usage;return t.bindBuffer(t.UNIFORM_BUFFER,T),t.bufferData(t.UNIFORM_BUFFER,C,A),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,N,T),T}function m(){for(let _=0;_0&&(T+=C-A),_.__size=T,_.__cache={},this}function v(_){const N={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(N.boundary=4,N.storage=4):_.isVector2?(N.boundary=8,N.storage=8):_.isVector3||_.isColor?(N.boundary=16,N.storage=12):_.isVector4?(N.boundary=16,N.storage=16):_.isMatrix3?(N.boundary=48,N.storage=48):_.isMatrix4?(N.boundary=64,N.storage=64):_.isTexture?Pn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Pn("WebGLRenderer: Unsupported uniform value type.",_),N}function x(_){const N=_.target;N.removeEventListener("dispose",x);const T=o.indexOf(N.__bindingPointIndex);o.splice(T,1),t.deleteBuffer(a[N.id]),delete a[N.id],delete s[N.id]}function g(){for(const _ in a)t.deleteBuffer(a[_]);o=[],a={},s={}}return{bind:c,update:u,dispose:g}}const M_e=new Uint16Array([11481,15204,11534,15171,11808,15015,12385,14843,12894,14716,13396,14600,13693,14483,13976,14366,14237,14171,14405,13961,14511,13770,14605,13598,14687,13444,14760,13305,14822,13066,14876,12857,14923,12675,14963,12517,14997,12379,15025,12230,15049,12023,15070,11843,15086,11687,15100,11551,15111,11433,15120,11330,15127,11217,15132,11060,15135,10922,15138,10801,15139,10695,15139,10600,13012,14923,13020,14917,13064,14886,13176,14800,13349,14666,13513,14526,13724,14398,13960,14230,14200,14020,14383,13827,14488,13651,14583,13491,14667,13348,14740,13132,14803,12908,14856,12713,14901,12542,14938,12394,14968,12241,14992,12017,15010,11822,15024,11654,15034,11507,15041,11380,15044,11269,15044,11081,15042,10913,15037,10764,15031,10635,15023,10520,15014,10419,15003,10330,13657,14676,13658,14673,13670,14660,13698,14622,13750,14547,13834,14442,13956,14317,14112,14093,14291,13889,14407,13704,14499,13538,14586,13389,14664,13201,14733,12966,14792,12758,14842,12577,14882,12418,14915,12272,14940,12033,14959,11826,14972,11646,14980,11490,14983,11355,14983,11212,14979,11008,14971,10830,14961,10675,14950,10540,14936,10420,14923,10315,14909,10204,14894,10041,14089,14460,14090,14459,14096,14452,14112,14431,14141,14388,14186,14305,14252,14130,14341,13941,14399,13756,14467,13585,14539,13430,14610,13272,14677,13026,14737,12808,14790,12617,14833,12449,14869,12303,14896,12065,14916,11845,14929,11655,14937,11490,14939,11347,14936,11184,14930,10970,14921,10783,14912,10621,14900,10480,14885,10356,14867,10247,14848,10062,14827,9894,14805,9745,14400,14208,14400,14206,14402,14198,14406,14174,14415,14122,14427,14035,14444,13913,14469,13767,14504,13613,14548,13463,14598,13324,14651,13082,14704,12858,14752,12658,14795,12483,14831,12330,14860,12106,14881,11875,14895,11675,14903,11501,14905,11351,14903,11178,14900,10953,14892,10757,14880,10589,14865,10442,14847,10313,14827,10162,14805,9965,14782,9792,14757,9642,14731,9507,14562,13883,14562,13883,14563,13877,14566,13862,14570,13830,14576,13773,14584,13689,14595,13582,14613,13461,14637,13336,14668,13120,14704,12897,14741,12695,14776,12516,14808,12358,14835,12150,14856,11910,14870,11701,14878,11519,14882,11361,14884,11187,14880,10951,14871,10748,14858,10572,14842,10418,14823,10286,14801,10099,14777,9897,14751,9722,14725,9567,14696,9430,14666,9309,14702,13604,14702,13604,14702,13600,14703,13591,14705,13570,14707,13533,14709,13477,14712,13400,14718,13305,14727,13106,14743,12907,14762,12716,14784,12539,14807,12380,14827,12190,14844,11943,14855,11727,14863,11539,14870,11376,14871,11204,14868,10960,14858,10748,14845,10565,14829,10406,14809,10269,14786,10058,14761,9852,14734,9671,14705,9512,14674,9374,14641,9253,14608,9076,14821,13366,14821,13365,14821,13364,14821,13358,14821,13344,14821,13320,14819,13252,14817,13145,14815,13011,14814,12858,14817,12698,14823,12539,14832,12389,14841,12214,14850,11968,14856,11750,14861,11558,14866,11390,14867,11226,14862,10972,14853,10754,14840,10565,14823,10401,14803,10259,14780,10032,14754,9820,14725,9635,14694,9473,14661,9333,14627,9203,14593,8988,14557,8798,14923,13014,14922,13014,14922,13012,14922,13004,14920,12987,14919,12957,14915,12907,14909,12834,14902,12738,14894,12623,14888,12498,14883,12370,14880,12203,14878,11970,14875,11759,14873,11569,14874,11401,14872,11243,14865,10986,14855,10762,14842,10568,14825,10401,14804,10255,14781,10017,14754,9799,14725,9611,14692,9445,14658,9301,14623,9139,14587,8920,14548,8729,14509,8562,15008,12672,15008,12672,15008,12671,15007,12667,15005,12656,15001,12637,14997,12605,14989,12556,14978,12490,14966,12407,14953,12313,14940,12136,14927,11934,14914,11742,14903,11563,14896,11401,14889,11247,14879,10992,14866,10767,14851,10570,14833,10400,14812,10252,14789,10007,14761,9784,14731,9592,14698,9424,14663,9279,14627,9088,14588,8868,14548,8676,14508,8508,14467,8360,15080,12386,15080,12386,15079,12385,15078,12383,15076,12378,15072,12367,15066,12347,15057,12315,15045,12253,15030,12138,15012,11998,14993,11845,14972,11685,14951,11530,14935,11383,14920,11228,14904,10981,14887,10762,14870,10567,14850,10397,14827,10248,14803,9997,14774,9771,14743,9578,14710,9407,14674,9259,14637,9048,14596,8826,14555,8632,14514,8464,14471,8317,14427,8182,15139,12008,15139,12008,15138,12008,15137,12007,15135,12003,15130,11990,15124,11969,15115,11929,15102,11872,15086,11794,15064,11693,15041,11581,15013,11459,14987,11336,14966,11170,14944,10944,14921,10738,14898,10552,14875,10387,14850,10239,14824,9983,14794,9758,14762,9563,14728,9392,14692,9244,14653,9014,14611,8791,14569,8597,14526,8427,14481,8281,14436,8110,14391,7885,15188,11617,15188,11617,15187,11617,15186,11618,15183,11617,15179,11612,15173,11601,15163,11581,15150,11546,15133,11495,15110,11427,15083,11346,15051,11246,15024,11057,14996,10868,14967,10687,14938,10517,14911,10362,14882,10206,14853,9956,14821,9737,14787,9543,14752,9375,14715,9228,14675,8980,14632,8760,14589,8565,14544,8395,14498,8248,14451,8049,14404,7824,14357,7630,15228,11298,15228,11298,15227,11299,15226,11301,15223,11303,15219,11302,15213,11299,15204,11290,15191,11271,15174,11217,15150,11129,15119,11015,15087,10886,15057,10744,15024,10599,14990,10455,14957,10318,14924,10143,14891,9911,14856,9701,14820,9516,14782,9352,14744,9200,14703,8946,14659,8725,14615,8533,14568,8366,14521,8220,14472,7992,14423,7770,14374,7578,14315,7408,15260,10819,15260,10819,15259,10822,15258,10826,15256,10832,15251,10836,15246,10841,15237,10838,15225,10821,15207,10788,15183,10734,15151,10660,15120,10571,15087,10469,15049,10359,15012,10249,14974,10041,14937,9837,14900,9647,14860,9475,14820,9320,14779,9147,14736,8902,14691,8688,14646,8499,14598,8335,14549,8189,14499,7940,14448,7720,14397,7529,14347,7363,14256,7218,15285,10410,15285,10411,15285,10413,15284,10418,15282,10425,15278,10434,15272,10442,15264,10449,15252,10445,15235,10433,15210,10403,15179,10358,15149,10301,15113,10218,15073,10059,15033,9894,14991,9726,14951,9565,14909,9413,14865,9273,14822,9073,14777,8845,14730,8641,14682,8459,14633,8300,14583,8129,14531,7883,14479,7670,14426,7482,14373,7321,14305,7176,14201,6939,15305,9939,15305,9940,15305,9945,15304,9955,15302,9967,15298,9989,15293,10010,15286,10033,15274,10044,15258,10045,15233,10022,15205,9975,15174,9903,15136,9808,15095,9697,15053,9578,15009,9451,14965,9327,14918,9198,14871,8973,14825,8766,14775,8579,14725,8408,14675,8259,14622,8058,14569,7821,14515,7615,14460,7435,14405,7276,14350,7108,14256,6866,14149,6653,15321,9444,15321,9445,15321,9448,15320,9458,15317,9470,15314,9490,15310,9515,15302,9540,15292,9562,15276,9579,15251,9577,15226,9559,15195,9519,15156,9463,15116,9389,15071,9304,15025,9208,14978,9023,14927,8838,14878,8661,14827,8496,14774,8344,14722,8206,14667,7973,14612,7749,14556,7555,14499,7382,14443,7229,14385,7025,14322,6791,14210,6588,14100,6409,15333,8920,15333,8921,15332,8927,15332,8943,15329,8965,15326,9002,15322,9048,15316,9106,15307,9162,15291,9204,15267,9221,15244,9221,15212,9196,15175,9134,15133,9043,15088,8930,15040,8801,14990,8665,14938,8526,14886,8391,14830,8261,14775,8087,14719,7866,14661,7664,14603,7482,14544,7322,14485,7178,14426,6936,14367,6713,14281,6517,14166,6348,14054,6198,15341,8360,15341,8361,15341,8366,15341,8379,15339,8399,15336,8431,15332,8473,15326,8527,15318,8585,15302,8632,15281,8670,15258,8690,15227,8690,15191,8664,15149,8612,15104,8543,15055,8456,15001,8360,14948,8259,14892,8122,14834,7923,14776,7734,14716,7558,14656,7397,14595,7250,14534,7070,14472,6835,14410,6628,14350,6443,14243,6283,14125,6135,14010,5889,15348,7715,15348,7717,15348,7725,15347,7745,15345,7780,15343,7836,15339,7905,15334,8e3,15326,8103,15310,8193,15293,8239,15270,8270,15240,8287,15204,8283,15163,8260,15118,8223,15067,8143,15014,8014,14958,7873,14899,7723,14839,7573,14778,7430,14715,7293,14652,7164,14588,6931,14524,6720,14460,6531,14396,6362,14330,6210,14207,6015,14086,5781,13969,5576,15352,7114,15352,7116,15352,7128,15352,7159,15350,7195,15348,7237,15345,7299,15340,7374,15332,7457,15317,7544,15301,7633,15280,7703,15251,7754,15216,7775,15176,7767,15131,7733,15079,7670,15026,7588,14967,7492,14906,7387,14844,7278,14779,7171,14714,6965,14648,6770,14581,6587,14515,6420,14448,6269,14382,6123,14299,5881,14172,5665,14049,5477,13929,5310,15355,6329,15355,6330,15355,6339,15355,6362,15353,6410,15351,6472,15349,6572,15344,6688,15337,6835,15323,6985,15309,7142,15287,7220,15260,7277,15226,7310,15188,7326,15142,7318,15090,7285,15036,7239,14976,7177,14914,7045,14849,6892,14782,6736,14714,6581,14645,6433,14576,6293,14506,6164,14438,5946,14369,5733,14270,5540,14140,5369,14014,5216,13892,5043,15357,5483,15357,5484,15357,5496,15357,5528,15356,5597,15354,5692,15351,5835,15347,6011,15339,6195,15328,6317,15314,6446,15293,6566,15268,6668,15235,6746,15197,6796,15152,6811,15101,6790,15046,6748,14985,6673,14921,6583,14854,6479,14785,6371,14714,6259,14643,6149,14571,5946,14499,5750,14428,5567,14358,5401,14242,5250,14109,5111,13980,4870,13856,4657,15359,4555,15359,4557,15358,4573,15358,4633,15357,4715,15355,4841,15353,5061,15349,5216,15342,5391,15331,5577,15318,5770,15299,5967,15274,6150,15243,6223,15206,6280,15161,6310,15111,6317,15055,6300,14994,6262,14928,6208,14860,6141,14788,5994,14715,5838,14641,5684,14566,5529,14492,5384,14418,5247,14346,5121,14216,4892,14079,4682,13948,4496,13822,4330,15359,3498,15359,3501,15359,3520,15359,3598,15358,3719,15356,3860,15355,4137,15351,4305,15344,4563,15334,4809,15321,5116,15303,5273,15280,5418,15250,5547,15214,5653,15170,5722,15120,5761,15064,5763,15002,5733,14935,5673,14865,5597,14792,5504,14716,5400,14640,5294,14563,5185,14486,5041,14410,4841,14335,4655,14191,4482,14051,4325,13918,4183,13790,4012,15360,2282,15360,2285,15360,2306,15360,2401,15359,2547,15357,2748,15355,3103,15352,3349,15345,3675,15336,4020,15324,4272,15307,4496,15285,4716,15255,4908,15220,5086,15178,5170,15128,5214,15072,5234,15010,5231,14943,5206,14871,5166,14796,5102,14718,4971,14639,4833,14559,4687,14480,4541,14402,4401,14315,4268,14167,4142,14025,3958,13888,3747,13759,3556,15360,923,15360,925,15360,946,15360,1052,15359,1214,15357,1494,15356,1892,15352,2274,15346,2663,15338,3099,15326,3393,15309,3679,15288,3980,15260,4183,15226,4325,15185,4437,15136,4517,15080,4570,15018,4591,14950,4581,14877,4545,14800,4485,14720,4411,14638,4325,14556,4231,14475,4136,14395,3988,14297,3803,14145,3628,13999,3465,13861,3314,13729,3177,15360,263,15360,264,15360,272,15360,325,15359,407,15358,548,15356,780,15352,1144,15347,1580,15339,2099,15328,2425,15312,2795,15292,3133,15264,3329,15232,3517,15191,3689,15143,3819,15088,3923,15025,3978,14956,3999,14882,3979,14804,3931,14722,3855,14639,3756,14554,3645,14470,3529,14388,3409,14279,3289,14124,3173,13975,3055,13834,2848,13701,2658,15360,49,15360,49,15360,52,15360,75,15359,111,15358,201,15356,283,15353,519,15348,726,15340,1045,15329,1415,15314,1795,15295,2173,15269,2410,15237,2649,15197,2866,15150,3054,15095,3140,15032,3196,14963,3228,14888,3236,14808,3224,14725,3191,14639,3146,14553,3088,14466,2976,14382,2836,14262,2692,14103,2549,13952,2409,13808,2278,13674,2154,15360,4,15360,4,15360,4,15360,13,15359,33,15358,59,15357,112,15353,199,15348,302,15341,456,15331,628,15316,827,15297,1082,15272,1332,15241,1601,15202,1851,15156,2069,15101,2172,15039,2256,14970,2314,14894,2348,14813,2358,14728,2344,14640,2311,14551,2263,14463,2203,14376,2133,14247,2059,14084,1915,13930,1761,13784,1609,13648,1464,15360,0,15360,0,15360,0,15360,3,15359,18,15358,26,15357,53,15354,80,15348,97,15341,165,15332,238,15318,326,15299,427,15275,529,15245,654,15207,771,15161,885,15108,994,15046,1089,14976,1170,14900,1229,14817,1266,14731,1284,14641,1282,14550,1260,14460,1223,14370,1174,14232,1116,14066,1050,13909,981,13761,910,13623,839]);let Xu=null;function E_e(){return Xu===null&&(Xu=new Aye(M_e,32,32,tO,Ix),Xu.minFilter=El,Xu.magFilter=El,Xu.wrapS=fd,Xu.wrapT=fd,Xu.generateMipmaps=!1,Xu.needsUpdate=!0),Xu}let j_e=class{constructor(e={}){const{canvas:n=Jxe(),context:r=null,depth:a=!0,stencil:s=!1,alpha:o=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const y=new Set([rO,nO,eO]),v=new Set([du,kf,v0,w0,ZL,JL]),x=new Uint32Array(4),g=new Int32Array(4);let _=null,N=null;const T=[],C=[];this.domElement=n,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.toneMapping=yh,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const A=this;let k=!1;this._outputColorSpace=Io;let R=0,P=0,D=null,H=-1,z=null;const G=new na,I=new na;let ee=null;const ie=new Zn(0);let X=0,me=n.width,he=n.height,ge=1,Y=null,oe=null;const le=new na(0,0,me,he),xe=new na(0,0,me,he);let Pe=!1;const q=new lO;let Z=!1,j=!1;const E=new sa,U=new Tt,K=new na,$={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ne=!1;function O(){return D===null?ge:1}let V=r;function J(se,He){return n.getContext(se,He)}try{const se={alpha:!0,depth:a,stencil:s,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:d,failIfMajorPerformanceCaveat:m};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${YL}`),n.addEventListener("webglcontextlost",$e,!1),n.addEventListener("webglcontextrestored",Ue,!1),n.addEventListener("webglcontextcreationerror",De,!1),V===null){const He="webgl2";if(V=J(He,se),V===null)throw J(He)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(se){throw se("WebGLRenderer: "+se.message),se}let W,re,ue,fe,ye,ae,L,F,te,ve,pe,de,Ne,Se,Le,qe,Ee,Te,Ae,Be,je,Xe,ce,Ie;function Ce(){W=new Uwe(V),W.init(),Xe=new S_e(V,W),re=new Ewe(V,W,e,Xe),ue=new v_e(V,W),re.reversedDepthBuffer&&p&&ue.buffers.depth.setReversed(!0),fe=new $we(V),ye=new o_e,ae=new w_e(V,W,ue,ye,re,Xe,fe),L=new Dwe(A),F=new zwe(A),te=new Wye(V),ce=new Pwe(V,te),ve=new Bwe(V,te,fe,ce),pe=new Vwe(V,ve,te,fe),Ae=new qwe(V,re,ae),qe=new jwe(ye),de=new s_e(A,L,F,W,re,ce,qe),Ne=new A_e(A,ye),Se=new c_e,Le=new f_e(W),Te=new Awe(A,L,F,ue,pe,f,c),Ee=new x_e(A,pe,re),Ie=new P_e(V,fe,re,ue),Be=new Mwe(V,W,fe),je=new Hwe(V,W,fe),fe.programs=de.programs,A.capabilities=re,A.extensions=W,A.properties=ye,A.renderLists=Se,A.shadowMap=Ee,A.state=ue,A.info=fe}Ce();const Ge=new C_e(A,V);this.xr=Ge,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const se=W.get("WEBGL_lose_context");se&&se.loseContext()},this.forceContextRestore=function(){const se=W.get("WEBGL_lose_context");se&&se.restoreContext()},this.getPixelRatio=function(){return ge},this.setPixelRatio=function(se){se!==void 0&&(ge=se,this.setSize(me,he,!1))},this.getSize=function(se){return se.set(me,he)},this.setSize=function(se,He,Ke=!0){if(Ge.isPresenting){Pn("WebGLRenderer: Can't change size while VR device is presenting.");return}me=se,he=He,n.width=Math.floor(se*ge),n.height=Math.floor(He*ge),Ke===!0&&(n.style.width=se+"px",n.style.height=He+"px"),this.setViewport(0,0,se,He)},this.getDrawingBufferSize=function(se){return se.set(me*ge,he*ge).floor()},this.setDrawingBufferSize=function(se,He,Ke){me=se,he=He,ge=Ke,n.width=Math.floor(se*Ke),n.height=Math.floor(He*Ke),this.setViewport(0,0,se,He)},this.getCurrentViewport=function(se){return se.copy(G)},this.getViewport=function(se){return se.copy(le)},this.setViewport=function(se,He,Ke,Ye){se.isVector4?le.set(se.x,se.y,se.z,se.w):le.set(se,He,Ke,Ye),ue.viewport(G.copy(le).multiplyScalar(ge).round())},this.getScissor=function(se){return se.copy(xe)},this.setScissor=function(se,He,Ke,Ye){se.isVector4?xe.set(se.x,se.y,se.z,se.w):xe.set(se,He,Ke,Ye),ue.scissor(I.copy(xe).multiplyScalar(ge).round())},this.getScissorTest=function(){return Pe},this.setScissorTest=function(se){ue.setScissorTest(Pe=se)},this.setOpaqueSort=function(se){Y=se},this.setTransparentSort=function(se){oe=se},this.getClearColor=function(se){return se.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor(...arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha(...arguments)},this.clear=function(se=!0,He=!0,Ke=!0){let Ye=0;if(se){let Me=!1;if(D!==null){const dt=D.texture.format;Me=y.has(dt)}if(Me){const dt=D.texture.type,ct=v.has(dt),nt=Te.getClearColor(),bt=Te.getClearAlpha(),Ut=nt.r,Et=nt.g,It=nt.b;ct?(x[0]=Ut,x[1]=Et,x[2]=It,x[3]=bt,V.clearBufferuiv(V.COLOR,0,x)):(g[0]=Ut,g[1]=Et,g[2]=It,g[3]=bt,V.clearBufferiv(V.COLOR,0,g))}else Ye|=V.COLOR_BUFFER_BIT}He&&(Ye|=V.DEPTH_BUFFER_BIT),Ke&&(Ye|=V.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),V.clear(Ye)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",$e,!1),n.removeEventListener("webglcontextrestored",Ue,!1),n.removeEventListener("webglcontextcreationerror",De,!1),Te.dispose(),Se.dispose(),Le.dispose(),ye.dispose(),L.dispose(),F.dispose(),pe.dispose(),ce.dispose(),Ie.dispose(),de.dispose(),Ge.dispose(),Ge.removeEventListener("sessionstart",yt),Ge.removeEventListener("sessionend",wt),_t.stop()};function $e(se){se.preventDefault(),o6("WebGLRenderer: Context Lost."),k=!0}function Ue(){o6("WebGLRenderer: Context Restored."),k=!1;const se=fe.autoReset,He=Ee.enabled,Ke=Ee.autoUpdate,Ye=Ee.needsUpdate,Me=Ee.type;Ce(),fe.autoReset=se,Ee.enabled=He,Ee.autoUpdate=Ke,Ee.needsUpdate=Ye,Ee.type=Me}function De(se){qi("WebGLRenderer: A WebGL context could not be created. Reason: ",se.statusMessage)}function Ve(se){const He=se.target;He.removeEventListener("dispose",Ve),it(He)}function it(se){xt(se),ye.remove(se)}function xt(se){const He=ye.get(se).programs;He!==void 0&&(He.forEach(function(Ke){de.releaseProgram(Ke)}),se.isShaderMaterial&&de.releaseShaderCache(se))}this.renderBufferDirect=function(se,He,Ke,Ye,Me,dt){He===null&&(He=$);const ct=Me.isMesh&&Me.matrixWorld.determinant()<0,nt=Fe(se,He,Ke,Ye,Me);ue.setMaterial(Ye,ct);let bt=Ke.index,Ut=1;if(Ye.wireframe===!0){if(bt=ve.getWireframeAttribute(Ke),bt===void 0)return;Ut=2}const Et=Ke.drawRange,It=Ke.attributes.position;let Zt=Et.start*Ut,tn=(Et.start+Et.count)*Ut;dt!==null&&(Zt=Math.max(Zt,dt.start*Ut),tn=Math.min(tn,(dt.start+dt.count)*Ut)),bt!==null?(Zt=Math.max(Zt,0),tn=Math.min(tn,bt.count)):It!=null&&(Zt=Math.max(Zt,0),tn=Math.min(tn,It.count));const yn=tn-Zt;if(yn<0||yn===1/0)return;ce.setup(Me,Ye,nt,Ke,bt);let _n,qn=Be;if(bt!==null&&(_n=te.get(bt),qn=je,qn.setIndex(_n)),Me.isMesh)Ye.wireframe===!0?(ue.setLineWidth(Ye.wireframeLinewidth*O()),qn.setMode(V.LINES)):qn.setMode(V.TRIANGLES);else if(Me.isLine){let sn=Ye.linewidth;sn===void 0&&(sn=1),ue.setLineWidth(sn*O()),Me.isLineSegments?qn.setMode(V.LINES):Me.isLineLoop?qn.setMode(V.LINE_LOOP):qn.setMode(V.LINE_STRIP)}else Me.isPoints?qn.setMode(V.POINTS):Me.isSprite&&qn.setMode(V.TRIANGLES);if(Me.isBatchedMesh)if(Me._multiDrawInstances!==null)N0("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),qn.renderMultiDrawInstances(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount,Me._multiDrawInstances);else if(W.get("WEBGL_multi_draw"))qn.renderMultiDraw(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount);else{const sn=Me._multiDrawStarts,Cn=Me._multiDrawCounts,gn=Me._multiDrawCount,Qr=bt?te.get(bt).bytesPerElement:1,Tn=ye.get(Ye).currentProgram.getUniforms();for(let hr=0;hr{function dt(){if(Ye.forEach(function(ct){ye.get(ct).currentProgram.isReady()&&Ye.delete(ct)}),Ye.size===0){Me(se);return}setTimeout(dt,10)}W.get("KHR_parallel_shader_compile")!==null?dt():setTimeout(dt,10)})};let kt=null;function We(se){kt&&kt(se)}function yt(){_t.stop()}function wt(){_t.start()}const _t=new qQ;_t.setAnimationLoop(We),typeof self<"u"&&_t.setContext(self),this.setAnimationLoop=function(se){kt=se,Ge.setAnimationLoop(se),se===null?_t.stop():_t.start()},Ge.addEventListener("sessionstart",yt),Ge.addEventListener("sessionend",wt),this.render=function(se,He){if(He!==void 0&&He.isCamera!==!0){qi("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(k===!0)return;if(se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),He.parent===null&&He.matrixWorldAutoUpdate===!0&&He.updateMatrixWorld(),Ge.enabled===!0&&Ge.isPresenting===!0&&(Ge.cameraAutoUpdate===!0&&Ge.updateCamera(He),He=Ge.getCamera()),se.isScene===!0&&se.onBeforeRender(A,se,He,D),N=Le.get(se,C.length),N.init(He),C.push(N),E.multiplyMatrices(He.projectionMatrix,He.matrixWorldInverse),q.setFromProjectionMatrix(E,eu,He.reversedDepth),j=this.localClippingEnabled,Z=qe.init(this.clippingPlanes,j),_=Se.get(se,T.length),_.init(),T.push(_),Ge.enabled===!0&&Ge.isPresenting===!0){const dt=A.xr.getDepthSensingMesh();dt!==null&&Ot(dt,He,-1/0,A.sortObjects)}Ot(se,He,0,A.sortObjects),_.finish(),A.sortObjects===!0&&_.sort(Y,oe),ne=Ge.enabled===!1||Ge.isPresenting===!1||Ge.hasDepthSensing()===!1,ne&&Te.addToRenderList(_,se),this.info.render.frame++,Z===!0&&qe.beginShadows();const Ke=N.state.shadowsArray;Ee.render(Ke,se,He),Z===!0&&qe.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ye=_.opaque,Me=_.transmissive;if(N.setupLights(),He.isArrayCamera){const dt=He.cameras;if(Me.length>0)for(let ct=0,nt=dt.length;ct0&&Xt(Ye,Me,se,He),ne&&Te.render(se),Vt(_,se,He);D!==null&&P===0&&(ae.updateMultisampleRenderTarget(D),ae.updateRenderTargetMipmap(D)),se.isScene===!0&&se.onAfterRender(A,se,He),ce.resetDefaultState(),H=-1,z=null,C.pop(),C.length>0?(N=C[C.length-1],Z===!0&&qe.setGlobalState(A.clippingPlanes,N.state.camera)):N=null,T.pop(),T.length>0?_=T[T.length-1]:_=null};function Ot(se,He,Ke,Ye){if(se.visible===!1)return;if(se.layers.test(He.layers)){if(se.isGroup)Ke=se.renderOrder;else if(se.isLOD)se.autoUpdate===!0&&se.update(He);else if(se.isLight)N.pushLight(se),se.castShadow&&N.pushShadow(se);else if(se.isSprite){if(!se.frustumCulled||q.intersectsSprite(se)){Ye&&K.setFromMatrixPosition(se.matrixWorld).applyMatrix4(E);const ct=pe.update(se),nt=se.material;nt.visible&&_.push(se,ct,nt,Ke,K.z,null)}}else if((se.isMesh||se.isLine||se.isPoints)&&(!se.frustumCulled||q.intersectsObject(se))){const ct=pe.update(se),nt=se.material;if(Ye&&(se.boundingSphere!==void 0?(se.boundingSphere===null&&se.computeBoundingSphere(),K.copy(se.boundingSphere.center)):(ct.boundingSphere===null&&ct.computeBoundingSphere(),K.copy(ct.boundingSphere.center)),K.applyMatrix4(se.matrixWorld).applyMatrix4(E)),Array.isArray(nt)){const bt=ct.groups;for(let Ut=0,Et=bt.length;Ut0&&Qe(Me,He,Ke),dt.length>0&&Qe(dt,He,Ke),ct.length>0&&Qe(ct,He,Ke),ue.buffers.depth.setTest(!0),ue.buffers.depth.setMask(!0),ue.buffers.color.setMask(!0),ue.setPolygonOffset(!1)}function Xt(se,He,Ke,Ye){if((Ke.isScene===!0?Ke.overrideMaterial:null)!==null)return;N.state.transmissionRenderTarget[Ye.id]===void 0&&(N.state.transmissionRenderTarget[Ye.id]=new Tf(1,1,{generateMipmaps:!0,type:W.has("EXT_color_buffer_half_float")||W.has("EXT_color_buffer_float")?Ix:du,minFilter:$p,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xr.workingColorSpace}));const dt=N.state.transmissionRenderTarget[Ye.id],ct=Ye.viewport||G;dt.setSize(ct.z*A.transmissionResolutionScale,ct.w*A.transmissionResolutionScale);const nt=A.getRenderTarget(),bt=A.getActiveCubeFace(),Ut=A.getActiveMipmapLevel();A.setRenderTarget(dt),A.getClearColor(ie),X=A.getClearAlpha(),X<1&&A.setClearColor(16777215,.5),A.clear(),ne&&Te.render(Ke);const Et=A.toneMapping;A.toneMapping=yh;const It=Ye.viewport;if(Ye.viewport!==void 0&&(Ye.viewport=void 0),N.setupLightsView(Ye),Z===!0&&qe.setGlobalState(A.clippingPlanes,Ye),Qe(se,Ke,Ye),ae.updateMultisampleRenderTarget(dt),ae.updateRenderTargetMipmap(dt),W.has("WEBGL_multisampled_render_to_texture")===!1){let Zt=!1;for(let tn=0,yn=He.length;tn0),It=!!Ke.morphAttributes.position,Zt=!!Ke.morphAttributes.normal,tn=!!Ke.morphAttributes.color;let yn=yh;Ye.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=A.toneMapping);const _n=Ke.morphAttributes.position||Ke.morphAttributes.normal||Ke.morphAttributes.color,qn=_n!==void 0?_n.length:0,sn=ye.get(Ye),Cn=N.state.lights;if(Z===!0&&(j===!0||se!==z)){const li=se===z&&Ye.id===H;qe.setState(Ye,se,li)}let gn=!1;Ye.version===sn.__version?(sn.needsLights&&sn.lightsStateVersion!==Cn.state.version||sn.outputColorSpace!==nt||Me.isBatchedMesh&&sn.batching===!1||!Me.isBatchedMesh&&sn.batching===!0||Me.isBatchedMesh&&sn.batchingColor===!0&&Me.colorTexture===null||Me.isBatchedMesh&&sn.batchingColor===!1&&Me.colorTexture!==null||Me.isInstancedMesh&&sn.instancing===!1||!Me.isInstancedMesh&&sn.instancing===!0||Me.isSkinnedMesh&&sn.skinning===!1||!Me.isSkinnedMesh&&sn.skinning===!0||Me.isInstancedMesh&&sn.instancingColor===!0&&Me.instanceColor===null||Me.isInstancedMesh&&sn.instancingColor===!1&&Me.instanceColor!==null||Me.isInstancedMesh&&sn.instancingMorph===!0&&Me.morphTexture===null||Me.isInstancedMesh&&sn.instancingMorph===!1&&Me.morphTexture!==null||sn.envMap!==bt||Ye.fog===!0&&sn.fog!==dt||sn.numClippingPlanes!==void 0&&(sn.numClippingPlanes!==qe.numPlanes||sn.numIntersection!==qe.numIntersection)||sn.vertexAlphas!==Ut||sn.vertexTangents!==Et||sn.morphTargets!==It||sn.morphNormals!==Zt||sn.morphColors!==tn||sn.toneMapping!==yn||sn.morphTargetsCount!==qn)&&(gn=!0):(gn=!0,sn.__version=Ye.version);let Qr=sn.currentProgram;gn===!0&&(Qr=hn(Ye,He,Me));let Tn=!1,hr=!1,_a=!1;const On=Qr.getUniforms(),$r=sn.uniforms;if(ue.useProgram(Qr.program)&&(Tn=!0,hr=!0,_a=!0),Ye.id!==H&&(H=Ye.id,hr=!0),Tn||z!==se){ue.buffers.depth.getReversed()&&se.reversedDepth!==!0&&(se._reversedDepth=!0,se.updateProjectionMatrix()),On.setValue(V,"projectionMatrix",se.projectionMatrix),On.setValue(V,"viewMatrix",se.matrixWorldInverse);const _i=On.map.cameraPosition;_i!==void 0&&_i.setValue(V,U.setFromMatrixPosition(se.matrixWorld)),re.logarithmicDepthBuffer&&On.setValue(V,"logDepthBufFC",2/(Math.log(se.far+1)/Math.LN2)),(Ye.isMeshPhongMaterial||Ye.isMeshToonMaterial||Ye.isMeshLambertMaterial||Ye.isMeshBasicMaterial||Ye.isMeshStandardMaterial||Ye.isShaderMaterial)&&On.setValue(V,"isOrthographic",se.isOrthographicCamera===!0),z!==se&&(z=se,hr=!0,_a=!0)}if(Me.isSkinnedMesh){On.setOptional(V,Me,"bindMatrix"),On.setOptional(V,Me,"bindMatrixInverse");const li=Me.skeleton;li&&(li.boneTexture===null&&li.computeBoneTexture(),On.setValue(V,"boneTexture",li.boneTexture,ae))}Me.isBatchedMesh&&(On.setOptional(V,Me,"batchingTexture"),On.setValue(V,"batchingTexture",Me._matricesTexture,ae),On.setOptional(V,Me,"batchingIdTexture"),On.setValue(V,"batchingIdTexture",Me._indirectTexture,ae),On.setOptional(V,Me,"batchingColorTexture"),Me._colorsTexture!==null&&On.setValue(V,"batchingColorTexture",Me._colorsTexture,ae));const cr=Ke.morphAttributes;if((cr.position!==void 0||cr.normal!==void 0||cr.color!==void 0)&&Ae.update(Me,Ke,Qr),(hr||sn.receiveShadow!==Me.receiveShadow)&&(sn.receiveShadow=Me.receiveShadow,On.setValue(V,"receiveShadow",Me.receiveShadow)),Ye.isMeshGouraudMaterial&&Ye.envMap!==null&&($r.envMap.value=bt,$r.flipEnvMap.value=bt.isCubeTexture&&bt.isRenderTargetTexture===!1?-1:1),Ye.isMeshStandardMaterial&&Ye.envMap===null&&He.environment!==null&&($r.envMapIntensity.value=He.environmentIntensity),$r.dfgLUT!==void 0&&($r.dfgLUT.value=E_e()),hr&&(On.setValue(V,"toneMappingExposure",A.toneMappingExposure),sn.needsLights&&tt($r,_a),dt&&Ye.fog===!0&&Ne.refreshFogUniforms($r,dt),Ne.refreshMaterialUniforms($r,Ye,ge,he,N.state.transmissionRenderTarget[se.id]),rN.upload(V,jn(sn),$r,ae)),Ye.isShaderMaterial&&Ye.uniformsNeedUpdate===!0&&(rN.upload(V,jn(sn),$r,ae),Ye.uniformsNeedUpdate=!1),Ye.isSpriteMaterial&&On.setValue(V,"center",Me.center),On.setValue(V,"modelViewMatrix",Me.modelViewMatrix),On.setValue(V,"normalMatrix",Me.normalMatrix),On.setValue(V,"modelMatrix",Me.matrixWorld),Ye.isShaderMaterial||Ye.isRawShaderMaterial){const li=Ye.uniformsGroups;for(let _i=0,Tr=li.length;_i0&&ae.useMultisampledRTT(se)===!1?Me=ye.get(se).__webglMultisampledFramebuffer:Array.isArray(Et)?Me=Et[Ke]:Me=Et,G.copy(se.viewport),I.copy(se.scissor),ee=se.scissorTest}else G.copy(le).multiplyScalar(ge).floor(),I.copy(xe).multiplyScalar(ge).floor(),ee=Pe;if(Ke!==0&&(Me=Ze),ue.bindFramebuffer(V.FRAMEBUFFER,Me)&&Ye&&ue.drawBuffers(se,Me),ue.viewport(G),ue.scissor(I),ue.setScissorTest(ee),dt){const bt=ye.get(se.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+He,bt.__webglTexture,Ke)}else if(ct){const bt=He;for(let Ut=0;Ut=0&&He<=se.width-Ye&&Ke>=0&&Ke<=se.height-Me&&(se.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+nt),V.readPixels(He,Ke,Ye,Me,Xe.convert(Et),Xe.convert(It),dt))}finally{const Ut=D!==null?ye.get(D).__webglFramebuffer:null;ue.bindFramebuffer(V.FRAMEBUFFER,Ut)}}},this.readRenderTargetPixelsAsync=async function(se,He,Ke,Ye,Me,dt,ct,nt=0){if(!(se&&se.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let bt=ye.get(se).__webglFramebuffer;if(se.isWebGLCubeRenderTarget&&ct!==void 0&&(bt=bt[ct]),bt)if(He>=0&&He<=se.width-Ye&&Ke>=0&&Ke<=se.height-Me){ue.bindFramebuffer(V.FRAMEBUFFER,bt);const Ut=se.textures[nt],Et=Ut.format,It=Ut.type;if(!re.textureFormatReadable(Et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!re.textureTypeReadable(It))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Zt=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,Zt),V.bufferData(V.PIXEL_PACK_BUFFER,dt.byteLength,V.STREAM_READ),se.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+nt),V.readPixels(He,Ke,Ye,Me,Xe.convert(Et),Xe.convert(It),0);const tn=D!==null?ye.get(D).__webglFramebuffer:null;ue.bindFramebuffer(V.FRAMEBUFFER,tn);const yn=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);return V.flush(),await eye(V,yn,4),V.bindBuffer(V.PIXEL_PACK_BUFFER,Zt),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,dt),V.deleteBuffer(Zt),V.deleteSync(yn),dt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(se,He=null,Ke=0){const Ye=Math.pow(2,-Ke),Me=Math.floor(se.image.width*Ye),dt=Math.floor(se.image.height*Ye),ct=He!==null?He.x:0,nt=He!==null?He.y:0;ae.setTexture2D(se,0),V.copyTexSubImage2D(V.TEXTURE_2D,Ke,0,0,ct,nt,Me,dt),ue.unbindTexture()};const ke=V.createFramebuffer(),ot=V.createFramebuffer();this.copyTextureToTexture=function(se,He,Ke=null,Ye=null,Me=0,dt=null){dt===null&&(Me!==0?(N0("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),dt=Me,Me=0):dt=0);let ct,nt,bt,Ut,Et,It,Zt,tn,yn;const _n=se.isCompressedTexture?se.mipmaps[dt]:se.image;if(Ke!==null)ct=Ke.max.x-Ke.min.x,nt=Ke.max.y-Ke.min.y,bt=Ke.isBox3?Ke.max.z-Ke.min.z:1,Ut=Ke.min.x,Et=Ke.min.y,It=Ke.isBox3?Ke.min.z:0;else{const cr=Math.pow(2,-Me);ct=Math.floor(_n.width*cr),nt=Math.floor(_n.height*cr),se.isDataArrayTexture?bt=_n.depth:se.isData3DTexture?bt=Math.floor(_n.depth*cr):bt=1,Ut=0,Et=0,It=0}Ye!==null?(Zt=Ye.x,tn=Ye.y,yn=Ye.z):(Zt=0,tn=0,yn=0);const qn=Xe.convert(He.format),sn=Xe.convert(He.type);let Cn;He.isData3DTexture?(ae.setTexture3D(He,0),Cn=V.TEXTURE_3D):He.isDataArrayTexture||He.isCompressedArrayTexture?(ae.setTexture2DArray(He,0),Cn=V.TEXTURE_2D_ARRAY):(ae.setTexture2D(He,0),Cn=V.TEXTURE_2D),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,He.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,He.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,He.unpackAlignment);const gn=V.getParameter(V.UNPACK_ROW_LENGTH),Qr=V.getParameter(V.UNPACK_IMAGE_HEIGHT),Tn=V.getParameter(V.UNPACK_SKIP_PIXELS),hr=V.getParameter(V.UNPACK_SKIP_ROWS),_a=V.getParameter(V.UNPACK_SKIP_IMAGES);V.pixelStorei(V.UNPACK_ROW_LENGTH,_n.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,_n.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,Ut),V.pixelStorei(V.UNPACK_SKIP_ROWS,Et),V.pixelStorei(V.UNPACK_SKIP_IMAGES,It);const On=se.isDataArrayTexture||se.isData3DTexture,$r=He.isDataArrayTexture||He.isData3DTexture;if(se.isDepthTexture){const cr=ye.get(se),li=ye.get(He),_i=ye.get(cr.__renderTarget),Tr=ye.get(li.__renderTarget);ue.bindFramebuffer(V.READ_FRAMEBUFFER,_i.__webglFramebuffer),ue.bindFramebuffer(V.DRAW_FRAMEBUFFER,Tr.__webglFramebuffer);for(let zi=0;ziMath.PI&&(r-=ro),a<-Math.PI?a+=ro:a>Math.PI&&(a-=ro),r<=a?this._spherical.theta=Math.max(r,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+a)/2?Math.max(r,this._spherical.theta):Math.min(a,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ua.setFromSpherical(this._spherical),ua.applyQuaternion(this._quatInverse),n.copy(this.target).add(ua),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const l=ua.length();o=this._clampDistance(l*this._scale);const c=l-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const l=new Tt(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const u=new Tt(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(l),this.object.updateMatrixWorld(),o=ua.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(P_.origin.copy(this.object.position),P_.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(P_.direction))wE||8*(1-this._lastQuaternion.dot(this.object.quaternion))>wE||this._lastTargetPosition.distanceToSquared(this.target)>wE?(this.dispatchEvent(rH),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ro/60*this.autoRotateSpeed*e:ro/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){ua.setFromMatrixColumn(n,0),ua.multiplyScalar(-e),this._panOffset.add(ua)}_panUp(e,n){this.screenSpacePanning===!0?ua.setFromMatrixColumn(n,1):(ua.setFromMatrixColumn(n,0),ua.crossVectors(this.object.up,ua)),ua.multiplyScalar(e),this._panOffset.add(ua)}_pan(e,n){const r=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;ua.copy(a).sub(this.target);let s=ua.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*n*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),a=e-r.left,s=n-r.top,o=r.width,l=r.height;this._mouse.x=a/o*2-1,this._mouse.y=-(s/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(ro*this._rotateDelta.x/n.clientHeight),this._rotateUp(ro*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ro*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._rotateStart.set(r,a)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._panStart.set(r,a)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),r=e.pageX-n.x,a=e.pageY-n.y,s=Math.sqrt(r*r+a*a);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),a=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(a,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(ro*this._rotateDelta.x/n.clientHeight),this._rotateUp(ro*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._panEnd.set(r,a)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),r=e.pageX-n.x,a=e.pageY-n.y,s=Math.sqrt(r*r+a*a);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+n.x)*.5,l=(e.pageY+n.y)*.5;this._updateZoomParameters(o,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n>5&31)/31,y=(ie>>10&31)/31):(p=g,f=_,y=N)}for(let ie=1;ie<=3;ie++){const X=z+ie*12,me=H*3*3+(ie-1)*3;R[me]=d.getFloat32(X,!0),R[me+1]=d.getFloat32(X+4,!0),R[me+2]=d.getFloat32(X+8,!0),P[me]=G,P[me+1]=I,P[me+2]=ee,v&&(D.setRGB(p,f,y,Io),x[me]=D.r,x[me+1]=D.g,x[me+2]=D.b)}}return k.setAttribute("position",new Us(R,3)),k.setAttribute("normal",new Us(P,3)),v&&(k.setAttribute("color",new Us(x,3)),k.hasColors=!0,k.alpha=T),k}function s(u){const d=new Ul,m=/solid([\s\S]*?)endsolid/g,p=/facet([\s\S]*?)endfacet/g,f=/solid\s(.+)/;let y=0;const v=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,x=new RegExp("vertex"+v+v+v,"g"),g=new RegExp("normal"+v+v+v,"g"),_=[],N=[],T=[],C=new Tt;let A,k=0,R=0,P=0;for(;(A=m.exec(u))!==null;){R=P;const D=A[0],H=(A=f.exec(D))!==null?A[1]:"";for(T.push(H);(A=p.exec(D))!==null;){let I=0,ee=0;const ie=A[0];for(;(A=g.exec(ie))!==null;)C.x=parseFloat(A[1]),C.y=parseFloat(A[2]),C.z=parseFloat(A[3]),ee++;for(;(A=x.exec(ie))!==null;)_.push(parseFloat(A[1]),parseFloat(A[2]),parseFloat(A[3])),N.push(C.x,C.y,C.z),I++,P++;ee!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+y),I!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+y),y++}const z=R,G=P-R;d.userData.groupNames=T,d.addGroup(z,G,k),k++}return d.setAttribute("position",new qo(_,3)),d.setAttribute("normal",new qo(N,3)),d}function o(u){return typeof u!="string"?new TextDecoder().decode(u):u}function l(u){if(typeof u=="string"){const d=new Uint8Array(u.length);for(let m=0;m>2,f=(3&u)<<4|d>>4,y=1>6:64,v=2>4,d=(15&p)<<4|(f=l.indexOf(c.charAt(v++)))>>2,m=(3&f)<<6|(y=l.indexOf(c.charAt(v++))),_[x++]=u,f!==64&&(_[x++]=d),y!==64&&(_[x++]=m);return _}},{"./support":30,"./utils":32}],2:[function(n,r,a){var s=n("./external"),o=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,m,p,f,y){this.compressedSize=d,this.uncompressedSize=m,this.crc32=p,this.compression=f,this.compressedContent=y}u.prototype={getContentWorker:function(){var d=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),m=this;return d.on("end",function(){if(this.streamInfo.data_length!==m.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,m,p){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(m.compressWorker(p)).pipe(new c("compressedSize")).withStreamInfo("compression",m)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,a){var s=n("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},a.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,a){var s=n("./utils"),o=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,m,p){var f=o,y=p+m;u^=-1;for(var v=p;v>>8^f[255&(u^d[v])];return-1^u})(0|c,l,l.length,0):(function(u,d,m,p){var f=o,y=p+m;u^=-1;for(var v=p;v>>8^f[255&(u^d.charCodeAt(v))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(n,r,a){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,a){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(m,p){c.call(this,"FlateWorker/"+m),this._pako=null,this._pakoAction=m,this._pakoOptions=p,this.meta={}}a.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(m){this.meta=m.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,m.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var m=this;this._pako.onData=function(p){m.push({data:p,meta:m.meta})}},a.compressWorker=function(m){return new d("Deflate",m)},a.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,a){function s(f,y){var v,x="";for(v=0;v>>=8;return x}function o(f,y,v,x,g,_){var N,T,C=f.file,A=f.compression,k=_!==u.utf8encode,R=l.transformTo("string",_(C.name)),P=l.transformTo("string",u.utf8encode(C.name)),D=C.comment,H=l.transformTo("string",_(D)),z=l.transformTo("string",u.utf8encode(D)),G=P.length!==C.name.length,I=z.length!==D.length,ee="",ie="",X="",me=C.dir,he=C.date,ge={crc32:0,compressedSize:0,uncompressedSize:0};y&&!v||(ge.crc32=f.crc32,ge.compressedSize=f.compressedSize,ge.uncompressedSize=f.uncompressedSize);var Y=0;y&&(Y|=8),k||!G&&!I||(Y|=2048);var oe=0,le=0;me&&(oe|=16),g==="UNIX"?(le=798,oe|=(function(Pe,q){var Z=Pe;return Pe||(Z=q?16893:33204),(65535&Z)<<16})(C.unixPermissions,me)):(le=20,oe|=(function(Pe){return 63&(Pe||0)})(C.dosPermissions)),N=he.getUTCHours(),N<<=6,N|=he.getUTCMinutes(),N<<=5,N|=he.getUTCSeconds()/2,T=he.getUTCFullYear()-1980,T<<=4,T|=he.getUTCMonth()+1,T<<=5,T|=he.getUTCDate(),G&&(ie=s(1,1)+s(d(R),4)+P,ee+="up"+s(ie.length,2)+ie),I&&(X=s(1,1)+s(d(H),4)+z,ee+="uc"+s(X.length,2)+X);var xe="";return xe+=`
\0`,xe+=s(Y,2),xe+=A.magic,xe+=s(N,2),xe+=s(T,2),xe+=s(ge.crc32,4),xe+=s(ge.compressedSize,4),xe+=s(ge.uncompressedSize,4),xe+=s(R.length,2),xe+=s(ee.length,2),{fileRecord:m.LOCAL_FILE_HEADER+xe+R+ee,dirRecord:m.CENTRAL_FILE_HEADER+s(le,2)+xe+s(H.length,2)+"\0\0\0\0"+s(oe,4)+s(x,4)+R+ee+H}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),m=n("../signature");function p(f,y,v,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=v,this.encodeFileName=x,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(p,c),p.prototype.push=function(f){var y=f.meta.percent||0,v=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:v?(y+100*(v-x-1))/v:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var y=this.streamFiles&&!f.file.dir;if(y){var v=o(f,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var y=this.streamFiles&&!f.file.dir,v=o(f,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),y)this.push({data:(function(x){return m.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,y=0;y=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=o},{"../utils":32}],19:[function(n,r,a){var s=n("./Uint8ArrayReader");function o(l){s.call(this,l)}n("../utils").inherits(o,s),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,a){var s=n("./DataReader");function o(l){s.call(this,l)}n("../utils").inherits(o,s),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(n,r,a){var s=n("./ArrayReader");function o(l){s.call(this,l)}n("../utils").inherits(o,s),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,a){var s=n("../utils"),o=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(m){var p=s.getTypeOf(m);return s.checkSupport(p),p!=="string"||o.uint8array?p==="nodebuffer"?new u(m):o.uint8array?new d(s.transformTo("uint8array",m)):new l(s.transformTo("array",m)):new c(m)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,a){var s=n("./GenericWorker"),o=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,a){var s=n("./GenericWorker"),o=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,a){var s=n("../utils"),o=n("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,a){var s=n("../utils"),o=n("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,a){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c "+o:o}},r.exports=s},{}],29:[function(n,r,a){var s=n("../utils"),o=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),m=null;if(u.nodestream)try{m=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(y,v){return new d.Promise(function(x,g){var _=[],N=y._internalType,T=y._outputType,C=y._mimeType;y.on("data",function(A,k){_.push(A),v&&v(k)}).on("error",function(A){_=[],g(A)}).on("end",function(){try{var A=(function(k,R,P){switch(k){case"blob":return s.newBlob(s.transformTo("arraybuffer",R),P);case"base64":return c.encode(R);default:return s.transformTo(k,R)}})(T,(function(k,R){var P,D=0,H=null,z=0;for(P=0;P"u")a.blob=!1;else{var s=new ArrayBuffer(0);try{a.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),a.blob=o.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!n("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,a){for(var s=n("./utils"),o=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function m(){c.call(this,"utf-8 decode"),this.leftOver=null}function p(){c.call(this,"utf-8 encode")}a.utf8encode=function(f){return o.nodebuffer?l.newBufferFrom(f,"utf-8"):(function(y){var v,x,g,_,N,T=y.length,C=0;for(_=0;_>>6:(x<65536?v[N++]=224|x>>>12:(v[N++]=240|x>>>18,v[N++]=128|x>>>12&63),v[N++]=128|x>>>6&63),v[N++]=128|63&x);return v})(f)},a.utf8decode=function(f){return o.nodebuffer?s.transformTo("nodebuffer",f).toString("utf-8"):(function(y){var v,x,g,_,N=y.length,T=new Array(2*N);for(v=x=0;v>10&1023,T[x++]=56320|1023&g)}return T.length!==x&&(T.subarray?T=T.subarray(0,x):T.length=x),s.applyFromCharCode(T)})(f=s.transformTo(o.uint8array?"uint8array":"array",f))},s.inherits(m,c),m.prototype.processChunk=function(f){var y=s.transformTo(o.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var v=y;(y=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),y.set(v,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var x=(function(_,N){var T;for((N=N||_.length)>_.length&&(N=_.length),T=N-1;0<=T&&(192&_[T])==128;)T--;return T<0||T===0?N:T+u[_[T]]>N?T:N})(y),g=y;x!==y.length&&(o.uint8array?(g=y.subarray(0,x),this.leftOver=y.subarray(x,y.length)):(g=y.slice(0,x),this.leftOver=y.slice(x,y.length))),this.push({data:a.utf8decode(g),meta:f.meta})},m.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=m,s.inherits(p,c),p.prototype.processChunk=function(f){this.push({data:a.utf8encode(f.data),meta:f.meta})},a.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,a){var s=n("./support"),o=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(v){return v}function d(v,x){for(var g=0;g>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var y,v,x,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?p[x++]=224|f>>>12:(p[x++]=240|f>>>18,p[x++]=128|f>>>12&63),p[x++]=128|f>>>6&63),p[x++]=128|63&f);return p},a.buf2binstring=function(m){return d(m,m.length)},a.binstring2buf=function(m){for(var p=new s.Buf8(m.length),f=0,y=p.length;f>10&1023,_[y++]=56320|1023&v)}return d(_,y)},a.utf8border=function(m,p){var f;for((p=p||m.length)>m.length&&(p=m.length),f=p-1;0<=f&&(192&m[f])==128;)f--;return f<0||f===0?p:f+c[m[f]]>p?f:p}},{"./common":41}],43:[function(n,r,a){r.exports=function(s,o,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,m=0;l!==0;){for(l-=m=2e3>>1:o>>>1;l[c]=o}return l})();r.exports=function(o,l,c,u){var d=s,m=u+c;o^=-1;for(var p=u;p>>8^d[255&(o^l[p])];return-1^o}},{}],46:[function(n,r,a){var s,o=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),m=0,p=4,f=0,y=-2,v=-1,x=4,g=2,_=8,N=9,T=286,C=30,A=19,k=2*T+1,R=15,P=3,D=258,H=D+P+1,z=42,G=113,I=1,ee=2,ie=3,X=4;function me(O,V){return O.msg=d[V],V}function he(O){return(O<<1)-(4O.avail_out&&(J=O.avail_out),J!==0&&(o.arraySet(O.output,V.pending_buf,V.pending_out,J,O.next_out),O.next_out+=J,V.pending_out+=J,O.total_out+=J,O.avail_out-=J,V.pending-=J,V.pending===0&&(V.pending_out=0))}function oe(O,V){l._tr_flush_block(O,0<=O.block_start?O.block_start:-1,O.strstart-O.block_start,V),O.block_start=O.strstart,Y(O.strm)}function le(O,V){O.pending_buf[O.pending++]=V}function xe(O,V){O.pending_buf[O.pending++]=V>>>8&255,O.pending_buf[O.pending++]=255&V}function Pe(O,V){var J,W,re=O.max_chain_length,ue=O.strstart,fe=O.prev_length,ye=O.nice_match,ae=O.strstart>O.w_size-H?O.strstart-(O.w_size-H):0,L=O.window,F=O.w_mask,te=O.prev,ve=O.strstart+D,pe=L[ue+fe-1],de=L[ue+fe];O.prev_length>=O.good_match&&(re>>=2),ye>O.lookahead&&(ye=O.lookahead);do if(L[(J=V)+fe]===de&&L[J+fe-1]===pe&&L[J]===L[ue]&&L[++J]===L[ue+1]){ue+=2,J++;do;while(L[++ue]===L[++J]&&L[++ue]===L[++J]&&L[++ue]===L[++J]&&L[++ue]===L[++J]&&L[++ue]===L[++J]&&L[++ue]===L[++J]&&L[++ue]===L[++J]&&L[++ue]===L[++J]&&ueae&&--re!=0);return fe<=O.lookahead?fe:O.lookahead}function q(O){var V,J,W,re,ue,fe,ye,ae,L,F,te=O.w_size;do{if(re=O.window_size-O.lookahead-O.strstart,O.strstart>=te+(te-H)){for(o.arraySet(O.window,O.window,te,te,0),O.match_start-=te,O.strstart-=te,O.block_start-=te,V=J=O.hash_size;W=O.head[--V],O.head[V]=te<=W?W-te:0,--J;);for(V=J=te;W=O.prev[--V],O.prev[V]=te<=W?W-te:0,--J;);re+=te}if(O.strm.avail_in===0)break;if(fe=O.strm,ye=O.window,ae=O.strstart+O.lookahead,L=re,F=void 0,F=fe.avail_in,L=P)for(ue=O.strstart-O.insert,O.ins_h=O.window[ue],O.ins_h=(O.ins_h<=P&&(O.ins_h=(O.ins_h<=P)if(W=l._tr_tally(O,O.strstart-O.match_start,O.match_length-P),O.lookahead-=O.match_length,O.match_length<=O.max_lazy_match&&O.lookahead>=P){for(O.match_length--;O.strstart++,O.ins_h=(O.ins_h<=P&&(O.ins_h=(O.ins_h<=P&&O.match_length<=O.prev_length){for(re=O.strstart+O.lookahead-P,W=l._tr_tally(O,O.strstart-1-O.prev_match,O.prev_length-P),O.lookahead-=O.prev_length-1,O.prev_length-=2;++O.strstart<=re&&(O.ins_h=(O.ins_h<O.pending_buf_size-5&&(J=O.pending_buf_size-5);;){if(O.lookahead<=1){if(q(O),O.lookahead===0&&V===m)return I;if(O.lookahead===0)break}O.strstart+=O.lookahead,O.lookahead=0;var W=O.block_start+J;if((O.strstart===0||O.strstart>=W)&&(O.lookahead=O.strstart-W,O.strstart=W,oe(O,!1),O.strm.avail_out===0)||O.strstart-O.block_start>=O.w_size-H&&(oe(O,!1),O.strm.avail_out===0))return I}return O.insert=0,V===p?(oe(O,!0),O.strm.avail_out===0?ie:X):(O.strstart>O.block_start&&(oe(O,!1),O.strm.avail_out),I)}),new E(4,4,8,4,Z),new E(4,5,16,8,Z),new E(4,6,32,32,Z),new E(4,4,16,16,j),new E(8,16,32,32,j),new E(8,16,128,128,j),new E(8,32,128,256,j),new E(32,128,258,1024,j),new E(32,258,258,4096,j)],a.deflateInit=function(O,V){return ne(O,V,_,15,8,0)},a.deflateInit2=ne,a.deflateReset=$,a.deflateResetKeep=K,a.deflateSetHeader=function(O,V){return O&&O.state?O.state.wrap!==2?y:(O.state.gzhead=V,f):y},a.deflate=function(O,V){var J,W,re,ue;if(!O||!O.state||5>8&255),le(W,W.gzhead.time>>16&255),le(W,W.gzhead.time>>24&255),le(W,W.level===9?2:2<=W.strategy||W.level<2?4:0),le(W,255&W.gzhead.os),W.gzhead.extra&&W.gzhead.extra.length&&(le(W,255&W.gzhead.extra.length),le(W,W.gzhead.extra.length>>8&255)),W.gzhead.hcrc&&(O.adler=u(O.adler,W.pending_buf,W.pending,0)),W.gzindex=0,W.status=69):(le(W,0),le(W,0),le(W,0),le(W,0),le(W,0),le(W,W.level===9?2:2<=W.strategy||W.level<2?4:0),le(W,3),W.status=G);else{var fe=_+(W.w_bits-8<<4)<<8;fe|=(2<=W.strategy||W.level<2?0:W.level<6?1:W.level===6?2:3)<<6,W.strstart!==0&&(fe|=32),fe+=31-fe%31,W.status=G,xe(W,fe),W.strstart!==0&&(xe(W,O.adler>>>16),xe(W,65535&O.adler)),O.adler=1}if(W.status===69)if(W.gzhead.extra){for(re=W.pending;W.gzindex<(65535&W.gzhead.extra.length)&&(W.pending!==W.pending_buf_size||(W.gzhead.hcrc&&W.pending>re&&(O.adler=u(O.adler,W.pending_buf,W.pending-re,re)),Y(O),re=W.pending,W.pending!==W.pending_buf_size));)le(W,255&W.gzhead.extra[W.gzindex]),W.gzindex++;W.gzhead.hcrc&&W.pending>re&&(O.adler=u(O.adler,W.pending_buf,W.pending-re,re)),W.gzindex===W.gzhead.extra.length&&(W.gzindex=0,W.status=73)}else W.status=73;if(W.status===73)if(W.gzhead.name){re=W.pending;do{if(W.pending===W.pending_buf_size&&(W.gzhead.hcrc&&W.pending>re&&(O.adler=u(O.adler,W.pending_buf,W.pending-re,re)),Y(O),re=W.pending,W.pending===W.pending_buf_size)){ue=1;break}ue=W.gzindexre&&(O.adler=u(O.adler,W.pending_buf,W.pending-re,re)),ue===0&&(W.gzindex=0,W.status=91)}else W.status=91;if(W.status===91)if(W.gzhead.comment){re=W.pending;do{if(W.pending===W.pending_buf_size&&(W.gzhead.hcrc&&W.pending>re&&(O.adler=u(O.adler,W.pending_buf,W.pending-re,re)),Y(O),re=W.pending,W.pending===W.pending_buf_size)){ue=1;break}ue=W.gzindexre&&(O.adler=u(O.adler,W.pending_buf,W.pending-re,re)),ue===0&&(W.status=103)}else W.status=103;if(W.status===103&&(W.gzhead.hcrc?(W.pending+2>W.pending_buf_size&&Y(O),W.pending+2<=W.pending_buf_size&&(le(W,255&O.adler),le(W,O.adler>>8&255),O.adler=0,W.status=G)):W.status=G),W.pending!==0){if(Y(O),O.avail_out===0)return W.last_flush=-1,f}else if(O.avail_in===0&&he(V)<=he(J)&&V!==p)return me(O,-5);if(W.status===666&&O.avail_in!==0)return me(O,-5);if(O.avail_in!==0||W.lookahead!==0||V!==m&&W.status!==666){var ye=W.strategy===2?(function(ae,L){for(var F;;){if(ae.lookahead===0&&(q(ae),ae.lookahead===0)){if(L===m)return I;break}if(ae.match_length=0,F=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++,F&&(oe(ae,!1),ae.strm.avail_out===0))return I}return ae.insert=0,L===p?(oe(ae,!0),ae.strm.avail_out===0?ie:X):ae.last_lit&&(oe(ae,!1),ae.strm.avail_out===0)?I:ee})(W,V):W.strategy===3?(function(ae,L){for(var F,te,ve,pe,de=ae.window;;){if(ae.lookahead<=D){if(q(ae),ae.lookahead<=D&&L===m)return I;if(ae.lookahead===0)break}if(ae.match_length=0,ae.lookahead>=P&&0ae.lookahead&&(ae.match_length=ae.lookahead)}if(ae.match_length>=P?(F=l._tr_tally(ae,1,ae.match_length-P),ae.lookahead-=ae.match_length,ae.strstart+=ae.match_length,ae.match_length=0):(F=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++),F&&(oe(ae,!1),ae.strm.avail_out===0))return I}return ae.insert=0,L===p?(oe(ae,!0),ae.strm.avail_out===0?ie:X):ae.last_lit&&(oe(ae,!1),ae.strm.avail_out===0)?I:ee})(W,V):s[W.level].func(W,V);if(ye!==ie&&ye!==X||(W.status=666),ye===I||ye===ie)return O.avail_out===0&&(W.last_flush=-1),f;if(ye===ee&&(V===1?l._tr_align(W):V!==5&&(l._tr_stored_block(W,0,0,!1),V===3&&(ge(W.head),W.lookahead===0&&(W.strstart=0,W.block_start=0,W.insert=0))),Y(O),O.avail_out===0))return W.last_flush=-1,f}return V!==p?f:W.wrap<=0?1:(W.wrap===2?(le(W,255&O.adler),le(W,O.adler>>8&255),le(W,O.adler>>16&255),le(W,O.adler>>24&255),le(W,255&O.total_in),le(W,O.total_in>>8&255),le(W,O.total_in>>16&255),le(W,O.total_in>>24&255)):(xe(W,O.adler>>>16),xe(W,65535&O.adler)),Y(O),0=J.w_size&&(ue===0&&(ge(J.head),J.strstart=0,J.block_start=0,J.insert=0),L=new o.Buf8(J.w_size),o.arraySet(L,V,F-J.w_size,J.w_size,0),V=L,F=J.w_size),fe=O.avail_in,ye=O.next_in,ae=O.input,O.avail_in=F,O.next_in=0,O.input=V,q(J);J.lookahead>=P;){for(W=J.strstart,re=J.lookahead-(P-1);J.ins_h=(J.ins_h<>>=P=R>>>24,N-=P,(P=R>>>16&255)===0)ee[d++]=65535&R;else{if(!(16&P)){if((64&P)==0){R=T[(65535&R)+(_&(1<>>=P,N-=P),N<15&&(_+=I[c++]<>>=P=R>>>24,N-=P,!(16&(P=R>>>16&255))){if((64&P)==0){R=C[(65535&R)+(_&(1<>>=P,N-=P,(P=d-m)