@terra.gl/core 0.0.1-alpha.19 → 0.0.1-alpha.20
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/index.js +3 -3
- package/dist/index.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var vw = (a, t, e) => t in a ? yw(a, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var M = (a, t, e) => vw(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import * as at from "three";
|
|
5
5
|
import { REVISION as zh, TrianglesDrawMode as ww, TriangleFanDrawMode as Ya, TriangleStripDrawMode as Dh, Mesh as ht, Vector3 as B, Color as Te, FrontSide as ro, Plane as kh, Matrix4 as Se, Vector4 as sn, PerspectiveCamera as Li, WebGLRenderTarget as xw, UniformsUtils as Qs, UniformsLib as qs, ShaderMaterial as ll, MOUSE as qn, TOUCH as $n, Spherical as $u, Quaternion as $t, OrthographicCamera as Ir, Vector2 as Ze, Ray as bw, Loader as cl, LoaderUtils as Bi, FileLoader as ri, MeshPhysicalMaterial as vn, SpotLight as Oh, PointLight as Ha, DirectionalLight as $s, InstancedMesh as ul, InstancedBufferAttribute as Ua, Object3D as tn, TextureLoader as so, ImageBitmapLoader as _w, BufferAttribute as en, InterleavedBuffer as Tw, InterleavedBufferAttribute as _i, LinearMipmapLinearFilter as hl, NearestMipmapLinearFilter as Lw, LinearMipmapNearestFilter as Mw, NearestMipmapNearestFilter as Sw, LinearFilter as eo, NearestFilter as Kh, RepeatWrapping as Cn, MirroredRepeatWrapping as Zw, ClampToEdgeWrapping as Na, PointsMaterial as oo, Material as La, LineBasicMaterial as Yh, MeshStandardMaterial as Ar, DoubleSide as dl, MeshBasicMaterial as pn, PropertyBinding as Er, BufferGeometry as mn, SkinnedMesh as Hh, LineSegments as Gw, Line as Uh, LineLoop as Ww, Points as Xr, Group as nn, MathUtils as ut, Skeleton as Nh, AnimationClip as Bh, Bone as Ba, InterpolateDiscrete as Rw, InterpolateLinear as jh, Texture as Qi, VectorKeyframeTrack as ja, NumberKeyframeTrack as Ja, QuaternionKeyframeTrack as Qa, Interpolant as Iw, Box3 as Zi, Sphere as fl, Curve as Pw, MeshPhongMaterial as Ma, MeshLambertMaterial as Jh, EquirectangularReflectionMapping as Cw, AmbientLight as Qh, Float32BufferAttribute as ei, Uint16BufferAttribute as Ew, Matrix3 as Vw, Euler as Zr, DataTextureLoader as Aw, HalfFloatType as Vs, FloatType as js, DataUtils as As, InstancedBufferGeometry as qh, InstancedInterleavedBuffer as qa, WireframeGeometry as Xw, Line3 as Fw, EventDispatcher as $h, Clock as pl, Scene as zw, FogExp2 as eh, CubeTextureLoader as Dw, WebGLRenderer as kw, PCFSoftShadowMap as Ow, ACESFilmicToneMapping as Kw, CameraHelper as Yw, CubicBezierCurve3 as Hw, PlaneGeometry as ji, Frustum as Uw, Raycaster as ml, CanvasTexture as Fr, SpriteMaterial as zr, Sprite as $i, DynamicDrawUsage as th, NormalBlending as Nw, BackSide as Bw, Shape as jw, ShapeGeometry as Jw, CylinderGeometry as Qw, AdditiveBlending as qw, AnimationMixer as $w, LoopRepeat as ex, LoopOnce as tx, LoadingManager as nx, Box2 as ix, ImageLoader as ed, SRGBColorSpace as rx } from "three";
|
|
6
|
-
const sx = "0.0.1-alpha.
|
|
6
|
+
const sx = "0.0.1-alpha.20", Sa = {
|
|
7
7
|
name: "Criska"
|
|
8
8
|
};
|
|
9
9
|
var Pr = function() {
|
|
@@ -15284,7 +15284,7 @@ class s_ extends Yr {
|
|
|
15284
15284
|
// 新增:把算好的 overlayParams 传给材质
|
|
15285
15285
|
regionOverlay: n || void 0
|
|
15286
15286
|
}), l = new Zi().setFromObject(i);
|
|
15287
|
-
s.updateBoundingBox(l.min.y, l.max.y), s.setDiffusionFromObject(i), i.material = s, i.material.needsUpdate = !0;
|
|
15287
|
+
s.updateBoundingBox(l.min.y, l.max.y), s.setDiffusionFromObject(i), i.receiveShadow = !1, i.material = s, i.material.needsUpdate = !0;
|
|
15288
15288
|
}
|
|
15289
15289
|
i.name === "grass" && (i.castShadow = !1, i.receiveShadow = !0, i.material.color = new Te("#81e4d8ff)").multiplyScalar(0.7), i.material.metalness = 0.2, i.material.roughness = 0.8, ["metalnessMap", "normalMap", "roughnessMap", "specularColorMap"].forEach((s) => {
|
|
15290
15290
|
const l = i.material[s];
|
|
@@ -16582,7 +16582,7 @@ function M_(a, t) {
|
|
|
16582
16582
|
}
|
|
16583
16583
|
const S_ = `{
|
|
16584
16584
|
"name": "@terra.gl/core",
|
|
16585
|
-
"version": "0.0.1-alpha.
|
|
16585
|
+
"version": "0.0.1-alpha.20",
|
|
16586
16586
|
"type": "module",
|
|
16587
16587
|
"files": [
|
|
16588
16588
|
"dist"
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(ee,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],m):(ee=typeof globalThis<"u"?globalThis:ee||self,m(ee["terra-gl"]={},ee.THREE))})(this,function(ee,m){"use strict";var kb=Object.defineProperty;var Ob=(ee,m,ci)=>m in ee?kb(ee,m,{enumerable:!0,configurable:!0,writable:!0,value:ci}):ee[m]=ci;var T=(ee,m,ci)=>Ob(ee,typeof m!="symbol"?m+"":m,ci);function ci(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const rt=ci(m),zh="0.0.1-alpha.
|
|
1
|
+
(function(ee,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],m):(ee=typeof globalThis<"u"?globalThis:ee||self,m(ee["terra-gl"]={},ee.THREE))})(this,function(ee,m){"use strict";var kb=Object.defineProperty;var Ob=(ee,m,ci)=>m in ee?kb(ee,m,{enumerable:!0,configurable:!0,writable:!0,value:ci}):ee[m]=ci;var T=(ee,m,ci)=>Ob(ee,typeof m!="symbol"?m+"":m,ci);function ci(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const rt=ci(m),zh="0.0.1-alpha.20",Ts={name:"Criska"};var Vi=function(){var a=0,t=document.createElement("div");t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",function(p){p.preventDefault(),n(++a%t.children.length)},!1);function e(p){return t.appendChild(p.dom),p}function n(p){for(var f=0;f<t.children.length;f++)t.children[f].style.display=f===p?"block":"none";a=p}var i=(performance||Date).now(),s=i,l=0,u=e(new Vi.Panel("FPS","#0ff","#002")),c=e(new Vi.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=e(new Vi.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:t,addPanel:e,showPanel:n,begin:function(){i=(performance||Date).now()},end:function(){l++;var p=(performance||Date).now();if(c.update(p-i,200),p>=s+1e3&&(u.update(l*1e3/(p-s),100),s=p,l=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return p},update:function(){i=this.end()},domElement:t,setMode:n}};Vi.Panel=function(a,t,e){var n=1/0,i=0,s=Math.round,l=s(window.devicePixelRatio||1),u=80*l,c=48*l,d=3*l,p=2*l,f=3*l,y=15*l,v=74*l,x=30*l,S=document.createElement("canvas");S.width=u,S.height=c,S.style.cssText="width:80px;height:48px";var _=S.getContext("2d");return _.font="bold "+9*l+"px Helvetica,Arial,sans-serif",_.textBaseline="top",_.fillStyle=e,_.fillRect(0,0,u,c),_.fillStyle=t,_.fillText(a,d,p),_.fillRect(f,y,v,x),_.fillStyle=e,_.globalAlpha=.9,_.fillRect(f,y,v,x),{dom:S,update:function(Z,M){n=Math.min(n,Z),i=Math.max(i,Z),_.fillStyle=e,_.globalAlpha=1,_.fillRect(0,0,u,y),_.fillStyle=t,_.fillText(s(Z)+" "+a+" ("+s(n)+"-"+s(i)+")",d,p),_.drawImage(S,f+l,y,v-l,x,f,y,v-l,x),_.fillRect(f+v-l,y,l,x),_.fillStyle=e,_.globalAlpha=.9,_.fillRect(f+v-l,y,l,s((1-Z/M)*x))}}};const gr=parseInt(m.REVISION.replace(/\D+/g,"")),Zs=gr>=125?"uv1":"uv2";function za(a,t){if(t===m.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(t===m.TriangleFanDrawMode||t===m.TriangleStripDrawMode){let e=a.getIndex();if(e===null){const l=[],u=a.getAttribute("position");if(u!==void 0){for(let c=0;c<u.count;c++)l.push(c);a.setIndex(l),e=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}const n=e.count-2,i=[];if(e)if(t===m.TriangleFanDrawMode)for(let l=1;l<=n;l++)i.push(e.getX(0)),i.push(e.getX(l)),i.push(e.getX(l+1));else for(let l=0;l<n;l++)l%2===0?(i.push(e.getX(l)),i.push(e.getX(l+1)),i.push(e.getX(l+2))):(i.push(e.getX(l+2)),i.push(e.getX(l+1)),i.push(e.getX(l)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=a.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),a}var Zt=Uint8Array,_n=Uint16Array,Gs=Uint32Array,Da=new Zt([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]),ka=new Zt([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]),Dh=new Zt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oa=function(a,t){for(var e=new _n(31),n=0;n<31;++n)e[n]=t+=1<<a[n-1];for(var i=new Gs(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)i[s]=s-e[n]<<5|n;return[e,i]},Ra=Oa(Da,2),Ka=Ra[0],kh=Ra[1];Ka[28]=258,kh[258]=28;for(var Oh=Oa(ka,0),Rh=Oh[0],Ws=new _n(32768),Ie=0;Ie<32768;++Ie){var Mn=(Ie&43690)>>>1|(Ie&21845)<<1;Mn=(Mn&52428)>>>2|(Mn&13107)<<2,Mn=(Mn&61680)>>>4|(Mn&3855)<<4,Ws[Ie]=((Mn&65280)>>>8|(Mn&255)<<8)>>>1}for(var Ai=function(a,t,e){for(var n=a.length,i=0,s=new _n(t);i<n;++i)++s[a[i]-1];var l=new _n(t);for(i=0;i<t;++i)l[i]=l[i-1]+s[i-1]<<1;var u;if(e){u=new _n(1<<t);var c=15-t;for(i=0;i<n;++i)if(a[i])for(var d=i<<4|a[i],p=t-a[i],f=l[a[i]-1]++<<p,y=f|(1<<p)-1;f<=y;++f)u[Ws[f]>>>c]=d}else for(u=new _n(n),i=0;i<n;++i)a[i]&&(u[i]=Ws[l[a[i]-1]++]>>>15-a[i]);return u},Fi=new Zt(288),Ie=0;Ie<144;++Ie)Fi[Ie]=8;for(var Ie=144;Ie<256;++Ie)Fi[Ie]=9;for(var Ie=256;Ie<280;++Ie)Fi[Ie]=7;for(var Ie=280;Ie<288;++Ie)Fi[Ie]=8;for(var Ya=new Zt(32),Ie=0;Ie<32;++Ie)Ya[Ie]=5;var Kh=Ai(Fi,9,1),Yh=Ai(Ya,5,1),Ps=function(a){for(var t=a[0],e=1;e<a.length;++e)a[e]>t&&(t=a[e]);return t},Rt=function(a,t,e){var n=t/8|0;return(a[n]|a[n+1]<<8)>>(t&7)&e},Is=function(a,t){var e=t/8|0;return(a[e]|a[e+1]<<8|a[e+2]<<16)>>(t&7)},Uh=function(a){return(a/8|0)+(a&7&&1)},Bh=function(a,t,e){(e==null||e>a.length)&&(e=a.length);var n=new(a instanceof _n?_n:a instanceof Gs?Gs:Zt)(e-t);return n.set(a.subarray(t,e)),n},Nh=function(a,t,e){var n=a.length;if(!n||e&&!e.l&&n<5)return t||new Zt(0);var i=!t||e,s=!e||e.i;e||(e={}),t||(t=new Zt(n*3));var l=function(je){var Je=t.length;if(je>Je){var Qe=new Zt(Math.max(Je*2,je));Qe.set(t),t=Qe}},u=e.f||0,c=e.p||0,d=e.b||0,p=e.l,f=e.d,y=e.m,v=e.n,x=n*8;do{if(!p){e.f=u=Rt(a,c,1);var S=Rt(a,c+1,3);if(c+=3,S)if(S==1)p=Kh,f=Yh,y=9,v=5;else if(S==2){var G=Rt(a,c,31)+257,A=Rt(a,c+10,15)+4,R=G+Rt(a,c+5,31)+1;c+=14;for(var D=new Zt(R),k=new Zt(19),C=0;C<A;++C)k[Dh[C]]=Rt(a,c+C*3,7);c+=A*3;for(var K=Ps(k),I=(1<<K)-1,z=Ai(k,K,1),C=0;C<R;){var N=z[Rt(a,c,I)];c+=N&15;var _=N>>>4;if(_<16)D[C++]=_;else{var H=0,j=0;for(_==16?(j=3+Rt(a,c,3),c+=2,H=D[C-1]):_==17?(j=3+Rt(a,c,7),c+=3):_==18&&(j=11+Rt(a,c,127),c+=7);j--;)D[C++]=H}}var q=D.subarray(0,G),J=D.subarray(G);y=Ps(q),v=Ps(J),p=Ai(q,y,1),f=Ai(J,v,1)}else throw"invalid block type";else{var _=Uh(c)+4,Z=a[_-4]|a[_-3]<<8,M=_+Z;if(M>n){if(s)throw"unexpected EOF";break}i&&l(d+Z),t.set(a.subarray(_,M),d),e.b=d+=Z,e.p=c=M*8;continue}if(c>x){if(s)throw"unexpected EOF";break}}i&&l(d+131072);for(var oe=(1<<y)-1,re=(1<<v)-1,te=c;;te=c){var H=p[Is(a,c)&oe],me=H>>>4;if(c+=H&15,c>x){if(s)throw"unexpected EOF";break}if(!H)throw"invalid length/literal";if(me<256)t[d++]=me;else if(me==256){te=c,p=null;break}else{var be=me-254;if(me>264){var C=me-257,he=Da[C];be=Rt(a,c,(1<<he)-1)+Ka[C],c+=he}var ve=f[Is(a,c)&re],ze=ve>>>4;if(!ve)throw"invalid distance";c+=ve&15;var J=Rh[ze];if(ze>3){var he=ka[ze];J+=Is(a,c)&(1<<he)-1,c+=he}if(c>x){if(s)throw"unexpected EOF";break}i&&l(d+131072);for(var Ye=d+be;d<Ye;d+=4)t[d]=t[d-J],t[d+1]=t[d+1-J],t[d+2]=t[d+2-J],t[d+3]=t[d+3-J];d=Ye}}e.l=p,e.p=te,e.b=d,p&&(u=1,e.m=y,e.d=f,e.n=v)}while(!u);return d==t.length?t:Bh(t,0,d)},jh=new Zt(0),Jh=function(a){if((a[0]&15)!=8||a[0]>>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Qh(a,t){return Nh((Jh(a),a.subarray(2,-4)),t)}var Hh=typeof TextDecoder<"u"&&new TextDecoder,Eh=0;try{Hh.decode(jh,{stream:!0}),Eh=1}catch{}class qh extends m.Mesh{constructor(t,e={}){super(t),this.isWater=!0;const n=this,i=e.textureWidth!==void 0?e.textureWidth:512,s=e.textureHeight!==void 0?e.textureHeight:512,l=e.clipBias!==void 0?e.clipBias:0,u=e.alpha!==void 0?e.alpha:1,c=e.time!==void 0?e.time:0,d=e.waterNormals!==void 0?e.waterNormals:null,p=e.sunDirection!==void 0?e.sunDirection:new m.Vector3(.70707,.70707,0),f=new m.Color(e.sunColor!==void 0?e.sunColor:16777215),y=new m.Color(e.waterColor!==void 0?e.waterColor:8355711),v=e.eye!==void 0?e.eye:new m.Vector3(0,0,0),x=e.distortionScale!==void 0?e.distortionScale:20,S=e.side!==void 0?e.side:m.FrontSide,_=e.fog!==void 0?e.fog:!1,Z=new m.Plane,M=new m.Vector3,G=new m.Vector3,A=new m.Vector3,R=new m.Matrix4,D=new m.Vector3(0,0,-1),k=new m.Vector4,C=new m.Vector3,K=new m.Vector3,I=new m.Vector4,z=new m.Matrix4,N=new m.PerspectiveCamera,H=new m.WebGLRenderTarget(i,s),j={uniforms:m.UniformsUtils.merge([m.UniformsLib.fog,m.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new m.Matrix4},sunColor:{value:new m.Color(8355711)},sunDirection:{value:new m.Vector3(.70707,.70707,0)},eye:{value:new m.Vector3},waterColor:{value:new m.Color(5592405)}}]),vertexShader:`
|
|
2
2
|
uniform mat4 textureMatrix;
|
|
3
3
|
uniform float time;
|
|
4
4
|
|
|
@@ -690,9 +690,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
|
-
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const n=new rt.Box3().setFromObject(e);if(n.isEmpty())return;const i=new rt.Vector3;n.getCenter(i);const s=[new rt.Vector3(n.min.x,n.min.y,n.min.z),new rt.Vector3(n.max.x,n.max.y,n.max.z)];let l=0;s.forEach(u=>{const c=i.distanceTo(u);c>l&&(l=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:l},this.needsUpdate=!0}updateBoundingBox(e,n){this.shaderOption.minY=e,this.shaderOption.maxY=n,this.needsUpdate=!0}updateEffects(e){this.shaderOption.effects={...this.shaderOption.effects,...e},this.needsUpdate=!0}animate(){requestAnimationFrame(()=>this.animate()),this.time.value=this.clock.getElapsedTime(),this.startTime.value<1&&(this.startTime.value+=.01)}}const Ap={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class kl extends ji{constructor(e){super(e);T(this,"_type","Model");T(this,"_emissive",!1);T(this,"_emissiveIntensity",1);T(this,"_emissiveColor","#ffffff");T(this,"_mixer",null);T(this,"_currentAction",null);T(this,"_animations",[]);T(this,"_clock",new m.Clock);T(this,"_autoUpdate",!0);T(this,"_animationRequestId",null);T(this,"_iscity",!1);this._emissive=e.emissive||!1,this._emissiveIntensity=e.emissiveIntensity||1,this._emissiveColor=e.emissiveColor||"#ffffff",this.castShadow=e.castShadow||!1,this.receiveShadow=e.receiveShadow||!1,this._iscity=e.iscity||!1}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new m.AnimationMixer(this._threeGeometry),this._startAnimationLoop(),this.playAnimation({name:this._animations[0].name,loop:!0,speed:1.5,fadeInDuration:.5,fadeOutDuration:.3})),this._updateGeometry(),this.setShadows({cast:this.castShadow,receive:this.receiveShadow}),this._applyEmissionProperties(),this._iscity&&this._rendercity())}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return Yf(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const n=e.material;n&&(n.emissiveIntensity=this._emissive?this._emissiveIntensity:0,n.emissive&&n.emissive.setStyle(this._emissiveColor))}})}get emissive(){return this._emissive}set emissive(e){this._emissive=e,this._applyEmissionProperties()}get emissiveIntensity(){return this._emissiveIntensity}set emissiveIntensity(e){this._emissiveIntensity=e,this._applyEmissionProperties()}get emissiveColor(){return this._emissiveColor}set emissiveColor(e){this._emissiveColor=e,this._applyEmissionProperties()}setEmission(e,n,i){this._emissive=e,n!==void 0&&(this._emissiveIntensity=n),i!==void 0&&(this._emissiveColor=i),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(n=>{n.isMesh&&n.material&&(n.castShadow=e.cast,n.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const n=typeof e.name=="number"?this._animations[e.name]:this._animations.find(i=>i.name===e.name);if(!n){console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(n),this._currentAction.setLoop(e.loop?m.LoopRepeat:m.LoopOnce,e.loop?1/0:1),this._currentAction.timeScale=e.speed||1,this._currentAction.time=e.startAt||0,this._currentAction.setEffectiveWeight(e.weight||1),e.fadeInDuration&&e.fadeInDuration>0&&this._currentAction.fadeIn(e.fadeInDuration),this._currentAction.play(),this._autoUpdate&&this._animationRequestId===null&&this._startAnimationLoop()}stopAnimation(e={}){this._currentAction&&(e.fadeDuration&&e.fadeDuration>0?(this._currentAction.fadeOut(e.fadeDuration),setTimeout(()=>{this._currentAction&&(this._currentAction.stop(),this._currentAction=null)},e.fadeDuration*1e3)):(this._currentAction.stop(),this._currentAction=null))}setAnimationPaused(e){this._currentAction&&(this._currentAction.paused=e.paused)}setAnimationSpeed(e){this._currentAction&&(this._currentAction.timeScale=e.speed)}updateAnimation(e){this._mixer&&this._mixer.update(e.deltaTime)}getAnimationNames(){return this._animations.map(e=>e.name)}getCurrentAnimationName(){return this._currentAction?this._currentAction.getClip().name:null}getAnimationDuration(e){let n;return typeof e.name=="number"?n=this._animations[e.name]:n=this._animations.find(i=>i.name===e.name),n?n.duration:null}dispose(){this._stopAnimationLoop(),this._mixer&&(this._mixer.stopAllAction(),this._mixer.uncacheRoot(this._threeGeometry)),super.dispose()}_startAnimationLoop(){if(!this._autoUpdate||this._animationRequestId!==null)return;const e=()=>{if(this._mixer){const n=this._clock.getDelta();this._mixer.update(n)}this._animationRequestId=requestAnimationFrame(e)};this._clock.start(),this._animationRequestId=requestAnimationFrame(e)}_stopAnimationLoop(){this._animationRequestId!==null&&(cancelAnimationFrame(this._animationRequestId),this._animationRequestId=null),this._clock.stop()}setAutoUpdate(e){this._autoUpdate=e,e?this._startAnimationLoop():this._stopAnimationLoop()}_computeOverlayVertices(e){const n=e.feature;if(n&&Array.isArray(n._vertexPoints)&&n._vertexPoints.length>=6){const d=n.getMap?.()||this.getMap();if(d&&d.prjcenter){const p=d.prjcenter,f=n._vertexPoints,y=[];for(let v=0;v+2<f.length;v+=3){const x=f[v],S=f[v+2],_=p.x+x,Z=p.z+S;y.push(new m.Vector2(_,Z))}if(y.length>=3)return y}}const i=this.getMap();if(!i||!e.geometry)return null;const s=e.geometry;let l;if(s.type==="Polygon")l=s.coordinates;else if(s.type==="MultiPolygon"){if(!s.coordinates.length)return null;l=s.coordinates[0]}else return null;if(!l.length||!l[0].length)return null;const u=l[0],c=[];for(const d of u){const p=d[0],f=d[1],y=i.geo2world(new m.Vector3(p,f,0));c.push(new m.Vector2(y.x,y.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let n=null;if(e&&e.getRegionOverlays){const i=e.getRegionOverlays()||[];if(i.length){const s=i.filter(u=>(u.mode??"overlay")==="overlay").sort((u,c)=>(u.zIndex??0)-(c.zIndex??0)),l=s[s.length-1];if(l&&(l.geometry||l.feature)){const u=this._computeOverlayVertices(l);u&&u.length>=3&&(n={color:new m.Color(l.color??"#00FF88"),opacity:l.opacity??.3,vertices:u})}}}this.traverse(async i=>{if(i instanceof m.Mesh&&i.material){if(i.castShadow=!0,i.name==="building"){const s=new Vp({color:new m.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new m.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new m.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new m.Color("#ffffff"),width:3,speed:5}}},regionOverlay:n||void 0}),l=new m.Box3().setFromObject(i);s.updateBoundingBox(l.min.y,l.max.y),s.setDiffusionFromObject(i),i.material=s,i.material.needsUpdate=!0}i.name==="grass"&&(i.castShadow=!1,i.receiveShadow=!0,i.material.color=new m.Color("#81e4d8ff)").multiplyScalar(.7),i.material.metalness=.2,i.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(s=>{const l=i.material[s];l&&(l.wrapS=l.wrapT=m.RepeatWrapping,l.repeat.set(.3,.3),l.needsUpdate=!0)}),i.material.normalScale=new m.Vector2(3,3))}})}}kl.mergeOptions(Ap);const Fp={};class Ol extends ji{constructor(e){super(e);T(this,"_type","Cloud")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._disposeGeometry();const e=this.getLayer();this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry.renderOrder=99,e&&(e._clouds.add(this._threeGeometry),e._clouds.updateMatrixWorld()))}async _createObject(e){switch(e.config.type){case"cloud":return Jf(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Ol.mergeOptions(Fp);const Xp={};class Rl extends ji{constructor(e){super(e);T(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return Hf(e.config,new m.Vector3(0,0,0),this.getMap());case"canvas-label":return Qf(e.config,new m.Vector3(0,0,0));default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Rl.mergeOptions(Xp);const zp={};class Kl extends ji{constructor(e){super(e);T(this,"_type","TPoints");T(this,"_geometries");this._geometries=e.geometries}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._threeGeometry&&(this._threeGeometry.points&&this.add(this._threeGeometry.points),this._threeGeometry.InstancedCol&&this.add(this._threeGeometry.InstancedCol),this.updateMatrixWorld(!0))}async _createObject(e){switch(e.config.type){case"light":return ep(e.config,this._geometries,this.getMap());default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Kl.mergeOptions(zp);function Pr(a,t){if(!a||a===!0)return!0;if(!Array.isArray(a))return!!a;switch(a[0]){case"all":return a.slice(1).every(n=>Pr(n,t));case"any":return a.slice(1).some(n=>Pr(n,t));case"!":return!Pr(a[1],t);case"==":{const n=st(a[1],t),i=st(a[2],t);return Ir(n)==Ir(i)}case"!=":{const n=st(a[1],t),i=st(a[2],t);return Ir(n)!=Ir(i)}case">":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)>Tn(i)}case"<":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)<Tn(i)}case">=":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)>=Tn(i)}case"<=":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)<=Tn(i)}case"in":{const n=st(a[1],t);return a.slice(2).map(s=>st(s,t)).includes(n)}case"!in":{const n=st(a[1],t);return!a.slice(2).map(s=>st(s,t)).includes(n)}case"has":{const n=a[1];return t!=null&&Object.prototype.hasOwnProperty.call(t,n)}case"!has":{const n=a[1];return!(t!=null&&Object.prototype.hasOwnProperty.call(t,n))}default:return!0}}function st(a,t){if(Array.isArray(a))switch(a[0]){case"get":return t?t[a[1]]:void 0;default:return a}return a}function Ir(a){if(a==null)return null;if(typeof a=="string"){const t=Number(a);if(!isNaN(t)&&a.trim()!=="")return t}return typeof a=="boolean"?a?1:0:a}function Tn(a){if(a==null)return 0;if(typeof a=="number")return a;if(typeof a=="boolean")return a?1:0;if(typeof a=="string"){const t=Number(a);return isNaN(t)?0:t}return Number(a)}class lo extends Bn{constructor(e,n){super(e,n);T(this,"TILE_SIZE");T(this,"EXTENT");T(this,"style");T(this,"_tileFeatureMap",new Map);T(this,"_activeFeatureFilter");this.TILE_SIZE=n.tileSize??256,this.EXTENT=n.extent??4096,this.style=n.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,n){const i=this.getMap(),s=`${e.z}-${e.x}-${e.y}`,l=this._tileFeatureMap.get(s);if(l&&l.length>0){l.forEach(p=>{p.visible=!0,this.children.some(f=>f&&p&&f.uuid===p.uuid)||p.addTo(this)});return}const u=n.vectorData;if(!u||!u.layers||!i||this.style.length===0)return;const c=[],d=this.style;Object.keys(u.layers).forEach(p=>{const f=u.layers[p];for(let y=0;y<f.length;y++){const v=f[y],x=v.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(v.properties))continue;let S=null;for(const _ of d)if(this._evaluateFilter(_.filter,v.properties,p,v.geometry.type)){S=_.style;break}if(S){const _={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:x,extent:this.EXTENT,tileSize:this.TILE_SIZE},Z=this._createFeatureInstance(v.geometry,v.geometry.type,S,v.properties);Z&&(Z.userData.tileData=_,Z.style=Wt.create(S),Z.addTo(this),Z.initializeGeometry(),c.push(Z))}}}),this._tileFeatureMap.set(s,c)}_evaluateFilter(e,n,i,s){if(!e||e===!0)return!0;const l={...n,$layer:i,$type:s};return Pr(e,l)}hideFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&n.forEach(i=>{i.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&(n.forEach(i=>{i._remove()}),this._tileFeatureMap.delete(e))}_createFeatureInstance(e,n,i,s){const u={geometry:{ismvt:!0,...e},style:i,userData:s};switch(n){case"Point":return new so(u);case"LineString":return new oo(u);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(n=>{n.forEach(i=>{i.material&&(i.material.opacity=e,i.material.transparent=e<1)})})}_onMapUpdate(){}validateFeature(e){return e instanceof hn}dispose(){this._tileFeatureMap.forEach((e,n)=>{this._removeFeaturesByTileKey(n)}),super.dispose()}}class Yl extends Tr{constructor(e,n){super(e,n);T(this,"isTileLayer",!0);T(this,"layerType","base");T(this,"isBaseLayer",!1);T(this,"_enabled",!0);T(this,"_visible",!0);T(this,"_rootTile");T(this,"_loader");T(this,"_LODThreshold",1);T(this,"isSceneLayer",!1);T(this,"opacity",1);T(this,"source");T(this,"projection");T(this,"minLevel",2);T(this,"maxLevel",19);this.layerId=e,this.source=n.source,this.projection=n.projection,this.minLevel=n.minLevel??2,this.maxLevel=n.maxLevel??19,this._LODThreshold=n.LODThreshold??1,this.opacity=n.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new tn,this._rootTile.matrixAutoUpdate=!0,this._rootTile.scale.set(this.projection.mapWidth,this.projection.mapHeight,1),this.add(this._rootTile),this._rootTile.updateMatrix(),this.layerId=e,this.name==="Layer-label-layer"&&this.position.set(0,0,1)}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}get loader(){return this._loader}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._rootTile&&(this._rootTile.visible=e&&this._visible)}get ivisible(){return this._visible&&super._visible}set ivisible(e){this._visible=e,this._rootTile&&(this._rootTile.visible=e&&this._enabled)}update(e){if(!(!this._enabled||!this._visible)){try{this._rootTile.update({camera:e,loader:this._loader,minLevel:this.minLevel,maxLevel:this.maxLevel,LODThreshold:this.LODThreshold})}catch{}console.groupEnd()}}_debugTileTree(){this._rootTile.traverse(e=>{e.isTile&&(e.loaded,e.visible,e.inFrustum,e.loaded)})}_getLODThreshold(){return 1}_getCurrentTileLevel(){let e=0;return this._rootTile.traverse(n=>{n.isTile&&n.loaded&&(e=Math.max(e,n.z))}),`最大层级: ${e}`}dispose(){this.remove(this._rootTile),this._rootTile.reload(this._loader)}reload(){this._rootTile.reload(this._loader)}setElevation(e){this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0)}raiseElevation(e){this.position.z+=e,this.updateMatrix(),this.updateMatrixWorld(!0)}getElevation(){return this.position.y}}class Ul extends m.LoadingManager{constructor(){super(...arguments);T(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const Xe={manager:new Ul,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(a){Xe.imgLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ts.name},registerGeometryLoader(a){Xe.demLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ts.name},registerMeshLoader(a){Xe.meshLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ts.name},getMaterialLoader(a){const t=Xe.imgLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getGeometryLoader(a){const t=Xe.demLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getMeshLoader(a){const t=Xe.meshLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`}};class Dp{constructor(t){T(this,"worker");this.worker=t()}async run(t,e){return new Promise(n=>{this.worker.onmessage=i=>{n(i.data)},this.worker.postMessage(t,e)})}terminate(){this.worker.terminate()}}const kp=4096,Bl=Math.PI;function co(a,t){const e=Math.floor(a[0]*t),n=Math.floor(a[1]*t),i=Math.floor((a[2]-a[0])*t),s=Math.floor((a[3]-a[1])*t);return{sx:e,sy:n,sw:i,sh:s}}function uo(a,t,e,n){if(n<a.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(n<=a.maxLevel)return{url:a._getUrl(t,e,n),clipBounds:[0,0,1,1]};const i=Op(t,e,n,a.maxLevel),s=i.parentNO;return{url:a._getUrl(s.x,s.y,s.z),clipBounds:i.bounds}}function Op(a,t,e,n){const i=e-n,s={x:a>>i,y:t>>i,z:e-i},l=Math.pow(2,i),u=Math.pow(.5,i),c=a%l/l-.5+u/2,d=t%l/l-.5+u/2,p=new m.Vector2(c,d),f=new m.Box2().setFromCenterAndSize(p,new m.Vector2(u,u)),y=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:y}}function ho(a,t,e,n,i=kp){const{x:s,y:l}=a,u=(t+s/i)/Math.pow(2,n),c=(e+l/i)/Math.pow(2,n),d=u*360-180,f=Math.atan(Math.sinh(Bl*(1-2*c)))*180/Bl;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Rp(a,t,e,n){if(!a||!a.coordinates)throw new Error("无效的geometry数据格式");const i={type:a.type,coordinates:null};function s(l){if(typeof l=="object"&&l.x!==void 0&&l.y!==void 0)return ho(l,t,e,n);if(Array.isArray(l)&&l.length>0){const u=l[0];return typeof u=="object"&&u.x!==void 0&&u.y!==void 0?l.map(c=>ho(c,t,e,n)):l.map(c=>s(c))}return l}return i.coordinates=s(a.coordinates),i}class Cr{constructor(){T(this,"_imgSource",[]);T(this,"_demSource");T(this,"_vtSource");T(this,"manager",Xe.manager)}get imgSource(){return this._imgSource}set imgSource(t){this._imgSource=t}get demSource(){return this._demSource}set demSource(t){this._demSource=t}get vtSource(){return this._vtSource}set vtSource(t){this._vtSource=t}async load(t){const e=await this.loadGeometry(t),n=await this.loadMaterial(t);console.assert(!!n&&!!e);for(let i=0;i<n.length;i++)e.addGroup(0,1/0,i);return{materials:n,geometry:e}}unload(t){const e=t.material,n=t.geometry;for(let i=0;i<e.length;i++)e[i].dispose();n.dispose()}async loadGeometry(t){let e;if(this.demSource&&t.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,t.bounds)){const n=Xe.getGeometryLoader(this.demSource),i=this.demSource;e=await n.load({source:i,...t}).catch(s=>(console.error("Load material error",i.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else if(this.vtSource&&t.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,t.bounds)){const n=Xe.getMeshLoader(this.vtSource),i=this.vtSource;e=await n.load({source:i,...t}).catch(s=>(console.error("Load geometry error",i.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else e=new m.PlaneGeometry;return e}async loadMaterial(t){const n=this.imgSource.filter(i=>t.z>=i.minLevel&&this._isBoundsInSourceBounds(i,t.bounds)).map(async i=>{const s=Xe.getMaterialLoader(i),l=await s.load({source:i,...t}).catch(c=>(console.error("Load material error",i.dataType,t.x,t.y,t.z),new m.MeshBasicMaterial)),u=c=>{s.unload&&s.unload(c.target),c.target.removeEventListener("dispose",u)};return l instanceof m.MeshBasicMaterial||l.addEventListener("dispose",u),l});return Promise.all(n)}_isBoundsInSourceBounds(t,e){const n=t._projectionBounds;return!(e[2]<n[0]||e[3]<n[1]||e[0]>n[2]||e[1]>n[3])}}function Ji(...a){const t=a,e=t&&t.length>1&&t[0].constructor||null;if(!e)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const n=t.reduce((l,u)=>l+u.length,0),i=new e(n);let s=0;for(const l of t)i.set(l,s),s+=l.length;return i}function Nl(a,t,e,n){const i=n?Yp(n,a.position.value):Kp(t),s=i.length,l=new Float32Array(s*6),u=new Float32Array(s*4),c=new t.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Up({edge:i[f],edgeIndex:f,attributes:a,skirtHeight:e,newPosition:l,newTexcoord0:u,newTriangles:c,newNormals:d});a.position.value=Ji(a.position.value,l),a.texcoord.value=Ji(a.texcoord.value,u),a.normal.value=Ji(a.normal.value,d);const p=Ji(t,c);return{attributes:a,indices:p}}function Kp(a){const t=[],e=Array.isArray(a)?a:Array.from(a);for(let i=0;i<e.length;i+=3){const s=e[i],l=e[i+1],u=e[i+2];t.push([s,l],[l,u],[u,s])}t.sort(([i,s],[l,u])=>{const c=Math.min(i,s),d=Math.min(l,u);return c!==d?c-d:Math.max(i,s)-Math.max(l,u)});const n=[];for(let i=0;i<t.length;i++)i+1<t.length&&t[i][0]===t[i+1][1]&&t[i][1]===t[i+1][0]?i++:n.push(t[i]);return n}function Yp(a,t){const e=(i,s)=>{i.sort(s)};e(a.westIndices,(i,s)=>t[3*i+1]-t[3*s+1]),e(a.eastIndices,(i,s)=>t[3*s+1]-t[3*i+1]),e(a.southIndices,(i,s)=>t[3*s]-t[3*i]),e(a.northIndices,(i,s)=>t[3*i]-t[3*s]);const n=[];return Object.values(a).forEach(i=>{if(i.length>1)for(let s=0;s<i.length-1;s++)n.push([i[s],i[s+1]])}),n}function Up({edge:a,edgeIndex:t,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:s,newTriangles:l,newNormals:u}){const c=e.position.value.length,d=t*2,p=d+1;i.set(e.position.value.subarray(a[0]*3,a[0]*3+3),d*3),i[d*3+2]=i[d*3+2]-n,i.set(e.position.value.subarray(a[1]*3,a[1]*3+3),p*3),i[p*3+2]=i[p*3+2]-n,s.set(e.texcoord.value.subarray(a[0]*2,a[0]*2+2),d*2),s.set(e.texcoord.value.subarray(a[1]*2,a[1]*2+2),p*2);const f=t*2*3;l[f]=a[0],l[f+1]=c/3+p,l[f+2]=a[1],l[f+3]=c/3+p,l[f+4]=a[0],l[f+5]=c/3+d,u[f]=0,u[f+1]=0,u[f+2]=1,u[f+3]=0,u[f+4]=0,u[f+5]=1}function jl(a){if(a.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${a.length}!`);const t=Math.floor(Math.sqrt(a.length)),e=t,n=t,i=fo(n,e);return{attributes:Bp(a,n,e),indices:i}}function Bp(a,t,e){const n=e*t,i=new Float32Array(n*3),s=new Float32Array(n*2);let l=0;for(let u=0;u<t;u++)for(let c=0;c<e;c++){const d=c/(e-1),p=u/(t-1);s[l*2]=d,s[l*2+1]=p,i[l*3]=d-.5,i[l*3+1]=p-.5,i[l*3+2]=a[(t-u-1)*e+c],l++}return{position:{value:i,size:3},texcoord:{value:s,size:2},normal:{value:po(i,fo(t,e)),size:3}}}function fo(a,t){const e=6*(t-1)*(a-1),n=new Uint16Array(e);let i=0;for(let s=0;s<a-1;s++)for(let l=0;l<t-1;l++){const u=s*t+l,c=u+1,d=u+t,p=d+1,f=i*6;n[f]=u,n[f+1]=c,n[f+2]=d,n[f+3]=d,n[f+4]=c,n[f+5]=p,i++}return n}function po(a,t){const e=new Float32Array(a.length);for(let n=0;n<t.length;n+=3){const i=t[n]*3,s=t[n+1]*3,l=t[n+2]*3,u=a[i],c=a[i+1],d=a[i+2],p=a[s],f=a[s+1],y=a[s+2],v=a[l],x=a[l+1],S=a[l+2],_=p-u,Z=f-c,M=y-d,G=v-u,A=x-c,R=S-d,D=Z*R-M*A,k=M*G-_*R,C=_*A-Z*G,K=Math.sqrt(D*D+k*k+C*C),I=[0,0,1];if(K>0){const z=1/K;I[0]=D*z,I[1]=k*z,I[2]=C*z}for(let z=0;z<3;z++)e[i+z]=e[s+z]=e[l+z]=I[z]}return e}class fi extends m.PlaneGeometry{constructor(){super(...arguments);T(this,"type","TileGeometry")}setData(e,n=1e3){let i=e instanceof Float32Array?jl(e):e;i=Nl(i.attributes,i.indices,n);const{attributes:s,indices:l}=i;return this.setIndex(new m.BufferAttribute(l,1)),this.setAttribute("position",new m.BufferAttribute(s.position.value,s.position.size)),this.setAttribute("uv",new m.BufferAttribute(s.texcoord.value,s.texcoord.size)),this.setAttribute("normal",new m.BufferAttribute(s.normal.value,s.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}class Jl{constructor(t=257){T(this,"gridSize");T(this,"numTriangles");T(this,"numParentTriangles");T(this,"indices");T(this,"coords");this.gridSize=t;const e=t-1;if(e&e-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=e*e*2-2,this.numParentTriangles=this.numTriangles-e*e,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let i=n+2,s=0,l=0,u=0,c=0,d=0,p=0;for(i&1?u=c=d=e:s=l=p=e;(i>>=1)>1;){const y=s+u>>1,v=l+c>>1;i&1?(u=s,c=l,s=d,l=p):(s=u,l=c,u=d,c=p),d=y,p=v}const f=n*4;this.coords[f+0]=s,this.coords[f+1]=l,this.coords[f+2]=u,this.coords[f+3]=c}}createTile(t){return new Np(t,this)}}class Np{constructor(t,e){T(this,"martini");T(this,"terrain");T(this,"errors");const n=e.gridSize;if(t.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${t.length}.`);this.terrain=t,this.martini=e,this.errors=new Float32Array(t.length),this.update()}update(){const{numTriangles:t,numParentTriangles:e,coords:n,gridSize:i}=this.martini,{terrain:s,errors:l}=this;for(let u=t-1;u>=0;u--){const c=u*4,d=n[c+0],p=n[c+1],f=n[c+2],y=n[c+3],v=d+f>>1,x=p+y>>1,S=v+x-p,_=x+d-v,Z=(s[p*i+d]+s[y*i+f])/2,M=x*i+v,G=Math.abs(Z-s[M]);if(l[M]=Math.max(l[M],G),u<e){const A=(p+_>>1)*i+(d+S>>1),R=(y+_>>1)*i+(f+S>>1);l[M]=Math.max(l[M],l[A],l[R])}}}getGeometryData(t=0){const{gridSize:e,indices:n}=this.martini,{errors:i}=this;let s=0,l=0;const u=e-1;let c,d,p=0;n.fill(0);function f(M,G,A,R,D,k){const C=M+A>>1,K=G+R>>1;Math.abs(M-D)+Math.abs(G-k)>1&&i[K*e+C]>t?(f(D,k,M,G,C,K),f(A,R,D,k,C,K)):(c=G*e+M,d=R*e+A,p=k*e+D,n[c]===0&&(n[c]=++s),n[d]===0&&(n[d]=++s),n[p]===0&&(n[p]=++s),l++)}f(0,0,u,u,u,0),f(u,u,0,0,0,u);const y=s*2,v=l*3,x=new Uint16Array(y),S=new Uint32Array(v);let _=0;function Z(M,G,A,R,D,k){const C=M+A>>1,K=G+R>>1;if(Math.abs(M-D)+Math.abs(G-k)>1&&i[K*e+C]>t)Z(D,k,M,G,C,K),Z(A,R,D,k,C,K);else{const I=n[G*e+M]-1,z=n[R*e+A]-1,N=n[k*e+D]-1;x[2*I]=M,x[2*I+1]=G,x[2*z]=A,x[2*z+1]=R,x[2*N]=D,x[2*N+1]=k,S[_++]=I,S[_++]=z,S[_++]=N}}return Z(0,0,u,u,u,0),Z(u,u,0,0,0,u),{attributes:this._getMeshAttributes(this.terrain,x,S),indices:S}}_getMeshAttributes(t,e,n){const i=Math.floor(Math.sqrt(t.length)),s=i-1,l=e.length/2,u=new Float32Array(l*3),c=new Float32Array(l*2);for(let p=0;p<l;p++){const f=e[p*2],y=e[p*2+1],v=y*i+f;u[3*p+0]=f/s-.5,u[3*p+1]=.5-y/s,u[3*p+2]=t[v],c[2*p+0]=f/s,c[2*p+1]=1-y/s}const d=po(u,n);return{position:{value:u,size:3},texcoord:{value:c,size:2},normal:{value:d,size:3}}}}class mo{constructor(){T(this,"info",{version:"0.10.0",description:"Terrain loader base class"});T(this,"dataType","")}async load(t){const{source:e,x:n,y:i,z:s}=t,{url:l,clipBounds:u}=uo(e,n,i,s);if(!l)return new fi;const c=await this.doLoad(l,{source:e,x:n,y:i,z:s,bounds:u});return Xe.manager.parseEnd(l),c}}class go extends m.MeshStandardMaterial{constructor(t={}){super({transparent:!0,side:m.FrontSide,...t})}setTexture(t){this.map=t,this.needsUpdate=!0}dispose(){const t=this.map;t&&(t.image instanceof ImageBitmap&&t.image.close(),t.dispose())}}var tt=(a=>(a[a.Unknown=0]="Unknown",a[a.Point=1]="Point",a[a.Linestring=2]="Linestring",a[a.Polygon=3]="Polygon",a))(tt||{});class Ql{render(t,e,n,i,s=1){switch(t.lineCap="round",t.lineJoin="round",(i.shadowBlur??0)>0&&(t.shadowBlur=i.shadowBlur??2,t.shadowColor=i.shadowColor??"black",t.shadowOffsetX=i.shadowOffset?i.shadowOffset[0]:0,t.shadowOffsetY=i.shadowOffset?i.shadowOffset[1]:0),e){case tt.Point:t.textAlign="center",t.textBaseline="middle",t.font=i.font??"14px Arial",t.fillStyle=i.fontColor??"white",this._renderPointText(t,n,s,i.textField??"name",i.fontOffset??[0,-8]);break;case tt.Linestring:this._renderLineString(t,n,s);break;case tt.Polygon:this._renderPolygon(t,n,s);break;default:console.warn(`Unknown feature type: ${e}`)}(i.fill||e===tt.Point)&&(t.globalAlpha=i.fillOpacity||.5,t.fillStyle=i.fillColor||i.color||"#3388ff",t.fill(i.fillRule||"evenodd")),(i.stroke??!0)&&(i.weight??1)>0&&(t.globalAlpha=i.opacity||1,t.lineWidth=i.weight||1,t.strokeStyle=i.color||"#3388ff",t.setLineDash(i.dashArray||[]),t.stroke())}_renderPointText(t,e,n=1,i="name",s=[0,0]){const l=e.geometry;t.beginPath();for(const c of l)for(let d=0;d<c.length;d++){const p=c[d];t.arc(p.x*n,p.y*n,2,0,2*Math.PI)}const u=e.properties;u&&u[i]&&t.fillText(u[i],l[0][0].x*n+s[0],l[0][0].y*n+s[1])}_renderLineString(t,e,n){const i=e.geometry;t.beginPath();for(const s of i)for(let l=0;l<s.length;l++){const{x:u,y:c}=s[l];l===0?t.moveTo(u*n,c*n):t.lineTo(u*n,c*n)}}_renderPolygon(t,e,n){const i=e.geometry;t.beginPath();for(let s=0;s<i.length;s++){const l=i[s];for(let u=0;u<l.length;u++){const{x:c,y:d}=l[u];u===0?t.moveTo(c*n,d*n):t.lineTo(c*n,d*n)}t.closePath()}}}class yo{constructor(){T(this,"info",{version:"0.10.0",description:"Image loader base class"});T(this,"dataType","")}async load(t){const{source:e,x:n,y:i,z:s}=t,l=new go,{url:u,clipBounds:c}=uo(e,n,i,s);if(u){const d=await this.doLoad(u,{source:e,x:n,y:i,z:s,bounds:c});l.map=d,Xe.manager.parseEnd(u)}return l}}class jp{constructor(){T(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"});T(this,"dataType","")}async load(t){const e=this._creatCanvasContext(256,256);this.drawTile(e,t);const n=new m.CanvasTexture(e.canvas.transferToImageBitmap());return new go({transparent:!0,map:n,opacity:t.source.opacity})}_creatCanvasContext(t,e){const i=new OffscreenCanvas(t,e).getContext("2d");if(!i)throw new Error("create canvas context failed");return i.scale(1,-1),i.translate(0,-e),i}}class Jp extends yo{constructor(){super(...arguments);T(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."});T(this,"dataType","image");T(this,"loader",new m.ImageLoader(Xe.manager))}async doLoad(e,n){const i=await this.loader.loadAsync(e).catch(u=>new Image(1,1)),s=new m.Texture;s.colorSpace=m.SRGBColorSpace;const{bounds:l}=n;return l[2]-l[0]<1?s.image=Qp(i,l):s.image=i,s.needsUpdate=!0,s}}function Qp(a,t){const e=a.width,n=new OffscreenCanvas(e,e),i=n.getContext("2d"),{sx:s,sy:l,sw:u,sh:c}=co(t,a.width);return i.drawImage(a,s,l,u,c,0,0,e,e),n}const Hp=`{
|
|
693
|
+
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const n=new rt.Box3().setFromObject(e);if(n.isEmpty())return;const i=new rt.Vector3;n.getCenter(i);const s=[new rt.Vector3(n.min.x,n.min.y,n.min.z),new rt.Vector3(n.max.x,n.max.y,n.max.z)];let l=0;s.forEach(u=>{const c=i.distanceTo(u);c>l&&(l=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:l},this.needsUpdate=!0}updateBoundingBox(e,n){this.shaderOption.minY=e,this.shaderOption.maxY=n,this.needsUpdate=!0}updateEffects(e){this.shaderOption.effects={...this.shaderOption.effects,...e},this.needsUpdate=!0}animate(){requestAnimationFrame(()=>this.animate()),this.time.value=this.clock.getElapsedTime(),this.startTime.value<1&&(this.startTime.value+=.01)}}const Ap={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class kl extends ji{constructor(e){super(e);T(this,"_type","Model");T(this,"_emissive",!1);T(this,"_emissiveIntensity",1);T(this,"_emissiveColor","#ffffff");T(this,"_mixer",null);T(this,"_currentAction",null);T(this,"_animations",[]);T(this,"_clock",new m.Clock);T(this,"_autoUpdate",!0);T(this,"_animationRequestId",null);T(this,"_iscity",!1);this._emissive=e.emissive||!1,this._emissiveIntensity=e.emissiveIntensity||1,this._emissiveColor=e.emissiveColor||"#ffffff",this.castShadow=e.castShadow||!1,this.receiveShadow=e.receiveShadow||!1,this._iscity=e.iscity||!1}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new m.AnimationMixer(this._threeGeometry),this._startAnimationLoop(),this.playAnimation({name:this._animations[0].name,loop:!0,speed:1.5,fadeInDuration:.5,fadeOutDuration:.3})),this._updateGeometry(),this.setShadows({cast:this.castShadow,receive:this.receiveShadow}),this._applyEmissionProperties(),this._iscity&&this._rendercity())}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return Yf(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const n=e.material;n&&(n.emissiveIntensity=this._emissive?this._emissiveIntensity:0,n.emissive&&n.emissive.setStyle(this._emissiveColor))}})}get emissive(){return this._emissive}set emissive(e){this._emissive=e,this._applyEmissionProperties()}get emissiveIntensity(){return this._emissiveIntensity}set emissiveIntensity(e){this._emissiveIntensity=e,this._applyEmissionProperties()}get emissiveColor(){return this._emissiveColor}set emissiveColor(e){this._emissiveColor=e,this._applyEmissionProperties()}setEmission(e,n,i){this._emissive=e,n!==void 0&&(this._emissiveIntensity=n),i!==void 0&&(this._emissiveColor=i),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(n=>{n.isMesh&&n.material&&(n.castShadow=e.cast,n.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const n=typeof e.name=="number"?this._animations[e.name]:this._animations.find(i=>i.name===e.name);if(!n){console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(n),this._currentAction.setLoop(e.loop?m.LoopRepeat:m.LoopOnce,e.loop?1/0:1),this._currentAction.timeScale=e.speed||1,this._currentAction.time=e.startAt||0,this._currentAction.setEffectiveWeight(e.weight||1),e.fadeInDuration&&e.fadeInDuration>0&&this._currentAction.fadeIn(e.fadeInDuration),this._currentAction.play(),this._autoUpdate&&this._animationRequestId===null&&this._startAnimationLoop()}stopAnimation(e={}){this._currentAction&&(e.fadeDuration&&e.fadeDuration>0?(this._currentAction.fadeOut(e.fadeDuration),setTimeout(()=>{this._currentAction&&(this._currentAction.stop(),this._currentAction=null)},e.fadeDuration*1e3)):(this._currentAction.stop(),this._currentAction=null))}setAnimationPaused(e){this._currentAction&&(this._currentAction.paused=e.paused)}setAnimationSpeed(e){this._currentAction&&(this._currentAction.timeScale=e.speed)}updateAnimation(e){this._mixer&&this._mixer.update(e.deltaTime)}getAnimationNames(){return this._animations.map(e=>e.name)}getCurrentAnimationName(){return this._currentAction?this._currentAction.getClip().name:null}getAnimationDuration(e){let n;return typeof e.name=="number"?n=this._animations[e.name]:n=this._animations.find(i=>i.name===e.name),n?n.duration:null}dispose(){this._stopAnimationLoop(),this._mixer&&(this._mixer.stopAllAction(),this._mixer.uncacheRoot(this._threeGeometry)),super.dispose()}_startAnimationLoop(){if(!this._autoUpdate||this._animationRequestId!==null)return;const e=()=>{if(this._mixer){const n=this._clock.getDelta();this._mixer.update(n)}this._animationRequestId=requestAnimationFrame(e)};this._clock.start(),this._animationRequestId=requestAnimationFrame(e)}_stopAnimationLoop(){this._animationRequestId!==null&&(cancelAnimationFrame(this._animationRequestId),this._animationRequestId=null),this._clock.stop()}setAutoUpdate(e){this._autoUpdate=e,e?this._startAnimationLoop():this._stopAnimationLoop()}_computeOverlayVertices(e){const n=e.feature;if(n&&Array.isArray(n._vertexPoints)&&n._vertexPoints.length>=6){const d=n.getMap?.()||this.getMap();if(d&&d.prjcenter){const p=d.prjcenter,f=n._vertexPoints,y=[];for(let v=0;v+2<f.length;v+=3){const x=f[v],S=f[v+2],_=p.x+x,Z=p.z+S;y.push(new m.Vector2(_,Z))}if(y.length>=3)return y}}const i=this.getMap();if(!i||!e.geometry)return null;const s=e.geometry;let l;if(s.type==="Polygon")l=s.coordinates;else if(s.type==="MultiPolygon"){if(!s.coordinates.length)return null;l=s.coordinates[0]}else return null;if(!l.length||!l[0].length)return null;const u=l[0],c=[];for(const d of u){const p=d[0],f=d[1],y=i.geo2world(new m.Vector3(p,f,0));c.push(new m.Vector2(y.x,y.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let n=null;if(e&&e.getRegionOverlays){const i=e.getRegionOverlays()||[];if(i.length){const s=i.filter(u=>(u.mode??"overlay")==="overlay").sort((u,c)=>(u.zIndex??0)-(c.zIndex??0)),l=s[s.length-1];if(l&&(l.geometry||l.feature)){const u=this._computeOverlayVertices(l);u&&u.length>=3&&(n={color:new m.Color(l.color??"#00FF88"),opacity:l.opacity??.3,vertices:u})}}}this.traverse(async i=>{if(i instanceof m.Mesh&&i.material){if(i.castShadow=!0,i.name==="building"){const s=new Vp({color:new m.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new m.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new m.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new m.Color("#ffffff"),width:3,speed:5}}},regionOverlay:n||void 0}),l=new m.Box3().setFromObject(i);s.updateBoundingBox(l.min.y,l.max.y),s.setDiffusionFromObject(i),i.receiveShadow=!1,i.material=s,i.material.needsUpdate=!0}i.name==="grass"&&(i.castShadow=!1,i.receiveShadow=!0,i.material.color=new m.Color("#81e4d8ff)").multiplyScalar(.7),i.material.metalness=.2,i.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(s=>{const l=i.material[s];l&&(l.wrapS=l.wrapT=m.RepeatWrapping,l.repeat.set(.3,.3),l.needsUpdate=!0)}),i.material.normalScale=new m.Vector2(3,3))}})}}kl.mergeOptions(Ap);const Fp={};class Ol extends ji{constructor(e){super(e);T(this,"_type","Cloud")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._disposeGeometry();const e=this.getLayer();this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry.renderOrder=99,e&&(e._clouds.add(this._threeGeometry),e._clouds.updateMatrixWorld()))}async _createObject(e){switch(e.config.type){case"cloud":return Jf(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Ol.mergeOptions(Fp);const Xp={};class Rl extends ji{constructor(e){super(e);T(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return Hf(e.config,new m.Vector3(0,0,0),this.getMap());case"canvas-label":return Qf(e.config,new m.Vector3(0,0,0));default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Rl.mergeOptions(Xp);const zp={};class Kl extends ji{constructor(e){super(e);T(this,"_type","TPoints");T(this,"_geometries");this._geometries=e.geometries}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._threeGeometry&&(this._threeGeometry.points&&this.add(this._threeGeometry.points),this._threeGeometry.InstancedCol&&this.add(this._threeGeometry.InstancedCol),this.updateMatrixWorld(!0))}async _createObject(e){switch(e.config.type){case"light":return ep(e.config,this._geometries,this.getMap());default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Kl.mergeOptions(zp);function Pr(a,t){if(!a||a===!0)return!0;if(!Array.isArray(a))return!!a;switch(a[0]){case"all":return a.slice(1).every(n=>Pr(n,t));case"any":return a.slice(1).some(n=>Pr(n,t));case"!":return!Pr(a[1],t);case"==":{const n=st(a[1],t),i=st(a[2],t);return Ir(n)==Ir(i)}case"!=":{const n=st(a[1],t),i=st(a[2],t);return Ir(n)!=Ir(i)}case">":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)>Tn(i)}case"<":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)<Tn(i)}case">=":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)>=Tn(i)}case"<=":{const n=st(a[1],t),i=st(a[2],t);return Tn(n)<=Tn(i)}case"in":{const n=st(a[1],t);return a.slice(2).map(s=>st(s,t)).includes(n)}case"!in":{const n=st(a[1],t);return!a.slice(2).map(s=>st(s,t)).includes(n)}case"has":{const n=a[1];return t!=null&&Object.prototype.hasOwnProperty.call(t,n)}case"!has":{const n=a[1];return!(t!=null&&Object.prototype.hasOwnProperty.call(t,n))}default:return!0}}function st(a,t){if(Array.isArray(a))switch(a[0]){case"get":return t?t[a[1]]:void 0;default:return a}return a}function Ir(a){if(a==null)return null;if(typeof a=="string"){const t=Number(a);if(!isNaN(t)&&a.trim()!=="")return t}return typeof a=="boolean"?a?1:0:a}function Tn(a){if(a==null)return 0;if(typeof a=="number")return a;if(typeof a=="boolean")return a?1:0;if(typeof a=="string"){const t=Number(a);return isNaN(t)?0:t}return Number(a)}class lo extends Bn{constructor(e,n){super(e,n);T(this,"TILE_SIZE");T(this,"EXTENT");T(this,"style");T(this,"_tileFeatureMap",new Map);T(this,"_activeFeatureFilter");this.TILE_SIZE=n.tileSize??256,this.EXTENT=n.extent??4096,this.style=n.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,n){const i=this.getMap(),s=`${e.z}-${e.x}-${e.y}`,l=this._tileFeatureMap.get(s);if(l&&l.length>0){l.forEach(p=>{p.visible=!0,this.children.some(f=>f&&p&&f.uuid===p.uuid)||p.addTo(this)});return}const u=n.vectorData;if(!u||!u.layers||!i||this.style.length===0)return;const c=[],d=this.style;Object.keys(u.layers).forEach(p=>{const f=u.layers[p];for(let y=0;y<f.length;y++){const v=f[y],x=v.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(v.properties))continue;let S=null;for(const _ of d)if(this._evaluateFilter(_.filter,v.properties,p,v.geometry.type)){S=_.style;break}if(S){const _={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:x,extent:this.EXTENT,tileSize:this.TILE_SIZE},Z=this._createFeatureInstance(v.geometry,v.geometry.type,S,v.properties);Z&&(Z.userData.tileData=_,Z.style=Wt.create(S),Z.addTo(this),Z.initializeGeometry(),c.push(Z))}}}),this._tileFeatureMap.set(s,c)}_evaluateFilter(e,n,i,s){if(!e||e===!0)return!0;const l={...n,$layer:i,$type:s};return Pr(e,l)}hideFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&n.forEach(i=>{i.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&(n.forEach(i=>{i._remove()}),this._tileFeatureMap.delete(e))}_createFeatureInstance(e,n,i,s){const u={geometry:{ismvt:!0,...e},style:i,userData:s};switch(n){case"Point":return new so(u);case"LineString":return new oo(u);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(n=>{n.forEach(i=>{i.material&&(i.material.opacity=e,i.material.transparent=e<1)})})}_onMapUpdate(){}validateFeature(e){return e instanceof hn}dispose(){this._tileFeatureMap.forEach((e,n)=>{this._removeFeaturesByTileKey(n)}),super.dispose()}}class Yl extends Tr{constructor(e,n){super(e,n);T(this,"isTileLayer",!0);T(this,"layerType","base");T(this,"isBaseLayer",!1);T(this,"_enabled",!0);T(this,"_visible",!0);T(this,"_rootTile");T(this,"_loader");T(this,"_LODThreshold",1);T(this,"isSceneLayer",!1);T(this,"opacity",1);T(this,"source");T(this,"projection");T(this,"minLevel",2);T(this,"maxLevel",19);this.layerId=e,this.source=n.source,this.projection=n.projection,this.minLevel=n.minLevel??2,this.maxLevel=n.maxLevel??19,this._LODThreshold=n.LODThreshold??1,this.opacity=n.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new tn,this._rootTile.matrixAutoUpdate=!0,this._rootTile.scale.set(this.projection.mapWidth,this.projection.mapHeight,1),this.add(this._rootTile),this._rootTile.updateMatrix(),this.layerId=e,this.name==="Layer-label-layer"&&this.position.set(0,0,1)}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}get loader(){return this._loader}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._rootTile&&(this._rootTile.visible=e&&this._visible)}get ivisible(){return this._visible&&super._visible}set ivisible(e){this._visible=e,this._rootTile&&(this._rootTile.visible=e&&this._enabled)}update(e){if(!(!this._enabled||!this._visible)){try{this._rootTile.update({camera:e,loader:this._loader,minLevel:this.minLevel,maxLevel:this.maxLevel,LODThreshold:this.LODThreshold})}catch{}console.groupEnd()}}_debugTileTree(){this._rootTile.traverse(e=>{e.isTile&&(e.loaded,e.visible,e.inFrustum,e.loaded)})}_getLODThreshold(){return 1}_getCurrentTileLevel(){let e=0;return this._rootTile.traverse(n=>{n.isTile&&n.loaded&&(e=Math.max(e,n.z))}),`最大层级: ${e}`}dispose(){this.remove(this._rootTile),this._rootTile.reload(this._loader)}reload(){this._rootTile.reload(this._loader)}setElevation(e){this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0)}raiseElevation(e){this.position.z+=e,this.updateMatrix(),this.updateMatrixWorld(!0)}getElevation(){return this.position.y}}class Ul extends m.LoadingManager{constructor(){super(...arguments);T(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const Xe={manager:new Ul,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(a){Xe.imgLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ts.name},registerGeometryLoader(a){Xe.demLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ts.name},registerMeshLoader(a){Xe.meshLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ts.name},getMaterialLoader(a){const t=Xe.imgLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getGeometryLoader(a){const t=Xe.demLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getMeshLoader(a){const t=Xe.meshLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`}};class Dp{constructor(t){T(this,"worker");this.worker=t()}async run(t,e){return new Promise(n=>{this.worker.onmessage=i=>{n(i.data)},this.worker.postMessage(t,e)})}terminate(){this.worker.terminate()}}const kp=4096,Bl=Math.PI;function co(a,t){const e=Math.floor(a[0]*t),n=Math.floor(a[1]*t),i=Math.floor((a[2]-a[0])*t),s=Math.floor((a[3]-a[1])*t);return{sx:e,sy:n,sw:i,sh:s}}function uo(a,t,e,n){if(n<a.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(n<=a.maxLevel)return{url:a._getUrl(t,e,n),clipBounds:[0,0,1,1]};const i=Op(t,e,n,a.maxLevel),s=i.parentNO;return{url:a._getUrl(s.x,s.y,s.z),clipBounds:i.bounds}}function Op(a,t,e,n){const i=e-n,s={x:a>>i,y:t>>i,z:e-i},l=Math.pow(2,i),u=Math.pow(.5,i),c=a%l/l-.5+u/2,d=t%l/l-.5+u/2,p=new m.Vector2(c,d),f=new m.Box2().setFromCenterAndSize(p,new m.Vector2(u,u)),y=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:y}}function ho(a,t,e,n,i=kp){const{x:s,y:l}=a,u=(t+s/i)/Math.pow(2,n),c=(e+l/i)/Math.pow(2,n),d=u*360-180,f=Math.atan(Math.sinh(Bl*(1-2*c)))*180/Bl;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Rp(a,t,e,n){if(!a||!a.coordinates)throw new Error("无效的geometry数据格式");const i={type:a.type,coordinates:null};function s(l){if(typeof l=="object"&&l.x!==void 0&&l.y!==void 0)return ho(l,t,e,n);if(Array.isArray(l)&&l.length>0){const u=l[0];return typeof u=="object"&&u.x!==void 0&&u.y!==void 0?l.map(c=>ho(c,t,e,n)):l.map(c=>s(c))}return l}return i.coordinates=s(a.coordinates),i}class Cr{constructor(){T(this,"_imgSource",[]);T(this,"_demSource");T(this,"_vtSource");T(this,"manager",Xe.manager)}get imgSource(){return this._imgSource}set imgSource(t){this._imgSource=t}get demSource(){return this._demSource}set demSource(t){this._demSource=t}get vtSource(){return this._vtSource}set vtSource(t){this._vtSource=t}async load(t){const e=await this.loadGeometry(t),n=await this.loadMaterial(t);console.assert(!!n&&!!e);for(let i=0;i<n.length;i++)e.addGroup(0,1/0,i);return{materials:n,geometry:e}}unload(t){const e=t.material,n=t.geometry;for(let i=0;i<e.length;i++)e[i].dispose();n.dispose()}async loadGeometry(t){let e;if(this.demSource&&t.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,t.bounds)){const n=Xe.getGeometryLoader(this.demSource),i=this.demSource;e=await n.load({source:i,...t}).catch(s=>(console.error("Load material error",i.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else if(this.vtSource&&t.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,t.bounds)){const n=Xe.getMeshLoader(this.vtSource),i=this.vtSource;e=await n.load({source:i,...t}).catch(s=>(console.error("Load geometry error",i.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else e=new m.PlaneGeometry;return e}async loadMaterial(t){const n=this.imgSource.filter(i=>t.z>=i.minLevel&&this._isBoundsInSourceBounds(i,t.bounds)).map(async i=>{const s=Xe.getMaterialLoader(i),l=await s.load({source:i,...t}).catch(c=>(console.error("Load material error",i.dataType,t.x,t.y,t.z),new m.MeshBasicMaterial)),u=c=>{s.unload&&s.unload(c.target),c.target.removeEventListener("dispose",u)};return l instanceof m.MeshBasicMaterial||l.addEventListener("dispose",u),l});return Promise.all(n)}_isBoundsInSourceBounds(t,e){const n=t._projectionBounds;return!(e[2]<n[0]||e[3]<n[1]||e[0]>n[2]||e[1]>n[3])}}function Ji(...a){const t=a,e=t&&t.length>1&&t[0].constructor||null;if(!e)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const n=t.reduce((l,u)=>l+u.length,0),i=new e(n);let s=0;for(const l of t)i.set(l,s),s+=l.length;return i}function Nl(a,t,e,n){const i=n?Yp(n,a.position.value):Kp(t),s=i.length,l=new Float32Array(s*6),u=new Float32Array(s*4),c=new t.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Up({edge:i[f],edgeIndex:f,attributes:a,skirtHeight:e,newPosition:l,newTexcoord0:u,newTriangles:c,newNormals:d});a.position.value=Ji(a.position.value,l),a.texcoord.value=Ji(a.texcoord.value,u),a.normal.value=Ji(a.normal.value,d);const p=Ji(t,c);return{attributes:a,indices:p}}function Kp(a){const t=[],e=Array.isArray(a)?a:Array.from(a);for(let i=0;i<e.length;i+=3){const s=e[i],l=e[i+1],u=e[i+2];t.push([s,l],[l,u],[u,s])}t.sort(([i,s],[l,u])=>{const c=Math.min(i,s),d=Math.min(l,u);return c!==d?c-d:Math.max(i,s)-Math.max(l,u)});const n=[];for(let i=0;i<t.length;i++)i+1<t.length&&t[i][0]===t[i+1][1]&&t[i][1]===t[i+1][0]?i++:n.push(t[i]);return n}function Yp(a,t){const e=(i,s)=>{i.sort(s)};e(a.westIndices,(i,s)=>t[3*i+1]-t[3*s+1]),e(a.eastIndices,(i,s)=>t[3*s+1]-t[3*i+1]),e(a.southIndices,(i,s)=>t[3*s]-t[3*i]),e(a.northIndices,(i,s)=>t[3*i]-t[3*s]);const n=[];return Object.values(a).forEach(i=>{if(i.length>1)for(let s=0;s<i.length-1;s++)n.push([i[s],i[s+1]])}),n}function Up({edge:a,edgeIndex:t,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:s,newTriangles:l,newNormals:u}){const c=e.position.value.length,d=t*2,p=d+1;i.set(e.position.value.subarray(a[0]*3,a[0]*3+3),d*3),i[d*3+2]=i[d*3+2]-n,i.set(e.position.value.subarray(a[1]*3,a[1]*3+3),p*3),i[p*3+2]=i[p*3+2]-n,s.set(e.texcoord.value.subarray(a[0]*2,a[0]*2+2),d*2),s.set(e.texcoord.value.subarray(a[1]*2,a[1]*2+2),p*2);const f=t*2*3;l[f]=a[0],l[f+1]=c/3+p,l[f+2]=a[1],l[f+3]=c/3+p,l[f+4]=a[0],l[f+5]=c/3+d,u[f]=0,u[f+1]=0,u[f+2]=1,u[f+3]=0,u[f+4]=0,u[f+5]=1}function jl(a){if(a.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${a.length}!`);const t=Math.floor(Math.sqrt(a.length)),e=t,n=t,i=fo(n,e);return{attributes:Bp(a,n,e),indices:i}}function Bp(a,t,e){const n=e*t,i=new Float32Array(n*3),s=new Float32Array(n*2);let l=0;for(let u=0;u<t;u++)for(let c=0;c<e;c++){const d=c/(e-1),p=u/(t-1);s[l*2]=d,s[l*2+1]=p,i[l*3]=d-.5,i[l*3+1]=p-.5,i[l*3+2]=a[(t-u-1)*e+c],l++}return{position:{value:i,size:3},texcoord:{value:s,size:2},normal:{value:po(i,fo(t,e)),size:3}}}function fo(a,t){const e=6*(t-1)*(a-1),n=new Uint16Array(e);let i=0;for(let s=0;s<a-1;s++)for(let l=0;l<t-1;l++){const u=s*t+l,c=u+1,d=u+t,p=d+1,f=i*6;n[f]=u,n[f+1]=c,n[f+2]=d,n[f+3]=d,n[f+4]=c,n[f+5]=p,i++}return n}function po(a,t){const e=new Float32Array(a.length);for(let n=0;n<t.length;n+=3){const i=t[n]*3,s=t[n+1]*3,l=t[n+2]*3,u=a[i],c=a[i+1],d=a[i+2],p=a[s],f=a[s+1],y=a[s+2],v=a[l],x=a[l+1],S=a[l+2],_=p-u,Z=f-c,M=y-d,G=v-u,A=x-c,R=S-d,D=Z*R-M*A,k=M*G-_*R,C=_*A-Z*G,K=Math.sqrt(D*D+k*k+C*C),I=[0,0,1];if(K>0){const z=1/K;I[0]=D*z,I[1]=k*z,I[2]=C*z}for(let z=0;z<3;z++)e[i+z]=e[s+z]=e[l+z]=I[z]}return e}class fi extends m.PlaneGeometry{constructor(){super(...arguments);T(this,"type","TileGeometry")}setData(e,n=1e3){let i=e instanceof Float32Array?jl(e):e;i=Nl(i.attributes,i.indices,n);const{attributes:s,indices:l}=i;return this.setIndex(new m.BufferAttribute(l,1)),this.setAttribute("position",new m.BufferAttribute(s.position.value,s.position.size)),this.setAttribute("uv",new m.BufferAttribute(s.texcoord.value,s.texcoord.size)),this.setAttribute("normal",new m.BufferAttribute(s.normal.value,s.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}class Jl{constructor(t=257){T(this,"gridSize");T(this,"numTriangles");T(this,"numParentTriangles");T(this,"indices");T(this,"coords");this.gridSize=t;const e=t-1;if(e&e-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=e*e*2-2,this.numParentTriangles=this.numTriangles-e*e,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let i=n+2,s=0,l=0,u=0,c=0,d=0,p=0;for(i&1?u=c=d=e:s=l=p=e;(i>>=1)>1;){const y=s+u>>1,v=l+c>>1;i&1?(u=s,c=l,s=d,l=p):(s=u,l=c,u=d,c=p),d=y,p=v}const f=n*4;this.coords[f+0]=s,this.coords[f+1]=l,this.coords[f+2]=u,this.coords[f+3]=c}}createTile(t){return new Np(t,this)}}class Np{constructor(t,e){T(this,"martini");T(this,"terrain");T(this,"errors");const n=e.gridSize;if(t.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${t.length}.`);this.terrain=t,this.martini=e,this.errors=new Float32Array(t.length),this.update()}update(){const{numTriangles:t,numParentTriangles:e,coords:n,gridSize:i}=this.martini,{terrain:s,errors:l}=this;for(let u=t-1;u>=0;u--){const c=u*4,d=n[c+0],p=n[c+1],f=n[c+2],y=n[c+3],v=d+f>>1,x=p+y>>1,S=v+x-p,_=x+d-v,Z=(s[p*i+d]+s[y*i+f])/2,M=x*i+v,G=Math.abs(Z-s[M]);if(l[M]=Math.max(l[M],G),u<e){const A=(p+_>>1)*i+(d+S>>1),R=(y+_>>1)*i+(f+S>>1);l[M]=Math.max(l[M],l[A],l[R])}}}getGeometryData(t=0){const{gridSize:e,indices:n}=this.martini,{errors:i}=this;let s=0,l=0;const u=e-1;let c,d,p=0;n.fill(0);function f(M,G,A,R,D,k){const C=M+A>>1,K=G+R>>1;Math.abs(M-D)+Math.abs(G-k)>1&&i[K*e+C]>t?(f(D,k,M,G,C,K),f(A,R,D,k,C,K)):(c=G*e+M,d=R*e+A,p=k*e+D,n[c]===0&&(n[c]=++s),n[d]===0&&(n[d]=++s),n[p]===0&&(n[p]=++s),l++)}f(0,0,u,u,u,0),f(u,u,0,0,0,u);const y=s*2,v=l*3,x=new Uint16Array(y),S=new Uint32Array(v);let _=0;function Z(M,G,A,R,D,k){const C=M+A>>1,K=G+R>>1;if(Math.abs(M-D)+Math.abs(G-k)>1&&i[K*e+C]>t)Z(D,k,M,G,C,K),Z(A,R,D,k,C,K);else{const I=n[G*e+M]-1,z=n[R*e+A]-1,N=n[k*e+D]-1;x[2*I]=M,x[2*I+1]=G,x[2*z]=A,x[2*z+1]=R,x[2*N]=D,x[2*N+1]=k,S[_++]=I,S[_++]=z,S[_++]=N}}return Z(0,0,u,u,u,0),Z(u,u,0,0,0,u),{attributes:this._getMeshAttributes(this.terrain,x,S),indices:S}}_getMeshAttributes(t,e,n){const i=Math.floor(Math.sqrt(t.length)),s=i-1,l=e.length/2,u=new Float32Array(l*3),c=new Float32Array(l*2);for(let p=0;p<l;p++){const f=e[p*2],y=e[p*2+1],v=y*i+f;u[3*p+0]=f/s-.5,u[3*p+1]=.5-y/s,u[3*p+2]=t[v],c[2*p+0]=f/s,c[2*p+1]=1-y/s}const d=po(u,n);return{position:{value:u,size:3},texcoord:{value:c,size:2},normal:{value:d,size:3}}}}class mo{constructor(){T(this,"info",{version:"0.10.0",description:"Terrain loader base class"});T(this,"dataType","")}async load(t){const{source:e,x:n,y:i,z:s}=t,{url:l,clipBounds:u}=uo(e,n,i,s);if(!l)return new fi;const c=await this.doLoad(l,{source:e,x:n,y:i,z:s,bounds:u});return Xe.manager.parseEnd(l),c}}class go extends m.MeshStandardMaterial{constructor(t={}){super({transparent:!0,side:m.FrontSide,...t})}setTexture(t){this.map=t,this.needsUpdate=!0}dispose(){const t=this.map;t&&(t.image instanceof ImageBitmap&&t.image.close(),t.dispose())}}var tt=(a=>(a[a.Unknown=0]="Unknown",a[a.Point=1]="Point",a[a.Linestring=2]="Linestring",a[a.Polygon=3]="Polygon",a))(tt||{});class Ql{render(t,e,n,i,s=1){switch(t.lineCap="round",t.lineJoin="round",(i.shadowBlur??0)>0&&(t.shadowBlur=i.shadowBlur??2,t.shadowColor=i.shadowColor??"black",t.shadowOffsetX=i.shadowOffset?i.shadowOffset[0]:0,t.shadowOffsetY=i.shadowOffset?i.shadowOffset[1]:0),e){case tt.Point:t.textAlign="center",t.textBaseline="middle",t.font=i.font??"14px Arial",t.fillStyle=i.fontColor??"white",this._renderPointText(t,n,s,i.textField??"name",i.fontOffset??[0,-8]);break;case tt.Linestring:this._renderLineString(t,n,s);break;case tt.Polygon:this._renderPolygon(t,n,s);break;default:console.warn(`Unknown feature type: ${e}`)}(i.fill||e===tt.Point)&&(t.globalAlpha=i.fillOpacity||.5,t.fillStyle=i.fillColor||i.color||"#3388ff",t.fill(i.fillRule||"evenodd")),(i.stroke??!0)&&(i.weight??1)>0&&(t.globalAlpha=i.opacity||1,t.lineWidth=i.weight||1,t.strokeStyle=i.color||"#3388ff",t.setLineDash(i.dashArray||[]),t.stroke())}_renderPointText(t,e,n=1,i="name",s=[0,0]){const l=e.geometry;t.beginPath();for(const c of l)for(let d=0;d<c.length;d++){const p=c[d];t.arc(p.x*n,p.y*n,2,0,2*Math.PI)}const u=e.properties;u&&u[i]&&t.fillText(u[i],l[0][0].x*n+s[0],l[0][0].y*n+s[1])}_renderLineString(t,e,n){const i=e.geometry;t.beginPath();for(const s of i)for(let l=0;l<s.length;l++){const{x:u,y:c}=s[l];l===0?t.moveTo(u*n,c*n):t.lineTo(u*n,c*n)}}_renderPolygon(t,e,n){const i=e.geometry;t.beginPath();for(let s=0;s<i.length;s++){const l=i[s];for(let u=0;u<l.length;u++){const{x:c,y:d}=l[u];u===0?t.moveTo(c*n,d*n):t.lineTo(c*n,d*n)}t.closePath()}}}class yo{constructor(){T(this,"info",{version:"0.10.0",description:"Image loader base class"});T(this,"dataType","")}async load(t){const{source:e,x:n,y:i,z:s}=t,l=new go,{url:u,clipBounds:c}=uo(e,n,i,s);if(u){const d=await this.doLoad(u,{source:e,x:n,y:i,z:s,bounds:c});l.map=d,Xe.manager.parseEnd(u)}return l}}class jp{constructor(){T(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"});T(this,"dataType","")}async load(t){const e=this._creatCanvasContext(256,256);this.drawTile(e,t);const n=new m.CanvasTexture(e.canvas.transferToImageBitmap());return new go({transparent:!0,map:n,opacity:t.source.opacity})}_creatCanvasContext(t,e){const i=new OffscreenCanvas(t,e).getContext("2d");if(!i)throw new Error("create canvas context failed");return i.scale(1,-1),i.translate(0,-e),i}}class Jp extends yo{constructor(){super(...arguments);T(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."});T(this,"dataType","image");T(this,"loader",new m.ImageLoader(Xe.manager))}async doLoad(e,n){const i=await this.loader.loadAsync(e).catch(u=>new Image(1,1)),s=new m.Texture;s.colorSpace=m.SRGBColorSpace;const{bounds:l}=n;return l[2]-l[0]<1?s.image=Qp(i,l):s.image=i,s.needsUpdate=!0,s}}function Qp(a,t){const e=a.width,n=new OffscreenCanvas(e,e),i=n.getContext("2d"),{sx:s,sy:l,sw:u,sh:c}=co(t,a.width);return i.drawImage(a,s,l,u,c,0,0,e,e),n}const Hp=`{
|
|
694
694
|
"name": "@terra.gl/core",
|
|
695
|
-
"version": "0.0.1-alpha.
|
|
695
|
+
"version": "0.0.1-alpha.20",
|
|
696
696
|
"type": "module",
|
|
697
697
|
"files": [
|
|
698
698
|
"dist"
|