@rings-webgpu/core 1.0.45 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rings.umd.js CHANGED
@@ -5787,13 +5787,15 @@ struct InstanceData {
5787
5787
  }
5788
5788
 
5789
5789
  // === calcSplatUV() - returns optional UV ===
5790
- fn calcSplatUV(orderId: u32, textureWidth: u32, numSplats: u32) -> vec2<i32> {
5790
+ fn getSplatId(orderId: u32, textureWidth: u32, numSplats: u32) -> u32 {
5791
5791
  let orderUV = vec2<i32>(
5792
5792
  i32(orderId % textureWidth),
5793
5793
  i32(orderId / textureWidth)
5794
5794
  );
5795
5795
 
5796
- let splatId = textureLoad(splatOrder, orderUV, 0).r;
5796
+ return u32(textureLoad(splatOrder, orderUV, 0).r);
5797
+ }
5798
+ fn calcSplatUV(splatId: u32, textureWidth: u32, numSplats: u32) -> vec2<i32> {
5797
5799
  return vec2<i32>(
5798
5800
  i32(splatId % textureWidth),
5799
5801
  i32(splatId / textureWidth)
@@ -5892,9 +5894,11 @@ struct InstanceData {
5892
5894
  if (orderId >= numSplats) {
5893
5895
  return discardSplat();
5894
5896
  }
5897
+
5898
+ let splatId = getSplatId(orderId, textureWidth, numSplats);
5895
5899
 
5896
5900
  // Calculate splat UV and load all data in one go
5897
- let splatUV = calcSplatUV(orderId, textureWidth, numSplats);
5901
+ let splatUV = calcSplatUV(splatId, textureWidth, numSplats);
5898
5902
  let splatData = getSplatData(splatUV);
5899
5903
 
5900
5904
  // Load color early for alpha test
@@ -7915,7 +7919,7 @@ else if (typeof exports === 'object')
7915
7919
  `;class Ff{compute;constructor(){this.compute=new Se(xf)}generateBRDFLUTTexture(){let e=new Ie(256,256,le.rgba8unorm,!1,GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING);this.compute.setStorageTexture("brdflutTexture",e),this.compute.workerSizeX=256/8,this.compute.workerSizeY=256/8;let t=E.beginCommandEncoder();return E.computeCommand(t,[this.compute]),E.endCommandEncoder(t),e}}class ai{id;guiTexture;uvRec=new ue(0,0,1,1);uvBorder=new ue(0,0,0,0);offsetSize=new ue(0,0,4,4);borderSize=new ue(0,0,0,0);trimSize=new fe;isSliced=!1;height=4;width=4;xadvance=0;xoffset=0;yoffset=0;constructor(e){this.guiTexture=e||B.res.defaultGUITexture}}class mr{static _maxUid=-1;_staticId=-1;dynamicId=-1;texture;width=1;height=1;get staticId(){return this._staticId}constructor(e){e||=B.res.whiteTexture,e.addressModeU="clamp-to-edge",e.addressModeV="clamp-to-edge",this.texture=e,mr._maxUid++,this._staticId=mr._maxUid,this.init()}init(){this.dynamicId=-1,this.width=this.texture.width,this.height=this.texture.height}}class tb{fntCache={};fntData={};addFontData(e,t,a){this.fntData[`${e}${t}`]=a}getFontData(e,t){return this.fntData[`${e}${t}`]}addFnt(e,t,a,r){let i=`${e}${t}`;this.fntCache[i]||(this.fntCache[i]={}),this.fntCache[i][a]=r}getFnt(e,t,a){let r=`${e}${t}`,i=this.fntCache[r];return i?i[a]:this.fntCache[" "]}}let ri=new tb;class kf{face="";size=0;bold=!1;italic=!1;stretchH=0;spacing="";outline=0;lineHeight=0;base=0;scaleW=0;scaleH=0;pages=0;packed=0;alphaChnl=0;redChnl=0;greenChnl=0;blueChnl=0;count=0;fontPage=[];fontChar={};constructor(){}}class Ef{id=0;file=""}class wf{id=-1;x=0;y=0;width=0;height=0;xoffset=0;yoffset=0;xadvance=0;page=0;chnl=0}class tr extends rt{static format=Je.TEXT;static parseSprite(e,t){for(const a in t.fontChar)if(Object.prototype.hasOwnProperty.call(t.fontChar,a)){const r=t.fontChar[a];let i=new ai;i.id=r.id.toString(),i.offsetSize.set(0,0,r.width,r.height),i.trimSize.set(r.width,r.height),i.width=r.width,i.height=r.height,i.xadvance=r.xadvance,i.xoffset=r.xoffset,i.yoffset=r.yoffset,i.guiTexture=e[r.page],i.uvRec.set(r.x/t.scaleW,(t.scaleH-(r.y+r.height))/t.scaleH,r.width/t.scaleW,r.height/t.scaleH),ri.addFnt(t.face,t.size,i.id,i)}}verification(){if(this.data)return!0;throw new Error("Method not implemented.")}async parseString(e){let t=this.getNewLine(e),a=e,r=new kf;a.trim().split(t).forEach((i,s)=>{if(s<2)tr.readLineProperty(i,r);else if(s<r.pages+2){let o=new Ef;tr.readLineProperty(i,o),r.fontPage.push(o)}else if(s<r.pages+3)tr.readLineProperty(i,r);else if(r.count>0){let o=new wf;tr.readLineProperty(i,o),r.fontChar[o.id]=o,r.count--}}),a="",this.data=r,await this.loadFontTextures()}getNewLine(e){return e.indexOf(`\r
7916
7920
  `)!=-1?`\r
7917
7921
  `:e.indexOf("\r")!=-1?"\r":`
7918
- `}async loadFontTextures(){let e=[],t=this.data;for(const a of t.fontPage){let r=this.baseUrl+a.file;await B.res.loadTexture(r,null,!0);let i=B.res.getTexture(r),s=new mr(i);e.push(s)}tr.parseSprite(e,t),t.fontChar[" "]||tr.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new ai,r=e.size*.5,i=e.lineHeight*.5;a.id=" ",a.offsetSize.set(0,0,e.size,e.size),a.trimSize.set(r,i),a.width=r,a.height=i,a.xadvance=0,a.xoffset=0,a.yoffset=0,a.guiTexture=t,a.uvRec.set(0,0,1e-6,1e-6),ri.addFnt(e.face,e.size,a.id,a)}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let s=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,s)&&(o.indexOf('"')==-1?t[s]=parseFloat(i[1]):t[s]=o.replace('"',"").replace('"',""))}})}}function ab(n,e){let t=new ai;return t.id=n,t.offsetSize.set(0,0,e.width,e.height),t.trimSize.set(e.width,e.height),t.width=e.width,t.height=e.height,t.xadvance=0,t.xoffset=0,t.yoffset=0,t.guiTexture=new mr(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function Rf(n,e,t){let a=new ai;a.guiTexture=n,a.id=e,a.uvRec.copyFrom(t.textureRect),a.trimSize.x=t.textureRect.z,a.trimSize.y=t.textureRect.w,a.offsetSize.x=t.textureRectOffset.x,a.offsetSize.y=t.textureRectOffset.y,a.offsetSize.z=t.size.x,a.offsetSize.w=t.size.y,a.width=t.size.x,a.height=t.size.y;let r=1/n.width,i=1/n.height;a.uvRec.set(a.uvRec.x*r,a.uvRec.y*i,a.uvRec.z*r,a.uvRec.w*i);let s=.1;return t.border.x<=s&&t.border.y<=s&&t.border.z<=s&&t.border.x<=s?a.isSliced=!1:(a.borderSize.copyFrom(t.border),a.uvBorder.copyFrom(t.border),a.uvBorder.x-=t.textureRectOffset.x,a.uvBorder.y-=t.textureRectOffset.y,a.uvBorder.z=t.border.z-(t.size.x-t.textureRect.z-t.textureRectOffset.x),a.uvBorder.w=t.border.w-(t.size.y-t.textureRect.w-t.textureRectOffset.y),a.uvBorder.x/=t.textureRect.z,a.uvBorder.z/=t.textureRect.z,a.uvBorder.y/=t.textureRect.w,a.uvBorder.w/=t.textureRect.w,a.isSliced=!0),a}class If{_spriteMap=new Map;_spriteList=[];textureSize=new fe;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=Rf(e,t,a);return this._spriteMap.set(r.id,r),this._spriteList.push(r),r}getSprite(e){return this._spriteMap.get(e)}get spriteList(){return this._spriteList}}class Tf extends rt{static format=Je.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await B.res.loadTexture(t,null,!0),this.data={json:this._json,texture:this._texture},this.parseAtlas()}verification(){if(this.data)return!0;throw new Error("verify failed.")}parseAtlas(){let e=new If(this._json.size),t=new mr(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);B.res.addAtlas(this.baseUrl,e),this.data=e}}var $t=Uint8Array,ii=Uint16Array,rb=Int32Array,Qf=new $t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Mf=new $t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ib=new $t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pf=function(n,e){for(var t=new ii(31),a=0;a<31;++a)t[a]=e+=1<<n[a-1];for(var r=new rb(t[30]),a=1;a<30;++a)for(var i=t[a];i<t[a+1];++i)r[i]=i-t[a]<<5|a;return{b:t,r}},Nf=Pf(Qf,2),Vf=Nf.b,sb=Nf.r;Vf[28]=258,sb[258]=28;for(var nb=Pf(Mf,0),ob=nb.b,oo=new ii(32768),Xe=0;Xe<32768;++Xe){var pr=(Xe&43690)>>1|(Xe&21845)<<1;pr=(pr&52428)>>2|(pr&13107)<<2,pr=(pr&61680)>>4|(pr&3855)<<4,oo[Xe]=((pr&65280)>>8|(pr&255)<<8)>>1}for(var Ti=(function(n,e,t){for(var a=n.length,r=0,i=new ii(e);r<a;++r)n[r]&&++i[n[r]-1];var s=new ii(e);for(r=1;r<e;++r)s[r]=s[r-1]+i[r-1]<<1;var o;if(t){o=new ii(1<<e);var l=15-e;for(r=0;r<a;++r)if(n[r])for(var c=r<<4|n[r],f=e-n[r],h=s[n[r]-1]++<<f,u=h|(1<<f)-1;h<=u;++h)o[oo[h]>>l]=c}else for(o=new ii(a),r=0;r<a;++r)n[r]&&(o[r]=oo[s[n[r]-1]++]>>15-n[r]);return o}),Qi=new $t(288),Xe=0;Xe<144;++Xe)Qi[Xe]=8;for(var Xe=144;Xe<256;++Xe)Qi[Xe]=9;for(var Xe=256;Xe<280;++Xe)Qi[Xe]=7;for(var Xe=280;Xe<288;++Xe)Qi[Xe]=8;for(var Of=new $t(32),Xe=0;Xe<32;++Xe)Of[Xe]=5;var lb=Ti(Qi,9,1),cb=Ti(Of,5,1),lo=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},Ua=function(n,e,t){var a=e/8|0;return(n[a]|n[a+1]<<8)>>(e&7)&t},co=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},fb=function(n){return(n+7)/8|0},fo=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new $t(n.subarray(e,t))},db=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ca=function(n,e,t){var a=new Error(e||db[n]);if(a.code=n,Error.captureStackTrace&&Error.captureStackTrace(a,ca),!t)throw a;return a},hb=function(n,e,t,a){var r=n.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new $t(0);var s=!t,o=s||e.i!=2,l=e.i;s&&(t=new $t(r*3));var c=function(ie){var ce=t.length;if(ie>ce){var ge=new $t(Math.max(ce*2,ie));ge.set(t),t=ge}},f=e.f||0,h=e.p||0,u=e.b||0,b=e.l,A=e.d,m=e.m,p=e.n,D=r*8;do{if(!b){f=Ua(n,h,1);var _=Ua(n,h+1,3);if(h+=3,_)if(_==1)b=lb,A=cb,m=9,p=5;else if(_==2){var S=Ua(n,h,31)+257,F=Ua(n,h+10,15)+4,k=S+Ua(n,h+5,31)+1;h+=14;for(var x=new $t(k),w=new $t(19),R=0;R<F;++R)w[ib[R]]=Ua(n,h+R*3,7);h+=F*3;for(var Q=lo(w),M=(1<<Q)-1,j=Ti(w,Q,1),R=0;R<k;){var he=j[Ua(n,h,M)];h+=he&15;var v=he>>4;if(v<16)x[R++]=v;else{var ae=0,P=0;for(v==16?(P=3+Ua(n,h,3),h+=2,ae=x[R-1]):v==17?(P=3+Ua(n,h,7),h+=3):v==18&&(P=11+Ua(n,h,127),h+=7);P--;)x[R++]=ae}}var z=x.subarray(0,S),W=x.subarray(S);m=lo(z),p=lo(W),b=Ti(z,m,1),A=Ti(W,p,1)}else ca(1);else{var v=fb(h)+4,U=n[v-4]|n[v-3]<<8,y=v+U;if(y>r){l&&ca(0);break}o&&c(u+U),t.set(n.subarray(v,y),u),e.b=u+=U,e.p=h=y*8,e.f=f;continue}if(h>D){l&&ca(0);break}}o&&c(u+131072);for(var V=(1<<m)-1,te=(1<<p)-1,J=h;;J=h){var ae=b[co(n,h)&V],K=ae>>4;if(h+=ae&15,h>D){l&&ca(0);break}if(ae||ca(2),K<256)t[u++]=K;else if(K==256){J=h,b=null;break}else{var ee=K-254;if(K>264){var R=K-257,re=Qf[R];ee=Ua(n,h,(1<<re)-1)+Vf[R],h+=re}var oe=A[co(n,h)&te],pe=oe>>4;oe||ca(3),h+=oe&15;var W=ob[pe];if(pe>3){var re=Mf[pe];W+=co(n,h)&(1<<re)-1,h+=re}if(h>D){l&&ca(0);break}o&&c(u+131072);var Te=u+ee;if(u<W){var Oe=i-W,q=Math.min(W,Te);for(Oe+u<0&&ca(3);u<q;++u)t[u]=a[Oe+u]}for(;u<Te;++u)t[u]=t[u-W]}}e.l=b,e.p=J,e.b=u,e.f=f,b&&(f=1,e.m=m,e.d=A,e.n=p)}while(!f);return u!=t.length&&s?fo(t,0,u):t.subarray(0,u)},ub=new $t(0),Pa=function(n,e){return n[e]|n[e+1]<<8},ya=function(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},ho=function(n,e){return ya(n,e)+ya(n,e+4)*4294967296};function bb(n,e){return hb(n,{i:2},e&&e.out,e&&e.dictionary)}var uo=typeof TextDecoder<"u"&&new TextDecoder,gb=0;try{uo.decode(ub,{stream:!0}),gb=1}catch{}var mb=function(n){for(var e="",t=0;;){var a=n[t++],r=(a>127)+(a>223)+(a>239);if(t+r>n.length)return{s:e,r:fo(n,t-1)};r?r==3?(a=((a&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):r&1?e+=String.fromCharCode((a&31)<<6|n[t++]&63):e+=String.fromCharCode((a&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(a)}};function Lf(n,e){if(e){for(var t="",a=0;a<n.length;a+=16384)t+=String.fromCharCode.apply(null,n.subarray(a,a+16384));return t}else{if(uo)return uo.decode(n);var r=mb(n),i=r.s,t=r.r;return t.length&&ca(8),i}}var pb=function(n,e){return e+30+Pa(n,e+26)+Pa(n,e+28)},Ab=function(n,e,t){var a=Pa(n,e+28),r=Lf(n.subarray(e+46,e+46+a),!(Pa(n,e+8)&2048)),i=e+46+a,s=ya(n,e+20),o=t&&s==4294967295?Db(n,i):[s,ya(n,e+24),ya(n,e+42)],l=o[0],c=o[1],f=o[2];return[Pa(n,e+10),l,c,r,i+Pa(n,e+30)+Pa(n,e+32),f]},Db=function(n,e){for(;Pa(n,e)!=1;e+=4+Pa(n,e+2));return[ho(n,e+12),ho(n,e+4),ho(n,e+20)]};function _b(n,e){for(var t={},a=n.length-22;ya(n,a)!=101010256;--a)(!a||n.length-a>65558)&&ca(13);var r=Pa(n,a+8);if(!r)return{};var i=ya(n,a+16),s=i==4294967295||r==65535;if(s){var o=ya(n,a-12);s=ya(n,o)==101075792,s&&(r=ya(n,o+32),i=ya(n,o+48))}for(var l=0;l<r;++l){var c=Ab(n,i,s),f=c[0],h=c[1],u=c[2],b=c[3],A=c[4],m=c[5],p=pb(n,m);i=A,f?f==8?t[b]=bb(n.subarray(p,p+h),{out:new $t(u)}):ca(14,"unknown compression type "+f):t[b]=fo(n,p,p+h)}return t}class Bt extends Dt{constructor(){super(),this.shader=new d.UnLitShader,this.baseMap=B.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Ir extends Ve{shape_vertices=[];shape_indices=[];radius;widthSegments;heightSegments;phiStart;phiLength;thetaStart;thetaLength;constructor(e,t,a,r,i,s,o){super(),this.radius=e,this.widthSegments=t,this.heightSegments=a,this.phiStart=r,this.phiLength=i,this.thetaStart=s,this.thetaLength=o,this.buildGeometry()}buildGeometry(){var e,t,a=0;let r=this.heightSegments,i=this.widthSegments,s=this.radius;var o=(r+1)*(i+1);let l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),h=new Uint16Array(i*r*2*3),u=0,b=0,A=0;for(t=0;t<=r;++t){var m=Math.PI*t/r,p=s*Math.cos(m),D=s*Math.sin(m);for(e=0;e<=i;++e){var _=2*Math.PI*e/i,v=D*Math.cos(_),U=D*Math.sin(_),y=1/Math.sqrt(v*v+p*p+U*U);if(l[u++]=v,l[u++]=p,l[u++]=U,c[b++]=v*y,c[b++]=p*y,c[b++]=U*y,f[A++]=e/i,f[A++]=t/r,e>0&&t>0){var S=(i+1)*t+e,F=(i+1)*t+e-1,k=(i+1)*(t-1)+e-1,x=(i+1)*(t-1)+e;t==r?(h[a++]=S,h[a++]=k,h[a++]=x):t==1?(h[a++]=S,h[a++]=F,h[a++]=k):(h[a++]=S,h[a++]=F,h[a++]=k,h[a++]=S,h[a++]=k,h[a++]=x)}}}this.setIndices(h),this.setAttribute(G.position,l),this.setAttribute(G.normal,c),this.setAttribute(G.uv,f),this.setAttribute(G.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:h.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new Ce(g.ZERO,new g(this.radius*2,this.radius*2,this.radius*2))}}class Mi extends d.Object3D{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new g(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),Mi.register3DRepresentation)this.marker=Mi.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new d.Object3D;const e=this.marker.addComponent(d.MeshRenderer);e.geometry=new Ir(.1,32,16),e.material=new Bt,e.material.baseColor=this.positionValid?new Z(0,1,0,1):new Z(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class Pi extends d.Object3D{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new Mi(t);this.addChild(a)}this.entityChildren=this.entityChildren.sort((t,a)=>t.positionIndex-a.positionIndex)}setup3DRepresentation(){this.line&&(this.removeChild(this.line),this.line=null),Pi.register3DRepresentation?(this.line=Pi.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new Z(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Ve,r=new Float32Array(e.length*3);for(let c=0;c<e.length;c++)r[c*3]=e[c].x,r[c*3+1]=e[c].y,r[c*3+2]=e[c].z;const i=new Uint16Array((e.length-1)*2);for(let c=0;c<e.length-1;c++)i[c*2]=c,i[c*2+1]=c+1;a.setIndices(i),a.setAttribute(G.position,r),a.addSubGeometry({indexStart:0,indexCount:i.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});const s=new d.Object3D,o=s.addComponent(d.MeshRenderer),l=new Bt;return l.topology="line-list",l.baseColor=t,l.blendMode=Ae.ADD,l.castReflection=!1,o.geometry=a,o.material=l,s}}class Gf extends rt{static format=Je.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=_b(new Uint8Array(e));for(const i in a){const s=a[i],l=new DOMParser().parseFromString(Lf(s),"application/xml"),c={};this.parseNode(l,c);const f=i.replace("wpmz/","").split(".")[0];Object.assign(t,{[f]:c["#document"].kml.Document})}const r=new Pi(t.waylines);this.data=r}catch(t){this.parserError(`KMZ parsing failed: ${t}`,-1)}}parseNode(e,t){const a=["Placemark","actionGroup","action"],r=e.nodeName.replace("wpml:","");if(!e.childNodes.length)t[r]=void 0;else{let i=null,s=!1;for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];if(l.nodeType==Node.TEXT_NODE){const c=l.nodeValue?.trim();c&&c.length>0&&(i=c)}else l.nodeType==Node.ELEMENT_NODE&&(s=!0)}if(i&&!s)t[r]=i;else if(s){a.includes(r)?t[r]?.length?t[r].push({}):t[r]=[{}]:t[r]={};for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];l.nodeType==Node.ELEMENT_NODE&&this.parseNode(l,Array.isArray(t[r])?t[r].at(-1):t[r])}}else t[r]=void 0}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class zf{_texturePool;_materialPool;_prefabPool;_gltfPool;_geometryPool;_atlasList;_obj;constructor(){this._texturePool=new Map,this._materialPool=new Map,this._prefabPool=new Map,this._geometryPool=new Map,this._gltfPool=new Map,this._atlasList=new Map,this._obj=new Map}getGltf(e){return this._gltfPool.get(e)}addObj(e,t){this._obj.set(e,t)}getObj(e){return this._obj.get(e)}addTexture(e,t){this._texturePool.set(e,t)}getTexture(e){return this._texturePool.get(e)}addGeometry(e,t){this._geometryPool.set(e,t)}getGeometry(e){return this._geometryPool.get(e)}addMat(e,t){return this._materialPool.set(e,t)}getMat(e){return this._materialPool.get(e)}addPrefab(e,t){this._prefabPool.set(e,t)}getPrefab(e){return this._prefabPool.get(e).instantiate()}addAtlas(e,t){t.name=e,this._atlasList.set(e,t)}getAtlas(e){return this._atlasList.get(e)}getGUISprite(e){for(let t of this._atlasList.values()){let a=t.getSprite(e);if(a)return a}return null}async load(e,t,a){return(await new Tt().load(e,t,a)).data}async loadGltf(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new Tt;r==".gltf"?a=await i.load(e,_t,t):a=await i.load(e,Hn,t);let s=a.data;return this._prefabPool.set(e,s),this._gltfPool.set(e,a.gltf),s}async loadObj(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new Tt;r==".obj"&&(a=await i.load(e,wi,t));let s=a.data;return this._prefabPool.set(e,s),s}async loadB3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let s=(await new Tt().load(e,ro,t,a)).data;return this._prefabPool.set(e,s),s}async loadI3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let s=(await new Tt().load(e,no,t,a)).data;return this._prefabPool.set(e,s),s}async loadTexture(e,t,a){if(this._texturePool.has(e))return this._texturePool.get(e);let r=new $a;r.flipY=a;try{await r.load(e,t)}catch(i){return console.error(`Failed to load texture: ${e}`,i),null}return this._texturePool.set(e,r),r}destroyTexture(e){const t=this._texturePool.get(e);return t?xe.getInstance().hasReference(t)?!1:(t.isDestroyed||t.destroy(),this._texturePool.delete(e),!0):!1}destroyTextureAllUnUsed(){for(const[e,t]of this._texturePool.entries())this.destroyTexture(e)}async loadTextureCount(e,t,a,r){return new Promise(async(i,s)=>{let o=0,l=[];t==0&&i(l);for(let c=0;c<t;c++){const f=e.shift();this.loadTexture(f,a,r).then(h=>{l.push(h),o++,o==t&&i(l)})}})}async loadBitmapTextures(e,t=5,a,r){let i=[],s=Math.floor(e.length/t)+1,o=Math.floor(e.length%t);for(let l=0;l<s;l++){let c=await this.loadTextureCount(e,l==s-1?o:t,a,r);i.push(...c)}return i}async loadHDRTexture(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new $n;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadHDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new xs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadLDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new ks;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadTextureCubeMaps(e){let t=e[0];if(this._texturePool.has(t))return this._texturePool.get(t);let a=new Kn;return await a.load(e),this._texturePool.set(e[0],a),a}async loadTextureCubeStd(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Kn;return await a.loadStd(e),a}async loadJSON(e,t){return await new Tt().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new Tt().load(e,tr,t,a),s=i.data;return ri.addFontData(s.face,s.size,s),i.data}async loadAtlas(e,t){return(await new Tt().load(e,Tf,t,e)).data}async loadKMZ(e,t){return(await new Tt().load(e,Gf,t)).data}normalTexture;maskTexture;whiteTexture;blackTexture;redTexture;blueTexture;greenTexture;yellowTexture;grayTexture;defaultSky;defaultGUITexture;defaultGUISprite;defaultMaterial;createTexture(e,t,a,r,i,s,o){let l=32,c=32,f=new Uint8Array(l*c*4);this.fillColor(f,e,t,a,r,i,s);let h=new Si;return h.name=o,h.create(16,16,f,!0),o&&this.addTexture(o,h),h}fillColor(e,t,a,r,i,s,o){for(let l=0;l<t;l++)for(let c=0;c<a;c++){let f=c*t+l;e[f*4+0]=r,e[f*4+1]=i,e[f*4+2]=s,e[f*4+3]=o}}initDefault(){this.normalTexture=this.createTexture(32,32,255*.5,255*.5,255,255,"default-normalTexture"),this.maskTexture=this.createTexture(32,32,255,255*.5,255,255,"default-maskTexture"),this.whiteTexture=this.createTexture(32,32,255,255,255,255,"default-whiteTexture"),this.blackTexture=this.createTexture(32,32,0,0,0,255,"default-blackTexture"),this.redTexture=this.createTexture(32,32,255,0,0,255,"default-redTexture"),this.blueTexture=this.createTexture(32,32,0,0,255,255,"default-blueTexture"),this.greenTexture=this.createTexture(32,32,0,255,0,255,"default-greenTexture"),this.yellowTexture=this.createTexture(32,32,0,255,255,255,"default-yellowTexture"),this.grayTexture=this.createTexture(32,32,128,128,128,255,"default-grayTexture");let t=new Ff().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new xs,this.defaultSky.createFromTexture(128,this.blackTexture),xe.getInstance().attached(this.defaultSky,this),xe.getInstance().attached(t,this),xe.getInstance().attached(this.normalTexture,this),xe.getInstance().attached(this.maskTexture,this),xe.getInstance().attached(this.whiteTexture,this),xe.getInstance().attached(this.blackTexture,this),xe.getInstance().attached(this.redTexture,this),xe.getInstance().attached(this.blueTexture,this),xe.getInstance().attached(this.greenTexture,this),xe.getInstance().attached(this.yellowTexture,this),xe.getInstance().attached(this.grayTexture,this),this.defaultGUITexture=new mr(this.whiteTexture),this.defaultGUISprite=new ai(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new qt}}class Wf extends $e{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=B.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=B.getRenderJob(e);this._postList.forEach(a=>{t.removePost(a)})}addPost(e){if(this._postList.has(e))return;let t=new e;return this._postList.set(e,t),this._enable&&this.activePost(),t}removePost(e){if(!this._postList.has(e))return;let t=this._postList.get(e);this._postList.delete(e);let a=this.transform.view3D;B.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Bb="1.0.44";class B{static res;static inputSystem;static views;static _frameRateValue=0;static _frameRate=360;static _time=0;static _beforeRender;static _renderLoop;static _lateRender;static _requestAnimationFrameID=0;static get frameRate(){return this._frameRate}static set frameRate(e){this._frameRate=e,this._frameRateValue=1e3/e,e>=360&&(this._frameRateValue=0)}static get size(){return I.presentationSize}static get aspect(){return I.aspect}static get width(){return I.windowWidth}static get height(){return I.windowHeight}static setting={doublePrecision:!1,occlusionQuery:{enable:!0,debug:!1},pick:{enable:!0,mode:"bound",detail:"mesh"},render:{debug:!1,renderPassState:4,renderState_left:5,renderState_right:5,renderState_split:.5,quadScale:1,hdrExposure:1.5,debugQuad:-1,maxPointLight:1e3,maxDirectLight:4,maxSportLight:1e3,drawOpMin:0,drawOpMax:Number.MAX_SAFE_INTEGER,drawTrMin:0,drawTrMax:Number.MAX_SAFE_INTEGER,zPrePass:!1,useLogDepth:!1,useCompressGBuffer:!1,gi:!1,postProcessing:{bloom:{downSampleStep:3,downSampleBlurSize:9,downSampleBlurSigma:1,upSampleBlurSize:9,upSampleBlurSigma:1,luminanceThreshole:1,bloomIntensity:1,hdr:1},globalFog:{debug:!1,enable:!1,fogType:0,fogHeightScale:.1,start:400,end:10,density:.02,ins:.5,skyFactor:.5,skyRoughness:.4,overrideSkyFactor:.8,fogColor:new Z(96/255,117/255,133/255,1),falloff:.7,rayLength:200,scatteringExponent:2.7,dirHeightLine:10},godRay:{blendColor:!0,rayMarchCount:16,scatteringExponent:5,intensity:.5},ssao:{enable:!1,radius:.15,bias:-.1,aoPower:2,debug:!0},outline:{enable:!1,strength:1,groupCount:4,outlinePixel:2,fadeOutlinePixel:4,textureScale:1,useAddMode:!1,debug:!0},taa:{enable:!1,jitterSeedCount:8,blendFactor:.1,sharpFactor:.6,sharpPreBlurFactor:.5,temporalJitterScale:.13,debug:!0},gtao:{enable:!1,darkFactor:1,maxDistance:5,maxPixel:50,rayMarchSegment:6,multiBounce:!1,usePosFloat32:!0,blendColor:!0,debug:!0},ssr:{enable:!1,pixelRatio:1,fadeEdgeRatio:.2,rayMarchRatio:.5,fadeDistanceMin:600,fadeDistanceMax:2e3,roughnessThreshold:.5,powDotRN:.2,mixThreshold:.1,debug:!0},fxaa:{enable:!1},depthOfView:{enable:!1,iterationCount:3,pixelOffset:1,near:150,far:300}}},shadow:{enable:!0,type:"HARD",pointShadowBias:5e-4,shadowSize:2048,pointShadowSize:1024,shadowSoft:.005,shadowBound:100,shadowBias:.05,needUpdate:!0,autoUpdate:!0,updateFrameRate:2,csmMargin:.1,csmScatteringExp:.7,csmAreaScale:.4,debug:!1},gi:{enable:!1,offsetX:0,offsetY:0,offsetZ:0,probeSpace:64,probeXCount:4,probeYCount:2,probeZCount:4,probeSize:32,probeSourceTextureSize:2048,octRTMaxSize:2048,octRTSideSize:16,maxDistance:64*1.73,normalBias:.25,depthSharpness:1,hysteresis:.98,lerpHysteresis:.01,irradianceChebyshevBias:.01,rayNumber:144,irradianceDistanceBias:32,indirectIntensity:1,ddgiGamma:2.2,bounceIntensity:.025,probeRoughness:1,realTimeGI:!1,debug:!1,autoRenderProbe:!1},sky:{type:"HDRSKY",sky:null,skyExposure:1,defaultFar:65536,defaultNear:1},light:{maxLight:4096},material:{materialChannelDebug:!1,materialDebug:!1},loader:{numConcurrent:20},reflectionSetting:{reflectionProbeMaxCount:8,reflectionProbeSize:256,width:256*6,height:8*256,enable:!0}};static renderJobs;static async init(e={}){console.log("Rings Version",Bb),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await Ee.init(T.allocCount,this.setting.doublePrecision),await I.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,Be.getGBufferFrame(Be.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),X.init(),Ka.init(),ve.init(),wt.init(),Wt.init(),this.res=new zf,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new tl,this.inputSystem.initCanvas(I.canvas)}static startRenderJob(e){let t=new O0(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(Wf).addPost(Mn),(this.setting.pick.mode=="pixel"||this.setting.pick.mode=="bound")&&(e.enablePick=!0),t}static startRenderView(e){this.renderJobs||=new Map,this.views=[e];let t=this.startRenderJob(e);return this.resume(),t}static startRenderViews(e){this.renderJobs||=new Map,this.views=e;for(let t=0;t<e.length;t++)this.startRenderJob(e[t]);this.resume()}static getRenderJob(e){return this.renderJobs.get(e)}static pause(){this._requestAnimationFrameID!==0&&(cancelAnimationFrame(this._requestAnimationFrameID),this._requestAnimationFrameID=0)}static resume(){this._requestAnimationFrameID===0&&(this._requestAnimationFrameID=requestAnimationFrame(e=>this.render(e)))}static async render(e){if(this._frameRateValue>0){let t=e-this._time;if(t<this._frameRateValue){let a=performance.now();await new Promise(r=>{setTimeout(()=>{e+=performance.now()-a,r(!0)},this._frameRateValue-t)})}this._time=e}await this.updateFrame(e),this._requestAnimationFrameID=0,this.resume()}static async updateFrame(e){ze.delta=e-ze.time,ze.time=e,ze.frame+=1,br.tick(ze.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const s=t[a];s.scene.waitUpdate();let[o,l]=I.presentationSize;s.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const s of Ne.componentsBeforeUpdateList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}let r=I.device.createCommandEncoder();for(const s of Ne.componentsComputeList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o,r)}}I.device.queue.submit([r.finish()]);for(const s of Ne.componentsUpdateList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}for(const s of Ne.graphicComponent){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];o&&f.enable&&h(o)}}this._renderLoop&&await this._renderLoop(),Ee.updateAllContinueTransform(0,T.useCount,16),ve.modelMatrixBindGroup.writeBuffer(T.useCount*16),this.renderJobs.forEach((s,o)=>{s.renderState||s.start(),s.renderFrame()});for(const s of Ne.componentsLateUpdateList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}this._lateRender&&await this._lateRender()}}let Es=`
7922
+ `}async loadFontTextures(){let e=[],t=this.data;for(const a of t.fontPage){let r=this.baseUrl+a.file;await B.res.loadTexture(r,null,!0);let i=B.res.getTexture(r),s=new mr(i);e.push(s)}tr.parseSprite(e,t),t.fontChar[" "]||tr.insertSpaceChar(t,e[0])}static insertSpaceChar(e,t){let a=new ai,r=e.size*.5,i=e.lineHeight*.5;a.id=" ",a.offsetSize.set(0,0,e.size,e.size),a.trimSize.set(r,i),a.width=r,a.height=i,a.xadvance=0,a.xoffset=0,a.yoffset=0,a.guiTexture=t,a.uvRec.set(0,0,1e-6,1e-6),ri.addFnt(e.face,e.size,a.id,a)}static readLineProperty(e,t){e.trim().split(" ").forEach((a,r)=>{let i=a.split("=");if(i.length>1){let s=i[0],o=i[1];Object.prototype.hasOwnProperty.call(t,s)&&(o.indexOf('"')==-1?t[s]=parseFloat(i[1]):t[s]=o.replace('"',"").replace('"',""))}})}}function ab(n,e){let t=new ai;return t.id=n,t.offsetSize.set(0,0,e.width,e.height),t.trimSize.set(e.width,e.height),t.width=e.width,t.height=e.height,t.xadvance=0,t.xoffset=0,t.yoffset=0,t.guiTexture=new mr(e),t.uvRec.set(0,0,1,1),e.isVideoTexture||(e.flipY=!0),t}function Rf(n,e,t){let a=new ai;a.guiTexture=n,a.id=e,a.uvRec.copyFrom(t.textureRect),a.trimSize.x=t.textureRect.z,a.trimSize.y=t.textureRect.w,a.offsetSize.x=t.textureRectOffset.x,a.offsetSize.y=t.textureRectOffset.y,a.offsetSize.z=t.size.x,a.offsetSize.w=t.size.y,a.width=t.size.x,a.height=t.size.y;let r=1/n.width,i=1/n.height;a.uvRec.set(a.uvRec.x*r,a.uvRec.y*i,a.uvRec.z*r,a.uvRec.w*i);let s=.1;return t.border.x<=s&&t.border.y<=s&&t.border.z<=s&&t.border.x<=s?a.isSliced=!1:(a.borderSize.copyFrom(t.border),a.uvBorder.copyFrom(t.border),a.uvBorder.x-=t.textureRectOffset.x,a.uvBorder.y-=t.textureRectOffset.y,a.uvBorder.z=t.border.z-(t.size.x-t.textureRect.z-t.textureRectOffset.x),a.uvBorder.w=t.border.w-(t.size.y-t.textureRect.w-t.textureRectOffset.y),a.uvBorder.x/=t.textureRect.z,a.uvBorder.z/=t.textureRect.z,a.uvBorder.y/=t.textureRect.w,a.uvBorder.w/=t.textureRect.w,a.isSliced=!0),a}class If{_spriteMap=new Map;_spriteList=[];textureSize=new fe;name;constructor(e){this.textureSize.set(e.x,e.y)}setTexture(e,t,a){let r=Rf(e,t,a);return this._spriteMap.set(r.id,r),this._spriteList.push(r),r}getSprite(e){return this._spriteMap.get(e)}get spriteList(){return this._spriteList}}class Tf extends rt{static format=Je.TEXT;_json;_texture;async parseString(e){this._json=JSON.parse(e);let t=this.userData.replace(".json",".png");this._texture=await B.res.loadTexture(t,null,!0),this.data={json:this._json,texture:this._texture},this.parseAtlas()}verification(){if(this.data)return!0;throw new Error("verify failed.")}parseAtlas(){let e=new If(this._json.size),t=new mr(this._texture),a=this._json.atlas;for(const r in a)e.setTexture(t,r,a[r]);B.res.addAtlas(this.baseUrl,e),this.data=e}}var $t=Uint8Array,ii=Uint16Array,rb=Int32Array,Qf=new $t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Mf=new $t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ib=new $t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pf=function(n,e){for(var t=new ii(31),a=0;a<31;++a)t[a]=e+=1<<n[a-1];for(var r=new rb(t[30]),a=1;a<30;++a)for(var i=t[a];i<t[a+1];++i)r[i]=i-t[a]<<5|a;return{b:t,r}},Nf=Pf(Qf,2),Vf=Nf.b,sb=Nf.r;Vf[28]=258,sb[258]=28;for(var nb=Pf(Mf,0),ob=nb.b,oo=new ii(32768),Xe=0;Xe<32768;++Xe){var pr=(Xe&43690)>>1|(Xe&21845)<<1;pr=(pr&52428)>>2|(pr&13107)<<2,pr=(pr&61680)>>4|(pr&3855)<<4,oo[Xe]=((pr&65280)>>8|(pr&255)<<8)>>1}for(var Ti=(function(n,e,t){for(var a=n.length,r=0,i=new ii(e);r<a;++r)n[r]&&++i[n[r]-1];var s=new ii(e);for(r=1;r<e;++r)s[r]=s[r-1]+i[r-1]<<1;var o;if(t){o=new ii(1<<e);var l=15-e;for(r=0;r<a;++r)if(n[r])for(var c=r<<4|n[r],f=e-n[r],h=s[n[r]-1]++<<f,u=h|(1<<f)-1;h<=u;++h)o[oo[h]>>l]=c}else for(o=new ii(a),r=0;r<a;++r)n[r]&&(o[r]=oo[s[n[r]-1]++]>>15-n[r]);return o}),Qi=new $t(288),Xe=0;Xe<144;++Xe)Qi[Xe]=8;for(var Xe=144;Xe<256;++Xe)Qi[Xe]=9;for(var Xe=256;Xe<280;++Xe)Qi[Xe]=7;for(var Xe=280;Xe<288;++Xe)Qi[Xe]=8;for(var Of=new $t(32),Xe=0;Xe<32;++Xe)Of[Xe]=5;var lb=Ti(Qi,9,1),cb=Ti(Of,5,1),lo=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},Ua=function(n,e,t){var a=e/8|0;return(n[a]|n[a+1]<<8)>>(e&7)&t},co=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},fb=function(n){return(n+7)/8|0},fo=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new $t(n.subarray(e,t))},db=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ca=function(n,e,t){var a=new Error(e||db[n]);if(a.code=n,Error.captureStackTrace&&Error.captureStackTrace(a,ca),!t)throw a;return a},hb=function(n,e,t,a){var r=n.length,i=a?a.length:0;if(!r||e.f&&!e.l)return t||new $t(0);var s=!t,o=s||e.i!=2,l=e.i;s&&(t=new $t(r*3));var c=function(ie){var ce=t.length;if(ie>ce){var ge=new $t(Math.max(ce*2,ie));ge.set(t),t=ge}},f=e.f||0,h=e.p||0,u=e.b||0,b=e.l,A=e.d,m=e.m,p=e.n,D=r*8;do{if(!b){f=Ua(n,h,1);var _=Ua(n,h+1,3);if(h+=3,_)if(_==1)b=lb,A=cb,m=9,p=5;else if(_==2){var S=Ua(n,h,31)+257,F=Ua(n,h+10,15)+4,k=S+Ua(n,h+5,31)+1;h+=14;for(var x=new $t(k),w=new $t(19),R=0;R<F;++R)w[ib[R]]=Ua(n,h+R*3,7);h+=F*3;for(var Q=lo(w),M=(1<<Q)-1,j=Ti(w,Q,1),R=0;R<k;){var he=j[Ua(n,h,M)];h+=he&15;var v=he>>4;if(v<16)x[R++]=v;else{var ae=0,P=0;for(v==16?(P=3+Ua(n,h,3),h+=2,ae=x[R-1]):v==17?(P=3+Ua(n,h,7),h+=3):v==18&&(P=11+Ua(n,h,127),h+=7);P--;)x[R++]=ae}}var z=x.subarray(0,S),W=x.subarray(S);m=lo(z),p=lo(W),b=Ti(z,m,1),A=Ti(W,p,1)}else ca(1);else{var v=fb(h)+4,U=n[v-4]|n[v-3]<<8,y=v+U;if(y>r){l&&ca(0);break}o&&c(u+U),t.set(n.subarray(v,y),u),e.b=u+=U,e.p=h=y*8,e.f=f;continue}if(h>D){l&&ca(0);break}}o&&c(u+131072);for(var V=(1<<m)-1,te=(1<<p)-1,J=h;;J=h){var ae=b[co(n,h)&V],K=ae>>4;if(h+=ae&15,h>D){l&&ca(0);break}if(ae||ca(2),K<256)t[u++]=K;else if(K==256){J=h,b=null;break}else{var ee=K-254;if(K>264){var R=K-257,re=Qf[R];ee=Ua(n,h,(1<<re)-1)+Vf[R],h+=re}var oe=A[co(n,h)&te],pe=oe>>4;oe||ca(3),h+=oe&15;var W=ob[pe];if(pe>3){var re=Mf[pe];W+=co(n,h)&(1<<re)-1,h+=re}if(h>D){l&&ca(0);break}o&&c(u+131072);var Te=u+ee;if(u<W){var Oe=i-W,q=Math.min(W,Te);for(Oe+u<0&&ca(3);u<q;++u)t[u]=a[Oe+u]}for(;u<Te;++u)t[u]=t[u-W]}}e.l=b,e.p=J,e.b=u,e.f=f,b&&(f=1,e.m=m,e.d=A,e.n=p)}while(!f);return u!=t.length&&s?fo(t,0,u):t.subarray(0,u)},ub=new $t(0),Pa=function(n,e){return n[e]|n[e+1]<<8},ya=function(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},ho=function(n,e){return ya(n,e)+ya(n,e+4)*4294967296};function bb(n,e){return hb(n,{i:2},e&&e.out,e&&e.dictionary)}var uo=typeof TextDecoder<"u"&&new TextDecoder,gb=0;try{uo.decode(ub,{stream:!0}),gb=1}catch{}var mb=function(n){for(var e="",t=0;;){var a=n[t++],r=(a>127)+(a>223)+(a>239);if(t+r>n.length)return{s:e,r:fo(n,t-1)};r?r==3?(a=((a&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):r&1?e+=String.fromCharCode((a&31)<<6|n[t++]&63):e+=String.fromCharCode((a&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(a)}};function Lf(n,e){if(e){for(var t="",a=0;a<n.length;a+=16384)t+=String.fromCharCode.apply(null,n.subarray(a,a+16384));return t}else{if(uo)return uo.decode(n);var r=mb(n),i=r.s,t=r.r;return t.length&&ca(8),i}}var pb=function(n,e){return e+30+Pa(n,e+26)+Pa(n,e+28)},Ab=function(n,e,t){var a=Pa(n,e+28),r=Lf(n.subarray(e+46,e+46+a),!(Pa(n,e+8)&2048)),i=e+46+a,s=ya(n,e+20),o=t&&s==4294967295?Db(n,i):[s,ya(n,e+24),ya(n,e+42)],l=o[0],c=o[1],f=o[2];return[Pa(n,e+10),l,c,r,i+Pa(n,e+30)+Pa(n,e+32),f]},Db=function(n,e){for(;Pa(n,e)!=1;e+=4+Pa(n,e+2));return[ho(n,e+12),ho(n,e+4),ho(n,e+20)]};function _b(n,e){for(var t={},a=n.length-22;ya(n,a)!=101010256;--a)(!a||n.length-a>65558)&&ca(13);var r=Pa(n,a+8);if(!r)return{};var i=ya(n,a+16),s=i==4294967295||r==65535;if(s){var o=ya(n,a-12);s=ya(n,o)==101075792,s&&(r=ya(n,o+32),i=ya(n,o+48))}for(var l=0;l<r;++l){var c=Ab(n,i,s),f=c[0],h=c[1],u=c[2],b=c[3],A=c[4],m=c[5],p=pb(n,m);i=A,f?f==8?t[b]=bb(n.subarray(p,p+h),{out:new $t(u)}):ca(14,"unknown compression type "+f):t[b]=fo(n,p,p+h)}return t}class Bt extends Dt{constructor(){super(),this.shader=new d.UnLitShader,this.baseMap=B.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}class Ir extends Ve{shape_vertices=[];shape_indices=[];radius;widthSegments;heightSegments;phiStart;phiLength;thetaStart;thetaLength;constructor(e,t,a,r,i,s,o){super(),this.radius=e,this.widthSegments=t,this.heightSegments=a,this.phiStart=r,this.phiLength=i,this.thetaStart=s,this.thetaLength=o,this.buildGeometry()}buildGeometry(){var e,t,a=0;let r=this.heightSegments,i=this.widthSegments,s=this.radius;var o=(r+1)*(i+1);let l=new Float32Array(o*3),c=new Float32Array(o*3),f=new Float32Array(o*2),h=new Uint16Array(i*r*2*3),u=0,b=0,A=0;for(t=0;t<=r;++t){var m=Math.PI*t/r,p=s*Math.cos(m),D=s*Math.sin(m);for(e=0;e<=i;++e){var _=2*Math.PI*e/i,v=D*Math.cos(_),U=D*Math.sin(_),y=1/Math.sqrt(v*v+p*p+U*U);if(l[u++]=v,l[u++]=p,l[u++]=U,c[b++]=v*y,c[b++]=p*y,c[b++]=U*y,f[A++]=e/i,f[A++]=t/r,e>0&&t>0){var S=(i+1)*t+e,F=(i+1)*t+e-1,k=(i+1)*(t-1)+e-1,x=(i+1)*(t-1)+e;t==r?(h[a++]=S,h[a++]=k,h[a++]=x):t==1?(h[a++]=S,h[a++]=F,h[a++]=k):(h[a++]=S,h[a++]=F,h[a++]=k,h[a++]=S,h[a++]=k,h[a++]=x)}}}this.setIndices(h),this.setAttribute(G.position,l),this.setAttribute(G.normal,c),this.setAttribute(G.uv,f),this.setAttribute(G.TEXCOORD_1,f),this.addSubGeometry({indexStart:0,indexCount:h.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0}),this.bounds=new Ce(g.ZERO,new g(this.radius*2,this.radius*2,this.radius*2))}}class Mi extends d.Object3D{static register3DRepresentation=null;positionIndex=-1;positionValid=!1;marker;constructor(e){super(),this.parsePlacemark(e),this.setup3DRepresentation()}parsePlacemark(e){if(!e.slamPositionInfo){console.warn("WayPoint3D: slamPositionInfo is not found");return}const t=e.slamPositionInfo.slamPosition.split(",").map(Number);this.localPosition=new g(t[0],t[1],t[2]),this.positionIndex=Number(e.slamPositionInfo.slamPositionIndex),this.positionValid=e.slamPositionInfo.slamPositionValid==="1"}setup3DRepresentation(){if(this.marker&&(this.removeChild(this.marker),this.marker=null),Mi.register3DRepresentation)this.marker=Mi.register3DRepresentation(this),this.marker&&this.addChild(this.marker);else{this.marker=new d.Object3D;const e=this.marker.addComponent(d.MeshRenderer);e.geometry=new Ir(.1,32,16),e.material=new Bt,e.material.baseColor=this.positionValid?new Z(0,1,0,1):new Z(1,0,0,1),this.addChild(this.marker),this.marker.name="WayPoint3DMarker"}}}class Pi extends d.Object3D{static register3DRepresentation=null;line;constructor(e){super(),this.parseWayLineFile(e),this.setup3DRepresentation()}parseWayLineFile(e){for(const t of e.Folder.Placemark){const a=new Mi(t);this.addChild(a)}this.entityChildren=this.entityChildren.sort((t,a)=>t.positionIndex-a.positionIndex)}setup3DRepresentation(){this.line&&(this.removeChild(this.line),this.line=null),Pi.register3DRepresentation?(this.line=Pi.register3DRepresentation(this),this.line&&this.addChild(this.line)):(this.line=this.createMultiLine(this.entityChildren.map(e=>e.localPosition),new Z(1,1,1,1)),this.addChild(this.line),this.line.name="WayLines3DLine")}createMultiLine(e,t){if(e.length<2)return null;const a=new Ve,r=new Float32Array(e.length*3);for(let c=0;c<e.length;c++)r[c*3]=e[c].x,r[c*3+1]=e[c].y,r[c*3+2]=e[c].z;const i=new Uint16Array((e.length-1)*2);for(let c=0;c<e.length-1;c++)i[c*2]=c,i[c*2+1]=c+1;a.setIndices(i),a.setAttribute(G.position,r),a.addSubGeometry({indexStart:0,indexCount:i.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});const s=new d.Object3D,o=s.addComponent(d.MeshRenderer),l=new Bt;return l.topology="line-list",l.baseColor=t,l.blendMode=Ae.ADD,l.castReflection=!1,o.geometry=a,o.material=l,s}}class Gf extends rt{static format=Je.BIN;parseBuffer(e){try{const t={template:null,waylines:null},a=_b(new Uint8Array(e));for(const i in a){const s=a[i],l=new DOMParser().parseFromString(Lf(s),"application/xml"),c={};this.parseNode(l,c);const f=i.replace("wpmz/","").split(".")[0];Object.assign(t,{[f]:c["#document"].kml.Document})}const r=new Pi(t.waylines);this.data=r}catch(t){this.parserError(`KMZ parsing failed: ${t}`,-1)}}parseNode(e,t){const a=["Placemark","actionGroup","action"],r=e.nodeName.replace("wpml:","");if(!e.childNodes.length)t[r]=void 0;else{let i=null,s=!1;for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];if(l.nodeType==Node.TEXT_NODE){const c=l.nodeValue?.trim();c&&c.length>0&&(i=c)}else l.nodeType==Node.ELEMENT_NODE&&(s=!0)}if(i&&!s)t[r]=i;else if(s){a.includes(r)?t[r]?.length?t[r].push({}):t[r]=[{}]:t[r]={};for(let o=0;o<e.childNodes.length;++o){const l=e.childNodes[o];l.nodeType==Node.ELEMENT_NODE&&this.parseNode(l,Array.isArray(t[r])?t[r].at(-1):t[r])}}else t[r]=void 0}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class zf{_texturePool;_materialPool;_prefabPool;_gltfPool;_geometryPool;_atlasList;_obj;constructor(){this._texturePool=new Map,this._materialPool=new Map,this._prefabPool=new Map,this._geometryPool=new Map,this._gltfPool=new Map,this._atlasList=new Map,this._obj=new Map}getGltf(e){return this._gltfPool.get(e)}addObj(e,t){this._obj.set(e,t)}getObj(e){return this._obj.get(e)}addTexture(e,t){this._texturePool.set(e,t)}getTexture(e){return this._texturePool.get(e)}addGeometry(e,t){this._geometryPool.set(e,t)}getGeometry(e){return this._geometryPool.get(e)}addMat(e,t){return this._materialPool.set(e,t)}getMat(e){return this._materialPool.get(e)}addPrefab(e,t){this._prefabPool.set(e,t)}getPrefab(e){return this._prefabPool.get(e).instantiate()}addAtlas(e,t){t.name=e,this._atlasList.set(e,t)}getAtlas(e){return this._atlasList.get(e)}getGUISprite(e){for(let t of this._atlasList.values()){let a=t.getSprite(e);if(a)return a}return null}async load(e,t,a){return(await new Tt().load(e,t,a)).data}async loadGltf(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new Tt;r==".gltf"?a=await i.load(e,_t,t):a=await i.load(e,Hn,t);let s=a.data;return this._prefabPool.set(e,s),this._gltfPool.set(e,a.gltf),s}async loadObj(e,t){if(this._prefabPool.has(e))return this._prefabPool.get(e);let a,r=e.substring(e.lastIndexOf(".")).toLowerCase(),i=new Tt;r==".obj"&&(a=await i.load(e,wi,t));let s=a.data;return this._prefabPool.set(e,s),s}async loadB3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let s=(await new Tt().load(e,ro,t,a)).data;return this._prefabPool.set(e,s),s}async loadI3DM(e,t,a){if(this._prefabPool.has(e))return this._prefabPool.get(e);let s=(await new Tt().load(e,no,t,a)).data;return this._prefabPool.set(e,s),s}async loadTexture(e,t,a){if(this._texturePool.has(e))return this._texturePool.get(e);let r=new $a;r.flipY=a;try{await r.load(e,t)}catch(i){return console.error(`Failed to load texture: ${e}`,i),null}return this._texturePool.set(e,r),r}destroyTexture(e){const t=this._texturePool.get(e);return t?xe.getInstance().hasReference(t)?!1:(t.isDestroyed||t.destroy(),this._texturePool.delete(e),!0):!1}destroyTextureAllUnUsed(){for(const[e,t]of this._texturePool.entries())this.destroyTexture(e)}async loadTextureCount(e,t,a,r){return new Promise(async(i,s)=>{let o=0,l=[];t==0&&i(l);for(let c=0;c<t;c++){const f=e.shift();this.loadTexture(f,a,r).then(h=>{l.push(h),o++,o==t&&i(l)})}})}async loadBitmapTextures(e,t=5,a,r){let i=[],s=Math.floor(e.length/t)+1,o=Math.floor(e.length%t);for(let l=0;l<s;l++){let c=await this.loadTextureCount(e,l==s-1?o:t,a,r);i.push(...c)}return i}async loadHDRTexture(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new $n;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadHDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new xs;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadLDRTextureCube(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new ks;return a=await a.load(e,t),this._texturePool.set(e,a),a}async loadTextureCubeMaps(e){let t=e[0];if(this._texturePool.has(t))return this._texturePool.get(t);let a=new Kn;return await a.load(e),this._texturePool.set(e[0],a),a}async loadTextureCubeStd(e,t){if(this._texturePool.has(e))return this._texturePool.get(e);let a=new Kn;return await a.loadStd(e),a}async loadJSON(e,t){return await new Tt().loadJson(e,t).then(async a=>a).catch(a=>{console.log(a)})}async loadFont(e,t,a){let i=await new Tt().load(e,tr,t,a),s=i.data;return ri.addFontData(s.face,s.size,s),i.data}async loadAtlas(e,t){return(await new Tt().load(e,Tf,t,e)).data}async loadKMZ(e,t){return(await new Tt().load(e,Gf,t)).data}normalTexture;maskTexture;whiteTexture;blackTexture;redTexture;blueTexture;greenTexture;yellowTexture;grayTexture;defaultSky;defaultGUITexture;defaultGUISprite;defaultMaterial;createTexture(e,t,a,r,i,s,o){let l=32,c=32,f=new Uint8Array(l*c*4);this.fillColor(f,e,t,a,r,i,s);let h=new Si;return h.name=o,h.create(16,16,f,!0),o&&this.addTexture(o,h),h}fillColor(e,t,a,r,i,s,o){for(let l=0;l<t;l++)for(let c=0;c<a;c++){let f=c*t+l;e[f*4+0]=r,e[f*4+1]=i,e[f*4+2]=s,e[f*4+3]=o}}initDefault(){this.normalTexture=this.createTexture(32,32,255*.5,255*.5,255,255,"default-normalTexture"),this.maskTexture=this.createTexture(32,32,255,255*.5,255,255,"default-maskTexture"),this.whiteTexture=this.createTexture(32,32,255,255,255,255,"default-whiteTexture"),this.blackTexture=this.createTexture(32,32,0,0,0,255,"default-blackTexture"),this.redTexture=this.createTexture(32,32,255,0,0,255,"default-redTexture"),this.blueTexture=this.createTexture(32,32,0,0,255,255,"default-blueTexture"),this.greenTexture=this.createTexture(32,32,0,255,0,255,"default-greenTexture"),this.yellowTexture=this.createTexture(32,32,0,255,255,255,"default-yellowTexture"),this.grayTexture=this.createTexture(32,32,128,128,128,255,"default-grayTexture");let t=new Ff().generateBRDFLUTTexture(),a=t.name="BRDFLUT";this.addTexture(a,t),this.defaultSky=new xs,this.defaultSky.createFromTexture(128,this.blackTexture),xe.getInstance().attached(this.defaultSky,this),xe.getInstance().attached(t,this),xe.getInstance().attached(this.normalTexture,this),xe.getInstance().attached(this.maskTexture,this),xe.getInstance().attached(this.whiteTexture,this),xe.getInstance().attached(this.blackTexture,this),xe.getInstance().attached(this.redTexture,this),xe.getInstance().attached(this.blueTexture,this),xe.getInstance().attached(this.greenTexture,this),xe.getInstance().attached(this.yellowTexture,this),xe.getInstance().attached(this.grayTexture,this),this.defaultGUITexture=new mr(this.whiteTexture),this.defaultGUISprite=new ai(this.defaultGUITexture),this.defaultGUISprite.trimSize.set(4,4),this.defaultMaterial=new qt}}class Wf extends $e{_postList;init(e){this._postList=new Map}start(){}stop(){}onEnable(){this.activePost()}onDisable(){this.unActivePost()}activePost(){let e=this.transform.view3D,t=B.getRenderJob(e);this._postList.forEach(a=>{t.addPost(a)})}unActivePost(){let e=this.transform.view3D,t=B.getRenderJob(e);this._postList.forEach(a=>{t.removePost(a)})}addPost(e){if(this._postList.has(e))return;let t=new e;return this._postList.set(e,t),this._enable&&this.activePost(),t}removePost(e){if(!this._postList.has(e))return;let t=this._postList.get(e);this._postList.delete(e);let a=this.transform.view3D;B.getRenderJob(a).removePost(t)}getPost(e){return this._postList.has(e)?this._postList.get(e):null}}const Bb="1.0.45";class B{static res;static inputSystem;static views;static _frameRateValue=0;static _frameRate=360;static _time=0;static _beforeRender;static _renderLoop;static _lateRender;static _requestAnimationFrameID=0;static get frameRate(){return this._frameRate}static set frameRate(e){this._frameRate=e,this._frameRateValue=1e3/e,e>=360&&(this._frameRateValue=0)}static get size(){return I.presentationSize}static get aspect(){return I.aspect}static get width(){return I.windowWidth}static get height(){return I.windowHeight}static setting={doublePrecision:!1,occlusionQuery:{enable:!0,debug:!1},pick:{enable:!0,mode:"bound",detail:"mesh"},render:{debug:!1,renderPassState:4,renderState_left:5,renderState_right:5,renderState_split:.5,quadScale:1,hdrExposure:1.5,debugQuad:-1,maxPointLight:1e3,maxDirectLight:4,maxSportLight:1e3,drawOpMin:0,drawOpMax:Number.MAX_SAFE_INTEGER,drawTrMin:0,drawTrMax:Number.MAX_SAFE_INTEGER,zPrePass:!1,useLogDepth:!1,useCompressGBuffer:!1,gi:!1,postProcessing:{bloom:{downSampleStep:3,downSampleBlurSize:9,downSampleBlurSigma:1,upSampleBlurSize:9,upSampleBlurSigma:1,luminanceThreshole:1,bloomIntensity:1,hdr:1},globalFog:{debug:!1,enable:!1,fogType:0,fogHeightScale:.1,start:400,end:10,density:.02,ins:.5,skyFactor:.5,skyRoughness:.4,overrideSkyFactor:.8,fogColor:new Z(96/255,117/255,133/255,1),falloff:.7,rayLength:200,scatteringExponent:2.7,dirHeightLine:10},godRay:{blendColor:!0,rayMarchCount:16,scatteringExponent:5,intensity:.5},ssao:{enable:!1,radius:.15,bias:-.1,aoPower:2,debug:!0},outline:{enable:!1,strength:1,groupCount:4,outlinePixel:2,fadeOutlinePixel:4,textureScale:1,useAddMode:!1,debug:!0},taa:{enable:!1,jitterSeedCount:8,blendFactor:.1,sharpFactor:.6,sharpPreBlurFactor:.5,temporalJitterScale:.13,debug:!0},gtao:{enable:!1,darkFactor:1,maxDistance:5,maxPixel:50,rayMarchSegment:6,multiBounce:!1,usePosFloat32:!0,blendColor:!0,debug:!0},ssr:{enable:!1,pixelRatio:1,fadeEdgeRatio:.2,rayMarchRatio:.5,fadeDistanceMin:600,fadeDistanceMax:2e3,roughnessThreshold:.5,powDotRN:.2,mixThreshold:.1,debug:!0},fxaa:{enable:!1},depthOfView:{enable:!1,iterationCount:3,pixelOffset:1,near:150,far:300}}},shadow:{enable:!0,type:"HARD",pointShadowBias:5e-4,shadowSize:2048,pointShadowSize:1024,shadowSoft:.005,shadowBound:100,shadowBias:.05,needUpdate:!0,autoUpdate:!0,updateFrameRate:2,csmMargin:.1,csmScatteringExp:.7,csmAreaScale:.4,debug:!1},gi:{enable:!1,offsetX:0,offsetY:0,offsetZ:0,probeSpace:64,probeXCount:4,probeYCount:2,probeZCount:4,probeSize:32,probeSourceTextureSize:2048,octRTMaxSize:2048,octRTSideSize:16,maxDistance:64*1.73,normalBias:.25,depthSharpness:1,hysteresis:.98,lerpHysteresis:.01,irradianceChebyshevBias:.01,rayNumber:144,irradianceDistanceBias:32,indirectIntensity:1,ddgiGamma:2.2,bounceIntensity:.025,probeRoughness:1,realTimeGI:!1,debug:!1,autoRenderProbe:!1},sky:{type:"HDRSKY",sky:null,skyExposure:1,defaultFar:65536,defaultNear:1},light:{maxLight:4096},material:{materialChannelDebug:!1,materialDebug:!1},loader:{numConcurrent:20},reflectionSetting:{reflectionProbeMaxCount:8,reflectionProbeSize:256,width:256*6,height:8*256,enable:!0}};static renderJobs;static async init(e={}){console.log("Rings Version",Bb),window.isSecureContext||console.warn("WebGPU is only supported in secure contexts (HTTPS or localhost)"),this.setting={...this.setting,...e.engineSetting},await Ee.init(T.allocCount,this.setting.doublePrecision),await I.init(e.canvasConfig),this.setting.reflectionSetting.width=this.setting.reflectionSetting.reflectionProbeSize*6,this.setting.reflectionSetting.height=this.setting.reflectionSetting.reflectionProbeSize*this.setting.reflectionSetting.reflectionProbeMaxCount,Be.getGBufferFrame(Be.reflections_GBuffer,this.setting.reflectionSetting.width,this.setting.reflectionSetting.height,!1),X.init(),Ka.init(),ve.init(),wt.init(),Wt.init(),this.res=new zf,this.res.initDefault(),this._beforeRender=e.beforeRender,this._renderLoop=e.renderLoop,this._lateRender=e.lateRender,this.inputSystem=new tl,this.inputSystem.initCanvas(I.canvas)}static startRenderJob(e){let t=new O0(e);return this.renderJobs.set(e,t),this.setting.pick.mode=="pixel"&&e.scene.getOrAddComponent(Wf).addPost(Mn),(this.setting.pick.mode=="pixel"||this.setting.pick.mode=="bound")&&(e.enablePick=!0),t}static startRenderView(e){this.renderJobs||=new Map,this.views=[e];let t=this.startRenderJob(e);return this.resume(),t}static startRenderViews(e){this.renderJobs||=new Map,this.views=e;for(let t=0;t<e.length;t++)this.startRenderJob(e[t]);this.resume()}static getRenderJob(e){return this.renderJobs.get(e)}static pause(){this._requestAnimationFrameID!==0&&(cancelAnimationFrame(this._requestAnimationFrameID),this._requestAnimationFrameID=0)}static resume(){this._requestAnimationFrameID===0&&(this._requestAnimationFrameID=requestAnimationFrame(e=>this.render(e)))}static async render(e){if(this._frameRateValue>0){let t=e-this._time;if(t<this._frameRateValue){let a=performance.now();await new Promise(r=>{setTimeout(()=>{e+=performance.now()-a,r(!0)},this._frameRateValue-t)})}this._time=e}await this.updateFrame(e),this._requestAnimationFrameID=0,this.resume()}static async updateFrame(e){ze.delta=e-ze.time,ze.time=e,ze.frame+=1,br.tick(ze.delta);let t=this.views,a=0;for(a=0;a<t.length;a++){const s=t[a];s.scene.waitUpdate();let[o,l]=I.presentationSize;s.camera.viewPort.setTo(0,0,o,l)}this._beforeRender&&await this._beforeRender();for(const s of Ne.componentsBeforeUpdateList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}let r=I.device.createCommandEncoder();for(const s of Ne.componentsComputeList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o,r)}}I.device.queue.submit([r.finish()]);for(const s of Ne.componentsUpdateList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}for(const s of Ne.graphicComponent){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];o&&f.enable&&h(o)}}this._renderLoop&&await this._renderLoop(),Ee.updateAllContinueTransform(0,T.useCount,16),ve.modelMatrixBindGroup.writeBuffer(T.useCount*16),this.renderJobs.forEach((s,o)=>{s.renderState||s.start(),s.renderFrame()});for(const s of Ne.componentsLateUpdateList){let o=s[0],l=s[1];for(const c of l){let f=c[0],h=c[1];f.enable&&h(o)}}this._lateRender&&await this._lateRender()}}let Es=`
7919
7923
  struct BloomCfg{
7920
7924
  downSampleStep: f32,
7921
7925
  downSampleBlurSize: f32,
@@ -11851,5 +11855,5 @@ fn frag(){
11851
11855
  `).filter(Boolean);let i=2,s=!1;for(const o of r){const l=o.split(/\s{2,}|\s*:/).filter(Boolean);if(l.length>=2){const c=l[0].trim().toUpperCase(),f=l[1].trim().toUpperCase();if(c==="VERS"||c==="VERSION"){const h=f.match(/(\d+\.?\d*)/);h&&(i=+h[1])}else(c==="WRAP"||c==="WRAP.")&&(s=f==="YES"||f==="Y")}}return{version:i,wrap:s}}parseWellParams(e){const t=Zt.parseSection(e,"W");if(!t)return{};const r=Zt.removeComment(t).split(`
11852
11856
  `).filter(Boolean),i={};for(const s of r){const o=Zt.parseParameterLine(s);o.mnemonic&&(i[o.mnemonic]={unit:o.unit,value:Zt.convertToValue(o.value),description:o.description})}return i}parseCurveParams(e){const t=Zt.parseSection(e,"C");if(!t)return{};const r=Zt.removeComment(t).split(`
11853
11857
  `).filter(Boolean),i={};for(const s of r){const o=Zt.parseParameterLine(s);o.mnemonic&&(i[o.mnemonic]={unit:o.unit,value:o.value,description:o.description})}return i}parseHeaders(e){const t=Zt.parseSection(e,"C");if(!t)throw new Error("LASLoader: ~CURVE section not found");const r=Zt.removeComment(t).split(`
11854
- `).filter(Boolean),i=[];for(const s of r){const o=Zt.parseParameterLine(s);o.mnemonic&&i.push(o.mnemonic)}if(i.length===0)throw new Error("LASLoader: No headers found in ~CURVE section");return i}parseData(e,t,a){const r=e.match(/~A(?:[\x20-\x7E])*(?:\r\n|\r|\n)([\s\S]*?)(?=~|$)/);if(!r||!r[1])throw new Error("LASLoader: ~A data section not found");const i=r[1].trim();if(!i)throw new Error("LASLoader: Data section is empty");const s=i.split(/\s+/).filter(c=>c.trim().length>0).map(c=>Zt.convertToValue(c.trim()));if(s.length===0)throw new Error("LASLoader: No data values found");const o=Math.floor(s.length/t.length);if(o===0)throw new Error("LASLoader: Insufficient data values");const l=[];for(let c=0;c<o;c++){const f=[];for(let h=0;h<t.length;h++){const u=c*t.length+h;u<s.length&&f.push(s[u])}f.length===t.length&&l.push(f)}return l}}var hi=(n=>(n.PointCloud="pointcloud",n.Curve="curve",n.WellTrajectory="trajectory",n))(hi||{}),Am=Object.getOwnPropertyDescriptor,Dm=(n,e,t,a)=>{for(var r=a>1?void 0:a?Am(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.FatLineShader=class extends gt{constructor(){super();const e=new qe("FatLine_VS","FatLine_FS");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);const t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,t.cullMode=Vt.none,t.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new Z(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new fe(1920,1080));const e=new T;this.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}},d.FatLineShader=Dm([Ta(d.FatLineShader,"FatLineShader")],d.FatLineShader);class Ch extends Dt{constructor(){super(),this.shader=new d.FatLineShader,this.transparent=!0}setInstanceBuffer(e){this.shader.setStorageBuffer("instances",e)}setModelMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set lineWidth(e){this.shader.setUniformFloat("lineWidth",e)}get lineWidth(){return this.shader.getUniformFloat("lineWidth")}set opacity(e){this.shader.setUniformFloat("opacity",e)}get opacity(){return this.shader.getUniformFloat("opacity")}set resolution(e){this.shader.setUniformVector2("resolution",e)}get resolution(){return this.shader.getUniformVector2("resolution")}}class _m extends rt{static format=Je.BIN;visualizationMode=hi.PointCloud;async parseBuffer(e){const a=await new yh().parse(e);await this.createVisualization(a)}async createVisualization(e){if("format"in e&&e.format==="binary")this.data=this.createBinaryPointCloudVisualization(e);else{const t=e;let a;switch(this.visualizationMode){case hi.PointCloud:a=this.createPointCloudVisualization(t);break;case hi.Curve:a=this.createCurveVisualization(t);break;case hi.WellTrajectory:a=this.createWellTrajectoryVisualization(t);break;default:a=this.createPointCloudVisualization(t)}a.lasData=t,a.wellParams=t.wellParams,a.curveParams=t.curveParams,this.data=a}}createBinaryPointCloudVisualization(e){const t=new d.Object3D;t.name="LASPointCloud";const a=new d.Object3D;a.name="LASPointCloudRoot",t.addChild(a);const r=a.addComponent(d.PointCloudRenderer);return r.initFromData(e.positions,e.colors,e.numPoints),r.setPointShape("circle"),r.setPointSize(4),t.lasFormat="binary",t.lasVersion=e.version,t.numPoints=e.numPoints,t.pointDataFormat=e.pointDataFormat,t.bbox=e.bbox,t}verification(){if(this.data)return!0;throw new Error("LASParser: Parse failed")}createPointCloudVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const s=t.map((D,_)=>_).filter(D=>D!==i).slice(0,2),o=a.filter(D=>!D.some(_=>_===r||_===+r));if(o.length===0)throw new Error("LASParser: No valid data points after filtering");const l=o.length,c=new Float32Array(l*3),f=new Uint8Array(l*4);let h=1/0,u=-1/0,b=1/0,A=-1/0;if(s.length>0){const D=o.map(_=>+_[s[0]]).filter(_=>!isNaN(_));if(h=Math.min(...D),u=Math.max(...D),s.length>1){const _=o.map(v=>+v[s[1]]).filter(v=>!isNaN(v));b=Math.min(..._),A=Math.max(..._)}}for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=D*4;if(c[v+2]=+_[i],s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;if(c[v+0]=S*10,s.length>1){const F=+_[s[1]],k=A!==b?(F-b)/(A-b):0;c[v+1]=k*10}else c[v+1]=0}else c[v+0]=0,c[v+1]=0;if(s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;this.mapValueToColor(S,f,U)}else f[U+0]=255,f[U+1]=255,f[U+2]=255,f[U+3]=255}const m=new d.Object3D;m.name="LASPointCloud";const p=m.addComponent(d.PointCloudRenderer);return p.initFromData(c,f,l),p.setPointShape("circle"),p.setPointSize(4),m}createCurveVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const s=t.map((D,_)=>_).find(D=>D!==i);if(s===void 0)throw new Error("LASParser: No curve column found");const o=a.filter(D=>{const _=+D[i],v=+D[s];return!isNaN(_)&&!isNaN(v)&&v!==r&&v!==+r});if(o.length===0)throw new Error("LASParser: No valid data points");const l=o.map(D=>+D[s]),c=Math.min(...l),h=Math.max(...l)-c,u=new Float32Array(o.length*3);for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=+_[i],y=+_[s];u[v+2]=U;const S=h>0?(y-c)/h:0;u[v+0]=S*10,u[v+1]=0}const b=new ih;b.setPositions(u);const A=new Ch;A.baseColor=new Z(1,0,0,1),A.lineWidth=2;const m=new d.Object3D;m.name=`LASCurve_${t[s]}`;const p=m.addComponent(d.FatLineRenderer);return p.geometry=b,p.material=A,m}createWellTrajectoryVisualization(e){throw new Error("LASParser: Well trajectory visualization not yet implemented")}normalizeValue(e,t,a){const r=t.map(o=>+o[a]).filter(o=>!isNaN(o)),i=Math.min(...r),s=Math.max(...r);return s!==i?(e-i)/(s-i):0}mapValueToColor(e,t,a){const r=Math.floor(e*255),i=Math.floor((1-e)*255);t[a+0]=r,t[a+1]=0,t[a+2]=i,t[a+3]=255}}class Io extends rt{static format=Je.BIN;static cloudImageProcessParam="";async parseBuffer(e){switch(qi(e).mode){case Sa.Splat:{const a=Ro(e),r={count:a.vertexCount,position:a.position,rotation:a.rotation,scale:a.scale,opacity:a.opacity,sh:a.sh};r.bbox=ko(a.position);const i=new d.Object3D;i.name="GaussianSplat",i.addComponent(d.GSplatRenderer).initAsset(r),this.data=i;break}case Sa.PointCloud:{const a=vh(e),r=new d.Object3D;r.name="PLYPointCloud";const i=new d.Object3D;i.name="PLYPointCloudRoot",r.addChild(i);const s=i.addComponent(d.PointCloudRenderer);if(a.color)s.initFromData(a.position,a.color,a.vertexCount);else{const o=new Uint8Array(a.vertexCount*4);o.fill(255),s.initFromData(a.position,o,a.vertexCount)}s.setPointShape("circle"),s.setPointSize(4),this.data=r;break}case Sa.Mesh:{const a=Bh(e),r=new d.Object3D;r.name="PLYMesh";const i=new Map;if(a.triangleTexnumbers&&a.triangleTexnumbers.length>0)for(let o=0;o<a.triangleTexnumbers.length;o++){const l=a.triangleTexnumbers[o];i.has(l)||i.set(l,[]),i.get(l).push(o)}else{const o=a.indices.length/3,l=[];for(let c=0;c<o;c++)l.push(c);i.set(0,l)}const s=new Map;if(a.textureFiles&&a.textureFiles.length>0){const o=[];for(let l=0;l<a.textureFiles.length;l++){const c=new qt,f=It.normalizePath(this.baseUrl+a.textureFiles[l]);o.push(B.res.loadTexture(f+Io.cloudImageProcessParam).then(h=>{c.baseMap=h,s.set(l,c)}))}await Promise.all(o)}s.size===0&&s.set(0,new qt);for(const[o,l]of i){const c=[];for(const A of l){const m=A*3;c.push(a.indices[m+0],a.indices[m+1],a.indices[m+2])}const f=new Ve;f.setAttribute(G.position,a.position),f.setAttribute(G.normal,a.normal),a.uv&&f.setAttribute(G.uv,a.uv),a.color&&f.setAttribute(G.color,a.color),f.setIndices(new Uint32Array(c)),f.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let h=s.get(o);h||(h=s.values().next().value||new qt);const u=new d.Object3D;u.name=`PLYMesh_Texture_${o}`;const b=u.addComponent(d.MeshRenderer);b.geometry=f,b.material=h,r.addChild(u)}this.data=r;break}}}verification(){return!!this.data}}class Sh{async parse(e){const t=new DataView(e),a=ti(t);console.assert(a==="pnts");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const s=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,h=new Ri(e,f,s,o),u=f+s+o,b=h.header.POINTS_LENGTH||0,A=new Fs(e,b,u,l,c);return{version:r,featureTable:h,batchTable:A}}}class xh extends Sh{async parse(e){const t=await super.parse(e),{featureTable:a,batchTable:r}=t,i=a.header.POINTS_LENGTH;if(!i||i<=0)throw new Error("PNTSLoader: POINTS_LENGTH must be defined and greater than zero");const o=a.header.extensions?.["3DTILES_draco_point_compression"];let l,c;if(o){const b=await this.parseDraco(a,o,i);l=b.positions,c=b.colors,b.normals}else l=this.parsePositions(a,i),c=this.parseColors(a,i),this.parseNormals(a,i);const f=new d.Object3D,h=f.addComponent(d.PointCloudRenderer);h.initFromData(l,c,i),h.setPointShape("circle"),h.setPointSize(4);const u=a.getData("RTC_CENTER",1,"FLOAT","VEC3");return u&&f.transform.localPosition.set(u[0],u[1],u[2]),f.batchTable=r,f.featureTable=a,f}parsePositions(e,t){let a=e.getData("POSITION",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("POSITION_QUANTIZED",t,"UNSIGNED_SHORT","VEC3");if(!r)throw new Error("PNTSLoader: Either POSITION or POSITION_QUANTIZED must be defined");const i=e.getData("QUANTIZED_VOLUME_SCALE",1,"FLOAT","VEC3"),s=e.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3");if(!i||!s)throw new Error("PNTSLoader: QUANTIZED_VOLUME_SCALE and QUANTIZED_VOLUME_OFFSET must be defined for quantized positions");const o=new Float32Array(t*3),l=65535;for(let c=0;c<t;c++){const f=c*3;o[f+0]=r[f+0]/l*i[0]+s[0],o[f+1]=r[f+1]/l*i[1]+s[1],o[f+2]=r[f+2]/l*i[2]+s[2]}return o}parseColors(e,t){let a=e.getData("RGBA",t,"UNSIGNED_BYTE","VEC4");if(a)return a;const r=e.getData("RGB",t,"UNSIGNED_BYTE","VEC3");if(r){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*3,h=c*4;l[h+0]=r[f+0],l[h+1]=r[f+1],l[h+2]=r[f+2],l[h+3]=255}return l}const i=e.getData("RGB565",t,"UNSIGNED_SHORT","SCALAR");if(i){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=this.decodeRGB565(i[c]),h=c*4;l[h+0]=f[0],l[h+1]=f[1],l[h+2]=f[2],l[h+3]=255}return l}const s=e.getData("CONSTANT_RGBA",1,"UNSIGNED_BYTE","VEC4");if(s){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*4;l[f+0]=s[0],l[f+1]=s[1],l[f+2]=s[2],l[f+3]=s[3]}return l}const o=new Uint8Array(t*4);return o.fill(255),o}parseNormals(e,t){let a=e.getData("NORMAL",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("NORMAL_OCT16P",t,"UNSIGNED_BYTE","VEC2");return r?this.decodeOctNormals(r,t):null}decodeRGB565(e){const t=(e>>11&31)<<3,a=(e>>5&63)<<2,r=(e&31)<<3;return[t,a,r]}decodeOctNormals(e,t){const a=new Float32Array(t*3);for(let r=0;r<t;r++){const i=r*2,s=e[i]/255,o=e[i+1]/255,l=s*2-1,c=o*2-1,f=1-Math.abs(l)-Math.abs(c);let h,u;f<0?(h=(l>=0?1:-1)*(1-Math.abs(c)),u=(c>=0?1:-1)*(1-Math.abs(l))):(h=l,u=c);const b=Math.sqrt(h*h+u*u+f*f),A=r*3;a[A+0]=h/b,a[A+1]=u/b,a[A+2]=f/b}return a}async parseDraco(e,t,a){throw new Error("Draco compression not yet implemented")}}class Fh extends rt{static format=Je.BIN;async parseBuffer(e){const a=await new xh().parse(e),r=new d.Object3D;r.name="PNTS",r.addChild(a),this.data=r}verification(){if(this.data)return!0;throw new Error("PNTSParser: Parse failed")}}class To{boneName;bonePath;parentBoneName;boneID;parentBoneID;instanceID;parentInstanceID;t;q;s;formBytes(e){this.boneName=e.readUTF(),this.bonePath=e.readUTF(),this.parentBoneName=e.readUTF(),this.boneID=e.readInt32(),this.parentBoneID=e.readInt32(),this.instanceID=e.readUTF(),this.parentInstanceID=e.readUTF(),this.t=e.readVector3(),this.q=e.readQuaternion(),this.s=e.readVector3()}}class Qo{name;count;boneData;boneMap;formBytes(e){this.boneData=[],this.boneMap=new Map,this.name=e.readUTF(),this.count=e.readInt32();for(let t=0;t<this.count;t++){let a=new To;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class kh extends rt{static format=Je.BIN;static parser(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Qo;i.formBytes(e.readBytesArray()),B.res.addObj(i.name,i)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}G.position,G.normal,G.color,G.TANGENT,G.uv,G.TEXCOORD_1,G.TEXCOORD_2,G.TEXCOORD_2,G.TEXCOORD_4,G.TEXCOORD_5,G.TEXCOORD_6,G.TEXCOORD_7,G.joints0,G.weights0;var H=(n=>(n[n.single=0]="single",n[n.boolean=1]="boolean",n[n.int=2]="int",n[n.int16=3]="int16",n[n.int32=4]="int32",n[n.float=5]="float",n[n.long=6]="long",n[n.uint=7]="uint",n[n.uint32=8]="uint32",n[n.uint64=9]="uint64",n[n.double=10]="double",n[n.string=11]="string",n[n.singleArray=12]="singleArray",n[n.stringArray=13]="stringArray",n[n.floatArray=14]="floatArray",n[n.vector2=15]="vector2",n[n.vector3=16]="vector3",n[n.vector4=17]="vector4",n[n.color=18]="color",n[n.color32=19]="color32",n[n.animationCurve=20]="animationCurve",n[n.quaternion=21]="quaternion",n[n.matrix4x4=22]="matrix4x4",n[n.mesh=23]="mesh",n[n.texture=24]="texture",n[n.material=25]="material",n[n.materials=26]="materials",n[n.skeleton=27]="skeleton",n[n.animClip=28]="animClip",n[n.vector2Int=29]="vector2Int",n[n.int32List=30]="int32List",n[n.colorList=31]="colorList",n[n.color32List=32]="color32List",n))(H||{});class Os{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=il(t);if(r){let i=new Dt;return i.shader=new r,i}else throw new Error("not found shader, shader name is "+t)}static applyMaterialTexture(e,t){for(let a=0;a<t.length;a++){const r=t[a];r.property in e?e[r.property]=r.texture:r.property in e.shader?e.shader[r.property]=r.texture:e.setTexture(r.property,r.texture)}}static applyMaterialProperties(e,t){for(let a=0;a<t.length;a++){const r=t[a],i=r.key;switch(r.type){case H.color:case H.color32:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformColor(i,s)}break;case H.single:case H.float:case H.int:case H.int16:case H.int32:case H.uint:case H.uint32:case H.uint64:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.singleArray:{let s=r.getValue()[0];i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.vector2:case H.vector2Int:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector2(i,s)}break;case H.vector3:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector3(i,s)}break;case H.vector4:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector4(i,s)}break}}}}class Va{static parser(e){switch(e.readInt32()){case H.single:return{t:H.single,v:e.readFloat32()};case H.boolean:return{t:H.boolean,v:e.readBoolean()};case H.int:return{t:H.int,v:e.readInt32()};case H.int16:return{t:H.int16,v:e.readInt16()};case H.int32:return{t:H.int32,v:e.readInt32()};case H.float:return{t:H.float,v:e.readFloat32()};case H.long:return{t:H.long,v:e.readFloat64()};case H.uint:return{t:H.uint,v:e.readUnit32()};case H.uint32:return{t:H.uint32,v:e.readUnit32()};case H.uint64:return{t:H.uint64,v:e.readUnit32()};case H.double:return{t:H.double,v:e.readFloat64()};case H.string:return{t:H.string,v:e.readUTF()};case H.singleArray:return{t:H.singleArray,v:e.readFloatArray()};case H.stringArray:return{t:H.stringArray,v:e.readStringArray()};case H.floatArray:return{t:H.floatArray,v:e.readFloatArray()};case H.vector2:return{t:H.vector2,v:e.readVector2()};case H.vector3:return{t:H.vector3,v:e.readVector3()};case H.vector4:return{t:H.vector4,v:e.readVector4()};case H.color:return{t:H.color,v:e.readColor()};case H.color32:return{t:H.color32,v:e.readColor()};case H.animationCurve:return{t:H.animationCurve,v:null};case H.quaternion:return{t:H.quaternion,v:e.readQuaternion()};case H.matrix4x4:return{t:H.matrix4x4,v:null};case H.mesh:{let o=e.readUTF(),l=B.res.getGeometry(o);return{t:H.mesh,v:l}}case H.texture:{let o=e.readUTF(),l=B.res.getTexture(o);return{t:H.texture,v:l}}case H.material:{let o=e.readUTF(),l=B.res.getMat(o);return{t:H.material,v:l}}case H.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let h=B.res.getMat(f);l.push(h)}return{t:H.materials,v:l}}case H.skeleton:break;case H.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new Zo;f.formBytes(e),o.push(f)}return{t:H.animClip,v:o}}case H.vector2Int:return{t:H.vector2Int,v:e.readVector2int()};case H.int32List:return{t:H.int32List,v:e.readInt32List()};case H.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Va.parser(e).v;r.push(l)}return{t:H.colorList,v:r};case H.color32List:let i=e.readInt32(),s=[];for(let o=0;o<i;o++){const l=Va.parser(e).v;s.push(l)}return{t:H.color32List,v:s}}}}class Mo{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Va.parser(e);this.type=t,this._data=a}}class Eh{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class wh extends rt{static format=Je.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),s=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],h=[],u=i.readInt32();for(let m=0;m<u;m++){let p=new Mo;p.formBytes(i),f.push(p)}let b=i.readInt32();for(let m=0;m<b;m++){let p=i.readBytesArray(),D=new Eh;D.property=p.readUTF(),D.name=p.readUTF(),D.texture=B.res.getTexture(D.name),D.texelSize=p.readVector2(),D.wrapModeU=p.readUnit32(),D.wrapModeV=p.readUnit32(),D.wrapModeW=p.readUnit32(),D.wrapMode=p.readUnit32(),D.anisoLevel=p.readUnit32(),D.dimension=p.readUnit32(),D.filterMode=p.readUnit32(),h.push(D)}let A=Os.GetMaterial(c);A.name=s;for(let m=0;m<l.length;m++){const p=l[m];A.shader.setDefine(p,!0)}Os.applyMaterialTexture(A,h),Os.applyMaterialProperties(A,f),B.res.addMat(o,A)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Po{shapeName;shapeIndex;frameCount;blendPositionList=new Float32Array;blendNormalList=new Float32Array;formBytes(e){let t=e.readBytesArray();this.shapeName=t.readUTF(),this.shapeIndex=t.readInt32(),this.frameCount=t.readInt32();let a=t.readInt32();this.blendPositionList=t.readFloat32Array(a*3);let r=t.readInt32();this.blendNormalList=t.readFloat32Array(r*3)}}class No{vertexCount;shapeNames;shapeIndexs;blendCount;blendShapePropertyDatas;blendShapeMap;formBytes(e){this.blendShapeMap=new Map,this.blendShapePropertyDatas=[];let t=e.readBytesArray();this.vertexCount=t.readInt32(),this.shapeNames=t.readStringArray(),this.shapeIndexs=t.readIntArray(),this.blendCount=t.readInt32();for(let a=0;a<this.blendCount;a++){let r=new Po;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class Rh{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class Ih extends rt{static format=Je.BIN;async parseBuffer(e){}static parserMeshs(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Rh,s=e.readBytesArray();i.meshName=s.readUTF(),i.meshID=s.readUTF(),s.readFloat32()>0,s.readFloat32()>0,s.readFloat32()>0;let o=s.readFloat32()>0,l=s.readFloat32()>0;o&&(i.bones=s.readStringArray(),i.bindPose=s.readMatrix44Array()),l&&(i.blendShapeData=new No,i.blendShapeData.formBytes(s));let c=s.readBytesArray(),f=s.readBytesArray(),h=c.readInt32(),u=0,b=[];for(let _=0;_<h;_++)b[_]={},b[_].att=Bm[c.readUTF()],b[_].dim=c.readInt32(),u+=b[_].dim,b[_].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let A=s.readInt32Array(),m=[],p=s.readInt32();for(let _=0;_<p;_++){let v=s.readInt32(),U=s.readInt32(),y=s.readInt32(),S=s.readInt32(),F=s.readInt32(),k=s.readInt32();s.readVector3(),s.readVector3();let x={indexStart:U,indexCount:y,vertexStart:S,vertexCount:k,firstStart:F,topology:v,index:_};m.push(x)}A.length>65535?i.indices=new Uint32Array(A):i.indices=new Uint16Array(A);let D=new Ve;if(D.vertexDim=u,D.geometryType=kt.compose_bin,D.setIndices(i.indices),D.setAttribute(G.all,i.vertexBuffer),o&&(D.skinNames=i.bones,D.bindPose=i.bindPose),l){D.blendShapeData=i.blendShapeData,D.morphTargetsRelative=!0,D.morphTargetDictionary={};for(let _=0;_<i.blendShapeData.blendCount;_++){D.setAttribute("a_morphPositions_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendPositionList),D.setAttribute("a_morphNormals_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendNormalList);for(let v=0;v<i.blendShapeData.blendCount;v++){let U=i.blendShapeData.shapeNames[v],y=i.blendShapeData.shapeIndexs[v];D.morphTargetDictionary[U]=y}}}for(let _=0;_<b.length;_++){const v=b[_].att;D.setAttribute(v,null)}for(let _=0;_<m.length;_++){const v=m[_];D.addSubGeometry(v)}D.name=i.meshName,B.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let Bm={Position:G.position,Normal:G.normal,Color:G.color,Tangent:G.TANGENT,TexCoord0:G.uv,TexCoord1:G.TEXCOORD_1,TexCoord2:G.TEXCOORD_2,TexCoord3:G.TEXCOORD_2,TexCoord4:G.TEXCOORD_4,TexCoord5:G.TEXCOORD_5,TexCoord6:G.TEXCOORD_6,TexCoord7:G.vIndex,BlendIndices:G.joints0,BlendWeight:G.weights0};class Ls extends DataView{get buffer(){return super.buffer}get byteOffset(){return super.byteOffset}get byteLength(){return super.byteLength}getInt16(e,t){return super.getInt16(e,t)}getInt32(e,t){return super.getInt32(e,t)}getFloat32(e,t){return super.getFloat32(e,t)}getFloat64(e,t){return super.getFloat64(e,t)}getUint8(e){return super.getUint8(e)}getUint32(e,t){return super.getUint32(e,t)}getInt8(e){return super.getInt8(e)}getUint16(e,t){return super.getUint16(e,t)}position=0;littleEndian=!0;constructor(e,t,a){super(e,t,a),this.position=0,this.position+=this.byteOffset}readUTF(){let e=this.readInt32(),t=e%4;t>0&&t<4&&(t=4-t);let a="",r=new Int8Array(this.buffer,this.position,e);return this.position+=e*Int8Array.BYTES_PER_ELEMENT,a+=String.fromCharCode.apply(null,r),this.position+=t*Int8Array.BYTES_PER_ELEMENT,a}readStringArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readUTF());return e}readByte(){let e=this.buffer[this.position];return this.position+=1,e}readBoolean(){let e=this.readInt32();return this.position+=4,e==1}readBytes(e){let t=new DataView(this.buffer,this.position,e);return this.position+=e,t.buffer}readBytesArray(){let e=this.readInt32(),t=new Ls(this.buffer.slice(this.position,this.position+e));return this.position+=e,t}readUnit8(){let e=this.getUint8(this.position);return this.position+=Uint8Array.BYTES_PER_ELEMENT,e}readUnit16(){let e=this.getUint16(this.position);return this.position+=Uint16Array.BYTES_PER_ELEMENT,e}readUnit32(){let e=this.getUint32(this.position);return this.position+=Uint32Array.BYTES_PER_ELEMENT,e}readInt8(){let e=this.getInt8(this.position);return this.position+=Int8Array.BYTES_PER_ELEMENT,e}readInt16(){let e=this.getInt16(this.position,this.littleEndian);return this.position+=Int16Array.BYTES_PER_ELEMENT,e}readInt32(){let e=this.getInt32(this.position,this.littleEndian);return this.position+=Int32Array.BYTES_PER_ELEMENT,e}readFloat32(){let e=this.getFloat32(this.position,this.littleEndian);return this.position+=Float32Array.BYTES_PER_ELEMENT,e}readFloat64(){let e=this.getFloat64(this.position,this.littleEndian);return this.position+=Float64Array.BYTES_PER_ELEMENT,e}readInt32Array(){let e=this.readInt32(),t=new Int32Array(this.buffer,this.position,e);return t=t.slice(0,e),this.position+=t.byteLength,t}readInt32List(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++)t.push(this.readInt32());return t}readFloatArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readFloat32();t.push(r)}return t}readIntArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readInt32();t.push(r)}return t}readVector2int(){let e=new fe;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new fe;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new g;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e}readVector3Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector3());return e}readVector4(){let e=new ue;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readVector4Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector4());return e}readColor(){let e=new Z;return e.r=this.readFloat32(),e.g=this.readFloat32(),e.b=this.readFloat32(),e.a=this.readFloat32(),e}readColorArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readColor());return e}readQuaternion(){let e=new ne;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readQuaternionArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readQuaternion());return e}readMatrix44(){let e=new T,t=e.rawData;return t[0]=this.readFloat32(),t[1]=this.readFloat32(),t[2]=this.readFloat32(),t[3]=this.readFloat32(),t[4]=this.readFloat32(),t[5]=this.readFloat32(),t[6]=this.readFloat32(),t[7]=this.readFloat32(),t[8]=this.readFloat32(),t[9]=this.readFloat32(),t[10]=this.readFloat32(),t[11]=this.readFloat32(),t[12]=this.readFloat32(),t[13]=this.readFloat32(),t[14]=this.readFloat32(),t[15]=this.readFloat32(),e}readMatrix44Array(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readMatrix44();t.push(r)}return t}readFloat32Array(e){let t=new DataView(this.buffer),a=new Float32Array(e);for(let r=0;r<e;r++)a[r]=t.getFloat32(this.position+r*Float32Array.BYTES_PER_ELEMENT,this.littleEndian);return this.position+=e*Float32Array.BYTES_PER_ELEMENT,a}getFloat32Array(){let e=new Float32Array(this.buffer,this.byteOffset,this.byteLength/Float32Array.BYTES_PER_ELEMENT);return e=e.slice(0,this.byteLength),e}}class Th extends rt{static format=Je.TEXT;static async parserTexture(e,t,a){let r=e.readInt32(),i=[];for(let o=0;o<r;o++){let l=e.readUTF();Qh.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let s=await B.res.loadBitmapTextures(i,B.setting.loader.numConcurrent,a,!0);for(const o of s)B.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var vm=Object.getOwnPropertyDescriptor,Um=(n,e,t,a)=>{for(var r=a>1?void 0:a?vm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitSSSShader=class extends gt{constructor(){super(),X.register("PBRLitSSSShader",_d);let e=new qe("PBRLitSSSShader","PBRLitSSSShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefine("USE_CUSTOMUNIFORM",!0),this.setDefault(),this.computes=[new hh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(1,1,1)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new Z(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _SSSMap(e){this.setTexture("sssMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SkinColor(e){this.setUniformColor("skinColor",e)}set _SkinPower(e){this.setUniformFloat("skinPower",e)}set _SkinColorIns(e){this.setUniformFloat("skinColorIns",e)}set curveFactor(e){this.setUniformFloat("curveFactor",e)}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitSSSShader=Um([Ta(d.LitSSSShader,"LitSSSShader")],d.LitSSSShader);var ym=Object.getOwnPropertyDescriptor,Cm=(n,e,t,a)=>{for(var r=a>1?void 0:a?ym(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitShader=class extends gt{constructor(){super();let e=new qe("PBRLItShader","PBRLItShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(0,0,0)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=B.res.grayTexture,this._BumpMap=B.res.normalTexture,this._MaskTex=B.res.maskTexture}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitShader=Cm([Ta(d.LitShader,"LitShader")],d.LitShader);class Gs{comName;data;static parser(e){let t=e.readBytesArray(),a=new Gs;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let s=new Mo;s.formBytes(t),a.data.push(s)}return a}}class $i{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new $i;a.name=t.readUTF(),a.parentName=t.readUTF(),a.position=t.readVector3(),a.rotation=t.readQuaternion(),a.scale=t.readVector3(),a.comDatas=[],a.child=[];let r=t.readInt32();for(let s=0;s<r;s++){const o=Gs.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let s=0;s<i;s++){const o=$i.parser(t);a.child.push(o)}return a}}class Qh extends rt{static useWebp=!0;static format=Je.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new Ls(e,0);await Th.parserTexture(t,this,this.loaderFunctions),kh.parser(t,this),Ih.parserMeshs(t,this),wh.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return $i.parser(e)}parserNodeTree(e){let t=new d.Object3D;if(t.localPosition=g.serialize(e.position),t.localQuaternion=ne.serialize(e.rotation),t.localScale=g.serialize(e.scale),t.name=e.name,e.comDatas)for(let a=0;a<e.comDatas.length;a++){const r=e.comDatas[a];let i=null,s=rl(r.comName);if(s){i=t.getOrAddComponent(s);for(let o=0;o<r.data.length;o++){const l=r.data[o];l.key in i&&(i[l.key]=l.getValue())}}}if(e.child&&e.child.length>0)for(let a=0;a<e.child.length;a++){let r=this.parserNodeTree(e.child[a]);t.addChild(r)}return t}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Sm{static getNumber(e){return parseFloat(e)}static getInt(e){return parseInt(e)}static getBoolean(e){return e=="true"}static getNumberArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(",");for(let r=0;r<a.length;r++)parseFloat(a[r]);return t}static getStringArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(","),r=[];for(let i=0;i<a.length;i++){const s=a[i];r.push(s)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var xm=Object.getOwnPropertyDescriptor,Fm=(n,e,t,a)=>{for(var r=a>1?void 0:a?xm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitShader=class extends gt{constructor(){super();let e=new qe("UnLit","UnLit");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformFloat("alphaCutoff",0)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitShader=Fm([Ta(d.UnLitShader,"UnLitShader")],d.UnLitShader);var km=Object.getOwnPropertyDescriptor,Em=(n,e,t,a)=>{for(var r=a>1?void 0:a?km(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitTexArrayShader=class extends gt{constructor(){super(),X.register("VertexAttributeIndexShader",pd),X.register("UnLitTextureArray",Bd);let e=new qe("UnLitTextureArray","UnLitTextureArray");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformFloat("alphaCutoff",0)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitTexArrayShader=Em([Ta(d.UnLitTexArrayShader,"UnLitTexArrayShader")],d.UnLitTexArrayShader);const vr=-1,Ur=0,Vo=1,Mh=2,Oa=3,wm=6378137,Rm=1/298.257223563,Im=6356752314245179e-9,Tm=Symbol("PLUGIN_REGISTERED");class Oo{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=Ur;used=!1;visible=!1;active=!1;inFrustum=!1;error=1/0;distanceFromCamera=1/0;depth=0;depthFromRenderedParent=0;lastFrameVisited=-1;isLeaf=!1;allChildrenReady=!1;hasContent=!1;hasRenderableContent=!1;hasUnrenderableContent=!1;childrenProcessed=0;usedLastFrame=!1;priority;canTraverse=!1;canTraverseFrame=-1;basePath="";cached={};constructor(e,t=null){if(this.boundingVolume=e.boundingVolume,this.geometricError=e.geometricError,this.refine=e.refine,this.content=e.content,this.contents=e.contents,this.transform=e.transform,this.extensions=e.extensions,this.extras=e.extras,this.parent=t,this.depth=t?t.depth+1:0,this.depthFromRenderedParent=t?.hasContent?0:t?t.depthFromRenderedParent+1:0,this.hasContent=!!(this.content||this.contents&&this.contents.length>0),this.content?.uri){const a=this.content.uri.toLowerCase();this.hasUnrenderableContent=a.endsWith("tileset.json"),this.hasRenderableContent=!this.hasUnrenderableContent}else this.contents&&this.contents.length>0&&(this.hasRenderableContent=!0)}addChild(e){e.parent=this,e.depth=this.depth+1,e.depthFromRenderedParent=this.hasContent?0:this.depthFromRenderedParent+1,this.children.push(e)}resetFrameState(e){this.lastFrameVisited!==e&&(this.lastFrameVisited=e,this.used=!1,this.inFrustum=!1,this.isLeaf=!1,this.visible=!1,this.active=!1,this.error=1/0,this.distanceFromCamera=1/0,this.allChildrenReady=!1)}}const Ph=2**30;class Nh{minSize=6e3;maxSize=8e3;minBytesSize=.3*Ph;maxBytesSize=.4*Ph;unloadPercent=.05;autoMarkUnused=!0;_itemSet=new Map;_itemList=[];_usedSet=new Set;_callbacks=new Map;_unloadingHandle=-1;_cachedBytes=0;_bytesMap=new Map;_loadedSet=new Set;_unloadPriorityCallback=null;set unloadPriorityCallback(e){this._unloadPriorityCallback=e}get unloadPriorityCallback(){return this._unloadPriorityCallback}isFull(){return this._itemSet.size>=this.maxSize||this._cachedBytes>=this.maxBytesSize}getMemoryUsage(e){return this._bytesMap.get(e)||0}setMemoryUsage(e,t){if(!this._itemSet.has(e))return;const a=this._bytesMap.get(e)||0;this._cachedBytes-=a,this._bytesMap.set(e,t),this._cachedBytes+=t}add(e,t){return this._itemSet.has(e)||this.isFull()?!1:(this._itemList.push(e),this._usedSet.add(e),this._itemSet.set(e,Date.now()),this._callbacks.set(e,t),this._loadedSet.add(e),!0)}has(e){return this._itemSet.has(e)}remove(e){if(!this._itemSet.has(e))return!1;const t=this._bytesMap.get(e)||0;this._cachedBytes-=t,this._bytesMap.delete(e);const a=this._callbacks.get(e);a&&a(e);const r=this._itemList.indexOf(e);return r!==-1&&this._itemList.splice(r,1),this._usedSet.delete(e),this._itemSet.delete(e),this._callbacks.delete(e),this._loadedSet.delete(e),!0}markUsed(e){this._itemSet.has(e)&&(this._usedSet.add(e),this._itemSet.set(e,Date.now()))}markUnused(e){this._usedSet.delete(e)}scheduleUnload(){this._unloadingHandle===-1&&(this._unloadingHandle=requestAnimationFrame(()=>{this._unloadingHandle=-1,this._performUnload()}))}_performUnload(){if(!(this._itemSet.size>this.minSize||this._cachedBytes>this.minBytesSize))return;this.autoMarkUnused&&this._itemSet.forEach((o,l)=>{this._usedSet.has(l)||this.markUnused(l)});const t=[];this._itemList.forEach(o=>{this._usedSet.has(o)||t.push(o)}),this._unloadPriorityCallback&&t.sort(this._unloadPriorityCallback);const a=Math.floor(this._itemSet.size*(1-this.unloadPercent)),r=this._cachedBytes-(this._cachedBytes-this.minBytesSize);let i=0,s=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-s<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,s+=c)}}clear(){Array.from(this._itemSet.keys()).forEach(t=>this.remove(t))}getStats(){return{size:this._itemSet.size,bytes:this._cachedBytes,usedCount:this._usedSet.size}}}class Lo{maxJobs=6;priorityCallback=null;_items=[];_callbacks=new Map;_currJobs=0;get running(){return this._items.length!==0||this._currJobs!==0}sort(){this.priorityCallback&&this._items.sort(this.priorityCallback)}has(e){return this._callbacks.has(e)}add(e,t){if(this._callbacks.has(e))return this._callbacks.get(e).promise;let a,r;const i=new Promise((o,l)=>{a=o,r=l}),s={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,s),i}remove(e){const t=this._items.indexOf(e);if(t!==-1){const a=this._callbacks.get(e);a&&(a.promise.catch(()=>{}),a.reject(new Error("PriorityQueue: Item removed."))),this._items.splice(t,1),this._callbacks.delete(e)}}removeByFilter(e){const t=[];this._items.forEach(a=>{e(a)&&t.push(a)}),t.forEach(a=>this.remove(a))}update(){this._tryRunJobs()}_tryRunJobs(){this.sort();const e=this.maxJobs;let t=0;const a=()=>{this._currJobs--};for(;e>this._currJobs&&this._items.length>0&&t<e;){this._currJobs++,t++;const r=this._items.shift(),i=this._callbacks.get(r);this._callbacks.delete(r),Promise.resolve(i.callback(r)).then(()=>{i.resolve(),a()}).catch(s=>{i.reject(s),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function Vh(n,e=null,t=null){const a=[];for(a.push(n),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),s=a.pop();if(e&&e(s,i,r)===!0){t&&t(s,i,r);return}const o=s.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(s),a.push(r+1);if(t&&t(s,i,r)===!0)return}}function Qm(n,e){let t=n;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const zs={inView:!1,error:1/0,distanceFromCamera:1/0},Oh=!0;function Lh(n){return n===Oa||n===vr}function yr(n,e){return n.lastFrameVisited===e&&n.used}function Gh(n){return n.childrenProcessed===n.children.length}function Go(n){return n.hasUnrenderableContent||n.parent!==null&&n.parent.geometricError<n.geometricError}function zo(n,e){n.lastFrameVisited!==e.frameCount&&(n.usedLastFrame=n.used,n.lastFrameVisited=e.frameCount,n.used=!1,n.inFrustum=!1,n.isLeaf=!1,n.visible=!1,n.active=!1,n.error=1/0,n.distanceFromCamera=1/0,n.allChildrenReady=!1,e.calculateTileViewError(n,zs),n.inFrustum=zs.inView,n.error=zs.error,n.distanceFromCamera=zs.distanceFromCamera)}function Wo(n,e,t=!1){n.used||(t||(n.used=!0,e.stats.used++),e.markTileUsed(n),n.inFrustum===!0&&e.stats.inFrustum++)}function Mm(n,e){if(n.canTraverse&&n.canTraverseFrame===e.frameCount)return n.canTraverse;let t=!1;return n.error<=e.errorTarget&&!Go(n)||n.depth>=e.maxDepth||!n.children||n.children.length===0?t=!1:t=!0,n.canTraverse=t,n.canTraverseFrame=e.frameCount,t}function Jo(n,e,t=!1){if(e.ensureChildrenArePreprocessed(n),zo(n,e),Wo(n,e,t),Go(n)&&Gh(n)){const a=n.children;for(let r=0,i=a.length;r<i;r++)Jo(a[r],e,t)}}function Ws(n,e){if(e.ensureChildrenArePreprocessed(n),zo(n,e),!n.inFrustum)return;if(!Mm(n,e)){Wo(n,e);const s=n.children;if(!n.hasContent&&s&&s.length>0)for(let o=0,l=s.length;o<l;o++){const c=s[o];Ws(c,e)}return}const a=n.children;let r=!1,i=!1;for(let s=0,o=a.length;s<o;s++){const l=a[s];Ws(l,e),r=r||yr(l,e.frameCount),i=i||l.inFrustum}if(n.refine==="REPLACE"&&!i&&a.length!==0){n.inFrustum=!1;for(let s=0,o=a.length;s<o;s++)Jo(a[s],e,!0);return}if(Wo(n,e),n.refine==="REPLACE"&&(r&&n.depth!==0||Oh))for(let s=0,o=a.length;s<o;s++)Jo(a[s],e)}function jo(n,e){const t=e.frameCount;if(!yr(n,t))return;const a=n.children;let r=!1;for(let i=0,s=a.length;i<s;i++){const o=a[i];r=r||yr(o,t)}if(!r)n.isLeaf=!0;else{let i=!0;for(let s=0,o=a.length;s<o;s++){const l=a[s];if(jo(l,e),yr(l,t)){const c=!Go(l);let f=!l.hasContent||l.hasRenderableContent&&Lh(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===vr;f=c&&f||l.allChildrenReady,i=i&&f}}n.allChildrenReady=i}}function zh(n,e){if(e.ensureChildrenArePreprocessed(n),yr(n,e.frameCount)&&(n.hasContent&&e.queueTileForDownload(n),Gh(n))){const t=n.children;for(let a=0,r=t.length;a<r;a++)zh(t[a],e)}}function Js(n,e){const t=e.stats;if(!yr(n,e.frameCount))return;if(n.isLeaf){n.loadingState===Oa?(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++):n.hasContent&&e.queueTileForDownload(n);return}const a=n.children,r=n.hasContent,i=Lh(n.loadingState)&&r,s=(e.errorTarget+1)*(e.errorThreshold||1),o=n.error<=s,l=n.refine==="ADD",c=n.allChildrenReady||n.depth===0&&!Oh;if(r&&(o||l)&&e.queueTileForDownload(n),(o&&i&&!c||i&&l)&&(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++),!l&&o&&!c)for(let f=0,h=a.length;f<h;f++){const u=a[f];yr(u,e.frameCount)&&zh(u,e)}else for(let f=0,h=a.length;f<h;f++)Js(a[f],e)}function js(n,e){const t=yr(n,e.frameCount);if(t||n.usedLastFrame){let a=!1,r=!1;if(t?(a=n.active,r=n.visible):zo(n,e),n.hasRenderableContent&&n.loadingState===Oa){const s=n.__wasSetVisible;n.__wasSetActive!==a&&(e.setTileDelayedActive(n,a),n.__wasSetActive=a),s!==r&&(e.setTileDelayedVisible(n,r),n.__wasSetVisible=r)}n.usedLastFrame=t;const i=n.children;for(let s=0,o=i.length;s<o;s++)js(i[s],e)}}class Vr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Vr.s_tmpMatrix||(Vr.s_tmpMatrix=new T),this._data=e,e.box)this._type="box",this._parseBox(e.box);else if(e.sphere)this._type="sphere",this._parseSphere(e.sphere);else if(e.region)this._type="region",this._parseRegion(e.region);else throw new Error("BoundingVolume: Invalid bounding volume data")}_parseBox(e){if(e.length!==12)throw new Error("BoundingVolume: Box must have 12 elements");const t=new g(e[0],e[1],e[2]),a=new g(e[3],e[4],e[5]),r=new g(e[6],e[7],e[8]),i=new g(e[9],e[10],e[11]),s=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),h=i.clone().normalize();this._matrix=new T;const u=this._matrix.rawData;u[0]=c.x,u[1]=c.y,u[2]=c.z,u[3]=0,u[4]=f.x,u[5]=f.y,u[6]=f.z,u[7]=0,u[8]=h.x,u[9]=h.y,u[10]=h.z,u[11]=0,u[12]=t.x,u[13]=t.y,u[14]=t.z,u[15]=1;const b=new g(s*2,o*2,l*2);this._box=new Ce(new g(0,0,0),b)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new g(e[0],e[1],e[2]),a=e[3];this._sphere=new Tr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,s,o]=e,l=new g((t+r)/2,(a+i)/2,(s+o)/2),c=new g(Math.abs(r-t),Math.abs(i-a),Math.abs(o-s));this._box=new Ce(l,c),this._matrix=new T,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new g(a.x-r,a.y-r,a.z-r),s=new g(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,s),t){const o=[new g(i.x,i.y,i.z),new g(s.x,i.y,i.z),new g(i.x,s.y,i.z),new g(s.x,s.y,i.z),new g(i.x,i.y,s.z),new g(s.x,i.y,s.z),new g(i.x,s.y,s.z),new g(s.x,s.y,s.z)];o.forEach(l=>{const c=new g;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Vr.s_tmpMatrix;if(a.identity(),this._matrix?t?a.multiplyMatrices(t,this._matrix):a.copyFrom(this._matrix):t&&a.copyFrom(t),a){const r=this._box,i=[new g(r.min.x,r.min.y,r.min.z),new g(r.max.x,r.min.y,r.min.z),new g(r.min.x,r.max.y,r.min.z),new g(r.max.x,r.max.y,r.min.z),new g(r.min.x,r.min.y,r.max.z),new g(r.max.x,r.min.y,r.max.z),new g(r.min.x,r.max.y,r.max.z),new g(r.max.x,r.max.y,r.max.z)];i.forEach(s=>{const o=new g;a.transformPoint(s,o),s.copyFrom(o)}),e.makeEmpty(),i.forEach(s=>{e.expandByPoint(s)})}else e.setFromMinMax(this._box.min,this._box.max);return e}throw new Error("BoundingVolume: Invalid state")}getOBB(e,t){this._type==="box"&&this._box&&this._matrix?(e.setFromMinMax(this._box.min,this._box.max),t.copyFrom(this._matrix)):(this.getAABB(e),t.identity())}getSphere(e){if(this._type==="sphere"&&this._sphere)return e.center.copyFrom(this._sphere.center),e.radius=this._sphere.radius,e;const t=new Ce;this.getAABB(t);const a=t.center,i=t.size.length*.5;return e.center.copyFrom(a),e.radius=i,e}get type(){return this._type}distanceToPoint(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center;let r=a;if(t){const o=new g;t.transformPoint(a,o),r=o}const i=this._sphere.radius,s=e.clone().subtract(r).length;return Math.max(0,s-i)}else if(this._box){const a=new Ce;this.getAABB(a,t);const r=a.center,i=a.size,s=Math.max(0,Math.abs(e.x-r.x)-i.x*.5),o=Math.max(0,Math.abs(e.y-r.y)-i.y*.5),l=Math.max(0,Math.abs(e.z-r.z)-i.z*.5);return Math.sqrt(s*s+o*o+l*l)}return 1/0}intersectsFrustum(e,t){if(this._type==="sphere"&&this._sphere){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}else if(this._box){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}return!1}}const Wh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.used!==e.used?n.used?1:-1:n.error!==e.error?n.error>e.error?1:-1:n.distanceFromCamera!==e.distanceFromCamera?n.distanceFromCamera>e.distanceFromCamera?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},Jh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.lastFrameVisited!==e.lastFrameVisited?n.lastFrameVisited>e.lastFrameVisited?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:n.loadingState!==e.loadingState?n.loadingState>e.loadingState?-1:1:n.hasUnrenderableContent!==e.hasUnrenderableContent?n.hasUnrenderableContent?-1:1:n.error!==e.error?n.error>e.error?-1:1:0};class Pm{rootLoadingState=Ur;rootTileSet=null;rootURL=null;fetchOptions={};frameCount=0;isLoading=!1;lruCache;loadQueue;processNodeQueue;plugins=[];_queuedTiles=[];_cachedSinceLoadComplete=new Set;_processedTiles=new WeakSet;_visibleTiles=new Set;_usedSet=new Set;_cacheHits=0;_cacheMisses=0;stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0,sceneCount:0,inCacheSinceLoad:0};errorTarget=16;errorThreshold=1;maxDepth=30;displayActiveTiles=!1;onRootTileLoaded;rtcOffset=null;_root=null;_activeTiles=new Set;_delayedHideTiles=new Set;_delayedVisibleTiles=new Set;_delayedActiveTiles=new Set;group;cameras=[];_cameraMap=new Map;_cameraInfo=[];_upRotationMatrix=new T;_ellipsoid;_bytesUsed=new WeakMap;_eventListeners=new Map;performanceStats={updateTime:0,traverseTime:0,markUsedTime:0,markVisibleTime:0,toggleTime:0,queueProcessTime:0};constructor(e=null){this.rootURL=e,this.lruCache=new Nh,this.lruCache.unloadPriorityCallback=Jh,this.loadQueue=new Lo,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=Wh,this.processNodeQueue=new Lo,this.processNodeQueue.maxJobs=25,this.group=new d.Object3D,this.group.name="TilesRendererGroup"}get root(){return this._root}get loadProgress(){const{stats:e,isLoading:t}=this,a=e.downloading,r=e.inCacheSinceLoad+(t?1:0);return r===0?1:1-a/r}update(){const{lruCache:e,_usedSet:t,stats:a,loadQueue:r,processNodeQueue:i}=this;this.rootLoadingState===Ur&&(this.rootLoadingState=Vo,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=Oa,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),h=this.preprocessNode(c.root,f,null);this.queueTileForDownload(h),this._root=h;const u=new Vr(h.boundingVolume),b=new Tr;u.getSphere(b);const A=new Ce;if(u.getAABB(A),this.rtcOffset=new g(-b.center.x,-b.center.y,-b.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:b.center,radius:b.radius,boundingBox:A,rtcOffset:this.rtcOffset})}catch(m){console.warn("Failed to calculate bounding volume for root tile:",m)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=vr,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const s=this.root;if(!s)return;a.inFrustum=0,a.used=0,a.active=0,a.visible=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.updateCameraInfo(),this._checkDelayedHideTiles(),this._checkDelayedActiveTiles(),this._checkDelayedVisibleTiles(),Ws(s,this),jo(s,this),Js(s,this),js(s,this);const o=this._queuedTiles;e.unloadPriorityCallback&&o.sort(e.unloadPriorityCallback);for(let c=0,f=o.length;c<f&&!e.isFull();c++)this.requestTileContents(o[c]);o.length=0,r.update(),i.update(),e.scheduleUnload(),(r.running||i.running)===!1&&this.isLoading===!0&&(this._cachedSinceLoadComplete.clear(),a.inCacheSinceLoad=0,this.dispatchEvent({type:"tiles-load-end"}),this.isLoading=!1)}traverse(e,t,a=!0){this.root&&Vh(this.root,(r,i,s)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,s):!1),t)}registerPlugin(e){if(this.plugins.includes(e))return;const t=e.priority||0;let a=this.plugins.length;for(let r=0;r<this.plugins.length;r++)if((this.plugins[r].priority||0)>t){a=r;break}this.plugins.splice(a,0,e),e.init&&e.init(this)}unregisterPlugin(e){const t=this.plugins;let a;if(typeof e=="string"?a=t.find(r=>r.name===e):a=e,a&&t.includes(a)){const r=t.indexOf(a);return t.splice(r,1),a.dispose&&a.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}calculateTileViewError(e,t){const a=e.cached,r=this.cameras,i=this._cameraInfo,s=a.boundingVolume;if(!s){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,h=1/0;const u=a.worldTransform;for(let b=0,A=r.length;b<A;b++){const m=i[b];let p,D;if(m.isOrthographic){const v=m.pixelSize;p=e.geometricError/v,D=1/0}else{const v=m.sseDenominator;D=s.distanceToPoint(m.position,u),p=D===0?1/0:e.geometricError/(D*v)}const _=i[b].frustum;s.intersectsFrustum(_,u)&&(o=!0,l=Math.max(l,p),c=Math.min(c,D)),f=Math.max(f,p),h=Math.min(h,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=h)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new g,frustum:new pn,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],s=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(s.position.copyFrom(l),s.frustum=i.frustum,s.isOrthographic=i.type===st.ortho,s.isOrthographic){const c=i.frustumSize;s.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;s.sseDenominator=2*Math.tan(f/2)/o.height}}}preprocessNode(e,t,a=null){if(this._processedTiles.has(e))return e;this._processedTiles.add(e);let r;if(e instanceof Oo?r=e:r=new Oo(e,a),r.content){const c=r.content;!("uri"in c)&&"url"in c&&(c.uri=c.url,delete c.url)}if(r.basePath=t,r.boundingVolume){const c=new Vr(r.boundingVolume);r.cached.boundingVolume=c}const i=new g(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),s=new T;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)s.rawData[f]=c[f]}if(!a){s.copyFrom(this._upRotationMatrix);const c=new g;c.copyFrom(i),c.applyMatrix4(s);const f=r.cached.boundingVolume.box,h=[new g(f.min.x,f.min.y,f.min.z),new g(f.max.x,f.min.y,f.min.z),new g(f.min.x,f.max.y,f.min.z),new g(f.max.x,f.max.y,f.min.z),new g(f.min.x,f.min.y,f.max.z),new g(f.max.x,f.min.y,f.max.z),new g(f.min.x,f.max.y,f.max.z),new g(f.max.x,f.max.y,f.max.z)];for(const A of h)A.applyMatrix4(s);const u=new Ce;h.forEach(A=>{u.expandByPoint(A)}),s.rawData[12]=-c.x,s.rawData[13]=-c.y,s.rawData[14]=-c.z;const b=u.min;s.rawData[13]-=b.y}const o=new T;o.copyFrom(s),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,s);const l=new T;if(l.copyFrom(o),l.invert(),r.cached.transfrom=s,r.cached.worldTransform=o,r.cached.transformInverse=l,e.children&&e.children.length>0){r.children=[];for(let c=0;c<e.children.length;c++){const f=e.children[c],h=this.preprocessNode(f,t,r);r.children.push(h)}r.childrenProcessed=r.children.length}return r}ensureChildrenArePreprocessed(e,t=!1){const a=e.children;for(let r=0,i=a.length;r<i;r++){const s=a[r];s.basePath!==void 0&&s.basePath!==""||s.cached.boundingVolume||(t?(this.processNodeQueue.remove(s),this.preprocessNode(s,e.basePath,e)):this.processNodeQueue.has(s)||this.processNodeQueue.add(s,o=>{this.preprocessNode(o,e.basePath,e)}))}}_recordCacheHit(){this._cacheHits++}_recordCacheMiss(){this._cacheMisses++}resetCacheStats(){this._cacheHits=0,this._cacheMisses=0}requestTileContents(e){if(e.loadingState!==Ur){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=Vo,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=vr,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async s=>{try{await this.parseTileContent(s,r,i),this.stats.downloading--}catch(o){s.loadingState=vr,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=Mh;const i=(c=>{const f=c.split(".");return f.length>1?f[f.length-1]:""})(t),s=a;let o=null;const l=new Tt;switch(i.toLowerCase()){case"b3dm":{o=(await l.load(s,ro,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"i3dm":{o=(await l.load(s,no,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"glb":case"gltf":{o=(await l.load(s,_t,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"pnts":{o=(await l.load(s,Fh,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"json":try{const c=await B.res.loadJSON(s);e.children.length=0,e.childrenProcessed=0;const f=this._getBasePath(s);if(c.root){const h=this.preprocessNode(c.root,f,e);e.children.push(h),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:c,url:s})}e.loadingState=Oa;return}catch(c){console.error("Failed to load external tileset:",c),e.loadingState=vr,this.stats.failed++;return}break;default:console.warn(`Unknown tile format: ${i}`);break}if(o){e.cached.scene=o;const c=this._estimateBytesUsed(o);this._bytesUsed.set(o,c),this.lruCache.setMemoryUsage(e,c),this.lruCache.has(e)||this.lruCache.add(e,f=>{if(f.cached.scene){const h=f.cached.scene;h.parent&&h.parent.object3D.removeChild(h),h.destroy(!0),f.cached.scene=null}f.loadingState=Ur}),this.setTileImmediateActive(e),e.active=!0,e.__wasSetActive=!0,this.stats.active++,this.setTileImmediateVisible(e),e.visible=!0,e.__wasSetVisible=!0,this.stats.visible++,this.stats.sceneCount++,e.loadingState=Oa,e.usedLastFrame=!0,Js(e,this),js(e,this)}else e.loadingState=vr,this.stats.failed++}markTileUsed(e){this._usedSet.add(e),this.lruCache.markUsed(e)}setTileDelayedActive(e,t){t?(this._activeTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedActiveTiles.has(e)||this._delayedActiveTiles.add(e)):(this._activeTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedActiveTiles.has(e)&&this._delayedActiveTiles.delete(e))}setTileImmediateActive(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform))}}setTileImmediateVisible(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0)}}_checkDelayedHideTiles(){if(this.stats.downloading===0)for(const e of this._delayedHideTiles){const t=e.cached.scene;t&&(t.transform.enable=!1,this._delayedHideTiles.delete(e))}}_checkDelayedActiveTiles(){for(const e of this._delayedActiveTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform),this._delayedActiveTiles.delete(e))}else this._delayedActiveTiles.delete(e)}_checkDelayedVisibleTiles(){for(const e of this._delayedVisibleTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0,this._delayedVisibleTiles.delete(e))}else this._delayedVisibleTiles.delete(e)}setTileDelayedVisible(e,t){t?(this._visibleTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedVisibleTiles.has(e)||this._delayedVisibleTiles.add(e)):(this._visibleTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedVisibleTiles.has(e)&&this._delayedVisibleTiles.delete(e))}queueTileForDownload(e){e.loadingState!==Ur||this.lruCache.isFull()||this._queuedTiles.push(e)}dispatchEvent(e){const t=this._eventListeners.get(e.type);t&&t.forEach(a=>{try{a(e)}catch(r){console.error("Error in event listener:",r)}})}async _loadRootTileSet(){if(!this.rootURL)throw new Error("Root URL is not set");const e=await B.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new T;switch(e.toLowerCase()){case"x":t.makeRotationAxis(g.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(g.X_AXIS,-Math.PI/2);break;default:console.warn(`Unknown gltfUpAxis: ${e}, using default`),t.identity();break}this._upRotationMatrix=t}_applyLocalTransform(e,t){const a=t.decompose(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_applyWorldTransform(e,t){const a=t.decompose(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_getBasePath(e){const t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}_resolveURL(e,t){return t.startsWith("http://")||t.startsWith("https://")?t:e+"/"+t}_getUrlExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}getMemoryStats(){const e=this.lruCache.getStats(),t=this.lruCache.maxBytesSize,a=e.bytes,r=t-a,i=this._cacheHits+this._cacheMisses,s=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:s}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===Oa&&e.push(t),!1),null),e}getVisibleTiles(){return Array.from(this._visibleTiles)}getActiveTiles(){return Array.from(this._activeTiles)}getTileTreeStats(){let e=0,t=0,a=0,r=0,i=0,s=0;return this.traverse(o=>(e++,o.loadingState===Oa&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),s+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?s/e:0}}printDebugInfo(){const e=this.stats,t=this.getMemoryStats(),a=this.getTileTreeStats(),r=this.performanceStats,i=this.lruCache.getStats();console.log("=== TilesRenderer Debug Info ==="),console.log("Stats:",e),console.log("Memory:",t),console.log("Tree:",a),console.log("Performance:",r),console.log("Cache:",i),console.log("Queues:",{load:this.loadQueue.getStats(),process:this.processNodeQueue.getStats()})}setPerformanceOptions(e){e.lruCacheMinSize!==void 0&&(this.lruCache.minSize=e.lruCacheMinSize),e.lruCacheMaxSize!==void 0&&(this.lruCache.maxSize=e.lruCacheMaxSize),e.lruCacheMinBytes!==void 0&&(this.lruCache.minBytesSize=e.lruCacheMinBytes),e.lruCacheMaxBytes!==void 0&&(this.lruCache.maxBytesSize=e.lruCacheMaxBytes),e.lruCacheUnloadPercent!==void 0&&(this.lruCache.unloadPercent=e.lruCacheUnloadPercent),e.downloadQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.downloadQueueMaxJobs),e.parseQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.parseQueueMaxJobs),e.processQueueMaxJobs!==void 0&&(this.processNodeQueue.maxJobs=e.processQueueMaxJobs),e.enablePerformanceStats!==void 0&&(this._enablePerformanceStats=e.enablePerformanceStats),e.enableCacheStats!==void 0&&(this._enableCacheStats=e.enableCacheStats)}dispose(e){[...this.plugins].forEach(a=>this.unregisterPlugin(a)),this.lruCache.clear(),this.loadQueue.clear(),this.processNodeQueue.clear(),this._root=null,this.rootTileSet=null,this.rootLoadingState=Ur,this.frameCount=0,this.isLoading=!1,this.resetCacheStats(),this.group.destroy(e)}setCamera(e,t,a){this.cameras.includes(e)||this.cameras.push(e),this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}deleteCamera(e){const t=this.cameras.indexOf(e);t!==-1&&this.cameras.splice(t,1),this._cameraMap.delete(e),this._updateCameraInfo()}setResolution(e,t,a){const r=this._cameraMap.get(e);r?(r.width=t,r.height=a):this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}forEachLoadedModel(e){this.traverse(t=>(t.loadingState===Oa&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent(d.MeshRenderer);r&&r.geometry&&(t+=1024),r&&r.material&&(t+=512)}),t}addEventListener(e,t){this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.get(e).push(t)}removeEventListener(e,t){const a=this._eventListeners.get(e);if(a){const r=a.indexOf(t);r!==-1&&a.splice(r,1)}}async loadTileSet(e,t){const r=(e.endsWith("/")?e.slice(0,-1):e)+"/"+t;this.rootURL=r}get modelList(){const e=[];return this.forEachLoadedModel(t=>{e.push(t)}),e}}class Nm{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class Vm{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class Om{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class Lm{uri;group;metadata}class Gm{class;properties}function zm(n,e){let t=0,a=null;return function(...r){const i=Date.now(),s=i-t;s>=e?(t=i,n.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),n.apply(this,r),a=null},e-s))}}class Wm extends Dt{static count=0;constructor(){super(),X.register("ColorLitShader",Ad),this.shader=new gt;let e=new qe("ColorLitShader","ColorLitShader");e.passType=de.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new Z),e.setUniformColor("emissiveColor",new Z),e.setUniformFloat("envIntensity",1),e.setUniformFloat("normalScale",1),e.setUniformFloat("roughness",0),e.setUniformFloat("metallic",0),e.setUniformFloat("ao",1),e.setUniformFloat("alphaCutoff",0);let t=e.shaderState;t.acceptShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,e.setTexture("normalMap",B.res.normalTexture),e.setTexture("emissiveMap",B.res.blackTexture)}clone(){return null}debug(){}}class Jm extends Dt{constructor(){super();let e=new qe("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=de.COLOR,e.setUniformVector4("transformUV1",new ue(0,0,1,1)),e.setUniformVector4("transformUV2",new ue(0,0,1,1)),e.setUniformColor("baseColor",new Z(1,1,1,1)),e.setUniformFloat("alphaCutoff",.5);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1;let a=new gt;a.addRenderPass(e),this.shader=a,this.baseMap=B.res.grayTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}function jm(n,e){}class Zm extends Dt{constructor(){super(),this.shader=new d.UnLitTexArrayShader,this.baseMap=B.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set shadowMap(e){}}class Zo{clipName;loopTime;startTime;stopTime;sampleRate;useSkeletonPos;useSkeletonScale;positionCurves=new Map;rotationCurves=new Map;scaleCurves=new Map;floatCurves=new Map;formBytes(e){if(this.clipName=e.readUTF(),this.loopTime=!e.readInt32(),this.startTime=e.readFloat32(),this.stopTime=e.readFloat32(),this.sampleRate=e.readInt32(),this.useSkeletonPos=e.readInt32()>0,this.useSkeletonScale=e.readInt32()>0,this.useSkeletonPos){let r=e.readInt32();for(let i=0;i<r;i++){let s=new Cr;s.formBytes(e),this.positionCurves.set(s.path,s)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new Cr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let s=new Cr;s.formBytes(e),this.scaleCurves.set(s.path,s)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new Cr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class Cr{path;attribute;propertys;preInfinity;postInfinity;rotationOrder;m_curves;k=0;_cacheValue;_kValue;constructor(e=1){this.k=e,this.m_curves=[],this.check()}check(){for(let e=0;e<this.k;e++)this.m_curves[e]||=new Vi;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new fe;break;case 3:this._cacheValue=new g;break;case 4:this._cacheValue=new ue;break}}get totalTime(){return this.m_curves[0].totalTime}addKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].addKeyFrame(e.getK(t))}removeKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].removeKeyFrame(e.getK(t))}getValue(e){switch(this.k){case 1:this._cacheValue=this.m_curves[0].getValue(e);break;case 2:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e);break;case 3:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e),this._cacheValue.z=this.m_curves[2].getValue(e);break;case 4:const t=this.m_curves[0].getCurveFramesExtent(e),a=t.lhsIndex,r=t.rhsIndex;e=t.time;let i=this.m_curves[0].getKey(a),s=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(s.time-i.time);ne.HELP_0.set(this.m_curves[0].getKey(a).value,this.m_curves[1].getKey(a).value,this.m_curves[2].getKey(a).value,this.m_curves[3].getKey(a).value),ne.HELP_1.set(this.m_curves[0].getKey(r).value,this.m_curves[1].getKey(r).value,this.m_curves[2].getKey(r).value,this.m_curves[3].getKey(r).value),ne.HELP_2.slerp(ne.HELP_0,ne.HELP_1,o),this._cacheValue.x=ne.HELP_2.x,this._cacheValue.y=ne.HELP_2.y,this._cacheValue.z=ne.HELP_2.z,this._cacheValue.w=ne.HELP_2.w;break}return this._cacheValue}getKeyCount(){return this.m_curves[0].getKeyCount()}getKey(e){let t=[];for(let a=0;a<this.k;a++)t.push(this.m_curves[a].getKey(e));return t}formBytes(e){this.path=e.readUTF(),this.k=e.readInt32(),this.check(),this.attribute=e.readUTF(),this.propertys=this.attribute.split("."),this.preInfinity=e.readInt32(),this.postInfinity=e.readInt32(),this.rotationOrder=e.readInt32();let t=e.readInt32();for(let a=0;a<t;a++){let r=new as(0);r.formBytes(e),this.addKeyFrame(r)}}}class Ym extends Map{negtive;constructor(e){if(super(e),this.negtive=new Map,e)for(let t of e)this.negtive.set(t[1],t[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.negtive.delete(t),super.delete(e)}return!1}getKey(e){return this.negtive.get(e)}deleteValue(e){let t=this.negtive.get(e);return t&&this.delete(t),this.negtive.delete(e)}set(e,t){return super.set(e,t),this.negtive.set(t,e),this}clear(){this.negtive.clear(),super.clear()}}class Xm{colorArray;constructor(e){this.colorArray=e}getColor(e){let t=e*this.colorArray.length,a=Math.floor(t),r=Math.min(a+1,this.colorArray.length-1),i=this.colorArray[a],s=this.colorArray[r];return Z.lerp(t-a,i,s)}}class Zs{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return g.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,s=e*e*e;return this.controlVertices[0].mul(a).add(this.controlVertices[1].mul(r)).add(this.controlVertices[2].mul(i)).add(this.controlVertices[3].mul(s))}getTangent(e){if(!(e>=0&&e<=1))return g.ZERO;let t=this.controlVertices,a=t[0].add(t[1].add(t[0]).mul(e)),r=t[1].add(t[2].add(t[1]).mul(e)),i=t[2].add(t[3].add(t[2]).mul(e)),s=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(s)}getClosestParam(e,t=1e-6){return this.getClosestParamRec(e,0,1,t)}getClosestParamRec(e,t,a,r){let i=(t+a)/2;if(a-t<r)return i;let s=(t+i)/2,o=(i+a)/2,l=this.getPoint(s),c=this.getPoint(o),f=l.subtract(e).lengthSquared,h=c.subtract(e).lengthSquared;return f<h?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var jh=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(jh||{});class Hm{type=0;numCurveSegments=0;numControlVertices=0;controlVertices=[];constructor(e,t=0){this.setControlVertices(e,t)}getPathType(){return this.type}isClosed(){return this.type==1}isValid(){return this.numCurveSegments>0}clear(){this.controlVertices.length=0,this.type=0,this.numCurveSegments=0,this.numControlVertices=0}computeApproxLength(){if(!this.isValid())return 0;let e=this.numCurveSegments+1;if(e<2)return 0;let t=0,a=this.controlVertices;for(let r=1;r<e;r++){let i=a[(r-1)*3],s=a[r*3];t+=i.subtract(s).lengthSquared}return t==0?0:t}computeApproxParamPerUnitLength(){let e=this.computeApproxLength();return this.numCurveSegments/e}computeApproxNormParamPerUnitLength(){return 1/this.computeApproxLength()}interpolatePoints(e,t){let a=e.length;a<2&&console.error("point count must great 1"),this.clear(),this.type=t;let r=this.controlVertices;switch(t){case 0:{this.numCurveSegments=a-1,this.numControlVertices=3*a-2,r.length=this.numControlVertices;for(let o=0;o<a;o++)r[o*3]=e[o];let i=e[1].subtract(e[0]).mul(.25);r[1]=e[0].add(i);let s=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(s);for(let o=1;o<this.numCurveSegments;o++){let l=e[o-1].subtract(e[o]),c=e[o+1].subtract(e[o]),f=l.lengthSquared,h=c.lengthSquared;if(f>0&&h>0){let u=(f+h)/8,b=c.div(h).subtract(l.div(f));b.normalize(),b=b.mul(u),r[o*3-1]=e[o].subtract(b),r[o*3+1]=e[o].add(b)}else r[o*3-1]=e[o],r[o*3+1]=e[o]}break}case 1:{this.numCurveSegments=a,this.numControlVertices=3*a+1,r.length=this.numControlVertices;for(let i=0;i<a;i++)r[i*3]=e[i];r[this.numControlVertices-1]=e[0];for(let i=1;i<=this.numCurveSegments;i++){let s=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[s].subtract(e[l]),f=e[o].subtract(e[l]),h=c.lengthSquared,u=f.lengthSquared,b=3*i-1,A=(3*i+1)%(this.numControlVertices-1);if(h>0&&u>0){let m=(h+u)/8,p=f.div(u).subtract(c.div(h));p.normalize(),p=p.mul(m),r[b]=e[l].subtract(p),r[A]=e[l].add(p)}else r[b]=e[l],r[A]=e[l]}break}}}setControlVertices(e,t){let a=e.length;a<=0||t==0&&a<4||t==1&&a<7||(a-1)%3==0&&(this.clear(),this.type=t,this.numControlVertices=a,this.numCurveSegments=(a-1)/3,this.controlVertices=e)}getPoint(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Ot.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=[],r=this.controlVertices;return a[0]=r[3*t+0],a[1]=r[3*t+1],a[2]=r[3*t+2],a[3]=r[3*t+3],new Zs(a).getPoint(e-t)}getPointNorm(e){return this.getPoint(e*this.numCurveSegments)}getTangent(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Ot.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=this.controlVertices,r=[];return r[0]=a[3*t+0],r[1]=a[3*t+1],r[2]=a[3*t+2],r[3]=a[3*t+3],new Zs(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],s=new Zs(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let h=0;h<4;h++)i[h]=this.controlVertices[o+h];s.setControlVertices(i);let l=s.getClosestParam(e,t),f=s.getPoint(l).subtract(e).lengthSquared;f<a&&(a=f,r=o/3+l)}return r}computeClosestNormParam(e,t){return this.computeClosestParam(e,t*this.numCurveSegments)}}class Km extends Map{valueList;keyList;isChange=!0;constructor(e,t,a){if(super(e),t&&(this.keyList=[]),a&&(this.valueList=[]),e)for(let r of e)this.valueList?.push(r[1]),this.keyList?.push(r[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.valueList&&this.deleteValue(t),this.keyList&&this.deleteKey(e),this.isChange=!0,super.delete(e)}return!1}deleteValue(e){let t=this.valueList.indexOf(e);return t>=0&&this.valueList.splice(t,1),this}deleteKey(e){let t=this.keyList.indexOf(e);return t>=0&&this.keyList.splice(t,1),this}set(e,t){return this.delete(e),this.keyList?.push(e),this.valueList?.push(t),super.set(e,t),this.isChange=!0,this}clear(){this.valueList&&(this.valueList.length=0),this.keyList&&(this.keyList.length=0),this.isChange=!0,super.clear()}}var Zh=(n=>(n[n.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",n[n.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",n[n.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",n[n.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",n[n.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",n[n.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",n[n.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",n[n.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",n[n.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",n[n.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",n[n.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",n[n.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",n[n.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",n))(Zh||{});const qm=3.141592653589793;class $m{}function Yh(n,e,t){let a=.3333333333333333,r=.5,i=n*a,s=i*i,l=s*i-i*e*r+t*r,c=-s+e*a,f=c*c*c,h=f+l*l;if(h>=0){let A=Math.sqrt(h)-l;return A=A>0?Math.pow(A,a):-Math.pow(-A,a),-i-c/A+A}let u=Math.sqrt(-f),b=Math.acos(-l/u);return u=Math.pow(u,a),u=u-c/u,b=-i+u*Math.cos(b*a),b}function Ys(n,e,t,a){let r=1e-5;if(Math.abs(n)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*n*t;if(i<0)return 0;let s=.5/n,o=Math.sqrt(i);return a.r0=(o-e)*s,a.r1=(-o-e)*s,2}function Xh(n,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let s=t/e,o=a/e,l=r/e;n[0]=Yh(s,o,l),i++;let c=e,f=t+e*n[0],h=a+t*n[0]+e*n[0]*n[0];i+=Ys(c,f,h,{r0:n[1],r1:n[2]})}else i+=Ys(t,a,r,{r0:n[1],r1:n[2]});return i}class La{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class rr{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[rr.kMaxNumSegments]=new La,this.integrationCache[rr.kMaxNumSegments]=0,this.doubleIntegrationCache[rr.kMaxNumSegments]=0,this.times[rr.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=fe.ZERO.clone(),t=20,a=1/t,r=a;for(let i=0;i<t;i++)this.calculateMinMax(e,this.evaluateDoubleIntegrated(r)),r+=a;return e}findMinMaxIntegrated(){let e=fe.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],s=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=Xh(c,i,s,o,l);for(let h=0;h<f;h++){let u=c[h]+t[r];u>=t[r]&&u<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(u))}this.calculateMinMax(e,this.evaluateIntegrated(a[r])),this.times[r]}return e}generateIntegrationCache(e){e.integrationCache[0]=0;let t=e.times[0],a=0;for(let r=1;r<e.segmentCount;r++){let i=e.segments[r-1].coeff;Yo(i);let s=t-a;e.integrationCache[r]=e.integrationCache[r-1]+La.EvalSegment(s,i)*s,a=t,t=e.times[r]}}generateDoubleIntegrationCache(e){let t=0,a=0;for(let r=0;r<e.segmentCount;r++){e.doubleIntegrationCache[r]=t;let i=e.times[r]-a;i=Math.max(i,0),t+=La.EvalSegment(i,e.segments[r].coeff)*i*i+e.integrationCache[r]*i,a=e.times[r]}}integrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)Yo(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)Hh(this.segments[e].coeff);this.generateDoubleIntegrationCache(this)}static isValidCurve(e){let t=e.getKeyCount(),a=t-1;return e.getKey(0).time!=0&&a++,e.getKey(t-1).time!=1&&a++,a<=rr.kMaxNumSegments}evaluateDoubleIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.doubleIntegrationCache[a]+this.integrationCache[a]*r+La.EvalSegment(r,this.segments[a].coeff)*r*r}t=this.times[a]}return 1}evaluateIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.integrationCache[a]+La.EvalSegment(r,this.segments[a].coeff)*r}t=this.times[a]}return 1}evaluate(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a])return La.EvalSegment(e-t,this.segments[a].coeff);t=this.times[a]}return 1}buildCurve(e,t){let a=e.getKeyCount();this.segmentCount=1;let r=1.01;if(this.segments.length=0,this.integrationCache.length=0,this.doubleIntegrationCache.length=0,this.times.length=0,this.times[0]=r,a!=0)if(a==1)this.segments[0]=new La,this.segments[0].coeff[3]=e.getKey(0).value*t;else{this.segmentCount=a-1;let i=0;e.getKey(0).time!=0&&(this.segments[0].coeff[3]=e.getKey(0).value,this.times[0]=e.getKey(0).time,i=1);for(let s=0;s<this.segmentCount;s++){let o;e.calculateCacheData(o,s,s+1,0),this.segments[s+i].coeff=o.coeff.concat(),this.times[s+i]=e.getKey(s+1).time}this.segmentCount+=i,e.getKey(a-1).time!=1&&(this.segments[this.segmentCount].coeff[3]=e.getKey(a-1).value,this.segmentCount++),this.times[this.segmentCount-1]=r;for(let s=0;s<this.segmentCount;s++)this.segments[s].coeff[0]*=t,this.segments[s].coeff[1]*=t,this.segments[s].coeff[2]*=t,this.segments[s].coeff[3]*=t}return!0}}function Hh(n){n[0]/=20,n[1]/=12,n[2]/=6,n[3]/=2}function Yo(n){n[0]/=4,n[1]/=3,n[2]/=2,n[3]/=1}var Kh=(n=>(n[n.kEMScalar=0]="kEMScalar",n[n.kEMOptimized=1]="kEMOptimized",n[n.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",n[n.kEMSlow=3]="kEMSlow",n))(Kh||{}),qh=(n=>(n[n.kMMCScalar=0]="kMMCScalar",n[n.kMMCCurve=1]="kMMCCurve",n[n.kMMCTwoCurves=2]="kMMCTwoCurves",n[n.kMMCTwoConstants=3]="kMMCTwoConstants",n))(qh||{});class ep{max;min}class tp{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class $h{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new Vi,this.maxCurve=new Vi}setScalar(e){this._scalar=e}getScalar(){return this._scalar}static evaluateSlow(e,t,a){let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==2?xr(e.minCurve.getValue(t)*e.getScalar(),r,a):r}static evaluate(e,t,a=1){if(e.minMaxState==0)return e.getScalar();let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==1?xr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?xr(e._minScalar,e._scalar,a):e.minMaxState==2?xr(e.minCurve.getValue(t)*e.getScalar(),r,1*Math.random()):this.evaluateSlow(e,t,1)}unSerialized(e){this.minMaxState=e.minMaxState,this._scalar=e.scalar,this._minScalar=e.minScalar,this.maxCurve.unSerialized(e.maxCurve),this.minCurve.unSerialized(e.minCurve)}}class ap{value=0;mode=0;spread=0;speed=new $h;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function rp(n,e){let t=rr.isValidCurve(n.max);return e!=2&&e!=3?t:t&&rr.isValidCurve(n.min)}function ip(n,e,t,a){n.max.buildCurve(e.max,t),a!=2&&a!=3?n.min.buildCurve(e.max,t):n.min.buildCurve(e.min,t)}function sp(n,e){let t=e.getKeyCount();if(t!=0)if(t==1)es(n,e.getKey(0).value);else{let a=t-1;es(n,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Ao;e.calculateCacheData(i,r,r+1,0);let s=3*i.coeff[0],o=2*i.coeff[1],l=1*i.coeff[2],c=e.getKey(r).time,f=e.getKey(r+1).time,h=[],u=Ys(s,o,l,{r0:h[0],r1:h[1]});for(let b=0;b<u;b++)h[b]>=0&&h[b]+c<f&&es(n,La.EvalSegment(h[b],i.coeff));es(n,La.EvalSegment(f-c,i.coeff))}}}function es(n,e){n.x=Math.min(n.x,e),n.y=Math.max(n.y,e)}class Or{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class eu{a;b;c;d;static ALIGN_ANY=0;static ALIGN_XY_AXIS=1;static ALIGN_YZ_AXIS=2;static ALIGN_XZ_AXIS=3;constructor(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}setTo(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}fromPoints(e,t,a){var r=t.x-e.x,i=t.y-e.y,s=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-s*l,this.b=s*o-r*c,this.c=r*l-i*o,this.d=-(this.a*e.x+this.b*e.y+this.c*e.z)}fromNormalAndPoint(e,t){this.a=e.x,this.b=e.y,this.c=e.z,this.d=-(this.a*t.x+this.b*t.y+this.c*t.z)}normalize(){var e=Math.sqrt(this.a*this.a+this.b*this.b+this.c*this.c);if(e>0){var t=1/e;this.a*=t,this.b*=t,this.c*=t,this.d*=t}return e}distance(e){return this.a*e.x+this.b*e.y+this.c*e.z+this.d}classifyPoint(e,t=.01){var a=this.distance(e);return a<-t?Or.BACK:a>t?Or.FRONT:Or.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function np(n,e){return Math.random()*e+Math.random()*n+(e-n)*Math.random()}function op(n,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*n*a+(e-n)*Math.random()*a}function tu(n,e,t){let a=0,r=0;for(;a===0;)a=Math.random();for(;r===0;)r=Math.random();let i=Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*r);return i=i/10+.5,(i>1||i<0)&&(i=tu(n,e,t)),i=Math.pow(i,t),i*=e-n,i+=n,i}function xa(n){return n>0?Math.floor(n):Math.floor(n)-1}let Ue=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];function Xo(n,e){let t=n&15,a=1+(t&7);return t&8&&(a=-a),a*e}function Xs(n,e,t){let a=n&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function ts(n,e,t,a){let r=n&15,i=r<8?e:t,s=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-s:s)}function ui(n,e,t,a,r){let i=n&31,s=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-s:s)+(i&2?-o:o)+(i&4?-l:l)}let ta=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]];function lp(n){let e=xa(n),t=e+1,a=n-e,r=a-1,i,s,o=1-a*a;o*=o,i=o*o*Xo(Ue[e&255],a);let l=1-r*r;return l*=l,s=l*l*Xo(Ue[t&255],r),.25*(i+s)}function cp(n,e){const t=.366025403,a=.211324865;let r,i,s,o=(n+e)*t,l=n+o,c=e+o,f=xa(l),h=xa(c),u=(f+h)*a,b=f-u,A=h-u,m=n-b,p=e-A,D,_;m>p?(D=1,_=0):(D=0,_=1);let v=m-D+a,U=p-_+a,y=m-1+2*a,S=p-1+2*a,F=f&255,k=h&255,x=.5-m*m-p*p;x<0?r=0:(x*=x,r=x*x*Xs(Ue[F+Ue[k]],m,p));let w=.5-v*v-U*U;w<0?i=0:(w*=w,i=w*w*Xs(Ue[F+D+Ue[k+_]],v,U));let R=.5-y*y-S*S;return R<0?s=0:(R*=R,s=R*R*Xs(Ue[F+1+Ue[k+1]],y,S)),40*(r+i+s)}function fp(n,e,t){const a=.333333333,r=.166666667;let i,s,o,l,c=(n+e+t)*a,f=n+c,h=e+c,u=t+c,b=xa(f),A=xa(h),m=xa(u),p=(b+A+m)*r,D=b-p,_=A-p,v=m-p,U=n-D,y=e-_,S=t-v,F,k,x,w,R,Q;U>=y?y>=S?(F=1,k=0,x=0,w=1,R=1,Q=0):U>=S?(F=1,k=0,x=0,w=1,R=0,Q=1):(F=0,k=0,x=1,w=1,R=0,Q=1):y<S?(F=0,k=0,x=1,w=0,R=1,Q=1):U<S?(F=0,k=1,x=0,w=0,R=1,Q=1):(F=0,k=1,x=0,w=1,R=1,Q=0);let M=U-F+r,j=y-k+r,he=S-x+r,ae=U-w+2*r,P=y-R+2*r,z=S-Q+2*r,W=U-1+3*r,V=y-1+3*r,te=S-1+3*r,J=b&255,K=A&255,ee=m&255,re=.6-U*U-y*y-S*S;re<0?i=0:(re*=re,i=re*re*ts(Ue[J+Ue[K+Ue[ee]]],U,y,S));let oe=.6-M*M-j*j-he*he;oe<0?s=0:(oe*=oe,s=oe*oe*ts(Ue[J+F+Ue[K+k+Ue[ee+x]]],M,j,he));let pe=.6-ae*ae-P*P-z*z;pe<0?o=0:(pe*=pe,o=pe*pe*ts(Ue[J+w+Ue[K+R+Ue[ee+Q]]],ae,P,z));let Te=.6-W*W-V*V-te*te;return Te<0?l=0:(Te*=Te,l=Te*Te*ts(Ue[J+1+Ue[K+1+Ue[ee+1]]],W,V,te)),32*(i+s+o+l)}function dp(n,e,t,a){const r=.309016994,i=.138196601;let s,o,l,c,f,h=(n+e+t+a)*r,u=n+h,b=e+h,A=t+h,m=a+h,p=xa(u),D=xa(b),_=xa(A),v=xa(m),U=(p+D+_+v)*i,y=p-U,S=D-U,F=_-U,k=v-U,x=n-y,w=e-S,R=t-F,Q=a-k,M=x>w?32:0,j=x>R?16:0,he=w>R?8:0,ae=x>Q?4:0,P=w>Q?2:0,z=R>Q?1:0,W=M+j+he+ae+P+z,V,te,J,K,ee,re,oe,pe,Te,Oe,q,ie;V=ta[W][0]>=3?1:0,te=ta[W][1]>=3?1:0,J=ta[W][2]>=3?1:0,K=ta[W][3]>=3?1:0,ee=ta[W][0]>=2?1:0,re=ta[W][1]>=2?1:0,oe=ta[W][2]>=2?1:0,pe=ta[W][3]>=2?1:0,Te=ta[W][0]>=1?1:0,Oe=ta[W][1]>=1?1:0,q=ta[W][2]>=1?1:0,ie=ta[W][3]>=1?1:0;let ce=x-V+i,ge=w-te+i,we=R-J+i,me=Q-K+i,ye=x-ee+2*i,Qe=w-re+2*i,Re=R-oe+2*i,Le=Q-pe+2*i,Ut=x-Te+3*i,je=w-Oe+3*i,sr=R-q+3*i,Ea=Q-ie+3*i,za=x-1+4*i,Wa=w-1+4*i,aa=R-1+4*i,Ja=Q-1+4*i,ua=p&255,Pt=D&255,wa=_&255,ba=v&255,Lr=.6-x*x-w*w-R*R-Q*Q;Lr<0?s=0:(Lr*=Lr,s=Lr*Lr*ui(Ue[ua+Ue[Pt+Ue[wa+Ue[ba]]]],x,w,R,Q));let Gr=.6-ce*ce-ge*ge-we*we-me*me;Gr<0?o=0:(Gr*=Gr,o=Gr*Gr*ui(Ue[ua+V+Ue[Pt+te+Ue[wa+J+Ue[ba+K]]]],ce,ge,we,me));let zr=.6-ye*ye-Qe*Qe-Re*Re-Le*Le;zr<0?l=0:(zr*=zr,l=zr*zr*ui(Ue[ua+ee+Ue[Pt+re+Ue[wa+oe+Ue[ba+pe]]]],ye,Qe,Re,Le));let Wr=.6-Ut*Ut-je*je-sr*sr-Ea*Ea;Wr<0?c=0:(Wr*=Wr,c=Wr*Wr*ui(Ue[ua+Te+Ue[Pt+Oe+Ue[wa+q+Ue[ba+ie]]]],Ut,je,sr,Ea));let Jr=.6-za*za-Wa*Wa-aa*aa-Ja*Ja;return Jr<0?f=0:(Jr*=Jr,f=Jr*Jr*ui(Ue[ua+1+Ue[Pt+1+Ue[wa+1+Ue[ba+1]]]],za,Wa,aa,Ja)),27*(s+o+l+c+f)}class Ho extends fe{static uv_0=new Ho;u=0;v=0;constructor(e=0,t=0){super(e,t),this.u=e,this.v=t}length(){return 0}static getUVSheet(e,t,a){let r=Math.floor(e%(t*a)),i=Math.floor(r/t),s=r%t;return new ue(i/t,s/a,1/t,1/a)}}class as{serializedVersion="2";time;tangentMode=0;weightedMode=0;propertyKeyFrame;constructor(e=0){this.time=e,this.propertyKeyFrame={}}getK(e){return this.propertyKeyFrame[e]}split(e,t,a){switch(e){case H.single:{let r=this.getKeyFrame(0);r[a]=t}break;case H.float:{let r=this.getKeyFrame(0);r[a]=t}break;case H.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y}break;case H.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case H.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case H.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break}}getKeyFrame(e){let t=this.propertyKeyFrame[e];return t||(t=new Rs,t.time=this.time,t.tangentMode=this.tangentMode,t.weightedMode=this.weightedMode,this.propertyKeyFrame[e]=t),t}formBytes(e){this.time=e.readFloat32();{let{t,v:a}=Va.parser(e);this.split(t,a,"value")}{let{t,v:a}=Va.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Va.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outWeight")}}}class hp{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new fe(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new g(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new ue(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}case"Quaternion":{let r=e,i=t;return new ne(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}}}}class rs{_keys=new Array;_values=new Array;getIndexByKey(e){return this._keys.indexOf(e)}getValueByKey(e){var t=this.getIndexByKey(e);return t>-1?this._values[t]:null}put(e,t){if(e==null)return null;var a=this.remove(e);return this._keys.push(e),this._values.push(t),a}remove(e){var t=this._keys.indexOf(e),a;return t>-1&&(a=this._values[t],this._keys.splice(t,1),this._values.splice(t,1)),a}getValues(){return this._values}getKeys(){return this._keys}clear(){this._values.length=0,this._keys.length=0}}class Sr{static WalkAble=1}class is{static SetConst(e){this.EPSILON=e,this.POWER_EPSILON=e*e}static EPSILON=.1;static POWER_EPSILON=this.EPSILON*this.EPSILON}class Mt extends g{static CALC_VECTOR3D1=new g;static CALC_VECTOR3D2=new g;static CALC_VECTOR3D3=new g;static CALC_VECTOR3D4=new g;static CALC_VECTOR3D5=new g;_pointId=0;constructor(e,t,a,r){super(t,a,r,0),this._pointId=e}get id(){return this._pointId}static equalPoint(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)+(e.z-t.z)*(e.z-t.z)<is.POWER_EPSILON}static calcDistance(e,t){return Mt.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),Mt.CALC_VECTOR3D3.length}}class au{_openedList;_closedList;_endNode;_startNode;_triangleChannel;_navMesh;_findIndex=0;constructor(){this._openedList=new Array,this._closedList=new Array}findPath(e,t,a){return this._findIndex++,this._navMesh=e,this._startNode=t,this._endNode=a,this._openedList.length=0,this._closedList.length=0,this._startNode&&this._endNode?(this._startNode.gg=0,this._startNode.h=0,this._startNode.f=0,this._startNode.parent=null,this.search()):!1}search(){for(var e=this._startNode,t=[],a;e!=this._endNode;){t=e.getNeibourTriangles(t,Sr.WalkAble,Sr.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+Mt.calcDistance(a,e)*a.costMultiplier,i=Mt.calcDistance(a,this._endNode),s=r+i;a.openId==this._findIndex?a.f>s&&(a.f=s,a.gg=r,a.h=i,a.parent=e):(a.f=s,a.gg=r,a.h=i,a.parent=e,a.openId=this._findIndex,this._openedList.push(a))}if(e.closeId=this._findIndex,this._closedList.push(e),this._openedList.length==0)return!1;this._openedList.sort(function(o,l){return o.f-l.f}),e=this._openedList.shift()}return this.buildPath(),!0}buildPath(){this._triangleChannel=[];var e=this._endNode;for(this._triangleChannel.push(e);e!=this._startNode;)e=e.parent,this._triangleChannel.unshift(e)}get channel(){return this._triangleChannel}}class Fa extends Mt{_ownerPoint;_ownerEdge;radius=0;constructor(e,t){super(e.id,0,0,0),this._ownerEdge=t,this._ownerPoint=e}get ownerPoint(){return this._ownerPoint}get ownerEdge(){return this._ownerEdge}scalePoint(e=.7){var t=new Fa(this._ownerPoint,this._ownerEdge);return t.copyFrom(this),t.decrementBy(this._ownerPoint),t.scaleBy(e),t.radius=t.length,t.incrementBy(this._ownerPoint),t}}class ka{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new g;constructor(e,t){if(this._pointA=e,this._pointB=t,e.id>=t.id)throw new Error("edge point order error!!!");this._triangleOwners=new Array,this._centerPoint=new g,this._edgeMask=Sr.WalkAble,Mt.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=Mt.CALC_VECTOR3D1.length,this._centerPoint.setTo((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2)}get size(){return this._edgeSize}get triangleOwners(){return this._triangleOwners}get centerPoint(){return this._centerPoint}initFatPoints(e){this._edgeDirA2B=this._pointB.subtract(this._pointA),this._edgeDirA2B.normalize(),this.fatPointA=this.fatPointA||new Fa(this._pointA,this),this.fatPointB=this.fatPointB||new Fa(this._pointB,this),this.fatPointA.radius!=e&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(e),ka.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(ka.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(-e),ka.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(ka.CALC_FAT_VECTOR),this.fatPointB.radius=e)}getFatPoint(e){return e==this._pointA?this.fatPointA:this.fatPointB}getAnotherFatPoint(e){return e==this._pointA?this.fatPointB:this.fatPointA}getAnotherPoint(e){return e==this._pointA?this._pointB:this._pointA}containsPoint(e){return Mt.equalPoint(e,this._pointA)?this._pointA:Mt.equalPoint(e,this._pointB)?this._pointB:null}addTriangleOwners(e){if(e.edges.indexOf(this)==-1)throw new Error("the edge is not belong triangle!!!");this._triangleOwners.indexOf(e)==-1&&this._triangleOwners.push(e)}getPublicPoint(e){return this._pointA==e._pointA||this._pointA==e._pointB?this._pointA:this._pointB==e._pointA||this._pointB==e._pointB?this._pointB:null}getEqualPoint(e){return Mt.equalPoint(e,this._pointA)?this._pointA:Mt.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&Sr.WalkAble)==Sr.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class De{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new g;static RAY_2=new g;static TEST_RAY=new g;static TEST_RAY_1=new g;static TEST_RAY_2=new g;static CALC_CROSS_POINT=new g;static CALC_CROSS_TEST=new g;cornerPoint;cornerEdge;continuePass(e,t,a){this.resetData(),this.curPoint=e,this.endPoint=t,this.cornerEdge=a}passEdge(e,t,a,r){if((this.rayA==null||this.rayB==null)&&(this.rayA=De.RAY_1,this.rayB=De.RAY_2,this.rayAPoint=e.pointA,this.rayBPoint=e.pointB,this.rayA.setTo(this.rayAPoint.x-this.curPoint.x,0,this.rayAPoint.z-this.curPoint.z),this.rayB.setTo(this.rayBPoint.x-this.curPoint.x,0,this.rayBPoint.z-this.curPoint.z)),r)return this.checkEndPoint(a);if(De.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);De.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var s;if(De.TEST_RAY_1.copyFrom(t.pointA),De.TEST_RAY_1.decrementBy(this.curPoint),De.TEST_RAY_2.copyFrom(t.pointB),De.TEST_RAY_2.decrementBy(this.curPoint),De.TEST_RAY_1.y=0,De.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,De.TEST_RAY_1,De.TEST_RAY_2)||this.isPointAtCenter(this.rayB,De.TEST_RAY_1,De.TEST_RAY_2)?s=!1:s=!0,s)return this.isPointAtCenter(this.rayA,De.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return De.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,De.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1)}calcCrossEdge(e,t,a){return this.calcCrossPoint(e.fatPointA,e.fatPointB,t,a)}calcCrossPoint(e,t,a,r){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);let i=De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z;var s=0;return i!=0&&(s=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),s>1?s=1:s<0&&(s=0),De.CALC_CROSS_POINT.scaleBy(s),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(De.CALC_CROSS_POINT.scaleBy(i),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){De.CALC_CROSS_TEST.copyFrom(t),De.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_TEST.x*r.z-r.x*De.CALC_CROSS_TEST.z);return i<=1&&i>=0}isPointAtCenter(e,t,a){var r=t.crossProduct(e);if(r.length==0&&e.length<t.length)return!0;var i=a.crossProduct(e);return i.length==0&&e.length<a.length?!0:(r.normalize(),i.normalize(),r.incrementBy(i),r.length<.01)}resetData(){this.cornerEdge=null,this.cornerPoint=null,this.curPoint=null,this.rayA=this.rayB=null,this.rayAPoint=this.rayBPoint=null,De.RAY_1.setTo(0,0,0),De.RAY_2.setTo(0,0,0)}}class ir{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new g;constructor(){this._router=new De}searchPath(e,t,a,r=0){return r<=0&&(r=1),this._aiRadius=r*1.5,this.searchEnable(e,t,a)?(this.search(e,t,a),!0):!1}get path(){return this._result}searchEnable(e,t,a){return!(e==null||t==null||a==null||a[0].plane.classifyPoint(e,is.EPSILON)!=Or.INTERSECT||a[a.length-1].plane.classifyPoint(t,is.EPSILON)!=Or.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,s,o,l,c;for(r=0;r<i;r++)o=a[r].getPublicEdge(a[r+1]),o.crossPoint=null,o.initFatPoints(this._aiRadius),this._tempPublicEdgeList.push(o),s=a[r],c=s.plane,s=a[r+1],l=s.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,is.EPSILON)==Or.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,h,u,b;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],s=a[r+1],b=r==i-1,b?l=t:l=s.getEdgeAgainstPoint(o),u=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,b),u||(f=this._router.cornerPoint,h=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(h),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let A=[];for(let m of this._result)A.push(new g().copyFrom(m));this._result=A}optimusTerminusFat(){var e,t,a;a=this._result[1],a instanceof Fa&&(e=a),a=this._result[this._result.length-2],a instanceof Fa&&(t=a),e&&(this._result[1]=e.scalePoint()),t&&e!=t&&(this._result[this._result.length-2]=t.scalePoint())}pushAllPathPoint2(e,t){var a=this._tempPublicEdgeList.length,r,i;this._result=new Array,this._result.push(e);for(var s=e,o,l,c,f=0;f<a;f++)if(r=this._tempPublicEdgeList[f],l=null,r.crossPoint)l=this.getFatPoint(r,r.crossPoint),l?this._result.push(l):this._result.push(r.crossPoint),s=r.crossPoint;else{i=null,o=null;for(var h=f+1;h<a&&(i=this._tempPublicEdgeList[h],o=i.crossPoint,!o);h++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==s?c=o.clone():(ir.CROSS_TEST_DIRECTION.setTo(o.x-s.x,0,o.z-s.z),c=this._router.calcCrossEdge(r,s,ir.CROSS_TEST_DIRECTION)),this._result.push(c))}this._result.push(t)}optimusByRadius(){var e=new Array;e.length=this._result.length;var t=this._result.length-2,a,r,i,s,o,l,c,f,h,u,b,A,m;for(m=0;m<t;m++)c=f=h=null,s=o=l=null,b=!1,A=null,a=this._result[m],r=this._result[m+1],i=this._result[m+2],a instanceof Fa&&(s=a),r instanceof Fa&&(o=r),i instanceof Fa&&(l=i),s&&(c=s.ownerPoint),o&&(f=o.ownerPoint),l&&(h=l.ownerPoint),c&&f&&c==f&&f!=h&&(b=!0),h&&f&&h==f&&c!=f&&(b=!0),b&&(ir.CROSS_TEST_DIRECTION.copyFrom(a),ir.CROSS_TEST_DIRECTION.decrementBy(i),u=o.ownerEdge,b=this._router.hasCrossPoint(u.pointA,u.pointB,i,ir.CROSS_TEST_DIRECTION),b&&(A=this._router.calcCrossPointOut(f,r,i,ir.CROSS_TEST_DIRECTION)),A&&(e[m+1]=A))}getFatPoint(e,t){if(e==null)return null;var a;t instanceof Fa&&(a=t);var r;return a?r=a.ownerPoint:r=e.getEqualPoint(t),r==null?null:(a=e.getFatPoint(r),a)}}class ru extends g{_id=0;_plane;_points=new Array;_edges=new Array;_neibourTriangles=new rs;_pointAgainstEdge=new rs;_edgeAgainstPoint=new rs;_mask=0;_aabbBox;f=0;gg=0;h=0;parent;costMultiplier=1;openId=0;closeId=0;get aabb(){return this._aabbBox}initAABB(){this._aabbBox=new Qt,this._aabbBox.addPoint(this._points[0]),this._aabbBox.addPoint(this._points[1]),this._aabbBox.addPoint(this._points[2])}calcGlobalQuadAABB(){}get isTriangle(){return!0}constructor(e,t,a,r){super(0,0,0,0),this._id=e,this._mask=Sr.WalkAble,this._edges.push(t,a,r);var i;for(i of this._edges)this._points.indexOf(i.pointA)==-1&&this._points.push(i.pointA),this._points.indexOf(i.pointB)==-1&&this._points.push(i.pointB);this.x=(this._points[0].x+this._points[1].x+this._points[2].x)/3,this.y=(this._points[0].y+this._points[1].y+this._points[2].y)/3,this.z=(this._points[0].z+this._points[1].z+this._points[2].z)/3,this._plane=new eu,this._plane.fromPoints(this._points[0],this._points[1],this._points[2]),this._plane.normalize(),this.genarateAgainstData(),this.initAABB()}genarateAgainstData(){var e,t;for(e of this._edges)for(t of this._points)e.pointA!=t&&e.pointB!=t&&(this._edgeAgainstPoint.put(e,t),this._pointAgainstEdge.put(t,e))}get id(){return this._id}get plane(){return this._plane}get points(){return this._points}addNeibour(e,t){if(this._edges.indexOf(e)>=0)this._neibourTriangles.put(e,t);else throw new Error("the edge is not in triangle!!!")}getNeibourTriangles(e=null,t=1,a=1){e=e||new Array,e.length=0;var r,i,s=this._neibourTriangles.getKeys(),o;for(o of s)i=o,i.testMask(t)&&(r=this._neibourTriangles.getValueByKey(i),r.testMask(a)&&e.push(r));return e}getEdges(e=null,t=1){e=e||new Array,e.length=0;var a;for(a of this._edges)a.testMask(t)&&e.push(a);return e}get walkAble(){return this.testMask(Sr.WalkAble)}get edges(){return this._edges}testMask(e){return(this._mask&e)==e}getEdgeAgainstPoint(e){return this._edgeAgainstPoint.getValueByKey(e)}getPointAgainstEdge(e){return this._pointAgainstEdge.getValueByKey(e)}getPublicEdge(e){if(e&&e!=this){var t=this._neibourTriangles.getKeys(),a;for(a of t)if(this._neibourTriangles.getValueByKey(a)==e)return a}return null}loopPublicEdge(e){var t,a;if(e&&e!=this){for(t of this._edges)for(a of e._edges)if(t==a)return t}return null}randomPoint(){var e=this._points[2].subtract(this._points[0]);e.scaleBy(Math.random()),e.incrementBy(this._points[0]);var t=this._points[1].subtract(e);return t.scaleBy(Math.random()),t.incrementBy(e),t}}class up{_nav3dPoints;_nav3dEdges;_nav3dTriangles;_path;_edgesDict;_nav3dAstar;_nav3dFunnel;_terrainQuad;_triangleList;get edges(){return this._nav3dEdges}get points(){return this._nav3dPoints}get path(){return this._path}get triangles(){return this._nav3dTriangles}constructor(e,t){this._nav3dPoints=new Array,this._nav3dEdges=new Array,this._nav3dTriangles=new Array,this._edgesDict=new rs,this.initPoints(e),this.initEdgesAndTriangles(t),this.createConnections(),this._nav3dAstar=new au,this._nav3dFunnel=new ir,this._terrainQuad=new ch(8,128),this._terrainQuad.createQuadTree(this._nav3dTriangles)}getTriangleAtPoint(e,t=5){return this._terrainQuad.getTriangleAtPoint(e,t)}findPath(e,t,a=5){this._path=null,this._triangleList=null;var r=this.getTriangleAtPoint(e,10),i=this.getTriangleAtPoint(t,10),s=this._nav3dAstar.findPath(this,r,i);return s?(this._triangleList=this._nav3dAstar.channel,s=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,s):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new Mt(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,s,o=e.length,l=0;l<o;l++)t=e[l],a=this.tryCreateEdge(t[0],t[1]),r=this.tryCreateEdge(t[1],t[2]),i=this.tryCreateEdge(t[2],t[0]),!(a==null||r==null||i==null)&&(s=new ru(l,a,r,i),this._nav3dTriangles.push(s))}tryCreateEdge(e,t){if(e==t)throw new Error("edge point index error!!!");if(e>t){var a=e;e=t,t=a}var r=this._edgesDict.getValueByKey(e+"_"+t);return r==null&&(r=new ka(this._nav3dPoints[e],this._nav3dPoints[t]),this._nav3dEdges.push(r),this._edgesDict.put(e+"_"+t,r)),r}createConnections(){for(var e=this._nav3dTriangles.length,t=this._nav3dTriangles.length,a,r,i,s,o=0;o<e;o++){a=this._nav3dTriangles[o];for(i of a.edges)i.addTriangleOwners(a);for(var l=0;l<t;l++)r=this._nav3dTriangles[l],a!=r&&(s=a.loopPublicEdge(r),s&&(a.addNeibour(s,r),r.addNeibour(s,a)))}}}class Ko{x;y;setTo(e,t){this.x=e,this.y=t}equals(e,t){return e==this.x&&t==this.y}equalPoint(e){return this.equals(e.x,e.y)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y)}clone(){var e=new Ko;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class Ga extends Ve{width;height;depth;constructor(e=1,t=1,a=1){super(),this.width=e,this.height=t,this.depth=a,this.initVertex()}initVertex(){let e=this.width/2,t=this.height/2,a=this.depth/2;this.bounds=new Ce(g.ZERO.clone(),new g(this.width,this.height,this.depth));let r=new Float32Array([-e,t,a,e,t,a,e,t,-a,-e,t,-a,-e,t,a,e,t,-a,e,-t,a,-e,-t,a,-e,-t,-a,e,-t,-a,e,-t,a,-e,-t,-a,-e,-t,a,-e,t,a,-e,t,-a,-e,-t,-a,-e,-t,a,-e,t,-a,e,t,a,e,-t,a,e,-t,-a,e,t,-a,e,t,a,e,-t,-a,e,t,a,-e,t,a,-e,-t,a,-e,-t,a,e,-t,a,e,t,a,e,-t,-a,-e,-t,-a,-e,t,-a,e,t,-a,e,-t,-a,-e,t,-a]),i=new Float32Array([0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1]),s=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),o=[0,2,1,3,5,4,6,8,7,9,11,10,12,14,13,15,17,16,18,20,19,21,23,22,24,26,25,27,29,28,30,32,31,33,35,34],l=new Uint16Array(o.reverse());this.setIndices(l),this.setAttribute(G.position,r),this.setAttribute(G.normal,i),this.setAttribute(G.uv,s),this.setAttribute(G.TEXCOORD_1,s),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class iu extends Ve{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,s=!1,o=0,l=Math.PI*2){super(),this.radiusTop=e,this.radiusBottom=t,this.height=a,this.radialSegments=r,this.heightSegments=i,this.openEnded=s,this.thetaStart=o,this.thetaLength=l,this.instanceID=Gt(),this.buildGeometry()}addGroup(e,t,a){this.addSubGeometry({indexStart:e,indexCount:t,vertexStart:e,vertexCount:0,firstStart:0,index:a,topology:0})}buildGeometry(){const e=this;this.radialSegments=Math.floor(this.radialSegments),this.heightSegments=Math.floor(this.heightSegments);const t=[],a=[],r=[],i=[];let s=0;const o=[],l=this.height/2;let c=0;A(),this.openEnded===!1&&(this.radiusTop>0&&m(!0),this.radiusBottom>0&&m(!1));let f=new Float32Array(t),h=new Float32Array(a),u=new Float32Array(r),b=new Uint16Array(i);this.setAttribute(G.position,f),this.setAttribute(G.normal,h),this.setAttribute(G.uv,u),this.setAttribute(G.TEXCOORD_1,u),this.setIndices(b);function A(){const p=new g,D=new g;let _=0;const v=(e.radiusBottom-e.radiusTop)/e.height;for(let U=0;U<=e.heightSegments;U++){const y=[],S=U/e.heightSegments,F=S*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let k=0;k<=e.radialSegments;k++){const x=k/e.radialSegments;let w=x*e.thetaLength+e.thetaStart;k==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(w=0);const R=Math.sin(w),Q=Math.cos(w);D.x=F*R,D.y=-S*e.height+l,D.z=F*Q,t.push(D.x,D.y,D.z),p.set(R,v,Q).normalize(),a.push(p.x,p.y,p.z),r.push(x,1-S),y.push(s++)}o.push(y)}for(let U=0;U<e.radialSegments;U++)for(let y=0;y<e.heightSegments;y++){const S=o[y][U],F=o[y+1][U],k=o[y+1][U+1],x=o[y][U+1];i.push(S,F,x),i.push(F,k,x),_+=6}e.addGroup(c,_,0),c+=_}function m(p){const D=s,_=new fe,v=new g;let U=0;const y=p===!0?e.radiusTop:e.radiusBottom,S=p===!0?1:-1;for(let k=1;k<=e.radialSegments;k++)t.push(0,l*S,0),a.push(0,S,0),r.push(.5,.5),s++;const F=s;for(let k=0;k<=e.radialSegments;k++){const w=k/e.radialSegments*e.thetaLength+e.thetaStart,R=Math.cos(w),Q=Math.sin(w);v.x=y*Q,v.y=l*S,v.z=y*R,t.push(v.x,v.y,v.z),a.push(0,S,0),_.x=R*.5+.5,_.y=Q*.5*S+.5,r.push(_.x,_.y),s++}for(let k=0;k<e.radialSegments;k++){const x=D+k,w=F+k;p===!0?i.push(w,w+1,x):i.push(w+1,w,x),U+=3}e.addGroup(c,U,p===!0?1:2),c+=U}}}class su extends Ve{radius;tube;radialSegments;tubularSegments;constructor(e=.4,t=.1,a=32,r=32){super(),this.radius=e,this.tube=t,this.radialSegments=a,this.tubularSegments=r,this.initVertex()}initVertex(){const e=2*Math.PI,t=this.radius,a=this.tube,r=this.radialSegments,i=this.tubularSegments;this.bounds=new Ce(g.ZERO.clone(),new g(t*2,a*2,t*2));var s=(r+1)*(i+1);let o=new Float32Array(s*3),l=new Float32Array(s*3),c=new Float32Array(s*2),f=new Uint16Array(r*i*2*3),h=0,u=0,b=0,A=0;for(let m=0;m<=r;m++)for(let p=0;p<=i;p++){const D=p/i,_=m/r,v=D*e,U=_*Math.PI*2;if(o[h++]=(t+a*Math.cos(U))*Math.sin(v),o[h++]=a*Math.sin(U),o[h++]=(t+a*Math.cos(U))*Math.cos(v),l[u++]=Math.sin(v)*Math.cos(U),l[u++]=Math.sin(U),l[u++]=Math.cos(v)*Math.cos(U),c[b++]=D,c[b++]=_,p<i&&m<r){const y=i+1,S=y*m+p,F=y*(m+1)+p,k=y*(m+1)+p+1,x=y*m+p+1;f[A++]=S,f[A++]=x,f[A++]=F,f[A++]=x,f[A++]=k,f[A++]=F}}this.setIndices(f),this.setAttribute(G.position,o),this.setAttribute(G.normal,l),this.setAttribute(G.uv,c),this.setAttribute(G.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class bp extends Ve{segment;row=0;constructor(e){super(),this.segment=e,this.buildGeometry()}buildGeometry(){this.row=this.segment+1;let e=new Uint32Array(this.segment*6),t=new Float32Array(this.row*3*2),a=new Float32Array(this.row*3*2),r=new Float32Array(this.row*2*2);for(let i=0;i<this.row;i++){t[i*3*2+0]=0,t[i*3*2+1]=0,t[i*3*2+2]=0,t[i*3*2+3]=0,t[i*3*2+4]=0,t[i*3*2+5]=0,a[i*3*2+0]=0,a[i*3*2+1]=0,a[i*3*2+2]=1,a[i*3*2+3]=0,a[i*3*2+4]=0,a[i*3*2+5]=1,r[i*2*2+0]=0,r[i*2*2+1]=i/this.segment,r[i*2*2+2]=1,r[i*2*2+3]=i/this.segment;let s=i*2,o=s,l=s+1,c=s+2,f=s+3;e[i*6+0]=o,e[i*6+1]=l,e[i*6+2]=c,e[i*6+3]=l,e[i*6+4]=f,e[i*6+5]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class gp extends Ve{faceCount=0;constructor(e){super(),this.faceCount=e,this.buildGeometry()}buildGeometry(){let e=new Uint32Array(this.faceCount*3),t=new Float32Array(this.faceCount*3*3),a=new Float32Array(this.faceCount*3*3),r=new Float32Array(this.faceCount*3*2),i=new Float32Array(this.faceCount*3*1);for(let s=0;s<this.faceCount;s++){let o=s*3+0,l=s*3+1,c=s*3+2;e[o]=o,e[l]=l,e[c]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.setAttribute(G.vIndex,i),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class mp extends ks{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new _s;let t=[];return B.res.fillColor(t,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.create(this._minSize,this._minSize,t,!1),this.createFromTexture(this._minSize,this._internalTexture),this}changeColor(e){return this._skyColor=e,B.res.fillColor(this._internalTexture.floatArray,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.updateTexture(this._minSize,this._minSize,this._internalTexture.floatArray,!1),this._faceData.uploadTexture(0,this._internalTexture),this}get color(){return this._skyColor}set color(e){this.changeColor(e)}}class pp extends d.Object3D{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new d.Object3D,t=new d.Object3D,a=new d.Object3D,r=new Ga(2,2,2),i=new Ga(2,2,2),s=new Ga(2,2,2),o=new Bt;o.baseColor=new Z(1,0,0);let l=new Bt;l.baseColor=new Z(0,1,0);let c=new Bt;c.baseColor=new Z(0,0,1);let f=e.addComponent(d.MeshRenderer),h=t.addComponent(d.MeshRenderer),u=a.addComponent(d.MeshRenderer);f.geometry=r,f.material=o,f.castShadow=!1,h.geometry=i,h.material=l,h.castShadow=!1,u.geometry=s,u.material=c,u.castShadow=!1,e.localScale=new g(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new g(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new g(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class Ap{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Ve,i=e.getAttribute(G.position).data.length/3,s=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let h=f[1].attribute;if(h==G.indices)continue;let u=e.getAttribute(h).data,b=u.length,A=new Float32Array(b*t);for(let m=0;m<t;m++){A.set(u,b*m);for(let p=0;p<i;p++)s[i*m+p]=m}r.setAttribute(h,A)}r.setAttribute(G.vIndex,s);let o=e.getAttribute(G.indices).data,l=o.length,c=new Uint32Array(o.length*t);for(let f=0;f<t;f++)for(let h=0;h<l;h++){let u=f*i,b=f*l;const A=o[h]+u;c[b+h]=A}return r.setIndices(c),r.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,index:0,vertexCount:0,firstStart:0,topology:0}),r}static generateNormal(){}static generateTangent(){}static packUV(){}}class Dp extends d.Object3D{size=100;divisions=10;constructor(e=100,t=10){super(),this.size=e,this.divisions=t,this.buildGeometry(),this.addAxis()}buildGeometry(){const e=[],t=[],a=this.size/this.divisions,r=this.size/2,i=this.divisions/2;for(let c=0,f=-r;c<=this.divisions;c++,f+=a)c!==i&&(e.push(-r,0,f,r,0,f),e.push(f,0,-r,f,0,r));for(let c=0;c<e.length/3;c+=2)t.push(c,c+1);let s=new Ve;s.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),s.setAttribute(G.position,new Float32Array(e)),s.addSubGeometry({indexStart:0,indexCount:t.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let o=new Bt;o.topology="line-list",o.baseColor=new Z(1,1,1,.15),o.blendMode=Ae.ADD,o.castReflection=!1;let l=this.addComponent(d.MeshRenderer);l.geometry=s,l.material=o}addAxis(){const e=this.size/2;let t=new Float32Array([-e,0,0,e,0,0]),a=new Uint16Array([0,1,2,3]),r=new Ve;r.setIndices(a),r.setAttribute(G.position,t),r.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});{let i=new d.Object3D,s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(1,0,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new d.Object3D;i.rotationY=90;let s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(0,1,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class _p{static color_temperature_to_rgb(e){e<1e3?e=1e3:e>4e4&&(e=4e4);let t=e/100,a=this.get_red(t),r=this.get_green(t),i=this.get_blue(t);return new Z(a/255,r/255,i/255,1)}static get_red(e){if(e<=66)return 255;let t=329.698727446*Math.pow(e-60,-.1332047592);return this.bound(t)}static get_green(e){let t=0;return e<=66?t=99.4708025861*Math.log(e)-161.1195681661:t=288.1221695283*Math.pow(e-60,-.0755148492),this.bound(t)}static get_blue(e){let t=0;return e>=66?255:e<=19?0:(t=138.5177312231*Math.log(e-10)-305.0447927307,this.bound(t))}static bound(e,t=0,a=255){let r=Math.max(e,t);return Math.min(r,a)}}class Bp{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new Ga),this.planeGeo||(this.planeGeo=new $r(1,1,1,1,g.UP)),this.sphere||(this.sphere=new Ir(1,35,35)),this.material||(this.material=new qt),this.materialMap||(this.materialMap=new Map)}static get CubeMesh(){return this.initHeap(),this.boxGeo}static get SphereMesh(){return this.initHeap(),this.sphere}static GetCube(){this.initHeap();let e=new d.Object3D,t=e.addComponent(d.MeshRenderer);return t.geometry=this.boxGeo,t.material=this.material.clone(),t.castShadow=!0,e}static GetMaterial(e){let t=this.materialMap.get(e);return t||(t=new qt,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.geometry=this.planeGeo;let r=this.GetMaterial(e);return r.blendMode=Ae.ADD,r.castShadow=!1,a.material=r,a.castGI=!1,a.castReflection=!1,t}static GetSingleCube(e,t,a,r,i,s){this.initHeap();let o=new qt;o.roughness=.5,o.metallic=.1,o.baseColor=new Z(r,i,s,1);let l=new d.Object3D,c=l.addComponent(d.MeshRenderer);return c.castGI=!0,c.geometry=new Ga(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new qt;i.baseColor=new Z(t,a,r,1);let s=new d.Object3D,o=s.addComponent(d.MeshRenderer);return o.castGI=!0,o.geometry=new Ir(e,20,20),o.material=i,s}static get Sphere(){this.initHeap();let e=new d.Object3D,t=e.addComponent(d.MeshRenderer);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);return r.castShadow=!1,r.geometry=new Ga(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,s,o=1,l=!0){let c=new d.Object3D,f=c.addComponent(d.PointLight);f.lightColor=new Z(r,i,s,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let h=this.GetSingleSphere(.1,1,1,1);return c.addChild(h),f}}var N=(n=>(n[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z",n[n.XY=3]="XY",n[n.XZ=4]="XZ",n[n.YZ=5]="YZ",n[n.XYZ=6]="XYZ",n[n.MAX=7]="MAX",n[n.NONE=8]="NONE",n))(N||{}),ha=(n=>(n[n.Local=0]="Local",n[n.Global=1]="Global",n))(ha||{});class Hs extends $e{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(N.MAX),this.mAxisColor=new Array(N.MAX),this.mAxisMaterial=new Array(N.MAX),this.mAxisCollider=new Array(N.MAX)}get target(){return this.object3D.target}get mX(){return this.object3D.mXObj}get mY(){return this.object3D.mYObj}get mZ(){return this.object3D.mZObj}get transformSpaceMode(){return this.object3D.transformSpaceMode}init(e){this.mContainer=new d.Object3D;let t=new Bt;t.baseColor=new Z(1,0,0),t.depthCompare=it.always,this.mAxisColor[N.X]=t.baseColor,this.mAxisMaterial[N.X]=t;let a=new Bt;a.baseColor=new Z(0,1,0),a.depthCompare=it.always,this.mAxisColor[N.Y]=a.baseColor,this.mAxisMaterial[N.Y]=a;let r=new Bt;r.baseColor=new Z(0,0,1),r.depthCompare=it.always,this.mAxisColor[N.Z]=r.baseColor,this.mAxisMaterial[N.Z]=r;let i=this.createCustomAxis(N.X),s=this.createCustomAxis(N.Y),o=this.createCustomAxis(N.Z);this.mContainer.addChild(this.mAxis[N.X]=i),this.mContainer.addChild(this.mAxis[N.Y]=s),this.mContainer.addChild(this.mAxis[N.Z]=o),this.mAxisCollider[N.X]=i.getComponent(da),this.mAxisCollider[N.Y]=s.getComponent(da),this.mAxisCollider[N.Z]=o.getComponent(da)}start(){}onEnable(e){this.object3D.addChild(this.mContainer),this.reset()}onDisable(e){this.object3D.removeChild(this.mContainer)}reset(){switch(this.transformSpaceMode){case ha.Local:{let t=T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).decompose();this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=t[1].x,this.object3D.rotationY=t[1].y,this.object3D.rotationZ=t[1].z,this.object3D.x=t[0].x,this.object3D.y=t[0].y,this.object3D.z=t[0].z}break;case ha.Global:{this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=0,this.object3D.rotationY=0,this.object3D.rotationZ=0;const e=this.mX.transform.worldPosition;this.object3D.x=e.x,this.object3D.y=e.y,this.object3D.z=e.z}break}}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||s==N.XYZ)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},s==N.XYZ)))break}return i}currentAxis=N.NONE;beginPoint=new g;beginMousePos=new g;currentPoint=new g;onMouseDown(e){if(e.mouseCode!=Ps.MOUSE_LEFT)return;let t=this.pickAxis();if(!t)return;this.currentAxis=t.axis,e.stopImmediatePropagation();const r=this.object3D.transform.scene3D.view.camera;let i=r.worldToScreenPoint(this.mX.transform.worldPosition),s=r.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(s),this.beginMousePos.x=B.inputSystem.mouseX,this.beginMousePos.y=B.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==N.NONE){let t=this.lastMoveObj.getComponent(d.MeshRenderer).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.X]),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Y]),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Z])),this.lastMoveAxis=N.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new Z(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let s=i.subtract(this.beginPoint);g.HELP_0.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let o=g.distance(g.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(g.HELP_0),this.transformSpaceMode){case ha.Local:this.applyLocalTransform(this.currentAxis,s,o);break;case ha.Global:this.applyGlobalTransform(this.currentAxis,s,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Ps.MOUSE_LEFT&&(this.currentAxis=N.NONE,this.reset())}onUpdate(e){let a=g.distance(e.camera.transform.worldPosition,this.object3D.transform.worldPosition)/100;if(this.mContainer.scaleX=this.mContainer.scaleY=this.mContainer.scaleZ=a,this.mX){const r=this.mX.transform.worldPosition;this.object3D.x=r.x,this.object3D.y=r.y,this.object3D.z=r.z}}applyLocalTransform(e,t,a){console.warn("not imp")}applyGlobalTransform(e,t,a){console.warn("not imp")}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=0,a=0,r=0;switch(e){case N.X:t=1;break;case N.Y:a=1;break;case N.Z:r=1;break}let i=.4+t*20,s=.4+a*20,o=.4+r*20,l=new d.Object3D;l.x=i*.5,l.y=s*.5,l.z=o*.5;let c=l.addComponent(d.MeshRenderer);c.geometry=new Ga(i,s,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(da),h=new oi;return h.setFromCenterAndSize(new g(0,0,0),new g(i+1,s+1,o+1)),f.shape=h,l}}class nu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(.9,.9,.9),t.depthCompare=it.always,this.mAxisColor[N.XYZ]=t.baseColor,this.mAxisMaterial[N.XYZ]=t;let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);r.geometry=new Ga(2,2,2),r.material=this.mAxisMaterial[N.XYZ];let i=a.addComponent(da),s=new oi;s.setFromCenterAndSize(new g(0,0,0),new g(2,2,2)),i.shape=s,this.mContainer.addChild(this.mAxis[N.XYZ]=a),this.mAxisCollider[N.XYZ]=a.getComponent(da)}applyLocalTransform(e,t,a){switch(this.currentAxis){case N.XYZ:{let r=0;Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?r=t.x:r=t.z:r=t.y,this.mX.scaleX+=r,this.mX.scaleY+=r,this.mX.scaleZ+=r}break;default:this.mX.transform.worldMatrix.transformVector(t,t),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=g.HELP_0;r.set(0,0,0),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(r.x=t.x),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(r.y=t.y),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,g.HELP_1),this.mX.scaleX+=g.HELP_1.x,this.mX.scaleY+=g.HELP_1.y,this.mX.scaleZ+=g.HELP_1.z}createCustomAxis(e){let t=super.createAxis(e),a=this.createBox(e);return t.addChild(a),t}createBox(e){let t=0,a=0,r=0,i=new d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new Ga(2,2,2),c.material=this.mAxisMaterial[e],i}}var mt=(n=>(n[n.Scale=0]="Scale",n[n.Rotation=1]="Rotation",n[n.Translation=2]="Translation",n[n.NONE=3]="NONE",n))(mt||{});class ou extends Hs{applyLocalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ,this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.identity(),T.help_matrix_1.createByRotation(1,g.Y_AXIS),T.help_matrix_2.multiplyMatrices(T.help_matrix_1,T.help_matrix_0),T.help_matrix_2.invert(),T.help_matrix_1.multiplyMatrices(T.help_matrix_2,T.help_matrix_0);let r=T.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),this.currentAxis==N.X){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.x-a.x>0&&(s=360-s),s}if(this.currentAxis==N.Y){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.y-a.y>0&&(s=360-s),s}if(this.currentAxis==N.Z){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.z-a.z>0&&(s=360-s),s}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.Y||this.currentAxis==N.Z){let r=this.getAngle();switch(T.help_matrix_0.identity(),this.currentAxis){case N.X:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.X_AXIS);break;case N.Y:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Y_AXIS);break;case N.Z:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Z_AXIS);break}T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let s=T.help_matrix_1.decompose(sa.QUATERNION)[1];ne.HELP_0.set(s.x,s.y,s.z,s.w),this.mLastAngle=r,this.mX.transform.localRotQuat=ne.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!1,this.mAxis[this.currentAxis].getComponent(d.MeshRenderer).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new d.Object3D;switch(e){case N.X:t.rotationZ=90;break;case N.Y:break;case N.Z:t.rotationX=90;break}let a=t.addComponent(d.MeshRenderer);a.geometry=new su(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;return i.setFromCenterAndSize(new g,new g(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r)){let l=g.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class lu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(0,0,1),t.depthCompare=it.always,this.mAxisColor[N.XY]=t.baseColor,this.mAxisMaterial[N.XY]=t;let a=new Bt;a.doubleSide=!0,a.baseColor=new Z(0,1,0),a.depthCompare=it.always,this.mAxisColor[N.XZ]=a.baseColor,this.mAxisMaterial[N.XZ]=a;let r=new Bt;r.doubleSide=!0,r.baseColor=new Z(1,0,0),r.depthCompare=it.always,this.mAxisColor[N.YZ]=r.baseColor,this.mAxisMaterial[N.YZ]=r;let i=this.createPlane(N.XY),s=this.createPlane(N.XZ),o=this.createPlane(N.YZ);this.mContainer.addChild(this.mAxis[N.XY]=i),this.mContainer.addChild(this.mAxis[N.XZ]=s),this.mContainer.addChild(this.mAxis[N.YZ]=o),this.mAxisCollider[N.XY]=i.getComponent(da),this.mAxisCollider[N.XZ]=s.getComponent(da),this.mAxisCollider[N.YZ]=o.getComponent(da)}applyLocalTransform(e,t,a){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),T.help_matrix_0.transformVector(t,g.HELP_0),this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ||(g.HELP_0.x=0),this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ||(g.HELP_0.y=0),this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ||(g.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(g.HELP_0,g.HELP_1),this.mX.x+=g.HELP_1.x,this.mX.y+=g.HELP_1.y,this.mX.z+=g.HELP_1.z}applyGlobalTransform(e,t,a){T.help_matrix_0.identity(),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&T.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,0,t.z),T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let r=T.help_matrix_1.decompose(sa.QUATERNION);this.mX.transform.localPosition=r[0],console.log(this.target.localPosition)}createCustomAxis(e){let t=super.createAxis(e),a=this.createArrows(e);return t.addChild(a),t}createArrows(e){let t=0,a=0,r=0,i=new d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1,i.rotationY=-90;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new iu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;switch(r.shape=i,e){case N.XY:a.geometry=new $r(4,4,1,1,g.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,4,.1));break;case N.XZ:a.geometry=new $r(4,4,1,1,g.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,.1,4));break;case N.YZ:a.geometry=new $r(4,4,1,1,g.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(.1,4,4));break}return t}}class qo extends d.Object3D{static _instance;static get instance(){return this._instance||(this._instance=new qo),this._instance}mTarget;mTransformMode=mt.NONE;mTransformSpaceType=ha.Global;mControllers;mXObj;mYObj;mZObj;constructor(){super(),this.mControllers=[null,null,null],this.mControllers[mt.Scale]=this.addComponent(nu),this.mControllers[mt.Rotation]=this.addComponent(ou),this.mControllers[mt.Translation]=this.addComponent(lu),this.mControllers[mt.Scale].enable=!1,this.mControllers[mt.Rotation].enable=!1,this.mControllers[mt.Translation].enable=!1,this.mXObj=new d.Object3D,this.mYObj=new d.Object3D,this.mZObj=new d.Object3D,this.mXObj.addChild(this.mYObj),this.mYObj.addChild(this.mZObj)}get transformMode(){return this.mTransformMode}get transformSpaceMode(){return this.mTransformSpaceType}active(e){e.addChild(this),e.addChild(this.mXObj)}unActive(e){e.removeChild(this)}get target(){return this.mTarget}selectObject(e,t,a){this.mTarget!=e&&(e?this.activate():this.unactivate(),this.mTarget=e,this.mXObj.localPosition=e.transform.worldPosition.clone()),t!=null&&this.selectTransformMode(t),a!=null&&this.selectTransformSpaceMode(a)}selectTransformMode(e){this.mTransformMode!=e&&(this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!1),this.mTransformMode=e,this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!0))}selectTransformSpaceMode(e){this.mTransformSpaceType!=e&&(this.mTransformSpaceType=e,this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].reset())}activate(){B.inputSystem.addEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onMouseDown,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onMouseMove,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){B.inputSystem.removeEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onMouseMove,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.onMouseUp,this)}onKeyDown(e){switch(e.keyCode){case tt.Key_R:this.selectTransformMode(mt.Scale),this.selectTransformSpaceMode(ha.Local);break;case tt.Key_E:this.selectTransformMode(mt.Rotation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_W:this.selectTransformMode(mt.Translation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_A:this.selectTransformSpaceMode(ha.Local);break;case tt.Key_S:this.selectTransformSpaceMode(ha.Global);break}}onMouseDown(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseDown(e)}onMouseMove(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseMove(e)}onMouseUp(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseUp(e)}}const vp=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));d.AccelerateDecelerateInterpolator=z0,d.AccelerateInterpolator=L0,d.AnimationCurve=Vi,d.AnimationCurveT=Cr,d.AnimationMonitor=Mr,d.AnimatorEventKeyframe=Zb,d.AnticipateInterpolator=j0,d.AnticipateOvershootInterpolator=xi,d.ArrayHas=gu,d.ArrayItemIndex=mu,d.AtlasParser=Tf,d.AtmosphericComponent=Vb,d.AtmosphericScatteringSky=yd,d.AtmosphericScatteringSkySetting=Ud,d.AtmosphericScatteringSky_shader=vd,d.AttributeAnimCurve=Rd,d.AxisObject=pp,d.B3DMLoader=er,d.B3DMLoaderBase=Bf,d.B3DMParseUtil=so,d.B3DMParser=ro,d.BRDFLUT=xf,d.BRDFLUTGenerate=Ff,d.BRDF_frag=wl,d.BatchTable=Fs,d.BiMap=Ym,d.BillboardComponent=Ni,d.BillboardType=Ar,d.BitUtil=ic,d.BitmapTexture2D=$a,d.BitmapTexture2DArray=yc,d.BitmapTextureCube=Kn,d.Blend=vc,d.BlendFactor=Uc,d.BlendMode=Ae,d.BlendShapeData=No,d.BlendShapePropertyData=Po,d.BloomPost=jg,d.BlurEffectCreatorBlur_cs=hf,d.BlurEffectCreatorSample_cs=df,d.BlurTexture2DBufferCreator=uf,d.BounceInterpolator=Kt,d.BoundUtil=kn,d.BoundingBox=Ce,d.BoundingSphere=Tr,d.BoundingVolume=Vr,d.BoxColliderShape=oi,d.BoxGeometry=Ga,d.BrdfLut_frag=Bl,d.BsDF_frag=Il,d.BxDF_frag=Rl,d.BxdfDebug_frag=Pl,d.BytesArray=Ls,d.CEvent=bt,d.CEventDispatcher=ja,d.CEventListener=ns,d.CResizeEvent=nr,d.CSM=ia,d.Camera3D=Hr,d.CameraControllerBase=ag,d.CameraType=st,d.CameraUtil=ht,d.CapsuleColliderShape=Cg,d.CastPointShadowMaterialPass=Nc,d.CastShadowMaterialPass=Pc,d.Clearcoat_frag=Tl,d.ClusterBoundsSource_cs=m0,d.ClusterConfig=Rt,d.ClusterDebug_frag=cl,d.ClusterLight=Jl,d.ClusterLightingBuffer=g0,d.ClusterLightingRender=A0,d.ClusterLighting_cs=p0,d.CollectInfo=Gc,d.ColliderComponent=da,d.ColliderShape=ut,d.ColliderShapeType=ni,d.Color=Z,d.ColorGradient=Xm,d.ColorLitMaterial=Wm,d.ColorLitShader=Ad,d.ColorPassFragmentOutput=Eb,d.ColorPassRenderer=b0,d.ColorUtil=cs,d.ComData=Gs,d.Combine_cs=dd,d.Common_frag=Dl,d.Common_vert=_l,d.ComponentBase=$e,d.ComponentCollect=Ne,d.ComputeGPUBuffer=ei,d.ComputeShader=Se,d.Context3D=al,d.CubeCamera=Qn,d.CubeMapFaceEnum=bf,d.CubeSky_Shader=rn,d.CubicBezierCurve=Zs,d.CubicBezierPath=Hm,d.CubicBezierType=jh,d.CycleInterpolator=Z0,d.CylinderGeometry=iu,d.DDGIIrradianceComputePass=I0,d.DDGIIrradianceGPUBufferReader=Hi,d.DDGIIrradianceVolume=n0,d.DDGIIrradiance_shader=R0,d.DDGILightingPass=P0,d.DDGILighting_shader=M0,d.DDGIMultiBouncePass=Q0,d.DDGIProbeRenderer=N0,d.DEGREES_TO_RADIANS=pt,d.DRACO_DECODER_GLTF_JS=H0,d.DecelerateInterpolator=G0,d.Denoising_cs=hd,d.Depth2DTextureArray=v0,d.DepthCubeArrayTexture=_0,d.DepthMaterialPass=Vc,d.DepthOfFieldPost=Zg,d.DepthOfView_cs=Xf,d.DoubleArray=rs,d.EditorInspector=jr,d.Engine3D=B,d.Entity=s0,d.EntityBatchCollect=zc,d.EntityCollect=$,d.EnvMap_frag=vl,d.ErpImage2CubeMap=jt,d.ErpImage2CubeMapCreateCube_cs=gf,d.ErpImage2CubeMapRgbe2rgba_cs=mf,d.ExtrudeGeometry=Eg,d.FAILED=vr,d.FASTFLOOR=xa,d.FXAAPost=Mn,d.FXAAShader=k0,d.FastMathShader=yl,d.FatLineGeometry=ih,d.FatLineMaterial=Ch,d.FatLine_FS=fc,d.FatLine_VS=cc,d.FeatureTable=Ri,d.FileLoader=Tt,d.FirstPersonCameraController=rg,d.Float16ArrayTexture=_s,d.Float32ArrayTexture=i0,d.FlyCameraController=ig,d.FontChar=wf,d.FontInfo=kf,d.FontPage=Ef,d.FontParser=tr,d.ForwardRenderJob=O0,d.FragmentOutput=on,d.FragmentVarying=Sl,d.FrameCache=Ao,d.Frustum=pn,d.FrustumCSM=Bc,d.FrustumCulling_cs=kb,d.FullQuad_vert_wgsl=Nl,d.GBufferFrame=Be,d.GBufferPass=Mc,d.GBufferPost=Yg,d.GBufferStand=sc,d.GBuffer_pass=ln,d.GILighting=Xn,d.GIProbeMaterial=th,d.GIProbeMaterialType=Fo,d.GIProbeShader=Dd,d.GIRenderCompleteEvent=Pn,d.GIRenderStartEvent=Bs,d.GLBChunk=cf,d.GLBHeader=lf,d.GLBParser=Hn,d.GLSLLexer=Cc,d.GLSLLexerToken=Di,d.GLSLPreprocessor=Sc,d.GLSLSyntax=Ec,d.GLTFBinaryExtension=yf,d.GLTFMaterial=gm,d.GLTFParser=_t,d.GLTFSubParser=ys,d.GLTFSubParserCamera=K0,d.GLTFSubParserConverter=of,d.GLTFSubParserMaterial=$0,d.GLTFSubParserMesh=q0,d.GLTFSubParserSkeleton=Yn,d.GLTFSubParserSkin=ef,d.GLTFType=oa,d.GLTF_Accessors=T2,d.GLTF_Info=vs,d.GLTF_Light=E2,d.GLTF_Mesh=I2,d.GLTF_Node=w2,d.GLTF_Primitives=R2,d.GLTF_Scene=k2,d.GPUAddressMode=Ht,d.GPUBlendFactor=pu,d.GPUBufferBase=Za,d.GPUBufferType=ga,d.GPUCompareFunction=it,d.GPUContext=E,d.GPUCullMode=Vt,d.GPUFilterMode=fr,d.GPUPrimitiveTopology=ls,d.GPUTextureFormat=le,d.GPUVertexFormat=mi,d.GPUVertexStepMode=_u,d.GSplatFormat=di,d.GSplatGeometry=Sn,d.GSplatMaterial=Cn,d.GSplat_FS=Zc,d.GSplat_VS=jc,d.GTAOPost=Xg,d.GTAO_cs=Hf,d.GUIAtlasTexture=If,d.GUICanvas=zi,d.GUIConfig=Qr,d.GUIGeometry=Nd,d.GUIGeometryRebuild=Od,d.GUIMaterial=vo,d.GUIPassRenderer=V0,d.GUIPick=Wd,d.GUIPickHelper=Zd,d.GUIQuad=Na,d.GUIQuadAttrEnum=ot,d.GUIRenderer=Ld,d.GUIShader=Bo,d.GUISpace=fa,d.GUISprite=ai,d.GUITexture=mr,d.GaussianSplatParser=dm,d.GenerayRandomDir=zl,d.GeoJsonParser=um,d.GeoJsonUtil=bm,d.GeoType=Vs,d.GeometryBase=Ve,d.GeometryIndicesBuffer=Hc,d.GeometryUtil=Ap,d.GeometryVertexBuffer=Yc,d.GeometryVertexType=kt,d.GetComponentClass=rl,d.GetCountInstanceID=tn,d.GetRepeat=ku,d.GetShader=il,d.GlassShader=wb,d.GlobalBindGroup=ve,d.GlobalBindGroupLayout=An,d.GlobalFog=Hg,d.GlobalFog_shader=po,d.GlobalIlluminationComponent=Dg,d.GlobalUniform=sn,d.GlobalUniformGroup=En,d.GodRayPost=Kg,d.GodRay_cs=Kf,d.GridObject=Dp,d.HDRTexture=$n,d.HDRTextureCube=xs,d.Hair_frag=jl,d.Hair_shader_op=Rb,d.Hair_shader_tr=Ib,d.HaltonSeq=us,d.Horizontal=Hd,d.HoverCameraController=sg,d.I3DMLoader=va,d.I3DMLoaderBase=Cf,d.I3DMParser=no,d.IBLEnvMapCreator=Df,d.IBLEnvMapCreator_cs=Af,d.IESProfiles=Aa,d.IESProfiles_frag=Fl,d.IKDTreeUserData=Ig,d.ImageType=si,d.IndicesGPUBuffer=Xc,d.Inline_vert=Al,d.InputSystem=tl,d.InstanceDrawComponent=_g,d.InstanceUniform=Ul,d.InstancedMesh=Sf,d.Interpolator=br,d.InterpolatorEnum=Nn,d.IrradianceDataReaderCompleteEvent=gh,d.IrradianceVolumeData_frag=pl,d.Irradiance_frag=El,d.IsEditorInspector=uu,d.IsNonSerialize=$s,d.Joint=tf,d.JointPose=Zn,d.JumperInterpolator=J0,d.KDTreeEntity=Qg,d.KDTreeNode=_r,d.KDTreeRange=nh,d.KDTreeSpace=oh,d.KDTreeUUID=Xi,d.KHR_draco_mesh_compression=jn,d.KHR_lights_punctual=mm,d.KHR_materials_clearcoat=rf,d.KHR_materials_emissive_strength=sf,d.KHR_materials_ior=pm,d.KHR_materials_unlit=nf,d.KMZParser=Gf,d.KV=Mo,d.KelvinUtil=_p,d.KeyCode=tt,d.KeyEvent=Ia,d.Keyframe=Rs,d.KeyframeT=as,d.LASLoader=yh,d.LASParser=_m,d.LASUtils=Zt,d.LASVisualizationMode=hi,d.LDRTextureCube=ks,d.LOADED=Oa,d.LOADING=Vo,d.LRUCache=Nh,d.LambertMaterial=Jm,d.Lambert_shader=Yl,d.LightBase=Ei,d.LightData=hs,d.LightEntries=o0,d.LightType=ft,d.LightingFunction_frag=fl,d.Line=vt,d.LineClassification=Jd,d.LinearInterpolator=W0,d.LitMaterial=qt,d.Lit_shader=Ql,d.LoaderBase=gr,d.LoaderEvent=Mg,d.LoaderManager=Ns,d.MAX_VALUE=yu,d.MIN_VALUE=Cu,d.Material=Dt,d.MaterialDataUniformGPUBuffer=Tc,d.MaterialUtilities=Os,d.MathShader=dl,d.MathUtil=Ot,d.Matrix3=Pr,d.Matrix4=T,d.MatrixBindGroup=f0,d.MatrixGPUBuffer=c0,d.MatrixShader=Wl,d.MemoryDO=or,d.MemoryInfo=nl,d.MergeRGBACreator=Vg,d.MergeRGBA_cs=qf,d.MeshColliderShape=Ms,d.MinMaxAnimationCurves=ep,d.MinMaxCurve=$h,d.MinMaxCurveState=qh,d.MinMaxPolyCurves=tp,d.MorePassParser=zg,d.MorePassShader=uh,d.MorphTargetBlender=Hb,d.MorphTargetData=h0,d.MorphTargetFrame=Kb,d.MorphTargetTransformKey=Qd,d.MorphTarget_shader=Xt,d.MouseCode=Ps,d.MultiBouncePass_cs=T0,d.Navi3DAstar=au,d.Navi3DConst=is,d.Navi3DEdge=ka,d.Navi3DFunnel=ir,d.Navi3DMaskType=Sr,d.Navi3DMesh=up,d.Navi3DPoint=Mt,d.Navi3DPoint2D=Ko,d.Navi3DPointFat=Fa,d.Navi3DRouter=De,d.Navi3DTriangle=ru,d.NonSerialize=qs,d.NormalMap_frag=Cl,d.OAnimationEvent=af,d.OBJParser=wi,d.Object3DEvent=Pg,d.Object3DTransformTools=qo,d.Object3DUtil=Bp,d.ObjectAnimClip=Id,d.OcclusionSystem=Tn,d.Octree=ur,d.OctreeEntity=Jc,d.OrbitController=ng,d.OrderMap=Km,d.Orientation3D=sa,d.OutLineBlendColor_cs=$f,d.OutlineCalcOutline_cs=ed,d.OutlinePass=Tb,d.OutlinePost=qg,d.OutlinePostData=ph,d.OutlinePostManager=Ah,d.OutlinePostSlot=mh,d.Outline_cs=td,d.OvershootInterpolator=Y0,d.PARSING=Mh,d.PBRLItShader=Ml,d.PBRLitSSSShader=_d,d.PLUGIN_REGISTERED=Tm,d.PNTSLoader=xh,d.PNTSLoaderBase=Sh,d.PNTSParser=Fh,d.ParserBase=rt,d.ParserFormat=Je,d.ParticleSystemCurveEvalMode=Kh,d.ParticleSystemRandomnessIds=Zh,d.PassGenerate=yi,d.PassShader=bh,d.PassType=de,d.PhysicMaterialUniform_frag=hl,d.PickCompute=ah,d.PickFire=rh,d.PickGUIEvent3D=yt,d.PickResult=Dh,d.Picker_cs=ad,d.PingPong=cn,d.PipelinePool=vn,d.Plane3D=eu,d.PlaneClassification=Or,d.PlaneGeometry=$r,d.PlyMode=Sa,d.PlyParser=Io,d.PlyStreamParser=Uh,d.PointClassification=jd,d.PointCloudGeometry=Fn,d.PointCloudMaterial=r0,d.PointCloud_FS=a0,d.PointCloud_VS=t0,d.PointLightShadowRenderer=B0,d.PointShadowCubeCamera=D0,d.PointerEvent3D=Y,d.Polynomial=La,d.PolynomialCurve=rr,d.Polynomials=$m,d.PoolNode=Gd,d.PostBase=Jt,d.PostProcessingComponent=Wf,d.PostRenderer=S0,d.PreDepthPassRenderer=y0,d.PreFilteredEnvironment_cs=x0,d.PreFilteredEnvironment_cs2=vb,d.PreIntegratedLut=rd,d.PreIntegratedLutCompute=hh,d.PrefabAvatarData=Qo,d.PrefabAvatarParser=kh,d.PrefabBoneData=To,d.PrefabMaterialParser=wh,d.PrefabMeshData=Rh,d.PrefabMeshParser=Ih,d.PrefabNode=$i,d.PrefabParser=Qh,d.PrefabStringUtil=Sm,d.PrefabTextureData=Eh,d.PrefabTextureParser=Th,d.Preprocessor=ma,d.PriorityQueue=Lo,d.Probe=eh,d.ProbeEntries=Og,d.ProbeGBufferFrame=w0,d.ProfilerUtil=ct,d.PropertyAnimClip=jb,d.PropertyAnimTag=Td,d.PropertyAnimation=Do,d.PropertyAnimationClip=Zo,d.PropertyAnimationClipState=wd,d.PropertyAnimationEvent=Li,d.PropertyHelp=Oi,d.QuadAABB=Qt,d.QuadGlsl_fs=Hl,d.QuadGlsl_vs=Xl,d.QuadRoot=ch,d.QuadTree=lh,d.QuadTreeCell=Br,d.Quad_depth2dArray_frag_wgsl=Bu,d.Quad_depth2d_frag_wgsl=Ll,d.Quad_depthCube_frag_wgsl=Gl,d.Quad_frag_wgsl=Ol,d.Quad_vert_wgsl=Vl,d.Quaternion=ne,d.R32UintTexture=Ds,d.RADIANS_TO_DEGREES=Yr,d.RGBEErrorCode=pf,d.RGBEHeader=eo,d.RGBEParser=to,d.RTDescriptor=We,d.RTFrame=nt,d.RTResourceConfig=Qa,d.RTResourceMap=wt,d.Rand=pi,d.RandomSeed=Eu,d.Ray=na,d.RayCastMeshDetail=fi,d.Reader=Kr,d.Rect=Ai,d.Reference=xe,d.Reflection=Sd,d.ReflectionCG=oc,d.ReflectionEntries=l0,d.ReflectionMaterial=Fd,d.ReflectionRenderer=F0,d.ReflectionShader=xd,d.ReflectionShader_shader=nc,d.RegisterComponent=Nt,d.RegisterShader=Ta,d.RenderContext=In,d.RenderLayer=Ci,d.RenderLayerUtil=Un,d.RenderNode=Ba,d.RenderShaderCollect=Wc,d.RenderShaderCompute=dh,d.RenderShaderPass=qe,d.RenderTexture=Et,d.RendererBase=Ma,d.RendererJob=E0,d.RendererMap=C0,d.RendererMask=Me,d.RendererMaskUtil=ra,d.RendererPassState=u0,d.RepeatSE=fn,d.Res=zf,d.RotationControlComponents=ou,d.SHCommon_frag=lc,d.SN_ArrayConstant=_i,d.SN_BinaryOperation=hr,d.SN_Break=o2,d.SN_CodeBlock=Da,d.SN_Constant=Ha,d.SN_Continue=ms,d.SN_Declaration=et,d.SN_Discard=l2,d.SN_DoWhileLoop=n2,d.SN_Expression=Fe,d.SN_ForLoop=kr,d.SN_Function=bs,d.SN_FunctionArgs=gs,d.SN_FunctionCall=Fr,d.SN_IFBranch=wr,d.SN_Identifier=Xa,d.SN_IndexOperation=Rr,d.SN_Layout=Ui,d.SN_ParenExpression=Fc,d.SN_Precision=ps,d.SN_Return=Bi,d.SN_SelectOperation=vi,d.SN_Struct=Ya,d.SN_TernaryOperation=kc,d.SN_UnaryOperation=qr,d.SN_WhileLoop=Er,d.SSAO_cs=Ub,d.SSGI2_cs=id,d.SSGIPost=$g,d.SSRPost=em,d.SSR_BlendColor_cs=sd,d.SSR_IS_Kernel=tm,d.SSR_IS_cs=nd,d.SSR_RayTrace_cs=od,d.ScaleControlComponents=nu,d.Scene3D=xg,d.Shader=gt,d.ShaderAttributeInfo=Bn,d.ShaderConverter=wc,d.ShaderConverterResult=Rc,d.ShaderLib=X,d.ShaderPassBase=an,d.ShaderReflection=xt,d.ShaderStage=_a,d.ShaderState=Ic,d.ShaderUniformInfo=_n,d.ShaderUtil=Ka,d.ShadingInput=xl,d.ShadowLightsCollect=Wt,d.ShadowMapPassRenderer=U0,d.ShadowMapping_frag=kl,d.Skeleton=qb,d.SkeletonAnimationClip=Us,d.SkeletonAnimationClipState=Ed,d.SkeletonAnimationCompute=$b,d.SkeletonAnimation_shader=Zr,d.SkeletonBlendComputeArgs=eg,d.SkeletonPose=ki,d.SkeletonTransformComputeArgs=tg,d.SkyGBufferPass=Qc,d.SkyGBuffer_pass=Kl,d.SkyMaterial=Cd,d.SkyRenderer=ws,d.SolidColorSky=mp,d.SphereColliderShape=Sg,d.SphereGeometry=Ir,d.SphereReflection=kd,d.StandShader=ff,d.StatementNode=Ge,d.StorageGPUBuffer=Pe,d.StreamLoader=im,d.StreamingGaussianSplatParser=hm,d.StringUtil=It,d.Struct=gi,d.StructStorageGPUBuffer=Lg,d.SubGeometry=Kc,d.TAACopyTex_cs=ld,d.TAAPost=am,d.TAASharpTex_cs=cd,d.TAA_cs=fd,d.TestComputeLoadBuffer=ud,d.TextAnchor=Yd,d.TextFieldLayout=qd,d.TextFieldLine=Kd,d.Texture=dt,d.TextureCube=Cs,d.TextureCubeFaceData=ao,d.TextureCubeStdCreator=Ss,d.TextureCubeUtils=qn,d.TextureMipmapCompute=Gg,d.TextureMipmapGenerator=pa,d.TextureScaleCompute=fh,d.ThirdPersonCameraController=lg,d.Tile=Oo,d.TileSet=Nm,d.TileSetChild=Om,d.TileSetChildContent=Lm,d.TileSetChildContentMetaData=Gm,d.TileSetRoot=Vm,d.TilesRenderer=Pm,d.Time=ze,d.TokenType=C,d.TorusGeometry=su,d.TouchData=el,d.TrailGeometry=bp,d.Transform=zt,d.TransformAxisEnum=N,d.TransformControllerBaseComponent=Hs,d.TransformMode=mt,d.TransformSpaceMode=ha,d.TranslationControlComponents=lu,d.TranslatorContext=Dn,d.TriGeometry=gp,d.Triangle=Zi,d.UIButton=yo,d.UIButtonTransition=$d,d.UIComponentBase=Uo,d.UIEvent=Ng,d.UIImage=Nr,d.UIImageGroup=Co,d.UIInteractive=Qs,d.UIInteractiveStyle=at,d.UIPanel=ji,d.UIRenderAble=Ji,d.UIShadow=So,d.UITextField=xo,d.UITransform=ar,d.UNLOADED=Ur,d.UUID=Gt,d.UV=Ho,d.Uint32ArrayTexture=xn,d.Uint8ArrayTexture=Si,d.UnLit=Zl,d.UnLitMaterial=Bt,d.UnLitMaterialUniform_frag=ul,d.UnLitTexArrayMaterial=Zm,d.UnLitTextureArray=Bd,d.UnLit_frag=bl,d.UniformGPUBuffer=Ct,d.UniformNode=lr,d.UniformType=St,d.ValueEnumType=H,d.ValueOp=hp,d.ValueParser=Va,d.ValueSpread=ap,d.Vector2=fe,d.Vector3=g,d.Vector3Ex=Gi,d.Vector4=ue,d.VertexAttribute=Rg,d.VertexAttributeIndexShader=pd,d.VertexAttributeName=G,d.VertexAttributeSize=cr,d.VertexAttributeStride=sh,d.VertexAttributes_vert=gl,d.VertexBufferLayout=wg,d.VertexFormat=ll,d.VertexGPUBuffer=As,d.Vertical=Xd,d.VideoUniform_frag=ml,d.View3D=Fg,d.ViewPanel=Is,d.ViewQuad=Rn,d.VirtualTexture=Ie,d.WGS84_FLATTENING=Rm,d.WGS84_HEIGHT=Im,d.WGS84_RADIUS=wm,d.WGSLTranslator=xc,d.WayLines3D=Pi,d.WayPoint3D=Mi,d.WebGPUDescriptorCreator=Ye,d.WorldMatrixUniform=nn,d.WorldPanel=Ts,d.WrapMode=li,d.WrapTimeMode=Dr,d.ZCullingCompute=Jg,d.ZPassShader_cs=md,d.ZPassShader_fs=rc,d.ZPassShader_vs=ac,d.ZSorterUtil=Oc,d.append=_c,d.arrayToString=_f,d.blendComponent=Au,d.buildCurves=ip,d.byteSizeOfType=ea,d.calculateCurveRangesValue=sp,d.calculateMinMax=es,d.castPointShadowMap_vert=$l,d.clamp=_e,d.clampRepeat=qu,d.computeAABBFromPositions=ko,d.cos=zu,d.crossProduct=Xu,d.cubicPolynomialRoot=Yh,d.cubicPolynomialRootsGeneric=Xh,d.curvesSupportProcedural=rp,d.deg2Rad=Ou,d.detectGSplatFormat=_h,d.directionShadowCastMap_frag=tc,d.dot=Ft,d.doubleIntegrateSegment=Hh,d.downSample=Zf,d.fastInvSqrt=Ac,d.floorfToIntPos=pc,d.fonts=ri,d.generateRandom=Hu,d.generateRandom3=Ku,d.getFloatFromInt=bc,d.getGLTypeFromTypedArray=j2,d.getGLTypeFromTypedArrayType=J2,d.getGlobalRandomSeed=Wu,d.getTypedArray=Z2,d.getTypedArrayTypeFromGLType=Jn,d.grad1=Xo,d.grad2=Xs,d.grad3=ts,d.grad4=ui,d.inferSHOrder=wo,d.integrateSegment=Yo,d.irradianceDataReader=Wg,d.kPI=qm,d.lerp=xr,d.lerpByte=Fu,d.lerpColor=xu,d.lerpVector3=Su,d.lruPriorityCallback=Jh,d.magnitude=hn,d.makeAloneSprite=ab,d.makeGUISprite=Rf,d.makeMatrix44=ds,d.markUsedSetLeaves=jo,d.markUsedTiles=Ws,d.markVisibleTiles=Js,d.matrixMultiply=mn,d.matrixRotate=a2,d.matrixRotateY=t2,d.mergeFunctions=os,d.multiplyMatrices4x4REF=Dc,d.normal_distribution=tu,d.normalizeFast=Yu,d.normalizeSafe=uc,d.normalizedToByte=Zu,d.normalizedToWord=ju,d.outlinePostData=Ca,d.outlinePostManager=rm,d.parsePlyGaussianSplat=Ro,d.parsePlyHeader=qi,d.parsePlyMesh=Bh,d.parsePlyPointCloud=vh,d.perm=Ue,d.post=Yf,d.priorityCallback=Wh,d.quadraticPolynomialRootsGeneric=Ys,d.rad2Deg=Lu,d.random01=Xr,d.randomBarycentricCoord=Vu,d.randomPointBetweenEllipsoid=Nu,d.randomPointBetweenSphere=Mu,d.randomPointInsideCube=Tu,d.randomPointInsideEllipsoid=Qu,d.randomPointInsideUnitCircle=Pu,d.randomPointInsideUnitSphere=mc,d.randomQuaternion=Ru,d.randomQuaternionUniformDistribution=Iu,d.randomUnitVector=fs,d.randomUnitVector2=gc,d.rangedRandomFloat=At,d.rangedRandomInt=wu,d.readByType=be,d.readMagicBytes=ti,d.registerMaterial=jm,d.repeat=gn,d.rotMatrix=e2,d.rotateVectorByQuat=Uu,d.roundfToIntPos=un,d.scale=dn,d.shadowCastMap_frag=ec,d.shadowCastMap_vert=ql,d.simplex=ta,d.sin=Gu,d.snoise1=lp,d.snoise2=cp,d.snoise3=fp,d.snoise4=dp,d.splatColorProperties=Eo,d.splatProperties=Ki,d.sqrMagnitude=bn,d.sqrtImpl=hc,d.stencilStateFace=Du,d.swap=Ju,d.textureCompress=bd,d.threshold=jf,d.throttle=zm,d.toHalfFloat=qa,d.toggleTiles=js,d.traverseAncestors=Qm,d.traverseSet=Vh,d.tw=Fb,d.uniform_real_distribution=np,d.uniform_real_distribution2=op,d.upSample=mo,d.webGPUContext=I,d.zSorterUtil=Lc,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
11858
+ `).filter(Boolean),i=[];for(const s of r){const o=Zt.parseParameterLine(s);o.mnemonic&&i.push(o.mnemonic)}if(i.length===0)throw new Error("LASLoader: No headers found in ~CURVE section");return i}parseData(e,t,a){const r=e.match(/~A(?:[\x20-\x7E])*(?:\r\n|\r|\n)([\s\S]*?)(?=~|$)/);if(!r||!r[1])throw new Error("LASLoader: ~A data section not found");const i=r[1].trim();if(!i)throw new Error("LASLoader: Data section is empty");const s=i.split(/\s+/).filter(c=>c.trim().length>0).map(c=>Zt.convertToValue(c.trim()));if(s.length===0)throw new Error("LASLoader: No data values found");const o=Math.floor(s.length/t.length);if(o===0)throw new Error("LASLoader: Insufficient data values");const l=[];for(let c=0;c<o;c++){const f=[];for(let h=0;h<t.length;h++){const u=c*t.length+h;u<s.length&&f.push(s[u])}f.length===t.length&&l.push(f)}return l}}var hi=(n=>(n.PointCloud="pointcloud",n.Curve="curve",n.WellTrajectory="trajectory",n))(hi||{}),Am=Object.getOwnPropertyDescriptor,Dm=(n,e,t,a)=>{for(var r=a>1?void 0:a?Am(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.FatLineShader=class extends gt{constructor(){super();const e=new qe("FatLine_VS","FatLine_FS");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);const t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,t.cullMode=Vt.none,t.depthWriteEnabled=!0,this.setDefault()}setDefault(){this.setUniformColor("baseColor",new Z(1,1,1,1)),this.setUniformFloat("lineWidth",1),this.setUniformFloat("opacity",1),this.setUniformVector2("resolution",new fe(1920,1080));const e=new T;this.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}},d.FatLineShader=Dm([Ta(d.FatLineShader,"FatLineShader")],d.FatLineShader);class Ch extends Dt{constructor(){super(),this.shader=new d.FatLineShader,this.transparent=!0}setInstanceBuffer(e){this.shader.setStorageBuffer("instances",e)}setModelMatrix(e){this.shader.getDefaultColorShader().setUniform("modelMatrix",e.rawData)}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set lineWidth(e){this.shader.setUniformFloat("lineWidth",e)}get lineWidth(){return this.shader.getUniformFloat("lineWidth")}set opacity(e){this.shader.setUniformFloat("opacity",e)}get opacity(){return this.shader.getUniformFloat("opacity")}set resolution(e){this.shader.setUniformVector2("resolution",e)}get resolution(){return this.shader.getUniformVector2("resolution")}}class _m extends rt{static format=Je.BIN;visualizationMode=hi.PointCloud;async parseBuffer(e){const a=await new yh().parse(e);await this.createVisualization(a)}async createVisualization(e){if("format"in e&&e.format==="binary")this.data=this.createBinaryPointCloudVisualization(e);else{const t=e;let a;switch(this.visualizationMode){case hi.PointCloud:a=this.createPointCloudVisualization(t);break;case hi.Curve:a=this.createCurveVisualization(t);break;case hi.WellTrajectory:a=this.createWellTrajectoryVisualization(t);break;default:a=this.createPointCloudVisualization(t)}a.lasData=t,a.wellParams=t.wellParams,a.curveParams=t.curveParams,this.data=a}}createBinaryPointCloudVisualization(e){const t=new d.Object3D;t.name="LASPointCloud";const a=new d.Object3D;a.name="LASPointCloudRoot",t.addChild(a);const r=a.addComponent(d.PointCloudRenderer);return r.initFromData(e.positions,e.colors,e.numPoints),r.setPointShape("circle"),r.setPointSize(4),t.lasFormat="binary",t.lasVersion=e.version,t.numPoints=e.numPoints,t.pointDataFormat=e.pointDataFormat,t.bbox=e.bbox,t}verification(){if(this.data)return!0;throw new Error("LASParser: Parse failed")}createPointCloudVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const s=t.map((D,_)=>_).filter(D=>D!==i).slice(0,2),o=a.filter(D=>!D.some(_=>_===r||_===+r));if(o.length===0)throw new Error("LASParser: No valid data points after filtering");const l=o.length,c=new Float32Array(l*3),f=new Uint8Array(l*4);let h=1/0,u=-1/0,b=1/0,A=-1/0;if(s.length>0){const D=o.map(_=>+_[s[0]]).filter(_=>!isNaN(_));if(h=Math.min(...D),u=Math.max(...D),s.length>1){const _=o.map(v=>+v[s[1]]).filter(v=>!isNaN(v));b=Math.min(..._),A=Math.max(..._)}}for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=D*4;if(c[v+2]=+_[i],s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;if(c[v+0]=S*10,s.length>1){const F=+_[s[1]],k=A!==b?(F-b)/(A-b):0;c[v+1]=k*10}else c[v+1]=0}else c[v+0]=0,c[v+1]=0;if(s.length>0){const y=+_[s[0]],S=u!==h?(y-h)/(u-h):0;this.mapValueToColor(S,f,U)}else f[U+0]=255,f[U+1]=255,f[U+2]=255,f[U+3]=255}const m=new d.Object3D;m.name="LASPointCloud";const p=m.addComponent(d.PointCloudRenderer);return p.initFromData(c,f,l),p.setPointShape("circle"),p.setPointSize(4),m}createCurveVisualization(e){const{headers:t,data:a,nullValue:r}=e,i=t.findIndex(D=>D.toUpperCase()==="DEPTH"||D.toUpperCase()==="DEPT");if(i<0)throw new Error("LASParser: DEPTH column not found");const s=t.map((D,_)=>_).find(D=>D!==i);if(s===void 0)throw new Error("LASParser: No curve column found");const o=a.filter(D=>{const _=+D[i],v=+D[s];return!isNaN(_)&&!isNaN(v)&&v!==r&&v!==+r});if(o.length===0)throw new Error("LASParser: No valid data points");const l=o.map(D=>+D[s]),c=Math.min(...l),h=Math.max(...l)-c,u=new Float32Array(o.length*3);for(let D=0;D<o.length;D++){const _=o[D],v=D*3,U=+_[i],y=+_[s];u[v+2]=U;const S=h>0?(y-c)/h:0;u[v+0]=S*10,u[v+1]=0}const b=new ih;b.setPositions(u);const A=new Ch;A.baseColor=new Z(1,0,0,1),A.lineWidth=2;const m=new d.Object3D;m.name=`LASCurve_${t[s]}`;const p=m.addComponent(d.FatLineRenderer);return p.geometry=b,p.material=A,m}createWellTrajectoryVisualization(e){throw new Error("LASParser: Well trajectory visualization not yet implemented")}normalizeValue(e,t,a){const r=t.map(o=>+o[a]).filter(o=>!isNaN(o)),i=Math.min(...r),s=Math.max(...r);return s!==i?(e-i)/(s-i):0}mapValueToColor(e,t,a){const r=Math.floor(e*255),i=Math.floor((1-e)*255);t[a+0]=r,t[a+1]=0,t[a+2]=i,t[a+3]=255}}class Io extends rt{static format=Je.BIN;static cloudImageProcessParam="";async parseBuffer(e){switch(qi(e).mode){case Sa.Splat:{const a=Ro(e),r={count:a.vertexCount,position:a.position,rotation:a.rotation,scale:a.scale,opacity:a.opacity,sh:a.sh};r.bbox=ko(a.position);const i=new d.Object3D;i.name="GaussianSplat",i.addComponent(d.GSplatRenderer).initAsset(r),this.data=i;break}case Sa.PointCloud:{const a=vh(e),r=new d.Object3D;r.name="PLYPointCloud";const i=new d.Object3D;i.name="PLYPointCloudRoot",r.addChild(i);const s=i.addComponent(d.PointCloudRenderer);if(a.color)s.initFromData(a.position,a.color,a.vertexCount);else{const o=new Uint8Array(a.vertexCount*4);o.fill(255),s.initFromData(a.position,o,a.vertexCount)}s.setPointShape("circle"),s.setPointSize(4),this.data=r;break}case Sa.Mesh:{const a=Bh(e),r=new d.Object3D;r.name="PLYMesh";const i=new Map;if(a.triangleTexnumbers&&a.triangleTexnumbers.length>0)for(let o=0;o<a.triangleTexnumbers.length;o++){const l=a.triangleTexnumbers[o];i.has(l)||i.set(l,[]),i.get(l).push(o)}else{const o=a.indices.length/3,l=[];for(let c=0;c<o;c++)l.push(c);i.set(0,l)}const s=new Map;if(a.textureFiles&&a.textureFiles.length>0){const o=[];for(let l=0;l<a.textureFiles.length;l++){const c=new qt,f=It.normalizePath(this.baseUrl+a.textureFiles[l]);o.push(B.res.loadTexture(f+Io.cloudImageProcessParam).then(h=>{c.baseMap=h,s.set(l,c)}))}await Promise.all(o)}s.size===0&&s.set(0,new qt);for(const[o,l]of i){const c=[];for(const A of l){const m=A*3;c.push(a.indices[m+0],a.indices[m+1],a.indices[m+2])}const f=new Ve;f.setAttribute(G.position,a.position),f.setAttribute(G.normal,a.normal),a.uv&&f.setAttribute(G.uv,a.uv),a.color&&f.setAttribute(G.color,a.color),f.setIndices(new Uint32Array(c)),f.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let h=s.get(o);h||(h=s.values().next().value||new qt);const u=new d.Object3D;u.name=`PLYMesh_Texture_${o}`;const b=u.addComponent(d.MeshRenderer);b.geometry=f,b.material=h,r.addChild(u)}this.data=r;break}}}verification(){return!!this.data}}class Sh{async parse(e){const t=new DataView(e),a=ti(t);console.assert(a==="pnts");const r=t.getUint32(4,!0);console.assert(r===1);const i=t.getUint32(8,!0);console.assert(i===e.byteLength);const s=t.getUint32(12,!0),o=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),f=28,h=new Ri(e,f,s,o),u=f+s+o,b=h.header.POINTS_LENGTH||0,A=new Fs(e,b,u,l,c);return{version:r,featureTable:h,batchTable:A}}}class xh extends Sh{async parse(e){const t=await super.parse(e),{featureTable:a,batchTable:r}=t,i=a.header.POINTS_LENGTH;if(!i||i<=0)throw new Error("PNTSLoader: POINTS_LENGTH must be defined and greater than zero");const o=a.header.extensions?.["3DTILES_draco_point_compression"];let l,c;if(o){const b=await this.parseDraco(a,o,i);l=b.positions,c=b.colors,b.normals}else l=this.parsePositions(a,i),c=this.parseColors(a,i),this.parseNormals(a,i);const f=new d.Object3D,h=f.addComponent(d.PointCloudRenderer);h.initFromData(l,c,i),h.setPointShape("circle"),h.setPointSize(4);const u=a.getData("RTC_CENTER",1,"FLOAT","VEC3");return u&&f.transform.localPosition.set(u[0],u[1],u[2]),f.batchTable=r,f.featureTable=a,f}parsePositions(e,t){let a=e.getData("POSITION",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("POSITION_QUANTIZED",t,"UNSIGNED_SHORT","VEC3");if(!r)throw new Error("PNTSLoader: Either POSITION or POSITION_QUANTIZED must be defined");const i=e.getData("QUANTIZED_VOLUME_SCALE",1,"FLOAT","VEC3"),s=e.getData("QUANTIZED_VOLUME_OFFSET",1,"FLOAT","VEC3");if(!i||!s)throw new Error("PNTSLoader: QUANTIZED_VOLUME_SCALE and QUANTIZED_VOLUME_OFFSET must be defined for quantized positions");const o=new Float32Array(t*3),l=65535;for(let c=0;c<t;c++){const f=c*3;o[f+0]=r[f+0]/l*i[0]+s[0],o[f+1]=r[f+1]/l*i[1]+s[1],o[f+2]=r[f+2]/l*i[2]+s[2]}return o}parseColors(e,t){let a=e.getData("RGBA",t,"UNSIGNED_BYTE","VEC4");if(a)return a;const r=e.getData("RGB",t,"UNSIGNED_BYTE","VEC3");if(r){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*3,h=c*4;l[h+0]=r[f+0],l[h+1]=r[f+1],l[h+2]=r[f+2],l[h+3]=255}return l}const i=e.getData("RGB565",t,"UNSIGNED_SHORT","SCALAR");if(i){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=this.decodeRGB565(i[c]),h=c*4;l[h+0]=f[0],l[h+1]=f[1],l[h+2]=f[2],l[h+3]=255}return l}const s=e.getData("CONSTANT_RGBA",1,"UNSIGNED_BYTE","VEC4");if(s){const l=new Uint8Array(t*4);for(let c=0;c<t;c++){const f=c*4;l[f+0]=s[0],l[f+1]=s[1],l[f+2]=s[2],l[f+3]=s[3]}return l}const o=new Uint8Array(t*4);return o.fill(255),o}parseNormals(e,t){let a=e.getData("NORMAL",t,"FLOAT","VEC3");if(a)return a;const r=e.getData("NORMAL_OCT16P",t,"UNSIGNED_BYTE","VEC2");return r?this.decodeOctNormals(r,t):null}decodeRGB565(e){const t=(e>>11&31)<<3,a=(e>>5&63)<<2,r=(e&31)<<3;return[t,a,r]}decodeOctNormals(e,t){const a=new Float32Array(t*3);for(let r=0;r<t;r++){const i=r*2,s=e[i]/255,o=e[i+1]/255,l=s*2-1,c=o*2-1,f=1-Math.abs(l)-Math.abs(c);let h,u;f<0?(h=(l>=0?1:-1)*(1-Math.abs(c)),u=(c>=0?1:-1)*(1-Math.abs(l))):(h=l,u=c);const b=Math.sqrt(h*h+u*u+f*f),A=r*3;a[A+0]=h/b,a[A+1]=u/b,a[A+2]=f/b}return a}async parseDraco(e,t,a){throw new Error("Draco compression not yet implemented")}}class Fh extends rt{static format=Je.BIN;async parseBuffer(e){const a=await new xh().parse(e),r=new d.Object3D;r.name="PNTS",r.addChild(a),this.data=r}verification(){if(this.data)return!0;throw new Error("PNTSParser: Parse failed")}}class To{boneName;bonePath;parentBoneName;boneID;parentBoneID;instanceID;parentInstanceID;t;q;s;formBytes(e){this.boneName=e.readUTF(),this.bonePath=e.readUTF(),this.parentBoneName=e.readUTF(),this.boneID=e.readInt32(),this.parentBoneID=e.readInt32(),this.instanceID=e.readUTF(),this.parentInstanceID=e.readUTF(),this.t=e.readVector3(),this.q=e.readQuaternion(),this.s=e.readVector3()}}class Qo{name;count;boneData;boneMap;formBytes(e){this.boneData=[],this.boneMap=new Map,this.name=e.readUTF(),this.count=e.readInt32();for(let t=0;t<this.count;t++){let a=new To;a.formBytes(e.readBytesArray()),this.boneData[t]=a,this.boneMap.set(a.boneName,a)}}}class kh extends rt{static format=Je.BIN;static parser(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Qo;i.formBytes(e.readBytesArray()),B.res.addObj(i.name,i)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}G.position,G.normal,G.color,G.TANGENT,G.uv,G.TEXCOORD_1,G.TEXCOORD_2,G.TEXCOORD_2,G.TEXCOORD_4,G.TEXCOORD_5,G.TEXCOORD_6,G.TEXCOORD_7,G.joints0,G.weights0;var H=(n=>(n[n.single=0]="single",n[n.boolean=1]="boolean",n[n.int=2]="int",n[n.int16=3]="int16",n[n.int32=4]="int32",n[n.float=5]="float",n[n.long=6]="long",n[n.uint=7]="uint",n[n.uint32=8]="uint32",n[n.uint64=9]="uint64",n[n.double=10]="double",n[n.string=11]="string",n[n.singleArray=12]="singleArray",n[n.stringArray=13]="stringArray",n[n.floatArray=14]="floatArray",n[n.vector2=15]="vector2",n[n.vector3=16]="vector3",n[n.vector4=17]="vector4",n[n.color=18]="color",n[n.color32=19]="color32",n[n.animationCurve=20]="animationCurve",n[n.quaternion=21]="quaternion",n[n.matrix4x4=22]="matrix4x4",n[n.mesh=23]="mesh",n[n.texture=24]="texture",n[n.material=25]="material",n[n.materials=26]="materials",n[n.skeleton=27]="skeleton",n[n.animClip=28]="animClip",n[n.vector2Int=29]="vector2Int",n[n.int32List=30]="int32List",n[n.colorList=31]="colorList",n[n.color32List=32]="color32List",n))(H||{});class Os{static GetMaterial(e){let t=e,a=t.split("/");t=a[a.length-1],a=t.split("."),t=a[a.length-1];let r=il(t);if(r){let i=new Dt;return i.shader=new r,i}else throw new Error("not found shader, shader name is "+t)}static applyMaterialTexture(e,t){for(let a=0;a<t.length;a++){const r=t[a];r.property in e?e[r.property]=r.texture:r.property in e.shader?e.shader[r.property]=r.texture:e.setTexture(r.property,r.texture)}}static applyMaterialProperties(e,t){for(let a=0;a<t.length;a++){const r=t[a],i=r.key;switch(r.type){case H.color:case H.color32:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformColor(i,s)}break;case H.single:case H.float:case H.int:case H.int16:case H.int32:case H.uint:case H.uint32:case H.uint64:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.singleArray:{let s=r.getValue()[0];i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformFloat(i,s)}break;case H.vector2:case H.vector2Int:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector2(i,s)}break;case H.vector3:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector3(i,s)}break;case H.vector4:{let s=r.getValue();i in e?e[i]=s:i in e.shader?e.shader[i]=s:e.setUniformVector4(i,s)}break}}}}class Va{static parser(e){switch(e.readInt32()){case H.single:return{t:H.single,v:e.readFloat32()};case H.boolean:return{t:H.boolean,v:e.readBoolean()};case H.int:return{t:H.int,v:e.readInt32()};case H.int16:return{t:H.int16,v:e.readInt16()};case H.int32:return{t:H.int32,v:e.readInt32()};case H.float:return{t:H.float,v:e.readFloat32()};case H.long:return{t:H.long,v:e.readFloat64()};case H.uint:return{t:H.uint,v:e.readUnit32()};case H.uint32:return{t:H.uint32,v:e.readUnit32()};case H.uint64:return{t:H.uint64,v:e.readUnit32()};case H.double:return{t:H.double,v:e.readFloat64()};case H.string:return{t:H.string,v:e.readUTF()};case H.singleArray:return{t:H.singleArray,v:e.readFloatArray()};case H.stringArray:return{t:H.stringArray,v:e.readStringArray()};case H.floatArray:return{t:H.floatArray,v:e.readFloatArray()};case H.vector2:return{t:H.vector2,v:e.readVector2()};case H.vector3:return{t:H.vector3,v:e.readVector3()};case H.vector4:return{t:H.vector4,v:e.readVector4()};case H.color:return{t:H.color,v:e.readColor()};case H.color32:return{t:H.color32,v:e.readColor()};case H.animationCurve:return{t:H.animationCurve,v:null};case H.quaternion:return{t:H.quaternion,v:e.readQuaternion()};case H.matrix4x4:return{t:H.matrix4x4,v:null};case H.mesh:{let o=e.readUTF(),l=B.res.getGeometry(o);return{t:H.mesh,v:l}}case H.texture:{let o=e.readUTF(),l=B.res.getTexture(o);return{t:H.texture,v:l}}case H.material:{let o=e.readUTF(),l=B.res.getMat(o);return{t:H.material,v:l}}case H.materials:{let o=e.readStringArray(),l=[];for(let c=0;c<o.length;c++){const f=o[c];let h=B.res.getMat(f);l.push(h)}return{t:H.materials,v:l}}case H.skeleton:break;case H.animClip:{let o=[],l=e.readInt32();for(let c=0;c<l;c++){let f=new Zo;f.formBytes(e),o.push(f)}return{t:H.animClip,v:o}}case H.vector2Int:return{t:H.vector2Int,v:e.readVector2int()};case H.int32List:return{t:H.int32List,v:e.readInt32List()};case H.colorList:let a=e.readInt32(),r=[];for(let o=0;o<a;o++){const l=Va.parser(e).v;r.push(l)}return{t:H.colorList,v:r};case H.color32List:let i=e.readInt32(),s=[];for(let o=0;o<i;o++){const l=Va.parser(e).v;s.push(l)}return{t:H.color32List,v:s}}}}class Mo{key;type;_data;getValue(){return this._data}formBytes(e){this.key=e.readUTF();let{t,v:a}=Va.parser(e);this.type=t,this._data=a}}class Eh{property;name;texture;texelSize;wrapModeU;wrapModeV;wrapModeW;wrapMode;anisoLevel;dimension;filterMode}class wh extends rt{static format=Je.TEXT;static parserMaterial(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=e.readBytesArray(),s=i.readUTF(),o=i.readUTF();i.readUTF();let l=i.readStringArray();i.readVector4(),i.readVector4();let c=i.readUTF(),f=[],h=[],u=i.readInt32();for(let m=0;m<u;m++){let p=new Mo;p.formBytes(i),f.push(p)}let b=i.readInt32();for(let m=0;m<b;m++){let p=i.readBytesArray(),D=new Eh;D.property=p.readUTF(),D.name=p.readUTF(),D.texture=B.res.getTexture(D.name),D.texelSize=p.readVector2(),D.wrapModeU=p.readUnit32(),D.wrapModeV=p.readUnit32(),D.wrapModeW=p.readUnit32(),D.wrapMode=p.readUnit32(),D.anisoLevel=p.readUnit32(),D.dimension=p.readUnit32(),D.filterMode=p.readUnit32(),h.push(D)}let A=Os.GetMaterial(c);A.name=s;for(let m=0;m<l.length;m++){const p=l[m];A.shader.setDefine(p,!0)}Os.applyMaterialTexture(A,h),Os.applyMaterialProperties(A,f),B.res.addMat(o,A)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Po{shapeName;shapeIndex;frameCount;blendPositionList=new Float32Array;blendNormalList=new Float32Array;formBytes(e){let t=e.readBytesArray();this.shapeName=t.readUTF(),this.shapeIndex=t.readInt32(),this.frameCount=t.readInt32();let a=t.readInt32();this.blendPositionList=t.readFloat32Array(a*3);let r=t.readInt32();this.blendNormalList=t.readFloat32Array(r*3)}}class No{vertexCount;shapeNames;shapeIndexs;blendCount;blendShapePropertyDatas;blendShapeMap;formBytes(e){this.blendShapeMap=new Map,this.blendShapePropertyDatas=[];let t=e.readBytesArray();this.vertexCount=t.readInt32(),this.shapeNames=t.readStringArray(),this.shapeIndexs=t.readIntArray(),this.blendCount=t.readInt32();for(let a=0;a<this.blendCount;a++){let r=new Po;r.formBytes(t),this.blendShapePropertyDatas.push(r),this.blendShapeMap.set(r.shapeName,r)}return e}}class Rh{name;meshName;meshID;vertexCount;vertexStrip;vertexBuffer;indices;attributes;bones;bindPose;blendShapeData}class Ih extends rt{static format=Je.BIN;async parseBuffer(e){}static parserMeshs(e,t){let a=e.readInt32();for(let r=0;r<a;r++){let i=new Rh,s=e.readBytesArray();i.meshName=s.readUTF(),i.meshID=s.readUTF(),s.readFloat32()>0,s.readFloat32()>0,s.readFloat32()>0;let o=s.readFloat32()>0,l=s.readFloat32()>0;o&&(i.bones=s.readStringArray(),i.bindPose=s.readMatrix44Array()),l&&(i.blendShapeData=new No,i.blendShapeData.formBytes(s));let c=s.readBytesArray(),f=s.readBytesArray(),h=c.readInt32(),u=0,b=[];for(let _=0;_<h;_++)b[_]={},b[_].att=Bm[c.readUTF()],b[_].dim=c.readInt32(),u+=b[_].dim,b[_].format=c.readUTF();i.vertexCount=c.readInt32(),i.vertexBuffer=f.getFloat32Array();let A=s.readInt32Array(),m=[],p=s.readInt32();for(let _=0;_<p;_++){let v=s.readInt32(),U=s.readInt32(),y=s.readInt32(),S=s.readInt32(),F=s.readInt32(),k=s.readInt32();s.readVector3(),s.readVector3();let x={indexStart:U,indexCount:y,vertexStart:S,vertexCount:k,firstStart:F,topology:v,index:_};m.push(x)}A.length>65535?i.indices=new Uint32Array(A):i.indices=new Uint16Array(A);let D=new Ve;if(D.vertexDim=u,D.geometryType=kt.compose_bin,D.setIndices(i.indices),D.setAttribute(G.all,i.vertexBuffer),o&&(D.skinNames=i.bones,D.bindPose=i.bindPose),l){D.blendShapeData=i.blendShapeData,D.morphTargetsRelative=!0,D.morphTargetDictionary={};for(let _=0;_<i.blendShapeData.blendCount;_++){D.setAttribute("a_morphPositions_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendPositionList),D.setAttribute("a_morphNormals_"+_,i.blendShapeData.blendShapePropertyDatas[_].blendNormalList);for(let v=0;v<i.blendShapeData.blendCount;v++){let U=i.blendShapeData.shapeNames[v],y=i.blendShapeData.shapeIndexs[v];D.morphTargetDictionary[U]=y}}}for(let _=0;_<b.length;_++){const v=b[_].att;D.setAttribute(v,null)}for(let _=0;_<m.length;_++){const v=m[_];D.addSubGeometry(v)}D.name=i.meshName,B.res.addGeometry(i.meshID,D)}}verification(){if(this.data)return!0;throw new Error("verify failed.")}}let Bm={Position:G.position,Normal:G.normal,Color:G.color,Tangent:G.TANGENT,TexCoord0:G.uv,TexCoord1:G.TEXCOORD_1,TexCoord2:G.TEXCOORD_2,TexCoord3:G.TEXCOORD_2,TexCoord4:G.TEXCOORD_4,TexCoord5:G.TEXCOORD_5,TexCoord6:G.TEXCOORD_6,TexCoord7:G.vIndex,BlendIndices:G.joints0,BlendWeight:G.weights0};class Ls extends DataView{get buffer(){return super.buffer}get byteOffset(){return super.byteOffset}get byteLength(){return super.byteLength}getInt16(e,t){return super.getInt16(e,t)}getInt32(e,t){return super.getInt32(e,t)}getFloat32(e,t){return super.getFloat32(e,t)}getFloat64(e,t){return super.getFloat64(e,t)}getUint8(e){return super.getUint8(e)}getUint32(e,t){return super.getUint32(e,t)}getInt8(e){return super.getInt8(e)}getUint16(e,t){return super.getUint16(e,t)}position=0;littleEndian=!0;constructor(e,t,a){super(e,t,a),this.position=0,this.position+=this.byteOffset}readUTF(){let e=this.readInt32(),t=e%4;t>0&&t<4&&(t=4-t);let a="",r=new Int8Array(this.buffer,this.position,e);return this.position+=e*Int8Array.BYTES_PER_ELEMENT,a+=String.fromCharCode.apply(null,r),this.position+=t*Int8Array.BYTES_PER_ELEMENT,a}readStringArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readUTF());return e}readByte(){let e=this.buffer[this.position];return this.position+=1,e}readBoolean(){let e=this.readInt32();return this.position+=4,e==1}readBytes(e){let t=new DataView(this.buffer,this.position,e);return this.position+=e,t.buffer}readBytesArray(){let e=this.readInt32(),t=new Ls(this.buffer.slice(this.position,this.position+e));return this.position+=e,t}readUnit8(){let e=this.getUint8(this.position);return this.position+=Uint8Array.BYTES_PER_ELEMENT,e}readUnit16(){let e=this.getUint16(this.position);return this.position+=Uint16Array.BYTES_PER_ELEMENT,e}readUnit32(){let e=this.getUint32(this.position);return this.position+=Uint32Array.BYTES_PER_ELEMENT,e}readInt8(){let e=this.getInt8(this.position);return this.position+=Int8Array.BYTES_PER_ELEMENT,e}readInt16(){let e=this.getInt16(this.position,this.littleEndian);return this.position+=Int16Array.BYTES_PER_ELEMENT,e}readInt32(){let e=this.getInt32(this.position,this.littleEndian);return this.position+=Int32Array.BYTES_PER_ELEMENT,e}readFloat32(){let e=this.getFloat32(this.position,this.littleEndian);return this.position+=Float32Array.BYTES_PER_ELEMENT,e}readFloat64(){let e=this.getFloat64(this.position,this.littleEndian);return this.position+=Float64Array.BYTES_PER_ELEMENT,e}readInt32Array(){let e=this.readInt32(),t=new Int32Array(this.buffer,this.position,e);return t=t.slice(0,e),this.position+=t.byteLength,t}readInt32List(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++)t.push(this.readInt32());return t}readFloatArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readFloat32();t.push(r)}return t}readIntArray(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readInt32();t.push(r)}return t}readVector2int(){let e=new fe;return e.x=this.readInt32(),e.y=this.readInt32(),e}readVector2(){let e=new fe;return e.x=this.readFloat32(),e.y=this.readFloat32(),e}readVector3(){let e=new g;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e}readVector3Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector3());return e}readVector4(){let e=new ue;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readVector4Array(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readVector4());return e}readColor(){let e=new Z;return e.r=this.readFloat32(),e.g=this.readFloat32(),e.b=this.readFloat32(),e.a=this.readFloat32(),e}readColorArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readColor());return e}readQuaternion(){let e=new ne;return e.x=this.readFloat32(),e.y=this.readFloat32(),e.z=this.readFloat32(),e.w=this.readFloat32(),e}readQuaternionArray(){let e=[],t=this.readInt32();for(let a=0;a<t;a++)e.push(this.readQuaternion());return e}readMatrix44(){let e=new T,t=e.rawData;return t[0]=this.readFloat32(),t[1]=this.readFloat32(),t[2]=this.readFloat32(),t[3]=this.readFloat32(),t[4]=this.readFloat32(),t[5]=this.readFloat32(),t[6]=this.readFloat32(),t[7]=this.readFloat32(),t[8]=this.readFloat32(),t[9]=this.readFloat32(),t[10]=this.readFloat32(),t[11]=this.readFloat32(),t[12]=this.readFloat32(),t[13]=this.readFloat32(),t[14]=this.readFloat32(),t[15]=this.readFloat32(),e}readMatrix44Array(){let e=this.readInt32(),t=[];for(let a=0;a<e;a++){let r=this.readMatrix44();t.push(r)}return t}readFloat32Array(e){let t=new DataView(this.buffer),a=new Float32Array(e);for(let r=0;r<e;r++)a[r]=t.getFloat32(this.position+r*Float32Array.BYTES_PER_ELEMENT,this.littleEndian);return this.position+=e*Float32Array.BYTES_PER_ELEMENT,a}getFloat32Array(){let e=new Float32Array(this.buffer,this.byteOffset,this.byteLength/Float32Array.BYTES_PER_ELEMENT);return e=e.slice(0,this.byteLength),e}}class Th extends rt{static format=Je.TEXT;static async parserTexture(e,t,a){let r=e.readInt32(),i=[];for(let o=0;o<r;o++){let l=e.readUTF();Qh.useWebp?(l=l.replace("png","webp"),l=l.replace("jpb","webp"),i.push(t.baseUrl+"webp/"+l)):i.push(t.baseUrl+l)}let s=await B.res.loadBitmapTextures(i,B.setting.loader.numConcurrent,a,!0);for(const o of s)B.res.addTexture(o.name,o)}verification(){if(this.data)return!0;throw new Error("verify failed.")}}var vm=Object.getOwnPropertyDescriptor,Um=(n,e,t,a)=>{for(var r=a>1?void 0:a?vm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitSSSShader=class extends gt{constructor(){super(),X.register("PBRLitSSSShader",_d);let e=new qe("PBRLitSSSShader","PBRLitSSSShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefine("USE_CUSTOMUNIFORM",!0),this.setDefault(),this.computes=[new hh(this)]}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(1,1,1)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this.setUniformColor("skinColor",new Z(1,0,0)),this.setUniformFloat("skinPower",3.4),this.setUniformFloat("skinColorIns",.5),this.setUniformFloat("curveFactor",1)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _SSSMap(e){this.setTexture("sssMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SkinColor(e){this.setUniformColor("skinColor",e)}set _SkinPower(e){this.setUniformFloat("skinPower",e)}set _SkinColorIns(e){this.setUniformFloat("skinColorIns",e)}set curveFactor(e){this.setUniformFloat("curveFactor",e)}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitSSSShader=Um([Ta(d.LitSSSShader,"LitSSSShader")],d.LitSSSShader);var ym=Object.getOwnPropertyDescriptor,Cm=(n,e,t,a)=>{for(var r=a>1?void 0:a?ym(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.LitShader=class extends gt{constructor(){super();let e=new qe("PBRLItShader","PBRLItShader");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!0,t.castShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,this.setDefine("USE_BRDF",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformFloat("shadowBias",35e-5),this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformColor("emissiveColor",new Z(0,0,0)),this.setUniformVector4("materialF0",new ue(.04,.04,.04,1)),this.setUniformColor("specularColor",new Z(.04,.04,.04)),this.setUniformFloat("envIntensity",1),this.setUniformFloat("normalScale",1),this.setUniformFloat("roughness",1),this.setUniformFloat("metallic",0),this.setUniformFloat("ao",1),this.setUniformFloat("roughness_min",0),this.setUniformFloat("roughness_max",1),this.setUniformFloat("metallic_min",0),this.setUniformFloat("metallic_max",1),this.setUniformFloat("emissiveIntensity",0),this.setUniformFloat("alphaCutoff",0),this.setUniformFloat("ior",1.5),this.setUniformFloat("clearcoatFactor",0),this.setUniformFloat("clearcoatRoughnessFactor",0),this.setUniformColor("clearcoatColor",new Z(1,1,1)),this.setUniformFloat("clearcoatWeight",0),this._MainTex=B.res.grayTexture,this._BumpMap=B.res.normalTexture,this._MaskTex=B.res.maskTexture}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.LitShader=Cm([Ta(d.LitShader,"LitShader")],d.LitShader);class Gs{comName;data;static parser(e){let t=e.readBytesArray(),a=new Gs;a.comName=t.readUTF(),a.data=[];let r=t.readInt32();for(let i=0;i<r;i++){let s=new Mo;s.formBytes(t),a.data.push(s)}return a}}class $i{name;parentName;position;rotation;scale;comDatas;child;static parser(e){let t=e.readBytesArray(),a=new $i;a.name=t.readUTF(),a.parentName=t.readUTF(),a.position=t.readVector3(),a.rotation=t.readQuaternion(),a.scale=t.readVector3(),a.comDatas=[],a.child=[];let r=t.readInt32();for(let s=0;s<r;s++){const o=Gs.parser(t);a.comDatas.push(o)}let i=t.readInt32();for(let s=0;s<i;s++){const o=$i.parser(t);a.child.push(o)}return a}}class Qh extends rt{static useWebp=!0;static format=Je.BIN;avatarDic;nodeData;async parseBuffer(e){this.avatarDic={};let t=new Ls(e,0);await Th.parserTexture(t,this,this.loaderFunctions),kh.parser(t,this),Ih.parserMeshs(t,this),wh.parserMaterial(t,this),this.nodeData=this.parserPrefabNode(t),this.data=this.data=this.parserNodeTree(this.nodeData)}parserPrefabNode(e){return $i.parser(e)}parserNodeTree(e){let t=new d.Object3D;if(t.localPosition=g.serialize(e.position),t.localQuaternion=ne.serialize(e.rotation),t.localScale=g.serialize(e.scale),t.name=e.name,e.comDatas)for(let a=0;a<e.comDatas.length;a++){const r=e.comDatas[a];let i=null,s=rl(r.comName);if(s){i=t.getOrAddComponent(s);for(let o=0;o<r.data.length;o++){const l=r.data[o];l.key in i&&(i[l.key]=l.getValue())}}}if(e.child&&e.child.length>0)for(let a=0;a<e.child.length;a++){let r=this.parserNodeTree(e.child[a]);t.addChild(r)}return t}verification(){if(this.data)return!0;throw new Error("verify failed.")}}class Sm{static getNumber(e){return parseFloat(e)}static getInt(e){return parseInt(e)}static getBoolean(e){return e=="true"}static getNumberArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(",");for(let r=0;r<a.length;r++)parseFloat(a[r]);return t}static getStringArray(e){let t=e.replaceAll("[","");t=t.replaceAll("]","");let a=t.split(","),r=[];for(let i=0;i<a.length;i++){const s=a[i];r.push(s)}return r}static getVector2(e){}static getVector3(e){}static getVector4(e){}static getQuaternion(e){}static getColor(e){}}var xm=Object.getOwnPropertyDescriptor,Fm=(n,e,t,a)=>{for(var r=a>1?void 0:a?xm(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitShader=class extends gt{constructor(){super();let e=new qe("UnLit","UnLit");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformFloat("alphaCutoff",0)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitShader=Fm([Ta(d.UnLitShader,"UnLitShader")],d.UnLitShader);var km=Object.getOwnPropertyDescriptor,Em=(n,e,t,a)=>{for(var r=a>1?void 0:a?km(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(r=s(r)||r);return r};d.UnLitTexArrayShader=class extends gt{constructor(){super(),X.register("VertexAttributeIndexShader",pd),X.register("UnLitTextureArray",Bd);let e=new qe("UnLitTextureArray","UnLitTextureArray");e.setShaderEntry("VertMain","FragMain"),this.addRenderPass(e);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1,this.setDefine("USE_BRDF",!0),this.setDefine("USE_AO_R",!0),this.setDefine("USE_ROUGHNESS_G",!0),this.setDefine("USE_METALLIC_B",!0),this.setDefine("USE_ALPHA_A",!0),this.setDefault()}setDefault(){this.setUniformVector4("transformUV1",new ue(0,0,1,1)),this.setUniformVector4("transformUV2",new ue(0,0,1,1)),this.setUniformColor("baseColor",new Z),this.setUniformFloat("alphaCutoff",0)}set _MainTex(e){this.setTexture("baseMap",e)}set _BumpMap(e){this.setTexture("normalMap",e)}set _MaskTex(e){this.setTexture("maskMap",e)}set _UVTransform(e){this.setUniformVector4("transformUV1",e)}set _Metallic(e){this.setUniformFloat("metallic",e)}set _Roughness(e){this.setUniformFloat("roughness",e)}set _MainColor(e){this.setUniformColor("baseColor",e)}set _AlphaCutoff(e){this.setUniformFloat("alphaCutoff",e)}set _DoubleSidedEnable(e){let t=this.getDefaultColorShader();t.shaderState.cullMode=e?Vt.none:t.shaderState.cullMode}set _SurfaceType(e){let t=this.getDefaultColorShader();e==0?t.blendMode=Ae.NONE:t.blendMode=Ae.ALPHA}set _AlphaCutoffEnable(e){e==0?this.setDefine("USE_ALPHACUT",!1):this.setDefine("USE_ALPHACUT",!0)}},d.UnLitTexArrayShader=Em([Ta(d.UnLitTexArrayShader,"UnLitTexArrayShader")],d.UnLitTexArrayShader);const vr=-1,Ur=0,Vo=1,Mh=2,Oa=3,wm=6378137,Rm=1/298.257223563,Im=6356752314245179e-9,Tm=Symbol("PLUGIN_REGISTERED");class Oo{boundingVolume;geometricError;refine;content;contents;transform;extensions;extras;parent=null;children=[];loadingState=Ur;used=!1;visible=!1;active=!1;inFrustum=!1;error=1/0;distanceFromCamera=1/0;depth=0;depthFromRenderedParent=0;lastFrameVisited=-1;isLeaf=!1;allChildrenReady=!1;hasContent=!1;hasRenderableContent=!1;hasUnrenderableContent=!1;childrenProcessed=0;usedLastFrame=!1;priority;canTraverse=!1;canTraverseFrame=-1;basePath="";cached={};constructor(e,t=null){if(this.boundingVolume=e.boundingVolume,this.geometricError=e.geometricError,this.refine=e.refine,this.content=e.content,this.contents=e.contents,this.transform=e.transform,this.extensions=e.extensions,this.extras=e.extras,this.parent=t,this.depth=t?t.depth+1:0,this.depthFromRenderedParent=t?.hasContent?0:t?t.depthFromRenderedParent+1:0,this.hasContent=!!(this.content||this.contents&&this.contents.length>0),this.content?.uri){const a=this.content.uri.toLowerCase();this.hasUnrenderableContent=a.endsWith("tileset.json"),this.hasRenderableContent=!this.hasUnrenderableContent}else this.contents&&this.contents.length>0&&(this.hasRenderableContent=!0)}addChild(e){e.parent=this,e.depth=this.depth+1,e.depthFromRenderedParent=this.hasContent?0:this.depthFromRenderedParent+1,this.children.push(e)}resetFrameState(e){this.lastFrameVisited!==e&&(this.lastFrameVisited=e,this.used=!1,this.inFrustum=!1,this.isLeaf=!1,this.visible=!1,this.active=!1,this.error=1/0,this.distanceFromCamera=1/0,this.allChildrenReady=!1)}}const Ph=2**30;class Nh{minSize=6e3;maxSize=8e3;minBytesSize=.3*Ph;maxBytesSize=.4*Ph;unloadPercent=.05;autoMarkUnused=!0;_itemSet=new Map;_itemList=[];_usedSet=new Set;_callbacks=new Map;_unloadingHandle=-1;_cachedBytes=0;_bytesMap=new Map;_loadedSet=new Set;_unloadPriorityCallback=null;set unloadPriorityCallback(e){this._unloadPriorityCallback=e}get unloadPriorityCallback(){return this._unloadPriorityCallback}isFull(){return this._itemSet.size>=this.maxSize||this._cachedBytes>=this.maxBytesSize}getMemoryUsage(e){return this._bytesMap.get(e)||0}setMemoryUsage(e,t){if(!this._itemSet.has(e))return;const a=this._bytesMap.get(e)||0;this._cachedBytes-=a,this._bytesMap.set(e,t),this._cachedBytes+=t}add(e,t){return this._itemSet.has(e)||this.isFull()?!1:(this._itemList.push(e),this._usedSet.add(e),this._itemSet.set(e,Date.now()),this._callbacks.set(e,t),this._loadedSet.add(e),!0)}has(e){return this._itemSet.has(e)}remove(e){if(!this._itemSet.has(e))return!1;const t=this._bytesMap.get(e)||0;this._cachedBytes-=t,this._bytesMap.delete(e);const a=this._callbacks.get(e);a&&a(e);const r=this._itemList.indexOf(e);return r!==-1&&this._itemList.splice(r,1),this._usedSet.delete(e),this._itemSet.delete(e),this._callbacks.delete(e),this._loadedSet.delete(e),!0}markUsed(e){this._itemSet.has(e)&&(this._usedSet.add(e),this._itemSet.set(e,Date.now()))}markUnused(e){this._usedSet.delete(e)}scheduleUnload(){this._unloadingHandle===-1&&(this._unloadingHandle=requestAnimationFrame(()=>{this._unloadingHandle=-1,this._performUnload()}))}_performUnload(){if(!(this._itemSet.size>this.minSize||this._cachedBytes>this.minBytesSize))return;this.autoMarkUnused&&this._itemSet.forEach((o,l)=>{this._usedSet.has(l)||this.markUnused(l)});const t=[];this._itemList.forEach(o=>{this._usedSet.has(o)||t.push(o)}),this._unloadPriorityCallback&&t.sort(this._unloadPriorityCallback);const a=Math.floor(this._itemSet.size*(1-this.unloadPercent)),r=this._cachedBytes-(this._cachedBytes-this.minBytesSize);let i=0,s=0;for(let o=0;o<t.length;o++){const l=t[o];if(this._itemSet.size-i<=a&&this._cachedBytes-s<=r)break;const c=this._bytesMap.get(l)||0;this.remove(l)&&(i++,s+=c)}}clear(){Array.from(this._itemSet.keys()).forEach(t=>this.remove(t))}getStats(){return{size:this._itemSet.size,bytes:this._cachedBytes,usedCount:this._usedSet.size}}}class Lo{maxJobs=6;priorityCallback=null;_items=[];_callbacks=new Map;_currJobs=0;get running(){return this._items.length!==0||this._currJobs!==0}sort(){this.priorityCallback&&this._items.sort(this.priorityCallback)}has(e){return this._callbacks.has(e)}add(e,t){if(this._callbacks.has(e))return this._callbacks.get(e).promise;let a,r;const i=new Promise((o,l)=>{a=o,r=l}),s={callback:t,promise:i,resolve:a,reject:r};return this._items.unshift(e),this._callbacks.set(e,s),i}remove(e){const t=this._items.indexOf(e);if(t!==-1){const a=this._callbacks.get(e);a&&(a.promise.catch(()=>{}),a.reject(new Error("PriorityQueue: Item removed."))),this._items.splice(t,1),this._callbacks.delete(e)}}removeByFilter(e){const t=[];this._items.forEach(a=>{e(a)&&t.push(a)}),t.forEach(a=>this.remove(a))}update(){this._tryRunJobs()}_tryRunJobs(){this.sort();const e=this.maxJobs;let t=0;const a=()=>{this._currJobs--};for(;e>this._currJobs&&this._items.length>0&&t<e;){this._currJobs++,t++;const r=this._items.shift(),i=this._callbacks.get(r);this._callbacks.delete(r),Promise.resolve(i.callback(r)).then(()=>{i.resolve(),a()}).catch(s=>{i.reject(s),a()})}}clear(){Array.from(this._items).forEach(t=>this.remove(t))}getStats(){return{queued:this._items.length,running:this._currJobs}}}function Vh(n,e=null,t=null){const a=[];for(a.push(n),a.push(null),a.push(0);a.length>0;){const r=a.pop(),i=a.pop(),s=a.pop();if(e&&e(s,i,r)===!0){t&&t(s,i,r);return}const o=s.children;if(o&&o.length>0)for(let l=o.length-1;l>=0;l--)a.push(o[l]),a.push(s),a.push(r+1);if(t&&t(s,i,r)===!0)return}}function Qm(n,e){let t=n;for(;t;){const a=t.depth,r=t.parent;e(t,r,a),t=r}}const zs={inView:!1,error:1/0,distanceFromCamera:1/0},Oh=!0;function Lh(n){return n===Oa||n===vr}function yr(n,e){return n.lastFrameVisited===e&&n.used}function Gh(n){return n.childrenProcessed===n.children.length}function Go(n){return n.hasUnrenderableContent||n.parent!==null&&n.parent.geometricError<n.geometricError}function zo(n,e){n.lastFrameVisited!==e.frameCount&&(n.usedLastFrame=n.used,n.lastFrameVisited=e.frameCount,n.used=!1,n.inFrustum=!1,n.isLeaf=!1,n.visible=!1,n.active=!1,n.error=1/0,n.distanceFromCamera=1/0,n.allChildrenReady=!1,e.calculateTileViewError(n,zs),n.inFrustum=zs.inView,n.error=zs.error,n.distanceFromCamera=zs.distanceFromCamera)}function Wo(n,e,t=!1){n.used||(t||(n.used=!0,e.stats.used++),e.markTileUsed(n),n.inFrustum===!0&&e.stats.inFrustum++)}function Mm(n,e){if(n.canTraverse&&n.canTraverseFrame===e.frameCount)return n.canTraverse;let t=!1;return n.error<=e.errorTarget&&!Go(n)||n.depth>=e.maxDepth||!n.children||n.children.length===0?t=!1:t=!0,n.canTraverse=t,n.canTraverseFrame=e.frameCount,t}function Jo(n,e,t=!1){if(e.ensureChildrenArePreprocessed(n),zo(n,e),Wo(n,e,t),Go(n)&&Gh(n)){const a=n.children;for(let r=0,i=a.length;r<i;r++)Jo(a[r],e,t)}}function Ws(n,e){if(e.ensureChildrenArePreprocessed(n),zo(n,e),!n.inFrustum)return;if(!Mm(n,e)){Wo(n,e);const s=n.children;if(!n.hasContent&&s&&s.length>0)for(let o=0,l=s.length;o<l;o++){const c=s[o];Ws(c,e)}return}const a=n.children;let r=!1,i=!1;for(let s=0,o=a.length;s<o;s++){const l=a[s];Ws(l,e),r=r||yr(l,e.frameCount),i=i||l.inFrustum}if(n.refine==="REPLACE"&&!i&&a.length!==0){n.inFrustum=!1;for(let s=0,o=a.length;s<o;s++)Jo(a[s],e,!0);return}if(Wo(n,e),n.refine==="REPLACE"&&(r&&n.depth!==0||Oh))for(let s=0,o=a.length;s<o;s++)Jo(a[s],e)}function jo(n,e){const t=e.frameCount;if(!yr(n,t))return;const a=n.children;let r=!1;for(let i=0,s=a.length;i<s;i++){const o=a[i];r=r||yr(o,t)}if(!r)n.isLeaf=!0;else{let i=!0;for(let s=0,o=a.length;s<o;s++){const l=a[s];if(jo(l,e),yr(l,t)){const c=!Go(l);let f=!l.hasContent||l.hasRenderableContent&&Lh(l.loadingState)||l.hasUnrenderableContent&&l.loadingState===vr;f=c&&f||l.allChildrenReady,i=i&&f}}n.allChildrenReady=i}}function zh(n,e){if(e.ensureChildrenArePreprocessed(n),yr(n,e.frameCount)&&(n.hasContent&&e.queueTileForDownload(n),Gh(n))){const t=n.children;for(let a=0,r=t.length;a<r;a++)zh(t[a],e)}}function Js(n,e){const t=e.stats;if(!yr(n,e.frameCount))return;if(n.isLeaf){n.loadingState===Oa?(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++):n.hasContent&&e.queueTileForDownload(n);return}const a=n.children,r=n.hasContent,i=Lh(n.loadingState)&&r,s=(e.errorTarget+1)*(e.errorThreshold||1),o=n.error<=s,l=n.refine==="ADD",c=n.allChildrenReady||n.depth===0&&!Oh;if(r&&(o||l)&&e.queueTileForDownload(n),(o&&i&&!c||i&&l)&&(n.inFrustum&&(n.visible=!0,t.visible++),n.active=!0,t.active++),!l&&o&&!c)for(let f=0,h=a.length;f<h;f++){const u=a[f];yr(u,e.frameCount)&&zh(u,e)}else for(let f=0,h=a.length;f<h;f++)Js(a[f],e)}function js(n,e){const t=yr(n,e.frameCount);if(t||n.usedLastFrame){let a=!1,r=!1;if(t?(a=n.active,r=n.visible):zo(n,e),n.hasRenderableContent&&n.loadingState===Oa){const s=n.__wasSetVisible;n.__wasSetActive!==a&&(e.setTileDelayedActive(n,a),n.__wasSetActive=a),s!==r&&(e.setTileDelayedVisible(n,r),n.__wasSetVisible=r)}n.usedLastFrame=t;const i=n.children;for(let s=0,o=i.length;s<o;s++)js(i[s],e)}}class Vr{static s_tmpMatrix=null;_type;_data;_box;get box(){return this._box}_sphere;_matrix;constructor(e){if(Vr.s_tmpMatrix||(Vr.s_tmpMatrix=new T),this._data=e,e.box)this._type="box",this._parseBox(e.box);else if(e.sphere)this._type="sphere",this._parseSphere(e.sphere);else if(e.region)this._type="region",this._parseRegion(e.region);else throw new Error("BoundingVolume: Invalid bounding volume data")}_parseBox(e){if(e.length!==12)throw new Error("BoundingVolume: Box must have 12 elements");const t=new g(e[0],e[1],e[2]),a=new g(e[3],e[4],e[5]),r=new g(e[6],e[7],e[8]),i=new g(e[9],e[10],e[11]),s=a.length,o=r.length,l=i.length,c=a.clone().normalize(),f=r.clone().normalize(),h=i.clone().normalize();this._matrix=new T;const u=this._matrix.rawData;u[0]=c.x,u[1]=c.y,u[2]=c.z,u[3]=0,u[4]=f.x,u[5]=f.y,u[6]=f.z,u[7]=0,u[8]=h.x,u[9]=h.y,u[10]=h.z,u[11]=0,u[12]=t.x,u[13]=t.y,u[14]=t.z,u[15]=1;const b=new g(s*2,o*2,l*2);this._box=new Ce(new g(0,0,0),b)}_parseSphere(e){if(e.length!==4)throw new Error("BoundingVolume: Sphere must have 4 elements");const t=new g(e[0],e[1],e[2]),a=e[3];this._sphere=new Tr(t,a)}_parseRegion(e){if(e.length!==6)throw new Error("BoundingVolume: Region must have 6 elements");const[t,a,r,i,s,o]=e,l=new g((t+r)/2,(a+i)/2,(s+o)/2),c=new g(Math.abs(r-t),Math.abs(i-a),Math.abs(o-s));this._box=new Ce(l,c),this._matrix=new T,this._matrix.identity()}getAABB(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center,r=this._sphere.radius,i=new g(a.x-r,a.y-r,a.z-r),s=new g(a.x+r,a.y+r,a.z+r);if(e.setFromMinMax(i,s),t){const o=[new g(i.x,i.y,i.z),new g(s.x,i.y,i.z),new g(i.x,s.y,i.z),new g(s.x,s.y,i.z),new g(i.x,i.y,s.z),new g(s.x,i.y,s.z),new g(i.x,s.y,s.z),new g(s.x,s.y,s.z)];o.forEach(l=>{const c=new g;t.transformPoint(l,c),l.copyFrom(c)}),e.makeEmpty(),o.forEach(l=>{e.expandByPoint(l)})}return e}else if(this._box){const a=Vr.s_tmpMatrix;if(a.identity(),this._matrix?t?a.multiplyMatrices(t,this._matrix):a.copyFrom(this._matrix):t&&a.copyFrom(t),a){const r=this._box,i=[new g(r.min.x,r.min.y,r.min.z),new g(r.max.x,r.min.y,r.min.z),new g(r.min.x,r.max.y,r.min.z),new g(r.max.x,r.max.y,r.min.z),new g(r.min.x,r.min.y,r.max.z),new g(r.max.x,r.min.y,r.max.z),new g(r.min.x,r.max.y,r.max.z),new g(r.max.x,r.max.y,r.max.z)];i.forEach(s=>{const o=new g;a.transformPoint(s,o),s.copyFrom(o)}),e.makeEmpty(),i.forEach(s=>{e.expandByPoint(s)})}else e.setFromMinMax(this._box.min,this._box.max);return e}throw new Error("BoundingVolume: Invalid state")}getOBB(e,t){this._type==="box"&&this._box&&this._matrix?(e.setFromMinMax(this._box.min,this._box.max),t.copyFrom(this._matrix)):(this.getAABB(e),t.identity())}getSphere(e){if(this._type==="sphere"&&this._sphere)return e.center.copyFrom(this._sphere.center),e.radius=this._sphere.radius,e;const t=new Ce;this.getAABB(t);const a=t.center,i=t.size.length*.5;return e.center.copyFrom(a),e.radius=i,e}get type(){return this._type}distanceToPoint(e,t){if(this._type==="sphere"&&this._sphere){const a=this._sphere.center;let r=a;if(t){const o=new g;t.transformPoint(a,o),r=o}const i=this._sphere.radius,s=e.clone().subtract(r).length;return Math.max(0,s-i)}else if(this._box){const a=new Ce;this.getAABB(a,t);const r=a.center,i=a.size,s=Math.max(0,Math.abs(e.x-r.x)-i.x*.5),o=Math.max(0,Math.abs(e.y-r.y)-i.y*.5),l=Math.max(0,Math.abs(e.z-r.z)-i.z*.5);return Math.sqrt(s*s+o*o+l*l)}return 1/0}intersectsFrustum(e,t){if(this._type==="sphere"&&this._sphere){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}else if(this._box){const a=new Ce;return this.getAABB(a,t),e.containsBox2(a)>0}return!1}}const Wh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.used!==e.used?n.used?1:-1:n.error!==e.error?n.error>e.error?1:-1:n.distanceFromCamera!==e.distanceFromCamera?n.distanceFromCamera>e.distanceFromCamera?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?-1:1:0},Jh=(n,e)=>{const t=n.priority||0,a=e.priority||0;return t!==a?t>a?1:-1:n.lastFrameVisited!==e.lastFrameVisited?n.lastFrameVisited>e.lastFrameVisited?-1:1:n.depthFromRenderedParent!==e.depthFromRenderedParent?n.depthFromRenderedParent>e.depthFromRenderedParent?1:-1:n.loadingState!==e.loadingState?n.loadingState>e.loadingState?-1:1:n.hasUnrenderableContent!==e.hasUnrenderableContent?n.hasUnrenderableContent?-1:1:n.error!==e.error?n.error>e.error?-1:1:0};class Pm{rootLoadingState=Ur;rootTileSet=null;rootURL=null;fetchOptions={};frameCount=0;isLoading=!1;lruCache;loadQueue;processNodeQueue;plugins=[];_queuedTiles=[];_cachedSinceLoadComplete=new Set;_processedTiles=new WeakSet;_visibleTiles=new Set;_usedSet=new Set;_cacheHits=0;_cacheMisses=0;stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0,sceneCount:0,inCacheSinceLoad:0};errorTarget=16;errorThreshold=1;maxDepth=30;displayActiveTiles=!1;onRootTileLoaded;rtcOffset=null;_root=null;_activeTiles=new Set;_delayedHideTiles=new Set;_delayedVisibleTiles=new Set;_delayedActiveTiles=new Set;group;cameras=[];_cameraMap=new Map;_cameraInfo=[];_upRotationMatrix=new T;_ellipsoid;_bytesUsed=new WeakMap;_eventListeners=new Map;performanceStats={updateTime:0,traverseTime:0,markUsedTime:0,markVisibleTime:0,toggleTime:0,queueProcessTime:0};transCdnUrlFunc=null;constructor(e=null){this.rootURL=e,this.lruCache=new Nh,this.lruCache.unloadPriorityCallback=Jh,this.loadQueue=new Lo,this.loadQueue.maxJobs=10,this.loadQueue.priorityCallback=Wh,this.processNodeQueue=new Lo,this.processNodeQueue.maxJobs=25,this.group=new d.Object3D,this.group.name="TilesRendererGroup"}get root(){return this._root}get loadProgress(){const{stats:e,isLoading:t}=this,a=e.downloading,r=e.inCacheSinceLoad+(t?1:0);return r===0?1:1-a/r}update(){const{lruCache:e,_usedSet:t,stats:a,loadQueue:r,processNodeQueue:i}=this;this.rootLoadingState===Ur&&(this.rootLoadingState=Vo,this.isLoading=!0,this._loadRootTileSet().then(c=>{if(this.rootLoadingState=Oa,this.rootTileSet=c,c.root){const f=this._getBasePath(this.rootURL||""),h=this.preprocessNode(c.root,f,null);this.queueTileForDownload(h),this._root=h;const u=new Vr(h.boundingVolume),b=new Tr;u.getSphere(b);const A=new Ce;if(u.getAABB(A),this.rtcOffset=new g(-b.center.x,-b.center.y,-b.center.z),this.onRootTileLoaded)try{this.onRootTileLoaded({center:b.center,radius:b.radius,boundingBox:A,rtcOffset:this.rtcOffset})}catch(m){console.warn("Failed to calculate bounding volume for root tile:",m)}}this.dispatchEvent({type:"load-tile-set",tileSet:c,url:this.rootURL})}).catch(c=>{this.rootLoadingState=vr,console.error("Failed to load root tileset:",c),this.dispatchEvent({type:"load-error",tile:null,error:c,url:this.rootURL})}));const s=this.root;if(!s)return;a.inFrustum=0,a.used=0,a.active=0,a.visible=0,this.frameCount++,t.forEach(c=>e.markUnused(c)),t.clear(),this.updateCameraInfo(),this._checkDelayedHideTiles(),this._checkDelayedActiveTiles(),this._checkDelayedVisibleTiles(),Ws(s,this),jo(s,this),Js(s,this),js(s,this);const o=this._queuedTiles;e.unloadPriorityCallback&&o.sort(e.unloadPriorityCallback);for(let c=0,f=o.length;c<f&&!e.isFull();c++)this.requestTileContents(o[c]);o.length=0,r.update(),i.update(),e.scheduleUnload(),(r.running||i.running)===!1&&this.isLoading===!0&&(this._cachedSinceLoadComplete.clear(),a.inCacheSinceLoad=0,this.dispatchEvent({type:"tiles-load-end"}),this.isLoading=!1)}traverse(e,t,a=!0){this.root&&Vh(this.root,(r,i,s)=>(a&&this.ensureChildrenArePreprocessed(r,!0),e?e(r,i,s):!1),t)}registerPlugin(e){if(this.plugins.includes(e))return;const t=e.priority||0;let a=this.plugins.length;for(let r=0;r<this.plugins.length;r++)if((this.plugins[r].priority||0)>t){a=r;break}this.plugins.splice(a,0,e),e.init&&e.init(this)}unregisterPlugin(e){const t=this.plugins;let a;if(typeof e=="string"?a=t.find(r=>r.name===e):a=e,a&&t.includes(a)){const r=t.indexOf(a);return t.splice(r,1),a.dispose&&a.dispose(),!0}return!1}getPluginByName(e){return this.plugins.find(t=>t.name===e)||null}calculateTileViewError(e,t){const a=e.cached,r=this.cameras,i=this._cameraInfo,s=a.boundingVolume;if(!s){t.inView=!1,t.error=1/0,t.distanceFromCamera=1/0;return}let o=!1,l=-1/0,c=1/0,f=-1/0,h=1/0;const u=a.worldTransform;for(let b=0,A=r.length;b<A;b++){const m=i[b];let p,D;if(m.isOrthographic){const v=m.pixelSize;p=e.geometricError/v,D=1/0}else{const v=m.sseDenominator;D=s.distanceToPoint(m.position,u),p=D===0?1/0:e.geometricError/(D*v)}const _=i[b].frustum;s.intersectsFrustum(_,u)&&(o=!0,l=Math.max(l,p),c=Math.min(c,D)),f=Math.max(f,p),h=Math.min(h,D)}o?(t.inView=!0,t.error=l,t.distanceFromCamera=c):(t.inView=!1,t.error=f,t.distanceFromCamera=h)}updateCameraInfo(){this._updateCameraInfo()}_updateCameraInfo(){const e=this.cameras,t=this._cameraInfo,a=this._cameraMap;for(;t.length<e.length;)t.push({position:new g,frustum:new pn,isOrthographic:!1});for(let r=0;r<e.length;r++){const i=e[r],s=t[r],o=a.get(i);if(!o)continue;const l=i.transform.worldPosition;if(s.position.copyFrom(l),s.frustum=i.frustum,s.isOrthographic=i.type===st.ortho,s.isOrthographic){const c=i.frustumSize;s.pixelSize=c/o.height}else{const f=i.fov*Math.PI/180;s.sseDenominator=2*Math.tan(f/2)/o.height}}}preprocessNode(e,t,a=null){if(this._processedTiles.has(e))return e;this._processedTiles.add(e);let r;if(e instanceof Oo?r=e:r=new Oo(e,a),r.content){const c=r.content;!("uri"in c)&&"url"in c&&(c.uri=c.url,delete c.url)}if(r.basePath=t,r.boundingVolume){const c=new Vr(r.boundingVolume);r.cached.boundingVolume=c}const i=new g(r.boundingVolume.box[0],r.boundingVolume.box[1],r.boundingVolume.box[2]),s=new T;if(r.transform){const c=r.transform;for(let f=0;f<16;f++)s.rawData[f]=c[f]}if(!a){s.copyFrom(this._upRotationMatrix);const c=new g;c.copyFrom(i),c.applyMatrix4(s);const f=r.cached.boundingVolume.box,h=[new g(f.min.x,f.min.y,f.min.z),new g(f.max.x,f.min.y,f.min.z),new g(f.min.x,f.max.y,f.min.z),new g(f.max.x,f.max.y,f.min.z),new g(f.min.x,f.min.y,f.max.z),new g(f.max.x,f.min.y,f.max.z),new g(f.min.x,f.max.y,f.max.z),new g(f.max.x,f.max.y,f.max.z)];for(const A of h)A.applyMatrix4(s);const u=new Ce;h.forEach(A=>{u.expandByPoint(A)}),s.rawData[12]=-c.x,s.rawData[13]=-c.y,s.rawData[14]=-c.z;const b=u.min;s.rawData[13]-=b.y}const o=new T;o.copyFrom(s),a&&a.cached.worldTransform&&o.multiplyMatrices(a.cached.worldTransform,s);const l=new T;if(l.copyFrom(o),l.invert(),r.cached.transfrom=s,r.cached.worldTransform=o,r.cached.transformInverse=l,e.children&&e.children.length>0){r.children=[];for(let c=0;c<e.children.length;c++){const f=e.children[c],h=this.preprocessNode(f,t,r);r.children.push(h)}r.childrenProcessed=r.children.length}return r}ensureChildrenArePreprocessed(e,t=!1){const a=e.children;for(let r=0,i=a.length;r<i;r++){const s=a[r];s.basePath!==void 0&&s.basePath!==""||s.cached.boundingVolume||(t?(this.processNodeQueue.remove(s),this.preprocessNode(s,e.basePath,e)):this.processNodeQueue.has(s)||this.processNodeQueue.add(s,o=>{this.preprocessNode(o,e.basePath,e)}))}}_recordCacheHit(){this._cacheHits++}_recordCacheMiss(){this._cacheMisses++}resetCacheStats(){this._cacheHits=0,this._cacheMisses=0}requestTileContents(e){if(e.loadingState!==Ur){this._recordCacheHit();return}if(this.lruCache.isFull()){this._recordCacheMiss();return}this._recordCacheMiss(),e.loadingState=Vo,this.stats.downloading++;const t=e.content||e.contents&&e.contents[0];if(!t||!t.uri){e.loadingState=vr,this.stats.downloading--,this.stats.failed++;return}const a=e.basePath||"",r=t.uri,i=this._resolveURL(a,r);this.loadQueue.add(e,async s=>{try{await this.parseTileContent(s,r,i),this.stats.downloading--}catch(o){s.loadingState=vr,this.stats.downloading--,this.stats.failed++,console.error("Failed to load tile:",o)}})}async parseTileContent(e,t,a){e.loadingState=Mh;const i=(c=>{const f=c.split(".");return f.length>1?f[f.length-1]:""})(t),s=this.transCdnUrlFunc?this.transCdnUrlFunc(a):a;let o=null;const l=new Tt;switch(i.toLowerCase()){case"b3dm":{o=(await l.load(s,ro,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"i3dm":{o=(await l.load(s,no,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"glb":case"gltf":{o=(await l.load(s,_t,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"pnts":{o=(await l.load(s,Fh,{onProgress:f=>{},onComplete:f=>{}})).data;break}case"json":try{const c=await B.res.loadJSON(s);e.children.length=0,e.childrenProcessed=0;const f=this._getBasePath(s);if(c.root){const h=this.preprocessNode(c.root,f,e);e.children.push(h),e.childrenProcessed=1,this.dispatchEvent({type:"load-tile-set",tileSet:c,url:s})}e.loadingState=Oa;return}catch(c){console.error("Failed to load external tileset:",c),e.loadingState=vr,this.stats.failed++;return}break;default:console.warn(`Unknown tile format: ${i}`);break}if(o){e.cached.scene=o;const c=this._estimateBytesUsed(o);this._bytesUsed.set(o,c),this.lruCache.setMemoryUsage(e,c),this.lruCache.has(e)||this.lruCache.add(e,f=>{if(f.cached.scene){const h=f.cached.scene;h.parent&&h.parent.object3D.removeChild(h),h.destroy(!0),f.cached.scene=null}f.loadingState=Ur}),this.setTileImmediateActive(e),e.active=!0,e.__wasSetActive=!0,this.stats.active++,this.setTileImmediateVisible(e),e.visible=!0,e.__wasSetVisible=!0,this.stats.visible++,this.stats.sceneCount++,e.loadingState=Oa,e.usedLastFrame=!0,Js(e,this),js(e,this)}else e.loadingState=vr,this.stats.failed++}markTileUsed(e){this._usedSet.add(e),this.lruCache.markUsed(e)}setTileDelayedActive(e,t){t?(this._activeTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedActiveTiles.has(e)||this._delayedActiveTiles.add(e)):(this._activeTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedActiveTiles.has(e)&&this._delayedActiveTiles.delete(e))}setTileImmediateActive(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform))}}setTileImmediateVisible(e){if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0)}}_checkDelayedHideTiles(){if(this.stats.downloading===0)for(const e of this._delayedHideTiles){const t=e.cached.scene;t&&(t.transform.enable=!1,this._delayedHideTiles.delete(e))}}_checkDelayedActiveTiles(){for(const e of this._delayedActiveTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(this.group.entityChildren.includes(t)||(t.parent&&t.parent.object3D.removeChild(t),this.group.addChild(t)),e.cached.worldTransform&&this._applyWorldTransform(t.transform,e.cached.worldTransform),this._delayedActiveTiles.delete(e))}else this._delayedActiveTiles.delete(e)}_checkDelayedVisibleTiles(){for(const e of this._delayedVisibleTiles)if(e.hasRenderableContent){const t=e.cached.scene;t&&(t.transform.enable=!0,this._delayedVisibleTiles.delete(e))}else this._delayedVisibleTiles.delete(e)}setTileDelayedVisible(e,t){t?(this._visibleTiles.add(e),this._delayedHideTiles.has(e)&&this._delayedHideTiles.delete(e),this._delayedVisibleTiles.has(e)||this._delayedVisibleTiles.add(e)):(this._visibleTiles.delete(e),this._delayedHideTiles.has(e)||this._delayedHideTiles.add(e),this._delayedVisibleTiles.has(e)&&this._delayedVisibleTiles.delete(e))}queueTileForDownload(e){e.loadingState!==Ur||this.lruCache.isFull()||this._queuedTiles.push(e)}dispatchEvent(e){const t=this._eventListeners.get(e.type);t&&t.forEach(a=>{try{a(e)}catch(r){console.error("Error in event listener:",r)}})}async _loadRootTileSet(){if(!this.rootURL)throw new Error("Root URL is not set");const e=await B.res.loadJSON(this.rootURL);return e.asset&&e.asset.gltfUpAxis&&this._setupUpAxisRotation(e.asset.gltfUpAxis),e}_setupUpAxisRotation(e){const t=new T;switch(e.toLowerCase()){case"x":t.makeRotationAxis(g.Y_AXIS,-Math.PI/2);break;case"y":t.identity();break;case"z":t.makeRotationAxis(g.X_AXIS,-Math.PI/2);break;default:console.warn(`Unknown gltfUpAxis: ${e}, using default`),t.identity();break}this._upRotationMatrix=t}_applyLocalTransform(e,t){const a=t.decompose(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_applyWorldTransform(e,t){const a=t.decompose(sa.EULER_ANGLES);e.localPosition=a[0];const r=new ne;r.fromEulerAngles(a[1].x,a[1].y,a[1].z),e.localRotQuat=r,e.localScale=a[2]}_getBasePath(e){const t=e.lastIndexOf("/");return t!==-1?e.substring(0,t):""}_resolveURL(e,t){return t.startsWith("http://")||t.startsWith("https://")?t:e+"/"+t}_getUrlExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}getMemoryStats(){const e=this.lruCache.getStats(),t=this.lruCache.maxBytesSize,a=e.bytes,r=t-a,i=this._cacheHits+this._cacheMisses,s=i>0?this._cacheHits/i:0;return{totalTiles:e.size,loadedTiles:e.usedCount,cachedTiles:e.size,totalBytes:t,usedBytes:a,freeBytes:r,cacheHitRate:s}}getLoadedTiles(){const e=[];return this.traverse(t=>(t.loadingState===Oa&&e.push(t),!1),null),e}getVisibleTiles(){return Array.from(this._visibleTiles)}getActiveTiles(){return Array.from(this._activeTiles)}getTileTreeStats(){let e=0,t=0,a=0,r=0,i=0,s=0;return this.traverse(o=>(e++,o.loadingState===Oa&&t++,o.visible&&a++,o.active&&r++,i=Math.max(i,o.depth),s+=o.depth,!1),null),{totalTiles:e,loadedTiles:t,visibleTiles:a,activeTiles:r,maxDepth:i,averageDepth:e>0?s/e:0}}printDebugInfo(){const e=this.stats,t=this.getMemoryStats(),a=this.getTileTreeStats(),r=this.performanceStats,i=this.lruCache.getStats();console.log("=== TilesRenderer Debug Info ==="),console.log("Stats:",e),console.log("Memory:",t),console.log("Tree:",a),console.log("Performance:",r),console.log("Cache:",i),console.log("Queues:",{load:this.loadQueue.getStats(),process:this.processNodeQueue.getStats()})}setPerformanceOptions(e){e.lruCacheMinSize!==void 0&&(this.lruCache.minSize=e.lruCacheMinSize),e.lruCacheMaxSize!==void 0&&(this.lruCache.maxSize=e.lruCacheMaxSize),e.lruCacheMinBytes!==void 0&&(this.lruCache.minBytesSize=e.lruCacheMinBytes),e.lruCacheMaxBytes!==void 0&&(this.lruCache.maxBytesSize=e.lruCacheMaxBytes),e.lruCacheUnloadPercent!==void 0&&(this.lruCache.unloadPercent=e.lruCacheUnloadPercent),e.downloadQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.downloadQueueMaxJobs),e.parseQueueMaxJobs!==void 0&&(this.loadQueue.maxJobs=e.parseQueueMaxJobs),e.processQueueMaxJobs!==void 0&&(this.processNodeQueue.maxJobs=e.processQueueMaxJobs),e.enablePerformanceStats!==void 0&&(this._enablePerformanceStats=e.enablePerformanceStats),e.enableCacheStats!==void 0&&(this._enableCacheStats=e.enableCacheStats)}dispose(e){[...this.plugins].forEach(a=>this.unregisterPlugin(a)),this.lruCache.clear(),this.loadQueue.clear(),this.processNodeQueue.clear(),this._root=null,this.rootTileSet=null,this.rootLoadingState=Ur,this.frameCount=0,this.isLoading=!1,this.resetCacheStats(),this.group.destroy(e)}setCamera(e,t,a){this.cameras.includes(e)||this.cameras.push(e),this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}deleteCamera(e){const t=this.cameras.indexOf(e);t!==-1&&this.cameras.splice(t,1),this._cameraMap.delete(e),this._updateCameraInfo()}setResolution(e,t,a){const r=this._cameraMap.get(e);r?(r.width=t,r.height=a):this._cameraMap.set(e,{width:t,height:a}),this._updateCameraInfo()}forEachLoadedModel(e){this.traverse(t=>(t.loadingState===Oa&&t.cached.scene&&e(t.cached.scene,t),!1),null)}_estimateBytesUsed(e){let t=0;return e.forChild(a=>{const r=a.getComponent(d.MeshRenderer);r&&r.geometry&&(t+=1024),r&&r.material&&(t+=512)}),t}addEventListener(e,t){this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.get(e).push(t)}removeEventListener(e,t){const a=this._eventListeners.get(e);if(a){const r=a.indexOf(t);r!==-1&&a.splice(r,1)}}async loadTileSet(e,t){const r=(e.endsWith("/")?e.slice(0,-1):e)+"/"+t;this.rootURL=r}get modelList(){const e=[];return this.forEachLoadedModel(t=>{e.push(t)}),e}}class Nm{asset;extras;geometricError;properties;refine;root;extensionsUsed;extensionsRequired;extensions}class Vm{boundingVolume;children;geometricError;transform;content;contents;refine;extensions;extras}class Om{boundingVolume;geometricError;refine;content;contents;children;transform;extensions;extras}class Lm{uri;group;metadata}class Gm{class;properties}function zm(n,e){let t=0,a=null;return function(...r){const i=Date.now(),s=i-t;s>=e?(t=i,n.apply(this,r)):(a!==null&&clearTimeout(a),a=window.setTimeout(()=>{t=Date.now(),n.apply(this,r),a=null},e-s))}}class Wm extends Dt{static count=0;constructor(){super(),X.register("ColorLitShader",Ad),this.shader=new gt;let e=new qe("ColorLitShader","ColorLitShader");e.passType=de.COLOR,this.shader.addRenderPass(e),e.setDefine("USE_BRDF",!0),e.setShaderEntry("VertMain","FragMain"),e.setUniformColor("baseColor",new Z),e.setUniformColor("emissiveColor",new Z),e.setUniformFloat("envIntensity",1),e.setUniformFloat("normalScale",1),e.setUniformFloat("roughness",0),e.setUniformFloat("metallic",0),e.setUniformFloat("ao",1),e.setUniformFloat("alphaCutoff",0);let t=e.shaderState;t.acceptShadow=!0,t.receiveEnv=!0,t.acceptGI=!0,t.useLight=!0,e.setTexture("normalMap",B.res.normalTexture),e.setTexture("emissiveMap",B.res.blackTexture)}clone(){return null}debug(){}}class Jm extends Dt{constructor(){super();let e=new qe("LambertShader","LambertShader");e.setShaderEntry("VertMain","FragMain"),e.passType=de.COLOR,e.setUniformVector4("transformUV1",new ue(0,0,1,1)),e.setUniformVector4("transformUV2",new ue(0,0,1,1)),e.setUniformColor("baseColor",new Z(1,1,1,1)),e.setUniformFloat("alphaCutoff",.5);let t=e.shaderState;t.acceptShadow=!1,t.castShadow=!1,t.receiveEnv=!1,t.acceptGI=!1,t.useLight=!1;let a=new gt;a.addRenderPass(e),this.shader=a,this.baseMap=B.res.grayTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set envMap(e){}set shadowMap(e){}}function jm(n,e){}class Zm extends Dt{constructor(){super(),this.shader=new d.UnLitTexArrayShader,this.baseMap=B.res.whiteTexture}set baseMap(e){this.shader.setTexture("baseMap",e)}get baseMap(){return this.shader.getTexture("baseMap")}set baseColor(e){this.shader.setUniformColor("baseColor",e)}get baseColor(){return this.shader.getUniformColor("baseColor")}set shadowMap(e){}}class Zo{clipName;loopTime;startTime;stopTime;sampleRate;useSkeletonPos;useSkeletonScale;positionCurves=new Map;rotationCurves=new Map;scaleCurves=new Map;floatCurves=new Map;formBytes(e){if(this.clipName=e.readUTF(),this.loopTime=!e.readInt32(),this.startTime=e.readFloat32(),this.stopTime=e.readFloat32(),this.sampleRate=e.readInt32(),this.useSkeletonPos=e.readInt32()>0,this.useSkeletonScale=e.readInt32()>0,this.useSkeletonPos){let r=e.readInt32();for(let i=0;i<r;i++){let s=new Cr;s.formBytes(e),this.positionCurves.set(s.path,s)}}let t=e.readInt32();for(let r=0;r<t;r++){let i=new Cr;i.formBytes(e),this.rotationCurves.set(i.path,i)}if(this.useSkeletonScale){let r=e.readInt32();for(let i=0;i<r;i++){let s=new Cr;s.formBytes(e),this.scaleCurves.set(s.path,s)}}let a=e.readInt32();for(let r=0;r<a;r++){let i=new Cr;i.formBytes(e),this.floatCurves.set(i.attribute,i)}}}class Cr{path;attribute;propertys;preInfinity;postInfinity;rotationOrder;m_curves;k=0;_cacheValue;_kValue;constructor(e=1){this.k=e,this.m_curves=[],this.check()}check(){for(let e=0;e<this.k;e++)this.m_curves[e]||=new Vi;switch(this.k){case 1:this._cacheValue=0;break;case 2:this._cacheValue=new fe;break;case 3:this._cacheValue=new g;break;case 4:this._cacheValue=new ue;break}}get totalTime(){return this.m_curves[0].totalTime}addKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].addKeyFrame(e.getK(t))}removeKeyFrame(e){for(let t=0;t<this.k;t++)this.m_curves[t].removeKeyFrame(e.getK(t))}getValue(e){switch(this.k){case 1:this._cacheValue=this.m_curves[0].getValue(e);break;case 2:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e);break;case 3:this._cacheValue.x=this.m_curves[0].getValue(e),this._cacheValue.y=this.m_curves[1].getValue(e),this._cacheValue.z=this.m_curves[2].getValue(e);break;case 4:const t=this.m_curves[0].getCurveFramesExtent(e),a=t.lhsIndex,r=t.rhsIndex;e=t.time;let i=this.m_curves[0].getKey(a),s=this.m_curves[0].getKey(r);e%=this.m_curves[0].totalTime;let o=(e-i.time)/(s.time-i.time);ne.HELP_0.set(this.m_curves[0].getKey(a).value,this.m_curves[1].getKey(a).value,this.m_curves[2].getKey(a).value,this.m_curves[3].getKey(a).value),ne.HELP_1.set(this.m_curves[0].getKey(r).value,this.m_curves[1].getKey(r).value,this.m_curves[2].getKey(r).value,this.m_curves[3].getKey(r).value),ne.HELP_2.slerp(ne.HELP_0,ne.HELP_1,o),this._cacheValue.x=ne.HELP_2.x,this._cacheValue.y=ne.HELP_2.y,this._cacheValue.z=ne.HELP_2.z,this._cacheValue.w=ne.HELP_2.w;break}return this._cacheValue}getKeyCount(){return this.m_curves[0].getKeyCount()}getKey(e){let t=[];for(let a=0;a<this.k;a++)t.push(this.m_curves[a].getKey(e));return t}formBytes(e){this.path=e.readUTF(),this.k=e.readInt32(),this.check(),this.attribute=e.readUTF(),this.propertys=this.attribute.split("."),this.preInfinity=e.readInt32(),this.postInfinity=e.readInt32(),this.rotationOrder=e.readInt32();let t=e.readInt32();for(let a=0;a<t;a++){let r=new as(0);r.formBytes(e),this.addKeyFrame(r)}}}class Ym extends Map{negtive;constructor(e){if(super(e),this.negtive=new Map,e)for(let t of e)this.negtive.set(t[1],t[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.negtive.delete(t),super.delete(e)}return!1}getKey(e){return this.negtive.get(e)}deleteValue(e){let t=this.negtive.get(e);return t&&this.delete(t),this.negtive.delete(e)}set(e,t){return super.set(e,t),this.negtive.set(t,e),this}clear(){this.negtive.clear(),super.clear()}}class Xm{colorArray;constructor(e){this.colorArray=e}getColor(e){let t=e*this.colorArray.length,a=Math.floor(t),r=Math.min(a+1,this.colorArray.length-1),i=this.colorArray[a],s=this.colorArray[r];return Z.lerp(t-a,i,s)}}class Zs{controlVertices;constructor(e){this.setControlVertices(e)}setControlVertices(e){e.length==4&&(this.controlVertices=e.concat())}getPoint(e){if(!(e>=0&&e<=1))return g.ZERO;let t=1-e,a=t*t*t,r=3*e*t*t,i=3*e*e*t,s=e*e*e;return this.controlVertices[0].mul(a).add(this.controlVertices[1].mul(r)).add(this.controlVertices[2].mul(i)).add(this.controlVertices[3].mul(s))}getTangent(e){if(!(e>=0&&e<=1))return g.ZERO;let t=this.controlVertices,a=t[0].add(t[1].add(t[0]).mul(e)),r=t[1].add(t[2].add(t[1]).mul(e)),i=t[2].add(t[3].add(t[2]).mul(e)),s=a.add(r.subtract(a).mul(e));return r.add(i.subtract(r).mul(e)).subtract(s)}getClosestParam(e,t=1e-6){return this.getClosestParamRec(e,0,1,t)}getClosestParamRec(e,t,a,r){let i=(t+a)/2;if(a-t<r)return i;let s=(t+i)/2,o=(i+a)/2,l=this.getPoint(s),c=this.getPoint(o),f=l.subtract(e).lengthSquared,h=c.subtract(e).lengthSquared;return f<h?a=i:t=i,this.getClosestParamRec(e,t,a,r)}}var jh=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(jh||{});class Hm{type=0;numCurveSegments=0;numControlVertices=0;controlVertices=[];constructor(e,t=0){this.setControlVertices(e,t)}getPathType(){return this.type}isClosed(){return this.type==1}isValid(){return this.numCurveSegments>0}clear(){this.controlVertices.length=0,this.type=0,this.numCurveSegments=0,this.numControlVertices=0}computeApproxLength(){if(!this.isValid())return 0;let e=this.numCurveSegments+1;if(e<2)return 0;let t=0,a=this.controlVertices;for(let r=1;r<e;r++){let i=a[(r-1)*3],s=a[r*3];t+=i.subtract(s).lengthSquared}return t==0?0:t}computeApproxParamPerUnitLength(){let e=this.computeApproxLength();return this.numCurveSegments/e}computeApproxNormParamPerUnitLength(){return 1/this.computeApproxLength()}interpolatePoints(e,t){let a=e.length;a<2&&console.error("point count must great 1"),this.clear(),this.type=t;let r=this.controlVertices;switch(t){case 0:{this.numCurveSegments=a-1,this.numControlVertices=3*a-2,r.length=this.numControlVertices;for(let o=0;o<a;o++)r[o*3]=e[o];let i=e[1].subtract(e[0]).mul(.25);r[1]=e[0].add(i);let s=e[a-2].subtract(e[a-1]).mul(.25);r[this.numControlVertices-2]=e[a-1].add(s);for(let o=1;o<this.numCurveSegments;o++){let l=e[o-1].subtract(e[o]),c=e[o+1].subtract(e[o]),f=l.lengthSquared,h=c.lengthSquared;if(f>0&&h>0){let u=(f+h)/8,b=c.div(h).subtract(l.div(f));b.normalize(),b=b.mul(u),r[o*3-1]=e[o].subtract(b),r[o*3+1]=e[o].add(b)}else r[o*3-1]=e[o],r[o*3+1]=e[o]}break}case 1:{this.numCurveSegments=a,this.numControlVertices=3*a+1,r.length=this.numControlVertices;for(let i=0;i<a;i++)r[i*3]=e[i];r[this.numControlVertices-1]=e[0];for(let i=1;i<=this.numCurveSegments;i++){let s=i-1,o=(i+1)%this.numCurveSegments,l=i%this.numCurveSegments,c=e[s].subtract(e[l]),f=e[o].subtract(e[l]),h=c.lengthSquared,u=f.lengthSquared,b=3*i-1,A=(3*i+1)%(this.numControlVertices-1);if(h>0&&u>0){let m=(h+u)/8,p=f.div(u).subtract(c.div(h));p.normalize(),p=p.mul(m),r[b]=e[l].subtract(p),r[A]=e[l].add(p)}else r[b]=e[l],r[A]=e[l]}break}}}setControlVertices(e,t){let a=e.length;a<=0||t==0&&a<4||t==1&&a<7||(a-1)%3==0&&(this.clear(),this.type=t,this.numControlVertices=a,this.numCurveSegments=(a-1)/3,this.controlVertices=e)}getPoint(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Ot.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=[],r=this.controlVertices;return a[0]=r[3*t+0],a[1]=r[3*t+1],a[2]=r[3*t+2],a[3]=r[3*t+3],new Zs(a).getPoint(e-t)}getPointNorm(e){return this.getPoint(e*this.numCurveSegments)}getTangent(e){if(this.type==1){for(;e<0;)e+=this.numCurveSegments;for(;e>this.numCurveSegments;)e-=this.numCurveSegments}else e=Ot.clampf(e,0,this.numCurveSegments);if(!(e>=0)&&e<=this.numCurveSegments)return;let t=Math.floor(e);t>=this.numCurveSegments&&(t=this.numCurveSegments-1);let a=this.controlVertices,r=[];return r[0]=a[3*t+0],r[1]=a[3*t+1],r[2]=a[3*t+2],r[3]=a[3*t+3],new Zs(r).getTangent(e-t)}getTangentNorm(e){return this.getTangent(e*this.numCurveSegments)}computeClosestParam(e,t){let a=Number.MAX_SAFE_INTEGER,r=0,i=[],s=new Zs(i);for(let o=0;o<this.controlVertices.length-1;o+=3){for(let h=0;h<4;h++)i[h]=this.controlVertices[o+h];s.setControlVertices(i);let l=s.getClosestParam(e,t),f=s.getPoint(l).subtract(e).lengthSquared;f<a&&(a=f,r=o/3+l)}return r}computeClosestNormParam(e,t){return this.computeClosestParam(e,t*this.numCurveSegments)}}class Km extends Map{valueList;keyList;isChange=!0;constructor(e,t,a){if(super(e),t&&(this.keyList=[]),a&&(this.valueList=[]),e)for(let r of e)this.valueList?.push(r[1]),this.keyList?.push(r[0])}delete(e){if(this.has(e)){let t=this.get(e);return this.valueList&&this.deleteValue(t),this.keyList&&this.deleteKey(e),this.isChange=!0,super.delete(e)}return!1}deleteValue(e){let t=this.valueList.indexOf(e);return t>=0&&this.valueList.splice(t,1),this}deleteKey(e){let t=this.keyList.indexOf(e);return t>=0&&this.keyList.splice(t,1),this}set(e,t){return this.delete(e),this.keyList?.push(e),this.valueList?.push(t),super.set(e,t),this.isChange=!0,this}clear(){this.valueList&&(this.valueList.length=0),this.keyList&&(this.keyList.length=0),this.isChange=!0,super.clear()}}var Zh=(n=>(n[n.kParticleSystemClampVelocityCurveId=322376503]="kParticleSystemClampVelocityCurveId",n[n.kParticleSystemForceCurveId=306581307]="kParticleSystemForceCurveId",n[n.kParticleSystemRotationCurveId=1793934638]="kParticleSystemRotationCurveId",n[n.kParticleSystemRotationBySpeedCurveId=3737431713]="kParticleSystemRotationBySpeedCurveId",n[n.kParticleSystemStartSpeedCurveId=2527743459]="kParticleSystemStartSpeedCurveId",n[n.kParticleSystemSizeCurveId=2368504881]="kParticleSystemSizeCurveId",n[n.kParticleSystemSizeBySpeedCurveId=4085612399]="kParticleSystemSizeBySpeedCurveId",n[n.kParticleSystemVelocityCurveId=3774601268]="kParticleSystemVelocityCurveId",n[n.kParticleSystemUVCurveId=326370691]="kParticleSystemUVCurveId",n[n.kParticleSystemColorGradientId=1494990940]="kParticleSystemColorGradientId",n[n.kParticleSystemColorByVelocityGradientId=1089181156]="kParticleSystemColorByVelocityGradientId",n[n.kParticleSystemMeshSelectionId=3159510623]="kParticleSystemMeshSelectionId",n[n.kParticleSystemUVRowSelectionId=2941263940]="kParticleSystemUVRowSelectionId",n))(Zh||{});const qm=3.141592653589793;class $m{}function Yh(n,e,t){let a=.3333333333333333,r=.5,i=n*a,s=i*i,l=s*i-i*e*r+t*r,c=-s+e*a,f=c*c*c,h=f+l*l;if(h>=0){let A=Math.sqrt(h)-l;return A=A>0?Math.pow(A,a):-Math.pow(-A,a),-i-c/A+A}let u=Math.sqrt(-f),b=Math.acos(-l/u);return u=Math.pow(u,a),u=u-c/u,b=-i+u*Math.cos(b*a),b}function Ys(n,e,t,a){let r=1e-5;if(Math.abs(n)<r)return Math.abs(e)>r?(a.r0=-t/e,1):0;let i=e*e-4*n*t;if(i<0)return 0;let s=.5/n,o=Math.sqrt(i);return a.r0=(o-e)*s,a.r1=(-o-e)*s,2}function Xh(n,e,t,a,r){let i=0;if(Math.abs(e)>=1e-4){let s=t/e,o=a/e,l=r/e;n[0]=Yh(s,o,l),i++;let c=e,f=t+e*n[0],h=a+t*n[0]+e*n[0]*n[0];i+=Ys(c,f,h,{r0:n[1],r1:n[2]})}else i+=Ys(t,a,r,{r0:n[1],r1:n[2]});return i}class La{coeff=[];static EvalSegment(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}}class rr{static kMaxNumSegments=8;segments=[];integrationCache=[];doubleIntegrationCache=[];times=[];segmentCount;constructor(){this.segments[rr.kMaxNumSegments]=new La,this.integrationCache[rr.kMaxNumSegments]=0,this.doubleIntegrationCache[rr.kMaxNumSegments]=0,this.times[rr.kMaxNumSegments]=0}calculateMinMax(e,t){e.x=Math.min(e.x,t),e.y=Math.max(e.y,t)}findMinMaxDoubleIntegrated(){let e=fe.ZERO.clone(),t=20,a=1/t,r=a;for(let i=0;i<t;i++)this.calculateMinMax(e,this.evaluateDoubleIntegrated(r)),r+=a;return e}findMinMaxIntegrated(){let e=fe.ZERO.clone(),t=[],a=[];for(let r=0;r<this.segmentCount;r++){let i=4*this.segments[r].coeff[0],s=3*this.segments[r].coeff[1],o=2*this.segments[r].coeff[2],l=1*this.segments[r].coeff[3],c=[],f=Xh(c,i,s,o,l);for(let h=0;h<f;h++){let u=c[h]+t[r];u>=t[r]&&u<a[r]&&this.calculateMinMax(e,this.evaluateIntegrated(u))}this.calculateMinMax(e,this.evaluateIntegrated(a[r])),this.times[r]}return e}generateIntegrationCache(e){e.integrationCache[0]=0;let t=e.times[0],a=0;for(let r=1;r<e.segmentCount;r++){let i=e.segments[r-1].coeff;Yo(i);let s=t-a;e.integrationCache[r]=e.integrationCache[r-1]+La.EvalSegment(s,i)*s,a=t,t=e.times[r]}}generateDoubleIntegrationCache(e){let t=0,a=0;for(let r=0;r<e.segmentCount;r++){e.doubleIntegrationCache[r]=t;let i=e.times[r]-a;i=Math.max(i,0),t+=La.EvalSegment(i,e.segments[r].coeff)*i*i+e.integrationCache[r]*i,a=e.times[r]}}integrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)Yo(this.segments[e].coeff)}doubleIntegrate(){this.generateIntegrationCache(this);for(let e=0;e<this.segmentCount;e++)Hh(this.segments[e].coeff);this.generateDoubleIntegrationCache(this)}static isValidCurve(e){let t=e.getKeyCount(),a=t-1;return e.getKey(0).time!=0&&a++,e.getKey(t-1).time!=1&&a++,a<=rr.kMaxNumSegments}evaluateDoubleIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.doubleIntegrationCache[a]+this.integrationCache[a]*r+La.EvalSegment(r,this.segments[a].coeff)*r*r}t=this.times[a]}return 1}evaluateIntegrated(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a]){let r=e-t;return this.integrationCache[a]+La.EvalSegment(r,this.segments[a].coeff)*r}t=this.times[a]}return 1}evaluate(e){let t=0;for(let a=0;a<this.segmentCount;a++){if(e<=this.times[a])return La.EvalSegment(e-t,this.segments[a].coeff);t=this.times[a]}return 1}buildCurve(e,t){let a=e.getKeyCount();this.segmentCount=1;let r=1.01;if(this.segments.length=0,this.integrationCache.length=0,this.doubleIntegrationCache.length=0,this.times.length=0,this.times[0]=r,a!=0)if(a==1)this.segments[0]=new La,this.segments[0].coeff[3]=e.getKey(0).value*t;else{this.segmentCount=a-1;let i=0;e.getKey(0).time!=0&&(this.segments[0].coeff[3]=e.getKey(0).value,this.times[0]=e.getKey(0).time,i=1);for(let s=0;s<this.segmentCount;s++){let o;e.calculateCacheData(o,s,s+1,0),this.segments[s+i].coeff=o.coeff.concat(),this.times[s+i]=e.getKey(s+1).time}this.segmentCount+=i,e.getKey(a-1).time!=1&&(this.segments[this.segmentCount].coeff[3]=e.getKey(a-1).value,this.segmentCount++),this.times[this.segmentCount-1]=r;for(let s=0;s<this.segmentCount;s++)this.segments[s].coeff[0]*=t,this.segments[s].coeff[1]*=t,this.segments[s].coeff[2]*=t,this.segments[s].coeff[3]*=t}return!0}}function Hh(n){n[0]/=20,n[1]/=12,n[2]/=6,n[3]/=2}function Yo(n){n[0]/=4,n[1]/=3,n[2]/=2,n[3]/=1}var Kh=(n=>(n[n.kEMScalar=0]="kEMScalar",n[n.kEMOptimized=1]="kEMOptimized",n[n.kEMOptimizedMinMax=2]="kEMOptimizedMinMax",n[n.kEMSlow=3]="kEMSlow",n))(Kh||{}),qh=(n=>(n[n.kMMCScalar=0]="kMMCScalar",n[n.kMMCCurve=1]="kMMCCurve",n[n.kMMCTwoCurves=2]="kMMCTwoCurves",n[n.kMMCTwoConstants=3]="kMMCTwoConstants",n))(qh||{});class ep{max;min}class tp{max;min;integrate(){this.max.integrate(),this.min.integrate()}doubleIntegrate(){this.max.doubleIntegrate(),this.min.doubleIntegrate()}findMinMaxIntegrated(){return null}findMinMaxDoubleIntegrated(){return null}}class $h{minMaxState;minCurve;maxCurve;_scalar=1;_minScalar;constructor(e=1){this._scalar=e,this.minMaxState=0,this.minCurve=new Vi,this.maxCurve=new Vi}setScalar(e){this._scalar=e}getScalar(){return this._scalar}static evaluateSlow(e,t,a){let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==2?xr(e.minCurve.getValue(t)*e.getScalar(),r,a):r}static evaluate(e,t,a=1){if(e.minMaxState==0)return e.getScalar();let r=e.maxCurve.getValue(t)*e.getScalar();return e.minMaxState==1?xr(e.minCurve.getValue(t)*e.getScalar(),r,a):e.minMaxState==3?xr(e._minScalar,e._scalar,a):e.minMaxState==2?xr(e.minCurve.getValue(t)*e.getScalar(),r,1*Math.random()):this.evaluateSlow(e,t,1)}unSerialized(e){this.minMaxState=e.minMaxState,this._scalar=e.scalar,this._minScalar=e.minScalar,this.maxCurve.unSerialized(e.maxCurve),this.minCurve.unSerialized(e.minCurve)}}class ap{value=0;mode=0;spread=0;speed=new $h;unSerialized(e){this.value=e.value,this.mode=e.mode,this.spread=e.spread,this.speed.unSerialized(e.speed)}}function rp(n,e){let t=rr.isValidCurve(n.max);return e!=2&&e!=3?t:t&&rr.isValidCurve(n.min)}function ip(n,e,t,a){n.max.buildCurve(e.max,t),a!=2&&a!=3?n.min.buildCurve(e.max,t):n.min.buildCurve(e.min,t)}function sp(n,e){let t=e.getKeyCount();if(t!=0)if(t==1)es(n,e.getKey(0).value);else{let a=t-1;es(n,e.getKey(0).value);for(let r=0;r<a;r++){let i=new Ao;e.calculateCacheData(i,r,r+1,0);let s=3*i.coeff[0],o=2*i.coeff[1],l=1*i.coeff[2],c=e.getKey(r).time,f=e.getKey(r+1).time,h=[],u=Ys(s,o,l,{r0:h[0],r1:h[1]});for(let b=0;b<u;b++)h[b]>=0&&h[b]+c<f&&es(n,La.EvalSegment(h[b],i.coeff));es(n,La.EvalSegment(f-c,i.coeff))}}}function es(n,e){n.x=Math.min(n.x,e),n.y=Math.max(n.y,e)}class Or{static BACK=0;static FRONT=1;static IN=0;static OUT=1;static INTERSECT=2}class eu{a;b;c;d;static ALIGN_ANY=0;static ALIGN_XY_AXIS=1;static ALIGN_YZ_AXIS=2;static ALIGN_XZ_AXIS=3;constructor(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}setTo(e=0,t=0,a=0,r=0){this.a=e,this.b=t,this.c=a,this.d=r}fromPoints(e,t,a){var r=t.x-e.x,i=t.y-e.y,s=t.z-e.z,o=a.x-e.x,l=a.y-e.y,c=a.z-e.z;this.a=i*c-s*l,this.b=s*o-r*c,this.c=r*l-i*o,this.d=-(this.a*e.x+this.b*e.y+this.c*e.z)}fromNormalAndPoint(e,t){this.a=e.x,this.b=e.y,this.c=e.z,this.d=-(this.a*t.x+this.b*t.y+this.c*t.z)}normalize(){var e=Math.sqrt(this.a*this.a+this.b*this.b+this.c*this.c);if(e>0){var t=1/e;this.a*=t,this.b*=t,this.c*=t,this.d*=t}return e}distance(e){return this.a*e.x+this.b*e.y+this.c*e.z+this.d}classifyPoint(e,t=.01){var a=this.distance(e);return a<-t?Or.BACK:a>t?Or.FRONT:Or.INTERSECT}toString(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"}}function np(n,e){return Math.random()*e+Math.random()*n+(e-n)*Math.random()}function op(n,e,t){let a=t*Math.random();return Math.random()*e*a+Math.random()*n*a+(e-n)*Math.random()*a}function tu(n,e,t){let a=0,r=0;for(;a===0;)a=Math.random();for(;r===0;)r=Math.random();let i=Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*r);return i=i/10+.5,(i>1||i<0)&&(i=tu(n,e,t)),i=Math.pow(i,t),i*=e-n,i+=n,i}function xa(n){return n>0?Math.floor(n):Math.floor(n)-1}let Ue=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];function Xo(n,e){let t=n&15,a=1+(t&7);return t&8&&(a=-a),a*e}function Xs(n,e,t){let a=n&7,r=a<4?e:t,i=a<4?t:e;return(a&1?-r:r)+(a&2?-2*i:2*i)}function ts(n,e,t,a){let r=n&15,i=r<8?e:t,s=r<4?t:r==12||r==14?e:a;return(r&1?-i:i)+(r&2?-s:s)}function ui(n,e,t,a,r){let i=n&31,s=i<24?e:t,o=i<16?t:a,l=i<8?a:r;return(i&1?-s:s)+(i&2?-o:o)+(i&4?-l:l)}let ta=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]];function lp(n){let e=xa(n),t=e+1,a=n-e,r=a-1,i,s,o=1-a*a;o*=o,i=o*o*Xo(Ue[e&255],a);let l=1-r*r;return l*=l,s=l*l*Xo(Ue[t&255],r),.25*(i+s)}function cp(n,e){const t=.366025403,a=.211324865;let r,i,s,o=(n+e)*t,l=n+o,c=e+o,f=xa(l),h=xa(c),u=(f+h)*a,b=f-u,A=h-u,m=n-b,p=e-A,D,_;m>p?(D=1,_=0):(D=0,_=1);let v=m-D+a,U=p-_+a,y=m-1+2*a,S=p-1+2*a,F=f&255,k=h&255,x=.5-m*m-p*p;x<0?r=0:(x*=x,r=x*x*Xs(Ue[F+Ue[k]],m,p));let w=.5-v*v-U*U;w<0?i=0:(w*=w,i=w*w*Xs(Ue[F+D+Ue[k+_]],v,U));let R=.5-y*y-S*S;return R<0?s=0:(R*=R,s=R*R*Xs(Ue[F+1+Ue[k+1]],y,S)),40*(r+i+s)}function fp(n,e,t){const a=.333333333,r=.166666667;let i,s,o,l,c=(n+e+t)*a,f=n+c,h=e+c,u=t+c,b=xa(f),A=xa(h),m=xa(u),p=(b+A+m)*r,D=b-p,_=A-p,v=m-p,U=n-D,y=e-_,S=t-v,F,k,x,w,R,Q;U>=y?y>=S?(F=1,k=0,x=0,w=1,R=1,Q=0):U>=S?(F=1,k=0,x=0,w=1,R=0,Q=1):(F=0,k=0,x=1,w=1,R=0,Q=1):y<S?(F=0,k=0,x=1,w=0,R=1,Q=1):U<S?(F=0,k=1,x=0,w=0,R=1,Q=1):(F=0,k=1,x=0,w=1,R=1,Q=0);let M=U-F+r,j=y-k+r,he=S-x+r,ae=U-w+2*r,P=y-R+2*r,z=S-Q+2*r,W=U-1+3*r,V=y-1+3*r,te=S-1+3*r,J=b&255,K=A&255,ee=m&255,re=.6-U*U-y*y-S*S;re<0?i=0:(re*=re,i=re*re*ts(Ue[J+Ue[K+Ue[ee]]],U,y,S));let oe=.6-M*M-j*j-he*he;oe<0?s=0:(oe*=oe,s=oe*oe*ts(Ue[J+F+Ue[K+k+Ue[ee+x]]],M,j,he));let pe=.6-ae*ae-P*P-z*z;pe<0?o=0:(pe*=pe,o=pe*pe*ts(Ue[J+w+Ue[K+R+Ue[ee+Q]]],ae,P,z));let Te=.6-W*W-V*V-te*te;return Te<0?l=0:(Te*=Te,l=Te*Te*ts(Ue[J+1+Ue[K+1+Ue[ee+1]]],W,V,te)),32*(i+s+o+l)}function dp(n,e,t,a){const r=.309016994,i=.138196601;let s,o,l,c,f,h=(n+e+t+a)*r,u=n+h,b=e+h,A=t+h,m=a+h,p=xa(u),D=xa(b),_=xa(A),v=xa(m),U=(p+D+_+v)*i,y=p-U,S=D-U,F=_-U,k=v-U,x=n-y,w=e-S,R=t-F,Q=a-k,M=x>w?32:0,j=x>R?16:0,he=w>R?8:0,ae=x>Q?4:0,P=w>Q?2:0,z=R>Q?1:0,W=M+j+he+ae+P+z,V,te,J,K,ee,re,oe,pe,Te,Oe,q,ie;V=ta[W][0]>=3?1:0,te=ta[W][1]>=3?1:0,J=ta[W][2]>=3?1:0,K=ta[W][3]>=3?1:0,ee=ta[W][0]>=2?1:0,re=ta[W][1]>=2?1:0,oe=ta[W][2]>=2?1:0,pe=ta[W][3]>=2?1:0,Te=ta[W][0]>=1?1:0,Oe=ta[W][1]>=1?1:0,q=ta[W][2]>=1?1:0,ie=ta[W][3]>=1?1:0;let ce=x-V+i,ge=w-te+i,we=R-J+i,me=Q-K+i,ye=x-ee+2*i,Qe=w-re+2*i,Re=R-oe+2*i,Le=Q-pe+2*i,Ut=x-Te+3*i,je=w-Oe+3*i,sr=R-q+3*i,Ea=Q-ie+3*i,za=x-1+4*i,Wa=w-1+4*i,aa=R-1+4*i,Ja=Q-1+4*i,ua=p&255,Pt=D&255,wa=_&255,ba=v&255,Lr=.6-x*x-w*w-R*R-Q*Q;Lr<0?s=0:(Lr*=Lr,s=Lr*Lr*ui(Ue[ua+Ue[Pt+Ue[wa+Ue[ba]]]],x,w,R,Q));let Gr=.6-ce*ce-ge*ge-we*we-me*me;Gr<0?o=0:(Gr*=Gr,o=Gr*Gr*ui(Ue[ua+V+Ue[Pt+te+Ue[wa+J+Ue[ba+K]]]],ce,ge,we,me));let zr=.6-ye*ye-Qe*Qe-Re*Re-Le*Le;zr<0?l=0:(zr*=zr,l=zr*zr*ui(Ue[ua+ee+Ue[Pt+re+Ue[wa+oe+Ue[ba+pe]]]],ye,Qe,Re,Le));let Wr=.6-Ut*Ut-je*je-sr*sr-Ea*Ea;Wr<0?c=0:(Wr*=Wr,c=Wr*Wr*ui(Ue[ua+Te+Ue[Pt+Oe+Ue[wa+q+Ue[ba+ie]]]],Ut,je,sr,Ea));let Jr=.6-za*za-Wa*Wa-aa*aa-Ja*Ja;return Jr<0?f=0:(Jr*=Jr,f=Jr*Jr*ui(Ue[ua+1+Ue[Pt+1+Ue[wa+1+Ue[ba+1]]]],za,Wa,aa,Ja)),27*(s+o+l+c+f)}class Ho extends fe{static uv_0=new Ho;u=0;v=0;constructor(e=0,t=0){super(e,t),this.u=e,this.v=t}length(){return 0}static getUVSheet(e,t,a){let r=Math.floor(e%(t*a)),i=Math.floor(r/t),s=r%t;return new ue(i/t,s/a,1/t,1/a)}}class as{serializedVersion="2";time;tangentMode=0;weightedMode=0;propertyKeyFrame;constructor(e=0){this.time=e,this.propertyKeyFrame={}}getK(e){return this.propertyKeyFrame[e]}split(e,t,a){switch(e){case H.single:{let r=this.getKeyFrame(0);r[a]=t}break;case H.float:{let r=this.getKeyFrame(0);r[a]=t}break;case H.vector2:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y}break;case H.vector3:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z}break;case H.vector4:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break;case H.quaternion:{let r=t,i=this.getKeyFrame(0);i[a]=r.x;let s=this.getKeyFrame(1);s[a]=r.y;let o=this.getKeyFrame(2);o[a]=r.z;let l=this.getKeyFrame(3);l[a]=r.w}break}}getKeyFrame(e){let t=this.propertyKeyFrame[e];return t||(t=new Rs,t.time=this.time,t.tangentMode=this.tangentMode,t.weightedMode=this.weightedMode,this.propertyKeyFrame[e]=t),t}formBytes(e){this.time=e.readFloat32();{let{t,v:a}=Va.parser(e);this.split(t,a,"value")}{let{t,v:a}=Va.parser(e);this.split(t,a,"inSlope")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outSlope")}this.tangentMode=e.readInt32(),this.weightedMode=e.readInt32();{let{t,v:a}=Va.parser(e);this.split(t,a,"inWeight")}{let{t,v:a}=Va.parser(e);this.split(t,a,"outWeight")}}}class hp{static sub(e,t){switch(e.constructor.name){case"number":return e-t;case"Vector2":{let r=e,i=t;return new fe(r.x-i.x,r.y-i.y)}case"Vector3":{let r=e,i=t;return new g(r.x-i.x,r.y-i.y,r.z-i.z)}case"Vector4":{let r=e,i=t;return new ue(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}case"Quaternion":{let r=e,i=t;return new ne(r.x-i.x,r.y-i.y,r.z-i.z,r.w-i.w)}}}}class rs{_keys=new Array;_values=new Array;getIndexByKey(e){return this._keys.indexOf(e)}getValueByKey(e){var t=this.getIndexByKey(e);return t>-1?this._values[t]:null}put(e,t){if(e==null)return null;var a=this.remove(e);return this._keys.push(e),this._values.push(t),a}remove(e){var t=this._keys.indexOf(e),a;return t>-1&&(a=this._values[t],this._keys.splice(t,1),this._values.splice(t,1)),a}getValues(){return this._values}getKeys(){return this._keys}clear(){this._values.length=0,this._keys.length=0}}class Sr{static WalkAble=1}class is{static SetConst(e){this.EPSILON=e,this.POWER_EPSILON=e*e}static EPSILON=.1;static POWER_EPSILON=this.EPSILON*this.EPSILON}class Mt extends g{static CALC_VECTOR3D1=new g;static CALC_VECTOR3D2=new g;static CALC_VECTOR3D3=new g;static CALC_VECTOR3D4=new g;static CALC_VECTOR3D5=new g;_pointId=0;constructor(e,t,a,r){super(t,a,r,0),this._pointId=e}get id(){return this._pointId}static equalPoint(e,t){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)+(e.z-t.z)*(e.z-t.z)<is.POWER_EPSILON}static calcDistance(e,t){return Mt.CALC_VECTOR3D3.setTo(e.x-t.x,e.y-t.y,e.z-t.z),Mt.CALC_VECTOR3D3.length}}class au{_openedList;_closedList;_endNode;_startNode;_triangleChannel;_navMesh;_findIndex=0;constructor(){this._openedList=new Array,this._closedList=new Array}findPath(e,t,a){return this._findIndex++,this._navMesh=e,this._startNode=t,this._endNode=a,this._openedList.length=0,this._closedList.length=0,this._startNode&&this._endNode?(this._startNode.gg=0,this._startNode.h=0,this._startNode.f=0,this._startNode.parent=null,this.search()):!1}search(){for(var e=this._startNode,t=[],a;e!=this._endNode;){t=e.getNeibourTriangles(t,Sr.WalkAble,Sr.WalkAble);for(a of t)if(a.closeId!=this._findIndex&&!(a==e||!a.walkAble)){var r=e.gg+Mt.calcDistance(a,e)*a.costMultiplier,i=Mt.calcDistance(a,this._endNode),s=r+i;a.openId==this._findIndex?a.f>s&&(a.f=s,a.gg=r,a.h=i,a.parent=e):(a.f=s,a.gg=r,a.h=i,a.parent=e,a.openId=this._findIndex,this._openedList.push(a))}if(e.closeId=this._findIndex,this._closedList.push(e),this._openedList.length==0)return!1;this._openedList.sort(function(o,l){return o.f-l.f}),e=this._openedList.shift()}return this.buildPath(),!0}buildPath(){this._triangleChannel=[];var e=this._endNode;for(this._triangleChannel.push(e);e!=this._startNode;)e=e.parent,this._triangleChannel.unshift(e)}get channel(){return this._triangleChannel}}class Fa extends Mt{_ownerPoint;_ownerEdge;radius=0;constructor(e,t){super(e.id,0,0,0),this._ownerEdge=t,this._ownerPoint=e}get ownerPoint(){return this._ownerPoint}get ownerEdge(){return this._ownerEdge}scalePoint(e=.7){var t=new Fa(this._ownerPoint,this._ownerEdge);return t.copyFrom(this),t.decrementBy(this._ownerPoint),t.scaleBy(e),t.radius=t.length,t.incrementBy(this._ownerPoint),t}}class ka{_edgeMask=0;_edgeSize=0;_pointA;_pointB;_triangleOwners;_centerPoint;_edgeDirA2B;crossPoint;fatPointA;fatPointB;static CALC_FAT_VECTOR=new g;constructor(e,t){if(this._pointA=e,this._pointB=t,e.id>=t.id)throw new Error("edge point order error!!!");this._triangleOwners=new Array,this._centerPoint=new g,this._edgeMask=Sr.WalkAble,Mt.CALC_VECTOR3D1.setTo(e.x-t.x,e.y-t.y,e.z-t.z),this._edgeSize=Mt.CALC_VECTOR3D1.length,this._centerPoint.setTo((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2)}get size(){return this._edgeSize}get triangleOwners(){return this._triangleOwners}get centerPoint(){return this._centerPoint}initFatPoints(e){this._edgeDirA2B=this._pointB.subtract(this._pointA),this._edgeDirA2B.normalize(),this.fatPointA=this.fatPointA||new Fa(this._pointA,this),this.fatPointB=this.fatPointB||new Fa(this._pointB,this),this.fatPointA.radius!=e&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(e),ka.CALC_FAT_VECTOR.incrementBy(this._pointA),this.fatPointA.copyFrom(ka.CALC_FAT_VECTOR),this.fatPointA.radius=e),this.fatPointB.radius!=e&&(ka.CALC_FAT_VECTOR.copyFrom(this._edgeDirA2B),ka.CALC_FAT_VECTOR.scaleBy(-e),ka.CALC_FAT_VECTOR.incrementBy(this._pointB),this.fatPointB.copyFrom(ka.CALC_FAT_VECTOR),this.fatPointB.radius=e)}getFatPoint(e){return e==this._pointA?this.fatPointA:this.fatPointB}getAnotherFatPoint(e){return e==this._pointA?this.fatPointB:this.fatPointA}getAnotherPoint(e){return e==this._pointA?this._pointB:this._pointA}containsPoint(e){return Mt.equalPoint(e,this._pointA)?this._pointA:Mt.equalPoint(e,this._pointB)?this._pointB:null}addTriangleOwners(e){if(e.edges.indexOf(this)==-1)throw new Error("the edge is not belong triangle!!!");this._triangleOwners.indexOf(e)==-1&&this._triangleOwners.push(e)}getPublicPoint(e){return this._pointA==e._pointA||this._pointA==e._pointB?this._pointA:this._pointB==e._pointA||this._pointB==e._pointB?this._pointB:null}getEqualPoint(e){return Mt.equalPoint(e,this._pointA)?this._pointA:Mt.equalPoint(e,this._pointB)?this._pointB:null}get pointA(){return this._pointA}get pointB(){return this._pointB}get walkAble(){return(this._edgeMask&Sr.WalkAble)==Sr.WalkAble}testMask(e){return(this._edgeMask&e)==e}}class De{endPoint;curPoint;rayA;rayB;rayAPoint;rayBPoint;static RAY_1=new g;static RAY_2=new g;static TEST_RAY=new g;static TEST_RAY_1=new g;static TEST_RAY_2=new g;static CALC_CROSS_POINT=new g;static CALC_CROSS_TEST=new g;cornerPoint;cornerEdge;continuePass(e,t,a){this.resetData(),this.curPoint=e,this.endPoint=t,this.cornerEdge=a}passEdge(e,t,a,r){if((this.rayA==null||this.rayB==null)&&(this.rayA=De.RAY_1,this.rayB=De.RAY_2,this.rayAPoint=e.pointA,this.rayBPoint=e.pointB,this.rayA.setTo(this.rayAPoint.x-this.curPoint.x,0,this.rayAPoint.z-this.curPoint.z),this.rayB.setTo(this.rayBPoint.x-this.curPoint.x,0,this.rayBPoint.z-this.curPoint.z)),r)return this.checkEndPoint(a);if(De.TEST_RAY.setTo(a.x-this.curPoint.x,0,a.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)){this.hasCrossPoint(t.pointA,t.pointB,this.rayAPoint,this.rayA)?(this.rayB.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayBPoint=a:this.rayBPoint=null):(this.rayA.copyFrom(De.TEST_RAY),a instanceof Mt?this.rayAPoint=a:this.rayAPoint=null);var i=t.getAnotherPoint(a);De.TEST_RAY.setTo(i.x-this.curPoint.x,0,i.z-this.curPoint.z),(i==this.rayAPoint||i==this.rayBPoint||this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB))&&(this.cornerEdge=t)}else{var s;if(De.TEST_RAY_1.copyFrom(t.pointA),De.TEST_RAY_1.decrementBy(this.curPoint),De.TEST_RAY_2.copyFrom(t.pointB),De.TEST_RAY_2.decrementBy(this.curPoint),De.TEST_RAY_1.y=0,De.TEST_RAY_2.y=0,this.isPointAtCenter(this.rayA,De.TEST_RAY_1,De.TEST_RAY_2)||this.isPointAtCenter(this.rayB,De.TEST_RAY_1,De.TEST_RAY_2)?s=!1:s=!0,s)return this.isPointAtCenter(this.rayA,De.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1}return!0}checkEndPoint(e){return De.TEST_RAY.setTo(e.x-this.curPoint.x,0,e.z-this.curPoint.z),this.isPointAtCenter(De.TEST_RAY,this.rayA,this.rayB)?!0:(this.isPointAtCenter(this.rayA,De.TEST_RAY,this.rayB)?this.cornerPoint=this.rayAPoint:this.cornerPoint=this.rayBPoint,this.cornerEdge.crossPoint=this.cornerPoint,!1)}calcCrossEdge(e,t,a){return this.calcCrossPoint(e.fatPointA,e.fatPointB,t,a)}calcCrossPoint(e,t,a,r){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);let i=De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z;var s=0;return i!=0&&(s=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/i),s>1?s=1:s<0&&(s=0),De.CALC_CROSS_POINT.scaleBy(s),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone()}calcCrossPointOut(e,t,a,r){De.CALC_CROSS_POINT.copyFrom(t),De.CALC_CROSS_POINT.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_POINT.x*r.z-r.x*De.CALC_CROSS_POINT.z);return i<=1&&i>=0?null:(De.CALC_CROSS_POINT.scaleBy(i),De.CALC_CROSS_POINT.incrementBy(e),De.CALC_CROSS_POINT.clone())}hasCrossPoint(e,t,a,r){De.CALC_CROSS_TEST.copyFrom(t),De.CALC_CROSS_TEST.decrementBy(e);var i=((e.z-a.z)*r.x-(e.x-a.x)*r.z)/(De.CALC_CROSS_TEST.x*r.z-r.x*De.CALC_CROSS_TEST.z);return i<=1&&i>=0}isPointAtCenter(e,t,a){var r=t.crossProduct(e);if(r.length==0&&e.length<t.length)return!0;var i=a.crossProduct(e);return i.length==0&&e.length<a.length?!0:(r.normalize(),i.normalize(),r.incrementBy(i),r.length<.01)}resetData(){this.cornerEdge=null,this.cornerPoint=null,this.curPoint=null,this.rayA=this.rayB=null,this.rayAPoint=this.rayBPoint=null,De.RAY_1.setTo(0,0,0),De.RAY_2.setTo(0,0,0)}}class ir{_aiRadius=0;_router;_result;_tempPublicEdgeList=new Array;_tempSamePlaneList=new Array;static CROSS_TEST_DIRECTION=new g;constructor(){this._router=new De}searchPath(e,t,a,r=0){return r<=0&&(r=1),this._aiRadius=r*1.5,this.searchEnable(e,t,a)?(this.search(e,t,a),!0):!1}get path(){return this._result}searchEnable(e,t,a){return!(e==null||t==null||a==null||a[0].plane.classifyPoint(e,is.EPSILON)!=Or.INTERSECT||a[a.length-1].plane.classifyPoint(t,is.EPSILON)!=Or.INTERSECT)}search(e,t,a){this._tempPublicEdgeList.length=0,this._tempSamePlaneList.length=0;var r=0,i=a.length-1,s,o,l,c;for(r=0;r<i;r++)o=a[r].getPublicEdge(a[r+1]),o.crossPoint=null,o.initFatPoints(this._aiRadius),this._tempPublicEdgeList.push(o),s=a[r],c=s.plane,s=a[r+1],l=s.getEdgeAgainstPoint(o),this._tempSamePlaneList.push(c.classifyPoint(l,is.EPSILON)==Or.INTERSECT);this._router.continuePass(e,t,this._tempPublicEdgeList[0]),i=this._tempPublicEdgeList.length;var f,h,u,b;for(r=0;r<i;r++)o=this._tempPublicEdgeList[r],s=a[r+1],b=r==i-1,b?l=t:l=s.getEdgeAgainstPoint(o),u=this._router.passEdge(o,this._tempPublicEdgeList[r+1],l,b),u||(f=this._router.cornerPoint,h=this._router.cornerEdge,r=this._tempPublicEdgeList.indexOf(h),this._router.continuePass(f,t,this._tempPublicEdgeList[r+1]));this.pushAllPathPoint2(e,t),this._result.length>=3&&(this.optimusTerminusFat(),this.optimusByRadius());let A=[];for(let m of this._result)A.push(new g().copyFrom(m));this._result=A}optimusTerminusFat(){var e,t,a;a=this._result[1],a instanceof Fa&&(e=a),a=this._result[this._result.length-2],a instanceof Fa&&(t=a),e&&(this._result[1]=e.scalePoint()),t&&e!=t&&(this._result[this._result.length-2]=t.scalePoint())}pushAllPathPoint2(e,t){var a=this._tempPublicEdgeList.length,r,i;this._result=new Array,this._result.push(e);for(var s=e,o,l,c,f=0;f<a;f++)if(r=this._tempPublicEdgeList[f],l=null,r.crossPoint)l=this.getFatPoint(r,r.crossPoint),l?this._result.push(l):this._result.push(r.crossPoint),s=r.crossPoint;else{i=null,o=null;for(var h=f+1;h<a&&(i=this._tempPublicEdgeList[h],o=i.crossPoint,!o);h++);o==null&&(o=t),l=this.getFatPoint(r,o),l?this._result.push(l):(o==s?c=o.clone():(ir.CROSS_TEST_DIRECTION.setTo(o.x-s.x,0,o.z-s.z),c=this._router.calcCrossEdge(r,s,ir.CROSS_TEST_DIRECTION)),this._result.push(c))}this._result.push(t)}optimusByRadius(){var e=new Array;e.length=this._result.length;var t=this._result.length-2,a,r,i,s,o,l,c,f,h,u,b,A,m;for(m=0;m<t;m++)c=f=h=null,s=o=l=null,b=!1,A=null,a=this._result[m],r=this._result[m+1],i=this._result[m+2],a instanceof Fa&&(s=a),r instanceof Fa&&(o=r),i instanceof Fa&&(l=i),s&&(c=s.ownerPoint),o&&(f=o.ownerPoint),l&&(h=l.ownerPoint),c&&f&&c==f&&f!=h&&(b=!0),h&&f&&h==f&&c!=f&&(b=!0),b&&(ir.CROSS_TEST_DIRECTION.copyFrom(a),ir.CROSS_TEST_DIRECTION.decrementBy(i),u=o.ownerEdge,b=this._router.hasCrossPoint(u.pointA,u.pointB,i,ir.CROSS_TEST_DIRECTION),b&&(A=this._router.calcCrossPointOut(f,r,i,ir.CROSS_TEST_DIRECTION)),A&&(e[m+1]=A))}getFatPoint(e,t){if(e==null)return null;var a;t instanceof Fa&&(a=t);var r;return a?r=a.ownerPoint:r=e.getEqualPoint(t),r==null?null:(a=e.getFatPoint(r),a)}}class ru extends g{_id=0;_plane;_points=new Array;_edges=new Array;_neibourTriangles=new rs;_pointAgainstEdge=new rs;_edgeAgainstPoint=new rs;_mask=0;_aabbBox;f=0;gg=0;h=0;parent;costMultiplier=1;openId=0;closeId=0;get aabb(){return this._aabbBox}initAABB(){this._aabbBox=new Qt,this._aabbBox.addPoint(this._points[0]),this._aabbBox.addPoint(this._points[1]),this._aabbBox.addPoint(this._points[2])}calcGlobalQuadAABB(){}get isTriangle(){return!0}constructor(e,t,a,r){super(0,0,0,0),this._id=e,this._mask=Sr.WalkAble,this._edges.push(t,a,r);var i;for(i of this._edges)this._points.indexOf(i.pointA)==-1&&this._points.push(i.pointA),this._points.indexOf(i.pointB)==-1&&this._points.push(i.pointB);this.x=(this._points[0].x+this._points[1].x+this._points[2].x)/3,this.y=(this._points[0].y+this._points[1].y+this._points[2].y)/3,this.z=(this._points[0].z+this._points[1].z+this._points[2].z)/3,this._plane=new eu,this._plane.fromPoints(this._points[0],this._points[1],this._points[2]),this._plane.normalize(),this.genarateAgainstData(),this.initAABB()}genarateAgainstData(){var e,t;for(e of this._edges)for(t of this._points)e.pointA!=t&&e.pointB!=t&&(this._edgeAgainstPoint.put(e,t),this._pointAgainstEdge.put(t,e))}get id(){return this._id}get plane(){return this._plane}get points(){return this._points}addNeibour(e,t){if(this._edges.indexOf(e)>=0)this._neibourTriangles.put(e,t);else throw new Error("the edge is not in triangle!!!")}getNeibourTriangles(e=null,t=1,a=1){e=e||new Array,e.length=0;var r,i,s=this._neibourTriangles.getKeys(),o;for(o of s)i=o,i.testMask(t)&&(r=this._neibourTriangles.getValueByKey(i),r.testMask(a)&&e.push(r));return e}getEdges(e=null,t=1){e=e||new Array,e.length=0;var a;for(a of this._edges)a.testMask(t)&&e.push(a);return e}get walkAble(){return this.testMask(Sr.WalkAble)}get edges(){return this._edges}testMask(e){return(this._mask&e)==e}getEdgeAgainstPoint(e){return this._edgeAgainstPoint.getValueByKey(e)}getPointAgainstEdge(e){return this._pointAgainstEdge.getValueByKey(e)}getPublicEdge(e){if(e&&e!=this){var t=this._neibourTriangles.getKeys(),a;for(a of t)if(this._neibourTriangles.getValueByKey(a)==e)return a}return null}loopPublicEdge(e){var t,a;if(e&&e!=this){for(t of this._edges)for(a of e._edges)if(t==a)return t}return null}randomPoint(){var e=this._points[2].subtract(this._points[0]);e.scaleBy(Math.random()),e.incrementBy(this._points[0]);var t=this._points[1].subtract(e);return t.scaleBy(Math.random()),t.incrementBy(e),t}}class up{_nav3dPoints;_nav3dEdges;_nav3dTriangles;_path;_edgesDict;_nav3dAstar;_nav3dFunnel;_terrainQuad;_triangleList;get edges(){return this._nav3dEdges}get points(){return this._nav3dPoints}get path(){return this._path}get triangles(){return this._nav3dTriangles}constructor(e,t){this._nav3dPoints=new Array,this._nav3dEdges=new Array,this._nav3dTriangles=new Array,this._edgesDict=new rs,this.initPoints(e),this.initEdgesAndTriangles(t),this.createConnections(),this._nav3dAstar=new au,this._nav3dFunnel=new ir,this._terrainQuad=new ch(8,128),this._terrainQuad.createQuadTree(this._nav3dTriangles)}getTriangleAtPoint(e,t=5){return this._terrainQuad.getTriangleAtPoint(e,t)}findPath(e,t,a=5){this._path=null,this._triangleList=null;var r=this.getTriangleAtPoint(e,10),i=this.getTriangleAtPoint(t,10),s=this._nav3dAstar.findPath(this,r,i);return s?(this._triangleList=this._nav3dAstar.channel,s=this._nav3dFunnel.searchPath(e,t,this._triangleList,a),this._path=this._nav3dFunnel.path,s):!1}initPoints(e){for(var t,a,r=e.length,i=0;i<r;i++)t=e[i],a=new Mt(i,t.x,t.y,t.z),this._nav3dPoints.push(a)}initEdgesAndTriangles(e){for(var t,a,r,i,s,o=e.length,l=0;l<o;l++)t=e[l],a=this.tryCreateEdge(t[0],t[1]),r=this.tryCreateEdge(t[1],t[2]),i=this.tryCreateEdge(t[2],t[0]),!(a==null||r==null||i==null)&&(s=new ru(l,a,r,i),this._nav3dTriangles.push(s))}tryCreateEdge(e,t){if(e==t)throw new Error("edge point index error!!!");if(e>t){var a=e;e=t,t=a}var r=this._edgesDict.getValueByKey(e+"_"+t);return r==null&&(r=new ka(this._nav3dPoints[e],this._nav3dPoints[t]),this._nav3dEdges.push(r),this._edgesDict.put(e+"_"+t,r)),r}createConnections(){for(var e=this._nav3dTriangles.length,t=this._nav3dTriangles.length,a,r,i,s,o=0;o<e;o++){a=this._nav3dTriangles[o];for(i of a.edges)i.addTriangleOwners(a);for(var l=0;l<t;l++)r=this._nav3dTriangles[l],a!=r&&(s=a.loopPublicEdge(r),s&&(a.addNeibour(s,r),r.addNeibour(s,a)))}}}class Ko{x;y;setTo(e,t){this.x=e,this.y=t}equals(e,t){return e==this.x&&t==this.y}equalPoint(e){return this.equals(e.x,e.y)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y)}clone(){var e=new Ko;return e.setTo(this.x,this.y),e}normalize(){var e=length;e!=0&&this.setTo(this.x/e,this.y/e)}}class Ga extends Ve{width;height;depth;constructor(e=1,t=1,a=1){super(),this.width=e,this.height=t,this.depth=a,this.initVertex()}initVertex(){let e=this.width/2,t=this.height/2,a=this.depth/2;this.bounds=new Ce(g.ZERO.clone(),new g(this.width,this.height,this.depth));let r=new Float32Array([-e,t,a,e,t,a,e,t,-a,-e,t,-a,-e,t,a,e,t,-a,e,-t,a,-e,-t,a,-e,-t,-a,e,-t,-a,e,-t,a,-e,-t,-a,-e,-t,a,-e,t,a,-e,t,-a,-e,-t,-a,-e,-t,a,-e,t,-a,e,t,a,e,-t,a,e,-t,-a,e,t,-a,e,t,a,e,-t,-a,e,t,a,-e,t,a,-e,-t,a,-e,-t,a,e,-t,a,e,t,a,e,-t,-a,-e,-t,-a,-e,t,-a,e,t,-a,e,-t,-a,-e,t,-a]),i=new Float32Array([0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1]),s=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),o=[0,2,1,3,5,4,6,8,7,9,11,10,12,14,13,15,17,16,18,20,19,21,23,22,24,26,25,27,29,28,30,32,31,33,35,34],l=new Uint16Array(o.reverse());this.setIndices(l),this.setAttribute(G.position,r),this.setAttribute(G.normal,i),this.setAttribute(G.uv,s),this.setAttribute(G.TEXCOORD_1,s),this.addSubGeometry({indexStart:0,indexCount:o.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class iu extends Ve{radiusTop;radiusBottom;height;radialSegments;heightSegments;openEnded;thetaStart;thetaLength;constructor(e=1,t=1,a=1,r=8,i=8,s=!1,o=0,l=Math.PI*2){super(),this.radiusTop=e,this.radiusBottom=t,this.height=a,this.radialSegments=r,this.heightSegments=i,this.openEnded=s,this.thetaStart=o,this.thetaLength=l,this.instanceID=Gt(),this.buildGeometry()}addGroup(e,t,a){this.addSubGeometry({indexStart:e,indexCount:t,vertexStart:e,vertexCount:0,firstStart:0,index:a,topology:0})}buildGeometry(){const e=this;this.radialSegments=Math.floor(this.radialSegments),this.heightSegments=Math.floor(this.heightSegments);const t=[],a=[],r=[],i=[];let s=0;const o=[],l=this.height/2;let c=0;A(),this.openEnded===!1&&(this.radiusTop>0&&m(!0),this.radiusBottom>0&&m(!1));let f=new Float32Array(t),h=new Float32Array(a),u=new Float32Array(r),b=new Uint16Array(i);this.setAttribute(G.position,f),this.setAttribute(G.normal,h),this.setAttribute(G.uv,u),this.setAttribute(G.TEXCOORD_1,u),this.setIndices(b);function A(){const p=new g,D=new g;let _=0;const v=(e.radiusBottom-e.radiusTop)/e.height;for(let U=0;U<=e.heightSegments;U++){const y=[],S=U/e.heightSegments,F=S*(e.radiusBottom-e.radiusTop)+e.radiusTop;for(let k=0;k<=e.radialSegments;k++){const x=k/e.radialSegments;let w=x*e.thetaLength+e.thetaStart;k==e.radialSegments&&Math.abs(e.thetaLength-e.thetaStart)==Math.PI*2&&(w=0);const R=Math.sin(w),Q=Math.cos(w);D.x=F*R,D.y=-S*e.height+l,D.z=F*Q,t.push(D.x,D.y,D.z),p.set(R,v,Q).normalize(),a.push(p.x,p.y,p.z),r.push(x,1-S),y.push(s++)}o.push(y)}for(let U=0;U<e.radialSegments;U++)for(let y=0;y<e.heightSegments;y++){const S=o[y][U],F=o[y+1][U],k=o[y+1][U+1],x=o[y][U+1];i.push(S,F,x),i.push(F,k,x),_+=6}e.addGroup(c,_,0),c+=_}function m(p){const D=s,_=new fe,v=new g;let U=0;const y=p===!0?e.radiusTop:e.radiusBottom,S=p===!0?1:-1;for(let k=1;k<=e.radialSegments;k++)t.push(0,l*S,0),a.push(0,S,0),r.push(.5,.5),s++;const F=s;for(let k=0;k<=e.radialSegments;k++){const w=k/e.radialSegments*e.thetaLength+e.thetaStart,R=Math.cos(w),Q=Math.sin(w);v.x=y*Q,v.y=l*S,v.z=y*R,t.push(v.x,v.y,v.z),a.push(0,S,0),_.x=R*.5+.5,_.y=Q*.5*S+.5,r.push(_.x,_.y),s++}for(let k=0;k<e.radialSegments;k++){const x=D+k,w=F+k;p===!0?i.push(w,w+1,x):i.push(w+1,w,x),U+=3}e.addGroup(c,U,p===!0?1:2),c+=U}}}class su extends Ve{radius;tube;radialSegments;tubularSegments;constructor(e=.4,t=.1,a=32,r=32){super(),this.radius=e,this.tube=t,this.radialSegments=a,this.tubularSegments=r,this.initVertex()}initVertex(){const e=2*Math.PI,t=this.radius,a=this.tube,r=this.radialSegments,i=this.tubularSegments;this.bounds=new Ce(g.ZERO.clone(),new g(t*2,a*2,t*2));var s=(r+1)*(i+1);let o=new Float32Array(s*3),l=new Float32Array(s*3),c=new Float32Array(s*2),f=new Uint16Array(r*i*2*3),h=0,u=0,b=0,A=0;for(let m=0;m<=r;m++)for(let p=0;p<=i;p++){const D=p/i,_=m/r,v=D*e,U=_*Math.PI*2;if(o[h++]=(t+a*Math.cos(U))*Math.sin(v),o[h++]=a*Math.sin(U),o[h++]=(t+a*Math.cos(U))*Math.cos(v),l[u++]=Math.sin(v)*Math.cos(U),l[u++]=Math.sin(U),l[u++]=Math.cos(v)*Math.cos(U),c[b++]=D,c[b++]=_,p<i&&m<r){const y=i+1,S=y*m+p,F=y*(m+1)+p,k=y*(m+1)+p+1,x=y*m+p+1;f[A++]=S,f[A++]=x,f[A++]=F,f[A++]=x,f[A++]=k,f[A++]=F}}this.setIndices(f),this.setAttribute(G.position,o),this.setAttribute(G.normal,l),this.setAttribute(G.uv,c),this.setAttribute(G.TEXCOORD_1,c),this.addSubGeometry({indexStart:0,indexCount:f.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class bp extends Ve{segment;row=0;constructor(e){super(),this.segment=e,this.buildGeometry()}buildGeometry(){this.row=this.segment+1;let e=new Uint32Array(this.segment*6),t=new Float32Array(this.row*3*2),a=new Float32Array(this.row*3*2),r=new Float32Array(this.row*2*2);for(let i=0;i<this.row;i++){t[i*3*2+0]=0,t[i*3*2+1]=0,t[i*3*2+2]=0,t[i*3*2+3]=0,t[i*3*2+4]=0,t[i*3*2+5]=0,a[i*3*2+0]=0,a[i*3*2+1]=0,a[i*3*2+2]=1,a[i*3*2+3]=0,a[i*3*2+4]=0,a[i*3*2+5]=1,r[i*2*2+0]=0,r[i*2*2+1]=i/this.segment,r[i*2*2+2]=1,r[i*2*2+3]=i/this.segment;let s=i*2,o=s,l=s+1,c=s+2,f=s+3;e[i*6+0]=o,e[i*6+1]=l,e[i*6+2]=c,e[i*6+3]=l,e[i*6+4]=f,e[i*6+5]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class gp extends Ve{faceCount=0;constructor(e){super(),this.faceCount=e,this.buildGeometry()}buildGeometry(){let e=new Uint32Array(this.faceCount*3),t=new Float32Array(this.faceCount*3*3),a=new Float32Array(this.faceCount*3*3),r=new Float32Array(this.faceCount*3*2),i=new Float32Array(this.faceCount*3*1);for(let s=0;s<this.faceCount;s++){let o=s*3+0,l=s*3+1,c=s*3+2;e[o]=o,e[l]=l,e[c]=c}this.setIndices(e),this.setAttribute(G.position,t),this.setAttribute(G.normal,a),this.setAttribute(G.uv,r),this.setAttribute(G.TEXCOORD_1,r),this.setAttribute(G.vIndex,i),this.addSubGeometry({indexStart:0,indexCount:e.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0})}}class mp extends ks{_internalTexture;_minSize=32;_skyColor;constructor(e){super(),this._skyColor=e,this._internalTexture=new _s;let t=[];return B.res.fillColor(t,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.create(this._minSize,this._minSize,t,!1),this.createFromTexture(this._minSize,this._internalTexture),this}changeColor(e){return this._skyColor=e,B.res.fillColor(this._internalTexture.floatArray,this._minSize,this._minSize,this.color.r,this.color.g,this.color.b,this.color.a),this._internalTexture.updateTexture(this._minSize,this._minSize,this._internalTexture.floatArray,!1),this._faceData.uploadTexture(0,this._internalTexture),this}get color(){return this._skyColor}set color(e){this.changeColor(e)}}class pp extends d.Object3D{length=100;thickness=.1;constructor(e,t=.1){super(),this.length=e,this.thickness=t,this.init()}init(){let e=new d.Object3D,t=new d.Object3D,a=new d.Object3D,r=new Ga(2,2,2),i=new Ga(2,2,2),s=new Ga(2,2,2),o=new Bt;o.baseColor=new Z(1,0,0);let l=new Bt;l.baseColor=new Z(0,1,0);let c=new Bt;c.baseColor=new Z(0,0,1);let f=e.addComponent(d.MeshRenderer),h=t.addComponent(d.MeshRenderer),u=a.addComponent(d.MeshRenderer);f.geometry=r,f.material=o,f.castShadow=!1,h.geometry=i,h.material=l,h.castShadow=!1,u.geometry=s,u.material=c,u.castShadow=!1,e.localScale=new g(this.length,this.thickness,this.thickness),e.x=this.length,t.localScale=new g(this.thickness,this.length,this.thickness),t.y=this.length,a.localScale=new g(this.thickness,this.thickness,this.length),a.z=this.length,this.addChild(e),this.addChild(t),this.addChild(a)}}class Ap{static merge(e,t,a){}static mergeNumber(e,t,a){let r=a||new Ve,i=e.getAttribute(G.position).data.length/3,s=new Float32Array(i*t);for(const f of e.vertexAttributeMap){let h=f[1].attribute;if(h==G.indices)continue;let u=e.getAttribute(h).data,b=u.length,A=new Float32Array(b*t);for(let m=0;m<t;m++){A.set(u,b*m);for(let p=0;p<i;p++)s[i*m+p]=m}r.setAttribute(h,A)}r.setAttribute(G.vIndex,s);let o=e.getAttribute(G.indices).data,l=o.length,c=new Uint32Array(o.length*t);for(let f=0;f<t;f++)for(let h=0;h<l;h++){let u=f*i,b=f*l;const A=o[h]+u;c[b+h]=A}return r.setIndices(c),r.addSubGeometry({indexStart:0,indexCount:c.length,vertexStart:0,index:0,vertexCount:0,firstStart:0,topology:0}),r}static generateNormal(){}static generateTangent(){}static packUV(){}}class Dp extends d.Object3D{size=100;divisions=10;constructor(e=100,t=10){super(),this.size=e,this.divisions=t,this.buildGeometry(),this.addAxis()}buildGeometry(){const e=[],t=[],a=this.size/this.divisions,r=this.size/2,i=this.divisions/2;for(let c=0,f=-r;c<=this.divisions;c++,f+=a)c!==i&&(e.push(-r,0,f,r,0,f),e.push(f,0,-r,f,0,r));for(let c=0;c<e.length/3;c+=2)t.push(c,c+1);let s=new Ve;s.setIndices(t.length>Uint16Array.length?new Uint32Array(t):new Uint16Array(t)),s.setAttribute(G.position,new Float32Array(e)),s.addSubGeometry({indexStart:0,indexCount:t.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});let o=new Bt;o.topology="line-list",o.baseColor=new Z(1,1,1,.15),o.blendMode=Ae.ADD,o.castReflection=!1;let l=this.addComponent(d.MeshRenderer);l.geometry=s,l.material=o}addAxis(){const e=this.size/2;let t=new Float32Array([-e,0,0,e,0,0]),a=new Uint16Array([0,1,2,3]),r=new Ve;r.setIndices(a),r.setAttribute(G.position,t),r.addSubGeometry({indexStart:0,indexCount:a.length,vertexStart:0,vertexCount:0,firstStart:0,index:0,topology:0});{let i=new d.Object3D,s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(1,0,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}{let i=new d.Object3D;i.rotationY=90;let s=i.addComponent(d.MeshRenderer);s.geometry=r;let o=s.material=new Bt;o.baseColor=new Z(0,1,0,.5),o.blendMode=Ae.ADD,o.castReflection=!1,o.topology="line-list",this.addChild(i)}}}class _p{static color_temperature_to_rgb(e){e<1e3?e=1e3:e>4e4&&(e=4e4);let t=e/100,a=this.get_red(t),r=this.get_green(t),i=this.get_blue(t);return new Z(a/255,r/255,i/255,1)}static get_red(e){if(e<=66)return 255;let t=329.698727446*Math.pow(e-60,-.1332047592);return this.bound(t)}static get_green(e){let t=0;return e<=66?t=99.4708025861*Math.log(e)-161.1195681661:t=288.1221695283*Math.pow(e-60,-.0755148492),this.bound(t)}static get_blue(e){let t=0;return e>=66?255:e<=19?0:(t=138.5177312231*Math.log(e-10)-305.0447927307,this.bound(t))}static bound(e,t=0,a=255){let r=Math.max(e,t);return Math.min(r,a)}}class Bp{static boxGeo;static planeGeo;static sphere;static material;static materialMap;static initHeap(){this.boxGeo||(this.boxGeo=new Ga),this.planeGeo||(this.planeGeo=new $r(1,1,1,1,g.UP)),this.sphere||(this.sphere=new Ir(1,35,35)),this.material||(this.material=new qt),this.materialMap||(this.materialMap=new Map)}static get CubeMesh(){return this.initHeap(),this.boxGeo}static get SphereMesh(){return this.initHeap(),this.sphere}static GetCube(){this.initHeap();let e=new d.Object3D,t=e.addComponent(d.MeshRenderer);return t.geometry=this.boxGeo,t.material=this.material.clone(),t.castShadow=!0,e}static GetMaterial(e){let t=this.materialMap.get(e);return t||(t=new qt,t.baseMap=e,this.materialMap.set(e,t)),t.clone()}static GetPlane(e){this.initHeap();let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.geometry=this.planeGeo;let r=this.GetMaterial(e);return r.blendMode=Ae.ADD,r.castShadow=!1,a.material=r,a.castGI=!1,a.castReflection=!1,t}static GetSingleCube(e,t,a,r,i,s){this.initHeap();let o=new qt;o.roughness=.5,o.metallic=.1,o.baseColor=new Z(r,i,s,1);let l=new d.Object3D,c=l.addComponent(d.MeshRenderer);return c.castGI=!0,c.geometry=new Ga(e,t,a),c.material=o,l}static GetSingleSphere(e,t,a,r){this.initHeap();let i=new qt;i.baseColor=new Z(t,a,r,1);let s=new d.Object3D,o=s.addComponent(d.MeshRenderer);return o.castGI=!0,o.geometry=new Ir(e,20,20),o.material=i,s}static get Sphere(){this.initHeap();let e=new d.Object3D,t=e.addComponent(d.MeshRenderer);return t.geometry=this.sphere,t.material=this.material,e}static GetSingleCube2(e,t=10){this.initHeap();let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);return r.castShadow=!1,r.geometry=new Ga(t,t,t),r.material=e,a}static GetPointLight(e,t,a,r,i,s,o=1,l=!0){let c=new d.Object3D,f=c.addComponent(d.PointLight);f.lightColor=new Z(r,i,s,1),f.intensity=o,f.range=a,f.at=8,f.radius=0,f.castShadow=l,c.localPosition=e,c.localRotation=t;let h=this.GetSingleSphere(.1,1,1,1);return c.addChild(h),f}}var N=(n=>(n[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z",n[n.XY=3]="XY",n[n.XZ=4]="XZ",n[n.YZ=5]="YZ",n[n.XYZ=6]="XYZ",n[n.MAX=7]="MAX",n[n.NONE=8]="NONE",n))(N||{}),ha=(n=>(n[n.Local=0]="Local",n[n.Global=1]="Global",n))(ha||{});class Hs extends $e{mAxis;mAxisColor;mContainer;mAxisMaterial;mAxisCollider;constructor(){super(),this._enable=!1,this.mAxis=new Array(N.MAX),this.mAxisColor=new Array(N.MAX),this.mAxisMaterial=new Array(N.MAX),this.mAxisCollider=new Array(N.MAX)}get target(){return this.object3D.target}get mX(){return this.object3D.mXObj}get mY(){return this.object3D.mYObj}get mZ(){return this.object3D.mZObj}get transformSpaceMode(){return this.object3D.transformSpaceMode}init(e){this.mContainer=new d.Object3D;let t=new Bt;t.baseColor=new Z(1,0,0),t.depthCompare=it.always,this.mAxisColor[N.X]=t.baseColor,this.mAxisMaterial[N.X]=t;let a=new Bt;a.baseColor=new Z(0,1,0),a.depthCompare=it.always,this.mAxisColor[N.Y]=a.baseColor,this.mAxisMaterial[N.Y]=a;let r=new Bt;r.baseColor=new Z(0,0,1),r.depthCompare=it.always,this.mAxisColor[N.Z]=r.baseColor,this.mAxisMaterial[N.Z]=r;let i=this.createCustomAxis(N.X),s=this.createCustomAxis(N.Y),o=this.createCustomAxis(N.Z);this.mContainer.addChild(this.mAxis[N.X]=i),this.mContainer.addChild(this.mAxis[N.Y]=s),this.mContainer.addChild(this.mAxis[N.Z]=o),this.mAxisCollider[N.X]=i.getComponent(da),this.mAxisCollider[N.Y]=s.getComponent(da),this.mAxisCollider[N.Z]=o.getComponent(da)}start(){}onEnable(e){this.object3D.addChild(this.mContainer),this.reset()}onDisable(e){this.object3D.removeChild(this.mContainer)}reset(){switch(this.transformSpaceMode){case ha.Local:{let t=T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).decompose();this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=t[1].x,this.object3D.rotationY=t[1].y,this.object3D.rotationZ=t[1].z,this.object3D.x=t[0].x,this.object3D.y=t[0].y,this.object3D.z=t[0].z}break;case ha.Global:{this.object3D.scaleX=1,this.object3D.scaleY=1,this.object3D.scaleZ=1,this.object3D.rotationX=0,this.object3D.rotationY=0,this.object3D.rotationZ=0;const e=this.mX.transform.worldPosition;this.object3D.x=e.x,this.object3D.y=e.y,this.object3D.z=e.z}break}}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r&&(!i||i.distance>r.distance||s==N.XYZ)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint},s==N.XYZ)))break}return i}currentAxis=N.NONE;beginPoint=new g;beginMousePos=new g;currentPoint=new g;onMouseDown(e){if(e.mouseCode!=Ps.MOUSE_LEFT)return;let t=this.pickAxis();if(!t)return;this.currentAxis=t.axis,e.stopImmediatePropagation();const r=this.object3D.transform.scene3D.view.camera;let i=r.worldToScreenPoint(this.mX.transform.worldPosition),s=r.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,i.z);this.beginPoint.copyFrom(s),this.beginMousePos.x=B.inputSystem.mouseX,this.beginMousePos.y=B.inputSystem.mouseY}lastMoveObj;lastMoveAxis;onMouseMove(e){if(this.currentAxis==N.NONE){let t=this.lastMoveObj.getComponent(d.MeshRenderer).material;this.lastMoveObj&&"baseColor"in t&&(t.baseColor=this.mAxisColor[this.lastMoveAxis],this.lastMoveObj=null,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.X]),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Y]),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",this.mAxisColor[N.Z])),this.lastMoveAxis=N.NONE);let a=this.pickAxis();if(!a)return;t.setUniformColor("baseColor",new Z(1,1,1)),this.lastMoveObj=a.obj,this.lastMoveAxis=a.axis,this.lastMoveAxis==N.XYZ&&(this.mAxis[N.X].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Y].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)),this.mAxis[N.Z].getComponent(d.MeshRenderer).material.setUniformColor("baseColor",new Z(1,1,1)))}else{const a=this.object3D.transform.scene3D.view.camera;let r=a.worldToScreenPoint(this.mX.transform.worldPosition),i=a.screenPointToWorld(B.inputSystem.mouseX,B.inputSystem.mouseY,r.z);this.currentPoint.copyFrom(i);let s=i.subtract(this.beginPoint);g.HELP_0.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let o=g.distance(g.HELP_0,this.beginMousePos);switch(this.beginMousePos.copyFrom(g.HELP_0),this.transformSpaceMode){case ha.Local:this.applyLocalTransform(this.currentAxis,s,o);break;case ha.Global:this.applyGlobalTransform(this.currentAxis,s,o);break}this.beginPoint.copyFrom(i),this.reset()}}onMouseUp(e){e.mouseCode==Ps.MOUSE_LEFT&&(this.currentAxis=N.NONE,this.reset())}onUpdate(e){let a=g.distance(e.camera.transform.worldPosition,this.object3D.transform.worldPosition)/100;if(this.mContainer.scaleX=this.mContainer.scaleY=this.mContainer.scaleZ=a,this.mX){const r=this.mX.transform.worldPosition;this.object3D.x=r.x,this.object3D.y=r.y,this.object3D.z=r.z}}applyLocalTransform(e,t,a){console.warn("not imp")}applyGlobalTransform(e,t,a){console.warn("not imp")}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=0,a=0,r=0;switch(e){case N.X:t=1;break;case N.Y:a=1;break;case N.Z:r=1;break}let i=.4+t*20,s=.4+a*20,o=.4+r*20,l=new d.Object3D;l.x=i*.5,l.y=s*.5,l.z=o*.5;let c=l.addComponent(d.MeshRenderer);c.geometry=new Ga(i,s,o),c.material=this.mAxisMaterial[e];let f=l.addComponent(da),h=new oi;return h.setFromCenterAndSize(new g(0,0,0),new g(i+1,s+1,o+1)),f.shape=h,l}}class nu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(.9,.9,.9),t.depthCompare=it.always,this.mAxisColor[N.XYZ]=t.baseColor,this.mAxisMaterial[N.XYZ]=t;let a=new d.Object3D,r=a.addComponent(d.MeshRenderer);r.geometry=new Ga(2,2,2),r.material=this.mAxisMaterial[N.XYZ];let i=a.addComponent(da),s=new oi;s.setFromCenterAndSize(new g(0,0,0),new g(2,2,2)),i.shape=s,this.mContainer.addChild(this.mAxis[N.XYZ]=a),this.mAxisCollider[N.XYZ]=a.getComponent(da)}applyLocalTransform(e,t,a){switch(this.currentAxis){case N.XYZ:{let r=0;Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?r=t.x:r=t.z:r=t.y,this.mX.scaleX+=r,this.mX.scaleY+=r,this.mX.scaleZ+=r}break;default:this.mX.transform.worldMatrix.transformVector(t,t),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(this.mX.scaleX=Math.abs(this.mX.scaleX+t.x)),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(this.mX.scaleY=Math.abs(this.mX.scaleY+t.y)),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(this.mX.scaleZ=Math.abs(this.mX.scaleZ+t.z));break}}applyGlobalTransform(e,t,a){let r=g.HELP_0;r.set(0,0,0),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&(r.x=t.x),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&(r.y=t.y),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&(r.z=t.z),this.mX.transform.worldMatrix.transformVector(r,g.HELP_1),this.mX.scaleX+=g.HELP_1.x,this.mX.scaleY+=g.HELP_1.y,this.mX.scaleZ+=g.HELP_1.z}createCustomAxis(e){let t=super.createAxis(e),a=this.createBox(e);return t.addChild(a),t}createBox(e){let t=0,a=0,r=0,i=new d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new Ga(2,2,2),c.material=this.mAxisMaterial[e],i}}var mt=(n=>(n[n.Scale=0]="Scale",n[n.Rotation=1]="Rotation",n[n.Translation=2]="Translation",n[n.NONE=3]="NONE",n))(mt||{});class ou extends Hs{applyLocalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ,this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.identity(),T.help_matrix_1.createByRotation(1,g.Y_AXIS),T.help_matrix_2.multiplyMatrices(T.help_matrix_1,T.help_matrix_0),T.help_matrix_2.invert(),T.help_matrix_1.multiplyMatrices(T.help_matrix_2,T.help_matrix_0);let r=T.help_matrix_1.decompose();this.mX.rotationX+=r[1].x,this.mY.rotationY+=r[1].y,this.mZ.rotationZ+=r[1].z}this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ}getAngle(){const t=this.object3D.transform.scene3D.view.camera,a=this.mZ.transform.worldPosition;if(t.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),this.currentAxis==N.X){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.x-a.x>0&&(s=360-s),s}if(this.currentAxis==N.Y){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.y-a.y>0&&(s=360-s),s}if(this.currentAxis==N.Z){let r=t.worldToScreenPoint(a);g.HELP_1.set(r.x,r.y,0),g.HELP_2.set(B.inputSystem.mouseX,B.inputSystem.mouseY,0);let i=g.HELP_2.subtract(g.HELP_1),s=g.getAngle(g.X_AXIS,i);return i.y>0&&(s=360-s),t.transform.worldPosition.z-a.z>0&&(s=360-s),s}return 0}mLastAngle=0;applyGlobalTransform(e,t,a){if(this.currentAxis==N.X||this.currentAxis==N.Y||this.currentAxis==N.Z){let r=this.getAngle();switch(T.help_matrix_0.identity(),this.currentAxis){case N.X:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.X_AXIS);break;case N.Y:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Y_AXIS);break;case N.Z:T.help_matrix_0.createByRotation(this.mLastAngle-r,g.Z_AXIS);break}T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let s=T.help_matrix_1.decompose(sa.QUATERNION)[1];ne.HELP_0.set(s.x,s.y,s.z,s.w),this.mLastAngle=r,this.mX.transform.localRotQuat=ne.HELP_0}}onMouseDown(e){super.onMouseDown(e),this.currentAxis!=N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!1,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!1,this.mAxis[this.currentAxis].getComponent(d.MeshRenderer).enable=!0,this.mLastAngle=this.getAngle())}onMouseUp(e){super.onMouseUp(e),this.currentAxis==N.NONE&&(this.mAxis[N.X].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Y].getComponent(d.MeshRenderer).enable=!0,this.mAxis[N.Z].getComponent(d.MeshRenderer).enable=!0)}createCustomAxis(e){return this.createAxis(e)}createAxis(e){let t=new d.Object3D;switch(e){case N.X:t.rotationZ=90;break;case N.Y:break;case N.Z:t.rotationX=90;break}let a=t.addComponent(d.MeshRenderer);a.geometry=new su(20,.4),a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;return i.setFromCenterAndSize(new g,new g(40,.4,40)),r.shape=i,t}pickAxis(){let a=this.object3D.transform.scene3D.view.camera.screenPointToRay(B.inputSystem.mouseX,B.inputSystem.mouseY),r,i;for(let s=0;s<=N.MAX;s++){let o=this.mAxisCollider[s];if(o&&(r=o.rayPick(a),r)){let l=g.distance(r.intersectPoint,o.shape.center);if(l>20+.8||l<20-.8)continue;(!i||i.distance>r.distance)&&(i={axis:s,obj:o.object3D,distance:r.distance,intersectPoint:r.intersectPoint})}}return i}}class lu extends Hs{init(e){super.init(e);let t=new Bt;t.doubleSide=!0,t.baseColor=new Z(0,0,1),t.depthCompare=it.always,this.mAxisColor[N.XY]=t.baseColor,this.mAxisMaterial[N.XY]=t;let a=new Bt;a.doubleSide=!0,a.baseColor=new Z(0,1,0),a.depthCompare=it.always,this.mAxisColor[N.XZ]=a.baseColor,this.mAxisMaterial[N.XZ]=a;let r=new Bt;r.doubleSide=!0,r.baseColor=new Z(1,0,0),r.depthCompare=it.always,this.mAxisColor[N.YZ]=r.baseColor,this.mAxisMaterial[N.YZ]=r;let i=this.createPlane(N.XY),s=this.createPlane(N.XZ),o=this.createPlane(N.YZ);this.mContainer.addChild(this.mAxis[N.XY]=i),this.mContainer.addChild(this.mAxis[N.XZ]=s),this.mContainer.addChild(this.mAxis[N.YZ]=o),this.mAxisCollider[N.XY]=i.getComponent(da),this.mAxisCollider[N.XZ]=s.getComponent(da),this.mAxisCollider[N.YZ]=o.getComponent(da)}applyLocalTransform(e,t,a){T.help_matrix_0.copyFrom(this.mX.transform.worldMatrix).invert(),T.help_matrix_0.transformVector(t,g.HELP_0),this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ||(g.HELP_0.x=0),this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ||(g.HELP_0.y=0),this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ||(g.HELP_0.z=0),this.mX.transform.worldMatrix.transformVector(g.HELP_0,g.HELP_1),this.mX.x+=g.HELP_1.x,this.mX.y+=g.HELP_1.y,this.mX.z+=g.HELP_1.z}applyGlobalTransform(e,t,a){T.help_matrix_0.identity(),(this.currentAxis==N.X||this.currentAxis==N.XY||this.currentAxis==N.XZ)&&T.help_matrix_0.appendTranslation(t.x,0,0),(this.currentAxis==N.Y||this.currentAxis==N.XY||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,t.y,0),(this.currentAxis==N.Z||this.currentAxis==N.XZ||this.currentAxis==N.YZ)&&T.help_matrix_0.appendTranslation(0,0,t.z),T.help_matrix_1.copyFrom(this.mX.transform.worldMatrix),T.help_matrix_1.append(T.help_matrix_0),this.mX.parent&&(T.help_matrix_2.copyFrom(this.mX.parent.worldMatrix),T.help_matrix_2.invert(),T.help_matrix_1.multiply(T.help_matrix_2));let r=T.help_matrix_1.decompose(sa.QUATERNION);this.mX.transform.localPosition=r[0],console.log(this.target.localPosition)}createCustomAxis(e){let t=super.createAxis(e),a=this.createArrows(e);return t.addChild(a),t}createArrows(e){let t=0,a=0,r=0,i=new d.Object3D;switch(e){case N.X:t=1,i.rotationZ=-90;break;case N.Y:a=1,i.rotationY=-90;break;case N.Z:r=1,i.rotationX=90;break}let s=.2+t*20,o=.2+a*20,l=.2+r*20;i.x=s*.5,i.y=o*.5,i.z=l*.5;let c=i.addComponent(d.MeshRenderer);return c.geometry=new iu(0,1,4),c.material=this.mAxisMaterial[e],i}createPlane(e){let t=new d.Object3D,a=t.addComponent(d.MeshRenderer);a.material=this.mAxisMaterial[e];let r=t.addComponent(da),i=new oi;switch(r.shape=i,e){case N.XY:a.geometry=new $r(4,4,1,1,g.Z_AXIS),t.x=8,t.y=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,4,.1));break;case N.XZ:a.geometry=new $r(4,4,1,1,g.Y_AXIS),t.x=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(4,.1,4));break;case N.YZ:a.geometry=new $r(4,4,1,1,g.X_AXIS),t.y=8,t.z=8,i.setFromCenterAndSize(new g(0,0,0),new g(.1,4,4));break}return t}}class qo extends d.Object3D{static _instance;static get instance(){return this._instance||(this._instance=new qo),this._instance}mTarget;mTransformMode=mt.NONE;mTransformSpaceType=ha.Global;mControllers;mXObj;mYObj;mZObj;constructor(){super(),this.mControllers=[null,null,null],this.mControllers[mt.Scale]=this.addComponent(nu),this.mControllers[mt.Rotation]=this.addComponent(ou),this.mControllers[mt.Translation]=this.addComponent(lu),this.mControllers[mt.Scale].enable=!1,this.mControllers[mt.Rotation].enable=!1,this.mControllers[mt.Translation].enable=!1,this.mXObj=new d.Object3D,this.mYObj=new d.Object3D,this.mZObj=new d.Object3D,this.mXObj.addChild(this.mYObj),this.mYObj.addChild(this.mZObj)}get transformMode(){return this.mTransformMode}get transformSpaceMode(){return this.mTransformSpaceType}active(e){e.addChild(this),e.addChild(this.mXObj)}unActive(e){e.removeChild(this)}get target(){return this.mTarget}selectObject(e,t,a){this.mTarget!=e&&(e?this.activate():this.unactivate(),this.mTarget=e,this.mXObj.localPosition=e.transform.worldPosition.clone()),t!=null&&this.selectTransformMode(t),a!=null&&this.selectTransformSpaceMode(a)}selectTransformMode(e){this.mTransformMode!=e&&(this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!1),this.mTransformMode=e,this.mTransformMode!=mt.NONE&&(this.mControllers[this.mTransformMode].enable=!0))}selectTransformSpaceMode(e){this.mTransformSpaceType!=e&&(this.mTransformSpaceType=e,this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].reset())}activate(){B.inputSystem.addEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.addEventListener(Y.POINTER_DOWN,this.onMouseDown,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_MOVE,this.onMouseMove,this,null,99999),B.inputSystem.addEventListener(Y.POINTER_UP,this.onMouseUp,this,null,99999)}unactivate(){B.inputSystem.removeEventListener(Ia.KEY_DOWN,this.onKeyDown,this),B.inputSystem.removeEventListener(Y.POINTER_DOWN,this.onMouseDown,this),B.inputSystem.removeEventListener(Y.POINTER_MOVE,this.onMouseMove,this),B.inputSystem.removeEventListener(Y.POINTER_UP,this.onMouseUp,this)}onKeyDown(e){switch(e.keyCode){case tt.Key_R:this.selectTransformMode(mt.Scale),this.selectTransformSpaceMode(ha.Local);break;case tt.Key_E:this.selectTransformMode(mt.Rotation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_W:this.selectTransformMode(mt.Translation),this.selectTransformSpaceMode(ha.Global);break;case tt.Key_A:this.selectTransformSpaceMode(ha.Local);break;case tt.Key_S:this.selectTransformSpaceMode(ha.Global);break}}onMouseDown(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseDown(e)}onMouseMove(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseMove(e)}onMouseUp(e){this.mTransformMode!=mt.NONE&&this.mControllers[this.mTransformMode].onMouseUp(e)}}const vp=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));d.AccelerateDecelerateInterpolator=z0,d.AccelerateInterpolator=L0,d.AnimationCurve=Vi,d.AnimationCurveT=Cr,d.AnimationMonitor=Mr,d.AnimatorEventKeyframe=Zb,d.AnticipateInterpolator=j0,d.AnticipateOvershootInterpolator=xi,d.ArrayHas=gu,d.ArrayItemIndex=mu,d.AtlasParser=Tf,d.AtmosphericComponent=Vb,d.AtmosphericScatteringSky=yd,d.AtmosphericScatteringSkySetting=Ud,d.AtmosphericScatteringSky_shader=vd,d.AttributeAnimCurve=Rd,d.AxisObject=pp,d.B3DMLoader=er,d.B3DMLoaderBase=Bf,d.B3DMParseUtil=so,d.B3DMParser=ro,d.BRDFLUT=xf,d.BRDFLUTGenerate=Ff,d.BRDF_frag=wl,d.BatchTable=Fs,d.BiMap=Ym,d.BillboardComponent=Ni,d.BillboardType=Ar,d.BitUtil=ic,d.BitmapTexture2D=$a,d.BitmapTexture2DArray=yc,d.BitmapTextureCube=Kn,d.Blend=vc,d.BlendFactor=Uc,d.BlendMode=Ae,d.BlendShapeData=No,d.BlendShapePropertyData=Po,d.BloomPost=jg,d.BlurEffectCreatorBlur_cs=hf,d.BlurEffectCreatorSample_cs=df,d.BlurTexture2DBufferCreator=uf,d.BounceInterpolator=Kt,d.BoundUtil=kn,d.BoundingBox=Ce,d.BoundingSphere=Tr,d.BoundingVolume=Vr,d.BoxColliderShape=oi,d.BoxGeometry=Ga,d.BrdfLut_frag=Bl,d.BsDF_frag=Il,d.BxDF_frag=Rl,d.BxdfDebug_frag=Pl,d.BytesArray=Ls,d.CEvent=bt,d.CEventDispatcher=ja,d.CEventListener=ns,d.CResizeEvent=nr,d.CSM=ia,d.Camera3D=Hr,d.CameraControllerBase=ag,d.CameraType=st,d.CameraUtil=ht,d.CapsuleColliderShape=Cg,d.CastPointShadowMaterialPass=Nc,d.CastShadowMaterialPass=Pc,d.Clearcoat_frag=Tl,d.ClusterBoundsSource_cs=m0,d.ClusterConfig=Rt,d.ClusterDebug_frag=cl,d.ClusterLight=Jl,d.ClusterLightingBuffer=g0,d.ClusterLightingRender=A0,d.ClusterLighting_cs=p0,d.CollectInfo=Gc,d.ColliderComponent=da,d.ColliderShape=ut,d.ColliderShapeType=ni,d.Color=Z,d.ColorGradient=Xm,d.ColorLitMaterial=Wm,d.ColorLitShader=Ad,d.ColorPassFragmentOutput=Eb,d.ColorPassRenderer=b0,d.ColorUtil=cs,d.ComData=Gs,d.Combine_cs=dd,d.Common_frag=Dl,d.Common_vert=_l,d.ComponentBase=$e,d.ComponentCollect=Ne,d.ComputeGPUBuffer=ei,d.ComputeShader=Se,d.Context3D=al,d.CubeCamera=Qn,d.CubeMapFaceEnum=bf,d.CubeSky_Shader=rn,d.CubicBezierCurve=Zs,d.CubicBezierPath=Hm,d.CubicBezierType=jh,d.CycleInterpolator=Z0,d.CylinderGeometry=iu,d.DDGIIrradianceComputePass=I0,d.DDGIIrradianceGPUBufferReader=Hi,d.DDGIIrradianceVolume=n0,d.DDGIIrradiance_shader=R0,d.DDGILightingPass=P0,d.DDGILighting_shader=M0,d.DDGIMultiBouncePass=Q0,d.DDGIProbeRenderer=N0,d.DEGREES_TO_RADIANS=pt,d.DRACO_DECODER_GLTF_JS=H0,d.DecelerateInterpolator=G0,d.Denoising_cs=hd,d.Depth2DTextureArray=v0,d.DepthCubeArrayTexture=_0,d.DepthMaterialPass=Vc,d.DepthOfFieldPost=Zg,d.DepthOfView_cs=Xf,d.DoubleArray=rs,d.EditorInspector=jr,d.Engine3D=B,d.Entity=s0,d.EntityBatchCollect=zc,d.EntityCollect=$,d.EnvMap_frag=vl,d.ErpImage2CubeMap=jt,d.ErpImage2CubeMapCreateCube_cs=gf,d.ErpImage2CubeMapRgbe2rgba_cs=mf,d.ExtrudeGeometry=Eg,d.FAILED=vr,d.FASTFLOOR=xa,d.FXAAPost=Mn,d.FXAAShader=k0,d.FastMathShader=yl,d.FatLineGeometry=ih,d.FatLineMaterial=Ch,d.FatLine_FS=fc,d.FatLine_VS=cc,d.FeatureTable=Ri,d.FileLoader=Tt,d.FirstPersonCameraController=rg,d.Float16ArrayTexture=_s,d.Float32ArrayTexture=i0,d.FlyCameraController=ig,d.FontChar=wf,d.FontInfo=kf,d.FontPage=Ef,d.FontParser=tr,d.ForwardRenderJob=O0,d.FragmentOutput=on,d.FragmentVarying=Sl,d.FrameCache=Ao,d.Frustum=pn,d.FrustumCSM=Bc,d.FrustumCulling_cs=kb,d.FullQuad_vert_wgsl=Nl,d.GBufferFrame=Be,d.GBufferPass=Mc,d.GBufferPost=Yg,d.GBufferStand=sc,d.GBuffer_pass=ln,d.GILighting=Xn,d.GIProbeMaterial=th,d.GIProbeMaterialType=Fo,d.GIProbeShader=Dd,d.GIRenderCompleteEvent=Pn,d.GIRenderStartEvent=Bs,d.GLBChunk=cf,d.GLBHeader=lf,d.GLBParser=Hn,d.GLSLLexer=Cc,d.GLSLLexerToken=Di,d.GLSLPreprocessor=Sc,d.GLSLSyntax=Ec,d.GLTFBinaryExtension=yf,d.GLTFMaterial=gm,d.GLTFParser=_t,d.GLTFSubParser=ys,d.GLTFSubParserCamera=K0,d.GLTFSubParserConverter=of,d.GLTFSubParserMaterial=$0,d.GLTFSubParserMesh=q0,d.GLTFSubParserSkeleton=Yn,d.GLTFSubParserSkin=ef,d.GLTFType=oa,d.GLTF_Accessors=T2,d.GLTF_Info=vs,d.GLTF_Light=E2,d.GLTF_Mesh=I2,d.GLTF_Node=w2,d.GLTF_Primitives=R2,d.GLTF_Scene=k2,d.GPUAddressMode=Ht,d.GPUBlendFactor=pu,d.GPUBufferBase=Za,d.GPUBufferType=ga,d.GPUCompareFunction=it,d.GPUContext=E,d.GPUCullMode=Vt,d.GPUFilterMode=fr,d.GPUPrimitiveTopology=ls,d.GPUTextureFormat=le,d.GPUVertexFormat=mi,d.GPUVertexStepMode=_u,d.GSplatFormat=di,d.GSplatGeometry=Sn,d.GSplatMaterial=Cn,d.GSplat_FS=Zc,d.GSplat_VS=jc,d.GTAOPost=Xg,d.GTAO_cs=Hf,d.GUIAtlasTexture=If,d.GUICanvas=zi,d.GUIConfig=Qr,d.GUIGeometry=Nd,d.GUIGeometryRebuild=Od,d.GUIMaterial=vo,d.GUIPassRenderer=V0,d.GUIPick=Wd,d.GUIPickHelper=Zd,d.GUIQuad=Na,d.GUIQuadAttrEnum=ot,d.GUIRenderer=Ld,d.GUIShader=Bo,d.GUISpace=fa,d.GUISprite=ai,d.GUITexture=mr,d.GaussianSplatParser=dm,d.GenerayRandomDir=zl,d.GeoJsonParser=um,d.GeoJsonUtil=bm,d.GeoType=Vs,d.GeometryBase=Ve,d.GeometryIndicesBuffer=Hc,d.GeometryUtil=Ap,d.GeometryVertexBuffer=Yc,d.GeometryVertexType=kt,d.GetComponentClass=rl,d.GetCountInstanceID=tn,d.GetRepeat=ku,d.GetShader=il,d.GlassShader=wb,d.GlobalBindGroup=ve,d.GlobalBindGroupLayout=An,d.GlobalFog=Hg,d.GlobalFog_shader=po,d.GlobalIlluminationComponent=Dg,d.GlobalUniform=sn,d.GlobalUniformGroup=En,d.GodRayPost=Kg,d.GodRay_cs=Kf,d.GridObject=Dp,d.HDRTexture=$n,d.HDRTextureCube=xs,d.Hair_frag=jl,d.Hair_shader_op=Rb,d.Hair_shader_tr=Ib,d.HaltonSeq=us,d.Horizontal=Hd,d.HoverCameraController=sg,d.I3DMLoader=va,d.I3DMLoaderBase=Cf,d.I3DMParser=no,d.IBLEnvMapCreator=Df,d.IBLEnvMapCreator_cs=Af,d.IESProfiles=Aa,d.IESProfiles_frag=Fl,d.IKDTreeUserData=Ig,d.ImageType=si,d.IndicesGPUBuffer=Xc,d.Inline_vert=Al,d.InputSystem=tl,d.InstanceDrawComponent=_g,d.InstanceUniform=Ul,d.InstancedMesh=Sf,d.Interpolator=br,d.InterpolatorEnum=Nn,d.IrradianceDataReaderCompleteEvent=gh,d.IrradianceVolumeData_frag=pl,d.Irradiance_frag=El,d.IsEditorInspector=uu,d.IsNonSerialize=$s,d.Joint=tf,d.JointPose=Zn,d.JumperInterpolator=J0,d.KDTreeEntity=Qg,d.KDTreeNode=_r,d.KDTreeRange=nh,d.KDTreeSpace=oh,d.KDTreeUUID=Xi,d.KHR_draco_mesh_compression=jn,d.KHR_lights_punctual=mm,d.KHR_materials_clearcoat=rf,d.KHR_materials_emissive_strength=sf,d.KHR_materials_ior=pm,d.KHR_materials_unlit=nf,d.KMZParser=Gf,d.KV=Mo,d.KelvinUtil=_p,d.KeyCode=tt,d.KeyEvent=Ia,d.Keyframe=Rs,d.KeyframeT=as,d.LASLoader=yh,d.LASParser=_m,d.LASUtils=Zt,d.LASVisualizationMode=hi,d.LDRTextureCube=ks,d.LOADED=Oa,d.LOADING=Vo,d.LRUCache=Nh,d.LambertMaterial=Jm,d.Lambert_shader=Yl,d.LightBase=Ei,d.LightData=hs,d.LightEntries=o0,d.LightType=ft,d.LightingFunction_frag=fl,d.Line=vt,d.LineClassification=Jd,d.LinearInterpolator=W0,d.LitMaterial=qt,d.Lit_shader=Ql,d.LoaderBase=gr,d.LoaderEvent=Mg,d.LoaderManager=Ns,d.MAX_VALUE=yu,d.MIN_VALUE=Cu,d.Material=Dt,d.MaterialDataUniformGPUBuffer=Tc,d.MaterialUtilities=Os,d.MathShader=dl,d.MathUtil=Ot,d.Matrix3=Pr,d.Matrix4=T,d.MatrixBindGroup=f0,d.MatrixGPUBuffer=c0,d.MatrixShader=Wl,d.MemoryDO=or,d.MemoryInfo=nl,d.MergeRGBACreator=Vg,d.MergeRGBA_cs=qf,d.MeshColliderShape=Ms,d.MinMaxAnimationCurves=ep,d.MinMaxCurve=$h,d.MinMaxCurveState=qh,d.MinMaxPolyCurves=tp,d.MorePassParser=zg,d.MorePassShader=uh,d.MorphTargetBlender=Hb,d.MorphTargetData=h0,d.MorphTargetFrame=Kb,d.MorphTargetTransformKey=Qd,d.MorphTarget_shader=Xt,d.MouseCode=Ps,d.MultiBouncePass_cs=T0,d.Navi3DAstar=au,d.Navi3DConst=is,d.Navi3DEdge=ka,d.Navi3DFunnel=ir,d.Navi3DMaskType=Sr,d.Navi3DMesh=up,d.Navi3DPoint=Mt,d.Navi3DPoint2D=Ko,d.Navi3DPointFat=Fa,d.Navi3DRouter=De,d.Navi3DTriangle=ru,d.NonSerialize=qs,d.NormalMap_frag=Cl,d.OAnimationEvent=af,d.OBJParser=wi,d.Object3DEvent=Pg,d.Object3DTransformTools=qo,d.Object3DUtil=Bp,d.ObjectAnimClip=Id,d.OcclusionSystem=Tn,d.Octree=ur,d.OctreeEntity=Jc,d.OrbitController=ng,d.OrderMap=Km,d.Orientation3D=sa,d.OutLineBlendColor_cs=$f,d.OutlineCalcOutline_cs=ed,d.OutlinePass=Tb,d.OutlinePost=qg,d.OutlinePostData=ph,d.OutlinePostManager=Ah,d.OutlinePostSlot=mh,d.Outline_cs=td,d.OvershootInterpolator=Y0,d.PARSING=Mh,d.PBRLItShader=Ml,d.PBRLitSSSShader=_d,d.PLUGIN_REGISTERED=Tm,d.PNTSLoader=xh,d.PNTSLoaderBase=Sh,d.PNTSParser=Fh,d.ParserBase=rt,d.ParserFormat=Je,d.ParticleSystemCurveEvalMode=Kh,d.ParticleSystemRandomnessIds=Zh,d.PassGenerate=yi,d.PassShader=bh,d.PassType=de,d.PhysicMaterialUniform_frag=hl,d.PickCompute=ah,d.PickFire=rh,d.PickGUIEvent3D=yt,d.PickResult=Dh,d.Picker_cs=ad,d.PingPong=cn,d.PipelinePool=vn,d.Plane3D=eu,d.PlaneClassification=Or,d.PlaneGeometry=$r,d.PlyMode=Sa,d.PlyParser=Io,d.PlyStreamParser=Uh,d.PointClassification=jd,d.PointCloudGeometry=Fn,d.PointCloudMaterial=r0,d.PointCloud_FS=a0,d.PointCloud_VS=t0,d.PointLightShadowRenderer=B0,d.PointShadowCubeCamera=D0,d.PointerEvent3D=Y,d.Polynomial=La,d.PolynomialCurve=rr,d.Polynomials=$m,d.PoolNode=Gd,d.PostBase=Jt,d.PostProcessingComponent=Wf,d.PostRenderer=S0,d.PreDepthPassRenderer=y0,d.PreFilteredEnvironment_cs=x0,d.PreFilteredEnvironment_cs2=vb,d.PreIntegratedLut=rd,d.PreIntegratedLutCompute=hh,d.PrefabAvatarData=Qo,d.PrefabAvatarParser=kh,d.PrefabBoneData=To,d.PrefabMaterialParser=wh,d.PrefabMeshData=Rh,d.PrefabMeshParser=Ih,d.PrefabNode=$i,d.PrefabParser=Qh,d.PrefabStringUtil=Sm,d.PrefabTextureData=Eh,d.PrefabTextureParser=Th,d.Preprocessor=ma,d.PriorityQueue=Lo,d.Probe=eh,d.ProbeEntries=Og,d.ProbeGBufferFrame=w0,d.ProfilerUtil=ct,d.PropertyAnimClip=jb,d.PropertyAnimTag=Td,d.PropertyAnimation=Do,d.PropertyAnimationClip=Zo,d.PropertyAnimationClipState=wd,d.PropertyAnimationEvent=Li,d.PropertyHelp=Oi,d.QuadAABB=Qt,d.QuadGlsl_fs=Hl,d.QuadGlsl_vs=Xl,d.QuadRoot=ch,d.QuadTree=lh,d.QuadTreeCell=Br,d.Quad_depth2dArray_frag_wgsl=Bu,d.Quad_depth2d_frag_wgsl=Ll,d.Quad_depthCube_frag_wgsl=Gl,d.Quad_frag_wgsl=Ol,d.Quad_vert_wgsl=Vl,d.Quaternion=ne,d.R32UintTexture=Ds,d.RADIANS_TO_DEGREES=Yr,d.RGBEErrorCode=pf,d.RGBEHeader=eo,d.RGBEParser=to,d.RTDescriptor=We,d.RTFrame=nt,d.RTResourceConfig=Qa,d.RTResourceMap=wt,d.Rand=pi,d.RandomSeed=Eu,d.Ray=na,d.RayCastMeshDetail=fi,d.Reader=Kr,d.Rect=Ai,d.Reference=xe,d.Reflection=Sd,d.ReflectionCG=oc,d.ReflectionEntries=l0,d.ReflectionMaterial=Fd,d.ReflectionRenderer=F0,d.ReflectionShader=xd,d.ReflectionShader_shader=nc,d.RegisterComponent=Nt,d.RegisterShader=Ta,d.RenderContext=In,d.RenderLayer=Ci,d.RenderLayerUtil=Un,d.RenderNode=Ba,d.RenderShaderCollect=Wc,d.RenderShaderCompute=dh,d.RenderShaderPass=qe,d.RenderTexture=Et,d.RendererBase=Ma,d.RendererJob=E0,d.RendererMap=C0,d.RendererMask=Me,d.RendererMaskUtil=ra,d.RendererPassState=u0,d.RepeatSE=fn,d.Res=zf,d.RotationControlComponents=ou,d.SHCommon_frag=lc,d.SN_ArrayConstant=_i,d.SN_BinaryOperation=hr,d.SN_Break=o2,d.SN_CodeBlock=Da,d.SN_Constant=Ha,d.SN_Continue=ms,d.SN_Declaration=et,d.SN_Discard=l2,d.SN_DoWhileLoop=n2,d.SN_Expression=Fe,d.SN_ForLoop=kr,d.SN_Function=bs,d.SN_FunctionArgs=gs,d.SN_FunctionCall=Fr,d.SN_IFBranch=wr,d.SN_Identifier=Xa,d.SN_IndexOperation=Rr,d.SN_Layout=Ui,d.SN_ParenExpression=Fc,d.SN_Precision=ps,d.SN_Return=Bi,d.SN_SelectOperation=vi,d.SN_Struct=Ya,d.SN_TernaryOperation=kc,d.SN_UnaryOperation=qr,d.SN_WhileLoop=Er,d.SSAO_cs=Ub,d.SSGI2_cs=id,d.SSGIPost=$g,d.SSRPost=em,d.SSR_BlendColor_cs=sd,d.SSR_IS_Kernel=tm,d.SSR_IS_cs=nd,d.SSR_RayTrace_cs=od,d.ScaleControlComponents=nu,d.Scene3D=xg,d.Shader=gt,d.ShaderAttributeInfo=Bn,d.ShaderConverter=wc,d.ShaderConverterResult=Rc,d.ShaderLib=X,d.ShaderPassBase=an,d.ShaderReflection=xt,d.ShaderStage=_a,d.ShaderState=Ic,d.ShaderUniformInfo=_n,d.ShaderUtil=Ka,d.ShadingInput=xl,d.ShadowLightsCollect=Wt,d.ShadowMapPassRenderer=U0,d.ShadowMapping_frag=kl,d.Skeleton=qb,d.SkeletonAnimationClip=Us,d.SkeletonAnimationClipState=Ed,d.SkeletonAnimationCompute=$b,d.SkeletonAnimation_shader=Zr,d.SkeletonBlendComputeArgs=eg,d.SkeletonPose=ki,d.SkeletonTransformComputeArgs=tg,d.SkyGBufferPass=Qc,d.SkyGBuffer_pass=Kl,d.SkyMaterial=Cd,d.SkyRenderer=ws,d.SolidColorSky=mp,d.SphereColliderShape=Sg,d.SphereGeometry=Ir,d.SphereReflection=kd,d.StandShader=ff,d.StatementNode=Ge,d.StorageGPUBuffer=Pe,d.StreamLoader=im,d.StreamingGaussianSplatParser=hm,d.StringUtil=It,d.Struct=gi,d.StructStorageGPUBuffer=Lg,d.SubGeometry=Kc,d.TAACopyTex_cs=ld,d.TAAPost=am,d.TAASharpTex_cs=cd,d.TAA_cs=fd,d.TestComputeLoadBuffer=ud,d.TextAnchor=Yd,d.TextFieldLayout=qd,d.TextFieldLine=Kd,d.Texture=dt,d.TextureCube=Cs,d.TextureCubeFaceData=ao,d.TextureCubeStdCreator=Ss,d.TextureCubeUtils=qn,d.TextureMipmapCompute=Gg,d.TextureMipmapGenerator=pa,d.TextureScaleCompute=fh,d.ThirdPersonCameraController=lg,d.Tile=Oo,d.TileSet=Nm,d.TileSetChild=Om,d.TileSetChildContent=Lm,d.TileSetChildContentMetaData=Gm,d.TileSetRoot=Vm,d.TilesRenderer=Pm,d.Time=ze,d.TokenType=C,d.TorusGeometry=su,d.TouchData=el,d.TrailGeometry=bp,d.Transform=zt,d.TransformAxisEnum=N,d.TransformControllerBaseComponent=Hs,d.TransformMode=mt,d.TransformSpaceMode=ha,d.TranslationControlComponents=lu,d.TranslatorContext=Dn,d.TriGeometry=gp,d.Triangle=Zi,d.UIButton=yo,d.UIButtonTransition=$d,d.UIComponentBase=Uo,d.UIEvent=Ng,d.UIImage=Nr,d.UIImageGroup=Co,d.UIInteractive=Qs,d.UIInteractiveStyle=at,d.UIPanel=ji,d.UIRenderAble=Ji,d.UIShadow=So,d.UITextField=xo,d.UITransform=ar,d.UNLOADED=Ur,d.UUID=Gt,d.UV=Ho,d.Uint32ArrayTexture=xn,d.Uint8ArrayTexture=Si,d.UnLit=Zl,d.UnLitMaterial=Bt,d.UnLitMaterialUniform_frag=ul,d.UnLitTexArrayMaterial=Zm,d.UnLitTextureArray=Bd,d.UnLit_frag=bl,d.UniformGPUBuffer=Ct,d.UniformNode=lr,d.UniformType=St,d.ValueEnumType=H,d.ValueOp=hp,d.ValueParser=Va,d.ValueSpread=ap,d.Vector2=fe,d.Vector3=g,d.Vector3Ex=Gi,d.Vector4=ue,d.VertexAttribute=Rg,d.VertexAttributeIndexShader=pd,d.VertexAttributeName=G,d.VertexAttributeSize=cr,d.VertexAttributeStride=sh,d.VertexAttributes_vert=gl,d.VertexBufferLayout=wg,d.VertexFormat=ll,d.VertexGPUBuffer=As,d.Vertical=Xd,d.VideoUniform_frag=ml,d.View3D=Fg,d.ViewPanel=Is,d.ViewQuad=Rn,d.VirtualTexture=Ie,d.WGS84_FLATTENING=Rm,d.WGS84_HEIGHT=Im,d.WGS84_RADIUS=wm,d.WGSLTranslator=xc,d.WayLines3D=Pi,d.WayPoint3D=Mi,d.WebGPUDescriptorCreator=Ye,d.WorldMatrixUniform=nn,d.WorldPanel=Ts,d.WrapMode=li,d.WrapTimeMode=Dr,d.ZCullingCompute=Jg,d.ZPassShader_cs=md,d.ZPassShader_fs=rc,d.ZPassShader_vs=ac,d.ZSorterUtil=Oc,d.append=_c,d.arrayToString=_f,d.blendComponent=Au,d.buildCurves=ip,d.byteSizeOfType=ea,d.calculateCurveRangesValue=sp,d.calculateMinMax=es,d.castPointShadowMap_vert=$l,d.clamp=_e,d.clampRepeat=qu,d.computeAABBFromPositions=ko,d.cos=zu,d.crossProduct=Xu,d.cubicPolynomialRoot=Yh,d.cubicPolynomialRootsGeneric=Xh,d.curvesSupportProcedural=rp,d.deg2Rad=Ou,d.detectGSplatFormat=_h,d.directionShadowCastMap_frag=tc,d.dot=Ft,d.doubleIntegrateSegment=Hh,d.downSample=Zf,d.fastInvSqrt=Ac,d.floorfToIntPos=pc,d.fonts=ri,d.generateRandom=Hu,d.generateRandom3=Ku,d.getFloatFromInt=bc,d.getGLTypeFromTypedArray=j2,d.getGLTypeFromTypedArrayType=J2,d.getGlobalRandomSeed=Wu,d.getTypedArray=Z2,d.getTypedArrayTypeFromGLType=Jn,d.grad1=Xo,d.grad2=Xs,d.grad3=ts,d.grad4=ui,d.inferSHOrder=wo,d.integrateSegment=Yo,d.irradianceDataReader=Wg,d.kPI=qm,d.lerp=xr,d.lerpByte=Fu,d.lerpColor=xu,d.lerpVector3=Su,d.lruPriorityCallback=Jh,d.magnitude=hn,d.makeAloneSprite=ab,d.makeGUISprite=Rf,d.makeMatrix44=ds,d.markUsedSetLeaves=jo,d.markUsedTiles=Ws,d.markVisibleTiles=Js,d.matrixMultiply=mn,d.matrixRotate=a2,d.matrixRotateY=t2,d.mergeFunctions=os,d.multiplyMatrices4x4REF=Dc,d.normal_distribution=tu,d.normalizeFast=Yu,d.normalizeSafe=uc,d.normalizedToByte=Zu,d.normalizedToWord=ju,d.outlinePostData=Ca,d.outlinePostManager=rm,d.parsePlyGaussianSplat=Ro,d.parsePlyHeader=qi,d.parsePlyMesh=Bh,d.parsePlyPointCloud=vh,d.perm=Ue,d.post=Yf,d.priorityCallback=Wh,d.quadraticPolynomialRootsGeneric=Ys,d.rad2Deg=Lu,d.random01=Xr,d.randomBarycentricCoord=Vu,d.randomPointBetweenEllipsoid=Nu,d.randomPointBetweenSphere=Mu,d.randomPointInsideCube=Tu,d.randomPointInsideEllipsoid=Qu,d.randomPointInsideUnitCircle=Pu,d.randomPointInsideUnitSphere=mc,d.randomQuaternion=Ru,d.randomQuaternionUniformDistribution=Iu,d.randomUnitVector=fs,d.randomUnitVector2=gc,d.rangedRandomFloat=At,d.rangedRandomInt=wu,d.readByType=be,d.readMagicBytes=ti,d.registerMaterial=jm,d.repeat=gn,d.rotMatrix=e2,d.rotateVectorByQuat=Uu,d.roundfToIntPos=un,d.scale=dn,d.shadowCastMap_frag=ec,d.shadowCastMap_vert=ql,d.simplex=ta,d.sin=Gu,d.snoise1=lp,d.snoise2=cp,d.snoise3=fp,d.snoise4=dp,d.splatColorProperties=Eo,d.splatProperties=Ki,d.sqrMagnitude=bn,d.sqrtImpl=hc,d.stencilStateFace=Du,d.swap=Ju,d.textureCompress=bd,d.threshold=jf,d.throttle=zm,d.toHalfFloat=qa,d.toggleTiles=js,d.traverseAncestors=Qm,d.traverseSet=Vh,d.tw=Fb,d.uniform_real_distribution=np,d.uniform_real_distribution2=op,d.upSample=mo,d.webGPUContext=I,d.zSorterUtil=Lc,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
11855
11859
  //# sourceMappingURL=rings.umd.js.map