vis-core 0.24.10 → 0.24.11

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 CHANGED
@@ -8,4 +8,4 @@ export * from './getVisConfig';
8
8
  export declare const access: {
9
9
  token: string;
10
10
  };
11
- export declare const VERSION = "0.24.10";
11
+ export declare const VERSION = "0.24.11";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document!="undefined"){var t=document.createElement("style");t.appendChild(document.createTextNode(".-translate-x-1\\/2,.-translate-y-1\\/2{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1 }.shadow{--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.ring{--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.invert,.filter{--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: }.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.left-1\\/2{left:50%}.top-1\\/2{top:50%}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.whitespace-nowrap{white-space:nowrap}.text-center{text-align:center}.text-sm{font-size:14px;line-height:20px}.text-xs{font-size:12px;line-height:16px}.leading-\\[1\\]{line-height:1}.text-\\[\\#809083\\]{--tw-text-opacity: 1;color:rgb(128 144 131 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-opacity-80{--tw-text-opacity: .8 }.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- "use strict";var K1=Object.defineProperty,z1=Object.defineProperties;var U1=Object.getOwnPropertyDescriptors;var F1=Object.getOwnPropertySymbols,P1=Object.getPrototypeOf,B1=Object.prototype.hasOwnProperty,E1=Object.prototype.propertyIsEnumerable,Q1=Reflect.get;var f1=(de,e)=>(e=Symbol[de])?e:Symbol.for("Symbol."+de),A1=de=>{throw TypeError(de)},r1=Math.pow,N1=(de,e,r)=>e in de?K1(de,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):de[e]=r,li=(de,e)=>{for(var r in e||(e={}))B1.call(e,r)&&N1(de,r,e[r]);if(F1)for(var r of F1(e))E1.call(e,r)&&N1(de,r,e[r]);return de},Pi=(de,e)=>z1(de,U1(e));var J0=(de,e,r)=>N1(de,typeof e!="symbol"?e+"":e,r);var a1=(de,e,r)=>Q1(P1(de),r,e);var ti=(de,e,r)=>new Promise((c,Je)=>{var Ke=$e=>{try{_e(r.next($e))}catch(qe){Je(qe)}},Qe=$e=>{try{_e(r.throw($e))}catch(qe){Je(qe)}},_e=$e=>$e.done?c($e.value):Promise.resolve($e.value).then(Ke,Qe);_e((r=r.apply(de,e)).next())}),j1=function(de,e){this[0]=de,this[1]=e};var w1=de=>{var e=de[f1("asyncIterator")],r=!1,c,Je={};return e==null?(e=de[f1("iterator")](),c=Ke=>Je[Ke]=Qe=>e[Ke](Qe)):(e=e.call(de),c=Ke=>Je[Ke]=Qe=>{if(r){if(r=!1,Ke==="throw")throw Qe;return Qe}return r=!0,{done:!1,value:new j1(new Promise(_e=>{var $e=e[Ke](Qe);$e instanceof Object||A1("Object expected"),_e($e)}),1)}}),Je[f1("iterator")]=()=>Je,c("next"),"throw"in e?c("throw"):Je.throw=Ke=>{throw Ke},"return"in e&&c("return"),Je},H1=(de,e,r)=>(e=de[f1("asyncIterator")])?e.call(de):(de=de[f1("iterator")](),e={},r=(c,Je)=>(Je=de[c])&&(e[c]=Ke=>new Promise((Qe,_e,$e)=>(Ke=Je.call(de,Ke),$e=Ke.done,Promise.resolve(Ke.value).then(qe=>Qe({value:qe,done:$e}),_e)))),r("next"),r("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),lodashEs=require("lodash-es"),turf=require("@turf/turf"),world$1=require("geojson-cn/extra/countries-next.json"),json100000Lite=require("geojson-cn/extra/100000-lite-next.json"),json100000=require("geojson-cn/extra/100000-next.json"),continentsCountriesIsoOrigin=require("geojson-cn/extra/continents-countries-iso.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(de){return de<0&&(de=this.length+de),this[de]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[de,e,r]=this.token.split(":::"),c=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),Je=CryptoJS.enc.Base64.parse(e),Ke=CryptoJS.enc.Base64.parse(r),Qe=CryptoJS.lib.WordArray.create(Je.words.slice(0,4)),_e=CryptoJS.lib.WordArray.create(Je.words.slice(4)),$e=jsrsasign.KJUR.crypto.Util.hashHex(Je.toString(),"sha256"),qe=c.verifyWithMessageHashPSS($e,jsrsasign.b64tohex(de),"sha256",32);if(!qe)return this.token=void 0,"";const rt=CryptoJS.AES.decrypt({ciphertext:_e},Ke,{iv:Qe,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),ct=JSON.parse(rt),Zt=Date.now();return!ct.s||ct.s>Zt?(this.token=void 0,""):ct.e&&ct.e<Zt?(this.token=void 0,""):(ct.isValid=qe,ct)}},version="0.24.10";/**
2
+ "use strict";var K1=Object.defineProperty,z1=Object.defineProperties;var U1=Object.getOwnPropertyDescriptors;var F1=Object.getOwnPropertySymbols,P1=Object.getPrototypeOf,B1=Object.prototype.hasOwnProperty,E1=Object.prototype.propertyIsEnumerable,Q1=Reflect.get;var f1=(de,e)=>(e=Symbol[de])?e:Symbol.for("Symbol."+de),A1=de=>{throw TypeError(de)},r1=Math.pow,N1=(de,e,r)=>e in de?K1(de,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):de[e]=r,li=(de,e)=>{for(var r in e||(e={}))B1.call(e,r)&&N1(de,r,e[r]);if(F1)for(var r of F1(e))E1.call(e,r)&&N1(de,r,e[r]);return de},Pi=(de,e)=>z1(de,U1(e));var J0=(de,e,r)=>N1(de,typeof e!="symbol"?e+"":e,r);var a1=(de,e,r)=>Q1(P1(de),r,e);var ti=(de,e,r)=>new Promise((c,Je)=>{var Ke=$e=>{try{_e(r.next($e))}catch(qe){Je(qe)}},Qe=$e=>{try{_e(r.throw($e))}catch(qe){Je(qe)}},_e=$e=>$e.done?c($e.value):Promise.resolve($e.value).then(Ke,Qe);_e((r=r.apply(de,e)).next())}),j1=function(de,e){this[0]=de,this[1]=e};var w1=de=>{var e=de[f1("asyncIterator")],r=!1,c,Je={};return e==null?(e=de[f1("iterator")](),c=Ke=>Je[Ke]=Qe=>e[Ke](Qe)):(e=e.call(de),c=Ke=>Je[Ke]=Qe=>{if(r){if(r=!1,Ke==="throw")throw Qe;return Qe}return r=!0,{done:!1,value:new j1(new Promise(_e=>{var $e=e[Ke](Qe);$e instanceof Object||A1("Object expected"),_e($e)}),1)}}),Je[f1("iterator")]=()=>Je,c("next"),"throw"in e?c("throw"):Je.throw=Ke=>{throw Ke},"return"in e&&c("return"),Je},H1=(de,e,r)=>(e=de[f1("asyncIterator")])?e.call(de):(de=de[f1("iterator")](),e={},r=(c,Je)=>(Je=de[c])&&(e[c]=Ke=>new Promise((Qe,_e,$e)=>(Ke=Je.call(de,Ke),$e=Ke.done,Promise.resolve(Ke.value).then(qe=>Qe({value:qe,done:$e}),_e)))),r("next"),r("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),lodashEs=require("lodash-es"),turf=require("@turf/turf"),world$1=require("geojson-cn/extra/countries-next.json"),json100000Lite=require("geojson-cn/extra/100000-lite-next.json"),json100000=require("geojson-cn/extra/100000-next.json"),continentsCountriesIsoOrigin=require("geojson-cn/extra/continents-countries-iso.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(de){return de<0&&(de=this.length+de),this[de]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[de,e,r]=this.token.split(":::"),c=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),Je=CryptoJS.enc.Base64.parse(e),Ke=CryptoJS.enc.Base64.parse(r),Qe=CryptoJS.lib.WordArray.create(Je.words.slice(0,4)),_e=CryptoJS.lib.WordArray.create(Je.words.slice(4)),$e=jsrsasign.KJUR.crypto.Util.hashHex(Je.toString(),"sha256"),qe=c.verifyWithMessageHashPSS($e,jsrsasign.b64tohex(de),"sha256",32);if(!qe)return this.token=void 0,"";const rt=CryptoJS.AES.decrypt({ciphertext:_e},Ke,{iv:Qe,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),ct=JSON.parse(rt),Zt=Date.now();return!ct.s||ct.s>Zt?(this.token=void 0,""):ct.e&&ct.e<Zt?(this.token=void 0,""):(ct.isValid=qe,ct)}},version="0.24.11";/**
3
3
  * @license
4
4
  * Copyright 2010-2025 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
@@ -5448,11 +5448,11 @@ version 0.8.2
5448
5448
  #include <colorspace_fragment>
5449
5449
  #include <fog_fragment>
5450
5450
 
5451
- }`};class CityPlane extends v{constructor(r){super();J0(this,"options");J0(this,"plane");J0(this,"water");this.options=li({color:"#0C4557",map:null},r)}create(){return ti(this,null,function*(){const{width:r,height:c,color:Je,map:Ke,material:Qe}=this.options;console.log("create plane",r,c);const _e=new PlaneGeometry(r,c,2,2);this.plane=_e;const $e=Qe||new MeshBasicMaterial({color:Je,map:Ke});this.createMesh(_e,$e)})}addWater(){const r=this.pencil.getPlugin("loader"),c=new Water(this.plane.clone(),{color:"#ffffff",scale:1,flowDirection:new Vector2(0,0),flowSpeed:1e-9,textureWidth:1024,textureHeight:1024,normalMap0:r.getAsset("/image/water/normalMap0.jpg"),normalMap1:r.getAsset("/image/water/normalMap1.jpg"),reflectivity:.04});this.water=c,c.position.z=.001,this.add(c)}}class ContinentsBg extends v{constructor(r){super();J0(this,"options");J0(this,"mapArr",[]);this.options=r}create(){return ti(this,null,function*(){const{depth:r}=this.options,c=this.pencil.installPlugins.get("materialList"),Je=this.pencil.getPlugin("draw"),Ke=c.getMaterialObj("continents");this.createGroup(),this.object3d.name="大洲组",yield Promise.all(continents.features.map(Qe=>ti(this,null,function*(){const _e=Qe.properties.name;_e==="大洋洲"&&(Qe.geometry.coordinates[4]=[],Qe.geometry.coordinates[21]=[]);const $e=turf.centroid(Qe).geometry.coordinates;let qe=0,st=0,rt=this.options.scale;const ct=30,Zt=25;_e==="南美洲"?(qe=-ct,st=Zt,rt=rt*.2):_e==="北美洲"?(qe=0,st=Zt,rt=rt*.18):_e==="大洋洲"?(qe=ct,st=Zt,rt=rt*.3):_e==="亚洲"?(qe=-ct,st=-Zt,rt=rt*.15):_e==="欧洲"?(qe=0,st=-Zt,rt=rt*.3):_e==="非洲"&&(qe=ct,st=-Zt,rt=rt*.2);const Wt=yield Je.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[Qe]},projection:{center:$e,scale:rt,rotate:[0,0],projectionType:"equirectangular"},areaGroup:!1,depth:r,materialOptions:li({},Ke)},this);Wt.userData.projection=G({center:$e,scale:rt,rotate:[0,0],projectionType:"equirectangular"}),Wt.userData.name=_e,Wt.position.set(qe,st,0),this.mapArr.push(Wt)})))})}getPointInContinentInfo(r){return continents.features.find(c=>c.geometry.coordinates.some(Je=>Je.length?turf.booleanPointInPolygon(turf.point(r),turf.polygon(Je)):!1))}getPointInContinent(r){return!!this.getPointInContinentInfo(r)}getLocationPosition(r,c){var Ke;const Je=c||((Ke=this.getPointInContinentInfo(r))==null?void 0:Ke.properties.name);if(Je){const Qe=this.mapArr.find(_e=>_e.userData.name===Je);if(Qe){const{projection:_e}=Qe.userData,[$e,qe]=r,[st,rt]=_e([$e,qe]),ct=new Vector3(st,-rt,this.options.depth);return ct.applyMatrix4(Qe.object3d.matrixWorld),[ct.x,ct.y,ct.z]}}}render(){const r=this.pencil.installPlugins.get("materialList");r.setObject3d(this.object3d,"continents-group",{baseObject:this,remove:!1}),this.mapArr.forEach(c=>{r.setObject3d(c.object3d,"continents-"+c.userData.name,{baseObject:c,remove:!1,parent:this.object3d})}),r.setObject3dMeta("continentsArea",{parent:this.object3d}),r.setObject3dMeta("continentsLine",{parent:this.object3d})}dispose(){this.mapArr.forEach(r=>{r.dispose()}),this.mapArr.length=0}}class PlaneMap extends v{constructor(r){super();J0(this,"options");J0(this,"isActive",!0);J0(this,"groupArr",[]);J0(this,"areaArr",[]);J0(this,"lineArr");J0(this,"extrudelineArr");this.options=li({depth:2},r)}geojson2Meta(r){return r.features.filter(c=>c.geometry).map(c=>{const{type:Je,coordinates:Ke}=c.geometry;let Qe=[];return Je==="Polygon"?Qe=Ke:Je==="MultiPolygon"&&(Qe=Ke.flat()),{coords:Qe,properties:c.properties}})}create(){return ti(this,null,function*(){const{geojson:r,bbox:c}=this.options,Je=this.geojson2Meta(r),Ke=this.pencil.getPlugin("worker"),Qe=this.pencil.getPlugin("draw"),$e=yield this.pencil.getPlugin("loader").load("/1.png"),qe=yield Ke.geoGeometry("extrudePolygon",{mesaage:{coordinatesArr:Je.map(({coords:vt})=>vt).flat(),projection:li({},this.options.projection),topSegments:100,bbox:c,depth:[this.options.depth],hasBottom:!1,hasSide:!1}}),st=qe.attributes.position.count;qe.setAttribute("color",new BufferAttribute(new Float32Array(st*3),3));const rt=this.options.depth;this.setNoise(qe,$e.image,rt);const ct=new Color$1,Zt=qe.attributes.color,Wt=qe.attributes.position,Yt=new Color$1("red"),Tt=new Color$1("green");for(let vt=0;vt<st;vt++){const Jt=Wt.getZ(vt)/rt;ct.lerpColors(Yt,Tt,Jt),Zt.setXYZ(vt,ct.r,ct.g,ct.b)}const dt=yield Qe.draw("ExtrudePolygon",{geometry:qe,material:new MeshStandardMaterial({flatShading:!0,vertexColors:!0})},null);dt.position.z+=.001,this.object3d=dt.object3d})}setNoise(r,c,Je=1){const Ke=document.createElement("canvas"),Qe=[];Ke.width=c.width,Ke.height=c.height;const _e=Ke.getContext("2d");_e.drawImage(c,0,0);const qe=_e.getImageData(0,0,c.width,c.height).data;for(let Zt=0;Zt<c.height;Zt++){Qe[Zt]=[];for(let Wt=0;Wt<c.width;Wt++){const Yt=(Zt*c.width+Wt)*4,Tt=qe[Yt];Qe[Zt][Wt]=Tt/255}}const st=r.attributes.position,rt=r.attributes.uv,ct=new Vector2;for(let Zt=0;Zt<st.count;Zt++){ct.fromBufferAttribute(rt,Zt);let Wt=Math.round(ct.x*c.width)-1,Yt=Math.round(ct.y*c.height)-1;Wt<0&&(Wt=0),Yt<0&&(Yt=0);const Tt=Qe[Yt][Wt];st.setZ(Zt,Tt*Je)}}}const objs$4=Pi(li({},objs$5),{PlaneMap:PlaneMap$1,CityPlane,ContinentsBg,Mountain:PlaneMap}),worldPacificCentre=de=>{de.options.curvatureResolution=0,de.loaderAdd=function(){const e=this.loader;e.add(["/image/map/jianbian.webp"]),e.add(["/image/map/hp2.webp","/image/map/fx2.webp"])},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=this.mList,c=(()=>{const Je=e.getAsset("/image/map/hp2.webp");Je.center.set(.5,.5),Je.repeat.set(.97,1.01);const Ke=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp2.webp"),normalMap:e.getAsset("/image/map/fx2.webp"),normalScale:new Vector2(2,1)}),Qe=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),_e=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),$e=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:Ke,sideMat:Qe,lineMat:_e,extrudeLineMat:de.options.extrudeLine?$e:null}})();r.setMaterialObj("plane",c)})}},world=de=>{if(de.initSettingsObj=li({"测试板块颜色.color:::caId":"ffffff","测试边框颜色.color:::caId":"ffffff","测试边框宽度:::caId":0,"测试添加面.btn:::caId":0},de.initSettingsObj),de.options.lineOffset=.02,delete de.extendsOptions.handleBackKeepCamvasState,de.extendsOptions.extrudeLine=()=>de.options.extrudeLine,de.extendsOptions.worldPacificCentre=()=>de.options.worldPacificCentre,de.options.worldPacificCentre){worldPacificCentre(de);return}de.initMaterial=function(){return ti(this,null,function*(){const e=this.mList,r=(()=>{const c=new MeshBasicMaterial({name:"顶面",color:"#0d2425"}),Je=new MeshBasicMaterial({name:"侧面",color:"#0d2425"}),Ke=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),Qe=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:c,sideMat:Je,lineMat:Ke,extrudeLineMat:de.options.extrudeLine?Qe:null}})();e.setMaterialObj("plane",r)})}},china=de=>{de.initSettingsObj=li({"测试板块颜色.color:::caId":"ffffff","测试边框颜色.color:::caId":"ffffff","测试边框宽度:::caId":0,"测试添加面.btn:::caId":0},de.initSettingsObj),de.options.lineOffset=.005,de.loaderAdd=function(){return ti(this,null,function*(){this.loader.add(["/image/map/jianbian.webp","/image/map/hp.webp","/image/map/shuchu2.webp"]),this.loaderAddBg()})},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=(()=>{const c=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp.webp"),normalMap:e.getAsset("/image/map/shuchu2.webp")}),Je=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),Ke=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),Qe=new it$1({name:"板块边线",color:new Color$1("#00FFED"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:c,sideMat:Je,lineMat:Ke,extrudeLineMat:Qe}})();this.mList.setMaterialObj("plane",r),this.options.drillDownSecondLevelMats&&this.mList.copyMaterialObj("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMaterialObj("plane","thirdPlane"),this.initMaterialBg()})}},base$1=de=>{de.loaderAdd=function(){return ti(this,null,function*(){this.loader.add(["/image/map/jianbian.webp"]),this.loaderAddBg()})},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=(()=>{const c=new MeshBasicMaterial({name:"顶面",color:new Color$1("#0d2425")}),Je=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),Ke=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),Qe=new it$1({color:new Color$1("#00FFED"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:c,sideMat:Je,lineMat:Ke,extrudeLineMat:Qe}})();this.mList.setMaterialObj("plane",r),this.options.drillDownSecondLevelMats&&this.mList.copyMaterialObj("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMaterialObj("plane","thirdPlane"),this.initMaterialBg()})}},getLabelElement=de=>{const e=document.createElement("div");return de.replace(/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,""),e.classList.add("vis-map-label","absolute","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2"),e.innerHTML=`
5451
+ }`};class CityPlane extends v{constructor(r){super();J0(this,"options");J0(this,"plane");J0(this,"water");this.options=li({color:"#0C4557",map:null},r)}create(){return ti(this,null,function*(){const{width:r,height:c,color:Je,map:Ke,material:Qe}=this.options,_e=new PlaneGeometry(r,c,2,2);this.plane=_e;const $e=Qe||new MeshBasicMaterial({color:Je,map:Ke});this.createMesh(_e,$e)})}addWater(){const r=this.pencil.getPlugin("loader"),c=new Water(this.plane.clone(),{color:"#ffffff",scale:1,flowDirection:new Vector2(0,0),flowSpeed:1e-9,textureWidth:1024,textureHeight:1024,normalMap0:r.getAsset("/image/water/normalMap0.jpg"),normalMap1:r.getAsset("/image/water/normalMap1.jpg"),reflectivity:.04});this.water=c,c.position.z=.001,this.add(c)}}class ContinentsBg extends v{constructor(r){super();J0(this,"options");J0(this,"mapArr",[]);this.options=r}create(){return ti(this,null,function*(){const{depth:r}=this.options,c=this.pencil.installPlugins.get("materialList"),Je=this.pencil.getPlugin("draw"),Ke=c.getMaterialObj("continents");this.createGroup(),this.object3d.name="大洲组",yield Promise.all(continents.features.map(Qe=>ti(this,null,function*(){const _e=Qe.properties.name;_e==="大洋洲"&&(Qe.geometry.coordinates[4]=[],Qe.geometry.coordinates[21]=[]);const $e=turf.centroid(Qe).geometry.coordinates;let qe=0,st=0,rt=this.options.scale;const ct=30,Zt=25;_e==="南美洲"?(qe=-ct,st=Zt,rt=rt*.2):_e==="北美洲"?(qe=0,st=Zt,rt=rt*.18):_e==="大洋洲"?(qe=ct,st=Zt,rt=rt*.3):_e==="亚洲"?(qe=-ct,st=-Zt,rt=rt*.15):_e==="欧洲"?(qe=0,st=-Zt,rt=rt*.3):_e==="非洲"&&(qe=ct,st=-Zt,rt=rt*.2);const Wt=yield Je.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[Qe]},projection:{center:$e,scale:rt,rotate:[0,0],projectionType:"equirectangular"},areaGroup:!1,depth:r,materialOptions:li({},Ke)},this);Wt.userData.projection=G({center:$e,scale:rt,rotate:[0,0],projectionType:"equirectangular"}),Wt.userData.name=_e,Wt.position.set(qe,st,0),this.mapArr.push(Wt)})))})}getPointInContinentInfo(r){return continents.features.find(c=>c.geometry.coordinates.some(Je=>Je.length?turf.booleanPointInPolygon(turf.point(r),turf.polygon(Je)):!1))}getPointInContinent(r){return!!this.getPointInContinentInfo(r)}getLocationPosition(r,c){var Ke;const Je=c||((Ke=this.getPointInContinentInfo(r))==null?void 0:Ke.properties.name);if(Je){const Qe=this.mapArr.find(_e=>_e.userData.name===Je);if(Qe){const{projection:_e}=Qe.userData,[$e,qe]=r,[st,rt]=_e([$e,qe]),ct=new Vector3(st,-rt,this.options.depth);return ct.applyMatrix4(Qe.object3d.matrixWorld),[ct.x,ct.y,ct.z]}}}render(){const r=this.pencil.installPlugins.get("materialList");r.setObject3d(this.object3d,"continents-group",{baseObject:this,remove:!1}),this.mapArr.forEach(c=>{r.setObject3d(c.object3d,"continents-"+c.userData.name,{baseObject:c,remove:!1,parent:this.object3d})}),r.setObject3dMeta("continentsArea",{parent:this.object3d}),r.setObject3dMeta("continentsLine",{parent:this.object3d})}dispose(){this.mapArr.forEach(r=>{r.dispose()}),this.mapArr.length=0}}class PlaneMap extends v{constructor(r){super();J0(this,"options");J0(this,"isActive",!0);J0(this,"groupArr",[]);J0(this,"areaArr",[]);J0(this,"lineArr");J0(this,"extrudelineArr");this.options=li({depth:2},r)}geojson2Meta(r){return r.features.filter(c=>c.geometry).map(c=>{const{type:Je,coordinates:Ke}=c.geometry;let Qe=[];return Je==="Polygon"?Qe=Ke:Je==="MultiPolygon"&&(Qe=Ke.flat()),{coords:Qe,properties:c.properties}})}create(){return ti(this,null,function*(){const{geojson:r,bbox:c}=this.options,Je=this.geojson2Meta(r),Ke=this.pencil.getPlugin("worker"),Qe=this.pencil.getPlugin("draw"),$e=yield this.pencil.getPlugin("loader").load("/1.png"),qe=yield Ke.geoGeometry("extrudePolygon",{mesaage:{coordinatesArr:Je.map(({coords:vt})=>vt).flat(),projection:li({},this.options.projection),topSegments:100,bbox:c,depth:[this.options.depth],hasBottom:!1,hasSide:!1}}),st=qe.attributes.position.count;qe.setAttribute("color",new BufferAttribute(new Float32Array(st*3),3));const rt=this.options.depth;this.setNoise(qe,$e.image,rt);const ct=new Color$1,Zt=qe.attributes.color,Wt=qe.attributes.position,Yt=new Color$1("red"),Tt=new Color$1("green");for(let vt=0;vt<st;vt++){const Jt=Wt.getZ(vt)/rt;ct.lerpColors(Yt,Tt,Jt),Zt.setXYZ(vt,ct.r,ct.g,ct.b)}const dt=yield Qe.draw("ExtrudePolygon",{geometry:qe,material:new MeshStandardMaterial({flatShading:!0,vertexColors:!0})},null);dt.position.z+=.001,this.object3d=dt.object3d})}setNoise(r,c,Je=1){const Ke=document.createElement("canvas"),Qe=[];Ke.width=c.width,Ke.height=c.height;const _e=Ke.getContext("2d");_e.drawImage(c,0,0);const qe=_e.getImageData(0,0,c.width,c.height).data;for(let Zt=0;Zt<c.height;Zt++){Qe[Zt]=[];for(let Wt=0;Wt<c.width;Wt++){const Yt=(Zt*c.width+Wt)*4,Tt=qe[Yt];Qe[Zt][Wt]=Tt/255}}const st=r.attributes.position,rt=r.attributes.uv,ct=new Vector2;for(let Zt=0;Zt<st.count;Zt++){ct.fromBufferAttribute(rt,Zt);let Wt=Math.round(ct.x*c.width)-1,Yt=Math.round(ct.y*c.height)-1;Wt<0&&(Wt=0),Yt<0&&(Yt=0);const Tt=Qe[Yt][Wt];st.setZ(Zt,Tt*Je)}}}const objs$4=Pi(li({},objs$5),{PlaneMap:PlaneMap$1,CityPlane,ContinentsBg,Mountain:PlaneMap}),worldPacificCentre=de=>{de.options.curvatureResolution=0,de.loaderAdd=function(){const e=this.loader;e.add(["/image/map/jianbian.webp"]),e.add(["/image/map/hp2.webp","/image/map/fx2.webp"])},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=this.mList,c=(()=>{const Je=e.getAsset("/image/map/hp2.webp");Je.center.set(.5,.5),Je.repeat.set(.97,1.01);const Ke=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp2.webp"),normalMap:e.getAsset("/image/map/fx2.webp"),normalScale:new Vector2(2,1)}),Qe=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),_e=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),$e=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:Ke,sideMat:Qe,lineMat:_e,extrudeLineMat:de.options.extrudeLine?$e:null}})();r.setMaterialObj("plane",c)})}},world=de=>{if(de.initSettingsObj=li({"测试板块颜色.color:::caId":"ffffff","测试边框颜色.color:::caId":"ffffff","测试边框宽度:::caId":0,"测试添加面.btn:::caId":0},de.initSettingsObj),de.options.lineOffset=.02,delete de.extendsOptions.handleBackKeepCamvasState,de.extendsOptions.extrudeLine=()=>de.options.extrudeLine,de.extendsOptions.worldPacificCentre=()=>de.options.worldPacificCentre,de.options.worldPacificCentre){worldPacificCentre(de);return}de.initMaterial=function(){return ti(this,null,function*(){const e=this.mList,r=(()=>{const c=new MeshBasicMaterial({name:"顶面",color:"#0d2425"}),Je=new MeshBasicMaterial({name:"侧面",color:"#0d2425"}),Ke=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),Qe=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:c,sideMat:Je,lineMat:Ke,extrudeLineMat:de.options.extrudeLine?Qe:null}})();e.setMaterialObj("plane",r)})}},china=de=>{de.initSettingsObj=li({"测试板块颜色.color:::caId":"ffffff","测试边框颜色.color:::caId":"ffffff","测试边框宽度:::caId":0,"测试添加面.btn:::caId":0},de.initSettingsObj),de.options.lineOffset=.005,de.loaderAdd=function(){return ti(this,null,function*(){this.loader.add(["/image/map/jianbian.webp","/image/map/hp.webp","/image/map/shuchu2.webp"]),this.loaderAddBg()})},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=(()=>{const c=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp.webp"),normalMap:e.getAsset("/image/map/shuchu2.webp")}),Je=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),Ke=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),Qe=new it$1({name:"板块边线",color:new Color$1("#00FFED"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:c,sideMat:Je,lineMat:Ke,extrudeLineMat:Qe}})();this.mList.setMaterialObj("plane",r),this.options.drillDownSecondLevelMats&&this.mList.copyMaterialObj("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMaterialObj("plane","thirdPlane"),this.initMaterialBg()})}},base$1=de=>{de.loaderAdd=function(){return ti(this,null,function*(){this.loader.add(["/image/map/jianbian.webp"]),this.loaderAddBg()})},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=(()=>{const c=new MeshBasicMaterial({name:"顶面",color:new Color$1("#0d2425")}),Je=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),Ke=new it$1({color:new Color$1("#73FEDD"),sizeAttenuation:0,lineWidth:this.options.lineWidth,depthWrite:!1}),Qe=new it$1({color:new Color$1("#00FFED"),sizeAttenuation:0,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:c,sideMat:Je,lineMat:Ke,extrudeLineMat:Qe}})();this.mList.setMaterialObj("plane",r),this.options.drillDownSecondLevelMats&&this.mList.copyMaterialObj("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMaterialObj("plane","thirdPlane"),this.initMaterialBg()})}},getLabelElement=de=>{const e=document.createElement("div");return de.replace(/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,""),e.classList.add("vis-map-label","absolute","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2"),e.innerHTML=`
5452
5452
  <div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
5453
5453
  ${de}
5454
5454
  </div>
5455
- `,e},findLevelJsonItem2=de=>de===0?{name:"世界",adcode:0}:/^\d{6}$/.test(`${de}`)?geojsonCn.findLevelJsonItem(de):continentsType.find(e=>e.adcode===de),u1=class u1 extends Base{constructor(){super(...arguments);J0(this,"drawController",new sl(objs$4));J0(this,"mapHistory",[]);J0(this,"activePlaneMap",null);J0(this,"isAnimating",!1);J0(this,"parentBg",[]);J0(this,"continentsBg");J0(this,"group");J0(this,"projection");J0(this,"pcenter",[104,37.5]);J0(this,"pscale",5e4/1e3);J0(this,"meters");J0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});J0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});J0(this,"caId");J0(this,"shadowMapLight");J0(this,"planeShadow")}get mapObj(){return this.mapHistory[this.mapHistory.length-1]}get map(){var r;return(r=this.mapObj)==null?void 0:r.map}get mapInfo(){var r;return(r=this.mapObj)==null?void 0:r.mapInfo}get mapArea(){var r;return(r=this.map)==null?void 0:r.areaArr}get mapLine(){var r;return(r=this.map)==null?void 0:r.lineArr}get adcodes(){return this.mapHistory.map(r=>r.mapInfo.adcode)}setOptions(r){r.continentType;const c=li(li({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let Je=li({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);const Ke=li(li({0:worldExclATABbox,1e5:chinaBbox},continentsBbox),r==null?void 0:r.bboxMap);Object.keys(c).forEach(Qe=>{Qe!=="100000"&&/^\d{6}$/.test(Qe)&&c[+Qe].features.forEach($e=>{const qe=$e.properties.adcode;Je[qe]={type:"FeatureCollection",features:[$e]}})}),Je=li(li({},Je),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(Pi(li({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,parentBgTopSegments:0,clickHandleDrillDown:!1,drillDownSecondLevelMats:!1,drillDownThirdLevelMats:!1,clickOusideBack:!0,mapDepth:[1,.4,.2],mapPadding:[100,100,100,100],plateInCenter:!0,drillDownPlateInCenter:!0,drillDownHideParent:!1,showOneLevel:!1,drillDownRestrictions:"district",showDistrict:!0,showDistrictStreetView:!1,showLabel:!1,lineWidth:2,lineOffset:0,extrudeLineWidth:6,extrudeLine:!0,equirectangular:!1,fahey:!1,projectionType:"mercator",polarAngle:Math.PI/180*120,azimuthAngle:0,handleBackKeepCamvasState:!0,curvatureResolution:0,worldPacificCentre:!1,mapBoundary:!0,mergeSide:!1,bottomPlane:!1,bottomPlaneWater:!1},r),{geojsonMap:c,extrudeLineGeojsonMap:Je,bboxMap:Ke})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.fahey&&(this.options.projectionType="fahey",this.pscale=100,this.pcenter=[0,0]),this.pencilConfig=PENCIL_CONFIG$4,(this.getAdcodeShowLevel(this.options.adcode)==="province"||this.getAdcodeShowLevel(this.options.adcode)==="country")&&(this.extendsOptions.clickHandleDrillDown=()=>this.options.clickHandleDrillDown,this.options.clickHandleDrillDown&&(this.workerOnce=!1,this.extendsOptions.mapDepth=()=>Array.isArray(this.options.mapDepth)?this.options.mapDepth:new Array(3).fill(this.options.mapDepth),this.extendsOptions.drillDownSecondLevelMats=()=>this.options.drillDownSecondLevelMats,this.extendsOptions.drillDownThirdLevelMats=()=>this.options.drillDownThirdLevelMats,this.extendsOptions.drillDownPlateInCenter=()=>this.options.drillDownPlateInCenter,this.extendsOptions.clickOusideBack=()=>this.options.clickOusideBack,this.extendsOptions.handleBackKeepCamvasState=()=>this.options.handleBackKeepCamvasState,this.extendsOptions.showOneLevel=()=>this.options.showOneLevel,this.extendsOptions.showDistrict=()=>this.options.showDistrict,this.extendsOptions.showDistrictStreetView=()=>this.options.showDistrictStreetView,this.options.parentBg&&(this.extendsOptions.drillDownHideParent=()=>this.options.drillDownHideParent)),this.extendsOptions.parentBg=()=>this.options.parentBg,this.options.parentBg&&(this.extendsOptions.parentBgDepth=()=>this.options.parentBgDepth,this.extendsOptions.parentBgTopSegments=()=>this.options.parentBgTopSegments),this.extendsOptions.continentsBg=()=>this.options.continentsBg,this.options.continentsBg&&(this.extendsOptions.continentsBgDepth=()=>this.options.continentsBgDepth)),this.options.adcode===0?world(this):this.options.style==="map2"||(this.options.adcode===1e5?china(this):base$1(this))}handleSetting(r,c){return ti(this,null,function*(){if(yield a1(u1.prototype,this,"handleSetting").call(this,r,c),r==="label")c===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels());else if(r==="labelLite")c===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels());else if(r==="shadowMap")c===!1?this.shadowMapDisabled():yield this.shadowMapEnabled();else if(r.startsWith("测试板块颜色.color")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";this.setAreaColorByProperty(Qe,Ke?Je:+Je,c)}}else if(r.startsWith("测试边框颜色.color")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";this.setLineColorByProperty(Qe,Ke?Je:+Je,c)}}else if(r.startsWith("测试边框宽度")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";this.setLineWidthByProperty(Qe,Ke?Je:+Je,c)}}else if(r.startsWith("测试添加面")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";yield this.addAreaPlaneByProperty(Qe,Ke?Je:+Je)}}return c})}init(){return ti(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.projection=G({center:this.pcenter,scale:this.pscale,projectionType:this.options.projectionType,rotate:this.options.worldPacificCentre?[-160,0]:void 0}),this.meters=this.projection([1*1141e-8+this.pcenter[0],0])[0],yield this.initPencil(),console.time(`vis-core:time.${this.visName}-loader`),this.loaderAdd(),console.timeEnd(`vis-core:time.${this.visName}-loader`),yield this.loader.loadAll(),this.group=yield this.drawController.draw("Group"),yield this.initMaterial(),yield this.initVis(r),this.options.clickHandleDrillDown&&(this.drawController.handlePick(()=>this.mapArea||[],"down",(c,Je)=>{(this.playing||Je.metaKey||Je.ctrlKey)&&this.handleClick(c)}),this.options.clickOusideBack&&this.drawController.handlePick(()=>this.map?[this.map]:[],"downOutside",(c,Je)=>{(this.playing||Je.metaKey||Je.ctrlKey)&&this.handleClick()})),yield Promise.all(this.drawController.objectsPromise)})}initVisBg(r){return ti(this,null,function*(){let c=1e3,Je=1e3;const Ke=new Vector3(0,0,0);if(this.options.parentBg){const Qe=geojsonCn.adcodeMap[r].parent||0,_e=this.options.geojsonMap[Qe],$e=this.options.bboxMap[Qe],qe={projection:{center:this.pcenter,scale:this.pscale,rotate:[0,0],projectionType:this.options.projectionType},areaGroup:!1,bbox:$e,depth:this.options.parentBgDepth},st=this.options.adcode!==1e5;if(st){const Yt=this.mList.getMaterialObj("parentPlane"),Tt=yield this.drawController.draw("PlaneMap",li({geojson:_e,materialOptions:li({},Yt)},qe),this.group);Tt.lineArr.forEach(dt=>{dt.object3d.name="中国线",this.mList.setObject3d(dt.object3d,"100000line",{baseObject:dt}),this.initBaseObjectUserData(dt)}),Tt.areaArr.forEach(dt=>{dt.object3d.name="中国板块",this.mList.setObject3d(dt.object3d,"100000area",{baseObject:dt})}),Tt.position.z=-this.options.parentBgDepth,this.parentBg.push(Tt)}const rt=this.mList.getMaterialObj("worldPlane"),ct=yield this.drawController.draw("PlaneMap",li({geojson:Pi(li({},_e),{features:[...this.options.geojsonMap[0].features.filter(Yt=>st?Yt.properties.ISO_A3!=="CHN":!0)]}),materialOptions:li({},rt)},qe),this.group);ct.lineArr.forEach(Yt=>{Yt.object3d.name="世界线",this.mList.setObject3d(Yt.object3d,"worldline",{baseObject:Yt}),this.initBaseObjectUserData(Yt)}),ct.areaArr.forEach(Yt=>{Yt.object3d.name="世界板块",this.mList.setObject3d(Yt.object3d,"worldarea",{baseObject:Yt})}),ct.position.z=-this.options.parentBgDepth,this.parentBg.push(ct);const{center:Zt,size:Wt}=ct.getSize();c=Wt.x,Je=Wt.y,Ke.set(Zt.x,Zt.y,0)}if(this.options.continentsBg){this.continentsBg=yield this.drawController.draw("ContinentsBg",{depth:this.options.continentsBgDepth,scale:this.pscale});const Qe=this.getLocationPosition([104,37.5]);this.continentsBg.position.set(...Qe),this.continentsBg.position.z=.1}if(this.options.bottomPlane){const Qe=yield this.drawController.draw("CityPlane",{width:c,height:Je,color:"#0f1e57"},this.group);Qe.object3d.name="地图底面",this.mList.setObject3d(Qe.object3d,"map-plane",{baseObject:Qe}),this.options.bottomPlaneWater&&Qe.addWater(),Qe.position.copy(Ke),Qe.position.z-=.1}})}initVis(r){return ti(this,null,function*(){var Qe;yield this.setAdcode({adcodes:[r],duration:0});const c=yield this.drawController.draw("Light",{type:"SpotLight",color:this.options.worldPacificCentre?"#82d9f2":"#c1e6dd",intensity:3,distance:0,angle:this.options.continentsBg?1:.5,penumbra:1,decay:0});this.fitTo(this.map,{enableTransition:!1});const Je=this.pencil.cameraPositon,Ke=this.pencil.cameraTarget;if(c==null||c.spotLight.position.copy(Je),c==null||c.spotLight.target.position.copy(Ke),this.options.mapBoundary){const _e=new Box3().setFromObject((Qe=this.map)==null?void 0:Qe.object3d);this.pencil.controls.setBoundary(_e)}yield this.initVisBg(r)})}loaderAddBg(){this.options.bottomPlaneWater&&this.loader.add(["/image/water/normalMap0.jpg","/image/water/normalMap1.jpg"],{colorCorrection:!1})}initMaterialBg(){return ti(this,null,function*(){if(this.options.parentBg){const r=(()=>{const c=new MeshStandardMaterial({name:"顶面",emissive:"#081417",color:"#000000"}),Je=new MeshBasicMaterial({name:"侧面",color:"#051714",side:DoubleSide}),Ke=new it$1({color:new Color$1("#50766E"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:c,sideMat:Je,lineMat:Ke}})();this.mList.setMaterialObj("worldPlane",r),this.options.adcode!==1e5&&this.mList.copyMaterialObj("worldPlane","parentPlane")}if(this.options.continentsBg){const r=(()=>{const c=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),Je=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),Ke=new it$1({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:c,sideMat:Je,lineMat:Ke}})();this.mList.setMaterialObj("continents",r),this.mList.setFixMeshList("continentsArea",["continents#topMat","continents#sideMat"],{name:"大洲板块"}),this.mList.setFixMeshList("continentsLine","continents#lineMat",{name:"大洲板块线"})}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var Ke,Qe;const c=this.unproject(r,this.mapObj.z+this.mapObj.depth),Je=(Qe=(Ke=this.projection).invert)==null?void 0:Qe.call(Ke,[c.x,-c.y]);console.log("consoleMousePostion.postion",c),console.log("consoleMousePostion.lnglat",Je)})}setAreaMixColor(r,c){this.setAreaColorByProperty("adcode",r,c,!0)}setAreaColorByProperty(r,c,Je,Ke=!1){if(!this.map)return;const Qe=this.map.areaArr.find(_e=>_e.userData[r]===c);if(Qe){const _e=this.map.setAreaColor(Qe,Je);Ke&&_e&&(_e.color.set("#ffffff"),_e.onBeforeCompile=$e=>{$e.uniforms.c={value:new Color$1(Je)},$e.fragmentShader=`
5455
+ `,e},findLevelJsonItem2=de=>de===0?{name:"世界",adcode:0}:/^\d{6}$/.test(`${de}`)?geojsonCn.findLevelJsonItem(de):continentsType.find(e=>e.adcode===de),u1=class u1 extends Base{constructor(){super(...arguments);J0(this,"drawController",new sl(objs$4));J0(this,"mapHistory",[]);J0(this,"activePlaneMap",null);J0(this,"isAnimating",!1);J0(this,"parentBg",[]);J0(this,"continentsBg");J0(this,"group");J0(this,"projection");J0(this,"pcenter",[104,37.5]);J0(this,"pscale",5e4/1e3);J0(this,"meters");J0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});J0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});J0(this,"caId");J0(this,"shadowMapLight");J0(this,"planeShadow")}get mapObj(){return this.mapHistory[this.mapHistory.length-1]}get map(){var r;return(r=this.mapObj)==null?void 0:r.map}get mapInfo(){var r;return(r=this.mapObj)==null?void 0:r.mapInfo}get mapArea(){var r;return(r=this.map)==null?void 0:r.areaArr}get mapLine(){var r;return(r=this.map)==null?void 0:r.lineArr}get adcodes(){return this.mapHistory.map(r=>r.mapInfo.adcode)}setOptions(r){r.continentType;const c=li(li({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let Je=li({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);const Ke=li(li({0:worldExclATABbox,1e5:chinaBbox},continentsBbox),r==null?void 0:r.bboxMap);Object.keys(c).forEach(Qe=>{Qe!=="100000"&&/^\d{6}$/.test(Qe)&&c[+Qe].features.forEach($e=>{const qe=$e.properties.adcode;Je[qe]={type:"FeatureCollection",features:[$e]}})}),Je=li(li({},Je),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(Pi(li({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,parentBgTopSegments:0,clickHandleDrillDown:!1,drillDownSecondLevelMats:!1,drillDownThirdLevelMats:!1,clickOusideBack:!0,mapDepth:[1,.4,.2],mapPadding:[100,100,100,100],plateInCenter:!0,drillDownPlateInCenter:!0,drillDownHideParent:!1,showOneLevel:!1,drillDownRestrictions:"district",showDistrict:!0,showLabel:!1,lineWidth:2,lineOffset:0,extrudeLineWidth:6,extrudeLine:!0,equirectangular:!1,fahey:!1,projectionType:"mercator",polarAngle:Math.PI/180*120,azimuthAngle:0,handleBackKeepCamvasState:!0,curvatureResolution:0,worldPacificCentre:!1,mapBoundary:!0,mergeSide:!1,bottomPlane:!1,bottomPlaneWater:!1},r),{geojsonMap:c,extrudeLineGeojsonMap:Je,bboxMap:Ke})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.fahey&&(this.options.projectionType="fahey",this.pscale=100,this.pcenter=[0,0]),this.pencilConfig=PENCIL_CONFIG$4,(this.getAdcodeShowLevel(this.options.adcode)==="province"||this.getAdcodeShowLevel(this.options.adcode)==="country")&&(this.extendsOptions.clickHandleDrillDown=()=>this.options.clickHandleDrillDown,this.options.clickHandleDrillDown&&(this.workerOnce=!1,this.extendsOptions.mapDepth=()=>Array.isArray(this.options.mapDepth)?this.options.mapDepth:new Array(3).fill(this.options.mapDepth),this.extendsOptions.drillDownSecondLevelMats=()=>this.options.drillDownSecondLevelMats,this.extendsOptions.drillDownThirdLevelMats=()=>this.options.drillDownThirdLevelMats,this.extendsOptions.drillDownPlateInCenter=()=>this.options.drillDownPlateInCenter,this.extendsOptions.clickOusideBack=()=>this.options.clickOusideBack,this.extendsOptions.handleBackKeepCamvasState=()=>this.options.handleBackKeepCamvasState,this.extendsOptions.showOneLevel=()=>this.options.showOneLevel,this.extendsOptions.showDistrict=()=>this.options.showDistrict,this.options.parentBg&&(this.extendsOptions.drillDownHideParent=()=>this.options.drillDownHideParent)),this.extendsOptions.parentBg=()=>this.options.parentBg,this.options.parentBg&&(this.extendsOptions.parentBgDepth=()=>this.options.parentBgDepth,this.extendsOptions.parentBgTopSegments=()=>this.options.parentBgTopSegments),this.extendsOptions.continentsBg=()=>this.options.continentsBg,this.options.continentsBg&&(this.extendsOptions.continentsBgDepth=()=>this.options.continentsBgDepth)),this.options.adcode===0?world(this):this.options.style==="map2"||(this.options.adcode===1e5?china(this):base$1(this))}handleSetting(r,c){return ti(this,null,function*(){if(yield a1(u1.prototype,this,"handleSetting").call(this,r,c),r==="label")c===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels());else if(r==="labelLite")c===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels());else if(r==="shadowMap")c===!1?this.shadowMapDisabled():yield this.shadowMapEnabled();else if(r.startsWith("测试板块颜色.color")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";this.setAreaColorByProperty(Qe,Ke?Je:+Je,c)}}else if(r.startsWith("测试边框颜色.color")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";this.setLineColorByProperty(Qe,Ke?Je:+Je,c)}}else if(r.startsWith("测试边框宽度")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";this.setLineWidthByProperty(Qe,Ke?Je:+Je,c)}}else if(r.startsWith("测试添加面")){const[,Je]=r.split("caId.");if(Je){const Ke=this.options.adcode===0,Qe=Ke?"ISO_A2":"adcode";yield this.addAreaPlaneByProperty(Qe,Ke?Je:+Je)}}return c})}init(){return ti(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.projection=G({center:this.pcenter,scale:this.pscale,projectionType:this.options.projectionType,rotate:this.options.worldPacificCentre?[-160,0]:void 0}),this.meters=this.projection([1*1141e-8+this.pcenter[0],0])[0],yield this.initPencil(),console.time(`vis-core:time.${this.visName}-loader`),this.loaderAdd(),console.timeEnd(`vis-core:time.${this.visName}-loader`),yield this.loader.loadAll(),this.group=yield this.drawController.draw("Group"),yield this.initMaterial(),yield this.initVis(r),this.options.clickHandleDrillDown&&(this.drawController.handlePick(()=>this.mapArea||[],"down",(c,Je)=>{(this.playing||Je.metaKey||Je.ctrlKey)&&this.handleClick(c)}),this.options.clickOusideBack&&this.drawController.handlePick(()=>this.map?[this.map]:[],"downOutside",(c,Je)=>{(this.playing||Je.metaKey||Je.ctrlKey)&&this.handleClick()})),yield Promise.all(this.drawController.objectsPromise)})}initVisBg(r){return ti(this,null,function*(){let c=1e3,Je=1e3;const Ke=new Vector3(0,0,0);if(this.options.parentBg){const Qe=geojsonCn.adcodeMap[r].parent||0,_e=this.options.geojsonMap[Qe],$e=this.options.bboxMap[Qe],qe={projection:{center:this.pcenter,scale:this.pscale,rotate:[0,0],projectionType:this.options.projectionType},areaGroup:!1,bbox:$e,depth:this.options.parentBgDepth},st=this.options.adcode!==1e5;if(st){const Yt=this.mList.getMaterialObj("parentPlane"),Tt=yield this.drawController.draw("PlaneMap",li({geojson:_e,materialOptions:li({},Yt)},qe),this.group);Tt.lineArr.forEach(dt=>{dt.object3d.name="中国线",this.mList.setObject3d(dt.object3d,"100000line",{baseObject:dt}),this.initBaseObjectUserData(dt)}),Tt.areaArr.forEach(dt=>{dt.object3d.name="中国板块",this.mList.setObject3d(dt.object3d,"100000area",{baseObject:dt})}),Tt.position.z=-this.options.parentBgDepth,this.parentBg.push(Tt)}const rt=this.mList.getMaterialObj("worldPlane"),ct=yield this.drawController.draw("PlaneMap",li({geojson:Pi(li({},_e),{features:[...this.options.geojsonMap[0].features.filter(Yt=>st?Yt.properties.ISO_A3!=="CHN":!0)]}),materialOptions:li({},rt)},qe),this.group);ct.lineArr.forEach(Yt=>{Yt.object3d.name="世界线",this.mList.setObject3d(Yt.object3d,"worldline",{baseObject:Yt}),this.initBaseObjectUserData(Yt)}),ct.areaArr.forEach(Yt=>{Yt.object3d.name="世界板块",this.mList.setObject3d(Yt.object3d,"worldarea",{baseObject:Yt})}),ct.position.z=-this.options.parentBgDepth,this.parentBg.push(ct);const{center:Zt,size:Wt}=ct.getSize();c=Wt.x,Je=Wt.y,Ke.set(Zt.x,Zt.y,0)}if(this.options.continentsBg){this.continentsBg=yield this.drawController.draw("ContinentsBg",{depth:this.options.continentsBgDepth,scale:this.pscale});const Qe=this.getLocationPosition([104,37.5]);this.continentsBg.position.set(...Qe),this.continentsBg.position.z=.1}if(this.options.bottomPlane){const Qe=yield this.drawController.draw("CityPlane",{width:c,height:Je,color:"#0f1e57"},this.group);Qe.object3d.name="地图底面",this.mList.setObject3d(Qe.object3d,"map-plane",{baseObject:Qe}),this.options.bottomPlaneWater&&Qe.addWater(),Qe.position.copy(Ke),Qe.position.z-=.1}})}initVis(r){return ti(this,null,function*(){var Qe;yield this.setAdcode({adcodes:[r],duration:0});const c=yield this.drawController.draw("Light",{type:"SpotLight",color:this.options.worldPacificCentre?"#82d9f2":"#c1e6dd",intensity:3,distance:0,angle:this.options.continentsBg?1:.5,penumbra:1,decay:0});this.fitTo(this.map,{enableTransition:!1});const Je=this.pencil.cameraPositon,Ke=this.pencil.cameraTarget;if(c==null||c.spotLight.position.copy(Je),c==null||c.spotLight.target.position.copy(Ke),this.options.mapBoundary){const _e=new Box3().setFromObject((Qe=this.map)==null?void 0:Qe.object3d);this.pencil.controls.setBoundary(_e)}yield this.initVisBg(r)})}loaderAddBg(){this.options.bottomPlaneWater&&this.loader.add(["/image/water/normalMap0.jpg","/image/water/normalMap1.jpg"],{colorCorrection:!1})}initMaterialBg(){return ti(this,null,function*(){if(this.options.parentBg){const r=(()=>{const c=new MeshStandardMaterial({name:"顶面",emissive:"#081417",color:"#000000"}),Je=new MeshBasicMaterial({name:"侧面",color:"#051714",side:DoubleSide}),Ke=new it$1({color:new Color$1("#50766E"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:c,sideMat:Je,lineMat:Ke}})();this.mList.setMaterialObj("worldPlane",r),this.options.adcode!==1e5&&this.mList.copyMaterialObj("worldPlane","parentPlane")}if(this.options.continentsBg){const r=(()=>{const c=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),Je=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),Ke=new it$1({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:c,sideMat:Je,lineMat:Ke}})();this.mList.setMaterialObj("continents",r),this.mList.setFixMeshList("continentsArea",["continents#topMat","continents#sideMat"],{name:"大洲板块"}),this.mList.setFixMeshList("continentsLine","continents#lineMat",{name:"大洲板块线"})}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var Ke,Qe;const c=this.unproject(r,this.mapObj.z+this.mapObj.depth),Je=(Qe=(Ke=this.projection).invert)==null?void 0:Qe.call(Ke,[c.x,-c.y]);console.log("consoleMousePostion.postion",c),console.log("consoleMousePostion.lnglat",Je)})}setAreaMixColor(r,c){this.setAreaColorByProperty("adcode",r,c,!0)}setAreaColorByProperty(r,c,Je,Ke=!1){if(!this.map)return;const Qe=this.map.areaArr.find(_e=>_e.userData[r]===c);if(Qe){const _e=this.map.setAreaColor(Qe,Je);Ke&&_e&&(_e.color.set("#ffffff"),_e.onBeforeCompile=$e=>{$e.uniforms.c={value:new Color$1(Je)},$e.fragmentShader=`
5456
5456
  uniform vec3 c;
5457
5457
  vec3 rgb2hsv(float r, float g, float b) {
5458
5458
  vec3 c = vec3(r, g, b);
@@ -5514,7 +5514,7 @@ version 0.8.2
5514
5514
  gl_FragColor = vec4(ccccc, alpha * 0.65);
5515
5515
 
5516
5516
 
5517
- `)},_e.needsUpdate=!0)}}setAreaEmissiveByProperty(r,c,Je,Ke=1){if(!this.map)return;const Qe=this.map.areaArr.find(_e=>_e.userData[r]===c);Qe&&this.map.setAreaEmissive(Qe,Je,Ke)}setLineColorByProperty(r,c,Je){if(!this.map)return;const Ke=this.map.lineArr.find(Qe=>Qe.userData[r]===c);Ke&&this.map.setLineColor(Ke,Je)}setLineWidthByProperty(r,c,Je){if(!this.map)return;const Ke=this.map.lineArr.find(Qe=>Qe.userData[r]===c);Ke&&this.map.setLineWidth(Ke,Je)}addAreaPlaneByProperty(Ke,Qe){return ti(this,arguments,function*(r,c,Je={}){var qe;if(!this.map)return;const $e=this.map.options.geojson.features.find(st=>st.properties&&st.properties[r]===c);if($e){const st=`${c}`;let rt=!1;if(this.mList.objectList.forEach((Yt,Tt)=>{if(Yt.key==="planeCopyExtrudePolygon"+st){console.warn("已经存在复制面",st),rt=!0;return}}),rt)return;let ct;Je.material?n$1(Je.material)?ct=new MeshBasicMaterial(li({},Je.material)):ct=Je.material:ct=new MeshBasicMaterial({color:"red"});let Zt;Je.lineMaterial?n$1(Je.lineMaterial)?Zt=new it$1(li({},Je.lineMaterial)):Zt=Je.lineMaterial:Zt=new it$1({color:new Color$1("blue"),sizeAttenuation:0,lineWidth:this.options.lineWidth});const Wt=yield this.map.addPlane($e,{material:ct,lineMaterial:Zt,topSegments:(qe=Je.topSegments)!=null?qe:0});return Wt.children.forEach(Yt=>{Yt instanceof je?(Yt.object3d.name="复制面"+st,this.mList.setObject3d(Yt.object3d,"planeCopyExtrudePolygon"+st,{baseObject:Yt})):Yt instanceof Ge&&(Yt.object3d.name="复制线"+st,this.mList.setObject3d(Yt.object3d,"planeCopyLine"+st,{baseObject:Yt}),this.initBaseObjectUserData(Yt))}),Wt}})}showAction(){return ti(this,null,function*(){a1(u1.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const r=this.drawController.group;if(this.mapHistory[0]){const{stop:c,start:Je}=sinusoidalInOut({onUpdate:Ke=>{if(!this.mapHistory[0]){c();return}r.position.z=-this.mapHistory[0].depth*(1-Ke)}});yield Je()}this.handlePickTest()})}handlePickTest(){return ti(this,null,function*(){var r;this.playing||(r=this.mapArea)==null||r.forEach(c=>{c.onPointerEvent("down",Je=>ti(this,null,function*(){var $e,qe,st;(qe=($e=this.pencil)==null?void 0:$e.helperController)==null||qe.removeAllExcludeScene(),(st=this.pencil.helperController)==null||st.add(Je.object3d),this.caId=Je.userData.ISO_A2||Je.userData.adcode;const Ke=this.mapLine.find(rt=>rt.userData.ISO_A2===this.caId||rt.userData.adcode===this.caId),_e=Je.object3d.material[0].color.getHexString();this.settings["测试板块颜色.color:::caId"]="#"+_e,yield this.settings["测试板块颜色.color:::caId"],this.settings["测试边框颜色.color:::caId"]="#"+(Ke==null?void 0:Ke.material.color.getHexString()),yield this.settings["测试边框颜色.color:::caId"],this.settings["测试边框宽度:::caId"]=Ke==null?void 0:Ke.material.lineWidth,yield this.settings["测试边框宽度:::caId"],this.emit("settingsChanged")}))})})}hide(){return ti(this,null,function*(){if(!this.showState)return;const r=this.drawController.group;yield sinusoidalInOut({onUpdate:c=>{r.position.z=-this.mapHistory[0].depth*c}}).start(),setTimeout(()=>{a1(u1.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return ti(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const r=yield this.drawController.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0}),c=r.object3d;this.mList.changeObject3dKey(c,"Shadow$1"),this.mList.changeObject3dKey(c.target,"Shadow$1"),this.shadowMapLight=r,r.object3d.position.set(.281,32.487,43.077),r.object3d.castShadow=!0;const Je=yield this.drawController.draw("PlaneShadow");this.mList.setObject3d(Je.object3d,"PlaneShadow",{baseObject:Je}),this.planeShadow=Je})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.mList.delObject3d(this.shadowMapLight.object3d),this.shadowMapLight=void 0),this.planeShadow&&(this.mList.delObject3d(this.planeShadow.object3d),this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(r){const c=this.getAdcodeShowLevel(r);let Je=this.options.mapDepth;Array.isArray(Je)||(Je=new Array(3).fill(Je));let Ke;return c==="country"?Ke=Je[0]:c==="province"?Ke=Je[1]:Ke=Je[2],Ke}getDepth(r,c){let Je=this.getOptionsDepth(r);if(this.options.depthReference&&this.options.bboxMap[r]){const Ke=this.options.depthReference,Qe=this.options.bboxMap[r];Je=Je*this.getReferenceScale(Ke,Qe)}else if(this.mapHistory.length&&this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]){const Ke=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode],Qe=this.getReferenceScale(Ke,c);Je=Je*Qe}return Je}getReferenceScale(r,c){const Je=Math.abs(c[3]-c[1])/Math.abs(r[3]-r[1]),Ke=Math.abs(c[2]-c[0])/Math.abs(r[2]-r[0]);return Math.max(Je,Ke)}getAdcodeShowLevel(r,c=!0){var Je;if((Je=this.options.fixCity)!=null&&Je[r]&&(r=this.options.fixCity[r]),r===0)return"world";if(r===1e5)return"country";if(/^\d{6}$/.test(`${r}`)){const{level:Ke,parent:Qe}=geojsonCn.adcodeMap[r],_e=Qe&&geojsonCn.adcodeMap[Qe].level;return Ke==="district"&&_e==="province"&&c?"city":Ke}else if(continentsType.find(Ke=>Ke.adcode===r))return"continent"}handleClick(r){const{drillDownRestrictions:c}=this.options;this.isAnimating||(r&&r.userData.adcode&&this.getAdcodeShowLevel(r.userData.adcode,!1)==="district"&&this.options.showDistrictStreetView?this.emit("beforeDrillDown",[...this.adcodes,r.userData.adcode],"city"):r&&r.userData.adcode&&this.getAdcodeShowLevel(r.userData.adcode)!==c?this.showMap({adcode:r.userData.adcode}):!r&&this.mapHistory.length>1&&this.showMap({adcode:this.adcodes.at(-2)}))}beforeShowMap(r){return!0}getAdcodes(r){const c=[];let Je=r;for(;Je;)c.unshift(Je),Je=geojsonCn.adcodeMap[Je].parent;return c}showMap(Ke){return ti(this,arguments,function*({adcode:r,adcodes:c,duration:Je=1e3}){const Qe=c||this.getAdcodes(r);(yield this.beforeShowMap(Qe))!==!1&&(this.emit("beforeDrillDown",[...Qe]),yield this.setAdcode({adcodes:Qe,duration:Je}),this.emit("afterDrillDown",[...Qe]))})}drawLabels(){return ti(this,null,function*(){var Je;const r=this.options.showLabel;!((Je=this.mapArea)!=null&&Je.length)||!r||this.drawController.getAllObject("Node",{key:"mapLabel"}).length||(yield Promise.all(this.mapArea.map(Ke=>ti(this,null,function*(){let{name:Qe,adcode:_e,centroid:$e}=Ke.userData;const{DistrictID:qe,DistName:st,NAME_CN:rt,CENTROID:ct,center:Zt}=Ke.userData;if(_e=_e||qe,$e=this.options.adcode===0?ct:$e||Zt,Qe=this.options.adcode===0?rt:Qe||st,!$e)return;const Wt=this.getLocationPosition($e);if(this.drawController.getObject("Node",{key:`mapLabel-${_e}`})||!Wt)return;const[Yt,Tt,dt]=Wt;let vt=Qe;r==="lite"&&vt&&(vt=Qe.replace("自治州","").replace("地区","").replace("自治区","").replace("省","").replace("市","").replace("壮族","").replace("特别行政区","").replace("回族","").replace("维吾尔",""));const Jt=vt&&getLabelElement(vt),$t=vt!=null&&vt.startsWith("澳门")?-1:0;yield this.drawController.draw("Node",{position:new Vector3(Yt,Tt+$t,dt),children:Jt,key:`mapLabel#${this.options.adcode===0?Qe:_e}`})}))))})}eraseLabels(){const r=this.drawController.getAllObject("Node",{key:"mapLabel"});this.drawController.erase(...r)}geAdcodePosition(r){var Je;const c=(Je=this.mapArea)==null?void 0:Je.find(Ke=>Ke.userData.adcode===r);if(c){const{centroid:Ke,center:Qe}=c.userData;return this.getLocationPosition(Ke||Qe)}}getLocationPosition(r){const[c,Je]=r,[Ke,Qe]=this.projection([c,Je]);return[Ke,-Qe,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(r){const c=this.geAdcodePosition(r);if(c){const[Je,Ke,Qe]=c,_e=new Vector3(Je,Ke,Qe);_e.project(this.pencil.camera);const{width:$e,height:qe}=this.pencil.getSize(),st=(_e.x*.5+.5)*$e,rt=(_e.y*-.5+.5)*qe;return{x:st,y:rt}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(c=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(c)))}handleDrillDown(Qe){return ti(this,arguments,function*({adcode:r,duration:c,saveBackCamvasState:Je,extrudelineBloom:Ke}){var _e,$e,qe,st,rt,ct,Zt,Wt;if(typeof r!="undefined"&&!this.isAnimating){const Yt=(_e=this.map)==null?void 0:_e.findGroup(r,!0),Tt=findLevelJsonItem2(+r);if(this.isAnimating||!Tt)return;this.isAnimating=!0;const{name:dt}=Tt;let{res:vt}=($e=this.options.geojsonMap)!=null&&$e[r]?{res:(qe=this.options.geojsonMap)==null?void 0:qe[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${r}.json`),{res:Jt}=this.options.extrudeLine?(st=this.options.extrudeLineGeojsonMap)!=null&&st[r]?{res:(rt=this.options.extrudeLineGeojsonMap)==null?void 0:rt[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${r}.json`):{res:void 0};if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(vt=Jt,Jt=void 0),[vt,Jt].filter(Boolean).forEach(e0=>{if(!e0.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const t0=geojsonCn.adcodeMap[r];e0.features[0].properties=Pi(li(li({},e0.features[0].properties),t0),{center:[t0.lng,t0.lat]})}}),vt){const e0=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if(e0&&this.fixNear(r),(ct=this.options.fixGeojson)!=null&&ct[r]){const o0=(Zt=this.options.fixGeojson)==null?void 0:Zt[r];if(o0.startsWith("-")){const G0=+o0.slice(1);vt.features=vt.features.filter(T0=>T0.properties.adcode!==G0)}}let t0=this.options.bboxMap[r]||turf.bbox(Jt||vt);this.options.bboxMap[r]=t0,this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?t0=this.options.bboxMap[this.mapInfo.adcode]:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?t0=this.options.bboxMap[this.mapInfo.adcode]:t0=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(o0=>{o0.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),(Je!=null?Je:this.options.handleBackKeepCamvasState)&&this.saveBackCamvasState(-1));const i0=this.mapHistory.length,n0=i0-1,s0=this.getDepth(r,t0),a0=(Wt=this.mapHistory[n0])==null?void 0:Wt.depth,l0=i0===0?0:this.mapHistory[n0].z+(this.options.showOneLevel?0:a0),u0=i0===0?0:l0-s0,b0=turf.center(vt).geometry.coordinates,[f0,m0]=this.projection(b0),r0=yield this.drawPlaneMap({geojson:vt,extrudeLineGeojson:Jt,depth:s0,bbox:t0,adcode:r,extrudelineBloom:Ke});r0.position.setZ(u0),this.mapHistory.push({map:r0,mapInfo:Tt,z:l0,depth:s0,cX:f0,cY:-m0});const h0=r0.position.z;e0&&(r0.position.z=l0,this.fitTo(r0,{enableTransition:c!==0}),r0.position.z=h0),Yt==null||Yt.hide(),this.map&&i0!==0&&(c?yield sinusoidalInOut({onUpdate:o0=>{this.map.position.z=h0+(l0-h0)*o0}}).start({duration:c}):this.map.position.z=l0),this.drawLabels()}else console.log(`${dt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveBackCamvasState(r){const c=this.mapHistory.at(r);c&&(c.cameraPositon=this.pencil.cameraPositon.clone(),c.cameraTarget=this.pencil.cameraTarget.clone())}fixNear(r){const c=this.getAdcodeShowLevel(r);r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(c==="country"||c==="province")&&this.pencil.camera.near!==this.pencilConfig.camera.near*10?(this.pencil.camera.near=this.pencilConfig.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(c==="city"||c==="district")&&this.pencil.camera.near!==this.pencilConfig.camera.near&&(this.pencil.camera.near=this.pencilConfig.camera.near,this.pencil.camera.updateProjectionMatrix())}absoluteAngle(r,c){const Je=Math.PI*2,Ke=r-c;return MathUtils.euclideanModulo(Ke+Math.PI,Je)-Math.PI}fitTo(Qe){return ti(this,arguments,function*(r,{polarAngle:c,azimuthAngle:Je,enableTransition:Ke=!0}={}){var Yt;if(!(r!=null&&r.object3d)||(yield this.useSaveCamera(`map-${(Yt=this.mapInfo)==null?void 0:Yt.adcode}`,Ke)))return;const $e=this.options.mapPadding,{height:qe,width:st}=this.pencil.getSize();qe<$e[0]+$e[2]+100&&($e[0]=0,$e[2]=0),st<$e[1]+$e[3]+100&&($e[1]=0,$e[3]=0);const rt=c||this.options.polarAngle,ct=Je||this.options.azimuthAngle,Zt=this.pencil.controls.azimuthAngle,Wt=this.pencil.controls.polarAngle;yield Promise.all([this.paddingInCssPixel(r,$e[0],$e[1],$e[2],$e[3],Ke),this.pencil.controls.rotateTo(Zt+this.absoluteAngle(ct,Zt),Wt+this.absoluteAngle(rt,Wt),Ke)])})}paddingInCssPixel(r,c,Je,Ke,Qe,_e){const{camera:$e,controls:qe}=this.pencil,st=$e.fov*MathUtils.DEG2RAD,rt=this.pencil.getSize().height,{size:ct}=r.getSize(),Zt=ct.x,Wt=ct.y,Yt=ct.z;let Tt=qe.getDistanceToFitBox(Zt,Wt,Yt),dt=0,vt=0,Jt=0,$t=0;for(let e0=0;e0<10;e0++){const t0=Tt-Yt*.5,i0=2*Math.tan(st*.5)*Math.abs(t0)/rt;dt=c*i0,vt=Ke*i0,Jt=Qe*i0,$t=Je*i0,Tt=qe.getDistanceToFitBox(Zt+Jt+$t,Wt+dt+vt,Yt)}return qe.fitToBox(r.object3d,_e,{paddingLeft:Jt,paddingRight:$t,paddingBottom:vt,paddingTop:dt})}drawPlaneMap($e){return ti(this,arguments,function*({geojson:r,extrudeLineGeojson:c,bbox:Je,depth:Ke,extrudelineBloom:Qe,adcode:_e}){const qe=[this.mList.getMaterialObj("plane"),this.mList.getMaterialObj("secondPlane"),this.mList.getMaterialObj("thirdPlane")];let st=this.mapHistory.length,rt;for(;!rt;)rt=qe[st],st--;const ct=this.mList.getMaterialObj("bgPlane"),Zt=li(li({},rt),ct?{bgTopMat:ct.topMat,bgSideMat:ct.sideMat,bgLineMat:ct.lineMat,bgExtrudeLineMat:ct.extrudeLineMat}:{});let Wt=r,Yt=c;this.options.cityOnMap&&c&&(Wt=c,this.options.showCityOnMapInnerLine?Yt=r:Yt=void 0);const Tt=yield this.drawController.draw("PlaneMap",{geojson:Wt,extrudeLineGeojson:Yt,depth:Ke,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:Zt,bbox:Je,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return this.mapHistory.length===0?(this.mList.setFixMeshList("area",["plane#topMat","plane#sideMat"],{name:"板块"}),this.mList.setFixMeshList("line","plane#lineMat",{name:"板块线"}),Tt.extrudelineArr&&Tt.extrudelineArr.forEach(dt=>{dt.object3d.name="板块边线",this.mList.setObject3d(dt.object3d,"extrudeLine",{baseObject:dt,replace:!0}),this.initBaseObjectUserData(dt),Qe&&(dt.object3d.userData.bloom=!0)})):Tt.extrudelineArr&&Qe&&Tt.extrudelineArr.forEach(dt=>{this.initBaseObjectUserData(dt),dt.object3d.userData.bloom=!0}),Tt})}handleBack(){return ti(this,arguments,function*({duration:r=1e3,handleLookBack:c=!0,keepOne:Je=!0}={}){if(this.isAnimating||(Je?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const Ke=this.mapHistory.pop();if(Ke!=null&&Ke.map){if(!this.options.drillDownPlateInCenter){const Qe=Ke.map.position.z,_e=this.mapObj?this.mapObj.z+(this.mapObj.depth-Ke.depth):0;yield sinusoidalInOut({onUpdate:$e=>{Ke.map.position.z=Qe+(_e-Qe)*$e}}).start({duration:r})}this.drawController.eraseWithoutMaterial(Ke.map),this.eraseLabels()}if(this.mapObj){const{map:Qe}=this.mapObj,_e=Qe==null?void 0:Qe.findGroup(Ke==null?void 0:Ke.mapInfo.adcode,!0);_e&&_e.show(),Qe&&c&&(this.options.showOneLevel?Qe.show():Qe.active(),this.options.drillDownHideParent&&this.parentBg.forEach($e=>{$e.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return ti(this,null,function*(){var Qe;const{map:c,cameraPositon:Je,cameraTarget:Ke}=this.mapObj;Je&&Ke?yield(Qe=this.pencil.controls)==null?void 0:Qe.setLookAt(Je.x,Je.y,Je.z,Ke.x,Ke.y,Ke.z,r!==0):yield this.fitTo(c,{enableTransition:r!==0})})}compareLocations(r,c){const Je=r.filter($e=>$e),Ke=c.filter($e=>$e),Qe=[];let _e=0;for(let $e=0;$e<Math.min(Je.length,Ke.length)&&Je[$e]===Ke[$e];$e++)_e++;for(let $e=_e;$e<Je.length;$e++)Qe.push(-1);for(let $e=_e;$e<Ke.length;$e++)Qe.push(Ke[$e]);return Qe}setAdcode(Je){return ti(this,arguments,function*({adcodes:r,duration:c}){var Qe,_e,$e;const{adcodes:Ke}=this;if(!(JSON.stringify(r)===JSON.stringify(Ke)||this.isAnimating))if(JSON.stringify(r)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:c})}catch(Zt){console.error(Zt)}else{const{continent:Zt,country:Wt,province:Yt,city:Tt,district:dt}=r.reduce((a0,l0)=>{const u0=this.getAdcodeShowLevel(l0);return a0[u0]=l0,a0},{}),{continent:vt,country:Jt,province:$t,city:e0,district:t0}=Ke.reduce((a0,l0)=>{const u0=this.getAdcodeShowLevel(l0);return a0[u0]=l0,a0},{}),i0=Zt||vt,n0=($e=(_e=(Qe=this.map)==null?void 0:Qe.extrudelineArr)==null?void 0:_e[0])==null?void 0:$e.object3d.userData.bloom,s0=this.compareLocations([vt,Jt,$t,e0,t0],[Zt,Wt,Yt,Tt,dt]);try{for(var qe=H1(s0.entries()),st,rt,ct;st=!(rt=yield qe.next()).done;st=!1){const[a0,l0]=rt.value;const u0=a0===s0.length-1?c:0;l0===-1?yield this.handleBack({duration:u0,handleLookBack:!!u0,keepOne:!i0}):yield this.handleDrillDown({adcode:l0,duration:u0,saveBackCamvasState:s0.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:n0})}}catch(rt){ct=[rt]}finally{try{st&&(rt=qe.return)&&(yield rt.call(qe))}finally{if(ct)throw ct[0]}}}})}setPadding(r,c=!1){this.options.mapPadding=r,c&&this.fitTo(this.map)}dispose(){var r,c;(r=this.map)==null||r.dispose(),this.parentBg.forEach(Je=>{Je.dispose()}),this.parentBg.length=0,(c=this.continentsBg)==null||c.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};J0(u1,"VisName","map");let Map$2=u1;const PENCIL_CONFIG$3={camera:{near:.01,far:100,fov:45,up:new Vector3(0,0,1)}};function clipGeojson(de,e){const r=turf.flatten(de).features,c=turf.flatten(e).features,Je={type:"FeatureCollection",features:[]};for(let Ke=r.length-1;Ke>=0;Ke--){const Qe=r[Ke];for(let _e=c.length-1;_e>=0;_e--){const $e=c[_e];if(contains(Qe,$e))Je.features.push($e);else if(contains($e,Qe))Qe.properties=$e.properties,Je.features.push(Qe);else{const qe=turf.intersect(Qe,$e);qe&&(qe.properties=$e.properties,Je.features.push(qe))}}}return Je}function contains(de,e){let r=!0;const c=turf.explode(e).features;for(let Je=c.length-1;Je>=0;Je--)if(!turf.inside(c[Je],de)){r=!1;break}return r}const getBoxMultiPoly=de=>{const e=de.features.map(r=>r.geometry.type==="Polygon"?[r.geometry.coordinates]:r.geometry.coordinates).flat();return Array.from({length:e.length},(r,c)=>turf.polygon(e[c]))};class Building extends v{constructor(r){super();J0(this,"options");J0(this,"building",{});J0(this,"outJson",new Map);J0(this,"worldPositionZ",{value:0});this.options=li({},r)}create(){return ti(this,null,function*(){const{json:r,projection:c,cacheKey:Je,meters:Ke,grey:Qe,clip:_e}=this.options,$e=this.pencil.installPlugins.get("materialList"),qe=this.pencil.getPlugin("worker"),st=this.pencil.getPlugin("draw"),rt=Qe?"-grey":"";this.createGroup();const ct=$e.getMaterialObj("building"+rt);let Zt=Je?yield qe.getCachedGeometry({cacheKey:Je}):[];if(Zt.length)_e&&this.outJson.set(1,!0);else{let Wt;_e&&(Wt=getBoxMultiPoly(_e));const Yt={};(r.features||r).forEach(dt=>{const vt=typeof dt.properties.h=="string"?dt.properties.h.split(".")[1]:0,Jt=Number(dt.properties.h)|0;Yt[vt]||(Yt[vt]={}),Yt[vt][Jt]||(Yt[vt][Jt]=[]),Wt?Wt.some(e0=>{dt.geometry.coordinates[1]&&console.log(dt.geometry.coordinates[1]);const t0=turf.polygon(dt.geometry.coordinates[0]);return turf.booleanContains(e0,t0)?(Yt[vt][Jt].push(dt),!0):!1})||this.outJson.set(dt,!1):Yt[vt][Jt].push(dt)});const Tt=Object.keys(Yt).map(dt=>{const vt=Yt[dt];return Object.keys(vt).map(Jt=>{const $t=vt[Jt];return{z:+dt,h:+Jt,coordinatesArr:$t.map(e0=>e0.geometry.type==="Polygon"?e0.geometry.coordinates[0]:e0.geometry.coordinates[0][0])}})}).flat().filter(dt=>dt.coordinatesArr.length);Zt=yield Promise.all(Tt.map(dt=>{const{h:vt,z:Jt,coordinatesArr:$t}=dt,e0=+vt<=20?+vt/18:+vt<=60?+vt/27:+vt/12;return qe.geoGeometry("extrudePolygon",{cacheKey:Je,userData:{z:Jt,h:vt},mesaage:{coordinatesArr:$t,projection:c,useGroups:2,depth:[Number(vt)*(Ke||1)],hasBottom:!1,sideRepeat:e0}})}))}yield Promise.all(Zt.map(Wt=>ti(this,null,function*(){const{h:Yt,z:Tt}=Wt.userData,dt=Yt+Tt,vt=dt<=20?"20":dt<=60?"60":"max";let Jt=this.options.material;Jt||(Jt=[ct[vt+"Top"],ct[vt+"Side"]]);const $t=yield st.draw("ExtrudePolygon",{key:"building",geometry:Wt,material:Jt},this);this.building[Yt]||(this.building[Yt]=[]),this.building[Yt].push($t),$t.position.z=Number(Tt)*(Ke||1)}))),this.options.sideGradient&&this.sideGradient(),this.object3d.name="建筑组",Qe||$e.setObject3d(this.object3d,`building${rt?"-grey":""}#group`)})}sideGradient(r="#052438",c=.05/100){this.traverse(Je=>{if(Je instanceof je){const Ke=Je.object3d.material;Ke[1].onBeforeCompile=Qe=>{Qe.uniforms.gradientColor={value:new Color$1(r)},Qe.uniforms.maxGradientHeight={value:c},Qe.uniforms.worldPositionZ=this.worldPositionZ,Qe.vertexShader=`
5517
+ `)},_e.needsUpdate=!0)}}setAreaEmissiveByProperty(r,c,Je,Ke=1){if(!this.map)return;const Qe=this.map.areaArr.find(_e=>_e.userData[r]===c);Qe&&this.map.setAreaEmissive(Qe,Je,Ke)}setLineColorByProperty(r,c,Je){if(!this.map)return;const Ke=this.map.lineArr.find(Qe=>Qe.userData[r]===c);Ke&&this.map.setLineColor(Ke,Je)}setLineWidthByProperty(r,c,Je){if(!this.map)return;const Ke=this.map.lineArr.find(Qe=>Qe.userData[r]===c);Ke&&this.map.setLineWidth(Ke,Je)}addAreaPlaneByProperty(Ke,Qe){return ti(this,arguments,function*(r,c,Je={}){var qe;if(!this.map)return;const $e=this.map.options.geojson.features.find(st=>st.properties&&st.properties[r]===c);if($e){const st=`${c}`;let rt=!1;if(this.mList.objectList.forEach((Yt,Tt)=>{if(Yt.key==="planeCopyExtrudePolygon"+st){console.warn("已经存在复制面",st),rt=!0;return}}),rt)return;let ct;Je.material?n$1(Je.material)?ct=new MeshBasicMaterial(li({},Je.material)):ct=Je.material:ct=new MeshBasicMaterial({color:"red"});let Zt;Je.lineMaterial?n$1(Je.lineMaterial)?Zt=new it$1(li({},Je.lineMaterial)):Zt=Je.lineMaterial:Zt=new it$1({color:new Color$1("blue"),sizeAttenuation:0,lineWidth:this.options.lineWidth});const Wt=yield this.map.addPlane($e,{material:ct,lineMaterial:Zt,topSegments:(qe=Je.topSegments)!=null?qe:0});return Wt.children.forEach(Yt=>{Yt instanceof je?(Yt.object3d.name="复制面"+st,this.mList.setObject3d(Yt.object3d,"planeCopyExtrudePolygon"+st,{baseObject:Yt})):Yt instanceof Ge&&(Yt.object3d.name="复制线"+st,this.mList.setObject3d(Yt.object3d,"planeCopyLine"+st,{baseObject:Yt}),this.initBaseObjectUserData(Yt))}),Wt}})}showAction(){return ti(this,null,function*(){a1(u1.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const r=this.drawController.group;if(this.mapHistory[0]){const{stop:c,start:Je}=sinusoidalInOut({onUpdate:Ke=>{if(!this.mapHistory[0]){c();return}r.position.z=-this.mapHistory[0].depth*(1-Ke)}});yield Je()}this.handlePickTest()})}handlePickTest(){return ti(this,null,function*(){var r;this.playing||(r=this.mapArea)==null||r.forEach(c=>{c.onPointerEvent("down",Je=>ti(this,null,function*(){var $e,qe,st;(qe=($e=this.pencil)==null?void 0:$e.helperController)==null||qe.removeAllExcludeScene(),(st=this.pencil.helperController)==null||st.add(Je.object3d),this.caId=Je.userData.ISO_A2||Je.userData.adcode;const Ke=this.mapLine.find(rt=>rt.userData.ISO_A2===this.caId||rt.userData.adcode===this.caId),_e=Je.object3d.material[0].color.getHexString();this.settings["测试板块颜色.color:::caId"]="#"+_e,yield this.settings["测试板块颜色.color:::caId"],this.settings["测试边框颜色.color:::caId"]="#"+(Ke==null?void 0:Ke.material.color.getHexString()),yield this.settings["测试边框颜色.color:::caId"],this.settings["测试边框宽度:::caId"]=Ke==null?void 0:Ke.material.lineWidth,yield this.settings["测试边框宽度:::caId"],this.emit("settingsChanged")}))})})}hide(){return ti(this,null,function*(){if(!this.showState)return;const r=this.drawController.group;yield sinusoidalInOut({onUpdate:c=>{r.position.z=-this.mapHistory[0].depth*c}}).start(),setTimeout(()=>{a1(u1.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return ti(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const r=yield this.drawController.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0}),c=r.object3d;this.mList.changeObject3dKey(c,"Shadow$1"),this.mList.changeObject3dKey(c.target,"Shadow$1"),this.shadowMapLight=r,r.object3d.position.set(.281,32.487,43.077),r.object3d.castShadow=!0;const Je=yield this.drawController.draw("PlaneShadow");this.mList.setObject3d(Je.object3d,"PlaneShadow",{baseObject:Je}),this.planeShadow=Je})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.mList.delObject3d(this.shadowMapLight.object3d),this.shadowMapLight=void 0),this.planeShadow&&(this.mList.delObject3d(this.planeShadow.object3d),this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(r){const c=this.getAdcodeShowLevel(r);let Je=this.options.mapDepth;Array.isArray(Je)||(Je=new Array(3).fill(Je));let Ke;return c==="country"?Ke=Je[0]:c==="province"?Ke=Je[1]:Ke=Je[2],Ke}getDepth(r,c){let Je=this.getOptionsDepth(r);if(this.options.depthReference&&this.options.bboxMap[r]){const Ke=this.options.depthReference,Qe=this.options.bboxMap[r];Je=Je*this.getReferenceScale(Ke,Qe)}else if(this.mapHistory.length&&this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]){const Ke=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode],Qe=this.getReferenceScale(Ke,c);Je=Je*Qe}return Je}getReferenceScale(r,c){const Je=Math.abs(c[3]-c[1])/Math.abs(r[3]-r[1]),Ke=Math.abs(c[2]-c[0])/Math.abs(r[2]-r[0]);return Math.max(Je,Ke)}getAdcodeShowLevel(r,c=!0){var Je;if((Je=this.options.fixCity)!=null&&Je[r]&&(r=this.options.fixCity[r]),r===0)return"world";if(r===1e5)return"country";if(/^\d{6}$/.test(`${r}`)){const{level:Ke,parent:Qe}=geojsonCn.adcodeMap[r],_e=Qe&&geojsonCn.adcodeMap[Qe].level;return Ke==="district"&&_e==="province"&&c?"city":Ke}else if(continentsType.find(Ke=>Ke.adcode===r))return"continent"}handleClick(r){const{drillDownRestrictions:c}=this.options;this.isAnimating||(r&&r.userData.adcode?this.getAdcodeShowLevel(r.userData.adcode,!1)!==c?this.showMap({adcode:r.userData.adcode}):this.emit("drilldownRestrictions",r.userData.adcode):!r&&this.mapHistory.length>1&&this.showMap({adcode:this.adcodes.at(-2)}))}beforeShowMap(r){return!0}getAdcodes(r){const c=[];let Je=r;for(;Je;)c.unshift(Je),Je=geojsonCn.adcodeMap[Je].parent;return c}showMap(Ke){return ti(this,arguments,function*({adcode:r,adcodes:c,duration:Je=1e3}){const Qe=c||this.getAdcodes(r);(yield this.beforeShowMap(Qe))!==!1&&(this.emit("beforeDrillDown",[...Qe]),yield this.setAdcode({adcodes:Qe,duration:Je}),this.emit("afterDrillDown",[...Qe]))})}drawLabels(){return ti(this,null,function*(){var Je;const r=this.options.showLabel;!((Je=this.mapArea)!=null&&Je.length)||!r||this.drawController.getAllObject("Node",{key:"mapLabel"}).length||(yield Promise.all(this.mapArea.map(Ke=>ti(this,null,function*(){let{name:Qe,adcode:_e,centroid:$e}=Ke.userData;const{DistrictID:qe,DistName:st,NAME_CN:rt,CENTROID:ct,center:Zt}=Ke.userData;if(_e=_e||qe,$e=this.options.adcode===0?ct:$e||Zt,Qe=this.options.adcode===0?rt:Qe||st,!$e)return;const Wt=this.getLocationPosition($e);if(this.drawController.getObject("Node",{key:`mapLabel-${_e}`})||!Wt)return;const[Yt,Tt,dt]=Wt;let vt=Qe;r==="lite"&&vt&&(vt=Qe.replace("自治州","").replace("地区","").replace("自治区","").replace("省","").replace("市","").replace("壮族","").replace("特别行政区","").replace("回族","").replace("维吾尔",""));const Jt=vt&&getLabelElement(vt),$t=vt!=null&&vt.startsWith("澳门")?-1:0;yield this.drawController.draw("Node",{position:new Vector3(Yt,Tt+$t,dt),children:Jt,key:`mapLabel#${this.options.adcode===0?Qe:_e}`})}))))})}eraseLabels(){const r=this.drawController.getAllObject("Node",{key:"mapLabel"});this.drawController.erase(...r)}geAdcodePosition(r){var Je;const c=(Je=this.mapArea)==null?void 0:Je.find(Ke=>Ke.userData.adcode===r);if(c){const{centroid:Ke,center:Qe}=c.userData;return this.getLocationPosition(Ke||Qe)}}getLocationPosition(r){const[c,Je]=r,[Ke,Qe]=this.projection([c,Je]);return[Ke,-Qe,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(r){const c=this.geAdcodePosition(r);if(c){const[Je,Ke,Qe]=c,_e=new Vector3(Je,Ke,Qe);_e.project(this.pencil.camera);const{width:$e,height:qe}=this.pencil.getSize(),st=(_e.x*.5+.5)*$e,rt=(_e.y*-.5+.5)*qe;return{x:st,y:rt}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(c=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(c)))}handleDrillDown(Qe){return ti(this,arguments,function*({adcode:r,duration:c,saveBackCamvasState:Je,extrudelineBloom:Ke}){var _e,$e,qe,st,rt,ct,Zt,Wt;if(typeof r!="undefined"&&!this.isAnimating){const Yt=(_e=this.map)==null?void 0:_e.findGroup(r,!0),Tt=findLevelJsonItem2(+r);if(this.isAnimating||!Tt)return;this.isAnimating=!0;const{name:dt}=Tt;let{res:vt}=($e=this.options.geojsonMap)!=null&&$e[r]?{res:(qe=this.options.geojsonMap)==null?void 0:qe[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${r}.json`),{res:Jt}=this.options.extrudeLine?(st=this.options.extrudeLineGeojsonMap)!=null&&st[r]?{res:(rt=this.options.extrudeLineGeojsonMap)==null?void 0:rt[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${r}.json`):{res:void 0};if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(vt=Jt,Jt=void 0),[vt,Jt].filter(Boolean).forEach(e0=>{if(!e0.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const t0=geojsonCn.adcodeMap[r];e0.features[0].properties=Pi(li(li({},e0.features[0].properties),t0),{center:[t0.lng,t0.lat]})}}),vt){const e0=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if(e0&&this.fixNear(r),(ct=this.options.fixGeojson)!=null&&ct[r]){const o0=(Zt=this.options.fixGeojson)==null?void 0:Zt[r];if(o0.startsWith("-")){const G0=+o0.slice(1);vt.features=vt.features.filter(T0=>T0.properties.adcode!==G0)}}let t0=this.options.bboxMap[r]||turf.bbox(Jt||vt);this.options.bboxMap[r]=t0,this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?t0=this.options.bboxMap[this.mapInfo.adcode]:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?t0=this.options.bboxMap[this.mapInfo.adcode]:t0=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(o0=>{o0.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),(Je!=null?Je:this.options.handleBackKeepCamvasState)&&this.saveBackCamvasState(-1));const i0=this.mapHistory.length,n0=i0-1,s0=this.getDepth(r,t0),a0=(Wt=this.mapHistory[n0])==null?void 0:Wt.depth,l0=i0===0?0:this.mapHistory[n0].z+(this.options.showOneLevel?0:a0),u0=i0===0?0:l0-s0,b0=turf.center(vt).geometry.coordinates,[f0,m0]=this.projection(b0),r0=yield this.drawPlaneMap({geojson:vt,extrudeLineGeojson:Jt,depth:s0,bbox:t0,adcode:r,extrudelineBloom:Ke});r0.position.setZ(u0),this.mapHistory.push({map:r0,mapInfo:Tt,z:l0,depth:s0,cX:f0,cY:-m0});const h0=r0.position.z;e0&&(r0.position.z=l0,this.fitTo(r0,{enableTransition:c!==0}),r0.position.z=h0),Yt==null||Yt.hide(),this.map&&i0!==0&&(c?yield sinusoidalInOut({onUpdate:o0=>{this.map.position.z=h0+(l0-h0)*o0}}).start({duration:c}):this.map.position.z=l0),this.drawLabels()}else console.log(`${dt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveBackCamvasState(r){const c=this.mapHistory.at(r);c&&(c.cameraPositon=this.pencil.cameraPositon.clone(),c.cameraTarget=this.pencil.cameraTarget.clone())}fixNear(r){const c=this.getAdcodeShowLevel(r);r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(c==="country"||c==="province")&&this.pencil.camera.near!==this.pencilConfig.camera.near*10?(this.pencil.camera.near=this.pencilConfig.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(c==="city"||c==="district")&&this.pencil.camera.near!==this.pencilConfig.camera.near&&(this.pencil.camera.near=this.pencilConfig.camera.near,this.pencil.camera.updateProjectionMatrix())}absoluteAngle(r,c){const Je=Math.PI*2,Ke=r-c;return MathUtils.euclideanModulo(Ke+Math.PI,Je)-Math.PI}fitTo(Qe){return ti(this,arguments,function*(r,{polarAngle:c,azimuthAngle:Je,enableTransition:Ke=!0}={}){var Yt;if(!(r!=null&&r.object3d)||(yield this.useSaveCamera(`map-${(Yt=this.mapInfo)==null?void 0:Yt.adcode}`,Ke)))return;const $e=this.options.mapPadding,{height:qe,width:st}=this.pencil.getSize();qe<$e[0]+$e[2]+100&&($e[0]=0,$e[2]=0),st<$e[1]+$e[3]+100&&($e[1]=0,$e[3]=0);const rt=c||this.options.polarAngle,ct=Je||this.options.azimuthAngle,Zt=this.pencil.controls.azimuthAngle,Wt=this.pencil.controls.polarAngle;yield Promise.all([this.paddingInCssPixel(r,$e[0],$e[1],$e[2],$e[3],Ke),this.pencil.controls.rotateTo(Zt+this.absoluteAngle(ct,Zt),Wt+this.absoluteAngle(rt,Wt),Ke)])})}paddingInCssPixel(r,c,Je,Ke,Qe,_e){const{camera:$e,controls:qe}=this.pencil,st=$e.fov*MathUtils.DEG2RAD,rt=this.pencil.getSize().height,{size:ct}=r.getSize(),Zt=ct.x,Wt=ct.y,Yt=ct.z;let Tt=qe.getDistanceToFitBox(Zt,Wt,Yt),dt=0,vt=0,Jt=0,$t=0;for(let e0=0;e0<10;e0++){const t0=Tt-Yt*.5,i0=2*Math.tan(st*.5)*Math.abs(t0)/rt;dt=c*i0,vt=Ke*i0,Jt=Qe*i0,$t=Je*i0,Tt=qe.getDistanceToFitBox(Zt+Jt+$t,Wt+dt+vt,Yt)}return qe.fitToBox(r.object3d,_e,{paddingLeft:Jt,paddingRight:$t,paddingBottom:vt,paddingTop:dt})}drawPlaneMap($e){return ti(this,arguments,function*({geojson:r,extrudeLineGeojson:c,bbox:Je,depth:Ke,extrudelineBloom:Qe,adcode:_e}){const qe=[this.mList.getMaterialObj("plane"),this.mList.getMaterialObj("secondPlane"),this.mList.getMaterialObj("thirdPlane")];let st=this.mapHistory.length,rt;for(;!rt;)rt=qe[st],st--;const ct=this.mList.getMaterialObj("bgPlane"),Zt=li(li({},rt),ct?{bgTopMat:ct.topMat,bgSideMat:ct.sideMat,bgLineMat:ct.lineMat,bgExtrudeLineMat:ct.extrudeLineMat}:{});let Wt=r,Yt=c;this.options.cityOnMap&&c&&(Wt=c,this.options.showCityOnMapInnerLine?Yt=r:Yt=void 0);const Tt=yield this.drawController.draw("PlaneMap",{geojson:Wt,extrudeLineGeojson:Yt,depth:Ke,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:Zt,bbox:Je,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return this.mapHistory.length===0?(this.mList.setFixMeshList("area",["plane#topMat","plane#sideMat"],{name:"板块"}),this.mList.setFixMeshList("line","plane#lineMat",{name:"板块线"}),Tt.extrudelineArr&&Tt.extrudelineArr.forEach(dt=>{dt.object3d.name="板块边线",this.mList.setObject3d(dt.object3d,"extrudeLine",{baseObject:dt,replace:!0}),this.initBaseObjectUserData(dt),Qe&&(dt.object3d.userData.bloom=!0)})):Tt.extrudelineArr&&Qe&&Tt.extrudelineArr.forEach(dt=>{this.initBaseObjectUserData(dt),dt.object3d.userData.bloom=!0}),Tt})}handleBack(){return ti(this,arguments,function*({duration:r=1e3,handleLookBack:c=!0,keepOne:Je=!0}={}){if(this.isAnimating||(Je?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const Ke=this.mapHistory.pop();if(Ke!=null&&Ke.map){if(!this.options.drillDownPlateInCenter){const Qe=Ke.map.position.z,_e=this.mapObj?this.mapObj.z+(this.mapObj.depth-Ke.depth):0;yield sinusoidalInOut({onUpdate:$e=>{Ke.map.position.z=Qe+(_e-Qe)*$e}}).start({duration:r})}this.drawController.eraseWithoutMaterial(Ke.map),this.eraseLabels()}if(this.mapObj){const{map:Qe}=this.mapObj,_e=Qe==null?void 0:Qe.findGroup(Ke==null?void 0:Ke.mapInfo.adcode,!0);_e&&_e.show(),Qe&&c&&(this.options.showOneLevel?Qe.show():Qe.active(),this.options.drillDownHideParent&&this.parentBg.forEach($e=>{$e.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return ti(this,null,function*(){var Qe;const{map:c,cameraPositon:Je,cameraTarget:Ke}=this.mapObj;Je&&Ke?yield(Qe=this.pencil.controls)==null?void 0:Qe.setLookAt(Je.x,Je.y,Je.z,Ke.x,Ke.y,Ke.z,r!==0):yield this.fitTo(c,{enableTransition:r!==0})})}compareLocations(r,c){const Je=r.filter($e=>$e),Ke=c.filter($e=>$e),Qe=[];let _e=0;for(let $e=0;$e<Math.min(Je.length,Ke.length)&&Je[$e]===Ke[$e];$e++)_e++;for(let $e=_e;$e<Je.length;$e++)Qe.push(-1);for(let $e=_e;$e<Ke.length;$e++)Qe.push(Ke[$e]);return Qe}setAdcode(Je){return ti(this,arguments,function*({adcodes:r,duration:c}){var Qe,_e,$e;const{adcodes:Ke}=this;if(!(JSON.stringify(r)===JSON.stringify(Ke)||this.isAnimating))if(JSON.stringify(r)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:c})}catch(Zt){console.error(Zt)}else{const{continent:Zt,country:Wt,province:Yt,city:Tt,district:dt}=r.reduce((a0,l0)=>{const u0=this.getAdcodeShowLevel(l0);return a0[u0]=l0,a0},{}),{continent:vt,country:Jt,province:$t,city:e0,district:t0}=Ke.reduce((a0,l0)=>{const u0=this.getAdcodeShowLevel(l0);return a0[u0]=l0,a0},{}),i0=Zt||vt,n0=($e=(_e=(Qe=this.map)==null?void 0:Qe.extrudelineArr)==null?void 0:_e[0])==null?void 0:$e.object3d.userData.bloom,s0=this.compareLocations([vt,Jt,$t,e0,t0],[Zt,Wt,Yt,Tt,dt]);try{for(var qe=H1(s0.entries()),st,rt,ct;st=!(rt=yield qe.next()).done;st=!1){const[a0,l0]=rt.value;const u0=a0===s0.length-1?c:0;l0===-1?yield this.handleBack({duration:u0,handleLookBack:!!u0,keepOne:!i0}):yield this.handleDrillDown({adcode:l0,duration:u0,saveBackCamvasState:s0.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:n0})}}catch(rt){ct=[rt]}finally{try{st&&(rt=qe.return)&&(yield rt.call(qe))}finally{if(ct)throw ct[0]}}}})}setPadding(r,c=!1){this.options.mapPadding=r,c&&this.fitTo(this.map)}dispose(){var r,c;(r=this.map)==null||r.dispose(),this.parentBg.forEach(Je=>{Je.dispose()}),this.parentBg.length=0,(c=this.continentsBg)==null||c.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};J0(u1,"VisName","map");let Map$2=u1;const PENCIL_CONFIG$3={camera:{near:.01,far:100,fov:45,up:new Vector3(0,0,1)}};function clipGeojson(de,e){const r=turf.flatten(de).features,c=turf.flatten(e).features,Je={type:"FeatureCollection",features:[]};for(let Ke=r.length-1;Ke>=0;Ke--){const Qe=r[Ke];for(let _e=c.length-1;_e>=0;_e--){const $e=c[_e];if(contains(Qe,$e))Je.features.push($e);else if(contains($e,Qe))Qe.properties=$e.properties,Je.features.push(Qe);else{const qe=turf.intersect(Qe,$e);qe&&(qe.properties=$e.properties,Je.features.push(qe))}}}return Je}function contains(de,e){let r=!0;const c=turf.explode(e).features;for(let Je=c.length-1;Je>=0;Je--)if(!turf.inside(c[Je],de)){r=!1;break}return r}const getBoxMultiPoly=de=>{const e=de.features.map(r=>r.geometry.type==="Polygon"?[r.geometry.coordinates]:r.geometry.coordinates).flat();return Array.from({length:e.length},(r,c)=>turf.polygon(e[c]))};class Building extends v{constructor(r){super();J0(this,"options");J0(this,"building",{});J0(this,"outJson",new Map);J0(this,"worldPositionZ",{value:0});this.options=li({},r)}create(){return ti(this,null,function*(){const{json:r,projection:c,cacheKey:Je,meters:Ke,grey:Qe,clip:_e}=this.options,$e=this.pencil.installPlugins.get("materialList"),qe=this.pencil.getPlugin("worker"),st=this.pencil.getPlugin("draw"),rt=Qe?"-grey":"";this.createGroup();const ct=$e.getMaterialObj("building"+rt);let Zt=Je?yield qe.getCachedGeometry({cacheKey:Je}):[];if(Zt.length)_e&&this.outJson.set(1,!0);else{let Wt;_e&&(Wt=getBoxMultiPoly(_e));const Yt={};(r.features||r).forEach(dt=>{const vt=typeof dt.properties.h=="string"?dt.properties.h.split(".")[1]:0,Jt=Number(dt.properties.h)|0;Yt[vt]||(Yt[vt]={}),Yt[vt][Jt]||(Yt[vt][Jt]=[]),Wt?Wt.some(e0=>{dt.geometry.coordinates[1]&&console.log(dt.geometry.coordinates[1]);const t0=turf.polygon(dt.geometry.coordinates[0]);return turf.booleanContains(e0,t0)?(Yt[vt][Jt].push(dt),!0):!1})||this.outJson.set(dt,!1):Yt[vt][Jt].push(dt)});const Tt=Object.keys(Yt).map(dt=>{const vt=Yt[dt];return Object.keys(vt).map(Jt=>{const $t=vt[Jt];return{z:+dt,h:+Jt,coordinatesArr:$t.map(e0=>e0.geometry.type==="Polygon"?e0.geometry.coordinates[0]:e0.geometry.coordinates[0][0])}})}).flat().filter(dt=>dt.coordinatesArr.length);Zt=yield Promise.all(Tt.map(dt=>{const{h:vt,z:Jt,coordinatesArr:$t}=dt,e0=+vt<=20?+vt/18:+vt<=60?+vt/27:+vt/12;return qe.geoGeometry("extrudePolygon",{cacheKey:Je,userData:{z:Jt,h:vt},mesaage:{coordinatesArr:$t,projection:c,useGroups:2,depth:[Number(vt)*(Ke||1)],hasBottom:!1,sideRepeat:e0}})}))}yield Promise.all(Zt.map(Wt=>ti(this,null,function*(){const{h:Yt,z:Tt}=Wt.userData,dt=Yt+Tt,vt=dt<=20?"20":dt<=60?"60":"max";let Jt=this.options.material;Jt||(Jt=[ct[vt+"Top"],ct[vt+"Side"]]);const $t=yield st.draw("ExtrudePolygon",{key:"building",geometry:Wt,material:Jt},this);this.building[Yt]||(this.building[Yt]=[]),this.building[Yt].push($t),$t.position.z=Number(Tt)*(Ke||1)}))),this.options.sideGradient&&this.sideGradient(),this.object3d.name="建筑组",Qe||$e.setObject3d(this.object3d,`building${rt?"-grey":""}#group`)})}sideGradient(r="#052438",c=.05/100){this.traverse(Je=>{if(Je instanceof je){const Ke=Je.object3d.material;Ke[1].onBeforeCompile=Qe=>{Qe.uniforms.gradientColor={value:new Color$1(r)},Qe.uniforms.maxGradientHeight={value:c},Qe.uniforms.worldPositionZ=this.worldPositionZ,Qe.vertexShader=`
5518
5518
  varying vec3 vPosition;
5519
5519
  varying vec3 vWorldPosition;
5520
5520
  ${Qe.vertexShader}
@@ -5622,7 +5622,7 @@ version 0.8.2
5622
5622
  #include <tonemapping_fragment>
5623
5623
  #include <colorspace_fragment>
5624
5624
  #include <fog_fragment>
5625
- }`},s0=new ShaderMaterial({name:n0.name,uniforms:UniformsUtils.clone(n0.uniforms),vertexShader:n0.vertexShader,fragmentShader:n0.fragmentShader,lights:!0,side:qe,fog:st});s0.uniforms.mirrorSampler.value=i0.texture,s0.uniforms.textureMatrix.value=e0,s0.uniforms.alpha.value=Je,s0.uniforms.normalSampler.value=Ke,s0.uniforms.waterColor.value=Qe,s0.uniforms.distortionScale.value=$e,s0.uniforms.eye.value=_e;const a0=de.material;de.material=s0,de.onBeforeRender=function(l0,u0,b0){a0.color!==s0.uniforms.waterColor.value&&(s0.uniforms.waterColor.value=a0.color),Zt.setFromMatrixPosition(de.matrixWorld),Wt.setFromMatrixPosition(b0.matrixWorld),Yt.extractRotation(de.matrixWorld),ct.set(0,0,1),ct.applyMatrix4(Yt),vt.subVectors(Zt,Wt),b0.updateMatrix(),b0.updateMatrixWorld(),de.updateMatrix(),de.updateMatrixWorld();const f0=new Frustum,m0=new Matrix4;if(m0.multiplyMatrices(b0.projectionMatrix,b0.matrixWorldInverse),f0.setFromProjectionMatrix(m0),!f0.intersectsObject(de)||vt.dot(ct)>0)return;vt.reflect(ct).negate(),vt.add(Zt),Yt.extractRotation(b0.matrixWorld),Tt.set(0,0,-1),Tt.applyMatrix4(Yt),Tt.add(Wt),Jt.subVectors(Zt,Tt),Jt.reflect(ct).negate(),Jt.add(Zt),t0.position.copy(vt),t0.up.set(0,1,0),t0.up.applyMatrix4(Yt),t0.up.reflect(ct),t0.lookAt(Jt),t0.far=b0.far,t0.updateMatrixWorld(),t0.projectionMatrix.copy(b0.projectionMatrix),e0.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),e0.multiply(t0.projectionMatrix),e0.multiply(t0.matrixWorldInverse),rt.setFromNormalAndCoplanarPoint(ct,Zt),rt.applyMatrix4(t0.matrixWorldInverse),dt.set(rt.normal.x,rt.normal.y,rt.normal.z,rt.constant);const r0=t0.projectionMatrix;$t.x=(Math.sign(dt.x)+r0.elements[8])/r0.elements[0],$t.y=(Math.sign(dt.y)+r0.elements[9])/r0.elements[5],$t.z=-1,$t.w=(1+r0.elements[10])/r0.elements[14],dt.multiplyScalar(2/dt.dot($t)),r0.elements[2]=dt.x,r0.elements[6]=dt.y,r0.elements[10]=dt.z+1,r0.elements[14]=dt.w,_e.setFromMatrixPosition(b0.matrixWorld);const h0=l0.getRenderTarget(),o0=l0.xr.enabled,G0=l0.shadowMap.autoUpdate;de.visible=!1,l0.xr.enabled=!1,l0.shadowMap.autoUpdate=!1,l0.setRenderTarget(i0),l0.state.buffers.depth.setMask(!0),l0.autoClear===!1&&l0.clear(),l0.render(u0,t0),de.visible=!0,l0.xr.enabled=o0,l0.shadowMap.autoUpdate=G0,l0.setRenderTarget(h0);const T0=b0.viewport;T0!==void 0&&l0.state.viewport(T0)}},PENCIL_CONFIG$2={camera:{near:.1,far:1e3,fov:45,up:new Vector3(0,0,1)}};class City$1 extends Base{constructor(){super(...arguments);J0(this,"drawController",new sl(objs$3));J0(this,"adcode",0);J0(this,"pcenter",[104,37.5]);J0(this,"pscale",5e4);J0(this,"projection");J0(this,"group");J0(this,"building");J0(this,"road");J0(this,"innerAreaGroup");J0(this,"outAreaGroup");J0(this,"multiplyScalar",1)}setOptions(r){super.setOptions(li({fitTo:!0,plane:!0,grey:!1,greyFull:!1,clipOutShow:!1,planeOut:!1,showBuilding:!0,showRoad:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1},r)),this.pencilConfig=PENCIL_CONFIG$2}loaderAdd(){const r=this.loader;r.add(["/image/city/20-1.jpg","/image/city/60-1.jpg","/image/city/max-1.jpg","/image/city/cylinder.webp"]),r.add(["/image/city/20.webp","/image/city/60.webp","/image/city/max.webp"],{colorCorrection:!1})}loaderAddJson(r){this.loader.add([this.options.showBuilding&&`/cityGzip/Building${r}.json.gzip`,this.options.showRoad&&`/cityGzip/Road${r}.json.gzip`,this.options.showRiver&&`/cityGzip/River${r}.json.gzip`,this.options.showGrassland&&`/cityGzip/Grassland${r}.json.gzip`].filter(Boolean),{})}initMaterial(){return ti(this,null,function*(){if(!this.mList.getMaterialObj("building")){const r=["20","60","max"].reduce((Je,Ke)=>{const Qe=this.loader.getAsset(`/image/city/${Ke}-1.jpg`),_e=this.loader.getAsset(`/image/city/${Ke}.webp`);return Je[Ke]=[new MeshBasicMaterial({name:"建筑顶面-板块内"+Ke+"高",color:"#00a3bc"}),new MeshStandardMaterial({name:"建筑侧面-板块内"+Ke+"高",map:Qe,normalMap:_e,envMap:this.getRoomEnvMap()})],[Qe,_e].forEach($e=>{$e.wrapS=RepeatWrapping,$e.wrapT=RepeatWrapping,$e.repeat.set(1,1)}),Je},{});this.mList.setMaterialObj("building",{"20Top":r[20][0],"20Side":r[20][1],"60Top":r[60][0],"60Side":r[60][1],maxTop:r.max[0],maxSide:r.max[1]});const c=["20","60","max"].reduce((Je,Ke)=>{const Qe=this.loader.getAsset(`/image/city/${Ke}-1.jpg`),_e=this.loader.getAsset(`/image/city/${Ke}.webp`);return Je[Ke]=[new MeshBasicMaterial({name:"建筑顶面-板块外"+Ke+"高",color:"#133144"}),new MeshStandardMaterial({name:"建筑侧面-块外"+Ke+"高",map:Qe,normalMap:_e,envMap:this.getRoomEnvMap()})],[Qe,_e].forEach($e=>{$e.wrapS=RepeatWrapping,$e.wrapT=RepeatWrapping,$e.repeat.set(1,1)}),Je},{});this.mList.setMaterialObj("building-grey",{"20Top":c[20][0],"20Side":c[20][1],"60Top":c[60][0],"60Side":c[60][1],maxTop:c.max[0],maxSide:c.max[1]})}if(!this.mList.getMaterialObj("road")){const r=new it$1({name:"道路-板块内",color:"#ffc457",sizeAttenuation:0,lineWidth:40}),c=new it$1({name:"道路-板块外",color:"#4a3f15",sizeAttenuation:0,lineWidth:40});this.mList.setMaterialObj("road",{primary:r}),this.mList.setMaterialObj("road-grey",{primary:c})}if(this.mList.getMaterialObj("geography")||(this.mList.setMaterialObj("geography",{river:new MeshBasicMaterial({name:"河流-板块内",color:"#115d8a"}),grassland:new MeshBasicMaterial({name:"绿地-板块内",color:"#043141"})}),this.mList.setMaterialObj("geography-grey",{river:new MeshBasicMaterial({name:"河流-板块外",color:"#19354f"}),grassland:new MeshBasicMaterial({name:"绿地-板块外",color:"#133341"})})),!this.mList.getMaterial("city-plane")){const r=new MeshBasicMaterial({name:"底面",color:"#0b2234"});this.mList.setMaterial("city-plane",r)}})}disableSSAO(){const r=this.pencil.composerController.ssaoPass;r&&(r.enabled=!1)}enabledSSAO(){const r=this.pencil.composerController.ssaoPass;r&&(r.enabled=!0)}init(){return ti(this,null,function*(){const{jsonName:r,bbox:c,adcode:Je}=this.options;yield this.initPencil(),this.tier0||this.enabledSSAO(),this.loaderAdd(),this.loaderAddJson(r),console.time(`vis-core:time.${this.visName}${Je}-loader`),yield this.loader.loadAll(),console.timeEnd(`vis-core:time.${this.visName}${Je}-loader`),this.verticalDragToForward=!0,this.adcode=this.options.adcode,this.options.center&&(this.pcenter=this.options.center),this.projection=G({center:this.pcenter,scale:this.pscale}),this.group=yield this.drawController.draw("Group"),this.group.scale.multiplyScalar(this.multiplyScalar),this.innerAreaGroup=yield this.drawController.draw("Group",{},this.group),this.outAreaGroup=yield this.drawController.draw("Group",{},this.group),yield this.initMaterial(),yield this.initVis(),yield Promise.all(this.drawController.objectsPromise)})}getInvert(r){var c,Je;return(Je=(c=this.projection).invert)==null?void 0:Je.call(c,[r.x,-r.z])}fitTo(r,c=!0){return ti(this,null,function*(){this.pencil.controls.fitToBox(r.object3d,c),this.pencil.controls.rotatePolarTo(this.pencil.camera.up.z===1?Math.PI/180*70:Math.PI/180*160,c)})}initVis(){return ti(this,null,function*(){const{fitTo:r,jsonName:c,bbox:Je,planeOut:Ke}=this.options,Qe=this.adcode,_e=this.loader,$e=_e.getAsset(`/cityGzip/Building${c}.json.gzip`),qe=_e.getAsset(`/cityGzip/Road${c}.json.gzip`),st=_e.getAsset(`/cityGzip/River${c}.json.gzip`),rt=_e.getAsset(`/cityGzip/Grassland${c}.json.gzip`),ct={};[...(st==null?void 0:st.features)||[],...(rt==null?void 0:rt.features)||[]].forEach(Jt=>{Jt.properties.o&&(ct[Jt.properties.o]=!0)});const Zt=Object.keys(ct).map(Jt=>+Jt).sort((Jt,$t)=>Jt-$t),Wt=-G({center:this.pcenter,scale:this.pscale})([this.pcenter[0],899e-8+this.pcenter[1]])[1];let Yt=1e3,Tt=1e3;if(Je){const Jt=this.projection([Je[0],Je[1]]),$t=this.projection([Je[2],Je[3]]),e0=Math.abs($t[0]-Jt[0]),t0=Math.abs($t[1]-Jt[1]);Yt=e0,Tt=t0,console.log("bbox",e0,t0)}const dt=this.mList.getMaterial("city-plane"),vt=yield this.drawController.draw("CityPlane",{width:Yt*10,height:Tt*10,material:dt},Ke?this.outAreaGroup:this.innerAreaGroup);this.options.grey||this.mList.setObject3d(vt.object3d,"city-plane",{baseObject:vt}),yield Promise.all([$e&&this.options.showBuilding&&this.drawBuilding({json:$e,meters:Wt,clip:this.options.clip,grey:this.options.grey,sideGradient:this.options.buildingSideGradient}),qe&&this.options.showRoad&&this.drawRoad({json:qe,meters:Wt,z:Zt.length,clip:this.options.clip,grey:this.options.grey}),st&&this.options.showRiver&&this.drawArea({json:st,type:"river",oArr:Zt,clip:this.options.clip,grey:this.options.grey}),rt&&this.options.showGrassland&&this.drawArea({json:rt,type:"grassland",oArr:Zt,clip:this.options.clip,grey:this.options.grey}),this.options.clip||this.drawController.draw("Target",{key:"cityTarget"+Qe},this.innerAreaGroup)].filter(Boolean)),r&&this.fitToTarget(Qe),this.pencil.getPlugin("worker").saveCache()})}fitToTarget(r,c){return ti(this,null,function*(){const Je=this.drawController.getObject("Target",{key:"cityTarget"+r});if(Je){if(c){const Qe=this.getWorldPosition(c[0],c[1]);Je.position.x=Qe.x,Je.position.y=Qe.y,Je.position.z=0}else{const Qe=Object.values(this.building.building).pop(),{min:_e,max:$e}=Qe[0].getSize();_e.multiplyScalar(1/this.multiplyScalar),$e.multiplyScalar(1/this.multiplyScalar);const qe=new Vector3(($e.x+_e.x)/2,($e.y+_e.y)/2,0);Je.position.copy(qe)}const Ke=Je.object3d.getWorldPosition(new Vector3);yield this.lookAtTarget({target:Ke,distance:6.984429017840711*this.multiplyScalar,polarAngle:.9963693538268685,azimuthAngle:0},!0)}})}drawBuilding(){return ti(this,arguments,function*(r={}){var Ke;if(!r.json){console.warn(" json:Building");return}const c=this.options.cacheKey?`building-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,Je=yield this.drawController.draw("Building",{projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:c,meters:r.meters,sideGradient:r.sideGradient,grey:r.grey,clip:r.clip},(Ke=r.group)!=null?Ke:this.innerAreaGroup);return this.options.clipOutShow&&Je.outJson.size&&(yield this.drawBuilding({json:this.options.greyFull?r.json:{features:Array.from(Je.outJson.keys()).filter(Qe=>Qe!==1)},meters:r.meters,grey:!0,clip:void 0,sideGradient:!1,group:this.outAreaGroup})),r.grey||(this.building=Je),Je})}drawArea(){return ti(this,arguments,function*(r={}){var _e;if(!r.json){console.warn(" json:drawGeography");return}if(!r.type)return;const{grey:c}=r,Je=c?"-grey":"",Ke=this.options.cacheKey?`${r.type}-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,Qe=yield this.drawController.draw("Area",{projection:{center:this.pcenter,scale:this.pscale},json:r.json,material:this.mList.getMaterialObj("geography"+Je)[r.type],type:r.type,cacheKey:Ke,oArr:r.oArr,clip:r.clip},(_e=r.group)!=null?_e:this.innerAreaGroup);return this.options.clipOutShow&&Qe.outJson.size&&(yield this.drawArea({json:this.options.greyFull?r.json:{features:Array.from(Qe.outJson.keys()).filter($e=>$e!==1)},type:r.type,grey:!0,oArr:r.oArr,clip:void 0,group:this.outAreaGroup})),r.type==="river"&&!c&&this.options.setWaterMaterial&&Qe.area.forEach($e=>{setWaterMaterial($e.object3d)}),Qe})}drawRoad(){return ti(this,arguments,function*(r={}){var Qe;if(!r.json){console.warn(" json:Road");return}const c=this.options.cacheKey?`road-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,Je=yield this.drawController.draw("Road",{projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:c,grey:r.grey,meters:r.meters,clip:r.clip},(Qe=r.group)!=null?Qe:this.innerAreaGroup),Ke=r.z||0;return Je.position.z=(Ke+1)*.001,this.options.clipOutShow&&Je.outJson.size&&(yield this.drawRoad({json:this.options.greyFull?r.json:{features:Array.from(Je.outJson.keys()).filter(_e=>_e!==1)},meters:r.meters,z:r.z,clip:void 0,grey:!0,group:this.outAreaGroup})),r.grey||(this.road=Je),Je})}getWorldPosition(r,c){if(this.options.coordtransformFunc){const Qe=this.options.coordtransformFunc(r,c);r=Qe.longitude,c=Qe.latitude}const[Je,Ke]=this.projection([r,c]);return{x:Je,y:-Ke}}}J0(City$1,"VisName","city");class City extends City$1{constructor(){super(...arguments);J0(this,"drawController",objs$2);J0(this,"multiplyScalar",1/1e3)}fixNearFar(r=.01,c){this.pencil.camera.near=r*this.multiplyScalar,c&&(this.pencil.camera.far=c*this.multiplyScalar),this.pencil.camera.updateProjectionMatrix()}}const m1=class m1 extends Map$1{constructor(){super(...arguments);J0(this,"cityVisObj",{});J0(this,"showGroup")}get cityVis(){var c,Je;let r=this.mapInfo.adcode;if((c=this.options.fixCity)!=null&&c[r]&&(r=this.options.fixCity[r]),this.getAdcodeShowLevel(r)!=="city"){const Ke=geojsonCn.adcodeMap[r].parent;this.getAdcodeShowLevel(Ke)==="city"&&(r=Ke)}return(Je=this.cityVisObj[r])==null?void 0:Je.city}get cityTarget(){var c;let r=this.mapInfo.adcode;return(c=this.options.fixCity)!=null&&c[r]&&(r=this.options.fixCity[r]),this.drawController.getObject("Target",{key:"cityTarget"+r})}setOptions(r){super.setOptions(li({clipOutShow:!0,allCity:!1,showBuilding:!0,buildingSideGradient:!1,showRoad:!0,cacheCity:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,showCityOnMapInnerLine:!1,greyFull:!1},r)),this.pencilConfig=PENCIL_CONFIG$3}init(){return ti(this,null,function*(){var r;if(yield a1(m1.prototype,this,"init").call(this),this.showGroup="map",this.options.adcode==1e5&&(this.pencil.camera.far=500,this.pencil.camera.updateProjectionMatrix()),this.options.cityOnMap)if(this.options.allCity){const c=geojsonCn.adcodeMap[this.mapInfo.adcode],Je=c.level==="province"?c.adcode:geojsonCn.adcodeMap[this.mapInfo.adcode].parent,Ke=(r=geojsonCn.allArr.find(Qe=>Qe.adcode===Je))==null?void 0:r.subAreas;Ke&&(yield Promise.all(Ke.map(Qe=>ti(this,null,function*(){yield this.initCityOnMap(Qe)}))))}else yield this.initCityOnMap(this.mapInfo.adcode)})}handleClick(r){this.showGroup==="map"&&super.handleClick(r)}initCityVis(Je){return ti(this,arguments,function*(r,c={clip:!1,grey:!1}){var st;(st=this.options.fixCity)!=null&&st[r]&&(r=this.options.fixCity[r]);const Ke=this.options.center,Qe=this.options.cityBboxMap[r];if(yield Promise.all(Object.values(this.cityVisObj).map(rt=>rt.state.promise)),this.cityVisObj[r])return;this.cityVisObj[r]={state:esusLite.makePromiseCreator(!0)};const _e=this.options.jsonNameObj[r],$e=new City({container:this.container,editor:!1});$e.setOptions({container:this.container,center:Ke,bbox:Qe,fitTo:!1,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:_e,grey:c.grey,greyFull:this.options.greyFull,clip:c.clip?this.map.options.geojson:void 0,clipOutShow:this.options.clipOutShow,planeOut:this.options.cityOnMap,showBuilding:this.options.showBuilding,buildingSideGradient:this.options.buildingSideGradient,showRoad:this.options.showRoad,showGrassland:this.options.showGrassland,showRiver:this.options.showRiver,setWaterMaterial:this.options.setWaterMaterial}),geojsonCn.adcodeMap[r].parent===35e4&&this.options.curvatureResolution&&city350000($e),$e.pencilConfig=this.pencilConfig,$e.pencil=this.pencil,$e.mList=this.mList,$e.editor=this.editor,$e.workerOnce=this.workerOnce,$e.sceneActive=this.sceneActive,$e.drawController=this.drawController,yield $e.init(),$e.group.hide(),this.cityVisObj[r].city=$e,this.cityVisObj[r].state.resolve(),this.emit("initCityVis",r)})}initCityOnMap(r){return ti(this,null,function*(){if(this.getAdcodeShowLevel(r)!=="city"){const Ke=geojsonCn.adcodeMap[r].parent;this.getAdcodeShowLevel(Ke)==="city"&&(yield this.initCityOnMap(Ke));return}const c=r===this.mapInfo.adcode||geojsonCn.adcodeMap[this.mapInfo.adcode].parent===r||geojsonCn.adcodeMap[r].parent===this.mapInfo.adcode;yield this.initCityVis(r,{clip:c,grey:!c}),yield this.cityVisObj[r].state.promise;const Je=this.cityVisObj[r].city;if(c){const Ke=this.mapObj.depth+1e-5;Je.group.position.z=this.mapObj.z+Ke,Je.outAreaGroup&&(Je.outAreaGroup.position.z-=Ke/Je.multiplyScalar)}else Je.group.position.z=this.mapObj.z;this.pencil.camera.near=.001,this.pencil.camera.far=7,this.pencil.camera.updateProjectionMatrix(),Je.group.show(),this.verticalDragToForward=!0})}showCity(r,c){return ti(this,null,function*(){var st;let Je,Ke,Qe=this.mapInfo.adcode,_e=.03637926645733737,$e=.9963693538268685,qe=0;if(typeof r=="number"?(Qe=r,Je=c,console.warn("showCity(adcode, lnglat) is deprecated, use showCity(option) instead")):(Je=r.lnglat,Ke=r.target,typeof r.adcode!="undefined"&&(Qe=r.adcode),typeof r.distance!="undefined"&&(_e=r.distance),typeof r.polarAngle!="undefined"&&($e=r.polarAngle),typeof r.azimuthAngle!="undefined"&&(qe=r.azimuthAngle)),this.options.cityOnMap){if(this.options.handleBackKeepCamvasState&&this.showGroup==="map"&&this.saveBackCamvasState(-1),Je||Ke){this.showGroup="city";const rt=Ke||this.getLocationPosition(Je),ct=new Vector3(rt[0],rt[1],this.mapObj.z+this.mapObj.depth);this.emit("beforeDrillDown","city"),yield this.cityVis.lookAtTarget({target:ct,distance:_e,polarAngle:$e,azimuthAngle:qe},!0),this.emit("afterDrillDown","city")}else console.error("showCityOnMap lnglat or target is required");return}if(Qe!==this.mapInfo.adcode){yield a1(m1.prototype,this,"showMap").call(this,{adcode:Qe,duration:0}),yield this.showCity({adcode:Qe,lnglat:Je});return}(st=this.options.fixCity)!=null&&st[Qe]&&(Qe=this.options.fixCity[Qe]),yield this.cityVisObj[Qe].state.promise,this.emit("beforeDrillDown","city"),this.showGroup="city",this.cityVis.fixNearFar(),this.cityVis.group.position.z=this.mapObj.z+this.mapObj.depth,this.cityVis.group.show(),this.group.hide(),this.verticalDragToForward=!0,yield this.cityVis.fitToTarget(Qe,Je),this.emit("afterDrillDown","city")})}showMap(c){return ti(this,arguments,function*({adcode:r}){if(this.isAnimating)return;const Je=r?this.getAdcodes(r):this.adcodes;this.showGroup==="city"&&!this.options.cityOnMap&&(this.fixNear(this.mapInfo.adcode),this.cityVis.group.hide(),this.group.show(),this.verticalDragToForward=!1),this.showGroup="map",JSON.stringify(Je)===JSON.stringify(this.adcodes)?(this.emit("beforeDrillDown",[...Je]),this.options.cityOnMap?yield this.handleLookBack():yield this.fitTo(this.map),this.emit("afterDrillDown",[...Je])):yield a1(m1.prototype,this,"showMap").call(this,{adcodes:[...Je]})})}dispose(){Object.values(this.cityVisObj).forEach(r=>{r.city&&r.city.dispose(),r.state.reject()}),super.dispose()}};J0(m1,"VisName","map2");let index$2=m1;class Earth$1 extends Sphere{constructor(r){super();J0(this,"options");this.options=li({radius:30},r)}create(){const r=this.pencil.installPlugins.get("materialList"),c=r.getMaterial("earthMaterial");this.material=c,super.create(),this.rotation.y=Math.PI/180*-90,this.object3d.name="地球",r.setObject3d(this.object3d,"earth")}}class Countries extends v{constructor(r){super();J0(this,"options");J0(this,"areaArr",[]);J0(this,"lineArr",[]);this.options=li({start:30,depth:1.4,lineOffset:.01,hasTop:!0,hasSide:!0,hasLine:!0,lineDuration:1e3,areaGroup:!0},r)}create(){return ti(this,null,function*(){const{geojson:r,mats:c,hasSide:Je,lineOffset:Ke,areaGroup:Qe}=this.options;this.createGroup();const _e=this.pencil.getPlugin("worker"),$e=this.pencil.getPlugin("draw"),{borderMat:qe,topMat:st,outLine:rt}=c;let ct=r.features.map(Yt=>{const{type:Tt,coordinates:dt}=Yt.geometry;let vt=[];return Tt==="Polygon"?vt=dt:Tt==="MultiPolygon"&&(vt=dt.flat()),{coords:vt,properties:Yt.properties}});const Zt=this.options.hasTop||this.options.hasSide,Wt=this.options.hasLine;Qe||(ct=[{coords:ct.map(({coords:Yt})=>Yt).flat(),properties:{}}]),yield Promise.all(ct.map(Yt=>[Zt&&_e.geoGeometry("conicPolygon",{mesaage:{start:[this.options.start],depth:[this.options.depth],useGroups:2,hasBottom:!1,topFirst:!0,coordinatesArr:Yt.coords,bbox:this.options.bbox,hasSide:Je},cb:Tt=>ti(this,null,function*(){const dt=yield $e.draw("ConicPolygon",{geometry:Tt,material:Je?[st,qe]:st,hasSide:Je},this);dt.userData=li({},Yt.properties),this.areaArr.push(dt)})}),Wt&&_e.geoGeometry("conicLine",{mesaage:{start:[this.options.start+this.options.depth+Ke],lineWidth:[1],coordinatesArr:Yt.coords},cb:Tt=>ti(this,null,function*(){const dt=yield $e.draw("Line",{geometry:Tt,material:rt,onTop:2},this);dt.userData=li({},Yt.properties),this.lineArr.push(dt)})})].filter(Boolean)).flat())})}setAreaColor(r,c){if(c==="origin"){r.useMaterial("origin");return}const[,Je]=r.setMaterialList(c,"clone",!1);return Je.color.set(c),r.useMaterial(c),Je}setLineColor(r,c){if(c==="origin"){r.useMaterial("origin");return}const Je=r.setMaterialList(c,"clone",!1);return Je.color.set(c),r.useMaterial(c),Je}setAreaEmissive(r,c,Je=1){if(c==="origin"){r.useMaterial("origin");return}const Ke="Emissive"+c+"_"+Je,[,Qe]=r.setMaterialList(Ke,"clone",!1);return Qe.emissive.set(c),Qe.emissiveIntensity=Je,r.useMaterial(Ke),Qe}}class SphereShadow extends v{constructor(r){super();J0(this,"options");this.options=li({radius:30},r)}create(){return ti(this,null,function*(){const r=this.pencil.installPlugins.get("materialList"),c=new SphereGeometry(this.options.radius,128,90),Je=new MeshBasicMaterial;this.createMesh(c,Je),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",r.setObject3d(this.object3d,"SphereShadow",{baseObject:this}),this.hide()})}}const objs$1=Pi(li({},objs$5),{Earth:Earth$1,Countries,SphereShadow}),PENCIL_CONFIG$1={camera:{near:.1,far:1e3}},chinaPlate=de=>{de.extendsOptions=Pi(li({},de.extendsOptions),{copyChinaPlane:de.options.copyChinaPlane}),de.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png"]),e.add(["/image/earth/chinaNormal.webp"],{colorCorrection:!1})},de.initVis=function(){return ti(this,null,function*(){yield this.initLight();const[,e,,r]=yield Promise.all([this.drawController.draw("Earth",{radius:this.options.radius}),this.drawController.draw("Countries",{geojson:{type:"FeatureCollection",features:worldJson.features.filter(c=>{var Je;return((Je=c.properties)==null?void 0:Je.NAME_CN)!=="中国"})},depth:0,start:this.options.radius,mats:this.mList.getMaterialObj("world"),hasSide:!1,hasTop:!1,areaGroup:!1}),this.drawController.draw("Countries",{geojson:chinaLiteJson,depth:0,start:this.options.radius+this.options.mapDepth,mats:this.mList.getMaterialObj("china"),hasSide:!1,hasTop:!1}),this.drawController.draw("Countries",{geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMaterialObj("plane"),bbox:chinaBbox,lineDuration:6e3})]);if(this.map=r,this.options.copyChinaPlane){this.options.copyChinaPlane;const c=yield this.drawController.draw("Countries",{geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,mats:{topMat:new MeshBasicMaterial({color:"#ffffff"})},bbox:chinaBbox,hasSide:!1,hasTop:!0,hasLine:!1,areaGroup:!1});c.object3d.name="复制中国顶面",this.mList.setObject3d(c.object3d.children[0],"chinaPlaneCopy",{})}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:e.getAsset("/image/earth/chinaNormal.webp")}),c=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:e.getAsset("/image/earth/chinaBorder.png")}),Je=new it$1({name:"中国边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#59C8FF")}),Ke=new it$1({name:"世界边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#80abaf")}),Qe=e.getAsset("/image/earth/basic.webp"),_e=new MeshStandardMaterial({name:"地球材质",map:Qe,color:new Color$1(2397309),metalness:.84,roughness:.51}),$e=e.getAsset("/image/earth/flyline.png");$e.wrapS=RepeatWrapping,$e.wrapT=RepeatWrapping,$e.repeat.set(.5,.5);const qe=new it$1({name:"省份边界",map:$e,useMap:1,lineWidth:2,sizeAttenuation:0,transparent:!0,color:new Color$1("#3a898b")});this.mList.setMaterialObj("plane",{topMat:r,borderMat:c,outLine:qe}),this.mList.setMaterialObj("world",{outLine:Ke}),this.mList.setMaterialObj("china",{outLine:Je}),this.mList.setMaterial("earthMaterial",_e)})}},countryPlate=de=>{de.initVis=function(){return ti(this,null,function*(){yield this.initLight();const[,e]=yield Promise.all([this.drawController.draw("Earth",{radius:this.options.radius}),this.drawController.draw("Countries",{geojson:worldJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMaterialObj("plane"),bbox:[-180,-90,180,90],lineOffset:.14}),this.drawController.draw("SphereShadow",{radius:this.options.radius})]);this.map=e,yield this.pencil.controls.rotateTo(1.8041576242193995,1.2232045720480524,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1),this.playing&&(this.pencil.controls.minPolarAngle=this.pencil.controls.polarAngle,this.pencil.controls.maxPolarAngle=this.pencil.controls.polarAngle)})},de.initMaterial=function(){return ti(this,null,function*(){const e=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),r=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),c=new it$1({name:"边框线",lineWidth:4,sizeAttenuation:0,color:new Color$1("#006aa3")}),Je=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.setMaterialObj("plane",{topMat:r,borderMat:e,outLine:c}),this.mList.setMaterial("earthMaterial",Je)})},de.getLocationPosition=function(e,r=0){const[c,Je]=e,Ke=this.options.mapDepth+this.options.radius+r;return o$1(c,Je,Ke)}},styles=Object.freeze(Object.defineProperty({__proto__:null,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),I1=class I1 extends Base{constructor(){super(...arguments);J0(this,"drawController",new sl(objs$1));J0(this,"leftTruck",!1);J0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});J0(this,"map");J0(this,"autoRotateSpeed",0);J0(this,"barArr",[])}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(li({mapDepth:1.4,radius:30,style:"chinaPlate",copyChinaPlane:!1},r)),this.pencilConfig=PENCIL_CONFIG$1,this.initSettingsObj={"测试板块颜色.color":"#000000","测试边框颜色.color":"#ffffff",测试立柱:"",autoRotate:!1},styles[this.options.style](this)}handleSetting(r,c){return ti(this,null,function*(){return yield a1(I1.prototype,this,"handleSetting").call(this,r,c),r==="测试板块颜色.color"?this.setAreaEmissiveByProperty("ISO_A2","CN",c):r==="测试边框颜色.color"?this.setLineColorByProperty("ISO_A2","CN",c):r==="测试立柱"?(typeof c=="boolean"&&(c=""),c?this.addBar(c):this.removeBar()):r==="autoRotate"&&this.playing&&(c?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),c})}show(){super.show(),this.animationIn()}animationIn(){const r=this.pencil.controls;r.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),r.addEventListener("controlend",()=>{this.pencil.autoRotate(this.autoRotateSpeed)})}initLight(){return ti(this,null,function*(){const[r,c]=yield Promise.all([this.drawController.draw("Light",{type:"RectAreaLight",color:"#E0FFFD",width:200,height:200}),this.drawController.draw("Light",{type:"RectAreaLight",intensity:3,width:200,height:170})]);r.position.set(0,50,-100),c.position.set(0,0,150),r.object3d.lookAt(0,0,0),c.object3d.lookAt(0,0,0),this.mList.changeObject3dKey(r.object3d,"$1_1"),this.mList.changeObject3dKey(c.object3d,"$1_2")})}getLocationPosition(r,c=0){const[Je,Ke]=r,Qe=this.options.radius+c;return o$1(Je,Ke,Qe)}setAreaColorByProperty(r,c,Je,Ke=!1){if(!this.map)return;const Qe=this.map.areaArr.find(_e=>_e.userData[r]===c);if(Qe){const _e=this.map.setAreaColor(Qe,Je);Ke&&_e&&(_e.color.set("#ffffff"),_e.onBeforeCompile=$e=>{$e.uniforms.c={value:new Color$1(Je)},$e.fragmentShader=`
5625
+ }`},s0=new ShaderMaterial({name:n0.name,uniforms:UniformsUtils.clone(n0.uniforms),vertexShader:n0.vertexShader,fragmentShader:n0.fragmentShader,lights:!0,side:qe,fog:st});s0.uniforms.mirrorSampler.value=i0.texture,s0.uniforms.textureMatrix.value=e0,s0.uniforms.alpha.value=Je,s0.uniforms.normalSampler.value=Ke,s0.uniforms.waterColor.value=Qe,s0.uniforms.distortionScale.value=$e,s0.uniforms.eye.value=_e;const a0=de.material;de.material=s0,de.onBeforeRender=function(l0,u0,b0){a0.color!==s0.uniforms.waterColor.value&&(s0.uniforms.waterColor.value=a0.color),Zt.setFromMatrixPosition(de.matrixWorld),Wt.setFromMatrixPosition(b0.matrixWorld),Yt.extractRotation(de.matrixWorld),ct.set(0,0,1),ct.applyMatrix4(Yt),vt.subVectors(Zt,Wt),b0.updateMatrix(),b0.updateMatrixWorld(),de.updateMatrix(),de.updateMatrixWorld();const f0=new Frustum,m0=new Matrix4;if(m0.multiplyMatrices(b0.projectionMatrix,b0.matrixWorldInverse),f0.setFromProjectionMatrix(m0),!f0.intersectsObject(de)||vt.dot(ct)>0)return;vt.reflect(ct).negate(),vt.add(Zt),Yt.extractRotation(b0.matrixWorld),Tt.set(0,0,-1),Tt.applyMatrix4(Yt),Tt.add(Wt),Jt.subVectors(Zt,Tt),Jt.reflect(ct).negate(),Jt.add(Zt),t0.position.copy(vt),t0.up.set(0,1,0),t0.up.applyMatrix4(Yt),t0.up.reflect(ct),t0.lookAt(Jt),t0.far=b0.far,t0.updateMatrixWorld(),t0.projectionMatrix.copy(b0.projectionMatrix),e0.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),e0.multiply(t0.projectionMatrix),e0.multiply(t0.matrixWorldInverse),rt.setFromNormalAndCoplanarPoint(ct,Zt),rt.applyMatrix4(t0.matrixWorldInverse),dt.set(rt.normal.x,rt.normal.y,rt.normal.z,rt.constant);const r0=t0.projectionMatrix;$t.x=(Math.sign(dt.x)+r0.elements[8])/r0.elements[0],$t.y=(Math.sign(dt.y)+r0.elements[9])/r0.elements[5],$t.z=-1,$t.w=(1+r0.elements[10])/r0.elements[14],dt.multiplyScalar(2/dt.dot($t)),r0.elements[2]=dt.x,r0.elements[6]=dt.y,r0.elements[10]=dt.z+1,r0.elements[14]=dt.w,_e.setFromMatrixPosition(b0.matrixWorld);const h0=l0.getRenderTarget(),o0=l0.xr.enabled,G0=l0.shadowMap.autoUpdate;de.visible=!1,l0.xr.enabled=!1,l0.shadowMap.autoUpdate=!1,l0.setRenderTarget(i0),l0.state.buffers.depth.setMask(!0),l0.autoClear===!1&&l0.clear(),l0.render(u0,t0),de.visible=!0,l0.xr.enabled=o0,l0.shadowMap.autoUpdate=G0,l0.setRenderTarget(h0);const T0=b0.viewport;T0!==void 0&&l0.state.viewport(T0)}},PENCIL_CONFIG$2={camera:{near:.1,far:1e3,fov:45,up:new Vector3(0,0,1)}};class City$1 extends Base{constructor(){super(...arguments);J0(this,"drawController",new sl(objs$3));J0(this,"adcode",0);J0(this,"pcenter",[104,37.5]);J0(this,"pscale",5e4);J0(this,"projection");J0(this,"group");J0(this,"building");J0(this,"road");J0(this,"innerAreaGroup");J0(this,"outAreaGroup");J0(this,"multiplyScalar",1)}setOptions(r){super.setOptions(li({fitTo:!0,plane:!0,grey:!1,greyFull:!1,clipOutShow:!1,planeOut:!1,showBuilding:!0,showRoad:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1},r)),this.pencilConfig=PENCIL_CONFIG$2}loaderAdd(){const r=this.loader;r.add(["/image/city/20-1.jpg","/image/city/60-1.jpg","/image/city/max-1.jpg","/image/city/cylinder.webp"]),r.add(["/image/city/20.webp","/image/city/60.webp","/image/city/max.webp"],{colorCorrection:!1})}loaderAddJson(r){this.loader.add([this.options.showBuilding&&`/cityGzip/Building${r}.json.gzip`,this.options.showRoad&&`/cityGzip/Road${r}.json.gzip`,this.options.showRiver&&`/cityGzip/River${r}.json.gzip`,this.options.showGrassland&&`/cityGzip/Grassland${r}.json.gzip`].filter(Boolean),{})}initMaterial(){return ti(this,null,function*(){if(!this.mList.getMaterialObj("building")){const r=["20","60","max"].reduce((Je,Ke)=>{const Qe=this.loader.getAsset(`/image/city/${Ke}-1.jpg`),_e=this.loader.getAsset(`/image/city/${Ke}.webp`);return Je[Ke]=[new MeshBasicMaterial({name:"建筑顶面-板块内"+Ke+"高",color:"#00a3bc"}),new MeshStandardMaterial({name:"建筑侧面-板块内"+Ke+"高",map:Qe,normalMap:_e,envMap:this.getRoomEnvMap()})],[Qe,_e].forEach($e=>{$e.wrapS=RepeatWrapping,$e.wrapT=RepeatWrapping,$e.repeat.set(1,1)}),Je},{});this.mList.setMaterialObj("building",{"20Top":r[20][0],"20Side":r[20][1],"60Top":r[60][0],"60Side":r[60][1],maxTop:r.max[0],maxSide:r.max[1]});const c=["20","60","max"].reduce((Je,Ke)=>{const Qe=this.loader.getAsset(`/image/city/${Ke}-1.jpg`),_e=this.loader.getAsset(`/image/city/${Ke}.webp`);return Je[Ke]=[new MeshBasicMaterial({name:"建筑顶面-板块外"+Ke+"高",color:"#133144"}),new MeshStandardMaterial({name:"建筑侧面-块外"+Ke+"高",map:Qe,normalMap:_e,envMap:this.getRoomEnvMap()})],[Qe,_e].forEach($e=>{$e.wrapS=RepeatWrapping,$e.wrapT=RepeatWrapping,$e.repeat.set(1,1)}),Je},{});this.mList.setMaterialObj("building-grey",{"20Top":c[20][0],"20Side":c[20][1],"60Top":c[60][0],"60Side":c[60][1],maxTop:c.max[0],maxSide:c.max[1]})}if(!this.mList.getMaterialObj("road")){const r=new it$1({name:"道路-板块内",color:"#ffc457",sizeAttenuation:0,lineWidth:40}),c=new it$1({name:"道路-板块外",color:"#4a3f15",sizeAttenuation:0,lineWidth:40});this.mList.setMaterialObj("road",{primary:r}),this.mList.setMaterialObj("road-grey",{primary:c})}if(this.mList.getMaterialObj("geography")||(this.mList.setMaterialObj("geography",{river:new MeshBasicMaterial({name:"河流-板块内",color:"#115d8a"}),grassland:new MeshBasicMaterial({name:"绿地-板块内",color:"#043141"})}),this.mList.setMaterialObj("geography-grey",{river:new MeshBasicMaterial({name:"河流-板块外",color:"#19354f"}),grassland:new MeshBasicMaterial({name:"绿地-板块外",color:"#133341"})})),!this.mList.getMaterial("city-plane")){const r=new MeshBasicMaterial({name:"底面",color:"#0b2234"});this.mList.setMaterial("city-plane",r)}})}disableSSAO(){const r=this.pencil.composerController.ssaoPass;r&&(r.enabled=!1)}enabledSSAO(){const r=this.pencil.composerController.ssaoPass;r&&(r.enabled=!0)}init(){return ti(this,null,function*(){const{jsonName:r,bbox:c,adcode:Je}=this.options;yield this.initPencil(),this.tier0||this.enabledSSAO(),this.loaderAdd(),this.loaderAddJson(r),console.time(`vis-core:time.${this.visName}${Je}-loader`),yield this.loader.loadAll(),console.timeEnd(`vis-core:time.${this.visName}${Je}-loader`),this.verticalDragToForward=!0,this.adcode=this.options.adcode,this.options.center&&(this.pcenter=this.options.center),this.projection=G({center:this.pcenter,scale:this.pscale}),this.group=yield this.drawController.draw("Group"),this.group.scale.multiplyScalar(this.multiplyScalar),this.innerAreaGroup=yield this.drawController.draw("Group",{},this.group),this.outAreaGroup=yield this.drawController.draw("Group",{},this.group),yield this.initMaterial(),yield this.initVis(),yield Promise.all(this.drawController.objectsPromise)})}getInvert(r){var c,Je;return(Je=(c=this.projection).invert)==null?void 0:Je.call(c,[r.x,-r.z])}fitTo(r,c=!0){return ti(this,null,function*(){this.pencil.controls.fitToBox(r.object3d,c),this.pencil.controls.rotatePolarTo(this.pencil.camera.up.z===1?Math.PI/180*70:Math.PI/180*160,c)})}initVis(){return ti(this,null,function*(){const{fitTo:r,jsonName:c,bbox:Je,planeOut:Ke}=this.options,Qe=this.adcode,_e=this.loader,$e=_e.getAsset(`/cityGzip/Building${c}.json.gzip`),qe=_e.getAsset(`/cityGzip/Road${c}.json.gzip`),st=_e.getAsset(`/cityGzip/River${c}.json.gzip`),rt=_e.getAsset(`/cityGzip/Grassland${c}.json.gzip`),ct={};[...(st==null?void 0:st.features)||[],...(rt==null?void 0:rt.features)||[]].forEach(Jt=>{Jt.properties.o&&(ct[Jt.properties.o]=!0)});const Zt=Object.keys(ct).map(Jt=>+Jt).sort((Jt,$t)=>Jt-$t),Wt=-G({center:this.pcenter,scale:this.pscale})([this.pcenter[0],899e-8+this.pcenter[1]])[1];let Yt=1e3,Tt=1e3;if(Je){const Jt=this.projection([Je[0],Je[1]]),$t=this.projection([Je[2],Je[3]]),e0=Math.abs($t[0]-Jt[0]),t0=Math.abs($t[1]-Jt[1]);Yt=e0,Tt=t0}const dt=this.mList.getMaterial("city-plane"),vt=yield this.drawController.draw("CityPlane",{width:Yt*10,height:Tt*10,material:dt},Ke?this.outAreaGroup:this.innerAreaGroup);this.options.grey||this.mList.setObject3d(vt.object3d,"city-plane",{baseObject:vt}),yield Promise.all([$e&&this.options.showBuilding&&this.drawBuilding({json:$e,meters:Wt,clip:this.options.clip,grey:this.options.grey,sideGradient:this.options.buildingSideGradient}),qe&&this.options.showRoad&&this.drawRoad({json:qe,meters:Wt,z:Zt.length,clip:this.options.clip,grey:this.options.grey}),st&&this.options.showRiver&&this.drawArea({json:st,type:"river",oArr:Zt,clip:this.options.clip,grey:this.options.grey}),rt&&this.options.showGrassland&&this.drawArea({json:rt,type:"grassland",oArr:Zt,clip:this.options.clip,grey:this.options.grey}),this.options.clip||this.drawController.draw("Target",{key:"cityTarget"+Qe},this.innerAreaGroup)].filter(Boolean)),r&&this.fitToTarget(Qe),this.pencil.getPlugin("worker").saveCache()})}fitToTarget(r,c){return ti(this,null,function*(){const Je=this.drawController.getObject("Target",{key:"cityTarget"+r});if(Je){if(c){const Qe=this.getWorldPosition(c[0],c[1]);Je.position.x=Qe.x,Je.position.y=Qe.y,Je.position.z=0}else{const Qe=Object.values(this.building.building).pop(),{min:_e,max:$e}=Qe[0].getSize();_e.multiplyScalar(1/this.multiplyScalar),$e.multiplyScalar(1/this.multiplyScalar);const qe=new Vector3(($e.x+_e.x)/2,($e.y+_e.y)/2,0);Je.position.copy(qe)}const Ke=Je.object3d.getWorldPosition(new Vector3);yield this.lookAtTarget({target:Ke,distance:6.984429017840711*this.multiplyScalar,polarAngle:.9963693538268685,azimuthAngle:0},!0)}})}drawBuilding(){return ti(this,arguments,function*(r={}){var Ke;if(!r.json){console.warn(" json:Building");return}const c=this.options.cacheKey?`building-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,Je=yield this.drawController.draw("Building",{projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:c,meters:r.meters,sideGradient:r.sideGradient,grey:r.grey,clip:r.clip},(Ke=r.group)!=null?Ke:this.innerAreaGroup);return this.options.clipOutShow&&Je.outJson.size&&(yield this.drawBuilding({json:this.options.greyFull?r.json:{features:Array.from(Je.outJson.keys()).filter(Qe=>Qe!==1)},meters:r.meters,grey:!0,clip:void 0,sideGradient:!1,group:this.outAreaGroup})),r.grey||(this.building=Je),Je})}drawArea(){return ti(this,arguments,function*(r={}){var _e;if(!r.json){console.warn(" json:drawGeography");return}if(!r.type)return;const{grey:c}=r,Je=c?"-grey":"",Ke=this.options.cacheKey?`${r.type}-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,Qe=yield this.drawController.draw("Area",{projection:{center:this.pcenter,scale:this.pscale},json:r.json,material:this.mList.getMaterialObj("geography"+Je)[r.type],type:r.type,cacheKey:Ke,oArr:r.oArr,clip:r.clip},(_e=r.group)!=null?_e:this.innerAreaGroup);return this.options.clipOutShow&&Qe.outJson.size&&(yield this.drawArea({json:this.options.greyFull?r.json:{features:Array.from(Qe.outJson.keys()).filter($e=>$e!==1)},type:r.type,grey:!0,oArr:r.oArr,clip:void 0,group:this.outAreaGroup})),r.type==="river"&&!c&&this.options.setWaterMaterial&&Qe.area.forEach($e=>{setWaterMaterial($e.object3d)}),Qe})}drawRoad(){return ti(this,arguments,function*(r={}){var Qe;if(!r.json){console.warn(" json:Road");return}const c=this.options.cacheKey?`road-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,Je=yield this.drawController.draw("Road",{projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:c,grey:r.grey,meters:r.meters,clip:r.clip},(Qe=r.group)!=null?Qe:this.innerAreaGroup),Ke=r.z||0;return Je.position.z=(Ke+1)*.001,this.options.clipOutShow&&Je.outJson.size&&(yield this.drawRoad({json:this.options.greyFull?r.json:{features:Array.from(Je.outJson.keys()).filter(_e=>_e!==1)},meters:r.meters,z:r.z,clip:void 0,grey:!0,group:this.outAreaGroup})),r.grey||(this.road=Je),Je})}getWorldPosition(r,c){if(this.options.coordtransformFunc){const Qe=this.options.coordtransformFunc(r,c);r=Qe.longitude,c=Qe.latitude}const[Je,Ke]=this.projection([r,c]);return{x:Je,y:-Ke}}}J0(City$1,"VisName","city");class City extends City$1{constructor(){super(...arguments);J0(this,"drawController",objs$2);J0(this,"multiplyScalar",1/1e3)}fixNearFar(r=.01,c){this.pencil.camera.near=r*this.multiplyScalar,c&&(this.pencil.camera.far=c*this.multiplyScalar),this.pencil.camera.updateProjectionMatrix()}}const m1=class m1 extends Map$1{constructor(){super(...arguments);J0(this,"cityVisObj",{});J0(this,"showGroup")}get cityVis(){var c,Je;let r=this.mapInfo.adcode;if((c=this.options.fixCity)!=null&&c[r]&&(r=this.options.fixCity[r]),this.getAdcodeShowLevel(r)!=="city"){const Ke=geojsonCn.adcodeMap[r].parent;this.getAdcodeShowLevel(Ke)==="city"&&(r=Ke)}return(Je=this.cityVisObj[r])==null?void 0:Je.city}get cityTarget(){var c;let r=this.mapInfo.adcode;return(c=this.options.fixCity)!=null&&c[r]&&(r=this.options.fixCity[r]),this.drawController.getObject("Target",{key:"cityTarget"+r})}setOptions(r){super.setOptions(li({clipOutShow:!0,allCity:!1,showBuilding:!0,buildingSideGradient:!1,showRoad:!0,cacheCity:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,showCityOnMapInnerLine:!1,greyFull:!1},r)),this.pencilConfig=PENCIL_CONFIG$3}init(){return ti(this,null,function*(){var r;if(yield a1(m1.prototype,this,"init").call(this),this.showGroup="map",this.options.adcode==1e5&&(this.pencil.camera.far=500,this.pencil.camera.updateProjectionMatrix()),this.options.cityOnMap)if(this.options.allCity){const c=geojsonCn.adcodeMap[this.mapInfo.adcode],Je=c.level==="province"?c.adcode:geojsonCn.adcodeMap[this.mapInfo.adcode].parent,Ke=(r=geojsonCn.allArr.find(Qe=>Qe.adcode===Je))==null?void 0:r.subAreas;Ke&&(yield Promise.all(Ke.map(Qe=>ti(this,null,function*(){yield this.initCityOnMap(Qe)}))))}else yield this.initCityOnMap(this.mapInfo.adcode)})}handleClick(r){this.showGroup==="map"&&super.handleClick(r)}initCityVis(Je){return ti(this,arguments,function*(r,c={clip:!1,grey:!1}){var st;(st=this.options.fixCity)!=null&&st[r]&&(r=this.options.fixCity[r]);const Ke=this.options.center,Qe=this.options.cityBboxMap[r];if(yield Promise.all(Object.values(this.cityVisObj).map(rt=>rt.state.promise)),this.cityVisObj[r])return;this.cityVisObj[r]={state:esusLite.makePromiseCreator(!0)};const _e=this.options.jsonNameObj[r],$e=new City({container:this.container,editor:!1});$e.setOptions({container:this.container,center:Ke,bbox:Qe,fitTo:!1,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:_e,grey:c.grey,greyFull:this.options.greyFull,clip:c.clip?this.map.options.geojson:void 0,clipOutShow:this.options.clipOutShow,planeOut:this.options.cityOnMap,showBuilding:this.options.showBuilding,buildingSideGradient:this.options.buildingSideGradient,showRoad:this.options.showRoad,showGrassland:this.options.showGrassland,showRiver:this.options.showRiver,setWaterMaterial:this.options.setWaterMaterial}),geojsonCn.adcodeMap[r].parent===35e4&&this.options.curvatureResolution&&city350000($e),$e.pencilConfig=this.pencilConfig,$e.pencil=this.pencil,$e.mList=this.mList,$e.editor=this.editor,$e.workerOnce=this.workerOnce,$e.sceneActive=this.sceneActive,$e.drawController=this.drawController,yield $e.init(),$e.group.hide(),this.cityVisObj[r].city=$e,this.cityVisObj[r].state.resolve(),this.emit("initCityVis",r)})}initCityOnMap(r){return ti(this,null,function*(){if(this.getAdcodeShowLevel(r)!=="city"){const Ke=geojsonCn.adcodeMap[r].parent;this.getAdcodeShowLevel(Ke)==="city"&&(yield this.initCityOnMap(Ke));return}const c=r===this.mapInfo.adcode||geojsonCn.adcodeMap[this.mapInfo.adcode].parent===r||geojsonCn.adcodeMap[r].parent===this.mapInfo.adcode;yield this.initCityVis(r,{clip:c,grey:!c}),yield this.cityVisObj[r].state.promise;const Je=this.cityVisObj[r].city;if(c){const Ke=this.mapObj.depth+1e-5;Je.group.position.z=this.mapObj.z+Ke,Je.outAreaGroup&&(Je.outAreaGroup.position.z-=Ke/Je.multiplyScalar)}else Je.group.position.z=this.mapObj.z;this.pencil.camera.near=.001,this.pencil.camera.far=7,this.pencil.camera.updateProjectionMatrix(),Je.group.show(),this.verticalDragToForward=!0})}showCity(r,c){return ti(this,null,function*(){var st;let Je,Ke,Qe=this.mapInfo.adcode,_e=.03637926645733737,$e=.9963693538268685,qe=0;if(typeof r=="number"?(Qe=r,Je=c,console.warn("showCity(adcode, lnglat) is deprecated, use showCity(option) instead")):(Je=r.lnglat,Ke=r.target,typeof r.adcode!="undefined"&&(Qe=r.adcode),typeof r.distance!="undefined"&&(_e=r.distance),typeof r.polarAngle!="undefined"&&($e=r.polarAngle),typeof r.azimuthAngle!="undefined"&&(qe=r.azimuthAngle)),this.options.cityOnMap){if(this.options.handleBackKeepCamvasState&&this.showGroup==="map"&&this.saveBackCamvasState(-1),Je||Ke){this.showGroup="city";const rt=Ke||this.getLocationPosition(Je),ct=new Vector3(rt[0],rt[1],this.mapObj.z+this.mapObj.depth);this.emit("beforeDrillDown","city"),yield this.cityVis.lookAtTarget({target:ct,distance:_e,polarAngle:$e,azimuthAngle:qe},!0),this.emit("afterDrillDown","city")}else console.error("showCityOnMap lnglat or target is required");return}if(Qe!==this.mapInfo.adcode){yield a1(m1.prototype,this,"showMap").call(this,{adcode:Qe,duration:0}),yield this.showCity({adcode:Qe,lnglat:Je});return}(st=this.options.fixCity)!=null&&st[Qe]&&(Qe=this.options.fixCity[Qe]),yield this.cityVisObj[Qe].state.promise,this.emit("beforeDrillDown","city"),this.showGroup="city",this.cityVis.fixNearFar(),this.cityVis.group.position.z=this.mapObj.z+this.mapObj.depth,this.cityVis.group.show(),this.group.hide(),this.verticalDragToForward=!0,yield this.cityVis.fitToTarget(Qe,Je),this.emit("afterDrillDown","city")})}showMap(c){return ti(this,arguments,function*({adcode:r}){if(this.isAnimating)return;const Je=r?this.getAdcodes(r):this.adcodes;this.showGroup==="city"&&!this.options.cityOnMap&&(this.fixNear(this.mapInfo.adcode),this.cityVis.group.hide(),this.group.show(),this.verticalDragToForward=!1),this.showGroup="map",JSON.stringify(Je)===JSON.stringify(this.adcodes)?(this.emit("beforeDrillDown",[...Je]),this.options.cityOnMap?yield this.handleLookBack():yield this.fitTo(this.map),this.emit("afterDrillDown",[...Je])):yield a1(m1.prototype,this,"showMap").call(this,{adcodes:[...Je]})})}dispose(){Object.values(this.cityVisObj).forEach(r=>{r.city&&r.city.dispose(),r.state.reject()}),super.dispose()}};J0(m1,"VisName","map2");let index$2=m1;class Earth$1 extends Sphere{constructor(r){super();J0(this,"options");this.options=li({radius:30},r)}create(){const r=this.pencil.installPlugins.get("materialList"),c=r.getMaterial("earthMaterial");this.material=c,super.create(),this.rotation.y=Math.PI/180*-90,this.object3d.name="地球",r.setObject3d(this.object3d,"earth")}}class Countries extends v{constructor(r){super();J0(this,"options");J0(this,"areaArr",[]);J0(this,"lineArr",[]);this.options=li({start:30,depth:1.4,lineOffset:.01,hasTop:!0,hasSide:!0,hasLine:!0,lineDuration:1e3,areaGroup:!0},r)}create(){return ti(this,null,function*(){const{geojson:r,mats:c,hasSide:Je,lineOffset:Ke,areaGroup:Qe}=this.options;this.createGroup();const _e=this.pencil.getPlugin("worker"),$e=this.pencil.getPlugin("draw"),{borderMat:qe,topMat:st,outLine:rt}=c;let ct=r.features.map(Yt=>{const{type:Tt,coordinates:dt}=Yt.geometry;let vt=[];return Tt==="Polygon"?vt=dt:Tt==="MultiPolygon"&&(vt=dt.flat()),{coords:vt,properties:Yt.properties}});const Zt=this.options.hasTop||this.options.hasSide,Wt=this.options.hasLine;Qe||(ct=[{coords:ct.map(({coords:Yt})=>Yt).flat(),properties:{}}]),yield Promise.all(ct.map(Yt=>[Zt&&_e.geoGeometry("conicPolygon",{mesaage:{start:[this.options.start],depth:[this.options.depth],useGroups:2,hasBottom:!1,topFirst:!0,coordinatesArr:Yt.coords,bbox:this.options.bbox,hasSide:Je},cb:Tt=>ti(this,null,function*(){const dt=yield $e.draw("ConicPolygon",{geometry:Tt,material:Je?[st,qe]:st,hasSide:Je},this);dt.userData=li({},Yt.properties),this.areaArr.push(dt)})}),Wt&&_e.geoGeometry("conicLine",{mesaage:{start:[this.options.start+this.options.depth+Ke],lineWidth:[1],coordinatesArr:Yt.coords},cb:Tt=>ti(this,null,function*(){const dt=yield $e.draw("Line",{geometry:Tt,material:rt,onTop:2},this);dt.userData=li({},Yt.properties),this.lineArr.push(dt)})})].filter(Boolean)).flat())})}setAreaColor(r,c){if(c==="origin"){r.useMaterial("origin");return}const[,Je]=r.setMaterialList(c,"clone",!1);return Je.color.set(c),r.useMaterial(c),Je}setLineColor(r,c){if(c==="origin"){r.useMaterial("origin");return}const Je=r.setMaterialList(c,"clone",!1);return Je.color.set(c),r.useMaterial(c),Je}setAreaEmissive(r,c,Je=1){if(c==="origin"){r.useMaterial("origin");return}const Ke="Emissive"+c+"_"+Je,[,Qe]=r.setMaterialList(Ke,"clone",!1);return Qe.emissive.set(c),Qe.emissiveIntensity=Je,r.useMaterial(Ke),Qe}}class SphereShadow extends v{constructor(r){super();J0(this,"options");this.options=li({radius:30},r)}create(){return ti(this,null,function*(){const r=this.pencil.installPlugins.get("materialList"),c=new SphereGeometry(this.options.radius,128,90),Je=new MeshBasicMaterial;this.createMesh(c,Je),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",r.setObject3d(this.object3d,"SphereShadow",{baseObject:this}),this.hide()})}}const objs$1=Pi(li({},objs$5),{Earth:Earth$1,Countries,SphereShadow}),PENCIL_CONFIG$1={camera:{near:.1,far:1e3}},chinaPlate=de=>{de.extendsOptions=Pi(li({},de.extendsOptions),{copyChinaPlane:de.options.copyChinaPlane}),de.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png"]),e.add(["/image/earth/chinaNormal.webp"],{colorCorrection:!1})},de.initVis=function(){return ti(this,null,function*(){yield this.initLight();const[,e,,r]=yield Promise.all([this.drawController.draw("Earth",{radius:this.options.radius}),this.drawController.draw("Countries",{geojson:{type:"FeatureCollection",features:worldJson.features.filter(c=>{var Je;return((Je=c.properties)==null?void 0:Je.NAME_CN)!=="中国"})},depth:0,start:this.options.radius,mats:this.mList.getMaterialObj("world"),hasSide:!1,hasTop:!1,areaGroup:!1}),this.drawController.draw("Countries",{geojson:chinaLiteJson,depth:0,start:this.options.radius+this.options.mapDepth,mats:this.mList.getMaterialObj("china"),hasSide:!1,hasTop:!1}),this.drawController.draw("Countries",{geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMaterialObj("plane"),bbox:chinaBbox,lineDuration:6e3})]);if(this.map=r,this.options.copyChinaPlane){this.options.copyChinaPlane;const c=yield this.drawController.draw("Countries",{geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,mats:{topMat:new MeshBasicMaterial({color:"#ffffff"})},bbox:chinaBbox,hasSide:!1,hasTop:!0,hasLine:!1,areaGroup:!1});c.object3d.name="复制中国顶面",this.mList.setObject3d(c.object3d.children[0],"chinaPlaneCopy",{})}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},de.initMaterial=function(){return ti(this,null,function*(){const e=this.loader,r=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:e.getAsset("/image/earth/chinaNormal.webp")}),c=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:e.getAsset("/image/earth/chinaBorder.png")}),Je=new it$1({name:"中国边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#59C8FF")}),Ke=new it$1({name:"世界边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#80abaf")}),Qe=e.getAsset("/image/earth/basic.webp"),_e=new MeshStandardMaterial({name:"地球材质",map:Qe,color:new Color$1(2397309),metalness:.84,roughness:.51}),$e=e.getAsset("/image/earth/flyline.png");$e.wrapS=RepeatWrapping,$e.wrapT=RepeatWrapping,$e.repeat.set(.5,.5);const qe=new it$1({name:"省份边界",map:$e,useMap:1,lineWidth:2,sizeAttenuation:0,transparent:!0,color:new Color$1("#3a898b")});this.mList.setMaterialObj("plane",{topMat:r,borderMat:c,outLine:qe}),this.mList.setMaterialObj("world",{outLine:Ke}),this.mList.setMaterialObj("china",{outLine:Je}),this.mList.setMaterial("earthMaterial",_e)})}},countryPlate=de=>{de.initVis=function(){return ti(this,null,function*(){yield this.initLight();const[,e]=yield Promise.all([this.drawController.draw("Earth",{radius:this.options.radius}),this.drawController.draw("Countries",{geojson:worldJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMaterialObj("plane"),bbox:[-180,-90,180,90],lineOffset:.14}),this.drawController.draw("SphereShadow",{radius:this.options.radius})]);this.map=e,yield this.pencil.controls.rotateTo(1.8041576242193995,1.2232045720480524,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1),this.playing&&(this.pencil.controls.minPolarAngle=this.pencil.controls.polarAngle,this.pencil.controls.maxPolarAngle=this.pencil.controls.polarAngle)})},de.initMaterial=function(){return ti(this,null,function*(){const e=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),r=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),c=new it$1({name:"边框线",lineWidth:4,sizeAttenuation:0,color:new Color$1("#006aa3")}),Je=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.setMaterialObj("plane",{topMat:r,borderMat:e,outLine:c}),this.mList.setMaterial("earthMaterial",Je)})},de.getLocationPosition=function(e,r=0){const[c,Je]=e,Ke=this.options.mapDepth+this.options.radius+r;return o$1(c,Je,Ke)}},styles=Object.freeze(Object.defineProperty({__proto__:null,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),I1=class I1 extends Base{constructor(){super(...arguments);J0(this,"drawController",new sl(objs$1));J0(this,"leftTruck",!1);J0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});J0(this,"map");J0(this,"autoRotateSpeed",0);J0(this,"barArr",[])}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(li({mapDepth:1.4,radius:30,style:"chinaPlate",copyChinaPlane:!1},r)),this.pencilConfig=PENCIL_CONFIG$1,this.initSettingsObj={"测试板块颜色.color":"#000000","测试边框颜色.color":"#ffffff",测试立柱:"",autoRotate:!1},styles[this.options.style](this)}handleSetting(r,c){return ti(this,null,function*(){return yield a1(I1.prototype,this,"handleSetting").call(this,r,c),r==="测试板块颜色.color"?this.setAreaEmissiveByProperty("ISO_A2","CN",c):r==="测试边框颜色.color"?this.setLineColorByProperty("ISO_A2","CN",c):r==="测试立柱"?(typeof c=="boolean"&&(c=""),c?this.addBar(c):this.removeBar()):r==="autoRotate"&&this.playing&&(c?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),c})}show(){super.show(),this.animationIn()}animationIn(){const r=this.pencil.controls;r.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),r.addEventListener("controlend",()=>{this.pencil.autoRotate(this.autoRotateSpeed)})}initLight(){return ti(this,null,function*(){const[r,c]=yield Promise.all([this.drawController.draw("Light",{type:"RectAreaLight",color:"#E0FFFD",width:200,height:200}),this.drawController.draw("Light",{type:"RectAreaLight",intensity:3,width:200,height:170})]);r.position.set(0,50,-100),c.position.set(0,0,150),r.object3d.lookAt(0,0,0),c.object3d.lookAt(0,0,0),this.mList.changeObject3dKey(r.object3d,"$1_1"),this.mList.changeObject3dKey(c.object3d,"$1_2")})}getLocationPosition(r,c=0){const[Je,Ke]=r,Qe=this.options.radius+c;return o$1(Je,Ke,Qe)}setAreaColorByProperty(r,c,Je,Ke=!1){if(!this.map)return;const Qe=this.map.areaArr.find(_e=>_e.userData[r]===c);if(Qe){const _e=this.map.setAreaColor(Qe,Je);Ke&&_e&&(_e.color.set("#ffffff"),_e.onBeforeCompile=$e=>{$e.uniforms.c={value:new Color$1(Je)},$e.fragmentShader=`
5626
5626
  uniform vec3 c;
5627
5627
  vec3 rgb2hsv(float r, float g, float b) {
5628
5628
  vec3 c = vec3(r, g, b);
@@ -90,7 +90,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
90
90
  ).toString(CryptoJS.enc.Utf8), ct = JSON.parse(rt), Zt = Date.now();
91
91
  return !ct.s || ct.s > Zt ? (this.token = void 0, "") : ct.e && ct.e < Zt ? (this.token = void 0, "") : (ct.isValid = qe, ct);
92
92
  }
93
- }, version = "0.24.10";
93
+ }, version = "0.24.11";
94
94
  /**
95
95
  * @license
96
96
  * Copyright 2010-2025 Three.js Authors
@@ -130267,9 +130267,7 @@ class CityPlane extends v {
130267
130267
  }
130268
130268
  create() {
130269
130269
  return ti(this, null, function* () {
130270
- const { width: r, height: c, color: Je, map: Ke, material: Qe } = this.options;
130271
- console.log("create plane", r, c);
130272
- const _e = new PlaneGeometry(r, c, 2, 2);
130270
+ const { width: r, height: c, color: Je, map: Ke, material: Qe } = this.options, _e = new PlaneGeometry(r, c, 2, 2);
130273
130271
  this.plane = _e;
130274
130272
  const $e = Qe || new MeshBasicMaterial({
130275
130273
  color: Je,
@@ -130751,7 +130749,6 @@ const objs$4 = Pi(li({}, objs$5), {
130751
130749
  showOneLevel: !1,
130752
130750
  drillDownRestrictions: "district",
130753
130751
  showDistrict: !0,
130754
- showDistrictStreetView: !1,
130755
130752
  showLabel: !1,
130756
130753
  lineWidth: 2,
130757
130754
  lineOffset: 0,
@@ -130773,7 +130770,7 @@ const objs$4 = Pi(li({}, objs$5), {
130773
130770
  geojsonMap: c,
130774
130771
  extrudeLineGeojsonMap: Je,
130775
130772
  bboxMap: Ke
130776
- })), this.options.equirectangular && (this.options.projectionType = "equirectangular"), this.options.fahey && (this.options.projectionType = "fahey", this.pscale = 100, this.pcenter = [0, 0]), this.pencilConfig = PENCIL_CONFIG$4, (this.getAdcodeShowLevel(this.options.adcode) === "province" || this.getAdcodeShowLevel(this.options.adcode) === "country") && (this.extendsOptions.clickHandleDrillDown = () => this.options.clickHandleDrillDown, this.options.clickHandleDrillDown && (this.workerOnce = !1, this.extendsOptions.mapDepth = () => Array.isArray(this.options.mapDepth) ? this.options.mapDepth : new Array(3).fill(this.options.mapDepth), this.extendsOptions.drillDownSecondLevelMats = () => this.options.drillDownSecondLevelMats, this.extendsOptions.drillDownThirdLevelMats = () => this.options.drillDownThirdLevelMats, this.extendsOptions.drillDownPlateInCenter = () => this.options.drillDownPlateInCenter, this.extendsOptions.clickOusideBack = () => this.options.clickOusideBack, this.extendsOptions.handleBackKeepCamvasState = () => this.options.handleBackKeepCamvasState, this.extendsOptions.showOneLevel = () => this.options.showOneLevel, this.extendsOptions.showDistrict = () => this.options.showDistrict, this.extendsOptions.showDistrictStreetView = () => this.options.showDistrictStreetView, this.options.parentBg && (this.extendsOptions.drillDownHideParent = () => this.options.drillDownHideParent)), this.extendsOptions.parentBg = () => this.options.parentBg, this.options.parentBg && (this.extendsOptions.parentBgDepth = () => this.options.parentBgDepth, this.extendsOptions.parentBgTopSegments = () => this.options.parentBgTopSegments), this.extendsOptions.continentsBg = () => this.options.continentsBg, this.options.continentsBg && (this.extendsOptions.continentsBgDepth = () => this.options.continentsBgDepth)), this.options.adcode === 0 ? world(this) : this.options.style === "map2" || (this.options.adcode === 1e5 ? china(this) : base$1(this));
130773
+ })), this.options.equirectangular && (this.options.projectionType = "equirectangular"), this.options.fahey && (this.options.projectionType = "fahey", this.pscale = 100, this.pcenter = [0, 0]), this.pencilConfig = PENCIL_CONFIG$4, (this.getAdcodeShowLevel(this.options.adcode) === "province" || this.getAdcodeShowLevel(this.options.adcode) === "country") && (this.extendsOptions.clickHandleDrillDown = () => this.options.clickHandleDrillDown, this.options.clickHandleDrillDown && (this.workerOnce = !1, this.extendsOptions.mapDepth = () => Array.isArray(this.options.mapDepth) ? this.options.mapDepth : new Array(3).fill(this.options.mapDepth), this.extendsOptions.drillDownSecondLevelMats = () => this.options.drillDownSecondLevelMats, this.extendsOptions.drillDownThirdLevelMats = () => this.options.drillDownThirdLevelMats, this.extendsOptions.drillDownPlateInCenter = () => this.options.drillDownPlateInCenter, this.extendsOptions.clickOusideBack = () => this.options.clickOusideBack, this.extendsOptions.handleBackKeepCamvasState = () => this.options.handleBackKeepCamvasState, this.extendsOptions.showOneLevel = () => this.options.showOneLevel, this.extendsOptions.showDistrict = () => this.options.showDistrict, this.options.parentBg && (this.extendsOptions.drillDownHideParent = () => this.options.drillDownHideParent)), this.extendsOptions.parentBg = () => this.options.parentBg, this.options.parentBg && (this.extendsOptions.parentBgDepth = () => this.options.parentBgDepth, this.extendsOptions.parentBgTopSegments = () => this.options.parentBgTopSegments), this.extendsOptions.continentsBg = () => this.options.continentsBg, this.options.continentsBg && (this.extendsOptions.continentsBgDepth = () => this.options.continentsBgDepth)), this.options.adcode === 0 ? world(this) : this.options.style === "map2" || (this.options.adcode === 1e5 ? china(this) : base$1(this));
130777
130774
  }
130778
130775
  handleSetting(r, c) {
130779
130776
  return ti(this, null, function* () {
@@ -131266,13 +131263,9 @@ const objs$4 = Pi(li({}, objs$5), {
131266
131263
  }
131267
131264
  handleClick(r) {
131268
131265
  const { drillDownRestrictions: c } = this.options;
131269
- this.isAnimating || (r && r.userData.adcode && this.getAdcodeShowLevel(r.userData.adcode, !1) === "district" && this.options.showDistrictStreetView ? this.emit(
131270
- "beforeDrillDown",
131271
- [...this.adcodes, r.userData.adcode],
131272
- "city"
131273
- ) : r && r.userData.adcode && this.getAdcodeShowLevel(r.userData.adcode) !== c ? this.showMap({
131266
+ this.isAnimating || (r && r.userData.adcode ? this.getAdcodeShowLevel(r.userData.adcode, !1) !== c ? this.showMap({
131274
131267
  adcode: r.userData.adcode
131275
- }) : !r && this.mapHistory.length > 1 && this.showMap({
131268
+ }) : this.emit("drilldownRestrictions", r.userData.adcode) : !r && this.mapHistory.length > 1 && this.showMap({
131276
131269
  adcode: this.adcodes.at(-2)
131277
131270
  }));
131278
131271
  }
@@ -133075,7 +133068,7 @@ class City$1 extends Base {
133075
133068
  let Yt = 1e3, Tt = 1e3;
133076
133069
  if (Je) {
133077
133070
  const Jt = this.projection([Je[0], Je[1]]), $t = this.projection([Je[2], Je[3]]), e0 = Math.abs($t[0] - Jt[0]), t0 = Math.abs($t[1] - Jt[1]);
133078
- Yt = e0, Tt = t0, console.log("bbox", e0, t0);
133071
+ Yt = e0, Tt = t0;
133079
133072
  }
133080
133073
  const dt = this.mList.getMaterial("city-plane"), vt = yield this.drawController.draw(
133081
133074
  "CityPlane",
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.24.10";
1
+ declare const _default: "0.24.11";
2
2
  export default _default;
@@ -34,7 +34,6 @@ export interface MapOptions extends BaseOptions {
34
34
  drillDownSecondLevelMats?: boolean;
35
35
  drillDownThirdLevelMats?: boolean;
36
36
  showDistrict?: boolean;
37
- showDistrictStreetView?: boolean;
38
37
  showLabel?: boolean | 'lite';
39
38
  lineWidth?: number;
40
39
  lineOffset?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.24.10",
3
+ "version": "0.24.11",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && bundler",