@terra.gl/core 0.0.1-alpha.62 → 0.0.1-alpha.63
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.d.ts +37 -0
- package/dist/index.js +4229 -4061
- package/dist/index.umd.cjs +60 -39
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(q,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],p):(q=typeof globalThis<"u"?globalThis:q||self,p(q["terra-gl"]={},q.THREE))})(this,function(q,p){"use strict";function uf(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const
|
|
1
|
+
(function(q,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],p):(q=typeof globalThis<"u"?globalThis:q||self,p(q["terra-gl"]={},q.THREE))})(this,function(q,p){"use strict";function uf(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ht=uf(p),df="0.0.1-alpha.63",wo={name:"Criska"};var ur=function(){var r=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++r%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(var f=0;f<e.children.length;f++)e.children[f].style.display=f===m?"block":"none";r=m}var n=(performance||Date).now(),o=n,a=0,c=t(new ur.Panel("FPS","#0ff","#002")),h=t(new ur.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new ur.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){n=(performance||Date).now()},end:function(){a++;var m=(performance||Date).now();if(h.update(m-n,200),m>=o+1e3&&(c.update(a*1e3/(m-o),100),o=m,a=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return m},update:function(){n=this.end()},domElement:e,setMode:i}};ur.Panel=function(r,e,t){var i=1/0,n=0,o=Math.round,a=o(window.devicePixelRatio||1),c=80*a,h=48*a,d=3*a,m=2*a,f=3*a,g=15*a,v=74*a,w=30*a,b=document.createElement("canvas");b.width=c,b.height=h,b.style.cssText="width:80px;height:48px";var x=b.getContext("2d");return x.font="bold "+9*a+"px Helvetica,Arial,sans-serif",x.textBaseline="top",x.fillStyle=t,x.fillRect(0,0,c,h),x.fillStyle=e,x.fillText(r,d,m),x.fillRect(f,g,v,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f,g,v,w),{dom:b,update:function(L,M){i=Math.min(i,L),n=Math.max(n,L),x.fillStyle=t,x.globalAlpha=1,x.fillRect(0,0,c,g),x.fillStyle=e,x.fillText(o(L)+" "+r+" ("+o(i)+"-"+o(n)+")",d,m),x.drawImage(b,f+a,g,v-a,w,f,g,v-a,w),x.fillRect(f+v-a,g,a,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f+v-a,g,a,o((1-L/M)*w))}}};const qr=parseInt(p.REVISION.replace(/\D+/g,"")),bo=qr>=125?"uv1":"uv2";function Fl(r,e){if(e===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===p.TriangleFanDrawMode||e===p.TriangleStripDrawMode){let t=r.getIndex();if(t===null){const a=[],c=r.getAttribute("position");if(c!==void 0){for(let h=0;h<c.count;h++)a.push(h);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const i=t.count-2,n=[];if(t)if(e===p.TriangleFanDrawMode)for(let a=1;a<=i;a++)n.push(t.getX(0)),n.push(t.getX(a)),n.push(t.getX(a+1));else for(let a=0;a<i;a++)a%2===0?(n.push(t.getX(a)),n.push(t.getX(a+1)),n.push(t.getX(a+2))):(n.push(t.getX(a+2)),n.push(t.getX(a+1)),n.push(t.getX(a)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=r.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var kt=Uint8Array,Di=Uint16Array,xo=Uint32Array,Ol=new kt([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]),Dl=new kt([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]),ff=new kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zl=function(r,e){for(var t=new Di(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new xo(t[30]),i=1;i<30;++i)for(var o=t[i];o<t[i+1];++o)n[o]=o-t[i]<<5|i;return[t,n]},Xl=zl(Ol,2),Ul=Xl[0],pf=Xl[1];Ul[28]=258,pf[258]=28;for(var mf=zl(Dl,0),gf=mf[0],Mo=new Di(32768),Ze=0;Ze<32768;++Ze){var zi=(Ze&43690)>>>1|(Ze&21845)<<1;zi=(zi&52428)>>>2|(zi&13107)<<2,zi=(zi&61680)>>>4|(zi&3855)<<4,Mo[Ze]=((zi&65280)>>>8|(zi&255)<<8)>>>1}for(var dr=function(r,e,t){for(var i=r.length,n=0,o=new Di(e);n<i;++n)++o[r[n]-1];var a=new Di(e);for(n=0;n<e;++n)a[n]=a[n-1]+o[n-1]<<1;var c;if(t){c=new Di(1<<e);var h=15-e;for(n=0;n<i;++n)if(r[n])for(var d=n<<4|r[n],m=e-r[n],f=a[r[n]-1]++<<m,g=f|(1<<m)-1;f<=g;++f)c[Mo[f]>>>h]=d}else for(c=new Di(i),n=0;n<i;++n)r[n]&&(c[n]=Mo[a[r[n]-1]++]>>>15-r[n]);return c},fr=new kt(288),Ze=0;Ze<144;++Ze)fr[Ze]=8;for(var Ze=144;Ze<256;++Ze)fr[Ze]=9;for(var Ze=256;Ze<280;++Ze)fr[Ze]=7;for(var Ze=280;Ze<288;++Ze)fr[Ze]=8;for(var kl=new kt(32),Ze=0;Ze<32;++Ze)kl[Ze]=5;var yf=dr(fr,9,1),vf=dr(kl,5,1),So=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},ei=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Lo=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},_f=function(r){return(r/8|0)+(r&7&&1)},wf=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Di?Di:r instanceof xo?xo:kt)(t-e);return i.set(r.subarray(e,t)),i},bf=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new kt(0);var n=!e||t,o=!t||t.i;t||(t={}),e||(e=new kt(i*3));var a=function(ft){var He=e.length;if(ft>He){var Re=new kt(Math.max(He*2,ft));Re.set(e),e=Re}},c=t.f||0,h=t.p||0,d=t.b||0,m=t.l,f=t.d,g=t.m,v=t.n,w=i*8;do{if(!m){t.f=c=ei(r,h,1);var b=ei(r,h+1,3);if(h+=3,b)if(b==1)m=yf,f=vf,g=9,v=5;else if(b==2){var C=ei(r,h,31)+257,W=ei(r,h+10,15)+4,z=C+ei(r,h+5,31)+1;h+=14;for(var D=new kt(z),X=new kt(19),I=0;I<W;++I)X[ff[I]]=ei(r,h+I*3,7);h+=W*3;for(var K=So(X),V=(1<<K)-1,G=dr(X,K,1),I=0;I<z;){var k=G[ei(r,h,V)];h+=k&15;var x=k>>>4;if(x<16)D[I++]=x;else{var j=0,Y=0;for(x==16?(Y=3+ei(r,h,3),h+=2,j=D[I-1]):x==17?(Y=3+ei(r,h,7),h+=3):x==18&&(Y=11+ei(r,h,127),h+=7);Y--;)D[I++]=j}}var H=D.subarray(0,C),Q=D.subarray(C);g=So(H),v=So(Q),m=dr(H,g,1),f=dr(Q,v,1)}else throw"invalid block type";else{var x=_f(h)+4,L=r[x-4]|r[x-3]<<8,M=x+L;if(M>i){if(o)throw"unexpected EOF";break}n&&a(d+L),e.set(r.subarray(x,M),d),t.b=d+=L,t.p=h=M*8;continue}if(h>w){if(o)throw"unexpected EOF";break}}n&&a(d+131072);for(var re=(1<<g)-1,ne=(1<<v)-1,le=h;;le=h){var j=m[Lo(r,h)&re],de=j>>>4;if(h+=j&15,h>w){if(o)throw"unexpected EOF";break}if(!j)throw"invalid length/literal";if(de<256)e[d++]=de;else if(de==256){le=h,m=null;break}else{var ge=de-254;if(de>264){var I=de-257,fe=Ol[I];ge=ei(r,h,(1<<fe)-1)+Ul[I],h+=fe}var Se=f[Lo(r,h)&ne],rt=Se>>>4;if(!Se)throw"invalid distance";h+=Se&15;var Q=gf[rt];if(rt>3){var fe=Dl[rt];Q+=Lo(r,h)&(1<<fe)-1,h+=fe}if(h>w){if(o)throw"unexpected EOF";break}n&&a(d+131072);for(var st=d+ge;d<st;d+=4)e[d]=e[d-Q],e[d+1]=e[d+1-Q],e[d+2]=e[d+2-Q],e[d+3]=e[d+3-Q];d=st}}t.l=m,t.p=le,t.b=d,m&&(c=1,t.m=g,t.d=f,t.n=v)}while(!c);return d==e.length?e:wf(e,0,d)},xf=new kt(0),Mf=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Sf(r,e){return bf((Mf(r),r.subarray(2,-4)),e)}var Lf=typeof TextDecoder<"u"&&new TextDecoder,Pf=0;try{Lf.decode(xf,{stream:!0}),Pf=1}catch{}class Cf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const i=this,n=t.textureWidth!==void 0?t.textureWidth:512,o=t.textureHeight!==void 0?t.textureHeight:512,a=t.clipBias!==void 0?t.clipBias:0,c=t.alpha!==void 0?t.alpha:1,h=t.time!==void 0?t.time:0,d=t.waterNormals!==void 0?t.waterNormals:null,m=t.sunDirection!==void 0?t.sunDirection:new p.Vector3(.70707,.70707,0),f=new p.Color(t.sunColor!==void 0?t.sunColor:16777215),g=new p.Color(t.waterColor!==void 0?t.waterColor:8355711),v=t.eye!==void 0?t.eye:new p.Vector3(0,0,0),w=t.distortionScale!==void 0?t.distortionScale:20,b=t.side!==void 0?t.side:p.FrontSide,x=t.fog!==void 0?t.fog:!1,L=new p.Plane,M=new p.Vector3,C=new p.Vector3,W=new p.Vector3,z=new p.Matrix4,D=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,K=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,k=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(n,o),Y={uniforms:p.UniformsUtils.merge([p.UniformsLib.fog,p.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new p.Matrix4},sunColor:{value:new p.Color(8355711)},sunDirection:{value:new p.Vector3(.70707,.70707,0)},eye:{value:new p.Vector3},waterColor:{value:new p.Color(5592405)}}]),vertexShader:`
|
|
2
2
|
uniform mat4 textureMatrix;
|
|
3
3
|
uniform float time;
|
|
4
4
|
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
#include <tonemapping_fragment>
|
|
95
95
|
#include <${qr>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
96
96
|
#include <fog_fragment>
|
|
97
|
-
}`},H=new p.ShaderMaterial({fragmentShader:Y.fragmentShader,vertexShader:Y.vertexShader,uniforms:p.UniformsUtils.clone(Y.uniforms),lights:!0,side:b,fog:x});H.uniforms.mirrorSampler.value=j.texture,H.uniforms.textureMatrix.value=G,H.uniforms.alpha.value=c,H.uniforms.time.value=u,H.uniforms.normalSampler.value=d,H.uniforms.sunColor.value=f,H.uniforms.waterColor.value=g,H.uniforms.sunDirection.value=m,H.uniforms.distortionScale.value=w,H.uniforms.eye.value=v,n.material=H,n.onBeforeRender=function(Q,re,ie){if(C.setFromMatrixPosition(n.matrixWorld),W.setFromMatrixPosition(ie.matrixWorld),z.extractRotation(n.matrixWorld),M.set(0,0,1),M.applyMatrix4(z),I.subVectors(C,W),I.dot(M)>0)return;I.reflect(M).negate(),I.add(C),z.extractRotation(ie.matrixWorld),D.set(0,0,-1),D.applyMatrix4(z),D.add(W),K.subVectors(C,D),K.reflect(M).negate(),K.add(C),k.position.copy(I),k.up.set(0,1,0),k.up.applyMatrix4(z),k.up.reflect(M),k.lookAt(K),k.far=ie.far,k.updateMatrixWorld(),k.projectionMatrix.copy(ie.projectionMatrix),G.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),G.multiply(k.projectionMatrix),G.multiply(k.matrixWorldInverse),L.setFromNormalAndCoplanarPoint(M,C),L.applyMatrix4(k.matrixWorldInverse),X.set(L.normal.x,L.normal.y,L.normal.z,L.constant);const le=k.projectionMatrix;V.x=(Math.sign(X.x)+le.elements[8])/le.elements[0],V.y=(Math.sign(X.y)+le.elements[9])/le.elements[5],V.z=-1,V.w=(1+le.elements[10])/le.elements[14],X.multiplyScalar(2/X.dot(V)),le.elements[2]=X.x,le.elements[6]=X.y,le.elements[10]=X.z+1-a,le.elements[14]=X.w,v.setFromMatrixPosition(ie.matrixWorld);const de=Q.getRenderTarget(),ge=Q.xr.enabled,fe=Q.shadowMap.autoUpdate;n.visible=!1,Q.xr.enabled=!1,Q.shadowMap.autoUpdate=!1,Q.setRenderTarget(j),Q.state.buffers.depth.setMask(!0),Q.autoClear===!1&&Q.clear(),Q.render(re,k),n.visible=!0,Q.xr.enabled=ge,Q.shadowMap.autoUpdate=fe,Q.setRenderTarget(de);const Se=ie.viewport;Se!==void 0&&Q.state.viewport(Se)}}}var Cf=Object.defineProperty,Tf=(r,e,t)=>e in r?Cf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gf=(r,e,t)=>(Tf(r,e+"",t),t);class Wf{constructor(){Gf(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let o=0,a=i.length;o<a;o++)i[o].call(this,e);e.target=null}}}var Zf=Object.defineProperty,Vf=(r,e,t)=>e in r?Zf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ne=(r,e,t)=>(Vf(r,typeof e!="symbol"?e+"":e,t),t);const es=new p.Ray,Kl=new p.Plane,If=Math.cos(70*(Math.PI/180)),Nl=(r,e)=>(r%e+e)%e;class Af extends Wf{constructor(e,t){super(),ne(this,"object"),ne(this,"domElement"),ne(this,"enabled",!0),ne(this,"target",new p.Vector3),ne(this,"minDistance",0),ne(this,"maxDistance",1/0),ne(this,"minZoom",0),ne(this,"maxZoom",1/0),ne(this,"minPolarAngle",0),ne(this,"maxPolarAngle",Math.PI),ne(this,"minAzimuthAngle",-1/0),ne(this,"maxAzimuthAngle",1/0),ne(this,"enableDamping",!1),ne(this,"dampingFactor",.05),ne(this,"enableZoom",!0),ne(this,"zoomSpeed",1),ne(this,"enableRotate",!0),ne(this,"rotateSpeed",1),ne(this,"enablePan",!0),ne(this,"panSpeed",1),ne(this,"screenSpacePanning",!0),ne(this,"keyPanSpeed",7),ne(this,"zoomToCursor",!1),ne(this,"autoRotate",!1),ne(this,"autoRotateSpeed",2),ne(this,"reverseOrbit",!1),ne(this,"reverseHorizontalOrbit",!1),ne(this,"reverseVerticalOrbit",!1),ne(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ne(this,"mouseButtons",{LEFT:p.MOUSE.ROTATE,MIDDLE:p.MOUSE.DOLLY,RIGHT:p.MOUSE.PAN}),ne(this,"touches",{ONE:p.TOUCH.ROTATE,TWO:p.TOUCH.DOLLY_PAN}),ne(this,"target0"),ne(this,"position0"),ne(this,"zoom0"),ne(this,"_domElementKeyEvents",null),ne(this,"getPolarAngle"),ne(this,"getAzimuthalAngle"),ne(this,"setPolarAngle"),ne(this,"setAzimuthalAngle"),ne(this,"getDistance"),ne(this,"getZoomScale"),ne(this,"listenToKeyEvents"),ne(this,"stopListenToKeyEvents"),ne(this,"saveState"),ne(this,"reset"),ne(this,"update"),ne(this,"connect"),ne(this,"dispose"),ne(this,"dollyIn"),ne(this,"dollyOut"),ne(this,"getScale"),ne(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>m.phi,this.getAzimuthalAngle=()=>m.theta,this.setPolarAngle=O=>{let E=Nl(O,2*Math.PI),ce=m.phi;ce<0&&(ce+=2*Math.PI),E<0&&(E+=2*Math.PI);let Me=Math.abs(E-ce);2*Math.PI-Me<Me&&(E<ce?E+=2*Math.PI:ce+=2*Math.PI),f.phi=E-ce,n.update()},this.setAzimuthalAngle=O=>{let E=Nl(O,2*Math.PI),ce=m.theta;ce<0&&(ce+=2*Math.PI),E<0&&(E+=2*Math.PI);let Me=Math.abs(E-ce);2*Math.PI-Me<Me&&(E<ce?E+=2*Math.PI:ce+=2*Math.PI),f.theta=E-ce,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=O=>{O.addEventListener("keydown",wn),this._domElementKeyEvents=O},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",wn),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=c.NONE},this.update=(()=>{const O=new p.Vector3,E=new p.Vector3(0,1,0),ce=new p.Quaternion().setFromUnitVectors(e.up,E),Me=ce.clone().invert(),Be=new p.Vector3,Bt=new p.Quaternion,sn=2*Math.PI;return function(){const Gs=n.object.position;ce.setFromUnitVectors(e.up,E),Me.copy(ce).invert(),O.copy(Gs).sub(n.target),O.applyQuaternion(ce),m.setFromVector3(O),n.autoRotate&&u===c.NONE&&Y(k()),n.enableDamping?(m.theta+=f.theta*n.dampingFactor,m.phi+=f.phi*n.dampingFactor):(m.theta+=f.theta,m.phi+=f.phi);let on=n.minAzimuthAngle,an=n.maxAzimuthAngle;isFinite(on)&&isFinite(an)&&(on<-Math.PI?on+=sn:on>Math.PI&&(on-=sn),an<-Math.PI?an+=sn:an>Math.PI&&(an-=sn),on<=an?m.theta=Math.max(on,Math.min(an,m.theta)):m.theta=m.theta>(on+an)/2?Math.max(on,m.theta):Math.min(an,m.theta)),m.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,m.phi)),m.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&K||n.object.isOrthographicCamera?m.radius=Se(m.radius):m.radius=Se(m.radius*g),O.setFromSpherical(m),O.applyQuaternion(Me),Gs.copy(n.target).add(O),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),v.set(0,0,0));let ni=!1;if(n.zoomToCursor&&K){let Pi=null;if(n.object instanceof p.PerspectiveCamera&&n.object.isPerspectiveCamera){const Ci=O.length();Pi=Se(Ci*g);const Qi=Ci-Pi;n.object.position.addScaledVector(X,Qi),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Ci=new p.Vector3(I.x,I.y,0);Ci.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/g)),n.object.updateProjectionMatrix(),ni=!0;const Qi=new p.Vector3(I.x,I.y,0);Qi.unproject(n.object),n.object.position.sub(Qi).add(Ci),n.object.updateMatrixWorld(),Pi=O.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Pi!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Pi).add(n.object.position):(es.origin.copy(n.object.position),es.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(es.direction))<If?e.lookAt(n.target):(Kl.setFromNormalAndCoplanarPoint(n.object.up,n.target),es.intersectPlane(Kl,n.target))))}else n.object instanceof p.OrthographicCamera&&n.object.isOrthographicCamera&&(ni=g!==1,ni&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/g)),n.object.updateProjectionMatrix()));return g=1,K=!1,ni||Be.distanceToSquared(n.object.position)>d||8*(1-Bt.dot(n.object.quaternion))>d?(n.dispatchEvent(i),Be.copy(n.object.position),Bt.copy(n.object.quaternion),ni=!1,!0):!1}})(),this.connect=O=>{n.domElement=O,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",ji),n.domElement.addEventListener("pointerdown",qn),n.domElement.addEventListener("pointercancel",Mi),n.domElement.addEventListener("wheel",ti)},this.dispose=()=>{var O,E,ce,Me,Be,Bt;n.domElement&&(n.domElement.style.touchAction="auto"),(O=n.domElement)==null||O.removeEventListener("contextmenu",ji),(E=n.domElement)==null||E.removeEventListener("pointerdown",qn),(ce=n.domElement)==null||ce.removeEventListener("pointercancel",Mi),(Me=n.domElement)==null||Me.removeEventListener("wheel",ti),(Be=n.domElement)==null||Be.ownerDocument.removeEventListener("pointermove",ei),(Bt=n.domElement)==null||Bt.ownerDocument.removeEventListener("pointerup",Mi),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",wn)};const n=this,i={type:"change"},o={type:"start"},a={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const d=1e-6,m=new p.Spherical,f=new p.Spherical;let g=1;const v=new p.Vector3,w=new p.Vector2,b=new p.Vector2,x=new p.Vector2,L=new p.Vector2,M=new p.Vector2,C=new p.Vector2,W=new p.Vector2,z=new p.Vector2,D=new p.Vector2,X=new p.Vector3,I=new p.Vector2;let K=!1;const V=[],G={};function k(){return 2*Math.PI/60/60*n.autoRotateSpeed}function j(){return Math.pow(.95,n.zoomSpeed)}function Y(O){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=O:f.theta-=O}function H(O){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=O:f.phi-=O}const Q=(()=>{const O=new p.Vector3;return function(ce,Me){O.setFromMatrixColumn(Me,0),O.multiplyScalar(-ce),v.add(O)}})(),re=(()=>{const O=new p.Vector3;return function(ce,Me){n.screenSpacePanning===!0?O.setFromMatrixColumn(Me,1):(O.setFromMatrixColumn(Me,0),O.crossVectors(n.object.up,O)),O.multiplyScalar(ce),v.add(O)}})(),ie=(()=>{const O=new p.Vector3;return function(ce,Me){const Be=n.domElement;if(Be&&n.object instanceof p.PerspectiveCamera&&n.object.isPerspectiveCamera){const Bt=n.object.position;O.copy(Bt).sub(n.target);let sn=O.length();sn*=Math.tan(n.object.fov/2*Math.PI/180),Q(2*ce*sn/Be.clientHeight,n.object.matrix),re(2*Me*sn/Be.clientHeight,n.object.matrix)}else Be&&n.object instanceof p.OrthographicCamera&&n.object.isOrthographicCamera?(Q(ce*(n.object.right-n.object.left)/n.object.zoom/Be.clientWidth,n.object.matrix),re(Me*(n.object.top-n.object.bottom)/n.object.zoom/Be.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function le(O){n.object instanceof p.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof p.OrthographicCamera&&n.object.isOrthographicCamera?g=O:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function de(O){le(g/O)}function ge(O){le(g*O)}function fe(O){if(!n.zoomToCursor||!n.domElement)return;K=!0;const E=n.domElement.getBoundingClientRect(),ce=O.clientX-E.left,Me=O.clientY-E.top,Be=E.width,Bt=E.height;I.x=ce/Be*2-1,I.y=-(Me/Bt)*2+1,X.set(I.x,I.y,1).unproject(n.object).sub(n.object.position).normalize()}function Se(O){return Math.max(n.minDistance,Math.min(n.maxDistance,O))}function it(O){w.set(O.clientX,O.clientY)}function rt(O){fe(O),W.set(O.clientX,O.clientY)}function dt(O){L.set(O.clientX,O.clientY)}function Qe(O){b.set(O.clientX,O.clientY),x.subVectors(b,w).multiplyScalar(n.rotateSpeed);const E=n.domElement;E&&(Y(2*Math.PI*x.x/E.clientHeight),H(2*Math.PI*x.y/E.clientHeight)),w.copy(b),n.update()}function Ye(O){z.set(O.clientX,O.clientY),D.subVectors(z,W),D.y>0?de(j()):D.y<0&&ge(j()),W.copy(z),n.update()}function Re(O){M.set(O.clientX,O.clientY),C.subVectors(M,L).multiplyScalar(n.panSpeed),ie(C.x,C.y),L.copy(M),n.update()}function st(O){fe(O),O.deltaY<0?ge(j()):O.deltaY>0&&de(j()),n.update()}function ze(O){let E=!1;switch(O.code){case n.keys.UP:ie(0,n.keyPanSpeed),E=!0;break;case n.keys.BOTTOM:ie(0,-n.keyPanSpeed),E=!0;break;case n.keys.LEFT:ie(n.keyPanSpeed,0),E=!0;break;case n.keys.RIGHT:ie(-n.keyPanSpeed,0),E=!0;break}E&&(O.preventDefault(),n.update())}function Vt(){if(V.length==1)w.set(V[0].pageX,V[0].pageY);else{const O=.5*(V[0].pageX+V[1].pageX),E=.5*(V[0].pageY+V[1].pageY);w.set(O,E)}}function Nt(){if(V.length==1)L.set(V[0].pageX,V[0].pageY);else{const O=.5*(V[0].pageX+V[1].pageX),E=.5*(V[0].pageY+V[1].pageY);L.set(O,E)}}function Ce(){const O=V[0].pageX-V[1].pageX,E=V[0].pageY-V[1].pageY,ce=Math.sqrt(O*O+E*E);W.set(0,ce)}function ot(){n.enableZoom&&Ce(),n.enablePan&&Nt()}function ft(){n.enableZoom&&Ce(),n.enableRotate&&Vt()}function Lt(O){if(V.length==1)b.set(O.pageX,O.pageY);else{const ce=Li(O),Me=.5*(O.pageX+ce.x),Be=.5*(O.pageY+ce.y);b.set(Me,Be)}x.subVectors(b,w).multiplyScalar(n.rotateSpeed);const E=n.domElement;E&&(Y(2*Math.PI*x.x/E.clientHeight),H(2*Math.PI*x.y/E.clientHeight)),w.copy(b)}function bi(O){if(V.length==1)M.set(O.pageX,O.pageY);else{const E=Li(O),ce=.5*(O.pageX+E.x),Me=.5*(O.pageY+E.y);M.set(ce,Me)}C.subVectors(M,L).multiplyScalar(n.panSpeed),ie(C.x,C.y),L.copy(M)}function Ri(O){const E=Li(O),ce=O.pageX-E.x,Me=O.pageY-E.y,Be=Math.sqrt(ce*ce+Me*Me);z.set(0,Be),D.set(0,Math.pow(z.y/W.y,n.zoomSpeed)),de(D.y),W.copy(z)}function xi(O){n.enableZoom&&Ri(O),n.enablePan&&bi(O)}function It(O){n.enableZoom&&Ri(O),n.enableRotate&&Lt(O)}function qn(O){var E,ce;n.enabled!==!1&&(V.length===0&&((E=n.domElement)==null||E.ownerDocument.addEventListener("pointermove",ei),(ce=n.domElement)==null||ce.ownerDocument.addEventListener("pointerup",Mi)),Fr(O),O.pointerType==="touch"?Ir(O):Si(O))}function ei(O){n.enabled!==!1&&(O.pointerType==="touch"?Ar(O):xa(O))}function Mi(O){var E,ce,Me;Or(O),V.length===0&&((E=n.domElement)==null||E.releasePointerCapture(O.pointerId),(ce=n.domElement)==null||ce.ownerDocument.removeEventListener("pointermove",ei),(Me=n.domElement)==null||Me.ownerDocument.removeEventListener("pointerup",Mi)),n.dispatchEvent(a),u=c.NONE}function Si(O){let E;switch(O.button){case 0:E=n.mouseButtons.LEFT;break;case 1:E=n.mouseButtons.MIDDLE;break;case 2:E=n.mouseButtons.RIGHT;break;default:E=-1}switch(E){case p.MOUSE.DOLLY:if(n.enableZoom===!1)return;rt(O),u=c.DOLLY;break;case p.MOUSE.ROTATE:if(O.ctrlKey||O.metaKey||O.shiftKey){if(n.enablePan===!1)return;dt(O),u=c.PAN}else{if(n.enableRotate===!1)return;it(O),u=c.ROTATE}break;case p.MOUSE.PAN:if(O.ctrlKey||O.metaKey||O.shiftKey){if(n.enableRotate===!1)return;it(O),u=c.ROTATE}else{if(n.enablePan===!1)return;dt(O),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(o)}function xa(O){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;Qe(O);break;case c.DOLLY:if(n.enableZoom===!1)return;Ye(O);break;case c.PAN:if(n.enablePan===!1)return;Re(O);break}}function ti(O){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(O.preventDefault(),n.dispatchEvent(o),st(O),n.dispatchEvent(a))}function wn(O){n.enabled===!1||n.enablePan===!1||ze(O)}function Ir(O){switch(Ji(O),V.length){case 1:switch(n.touches.ONE){case p.TOUCH.ROTATE:if(n.enableRotate===!1)return;Vt(),u=c.TOUCH_ROTATE;break;case p.TOUCH.PAN:if(n.enablePan===!1)return;Nt(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case p.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ot(),u=c.TOUCH_DOLLY_PAN;break;case p.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ft(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(o)}function Ar(O){switch(Ji(O),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Lt(O),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;bi(O),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;xi(O),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;It(O),n.update();break;default:u=c.NONE}}function ji(O){n.enabled!==!1&&O.preventDefault()}function Fr(O){V.push(O)}function Or(O){delete G[O.pointerId];for(let E=0;E<V.length;E++)if(V[E].pointerId==O.pointerId){V.splice(E,1);return}}function Ji(O){let E=G[O.pointerId];E===void 0&&(E=new p.Vector2,G[O.pointerId]=E),E.set(O.pageX,O.pageY)}function Li(O){const E=O.pointerId===V[0].pointerId?V[1]:V[0];return G[E.pointerId]}this.dollyIn=(O=j())=>{ge(O),n.update()},this.dollyOut=(O=j())=>{de(O),n.update()},this.getScale=()=>g,this.setScale=O=>{le(O),n.update()},this.getZoomScale=()=>j(),t!==void 0&&this.connect(t),this.update()}}class Ff extends Af{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=p.MOUSE.PAN,this.mouseButtons.RIGHT=p.MOUSE.ROTATE,this.touches.ONE=p.TOUCH.PAN,this.touches.TWO=p.TOUCH.DOLLY_ROTATE}}var Of=Object.defineProperty,Df=(r,e,t)=>e in r?Of(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,di=(r,e,t)=>(Df(r,typeof e!="symbol"?e+"":e,t),t);class pr{constructor(){di(this,"enabled",!0),di(this,"needsSwap",!0),di(this,"clear",!1),di(this,"renderToScreen",!1)}setSize(e,t){}render(e,t,n,i,o){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}class Bl{constructor(e){di(this,"camera",new p.OrthographicCamera(-1,1,1,-1,0,1)),di(this,"geometry",new p.PlaneGeometry(2,2)),di(this,"mesh"),this.mesh=new p.Mesh(this.geometry,e)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}var zf=Object.defineProperty,Xf=(r,e,t)=>e in r?zf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ts=(r,e,t)=>(Xf(r,typeof e!="symbol"?e+"":e,t),t);class Yl extends pr{constructor(e,t="tDiffuse"){super(),ts(this,"textureID"),ts(this,"uniforms"),ts(this,"material"),ts(this,"fsQuad"),this.textureID=t,e instanceof p.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):(this.uniforms=p.UniformsUtils.clone(e.uniforms),this.material=new p.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Bl(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.fsQuad.dispose(),this.material.dispose()}}const Lo={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
97
|
+
}`},H=new p.ShaderMaterial({fragmentShader:Y.fragmentShader,vertexShader:Y.vertexShader,uniforms:p.UniformsUtils.clone(Y.uniforms),lights:!0,side:b,fog:x});H.uniforms.mirrorSampler.value=j.texture,H.uniforms.textureMatrix.value=G,H.uniforms.alpha.value=c,H.uniforms.time.value=h,H.uniforms.normalSampler.value=d,H.uniforms.sunColor.value=f,H.uniforms.waterColor.value=g,H.uniforms.sunDirection.value=m,H.uniforms.distortionScale.value=w,H.uniforms.eye.value=v,i.material=H,i.onBeforeRender=function(Q,re,ne){if(C.setFromMatrixPosition(i.matrixWorld),W.setFromMatrixPosition(ne.matrixWorld),z.extractRotation(i.matrixWorld),M.set(0,0,1),M.applyMatrix4(z),I.subVectors(C,W),I.dot(M)>0)return;I.reflect(M).negate(),I.add(C),z.extractRotation(ne.matrixWorld),D.set(0,0,-1),D.applyMatrix4(z),D.add(W),K.subVectors(C,D),K.reflect(M).negate(),K.add(C),k.position.copy(I),k.up.set(0,1,0),k.up.applyMatrix4(z),k.up.reflect(M),k.lookAt(K),k.far=ne.far,k.updateMatrixWorld(),k.projectionMatrix.copy(ne.projectionMatrix),G.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),G.multiply(k.projectionMatrix),G.multiply(k.matrixWorldInverse),L.setFromNormalAndCoplanarPoint(M,C),L.applyMatrix4(k.matrixWorldInverse),X.set(L.normal.x,L.normal.y,L.normal.z,L.constant);const le=k.projectionMatrix;V.x=(Math.sign(X.x)+le.elements[8])/le.elements[0],V.y=(Math.sign(X.y)+le.elements[9])/le.elements[5],V.z=-1,V.w=(1+le.elements[10])/le.elements[14],X.multiplyScalar(2/X.dot(V)),le.elements[2]=X.x,le.elements[6]=X.y,le.elements[10]=X.z+1-a,le.elements[14]=X.w,v.setFromMatrixPosition(ne.matrixWorld);const de=Q.getRenderTarget(),ge=Q.xr.enabled,fe=Q.shadowMap.autoUpdate;i.visible=!1,Q.xr.enabled=!1,Q.shadowMap.autoUpdate=!1,Q.setRenderTarget(j),Q.state.buffers.depth.setMask(!0),Q.autoClear===!1&&Q.clear(),Q.render(re,k),i.visible=!0,Q.xr.enabled=ge,Q.shadowMap.autoUpdate=fe,Q.setRenderTarget(de);const Se=ne.viewport;Se!==void 0&&Q.state.viewport(Se)}}}var Tf=Object.defineProperty,Gf=(r,e,t)=>e in r?Tf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wf=(r,e,t)=>(Gf(r,e+"",t),t);class Zf{constructor(){Wf(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const n=this._listeners[e];if(n!==void 0){const o=n.indexOf(t);o!==-1&&n.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const n=i.slice(0);for(let o=0,a=n.length;o<a;o++)n[o].call(this,e);e.target=null}}}var Vf=Object.defineProperty,If=(r,e,t)=>e in r?Vf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ie=(r,e,t)=>(If(r,typeof e!="symbol"?e+"":e,t),t);const es=new p.Ray,Kl=new p.Plane,Af=Math.cos(70*(Math.PI/180)),Nl=(r,e)=>(r%e+e)%e;class Ff extends Zf{constructor(e,t){super(),ie(this,"object"),ie(this,"domElement"),ie(this,"enabled",!0),ie(this,"target",new p.Vector3),ie(this,"minDistance",0),ie(this,"maxDistance",1/0),ie(this,"minZoom",0),ie(this,"maxZoom",1/0),ie(this,"minPolarAngle",0),ie(this,"maxPolarAngle",Math.PI),ie(this,"minAzimuthAngle",-1/0),ie(this,"maxAzimuthAngle",1/0),ie(this,"enableDamping",!1),ie(this,"dampingFactor",.05),ie(this,"enableZoom",!0),ie(this,"zoomSpeed",1),ie(this,"enableRotate",!0),ie(this,"rotateSpeed",1),ie(this,"enablePan",!0),ie(this,"panSpeed",1),ie(this,"screenSpacePanning",!0),ie(this,"keyPanSpeed",7),ie(this,"zoomToCursor",!1),ie(this,"autoRotate",!1),ie(this,"autoRotateSpeed",2),ie(this,"reverseOrbit",!1),ie(this,"reverseHorizontalOrbit",!1),ie(this,"reverseVerticalOrbit",!1),ie(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ie(this,"mouseButtons",{LEFT:p.MOUSE.ROTATE,MIDDLE:p.MOUSE.DOLLY,RIGHT:p.MOUSE.PAN}),ie(this,"touches",{ONE:p.TOUCH.ROTATE,TWO:p.TOUCH.DOLLY_PAN}),ie(this,"target0"),ie(this,"position0"),ie(this,"zoom0"),ie(this,"_domElementKeyEvents",null),ie(this,"getPolarAngle"),ie(this,"getAzimuthalAngle"),ie(this,"setPolarAngle"),ie(this,"setAzimuthalAngle"),ie(this,"getDistance"),ie(this,"getZoomScale"),ie(this,"listenToKeyEvents"),ie(this,"stopListenToKeyEvents"),ie(this,"saveState"),ie(this,"reset"),ie(this,"update"),ie(this,"connect"),ie(this,"dispose"),ie(this,"dollyIn"),ie(this,"dollyOut"),ie(this,"getScale"),ie(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>m.phi,this.getAzimuthalAngle=()=>m.theta,this.setPolarAngle=O=>{let E=Nl(O,2*Math.PI),ce=m.phi;ce<0&&(ce+=2*Math.PI),E<0&&(E+=2*Math.PI);let Me=Math.abs(E-ce);2*Math.PI-Me<Me&&(E<ce?E+=2*Math.PI:ce+=2*Math.PI),f.phi=E-ce,i.update()},this.setAzimuthalAngle=O=>{let E=Nl(O,2*Math.PI),ce=m.theta;ce<0&&(ce+=2*Math.PI),E<0&&(E+=2*Math.PI);let Me=Math.abs(E-ce);2*Math.PI-Me<Me&&(E<ce?E+=2*Math.PI:ce+=2*Math.PI),f.theta=E-ce,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=O=>{O.addEventListener("keydown",wi),this._domElementKeyEvents=O},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",wi),this._domElementKeyEvents=null},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(n),i.update(),h=c.NONE},this.update=(()=>{const O=new p.Vector3,E=new p.Vector3(0,1,0),ce=new p.Quaternion().setFromUnitVectors(e.up,E),Me=ce.clone().invert(),Ye=new p.Vector3,Yt=new p.Quaternion,si=2*Math.PI;return function(){const Ws=i.object.position;ce.setFromUnitVectors(e.up,E),Me.copy(ce).invert(),O.copy(Ws).sub(i.target),O.applyQuaternion(ce),m.setFromVector3(O),i.autoRotate&&h===c.NONE&&Y(k()),i.enableDamping?(m.theta+=f.theta*i.dampingFactor,m.phi+=f.phi*i.dampingFactor):(m.theta+=f.theta,m.phi+=f.phi);let oi=i.minAzimuthAngle,ai=i.maxAzimuthAngle;isFinite(oi)&&isFinite(ai)&&(oi<-Math.PI?oi+=si:oi>Math.PI&&(oi-=si),ai<-Math.PI?ai+=si:ai>Math.PI&&(ai-=si),oi<=ai?m.theta=Math.max(oi,Math.min(ai,m.theta)):m.theta=m.theta>(oi+ai)/2?Math.max(oi,m.theta):Math.min(ai,m.theta)),m.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,m.phi)),m.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(v,i.dampingFactor):i.target.add(v),i.zoomToCursor&&K||i.object.isOrthographicCamera?m.radius=Se(m.radius):m.radius=Se(m.radius*g),O.setFromSpherical(m),O.applyQuaternion(Me),Ws.copy(i.target).add(O),i.object.matrixAutoUpdate||i.object.updateMatrix(),i.object.lookAt(i.target),i.enableDamping===!0?(f.theta*=1-i.dampingFactor,f.phi*=1-i.dampingFactor,v.multiplyScalar(1-i.dampingFactor)):(f.set(0,0,0),v.set(0,0,0));let tn=!1;if(i.zoomToCursor&&K){let Pn=null;if(i.object instanceof p.PerspectiveCamera&&i.object.isPerspectiveCamera){const Cn=O.length();Pn=Se(Cn*g);const Qn=Cn-Pn;i.object.position.addScaledVector(X,Qn),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const Cn=new p.Vector3(I.x,I.y,0);Cn.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/g)),i.object.updateProjectionMatrix(),tn=!0;const Qn=new p.Vector3(I.x,I.y,0);Qn.unproject(i.object),i.object.position.sub(Qn).add(Cn),i.object.updateMatrixWorld(),Pn=O.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Pn!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Pn).add(i.object.position):(es.origin.copy(i.object.position),es.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(es.direction))<Af?e.lookAt(i.target):(Kl.setFromNormalAndCoplanarPoint(i.object.up,i.target),es.intersectPlane(Kl,i.target))))}else i.object instanceof p.OrthographicCamera&&i.object.isOrthographicCamera&&(tn=g!==1,tn&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/g)),i.object.updateProjectionMatrix()));return g=1,K=!1,tn||Ye.distanceToSquared(i.object.position)>d||8*(1-Yt.dot(i.object.quaternion))>d?(i.dispatchEvent(n),Ye.copy(i.object.position),Yt.copy(i.object.quaternion),tn=!1,!0):!1}})(),this.connect=O=>{i.domElement=O,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",jn),i.domElement.addEventListener("pointerdown",$i),i.domElement.addEventListener("pointercancel",Mn),i.domElement.addEventListener("wheel",en)},this.dispose=()=>{var O,E,ce,Me,Ye,Yt;i.domElement&&(i.domElement.style.touchAction="auto"),(O=i.domElement)==null||O.removeEventListener("contextmenu",jn),(E=i.domElement)==null||E.removeEventListener("pointerdown",$i),(ce=i.domElement)==null||ce.removeEventListener("pointercancel",Mn),(Me=i.domElement)==null||Me.removeEventListener("wheel",en),(Ye=i.domElement)==null||Ye.ownerDocument.removeEventListener("pointermove",qi),(Yt=i.domElement)==null||Yt.ownerDocument.removeEventListener("pointerup",Mn),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",wi)};const i=this,n={type:"change"},o={type:"start"},a={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const d=1e-6,m=new p.Spherical,f=new p.Spherical;let g=1;const v=new p.Vector3,w=new p.Vector2,b=new p.Vector2,x=new p.Vector2,L=new p.Vector2,M=new p.Vector2,C=new p.Vector2,W=new p.Vector2,z=new p.Vector2,D=new p.Vector2,X=new p.Vector3,I=new p.Vector2;let K=!1;const V=[],G={};function k(){return 2*Math.PI/60/60*i.autoRotateSpeed}function j(){return Math.pow(.95,i.zoomSpeed)}function Y(O){i.reverseOrbit||i.reverseHorizontalOrbit?f.theta+=O:f.theta-=O}function H(O){i.reverseOrbit||i.reverseVerticalOrbit?f.phi+=O:f.phi-=O}const Q=(()=>{const O=new p.Vector3;return function(ce,Me){O.setFromMatrixColumn(Me,0),O.multiplyScalar(-ce),v.add(O)}})(),re=(()=>{const O=new p.Vector3;return function(ce,Me){i.screenSpacePanning===!0?O.setFromMatrixColumn(Me,1):(O.setFromMatrixColumn(Me,0),O.crossVectors(i.object.up,O)),O.multiplyScalar(ce),v.add(O)}})(),ne=(()=>{const O=new p.Vector3;return function(ce,Me){const Ye=i.domElement;if(Ye&&i.object instanceof p.PerspectiveCamera&&i.object.isPerspectiveCamera){const Yt=i.object.position;O.copy(Yt).sub(i.target);let si=O.length();si*=Math.tan(i.object.fov/2*Math.PI/180),Q(2*ce*si/Ye.clientHeight,i.object.matrix),re(2*Me*si/Ye.clientHeight,i.object.matrix)}else Ye&&i.object instanceof p.OrthographicCamera&&i.object.isOrthographicCamera?(Q(ce*(i.object.right-i.object.left)/i.object.zoom/Ye.clientWidth,i.object.matrix),re(Me*(i.object.top-i.object.bottom)/i.object.zoom/Ye.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function le(O){i.object instanceof p.PerspectiveCamera&&i.object.isPerspectiveCamera||i.object instanceof p.OrthographicCamera&&i.object.isOrthographicCamera?g=O:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function de(O){le(g/O)}function ge(O){le(g*O)}function fe(O){if(!i.zoomToCursor||!i.domElement)return;K=!0;const E=i.domElement.getBoundingClientRect(),ce=O.clientX-E.left,Me=O.clientY-E.top,Ye=E.width,Yt=E.height;I.x=ce/Ye*2-1,I.y=-(Me/Yt)*2+1,X.set(I.x,I.y,1).unproject(i.object).sub(i.object.position).normalize()}function Se(O){return Math.max(i.minDistance,Math.min(i.maxDistance,O))}function rt(O){w.set(O.clientX,O.clientY)}function st(O){fe(O),W.set(O.clientX,O.clientY)}function ft(O){L.set(O.clientX,O.clientY)}function He(O){b.set(O.clientX,O.clientY),x.subVectors(b,w).multiplyScalar(i.rotateSpeed);const E=i.domElement;E&&(Y(2*Math.PI*x.x/E.clientHeight),H(2*Math.PI*x.y/E.clientHeight)),w.copy(b),i.update()}function Re(O){z.set(O.clientX,O.clientY),D.subVectors(z,W),D.y>0?de(j()):D.y<0&&ge(j()),W.copy(z),i.update()}function je(O){M.set(O.clientX,O.clientY),C.subVectors(M,L).multiplyScalar(i.panSpeed),ne(C.x,C.y),L.copy(M),i.update()}function ot(O){fe(O),O.deltaY<0?ge(j()):O.deltaY>0&&de(j()),i.update()}function Xe(O){let E=!1;switch(O.code){case i.keys.UP:ne(0,i.keyPanSpeed),E=!0;break;case i.keys.BOTTOM:ne(0,-i.keyPanSpeed),E=!0;break;case i.keys.LEFT:ne(i.keyPanSpeed,0),E=!0;break;case i.keys.RIGHT:ne(-i.keyPanSpeed,0),E=!0;break}E&&(O.preventDefault(),i.update())}function It(){if(V.length==1)w.set(V[0].pageX,V[0].pageY);else{const O=.5*(V[0].pageX+V[1].pageX),E=.5*(V[0].pageY+V[1].pageY);w.set(O,E)}}function Bt(){if(V.length==1)L.set(V[0].pageX,V[0].pageY);else{const O=.5*(V[0].pageX+V[1].pageX),E=.5*(V[0].pageY+V[1].pageY);L.set(O,E)}}function Ce(){const O=V[0].pageX-V[1].pageX,E=V[0].pageY-V[1].pageY,ce=Math.sqrt(O*O+E*E);W.set(0,ce)}function at(){i.enableZoom&&Ce(),i.enablePan&&Bt()}function pt(){i.enableZoom&&Ce(),i.enableRotate&&It()}function Pt(O){if(V.length==1)b.set(O.pageX,O.pageY);else{const ce=Ln(O),Me=.5*(O.pageX+ce.x),Ye=.5*(O.pageY+ce.y);b.set(Me,Ye)}x.subVectors(b,w).multiplyScalar(i.rotateSpeed);const E=i.domElement;E&&(Y(2*Math.PI*x.x/E.clientHeight),H(2*Math.PI*x.y/E.clientHeight)),w.copy(b)}function bn(O){if(V.length==1)M.set(O.pageX,O.pageY);else{const E=Ln(O),ce=.5*(O.pageX+E.x),Me=.5*(O.pageY+E.y);M.set(ce,Me)}C.subVectors(M,L).multiplyScalar(i.panSpeed),ne(C.x,C.y),L.copy(M)}function Rn(O){const E=Ln(O),ce=O.pageX-E.x,Me=O.pageY-E.y,Ye=Math.sqrt(ce*ce+Me*Me);z.set(0,Ye),D.set(0,Math.pow(z.y/W.y,i.zoomSpeed)),de(D.y),W.copy(z)}function xn(O){i.enableZoom&&Rn(O),i.enablePan&&bn(O)}function At(O){i.enableZoom&&Rn(O),i.enableRotate&&Pt(O)}function $i(O){var E,ce;i.enabled!==!1&&(V.length===0&&((E=i.domElement)==null||E.ownerDocument.addEventListener("pointermove",qi),(ce=i.domElement)==null||ce.ownerDocument.addEventListener("pointerup",Mn)),Fr(O),O.pointerType==="touch"?Ir(O):Sn(O))}function qi(O){i.enabled!==!1&&(O.pointerType==="touch"?Ar(O):xa(O))}function Mn(O){var E,ce,Me;Or(O),V.length===0&&((E=i.domElement)==null||E.releasePointerCapture(O.pointerId),(ce=i.domElement)==null||ce.ownerDocument.removeEventListener("pointermove",qi),(Me=i.domElement)==null||Me.ownerDocument.removeEventListener("pointerup",Mn)),i.dispatchEvent(a),h=c.NONE}function Sn(O){let E;switch(O.button){case 0:E=i.mouseButtons.LEFT;break;case 1:E=i.mouseButtons.MIDDLE;break;case 2:E=i.mouseButtons.RIGHT;break;default:E=-1}switch(E){case p.MOUSE.DOLLY:if(i.enableZoom===!1)return;st(O),h=c.DOLLY;break;case p.MOUSE.ROTATE:if(O.ctrlKey||O.metaKey||O.shiftKey){if(i.enablePan===!1)return;ft(O),h=c.PAN}else{if(i.enableRotate===!1)return;rt(O),h=c.ROTATE}break;case p.MOUSE.PAN:if(O.ctrlKey||O.metaKey||O.shiftKey){if(i.enableRotate===!1)return;rt(O),h=c.ROTATE}else{if(i.enablePan===!1)return;ft(O),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&i.dispatchEvent(o)}function xa(O){if(i.enabled!==!1)switch(h){case c.ROTATE:if(i.enableRotate===!1)return;He(O);break;case c.DOLLY:if(i.enableZoom===!1)return;Re(O);break;case c.PAN:if(i.enablePan===!1)return;je(O);break}}function en(O){i.enabled===!1||i.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(O.preventDefault(),i.dispatchEvent(o),ot(O),i.dispatchEvent(a))}function wi(O){i.enabled===!1||i.enablePan===!1||Xe(O)}function Ir(O){switch(Jn(O),V.length){case 1:switch(i.touches.ONE){case p.TOUCH.ROTATE:if(i.enableRotate===!1)return;It(),h=c.TOUCH_ROTATE;break;case p.TOUCH.PAN:if(i.enablePan===!1)return;Bt(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(i.touches.TWO){case p.TOUCH.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;at(),h=c.TOUCH_DOLLY_PAN;break;case p.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;pt(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&i.dispatchEvent(o)}function Ar(O){switch(Jn(O),h){case c.TOUCH_ROTATE:if(i.enableRotate===!1)return;Pt(O),i.update();break;case c.TOUCH_PAN:if(i.enablePan===!1)return;bn(O),i.update();break;case c.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;xn(O),i.update();break;case c.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;At(O),i.update();break;default:h=c.NONE}}function jn(O){i.enabled!==!1&&O.preventDefault()}function Fr(O){V.push(O)}function Or(O){delete G[O.pointerId];for(let E=0;E<V.length;E++)if(V[E].pointerId==O.pointerId){V.splice(E,1);return}}function Jn(O){let E=G[O.pointerId];E===void 0&&(E=new p.Vector2,G[O.pointerId]=E),E.set(O.pageX,O.pageY)}function Ln(O){const E=O.pointerId===V[0].pointerId?V[1]:V[0];return G[E.pointerId]}this.dollyIn=(O=j())=>{ge(O),i.update()},this.dollyOut=(O=j())=>{de(O),i.update()},this.getScale=()=>g,this.setScale=O=>{le(O),i.update()},this.getZoomScale=()=>j(),t!==void 0&&this.connect(t),this.update()}}class Of extends Ff{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=p.MOUSE.PAN,this.mouseButtons.RIGHT=p.MOUSE.ROTATE,this.touches.ONE=p.TOUCH.PAN,this.touches.TWO=p.TOUCH.DOLLY_ROTATE}}var Df=Object.defineProperty,zf=(r,e,t)=>e in r?Df(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,dn=(r,e,t)=>(zf(r,typeof e!="symbol"?e+"":e,t),t);class pr{constructor(){dn(this,"enabled",!0),dn(this,"needsSwap",!0),dn(this,"clear",!1),dn(this,"renderToScreen",!1)}setSize(e,t){}render(e,t,i,n,o){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}class Bl{constructor(e){dn(this,"camera",new p.OrthographicCamera(-1,1,1,-1,0,1)),dn(this,"geometry",new p.PlaneGeometry(2,2)),dn(this,"mesh"),this.mesh=new p.Mesh(this.geometry,e)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}var Xf=Object.defineProperty,Uf=(r,e,t)=>e in r?Xf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ts=(r,e,t)=>(Uf(r,typeof e!="symbol"?e+"":e,t),t);class Yl extends pr{constructor(e,t="tDiffuse"){super(),ts(this,"textureID"),ts(this,"uniforms"),ts(this,"material"),ts(this,"fsQuad"),this.textureID=t,e instanceof p.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):(this.uniforms=p.UniformsUtils.clone(e.uniforms),this.material=new p.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Bl(this.material)}render(e,t,i){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.fsQuad.dispose(),this.material.dispose()}}const Po={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
98
98
|
varying vec2 vUv;
|
|
99
99
|
|
|
100
100
|
void main() {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
gl_FragColor = opacity * texel;
|
|
117
117
|
|
|
118
118
|
}
|
|
119
|
-
`},
|
|
119
|
+
`},kf={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new p.Color(0)},defaultOpacity:{value:0}},vertexShader:`
|
|
120
120
|
varying vec2 vUv;
|
|
121
121
|
|
|
122
122
|
void main() {
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
gl_FragColor = mix( outputColor, texel, alpha );
|
|
151
151
|
|
|
152
152
|
}
|
|
153
|
-
`};var
|
|
153
|
+
`};var Kf=Object.defineProperty,Nf=(r,e,t)=>e in r?Kf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Rl=(r,e,t)=>(Nf(r,typeof e!="symbol"?e+"":e,t),t);const Bf=(()=>{const r=class extends pr{constructor(t,i,n,o){super(),this.strength=i!==void 0?i:1,this.radius=n,this.threshold=o,this.resolution=t!==void 0?new p.Vector2(t.x,t.y):new p.Vector2(256,256),this.clearColor=new p.Color(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let a=Math.round(this.resolution.x/2),c=Math.round(this.resolution.y/2);this.renderTargetBright=new p.WebGLRenderTarget(a,c,{type:p.HalfFloatType}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let g=0;g<this.nMips;g++){const v=new p.WebGLRenderTarget(a,c,{type:p.HalfFloatType});v.texture.name="UnrealBloomPass.h"+g,v.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(v);const w=new p.WebGLRenderTarget(a,c,{type:p.HalfFloatType});w.texture.name="UnrealBloomPass.v"+g,w.texture.generateMipmaps=!1,this.renderTargetsVertical.push(w),a=Math.round(a/2),c=Math.round(c/2)}const h=kf;this.highPassUniforms=p.UniformsUtils.clone(h.uniforms),this.highPassUniforms.luminosityThreshold.value=o,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new p.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const d=[3,5,7,9,11];a=Math.round(this.resolution.x/2),c=Math.round(this.resolution.y/2);for(let g=0;g<this.nMips;g++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(d[g])),this.separableBlurMaterials[g].uniforms.texSize.value=new p.Vector2(a,c),a=Math.round(a/2),c=Math.round(c/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=i,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const m=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=m,this.bloomTintColors=[new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const f=Po;this.copyUniforms=p.UniformsUtils.clone(f.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new p.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:f.vertexShader,fragmentShader:f.fragmentShader,blending:p.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new p.Color,this.oldClearAlpha=1,this.basic=new p.MeshBasicMaterial,this.fsQuad=new Bl(null)}dispose(){for(let t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(let t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(let t=0;t<this.separableBlurMaterials.length;t++)this.separableBlurMaterials[t].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(t,i){let n=Math.round(t/2),o=Math.round(i/2);this.renderTargetBright.setSize(n,o);for(let a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(n,o),this.renderTargetsVertical[a].setSize(n,o),this.separableBlurMaterials[a].uniforms.texSize.value=new p.Vector2(n,o),n=Math.round(n/2),o=Math.round(o/2)}render(t,i,n,o,a){t.getClearColor(this._oldClearColor),this.oldClearAlpha=t.getClearAlpha();const c=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),a&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,t.setRenderTarget(null),t.clear(),this.fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this.fsQuad.render(t);let h=this.renderTargetBright;for(let d=0;d<this.nMips;d++)this.fsQuad.material=this.separableBlurMaterials[d],this.separableBlurMaterials[d].uniforms.colorTexture.value=h.texture,this.separableBlurMaterials[d].uniforms.direction.value=r.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[d]),t.clear(),this.fsQuad.render(t),this.separableBlurMaterials[d].uniforms.colorTexture.value=this.renderTargetsHorizontal[d].texture,this.separableBlurMaterials[d].uniforms.direction.value=r.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[d]),t.clear(),this.fsQuad.render(t),h=this.renderTargetsVertical[d];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,a&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(n),this.fsQuad.render(t)),t.setClearColor(this._oldClearColor,this.oldClearAlpha),t.autoClear=c}getSeperableBlurMaterial(t){return new p.ShaderMaterial({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new p.Vector2(.5,.5)},direction:{value:new p.Vector2(.5,.5)}},vertexShader:`varying vec2 vUv;
|
|
154
154
|
void main() {
|
|
155
155
|
vUv = uv;
|
|
156
156
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
@@ -204,12 +204,12 @@
|
|
|
204
204
|
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
|
|
205
205
|
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
|
|
206
206
|
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
|
|
207
|
-
}`})}};let e=r;return Rl(e,"BlurDirectionX",new p.Vector2(1,0)),Rl(e,"BlurDirectionY",new p.Vector2(0,1)),e})();var Bf=Object.defineProperty,Yf=(r,e,t)=>e in r?Bf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Po=(r,e,t)=>(Yf(r,typeof e!="symbol"?e+"":e,t),t);class jl extends pr{constructor(e,t){super(),Po(this,"scene"),Po(this,"camera"),Po(this,"inverse"),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0);let a,c;this.inverse?(a=0,c=1):(a=1,c=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),o.buffers.stencil.setFunc(i.ALWAYS,a,4294967295),o.buffers.stencil.setClear(c),o.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(i.EQUAL,1,4294967295),o.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),o.buffers.stencil.setLocked(!0)}}class Rf extends pr{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}var jf=Object.defineProperty,Jf=(r,e,t)=>e in r?jf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kt=(r,e,t)=>(Jf(r,typeof e!="symbol"?e+"":e,t),t);class Qf{constructor(e,t){if(kt(this,"renderer"),kt(this,"_pixelRatio"),kt(this,"_width"),kt(this,"_height"),kt(this,"renderTarget1"),kt(this,"renderTarget2"),kt(this,"writeBuffer"),kt(this,"readBuffer"),kt(this,"renderToScreen"),kt(this,"passes",[]),kt(this,"copyPass"),kt(this,"clock"),this.renderer=e,t===void 0){const n={minFilter:p.LinearFilter,magFilter:p.LinearFilter,format:p.RGBAFormat},i=e.getSize(new p.Vector2);this._pixelRatio=e.getPixelRatio(),this._width=i.width,this._height=i.height,t=new p.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,n),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,Lo===void 0&&console.error("THREE.EffectComposer relies on CopyShader"),Yl===void 0&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Yl(Lo),this.copyPass.material.blending=p.NoBlending,this.clock=new p.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;const i=this.passes.length;for(let o=0;o<i;o++){const a=this.passes[o];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(o),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const c=this.renderer.getContext(),u=this.renderer.state.buffers.stencil;u.setFunc(c.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),u.setFunc(c.EQUAL,1,4294967295)}this.swapBuffers()}jl!==void 0&&(a instanceof jl?n=!0:a instanceof Rf&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new p.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let o=0;o<this.passes.length;o++)this.passes[o].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}var Hf=Object.defineProperty,Ef=(r,e,t)=>e in r?Hf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fi=(r,e,t)=>(Ef(r,typeof e!="symbol"?e+"":e,t),t);class $f extends pr{constructor(e,t,n,i,o=0){super(),fi(this,"scene"),fi(this,"camera"),fi(this,"overrideMaterial"),fi(this,"clearColor"),fi(this,"clearAlpha"),fi(this,"clearDepth",!1),fi(this,"_oldClearColor",new p.Color),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=o,this.clear=!0,this.needsSwap=!1}render(e,t,n){let i=e.autoClear;e.autoClear=!1;let o,a=null;this.overrideMaterial!==void 0&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),o=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,o),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=a),e.autoClear=i}}function zi(r){if(typeof TextDecoder<"u")return new TextDecoder().decode(r);let e="";for(let t=0,n=r.length;t<n;t++)e+=String.fromCharCode(r[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const pi="srgb",Sn="srgb-linear",Jl=3001,qf=3e3;class ep extends p.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new sp(t)}),this.register(function(t){return new op(t)}),this.register(function(t){return new mp(t)}),this.register(function(t){return new gp(t)}),this.register(function(t){return new yp(t)}),this.register(function(t){return new lp(t)}),this.register(function(t){return new cp(t)}),this.register(function(t){return new up(t)}),this.register(function(t){return new hp(t)}),this.register(function(t){return new rp(t)}),this.register(function(t){return new dp(t)}),this.register(function(t){return new ap(t)}),this.register(function(t){return new pp(t)}),this.register(function(t){return new fp(t)}),this.register(function(t){return new np(t)}),this.register(function(t){return new vp(t)}),this.register(function(t){return new _p(t)})}load(e,t,n,i){const o=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const d=p.LoaderUtils.extractUrlBase(e);a=p.LoaderUtils.resolveURL(d,this.path)}else a=p.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const c=function(d){i?i(d):console.error(d),o.manager.itemError(e),o.manager.itemEnd(e)},u=new p.FileLoader(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(d){try{o.parse(d,a,function(m){t(m),o.manager.itemEnd(e)},c)}catch(m){c(m)}},n,c)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let o;const a={},c={};if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(zi(new Uint8Array(e.slice(0,4)))===Ql){try{a[ve.KHR_BINARY_GLTF]=new wp(e)}catch(m){i&&i(m);return}o=JSON.parse(a[ve.KHR_BINARY_GLTF].content)}else o=JSON.parse(zi(new Uint8Array(e)));else o=e;if(o.asset===void 0||o.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new Ip(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const m=this.pluginCallbacks[d](u);m.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[m.name]=m,a[m.name]=!0}if(o.extensionsUsed)for(let d=0;d<o.extensionsUsed.length;++d){const m=o.extensionsUsed[d],f=o.extensionsRequired||[];switch(m){case ve.KHR_MATERIALS_UNLIT:a[m]=new ip;break;case ve.KHR_DRACO_MESH_COMPRESSION:a[m]=new bp(o,this.dracoLoader);break;case ve.KHR_TEXTURE_TRANSFORM:a[m]=new xp;break;case ve.KHR_MESH_QUANTIZATION:a[m]=new Mp;break;default:f.indexOf(m)>=0&&c[m]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}u.setExtensions(a),u.setPlugins(c),u.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,o){n.parse(e,t,i,o)})}}function tp(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const ve={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class np{constructor(e){this.parser=e,this.name=ve.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const o=t.json,u=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let d;const m=new p.Color(16777215);u.color!==void 0&&m.setRGB(u.color[0],u.color[1],u.color[2],Sn);const f=u.range!==void 0?u.range:0;switch(u.type){case"directional":d=new p.DirectionalLight(m),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new p.PointLight(m),d.distance=f;break;case"spot":d=new p.SpotLight(m),d.distance=f,u.spot=u.spot||{},u.spot.innerConeAngle=u.spot.innerConeAngle!==void 0?u.spot.innerConeAngle:0,u.spot.outerConeAngle=u.spot.outerConeAngle!==void 0?u.spot.outerConeAngle:Math.PI/4,d.angle=u.spot.outerConeAngle,d.penumbra=1-u.spot.innerConeAngle/u.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+u.type)}return d.position.set(0,0,0),d.decay=2,Ln(d,u),u.intensity!==void 0&&(d.intensity=u.intensity),d.name=t.createUniqueName(u.name||"light_"+e),i=Promise.resolve(d),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],c=(o.extensions&&o.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(u){return n._getNodeRef(t.cache,c,u)})}}class ip{constructor(){this.name=ve.KHR_MATERIALS_UNLIT}getMaterialType(){return p.MeshBasicMaterial}extendParams(e,t,n){const i=[];e.color=new p.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const a=o.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Sn),e.opacity=a[3]}o.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",o.baseColorTexture,pi))}return Promise.all(i)}}class rp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class sp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const c=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new p.Vector2(c,c)}return Promise.all(o)}}class op{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.dispersion=o.dispersion!==void 0?o.dispersion:0,Promise.resolve()}}class ap{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(o)}}class lp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new p.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(a.sheenColorFactor!==void 0){const c=a.sheenColorFactor;t.sheenColor.setRGB(c[0],c[1],c[2],Sn)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,pi)),a.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(o)}}class cp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(o)}}class up{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const c=a.attenuationColor||[1,1,1];return t.attenuationColor=new p.Color().setRGB(c[0],c[1],c[2],Sn),Promise.all(o)}}class hp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class dp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const c=a.specularColorFactor||[1,1,1];return t.specularColor=new p.Color().setRGB(c[0],c[1],c[2],Sn),a.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,pi)),Promise.all(o)}}class fp{constructor(e){this.parser=e,this.name=ve.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(o)}}class pp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(o)}}class mp{constructor(e){this.parser=e,this.name=ve.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const o=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,a)}}class gp{constructor(e){this.parser=e,this.name=ve.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const a=o.extensions[t],c=i.images[a.source];let u=n.textureLoader;if(c.uri){const d=n.options.manager.getHandler(c.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(e,a.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class yp{constructor(e){this.parser=e,this.name=ve.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const a=o.extensions[t],c=i.images[a.source];let u=n.textureLoader;if(c.uri){const d=n.options.manager.getHandler(c.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(e,a.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class vp{constructor(e){this.name=ve.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(c){const u=i.byteOffset||0,d=i.byteLength||0,m=i.count,f=i.byteStride,g=new Uint8Array(c,u,d);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(m,f,g,i.mode,i.filter).then(function(v){return v.buffer}):a.ready.then(function(){const v=new ArrayBuffer(m*f);return a.decodeGltfBuffer(new Uint8Array(v),m,f,g,i.mode,i.filter),v})})}else return null}}class _p{constructor(e){this.name=ve.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const d of i.primitives)if(d.mode!==Kt.TRIANGLES&&d.mode!==Kt.TRIANGLE_STRIP&&d.mode!==Kt.TRIANGLE_FAN&&d.mode!==void 0)return null;const a=n.extensions[this.name].attributes,c=[],u={};for(const d in a)c.push(this.parser.getDependency("accessor",a[d]).then(m=>(u[d]=m,u[d])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(d=>{const m=d.pop(),f=m.isGroup?m.children:[m],g=d[0].count,v=[];for(const w of f){const b=new p.Matrix4,x=new p.Vector3,L=new p.Quaternion,M=new p.Vector3(1,1,1),C=new p.InstancedMesh(w.geometry,w.material,g);for(let W=0;W<g;W++)u.TRANSLATION&&x.fromBufferAttribute(u.TRANSLATION,W),u.ROTATION&&L.fromBufferAttribute(u.ROTATION,W),u.SCALE&&M.fromBufferAttribute(u.SCALE,W),C.setMatrixAt(W,b.compose(x,L,M));for(const W in u)if(W==="_COLOR_0"){const z=u[W];C.instanceColor=new p.InstancedBufferAttribute(z.array,z.itemSize,z.normalized)}else W!=="TRANSLATION"&&W!=="ROTATION"&&W!=="SCALE"&&w.geometry.setAttribute(W,u[W]);p.Object3D.prototype.copy.call(C,w),this.parser.assignFinalMaterial(C),v.push(C)}return m.isGroup?(m.clear(),m.add(...v),m):v[0]}))}}const Ql="glTF",mr=12,Hl={JSON:1313821514,BIN:5130562};class wp{constructor(e){this.name=ve.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,mr);if(this.header={magic:zi(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ql)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-mr,i=new DataView(e,mr);let o=0;for(;o<n;){const a=i.getUint32(o,!0);o+=4;const c=i.getUint32(o,!0);if(o+=4,c===Hl.JSON){const u=new Uint8Array(e,mr+o,a);this.content=zi(u)}else if(c===Hl.BIN){const u=mr+o;this.body=e.slice(u,u+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class bp{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ve.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,o=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,c={},u={},d={};for(const m in a){const f=To[m]||m.toLowerCase();c[f]=a[m]}for(const m in e.attributes){const f=To[m]||m.toLowerCase();if(a[m]!==void 0){const g=n.accessors[e.attributes[m]],v=Xi[g.componentType];d[f]=v.name,u[f]=g.normalized===!0}}return t.getDependency("bufferView",o).then(function(m){return new Promise(function(f,g){i.decodeDracoFile(m,function(v){for(const w in v.attributes){const b=v.attributes[w],x=u[w];x!==void 0&&(b.normalized=x)}f(v)},c,d,Sn,g)})})}}class xp{constructor(){this.name=ve.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Mp{constructor(){this.name=ve.KHR_MESH_QUANTIZATION}}class El extends p.Interpolant{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[o+a];return t}interpolate_(e,t,n,i){const o=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=c*2,d=c*3,m=i-t,f=(n-t)/m,g=f*f,v=g*f,w=e*d,b=w-d,x=-2*v+3*g,L=v-g,M=1-x,C=L-g+f;for(let W=0;W!==c;W++){const z=a[b+W+c],D=a[b+W+u]*m,X=a[w+W+c],I=a[w+W]*m;o[W]=M*z+C*D+x*X+L*I}return o}}const Sp=new p.Quaternion;class Lp extends El{interpolate_(e,t,n,i){const o=super.interpolate_(e,t,n,i);return Sp.fromArray(o).normalize().toArray(o),o}}const Kt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Xi={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$l={9728:p.NearestFilter,9729:p.LinearFilter,9984:p.NearestMipmapNearestFilter,9985:p.LinearMipmapNearestFilter,9986:p.NearestMipmapLinearFilter,9987:p.LinearMipmapLinearFilter},ql={33071:p.ClampToEdgeWrapping,33648:p.MirroredRepeatWrapping,10497:p.RepeatWrapping},Co={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},To={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...qr>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Xn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Pp={CUBICSPLINE:void 0,LINEAR:p.InterpolateLinear,STEP:p.InterpolateDiscrete},Go={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Cp(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new p.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:p.FrontSide})),r.DefaultMaterial}function mi(r,e,t){for(const n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Ln(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Tp(r,e,t){let n=!1,i=!1,o=!1;for(let d=0,m=e.length;d<m;d++){const f=e[d];if(f.POSITION!==void 0&&(n=!0),f.NORMAL!==void 0&&(i=!0),f.COLOR_0!==void 0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(r);const a=[],c=[],u=[];for(let d=0,m=e.length;d<m;d++){const f=e[d];if(n){const g=f.POSITION!==void 0?t.getDependency("accessor",f.POSITION):r.attributes.position;a.push(g)}if(i){const g=f.NORMAL!==void 0?t.getDependency("accessor",f.NORMAL):r.attributes.normal;c.push(g)}if(o){const g=f.COLOR_0!==void 0?t.getDependency("accessor",f.COLOR_0):r.attributes.color;u.push(g)}}return Promise.all([Promise.all(a),Promise.all(c),Promise.all(u)]).then(function(d){const m=d[0],f=d[1],g=d[2];return n&&(r.morphAttributes.position=m),i&&(r.morphAttributes.normal=f),o&&(r.morphAttributes.color=g),r.morphTargetsRelative=!0,r})}function Gp(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Wp(r){let e;const t=r.extensions&&r.extensions[ve.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Wo(t.attributes):e=r.indices+":"+Wo(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+Wo(r.targets[n]);return e}function Wo(r){let e="";const t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function Zo(r){switch(r){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Zp(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Vp=new p.Matrix4;class Ip{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new tp,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,o=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,o=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&o<98?this.textureLoader=new p.TextureLoader(this.options.manager):this.textureLoader=new p.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new p.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const c={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return mi(o,c,i),Ln(c,i),Promise.all(n._invokeAll(function(u){return u.afterRoot&&u.afterRoot(c)})).then(function(){for(const u of c.scenes)u.updateMatrixWorld();e(c)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,o=t.length;i<o;i++){const a=t[i].joints;for(let c=0,u=a.length;c<u;c++)e[a[c]].isBone=!0}for(let i=0,o=e.length;i<o;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),o=(a,c)=>{const u=this.associations.get(a);u!=null&&this.associations.set(c,u);for(const[d,m]of a.children.entries())o(m,c.children[d])};return o(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const o=e(t[i]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":i=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(o,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[ve.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(o,a){n.load(p.LoaderUtils.resolveURL(t.uri,i.path),o,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=Co[i.type],c=Xi[i.componentType],u=i.normalized===!0,d=new c(i.count*a);return Promise.resolve(new p.BufferAttribute(d,a,u))}const o=[];return i.bufferView!==void 0?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),i.sparse!==void 0&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then(function(a){const c=a[0],u=Co[i.type],d=Xi[i.componentType],m=d.BYTES_PER_ELEMENT,f=m*u,g=i.byteOffset||0,v=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,w=i.normalized===!0;let b,x;if(v&&v!==f){const L=Math.floor(g/v),M="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+L+":"+i.count;let C=t.cache.get(M);C||(b=new d(c,L*v,i.count*v/m),C=new p.InterleavedBuffer(b,v/m),t.cache.add(M,C)),x=new p.InterleavedBufferAttribute(C,u,g%v/m,w)}else c===null?b=new d(i.count*u):b=new d(c,g,i.count*u),x=new p.BufferAttribute(b,u,w);if(i.sparse!==void 0){const L=Co.SCALAR,M=Xi[i.sparse.indices.componentType],C=i.sparse.indices.byteOffset||0,W=i.sparse.values.byteOffset||0,z=new M(a[1],C,i.sparse.count*L),D=new d(a[2],W,i.sparse.count*u);c!==null&&(x=new p.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let X=0,I=z.length;X<I;X++){const K=z[X];if(x.setX(K,D[X*u]),u>=2&&x.setY(K,D[X*u+1]),u>=3&&x.setZ(K,D[X*u+2]),u>=4&&x.setW(K,D[X*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,a=t.images[o];let c=this.textureLoader;if(a.uri){const u=n.manager.getHandler(a.uri);u!==null&&(c=u)}return this.loadTextureImage(e,o,c)}loadTextureImage(e,t,n){const i=this,o=this.json,a=o.textures[e],c=o.images[t],u=(c.uri||c.bufferView)+":"+a.sampler;if(this.textureCache[u])return this.textureCache[u];const d=this.loadImageSource(t,n).then(function(m){m.flipY=!1,m.name=a.name||c.name||"",m.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(m.name=c.uri);const g=(o.samplers||{})[a.sampler]||{};return m.magFilter=$l[g.magFilter]||p.LinearFilter,m.minFilter=$l[g.minFilter]||p.LinearMipmapLinearFilter,m.wrapS=ql[g.wrapS]||p.RepeatWrapping,m.wrapT=ql[g.wrapT]||p.RepeatWrapping,i.associations.set(m,{textures:e}),m}).catch(function(){return null});return this.textureCache[u]=d,d}loadImageSource(e,t){const n=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const a=i.images[e],c=self.URL||self.webkitURL;let u=a.uri||"",d=!1;if(a.bufferView!==void 0)u=n.getDependency("bufferView",a.bufferView).then(function(f){d=!0;const g=new Blob([f],{type:a.mimeType});return u=c.createObjectURL(g),u});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const m=Promise.resolve(u).then(function(f){return new Promise(function(g,v){let w=g;t.isImageBitmapLoader===!0&&(w=function(b){const x=new p.Texture(b);x.needsUpdate=!0,g(x)}),t.load(p.LoaderUtils.resolveURL(f,o.path),w,void 0,v)})}).then(function(f){return d===!0&&c.revokeObjectURL(u),Ln(f,a),f.userData.mimeType=a.mimeType||Zp(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),f});return this.sourceCache[e]=m,m}assignTexture(e,t,n,i){const o=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),o.extensions[ve.KHR_TEXTURE_TRANSFORM]){const c=n.extensions!==void 0?n.extensions[ve.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const u=o.associations.get(a);a=o.extensions[ve.KHR_TEXTURE_TRANSFORM].extendTexture(a,c),o.associations.set(a,u)}}return i!==void 0&&(typeof i=="number"&&(i=i===Jl?pi:Sn),"colorSpace"in a?a.colorSpace=i:a.encoding=i===pi?Jl:qf),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const c="PointsMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new p.PointsMaterial,p.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(c,u)),n=u}else if(e.isLine){const c="LineBasicMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new p.LineBasicMaterial,p.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,this.cache.add(c,u)),n=u}if(i||o||a){let c="ClonedMaterial:"+n.uuid+":";i&&(c+="derivative-tangents:"),o&&(c+="vertex-colors:"),a&&(c+="flat-shading:");let u=this.cache.get(c);u||(u=n.clone(),o&&(u.vertexColors=!0),a&&(u.flatShading=!0),i&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(c,u),this.associations.set(u,this.associations.get(n))),n=u}e.material=n}getMaterialType(){return p.MeshStandardMaterial}loadMaterial(e){const t=this,n=this.json,i=this.extensions,o=n.materials[e];let a;const c={},u=o.extensions||{},d=[];if(u[ve.KHR_MATERIALS_UNLIT]){const f=i[ve.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),d.push(f.extendParams(c,o,t))}else{const f=o.pbrMetallicRoughness||{};if(c.color=new p.Color(1,1,1),c.opacity=1,Array.isArray(f.baseColorFactor)){const g=f.baseColorFactor;c.color.setRGB(g[0],g[1],g[2],Sn),c.opacity=g[3]}f.baseColorTexture!==void 0&&d.push(t.assignTexture(c,"map",f.baseColorTexture,pi)),c.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,c.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(c,"metalnessMap",f.metallicRoughnessTexture)),d.push(t.assignTexture(c,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,c)})))}o.doubleSided===!0&&(c.side=p.DoubleSide);const m=o.alphaMode||Go.OPAQUE;if(m===Go.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,m===Go.MASK&&(c.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==p.MeshBasicMaterial&&(d.push(t.assignTexture(c,"normalMap",o.normalTexture)),c.normalScale=new p.Vector2(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;c.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&a!==p.MeshBasicMaterial&&(d.push(t.assignTexture(c,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==p.MeshBasicMaterial){const f=o.emissiveFactor;c.emissive=new p.Color().setRGB(f[0],f[1],f[2],Sn)}return o.emissiveTexture!==void 0&&a!==p.MeshBasicMaterial&&d.push(t.assignTexture(c,"emissiveMap",o.emissiveTexture,pi)),Promise.all(d).then(function(){const f=new a(c);return o.name&&(f.name=o.name),Ln(f,o),t.associations.set(f,{materials:e}),o.extensions&&mi(i,f,o),f})}createUniqueName(e){const t=p.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function o(c){return n[ve.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,t).then(function(u){return ec(u,c,t)})}const a=[];for(let c=0,u=e.length;c<u;c++){const d=e[c],m=Wp(d),f=i[m];if(f)a.push(f.promise);else{let g;d.extensions&&d.extensions[ve.KHR_DRACO_MESH_COMPRESSION]?g=o(d):g=ec(new p.BufferGeometry,d,t),i[m]={primitive:d,promise:g},a.push(g)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,o=n.meshes[e],a=o.primitives,c=[];for(let u=0,d=a.length;u<d;u++){const m=a[u].material===void 0?Cp(this.cache):this.getDependency("material",a[u].material);c.push(m)}return c.push(t.loadGeometries(a)),Promise.all(c).then(function(u){const d=u.slice(0,u.length-1),m=u[u.length-1],f=[];for(let v=0,w=m.length;v<w;v++){const b=m[v],x=a[v];let L;const M=d[v];if(x.mode===Kt.TRIANGLES||x.mode===Kt.TRIANGLE_STRIP||x.mode===Kt.TRIANGLE_FAN||x.mode===void 0)L=o.isSkinnedMesh===!0?new p.SkinnedMesh(b,M):new p.Mesh(b,M),L.isSkinnedMesh===!0&&L.normalizeSkinWeights(),x.mode===Kt.TRIANGLE_STRIP?L.geometry=Fl(L.geometry,p.TriangleStripDrawMode):x.mode===Kt.TRIANGLE_FAN&&(L.geometry=Fl(L.geometry,p.TriangleFanDrawMode));else if(x.mode===Kt.LINES)L=new p.LineSegments(b,M);else if(x.mode===Kt.LINE_STRIP)L=new p.Line(b,M);else if(x.mode===Kt.LINE_LOOP)L=new p.LineLoop(b,M);else if(x.mode===Kt.POINTS)L=new p.Points(b,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(L.geometry.morphAttributes).length>0&&Gp(L,o),L.name=t.createUniqueName(o.name||"mesh_"+e),Ln(L,o),x.extensions&&mi(i,L,x),t.assignFinalMaterial(L),f.push(L)}for(let v=0,w=f.length;v<w;v++)t.associations.set(f[v],{meshes:e,primitives:v});if(f.length===1)return o.extensions&&mi(i,f[0],o),f[0];const g=new p.Group;o.extensions&&mi(i,g,o),t.associations.set(g,{meshes:e});for(let v=0,w=f.length;v<w;v++)g.add(f[v]);return g})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new p.PerspectiveCamera(p.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new p.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Ln(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,o=t.joints.length;i<o;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const o=i.pop(),a=i,c=[],u=[];for(let d=0,m=a.length;d<m;d++){const f=a[d];if(f){c.push(f);const g=new p.Matrix4;o!==null&&g.fromArray(o.array,d*16),u.push(g)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new p.Skeleton(c,u)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],o=i.name?i.name:"animation_"+e,a=[],c=[],u=[],d=[],m=[];for(let f=0,g=i.channels.length;f<g;f++){const v=i.channels[f],w=i.samplers[v.sampler],b=v.target,x=b.node,L=i.parameters!==void 0?i.parameters[w.input]:w.input,M=i.parameters!==void 0?i.parameters[w.output]:w.output;b.node!==void 0&&(a.push(this.getDependency("node",x)),c.push(this.getDependency("accessor",L)),u.push(this.getDependency("accessor",M)),d.push(w),m.push(b))}return Promise.all([Promise.all(a),Promise.all(c),Promise.all(u),Promise.all(d),Promise.all(m)]).then(function(f){const g=f[0],v=f[1],w=f[2],b=f[3],x=f[4],L=[];for(let M=0,C=g.length;M<C;M++){const W=g[M],z=v[M],D=w[M],X=b[M],I=x[M];if(W===void 0)continue;W.updateMatrix&&W.updateMatrix();const K=n._createAnimationTracks(W,z,D,X,I);if(K)for(let V=0;V<K.length;V++)L.push(K[V])}return new p.AnimationClip(o,void 0,L)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(o){const a=n._getNodeRef(n.meshCache,i.mesh,o);return i.weights!==void 0&&a.traverse(function(c){if(c.isMesh)for(let u=0,d=i.weights.length;u<d;u++)c.morphTargetInfluences[u]=i.weights[u]}),a})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],o=n._loadNodeShallow(e),a=[],c=i.children||[];for(let d=0,m=c.length;d<m;d++)a.push(n.getDependency("node",c[d]));const u=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([o,Promise.all(a),u]).then(function(d){const m=d[0],f=d[1],g=d[2];g!==null&&m.traverse(function(v){v.isSkinnedMesh&&v.bind(g,Vp)});for(let v=0,w=f.length;v<w;v++)m.add(f[v]);return m})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],a=o.name?i.createUniqueName(o.name):"",c=[],u=i._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return u&&c.push(u),o.camera!==void 0&&c.push(i.getDependency("camera",o.camera).then(function(d){return i._getNodeRef(i.cameraCache,o.camera,d)})),i._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){c.push(d)}),this.nodeCache[e]=Promise.all(c).then(function(d){let m;if(o.isBone===!0?m=new p.Bone:d.length>1?m=new p.Group:d.length===1?m=d[0]:m=new p.Object3D,m!==d[0])for(let f=0,g=d.length;f<g;f++)m.add(d[f]);if(o.name&&(m.userData.name=o.name,m.name=a),Ln(m,o),o.extensions&&mi(n,m,o),o.matrix!==void 0){const f=new p.Matrix4;f.fromArray(o.matrix),m.applyMatrix4(f)}else o.translation!==void 0&&m.position.fromArray(o.translation),o.rotation!==void 0&&m.quaternion.fromArray(o.rotation),o.scale!==void 0&&m.scale.fromArray(o.scale);return i.associations.has(m)||i.associations.set(m,{}),i.associations.get(m).nodes=e,m}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,o=new p.Group;n.name&&(o.name=i.createUniqueName(n.name)),Ln(o,n),n.extensions&&mi(t,o,n);const a=n.nodes||[],c=[];for(let u=0,d=a.length;u<d;u++)c.push(i.getDependency("node",a[u]));return Promise.all(c).then(function(u){for(let m=0,f=u.length;m<f;m++)o.add(u[m]);const d=m=>{const f=new Map;for(const[g,v]of i.associations)(g instanceof p.Material||g instanceof p.Texture)&&f.set(g,v);return m.traverse(g=>{const v=i.associations.get(g);v!=null&&f.set(g,v)}),f};return i.associations=d(o),o})}_createAnimationTracks(e,t,n,i,o){const a=[],c=e.name?e.name:e.uuid,u=[];Xn[o.path]===Xn.weights?e.traverse(function(g){g.morphTargetInfluences&&u.push(g.name?g.name:g.uuid)}):u.push(c);let d;switch(Xn[o.path]){case Xn.weights:d=p.NumberKeyframeTrack;break;case Xn.rotation:d=p.QuaternionKeyframeTrack;break;case Xn.position:case Xn.scale:d=p.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:d=p.NumberKeyframeTrack;break;case 2:case 3:default:d=p.VectorKeyframeTrack;break}break}const m=i.interpolation!==void 0?Pp[i.interpolation]:p.InterpolateLinear,f=this._getArrayFromAccessor(n);for(let g=0,v=u.length;g<v;g++){const w=new d(u[g]+"."+Xn[o.path],t.array,f,m);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(w),a.push(w)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Zo(t.constructor),i=new Float32Array(t.length);for(let o=0,a=t.length;o<a;o++)i[o]=t[o]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof p.QuaternionKeyframeTrack?Lp:El;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ap(r,e,t){const n=e.attributes,i=new p.Box3;if(n.POSITION!==void 0){const c=t.json.accessors[n.POSITION],u=c.min,d=c.max;if(u!==void 0&&d!==void 0){if(i.set(new p.Vector3(u[0],u[1],u[2]),new p.Vector3(d[0],d[1],d[2])),c.normalized){const m=Zo(Xi[c.componentType]);i.min.multiplyScalar(m),i.max.multiplyScalar(m)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const c=new p.Vector3,u=new p.Vector3;for(let d=0,m=o.length;d<m;d++){const f=o[d];if(f.POSITION!==void 0){const g=t.json.accessors[f.POSITION],v=g.min,w=g.max;if(v!==void 0&&w!==void 0){if(u.setX(Math.max(Math.abs(v[0]),Math.abs(w[0]))),u.setY(Math.max(Math.abs(v[1]),Math.abs(w[1]))),u.setZ(Math.max(Math.abs(v[2]),Math.abs(w[2]))),g.normalized){const b=Zo(Xi[g.componentType]);u.multiplyScalar(b)}c.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(c)}r.boundingBox=i;const a=new p.Sphere;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=a}function ec(r,e,t){const n=e.attributes,i=[];function o(a,c){return t.getDependency("accessor",a).then(function(u){r.setAttribute(c,u)})}for(const a in n){const c=To[a]||a.toLowerCase();c in r.attributes||i.push(o(n[a],c))}if(e.indices!==void 0&&!r.index){const a=t.getDependency("accessor",e.indices).then(function(c){r.setIndex(c)});i.push(a)}return Ln(r,e),Ap(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?Tp(r,e.targets,t):r})}function tc(r,e,t){const n=t.length-r-1;if(e>=t[n])return n-1;if(e<=t[r])return r;let i=r,o=n,a=Math.floor((i+o)/2);for(;e<t[a]||e>=t[a+1];)e<t[a]?o=a:i=a,a=Math.floor((i+o)/2);return a}function Fp(r,e,t,n){const i=[],o=[],a=[];i[0]=1;for(let c=1;c<=t;++c){o[c]=e-n[r+1-c],a[c]=n[r+c]-e;let u=0;for(let d=0;d<c;++d){const m=a[d+1],f=o[c-d],g=i[d]/(m+f);i[d]=u+m*g,u=f*g}i[c]=u}return i}function Op(r,e,t,n){const i=tc(r,n,e),o=Fp(i,n,r,e),a=new p.Vector4(0,0,0,0);for(let c=0;c<=r;++c){const u=t[i-r+c],d=o[c],m=u.w*d;a.x+=u.x*m,a.y+=u.y*m,a.z+=u.z*m,a.w+=u.w*d}return a}function Dp(r,e,t,n,i){const o=[];for(let f=0;f<=t;++f)o[f]=0;const a=[];for(let f=0;f<=n;++f)a[f]=o.slice(0);const c=[];for(let f=0;f<=t;++f)c[f]=o.slice(0);c[0][0]=1;const u=o.slice(0),d=o.slice(0);for(let f=1;f<=t;++f){u[f]=e-i[r+1-f],d[f]=i[r+f]-e;let g=0;for(let v=0;v<f;++v){const w=d[v+1],b=u[f-v];c[f][v]=w+b;const x=c[v][f-1]/c[f][v];c[v][f]=g+w*x,g=b*x}c[f][f]=g}for(let f=0;f<=t;++f)a[0][f]=c[f][t];for(let f=0;f<=t;++f){let g=0,v=1;const w=[];for(let b=0;b<=t;++b)w[b]=o.slice(0);w[0][0]=1;for(let b=1;b<=n;++b){let x=0;const L=f-b,M=t-b;f>=b&&(w[v][0]=w[g][0]/c[M+1][L],x=w[v][0]*c[L][M]);const C=L>=-1?1:-L,W=f-1<=M?b-1:t-f;for(let D=C;D<=W;++D)w[v][D]=(w[g][D]-w[g][D-1])/c[M+1][L+D],x+=w[v][D]*c[L+D][M];f<=M&&(w[v][b]=-w[g][b-1]/c[M+1][f],x+=w[v][b]*c[f][M]),a[b][f]=x;const z=g;g=v,v=z}}let m=t;for(let f=1;f<=n;++f){for(let g=0;g<=t;++g)a[f][g]*=m;m*=t-f}return a}function zp(r,e,t,n,i){const o=i<r?i:r,a=[],c=tc(r,n,e),u=Dp(c,n,r,o,e),d=[];for(let m=0;m<t.length;++m){const f=t[m].clone(),g=f.w;f.x*=g,f.y*=g,f.z*=g,d[m]=f}for(let m=0;m<=o;++m){const f=d[c-r].clone().multiplyScalar(u[m][0]);for(let g=1;g<=r;++g)f.add(d[c-r+g].clone().multiplyScalar(u[m][g]));a[m]=f}for(let m=o+1;m<=i+1;++m)a[m]=new p.Vector4(0,0,0);return a}function Xp(r,e){let t=1;for(let i=2;i<=r;++i)t*=i;let n=1;for(let i=2;i<=e;++i)n*=i;for(let i=2;i<=r-e;++i)n*=i;return t/n}function Up(r){const e=r.length,t=[],n=[];for(let o=0;o<e;++o){const a=r[o];t[o]=new p.Vector3(a.x,a.y,a.z),n[o]=a.w}const i=[];for(let o=0;o<e;++o){const a=t[o].clone();for(let c=1;c<=o;++c)a.sub(i[o-c].clone().multiplyScalar(Xp(o,c)*n[c]));i[o]=a.divideScalar(n[0])}return i}function kp(r,e,t,n,i){const o=zp(r,e,t,n,i);return Up(o)}class nc extends p.Curve{constructor(e,t,n,i,o){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=i||0,this.endKnot=o||this.knots.length-1;for(let a=0;a<n.length;++a){const c=n[a];this.controlPoints[a]=new p.Vector4(c.x,c.y,c.z,c.w)}}getPoint(e,t){const n=t||new p.Vector3,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),o=Op(this.degree,this.knots,this.controlPoints,i);return o.w!=1&&o.divideScalar(o.w),n.set(o.x,o.y,o.z)}getTangent(e,t){const n=t||new p.Vector3,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),o=kp(this.degree,this.knots,this.controlPoints,i,1);return n.copy(o[1]).normalize(),n}}let _e,Ue,bt;class Kp extends p.Loader{constructor(e){super(e)}load(e,t,n,i){const o=this,a=o.path===""?p.LoaderUtils.extractUrlBase(e):o.path,c=new p.FileLoader(this.manager);c.setPath(o.path),c.setResponseType("arraybuffer"),c.setRequestHeader(o.requestHeader),c.setWithCredentials(o.withCredentials),c.load(e,function(u){try{t(o.parse(u,a))}catch(d){i?i(d):console.error(d),o.manager.itemError(e)}},n,i)}parse(e,t){if(Jp(e))_e=new jp().parse(e);else{const i=lc(e);if(!Qp(i))throw new Error("THREE.FBXLoader: Unknown format.");if(sc(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+sc(i));_e=new Rp().parse(i)}const n=new p.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Np(n,this.manager).parse(_e)}}class Np{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Ue=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),i=this.parseDeformers(),o=new Bp().parse(i);return this.parseScene(i,o,n),bt}parseConnections(){const e=new Map;return"Connections"in _e&&_e.Connections.connections.forEach(function(n){const i=n[0],o=n[1],a=n[2];e.has(i)||e.set(i,{parents:[],children:[]});const c={ID:o,relationship:a};e.get(i).parents.push(c),e.has(o)||e.set(o,{parents:[],children:[]});const u={ID:i,relationship:a};e.get(o).children.push(u)}),e}parseImages(){const e={},t={};if("Video"in _e.Objects){const n=_e.Objects.Video;for(const i in n){const o=n[i],a=parseInt(i);if(e[a]=o.RelativeFilename||o.Filename,"Content"in o){const c=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,u=typeof o.Content=="string"&&o.Content!=="";if(c||u){const d=this.parseImage(n[i]);t[o.RelativeFilename||o.Filename]=d}}}}for(const n in e){const i=e[n];t[i]!==void 0?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let o;switch(i){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in _e.Objects){const n=_e.Objects.Texture;for(const i in n){const o=this.parseTexture(n[i],e);t.set(parseInt(i),o)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const i=e.WrapModeU,o=e.WrapModeV,a=i!==void 0?i.value:0,c=o!==void 0?o.value:0;if(n.wrapS=a===0?p.RepeatWrapping:p.ClampToEdgeWrapping,n.wrapT=c===0?p.RepeatWrapping:p.ClampToEdgeWrapping,"Scaling"in e){const u=e.Scaling.value;n.repeat.x=u[0],n.repeat.y=u[1]}return n}loadTexture(e,t){let n;const i=this.textureLoader.path,o=Ue.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(n=t[o[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let a;const c=e.FileName.slice(-3).toLowerCase();if(c==="tga"){const u=this.manager.getHandler(".tga");u===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),a=new p.Texture):(u.setPath(this.textureLoader.path),a=u.load(n))}else c==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),a=new p.Texture):a=this.textureLoader.load(n);return this.textureLoader.setPath(i),a}parseMaterials(e){const t=new Map;if("Material"in _e.Objects){const n=_e.Objects.Material;for(const i in n){const o=this.parseMaterial(n[i],e);o!==null&&t.set(parseInt(i),o)}}return t}parseMaterial(e,t){const n=e.id,i=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ue.has(n))return null;const a=this.parseParameters(e,t,n);let c;switch(o.toLowerCase()){case"phong":c=new p.MeshPhongMaterial;break;case"lambert":c=new p.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),c=new p.MeshPhongMaterial;break}return c.setValues(a),c.name=i,c}parseParameters(e,t,n){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new p.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new p.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new p.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new p.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new p.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new p.Color().fromArray(e.SpecularColor.value));const o=this;return Ue.get(n).children.forEach(function(a){const c=a.relationship;switch(c){case"Bump":i.bumpMap=o.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":i.aoMap=o.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=o.getTexture(t,a.ID),i.map!==void 0&&("colorSpace"in i.map?i.map.colorSpace="srgb":i.map.encoding=3001);break;case"DisplacementColor":i.displacementMap=o.getTexture(t,a.ID);break;case"EmissiveColor":i.emissiveMap=o.getTexture(t,a.ID),i.emissiveMap!==void 0&&("colorSpace"in i.emissiveMap?i.emissiveMap.colorSpace="srgb":i.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=o.getTexture(t,a.ID);break;case"ReflectionColor":i.envMap=o.getTexture(t,a.ID),i.envMap!==void 0&&(i.envMap.mapping=p.EquirectangularReflectionMapping,"colorSpace"in i.envMap?i.envMap.colorSpace="srgb":i.envMap.encoding=3001);break;case"SpecularColor":i.specularMap=o.getTexture(t,a.ID),i.specularMap!==void 0&&("colorSpace"in i.specularMap?i.specularMap.colorSpace="srgb":i.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=o.getTexture(t,a.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",c);break}}),i}getTexture(e,t){return"LayeredTexture"in _e.Objects&&t in _e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ue.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in _e.Objects){const n=_e.Objects.Deformer;for(const i in n){const o=n[i],a=Ue.get(parseInt(i));if(o.attrType==="Skin"){const c=this.parseSkeleton(a,n);c.ID=i,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),c.geometryID=a.parents[0].ID,e[i]=c}else if(o.attrType==="BlendShape"){const c={id:i};c.rawTargets=this.parseMorphTargets(a,n),c.id=i,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=c}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(i){const o=t[i.ID];if(o.attrType!=="Cluster")return;const a={ID:i.ID,indices:[],weights:[],transformLink:new p.Matrix4().fromArray(o.TransformLink.a)};"Indexes"in o&&(a.indices=o.Indexes.a,a.weights=o.Weights.a),n.push(a)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let i=0;i<e.children.length;i++){const o=e.children[i],a=t[o.ID],c={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;c.geoID=Ue.get(parseInt(o.ID)).children.filter(function(u){return u.relationship===void 0})[0].ID,n.push(c)}return n}parseScene(e,t,n){bt=new p.Group;const i=this.parseModels(e.skeletons,t,n),o=_e.Objects.Model,a=this;i.forEach(function(u){const d=o[u.ID];a.setLookAtProperties(u,d),Ue.get(u.ID).parents.forEach(function(f){const g=i.get(f.ID);g!==void 0&&g.add(u)}),u.parent===null&&bt.add(u)}),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),bt.traverse(function(u){if(u.userData.transformData){u.parent&&(u.userData.transformData.parentMatrix=u.parent.matrix,u.userData.transformData.parentMatrixWorld=u.parent.matrixWorld);const d=oc(u.userData.transformData);u.applyMatrix4(d),u.updateWorldMatrix()}});const c=new Yp().parse();bt.children.length===1&&bt.children[0].isGroup&&(bt.children[0].animations=c,bt=bt.children[0]),bt.animations=c}parseModels(e,t,n){const i=new Map,o=_e.Objects.Model;for(const a in o){const c=parseInt(a),u=o[a],d=Ue.get(c);let m=this.buildSkeleton(d,e,c,u.attrName);if(!m){switch(u.attrType){case"Camera":m=this.createCamera(d);break;case"Light":m=this.createLight(d);break;case"Mesh":m=this.createMesh(d,t,n);break;case"NurbsCurve":m=this.createCurve(d,t);break;case"LimbNode":case"Root":m=new p.Bone;break;case"Null":default:m=new p.Group;break}m.name=u.attrName?p.PropertyBinding.sanitizeNodeName(u.attrName):"",m.ID=c}this.getTransformData(m,u),i.set(c,m)}return i}buildSkeleton(e,t,n,i){let o=null;return e.parents.forEach(function(a){for(const c in t){const u=t[c];u.rawBones.forEach(function(d,m){if(d.ID===a.ID){const f=o;o=new p.Bone,o.matrixWorld.copy(d.transformLink),o.name=i?p.PropertyBinding.sanitizeNodeName(i):"",o.ID=n,u.bones[m]=o,f!==null&&o.add(f)}})}}),o}createCamera(e){let t,n;if(e.children.forEach(function(i){const o=_e.Objects.NodeAttribute[i.ID];o!==void 0&&(n=o)}),n===void 0)t=new p.Object3D;else{let i=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(i=1);let o=1;n.NearPlane!==void 0&&(o=n.NearPlane.value/1e3);let a=1e3;n.FarPlane!==void 0&&(a=n.FarPlane.value/1e3);let c=window.innerWidth,u=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(c=n.AspectWidth.value,u=n.AspectHeight.value);const d=c/u;let m=45;n.FieldOfView!==void 0&&(m=n.FieldOfView.value);const f=n.FocalLength?n.FocalLength.value:null;switch(i){case 0:t=new p.PerspectiveCamera(m,d,o,a),f!==null&&t.setFocalLength(f);break;case 1:t=new p.OrthographicCamera(-c/2,c/2,u/2,-u/2,o,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new p.Object3D;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(i){const o=_e.Objects.NodeAttribute[i.ID];o!==void 0&&(n=o)}),n===void 0)t=new p.Object3D;else{let i;n.LightType===void 0?i=0:i=n.LightType.value;let o=16777215;n.Color!==void 0&&(o=new p.Color().fromArray(n.Color.value));let a=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(a=0);let c=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?c=0:c=n.FarAttenuationEnd.value);const u=1;switch(i){case 0:t=new p.PointLight(o,a,c,u);break;case 1:t=new p.DirectionalLight(o,a);break;case 2:let d=Math.PI/3;n.InnerAngle!==void 0&&(d=p.MathUtils.degToRad(n.InnerAngle.value));let m=0;n.OuterAngle!==void 0&&(m=p.MathUtils.degToRad(n.OuterAngle.value),m=Math.max(m,1)),t=new p.SpotLight(o,a,c,d,m,u);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new p.PointLight(o,a);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let i,o=null,a=null;const c=[];return e.children.forEach(function(u){t.has(u.ID)&&(o=t.get(u.ID)),n.has(u.ID)&&c.push(n.get(u.ID))}),c.length>1?a=c:c.length>0?a=c[0]:(a=new p.MeshPhongMaterial({color:13421772}),c.push(a)),"color"in o.attributes&&c.forEach(function(u){u.vertexColors=!0}),o.FBX_Deformer?(i=new p.SkinnedMesh(o,a),i.normalizeSkinWeights()):i=new p.Mesh(o,a),i}createCurve(e,t){const n=e.children.reduce(function(o,a){return t.has(a.ID)&&(o=t.get(a.ID)),o},null),i=new p.LineBasicMaterial({color:3342591,linewidth:1});return new p.Line(n,i)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=ac(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Ue.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const o=_e.Objects.Model[i.ID];if("Lcl_Translation"in o){const a=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),bt.add(e.target)):e.lookAt(new p.Vector3().fromArray(a))}}})}bindSkeleton(e,t,n){const i=this.parsePoseNodes();for(const o in e){const a=e[o];Ue.get(parseInt(a.ID)).parents.forEach(function(u){if(t.has(u.ID)){const d=u.ID;Ue.get(d).parents.forEach(function(f){n.has(f.ID)&&n.get(f.ID).bind(new p.Skeleton(a.bones),i[f.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in _e.Objects){const t=_e.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const i=t[n].PoseNode;Array.isArray(i)?i.forEach(function(o){e[o.Node]=new p.Matrix4().fromArray(o.Matrix.a)}):e[i.Node]=new p.Matrix4().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in _e&&"AmbientColor"in _e.GlobalSettings){const e=_e.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(t!==0||n!==0||i!==0){const o=new p.Color(t,n,i);bt.add(new p.AmbientLight(o,1))}}}}class Bp{parse(e){const t=new Map;if("Geometry"in _e.Objects){const n=_e.Objects.Geometry;for(const i in n){const o=Ue.get(parseInt(i)),a=this.parseGeometry(o,n[i],e);t.set(parseInt(i),a)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const i=n.skeletons,o=[],a=e.parents.map(function(f){return _e.Objects.Model[f.ID]});if(a.length===0)return;const c=e.children.reduce(function(f,g){return i[g.ID]!==void 0&&(f=i[g.ID]),f},null);e.children.forEach(function(f){n.morphTargets[f.ID]!==void 0&&o.push(n.morphTargets[f.ID])});const u=a[0],d={};"RotationOrder"in u&&(d.eulerOrder=ac(u.RotationOrder.value)),"InheritType"in u&&(d.inheritType=parseInt(u.InheritType.value)),"GeometricTranslation"in u&&(d.translation=u.GeometricTranslation.value),"GeometricRotation"in u&&(d.rotation=u.GeometricRotation.value),"GeometricScaling"in u&&(d.scale=u.GeometricScaling.value);const m=oc(d);return this.genGeometry(t,c,o,m)}genGeometry(e,t,n,i){const o=new p.BufferGeometry;e.attrName&&(o.name=e.attrName);const a=this.parseGeoNode(e,t),c=this.genBuffers(a),u=new p.Float32BufferAttribute(c.vertex,3);if(u.applyMatrix4(i),o.setAttribute("position",u),c.colors.length>0&&o.setAttribute("color",new p.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new p.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new p.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),c.normal.length>0){const d=new p.Matrix3().getNormalMatrix(i),m=new p.Float32BufferAttribute(c.normal,3);m.applyNormalMatrix(d),o.setAttribute("normal",m)}if(c.uvs.forEach(function(d,m){wo==="uv2"&&m++;const f=m===0?"uv":`uv${m}`;o.setAttribute(f,new p.Float32BufferAttribute(c.uvs[m],2))}),a.material&&a.material.mappingType!=="AllSame"){let d=c.materialIndex[0],m=0;if(c.materialIndex.forEach(function(f,g){f!==d&&(o.addGroup(m,g-m,d),d=f,m=g)}),o.groups.length>0){const f=o.groups[o.groups.length-1],g=f.start+f.count;g!==c.materialIndex.length&&o.addGroup(g,c.materialIndex.length-g,d)}o.groups.length===0&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(o,e,n,i),o}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(i,o){i.indices.forEach(function(a,c){n.weightTable[a]===void 0&&(n.weightTable[a]=[]),n.weightTable[a].push({id:o,weight:i.weights[c]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,o=!1,a=[],c=[],u=[],d=[],m=[],f=[];const g=this;return e.vertexIndices.forEach(function(v,w){let b,x=!1;v<0&&(v=v^-1,x=!0);let L=[],M=[];if(a.push(v*3,v*3+1,v*3+2),e.color){const C=ns(w,n,v,e.color);u.push(C[0],C[1],C[2])}if(e.skeleton){if(e.weightTable[v]!==void 0&&e.weightTable[v].forEach(function(C){M.push(C.weight),L.push(C.id)}),M.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const C=[0,0,0,0],W=[0,0,0,0];M.forEach(function(z,D){let X=z,I=L[D];W.forEach(function(K,V,G){if(X>K){G[V]=X,X=K;const k=C[V];C[V]=I,I=k}})}),L=C,M=W}for(;M.length<4;)M.push(0),L.push(0);for(let C=0;C<4;++C)m.push(M[C]),f.push(L[C])}if(e.normal){const C=ns(w,n,v,e.normal);c.push(C[0],C[1],C[2])}e.material&&e.material.mappingType!=="AllSame"&&(b=ns(w,n,v,e.material)[0]),e.uv&&e.uv.forEach(function(C,W){const z=ns(w,n,v,C);d[W]===void 0&&(d[W]=[]),d[W].push(z[0]),d[W].push(z[1])}),i++,x&&(g.genFace(t,e,a,b,c,u,d,m,f,i),n++,i=0,a=[],c=[],u=[],d=[],m=[],f=[])}),t}genFace(e,t,n,i,o,a,c,u,d,m){for(let f=2;f<m;f++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[(f-1)*3]]),e.vertex.push(t.vertexPositions[n[(f-1)*3+1]]),e.vertex.push(t.vertexPositions[n[(f-1)*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(u[0]),e.vertexWeights.push(u[1]),e.vertexWeights.push(u[2]),e.vertexWeights.push(u[3]),e.vertexWeights.push(u[(f-1)*4]),e.vertexWeights.push(u[(f-1)*4+1]),e.vertexWeights.push(u[(f-1)*4+2]),e.vertexWeights.push(u[(f-1)*4+3]),e.vertexWeights.push(u[f*4]),e.vertexWeights.push(u[f*4+1]),e.vertexWeights.push(u[f*4+2]),e.vertexWeights.push(u[f*4+3]),e.weightsIndices.push(d[0]),e.weightsIndices.push(d[1]),e.weightsIndices.push(d[2]),e.weightsIndices.push(d[3]),e.weightsIndices.push(d[(f-1)*4]),e.weightsIndices.push(d[(f-1)*4+1]),e.weightsIndices.push(d[(f-1)*4+2]),e.weightsIndices.push(d[(f-1)*4+3]),e.weightsIndices.push(d[f*4]),e.weightsIndices.push(d[f*4+1]),e.weightsIndices.push(d[f*4+2]),e.weightsIndices.push(d[f*4+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[(f-1)*3]),e.colors.push(a[(f-1)*3+1]),e.colors.push(a[(f-1)*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(o[0]),e.normal.push(o[1]),e.normal.push(o[2]),e.normal.push(o[(f-1)*3]),e.normal.push(o[(f-1)*3+1]),e.normal.push(o[(f-1)*3+2]),e.normal.push(o[f*3]),e.normal.push(o[f*3+1]),e.normal.push(o[f*3+2])),t.uv&&t.uv.forEach(function(g,v){e.uvs[v]===void 0&&(e.uvs[v]=[]),e.uvs[v].push(c[v][0]),e.uvs[v].push(c[v][1]),e.uvs[v].push(c[v][(f-1)*2]),e.uvs[v].push(c[v][(f-1)*2+1]),e.uvs[v].push(c[v][f*2]),e.uvs[v].push(c[v][f*2+1])})}addMorphTargets(e,t,n,i){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const o=this;n.forEach(function(a){a.rawTargets.forEach(function(c){const u=_e.Objects.Geometry[c.geoID];u!==void 0&&o.genMorphGeometry(e,t,u,i,c.name)})})}genMorphGeometry(e,t,n,i,o){const a=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],c=n.Vertices!==void 0?n.Vertices.a:[],u=n.Indexes!==void 0?n.Indexes.a:[],d=e.attributes.position.count*3,m=new Float32Array(d);for(let w=0;w<u.length;w++){const b=u[w]*3;m[b]=c[w*3],m[b+1]=c[w*3+1],m[b+2]=c[w*3+2]}const f={vertexIndices:a,vertexPositions:m},g=this.genBuffers(f),v=new p.Float32BufferAttribute(g.vertex,3);v.name=o||n.attrName,v.applyMatrix4(i),e.morphAttributes.position.push(v)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a;let o=[];return n==="IndexToDirect"&&("NormalIndex"in e?o=e.NormalIndex.a:"NormalsIndex"in e&&(o=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:o,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a;let o=[];return n==="IndexToDirect"&&(o=e.UVIndex.a),{dataSize:2,buffer:i,indices:o,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a;let o=[];return n==="IndexToDirect"&&(o=e.ColorIndex.a),{dataSize:4,buffer:i,indices:o,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const i=e.Materials.a,o=[];for(let a=0;a<i.length;++a)o.push(a);return{dataSize:1,buffer:i,indices:o,mappingType:t,referenceType:n}}parseNurbsGeometry(e){if(nc===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new p.BufferGeometry;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new p.BufferGeometry;const n=t-1,i=e.KnotVector.a,o=[],a=e.Points.a;for(let f=0,g=a.length;f<g;f+=4)o.push(new p.Vector4().fromArray(a,f));let c,u;if(e.Form==="Closed")o.push(o[0]);else if(e.Form==="Periodic"){c=n,u=i.length-1-c;for(let f=0;f<n;++f)o.push(o[f])}const m=new nc(n,i,o,c,u).getPoints(o.length*12);return new p.BufferGeometry().setFromPoints(m)}}class Yp{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const i=t[n],o=this.addClip(i);e.push(o)}return e}parseClips(){if(_e.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=_e.Objects.AnimationCurveNode,t=new Map;for(const n in e){const i=e[n];if(i.attrName.match(/S|R|T|DeformPercent/)!==null){const o={id:i.id,attr:i.attrName,curves:{}};t.set(o.id,o)}}return t}parseAnimationCurves(e){const t=_e.Objects.AnimationCurve;for(const n in t){const i={id:t[n].id,times:t[n].KeyTime.a.map(Hp),values:t[n].KeyValueFloat.a},o=Ue.get(i.id);if(o!==void 0){const a=o.parents[0].ID,c=o.parents[0].relationship;c.match(/X/)?e.get(a).curves.x=i:c.match(/Y/)?e.get(a).curves.y=i:c.match(/Z/)?e.get(a).curves.z=i:c.match(/d|DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=i)}}}parseAnimationLayers(e){const t=_e.Objects.AnimationLayer,n=new Map;for(const i in t){const o=[],a=Ue.get(parseInt(i));a!==void 0&&(a.children.forEach(function(u,d){if(e.has(u.ID)){const m=e.get(u.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(o[d]===void 0){const f=Ue.get(u.ID).parents.filter(function(g){return g.relationship!==void 0})[0].ID;if(f!==void 0){const g=_e.Objects.Model[f.toString()];if(g===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",u);return}const v={modelName:g.attrName?p.PropertyBinding.sanitizeNodeName(g.attrName):"",ID:g.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};bt.traverse(function(w){w.ID===g.id&&(v.transform=w.matrix,w.userData.transformData&&(v.eulerOrder=w.userData.transformData.eulerOrder))}),v.transform||(v.transform=new p.Matrix4),"PreRotation"in g&&(v.preRotation=g.PreRotation.value),"PostRotation"in g&&(v.postRotation=g.PostRotation.value),o[d]=v}}o[d]&&(o[d][m.attr]=m)}else if(m.curves.morph!==void 0){if(o[d]===void 0){const f=Ue.get(u.ID).parents.filter(function(L){return L.relationship!==void 0})[0].ID,g=Ue.get(f).parents[0].ID,v=Ue.get(g).parents[0].ID,w=Ue.get(v).parents[0].ID,b=_e.Objects.Model[w],x={modelName:b.attrName?p.PropertyBinding.sanitizeNodeName(b.attrName):"",morphName:_e.Objects.Deformer[f].attrName};o[d]=x}o[d][m.attr]=m}}}),n.set(parseInt(i),o))}return n}parseAnimStacks(e){const t=_e.Objects.AnimationStack,n={};for(const i in t){const o=Ue.get(parseInt(i)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(o[0].ID);n[i]={name:t[i].attrName,layer:a}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(i){t=t.concat(n.generateTracks(i))}),new p.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let n=new p.Vector3,i=new p.Quaternion,o=new p.Vector3;if(e.transform&&e.transform.decompose(n,i,o),n=n.toArray(),i=new p.Euler().setFromQuaternion(i,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");a!==void 0&&t.push(a)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const a=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);a!==void 0&&t.push(a)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");a!==void 0&&t.push(a)}if(e.DeformPercent!==void 0){const a=this.generateMorphTrack(e);a!==void 0&&t.push(a)}return t}generateVectorTrack(e,t,n,i){const o=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(o,t,n);return new p.VectorKeyframeTrack(e+"."+i,o,a)}generateRotationTrack(e,t,n,i,o,a){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(p.MathUtils.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(p.MathUtils.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(p.MathUtils.degToRad));const c=this.getTimesForAllAxes(t),u=this.getKeyframeTrackValues(c,t,n);i!==void 0&&(i=i.map(p.MathUtils.degToRad),i.push(a),i=new p.Euler().fromArray(i),i=new p.Quaternion().setFromEuler(i)),o!==void 0&&(o=o.map(p.MathUtils.degToRad),o.push(a),o=new p.Euler().fromArray(o),o=new p.Quaternion().setFromEuler(o).invert());const d=new p.Quaternion,m=new p.Euler,f=[];for(let g=0;g<u.length;g+=3)m.set(u[g],u[g+1],u[g+2],a),d.setFromEuler(m),i!==void 0&&d.premultiply(i),o!==void 0&&d.multiply(o),d.toArray(f,g/3*4);return new p.QuaternionKeyframeTrack(e+".quaternion",c,f)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(o){return o/100}),i=bt.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new p.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,i){return n-i}),t.length>1){let n=1,i=t[0];for(let o=1;o<t.length;o++){const a=t[o];a!==i&&(t[n]=a,i=a,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const i=n,o=[];let a=-1,c=-1,u=-1;return e.forEach(function(d){if(t.x&&(a=t.x.times.indexOf(d)),t.y&&(c=t.y.times.indexOf(d)),t.z&&(u=t.z.times.indexOf(d)),a!==-1){const m=t.x.values[a];o.push(m),i[0]=m}else o.push(i[0]);if(c!==-1){const m=t.y.values[c];o.push(m),i[1]=m}else o.push(i[1]);if(u!==-1){const m=t.z.values[u];o.push(m),i[2]=m}else o.push(i[2])}),o}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],i=e.values[t]-n,o=Math.abs(i);if(o>=180){const a=o/180,c=i/a;let u=n+c;const d=e.times[t-1],f=(e.times[t]-d)/a;let g=d+f;const v=[],w=[];for(;g<e.times[t];)v.push(g),g+=f,w.push(u),u+=c;e.times=cc(e.times,t,v),e.values=cc(e.values,t,w)}}}}class Rp{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new rc,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(i,o){const a=i.match(/^[\s\t]*;/),c=i.match(/^[\s\t]*$/);if(a||c)return;const u=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),d=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),m=i.match("^\\t{"+(t.currentIndent-1)+"}}");u?t.parseNodeBegin(i,u):d?t.parseNodeProperty(i,d,n[++o]):m?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(u){return u.trim().replace(/^"/,"").replace(/"$/,"")}),o={name:n},a=this.parseNodeAttr(i),c=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,o):n in c?(n==="PoseNode"?c.PoseNode.push(o):c[n].id!==void 0&&(c[n]={},c[n][c[n].id]=c[n]),a.id!==""&&(c[n][a.id]=o)):typeof a.id=="number"?(c[n]={},c[n][a.id]=o):n!=="Properties70"&&(n==="PoseNode"?c[n]=[o]:c[n]=o),typeof a.id=="number"&&(o.id=a.id),a.name!==""&&(o.attrName=a.name),a.type!==""&&(o.attrType=a.type),this.pushStack(o)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&o===","&&(o=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,i,o);return}if(i==="C"){const u=o.split(",").slice(1),d=parseInt(u[0]),m=parseInt(u[1]);let f=o.split(",").slice(3);f=f.map(function(g){return g.trim().replace(/^"/,"")}),i="connections",o=[d,m],$p(o,f),a[i]===void 0&&(a[i]=[])}i==="Node"&&(a.id=o),i in a&&Array.isArray(a[i])?a[i].push(o):i!=="a"?a[i]=o:a.a=o,this.setCurrentProp(a,i),i==="a"&&o.slice(-1)!==","&&(a.a=Io(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Io(t.a))}parseNodeSpecialProperty(e,t,n){const i=n.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=i[0],a=i[1],c=i[2],u=i[3];let d=i[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":d=parseFloat(d);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":d=Io(d);break}this.getPrevNode()[o]={type:a,type2:c,flag:u,value:d},this.setCurrentProp(this.getPrevNode(),o)}}class jp{parse(e){const t=new ic(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new rc;for(;!this.endOfContent(t);){const o=this.parseNode(t,n);o!==null&&i.add(o.name,o)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},i=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),c=e.getString(a);if(i===0)return null;const u=[];for(let g=0;g<o;g++)u.push(this.parseProperty(e));const d=u.length>0?u[0]:"",m=u.length>1?u[1]:"",f=u.length>2?u[2]:"";for(n.singleProperty=o===1&&e.getOffset()===i;i>e.getOffset();){const g=this.parseNode(e,t);g!==null&&this.parseSubNode(c,n,g)}return n.propertyList=u,typeof d=="number"&&(n.id=d),m!==""&&(n.attrName=m),f!==""&&(n.attrType=f),c!==""&&(n.name=c),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const i=n.propertyList[0];Array.isArray(i)?(t[n.name]=n,n.a=i):t[n.name]=i}else if(e==="Connections"&&n.name==="C"){const i=[];n.propertyList.forEach(function(o,a){a!==0&&i.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(n.name==="Properties70")Object.keys(n).forEach(function(o){t[o]=n[o]});else if(e==="Properties70"&&n.name==="P"){let i=n.propertyList[0],o=n.propertyList[1];const a=n.propertyList[2],c=n.propertyList[3];let u;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?u=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:u=n.propertyList[4],t[i]={type:o,type2:a,flag:c,value:u}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),o=e.getUint32(),a=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const c=Mf(new Uint8Array(e.getArrayBuffer(a))),u=new ic(c.buffer);switch(t){case"b":case"c":return u.getBooleanArray(i);case"d":return u.getFloat64Array(i);case"f":return u.getFloat32Array(i);case"i":return u.getInt32Array(i);case"l":return u.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class ic{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=[];for(let i=0;i<e;i++)t[i]=this.getUint8();const n=t.indexOf(0);return n>=0&&(t=t.slice(0,n)),zi(new Uint8Array(t))}}class rc{add(e,t){this[e]=t}}function Jp(r){const e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===lc(r,0,e.length)}function Qp(r){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(i){const o=r[i-1];return r=r.slice(t+i),t++,o}for(let i=0;i<e.length;++i)if(n(1)===e[i])return!1;return!0}function sc(r){const e=/FBXVersion: (\d+)/,t=r.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Hp(r){return r/46186158e3}const Ep=[];function ns(r,e,t,n){let i;switch(n.mappingType){case"ByPolygonVertex":i=r;break;case"ByPolygon":i=e;break;case"ByVertice":i=t;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(i=n.indices[i]);const o=i*n.dataSize,a=o+n.dataSize;return qp(Ep,n.buffer,o,a)}const Vo=new p.Euler,Ui=new p.Vector3;function oc(r){const e=new p.Matrix4,t=new p.Matrix4,n=new p.Matrix4,i=new p.Matrix4,o=new p.Matrix4,a=new p.Matrix4,c=new p.Matrix4,u=new p.Matrix4,d=new p.Matrix4,m=new p.Matrix4,f=new p.Matrix4,g=new p.Matrix4,v=r.inheritType?r.inheritType:0;if(r.translation&&e.setPosition(Ui.fromArray(r.translation)),r.preRotation){const V=r.preRotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),t.makeRotationFromEuler(Vo.fromArray(V))}if(r.rotation){const V=r.rotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),n.makeRotationFromEuler(Vo.fromArray(V))}if(r.postRotation){const V=r.postRotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),i.makeRotationFromEuler(Vo.fromArray(V)),i.invert()}r.scale&&o.scale(Ui.fromArray(r.scale)),r.scalingOffset&&c.setPosition(Ui.fromArray(r.scalingOffset)),r.scalingPivot&&a.setPosition(Ui.fromArray(r.scalingPivot)),r.rotationOffset&&u.setPosition(Ui.fromArray(r.rotationOffset)),r.rotationPivot&&d.setPosition(Ui.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(f.copy(r.parentMatrix),m.copy(r.parentMatrixWorld));const w=t.clone().multiply(n).multiply(i),b=new p.Matrix4;b.extractRotation(m);const x=new p.Matrix4;x.copyPosition(m);const L=x.clone().invert().multiply(m),M=b.clone().invert().multiply(L),C=o,W=new p.Matrix4;if(v===0)W.copy(b).multiply(w).multiply(M).multiply(C);else if(v===1)W.copy(b).multiply(M).multiply(w).multiply(C);else{const G=new p.Matrix4().scale(new p.Vector3().setFromMatrixScale(f)).clone().invert(),k=M.clone().multiply(G);W.copy(b).multiply(w).multiply(k).multiply(C)}const z=d.clone().invert(),D=a.clone().invert();let X=e.clone().multiply(u).multiply(d).multiply(t).multiply(n).multiply(i).multiply(z).multiply(c).multiply(a).multiply(o).multiply(D);const I=new p.Matrix4().copyPosition(X),K=m.clone().multiply(I);return g.copyPosition(K),X=g.clone().multiply(W),X.premultiply(m.invert()),X}function ac(r){r=r||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return r===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[r]}function Io(r){return r.split(",").map(function(t){return parseFloat(t)})}function lc(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=r.byteLength),zi(new Uint8Array(r,e,t))}function $p(r,e){for(let t=0,n=r.length,i=e.length;t<i;t++,n++)r[n]=e[t]}function qp(r,e,t,n){for(let i=t,o=0;i<n;i++,o++)r[o]=e[i];return r}function cc(r,e,t){return r.slice(0,e).concat(t).concat(r.slice(e))}class em extends p.DataTextureLoader{constructor(e){super(e),this.type=p.HalfFloatType}parse(e){const a=function(I,K){switch(I){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(K||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(K||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(K||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(K||""))}},m=`
|
|
207
|
+
}`})}};let e=r;return Rl(e,"BlurDirectionX",new p.Vector2(1,0)),Rl(e,"BlurDirectionY",new p.Vector2(0,1)),e})();var Yf=Object.defineProperty,Rf=(r,e,t)=>e in r?Yf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Co=(r,e,t)=>(Rf(r,typeof e!="symbol"?e+"":e,t),t);class jl extends pr{constructor(e,t){super(),Co(this,"scene"),Co(this,"camera"),Co(this,"inverse"),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,i){const n=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0);let a,c;this.inverse?(a=0,c=1):(a=1,c=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(n.REPLACE,n.REPLACE,n.REPLACE),o.buffers.stencil.setFunc(n.ALWAYS,a,4294967295),o.buffers.stencil.setClear(c),o.buffers.stencil.setLocked(!0),e.setRenderTarget(i),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(n.EQUAL,1,4294967295),o.buffers.stencil.setOp(n.KEEP,n.KEEP,n.KEEP),o.buffers.stencil.setLocked(!0)}}class jf extends pr{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}var Jf=Object.defineProperty,Qf=(r,e,t)=>e in r?Jf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Kt=(r,e,t)=>(Qf(r,typeof e!="symbol"?e+"":e,t),t);class Hf{constructor(e,t){if(Kt(this,"renderer"),Kt(this,"_pixelRatio"),Kt(this,"_width"),Kt(this,"_height"),Kt(this,"renderTarget1"),Kt(this,"renderTarget2"),Kt(this,"writeBuffer"),Kt(this,"readBuffer"),Kt(this,"renderToScreen"),Kt(this,"passes",[]),Kt(this,"copyPass"),Kt(this,"clock"),this.renderer=e,t===void 0){const i={minFilter:p.LinearFilter,magFilter:p.LinearFilter,format:p.RGBAFormat},n=e.getSize(new p.Vector2);this._pixelRatio=e.getPixelRatio(),this._width=n.width,this._height=n.height,t=new p.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,i),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,Po===void 0&&console.error("THREE.EffectComposer relies on CopyShader"),Yl===void 0&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Yl(Po),this.copyPass.material.blending=p.NoBlending,this.clock=new p.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let i=!1;const n=this.passes.length;for(let o=0;o<n;o++){const a=this.passes[o];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(o),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,i),a.needsSwap){if(i){const c=this.renderer.getContext(),h=this.renderer.state.buffers.stencil;h.setFunc(c.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),h.setFunc(c.EQUAL,1,4294967295)}this.swapBuffers()}jl!==void 0&&(a instanceof jl?i=!0:a instanceof jf&&(i=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new p.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const i=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(i,n),this.renderTarget2.setSize(i,n);for(let o=0;o<this.passes.length;o++)this.passes[o].setSize(i,n)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}var Ef=Object.defineProperty,$f=(r,e,t)=>e in r?Ef(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fn=(r,e,t)=>($f(r,typeof e!="symbol"?e+"":e,t),t);class qf extends pr{constructor(e,t,i,n,o=0){super(),fn(this,"scene"),fn(this,"camera"),fn(this,"overrideMaterial"),fn(this,"clearColor"),fn(this,"clearAlpha"),fn(this,"clearDepth",!1),fn(this,"_oldClearColor",new p.Color),this.scene=e,this.camera=t,this.overrideMaterial=i,this.clearColor=n,this.clearAlpha=o,this.clear=!0,this.needsSwap=!1}render(e,t,i){let n=e.autoClear;e.autoClear=!1;let o,a=null;this.overrideMaterial!==void 0&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),o=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:i),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,o),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=a),e.autoClear=n}}function zn(r){if(typeof TextDecoder<"u")return new TextDecoder().decode(r);let e="";for(let t=0,i=r.length;t<i;t++)e+=String.fromCharCode(r[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const pn="srgb",Si="srgb-linear",Jl=3001,ep=3e3;class tp extends p.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new op(t)}),this.register(function(t){return new ap(t)}),this.register(function(t){return new gp(t)}),this.register(function(t){return new yp(t)}),this.register(function(t){return new vp(t)}),this.register(function(t){return new cp(t)}),this.register(function(t){return new hp(t)}),this.register(function(t){return new up(t)}),this.register(function(t){return new dp(t)}),this.register(function(t){return new sp(t)}),this.register(function(t){return new fp(t)}),this.register(function(t){return new lp(t)}),this.register(function(t){return new mp(t)}),this.register(function(t){return new pp(t)}),this.register(function(t){return new np(t)}),this.register(function(t){return new _p(t)}),this.register(function(t){return new wp(t)})}load(e,t,i,n){const o=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const d=p.LoaderUtils.extractUrlBase(e);a=p.LoaderUtils.resolveURL(d,this.path)}else a=p.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const c=function(d){n?n(d):console.error(d),o.manager.itemError(e),o.manager.itemEnd(e)},h=new p.FileLoader(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(d){try{o.parse(d,a,function(m){t(m),o.manager.itemEnd(e)},c)}catch(m){c(m)}},i,c)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,n){let o;const a={},c={};if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(zn(new Uint8Array(e.slice(0,4)))===Ql){try{a[ve.KHR_BINARY_GLTF]=new bp(e)}catch(m){n&&n(m);return}o=JSON.parse(a[ve.KHR_BINARY_GLTF].content)}else o=JSON.parse(zn(new Uint8Array(e)));else o=e;if(o.asset===void 0||o.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const h=new Ap(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const m=this.pluginCallbacks[d](h);m.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[m.name]=m,a[m.name]=!0}if(o.extensionsUsed)for(let d=0;d<o.extensionsUsed.length;++d){const m=o.extensionsUsed[d],f=o.extensionsRequired||[];switch(m){case ve.KHR_MATERIALS_UNLIT:a[m]=new rp;break;case ve.KHR_DRACO_MESH_COMPRESSION:a[m]=new xp(o,this.dracoLoader);break;case ve.KHR_TEXTURE_TRANSFORM:a[m]=new Mp;break;case ve.KHR_MESH_QUANTIZATION:a[m]=new Sp;break;default:f.indexOf(m)>=0&&c[m]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}h.setExtensions(a),h.setPlugins(c),h.parse(i,n)}parseAsync(e,t){const i=this;return new Promise(function(n,o){i.parse(e,t,n,o)})}}function ip(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const ve={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class np{constructor(e){this.parser=e,this.name=ve.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,n=t.length;i<n;i++){const o=t[i];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let n=t.cache.get(i);if(n)return n;const o=t.json,h=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let d;const m=new p.Color(16777215);h.color!==void 0&&m.setRGB(h.color[0],h.color[1],h.color[2],Si);const f=h.range!==void 0?h.range:0;switch(h.type){case"directional":d=new p.DirectionalLight(m),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new p.PointLight(m),d.distance=f;break;case"spot":d=new p.SpotLight(m),d.distance=f,h.spot=h.spot||{},h.spot.innerConeAngle=h.spot.innerConeAngle!==void 0?h.spot.innerConeAngle:0,h.spot.outerConeAngle=h.spot.outerConeAngle!==void 0?h.spot.outerConeAngle:Math.PI/4,d.angle=h.spot.outerConeAngle,d.penumbra=1-h.spot.innerConeAngle/h.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+h.type)}return d.position.set(0,0,0),d.decay=2,Li(d,h),h.intensity!==void 0&&(d.intensity=h.intensity),d.name=t.createUniqueName(h.name||"light_"+e),n=Promise.resolve(d),t.cache.add(i,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,o=i.json.nodes[e],c=(o.extensions&&o.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(h){return i._getNodeRef(t.cache,c,h)})}}class rp{constructor(){this.name=ve.KHR_MATERIALS_UNLIT}getMaterialType(){return p.MeshBasicMaterial}extendParams(e,t,i){const n=[];e.color=new p.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const a=o.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Si),e.opacity=a[3]}o.baseColorTexture!==void 0&&n.push(i.assignTexture(e,"map",o.baseColorTexture,pn))}return Promise.all(n)}}class sp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=n.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class op{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],a=n.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&o.push(i.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&o.push(i.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(o.push(i.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const c=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new p.Vector2(c,c)}return Promise.all(o)}}class ap{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=n.extensions[this.name];return t.dispersion=o.dispersion!==void 0?o.dispersion:0,Promise.resolve()}}class lp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],a=n.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&o.push(i.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&o.push(i.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(o)}}class cp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new p.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=n.extensions[this.name];if(a.sheenColorFactor!==void 0){const c=a.sheenColorFactor;t.sheenColor.setRGB(c[0],c[1],c[2],Si)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&o.push(i.assignTexture(t,"sheenColorMap",a.sheenColorTexture,pn)),a.sheenRoughnessTexture!==void 0&&o.push(i.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(o)}}class hp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],a=n.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&o.push(i.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(o)}}class up{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],a=n.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&o.push(i.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const c=a.attenuationColor||[1,1,1];return t.attenuationColor=new p.Color().setRGB(c[0],c[1],c[2],Si),Promise.all(o)}}class dp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=n.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class fp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],a=n.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&o.push(i.assignTexture(t,"specularIntensityMap",a.specularTexture));const c=a.specularColorFactor||[1,1,1];return t.specularColor=new p.Color().setRGB(c[0],c[1],c[2],Si),a.specularColorTexture!==void 0&&o.push(i.assignTexture(t,"specularColorMap",a.specularColorTexture,pn)),Promise.all(o)}}class pp{constructor(e){this.parser=e,this.name=ve.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],a=n.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&o.push(i.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(o)}}class mp{constructor(e){this.parser=e,this.name=ve.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],a=n.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&o.push(i.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(o)}}class gp{constructor(e){this.parser=e,this.name=ve.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,n=i.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const o=n.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,a)}}class yp{constructor(e){this.parser=e,this.name=ve.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,n=i.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const a=o.extensions[t],c=n.images[a.source];let h=i.textureLoader;if(c.uri){const d=i.options.manager.getHandler(c.uri);d!==null&&(h=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,a.source,h);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class vp{constructor(e){this.parser=e,this.name=ve.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,n=i.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const a=o.extensions[t],c=n.images[a.source];let h=i.textureLoader;if(c.uri){const d=i.options.manager.getHandler(c.uri);d!==null&&(h=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,a.source,h);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class _p{constructor(e){this.name=ve.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],o=this.parser.getDependency("buffer",n.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(c){const h=n.byteOffset||0,d=n.byteLength||0,m=n.count,f=n.byteStride,g=new Uint8Array(c,h,d);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(m,f,g,n.mode,n.filter).then(function(v){return v.buffer}):a.ready.then(function(){const v=new ArrayBuffer(m*f);return a.decodeGltfBuffer(new Uint8Array(v),m,f,g,n.mode,n.filter),v})})}else return null}}class wp{constructor(e){this.name=ve.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=t.meshes[i.mesh];for(const d of n.primitives)if(d.mode!==Nt.TRIANGLES&&d.mode!==Nt.TRIANGLE_STRIP&&d.mode!==Nt.TRIANGLE_FAN&&d.mode!==void 0)return null;const a=i.extensions[this.name].attributes,c=[],h={};for(const d in a)c.push(this.parser.getDependency("accessor",a[d]).then(m=>(h[d]=m,h[d])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(d=>{const m=d.pop(),f=m.isGroup?m.children:[m],g=d[0].count,v=[];for(const w of f){const b=new p.Matrix4,x=new p.Vector3,L=new p.Quaternion,M=new p.Vector3(1,1,1),C=new p.InstancedMesh(w.geometry,w.material,g);for(let W=0;W<g;W++)h.TRANSLATION&&x.fromBufferAttribute(h.TRANSLATION,W),h.ROTATION&&L.fromBufferAttribute(h.ROTATION,W),h.SCALE&&M.fromBufferAttribute(h.SCALE,W),C.setMatrixAt(W,b.compose(x,L,M));for(const W in h)if(W==="_COLOR_0"){const z=h[W];C.instanceColor=new p.InstancedBufferAttribute(z.array,z.itemSize,z.normalized)}else W!=="TRANSLATION"&&W!=="ROTATION"&&W!=="SCALE"&&w.geometry.setAttribute(W,h[W]);p.Object3D.prototype.copy.call(C,w),this.parser.assignFinalMaterial(C),v.push(C)}return m.isGroup?(m.clear(),m.add(...v),m):v[0]}))}}const Ql="glTF",mr=12,Hl={JSON:1313821514,BIN:5130562};class bp{constructor(e){this.name=ve.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,mr);if(this.header={magic:zn(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ql)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-mr,n=new DataView(e,mr);let o=0;for(;o<i;){const a=n.getUint32(o,!0);o+=4;const c=n.getUint32(o,!0);if(o+=4,c===Hl.JSON){const h=new Uint8Array(e,mr+o,a);this.content=zn(h)}else if(c===Hl.BIN){const h=mr+o;this.body=e.slice(h,h+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class xp{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ve.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,n=this.dracoLoader,o=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,c={},h={},d={};for(const m in a){const f=Go[m]||m.toLowerCase();c[f]=a[m]}for(const m in e.attributes){const f=Go[m]||m.toLowerCase();if(a[m]!==void 0){const g=i.accessors[e.attributes[m]],v=Xn[g.componentType];d[f]=v.name,h[f]=g.normalized===!0}}return t.getDependency("bufferView",o).then(function(m){return new Promise(function(f,g){n.decodeDracoFile(m,function(v){for(const w in v.attributes){const b=v.attributes[w],x=h[w];x!==void 0&&(b.normalized=x)}f(v)},c,d,Si,g)})})}}class Mp{constructor(){this.name=ve.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Sp{constructor(){this.name=ve.KHR_MESH_QUANTIZATION}}class El extends p.Interpolant{constructor(e,t,i,n){super(e,t,i,n)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,o=e*n*3+n;for(let a=0;a!==n;a++)t[a]=i[o+a];return t}interpolate_(e,t,i,n){const o=this.resultBuffer,a=this.sampleValues,c=this.valueSize,h=c*2,d=c*3,m=n-t,f=(i-t)/m,g=f*f,v=g*f,w=e*d,b=w-d,x=-2*v+3*g,L=v-g,M=1-x,C=L-g+f;for(let W=0;W!==c;W++){const z=a[b+W+c],D=a[b+W+h]*m,X=a[w+W+c],I=a[w+W]*m;o[W]=M*z+C*D+x*X+L*I}return o}}const Lp=new p.Quaternion;class Pp extends El{interpolate_(e,t,i,n){const o=super.interpolate_(e,t,i,n);return Lp.fromArray(o).normalize().toArray(o),o}}const Nt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Xn={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$l={9728:p.NearestFilter,9729:p.LinearFilter,9984:p.NearestMipmapNearestFilter,9985:p.LinearMipmapNearestFilter,9986:p.NearestMipmapLinearFilter,9987:p.LinearMipmapLinearFilter},ql={33071:p.ClampToEdgeWrapping,33648:p.MirroredRepeatWrapping,10497:p.RepeatWrapping},To={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Go={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...qr>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Xi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Cp={CUBICSPLINE:void 0,LINEAR:p.InterpolateLinear,STEP:p.InterpolateDiscrete},Wo={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Tp(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new p.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:p.FrontSide})),r.DefaultMaterial}function mn(r,e,t){for(const i in t.extensions)r[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Li(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Gp(r,e,t){let i=!1,n=!1,o=!1;for(let d=0,m=e.length;d<m;d++){const f=e[d];if(f.POSITION!==void 0&&(i=!0),f.NORMAL!==void 0&&(n=!0),f.COLOR_0!==void 0&&(o=!0),i&&n&&o)break}if(!i&&!n&&!o)return Promise.resolve(r);const a=[],c=[],h=[];for(let d=0,m=e.length;d<m;d++){const f=e[d];if(i){const g=f.POSITION!==void 0?t.getDependency("accessor",f.POSITION):r.attributes.position;a.push(g)}if(n){const g=f.NORMAL!==void 0?t.getDependency("accessor",f.NORMAL):r.attributes.normal;c.push(g)}if(o){const g=f.COLOR_0!==void 0?t.getDependency("accessor",f.COLOR_0):r.attributes.color;h.push(g)}}return Promise.all([Promise.all(a),Promise.all(c),Promise.all(h)]).then(function(d){const m=d[0],f=d[1],g=d[2];return i&&(r.morphAttributes.position=m),n&&(r.morphAttributes.normal=f),o&&(r.morphAttributes.color=g),r.morphTargetsRelative=!0,r})}function Wp(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let i=0,n=t.length;i<n;i++)r.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Zp(r){let e;const t=r.extensions&&r.extensions[ve.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Zo(t.attributes):e=r.indices+":"+Zo(r.attributes)+":"+r.mode,r.targets!==void 0)for(let i=0,n=r.targets.length;i<n;i++)e+=":"+Zo(r.targets[i]);return e}function Zo(r){let e="";const t=Object.keys(r).sort();for(let i=0,n=t.length;i<n;i++)e+=t[i]+":"+r[t[i]]+";";return e}function Vo(r){switch(r){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Vp(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ip=new p.Matrix4;class Ap{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ip,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=!1,o=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,o=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||n&&o<98?this.textureLoader=new p.TextureLoader(this.options.manager):this.textureLoader=new p.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new p.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,n=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(a){const c={scene:a[0][n.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:n.asset,parser:i,userData:{}};return mn(o,c,n),Li(c,n),Promise.all(i._invokeAll(function(h){return h.afterRoot&&h.afterRoot(c)})).then(function(){for(const h of c.scenes)h.updateMatrixWorld();e(c)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let n=0,o=t.length;n<o;n++){const a=t[n].joints;for(let c=0,h=a.length;c<h;c++)e[a[c]].isBone=!0}for(let n=0,o=e.length;n<o;n++){const a=e[n];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(i[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const n=i.clone(),o=(a,c)=>{const h=this.associations.get(a);h!=null&&this.associations.set(c,h);for(const[d,m]of a.children.entries())o(m,c.children[d])};return o(i,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const n=e(t[i]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let n=0;n<t.length;n++){const o=e(t[n]);o&&i.push(o)}return i}getDependency(e,t){const i=e+":"+t;let n=this.cache.get(i);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":n=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(i,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(o,a){return i.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[ve.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(o,a){i.load(p.LoaderUtils.resolveURL(t.uri,n.path),o,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const n=t.byteLength||0,o=t.byteOffset||0;return i.slice(o,o+n)})}loadAccessor(e){const t=this,i=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const a=To[n.type],c=Xn[n.componentType],h=n.normalized===!0,d=new c(n.count*a);return Promise.resolve(new p.BufferAttribute(d,a,h))}const o=[];return n.bufferView!==void 0?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),n.sparse!==void 0&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then(function(a){const c=a[0],h=To[n.type],d=Xn[n.componentType],m=d.BYTES_PER_ELEMENT,f=m*h,g=n.byteOffset||0,v=n.bufferView!==void 0?i.bufferViews[n.bufferView].byteStride:void 0,w=n.normalized===!0;let b,x;if(v&&v!==f){const L=Math.floor(g/v),M="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+L+":"+n.count;let C=t.cache.get(M);C||(b=new d(c,L*v,n.count*v/m),C=new p.InterleavedBuffer(b,v/m),t.cache.add(M,C)),x=new p.InterleavedBufferAttribute(C,h,g%v/m,w)}else c===null?b=new d(n.count*h):b=new d(c,g,n.count*h),x=new p.BufferAttribute(b,h,w);if(n.sparse!==void 0){const L=To.SCALAR,M=Xn[n.sparse.indices.componentType],C=n.sparse.indices.byteOffset||0,W=n.sparse.values.byteOffset||0,z=new M(a[1],C,n.sparse.count*L),D=new d(a[2],W,n.sparse.count*h);c!==null&&(x=new p.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let X=0,I=z.length;X<I;X++){const K=z[X];if(x.setX(K,D[X*h]),h>=2&&x.setY(K,D[X*h+1]),h>=3&&x.setZ(K,D[X*h+2]),h>=4&&x.setW(K,D[X*h+3]),h>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,i=this.options,o=t.textures[e].source,a=t.images[o];let c=this.textureLoader;if(a.uri){const h=i.manager.getHandler(a.uri);h!==null&&(c=h)}return this.loadTextureImage(e,o,c)}loadTextureImage(e,t,i){const n=this,o=this.json,a=o.textures[e],c=o.images[t],h=(c.uri||c.bufferView)+":"+a.sampler;if(this.textureCache[h])return this.textureCache[h];const d=this.loadImageSource(t,i).then(function(m){m.flipY=!1,m.name=a.name||c.name||"",m.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(m.name=c.uri);const g=(o.samplers||{})[a.sampler]||{};return m.magFilter=$l[g.magFilter]||p.LinearFilter,m.minFilter=$l[g.minFilter]||p.LinearMipmapLinearFilter,m.wrapS=ql[g.wrapS]||p.RepeatWrapping,m.wrapT=ql[g.wrapT]||p.RepeatWrapping,n.associations.set(m,{textures:e}),m}).catch(function(){return null});return this.textureCache[h]=d,d}loadImageSource(e,t){const i=this,n=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const a=n.images[e],c=self.URL||self.webkitURL;let h=a.uri||"",d=!1;if(a.bufferView!==void 0)h=i.getDependency("bufferView",a.bufferView).then(function(f){d=!0;const g=new Blob([f],{type:a.mimeType});return h=c.createObjectURL(g),h});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const m=Promise.resolve(h).then(function(f){return new Promise(function(g,v){let w=g;t.isImageBitmapLoader===!0&&(w=function(b){const x=new p.Texture(b);x.needsUpdate=!0,g(x)}),t.load(p.LoaderUtils.resolveURL(f,o.path),w,void 0,v)})}).then(function(f){return d===!0&&c.revokeObjectURL(h),Li(f,a),f.userData.mimeType=a.mimeType||Vp(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",h),f});return this.sourceCache[e]=m,m}assignTexture(e,t,i,n){const o=this;return this.getDependency("texture",i.index).then(function(a){if(!a)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(a=a.clone(),a.channel=i.texCoord),o.extensions[ve.KHR_TEXTURE_TRANSFORM]){const c=i.extensions!==void 0?i.extensions[ve.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const h=o.associations.get(a);a=o.extensions[ve.KHR_TEXTURE_TRANSFORM].extendTexture(a,c),o.associations.set(a,h)}}return n!==void 0&&(typeof n=="number"&&(n=n===Jl?pn:Si),"colorSpace"in a?a.colorSpace=n:a.encoding=n===pn?Jl:ep),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const n=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const c="PointsMaterial:"+i.uuid;let h=this.cache.get(c);h||(h=new p.PointsMaterial,p.Material.prototype.copy.call(h,i),h.color.copy(i.color),h.map=i.map,h.sizeAttenuation=!1,this.cache.add(c,h)),i=h}else if(e.isLine){const c="LineBasicMaterial:"+i.uuid;let h=this.cache.get(c);h||(h=new p.LineBasicMaterial,p.Material.prototype.copy.call(h,i),h.color.copy(i.color),h.map=i.map,this.cache.add(c,h)),i=h}if(n||o||a){let c="ClonedMaterial:"+i.uuid+":";n&&(c+="derivative-tangents:"),o&&(c+="vertex-colors:"),a&&(c+="flat-shading:");let h=this.cache.get(c);h||(h=i.clone(),o&&(h.vertexColors=!0),a&&(h.flatShading=!0),n&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(c,h),this.associations.set(h,this.associations.get(i))),i=h}e.material=i}getMaterialType(){return p.MeshStandardMaterial}loadMaterial(e){const t=this,i=this.json,n=this.extensions,o=i.materials[e];let a;const c={},h=o.extensions||{},d=[];if(h[ve.KHR_MATERIALS_UNLIT]){const f=n[ve.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),d.push(f.extendParams(c,o,t))}else{const f=o.pbrMetallicRoughness||{};if(c.color=new p.Color(1,1,1),c.opacity=1,Array.isArray(f.baseColorFactor)){const g=f.baseColorFactor;c.color.setRGB(g[0],g[1],g[2],Si),c.opacity=g[3]}f.baseColorTexture!==void 0&&d.push(t.assignTexture(c,"map",f.baseColorTexture,pn)),c.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,c.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(c,"metalnessMap",f.metallicRoughnessTexture)),d.push(t.assignTexture(c,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,c)})))}o.doubleSided===!0&&(c.side=p.DoubleSide);const m=o.alphaMode||Wo.OPAQUE;if(m===Wo.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,m===Wo.MASK&&(c.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==p.MeshBasicMaterial&&(d.push(t.assignTexture(c,"normalMap",o.normalTexture)),c.normalScale=new p.Vector2(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;c.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&a!==p.MeshBasicMaterial&&(d.push(t.assignTexture(c,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==p.MeshBasicMaterial){const f=o.emissiveFactor;c.emissive=new p.Color().setRGB(f[0],f[1],f[2],Si)}return o.emissiveTexture!==void 0&&a!==p.MeshBasicMaterial&&d.push(t.assignTexture(c,"emissiveMap",o.emissiveTexture,pn)),Promise.all(d).then(function(){const f=new a(c);return o.name&&(f.name=o.name),Li(f,o),t.associations.set(f,{materials:e}),o.extensions&&mn(n,f,o),f})}createUniqueName(e){const t=p.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,n=this.primitiveCache;function o(c){return i[ve.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,t).then(function(h){return ec(h,c,t)})}const a=[];for(let c=0,h=e.length;c<h;c++){const d=e[c],m=Zp(d),f=n[m];if(f)a.push(f.promise);else{let g;d.extensions&&d.extensions[ve.KHR_DRACO_MESH_COMPRESSION]?g=o(d):g=ec(new p.BufferGeometry,d,t),n[m]={primitive:d,promise:g},a.push(g)}}return Promise.all(a)}loadMesh(e){const t=this,i=this.json,n=this.extensions,o=i.meshes[e],a=o.primitives,c=[];for(let h=0,d=a.length;h<d;h++){const m=a[h].material===void 0?Tp(this.cache):this.getDependency("material",a[h].material);c.push(m)}return c.push(t.loadGeometries(a)),Promise.all(c).then(function(h){const d=h.slice(0,h.length-1),m=h[h.length-1],f=[];for(let v=0,w=m.length;v<w;v++){const b=m[v],x=a[v];let L;const M=d[v];if(x.mode===Nt.TRIANGLES||x.mode===Nt.TRIANGLE_STRIP||x.mode===Nt.TRIANGLE_FAN||x.mode===void 0)L=o.isSkinnedMesh===!0?new p.SkinnedMesh(b,M):new p.Mesh(b,M),L.isSkinnedMesh===!0&&L.normalizeSkinWeights(),x.mode===Nt.TRIANGLE_STRIP?L.geometry=Fl(L.geometry,p.TriangleStripDrawMode):x.mode===Nt.TRIANGLE_FAN&&(L.geometry=Fl(L.geometry,p.TriangleFanDrawMode));else if(x.mode===Nt.LINES)L=new p.LineSegments(b,M);else if(x.mode===Nt.LINE_STRIP)L=new p.Line(b,M);else if(x.mode===Nt.LINE_LOOP)L=new p.LineLoop(b,M);else if(x.mode===Nt.POINTS)L=new p.Points(b,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(L.geometry.morphAttributes).length>0&&Wp(L,o),L.name=t.createUniqueName(o.name||"mesh_"+e),Li(L,o),x.extensions&&mn(n,L,x),t.assignFinalMaterial(L),f.push(L)}for(let v=0,w=f.length;v<w;v++)t.associations.set(f[v],{meshes:e,primitives:v});if(f.length===1)return o.extensions&&mn(n,f[0],o),f[0];const g=new p.Group;o.extensions&&mn(n,g,o),t.associations.set(g,{meshes:e});for(let v=0,w=f.length;v<w;v++)g.add(f[v]);return g})}loadCamera(e){let t;const i=this.json.cameras[e],n=i[i.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new p.PerspectiveCamera(p.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):i.type==="orthographic"&&(t=new p.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Li(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let n=0,o=t.joints.length;n<o;n++)i.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(n){const o=n.pop(),a=n,c=[],h=[];for(let d=0,m=a.length;d<m;d++){const f=a[d];if(f){c.push(f);const g=new p.Matrix4;o!==null&&g.fromArray(o.array,d*16),h.push(g)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new p.Skeleton(c,h)})}loadAnimation(e){const t=this.json,i=this,n=t.animations[e],o=n.name?n.name:"animation_"+e,a=[],c=[],h=[],d=[],m=[];for(let f=0,g=n.channels.length;f<g;f++){const v=n.channels[f],w=n.samplers[v.sampler],b=v.target,x=b.node,L=n.parameters!==void 0?n.parameters[w.input]:w.input,M=n.parameters!==void 0?n.parameters[w.output]:w.output;b.node!==void 0&&(a.push(this.getDependency("node",x)),c.push(this.getDependency("accessor",L)),h.push(this.getDependency("accessor",M)),d.push(w),m.push(b))}return Promise.all([Promise.all(a),Promise.all(c),Promise.all(h),Promise.all(d),Promise.all(m)]).then(function(f){const g=f[0],v=f[1],w=f[2],b=f[3],x=f[4],L=[];for(let M=0,C=g.length;M<C;M++){const W=g[M],z=v[M],D=w[M],X=b[M],I=x[M];if(W===void 0)continue;W.updateMatrix&&W.updateMatrix();const K=i._createAnimationTracks(W,z,D,X,I);if(K)for(let V=0;V<K.length;V++)L.push(K[V])}return new p.AnimationClip(o,void 0,L)})}createNodeMesh(e){const t=this.json,i=this,n=t.nodes[e];return n.mesh===void 0?null:i.getDependency("mesh",n.mesh).then(function(o){const a=i._getNodeRef(i.meshCache,n.mesh,o);return n.weights!==void 0&&a.traverse(function(c){if(c.isMesh)for(let h=0,d=n.weights.length;h<d;h++)c.morphTargetInfluences[h]=n.weights[h]}),a})}loadNode(e){const t=this.json,i=this,n=t.nodes[e],o=i._loadNodeShallow(e),a=[],c=n.children||[];for(let d=0,m=c.length;d<m;d++)a.push(i.getDependency("node",c[d]));const h=n.skin===void 0?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([o,Promise.all(a),h]).then(function(d){const m=d[0],f=d[1],g=d[2];g!==null&&m.traverse(function(v){v.isSkinnedMesh&&v.bind(g,Ip)});for(let v=0,w=f.length;v<w;v++)m.add(f[v]);return m})}_loadNodeShallow(e){const t=this.json,i=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],a=o.name?n.createUniqueName(o.name):"",c=[],h=n._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return h&&c.push(h),o.camera!==void 0&&c.push(n.getDependency("camera",o.camera).then(function(d){return n._getNodeRef(n.cameraCache,o.camera,d)})),n._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){c.push(d)}),this.nodeCache[e]=Promise.all(c).then(function(d){let m;if(o.isBone===!0?m=new p.Bone:d.length>1?m=new p.Group:d.length===1?m=d[0]:m=new p.Object3D,m!==d[0])for(let f=0,g=d.length;f<g;f++)m.add(d[f]);if(o.name&&(m.userData.name=o.name,m.name=a),Li(m,o),o.extensions&&mn(i,m,o),o.matrix!==void 0){const f=new p.Matrix4;f.fromArray(o.matrix),m.applyMatrix4(f)}else o.translation!==void 0&&m.position.fromArray(o.translation),o.rotation!==void 0&&m.quaternion.fromArray(o.rotation),o.scale!==void 0&&m.scale.fromArray(o.scale);return n.associations.has(m)||n.associations.set(m,{}),n.associations.get(m).nodes=e,m}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],n=this,o=new p.Group;i.name&&(o.name=n.createUniqueName(i.name)),Li(o,i),i.extensions&&mn(t,o,i);const a=i.nodes||[],c=[];for(let h=0,d=a.length;h<d;h++)c.push(n.getDependency("node",a[h]));return Promise.all(c).then(function(h){for(let m=0,f=h.length;m<f;m++)o.add(h[m]);const d=m=>{const f=new Map;for(const[g,v]of n.associations)(g instanceof p.Material||g instanceof p.Texture)&&f.set(g,v);return m.traverse(g=>{const v=n.associations.get(g);v!=null&&f.set(g,v)}),f};return n.associations=d(o),o})}_createAnimationTracks(e,t,i,n,o){const a=[],c=e.name?e.name:e.uuid,h=[];Xi[o.path]===Xi.weights?e.traverse(function(g){g.morphTargetInfluences&&h.push(g.name?g.name:g.uuid)}):h.push(c);let d;switch(Xi[o.path]){case Xi.weights:d=p.NumberKeyframeTrack;break;case Xi.rotation:d=p.QuaternionKeyframeTrack;break;case Xi.position:case Xi.scale:d=p.VectorKeyframeTrack;break;default:switch(i.itemSize){case 1:d=p.NumberKeyframeTrack;break;case 2:case 3:default:d=p.VectorKeyframeTrack;break}break}const m=n.interpolation!==void 0?Cp[n.interpolation]:p.InterpolateLinear,f=this._getArrayFromAccessor(i);for(let g=0,v=h.length;g<v;g++){const w=new d(h[g]+"."+Xi[o.path],t.array,f,m);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(w),a.push(w)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=Vo(t.constructor),n=new Float32Array(t.length);for(let o=0,a=t.length;o<a;o++)n[o]=t[o]*i;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const n=this instanceof p.QuaternionKeyframeTrack?Pp:El;return new n(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Fp(r,e,t){const i=e.attributes,n=new p.Box3;if(i.POSITION!==void 0){const c=t.json.accessors[i.POSITION],h=c.min,d=c.max;if(h!==void 0&&d!==void 0){if(n.set(new p.Vector3(h[0],h[1],h[2]),new p.Vector3(d[0],d[1],d[2])),c.normalized){const m=Vo(Xn[c.componentType]);n.min.multiplyScalar(m),n.max.multiplyScalar(m)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const c=new p.Vector3,h=new p.Vector3;for(let d=0,m=o.length;d<m;d++){const f=o[d];if(f.POSITION!==void 0){const g=t.json.accessors[f.POSITION],v=g.min,w=g.max;if(v!==void 0&&w!==void 0){if(h.setX(Math.max(Math.abs(v[0]),Math.abs(w[0]))),h.setY(Math.max(Math.abs(v[1]),Math.abs(w[1]))),h.setZ(Math.max(Math.abs(v[2]),Math.abs(w[2]))),g.normalized){const b=Vo(Xn[g.componentType]);h.multiplyScalar(b)}c.max(h)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(c)}r.boundingBox=n;const a=new p.Sphere;n.getCenter(a.center),a.radius=n.min.distanceTo(n.max)/2,r.boundingSphere=a}function ec(r,e,t){const i=e.attributes,n=[];function o(a,c){return t.getDependency("accessor",a).then(function(h){r.setAttribute(c,h)})}for(const a in i){const c=Go[a]||a.toLowerCase();c in r.attributes||n.push(o(i[a],c))}if(e.indices!==void 0&&!r.index){const a=t.getDependency("accessor",e.indices).then(function(c){r.setIndex(c)});n.push(a)}return Li(r,e),Fp(r,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Gp(r,e.targets,t):r})}function tc(r,e,t){const i=t.length-r-1;if(e>=t[i])return i-1;if(e<=t[r])return r;let n=r,o=i,a=Math.floor((n+o)/2);for(;e<t[a]||e>=t[a+1];)e<t[a]?o=a:n=a,a=Math.floor((n+o)/2);return a}function Op(r,e,t,i){const n=[],o=[],a=[];n[0]=1;for(let c=1;c<=t;++c){o[c]=e-i[r+1-c],a[c]=i[r+c]-e;let h=0;for(let d=0;d<c;++d){const m=a[d+1],f=o[c-d],g=n[d]/(m+f);n[d]=h+m*g,h=f*g}n[c]=h}return n}function Dp(r,e,t,i){const n=tc(r,i,e),o=Op(n,i,r,e),a=new p.Vector4(0,0,0,0);for(let c=0;c<=r;++c){const h=t[n-r+c],d=o[c],m=h.w*d;a.x+=h.x*m,a.y+=h.y*m,a.z+=h.z*m,a.w+=h.w*d}return a}function zp(r,e,t,i,n){const o=[];for(let f=0;f<=t;++f)o[f]=0;const a=[];for(let f=0;f<=i;++f)a[f]=o.slice(0);const c=[];for(let f=0;f<=t;++f)c[f]=o.slice(0);c[0][0]=1;const h=o.slice(0),d=o.slice(0);for(let f=1;f<=t;++f){h[f]=e-n[r+1-f],d[f]=n[r+f]-e;let g=0;for(let v=0;v<f;++v){const w=d[v+1],b=h[f-v];c[f][v]=w+b;const x=c[v][f-1]/c[f][v];c[v][f]=g+w*x,g=b*x}c[f][f]=g}for(let f=0;f<=t;++f)a[0][f]=c[f][t];for(let f=0;f<=t;++f){let g=0,v=1;const w=[];for(let b=0;b<=t;++b)w[b]=o.slice(0);w[0][0]=1;for(let b=1;b<=i;++b){let x=0;const L=f-b,M=t-b;f>=b&&(w[v][0]=w[g][0]/c[M+1][L],x=w[v][0]*c[L][M]);const C=L>=-1?1:-L,W=f-1<=M?b-1:t-f;for(let D=C;D<=W;++D)w[v][D]=(w[g][D]-w[g][D-1])/c[M+1][L+D],x+=w[v][D]*c[L+D][M];f<=M&&(w[v][b]=-w[g][b-1]/c[M+1][f],x+=w[v][b]*c[f][M]),a[b][f]=x;const z=g;g=v,v=z}}let m=t;for(let f=1;f<=i;++f){for(let g=0;g<=t;++g)a[f][g]*=m;m*=t-f}return a}function Xp(r,e,t,i,n){const o=n<r?n:r,a=[],c=tc(r,i,e),h=zp(c,i,r,o,e),d=[];for(let m=0;m<t.length;++m){const f=t[m].clone(),g=f.w;f.x*=g,f.y*=g,f.z*=g,d[m]=f}for(let m=0;m<=o;++m){const f=d[c-r].clone().multiplyScalar(h[m][0]);for(let g=1;g<=r;++g)f.add(d[c-r+g].clone().multiplyScalar(h[m][g]));a[m]=f}for(let m=o+1;m<=n+1;++m)a[m]=new p.Vector4(0,0,0);return a}function Up(r,e){let t=1;for(let n=2;n<=r;++n)t*=n;let i=1;for(let n=2;n<=e;++n)i*=n;for(let n=2;n<=r-e;++n)i*=n;return t/i}function kp(r){const e=r.length,t=[],i=[];for(let o=0;o<e;++o){const a=r[o];t[o]=new p.Vector3(a.x,a.y,a.z),i[o]=a.w}const n=[];for(let o=0;o<e;++o){const a=t[o].clone();for(let c=1;c<=o;++c)a.sub(n[o-c].clone().multiplyScalar(Up(o,c)*i[c]));n[o]=a.divideScalar(i[0])}return n}function Kp(r,e,t,i,n){const o=Xp(r,e,t,i,n);return kp(o)}class ic extends p.Curve{constructor(e,t,i,n,o){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=o||this.knots.length-1;for(let a=0;a<i.length;++a){const c=i[a];this.controlPoints[a]=new p.Vector4(c.x,c.y,c.z,c.w)}}getPoint(e,t){const i=t||new p.Vector3,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),o=Dp(this.degree,this.knots,this.controlPoints,n);return o.w!=1&&o.divideScalar(o.w),i.set(o.x,o.y,o.z)}getTangent(e,t){const i=t||new p.Vector3,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),o=Kp(this.degree,this.knots,this.controlPoints,n,1);return i.copy(o[1]).normalize(),i}}let _e,ke,xt;class Np extends p.Loader{constructor(e){super(e)}load(e,t,i,n){const o=this,a=o.path===""?p.LoaderUtils.extractUrlBase(e):o.path,c=new p.FileLoader(this.manager);c.setPath(o.path),c.setResponseType("arraybuffer"),c.setRequestHeader(o.requestHeader),c.setWithCredentials(o.withCredentials),c.load(e,function(h){try{t(o.parse(h,a))}catch(d){n?n(d):console.error(d),o.manager.itemError(e)}},i,n)}parse(e,t){if(Qp(e))_e=new Jp().parse(e);else{const n=lc(e);if(!Hp(n))throw new Error("THREE.FBXLoader: Unknown format.");if(sc(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+sc(n));_e=new jp().parse(n)}const i=new p.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Bp(i,this.manager).parse(_e)}}class Bp{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){ke=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),n=this.parseDeformers(),o=new Yp().parse(n);return this.parseScene(n,o,i),xt}parseConnections(){const e=new Map;return"Connections"in _e&&_e.Connections.connections.forEach(function(i){const n=i[0],o=i[1],a=i[2];e.has(n)||e.set(n,{parents:[],children:[]});const c={ID:o,relationship:a};e.get(n).parents.push(c),e.has(o)||e.set(o,{parents:[],children:[]});const h={ID:n,relationship:a};e.get(o).children.push(h)}),e}parseImages(){const e={},t={};if("Video"in _e.Objects){const i=_e.Objects.Video;for(const n in i){const o=i[n],a=parseInt(n);if(e[a]=o.RelativeFilename||o.Filename,"Content"in o){const c=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,h=typeof o.Content=="string"&&o.Content!=="";if(c||h){const d=this.parseImage(i[n]);t[o.RelativeFilename||o.Filename]=d}}}}for(const i in e){const n=e[i];t[n]!==void 0?e[i]=t[n]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){const t=e.Content,i=e.RelativeFilename||e.Filename,n=i.slice(i.lastIndexOf(".")+1).toLowerCase();let o;switch(n){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",i),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in _e.Objects){const i=_e.Objects.Texture;for(const n in i){const o=this.parseTexture(i[n],e);t.set(parseInt(n),o)}}return t}parseTexture(e,t){const i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;const n=e.WrapModeU,o=e.WrapModeV,a=n!==void 0?n.value:0,c=o!==void 0?o.value:0;if(i.wrapS=a===0?p.RepeatWrapping:p.ClampToEdgeWrapping,i.wrapT=c===0?p.RepeatWrapping:p.ClampToEdgeWrapping,"Scaling"in e){const h=e.Scaling.value;i.repeat.x=h[0],i.repeat.y=h[1]}return i}loadTexture(e,t){let i;const n=this.textureLoader.path,o=ke.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(i=t[o[0].ID],(i.indexOf("blob:")===0||i.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let a;const c=e.FileName.slice(-3).toLowerCase();if(c==="tga"){const h=this.manager.getHandler(".tga");h===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),a=new p.Texture):(h.setPath(this.textureLoader.path),a=h.load(i))}else c==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),a=new p.Texture):a=this.textureLoader.load(i);return this.textureLoader.setPath(n),a}parseMaterials(e){const t=new Map;if("Material"in _e.Objects){const i=_e.Objects.Material;for(const n in i){const o=this.parseMaterial(i[n],e);o!==null&&t.set(parseInt(n),o)}}return t}parseMaterial(e,t){const i=e.id,n=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!ke.has(i))return null;const a=this.parseParameters(e,t,i);let c;switch(o.toLowerCase()){case"phong":c=new p.MeshPhongMaterial;break;case"lambert":c=new p.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),c=new p.MeshPhongMaterial;break}return c.setValues(a),c.name=n,c}parseParameters(e,t,i){const n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=new p.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new p.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new p.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new p.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=new p.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new p.Color().fromArray(e.SpecularColor.value));const o=this;return ke.get(i).children.forEach(function(a){const c=a.relationship;switch(c){case"Bump":n.bumpMap=o.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":n.aoMap=o.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=o.getTexture(t,a.ID),n.map!==void 0&&("colorSpace"in n.map?n.map.colorSpace="srgb":n.map.encoding=3001);break;case"DisplacementColor":n.displacementMap=o.getTexture(t,a.ID);break;case"EmissiveColor":n.emissiveMap=o.getTexture(t,a.ID),n.emissiveMap!==void 0&&("colorSpace"in n.emissiveMap?n.emissiveMap.colorSpace="srgb":n.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=o.getTexture(t,a.ID);break;case"ReflectionColor":n.envMap=o.getTexture(t,a.ID),n.envMap!==void 0&&(n.envMap.mapping=p.EquirectangularReflectionMapping,"colorSpace"in n.envMap?n.envMap.colorSpace="srgb":n.envMap.encoding=3001);break;case"SpecularColor":n.specularMap=o.getTexture(t,a.ID),n.specularMap!==void 0&&("colorSpace"in n.specularMap?n.specularMap.colorSpace="srgb":n.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=o.getTexture(t,a.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",c);break}}),n}getTexture(e,t){return"LayeredTexture"in _e.Objects&&t in _e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ke.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in _e.Objects){const i=_e.Objects.Deformer;for(const n in i){const o=i[n],a=ke.get(parseInt(n));if(o.attrType==="Skin"){const c=this.parseSkeleton(a,i);c.ID=n,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),c.geometryID=a.parents[0].ID,e[n]=c}else if(o.attrType==="BlendShape"){const c={id:n};c.rawTargets=this.parseMorphTargets(a,i),c.id=n,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=c}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const i=[];return e.children.forEach(function(n){const o=t[n.ID];if(o.attrType!=="Cluster")return;const a={ID:n.ID,indices:[],weights:[],transformLink:new p.Matrix4().fromArray(o.TransformLink.a)};"Indexes"in o&&(a.indices=o.Indexes.a,a.weights=o.Weights.a),i.push(a)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){const i=[];for(let n=0;n<e.children.length;n++){const o=e.children[n],a=t[o.ID],c={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;c.geoID=ke.get(parseInt(o.ID)).children.filter(function(h){return h.relationship===void 0})[0].ID,i.push(c)}return i}parseScene(e,t,i){xt=new p.Group;const n=this.parseModels(e.skeletons,t,i),o=_e.Objects.Model,a=this;n.forEach(function(h){const d=o[h.ID];a.setLookAtProperties(h,d),ke.get(h.ID).parents.forEach(function(f){const g=n.get(f.ID);g!==void 0&&g.add(h)}),h.parent===null&&xt.add(h)}),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),xt.traverse(function(h){if(h.userData.transformData){h.parent&&(h.userData.transformData.parentMatrix=h.parent.matrix,h.userData.transformData.parentMatrixWorld=h.parent.matrixWorld);const d=oc(h.userData.transformData);h.applyMatrix4(d),h.updateWorldMatrix()}});const c=new Rp().parse();xt.children.length===1&&xt.children[0].isGroup&&(xt.children[0].animations=c,xt=xt.children[0]),xt.animations=c}parseModels(e,t,i){const n=new Map,o=_e.Objects.Model;for(const a in o){const c=parseInt(a),h=o[a],d=ke.get(c);let m=this.buildSkeleton(d,e,c,h.attrName);if(!m){switch(h.attrType){case"Camera":m=this.createCamera(d);break;case"Light":m=this.createLight(d);break;case"Mesh":m=this.createMesh(d,t,i);break;case"NurbsCurve":m=this.createCurve(d,t);break;case"LimbNode":case"Root":m=new p.Bone;break;case"Null":default:m=new p.Group;break}m.name=h.attrName?p.PropertyBinding.sanitizeNodeName(h.attrName):"",m.ID=c}this.getTransformData(m,h),n.set(c,m)}return n}buildSkeleton(e,t,i,n){let o=null;return e.parents.forEach(function(a){for(const c in t){const h=t[c];h.rawBones.forEach(function(d,m){if(d.ID===a.ID){const f=o;o=new p.Bone,o.matrixWorld.copy(d.transformLink),o.name=n?p.PropertyBinding.sanitizeNodeName(n):"",o.ID=i,h.bones[m]=o,f!==null&&o.add(f)}})}}),o}createCamera(e){let t,i;if(e.children.forEach(function(n){const o=_e.Objects.NodeAttribute[n.ID];o!==void 0&&(i=o)}),i===void 0)t=new p.Object3D;else{let n=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(n=1);let o=1;i.NearPlane!==void 0&&(o=i.NearPlane.value/1e3);let a=1e3;i.FarPlane!==void 0&&(a=i.FarPlane.value/1e3);let c=window.innerWidth,h=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(c=i.AspectWidth.value,h=i.AspectHeight.value);const d=c/h;let m=45;i.FieldOfView!==void 0&&(m=i.FieldOfView.value);const f=i.FocalLength?i.FocalLength.value:null;switch(n){case 0:t=new p.PerspectiveCamera(m,d,o,a),f!==null&&t.setFocalLength(f);break;case 1:t=new p.OrthographicCamera(-c/2,c/2,h/2,-h/2,o,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new p.Object3D;break}}return t}createLight(e){let t,i;if(e.children.forEach(function(n){const o=_e.Objects.NodeAttribute[n.ID];o!==void 0&&(i=o)}),i===void 0)t=new p.Object3D;else{let n;i.LightType===void 0?n=0:n=i.LightType.value;let o=16777215;i.Color!==void 0&&(o=new p.Color().fromArray(i.Color.value));let a=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(a=0);let c=0;i.FarAttenuationEnd!==void 0&&(i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?c=0:c=i.FarAttenuationEnd.value);const h=1;switch(n){case 0:t=new p.PointLight(o,a,c,h);break;case 1:t=new p.DirectionalLight(o,a);break;case 2:let d=Math.PI/3;i.InnerAngle!==void 0&&(d=p.MathUtils.degToRad(i.InnerAngle.value));let m=0;i.OuterAngle!==void 0&&(m=p.MathUtils.degToRad(i.OuterAngle.value),m=Math.max(m,1)),t=new p.SpotLight(o,a,c,d,m,h);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new p.PointLight(o,a);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,i){let n,o=null,a=null;const c=[];return e.children.forEach(function(h){t.has(h.ID)&&(o=t.get(h.ID)),i.has(h.ID)&&c.push(i.get(h.ID))}),c.length>1?a=c:c.length>0?a=c[0]:(a=new p.MeshPhongMaterial({color:13421772}),c.push(a)),"color"in o.attributes&&c.forEach(function(h){h.vertexColors=!0}),o.FBX_Deformer?(n=new p.SkinnedMesh(o,a),n.normalizeSkinWeights()):n=new p.Mesh(o,a),n}createCurve(e,t){const i=e.children.reduce(function(o,a){return t.has(a.ID)&&(o=t.get(a.ID)),o},null),n=new p.LineBasicMaterial({color:3342591,linewidth:1});return new p.Line(i,n)}getTransformData(e,t){const i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=ac(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&ke.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){const o=_e.Objects.Model[n.ID];if("Lcl_Translation"in o){const a=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),xt.add(e.target)):e.lookAt(new p.Vector3().fromArray(a))}}})}bindSkeleton(e,t,i){const n=this.parsePoseNodes();for(const o in e){const a=e[o];ke.get(parseInt(a.ID)).parents.forEach(function(h){if(t.has(h.ID)){const d=h.ID;ke.get(d).parents.forEach(function(f){i.has(f.ID)&&i.get(f.ID).bind(new p.Skeleton(a.bones),n[f.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in _e.Objects){const t=_e.Objects.Pose;for(const i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){const n=t[i].PoseNode;Array.isArray(n)?n.forEach(function(o){e[o.Node]=new p.Matrix4().fromArray(o.Matrix.a)}):e[n.Node]=new p.Matrix4().fromArray(n.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in _e&&"AmbientColor"in _e.GlobalSettings){const e=_e.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],n=e[2];if(t!==0||i!==0||n!==0){const o=new p.Color(t,i,n);xt.add(new p.AmbientLight(o,1))}}}}class Yp{parse(e){const t=new Map;if("Geometry"in _e.Objects){const i=_e.Objects.Geometry;for(const n in i){const o=ke.get(parseInt(n)),a=this.parseGeometry(o,i[n],e);t.set(parseInt(n),a)}}return t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){const n=i.skeletons,o=[],a=e.parents.map(function(f){return _e.Objects.Model[f.ID]});if(a.length===0)return;const c=e.children.reduce(function(f,g){return n[g.ID]!==void 0&&(f=n[g.ID]),f},null);e.children.forEach(function(f){i.morphTargets[f.ID]!==void 0&&o.push(i.morphTargets[f.ID])});const h=a[0],d={};"RotationOrder"in h&&(d.eulerOrder=ac(h.RotationOrder.value)),"InheritType"in h&&(d.inheritType=parseInt(h.InheritType.value)),"GeometricTranslation"in h&&(d.translation=h.GeometricTranslation.value),"GeometricRotation"in h&&(d.rotation=h.GeometricRotation.value),"GeometricScaling"in h&&(d.scale=h.GeometricScaling.value);const m=oc(d);return this.genGeometry(t,c,o,m)}genGeometry(e,t,i,n){const o=new p.BufferGeometry;e.attrName&&(o.name=e.attrName);const a=this.parseGeoNode(e,t),c=this.genBuffers(a),h=new p.Float32BufferAttribute(c.vertex,3);if(h.applyMatrix4(n),o.setAttribute("position",h),c.colors.length>0&&o.setAttribute("color",new p.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new p.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new p.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),c.normal.length>0){const d=new p.Matrix3().getNormalMatrix(n),m=new p.Float32BufferAttribute(c.normal,3);m.applyNormalMatrix(d),o.setAttribute("normal",m)}if(c.uvs.forEach(function(d,m){bo==="uv2"&&m++;const f=m===0?"uv":`uv${m}`;o.setAttribute(f,new p.Float32BufferAttribute(c.uvs[m],2))}),a.material&&a.material.mappingType!=="AllSame"){let d=c.materialIndex[0],m=0;if(c.materialIndex.forEach(function(f,g){f!==d&&(o.addGroup(m,g-m,d),d=f,m=g)}),o.groups.length>0){const f=o.groups[o.groups.length-1],g=f.start+f.count;g!==c.materialIndex.length&&o.addGroup(g,c.materialIndex.length-g,d)}o.groups.length===0&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(o,e,i,n),o}parseGeoNode(e,t){const i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let n=0;for(;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(n,o){n.indices.forEach(function(a,c){i.weightTable[a]===void 0&&(i.weightTable[a]=[]),i.weightTable[a].push({id:o,weight:n.weights[c]})})})),i}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let i=0,n=0,o=!1,a=[],c=[],h=[],d=[],m=[],f=[];const g=this;return e.vertexIndices.forEach(function(v,w){let b,x=!1;v<0&&(v=v^-1,x=!0);let L=[],M=[];if(a.push(v*3,v*3+1,v*3+2),e.color){const C=is(w,i,v,e.color);h.push(C[0],C[1],C[2])}if(e.skeleton){if(e.weightTable[v]!==void 0&&e.weightTable[v].forEach(function(C){M.push(C.weight),L.push(C.id)}),M.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const C=[0,0,0,0],W=[0,0,0,0];M.forEach(function(z,D){let X=z,I=L[D];W.forEach(function(K,V,G){if(X>K){G[V]=X,X=K;const k=C[V];C[V]=I,I=k}})}),L=C,M=W}for(;M.length<4;)M.push(0),L.push(0);for(let C=0;C<4;++C)m.push(M[C]),f.push(L[C])}if(e.normal){const C=is(w,i,v,e.normal);c.push(C[0],C[1],C[2])}e.material&&e.material.mappingType!=="AllSame"&&(b=is(w,i,v,e.material)[0]),e.uv&&e.uv.forEach(function(C,W){const z=is(w,i,v,C);d[W]===void 0&&(d[W]=[]),d[W].push(z[0]),d[W].push(z[1])}),n++,x&&(g.genFace(t,e,a,b,c,h,d,m,f,n),i++,n=0,a=[],c=[],h=[],d=[],m=[],f=[])}),t}genFace(e,t,i,n,o,a,c,h,d,m){for(let f=2;f<m;f++)e.vertex.push(t.vertexPositions[i[0]]),e.vertex.push(t.vertexPositions[i[1]]),e.vertex.push(t.vertexPositions[i[2]]),e.vertex.push(t.vertexPositions[i[(f-1)*3]]),e.vertex.push(t.vertexPositions[i[(f-1)*3+1]]),e.vertex.push(t.vertexPositions[i[(f-1)*3+2]]),e.vertex.push(t.vertexPositions[i[f*3]]),e.vertex.push(t.vertexPositions[i[f*3+1]]),e.vertex.push(t.vertexPositions[i[f*3+2]]),t.skeleton&&(e.vertexWeights.push(h[0]),e.vertexWeights.push(h[1]),e.vertexWeights.push(h[2]),e.vertexWeights.push(h[3]),e.vertexWeights.push(h[(f-1)*4]),e.vertexWeights.push(h[(f-1)*4+1]),e.vertexWeights.push(h[(f-1)*4+2]),e.vertexWeights.push(h[(f-1)*4+3]),e.vertexWeights.push(h[f*4]),e.vertexWeights.push(h[f*4+1]),e.vertexWeights.push(h[f*4+2]),e.vertexWeights.push(h[f*4+3]),e.weightsIndices.push(d[0]),e.weightsIndices.push(d[1]),e.weightsIndices.push(d[2]),e.weightsIndices.push(d[3]),e.weightsIndices.push(d[(f-1)*4]),e.weightsIndices.push(d[(f-1)*4+1]),e.weightsIndices.push(d[(f-1)*4+2]),e.weightsIndices.push(d[(f-1)*4+3]),e.weightsIndices.push(d[f*4]),e.weightsIndices.push(d[f*4+1]),e.weightsIndices.push(d[f*4+2]),e.weightsIndices.push(d[f*4+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[(f-1)*3]),e.colors.push(a[(f-1)*3+1]),e.colors.push(a[(f-1)*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(o[0]),e.normal.push(o[1]),e.normal.push(o[2]),e.normal.push(o[(f-1)*3]),e.normal.push(o[(f-1)*3+1]),e.normal.push(o[(f-1)*3+2]),e.normal.push(o[f*3]),e.normal.push(o[f*3+1]),e.normal.push(o[f*3+2])),t.uv&&t.uv.forEach(function(g,v){e.uvs[v]===void 0&&(e.uvs[v]=[]),e.uvs[v].push(c[v][0]),e.uvs[v].push(c[v][1]),e.uvs[v].push(c[v][(f-1)*2]),e.uvs[v].push(c[v][(f-1)*2+1]),e.uvs[v].push(c[v][f*2]),e.uvs[v].push(c[v][f*2+1])})}addMorphTargets(e,t,i,n){if(i.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const o=this;i.forEach(function(a){a.rawTargets.forEach(function(c){const h=_e.Objects.Geometry[c.geoID];h!==void 0&&o.genMorphGeometry(e,t,h,n,c.name)})})}genMorphGeometry(e,t,i,n,o){const a=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],c=i.Vertices!==void 0?i.Vertices.a:[],h=i.Indexes!==void 0?i.Indexes.a:[],d=e.attributes.position.count*3,m=new Float32Array(d);for(let w=0;w<h.length;w++){const b=h[w]*3;m[b]=c[w*3],m[b+1]=c[w*3+1],m[b+2]=c[w*3+2]}const f={vertexIndices:a,vertexPositions:m},g=this.genBuffers(f),v=new p.Float32BufferAttribute(g.vertex,3);v.name=o||i.attrName,v.applyMatrix4(n),e.morphAttributes.position.push(v)}parseNormals(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Normals.a;let o=[];return i==="IndexToDirect"&&("NormalIndex"in e?o=e.NormalIndex.a:"NormalsIndex"in e&&(o=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:o,mappingType:t,referenceType:i}}parseUVs(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.UV.a;let o=[];return i==="IndexToDirect"&&(o=e.UVIndex.a),{dataSize:2,buffer:n,indices:o,mappingType:t,referenceType:i}}parseVertexColors(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Colors.a;let o=[];return i==="IndexToDirect"&&(o=e.ColorIndex.a),{dataSize:4,buffer:n,indices:o,mappingType:t,referenceType:i}}parseMaterialIndices(e){const t=e.MappingInformationType,i=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};const n=e.Materials.a,o=[];for(let a=0;a<n.length;++a)o.push(a);return{dataSize:1,buffer:n,indices:o,mappingType:t,referenceType:i}}parseNurbsGeometry(e){if(ic===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new p.BufferGeometry;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new p.BufferGeometry;const i=t-1,n=e.KnotVector.a,o=[],a=e.Points.a;for(let f=0,g=a.length;f<g;f+=4)o.push(new p.Vector4().fromArray(a,f));let c,h;if(e.Form==="Closed")o.push(o[0]);else if(e.Form==="Periodic"){c=i,h=n.length-1-c;for(let f=0;f<i;++f)o.push(o[f])}const m=new ic(i,n,o,c,h).getPoints(o.length*12);return new p.BufferGeometry().setFromPoints(m)}}class Rp{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const i in t){const n=t[i],o=this.addClip(n);e.push(o)}return e}parseClips(){if(_e.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=_e.Objects.AnimationCurveNode,t=new Map;for(const i in e){const n=e[i];if(n.attrName.match(/S|R|T|DeformPercent/)!==null){const o={id:n.id,attr:n.attrName,curves:{}};t.set(o.id,o)}}return t}parseAnimationCurves(e){const t=_e.Objects.AnimationCurve;for(const i in t){const n={id:t[i].id,times:t[i].KeyTime.a.map(Ep),values:t[i].KeyValueFloat.a},o=ke.get(n.id);if(o!==void 0){const a=o.parents[0].ID,c=o.parents[0].relationship;c.match(/X/)?e.get(a).curves.x=n:c.match(/Y/)?e.get(a).curves.y=n:c.match(/Z/)?e.get(a).curves.z=n:c.match(/d|DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=n)}}}parseAnimationLayers(e){const t=_e.Objects.AnimationLayer,i=new Map;for(const n in t){const o=[],a=ke.get(parseInt(n));a!==void 0&&(a.children.forEach(function(h,d){if(e.has(h.ID)){const m=e.get(h.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(o[d]===void 0){const f=ke.get(h.ID).parents.filter(function(g){return g.relationship!==void 0})[0].ID;if(f!==void 0){const g=_e.Objects.Model[f.toString()];if(g===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",h);return}const v={modelName:g.attrName?p.PropertyBinding.sanitizeNodeName(g.attrName):"",ID:g.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};xt.traverse(function(w){w.ID===g.id&&(v.transform=w.matrix,w.userData.transformData&&(v.eulerOrder=w.userData.transformData.eulerOrder))}),v.transform||(v.transform=new p.Matrix4),"PreRotation"in g&&(v.preRotation=g.PreRotation.value),"PostRotation"in g&&(v.postRotation=g.PostRotation.value),o[d]=v}}o[d]&&(o[d][m.attr]=m)}else if(m.curves.morph!==void 0){if(o[d]===void 0){const f=ke.get(h.ID).parents.filter(function(L){return L.relationship!==void 0})[0].ID,g=ke.get(f).parents[0].ID,v=ke.get(g).parents[0].ID,w=ke.get(v).parents[0].ID,b=_e.Objects.Model[w],x={modelName:b.attrName?p.PropertyBinding.sanitizeNodeName(b.attrName):"",morphName:_e.Objects.Deformer[f].attrName};o[d]=x}o[d][m.attr]=m}}}),i.set(parseInt(n),o))}return i}parseAnimStacks(e){const t=_e.Objects.AnimationStack,i={};for(const n in t){const o=ke.get(parseInt(n)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(o[0].ID);i[n]={name:t[n].attrName,layer:a}}return i}addClip(e){let t=[];const i=this;return e.layer.forEach(function(n){t=t.concat(i.generateTracks(n))}),new p.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let i=new p.Vector3,n=new p.Quaternion,o=new p.Vector3;if(e.transform&&e.transform.decompose(i,n,o),i=i.toArray(),n=new p.Euler().setFromQuaternion(n,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");a!==void 0&&t.push(a)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const a=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder);a!==void 0&&t.push(a)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");a!==void 0&&t.push(a)}if(e.DeformPercent!==void 0){const a=this.generateMorphTrack(e);a!==void 0&&t.push(a)}return t}generateVectorTrack(e,t,i,n){const o=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(o,t,i);return new p.VectorKeyframeTrack(e+"."+n,o,a)}generateRotationTrack(e,t,i,n,o,a){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(p.MathUtils.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(p.MathUtils.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(p.MathUtils.degToRad));const c=this.getTimesForAllAxes(t),h=this.getKeyframeTrackValues(c,t,i);n!==void 0&&(n=n.map(p.MathUtils.degToRad),n.push(a),n=new p.Euler().fromArray(n),n=new p.Quaternion().setFromEuler(n)),o!==void 0&&(o=o.map(p.MathUtils.degToRad),o.push(a),o=new p.Euler().fromArray(o),o=new p.Quaternion().setFromEuler(o).invert());const d=new p.Quaternion,m=new p.Euler,f=[];for(let g=0;g<h.length;g+=3)m.set(h[g],h[g+1],h[g+2],a),d.setFromEuler(m),n!==void 0&&d.premultiply(n),o!==void 0&&d.multiply(o),d.toArray(f,g/3*4);return new p.QuaternionKeyframeTrack(e+".quaternion",c,f)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,i=t.values.map(function(o){return o/100}),n=xt.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new p.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,n){return i-n}),t.length>1){let i=1,n=t[0];for(let o=1;o<t.length;o++){const a=t[o];a!==n&&(t[i]=a,n=a,i++)}t=t.slice(0,i)}return t}getKeyframeTrackValues(e,t,i){const n=i,o=[];let a=-1,c=-1,h=-1;return e.forEach(function(d){if(t.x&&(a=t.x.times.indexOf(d)),t.y&&(c=t.y.times.indexOf(d)),t.z&&(h=t.z.times.indexOf(d)),a!==-1){const m=t.x.values[a];o.push(m),n[0]=m}else o.push(n[0]);if(c!==-1){const m=t.y.values[c];o.push(m),n[1]=m}else o.push(n[1]);if(h!==-1){const m=t.z.values[h];o.push(m),n[2]=m}else o.push(n[2])}),o}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const i=e.values[t-1],n=e.values[t]-i,o=Math.abs(n);if(o>=180){const a=o/180,c=n/a;let h=i+c;const d=e.times[t-1],f=(e.times[t]-d)/a;let g=d+f;const v=[],w=[];for(;g<e.times[t];)v.push(g),g+=f,w.push(h),h+=c;e.times=cc(e.times,t,v),e.values=cc(e.values,t,w)}}}}class jp{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new rc,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,i=e.split(/[\r\n]+/);return i.forEach(function(n,o){const a=n.match(/^[\s\t]*;/),c=n.match(/^[\s\t]*$/);if(a||c)return;const h=n.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),d=n.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),m=n.match("^\\t{"+(t.currentIndent-1)+"}}");h?t.parseNodeBegin(n,h):d?t.parseNodeProperty(n,d,i[++o]):m?t.popStack():n.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(n)}),this.allNodes}parseNodeBegin(e,t){const i=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(h){return h.trim().replace(/^"/,"").replace(/"$/,"")}),o={name:i},a=this.parseNodeAttr(n),c=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,o):i in c?(i==="PoseNode"?c.PoseNode.push(o):c[i].id!==void 0&&(c[i]={},c[i][c[i].id]=c[i]),a.id!==""&&(c[i][a.id]=o)):typeof a.id=="number"?(c[i]={},c[i][a.id]=o):i!=="Properties70"&&(i==="PoseNode"?c[i]=[o]:c[i]=o),typeof a.id=="number"&&(o.id=a.id),a.name!==""&&(o.attrName=a.name),a.type!==""&&(o.attrType=a.type),this.pushStack(o)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",n="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:i,type:n}}parseNodeProperty(e,t,i){let n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();n==="Content"&&o===","&&(o=i.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,n,o);return}if(n==="C"){const h=o.split(",").slice(1),d=parseInt(h[0]),m=parseInt(h[1]);let f=o.split(",").slice(3);f=f.map(function(g){return g.trim().replace(/^"/,"")}),n="connections",o=[d,m],qp(o,f),a[n]===void 0&&(a[n]=[])}n==="Node"&&(a.id=o),n in a&&Array.isArray(a[n])?a[n].push(o):n!=="a"?a[n]=o:a.a=o,this.setCurrentProp(a,n),n==="a"&&o.slice(-1)!==","&&(a.a=Ao(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Ao(t.a))}parseNodeSpecialProperty(e,t,i){const n=i.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=n[0],a=n[1],c=n[2],h=n[3];let d=n[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":d=parseFloat(d);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":d=Ao(d);break}this.getPrevNode()[o]={type:a,type2:c,flag:h,value:d},this.setCurrentProp(this.getPrevNode(),o)}}class Jp{parse(e){const t=new nc(e);t.skip(23);const i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);const n=new rc;for(;!this.endOfContent(t);){const o=this.parseNode(t,i);o!==null&&n.add(o.name,o)}return n}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const i={},n=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),c=e.getString(a);if(n===0)return null;const h=[];for(let g=0;g<o;g++)h.push(this.parseProperty(e));const d=h.length>0?h[0]:"",m=h.length>1?h[1]:"",f=h.length>2?h[2]:"";for(i.singleProperty=o===1&&e.getOffset()===n;n>e.getOffset();){const g=this.parseNode(e,t);g!==null&&this.parseSubNode(c,i,g)}return i.propertyList=h,typeof d=="number"&&(i.id=d),m!==""&&(i.attrName=m),f!==""&&(i.attrType=f),c!==""&&(i.name=c),i}parseSubNode(e,t,i){if(i.singleProperty===!0){const n=i.propertyList[0];Array.isArray(n)?(t[i.name]=i,i.a=n):t[i.name]=n}else if(e==="Connections"&&i.name==="C"){const n=[];i.propertyList.forEach(function(o,a){a!==0&&n.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(n)}else if(i.name==="Properties70")Object.keys(i).forEach(function(o){t[o]=i[o]});else if(e==="Properties70"&&i.name==="P"){let n=i.propertyList[0],o=i.propertyList[1];const a=i.propertyList[2],c=i.propertyList[3];let h;n.indexOf("Lcl ")===0&&(n=n.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?h=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:h=i.propertyList[4],t[n]={type:o,type2:a,flag:c,value:h}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){const t=e.getString(1);let i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const n=e.getUint32(),o=e.getUint32(),a=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}const c=Sf(new Uint8Array(e.getArrayBuffer(a))),h=new nc(c.buffer);switch(t){case"b":case"c":return h.getBooleanArray(n);case"d":return h.getFloat64Array(n);case"f":return h.getFloat32Array(n);case"i":return h.getInt32Array(n);case"l":return h.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class nc{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let i=0;i<e;i++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=[];for(let n=0;n<e;n++)t[n]=this.getUint8();const i=t.indexOf(0);return i>=0&&(t=t.slice(0,i)),zn(new Uint8Array(t))}}class rc{add(e,t){this[e]=t}}function Qp(r){const e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===lc(r,0,e.length)}function Hp(r){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function i(n){const o=r[n-1];return r=r.slice(t+n),t++,o}for(let n=0;n<e.length;++n)if(i(1)===e[n])return!1;return!0}function sc(r){const e=/FBXVersion: (\d+)/,t=r.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ep(r){return r/46186158e3}const $p=[];function is(r,e,t,i){let n;switch(i.mappingType){case"ByPolygonVertex":n=r;break;case"ByPolygon":n=e;break;case"ByVertice":n=t;break;case"AllSame":n=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}i.referenceType==="IndexToDirect"&&(n=i.indices[n]);const o=n*i.dataSize,a=o+i.dataSize;return em($p,i.buffer,o,a)}const Io=new p.Euler,Un=new p.Vector3;function oc(r){const e=new p.Matrix4,t=new p.Matrix4,i=new p.Matrix4,n=new p.Matrix4,o=new p.Matrix4,a=new p.Matrix4,c=new p.Matrix4,h=new p.Matrix4,d=new p.Matrix4,m=new p.Matrix4,f=new p.Matrix4,g=new p.Matrix4,v=r.inheritType?r.inheritType:0;if(r.translation&&e.setPosition(Un.fromArray(r.translation)),r.preRotation){const V=r.preRotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),t.makeRotationFromEuler(Io.fromArray(V))}if(r.rotation){const V=r.rotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),i.makeRotationFromEuler(Io.fromArray(V))}if(r.postRotation){const V=r.postRotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),n.makeRotationFromEuler(Io.fromArray(V)),n.invert()}r.scale&&o.scale(Un.fromArray(r.scale)),r.scalingOffset&&c.setPosition(Un.fromArray(r.scalingOffset)),r.scalingPivot&&a.setPosition(Un.fromArray(r.scalingPivot)),r.rotationOffset&&h.setPosition(Un.fromArray(r.rotationOffset)),r.rotationPivot&&d.setPosition(Un.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(f.copy(r.parentMatrix),m.copy(r.parentMatrixWorld));const w=t.clone().multiply(i).multiply(n),b=new p.Matrix4;b.extractRotation(m);const x=new p.Matrix4;x.copyPosition(m);const L=x.clone().invert().multiply(m),M=b.clone().invert().multiply(L),C=o,W=new p.Matrix4;if(v===0)W.copy(b).multiply(w).multiply(M).multiply(C);else if(v===1)W.copy(b).multiply(M).multiply(w).multiply(C);else{const G=new p.Matrix4().scale(new p.Vector3().setFromMatrixScale(f)).clone().invert(),k=M.clone().multiply(G);W.copy(b).multiply(w).multiply(k).multiply(C)}const z=d.clone().invert(),D=a.clone().invert();let X=e.clone().multiply(h).multiply(d).multiply(t).multiply(i).multiply(n).multiply(z).multiply(c).multiply(a).multiply(o).multiply(D);const I=new p.Matrix4().copyPosition(X),K=m.clone().multiply(I);return g.copyPosition(K),X=g.clone().multiply(W),X.premultiply(m.invert()),X}function ac(r){r=r||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return r===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[r]}function Ao(r){return r.split(",").map(function(t){return parseFloat(t)})}function lc(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=r.byteLength),zn(new Uint8Array(r,e,t))}function qp(r,e){for(let t=0,i=r.length,n=e.length;t<n;t++,i++)r[i]=e[t]}function em(r,e,t,i){for(let n=t,o=0;n<i;n++,o++)r[o]=e[n];return r}function cc(r,e,t){return r.slice(0,e).concat(t).concat(r.slice(e))}class tm extends p.DataTextureLoader{constructor(e){super(e),this.type=p.HalfFloatType}parse(e){const a=function(I,K){switch(I){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(K||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(K||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(K||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(K||""))}},m=`
|
|
208
208
|
`,f=function(I,K,V){K=K||1024;let k=I.pos,j=-1,Y=0,H="",Q=String.fromCharCode.apply(null,new Uint16Array(I.subarray(k,k+128)));for(;0>(j=Q.indexOf(m))&&Y<K&&k<I.byteLength;)H+=Q,Y+=Q.length,k+=128,Q+=String.fromCharCode.apply(null,new Uint16Array(I.subarray(k,k+128)));return-1<j?(I.pos+=Y+j+1,H+Q.slice(0,j)):!1},g=function(I){const K=/^#\?(\S+)/,V=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,G=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,k=/^\s*FORMAT=(\S+)\s*$/,j=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,Y={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let H,Q;for((I.pos>=I.byteLength||!(H=f(I)))&&a(1,"no header found"),(Q=H.match(K))||a(3,"bad initial token"),Y.valid|=1,Y.programtype=Q[1],Y.string+=H+`
|
|
209
209
|
`;H=f(I),H!==!1;){if(Y.string+=H+`
|
|
210
210
|
`,H.charAt(0)==="#"){Y.comments+=H+`
|
|
211
|
-
`;continue}if((Q=H.match(V))&&(Y.gamma=parseFloat(Q[1])),(Q=H.match(G))&&(Y.exposure=parseFloat(Q[1])),(Q=H.match(k))&&(Y.valid|=2,Y.format=Q[1]),(Q=H.match(j))&&(Y.valid|=4,Y.height=parseInt(Q[1],10),Y.width=parseInt(Q[2],10)),Y.valid&2&&Y.valid&4)break}return Y.valid&2||a(3,"missing format specifier"),Y.valid&4||a(3,"missing image size specifier"),Y},v=function(I,K,V){const G=K;if(G<8||G>32767||I[0]!==2||I[1]!==2||I[2]&128)return new Uint8Array(I);G!==(I[2]<<8|I[3])&&a(3,"wrong scanline width");const k=new Uint8Array(4*K*V);k.length||a(4,"unable to allocate buffer space");let j=0,Y=0;const H=4*G,Q=new Uint8Array(4),re=new Uint8Array(H);let
|
|
212
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const
|
|
211
|
+
`;continue}if((Q=H.match(V))&&(Y.gamma=parseFloat(Q[1])),(Q=H.match(G))&&(Y.exposure=parseFloat(Q[1])),(Q=H.match(k))&&(Y.valid|=2,Y.format=Q[1]),(Q=H.match(j))&&(Y.valid|=4,Y.height=parseInt(Q[1],10),Y.width=parseInt(Q[2],10)),Y.valid&2&&Y.valid&4)break}return Y.valid&2||a(3,"missing format specifier"),Y.valid&4||a(3,"missing image size specifier"),Y},v=function(I,K,V){const G=K;if(G<8||G>32767||I[0]!==2||I[1]!==2||I[2]&128)return new Uint8Array(I);G!==(I[2]<<8|I[3])&&a(3,"wrong scanline width");const k=new Uint8Array(4*K*V);k.length||a(4,"unable to allocate buffer space");let j=0,Y=0;const H=4*G,Q=new Uint8Array(4),re=new Uint8Array(H);let ne=V;for(;ne>0&&Y<I.byteLength;){Y+4>I.byteLength&&a(1),Q[0]=I[Y++],Q[1]=I[Y++],Q[2]=I[Y++],Q[3]=I[Y++],(Q[0]!=2||Q[1]!=2||(Q[2]<<8|Q[3])!=G)&&a(3,"bad rgbe scanline format");let le=0,de;for(;le<H&&Y<I.byteLength;){de=I[Y++];const fe=de>128;if(fe&&(de-=128),(de===0||le+de>H)&&a(3,"bad scanline data"),fe){const Se=I[Y++];for(let rt=0;rt<de;rt++)re[le++]=Se}else re.set(I.subarray(Y,Y+de),le),le+=de,Y+=de}const ge=G;for(let fe=0;fe<ge;fe++){let Se=0;k[j]=re[fe+Se],Se+=G,k[j+1]=re[fe+Se],Se+=G,k[j+2]=re[fe+Se],Se+=G,k[j+3]=re[fe+Se],j+=4}ne--}return k},w=function(I,K,V,G){const k=I[K+3],j=Math.pow(2,k-128)/255;V[G+0]=I[K+0]*j,V[G+1]=I[K+1]*j,V[G+2]=I[K+2]*j,V[G+3]=1},b=function(I,K,V,G){const k=I[K+3],j=Math.pow(2,k-128)/255;V[G+0]=p.DataUtils.toHalfFloat(Math.min(I[K+0]*j,65504)),V[G+1]=p.DataUtils.toHalfFloat(Math.min(I[K+1]*j,65504)),V[G+2]=p.DataUtils.toHalfFloat(Math.min(I[K+2]*j,65504)),V[G+3]=p.DataUtils.toHalfFloat(1)},x=new Uint8Array(e);x.pos=0;const L=g(x),M=L.width,C=L.height,W=v(x.subarray(x.pos),M,C);let z,D,X;switch(this.type){case p.FloatType:X=W.length/4;const I=new Float32Array(X*4);for(let V=0;V<X;V++)w(W,V*4,I,V*4);z=I,D=p.FloatType;break;case p.HalfFloatType:X=W.length/4;const K=new Uint16Array(X*4);for(let V=0;V<X;V++)b(W,V*4,K,V*4);z=K,D=p.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:M,height:C,data:z,header:L.string,gamma:L.gamma,exposure:L.exposure,type:D}}setDataType(e){return this.type=e,this}load(e,t,i,n){function o(a,c){switch(a.type){case p.FloatType:case p.HalfFloatType:"colorSpace"in a?a.colorSpace="srgb-linear":a.encoding=3e3,a.minFilter=p.LinearFilter,a.magFilter=p.LinearFilter,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,c)}return super.load(e,o,i,n)}}const Fo=new WeakMap;class im extends p.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,n){const o=new p.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,a=>{const c={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(a,c).then(t).catch(n)},i,n)}decodeDracoFile(e,t,i,n){const o={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,o).then(t)}decodeGeometry(e,t){for(const h in t.attributeTypes){const d=t.attributeTypes[h];d.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[h]=d.name)}const i=JSON.stringify(t);if(Fo.has(e)){const h=Fo.get(e);if(h.key===i)return h.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const o=this.workerNextTaskID++,a=e.byteLength,c=this._getWorker(o,a).then(h=>(n=h,new Promise((d,m)=>{n._callbacks[o]={resolve:d,reject:m},n.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(h=>this._createGeometry(h.geometry));return c.catch(()=>!0).then(()=>{n&&o&&this._releaseTask(n,o)}),Fo.set(e,{key:i,promise:c}),c}_createGeometry(e){const t=new p.BufferGeometry;e.index&&t.setIndex(new p.BufferAttribute(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const n=e.attributes[i],o=n.name,a=n.array,c=n.itemSize;t.setAttribute(o,new p.BufferAttribute(a,c))}return t}_loadLibrary(e,t){const i=new p.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((n,o)=>{i.load(e,n,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const n=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const o=nm.toString(),a=["/* draco decoder */",n,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
212
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(o){const a=o.data;switch(a.type){case"decode":n._callbacks[a.id].resolve(a);break;case"error":n._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,o){return n._taskLoad>o._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function nm(){let r,e;onmessage=function(a){const c=a.data;switch(c.type){case"init":r=c.decoderConfig,e=new Promise(function(m){r.onModuleLoaded=function(f){m({draco:f})},DracoDecoderModule(r)});break;case"decode":const h=c.buffer,d=c.taskConfig;e.then(m=>{const f=m.draco,g=new f.Decoder,v=new f.DecoderBuffer;v.Init(new Int8Array(h),h.byteLength);try{const w=t(f,g,v,d),b=w.attributes.map(x=>x.array.buffer);w.index&&b.push(w.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:w},b)}catch(w){console.error(w),self.postMessage({type:"error",id:c.id,error:w.message})}finally{f.destroy(v),f.destroy(g)}});break}};function t(a,c,h,d){const m=d.attributeIDs,f=d.attributeTypes;let g,v;const w=c.GetEncodedGeometryType(h);if(w===a.TRIANGULAR_MESH)g=new a.Mesh,v=c.DecodeBufferToMesh(h,g);else if(w===a.POINT_CLOUD)g=new a.PointCloud,v=c.DecodeBufferToPointCloud(h,g);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!v.ok()||g.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());const b={index:null,attributes:[]};for(const x in m){const L=self[f[x]];let M,C;if(d.useUniqueIDs)C=m[x],M=c.GetAttributeByUniqueId(g,C);else{if(C=c.GetAttributeId(g,a[m[x]]),C===-1)continue;M=c.GetAttribute(g,C)}b.attributes.push(n(a,c,g,x,L,M))}return w===a.TRIANGULAR_MESH&&(b.index=i(a,c,g)),a.destroy(g),b}function i(a,c,h){const m=h.num_faces()*3,f=m*4,g=a._malloc(f);c.GetTrianglesUInt32Array(h,f,g);const v=new Uint32Array(a.HEAPF32.buffer,g,m).slice();return a._free(g),{array:v,itemSize:1}}function n(a,c,h,d,m,f){const g=f.num_components(),w=h.num_points()*g,b=w*m.BYTES_PER_ELEMENT,x=o(a,m),L=a._malloc(b);c.GetAttributeDataArrayForAllPoints(h,f,x,b,L);const M=new m(a.HEAPF32.buffer,L,w).slice();return a._free(L),{name:d,array:M,itemSize:g}}function o(a,c){switch(c){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}const hc=new p.Box3,ns=new p.Vector3;class uc extends p.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new p.Float32BufferAttribute(e,3)),this.setAttribute("uv",new p.Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new p.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new p.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new p.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const n=new p.InstancedInterleavedBuffer(i,t*2,1);return this.setAttribute("instanceColorStart",new p.InterleavedBufferAttribute(n,t,0)),this.setAttribute("instanceColorEnd",new p.InterleavedBufferAttribute(n,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new p.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new p.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),hc.setFromBufferAttribute(t),this.boundingBox.union(hc))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new p.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let o=0,a=e.count;o<a;o++)ns.fromBufferAttribute(e,o),n=Math.max(n,i.distanceToSquared(ns)),ns.fromBufferAttribute(t,o),n=Math.max(n,i.distanceToSquared(ns));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class rs extends uc{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setPositions(i),this}setColors(e,t=3){const i=e.length-t,n=new Float32Array(2*i);if(t===3)for(let o=0;o<i;o+=t)n[2*o]=e[o],n[2*o+1]=e[o+1],n[2*o+2]=e[o+2],n[2*o+3]=e[o+3],n[2*o+4]=e[o+4],n[2*o+5]=e[o+5];else for(let o=0;o<i;o+=t)n[2*o]=e[o],n[2*o+1]=e[o+1],n[2*o+2]=e[o+2],n[2*o+3]=e[o+3],n[2*o+4]=e[o+4],n[2*o+5]=e[o+5],n[2*o+6]=e[o+6],n[2*o+7]=e[o+7];return super.setColors(n,t),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class gr extends p.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:p.UniformsUtils.clone(p.UniformsUtils.merge([p.UniformsLib.common,p.UniformsLib.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new p.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
|
|
213
213
|
#include <common>
|
|
214
214
|
#include <fog_pars_vertex>
|
|
215
215
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -617,13 +617,13 @@
|
|
|
617
617
|
#include <premultiplied_alpha_fragment>
|
|
618
618
|
|
|
619
619
|
}
|
|
620
|
-
`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const Fo=new p.Vector4,dc=new p.Vector3,fc=new p.Vector3,Ee=new p.Vector4,$e=new p.Vector4,dn=new p.Vector4,Oo=new p.Vector3,Do=new p.Matrix4,qe=new p.Line3,pc=new p.Vector3,ss=new p.Box3,os=new p.Sphere,fn=new p.Vector4;let pn,gi;function mc(r,e,t){return fn.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),fn.multiplyScalar(1/fn.w),fn.x=gi/t.width,fn.y=gi/t.height,fn.applyMatrix4(r.projectionMatrixInverse),fn.multiplyScalar(1/fn.w),Math.abs(Math.max(fn.x,fn.y))}function im(r,e){const t=r.matrixWorld,n=r.geometry,i=n.attributes.instanceStart,o=n.attributes.instanceEnd,a=Math.min(n.instanceCount,i.count);for(let c=0,u=a;c<u;c++){qe.start.fromBufferAttribute(i,c),qe.end.fromBufferAttribute(o,c),qe.applyMatrix4(t);const d=new p.Vector3,m=new p.Vector3;pn.distanceSqToSegment(qe.start,qe.end,m,d),m.distanceTo(d)<gi*.5&&e.push({point:m,pointOnLine:d,distance:pn.origin.distanceTo(m),object:r,face:null,faceIndex:c,uv:null,[wo]:null})}}function rm(r,e,t){const n=e.projectionMatrix,o=r.material.resolution,a=r.matrixWorld,c=r.geometry,u=c.attributes.instanceStart,d=c.attributes.instanceEnd,m=Math.min(c.instanceCount,u.count),f=-e.near;pn.at(1,dn),dn.w=1,dn.applyMatrix4(e.matrixWorldInverse),dn.applyMatrix4(n),dn.multiplyScalar(1/dn.w),dn.x*=o.x/2,dn.y*=o.y/2,dn.z=0,Oo.copy(dn),Do.multiplyMatrices(e.matrixWorldInverse,a);for(let g=0,v=m;g<v;g++){if(Ee.fromBufferAttribute(u,g),$e.fromBufferAttribute(d,g),Ee.w=1,$e.w=1,Ee.applyMatrix4(Do),$e.applyMatrix4(Do),Ee.z>f&&$e.z>f)continue;if(Ee.z>f){const C=Ee.z-$e.z,W=(Ee.z-f)/C;Ee.lerp($e,W)}else if($e.z>f){const C=$e.z-Ee.z,W=($e.z-f)/C;$e.lerp(Ee,W)}Ee.applyMatrix4(n),$e.applyMatrix4(n),Ee.multiplyScalar(1/Ee.w),$e.multiplyScalar(1/$e.w),Ee.x*=o.x/2,Ee.y*=o.y/2,$e.x*=o.x/2,$e.y*=o.y/2,qe.start.copy(Ee),qe.start.z=0,qe.end.copy($e),qe.end.z=0;const b=qe.closestPointToPointParameter(Oo,!0);qe.at(b,pc);const x=p.MathUtils.lerp(Ee.z,$e.z,b),L=x>=-1&&x<=1,M=Oo.distanceTo(pc)<gi*.5;if(L&&M){qe.start.fromBufferAttribute(u,g),qe.end.fromBufferAttribute(d,g),qe.start.applyMatrix4(a),qe.end.applyMatrix4(a);const C=new p.Vector3,W=new p.Vector3;pn.distanceSqToSegment(qe.start,qe.end,W,C),t.push({point:W,pointOnLine:C,distance:pn.origin.distanceTo(W),object:r,face:null,faceIndex:g,uv:null,[wo]:null})}}}class sm extends p.Mesh{constructor(e=new hc,t=new gr({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let a=0,c=0,u=t.count;a<u;a++,c+=2)dc.fromBufferAttribute(t,a),fc.fromBufferAttribute(n,a),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+dc.distanceTo(fc);const o=new p.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(o,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;pn=e.ray;const a=this.matrixWorld,c=this.geometry,u=this.material;gi=u.linewidth+o,c.boundingSphere===null&&c.computeBoundingSphere(),os.copy(c.boundingSphere).applyMatrix4(a);let d;if(n)d=gi*.5;else{const f=Math.max(i.near,os.distanceToPoint(pn.origin));d=mc(i,f,u.resolution)}if(os.radius+=d,pn.intersectsSphere(os)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),ss.copy(c.boundingBox).applyMatrix4(a);let m;if(n)m=gi*.5;else{const f=Math.max(i.near,ss.distanceToPoint(pn.origin));m=mc(i,f,u.resolution)}ss.expandByScalar(m),pn.intersectsBox(ss)!==!1&&(n?im(this,t):rm(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Fo),this.material.uniforms.resolution.value.set(Fo.z,Fo.w))}}class yr extends sm{constructor(e=new rs,t=new gr({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}var Un=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return this.None(r)},Out:function(r){return this.None(r)},InOut:function(r){return this.None(r)}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var e=1.70158;return r===1?1:r*r*((e+1)*r-e)},Out:function(r){var e=1.70158;return r===0?0:--r*r*((e+1)*r+e)+1},InOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)}}),Bounce:Object.freeze({In:function(r){return 1-Un.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?Un.Bounce.In(r*2)*.5:Un.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(e){return Math.pow(e,r)},Out:function(e){return 1-Math.pow(1-e,r)},InOut:function(e){return e<.5?Math.pow(e*2,r)/2:(1-Math.pow(2-e*2,r))/2+.5}}}}),vr=function(){return performance.now()},om=function(){function r(){this._tweens={},this._tweensAddedDuringUpdate={}}return r.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},r.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},r.prototype.update=function(e,t){e===void 0&&(e=vr()),t===void 0&&(t=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var o=this._tweens[n[i]],a=!t;o&&o.update(e,a)===!1&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),zo={Linear:function(r,e){var t=r.length-1,n=t*e,i=Math.floor(n),o=zo.Utils.Linear;return e<0?o(r[0],r[1],n):e>1?o(r[t],r[t-1],t-n):o(r[i],r[i+1>t?t:i+1],n-i)},Utils:{Linear:function(r,e,t){return(e-r)*t+r}}},gc=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),Xo=new om,as=function(){function r(e,t){t===void 0&&(t=Xo),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Un.Linear.None,this._interpolationFunction=zo.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=gc.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.getDuration=function(){return this._duration},r.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},r.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},r.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},r.prototype.start=function(e,t){if(e===void 0&&(e=vr()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},r.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},r.prototype._setupProperties=function(e,t,n,i,o){for(var a in n){var c=e[a],u=Array.isArray(c),d=u?"array":typeof c,m=!u&&Array.isArray(n[a]);if(!(d==="undefined"||d==="function")){if(m){var f=n[a];if(f.length===0)continue;for(var g=[c],v=0,w=f.length;v<w;v+=1){var b=this._handleRelativeValue(c,f[v]);if(isNaN(b)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(b)}m&&(n[a]=g)}if((d==="object"||u)&&c&&!m){t[a]=u?[]:{};var x=c;for(var L in x)t[a][L]=x[L];i[a]=u?[]:{};var f=n[a];if(!this._isDynamic){var M={};for(var L in f)M[L]=f[L];n[a]=f=M}this._setupProperties(x,t[a],f,i[a],o)}else(typeof t[a]>"u"||o)&&(t[a]=c),u||(t[a]*=1),m?i[a]=n[a].slice().reverse():i[a]=t[a]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},r.prototype.pause=function(e){return e===void 0&&(e=vr()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},r.prototype.resume=function(e){return e===void 0&&(e=vr()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},r.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},r.prototype.group=function(e){return e===void 0&&(e=Xo),this._group=e,this},r.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},r.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},r.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},r.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},r.prototype.easing=function(e){return e===void 0&&(e=Un.Linear.None),this._easingFunction=e,this},r.prototype.interpolation=function(e){return e===void 0&&(e=zo.Linear),this._interpolationFunction=e,this},r.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},r.prototype.onStart=function(e){return this._onStartCallback=e,this},r.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},r.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},r.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},r.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},r.prototype.onStop=function(e){return this._onStopCallback=e,this},r.prototype.update=function(e,t){var n=this,i;if(e===void 0&&(e=vr()),t===void 0&&(t=!0),this._isPaused)return!0;var o,a=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>a)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var c=e-this._startTime,u=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),d=this._duration+this._repeat*u,m=function(){if(n._duration===0||c>d)return 1;var x=Math.trunc(c/u),L=c-x*u,M=Math.min(L/n._duration,1);return M===0&&c===n._duration?1:M},f=m(),g=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,g),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||c>=this._duration)if(this._repeat>0){var v=Math.min(Math.trunc((c-this._duration)/u)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=u*v,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var w=0,b=this._chainedTweens.length;w<b;w++)this._chainedTweens[w].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(e,t,n,i){for(var o in n)if(t[o]!==void 0){var a=t[o]||0,c=n[o],u=Array.isArray(e[o]),d=Array.isArray(c),m=!u&&d;m?e[o]=this._interpolationFunction(c,i):typeof c=="object"&&c?this._updateProperties(e[o],a,c,i):(c=this._handleRelativeValue(a,c),typeof c=="number"&&(e[o]=a+(c-a)*i))}},r.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},r.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},r}();gc.nextId;var mn=Xo;mn.getAll.bind(mn),mn.removeAll.bind(mn),mn.add.bind(mn),mn.remove.bind(mn);var am=mn.update.bind(mn);function Uo(r,e,t){if(r==null||r==="")throw new Error(t||`Parameter "${e}" is required but received: ${r}`);return r}function yc(r,e,t){const n=e.split(".");let i=r;for(const o of n){if(i[o]===void 0||i[o]===null)throw new Error(`Property "${e}" is required but missing at path: "${o}"`);i=i[o]}return i}function lm(r,e,t,n=0,i=1){const o=(r-e)*(i-n)/(t-e)+n,a=Math.min(n,i),c=Math.max(n,i);return o<a?a:o>c?c:o||0}var cm=Object.defineProperty,um=(r,e,t)=>e in r?cm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vc=(r,e,t)=>um(r,typeof e!="symbol"?e+"":e,t);class ko{constructor(){vc(this,"_dispatcher",new p.EventDispatcher),vc(this,"_listenerMap",new Map)}on(e,t){const n=i=>t(i.data||i);return this._listenerMap.has(e)||this._listenerMap.set(e,new Map),this._listenerMap.get(e).set(t,n),this._dispatcher.addEventListener(e,n),this}once(e,t){const n=i=>{this.off(e,n),t(i.data||i)};return this.on(e,n)}off(e,t){const n=this._listenerMap.get(e);if(!n)return this;const i=n.get(t);return i&&(this._dispatcher.removeEventListener(e,i),n.delete(t),n.size===0&&this._listenerMap.delete(e)),this}trigger(e,t){const n={type:e,data:t};return this._dispatcher.dispatchEvent(n),this}get threeEventDispatcher(){return this._dispatcher}}function hm(r,e){return r.replace(/\{(\w+)\}/g,(t,n)=>{if(e.hasOwnProperty(n)){const i=e[n];return i!==void 0?String(i):t}throw new Error(`缺少必要参数: ${n}`)})}function Ko(r,...e){for(let t=0;t<e.length;t++){const n=e[t];for(const i in n)r[i]=n[i]}return r}function ls(r){return r==null}function _r(r){return ls(r)?!1:typeof r=="function"||r.constructor!==null&&r.constructor===Function}function _c(r=new Date){const e=r.getFullYear().toString(),t=(r.getMonth()+1).toString().padStart(2,"0"),n=r.getDate().toString().padStart(2,"0"),i=r.getHours().toString().padStart(2,"0"),o=r.getMinutes().toString().padStart(2,"0"),a=r.getSeconds().toString().padStart(2,"0");return`${e}-${t}-${n} ${i}:${o}:${a}`}var dm=Object.defineProperty,fm=(r,e,t)=>e in r?dm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,No=(r,e,t)=>fm(r,typeof e!="symbol"?e+"":e,t);class pm{}class cs extends Kn(yi(pm)){constructor(e){super(),No(this,"target"),No(this,"dom"),No(this,"_enabled",!1),this.target=e}enable(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)}disable(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this}enabled(){return!!this._enabled}remove(){this.disable(),delete this.target,delete this.dom}}const wc=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];let wr={};function bc(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!wc){const r=navigator.userAgent.toLowerCase(),e=document.documentElement||{style:{}},t="ActiveXObject"in window,n=r.indexOf("webkit")!==-1,i=r.indexOf("phantom")!==-1,o=r.search("android [23]")!==-1,a=r.indexOf("chrome")!==-1,c=r.indexOf("gecko")!==-1&&!n&&!("opera"in window)&&!t,u=/iphone/i.test(r)&&/micromessenger/i.test(r),d=typeof orientation<"u"||r.indexOf("mobile")!==-1,m=!window.PointerEvent&&"MSPointerEvent"in window,f=window.PointerEvent&&navigator.pointerEnabled||m,g=t&&"transition"in e.style,v="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!o,w="MozPerspective"in e.style,b="OTransition"in e.style,x=(g||v||w)&&!b&&!i,L=typeof window<"u"&&_r(window.createImageBitmap),M=typeof window<"u"&&_r(window.ResizeObserver),C=typeof window<"u"&&_r(window.btoa),W=typeof window<"u"&&_r(window.Proxy),z=typeof window<"u"&&_r(window.requestIdleCallback);let D=0;if(a){const k=r.match(/chrome\/([\d.]+)/);D=k?k[1]:0}const X=!i&&(f||"ontouchstart"in window||"DocumentTouch"in window&&document instanceof window.DocumentTouch),I=typeof window<"u"&&"WebGLRenderingContext"in window,K=bc();let V=!1;try{new OffscreenCanvas(2,2).getContext("2d"),V=!0}catch{V=!1}let G=!1;try{window.addEventListener("testPassive",()=>{},{get passive(){return G=!0,!0}})}catch{}wr={IS_NODE:wc,isTest:!1,ie:t,ielt9:t&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:n,gecko:c,android:r.indexOf("android")!==-1,android23:o,chrome:a,chromeVersion:D,safari:!a&&r.indexOf("safari")!==-1,phantomjs:i,ie3d:g,webkit3d:v,gecko3d:w,opera12:b,any3d:x,iosWeixin:u,mobile:d,mobileWebkit:d&&n,mobileWebkit3d:d&&v,mobileOpera:d&&"opera"in window,mobileGecko:d&&c,touch:!!X,msPointer:!!m,pointer:!!f,retina:K>1,devicePixelRatio:K,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:t&&document.documentMode===9,ie10:t&&document.documentMode===10,webgl:I,imageBitMap:L,resizeObserver:M,btoa:C,decodeImageInWorker:V,monitorDPRChange:!0,supportsPassive:G,proxy:W,requestIdleCallback:z,checkDevicePixelRatio:()=>{if(typeof window<"u"&&wr.monitorDPRChange){const k=bc(),j=k!==wr.devicePixelRatio;return j&&(wr.devicePixelRatio=k),j}return!1}}}const mm=wr;var gm=Object.defineProperty,ym=(r,e,t)=>e in r?gm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kn=(r,e,t)=>ym(r,typeof e!="symbol"?e+"":e,t);function Kn(r){return class extends r{constructor(...e){super(...e),kn(this,"eventClass",new ko),kn(this,"on",this.eventClass.on.bind(this.eventClass)),kn(this,"trigger",this.eventClass.trigger.bind(this.eventClass)),kn(this,"off",this.eventClass.off.bind(this.eventClass)),this.eventClass=new ko}}}function yi(r){return class extends r{constructor(...e){super(...e),kn(this,"options"),kn(this,"_isUpdatingOptions"),kn(this,"_initHooksCalled"),kn(this,"_initHooks");const t=Object.getPrototypeOf(this).options||{},n=Ko({},t,e[0]||{});this.setOptions(n),this.callInitHooks(),this._isUpdatingOptions=!1}proxyOptions(){return mm.proxy?(this.options=new Proxy(this.options,{set:(e,t,n)=>{if(t=t,e[t]===n||(e[t]=n,this._isUpdatingOptions))return!0;const i={};return i[t]=n,this.config(i),!0}}),this):this}callInitHooks(){const e=Object.getPrototypeOf(this);return this._visitInitHooks(e),this}setOptions(e){if((!this.hasOwnProperty("options")||ls(this.options))&&(this.options=this.options?Object.create(this.options):{}),!e)return this;for(const t in e)this.options[t]=e[t];return this}config(e,t){if(this._isUpdatingOptions=!0,e){if(arguments.length===2&&typeof e=="string"){const n={};n[e]=t,e=n}e=e;for(const n in e)this.options[n]=e[n],this[n]&&this[n]instanceof cs&&(e[n]?this[n].enable():this[n].disable());this.onConfig(e),this._isUpdatingOptions=!1}else{const n={};for(const i in this.options)this.options.hasOwnProperty(i)&&(n[i]=this.options[i]);return this._isUpdatingOptions=!1,n}return this}onConfig(e){}_visitInitHooks(e){if(this._initHooksCalled)return;const t=Object.getPrototypeOf(e);t._visitInitHooks&&t._visitInitHooks.call(this,t),this._initHooksCalled=!0;const n=e._initHooks;if(n&&n!==t._initHooks)for(let i=0;i<n.length;i++)n[i].call(this)}static mergeOptions(e){const t=this.prototype,n=Object.getPrototypeOf(t);return t.hasOwnProperty("options")?t.options===n.options&&(t.options=Object.create(t.options)):t.options={},Ko(t.options,e),this}static addInitHook(e,...t){const n=typeof e=="function"?e:function(){this[e].apply(this,t)},i=this.prototype,o=Object.getPrototypeOf(i);return(!i._initHooks||i._initHooks===o._initHooks)&&(i._initHooks=[]),i._initHooks.push(n),this}static include(...e){for(let t=0;t<e.length;t++)Ko(this.prototype,e[t]);return this}}}var vm=Object.defineProperty,_m=(r,e,t)=>e in r?vm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nn=(r,e,t)=>_m(r,typeof e!="symbol"?e+"":e,t);const Bo=`
|
|
620
|
+
`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const Oo=new p.Vector4,dc=new p.Vector3,fc=new p.Vector3,$e=new p.Vector4,qe=new p.Vector4,di=new p.Vector4,Do=new p.Vector3,zo=new p.Matrix4,et=new p.Line3,pc=new p.Vector3,ss=new p.Box3,os=new p.Sphere,fi=new p.Vector4;let pi,gn;function mc(r,e,t){return fi.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),fi.multiplyScalar(1/fi.w),fi.x=gn/t.width,fi.y=gn/t.height,fi.applyMatrix4(r.projectionMatrixInverse),fi.multiplyScalar(1/fi.w),Math.abs(Math.max(fi.x,fi.y))}function rm(r,e){const t=r.matrixWorld,i=r.geometry,n=i.attributes.instanceStart,o=i.attributes.instanceEnd,a=Math.min(i.instanceCount,n.count);for(let c=0,h=a;c<h;c++){et.start.fromBufferAttribute(n,c),et.end.fromBufferAttribute(o,c),et.applyMatrix4(t);const d=new p.Vector3,m=new p.Vector3;pi.distanceSqToSegment(et.start,et.end,m,d),m.distanceTo(d)<gn*.5&&e.push({point:m,pointOnLine:d,distance:pi.origin.distanceTo(m),object:r,face:null,faceIndex:c,uv:null,[bo]:null})}}function sm(r,e,t){const i=e.projectionMatrix,o=r.material.resolution,a=r.matrixWorld,c=r.geometry,h=c.attributes.instanceStart,d=c.attributes.instanceEnd,m=Math.min(c.instanceCount,h.count),f=-e.near;pi.at(1,di),di.w=1,di.applyMatrix4(e.matrixWorldInverse),di.applyMatrix4(i),di.multiplyScalar(1/di.w),di.x*=o.x/2,di.y*=o.y/2,di.z=0,Do.copy(di),zo.multiplyMatrices(e.matrixWorldInverse,a);for(let g=0,v=m;g<v;g++){if($e.fromBufferAttribute(h,g),qe.fromBufferAttribute(d,g),$e.w=1,qe.w=1,$e.applyMatrix4(zo),qe.applyMatrix4(zo),$e.z>f&&qe.z>f)continue;if($e.z>f){const C=$e.z-qe.z,W=($e.z-f)/C;$e.lerp(qe,W)}else if(qe.z>f){const C=qe.z-$e.z,W=(qe.z-f)/C;qe.lerp($e,W)}$e.applyMatrix4(i),qe.applyMatrix4(i),$e.multiplyScalar(1/$e.w),qe.multiplyScalar(1/qe.w),$e.x*=o.x/2,$e.y*=o.y/2,qe.x*=o.x/2,qe.y*=o.y/2,et.start.copy($e),et.start.z=0,et.end.copy(qe),et.end.z=0;const b=et.closestPointToPointParameter(Do,!0);et.at(b,pc);const x=p.MathUtils.lerp($e.z,qe.z,b),L=x>=-1&&x<=1,M=Do.distanceTo(pc)<gn*.5;if(L&&M){et.start.fromBufferAttribute(h,g),et.end.fromBufferAttribute(d,g),et.start.applyMatrix4(a),et.end.applyMatrix4(a);const C=new p.Vector3,W=new p.Vector3;pi.distanceSqToSegment(et.start,et.end,W,C),t.push({point:W,pointOnLine:C,distance:pi.origin.distanceTo(W),object:r,face:null,faceIndex:g,uv:null,[bo]:null})}}}class om extends p.Mesh{constructor(e=new uc,t=new gr({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,n=new Float32Array(2*t.count);for(let a=0,c=0,h=t.count;a<h;a++,c+=2)dc.fromBufferAttribute(t,a),fc.fromBufferAttribute(i,a),n[c]=c===0?0:n[c-1],n[c+1]=n[c]+dc.distanceTo(fc);const o=new p.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(o,1,1)),this}raycast(e,t){const i=this.material.worldUnits,n=e.camera;n===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;pi=e.ray;const a=this.matrixWorld,c=this.geometry,h=this.material;gn=h.linewidth+o,c.boundingSphere===null&&c.computeBoundingSphere(),os.copy(c.boundingSphere).applyMatrix4(a);let d;if(i)d=gn*.5;else{const f=Math.max(n.near,os.distanceToPoint(pi.origin));d=mc(n,f,h.resolution)}if(os.radius+=d,pi.intersectsSphere(os)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),ss.copy(c.boundingBox).applyMatrix4(a);let m;if(i)m=gn*.5;else{const f=Math.max(n.near,ss.distanceToPoint(pi.origin));m=mc(n,f,h.resolution)}ss.expandByScalar(m),pi.intersectsBox(ss)!==!1&&(i?rm(this,t):sm(this,n,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Oo),this.material.uniforms.resolution.value.set(Oo.z,Oo.w))}}class yr extends om{constructor(e=new rs,t=new gr({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}var Ui=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return this.None(r)},Out:function(r){return this.None(r)},InOut:function(r){return this.None(r)}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var e=1.70158;return r===1?1:r*r*((e+1)*r-e)},Out:function(r){var e=1.70158;return r===0?0:--r*r*((e+1)*r+e)+1},InOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)}}),Bounce:Object.freeze({In:function(r){return 1-Ui.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?Ui.Bounce.In(r*2)*.5:Ui.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(e){return Math.pow(e,r)},Out:function(e){return 1-Math.pow(1-e,r)},InOut:function(e){return e<.5?Math.pow(e*2,r)/2:(1-Math.pow(2-e*2,r))/2+.5}}}}),vr=function(){return performance.now()},am=function(){function r(){this._tweens={},this._tweensAddedDuringUpdate={}}return r.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},r.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},r.prototype.update=function(e,t){e===void 0&&(e=vr()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var o=this._tweens[i[n]],a=!t;o&&o.update(e,a)===!1&&!t&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),Xo={Linear:function(r,e){var t=r.length-1,i=t*e,n=Math.floor(i),o=Xo.Utils.Linear;return e<0?o(r[0],r[1],i):e>1?o(r[t],r[t-1],t-i):o(r[n],r[n+1>t?t:n+1],i-n)},Utils:{Linear:function(r,e,t){return(e-r)*t+r}}},gc=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),Uo=new am,as=function(){function r(e,t){t===void 0&&(t=Uo),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ui.Linear.None,this._interpolationFunction=Xo.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=gc.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.getDuration=function(){return this._duration},r.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},r.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},r.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},r.prototype.start=function(e,t){if(e===void 0&&(e=vr()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var o in this._valuesEnd)n[o]=this._valuesEnd[o];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},r.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},r.prototype._setupProperties=function(e,t,i,n,o){for(var a in i){var c=e[a],h=Array.isArray(c),d=h?"array":typeof c,m=!h&&Array.isArray(i[a]);if(!(d==="undefined"||d==="function")){if(m){var f=i[a];if(f.length===0)continue;for(var g=[c],v=0,w=f.length;v<w;v+=1){var b=this._handleRelativeValue(c,f[v]);if(isNaN(b)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(b)}m&&(i[a]=g)}if((d==="object"||h)&&c&&!m){t[a]=h?[]:{};var x=c;for(var L in x)t[a][L]=x[L];n[a]=h?[]:{};var f=i[a];if(!this._isDynamic){var M={};for(var L in f)M[L]=f[L];i[a]=f=M}this._setupProperties(x,t[a],f,n[a],o)}else(typeof t[a]>"u"||o)&&(t[a]=c),h||(t[a]*=1),m?n[a]=i[a].slice().reverse():n[a]=t[a]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},r.prototype.pause=function(e){return e===void 0&&(e=vr()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},r.prototype.resume=function(e){return e===void 0&&(e=vr()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},r.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},r.prototype.group=function(e){return e===void 0&&(e=Uo),this._group=e,this},r.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},r.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},r.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},r.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},r.prototype.easing=function(e){return e===void 0&&(e=Ui.Linear.None),this._easingFunction=e,this},r.prototype.interpolation=function(e){return e===void 0&&(e=Xo.Linear),this._interpolationFunction=e,this},r.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},r.prototype.onStart=function(e){return this._onStartCallback=e,this},r.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},r.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},r.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},r.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},r.prototype.onStop=function(e){return this._onStopCallback=e,this},r.prototype.update=function(e,t){var i=this,n;if(e===void 0&&(e=vr()),t===void 0&&(t=!0),this._isPaused)return!0;var o,a=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>a)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var c=e-this._startTime,h=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),d=this._duration+this._repeat*h,m=function(){if(i._duration===0||c>d)return 1;var x=Math.trunc(c/h),L=c-x*h,M=Math.min(L/i._duration,1);return M===0&&c===i._duration?1:M},f=m(),g=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,g),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||c>=this._duration)if(this._repeat>0){var v=Math.min(Math.trunc((c-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=h*v,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var w=0,b=this._chainedTweens.length;w<b;w++)this._chainedTweens[w].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(e,t,i,n){for(var o in i)if(t[o]!==void 0){var a=t[o]||0,c=i[o],h=Array.isArray(e[o]),d=Array.isArray(c),m=!h&&d;m?e[o]=this._interpolationFunction(c,n):typeof c=="object"&&c?this._updateProperties(e[o],a,c,n):(c=this._handleRelativeValue(a,c),typeof c=="number"&&(e[o]=a+(c-a)*n))}},r.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},r.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},r}();gc.nextId;var mi=Uo;mi.getAll.bind(mi),mi.removeAll.bind(mi),mi.add.bind(mi),mi.remove.bind(mi);var lm=mi.update.bind(mi);function ko(r,e,t){if(r==null||r==="")throw new Error(t||`Parameter "${e}" is required but received: ${r}`);return r}function yc(r,e,t){const i=e.split(".");let n=r;for(const o of i){if(n[o]===void 0||n[o]===null)throw new Error(`Property "${e}" is required but missing at path: "${o}"`);n=n[o]}return n}function cm(r,e,t,i=0,n=1){const o=(r-e)*(n-i)/(t-e)+i,a=Math.min(i,n),c=Math.max(i,n);return o<a?a:o>c?c:o||0}var hm=Object.defineProperty,um=(r,e,t)=>e in r?hm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vc=(r,e,t)=>um(r,typeof e!="symbol"?e+"":e,t);class Ko{constructor(){vc(this,"_dispatcher",new p.EventDispatcher),vc(this,"_listenerMap",new Map)}on(e,t){const i=n=>t(n.data||n);return this._listenerMap.has(e)||this._listenerMap.set(e,new Map),this._listenerMap.get(e).set(t,i),this._dispatcher.addEventListener(e,i),this}once(e,t){const i=n=>{this.off(e,i),t(n.data||n)};return this.on(e,i)}off(e,t){const i=this._listenerMap.get(e);if(!i)return this;const n=i.get(t);return n&&(this._dispatcher.removeEventListener(e,n),i.delete(t),i.size===0&&this._listenerMap.delete(e)),this}trigger(e,t){const i={type:e,data:t};return this._dispatcher.dispatchEvent(i),this}get threeEventDispatcher(){return this._dispatcher}}function dm(r,e){return r.replace(/\{(\w+)\}/g,(t,i)=>{if(e.hasOwnProperty(i)){const n=e[i];return n!==void 0?String(n):t}throw new Error(`缺少必要参数: ${i}`)})}function No(r,...e){for(let t=0;t<e.length;t++){const i=e[t];for(const n in i)r[n]=i[n]}return r}function ls(r){return r==null}function _r(r){return ls(r)?!1:typeof r=="function"||r.constructor!==null&&r.constructor===Function}function _c(r=new Date){const e=r.getFullYear().toString(),t=(r.getMonth()+1).toString().padStart(2,"0"),i=r.getDate().toString().padStart(2,"0"),n=r.getHours().toString().padStart(2,"0"),o=r.getMinutes().toString().padStart(2,"0"),a=r.getSeconds().toString().padStart(2,"0");return`${e}-${t}-${i} ${n}:${o}:${a}`}var fm=Object.defineProperty,pm=(r,e,t)=>e in r?fm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bo=(r,e,t)=>pm(r,typeof e!="symbol"?e+"":e,t);class mm{}class cs extends Ki(yn(mm)){constructor(e){super(),Bo(this,"target"),Bo(this,"dom"),Bo(this,"_enabled",!1),this.target=e}enable(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)}disable(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this}enabled(){return!!this._enabled}remove(){this.disable(),delete this.target,delete this.dom}}const wc=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];let wr={};function bc(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!wc){const r=navigator.userAgent.toLowerCase(),e=document.documentElement||{style:{}},t="ActiveXObject"in window,i=r.indexOf("webkit")!==-1,n=r.indexOf("phantom")!==-1,o=r.search("android [23]")!==-1,a=r.indexOf("chrome")!==-1,c=r.indexOf("gecko")!==-1&&!i&&!("opera"in window)&&!t,h=/iphone/i.test(r)&&/micromessenger/i.test(r),d=typeof orientation<"u"||r.indexOf("mobile")!==-1,m=!window.PointerEvent&&"MSPointerEvent"in window,f=window.PointerEvent&&navigator.pointerEnabled||m,g=t&&"transition"in e.style,v="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!o,w="MozPerspective"in e.style,b="OTransition"in e.style,x=(g||v||w)&&!b&&!n,L=typeof window<"u"&&_r(window.createImageBitmap),M=typeof window<"u"&&_r(window.ResizeObserver),C=typeof window<"u"&&_r(window.btoa),W=typeof window<"u"&&_r(window.Proxy),z=typeof window<"u"&&_r(window.requestIdleCallback);let D=0;if(a){const k=r.match(/chrome\/([\d.]+)/);D=k?k[1]:0}const X=!n&&(f||"ontouchstart"in window||"DocumentTouch"in window&&document instanceof window.DocumentTouch),I=typeof window<"u"&&"WebGLRenderingContext"in window,K=bc();let V=!1;try{new OffscreenCanvas(2,2).getContext("2d"),V=!0}catch{V=!1}let G=!1;try{window.addEventListener("testPassive",()=>{},{get passive(){return G=!0,!0}})}catch{}wr={IS_NODE:wc,isTest:!1,ie:t,ielt9:t&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:i,gecko:c,android:r.indexOf("android")!==-1,android23:o,chrome:a,chromeVersion:D,safari:!a&&r.indexOf("safari")!==-1,phantomjs:n,ie3d:g,webkit3d:v,gecko3d:w,opera12:b,any3d:x,iosWeixin:h,mobile:d,mobileWebkit:d&&i,mobileWebkit3d:d&&v,mobileOpera:d&&"opera"in window,mobileGecko:d&&c,touch:!!X,msPointer:!!m,pointer:!!f,retina:K>1,devicePixelRatio:K,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:t&&document.documentMode===9,ie10:t&&document.documentMode===10,webgl:I,imageBitMap:L,resizeObserver:M,btoa:C,decodeImageInWorker:V,monitorDPRChange:!0,supportsPassive:G,proxy:W,requestIdleCallback:z,checkDevicePixelRatio:()=>{if(typeof window<"u"&&wr.monitorDPRChange){const k=bc(),j=k!==wr.devicePixelRatio;return j&&(wr.devicePixelRatio=k),j}return!1}}}const gm=wr;var ym=Object.defineProperty,vm=(r,e,t)=>e in r?ym(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ki=(r,e,t)=>vm(r,typeof e!="symbol"?e+"":e,t);function Ki(r){return class extends r{constructor(...e){super(...e),ki(this,"eventClass",new Ko),ki(this,"on",this.eventClass.on.bind(this.eventClass)),ki(this,"trigger",this.eventClass.trigger.bind(this.eventClass)),ki(this,"off",this.eventClass.off.bind(this.eventClass)),this.eventClass=new Ko}}}function yn(r){return class extends r{constructor(...e){super(...e),ki(this,"options"),ki(this,"_isUpdatingOptions"),ki(this,"_initHooksCalled"),ki(this,"_initHooks");const t=Object.getPrototypeOf(this).options||{},i=No({},t,e[0]||{});this.setOptions(i),this.callInitHooks(),this._isUpdatingOptions=!1}proxyOptions(){return gm.proxy?(this.options=new Proxy(this.options,{set:(e,t,i)=>{if(t=t,e[t]===i||(e[t]=i,this._isUpdatingOptions))return!0;const n={};return n[t]=i,this.config(n),!0}}),this):this}callInitHooks(){const e=Object.getPrototypeOf(this);return this._visitInitHooks(e),this}setOptions(e){if((!this.hasOwnProperty("options")||ls(this.options))&&(this.options=this.options?Object.create(this.options):{}),!e)return this;for(const t in e)this.options[t]=e[t];return this}config(e,t){if(this._isUpdatingOptions=!0,e){if(arguments.length===2&&typeof e=="string"){const i={};i[e]=t,e=i}e=e;for(const i in e)this.options[i]=e[i],this[i]&&this[i]instanceof cs&&(e[i]?this[i].enable():this[i].disable());this.onConfig(e),this._isUpdatingOptions=!1}else{const i={};for(const n in this.options)this.options.hasOwnProperty(n)&&(i[n]=this.options[n]);return this._isUpdatingOptions=!1,i}return this}onConfig(e){}_visitInitHooks(e){if(this._initHooksCalled)return;const t=Object.getPrototypeOf(e);t._visitInitHooks&&t._visitInitHooks.call(this,t),this._initHooksCalled=!0;const i=e._initHooks;if(i&&i!==t._initHooks)for(let n=0;n<i.length;n++)i[n].call(this)}static mergeOptions(e){const t=this.prototype,i=Object.getPrototypeOf(t);return t.hasOwnProperty("options")?t.options===i.options&&(t.options=Object.create(t.options)):t.options={},No(t.options,e),this}static addInitHook(e,...t){const i=typeof e=="function"?e:function(){this[e].apply(this,t)},n=this.prototype,o=Object.getPrototypeOf(n);return(!n._initHooks||n._initHooks===o._initHooks)&&(n._initHooks=[]),n._initHooks.push(i),this}static include(...e){for(let t=0;t<e.length;t++)No(this.prototype,e[t]);return this}}}var _m=Object.defineProperty,wm=(r,e,t)=>e in r?_m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ae=(r,e,t)=>wm(r,typeof e!="symbol"?e+"":e,t);const hs=`
|
|
621
621
|
varying vec2 vUv;
|
|
622
622
|
void main() {
|
|
623
623
|
vUv = uv;
|
|
624
624
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
625
625
|
}
|
|
626
|
-
`,
|
|
626
|
+
`,bm=`
|
|
627
627
|
varying vec2 vUv;
|
|
628
628
|
uniform float iTime;
|
|
629
629
|
uniform float rainSpeed;
|
|
@@ -647,35 +647,50 @@
|
|
|
647
647
|
return mix(mix(lb, rb, f.x), mix(lt, rt, f.x), f.y);
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
|
|
650
|
+
// 原始的 rain 函数,保留其复杂逻辑
|
|
651
|
+
float rainOriginal(vec2 uv, float intensity, float speed) {
|
|
651
652
|
float travelTime = (iTime * 0.2) + 0.1;
|
|
652
653
|
vec2 tiling = vec2(1.0, 0.01);
|
|
653
|
-
|
|
654
|
-
// rainIntensity 越小 → 缩放系数越大 → 噪声格点越密 → 屏幕上的雨纹越多(密集小雨)
|
|
655
|
-
float scale = max(rainIntensity, 0.001);
|
|
654
|
+
float scale = max(intensity, 0.001);
|
|
656
655
|
vec2 offset = vec2(travelTime * 0.5 + uv.x * 0.2, travelTime * 0.2);
|
|
657
656
|
vec2 st = uv * tiling / scale + offset;
|
|
658
657
|
float rain = 0.1;
|
|
659
|
-
float f = fract(noise(st * 200.5) * noise(st * 125.5) *
|
|
660
|
-
f = clamp(pow(abs(f), 15.0) * 1.5 * (rain * rain * 125.0), 0.0, 0.25 *
|
|
658
|
+
float f = fract(noise(st * 200.5) * noise(st * 125.5) * speed);
|
|
659
|
+
f = clamp(pow(abs(f), 15.0) * 1.5 * (rain * rain * 125.0), 0.0, 0.25 * intensity);
|
|
661
660
|
return f;
|
|
662
661
|
}
|
|
663
662
|
|
|
663
|
+
// 深度层函数,调用原始逻辑但参数不同
|
|
664
|
+
float rainLayer(vec2 uv, float depth, float speedMult, float intensityMult) {
|
|
665
|
+
// 调整原始函数的参数以体现深度
|
|
666
|
+
float adjustedIntensity = rainIntensity * intensityMult * max(0.1, 1.0 - depth * 0.6);
|
|
667
|
+
float adjustedSpeed = rainSpeed * speedMult;
|
|
668
|
+
return rainOriginal(uv, adjustedIntensity, adjustedSpeed);
|
|
669
|
+
}
|
|
670
|
+
|
|
664
671
|
mat2 rotate2d(float angle) {
|
|
665
672
|
return mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
|
|
666
673
|
}
|
|
667
674
|
|
|
668
675
|
void main() {
|
|
669
|
-
mat2
|
|
670
|
-
|
|
671
|
-
|
|
676
|
+
mat2 rot = rotate2d(rainAngle * PI);
|
|
677
|
+
vec2 rotatedUv = vUv * rot;
|
|
678
|
+
|
|
679
|
+
// 两层深度:前景(快、浓)、远景(慢、淡)
|
|
680
|
+
float rain = 0.0;
|
|
681
|
+
rain += rainLayer(rotatedUv, 0.0, 1.3, 0.7); // 前景:较快、较浓
|
|
682
|
+
rain += rainLayer(rotatedUv, 1.0, 0.7, 0.3); // 远景:较慢、较淡
|
|
683
|
+
|
|
684
|
+
if (rain <= 0.01) {
|
|
672
685
|
discard;
|
|
673
686
|
return;
|
|
674
687
|
}
|
|
675
|
-
|
|
688
|
+
|
|
689
|
+
// 雨滴颜色略带灰蓝,更自然
|
|
690
|
+
vec3 col = vec3(0.75, 0.8, 0.85);
|
|
676
691
|
gl_FragColor = vec4(col, rain);
|
|
677
692
|
}
|
|
678
|
-
`,
|
|
693
|
+
`,xm=`
|
|
679
694
|
varying vec2 vUv;
|
|
680
695
|
uniform float iTime;
|
|
681
696
|
uniform float aspectRatio; // 屏幕宽高比,修正非正方形屏幕上的椭圆问题
|
|
@@ -712,7 +727,7 @@
|
|
|
712
727
|
}
|
|
713
728
|
gl_FragColor = vec4(1.0, 1.0, 1.0, snow);
|
|
714
729
|
}
|
|
715
|
-
`,
|
|
730
|
+
`,Mm=`
|
|
716
731
|
varying vec2 vUv;
|
|
717
732
|
uniform float iTime;
|
|
718
733
|
uniform float fogSpeed;
|
|
@@ -813,18 +828,24 @@
|
|
|
813
828
|
}
|
|
814
829
|
gl_FragColor = vec4(vec3(1.0), q * fogOpacity);
|
|
815
830
|
}
|
|
816
|
-
`;class xc{constructor(e,t,n={}){Nn(this,"scene"),Nn(this,"camera"),Nn(this,"mesh"),Nn(this,"rainMaterial"),Nn(this,"snowMaterial"),Nn(this,"fogMaterial"),Nn(this,"_type",null),Nn(this,"_activeMaterial",null),this.scene=new p.Scene,this.scene.autoClear=!1;const i=e/2,o=t/2;this.camera=new p.OrthographicCamera(-i,i,o,-o,.1,10),this.camera.position.z=5;const a=new p.PlaneGeometry(e,t);this.mesh=new p.Mesh(a),this.mesh.position.z=1,this.scene.add(this.mesh),this.rainMaterial=new p.ShaderMaterial({vertexShader:Bo,fragmentShader:wm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},rainSpeed:{value:n.speed??3},rainAngle:{value:n.rainAngle??-.1},rainIntensity:{value:n.rainIntensity??1}}}),this.snowMaterial=new p.ShaderMaterial({vertexShader:Bo,fragmentShader:bm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},aspectRatio:{value:e/t}}}),this.fogMaterial=new p.ShaderMaterial({vertexShader:Bo,fragmentShader:xm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},fogSpeed:{value:n.speed??1},fogOpacity:{value:n.opacity??1}}}),n.type&&this.setWeather(n.type),n.speed!==void 0&&this.setSpeed(n.speed),n.opacity!==void 0&&this.setOpacity(n.opacity),n.rainIntensity!==void 0&&this.setRainIntensity(n.rainIntensity)}get type(){return this._type}setWeather(e){if(this._type=e,e===null)return this._activeMaterial=null,this.mesh.material=null,this;switch(e){case"rain":this._activeMaterial=this.rainMaterial;break;case"snow":this._activeMaterial=this.snowMaterial;break;case"fog":this._activeMaterial=this.fogMaterial;break}return this.mesh.material=this._activeMaterial,this}setSpeed(e){return this.rainMaterial.uniforms.rainSpeed&&(this.rainMaterial.uniforms.rainSpeed.value=e),this.fogMaterial.uniforms.fogSpeed&&(this.fogMaterial.uniforms.fogSpeed.value=e),this}setOpacity(e){return this.fogMaterial.uniforms.fogOpacity&&(this.fogMaterial.uniforms.fogOpacity.value=e),this}setRainAngle(e){return this.rainMaterial.uniforms.rainAngle&&(this.rainMaterial.uniforms.rainAngle.value=e),this}setRainIntensity(e){return this.rainMaterial.uniforms.rainIntensity&&(this.rainMaterial.uniforms.rainIntensity.value=e),this}update(e){if(!this._activeMaterial)return;const t=this._activeMaterial.uniforms.iTime.value+e;this._activeMaterial.uniforms.iTime.value=t}resize(e,t){const n=e/2,i=t/2;this.camera.left=-n,this.camera.right=n,this.camera.top=i,this.camera.bottom=-i,this.camera.updateProjectionMatrix(),this.snowMaterial.uniforms.aspectRatio&&(this.snowMaterial.uniforms.aspectRatio.value=e/t),this.mesh.geometry.dispose(),this.mesh.geometry=new p.PlaneGeometry(e,t)}dispose(){this.rainMaterial.dispose(),this.snowMaterial.dispose(),this.fogMaterial.dispose(),this.mesh.geometry.dispose()}}var Mm=Object.defineProperty,Sm=(r,e,t)=>e in r?Mm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ve=(r,e,t)=>Sm(r,typeof e!="symbol"?e+"":e,t);const Lm=Kn(yi(p.EventDispatcher));class Mc extends Lm{constructor(e,t={}){super(),Ve(this,"scene"),Ve(this,"renderer"),Ve(this,"camera"),Ve(this,"controls"),Ve(this,"ambLight"),Ve(this,"dirLight"),Ve(this,"auxDirLight"),Ve(this,"clouds",null),Ve(this,"container"),Ve(this,"_clock",new p.Clock),Ve(this,"stats"),Ve(this,"_animationCallbacks",new Set),Ve(this,"_fogFactor",1),Ve(this,"_sceneSize",5e4*2),Ve(this,"_weatherEffect",null),Ve(this,"gorund"),Ve(this,"map"),Ve(this,"centerPostion"),Ve(this,"_isInteracting",!1),Ve(this,"debug",!1),Ve(this,"flyTween",null),Ve(this,"composer"),Ve(this,"renderPass"),Ve(this,"bloomPass"),Ve(this,"calculateCameraPosition",(g,v,w,b)=>{const x=new p.Vector3(0,v*Math.cos(w),v*Math.sin(w));return x.applyAxisAngle(new p.Vector3(0,1,0),b),new p.Vector3(g.x+x.x,g.y+x.y,g.z+x.z)}),this.setOptions(t);const{antialias:n=!1,stencil:i=!0,logarithmicDepthBuffer:o=!0,skybox:a,map:c,bloom:u,minDistance:d,maxDistance:m,draggable:f=!0}=t;if(this.map=c,this.centerPostion=this.map.geo2world(new p.Vector3(this.map.center[0],this.map.center[1],0)),this.renderer=this._createRenderer(n,i,o),this.scene=this._createScene(a),this.camera=this._createCamera(),e&&this.addTo(e),this.controls=this._createControls(d,m),this.controls.enabled=f!==!1,this.ambLight=this._createAmbLight(),this.scene.add(this.ambLight),this.dirLight=this._createDirLight(),this.scene.add(this.dirLight),this.scene.add(this.dirLight.target),this.auxDirLight=this._createAuxDirLight(),this.gorund=this._createGorund(),this.scene.add(this.gorund),u&&u.enabled){const g=this.renderer.getPixelRatio(),v=this.container?this.width:window.innerWidth,w=this.container?this.height:window.innerHeight,b=v*g,x=w*g,L=new p.WebGLRenderTarget(b,x,{format:p.RGBAFormat});L.samples=4,this.composer=new Qf(this.renderer,L),this.renderPass=new $f(this.scene,this.camera),this.composer.addPass(this.renderPass);const M=u?.strength??1.5,C=u?.radius??1,W=u?.threshold??.7;this.bloomPass=new Nf(new p.Vector2(b,x),M,C,W),this.composer.addPass(this.bloomPass)}this.renderer.setAnimationLoop(this.animate.bind(this)),this._initWeather(),this.debug=t.debug||!1,this.flyTween=null,this.debug&&(this.stats=new hr,document.body.appendChild(this.stats.dom))}get fogFactor(){return this._fogFactor}get isInteracting(){return this._isInteracting}set fogFactor(e){this._fogFactor=e,this.controls.dispatchEvent({type:"change",target:this.controls})}get width(){return this.container?.clientWidth||0}get height(){return this.container?.clientHeight||0}addTo(e){const t=typeof e=="string"?document.querySelector(e):e;if(t instanceof HTMLElement)this.container=t,t.appendChild(this.renderer.domElement),new ResizeObserver(this.resize.bind(this)).observe(t);else throw`${e} not found!}`;return this}_createScene(e){const t=new p.Scene,n=e?.defaultColor||"rgb(21,48,94)";if(t.background=new p.Color(n),t.fog=new p.FogExp2(n,2e-4),e?.files){const i=new p.CubeTextureLoader;e.path&&i.setPath(e.path),i.load(e.files,o=>{t.background=o},void 0,o=>{console.error("Error loading skybox:",o),t.background=new p.Color(n)})}else e?.hdr&&this._loadHDRWithPMREM(t,e);return t}async _loadHDRWithPMREM(e,t){try{if(t){const i=await new em().setPath(t.path||"").setDataType(p.FloatType).loadAsync(t.hdr);i.colorSpace=this.renderer.outputColorSpace,i.mapping=303,i.needsUpdate=!0,e.background=i,e.environment=i}}catch(n){console.error("加载HDR失败:",n),e.background=new p.Color(t?.defaultColor||14414079)}}_createRenderer(e,t,n){const i=new p.WebGLRenderer({antialias:e,logarithmicDepthBuffer:n,stencil:t,alpha:!0,precision:"highp",powerPreference:"high-performance",failIfMajorPerformanceCaveat:!0});return i.debug.checkShaderErrors=!0,i.sortObjects=!0,i.setPixelRatio(window.devicePixelRatio),i.domElement.tabIndex=0,i.shadowMap.enabled=!0,i.shadowMap.needsUpdate=!0,i.shadowMap.type=p.PCFSoftShadowMap,i.toneMapping=p.ACESFilmicToneMapping,i.toneMappingExposure=1,i.outputColorSpace=p.SRGBColorSpace,i.autoClear=!1,i}_createCamera(){return new p.PerspectiveCamera(45,this.getAspect(),.1,this._sceneSize*2)}_createControls(e,t){const n=new Ff(this.camera,this.renderer.domElement),i=Math.PI/2.1;return n.screenSpacePanning=!1,n.minDistance=e??.1,n.maxDistance=t??6e4,n.maxPolarAngle=i,n.enableDamping=!0,n.dampingFactor=.08,n.keyPanSpeed=1,n.listenToKeyEvents(this.renderer.domElement),n.addEventListener("change",()=>{const o=Math.max(n.getPolarAngle(),.1),a=Math.max(n.getDistance(),100);n.zoomSpeed=Math.max(Math.log(a/1e3),1)+3;const c=3e5*2;n.maxDistance>c*.95&&(n.maxDistance=c*.95),this.camera.far=p.MathUtils.clamp(a/o*8,100,c),this.camera.near=p.MathUtils.clamp(this.camera.far/1e3,.001,1),this.camera.updateProjectionMatrix(),this.scene.fog instanceof p.FogExp2&&(this.scene.fog.density=o/(a+5)*this.fogFactor*.1);const d=a>6e4;n.minAzimuthAngle=d?0:-1/0,n.maxAzimuthAngle=d?0:1/0,n.maxPolarAngle=lm(n.getDistance(),0,7e4,i,0),this.map?.trigger("control-change",{type:"control-change",control:n,camera:this.camera,target:this.map})}),n.addEventListener("start",()=>{this._isInteracting=!0,this.map?.trigger("control-start",{type:"control-start",control:n,camera:this.camera,target:this.map})}),n.addEventListener("end",()=>{this._isInteracting=!1,this.map?.trigger("control-end",{type:"control-end",control:n,camera:this.camera,target:this.map})}),n}_createAmbLight(){return new p.AmbientLight(16777215,.1)}_createDirLight(){const f=new p.DirectionalLight("rgb(255, 255, 255)",3);f.position.set(this.centerPostion.x+55e3*1.2,55e3*2,this.centerPostion.z+55e3*1);const g=new p.Object3D;if(g.position.copy(this.centerPostion),this.scene.add(g),f.target=g,f.castShadow=!0,f.shadow.mapSize.width=1024*10,f.shadow.mapSize.height=1024*10,f.shadow.camera.near=1,f.shadow.camera.far=192500,f.shadow.camera.left=-55e3,f.shadow.camera.bottom=-55e3,f.shadow.camera.top=55e3,f.shadow.camera.right=55e3,f.shadow.radius=1,f.shadow.bias=-0,this.debug){const v=new p.CameraHelper(f.shadow.camera);v.name="dirLightCameraHelper",this.scene.add(v)}return f}_createAuxDirLight(){const a=this._createAuxLightInstance(this.centerPostion.x+-66e3,82500,this.centerPostion.z+-55e3,.5);a.name="AuxDirLight_BackFill",this.scene.add(a),this.scene.add(a.target);const m=this._createAuxLightInstance(this.centerPostion.x+55e3*-1,55e3*1.5,this.centerPostion.z+55e3*1.2,.5);m.name="AuxDirLight_LeftRim",this.scene.add(m),this.scene.add(m.target);const w=this._createAuxLightInstance(this.centerPostion.x+55e3*1,55e3*1.5,this.centerPostion.z+55e3*-1.2,.5);return w.name="AuxDirLight_RightRim",this.scene.add(w),this.scene.add(w.target),a}_createAuxLightInstance(e,t,n,i){const o=new p.DirectionalLight(16777215,i);o.position.set(e,t,n);const a=new p.Object3D;return a.position.copy(this.centerPostion),this.scene.add(a),o.target=a,o.castShadow=!1,o}resize(){const e=this.width,t=this.height;if(this.renderer.setSize(e,t),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this._weatherEffect&&this._weatherEffect.resize(e,t),this.composer){const n=this.renderer.getPixelRatio();this.composer.setSize(e*n,t*n),this.composer.render()}else this.renderer.render(this.scene,this.camera);return this}addAnimationCallback(e){return this._animationCallbacks.add(e),()=>this._animationCallbacks.delete(e)}animate(){const e=this._clock.getDelta(),t=this._clock.getElapsedTime();this._animationCallbacks.forEach(n=>n(e,t,this)),this.controls.update(),this.renderer.clear(),this.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this._weatherEffect?.type&&(this._weatherEffect.update(e),this.renderer.render(this._weatherEffect.scene,this._weatherEffect.camera)),am(),this.stats&&this.stats.update(),this.dispatchEvent({type:"update",delta:e})}flyTo(e,t,n=!0,i){if(this.controls.target.copy(e),n){const o=this.camera.position;new as(o).to({y:2e7,z:0},500).chain(new as(o).to(t,2e3).easing(Un.Quintic.Out).onComplete(a=>i&&i(a))).start()}else this.camera.position.copy(t)}flyToAdvanced(e){const t=this.camera,n=this.controls,i=e.center,o=e.cameraCoord,a=e.duration??2e3,c=e.delay??0,u=e.complete,d=!!e.curvePath;if(!i||!o)return;const m=this.map.geo2world(new p.Vector3(i[0],i[1],0)),f=this.map.geo2world(new p.Vector3(o[0],o[1],o[2]));if(!t||!n||!m||!f)return;const g=n.target.clone(),v=t.position.clone(),w=new p.Vector3(m.x,m.y,m.z),b=new p.Vector3(f.x,f.y,f.z);if(this.flyTween&&(this.flyTween.stop(),this.flyTween=null),d){const x=[v,v.clone().lerp(b,.33),v.clone().lerp(b,.67),b],L=new p.CubicBezierCurve3(...x),M={t:0,x:g.x,y:g.y,z:g.z};this.flyTween=new as(M).to({t:1,x:w.x,y:w.y,z:w.z},a).easing(Un.Quadratic.InOut).onUpdate(()=>{const C=L.getPoint(M.t),W=new p.Vector3(M.x,M.y,M.z);t.position.copy(C),t.lookAt(W),t.updateProjectionMatrix(),n.target.copy(W),n.update()})}else{const x={tx:g.x,ty:g.y,tz:g.z,px:v.x,py:v.y,pz:v.z};this.flyTween=new as(x).to({tx:w.x,ty:w.y,tz:w.z,px:b.x,py:b.y,pz:b.z},a).easing(Un.Quadratic.InOut).onUpdate(()=>{const L=new p.Vector3(x.tx,x.ty,x.tz),M=new p.Vector3(x.px,x.py,x.pz);t.position.copy(M),t.lookAt(L),n.target.copy(L),n.update()})}this.flyTween&&(this.flyTween.onComplete(()=>{this.flyTween&&(this.flyTween.stop(),this.flyTween=null),u&&u()}),c>0?setTimeout(()=>{this.flyTween&&this.flyTween.start()},c):this.flyTween.start())}onConfig(e){if("draggable"in e){const t=e.draggable;this.controls&&(this.controls.enabled=t!==!1)}}flyToPoint(e){const{controls:t}=this,n=e.center,i=e.duration??2e3,o=typeof e.distance=="number"?e.distance:typeof e.altitude=="number"?e.altitude:t.getDistance(),a=w=>w*Math.PI/180;let c;if(typeof e.polarDeg=="number"){const w=e.polarDeg<=0?.1:e.polarDeg;c=a(w)}else typeof e.polarAngle=="number"?c=e.polarAngle<=0?a(.1):e.polarAngle:c=t.getPolarAngle();const u=typeof e.azimuthDeg=="number"?a(e.azimuthDeg):e.azimuthAngle||t.getAzimuthalAngle(),d=e.complete,m=!!e.curvePath,f=this.map.geo2world(new p.Vector3(n[0],n[1],0)),g=this.calculateCameraPosition(f,o,c,u),v=this.map.world2geo(g);this.flyToAdvanced({center:[n[0],n[1],0],cameraCoord:[v.x,v.y,v.z||0],duration:i,complete:d,curvePath:m})}getState(){return{centerPosition:this.controls.target,cameraPosition:this.camera.position}}_bindMap(e){e&&(this.map=e)}getMap(){return this.map?this.map:null}getAspect(){const[e,t]=this.getWidthHeight();return e/t}getWidthHeight(){let e=window.innerWidth,t=window.innerHeight;return[e,t]}_createGorund(){const e=this.centerPostion,t=new p.MeshStandardMaterial({transparent:!1,color:new p.Color("rgb(45,52,60)").multiplyScalar(.7),metalness:.2,roughness:1}),n=new p.PlaneGeometry(this._sceneSize*2,this._sceneSize*2),i=new p.Mesh(n,t);return i.name="地面",i.castShadow=!1,i.receiveShadow=!1,i.position.y=0,i.position.add(e),i.rotateX(-Math.PI/2),i.visible=!1,i}_initWeather(){const e=this.width,t=this.height;this._weatherEffect=new xc(e,t);const n=this.options;if(n.weather){const i=n.weather;i.type&&this._weatherEffect.setWeather(i.type),i.speed!==void 0&&this._weatherEffect.setSpeed(i.speed),i.opacity!==void 0&&this._weatherEffect.setOpacity(i.opacity),i.rainAngle!==void 0&&this._weatherEffect.setRainAngle(i.rainAngle),i.rainIntensity!==void 0&&this._weatherEffect.setRainIntensity(i.rainIntensity)}}setWeather(e,t={}){return this._weatherEffect?(this._weatherEffect.setWeather(e),t.speed!==void 0&&this._weatherEffect.setSpeed(t.speed),t.opacity!==void 0&&this._weatherEffect.setOpacity(t.opacity),t.rainAngle!==void 0&&this._weatherEffect.setRainAngle(t.rainAngle),t.rainIntensity!==void 0&&this._weatherEffect.setRainIntensity(t.rainIntensity),this):this}getWeatherEffect(){return this._weatherEffect}setWeatherSpeed(e){return this._weatherEffect?.setSpeed(e),this}setWeatherOpacity(e){return this._weatherEffect?.setOpacity(e),this}setWeatherRainAngle(e){return this._weatherEffect?.setRainAngle(e),this}setWeatherRainIntensity(e){return this._weatherEffect?.setRainIntensity(e),this}destroy(){try{this.renderer.setAnimationLoop(null),this._animationCallbacks.clear(),this._weatherEffect&&(this._weatherEffect.dispose(),this._weatherEffect=null),this.map=null,this.controls&&this.controls.dispose(),this.scene&&(this.scene.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>{this._disposeMaterial(t)}):this._disposeMaterial(e.material))}),this.scene.clear()),this.composer&&(this.bloomPass&&this.bloomPass.dispose?.(),this.renderPass&&this.renderPass.dispose?.(),this.composer=null,this.renderPass=null,this.bloomPass=null),this.renderer&&(this.renderer.dispose(),this.container&&this.renderer.domElement.parentNode===this.container&&this.container.removeChild(this.renderer.domElement)),this.stats&&this.stats.dom.parentNode&&this.stats.dom.parentNode.removeChild(this.stats.dom)}catch(e){console.error("❌ 销毁Viewer时出错:",e)}}_disposeMaterial(e){if(!e)return;["map","lightMap","bumpMap","normalMap","specularMap","envMap","alphaMap","aoMap","displacementMap","emissiveMap","gradientMap","metalnessMap","roughnessMap"].forEach(n=>{e[n]&&e[n].dispose()}),e.dispose()}}var br=(r=>(r[r.none=0]="none",r[r.create=1]="create",r[r.remove=2]="remove",r))(br||{});function Pm(r,e){const t=r.position.clone().setZ(r.maxZ).applyMatrix4(r.matrixWorld);return e.distanceTo(t)}function Cm(r){const e=r.scale,t=new p.Vector3(-e.x,-e.y,0).applyMatrix4(r.matrixWorld),n=new p.Vector3(e.x,e.y,0).applyMatrix4(r.matrixWorld);return t.sub(n).length()}function Tm(r){return r.distToCamera/r.sizeInWorld*.8}function Gm(r,e,t,n){const i=Tm(r);if(r.isLeaf){if(r.inFrustum&&r.z<t&&(r.z<e||r.showing)&&(r.z<e||i<n))return 1}else if(r.z>=e&&(r.z>t||i>n))return 2;return 0}function Wm(r,e,t,n){const i=[],o=n+1,a=e*2,c=0,u=.25;{const d=t*2,m=new p.Vector3(.5,.5,1),f=new Bn(a,d,o),g=new Bn(a+1,d,o),v=new Bn(a,d+1,o),w=new Bn(a+1,d+1,o);f.position.set(-u,u,c),f.scale.copy(m),g.position.set(u,u,c),g.scale.copy(m),v.position.set(-u,-u,c),v.scale.copy(m),w.position.set(u,-u,c),w.scale.copy(m),i.push(f,g,v,w)}return i}var Zm=Object.defineProperty,Vm=(r,e,t)=>e in r?Zm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,et=(r,e,t)=>Vm(r,typeof e!="symbol"?e+"":e,t);const Im=10,Am=new p.InstancedBufferGeometry,Fm=new p.Vector3,Om=new p.Matrix4,Dm=new p.Box3(new p.Vector3(-.5,-.5,0),new p.Vector3(.5,.5,1)),Sc=new p.Frustum,Lc=class $r extends p.Mesh{constructor(e=0,t=0,n=0){super(Am,[]),et(this,"_dataOnlyMode",!1),et(this,"vectorData",null),et(this,"x"),et(this,"y"),et(this,"z"),et(this,"isTile",!0),et(this,"parent",null),et(this,"children",[]),et(this,"_ready",!1),et(this,"_isDummy",!1),et(this,"_showing",!1),et(this,"_maxZ",0),et(this,"distToCamera",0),et(this,"sizeInWorld",0),et(this,"_loaded",!1),et(this,"_inFrustum",!1),this.x=e,this.y=t,this.z=n,this.name=`Tile ${n}-${e}-${t}`,this.up.set(0,0,1),this.matrixAutoUpdate=!1}setDataOnlyMode(e){return this._dataOnlyMode=e,e&&(this.visible=!1),this}isDataOnlyMode(){return this._dataOnlyMode}getVectorData(){return this.vectorData}static get downloadThreads(){return $r._downloadThreads}get isDummy(){return this._isDummy}get showing(){return this._showing}set showing(e){const t=this._showing;this._showing=e,this.material.forEach(n=>n.visible=e),t===!1&&this._showing===!0&&this._loaded&&this.dispatchEvent({type:"tile-shown",tile:this}),t===!0&&this._showing===!1&&this.dispatchEvent({type:"tile-hidden",tile:this})}get maxZ(){return this._maxZ}set maxZ(e){this._maxZ=e}get index(){return this.parent?this.parent.children.indexOf(this):-1}get loaded(){return this._loaded}get inFrustum(){return this._inFrustum}set inFrustum(e){this._inFrustum=e}get isLeaf(){return this.children.filter(e=>e.isTile).length===0}traverse(e){e(this),this.children.forEach(t=>{t.isTile&&t.traverse(e)})}traverseVisible(e){this.visible&&(e(this),this.children.forEach(t=>{t.isTile&&t.traverseVisible(e)}))}raycast(e,t){this.showing&&this.loaded&&this.isTile&&super.raycast(e,t)}LOD(e){if($r.downloadThreads>Im)return{action:br.none};let t=[];const{loader:n,minLevel:i,maxLevel:o,LODThreshold:a}=e,c=Gm(this,i,o,a);return c===br.create&&(t=Wm(n,this.x,this.y,this.z),this.add(...t)),{action:c,newTiles:t}}_checkVisible(){const e=this.parent;if(e&&e.isTile){const t=e.children.filter(i=>i.isTile),n=t.every(i=>i.loaded);e.showing=!n,t.forEach(i=>i.showing=n)}return this}async _load(e){$r._downloadThreads++;const{x:t,y:n,z:i}=this;if(this._dataOnlyMode)try{const o=await e.load({x:t,y:n,z:i,bounds:[-1/0,-1/0,1/0,1/0]});this.vectorData=o.geometry?.userData||{},this._loaded=!0,this.dispatchEvent({type:"vector-data-loaded",data:this.vectorData,tile:this})}catch(o){console.error(`数据模式加载失败 ${i}/${t}/${n}:`,o),this._loaded=!1}else{const o=await e.load({x:t,y:n,z:i,bounds:[-1/0,-1/0,1/0,1/0]});this.material=o.materials,this.geometry=o.geometry,this.maxZ=this.geometry.boundingBox?.max.z||0,this._loaded=!0}return $r._downloadThreads--,this}_init(){this.updateMatrix(),this.updateMatrixWorld(),this.sizeInWorld=Cm(this)}update(e){if(console.assert(this.z===0),!this.parent)return this;Sc.setFromProjectionMatrix(Om.multiplyMatrices(e.camera.projectionMatrix,e.camera.matrixWorldInverse));const t=e.camera.getWorldPosition(Fm);return this.traverse(n=>{n.receiveShadow=this.receiveShadow,n.castShadow=this.castShadow;const i=Dm.clone().applyMatrix4(n.matrixWorld);i.max.setY(9e3),n.inFrustum=Sc.intersectsBox(i),n.distToCamera=Pm(n,t);const{action:o,newTiles:a}=n.LOD(e);this._doAction(n,o,a,e)}),this._checkReady(),this}_doAction(e,t,n,i){return t===br.create?n?.forEach(o=>{o._init(),o._isDummy=o.z<i.minLevel,this.dispatchEvent({type:"tile-created",tile:o}),o.isDummy||o._load(i.loader).then(()=>{o._checkVisible(),this.dispatchEvent({type:"tile-loaded",tile:o})})}):t===br.remove&&(e.showing=!0,e._unLoad(!1,i.loader),this.dispatchEvent({type:"tile-unload",tile:e})),this}reload(e){return this._unLoad(!0,e),this}_checkReady(){return this._ready||(this._ready=!0,this.traverse(e=>{if(e.isLeaf&&e.loaded&&!e.isDummy){this._ready=!1;return}}),this._ready&&this.dispatchEvent({type:"ready"})),this}_unLoad(e,t){return e&&this.isTile&&!this.isDummy&&(this.dispatchEvent({type:"unload"}),t?.unload?.(this)),this.children.forEach(n=>n._unLoad(!0,t)),this.clear(),this}};et(Lc,"_downloadThreads",0);let Bn=Lc;var zm=Object.defineProperty,Xm=(r,e,t)=>e in r?zm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Um=(r,e,t)=>Xm(r,e+"",t);class Pc{constructor(e=0){Um(this,"_lon0",0),this._lon0=e}get lon0(){return this._lon0}getTileXWithCenterLon(e,t){const n=Math.pow(2,t);let i=e+Math.round(n/360*this._lon0);return i>=n?i-=n:i<0&&(i+=n),i}getTileXYZproj(e,t,n){const i=this.mapWidth,o=this.mapHeight/2,a=e/Math.pow(2,n)*i-i/2,c=o-t/Math.pow(2,n)*o*2;return{x:a,y:c}}getProjBoundsFromLonLat(e){const t=e[0]===-180&&e[2]===180,n=this.project(e[0]+(t?this._lon0:0),e[1]),i=this.project(e[2]+(t?this._lon0:0),e[3]);return[Math.min(n.x,i.x),Math.min(n.y,i.y),Math.max(n.x,i.x),Math.max(n.y,i.y)]}getProjBoundsFromXYZ(e,t,n){const i=this.getTileXYZproj(e,t,n),o=this.getTileXYZproj(e+1,t+1,n);return[Math.min(i.x,o.x),Math.min(i.y,o.y),Math.max(i.x,o.x),Math.max(i.y,o.y)]}getLonLatBoundsFromXYZ(e,t,n){const i=this.getProjBoundsFromXYZ(e,t,n),o=this.unProject(i[0],i[1]),a=this.unProject(i[2],i[3]);return[o.lon,o.lat,a.lon,a.lat]}}var km=Object.defineProperty,Km=(r,e,t)=>e in r?km(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,us=(r,e,t)=>Km(r,typeof e!="symbol"?e+"":e,t);const xr=6378e3;class Cc extends Pc{constructor(){super(...arguments),us(this,"ID","3857"),us(this,"mapWidth",2*Math.PI*xr),us(this,"mapHeight",this.mapWidth),us(this,"mapDepth",1)}project(e,t){const n=(e-this.lon0)*(Math.PI/180),i=t*(Math.PI/180),o=xr*n,a=xr*Math.log(Math.tan(Math.PI/4+i/2));return{x:o,y:a}}unProject(e,t){let n=e/xr*(180/Math.PI)+this.lon0;return n>180&&(n-=360),{lat:(2*Math.atan(Math.exp(t/xr))-Math.PI/2)*(180/Math.PI),lon:n}}}var Nm=Object.defineProperty,Bm=(r,e,t)=>e in r?Nm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,hs=(r,e,t)=>Bm(r,typeof e!="symbol"?e+"":e,t);class Ym extends Pc{constructor(){super(...arguments),hs(this,"ID","4326"),hs(this,"mapWidth",36e3),hs(this,"mapHeight",18e3),hs(this,"mapDepth",1)}project(e,t){return{x:(e-this.lon0)*100,y:t*100}}unProject(e,t){return{lon:e/100+this.lon0,lat:t/100}}}const Rm={createFromID:(r="3857",e)=>{let t;switch(r){case"3857":t=new Cc(e);break;case"4326":t=new Ym(e);break;default:throw new Error(`Projection ID: ${r} is not supported.`)}return t}};function Yo(r,e){const t=r.getLayers().find(i=>i.isBaseLayer===!0)?._rootTile,n=e.intersectObjects([t]);for(const i of n)if(i.object instanceof Bn){const o=r.worldToLocal(i.point.clone()),a=r.map2geo(o);return Object.assign(i,{location:a})}}function Ro(r,e){const t=new p.Vector3(0,-1,0),n=new p.Vector3(e.x,10*1e3,e.z),i=new p.Raycaster(n,t);return Yo(r,i)}function Tc(r,e,t){const n=new p.Raycaster;return n.setFromCamera(t,r),Yo(e,n)}function jm(r,e=128){const t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("Failed to get canvas context");t.width=e,t.height=e;const i=e/2,o=e/2;return n.imageSmoothingEnabled=!1,n.fillStyle="#000022",n.strokeStyle="DarkGoldenrod",n.lineWidth=5,n.moveTo(i,3),n.lineTo(i,e),n.stroke(),n.closePath(),n.lineWidth=2,n.beginPath(),n.roundRect(2,2,e-4,o-8,10),n.closePath(),n.fill(),n.stroke(),n.font="24px Arial",n.fillStyle="Goldenrod",n.strokeStyle="black",n.textAlign="center",n.textBaseline="top",n.strokeText(r,i,20),n.fillText(r,i,20),t}function Jm(r,e=128){const t=new p.CanvasTexture(jm(r,e)),n=new p.SpriteMaterial({map:t,sizeAttenuation:!1}),i=new p.Sprite(n);return i.visible=!1,i.center.set(.5,.3),i.scale.setScalar(.11),i.renderOrder=999,i}var Qm=Object.defineProperty,Hm=(r,e,t)=>e in r?Qm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gn=(r,e,t)=>Hm(r,typeof e!="symbol"?e+"":e,t);class ds extends p.Mesh{constructor(e){super(),gn(this,"name","map"),gn(this,"_clock",new p.Clock),gn(this,"isLOD",!0),gn(this,"autoUpdate",!0),gn(this,"updateInterval",100),gn(this,"_minLevel",2),gn(this,"_layers",new Map),gn(this,"_maxLevel",24),gn(this,"_projection",new Cc(0)),gn(this,"_LODThreshold",1),this.up.set(0,0,1);const{minLevel:t=2,maxLevel:n=19}=e;this.minLevel=t,this.maxLevel=n}get minLevel(){return this._minLevel}set minLevel(e){this._minLevel=e}get maxLevel(){return this._maxLevel}set maxLevel(e){this._maxLevel=e}get lon0(){return this.projection.lon0}get projection(){return this._projection}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}static create(e){return new ds(e)}update(e){if(!this.autoUpdate)return;const t=this._clock.getElapsedTime();t>this.updateInterval/1e3&&(this._layers.forEach(n=>{n.enabled&&n.visible&&n.update(e)}),this._clock.start(),this.dispatchEvent({type:"update",delta:t}))}dispose(){this.removeFromParent()}geo2pos(e){return this.geo2map(e)}geo2map(e){const t=this.projection.project(e.x,e.y);return new p.Vector3(t.x,t.y,e.z)}geo2world(e){return this.localToWorld(this.geo2map(e))}pos2geo(e){return this.map2geo(e)}map2geo(e){const t=this.projection.unProject(e.x,e.y);return new p.Vector3(t.lon,t.lat,e.z)}world2geo(e){return this.pos2geo(this.worldToLocal(e.clone()))}getLocalInfoFromGeo(e){const t=this.geo2world(e);return Ro(this,t)}getLocalInfoFromWorld(e){return Ro(this,e)}getLocalInfoFromScreen(e,t){return Tc(e,this,t)}get downloading(){return Bn.downloadThreads}addLayer(e){return this._layers.has(e.layerId)&&console.warn(`Layer ${e.layerid} already exists, will be replaced 图层 ${e.layerid} 已存在,将被替换`),this._layers.set(e.layerId,e),this.add(e),this}removeLayer(e){const t=this._layers.get(e);return t?(this._layers.delete(e),this.remove(t),t.dispose(),!0):(console.warn(`⚠️ Layer ${e} does not exist 图层 ${e} 不存在`),!1)}getLayer(e){return this._layers.get(e)}getLayerIds(){return Array.from(this._layers.keys())}clearLayers(){return this._layers.forEach(e=>{this.remove(e),e.dispose()}),this._layers.clear(),this}getLayers(){return Array.from(this._layers.values())}getApproxZoomLevel(){let e=this.minLevel;const t=this.getLayers().find(i=>i.isBaseLayer===!0);return!t||!t._rootTile||t._rootTile.traverseVisible(i=>{i.showing&&i.inFrustum&&(e=Math.max(e,i.z))}),e}getDataZoom(){let e=this.minLevel;const t=this.getLayers().find(i=>i.isBaseLayer===!0);return!t||!t._rootTile||t._rootTile.traverseVisible(i=>{i.showing&&i.inFrustum&&(e=Math.max(e,i.z))}),e}}var Em=Object.defineProperty,$m=(r,e,t)=>e in r?Em(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qm=(r,e,t)=>$m(r,e+"",t);function jo(r){return class extends r{constructor(...t){super(...t),qm(this,"_handlers"),this._handlers=[]}addHandler(t,n){if(!n)return this;if(this._handlers||(this._handlers=[]),this[t])return this[t].enable(),this;const i=this[t]=new n(this);return this._handlers.push(i),this.options[t]&&i.enable(),this}removeHandler(t){if(!t)return this;const n=this[t];if(n&&this._handlers){const i=this._handlers.indexOf(n);i>=0&&this._handlers.splice(i,1),this[t].remove(),delete this[t]}return this}_clearHandlers(){if(this._handlers){for(let t=0,n=this._handlers.length;t<n;t++)this._handlers[t].remove();this._handlers=[]}}}}var eg=Object.defineProperty,tg=(r,e,t)=>e in r?eg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vi=(r,e,t)=>tg(r,typeof e!="symbol"?e+"":e,t);const ng={attribution:"",visible:!0,opacity:1,zIndex:0,isSceneLayer:!1,altitude:0};class fs extends jo(Kn(yi(p.Group))){constructor(e,t){super(),vi(this,"_id"),vi(this,"opacity",1),vi(this,"_animationCallbacks",new Set),vi(this,"isSceneLayer",!1),vi(this,"_altitude",0),vi(this,"depthOffset"),vi(this,"_regionOverlays",[]),Uo(e,"id","Layer ID must be specified 图层ID必须指定"),t&&(this.setOptions(t),this.opacity=t.opacity||1,this.isSceneLayer=t.isSceneLayer??!1,t.altitude!==void 0&&this.setAltitude(t.altitude)),this._id=e,typeof this.animate=="function"&&this._registerAnimate()}getId(){return this._id}addTo(e){return e.addLayer(this),this}getZIndex(){const e=this.options||{};return typeof e.zIndex=="number"?e.zIndex:0}getDepthOffset(){const e=this.options||{};return typeof e.depthOffset=="number"?e.depthOffset:0}getOpacity(){return this.opacity}setOpacity(e){this.opacity=e,this.traverse(t=>{"material"in t&&(Array.isArray(t.material)?t.material:[t.material]).forEach(i=>{"opacity"in i&&(i.transparent=e<1,i.opacity=e,i.needsUpdate=!0)}),t instanceof p.Sprite&&(t.material.opacity=e,t.material.transparent=e<1,t.material.needsUpdate=!0)})}getMap(){return this.map?this.map:null}show(){return this.visible||(this.visible=!0,this.options.visible=!0,this.getMap()),this}hide(){return this.visible&&(this.visible=!1,this.options.visible=!1,this.getMap()),this}setAltitude(e){return this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0),this}getAltitude(){return this.position.y}_bindMap(e){e&&(this.map=e,typeof this.animate=="function"&&this._registerAnimate())}_registerAnimate(){const e=this.getMap();if(!e?.viewer)return;const t=e.viewer.addAnimationCallback((n,i,o)=>{this.animate?.(n,i,o)});this._animationCallbacks.add(t)}_clearAnimationCallbacks(){this._animationCallbacks.forEach(e=>e()),this._animationCallbacks.clear()}getOptions(){return{...this.options}}setRegionOverlays(e){return this._regionOverlays=(e||[]).map(t=>({id:t.id??this._generateRegionOverlayId(),color:t.color??"#00FF88",opacity:t.opacity??.3,mode:t.mode??"overlay",zIndex:t.zIndex??0,geometry:t.geometry,feature:t.feature})),this}addRegionOverlay(e){const t=e.id??this._generateRegionOverlayId(),n={id:t,color:e.color??"#00FF88",opacity:e.opacity??.3,mode:e.mode??"overlay",zIndex:e.zIndex??0,geometry:e.geometry,feature:e.feature};return this._regionOverlays.push(n),t}removeRegionOverlay(e){return this._regionOverlays=this._regionOverlays.filter(t=>t.id!==e),this}clearRegionOverlays(){return this._regionOverlays=[],this}getRegionOverlays(){return this._regionOverlays.slice()}_generateRegionOverlayId(){return`region-overlay-${Date.now()}-${Math.random().toString(16).slice(2)}`}}fs.mergeOptions(ng);var ig=Object.defineProperty,rg=(r,e,t)=>e in r?ig(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mr=(r,e,t)=>rg(r,typeof e!="symbol"?e+"":e,t);const Gc=class lf{constructor(e){Mr(this,"_cache",new Map),Mr(this,"_gltfLoader"),Mr(this,"_fbxLoader"),Mr(this,"_dracoLoader"),this._gltfLoader=new ep(e),this._fbxLoader=new Kp(e)}static init(e){return this._instance||(this._instance=new lf(e)),this._instance}async load(e){const t=`${e.type}:${e.url}`;if(this._cache.has(t))return this._cloneCachedModel(t,e);e.type==="gltf"&&e.dracoOptions?.enable&&this._initDracoLoader(e.dracoOptions.decoderPath);let n,i;try{if(e.type==="gltf"){const o=await this._gltfLoader.loadAsync(e.url);n=o.scene,i=o.animations}else n=await this._fbxLoader.loadAsync(e.url),i=n.animations;return this._cache.set(t,{model:n,animations:i}),{model:this._processModel(n.clone(),e),animations:i?.map(o=>({...o,name:o.name||"unnamed"}))||[]}}catch(o){throw console.error(`Failed to load ${e.type} model 加载${e.type}模型失败:`,e.url,o),o}}_initDracoLoader(e="/draco/"){this._dracoLoader||(this._dracoLoader=new tm,this._dracoLoader.setDecoderPath(e),this._gltfLoader.setDRACOLoader(this._dracoLoader))}_cloneCachedModel(e,t){const n=this._cache.get(e),i=n.model.clone();return{model:this._processModel(i,t),animations:n.animations?.map(o=>({...o,name:o.name||"unnamed"}))||[]}}_processModel(e,t){return t.position&&e.position.copy(t.position),t.scale&&(typeof t.scale=="number"?e.scale.setScalar(t.scale):t.scale.x!==void 0||t.scale.y!==void 0||t.scale.z!==void 0?(t.scale.x!==void 0&&(e.scale.x=t.scale.x),t.scale.y!==void 0&&(e.scale.y=t.scale.y),t.scale.z!==void 0&&(e.scale.z=t.scale.z)):e.scale.copy(t.scale)),t.rotation&&e.rotation.set(t.rotation.x,t.rotation.y,t.rotation.z),t.materialOverrides&&e.traverse(n=>{if(n instanceof p.Mesh&&n.material){const i=t.materialOverrides[n.name];i&&(n.material=i)}}),e.traverse(n=>{n instanceof p.Mesh&&n.material}),e}clearCache(){this._cache.clear()}static clearCache(){this._instance&&this._instance.clearCache()}};Mr(Gc,"_instance");let Wc=Gc;const Jo=(r,e)=>{"updateRanges"in r?r.updateRanges[0]=e:r.updateRange=e},Zc=new p.Matrix4,ps=new p.Vector3,ms=new p.Quaternion,Vc=new p.Vector3,Ic=new p.Quaternion,Sr=new p.Vector3,sg=r=>class extends r{constructor(){super();const e=parseInt(p.REVISION.replace(/\D+/g,""))>=154?"opaque_fragment":"output_fragment";this.onBeforeCompile=t=>{t.vertexShader=`attribute float cloudOpacity;
|
|
831
|
+
`,Sm=`
|
|
832
|
+
varying vec2 vUv;
|
|
833
|
+
uniform float flashOpacity;
|
|
834
|
+
void main() {
|
|
835
|
+
gl_FragColor = vec4(1.0, 1.0, 1.0, flashOpacity);
|
|
836
|
+
}
|
|
837
|
+
`;class xc{constructor(e,t,i){Ae(this,"lines",[]),Ae(this,"flashOpacity",1),Ae(this,"_decay");const n=(this._rand(i,0)-.5)*e*1.5,o=t*.9,a=-t*.9,c=e*.1,h=[];let d=n,m=o;for(;m>a;)m-=t*(.025+this._rand(i,m*.1)*.035),d+=(this._rand(i,m*.2)-.5)*c,this._rand(i,m*.3+99)<.22&&m>a+t*.4&&h.push({x:d,y:m,seed:i+h.length*137.508});const f=this._buildPath(n,o,a,c,i);this._addGlow(f);for(const g of h){const v=g.y-t*(.12+this._rand(g.seed,77)*.2),w=this._buildPath(g.x,g.y,v,c*.4,g.seed);this._addGlow(w)}this._decay=.025+this._rand(i,55)*.02}_buildPath(e,t,i,n,o){const a=t-i,c=32,h=a/c,d=[new p.Vector3(e,t,0)];let m=e;for(let f=1;f<=c;f++){const g=f/c;m+=(this._rand(o,f*.17+5)-.5)*n;const v=1-g*.55;d.push(new p.Vector3(m*v,t-f*h,0))}return d}_rand(e,t){const i=Math.sin(e+t)*43758.5453;return i-Math.floor(i)}_addGlow(e){if(e.length<2)return;const t=[[.25,8961023],[.55,10079487],[1,16777215]];for(const[i,n]of t){const o=new p.BufferGeometry().setFromPoints(e),a=new p.Line(o,new p.LineBasicMaterial({color:n,transparent:!0,opacity:i,depthTest:!1,depthWrite:!1}));this.lines.push(a)}}isDead(){return this.flashOpacity<=0}fade(e){this.flashOpacity=Math.max(0,this.flashOpacity-this._decay*e*60);for(const t of this.lines)t.material.opacity=this.flashOpacity}dispose(){for(const e of this.lines)e.geometry.dispose(),e.material.dispose();this.lines.length=0}}class Lm{constructor(e){Ae(this,"_scene"),Ae(this,"_hw",1),Ae(this,"_hh",1),Ae(this,"_bolts",[]),Ae(this,"_flashMesh",null),Ae(this,"_flashOpacity",0),Ae(this,"_flickerLeft",0),Ae(this,"_flickerTick",0),Ae(this,"_intervalMin",5e3),Ae(this,"_intervalMax",15e3),Ae(this,"_lastTriggerTime",0),Ae(this,"_nextInterval",0),this._scene=e,this._resetNextInterval()}setTriggerInterval(e,t){this._intervalMin=e,this._intervalMax=t}getTriggerInterval(){return[this._intervalMin,this._intervalMax]}trigger(){const e=new xc(this._hw,this._hh,Math.random()*9999);for(const t of e.lines)this._scene.add(t);if(this._bolts.push(e),Math.random()<.5){const t=new xc(this._hw,this._hh,Math.random()*9999);for(const i of t.lines)this._scene.add(i);this._bolts.push(t)}if(!this._flashMesh){const t=new p.PlaneGeometry(this._hw*2,this._hh*2),i=new p.ShaderMaterial({vertexShader:hs,fragmentShader:Sm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{flashOpacity:{value:0}}});this._flashMesh=new p.Mesh(t,i),this._flashMesh.renderOrder=999,this._scene.add(this._flashMesh)}this._flashMesh.visible=!0,this._flashOpacity=1,this._flickerLeft=2+Math.floor(Math.random()*4),this._flickerTick=0,this._lastTriggerTime=Date.now(),this._resetNextInterval()}_resetNextInterval(){this._nextInterval=this._intervalMin+Math.random()*(this._intervalMax-this._intervalMin)}update(e,t){(t??Date.now())-this._lastTriggerTime>this._nextInterval&&this.trigger(),this._flickerTick++,this._flickerTick%3===0&&this._flickerLeft>0&&(this._flickerLeft--,this._flickerLeft%2===0?this._flashOpacity=.9+Math.random()*.1:this._flashOpacity*=.1),this._flashOpacity=Math.max(0,this._flashOpacity-e*3.5),this._flashMesh&&(this._flashMesh.material.uniforms.flashOpacity.value=this._flashOpacity,this._flashMesh.visible=this._flashOpacity>.005);for(let n=this._bolts.length-1;n>=0;n--)if(this._bolts[n].fade(e),this._bolts[n].isDead()){for(const o of this._bolts[n].lines)this._scene.remove(o);this._bolts[n].dispose(),this._bolts.splice(n,1)}}resize(e,t){this._hw=e,this._hh=t,this._flashMesh&&(this._flashMesh.geometry.dispose(),this._flashMesh.geometry=new p.PlaneGeometry(e*2,t*2))}dispose(){for(const e of this._bolts){for(const t of e.lines)this._scene.remove(t);e.dispose()}this._bolts=[],this._flashMesh&&(this._flashMesh.geometry.dispose(),this._flashMesh.material.dispose(),this._scene.remove(this._flashMesh),this._flashMesh=null)}}class Mc{constructor(e,t,i={}){Ae(this,"scene"),Ae(this,"camera"),Ae(this,"mesh"),Ae(this,"rainMaterial"),Ae(this,"snowMaterial"),Ae(this,"fogMaterial"),Ae(this,"lightningSystem"),Ae(this,"_type",null),Ae(this,"_activeMaterial",null),this.scene=new p.Scene,this.scene.autoClear=!1;const n=e/2,o=t/2;this.camera=new p.OrthographicCamera(-n,n,o,-o,.1,10),this.camera.position.z=5;const a=new p.PlaneGeometry(e,t);this.mesh=new p.Mesh(a),this.mesh.position.z=1,this.scene.add(this.mesh),this.rainMaterial=new p.ShaderMaterial({vertexShader:hs,fragmentShader:bm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},rainSpeed:{value:i.speed??3},rainAngle:{value:i.rainAngle??-.1},rainIntensity:{value:i.rainIntensity??1}}}),this.snowMaterial=new p.ShaderMaterial({vertexShader:hs,fragmentShader:xm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},aspectRatio:{value:e/t}}}),this.fogMaterial=new p.ShaderMaterial({vertexShader:hs,fragmentShader:Mm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},fogSpeed:{value:i.speed??1},fogOpacity:{value:i.opacity??1}}}),this.lightningSystem=new Lm(this.scene),i.type&&this.setWeather(i.type),i.speed!==void 0&&this.setSpeed(i.speed),i.opacity!==void 0&&this.setOpacity(i.opacity),i.rainIntensity!==void 0&&this.setRainIntensity(i.rainIntensity)}get type(){return this._type}setWeather(e){if(this._type=e,e===null)return this._activeMaterial=null,this.mesh.material=null,this;switch(e){case"rain":this._activeMaterial=this.rainMaterial;break;case"snow":this._activeMaterial=this.snowMaterial;break;case"fog":this._activeMaterial=this.fogMaterial;break}return this.mesh.material=this._activeMaterial,this}setSpeed(e){return this.rainMaterial.uniforms.rainSpeed&&(this.rainMaterial.uniforms.rainSpeed.value=e),this.fogMaterial.uniforms.fogSpeed&&(this.fogMaterial.uniforms.fogSpeed.value=e),this}setOpacity(e){return this.fogMaterial.uniforms.fogOpacity&&(this.fogMaterial.uniforms.fogOpacity.value=e),this}setRainAngle(e){return this.rainMaterial.uniforms.rainAngle&&(this.rainMaterial.uniforms.rainAngle.value=e),this}setRainIntensity(e){return this.rainMaterial.uniforms.rainIntensity&&(this.rainMaterial.uniforms.rainIntensity.value=e),this}triggerLightning(){this.lightningSystem.trigger()}update(e){if(this._activeMaterial){const t=this._activeMaterial.uniforms.iTime.value+e;this._activeMaterial.uniforms.iTime.value=t}this.lightningSystem.update(e,Date.now())}resize(e,t){const i=e/2,n=t/2;this.camera.left=-i,this.camera.right=i,this.camera.top=n,this.camera.bottom=-n,this.camera.updateProjectionMatrix(),this.snowMaterial.uniforms.aspectRatio&&(this.snowMaterial.uniforms.aspectRatio.value=e/t),this.mesh.geometry.dispose(),this.mesh.geometry=new p.PlaneGeometry(e,t),this.lightningSystem.resize(i,n)}dispose(){this.rainMaterial.dispose(),this.snowMaterial.dispose(),this.fogMaterial.dispose(),this.mesh.geometry.dispose(),this.lightningSystem.dispose()}}var Pm=Object.defineProperty,Cm=(r,e,t)=>e in r?Pm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ve=(r,e,t)=>Cm(r,typeof e!="symbol"?e+"":e,t);const Tm=Ki(yn(p.EventDispatcher));class Sc extends Tm{constructor(e,t={}){super(),Ve(this,"scene"),Ve(this,"renderer"),Ve(this,"camera"),Ve(this,"controls"),Ve(this,"ambLight"),Ve(this,"dirLight"),Ve(this,"auxDirLight"),Ve(this,"clouds",null),Ve(this,"container"),Ve(this,"_clock",new p.Clock),Ve(this,"stats"),Ve(this,"_animationCallbacks",new Set),Ve(this,"_fogFactor",1),Ve(this,"_sceneSize",5e4*2),Ve(this,"_weatherEffect",null),Ve(this,"gorund"),Ve(this,"map"),Ve(this,"centerPostion"),Ve(this,"_isInteracting",!1),Ve(this,"debug",!1),Ve(this,"flyTween",null),Ve(this,"composer"),Ve(this,"renderPass"),Ve(this,"bloomPass"),Ve(this,"calculateCameraPosition",(g,v,w,b)=>{const x=new p.Vector3(0,v*Math.cos(w),v*Math.sin(w));return x.applyAxisAngle(new p.Vector3(0,1,0),b),new p.Vector3(g.x+x.x,g.y+x.y,g.z+x.z)}),this.setOptions(t);const{antialias:i=!1,stencil:n=!0,logarithmicDepthBuffer:o=!0,skybox:a,map:c,bloom:h,minDistance:d,maxDistance:m,draggable:f=!0}=t;if(this.map=c,this.centerPostion=this.map.geo2world(new p.Vector3(this.map.center[0],this.map.center[1],0)),this.renderer=this._createRenderer(i,n,o),this.scene=this._createScene(a),this.camera=this._createCamera(),e&&this.addTo(e),this.controls=this._createControls(d,m),this.controls.enabled=f!==!1,this.ambLight=this._createAmbLight(),this.scene.add(this.ambLight),this.dirLight=this._createDirLight(),this.scene.add(this.dirLight),this.scene.add(this.dirLight.target),this.auxDirLight=this._createAuxDirLight(),this.gorund=this._createGorund(),this.scene.add(this.gorund),h&&h.enabled){const g=this.renderer.getPixelRatio(),v=this.container?this.width:window.innerWidth,w=this.container?this.height:window.innerHeight,b=v*g,x=w*g,L=new p.WebGLRenderTarget(b,x,{format:p.RGBAFormat});L.samples=4,this.composer=new Hf(this.renderer,L),this.renderPass=new qf(this.scene,this.camera),this.composer.addPass(this.renderPass);const M=h?.strength??1.5,C=h?.radius??1,W=h?.threshold??.7;this.bloomPass=new Bf(new p.Vector2(b,x),M,C,W),this.composer.addPass(this.bloomPass)}this.renderer.setAnimationLoop(this.animate.bind(this)),this._initWeather(),this.debug=t.debug||!1,this.flyTween=null,this.debug&&(this.stats=new ur,document.body.appendChild(this.stats.dom))}get fogFactor(){return this._fogFactor}get isInteracting(){return this._isInteracting}set fogFactor(e){this._fogFactor=e,this.controls.dispatchEvent({type:"change",target:this.controls})}get width(){return this.container?.clientWidth||0}get height(){return this.container?.clientHeight||0}addTo(e){const t=typeof e=="string"?document.querySelector(e):e;if(t instanceof HTMLElement)this.container=t,t.appendChild(this.renderer.domElement),new ResizeObserver(this.resize.bind(this)).observe(t);else throw`${e} not found!}`;return this}_createScene(e){const t=new p.Scene,i=e?.defaultColor||"rgb(21,48,94)";if(t.background=new p.Color(i),t.fog=new p.FogExp2(i,2e-4),e?.files){const n=new p.CubeTextureLoader;e.path&&n.setPath(e.path),n.load(e.files,o=>{t.background=o},void 0,o=>{console.error("Error loading skybox:",o),t.background=new p.Color(i)})}else e?.hdr&&this._loadHDRWithPMREM(t,e);return t}async _loadHDRWithPMREM(e,t){try{if(t){const n=await new tm().setPath(t.path||"").setDataType(p.FloatType).loadAsync(t.hdr);n.colorSpace=this.renderer.outputColorSpace,n.mapping=303,n.needsUpdate=!0,e.background=n,e.environment=n}}catch(i){console.error("加载HDR失败:",i),e.background=new p.Color(t?.defaultColor||14414079)}}_createRenderer(e,t,i){const n=new p.WebGLRenderer({antialias:e,logarithmicDepthBuffer:i,stencil:t,alpha:!0,precision:"highp",powerPreference:"high-performance",failIfMajorPerformanceCaveat:!0});return n.debug.checkShaderErrors=!0,n.sortObjects=!0,n.setPixelRatio(window.devicePixelRatio),n.domElement.tabIndex=0,n.shadowMap.enabled=!0,n.shadowMap.needsUpdate=!0,n.shadowMap.type=p.PCFSoftShadowMap,n.toneMapping=p.ACESFilmicToneMapping,n.toneMappingExposure=1,n.outputColorSpace=p.SRGBColorSpace,n.autoClear=!1,n}_createCamera(){return new p.PerspectiveCamera(45,this.getAspect(),.1,this._sceneSize*2)}_createControls(e,t){const i=new Of(this.camera,this.renderer.domElement),n=Math.PI/2.1;return i.screenSpacePanning=!1,i.minDistance=e??.1,i.maxDistance=t??6e4,i.maxPolarAngle=n,i.enableDamping=!0,i.dampingFactor=.08,i.keyPanSpeed=1,i.listenToKeyEvents(this.renderer.domElement),i.addEventListener("change",()=>{const o=Math.max(i.getPolarAngle(),.1),a=Math.max(i.getDistance(),100);i.zoomSpeed=Math.max(Math.log(a/1e3),1)+3;const c=3e5*2;i.maxDistance>c*.95&&(i.maxDistance=c*.95),this.camera.far=p.MathUtils.clamp(a/o*8,100,c),this.camera.near=p.MathUtils.clamp(this.camera.far/1e3,.001,1),this.camera.updateProjectionMatrix(),this.scene.fog instanceof p.FogExp2&&(this.scene.fog.density=o/(a+5)*this.fogFactor*.1);const d=a>6e4;i.minAzimuthAngle=d?0:-1/0,i.maxAzimuthAngle=d?0:1/0,i.maxPolarAngle=cm(i.getDistance(),0,7e4,n,0),this.map?.trigger("control-change",{type:"control-change",control:i,camera:this.camera,target:this.map})}),i.addEventListener("start",()=>{this._isInteracting=!0,this.map?.trigger("control-start",{type:"control-start",control:i,camera:this.camera,target:this.map})}),i.addEventListener("end",()=>{this._isInteracting=!1,this.map?.trigger("control-end",{type:"control-end",control:i,camera:this.camera,target:this.map})}),i}_createAmbLight(){return new p.AmbientLight(16777215,.1)}_createDirLight(){const f=new p.DirectionalLight("rgb(255, 255, 255)",3);f.position.set(this.centerPostion.x+55e3*1.2,55e3*2,this.centerPostion.z+55e3*1);const g=new p.Object3D;if(g.position.copy(this.centerPostion),this.scene.add(g),f.target=g,f.castShadow=!0,f.shadow.mapSize.width=1024*10,f.shadow.mapSize.height=1024*10,f.shadow.camera.near=1,f.shadow.camera.far=192500,f.shadow.camera.left=-55e3,f.shadow.camera.bottom=-55e3,f.shadow.camera.top=55e3,f.shadow.camera.right=55e3,f.shadow.radius=1,f.shadow.bias=-0,this.debug){const v=new p.CameraHelper(f.shadow.camera);v.name="dirLightCameraHelper",this.scene.add(v)}return f}_createAuxDirLight(){const a=this._createAuxLightInstance(this.centerPostion.x+-66e3,82500,this.centerPostion.z+-55e3,.5);a.name="AuxDirLight_BackFill",this.scene.add(a),this.scene.add(a.target);const m=this._createAuxLightInstance(this.centerPostion.x+55e3*-1,55e3*1.5,this.centerPostion.z+55e3*1.2,.5);m.name="AuxDirLight_LeftRim",this.scene.add(m),this.scene.add(m.target);const w=this._createAuxLightInstance(this.centerPostion.x+55e3*1,55e3*1.5,this.centerPostion.z+55e3*-1.2,.5);return w.name="AuxDirLight_RightRim",this.scene.add(w),this.scene.add(w.target),a}_createAuxLightInstance(e,t,i,n){const o=new p.DirectionalLight(16777215,n);o.position.set(e,t,i);const a=new p.Object3D;return a.position.copy(this.centerPostion),this.scene.add(a),o.target=a,o.castShadow=!1,o}resize(){const e=this.width,t=this.height;if(this.renderer.setSize(e,t),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this._weatherEffect&&this._weatherEffect.resize(e,t),this.composer){const i=this.renderer.getPixelRatio();this.composer.setSize(e*i,t*i),this.composer.render()}else this.renderer.render(this.scene,this.camera);return this}addAnimationCallback(e){return this._animationCallbacks.add(e),()=>this._animationCallbacks.delete(e)}animate(){const e=this._clock.getDelta(),t=this._clock.getElapsedTime();this._animationCallbacks.forEach(i=>i(e,t,this)),this.controls.update(),this.renderer.clear(),this.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this._weatherEffect?.type&&(this._weatherEffect.update(e),this.renderer.render(this._weatherEffect.scene,this._weatherEffect.camera)),lm(),this.stats&&this.stats.update(),this.dispatchEvent({type:"update",delta:e})}flyTo(e,t,i=!0,n){if(this.controls.target.copy(e),i){const o=this.camera.position;new as(o).to({y:2e7,z:0},500).chain(new as(o).to(t,2e3).easing(Ui.Quintic.Out).onComplete(a=>n&&n(a))).start()}else this.camera.position.copy(t)}flyToAdvanced(e){const t=this.camera,i=this.controls,n=e.center,o=e.cameraCoord,a=e.duration??2e3,c=e.delay??0,h=e.complete,d=!!e.curvePath;if(!n||!o)return;const m=this.map.geo2world(new p.Vector3(n[0],n[1],0)),f=this.map.geo2world(new p.Vector3(o[0],o[1],o[2]));if(!t||!i||!m||!f)return;const g=i.target.clone(),v=t.position.clone(),w=new p.Vector3(m.x,m.y,m.z),b=new p.Vector3(f.x,f.y,f.z);if(this.flyTween&&(this.flyTween.stop(),this.flyTween=null),d){const x=[v,v.clone().lerp(b,.33),v.clone().lerp(b,.67),b],L=new p.CubicBezierCurve3(...x),M={t:0,x:g.x,y:g.y,z:g.z};this.flyTween=new as(M).to({t:1,x:w.x,y:w.y,z:w.z},a).easing(Ui.Quadratic.InOut).onUpdate(()=>{const C=L.getPoint(M.t),W=new p.Vector3(M.x,M.y,M.z);t.position.copy(C),t.lookAt(W),t.updateProjectionMatrix(),i.target.copy(W),i.update()})}else{const x={tx:g.x,ty:g.y,tz:g.z,px:v.x,py:v.y,pz:v.z};this.flyTween=new as(x).to({tx:w.x,ty:w.y,tz:w.z,px:b.x,py:b.y,pz:b.z},a).easing(Ui.Quadratic.InOut).onUpdate(()=>{const L=new p.Vector3(x.tx,x.ty,x.tz),M=new p.Vector3(x.px,x.py,x.pz);t.position.copy(M),t.lookAt(L),i.target.copy(L),i.update()})}this.flyTween&&(this.flyTween.onComplete(()=>{this.flyTween&&(this.flyTween.stop(),this.flyTween=null),h&&h()}),c>0?setTimeout(()=>{this.flyTween&&this.flyTween.start()},c):this.flyTween.start())}onConfig(e){if("draggable"in e){const t=e.draggable;this.controls&&(this.controls.enabled=t!==!1)}}flyToPoint(e){const{controls:t}=this,i=e.center,n=e.duration??2e3,o=typeof e.distance=="number"?e.distance:typeof e.altitude=="number"?e.altitude:t.getDistance(),a=w=>w*Math.PI/180;let c;if(typeof e.polarDeg=="number"){const w=e.polarDeg<=0?.1:e.polarDeg;c=a(w)}else typeof e.polarAngle=="number"?c=e.polarAngle<=0?a(.1):e.polarAngle:c=t.getPolarAngle();const h=typeof e.azimuthDeg=="number"?a(e.azimuthDeg):e.azimuthAngle||t.getAzimuthalAngle(),d=e.complete,m=!!e.curvePath,f=this.map.geo2world(new p.Vector3(i[0],i[1],0)),g=this.calculateCameraPosition(f,o,c,h),v=this.map.world2geo(g);this.flyToAdvanced({center:[i[0],i[1],0],cameraCoord:[v.x,v.y,v.z||0],duration:n,complete:d,curvePath:m})}getState(){return{centerPosition:this.controls.target,cameraPosition:this.camera.position}}_bindMap(e){e&&(this.map=e)}getMap(){return this.map?this.map:null}getAspect(){const[e,t]=this.getWidthHeight();return e/t}getWidthHeight(){let e=window.innerWidth,t=window.innerHeight;return[e,t]}_createGorund(){const e=this.centerPostion,t=new p.MeshStandardMaterial({transparent:!1,color:new p.Color("rgb(45,52,60)").multiplyScalar(.7),metalness:.2,roughness:1}),i=new p.PlaneGeometry(this._sceneSize*2,this._sceneSize*2),n=new p.Mesh(i,t);return n.name="地面",n.castShadow=!1,n.receiveShadow=!1,n.position.y=0,n.position.add(e),n.rotateX(-Math.PI/2),n.visible=!1,n}_initWeather(){const e=this.width,t=this.height;this._weatherEffect=new Mc(e,t);const i=this.options;if(i.weather){const n=i.weather;n.type&&this._weatherEffect.setWeather(n.type),n.speed!==void 0&&this._weatherEffect.setSpeed(n.speed),n.opacity!==void 0&&this._weatherEffect.setOpacity(n.opacity),n.rainAngle!==void 0&&this._weatherEffect.setRainAngle(n.rainAngle),n.rainIntensity!==void 0&&this._weatherEffect.setRainIntensity(n.rainIntensity)}}setWeather(e,t={}){return this._weatherEffect?(this._weatherEffect.setWeather(e),t.speed!==void 0&&this._weatherEffect.setSpeed(t.speed),t.opacity!==void 0&&this._weatherEffect.setOpacity(t.opacity),t.rainAngle!==void 0&&this._weatherEffect.setRainAngle(t.rainAngle),t.rainIntensity!==void 0&&this._weatherEffect.setRainIntensity(t.rainIntensity),this):this}getWeatherEffect(){return this._weatherEffect}setWeatherSpeed(e){return this._weatherEffect?.setSpeed(e),this}setWeatherOpacity(e){return this._weatherEffect?.setOpacity(e),this}setWeatherRainAngle(e){return this._weatherEffect?.setRainAngle(e),this}setWeatherRainIntensity(e){return this._weatherEffect?.setRainIntensity(e),this}destroy(){try{this.renderer.setAnimationLoop(null),this._animationCallbacks.clear(),this._weatherEffect&&(this._weatherEffect.dispose(),this._weatherEffect=null),this.map=null,this.controls&&this.controls.dispose(),this.scene&&(this.scene.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>{this._disposeMaterial(t)}):this._disposeMaterial(e.material))}),this.scene.clear()),this.composer&&(this.bloomPass&&this.bloomPass.dispose?.(),this.renderPass&&this.renderPass.dispose?.(),this.composer=null,this.renderPass=null,this.bloomPass=null),this.renderer&&(this.renderer.dispose(),this.container&&this.renderer.domElement.parentNode===this.container&&this.container.removeChild(this.renderer.domElement)),this.stats&&this.stats.dom.parentNode&&this.stats.dom.parentNode.removeChild(this.stats.dom)}catch(e){console.error("❌ 销毁Viewer时出错:",e)}}_disposeMaterial(e){if(!e)return;["map","lightMap","bumpMap","normalMap","specularMap","envMap","alphaMap","aoMap","displacementMap","emissiveMap","gradientMap","metalnessMap","roughnessMap"].forEach(i=>{e[i]&&e[i].dispose()}),e.dispose()}}var br=(r=>(r[r.none=0]="none",r[r.create=1]="create",r[r.remove=2]="remove",r))(br||{});function Gm(r,e){const t=r.position.clone().setZ(r.maxZ).applyMatrix4(r.matrixWorld);return e.distanceTo(t)}function Wm(r){const e=r.scale,t=new p.Vector3(-e.x,-e.y,0).applyMatrix4(r.matrixWorld),i=new p.Vector3(e.x,e.y,0).applyMatrix4(r.matrixWorld);return t.sub(i).length()}function Zm(r){return r.distToCamera/r.sizeInWorld*.8}function Vm(r,e,t,i){const n=Zm(r);if(r.isLeaf){if(r.inFrustum&&r.z<t&&(r.z<e||r.showing)&&(r.z<e||n<i))return 1}else if(r.z>=e&&(r.z>t||n>i))return 2;return 0}function Im(r,e,t,i){const n=[],o=i+1,a=e*2,c=0,h=.25;{const d=t*2,m=new p.Vector3(.5,.5,1),f=new Ni(a,d,o),g=new Ni(a+1,d,o),v=new Ni(a,d+1,o),w=new Ni(a+1,d+1,o);f.position.set(-h,h,c),f.scale.copy(m),g.position.set(h,h,c),g.scale.copy(m),v.position.set(-h,-h,c),v.scale.copy(m),w.position.set(h,-h,c),w.scale.copy(m),n.push(f,g,v,w)}return n}var Am=Object.defineProperty,Fm=(r,e,t)=>e in r?Am(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tt=(r,e,t)=>Fm(r,typeof e!="symbol"?e+"":e,t);const Om=10,Dm=new p.InstancedBufferGeometry,zm=new p.Vector3,Xm=new p.Matrix4,Um=new p.Box3(new p.Vector3(-.5,-.5,0),new p.Vector3(.5,.5,1)),Lc=new p.Frustum,Pc=class $r extends p.Mesh{constructor(e=0,t=0,i=0){super(Dm,[]),tt(this,"_dataOnlyMode",!1),tt(this,"vectorData",null),tt(this,"x"),tt(this,"y"),tt(this,"z"),tt(this,"isTile",!0),tt(this,"parent",null),tt(this,"children",[]),tt(this,"_ready",!1),tt(this,"_isDummy",!1),tt(this,"_showing",!1),tt(this,"_maxZ",0),tt(this,"distToCamera",0),tt(this,"sizeInWorld",0),tt(this,"_loaded",!1),tt(this,"_inFrustum",!1),this.x=e,this.y=t,this.z=i,this.name=`Tile ${i}-${e}-${t}`,this.up.set(0,0,1),this.matrixAutoUpdate=!1}setDataOnlyMode(e){return this._dataOnlyMode=e,e&&(this.visible=!1),this}isDataOnlyMode(){return this._dataOnlyMode}getVectorData(){return this.vectorData}static get downloadThreads(){return $r._downloadThreads}get isDummy(){return this._isDummy}get showing(){return this._showing}set showing(e){const t=this._showing;this._showing=e,this.material.forEach(i=>i.visible=e),t===!1&&this._showing===!0&&this._loaded&&this.dispatchEvent({type:"tile-shown",tile:this}),t===!0&&this._showing===!1&&this.dispatchEvent({type:"tile-hidden",tile:this})}get maxZ(){return this._maxZ}set maxZ(e){this._maxZ=e}get index(){return this.parent?this.parent.children.indexOf(this):-1}get loaded(){return this._loaded}get inFrustum(){return this._inFrustum}set inFrustum(e){this._inFrustum=e}get isLeaf(){return this.children.filter(e=>e.isTile).length===0}traverse(e){e(this),this.children.forEach(t=>{t.isTile&&t.traverse(e)})}traverseVisible(e){this.visible&&(e(this),this.children.forEach(t=>{t.isTile&&t.traverseVisible(e)}))}raycast(e,t){this.showing&&this.loaded&&this.isTile&&super.raycast(e,t)}LOD(e){if($r.downloadThreads>Om)return{action:br.none};let t=[];const{loader:i,minLevel:n,maxLevel:o,LODThreshold:a}=e,c=Vm(this,n,o,a);return c===br.create&&(t=Im(i,this.x,this.y,this.z),this.add(...t)),{action:c,newTiles:t}}_checkVisible(){const e=this.parent;if(e&&e.isTile){const t=e.children.filter(n=>n.isTile),i=t.every(n=>n.loaded);e.showing=!i,t.forEach(n=>n.showing=i)}return this}async _load(e){$r._downloadThreads++;const{x:t,y:i,z:n}=this;if(this._dataOnlyMode)try{const o=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.vectorData=o.geometry?.userData||{},this._loaded=!0,this.dispatchEvent({type:"vector-data-loaded",data:this.vectorData,tile:this})}catch(o){console.error(`数据模式加载失败 ${n}/${t}/${i}:`,o),this._loaded=!1}else{const o=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.material=o.materials,this.geometry=o.geometry,this.maxZ=this.geometry.boundingBox?.max.z||0,this._loaded=!0}return $r._downloadThreads--,this}_init(){this.updateMatrix(),this.updateMatrixWorld(),this.sizeInWorld=Wm(this)}update(e){if(console.assert(this.z===0),!this.parent)return this;Lc.setFromProjectionMatrix(Xm.multiplyMatrices(e.camera.projectionMatrix,e.camera.matrixWorldInverse));const t=e.camera.getWorldPosition(zm);return this.traverse(i=>{i.receiveShadow=this.receiveShadow,i.castShadow=this.castShadow;const n=Um.clone().applyMatrix4(i.matrixWorld);n.max.setY(9e3),i.inFrustum=Lc.intersectsBox(n),i.distToCamera=Gm(i,t);const{action:o,newTiles:a}=i.LOD(e);this._doAction(i,o,a,e)}),this._checkReady(),this}_doAction(e,t,i,n){return t===br.create?i?.forEach(o=>{o._init(),o._isDummy=o.z<n.minLevel,this.dispatchEvent({type:"tile-created",tile:o}),o.isDummy||o._load(n.loader).then(()=>{o._checkVisible(),this.dispatchEvent({type:"tile-loaded",tile:o})})}):t===br.remove&&(e.showing=!0,e._unLoad(!1,n.loader),this.dispatchEvent({type:"tile-unload",tile:e})),this}reload(e){return this._unLoad(!0,e),this}_checkReady(){return this._ready||(this._ready=!0,this.traverse(e=>{if(e.isLeaf&&e.loaded&&!e.isDummy){this._ready=!1;return}}),this._ready&&this.dispatchEvent({type:"ready"})),this}_unLoad(e,t){return e&&this.isTile&&!this.isDummy&&(this.dispatchEvent({type:"unload"}),t?.unload?.(this)),this.children.forEach(i=>i._unLoad(!0,t)),this.clear(),this}};tt(Pc,"_downloadThreads",0);let Ni=Pc;var km=Object.defineProperty,Km=(r,e,t)=>e in r?km(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nm=(r,e,t)=>Km(r,e+"",t);class Cc{constructor(e=0){Nm(this,"_lon0",0),this._lon0=e}get lon0(){return this._lon0}getTileXWithCenterLon(e,t){const i=Math.pow(2,t);let n=e+Math.round(i/360*this._lon0);return n>=i?n-=i:n<0&&(n+=i),n}getTileXYZproj(e,t,i){const n=this.mapWidth,o=this.mapHeight/2,a=e/Math.pow(2,i)*n-n/2,c=o-t/Math.pow(2,i)*o*2;return{x:a,y:c}}getProjBoundsFromLonLat(e){const t=e[0]===-180&&e[2]===180,i=this.project(e[0]+(t?this._lon0:0),e[1]),n=this.project(e[2]+(t?this._lon0:0),e[3]);return[Math.min(i.x,n.x),Math.min(i.y,n.y),Math.max(i.x,n.x),Math.max(i.y,n.y)]}getProjBoundsFromXYZ(e,t,i){const n=this.getTileXYZproj(e,t,i),o=this.getTileXYZproj(e+1,t+1,i);return[Math.min(n.x,o.x),Math.min(n.y,o.y),Math.max(n.x,o.x),Math.max(n.y,o.y)]}getLonLatBoundsFromXYZ(e,t,i){const n=this.getProjBoundsFromXYZ(e,t,i),o=this.unProject(n[0],n[1]),a=this.unProject(n[2],n[3]);return[o.lon,o.lat,a.lon,a.lat]}}var Bm=Object.defineProperty,Ym=(r,e,t)=>e in r?Bm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,us=(r,e,t)=>Ym(r,typeof e!="symbol"?e+"":e,t);const xr=6378e3;class Tc extends Cc{constructor(){super(...arguments),us(this,"ID","3857"),us(this,"mapWidth",2*Math.PI*xr),us(this,"mapHeight",this.mapWidth),us(this,"mapDepth",1)}project(e,t){const i=(e-this.lon0)*(Math.PI/180),n=t*(Math.PI/180),o=xr*i,a=xr*Math.log(Math.tan(Math.PI/4+n/2));return{x:o,y:a}}unProject(e,t){let i=e/xr*(180/Math.PI)+this.lon0;return i>180&&(i-=360),{lat:(2*Math.atan(Math.exp(t/xr))-Math.PI/2)*(180/Math.PI),lon:i}}}var Rm=Object.defineProperty,jm=(r,e,t)=>e in r?Rm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ds=(r,e,t)=>jm(r,typeof e!="symbol"?e+"":e,t);class Jm extends Cc{constructor(){super(...arguments),ds(this,"ID","4326"),ds(this,"mapWidth",36e3),ds(this,"mapHeight",18e3),ds(this,"mapDepth",1)}project(e,t){return{x:(e-this.lon0)*100,y:t*100}}unProject(e,t){return{lon:e/100+this.lon0,lat:t/100}}}const Qm={createFromID:(r="3857",e)=>{let t;switch(r){case"3857":t=new Tc(e);break;case"4326":t=new Jm(e);break;default:throw new Error(`Projection ID: ${r} is not supported.`)}return t}};function Yo(r,e){const t=r.getLayers().find(n=>n.isBaseLayer===!0)?._rootTile,i=e.intersectObjects([t]);for(const n of i)if(n.object instanceof Ni){const o=r.worldToLocal(n.point.clone()),a=r.map2geo(o);return Object.assign(n,{location:a})}}function Ro(r,e){const t=new p.Vector3(0,-1,0),i=new p.Vector3(e.x,10*1e3,e.z),n=new p.Raycaster(i,t);return Yo(r,n)}function Gc(r,e,t){const i=new p.Raycaster;return i.setFromCamera(t,r),Yo(e,i)}function Hm(r,e=128){const t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("Failed to get canvas context");t.width=e,t.height=e;const n=e/2,o=e/2;return i.imageSmoothingEnabled=!1,i.fillStyle="#000022",i.strokeStyle="DarkGoldenrod",i.lineWidth=5,i.moveTo(n,3),i.lineTo(n,e),i.stroke(),i.closePath(),i.lineWidth=2,i.beginPath(),i.roundRect(2,2,e-4,o-8,10),i.closePath(),i.fill(),i.stroke(),i.font="24px Arial",i.fillStyle="Goldenrod",i.strokeStyle="black",i.textAlign="center",i.textBaseline="top",i.strokeText(r,n,20),i.fillText(r,n,20),t}function Em(r,e=128){const t=new p.CanvasTexture(Hm(r,e)),i=new p.SpriteMaterial({map:t,sizeAttenuation:!1}),n=new p.Sprite(i);return n.visible=!1,n.center.set(.5,.3),n.scale.setScalar(.11),n.renderOrder=999,n}var $m=Object.defineProperty,qm=(r,e,t)=>e in r?$m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gi=(r,e,t)=>qm(r,typeof e!="symbol"?e+"":e,t);class fs extends p.Mesh{constructor(e){super(),gi(this,"name","map"),gi(this,"_clock",new p.Clock),gi(this,"isLOD",!0),gi(this,"autoUpdate",!0),gi(this,"updateInterval",100),gi(this,"_minLevel",2),gi(this,"_layers",new Map),gi(this,"_maxLevel",24),gi(this,"_projection",new Tc(0)),gi(this,"_LODThreshold",1),this.up.set(0,0,1);const{minLevel:t=2,maxLevel:i=19}=e;this.minLevel=t,this.maxLevel=i}get minLevel(){return this._minLevel}set minLevel(e){this._minLevel=e}get maxLevel(){return this._maxLevel}set maxLevel(e){this._maxLevel=e}get lon0(){return this.projection.lon0}get projection(){return this._projection}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}static create(e){return new fs(e)}update(e){if(!this.autoUpdate)return;const t=this._clock.getElapsedTime();t>this.updateInterval/1e3&&(this._layers.forEach(i=>{i.enabled&&i.visible&&i.update(e)}),this._clock.start(),this.dispatchEvent({type:"update",delta:t}))}dispose(){this.removeFromParent()}geo2pos(e){return this.geo2map(e)}geo2map(e){const t=this.projection.project(e.x,e.y);return new p.Vector3(t.x,t.y,e.z)}geo2world(e){return this.localToWorld(this.geo2map(e))}pos2geo(e){return this.map2geo(e)}map2geo(e){const t=this.projection.unProject(e.x,e.y);return new p.Vector3(t.lon,t.lat,e.z)}world2geo(e){return this.pos2geo(this.worldToLocal(e.clone()))}getLocalInfoFromGeo(e){const t=this.geo2world(e);return Ro(this,t)}getLocalInfoFromWorld(e){return Ro(this,e)}getLocalInfoFromScreen(e,t){return Gc(e,this,t)}get downloading(){return Ni.downloadThreads}addLayer(e){return this._layers.has(e.layerId)&&console.warn(`Layer ${e.layerid} already exists, will be replaced 图层 ${e.layerid} 已存在,将被替换`),this._layers.set(e.layerId,e),this.add(e),this}removeLayer(e){const t=this._layers.get(e);return t?(this._layers.delete(e),this.remove(t),t.dispose(),!0):(console.warn(`⚠️ Layer ${e} does not exist 图层 ${e} 不存在`),!1)}getLayer(e){return this._layers.get(e)}getLayerIds(){return Array.from(this._layers.keys())}clearLayers(){return this._layers.forEach(e=>{this.remove(e),e.dispose()}),this._layers.clear(),this}getLayers(){return Array.from(this._layers.values())}getApproxZoomLevel(){let e=this.minLevel;const t=this.getLayers().find(n=>n.isBaseLayer===!0);return!t||!t._rootTile||t._rootTile.traverseVisible(n=>{n.showing&&n.inFrustum&&(e=Math.max(e,n.z))}),e}getDataZoom(){let e=this.minLevel;const t=this.getLayers().find(n=>n.isBaseLayer===!0);return!t||!t._rootTile||t._rootTile.traverseVisible(n=>{n.showing&&n.inFrustum&&(e=Math.max(e,n.z))}),e}}var eg=Object.defineProperty,tg=(r,e,t)=>e in r?eg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ig=(r,e,t)=>tg(r,e+"",t);function jo(r){return class extends r{constructor(...t){super(...t),ig(this,"_handlers"),this._handlers=[]}addHandler(t,i){if(!i)return this;if(this._handlers||(this._handlers=[]),this[t])return this[t].enable(),this;const n=this[t]=new i(this);return this._handlers.push(n),this.options[t]&&n.enable(),this}removeHandler(t){if(!t)return this;const i=this[t];if(i&&this._handlers){const n=this._handlers.indexOf(i);n>=0&&this._handlers.splice(n,1),this[t].remove(),delete this[t]}return this}_clearHandlers(){if(this._handlers){for(let t=0,i=this._handlers.length;t<i;t++)this._handlers[t].remove();this._handlers=[]}}}}var ng=Object.defineProperty,rg=(r,e,t)=>e in r?ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vn=(r,e,t)=>rg(r,typeof e!="symbol"?e+"":e,t);const sg={attribution:"",visible:!0,opacity:1,zIndex:0,isSceneLayer:!1,altitude:0};class ps extends jo(Ki(yn(p.Group))){constructor(e,t){super(),vn(this,"_id"),vn(this,"opacity",1),vn(this,"_animationCallbacks",new Set),vn(this,"isSceneLayer",!1),vn(this,"_altitude",0),vn(this,"depthOffset"),vn(this,"_regionOverlays",[]),ko(e,"id","Layer ID must be specified 图层ID必须指定"),t&&(this.setOptions(t),this.opacity=t.opacity||1,this.isSceneLayer=t.isSceneLayer??!1,t.altitude!==void 0&&this.setAltitude(t.altitude)),this._id=e,typeof this.animate=="function"&&this._registerAnimate()}getId(){return this._id}addTo(e){return e.addLayer(this),this}getZIndex(){const e=this.options||{};return typeof e.zIndex=="number"?e.zIndex:0}getDepthOffset(){const e=this.options||{};return typeof e.depthOffset=="number"?e.depthOffset:0}getOpacity(){return this.opacity}setOpacity(e){this.opacity=e,this.traverse(t=>{"material"in t&&(Array.isArray(t.material)?t.material:[t.material]).forEach(n=>{"opacity"in n&&(n.transparent=e<1,n.opacity=e,n.needsUpdate=!0)}),t instanceof p.Sprite&&(t.material.opacity=e,t.material.transparent=e<1,t.material.needsUpdate=!0)})}getMap(){return this.map?this.map:null}show(){return this.visible||(this.visible=!0,this.options.visible=!0,this.getMap()),this}hide(){return this.visible&&(this.visible=!1,this.options.visible=!1,this.getMap()),this}setAltitude(e){return this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0),this}getAltitude(){return this.position.y}_bindMap(e){e&&(this.map=e,typeof this.animate=="function"&&this._registerAnimate())}_registerAnimate(){const e=this.getMap();if(!e?.viewer)return;const t=e.viewer.addAnimationCallback((i,n,o)=>{this.animate?.(i,n,o)});this._animationCallbacks.add(t)}_clearAnimationCallbacks(){this._animationCallbacks.forEach(e=>e()),this._animationCallbacks.clear()}getOptions(){return{...this.options}}setRegionOverlays(e){return this._regionOverlays=(e||[]).map(t=>({id:t.id??this._generateRegionOverlayId(),color:t.color??"#00FF88",opacity:t.opacity??.3,mode:t.mode??"overlay",zIndex:t.zIndex??0,geometry:t.geometry,feature:t.feature})),this}addRegionOverlay(e){const t=e.id??this._generateRegionOverlayId(),i={id:t,color:e.color??"#00FF88",opacity:e.opacity??.3,mode:e.mode??"overlay",zIndex:e.zIndex??0,geometry:e.geometry,feature:e.feature};return this._regionOverlays.push(i),t}removeRegionOverlay(e){return this._regionOverlays=this._regionOverlays.filter(t=>t.id!==e),this}clearRegionOverlays(){return this._regionOverlays=[],this}getRegionOverlays(){return this._regionOverlays.slice()}_generateRegionOverlayId(){return`region-overlay-${Date.now()}-${Math.random().toString(16).slice(2)}`}}ps.mergeOptions(sg);var og=Object.defineProperty,ag=(r,e,t)=>e in r?og(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mr=(r,e,t)=>ag(r,typeof e!="symbol"?e+"":e,t);const Wc=class cf{constructor(e){Mr(this,"_cache",new Map),Mr(this,"_gltfLoader"),Mr(this,"_fbxLoader"),Mr(this,"_dracoLoader"),this._gltfLoader=new tp(e),this._fbxLoader=new Np(e)}static init(e){return this._instance||(this._instance=new cf(e)),this._instance}async load(e){const t=`${e.type}:${e.url}`;if(this._cache.has(t))return this._cloneCachedModel(t,e);e.type==="gltf"&&e.dracoOptions?.enable&&this._initDracoLoader(e.dracoOptions.decoderPath);let i,n;try{if(e.type==="gltf"){const o=await this._gltfLoader.loadAsync(e.url);i=o.scene,n=o.animations}else i=await this._fbxLoader.loadAsync(e.url),n=i.animations;return this._cache.set(t,{model:i,animations:n}),{model:this._processModel(i.clone(),e),animations:n?.map(o=>({...o,name:o.name||"unnamed"}))||[]}}catch(o){throw console.error(`Failed to load ${e.type} model 加载${e.type}模型失败:`,e.url,o),o}}_initDracoLoader(e="/draco/"){this._dracoLoader||(this._dracoLoader=new im,this._dracoLoader.setDecoderPath(e),this._gltfLoader.setDRACOLoader(this._dracoLoader))}_cloneCachedModel(e,t){const i=this._cache.get(e),n=i.model.clone();return{model:this._processModel(n,t),animations:i.animations?.map(o=>({...o,name:o.name||"unnamed"}))||[]}}_processModel(e,t){return t.position&&e.position.copy(t.position),t.scale&&(typeof t.scale=="number"?e.scale.setScalar(t.scale):t.scale.x!==void 0||t.scale.y!==void 0||t.scale.z!==void 0?(t.scale.x!==void 0&&(e.scale.x=t.scale.x),t.scale.y!==void 0&&(e.scale.y=t.scale.y),t.scale.z!==void 0&&(e.scale.z=t.scale.z)):e.scale.copy(t.scale)),t.rotation&&e.rotation.set(t.rotation.x,t.rotation.y,t.rotation.z),t.materialOverrides&&e.traverse(i=>{if(i instanceof p.Mesh&&i.material){const n=t.materialOverrides[i.name];n&&(i.material=n)}}),e.traverse(i=>{i instanceof p.Mesh&&i.material}),e}clearCache(){this._cache.clear()}static clearCache(){this._instance&&this._instance.clearCache()}};Mr(Wc,"_instance");let Zc=Wc;const Jo=(r,e)=>{"updateRanges"in r?r.updateRanges[0]=e:r.updateRange=e},Vc=new p.Matrix4,ms=new p.Vector3,gs=new p.Quaternion,Ic=new p.Vector3,Ac=new p.Quaternion,Sr=new p.Vector3,lg=r=>class extends r{constructor(){super();const e=parseInt(p.REVISION.replace(/\D+/g,""))>=154?"opaque_fragment":"output_fragment";this.onBeforeCompile=t=>{t.vertexShader=`attribute float cloudOpacity;
|
|
817
838
|
varying float vOpacity;
|
|
818
839
|
`+t.vertexShader.replace("#include <fog_vertex>",`#include <fog_vertex>
|
|
819
840
|
vOpacity = cloudOpacity;
|
|
820
841
|
`),t.fragmentShader=`varying float vOpacity;
|
|
821
842
|
`+t.fragmentShader.replace(`#include <${e}>`,`#include <${e}>
|
|
822
843
|
gl_FragColor = vec4(outgoingLight, diffuseColor.a * vOpacity);
|
|
823
|
-
`)}}};class
|
|
844
|
+
`)}}};class cg extends p.Group{constructor({limit:e=200,range:t,material:i=p.MeshLambertMaterial,texture:n,frustumCulled:o=!0}={}){super(),this.name="Clouds",this.ref=this;const a=this,c=new p.PlaneGeometry(1,1),h=new Float32Array(Array.from({length:e},()=>1)),d=new Float32Array(Array.from({length:e},()=>[1,1,1]).flat()),m=new p.InstancedBufferAttribute(h,1);m.setUsage(p.DynamicDrawUsage),c.setAttribute("cloudOpacity",m);const f=lg(i),g=new f;g.map=n,g.transparent=!0,g.depthWrite=!1,g.needsUpdate=!0,this.cloudMaterial=g,this.instance=new p.InstancedMesh(c,g,e);const v=this.instance;v.matrixAutoUpdate=!1,v.frustumCulled=o,v.instanceColor=new p.InstancedBufferAttribute(d,3),v.instanceColor.setUsage(p.DynamicDrawUsage),a.add(v);const w=[],b=()=>{const X=w.length;let I=0;for(let K=0;K<this.ref.children.length;K++){const V=this.ref.children[K];V.cloudStateArray&&(I+=V.cloudStateArray.length)}if(X===I)return w;w.length=0;for(let K=0;K<this.ref.children.length;K++){const V=this.ref.children[K];V.cloudStateArray&&w.push(...V.cloudStateArray)}return x(),w},x=()=>{const X=Math.min(e,t!==void 0?t:e,w.length);v.count=X,Jo(v.instanceMatrix,{offset:0,count:X*16}),v.instanceColor&&Jo(v.instanceColor,{offset:0,count:X*3}),Jo(v.geometry.attributes.cloudOpacity,{offset:0,count:X})};let L=0,M=0,C;const W=new p.Quaternion,z=new p.Vector3(0,0,1),D=new p.Vector3;this.update=(X,I,K)=>{L=I,Vc.copy(v.matrixWorld).invert(),X.matrixWorld.decompose(Ic,Ac,Sr);const V=b();for(M=0;M<V.length;M++)C=V[M],C.ref.matrixWorld.decompose(ms,gs,Sr),ms.add(D.copy(C.position).applyQuaternion(gs).multiply(Sr)),gs.copy(Ac).multiply(W.setFromAxisAngle(z,C.rotation+=K*C.rotationFactor)),Sr.multiplyScalar(C.volume+(1+Math.sin(L*C.density*C.speed))/2*C.growth),C.matrix.compose(ms,gs,Sr).premultiply(Vc),C.dist=ms.distanceTo(Ic);for(V.sort((G,k)=>k.dist-G.dist),M=0;M<V.length;M++)C=V[M],h[M]=C.opacity*(C.dist<C.fade-1?C.dist/C.fade:1),v.setMatrixAt(M,C.matrix),v.setColorAt(M,C.color);v.geometry.attributes.cloudOpacity.needsUpdate=!0,v.instanceMatrix.needsUpdate=!0,v.instanceColor&&(v.instanceColor.needsUpdate=!0)}}}let hg=0;class ug extends p.Group{constructor({opacity:e=1,speed:t=0,bounds:i=new p.Vector3().fromArray([5,1,1]),segments:n=20,color:o=new p.Color("#ffffff"),fade:a=10,volume:c=6,smallestVolume:h=.25,distribute:d=null,growth:m=4,concentrate:f="inside",seed:g=Math.random()}={}){super(),this.name="cloud_"+hg++,this.seed=g,this.segments=n,this.bounds=i,this.concentrate=f,this.volume=c,this.smallestVolume=h,this.distribute=d,this.growth=m,this.speed=t,this.fade=a,this.opacity=e,this.color=o,this.ref=this,this.cloudStateArray=[],this.updateCloud()}updateCloudStateArray(){if(this.cloudStateArray.length===this.segments)return;const{segments:e,uuid:t}=this;if(this.cloudStateArray.length>this.segments)this.cloudStateArray.splice(0,this.cloudStateArray.length-this.segments);else for(let i=this.cloudStateArray.length;i<e;i++)this.cloudStateArray.push({segments:e,bounds:new p.Vector3(1,1,1),position:new p.Vector3,uuid:t,index:i,ref:this,dist:0,matrix:new p.Matrix4,volume:0,length:0,speed:0,growth:0,opacity:1,fade:0,density:0,rotation:i*(Math.PI/e),rotationFactor:0,color:new p.Color})}updateCloud(){const{volume:e,color:t,speed:i,growth:n,opacity:o,fade:a,bounds:c,seed:h,cloudStateArray:d,distribute:m,segments:f,concentrate:g,smallestVolume:v}=this;this.updateCloudStateArray();let w=0;function b(){const x=Math.sin(h+w)*1e4;return w++,x-Math.floor(x)}d.forEach((x,L)=>{x.segments=f,x.volume=e,x.color=t,x.speed=i,x.growth=n,x.opacity=o,x.fade=a,x.bounds.copy(c),x.density=Math.max(.5,b()),x.rotationFactor=Math.max(.2,.5*b())*i;const M=m?.(x,L);if(M||f>1){var C;x.position.copy(x.bounds).multiply((C=M?.point)!==null&&C!==void 0?C:{x:b()*2-1,y:b()*2-1,z:b()*2-1})}const W=Math.abs(x.position.x),z=Math.abs(x.position.y),D=Math.abs(x.position.z),X=Math.max(W,z,D);x.length=1,W===X&&(x.length-=W/x.bounds.x),z===X&&(x.length-=z/x.bounds.y),D===X&&(x.length-=D/x.bounds.z),x.volume=(M?.volume!==void 0?M.volume:Math.max(Math.max(0,v),g==="random"?b():g==="inside"?x.length:1-x.length))*e})}}class Qo{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const i=this.workersResolve[e];if(i&&i(t),this.queue.length){const{resolve:n,msg:o,transfer:a}=this.queue.shift();this.workersResolve[e]=n,this.workers[e].postMessage(o,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{const n=this._getIdleWorker();n!==-1?(this._initWorker(n),this.workerStatus|=1<<n,this.workersResolve[n]=i,this.workers[n].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}function Fc(r,e){const t=new p.BufferGeometry;t.setAttribute("position",new p.BufferAttribute(new Float32Array([0,0,0]),3));const i=r.sizeAttenuation??!0,n=i?r.size*.002:r.size,o=new p.PointsMaterial({size:n,color:r.color||16777215,sizeAttenuation:i,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0});o.onBeforeCompile=c=>{c.fragmentShader=c.fragmentShader.replace("#include <clipping_planes_fragment>",`
|
|
824
845
|
#include <clipping_planes_fragment>
|
|
825
846
|
vec2 coord = gl_PointCoord - vec2(0.5);
|
|
826
847
|
if(length(coord) > 0.5) discard;
|
|
827
|
-
`)};const a=new p.Points(t,o);return a.position.copy(e),a}async function
|
|
848
|
+
`)};const a=new p.Points(t,o);return a.position.copy(e),a}async function dg(r,e){let t=null;try{t=await Mt._loadTexture(r.url),t.magFilter=p.LinearFilter,t.minFilter=p.LinearMipmapLinearFilter,t.colorSpace=p.SRGBColorSpace,t.generateMipmaps=!0,t.premultiplyAlpha=!1,t.needsUpdate=!0}catch(d){console.error("IconPoint texture load failed:",r.url,d)}const i=new p.SpriteMaterial({map:t??null,color:r.color||16777215,transparent:r.transparent??!0,opacity:r.opacity??1,sizeAttenuation:r.sizeAttenuation??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,premultipliedAlpha:!1,blending:p.NormalBlending}),n=new p.Sprite(i),o=.002,a=r.size;let c,h;if(Array.isArray(a))[c,h]=a;else{const d=typeof a=="number"?a:32;if(t&&t.image?.width&&t.image?.height){const m=t.image,f=m.width/m.height||1;h=d,c=d*f}else c=d,h=d}return n.scale.set(c*o,h*o,1),r.rotation&&(n.rotation.z=r.rotation),r.anchor&&n.center.set(r.anchor[0],r.anchor[1]),n.position.copy(e),n}function Ho(r,e){let t;e instanceof Float32Array?t=Array.from(e):Array.isArray(e)&&typeof e[0]=="number"?t=e:t=e.flatMap(o=>[o.x,o.y,o.z]);const i=new rs;i.setPositions(t);const n=new gr({color:new p.Color(r.color??16777215).getHex(),linewidth:r.width??2,transparent:r.transparent??!0,opacity:r.opacity??1,dashed:!!r.dashArray,dashScale:r.dashArray?.[0]??1,dashSize:r.dashArray?.[0]??1,gapSize:r.dashArray?.[1]??0,resolution:new p.Vector2(window.innerWidth,window.innerHeight),alphaToCoverage:!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0});return window.addEventListener("resize",()=>{n.resolution.set(window.innerWidth,window.innerHeight)}),new yr(i,n)}function Oc(r,e){let t=[];if(Array.isArray(e)&&typeof e[0]=="number")for(let b=0;b<e.length;b+=3)t.push(new p.Vector3(e[b],e[b+1],e[b+2]));else if(e instanceof Float32Array)for(let b=0;b<e.length;b+=3)t.push(new p.Vector3(e[b],e[b+1],e[b+2]));else t=e;if(t.length<2)return new p.Mesh;const i=new p.CurvePath,n=r.cornerRadius||5;if(t.length===2||n<=0)for(let b=0;b<t.length-1;b++){const x=new p.LineCurve3(t[b],t[b+1]);i.curves.push(x)}else{let b=t[0];for(let x=1;x<t.length-1;x++){const L=b,M=t[x],C=t[x+1],W=new p.Vector3().subVectors(M,L),z=new p.Vector3().subVectors(C,M),D=W.length(),X=z.length(),I=Math.min(D,X)*.4,K=Math.min(n,I);W.normalize().multiplyScalar(D-K),z.normalize().multiplyScalar(K);const V=new p.Vector3().addVectors(L,W),G=new p.Vector3().addVectors(M,z);i.curves.push(new p.LineCurve3(L,V)),i.curves.push(new p.QuadraticBezierCurve3(V,M,G)),b=G}i.curves.push(new p.LineCurve3(b,t[t.length-1]))}const o=r.radius||2,a=r.radialSegments||8,c=r.tubularSegments||64,h=new p.TubeGeometry(i,c,o,a,!1),d=5,m=new p.MeshPhongMaterial({color:r.color||"#19bbd5",side:p.DoubleSide,emissive:new p.Color(r.color||"#19bbd5"),emissiveIntensity:.6*d,transparent:!0});m.defines={USE_UV:""};const g={totalLength:{value:i.getLength()},stripeOffset:{value:0},stripeWidth:{value:r.stripeWidth||10},stripeSpacing:{value:r.stripeSpacing||20},stripeColor:{value:new p.Color(r.stripeColor||"#096be3")},speedFactor:{value:r.speed||10},bloomBoost:{value:d}};m.onBeforeCompile=b=>{b.uniforms.totalLength=g.totalLength,b.uniforms.stripeOffset=g.stripeOffset,b.uniforms.stripeWidth=g.stripeWidth,b.uniforms.stripeSpacing=g.stripeSpacing,b.uniforms.stripeColor=g.stripeColor,b.uniforms.bloomBoost=g.bloomBoost,b.fragmentShader=`
|
|
828
849
|
uniform float totalLength;
|
|
829
850
|
uniform float stripeOffset;
|
|
830
851
|
uniform float stripeWidth;
|
|
@@ -851,7 +872,7 @@
|
|
|
851
872
|
|
|
852
873
|
// 自发光通道也叠加一遍,进一步抬高亮度
|
|
853
874
|
totalEmissiveRadiance += stripeColor * isStripe_e * (3.0 * bloomBoost);
|
|
854
|
-
`)};const v=new p.Mesh(
|
|
875
|
+
`)};const v=new p.Mesh(h,m);let w=0;return v.onBeforeRender=()=>{const b=performance.now(),x=w?(b-w)/1e3:.016;w=b;const L=g.speedFactor.value/g.totalLength.value*10;g.stripeOffset.value-=x*L,g.stripeOffset.value=g.stripeOffset.value%1},v}function Dc(r,e){let t=[];if(Array.isArray(e)&&typeof e[0]=="number")for(let C=0;C<e.length;C+=3)t.push(new p.Vector3(e[C],e[C+1],e[C+2]));else if(e instanceof Float32Array)for(let C=0;C<e.length;C+=3)t.push(new p.Vector3(e[C],e[C+1],e[C+2]));else t=e;if(t.length<2)return new p.Mesh;const i=new p.CurvePath,n=r.cornerRadius||5;if(t.length===2||n<=0)for(let C=0;C<t.length-1;C++){const W=new p.LineCurve3(t[C],t[C+1]);i.curves.push(W)}else{let C=t[0];for(let W=1;W<t.length-1;W++){const z=C,D=t[W],X=t[W+1],I=new p.Vector3().subVectors(D,z),K=new p.Vector3().subVectors(X,D),V=I.length(),G=K.length(),k=Math.min(V,G)*.4,j=Math.min(n,k);I.normalize().multiplyScalar(V-j),K.normalize().multiplyScalar(j);const Y=new p.Vector3().addVectors(z,I),H=new p.Vector3().addVectors(D,K);i.curves.push(new p.LineCurve3(z,Y)),i.curves.push(new p.QuadraticBezierCurve3(Y,D,H)),C=H}i.curves.push(new p.LineCurve3(C,t[t.length-1]))}const o=r.width||4,c=i.getPoints(128),h=[],d=[],m=[];let f=0;const g=i.getLength();for(let C=0;C<c.length;C++){const W=c[C];let z;C===0?z=new p.Vector3().subVectors(c[1],c[0]):C===c.length-1?z=new p.Vector3().subVectors(c[C],c[C-1]):z=new p.Vector3().subVectors(c[C+1],c[C-1]),z.y=0,z.normalize();const D=new p.Vector3(-z.z,0,z.x),X=o/2,I=new p.Vector3(W.x+D.x*X,W.y,W.z+D.z*X),K=new p.Vector3(W.x-D.x*X,W.y,W.z-D.z*X);h.push(I.x,I.y,I.z),h.push(K.x,K.y,K.z),C>0&&(f+=c[C].distanceTo(c[C-1]));const V=f/g;if(d.push(V,0),d.push(V,1),C<c.length-1){const G=C*2;m.push(G,G+1,G+2),m.push(G+1,G+3,G+2)}}const v=new p.BufferGeometry;v.setAttribute("position",new p.BufferAttribute(new Float32Array(h),3)),v.setAttribute("uv",new p.BufferAttribute(new Float32Array(d),2)),v.setIndex(m),v.computeVertexNormals();const w=5,b=new p.MeshPhongMaterial({color:r.color||"#0ED5FD",side:p.DoubleSide,emissive:new p.Color(r.color||"#0ED5FD"),emissiveIntensity:5,transparent:!0});b.defines={USE_UV:""};const x={totalLength:{value:g},stripeOffset:{value:0},arrowLength:{value:r.arrowLength||20},arrowSpacing:{value:r.arrowSpacing||80},arrowColor:{value:new p.Color(r.color||"#0ED5FD")},speedFactor:{value:r.speed||10},bloomBoost:{value:w}};b.onBeforeCompile=C=>{C.uniforms.totalLength=x.totalLength,C.uniforms.stripeOffset=x.stripeOffset,C.uniforms.arrowLength=x.arrowLength,C.uniforms.arrowSpacing=x.arrowSpacing,C.uniforms.arrowColor=x.arrowColor,C.uniforms.bloomBoost=x.bloomBoost,C.fragmentShader=C.fragmentShader.replace("uniform vec3 diffuse;",`uniform vec3 diffuse;
|
|
855
876
|
uniform float totalLength;
|
|
856
877
|
uniform float stripeOffset;
|
|
857
878
|
uniform float arrowLength;
|
|
@@ -896,7 +917,7 @@
|
|
|
896
917
|
mask2 = clamp(mask2, 0.0, 1.0);
|
|
897
918
|
|
|
898
919
|
totalEmissiveRadiance += arrowColor * mask2 * 0.5;
|
|
899
|
-
}`)};const L=new p.Mesh(v,b);let M=0;return L.onBeforeRender=()=>{const C=performance.now(),W=M?(C-M)/1e3:.016;M=C;const z=x.speedFactor.value/x.totalLength.value*10;x.stripeOffset.value-=W*z,x.stripeOffset.value=x.stripeOffset.value%1},L}async function
|
|
920
|
+
}`)};const L=new p.Mesh(v,b);let M=0;return L.onBeforeRender=()=>{const C=performance.now(),W=M?(C-M)/1e3:.016;M=C;const z=x.speedFactor.value/x.totalLength.value*10;x.stripeOffset.value-=W*z,x.stripeOffset.value=x.stripeOffset.value%1},L}async function zc(r,e){let t=[];if(Array.isArray(e)&&typeof e[0]=="number"){const G=e;for(let k=0;k<G.length;k+=3)t.push(new p.Vector3(G[k],G[k+1],G[k+2]))}else if(e instanceof Float32Array)for(let G=0;G<e.length;G+=3)t.push(new p.Vector3(e[G],e[G+1],e[G+2]));else t=e;if(t.length<2)return new p.Mesh;const i=(r.width??10)*.5,n=[],o=[],a=[];let c=0;const h=[0];for(let G=1;G<t.length;G++){const k=t[G].distanceTo(t[G-1]);c+=k,h.push(c)}if(c===0)return new p.Mesh;const d=r.repeat??1,m=[],f=[];for(let G=0;G<t.length;G++){let k=new p.Vector3;G===0?k.subVectors(t[G+1],t[G]):G===t.length-1?k.subVectors(t[G],t[G-1]):k.subVectors(t[G+1],t[G-1]),k.normalize();const j=new p.Vector3(0,1,0);let Y=new p.Vector3().crossVectors(k,j);Y.lengthSq()<1e-10?Y.set(1,0,0):Y.normalize(),m.push(t[G].clone().add(Y.clone().multiplyScalar(-i))),f.push(t[G].clone().add(Y.clone().multiplyScalar(i)))}let g=0,v=0;for(let G=1;G<m.length;G++)g+=m[G].distanceTo(m[G-1]),v+=f[G].distanceTo(f[G-1]);if((g+v)/2===0)return new p.Mesh;for(let G=0;G<t.length;G++){n.push(m[G].x,m[G].y,m[G].z,f[G].x,f[G].y,f[G].z);const k=h[G]/c*d;o.push(k,0,k,1)}const b=t.length-1;for(let G=0;G<b;G++){const k=G*2,j=G*2+1,Y=(G+1)*2,H=(G+1)*2+1;a.push(k,Y,j),a.push(Y,H,j)}const x=new p.BufferGeometry;x.setAttribute("position",new p.BufferAttribute(new Float32Array(n),3)),x.setAttribute("uv",new p.BufferAttribute(new Float32Array(o),2)),x.setIndex(a),x.computeBoundingBox(),x.computeVertexNormals();const L=await Mt._loadTexture(r.flowTexture);L.wrapS=p.RepeatWrapping,L.wrapT=p.RepeatWrapping,L.anisotropy=4,L.needsUpdate=!0;const M=new p.Color(r.color??16777215),W={uMap:{value:L},uColor:{value:M},uOpacity:{value:r.opacity??1},uOffset:{value:0},uBloomBoost:{value:5}},z=r.depthOffset??1,D=z!==0,X=new p.ShaderMaterial({uniforms:W,vertexShader:`
|
|
900
921
|
varying vec2 vUv;
|
|
901
922
|
void main() {
|
|
902
923
|
vUv = uv;
|
|
@@ -925,7 +946,7 @@
|
|
|
925
946
|
|
|
926
947
|
gl_FragColor = vec4(finalColor, alpha);
|
|
927
948
|
}
|
|
928
|
-
`,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!1,blending:p.AdditiveBlending,side:p.DoubleSide,polygonOffset:D,polygonOffsetFactor:-z,polygonOffsetUnits:-z}),I=new p.Mesh(x,X);let K=0;I.onBeforeRender=()=>{const G=performance.now(),k=K?(G-K)/1e3:.016;K=G;const j=r.speed??10;W.uOffset.value=V(W.uOffset.value-k*j/c)};function V(G){return G-Math.floor(G)}return I}async function
|
|
949
|
+
`,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!1,blending:p.AdditiveBlending,side:p.DoubleSide,polygonOffset:D,polygonOffsetFactor:-z,polygonOffsetUnits:-z}),I=new p.Mesh(x,X);let K=0;I.onBeforeRender=()=>{const G=performance.now(),k=K?(G-K)/1e3:.016;K=G;const j=r.speed??10;W.uOffset.value=V(W.uOffset.value-k*j/c)};function V(G){return G-Math.floor(G)}return I}async function fg(r,e){const t=r.type||(r.url.toLowerCase().endsWith(".fbx")?"fbx":"gltf");return await Zc.init().load({...r,type:t,position:e})}function pg(r,e){const{geometry:t,center:i,avgY:n}=Eo(e),o=r.depthOffset??0,a=o!==0,c=new p.MeshBasicMaterial({color:new p.Color(r.color??16777215),transparent:r.transparent??!0,opacity:r.opacity??1,wireframe:r.wireframe??!1,side:r.side==="back"?p.BackSide:r.side==="double"?p.DoubleSide:p.FrontSide,polygonOffset:a,polygonOffsetFactor:a?o:0,polygonOffsetUnits:a?o:0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0}),h=new p.Mesh(t,c);if(h.rotation.x=-Math.PI/2,h.position.set(i.x,n,i.z),(r.borderWidth??0)>0){const f={color:r.borderColor??r.color??0,width:r.borderWidth},g=[];for(let w=0;w<e.length;w+=3){const b=e[w],x=e[w+2];g.push(b-i.x,-(x-i.z),0)}const v=Ho(f,g);v.position.z+=.1,h.add(v)}return h}function mg(r,e){const t=r.extrude?.height||2e3,i=[],n=[],o=[];for(let f=0;f<e.length;f+=3){const g=e[f],v=e[f+1],w=e[f+2];n.push(new p.Vector3(g,v,w)),o.push(new p.Vector3(g,v+t,w))}i.push(...n,...o);const a=new p.BufferGeometry;a.setFromPoints(i);const c=[],h=n.length;for(let f=0;f<h;f++){const g=(f+1)%h;c.push(f,f+h,g),c.push(g,f+h,g+h)}for(let f=2;f<h;f++)c.push(0,f-1,f),c.push(h,h+f-1,h+f);a.setIndex(c),a.computeVertexNormals();const d=new p.ShaderMaterial({uniforms:{uColor:{value:new p.Color(r.color??16777215)},uOpacity:{value:r.opacity??1},uBrightness:{value:1.2}},vertexShader:`
|
|
929
950
|
varying vec3 vWorldPosition;
|
|
930
951
|
varying vec3 vNormal;
|
|
931
952
|
void main() {
|
|
@@ -947,30 +968,30 @@
|
|
|
947
968
|
gl_FragColor = vec4(finalColor, uOpacity);
|
|
948
969
|
if (uOpacity >= 0.99) gl_FragDepthEXT = gl_FragCoord.z;
|
|
949
970
|
}
|
|
950
|
-
`,transparent:r.transparent??!0,side:p.DoubleSide,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0});return new p.Mesh(a,d)}function fg(r,e,t){const{geometry:n,center:i,avgY:o}=Eo(t),a=new Pf(n,{textureWidth:512,textureHeight:512,waterNormals:new p.TextureLoader().load(r.normalMap,function(d){d.wrapS=d.wrapT=p.RepeatWrapping}),waterColor:r.color||"#19AAEE",sunColor:r.sunColor||"#05FFF8",distortionScale:1,alpha:r.opacity||.8}),c=a.onBeforeRender,u=a.onAfterRender;return a.onBeforeRender=(d,m,f,g,v,w)=>{e.tilemap.autoUpdate=!1,c.call(a,d,m,f,g,v,w)},a.onAfterRender=(d,m,f,g,v,w)=>{e.tilemap.autoUpdate=!0,u.call(a,d,m,f,g,v,w)},a.material.uniforms.size.value=.1,a.rotation.x=-Math.PI/2,a.position.set(i.x,o,i.z),e.viewer.addEventListener("update",()=>{a.material.uniforms.time.value+=1/60}),a}function Eo(r){let e=0;for(let a=1;a<r.length;a+=3)e+=r[a];e/=r.length/3;const t={x:0,z:0},n=[];for(let a=0;a<r.length;a+=3)t.x+=r[a],t.z+=r[a+2];t.x/=r.length/3,t.z/=r.length/3;for(let a=0;a<r.length;a+=3)n.push(new p.Vector2(r[a]-t.x,-(r[a+2]-t.z)));const i=new p.Shape(n);return{geometry:new p.ShapeGeometry(i),center:t,avgY:e}}async function pg(r,e){const{geometry:t,center:n,avgY:i}=Eo(e),o=await xt._loadTexture(r.normalMap),a=await xt._loadTexture(r.normalMap);o.wrapS=o.wrapT=p.RepeatWrapping,a.wrapS=a.wrapT=p.RepeatWrapping,o.repeat.set(.015,.015),a.repeat.set(.005,.005);const c=new p.MeshStandardMaterial({color:new p.Color(r.color).multiplyScalar(3.5),roughness:.1,metalness:.8,transparent:r.transparent??!0,opacity:.9,fog:!1,normalMap:o,normalScale:new p.Vector2(1.5,1.5),envMapIntensity:2,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0}),u=new p.Mesh(t,c);u.rotation.x=-Math.PI/2,u.position.set(n.x,i+.15,n.z),u.castShadow=!1,u.receiveShadow=!0;let d=0;return u.onBeforeRender=()=>{const m=performance.now(),f=d?(m-d)/1e3:.016;o.offset.x+=f*.08,o.offset.y+=f*.03,a.offset.x-=f*.12,a.offset.y+=f*.02,u.position.y=i+.5+Math.sin(m*.02)*.02,d=m},u}function mg(r,e){r.color=new p.Color(r.hexcolor),r.boundstext&&(r.bounds=new p.Vector3(r.boundstext.x,r.boundstext.y,r.boundstext.z));const t=new lg(r);return t.castShadow=!0,t.scale.setScalar(50),t.position.copy(e),t}async function gg(r,e){const n={...{fontSizeDpi:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,screenSpaceSize:20,fixedSize:50},...r};n.screenSpaceSize==null&&n.fixedSize!=null&&(n.screenSpaceSize=n.fixedSize);const o=(typeof window<"u"&&window.devicePixelRatio||1)*4,a=r.screenSpaceSize!=null||r.fixedSize!=null;if(r.fontSizeDpi==null&&a){const D=r.screenSpaceSize??r.fixedSize??n.screenSpaceSize;n.fontSizeDpi=D*o}n.fontSizeDpi=Math.min(Math.max(n.fontSizeDpi,8),128);const c=document.createElement("canvas"),u=c.getContext("2d");if(!u)throw new Error("canvas context is null");const d=`${n.fontStyle} ${n.fontWeight} ${n.fontSizeDpi}px ${n.fontFamily}`;u.font=d;const m=n.showBackground?20:0,f=100,g=50,v=u.measureText(n.text),w=Math.max(f,v.width+m*2),b=Math.max(g,n.fontSizeDpi*1.5+m*2);c.width=Math.min(w,2048),c.height=Math.min(b,2048),u.clearRect(0,0,c.width,c.height),u.font=d,n.showBackground&&(n.bgStyle===1?(u.fillStyle=n.bgColor,u.globalAlpha=n.bgOpacity,u.beginPath(),zc(u,m/2,m/2,c.width-m,c.height-m,n.roundRectRadius),u.fill(),u.globalAlpha=1,u.shadowColor=n.shadowColor,u.shadowBlur=n.shadowBlur,u.shadowOffsetX=n.shadowOffsetX,u.shadowOffsetY=n.shadowOffsetY):(u.fillStyle=n.bgColor,u.globalAlpha=n.bgOpacity,u.beginPath(),Xc(u,c.width/2,c.height/2,c.width*.8,c.height*.8,n.roundRectRadius,n.bubblePointerHeight,n.bubblePointerWidth),u.fill(),u.globalAlpha=1,u.strokeStyle=n.bubbleBorderColor,u.lineWidth=n.bubbleBorderWidth,u.stroke())),u.textAlign="center",u.textBaseline="middle",n.strokeWidth>0&&(u.strokeStyle=n.strokeColor,u.lineWidth=n.strokeWidth,u.lineJoin="round",u.strokeText(n.text,c.width/2,c.height/2)),u.fillStyle=n.textColor,u.fillText(n.text,c.width/2,c.height/2),u.shadowColor="transparent";const x=new p.CanvasTexture(c);x.magFilter=p.NearestFilter,x.minFilter=p.LinearMipmapLinearFilter,x.anisotropy=16;const L=new p.SpriteMaterial({map:x,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,fog:!1}),M=new p.Sprite(L),C=n.screenSpaceSize??n.fixedSize;M.scale.set(c.width*C/100,c.height*C/100,1);const W=r.anchor||[.5,.5],z=r.textOffset||{x:0,y:0};return M.center.set(W[0]-z.x/c.width,W[1]+z.y/c.height),e&&M.position.copy(e),M}async function yg(r,e,t){const i={...{fontSizeDpi:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,screenSpaceSize:20,maxVisibleDistance:1/0},...r};i.screenSpaceSize==null&&r.fixedSize!=null&&(i.screenSpaceSize=r.fixedSize);const a=(typeof window<"u"&&window.devicePixelRatio||1)*4;r.fontSizeDpi==null&&(i.fontSizeDpi=i.screenSpaceSize*a),i.fontSizeDpi=Math.max(i.fontSizeDpi,8);const c=document.createElement("canvas"),u=c.getContext("2d");if(!u)throw new Error("Failed to get canvas context");const d=`${i.fontStyle} ${i.fontWeight} ${i.fontSizeDpi}px ${i.fontFamily}`;u.font=d;const m=i.showBackground?20:0,f=100,g=50,v=u.measureText(i.text),w=Math.max(f,v.width+m*2),b=Math.max(g,i.fontSizeDpi*1.5+m*2);c.width=Math.min(w,2048),c.height=Math.min(b,2048),u.clearRect(0,0,c.width,c.height),u.font=d,i.showBackground&&(i.bgStyle===1?(u.fillStyle=i.bgColor,u.globalAlpha=i.bgOpacity,u.beginPath(),zc(u,m/2,m/2,c.width-m,c.height-m,i.roundRectRadius),u.fill(),u.globalAlpha=1,u.shadowColor=i.shadowColor,u.shadowBlur=i.shadowBlur,u.shadowOffsetX=i.shadowOffsetX,u.shadowOffsetY=i.shadowOffsetY):(u.fillStyle=i.bgColor,u.globalAlpha=i.bgOpacity,u.beginPath(),Xc(u,c.width/2,c.height/2,c.width*.8,c.height*.8,i.roundRectRadius,i.bubblePointerHeight,i.bubblePointerWidth),u.fill(),u.globalAlpha=1,u.strokeStyle=i.bubbleBorderColor,u.lineWidth=i.bubbleBorderWidth,u.stroke())),u.textAlign="center",u.textBaseline="middle",i.strokeWidth>0&&(u.strokeStyle=i.strokeColor,u.lineWidth=i.strokeWidth,u.lineJoin="round",u.strokeText(i.text,c.width/2,c.height/2)),u.fillStyle=i.textColor,u.fillText(i.text,c.width/2,c.height/2),u.shadowColor="transparent";const x=new p.CanvasTexture(c),L=new p.SpriteMaterial({map:x,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,fog:!1}),M=new p.Sprite(L),C=r.anchor||[.5,.5],W=r.textOffset||{x:0,y:0},z=i.screenSpaceSize,D=z*(c.width/c.height);M.center.set(C[0]-W.x/D,C[1]+W.y/z),M.position.copy(e),M.userData.isLabel=!0;const X=()=>{if(!M.visible)return;const K=t.viewer.camera.position.distanceTo(M.position);if(K>i.maxVisibleDistance){M.visible=!1;return}M.visible=!0;const V=new p.Vector2;t.viewer.renderer.getSize(V);const G=V.height,k=p.MathUtils.degToRad(t.viewer.camera.fov),j=typeof window<"u"&&window.devicePixelRatio||1,H=i.screenSpaceSize*j/c.height*(2*K*Math.tan(k/2)/G);M.scale.set(H*c.width,H*c.height,1),M.lookAt(t.viewer.camera.position)};X();const I=()=>X();return M.addEventListener("dispose",()=>{t.viewer.renderer.domElement.removeEventListener("resize",X)}),t.viewer.renderer.domElement.addEventListener("resize",X),t.viewer.camera.addEventListener("change",X),M.onBeforeRender=I,M}async function vg(r,e){const t=r.size??r.iconSize,n={text:r.text||"",iconSize:t,fontSize:r.fontSize??12,fontFamily:r.fontFamily||"微软雅黑",fontWeight:r.fontWeight??400,padding:{top:3,right:6,bottom:3,left:6,...r.padding},bgColor:r.bgColor||"#ffffff",bgOpacity:r.bgOpacity??1,textColor:r.textColor||"#000000",strokeColor:r.strokeColor||"#000000",strokeWidth:r.strokeWidth??0,iconScale:r.iconScale??1,renderbg:r.renderbg??!0,textOffset:r.textOffset??{x:-40,y:-19},depthTest:r.depthTest??!1,depthWrite:r.depthWrite??!1,transparent:r.transparent??!0,canvasScale:4};let i=null;if(r.url)try{i=await Lg(r.url)}catch{console.error("Label icon load failed:",r.url)}const{canvas:o,width:a,height:c,center:u}=await _g(n,i),d=new p.Texture(o);d.generateMipmaps=!0,d.minFilter=p.LinearMipmapLinearFilter,d.magFilter=p.LinearFilter,d.colorSpace=p.SRGBColorSpace,d.premultiplyAlpha=!1,d.needsUpdate=!0;const m=new p.SpriteMaterial({map:d,transparent:n.transparent??!0,depthTest:n.depthTest??!0,depthWrite:n.depthWrite??!0,blending:p.NormalBlending,sizeAttenuation:!1,premultipliedAlpha:!1,alphaTest:.05}),f=new p.Sprite(m),g=.002;return f.scale.set(a*g,c*g,1),r.anchor?f.center.set(r.anchor[0],r.anchor[1]):f.center.set(u[0],u[1]),e&&f.position.copy(e),f}async function _g(r,e){return new Promise(t=>{const{text:n,fontSize:i,fontFamily:o,padding:a,bgColor:c,textColor:u,strokeColor:d,strokeWidth:m,iconScale:f,canvasScale:g,renderbg:v,textOffset:w,iconSize:b,fontWeight:x,bgOpacity:L}=r,M=e!==null;let C=0,W=0;if(M&&e){const Ce=e.naturalWidth||e.width||1,ot=e.naturalHeight||e.height||1,ft=Ce/ot||1;Array.isArray(b)?(C=b[0],W=b[1]):typeof b=="number"?(W=b,C=b*ft):(C=Ce,W=ot)}else Array.isArray(b)?(C=b[0],W=b[1]):typeof b=="number"&&(C=b,W=b);const D=document.createElement("canvas").getContext("2d"),X=`${x} ${i}px ${o}`;D.font=X;const I=bg(D,n,i),{width:K,ascent:V,descent:G}=I,k=M?C/2:0,j=M?W/2:0,Y=k+w.x,H=j+w.y,Q=Y-a.left,re=Y+K+a.right,ie=H-V-a.top,le=H+G+a.bottom;let de,ge,fe,Se;M?(de=Math.min(0,Q),ge=Math.min(0,ie),fe=Math.max(C,re),Se=Math.max(W,le)):(de=Q,ge=ie,fe=re,Se=le);const it=Math.ceil(fe-de),rt=Math.ceil(Se-ge),{canvas:dt,ctx:Qe}=wg(it,rt,g),Ye=-de,Re=-ge;if(M&&e&&C>0&&W>0){const Ce=C*f,ot=W*f,ft=(C-Ce)/2,Lt=(W-ot)/2,bi=Ye+ft,Ri=Re+Lt;Qe.drawImage(e,bi,Ri,Ce,ot)}const st=Ye+Y,ze=Re+H;v&&c&&c!=="transparent"&&Mg(Qe,st,ze,K,V,G,a,c,L),Qe.font=X,Sg(Qe,n,st,ze,u,m,d);let Vt,Nt;M&&C>0&&W>0?(Vt=(Ye+k)/it,Nt=(Re+j)/rt):(Vt=.5,Nt=.5),t({canvas:dt,width:it,height:rt,center:[Vt,1-Nt]})})}function zc(r,e,t,n,i,o){r.beginPath(),r.moveTo(e+o,t),r.lineTo(e+n-o,t),r.quadraticCurveTo(e+n,t,e+n,t+o),r.lineTo(e+n,t+i-o),r.quadraticCurveTo(e+n,t+i,e+n-o,t+i),r.lineTo(e+o,t+i),r.quadraticCurveTo(e,t+i,e,t+i-o),r.lineTo(e,t+o),r.quadraticCurveTo(e,t,e+o,t),r.closePath()}function Xc(r,e,t,n,i,o,a,c){if(n<=0)throw new Error("Width must be positive");if(i<=0)throw new Error("Height must be positive");if(o<0)throw new Error("Radius cannot be negative");const u=n,d=i,m=Math.min(o,n/2,i/2),f=a??10,g=c??15;r.beginPath(),r.moveTo(e-u/2+m,t-d/2),r.lineTo(e+u/2-m,t-d/2),r.quadraticCurveTo(e+u/2,t-d/2,e+u/2,t-d/2+m),r.lineTo(e+u/2,t+d/2-m),r.quadraticCurveTo(e+u/2,t+d/2,e+u/2-m,t+d/2),r.lineTo(e+g/2,t+d/2),r.lineTo(e,t+d/2+f),r.lineTo(e-g/2,t+d/2),r.lineTo(e-u/2+m,t+d/2),r.quadraticCurveTo(e-u/2,t+d/2,e-u/2,t+d/2-m),r.lineTo(e-u/2,t-d/2+m),r.quadraticCurveTo(e-u/2,t-d/2,e-u/2+m,t-d/2),r.closePath()}function wg(r,e,t){const n=document.createElement("canvas");n.width=Math.ceil(r*t),n.height=Math.ceil(e*t);const i=n.getContext("2d",{alpha:!0});return i.scale(t,t),i.imageSmoothingEnabled=!1,{canvas:n,ctx:i}}function bg(r,e,t){const n=r.measureText(e);return{width:n.width,ascent:n.actualBoundingBoxAscent||t*.8,descent:n.actualBoundingBoxDescent||t*.2,totalHeight:(n.actualBoundingBoxAscent||t*.8)+(n.actualBoundingBoxDescent||t*.2)}}function xg(r,e,t,n,i,o){r.beginPath(),r.moveTo(e+o,t),r.lineTo(e+n-o,t),r.arcTo(e+n,t,e+n,t+o,o),r.lineTo(e+n,t+i-o),r.arcTo(e+n,t+i,e+n-o,t+i,o),r.lineTo(e+o,t+i),r.arcTo(e,t+i,e,t+i-o,o),r.lineTo(e,t+o),r.arcTo(e,t,e+o,t,o),r.closePath()}function Mg(r,e,t,n,i,o,a,c,u=1){const d=e-a.left,m=t-i-a.top,f=n+a.left+a.right,g=i+o+a.top+a.bottom;r.save(),r.globalAlpha=u,r.fillStyle=c,xg(r,d,m,f,g,2),r.fill(),r.restore()}function Sg(r,e,t,n,i,o,a){r.save(),r.textBaseline="alphabetic",r.textAlign="left",o>0&&(r.strokeStyle=a,r.lineWidth=o,r.lineJoin="round",r.strokeText(e,t,n)),r.fillStyle=i,r.fillText(e,t,n),r.restore()}function Lg(r){return new Promise((e,t)=>{const n=new Image;n.crossOrigin="Anonymous",n.onload=()=>e(n),n.onerror=i=>t(new Error(`Failed to load image: ${r} ${i}`)),n.src=r})}async function Pg(r,e,t){const i=new p.CylinderGeometry(.2,.2,24,12),o=new p.MeshBasicMaterial({color:r.color}),a=await xt._loadTexture(r.icon),c=new p.PointsMaterial({size:80*window.innerHeight/window.innerHeight,fog:!1,opacity:1,transparent:r.transparent??!0,toneMapped:!1,blending:p.AdditiveBlending,map:a,sizeAttenuation:!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!1}),u=new p.InstancedMesh(i,o,e.length);u.position.add(t.prjcenter),u.castShadow=!0;const d=new p.Object3D,m=[];for(let w=0;w<e.length;w++){const b=e[w],x=new p.Vector3(b.coordinates[0],b.coordinates[1],b.coordinates[2]||0),M=t.geo2world(x).sub(t.prjcenter);d.position.copy(M),d.updateMatrix(),u.setMatrixAt(w,d.matrix),m.push(M.x,0,M.z)}const f=new Float32Array(m),g=new p.BufferGeometry;g.setAttribute("position",new p.BufferAttribute(f,3));const v=new p.Points(g,c);return v.position.add(t.prjcenter),v.position.y=1.5*10,v.renderOrder=99999999,v.visible=!0,{points:v,InstancedCol:u}}var Cg=Object.defineProperty,Tg=(r,e,t)=>e in r?Cg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Uc=(r,e,t)=>Tg(r,typeof e!="symbol"?e+"":e,t);const $o=class Di{constructor(e){this.config=e}async applyTo(e){if(!e)return!1;try{switch(e.visible=this.config.visible!==!1,this.config.type){case"basic-point":case"icon-point":case"icon-label-point":return this._applyPointStyle(e);case"basic-line":return this._applyLineStyle(e);case"flow-tube-line":return this._applyFlowLineStyle(e);case"arrow-line":return this._applyArrowLineStyle(e);case"flow-texture-line":return this._applyFlowTextureLineStyle(e);case"gltf":case"fbx":return this._applyModelStyle(e);case"basic-polygon":return this._applyPolygonStyle(e);case"extrude-polygon":return this._applyExtrudeStyle(e);case"water":case"base-water":return this._applyWaterStyle(e);case"cloud":return this._applyCloudStyle(e);case"canvas-label":case"canvas-label-fixed":return this._applyTextSpriteStyle(e);case"light":return this._applyLightStyle(e);case"custom":return this._applyCustomStyle(e);default:throw new Error("Unknown style type")}}catch(t){return console.error("Style apply failed:",t),e.visible=!1,!1}}async _applyPointStyle(e){const t=this.config;return t.type==="icon-point"?await this._applyIconPoint(e,t):t.type==="basic-point"?this._applyBasicPoint(e,t):t.type==="icon-label-point"&&this._applyIconLabelPoint(e,t),!0}async _applyIconPoint(e,t){return!0}_applyBasicPoint(e,t){let n;if(e instanceof p.Points)n=e;else if(n=Ac(t,e.position),n.position.copy(e.position),n.rotation.copy(e.rotation),n.scale.copy(e.scale),e.parent){let a=e.parent;a._threeGeometry=n,a._updateGeometry()}const i=n.material,o=t.sizeAttenuation;i.size=o?t.size*.002:t.size,t.color&&i.color.set(t.color),i.sizeAttenuation=o??!1,i.onBeforeCompile=a=>{a.fragmentShader=a.fragmentShader.replace("#include <clipping_planes_fragment>",`
|
|
971
|
+
`,transparent:r.transparent??!0,side:p.DoubleSide,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0});return new p.Mesh(a,d)}function gg(r,e,t){const{geometry:i,center:n,avgY:o}=Eo(t),a=new Cf(i,{textureWidth:512,textureHeight:512,waterNormals:new p.TextureLoader().load(r.normalMap,function(d){d.wrapS=d.wrapT=p.RepeatWrapping}),waterColor:r.color||"#19AAEE",sunColor:r.sunColor||"#05FFF8",distortionScale:1,alpha:r.opacity||.8}),c=a.onBeforeRender,h=a.onAfterRender;return a.onBeforeRender=(d,m,f,g,v,w)=>{e.tilemap.autoUpdate=!1,c.call(a,d,m,f,g,v,w)},a.onAfterRender=(d,m,f,g,v,w)=>{e.tilemap.autoUpdate=!0,h.call(a,d,m,f,g,v,w)},a.material.uniforms.size.value=.1,a.rotation.x=-Math.PI/2,a.position.set(n.x,o,n.z),e.viewer.addEventListener("update",()=>{a.material.uniforms.time.value+=1/60}),a}function Eo(r){let e=0;for(let a=1;a<r.length;a+=3)e+=r[a];e/=r.length/3;const t={x:0,z:0},i=[];for(let a=0;a<r.length;a+=3)t.x+=r[a],t.z+=r[a+2];t.x/=r.length/3,t.z/=r.length/3;for(let a=0;a<r.length;a+=3)i.push(new p.Vector2(r[a]-t.x,-(r[a+2]-t.z)));const n=new p.Shape(i);return{geometry:new p.ShapeGeometry(n),center:t,avgY:e}}async function yg(r,e){const{geometry:t,center:i,avgY:n}=Eo(e),o=await Mt._loadTexture(r.normalMap),a=await Mt._loadTexture(r.normalMap);o.wrapS=o.wrapT=p.RepeatWrapping,a.wrapS=a.wrapT=p.RepeatWrapping,o.repeat.set(.015,.015),a.repeat.set(.005,.005);const c=new p.MeshStandardMaterial({color:new p.Color(r.color).multiplyScalar(3.5),roughness:.1,metalness:.8,transparent:r.transparent??!0,opacity:.9,fog:!1,normalMap:o,normalScale:new p.Vector2(1.5,1.5),envMapIntensity:2,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0}),h=new p.Mesh(t,c);h.rotation.x=-Math.PI/2,h.position.set(i.x,n+.15,i.z),h.castShadow=!1,h.receiveShadow=!0;let d=0;return h.onBeforeRender=()=>{const m=performance.now(),f=d?(m-d)/1e3:.016;o.offset.x+=f*.08,o.offset.y+=f*.03,a.offset.x-=f*.12,a.offset.y+=f*.02,h.position.y=n+.5+Math.sin(m*.02)*.02,d=m},h}function vg(r,e){r.color=new p.Color(r.hexcolor),r.boundstext&&(r.bounds=new p.Vector3(r.boundstext.x,r.boundstext.y,r.boundstext.z));const t=new ug(r);return t.castShadow=!0,t.scale.setScalar(50),t.position.copy(e),t}async function _g(r,e){const i={...{fontSizeDpi:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,screenSpaceSize:20,fixedSize:50},...r};i.screenSpaceSize==null&&i.fixedSize!=null&&(i.screenSpaceSize=i.fixedSize);const o=(typeof window<"u"&&window.devicePixelRatio||1)*4,a=r.screenSpaceSize!=null||r.fixedSize!=null;if(r.fontSizeDpi==null&&a){const D=r.screenSpaceSize??r.fixedSize??i.screenSpaceSize;i.fontSizeDpi=D*o}i.fontSizeDpi=Math.min(Math.max(i.fontSizeDpi,8),128);const c=document.createElement("canvas"),h=c.getContext("2d");if(!h)throw new Error("canvas context is null");const d=`${i.fontStyle} ${i.fontWeight} ${i.fontSizeDpi}px ${i.fontFamily}`;h.font=d;const m=i.showBackground?20:0,f=100,g=50,v=h.measureText(i.text),w=Math.max(f,v.width+m*2),b=Math.max(g,i.fontSizeDpi*1.5+m*2);c.width=Math.min(w,2048),c.height=Math.min(b,2048),h.clearRect(0,0,c.width,c.height),h.font=d,i.showBackground&&(i.bgStyle===1?(h.fillStyle=i.bgColor,h.globalAlpha=i.bgOpacity,h.beginPath(),Xc(h,m/2,m/2,c.width-m,c.height-m,i.roundRectRadius),h.fill(),h.globalAlpha=1,h.shadowColor=i.shadowColor,h.shadowBlur=i.shadowBlur,h.shadowOffsetX=i.shadowOffsetX,h.shadowOffsetY=i.shadowOffsetY):(h.fillStyle=i.bgColor,h.globalAlpha=i.bgOpacity,h.beginPath(),Uc(h,c.width/2,c.height/2,c.width*.8,c.height*.8,i.roundRectRadius,i.bubblePointerHeight,i.bubblePointerWidth),h.fill(),h.globalAlpha=1,h.strokeStyle=i.bubbleBorderColor,h.lineWidth=i.bubbleBorderWidth,h.stroke())),h.textAlign="center",h.textBaseline="middle",i.strokeWidth>0&&(h.strokeStyle=i.strokeColor,h.lineWidth=i.strokeWidth,h.lineJoin="round",h.strokeText(i.text,c.width/2,c.height/2)),h.fillStyle=i.textColor,h.fillText(i.text,c.width/2,c.height/2),h.shadowColor="transparent";const x=new p.CanvasTexture(c);x.magFilter=p.NearestFilter,x.minFilter=p.LinearMipmapLinearFilter,x.anisotropy=16;const L=new p.SpriteMaterial({map:x,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,fog:!1}),M=new p.Sprite(L),C=i.screenSpaceSize??i.fixedSize;M.scale.set(c.width*C/100,c.height*C/100,1);const W=r.anchor||[.5,.5],z=r.textOffset||{x:0,y:0};return M.center.set(W[0]-z.x/c.width,W[1]+z.y/c.height),e&&M.position.copy(e),M}async function wg(r,e,t){const n={...{fontSizeDpi:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,screenSpaceSize:20,maxVisibleDistance:1/0},...r};n.screenSpaceSize==null&&r.fixedSize!=null&&(n.screenSpaceSize=r.fixedSize);const a=(typeof window<"u"&&window.devicePixelRatio||1)*4;r.fontSizeDpi==null&&(n.fontSizeDpi=n.screenSpaceSize*a),n.fontSizeDpi=Math.max(n.fontSizeDpi,8);const c=document.createElement("canvas"),h=c.getContext("2d");if(!h)throw new Error("Failed to get canvas context");const d=`${n.fontStyle} ${n.fontWeight} ${n.fontSizeDpi}px ${n.fontFamily}`;h.font=d;const m=n.showBackground?20:0,f=100,g=50,v=h.measureText(n.text),w=Math.max(f,v.width+m*2),b=Math.max(g,n.fontSizeDpi*1.5+m*2);c.width=Math.min(w,2048),c.height=Math.min(b,2048),h.clearRect(0,0,c.width,c.height),h.font=d,n.showBackground&&(n.bgStyle===1?(h.fillStyle=n.bgColor,h.globalAlpha=n.bgOpacity,h.beginPath(),Xc(h,m/2,m/2,c.width-m,c.height-m,n.roundRectRadius),h.fill(),h.globalAlpha=1,h.shadowColor=n.shadowColor,h.shadowBlur=n.shadowBlur,h.shadowOffsetX=n.shadowOffsetX,h.shadowOffsetY=n.shadowOffsetY):(h.fillStyle=n.bgColor,h.globalAlpha=n.bgOpacity,h.beginPath(),Uc(h,c.width/2,c.height/2,c.width*.8,c.height*.8,n.roundRectRadius,n.bubblePointerHeight,n.bubblePointerWidth),h.fill(),h.globalAlpha=1,h.strokeStyle=n.bubbleBorderColor,h.lineWidth=n.bubbleBorderWidth,h.stroke())),h.textAlign="center",h.textBaseline="middle",n.strokeWidth>0&&(h.strokeStyle=n.strokeColor,h.lineWidth=n.strokeWidth,h.lineJoin="round",h.strokeText(n.text,c.width/2,c.height/2)),h.fillStyle=n.textColor,h.fillText(n.text,c.width/2,c.height/2),h.shadowColor="transparent";const x=new p.CanvasTexture(c),L=new p.SpriteMaterial({map:x,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,fog:!1}),M=new p.Sprite(L),C=r.anchor||[.5,.5],W=r.textOffset||{x:0,y:0},z=n.screenSpaceSize,D=z*(c.width/c.height);M.center.set(C[0]-W.x/D,C[1]+W.y/z),M.position.copy(e),M.userData.isLabel=!0;const X=()=>{if(!M.visible)return;const K=t.viewer.camera.position.distanceTo(M.position);if(K>n.maxVisibleDistance){M.visible=!1;return}M.visible=!0;const V=new p.Vector2;t.viewer.renderer.getSize(V);const G=V.height,k=p.MathUtils.degToRad(t.viewer.camera.fov),j=typeof window<"u"&&window.devicePixelRatio||1,H=n.screenSpaceSize*j/c.height*(2*K*Math.tan(k/2)/G);M.scale.set(H*c.width,H*c.height,1),M.lookAt(t.viewer.camera.position)};X();const I=()=>X();return M.addEventListener("dispose",()=>{t.viewer.renderer.domElement.removeEventListener("resize",X)}),t.viewer.renderer.domElement.addEventListener("resize",X),t.viewer.camera.addEventListener("change",X),M.onBeforeRender=I,M}async function bg(r,e){const t=r.size??r.iconSize,i={text:r.text||"",iconSize:t,fontSize:r.fontSize??12,fontFamily:r.fontFamily||"微软雅黑",fontWeight:r.fontWeight??400,padding:{top:3,right:6,bottom:3,left:6,...r.padding},bgColor:r.bgColor||"#ffffff",bgOpacity:r.bgOpacity??1,textColor:r.textColor||"#000000",strokeColor:r.strokeColor||"#000000",strokeWidth:r.strokeWidth??0,iconScale:r.iconScale??1,renderbg:r.renderbg??!0,textOffset:r.textOffset??{x:-40,y:-19},depthTest:r.depthTest??!1,depthWrite:r.depthWrite??!1,transparent:r.transparent??!0,canvasScale:4};let n=null;if(r.url)try{n=await Tg(r.url)}catch{console.error("Label icon load failed:",r.url)}const{canvas:o,width:a,height:c,center:h}=await xg(i,n),d=new p.Texture(o);d.generateMipmaps=!0,d.minFilter=p.LinearMipmapLinearFilter,d.magFilter=p.LinearFilter,d.colorSpace=p.SRGBColorSpace,d.premultiplyAlpha=!1,d.needsUpdate=!0;const m=new p.SpriteMaterial({map:d,transparent:i.transparent??!0,depthTest:i.depthTest??!0,depthWrite:i.depthWrite??!0,blending:p.NormalBlending,sizeAttenuation:!1,premultipliedAlpha:!1,alphaTest:.05}),f=new p.Sprite(m),g=.002;return f.scale.set(a*g,c*g,1),r.anchor?f.center.set(r.anchor[0],r.anchor[1]):f.center.set(h[0],h[1]),e&&f.position.copy(e),f}async function xg(r,e){return new Promise(t=>{const{text:i,fontSize:n,fontFamily:o,padding:a,bgColor:c,textColor:h,strokeColor:d,strokeWidth:m,iconScale:f,canvasScale:g,renderbg:v,textOffset:w,iconSize:b,fontWeight:x,bgOpacity:L}=r,M=e!==null;let C=0,W=0;if(M&&e){const Ce=e.naturalWidth||e.width||1,at=e.naturalHeight||e.height||1,pt=Ce/at||1;Array.isArray(b)?(C=b[0],W=b[1]):typeof b=="number"?(W=b,C=b*pt):(C=Ce,W=at)}else Array.isArray(b)?(C=b[0],W=b[1]):typeof b=="number"&&(C=b,W=b);const D=document.createElement("canvas").getContext("2d"),X=`${x} ${n}px ${o}`;D.font=X;const I=Sg(D,i,n),{width:K,ascent:V,descent:G}=I,k=M?C/2:0,j=M?W/2:0,Y=k+w.x,H=j+w.y,Q=Y-a.left,re=Y+K+a.right,ne=H-V-a.top,le=H+G+a.bottom;let de,ge,fe,Se;M?(de=Math.min(0,Q),ge=Math.min(0,ne),fe=Math.max(C,re),Se=Math.max(W,le)):(de=Q,ge=ne,fe=re,Se=le);const rt=Math.ceil(fe-de),st=Math.ceil(Se-ge),{canvas:ft,ctx:He}=Mg(rt,st,g),Re=-de,je=-ge;if(M&&e&&C>0&&W>0){const Ce=C*f,at=W*f,pt=(C-Ce)/2,Pt=(W-at)/2,bn=Re+pt,Rn=je+Pt;He.drawImage(e,bn,Rn,Ce,at)}const ot=Re+Y,Xe=je+H;v&&c&&c!=="transparent"&&Pg(He,ot,Xe,K,V,G,a,c,L),He.font=X,Cg(He,i,ot,Xe,h,m,d);let It,Bt;M&&C>0&&W>0?(It=(Re+k)/rt,Bt=(je+j)/st):(It=.5,Bt=.5),t({canvas:ft,width:rt,height:st,center:[It,1-Bt]})})}function Xc(r,e,t,i,n,o){r.beginPath(),r.moveTo(e+o,t),r.lineTo(e+i-o,t),r.quadraticCurveTo(e+i,t,e+i,t+o),r.lineTo(e+i,t+n-o),r.quadraticCurveTo(e+i,t+n,e+i-o,t+n),r.lineTo(e+o,t+n),r.quadraticCurveTo(e,t+n,e,t+n-o),r.lineTo(e,t+o),r.quadraticCurveTo(e,t,e+o,t),r.closePath()}function Uc(r,e,t,i,n,o,a,c){if(i<=0)throw new Error("Width must be positive");if(n<=0)throw new Error("Height must be positive");if(o<0)throw new Error("Radius cannot be negative");const h=i,d=n,m=Math.min(o,i/2,n/2),f=a??10,g=c??15;r.beginPath(),r.moveTo(e-h/2+m,t-d/2),r.lineTo(e+h/2-m,t-d/2),r.quadraticCurveTo(e+h/2,t-d/2,e+h/2,t-d/2+m),r.lineTo(e+h/2,t+d/2-m),r.quadraticCurveTo(e+h/2,t+d/2,e+h/2-m,t+d/2),r.lineTo(e+g/2,t+d/2),r.lineTo(e,t+d/2+f),r.lineTo(e-g/2,t+d/2),r.lineTo(e-h/2+m,t+d/2),r.quadraticCurveTo(e-h/2,t+d/2,e-h/2,t+d/2-m),r.lineTo(e-h/2,t-d/2+m),r.quadraticCurveTo(e-h/2,t-d/2,e-h/2+m,t-d/2),r.closePath()}function Mg(r,e,t){const i=document.createElement("canvas");i.width=Math.ceil(r*t),i.height=Math.ceil(e*t);const n=i.getContext("2d",{alpha:!0});return n.scale(t,t),n.imageSmoothingEnabled=!1,{canvas:i,ctx:n}}function Sg(r,e,t){const i=r.measureText(e);return{width:i.width,ascent:i.actualBoundingBoxAscent||t*.8,descent:i.actualBoundingBoxDescent||t*.2,totalHeight:(i.actualBoundingBoxAscent||t*.8)+(i.actualBoundingBoxDescent||t*.2)}}function Lg(r,e,t,i,n,o){r.beginPath(),r.moveTo(e+o,t),r.lineTo(e+i-o,t),r.arcTo(e+i,t,e+i,t+o,o),r.lineTo(e+i,t+n-o),r.arcTo(e+i,t+n,e+i-o,t+n,o),r.lineTo(e+o,t+n),r.arcTo(e,t+n,e,t+n-o,o),r.lineTo(e,t+o),r.arcTo(e,t,e+o,t,o),r.closePath()}function Pg(r,e,t,i,n,o,a,c,h=1){const d=e-a.left,m=t-n-a.top,f=i+a.left+a.right,g=n+o+a.top+a.bottom;r.save(),r.globalAlpha=h,r.fillStyle=c,Lg(r,d,m,f,g,2),r.fill(),r.restore()}function Cg(r,e,t,i,n,o,a){r.save(),r.textBaseline="alphabetic",r.textAlign="left",o>0&&(r.strokeStyle=a,r.lineWidth=o,r.lineJoin="round",r.strokeText(e,t,i)),r.fillStyle=n,r.fillText(e,t,i),r.restore()}function Tg(r){return new Promise((e,t)=>{const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>e(i),i.onerror=n=>t(new Error(`Failed to load image: ${r} ${n}`)),i.src=r})}async function Gg(r,e,t){const n=new p.CylinderGeometry(.2,.2,24,12),o=new p.MeshBasicMaterial({color:r.color}),a=await Mt._loadTexture(r.icon),c=new p.PointsMaterial({size:80*window.innerHeight/window.innerHeight,fog:!1,opacity:1,transparent:r.transparent??!0,toneMapped:!1,blending:p.AdditiveBlending,map:a,sizeAttenuation:!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!1}),h=new p.InstancedMesh(n,o,e.length);h.position.add(t.prjcenter),h.castShadow=!0;const d=new p.Object3D,m=[];for(let w=0;w<e.length;w++){const b=e[w],x=new p.Vector3(b.coordinates[0],b.coordinates[1],b.coordinates[2]||0),M=t.geo2world(x).sub(t.prjcenter);d.position.copy(M),d.updateMatrix(),h.setMatrixAt(w,d.matrix),m.push(M.x,0,M.z)}const f=new Float32Array(m),g=new p.BufferGeometry;g.setAttribute("position",new p.BufferAttribute(f,3));const v=new p.Points(g,c);return v.position.add(t.prjcenter),v.position.y=1.5*10,v.renderOrder=99999999,v.visible=!0,{points:v,InstancedCol:h}}var Wg=Object.defineProperty,Zg=(r,e,t)=>e in r?Wg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kc=(r,e,t)=>Zg(r,typeof e!="symbol"?e+"":e,t);const $o=class Dn{constructor(e){this.config=e}async applyTo(e){if(!e)return!1;try{switch(e.visible=this.config.visible!==!1,this.config.type){case"basic-point":case"icon-point":case"icon-label-point":return this._applyPointStyle(e);case"basic-line":return this._applyLineStyle(e);case"flow-tube-line":return this._applyFlowLineStyle(e);case"arrow-line":return this._applyArrowLineStyle(e);case"flow-texture-line":return this._applyFlowTextureLineStyle(e);case"gltf":case"fbx":return this._applyModelStyle(e);case"basic-polygon":return this._applyPolygonStyle(e);case"extrude-polygon":return this._applyExtrudeStyle(e);case"water":case"base-water":return this._applyWaterStyle(e);case"cloud":return this._applyCloudStyle(e);case"canvas-label":case"canvas-label-fixed":return this._applyTextSpriteStyle(e);case"light":return this._applyLightStyle(e);case"custom":return this._applyCustomStyle(e);default:throw new Error("Unknown style type")}}catch(t){return console.error("Style apply failed:",t),e.visible=!1,!1}}async _applyPointStyle(e){const t=this.config;return t.type==="icon-point"?await this._applyIconPoint(e,t):t.type==="basic-point"?this._applyBasicPoint(e,t):t.type==="icon-label-point"&&this._applyIconLabelPoint(e,t),!0}async _applyIconPoint(e,t){return!0}_applyBasicPoint(e,t){let i;if(e instanceof p.Points)i=e;else if(i=Fc(t,e.position),i.position.copy(e.position),i.rotation.copy(e.rotation),i.scale.copy(e.scale),e.parent){let a=e.parent;a._threeGeometry=i,a._updateGeometry()}const n=i.material,o=t.sizeAttenuation;n.size=o?t.size*.002:t.size,t.color&&n.color.set(t.color),n.sizeAttenuation=o??!1,n.onBeforeCompile=a=>{a.fragmentShader=a.fragmentShader.replace("#include <clipping_planes_fragment>",`
|
|
951
972
|
#include <clipping_planes_fragment>
|
|
952
973
|
vec2 coord = gl_PointCoord - vec2(0.5);
|
|
953
974
|
if(length(coord) > 0.5) discard;
|
|
954
|
-
`)},i.needsUpdate=!0}_applyIconLabelPoint(e,t){return!0}_applyLineStyle(e){const t=this.config;if(e.isLine2){const i=e.material;return t.color!==void 0&&i.color.set(t.color),t.width!==void 0&&(i.linewidth=t.width),t.opacity!==void 0&&(i.opacity=t.opacity,i.transparent=t.opacity<1),i.needsUpdate=!0,!0}if(e.parent){let n=e.parent;n._toThreeJSGeometry&&n._toThreeJSGeometry()}return!0}_applyFlowLineStyle(e){return!0}_applyArrowLineStyle(e){return!0}_applyFlowTextureLineStyle(e){return!0}_applyPolygonStyle(e){const t=this.config;return e.traverse(n=>{n instanceof p.Mesh&&(Array.isArray(n.material)?n.material:[n.material]).forEach(o=>{t.color!==void 0&&o.color.set(t.color),t.opacity!==void 0&&(o.opacity=t.opacity,o.transparent=t.opacity<1),t.wireframe!==void 0&&(o.wireframe=t.wireframe),o.needsUpdate=!0})}),!0}_applyExtrudeStyle(e){return!0}_applyWaterStyle(e){return!0}_applyCloudStyle(e){return!0}_applyTextSpriteStyle(e){return!0}_applyLightStyle(e){return!0}async _applyModelStyle(e){return!0}async _applyCustomStyle(e){const n=await this.config.build();return e instanceof p.Group&&(e.clear(),e.add(n)),!0}static async _loadTexture(e){if(Di._textureCache.has(e))return Di._textureCache.get(e);const t=await new Promise((n,i)=>{Di._textureLoader.load(e,n,void 0,i)});return t.needsUpdate=!0,Di._textureCache.set(e,t),t}static create(e){return e instanceof Di?e:new Di(e)}};Uc($o,"_textureCache",new Map),Uc($o,"_textureLoader",new p.TextureLoader);let xt=$o;const tt=[];for(let r=0;r<256;++r)tt.push((r+256).toString(16).slice(1));function Gg(r,e=0){return(tt[r[e+0]]+tt[r[e+1]]+tt[r[e+2]]+tt[r[e+3]]+"-"+tt[r[e+4]]+tt[r[e+5]]+"-"+tt[r[e+6]]+tt[r[e+7]]+"-"+tt[r[e+8]]+tt[r[e+9]]+"-"+tt[r[e+10]]+tt[r[e+11]]+tt[r[e+12]]+tt[r[e+13]]+tt[r[e+14]]+tt[r[e+15]]).toLowerCase()}let qo;const Wg=new Uint8Array(16);function Zg(){if(!qo){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qo=crypto.getRandomValues.bind(crypto)}return qo(Wg)}const kc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Vg(r,e,t){if(kc.randomUUID&&!r)return kc.randomUUID();r=r||{};const n=r.random??r.rng?.()??Zg();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Gg(n)}var Kc=(r=>(r.POINT="point",r.LINE_VERTEX="line_vertex",r.POLYGON_CENTER="polygon_center",r.LABEL="label",r.ICON="icon",r.CLUSTER="cluster",r))(Kc||{}),yn=(r=>(r.NO_COLLISION="no_collision",r.PRIORITY_LOST="priority_lost",r.OUT_OF_VIEWPORT="out_of_viewport",r.ZOOM_FILTERED="zoom_filtered",r.MANUAL_HIDDEN="manual_hidden",r.GROUP_COLLISION="group_collision",r))(yn||{}),Ig=Object.defineProperty,Ag=(r,e,t)=>e in r?Ig(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Lr=(r,e,t)=>Ag(r,typeof e!="symbol"?e+"":e,t);class Fg extends cs{constructor(){super(...arguments),Lr(this,"_isDragging",!1),Lr(this,"_lastCoord",null),Lr(this,"_boundOnMouseDown",this._onMouseDown.bind(this)),Lr(this,"_boundOnMouseMove",this._onMouseMove.bind(this)),Lr(this,"_boundOnMouseUp",this._onMouseUp.bind(this))}addHooks(){this.target.on("mousedown",this._boundOnMouseDown)}removeHooks(){this.target.off("mousedown",this._boundOnMouseDown),this._stopDrag()}_onMouseDown(e){const t=this.target.getMap();!t||!this.target.options.draggable||(this._isDragging=!0,this._lastCoord=e.coordinate,t.viewer.config("draggable",!1),t.on("mousemove",this._boundOnMouseMove),t.on("mouseup",this._boundOnMouseUp),this.target.trigger("dragstart",e))}_onMouseMove(e){if(!this._isDragging||!this._lastCoord||!e.coordinate)return;const t=e.coordinate,n=t[0]-this._lastCoord[0],i=t[1]-this._lastCoord[1];Math.abs(n)<1e-8&&Math.abs(i)<1e-8||(this._translate(n,i),this._lastCoord=t,this.target.trigger("dragging",e))}_onMouseUp(e){this._stopDrag(),this.target.trigger("dragend",e)}_stopDrag(){this._isDragging=!1;const e=this.target.getMap();e&&(e.viewer.config("draggable",!0),e.off("mousemove",this._boundOnMouseMove),e.off("mouseup",this._boundOnMouseUp))}_translate(e,t){const n=this.target._geometry;if(!n||!n.coordinates)return;const i=a=>Array.isArray(a[0])?a.map(i):[a[0]+e,a[1]+t],o=i(n.coordinates);n.coordinates=o,this.target._onPositionChanged(!0)}}var Og=Object.defineProperty,Dg=(r,e,t)=>e in r?Og(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wt=(r,e,t)=>Dg(r,typeof e!="symbol"?e+"":e,t);class ut extends jo(Kn(yi(p.Object3D))){constructor(e){super(),Wt(this,"_position"),Wt(this,"_threeGeometry"),Wt(this,"_geometry"),Wt(this,"_layer"),Wt(this,"_style"),Wt(this,"_id"),Wt(this,"_styleQueue",[]),Wt(this,"_isApplyingStyle",!1),Wt(this,"_isGeometryInitializing",!1),Wt(this,"_bloomConfig"),Wt(this,"_collisionState",{visible:!0,reason:yn.NO_COLLISION,collidedWith:[],timestamp:Date.now()}),Wt(this,"_collisionConfig",{enabled:!0,priority:50,padding:4,minZoom:0,maxZoom:24}),Wt(this,"_animationRef",null),Uo(e.geometry,"geometry","geometry must be specified"),this._geometry=e.geometry,this._position=new p.Vector3(0,0,0),this._threeGeometry=new p.Object3D,this.options={draggable:e.draggable||!1,editable:e.editable||!1},e.userData&&(this.userData=Object.assign({},JSON.parse(JSON.stringify(e.userData)))),e.style&&this.setStyle(e.style),e.id?this._id=e.id:this._id=Vg(),this.addHandler("draggable",Fg)}async initializeGeometry(){if(!(this._isGeometryInitializing||this._threeGeometry)){this._isGeometryInitializing=!0;try{await this._toThreeJSGeometry(),this._processStyleQueue()}finally{this._isGeometryInitializing=!1}}}_updateGeometryPositions(){this._toThreeJSGeometry()}setStyle(e){const t=e instanceof xt?e:new xt(e);this._style=t;const n=JSON.parse(JSON.stringify(t.config));return this._styleQueue.push(n),this._tryProcessQueue(),this}getStyle(){return this._style}setBloom(e,t){const n=this._bloomConfig||{intensity:1,color:"#ffffff"};return this._bloomConfig={enabled:e,intensity:t?.intensity??n.intensity,color:t?.color??n.color},this._threeGeometry&&this._applyBloomToObject(this._threeGeometry),this}getBloom(){return this._bloomConfig}_applyBloomToObject(e){if(!this._bloomConfig)return;const{enabled:t,intensity:n,color:i}=this._bloomConfig;e.traverse(o=>{if(o instanceof p.Points&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={size:a.size,sizeAttenuation:a.sizeAttenuation});const c=o.userData.__bloomBackup;t?(a.size=c.size*(1+n),a.sizeAttenuation=!1):(a.size=c.size,a.sizeAttenuation=c.sizeAttenuation),a.needsUpdate=!0;return}if(o.type==="Sprite"&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.userData.__bloomBackup;t?(a.color&&c.color&&(a.color.copy(c.color),i&&i!=="#ffffff"&&a.color.setStyle(i),a.color.multiplyScalar(1+n*2)),a.opacity=Math.min(1,(c.opacity??1)*(1+n*.3))):(c.color&&a.color&&a.color.copy(c.color),a.opacity=c.opacity),a.needsUpdate=!0;return}if(o.isLine2&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.userData.__bloomBackup;t?(a.color&&c.color&&(a.color.copy(c.color),i&&i!=="#ffffff"&&a.color.setStyle(i),a.color.multiplyScalar(1+n*2)),a.opacity=Math.min(1,(c.opacity??1)*(1+n*.3))):(c.color&&a.color&&a.color.copy(c.color),a.opacity=c.opacity),a.needsUpdate=!0;return}o instanceof p.Mesh&&o.material&&(Array.isArray(o.material)?o.material:[o.material]).forEach(c=>{o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={emissiveIntensity:c.emissiveIntensity??0,emissiveColor:c.emissive?c.emissive.clone():null,color:c.color?c.color.clone():null});const u=o.userData.__bloomBackup;t?"emissive"in c&&c.emissive?(c.emissiveIntensity=n,i&&i!=="#ffffff"&&c.emissive.setStyle?c.emissive.setStyle(i):u.color&&c.emissive&&c.emissive.copy(u.color)):c.color&&(u.color&&c.color.copy(u.color),i&&i!=="#ffffff"?c.color.setStyle(i):c.color.multiplyScalar(1+n*.3)):("emissiveIntensity"in c&&(c.emissiveIntensity=u.emissiveIntensity!==void 0?u.emissiveIntensity:0),u.emissiveColor&&c.emissive&&c.emissive.copy(u.emissiveColor),u.color&&c.color&&c.color.copy(u.color)),c.needsUpdate=!0})})}async _applyStyleWithRetry(e,t=3,n=100){let i=null;for(let o=1;o<=t;o++)try{this._threeGeometry.parent||(this.add(this._threeGeometry),await new Promise(c=>requestAnimationFrame(c))),await e.applyTo(this._threeGeometry);const a=e.config;if(a.bloom!==void 0){const c=a.bloom;typeof c=="boolean"?this._bloomConfig={enabled:c,intensity:1,color:"#ffffff"}:this._bloomConfig={enabled:c.enabled??!0,intensity:c.intensity??1,color:c.color??"#ffffff"}}this._bloomConfig&&this._threeGeometry&&this._applyBloomToObject(this._threeGeometry);return}catch(a){if(i=a,o<t){const c=n*Math.pow(2,o-1);await new Promise(u=>setTimeout(u,c))}}throw i||new Error("样式应用失败,重试次数耗尽")}async _processStyleQueue(){if(!this._threeGeometry||this._isApplyingStyle||this._styleQueue.length===0)return;this._isApplyingStyle=!0;const e=this._styleQueue[0];try{const t=new xt(JSON.parse(JSON.stringify(e)));await this._applyStyleWithRetry(t),this._styleQueue.shift(),this._styleQueue.length>0&&await this._processStyleQueue()}catch(t){throw t}finally{this._isApplyingStyle=!1,this._styleQueue.length>0&&this._tryProcessQueue()}}_tryProcessQueue(){this._threeGeometry&&!this._isApplyingStyle&&this._styleQueue.length>0?this._processStyleQueue().catch(t=>{this._isApplyingStyle=!1,this._tryProcessQueue(),console.warn(t)}):!this._threeGeometry&&!this._isGeometryInitializing&&this.initializeGeometry()}addTo(e){return e.addFeature(this),this}getLayer(){return this._layer||null}getMap(){return this._layer?this._layer.getMap():null}setCoordinates(e){return this._geometry.coordinates=e,this._onPositionChanged(),this}_onPositionChanged(e=!1){e&&this._threeGeometry?this._updateGeometryPositions():this._toThreeJSGeometry(),this.trigger("positionchange")}getCenter(){return this._geometry.type==="Point"?this._geometry.coordinates:[0,0]}_bindLayer(e){if(this._layer&&this._layer!==e)throw new Error("Feature cannot be added to multiple layers");this._layer=e}_updateGeometry(){this._disposeGeometry(),this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry?.userData?._type==="Model"?this._threeGeometry.renderOrder=0:this._threeGeometry.renderOrder=99,this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue())}_remove(){return this.getLayer()?(this._unbind(),this):this}_unbind(){const e=this.getLayer();e&&(e.onRemoveFeature&&e.onRemoveFeature(this),delete this._layer)}_disposeGeometry(){this._threeGeometry&&(this.clear(),"traverse"in this&&this._threeGeometry.traverse(e=>{e instanceof p.Mesh?(e.geometry?.dispose(),Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material?.dispose()):"isLine"in e&&e.isLine&&(e.geometry?.dispose(),e.material?.dispose())}))}get collidable(){return this._collisionConfig.enabled}get collisionType(){return Kc.POINT}getCollisionPriority(){return this.userData.collisionPriority??this._style?.config.collisionPriority??this._collisionConfig.priority}getScreenBoundingBox(e,t){if(!this.collidable)return null;try{const n=new p.Vector3;this._threeGeometry.getWorldPosition(n);const i=n.clone().project(e);if(!(i.x>=-1.1&&i.x<=1.1&&i.y>=-1.1&&i.y<=1.1&&i.z>=-1&&i.z<=1))return null;const{width:a,height:c}=t.domElement,u=(i.x*.5+.5)*a,d=(-i.y*.5+.5)*c,m=this._calculateCollisionBoundingBox(e,t);return m?{id:this._id,x:u+m.offsetX,y:d+m.offsetY,width:20+this._collisionConfig.padding*2,height:20+this._collisionConfig.padding*2,priority:this.getCollisionPriority(),featureId:this._id,layerId:this._layer?.getId()||"unknown",type:this.collisionType,data:this.getCollisionData()}:null}catch(n){return console.warn(`Feature ${this._id} 包围盒计算失败:`,n),null}}setCollisionVisibility(e,t=yn.MANUAL_HIDDEN){this._collisionState.visible!==e&&(this._animationRef!==null&&(cancelAnimationFrame(this._animationRef),this._animationRef=null),this.visible=e,this._applyFinalAlpha(e?1:0),this._collisionState={visible:e,reason:t,collidedWith:e?[]:this._collisionState.collidedWith,timestamp:Date.now()})}getCollisionVisibility(){return this._collisionState.visible}setCollisionConfig(e){return Object.assign(this._collisionConfig,e),this}enableCollision(){return this._collisionConfig.enabled=!0,this}disableCollision(){return this._collisionConfig.enabled=!1,this.setCollisionVisibility(!0,yn.MANUAL_HIDDEN),this}_applyVisibilityAlpha(e){this.traverse(t=>{t instanceof p.Mesh&&(Array.isArray(t.material)?t.material.forEach(n=>{n.opacity!==void 0&&(n.opacity=e)}):t.material.opacity!==void 0&&(t.material.opacity=e))})}_applyFinalAlpha(e){this._applyVisibilityAlpha(e),this.traverse(t=>{t instanceof p.Mesh&&(t.material.needsUpdate=!0)})}getCollisionData(){return{featureType:this.constructor.name,userData:this.userData,styleConfig:this._style?.config}}_calculateCollisionBoundingBox(e,t){if(!this.visible||!this._threeGeometry||!e||!t)return null;try{const n=new p.Box3().setFromObject(this._threeGeometry);if(n.isEmpty())return this._getFallbackBoundingBox();const i=[new p.Vector3(n.min.x,n.min.y,n.min.z),new p.Vector3(n.max.x,n.min.y,n.min.z),new p.Vector3(n.min.x,n.max.y,n.min.z),new p.Vector3(n.max.x,n.max.y,n.min.z),new p.Vector3(n.min.x,n.min.y,n.max.z),new p.Vector3(n.max.x,n.min.y,n.max.z),new p.Vector3(n.min.x,n.max.y,n.max.z),new p.Vector3(n.max.x,n.max.y,n.max.z)],{width:o,height:a}=t.domElement,c=[];i.forEach(z=>{const D=z.clone().project(e),X=(D.x*.5+.5)*o,I=(-D.y*.5+.5)*a;c.push(new p.Vector2(X,I))});let u=1/0,d=-1/0,m=1/0,f=-1/0;c.forEach(z=>{u=Math.min(u,z.x),d=Math.max(d,z.x),m=Math.min(m,z.y),f=Math.max(f,z.y)});const g=d-u,v=f-m,w=4,b=Math.max(g,w),x=Math.max(v,w),L=new p.Vector3;n.getCenter(L);const M=L.clone().project(e),C=(M.x*.5+.5)*o,W=(-M.y*.5+.5)*a;return{width:b,height:x,offsetX:u-C,offsetY:m-W}}catch(n){return console.warn("Bounding box calculation failed 包围盒计算失败:",n),this._getFallbackBoundingBox()}}_getFallbackBoundingBox(){return{width:20,height:20,offsetX:-10,offsetY:-10}}_tileCoordToLocalWorld(e,t,n,i){const{tileZ:o,tileX:a,tileY:c,extent:u,tileSize:d}=n,m=(e/u-.5)*d,f=(.5-t/u)*d;return i.tileIDToWorldCenter(o,a,c).clone().add(new p.Vector3(m,f,0)).sub(i.prjcenter)}}var zg=Object.defineProperty,Xg=(r,e,t)=>e in r?zg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nc=(r,e,t)=>Xg(r,typeof e!="symbol"?e+"":e,t);class Yn extends fs{constructor(e,t){super(e,t),Nc(this,"_feaList"),Nc(this,"_collision",!1),this._feaList=[],t?.collision&&(this._collision=!0)}addFeature(e){const t=Array.isArray(e)?e:[e];for(const n of t)if(!(!n||!(n instanceof ut))&&!n.getLayer()){if(!this.validateFeature(n)){console.error(`Feature ${n.id} does not match the layer's type requirements`);continue}n._bindLayer(this),this._feaList.push(n),n.getMap()&&n._toThreeJSGeometry(),this._clouds&&(this.map.viewer.scene.add(this._clouds),console.log("我是云朵被添加cloud",this.map.viewer.scene)),this.add(n)}return this}getFeatures(e,t){if(!e)return this._feaList.slice(0);const n=[];let i,o;for(let a=0,c=this._feaList.length;a<c;a++)i=this._feaList[a],t?o=e.call(t,i):o=e(i),o&&n.push(i);return n}getCount(){return this._feaList.length}isEmpty(){return!this._feaList.length}removeFeature(e){if(!Array.isArray(e))return this.removeFeature([e]);for(let t=e.length-1;t>=0;t--)e[t]instanceof ut||(e[t]=this.removeFeature(e[t])),!(!e[t]||this!==e[t].getLayer())&&e[t]._remove();return this}clear(){const e=this._feaList.slice();for(const t of e)t._remove();return this}onRemoveFeature(e){if(!e)return;const t=e.getLayer();if(!t||t!==this)return;const n=this._findInList(e);n>=0&&this._feaList.splice(n,1),e.parent&&e.parent===this?this.remove(e):console.warn("Feature parent mismatch:",e.parent),this._disposeFeatureResources(e)}_findInList(e){const t=this._feaList.length;if(t===0)return-1;let n=0,i=t-1,o;for(;n<=i;){if(o=Math.floor((n+i)/2),this._feaList[o]===e)return o;n=o+1}return-1}_disposeFeatureResources(e){try{e.geometry&&e.geometry.dispose&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose?.()):e.material.dispose&&e.material.dispose()),e instanceof p.Object3D&&e.traverse(t=>{t!==e&&this._disposeFeatureResources(t)})}catch(t){console.error("Error disposing feature resources:",t)}}_mergedGeometry(){this.traverse(e=>{e.isMesh&&e.geometry&&e.material&&console.log("Merging geometry 几何体合并中",e)})}setCollisionEngine(e){return this._collisionEngine=e,this}}var Ug=Object.defineProperty,kg=(r,e,t)=>e in r?Ug(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bc=(r,e,t)=>kg(r,typeof e!="symbol"?e+"":e,t);class Kg extends p.Group{constructor(){super(...arguments),Bc(this,"_layers",new Set),Bc(this,"_layerids",new Set)}add(...e){return e.forEach(t=>{if(!(t instanceof fs))throw new Error("LayerContainer can only contain Layer instances! LayerContainer只能包含Layer实例!");const n=t.getId();if(this._layerids.has(n))throw new Error(`Layer with ID '${n}' already exists in the container! ID为'${n}'的图层已存在于容器中!`);this._layers.add(t),this._layerids.add(n),super.add(t)}),this}remove(...e){return e.forEach(t=>{this._layers.delete(t),this._layerids.delete(t.getId()),super.remove(t)}),this}getLayers(){return Array.from(this._layers)}getLayerById(e){for(const t of this._layers)if(t.getId()===e)return t}clearLayers(){return this._layers.clear(),this._layerids.clear(),super.clear(),this}}var Ng=Object.defineProperty,Bg=(r,e,t)=>e in r?Ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yg=(r,e,t)=>Bg(r,e+"",t);class Rg{constructor(){Yg(this,"canvasDict",{})}getCanvas(e=40,t=30,n=1,i){const o=Math.ceil(e*n),a=Math.ceil(t*n),c=i?`${o}_${a}_${i}`:`${o}_${a}`;if(!this.canvasDict[c]){const m=document.createElement("canvas");m.width=o,m.height=a,this.canvasDict[c]=m}const u=this.canvasDict[c],d=u.getContext("2d");return d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u.width,u.height),d.scale(n,n),u}}function jg(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return Yc(this.cover(e,t),e,t,r)}function Yc(r,e,t,n){if(isNaN(e)||isNaN(t))return r;var i,o=r._root,a={data:n},c=r._x0,u=r._y0,d=r._x1,m=r._y1,f,g,v,w,b,x,L,M;if(!o)return r._root=a,r;for(;o.length;)if((b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(u+m)/2))?u=g:m=g,i=o,!(o=o[L=x<<1|b]))return i[L]=a,r;if(v=+r._x.call(null,o.data),w=+r._y.call(null,o.data),e===v&&t===w)return a.next=o,i?i[L]=a:r._root=a,r;do i=i?i[L]=new Array(4):r._root=new Array(4),(b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(u+m)/2))?u=g:m=g;while((L=x<<1|b)===(M=(w>=g)<<1|v>=f));return i[M]=o,i[L]=a,r}function Jg(r){var e,t,n=r.length,i,o,a=new Array(n),c=new Array(n),u=1/0,d=1/0,m=-1/0,f=-1/0;for(t=0;t<n;++t)isNaN(i=+this._x.call(null,e=r[t]))||isNaN(o=+this._y.call(null,e))||(a[t]=i,c[t]=o,i<u&&(u=i),i>m&&(m=i),o<d&&(d=o),o>f&&(f=o));if(u>m||d>f)return this;for(this.cover(u,d).cover(m,f),t=0;t<n;++t)Yc(this,a[t],c[t],r[t]);return this}function Qg(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,n=this._y0,i=this._x1,o=this._y1;if(isNaN(t))i=(t=Math.floor(r))+1,o=(n=Math.floor(e))+1;else{for(var a=i-t||1,c=this._root,u,d;t>r||r>=i||n>e||e>=o;)switch(d=(e<n)<<1|r<t,u=new Array(4),u[d]=c,c=u,a*=2,d){case 0:i=t+a,o=n+a;break;case 1:t=i-a,o=n+a;break;case 2:i=t+a,n=o-a;break;case 3:t=i-a,n=o-a;break}this._root&&this._root.length&&(this._root=c)}return this._x0=t,this._y0=n,this._x1=i,this._y1=o,this}function Hg(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function Eg(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function gt(r,e,t,n,i){this.node=r,this.x0=e,this.y0=t,this.x1=n,this.y1=i}function $g(r,e,t){var n,i=this._x0,o=this._y0,a,c,u,d,m=this._x1,f=this._y1,g=[],v=this._root,w,b;for(v&&g.push(new gt(v,i,o,m,f)),t==null?t=1/0:(i=r-t,o=e-t,m=r+t,f=e+t,t*=t);w=g.pop();)if(!(!(v=w.node)||(a=w.x0)>m||(c=w.y0)>f||(u=w.x1)<i||(d=w.y1)<o))if(v.length){var x=(a+u)/2,L=(c+d)/2;g.push(new gt(v[3],x,L,u,d),new gt(v[2],a,L,x,d),new gt(v[1],x,c,u,L),new gt(v[0],a,c,x,L)),(b=(e>=L)<<1|r>=x)&&(w=g[g.length-1],g[g.length-1]=g[g.length-1-b],g[g.length-1-b]=w)}else{var M=r-+this._x.call(null,v.data),C=e-+this._y.call(null,v.data),W=M*M+C*C;if(W<t){var z=Math.sqrt(t=W);i=r-z,o=e-z,m=r+z,f=e+z,n=v.data}}return n}function qg(r){if(isNaN(m=+this._x.call(null,r))||isNaN(f=+this._y.call(null,r)))return this;var e,t=this._root,n,i,o,a=this._x0,c=this._y0,u=this._x1,d=this._y1,m,f,g,v,w,b,x,L;if(!t)return this;if(t.length)for(;;){if((w=m>=(g=(a+u)/2))?a=g:u=g,(b=f>=(v=(c+d)/2))?c=v:d=v,e=t,!(t=t[x=b<<1|w]))return this;if(!t.length)break;(e[x+1&3]||e[x+2&3]||e[x+3&3])&&(n=e,L=x)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(o=t.next)&&delete t.next,i?(o?i.next=o:delete i.next,this):e?(o?e[x]=o:delete e[x],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[L]=t:this._root=t),this):(this._root=o,this)}function e0(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function t0(){return this._root}function n0(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function i0(r){var e=[],t,n=this._root,i,o,a,c,u;for(n&&e.push(new gt(n,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(n=t.node,o=t.x0,a=t.y0,c=t.x1,u=t.y1)&&n.length){var d=(o+c)/2,m=(a+u)/2;(i=n[3])&&e.push(new gt(i,d,m,c,u)),(i=n[2])&&e.push(new gt(i,o,m,d,u)),(i=n[1])&&e.push(new gt(i,d,a,c,m)),(i=n[0])&&e.push(new gt(i,o,a,d,m))}return this}function r0(r){var e=[],t=[],n;for(this._root&&e.push(new gt(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,c=n.y0,u=n.x1,d=n.y1,m=(a+u)/2,f=(c+d)/2;(o=i[0])&&e.push(new gt(o,a,c,m,f)),(o=i[1])&&e.push(new gt(o,m,c,u,f)),(o=i[2])&&e.push(new gt(o,a,f,m,d)),(o=i[3])&&e.push(new gt(o,m,f,u,d))}t.push(n)}for(;n=t.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function s0(r){return r[0]}function o0(r){return arguments.length?(this._x=r,this):this._x}function a0(r){return r[1]}function l0(r){return arguments.length?(this._y=r,this):this._y}function Rc(r,e,t){var n=new ea(e??s0,t??a0,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function ea(r,e,t,n,i,o){this._x=r,this._y=e,this._x0=t,this._y0=n,this._x1=i,this._y1=o,this._root=void 0}function jc(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var yt=Rc.prototype=ea.prototype;yt.copy=function(){var r=new ea(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,n;if(!e)return r;if(!e.length)return r._root=jc(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var i=0;i<4;++i)(n=e.source[i])&&(n.length?t.push({source:n,target:e.target[i]=new Array(4)}):e.target[i]=jc(n));return r},yt.add=jg,yt.addAll=Jg,yt.cover=Qg,yt.data=Hg,yt.extent=Eg,yt.find=$g,yt.remove=qg,yt.removeAll=e0,yt.root=t0,yt.size=n0,yt.visit=i0,yt.visitAfter=r0,yt.x=o0,yt.y=l0;var c0=Object.defineProperty,u0=(r,e,t)=>e in r?c0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jc=(r,e,t)=>u0(r,typeof e!="symbol"?e+"":e,t);class Qc{constructor(e){Jc(this,"_quadtree"),Jc(this,"_viewport"),this._viewport=e,this._rebuildQuadTree()}updateViewport(e){(e.width!==this._viewport.width||e.height!==this._viewport.height)&&(this._viewport=e,this._rebuildQuadTree())}addBoxes(e){e.forEach(t=>{this._isBoxInViewport(t)&&this._quadtree.add(t)})}findCollisions(e){const t=[],n=this._getSearchBounds(e);return this._quadtree.visit((i,o,a,c,u)=>this._checkNodeCollision(n,o,a,c,u)?(i.length||this._getNodeData(i).forEach(m=>{m.id!==e.id&&this._checkBoxCollision(e,m)&&t.push(m)}),!1):void 0),t}clear(){this._rebuildQuadTree()}getAllBoxes(){const e=[];return this._quadtree.visit(t=>{if(!t.length){const n=this._getNodeData(t);e.push(...n)}return!1}),e}_rebuildQuadTree(){this._quadtree=Rc().x(e=>e.x).y(e=>e.y).extent([[0,0],[this._viewport.width,this._viewport.height]])}_isBoxInViewport(e){const t=e.width/2,n=e.height/2;return e.x+t>=0&&e.x-t<=this._viewport.width&&e.y+n>=0&&e.y-n<=this._viewport.height}_getSearchBounds(e){return{x:e.x,y:e.y,width:e.width*2,height:e.height*2}}_checkNodeCollision(e,t,n,i,o){const a=(t+i)/2,c=(n+o)/2,u=i-t,d=o-n;return Math.abs(e.x-a)*2<e.width+u&&Math.abs(e.y-c)*2<e.height+d}_checkBoxCollision(e,t){return Math.abs(e.x-t.x)*2<e.width+t.width&&Math.abs(e.y-t.y)*2<e.height+t.height}_getNodeData(e){return e?Array.isArray(e.data)?e.data:e.data?[e.data]:[]:[]}removeBox(e){const n=this.getAllBoxes().filter(i=>i.id!==e);this.clear(),n.length>0&&this.addBoxes(n)}}var h0=Object.defineProperty,d0=(r,e,t)=>e in r?h0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hc=(r,e,t)=>d0(r,typeof e!="symbol"?e+"":e,t);class f0{constructor(){Hc(this,"_strategies",new Map),Hc(this,"_executionOrder",[])}registerStrategy(e,t){return this._strategies.set(e.name,e),t!==void 0?this._executionOrder.splice(t,0,e.name):this._executionOrder.push(e.name),this}async executeStrategies(e,t){const n=new Map;e.forEach(i=>{n.set(i._id,{featureId:i._id,visible:!0,reason:yn.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})});for(const i of this._executionOrder){const o=this._strategies.get(i);if(o?.enabled)try{const a=await o.execute(e,t,n);this._mergeResults(n,a)}catch(a){console.error(`Strategy ${i} execution failed: 策略 ${i} 执行失败:`,a)}}return n}_mergeResults(e,t){t.forEach(n=>{const i=e.get(n.featureId);i&&!i.visible||e.set(n.featureId,n)})}}var p0=Object.defineProperty,m0=(r,e,t)=>e in r?p0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_i=(r,e,t)=>m0(r,typeof e!="symbol"?e+"":e,t);class g0{constructor(){_i(this,"frameStats",new Map),_i(this,"summaryStats",{totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0}),_i(this,"sampleWindowSize",60),_i(this,"currentFrameId",0),_i(this,"lastReportTime",0),_i(this,"reportInterval",5e3),_i(this,"performanceThresholds",{criticalFrameTime:33,warningFrameTime:16,idealFrameTime:8}),this.lastReportTime=Date.now()}startFrame(e){this.currentFrameId=e;const t={frameId:e,startTime:performance.now(),endTime:0,duration:0,featureCount:0,visibleCount:0,hiddenCount:0,collisionChecks:0,memoryUsage:0,strategyTimes:new Map};this.frameStats.set(e,t),this.cleanupOldFrames()}endFrame(e,t){const n=this.frameStats.get(e);if(!n)return;const i=performance.now();n.endTime=i,n.duration=i-n.startTime,t&&Object.assign(n,t),"memory"in performance&&(n.memoryUsage=performance.memory.usedJSHeapSize),this.updateSummaryStats(n),this.maybeOutputReport()}recordStrategyTime(e,t){const n=this.frameStats.get(this.currentFrameId);n&&n.strategyTimes.set(e,t)}recordCollisionChecks(e){const t=this.frameStats.get(this.currentFrameId);t&&(t.collisionChecks+=e)}getStats(){const e=this.getRecentFrames(this.sampleWindowSize),t=this.calculateFPS(e),n=this.calculateAverageFrameTime(e);return{summary:{...this.summaryStats},recent:{fps:t,frameTime:n,frameTimeStdDev:this.calculateFrameTimeStdDev(e),averageFeaturesPerFrame:this.calculateAverageFeatures(e),performanceLevel:this.getPerformanceLevel(n)},currentFrame:this.frameStats.get(this.currentFrameId)||null,strategies:this.getStrategyPerformance(e),warnings:this.getPerformanceWarnings(e)}}getDetailedReport(){const e=this.getRecentFrames(this.sampleWindowSize),t=this.getStats();return{...t,frameHistory:Array.from(e.values()),trends:this.calculateTrends(e),recommendations:this.getPerformanceRecommendations(t)}}reset(){this.frameStats.clear(),this.summaryStats={totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0},this.currentFrameId=0,this.lastReportTime=Date.now()}cleanupOldFrames(){this.frameStats.size>this.sampleWindowSize*2&&Array.from(this.frameStats.keys()).sort((t,n)=>t-n).slice(0,this.frameStats.size-this.sampleWindowSize).forEach(t=>{this.frameStats.delete(t)})}updateSummaryStats(e){this.summaryStats.totalFrames++,this.summaryStats.totalFeaturesProcessed+=e.featureCount||0,this.summaryStats.averageFrameTime=(this.summaryStats.averageFrameTime*(this.summaryStats.totalFrames-1)+e.duration)/this.summaryStats.totalFrames,this.summaryStats.minFrameTime=Math.min(this.summaryStats.minFrameTime,e.duration),this.summaryStats.maxFrameTime=Math.max(this.summaryStats.maxFrameTime,e.duration),this.summaryStats.averageFPS=1e3/this.summaryStats.averageFrameTime}maybeOutputReport(){const e=Date.now();if(e-this.lastReportTime>=this.reportInterval){const t=this.getStats();t.warnings.length>0?console.warn("避让系统性能报告:",t):console.log("避让系统性能正常:",t),this.lastReportTime=e}}getRecentFrames(e){return Array.from(this.frameStats.values()).slice(-e).filter(n=>n.duration>0)}calculateFPS(e){if(e.length===0)return 0;const t=this.calculateAverageFrameTime(e);return t>0?1e3/t:0}calculateAverageFrameTime(e){return e.length===0?0:e.reduce((t,n)=>t+n.duration,0)/e.length}calculateFrameTimeStdDev(e){if(e.length===0)return 0;const t=this.calculateAverageFrameTime(e),n=e.map(i=>Math.pow(i.duration-t,2));return Math.sqrt(n.reduce((i,o)=>i+o,0)/e.length)}calculateAverageFeatures(e){return e.length===0?0:e.reduce((t,n)=>t+(n.featureCount||0),0)/e.length}getPerformanceLevel(e){return e>this.performanceThresholds.criticalFrameTime?"critical":e>this.performanceThresholds.warningFrameTime?"warning":e>this.performanceThresholds.idealFrameTime?"good":"excellent"}getStrategyPerformance(e){const t=new Map;return e.forEach(n=>{n.strategyTimes.forEach((i,o)=>{t.has(o)||t.set(o,[]),t.get(o).push(i)})}),Array.from(t.entries()).map(([n,i])=>({name:n,averageTime:i.reduce((o,a)=>o+a,0)/i.length,maxTime:Math.max(...i),minTime:Math.min(...i),callCount:i.length}))}getPerformanceWarnings(e){const t=[],n=e.slice(-30);if(n.length===0)return t;const i=this.calculateAverageFrameTime(n);i>this.performanceThresholds.criticalFrameTime?t.push({type:"critical",message:`帧率过低: ${Math.round(1e3/i)}fps`,suggestion:"考虑减少要素数量或简化避让策略"}):i>this.performanceThresholds.warningFrameTime&&t.push({type:"warning",message:`帧率较低: ${Math.round(1e3/i)}fps`,suggestion:"建议优化避让算法或增加更新间隔"});const o=n.map(a=>a.memoryUsage).filter(a=>a>0);if(o.length>0){const a=o.reduce((c,u)=>c+u,0)/o.length;a>100*1024*1024&&t.push({type:"warning",message:`内存使用较高: ${(a/1024/1024).toFixed(1)}MB`,suggestion:"检查内存泄漏,及时清理无用资源"})}return t}calculateTrends(e){if(e.length<2)return{frameTime:"stable",fps:"stable",features:"stable"};const t=e.slice(0,Math.floor(e.length/2)),n=e.slice(Math.floor(e.length/2)),i=this.calculateAverageFrameTime(t),a=(this.calculateAverageFrameTime(n)-i)/i*100;return{frameTime:Math.abs(a)<5?"stable":a>0?"worsening":"improving",fps:Math.abs(a)<5?"stable":a>0?"improving":"worsening",features:"stable"}}getPerformanceRecommendations(e){const t=[];return e.recent.performanceLevel==="critical"&&(t.push("建议启用要素抽样或聚合显示"),t.push("考虑增加避让更新间隔时间"),t.push("检查是否有不必要的避让策略")),e.recent.averageFeaturesPerFrame>5e3&&t.push("要素数量过多,建议启用LOD分级"),e.strategies.forEach(n=>{n.averageTime>10&&t.push(`策略 "${n.name}" 执行时间较长,考虑优化`)}),t}}var y0=Object.defineProperty,v0=(r,e,t)=>e in r?y0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gs=(r,e,t)=>v0(r,typeof e!="symbol"?e+"":e,t);class _0{constructor(){gs(this,"name","priority"),gs(this,"enabled",!0),gs(this,"weight",1),gs(this,"description","Priority-based avoidance strategy, smaller value means higher priority 基于优先级的避让策略,数值越小优先级越高")}async execute(e,t,n){const i=[],o=new Qc(t.viewport),a=[],c=new Map;return e.forEach(u=>{if(!u.collidable)return;const d=u.getScreenBoundingBox(t.camera,t.renderer);d&&(a.push(d),c.set(u._id,u),n?.get(u._id)?.visible)}),a.sort((u,d)=>u.priority-d.priority),a.forEach(u=>{const d=o.findCollisions(u);d.length===0?(o.addBoxes([u]),i.push({featureId:u.featureId,visible:!0,reason:yn.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})):d.some(f=>f.priority<u.priority)?i.push({featureId:u.featureId,visible:!1,reason:yn.PRIORITY_LOST,collidedWith:d.map(f=>f.featureId),timestamp:t.timestamp}):(o.addBoxes([u]),i.push({featureId:u.featureId,visible:!0,reason:yn.NO_COLLISION,collidedWith:[],timestamp:t.timestamp}),d.forEach(f=>{i.push({featureId:f.featureId,visible:!1,reason:yn.PRIORITY_LOST,collidedWith:[u.featureId],timestamp:t.timestamp})}))}),i}}var w0=Object.defineProperty,b0=(r,e,t)=>e in r?w0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Rn=(r,e,t)=>b0(r,typeof e!="symbol"?e+"":e,t);class x0{constructor(e,t={}){this.renderer=e,Rn(this,"_quadTreeManager"),Rn(this,"_strategyOrchestrator"),Rn(this,"_performanceMonitor"),Rn(this,"_layers",new Set),Rn(this,"_config"),Rn(this,"_isUpdating",!1),Rn(this,"_lastUpdateTime",0),Rn(this,"_frameCount",0),this._config={enabled:!0,padding:4,updateInterval:0,animationDuration:300,maxFeaturesPerFrame:2e3,viewportMargin:50,strategies:{priority:!0,grouping:!1,proximity:!1},...t},this._initializeComponents(),this._setupPerformanceMonitoring()}async update(e){if(!this._config.enabled||this._isUpdating)return;const t=Date.now();if(!(this._config.updateInterval>0&&t-this._lastUpdateTime<this._config.updateInterval)){this._isUpdating=!0,this._frameCount++;try{this._resetAllFeaturesVisibility();const n=this._createCollisionContext(e,t),i=this._collectCollidableFeatures();if(i.length===0)return;this._performanceMonitor.startFrame(this._frameCount);const o=await this._strategyOrchestrator.executeStrategies(i,n);await this._applyCollisionResults(o,i),this._performanceMonitor.endFrame(this._frameCount,{featureCount:i.length,visibleCount:Array.from(o.values()).filter(a=>a.visible).length,hiddenCount:Array.from(o.values()).filter(a=>!a.visible).length}),this._lastUpdateTime=t}catch(n){console.error("避让引擎更新失败:",n)}finally{this._isUpdating=!1}}}_resetAllFeaturesVisibility(){this._layers.forEach(e=>{e.getFeatures().filter(n=>n.collidable).forEach(n=>{n.setCollisionVisibility(!0,yn.NO_COLLISION)})})}registerLayer(e){return this._layers.add(e),this}unregisterLayer(e){return this._layers.delete(e),this}setConfig(e){return Object.assign(this._config,e),this}getPerformanceStats(){return this._performanceMonitor.getStats()}_initializeComponents(){const e={width:this.renderer.domElement.width,height:this.renderer.domElement.height};this._quadTreeManager=new Qc(e),this._strategyOrchestrator=new f0,this._performanceMonitor=new g0,this._strategyOrchestrator.registerStrategy(new _0,0),this._setupViewportResizeHandler()}_createCollisionContext(e,t){return{camera:e,renderer:this.renderer,viewport:{width:this.renderer.domElement.width,height:this.renderer.domElement.height},zoomLevel:e.position.z,timestamp:t,frameNumber:this._frameCount}}_collectCollidableFeatures(){const e=[];return this._layers.forEach(t=>{const n=t.getFeatures().filter(i=>i.collidable&&i instanceof ut);if(e.length+n.length>this._config.maxFeaturesPerFrame){console.warn(`达到每帧最大要素处理限制: ${this._config.maxFeaturesPerFrame}`);return}e.push(...n)}),e}async _applyCollisionResults(e,t){const n=t.map(i=>{const o=e.get(i._id);return o&&i.setCollisionVisibility(o.visible,o.reason),Promise.resolve()});await Promise.all(n)}_setupViewportResizeHandler(){new ResizeObserver(t=>{t.forEach(n=>{const{width:i,height:o}=n.contentRect;this._quadTreeManager.updateViewport({width:i,height:o})})}).observe(this.renderer.domElement)}_setupPerformanceMonitoring(){setInterval(()=>{const e=this.getPerformanceStats();e.frameRate<30&&console.warn("避让系统性能警告:",e)},5e3)}}var Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ys={exports:{}};ys.exports,function(r,e){(function(){var t,n="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",d=500,m="__lodash_placeholder__",f=1,g=2,v=4,w=1,b=2,x=1,L=2,M=4,C=8,W=16,z=32,D=64,X=128,I=256,K=512,V=30,G="...",k=800,j=16,Y=1,H=2,Q=3,re=1/0,ie=9007199254740991,le=17976931348623157e292,de=NaN,ge=4294967295,fe=ge-1,Se=ge>>>1,it=[["ary",X],["bind",x],["bindKey",L],["curry",C],["curryRight",W],["flip",K],["partial",z],["partialRight",D],["rearg",I]],rt="[object Arguments]",dt="[object Array]",Qe="[object AsyncFunction]",Ye="[object Boolean]",Re="[object Date]",st="[object DOMException]",ze="[object Error]",Vt="[object Function]",Nt="[object GeneratorFunction]",Ce="[object Map]",ot="[object Number]",ft="[object Null]",Lt="[object Object]",bi="[object Promise]",Ri="[object Proxy]",xi="[object RegExp]",It="[object Set]",qn="[object String]",ei="[object Symbol]",Mi="[object Undefined]",Si="[object WeakMap]",xa="[object WeakSet]",ti="[object ArrayBuffer]",wn="[object DataView]",Ir="[object Float32Array]",Ar="[object Float64Array]",ji="[object Int8Array]",Fr="[object Int16Array]",Or="[object Int32Array]",Ji="[object Uint8Array]",Li="[object Uint8ClampedArray]",O="[object Uint16Array]",E="[object Uint32Array]",ce=/\b__p \+= '';/g,Me=/\b(__p \+=) '' \+/g,Be=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Bt=/&(?:amp|lt|gt|quot|#39);/g,sn=/[&<>"']/g,Au=RegExp(Bt.source),Gs=RegExp(sn.source),on=/<%-([\s\S]+?)%>/g,an=/<%([\s\S]+?)%>/g,ni=/<%=([\s\S]+?)%>/g,Pi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ci=/^\w*$/,Qi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ma=/[\\^$.*+?()[\]{}|]/g,fw=RegExp(Ma.source),Sa=/^\s+/,pw=/\s/,mw=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,gw=/\{\n\/\* \[wrapped with (.+)\] \*/,yw=/,? & /,vw=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,_w=/[()=,{}\[\]\/\s]/,ww=/\\(\\)?/g,bw=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Fu=/\w*$/,xw=/^[-+]0x[0-9a-f]+$/i,Mw=/^0b[01]+$/i,Sw=/^\[object .+?Constructor\]$/,Lw=/^0o[0-7]+$/i,Pw=/^(?:0|[1-9]\d*)$/,Cw=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ws=/($^)/,Tw=/['\n\r\u2028\u2029\\]/g,Zs="\\ud800-\\udfff",Gw="\\u0300-\\u036f",Ww="\\ufe20-\\ufe2f",Zw="\\u20d0-\\u20ff",Ou=Gw+Ww+Zw,Du="\\u2700-\\u27bf",zu="a-z\\xdf-\\xf6\\xf8-\\xff",Vw="\\xac\\xb1\\xd7\\xf7",Iw="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Aw="\\u2000-\\u206f",Fw=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Xu="A-Z\\xc0-\\xd6\\xd8-\\xde",Uu="\\ufe0e\\ufe0f",ku=Vw+Iw+Aw+Fw,La="['’]",Ow="["+Zs+"]",Ku="["+ku+"]",Vs="["+Ou+"]",Nu="\\d+",Dw="["+Du+"]",Bu="["+zu+"]",Yu="[^"+Zs+ku+Nu+Du+zu+Xu+"]",Pa="\\ud83c[\\udffb-\\udfff]",zw="(?:"+Vs+"|"+Pa+")",Ru="[^"+Zs+"]",Ca="(?:\\ud83c[\\udde6-\\uddff]){2}",Ta="[\\ud800-\\udbff][\\udc00-\\udfff]",Hi="["+Xu+"]",ju="\\u200d",Ju="(?:"+Bu+"|"+Yu+")",Xw="(?:"+Hi+"|"+Yu+")",Qu="(?:"+La+"(?:d|ll|m|re|s|t|ve))?",Hu="(?:"+La+"(?:D|LL|M|RE|S|T|VE))?",Eu=zw+"?",$u="["+Uu+"]?",Uw="(?:"+ju+"(?:"+[Ru,Ca,Ta].join("|")+")"+$u+Eu+")*",kw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Kw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qu=$u+Eu+Uw,Nw="(?:"+[Dw,Ca,Ta].join("|")+")"+qu,Bw="(?:"+[Ru+Vs+"?",Vs,Ca,Ta,Ow].join("|")+")",Yw=RegExp(La,"g"),Rw=RegExp(Vs,"g"),Ga=RegExp(Pa+"(?="+Pa+")|"+Bw+qu,"g"),jw=RegExp([Hi+"?"+Bu+"+"+Qu+"(?="+[Ku,Hi,"$"].join("|")+")",Xw+"+"+Hu+"(?="+[Ku,Hi+Ju,"$"].join("|")+")",Hi+"?"+Ju+"+"+Qu,Hi+"+"+Hu,Kw,kw,Nu,Nw].join("|"),"g"),Jw=RegExp("["+ju+Zs+Ou+Uu+"]"),Qw=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Hw=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ew=-1,Ie={};Ie[Ir]=Ie[Ar]=Ie[ji]=Ie[Fr]=Ie[Or]=Ie[Ji]=Ie[Li]=Ie[O]=Ie[E]=!0,Ie[rt]=Ie[dt]=Ie[ti]=Ie[Ye]=Ie[wn]=Ie[Re]=Ie[ze]=Ie[Vt]=Ie[Ce]=Ie[ot]=Ie[Lt]=Ie[xi]=Ie[It]=Ie[qn]=Ie[Si]=!1;var We={};We[rt]=We[dt]=We[ti]=We[wn]=We[Ye]=We[Re]=We[Ir]=We[Ar]=We[ji]=We[Fr]=We[Or]=We[Ce]=We[ot]=We[Lt]=We[xi]=We[It]=We[qn]=We[ei]=We[Ji]=We[Li]=We[O]=We[E]=!0,We[ze]=We[Vt]=We[Si]=!1;var $w={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ: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","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},nb=parseFloat,ib=parseInt,eh=typeof Pr=="object"&&Pr&&Pr.Object===Object&&Pr,rb=typeof self=="object"&&self&&self.Object===Object&&self,at=eh||rb||Function("return this")(),Wa=e&&!e.nodeType&&e,Ti=Wa&&!0&&r&&!r.nodeType&&r,th=Ti&&Ti.exports===Wa,Za=th&&eh.process,Yt=function(){try{var A=Ti&&Ti.require&&Ti.require("util").types;return A||Za&&Za.binding&&Za.binding("util")}catch{}}(),nh=Yt&&Yt.isArrayBuffer,ih=Yt&&Yt.isDate,rh=Yt&&Yt.isMap,sh=Yt&&Yt.isRegExp,oh=Yt&&Yt.isSet,ah=Yt&&Yt.isTypedArray;function At(A,N,U){switch(U.length){case 0:return A.call(N);case 1:return A.call(N,U[0]);case 2:return A.call(N,U[0],U[1]);case 3:return A.call(N,U[0],U[1],U[2])}return A.apply(N,U)}function sb(A,N,U,ee){for(var ue=-1,Le=A==null?0:A.length;++ue<Le;){var je=A[ue];N(ee,je,U(je),A)}return ee}function Rt(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee&&N(A[U],U,A)!==!1;);return A}function ob(A,N){for(var U=A==null?0:A.length;U--&&N(A[U],U,A)!==!1;);return A}function lh(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(!N(A[U],U,A))return!1;return!0}function ii(A,N){for(var U=-1,ee=A==null?0:A.length,ue=0,Le=[];++U<ee;){var je=A[U];N(je,U,A)&&(Le[ue++]=je)}return Le}function Is(A,N){var U=A==null?0:A.length;return!!U&&Ei(A,N,0)>-1}function Va(A,N,U){for(var ee=-1,ue=A==null?0:A.length;++ee<ue;)if(U(N,A[ee]))return!0;return!1}function Ae(A,N){for(var U=-1,ee=A==null?0:A.length,ue=Array(ee);++U<ee;)ue[U]=N(A[U],U,A);return ue}function ri(A,N){for(var U=-1,ee=N.length,ue=A.length;++U<ee;)A[ue+U]=N[U];return A}function Ia(A,N,U,ee){var ue=-1,Le=A==null?0:A.length;for(ee&&Le&&(U=A[++ue]);++ue<Le;)U=N(U,A[ue],ue,A);return U}function ab(A,N,U,ee){var ue=A==null?0:A.length;for(ee&&ue&&(U=A[--ue]);ue--;)U=N(U,A[ue],ue,A);return U}function Aa(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(N(A[U],U,A))return!0;return!1}var lb=Fa("length");function cb(A){return A.split("")}function ub(A){return A.match(vw)||[]}function ch(A,N,U){var ee;return U(A,function(ue,Le,je){if(N(ue,Le,je))return ee=Le,!1}),ee}function As(A,N,U,ee){for(var ue=A.length,Le=U+(ee?1:-1);ee?Le--:++Le<ue;)if(N(A[Le],Le,A))return Le;return-1}function Ei(A,N,U){return N===N?xb(A,N,U):As(A,uh,U)}function hb(A,N,U,ee){for(var ue=U-1,Le=A.length;++ue<Le;)if(ee(A[ue],N))return ue;return-1}function uh(A){return A!==A}function hh(A,N){var U=A==null?0:A.length;return U?Da(A,N)/U:de}function Fa(A){return function(N){return N==null?t:N[A]}}function Oa(A){return function(N){return A==null?t:A[N]}}function dh(A,N,U,ee,ue){return ue(A,function(Le,je,Ge){U=ee?(ee=!1,Le):N(U,Le,je,Ge)}),U}function db(A,N){var U=A.length;for(A.sort(N);U--;)A[U]=A[U].value;return A}function Da(A,N){for(var U,ee=-1,ue=A.length;++ee<ue;){var Le=N(A[ee]);Le!==t&&(U=U===t?Le:U+Le)}return U}function za(A,N){for(var U=-1,ee=Array(A);++U<A;)ee[U]=N(U);return ee}function fb(A,N){return Ae(N,function(U){return[U,A[U]]})}function fh(A){return A&&A.slice(0,yh(A)+1).replace(Sa,"")}function Ft(A){return function(N){return A(N)}}function Xa(A,N){return Ae(N,function(U){return A[U]})}function Dr(A,N){return A.has(N)}function ph(A,N){for(var U=-1,ee=A.length;++U<ee&&Ei(N,A[U],0)>-1;);return U}function mh(A,N){for(var U=A.length;U--&&Ei(N,A[U],0)>-1;);return U}function pb(A,N){for(var U=A.length,ee=0;U--;)A[U]===N&&++ee;return ee}var mb=Oa($w),gb=Oa(qw);function yb(A){return"\\"+tb[A]}function vb(A,N){return A==null?t:A[N]}function $i(A){return Jw.test(A)}function _b(A){return Qw.test(A)}function wb(A){for(var N,U=[];!(N=A.next()).done;)U.push(N.value);return U}function Ua(A){var N=-1,U=Array(A.size);return A.forEach(function(ee,ue){U[++N]=[ue,ee]}),U}function gh(A,N){return function(U){return A(N(U))}}function si(A,N){for(var U=-1,ee=A.length,ue=0,Le=[];++U<ee;){var je=A[U];(je===N||je===m)&&(A[U]=m,Le[ue++]=U)}return Le}function Fs(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=ee}),U}function bb(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=[ee,ee]}),U}function xb(A,N,U){for(var ee=U-1,ue=A.length;++ee<ue;)if(A[ee]===N)return ee;return-1}function Mb(A,N,U){for(var ee=U+1;ee--;)if(A[ee]===N)return ee;return ee}function qi(A){return $i(A)?Lb(A):lb(A)}function ln(A){return $i(A)?Pb(A):cb(A)}function yh(A){for(var N=A.length;N--&&pw.test(A.charAt(N)););return N}var Sb=Oa(eb);function Lb(A){for(var N=Ga.lastIndex=0;Ga.test(A);)++N;return N}function Pb(A){return A.match(Ga)||[]}function Cb(A){return A.match(jw)||[]}var Tb=function A(N){N=N==null?at:er.defaults(at.Object(),N,er.pick(at,Hw));var U=N.Array,ee=N.Date,ue=N.Error,Le=N.Function,je=N.Math,Ge=N.Object,ka=N.RegExp,Gb=N.String,jt=N.TypeError,Os=U.prototype,Wb=Le.prototype,tr=Ge.prototype,Ds=N["__core-js_shared__"],zs=Wb.toString,Te=tr.hasOwnProperty,Zb=0,vh=function(){var s=/[^.]+$/.exec(Ds&&Ds.keys&&Ds.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Xs=tr.toString,Vb=zs.call(Ge),Ib=at._,Ab=ka("^"+zs.call(Te).replace(Ma,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Us=th?N.Buffer:t,oi=N.Symbol,ks=N.Uint8Array,_h=Us?Us.allocUnsafe:t,Ks=gh(Ge.getPrototypeOf,Ge),wh=Ge.create,bh=tr.propertyIsEnumerable,Ns=Os.splice,xh=oi?oi.isConcatSpreadable:t,zr=oi?oi.iterator:t,Gi=oi?oi.toStringTag:t,Bs=function(){try{var s=Ai(Ge,"defineProperty");return s({},"",{}),s}catch{}}(),Fb=N.clearTimeout!==at.clearTimeout&&N.clearTimeout,Ob=ee&&ee.now!==at.Date.now&&ee.now,Db=N.setTimeout!==at.setTimeout&&N.setTimeout,Ys=je.ceil,Rs=je.floor,Ka=Ge.getOwnPropertySymbols,zb=Us?Us.isBuffer:t,Mh=N.isFinite,Xb=Os.join,Ub=gh(Ge.keys,Ge),Je=je.max,pt=je.min,kb=ee.now,Kb=N.parseInt,Sh=je.random,Nb=Os.reverse,Na=Ai(N,"DataView"),Xr=Ai(N,"Map"),Ba=Ai(N,"Promise"),nr=Ai(N,"Set"),Ur=Ai(N,"WeakMap"),kr=Ai(Ge,"create"),js=Ur&&new Ur,ir={},Bb=Fi(Na),Yb=Fi(Xr),Rb=Fi(Ba),jb=Fi(nr),Jb=Fi(Ur),Js=oi?oi.prototype:t,Kr=Js?Js.valueOf:t,Lh=Js?Js.toString:t;function S(s){if(Xe(s)&&!he(s)&&!(s instanceof be)){if(s instanceof Jt)return s;if(Te.call(s,"__wrapped__"))return Pd(s)}return new Jt(s)}var rr=function(){function s(){}return function(l){if(!Fe(l))return{};if(wh)return wh(l);s.prototype=l;var h=new s;return s.prototype=t,h}}();function Qs(){}function Jt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}S.templateSettings={escape:on,evaluate:an,interpolate:ni,variable:"",imports:{_:S}},S.prototype=Qs.prototype,S.prototype.constructor=S,Jt.prototype=rr(Qs.prototype),Jt.prototype.constructor=Jt;function be(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ge,this.__views__=[]}function Qb(){var s=new be(this.__wrapped__);return s.__actions__=Pt(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=Pt(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=Pt(this.__views__),s}function Hb(){if(this.__filtered__){var s=new be(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function Eb(){var s=this.__wrapped__.value(),l=this.__dir__,h=he(s),y=l<0,_=h?s.length:0,P=cx(0,_,this.__views__),T=P.start,Z=P.end,F=Z-T,B=y?Z:T-1,R=this.__iteratees__,J=R.length,$=0,te=pt(F,this.__takeCount__);if(!h||!y&&_==F&&te==F)return Qh(s,this.__actions__);var oe=[];e:for(;F--&&$<te;){B+=l;for(var me=-1,ae=s[B];++me<J;){var we=R[me],xe=we.iteratee,zt=we.type,wt=xe(ae);if(zt==H)ae=wt;else if(!wt){if(zt==Y)continue e;break e}}oe[$++]=ae}return oe}be.prototype=rr(Qs.prototype),be.prototype.constructor=be;function Wi(s){var l=-1,h=s==null?0:s.length;for(this.clear();++l<h;){var y=s[l];this.set(y[0],y[1])}}function $b(){this.__data__=kr?kr(null):{},this.size=0}function qb(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function e1(s){var l=this.__data__;if(kr){var h=l[s];return h===u?t:h}return Te.call(l,s)?l[s]:t}function t1(s){var l=this.__data__;return kr?l[s]!==t:Te.call(l,s)}function n1(s,l){var h=this.__data__;return this.size+=this.has(s)?0:1,h[s]=kr&&l===t?u:l,this}Wi.prototype.clear=$b,Wi.prototype.delete=qb,Wi.prototype.get=e1,Wi.prototype.has=t1,Wi.prototype.set=n1;function Tn(s){var l=-1,h=s==null?0:s.length;for(this.clear();++l<h;){var y=s[l];this.set(y[0],y[1])}}function i1(){this.__data__=[],this.size=0}function r1(s){var l=this.__data__,h=Hs(l,s);if(h<0)return!1;var y=l.length-1;return h==y?l.pop():Ns.call(l,h,1),--this.size,!0}function s1(s){var l=this.__data__,h=Hs(l,s);return h<0?t:l[h][1]}function o1(s){return Hs(this.__data__,s)>-1}function a1(s,l){var h=this.__data__,y=Hs(h,s);return y<0?(++this.size,h.push([s,l])):h[y][1]=l,this}Tn.prototype.clear=i1,Tn.prototype.delete=r1,Tn.prototype.get=s1,Tn.prototype.has=o1,Tn.prototype.set=a1;function Gn(s){var l=-1,h=s==null?0:s.length;for(this.clear();++l<h;){var y=s[l];this.set(y[0],y[1])}}function l1(){this.size=0,this.__data__={hash:new Wi,map:new(Xr||Tn),string:new Wi}}function c1(s){var l=lo(this,s).delete(s);return this.size-=l?1:0,l}function u1(s){return lo(this,s).get(s)}function h1(s){return lo(this,s).has(s)}function d1(s,l){var h=lo(this,s),y=h.size;return h.set(s,l),this.size+=h.size==y?0:1,this}Gn.prototype.clear=l1,Gn.prototype.delete=c1,Gn.prototype.get=u1,Gn.prototype.has=h1,Gn.prototype.set=d1;function Zi(s){var l=-1,h=s==null?0:s.length;for(this.__data__=new Gn;++l<h;)this.add(s[l])}function f1(s){return this.__data__.set(s,u),this}function p1(s){return this.__data__.has(s)}Zi.prototype.add=Zi.prototype.push=f1,Zi.prototype.has=p1;function cn(s){var l=this.__data__=new Tn(s);this.size=l.size}function m1(){this.__data__=new Tn,this.size=0}function g1(s){var l=this.__data__,h=l.delete(s);return this.size=l.size,h}function y1(s){return this.__data__.get(s)}function v1(s){return this.__data__.has(s)}function _1(s,l){var h=this.__data__;if(h instanceof Tn){var y=h.__data__;if(!Xr||y.length<i-1)return y.push([s,l]),this.size=++h.size,this;h=this.__data__=new Gn(y)}return h.set(s,l),this.size=h.size,this}cn.prototype.clear=m1,cn.prototype.delete=g1,cn.prototype.get=y1,cn.prototype.has=v1,cn.prototype.set=_1;function Ph(s,l){var h=he(s),y=!h&&Oi(s),_=!h&&!y&&hi(s),P=!h&&!y&&!_&&lr(s),T=h||y||_||P,Z=T?za(s.length,Gb):[],F=Z.length;for(var B in s)(l||Te.call(s,B))&&!(T&&(B=="length"||_&&(B=="offset"||B=="parent")||P&&(B=="buffer"||B=="byteLength"||B=="byteOffset")||In(B,F)))&&Z.push(B);return Z}function Ch(s){var l=s.length;return l?s[tl(0,l-1)]:t}function w1(s,l){return co(Pt(s),Vi(l,0,s.length))}function b1(s){return co(Pt(s))}function Ya(s,l,h){(h!==t&&!un(s[l],h)||h===t&&!(l in s))&&Wn(s,l,h)}function Nr(s,l,h){var y=s[l];(!(Te.call(s,l)&&un(y,h))||h===t&&!(l in s))&&Wn(s,l,h)}function Hs(s,l){for(var h=s.length;h--;)if(un(s[h][0],l))return h;return-1}function x1(s,l,h,y){return ai(s,function(_,P,T){l(y,_,h(_),T)}),y}function Th(s,l){return s&&xn(l,He(l),s)}function M1(s,l){return s&&xn(l,Tt(l),s)}function Wn(s,l,h){l=="__proto__"&&Bs?Bs(s,l,{configurable:!0,enumerable:!0,value:h,writable:!0}):s[l]=h}function Ra(s,l){for(var h=-1,y=l.length,_=U(y),P=s==null;++h<y;)_[h]=P?t:Pl(s,l[h]);return _}function Vi(s,l,h){return s===s&&(h!==t&&(s=s<=h?s:h),l!==t&&(s=s>=l?s:l)),s}function Qt(s,l,h,y,_,P){var T,Z=l&f,F=l&g,B=l&v;if(h&&(T=_?h(s,y,_,P):h(s)),T!==t)return T;if(!Fe(s))return s;var R=he(s);if(R){if(T=hx(s),!Z)return Pt(s,T)}else{var J=mt(s),$=J==Vt||J==Nt;if(hi(s))return $h(s,Z);if(J==Lt||J==rt||$&&!_){if(T=F||$?{}:yd(s),!Z)return F?ex(s,M1(T,s)):q1(s,Th(T,s))}else{if(!We[J])return _?s:{};T=dx(s,J,Z)}}P||(P=new cn);var te=P.get(s);if(te)return te;P.set(s,T),Rd(s)?s.forEach(function(ae){T.add(Qt(ae,l,h,ae,s,P))}):Bd(s)&&s.forEach(function(ae,we){T.set(we,Qt(ae,l,h,we,s,P))});var oe=B?F?dl:hl:F?Tt:He,me=R?t:oe(s);return Rt(me||s,function(ae,we){me&&(we=ae,ae=s[we]),Nr(T,we,Qt(ae,l,h,we,s,P))}),T}function S1(s){var l=He(s);return function(h){return Gh(h,s,l)}}function Gh(s,l,h){var y=h.length;if(s==null)return!y;for(s=Ge(s);y--;){var _=h[y],P=l[_],T=s[_];if(T===t&&!(_ in s)||!P(T))return!1}return!0}function Wh(s,l,h){if(typeof s!="function")throw new jt(a);return Hr(function(){s.apply(t,h)},l)}function Br(s,l,h,y){var _=-1,P=Is,T=!0,Z=s.length,F=[],B=l.length;if(!Z)return F;h&&(l=Ae(l,Ft(h))),y?(P=Va,T=!1):l.length>=i&&(P=Dr,T=!1,l=new Zi(l));e:for(;++_<Z;){var R=s[_],J=h==null?R:h(R);if(R=y||R!==0?R:0,T&&J===J){for(var $=B;$--;)if(l[$]===J)continue e;F.push(R)}else P(l,J,y)||F.push(R)}return F}var ai=id(bn),Zh=id(Ja,!0);function L1(s,l){var h=!0;return ai(s,function(y,_,P){return h=!!l(y,_,P),h}),h}function Es(s,l,h){for(var y=-1,_=s.length;++y<_;){var P=s[y],T=l(P);if(T!=null&&(Z===t?T===T&&!Dt(T):h(T,Z)))var Z=T,F=P}return F}function P1(s,l,h,y){var _=s.length;for(h=pe(h),h<0&&(h=-h>_?0:_+h),y=y===t||y>_?_:pe(y),y<0&&(y+=_),y=h>y?0:Jd(y);h<y;)s[h++]=l;return s}function Vh(s,l){var h=[];return ai(s,function(y,_,P){l(y,_,P)&&h.push(y)}),h}function lt(s,l,h,y,_){var P=-1,T=s.length;for(h||(h=px),_||(_=[]);++P<T;){var Z=s[P];l>0&&h(Z)?l>1?lt(Z,l-1,h,y,_):ri(_,Z):y||(_[_.length]=Z)}return _}var ja=rd(),Ih=rd(!0);function bn(s,l){return s&&ja(s,l,He)}function Ja(s,l){return s&&Ih(s,l,He)}function $s(s,l){return ii(l,function(h){return An(s[h])})}function Ii(s,l){l=ci(l,s);for(var h=0,y=l.length;s!=null&&h<y;)s=s[Mn(l[h++])];return h&&h==y?s:t}function Ah(s,l,h){var y=l(s);return he(s)?y:ri(y,h(s))}function vt(s){return s==null?s===t?Mi:ft:Gi&&Gi in Ge(s)?lx(s):bx(s)}function Qa(s,l){return s>l}function C1(s,l){return s!=null&&Te.call(s,l)}function T1(s,l){return s!=null&&l in Ge(s)}function G1(s,l,h){return s>=pt(l,h)&&s<Je(l,h)}function Ha(s,l,h){for(var y=h?Va:Is,_=s[0].length,P=s.length,T=P,Z=U(P),F=1/0,B=[];T--;){var R=s[T];T&&l&&(R=Ae(R,Ft(l))),F=pt(R.length,F),Z[T]=!h&&(l||_>=120&&R.length>=120)?new Zi(T&&R):t}R=s[0];var J=-1,$=Z[0];e:for(;++J<_&&B.length<F;){var te=R[J],oe=l?l(te):te;if(te=h||te!==0?te:0,!($?Dr($,oe):y(B,oe,h))){for(T=P;--T;){var me=Z[T];if(!(me?Dr(me,oe):y(s[T],oe,h)))continue e}$&&$.push(oe),B.push(te)}}return B}function W1(s,l,h,y){return bn(s,function(_,P,T){l(y,h(_),P,T)}),y}function Yr(s,l,h){l=ci(l,s),s=bd(s,l);var y=s==null?s:s[Mn(Et(l))];return y==null?t:At(y,s,h)}function Fh(s){return Xe(s)&&vt(s)==rt}function Z1(s){return Xe(s)&&vt(s)==ti}function V1(s){return Xe(s)&&vt(s)==Re}function Rr(s,l,h,y,_){return s===l?!0:s==null||l==null||!Xe(s)&&!Xe(l)?s!==s&&l!==l:I1(s,l,h,y,Rr,_)}function I1(s,l,h,y,_,P){var T=he(s),Z=he(l),F=T?dt:mt(s),B=Z?dt:mt(l);F=F==rt?Lt:F,B=B==rt?Lt:B;var R=F==Lt,J=B==Lt,$=F==B;if($&&hi(s)){if(!hi(l))return!1;T=!0,R=!1}if($&&!R)return P||(P=new cn),T||lr(s)?pd(s,l,h,y,_,P):ox(s,l,F,h,y,_,P);if(!(h&w)){var te=R&&Te.call(s,"__wrapped__"),oe=J&&Te.call(l,"__wrapped__");if(te||oe){var me=te?s.value():s,ae=oe?l.value():l;return P||(P=new cn),_(me,ae,h,y,P)}}return $?(P||(P=new cn),ax(s,l,h,y,_,P)):!1}function A1(s){return Xe(s)&&mt(s)==Ce}function Ea(s,l,h,y){var _=h.length,P=_,T=!y;if(s==null)return!P;for(s=Ge(s);_--;){var Z=h[_];if(T&&Z[2]?Z[1]!==s[Z[0]]:!(Z[0]in s))return!1}for(;++_<P;){Z=h[_];var F=Z[0],B=s[F],R=Z[1];if(T&&Z[2]){if(B===t&&!(F in s))return!1}else{var J=new cn;if(y)var $=y(B,R,F,s,l,J);if(!($===t?Rr(R,B,w|b,y,J):$))return!1}}return!0}function Oh(s){if(!Fe(s)||gx(s))return!1;var l=An(s)?Ab:Sw;return l.test(Fi(s))}function F1(s){return Xe(s)&&vt(s)==xi}function O1(s){return Xe(s)&&mt(s)==It}function D1(s){return Xe(s)&&go(s.length)&&!!Ie[vt(s)]}function Dh(s){return typeof s=="function"?s:s==null?Gt:typeof s=="object"?he(s)?Uh(s[0],s[1]):Xh(s):of(s)}function $a(s){if(!Qr(s))return Ub(s);var l=[];for(var h in Ge(s))Te.call(s,h)&&h!="constructor"&&l.push(h);return l}function z1(s){if(!Fe(s))return wx(s);var l=Qr(s),h=[];for(var y in s)y=="constructor"&&(l||!Te.call(s,y))||h.push(y);return h}function qa(s,l){return s<l}function zh(s,l){var h=-1,y=Ct(s)?U(s.length):[];return ai(s,function(_,P,T){y[++h]=l(_,P,T)}),y}function Xh(s){var l=pl(s);return l.length==1&&l[0][2]?_d(l[0][0],l[0][1]):function(h){return h===s||Ea(h,s,l)}}function Uh(s,l){return gl(s)&&vd(l)?_d(Mn(s),l):function(h){var y=Pl(h,s);return y===t&&y===l?Cl(h,s):Rr(l,y,w|b)}}function qs(s,l,h,y,_){s!==l&&ja(l,function(P,T){if(_||(_=new cn),Fe(P))X1(s,l,T,h,qs,y,_);else{var Z=y?y(vl(s,T),P,T+"",s,l,_):t;Z===t&&(Z=P),Ya(s,T,Z)}},Tt)}function X1(s,l,h,y,_,P,T){var Z=vl(s,h),F=vl(l,h),B=T.get(F);if(B){Ya(s,h,B);return}var R=P?P(Z,F,h+"",s,l,T):t,J=R===t;if(J){var $=he(F),te=!$&&hi(F),oe=!$&&!te&&lr(F);R=F,$||te||oe?he(Z)?R=Z:ke(Z)?R=Pt(Z):te?(J=!1,R=$h(F,!0)):oe?(J=!1,R=qh(F,!0)):R=[]:Er(F)||Oi(F)?(R=Z,Oi(Z)?R=Qd(Z):(!Fe(Z)||An(Z))&&(R=yd(F))):J=!1}J&&(T.set(F,R),_(R,F,y,P,T),T.delete(F)),Ya(s,h,R)}function kh(s,l){var h=s.length;if(h)return l+=l<0?h:0,In(l,h)?s[l]:t}function Kh(s,l,h){l.length?l=Ae(l,function(P){return he(P)?function(T){return Ii(T,P.length===1?P[0]:P)}:P}):l=[Gt];var y=-1;l=Ae(l,Ft(se()));var _=zh(s,function(P,T,Z){var F=Ae(l,function(B){return B(P)});return{criteria:F,index:++y,value:P}});return db(_,function(P,T){return $1(P,T,h)})}function U1(s,l){return Nh(s,l,function(h,y){return Cl(s,y)})}function Nh(s,l,h){for(var y=-1,_=l.length,P={};++y<_;){var T=l[y],Z=Ii(s,T);h(Z,T)&&jr(P,ci(T,s),Z)}return P}function k1(s){return function(l){return Ii(l,s)}}function el(s,l,h,y){var _=y?hb:Ei,P=-1,T=l.length,Z=s;for(s===l&&(l=Pt(l)),h&&(Z=Ae(s,Ft(h)));++P<T;)for(var F=0,B=l[P],R=h?h(B):B;(F=_(Z,R,F,y))>-1;)Z!==s&&Ns.call(Z,F,1),Ns.call(s,F,1);return s}function Bh(s,l){for(var h=s?l.length:0,y=h-1;h--;){var _=l[h];if(h==y||_!==P){var P=_;In(_)?Ns.call(s,_,1):rl(s,_)}}return s}function tl(s,l){return s+Rs(Sh()*(l-s+1))}function K1(s,l,h,y){for(var _=-1,P=Je(Ys((l-s)/(h||1)),0),T=U(P);P--;)T[y?P:++_]=s,s+=h;return T}function nl(s,l){var h="";if(!s||l<1||l>ie)return h;do l%2&&(h+=s),l=Rs(l/2),l&&(s+=s);while(l);return h}function ye(s,l){return _l(wd(s,l,Gt),s+"")}function N1(s){return Ch(cr(s))}function B1(s,l){var h=cr(s);return co(h,Vi(l,0,h.length))}function jr(s,l,h,y){if(!Fe(s))return s;l=ci(l,s);for(var _=-1,P=l.length,T=P-1,Z=s;Z!=null&&++_<P;){var F=Mn(l[_]),B=h;if(F==="__proto__"||F==="constructor"||F==="prototype")return s;if(_!=T){var R=Z[F];B=y?y(R,F,Z):t,B===t&&(B=Fe(R)?R:In(l[_+1])?[]:{})}Nr(Z,F,B),Z=Z[F]}return s}var Yh=js?function(s,l){return js.set(s,l),s}:Gt,Y1=Bs?function(s,l){return Bs(s,"toString",{configurable:!0,enumerable:!1,value:Gl(l),writable:!0})}:Gt;function R1(s){return co(cr(s))}function Ht(s,l,h){var y=-1,_=s.length;l<0&&(l=-l>_?0:_+l),h=h>_?_:h,h<0&&(h+=_),_=l>h?0:h-l>>>0,l>>>=0;for(var P=U(_);++y<_;)P[y]=s[y+l];return P}function j1(s,l){var h;return ai(s,function(y,_,P){return h=l(y,_,P),!h}),!!h}function eo(s,l,h){var y=0,_=s==null?y:s.length;if(typeof l=="number"&&l===l&&_<=Se){for(;y<_;){var P=y+_>>>1,T=s[P];T!==null&&!Dt(T)&&(h?T<=l:T<l)?y=P+1:_=P}return _}return il(s,l,Gt,h)}function il(s,l,h,y){var _=0,P=s==null?0:s.length;if(P===0)return 0;l=h(l);for(var T=l!==l,Z=l===null,F=Dt(l),B=l===t;_<P;){var R=Rs((_+P)/2),J=h(s[R]),$=J!==t,te=J===null,oe=J===J,me=Dt(J);if(T)var ae=y||oe;else B?ae=oe&&(y||$):Z?ae=oe&&$&&(y||!te):F?ae=oe&&$&&!te&&(y||!me):te||me?ae=!1:ae=y?J<=l:J<l;ae?_=R+1:P=R}return pt(P,fe)}function Rh(s,l){for(var h=-1,y=s.length,_=0,P=[];++h<y;){var T=s[h],Z=l?l(T):T;if(!h||!un(Z,F)){var F=Z;P[_++]=T===0?0:T}}return P}function jh(s){return typeof s=="number"?s:Dt(s)?de:+s}function Ot(s){if(typeof s=="string")return s;if(he(s))return Ae(s,Ot)+"";if(Dt(s))return Lh?Lh.call(s):"";var l=s+"";return l=="0"&&1/s==-re?"-0":l}function li(s,l,h){var y=-1,_=Is,P=s.length,T=!0,Z=[],F=Z;if(h)T=!1,_=Va;else if(P>=i){var B=l?null:rx(s);if(B)return Fs(B);T=!1,_=Dr,F=new Zi}else F=l?[]:Z;e:for(;++y<P;){var R=s[y],J=l?l(R):R;if(R=h||R!==0?R:0,T&&J===J){for(var $=F.length;$--;)if(F[$]===J)continue e;l&&F.push(J),Z.push(R)}else _(F,J,h)||(F!==Z&&F.push(J),Z.push(R))}return Z}function rl(s,l){return l=ci(l,s),s=bd(s,l),s==null||delete s[Mn(Et(l))]}function Jh(s,l,h,y){return jr(s,l,h(Ii(s,l)),y)}function to(s,l,h,y){for(var _=s.length,P=y?_:-1;(y?P--:++P<_)&&l(s[P],P,s););return h?Ht(s,y?0:P,y?P+1:_):Ht(s,y?P+1:0,y?_:P)}function Qh(s,l){var h=s;return h instanceof be&&(h=h.value()),Ia(l,function(y,_){return _.func.apply(_.thisArg,ri([y],_.args))},h)}function sl(s,l,h){var y=s.length;if(y<2)return y?li(s[0]):[];for(var _=-1,P=U(y);++_<y;)for(var T=s[_],Z=-1;++Z<y;)Z!=_&&(P[_]=Br(P[_]||T,s[Z],l,h));return li(lt(P,1),l,h)}function Hh(s,l,h){for(var y=-1,_=s.length,P=l.length,T={};++y<_;){var Z=y<P?l[y]:t;h(T,s[y],Z)}return T}function ol(s){return ke(s)?s:[]}function al(s){return typeof s=="function"?s:Gt}function ci(s,l){return he(s)?s:gl(s,l)?[s]:Ld(Pe(s))}var J1=ye;function ui(s,l,h){var y=s.length;return h=h===t?y:h,!l&&h>=y?s:Ht(s,l,h)}var Eh=Fb||function(s){return at.clearTimeout(s)};function $h(s,l){if(l)return s.slice();var h=s.length,y=_h?_h(h):new s.constructor(h);return s.copy(y),y}function ll(s){var l=new s.constructor(s.byteLength);return new ks(l).set(new ks(s)),l}function Q1(s,l){var h=l?ll(s.buffer):s.buffer;return new s.constructor(h,s.byteOffset,s.byteLength)}function H1(s){var l=new s.constructor(s.source,Fu.exec(s));return l.lastIndex=s.lastIndex,l}function E1(s){return Kr?Ge(Kr.call(s)):{}}function qh(s,l){var h=l?ll(s.buffer):s.buffer;return new s.constructor(h,s.byteOffset,s.length)}function ed(s,l){if(s!==l){var h=s!==t,y=s===null,_=s===s,P=Dt(s),T=l!==t,Z=l===null,F=l===l,B=Dt(l);if(!Z&&!B&&!P&&s>l||P&&T&&F&&!Z&&!B||y&&T&&F||!h&&F||!_)return 1;if(!y&&!P&&!B&&s<l||B&&h&&_&&!y&&!P||Z&&h&&_||!T&&_||!F)return-1}return 0}function $1(s,l,h){for(var y=-1,_=s.criteria,P=l.criteria,T=_.length,Z=h.length;++y<T;){var F=ed(_[y],P[y]);if(F){if(y>=Z)return F;var B=h[y];return F*(B=="desc"?-1:1)}}return s.index-l.index}function td(s,l,h,y){for(var _=-1,P=s.length,T=h.length,Z=-1,F=l.length,B=Je(P-T,0),R=U(F+B),J=!y;++Z<F;)R[Z]=l[Z];for(;++_<T;)(J||_<P)&&(R[h[_]]=s[_]);for(;B--;)R[Z++]=s[_++];return R}function nd(s,l,h,y){for(var _=-1,P=s.length,T=-1,Z=h.length,F=-1,B=l.length,R=Je(P-Z,0),J=U(R+B),$=!y;++_<R;)J[_]=s[_];for(var te=_;++F<B;)J[te+F]=l[F];for(;++T<Z;)($||_<P)&&(J[te+h[T]]=s[_++]);return J}function Pt(s,l){var h=-1,y=s.length;for(l||(l=U(y));++h<y;)l[h]=s[h];return l}function xn(s,l,h,y){var _=!h;h||(h={});for(var P=-1,T=l.length;++P<T;){var Z=l[P],F=y?y(h[Z],s[Z],Z,h,s):t;F===t&&(F=s[Z]),_?Wn(h,Z,F):Nr(h,Z,F)}return h}function q1(s,l){return xn(s,ml(s),l)}function ex(s,l){return xn(s,md(s),l)}function no(s,l){return function(h,y){var _=he(h)?sb:x1,P=l?l():{};return _(h,s,se(y,2),P)}}function sr(s){return ye(function(l,h){var y=-1,_=h.length,P=_>1?h[_-1]:t,T=_>2?h[2]:t;for(P=s.length>3&&typeof P=="function"?(_--,P):t,T&&_t(h[0],h[1],T)&&(P=_<3?t:P,_=1),l=Ge(l);++y<_;){var Z=h[y];Z&&s(l,Z,y,P)}return l})}function id(s,l){return function(h,y){if(h==null)return h;if(!Ct(h))return s(h,y);for(var _=h.length,P=l?_:-1,T=Ge(h);(l?P--:++P<_)&&y(T[P],P,T)!==!1;);return h}}function rd(s){return function(l,h,y){for(var _=-1,P=Ge(l),T=y(l),Z=T.length;Z--;){var F=T[s?Z:++_];if(h(P[F],F,P)===!1)break}return l}}function tx(s,l,h){var y=l&x,_=Jr(s);function P(){var T=this&&this!==at&&this instanceof P?_:s;return T.apply(y?h:this,arguments)}return P}function sd(s){return function(l){l=Pe(l);var h=$i(l)?ln(l):t,y=h?h[0]:l.charAt(0),_=h?ui(h,1).join(""):l.slice(1);return y[s]()+_}}function or(s){return function(l){return Ia(rf(nf(l).replace(Yw,"")),s,"")}}function Jr(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var h=rr(s.prototype),y=s.apply(h,l);return Fe(y)?y:h}}function nx(s,l,h){var y=Jr(s);function _(){for(var P=arguments.length,T=U(P),Z=P,F=ar(_);Z--;)T[Z]=arguments[Z];var B=P<3&&T[0]!==F&&T[P-1]!==F?[]:si(T,F);if(P-=B.length,P<h)return ud(s,l,io,_.placeholder,t,T,B,t,t,h-P);var R=this&&this!==at&&this instanceof _?y:s;return At(R,this,T)}return _}function od(s){return function(l,h,y){var _=Ge(l);if(!Ct(l)){var P=se(h,3);l=He(l),h=function(Z){return P(_[Z],Z,_)}}var T=s(l,h,y);return T>-1?_[P?l[T]:T]:t}}function ad(s){return Vn(function(l){var h=l.length,y=h,_=Jt.prototype.thru;for(s&&l.reverse();y--;){var P=l[y];if(typeof P!="function")throw new jt(a);if(_&&!T&&ao(P)=="wrapper")var T=new Jt([],!0)}for(y=T?y:h;++y<h;){P=l[y];var Z=ao(P),F=Z=="wrapper"?fl(P):t;F&&yl(F[0])&&F[1]==(X|C|z|I)&&!F[4].length&&F[9]==1?T=T[ao(F[0])].apply(T,F[3]):T=P.length==1&&yl(P)?T[Z]():T.thru(P)}return function(){var B=arguments,R=B[0];if(T&&B.length==1&&he(R))return T.plant(R).value();for(var J=0,$=h?l[J].apply(this,B):R;++J<h;)$=l[J].call(this,$);return $}})}function io(s,l,h,y,_,P,T,Z,F,B){var R=l&X,J=l&x,$=l&L,te=l&(C|W),oe=l&K,me=$?t:Jr(s);function ae(){for(var we=arguments.length,xe=U(we),zt=we;zt--;)xe[zt]=arguments[zt];if(te)var wt=ar(ae),Xt=pb(xe,wt);if(y&&(xe=td(xe,y,_,te)),P&&(xe=nd(xe,P,T,te)),we-=Xt,te&&we<B){var Ke=si(xe,wt);return ud(s,l,io,ae.placeholder,h,xe,Ke,Z,F,B-we)}var hn=J?h:this,On=$?hn[s]:s;return we=xe.length,Z?xe=xx(xe,Z):oe&&we>1&&xe.reverse(),R&&F<we&&(xe.length=F),this&&this!==at&&this instanceof ae&&(On=me||Jr(On)),On.apply(hn,xe)}return ae}function ld(s,l){return function(h,y){return W1(h,s,l(y),{})}}function ro(s,l){return function(h,y){var _;if(h===t&&y===t)return l;if(h!==t&&(_=h),y!==t){if(_===t)return y;typeof h=="string"||typeof y=="string"?(h=Ot(h),y=Ot(y)):(h=jh(h),y=jh(y)),_=s(h,y)}return _}}function cl(s){return Vn(function(l){return l=Ae(l,Ft(se())),ye(function(h){var y=this;return s(l,function(_){return At(_,y,h)})})})}function so(s,l){l=l===t?" ":Ot(l);var h=l.length;if(h<2)return h?nl(l,s):l;var y=nl(l,Ys(s/qi(l)));return $i(l)?ui(ln(y),0,s).join(""):y.slice(0,s)}function ix(s,l,h,y){var _=l&x,P=Jr(s);function T(){for(var Z=-1,F=arguments.length,B=-1,R=y.length,J=U(R+F),$=this&&this!==at&&this instanceof T?P:s;++B<R;)J[B]=y[B];for(;F--;)J[B++]=arguments[++Z];return At($,_?h:this,J)}return T}function cd(s){return function(l,h,y){return y&&typeof y!="number"&&_t(l,h,y)&&(h=y=t),l=Fn(l),h===t?(h=l,l=0):h=Fn(h),y=y===t?l<h?1:-1:Fn(y),K1(l,h,y,s)}}function oo(s){return function(l,h){return typeof l=="string"&&typeof h=="string"||(l=$t(l),h=$t(h)),s(l,h)}}function ud(s,l,h,y,_,P,T,Z,F,B){var R=l&C,J=R?T:t,$=R?t:T,te=R?P:t,oe=R?t:P;l|=R?z:D,l&=~(R?D:z),l&M||(l&=-4);var me=[s,l,_,te,J,oe,$,Z,F,B],ae=h.apply(t,me);return yl(s)&&xd(ae,me),ae.placeholder=y,Md(ae,s,l)}function ul(s){var l=je[s];return function(h,y){if(h=$t(h),y=y==null?0:pt(pe(y),292),y&&Mh(h)){var _=(Pe(h)+"e").split("e"),P=l(_[0]+"e"+(+_[1]+y));return _=(Pe(P)+"e").split("e"),+(_[0]+"e"+(+_[1]-y))}return l(h)}}var rx=nr&&1/Fs(new nr([,-0]))[1]==re?function(s){return new nr(s)}:Vl;function hd(s){return function(l){var h=mt(l);return h==Ce?Ua(l):h==It?bb(l):fb(l,s(l))}}function Zn(s,l,h,y,_,P,T,Z){var F=l&L;if(!F&&typeof s!="function")throw new jt(a);var B=y?y.length:0;if(B||(l&=-97,y=_=t),T=T===t?T:Je(pe(T),0),Z=Z===t?Z:pe(Z),B-=_?_.length:0,l&D){var R=y,J=_;y=_=t}var $=F?t:fl(s),te=[s,l,h,y,_,R,J,P,T,Z];if($&&_x(te,$),s=te[0],l=te[1],h=te[2],y=te[3],_=te[4],Z=te[9]=te[9]===t?F?0:s.length:Je(te[9]-B,0),!Z&&l&(C|W)&&(l&=-25),!l||l==x)var oe=tx(s,l,h);else l==C||l==W?oe=nx(s,l,Z):(l==z||l==(x|z))&&!_.length?oe=ix(s,l,h,y):oe=io.apply(t,te);var me=$?Yh:xd;return Md(me(oe,te),s,l)}function dd(s,l,h,y){return s===t||un(s,tr[h])&&!Te.call(y,h)?l:s}function fd(s,l,h,y,_,P){return Fe(s)&&Fe(l)&&(P.set(l,s),qs(s,l,t,fd,P),P.delete(l)),s}function sx(s){return Er(s)?t:s}function pd(s,l,h,y,_,P){var T=h&w,Z=s.length,F=l.length;if(Z!=F&&!(T&&F>Z))return!1;var B=P.get(s),R=P.get(l);if(B&&R)return B==l&&R==s;var J=-1,$=!0,te=h&b?new Zi:t;for(P.set(s,l),P.set(l,s);++J<Z;){var oe=s[J],me=l[J];if(y)var ae=T?y(me,oe,J,l,s,P):y(oe,me,J,s,l,P);if(ae!==t){if(ae)continue;$=!1;break}if(te){if(!Aa(l,function(we,xe){if(!Dr(te,xe)&&(oe===we||_(oe,we,h,y,P)))return te.push(xe)})){$=!1;break}}else if(!(oe===me||_(oe,me,h,y,P))){$=!1;break}}return P.delete(s),P.delete(l),$}function ox(s,l,h,y,_,P,T){switch(h){case wn:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case ti:return!(s.byteLength!=l.byteLength||!P(new ks(s),new ks(l)));case Ye:case Re:case ot:return un(+s,+l);case ze:return s.name==l.name&&s.message==l.message;case xi:case qn:return s==l+"";case Ce:var Z=Ua;case It:var F=y&w;if(Z||(Z=Fs),s.size!=l.size&&!F)return!1;var B=T.get(s);if(B)return B==l;y|=b,T.set(s,l);var R=pd(Z(s),Z(l),y,_,P,T);return T.delete(s),R;case ei:if(Kr)return Kr.call(s)==Kr.call(l)}return!1}function ax(s,l,h,y,_,P){var T=h&w,Z=hl(s),F=Z.length,B=hl(l),R=B.length;if(F!=R&&!T)return!1;for(var J=F;J--;){var $=Z[J];if(!(T?$ in l:Te.call(l,$)))return!1}var te=P.get(s),oe=P.get(l);if(te&&oe)return te==l&&oe==s;var me=!0;P.set(s,l),P.set(l,s);for(var ae=T;++J<F;){$=Z[J];var we=s[$],xe=l[$];if(y)var zt=T?y(xe,we,$,l,s,P):y(we,xe,$,s,l,P);if(!(zt===t?we===xe||_(we,xe,h,y,P):zt)){me=!1;break}ae||(ae=$=="constructor")}if(me&&!ae){var wt=s.constructor,Xt=l.constructor;wt!=Xt&&"constructor"in s&&"constructor"in l&&!(typeof wt=="function"&&wt instanceof wt&&typeof Xt=="function"&&Xt instanceof Xt)&&(me=!1)}return P.delete(s),P.delete(l),me}function Vn(s){return _l(wd(s,t,Gd),s+"")}function hl(s){return Ah(s,He,ml)}function dl(s){return Ah(s,Tt,md)}var fl=js?function(s){return js.get(s)}:Vl;function ao(s){for(var l=s.name+"",h=ir[l],y=Te.call(ir,l)?h.length:0;y--;){var _=h[y],P=_.func;if(P==null||P==s)return _.name}return l}function ar(s){var l=Te.call(S,"placeholder")?S:s;return l.placeholder}function se(){var s=S.iteratee||Wl;return s=s===Wl?Dh:s,arguments.length?s(arguments[0],arguments[1]):s}function lo(s,l){var h=s.__data__;return mx(l)?h[typeof l=="string"?"string":"hash"]:h.map}function pl(s){for(var l=He(s),h=l.length;h--;){var y=l[h],_=s[y];l[h]=[y,_,vd(_)]}return l}function Ai(s,l){var h=vb(s,l);return Oh(h)?h:t}function lx(s){var l=Te.call(s,Gi),h=s[Gi];try{s[Gi]=t;var y=!0}catch{}var _=Xs.call(s);return y&&(l?s[Gi]=h:delete s[Gi]),_}var ml=Ka?function(s){return s==null?[]:(s=Ge(s),ii(Ka(s),function(l){return bh.call(s,l)}))}:Il,md=Ka?function(s){for(var l=[];s;)ri(l,ml(s)),s=Ks(s);return l}:Il,mt=vt;(Na&&mt(new Na(new ArrayBuffer(1)))!=wn||Xr&&mt(new Xr)!=Ce||Ba&&mt(Ba.resolve())!=bi||nr&&mt(new nr)!=It||Ur&&mt(new Ur)!=Si)&&(mt=function(s){var l=vt(s),h=l==Lt?s.constructor:t,y=h?Fi(h):"";if(y)switch(y){case Bb:return wn;case Yb:return Ce;case Rb:return bi;case jb:return It;case Jb:return Si}return l});function cx(s,l,h){for(var y=-1,_=h.length;++y<_;){var P=h[y],T=P.size;switch(P.type){case"drop":s+=T;break;case"dropRight":l-=T;break;case"take":l=pt(l,s+T);break;case"takeRight":s=Je(s,l-T);break}}return{start:s,end:l}}function ux(s){var l=s.match(gw);return l?l[1].split(yw):[]}function gd(s,l,h){l=ci(l,s);for(var y=-1,_=l.length,P=!1;++y<_;){var T=Mn(l[y]);if(!(P=s!=null&&h(s,T)))break;s=s[T]}return P||++y!=_?P:(_=s==null?0:s.length,!!_&&go(_)&&In(T,_)&&(he(s)||Oi(s)))}function hx(s){var l=s.length,h=new s.constructor(l);return l&&typeof s[0]=="string"&&Te.call(s,"index")&&(h.index=s.index,h.input=s.input),h}function yd(s){return typeof s.constructor=="function"&&!Qr(s)?rr(Ks(s)):{}}function dx(s,l,h){var y=s.constructor;switch(l){case ti:return ll(s);case Ye:case Re:return new y(+s);case wn:return Q1(s,h);case Ir:case Ar:case ji:case Fr:case Or:case Ji:case Li:case O:case E:return qh(s,h);case Ce:return new y;case ot:case qn:return new y(s);case xi:return H1(s);case It:return new y;case ei:return E1(s)}}function fx(s,l){var h=l.length;if(!h)return s;var y=h-1;return l[y]=(h>1?"& ":"")+l[y],l=l.join(h>2?", ":" "),s.replace(mw,`{
|
|
975
|
+
`)},n.needsUpdate=!0}_applyIconLabelPoint(e,t){return!0}_applyLineStyle(e){const t=this.config;if(e.isLine2){const n=e.material;return t.color!==void 0&&n.color.set(t.color),t.width!==void 0&&(n.linewidth=t.width),t.opacity!==void 0&&(n.opacity=t.opacity,n.transparent=t.opacity<1),n.needsUpdate=!0,!0}if(e.parent){let i=e.parent;i._toThreeJSGeometry&&i._toThreeJSGeometry()}return!0}_applyFlowLineStyle(e){return!0}_applyArrowLineStyle(e){return!0}_applyFlowTextureLineStyle(e){return!0}_applyPolygonStyle(e){const t=this.config;return e.traverse(i=>{i instanceof p.Mesh&&(Array.isArray(i.material)?i.material:[i.material]).forEach(o=>{t.color!==void 0&&o.color.set(t.color),t.opacity!==void 0&&(o.opacity=t.opacity,o.transparent=t.opacity<1),t.wireframe!==void 0&&(o.wireframe=t.wireframe),o.needsUpdate=!0})}),!0}_applyExtrudeStyle(e){return!0}_applyWaterStyle(e){return!0}_applyCloudStyle(e){return!0}_applyTextSpriteStyle(e){return!0}_applyLightStyle(e){return!0}async _applyModelStyle(e){return!0}async _applyCustomStyle(e){const i=await this.config.build();return e instanceof p.Group&&(e.clear(),e.add(i)),!0}static async _loadTexture(e){if(Dn._textureCache.has(e))return Dn._textureCache.get(e);const t=await new Promise((i,n)=>{Dn._textureLoader.load(e,i,void 0,n)});return t.needsUpdate=!0,Dn._textureCache.set(e,t),t}static create(e){return e instanceof Dn?e:new Dn(e)}};kc($o,"_textureCache",new Map),kc($o,"_textureLoader",new p.TextureLoader);let Mt=$o;const it=[];for(let r=0;r<256;++r)it.push((r+256).toString(16).slice(1));function Vg(r,e=0){return(it[r[e+0]]+it[r[e+1]]+it[r[e+2]]+it[r[e+3]]+"-"+it[r[e+4]]+it[r[e+5]]+"-"+it[r[e+6]]+it[r[e+7]]+"-"+it[r[e+8]]+it[r[e+9]]+"-"+it[r[e+10]]+it[r[e+11]]+it[r[e+12]]+it[r[e+13]]+it[r[e+14]]+it[r[e+15]]).toLowerCase()}let qo;const Ig=new Uint8Array(16);function Ag(){if(!qo){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qo=crypto.getRandomValues.bind(crypto)}return qo(Ig)}const Kc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fg(r,e,t){if(Kc.randomUUID&&!r)return Kc.randomUUID();r=r||{};const i=r.random??r.rng?.()??Ag();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Vg(i)}var Nc=(r=>(r.POINT="point",r.LINE_VERTEX="line_vertex",r.POLYGON_CENTER="polygon_center",r.LABEL="label",r.ICON="icon",r.CLUSTER="cluster",r))(Nc||{}),yi=(r=>(r.NO_COLLISION="no_collision",r.PRIORITY_LOST="priority_lost",r.OUT_OF_VIEWPORT="out_of_viewport",r.ZOOM_FILTERED="zoom_filtered",r.MANUAL_HIDDEN="manual_hidden",r.GROUP_COLLISION="group_collision",r))(yi||{}),Og=Object.defineProperty,Dg=(r,e,t)=>e in r?Og(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Lr=(r,e,t)=>Dg(r,typeof e!="symbol"?e+"":e,t);class zg extends cs{constructor(){super(...arguments),Lr(this,"_isDragging",!1),Lr(this,"_lastCoord",null),Lr(this,"_boundOnMouseDown",this._onMouseDown.bind(this)),Lr(this,"_boundOnMouseMove",this._onMouseMove.bind(this)),Lr(this,"_boundOnMouseUp",this._onMouseUp.bind(this))}addHooks(){this.target.on("mousedown",this._boundOnMouseDown)}removeHooks(){this.target.off("mousedown",this._boundOnMouseDown),this._stopDrag()}_onMouseDown(e){const t=this.target.getMap();!t||!this.target.options.draggable||(this._isDragging=!0,this._lastCoord=e.coordinate,t.viewer.config("draggable",!1),t.on("mousemove",this._boundOnMouseMove),t.on("mouseup",this._boundOnMouseUp),this.target.trigger("dragstart",e))}_onMouseMove(e){if(!this._isDragging||!this._lastCoord||!e.coordinate)return;const t=e.coordinate,i=t[0]-this._lastCoord[0],n=t[1]-this._lastCoord[1];Math.abs(i)<1e-8&&Math.abs(n)<1e-8||(this._translate(i,n),this._lastCoord=t,this.target.trigger("dragging",e))}_onMouseUp(e){this._stopDrag(),this.target.trigger("dragend",e)}_stopDrag(){this._isDragging=!1;const e=this.target.getMap();e&&(e.viewer.config("draggable",!0),e.off("mousemove",this._boundOnMouseMove),e.off("mouseup",this._boundOnMouseUp))}_translate(e,t){const i=this.target._geometry;if(!i||!i.coordinates)return;const n=a=>Array.isArray(a[0])?a.map(n):[a[0]+e,a[1]+t],o=n(i.coordinates);i.coordinates=o,this.target._onPositionChanged(!0)}}var Xg=Object.defineProperty,Ug=(r,e,t)=>e in r?Xg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zt=(r,e,t)=>Ug(r,typeof e!="symbol"?e+"":e,t);class ut extends jo(Ki(yn(p.Object3D))){constructor(e){super(),Zt(this,"_position"),Zt(this,"_threeGeometry"),Zt(this,"_geometry"),Zt(this,"_layer"),Zt(this,"_style"),Zt(this,"_id"),Zt(this,"_styleQueue",[]),Zt(this,"_isApplyingStyle",!1),Zt(this,"_isGeometryInitializing",!1),Zt(this,"_bloomConfig"),Zt(this,"_collisionState",{visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:Date.now()}),Zt(this,"_collisionConfig",{enabled:!0,priority:50,padding:4,minZoom:0,maxZoom:24}),Zt(this,"_animationRef",null),ko(e.geometry,"geometry","geometry must be specified"),this._geometry=e.geometry,this._position=new p.Vector3(0,0,0),this._threeGeometry=new p.Object3D,this.options={draggable:e.draggable||!1,editable:e.editable||!1},e.userData&&(this.userData=Object.assign({},JSON.parse(JSON.stringify(e.userData)))),e.style&&this.setStyle(e.style),e.id?this._id=e.id:this._id=Fg(),this.addHandler("draggable",zg)}async initializeGeometry(){if(!(this._isGeometryInitializing||this._threeGeometry)){this._isGeometryInitializing=!0;try{await this._toThreeJSGeometry(),this._processStyleQueue()}finally{this._isGeometryInitializing=!1}}}_updateGeometryPositions(){this._toThreeJSGeometry()}setStyle(e){const t=e instanceof Mt?e:new Mt(e);this._style=t;const i=JSON.parse(JSON.stringify(t.config));return this._styleQueue.push(i),this._tryProcessQueue(),this}getStyle(){return this._style}setBloom(e,t){const i=this._bloomConfig||{intensity:1,color:"#ffffff"};return this._bloomConfig={enabled:e,intensity:t?.intensity??i.intensity,color:t?.color??i.color},this._threeGeometry&&this._applyBloomToObject(this._threeGeometry),this}getBloom(){return this._bloomConfig}_applyBloomToObject(e){if(!this._bloomConfig)return;const{enabled:t,intensity:i,color:n}=this._bloomConfig;e.traverse(o=>{if(o instanceof p.Points&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={size:a.size,sizeAttenuation:a.sizeAttenuation});const c=o.userData.__bloomBackup;t?(a.size=c.size*(1+i),a.sizeAttenuation=!1):(a.size=c.size,a.sizeAttenuation=c.sizeAttenuation),a.needsUpdate=!0;return}if(o.type==="Sprite"&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.userData.__bloomBackup;t?(a.color&&c.color&&(a.color.copy(c.color),n&&n!=="#ffffff"&&a.color.setStyle(n),a.color.multiplyScalar(1+i*2)),a.opacity=Math.min(1,(c.opacity??1)*(1+i*.3))):(c.color&&a.color&&a.color.copy(c.color),a.opacity=c.opacity),a.needsUpdate=!0;return}if(o.isLine2&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.userData.__bloomBackup;t?(a.color&&c.color&&(a.color.copy(c.color),n&&n!=="#ffffff"&&a.color.setStyle(n),a.color.multiplyScalar(1+i*2)),a.opacity=Math.min(1,(c.opacity??1)*(1+i*.3))):(c.color&&a.color&&a.color.copy(c.color),a.opacity=c.opacity),a.needsUpdate=!0;return}o instanceof p.Mesh&&o.material&&(Array.isArray(o.material)?o.material:[o.material]).forEach(c=>{o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={emissiveIntensity:c.emissiveIntensity??0,emissiveColor:c.emissive?c.emissive.clone():null,color:c.color?c.color.clone():null});const h=o.userData.__bloomBackup;t?"emissive"in c&&c.emissive?(c.emissiveIntensity=i,n&&n!=="#ffffff"&&c.emissive.setStyle?c.emissive.setStyle(n):h.color&&c.emissive&&c.emissive.copy(h.color)):c.color&&(h.color&&c.color.copy(h.color),n&&n!=="#ffffff"?c.color.setStyle(n):c.color.multiplyScalar(1+i*.3)):("emissiveIntensity"in c&&(c.emissiveIntensity=h.emissiveIntensity!==void 0?h.emissiveIntensity:0),h.emissiveColor&&c.emissive&&c.emissive.copy(h.emissiveColor),h.color&&c.color&&c.color.copy(h.color)),c.needsUpdate=!0})})}async _applyStyleWithRetry(e,t=3,i=100){let n=null;for(let o=1;o<=t;o++)try{this._threeGeometry.parent||(this.add(this._threeGeometry),await new Promise(c=>requestAnimationFrame(c))),await e.applyTo(this._threeGeometry);const a=e.config;if(a.bloom!==void 0){const c=a.bloom;typeof c=="boolean"?this._bloomConfig={enabled:c,intensity:1,color:"#ffffff"}:this._bloomConfig={enabled:c.enabled??!0,intensity:c.intensity??1,color:c.color??"#ffffff"}}this._bloomConfig&&this._threeGeometry&&this._applyBloomToObject(this._threeGeometry);return}catch(a){if(n=a,o<t){const c=i*Math.pow(2,o-1);await new Promise(h=>setTimeout(h,c))}}throw n||new Error("样式应用失败,重试次数耗尽")}async _processStyleQueue(){if(!this._threeGeometry||this._isApplyingStyle||this._styleQueue.length===0)return;this._isApplyingStyle=!0;const e=this._styleQueue[0];try{const t=new Mt(JSON.parse(JSON.stringify(e)));await this._applyStyleWithRetry(t),this._styleQueue.shift(),this._styleQueue.length>0&&await this._processStyleQueue()}catch(t){throw t}finally{this._isApplyingStyle=!1,this._styleQueue.length>0&&this._tryProcessQueue()}}_tryProcessQueue(){this._threeGeometry&&!this._isApplyingStyle&&this._styleQueue.length>0?this._processStyleQueue().catch(t=>{this._isApplyingStyle=!1,this._tryProcessQueue(),console.warn(t)}):!this._threeGeometry&&!this._isGeometryInitializing&&this.initializeGeometry()}addTo(e){return e.addFeature(this),this}getLayer(){return this._layer||null}getMap(){return this._layer?this._layer.getMap():null}setCoordinates(e){return this._geometry.coordinates=e,this._onPositionChanged(),this}_onPositionChanged(e=!1){e&&this._threeGeometry?this._updateGeometryPositions():this._toThreeJSGeometry(),this.trigger("positionchange")}getCenter(){return this._geometry.type==="Point"?this._geometry.coordinates:[0,0]}_bindLayer(e){if(this._layer&&this._layer!==e)throw new Error("Feature cannot be added to multiple layers");this._layer=e}_updateGeometry(){this._disposeGeometry(),this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry?.userData?._type==="Model"?this._threeGeometry.renderOrder=0:this._threeGeometry.renderOrder=99,this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue())}_remove(){return this.getLayer()?(this._unbind(),this):this}_unbind(){const e=this.getLayer();e&&(e.onRemoveFeature&&e.onRemoveFeature(this),delete this._layer)}_disposeGeometry(){this._threeGeometry&&(this.clear(),"traverse"in this&&this._threeGeometry.traverse(e=>{e instanceof p.Mesh?(e.geometry?.dispose(),Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material?.dispose()):"isLine"in e&&e.isLine&&(e.geometry?.dispose(),e.material?.dispose())}))}get collidable(){return this._collisionConfig.enabled}get collisionType(){return Nc.POINT}getCollisionPriority(){return this.userData.collisionPriority??this._style?.config.collisionPriority??this._collisionConfig.priority}getScreenBoundingBox(e,t){if(!this.collidable)return null;try{const i=new p.Vector3;this._threeGeometry.getWorldPosition(i);const n=i.clone().project(e);if(!(n.x>=-1.1&&n.x<=1.1&&n.y>=-1.1&&n.y<=1.1&&n.z>=-1&&n.z<=1))return null;const{width:a,height:c}=t.domElement,h=(n.x*.5+.5)*a,d=(-n.y*.5+.5)*c,m=this._calculateCollisionBoundingBox(e,t);return m?{id:this._id,x:h+m.offsetX,y:d+m.offsetY,width:20+this._collisionConfig.padding*2,height:20+this._collisionConfig.padding*2,priority:this.getCollisionPriority(),featureId:this._id,layerId:this._layer?.getId()||"unknown",type:this.collisionType,data:this.getCollisionData()}:null}catch(i){return console.warn(`Feature ${this._id} 包围盒计算失败:`,i),null}}setCollisionVisibility(e,t=yi.MANUAL_HIDDEN){this._collisionState.visible!==e&&(this._animationRef!==null&&(cancelAnimationFrame(this._animationRef),this._animationRef=null),this.visible=e,this._applyFinalAlpha(e?1:0),this._collisionState={visible:e,reason:t,collidedWith:e?[]:this._collisionState.collidedWith,timestamp:Date.now()})}getCollisionVisibility(){return this._collisionState.visible}setCollisionConfig(e){return Object.assign(this._collisionConfig,e),this}enableCollision(){return this._collisionConfig.enabled=!0,this}disableCollision(){return this._collisionConfig.enabled=!1,this.setCollisionVisibility(!0,yi.MANUAL_HIDDEN),this}_applyVisibilityAlpha(e){this.traverse(t=>{t instanceof p.Mesh&&(Array.isArray(t.material)?t.material.forEach(i=>{i.opacity!==void 0&&(i.opacity=e)}):t.material.opacity!==void 0&&(t.material.opacity=e))})}_applyFinalAlpha(e){this._applyVisibilityAlpha(e),this.traverse(t=>{t instanceof p.Mesh&&(t.material.needsUpdate=!0)})}getCollisionData(){return{featureType:this.constructor.name,userData:this.userData,styleConfig:this._style?.config}}_calculateCollisionBoundingBox(e,t){if(!this.visible||!this._threeGeometry||!e||!t)return null;try{const i=new p.Box3().setFromObject(this._threeGeometry);if(i.isEmpty())return this._getFallbackBoundingBox();const n=[new p.Vector3(i.min.x,i.min.y,i.min.z),new p.Vector3(i.max.x,i.min.y,i.min.z),new p.Vector3(i.min.x,i.max.y,i.min.z),new p.Vector3(i.max.x,i.max.y,i.min.z),new p.Vector3(i.min.x,i.min.y,i.max.z),new p.Vector3(i.max.x,i.min.y,i.max.z),new p.Vector3(i.min.x,i.max.y,i.max.z),new p.Vector3(i.max.x,i.max.y,i.max.z)],{width:o,height:a}=t.domElement,c=[];n.forEach(z=>{const D=z.clone().project(e),X=(D.x*.5+.5)*o,I=(-D.y*.5+.5)*a;c.push(new p.Vector2(X,I))});let h=1/0,d=-1/0,m=1/0,f=-1/0;c.forEach(z=>{h=Math.min(h,z.x),d=Math.max(d,z.x),m=Math.min(m,z.y),f=Math.max(f,z.y)});const g=d-h,v=f-m,w=4,b=Math.max(g,w),x=Math.max(v,w),L=new p.Vector3;i.getCenter(L);const M=L.clone().project(e),C=(M.x*.5+.5)*o,W=(-M.y*.5+.5)*a;return{width:b,height:x,offsetX:h-C,offsetY:m-W}}catch(i){return console.warn("Bounding box calculation failed 包围盒计算失败:",i),this._getFallbackBoundingBox()}}_getFallbackBoundingBox(){return{width:20,height:20,offsetX:-10,offsetY:-10}}_tileCoordToLocalWorld(e,t,i,n){const{tileZ:o,tileX:a,tileY:c,extent:h,tileSize:d}=i,m=(e/h-.5)*d,f=(.5-t/h)*d;return n.tileIDToWorldCenter(o,a,c).clone().add(new p.Vector3(m,f,0)).sub(n.prjcenter)}}var kg=Object.defineProperty,Kg=(r,e,t)=>e in r?kg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bc=(r,e,t)=>Kg(r,typeof e!="symbol"?e+"":e,t);class Bi extends ps{constructor(e,t){super(e,t),Bc(this,"_feaList"),Bc(this,"_collision",!1),this._feaList=[],t?.collision&&(this._collision=!0)}addFeature(e){const t=Array.isArray(e)?e:[e];for(const i of t)if(!(!i||!(i instanceof ut))&&!i.getLayer()){if(!this.validateFeature(i)){console.error(`Feature ${i.id} does not match the layer's type requirements`);continue}i._bindLayer(this),this._feaList.push(i),i.getMap()&&i._toThreeJSGeometry(),this._clouds&&(this.map.viewer.scene.add(this._clouds),console.log("我是云朵被添加cloud",this.map.viewer.scene)),this.add(i)}return this}getFeatures(e,t){if(!e)return this._feaList.slice(0);const i=[];let n,o;for(let a=0,c=this._feaList.length;a<c;a++)n=this._feaList[a],t?o=e.call(t,n):o=e(n),o&&i.push(n);return i}getCount(){return this._feaList.length}isEmpty(){return!this._feaList.length}removeFeature(e){if(!Array.isArray(e))return this.removeFeature([e]);for(let t=e.length-1;t>=0;t--)e[t]instanceof ut||(e[t]=this.removeFeature(e[t])),!(!e[t]||this!==e[t].getLayer())&&e[t]._remove();return this}clear(){const e=this._feaList.slice();for(const t of e)t._remove();return this}onRemoveFeature(e){if(!e)return;const t=e.getLayer();if(!t||t!==this)return;const i=this._findInList(e);i>=0&&this._feaList.splice(i,1),e.parent&&e.parent===this?this.remove(e):console.warn("Feature parent mismatch:",e.parent),this._disposeFeatureResources(e)}_findInList(e){const t=this._feaList.length;if(t===0)return-1;let i=0,n=t-1,o;for(;i<=n;){if(o=Math.floor((i+n)/2),this._feaList[o]===e)return o;i=o+1}return-1}_disposeFeatureResources(e){try{e.geometry&&e.geometry.dispose&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose?.()):e.material.dispose&&e.material.dispose()),e instanceof p.Object3D&&e.traverse(t=>{t!==e&&this._disposeFeatureResources(t)})}catch(t){console.error("Error disposing feature resources:",t)}}_mergedGeometry(){this.traverse(e=>{e.isMesh&&e.geometry&&e.material&&console.log("Merging geometry 几何体合并中",e)})}setCollisionEngine(e){return this._collisionEngine=e,this}}var Ng=Object.defineProperty,Bg=(r,e,t)=>e in r?Ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yc=(r,e,t)=>Bg(r,typeof e!="symbol"?e+"":e,t);class Yg extends p.Group{constructor(){super(...arguments),Yc(this,"_layers",new Set),Yc(this,"_layerids",new Set)}add(...e){return e.forEach(t=>{if(!(t instanceof ps))throw new Error("LayerContainer can only contain Layer instances! LayerContainer只能包含Layer实例!");const i=t.getId();if(this._layerids.has(i))throw new Error(`Layer with ID '${i}' already exists in the container! ID为'${i}'的图层已存在于容器中!`);this._layers.add(t),this._layerids.add(i),super.add(t)}),this}remove(...e){return e.forEach(t=>{this._layers.delete(t),this._layerids.delete(t.getId()),super.remove(t)}),this}getLayers(){return Array.from(this._layers)}getLayerById(e){for(const t of this._layers)if(t.getId()===e)return t}clearLayers(){return this._layers.clear(),this._layerids.clear(),super.clear(),this}}var Rg=Object.defineProperty,jg=(r,e,t)=>e in r?Rg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jg=(r,e,t)=>jg(r,e+"",t);class Qg{constructor(){Jg(this,"canvasDict",{})}getCanvas(e=40,t=30,i=1,n){const o=Math.ceil(e*i),a=Math.ceil(t*i),c=n?`${o}_${a}_${n}`:`${o}_${a}`;if(!this.canvasDict[c]){const m=document.createElement("canvas");m.width=o,m.height=a,this.canvasDict[c]=m}const h=this.canvasDict[c],d=h.getContext("2d");return d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,h.width,h.height),d.scale(i,i),h}}function Hg(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return Rc(this.cover(e,t),e,t,r)}function Rc(r,e,t,i){if(isNaN(e)||isNaN(t))return r;var n,o=r._root,a={data:i},c=r._x0,h=r._y0,d=r._x1,m=r._y1,f,g,v,w,b,x,L,M;if(!o)return r._root=a,r;for(;o.length;)if((b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(h+m)/2))?h=g:m=g,n=o,!(o=o[L=x<<1|b]))return n[L]=a,r;if(v=+r._x.call(null,o.data),w=+r._y.call(null,o.data),e===v&&t===w)return a.next=o,n?n[L]=a:r._root=a,r;do n=n?n[L]=new Array(4):r._root=new Array(4),(b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(h+m)/2))?h=g:m=g;while((L=x<<1|b)===(M=(w>=g)<<1|v>=f));return n[M]=o,n[L]=a,r}function Eg(r){var e,t,i=r.length,n,o,a=new Array(i),c=new Array(i),h=1/0,d=1/0,m=-1/0,f=-1/0;for(t=0;t<i;++t)isNaN(n=+this._x.call(null,e=r[t]))||isNaN(o=+this._y.call(null,e))||(a[t]=n,c[t]=o,n<h&&(h=n),n>m&&(m=n),o<d&&(d=o),o>f&&(f=o));if(h>m||d>f)return this;for(this.cover(h,d).cover(m,f),t=0;t<i;++t)Rc(this,a[t],c[t],r[t]);return this}function $g(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,i=this._y0,n=this._x1,o=this._y1;if(isNaN(t))n=(t=Math.floor(r))+1,o=(i=Math.floor(e))+1;else{for(var a=n-t||1,c=this._root,h,d;t>r||r>=n||i>e||e>=o;)switch(d=(e<i)<<1|r<t,h=new Array(4),h[d]=c,c=h,a*=2,d){case 0:n=t+a,o=i+a;break;case 1:t=n-a,o=i+a;break;case 2:n=t+a,i=o-a;break;case 3:t=n-a,i=o-a;break}this._root&&this._root.length&&(this._root=c)}return this._x0=t,this._y0=i,this._x1=n,this._y1=o,this}function qg(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function e0(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function yt(r,e,t,i,n){this.node=r,this.x0=e,this.y0=t,this.x1=i,this.y1=n}function t0(r,e,t){var i,n=this._x0,o=this._y0,a,c,h,d,m=this._x1,f=this._y1,g=[],v=this._root,w,b;for(v&&g.push(new yt(v,n,o,m,f)),t==null?t=1/0:(n=r-t,o=e-t,m=r+t,f=e+t,t*=t);w=g.pop();)if(!(!(v=w.node)||(a=w.x0)>m||(c=w.y0)>f||(h=w.x1)<n||(d=w.y1)<o))if(v.length){var x=(a+h)/2,L=(c+d)/2;g.push(new yt(v[3],x,L,h,d),new yt(v[2],a,L,x,d),new yt(v[1],x,c,h,L),new yt(v[0],a,c,x,L)),(b=(e>=L)<<1|r>=x)&&(w=g[g.length-1],g[g.length-1]=g[g.length-1-b],g[g.length-1-b]=w)}else{var M=r-+this._x.call(null,v.data),C=e-+this._y.call(null,v.data),W=M*M+C*C;if(W<t){var z=Math.sqrt(t=W);n=r-z,o=e-z,m=r+z,f=e+z,i=v.data}}return i}function i0(r){if(isNaN(m=+this._x.call(null,r))||isNaN(f=+this._y.call(null,r)))return this;var e,t=this._root,i,n,o,a=this._x0,c=this._y0,h=this._x1,d=this._y1,m,f,g,v,w,b,x,L;if(!t)return this;if(t.length)for(;;){if((w=m>=(g=(a+h)/2))?a=g:h=g,(b=f>=(v=(c+d)/2))?c=v:d=v,e=t,!(t=t[x=b<<1|w]))return this;if(!t.length)break;(e[x+1&3]||e[x+2&3]||e[x+3&3])&&(i=e,L=x)}for(;t.data!==r;)if(n=t,!(t=t.next))return this;return(o=t.next)&&delete t.next,n?(o?n.next=o:delete n.next,this):e?(o?e[x]=o:delete e[x],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[L]=t:this._root=t),this):(this._root=o,this)}function n0(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function r0(){return this._root}function s0(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function o0(r){var e=[],t,i=this._root,n,o,a,c,h;for(i&&e.push(new yt(i,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(i=t.node,o=t.x0,a=t.y0,c=t.x1,h=t.y1)&&i.length){var d=(o+c)/2,m=(a+h)/2;(n=i[3])&&e.push(new yt(n,d,m,c,h)),(n=i[2])&&e.push(new yt(n,o,m,d,h)),(n=i[1])&&e.push(new yt(n,d,a,c,m)),(n=i[0])&&e.push(new yt(n,o,a,d,m))}return this}function a0(r){var e=[],t=[],i;for(this._root&&e.push(new yt(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var n=i.node;if(n.length){var o,a=i.x0,c=i.y0,h=i.x1,d=i.y1,m=(a+h)/2,f=(c+d)/2;(o=n[0])&&e.push(new yt(o,a,c,m,f)),(o=n[1])&&e.push(new yt(o,m,c,h,f)),(o=n[2])&&e.push(new yt(o,a,f,m,d)),(o=n[3])&&e.push(new yt(o,m,f,h,d))}t.push(i)}for(;i=t.pop();)r(i.node,i.x0,i.y0,i.x1,i.y1);return this}function l0(r){return r[0]}function c0(r){return arguments.length?(this._x=r,this):this._x}function h0(r){return r[1]}function u0(r){return arguments.length?(this._y=r,this):this._y}function jc(r,e,t){var i=new ea(e??l0,t??h0,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function ea(r,e,t,i,n,o){this._x=r,this._y=e,this._x0=t,this._y0=i,this._x1=n,this._y1=o,this._root=void 0}function Jc(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var vt=jc.prototype=ea.prototype;vt.copy=function(){var r=new ea(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,i;if(!e)return r;if(!e.length)return r._root=Jc(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var n=0;n<4;++n)(i=e.source[n])&&(i.length?t.push({source:i,target:e.target[n]=new Array(4)}):e.target[n]=Jc(i));return r},vt.add=Hg,vt.addAll=Eg,vt.cover=$g,vt.data=qg,vt.extent=e0,vt.find=t0,vt.remove=i0,vt.removeAll=n0,vt.root=r0,vt.size=s0,vt.visit=o0,vt.visitAfter=a0,vt.x=c0,vt.y=u0;var d0=Object.defineProperty,f0=(r,e,t)=>e in r?d0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qc=(r,e,t)=>f0(r,typeof e!="symbol"?e+"":e,t);class Hc{constructor(e){Qc(this,"_quadtree"),Qc(this,"_viewport"),this._viewport=e,this._rebuildQuadTree()}updateViewport(e){(e.width!==this._viewport.width||e.height!==this._viewport.height)&&(this._viewport=e,this._rebuildQuadTree())}addBoxes(e){e.forEach(t=>{this._isBoxInViewport(t)&&this._quadtree.add(t)})}findCollisions(e){const t=[],i=this._getSearchBounds(e);return this._quadtree.visit((n,o,a,c,h)=>this._checkNodeCollision(i,o,a,c,h)?(n.length||this._getNodeData(n).forEach(m=>{m.id!==e.id&&this._checkBoxCollision(e,m)&&t.push(m)}),!1):void 0),t}clear(){this._rebuildQuadTree()}getAllBoxes(){const e=[];return this._quadtree.visit(t=>{if(!t.length){const i=this._getNodeData(t);e.push(...i)}return!1}),e}_rebuildQuadTree(){this._quadtree=jc().x(e=>e.x).y(e=>e.y).extent([[0,0],[this._viewport.width,this._viewport.height]])}_isBoxInViewport(e){const t=e.width/2,i=e.height/2;return e.x+t>=0&&e.x-t<=this._viewport.width&&e.y+i>=0&&e.y-i<=this._viewport.height}_getSearchBounds(e){return{x:e.x,y:e.y,width:e.width*2,height:e.height*2}}_checkNodeCollision(e,t,i,n,o){const a=(t+n)/2,c=(i+o)/2,h=n-t,d=o-i;return Math.abs(e.x-a)*2<e.width+h&&Math.abs(e.y-c)*2<e.height+d}_checkBoxCollision(e,t){return Math.abs(e.x-t.x)*2<e.width+t.width&&Math.abs(e.y-t.y)*2<e.height+t.height}_getNodeData(e){return e?Array.isArray(e.data)?e.data:e.data?[e.data]:[]:[]}removeBox(e){const i=this.getAllBoxes().filter(n=>n.id!==e);this.clear(),i.length>0&&this.addBoxes(i)}}var p0=Object.defineProperty,m0=(r,e,t)=>e in r?p0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ec=(r,e,t)=>m0(r,typeof e!="symbol"?e+"":e,t);class g0{constructor(){Ec(this,"_strategies",new Map),Ec(this,"_executionOrder",[])}registerStrategy(e,t){return this._strategies.set(e.name,e),t!==void 0?this._executionOrder.splice(t,0,e.name):this._executionOrder.push(e.name),this}async executeStrategies(e,t){const i=new Map;e.forEach(n=>{i.set(n._id,{featureId:n._id,visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})});for(const n of this._executionOrder){const o=this._strategies.get(n);if(o?.enabled)try{const a=await o.execute(e,t,i);this._mergeResults(i,a)}catch(a){console.error(`Strategy ${n} execution failed: 策略 ${n} 执行失败:`,a)}}return i}_mergeResults(e,t){t.forEach(i=>{const n=e.get(i.featureId);n&&!n.visible||e.set(i.featureId,i)})}}var y0=Object.defineProperty,v0=(r,e,t)=>e in r?y0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_n=(r,e,t)=>v0(r,typeof e!="symbol"?e+"":e,t);class _0{constructor(){_n(this,"frameStats",new Map),_n(this,"summaryStats",{totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0}),_n(this,"sampleWindowSize",60),_n(this,"currentFrameId",0),_n(this,"lastReportTime",0),_n(this,"reportInterval",5e3),_n(this,"performanceThresholds",{criticalFrameTime:33,warningFrameTime:16,idealFrameTime:8}),this.lastReportTime=Date.now()}startFrame(e){this.currentFrameId=e;const t={frameId:e,startTime:performance.now(),endTime:0,duration:0,featureCount:0,visibleCount:0,hiddenCount:0,collisionChecks:0,memoryUsage:0,strategyTimes:new Map};this.frameStats.set(e,t),this.cleanupOldFrames()}endFrame(e,t){const i=this.frameStats.get(e);if(!i)return;const n=performance.now();i.endTime=n,i.duration=n-i.startTime,t&&Object.assign(i,t),"memory"in performance&&(i.memoryUsage=performance.memory.usedJSHeapSize),this.updateSummaryStats(i),this.maybeOutputReport()}recordStrategyTime(e,t){const i=this.frameStats.get(this.currentFrameId);i&&i.strategyTimes.set(e,t)}recordCollisionChecks(e){const t=this.frameStats.get(this.currentFrameId);t&&(t.collisionChecks+=e)}getStats(){const e=this.getRecentFrames(this.sampleWindowSize),t=this.calculateFPS(e),i=this.calculateAverageFrameTime(e);return{summary:{...this.summaryStats},recent:{fps:t,frameTime:i,frameTimeStdDev:this.calculateFrameTimeStdDev(e),averageFeaturesPerFrame:this.calculateAverageFeatures(e),performanceLevel:this.getPerformanceLevel(i)},currentFrame:this.frameStats.get(this.currentFrameId)||null,strategies:this.getStrategyPerformance(e),warnings:this.getPerformanceWarnings(e)}}getDetailedReport(){const e=this.getRecentFrames(this.sampleWindowSize),t=this.getStats();return{...t,frameHistory:Array.from(e.values()),trends:this.calculateTrends(e),recommendations:this.getPerformanceRecommendations(t)}}reset(){this.frameStats.clear(),this.summaryStats={totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0},this.currentFrameId=0,this.lastReportTime=Date.now()}cleanupOldFrames(){this.frameStats.size>this.sampleWindowSize*2&&Array.from(this.frameStats.keys()).sort((t,i)=>t-i).slice(0,this.frameStats.size-this.sampleWindowSize).forEach(t=>{this.frameStats.delete(t)})}updateSummaryStats(e){this.summaryStats.totalFrames++,this.summaryStats.totalFeaturesProcessed+=e.featureCount||0,this.summaryStats.averageFrameTime=(this.summaryStats.averageFrameTime*(this.summaryStats.totalFrames-1)+e.duration)/this.summaryStats.totalFrames,this.summaryStats.minFrameTime=Math.min(this.summaryStats.minFrameTime,e.duration),this.summaryStats.maxFrameTime=Math.max(this.summaryStats.maxFrameTime,e.duration),this.summaryStats.averageFPS=1e3/this.summaryStats.averageFrameTime}maybeOutputReport(){const e=Date.now();if(e-this.lastReportTime>=this.reportInterval){const t=this.getStats();t.warnings.length>0?console.warn("避让系统性能报告:",t):console.log("避让系统性能正常:",t),this.lastReportTime=e}}getRecentFrames(e){return Array.from(this.frameStats.values()).slice(-e).filter(i=>i.duration>0)}calculateFPS(e){if(e.length===0)return 0;const t=this.calculateAverageFrameTime(e);return t>0?1e3/t:0}calculateAverageFrameTime(e){return e.length===0?0:e.reduce((t,i)=>t+i.duration,0)/e.length}calculateFrameTimeStdDev(e){if(e.length===0)return 0;const t=this.calculateAverageFrameTime(e),i=e.map(n=>Math.pow(n.duration-t,2));return Math.sqrt(i.reduce((n,o)=>n+o,0)/e.length)}calculateAverageFeatures(e){return e.length===0?0:e.reduce((t,i)=>t+(i.featureCount||0),0)/e.length}getPerformanceLevel(e){return e>this.performanceThresholds.criticalFrameTime?"critical":e>this.performanceThresholds.warningFrameTime?"warning":e>this.performanceThresholds.idealFrameTime?"good":"excellent"}getStrategyPerformance(e){const t=new Map;return e.forEach(i=>{i.strategyTimes.forEach((n,o)=>{t.has(o)||t.set(o,[]),t.get(o).push(n)})}),Array.from(t.entries()).map(([i,n])=>({name:i,averageTime:n.reduce((o,a)=>o+a,0)/n.length,maxTime:Math.max(...n),minTime:Math.min(...n),callCount:n.length}))}getPerformanceWarnings(e){const t=[],i=e.slice(-30);if(i.length===0)return t;const n=this.calculateAverageFrameTime(i);n>this.performanceThresholds.criticalFrameTime?t.push({type:"critical",message:`帧率过低: ${Math.round(1e3/n)}fps`,suggestion:"考虑减少要素数量或简化避让策略"}):n>this.performanceThresholds.warningFrameTime&&t.push({type:"warning",message:`帧率较低: ${Math.round(1e3/n)}fps`,suggestion:"建议优化避让算法或增加更新间隔"});const o=i.map(a=>a.memoryUsage).filter(a=>a>0);if(o.length>0){const a=o.reduce((c,h)=>c+h,0)/o.length;a>100*1024*1024&&t.push({type:"warning",message:`内存使用较高: ${(a/1024/1024).toFixed(1)}MB`,suggestion:"检查内存泄漏,及时清理无用资源"})}return t}calculateTrends(e){if(e.length<2)return{frameTime:"stable",fps:"stable",features:"stable"};const t=e.slice(0,Math.floor(e.length/2)),i=e.slice(Math.floor(e.length/2)),n=this.calculateAverageFrameTime(t),a=(this.calculateAverageFrameTime(i)-n)/n*100;return{frameTime:Math.abs(a)<5?"stable":a>0?"worsening":"improving",fps:Math.abs(a)<5?"stable":a>0?"improving":"worsening",features:"stable"}}getPerformanceRecommendations(e){const t=[];return e.recent.performanceLevel==="critical"&&(t.push("建议启用要素抽样或聚合显示"),t.push("考虑增加避让更新间隔时间"),t.push("检查是否有不必要的避让策略")),e.recent.averageFeaturesPerFrame>5e3&&t.push("要素数量过多,建议启用LOD分级"),e.strategies.forEach(i=>{i.averageTime>10&&t.push(`策略 "${i.name}" 执行时间较长,考虑优化`)}),t}}var w0=Object.defineProperty,b0=(r,e,t)=>e in r?w0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ys=(r,e,t)=>b0(r,typeof e!="symbol"?e+"":e,t);class x0{constructor(){ys(this,"name","priority"),ys(this,"enabled",!0),ys(this,"weight",1),ys(this,"description","Priority-based avoidance strategy, smaller value means higher priority 基于优先级的避让策略,数值越小优先级越高")}async execute(e,t,i){const n=[],o=new Hc(t.viewport),a=[],c=new Map;return e.forEach(h=>{if(!h.collidable)return;const d=h.getScreenBoundingBox(t.camera,t.renderer);d&&(a.push(d),c.set(h._id,h),i?.get(h._id)?.visible)}),a.sort((h,d)=>h.priority-d.priority),a.forEach(h=>{const d=o.findCollisions(h);d.length===0?(o.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})):d.some(f=>f.priority<h.priority)?n.push({featureId:h.featureId,visible:!1,reason:yi.PRIORITY_LOST,collidedWith:d.map(f=>f.featureId),timestamp:t.timestamp}):(o.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp}),d.forEach(f=>{n.push({featureId:f.featureId,visible:!1,reason:yi.PRIORITY_LOST,collidedWith:[h.featureId],timestamp:t.timestamp})}))}),n}}var M0=Object.defineProperty,S0=(r,e,t)=>e in r?M0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yi=(r,e,t)=>S0(r,typeof e!="symbol"?e+"":e,t);class L0{constructor(e,t={}){this.renderer=e,Yi(this,"_quadTreeManager"),Yi(this,"_strategyOrchestrator"),Yi(this,"_performanceMonitor"),Yi(this,"_layers",new Set),Yi(this,"_config"),Yi(this,"_isUpdating",!1),Yi(this,"_lastUpdateTime",0),Yi(this,"_frameCount",0),this._config={enabled:!0,padding:4,updateInterval:0,animationDuration:300,maxFeaturesPerFrame:2e3,viewportMargin:50,strategies:{priority:!0,grouping:!1,proximity:!1},...t},this._initializeComponents(),this._setupPerformanceMonitoring()}async update(e){if(!this._config.enabled||this._isUpdating)return;const t=Date.now();if(!(this._config.updateInterval>0&&t-this._lastUpdateTime<this._config.updateInterval)){this._isUpdating=!0,this._frameCount++;try{this._resetAllFeaturesVisibility();const i=this._createCollisionContext(e,t),n=this._collectCollidableFeatures();if(n.length===0)return;this._performanceMonitor.startFrame(this._frameCount);const o=await this._strategyOrchestrator.executeStrategies(n,i);await this._applyCollisionResults(o,n),this._performanceMonitor.endFrame(this._frameCount,{featureCount:n.length,visibleCount:Array.from(o.values()).filter(a=>a.visible).length,hiddenCount:Array.from(o.values()).filter(a=>!a.visible).length}),this._lastUpdateTime=t}catch(i){console.error("避让引擎更新失败:",i)}finally{this._isUpdating=!1}}}_resetAllFeaturesVisibility(){this._layers.forEach(e=>{e.getFeatures().filter(i=>i.collidable).forEach(i=>{i.setCollisionVisibility(!0,yi.NO_COLLISION)})})}registerLayer(e){return this._layers.add(e),this}unregisterLayer(e){return this._layers.delete(e),this}setConfig(e){return Object.assign(this._config,e),this}getPerformanceStats(){return this._performanceMonitor.getStats()}_initializeComponents(){const e={width:this.renderer.domElement.width,height:this.renderer.domElement.height};this._quadTreeManager=new Hc(e),this._strategyOrchestrator=new g0,this._performanceMonitor=new _0,this._strategyOrchestrator.registerStrategy(new x0,0),this._setupViewportResizeHandler()}_createCollisionContext(e,t){return{camera:e,renderer:this.renderer,viewport:{width:this.renderer.domElement.width,height:this.renderer.domElement.height},zoomLevel:e.position.z,timestamp:t,frameNumber:this._frameCount}}_collectCollidableFeatures(){const e=[];return this._layers.forEach(t=>{const i=t.getFeatures().filter(n=>n.collidable&&n instanceof ut);if(e.length+i.length>this._config.maxFeaturesPerFrame){console.warn(`达到每帧最大要素处理限制: ${this._config.maxFeaturesPerFrame}`);return}e.push(...i)}),e}async _applyCollisionResults(e,t){const i=t.map(n=>{const o=e.get(n._id);return o&&n.setCollisionVisibility(o.visible,o.reason),Promise.resolve()});await Promise.all(i)}_setupViewportResizeHandler(){new ResizeObserver(t=>{t.forEach(i=>{const{width:n,height:o}=i.contentRect;this._quadTreeManager.updateViewport({width:n,height:o})})}).observe(this.renderer.domElement)}_setupPerformanceMonitoring(){setInterval(()=>{const e=this.getPerformanceStats();e.frameRate<30&&console.warn("避让系统性能警告:",e)},5e3)}}var Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},vs={exports:{}};vs.exports,function(r,e){(function(){var t,i="4.17.21",n=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",d=500,m="__lodash_placeholder__",f=1,g=2,v=4,w=1,b=2,x=1,L=2,M=4,C=8,W=16,z=32,D=64,X=128,I=256,K=512,V=30,G="...",k=800,j=16,Y=1,H=2,Q=3,re=1/0,ne=9007199254740991,le=17976931348623157e292,de=NaN,ge=4294967295,fe=ge-1,Se=ge>>>1,rt=[["ary",X],["bind",x],["bindKey",L],["curry",C],["curryRight",W],["flip",K],["partial",z],["partialRight",D],["rearg",I]],st="[object Arguments]",ft="[object Array]",He="[object AsyncFunction]",Re="[object Boolean]",je="[object Date]",ot="[object DOMException]",Xe="[object Error]",It="[object Function]",Bt="[object GeneratorFunction]",Ce="[object Map]",at="[object Number]",pt="[object Null]",Pt="[object Object]",bn="[object Promise]",Rn="[object Proxy]",xn="[object RegExp]",At="[object Set]",$i="[object String]",qi="[object Symbol]",Mn="[object Undefined]",Sn="[object WeakMap]",xa="[object WeakSet]",en="[object ArrayBuffer]",wi="[object DataView]",Ir="[object Float32Array]",Ar="[object Float64Array]",jn="[object Int8Array]",Fr="[object Int16Array]",Or="[object Int32Array]",Jn="[object Uint8Array]",Ln="[object Uint8ClampedArray]",O="[object Uint16Array]",E="[object Uint32Array]",ce=/\b__p \+= '';/g,Me=/\b(__p \+=) '' \+/g,Ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Yt=/&(?:amp|lt|gt|quot|#39);/g,si=/[&<>"']/g,Fh=RegExp(Yt.source),Ws=RegExp(si.source),oi=/<%-([\s\S]+?)%>/g,ai=/<%([\s\S]+?)%>/g,tn=/<%=([\s\S]+?)%>/g,Pn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cn=/^\w*$/,Qn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ma=/[\\^$.*+?()[\]{}|]/g,gw=RegExp(Ma.source),Sa=/^\s+/,yw=/\s/,vw=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,_w=/\{\n\/\* \[wrapped with (.+)\] \*/,ww=/,? & /,bw=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,xw=/[()=,{}\[\]\/\s]/,Mw=/\\(\\)?/g,Sw=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Oh=/\w*$/,Lw=/^[-+]0x[0-9a-f]+$/i,Pw=/^0b[01]+$/i,Cw=/^\[object .+?Constructor\]$/,Tw=/^0o[0-7]+$/i,Gw=/^(?:0|[1-9]\d*)$/,Ww=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zs=/($^)/,Zw=/['\n\r\u2028\u2029\\]/g,Vs="\\ud800-\\udfff",Vw="\\u0300-\\u036f",Iw="\\ufe20-\\ufe2f",Aw="\\u20d0-\\u20ff",Dh=Vw+Iw+Aw,zh="\\u2700-\\u27bf",Xh="a-z\\xdf-\\xf6\\xf8-\\xff",Fw="\\xac\\xb1\\xd7\\xf7",Ow="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Dw="\\u2000-\\u206f",zw=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Uh="A-Z\\xc0-\\xd6\\xd8-\\xde",kh="\\ufe0e\\ufe0f",Kh=Fw+Ow+Dw+zw,La="['’]",Xw="["+Vs+"]",Nh="["+Kh+"]",Is="["+Dh+"]",Bh="\\d+",Uw="["+zh+"]",Yh="["+Xh+"]",Rh="[^"+Vs+Kh+Bh+zh+Xh+Uh+"]",Pa="\\ud83c[\\udffb-\\udfff]",kw="(?:"+Is+"|"+Pa+")",jh="[^"+Vs+"]",Ca="(?:\\ud83c[\\udde6-\\uddff]){2}",Ta="[\\ud800-\\udbff][\\udc00-\\udfff]",Hn="["+Uh+"]",Jh="\\u200d",Qh="(?:"+Yh+"|"+Rh+")",Kw="(?:"+Hn+"|"+Rh+")",Hh="(?:"+La+"(?:d|ll|m|re|s|t|ve))?",Eh="(?:"+La+"(?:D|LL|M|RE|S|T|VE))?",$h=kw+"?",qh="["+kh+"]?",Nw="(?:"+Jh+"(?:"+[jh,Ca,Ta].join("|")+")"+qh+$h+")*",Bw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eu=qh+$h+Nw,Rw="(?:"+[Uw,Ca,Ta].join("|")+")"+eu,jw="(?:"+[jh+Is+"?",Is,Ca,Ta,Xw].join("|")+")",Jw=RegExp(La,"g"),Qw=RegExp(Is,"g"),Ga=RegExp(Pa+"(?="+Pa+")|"+jw+eu,"g"),Hw=RegExp([Hn+"?"+Yh+"+"+Hh+"(?="+[Nh,Hn,"$"].join("|")+")",Kw+"+"+Eh+"(?="+[Nh,Hn+Qh,"$"].join("|")+")",Hn+"?"+Qh+"+"+Hh,Hn+"+"+Eh,Yw,Bw,Bh,Rw].join("|"),"g"),Ew=RegExp("["+Jh+Vs+Dh+kh+"]"),$w=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qw=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],eb=-1,Ie={};Ie[Ir]=Ie[Ar]=Ie[jn]=Ie[Fr]=Ie[Or]=Ie[Jn]=Ie[Ln]=Ie[O]=Ie[E]=!0,Ie[st]=Ie[ft]=Ie[en]=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j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ib={"&":"&","<":"<",">":">",'"':""","'":"'"},nb={"&":"&","<":"<",">":">",""":'"',"'":"'"},rb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sb=parseFloat,ob=parseInt,tu=typeof Pr=="object"&&Pr&&Pr.Object===Object&&Pr,ab=typeof self=="object"&&self&&self.Object===Object&&self,lt=tu||ab||Function("return this")(),Wa=e&&!e.nodeType&&e,Tn=Wa&&!0&&r&&!r.nodeType&&r,iu=Tn&&Tn.exports===Wa,Za=iu&&tu.process,Rt=function(){try{var A=Tn&&Tn.require&&Tn.require("util").types;return A||Za&&Za.binding&&Za.binding("util")}catch{}}(),nu=Rt&&Rt.isArrayBuffer,ru=Rt&&Rt.isDate,su=Rt&&Rt.isMap,ou=Rt&&Rt.isRegExp,au=Rt&&Rt.isSet,lu=Rt&&Rt.isTypedArray;function Ft(A,N,U){switch(U.length){case 0:return A.call(N);case 1:return A.call(N,U[0]);case 2:return A.call(N,U[0],U[1]);case 3:return A.call(N,U[0],U[1],U[2])}return A.apply(N,U)}function lb(A,N,U,ee){for(var he=-1,Le=A==null?0:A.length;++he<Le;){var Je=A[he];N(ee,Je,U(Je),A)}return ee}function jt(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee&&N(A[U],U,A)!==!1;);return A}function cb(A,N){for(var U=A==null?0:A.length;U--&&N(A[U],U,A)!==!1;);return A}function cu(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(!N(A[U],U,A))return!1;return!0}function nn(A,N){for(var U=-1,ee=A==null?0:A.length,he=0,Le=[];++U<ee;){var Je=A[U];N(Je,U,A)&&(Le[he++]=Je)}return Le}function As(A,N){var U=A==null?0:A.length;return!!U&&En(A,N,0)>-1}function Va(A,N,U){for(var ee=-1,he=A==null?0:A.length;++ee<he;)if(U(N,A[ee]))return!0;return!1}function Fe(A,N){for(var U=-1,ee=A==null?0:A.length,he=Array(ee);++U<ee;)he[U]=N(A[U],U,A);return he}function rn(A,N){for(var U=-1,ee=N.length,he=A.length;++U<ee;)A[he+U]=N[U];return A}function Ia(A,N,U,ee){var he=-1,Le=A==null?0:A.length;for(ee&&Le&&(U=A[++he]);++he<Le;)U=N(U,A[he],he,A);return U}function hb(A,N,U,ee){var he=A==null?0:A.length;for(ee&&he&&(U=A[--he]);he--;)U=N(U,A[he],he,A);return U}function Aa(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(N(A[U],U,A))return!0;return!1}var ub=Fa("length");function db(A){return A.split("")}function fb(A){return A.match(bw)||[]}function hu(A,N,U){var ee;return U(A,function(he,Le,Je){if(N(he,Le,Je))return ee=Le,!1}),ee}function Fs(A,N,U,ee){for(var he=A.length,Le=U+(ee?1:-1);ee?Le--:++Le<he;)if(N(A[Le],Le,A))return Le;return-1}function En(A,N,U){return N===N?Lb(A,N,U):Fs(A,uu,U)}function pb(A,N,U,ee){for(var he=U-1,Le=A.length;++he<Le;)if(ee(A[he],N))return he;return-1}function uu(A){return A!==A}function du(A,N){var U=A==null?0:A.length;return U?Da(A,N)/U:de}function Fa(A){return function(N){return N==null?t:N[A]}}function Oa(A){return function(N){return A==null?t:A[N]}}function fu(A,N,U,ee,he){return he(A,function(Le,Je,Ge){U=ee?(ee=!1,Le):N(U,Le,Je,Ge)}),U}function mb(A,N){var U=A.length;for(A.sort(N);U--;)A[U]=A[U].value;return A}function Da(A,N){for(var U,ee=-1,he=A.length;++ee<he;){var Le=N(A[ee]);Le!==t&&(U=U===t?Le:U+Le)}return U}function za(A,N){for(var U=-1,ee=Array(A);++U<A;)ee[U]=N(U);return ee}function gb(A,N){return Fe(N,function(U){return[U,A[U]]})}function pu(A){return A&&A.slice(0,vu(A)+1).replace(Sa,"")}function Ot(A){return function(N){return A(N)}}function Xa(A,N){return Fe(N,function(U){return A[U]})}function Dr(A,N){return A.has(N)}function mu(A,N){for(var U=-1,ee=A.length;++U<ee&&En(N,A[U],0)>-1;);return U}function gu(A,N){for(var U=A.length;U--&&En(N,A[U],0)>-1;);return U}function yb(A,N){for(var U=A.length,ee=0;U--;)A[U]===N&&++ee;return ee}var vb=Oa(tb),_b=Oa(ib);function wb(A){return"\\"+rb[A]}function bb(A,N){return A==null?t:A[N]}function $n(A){return Ew.test(A)}function xb(A){return $w.test(A)}function Mb(A){for(var N,U=[];!(N=A.next()).done;)U.push(N.value);return U}function Ua(A){var N=-1,U=Array(A.size);return A.forEach(function(ee,he){U[++N]=[he,ee]}),U}function yu(A,N){return function(U){return A(N(U))}}function sn(A,N){for(var U=-1,ee=A.length,he=0,Le=[];++U<ee;){var Je=A[U];(Je===N||Je===m)&&(A[U]=m,Le[he++]=U)}return Le}function Os(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=ee}),U}function Sb(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=[ee,ee]}),U}function Lb(A,N,U){for(var ee=U-1,he=A.length;++ee<he;)if(A[ee]===N)return ee;return-1}function Pb(A,N,U){for(var ee=U+1;ee--;)if(A[ee]===N)return ee;return ee}function qn(A){return $n(A)?Tb(A):ub(A)}function li(A){return $n(A)?Gb(A):db(A)}function vu(A){for(var N=A.length;N--&&yw.test(A.charAt(N)););return N}var Cb=Oa(nb);function Tb(A){for(var N=Ga.lastIndex=0;Ga.test(A);)++N;return N}function Gb(A){return A.match(Ga)||[]}function Wb(A){return A.match(Hw)||[]}var Zb=function A(N){N=N==null?lt:er.defaults(lt.Object(),N,er.pick(lt,qw));var U=N.Array,ee=N.Date,he=N.Error,Le=N.Function,Je=N.Math,Ge=N.Object,ka=N.RegExp,Vb=N.String,Jt=N.TypeError,Ds=U.prototype,Ib=Le.prototype,tr=Ge.prototype,zs=N["__core-js_shared__"],Xs=Ib.toString,Te=tr.hasOwnProperty,Ab=0,_u=function(){var s=/[^.]+$/.exec(zs&&zs.keys&&zs.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Us=tr.toString,Fb=Xs.call(Ge),Ob=lt._,Db=ka("^"+Xs.call(Te).replace(Ma,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ks=iu?N.Buffer:t,on=N.Symbol,Ks=N.Uint8Array,wu=ks?ks.allocUnsafe:t,Ns=yu(Ge.getPrototypeOf,Ge),bu=Ge.create,xu=tr.propertyIsEnumerable,Bs=Ds.splice,Mu=on?on.isConcatSpreadable:t,zr=on?on.iterator:t,Gn=on?on.toStringTag:t,Ys=function(){try{var s=An(Ge,"defineProperty");return s({},"",{}),s}catch{}}(),zb=N.clearTimeout!==lt.clearTimeout&&N.clearTimeout,Xb=ee&&ee.now!==lt.Date.now&&ee.now,Ub=N.setTimeout!==lt.setTimeout&&N.setTimeout,Rs=Je.ceil,js=Je.floor,Ka=Ge.getOwnPropertySymbols,kb=ks?ks.isBuffer:t,Su=N.isFinite,Kb=Ds.join,Nb=yu(Ge.keys,Ge),Qe=Je.max,mt=Je.min,Bb=ee.now,Yb=N.parseInt,Lu=Je.random,Rb=Ds.reverse,Na=An(N,"DataView"),Xr=An(N,"Map"),Ba=An(N,"Promise"),ir=An(N,"Set"),Ur=An(N,"WeakMap"),kr=An(Ge,"create"),Js=Ur&&new Ur,nr={},jb=Fn(Na),Jb=Fn(Xr),Qb=Fn(Ba),Hb=Fn(ir),Eb=Fn(Ur),Qs=on?on.prototype:t,Kr=Qs?Qs.valueOf:t,Pu=Qs?Qs.toString:t;function S(s){if(Ue(s)&&!ue(s)&&!(s instanceof be)){if(s instanceof Qt)return s;if(Te.call(s,"__wrapped__"))return Cd(s)}return new Qt(s)}var rr=function(){function s(){}return function(l){if(!Oe(l))return{};if(bu)return bu(l);s.prototype=l;var u=new s;return s.prototype=t,u}}();function Hs(){}function Qt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}S.templateSettings={escape:oi,evaluate:ai,interpolate:tn,variable:"",imports:{_:S}},S.prototype=Hs.prototype,S.prototype.constructor=S,Qt.prototype=rr(Hs.prototype),Qt.prototype.constructor=Qt;function be(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ge,this.__views__=[]}function $b(){var s=new be(this.__wrapped__);return s.__actions__=Ct(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=Ct(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=Ct(this.__views__),s}function qb(){if(this.__filtered__){var s=new be(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function e1(){var s=this.__wrapped__.value(),l=this.__dir__,u=ue(s),y=l<0,_=u?s.length:0,P=dx(0,_,this.__views__),T=P.start,Z=P.end,F=Z-T,B=y?Z:T-1,R=this.__iteratees__,J=R.length,$=0,te=mt(F,this.__takeCount__);if(!u||!y&&_==F&&te==F)return Hu(s,this.__actions__);var oe=[];e:for(;F--&&$<te;){B+=l;for(var me=-1,ae=s[B];++me<J;){var we=R[me],xe=we.iteratee,Xt=we.type,bt=xe(ae);if(Xt==H)ae=bt;else if(!bt){if(Xt==Y)continue e;break e}}oe[$++]=ae}return oe}be.prototype=rr(Hs.prototype),be.prototype.constructor=be;function Wn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function t1(){this.__data__=kr?kr(null):{},this.size=0}function i1(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function n1(s){var l=this.__data__;if(kr){var u=l[s];return u===h?t:u}return Te.call(l,s)?l[s]:t}function r1(s){var l=this.__data__;return kr?l[s]!==t:Te.call(l,s)}function s1(s,l){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=kr&&l===t?h:l,this}Wn.prototype.clear=t1,Wn.prototype.delete=i1,Wn.prototype.get=n1,Wn.prototype.has=r1,Wn.prototype.set=s1;function Ti(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function o1(){this.__data__=[],this.size=0}function a1(s){var l=this.__data__,u=Es(l,s);if(u<0)return!1;var y=l.length-1;return u==y?l.pop():Bs.call(l,u,1),--this.size,!0}function l1(s){var l=this.__data__,u=Es(l,s);return u<0?t:l[u][1]}function c1(s){return Es(this.__data__,s)>-1}function h1(s,l){var u=this.__data__,y=Es(u,s);return y<0?(++this.size,u.push([s,l])):u[y][1]=l,this}Ti.prototype.clear=o1,Ti.prototype.delete=a1,Ti.prototype.get=l1,Ti.prototype.has=c1,Ti.prototype.set=h1;function Gi(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function u1(){this.size=0,this.__data__={hash:new Wn,map:new(Xr||Ti),string:new Wn}}function d1(s){var l=co(this,s).delete(s);return this.size-=l?1:0,l}function f1(s){return co(this,s).get(s)}function p1(s){return co(this,s).has(s)}function m1(s,l){var u=co(this,s),y=u.size;return u.set(s,l),this.size+=u.size==y?0:1,this}Gi.prototype.clear=u1,Gi.prototype.delete=d1,Gi.prototype.get=f1,Gi.prototype.has=p1,Gi.prototype.set=m1;function Zn(s){var l=-1,u=s==null?0:s.length;for(this.__data__=new Gi;++l<u;)this.add(s[l])}function g1(s){return this.__data__.set(s,h),this}function y1(s){return this.__data__.has(s)}Zn.prototype.add=Zn.prototype.push=g1,Zn.prototype.has=y1;function ci(s){var l=this.__data__=new Ti(s);this.size=l.size}function v1(){this.__data__=new Ti,this.size=0}function _1(s){var l=this.__data__,u=l.delete(s);return this.size=l.size,u}function w1(s){return this.__data__.get(s)}function b1(s){return this.__data__.has(s)}function x1(s,l){var u=this.__data__;if(u instanceof Ti){var y=u.__data__;if(!Xr||y.length<n-1)return y.push([s,l]),this.size=++u.size,this;u=this.__data__=new Gi(y)}return u.set(s,l),this.size=u.size,this}ci.prototype.clear=v1,ci.prototype.delete=_1,ci.prototype.get=w1,ci.prototype.has=b1,ci.prototype.set=x1;function Cu(s,l){var u=ue(s),y=!u&&On(s),_=!u&&!y&&un(s),P=!u&&!y&&!_&&lr(s),T=u||y||_||P,Z=T?za(s.length,Vb):[],F=Z.length;for(var B in s)(l||Te.call(s,B))&&!(T&&(B=="length"||_&&(B=="offset"||B=="parent")||P&&(B=="buffer"||B=="byteLength"||B=="byteOffset")||Ii(B,F)))&&Z.push(B);return Z}function Tu(s){var l=s.length;return l?s[tl(0,l-1)]:t}function M1(s,l){return ho(Ct(s),Vn(l,0,s.length))}function S1(s){return ho(Ct(s))}function Ya(s,l,u){(u!==t&&!hi(s[l],u)||u===t&&!(l in s))&&Wi(s,l,u)}function Nr(s,l,u){var y=s[l];(!(Te.call(s,l)&&hi(y,u))||u===t&&!(l in s))&&Wi(s,l,u)}function Es(s,l){for(var u=s.length;u--;)if(hi(s[u][0],l))return u;return-1}function L1(s,l,u,y){return an(s,function(_,P,T){l(y,_,u(_),T)}),y}function Gu(s,l){return s&&xi(l,Ee(l),s)}function P1(s,l){return s&&xi(l,Gt(l),s)}function Wi(s,l,u){l=="__proto__"&&Ys?Ys(s,l,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[l]=u}function Ra(s,l){for(var u=-1,y=l.length,_=U(y),P=s==null;++u<y;)_[u]=P?t:Pl(s,l[u]);return _}function Vn(s,l,u){return s===s&&(u!==t&&(s=s<=u?s:u),l!==t&&(s=s>=l?s:l)),s}function Ht(s,l,u,y,_,P){var T,Z=l&f,F=l&g,B=l&v;if(u&&(T=_?u(s,y,_,P):u(s)),T!==t)return T;if(!Oe(s))return s;var R=ue(s);if(R){if(T=px(s),!Z)return Ct(s,T)}else{var J=gt(s),$=J==It||J==Bt;if(un(s))return qu(s,Z);if(J==Pt||J==st||$&&!_){if(T=F||$?{}:vd(s),!Z)return F?nx(s,P1(T,s)):ix(s,Gu(T,s))}else{if(!We[J])return _?s:{};T=mx(s,J,Z)}}P||(P=new ci);var te=P.get(s);if(te)return te;P.set(s,T),jd(s)?s.forEach(function(ae){T.add(Ht(ae,l,u,ae,s,P))}):Yd(s)&&s.forEach(function(ae,we){T.set(we,Ht(ae,l,u,we,s,P))});var oe=B?F?dl:ul:F?Gt:Ee,me=R?t:oe(s);return jt(me||s,function(ae,we){me&&(we=ae,ae=s[we]),Nr(T,we,Ht(ae,l,u,we,s,P))}),T}function C1(s){var l=Ee(s);return function(u){return Wu(u,s,l)}}function Wu(s,l,u){var y=u.length;if(s==null)return!y;for(s=Ge(s);y--;){var _=u[y],P=l[_],T=s[_];if(T===t&&!(_ in s)||!P(T))return!1}return!0}function Zu(s,l,u){if(typeof s!="function")throw new Jt(a);return Hr(function(){s.apply(t,u)},l)}function Br(s,l,u,y){var _=-1,P=As,T=!0,Z=s.length,F=[],B=l.length;if(!Z)return F;u&&(l=Fe(l,Ot(u))),y?(P=Va,T=!1):l.length>=n&&(P=Dr,T=!1,l=new Zn(l));e:for(;++_<Z;){var R=s[_],J=u==null?R:u(R);if(R=y||R!==0?R:0,T&&J===J){for(var $=B;$--;)if(l[$]===J)continue e;F.push(R)}else P(l,J,y)||F.push(R)}return F}var an=rd(bi),Vu=rd(Ja,!0);function T1(s,l){var u=!0;return an(s,function(y,_,P){return u=!!l(y,_,P),u}),u}function $s(s,l,u){for(var y=-1,_=s.length;++y<_;){var P=s[y],T=l(P);if(T!=null&&(Z===t?T===T&&!zt(T):u(T,Z)))var Z=T,F=P}return F}function G1(s,l,u,y){var _=s.length;for(u=pe(u),u<0&&(u=-u>_?0:_+u),y=y===t||y>_?_:pe(y),y<0&&(y+=_),y=u>y?0:Qd(y);u<y;)s[u++]=l;return s}function Iu(s,l){var u=[];return an(s,function(y,_,P){l(y,_,P)&&u.push(y)}),u}function ct(s,l,u,y,_){var P=-1,T=s.length;for(u||(u=yx),_||(_=[]);++P<T;){var Z=s[P];l>0&&u(Z)?l>1?ct(Z,l-1,u,y,_):rn(_,Z):y||(_[_.length]=Z)}return _}var ja=sd(),Au=sd(!0);function bi(s,l){return s&&ja(s,l,Ee)}function Ja(s,l){return s&&Au(s,l,Ee)}function qs(s,l){return nn(l,function(u){return Ai(s[u])})}function In(s,l){l=cn(l,s);for(var u=0,y=l.length;s!=null&&u<y;)s=s[Mi(l[u++])];return u&&u==y?s:t}function Fu(s,l,u){var y=l(s);return ue(s)?y:rn(y,u(s))}function _t(s){return s==null?s===t?Mn:pt:Gn&&Gn in Ge(s)?ux(s):Sx(s)}function Qa(s,l){return s>l}function W1(s,l){return s!=null&&Te.call(s,l)}function Z1(s,l){return s!=null&&l in Ge(s)}function V1(s,l,u){return s>=mt(l,u)&&s<Qe(l,u)}function Ha(s,l,u){for(var y=u?Va:As,_=s[0].length,P=s.length,T=P,Z=U(P),F=1/0,B=[];T--;){var R=s[T];T&&l&&(R=Fe(R,Ot(l))),F=mt(R.length,F),Z[T]=!u&&(l||_>=120&&R.length>=120)?new Zn(T&&R):t}R=s[0];var J=-1,$=Z[0];e:for(;++J<_&&B.length<F;){var te=R[J],oe=l?l(te):te;if(te=u||te!==0?te:0,!($?Dr($,oe):y(B,oe,u))){for(T=P;--T;){var me=Z[T];if(!(me?Dr(me,oe):y(s[T],oe,u)))continue e}$&&$.push(oe),B.push(te)}}return B}function I1(s,l,u,y){return bi(s,function(_,P,T){l(y,u(_),P,T)}),y}function Yr(s,l,u){l=cn(l,s),s=xd(s,l);var y=s==null?s:s[Mi($t(l))];return y==null?t:Ft(y,s,u)}function Ou(s){return Ue(s)&&_t(s)==st}function A1(s){return Ue(s)&&_t(s)==en}function F1(s){return Ue(s)&&_t(s)==je}function Rr(s,l,u,y,_){return s===l?!0:s==null||l==null||!Ue(s)&&!Ue(l)?s!==s&&l!==l:O1(s,l,u,y,Rr,_)}function O1(s,l,u,y,_,P){var T=ue(s),Z=ue(l),F=T?ft:gt(s),B=Z?ft:gt(l);F=F==st?Pt:F,B=B==st?Pt:B;var R=F==Pt,J=B==Pt,$=F==B;if($&&un(s)){if(!un(l))return!1;T=!0,R=!1}if($&&!R)return P||(P=new ci),T||lr(s)?md(s,l,u,y,_,P):cx(s,l,F,u,y,_,P);if(!(u&w)){var te=R&&Te.call(s,"__wrapped__"),oe=J&&Te.call(l,"__wrapped__");if(te||oe){var me=te?s.value():s,ae=oe?l.value():l;return P||(P=new ci),_(me,ae,u,y,P)}}return $?(P||(P=new ci),hx(s,l,u,y,_,P)):!1}function D1(s){return Ue(s)&>(s)==Ce}function Ea(s,l,u,y){var _=u.length,P=_,T=!y;if(s==null)return!P;for(s=Ge(s);_--;){var Z=u[_];if(T&&Z[2]?Z[1]!==s[Z[0]]:!(Z[0]in s))return!1}for(;++_<P;){Z=u[_];var F=Z[0],B=s[F],R=Z[1];if(T&&Z[2]){if(B===t&&!(F in s))return!1}else{var J=new ci;if(y)var $=y(B,R,F,s,l,J);if(!($===t?Rr(R,B,w|b,y,J):$))return!1}}return!0}function Du(s){if(!Oe(s)||_x(s))return!1;var l=Ai(s)?Db:Cw;return l.test(Fn(s))}function z1(s){return Ue(s)&&_t(s)==xn}function X1(s){return Ue(s)&>(s)==At}function U1(s){return Ue(s)&&yo(s.length)&&!!Ie[_t(s)]}function zu(s){return typeof s=="function"?s:s==null?Wt:typeof s=="object"?ue(s)?ku(s[0],s[1]):Uu(s):af(s)}function $a(s){if(!Qr(s))return Nb(s);var l=[];for(var u in Ge(s))Te.call(s,u)&&u!="constructor"&&l.push(u);return l}function k1(s){if(!Oe(s))return Mx(s);var l=Qr(s),u=[];for(var y in s)y=="constructor"&&(l||!Te.call(s,y))||u.push(y);return u}function qa(s,l){return s<l}function Xu(s,l){var u=-1,y=Tt(s)?U(s.length):[];return an(s,function(_,P,T){y[++u]=l(_,P,T)}),y}function Uu(s){var l=pl(s);return l.length==1&&l[0][2]?wd(l[0][0],l[0][1]):function(u){return u===s||Ea(u,s,l)}}function ku(s,l){return gl(s)&&_d(l)?wd(Mi(s),l):function(u){var y=Pl(u,s);return y===t&&y===l?Cl(u,s):Rr(l,y,w|b)}}function eo(s,l,u,y,_){s!==l&&ja(l,function(P,T){if(_||(_=new ci),Oe(P))K1(s,l,T,u,eo,y,_);else{var Z=y?y(vl(s,T),P,T+"",s,l,_):t;Z===t&&(Z=P),Ya(s,T,Z)}},Gt)}function K1(s,l,u,y,_,P,T){var Z=vl(s,u),F=vl(l,u),B=T.get(F);if(B){Ya(s,u,B);return}var R=P?P(Z,F,u+"",s,l,T):t,J=R===t;if(J){var $=ue(F),te=!$&&un(F),oe=!$&&!te&&lr(F);R=F,$||te||oe?ue(Z)?R=Z:Ke(Z)?R=Ct(Z):te?(J=!1,R=qu(F,!0)):oe?(J=!1,R=ed(F,!0)):R=[]:Er(F)||On(F)?(R=Z,On(Z)?R=Hd(Z):(!Oe(Z)||Ai(Z))&&(R=vd(F))):J=!1}J&&(T.set(F,R),_(R,F,y,P,T),T.delete(F)),Ya(s,u,R)}function Ku(s,l){var u=s.length;if(u)return l+=l<0?u:0,Ii(l,u)?s[l]:t}function Nu(s,l,u){l.length?l=Fe(l,function(P){return ue(P)?function(T){return In(T,P.length===1?P[0]:P)}:P}):l=[Wt];var y=-1;l=Fe(l,Ot(se()));var _=Xu(s,function(P,T,Z){var F=Fe(l,function(B){return B(P)});return{criteria:F,index:++y,value:P}});return mb(_,function(P,T){return tx(P,T,u)})}function N1(s,l){return Bu(s,l,function(u,y){return Cl(s,y)})}function Bu(s,l,u){for(var y=-1,_=l.length,P={};++y<_;){var T=l[y],Z=In(s,T);u(Z,T)&&jr(P,cn(T,s),Z)}return P}function B1(s){return function(l){return In(l,s)}}function el(s,l,u,y){var _=y?pb:En,P=-1,T=l.length,Z=s;for(s===l&&(l=Ct(l)),u&&(Z=Fe(s,Ot(u)));++P<T;)for(var F=0,B=l[P],R=u?u(B):B;(F=_(Z,R,F,y))>-1;)Z!==s&&Bs.call(Z,F,1),Bs.call(s,F,1);return s}function Yu(s,l){for(var u=s?l.length:0,y=u-1;u--;){var _=l[u];if(u==y||_!==P){var P=_;Ii(_)?Bs.call(s,_,1):rl(s,_)}}return s}function tl(s,l){return s+js(Lu()*(l-s+1))}function Y1(s,l,u,y){for(var _=-1,P=Qe(Rs((l-s)/(u||1)),0),T=U(P);P--;)T[y?P:++_]=s,s+=u;return T}function il(s,l){var u="";if(!s||l<1||l>ne)return u;do l%2&&(u+=s),l=js(l/2),l&&(s+=s);while(l);return u}function ye(s,l){return _l(bd(s,l,Wt),s+"")}function R1(s){return Tu(cr(s))}function j1(s,l){var u=cr(s);return ho(u,Vn(l,0,u.length))}function jr(s,l,u,y){if(!Oe(s))return s;l=cn(l,s);for(var _=-1,P=l.length,T=P-1,Z=s;Z!=null&&++_<P;){var F=Mi(l[_]),B=u;if(F==="__proto__"||F==="constructor"||F==="prototype")return s;if(_!=T){var R=Z[F];B=y?y(R,F,Z):t,B===t&&(B=Oe(R)?R:Ii(l[_+1])?[]:{})}Nr(Z,F,B),Z=Z[F]}return s}var Ru=Js?function(s,l){return Js.set(s,l),s}:Wt,J1=Ys?function(s,l){return Ys(s,"toString",{configurable:!0,enumerable:!1,value:Gl(l),writable:!0})}:Wt;function Q1(s){return ho(cr(s))}function Et(s,l,u){var y=-1,_=s.length;l<0&&(l=-l>_?0:_+l),u=u>_?_:u,u<0&&(u+=_),_=l>u?0:u-l>>>0,l>>>=0;for(var P=U(_);++y<_;)P[y]=s[y+l];return P}function H1(s,l){var u;return an(s,function(y,_,P){return u=l(y,_,P),!u}),!!u}function to(s,l,u){var y=0,_=s==null?y:s.length;if(typeof l=="number"&&l===l&&_<=Se){for(;y<_;){var P=y+_>>>1,T=s[P];T!==null&&!zt(T)&&(u?T<=l:T<l)?y=P+1:_=P}return _}return nl(s,l,Wt,u)}function nl(s,l,u,y){var _=0,P=s==null?0:s.length;if(P===0)return 0;l=u(l);for(var T=l!==l,Z=l===null,F=zt(l),B=l===t;_<P;){var R=js((_+P)/2),J=u(s[R]),$=J!==t,te=J===null,oe=J===J,me=zt(J);if(T)var ae=y||oe;else B?ae=oe&&(y||$):Z?ae=oe&&$&&(y||!te):F?ae=oe&&$&&!te&&(y||!me):te||me?ae=!1:ae=y?J<=l:J<l;ae?_=R+1:P=R}return mt(P,fe)}function ju(s,l){for(var u=-1,y=s.length,_=0,P=[];++u<y;){var T=s[u],Z=l?l(T):T;if(!u||!hi(Z,F)){var F=Z;P[_++]=T===0?0:T}}return P}function Ju(s){return typeof s=="number"?s:zt(s)?de:+s}function Dt(s){if(typeof s=="string")return s;if(ue(s))return Fe(s,Dt)+"";if(zt(s))return Pu?Pu.call(s):"";var l=s+"";return l=="0"&&1/s==-re?"-0":l}function ln(s,l,u){var y=-1,_=As,P=s.length,T=!0,Z=[],F=Z;if(u)T=!1,_=Va;else if(P>=n){var B=l?null:ax(s);if(B)return Os(B);T=!1,_=Dr,F=new Zn}else F=l?[]:Z;e:for(;++y<P;){var R=s[y],J=l?l(R):R;if(R=u||R!==0?R:0,T&&J===J){for(var $=F.length;$--;)if(F[$]===J)continue e;l&&F.push(J),Z.push(R)}else _(F,J,u)||(F!==Z&&F.push(J),Z.push(R))}return Z}function rl(s,l){return l=cn(l,s),s=xd(s,l),s==null||delete s[Mi($t(l))]}function Qu(s,l,u,y){return jr(s,l,u(In(s,l)),y)}function io(s,l,u,y){for(var _=s.length,P=y?_:-1;(y?P--:++P<_)&&l(s[P],P,s););return u?Et(s,y?0:P,y?P+1:_):Et(s,y?P+1:0,y?_:P)}function Hu(s,l){var u=s;return u instanceof be&&(u=u.value()),Ia(l,function(y,_){return _.func.apply(_.thisArg,rn([y],_.args))},u)}function sl(s,l,u){var y=s.length;if(y<2)return y?ln(s[0]):[];for(var _=-1,P=U(y);++_<y;)for(var T=s[_],Z=-1;++Z<y;)Z!=_&&(P[_]=Br(P[_]||T,s[Z],l,u));return ln(ct(P,1),l,u)}function Eu(s,l,u){for(var y=-1,_=s.length,P=l.length,T={};++y<_;){var Z=y<P?l[y]:t;u(T,s[y],Z)}return T}function ol(s){return Ke(s)?s:[]}function al(s){return typeof s=="function"?s:Wt}function cn(s,l){return ue(s)?s:gl(s,l)?[s]:Pd(Pe(s))}var E1=ye;function hn(s,l,u){var y=s.length;return u=u===t?y:u,!l&&u>=y?s:Et(s,l,u)}var $u=zb||function(s){return lt.clearTimeout(s)};function qu(s,l){if(l)return s.slice();var u=s.length,y=wu?wu(u):new s.constructor(u);return s.copy(y),y}function ll(s){var l=new s.constructor(s.byteLength);return new Ks(l).set(new Ks(s)),l}function $1(s,l){var u=l?ll(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function q1(s){var l=new s.constructor(s.source,Oh.exec(s));return l.lastIndex=s.lastIndex,l}function ex(s){return Kr?Ge(Kr.call(s)):{}}function ed(s,l){var u=l?ll(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function td(s,l){if(s!==l){var u=s!==t,y=s===null,_=s===s,P=zt(s),T=l!==t,Z=l===null,F=l===l,B=zt(l);if(!Z&&!B&&!P&&s>l||P&&T&&F&&!Z&&!B||y&&T&&F||!u&&F||!_)return 1;if(!y&&!P&&!B&&s<l||B&&u&&_&&!y&&!P||Z&&u&&_||!T&&_||!F)return-1}return 0}function tx(s,l,u){for(var y=-1,_=s.criteria,P=l.criteria,T=_.length,Z=u.length;++y<T;){var F=td(_[y],P[y]);if(F){if(y>=Z)return F;var B=u[y];return F*(B=="desc"?-1:1)}}return s.index-l.index}function id(s,l,u,y){for(var _=-1,P=s.length,T=u.length,Z=-1,F=l.length,B=Qe(P-T,0),R=U(F+B),J=!y;++Z<F;)R[Z]=l[Z];for(;++_<T;)(J||_<P)&&(R[u[_]]=s[_]);for(;B--;)R[Z++]=s[_++];return R}function nd(s,l,u,y){for(var _=-1,P=s.length,T=-1,Z=u.length,F=-1,B=l.length,R=Qe(P-Z,0),J=U(R+B),$=!y;++_<R;)J[_]=s[_];for(var te=_;++F<B;)J[te+F]=l[F];for(;++T<Z;)($||_<P)&&(J[te+u[T]]=s[_++]);return J}function Ct(s,l){var u=-1,y=s.length;for(l||(l=U(y));++u<y;)l[u]=s[u];return l}function xi(s,l,u,y){var _=!u;u||(u={});for(var P=-1,T=l.length;++P<T;){var Z=l[P],F=y?y(u[Z],s[Z],Z,u,s):t;F===t&&(F=s[Z]),_?Wi(u,Z,F):Nr(u,Z,F)}return u}function ix(s,l){return xi(s,ml(s),l)}function nx(s,l){return xi(s,gd(s),l)}function no(s,l){return function(u,y){var _=ue(u)?lb:L1,P=l?l():{};return _(u,s,se(y,2),P)}}function sr(s){return ye(function(l,u){var y=-1,_=u.length,P=_>1?u[_-1]:t,T=_>2?u[2]:t;for(P=s.length>3&&typeof P=="function"?(_--,P):t,T&&wt(u[0],u[1],T)&&(P=_<3?t:P,_=1),l=Ge(l);++y<_;){var Z=u[y];Z&&s(l,Z,y,P)}return l})}function rd(s,l){return function(u,y){if(u==null)return u;if(!Tt(u))return s(u,y);for(var _=u.length,P=l?_:-1,T=Ge(u);(l?P--:++P<_)&&y(T[P],P,T)!==!1;);return u}}function sd(s){return function(l,u,y){for(var _=-1,P=Ge(l),T=y(l),Z=T.length;Z--;){var F=T[s?Z:++_];if(u(P[F],F,P)===!1)break}return l}}function rx(s,l,u){var y=l&x,_=Jr(s);function P(){var T=this&&this!==lt&&this instanceof P?_:s;return T.apply(y?u:this,arguments)}return P}function od(s){return function(l){l=Pe(l);var u=$n(l)?li(l):t,y=u?u[0]:l.charAt(0),_=u?hn(u,1).join(""):l.slice(1);return y[s]()+_}}function or(s){return function(l){return Ia(sf(rf(l).replace(Jw,"")),s,"")}}function Jr(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var u=rr(s.prototype),y=s.apply(u,l);return Oe(y)?y:u}}function sx(s,l,u){var y=Jr(s);function _(){for(var P=arguments.length,T=U(P),Z=P,F=ar(_);Z--;)T[Z]=arguments[Z];var B=P<3&&T[0]!==F&&T[P-1]!==F?[]:sn(T,F);if(P-=B.length,P<u)return ud(s,l,ro,_.placeholder,t,T,B,t,t,u-P);var R=this&&this!==lt&&this instanceof _?y:s;return Ft(R,this,T)}return _}function ad(s){return function(l,u,y){var _=Ge(l);if(!Tt(l)){var P=se(u,3);l=Ee(l),u=function(Z){return P(_[Z],Z,_)}}var T=s(l,u,y);return T>-1?_[P?l[T]:T]:t}}function ld(s){return Vi(function(l){var u=l.length,y=u,_=Qt.prototype.thru;for(s&&l.reverse();y--;){var P=l[y];if(typeof P!="function")throw new Jt(a);if(_&&!T&&lo(P)=="wrapper")var T=new Qt([],!0)}for(y=T?y:u;++y<u;){P=l[y];var Z=lo(P),F=Z=="wrapper"?fl(P):t;F&&yl(F[0])&&F[1]==(X|C|z|I)&&!F[4].length&&F[9]==1?T=T[lo(F[0])].apply(T,F[3]):T=P.length==1&&yl(P)?T[Z]():T.thru(P)}return function(){var B=arguments,R=B[0];if(T&&B.length==1&&ue(R))return T.plant(R).value();for(var J=0,$=u?l[J].apply(this,B):R;++J<u;)$=l[J].call(this,$);return $}})}function ro(s,l,u,y,_,P,T,Z,F,B){var R=l&X,J=l&x,$=l&L,te=l&(C|W),oe=l&K,me=$?t:Jr(s);function ae(){for(var we=arguments.length,xe=U(we),Xt=we;Xt--;)xe[Xt]=arguments[Xt];if(te)var bt=ar(ae),Ut=yb(xe,bt);if(y&&(xe=id(xe,y,_,te)),P&&(xe=nd(xe,P,T,te)),we-=Ut,te&&we<B){var Ne=sn(xe,bt);return ud(s,l,ro,ae.placeholder,u,xe,Ne,Z,F,B-we)}var ui=J?u:this,Oi=$?ui[s]:s;return we=xe.length,Z?xe=Lx(xe,Z):oe&&we>1&&xe.reverse(),R&&F<we&&(xe.length=F),this&&this!==lt&&this instanceof ae&&(Oi=me||Jr(Oi)),Oi.apply(ui,xe)}return ae}function cd(s,l){return function(u,y){return I1(u,s,l(y),{})}}function so(s,l){return function(u,y){var _;if(u===t&&y===t)return l;if(u!==t&&(_=u),y!==t){if(_===t)return y;typeof u=="string"||typeof y=="string"?(u=Dt(u),y=Dt(y)):(u=Ju(u),y=Ju(y)),_=s(u,y)}return _}}function cl(s){return Vi(function(l){return l=Fe(l,Ot(se())),ye(function(u){var y=this;return s(l,function(_){return Ft(_,y,u)})})})}function oo(s,l){l=l===t?" ":Dt(l);var u=l.length;if(u<2)return u?il(l,s):l;var y=il(l,Rs(s/qn(l)));return $n(l)?hn(li(y),0,s).join(""):y.slice(0,s)}function ox(s,l,u,y){var _=l&x,P=Jr(s);function T(){for(var Z=-1,F=arguments.length,B=-1,R=y.length,J=U(R+F),$=this&&this!==lt&&this instanceof T?P:s;++B<R;)J[B]=y[B];for(;F--;)J[B++]=arguments[++Z];return Ft($,_?u:this,J)}return T}function hd(s){return function(l,u,y){return y&&typeof y!="number"&&wt(l,u,y)&&(u=y=t),l=Fi(l),u===t?(u=l,l=0):u=Fi(u),y=y===t?l<u?1:-1:Fi(y),Y1(l,u,y,s)}}function ao(s){return function(l,u){return typeof l=="string"&&typeof u=="string"||(l=qt(l),u=qt(u)),s(l,u)}}function ud(s,l,u,y,_,P,T,Z,F,B){var R=l&C,J=R?T:t,$=R?t:T,te=R?P:t,oe=R?t:P;l|=R?z:D,l&=~(R?D:z),l&M||(l&=-4);var me=[s,l,_,te,J,oe,$,Z,F,B],ae=u.apply(t,me);return yl(s)&&Md(ae,me),ae.placeholder=y,Sd(ae,s,l)}function hl(s){var l=Je[s];return function(u,y){if(u=qt(u),y=y==null?0:mt(pe(y),292),y&&Su(u)){var _=(Pe(u)+"e").split("e"),P=l(_[0]+"e"+(+_[1]+y));return _=(Pe(P)+"e").split("e"),+(_[0]+"e"+(+_[1]-y))}return l(u)}}var ax=ir&&1/Os(new ir([,-0]))[1]==re?function(s){return new ir(s)}:Vl;function dd(s){return function(l){var u=gt(l);return u==Ce?Ua(l):u==At?Sb(l):gb(l,s(l))}}function Zi(s,l,u,y,_,P,T,Z){var F=l&L;if(!F&&typeof s!="function")throw new Jt(a);var B=y?y.length:0;if(B||(l&=-97,y=_=t),T=T===t?T:Qe(pe(T),0),Z=Z===t?Z:pe(Z),B-=_?_.length:0,l&D){var R=y,J=_;y=_=t}var $=F?t:fl(s),te=[s,l,u,y,_,R,J,P,T,Z];if($&&xx(te,$),s=te[0],l=te[1],u=te[2],y=te[3],_=te[4],Z=te[9]=te[9]===t?F?0:s.length:Qe(te[9]-B,0),!Z&&l&(C|W)&&(l&=-25),!l||l==x)var oe=rx(s,l,u);else l==C||l==W?oe=sx(s,l,Z):(l==z||l==(x|z))&&!_.length?oe=ox(s,l,u,y):oe=ro.apply(t,te);var me=$?Ru:Md;return Sd(me(oe,te),s,l)}function fd(s,l,u,y){return s===t||hi(s,tr[u])&&!Te.call(y,u)?l:s}function pd(s,l,u,y,_,P){return Oe(s)&&Oe(l)&&(P.set(l,s),eo(s,l,t,pd,P),P.delete(l)),s}function lx(s){return Er(s)?t:s}function md(s,l,u,y,_,P){var T=u&w,Z=s.length,F=l.length;if(Z!=F&&!(T&&F>Z))return!1;var B=P.get(s),R=P.get(l);if(B&&R)return B==l&&R==s;var J=-1,$=!0,te=u&b?new Zn:t;for(P.set(s,l),P.set(l,s);++J<Z;){var oe=s[J],me=l[J];if(y)var ae=T?y(me,oe,J,l,s,P):y(oe,me,J,s,l,P);if(ae!==t){if(ae)continue;$=!1;break}if(te){if(!Aa(l,function(we,xe){if(!Dr(te,xe)&&(oe===we||_(oe,we,u,y,P)))return te.push(xe)})){$=!1;break}}else if(!(oe===me||_(oe,me,u,y,P))){$=!1;break}}return P.delete(s),P.delete(l),$}function cx(s,l,u,y,_,P,T){switch(u){case wi:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case en:return!(s.byteLength!=l.byteLength||!P(new Ks(s),new Ks(l)));case Re:case je:case at:return hi(+s,+l);case Xe:return s.name==l.name&&s.message==l.message;case xn:case $i:return s==l+"";case Ce:var Z=Ua;case At:var F=y&w;if(Z||(Z=Os),s.size!=l.size&&!F)return!1;var B=T.get(s);if(B)return B==l;y|=b,T.set(s,l);var R=md(Z(s),Z(l),y,_,P,T);return T.delete(s),R;case qi:if(Kr)return Kr.call(s)==Kr.call(l)}return!1}function hx(s,l,u,y,_,P){var T=u&w,Z=ul(s),F=Z.length,B=ul(l),R=B.length;if(F!=R&&!T)return!1;for(var J=F;J--;){var $=Z[J];if(!(T?$ in l:Te.call(l,$)))return!1}var te=P.get(s),oe=P.get(l);if(te&&oe)return te==l&&oe==s;var me=!0;P.set(s,l),P.set(l,s);for(var ae=T;++J<F;){$=Z[J];var we=s[$],xe=l[$];if(y)var Xt=T?y(xe,we,$,l,s,P):y(we,xe,$,s,l,P);if(!(Xt===t?we===xe||_(we,xe,u,y,P):Xt)){me=!1;break}ae||(ae=$=="constructor")}if(me&&!ae){var bt=s.constructor,Ut=l.constructor;bt!=Ut&&"constructor"in s&&"constructor"in l&&!(typeof bt=="function"&&bt instanceof bt&&typeof Ut=="function"&&Ut instanceof Ut)&&(me=!1)}return P.delete(s),P.delete(l),me}function Vi(s){return _l(bd(s,t,Wd),s+"")}function ul(s){return Fu(s,Ee,ml)}function dl(s){return Fu(s,Gt,gd)}var fl=Js?function(s){return Js.get(s)}:Vl;function lo(s){for(var l=s.name+"",u=nr[l],y=Te.call(nr,l)?u.length:0;y--;){var _=u[y],P=_.func;if(P==null||P==s)return _.name}return l}function ar(s){var l=Te.call(S,"placeholder")?S:s;return l.placeholder}function se(){var s=S.iteratee||Wl;return s=s===Wl?zu:s,arguments.length?s(arguments[0],arguments[1]):s}function co(s,l){var u=s.__data__;return vx(l)?u[typeof l=="string"?"string":"hash"]:u.map}function pl(s){for(var l=Ee(s),u=l.length;u--;){var y=l[u],_=s[y];l[u]=[y,_,_d(_)]}return l}function An(s,l){var u=bb(s,l);return Du(u)?u:t}function ux(s){var l=Te.call(s,Gn),u=s[Gn];try{s[Gn]=t;var y=!0}catch{}var _=Us.call(s);return y&&(l?s[Gn]=u:delete s[Gn]),_}var ml=Ka?function(s){return s==null?[]:(s=Ge(s),nn(Ka(s),function(l){return xu.call(s,l)}))}:Il,gd=Ka?function(s){for(var l=[];s;)rn(l,ml(s)),s=Ns(s);return l}:Il,gt=_t;(Na&>(new Na(new ArrayBuffer(1)))!=wi||Xr&>(new Xr)!=Ce||Ba&>(Ba.resolve())!=bn||ir&>(new ir)!=At||Ur&>(new Ur)!=Sn)&&(gt=function(s){var l=_t(s),u=l==Pt?s.constructor:t,y=u?Fn(u):"";if(y)switch(y){case jb:return wi;case Jb:return Ce;case Qb:return bn;case Hb:return At;case Eb:return Sn}return l});function dx(s,l,u){for(var y=-1,_=u.length;++y<_;){var P=u[y],T=P.size;switch(P.type){case"drop":s+=T;break;case"dropRight":l-=T;break;case"take":l=mt(l,s+T);break;case"takeRight":s=Qe(s,l-T);break}}return{start:s,end:l}}function fx(s){var l=s.match(_w);return l?l[1].split(ww):[]}function yd(s,l,u){l=cn(l,s);for(var y=-1,_=l.length,P=!1;++y<_;){var T=Mi(l[y]);if(!(P=s!=null&&u(s,T)))break;s=s[T]}return P||++y!=_?P:(_=s==null?0:s.length,!!_&&yo(_)&&Ii(T,_)&&(ue(s)||On(s)))}function px(s){var l=s.length,u=new s.constructor(l);return l&&typeof s[0]=="string"&&Te.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function vd(s){return typeof s.constructor=="function"&&!Qr(s)?rr(Ns(s)):{}}function mx(s,l,u){var y=s.constructor;switch(l){case en:return ll(s);case Re:case je:return new y(+s);case wi:return $1(s,u);case Ir:case Ar:case jn:case Fr:case Or:case Jn:case Ln:case O:case E:return ed(s,u);case Ce:return new y;case at:case $i:return new y(s);case xn:return q1(s);case At:return new y;case qi:return ex(s)}}function gx(s,l){var u=l.length;if(!u)return s;var y=u-1;return l[y]=(u>1?"& ":"")+l[y],l=l.join(u>2?", ":" "),s.replace(vw,`{
|
|
955
976
|
/* [wrapped with `+l+`] */
|
|
956
|
-
`)}function px(s){return he(s)||Oi(s)||!!(xh&&s&&s[xh])}function In(s,l){var h=typeof s;return l=l??ie,!!l&&(h=="number"||h!="symbol"&&Pw.test(s))&&s>-1&&s%1==0&&s<l}function _t(s,l,h){if(!Fe(h))return!1;var y=typeof l;return(y=="number"?Ct(h)&&In(l,h.length):y=="string"&&l in h)?un(h[l],s):!1}function gl(s,l){if(he(s))return!1;var h=typeof s;return h=="number"||h=="symbol"||h=="boolean"||s==null||Dt(s)?!0:Ci.test(s)||!Pi.test(s)||l!=null&&s in Ge(l)}function mx(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function yl(s){var l=ao(s),h=S[l];if(typeof h!="function"||!(l in be.prototype))return!1;if(s===h)return!0;var y=fl(h);return!!y&&s===y[0]}function gx(s){return!!vh&&vh in s}var yx=Ds?An:Al;function Qr(s){var l=s&&s.constructor,h=typeof l=="function"&&l.prototype||tr;return s===h}function vd(s){return s===s&&!Fe(s)}function _d(s,l){return function(h){return h==null?!1:h[s]===l&&(l!==t||s in Ge(h))}}function vx(s){var l=po(s,function(y){return h.size===d&&h.clear(),y}),h=l.cache;return l}function _x(s,l){var h=s[1],y=l[1],_=h|y,P=_<(x|L|X),T=y==X&&h==C||y==X&&h==I&&s[7].length<=l[8]||y==(X|I)&&l[7].length<=l[8]&&h==C;if(!(P||T))return s;y&x&&(s[2]=l[2],_|=h&x?0:M);var Z=l[3];if(Z){var F=s[3];s[3]=F?td(F,Z,l[4]):Z,s[4]=F?si(s[3],m):l[4]}return Z=l[5],Z&&(F=s[5],s[5]=F?nd(F,Z,l[6]):Z,s[6]=F?si(s[5],m):l[6]),Z=l[7],Z&&(s[7]=Z),y&X&&(s[8]=s[8]==null?l[8]:pt(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=_,s}function wx(s){var l=[];if(s!=null)for(var h in Ge(s))l.push(h);return l}function bx(s){return Xs.call(s)}function wd(s,l,h){return l=Je(l===t?s.length-1:l,0),function(){for(var y=arguments,_=-1,P=Je(y.length-l,0),T=U(P);++_<P;)T[_]=y[l+_];_=-1;for(var Z=U(l+1);++_<l;)Z[_]=y[_];return Z[l]=h(T),At(s,this,Z)}}function bd(s,l){return l.length<2?s:Ii(s,Ht(l,0,-1))}function xx(s,l){for(var h=s.length,y=pt(l.length,h),_=Pt(s);y--;){var P=l[y];s[y]=In(P,h)?_[P]:t}return s}function vl(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var xd=Sd(Yh),Hr=Db||function(s,l){return at.setTimeout(s,l)},_l=Sd(Y1);function Md(s,l,h){var y=l+"";return _l(s,fx(y,Mx(ux(y),h)))}function Sd(s){var l=0,h=0;return function(){var y=kb(),_=j-(y-h);if(h=y,_>0){if(++l>=k)return arguments[0]}else l=0;return s.apply(t,arguments)}}function co(s,l){var h=-1,y=s.length,_=y-1;for(l=l===t?y:l;++h<l;){var P=tl(h,_),T=s[P];s[P]=s[h],s[h]=T}return s.length=l,s}var Ld=vx(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Qi,function(h,y,_,P){l.push(_?P.replace(ww,"$1"):y||h)}),l});function Mn(s){if(typeof s=="string"||Dt(s))return s;var l=s+"";return l=="0"&&1/s==-re?"-0":l}function Fi(s){if(s!=null){try{return zs.call(s)}catch{}try{return s+""}catch{}}return""}function Mx(s,l){return Rt(it,function(h){var y="_."+h[0];l&h[1]&&!Is(s,y)&&s.push(y)}),s.sort()}function Pd(s){if(s instanceof be)return s.clone();var l=new Jt(s.__wrapped__,s.__chain__);return l.__actions__=Pt(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function Sx(s,l,h){(h?_t(s,l,h):l===t)?l=1:l=Je(pe(l),0);var y=s==null?0:s.length;if(!y||l<1)return[];for(var _=0,P=0,T=U(Ys(y/l));_<y;)T[P++]=Ht(s,_,_+=l);return T}function Lx(s){for(var l=-1,h=s==null?0:s.length,y=0,_=[];++l<h;){var P=s[l];P&&(_[y++]=P)}return _}function Px(){var s=arguments.length;if(!s)return[];for(var l=U(s-1),h=arguments[0],y=s;y--;)l[y-1]=arguments[y];return ri(he(h)?Pt(h):[h],lt(l,1))}var Cx=ye(function(s,l){return ke(s)?Br(s,lt(l,1,ke,!0)):[]}),Tx=ye(function(s,l){var h=Et(l);return ke(h)&&(h=t),ke(s)?Br(s,lt(l,1,ke,!0),se(h,2)):[]}),Gx=ye(function(s,l){var h=Et(l);return ke(h)&&(h=t),ke(s)?Br(s,lt(l,1,ke,!0),t,h):[]});function Wx(s,l,h){var y=s==null?0:s.length;return y?(l=h||l===t?1:pe(l),Ht(s,l<0?0:l,y)):[]}function Zx(s,l,h){var y=s==null?0:s.length;return y?(l=h||l===t?1:pe(l),l=y-l,Ht(s,0,l<0?0:l)):[]}function Vx(s,l){return s&&s.length?to(s,se(l,3),!0,!0):[]}function Ix(s,l){return s&&s.length?to(s,se(l,3),!0):[]}function Ax(s,l,h,y){var _=s==null?0:s.length;return _?(h&&typeof h!="number"&&_t(s,l,h)&&(h=0,y=_),P1(s,l,h,y)):[]}function Cd(s,l,h){var y=s==null?0:s.length;if(!y)return-1;var _=h==null?0:pe(h);return _<0&&(_=Je(y+_,0)),As(s,se(l,3),_)}function Td(s,l,h){var y=s==null?0:s.length;if(!y)return-1;var _=y-1;return h!==t&&(_=pe(h),_=h<0?Je(y+_,0):pt(_,y-1)),As(s,se(l,3),_,!0)}function Gd(s){var l=s==null?0:s.length;return l?lt(s,1):[]}function Fx(s){var l=s==null?0:s.length;return l?lt(s,re):[]}function Ox(s,l){var h=s==null?0:s.length;return h?(l=l===t?1:pe(l),lt(s,l)):[]}function Dx(s){for(var l=-1,h=s==null?0:s.length,y={};++l<h;){var _=s[l];y[_[0]]=_[1]}return y}function Wd(s){return s&&s.length?s[0]:t}function zx(s,l,h){var y=s==null?0:s.length;if(!y)return-1;var _=h==null?0:pe(h);return _<0&&(_=Je(y+_,0)),Ei(s,l,_)}function Xx(s){var l=s==null?0:s.length;return l?Ht(s,0,-1):[]}var Ux=ye(function(s){var l=Ae(s,ol);return l.length&&l[0]===s[0]?Ha(l):[]}),kx=ye(function(s){var l=Et(s),h=Ae(s,ol);return l===Et(h)?l=t:h.pop(),h.length&&h[0]===s[0]?Ha(h,se(l,2)):[]}),Kx=ye(function(s){var l=Et(s),h=Ae(s,ol);return l=typeof l=="function"?l:t,l&&h.pop(),h.length&&h[0]===s[0]?Ha(h,t,l):[]});function Nx(s,l){return s==null?"":Xb.call(s,l)}function Et(s){var l=s==null?0:s.length;return l?s[l-1]:t}function Bx(s,l,h){var y=s==null?0:s.length;if(!y)return-1;var _=y;return h!==t&&(_=pe(h),_=_<0?Je(y+_,0):pt(_,y-1)),l===l?Mb(s,l,_):As(s,uh,_,!0)}function Yx(s,l){return s&&s.length?kh(s,pe(l)):t}var Rx=ye(Zd);function Zd(s,l){return s&&s.length&&l&&l.length?el(s,l):s}function jx(s,l,h){return s&&s.length&&l&&l.length?el(s,l,se(h,2)):s}function Jx(s,l,h){return s&&s.length&&l&&l.length?el(s,l,t,h):s}var Qx=Vn(function(s,l){var h=s==null?0:s.length,y=Ra(s,l);return Bh(s,Ae(l,function(_){return In(_,h)?+_:_}).sort(ed)),y});function Hx(s,l){var h=[];if(!(s&&s.length))return h;var y=-1,_=[],P=s.length;for(l=se(l,3);++y<P;){var T=s[y];l(T,y,s)&&(h.push(T),_.push(y))}return Bh(s,_),h}function wl(s){return s==null?s:Nb.call(s)}function Ex(s,l,h){var y=s==null?0:s.length;return y?(h&&typeof h!="number"&&_t(s,l,h)?(l=0,h=y):(l=l==null?0:pe(l),h=h===t?y:pe(h)),Ht(s,l,h)):[]}function $x(s,l){return eo(s,l)}function qx(s,l,h){return il(s,l,se(h,2))}function eM(s,l){var h=s==null?0:s.length;if(h){var y=eo(s,l);if(y<h&&un(s[y],l))return y}return-1}function tM(s,l){return eo(s,l,!0)}function nM(s,l,h){return il(s,l,se(h,2),!0)}function iM(s,l){var h=s==null?0:s.length;if(h){var y=eo(s,l,!0)-1;if(un(s[y],l))return y}return-1}function rM(s){return s&&s.length?Rh(s):[]}function sM(s,l){return s&&s.length?Rh(s,se(l,2)):[]}function oM(s){var l=s==null?0:s.length;return l?Ht(s,1,l):[]}function aM(s,l,h){return s&&s.length?(l=h||l===t?1:pe(l),Ht(s,0,l<0?0:l)):[]}function lM(s,l,h){var y=s==null?0:s.length;return y?(l=h||l===t?1:pe(l),l=y-l,Ht(s,l<0?0:l,y)):[]}function cM(s,l){return s&&s.length?to(s,se(l,3),!1,!0):[]}function uM(s,l){return s&&s.length?to(s,se(l,3)):[]}var hM=ye(function(s){return li(lt(s,1,ke,!0))}),dM=ye(function(s){var l=Et(s);return ke(l)&&(l=t),li(lt(s,1,ke,!0),se(l,2))}),fM=ye(function(s){var l=Et(s);return l=typeof l=="function"?l:t,li(lt(s,1,ke,!0),t,l)});function pM(s){return s&&s.length?li(s):[]}function mM(s,l){return s&&s.length?li(s,se(l,2)):[]}function gM(s,l){return l=typeof l=="function"?l:t,s&&s.length?li(s,t,l):[]}function bl(s){if(!(s&&s.length))return[];var l=0;return s=ii(s,function(h){if(ke(h))return l=Je(h.length,l),!0}),za(l,function(h){return Ae(s,Fa(h))})}function Vd(s,l){if(!(s&&s.length))return[];var h=bl(s);return l==null?h:Ae(h,function(y){return At(l,t,y)})}var yM=ye(function(s,l){return ke(s)?Br(s,l):[]}),vM=ye(function(s){return sl(ii(s,ke))}),_M=ye(function(s){var l=Et(s);return ke(l)&&(l=t),sl(ii(s,ke),se(l,2))}),wM=ye(function(s){var l=Et(s);return l=typeof l=="function"?l:t,sl(ii(s,ke),t,l)}),bM=ye(bl);function xM(s,l){return Hh(s||[],l||[],Nr)}function MM(s,l){return Hh(s||[],l||[],jr)}var SM=ye(function(s){var l=s.length,h=l>1?s[l-1]:t;return h=typeof h=="function"?(s.pop(),h):t,Vd(s,h)});function Id(s){var l=S(s);return l.__chain__=!0,l}function LM(s,l){return l(s),s}function uo(s,l){return l(s)}var PM=Vn(function(s){var l=s.length,h=l?s[0]:0,y=this.__wrapped__,_=function(P){return Ra(P,s)};return l>1||this.__actions__.length||!(y instanceof be)||!In(h)?this.thru(_):(y=y.slice(h,+h+(l?1:0)),y.__actions__.push({func:uo,args:[_],thisArg:t}),new Jt(y,this.__chain__).thru(function(P){return l&&!P.length&&P.push(t),P}))});function CM(){return Id(this)}function TM(){return new Jt(this.value(),this.__chain__)}function GM(){this.__values__===t&&(this.__values__=jd(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function WM(){return this}function ZM(s){for(var l,h=this;h instanceof Qs;){var y=Pd(h);y.__index__=0,y.__values__=t,l?_.__wrapped__=y:l=y;var _=y;h=h.__wrapped__}return _.__wrapped__=s,l}function VM(){var s=this.__wrapped__;if(s instanceof be){var l=s;return this.__actions__.length&&(l=new be(this)),l=l.reverse(),l.__actions__.push({func:uo,args:[wl],thisArg:t}),new Jt(l,this.__chain__)}return this.thru(wl)}function IM(){return Qh(this.__wrapped__,this.__actions__)}var AM=no(function(s,l,h){Te.call(s,h)?++s[h]:Wn(s,h,1)});function FM(s,l,h){var y=he(s)?lh:L1;return h&&_t(s,l,h)&&(l=t),y(s,se(l,3))}function OM(s,l){var h=he(s)?ii:Vh;return h(s,se(l,3))}var DM=od(Cd),zM=od(Td);function XM(s,l){return lt(ho(s,l),1)}function UM(s,l){return lt(ho(s,l),re)}function kM(s,l,h){return h=h===t?1:pe(h),lt(ho(s,l),h)}function Ad(s,l){var h=he(s)?Rt:ai;return h(s,se(l,3))}function Fd(s,l){var h=he(s)?ob:Zh;return h(s,se(l,3))}var KM=no(function(s,l,h){Te.call(s,h)?s[h].push(l):Wn(s,h,[l])});function NM(s,l,h,y){s=Ct(s)?s:cr(s),h=h&&!y?pe(h):0;var _=s.length;return h<0&&(h=Je(_+h,0)),yo(s)?h<=_&&s.indexOf(l,h)>-1:!!_&&Ei(s,l,h)>-1}var BM=ye(function(s,l,h){var y=-1,_=typeof l=="function",P=Ct(s)?U(s.length):[];return ai(s,function(T){P[++y]=_?At(l,T,h):Yr(T,l,h)}),P}),YM=no(function(s,l,h){Wn(s,h,l)});function ho(s,l){var h=he(s)?Ae:zh;return h(s,se(l,3))}function RM(s,l,h,y){return s==null?[]:(he(l)||(l=l==null?[]:[l]),h=y?t:h,he(h)||(h=h==null?[]:[h]),Kh(s,l,h))}var jM=no(function(s,l,h){s[h?0:1].push(l)},function(){return[[],[]]});function JM(s,l,h){var y=he(s)?Ia:dh,_=arguments.length<3;return y(s,se(l,4),h,_,ai)}function QM(s,l,h){var y=he(s)?ab:dh,_=arguments.length<3;return y(s,se(l,4),h,_,Zh)}function HM(s,l){var h=he(s)?ii:Vh;return h(s,mo(se(l,3)))}function EM(s){var l=he(s)?Ch:N1;return l(s)}function $M(s,l,h){(h?_t(s,l,h):l===t)?l=1:l=pe(l);var y=he(s)?w1:B1;return y(s,l)}function qM(s){var l=he(s)?b1:R1;return l(s)}function eS(s){if(s==null)return 0;if(Ct(s))return yo(s)?qi(s):s.length;var l=mt(s);return l==Ce||l==It?s.size:$a(s).length}function tS(s,l,h){var y=he(s)?Aa:j1;return h&&_t(s,l,h)&&(l=t),y(s,se(l,3))}var nS=ye(function(s,l){if(s==null)return[];var h=l.length;return h>1&&_t(s,l[0],l[1])?l=[]:h>2&&_t(l[0],l[1],l[2])&&(l=[l[0]]),Kh(s,lt(l,1),[])}),fo=Ob||function(){return at.Date.now()};function iS(s,l){if(typeof l!="function")throw new jt(a);return s=pe(s),function(){if(--s<1)return l.apply(this,arguments)}}function Od(s,l,h){return l=h?t:l,l=s&&l==null?s.length:l,Zn(s,X,t,t,t,t,l)}function Dd(s,l){var h;if(typeof l!="function")throw new jt(a);return s=pe(s),function(){return--s>0&&(h=l.apply(this,arguments)),s<=1&&(l=t),h}}var xl=ye(function(s,l,h){var y=x;if(h.length){var _=si(h,ar(xl));y|=z}return Zn(s,y,l,h,_)}),zd=ye(function(s,l,h){var y=x|L;if(h.length){var _=si(h,ar(zd));y|=z}return Zn(l,y,s,h,_)});function Xd(s,l,h){l=h?t:l;var y=Zn(s,C,t,t,t,t,t,l);return y.placeholder=Xd.placeholder,y}function Ud(s,l,h){l=h?t:l;var y=Zn(s,W,t,t,t,t,t,l);return y.placeholder=Ud.placeholder,y}function kd(s,l,h){var y,_,P,T,Z,F,B=0,R=!1,J=!1,$=!0;if(typeof s!="function")throw new jt(a);l=$t(l)||0,Fe(h)&&(R=!!h.leading,J="maxWait"in h,P=J?Je($t(h.maxWait)||0,l):P,$="trailing"in h?!!h.trailing:$);function te(Ke){var hn=y,On=_;return y=_=t,B=Ke,T=s.apply(On,hn),T}function oe(Ke){return B=Ke,Z=Hr(we,l),R?te(Ke):T}function me(Ke){var hn=Ke-F,On=Ke-B,af=l-hn;return J?pt(af,P-On):af}function ae(Ke){var hn=Ke-F,On=Ke-B;return F===t||hn>=l||hn<0||J&&On>=P}function we(){var Ke=fo();if(ae(Ke))return xe(Ke);Z=Hr(we,me(Ke))}function xe(Ke){return Z=t,$&&y?te(Ke):(y=_=t,T)}function zt(){Z!==t&&Eh(Z),B=0,y=F=_=Z=t}function wt(){return Z===t?T:xe(fo())}function Xt(){var Ke=fo(),hn=ae(Ke);if(y=arguments,_=this,F=Ke,hn){if(Z===t)return oe(F);if(J)return Eh(Z),Z=Hr(we,l),te(F)}return Z===t&&(Z=Hr(we,l)),T}return Xt.cancel=zt,Xt.flush=wt,Xt}var rS=ye(function(s,l){return Wh(s,1,l)}),sS=ye(function(s,l,h){return Wh(s,$t(l)||0,h)});function oS(s){return Zn(s,K)}function po(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new jt(a);var h=function(){var y=arguments,_=l?l.apply(this,y):y[0],P=h.cache;if(P.has(_))return P.get(_);var T=s.apply(this,y);return h.cache=P.set(_,T)||P,T};return h.cache=new(po.Cache||Gn),h}po.Cache=Gn;function mo(s){if(typeof s!="function")throw new jt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function aS(s){return Dd(2,s)}var lS=J1(function(s,l){l=l.length==1&&he(l[0])?Ae(l[0],Ft(se())):Ae(lt(l,1),Ft(se()));var h=l.length;return ye(function(y){for(var _=-1,P=pt(y.length,h);++_<P;)y[_]=l[_].call(this,y[_]);return At(s,this,y)})}),Ml=ye(function(s,l){var h=si(l,ar(Ml));return Zn(s,z,t,l,h)}),Kd=ye(function(s,l){var h=si(l,ar(Kd));return Zn(s,D,t,l,h)}),cS=Vn(function(s,l){return Zn(s,I,t,t,t,l)});function uS(s,l){if(typeof s!="function")throw new jt(a);return l=l===t?l:pe(l),ye(s,l)}function hS(s,l){if(typeof s!="function")throw new jt(a);return l=l==null?0:Je(pe(l),0),ye(function(h){var y=h[l],_=ui(h,0,l);return y&&ri(_,y),At(s,this,_)})}function dS(s,l,h){var y=!0,_=!0;if(typeof s!="function")throw new jt(a);return Fe(h)&&(y="leading"in h?!!h.leading:y,_="trailing"in h?!!h.trailing:_),kd(s,l,{leading:y,maxWait:l,trailing:_})}function fS(s){return Od(s,1)}function pS(s,l){return Ml(al(l),s)}function mS(){if(!arguments.length)return[];var s=arguments[0];return he(s)?s:[s]}function gS(s){return Qt(s,v)}function yS(s,l){return l=typeof l=="function"?l:t,Qt(s,v,l)}function vS(s){return Qt(s,f|v)}function _S(s,l){return l=typeof l=="function"?l:t,Qt(s,f|v,l)}function wS(s,l){return l==null||Gh(s,l,He(l))}function un(s,l){return s===l||s!==s&&l!==l}var bS=oo(Qa),xS=oo(function(s,l){return s>=l}),Oi=Fh(function(){return arguments}())?Fh:function(s){return Xe(s)&&Te.call(s,"callee")&&!bh.call(s,"callee")},he=U.isArray,MS=nh?Ft(nh):Z1;function Ct(s){return s!=null&&go(s.length)&&!An(s)}function ke(s){return Xe(s)&&Ct(s)}function SS(s){return s===!0||s===!1||Xe(s)&&vt(s)==Ye}var hi=zb||Al,LS=ih?Ft(ih):V1;function PS(s){return Xe(s)&&s.nodeType===1&&!Er(s)}function CS(s){if(s==null)return!0;if(Ct(s)&&(he(s)||typeof s=="string"||typeof s.splice=="function"||hi(s)||lr(s)||Oi(s)))return!s.length;var l=mt(s);if(l==Ce||l==It)return!s.size;if(Qr(s))return!$a(s).length;for(var h in s)if(Te.call(s,h))return!1;return!0}function TS(s,l){return Rr(s,l)}function GS(s,l,h){h=typeof h=="function"?h:t;var y=h?h(s,l):t;return y===t?Rr(s,l,t,h):!!y}function Sl(s){if(!Xe(s))return!1;var l=vt(s);return l==ze||l==st||typeof s.message=="string"&&typeof s.name=="string"&&!Er(s)}function WS(s){return typeof s=="number"&&Mh(s)}function An(s){if(!Fe(s))return!1;var l=vt(s);return l==Vt||l==Nt||l==Qe||l==Ri}function Nd(s){return typeof s=="number"&&s==pe(s)}function go(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ie}function Fe(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Xe(s){return s!=null&&typeof s=="object"}var Bd=rh?Ft(rh):A1;function ZS(s,l){return s===l||Ea(s,l,pl(l))}function VS(s,l,h){return h=typeof h=="function"?h:t,Ea(s,l,pl(l),h)}function IS(s){return Yd(s)&&s!=+s}function AS(s){if(yx(s))throw new ue(o);return Oh(s)}function FS(s){return s===null}function OS(s){return s==null}function Yd(s){return typeof s=="number"||Xe(s)&&vt(s)==ot}function Er(s){if(!Xe(s)||vt(s)!=Lt)return!1;var l=Ks(s);if(l===null)return!0;var h=Te.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&zs.call(h)==Vb}var Ll=sh?Ft(sh):F1;function DS(s){return Nd(s)&&s>=-ie&&s<=ie}var Rd=oh?Ft(oh):O1;function yo(s){return typeof s=="string"||!he(s)&&Xe(s)&&vt(s)==qn}function Dt(s){return typeof s=="symbol"||Xe(s)&&vt(s)==ei}var lr=ah?Ft(ah):D1;function zS(s){return s===t}function XS(s){return Xe(s)&&mt(s)==Si}function US(s){return Xe(s)&&vt(s)==xa}var kS=oo(qa),KS=oo(function(s,l){return s<=l});function jd(s){if(!s)return[];if(Ct(s))return yo(s)?ln(s):Pt(s);if(zr&&s[zr])return wb(s[zr]());var l=mt(s),h=l==Ce?Ua:l==It?Fs:cr;return h(s)}function Fn(s){if(!s)return s===0?s:0;if(s=$t(s),s===re||s===-re){var l=s<0?-1:1;return l*le}return s===s?s:0}function pe(s){var l=Fn(s),h=l%1;return l===l?h?l-h:l:0}function Jd(s){return s?Vi(pe(s),0,ge):0}function $t(s){if(typeof s=="number")return s;if(Dt(s))return de;if(Fe(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Fe(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=fh(s);var h=Mw.test(s);return h||Lw.test(s)?ib(s.slice(2),h?2:8):xw.test(s)?de:+s}function Qd(s){return xn(s,Tt(s))}function NS(s){return s?Vi(pe(s),-ie,ie):s===0?s:0}function Pe(s){return s==null?"":Ot(s)}var BS=sr(function(s,l){if(Qr(l)||Ct(l)){xn(l,He(l),s);return}for(var h in l)Te.call(l,h)&&Nr(s,h,l[h])}),Hd=sr(function(s,l){xn(l,Tt(l),s)}),vo=sr(function(s,l,h,y){xn(l,Tt(l),s,y)}),YS=sr(function(s,l,h,y){xn(l,He(l),s,y)}),RS=Vn(Ra);function jS(s,l){var h=rr(s);return l==null?h:Th(h,l)}var JS=ye(function(s,l){s=Ge(s);var h=-1,y=l.length,_=y>2?l[2]:t;for(_&&_t(l[0],l[1],_)&&(y=1);++h<y;)for(var P=l[h],T=Tt(P),Z=-1,F=T.length;++Z<F;){var B=T[Z],R=s[B];(R===t||un(R,tr[B])&&!Te.call(s,B))&&(s[B]=P[B])}return s}),QS=ye(function(s){return s.push(t,fd),At(Ed,t,s)});function HS(s,l){return ch(s,se(l,3),bn)}function ES(s,l){return ch(s,se(l,3),Ja)}function $S(s,l){return s==null?s:ja(s,se(l,3),Tt)}function qS(s,l){return s==null?s:Ih(s,se(l,3),Tt)}function e2(s,l){return s&&bn(s,se(l,3))}function t2(s,l){return s&&Ja(s,se(l,3))}function n2(s){return s==null?[]:$s(s,He(s))}function i2(s){return s==null?[]:$s(s,Tt(s))}function Pl(s,l,h){var y=s==null?t:Ii(s,l);return y===t?h:y}function r2(s,l){return s!=null&&gd(s,l,C1)}function Cl(s,l){return s!=null&&gd(s,l,T1)}var s2=ld(function(s,l,h){l!=null&&typeof l.toString!="function"&&(l=Xs.call(l)),s[l]=h},Gl(Gt)),o2=ld(function(s,l,h){l!=null&&typeof l.toString!="function"&&(l=Xs.call(l)),Te.call(s,l)?s[l].push(h):s[l]=[h]},se),a2=ye(Yr);function He(s){return Ct(s)?Ph(s):$a(s)}function Tt(s){return Ct(s)?Ph(s,!0):z1(s)}function l2(s,l){var h={};return l=se(l,3),bn(s,function(y,_,P){Wn(h,l(y,_,P),y)}),h}function c2(s,l){var h={};return l=se(l,3),bn(s,function(y,_,P){Wn(h,_,l(y,_,P))}),h}var u2=sr(function(s,l,h){qs(s,l,h)}),Ed=sr(function(s,l,h,y){qs(s,l,h,y)}),h2=Vn(function(s,l){var h={};if(s==null)return h;var y=!1;l=Ae(l,function(P){return P=ci(P,s),y||(y=P.length>1),P}),xn(s,dl(s),h),y&&(h=Qt(h,f|g|v,sx));for(var _=l.length;_--;)rl(h,l[_]);return h});function d2(s,l){return $d(s,mo(se(l)))}var f2=Vn(function(s,l){return s==null?{}:U1(s,l)});function $d(s,l){if(s==null)return{};var h=Ae(dl(s),function(y){return[y]});return l=se(l),Nh(s,h,function(y,_){return l(y,_[0])})}function p2(s,l,h){l=ci(l,s);var y=-1,_=l.length;for(_||(_=1,s=t);++y<_;){var P=s==null?t:s[Mn(l[y])];P===t&&(y=_,P=h),s=An(P)?P.call(s):P}return s}function m2(s,l,h){return s==null?s:jr(s,l,h)}function g2(s,l,h,y){return y=typeof y=="function"?y:t,s==null?s:jr(s,l,h,y)}var qd=hd(He),ef=hd(Tt);function y2(s,l,h){var y=he(s),_=y||hi(s)||lr(s);if(l=se(l,4),h==null){var P=s&&s.constructor;_?h=y?new P:[]:Fe(s)?h=An(P)?rr(Ks(s)):{}:h={}}return(_?Rt:bn)(s,function(T,Z,F){return l(h,T,Z,F)}),h}function v2(s,l){return s==null?!0:rl(s,l)}function _2(s,l,h){return s==null?s:Jh(s,l,al(h))}function w2(s,l,h,y){return y=typeof y=="function"?y:t,s==null?s:Jh(s,l,al(h),y)}function cr(s){return s==null?[]:Xa(s,He(s))}function b2(s){return s==null?[]:Xa(s,Tt(s))}function x2(s,l,h){return h===t&&(h=l,l=t),h!==t&&(h=$t(h),h=h===h?h:0),l!==t&&(l=$t(l),l=l===l?l:0),Vi($t(s),l,h)}function M2(s,l,h){return l=Fn(l),h===t?(h=l,l=0):h=Fn(h),s=$t(s),G1(s,l,h)}function S2(s,l,h){if(h&&typeof h!="boolean"&&_t(s,l,h)&&(l=h=t),h===t&&(typeof l=="boolean"?(h=l,l=t):typeof s=="boolean"&&(h=s,s=t)),s===t&&l===t?(s=0,l=1):(s=Fn(s),l===t?(l=s,s=0):l=Fn(l)),s>l){var y=s;s=l,l=y}if(h||s%1||l%1){var _=Sh();return pt(s+_*(l-s+nb("1e-"+((_+"").length-1))),l)}return tl(s,l)}var L2=or(function(s,l,h){return l=l.toLowerCase(),s+(h?tf(l):l)});function tf(s){return Tl(Pe(s).toLowerCase())}function nf(s){return s=Pe(s),s&&s.replace(Cw,mb).replace(Rw,"")}function P2(s,l,h){s=Pe(s),l=Ot(l);var y=s.length;h=h===t?y:Vi(pe(h),0,y);var _=h;return h-=l.length,h>=0&&s.slice(h,_)==l}function C2(s){return s=Pe(s),s&&Gs.test(s)?s.replace(sn,gb):s}function T2(s){return s=Pe(s),s&&fw.test(s)?s.replace(Ma,"\\$&"):s}var G2=or(function(s,l,h){return s+(h?"-":"")+l.toLowerCase()}),W2=or(function(s,l,h){return s+(h?" ":"")+l.toLowerCase()}),Z2=sd("toLowerCase");function V2(s,l,h){s=Pe(s),l=pe(l);var y=l?qi(s):0;if(!l||y>=l)return s;var _=(l-y)/2;return so(Rs(_),h)+s+so(Ys(_),h)}function I2(s,l,h){s=Pe(s),l=pe(l);var y=l?qi(s):0;return l&&y<l?s+so(l-y,h):s}function A2(s,l,h){s=Pe(s),l=pe(l);var y=l?qi(s):0;return l&&y<l?so(l-y,h)+s:s}function F2(s,l,h){return h||l==null?l=0:l&&(l=+l),Kb(Pe(s).replace(Sa,""),l||0)}function O2(s,l,h){return(h?_t(s,l,h):l===t)?l=1:l=pe(l),nl(Pe(s),l)}function D2(){var s=arguments,l=Pe(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var z2=or(function(s,l,h){return s+(h?"_":"")+l.toLowerCase()});function X2(s,l,h){return h&&typeof h!="number"&&_t(s,l,h)&&(l=h=t),h=h===t?ge:h>>>0,h?(s=Pe(s),s&&(typeof l=="string"||l!=null&&!Ll(l))&&(l=Ot(l),!l&&$i(s))?ui(ln(s),0,h):s.split(l,h)):[]}var U2=or(function(s,l,h){return s+(h?" ":"")+Tl(l)});function k2(s,l,h){return s=Pe(s),h=h==null?0:Vi(pe(h),0,s.length),l=Ot(l),s.slice(h,h+l.length)==l}function K2(s,l,h){var y=S.templateSettings;h&&_t(s,l,h)&&(l=t),s=Pe(s),l=vo({},l,y,dd);var _=vo({},l.imports,y.imports,dd),P=He(_),T=Xa(_,P),Z,F,B=0,R=l.interpolate||Ws,J="__p += '",$=ka((l.escape||Ws).source+"|"+R.source+"|"+(R===ni?bw:Ws).source+"|"+(l.evaluate||Ws).source+"|$","g"),te="//# sourceURL="+(Te.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ew+"]")+`
|
|
957
|
-
`;s.replace($,function(ae,we,xe,
|
|
977
|
+
`)}function yx(s){return ue(s)||On(s)||!!(Mu&&s&&s[Mu])}function Ii(s,l){var u=typeof s;return l=l??ne,!!l&&(u=="number"||u!="symbol"&&Gw.test(s))&&s>-1&&s%1==0&&s<l}function wt(s,l,u){if(!Oe(u))return!1;var y=typeof l;return(y=="number"?Tt(u)&&Ii(l,u.length):y=="string"&&l in u)?hi(u[l],s):!1}function gl(s,l){if(ue(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||zt(s)?!0:Cn.test(s)||!Pn.test(s)||l!=null&&s in Ge(l)}function vx(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function yl(s){var l=lo(s),u=S[l];if(typeof u!="function"||!(l in be.prototype))return!1;if(s===u)return!0;var y=fl(u);return!!y&&s===y[0]}function _x(s){return!!_u&&_u in s}var wx=zs?Ai:Al;function Qr(s){var l=s&&s.constructor,u=typeof l=="function"&&l.prototype||tr;return s===u}function _d(s){return s===s&&!Oe(s)}function wd(s,l){return function(u){return u==null?!1:u[s]===l&&(l!==t||s in Ge(u))}}function bx(s){var l=mo(s,function(y){return u.size===d&&u.clear(),y}),u=l.cache;return l}function xx(s,l){var u=s[1],y=l[1],_=u|y,P=_<(x|L|X),T=y==X&&u==C||y==X&&u==I&&s[7].length<=l[8]||y==(X|I)&&l[7].length<=l[8]&&u==C;if(!(P||T))return s;y&x&&(s[2]=l[2],_|=u&x?0:M);var Z=l[3];if(Z){var F=s[3];s[3]=F?id(F,Z,l[4]):Z,s[4]=F?sn(s[3],m):l[4]}return Z=l[5],Z&&(F=s[5],s[5]=F?nd(F,Z,l[6]):Z,s[6]=F?sn(s[5],m):l[6]),Z=l[7],Z&&(s[7]=Z),y&X&&(s[8]=s[8]==null?l[8]:mt(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=_,s}function Mx(s){var l=[];if(s!=null)for(var u in Ge(s))l.push(u);return l}function Sx(s){return Us.call(s)}function bd(s,l,u){return l=Qe(l===t?s.length-1:l,0),function(){for(var y=arguments,_=-1,P=Qe(y.length-l,0),T=U(P);++_<P;)T[_]=y[l+_];_=-1;for(var Z=U(l+1);++_<l;)Z[_]=y[_];return Z[l]=u(T),Ft(s,this,Z)}}function xd(s,l){return l.length<2?s:In(s,Et(l,0,-1))}function Lx(s,l){for(var u=s.length,y=mt(l.length,u),_=Ct(s);y--;){var P=l[y];s[y]=Ii(P,u)?_[P]:t}return s}function vl(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var Md=Ld(Ru),Hr=Ub||function(s,l){return lt.setTimeout(s,l)},_l=Ld(J1);function Sd(s,l,u){var y=l+"";return _l(s,gx(y,Px(fx(y),u)))}function Ld(s){var l=0,u=0;return function(){var y=Bb(),_=j-(y-u);if(u=y,_>0){if(++l>=k)return arguments[0]}else l=0;return s.apply(t,arguments)}}function ho(s,l){var u=-1,y=s.length,_=y-1;for(l=l===t?y:l;++u<l;){var P=tl(u,_),T=s[P];s[P]=s[u],s[u]=T}return s.length=l,s}var Pd=bx(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Qn,function(u,y,_,P){l.push(_?P.replace(Mw,"$1"):y||u)}),l});function Mi(s){if(typeof s=="string"||zt(s))return s;var l=s+"";return l=="0"&&1/s==-re?"-0":l}function Fn(s){if(s!=null){try{return Xs.call(s)}catch{}try{return s+""}catch{}}return""}function Px(s,l){return jt(rt,function(u){var y="_."+u[0];l&u[1]&&!As(s,y)&&s.push(y)}),s.sort()}function Cd(s){if(s instanceof be)return s.clone();var l=new Qt(s.__wrapped__,s.__chain__);return l.__actions__=Ct(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function Cx(s,l,u){(u?wt(s,l,u):l===t)?l=1:l=Qe(pe(l),0);var y=s==null?0:s.length;if(!y||l<1)return[];for(var _=0,P=0,T=U(Rs(y/l));_<y;)T[P++]=Et(s,_,_+=l);return T}function Tx(s){for(var l=-1,u=s==null?0:s.length,y=0,_=[];++l<u;){var P=s[l];P&&(_[y++]=P)}return _}function Gx(){var s=arguments.length;if(!s)return[];for(var l=U(s-1),u=arguments[0],y=s;y--;)l[y-1]=arguments[y];return rn(ue(u)?Ct(u):[u],ct(l,1))}var Wx=ye(function(s,l){return Ke(s)?Br(s,ct(l,1,Ke,!0)):[]}),Zx=ye(function(s,l){var u=$t(l);return Ke(u)&&(u=t),Ke(s)?Br(s,ct(l,1,Ke,!0),se(u,2)):[]}),Vx=ye(function(s,l){var u=$t(l);return Ke(u)&&(u=t),Ke(s)?Br(s,ct(l,1,Ke,!0),t,u):[]});function Ix(s,l,u){var y=s==null?0:s.length;return y?(l=u||l===t?1:pe(l),Et(s,l<0?0:l,y)):[]}function Ax(s,l,u){var y=s==null?0:s.length;return y?(l=u||l===t?1:pe(l),l=y-l,Et(s,0,l<0?0:l)):[]}function Fx(s,l){return s&&s.length?io(s,se(l,3),!0,!0):[]}function Ox(s,l){return s&&s.length?io(s,se(l,3),!0):[]}function Dx(s,l,u,y){var _=s==null?0:s.length;return _?(u&&typeof u!="number"&&wt(s,l,u)&&(u=0,y=_),G1(s,l,u,y)):[]}function Td(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=u==null?0:pe(u);return _<0&&(_=Qe(y+_,0)),Fs(s,se(l,3),_)}function Gd(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=y-1;return u!==t&&(_=pe(u),_=u<0?Qe(y+_,0):mt(_,y-1)),Fs(s,se(l,3),_,!0)}function Wd(s){var l=s==null?0:s.length;return l?ct(s,1):[]}function zx(s){var l=s==null?0:s.length;return l?ct(s,re):[]}function Xx(s,l){var u=s==null?0:s.length;return u?(l=l===t?1:pe(l),ct(s,l)):[]}function Ux(s){for(var l=-1,u=s==null?0:s.length,y={};++l<u;){var _=s[l];y[_[0]]=_[1]}return y}function Zd(s){return s&&s.length?s[0]:t}function kx(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=u==null?0:pe(u);return _<0&&(_=Qe(y+_,0)),En(s,l,_)}function Kx(s){var l=s==null?0:s.length;return l?Et(s,0,-1):[]}var Nx=ye(function(s){var l=Fe(s,ol);return l.length&&l[0]===s[0]?Ha(l):[]}),Bx=ye(function(s){var l=$t(s),u=Fe(s,ol);return l===$t(u)?l=t:u.pop(),u.length&&u[0]===s[0]?Ha(u,se(l,2)):[]}),Yx=ye(function(s){var l=$t(s),u=Fe(s,ol);return l=typeof l=="function"?l:t,l&&u.pop(),u.length&&u[0]===s[0]?Ha(u,t,l):[]});function Rx(s,l){return s==null?"":Kb.call(s,l)}function $t(s){var l=s==null?0:s.length;return l?s[l-1]:t}function jx(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=y;return u!==t&&(_=pe(u),_=_<0?Qe(y+_,0):mt(_,y-1)),l===l?Pb(s,l,_):Fs(s,uu,_,!0)}function Jx(s,l){return s&&s.length?Ku(s,pe(l)):t}var Qx=ye(Vd);function Vd(s,l){return s&&s.length&&l&&l.length?el(s,l):s}function Hx(s,l,u){return s&&s.length&&l&&l.length?el(s,l,se(u,2)):s}function Ex(s,l,u){return s&&s.length&&l&&l.length?el(s,l,t,u):s}var $x=Vi(function(s,l){var u=s==null?0:s.length,y=Ra(s,l);return Yu(s,Fe(l,function(_){return Ii(_,u)?+_:_}).sort(td)),y});function qx(s,l){var u=[];if(!(s&&s.length))return u;var y=-1,_=[],P=s.length;for(l=se(l,3);++y<P;){var T=s[y];l(T,y,s)&&(u.push(T),_.push(y))}return Yu(s,_),u}function wl(s){return s==null?s:Rb.call(s)}function eM(s,l,u){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&wt(s,l,u)?(l=0,u=y):(l=l==null?0:pe(l),u=u===t?y:pe(u)),Et(s,l,u)):[]}function tM(s,l){return to(s,l)}function iM(s,l,u){return nl(s,l,se(u,2))}function nM(s,l){var u=s==null?0:s.length;if(u){var y=to(s,l);if(y<u&&hi(s[y],l))return y}return-1}function rM(s,l){return to(s,l,!0)}function sM(s,l,u){return nl(s,l,se(u,2),!0)}function oM(s,l){var u=s==null?0:s.length;if(u){var y=to(s,l,!0)-1;if(hi(s[y],l))return y}return-1}function aM(s){return s&&s.length?ju(s):[]}function lM(s,l){return s&&s.length?ju(s,se(l,2)):[]}function cM(s){var l=s==null?0:s.length;return l?Et(s,1,l):[]}function hM(s,l,u){return s&&s.length?(l=u||l===t?1:pe(l),Et(s,0,l<0?0:l)):[]}function uM(s,l,u){var y=s==null?0:s.length;return y?(l=u||l===t?1:pe(l),l=y-l,Et(s,l<0?0:l,y)):[]}function dM(s,l){return s&&s.length?io(s,se(l,3),!1,!0):[]}function fM(s,l){return s&&s.length?io(s,se(l,3)):[]}var pM=ye(function(s){return ln(ct(s,1,Ke,!0))}),mM=ye(function(s){var l=$t(s);return Ke(l)&&(l=t),ln(ct(s,1,Ke,!0),se(l,2))}),gM=ye(function(s){var l=$t(s);return l=typeof l=="function"?l:t,ln(ct(s,1,Ke,!0),t,l)});function yM(s){return s&&s.length?ln(s):[]}function vM(s,l){return s&&s.length?ln(s,se(l,2)):[]}function _M(s,l){return l=typeof l=="function"?l:t,s&&s.length?ln(s,t,l):[]}function bl(s){if(!(s&&s.length))return[];var l=0;return s=nn(s,function(u){if(Ke(u))return l=Qe(u.length,l),!0}),za(l,function(u){return Fe(s,Fa(u))})}function Id(s,l){if(!(s&&s.length))return[];var u=bl(s);return l==null?u:Fe(u,function(y){return Ft(l,t,y)})}var wM=ye(function(s,l){return Ke(s)?Br(s,l):[]}),bM=ye(function(s){return sl(nn(s,Ke))}),xM=ye(function(s){var l=$t(s);return Ke(l)&&(l=t),sl(nn(s,Ke),se(l,2))}),MM=ye(function(s){var l=$t(s);return l=typeof l=="function"?l:t,sl(nn(s,Ke),t,l)}),SM=ye(bl);function LM(s,l){return Eu(s||[],l||[],Nr)}function PM(s,l){return Eu(s||[],l||[],jr)}var CM=ye(function(s){var l=s.length,u=l>1?s[l-1]:t;return u=typeof u=="function"?(s.pop(),u):t,Id(s,u)});function Ad(s){var l=S(s);return l.__chain__=!0,l}function TM(s,l){return l(s),s}function uo(s,l){return l(s)}var GM=Vi(function(s){var l=s.length,u=l?s[0]:0,y=this.__wrapped__,_=function(P){return Ra(P,s)};return l>1||this.__actions__.length||!(y instanceof be)||!Ii(u)?this.thru(_):(y=y.slice(u,+u+(l?1:0)),y.__actions__.push({func:uo,args:[_],thisArg:t}),new Qt(y,this.__chain__).thru(function(P){return l&&!P.length&&P.push(t),P}))});function WM(){return Ad(this)}function ZM(){return new Qt(this.value(),this.__chain__)}function VM(){this.__values__===t&&(this.__values__=Jd(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function IM(){return this}function AM(s){for(var l,u=this;u instanceof Hs;){var y=Cd(u);y.__index__=0,y.__values__=t,l?_.__wrapped__=y:l=y;var _=y;u=u.__wrapped__}return _.__wrapped__=s,l}function FM(){var s=this.__wrapped__;if(s instanceof be){var l=s;return this.__actions__.length&&(l=new be(this)),l=l.reverse(),l.__actions__.push({func:uo,args:[wl],thisArg:t}),new Qt(l,this.__chain__)}return this.thru(wl)}function OM(){return Hu(this.__wrapped__,this.__actions__)}var DM=no(function(s,l,u){Te.call(s,u)?++s[u]:Wi(s,u,1)});function zM(s,l,u){var y=ue(s)?cu:T1;return u&&wt(s,l,u)&&(l=t),y(s,se(l,3))}function XM(s,l){var u=ue(s)?nn:Iu;return u(s,se(l,3))}var UM=ad(Td),kM=ad(Gd);function KM(s,l){return ct(fo(s,l),1)}function NM(s,l){return ct(fo(s,l),re)}function BM(s,l,u){return u=u===t?1:pe(u),ct(fo(s,l),u)}function Fd(s,l){var u=ue(s)?jt:an;return u(s,se(l,3))}function Od(s,l){var u=ue(s)?cb:Vu;return u(s,se(l,3))}var YM=no(function(s,l,u){Te.call(s,u)?s[u].push(l):Wi(s,u,[l])});function RM(s,l,u,y){s=Tt(s)?s:cr(s),u=u&&!y?pe(u):0;var _=s.length;return u<0&&(u=Qe(_+u,0)),vo(s)?u<=_&&s.indexOf(l,u)>-1:!!_&&En(s,l,u)>-1}var jM=ye(function(s,l,u){var y=-1,_=typeof l=="function",P=Tt(s)?U(s.length):[];return an(s,function(T){P[++y]=_?Ft(l,T,u):Yr(T,l,u)}),P}),JM=no(function(s,l,u){Wi(s,u,l)});function fo(s,l){var u=ue(s)?Fe:Xu;return u(s,se(l,3))}function QM(s,l,u,y){return s==null?[]:(ue(l)||(l=l==null?[]:[l]),u=y?t:u,ue(u)||(u=u==null?[]:[u]),Nu(s,l,u))}var HM=no(function(s,l,u){s[u?0:1].push(l)},function(){return[[],[]]});function EM(s,l,u){var y=ue(s)?Ia:fu,_=arguments.length<3;return y(s,se(l,4),u,_,an)}function $M(s,l,u){var y=ue(s)?hb:fu,_=arguments.length<3;return y(s,se(l,4),u,_,Vu)}function qM(s,l){var u=ue(s)?nn:Iu;return u(s,go(se(l,3)))}function eS(s){var l=ue(s)?Tu:R1;return l(s)}function tS(s,l,u){(u?wt(s,l,u):l===t)?l=1:l=pe(l);var y=ue(s)?M1:j1;return y(s,l)}function iS(s){var l=ue(s)?S1:Q1;return l(s)}function nS(s){if(s==null)return 0;if(Tt(s))return vo(s)?qn(s):s.length;var l=gt(s);return l==Ce||l==At?s.size:$a(s).length}function rS(s,l,u){var y=ue(s)?Aa:H1;return u&&wt(s,l,u)&&(l=t),y(s,se(l,3))}var sS=ye(function(s,l){if(s==null)return[];var u=l.length;return u>1&&wt(s,l[0],l[1])?l=[]:u>2&&wt(l[0],l[1],l[2])&&(l=[l[0]]),Nu(s,ct(l,1),[])}),po=Xb||function(){return lt.Date.now()};function oS(s,l){if(typeof l!="function")throw new Jt(a);return s=pe(s),function(){if(--s<1)return l.apply(this,arguments)}}function Dd(s,l,u){return l=u?t:l,l=s&&l==null?s.length:l,Zi(s,X,t,t,t,t,l)}function zd(s,l){var u;if(typeof l!="function")throw new Jt(a);return s=pe(s),function(){return--s>0&&(u=l.apply(this,arguments)),s<=1&&(l=t),u}}var xl=ye(function(s,l,u){var y=x;if(u.length){var _=sn(u,ar(xl));y|=z}return Zi(s,y,l,u,_)}),Xd=ye(function(s,l,u){var y=x|L;if(u.length){var _=sn(u,ar(Xd));y|=z}return Zi(l,y,s,u,_)});function Ud(s,l,u){l=u?t:l;var y=Zi(s,C,t,t,t,t,t,l);return y.placeholder=Ud.placeholder,y}function kd(s,l,u){l=u?t:l;var y=Zi(s,W,t,t,t,t,t,l);return y.placeholder=kd.placeholder,y}function Kd(s,l,u){var y,_,P,T,Z,F,B=0,R=!1,J=!1,$=!0;if(typeof s!="function")throw new Jt(a);l=qt(l)||0,Oe(u)&&(R=!!u.leading,J="maxWait"in u,P=J?Qe(qt(u.maxWait)||0,l):P,$="trailing"in u?!!u.trailing:$);function te(Ne){var ui=y,Oi=_;return y=_=t,B=Ne,T=s.apply(Oi,ui),T}function oe(Ne){return B=Ne,Z=Hr(we,l),R?te(Ne):T}function me(Ne){var ui=Ne-F,Oi=Ne-B,lf=l-ui;return J?mt(lf,P-Oi):lf}function ae(Ne){var ui=Ne-F,Oi=Ne-B;return F===t||ui>=l||ui<0||J&&Oi>=P}function we(){var Ne=po();if(ae(Ne))return xe(Ne);Z=Hr(we,me(Ne))}function xe(Ne){return Z=t,$&&y?te(Ne):(y=_=t,T)}function Xt(){Z!==t&&$u(Z),B=0,y=F=_=Z=t}function bt(){return Z===t?T:xe(po())}function Ut(){var Ne=po(),ui=ae(Ne);if(y=arguments,_=this,F=Ne,ui){if(Z===t)return oe(F);if(J)return $u(Z),Z=Hr(we,l),te(F)}return Z===t&&(Z=Hr(we,l)),T}return Ut.cancel=Xt,Ut.flush=bt,Ut}var aS=ye(function(s,l){return Zu(s,1,l)}),lS=ye(function(s,l,u){return Zu(s,qt(l)||0,u)});function cS(s){return Zi(s,K)}function mo(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new Jt(a);var u=function(){var y=arguments,_=l?l.apply(this,y):y[0],P=u.cache;if(P.has(_))return P.get(_);var T=s.apply(this,y);return u.cache=P.set(_,T)||P,T};return u.cache=new(mo.Cache||Gi),u}mo.Cache=Gi;function go(s){if(typeof s!="function")throw new Jt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function hS(s){return zd(2,s)}var uS=E1(function(s,l){l=l.length==1&&ue(l[0])?Fe(l[0],Ot(se())):Fe(ct(l,1),Ot(se()));var u=l.length;return ye(function(y){for(var _=-1,P=mt(y.length,u);++_<P;)y[_]=l[_].call(this,y[_]);return Ft(s,this,y)})}),Ml=ye(function(s,l){var u=sn(l,ar(Ml));return Zi(s,z,t,l,u)}),Nd=ye(function(s,l){var u=sn(l,ar(Nd));return Zi(s,D,t,l,u)}),dS=Vi(function(s,l){return Zi(s,I,t,t,t,l)});function fS(s,l){if(typeof s!="function")throw new Jt(a);return l=l===t?l:pe(l),ye(s,l)}function pS(s,l){if(typeof s!="function")throw new Jt(a);return l=l==null?0:Qe(pe(l),0),ye(function(u){var y=u[l],_=hn(u,0,l);return y&&rn(_,y),Ft(s,this,_)})}function mS(s,l,u){var y=!0,_=!0;if(typeof s!="function")throw new Jt(a);return Oe(u)&&(y="leading"in u?!!u.leading:y,_="trailing"in u?!!u.trailing:_),Kd(s,l,{leading:y,maxWait:l,trailing:_})}function gS(s){return Dd(s,1)}function yS(s,l){return Ml(al(l),s)}function vS(){if(!arguments.length)return[];var s=arguments[0];return ue(s)?s:[s]}function _S(s){return Ht(s,v)}function wS(s,l){return l=typeof l=="function"?l:t,Ht(s,v,l)}function bS(s){return Ht(s,f|v)}function xS(s,l){return l=typeof l=="function"?l:t,Ht(s,f|v,l)}function MS(s,l){return l==null||Wu(s,l,Ee(l))}function hi(s,l){return s===l||s!==s&&l!==l}var SS=ao(Qa),LS=ao(function(s,l){return s>=l}),On=Ou(function(){return arguments}())?Ou:function(s){return Ue(s)&&Te.call(s,"callee")&&!xu.call(s,"callee")},ue=U.isArray,PS=nu?Ot(nu):A1;function Tt(s){return s!=null&&yo(s.length)&&!Ai(s)}function Ke(s){return Ue(s)&&Tt(s)}function CS(s){return s===!0||s===!1||Ue(s)&&_t(s)==Re}var un=kb||Al,TS=ru?Ot(ru):F1;function GS(s){return Ue(s)&&s.nodeType===1&&!Er(s)}function WS(s){if(s==null)return!0;if(Tt(s)&&(ue(s)||typeof s=="string"||typeof s.splice=="function"||un(s)||lr(s)||On(s)))return!s.length;var l=gt(s);if(l==Ce||l==At)return!s.size;if(Qr(s))return!$a(s).length;for(var u in s)if(Te.call(s,u))return!1;return!0}function ZS(s,l){return Rr(s,l)}function VS(s,l,u){u=typeof u=="function"?u:t;var y=u?u(s,l):t;return y===t?Rr(s,l,t,u):!!y}function Sl(s){if(!Ue(s))return!1;var l=_t(s);return l==Xe||l==ot||typeof s.message=="string"&&typeof s.name=="string"&&!Er(s)}function IS(s){return typeof s=="number"&&Su(s)}function Ai(s){if(!Oe(s))return!1;var l=_t(s);return l==It||l==Bt||l==He||l==Rn}function Bd(s){return typeof s=="number"&&s==pe(s)}function yo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ne}function Oe(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Ue(s){return s!=null&&typeof s=="object"}var Yd=su?Ot(su):D1;function AS(s,l){return s===l||Ea(s,l,pl(l))}function FS(s,l,u){return u=typeof u=="function"?u:t,Ea(s,l,pl(l),u)}function OS(s){return Rd(s)&&s!=+s}function DS(s){if(wx(s))throw new he(o);return Du(s)}function zS(s){return s===null}function XS(s){return s==null}function Rd(s){return typeof s=="number"||Ue(s)&&_t(s)==at}function Er(s){if(!Ue(s)||_t(s)!=Pt)return!1;var l=Ns(s);if(l===null)return!0;var u=Te.call(l,"constructor")&&l.constructor;return typeof u=="function"&&u instanceof u&&Xs.call(u)==Fb}var Ll=ou?Ot(ou):z1;function US(s){return Bd(s)&&s>=-ne&&s<=ne}var jd=au?Ot(au):X1;function vo(s){return typeof s=="string"||!ue(s)&&Ue(s)&&_t(s)==$i}function zt(s){return typeof s=="symbol"||Ue(s)&&_t(s)==qi}var lr=lu?Ot(lu):U1;function kS(s){return s===t}function KS(s){return Ue(s)&>(s)==Sn}function NS(s){return Ue(s)&&_t(s)==xa}var BS=ao(qa),YS=ao(function(s,l){return s<=l});function Jd(s){if(!s)return[];if(Tt(s))return vo(s)?li(s):Ct(s);if(zr&&s[zr])return Mb(s[zr]());var l=gt(s),u=l==Ce?Ua:l==At?Os:cr;return u(s)}function Fi(s){if(!s)return s===0?s:0;if(s=qt(s),s===re||s===-re){var l=s<0?-1:1;return l*le}return s===s?s:0}function pe(s){var l=Fi(s),u=l%1;return l===l?u?l-u:l:0}function Qd(s){return s?Vn(pe(s),0,ge):0}function qt(s){if(typeof s=="number")return s;if(zt(s))return de;if(Oe(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Oe(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=pu(s);var u=Pw.test(s);return u||Tw.test(s)?ob(s.slice(2),u?2:8):Lw.test(s)?de:+s}function Hd(s){return xi(s,Gt(s))}function RS(s){return s?Vn(pe(s),-ne,ne):s===0?s:0}function Pe(s){return s==null?"":Dt(s)}var jS=sr(function(s,l){if(Qr(l)||Tt(l)){xi(l,Ee(l),s);return}for(var u in l)Te.call(l,u)&&Nr(s,u,l[u])}),Ed=sr(function(s,l){xi(l,Gt(l),s)}),_o=sr(function(s,l,u,y){xi(l,Gt(l),s,y)}),JS=sr(function(s,l,u,y){xi(l,Ee(l),s,y)}),QS=Vi(Ra);function HS(s,l){var u=rr(s);return l==null?u:Gu(u,l)}var ES=ye(function(s,l){s=Ge(s);var u=-1,y=l.length,_=y>2?l[2]:t;for(_&&wt(l[0],l[1],_)&&(y=1);++u<y;)for(var P=l[u],T=Gt(P),Z=-1,F=T.length;++Z<F;){var B=T[Z],R=s[B];(R===t||hi(R,tr[B])&&!Te.call(s,B))&&(s[B]=P[B])}return s}),$S=ye(function(s){return s.push(t,pd),Ft($d,t,s)});function qS(s,l){return hu(s,se(l,3),bi)}function e2(s,l){return hu(s,se(l,3),Ja)}function t2(s,l){return s==null?s:ja(s,se(l,3),Gt)}function i2(s,l){return s==null?s:Au(s,se(l,3),Gt)}function n2(s,l){return s&&bi(s,se(l,3))}function r2(s,l){return s&&Ja(s,se(l,3))}function s2(s){return s==null?[]:qs(s,Ee(s))}function o2(s){return s==null?[]:qs(s,Gt(s))}function Pl(s,l,u){var y=s==null?t:In(s,l);return y===t?u:y}function a2(s,l){return s!=null&&yd(s,l,W1)}function Cl(s,l){return s!=null&&yd(s,l,Z1)}var l2=cd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=Us.call(l)),s[l]=u},Gl(Wt)),c2=cd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=Us.call(l)),Te.call(s,l)?s[l].push(u):s[l]=[u]},se),h2=ye(Yr);function Ee(s){return Tt(s)?Cu(s):$a(s)}function Gt(s){return Tt(s)?Cu(s,!0):k1(s)}function u2(s,l){var u={};return l=se(l,3),bi(s,function(y,_,P){Wi(u,l(y,_,P),y)}),u}function d2(s,l){var u={};return l=se(l,3),bi(s,function(y,_,P){Wi(u,_,l(y,_,P))}),u}var f2=sr(function(s,l,u){eo(s,l,u)}),$d=sr(function(s,l,u,y){eo(s,l,u,y)}),p2=Vi(function(s,l){var u={};if(s==null)return u;var y=!1;l=Fe(l,function(P){return P=cn(P,s),y||(y=P.length>1),P}),xi(s,dl(s),u),y&&(u=Ht(u,f|g|v,lx));for(var _=l.length;_--;)rl(u,l[_]);return u});function m2(s,l){return qd(s,go(se(l)))}var g2=Vi(function(s,l){return s==null?{}:N1(s,l)});function qd(s,l){if(s==null)return{};var u=Fe(dl(s),function(y){return[y]});return l=se(l),Bu(s,u,function(y,_){return l(y,_[0])})}function y2(s,l,u){l=cn(l,s);var y=-1,_=l.length;for(_||(_=1,s=t);++y<_;){var P=s==null?t:s[Mi(l[y])];P===t&&(y=_,P=u),s=Ai(P)?P.call(s):P}return s}function v2(s,l,u){return s==null?s:jr(s,l,u)}function _2(s,l,u,y){return y=typeof y=="function"?y:t,s==null?s:jr(s,l,u,y)}var ef=dd(Ee),tf=dd(Gt);function w2(s,l,u){var y=ue(s),_=y||un(s)||lr(s);if(l=se(l,4),u==null){var P=s&&s.constructor;_?u=y?new P:[]:Oe(s)?u=Ai(P)?rr(Ns(s)):{}:u={}}return(_?jt:bi)(s,function(T,Z,F){return l(u,T,Z,F)}),u}function b2(s,l){return s==null?!0:rl(s,l)}function x2(s,l,u){return s==null?s:Qu(s,l,al(u))}function M2(s,l,u,y){return y=typeof y=="function"?y:t,s==null?s:Qu(s,l,al(u),y)}function cr(s){return s==null?[]:Xa(s,Ee(s))}function S2(s){return s==null?[]:Xa(s,Gt(s))}function L2(s,l,u){return u===t&&(u=l,l=t),u!==t&&(u=qt(u),u=u===u?u:0),l!==t&&(l=qt(l),l=l===l?l:0),Vn(qt(s),l,u)}function P2(s,l,u){return l=Fi(l),u===t?(u=l,l=0):u=Fi(u),s=qt(s),V1(s,l,u)}function C2(s,l,u){if(u&&typeof u!="boolean"&&wt(s,l,u)&&(l=u=t),u===t&&(typeof l=="boolean"?(u=l,l=t):typeof s=="boolean"&&(u=s,s=t)),s===t&&l===t?(s=0,l=1):(s=Fi(s),l===t?(l=s,s=0):l=Fi(l)),s>l){var y=s;s=l,l=y}if(u||s%1||l%1){var _=Lu();return mt(s+_*(l-s+sb("1e-"+((_+"").length-1))),l)}return tl(s,l)}var T2=or(function(s,l,u){return l=l.toLowerCase(),s+(u?nf(l):l)});function nf(s){return Tl(Pe(s).toLowerCase())}function rf(s){return s=Pe(s),s&&s.replace(Ww,vb).replace(Qw,"")}function G2(s,l,u){s=Pe(s),l=Dt(l);var y=s.length;u=u===t?y:Vn(pe(u),0,y);var _=u;return u-=l.length,u>=0&&s.slice(u,_)==l}function W2(s){return s=Pe(s),s&&Ws.test(s)?s.replace(si,_b):s}function Z2(s){return s=Pe(s),s&&gw.test(s)?s.replace(Ma,"\\$&"):s}var V2=or(function(s,l,u){return s+(u?"-":"")+l.toLowerCase()}),I2=or(function(s,l,u){return s+(u?" ":"")+l.toLowerCase()}),A2=od("toLowerCase");function F2(s,l,u){s=Pe(s),l=pe(l);var y=l?qn(s):0;if(!l||y>=l)return s;var _=(l-y)/2;return oo(js(_),u)+s+oo(Rs(_),u)}function O2(s,l,u){s=Pe(s),l=pe(l);var y=l?qn(s):0;return l&&y<l?s+oo(l-y,u):s}function D2(s,l,u){s=Pe(s),l=pe(l);var y=l?qn(s):0;return l&&y<l?oo(l-y,u)+s:s}function z2(s,l,u){return u||l==null?l=0:l&&(l=+l),Yb(Pe(s).replace(Sa,""),l||0)}function X2(s,l,u){return(u?wt(s,l,u):l===t)?l=1:l=pe(l),il(Pe(s),l)}function U2(){var s=arguments,l=Pe(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var k2=or(function(s,l,u){return s+(u?"_":"")+l.toLowerCase()});function K2(s,l,u){return u&&typeof u!="number"&&wt(s,l,u)&&(l=u=t),u=u===t?ge:u>>>0,u?(s=Pe(s),s&&(typeof l=="string"||l!=null&&!Ll(l))&&(l=Dt(l),!l&&$n(s))?hn(li(s),0,u):s.split(l,u)):[]}var N2=or(function(s,l,u){return s+(u?" ":"")+Tl(l)});function B2(s,l,u){return s=Pe(s),u=u==null?0:Vn(pe(u),0,s.length),l=Dt(l),s.slice(u,u+l.length)==l}function Y2(s,l,u){var y=S.templateSettings;u&&wt(s,l,u)&&(l=t),s=Pe(s),l=_o({},l,y,fd);var _=_o({},l.imports,y.imports,fd),P=Ee(_),T=Xa(_,P),Z,F,B=0,R=l.interpolate||Zs,J="__p += '",$=ka((l.escape||Zs).source+"|"+R.source+"|"+(R===tn?Sw:Zs).source+"|"+(l.evaluate||Zs).source+"|$","g"),te="//# sourceURL="+(Te.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++eb+"]")+`
|
|
978
|
+
`;s.replace($,function(ae,we,xe,Xt,bt,Ut){return xe||(xe=Xt),J+=s.slice(B,Ut).replace(Zw,wb),we&&(Z=!0,J+=`' +
|
|
958
979
|
__e(`+we+`) +
|
|
959
|
-
'`),
|
|
960
|
-
`+
|
|
980
|
+
'`),bt&&(F=!0,J+=`';
|
|
981
|
+
`+bt+`;
|
|
961
982
|
__p += '`),xe&&(J+=`' +
|
|
962
983
|
((__t = (`+xe+`)) == null ? '' : __t) +
|
|
963
|
-
'`),B=
|
|
984
|
+
'`),B=Ut+ae.length,ae}),J+=`';
|
|
964
985
|
`;var oe=Te.call(l,"variable")&&l.variable;if(!oe)J=`with (obj) {
|
|
965
986
|
`+J+`
|
|
966
987
|
}
|
|
967
|
-
`;else if(
|
|
988
|
+
`;else if(xw.test(oe))throw new he(c);J=(F?J.replace(ce,""):J).replace(Me,"$1").replace(Ye,"$1;"),J="function("+(oe||"obj")+`) {
|
|
968
989
|
`+(oe?"":`obj || (obj = {});
|
|
969
990
|
`)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(F?`, __j = Array.prototype.join;
|
|
970
991
|
function print() { __p += __j.call(arguments, '') }
|
|
971
992
|
`:`;
|
|
972
993
|
`)+J+`return __p
|
|
973
|
-
}`;var me=sf(function(){return Le(P,te+"return "+J).apply(t,T)});if(me.source=J,Sl(me))throw me;return me}function N2(s){return Pe(s).toLowerCase()}function B2(s){return Pe(s).toUpperCase()}function Y2(s,l,h){if(s=Pe(s),s&&(h||l===t))return fh(s);if(!s||!(l=Ot(l)))return s;var y=ln(s),_=ln(l),P=ph(y,_),T=mh(y,_)+1;return ui(y,P,T).join("")}function R2(s,l,h){if(s=Pe(s),s&&(h||l===t))return s.slice(0,yh(s)+1);if(!s||!(l=Ot(l)))return s;var y=ln(s),_=mh(y,ln(l))+1;return ui(y,0,_).join("")}function j2(s,l,h){if(s=Pe(s),s&&(h||l===t))return s.replace(Sa,"");if(!s||!(l=Ot(l)))return s;var y=ln(s),_=ph(y,ln(l));return ui(y,_).join("")}function J2(s,l){var h=V,y=G;if(Fe(l)){var _="separator"in l?l.separator:_;h="length"in l?pe(l.length):h,y="omission"in l?Ot(l.omission):y}s=Pe(s);var P=s.length;if($i(s)){var T=ln(s);P=T.length}if(h>=P)return s;var Z=h-qi(y);if(Z<1)return y;var F=T?ui(T,0,Z).join(""):s.slice(0,Z);if(_===t)return F+y;if(T&&(Z+=F.length-Z),Ll(_)){if(s.slice(Z).search(_)){var B,R=F;for(_.global||(_=ka(_.source,Pe(Fu.exec(_))+"g")),_.lastIndex=0;B=_.exec(R);)var J=B.index;F=F.slice(0,J===t?Z:J)}}else if(s.indexOf(Ot(_),Z)!=Z){var $=F.lastIndexOf(_);$>-1&&(F=F.slice(0,$))}return F+y}function Q2(s){return s=Pe(s),s&&Au.test(s)?s.replace(Bt,Sb):s}var H2=or(function(s,l,h){return s+(h?" ":"")+l.toUpperCase()}),Tl=sd("toUpperCase");function rf(s,l,h){return s=Pe(s),l=h?t:l,l===t?_b(s)?Cb(s):ub(s):s.match(l)||[]}var sf=ye(function(s,l){try{return At(s,t,l)}catch(h){return Sl(h)?h:new ue(h)}}),E2=Vn(function(s,l){return Rt(l,function(h){h=Mn(h),Wn(s,h,xl(s[h],s))}),s});function $2(s){var l=s==null?0:s.length,h=se();return s=l?Ae(s,function(y){if(typeof y[1]!="function")throw new jt(a);return[h(y[0]),y[1]]}):[],ye(function(y){for(var _=-1;++_<l;){var P=s[_];if(At(P[0],this,y))return At(P[1],this,y)}})}function q2(s){return S1(Qt(s,f))}function Gl(s){return function(){return s}}function eL(s,l){return s==null||s!==s?l:s}var tL=ad(),nL=ad(!0);function Gt(s){return s}function Wl(s){return Dh(typeof s=="function"?s:Qt(s,f))}function iL(s){return Xh(Qt(s,f))}function rL(s,l){return Uh(s,Qt(l,f))}var sL=ye(function(s,l){return function(h){return Yr(h,s,l)}}),oL=ye(function(s,l){return function(h){return Yr(s,h,l)}});function Zl(s,l,h){var y=He(l),_=$s(l,y);h==null&&!(Fe(l)&&(_.length||!y.length))&&(h=l,l=s,s=this,_=$s(l,He(l)));var P=!(Fe(h)&&"chain"in h)||!!h.chain,T=An(s);return Rt(_,function(Z){var F=l[Z];s[Z]=F,T&&(s.prototype[Z]=function(){var B=this.__chain__;if(P||B){var R=s(this.__wrapped__),J=R.__actions__=Pt(this.__actions__);return J.push({func:F,args:arguments,thisArg:s}),R.__chain__=B,R}return F.apply(s,ri([this.value()],arguments))})}),s}function aL(){return at._===this&&(at._=Ib),this}function Vl(){}function lL(s){return s=pe(s),ye(function(l){return kh(l,s)})}var cL=cl(Ae),uL=cl(lh),hL=cl(Aa);function of(s){return gl(s)?Fa(Mn(s)):k1(s)}function dL(s){return function(l){return s==null?t:Ii(s,l)}}var fL=cd(),pL=cd(!0);function Il(){return[]}function Al(){return!1}function mL(){return{}}function gL(){return""}function yL(){return!0}function vL(s,l){if(s=pe(s),s<1||s>ie)return[];var h=ge,y=pt(s,ge);l=se(l),s-=ge;for(var _=za(y,l);++h<s;)l(h);return _}function _L(s){return he(s)?Ae(s,Mn):Dt(s)?[s]:Pt(Ld(Pe(s)))}function wL(s){var l=++Zb;return Pe(s)+l}var bL=ro(function(s,l){return s+l},0),xL=ul("ceil"),ML=ro(function(s,l){return s/l},1),SL=ul("floor");function LL(s){return s&&s.length?Es(s,Gt,Qa):t}function PL(s,l){return s&&s.length?Es(s,se(l,2),Qa):t}function CL(s){return hh(s,Gt)}function TL(s,l){return hh(s,se(l,2))}function GL(s){return s&&s.length?Es(s,Gt,qa):t}function WL(s,l){return s&&s.length?Es(s,se(l,2),qa):t}var ZL=ro(function(s,l){return s*l},1),VL=ul("round"),IL=ro(function(s,l){return s-l},0);function AL(s){return s&&s.length?Da(s,Gt):0}function FL(s,l){return s&&s.length?Da(s,se(l,2)):0}return S.after=iS,S.ary=Od,S.assign=BS,S.assignIn=Hd,S.assignInWith=vo,S.assignWith=YS,S.at=RS,S.before=Dd,S.bind=xl,S.bindAll=E2,S.bindKey=zd,S.castArray=mS,S.chain=Id,S.chunk=Sx,S.compact=Lx,S.concat=Px,S.cond=$2,S.conforms=q2,S.constant=Gl,S.countBy=AM,S.create=jS,S.curry=Xd,S.curryRight=Ud,S.debounce=kd,S.defaults=JS,S.defaultsDeep=QS,S.defer=rS,S.delay=sS,S.difference=Cx,S.differenceBy=Tx,S.differenceWith=Gx,S.drop=Wx,S.dropRight=Zx,S.dropRightWhile=Vx,S.dropWhile=Ix,S.fill=Ax,S.filter=OM,S.flatMap=XM,S.flatMapDeep=UM,S.flatMapDepth=kM,S.flatten=Gd,S.flattenDeep=Fx,S.flattenDepth=Ox,S.flip=oS,S.flow=tL,S.flowRight=nL,S.fromPairs=Dx,S.functions=n2,S.functionsIn=i2,S.groupBy=KM,S.initial=Xx,S.intersection=Ux,S.intersectionBy=kx,S.intersectionWith=Kx,S.invert=s2,S.invertBy=o2,S.invokeMap=BM,S.iteratee=Wl,S.keyBy=YM,S.keys=He,S.keysIn=Tt,S.map=ho,S.mapKeys=l2,S.mapValues=c2,S.matches=iL,S.matchesProperty=rL,S.memoize=po,S.merge=u2,S.mergeWith=Ed,S.method=sL,S.methodOf=oL,S.mixin=Zl,S.negate=mo,S.nthArg=lL,S.omit=h2,S.omitBy=d2,S.once=aS,S.orderBy=RM,S.over=cL,S.overArgs=lS,S.overEvery=uL,S.overSome=hL,S.partial=Ml,S.partialRight=Kd,S.partition=jM,S.pick=f2,S.pickBy=$d,S.property=of,S.propertyOf=dL,S.pull=Rx,S.pullAll=Zd,S.pullAllBy=jx,S.pullAllWith=Jx,S.pullAt=Qx,S.range=fL,S.rangeRight=pL,S.rearg=cS,S.reject=HM,S.remove=Hx,S.rest=uS,S.reverse=wl,S.sampleSize=$M,S.set=m2,S.setWith=g2,S.shuffle=qM,S.slice=Ex,S.sortBy=nS,S.sortedUniq=rM,S.sortedUniqBy=sM,S.split=X2,S.spread=hS,S.tail=oM,S.take=aM,S.takeRight=lM,S.takeRightWhile=cM,S.takeWhile=uM,S.tap=LM,S.throttle=dS,S.thru=uo,S.toArray=jd,S.toPairs=qd,S.toPairsIn=ef,S.toPath=_L,S.toPlainObject=Qd,S.transform=y2,S.unary=fS,S.union=hM,S.unionBy=dM,S.unionWith=fM,S.uniq=pM,S.uniqBy=mM,S.uniqWith=gM,S.unset=v2,S.unzip=bl,S.unzipWith=Vd,S.update=_2,S.updateWith=w2,S.values=cr,S.valuesIn=b2,S.without=yM,S.words=rf,S.wrap=pS,S.xor=vM,S.xorBy=_M,S.xorWith=wM,S.zip=bM,S.zipObject=xM,S.zipObjectDeep=MM,S.zipWith=SM,S.entries=qd,S.entriesIn=ef,S.extend=Hd,S.extendWith=vo,Zl(S,S),S.add=bL,S.attempt=sf,S.camelCase=L2,S.capitalize=tf,S.ceil=xL,S.clamp=x2,S.clone=gS,S.cloneDeep=vS,S.cloneDeepWith=_S,S.cloneWith=yS,S.conformsTo=wS,S.deburr=nf,S.defaultTo=eL,S.divide=ML,S.endsWith=P2,S.eq=un,S.escape=C2,S.escapeRegExp=T2,S.every=FM,S.find=DM,S.findIndex=Cd,S.findKey=HS,S.findLast=zM,S.findLastIndex=Td,S.findLastKey=ES,S.floor=SL,S.forEach=Ad,S.forEachRight=Fd,S.forIn=$S,S.forInRight=qS,S.forOwn=e2,S.forOwnRight=t2,S.get=Pl,S.gt=bS,S.gte=xS,S.has=r2,S.hasIn=Cl,S.head=Wd,S.identity=Gt,S.includes=NM,S.indexOf=zx,S.inRange=M2,S.invoke=a2,S.isArguments=Oi,S.isArray=he,S.isArrayBuffer=MS,S.isArrayLike=Ct,S.isArrayLikeObject=ke,S.isBoolean=SS,S.isBuffer=hi,S.isDate=LS,S.isElement=PS,S.isEmpty=CS,S.isEqual=TS,S.isEqualWith=GS,S.isError=Sl,S.isFinite=WS,S.isFunction=An,S.isInteger=Nd,S.isLength=go,S.isMap=Bd,S.isMatch=ZS,S.isMatchWith=VS,S.isNaN=IS,S.isNative=AS,S.isNil=OS,S.isNull=FS,S.isNumber=Yd,S.isObject=Fe,S.isObjectLike=Xe,S.isPlainObject=Er,S.isRegExp=Ll,S.isSafeInteger=DS,S.isSet=Rd,S.isString=yo,S.isSymbol=Dt,S.isTypedArray=lr,S.isUndefined=zS,S.isWeakMap=XS,S.isWeakSet=US,S.join=Nx,S.kebabCase=G2,S.last=Et,S.lastIndexOf=Bx,S.lowerCase=W2,S.lowerFirst=Z2,S.lt=kS,S.lte=KS,S.max=LL,S.maxBy=PL,S.mean=CL,S.meanBy=TL,S.min=GL,S.minBy=WL,S.stubArray=Il,S.stubFalse=Al,S.stubObject=mL,S.stubString=gL,S.stubTrue=yL,S.multiply=ZL,S.nth=Yx,S.noConflict=aL,S.noop=Vl,S.now=fo,S.pad=V2,S.padEnd=I2,S.padStart=A2,S.parseInt=F2,S.random=S2,S.reduce=JM,S.reduceRight=QM,S.repeat=O2,S.replace=D2,S.result=p2,S.round=VL,S.runInContext=A,S.sample=EM,S.size=eS,S.snakeCase=z2,S.some=tS,S.sortedIndex=$x,S.sortedIndexBy=qx,S.sortedIndexOf=eM,S.sortedLastIndex=tM,S.sortedLastIndexBy=nM,S.sortedLastIndexOf=iM,S.startCase=U2,S.startsWith=k2,S.subtract=IL,S.sum=AL,S.sumBy=FL,S.template=K2,S.times=vL,S.toFinite=Fn,S.toInteger=pe,S.toLength=Jd,S.toLower=N2,S.toNumber=$t,S.toSafeInteger=NS,S.toString=Pe,S.toUpper=B2,S.trim=Y2,S.trimEnd=R2,S.trimStart=j2,S.truncate=J2,S.unescape=Q2,S.uniqueId=wL,S.upperCase=H2,S.upperFirst=Tl,S.each=Ad,S.eachRight=Fd,S.first=Wd,Zl(S,function(){var s={};return bn(S,function(l,h){Te.call(S.prototype,h)||(s[h]=l)}),s}(),{chain:!1}),S.VERSION=n,Rt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){S[s].placeholder=S}),Rt(["drop","take"],function(s,l){be.prototype[s]=function(h){h=h===t?1:Je(pe(h),0);var y=this.__filtered__&&!l?new be(this):this.clone();return y.__filtered__?y.__takeCount__=pt(h,y.__takeCount__):y.__views__.push({size:pt(h,ge),type:s+(y.__dir__<0?"Right":"")}),y},be.prototype[s+"Right"]=function(h){return this.reverse()[s](h).reverse()}}),Rt(["filter","map","takeWhile"],function(s,l){var h=l+1,y=h==Y||h==Q;be.prototype[s]=function(_){var P=this.clone();return P.__iteratees__.push({iteratee:se(_,3),type:h}),P.__filtered__=P.__filtered__||y,P}}),Rt(["head","last"],function(s,l){var h="take"+(l?"Right":"");be.prototype[s]=function(){return this[h](1).value()[0]}}),Rt(["initial","tail"],function(s,l){var h="drop"+(l?"":"Right");be.prototype[s]=function(){return this.__filtered__?new be(this):this[h](1)}}),be.prototype.compact=function(){return this.filter(Gt)},be.prototype.find=function(s){return this.filter(s).head()},be.prototype.findLast=function(s){return this.reverse().find(s)},be.prototype.invokeMap=ye(function(s,l){return typeof s=="function"?new be(this):this.map(function(h){return Yr(h,s,l)})}),be.prototype.reject=function(s){return this.filter(mo(se(s)))},be.prototype.slice=function(s,l){s=pe(s);var h=this;return h.__filtered__&&(s>0||l<0)?new be(h):(s<0?h=h.takeRight(-s):s&&(h=h.drop(s)),l!==t&&(l=pe(l),h=l<0?h.dropRight(-l):h.take(l-s)),h)},be.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},be.prototype.toArray=function(){return this.take(ge)},bn(be.prototype,function(s,l){var h=/^(?:filter|find|map|reject)|While$/.test(l),y=/^(?:head|last)$/.test(l),_=S[y?"take"+(l=="last"?"Right":""):l],P=y||/^find/.test(l);_&&(S.prototype[l]=function(){var T=this.__wrapped__,Z=y?[1]:arguments,F=T instanceof be,B=Z[0],R=F||he(T),J=function(we){var xe=_.apply(S,ri([we],Z));return y&&$?xe[0]:xe};R&&h&&typeof B=="function"&&B.length!=1&&(F=R=!1);var $=this.__chain__,te=!!this.__actions__.length,oe=P&&!$,me=F&&!te;if(!P&&R){T=me?T:new be(this);var ae=s.apply(T,Z);return ae.__actions__.push({func:uo,args:[J],thisArg:t}),new Jt(ae,$)}return oe&&me?s.apply(this,Z):(ae=this.thru(J),oe?y?ae.value()[0]:ae.value():ae)})}),Rt(["pop","push","shift","sort","splice","unshift"],function(s){var l=Os[s],h=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",y=/^(?:pop|shift)$/.test(s);S.prototype[s]=function(){var _=arguments;if(y&&!this.__chain__){var P=this.value();return l.apply(he(P)?P:[],_)}return this[h](function(T){return l.apply(he(T)?T:[],_)})}}),bn(be.prototype,function(s,l){var h=S[l];if(h){var y=h.name+"";Te.call(ir,y)||(ir[y]=[]),ir[y].push({name:l,func:h})}}),ir[io(t,L).name]=[{name:"wrapper",func:t}],be.prototype.clone=Qb,be.prototype.reverse=Hb,be.prototype.value=Eb,S.prototype.at=PM,S.prototype.chain=CM,S.prototype.commit=TM,S.prototype.next=GM,S.prototype.plant=ZM,S.prototype.reverse=VM,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=IM,S.prototype.first=S.prototype.head,zr&&(S.prototype[zr]=WM),S},er=Tb();Ti?((Ti.exports=er)._=er,Wa._=er):at._=er}).call(Pr)}(ys,ys.exports);var M0=ys.exports,S0=Object.defineProperty,L0=(r,e,t)=>e in r?S0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,P0=(r,e,t)=>L0(r,e+"",t);let en=class extends ut{constructor(e){super(e),P0(this,"_baseType","Point"),this._threeGeometry=this._createThreeGeometry(),this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=new p.Vector3(this._geometry.coordinates[0],this._geometry.coordinates[1],this._geometry.coordinates[2]||0);return e?e.geo2world(t):t}_toThreeJSGeometry(){}_updateGeometryPositions(){const e=this._coordsTransform();if(this._position=e,this._threeGeometry){const t=this.getMap();t?.prjcenter?this._threeGeometry.position.copy(e).sub(t.prjcenter):this._threeGeometry.position.copy(e),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0)}else this._toThreeJSGeometry()}_createThreeGeometry(){return new p.Points(new p.BufferGeometry,new p.PointsMaterial({size:1,color:8947848}))}};var C0=Object.defineProperty,T0=(r,e,t)=>e in r?C0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,G0=(r,e,t)=>T0(r,e+"",t);const W0={};class Pn extends en{constructor(e){super(e),G0(this,"_type","Marker")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){this._position=this._coordsTransform(),this._threeGeometry?(this._threeGeometry.position.copy(this._position),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)):this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-point":return Ac(e.config,new p.Vector3(0,0,0));case"icon-point":return cg(e.config,this._position);case"icon-label-point":return vg(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_calculateCollisionBoundingBox(e,t){if(!this.visible||!this._threeGeometry||!e||!t)return null;try{switch(this._style?.config.type){case"icon-point":return this._calculateSpriteBoundingBox(this._threeGeometry);default:return this._getFallbackBoundingBox()}}catch(n){return console.warn(`Marker ${this._id} bounding box calculation failed:`,n),console.warn(`Marker ${this._id} 包围盒计算失败:`,n),this._getFallbackBoundingBox()}}_calculateSpriteBoundingBox(e){try{const n=Math.max(Math.abs(e.scale.x),Math.abs(e.scale.y))/.002;return{width:n,height:n,offsetX:-n/2,offsetY:-n/2}}catch{return{width:20,height:20,offsetX:-10,offsetY:-10}}}_getFallbackBoundingBox(){switch(this.getStyle()?.config.type){case"icon-point":case"icon-label-point":return{width:20,height:20,offsetX:-10,offsetY:-10};case"basic-point":return{width:10,height:10,offsetX:-5,offsetY:-5};default:return{width:15,height:15,offsetX:-7.5,offsetY:-7.5}}}}Pn.mergeOptions(W0);var Z0=Object.defineProperty,V0=(r,e,t)=>e in r?Z0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ec=(r,e,t)=>V0(r,typeof e!="symbol"?e+"":e,t);class $c extends ut{constructor(e){super(e),Ec(this,"_baseType","Line"),Ec(this,"_vertexPoints"),this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=this._geometry,n=e?.prjcenter;if(this._geometry.type==="LineString"){let o=t.coordinates.map(c=>{const u=new p.Vector3(c[0],c[1],c[2]||0);return(e?e.geo2world(u):u).sub(n)}),a=o.flatMap(c=>[c.x,c.y,c.z]);return{_position:o,_vertexPoints:a}}}_toThreeJSGeometry(){}_createThreeGeometry(){const e=new rs,t=new gr({color:8947848,linewidth:.1,dashed:!1,resolution:new p.Vector2(window.innerWidth,window.innerHeight)});return new yr(e,t)}}var I0=Object.defineProperty,A0=(r,e,t)=>e in r?I0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F0=(r,e,t)=>A0(r,e+"",t);const O0={};class Mt extends $c{constructor(e){super(e),F0(this,"_type","LineString")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){let{_vertexPoints:e}=this._coordsTransform();if(this._vertexPoints=e,this._threeGeometry&&(this._threeGeometry.isLine2||this._threeGeometry instanceof yr)){const i=this._threeGeometry.geometry;i.setPositions(this._vertexPoints),i.computeBoundingSphere(),i.computeBoundingBox();const o=this.getMap();o?.prjcenter&&this._threeGeometry.position.set(o.prjcenter.x,o.prjcenter.y,o.prjcenter.z),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)}else console.warn("[LineString] _updateGeometryPositions: Geometry type mismatch, fallback to full rebuild",{hasGeometry:!!this._threeGeometry,geometryType:this._threeGeometry?.constructor?.name,isLine2:this._threeGeometry?.isLine2}),this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-line":return Ho(e.config,this._vertexPoints);case"flow-tube-line":return Fc(e.config,this._vertexPoints);case"arrow-line":return Oc(e.config,this._vertexPoints);case"flow-texture-line":return await Dc(e.config,this._vertexPoints);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_updateGeometry(){const e=this.getMap();if(this._threeGeometry){if(this._threeGeometry instanceof yr){const n=this._threeGeometry.geometry;n.setPositions(this._vertexPoints),n.computeBoundingSphere(),n.computeBoundingBox()}this._threeGeometry.position.add(e?.prjcenter),this._threeGeometry.renderOrder=99,this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue()}}}Mt.mergeOptions(O0);var D0=Object.defineProperty,z0=(r,e,t)=>e in r?D0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qc=(r,e,t)=>z0(r,typeof e!="symbol"?e+"":e,t);class X0 extends ut{constructor(e){super(e),qc(this,"_baseType","Surface"),qc(this,"_vertexPoints"),this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=e?.prjcenter,n=this._geometry;if(!n)throw new Error("Geometry data undefined");if(n.type==="Polygon"){const i=n.coordinates;let o=[],a=[];return i.forEach(c=>{const u=c.map(d=>{const m=new p.Vector3(d[0],d[1],d[2]||0);return(e?e.geo2world(m):m).sub(t)});o.push(u),a.push(...u.flatMap(d=>[d.x,d.y,d.z]))}),{_positions:o,_vertexPoints:a}}else if(n.type==="MultiPolygon"){const i=n.coordinates;let o=[],a=[];return i.forEach(c=>{const u=[];c.forEach(d=>{const m=d.map(f=>{const g=new p.Vector3(f[0],f[1],f[2]||0);return(e?e.geo2world(g):g).sub(t)});u.push(m),a.push(...m.flatMap(f=>[f.x,f.y,f.z]))}),o.push(u)}),{_positions:o,_vertexPoints:a}}else throw new Error(`Unsupported geometry type: ${n.type}`)}_updateGeometry(){const e=this._style?.config.type;if(this.clear(),!this._threeGeometry||!this._vertexPoints?.length){console.warn("Cannot update geometry: missing geometry or vertex data");return}const t=this.getMap();try{e==="basic-polygon"?(this._threeGeometry.renderOrder=90,this._threeGeometry.position.add(t?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry)):(e==="extrude-polygon"||e?.includes("water"))&&(this._threeGeometry.renderOrder=90,this._threeGeometry.position.add(t?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry))}catch(n){throw console.error("Failed to update polygon position:",n),n}}_createThreeGeometry(){const e=new rs,t=new gr({color:8947848,linewidth:.1,dashed:!1,resolution:new p.Vector2(window.innerWidth,window.innerHeight)});return new yr(e,t)}}var U0=Object.defineProperty,k0=(r,e,t)=>e in r?U0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,K0=(r,e,t)=>k0(r,e+"",t);const N0={};class vn extends X0{constructor(e){super(e),K0(this,"_type","Polygon")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this.remove(this._threeGeometry),this._threeGeometry=await this._createObject(this._style),this._updateGeometry(),await this._style.applyTo(this._threeGeometry))}_updateGeometryPositions(){const e=this._style?.config.type;console.warn("[Polygon] _updateGeometryPositions: Fallback to full rebuild",{styleType:e,hasGeometry:!!this._threeGeometry}),this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-polygon":return hg(e.config,this._vertexPoints);case"extrude-polygon":return dg(e.config,this._vertexPoints);case"water":return fg(e.config,this.getMap(),this._vertexPoints);case"base-water":return pg(e.config,this._vertexPoints);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_calculateCollisionBoundingBox(){return null}}vn.mergeOptions(N0);var B0=Object.defineProperty,Y0=(r,e,t)=>e in r?B0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ta=(r,e,t)=>Y0(r,typeof e!="symbol"?e+"":e,t);const R0={};class eu extends $c{constructor(e){super(e),ta(this,"_type","MultiLineString"),ta(this,"_lineObjects",[]),ta(this,"_linesContainer"),this._linesContainer=new p.Group}async _toThreeJSGeometry(){const{_position:e}=this._coordsTransform(),t=this.getMap();if(this.clearLines(),this._disposeGeometry(),this._style){for(const n of e){const i=n.flatMap(a=>[a.x,a.y,a.z]),o=await this._createLineObject(this._style,i);o.position.add(t?.prjcenter),o.updateMatrixWorld(!0),o.renderOrder=99,this._lineObjects.push(o),this._linesContainer.add(o)}this._linesContainer.renderOrder=99,this._threeGeometry=this._linesContainer,this.add(this._threeGeometry),this._updateContainer(),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0),this._tryProcessQueue()}}async _createLineObject(e,t){switch(e.config.type){case"basic-line":return Ho(e.config,t);case"flow-tube-line":return Fc(e.config,t);case"arrow-line":return Oc(e.config,t);case"flow-texture-line":return await Dc(e.config,t);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_coordsTransform(){const e=this.getMap(),t=this._geometry;if(this._geometry.type==="MultiLineString"){const n=e?.prjcenter;return{_position:t.coordinates.map(o=>o.map(a=>{const c=new p.Vector3(a[0],a[1],a[2]||0);return(e?e.geo2world(c):c).sub(n)}))}}}_updateContainer(){this._linesContainer.updateMatrixWorld(!0)}clearLines(){this._lineObjects.forEach(e=>{this._linesContainer.remove(e),e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material.dispose())}),this._lineObjects=[]}_updateGeometry(){this._toThreeJSGeometry()}_disposeObject(){}}eu.mergeOptions(R0);var j0=Object.defineProperty,J0=(r,e,t)=>e in r?j0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cr=(r,e,t)=>J0(r,typeof e!="symbol"?e+"":e,t);const na=64;class Q0 extends ct.MeshStandardMaterial{constructor(e={}){const{shaderOption:t,regionOverlay:n,...i}=e;if(super({color:"rgb(58,126,182)",roughness:.7,metalness:.1,transparent:!0,opacity:.9,envMapIntensity:.8,depthWrite:!0,depthTest:!0,...i}),Cr(this,"shaderOption"),Cr(this,"clock"),Cr(this,"time"),Cr(this,"startTime"),Cr(this,"regionOverlay"),n&&n.vertices&&n.vertices.length>0){const o=n.vertices.slice(0,na).map(c=>c.clone()),a=o.length;for(;o.length<na;)o.push(new ct.Vector2(0,0));this.regionOverlay={color:n.color,opacity:n.opacity,vertices:o,vertexCount:a}}this.shaderOption={minY:0,maxY:100,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!1,color:new ct.Color("#9ECDEC"),width:20,speed:1,maxDistance:100,center:void 0},flow:{enabled:!1,color:new ct.Color("#00E4FF"),range:10,speed:20},sweep:{enabled:!1,color:new ct.Color("#FFFFFF"),width:1.5,speed:10}},...t},this.clock=new ct.Clock,this.time={value:0},this.startTime={value:0},this.animate()}onBeforeCompile(e){const{minY:t,maxY:n,minRate:i,maxRate:o,effects:a}=this.shaderOption,c=n-t,u=!!this.regionOverlay;e.uniforms={...e.uniforms,time:this.time,uStartTime:this.startTime,uMinY:{value:t},uMaxY:{value:n},uHeightRange:{value:c},uMinRate:{value:i},uMaxRate:{value:o},uDiffusionEnabled:{value:a?.diffusion?.enabled?1:0},uDiffusionColor:{value:a?.diffusion?.color||new ct.Color("#9ECDEC")},uDiffusionWidth:{value:a?.diffusion?.width||20},uDiffusionSpeed:{value:a?.diffusion?.speed||1},uDiffusionMaxDistance:{value:a?.diffusion?.maxDistance||100},uDiffusionCenter:{value:a?.diffusion?.center||new ct.Vector3(0,0,0)},uFlowEnabled:{value:a?.flow?.enabled?1:0},uFlowColor:{value:a?.flow?.color||new ct.Color("#00E4FF")},uFlowRange:{value:a?.flow?.range||10},uFlowSpeed:{value:a?.flow?.speed||20},uSweepEnabled:{value:a?.sweep?.enabled?1:0},uSweepColor:{value:a?.sweep?.color||new ct.Color("#FFFFFF")},uSweepWidth:{value:a?.sweep?.width||1.5},uSweepSpeed:{value:a?.sweep?.speed||10},uRegionOverlayEnabled:{value:u?1:0},uRegionOverlayColor:{value:this.regionOverlay?.color||new ct.Color("#00FF88")},uRegionOverlayOpacity:{value:this.regionOverlay?.opacity??0},uRegionOverlayVertexCount:{value:this.regionOverlay?.vertexCount??0},uRegionOverlayVertices:{value:this.regionOverlay?.vertices||new Array(na).fill(0).map(()=>new ct.Vector2(0,0))}},e.vertexShader=`
|
|
994
|
+
}`;var me=of(function(){return Le(P,te+"return "+J).apply(t,T)});if(me.source=J,Sl(me))throw me;return me}function R2(s){return Pe(s).toLowerCase()}function j2(s){return Pe(s).toUpperCase()}function J2(s,l,u){if(s=Pe(s),s&&(u||l===t))return pu(s);if(!s||!(l=Dt(l)))return s;var y=li(s),_=li(l),P=mu(y,_),T=gu(y,_)+1;return hn(y,P,T).join("")}function Q2(s,l,u){if(s=Pe(s),s&&(u||l===t))return s.slice(0,vu(s)+1);if(!s||!(l=Dt(l)))return s;var y=li(s),_=gu(y,li(l))+1;return hn(y,0,_).join("")}function H2(s,l,u){if(s=Pe(s),s&&(u||l===t))return s.replace(Sa,"");if(!s||!(l=Dt(l)))return s;var y=li(s),_=mu(y,li(l));return hn(y,_).join("")}function E2(s,l){var u=V,y=G;if(Oe(l)){var _="separator"in l?l.separator:_;u="length"in l?pe(l.length):u,y="omission"in l?Dt(l.omission):y}s=Pe(s);var P=s.length;if($n(s)){var T=li(s);P=T.length}if(u>=P)return s;var Z=u-qn(y);if(Z<1)return y;var F=T?hn(T,0,Z).join(""):s.slice(0,Z);if(_===t)return F+y;if(T&&(Z+=F.length-Z),Ll(_)){if(s.slice(Z).search(_)){var B,R=F;for(_.global||(_=ka(_.source,Pe(Oh.exec(_))+"g")),_.lastIndex=0;B=_.exec(R);)var J=B.index;F=F.slice(0,J===t?Z:J)}}else if(s.indexOf(Dt(_),Z)!=Z){var $=F.lastIndexOf(_);$>-1&&(F=F.slice(0,$))}return F+y}function $2(s){return s=Pe(s),s&&Fh.test(s)?s.replace(Yt,Cb):s}var q2=or(function(s,l,u){return s+(u?" ":"")+l.toUpperCase()}),Tl=od("toUpperCase");function sf(s,l,u){return s=Pe(s),l=u?t:l,l===t?xb(s)?Wb(s):fb(s):s.match(l)||[]}var of=ye(function(s,l){try{return Ft(s,t,l)}catch(u){return Sl(u)?u:new he(u)}}),eL=Vi(function(s,l){return jt(l,function(u){u=Mi(u),Wi(s,u,xl(s[u],s))}),s});function tL(s){var l=s==null?0:s.length,u=se();return s=l?Fe(s,function(y){if(typeof y[1]!="function")throw new Jt(a);return[u(y[0]),y[1]]}):[],ye(function(y){for(var _=-1;++_<l;){var P=s[_];if(Ft(P[0],this,y))return Ft(P[1],this,y)}})}function iL(s){return C1(Ht(s,f))}function Gl(s){return function(){return s}}function nL(s,l){return s==null||s!==s?l:s}var rL=ld(),sL=ld(!0);function Wt(s){return s}function Wl(s){return zu(typeof s=="function"?s:Ht(s,f))}function oL(s){return Uu(Ht(s,f))}function aL(s,l){return ku(s,Ht(l,f))}var lL=ye(function(s,l){return function(u){return Yr(u,s,l)}}),cL=ye(function(s,l){return function(u){return Yr(s,u,l)}});function Zl(s,l,u){var y=Ee(l),_=qs(l,y);u==null&&!(Oe(l)&&(_.length||!y.length))&&(u=l,l=s,s=this,_=qs(l,Ee(l)));var P=!(Oe(u)&&"chain"in u)||!!u.chain,T=Ai(s);return jt(_,function(Z){var F=l[Z];s[Z]=F,T&&(s.prototype[Z]=function(){var B=this.__chain__;if(P||B){var R=s(this.__wrapped__),J=R.__actions__=Ct(this.__actions__);return J.push({func:F,args:arguments,thisArg:s}),R.__chain__=B,R}return F.apply(s,rn([this.value()],arguments))})}),s}function hL(){return lt._===this&&(lt._=Ob),this}function Vl(){}function uL(s){return s=pe(s),ye(function(l){return Ku(l,s)})}var dL=cl(Fe),fL=cl(cu),pL=cl(Aa);function af(s){return gl(s)?Fa(Mi(s)):B1(s)}function mL(s){return function(l){return s==null?t:In(s,l)}}var gL=hd(),yL=hd(!0);function Il(){return[]}function Al(){return!1}function vL(){return{}}function _L(){return""}function wL(){return!0}function bL(s,l){if(s=pe(s),s<1||s>ne)return[];var u=ge,y=mt(s,ge);l=se(l),s-=ge;for(var _=za(y,l);++u<s;)l(u);return _}function xL(s){return ue(s)?Fe(s,Mi):zt(s)?[s]:Ct(Pd(Pe(s)))}function ML(s){var l=++Ab;return Pe(s)+l}var SL=so(function(s,l){return s+l},0),LL=hl("ceil"),PL=so(function(s,l){return s/l},1),CL=hl("floor");function TL(s){return s&&s.length?$s(s,Wt,Qa):t}function GL(s,l){return s&&s.length?$s(s,se(l,2),Qa):t}function WL(s){return du(s,Wt)}function ZL(s,l){return du(s,se(l,2))}function VL(s){return s&&s.length?$s(s,Wt,qa):t}function IL(s,l){return s&&s.length?$s(s,se(l,2),qa):t}var AL=so(function(s,l){return s*l},1),FL=hl("round"),OL=so(function(s,l){return s-l},0);function DL(s){return s&&s.length?Da(s,Wt):0}function zL(s,l){return s&&s.length?Da(s,se(l,2)):0}return S.after=oS,S.ary=Dd,S.assign=jS,S.assignIn=Ed,S.assignInWith=_o,S.assignWith=JS,S.at=QS,S.before=zd,S.bind=xl,S.bindAll=eL,S.bindKey=Xd,S.castArray=vS,S.chain=Ad,S.chunk=Cx,S.compact=Tx,S.concat=Gx,S.cond=tL,S.conforms=iL,S.constant=Gl,S.countBy=DM,S.create=HS,S.curry=Ud,S.curryRight=kd,S.debounce=Kd,S.defaults=ES,S.defaultsDeep=$S,S.defer=aS,S.delay=lS,S.difference=Wx,S.differenceBy=Zx,S.differenceWith=Vx,S.drop=Ix,S.dropRight=Ax,S.dropRightWhile=Fx,S.dropWhile=Ox,S.fill=Dx,S.filter=XM,S.flatMap=KM,S.flatMapDeep=NM,S.flatMapDepth=BM,S.flatten=Wd,S.flattenDeep=zx,S.flattenDepth=Xx,S.flip=cS,S.flow=rL,S.flowRight=sL,S.fromPairs=Ux,S.functions=s2,S.functionsIn=o2,S.groupBy=YM,S.initial=Kx,S.intersection=Nx,S.intersectionBy=Bx,S.intersectionWith=Yx,S.invert=l2,S.invertBy=c2,S.invokeMap=jM,S.iteratee=Wl,S.keyBy=JM,S.keys=Ee,S.keysIn=Gt,S.map=fo,S.mapKeys=u2,S.mapValues=d2,S.matches=oL,S.matchesProperty=aL,S.memoize=mo,S.merge=f2,S.mergeWith=$d,S.method=lL,S.methodOf=cL,S.mixin=Zl,S.negate=go,S.nthArg=uL,S.omit=p2,S.omitBy=m2,S.once=hS,S.orderBy=QM,S.over=dL,S.overArgs=uS,S.overEvery=fL,S.overSome=pL,S.partial=Ml,S.partialRight=Nd,S.partition=HM,S.pick=g2,S.pickBy=qd,S.property=af,S.propertyOf=mL,S.pull=Qx,S.pullAll=Vd,S.pullAllBy=Hx,S.pullAllWith=Ex,S.pullAt=$x,S.range=gL,S.rangeRight=yL,S.rearg=dS,S.reject=qM,S.remove=qx,S.rest=fS,S.reverse=wl,S.sampleSize=tS,S.set=v2,S.setWith=_2,S.shuffle=iS,S.slice=eM,S.sortBy=sS,S.sortedUniq=aM,S.sortedUniqBy=lM,S.split=K2,S.spread=pS,S.tail=cM,S.take=hM,S.takeRight=uM,S.takeRightWhile=dM,S.takeWhile=fM,S.tap=TM,S.throttle=mS,S.thru=uo,S.toArray=Jd,S.toPairs=ef,S.toPairsIn=tf,S.toPath=xL,S.toPlainObject=Hd,S.transform=w2,S.unary=gS,S.union=pM,S.unionBy=mM,S.unionWith=gM,S.uniq=yM,S.uniqBy=vM,S.uniqWith=_M,S.unset=b2,S.unzip=bl,S.unzipWith=Id,S.update=x2,S.updateWith=M2,S.values=cr,S.valuesIn=S2,S.without=wM,S.words=sf,S.wrap=yS,S.xor=bM,S.xorBy=xM,S.xorWith=MM,S.zip=SM,S.zipObject=LM,S.zipObjectDeep=PM,S.zipWith=CM,S.entries=ef,S.entriesIn=tf,S.extend=Ed,S.extendWith=_o,Zl(S,S),S.add=SL,S.attempt=of,S.camelCase=T2,S.capitalize=nf,S.ceil=LL,S.clamp=L2,S.clone=_S,S.cloneDeep=bS,S.cloneDeepWith=xS,S.cloneWith=wS,S.conformsTo=MS,S.deburr=rf,S.defaultTo=nL,S.divide=PL,S.endsWith=G2,S.eq=hi,S.escape=W2,S.escapeRegExp=Z2,S.every=zM,S.find=UM,S.findIndex=Td,S.findKey=qS,S.findLast=kM,S.findLastIndex=Gd,S.findLastKey=e2,S.floor=CL,S.forEach=Fd,S.forEachRight=Od,S.forIn=t2,S.forInRight=i2,S.forOwn=n2,S.forOwnRight=r2,S.get=Pl,S.gt=SS,S.gte=LS,S.has=a2,S.hasIn=Cl,S.head=Zd,S.identity=Wt,S.includes=RM,S.indexOf=kx,S.inRange=P2,S.invoke=h2,S.isArguments=On,S.isArray=ue,S.isArrayBuffer=PS,S.isArrayLike=Tt,S.isArrayLikeObject=Ke,S.isBoolean=CS,S.isBuffer=un,S.isDate=TS,S.isElement=GS,S.isEmpty=WS,S.isEqual=ZS,S.isEqualWith=VS,S.isError=Sl,S.isFinite=IS,S.isFunction=Ai,S.isInteger=Bd,S.isLength=yo,S.isMap=Yd,S.isMatch=AS,S.isMatchWith=FS,S.isNaN=OS,S.isNative=DS,S.isNil=XS,S.isNull=zS,S.isNumber=Rd,S.isObject=Oe,S.isObjectLike=Ue,S.isPlainObject=Er,S.isRegExp=Ll,S.isSafeInteger=US,S.isSet=jd,S.isString=vo,S.isSymbol=zt,S.isTypedArray=lr,S.isUndefined=kS,S.isWeakMap=KS,S.isWeakSet=NS,S.join=Rx,S.kebabCase=V2,S.last=$t,S.lastIndexOf=jx,S.lowerCase=I2,S.lowerFirst=A2,S.lt=BS,S.lte=YS,S.max=TL,S.maxBy=GL,S.mean=WL,S.meanBy=ZL,S.min=VL,S.minBy=IL,S.stubArray=Il,S.stubFalse=Al,S.stubObject=vL,S.stubString=_L,S.stubTrue=wL,S.multiply=AL,S.nth=Jx,S.noConflict=hL,S.noop=Vl,S.now=po,S.pad=F2,S.padEnd=O2,S.padStart=D2,S.parseInt=z2,S.random=C2,S.reduce=EM,S.reduceRight=$M,S.repeat=X2,S.replace=U2,S.result=y2,S.round=FL,S.runInContext=A,S.sample=eS,S.size=nS,S.snakeCase=k2,S.some=rS,S.sortedIndex=tM,S.sortedIndexBy=iM,S.sortedIndexOf=nM,S.sortedLastIndex=rM,S.sortedLastIndexBy=sM,S.sortedLastIndexOf=oM,S.startCase=N2,S.startsWith=B2,S.subtract=OL,S.sum=DL,S.sumBy=zL,S.template=Y2,S.times=bL,S.toFinite=Fi,S.toInteger=pe,S.toLength=Qd,S.toLower=R2,S.toNumber=qt,S.toSafeInteger=RS,S.toString=Pe,S.toUpper=j2,S.trim=J2,S.trimEnd=Q2,S.trimStart=H2,S.truncate=E2,S.unescape=$2,S.uniqueId=ML,S.upperCase=q2,S.upperFirst=Tl,S.each=Fd,S.eachRight=Od,S.first=Zd,Zl(S,function(){var s={};return bi(S,function(l,u){Te.call(S.prototype,u)||(s[u]=l)}),s}(),{chain:!1}),S.VERSION=i,jt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){S[s].placeholder=S}),jt(["drop","take"],function(s,l){be.prototype[s]=function(u){u=u===t?1:Qe(pe(u),0);var y=this.__filtered__&&!l?new be(this):this.clone();return y.__filtered__?y.__takeCount__=mt(u,y.__takeCount__):y.__views__.push({size:mt(u,ge),type:s+(y.__dir__<0?"Right":"")}),y},be.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),jt(["filter","map","takeWhile"],function(s,l){var u=l+1,y=u==Y||u==Q;be.prototype[s]=function(_){var P=this.clone();return P.__iteratees__.push({iteratee:se(_,3),type:u}),P.__filtered__=P.__filtered__||y,P}}),jt(["head","last"],function(s,l){var u="take"+(l?"Right":"");be.prototype[s]=function(){return this[u](1).value()[0]}}),jt(["initial","tail"],function(s,l){var u="drop"+(l?"":"Right");be.prototype[s]=function(){return this.__filtered__?new be(this):this[u](1)}}),be.prototype.compact=function(){return this.filter(Wt)},be.prototype.find=function(s){return this.filter(s).head()},be.prototype.findLast=function(s){return this.reverse().find(s)},be.prototype.invokeMap=ye(function(s,l){return typeof s=="function"?new be(this):this.map(function(u){return Yr(u,s,l)})}),be.prototype.reject=function(s){return this.filter(go(se(s)))},be.prototype.slice=function(s,l){s=pe(s);var u=this;return u.__filtered__&&(s>0||l<0)?new be(u):(s<0?u=u.takeRight(-s):s&&(u=u.drop(s)),l!==t&&(l=pe(l),u=l<0?u.dropRight(-l):u.take(l-s)),u)},be.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},be.prototype.toArray=function(){return this.take(ge)},bi(be.prototype,function(s,l){var u=/^(?:filter|find|map|reject)|While$/.test(l),y=/^(?:head|last)$/.test(l),_=S[y?"take"+(l=="last"?"Right":""):l],P=y||/^find/.test(l);_&&(S.prototype[l]=function(){var T=this.__wrapped__,Z=y?[1]:arguments,F=T instanceof be,B=Z[0],R=F||ue(T),J=function(we){var xe=_.apply(S,rn([we],Z));return y&&$?xe[0]:xe};R&&u&&typeof B=="function"&&B.length!=1&&(F=R=!1);var $=this.__chain__,te=!!this.__actions__.length,oe=P&&!$,me=F&&!te;if(!P&&R){T=me?T:new be(this);var ae=s.apply(T,Z);return ae.__actions__.push({func:uo,args:[J],thisArg:t}),new Qt(ae,$)}return oe&&me?s.apply(this,Z):(ae=this.thru(J),oe?y?ae.value()[0]:ae.value():ae)})}),jt(["pop","push","shift","sort","splice","unshift"],function(s){var l=Ds[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",y=/^(?:pop|shift)$/.test(s);S.prototype[s]=function(){var _=arguments;if(y&&!this.__chain__){var P=this.value();return l.apply(ue(P)?P:[],_)}return this[u](function(T){return l.apply(ue(T)?T:[],_)})}}),bi(be.prototype,function(s,l){var u=S[l];if(u){var y=u.name+"";Te.call(nr,y)||(nr[y]=[]),nr[y].push({name:l,func:u})}}),nr[ro(t,L).name]=[{name:"wrapper",func:t}],be.prototype.clone=$b,be.prototype.reverse=qb,be.prototype.value=e1,S.prototype.at=GM,S.prototype.chain=WM,S.prototype.commit=ZM,S.prototype.next=VM,S.prototype.plant=AM,S.prototype.reverse=FM,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=OM,S.prototype.first=S.prototype.head,zr&&(S.prototype[zr]=IM),S},er=Zb();Tn?((Tn.exports=er)._=er,Wa._=er):lt._=er}).call(Pr)}(vs,vs.exports);var P0=vs.exports,C0=Object.defineProperty,T0=(r,e,t)=>e in r?C0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,G0=(r,e,t)=>T0(r,e+"",t);let ti=class extends ut{constructor(e){super(e),G0(this,"_baseType","Point"),this._threeGeometry=this._createThreeGeometry(),this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=new p.Vector3(this._geometry.coordinates[0],this._geometry.coordinates[1],this._geometry.coordinates[2]||0);return e?e.geo2world(t):t}_toThreeJSGeometry(){}_updateGeometryPositions(){const e=this._coordsTransform();if(this._position=e,this._threeGeometry){const t=this.getMap();t?.prjcenter?this._threeGeometry.position.copy(e).sub(t.prjcenter):this._threeGeometry.position.copy(e),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0)}else this._toThreeJSGeometry()}_createThreeGeometry(){return new p.Points(new p.BufferGeometry,new p.PointsMaterial({size:1,color:8947848}))}};var W0=Object.defineProperty,Z0=(r,e,t)=>e in r?W0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V0=(r,e,t)=>Z0(r,e+"",t);const I0={};class Pi extends ti{constructor(e){super(e),V0(this,"_type","Marker")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){this._position=this._coordsTransform(),this._threeGeometry?(this._threeGeometry.position.copy(this._position),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)):this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-point":return Fc(e.config,new p.Vector3(0,0,0));case"icon-point":return dg(e.config,this._position);case"icon-label-point":return bg(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_calculateCollisionBoundingBox(e,t){if(!this.visible||!this._threeGeometry||!e||!t)return null;try{switch(this._style?.config.type){case"icon-point":return this._calculateSpriteBoundingBox(this._threeGeometry);default:return this._getFallbackBoundingBox()}}catch(i){return console.warn(`Marker ${this._id} bounding box calculation failed:`,i),console.warn(`Marker ${this._id} 包围盒计算失败:`,i),this._getFallbackBoundingBox()}}_calculateSpriteBoundingBox(e){try{const i=Math.max(Math.abs(e.scale.x),Math.abs(e.scale.y))/.002;return{width:i,height:i,offsetX:-i/2,offsetY:-i/2}}catch{return{width:20,height:20,offsetX:-10,offsetY:-10}}}_getFallbackBoundingBox(){switch(this.getStyle()?.config.type){case"icon-point":case"icon-label-point":return{width:20,height:20,offsetX:-10,offsetY:-10};case"basic-point":return{width:10,height:10,offsetX:-5,offsetY:-5};default:return{width:15,height:15,offsetX:-7.5,offsetY:-7.5}}}}Pi.mergeOptions(I0);var A0=Object.defineProperty,F0=(r,e,t)=>e in r?A0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$c=(r,e,t)=>F0(r,typeof e!="symbol"?e+"":e,t);class qc extends ut{constructor(e){super(e),$c(this,"_baseType","Line"),$c(this,"_vertexPoints"),this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=this._geometry,i=e?.prjcenter;if(this._geometry.type==="LineString"){let o=t.coordinates.map(c=>{const h=new p.Vector3(c[0],c[1],c[2]||0);return(e?e.geo2world(h):h).sub(i)}),a=o.flatMap(c=>[c.x,c.y,c.z]);return{_position:o,_vertexPoints:a}}}_toThreeJSGeometry(){}_createThreeGeometry(){const e=new rs,t=new gr({color:8947848,linewidth:.1,dashed:!1,resolution:new p.Vector2(window.innerWidth,window.innerHeight)});return new yr(e,t)}}var O0=Object.defineProperty,D0=(r,e,t)=>e in r?O0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,z0=(r,e,t)=>D0(r,e+"",t);const X0={};class St extends qc{constructor(e){super(e),z0(this,"_type","LineString")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){let{_vertexPoints:e}=this._coordsTransform();if(this._vertexPoints=e,this._threeGeometry&&(this._threeGeometry.isLine2||this._threeGeometry instanceof yr)){const n=this._threeGeometry.geometry;n.setPositions(this._vertexPoints),n.computeBoundingSphere(),n.computeBoundingBox();const o=this.getMap();o?.prjcenter&&this._threeGeometry.position.set(o.prjcenter.x,o.prjcenter.y,o.prjcenter.z),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)}else console.warn("[LineString] _updateGeometryPositions: Geometry type mismatch, fallback to full rebuild",{hasGeometry:!!this._threeGeometry,geometryType:this._threeGeometry?.constructor?.name,isLine2:this._threeGeometry?.isLine2}),this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-line":return Ho(e.config,this._vertexPoints);case"flow-tube-line":return Oc(e.config,this._vertexPoints);case"arrow-line":return Dc(e.config,this._vertexPoints);case"flow-texture-line":return await zc(e.config,this._vertexPoints);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_updateGeometry(){const e=this.getMap();if(this._threeGeometry){if(this._threeGeometry instanceof yr){const i=this._threeGeometry.geometry;i.setPositions(this._vertexPoints),i.computeBoundingSphere(),i.computeBoundingBox()}this._threeGeometry.position.add(e?.prjcenter),this._threeGeometry.renderOrder=99,this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue()}}}St.mergeOptions(X0);var U0=Object.defineProperty,k0=(r,e,t)=>e in r?U0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eh=(r,e,t)=>k0(r,typeof e!="symbol"?e+"":e,t);class K0 extends ut{constructor(e){super(e),eh(this,"_baseType","Surface"),eh(this,"_vertexPoints"),this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=e?.prjcenter,i=this._geometry;if(!i)throw new Error("Geometry data undefined");if(i.type==="Polygon"){const n=i.coordinates;let o=[],a=[];return n.forEach(c=>{const h=c.map(d=>{const m=new p.Vector3(d[0],d[1],d[2]||0);return(e?e.geo2world(m):m).sub(t)});o.push(h),a.push(...h.flatMap(d=>[d.x,d.y,d.z]))}),{_positions:o,_vertexPoints:a}}else if(i.type==="MultiPolygon"){const n=i.coordinates;let o=[],a=[];return n.forEach(c=>{const h=[];c.forEach(d=>{const m=d.map(f=>{const g=new p.Vector3(f[0],f[1],f[2]||0);return(e?e.geo2world(g):g).sub(t)});h.push(m),a.push(...m.flatMap(f=>[f.x,f.y,f.z]))}),o.push(h)}),{_positions:o,_vertexPoints:a}}else throw new Error(`Unsupported geometry type: ${i.type}`)}_updateGeometry(){const e=this._style?.config.type;if(this.clear(),!this._threeGeometry||!this._vertexPoints?.length){console.warn("Cannot update geometry: missing geometry or vertex data");return}const t=this.getMap();try{e==="basic-polygon"?(this._threeGeometry.renderOrder=90,this._threeGeometry.position.add(t?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry)):(e==="extrude-polygon"||e?.includes("water"))&&(this._threeGeometry.renderOrder=90,this._threeGeometry.position.add(t?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry))}catch(i){throw console.error("Failed to update polygon position:",i),i}}_createThreeGeometry(){const e=new rs,t=new gr({color:8947848,linewidth:.1,dashed:!1,resolution:new p.Vector2(window.innerWidth,window.innerHeight)});return new yr(e,t)}}var N0=Object.defineProperty,B0=(r,e,t)=>e in r?N0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Y0=(r,e,t)=>B0(r,e+"",t);const R0={};class vi extends K0{constructor(e){super(e),Y0(this,"_type","Polygon")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this.remove(this._threeGeometry),this._threeGeometry=await this._createObject(this._style),this._updateGeometry(),await this._style.applyTo(this._threeGeometry))}_updateGeometryPositions(){const e=this._style?.config.type;console.warn("[Polygon] _updateGeometryPositions: Fallback to full rebuild",{styleType:e,hasGeometry:!!this._threeGeometry}),this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-polygon":return pg(e.config,this._vertexPoints);case"extrude-polygon":return mg(e.config,this._vertexPoints);case"water":return gg(e.config,this.getMap(),this._vertexPoints);case"base-water":return yg(e.config,this._vertexPoints);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_calculateCollisionBoundingBox(){return null}}vi.mergeOptions(R0);var j0=Object.defineProperty,J0=(r,e,t)=>e in r?j0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ta=(r,e,t)=>J0(r,typeof e!="symbol"?e+"":e,t);const Q0={};class th extends qc{constructor(e){super(e),ta(this,"_type","MultiLineString"),ta(this,"_lineObjects",[]),ta(this,"_linesContainer"),this._linesContainer=new p.Group}async _toThreeJSGeometry(){const{_position:e}=this._coordsTransform(),t=this.getMap();if(this.clearLines(),this._disposeGeometry(),this._style){for(const i of e){const n=i.flatMap(a=>[a.x,a.y,a.z]),o=await this._createLineObject(this._style,n);o.position.add(t?.prjcenter),o.updateMatrixWorld(!0),o.renderOrder=99,this._lineObjects.push(o),this._linesContainer.add(o)}this._linesContainer.renderOrder=99,this._threeGeometry=this._linesContainer,this.add(this._threeGeometry),this._updateContainer(),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0),this._tryProcessQueue()}}async _createLineObject(e,t){switch(e.config.type){case"basic-line":return Ho(e.config,t);case"flow-tube-line":return Oc(e.config,t);case"arrow-line":return Dc(e.config,t);case"flow-texture-line":return await zc(e.config,t);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_coordsTransform(){const e=this.getMap(),t=this._geometry;if(this._geometry.type==="MultiLineString"){const i=e?.prjcenter;return{_position:t.coordinates.map(o=>o.map(a=>{const c=new p.Vector3(a[0],a[1],a[2]||0);return(e?e.geo2world(c):c).sub(i)}))}}}_updateContainer(){this._linesContainer.updateMatrixWorld(!0)}clearLines(){this._lineObjects.forEach(e=>{this._linesContainer.remove(e),e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material.dispose())}),this._lineObjects=[]}_updateGeometry(){this._toThreeJSGeometry()}_disposeObject(){}}th.mergeOptions(Q0);var H0=Object.defineProperty,E0=(r,e,t)=>e in r?H0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cr=(r,e,t)=>E0(r,typeof e!="symbol"?e+"":e,t);const ia=64;class $0 extends ht.MeshStandardMaterial{constructor(e={}){const{shaderOption:t,regionOverlay:i,...n}=e;if(super({color:"rgb(58,126,182)",roughness:.7,metalness:.1,transparent:!0,opacity:.9,envMapIntensity:.8,depthWrite:!0,depthTest:!0,...n}),Cr(this,"shaderOption"),Cr(this,"clock"),Cr(this,"time"),Cr(this,"startTime"),Cr(this,"regionOverlay"),i&&i.vertices&&i.vertices.length>0){const o=i.vertices.slice(0,ia).map(c=>c.clone()),a=o.length;for(;o.length<ia;)o.push(new ht.Vector2(0,0));this.regionOverlay={color:i.color,opacity:i.opacity,vertices:o,vertexCount:a}}this.shaderOption={minY:0,maxY:100,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!1,color:new ht.Color("#9ECDEC"),width:20,speed:1,maxDistance:100,center:void 0},flow:{enabled:!1,color:new ht.Color("#00E4FF"),range:10,speed:20},sweep:{enabled:!1,color:new ht.Color("#FFFFFF"),width:1.5,speed:10}},...t},this.clock=new ht.Clock,this.time={value:0},this.startTime={value:0},this.animate()}onBeforeCompile(e){const{minY:t,maxY:i,minRate:n,maxRate:o,effects:a}=this.shaderOption,c=i-t,h=!!this.regionOverlay;e.uniforms={...e.uniforms,time:this.time,uStartTime:this.startTime,uMinY:{value:t},uMaxY:{value:i},uHeightRange:{value:c},uMinRate:{value:n},uMaxRate:{value:o},uDiffusionEnabled:{value:a?.diffusion?.enabled?1:0},uDiffusionColor:{value:a?.diffusion?.color||new ht.Color("#9ECDEC")},uDiffusionWidth:{value:a?.diffusion?.width||20},uDiffusionSpeed:{value:a?.diffusion?.speed||1},uDiffusionMaxDistance:{value:a?.diffusion?.maxDistance||100},uDiffusionCenter:{value:a?.diffusion?.center||new ht.Vector3(0,0,0)},uFlowEnabled:{value:a?.flow?.enabled?1:0},uFlowColor:{value:a?.flow?.color||new ht.Color("#00E4FF")},uFlowRange:{value:a?.flow?.range||10},uFlowSpeed:{value:a?.flow?.speed||20},uSweepEnabled:{value:a?.sweep?.enabled?1:0},uSweepColor:{value:a?.sweep?.color||new ht.Color("#FFFFFF")},uSweepWidth:{value:a?.sweep?.width||1.5},uSweepSpeed:{value:a?.sweep?.speed||10},uRegionOverlayEnabled:{value:h?1:0},uRegionOverlayColor:{value:this.regionOverlay?.color||new ht.Color("#00FF88")},uRegionOverlayOpacity:{value:this.regionOverlay?.opacity??0},uRegionOverlayVertexCount:{value:this.regionOverlay?.vertexCount??0},uRegionOverlayVertices:{value:this.regionOverlay?.vertices||new Array(ia).fill(0).map(()=>new ht.Vector2(0,0))}},e.vertexShader=`
|
|
974
995
|
varying vec3 vWorldPosition;
|
|
975
996
|
varying vec3 vPosition;
|
|
976
997
|
varying float vHeight;
|
|
@@ -1098,9 +1119,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1098
1119
|
);
|
|
1099
1120
|
}
|
|
1100
1121
|
}
|
|
1101
|
-
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new ct.Box3().setFromObject(e);if(t.isEmpty())return;const n=new ct.Vector3;t.getCenter(n);const i=[new ct.Vector3(t.min.x,t.min.y,t.min.z),new ct.Vector3(t.max.x,t.max.y,t.max.z)];let o=0;i.forEach(a=>{const c=n.distanceTo(a);c>o&&(o=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:n,maxDistance:o},this.needsUpdate=!0}updateBoundingBox(e,t){this.shaderOption.minY=e,this.shaderOption.maxY=t,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)}}var H0=Object.defineProperty,E0=(r,e,t)=>e in r?H0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tn=(r,e,t)=>E0(r,typeof e!="symbol"?e+"":e,t);const $0={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class tu extends en{constructor(e){super(e),tn(this,"_type","Model"),tn(this,"_emissive",!1),tn(this,"_emissiveIntensity",1),tn(this,"_emissiveColor","#ffffff"),tn(this,"_mixer",null),tn(this,"_currentAction",null),tn(this,"_animations",[]),tn(this,"_clock",new p.Clock),tn(this,"_autoUpdate",!0),tn(this,"_animationRequestId",null),tn(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(){if(this._position=this._coordsTransform(),this._style){if(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,!this._threeGeometry){console.error("Model load failed: model returned by _createObject is undefined"),console.error("模型加载失败:_createObject返回的model为undefined");return}this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new p.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(),this.trigger("loaded",{timestamp:_c(),targrt:this})}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return ug(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const t=e.material;t&&(t.emissiveIntensity=this._emissive?this._emissiveIntensity:0,t.emissive&&t.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,t,n){this._emissive=e,t!==void 0&&(this._emissiveIntensity=t),n!==void 0&&(this._emissiveColor=n),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(t=>{t.isMesh&&t.material&&(t.castShadow=e.cast,t.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("No available animations for model"),console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const t=typeof e.name=="number"?this._animations[e.name]:this._animations.find(n=>n.name===e.name);if(!t){console.warn(`Animation not found: ${e.name}`),console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(t),this._currentAction.setLoop(e.loop?p.LoopRepeat:p.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 t;return typeof e.name=="number"?t=this._animations[e.name]:t=this._animations.find(n=>n.name===e.name),t?t.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 t=this._clock.getDelta();this._mixer.update(t)}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 t=e.feature;if(t&&Array.isArray(t._vertexPoints)&&t._vertexPoints.length>=6){const u=t.getMap?.()||this.getMap();if(u&&u.prjcenter){const d=u.prjcenter,m=t._vertexPoints,f=[];for(let g=0;g+2<m.length;g+=3){const v=m[g],w=m[g+2],b=d.x+v,x=d.z+w;f.push(new p.Vector2(b,x))}if(f.length>=3)return f}}const n=this.getMap();if(!n||!e.geometry)return null;const i=e.geometry;let o;if(i.type==="Polygon")o=i.coordinates;else if(i.type==="MultiPolygon"){if(!i.coordinates.length)return null;o=i.coordinates[0]}else return null;if(!o.length||!o[0].length)return null;const a=o[0],c=[];for(const u of a){const d=u[0],m=u[1],f=n.geo2world(new p.Vector3(d,m,0));c.push(new p.Vector2(f.x,f.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let t=null;if(e&&e.getRegionOverlays){const n=e.getRegionOverlays()||[];if(n.length){const i=n.filter(a=>(a.mode??"overlay")==="overlay").sort((a,c)=>(a.zIndex??0)-(c.zIndex??0)),o=i[i.length-1];if(o&&(o.geometry||o.feature)){const a=this._computeOverlayVertices(o);a&&a.length>=3&&(t={color:new p.Color(o.color??"#00FF88"),opacity:o.opacity??.3,vertices:a})}}}this.traverse(async n=>{if(n instanceof p.Mesh&&n.material){if(n.castShadow=!0,n.name==="building"){const i=new Q0({color:new p.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new p.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new p.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new p.Color("#ffffff"),width:3,speed:5}}},regionOverlay:t||void 0}),o=new p.Box3().setFromObject(n);i.updateBoundingBox(o.min.y,o.max.y),i.setDiffusionFromObject(n),n.receiveShadow=!1,n.material=i,n.material.needsUpdate=!0}n.name==="grass"&&(n.castShadow=!1,n.receiveShadow=!0,n.material.color=new p.Color("#81e4d8ff)").multiplyScalar(.7),n.material.metalness=.2,n.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(i=>{const o=n.material[i];o&&(o.wrapS=o.wrapT=p.RepeatWrapping,o.repeat.set(.3,.3),o.needsUpdate=!0)}),n.material.normalScale=new p.Vector2(3,3))}})}}tu.mergeOptions($0);var q0=Object.defineProperty,ey=(r,e,t)=>e in r?q0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ty=(r,e,t)=>ey(r,e+"",t);const ny={};class nu extends en{constructor(e){super(e),ty(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 mg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}nu.mergeOptions(ny);var iy=Object.defineProperty,ry=(r,e,t)=>e in r?iy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sy=(r,e,t)=>ry(r,e+"",t);const oy={};class iu extends en{constructor(e){super(e),sy(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){this._position=this._coordsTransform(),this._threeGeometry?(this._threeGeometry.position.copy(this._position),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)):this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return yg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return gg(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}iu.mergeOptions(oy);var ay=Object.defineProperty,ly=(r,e,t)=>e in r?ay(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ru=(r,e,t)=>ly(r,typeof e!="symbol"?e+"":e,t);const cy={};class su extends en{constructor(e){super(e),ru(this,"_type","TPoints"),ru(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 Pg(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}su.mergeOptions(cy);var uy=Object.defineProperty,hy=(r,e,t)=>e in r?uy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,jn=(r,e,t)=>hy(r,typeof e!="symbol"?e+"":e,t);class Tr extends Kn(Object){constructor(e,t){super(),jn(this,"options"),jn(this,"map"),jn(this,"_sprite",null),jn(this,"_isDragging",!1),jn(this,"_dragStartPosition",null),jn(this,"_lastCoordinate",null),jn(this,"_boundOnMouseMove",null),jn(this,"_boundOnMouseUp",null),this.map=t,this.options={position:e.position,index:e.index,symbol:e.symbol??0,size:e.size??8,color:e.color??"#ffffff",opacity:e.opacity??.9,draggable:e.draggable??!0},this._createSprite(),this._boundOnMouseMove=this._onMouseMove.bind(this),this._boundOnMouseUp=this._onMouseUp.bind(this)}_createSprite(){const t=document.createElement("canvas"),n=t.getContext("2d");t.width=64,t.height=64;const i=64/2,o=64/2-2;n.clearRect(0,0,t.width,t.height),n.beginPath(),n.arc(i,i,o,0,2*Math.PI),n.fillStyle="#000000",n.fill(),n.beginPath(),n.arc(i,i,o-2,0,2*Math.PI),n.fillStyle=this.options.color,n.fill();const a=new p.CanvasTexture(t);a.needsUpdate=!0;const c=new p.SpriteMaterial({map:a,opacity:this.options.opacity,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!0});this._sprite=new p.Sprite(c),this._sprite.position.copy(this.options.position),this._sprite.renderOrder=999999;const u=new p.Vector2;this._sprite.onBeforeRender=(d,m,f)=>{if(!this._sprite||!f)return;const g=f.position.distanceTo(this._sprite.position);d.getSize(u);const v=d.getPixelRatio(),w=this.options.size*v;let b=1;if(f.isPerspectiveCamera){const x=f.fov*Math.PI/180,L=2*Math.tan(x/2)*g;b=w/u.y*L}else if(f.isOrthographicCamera){const x=f.top,L=f.bottom,M=Math.abs(x-L)/f.zoom;b=w/u.y*M}this._sprite.scale.set(b,b,1)},this._sprite._editHandle=this,this.map.viewer.scene.add(this._sprite)}updatePosition(e){this.options.position=e,this._sprite&&this._sprite.position.copy(e)}getPosition(){return this.options.position.clone()}getIndex(){return this.options.index}getSymbol(){return this.options.symbol}getSprite(){return this._sprite}intersect(e){return!this._sprite||!this.options.draggable?!1:e.intersectObject(this._sprite).length>0}startDrag(e){this.options.draggable&&(this._isDragging=!0,this._dragStartPosition=this.options.position.clone(),this._lastCoordinate=e,this.map.viewer.config("draggable",!1),this.map.on("mousemove",this._boundOnMouseMove),this.map.on("mouseup",this._boundOnMouseUp),this.trigger("dragstart",{target:this,coordinate:e,position:this.options.position.clone()}))}_onMouseMove(e){if(!this._isDragging||!this._lastCoordinate)return;const t=e.coordinate,n=t[0]-this._lastCoordinate[0],i=t[1]-this._lastCoordinate[1],o=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],o.z));this.updatePosition(a),this._lastCoordinate=t,this.trigger("dragging",{target:this,coordinate:t,position:this.options.position.clone(),offset:{dx:n,dy:i}})}_onMouseUp(e){this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp),this.trigger("dragend",{target:this,coordinate:e.coordinate,position:this.options.position.clone(),startPosition:this._dragStartPosition}),this._dragStartPosition=null,this._lastCoordinate=null)}show(){this._sprite&&(this._sprite.visible=!0)}hide(){this._sprite&&(this._sprite.visible=!1)}remove(){if(this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp)),this._sprite){this.map.viewer.scene.remove(this._sprite);const e=this._sprite.material;e.map&&e.map.dispose(),e.dispose(),this._sprite=null}this._dragStartPosition=null,this._lastCoordinate=null,this._boundOnMouseMove=null,this._boundOnMouseUp=null}}function ia(r,e,t){const{currentTarget:n,clientX:i,clientY:o}=r;if(n instanceof HTMLElement){const a=n.clientWidth,c=n.clientHeight,u=new p.Vector2(i/a*2-1,-(o/c)*2+1);return e.getLocalInfoFromScreen(t,u)?.location}else return}var dy=Object.defineProperty,fy=(r,e,t)=>e in r?dy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ht=(r,e,t)=>fy(r,typeof e!="symbol"?e+"":e,t);class py extends cs{constructor(e,t){super(e),ht(this,"options"),ht(this,"_handles",[]),ht(this,"_middleHandles",[]),ht(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),ht(this,"_editing",!1),ht(this,"_shadow",null),ht(this,"_shadowSnapshot",null),ht(this,"_updating",!1),ht(this,"_history",[]),ht(this,"_historyIndex",-1),ht(this,"_draggableOriginalState",!1),ht(this,"_boundOnMapMouseMove",null),ht(this,"_boundOnMapClick",null),ht(this,"_boundOnMapMouseDown",null),ht(this,"_boundOnFeatureDragging",null),ht(this,"_boundOnFeatureDragEnd",null),this.options={handleSize:t?.handleSize??8,handleColor:t?.handleColor??"#ffffff",showMiddleHandles:t?.showMiddleHandles??!1,maxHistorySize:t?.maxHistorySize??20,removeVertexOn:t?.removeVertexOn??"contextmenu"},this._boundOnMapMouseMove=this._onMapMouseMove.bind(this),this._boundOnMapClick=this._onMapClick.bind(this),this._boundOnMapMouseDown=this._onMapMouseDown.bind(this),this._boundOnFeatureDragging=this._onFeatureDragging.bind(this),this._boundOnFeatureDragEnd=this._onFeatureDragEnd.bind(this)}enable(){return this._editing?this:(super.enable(),this._editing=!0,this._createShadow(),this._saveSnapshot(),this._setFeatureEditingStyle(!0),this._createHandles(),this.target.trigger("editstart"),this._draggableOriginalState=this.target.options.draggable||!1,this._draggableOriginalState||(this.target.options.draggable=!0,this.target.draggable&&this.target.draggable.enable()),this)}disable(){return this._editing?(super.disable(),this._editing=!1,this._clearHandles(),this._setFeatureEditingStyle(!1),this._draggableOriginalState||(this.target.options.draggable=!1,this.target.draggable&&this.target.draggable.disable()),this._draggableOriginalState=!1,this._updateCoordFromShadow(),this._removeShadow(),this.target.trigger("editend"),this):this}addHooks(){const e=this._getMap();e&&(e.on("mousemove",this._boundOnMapMouseMove),e.on("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.addEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.on("contextmenu",this._boundOnMapClick)),this.target.on("dragging",this._boundOnFeatureDragging),this.target.on("dragend",this._boundOnFeatureDragEnd)}removeHooks(){const e=this._getMap();e&&(e.off("mousemove",this._boundOnMapMouseMove),e.off("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.removeEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.off("contextmenu",this._boundOnMapClick)),this.target.off("dragging",this._boundOnFeatureDragging),this.target.off("dragend",this._boundOnFeatureDragEnd)}isEditing(){return this._editing}_createShadow(){this._shadow=null}_removeShadow(){this._shadow&&(this._shadow=null),this._shadowSnapshot=null}_updateCoordFromShadow(e=!1){e&&!this._updating&&this.target._onPositionChanged(!0)}_saveSnapshot(){const e=this.target._geometry;this._shadowSnapshot={type:e.type,coordinates:JSON.parse(JSON.stringify(e.coordinates))},this._addHistory(e.coordinates)}_addHistory(e){this._historyIndex<this._history.length-1&&(this._history=this._history.slice(0,this._historyIndex+1)),this._history.push({coordinates:JSON.parse(JSON.stringify(e)),timestamp:Date.now()}),this._history.length>this.options.maxHistorySize?this._history.shift():this._historyIndex++}undo(){if(this._historyIndex>0){this._historyIndex--;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editundo")}return this}redo(){if(this._historyIndex<this._history.length-1){this._historyIndex++;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editredo")}return this}_restoreCoordinates(e){const t=this.target._geometry;t.coordinates=JSON.parse(JSON.stringify(e)),this.target._onPositionChanged(!0),this._updateHandlePositions()}cancel(){return this._shadowSnapshot&&this._restoreCoordinates(this._shadowSnapshot.coordinates),this.disable(),this}_createHandles(){const e=this.target._geometry,t=this._getMap();if(!t){console.warn("[FeatureEditHandler] No map found, cannot create handles");return}this.target instanceof en?this._createPointHandles(e,t):this.target instanceof Mt?this._createLineStringHandles(e,t):this.target instanceof vn&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const n=e.coordinates,i=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),o=new Tr({position:i,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);o.on("dragstart",a=>{this._onHandleDragStart(a,0)}),o.on("dragging",a=>{this._onHandleDragging(a,0)}),o.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(o)}_createLineStringHandles(e,t){const n=e.coordinates;n.forEach((i,o)=>{const a=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0)),c=new Tr({position:a,index:o,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",u=>{this._onHandleDragStart(u,o)}),c.on("dragging",u=>{this._onHandleDragging(u,o)}),c.on("dragend",u=>{this._onHandleDragEnd(u,o)}),this._handles.push(c)}),this.options.showMiddleHandles&&this._createLineStringMiddleHandles(n,t)}_onHandleDragging(e,t){this._updating=!0;const i=e.target.getPosition();if(!this._getMap())return;const a=this._fixHandlePointCoordinates(i,t),c=this.target._geometry;this.target instanceof en?c.coordinates=[a.x,a.y,a.z]:this.target instanceof Mt&&(c.coordinates[t]=[a.x,a.y,a.z]),this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,coordinate:[a.x,a.y,a.z]}),this.target.trigger("editing",{index:t,coordinate:[a.x,a.y,a.z]}),this._updating=!1}_onHandleDragStart(e,t){this._updating=!0,this.target.trigger("handledragstart",{index:t,coordinate:e.coordinate})}_onHandleDragEnd(e,t){this._updating=!1;const n=this.target._geometry;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,coordinate:this.target instanceof en?n.coordinates:n.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof en?n.coordinates:n.coordinates[t]})}_createPolygonHandles(e,t){const n=e.coordinates;if(!n||!Array.isArray(n)||n.length===0){console.warn("[FeatureEditHandler] Invalid polygon coordinates");return}n.forEach((o,a)=>{if(!o||o.length<3)return;const c=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let u=0;u<c;u++){const d=o[u],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Tr({position:m,index:u,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);f._ringIndex=a,f.on("dragstart",g=>{this._onPolygonHandleDragStart(g,u,a)}),f.on("dragging",g=>{this._onPolygonHandleDragging(g,u,a)}),f.on("dragend",g=>{this._onPolygonHandleDragEnd(g,u,a)}),this._handles.push(f)}this.options.showMiddleHandles&&this._createPolygonMiddleHandles(o,a,t)})}_onPolygonHandleDragStart(e,t,n){this._updating=!0,this.target.trigger("handledragstart",{index:t,ringIndex:n,coordinate:e.coordinate})}_onPolygonHandleDragging(e,t,n){const o=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(o,t,n),d=this.target._geometry.coordinates;if(d[n]&&d[n][t]&&(d[n][t]=[c.x,c.y,c.z],t===0&&d[n].length>1)){const m=d[n].length-1;d[n][m]=[c.x,c.y,c.z]}this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,ringIndex:n,coordinate:[c.x,c.y,c.z]}),this.target.trigger("editing",{index:t,ringIndex:n,coordinate:[c.x,c.y,c.z]})}_onPolygonHandleDragEnd(e,t,n){this._updating=!1;const i=this.target._geometry,o=i.coordinates;this._addHistory(i.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:n,coordinate:o[n]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:n,coordinate:o[n]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof en){const n=e.coordinates,i=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[0]&&this._handles[0].updatePosition(i)}else if(this.target instanceof Mt)e.coordinates.forEach((i,o)=>{const a=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0));this._handles[o]&&this._handles[o].updatePosition(a)});else if(this.target instanceof vn){const n=e.coordinates;let i=0;n.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a;c++){const u=o[c],d=t.geo2world(new p.Vector3(u[0],u[1],u[2]||0));this._handles[i]&&this._handles[i].updatePosition(d),i++}})}}}_clearHandles(){this._handles.forEach(e=>e.remove()),this._handles=[],this._middleHandles.forEach(e=>e.remove()),this._middleHandles=[]}_onFeatureDragging(e){this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_onFeatureDragEnd(e){const t=this.target._geometry;this._addHistory(t.coordinates),this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_updateMiddleHandlePositions(){const e=this.target._geometry,t=this._getMap();if(!t)return;let n=0;if(this.target instanceof Mt){const i=e.coordinates;for(let o=0;o<i.length-1&&!(n>=this._middleHandles.length);o++){const a=i[o],c=i[o+1],u=[(a[0]+c[0])/2,(a[1]+c[1])/2,((a[2]||0)+(c[2]||0))/2],d=t.geo2world(new p.Vector3(u[0],u[1],u[2]));this._middleHandles[n].updatePosition(d),n++}}else this.target instanceof vn&&e.coordinates.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a&&!(n>=this._middleHandles.length);c++){const u=(c+1)%a,d=o[c],m=o[u],f=[(d[0]+m[0])/2,(d[1]+m[1])/2,((d[2]||0)+(m[2]||0))/2],g=t.geo2world(new p.Vector3(f[0],f[1],f[2]));this._middleHandles[n].updatePosition(g),n++}})}_onMapMouseDown(e){const t=this._getMap();if(!t)return;const n=new p.Raycaster;n.params.Points={threshold:.5};const i=e,o=t.viewer.renderer.domElement,a=o.getBoundingClientRect(),c=new p.Vector2((i.clientX-a.left)/a.width*2-1,-((i.clientY-a.top)/a.height)*2+1);n.setFromCamera(c,t.viewer.camera);const u=[...this._handles,...this._middleHandles];for(const d of u)if(d.intersect(n)){const m=ia({currentTarget:o,clientX:i.clientX,clientY:i.clientY},t.tilemap,t.viewer.camera);m&&(d.startDrag([m.x,m.y]),i.stopPropagation&&i.stopPropagation(),i.stopImmediatePropagation&&i.stopImmediatePropagation(),i.preventDefault&&i.preventDefault());return}}_onMapMouseMove(e){}_onMapClick(e){if(!(e.type===this.options.removeVertexOn))return;const n=this._getMap();if(!n)return;const i=new p.Raycaster;i.params.Points={threshold:.5};const o=e.originEvent;if(!o)return;const a=new p.Vector2(o.offsetX/n.viewer.renderer.domElement.clientWidth*2-1,-(o.offsetY/n.viewer.renderer.domElement.clientHeight)*2+1);i.setFromCamera(a,n.viewer.camera);for(let c=0;c<this._handles.length;c++)if(this._handles[c].intersect(i)){this._removeVertex(c),o.stopPropagation&&o.stopPropagation(),o.preventDefault&&o.preventDefault();return}}_setFeatureEditingStyle(e){const t=this.target._threeGeometry;t&&t.traverse(n=>{n.material&&(e?Array.isArray(n.material)?n.material.forEach(i=>{i.userData._originalOpacity||(i.userData._originalOpacity=i.opacity),i.opacity=Math.min(i.opacity*.6,.6),i.transparent=!0}):(n.material.userData._originalOpacity||(n.material.userData._originalOpacity=n.material.opacity),n.material.opacity=Math.min(n.material.opacity*.6,.6),n.material.transparent=!0):Array.isArray(n.material)?n.material.forEach(i=>{i.userData._originalOpacity!==void 0&&(i.opacity=i.userData._originalOpacity,delete i.userData._originalOpacity)}):n.material.userData._originalOpacity!==void 0&&(n.material.opacity=n.material.userData._originalOpacity,delete n.material.userData._originalOpacity))})}_removeVertex(e){const t=this.target._geometry,n=this._handles[e],i=n.getIndex(),o=n._ringIndex||0;let a=null;if(this.target instanceof Mt){const c=t.coordinates;if(c.length<=2){console.warn("[FeatureEditHandler] LineString requires at least 2 vertices");return}a=c[i],c.splice(i,1)}else if(this.target instanceof vn){const u=t.coordinates[o];if(!u)return;const d=u.length>1&&u[0][0]===u[u.length-1][0]&&u[0][1]===u[u.length-1][1],m=d?4:3;if(u.length<=m){console.warn("[FeatureEditHandler] Polygon ring requires at least 3 vertices");return}a=u[i],u.splice(i,1),d&&i===0&&u.length>0&&(u[u.length-1]=[...u[0]])}else return;this.target._onPositionChanged(!0),n.remove(),this._handles.splice(e,1),this._updateHandleIndices(),this._addHistory(t.coordinates),this.target.trigger("handleremove",{index:i,ringIndex:o,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let n=0;n<e.length-1;n++){const i=e[n],o=e[n+1],a=[(i[0]+o[0])/2,(i[1]+o[1])/2,((i[2]||0)+(o[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),u=new Tr({position:c,index:n,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},t);u.on("dragstart",d=>{this._onMiddleHandleClick(n,"LineString",0)}),this._middleHandles.push(u)}}_createPolygonMiddleHandles(e,t,n){const i=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.length-1:e.length;for(let o=0;o<i;o++){const a=(o+1)%i,c=e[o],u=e[a],d=[(c[0]+u[0])/2,(c[1]+u[1])/2,((c[2]||0)+(u[2]||0))/2],m=n.geo2world(new p.Vector3(d[0],d[1],d[2])),f=new Tr({position:m,index:o,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},n);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(o,"Polygon",t)}),this._middleHandles.push(f)}}_onMiddleHandleClick(e,t,n){const i=this.target._geometry;if(this._getMap()){if(t==="LineString"){const a=i.coordinates,c=a[e],u=a[e+1],d=[(c[0]+u[0])/2,(c[1]+u[1])/2,((c[2]||0)+(u[2]||0))/2];a.splice(e+1,0,d)}else if(t==="Polygon"){const c=i.coordinates[n];if(!c)return;const u=c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]?c.length-1:c.length,d=(e+1)%u,m=c[e],f=c[d],g=[(m[0]+f[0])/2,(m[1]+f[1])/2,((m[2]||0)+(f[2]||0))/2];c.splice(e+1,0,g),c.length>1&&c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]&&e===u-1&&(c[c.length-1]=[...c[0]])}this.target._onPositionChanged(!0),this._clearHandles(),this._createHandles(),this._addHistory(i.coordinates),this.target.trigger("vertexinsert",{index:e+1,ringIndex:n})}}_updateHandleIndices(){if(this.target instanceof Mt)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof vn){let e=0;this.target._geometry.coordinates.forEach((i,o)=>{const a=i[0][0]===i[i.length-1][0]&&i[0][1]===i[i.length-1][1]?i.length-1:i.length;for(let c=0;c<a;c++)this._handles[e]&&(this._handles[e]._index=c,this._handles[e]._ringIndex=o),e++})}}_fixHandlePointCoordinates(e,t,n=0){const i=this._getMap();if(!i)return e;const o=this.target._geometry;let a=null;if(this.target instanceof en)a=o.coordinates;else if(this.target instanceof Mt)a=o.coordinates[t];else if(this.target instanceof vn){const u=o.coordinates;u[n]&&u[n][t]&&(a=u[n][t])}if(!a||!a[2]||a[2]===0)return i.world2geo(e);const c=i.world2geo(e);return c.z=a[2],c}_getMap(){return this.target.getMap()}remove(){this.disable(),this._history=[],this._historyIndex=-1,this._shadow=null,this._shadowSnapshot=null,this._boundOnMapMouseMove=null,this._boundOnMapClick=null,this._boundOnMapMouseDown=null}}ut.prototype.startEdit=function(r){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new py(this,r),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},ut.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},ut.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},ut.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},ut.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},ut.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function vs(r,e){if(!r||r===!0)return!0;if(!Array.isArray(r))return!!r;switch(r[0]){case"all":return r.slice(1).every(n=>vs(n,e));case"any":return r.slice(1).some(n=>vs(n,e));case"!":return!vs(r[1],e);case"==":{const n=Oe(r[1],e),i=Oe(r[2],e);return _s(n)==_s(i)}case"!=":{const n=Oe(r[1],e),i=Oe(r[2],e);return _s(n)!=_s(i)}case">":{const n=Oe(r[1],e),i=Oe(r[2],e);return Jn(n)>Jn(i)}case"<":{const n=Oe(r[1],e),i=Oe(r[2],e);return Jn(n)<Jn(i)}case">=":{const n=Oe(r[1],e),i=Oe(r[2],e);return Jn(n)>=Jn(i)}case"<=":{const n=Oe(r[1],e),i=Oe(r[2],e);return Jn(n)<=Jn(i)}case"in":{const n=Oe(r[1],e);return r.slice(2).map(o=>Oe(o,e)).includes(n)}case"!in":{const n=Oe(r[1],e);return!r.slice(2).map(o=>Oe(o,e)).includes(n)}case"has":{const n=r[1];return e!=null&&Object.prototype.hasOwnProperty.call(e,n)}case"!has":{const n=r[1];return!(e!=null&&Object.prototype.hasOwnProperty.call(e,n))}case"like":case"contains":{const n=Oe(r[1],e),i=Oe(r[2],e);return String(n).toLowerCase().includes(String(i).toLowerCase())}case"starts-with":{const n=Oe(r[1],e),i=Oe(r[2],e);return String(n).toLowerCase().startsWith(String(i).toLowerCase())}case"ends-with":{const n=Oe(r[1],e),i=Oe(r[2],e);return String(n).toLowerCase().endsWith(String(i).toLowerCase())}default:return!0}}function Oe(r,e){if(Array.isArray(r))switch(r[0]){case"get":return e?e[r[1]]:void 0;default:return r}return r}function _s(r){if(r==null)return null;if(typeof r=="string"){const e=Number(r);if(!isNaN(e)&&r.trim()!=="")return e}return typeof r=="boolean"?r?1:0:r}function Jn(r){if(r==null)return 0;if(typeof r=="number")return r;if(typeof r=="boolean")return r?1:0;if(typeof r=="string"){const e=Number(r);return isNaN(e)?0:e}return Number(r)}var my=Object.defineProperty,gy=(r,e,t)=>e in r?my(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ki=(r,e,t)=>gy(r,typeof e!="symbol"?e+"":e,t);class ws extends Yn{constructor(e,t){super(e,t),ki(this,"TILE_SIZE"),ki(this,"EXTENT"),ki(this,"style"),ki(this,"interactive",!1),ki(this,"_tileFeatureMap",new Map),ki(this,"_activeFeatureFilter"),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,t){const n=this.getMap(),i=`${e.z}-${e.x}-${e.y}`,o=this._tileFeatureMap.get(i);if(o&&o.length>0){o.forEach(d=>{d.visible=!0,this.children.some(m=>m&&d&&m.uuid===d.uuid)||d.addTo(this)});return}const a=t.vectorData;if(!a||!a.layers||!n||this.style.length===0)return;const c=[],u=this.style;Object.keys(a.layers).forEach(d=>{const m=a.layers[d];for(let f=0;f<m.length;f++){const g=m[f],v=g.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(g.properties))continue;let w=null;for(const b of u)if(this._evaluateFilter(b.filter,g.properties,d,g.geometry.type)){w=b.style;break}if(w){const b={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:v,extent:this.EXTENT,tileSize:this.TILE_SIZE},x=this._createFeatureInstance(g.geometry,g.geometry.type,w,{layerName:d,...g.properties});x&&(x.userData.tileData=b,x.style=xt.create(w),x.addTo(this),x.initializeGeometry(),c.push(x))}}}),this._tileFeatureMap.set(i,c)}_evaluateFilter(e,t,n,i){if(!e||e===!0)return!0;const o={...t,$layer:n,$type:i};return vs(e,o)}hideFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&t.forEach(n=>{n.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&(t.forEach(n=>{n._remove()}),this._tileFeatureMap.delete(e))}_createFeatureInstance(e,t,n,i){const a={geometry:{ismvt:!0,...e},style:n,userData:i};switch(t){case"Point":return new Pn(a);case"LineString":return new Mt(a);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(t=>{t.forEach(n=>{n.material&&(n.material.opacity=e,n.material.transparent=e<1)})})}_onMapUpdate(){}updateStyle(e,t){if(!e||!Array.isArray(e)){console.warn("[VectorTileRenderLayer] updateStyle called with invalid style rules.");return}this.style=e,this._tileFeatureMap.forEach((n,i)=>{const o=t.get(i);if(!o||!o.data||!o.data.vectorData)return;const a=o.data.vectorData;n.forEach(c=>{const u=c.userData,d=c.userData.tileData?.rawCoordinates?.type;let m="";if(a&&a.layers){for(const[g,v]of Object.entries(a.layers))if(v.some(b=>b.properties===u||JSON.stringify(b.properties)===JSON.stringify(u))){m=g;break}}if(this._activeFeatureFilter&&!this._activeFeatureFilter(u)){c.visible=!1;return}let f=null;for(const g of e)if(this._evaluateFilter(g.filter,u,m,d)){f=g.style;break}f?(this._applyStyleToFeature(c,f),c.visible=!0):c.visible=!1})})}_applyStyleToFeature(e,t){e.style=xt.create(t),e.initializeGeometry()}validateFeature(e){return e instanceof ut}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)})}}var yy=Object.defineProperty,vy=(r,e,t)=>e in r?yy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,St=(r,e,t)=>vy(r,typeof e!="symbol"?e+"":e,t);class ou extends fs{constructor(e,t){super(e,t),this.layerId=e,St(this,"isTileLayer",!0),St(this,"layerType","base"),St(this,"isBaseLayer",!1),St(this,"_enabled",!0),St(this,"_visible",!0),St(this,"_rootTile"),St(this,"_loader"),St(this,"_LODThreshold",1),St(this,"isSceneLayer",!1),St(this,"opacity",1),St(this,"source"),St(this,"projection"),St(this,"minLevel",2),St(this,"maxLevel",19),this.source=t.source,this.projection=t.projection,this.minLevel=t.minLevel??2,this.maxLevel=t.maxLevel??19,this._LODThreshold=t.LODThreshold??1,this.opacity=t.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new Bn,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(t=>{t.isTile&&t.loaded&&(e=Math.max(e,t.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}}var _y=Object.defineProperty,wy=(r,e,t)=>e in r?_y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,by=(r,e,t)=>wy(r,e+"",t);class au extends p.LoadingManager{constructor(){super(...arguments),by(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const De={manager:new au,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(r){De.imgLoaderMap.set(r.dataType,r),r.info.author=r.info.author??_o.name},registerGeometryLoader(r){De.demLoaderMap.set(r.dataType,r),r.info.author=r.info.author??_o.name},registerMeshLoader(r){De.meshLoaderMap.set(r.dataType,r),r.info.author=r.info.author??_o.name},getMaterialLoader(r){const e=De.imgLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getGeometryLoader(r){const e=De.demLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getMeshLoader(r){const e=De.meshLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`}};var xy=Object.defineProperty,My=(r,e,t)=>e in r?xy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sy=(r,e,t)=>My(r,e+"",t);class Ly{constructor(e){Sy(this,"worker"),this.worker=e()}async run(e,t){return new Promise(n=>{this.worker.onmessage=i=>{n(i.data)},this.worker.postMessage(e,t)})}terminate(){this.worker.terminate()}}const Py=4096,lu=Math.PI;function ra(r,e){const t=Math.floor(r[0]*e),n=Math.floor(r[1]*e),i=Math.floor((r[2]-r[0])*e),o=Math.floor((r[3]-r[1])*e);return{sx:t,sy:n,sw:i,sh:o}}function sa(r,e,t,n){if(n<r.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(n<=r.maxLevel)return{url:r._getUrl(e,t,n),clipBounds:[0,0,1,1]};const i=Cy(e,t,n,r.maxLevel),o=i.parentNO;return{url:r._getUrl(o.x,o.y,o.z),clipBounds:i.bounds}}function Cy(r,e,t,n){const i=t-n,o={x:r>>i,y:e>>i,z:t-i},a=Math.pow(2,i),c=Math.pow(.5,i),u=r%a/a-.5+c/2,d=e%a/a-.5+c/2,m=new p.Vector2(u,d),f=new p.Box2().setFromCenterAndSize(m,new p.Vector2(c,c)),g=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:o,bounds:g}}function oa(r,e,t,n,i=Py){const{x:o,y:a}=r,c=(e+o/i)/Math.pow(2,n),u=(t+a/i)/Math.pow(2,n),d=c*360-180,f=Math.atan(Math.sinh(lu*(1-2*u)))*180/lu;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Ty(r,e,t,n){if(!r||!r.coordinates)throw new Error("无效的geometry数据格式");const i={type:r.type,coordinates:null};function o(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return oa(a,e,t,n);if(Array.isArray(a)&&a.length>0){const c=a[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?a.map(u=>oa(u,e,t,n)):a.map(u=>o(u))}return a}return i.coordinates=o(r.coordinates),i}var Gy=Object.defineProperty,Wy=(r,e,t)=>e in r?Gy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bs=(r,e,t)=>Wy(r,typeof e!="symbol"?e+"":e,t);class xs{constructor(){bs(this,"_imgSource",[]),bs(this,"_demSource"),bs(this,"_vtSource"),bs(this,"manager",De.manager)}get imgSource(){return this._imgSource}set imgSource(e){this._imgSource=e}get demSource(){return this._demSource}set demSource(e){this._demSource=e}get vtSource(){return this._vtSource}set vtSource(e){this._vtSource=e}async load(e){const t=await this.loadGeometry(e),n=await this.loadMaterial(e);console.assert(!!n&&!!t);for(let i=0;i<n.length;i++)t.addGroup(0,1/0,i);return{materials:n,geometry:t}}unload(e){const t=e.material,n=e.geometry;for(let i=0;i<t.length;i++)t[i].dispose();n.dispose()}async loadGeometry(e){let t;if(this.demSource&&e.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,e.bounds)){const n=De.getGeometryLoader(this.demSource),i=this.demSource;t=await n.load({source:i,...e}).catch(o=>(console.error("Load material error",i.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{n.unload&&n.unload(t)})}else if(this.vtSource&&e.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,e.bounds)){const n=De.getMeshLoader(this.vtSource),i=this.vtSource;t=await n.load({source:i,...e}).catch(o=>(console.error("Load geometry error",i.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{n.unload&&n.unload(t)})}else t=new p.PlaneGeometry;return t}async loadMaterial(e){const n=this.imgSource.filter(i=>e.z>=i.minLevel&&this._isBoundsInSourceBounds(i,e.bounds)).map(async i=>{const o=De.getMaterialLoader(i),a=await o.load({source:i,...e}).catch(u=>(console.error("Load material error",i.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=u=>{o.unload&&o.unload(u.target),u.target.removeEventListener("dispose",c)};return a instanceof p.MeshBasicMaterial||a.addEventListener("dispose",c),a});return Promise.all(n)}_isBoundsInSourceBounds(e,t){const n=e._projectionBounds;return!(t[2]<n[0]||t[3]<n[1]||t[0]>n[2]||t[1]>n[3])}}function Gr(...r){const e=r,t=e&&e.length>1&&e[0].constructor||null;if(!t)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const n=e.reduce((a,c)=>a+c.length,0),i=new t(n);let o=0;for(const a of e)i.set(a,o),o+=a.length;return i}function cu(r,e,t,n){const i=n?Vy(n,r.position.value):Zy(e),o=i.length,a=new Float32Array(o*6),c=new Float32Array(o*4),u=new e.constructor(o*6),d=new Float32Array(o*6);for(let f=0;f<o;f++)Iy({edge:i[f],edgeIndex:f,attributes:r,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:u,newNormals:d});r.position.value=Gr(r.position.value,a),r.texcoord.value=Gr(r.texcoord.value,c),r.normal.value=Gr(r.normal.value,d);const m=Gr(e,u);return{attributes:r,indices:m}}function Zy(r){const e=[],t=Array.isArray(r)?r:Array.from(r);for(let i=0;i<t.length;i+=3){const o=t[i],a=t[i+1],c=t[i+2];e.push([o,a],[a,c],[c,o])}e.sort(([i,o],[a,c])=>{const u=Math.min(i,o),d=Math.min(a,c);return u!==d?u-d:Math.max(i,o)-Math.max(a,c)});const n=[];for(let i=0;i<e.length;i++)i+1<e.length&&e[i][0]===e[i+1][1]&&e[i][1]===e[i+1][0]?i++:n.push(e[i]);return n}function Vy(r,e){const t=(i,o)=>{i.sort(o)};t(r.westIndices,(i,o)=>e[3*i+1]-e[3*o+1]),t(r.eastIndices,(i,o)=>e[3*o+1]-e[3*i+1]),t(r.southIndices,(i,o)=>e[3*o]-e[3*i]),t(r.northIndices,(i,o)=>e[3*i]-e[3*o]);const n=[];return Object.values(r).forEach(i=>{if(i.length>1)for(let o=0;o<i.length-1;o++)n.push([i[o],i[o+1]])}),n}function Iy({edge:r,edgeIndex:e,attributes:t,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:a,newNormals:c}){const u=t.position.value.length,d=e*2,m=d+1;i.set(t.position.value.subarray(r[0]*3,r[0]*3+3),d*3),i[d*3+2]=i[d*3+2]-n,i.set(t.position.value.subarray(r[1]*3,r[1]*3+3),m*3),i[m*3+2]=i[m*3+2]-n,o.set(t.texcoord.value.subarray(r[0]*2,r[0]*2+2),d*2),o.set(t.texcoord.value.subarray(r[1]*2,r[1]*2+2),m*2);const f=e*2*3;a[f]=r[0],a[f+1]=u/3+m,a[f+2]=r[1],a[f+3]=u/3+m,a[f+4]=r[0],a[f+5]=u/3+d,c[f]=0,c[f+1]=0,c[f+2]=1,c[f+3]=0,c[f+4]=0,c[f+5]=1}function uu(r){if(r.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${r.length}!`);const e=Math.floor(Math.sqrt(r.length)),t=e,n=e,i=aa(n,t);return{attributes:Ay(r,n,t),indices:i}}function Ay(r,e,t){const n=t*e,i=new Float32Array(n*3),o=new Float32Array(n*2);let a=0;for(let c=0;c<e;c++)for(let u=0;u<t;u++){const d=u/(t-1),m=c/(e-1);o[a*2]=d,o[a*2+1]=m,i[a*3]=d-.5,i[a*3+1]=m-.5,i[a*3+2]=r[(e-c-1)*t+u],a++}return{position:{value:i,size:3},texcoord:{value:o,size:2},normal:{value:la(i,aa(e,t)),size:3}}}function aa(r,e){const t=6*(e-1)*(r-1),n=new Uint16Array(t);let i=0;for(let o=0;o<r-1;o++)for(let a=0;a<e-1;a++){const c=o*e+a,u=c+1,d=c+e,m=d+1,f=i*6;n[f]=c,n[f+1]=u,n[f+2]=d,n[f+3]=d,n[f+4]=u,n[f+5]=m,i++}return n}function la(r,e){const t=new Float32Array(r.length);for(let n=0;n<e.length;n+=3){const i=e[n]*3,o=e[n+1]*3,a=e[n+2]*3,c=r[i],u=r[i+1],d=r[i+2],m=r[o],f=r[o+1],g=r[o+2],v=r[a],w=r[a+1],b=r[a+2],x=m-c,L=f-u,M=g-d,C=v-c,W=w-u,z=b-d,D=L*z-M*W,X=M*C-x*z,I=x*W-L*C,K=Math.sqrt(D*D+X*X+I*I),V=[0,0,1];if(K>0){const G=1/K;V[0]=D*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[i+G]=t[o+G]=t[a+G]=V[G]}return t}var Fy=Object.defineProperty,Oy=(r,e,t)=>e in r?Fy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Dy=(r,e,t)=>Oy(r,e+"",t);class Ki extends p.PlaneGeometry{constructor(){super(...arguments),Dy(this,"type","TileGeometry")}setData(e,t=1e3){let n=e instanceof Float32Array?uu(e):e;n=cu(n.attributes,n.indices,t);const{attributes:i,indices:o}=n;return this.setIndex(new p.BufferAttribute(o,1)),this.setAttribute("position",new p.BufferAttribute(i.position.value,i.position.size)),this.setAttribute("uv",new p.BufferAttribute(i.texcoord.value,i.texcoord.size)),this.setAttribute("normal",new p.BufferAttribute(i.normal.value,i.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}var zy=Object.defineProperty,Xy=(r,e,t)=>e in r?zy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qn=(r,e,t)=>Xy(r,typeof e!="symbol"?e+"":e,t);class hu{constructor(e=257){Qn(this,"gridSize"),Qn(this,"numTriangles"),Qn(this,"numParentTriangles"),Qn(this,"indices"),Qn(this,"coords"),this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,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,o=0,a=0,c=0,u=0,d=0,m=0;for(i&1?c=u=d=t:o=a=m=t;(i>>=1)>1;){const g=o+c>>1,v=a+u>>1;i&1?(c=o,u=a,o=d,a=m):(o=c,a=u,c=d,u=m),d=g,m=v}const f=n*4;this.coords[f+0]=o,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=u}}createTile(e){return new Uy(e,this)}}class Uy{constructor(e,t){Qn(this,"martini"),Qn(this,"terrain"),Qn(this,"errors");const n=t.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:n,gridSize:i}=this.martini,{terrain:o,errors:a}=this;for(let c=e-1;c>=0;c--){const u=c*4,d=n[u+0],m=n[u+1],f=n[u+2],g=n[u+3],v=d+f>>1,w=m+g>>1,b=v+w-m,x=w+d-v,L=(o[m*i+d]+o[g*i+f])/2,M=w*i+v,C=Math.abs(L-o[M]);if(a[M]=Math.max(a[M],C),c<t){const W=(m+x>>1)*i+(d+b>>1),z=(g+x>>1)*i+(f+b>>1);a[M]=Math.max(a[M],a[W],a[z])}}}getGeometryData(e=0){const{gridSize:t,indices:n}=this.martini,{errors:i}=this;let o=0,a=0;const c=t-1;let u,d,m=0;n.fill(0);function f(M,C,W,z,D,X){const I=M+W>>1,K=C+z>>1;Math.abs(M-D)+Math.abs(C-X)>1&&i[K*t+I]>e?(f(D,X,M,C,I,K),f(W,z,D,X,I,K)):(u=C*t+M,d=z*t+W,m=X*t+D,n[u]===0&&(n[u]=++o),n[d]===0&&(n[d]=++o),n[m]===0&&(n[m]=++o),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=o*2,v=a*3,w=new Uint16Array(g),b=new Uint32Array(v);let x=0;function L(M,C,W,z,D,X){const I=M+W>>1,K=C+z>>1;if(Math.abs(M-D)+Math.abs(C-X)>1&&i[K*t+I]>e)L(D,X,M,C,I,K),L(W,z,D,X,I,K);else{const V=n[C*t+M]-1,G=n[z*t+W]-1,k=n[X*t+D]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=W,w[2*G+1]=z,w[2*k]=D,w[2*k+1]=X,b[x++]=V,b[x++]=G,b[x++]=k}}return L(0,0,c,c,c,0),L(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,w,b),indices:b}}_getMeshAttributes(e,t,n){const i=Math.floor(Math.sqrt(e.length)),o=i-1,a=t.length/2,c=new Float32Array(a*3),u=new Float32Array(a*2);for(let m=0;m<a;m++){const f=t[m*2],g=t[m*2+1],v=g*i+f;c[3*m+0]=f/o-.5,c[3*m+1]=.5-g/o,c[3*m+2]=e[v],u[2*m+0]=f/o,u[2*m+1]=1-g/o}const d=la(c,n);return{position:{value:c,size:3},texcoord:{value:u,size:2},normal:{value:d,size:3}}}}var ky=Object.defineProperty,Ky=(r,e,t)=>e in r?ky(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,du=(r,e,t)=>Ky(r,typeof e!="symbol"?e+"":e,t);class ca{constructor(){du(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),du(this,"dataType","")}async load(e){const{source:t,x:n,y:i,z:o}=e,{url:a,clipBounds:c}=sa(t,n,i,o);if(!a)return new Ki;const u=await this.doLoad(a,{source:t,x:n,y:i,z:o,bounds:c});return De.manager.parseEnd(a),u}}class ua extends p.MeshStandardMaterial{constructor(e={}){super({transparent:!0,side:p.FrontSide,...e})}setTexture(e){this.map=e,this.needsUpdate=!0}dispose(){const e=this.map;e&&(e.image instanceof ImageBitmap&&e.image.close(),e.dispose())}}var nt=(r=>(r[r.Unknown=0]="Unknown",r[r.Point=1]="Point",r[r.Linestring=2]="Linestring",r[r.Polygon=3]="Polygon",r))(nt||{});class fu{render(e,t,n,i,o=1){switch(e.lineCap="round",e.lineJoin="round",(i.shadowBlur??0)>0&&(e.shadowBlur=i.shadowBlur??2,e.shadowColor=i.shadowColor??"black",e.shadowOffsetX=i.shadowOffset?i.shadowOffset[0]:0,e.shadowOffsetY=i.shadowOffset?i.shadowOffset[1]:0),t){case nt.Point:e.textAlign="center",e.textBaseline="middle",e.font=i.font??"14px Arial",e.fillStyle=i.fontColor??"white",this._renderPointText(e,n,o,i.textField??"name",i.fontOffset??[0,-8]);break;case nt.Linestring:this._renderLineString(e,n,o);break;case nt.Polygon:this._renderPolygon(e,n,o);break;default:console.warn(`Unknown feature type: ${t}`)}(i.fill||t===nt.Point)&&(e.globalAlpha=i.fillOpacity||.5,e.fillStyle=i.fillColor||i.color||"#3388ff",e.fill(i.fillRule||"evenodd")),(i.stroke??!0)&&(i.weight??1)>0&&(e.globalAlpha=i.opacity||1,e.lineWidth=i.weight||1,e.strokeStyle=i.color||"#3388ff",e.setLineDash(i.dashArray||[]),e.stroke())}_renderPointText(e,t,n=1,i="name",o=[0,0]){const a=t.geometry;e.beginPath();for(const u of a)for(let d=0;d<u.length;d++){const m=u[d];e.arc(m.x*n,m.y*n,2,0,2*Math.PI)}const c=t.properties;c&&c[i]&&e.fillText(c[i],a[0][0].x*n+o[0],a[0][0].y*n+o[1])}_renderLineString(e,t,n){const i=t.geometry;e.beginPath();for(const o of i)for(let a=0;a<o.length;a++){const{x:c,y:u}=o[a];a===0?e.moveTo(c*n,u*n):e.lineTo(c*n,u*n)}}_renderPolygon(e,t,n){const i=t.geometry;e.beginPath();for(let o=0;o<i.length;o++){const a=i[o];for(let c=0;c<a.length;c++){const{x:u,y:d}=a[c];c===0?e.moveTo(u*n,d*n):e.lineTo(u*n,d*n)}e.closePath()}}}var Ny=Object.defineProperty,By=(r,e,t)=>e in r?Ny(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pu=(r,e,t)=>By(r,typeof e!="symbol"?e+"":e,t);class ha{constructor(){pu(this,"info",{version:"0.10.0",description:"Image loader base class"}),pu(this,"dataType","")}async load(e){const{source:t,x:n,y:i,z:o}=e,a=new ua({}),{url:c,clipBounds:u}=sa(t,n,i,o);if(c){const d=await this.doLoad(c,{source:t,x:n,y:i,z:o,bounds:u});a.map=d,De.manager.parseEnd(c)}return a}}var Yy=Object.defineProperty,Ry=(r,e,t)=>e in r?Yy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mu=(r,e,t)=>Ry(r,typeof e!="symbol"?e+"":e,t);class jy{constructor(){mu(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),mu(this,"dataType","")}async load(e){const t=this._creatCanvasContext(256,256);this.drawTile(t,e);const n=new p.CanvasTexture(t.canvas.transferToImageBitmap());return new ua({transparent:!0,map:n,opacity:e.source.opacity})}_creatCanvasContext(e,t){const i=new OffscreenCanvas(e,t).getContext("2d");if(!i)throw new Error("create canvas context failed");return i.scale(1,-1),i.translate(0,-t),i}}var Jy=Object.defineProperty,Qy=(r,e,t)=>e in r?Jy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,da=(r,e,t)=>Qy(r,typeof e!="symbol"?e+"":e,t);class Hy extends ha{constructor(){super(...arguments),da(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),da(this,"dataType","image"),da(this,"loader",new p.ImageLoader(De.manager))}async doLoad(e,t){const n=await this.loader.loadAsync(e).catch(a=>new Image(1,1)),i=new p.Texture;i.colorSpace=p.SRGBColorSpace;const{bounds:o}=t;return o[2]-o[0]<1?i.image=Ey(n,o):i.image=n,i.needsUpdate=!0,i}}function Ey(r,e){const t=r.width,n=new OffscreenCanvas(t,t),i=n.getContext("2d"),{sx:o,sy:a,sw:c,sh:u}=ra(e,r.width);return i.drawImage(r,o,a,c,u,0,0,t,t),n}const $y=`{
|
|
1122
|
+
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new ht.Box3().setFromObject(e);if(t.isEmpty())return;const i=new ht.Vector3;t.getCenter(i);const n=[new ht.Vector3(t.min.x,t.min.y,t.min.z),new ht.Vector3(t.max.x,t.max.y,t.max.z)];let o=0;n.forEach(a=>{const c=i.distanceTo(a);c>o&&(o=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:o},this.needsUpdate=!0}updateBoundingBox(e,t){this.shaderOption.minY=e,this.shaderOption.maxY=t,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)}}var q0=Object.defineProperty,ey=(r,e,t)=>e in r?q0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ii=(r,e,t)=>ey(r,typeof e!="symbol"?e+"":e,t);const ty={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class ih extends ti{constructor(e){super(e),ii(this,"_type","Model"),ii(this,"_emissive",!1),ii(this,"_emissiveIntensity",1),ii(this,"_emissiveColor","#ffffff"),ii(this,"_mixer",null),ii(this,"_currentAction",null),ii(this,"_animations",[]),ii(this,"_clock",new p.Clock),ii(this,"_autoUpdate",!0),ii(this,"_animationRequestId",null),ii(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(){if(this._position=this._coordsTransform(),this._style){if(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,!this._threeGeometry){console.error("Model load failed: model returned by _createObject is undefined"),console.error("模型加载失败:_createObject返回的model为undefined");return}this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new p.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(),this.trigger("loaded",{timestamp:_c(),targrt:this})}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return fg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const t=e.material;t&&(t.emissiveIntensity=this._emissive?this._emissiveIntensity:0,t.emissive&&t.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,t,i){this._emissive=e,t!==void 0&&(this._emissiveIntensity=t),i!==void 0&&(this._emissiveColor=i),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(t=>{t.isMesh&&t.material&&(t.castShadow=e.cast,t.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("No available animations for model"),console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const t=typeof e.name=="number"?this._animations[e.name]:this._animations.find(i=>i.name===e.name);if(!t){console.warn(`Animation not found: ${e.name}`),console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(t),this._currentAction.setLoop(e.loop?p.LoopRepeat:p.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 t;return typeof e.name=="number"?t=this._animations[e.name]:t=this._animations.find(i=>i.name===e.name),t?t.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 t=this._clock.getDelta();this._mixer.update(t)}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 t=e.feature;if(t&&Array.isArray(t._vertexPoints)&&t._vertexPoints.length>=6){const h=t.getMap?.()||this.getMap();if(h&&h.prjcenter){const d=h.prjcenter,m=t._vertexPoints,f=[];for(let g=0;g+2<m.length;g+=3){const v=m[g],w=m[g+2],b=d.x+v,x=d.z+w;f.push(new p.Vector2(b,x))}if(f.length>=3)return f}}const i=this.getMap();if(!i||!e.geometry)return null;const n=e.geometry;let o;if(n.type==="Polygon")o=n.coordinates;else if(n.type==="MultiPolygon"){if(!n.coordinates.length)return null;o=n.coordinates[0]}else return null;if(!o.length||!o[0].length)return null;const a=o[0],c=[];for(const h of a){const d=h[0],m=h[1],f=i.geo2world(new p.Vector3(d,m,0));c.push(new p.Vector2(f.x,f.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let t=null;if(e&&e.getRegionOverlays){const i=e.getRegionOverlays()||[];if(i.length){const n=i.filter(a=>(a.mode??"overlay")==="overlay").sort((a,c)=>(a.zIndex??0)-(c.zIndex??0)),o=n[n.length-1];if(o&&(o.geometry||o.feature)){const a=this._computeOverlayVertices(o);a&&a.length>=3&&(t={color:new p.Color(o.color??"#00FF88"),opacity:o.opacity??.3,vertices:a})}}}this.traverse(async i=>{if(i instanceof p.Mesh&&i.material){if(i.castShadow=!0,i.name==="building"){const n=new $0({color:new p.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new p.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new p.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new p.Color("#ffffff"),width:3,speed:5}}},regionOverlay:t||void 0}),o=new p.Box3().setFromObject(i);n.updateBoundingBox(o.min.y,o.max.y),n.setDiffusionFromObject(i),i.receiveShadow=!1,i.material=n,i.material.needsUpdate=!0}i.name==="grass"&&(i.castShadow=!1,i.receiveShadow=!0,i.material.color=new p.Color("#81e4d8ff)").multiplyScalar(.7),i.material.metalness=.2,i.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(n=>{const o=i.material[n];o&&(o.wrapS=o.wrapT=p.RepeatWrapping,o.repeat.set(.3,.3),o.needsUpdate=!0)}),i.material.normalScale=new p.Vector2(3,3))}})}}ih.mergeOptions(ty);var iy=Object.defineProperty,ny=(r,e,t)=>e in r?iy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ry=(r,e,t)=>ny(r,e+"",t);const sy={};class nh extends ti{constructor(e){super(e),ry(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 vg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}nh.mergeOptions(sy);var oy=Object.defineProperty,ay=(r,e,t)=>e in r?oy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ly=(r,e,t)=>ay(r,e+"",t);const cy={};class rh extends ti{constructor(e){super(e),ly(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){this._position=this._coordsTransform(),this._threeGeometry?(this._threeGeometry.position.copy(this._position),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)):this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return wg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return _g(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}rh.mergeOptions(cy);var hy=Object.defineProperty,uy=(r,e,t)=>e in r?hy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sh=(r,e,t)=>uy(r,typeof e!="symbol"?e+"":e,t);const dy={};class oh extends ti{constructor(e){super(e),sh(this,"_type","TPoints"),sh(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 Gg(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}oh.mergeOptions(dy);var fy=Object.defineProperty,py=(r,e,t)=>e in r?fy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ri=(r,e,t)=>py(r,typeof e!="symbol"?e+"":e,t);class Tr extends Ki(Object){constructor(e,t){super(),Ri(this,"options"),Ri(this,"map"),Ri(this,"_sprite",null),Ri(this,"_isDragging",!1),Ri(this,"_dragStartPosition",null),Ri(this,"_lastCoordinate",null),Ri(this,"_boundOnMouseMove",null),Ri(this,"_boundOnMouseUp",null),this.map=t,this.options={position:e.position,index:e.index,symbol:e.symbol??0,size:e.size??8,color:e.color??"#ffffff",opacity:e.opacity??.9,draggable:e.draggable??!0},this._createSprite(),this._boundOnMouseMove=this._onMouseMove.bind(this),this._boundOnMouseUp=this._onMouseUp.bind(this)}_createSprite(){const t=document.createElement("canvas"),i=t.getContext("2d");t.width=64,t.height=64;const n=64/2,o=64/2-2;i.clearRect(0,0,t.width,t.height),i.beginPath(),i.arc(n,n,o,0,2*Math.PI),i.fillStyle="#000000",i.fill(),i.beginPath(),i.arc(n,n,o-2,0,2*Math.PI),i.fillStyle=this.options.color,i.fill();const a=new p.CanvasTexture(t);a.needsUpdate=!0;const c=new p.SpriteMaterial({map:a,opacity:this.options.opacity,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!0});this._sprite=new p.Sprite(c),this._sprite.position.copy(this.options.position),this._sprite.renderOrder=999999;const h=new p.Vector2;this._sprite.onBeforeRender=(d,m,f)=>{if(!this._sprite||!f)return;const g=f.position.distanceTo(this._sprite.position);d.getSize(h);const v=d.getPixelRatio(),w=this.options.size*v;let b=1;if(f.isPerspectiveCamera){const x=f.fov*Math.PI/180,L=2*Math.tan(x/2)*g;b=w/h.y*L}else if(f.isOrthographicCamera){const x=f.top,L=f.bottom,M=Math.abs(x-L)/f.zoom;b=w/h.y*M}this._sprite.scale.set(b,b,1)},this._sprite._editHandle=this,this.map.viewer.scene.add(this._sprite)}updatePosition(e){this.options.position=e,this._sprite&&this._sprite.position.copy(e)}getPosition(){return this.options.position.clone()}getIndex(){return this.options.index}getSymbol(){return this.options.symbol}getSprite(){return this._sprite}intersect(e){return!this._sprite||!this.options.draggable?!1:e.intersectObject(this._sprite).length>0}startDrag(e){this.options.draggable&&(this._isDragging=!0,this._dragStartPosition=this.options.position.clone(),this._lastCoordinate=e,this.map.viewer.config("draggable",!1),this.map.on("mousemove",this._boundOnMouseMove),this.map.on("mouseup",this._boundOnMouseUp),this.trigger("dragstart",{target:this,coordinate:e,position:this.options.position.clone()}))}_onMouseMove(e){if(!this._isDragging||!this._lastCoordinate)return;const t=e.coordinate,i=t[0]-this._lastCoordinate[0],n=t[1]-this._lastCoordinate[1],o=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],o.z));this.updatePosition(a),this._lastCoordinate=t,this.trigger("dragging",{target:this,coordinate:t,position:this.options.position.clone(),offset:{dx:i,dy:n}})}_onMouseUp(e){this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp),this.trigger("dragend",{target:this,coordinate:e.coordinate,position:this.options.position.clone(),startPosition:this._dragStartPosition}),this._dragStartPosition=null,this._lastCoordinate=null)}show(){this._sprite&&(this._sprite.visible=!0)}hide(){this._sprite&&(this._sprite.visible=!1)}remove(){if(this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp)),this._sprite){this.map.viewer.scene.remove(this._sprite);const e=this._sprite.material;e.map&&e.map.dispose(),e.dispose(),this._sprite=null}this._dragStartPosition=null,this._lastCoordinate=null,this._boundOnMouseMove=null,this._boundOnMouseUp=null}}function na(r,e,t){const{currentTarget:i,clientX:n,clientY:o}=r;if(i instanceof HTMLElement){const a=i.clientWidth,c=i.clientHeight,h=new p.Vector2(n/a*2-1,-(o/c)*2+1);return e.getLocalInfoFromScreen(t,h)?.location}else return}var my=Object.defineProperty,gy=(r,e,t)=>e in r?my(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,dt=(r,e,t)=>gy(r,typeof e!="symbol"?e+"":e,t);class yy extends cs{constructor(e,t){super(e),dt(this,"options"),dt(this,"_handles",[]),dt(this,"_middleHandles",[]),dt(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),dt(this,"_editing",!1),dt(this,"_shadow",null),dt(this,"_shadowSnapshot",null),dt(this,"_updating",!1),dt(this,"_history",[]),dt(this,"_historyIndex",-1),dt(this,"_draggableOriginalState",!1),dt(this,"_boundOnMapMouseMove",null),dt(this,"_boundOnMapClick",null),dt(this,"_boundOnMapMouseDown",null),dt(this,"_boundOnFeatureDragging",null),dt(this,"_boundOnFeatureDragEnd",null),this.options={handleSize:t?.handleSize??8,handleColor:t?.handleColor??"#ffffff",showMiddleHandles:t?.showMiddleHandles??!1,maxHistorySize:t?.maxHistorySize??20,removeVertexOn:t?.removeVertexOn??"contextmenu"},this._boundOnMapMouseMove=this._onMapMouseMove.bind(this),this._boundOnMapClick=this._onMapClick.bind(this),this._boundOnMapMouseDown=this._onMapMouseDown.bind(this),this._boundOnFeatureDragging=this._onFeatureDragging.bind(this),this._boundOnFeatureDragEnd=this._onFeatureDragEnd.bind(this)}enable(){return this._editing?this:(super.enable(),this._editing=!0,this._createShadow(),this._saveSnapshot(),this._setFeatureEditingStyle(!0),this._createHandles(),this.target.trigger("editstart"),this._draggableOriginalState=this.target.options.draggable||!1,this._draggableOriginalState||(this.target.options.draggable=!0,this.target.draggable&&this.target.draggable.enable()),this)}disable(){return this._editing?(super.disable(),this._editing=!1,this._clearHandles(),this._setFeatureEditingStyle(!1),this._draggableOriginalState||(this.target.options.draggable=!1,this.target.draggable&&this.target.draggable.disable()),this._draggableOriginalState=!1,this._updateCoordFromShadow(),this._removeShadow(),this.target.trigger("editend"),this):this}addHooks(){const e=this._getMap();e&&(e.on("mousemove",this._boundOnMapMouseMove),e.on("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.addEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.on("contextmenu",this._boundOnMapClick)),this.target.on("dragging",this._boundOnFeatureDragging),this.target.on("dragend",this._boundOnFeatureDragEnd)}removeHooks(){const e=this._getMap();e&&(e.off("mousemove",this._boundOnMapMouseMove),e.off("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.removeEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.off("contextmenu",this._boundOnMapClick)),this.target.off("dragging",this._boundOnFeatureDragging),this.target.off("dragend",this._boundOnFeatureDragEnd)}isEditing(){return this._editing}_createShadow(){this._shadow=null}_removeShadow(){this._shadow&&(this._shadow=null),this._shadowSnapshot=null}_updateCoordFromShadow(e=!1){e&&!this._updating&&this.target._onPositionChanged(!0)}_saveSnapshot(){const e=this.target._geometry;this._shadowSnapshot={type:e.type,coordinates:JSON.parse(JSON.stringify(e.coordinates))},this._addHistory(e.coordinates)}_addHistory(e){this._historyIndex<this._history.length-1&&(this._history=this._history.slice(0,this._historyIndex+1)),this._history.push({coordinates:JSON.parse(JSON.stringify(e)),timestamp:Date.now()}),this._history.length>this.options.maxHistorySize?this._history.shift():this._historyIndex++}undo(){if(this._historyIndex>0){this._historyIndex--;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editundo")}return this}redo(){if(this._historyIndex<this._history.length-1){this._historyIndex++;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editredo")}return this}_restoreCoordinates(e){const t=this.target._geometry;t.coordinates=JSON.parse(JSON.stringify(e)),this.target._onPositionChanged(!0),this._updateHandlePositions()}cancel(){return this._shadowSnapshot&&this._restoreCoordinates(this._shadowSnapshot.coordinates),this.disable(),this}_createHandles(){const e=this.target._geometry,t=this._getMap();if(!t){console.warn("[FeatureEditHandler] No map found, cannot create handles");return}this.target instanceof ti?this._createPointHandles(e,t):this.target instanceof St?this._createLineStringHandles(e,t):this.target instanceof vi&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0)),o=new Tr({position:n,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);o.on("dragstart",a=>{this._onHandleDragStart(a,0)}),o.on("dragging",a=>{this._onHandleDragging(a,0)}),o.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(o)}_createLineStringHandles(e,t){const i=e.coordinates;i.forEach((n,o)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),c=new Tr({position:a,index:o,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",h=>{this._onHandleDragStart(h,o)}),c.on("dragging",h=>{this._onHandleDragging(h,o)}),c.on("dragend",h=>{this._onHandleDragEnd(h,o)}),this._handles.push(c)}),this.options.showMiddleHandles&&this._createLineStringMiddleHandles(i,t)}_onHandleDragging(e,t){this._updating=!0;const n=e.target.getPosition();if(!this._getMap())return;const a=this._fixHandlePointCoordinates(n,t),c=this.target._geometry;this.target instanceof ti?c.coordinates=[a.x,a.y,a.z]:this.target instanceof St&&(c.coordinates[t]=[a.x,a.y,a.z]),this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,coordinate:[a.x,a.y,a.z]}),this.target.trigger("editing",{index:t,coordinate:[a.x,a.y,a.z]}),this._updating=!1}_onHandleDragStart(e,t){this._updating=!0,this.target.trigger("handledragstart",{index:t,coordinate:e.coordinate})}_onHandleDragEnd(e,t){this._updating=!1;const i=this.target._geometry;this._addHistory(i.coordinates),this.target.trigger("handledragend",{index:t,coordinate:this.target instanceof ti?i.coordinates:i.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof ti?i.coordinates:i.coordinates[t]})}_createPolygonHandles(e,t){const i=e.coordinates;if(!i||!Array.isArray(i)||i.length===0){console.warn("[FeatureEditHandler] Invalid polygon coordinates");return}i.forEach((o,a)=>{if(!o||o.length<3)return;const c=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let h=0;h<c;h++){const d=o[h],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Tr({position:m,index:h,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);f._ringIndex=a,f.on("dragstart",g=>{this._onPolygonHandleDragStart(g,h,a)}),f.on("dragging",g=>{this._onPolygonHandleDragging(g,h,a)}),f.on("dragend",g=>{this._onPolygonHandleDragEnd(g,h,a)}),this._handles.push(f)}this.options.showMiddleHandles&&this._createPolygonMiddleHandles(o,a,t)})}_onPolygonHandleDragStart(e,t,i){this._updating=!0,this.target.trigger("handledragstart",{index:t,ringIndex:i,coordinate:e.coordinate})}_onPolygonHandleDragging(e,t,i){const o=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(o,t,i),d=this.target._geometry.coordinates;if(d[i]&&d[i][t]&&(d[i][t]=[c.x,c.y,c.z],t===0&&d[i].length>1)){const m=d[i].length-1;d[i][m]=[c.x,c.y,c.z]}this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]}),this.target.trigger("editing",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]})}_onPolygonHandleDragEnd(e,t,i){this._updating=!1;const n=this.target._geometry,o=n.coordinates;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:i,coordinate:o[i]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:i,coordinate:o[i]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof ti){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0));this._handles[0]&&this._handles[0].updatePosition(n)}else if(this.target instanceof St)e.coordinates.forEach((n,o)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[o]&&this._handles[o].updatePosition(a)});else if(this.target instanceof vi){const i=e.coordinates;let n=0;i.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a;c++){const h=o[c],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]||0));this._handles[n]&&this._handles[n].updatePosition(d),n++}})}}}_clearHandles(){this._handles.forEach(e=>e.remove()),this._handles=[],this._middleHandles.forEach(e=>e.remove()),this._middleHandles=[]}_onFeatureDragging(e){this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_onFeatureDragEnd(e){const t=this.target._geometry;this._addHistory(t.coordinates),this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_updateMiddleHandlePositions(){const e=this.target._geometry,t=this._getMap();if(!t)return;let i=0;if(this.target instanceof St){const n=e.coordinates;for(let o=0;o<n.length-1&&!(i>=this._middleHandles.length);o++){const a=n[o],c=n[o+1],h=[(a[0]+c[0])/2,(a[1]+c[1])/2,((a[2]||0)+(c[2]||0))/2],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]));this._middleHandles[i].updatePosition(d),i++}}else this.target instanceof vi&&e.coordinates.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a&&!(i>=this._middleHandles.length);c++){const h=(c+1)%a,d=o[c],m=o[h],f=[(d[0]+m[0])/2,(d[1]+m[1])/2,((d[2]||0)+(m[2]||0))/2],g=t.geo2world(new p.Vector3(f[0],f[1],f[2]));this._middleHandles[i].updatePosition(g),i++}})}_onMapMouseDown(e){const t=this._getMap();if(!t)return;const i=new p.Raycaster;i.params.Points={threshold:.5};const n=e,o=t.viewer.renderer.domElement,a=o.getBoundingClientRect(),c=new p.Vector2((n.clientX-a.left)/a.width*2-1,-((n.clientY-a.top)/a.height)*2+1);i.setFromCamera(c,t.viewer.camera);const h=[...this._handles,...this._middleHandles];for(const d of h)if(d.intersect(i)){const m=na({currentTarget:o,clientX:n.clientX,clientY:n.clientY},t.tilemap,t.viewer.camera);m&&(d.startDrag([m.x,m.y]),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.preventDefault&&n.preventDefault());return}}_onMapMouseMove(e){}_onMapClick(e){if(!(e.type===this.options.removeVertexOn))return;const i=this._getMap();if(!i)return;const n=new p.Raycaster;n.params.Points={threshold:.5};const o=e.originEvent;if(!o)return;const a=new p.Vector2(o.offsetX/i.viewer.renderer.domElement.clientWidth*2-1,-(o.offsetY/i.viewer.renderer.domElement.clientHeight)*2+1);n.setFromCamera(a,i.viewer.camera);for(let c=0;c<this._handles.length;c++)if(this._handles[c].intersect(n)){this._removeVertex(c),o.stopPropagation&&o.stopPropagation(),o.preventDefault&&o.preventDefault();return}}_setFeatureEditingStyle(e){const t=this.target._threeGeometry;t&&t.traverse(i=>{i.material&&(e?Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity||(n.userData._originalOpacity=n.opacity),n.opacity=Math.min(n.opacity*.6,.6),n.transparent=!0}):(i.material.userData._originalOpacity||(i.material.userData._originalOpacity=i.material.opacity),i.material.opacity=Math.min(i.material.opacity*.6,.6),i.material.transparent=!0):Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity!==void 0&&(n.opacity=n.userData._originalOpacity,delete n.userData._originalOpacity)}):i.material.userData._originalOpacity!==void 0&&(i.material.opacity=i.material.userData._originalOpacity,delete i.material.userData._originalOpacity))})}_removeVertex(e){const t=this.target._geometry,i=this._handles[e],n=i.getIndex(),o=i._ringIndex||0;let a=null;if(this.target instanceof St){const c=t.coordinates;if(c.length<=2){console.warn("[FeatureEditHandler] LineString requires at least 2 vertices");return}a=c[n],c.splice(n,1)}else if(this.target instanceof vi){const h=t.coordinates[o];if(!h)return;const d=h.length>1&&h[0][0]===h[h.length-1][0]&&h[0][1]===h[h.length-1][1],m=d?4:3;if(h.length<=m){console.warn("[FeatureEditHandler] Polygon ring requires at least 3 vertices");return}a=h[n],h.splice(n,1),d&&n===0&&h.length>0&&(h[h.length-1]=[...h[0]])}else return;this.target._onPositionChanged(!0),i.remove(),this._handles.splice(e,1),this._updateHandleIndices(),this._addHistory(t.coordinates),this.target.trigger("handleremove",{index:n,ringIndex:o,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let i=0;i<e.length-1;i++){const n=e[i],o=e[i+1],a=[(n[0]+o[0])/2,(n[1]+o[1])/2,((n[2]||0)+(o[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),h=new Tr({position:c,index:i,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},t);h.on("dragstart",d=>{this._onMiddleHandleClick(i,"LineString",0)}),this._middleHandles.push(h)}}_createPolygonMiddleHandles(e,t,i){const n=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.length-1:e.length;for(let o=0;o<n;o++){const a=(o+1)%n,c=e[o],h=e[a],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2],m=i.geo2world(new p.Vector3(d[0],d[1],d[2])),f=new Tr({position:m,index:o,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},i);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(o,"Polygon",t)}),this._middleHandles.push(f)}}_onMiddleHandleClick(e,t,i){const n=this.target._geometry;if(this._getMap()){if(t==="LineString"){const a=n.coordinates,c=a[e],h=a[e+1],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2];a.splice(e+1,0,d)}else if(t==="Polygon"){const c=n.coordinates[i];if(!c)return;const h=c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]?c.length-1:c.length,d=(e+1)%h,m=c[e],f=c[d],g=[(m[0]+f[0])/2,(m[1]+f[1])/2,((m[2]||0)+(f[2]||0))/2];c.splice(e+1,0,g),c.length>1&&c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]&&e===h-1&&(c[c.length-1]=[...c[0]])}this.target._onPositionChanged(!0),this._clearHandles(),this._createHandles(),this._addHistory(n.coordinates),this.target.trigger("vertexinsert",{index:e+1,ringIndex:i})}}_updateHandleIndices(){if(this.target instanceof St)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof vi){let e=0;this.target._geometry.coordinates.forEach((n,o)=>{const a=n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]?n.length-1:n.length;for(let c=0;c<a;c++)this._handles[e]&&(this._handles[e]._index=c,this._handles[e]._ringIndex=o),e++})}}_fixHandlePointCoordinates(e,t,i=0){const n=this._getMap();if(!n)return e;const o=this.target._geometry;let a=null;if(this.target instanceof ti)a=o.coordinates;else if(this.target instanceof St)a=o.coordinates[t];else if(this.target instanceof vi){const h=o.coordinates;h[i]&&h[i][t]&&(a=h[i][t])}if(!a||!a[2]||a[2]===0)return n.world2geo(e);const c=n.world2geo(e);return c.z=a[2],c}_getMap(){return this.target.getMap()}remove(){this.disable(),this._history=[],this._historyIndex=-1,this._shadow=null,this._shadowSnapshot=null,this._boundOnMapMouseMove=null,this._boundOnMapClick=null,this._boundOnMapMouseDown=null}}ut.prototype.startEdit=function(r){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new yy(this,r),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},ut.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},ut.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},ut.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},ut.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},ut.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function _s(r,e){if(!r||r===!0)return!0;if(!Array.isArray(r))return!!r;switch(r[0]){case"all":return r.slice(1).every(i=>_s(i,e));case"any":return r.slice(1).some(i=>_s(i,e));case"!":return!_s(r[1],e);case"==":{const i=De(r[1],e),n=De(r[2],e);return ws(i)==ws(n)}case"!=":{const i=De(r[1],e),n=De(r[2],e);return ws(i)!=ws(n)}case">":{const i=De(r[1],e),n=De(r[2],e);return ji(i)>ji(n)}case"<":{const i=De(r[1],e),n=De(r[2],e);return ji(i)<ji(n)}case">=":{const i=De(r[1],e),n=De(r[2],e);return ji(i)>=ji(n)}case"<=":{const i=De(r[1],e),n=De(r[2],e);return ji(i)<=ji(n)}case"in":{const i=De(r[1],e);return r.slice(2).map(o=>De(o,e)).includes(i)}case"!in":{const i=De(r[1],e);return!r.slice(2).map(o=>De(o,e)).includes(i)}case"has":{const i=r[1];return e!=null&&Object.prototype.hasOwnProperty.call(e,i)}case"!has":{const i=r[1];return!(e!=null&&Object.prototype.hasOwnProperty.call(e,i))}case"like":case"contains":{const i=De(r[1],e),n=De(r[2],e);return String(i).toLowerCase().includes(String(n).toLowerCase())}case"starts-with":{const i=De(r[1],e),n=De(r[2],e);return String(i).toLowerCase().startsWith(String(n).toLowerCase())}case"ends-with":{const i=De(r[1],e),n=De(r[2],e);return String(i).toLowerCase().endsWith(String(n).toLowerCase())}default:return!0}}function De(r,e){if(Array.isArray(r))switch(r[0]){case"get":return e?e[r[1]]:void 0;default:return r}return r}function ws(r){if(r==null)return null;if(typeof r=="string"){const e=Number(r);if(!isNaN(e)&&r.trim()!=="")return e}return typeof r=="boolean"?r?1:0:r}function ji(r){if(r==null)return 0;if(typeof r=="number")return r;if(typeof r=="boolean")return r?1:0;if(typeof r=="string"){const e=Number(r);return isNaN(e)?0:e}return Number(r)}var vy=Object.defineProperty,_y=(r,e,t)=>e in r?vy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kn=(r,e,t)=>_y(r,typeof e!="symbol"?e+"":e,t);class bs extends Bi{constructor(e,t){super(e,t),kn(this,"TILE_SIZE"),kn(this,"EXTENT"),kn(this,"style"),kn(this,"interactive",!1),kn(this,"_tileFeatureMap",new Map),kn(this,"_activeFeatureFilter"),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,t){const i=this.getMap(),n=`${e.z}-${e.x}-${e.y}`,o=this._tileFeatureMap.get(n);if(o&&o.length>0){o.forEach(d=>{d.visible=!0,this.children.some(m=>m&&d&&m.uuid===d.uuid)||d.addTo(this)});return}const a=t.vectorData;if(!a||!a.layers||!i||this.style.length===0)return;const c=[],h=this.style;Object.keys(a.layers).forEach(d=>{const m=a.layers[d];for(let f=0;f<m.length;f++){const g=m[f],v=g.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(g.properties))continue;let w=null;for(const b of h)if(this._evaluateFilter(b.filter,g.properties,d,g.geometry.type)){w=b.style;break}if(w){const b={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:v,extent:this.EXTENT,tileSize:this.TILE_SIZE},x=this._createFeatureInstance(g.geometry,g.geometry.type,w,{layerName:d,...g.properties});x&&(x.userData.tileData=b,x.style=Mt.create(w),x.addTo(this),x.initializeGeometry(),c.push(x))}}}),this._tileFeatureMap.set(n,c)}_evaluateFilter(e,t,i,n){if(!e||e===!0)return!0;const o={...t,$layer:i,$type:n};return _s(e,o)}hideFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&t.forEach(i=>{i.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&(t.forEach(i=>{i._remove()}),this._tileFeatureMap.delete(e))}_createFeatureInstance(e,t,i,n){const a={geometry:{ismvt:!0,...e},style:i,userData:n};switch(t){case"Point":return new Pi(a);case"LineString":return new St(a);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(t=>{t.forEach(i=>{i.material&&(i.material.opacity=e,i.material.transparent=e<1)})})}_onMapUpdate(){}updateStyle(e,t){if(!e||!Array.isArray(e)){console.warn("[VectorTileRenderLayer] updateStyle called with invalid style rules.");return}this.style=e,this._tileFeatureMap.forEach((i,n)=>{const o=t.get(n);if(!o||!o.data||!o.data.vectorData)return;const a=o.data.vectorData;i.forEach(c=>{const h=c.userData,d=c.userData.tileData?.rawCoordinates?.type;let m="";if(a&&a.layers){for(const[g,v]of Object.entries(a.layers))if(v.some(b=>b.properties===h||JSON.stringify(b.properties)===JSON.stringify(h))){m=g;break}}if(this._activeFeatureFilter&&!this._activeFeatureFilter(h)){c.visible=!1;return}let f=null;for(const g of e)if(this._evaluateFilter(g.filter,h,m,d)){f=g.style;break}f?(this._applyStyleToFeature(c,f),c.visible=!0):c.visible=!1})})}_applyStyleToFeature(e,t){e.style=Mt.create(t),e.initializeGeometry()}validateFeature(e){return e instanceof ut}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)})}}var wy=Object.defineProperty,by=(r,e,t)=>e in r?wy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Lt=(r,e,t)=>by(r,typeof e!="symbol"?e+"":e,t);class ah extends ps{constructor(e,t){super(e,t),this.layerId=e,Lt(this,"isTileLayer",!0),Lt(this,"layerType","base"),Lt(this,"isBaseLayer",!1),Lt(this,"_enabled",!0),Lt(this,"_visible",!0),Lt(this,"_rootTile"),Lt(this,"_loader"),Lt(this,"_LODThreshold",1),Lt(this,"isSceneLayer",!1),Lt(this,"opacity",1),Lt(this,"source"),Lt(this,"projection"),Lt(this,"minLevel",2),Lt(this,"maxLevel",19),this.source=t.source,this.projection=t.projection,this.minLevel=t.minLevel??2,this.maxLevel=t.maxLevel??19,this._LODThreshold=t.LODThreshold??1,this.opacity=t.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new Ni,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(t=>{t.isTile&&t.loaded&&(e=Math.max(e,t.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}}var xy=Object.defineProperty,My=(r,e,t)=>e in r?xy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sy=(r,e,t)=>My(r,e+"",t);class lh extends p.LoadingManager{constructor(){super(...arguments),Sy(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const ze={manager:new lh,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(r){ze.imgLoaderMap.set(r.dataType,r),r.info.author=r.info.author??wo.name},registerGeometryLoader(r){ze.demLoaderMap.set(r.dataType,r),r.info.author=r.info.author??wo.name},registerMeshLoader(r){ze.meshLoaderMap.set(r.dataType,r),r.info.author=r.info.author??wo.name},getMaterialLoader(r){const e=ze.imgLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getGeometryLoader(r){const e=ze.demLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getMeshLoader(r){const e=ze.meshLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`}};var Ly=Object.defineProperty,Py=(r,e,t)=>e in r?Ly(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cy=(r,e,t)=>Py(r,e+"",t);class Ty{constructor(e){Cy(this,"worker"),this.worker=e()}async run(e,t){return new Promise(i=>{this.worker.onmessage=n=>{i(n.data)},this.worker.postMessage(e,t)})}terminate(){this.worker.terminate()}}const Gy=4096,ch=Math.PI;function ra(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),o=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:o}}function sa(r,e,t,i){if(i<r.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(i<=r.maxLevel)return{url:r._getUrl(e,t,i),clipBounds:[0,0,1,1]};const n=Wy(e,t,i,r.maxLevel),o=n.parentNO;return{url:r._getUrl(o.x,o.y,o.z),clipBounds:n.bounds}}function Wy(r,e,t,i){const n=t-i,o={x:r>>n,y:e>>n,z:t-n},a=Math.pow(2,n),c=Math.pow(.5,n),h=r%a/a-.5+c/2,d=e%a/a-.5+c/2,m=new p.Vector2(h,d),f=new p.Box2().setFromCenterAndSize(m,new p.Vector2(c,c)),g=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:o,bounds:g}}function oa(r,e,t,i,n=Gy){const{x:o,y:a}=r,c=(e+o/n)/Math.pow(2,i),h=(t+a/n)/Math.pow(2,i),d=c*360-180,f=Math.atan(Math.sinh(ch*(1-2*h)))*180/ch;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Zy(r,e,t,i){if(!r||!r.coordinates)throw new Error("无效的geometry数据格式");const n={type:r.type,coordinates:null};function o(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return oa(a,e,t,i);if(Array.isArray(a)&&a.length>0){const c=a[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?a.map(h=>oa(h,e,t,i)):a.map(h=>o(h))}return a}return n.coordinates=o(r.coordinates),n}var Vy=Object.defineProperty,Iy=(r,e,t)=>e in r?Vy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xs=(r,e,t)=>Iy(r,typeof e!="symbol"?e+"":e,t);class Ms{constructor(){xs(this,"_imgSource",[]),xs(this,"_demSource"),xs(this,"_vtSource"),xs(this,"manager",ze.manager)}get imgSource(){return this._imgSource}set imgSource(e){this._imgSource=e}get demSource(){return this._demSource}set demSource(e){this._demSource=e}get vtSource(){return this._vtSource}set vtSource(e){this._vtSource=e}async load(e){const t=await this.loadGeometry(e),i=await this.loadMaterial(e);console.assert(!!i&&!!t);for(let n=0;n<i.length;n++)t.addGroup(0,1/0,n);return{materials:i,geometry:t}}unload(e){const t=e.material,i=e.geometry;for(let n=0;n<t.length;n++)t[n].dispose();i.dispose()}async loadGeometry(e){let t;if(this.demSource&&e.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,e.bounds)){const i=ze.getGeometryLoader(this.demSource),n=this.demSource;t=await i.load({source:n,...e}).catch(o=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else if(this.vtSource&&e.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,e.bounds)){const i=ze.getMeshLoader(this.vtSource),n=this.vtSource;t=await i.load({source:n,...e}).catch(o=>(console.error("Load geometry error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else t=new p.PlaneGeometry;return t}async loadMaterial(e){const i=this.imgSource.filter(n=>e.z>=n.minLevel&&this._isBoundsInSourceBounds(n,e.bounds)).map(async n=>{const o=ze.getMaterialLoader(n),a=await o.load({source:n,...e}).catch(h=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=h=>{o.unload&&o.unload(h.target),h.target.removeEventListener("dispose",c)};return a instanceof p.MeshBasicMaterial||a.addEventListener("dispose",c),a});return Promise.all(i)}_isBoundsInSourceBounds(e,t){const i=e._projectionBounds;return!(t[2]<i[0]||t[3]<i[1]||t[0]>i[2]||t[1]>i[3])}}function Gr(...r){const e=r,t=e&&e.length>1&&e[0].constructor||null;if(!t)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const i=e.reduce((a,c)=>a+c.length,0),n=new t(i);let o=0;for(const a of e)n.set(a,o),o+=a.length;return n}function hh(r,e,t,i){const n=i?Fy(i,r.position.value):Ay(e),o=n.length,a=new Float32Array(o*6),c=new Float32Array(o*4),h=new e.constructor(o*6),d=new Float32Array(o*6);for(let f=0;f<o;f++)Oy({edge:n[f],edgeIndex:f,attributes:r,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:h,newNormals:d});r.position.value=Gr(r.position.value,a),r.texcoord.value=Gr(r.texcoord.value,c),r.normal.value=Gr(r.normal.value,d);const m=Gr(e,h);return{attributes:r,indices:m}}function Ay(r){const e=[],t=Array.isArray(r)?r:Array.from(r);for(let n=0;n<t.length;n+=3){const o=t[n],a=t[n+1],c=t[n+2];e.push([o,a],[a,c],[c,o])}e.sort(([n,o],[a,c])=>{const h=Math.min(n,o),d=Math.min(a,c);return h!==d?h-d:Math.max(n,o)-Math.max(a,c)});const i=[];for(let n=0;n<e.length;n++)n+1<e.length&&e[n][0]===e[n+1][1]&&e[n][1]===e[n+1][0]?n++:i.push(e[n]);return i}function Fy(r,e){const t=(n,o)=>{n.sort(o)};t(r.westIndices,(n,o)=>e[3*n+1]-e[3*o+1]),t(r.eastIndices,(n,o)=>e[3*o+1]-e[3*n+1]),t(r.southIndices,(n,o)=>e[3*o]-e[3*n]),t(r.northIndices,(n,o)=>e[3*n]-e[3*o]);const i=[];return Object.values(r).forEach(n=>{if(n.length>1)for(let o=0;o<n.length-1;o++)i.push([n[o],n[o+1]])}),i}function Oy({edge:r,edgeIndex:e,attributes:t,skirtHeight:i,newPosition:n,newTexcoord0:o,newTriangles:a,newNormals:c}){const h=t.position.value.length,d=e*2,m=d+1;n.set(t.position.value.subarray(r[0]*3,r[0]*3+3),d*3),n[d*3+2]=n[d*3+2]-i,n.set(t.position.value.subarray(r[1]*3,r[1]*3+3),m*3),n[m*3+2]=n[m*3+2]-i,o.set(t.texcoord.value.subarray(r[0]*2,r[0]*2+2),d*2),o.set(t.texcoord.value.subarray(r[1]*2,r[1]*2+2),m*2);const f=e*2*3;a[f]=r[0],a[f+1]=h/3+m,a[f+2]=r[1],a[f+3]=h/3+m,a[f+4]=r[0],a[f+5]=h/3+d,c[f]=0,c[f+1]=0,c[f+2]=1,c[f+3]=0,c[f+4]=0,c[f+5]=1}function uh(r){if(r.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${r.length}!`);const e=Math.floor(Math.sqrt(r.length)),t=e,i=e,n=aa(i,t);return{attributes:Dy(r,i,t),indices:n}}function Dy(r,e,t){const i=t*e,n=new Float32Array(i*3),o=new Float32Array(i*2);let a=0;for(let c=0;c<e;c++)for(let h=0;h<t;h++){const d=h/(t-1),m=c/(e-1);o[a*2]=d,o[a*2+1]=m,n[a*3]=d-.5,n[a*3+1]=m-.5,n[a*3+2]=r[(e-c-1)*t+h],a++}return{position:{value:n,size:3},texcoord:{value:o,size:2},normal:{value:la(n,aa(e,t)),size:3}}}function aa(r,e){const t=6*(e-1)*(r-1),i=new Uint16Array(t);let n=0;for(let o=0;o<r-1;o++)for(let a=0;a<e-1;a++){const c=o*e+a,h=c+1,d=c+e,m=d+1,f=n*6;i[f]=c,i[f+1]=h,i[f+2]=d,i[f+3]=d,i[f+4]=h,i[f+5]=m,n++}return i}function la(r,e){const t=new Float32Array(r.length);for(let i=0;i<e.length;i+=3){const n=e[i]*3,o=e[i+1]*3,a=e[i+2]*3,c=r[n],h=r[n+1],d=r[n+2],m=r[o],f=r[o+1],g=r[o+2],v=r[a],w=r[a+1],b=r[a+2],x=m-c,L=f-h,M=g-d,C=v-c,W=w-h,z=b-d,D=L*z-M*W,X=M*C-x*z,I=x*W-L*C,K=Math.sqrt(D*D+X*X+I*I),V=[0,0,1];if(K>0){const G=1/K;V[0]=D*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[n+G]=t[o+G]=t[a+G]=V[G]}return t}var zy=Object.defineProperty,Xy=(r,e,t)=>e in r?zy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Uy=(r,e,t)=>Xy(r,e+"",t);class Kn extends p.PlaneGeometry{constructor(){super(...arguments),Uy(this,"type","TileGeometry")}setData(e,t=1e3){let i=e instanceof Float32Array?uh(e):e;i=hh(i.attributes,i.indices,t);const{attributes:n,indices:o}=i;return this.setIndex(new p.BufferAttribute(o,1)),this.setAttribute("position",new p.BufferAttribute(n.position.value,n.position.size)),this.setAttribute("uv",new p.BufferAttribute(n.texcoord.value,n.texcoord.size)),this.setAttribute("normal",new p.BufferAttribute(n.normal.value,n.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}var ky=Object.defineProperty,Ky=(r,e,t)=>e in r?ky(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ji=(r,e,t)=>Ky(r,typeof e!="symbol"?e+"":e,t);class dh{constructor(e=257){Ji(this,"gridSize"),Ji(this,"numTriangles"),Ji(this,"numParentTriangles"),Ji(this,"indices"),Ji(this,"coords"),this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let i=0;i<this.numTriangles;i++){let n=i+2,o=0,a=0,c=0,h=0,d=0,m=0;for(n&1?c=h=d=t:o=a=m=t;(n>>=1)>1;){const g=o+c>>1,v=a+h>>1;n&1?(c=o,h=a,o=d,a=m):(o=c,a=h,c=d,h=m),d=g,m=v}const f=i*4;this.coords[f+0]=o,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=h}}createTile(e){return new Ny(e,this)}}class Ny{constructor(e,t){Ji(this,"martini"),Ji(this,"terrain"),Ji(this,"errors");const i=t.gridSize;if(e.length!==i*i)throw new Error(`Expected terrain data of length ${i*i} (${i} x ${i}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:i,gridSize:n}=this.martini,{terrain:o,errors:a}=this;for(let c=e-1;c>=0;c--){const h=c*4,d=i[h+0],m=i[h+1],f=i[h+2],g=i[h+3],v=d+f>>1,w=m+g>>1,b=v+w-m,x=w+d-v,L=(o[m*n+d]+o[g*n+f])/2,M=w*n+v,C=Math.abs(L-o[M]);if(a[M]=Math.max(a[M],C),c<t){const W=(m+x>>1)*n+(d+b>>1),z=(g+x>>1)*n+(f+b>>1);a[M]=Math.max(a[M],a[W],a[z])}}}getGeometryData(e=0){const{gridSize:t,indices:i}=this.martini,{errors:n}=this;let o=0,a=0;const c=t-1;let h,d,m=0;i.fill(0);function f(M,C,W,z,D,X){const I=M+W>>1,K=C+z>>1;Math.abs(M-D)+Math.abs(C-X)>1&&n[K*t+I]>e?(f(D,X,M,C,I,K),f(W,z,D,X,I,K)):(h=C*t+M,d=z*t+W,m=X*t+D,i[h]===0&&(i[h]=++o),i[d]===0&&(i[d]=++o),i[m]===0&&(i[m]=++o),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=o*2,v=a*3,w=new Uint16Array(g),b=new Uint32Array(v);let x=0;function L(M,C,W,z,D,X){const I=M+W>>1,K=C+z>>1;if(Math.abs(M-D)+Math.abs(C-X)>1&&n[K*t+I]>e)L(D,X,M,C,I,K),L(W,z,D,X,I,K);else{const V=i[C*t+M]-1,G=i[z*t+W]-1,k=i[X*t+D]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=W,w[2*G+1]=z,w[2*k]=D,w[2*k+1]=X,b[x++]=V,b[x++]=G,b[x++]=k}}return L(0,0,c,c,c,0),L(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,w,b),indices:b}}_getMeshAttributes(e,t,i){const n=Math.floor(Math.sqrt(e.length)),o=n-1,a=t.length/2,c=new Float32Array(a*3),h=new Float32Array(a*2);for(let m=0;m<a;m++){const f=t[m*2],g=t[m*2+1],v=g*n+f;c[3*m+0]=f/o-.5,c[3*m+1]=.5-g/o,c[3*m+2]=e[v],h[2*m+0]=f/o,h[2*m+1]=1-g/o}const d=la(c,i);return{position:{value:c,size:3},texcoord:{value:h,size:2},normal:{value:d,size:3}}}}var By=Object.defineProperty,Yy=(r,e,t)=>e in r?By(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fh=(r,e,t)=>Yy(r,typeof e!="symbol"?e+"":e,t);class ca{constructor(){fh(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),fh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:o}=e,{url:a,clipBounds:c}=sa(t,i,n,o);if(!a)return new Kn;const h=await this.doLoad(a,{source:t,x:i,y:n,z:o,bounds:c});return ze.manager.parseEnd(a),h}}class ha extends p.MeshStandardMaterial{constructor(e={}){super({transparent:!0,side:p.FrontSide,...e})}setTexture(e){this.map=e,this.needsUpdate=!0}dispose(){const e=this.map;e&&(e.image instanceof ImageBitmap&&e.image.close(),e.dispose())}}var nt=(r=>(r[r.Unknown=0]="Unknown",r[r.Point=1]="Point",r[r.Linestring=2]="Linestring",r[r.Polygon=3]="Polygon",r))(nt||{});class ph{render(e,t,i,n,o=1){switch(e.lineCap="round",e.lineJoin="round",(n.shadowBlur??0)>0&&(e.shadowBlur=n.shadowBlur??2,e.shadowColor=n.shadowColor??"black",e.shadowOffsetX=n.shadowOffset?n.shadowOffset[0]:0,e.shadowOffsetY=n.shadowOffset?n.shadowOffset[1]:0),t){case nt.Point:e.textAlign="center",e.textBaseline="middle",e.font=n.font??"14px Arial",e.fillStyle=n.fontColor??"white",this._renderPointText(e,i,o,n.textField??"name",n.fontOffset??[0,-8]);break;case nt.Linestring:this._renderLineString(e,i,o);break;case nt.Polygon:this._renderPolygon(e,i,o);break;default:console.warn(`Unknown feature type: ${t}`)}(n.fill||t===nt.Point)&&(e.globalAlpha=n.fillOpacity||.5,e.fillStyle=n.fillColor||n.color||"#3388ff",e.fill(n.fillRule||"evenodd")),(n.stroke??!0)&&(n.weight??1)>0&&(e.globalAlpha=n.opacity||1,e.lineWidth=n.weight||1,e.strokeStyle=n.color||"#3388ff",e.setLineDash(n.dashArray||[]),e.stroke())}_renderPointText(e,t,i=1,n="name",o=[0,0]){const a=t.geometry;e.beginPath();for(const h of a)for(let d=0;d<h.length;d++){const m=h[d];e.arc(m.x*i,m.y*i,2,0,2*Math.PI)}const c=t.properties;c&&c[n]&&e.fillText(c[n],a[0][0].x*i+o[0],a[0][0].y*i+o[1])}_renderLineString(e,t,i){const n=t.geometry;e.beginPath();for(const o of n)for(let a=0;a<o.length;a++){const{x:c,y:h}=o[a];a===0?e.moveTo(c*i,h*i):e.lineTo(c*i,h*i)}}_renderPolygon(e,t,i){const n=t.geometry;e.beginPath();for(let o=0;o<n.length;o++){const a=n[o];for(let c=0;c<a.length;c++){const{x:h,y:d}=a[c];c===0?e.moveTo(h*i,d*i):e.lineTo(h*i,d*i)}e.closePath()}}}var Ry=Object.defineProperty,jy=(r,e,t)=>e in r?Ry(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mh=(r,e,t)=>jy(r,typeof e!="symbol"?e+"":e,t);class ua{constructor(){mh(this,"info",{version:"0.10.0",description:"Image loader base class"}),mh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:o}=e,a=new ha({}),{url:c,clipBounds:h}=sa(t,i,n,o);if(c){const d=await this.doLoad(c,{source:t,x:i,y:n,z:o,bounds:h});a.map=d,ze.manager.parseEnd(c)}return a}}var Jy=Object.defineProperty,Qy=(r,e,t)=>e in r?Jy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gh=(r,e,t)=>Qy(r,typeof e!="symbol"?e+"":e,t);class Hy{constructor(){gh(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),gh(this,"dataType","")}async load(e){const t=this._creatCanvasContext(256,256);this.drawTile(t,e);const i=new p.CanvasTexture(t.canvas.transferToImageBitmap());return new ha({transparent:!0,map:i,opacity:e.source.opacity})}_creatCanvasContext(e,t){const n=new OffscreenCanvas(e,t).getContext("2d");if(!n)throw new Error("create canvas context failed");return n.scale(1,-1),n.translate(0,-t),n}}var Ey=Object.defineProperty,$y=(r,e,t)=>e in r?Ey(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,da=(r,e,t)=>$y(r,typeof e!="symbol"?e+"":e,t);class qy extends ua{constructor(){super(...arguments),da(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),da(this,"dataType","image"),da(this,"loader",new p.ImageLoader(ze.manager))}async doLoad(e,t){const i=await this.loader.loadAsync(e).catch(a=>new Image(1,1)),n=new p.Texture;n.colorSpace=p.SRGBColorSpace;const{bounds:o}=t;return o[2]-o[0]<1?n.image=ev(i,o):n.image=i,n.needsUpdate=!0,n}}function ev(r,e){const t=r.width,i=new OffscreenCanvas(t,t),n=i.getContext("2d"),{sx:o,sy:a,sw:c,sh:h}=ra(e,r.width);return n.drawImage(r,o,a,c,h,0,0,t,t),i}const tv=`{
|
|
1102
1123
|
"name": "@terra.gl/core",
|
|
1103
|
-
"version": "0.0.1-alpha.
|
|
1124
|
+
"version": "0.0.1-alpha.63",
|
|
1104
1125
|
"type": "module",
|
|
1105
1126
|
"files": [
|
|
1106
1127
|
"dist"
|
|
@@ -1166,4 +1187,4 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1166
1187
|
"vue": "^3.5.18"
|
|
1167
1188
|
}
|
|
1168
1189
|
}
|
|
1169
|
-
`;var qy=Object.defineProperty,ev=(r,e,t)=>e in r?qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zt=(r,e,t)=>ev(r,typeof e!="symbol"?e+"":e,t);class nn{constructor(e){Zt(this,"dataType","image"),Zt(this,"attribution","isource"),Zt(this,"minLevel",0),Zt(this,"maxLevel",18),Zt(this,"projectionID","3857"),Zt(this,"url",""),Zt(this,"subdomains",[]),Zt(this,"s",""),Zt(this,"opacity",1),Zt(this,"isTMS",!1),Zt(this,"bounds",[-180,-85,180,85]),Zt(this,"_projectionBounds",[-1/0,-1/0,1/0,1/0]),Zt(this,"tileMaterial"),Object.assign(this,e)}getUrl(e,t,n){const i={...this,x:e,y:t,z:n};return tv(this.url,i)}_getUrl(e,t,n){const i=this.subdomains.length;if(i>0){const a=Math.floor(Math.random()*i);this.s=this.subdomains[a]}const o=this.isTMS?Math.pow(2,n)-1-t:t;return this.getUrl(e,o,n)}static create(e){return new nn(e)}}function tv(r,e){const t=/\{ *([\w_-]+) *\}/g;return r.replace(t,(n,i)=>{const o=e[i]??(()=>{throw new Error(`source url template error, No value provided for variable: ${n}`)})();return typeof o=="function"?o(e):o})}const{version:nv,author:iv}=JSON.parse($y);function rv(r,e=100){return new Promise(t=>{const n=setInterval(()=>{r&&(clearInterval(n),t())},e)})}function fa(r){return De.registerMaterialLoader(r),r}function pa(r){return De.registerGeometryLoader(r),r}function gu(r){return De.registerMeshLoader(r),r}fa(new Hy);const yu="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEsoayxkKXtjb25zdCB5PW5ldyBGbG9hdDMyQXJyYXkoay5sZW5ndGgpO2ZvcihsZXQgVj0wO1Y8ZC5sZW5ndGg7Vis9Myl7Y29uc3QgYT1kW1ZdKjMsZT1kW1YrMV0qMyxyPWRbVisyXSozLHM9a1thXSx0PWtbYSsxXSxuPWtbYSsyXSxoPWtbZV0saT1rW2UrMV0sbz1rW2UrMl0sYz1rW3JdLHU9a1tyKzFdLG09a1tyKzJdLHc9aC1zLGw9aS10LGY9by1uLGc9Yy1zLE09dS10LEQ9bS1uLHA9bCpELWYqTSxVPWYqZy13KkQsST13Kk0tbCpnLHo9TWF0aC5zcXJ0KHAqcCtVKlUrSSpJKSx4PVswLDAsMV07aWYoej4wKXtjb25zdCB2PTEvejt4WzBdPXAqdix4WzFdPVUqdix4WzJdPUkqdn1mb3IobGV0IHY9MDt2PDM7disrKXlbYSt2XT15W2Urdl09eVtyK3ZdPXhbdl19cmV0dXJuIHl9dmFyIFc9T2JqZWN0LmRlZmluZVByb3BlcnR5LFA9K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aC5mbG9vcihrWzFdKmQpLGE9TWF0aC5mbG9vcigoa1syXS1rWzBdKSpkKSxlPU1hdGguZmxvb3IoKGtbM10ta1sxXSkqZCk7cmV0dXJue3N4Onksc3k6VixzdzphLHNoOmV9fXNlbGYub25tZXNzYWdlPWs9Pntjb25zdCBkPWsuZGF0YSx5PW9lKGQuZGVtRGF0YSxkLnosZC5jbGlwQm91bmRzKTtzZWxmLnBvc3RNZXNzYWdlKHkpfX0pKCk7Cg==",sv=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),vu=typeof self<"u"&&self.Blob&&new Blob([sv(yu)],{type:"text/javascript;charset=utf-8"});function ov(r){let e;try{if(e=vu&&(self.URL||self.webkitURL).createObjectURL(vu),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+yu,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const av=function(){var r={};r.defaultNoDataValue=-34027999387901484e22,r.decode=function(a,c){c=c||{};var u=c.encodedMaskData||c.encodedMaskData===null,d=i(a,c.inputOffset||0,u),m=c.noDataValue!==null?c.noDataValue:r.defaultNoDataValue,f=e(d,c.pixelType||Float32Array,c.encodedMaskData,m,c.returnMask),g={width:d.width,height:d.height,pixelData:f.resultPixels,minValue:f.minValue,maxValue:d.pixels.maxValue,noDataValue:m};return f.resultMask&&(g.maskData=f.resultMask),c.returnEncodedMask&&d.mask&&(g.encodedMaskData=d.mask.bitset?d.mask.bitset:null),c.returnFileInfo&&(g.fileInfo=t(d),c.computeUsedBitDepths&&(g.fileInfo.bitDepths=n(d))),g};var e=function(a,c,u,d,m){var f=0,g=a.pixels.numBlocksX,v=a.pixels.numBlocksY,w=Math.floor(a.width/g),b=Math.floor(a.height/v),x=2*a.maxZError,L=Number.MAX_VALUE,M;u=u||(a.mask?a.mask.bitset:null);var C,W;C=new c(a.width*a.height),m&&u&&(W=new Uint8Array(a.width*a.height));for(var z=new Float32Array(w*b),D,X,I=0;I<=v;I++){var K=I!==v?b:a.height%v;if(K!==0)for(var V=0;V<=g;V++){var G=V!==g?w:a.width%g;if(G!==0){var k=I*a.width*b+V*w,j=a.width-G,Y=a.pixels.blocks[f],H,Q,re;Y.encoding<2?(Y.encoding===0?H=Y.rawData:(o(Y.stuffedData,Y.bitsPerPixel,Y.numValidPixels,Y.offset,x,z,a.pixels.maxValue),H=z),Q=0):Y.encoding===2?re=0:re=Y.offset;var ie;if(u)for(X=0;X<K;X++){for(k&7&&(ie=u[k>>3],ie<<=k&7),D=0;D<G;D++)k&7||(ie=u[k>>3]),ie&128?(W&&(W[k]=1),M=Y.encoding<2?H[Q++]:re,L=L>M?M:L,C[k++]=M):(W&&(W[k]=0),C[k++]=d),ie<<=1;k+=j}else if(Y.encoding<2)for(X=0;X<K;X++){for(D=0;D<G;D++)M=H[Q++],L=L>M?M:L,C[k++]=M;k+=j}else for(L=L>re?re:L,X=0;X<K;X++){for(D=0;D<G;D++)C[k++]=re;k+=j}if(Y.encoding===1&&Q!==Y.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:C,resultMask:W,minValue:L}},t=function(a){return{fileIdentifierString:a.fileIdentifierString,fileVersion:a.fileVersion,imageType:a.imageType,height:a.height,width:a.width,maxZError:a.maxZError,eofOffset:a.eofOffset,mask:a.mask?{numBlocksX:a.mask.numBlocksX,numBlocksY:a.mask.numBlocksY,numBytes:a.mask.numBytes,maxValue:a.mask.maxValue}:null,pixels:{numBlocksX:a.pixels.numBlocksX,numBlocksY:a.pixels.numBlocksY,numBytes:a.pixels.numBytes,maxValue:a.pixels.maxValue,noDataValue:a.noDataValue}}},n=function(a){for(var c=a.pixels.numBlocksX*a.pixels.numBlocksY,u={},d=0;d<c;d++){var m=a.pixels.blocks[d];m.encoding===0?u.float32=!0:m.encoding===1?u[m.bitsPerPixel]=!0:u[0]=!0}return Object.keys(u)},i=function(a,c,u){var d={},m=new Uint8Array(a,c,10);if(d.fileIdentifierString=String.fromCharCode.apply(null,m),d.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+d.fileIdentifierString;c+=10;var f=new DataView(a,c,24);if(d.fileVersion=f.getInt32(0,!0),d.imageType=f.getInt32(4,!0),d.height=f.getUint32(8,!0),d.width=f.getUint32(12,!0),d.maxZError=f.getFloat64(16,!0),c+=24,!u)if(f=new DataView(a,c,16),d.mask={},d.mask.numBlocksY=f.getUint32(0,!0),d.mask.numBlocksX=f.getUint32(4,!0),d.mask.numBytes=f.getUint32(8,!0),d.mask.maxValue=f.getFloat32(12,!0),c+=16,d.mask.numBytes>0){var g=new Uint8Array(Math.ceil(d.width*d.height/8));f=new DataView(a,c,d.mask.numBytes);var v=f.getInt16(0,!0),w=2,b=0;do{if(v>0)for(;v--;)g[b++]=f.getUint8(w++);else{var x=f.getUint8(w++);for(v=-v;v--;)g[b++]=x}v=f.getInt16(w,!0),w+=2}while(w<d.mask.numBytes);if(v!==-32768||b<g.length)throw"Unexpected end of mask RLE encoding";d.mask.bitset=g,c+=d.mask.numBytes}else d.mask.numBytes|d.mask.numBlocksY|d.mask.maxValue||(d.mask.bitset=new Uint8Array(Math.ceil(d.width*d.height/8)));f=new DataView(a,c,16),d.pixels={},d.pixels.numBlocksY=f.getUint32(0,!0),d.pixels.numBlocksX=f.getUint32(4,!0),d.pixels.numBytes=f.getUint32(8,!0),d.pixels.maxValue=f.getFloat32(12,!0),c+=16;var L=d.pixels.numBlocksX,M=d.pixels.numBlocksY,C=L+(d.width%L>0?1:0),W=M+(d.height%M>0?1:0);d.pixels.blocks=new Array(C*W);for(var z=0,D=0;D<W;D++)for(var X=0;X<C;X++){var I=0,K=a.byteLength-c;f=new DataView(a,c,Math.min(10,K));var V={};d.pixels.blocks[z++]=V;var G=f.getUint8(0);if(I++,V.encoding=G&63,V.encoding>3)throw"Invalid block encoding ("+V.encoding+")";if(V.encoding===2){c++;continue}if(G!==0&&G!==2){if(G>>=6,V.offsetType=G,G===2)V.offset=f.getInt8(1),I++;else if(G===1)V.offset=f.getInt16(1,!0),I+=2;else if(G===0)V.offset=f.getFloat32(1,!0),I+=4;else throw"Invalid block offset type";if(V.encoding===1)if(G=f.getUint8(I),I++,V.bitsPerPixel=G&63,G>>=6,V.numValidPixelsType=G,G===2)V.numValidPixels=f.getUint8(I),I++;else if(G===1)V.numValidPixels=f.getUint16(I,!0),I+=2;else if(G===0)V.numValidPixels=f.getUint32(I,!0),I+=4;else throw"Invalid valid pixel count type"}if(c+=I,V.encoding!==3){var k,j;if(V.encoding===0){var Y=(d.pixels.numBytes-1)/4;if(Y!==Math.floor(Y))throw"uncompressed block has invalid length";k=new ArrayBuffer(Y*4),j=new Uint8Array(k),j.set(new Uint8Array(a,c,Y*4));var H=new Float32Array(k);V.rawData=H,c+=Y*4}else if(V.encoding===1){var Q=Math.ceil(V.numValidPixels*V.bitsPerPixel/8),re=Math.ceil(Q/4);k=new ArrayBuffer(re*4),j=new Uint8Array(k),j.set(new Uint8Array(a,c,Q)),V.stuffedData=new Uint32Array(k),c+=Q}}}return d.eofOffset=c,d},o=function(a,c,u,d,m,f,g){var v=(1<<c)-1,w=0,b,x=0,L,M,C=Math.ceil((g-d)/m),W=a.length*4-Math.ceil(c*u/8);for(a[a.length-1]<<=8*W,b=0;b<u;b++){if(x===0&&(M=a[w++],x=32),x>=c)L=M>>>x-c&v,x-=c;else{var z=c-x;L=(M&v)<<z&v,M=a[w++],x=32-z,L+=M>>>x}f[b]=L<C?d+L*m:g}return f};return r}(),lv=function(){var r={unstuff:function(i,o,a,c,u,d,m,f){var g=(1<<a)-1,v=0,w,b=0,x,L,M,C,W=i.length*4-Math.ceil(a*c/8);if(i[i.length-1]<<=8*W,u)for(w=0;w<c;w++)b===0&&(L=i[v++],b=32),b>=a?(x=L>>>b-a&g,b-=a):(M=a-b,x=(L&g)<<M&g,L=i[v++],b=32-M,x+=L>>>b),o[w]=u[x];else for(C=Math.ceil((f-d)/m),w=0;w<c;w++)b===0&&(L=i[v++],b=32),b>=a?(x=L>>>b-a&g,b-=a):(M=a-b,x=(L&g)<<M&g,L=i[v++],b=32-M,x+=L>>>b),o[w]=x<C?d+x*m:f},unstuffLUT:function(i,o,a,c,u,d){var m=(1<<o)-1,f=0,g=0,v=0,w=0,b=0,x,L=[],M=i.length*4-Math.ceil(o*a/8);i[i.length-1]<<=8*M;var C=Math.ceil((d-c)/u);for(g=0;g<a;g++)w===0&&(x=i[f++],w=32),w>=o?(b=x>>>w-o&m,w-=o):(v=o-w,b=(x&m)<<v&m,x=i[f++],w=32-v,b+=x>>>w),L[g]=b<C?c+b*u:d;return L.unshift(c),L},unstuff2:function(i,o,a,c,u,d,m,f){var g=(1<<a)-1,v=0,w,b=0,x=0,L,M,C;if(u)for(w=0;w<c;w++)b===0&&(M=i[v++],b=32,x=0),b>=a?(L=M>>>x&g,b-=a,x+=a):(C=a-b,L=M>>>x&g,M=i[v++],b=32-C,L|=(M&(1<<C)-1)<<a-C,x=C),o[w]=u[L];else{var W=Math.ceil((f-d)/m);for(w=0;w<c;w++)b===0&&(M=i[v++],b=32,x=0),b>=a?(L=M>>>x&g,b-=a,x+=a):(C=a-b,L=M>>>x&g,M=i[v++],b=32-C,L|=(M&(1<<C)-1)<<a-C,x=C),o[w]=L<W?d+L*m:f}return o},unstuffLUT2:function(i,o,a,c,u,d){var m=(1<<o)-1,f=0,g=0,v=0,w=0,b=0,x=0,L,M=[],C=Math.ceil((d-c)/u);for(g=0;g<a;g++)w===0&&(L=i[f++],w=32,x=0),w>=o?(b=L>>>x&m,w-=o,x+=o):(v=o-w,b=L>>>x&m,L=i[f++],w=32-v,b|=(L&(1<<v)-1)<<o-v,x=v),M[g]=b<C?c+b*u:d;return M.unshift(c),M},originalUnstuff:function(i,o,a,c){var u=(1<<a)-1,d=0,m,f=0,g,v,w,b=i.length*4-Math.ceil(a*c/8);for(i[i.length-1]<<=8*b,m=0;m<c;m++)f===0&&(v=i[d++],f=32),f>=a?(g=v>>>f-a&u,f-=a):(w=a-f,g=(v&u)<<w&u,v=i[d++],f=32-w,g+=v>>>f),o[m]=g;return o},originalUnstuff2:function(i,o,a,c){var u=(1<<a)-1,d=0,m,f=0,g=0,v,w,b;for(m=0;m<c;m++)f===0&&(w=i[d++],f=32,g=0),f>=a?(v=w>>>g&u,f-=a,g+=a):(b=a-f,v=w>>>g&u,w=i[d++],f=32-b,v|=(w&(1<<b)-1)<<a-b,g=b),o[m]=v;return o}},e={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(i){for(var o=65535,a=65535,c=i.length,u=Math.floor(c/2),d=0;u;){var m=u>=359?359:u;u-=m;do o+=i[d++]<<8,a+=o+=i[d++];while(--m);o=(o&65535)+(o>>>16),a=(a&65535)+(a>>>16)}return c&1&&(a+=o+=i[d]<<8),o=(o&65535)+(o>>>16),a=(a&65535)+(a>>>16),(a<<16|o)>>>0},readHeaderInfo:function(i,o){var a=o.ptr,c=new Uint8Array(i,a,6),u={};if(u.fileIdentifierString=String.fromCharCode.apply(null,c),u.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+u.fileIdentifierString;a+=6;var d=new DataView(i,a,8),m=d.getInt32(0,!0);u.fileVersion=m,a+=4,m>=3&&(u.checksum=d.getUint32(4,!0),a+=4),d=new DataView(i,a,12),u.height=d.getUint32(0,!0),u.width=d.getUint32(4,!0),a+=8,m>=4?(u.numDims=d.getUint32(8,!0),a+=4):u.numDims=1,d=new DataView(i,a,40),u.numValidPixel=d.getUint32(0,!0),u.microBlockSize=d.getInt32(4,!0),u.blobSize=d.getInt32(8,!0),u.imageType=d.getInt32(12,!0),u.maxZError=d.getFloat64(16,!0),u.zMin=d.getFloat64(24,!0),u.zMax=d.getFloat64(32,!0),a+=40,o.headerInfo=u,o.ptr=a;var f,g;if(m>=3&&(g=m>=4?52:48,f=this.computeChecksumFletcher32(new Uint8Array(i,a-g,u.blobSize-14)),f!==u.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(i,o){var a=o.headerInfo,c=this.getDataTypeArray(a.imageType),u=a.numDims*this.getDataTypeSize(a.imageType),d=this.readSubArray(i,o.ptr,c,u),m=this.readSubArray(i,o.ptr+u,c,u);o.ptr+=2*u;var f,g=!0;for(f=0;f<a.numDims;f++)if(d[f]!==m[f]){g=!1;break}return a.minValues=d,a.maxValues=m,g},readSubArray:function(i,o,a,c){var u;if(a===Uint8Array)u=new Uint8Array(i,o,c);else{var d=new ArrayBuffer(c),m=new Uint8Array(d);m.set(new Uint8Array(i,o,c)),u=new a(d)}return u},readMask:function(i,o){var a=o.ptr,c=o.headerInfo,u=c.width*c.height,d=c.numValidPixel,m=new DataView(i,a,4),f={};if(f.numBytes=m.getUint32(0,!0),a+=4,(d===0||u===d)&&f.numBytes!==0)throw"invalid mask";var g,v;if(d===0)g=new Uint8Array(Math.ceil(u/8)),f.bitset=g,v=new Uint8Array(u),o.pixels.resultMask=v,a+=f.numBytes;else if(f.numBytes>0){g=new Uint8Array(Math.ceil(u/8)),m=new DataView(i,a,f.numBytes);var w=m.getInt16(0,!0),b=2,x=0,L=0;do{if(w>0)for(;w--;)g[x++]=m.getUint8(b++);else for(L=m.getUint8(b++),w=-w;w--;)g[x++]=L;w=m.getInt16(b,!0),b+=2}while(b<f.numBytes);if(w!==-32768||x<g.length)throw"Unexpected end of mask RLE encoding";v=new Uint8Array(u);var M=0,C=0;for(C=0;C<u;C++)C&7?(M=g[C>>3],M<<=C&7):M=g[C>>3],M&128&&(v[C]=1);o.pixels.resultMask=v,f.bitset=g,a+=f.numBytes}return o.ptr=a,o.mask=f,!0},readDataOneSweep:function(i,o,a,c){var u=o.ptr,d=o.headerInfo,m=d.numDims,f=d.width*d.height,g=d.imageType,v=d.numValidPixel*e.getDataTypeSize(g)*m,w,b=o.pixels.resultMask;if(a===Uint8Array)w=new Uint8Array(i,u,v);else{var x=new ArrayBuffer(v),L=new Uint8Array(x);L.set(new Uint8Array(i,u,v)),w=new a(x)}if(w.length===f*m)c?o.pixels.resultPixels=e.swapDimensionOrder(w,f,m,a,!0):o.pixels.resultPixels=w;else{o.pixels.resultPixels=new a(f*m);var M=0,C=0,W=0,z=0;if(m>1){if(c){for(C=0;C<f;C++)if(b[C])for(z=C,W=0;W<m;W++,z+=f)o.pixels.resultPixels[z]=w[M++]}else for(C=0;C<f;C++)if(b[C])for(z=C*m,W=0;W<m;W++)o.pixels.resultPixels[z+W]=w[M++]}else for(C=0;C<f;C++)b[C]&&(o.pixels.resultPixels[C]=w[M++])}return u+=v,o.ptr=u,!0},readHuffmanTree:function(i,o){var a=this.HUFFMAN_LUT_BITS_MAX,c=new DataView(i,o.ptr,16);o.ptr+=16;var u=c.getInt32(0,!0);if(u<2)throw"unsupported Huffman version";var d=c.getInt32(4,!0),m=c.getInt32(8,!0),f=c.getInt32(12,!0);if(m>=f)return!1;var g=new Uint32Array(f-m);e.decodeBits(i,o,g);var v=[],w,b,x,L;for(w=m;w<f;w++)b=w-(w<d?0:d),v[b]={first:g[w-m],second:null};var M=i.byteLength-o.ptr,C=Math.ceil(M/4),W=new ArrayBuffer(C*4),z=new Uint8Array(W);z.set(new Uint8Array(i,o.ptr,M));var D=new Uint32Array(W),X=0,I,K=0;for(I=D[0],w=m;w<f;w++)b=w-(w<d?0:d),L=v[b].first,L>0&&(v[b].second=I<<X>>>32-L,32-X>=L?(X+=L,X===32&&(X=0,K++,I=D[K])):(X+=L-32,K++,I=D[K],v[b].second|=I>>>32-X));var V=0,G=0,k=new t;for(w=0;w<v.length;w++)v[w]!==void 0&&(V=Math.max(V,v[w].first));V>=a?G=a:G=V;var j=[],Y,H,Q,re,ie,le;for(w=m;w<f;w++)if(b=w-(w<d?0:d),L=v[b].first,L>0)if(Y=[L,b],L<=G)for(H=v[b].second<<G-L,Q=1<<G-L,x=0;x<Q;x++)j[H|x]=Y;else for(H=v[b].second,le=k,re=L-1;re>=0;re--)ie=H>>>re&1,ie?(le.right||(le.right=new t),le=le.right):(le.left||(le.left=new t),le=le.left),re===0&&!le.val&&(le.val=Y[1]);return{decodeLut:j,numBitsLUTQick:G,numBitsLUT:V,tree:k,stuffedData:D,srcPtr:K,bitPos:X}},readHuffman:function(i,o,a,c){var u=o.headerInfo,d=u.numDims,m=o.headerInfo.height,f=o.headerInfo.width,g=f*m,v=this.readHuffmanTree(i,o),w=v.decodeLut,b=v.tree,x=v.stuffedData,L=v.srcPtr,M=v.bitPos,C=v.numBitsLUTQick,W=v.numBitsLUT,z=o.headerInfo.imageType===0?128:0,D,X,I,K=o.pixels.resultMask,V,G,k,j,Y,H,Q,re=0;M>0&&(L++,M=0);var ie=x[L],le=o.encodeMode===1,de=new a(g*d),ge=de,fe;if(d<2||le){for(fe=0;fe<d;fe++)if(d>1&&(ge=new a(de.buffer,g*fe,g),re=0),o.headerInfo.numValidPixel===f*m)for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++,H++){if(X=0,V=ie<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ie<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),D=b,Q=0;Q<W;Q++)if(k=V>>>W-Q-1&1,D=k?D.right:D.left,!(D.left||D.right)){X=D.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ie=x[L]),I=X-z,le?(Y>0?I+=re:j>0?I+=ge[H-f]:I+=re,I&=255,ge[H]=I,re=I):ge[H]=I}else for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++,H++)if(K[H]){if(X=0,V=ie<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ie<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),D=b,Q=0;Q<W;Q++)if(k=V>>>W-Q-1&1,D=k?D.right:D.left,!(D.left||D.right)){X=D.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ie=x[L]),I=X-z,le?(Y>0&&K[H-1]?I+=re:j>0&&K[H-f]?I+=ge[H-f]:I+=re,I&=255,ge[H]=I,re=I):ge[H]=I}}else for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++)if(H=j*f+Y,!K||K[H])for(fe=0;fe<d;fe++,H+=g){if(X=0,V=ie<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ie<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),D=b,Q=0;Q<W;Q++)if(k=V>>>W-Q-1&1,D=k?D.right:D.left,!(D.left||D.right)){X=D.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ie=x[L]),I=X-z,ge[H]=I}o.ptr=o.ptr+(L+1)*4+(M>0?4:0),o.pixels.resultPixels=de,d>1&&!c&&(o.pixels.resultPixels=e.swapDimensionOrder(de,g,d,a))},decodeBits:function(i,o,a,c,u){{var d=o.headerInfo,m=d.fileVersion,f=0,g=i.byteLength-o.ptr>=5?5:i.byteLength-o.ptr,v=new DataView(i,o.ptr,g),w=v.getUint8(0);f++;var b=w>>6,x=b===0?4:3-b,L=(w&32)>0,M=w&31,C=0;if(x===1)C=v.getUint8(f),f++;else if(x===2)C=v.getUint16(f,!0),f+=2;else if(x===4)C=v.getUint32(f,!0),f+=4;else throw"Invalid valid pixel count type";var W=2*d.maxZError,z,D,X,I,K,V,G,k,j,Y=d.numDims>1?d.maxValues[u]:d.zMax;if(L){for(o.counter.lut++,k=v.getUint8(f),f++,I=Math.ceil((k-1)*M/8),K=Math.ceil(I/4),D=new ArrayBuffer(K*4),X=new Uint8Array(D),o.ptr+=f,X.set(new Uint8Array(i,o.ptr,I)),G=new Uint32Array(D),o.ptr+=I,j=0;k-1>>>j;)j++;I=Math.ceil(C*j/8),K=Math.ceil(I/4),D=new ArrayBuffer(K*4),X=new Uint8Array(D),X.set(new Uint8Array(i,o.ptr,I)),z=new Uint32Array(D),o.ptr+=I,m>=3?V=r.unstuffLUT2(G,M,k-1,c,W,Y):V=r.unstuffLUT(G,M,k-1,c,W,Y),m>=3?r.unstuff2(z,a,j,C,V):r.unstuff(z,a,j,C,V)}else o.counter.bitstuffer++,j=M,o.ptr+=f,j>0&&(I=Math.ceil(C*j/8),K=Math.ceil(I/4),D=new ArrayBuffer(K*4),X=new Uint8Array(D),X.set(new Uint8Array(i,o.ptr,I)),z=new Uint32Array(D),o.ptr+=I,m>=3?c==null?r.originalUnstuff2(z,a,j,C):r.unstuff2(z,a,j,C,!1,c,W,Y):c==null?r.originalUnstuff(z,a,j,C):r.unstuff(z,a,j,C,!1,c,W,Y))}},readTiles:function(i,o,a,c){var u=o.headerInfo,d=u.width,m=u.height,f=d*m,g=u.microBlockSize,v=u.imageType,w=e.getDataTypeSize(v),b=Math.ceil(d/g),x=Math.ceil(m/g);o.pixels.numBlocksY=x,o.pixels.numBlocksX=b,o.pixels.ptr=0;var L=0,M=0,C=0,W=0,z=0,D=0,X=0,I=0,K=0,V=0,G=0,k=0,j=0,Y=0,H=0,Q=0,re,ie,le,de,ge,fe,Se=new a(g*g),it=m%g||g,rt=d%g||g,dt,Qe,Ye=u.numDims,Re,st=o.pixels.resultMask,ze=o.pixels.resultPixels,Vt=u.fileVersion,Nt=Vt>=5?14:15,Ce,ot=u.zMax,ft;for(C=0;C<x;C++)for(z=C!==x-1?g:it,W=0;W<b;W++)for(D=W!==b-1?g:rt,G=C*d*g+W*g,k=d-D,Re=0;Re<Ye;Re++){if(Ye>1?(ft=ze,G=C*d*g+W*g,ze=new a(o.pixels.resultPixels.buffer,f*Re*w,f),ot=u.maxValues[Re]):ft=null,X=i.byteLength-o.ptr,re=new DataView(i,o.ptr,Math.min(10,X)),ie={},Q=0,I=re.getUint8(0),Q++,Ce=u.fileVersion>=5?I&4:0,K=I>>6&255,V=I>>2&Nt,V!==(W*g>>3&Nt)||Ce&&Re===0)throw"integrity issue";if(fe=I&3,fe>3)throw o.ptr+=Q,"Invalid block encoding ("+fe+")";if(fe===2){if(Ce)if(st)for(L=0;L<z;L++)for(M=0;M<D;M++)st[G]&&(ze[G]=ft[G]),G++;else for(L=0;L<z;L++)for(M=0;M<D;M++)ze[G]=ft[G],G++;o.counter.constant++,o.ptr+=Q;continue}else if(fe===0){if(Ce)throw"integrity issue";if(o.counter.uncompressed++,o.ptr+=Q,j=z*D*w,Y=i.byteLength-o.ptr,j=j<Y?j:Y,le=new ArrayBuffer(j%w===0?j:j+w-j%w),de=new Uint8Array(le),de.set(new Uint8Array(i,o.ptr,j)),ge=new a(le),H=0,st)for(L=0;L<z;L++){for(M=0;M<D;M++)st[G]&&(ze[G]=ge[H++]),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)ze[G++]=ge[H++];G+=k}o.ptr+=H*w}else if(dt=e.getDataTypeUsed(Ce&&v<6?4:v,K),Qe=e.getOnePixel(ie,Q,dt,re),Q+=e.getDataTypeSize(dt),fe===3)if(o.ptr+=Q,o.counter.constantoffset++,st)for(L=0;L<z;L++){for(M=0;M<D;M++)st[G]&&(ze[G]=Ce?Math.min(ot,ft[G]+Qe):Qe),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)ze[G]=Ce?Math.min(ot,ft[G]+Qe):Qe,G++;G+=k}else if(o.ptr+=Q,e.decodeBits(i,o,Se,Qe,Re),Q=0,Ce)if(st)for(L=0;L<z;L++){for(M=0;M<D;M++)st[G]&&(ze[G]=Se[Q++]+ft[G]),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)ze[G]=Se[Q++]+ft[G],G++;G+=k}else if(st)for(L=0;L<z;L++){for(M=0;M<D;M++)st[G]&&(ze[G]=Se[Q++]),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)ze[G++]=Se[Q++];G+=k}}Ye>1&&!c&&(o.pixels.resultPixels=e.swapDimensionOrder(o.pixels.resultPixels,f,Ye,a))},formatFileInfo:function(i){return{fileIdentifierString:i.headerInfo.fileIdentifierString,fileVersion:i.headerInfo.fileVersion,imageType:i.headerInfo.imageType,height:i.headerInfo.height,width:i.headerInfo.width,numValidPixel:i.headerInfo.numValidPixel,microBlockSize:i.headerInfo.microBlockSize,blobSize:i.headerInfo.blobSize,maxZError:i.headerInfo.maxZError,pixelType:e.getPixelType(i.headerInfo.imageType),eofOffset:i.eofOffset,mask:i.mask?{numBytes:i.mask.numBytes}:null,pixels:{numBlocksX:i.pixels.numBlocksX,numBlocksY:i.pixels.numBlocksY,maxValue:i.headerInfo.zMax,minValue:i.headerInfo.zMin,noDataValue:i.noDataValue}}},constructConstantSurface:function(i,o){var a=i.headerInfo.zMax,c=i.headerInfo.zMin,u=i.headerInfo.maxValues,d=i.headerInfo.numDims,m=i.headerInfo.height*i.headerInfo.width,f=0,g=0,v=0,w=i.pixels.resultMask,b=i.pixels.resultPixels;if(w)if(d>1){if(o)for(f=0;f<d;f++)for(v=f*m,a=u[f],g=0;g<m;g++)w[g]&&(b[v+g]=a);else for(g=0;g<m;g++)if(w[g])for(v=g*d,f=0;f<d;f++)b[v+d]=u[f]}else for(g=0;g<m;g++)w[g]&&(b[g]=a);else if(d>1&&c!==a)if(o)for(f=0;f<d;f++)for(v=f*m,a=u[f],g=0;g<m;g++)b[v+g]=a;else for(g=0;g<m;g++)for(v=g*d,f=0;f<d;f++)b[v+f]=u[f];else for(g=0;g<m*d;g++)b[g]=a},getDataTypeArray:function(i){var o;switch(i){case 0:o=Int8Array;break;case 1:o=Uint8Array;break;case 2:o=Int16Array;break;case 3:o=Uint16Array;break;case 4:o=Int32Array;break;case 5:o=Uint32Array;break;case 6:o=Float32Array;break;case 7:o=Float64Array;break;default:o=Float32Array}return o},getPixelType:function(i){var o;switch(i){case 0:o="S8";break;case 1:o="U8";break;case 2:o="S16";break;case 3:o="U16";break;case 4:o="S32";break;case 5:o="U32";break;case 6:o="F32";break;case 7:o="F64";break;default:o="F32"}return o},isValidPixelValue:function(i,o){if(o==null)return!1;var a;switch(i){case 0:a=o>=-128&&o<=127;break;case 1:a=o>=0&&o<=255;break;case 2:a=o>=-32768&&o<=32767;break;case 3:a=o>=0&&o<=65536;break;case 4:a=o>=-2147483648&&o<=2147483647;break;case 5:a=o>=0&&o<=4294967296;break;case 6:a=o>=-34027999387901484e22&&o<=34027999387901484e22;break;case 7:a=o>=-17976931348623157e292&&o<=17976931348623157e292;break;default:a=!1}return a},getDataTypeSize:function(i){var o=0;switch(i){case 0:case 1:o=1;break;case 2:case 3:o=2;break;case 4:case 5:case 6:o=4;break;case 7:o=8;break;default:o=i}return o},getDataTypeUsed:function(i,o){var a=i;switch(i){case 2:case 4:a=i-o;break;case 3:case 5:a=i-2*o;break;case 6:o===0?a=i:o===1?a=2:a=1;break;case 7:o===0?a=i:a=i-2*o+1;break;default:a=i;break}return a},getOnePixel:function(i,o,a,c){var u=0;switch(a){case 0:u=c.getInt8(o);break;case 1:u=c.getUint8(o);break;case 2:u=c.getInt16(o,!0);break;case 3:u=c.getUint16(o,!0);break;case 4:u=c.getInt32(o,!0);break;case 5:u=c.getUInt32(o,!0);break;case 6:u=c.getFloat32(o,!0);break;case 7:u=c.getFloat64(o,!0);break;default:throw"the decoder does not understand this pixel type"}return u},swapDimensionOrder:function(i,o,a,c,u){var d=0,m=0,f=0,g=0,v=i;if(a>1)if(v=new c(o*a),u)for(d=0;d<o;d++)for(g=d,f=0;f<a;f++,g+=o)v[g]=i[m++];else for(d=0;d<o;d++)for(g=d,f=0;f<a;f++,g+=o)v[m++]=i[g];return v}},t=function(i,o,a){this.val=i,this.left=o,this.right=a},n={decode:function(i,o){o=o||{};var a=o.noDataValue,c=0,u={};if(u.ptr=o.inputOffset||0,u.pixels={},!!e.readHeaderInfo(i,u)){var d=u.headerInfo,m=d.fileVersion,f=e.getDataTypeArray(d.imageType);if(m>5)throw"unsupported lerc version 2."+m;e.readMask(i,u),d.numValidPixel!==d.width*d.height&&!u.pixels.resultMask&&(u.pixels.resultMask=o.maskData);var g=d.width*d.height;u.pixels.resultPixels=new f(g*d.numDims),u.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var v=!o.returnPixelInterleavedDims;if(d.numValidPixel!==0)if(d.zMax===d.zMin)e.constructConstantSurface(u,v);else if(m>=4&&e.checkMinMaxRanges(i,u))e.constructConstantSurface(u,v);else{var w=new DataView(i,u.ptr,2),b=w.getUint8(0);if(u.ptr++,b)e.readDataOneSweep(i,u,f,v);else if(m>1&&d.imageType<=1&&Math.abs(d.maxZError-.5)<1e-5){var x=w.getUint8(1);if(u.ptr++,u.encodeMode=x,x>2||m<4&&x>1)throw"Invalid Huffman flag "+x;x?e.readHuffman(i,u,f,v):e.readTiles(i,u,f,v)}else e.readTiles(i,u,f,v)}u.eofOffset=u.ptr;var L;o.inputOffset?(L=u.headerInfo.blobSize+o.inputOffset-u.ptr,Math.abs(L)>=1&&(u.eofOffset=o.inputOffset+u.headerInfo.blobSize)):(L=u.headerInfo.blobSize-u.ptr,Math.abs(L)>=1&&(u.eofOffset=u.headerInfo.blobSize));var M={width:d.width,height:d.height,pixelData:u.pixels.resultPixels,minValue:d.zMin,maxValue:d.zMax,validPixelCount:d.numValidPixel,dimCount:d.numDims,dimStats:{minValues:d.minValues,maxValues:d.maxValues},maskData:u.pixels.resultMask};if(u.pixels.resultMask&&e.isValidPixelValue(d.imageType,a)){var C=u.pixels.resultMask;for(c=0;c<g;c++)C[c]||(M.pixelData[c]=a);M.noDataValue=a}return u.noDataValue=a,o.returnFileInfo&&(M.fileInfo=e.formatFileInfo(u)),M}},getBandCount:function(i){var o=0,a=0,c={};for(c.ptr=0,c.pixels={};a<i.byteLength-58;)e.readHeaderInfo(i,c),a+=c.headerInfo.blobSize,o++,c.ptr=a;return o}};return n}();var cv=function(){var r=new ArrayBuffer(4),e=new Uint8Array(r),t=new Uint32Array(r);return t[0]=1,e[0]===1}(),uv={decode:function(r,e){if(!cv)throw"Big endian system is not supported.";e=e||{};var t=e.inputOffset||0,n=new Uint8Array(r,t,10),i=String.fromCharCode.apply(null,n),o,a;if(i.trim()==="CntZImage")o=av,a=1;else if(i.substring(0,5)==="Lerc2")o=lv,a=2;else throw"Unexpected file identifier string: "+i;for(var c=0,u=r.byteLength-10,d,m=[],f,g,v={width:0,height:0,pixels:[],pixelType:e.pixelType,mask:null,statistics:[]},w=0;t<u;){var b=o.decode(r,{inputOffset:t,encodedMaskData:d,maskData:g,returnMask:c===0,returnEncodedMask:c===0,returnFileInfo:!0,returnPixelInterleavedDims:e.returnPixelInterleavedDims,pixelType:e.pixelType||null,noDataValue:e.noDataValue||null});t=b.fileInfo.eofOffset,g=b.maskData,c===0&&(d=b.encodedMaskData,v.width=b.width,v.height=b.height,v.dimCount=b.dimCount||1,v.pixelType=b.pixelType||b.fileInfo.pixelType,v.mask=g),a>1&&(g&&m.push(g),b.fileInfo.mask&&b.fileInfo.mask.numBytes>0&&w++),c++,v.pixels.push(b.pixelData),v.statistics.push({minValue:b.minValue,maxValue:b.maxValue,noDataValue:b.noDataValue,dimStats:b.dimStats})}var x,L,M;if(a>1&&w>1){for(M=v.width*v.height,v.bandMasks=m,g=new Uint8Array(M),g.set(m[0]),x=1;x<m.length;x++)for(f=m[x],L=0;L<M;L++)g[L]=g[L]&f[L];v.maskData=g}return v}};const hv={0:7e3,1:6e3,2:5e3,3:4e3,4:3e3,5:2500,6:2e3,7:1500,8:800,9:500,10:200,11:100,12:40,13:12,14:5,15:2,16:1,17:.5,18:.2,19:.1,20:.01};function dv(r){const{height:e,width:t,pixels:n}=uv.decode(r),i=new Float32Array(e*t);for(let o=0;o<i.length;o++)i[o]=n[0][o];return{array:i,width:t,height:e}}function fv(r,e,t){let n=dv(r);t[2]-t[0]<1&&(n=pv(n,t));const{array:i,width:o}=n,c=new hu(o).createTile(i),u=hv[e]||0;return c.getGeometryData(u)}function pv(r,e){function t(c,u,d,m,f,g,v,w){const b=new Float32Array(f*g);for(let L=0;L<g;L++)for(let M=0;M<f;M++){const C=(L+m)*u+(M+d),W=L*f+M;b[W]=c[C]}const x=new Float32Array(w*v);for(let L=0;L<w;L++)for(let M=0;M<v;M++){const C=L*w+M,W=Math.round(M*g/w),D=Math.round(L*f/v)*f+W;x[C]=b[D]}return x}const n=mv(e,r.width),i=n.sw+1,o=n.sh+1;return{array:t(r.array,r.width,n.sx,n.sy,n.sw,n.sh,i,o),width:i,height:o}}function mv(r,e){const t=Math.floor(r[0]*e),n=Math.floor(r[1]*e),i=Math.floor((r[2]-r[0])*e),o=Math.floor((r[3]-r[1])*e);return{sx:t,sy:n,sw:i,sh:o}}var gv=Object.defineProperty,yv=(r,e,t)=>e in r?gv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ms=(r,e,t)=>yv(r,typeof e!="symbol"?e+"":e,t);const vv=10;class _v extends ca{constructor(){super(),Ms(this,"info",{version:"0.10.0",description:"Tile LERC terrain loader. It can load ArcGis-lerc format terrain data."}),Ms(this,"dataType","lerc"),Ms(this,"fileLoader",new p.FileLoader(De.manager)),Ms(this,"_workerPool",new Qo(0)),this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new ov)}async doLoad(e,t){this._workerPool.pool===0&&this._workerPool.setWorkerLimit(vv);const{z:n,bounds:i}=t,o=await this.fileLoader.loadAsync(e).catch(()=>new Float32Array(256*256)),a=fv(o,n,i);return new Ki().setData(a)}}pa(new _v);const _u="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGModCl7cmV0dXJuIGEodC5kYXRhKX1mdW5jdGlvbiBhKHQpe2Z1bmN0aW9uIG4oZSx1KXtjb25zdCByPXUqNCxbaSxmLGcsbF09ZS5zbGljZShyLHIrNCk7cmV0dXJuIGw9PT0wPzA6LTFlNCsoaTw8MTZ8Zjw8OHxnKSouMX1jb25zdCBvPXQubGVuZ3RoPj4+MixzPW5ldyBGbG9hdDMyQXJyYXkobyk7Zm9yKGxldCBlPTA7ZTxvO2UrKylzW2VdPW4odCxlKTtyZXR1cm4gc31zZWxmLm9ubWVzc2FnZT10PT57Y29uc3Qgbj1jKHQuZGF0YS5pbWdEYXRhKTtzZWxmLnBvc3RNZXNzYWdlKG4pfX0pKCk7Cg==",wv=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),wu=typeof self<"u"&&self.Blob&&new Blob([wv(_u)],{type:"text/javascript;charset=utf-8"});function bv(r){let e;try{if(e=wu&&(self.URL||self.webkitURL).createObjectURL(wu),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+_u,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var xv=Object.defineProperty,Mv=(r,e,t)=>e in r?xv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ss=(r,e,t)=>Mv(r,typeof e!="symbol"?e+"":e,t);const Sv=10;class Lv extends ca{constructor(){super(),Ss(this,"info",{version:"0.10.0",description:"Mapbox-RGB terrain loader, It can load Mapbox-RGB terrain data."}),Ss(this,"dataType","terrain-rgb"),Ss(this,"imageLoader",new p.ImageLoader(De.manager)),Ss(this,"_workerPool",new Qo(0)),this._workerPool.setWorkerCreator(()=>new bv)}async doLoad(e,t){const n=await this.imageLoader.loadAsync(e).catch(u=>new Image),i=p.MathUtils.clamp((t.z+2)*3,2,64),o=Pv(n,t.bounds,i);let a;this._workerPool.pool===0&&this._workerPool.setWorkerLimit(Sv),a=(await this._workerPool.postMessage({imgData:o},[o.data.buffer])).data;const c=new Ki;return c.setData(a),c}}function Pv(r,e,t){const n=ra(e,r.width);t=Math.min(t,n.sw);const o=new OffscreenCanvas(t,t).getContext("2d");return o.imageSmoothingEnabled=!1,o.drawImage(r,n.sx,n.sy,n.sw,n.sh,0,0,t,t),o.getImageData(0,0,t,t)}pa(new Lv);function Hn(r,e){this.x=r,this.y=e}Hn.prototype={clone(){return new Hn(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,t=r.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),t=Math.sin(r),n=e*this.x-t*this.y,i=t*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround(r,e){const t=Math.cos(r),n=Math.sin(r),i=e.x+t*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=i,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Hn},Hn.convert=function(r){if(r instanceof Hn)return r;if(Array.isArray(r))return new Hn(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Hn(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};class bu{constructor(e,t,n,i,o){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,e.readFields(Cv,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,n=[];let i,o=1,a=0,c=0,u=0;for(;e.pos<t;){if(a<=0){const d=e.readVarint();o=d&7,a=d>>3}if(a--,o===1||o===2)c+=e.readSVarint(),u+=e.readSVarint(),o===1&&(i&&n.push(i),i=[]),i&&i.push(new Hn(c,u));else if(o===7)i&&i.push(i[0].clone());else throw new Error(`unknown command ${o}`)}return i&&n.push(i),n}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,i=0,o=0,a=0,c=1/0,u=-1/0,d=1/0,m=-1/0;for(;e.pos<t;){if(i<=0){const f=e.readVarint();n=f&7,i=f>>3}if(i--,n===1||n===2)o+=e.readSVarint(),a+=e.readSVarint(),o<c&&(c=o),o>u&&(u=o),a<d&&(d=a),a>m&&(m=a);else if(n!==7)throw new Error(`unknown command ${n}`)}return[c,d,u,m]}toGeoJSON(e,t,n){const i=this.extent*Math.pow(2,n),o=this.extent*e,a=this.extent*t,c=this.loadGeometry();function u(g){return[(g.x+o)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(g.y+a)*2/i)*Math.PI))-90]}function d(g){return g.map(u)}let m;if(this.type===1){const g=[];for(const w of c)g.push(w[0]);const v=d(g);m=g.length===1?{type:"Point",coordinates:v[0]}:{type:"MultiPoint",coordinates:v}}else if(this.type===2){const g=c.map(d);m=g.length===1?{type:"LineString",coordinates:g[0]}:{type:"MultiLineString",coordinates:g}}else if(this.type===3){const g=Gv(c),v=[];for(const w of g)v.push(w.map(d));m=v.length===1?{type:"Polygon",coordinates:v[0]}:{type:"MultiPolygon",coordinates:v}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:m,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}bu.types=["Unknown","Point","LineString","Polygon"];function Cv(r,e,t){r===1?e.id=t.readVarint():r===2?Tv(t,e):r===3?e.type=t.readVarint():r===4&&(e._geometry=t.pos)}function Tv(r,e){const t=r.readVarint()+r.pos;for(;r.pos<t;){const n=e._keys[r.readVarint()],i=e._values[r.readVarint()];e.properties[n]=i}}function Gv(r){const e=r.length;if(e<=1)return[r];const t=[];let n,i;for(let o=0;o<e;o++){const a=Wv(r[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&t.push(n),n=[r[o]]):n&&n.push(r[o]))}return n&&t.push(n),t}function Wv(r){let e=0;for(let t=0,n=r.length,i=n-1,o,a;t<n;i=t++)o=r[t],a=r[i],e+=(a.x-o.x)*(o.y+a.y);return e}let Zv=class{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Vv,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new bu(this._pbf,t,this.extent,this._keys,this._values)}};function Vv(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(Iv(t))}function Iv(r){let e=null;const t=r.readVarint()+r.pos;for(;r.pos<t;){const n=r.readVarint()>>3;e=n===1?r.readString():n===2?r.readFloat():n===3?r.readDouble():n===4?r.readVarint64():n===5?r.readVarint():n===6?r.readSVarint():n===7?r.readBoolean():null}if(e==null)throw new Error("unknown feature value");return e}class Av{constructor(e,t){this.layers=e.readFields(Fv,{},t)}}function Fv(r,e,t){if(r===3){const n=new Zv(t,t.readVarint()+t.pos);n.length&&(e[n.name]=n)}}const ma=65536*65536,xu=1/ma,Ov=12,Mu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),ga=0,Ls=1,Wr=2,Ps=5;class Dv{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){const i=this.readVarint(),o=i>>3,a=this.pos;this.type=i&7,e(o,t,this),this.pos===a&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ma;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ma;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let n,i;return i=t[this.pos++],n=i&127,i<128||(i=t[this.pos++],n|=(i&127)<<7,i<128)||(i=t[this.pos++],n|=(i&127)<<14,i<128)||(i=t[this.pos++],n|=(i&127)<<21,i<128)?n:(i=t[this.pos],n|=(i&15)<<28,zv(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Ov&&Mu?Mu.decode(this.buf.subarray(t,e)):Ev(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Wr?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===ga)for(;this.buf[this.pos++]>127;);else if(t===Wr)this.pos=this.readVarint()+this.pos;else if(t===Ps)this.pos+=4;else if(t===Ls)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*xu),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*xu),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){Xv(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=$v(this.buf,e,this.pos);const n=this.pos-t;n>=128&&Su(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const i=this.pos-n;i>=128&&Su(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i}writeMessage(e,t,n){this.writeTag(e,Wr),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Kv,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Nv,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Rv,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Bv,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Yv,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,jv,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Jv,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Qv,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Hv,t)}writeBytesField(e,t){this.writeTag(e,Wr),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,Ps),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,Ps),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Ls),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Ls),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,ga),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,ga),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Wr),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,Ps),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Ls),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function zv(r,e,t){const n=t.buf;let i,o;if(o=n[t.pos++],i=(o&112)>>4,o<128||(o=n[t.pos++],i|=(o&127)<<3,o<128)||(o=n[t.pos++],i|=(o&127)<<10,o<128)||(o=n[t.pos++],i|=(o&127)<<17,o<128)||(o=n[t.pos++],i|=(o&127)<<24,o<128)||(o=n[t.pos++],i|=(o&1)<<31,o<128))return Ni(r,i,e);throw new Error("Expected varint not more than 10 bytes")}function Ni(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}function Xv(r,e){let t,n;if(r>=0?(t=r%4294967296|0,n=r/4294967296|0):(t=~(-r%4294967296),n=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Uv(t,n,e),kv(n,e)}function Uv(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}function kv(r,e){const t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}function Su(r,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let i=t.pos-1;i>=r;i--)t.buf[i+n]=t.buf[i]}function Kv(r,e){for(let t=0;t<r.length;t++)e.writeVarint(r[t])}function Nv(r,e){for(let t=0;t<r.length;t++)e.writeSVarint(r[t])}function Bv(r,e){for(let t=0;t<r.length;t++)e.writeFloat(r[t])}function Yv(r,e){for(let t=0;t<r.length;t++)e.writeDouble(r[t])}function Rv(r,e){for(let t=0;t<r.length;t++)e.writeBoolean(r[t])}function jv(r,e){for(let t=0;t<r.length;t++)e.writeFixed32(r[t])}function Jv(r,e){for(let t=0;t<r.length;t++)e.writeSFixed32(r[t])}function Qv(r,e){for(let t=0;t<r.length;t++)e.writeFixed64(r[t])}function Hv(r,e){for(let t=0;t<r.length;t++)e.writeSFixed64(r[t])}function Ev(r,e,t){let n="",i=e;for(;i<t;){const o=r[i];let a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c>t)break;let u,d,m;c===1?o<128&&(a=o):c===2?(u=r[i+1],(u&192)===128&&(a=(o&31)<<6|u&63,a<=127&&(a=null))):c===3?(u=r[i+1],d=r[i+2],(u&192)===128&&(d&192)===128&&(a=(o&15)<<12|(u&63)<<6|d&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):c===4&&(u=r[i+1],d=r[i+2],m=r[i+3],(u&192)===128&&(d&192)===128&&(m&192)===128&&(a=(o&15)<<18|(u&63)<<12|(d&63)<<6|m&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,c=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=c}return n}function $v(r,e,t){for(let n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){r[t++]=239,r[t++]=191,r[t++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):o=i;continue}else o&&(r[t++]=239,r[t++]=191,r[t++]=189,o=null);i<128?r[t++]=i:(i<2048?r[t++]=i>>6|192:(i<65536?r[t++]=i>>12|224:(r[t++]=i>>18|240,r[t++]=i>>12&63|128),r[t++]=i>>6&63|128),r[t++]=i&63|128)}return t}var qv=Object.defineProperty,e_=(r,e,t)=>e in r?qv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ya=(r,e,t)=>e_(r,typeof e!="symbol"?e+"":e,t);class t_ extends ha{constructor(){super(),ya(this,"dataType","mvt"),ya(this,"_loader",new p.FileLoader(De.manager)),ya(this,"_render",new fu),this._loader.setResponseType("arraybuffer")}async doLoad(e,t){const n=await this._loader.loadAsync(e),i=new Av(new Dv(n)),o=this.drawTile(i,t.source.style,t.z);return new p.CanvasTexture(o)}drawTile(e,t,n){const c=new OffscreenCanvas(256,256).getContext("2d");if(c){if(t)for(const u in t.layer){const d=t.layer[u];if(t&&(n<(d.minLevel??1)||n>(d.maxLevel??20)))continue;const m=e.layers[u];if(m){const f=256/m.extent;this._renderLayer(c,m,d,f)}}else for(const u in e.layers){const d=e.layers[u],m=256/d.extent;this._renderLayer(c,d,void 0,m)}return c.canvas}else throw new Error("Canvas context is not available")}_renderLayer(e,t,n,i=1){e.save();for(let o=0;o<t.length;o++){const a=t.feature(o);this._renderFeature(e,a,n,i)}return e.restore(),this}_renderFeature(e,t,n={},i=1){const o=[nt.Unknown,nt.Point,nt.Linestring,nt.Polygon][t.type],a={geometry:t.loadGeometry(),properties:t.properties};this._render.render(e,o,a,n,i)}_convertToGeoJSONFeature(e,t){const n=this._convertGeometryToGeoJSON(e.geometry,t);return n?{type:"Feature",geometry:n,properties:e.properties||{},id:e.id}:null}_convertGeometryToGeoJSON(e,t){switch(t){case nt.Point:return this._convertPointGeometry(e);case nt.Linestring:return this._convertLineGeometry(e);case nt.Polygon:return this._convertPolygonGeometry(e);default:return console.warn("未知的几何类型:",t),null}}_convertPointGeometry(e){const t=[];for(const n of e)for(const i of n)t.push([i.x,i.y]);return t.length===0?null:t.length===1?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}_convertLineGeometry(e){const t=[];for(const n of e){const i=[];for(const o of n)i.push([o.x,o.y]);i.length>=2&&t.push(i)}return t.length===0?null:t.length===1?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}_convertPolygonGeometry(e){const t=[];let n=[];for(const i of e){const o=[];for(const a of i)o.push([a.x,a.y]);o.length>=4&&(this._isRingClockwise(o)||n.length===0?(n.length>0&&t.push(n),n=[o]):n.push(o))}return n.length>0&&t.push(n),t.length===0?null:t.length===1?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}_isRingClockwise(e){let t=0;for(let n=0;n<e.length-1;n++){const[i,o]=e[n],[a,c]=e[n+1];t+=(a-i)*(c+o)}return t>0}convertVectorTileToGeoJSON(e){const t=[];for(const n in e.layers){const i=e.layers[n];for(let o=0;o<i.length;o++){const a=i.feature(o),c=[nt.Unknown,nt.Point,nt.Linestring,nt.Polygon][a.type],u={geometry:a.loadGeometry(),properties:a.properties},d=this._convertToGeoJSONFeature(u,c);d&&(d.properties._layer=n,t.push(d))}}return{type:"FeatureCollection",features:t}}}fa(new t_);const Lu="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IF89MjMyODMwNjQzNjUzODY5NjNlLTI2LG09MTIsUD10eXBlb2YgVGV4dERlY29kZXI+InUiP251bGw6bmV3IFRleHREZWNvZGVyKCJ1dGYtOCIpLGc9MCx5PTEsRj0yLHA9NTtjbGFzcyBNe2NvbnN0cnVjdG9yKHQ9bmV3IFVpbnQ4QXJyYXkoMTYpKXt0aGlzLmJ1Zj1BcnJheUJ1ZmZlci5pc1ZpZXcodCk/dDpuZXcgVWludDhBcnJheSh0KSx0aGlzLmRhdGFWaWV3PW5ldyBEYXRhVmlldyh0aGlzLmJ1Zi5idWZmZXIpLHRoaXMucG9zPTAsdGhpcy50eXBlPTAsdGhpcy5sZW5ndGg9dGhpcy5idWYubGVuZ3RofXJlYWRGaWVsZHModCxlLHI9dGhpcy5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O3RyeXtjb25zdCBlPWF3YWl0IEsodC5hcnJheUJ1ZmZlcix0LngsdC55LHQueik7c2VsZi5wb3N0TWVzc2FnZShlKX1jYXRjaChlKXtjb25zb2xlLmVycm9yKCJXb3JrZXIgTVZUIOino+aekOWksei0pToiLGUpLHNlbGYucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfX19KSgpOwo=",n_=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Pu=typeof self<"u"&&self.Blob&&new Blob([n_(Lu)],{type:"text/javascript;charset=utf-8"});function i_(r){let e;try{if(e=Pu&&(self.URL||self.webkitURL).createObjectURL(Pu),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Lu,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var r_=Object.defineProperty,s_=(r,e,t)=>e in r?r_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cs=(r,e,t)=>s_(r,typeof e!="symbol"?e+"":e,t);const o_=10;class a_{constructor(){Cs(this,"info",{version:"1.0.0",description:"Vector Tile loader for Mapbox Vector Tile format. It can load and parse MVT data."}),Cs(this,"dataType","VectorTile"),Cs(this,"fileLoader",new p.FileLoader(De.manager)),Cs(this,"_workerPool",new Qo(0)),this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new i_)}async load(e){const{source:t,x:n,y:i,z:o}=e,a=typeof t._getUrl=="function"?t._getUrl(n,i,o):this.buildTileUrl(t.url,n,i,o);if(!a)return this.createErrorGeometry(n,i,o,new Error("VectorTileLoader: source._getUrl 返回空 URL"));this._workerPool.pool===0&&this._workerPool.setWorkerLimit(o_);try{const c=await this.fetchVectorData(a),u={arrayBuffer:c,x:n,y:i,z:o},m=(await this._workerPool.postMessage(u,[c])).data;if(m.error)throw new Error(m.error);const f=this.createGeometryWithVectorData(m,e);return De.manager.parseEnd(a),f}catch(c){return this.createErrorGeometry(n,i,o,c)}}async fetchVectorData(e){try{const t=await this.fileLoader.loadAsync(e);if(!t||t.byteLength===0)throw new Error("Empty response");return t}catch(t){throw new Error(`Failed to fetch vector tile: ${t.message}`)}}calculateTileBounds(e,t,n){const i=4007501668557849e-8/Math.pow(2,n),o=-20037508342789244e-9+e*i,a=o+i,c=20037508342789244e-9-(t+1)*i,u=c+i;return{min:new p.Vector2(o,c),max:new p.Vector2(a,u),world:new p.Vector2(i,i)}}buildTileUrl(e,t,n,i){return e.replace("{x}",t.toString()).replace("{y}",n.toString()).replace("{z}",i.toString()).replace("{-y}",(Math.pow(2,i)-1-n).toString())}createGeometryWithVectorData(e,t){const n=new Ki;return n.userData={vectorData:e,tileInfo:{x:t.x,y:t.y,z:t.z,bounds:t.bounds},metadata:{dataType:"vector-tile",version:"1.0.0",loadedAt:Date.now()}},n}createErrorGeometry(e,t,n,i){const o=new Ki;return o.userData={vectorData:{x:e,y:t,z:n,layers:{},totalFeatures:0,bounds:this.calculateTileBounds(e,t,n),error:i.message,timestamp:Date.now(),dataFormat:"error"},tileInfo:{x:e,y:t,z:n,bounds:[0,0,0,0]},metadata:{dataType:"vector-tile-error",error:!0,errorMessage:i.message}},o}unload(e){e.userData?.vectorData&&(e.userData.vectorData=null),e.dispose&&e.dispose()}static getVectorData(e){return e.userData?.vectorData||null}static hasValidVectorData(e){const t=this.getVectorData(e);return t&&!t.error&&t.totalFeatures>0}static getLayerNames(e){const t=this.getVectorData(e);return t?Object.keys(t.layers||{}):[]}static getFeaturesByLayer(e,t){return this.getVectorData(e)?.layers?.[t]?.convertedFeatures||[]}}gu(new a_);var l_=Object.defineProperty,c_=(r,e,t)=>e in r?l_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,En=(r,e,t)=>c_(r,typeof e!="symbol"?e+"":e,t);class va extends ou{constructor(e,t){if(super(e,t),En(this,"layerType","vector"),En(this,"_tileDataMap",new Map),En(this,"_renderer"),En(this,"_style"),En(this,"_feaList",[]),En(this,"_collision",!1),En(this,"_renderAltitude",0),En(this,"_eventsBound",!1),!t.style)throw new Error("VectorTileLayer must provide style configuration! VectorTileLayer 必须提供样式配置");this._style=t.style,this._collision=t.collision||!1,this._featureFilter=t.featureFilter,this._renderAltitude=t.altitude||0,this._rootTile.setDataOnlyMode(!0),this._setupDataModeAndListenersForChildren(),this._setupLifeCycleListeners()}_setupDataModeAndListenersForChildren(){const e=t=>{t!==this._rootTile&&t.setDataOnlyMode(!0),this._addShownListenerToTile(t),this._addUnloadListenerToTile(t)};this._rootTile.addEventListener("tile-created",t=>{const n=t.tile;e(n)}),this._rootTile.traverse(t=>{t.isTile&&e(t)})}_addShownListenerToTile(e){const t=n=>{const i=n.tile,o=`${i.z}-${i.x}-${i.y}`,a=!!this._renderer,c=this._tileDataMap.get(o);a&&c&&this._renderer.processTileData(i,c.data)};e.addEventListener("tile-shown",t)}_addUnloadListenerToTile(e){const t=n=>{const i=n.tile||n.target,o=`${i.z}-${i.x}-${i.y}`;if(this._renderer)try{this._renderer.removeFeaturesByTileKey(o)}catch{}this._tileDataMap.delete(o)};e.addEventListener("unload",t)}setAltitude(e){return super.setAltitude(0),this._renderAltitude=e,this._renderer&&this._renderer.setAltitude(e),this}getAltitude(){return this._renderAltitude}_addHiddenListenerToTile(e){const t=n=>{const i=n.tile,o=`${i.z}-${i.x}-${i.y}`;if(this._renderer)try{this._renderer.hideFeaturesByTileKey(o)}catch{}};e.addEventListener("tile-hidden",t)}_setupLifeCycleListeners(){this._rootTile.addEventListener("tile-loaded",e=>{const t=e.tile,n=`${t.z}-${t.x}-${t.y}`,i=this.getVectorDataFromTile(t);if(!i){console.warn(`[VectorTileLayer] Tile ${n} loaded but has no vector data.`);return}if(i.vectorData?.dataFormat==="mvt"&&this._tileDataMap.set(n,{data:i,tile:t,timestamp:Date.now(),pending:!1}),t.showing&&this._renderer&&i.vectorData?.dataFormat==="mvt")try{this._renderer.processTileData(t,i)}catch{}})}getVectorDataFromTile(e){return!e.geometry||!e.getVectorData()?null:e.getVectorData()}createLoader(){const e=new xs;return e.vtSource=this.source,e}getVisibleVectorTiles(){const e=[];return this._rootTile.traverse(t=>{if(t.isTile&&t.loaded&&t.inFrustum){const n=`${t.z}-${t.x}-${t.y}`,i=this._tileDataMap.get(n);i&&e.push({tileKey:n,data:i.data,tile:i.tile})}}),e}getAllVectorData(){return new Map(this._tileDataMap)}getVectorData(e,t,n){const i=`${n}-${e}-${t}`,o=this._tileDataMap.get(i);return o?o.data:null}setFeatureFilter(e){this._featureFilter=e,this._renderer&&this._renderer.setFeatureFilter(e)}clearFeatureFilter(){this._featureFilter=void 0,this._renderer&&this._renderer.clearFeatureFilter()}setOpacity(e){this.opacity=e,this._renderer&&this._renderer.setOpacity(e)}hide(){return super.hide(),this._renderer&&this._renderer.hide(),this}show(){return super.show(),this._renderer&&this._renderer.show(),this}update(e){!this.enabled||!this.visible||super.update(e)}dispose(){this._renderer&&this._renderer.dispose(),super.dispose()}setFeaturePickingEnabled(e){this.options.enableFeaturePicking=e,this._renderer&&(this._renderer.interactive=e,e&&!this._eventsBound&&this._bindRendererEvents(this._renderer))}_bindRendererEvents(e){if(this._eventsBound)return;["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu"].forEach(n=>{const i="feature"+n;e.on(i,o=>{this.trigger(i,o)})}),this._eventsBound=!0}_setRenderer(e){this._renderer=e,this._eventsBound=!1,this.options.enableFeaturePicking&&this._bindRendererEvents(e)}_getRenderer(){return this._renderer||null}getStyle(){return this._style}setStyle(e){return this._style=e,this._renderer&&(this._renderer.style=e,this._tileDataMap.forEach((n,i)=>{this._renderer.removeFeaturesByTileKey(i)}),this.getVisibleVectorTiles().forEach(({tile:n,data:i})=>{this._renderer.processTileData(n,i)})),this}setSymbol(e){return this.setStyle(e)}}var u_=Object.defineProperty,h_=(r,e,t)=>e in r?u_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ne=(r,e,t)=>h_(r,typeof e!="symbol"?e+"":e,t);class d_{constructor(...e){}}const f_={};let wi=class cf extends jo(Kn(yi(d_))){constructor(e,t){Uo(e,"container","Map container element must be specified");const n=["center","basemap"];for(const W of n)yc(t,W);const o={...t,viewer:{...{viewer:{antialias:!0,stencil:!0,logarithmicDepthBuffer:!0}}.viewer,...t.viewer}};super(o),Ne(this,"viewer"),Ne(this,"tilemap"),Ne(this,"center"),Ne(this,"prjcenter"),Ne(this,"_layerContainer"),Ne(this,"_EventMap",{loaded:{listened:!1}}),Ne(this,"_canvasManager",new Rg),Ne(this,"collisionEngine"),Ne(this,"_onLoadHooks"),Ne(this,"_minZoom",0),Ne(this,"_maxZoom",22),Ne(this,"_ZOOM_MIN_CONST",0),Ne(this,"_ZOOM_MAX_CONST",22),Ne(this,"_minZoomDistance",500),Ne(this,"_maxZoomDistance",8e4),Ne(this,"_isZooming",!1),Ne(this,"_zoomStartValue",0),Ne(this,"_lastZoomForControls",0),Ne(this,"_overZoom",0),Ne(this,"_lastCameraDistance",0),this.tilemap=this.initTileMap(o.basemap),this.center=this.options.center,this.viewer=new Mc(e,{...o.viewer,map:this}),this.tilemap.receiveShadow=!0,this.viewer.scene.add(this.tilemap);const a=this.tilemap.geo2world(new p.Vector3(this.center[0],this.center[1],0));this.prjcenter=a;const c=this.options.viewer??{};this.viewer.flyToPoint({center:this.center,distance:typeof this.center[2]=="number"?this.center[2]:void 0,polarDeg:typeof c.polarDeg=="number"?c.polarDeg:void 0,azimuthDeg:typeof c.azimuthDeg=="number"?c.azimuthDeg:void 0,polarAngle:c.polarAngle,azimuthAngle:c.azimuthAngle,duration:0,curvePath:!1}),this._minZoomDistance=this.viewer.controls.minDistance,this._maxZoomDistance=this.viewer.controls.maxDistance;const u=this._getCameraDistance();this._lastCameraDistance=u,this._layerContainer=new Kg,this.viewer.scene.add(this._layerContainer);const d=this.viewer.controls;this._minZoomDistance=typeof d?.minDistance=="number"?d.minDistance:500,this._maxZoomDistance=typeof d?.maxDistance=="number"?d.maxDistance:8e4;const f=this.tilemap.getLayers().find(W=>W.isBaseLayer===!0)?.minLevel??this.tilemap.minLevel;this._minZoom=Math.max(this._ZOOM_MIN_CONST,Math.min(this._ZOOM_MAX_CONST,f)),this._maxZoom=this._ZOOM_MAX_CONST;const g=this.prjcenter,w=this.viewer.camera.position.clone().clone().sub(g).normalize(),x=ls(t.zoom)?13:t.zoom,L=Math.max(this._minZoom,Math.min(this._maxZoom,x)),M=this._computeDistanceFromZoom(L);a.clone().addScaledVector(w,M);const C=this.getZoom();this._lastZoomForControls=C,this._zoomStartValue=C,this.collisionEngine=new x0(this.viewer.renderer,{padding:8,updateInterval:16,animationDuration:200,maxFeaturesPerFrame:2e4,strategies:{priority:!0,grouping:!0,proximity:!0}}),this.on("control-change",M0.debounce(W=>{if(!this.tilemap||!this.collisionEngine)return;const z=this.tilemap,D=z.getDataZoom(),I=z.getLayers().find(H=>H.isBaseLayer===!0)?.maxLevel??z.maxLevel,K=this._getCameraDistance(),V=K-this._lastCameraDistance;this._lastCameraDistance=K;const{max:G}=this._getViewZoomRange(),k=Math.max(0,G-I);D<I?this._overZoom=0:V<-.001?this._overZoom=Math.min(this._overZoom+1,k):V>.001&&(this._overZoom=Math.max(this._overZoom-1,0));const j=this.getZoom();Math.abs(j-this._lastZoomForControls)>.001&&(this._isZooming?this.trigger("zooming",{from:this._zoomStartValue,to:j}):(this._isZooming=!0,this._zoomStartValue=this._lastZoomForControls,this.trigger("zoomstart",{from:this._zoomStartValue,to:j})),this._lastZoomForControls=j),this.collisionEngine.update(W.camera)},10,{leading:!1,trailing:!0})),this.on("control-end",()=>{this._isZooming&&(this._isZooming=!1,this.trigger("zoomend",{from:this._zoomStartValue,to:this.getZoom()}))}),this._callOnLoadHooks()}static addOnLoadHook(e,...t){const n=typeof e=="function"?e:function(){this[e].apply(this,t)},i=this.prototype;return i._onLoadHooks=i._onLoadHooks||[],i._onLoadHooks.push(n),this}_callOnLoadHooks(){const e=cf.prototype;if(e._onLoadHooks)for(let t=0,n=e._onLoadHooks.length;t<n;t++)e._onLoadHooks[t].call(this)}getZoom(){const e=this.tilemap,t=e.getDataZoom(),i=e.getLayers().find(o=>o.isBaseLayer===!0)?.maxLevel??e.maxLevel;return t<i?t:i+this._overZoom}getDataZoom(){return this.tilemap.getDataZoom()}getMinZoom(){return this._minZoom}getMaxZoom(){return this._maxZoom}setZoomRange(e,t){if(e>t){const i=e;e=t,t=i}this._minZoom=e,this._maxZoom=t;const n=this.viewer.controls;if(n){const i=this._computeDistanceFromZoom(this._maxZoom),o=this._computeDistanceFromZoom(this._minZoom);n.minDistance=i,n.maxDistance=o}return this}setMinZoom(e){return this.setZoomRange(e,this._maxZoom)}setMaxZoom(e){return this.setZoomRange(this._minZoom,e)}setZoom(e){const t=this.getMinZoom(),n=this.getMaxZoom(),i=Math.max(t,Math.min(n,e)),o=this.getZoom(),a=this._computeDistanceFromZoom(i),c=this.viewer.controls,u=c?.target??this.prjcenter,d=this.viewer.camera,m=d.position.clone().sub(u).normalize();return d.position.copy(u).addScaledVector(m,a),d.updateProjectionMatrix(),typeof c?.update=="function"&&c.update(),this._lastZoomForControls=i,this.trigger("zoomend",{from:o,to:this.getZoom()}),this}zoomIn(e=1){return this.setZoom(this.getZoom()+e)}zoomOut(e=1){return this.setZoom(this.getZoom()-e)}_computeDistanceFromZoom(e){const t=this._ZOOM_MIN_CONST,n=this._ZOOM_MAX_CONST,i=this._minZoomDistance,o=this._maxZoomDistance;if(i<=0||i>=o){const m=Math.max(t,Math.min(n,e)),f=(n-m)/(n-t);return i+f*(o-i)}const c=(Math.max(t,Math.min(n,e))-t)/(n-t),u=i/o;return o*Math.pow(u,c)}initTileMap(e){const t=new ds({...e});try{if(e.Baselayers?.length)for(const n of e.Baselayers)n.isBaseLayer=!0,t.addLayer(n)}catch(n){console.error("💥 Diagnostic failed 诊断失败:",n)}return t.rotateX(-Math.PI/2),t.receiveShadow=!0,setTimeout(()=>{const n={timestamp:_c(),targrt:this};this._EventMap.loaded={listened:!0},this.trigger("loaded",n)},0),t}addLayer(e,...t){if(!e)return this;Array.isArray(e)||(e=[e]),t?.length&&(e=e.concat(t)),t?.length&&(e=e.concat(t));for(let n=0,i=e.length;n<i;n++){const o=e[n],a=o.getId();if(ls(a))throw new Error("Invalid id for the layer: "+a);o.isTileLayer?this.addTileLayer(o):this.addRegularLayer(o)}return this}removeLayer(e){const t=typeof e=="string"?e:e.getId(),n=this.tilemap.getLayer(t);if(n){if(n instanceof va){const o=n._getRenderer();o&&this._layerContainer.remove(o)}return this.tilemap.removeLayer(t),!0}const i=this._layerContainer.getLayerById(t);return i?(this._layerContainer.remove(i),i instanceof Yn&&i?._collision,!0):(console.warn(`⚠️ Layer does not exist 图层不存在: ${t}`),!1)}addRegularLayer(e){this._layerContainer.add(e),e._bindMap(this),e instanceof Yn&&e?._collision&&(this.collisionEngine.registerLayer(e),e.setCollisionEngine(this.collisionEngine))}addTileLayer(e){if(this.tilemap.addLayer(e),e._bindMap(this),e instanceof va){const t=e.options||{},n=new ws(e.getId()+"-vtrender",{altitude:e.getAltitude(),style:e.getStyle(),collision:e._collision,zIndex:typeof t.zIndex=="number"?t.zIndex:void 0,depthOffset:typeof t.depthOffset=="number"?t.depthOffset:void 0});t.enableFeaturePicking&&(n.interactive=!0),e._setRenderer(n),this.addRegularLayer(n)}return this}clearLayers(){return this._layerContainer.clear(),this.tilemap.clearLayers(),this}getLayers(){const e=this._layerContainer.getLayers().filter(n=>!(n instanceof ws)),t=this.tilemap.getLayers();return[...e,...t]}getLayerById(e){const t=this._layerContainer.getLayerById(e);return t?t instanceof ws?void 0:t:this.tilemap.getLayer(e)}geo2world(e){return this.tilemap.geo2world(e)}world2geo(e){return this.tilemap.world2geo(e)}geo2map(e){return this.tilemap.geo2map(e)}_getCanvas(e=40,t=30,n){return this._canvasManager.getCanvas(e,t,1,n)}getContainer(){return this.viewer.container}getRenderer(){return this.viewer.renderer}getCamera(){return this.viewer.camera}_findFeaturesAt(e){const t=this,n=t.getRenderer(),i=t.getCamera(),o=n.domElement.getBoundingClientRect(),a=e.x/o.width*2-1,c=-(e.y/o.height)*2+1,u=new p.Raycaster;u.setFromCamera(new p.Vector2(a,c),i);const d=[...t.getLayers(),...t._layerContainer.getLayers().filter(g=>g instanceof ws&&g.interactive)].filter(g=>!g?.isSceneLayer&&g?.visible===!0),f=u.intersectObjects(d,!0).map(g=>{let v=g.object,w=null;for(;v;){if(v instanceof ut){w=v;break}v=v.parent}return!w||w.visible===!1?null:{feature:w,distance:g.distance,object:g.object}}).filter(g=>!!g);return f.length?f.sort((g,v)=>g.distance-v.distance):[]}getCenter(){const e=this.viewer.controls.target.clone(),t=this.world2geo(e);return[t.x,t.y,t.z]}_getEventPosition(e){let t,n;if("touches"in e){if(e.touches.length===0)return null;t=e.touches[0].clientX,n=e.touches[0].clientY}else t=e.clientX,n=e.clientY;const i=this.getContainer();if(!i)return null;const o=i.getBoundingClientRect();return{x:t-o.left,y:n-o.top}}get isInteracting(){return this.viewer?this.viewer.isInteracting:!1}_getCameraDistance(){const e=this.viewer.controls,t=this.viewer.camera,n=e?.target??this.prjcenter;return e&&typeof e.getDistance=="function"?e.getDistance():t.position.distanceTo(n)}_getViewZoomRange(){const e=this.viewer.controls,t=typeof e?.minDistance=="number"?e.minDistance:this._minZoomDistance,n=typeof e?.maxDistance=="number"?e.maxDistance:this._maxZoomDistance;if(t<=0||t>=n){const f=this.tilemap.getDataZoom();return{min:f,max:f}}const i=n/t,o=Math.log2(i),a=this.tilemap.getLayers().find(f=>f.isBaseLayer===!0),c=a?.minLevel??this.tilemap.minLevel,u=a?.maxLevel??this.tilemap.maxLevel,d=c,m=u+o;return{min:d,max:m}}flyTo(e){this.viewer.flyToAdvanced(e)}flyToPoint(e){this.viewer.flyToPoint(e)}destroy(){try{this._clearHandlers(),["control-change","control-start","control-end","zoomstart","zooming","zoomend","loaded"].forEach(t=>{const n=this._listenerMap?.get(t);n&&n.forEach((i,o)=>{this.off(t,o)})}),this.clearLayers(),Wc.clearCache(),this.collisionEngine&&(this.collisionEngine=null),this._layerContainer&&(this._layerContainer.clear(),this._layerContainer=null),this.tilemap&&(this.tilemap.dispose(),this.tilemap=null),this._canvasManager&&(this._canvasManager=null),this.viewer&&(this.viewer.destroy(),this.viewer=null),this._EventMap={loaded:{listened:!1}}}catch(e){console.error("Error destroying map 销毁地图时出错:",e)}}};wi.mergeOptions(f_);const p_=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout"];wi.prototype._removeDomEvents=function(){},wi.prototype._registerDomEvents=function(){const r=this.viewer.container;if(r){let t=null;p_.forEach(n=>{r.addEventListener(n,i=>{if(!this.viewer||!this.tilemap)return;if(n==="mousedown"&&(t={x:i.clientX,y:i.clientY}),n==="click"&&t){const c=i.clientX-t.x,u=i.clientY-t.y;if(Math.sqrt(c*c+u*u)>5)return}let o=ia(i,this.tilemap,this.viewer.camera),a={target:this,originEvent:i,eventName:n,screenXY:{X:i.screenX,Y:i.screenY}};if(o){let c=[o.x,o.y,o.z];a={target:this,originEvent:i,coordinate:c,eventName:n,screenXY:{X:i.screenX,Y:i.screenY}}}this.trigger(n,a)})})}},wi.addOnLoadHook("_registerDomEvents");var m_=Object.defineProperty,g_=(r,e,t)=>e in r?m_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_a=(r,e,t)=>g_(r,typeof e!="symbol"?e+"":e,t);const y_=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchmove","touchend"];class v_ extends cs{constructor(){super(...arguments),_a(this,"_registeredEvents",[]),_a(this,"_mouseDownTime",0),_a(this,"_eventCommon",e=>{(e.type==="mousedown"||e.type==="touchstart")&&(this._mouseDownTime=Date.now()),!(e.type==="click"&&Date.now()-this._mouseDownTime>300)&&this._handleEvent(e,e.type)})}addHooks(){const t=this.target.getContainer();t&&y_.forEach(n=>{t.addEventListener(n,this._eventCommon),this._registeredEvents.push(n)})}removeHooks(){const t=this.target.getContainer();t&&this._registeredEvents.length>0&&(this._registeredEvents.forEach(n=>{const i=n;t.removeEventListener(i,this._eventCommon)}),this._registeredEvents=[])}_handleEvent(e,t){const n=this.target;if(!n||!n.viewer||this._shouldIgnoreEvent(t)||(t==="mousemove"||t==="mouseenter"||t==="mouseleave"||t==="mouseover"||t==="mouseout"||t==="touchmove")&&!n.getLayers().some(u=>!u.isSceneLayer&&u._feaList?.length>0))return;const i=n._getEventPosition(e);if(!i)return;const o=n._findFeaturesAt(i);if(o.length===0)return;const a=o[0].feature;switch(t){case"click":this._handleClickEvent(a,e);break;case"mousemove":case"mouseenter":case"mouseleave":case"mouseover":case"mouseout":case"touchmove":this.handleMoveEvent(a,e);break;default:if(a){this._fireFeatureEvent(a,t,e);const c=a.getLayer();c&&c.trigger("feature"+t,{feature:a,domEvent:e,type:"feature"+t})}}}_handleClickEvent(e,t){if(!e)return;this._fireFeatureEvent(e,"click",t);const n=e.getLayer();n&&n.trigger("featureclick",{feature:e,domEvent:t,type:"featureclick"})}handleMoveEvent(e,t){if(!e)return;this._fireFeatureEvent(e,t.type,t);const n=e.getLayer();n&&n.trigger("feature"+t.type,{feature:e,domEvent:t,type:"feature"+t.type})}_fireFeatureEvent(e,t,n){const i=this.target;if(!i||!i.tilemap||!i.viewer)return;let o=n,a,c;if("touches"in n){const f=n.touches[0]||n.changedTouches[0];if(!f)return;o={currentTarget:n.currentTarget,clientX:f.clientX,clientY:f.clientY},a=f.screenX,c=f.screenY}else{const f=n;o=f,a=f.screenX,c=f.screenY}const u=ia(o,i.tilemap,i.viewer.camera);if(!u)return;const d=[u.x,u.y,u.z],m={target:e,originEvent:n,coordinate:d,eventName:t,screenXY:{X:a,Y:c}};e.trigger(t,m)}_shouldIgnoreEvent(e){const t=this.target;return t.viewer?e==="mousedown"||e==="touchstart"?!1:!!t.isInteracting:!0}}wi.mergeOptions({FeatureEvents:!0,onlyVisibleFeatureEvents:!0}),wi.addOnLoadHook("addHandler","FeatureEvents",v_);var __=Object.defineProperty,w_=(r,e,t)=>e in r?__(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_n=(r,e,t)=>w_(r,typeof e!="symbol"?e+"":e,t);let b_=class{constructor(...e){}};const Cu=class ur extends Kn(yi(b_)){constructor(e={}){super(e),_n(this,"_owner"),_n(this,"_map"),_n(this,"_worldPosition"),_n(this,"_coordinate"),_n(this,"_dom"),_n(this,"_visible",!1),_n(this,"_boundMapHandlers",new Map),_n(this,"_viewerUpdateHandler"),_n(this,"_positionedOnce",!1)}_getClassName(){return"UIComponent"}getOffset(){return{x:this.options.dx??0,y:this.options.dy??0}}addTo(e){if(!e)return this;this._owner=e;const t=typeof e.getMap=="function"?e.getMap():e;return t?(this._map=t,this._bindMapEvents(!0),this.options.single&&(ur._singletons.forEach(n=>{n!==this&&n.options.single&&n._map===t&&n.hide()}),ur._singletons.add(this)),this.onAdd&&this.onAdd(),this.trigger("add",{owner:e,map:t}),this):this}remove(){const e=this._map;return this.hideDom(),this._bindMapEvents(!1),this.options.single&&ur._singletons.delete(this),this.onRemove&&this.onRemove(),this.trigger("remove",{owner:this._owner,map:e}),this._owner=void 0,this._map=void 0,this}show(e){const t=this._map??(this._owner&&typeof this._owner.getMap=="function"?this._owner.getMap():void 0);if(!t)return this;if(this._map=t,this.options.single&&(ur._singletons.forEach(n=>{n!==this&&n.options.single&&n._map===t&&n.isVisible()&&n.hide()}),ur._singletons.add(this)),!this._dom){const n=this.buildOn();this._dom=n,n.style.position="absolute",typeof this.options.zIndex=="number"&&(n.style.zIndex=String(this.options.zIndex));const i=t.getContainer();if(!i)return this;i.appendChild(n)}return this._coordinate=e?[...e]:void 0,this._visible=!0,this._positionedOnce=!1,this._dom&&(this._dom.style.display="none"),this.trigger("show",{owner:this._owner,map:t}),this}hide(){return this._visible=!1,this._dom&&(this._dom.style.display="none"),this._coordinate=void 0,this.trigger("hide",{owner:this._owner,map:this._map}),this}hideDom(){return this._dom&&this._dom.parentElement&&(this._dom.parentElement.removeChild(this._dom),this.onDomRemove&&this.onDomRemove()),this._dom=void 0,this._visible=!1,this._coordinate=void 0,this}getMap(){return this._map}isVisible(){return this._visible}_bindMapEvents(e){const t=this._map;if(!t)return;const n=t,i=e?"on":"off",o=(a,c)=>{e?this._boundMapHandlers.set(a,c):this._boundMapHandlers.delete(a)};if(e){const a=()=>{this._visible&&this._updatePosition()};n[i]("control-change",a),o("control-change",a);const c=t.viewer;if(c&&!this._viewerUpdateHandler){const u=()=>{this._visible&&this._updatePosition()};this._viewerUpdateHandler=u,c.addEventListener("update",u)}}else{this._boundMapHandlers.forEach((c,u)=>{n[i](u,c)}),this._boundMapHandlers.clear();const a=t.viewer;a&&this._viewerUpdateHandler&&(a.removeEventListener("update",this._viewerUpdateHandler),this._viewerUpdateHandler=void 0)}}_resolveWorldPosition(){const e=this._map;if(!e)return;if(this._coordinate){const[n,i,o=0]=this._coordinate,a=new p.Vector3(n,i,o);return e.geo2world(a)}const t=this._owner;if(t&&t._geometry){const n=t._geometry;if(n&&(n.type==="Point"||n.type==="MultiPoint")){let i;if(n.type==="Point"?i=n.coordinates:n.type==="MultiPoint"&&Array.isArray(n.coordinates)&&n.coordinates.length>0&&(i=n.coordinates[0]),i&&i.length>=2){const o=new p.Vector3(i[0],i[1],i[2]??0);return e.geo2world(o)}}if(t._threeGeometry&&typeof t._threeGeometry.getWorldPosition=="function"){const i=new p.Vector3;if(t._threeGeometry.getWorldPosition(i),!(i.x===0&&i.y===0&&i.z===0))return i}if(t._position instanceof p.Vector3){const i=t._position;if(!(i.x===0&&i.y===0&&i.z===0))return i.clone()}}if(t&&typeof t.getWorldPosition=="function"){const n=new p.Vector3;return t.getWorldPosition(n),n}return e.prjcenter?.clone?.()??void 0}_updatePosition(){if(!this._dom||!this._map)return;if(this._visible){const u=this._resolveWorldPosition();if(!u){this._dom.style.display="none";return}this._worldPosition=u}if(!this._worldPosition)return;const e=this._map.viewer,t=e.camera,n=this._dom.style.display==="none";n&&(this._dom.style.visibility="hidden",this._dom.style.display=""),t.updateMatrixWorld();const i=this._worldPosition.clone().project(t);if(i.x<-1.1||i.x>1.1||i.y<-1.1||i.y>1.1||i.z<-1||i.z>1){this._dom.style.display="none",n&&(this._dom.style.visibility="");return}const o=(i.x*.5+.5)*e.width,a=(-i.y*.5+.5)*e.height,c=this.getOffset();if(this._dom.style.left=`${o+c.x}px`,this._dom.style.top=`${a+c.y}px`,n&&(this._dom.style.visibility=""),!this._positionedOnce){this._positionedOnce=!0,this._dom.style.display="none";return}this._dom.style.display=""}};_n(Cu,"_singletons",new Set);let Tu=Cu;var x_=Object.defineProperty,M_=(r,e,t)=>e in r?x_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gu=(r,e,t)=>M_(r,typeof e!="symbol"?e+"":e,t);class wa extends Tu{constructor(e){super({single:!0,...e}),Gu(this,"_titleEl"),Gu(this,"_contentEl")}_getClassName(){return"InfoWindow"}buildOn(){if(this.options.custom){let c;this.options.content instanceof HTMLElement?c=this.options.content:(c=document.createElement("div"),typeof this.options.content=="string"&&(c.innerHTML=this.options.content));const u=this.options.containerClass;return u&&(Array.isArray(u)?u:[u]).forEach(m=>{c.classList.add(m)}),this.options.minWidth&&(c.style.minWidth=`${this.options.minWidth}px`),this.options.minHeight&&(c.style.minHeight=`${this.options.minHeight}px`),this._titleEl=void 0,this._contentEl=c,c}const e=document.createElement("div");e.className="terra-infowindow";const t=this.options.containerClass;t&&(Array.isArray(t)?t:[t]).forEach(u=>{e.classList.add(u)}),typeof this.options.zIndex=="number"&&(e.style.zIndex=String(this.options.zIndex)),this.options.minWidth&&(e.style.minWidth=`${this.options.minWidth}px`),this.options.minHeight&&(e.style.minHeight=`${this.options.minHeight}px`);const n=document.createElement("div");n.className="terra-infowindow-header";const i=document.createElement("div");i.className="terra-infowindow-title",this.options.title&&(i.innerText=this.options.title);const o=document.createElement("span");o.className="terra-infowindow-close",o.innerHTML="×",o.title="关闭",o.addEventListener("click",c=>{c.stopPropagation(),c.preventDefault(),this.close()}),o.addEventListener("mousedown",c=>{c.preventDefault()}),o.style.cursor="pointer",o.style.userSelect="none",n.appendChild(i),n.appendChild(o);const a=document.createElement("div");return a.className="terra-infowindow-content",this.options.content instanceof HTMLElement?a.appendChild(this.options.content):typeof this.options.content=="string"&&(a.innerHTML=this.options.content),e.appendChild(n),e.appendChild(a),this._titleEl=i,this._contentEl=a,e}getOffset(){const e=super.getOffset(),t=this._dom;if(!t)return e;const n=t.offsetWidth,i=t.offsetHeight,o=10;let a=e.x-n/2,c=e.y-i-o;const u=this._owner,d=this.getMap();if(u&&typeof u.getStyle=="function"&&d?.viewer){const f=u.getStyle?.()?.config,g=f?.type;if(f&&(g==="icon-point"||g==="icon-label-point")){const v=Array.isArray(f.anchor)?f.anchor:[.5,.5],w=typeof v[1]=="number"?v[1]:.5;let b=0;const x=u._threeGeometry;if(x&&x instanceof p.Sprite&&(b=this._getSpriteScreenHeight(x,d.viewer)),b<=0){let L=0;if(g==="icon-point"){const M=f.size;Array.isArray(M)?L=M[1]:typeof M=="number"&&(L=M)}else if(g==="icon-label-point"){const M=f.size??f.iconSize;Array.isArray(M)?L=M[1]:typeof M=="number"&&(L=M)}b=L*(1-w)}else b=b*(1-w);b>0&&(c-=b)}}return{x:a,y:c}}_getSpriteScreenHeight(e,t){try{const n=t.camera,i=t.renderer;if(!n||!i)return 0;const o=t.height||i.domElement.clientHeight;if(!(e.material.sizeAttenuation!==!1)){const z=n.projectionMatrix.elements[5];return e.scale.y*z*o/2}const u=new p.Vector3;e.getWorldPosition(u);const d=n.position.clone(),m=u.clone().sub(d).normalize(),f=new p.Vector3;f.crossVectors(n.up,m).normalize();const g=new p.Vector3;g.crossVectors(m,f).normalize();const v=e.scale.y*(1-e.center.y),w=e.scale.y*e.center.y,b=u.clone().add(g.clone().multiplyScalar(v)),x=u.clone().sub(g.clone().multiplyScalar(w)),L=b.clone().project(n),M=x.clone().project(n),C=(-L.y*.5+.5)*o,W=(-M.y*.5+.5)*o;return Math.abs(W-C)}catch(n){return console.warn("Failed to calculate sprite screen height: // 计算 sprite 屏幕高度失败:",n),0}}setTitle(e){return this.options.title=e,this._titleEl&&(this._titleEl.innerText=e??""),this}setContent(e){return this.options.content=e,this._contentEl?(this._contentEl.innerHTML="",e instanceof HTMLElement?this._contentEl.appendChild(e):this._contentEl.innerHTML=e,this):this}open(e){super.show(e);const t=this,n=()=>{!t._dom||!t._map||!t._visible||(t._positionedOnce=!0,t._updatePosition())},o=this.getMap()?.viewer;if(o&&typeof o.addEventListener=="function"){const a=()=>{o.removeEventListener("update",a),n()};o.addEventListener("update",a)}else requestAnimationFrame(n);return this}close(){return this.hide()}}ut.include({setInfoWindow(r){this.removeInfoWindow();let e;return r instanceof wa?e=r:e=new wa(r),this._infoWindow=e,this.getMap()&&e.addTo(this),this},getInfoWindow(){return this._infoWindow},openInfoWindow(r){const e=this._infoWindow;return e?(e.getMap()||this.getMap()&&e.addTo(this),requestAnimationFrame(()=>{e.open(r)}),this):this},closeInfoWindow(){return this._infoWindow&&this._infoWindow.close(),this},removeInfoWindow(){return this._infoWindow&&(this._infoWindow.remove(),this._infoWindow=void 0),this}});var S_=Object.defineProperty,L_=(r,e,t)=>e in r?S_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ba=(r,e,t)=>L_(r,typeof e!="symbol"?e+"":e,t);class P_{constructor(...e){}}class Wu extends Kn(yi(P_)){constructor(e={}){super(e),ba(this,"_map"),ba(this,"_enabled",!1),ba(this,"_boundHandlers",new Map)}addTo(e){if(!e)return this;const t=e;return t._activeMapTool&&t._activeMapTool!==this&&t._activeMapTool.disable(),t._activeMapTool=this,this._map=e,this.onAdd&&this.onAdd(),this.enable(),this.trigger("add",{map:e}),this}getMap(){return this._map}enable(){return!this._map||this._enabled?this:(this._enabled=!0,this._bindEvents(),this.onEnable&&this.onEnable(),this.trigger("enable",{map:this._map}),this)}disable(){return!this._map||!this._enabled?this:(this._enabled=!1,this._unbindEvents(),this.onDisable&&this.onDisable(),this.trigger("disable",{map:this._map}),this)}isEnabled(){return!!this._enabled}remove(){if(!this._map)return this;this.disable();const e=this._map;return e._activeMapTool===this&&delete e._activeMapTool,this._map=void 0,this.trigger("remove"),this}_bindEvents(){const e=this._map;if(!e)return;const t=this.getEvents()||{};Object.keys(t).forEach(n=>{const i=t[n];if(!i)return;const o=a=>i.call(this,a);this._boundHandlers.set(n,o),e.on(n,o)})}_unbindEvents(){const e=this._map;e&&(this._boundHandlers.forEach((t,n)=>{e.off(n,t)}),this._boundHandlers.clear())}}var C_=Object.defineProperty,T_=(r,e,t)=>e in r?C_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zr=(r,e,t)=>T_(r,typeof e!="symbol"?e+"":e,t);class G_ extends Yn{constructor(e){super(e,{altitude:1})}validateFeature(e){return!!e}}const Zu={};class Bi extends Wu{constructor(e){super(e),Zr(this,"_modeDef"),Zr(this,"_clickCoords",[]),Zr(this,"_isDrawing",!1),Zr(this,"_geometry"),Zr(this,"_draftLayer"),this.options.once=this.options.once??!1,this._ensureMode()}static registerMode(e,t){Zu[e.toLowerCase()]=t}static getModeDefinition(e){return Zu[e.toLowerCase()]}getMode(){return(this.options.mode||"").toLowerCase()}setMode(e){return this._finishDrawingSilently(),this.options.mode=e,this._ensureMode(),this}setStyle(e){return e.geometryStyle!==void 0&&(this.options.geometryStyle=e.geometryStyle),Object.prototype.hasOwnProperty.call(e,"vertexStyle")&&(this.options.vertexStyle=e.vertexStyle??null),this}getEvents(){return{click:this._handleClick.bind(this),mousemove:this._handleMouseMove.bind(this),dblclick:this._handleDblClick.bind(this)}}onEnable(){this._ensureMode()}onDisable(){this._finishDrawingSilently(),this._destroyDraftLayer()}_ensureMode(){const e=this.getMode(),t=Bi.getModeDefinition(e);if(!t)throw new Error(`DrawTool: mode "${e}" 未注册,请先调用 DrawTool.registerMode`);this._modeDef=t}_handleClick(e){if(!this._modeDef||!e.coordinate)return;const t=e.coordinate,n=this._modeDef,i={...e,drawTool:this};this._isDrawing?(this._clickCoords.push(t),n.update(this._clickCoords,this._geometry,i),this.trigger("drawvertex",{coordinate:t,geometry:this._geometry,coords:[...this._clickCoords],originEvent:i})):(this._isDrawing=!0,this._clickCoords=[t],this._geometry=n.create(t,i),this.trigger("drawstart",{coordinate:t,geometry:this._geometry,coords:[...this._clickCoords],originEvent:i})),n.clickLimit&&this._clickCoords.length>=n.clickLimit&&this._finishDrawing(i)}_handleMouseMove(e){if(!this._modeDef||!this._isDrawing||!e.coordinate)return;const t=this._modeDef,n=[...this._clickCoords,e.coordinate],i={...e,drawTool:this};t.update(n,this._geometry,i),this.trigger("drawing",{coordinate:e.coordinate,geometry:this._geometry,coords:n,originEvent:i})}_handleDblClick(e){if(!this._modeDef||!this._isDrawing)return;const t={...e,drawTool:this};this._finishDrawing(t)}_finishDrawing(e){if(!this._modeDef||!this._isDrawing)return;const n=this._modeDef.generate(this._geometry,[...this._clickCoords]);this.trigger("drawend",{geometry:n,coords:[...this._clickCoords],originEvent:e}),this._isDrawing=!1,this._clickCoords=[],this._geometry=void 0,this.options.once&&this.disable()}_finishDrawingSilently(){this._isDrawing=!1,this._clickCoords=[],this._geometry=void 0}_getOrCreateDraftLayer(){if(this._draftLayer)return this._draftLayer;const e=this.getMap();if(!e)throw new Error("DrawTool: 尚未绑定地图,请先调用 addTo(map)");const t=`__draw_draft_${Date.now().toString(36)}`,n=new G_(t);return e.addLayer(n),this._draftLayer=n,n}_destroyDraftLayer(){const e=this.getMap();e&&this._draftLayer&&e.removeLayer(this._draftLayer.getId()),this._draftLayer=void 0}}const W_={actions:["click","mousemove"],create(r,e){const t=e.drawTool,n=t._getOrCreateDraftLayer(),i=$n(t.options.geometryStyle,{type:"basic-point",size:10,color:"#00ffff"}),o={type:"Point",coordinates:r},a=new Pn({geometry:o,style:i});return a.addTo(n),a.initializeGeometry(),{tool:t,draftLayer:n,draftMarker:a}},update(r,e,t){const n=e?.draftMarker;if(!n)return;const i=r[r.length-1];n._geometry={type:"Point",coordinates:i},n._position=n._coordsTransform(),n._toThreeJSGeometry&&n._toThreeJSGeometry()},generate(r,e){const t=r.tool;if(!e.length)return null;r.draftMarker&&(r.draftMarker._remove(),r.draftMarker=null);const n=$n(t.options.geometryStyle,{type:"basic-point",size:10,color:"#00ffff"}),i=e[e.length-1];return new Pn({geometry:{type:"Point",coordinates:i},style:n})},clickLimit:1},Z_={actions:["click","mousemove","dblclick"],create(r,e){const t=e.drawTool,n=t._getOrCreateDraftLayer(),i=$n(t.options.geometryStyle,{type:"basic-line",color:"#ff0000",width:2}),o=t.options.vertexStyle===null?void 0:$n(t.options.vertexStyle,{type:"basic-point",size:8,color:"#00ffff"}),a={type:"LineString",coordinates:[r]},c=new Mt({geometry:a,style:i});c.addTo(n);const u=[];if(o){const d={type:"Point",coordinates:r},m=new Pn({geometry:d,style:o});m.addTo(n),u.push(m)}return{tool:t,draftLayer:n,draftLine:c,draftAnchors:u,lineStyle:i,vertexStyle:o}},update(r,e,t){if(!e)return;const n=e.draftLayer;if(!r||r.length<2)return;e.draftLine&&(e.draftLine._remove(),e.draftLine=null);const i={type:"LineString",coordinates:r},o=new Mt({geometry:i,style:e.lineStyle});if(o.addTo(n),e.draftLine=o,t.eventName==="click"&&e.vertexStyle){const c={type:"Point",coordinates:r[r.length-1]},u=new Pn({geometry:c,style:e.vertexStyle});u.addTo(n),e.draftAnchors.push(u)}},generate(r,e){const t=r.tool;if(!e.length)return null;if(r.draftLine&&(r.draftLine._remove(),r.draftLine=null),Array.isArray(r.draftAnchors)){for(const o of r.draftAnchors)o?._remove();r.draftAnchors=[]}const n=$n(t.options.geometryStyle,{type:"basic-line",color:"#ff0000",width:2});return new Mt({geometry:{type:"LineString",coordinates:e},style:n})}},V_={actions:["click","mousemove","dblclick"],create(r,e){const t=e.drawTool,n=t._getOrCreateDraftLayer(),i=$n(t.options.geometryStyle,{type:"basic-polygon",color:"#00ff00",opacity:.5}),o=t.options.vertexStyle===null?void 0:$n(t.options.vertexStyle,{type:"basic-point",size:8,color:"#00ffff"}),a=[];if(o){const c={type:"Point",coordinates:r},u=new Pn({geometry:c,style:o});u.addTo(n),u.initializeGeometry(),a.push(u)}return{tool:t,draftLayer:n,draftPolygon:null,draftEdgeLine:null,draftAnchors:a,polygonStyle:i,vertexStyle:o}},update(r,e,t){if(!e)return;const n=e.draftLayer;if(t.eventName==="click"&&e.vertexStyle){const m={type:"Point",coordinates:r[r.length-1]},f=new Pn({geometry:m,style:e.vertexStyle});f.addTo(n),f.initializeGeometry(),e.draftAnchors.push(f)}if(!r||r.length<2){e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null),e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null);return}if(r.length===2){e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null),e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null);const d={type:"LineString",coordinates:r},m=e.polygonStyle?.config&&e.polygonStyle.config.color||"#00ff00",f=new xt({type:"basic-line",color:m,width:2}),g=new Mt({geometry:d,style:f});g.addTo(n),e.draftEdgeLine=g;return}e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null);const i=r.slice(),o=i[0],a=i[i.length-1];(o[0]!==a[0]||o[1]!==a[1]||(o[2]||0)!==(a[2]||0))&&i.push(o),e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null);const c={type:"Polygon",coordinates:[i]},u=new vn({geometry:c,style:e.polygonStyle});u.addTo(n),e.draftPolygon=u},generate(r,e){const t=r.tool;if(e.length<3)return null;if(r.draftPolygon&&(r.draftPolygon._remove(),r.draftPolygon=null),r.draftEdgeLine&&(r.draftEdgeLine._remove(),r.draftEdgeLine=null),Array.isArray(r.draftAnchors)){for(const u of r.draftAnchors)u?._remove();r.draftAnchors=[]}const n=$n(t.options.geometryStyle,{type:"basic-polygon",color:"#00ff00",opacity:.5}),i=e.slice(),o=i[0],a=i[i.length-1];return(o[0]!==a[0]||o[1]!==a[1]||(o[2]||0)!==(a[2]||0))&&i.push(o),new vn({geometry:{type:"Polygon",coordinates:[i]},style:n})}};Bi.registerMode("point",W_),Bi.registerMode("line",Z_),Bi.registerMode("polygon",V_);function $n(r,e){return xt.create(r||e)}var I_=Object.defineProperty,A_=(r,e,t)=>e in r?I_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rn=(r,e,t)=>A_(r,typeof e!="symbol"?e+"":e,t);class F_ extends nn{constructor(e){if(super(e),rn(this,"dataType","image"),rn(this,"attribution","天地图"),rn(this,"token",""),rn(this,"style","img_w"),rn(this,"subdomains","01234"),rn(this,"url","https://t{s}.tianditu.gov.cn/DataServer?T={style}&x={x}&y={y}&l={z}&tk={token}"),Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}class O_ extends nn{constructor(e){if(super(e),rn(this,"dataType","quantized-mesh"),rn(this,"attribution","天地图"),rn(this,"token",""),rn(this,"subdomains","01234"),rn(this,"url","https://t{s}.tianditu.gov.cn/mapservice/swdx?T=elv_c&tk={token}&x={x}&y={y}&l={z}"),Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}var D_=Object.defineProperty,z_=(r,e,t)=>e in r?D_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Vu=(r,e,t)=>z_(r,typeof e!="symbol"?e+"":e,t);class X_ extends nn{constructor(e){super({...e,url:e.urlTemplate,isTMS:e.isTMS||!1}),Vu(this,"minLevel",2),Vu(this,"maxLevel",24)}getUrl(e,t,n){const i=this.isTMS?Math.pow(2,n)-1-t:t;return hm(this.url,{...this,x:e,y:i,z:n,tileMatrix:n,tileRow:i,tileCol:e})}}var U_=Object.defineProperty,k_=(r,e,t)=>e in r?U_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cn=(r,e,t)=>k_(r,typeof e!="symbol"?e+"":e,t);class K_ extends nn{constructor(e){super(e),Cn(this,"dataType","image"),Cn(this,"attribution","ArcGIS"),Cn(this,"style","World_Imagery"),Cn(this,"url","https://services.arcgisonline.com/arcgis/rest/services/{style}/MapServer/tile/{z}/{y}/{x}"),Object.assign(this,e)}}class N_ extends nn{constructor(e){super(e),Cn(this,"dataType","lerc"),Cn(this,"attribution","ArcGIS"),Cn(this,"minLevel",6),Cn(this,"maxLevel",13),Cn(this,"url","https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/{z}/{y}/{x}"),Object.assign(this,e)}}var B_=Object.defineProperty,Y_=(r,e,t)=>e in r?B_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yi=(r,e,t)=>Y_(r,typeof e!="symbol"?e+"":e,t);class R_ extends nn{constructor(e){if(super(e),Yi(this,"token",""),Yi(this,"format","webp"),Yi(this,"style","cm2myr6qx001t01pi0sf7estf"),Yi(this,"attribution","MapBox"),Yi(this,"maxLevel",25),Yi(this,"url","https://api.mapbox.com/styles/v1/criska/cm2myr6qx001t01pi0sf7estf/tiles/256/{z}/{x}/{y}?access_token={token}&format={format}"),Object.assign(this,e),!this.token)throw new Error("MapBox访问令牌(token)是必填参数")}}var j_=Object.defineProperty,J_=(r,e,t)=>e in r?j_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Iu=(r,e,t)=>J_(r,typeof e!="symbol"?e+"":e,t);class Q_ extends nn{constructor(e){super(e),Iu(this,"dataType","mvt"),Iu(this,"style",{layer:[]}),Object.assign(this,e)}}var H_=Object.defineProperty,E_=(r,e,t)=>e in r?H_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Vr=(r,e,t)=>E_(r,typeof e!="symbol"?e+"":e,t);class $_ extends nn{constructor(e){super(e),Vr(this,"dataType","VectorTile"),Vr(this,"attribution","ArcGIS"),Vr(this,"minLevel",1),Vr(this,"maxLevel",21),Vr(this,"url","https://api.maptiler.com/tiles/v3/{z}/{x}/{y}.pbf?key=uKYsZQZpm72WlbSgH9B7"),Object.assign(this,e)}}class q_ extends Yn{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Line"}}class ew extends Yn{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Point"}}class tw extends Yn{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Surface"}}var nw=Object.defineProperty,iw=(r,e,t)=>e in r?nw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rw=(r,e,t)=>iw(r,e+"",t);class sw extends Yn{constructor(e,t){super(e,t),rw(this,"_clouds",null);const n=["texture"];for(const i of n)yc(t,i);this._createClouds(t.texture)}async _createClouds(e){const t=await xt._loadTexture(e),n=new og({texture:t,material:p.MeshBasicMaterial});n.castShadow=!0,this._clouds=n}validateFeature(e){return e._type==="Cloud"}animate(e,t){this._clouds&&this._clouds.update(this.map.viewer.camera,t,e)}}var ow=Object.defineProperty,aw=(r,e,t)=>e in r?ow(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,lw=(r,e,t)=>aw(r,e+"",t);class cw extends ou{constructor(e,t){super(e,t),lw(this,"layerType","raster")}createLoader(){const e=new xs;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}}var uw=Object.defineProperty,hw=(r,e,t)=>e in r?uw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ts=(r,e,t)=>hw(r,typeof e!="symbol"?e+"":e,t);class dw extends cw{constructor(e,t){super(e,t),Ts(this,"layerType","wmts"),Ts(this,"_layerName"),Ts(this,"_style"),Ts(this,"_matrixSet"),this._layerName=t.layerName,this._style=t.style||"default",this._matrixSet=t.matrixSet||"GoogleMapsCompatible"}get layerName(){return this._layerName}get style(){return this._style}get matrixSet(){return this._matrixSet}createLoader(){const e=new xs;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}update(e){this.loader&&super.update(e)}}console.log("%c✨ terra.gl V"+hf+" ","color:rgb(255, 255, 255); font-weight: bold; background: linear-gradient(90deg, #ffb6c1, #ff69b4); padding: 5px; border-radius: 5px;"),q.ArcGisDemSource=N_,q.ArcGisSource=K_,q.CloudsLayer=sw,q.DrawTool=Bi,q.EventClass=ko,q.Feature=ut,q.ICloud=nu,q.InfoWindow=wa,q.Label=iu,q.LineLayer=q_,q.LineString=Mt,q.LoaderFactory=De,q.MVTGeoSource=$_,q.MVTSource=Q_,q.Map=wi,q.MapBoxSource=R_,q.MapTool=Wu,q.Marker=Pn,q.Martini=hu,q.Model=tu,q.MultiLineString=eu,q.PointLayer=ew,q.Polygon=vn,q.PolygonLayer=tw,q.ProjectFactory=Rm,q.PromiseWorker=Ly,q.Style=xt,q.TDTQMSource=O_,q.TDTSource=F_,q.TPoints=su,q.Tile=Bn,q.TileCanvasLoader=jy,q.TileGeometry=Ki,q.TileGeometryLoader=ca,q.TileLoader=xs,q.TileLoadingManager=au,q.TileMap=ds,q.TileMaterial=ua,q.TileMaterialLoader=ha,q.TileSource=nn,q.UIComponent=Tu,q.VectorFeatureTypes=nt,q.VectorTileLayer=va,q.VectorTileRender=fu,q.Viewer=Mc,q.WMTSSource=X_,q.WMTSTileLayer=dw,q.WeatherEffect=xc,q.addSkirt=cu,q.author=iv,q.concatenateTypedArrays=Gr,q.convertGeometryToWGS84=Ty,q.createBillboards=Jm,q.getBoundsCoord=ra,q.getGeometryDataFromDem=uu,q.getGridIndices=aa,q.getLocalInfoFromRay=Yo,q.getLocalInfoFromScreen=Tc,q.getLocalInfoFromWorld=Ro,q.getNormals=la,q.getSafeTileUrlAndBounds=sa,q.registerDEMLoader=pa,q.registerImgLoader=fa,q.registerMeshLoader=gu,q.vector2ToWGS84=oa,q.version=nv,q.waitFor=rv,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|
|
1190
|
+
`;var iv=Object.defineProperty,nv=(r,e,t)=>e in r?iv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Vt=(r,e,t)=>nv(r,typeof e!="symbol"?e+"":e,t);class ni{constructor(e){Vt(this,"dataType","image"),Vt(this,"attribution","isource"),Vt(this,"minLevel",0),Vt(this,"maxLevel",18),Vt(this,"projectionID","3857"),Vt(this,"url",""),Vt(this,"subdomains",[]),Vt(this,"s",""),Vt(this,"opacity",1),Vt(this,"isTMS",!1),Vt(this,"bounds",[-180,-85,180,85]),Vt(this,"_projectionBounds",[-1/0,-1/0,1/0,1/0]),Vt(this,"tileMaterial"),Object.assign(this,e)}getUrl(e,t,i){const n={...this,x:e,y:t,z:i};return rv(this.url,n)}_getUrl(e,t,i){const n=this.subdomains.length;if(n>0){const a=Math.floor(Math.random()*n);this.s=this.subdomains[a]}const o=this.isTMS?Math.pow(2,i)-1-t:t;return this.getUrl(e,o,i)}static create(e){return new ni(e)}}function rv(r,e){const t=/\{ *([\w_-]+) *\}/g;return r.replace(t,(i,n)=>{const o=e[n]??(()=>{throw new Error(`source url template error, No value provided for variable: ${i}`)})();return typeof o=="function"?o(e):o})}const{version:sv,author:ov}=JSON.parse(tv);function av(r,e=100){return new Promise(t=>{const i=setInterval(()=>{r&&(clearInterval(i),t())},e)})}function fa(r){return ze.registerMaterialLoader(r),r}function pa(r){return ze.registerGeometryLoader(r),r}function yh(r){return ze.registerMeshLoader(r),r}fa(new qy);const vh="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEsoayxkKXtjb25zdCB5PW5ldyBGbG9hdDMyQXJyYXkoay5sZW5ndGgpO2ZvcihsZXQgVj0wO1Y8ZC5sZW5ndGg7Vis9Myl7Y29uc3QgYT1kW1ZdKjMsZT1kW1YrMV0qMyxyPWRbVisyXSozLHM9a1thXSx0PWtbYSsxXSxuPWtbYSsyXSxoPWtbZV0saT1rW2UrMV0sbz1rW2UrMl0sYz1rW3JdLHU9a1tyKzFdLG09a1tyKzJdLHc9aC1zLGw9aS10LGY9by1uLGc9Yy1zLE09dS10LEQ9bS1uLHA9bCpELWYqTSxVPWYqZy13KkQsST13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twXX1yZXR1cm4gd31jb25zdCBWPXVlKGQsay53aWR0aCksYT1WLnN3KzEsZT1WLnNoKzE7cmV0dXJue2FycmF5Onkoay5hcnJheSxrLndpZHRoLFYuc3gsVi5zeSxWLnN3LFYuc2gsYSxlKSx3aWR0aDphLGhlaWdodDplfX1mdW5jdGlvbiB1ZShrLGQpe2NvbnN0IHk9TWF0aC5mbG9vcihrWzBdKmQpLFY9TWF0aC5mbG9vcihrWzFdKmQpLGE9TWF0aC5mbG9vcigoa1syXS1rWzBdKSpkKSxlPU1hdGguZmxvb3IoKGtbM10ta1sxXSkqZCk7cmV0dXJue3N4Onksc3k6VixzdzphLHNoOmV9fXNlbGYub25tZXNzYWdlPWs9Pntjb25zdCBkPWsuZGF0YSx5PW9lKGQuZGVtRGF0YSxkLnosZC5jbGlwQm91bmRzKTtzZWxmLnBvc3RNZXNzYWdlKHkpfX0pKCk7Cg==",lv=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),_h=typeof self<"u"&&self.Blob&&new Blob([lv(vh)],{type:"text/javascript;charset=utf-8"});function cv(r){let e;try{if(e=_h&&(self.URL||self.webkitURL).createObjectURL(_h),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+vh,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const hv=function(){var r={};r.defaultNoDataValue=-34027999387901484e22,r.decode=function(a,c){c=c||{};var h=c.encodedMaskData||c.encodedMaskData===null,d=n(a,c.inputOffset||0,h),m=c.noDataValue!==null?c.noDataValue:r.defaultNoDataValue,f=e(d,c.pixelType||Float32Array,c.encodedMaskData,m,c.returnMask),g={width:d.width,height:d.height,pixelData:f.resultPixels,minValue:f.minValue,maxValue:d.pixels.maxValue,noDataValue:m};return f.resultMask&&(g.maskData=f.resultMask),c.returnEncodedMask&&d.mask&&(g.encodedMaskData=d.mask.bitset?d.mask.bitset:null),c.returnFileInfo&&(g.fileInfo=t(d),c.computeUsedBitDepths&&(g.fileInfo.bitDepths=i(d))),g};var e=function(a,c,h,d,m){var f=0,g=a.pixels.numBlocksX,v=a.pixels.numBlocksY,w=Math.floor(a.width/g),b=Math.floor(a.height/v),x=2*a.maxZError,L=Number.MAX_VALUE,M;h=h||(a.mask?a.mask.bitset:null);var C,W;C=new c(a.width*a.height),m&&h&&(W=new Uint8Array(a.width*a.height));for(var z=new Float32Array(w*b),D,X,I=0;I<=v;I++){var K=I!==v?b:a.height%v;if(K!==0)for(var V=0;V<=g;V++){var G=V!==g?w:a.width%g;if(G!==0){var k=I*a.width*b+V*w,j=a.width-G,Y=a.pixels.blocks[f],H,Q,re;Y.encoding<2?(Y.encoding===0?H=Y.rawData:(o(Y.stuffedData,Y.bitsPerPixel,Y.numValidPixels,Y.offset,x,z,a.pixels.maxValue),H=z),Q=0):Y.encoding===2?re=0:re=Y.offset;var ne;if(h)for(X=0;X<K;X++){for(k&7&&(ne=h[k>>3],ne<<=k&7),D=0;D<G;D++)k&7||(ne=h[k>>3]),ne&128?(W&&(W[k]=1),M=Y.encoding<2?H[Q++]:re,L=L>M?M:L,C[k++]=M):(W&&(W[k]=0),C[k++]=d),ne<<=1;k+=j}else if(Y.encoding<2)for(X=0;X<K;X++){for(D=0;D<G;D++)M=H[Q++],L=L>M?M:L,C[k++]=M;k+=j}else for(L=L>re?re:L,X=0;X<K;X++){for(D=0;D<G;D++)C[k++]=re;k+=j}if(Y.encoding===1&&Q!==Y.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:C,resultMask:W,minValue:L}},t=function(a){return{fileIdentifierString:a.fileIdentifierString,fileVersion:a.fileVersion,imageType:a.imageType,height:a.height,width:a.width,maxZError:a.maxZError,eofOffset:a.eofOffset,mask:a.mask?{numBlocksX:a.mask.numBlocksX,numBlocksY:a.mask.numBlocksY,numBytes:a.mask.numBytes,maxValue:a.mask.maxValue}:null,pixels:{numBlocksX:a.pixels.numBlocksX,numBlocksY:a.pixels.numBlocksY,numBytes:a.pixels.numBytes,maxValue:a.pixels.maxValue,noDataValue:a.noDataValue}}},i=function(a){for(var c=a.pixels.numBlocksX*a.pixels.numBlocksY,h={},d=0;d<c;d++){var m=a.pixels.blocks[d];m.encoding===0?h.float32=!0:m.encoding===1?h[m.bitsPerPixel]=!0:h[0]=!0}return Object.keys(h)},n=function(a,c,h){var d={},m=new Uint8Array(a,c,10);if(d.fileIdentifierString=String.fromCharCode.apply(null,m),d.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+d.fileIdentifierString;c+=10;var f=new DataView(a,c,24);if(d.fileVersion=f.getInt32(0,!0),d.imageType=f.getInt32(4,!0),d.height=f.getUint32(8,!0),d.width=f.getUint32(12,!0),d.maxZError=f.getFloat64(16,!0),c+=24,!h)if(f=new DataView(a,c,16),d.mask={},d.mask.numBlocksY=f.getUint32(0,!0),d.mask.numBlocksX=f.getUint32(4,!0),d.mask.numBytes=f.getUint32(8,!0),d.mask.maxValue=f.getFloat32(12,!0),c+=16,d.mask.numBytes>0){var g=new Uint8Array(Math.ceil(d.width*d.height/8));f=new DataView(a,c,d.mask.numBytes);var v=f.getInt16(0,!0),w=2,b=0;do{if(v>0)for(;v--;)g[b++]=f.getUint8(w++);else{var x=f.getUint8(w++);for(v=-v;v--;)g[b++]=x}v=f.getInt16(w,!0),w+=2}while(w<d.mask.numBytes);if(v!==-32768||b<g.length)throw"Unexpected end of mask RLE encoding";d.mask.bitset=g,c+=d.mask.numBytes}else d.mask.numBytes|d.mask.numBlocksY|d.mask.maxValue||(d.mask.bitset=new Uint8Array(Math.ceil(d.width*d.height/8)));f=new DataView(a,c,16),d.pixels={},d.pixels.numBlocksY=f.getUint32(0,!0),d.pixels.numBlocksX=f.getUint32(4,!0),d.pixels.numBytes=f.getUint32(8,!0),d.pixels.maxValue=f.getFloat32(12,!0),c+=16;var L=d.pixels.numBlocksX,M=d.pixels.numBlocksY,C=L+(d.width%L>0?1:0),W=M+(d.height%M>0?1:0);d.pixels.blocks=new Array(C*W);for(var z=0,D=0;D<W;D++)for(var X=0;X<C;X++){var I=0,K=a.byteLength-c;f=new DataView(a,c,Math.min(10,K));var V={};d.pixels.blocks[z++]=V;var G=f.getUint8(0);if(I++,V.encoding=G&63,V.encoding>3)throw"Invalid block encoding ("+V.encoding+")";if(V.encoding===2){c++;continue}if(G!==0&&G!==2){if(G>>=6,V.offsetType=G,G===2)V.offset=f.getInt8(1),I++;else if(G===1)V.offset=f.getInt16(1,!0),I+=2;else if(G===0)V.offset=f.getFloat32(1,!0),I+=4;else throw"Invalid block offset type";if(V.encoding===1)if(G=f.getUint8(I),I++,V.bitsPerPixel=G&63,G>>=6,V.numValidPixelsType=G,G===2)V.numValidPixels=f.getUint8(I),I++;else if(G===1)V.numValidPixels=f.getUint16(I,!0),I+=2;else if(G===0)V.numValidPixels=f.getUint32(I,!0),I+=4;else throw"Invalid valid pixel count type"}if(c+=I,V.encoding!==3){var k,j;if(V.encoding===0){var Y=(d.pixels.numBytes-1)/4;if(Y!==Math.floor(Y))throw"uncompressed block has invalid length";k=new ArrayBuffer(Y*4),j=new Uint8Array(k),j.set(new Uint8Array(a,c,Y*4));var H=new Float32Array(k);V.rawData=H,c+=Y*4}else if(V.encoding===1){var Q=Math.ceil(V.numValidPixels*V.bitsPerPixel/8),re=Math.ceil(Q/4);k=new ArrayBuffer(re*4),j=new Uint8Array(k),j.set(new Uint8Array(a,c,Q)),V.stuffedData=new Uint32Array(k),c+=Q}}}return d.eofOffset=c,d},o=function(a,c,h,d,m,f,g){var v=(1<<c)-1,w=0,b,x=0,L,M,C=Math.ceil((g-d)/m),W=a.length*4-Math.ceil(c*h/8);for(a[a.length-1]<<=8*W,b=0;b<h;b++){if(x===0&&(M=a[w++],x=32),x>=c)L=M>>>x-c&v,x-=c;else{var z=c-x;L=(M&v)<<z&v,M=a[w++],x=32-z,L+=M>>>x}f[b]=L<C?d+L*m:g}return f};return r}(),uv=function(){var r={unstuff:function(n,o,a,c,h,d,m,f){var g=(1<<a)-1,v=0,w,b=0,x,L,M,C,W=n.length*4-Math.ceil(a*c/8);if(n[n.length-1]<<=8*W,h)for(w=0;w<c;w++)b===0&&(L=n[v++],b=32),b>=a?(x=L>>>b-a&g,b-=a):(M=a-b,x=(L&g)<<M&g,L=n[v++],b=32-M,x+=L>>>b),o[w]=h[x];else for(C=Math.ceil((f-d)/m),w=0;w<c;w++)b===0&&(L=n[v++],b=32),b>=a?(x=L>>>b-a&g,b-=a):(M=a-b,x=(L&g)<<M&g,L=n[v++],b=32-M,x+=L>>>b),o[w]=x<C?d+x*m:f},unstuffLUT:function(n,o,a,c,h,d){var m=(1<<o)-1,f=0,g=0,v=0,w=0,b=0,x,L=[],M=n.length*4-Math.ceil(o*a/8);n[n.length-1]<<=8*M;var C=Math.ceil((d-c)/h);for(g=0;g<a;g++)w===0&&(x=n[f++],w=32),w>=o?(b=x>>>w-o&m,w-=o):(v=o-w,b=(x&m)<<v&m,x=n[f++],w=32-v,b+=x>>>w),L[g]=b<C?c+b*h:d;return L.unshift(c),L},unstuff2:function(n,o,a,c,h,d,m,f){var g=(1<<a)-1,v=0,w,b=0,x=0,L,M,C;if(h)for(w=0;w<c;w++)b===0&&(M=n[v++],b=32,x=0),b>=a?(L=M>>>x&g,b-=a,x+=a):(C=a-b,L=M>>>x&g,M=n[v++],b=32-C,L|=(M&(1<<C)-1)<<a-C,x=C),o[w]=h[L];else{var W=Math.ceil((f-d)/m);for(w=0;w<c;w++)b===0&&(M=n[v++],b=32,x=0),b>=a?(L=M>>>x&g,b-=a,x+=a):(C=a-b,L=M>>>x&g,M=n[v++],b=32-C,L|=(M&(1<<C)-1)<<a-C,x=C),o[w]=L<W?d+L*m:f}return o},unstuffLUT2:function(n,o,a,c,h,d){var m=(1<<o)-1,f=0,g=0,v=0,w=0,b=0,x=0,L,M=[],C=Math.ceil((d-c)/h);for(g=0;g<a;g++)w===0&&(L=n[f++],w=32,x=0),w>=o?(b=L>>>x&m,w-=o,x+=o):(v=o-w,b=L>>>x&m,L=n[f++],w=32-v,b|=(L&(1<<v)-1)<<o-v,x=v),M[g]=b<C?c+b*h:d;return M.unshift(c),M},originalUnstuff:function(n,o,a,c){var h=(1<<a)-1,d=0,m,f=0,g,v,w,b=n.length*4-Math.ceil(a*c/8);for(n[n.length-1]<<=8*b,m=0;m<c;m++)f===0&&(v=n[d++],f=32),f>=a?(g=v>>>f-a&h,f-=a):(w=a-f,g=(v&h)<<w&h,v=n[d++],f=32-w,g+=v>>>f),o[m]=g;return o},originalUnstuff2:function(n,o,a,c){var h=(1<<a)-1,d=0,m,f=0,g=0,v,w,b;for(m=0;m<c;m++)f===0&&(w=n[d++],f=32,g=0),f>=a?(v=w>>>g&h,f-=a,g+=a):(b=a-f,v=w>>>g&h,w=n[d++],f=32-b,v|=(w&(1<<b)-1)<<a-b,g=b),o[m]=v;return o}},e={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(n){for(var o=65535,a=65535,c=n.length,h=Math.floor(c/2),d=0;h;){var m=h>=359?359:h;h-=m;do o+=n[d++]<<8,a+=o+=n[d++];while(--m);o=(o&65535)+(o>>>16),a=(a&65535)+(a>>>16)}return c&1&&(a+=o+=n[d]<<8),o=(o&65535)+(o>>>16),a=(a&65535)+(a>>>16),(a<<16|o)>>>0},readHeaderInfo:function(n,o){var a=o.ptr,c=new Uint8Array(n,a,6),h={};if(h.fileIdentifierString=String.fromCharCode.apply(null,c),h.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+h.fileIdentifierString;a+=6;var d=new DataView(n,a,8),m=d.getInt32(0,!0);h.fileVersion=m,a+=4,m>=3&&(h.checksum=d.getUint32(4,!0),a+=4),d=new DataView(n,a,12),h.height=d.getUint32(0,!0),h.width=d.getUint32(4,!0),a+=8,m>=4?(h.numDims=d.getUint32(8,!0),a+=4):h.numDims=1,d=new DataView(n,a,40),h.numValidPixel=d.getUint32(0,!0),h.microBlockSize=d.getInt32(4,!0),h.blobSize=d.getInt32(8,!0),h.imageType=d.getInt32(12,!0),h.maxZError=d.getFloat64(16,!0),h.zMin=d.getFloat64(24,!0),h.zMax=d.getFloat64(32,!0),a+=40,o.headerInfo=h,o.ptr=a;var f,g;if(m>=3&&(g=m>=4?52:48,f=this.computeChecksumFletcher32(new Uint8Array(n,a-g,h.blobSize-14)),f!==h.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(n,o){var a=o.headerInfo,c=this.getDataTypeArray(a.imageType),h=a.numDims*this.getDataTypeSize(a.imageType),d=this.readSubArray(n,o.ptr,c,h),m=this.readSubArray(n,o.ptr+h,c,h);o.ptr+=2*h;var f,g=!0;for(f=0;f<a.numDims;f++)if(d[f]!==m[f]){g=!1;break}return a.minValues=d,a.maxValues=m,g},readSubArray:function(n,o,a,c){var h;if(a===Uint8Array)h=new Uint8Array(n,o,c);else{var d=new ArrayBuffer(c),m=new Uint8Array(d);m.set(new Uint8Array(n,o,c)),h=new a(d)}return h},readMask:function(n,o){var a=o.ptr,c=o.headerInfo,h=c.width*c.height,d=c.numValidPixel,m=new DataView(n,a,4),f={};if(f.numBytes=m.getUint32(0,!0),a+=4,(d===0||h===d)&&f.numBytes!==0)throw"invalid mask";var g,v;if(d===0)g=new Uint8Array(Math.ceil(h/8)),f.bitset=g,v=new Uint8Array(h),o.pixels.resultMask=v,a+=f.numBytes;else if(f.numBytes>0){g=new Uint8Array(Math.ceil(h/8)),m=new DataView(n,a,f.numBytes);var w=m.getInt16(0,!0),b=2,x=0,L=0;do{if(w>0)for(;w--;)g[x++]=m.getUint8(b++);else for(L=m.getUint8(b++),w=-w;w--;)g[x++]=L;w=m.getInt16(b,!0),b+=2}while(b<f.numBytes);if(w!==-32768||x<g.length)throw"Unexpected end of mask RLE encoding";v=new Uint8Array(h);var M=0,C=0;for(C=0;C<h;C++)C&7?(M=g[C>>3],M<<=C&7):M=g[C>>3],M&128&&(v[C]=1);o.pixels.resultMask=v,f.bitset=g,a+=f.numBytes}return o.ptr=a,o.mask=f,!0},readDataOneSweep:function(n,o,a,c){var h=o.ptr,d=o.headerInfo,m=d.numDims,f=d.width*d.height,g=d.imageType,v=d.numValidPixel*e.getDataTypeSize(g)*m,w,b=o.pixels.resultMask;if(a===Uint8Array)w=new Uint8Array(n,h,v);else{var x=new ArrayBuffer(v),L=new Uint8Array(x);L.set(new Uint8Array(n,h,v)),w=new a(x)}if(w.length===f*m)c?o.pixels.resultPixels=e.swapDimensionOrder(w,f,m,a,!0):o.pixels.resultPixels=w;else{o.pixels.resultPixels=new a(f*m);var M=0,C=0,W=0,z=0;if(m>1){if(c){for(C=0;C<f;C++)if(b[C])for(z=C,W=0;W<m;W++,z+=f)o.pixels.resultPixels[z]=w[M++]}else for(C=0;C<f;C++)if(b[C])for(z=C*m,W=0;W<m;W++)o.pixels.resultPixels[z+W]=w[M++]}else for(C=0;C<f;C++)b[C]&&(o.pixels.resultPixels[C]=w[M++])}return h+=v,o.ptr=h,!0},readHuffmanTree:function(n,o){var a=this.HUFFMAN_LUT_BITS_MAX,c=new DataView(n,o.ptr,16);o.ptr+=16;var h=c.getInt32(0,!0);if(h<2)throw"unsupported Huffman version";var d=c.getInt32(4,!0),m=c.getInt32(8,!0),f=c.getInt32(12,!0);if(m>=f)return!1;var g=new Uint32Array(f-m);e.decodeBits(n,o,g);var v=[],w,b,x,L;for(w=m;w<f;w++)b=w-(w<d?0:d),v[b]={first:g[w-m],second:null};var M=n.byteLength-o.ptr,C=Math.ceil(M/4),W=new ArrayBuffer(C*4),z=new Uint8Array(W);z.set(new Uint8Array(n,o.ptr,M));var D=new Uint32Array(W),X=0,I,K=0;for(I=D[0],w=m;w<f;w++)b=w-(w<d?0:d),L=v[b].first,L>0&&(v[b].second=I<<X>>>32-L,32-X>=L?(X+=L,X===32&&(X=0,K++,I=D[K])):(X+=L-32,K++,I=D[K],v[b].second|=I>>>32-X));var V=0,G=0,k=new t;for(w=0;w<v.length;w++)v[w]!==void 0&&(V=Math.max(V,v[w].first));V>=a?G=a:G=V;var j=[],Y,H,Q,re,ne,le;for(w=m;w<f;w++)if(b=w-(w<d?0:d),L=v[b].first,L>0)if(Y=[L,b],L<=G)for(H=v[b].second<<G-L,Q=1<<G-L,x=0;x<Q;x++)j[H|x]=Y;else for(H=v[b].second,le=k,re=L-1;re>=0;re--)ne=H>>>re&1,ne?(le.right||(le.right=new t),le=le.right):(le.left||(le.left=new t),le=le.left),re===0&&!le.val&&(le.val=Y[1]);return{decodeLut:j,numBitsLUTQick:G,numBitsLUT:V,tree:k,stuffedData:D,srcPtr:K,bitPos:X}},readHuffman:function(n,o,a,c){var h=o.headerInfo,d=h.numDims,m=o.headerInfo.height,f=o.headerInfo.width,g=f*m,v=this.readHuffmanTree(n,o),w=v.decodeLut,b=v.tree,x=v.stuffedData,L=v.srcPtr,M=v.bitPos,C=v.numBitsLUTQick,W=v.numBitsLUT,z=o.headerInfo.imageType===0?128:0,D,X,I,K=o.pixels.resultMask,V,G,k,j,Y,H,Q,re=0;M>0&&(L++,M=0);var ne=x[L],le=o.encodeMode===1,de=new a(g*d),ge=de,fe;if(d<2||le){for(fe=0;fe<d;fe++)if(d>1&&(ge=new a(de.buffer,g*fe,g),re=0),o.headerInfo.numValidPixel===f*m)for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++,H++){if(X=0,V=ne<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ne<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),D=b,Q=0;Q<W;Q++)if(k=V>>>W-Q-1&1,D=k?D.right:D.left,!(D.left||D.right)){X=D.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ne=x[L]),I=X-z,le?(Y>0?I+=re:j>0?I+=ge[H-f]:I+=re,I&=255,ge[H]=I,re=I):ge[H]=I}else for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++,H++)if(K[H]){if(X=0,V=ne<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ne<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),D=b,Q=0;Q<W;Q++)if(k=V>>>W-Q-1&1,D=k?D.right:D.left,!(D.left||D.right)){X=D.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ne=x[L]),I=X-z,le?(Y>0&&K[H-1]?I+=re:j>0&&K[H-f]?I+=ge[H-f]:I+=re,I&=255,ge[H]=I,re=I):ge[H]=I}}else for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++)if(H=j*f+Y,!K||K[H])for(fe=0;fe<d;fe++,H+=g){if(X=0,V=ne<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ne<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),D=b,Q=0;Q<W;Q++)if(k=V>>>W-Q-1&1,D=k?D.right:D.left,!(D.left||D.right)){X=D.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ne=x[L]),I=X-z,ge[H]=I}o.ptr=o.ptr+(L+1)*4+(M>0?4:0),o.pixels.resultPixels=de,d>1&&!c&&(o.pixels.resultPixels=e.swapDimensionOrder(de,g,d,a))},decodeBits:function(n,o,a,c,h){{var d=o.headerInfo,m=d.fileVersion,f=0,g=n.byteLength-o.ptr>=5?5:n.byteLength-o.ptr,v=new DataView(n,o.ptr,g),w=v.getUint8(0);f++;var b=w>>6,x=b===0?4:3-b,L=(w&32)>0,M=w&31,C=0;if(x===1)C=v.getUint8(f),f++;else if(x===2)C=v.getUint16(f,!0),f+=2;else if(x===4)C=v.getUint32(f,!0),f+=4;else throw"Invalid valid pixel count type";var W=2*d.maxZError,z,D,X,I,K,V,G,k,j,Y=d.numDims>1?d.maxValues[h]:d.zMax;if(L){for(o.counter.lut++,k=v.getUint8(f),f++,I=Math.ceil((k-1)*M/8),K=Math.ceil(I/4),D=new ArrayBuffer(K*4),X=new Uint8Array(D),o.ptr+=f,X.set(new Uint8Array(n,o.ptr,I)),G=new Uint32Array(D),o.ptr+=I,j=0;k-1>>>j;)j++;I=Math.ceil(C*j/8),K=Math.ceil(I/4),D=new ArrayBuffer(K*4),X=new Uint8Array(D),X.set(new Uint8Array(n,o.ptr,I)),z=new Uint32Array(D),o.ptr+=I,m>=3?V=r.unstuffLUT2(G,M,k-1,c,W,Y):V=r.unstuffLUT(G,M,k-1,c,W,Y),m>=3?r.unstuff2(z,a,j,C,V):r.unstuff(z,a,j,C,V)}else o.counter.bitstuffer++,j=M,o.ptr+=f,j>0&&(I=Math.ceil(C*j/8),K=Math.ceil(I/4),D=new ArrayBuffer(K*4),X=new Uint8Array(D),X.set(new Uint8Array(n,o.ptr,I)),z=new Uint32Array(D),o.ptr+=I,m>=3?c==null?r.originalUnstuff2(z,a,j,C):r.unstuff2(z,a,j,C,!1,c,W,Y):c==null?r.originalUnstuff(z,a,j,C):r.unstuff(z,a,j,C,!1,c,W,Y))}},readTiles:function(n,o,a,c){var h=o.headerInfo,d=h.width,m=h.height,f=d*m,g=h.microBlockSize,v=h.imageType,w=e.getDataTypeSize(v),b=Math.ceil(d/g),x=Math.ceil(m/g);o.pixels.numBlocksY=x,o.pixels.numBlocksX=b,o.pixels.ptr=0;var L=0,M=0,C=0,W=0,z=0,D=0,X=0,I=0,K=0,V=0,G=0,k=0,j=0,Y=0,H=0,Q=0,re,ne,le,de,ge,fe,Se=new a(g*g),rt=m%g||g,st=d%g||g,ft,He,Re=h.numDims,je,ot=o.pixels.resultMask,Xe=o.pixels.resultPixels,It=h.fileVersion,Bt=It>=5?14:15,Ce,at=h.zMax,pt;for(C=0;C<x;C++)for(z=C!==x-1?g:rt,W=0;W<b;W++)for(D=W!==b-1?g:st,G=C*d*g+W*g,k=d-D,je=0;je<Re;je++){if(Re>1?(pt=Xe,G=C*d*g+W*g,Xe=new a(o.pixels.resultPixels.buffer,f*je*w,f),at=h.maxValues[je]):pt=null,X=n.byteLength-o.ptr,re=new DataView(n,o.ptr,Math.min(10,X)),ne={},Q=0,I=re.getUint8(0),Q++,Ce=h.fileVersion>=5?I&4:0,K=I>>6&255,V=I>>2&Bt,V!==(W*g>>3&Bt)||Ce&&je===0)throw"integrity issue";if(fe=I&3,fe>3)throw o.ptr+=Q,"Invalid block encoding ("+fe+")";if(fe===2){if(Ce)if(ot)for(L=0;L<z;L++)for(M=0;M<D;M++)ot[G]&&(Xe[G]=pt[G]),G++;else for(L=0;L<z;L++)for(M=0;M<D;M++)Xe[G]=pt[G],G++;o.counter.constant++,o.ptr+=Q;continue}else if(fe===0){if(Ce)throw"integrity issue";if(o.counter.uncompressed++,o.ptr+=Q,j=z*D*w,Y=n.byteLength-o.ptr,j=j<Y?j:Y,le=new ArrayBuffer(j%w===0?j:j+w-j%w),de=new Uint8Array(le),de.set(new Uint8Array(n,o.ptr,j)),ge=new a(le),H=0,ot)for(L=0;L<z;L++){for(M=0;M<D;M++)ot[G]&&(Xe[G]=ge[H++]),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)Xe[G++]=ge[H++];G+=k}o.ptr+=H*w}else if(ft=e.getDataTypeUsed(Ce&&v<6?4:v,K),He=e.getOnePixel(ne,Q,ft,re),Q+=e.getDataTypeSize(ft),fe===3)if(o.ptr+=Q,o.counter.constantoffset++,ot)for(L=0;L<z;L++){for(M=0;M<D;M++)ot[G]&&(Xe[G]=Ce?Math.min(at,pt[G]+He):He),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)Xe[G]=Ce?Math.min(at,pt[G]+He):He,G++;G+=k}else if(o.ptr+=Q,e.decodeBits(n,o,Se,He,je),Q=0,Ce)if(ot)for(L=0;L<z;L++){for(M=0;M<D;M++)ot[G]&&(Xe[G]=Se[Q++]+pt[G]),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)Xe[G]=Se[Q++]+pt[G],G++;G+=k}else if(ot)for(L=0;L<z;L++){for(M=0;M<D;M++)ot[G]&&(Xe[G]=Se[Q++]),G++;G+=k}else for(L=0;L<z;L++){for(M=0;M<D;M++)Xe[G++]=Se[Q++];G+=k}}Re>1&&!c&&(o.pixels.resultPixels=e.swapDimensionOrder(o.pixels.resultPixels,f,Re,a))},formatFileInfo:function(n){return{fileIdentifierString:n.headerInfo.fileIdentifierString,fileVersion:n.headerInfo.fileVersion,imageType:n.headerInfo.imageType,height:n.headerInfo.height,width:n.headerInfo.width,numValidPixel:n.headerInfo.numValidPixel,microBlockSize:n.headerInfo.microBlockSize,blobSize:n.headerInfo.blobSize,maxZError:n.headerInfo.maxZError,pixelType:e.getPixelType(n.headerInfo.imageType),eofOffset:n.eofOffset,mask:n.mask?{numBytes:n.mask.numBytes}:null,pixels:{numBlocksX:n.pixels.numBlocksX,numBlocksY:n.pixels.numBlocksY,maxValue:n.headerInfo.zMax,minValue:n.headerInfo.zMin,noDataValue:n.noDataValue}}},constructConstantSurface:function(n,o){var a=n.headerInfo.zMax,c=n.headerInfo.zMin,h=n.headerInfo.maxValues,d=n.headerInfo.numDims,m=n.headerInfo.height*n.headerInfo.width,f=0,g=0,v=0,w=n.pixels.resultMask,b=n.pixels.resultPixels;if(w)if(d>1){if(o)for(f=0;f<d;f++)for(v=f*m,a=h[f],g=0;g<m;g++)w[g]&&(b[v+g]=a);else for(g=0;g<m;g++)if(w[g])for(v=g*d,f=0;f<d;f++)b[v+d]=h[f]}else for(g=0;g<m;g++)w[g]&&(b[g]=a);else if(d>1&&c!==a)if(o)for(f=0;f<d;f++)for(v=f*m,a=h[f],g=0;g<m;g++)b[v+g]=a;else for(g=0;g<m;g++)for(v=g*d,f=0;f<d;f++)b[v+f]=h[f];else for(g=0;g<m*d;g++)b[g]=a},getDataTypeArray:function(n){var o;switch(n){case 0:o=Int8Array;break;case 1:o=Uint8Array;break;case 2:o=Int16Array;break;case 3:o=Uint16Array;break;case 4:o=Int32Array;break;case 5:o=Uint32Array;break;case 6:o=Float32Array;break;case 7:o=Float64Array;break;default:o=Float32Array}return o},getPixelType:function(n){var o;switch(n){case 0:o="S8";break;case 1:o="U8";break;case 2:o="S16";break;case 3:o="U16";break;case 4:o="S32";break;case 5:o="U32";break;case 6:o="F32";break;case 7:o="F64";break;default:o="F32"}return o},isValidPixelValue:function(n,o){if(o==null)return!1;var a;switch(n){case 0:a=o>=-128&&o<=127;break;case 1:a=o>=0&&o<=255;break;case 2:a=o>=-32768&&o<=32767;break;case 3:a=o>=0&&o<=65536;break;case 4:a=o>=-2147483648&&o<=2147483647;break;case 5:a=o>=0&&o<=4294967296;break;case 6:a=o>=-34027999387901484e22&&o<=34027999387901484e22;break;case 7:a=o>=-17976931348623157e292&&o<=17976931348623157e292;break;default:a=!1}return a},getDataTypeSize:function(n){var o=0;switch(n){case 0:case 1:o=1;break;case 2:case 3:o=2;break;case 4:case 5:case 6:o=4;break;case 7:o=8;break;default:o=n}return o},getDataTypeUsed:function(n,o){var a=n;switch(n){case 2:case 4:a=n-o;break;case 3:case 5:a=n-2*o;break;case 6:o===0?a=n:o===1?a=2:a=1;break;case 7:o===0?a=n:a=n-2*o+1;break;default:a=n;break}return a},getOnePixel:function(n,o,a,c){var h=0;switch(a){case 0:h=c.getInt8(o);break;case 1:h=c.getUint8(o);break;case 2:h=c.getInt16(o,!0);break;case 3:h=c.getUint16(o,!0);break;case 4:h=c.getInt32(o,!0);break;case 5:h=c.getUInt32(o,!0);break;case 6:h=c.getFloat32(o,!0);break;case 7:h=c.getFloat64(o,!0);break;default:throw"the decoder does not understand this pixel type"}return h},swapDimensionOrder:function(n,o,a,c,h){var d=0,m=0,f=0,g=0,v=n;if(a>1)if(v=new c(o*a),h)for(d=0;d<o;d++)for(g=d,f=0;f<a;f++,g+=o)v[g]=n[m++];else for(d=0;d<o;d++)for(g=d,f=0;f<a;f++,g+=o)v[m++]=n[g];return v}},t=function(n,o,a){this.val=n,this.left=o,this.right=a},i={decode:function(n,o){o=o||{};var a=o.noDataValue,c=0,h={};if(h.ptr=o.inputOffset||0,h.pixels={},!!e.readHeaderInfo(n,h)){var d=h.headerInfo,m=d.fileVersion,f=e.getDataTypeArray(d.imageType);if(m>5)throw"unsupported lerc version 2."+m;e.readMask(n,h),d.numValidPixel!==d.width*d.height&&!h.pixels.resultMask&&(h.pixels.resultMask=o.maskData);var g=d.width*d.height;h.pixels.resultPixels=new f(g*d.numDims),h.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var v=!o.returnPixelInterleavedDims;if(d.numValidPixel!==0)if(d.zMax===d.zMin)e.constructConstantSurface(h,v);else if(m>=4&&e.checkMinMaxRanges(n,h))e.constructConstantSurface(h,v);else{var w=new DataView(n,h.ptr,2),b=w.getUint8(0);if(h.ptr++,b)e.readDataOneSweep(n,h,f,v);else if(m>1&&d.imageType<=1&&Math.abs(d.maxZError-.5)<1e-5){var x=w.getUint8(1);if(h.ptr++,h.encodeMode=x,x>2||m<4&&x>1)throw"Invalid Huffman flag "+x;x?e.readHuffman(n,h,f,v):e.readTiles(n,h,f,v)}else e.readTiles(n,h,f,v)}h.eofOffset=h.ptr;var L;o.inputOffset?(L=h.headerInfo.blobSize+o.inputOffset-h.ptr,Math.abs(L)>=1&&(h.eofOffset=o.inputOffset+h.headerInfo.blobSize)):(L=h.headerInfo.blobSize-h.ptr,Math.abs(L)>=1&&(h.eofOffset=h.headerInfo.blobSize));var M={width:d.width,height:d.height,pixelData:h.pixels.resultPixels,minValue:d.zMin,maxValue:d.zMax,validPixelCount:d.numValidPixel,dimCount:d.numDims,dimStats:{minValues:d.minValues,maxValues:d.maxValues},maskData:h.pixels.resultMask};if(h.pixels.resultMask&&e.isValidPixelValue(d.imageType,a)){var C=h.pixels.resultMask;for(c=0;c<g;c++)C[c]||(M.pixelData[c]=a);M.noDataValue=a}return h.noDataValue=a,o.returnFileInfo&&(M.fileInfo=e.formatFileInfo(h)),M}},getBandCount:function(n){var o=0,a=0,c={};for(c.ptr=0,c.pixels={};a<n.byteLength-58;)e.readHeaderInfo(n,c),a+=c.headerInfo.blobSize,o++,c.ptr=a;return o}};return i}();var dv=function(){var r=new ArrayBuffer(4),e=new Uint8Array(r),t=new Uint32Array(r);return t[0]=1,e[0]===1}(),fv={decode:function(r,e){if(!dv)throw"Big endian system is not supported.";e=e||{};var t=e.inputOffset||0,i=new Uint8Array(r,t,10),n=String.fromCharCode.apply(null,i),o,a;if(n.trim()==="CntZImage")o=hv,a=1;else if(n.substring(0,5)==="Lerc2")o=uv,a=2;else throw"Unexpected file identifier string: "+n;for(var c=0,h=r.byteLength-10,d,m=[],f,g,v={width:0,height:0,pixels:[],pixelType:e.pixelType,mask:null,statistics:[]},w=0;t<h;){var b=o.decode(r,{inputOffset:t,encodedMaskData:d,maskData:g,returnMask:c===0,returnEncodedMask:c===0,returnFileInfo:!0,returnPixelInterleavedDims:e.returnPixelInterleavedDims,pixelType:e.pixelType||null,noDataValue:e.noDataValue||null});t=b.fileInfo.eofOffset,g=b.maskData,c===0&&(d=b.encodedMaskData,v.width=b.width,v.height=b.height,v.dimCount=b.dimCount||1,v.pixelType=b.pixelType||b.fileInfo.pixelType,v.mask=g),a>1&&(g&&m.push(g),b.fileInfo.mask&&b.fileInfo.mask.numBytes>0&&w++),c++,v.pixels.push(b.pixelData),v.statistics.push({minValue:b.minValue,maxValue:b.maxValue,noDataValue:b.noDataValue,dimStats:b.dimStats})}var x,L,M;if(a>1&&w>1){for(M=v.width*v.height,v.bandMasks=m,g=new Uint8Array(M),g.set(m[0]),x=1;x<m.length;x++)for(f=m[x],L=0;L<M;L++)g[L]=g[L]&f[L];v.maskData=g}return v}};const pv={0:7e3,1:6e3,2:5e3,3:4e3,4:3e3,5:2500,6:2e3,7:1500,8:800,9:500,10:200,11:100,12:40,13:12,14:5,15:2,16:1,17:.5,18:.2,19:.1,20:.01};function mv(r){const{height:e,width:t,pixels:i}=fv.decode(r),n=new Float32Array(e*t);for(let o=0;o<n.length;o++)n[o]=i[0][o];return{array:n,width:t,height:e}}function gv(r,e,t){let i=mv(r);t[2]-t[0]<1&&(i=yv(i,t));const{array:n,width:o}=i,c=new dh(o).createTile(n),h=pv[e]||0;return c.getGeometryData(h)}function yv(r,e){function t(c,h,d,m,f,g,v,w){const b=new Float32Array(f*g);for(let L=0;L<g;L++)for(let M=0;M<f;M++){const C=(L+m)*h+(M+d),W=L*f+M;b[W]=c[C]}const x=new Float32Array(w*v);for(let L=0;L<w;L++)for(let M=0;M<v;M++){const C=L*w+M,W=Math.round(M*g/w),D=Math.round(L*f/v)*f+W;x[C]=b[D]}return x}const i=vv(e,r.width),n=i.sw+1,o=i.sh+1;return{array:t(r.array,r.width,i.sx,i.sy,i.sw,i.sh,n,o),width:n,height:o}}function vv(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),o=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:o}}var _v=Object.defineProperty,wv=(r,e,t)=>e in r?_v(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ss=(r,e,t)=>wv(r,typeof e!="symbol"?e+"":e,t);const bv=10;class xv extends ca{constructor(){super(),Ss(this,"info",{version:"0.10.0",description:"Tile LERC terrain loader. It can load ArcGis-lerc format terrain data."}),Ss(this,"dataType","lerc"),Ss(this,"fileLoader",new p.FileLoader(ze.manager)),Ss(this,"_workerPool",new Qo(0)),this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new cv)}async doLoad(e,t){this._workerPool.pool===0&&this._workerPool.setWorkerLimit(bv);const{z:i,bounds:n}=t,o=await this.fileLoader.loadAsync(e).catch(()=>new Float32Array(256*256)),a=gv(o,i,n);return new Kn().setData(a)}}pa(new xv);const wh="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGModCl7cmV0dXJuIGEodC5kYXRhKX1mdW5jdGlvbiBhKHQpe2Z1bmN0aW9uIG4oZSx1KXtjb25zdCByPXUqNCxbaSxmLGcsbF09ZS5zbGljZShyLHIrNCk7cmV0dXJuIGw9PT0wPzA6LTFlNCsoaTw8MTZ8Zjw8OHxnKSouMX1jb25zdCBvPXQubGVuZ3RoPj4+MixzPW5ldyBGbG9hdDMyQXJyYXkobyk7Zm9yKGxldCBlPTA7ZTxvO2UrKylzW2VdPW4odCxlKTtyZXR1cm4gc31zZWxmLm9ubWVzc2FnZT10PT57Y29uc3Qgbj1jKHQuZGF0YS5pbWdEYXRhKTtzZWxmLnBvc3RNZXNzYWdlKG4pfX0pKCk7Cg==",Mv=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),bh=typeof self<"u"&&self.Blob&&new Blob([Mv(wh)],{type:"text/javascript;charset=utf-8"});function Sv(r){let e;try{if(e=bh&&(self.URL||self.webkitURL).createObjectURL(bh),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+wh,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var Lv=Object.defineProperty,Pv=(r,e,t)=>e in r?Lv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ls=(r,e,t)=>Pv(r,typeof e!="symbol"?e+"":e,t);const Cv=10;class Tv extends ca{constructor(){super(),Ls(this,"info",{version:"0.10.0",description:"Mapbox-RGB terrain loader, It can load Mapbox-RGB terrain data."}),Ls(this,"dataType","terrain-rgb"),Ls(this,"imageLoader",new p.ImageLoader(ze.manager)),Ls(this,"_workerPool",new Qo(0)),this._workerPool.setWorkerCreator(()=>new Sv)}async doLoad(e,t){const i=await this.imageLoader.loadAsync(e).catch(h=>new Image),n=p.MathUtils.clamp((t.z+2)*3,2,64),o=Gv(i,t.bounds,n);let a;this._workerPool.pool===0&&this._workerPool.setWorkerLimit(Cv),a=(await this._workerPool.postMessage({imgData:o},[o.data.buffer])).data;const c=new Kn;return c.setData(a),c}}function Gv(r,e,t){const i=ra(e,r.width);t=Math.min(t,i.sw);const o=new OffscreenCanvas(t,t).getContext("2d");return o.imageSmoothingEnabled=!1,o.drawImage(r,i.sx,i.sy,i.sw,i.sh,0,0,t,t),o.getImageData(0,0,t,t)}pa(new Tv);function Qi(r,e){this.x=r,this.y=e}Qi.prototype={clone(){return new Qi(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,t=r.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),t=Math.sin(r),i=e*this.x-t*this.y,n=t*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(r,e){const t=Math.cos(r),i=Math.sin(r),n=e.x+t*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+t*(this.y-e.y);return this.x=n,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Qi},Qi.convert=function(r){if(r instanceof Qi)return r;if(Array.isArray(r))return new Qi(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Qi(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};class xh{constructor(e,t,i,n,o){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(Wv,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let n,o=1,a=0,c=0,h=0;for(;e.pos<t;){if(a<=0){const d=e.readVarint();o=d&7,a=d>>3}if(a--,o===1||o===2)c+=e.readSVarint(),h+=e.readSVarint(),o===1&&(n&&i.push(n),n=[]),n&&n.push(new Qi(c,h));else if(o===7)n&&n.push(n[0].clone());else throw new Error(`unknown command ${o}`)}return n&&i.push(n),i}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,n=0,o=0,a=0,c=1/0,h=-1/0,d=1/0,m=-1/0;for(;e.pos<t;){if(n<=0){const f=e.readVarint();i=f&7,n=f>>3}if(n--,i===1||i===2)o+=e.readSVarint(),a+=e.readSVarint(),o<c&&(c=o),o>h&&(h=o),a<d&&(d=a),a>m&&(m=a);else if(i!==7)throw new Error(`unknown command ${i}`)}return[c,d,h,m]}toGeoJSON(e,t,i){const n=this.extent*Math.pow(2,i),o=this.extent*e,a=this.extent*t,c=this.loadGeometry();function h(g){return[(g.x+o)*360/n-180,360/Math.PI*Math.atan(Math.exp((1-(g.y+a)*2/n)*Math.PI))-90]}function d(g){return g.map(h)}let m;if(this.type===1){const g=[];for(const w of c)g.push(w[0]);const v=d(g);m=g.length===1?{type:"Point",coordinates:v[0]}:{type:"MultiPoint",coordinates:v}}else if(this.type===2){const g=c.map(d);m=g.length===1?{type:"LineString",coordinates:g[0]}:{type:"MultiLineString",coordinates:g}}else if(this.type===3){const g=Vv(c),v=[];for(const w of g)v.push(w.map(d));m=v.length===1?{type:"Polygon",coordinates:v[0]}:{type:"MultiPolygon",coordinates:v}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:m,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}xh.types=["Unknown","Point","LineString","Polygon"];function Wv(r,e,t){r===1?e.id=t.readVarint():r===2?Zv(t,e):r===3?e.type=t.readVarint():r===4&&(e._geometry=t.pos)}function Zv(r,e){const t=r.readVarint()+r.pos;for(;r.pos<t;){const i=e._keys[r.readVarint()],n=e._values[r.readVarint()];e.properties[i]=n}}function Vv(r){const e=r.length;if(e<=1)return[r];const t=[];let i,n;for(let o=0;o<e;o++){const a=Iv(r[o]);a!==0&&(n===void 0&&(n=a<0),n===a<0?(i&&t.push(i),i=[r[o]]):i&&i.push(r[o]))}return i&&t.push(i),t}function Iv(r){let e=0;for(let t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}let Av=class{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Fv,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new xh(this._pbf,t,this.extent,this._keys,this._values)}};function Fv(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(Ov(t))}function Ov(r){let e=null;const t=r.readVarint()+r.pos;for(;r.pos<t;){const i=r.readVarint()>>3;e=i===1?r.readString():i===2?r.readFloat():i===3?r.readDouble():i===4?r.readVarint64():i===5?r.readVarint():i===6?r.readSVarint():i===7?r.readBoolean():null}if(e==null)throw new Error("unknown feature value");return e}class Dv{constructor(e,t){this.layers=e.readFields(zv,{},t)}}function zv(r,e,t){if(r===3){const i=new Av(t,t.readVarint()+t.pos);i.length&&(e[i.name]=i)}}const ma=65536*65536,Mh=1/ma,Xv=12,Sh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),ga=0,Ps=1,Wr=2,Cs=5;class Uv{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const n=this.readVarint(),o=n>>3,a=this.pos;this.type=n&7,e(o,t,this),this.pos===a&&this.skip(n)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ma;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ma;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,n;return n=t[this.pos++],i=n&127,n<128||(n=t[this.pos++],i|=(n&127)<<7,n<128)||(n=t[this.pos++],i|=(n&127)<<14,n<128)||(n=t[this.pos++],i|=(n&127)<<21,n<128)?i:(n=t[this.pos],i|=(n&15)<<28,kv(i,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Xv&&Sh?Sh.decode(this.buf.subarray(t,e)):e_(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Wr?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===ga)for(;this.buf[this.pos++]>127;);else if(t===Wr)this.pos=this.readVarint()+this.pos;else if(t===Cs)this.pos+=4;else if(t===Ps)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Mh),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Mh),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){Kv(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=t_(this.buf,e,this.pos);const i=this.pos-t;i>=128&&Lh(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const n=this.pos-i;n>=128&&Lh(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,i){this.writeTag(e,Wr),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Yv,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Rv,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Qv,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,jv,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Jv,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Hv,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Ev,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,$v,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,qv,t)}writeBytesField(e,t){this.writeTag(e,Wr),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,Cs),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,Cs),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Ps),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Ps),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,ga),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,ga),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Wr),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,Cs),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Ps),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function kv(r,e,t){const i=t.buf;let n,o;if(o=i[t.pos++],n=(o&112)>>4,o<128||(o=i[t.pos++],n|=(o&127)<<3,o<128)||(o=i[t.pos++],n|=(o&127)<<10,o<128)||(o=i[t.pos++],n|=(o&127)<<17,o<128)||(o=i[t.pos++],n|=(o&127)<<24,o<128)||(o=i[t.pos++],n|=(o&1)<<31,o<128))return Nn(r,n,e);throw new Error("Expected varint not more than 10 bytes")}function Nn(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}function Kv(r,e){let t,i;if(r>=0?(t=r%4294967296|0,i=r/4294967296|0):(t=~(-r%4294967296),i=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Nv(t,i,e),Bv(i,e)}function Nv(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}function Bv(r,e){const t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}function Lh(r,e,t){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(let n=t.pos-1;n>=r;n--)t.buf[n+i]=t.buf[n]}function Yv(r,e){for(let t=0;t<r.length;t++)e.writeVarint(r[t])}function Rv(r,e){for(let t=0;t<r.length;t++)e.writeSVarint(r[t])}function jv(r,e){for(let t=0;t<r.length;t++)e.writeFloat(r[t])}function Jv(r,e){for(let t=0;t<r.length;t++)e.writeDouble(r[t])}function Qv(r,e){for(let t=0;t<r.length;t++)e.writeBoolean(r[t])}function Hv(r,e){for(let t=0;t<r.length;t++)e.writeFixed32(r[t])}function Ev(r,e){for(let t=0;t<r.length;t++)e.writeSFixed32(r[t])}function $v(r,e){for(let t=0;t<r.length;t++)e.writeFixed64(r[t])}function qv(r,e){for(let t=0;t<r.length;t++)e.writeSFixed64(r[t])}function e_(r,e,t){let i="",n=e;for(;n<t;){const o=r[n];let a=null,c=o>239?4:o>223?3:o>191?2:1;if(n+c>t)break;let h,d,m;c===1?o<128&&(a=o):c===2?(h=r[n+1],(h&192)===128&&(a=(o&31)<<6|h&63,a<=127&&(a=null))):c===3?(h=r[n+1],d=r[n+2],(h&192)===128&&(d&192)===128&&(a=(o&15)<<12|(h&63)<<6|d&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):c===4&&(h=r[n+1],d=r[n+2],m=r[n+3],(h&192)===128&&(d&192)===128&&(m&192)===128&&(a=(o&15)<<18|(h&63)<<12|(d&63)<<6|m&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,c=1):a>65535&&(a-=65536,i+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),i+=String.fromCharCode(a),n+=c}return i}function t_(r,e,t){for(let i=0,n,o;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(o)if(n<56320){r[t++]=239,r[t++]=191,r[t++]=189,o=n;continue}else n=o-55296<<10|n-56320|65536,o=null;else{n>56319||i+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):o=n;continue}else o&&(r[t++]=239,r[t++]=191,r[t++]=189,o=null);n<128?r[t++]=n:(n<2048?r[t++]=n>>6|192:(n<65536?r[t++]=n>>12|224:(r[t++]=n>>18|240,r[t++]=n>>12&63|128),r[t++]=n>>6&63|128),r[t++]=n&63|128)}return t}var i_=Object.defineProperty,n_=(r,e,t)=>e in r?i_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ya=(r,e,t)=>n_(r,typeof e!="symbol"?e+"":e,t);class r_ extends ua{constructor(){super(),ya(this,"dataType","mvt"),ya(this,"_loader",new p.FileLoader(ze.manager)),ya(this,"_render",new ph),this._loader.setResponseType("arraybuffer")}async doLoad(e,t){const i=await this._loader.loadAsync(e),n=new Dv(new Uv(i)),o=this.drawTile(n,t.source.style,t.z);return new p.CanvasTexture(o)}drawTile(e,t,i){const c=new OffscreenCanvas(256,256).getContext("2d");if(c){if(t)for(const h in t.layer){const d=t.layer[h];if(t&&(i<(d.minLevel??1)||i>(d.maxLevel??20)))continue;const m=e.layers[h];if(m){const f=256/m.extent;this._renderLayer(c,m,d,f)}}else for(const h in e.layers){const d=e.layers[h],m=256/d.extent;this._renderLayer(c,d,void 0,m)}return c.canvas}else throw new Error("Canvas context is not available")}_renderLayer(e,t,i,n=1){e.save();for(let o=0;o<t.length;o++){const a=t.feature(o);this._renderFeature(e,a,i,n)}return e.restore(),this}_renderFeature(e,t,i={},n=1){const o=[nt.Unknown,nt.Point,nt.Linestring,nt.Polygon][t.type],a={geometry:t.loadGeometry(),properties:t.properties};this._render.render(e,o,a,i,n)}_convertToGeoJSONFeature(e,t){const i=this._convertGeometryToGeoJSON(e.geometry,t);return i?{type:"Feature",geometry:i,properties:e.properties||{},id:e.id}:null}_convertGeometryToGeoJSON(e,t){switch(t){case nt.Point:return this._convertPointGeometry(e);case nt.Linestring:return this._convertLineGeometry(e);case nt.Polygon:return this._convertPolygonGeometry(e);default:return console.warn("未知的几何类型:",t),null}}_convertPointGeometry(e){const t=[];for(const i of e)for(const n of i)t.push([n.x,n.y]);return t.length===0?null:t.length===1?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}_convertLineGeometry(e){const t=[];for(const i of e){const n=[];for(const o of i)n.push([o.x,o.y]);n.length>=2&&t.push(n)}return t.length===0?null:t.length===1?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}_convertPolygonGeometry(e){const t=[];let i=[];for(const n of e){const o=[];for(const a of n)o.push([a.x,a.y]);o.length>=4&&(this._isRingClockwise(o)||i.length===0?(i.length>0&&t.push(i),i=[o]):i.push(o))}return i.length>0&&t.push(i),t.length===0?null:t.length===1?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}_isRingClockwise(e){let t=0;for(let i=0;i<e.length-1;i++){const[n,o]=e[i],[a,c]=e[i+1];t+=(a-n)*(c+o)}return t>0}convertVectorTileToGeoJSON(e){const t=[];for(const i in e.layers){const n=e.layers[i];for(let o=0;o<n.length;o++){const a=n.feature(o),c=[nt.Unknown,nt.Point,nt.Linestring,nt.Polygon][a.type],h={geometry:a.loadGeometry(),properties:a.properties},d=this._convertToGeoJSONFeature(h,c);d&&(d.properties._layer=i,t.push(d))}}return{type:"FeatureCollection",features:t}}}fa(new r_);const Ph="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IF89MjMyODMwNjQzNjUzODY5NjNlLTI2LG09MTIsUD10eXBlb2YgVGV4dERlY29kZXI+InUiP251bGw6bmV3IFRleHREZWNvZGVyKCJ1dGYtOCIpLGc9MCx5PTEsRj0yLHA9NTtjbGFzcyBNe2NvbnN0cnVjdG9yKHQ9bmV3IFVpbnQ4QXJyYXkoMTYp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gaCBpbiBuLmxheWVycyl7Y29uc3QgYT1uLmxheWVyc1toXSxkPVtdO2ZvcihsZXQgdT0wO3U8YS5sZW5ndGg7dSsrKXtjb25zdCBsPWEuZmVhdHVyZSh1KS50b0dlb0pTT04odCxlLHIpO2QucHVzaChsKX1vW2hdPWR9cmV0dXJuIG99c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+e2NvbnN0IHQ9aS5kYXRhO3RyeXtjb25zdCBlPWF3YWl0IEsodC5hcnJheUJ1ZmZlcix0LngsdC55LHQueik7c2VsZi5wb3N0TWVzc2FnZShlKX1jYXRjaChlKXtjb25zb2xlLmVycm9yKCJXb3JrZXIgTVZUIOino+aekOWksei0pToiLGUpLHNlbGYucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfX19KSgpOwo=",s_=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Ch=typeof self<"u"&&self.Blob&&new Blob([s_(Ph)],{type:"text/javascript;charset=utf-8"});function o_(r){let e;try{if(e=Ch&&(self.URL||self.webkitURL).createObjectURL(Ch),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Ph,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var a_=Object.defineProperty,l_=(r,e,t)=>e in r?a_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ts=(r,e,t)=>l_(r,typeof e!="symbol"?e+"":e,t);const c_=10;class h_{constructor(){Ts(this,"info",{version:"1.0.0",description:"Vector Tile loader for Mapbox Vector Tile format. It can load and parse MVT data."}),Ts(this,"dataType","VectorTile"),Ts(this,"fileLoader",new p.FileLoader(ze.manager)),Ts(this,"_workerPool",new Qo(0)),this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new o_)}async load(e){const{source:t,x:i,y:n,z:o}=e,a=typeof t._getUrl=="function"?t._getUrl(i,n,o):this.buildTileUrl(t.url,i,n,o);if(!a)return this.createErrorGeometry(i,n,o,new Error("VectorTileLoader: source._getUrl 返回空 URL"));this._workerPool.pool===0&&this._workerPool.setWorkerLimit(c_);try{const c=await this.fetchVectorData(a),h={arrayBuffer:c,x:i,y:n,z:o},m=(await this._workerPool.postMessage(h,[c])).data;if(m.error)throw new Error(m.error);const f=this.createGeometryWithVectorData(m,e);return ze.manager.parseEnd(a),f}catch(c){return this.createErrorGeometry(i,n,o,c)}}async fetchVectorData(e){try{const t=await this.fileLoader.loadAsync(e);if(!t||t.byteLength===0)throw new Error("Empty response");return t}catch(t){throw new Error(`Failed to fetch vector tile: ${t.message}`)}}calculateTileBounds(e,t,i){const n=4007501668557849e-8/Math.pow(2,i),o=-20037508342789244e-9+e*n,a=o+n,c=20037508342789244e-9-(t+1)*n,h=c+n;return{min:new p.Vector2(o,c),max:new p.Vector2(a,h),world:new p.Vector2(n,n)}}buildTileUrl(e,t,i,n){return e.replace("{x}",t.toString()).replace("{y}",i.toString()).replace("{z}",n.toString()).replace("{-y}",(Math.pow(2,n)-1-i).toString())}createGeometryWithVectorData(e,t){const i=new Kn;return i.userData={vectorData:e,tileInfo:{x:t.x,y:t.y,z:t.z,bounds:t.bounds},metadata:{dataType:"vector-tile",version:"1.0.0",loadedAt:Date.now()}},i}createErrorGeometry(e,t,i,n){const o=new Kn;return o.userData={vectorData:{x:e,y:t,z:i,layers:{},totalFeatures:0,bounds:this.calculateTileBounds(e,t,i),error:n.message,timestamp:Date.now(),dataFormat:"error"},tileInfo:{x:e,y:t,z:i,bounds:[0,0,0,0]},metadata:{dataType:"vector-tile-error",error:!0,errorMessage:n.message}},o}unload(e){e.userData?.vectorData&&(e.userData.vectorData=null),e.dispose&&e.dispose()}static getVectorData(e){return e.userData?.vectorData||null}static hasValidVectorData(e){const t=this.getVectorData(e);return t&&!t.error&&t.totalFeatures>0}static getLayerNames(e){const t=this.getVectorData(e);return t?Object.keys(t.layers||{}):[]}static getFeaturesByLayer(e,t){return this.getVectorData(e)?.layers?.[t]?.convertedFeatures||[]}}yh(new h_);var u_=Object.defineProperty,d_=(r,e,t)=>e in r?u_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hi=(r,e,t)=>d_(r,typeof e!="symbol"?e+"":e,t);class va extends ah{constructor(e,t){if(super(e,t),Hi(this,"layerType","vector"),Hi(this,"_tileDataMap",new Map),Hi(this,"_renderer"),Hi(this,"_style"),Hi(this,"_feaList",[]),Hi(this,"_collision",!1),Hi(this,"_renderAltitude",0),Hi(this,"_eventsBound",!1),!t.style)throw new Error("VectorTileLayer must provide style configuration! VectorTileLayer 必须提供样式配置");this._style=t.style,this._collision=t.collision||!1,this._featureFilter=t.featureFilter,this._renderAltitude=t.altitude||0,this._rootTile.setDataOnlyMode(!0),this._setupDataModeAndListenersForChildren(),this._setupLifeCycleListeners()}_setupDataModeAndListenersForChildren(){const e=t=>{t!==this._rootTile&&t.setDataOnlyMode(!0),this._addShownListenerToTile(t),this._addUnloadListenerToTile(t)};this._rootTile.addEventListener("tile-created",t=>{const i=t.tile;e(i)}),this._rootTile.traverse(t=>{t.isTile&&e(t)})}_addShownListenerToTile(e){const t=i=>{const n=i.tile,o=`${n.z}-${n.x}-${n.y}`,a=!!this._renderer,c=this._tileDataMap.get(o);a&&c&&this._renderer.processTileData(n,c.data)};e.addEventListener("tile-shown",t)}_addUnloadListenerToTile(e){const t=i=>{const n=i.tile||i.target,o=`${n.z}-${n.x}-${n.y}`;if(this._renderer)try{this._renderer.removeFeaturesByTileKey(o)}catch{}this._tileDataMap.delete(o)};e.addEventListener("unload",t)}setAltitude(e){return super.setAltitude(0),this._renderAltitude=e,this._renderer&&this._renderer.setAltitude(e),this}getAltitude(){return this._renderAltitude}_addHiddenListenerToTile(e){const t=i=>{const n=i.tile,o=`${n.z}-${n.x}-${n.y}`;if(this._renderer)try{this._renderer.hideFeaturesByTileKey(o)}catch{}};e.addEventListener("tile-hidden",t)}_setupLifeCycleListeners(){this._rootTile.addEventListener("tile-loaded",e=>{const t=e.tile,i=`${t.z}-${t.x}-${t.y}`,n=this.getVectorDataFromTile(t);if(!n){console.warn(`[VectorTileLayer] Tile ${i} loaded but has no vector data.`);return}if(n.vectorData?.dataFormat==="mvt"&&this._tileDataMap.set(i,{data:n,tile:t,timestamp:Date.now(),pending:!1}),t.showing&&this._renderer&&n.vectorData?.dataFormat==="mvt")try{this._renderer.processTileData(t,n)}catch{}})}getVectorDataFromTile(e){return!e.geometry||!e.getVectorData()?null:e.getVectorData()}createLoader(){const e=new Ms;return e.vtSource=this.source,e}getVisibleVectorTiles(){const e=[];return this._rootTile.traverse(t=>{if(t.isTile&&t.loaded&&t.inFrustum){const i=`${t.z}-${t.x}-${t.y}`,n=this._tileDataMap.get(i);n&&e.push({tileKey:i,data:n.data,tile:n.tile})}}),e}getAllVectorData(){return new Map(this._tileDataMap)}getVectorData(e,t,i){const n=`${i}-${e}-${t}`,o=this._tileDataMap.get(n);return o?o.data:null}setFeatureFilter(e){this._featureFilter=e,this._renderer&&this._renderer.setFeatureFilter(e)}clearFeatureFilter(){this._featureFilter=void 0,this._renderer&&this._renderer.clearFeatureFilter()}setOpacity(e){this.opacity=e,this._renderer&&this._renderer.setOpacity(e)}hide(){return super.hide(),this._renderer&&this._renderer.hide(),this}show(){return super.show(),this._renderer&&this._renderer.show(),this}update(e){!this.enabled||!this.visible||super.update(e)}dispose(){this._renderer&&this._renderer.dispose(),super.dispose()}setFeaturePickingEnabled(e){this.options.enableFeaturePicking=e,this._renderer&&(this._renderer.interactive=e,e&&!this._eventsBound&&this._bindRendererEvents(this._renderer))}_bindRendererEvents(e){if(this._eventsBound)return;["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu"].forEach(i=>{const n="feature"+i;e.on(n,o=>{this.trigger(n,o)})}),this._eventsBound=!0}_setRenderer(e){this._renderer=e,this._eventsBound=!1,this.options.enableFeaturePicking&&this._bindRendererEvents(e)}_getRenderer(){return this._renderer||null}getStyle(){return this._style}setStyle(e){return this._style=e,this._renderer&&(this._renderer.style=e,this._tileDataMap.forEach((i,n)=>{this._renderer.removeFeaturesByTileKey(n)}),this.getVisibleVectorTiles().forEach(({tile:i,data:n})=>{this._renderer.processTileData(i,n)})),this}setSymbol(e){return this.setStyle(e)}}var f_=Object.defineProperty,p_=(r,e,t)=>e in r?f_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Be=(r,e,t)=>p_(r,typeof e!="symbol"?e+"":e,t);class m_{constructor(...e){}}const g_={};let wn=class hf extends jo(Ki(yn(m_))){constructor(e,t){ko(e,"container","Map container element must be specified");const i=["center","basemap"];for(const W of i)yc(t,W);const o={...t,viewer:{...{viewer:{antialias:!0,stencil:!0,logarithmicDepthBuffer:!0}}.viewer,...t.viewer}};super(o),Be(this,"viewer"),Be(this,"tilemap"),Be(this,"center"),Be(this,"prjcenter"),Be(this,"_layerContainer"),Be(this,"_EventMap",{loaded:{listened:!1}}),Be(this,"_canvasManager",new Qg),Be(this,"collisionEngine"),Be(this,"_onLoadHooks"),Be(this,"_minZoom",0),Be(this,"_maxZoom",22),Be(this,"_ZOOM_MIN_CONST",0),Be(this,"_ZOOM_MAX_CONST",22),Be(this,"_minZoomDistance",500),Be(this,"_maxZoomDistance",8e4),Be(this,"_isZooming",!1),Be(this,"_zoomStartValue",0),Be(this,"_lastZoomForControls",0),Be(this,"_overZoom",0),Be(this,"_lastCameraDistance",0),this.tilemap=this.initTileMap(o.basemap),this.center=this.options.center,this.viewer=new Sc(e,{...o.viewer,map:this}),this.tilemap.receiveShadow=!0,this.viewer.scene.add(this.tilemap);const a=this.tilemap.geo2world(new p.Vector3(this.center[0],this.center[1],0));this.prjcenter=a;const c=this.options.viewer??{};this.viewer.flyToPoint({center:this.center,distance:typeof this.center[2]=="number"?this.center[2]:void 0,polarDeg:typeof c.polarDeg=="number"?c.polarDeg:void 0,azimuthDeg:typeof c.azimuthDeg=="number"?c.azimuthDeg:void 0,polarAngle:c.polarAngle,azimuthAngle:c.azimuthAngle,duration:0,curvePath:!1}),this._minZoomDistance=this.viewer.controls.minDistance,this._maxZoomDistance=this.viewer.controls.maxDistance;const h=this._getCameraDistance();this._lastCameraDistance=h,this._layerContainer=new Yg,this.viewer.scene.add(this._layerContainer);const d=this.viewer.controls;this._minZoomDistance=typeof d?.minDistance=="number"?d.minDistance:500,this._maxZoomDistance=typeof d?.maxDistance=="number"?d.maxDistance:8e4;const f=this.tilemap.getLayers().find(W=>W.isBaseLayer===!0)?.minLevel??this.tilemap.minLevel;this._minZoom=Math.max(this._ZOOM_MIN_CONST,Math.min(this._ZOOM_MAX_CONST,f)),this._maxZoom=this._ZOOM_MAX_CONST;const g=this.prjcenter,w=this.viewer.camera.position.clone().clone().sub(g).normalize(),x=ls(t.zoom)?13:t.zoom,L=Math.max(this._minZoom,Math.min(this._maxZoom,x)),M=this._computeDistanceFromZoom(L);a.clone().addScaledVector(w,M);const C=this.getZoom();this._lastZoomForControls=C,this._zoomStartValue=C,this.collisionEngine=new L0(this.viewer.renderer,{padding:8,updateInterval:16,animationDuration:200,maxFeaturesPerFrame:2e4,strategies:{priority:!0,grouping:!0,proximity:!0}}),this.on("control-change",P0.debounce(W=>{if(!this.tilemap||!this.collisionEngine)return;const z=this.tilemap,D=z.getDataZoom(),I=z.getLayers().find(H=>H.isBaseLayer===!0)?.maxLevel??z.maxLevel,K=this._getCameraDistance(),V=K-this._lastCameraDistance;this._lastCameraDistance=K;const{max:G}=this._getViewZoomRange(),k=Math.max(0,G-I);D<I?this._overZoom=0:V<-.001?this._overZoom=Math.min(this._overZoom+1,k):V>.001&&(this._overZoom=Math.max(this._overZoom-1,0));const j=this.getZoom();Math.abs(j-this._lastZoomForControls)>.001&&(this._isZooming?this.trigger("zooming",{from:this._zoomStartValue,to:j}):(this._isZooming=!0,this._zoomStartValue=this._lastZoomForControls,this.trigger("zoomstart",{from:this._zoomStartValue,to:j})),this._lastZoomForControls=j),this.collisionEngine.update(W.camera)},10,{leading:!1,trailing:!0})),this.on("control-end",()=>{this._isZooming&&(this._isZooming=!1,this.trigger("zoomend",{from:this._zoomStartValue,to:this.getZoom()}))}),this._callOnLoadHooks()}static addOnLoadHook(e,...t){const i=typeof e=="function"?e:function(){this[e].apply(this,t)},n=this.prototype;return n._onLoadHooks=n._onLoadHooks||[],n._onLoadHooks.push(i),this}_callOnLoadHooks(){const e=hf.prototype;if(e._onLoadHooks)for(let t=0,i=e._onLoadHooks.length;t<i;t++)e._onLoadHooks[t].call(this)}getZoom(){const e=this.tilemap,t=e.getDataZoom(),n=e.getLayers().find(o=>o.isBaseLayer===!0)?.maxLevel??e.maxLevel;return t<n?t:n+this._overZoom}getDataZoom(){return this.tilemap.getDataZoom()}getMinZoom(){return this._minZoom}getMaxZoom(){return this._maxZoom}setZoomRange(e,t){if(e>t){const n=e;e=t,t=n}this._minZoom=e,this._maxZoom=t;const i=this.viewer.controls;if(i){const n=this._computeDistanceFromZoom(this._maxZoom),o=this._computeDistanceFromZoom(this._minZoom);i.minDistance=n,i.maxDistance=o}return this}setMinZoom(e){return this.setZoomRange(e,this._maxZoom)}setMaxZoom(e){return this.setZoomRange(this._minZoom,e)}setZoom(e){const t=this.getMinZoom(),i=this.getMaxZoom(),n=Math.max(t,Math.min(i,e)),o=this.getZoom(),a=this._computeDistanceFromZoom(n),c=this.viewer.controls,h=c?.target??this.prjcenter,d=this.viewer.camera,m=d.position.clone().sub(h).normalize();return d.position.copy(h).addScaledVector(m,a),d.updateProjectionMatrix(),typeof c?.update=="function"&&c.update(),this._lastZoomForControls=n,this.trigger("zoomend",{from:o,to:this.getZoom()}),this}zoomIn(e=1){return this.setZoom(this.getZoom()+e)}zoomOut(e=1){return this.setZoom(this.getZoom()-e)}_computeDistanceFromZoom(e){const t=this._ZOOM_MIN_CONST,i=this._ZOOM_MAX_CONST,n=this._minZoomDistance,o=this._maxZoomDistance;if(n<=0||n>=o){const m=Math.max(t,Math.min(i,e)),f=(i-m)/(i-t);return n+f*(o-n)}const c=(Math.max(t,Math.min(i,e))-t)/(i-t),h=n/o;return o*Math.pow(h,c)}initTileMap(e){const t=new fs({...e});try{if(e.Baselayers?.length)for(const i of e.Baselayers)i.isBaseLayer=!0,t.addLayer(i)}catch(i){console.error("💥 Diagnostic failed 诊断失败:",i)}return t.rotateX(-Math.PI/2),t.receiveShadow=!0,setTimeout(()=>{const i={timestamp:_c(),targrt:this};this._EventMap.loaded={listened:!0},this.trigger("loaded",i)},0),t}addLayer(e,...t){if(!e)return this;Array.isArray(e)||(e=[e]),t?.length&&(e=e.concat(t)),t?.length&&(e=e.concat(t));for(let i=0,n=e.length;i<n;i++){const o=e[i],a=o.getId();if(ls(a))throw new Error("Invalid id for the layer: "+a);o.isTileLayer?this.addTileLayer(o):this.addRegularLayer(o)}return this}removeLayer(e){const t=typeof e=="string"?e:e.getId(),i=this.tilemap.getLayer(t);if(i){if(i instanceof va){const o=i._getRenderer();o&&this._layerContainer.remove(o)}return this.tilemap.removeLayer(t),!0}const n=this._layerContainer.getLayerById(t);return n?(this._layerContainer.remove(n),n instanceof Bi&&n?._collision,!0):(console.warn(`⚠️ Layer does not exist 图层不存在: ${t}`),!1)}addRegularLayer(e){this._layerContainer.add(e),e._bindMap(this),e instanceof Bi&&e?._collision&&(this.collisionEngine.registerLayer(e),e.setCollisionEngine(this.collisionEngine))}addTileLayer(e){if(this.tilemap.addLayer(e),e._bindMap(this),e instanceof va){const t=e.options||{},i=new bs(e.getId()+"-vtrender",{altitude:e.getAltitude(),style:e.getStyle(),collision:e._collision,zIndex:typeof t.zIndex=="number"?t.zIndex:void 0,depthOffset:typeof t.depthOffset=="number"?t.depthOffset:void 0});t.enableFeaturePicking&&(i.interactive=!0),e._setRenderer(i),this.addRegularLayer(i)}return this}clearLayers(){return this._layerContainer.clear(),this.tilemap.clearLayers(),this}getLayers(){const e=this._layerContainer.getLayers().filter(i=>!(i instanceof bs)),t=this.tilemap.getLayers();return[...e,...t]}getLayerById(e){const t=this._layerContainer.getLayerById(e);return t?t instanceof bs?void 0:t:this.tilemap.getLayer(e)}geo2world(e){return this.tilemap.geo2world(e)}world2geo(e){return this.tilemap.world2geo(e)}geo2map(e){return this.tilemap.geo2map(e)}_getCanvas(e=40,t=30,i){return this._canvasManager.getCanvas(e,t,1,i)}getContainer(){return this.viewer.container}getRenderer(){return this.viewer.renderer}getCamera(){return this.viewer.camera}_findFeaturesAt(e){const t=this,i=t.getRenderer(),n=t.getCamera(),o=i.domElement.getBoundingClientRect(),a=e.x/o.width*2-1,c=-(e.y/o.height)*2+1,h=new p.Raycaster;h.setFromCamera(new p.Vector2(a,c),n);const d=[...t.getLayers(),...t._layerContainer.getLayers().filter(g=>g instanceof bs&&g.interactive)].filter(g=>!g?.isSceneLayer&&g?.visible===!0),f=h.intersectObjects(d,!0).map(g=>{let v=g.object,w=null;for(;v;){if(v instanceof ut){w=v;break}v=v.parent}return!w||w.visible===!1?null:{feature:w,distance:g.distance,object:g.object}}).filter(g=>!!g);return f.length?f.sort((g,v)=>g.distance-v.distance):[]}getCenter(){const e=this.viewer.controls.target.clone(),t=this.world2geo(e);return[t.x,t.y,t.z]}_getEventPosition(e){let t,i;if("touches"in e){if(e.touches.length===0)return null;t=e.touches[0].clientX,i=e.touches[0].clientY}else t=e.clientX,i=e.clientY;const n=this.getContainer();if(!n)return null;const o=n.getBoundingClientRect();return{x:t-o.left,y:i-o.top}}get isInteracting(){return this.viewer?this.viewer.isInteracting:!1}_getCameraDistance(){const e=this.viewer.controls,t=this.viewer.camera,i=e?.target??this.prjcenter;return e&&typeof e.getDistance=="function"?e.getDistance():t.position.distanceTo(i)}_getViewZoomRange(){const e=this.viewer.controls,t=typeof e?.minDistance=="number"?e.minDistance:this._minZoomDistance,i=typeof e?.maxDistance=="number"?e.maxDistance:this._maxZoomDistance;if(t<=0||t>=i){const f=this.tilemap.getDataZoom();return{min:f,max:f}}const n=i/t,o=Math.log2(n),a=this.tilemap.getLayers().find(f=>f.isBaseLayer===!0),c=a?.minLevel??this.tilemap.minLevel,h=a?.maxLevel??this.tilemap.maxLevel,d=c,m=h+o;return{min:d,max:m}}flyTo(e){this.viewer.flyToAdvanced(e)}flyToPoint(e){this.viewer.flyToPoint(e)}destroy(){try{this._clearHandlers(),["control-change","control-start","control-end","zoomstart","zooming","zoomend","loaded"].forEach(t=>{const i=this._listenerMap?.get(t);i&&i.forEach((n,o)=>{this.off(t,o)})}),this.clearLayers(),Zc.clearCache(),this.collisionEngine&&(this.collisionEngine=null),this._layerContainer&&(this._layerContainer.clear(),this._layerContainer=null),this.tilemap&&(this.tilemap.dispose(),this.tilemap=null),this._canvasManager&&(this._canvasManager=null),this.viewer&&(this.viewer.destroy(),this.viewer=null),this._EventMap={loaded:{listened:!1}}}catch(e){console.error("Error destroying map 销毁地图时出错:",e)}}};wn.mergeOptions(g_);const y_=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout"];wn.prototype._removeDomEvents=function(){},wn.prototype._registerDomEvents=function(){const r=this.viewer.container;if(r){let t=null;y_.forEach(i=>{r.addEventListener(i,n=>{if(!this.viewer||!this.tilemap)return;if(i==="mousedown"&&(t={x:n.clientX,y:n.clientY}),i==="click"&&t){const c=n.clientX-t.x,h=n.clientY-t.y;if(Math.sqrt(c*c+h*h)>5)return}let o=na(n,this.tilemap,this.viewer.camera),a={target:this,originEvent:n,eventName:i,screenXY:{X:n.screenX,Y:n.screenY}};if(o){let c=[o.x,o.y,o.z];a={target:this,originEvent:n,coordinate:c,eventName:i,screenXY:{X:n.screenX,Y:n.screenY}}}this.trigger(i,a)})})}},wn.addOnLoadHook("_registerDomEvents");var v_=Object.defineProperty,__=(r,e,t)=>e in r?v_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_a=(r,e,t)=>__(r,typeof e!="symbol"?e+"":e,t);const w_=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchmove","touchend"];class b_ extends cs{constructor(){super(...arguments),_a(this,"_registeredEvents",[]),_a(this,"_mouseDownTime",0),_a(this,"_eventCommon",e=>{(e.type==="mousedown"||e.type==="touchstart")&&(this._mouseDownTime=Date.now()),!(e.type==="click"&&Date.now()-this._mouseDownTime>300)&&this._handleEvent(e,e.type)})}addHooks(){const t=this.target.getContainer();t&&w_.forEach(i=>{t.addEventListener(i,this._eventCommon),this._registeredEvents.push(i)})}removeHooks(){const t=this.target.getContainer();t&&this._registeredEvents.length>0&&(this._registeredEvents.forEach(i=>{const n=i;t.removeEventListener(n,this._eventCommon)}),this._registeredEvents=[])}_handleEvent(e,t){const i=this.target;if(!i||!i.viewer||this._shouldIgnoreEvent(t)||(t==="mousemove"||t==="mouseenter"||t==="mouseleave"||t==="mouseover"||t==="mouseout"||t==="touchmove")&&!i.getLayers().some(h=>!h.isSceneLayer&&h._feaList?.length>0))return;const n=i._getEventPosition(e);if(!n)return;const o=i._findFeaturesAt(n);if(o.length===0)return;const a=o[0].feature;switch(t){case"click":this._handleClickEvent(a,e);break;case"mousemove":case"mouseenter":case"mouseleave":case"mouseover":case"mouseout":case"touchmove":this.handleMoveEvent(a,e);break;default:if(a){this._fireFeatureEvent(a,t,e);const c=a.getLayer();c&&c.trigger("feature"+t,{feature:a,domEvent:e,type:"feature"+t})}}}_handleClickEvent(e,t){if(!e)return;this._fireFeatureEvent(e,"click",t);const i=e.getLayer();i&&i.trigger("featureclick",{feature:e,domEvent:t,type:"featureclick"})}handleMoveEvent(e,t){if(!e)return;this._fireFeatureEvent(e,t.type,t);const i=e.getLayer();i&&i.trigger("feature"+t.type,{feature:e,domEvent:t,type:"feature"+t.type})}_fireFeatureEvent(e,t,i){const n=this.target;if(!n||!n.tilemap||!n.viewer)return;let o=i,a,c;if("touches"in i){const f=i.touches[0]||i.changedTouches[0];if(!f)return;o={currentTarget:i.currentTarget,clientX:f.clientX,clientY:f.clientY},a=f.screenX,c=f.screenY}else{const f=i;o=f,a=f.screenX,c=f.screenY}const h=na(o,n.tilemap,n.viewer.camera);if(!h)return;const d=[h.x,h.y,h.z],m={target:e,originEvent:i,coordinate:d,eventName:t,screenXY:{X:a,Y:c}};e.trigger(t,m)}_shouldIgnoreEvent(e){const t=this.target;return t.viewer?e==="mousedown"||e==="touchstart"?!1:!!t.isInteracting:!0}}wn.mergeOptions({FeatureEvents:!0,onlyVisibleFeatureEvents:!0}),wn.addOnLoadHook("addHandler","FeatureEvents",b_);var x_=Object.defineProperty,M_=(r,e,t)=>e in r?x_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_i=(r,e,t)=>M_(r,typeof e!="symbol"?e+"":e,t);let S_=class{constructor(...e){}};const Th=class hr extends Ki(yn(S_)){constructor(e={}){super(e),_i(this,"_owner"),_i(this,"_map"),_i(this,"_worldPosition"),_i(this,"_coordinate"),_i(this,"_dom"),_i(this,"_visible",!1),_i(this,"_boundMapHandlers",new Map),_i(this,"_viewerUpdateHandler"),_i(this,"_positionedOnce",!1)}_getClassName(){return"UIComponent"}getOffset(){return{x:this.options.dx??0,y:this.options.dy??0}}addTo(e){if(!e)return this;this._owner=e;const t=typeof e.getMap=="function"?e.getMap():e;return t?(this._map=t,this._bindMapEvents(!0),this.options.single&&(hr._singletons.forEach(i=>{i!==this&&i.options.single&&i._map===t&&i.hide()}),hr._singletons.add(this)),this.onAdd&&this.onAdd(),this.trigger("add",{owner:e,map:t}),this):this}remove(){const e=this._map;return this.hideDom(),this._bindMapEvents(!1),this.options.single&&hr._singletons.delete(this),this.onRemove&&this.onRemove(),this.trigger("remove",{owner:this._owner,map:e}),this._owner=void 0,this._map=void 0,this}show(e){const t=this._map??(this._owner&&typeof this._owner.getMap=="function"?this._owner.getMap():void 0);if(!t)return this;if(this._map=t,this.options.single&&(hr._singletons.forEach(i=>{i!==this&&i.options.single&&i._map===t&&i.isVisible()&&i.hide()}),hr._singletons.add(this)),!this._dom){const i=this.buildOn();this._dom=i,i.style.position="absolute",typeof this.options.zIndex=="number"&&(i.style.zIndex=String(this.options.zIndex));const n=t.getContainer();if(!n)return this;n.appendChild(i)}return this._coordinate=e?[...e]:void 0,this._visible=!0,this._positionedOnce=!1,this._dom&&(this._dom.style.display="none"),this.trigger("show",{owner:this._owner,map:t}),this}hide(){return this._visible=!1,this._dom&&(this._dom.style.display="none"),this._coordinate=void 0,this.trigger("hide",{owner:this._owner,map:this._map}),this}hideDom(){return this._dom&&this._dom.parentElement&&(this._dom.parentElement.removeChild(this._dom),this.onDomRemove&&this.onDomRemove()),this._dom=void 0,this._visible=!1,this._coordinate=void 0,this}getMap(){return this._map}isVisible(){return this._visible}_bindMapEvents(e){const t=this._map;if(!t)return;const i=t,n=e?"on":"off",o=(a,c)=>{e?this._boundMapHandlers.set(a,c):this._boundMapHandlers.delete(a)};if(e){const a=()=>{this._visible&&this._updatePosition()};i[n]("control-change",a),o("control-change",a);const c=t.viewer;if(c&&!this._viewerUpdateHandler){const h=()=>{this._visible&&this._updatePosition()};this._viewerUpdateHandler=h,c.addEventListener("update",h)}}else{this._boundMapHandlers.forEach((c,h)=>{i[n](h,c)}),this._boundMapHandlers.clear();const a=t.viewer;a&&this._viewerUpdateHandler&&(a.removeEventListener("update",this._viewerUpdateHandler),this._viewerUpdateHandler=void 0)}}_resolveWorldPosition(){const e=this._map;if(!e)return;if(this._coordinate){const[i,n,o=0]=this._coordinate,a=new p.Vector3(i,n,o);return e.geo2world(a)}const t=this._owner;if(t&&t._geometry){const i=t._geometry;if(i&&(i.type==="Point"||i.type==="MultiPoint")){let n;if(i.type==="Point"?n=i.coordinates:i.type==="MultiPoint"&&Array.isArray(i.coordinates)&&i.coordinates.length>0&&(n=i.coordinates[0]),n&&n.length>=2){const o=new p.Vector3(n[0],n[1],n[2]??0);return e.geo2world(o)}}if(t._threeGeometry&&typeof t._threeGeometry.getWorldPosition=="function"){const n=new p.Vector3;if(t._threeGeometry.getWorldPosition(n),!(n.x===0&&n.y===0&&n.z===0))return n}if(t._position instanceof p.Vector3){const n=t._position;if(!(n.x===0&&n.y===0&&n.z===0))return n.clone()}}if(t&&typeof t.getWorldPosition=="function"){const i=new p.Vector3;return t.getWorldPosition(i),i}return e.prjcenter?.clone?.()??void 0}_updatePosition(){if(!this._dom||!this._map)return;if(this._visible){const h=this._resolveWorldPosition();if(!h){this._dom.style.display="none";return}this._worldPosition=h}if(!this._worldPosition)return;const e=this._map.viewer,t=e.camera,i=this._dom.style.display==="none";i&&(this._dom.style.visibility="hidden",this._dom.style.display=""),t.updateMatrixWorld();const n=this._worldPosition.clone().project(t);if(n.x<-1.1||n.x>1.1||n.y<-1.1||n.y>1.1||n.z<-1||n.z>1){this._dom.style.display="none",i&&(this._dom.style.visibility="");return}const o=(n.x*.5+.5)*e.width,a=(-n.y*.5+.5)*e.height,c=this.getOffset();if(this._dom.style.left=`${o+c.x}px`,this._dom.style.top=`${a+c.y}px`,i&&(this._dom.style.visibility=""),!this._positionedOnce){this._positionedOnce=!0,this._dom.style.display="none";return}this._dom.style.display=""}};_i(Th,"_singletons",new Set);let Gh=Th;var L_=Object.defineProperty,P_=(r,e,t)=>e in r?L_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wh=(r,e,t)=>P_(r,typeof e!="symbol"?e+"":e,t);class wa extends Gh{constructor(e){super({single:!0,...e}),Wh(this,"_titleEl"),Wh(this,"_contentEl")}_getClassName(){return"InfoWindow"}buildOn(){if(this.options.custom){let c;this.options.content instanceof HTMLElement?c=this.options.content:(c=document.createElement("div"),typeof this.options.content=="string"&&(c.innerHTML=this.options.content));const h=this.options.containerClass;return h&&(Array.isArray(h)?h:[h]).forEach(m=>{c.classList.add(m)}),this.options.minWidth&&(c.style.minWidth=`${this.options.minWidth}px`),this.options.minHeight&&(c.style.minHeight=`${this.options.minHeight}px`),this._titleEl=void 0,this._contentEl=c,c}const e=document.createElement("div");e.className="terra-infowindow";const t=this.options.containerClass;t&&(Array.isArray(t)?t:[t]).forEach(h=>{e.classList.add(h)}),typeof this.options.zIndex=="number"&&(e.style.zIndex=String(this.options.zIndex)),this.options.minWidth&&(e.style.minWidth=`${this.options.minWidth}px`),this.options.minHeight&&(e.style.minHeight=`${this.options.minHeight}px`);const i=document.createElement("div");i.className="terra-infowindow-header";const n=document.createElement("div");n.className="terra-infowindow-title",this.options.title&&(n.innerText=this.options.title);const o=document.createElement("span");o.className="terra-infowindow-close",o.innerHTML="×",o.title="关闭",o.addEventListener("click",c=>{c.stopPropagation(),c.preventDefault(),this.close()}),o.addEventListener("mousedown",c=>{c.preventDefault()}),o.style.cursor="pointer",o.style.userSelect="none",i.appendChild(n),i.appendChild(o);const a=document.createElement("div");return a.className="terra-infowindow-content",this.options.content instanceof HTMLElement?a.appendChild(this.options.content):typeof this.options.content=="string"&&(a.innerHTML=this.options.content),e.appendChild(i),e.appendChild(a),this._titleEl=n,this._contentEl=a,e}getOffset(){const e=super.getOffset(),t=this._dom;if(!t)return e;const i=t.offsetWidth,n=t.offsetHeight,o=10;let a=e.x-i/2,c=e.y-n-o;const h=this._owner,d=this.getMap();if(h&&typeof h.getStyle=="function"&&d?.viewer){const f=h.getStyle?.()?.config,g=f?.type;if(f&&(g==="icon-point"||g==="icon-label-point")){const v=Array.isArray(f.anchor)?f.anchor:[.5,.5],w=typeof v[1]=="number"?v[1]:.5;let b=0;const x=h._threeGeometry;if(x&&x instanceof p.Sprite&&(b=this._getSpriteScreenHeight(x,d.viewer)),b<=0){let L=0;if(g==="icon-point"){const M=f.size;Array.isArray(M)?L=M[1]:typeof M=="number"&&(L=M)}else if(g==="icon-label-point"){const M=f.size??f.iconSize;Array.isArray(M)?L=M[1]:typeof M=="number"&&(L=M)}b=L*(1-w)}else b=b*(1-w);b>0&&(c-=b)}}return{x:a,y:c}}_getSpriteScreenHeight(e,t){try{const i=t.camera,n=t.renderer;if(!i||!n)return 0;const o=t.height||n.domElement.clientHeight;if(!(e.material.sizeAttenuation!==!1)){const z=i.projectionMatrix.elements[5];return e.scale.y*z*o/2}const h=new p.Vector3;e.getWorldPosition(h);const d=i.position.clone(),m=h.clone().sub(d).normalize(),f=new p.Vector3;f.crossVectors(i.up,m).normalize();const g=new p.Vector3;g.crossVectors(m,f).normalize();const v=e.scale.y*(1-e.center.y),w=e.scale.y*e.center.y,b=h.clone().add(g.clone().multiplyScalar(v)),x=h.clone().sub(g.clone().multiplyScalar(w)),L=b.clone().project(i),M=x.clone().project(i),C=(-L.y*.5+.5)*o,W=(-M.y*.5+.5)*o;return Math.abs(W-C)}catch(i){return console.warn("Failed to calculate sprite screen height: // 计算 sprite 屏幕高度失败:",i),0}}setTitle(e){return this.options.title=e,this._titleEl&&(this._titleEl.innerText=e??""),this}setContent(e){return this.options.content=e,this._contentEl?(this._contentEl.innerHTML="",e instanceof HTMLElement?this._contentEl.appendChild(e):this._contentEl.innerHTML=e,this):this}open(e){super.show(e);const t=this,i=()=>{!t._dom||!t._map||!t._visible||(t._positionedOnce=!0,t._updatePosition())},o=this.getMap()?.viewer;if(o&&typeof o.addEventListener=="function"){const a=()=>{o.removeEventListener("update",a),i()};o.addEventListener("update",a)}else requestAnimationFrame(i);return this}close(){return this.hide()}}ut.include({setInfoWindow(r){this.removeInfoWindow();let e;return r instanceof wa?e=r:e=new wa(r),this._infoWindow=e,this.getMap()&&e.addTo(this),this},getInfoWindow(){return this._infoWindow},openInfoWindow(r){const e=this._infoWindow;return e?(e.getMap()||this.getMap()&&e.addTo(this),requestAnimationFrame(()=>{e.open(r)}),this):this},closeInfoWindow(){return this._infoWindow&&this._infoWindow.close(),this},removeInfoWindow(){return this._infoWindow&&(this._infoWindow.remove(),this._infoWindow=void 0),this}});var C_=Object.defineProperty,T_=(r,e,t)=>e in r?C_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ba=(r,e,t)=>T_(r,typeof e!="symbol"?e+"":e,t);class G_{constructor(...e){}}class Zh extends Ki(yn(G_)){constructor(e={}){super(e),ba(this,"_map"),ba(this,"_enabled",!1),ba(this,"_boundHandlers",new Map)}addTo(e){if(!e)return this;const t=e;return t._activeMapTool&&t._activeMapTool!==this&&t._activeMapTool.disable(),t._activeMapTool=this,this._map=e,this.onAdd&&this.onAdd(),this.enable(),this.trigger("add",{map:e}),this}getMap(){return this._map}enable(){return!this._map||this._enabled?this:(this._enabled=!0,this._bindEvents(),this.onEnable&&this.onEnable(),this.trigger("enable",{map:this._map}),this)}disable(){return!this._map||!this._enabled?this:(this._enabled=!1,this._unbindEvents(),this.onDisable&&this.onDisable(),this.trigger("disable",{map:this._map}),this)}isEnabled(){return!!this._enabled}remove(){if(!this._map)return this;this.disable();const e=this._map;return e._activeMapTool===this&&delete e._activeMapTool,this._map=void 0,this.trigger("remove"),this}_bindEvents(){const e=this._map;if(!e)return;const t=this.getEvents()||{};Object.keys(t).forEach(i=>{const n=t[i];if(!n)return;const o=a=>n.call(this,a);this._boundHandlers.set(i,o),e.on(i,o)})}_unbindEvents(){const e=this._map;e&&(this._boundHandlers.forEach((t,i)=>{e.off(i,t)}),this._boundHandlers.clear())}}var W_=Object.defineProperty,Z_=(r,e,t)=>e in r?W_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zr=(r,e,t)=>Z_(r,typeof e!="symbol"?e+"":e,t);class V_ extends Bi{constructor(e){super(e,{altitude:1})}validateFeature(e){return!!e}}const Vh={};class Bn extends Zh{constructor(e){super(e),Zr(this,"_modeDef"),Zr(this,"_clickCoords",[]),Zr(this,"_isDrawing",!1),Zr(this,"_geometry"),Zr(this,"_draftLayer"),this.options.once=this.options.once??!1,this._ensureMode()}static registerMode(e,t){Vh[e.toLowerCase()]=t}static getModeDefinition(e){return Vh[e.toLowerCase()]}getMode(){return(this.options.mode||"").toLowerCase()}setMode(e){return this._finishDrawingSilently(),this.options.mode=e,this._ensureMode(),this}setStyle(e){return e.geometryStyle!==void 0&&(this.options.geometryStyle=e.geometryStyle),Object.prototype.hasOwnProperty.call(e,"vertexStyle")&&(this.options.vertexStyle=e.vertexStyle??null),this}getEvents(){return{click:this._handleClick.bind(this),mousemove:this._handleMouseMove.bind(this),dblclick:this._handleDblClick.bind(this)}}onEnable(){this._ensureMode()}onDisable(){this._finishDrawingSilently(),this._destroyDraftLayer()}_ensureMode(){const e=this.getMode(),t=Bn.getModeDefinition(e);if(!t)throw new Error(`DrawTool: mode "${e}" 未注册,请先调用 DrawTool.registerMode`);this._modeDef=t}_handleClick(e){if(!this._modeDef||!e.coordinate)return;const t=e.coordinate,i=this._modeDef,n={...e,drawTool:this};this._isDrawing?(this._clickCoords.push(t),i.update(this._clickCoords,this._geometry,n),this.trigger("drawvertex",{coordinate:t,geometry:this._geometry,coords:[...this._clickCoords],originEvent:n})):(this._isDrawing=!0,this._clickCoords=[t],this._geometry=i.create(t,n),this.trigger("drawstart",{coordinate:t,geometry:this._geometry,coords:[...this._clickCoords],originEvent:n})),i.clickLimit&&this._clickCoords.length>=i.clickLimit&&this._finishDrawing(n)}_handleMouseMove(e){if(!this._modeDef||!this._isDrawing||!e.coordinate)return;const t=this._modeDef,i=[...this._clickCoords,e.coordinate],n={...e,drawTool:this};t.update(i,this._geometry,n),this.trigger("drawing",{coordinate:e.coordinate,geometry:this._geometry,coords:i,originEvent:n})}_handleDblClick(e){if(!this._modeDef||!this._isDrawing)return;const t={...e,drawTool:this};this._finishDrawing(t)}_finishDrawing(e){if(!this._modeDef||!this._isDrawing)return;const i=this._modeDef.generate(this._geometry,[...this._clickCoords]);this.trigger("drawend",{geometry:i,coords:[...this._clickCoords],originEvent:e}),this._isDrawing=!1,this._clickCoords=[],this._geometry=void 0,this.options.once&&this.disable()}_finishDrawingSilently(){this._isDrawing=!1,this._clickCoords=[],this._geometry=void 0}_getOrCreateDraftLayer(){if(this._draftLayer)return this._draftLayer;const e=this.getMap();if(!e)throw new Error("DrawTool: 尚未绑定地图,请先调用 addTo(map)");const t=`__draw_draft_${Date.now().toString(36)}`,i=new V_(t);return e.addLayer(i),this._draftLayer=i,i}_destroyDraftLayer(){const e=this.getMap();e&&this._draftLayer&&e.removeLayer(this._draftLayer.getId()),this._draftLayer=void 0}}const I_={actions:["click","mousemove"],create(r,e){const t=e.drawTool,i=t._getOrCreateDraftLayer(),n=Ei(t.options.geometryStyle,{type:"basic-point",size:10,color:"#00ffff"}),o={type:"Point",coordinates:r},a=new Pi({geometry:o,style:n});return a.addTo(i),a.initializeGeometry(),{tool:t,draftLayer:i,draftMarker:a}},update(r,e,t){const i=e?.draftMarker;if(!i)return;const n=r[r.length-1];i._geometry={type:"Point",coordinates:n},i._position=i._coordsTransform(),i._toThreeJSGeometry&&i._toThreeJSGeometry()},generate(r,e){const t=r.tool;if(!e.length)return null;r.draftMarker&&(r.draftMarker._remove(),r.draftMarker=null);const i=Ei(t.options.geometryStyle,{type:"basic-point",size:10,color:"#00ffff"}),n=e[e.length-1];return new Pi({geometry:{type:"Point",coordinates:n},style:i})},clickLimit:1},A_={actions:["click","mousemove","dblclick"],create(r,e){const t=e.drawTool,i=t._getOrCreateDraftLayer(),n=Ei(t.options.geometryStyle,{type:"basic-line",color:"#ff0000",width:2}),o=t.options.vertexStyle===null?void 0:Ei(t.options.vertexStyle,{type:"basic-point",size:8,color:"#00ffff"}),a={type:"LineString",coordinates:[r]},c=new St({geometry:a,style:n});c.addTo(i);const h=[];if(o){const d={type:"Point",coordinates:r},m=new Pi({geometry:d,style:o});m.addTo(i),h.push(m)}return{tool:t,draftLayer:i,draftLine:c,draftAnchors:h,lineStyle:n,vertexStyle:o}},update(r,e,t){if(!e)return;const i=e.draftLayer;if(!r||r.length<2)return;e.draftLine&&(e.draftLine._remove(),e.draftLine=null);const n={type:"LineString",coordinates:r},o=new St({geometry:n,style:e.lineStyle});if(o.addTo(i),e.draftLine=o,t.eventName==="click"&&e.vertexStyle){const c={type:"Point",coordinates:r[r.length-1]},h=new Pi({geometry:c,style:e.vertexStyle});h.addTo(i),e.draftAnchors.push(h)}},generate(r,e){const t=r.tool;if(!e.length)return null;if(r.draftLine&&(r.draftLine._remove(),r.draftLine=null),Array.isArray(r.draftAnchors)){for(const o of r.draftAnchors)o?._remove();r.draftAnchors=[]}const i=Ei(t.options.geometryStyle,{type:"basic-line",color:"#ff0000",width:2});return new St({geometry:{type:"LineString",coordinates:e},style:i})}},F_={actions:["click","mousemove","dblclick"],create(r,e){const t=e.drawTool,i=t._getOrCreateDraftLayer(),n=Ei(t.options.geometryStyle,{type:"basic-polygon",color:"#00ff00",opacity:.5}),o=t.options.vertexStyle===null?void 0:Ei(t.options.vertexStyle,{type:"basic-point",size:8,color:"#00ffff"}),a=[];if(o){const c={type:"Point",coordinates:r},h=new Pi({geometry:c,style:o});h.addTo(i),h.initializeGeometry(),a.push(h)}return{tool:t,draftLayer:i,draftPolygon:null,draftEdgeLine:null,draftAnchors:a,polygonStyle:n,vertexStyle:o}},update(r,e,t){if(!e)return;const i=e.draftLayer;if(t.eventName==="click"&&e.vertexStyle){const m={type:"Point",coordinates:r[r.length-1]},f=new Pi({geometry:m,style:e.vertexStyle});f.addTo(i),f.initializeGeometry(),e.draftAnchors.push(f)}if(!r||r.length<2){e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null),e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null);return}if(r.length===2){e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null),e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null);const d={type:"LineString",coordinates:r},m=e.polygonStyle?.config&&e.polygonStyle.config.color||"#00ff00",f=new Mt({type:"basic-line",color:m,width:2}),g=new St({geometry:d,style:f});g.addTo(i),e.draftEdgeLine=g;return}e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null);const n=r.slice(),o=n[0],a=n[n.length-1];(o[0]!==a[0]||o[1]!==a[1]||(o[2]||0)!==(a[2]||0))&&n.push(o),e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null);const c={type:"Polygon",coordinates:[n]},h=new vi({geometry:c,style:e.polygonStyle});h.addTo(i),e.draftPolygon=h},generate(r,e){const t=r.tool;if(e.length<3)return null;if(r.draftPolygon&&(r.draftPolygon._remove(),r.draftPolygon=null),r.draftEdgeLine&&(r.draftEdgeLine._remove(),r.draftEdgeLine=null),Array.isArray(r.draftAnchors)){for(const h of r.draftAnchors)h?._remove();r.draftAnchors=[]}const i=Ei(t.options.geometryStyle,{type:"basic-polygon",color:"#00ff00",opacity:.5}),n=e.slice(),o=n[0],a=n[n.length-1];return(o[0]!==a[0]||o[1]!==a[1]||(o[2]||0)!==(a[2]||0))&&n.push(o),new vi({geometry:{type:"Polygon",coordinates:[n]},style:i})}};Bn.registerMode("point",I_),Bn.registerMode("line",A_),Bn.registerMode("polygon",F_);function Ei(r,e){return Mt.create(r||e)}var O_=Object.defineProperty,D_=(r,e,t)=>e in r?O_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ri=(r,e,t)=>D_(r,typeof e!="symbol"?e+"":e,t);class z_ extends ni{constructor(e){if(super(e),ri(this,"dataType","image"),ri(this,"attribution","天地图"),ri(this,"token",""),ri(this,"style","img_w"),ri(this,"subdomains","01234"),ri(this,"url","https://t{s}.tianditu.gov.cn/DataServer?T={style}&x={x}&y={y}&l={z}&tk={token}"),Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}class X_ extends ni{constructor(e){if(super(e),ri(this,"dataType","quantized-mesh"),ri(this,"attribution","天地图"),ri(this,"token",""),ri(this,"subdomains","01234"),ri(this,"url","https://t{s}.tianditu.gov.cn/mapservice/swdx?T=elv_c&tk={token}&x={x}&y={y}&l={z}"),Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}var U_=Object.defineProperty,k_=(r,e,t)=>e in r?U_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ih=(r,e,t)=>k_(r,typeof e!="symbol"?e+"":e,t);class K_ extends ni{constructor(e){super({...e,url:e.urlTemplate,isTMS:e.isTMS||!1}),Ih(this,"minLevel",2),Ih(this,"maxLevel",24)}getUrl(e,t,i){const n=this.isTMS?Math.pow(2,i)-1-t:t;return dm(this.url,{...this,x:e,y:n,z:i,tileMatrix:i,tileRow:n,tileCol:e})}}var N_=Object.defineProperty,B_=(r,e,t)=>e in r?N_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ci=(r,e,t)=>B_(r,typeof e!="symbol"?e+"":e,t);class Y_ extends ni{constructor(e){super(e),Ci(this,"dataType","image"),Ci(this,"attribution","ArcGIS"),Ci(this,"style","World_Imagery"),Ci(this,"url","https://services.arcgisonline.com/arcgis/rest/services/{style}/MapServer/tile/{z}/{y}/{x}"),Object.assign(this,e)}}class R_ extends ni{constructor(e){super(e),Ci(this,"dataType","lerc"),Ci(this,"attribution","ArcGIS"),Ci(this,"minLevel",6),Ci(this,"maxLevel",13),Ci(this,"url","https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/{z}/{y}/{x}"),Object.assign(this,e)}}var j_=Object.defineProperty,J_=(r,e,t)=>e in r?j_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yn=(r,e,t)=>J_(r,typeof e!="symbol"?e+"":e,t);class Q_ extends ni{constructor(e){if(super(e),Yn(this,"token",""),Yn(this,"format","webp"),Yn(this,"style","cm2myr6qx001t01pi0sf7estf"),Yn(this,"attribution","MapBox"),Yn(this,"maxLevel",25),Yn(this,"url","https://api.mapbox.com/styles/v1/criska/cm2myr6qx001t01pi0sf7estf/tiles/256/{z}/{x}/{y}?access_token={token}&format={format}"),Object.assign(this,e),!this.token)throw new Error("MapBox访问令牌(token)是必填参数")}}var H_=Object.defineProperty,E_=(r,e,t)=>e in r?H_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ah=(r,e,t)=>E_(r,typeof e!="symbol"?e+"":e,t);class $_ extends ni{constructor(e){super(e),Ah(this,"dataType","mvt"),Ah(this,"style",{layer:[]}),Object.assign(this,e)}}var q_=Object.defineProperty,ew=(r,e,t)=>e in r?q_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Vr=(r,e,t)=>ew(r,typeof e!="symbol"?e+"":e,t);class tw extends ni{constructor(e){super(e),Vr(this,"dataType","VectorTile"),Vr(this,"attribution","ArcGIS"),Vr(this,"minLevel",1),Vr(this,"maxLevel",21),Vr(this,"url","https://api.maptiler.com/tiles/v3/{z}/{x}/{y}.pbf?key=uKYsZQZpm72WlbSgH9B7"),Object.assign(this,e)}}class iw extends Bi{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Line"}}class nw extends Bi{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Point"}}class rw extends Bi{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Surface"}}var sw=Object.defineProperty,ow=(r,e,t)=>e in r?sw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,aw=(r,e,t)=>ow(r,e+"",t);class lw extends Bi{constructor(e,t){super(e,t),aw(this,"_clouds",null);const i=["texture"];for(const n of i)yc(t,n);this._createClouds(t.texture)}async _createClouds(e){const t=await Mt._loadTexture(e),i=new cg({texture:t,material:p.MeshBasicMaterial});i.castShadow=!0,this._clouds=i}validateFeature(e){return e._type==="Cloud"}animate(e,t){this._clouds&&this._clouds.update(this.map.viewer.camera,t,e)}}var cw=Object.defineProperty,hw=(r,e,t)=>e in r?cw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,uw=(r,e,t)=>hw(r,e+"",t);class dw extends ah{constructor(e,t){super(e,t),uw(this,"layerType","raster")}createLoader(){const e=new Ms;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}}var fw=Object.defineProperty,pw=(r,e,t)=>e in r?fw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gs=(r,e,t)=>pw(r,typeof e!="symbol"?e+"":e,t);class mw extends dw{constructor(e,t){super(e,t),Gs(this,"layerType","wmts"),Gs(this,"_layerName"),Gs(this,"_style"),Gs(this,"_matrixSet"),this._layerName=t.layerName,this._style=t.style||"default",this._matrixSet=t.matrixSet||"GoogleMapsCompatible"}get layerName(){return this._layerName}get style(){return this._style}get matrixSet(){return this._matrixSet}createLoader(){const e=new Ms;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}update(e){this.loader&&super.update(e)}}console.log("%c✨ terra.gl V"+df+" ","color:rgb(255, 255, 255); font-weight: bold; background: linear-gradient(90deg, #ffb6c1, #ff69b4); padding: 5px; border-radius: 5px;"),q.ArcGisDemSource=R_,q.ArcGisSource=Y_,q.CloudsLayer=lw,q.DrawTool=Bn,q.EventClass=Ko,q.Feature=ut,q.ICloud=nh,q.InfoWindow=wa,q.Label=rh,q.LineLayer=iw,q.LineString=St,q.LoaderFactory=ze,q.MVTGeoSource=tw,q.MVTSource=$_,q.Map=wn,q.MapBoxSource=Q_,q.MapTool=Zh,q.Marker=Pi,q.Martini=dh,q.Model=ih,q.MultiLineString=th,q.PointLayer=nw,q.Polygon=vi,q.PolygonLayer=rw,q.ProjectFactory=Qm,q.PromiseWorker=Ty,q.Style=Mt,q.TDTQMSource=X_,q.TDTSource=z_,q.TPoints=oh,q.Tile=Ni,q.TileCanvasLoader=Hy,q.TileGeometry=Kn,q.TileGeometryLoader=ca,q.TileLoader=Ms,q.TileLoadingManager=lh,q.TileMap=fs,q.TileMaterial=ha,q.TileMaterialLoader=ua,q.TileSource=ni,q.UIComponent=Gh,q.VectorFeatureTypes=nt,q.VectorTileLayer=va,q.VectorTileRender=ph,q.Viewer=Sc,q.WMTSSource=K_,q.WMTSTileLayer=mw,q.WeatherEffect=Mc,q.addSkirt=hh,q.author=ov,q.concatenateTypedArrays=Gr,q.convertGeometryToWGS84=Zy,q.createBillboards=Em,q.getBoundsCoord=ra,q.getGeometryDataFromDem=uh,q.getGridIndices=aa,q.getLocalInfoFromRay=Yo,q.getLocalInfoFromScreen=Gc,q.getLocalInfoFromWorld=Ro,q.getNormals=la,q.getSafeTileUrlAndBounds=sa,q.registerDEMLoader=pa,q.registerImgLoader=fa,q.registerMeshLoader=yh,q.vector2ToWGS84=oa,q.version=sv,q.waitFor=av,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|