vis-core 0.27.14 → 0.27.15
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 +1 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +7 -5
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
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,.transform{--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 }.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))}.transform{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))}.resize{resize:both}.whitespace-nowrap{white-space:nowrap}.text-center{text-align:center}.text-sm{font-size:14px;line-height:20px}.leading-\\[1\\]{line-height:1}.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)}.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 Nn=Object.defineProperty,Kn=Object.defineProperties;var Fn=Object.getOwnPropertyDescriptors;var Wn=Object.getOwnPropertySymbols,An=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty,Hn=Object.prototype.propertyIsEnumerable,Yn=Reflect.get;var Ln=(g,t)=>(t=Symbol[g])?t:Symbol.for("Symbol."+g),Un=g=>{throw TypeError(g)},mn=Math.pow,Vn=(g,t,r)=>t in g?Nn(g,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):g[t]=r,bi=(g,t)=>{for(var r in t||(t={}))kn.call(t,r)&&Vn(g,r,t[r]);if(Wn)for(var r of Wn(t))Hn.call(t,r)&&Vn(g,r,t[r]);return g},Di=(g,t)=>Kn(g,Fn(t));var _0=(g,t,r)=>Vn(g,typeof t!="symbol"?t+"":t,r);var yn=(g,t,r)=>Yn(An(g),r,t);var D0=(g,t,r)=>new Promise((d,v)=>{var C=ye=>{try{E(r.next(ye))}catch(Le){v(Le)}},w=ye=>{try{E(r.throw(ye))}catch(Le){v(Le)}},E=ye=>ye.done?d(ye.value):Promise.resolve(ye.value).then(C,w);E((r=r.apply(g,t)).next())}),Bn=function(g,t){this[0]=g,this[1]=t};var Pn=g=>{var t=g[Ln("asyncIterator")],r=!1,d,v={};return t==null?(t=g[Ln("iterator")](),d=C=>v[C]=w=>t[C](w)):(t=t.call(g),d=C=>v[C]=w=>{if(r){if(r=!1,C==="throw")throw w;return w}return r=!0,{done:!1,value:new Bn(new Promise(E=>{var ye=t[C](w);ye instanceof Object||Un("Object expected"),E(ye)}),1)}}),v[Ln("iterator")]=()=>v,d("next"),"throw"in t?d("throw"):v.throw=C=>{throw C},"return"in t&&d("return"),v},En=(g,t,r)=>(t=g[Ln("asyncIterator")])?t.call(g):(g=g[Ln("iterator")](),t={},r=(d,v)=>(v=g[d])&&(t[d]=C=>new Promise((w,E,ye)=>(C=v.call(g,C),ye=C.done,Promise.resolve(C.value).then(Le=>w({value:Le,done:ye}),E)))),r("next"),r("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),turf=require("@turf/turf"),world$1=require("geojson-cn/json/0.json"),json100000Lite=require("geojson-cn/json-lite/100000.json"),json100000=require("geojson-cn/json/100000.json"),adcodeAll=require("geojson-cn/json-lite/all.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(g){return g<0&&(g=this.length+g),this[g]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[g,t,r]=this.token.split(":::"),d=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),v=CryptoJS.enc.Base64.parse(t),C=CryptoJS.enc.Base64.parse(r),w=CryptoJS.lib.WordArray.create(v.words.slice(0,4)),E=CryptoJS.lib.WordArray.create(v.words.slice(4)),ye=jsrsasign.KJUR.crypto.Util.hashHex(v.toString(),"sha256"),Le=d.verifyWithMessageHashPSS(ye,jsrsasign.b64tohex(g),"sha256",32);if(!Le)return this.token=void 0,"";const Ne=CryptoJS.AES.decrypt({ciphertext:E},C,{iv:w,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Fe=JSON.parse(Ne),at=Date.now();return!Fe.s||Fe.s>at?(this.token=void 0,""):Fe.e&&Fe.e<at?(this.token=void 0,""):(Fe.isValid=Le,Fe)}},version="0.27.
|
|
2
|
+
"use strict";var Nn=Object.defineProperty,Kn=Object.defineProperties;var Fn=Object.getOwnPropertyDescriptors;var Wn=Object.getOwnPropertySymbols,An=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty,Hn=Object.prototype.propertyIsEnumerable,Yn=Reflect.get;var Ln=(g,t)=>(t=Symbol[g])?t:Symbol.for("Symbol."+g),Un=g=>{throw TypeError(g)},mn=Math.pow,Vn=(g,t,r)=>t in g?Nn(g,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):g[t]=r,bi=(g,t)=>{for(var r in t||(t={}))kn.call(t,r)&&Vn(g,r,t[r]);if(Wn)for(var r of Wn(t))Hn.call(t,r)&&Vn(g,r,t[r]);return g},Di=(g,t)=>Kn(g,Fn(t));var _0=(g,t,r)=>Vn(g,typeof t!="symbol"?t+"":t,r);var yn=(g,t,r)=>Yn(An(g),r,t);var D0=(g,t,r)=>new Promise((d,v)=>{var C=ye=>{try{E(r.next(ye))}catch(Le){v(Le)}},w=ye=>{try{E(r.throw(ye))}catch(Le){v(Le)}},E=ye=>ye.done?d(ye.value):Promise.resolve(ye.value).then(C,w);E((r=r.apply(g,t)).next())}),Bn=function(g,t){this[0]=g,this[1]=t};var Pn=g=>{var t=g[Ln("asyncIterator")],r=!1,d,v={};return t==null?(t=g[Ln("iterator")](),d=C=>v[C]=w=>t[C](w)):(t=t.call(g),d=C=>v[C]=w=>{if(r){if(r=!1,C==="throw")throw w;return w}return r=!0,{done:!1,value:new Bn(new Promise(E=>{var ye=t[C](w);ye instanceof Object||Un("Object expected"),E(ye)}),1)}}),v[Ln("iterator")]=()=>v,d("next"),"throw"in t?d("throw"):v.throw=C=>{throw C},"return"in t&&d("return"),v},En=(g,t,r)=>(t=g[Ln("asyncIterator")])?t.call(g):(g=g[Ln("iterator")](),t={},r=(d,v)=>(v=g[d])&&(t[d]=C=>new Promise((w,E,ye)=>(C=v.call(g,C),ye=C.done,Promise.resolve(C.value).then(Le=>w({value:Le,done:ye}),E)))),r("next"),r("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),turf=require("@turf/turf"),world$1=require("geojson-cn/json/0.json"),json100000Lite=require("geojson-cn/json-lite/100000.json"),json100000=require("geojson-cn/json/100000.json"),adcodeAll=require("geojson-cn/json-lite/all.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(g){return g<0&&(g=this.length+g),this[g]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[g,t,r]=this.token.split(":::"),d=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),v=CryptoJS.enc.Base64.parse(t),C=CryptoJS.enc.Base64.parse(r),w=CryptoJS.lib.WordArray.create(v.words.slice(0,4)),E=CryptoJS.lib.WordArray.create(v.words.slice(4)),ye=jsrsasign.KJUR.crypto.Util.hashHex(v.toString(),"sha256"),Le=d.verifyWithMessageHashPSS(ye,jsrsasign.b64tohex(g),"sha256",32);if(!Le)return this.token=void 0,"";const Ne=CryptoJS.AES.decrypt({ciphertext:E},C,{iv:w,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Fe=JSON.parse(Ne),at=Date.now();return!Fe.s||Fe.s>at?(this.token=void 0,""):Fe.e&&Fe.e<at?(this.token=void 0,""):(Fe.isValid=Le,Fe)}},version="0.27.15";/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2010-2025 Three.js Authors
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -5149,4 +5149,4 @@ version 0.8.2
|
|
|
5149
5149
|
<div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
|
|
5150
5150
|
${g}
|
|
5151
5151
|
</div>
|
|
5152
|
-
`,t},xn=class xn extends Base{constructor(){super(...arguments);_0(this,"leadObjs",objs$1);_0(this,"mapHistory",[]);_0(this,"activePlaneMap",null);_0(this,"isAnimating",!1);_0(this,"parentBg",[]);_0(this,"continentsBg");_0(this,"group");_0(this,"projection");_0(this,"pcenter",[104,37.5]);_0(this,"pscale",5e4/1e3);_0(this,"meters");_0(this,"cityVis",null);_0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});_0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});_0(this,"caId");_0(this,"shadowMapLight");_0(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 d=bi(bi({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let v=bi({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);Object.keys(d).forEach(C=>{C!=="100000"&&/^\d{6}$/.test(C)&&d[+C].features.forEach(E=>{const ye=E.properties.adcode;v[ye]={type:"FeatureCollection",features:[E]}})}),v=bi(bi({},v),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(Di(bi({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,parentBgTopSegments:0,clickHandleDrillDown:!1,drillDownSecondLevelMats:!1,drillDownFirstLevelUseBgMats:!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:r.style==="map2CityOnMap"?Math.PI/180*60:Math.PI/180*120,azimuthAngle:0,handleBackKeepCamvasState:!1,worldPacificCentre:!1,mapBoundary:!0,mergeSide:!1,bottomPlane:!1,bottomPlaneWater:!1,clipOutShow:!0,showBuilding:!0,buildingSideGradient:!1,showRoad:!0,cacheCity:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,showCityOnMapInnerLine:!1,greyFull:!1,citySSAO:!0,pencilConfig:{camera:{near:.1,far:1e3}}},r),{geojsonMap:d,extrudeLineGeojsonMap:v})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.fahey&&(this.options.projectionType="fahey",this.pscale=100,this.pcenter=[0,0]),(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.drillDownFirstLevelUseBgMats=()=>this.options.drillDownFirstLevelUseBgMats,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==="map2Base"||this.options.style==="map2CityOnMap"?base$1(this):this.options.adcode===1e5?china(this):base$2(this)}handleSetting(r,d){return D0(this,null,function*(){return yield yn(xn.prototype,this,"handleSetting").call(this,r,d),r==="label"?d===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels()):r==="labelLite"?d===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels()):r==="shadowMap"&&(d===!1?this.shadowMapDisabled():yield this.shadowMapEnabled()),d})}init(){return D0(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.projection=m({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.lead.draw("Group",{key:"map"+r}),this.group.object3d.name="地图",yield this.initMaterial(),yield this.initVis(r),this.options.clickHandleDrillDown&&(this.lead.handlePick(()=>this.mapArea||[],"down",({baseObject:d,mouseEvent:v})=>{(this.playing||v.metaKey||v.ctrlKey)&&this.handleClick(d)}),this.options.clickOusideBack&&this.lead.handlePick(()=>this.map?[this.map]:[],"downOutside",({mouseEvent:d})=>{(this.playing||d.metaKey||d.ctrlKey)&&this.handleClick()})),yield Promise.all(this.lead.objectsPromise)})}initCityVis(v){return D0(this,arguments,function*(r,d={clip:!1,grey:!1}){var ye;(ye=this.options.fixCity)!=null&&ye[r]&&(r=this.options.fixCity[r]);const C=this.options.center,w=this.options.jsonNameObj[r],E=new City({container:this.container,editor:!1,workerOnce:this.workerOnce});return E.setOptions({container:this.container,center:C,fitTo:!1,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:w,grey:d.grey,greyFull:this.options.greyFull,clip:d.clip?this.map.options.geojson:void 0,clipOutShow:this.options.clipOutShow,planeOut:this.options.style==="map2CityOnMap",showBuilding:this.options.showBuilding,buildingSideGradient:this.options.buildingSideGradient,showRoad:this.options.showRoad,showGrassland:this.options.showGrassland,showRiver:this.options.showRiver,setWaterMaterial:this.options.setWaterMaterial,ssao:this.options.citySSAO,pencil2:this.pencil}),yield E.init(),this.cityVis=E,this.settings.mouseLeft=Ki.SCREEN_PAN,yield this.settings.mouseLeft,this.emit("initCityVis",r),E})}initCityOnMap(r){return D0(this,null,function*(){if(this.getAdcodeShowLevel(r)!=="city"){const C=findAdcodeInfo(r).parent;this.getAdcodeShowLevel(C)==="city"&&(yield this.initCityOnMap(C));return}const d=r===this.mapInfo.adcode||findAdcodeInfo(this.mapInfo.adcode).parent===r||findAdcodeInfo(r).parent===this.mapInfo.adcode,v=yield this.initCityVis(r,{clip:d,grey:!d});if(d){const C=this.mapObj.depth+1e-5;v.group.position.z=this.mapObj.z+C,v.outAreaGroup&&(v.outAreaGroup.position.z-=C/v.multiplyScalar)}else v.group.position.z=this.mapObj.z;this.pencil.camera.near=.001,this.pencil.camera.far=7,this.pencil.camera.updateProjectionMatrix()})}initVisBg(){return D0(this,null,function*(){let r=1e3,d=1e3;const v=new Vector3(0,0,0);if(this.options.parentBg){const C={projection:{center:this.pcenter,scale:this.pscale,rotate:[0,0],projectionType:this.options.projectionType},areaGroup:!1,depth:this.options.parentBgDepth},w=this.options.adcode!==1e5;if(w){const at=this.mList.getMultiple("parentPlane"),ot=findAdcodeInfo(this.options.adcode).parent,Gt=findAdcodeInfo(ot),ct=Gt.b,{res:ke}=yield this.getGeojson(ot),ht=yield this.lead.draw("PlaneMap",bi({key:"bg-100000",geojson:ke,bbox:ct,materialOptions:bi({},at)},C),this.group);ht.object3d.name=Gt.name,ht.lineArr.forEach(xt=>{xt.object3d.name="线",this.lead.updateBaseObjectKey(xt,"100000line"),this.initBaseObjectUserData(xt)}),ht.areaArr.forEach(xt=>{xt.object3d.name="板块",this.lead.updateBaseObjectKey(xt,"100000area")}),ht.position.z=-this.options.parentBgDepth,this.parentBg.push(ht)}const E=this.mList.getMultiple("worldPlane"),ye=this.options.geojsonMap[0],Le=findAdcodeInfo(0).b,Re=yield this.lead.draw("PlaneMap",bi({key:"bg-0",geojson:Di(bi({},ye),{features:[...ye.features.filter(at=>w?at.properties.iso_a3!=="CHN":!0)]}),bbox:Le,materialOptions:bi({},E)},C),this.group);Re.object3d.name="世界",Re.lineArr.forEach(at=>{at.object3d.name="线",this.lead.updateBaseObjectKey(at,"worldline"),this.initBaseObjectUserData(at)}),Re.areaArr.forEach(at=>{at.object3d.name="板块",this.lead.updateBaseObjectKey(at,"worldarea")}),Re.position.z=-this.options.parentBgDepth,this.parentBg.push(Re);const{center:Ne,size:Fe}=Re.getSize();r=Fe.x,d=Fe.y,v.set(Ne.x,Ne.y,0)}if(this.options.continentsBg){this.continentsBg=yield this.lead.draw("ContinentsBg",{depth:this.options.continentsBgDepth,scale:this.pscale},this.group);const C=this.getLocationPosition([104,37.5]);this.continentsBg.position.set(...C),this.continentsBg.position.z=.1}if(this.options.bottomPlane){const C=yield this.lead.draw("CityPlane",{width:r,height:d,color:"#0f1e57"},this.group);C.object3d.name="地图底面",this.lead.updateBaseObjectKey(C,"map-plane"),this.options.bottomPlaneWater&&C.addWater(),C.position.copy(v),C.position.z-=.1}})}initVis(r){return D0(this,null,function*(){var d;if(yield this.setAdcode({adcodes:[r],duration:0}),this.options.style!=="map2Base"&&this.options.style!=="map2CityOnMap"){const v=yield this.lead.draw("Light",{type:"SpotLight",color:this.options.worldPacificCentre?"#82d9f2":"#c1e6dd",intensity:3,distance:0,angle:this.options.continentsBg?1:.5,penumbra:1,decay:0}),C=this.pencil.cameraPositon,w=this.pencil.cameraTarget;v==null||v.spotLight.position.copy(C),v==null||v.spotLight.target.position.copy(w)}if(this.options.mapBoundary){const v=new Box3().setFromObject((d=this.map)==null?void 0:d.object3d);this.pencil.controls.setBoundary(v)}yield this.initVisBg()})}loaderAddBg(){this.options.bottomPlaneWater&&this.loader.add(["/image/water/normalMap0.jpg","/image/water/normalMap1.jpg"],{colorCorrection:!1})}initMaterialBg(){return D0(this,null,function*(){if(this.options.parentBg){const r=(()=>{const d=new MeshStandardMaterial({name:"世界顶面",emissive:"#081417",color:"#000000"}),v=new MeshBasicMaterial({name:"世界侧面",color:"#051714",side:DoubleSide}),C=new Ie$2({name:"世界线",color:new Color$1("#50766E"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:d,sideMat:v,lineMat:C}})();this.mList.addMultiple("worldPlane",r),this.options.adcode!==1e5&&(this.mList.copyMultiple("worldPlane","parentPlane"),Object.values(this.mList.getMultiple("parentPlane")).forEach(d=>{d.name=d.name.replace("世界","父级")}))}if(this.options.continentsBg){const r=(()=>{const d=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),v=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),C=new Ie$2({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:d,sideMat:v,lineMat:C}})();this.mList.addMultiple("continents",r)}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var C,w;const d=this.unproject(r,this.mapObj.z+this.mapObj.depth),v=(w=(C=this.projection).invert)==null?void 0:w.call(C,[d.x,-d.y]);console.log("consoleMousePostion.postion",d),console.log("consoleMousePostion.lnglat",v)})}setAreaMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.areaArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const E=C.object3d,ye=E.material[0].clone();v.color&&ye.color.set(v.color),v.emissive&&(ye.emissive.set(v.emissive),ye.emissiveIntensity=v.emissiveIntensity||1),C.setMaterialList(w,[ye,E.material[1]])}C.useMaterial(w)}}setLineMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.lineArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const ye=C.object3d.material.clone();v.color&&ye.color.set(v.color),v.width&&(ye.lineWidth=v.width),C.setMaterialList(w,ye)}C.useMaterial(w)}}addAreaPlaneByProperty(r,d,v){return D0(this,null,function*(){if(!this.map)return;const w=this.map.options.geojson.features.find(E=>E.properties&&E.properties[r]===d);if(w){let E=v.material,ye=v.sideMaterial;if(f(v.sideMaterial)&&(ye=new MeshBasicMaterial(bi({},v.sideMaterial))),f(v.material)&&(E=new MeshBasicMaterial(bi({},v.material))),v.area){const Ne=this.objectByUuid(v.area);Ne&&([E,ye]=Ne.material)}let Le=v.lineMaterial;if(f(v.lineMaterial)&&(Le=new Ie$2(bi({},v.lineMaterial))),v.line){const Ne=this.objectByUuid(v.line);Ne&&(Le=Ne.material)}const Re=yield this.lead.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[w]},depth:v.depth||0,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:{topMat:E,lineMat:Le,sideMat:ye},areaGroup:!1},this.group);if(Re.position.z=this.mapObj.z+this.mapObj.depth+.01,v.lineBloom&&Re.lineArr.forEach(Ne=>{Ne.enableBloom()}),v.area){Re.position.z=0;const Ne=this.baseObjectByUuid(v.area);Re.areaArr.forEach(Fe=>{Ne!=null&&Ne.isBloom&&Fe.enableBloom(),Fe.scale.z=Ne.scale.z,Fe.position.z=Ne.position.z})}if(v.line){const Ne=this.baseObjectByUuid(v.line);Re.lineArr.forEach(Fe=>{Ne!=null&&Ne.isBloom&&Fe.enableBloom(),Fe.position.z=Ne.position.z})}return Re}})}showAction(){return D0(this,null,function*(){yn(xn.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const r=this.lead.group;if(this.mapHistory[0]){const{stop:d,start:v}=sinusoidalInOut({onUpdate:C=>{if(!this.mapHistory[0]){d();return}r.position.z=-this.mapHistory[0].depth*(1-C)}});if(yield v(),this.mapHistory[0]){const C=this.pencil.cameraTarget.toArray();this.pencil.controls.setTarget(C[0],C[1],this.mapHistory[0].depth+this.mapHistory[0].z,!1)}this.saveCamvasState("controls",0)}})}hide(){return D0(this,null,function*(){if(!this.showState)return;const r=this.lead.group;yield sinusoidalInOut({onUpdate:d=>{r.position.z=-this.mapHistory[0].depth*d}}).start(),setTimeout(()=>{yn(xn.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return D0(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const r=yield this.lead.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0});this.lead.updateBaseObjectKey(r,"ShadowSpotLight"),this.shadowMapLight=r,r.object3d.position.set(.281,32.487,43.077),r.object3d.castShadow=!0;const d=yield this.lead.draw("PlaneShadow");this.planeShadow=d})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.shadowMapLight=void 0),this.planeShadow&&(this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(r){const d=this.getAdcodeShowLevel(r);let v=this.options.mapDepth;Array.isArray(v)||(v=new Array(3).fill(v));let C;return d==="country"?C=v[0]:d==="province"?C=v[1]:C=v[2],C}getDepth(r,d){let v=this.getOptionsDepth(r);if(this.options.depthReference){const C=this.options.depthReference,w=findAdcodeInfo(r).b;v=v*this.getReferenceScale(C,w)}else if(this.mapHistory.length){const C=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b,w=this.getReferenceScale(C,d);v=v*w}return v}getReferenceScale(r,d){const v=Math.abs(d[3]-d[1])/Math.abs(r[3]-r[1]),C=Math.abs(d[2]-d[0])/Math.abs(r[2]-r[0]);return Math.max(v,C)}getAdcodeShowLevel(r,d=!0){var v;if((v=this.options.fixCity)!=null&&v[r]&&(r=this.options.fixCity[r]),r===0)return"world";if(r===1e5)return"country";if(/^\d{6}$/.test(`${r}`)){const{level:C,parent:w}=findAdcodeInfo(r),E=w&&findAdcodeInfo(w).level;return C==="district"&&E==="province"&&d?"city":C}else if(continentsType.find(C=>C.adcode===r))return"continent"}handleClick(r){const{drillDownRestrictions:d}=this.options;this.isAnimating||(r&&r.userData.adcode?this.getAdcodeShowLevel(r.userData.adcode,!1)!==d?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){var C;const d=[];let v=r;for(;v&&(d.unshift(v),v!==this.options.adcode);)v=(C=findAdcodeInfo(v))==null?void 0:C.parent;return d}showMap(C){return D0(this,arguments,function*({adcode:r,adcodes:d,duration:v=1e3}){const w=d||this.getAdcodes(r);(yield this.beforeShowMap(w))!==!1&&(this.emit("beforeDrillDown",[...w]),yield this.setAdcode({adcodes:w,duration:v}),this.emit("afterDrillDown",[...w]))})}drawLabels(){return D0(this,null,function*(){var v;const r=this.options.showLabel;if(!((v=this.mapArea)!=null&&v.length)||!r)return;let d=this.lead.getObject("Group",{key:"mapLabel"});d||(d=yield this.lead.draw("Group",{key:"mapLabel"},this.group),d.object3d.name="地图标签组",yield Promise.all(this.mapArea.map(C=>D0(this,null,function*(){let{name:w,adcode:E,centroid:ye}=C.userData;const{DistrictID:Le,DistName:Re,iso_a2:Ne,center:Fe}=C.userData;if(E=E||Ne||Le,ye=ye||Fe,w=w||Re,!ye)return;const at=this.getLocationPosition(ye);if(this.lead.getObject("Node",{key:`mapLabel-${E}`})||!at)return;const[ot,Gt,ct]=at;let ke=w;r==="lite"&&ke&&(ke=w.replace(/自治州|地区|自治区|省|市|壮族|特别行政区|回族|维吾尔/g,""));const ht=ke&&getLabelElement(ke),xt=ke!=null&&ke.startsWith("澳门")?-1:0;yield this.lead.draw("Node",{position:new Vector3(ot,Gt+xt,ct),children:ht,key:`$p:-${this.options.adcode===0?w:E}`},d)}))))})}eraseLabels(){const r=this.lead.getObject("Group",{key:"mapLabel"});r==null||r.erase()}geAdcodePosition(r){var v;const d=(v=this.mapArea)==null?void 0:v.find(C=>C.userData.adcode===r);if(d){const{centroid:C,center:w}=d.userData;return this.getLocationPosition(C||w)}}getLocationPosition(r){const[d,v]=r,[C,w]=this.projection([d,v]);return[C,-w,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(r){const d=this.geAdcodePosition(r);if(d){const[v,C,w]=d,E=new Vector3(v,C,w);E.project(this.pencil.camera);const{width:ye,height:Le}=this.pencil.getSize(),Re=(E.x*.5+.5)*ye,Ne=(E.y*-.5+.5)*Le;return{x:Re,y:Ne}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(d=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(d)))}getGeojson(r,d=!1){return D0(this,null,function*(){var v,C,w,E;return d?this.options.extrudeLine?(w=this.options.extrudeLineGeojsonMap)!=null&&w[r]?{res:(E=this.options.extrudeLineGeojsonMap)==null?void 0:E[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${r}.json`):{res:void 0}:(v=this.options.geojsonMap)!=null&&v[r]?{res:(C=this.options.geojsonMap)==null?void 0:C[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${r}.json`)})}handleDrillDown(E){return D0(this,arguments,function*({adcode:r,duration:d,handleLook:v,saveBackCamvasState:C,extrudelineBloom:w}){var ye,Le,Re,Ne,Fe;if(typeof r!="undefined"&&!this.isAnimating){const at=(ye=this.map)==null?void 0:ye.findGroup(r,!0),ot=findAdcodeInfo(+r);if(this.isAnimating||!ot)return;this.isAnimating=!0;const{name:Gt}=ot;let{res:ct}=yield this.getGeojson(r),{res:ke}=yield this.getGeojson(r,!0);if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(ct=ke,ke=void 0),[ct,ke].filter(Boolean).forEach(xt=>{if(!xt.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const Rt=findAdcodeInfo(r);xt.features[0].properties=Di(bi(bi({},xt.features[0].properties),Rt),{center:[Rt.lng,Rt.lat]})}}),ct){const xt=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if((Le=this.options.fixGeojson)!=null&&Le[r]){const Ut=(Re=this.options.fixGeojson)==null?void 0:Re[r];if(Ut.startsWith("-")){const l0=+Ut.slice(1);ct.features=ct.features.filter(S0=>S0.properties.adcode!==l0)}}let Rt=findAdcodeInfo(r).b;const Wt=[...Rt];this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Rt=findAdcodeInfo(this.mapInfo.adcode).b:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Rt=findAdcodeInfo(this.mapInfo.adcode).b:Rt=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(Ut=>{Ut.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),C&&this.saveCamvasState("userControls",-1));const Pt=this.mapHistory.length,Nt=Pt-1,Kt=this.getDepth(r,Wt),Ft=(Ne=this.mapHistory[Nt])==null?void 0:Ne.depth,kt=Pt===0||this.options.showOneLevel?0:this.mapHistory[Nt].z+Ft,Yt=Pt===0||this.options.showOneLevel?0:kt-Kt,s0=turf.center(ct).geometry.coordinates,[o0,h0]=this.projection(s0),r0=yield this.drawPlaneMap({geojson:ct,extrudeLineGeojson:ke,depth:Kt,bbox:Rt,adcode:r,extrudelineBloom:w});at==null||at.hide(),r0.position.setZ(Yt);const e0=r0.position.z,i0=()=>D0(this,null,function*(){yield sinusoidalInOut({onUpdate:Ut=>{kt!==e0&&(r0.position.z=e0+(kt-e0)*Ut)}}).start({duration:d})});if(xt)if(this.fixNear(r),r0.position.z=kt,v){const Ut=(Fe=this.mapHistory.at(-1))==null?void 0:Fe.controls;yield this.fitTo(r0,{z:kt+Kt,adcode:r,enableTransition:d!==0,polarAngle:Ut==null?void 0:Ut.polarAngle,azimuthAngle:Ut==null?void 0:Ut.azimuthAngle,handleStart:()=>D0(this,null,function*(){r0.position.z=e0,yield i0()})})}else this.options.showOneLevel&&r0.hide();else yield i0();this.mapHistory.push({map:r0,mapInfo:ot,z:kt,depth:Kt,cX:o0,cY:-h0}),v&&this.drawLabels(),this.saveCamvasState("controls",-1)}else console.log(`${Gt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveCamvasState(r,d){const v=this.mapHistory.at(d);v&&(v[r]={lookAt:[...this.pencil.cameraPositon.toArray(),...this.pencil.cameraTarget.toArray()],polarAngle:this.pencil.controls.polarAngle,azimuthAngle:this.pencil.controls.azimuthAngle})}fixNear(r){const d=this.getAdcodeShowLevel(r),{pencilConfig:v}=this.options;r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(d==="country"||d==="province")&&this.pencil.camera.near!==v.camera.near*10?(this.pencil.camera.near=v.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(d==="city"||d==="district")&&this.pencil.camera.near!==v.camera.near&&(this.pencil.camera.near=v.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(Le){return D0(this,arguments,function*(r,{polarAngle:d,azimuthAngle:v,z:C,handleStart:w,adcode:E,enableTransition:ye=!0}={}){if(!(r!=null&&r.object3d))return;if(E&&(yield this.useSaveCamera(`map-${E}`,ye))){w&&(yield w());return}const Re=this.options.mapPadding,{height:Ne,width:Fe}=this.pencil.getSize();Ne<Re[0]+Re[2]+50&&(Re[0]=0,Re[2]=0),Fe<Re[1]+Re[3]+50&&(Re[1]=0,Re[3]=0);const at=d!=null?d:this.options.polarAngle,ot=v!=null?v:this.options.azimuthAngle,Gt=this.pencil.cameraPositon.toArray(),ct=this.pencil.cameraTarget.toArray();yield this.paddingInCssPixel(r,Re[0],Re[1],Re[2],Re[3],!1);let ke;C&&(ke=this.pencil.cameraTarget.toArray(),yield this.pencil.controls.setTarget(ke[0],ke[1],C,!1)),yield this.pencil.controls.rotateTo(ot,at,!1),ke=this.pencil.cameraTarget.toArray();const ht=this.pencil.cameraPositon.toArray();yield this.lookAt(...Gt,...ct),yield Promise.all([this.lookAt(...ht,...ke,ye),w==null?void 0:w()].filter(Boolean))})}drawPlaneMap(ye){return D0(this,arguments,function*({geojson:r,extrudeLineGeojson:d,bbox:v,depth:C,extrudelineBloom:w,adcode:E}){var Gt;const Le=[this.mList.getMultiple("plane"),this.mList.getMultiple("secondPlane"),this.mList.getMultiple("thirdPlane")];let Re=this.mapHistory.length,Ne=null;for(;Ne===null;)Ne=Le[Re],Re--;const Fe=this.mList.getMultiple("bgPlane"),at=bi(bi({},Ne),Fe?{bgTopMat:Fe.topMat,bgSideMat:Fe.sideMat,bgLineMat:Fe.lineMat,bgExtrudeLineMat:Fe.extrudeLineMat}:{}),ot=yield this.lead.draw("PlaneMap",{key:`${E}`,geojson:r,extrudeLineGeojson:d,depth:C,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:at,bbox:v,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return ot.object3d.name=((Gt=findAdcodeInfo(E))==null?void 0:Gt.name)||`${E}`,this.options.style==="map2CityOnMap"&&!this.options.showCityOnMapInnerLine&&(Ne.lineMat.colorWrite=!1,this.mList.setUserData("plane#lineMat",{selectHide:!0})),ot.extrudelineArr&&ot.extrudelineArr.forEach(ct=>{ct.object3d.name="板块边线",this.lead.updateBaseObjectKey(ct,"extrudeLine"),this.initBaseObjectUserData(ct),w&&(ct.object3d.userData.bloom=!0)}),ot})}handleBack(){return D0(this,arguments,function*({duration:r=1e3,handleLookBack:d=!0,keepOne:v=!0}={}){if(this.isAnimating||(v?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const C=this.mapHistory.pop();if(!this.options.drillDownPlateInCenter){const w=C.map.position.z,E=this.mapObj?this.mapObj.z+(this.mapObj.depth-C.depth):0;yield sinusoidalInOut({onUpdate:ye=>{C.map.position.z=w+(E-w)*ye}}).start({duration:r})}if(this.lead.eraseWithoutMaterial(C.map),this.eraseLabels(),this.mapObj){const{map:w}=this.mapObj,E=w==null?void 0:w.findGroup(C.mapInfo.adcode,!0);E&&E.show(),w&&d&&(this.options.showOneLevel?w.show():w.active(),this.options.drillDownHideParent&&this.parentBg.forEach(ye=>{ye.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return D0(this,null,function*(){const{userControls:d,controls:v}=this.mapObj;yield this.pencil.controls.setLookAt(...d?d.lookAt:v.lookAt,r!==0)})}compareLocations(r,d){const v=r.filter(ye=>ye),C=d.filter(ye=>ye),w=[];let E=0;for(let ye=0;ye<Math.min(v.length,C.length)&&v[ye]===C[ye];ye++)E++;for(let ye=E;ye<v.length;ye++)w.push(-1);for(let ye=E;ye<C.length;ye++)w.push(C[ye]);return w}setAdcode(v){return D0(this,arguments,function*({adcodes:r,duration:d}){var w,E,ye;const{adcodes:C}=this;if(!(JSON.stringify(r)===JSON.stringify(C)||this.isAnimating))if(JSON.stringify(r)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:d,handleLook:!0})}catch(at){console.error(at)}else{const{continent:at,country:ot,province:Gt,city:ct,district:ke}=r.reduce((kt,Yt)=>{const s0=this.getAdcodeShowLevel(Yt);return kt[s0]=Yt,kt},{}),{continent:ht,country:xt,province:Rt,city:Wt,district:Pt}=C.reduce((kt,Yt)=>{const s0=this.getAdcodeShowLevel(Yt);return kt[s0]=Yt,kt},{}),Nt=at||ht,Kt=(ye=(E=(w=this.map)==null?void 0:w.extrudelineArr)==null?void 0:E[0])==null?void 0:ye.object3d.userData.bloom,Ft=this.compareLocations([ht,xt,Rt,Wt,Pt],[at,ot,Gt,ct,ke]);try{for(var Le=En(Ft.entries()),Re,Ne,Fe;Re=!(Ne=yield Le.next()).done;Re=!1){const[kt,Yt]=Ne.value;const s0=kt===Ft.length-1?d:0,o0=kt===Ft.length-1;Yt===-1?yield this.handleBack({duration:s0,handleLookBack:o0,keepOne:!Nt}):yield this.handleDrillDown({adcode:Yt,duration:s0,handleLook:o0,saveBackCamvasState:Ft.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:Kt})}}catch(Ne){Fe=[Ne]}finally{try{Re&&(Ne=Le.return)&&(yield Ne.call(Le))}finally{if(Fe)throw Fe[0]}}}})}setPadding(r,d=!1,v=!1){this.options.mapPadding=[...r],d&&this.fitTo(this.map,{enableTransition:v})}dispose(){var r,d,v;(r=this.cityVis)==null||r.dispose(),(d=this.map)==null||d.dispose(),this.parentBg.forEach(C=>{C.dispose()}),this.parentBg.length=0,(v=this.continentsBg)==null||v.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};_0(xn,"VisName","map");let index$1=xn;class Earth extends Sphere{constructor(r){super();_0(this,"options");this.options=bi({radius:30,rotationY:0},r)}create(){const d=this.pencil.installPlugins.get("materialList").get("earthMaterial");this.material=d,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class Countries extends ie$1{constructor(r){super();_0(this,"options");_0(this,"areaArr",[]);_0(this,"lineArr",[]);this.options=bi({start:30,depth:1.4,lineOffset:.01,hasTop:!0,hasSide:!0,hasLine:!0,lineDuration:1e3,areaGroup:!0},r)}create(){return D0(this,null,function*(){const{geojson:r,mats:d,hasSide:v,lineOffset:C,areaGroup:w}=this.options;this.createGroup();const E=this.pencil.getPlugin("worker"),ye=this.pencil.lead,{borderMat:Le,topMat:Re,outLine:Ne}=d;let Fe=r.features.map(Gt=>{const{type:ct,coordinates:ke}=Gt.geometry;let ht=[];return ct==="Polygon"?ht=ke:ct==="MultiPolygon"&&(ht=ke.flat()),{coords:ht,properties:Gt.properties}});const at=this.options.hasTop||this.options.hasSide,ot=this.options.hasLine;w||(Fe=[{coords:Fe.map(({coords:Gt})=>Gt).flat(),properties:{}}]),yield Promise.all(Fe.map(Gt=>[at&&E.geoGeometry("conicPolygon",{mesaage:{start:[this.options.start],depth:[this.options.depth],useGroups:2,hasBottom:!1,topFirst:!0,coordinatesArr:Gt.coords,bbox:this.options.bbox,hasSide:v},cb:ct=>D0(this,null,function*(){var ht,xt;const ke=yield ye.draw("ConicPolygon",{geometry:ct,material:v?[Re,Le]:Re,hasSide:v},this);ke.object3d.name=(ht=Gt.properties)!=null&&ht.name?((xt=Gt.properties)==null?void 0:xt.name)+"-板块":"板块",ke.userData=bi({},Gt.properties),this.areaArr.push(ke)})}),ot&&E.geoGeometry("conicLine",{mesaage:{start:[this.options.start+this.options.depth+C],lineWidth:[1],coordinatesArr:Gt.coords},cb:ct=>D0(this,null,function*(){var ht;const ke=yield ye.draw("Line",{geometry:ct,material:Ne,onTop:2},this);ke.object3d.name=(ht=Gt.properties)!=null&&ht.name?Gt.properties.name+"-线":"线",ke.userData=bi({},Gt.properties),this.lineArr.push(ke)})})].filter(Boolean)).flat())})}}class SphereShadow extends ie$1{constructor(r){super();_0(this,"options");this.options=bi({radius:30},r)}create(){return D0(this,null,function*(){const r=new SphereGeometry(this.options.radius,128,90),d=new MeshBasicMaterial;this.createMesh(r,d),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs=Di(bi({},objs$3),{Earth,Countries,SphereShadow}),base=g=>{g.loaderAdd=function(){const{loader:t}=this;t.add(["/image/earth2/basic.jpg"]),t.add(["/image/earth2/NormalMap.jpg"],{colorCorrection:!1})},g.initMaterial=function(){return D0(this,null,function*(){const t=this.loader,r=t.getAsset("/image/earth2/basic.jpg"),d=t.getAsset("/image/earth2/NormalMap.jpg"),v=new MeshStandardMaterial({name:"地球材质",map:r,metalness:.1,roughness:.8,normalMap:d,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",v)})},g.initVis=function(){return D0(this,null,function*(){g.pencil.camera.near=1,g.pencil.camera.far=3e3,g.pencil.camera.fov=12,g.pencil.camera.updateProjectionMatrix();const[t,r]=yield Promise.all([this.lead.draw("Light",{type:"PointLight",intensity:4,color:16777215,distance:0,decay:0}),this.lead.draw("Earth",{radius:100,rotationY:Math.PI/180*90})]);yield this.pencil.controls.fitToBox(r.object3d,!1),t.position.copy(this.pencil.cameraPositon)})}},chinaPlate=g=>{g.extendsOptions=Di(bi({},g.extendsOptions),{copyChinaPlane:g.options.copyChinaPlane}),g.loaderAdd=function(){const{loader:t}=this;t.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png"]),t.add(["/image/earth/chinaNormal.webp"],{colorCorrection:!1})},g.initVis=function(){return D0(this,null,function*(){yield this.initLight();const[,t,r,d]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:worldJson.features.filter(v=>{var C;return((C=v.properties)==null?void 0:C.name)!=="中国"})},depth:0,start:this.options.radius,mats:this.mList.getMultiple("world"),hasSide:!1,hasTop:!1,areaGroup:!1}),this.lead.draw("Countries",{geojson:chinaLiteJson,depth:0,start:this.options.radius+this.options.mapDepth,mats:this.mList.getMultiple("china"),hasSide:!1,hasTop:!1}),this.lead.draw("Countries",{geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMultiple("plane"),bbox:chinaBbox,lineDuration:6e3})]);if(t.object3d.name="世界",r.object3d.name="中国边界",d.object3d.name="中国",this.map=d,this.options.copyChinaPlane){this.options.copyChinaPlane;const v=yield this.lead.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});v.object3d.name="复制中国顶面",this.lead.updateBaseObjectKey(v.children[0],"chinaPlaneCopy")}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},g.initMaterial=function(){return D0(this,null,function*(){const t=this.loader,r=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:t.getAsset("/image/earth/chinaNormal.webp")}),d=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:t.getAsset("/image/earth/chinaBorder.png")}),v=new Ie$2({name:"中国边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#59C8FF")}),C=new Ie$2({name:"世界边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#80abaf")}),w=t.getAsset("/image/earth/basic.webp"),E=new MeshStandardMaterial({name:"地球材质",map:w,color:new Color$1(2397309),metalness:.84,roughness:.51}),ye=t.getAsset("/image/earth/flyline.png");ye.wrapS=RepeatWrapping,ye.wrapT=RepeatWrapping,ye.repeat.set(.5,.5);const Le=new Ie$2({name:"省份边界",map:ye,useMap:1,lineWidth:2,sizeAttenuation:0,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:r,borderMat:d,outLine:Le}),this.mList.addMultiple("world",{outLine:C}),this.mList.addMultiple("china",{outLine:v}),this.mList.add("earthMaterial",E)})}},countryPlate=g=>{g.initVis=function(){return D0(this,null,function*(){yield this.initLight();const[,t]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{geojson:worldJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMultiple("plane"),bbox:[-180,-90,180,90],lineOffset:.14}),this.lead.draw("SphereShadow",{radius:this.options.radius})]);this.map=t,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)})},g.initMaterial=function(){return D0(this,null,function*(){const t=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),r=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),d=new Ie$2({name:"边框线",lineWidth:4,sizeAttenuation:0,color:new Color$1("#006aa3")}),v=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.addMultiple("plane",{topMat:r,borderMat:t,outLine:d}),this.mList.add("earthMaterial",v)})},g.getLocationPosition=function(t,r=0){const[d,v]=t,C=this.options.mapDepth+this.options.radius+r;return i$1(d,v,C)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),Rn=class Rn extends Base{constructor(){super(...arguments);_0(this,"leadObjs",objs);_0(this,"leftTruck",!1);_0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});_0(this,"map");_0(this,"autoRotateSpeed",0)}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(bi({mapDepth:1.4,radius:30,style:"chinaPlate",copyChinaPlane:!1},r)),this.initSettingsObj={autoRotate:!1},styles[this.options.style](this)}handleSetting(r,d){return D0(this,null,function*(){return yield yn(Rn.prototype,this,"handleSetting").call(this,r,d),r==="autoRotate"&&this.playing&&(d?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),d})}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 D0(this,null,function*(){const[r,d]=yield Promise.all([this.lead.draw("Light",{type:"RectAreaLight",color:"#E0FFFD",width:200,height:200}),this.lead.draw("Light",{type:"RectAreaLight",intensity:3,width:200,height:170})]);r.position.set(0,50,-100),d.position.set(0,0,150),r.object3d.lookAt(0,0,0),d.object3d.lookAt(0,0,0),this.lead.updateBaseObjectKey(r,"RectAreaLight_1"),this.lead.updateBaseObjectKey(d,"RectAreaLight_2")})}getLocationPosition(r,d=0){const[v,C]=r,w=this.getRadius()+d;return i$1(v,C,w)}setAreaMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.areaArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const E=C.object3d,ye=E.material[0].clone();v.color&&ye.color.set(v.color),v.emissive&&(ye.emissive.set(v.emissive),ye.emissiveIntensity=v.emissiveIntensity||1),C.setMaterialList(w,[ye,E.material[1]])}C.useMaterial(w)}}setLineMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.lineArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const ye=C.object3d.material.clone();v.color&&ye.color.set(v.color),v.width&&(ye.lineWidth=v.width),C.setMaterialList(w,ye)}C.useMaterial(w)}}addAreaPlaneByProperty(r,d,v){return D0(this,null,function*(){if(!this.map)return;const w=this.map.options.geojson.features.find(E=>E.properties&&E.properties[r]===d);if(w)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[w]},depth:this.options.mapDepth+.3,start:this.options.radius,mats:{topMat:new MeshBasicMaterial(v.area),outLine:new Ie$2(v.line)}})})}getRadius(){const r=this.baseObjectByUuid("earth");return r?r.object3d.geometry.parameters.radius:0}checkBehindEarth(r,d){const v=new Vector3(0,0,0),C=new Vector3(0,0,0),w=this.getRadius(),E=()=>{const ye=r();if(!ye.length)return;this.pencil.controls.getPosition(C,!1);const Le=v.clone().sub(C),Re=Math.sqrt(Math.pow(Le.length(),2)-Math.pow(w,2)),Ne=ye.map(Fe=>Fe.position.clone().sub(C).length()>Re);d(ye,Ne)};E(),this.pencil.controls.addEventListener("update",()=>{E()})}};_0(Rn,"VisName","earth");let index=Rn;const ec=(g,t)=>{const r=stringToUtf8ByteArray(g),d=stringToUtf8ByteArray(t).map(function(v,C){return v^r[Math.floor(C%r.length)]}).join(",");return btoa(d)};function stringToUtf8ByteArray(g){const t=[];let r=0;for(let d=0;d<g.length;d++){let v=g.charCodeAt(d);v<128?t[r++]=v:v<2048?(t[r++]=v>>6|192,t[r++]=v&63|128):(v&64512)==55296&&d+1<g.length&&(g.charCodeAt(d+1)&64512)==56320?(v=65536+((v&1023)<<10)+(g.charCodeAt(++d)&1023),t[r++]=v>>18|240,t[r++]=v>>12&63|128,t[r++]=v>>6&63|128,t[r++]=v&63|128):(t[r++]=v>>12|224,t[r++]=v>>6&63|128,t[r++]=v&63|128)}return t}const png2webp=(g,t=2048)=>new Promise((r,d)=>{const v=document.createElement("img"),C=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",w,!1);const E=document.createElement("canvas");if(E.width=v.naturalWidth,E.height=v.naturalHeight,E.width>t||E.height>t){const Re=Math.min(t/E.width,t/E.height);E.width*=Re,E.height*=Re}E.getContext("2d").drawImage(v,0,0,E.width,E.height);const ye=E.toDataURL("image/webp"),Le=new Image;Le.onload=()=>{r(Le)},Le.src=ye},w=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",w,!1),d(new Error("Image load error"))};v.addEventListener("load",C,!1),v.addEventListener("error",w,!1),v.src=g});let b="/";b==="/"&&(b="");const getMapConfig=(v,...C)=>D0(exports,[v,...C],function*(g,t=b,r,d){if((r==null?void 0:r.style)==="map2CityOnMap")return getMapWithCityConfig(g,t,r,d);if(g===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const w=findAdcodeInfo(g);return extendMapConfig({center:[w.lng,w.lat],adcode:w.adcode},t,r,d)}}),getMapWithCityConfig=(v,...C)=>D0(exports,[v,...C],function*(g,t=b,r,d){const w=findAdcodeInfo(g);return extendMapConfig({center:[w.lng,w.lat],adcode:w.adcode,style:"map2CityOnMap",mapDepth:.004,mergeSide:!0},t,r,d)}),extendMapConfig=(v,...C)=>D0(exports,[v,...C],function*(g,t=b,r,d){var ot,Gt;if(g.adcode===0&&g.adcode===1e5)return bi({},g);const w=g.adcode,E=findAdcodeInfo(w).level==="province",ye=findAdcodeInfo(w).level==="city",Le=(ot=g.fixGeojson)==null?void 0:ot[w],Re=(Gt=g.fixGeojson)==null?void 0:Gt[w+"-lite"];let{res:Ne}=yield jsonFetch(t+`/geojson/${Le||"json"}/${w}.json`);const{res:Fe}=yield jsonFetch(t+`/geojson/${Re||"json-lite"}/${w}.json`),at=Di(bi({},g),{geojsonMap:{[w]:Ne},extrudeLineGeojsonMap:{[w]:Fe},cityBboxMap:{},jsonNameObj:{},depthReference:void 0,__template:r==null?void 0:r.__template});if(g.style==="map2CityOnMap"){if(!E){let ct=findAdcodeInfo(w).parent;for(;findAdcodeInfo(ct).level!=="province";)ct=findAdcodeInfo(ct).parent;const{res:ke}=yield jsonFetch(t+`/geojson/${Le||"json"}/${ct}.json`);Ne=ke}Ne.features.forEach(ct=>{at.jsonNameObj[ct.properties.adcode]=ec(ct.properties.name,`${ct.properties.adcode}`)})}if((r==null?void 0:r.__template)==="7s93q0lma4n9887"&&d){console.log("map",w);const ct=yield png2webp(`/template/7s93q0lma4n9887/${w}.jpg`),ke=yield png2webp(`/template/7s93q0lma4n9887/${w}-自发光.jpg`);d[4]=ct.src,d[5]=ke.src,console.log("替换 map emissiveMap")}if((r==null?void 0:r.__template)==="l7ojr7nqc06u24f"&&d&&ye){const ct=yield png2webp(`/template/l7ojr7nqc06u24f/${w}.jpg`),ke=yield png2webp(`/template/l7ojr7nqc06u24f/${w}-自发光.jpg`);d[5]=ct.src,d[4]=ke.src,console.log("替换 map emissiveMap")}if(g.parentBg){const ct=findAdcodeInfo(w).parent;if(ct!==1e5){const{res:ke}=yield jsonFetch(t+`/geojson/json/${ct}.json`),{res:ht}=yield jsonFetch(t+`/geojson/json-lite/${ct}.json`);at.geojsonMap[ct]=ke,at.extrudeLineGeojsonMap[ct]=ht}}return r&&(at.depthReference=r.depthReference||findAdcodeInfo(r.adcode).b),at}),getCityConfig=(r,...d)=>D0(exports,[r,...d],function*(g,t=b){const v=findAdcodeInfo(g),{name:C}=v;return{center:[v.lng,v.lat],adcode:v.adcode,jsonName:ec(C,`${g}`)}}),removeCameraHistory=g=>g.filter(t=>!(t.objectUuid==="camera"&&["SetPosition","SetTarget"].includes(t.type))),access={set token(g){accessToken.token=g}},VERSION=version;exports.Base=Base;exports.City=City$1;exports.Earth=index;exports.Map=index$1;exports.THREE=THREE;exports.TWEEN=tween_esm;exports.VERSION=VERSION;exports.access=access;exports.animationUtils=animation;exports.getCityConfig=getCityConfig;exports.getMapConfig=getMapConfig;exports.removeCameraHistory=removeCameraHistory;
|
|
5152
|
+
`,t},xn=class xn extends Base{constructor(){super(...arguments);_0(this,"leadObjs",objs$1);_0(this,"mapHistory",[]);_0(this,"activePlaneMap",null);_0(this,"isAnimating",!1);_0(this,"parentBg",[]);_0(this,"continentsBg");_0(this,"group");_0(this,"projection");_0(this,"pcenter",[104,37.5]);_0(this,"pscale",5e4/1e3);_0(this,"meters");_0(this,"cityVis",null);_0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});_0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});_0(this,"caId");_0(this,"shadowMapLight");_0(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 d=bi(bi({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let v=bi({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);Object.keys(d).forEach(C=>{C!=="100000"&&/^\d{6}$/.test(C)&&d[+C].features.forEach(E=>{const ye=E.properties.adcode;v[ye]={type:"FeatureCollection",features:[E]}})}),v=bi(bi({},v),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(Di(bi({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,parentBgTopSegments:0,clickHandleDrillDown:!1,drillDownSecondLevelMats:!1,drillDownFirstLevelUseBgMats:!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:r.style==="map2CityOnMap"?Math.PI/180*60:Math.PI/180*120,azimuthAngle:0,handleBackKeepCamvasState:!1,worldPacificCentre:!1,mapBoundary:!0,mergeSide:!1,bottomPlane:!1,bottomPlaneWater:!1,clipOutShow:!0,showBuilding:!0,buildingSideGradient:!1,showRoad:!0,cacheCity:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,showCityOnMapInnerLine:!1,greyFull:!1,citySSAO:!0,pencilConfig:{camera:{near:.1,far:1e3}}},r),{geojsonMap:d,extrudeLineGeojsonMap:v})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.fahey&&(this.options.projectionType="fahey",this.pscale=100,this.pcenter=[0,0]),(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.drillDownFirstLevelUseBgMats=()=>this.options.drillDownFirstLevelUseBgMats,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==="map2Base"||this.options.style==="map2CityOnMap"?base$1(this):this.options.adcode===1e5?china(this):base$2(this)}handleSetting(r,d){return D0(this,null,function*(){return yield yn(xn.prototype,this,"handleSetting").call(this,r,d),r==="label"?d===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels()):r==="labelLite"?d===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels()):r==="shadowMap"&&(d===!1?this.shadowMapDisabled():yield this.shadowMapEnabled()),d})}init(){return D0(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.projection=m({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.lead.draw("Group",{key:"map"+r}),this.group.object3d.name="地图",yield this.initMaterial(),yield this.initVis(r),this.options.clickHandleDrillDown&&(this.lead.handlePick(()=>this.mapArea||[],"down",({baseObject:d,mouseEvent:v})=>{(this.playing||v.metaKey||v.ctrlKey)&&this.handleClick(d)}),this.options.clickOusideBack&&this.lead.handlePick(()=>this.map?[this.map]:[],"downOutside",({mouseEvent:d})=>{(this.playing||d.metaKey||d.ctrlKey)&&this.handleClick()})),yield Promise.all(this.lead.objectsPromise)})}initCityVis(v){return D0(this,arguments,function*(r,d={clip:!1,grey:!1}){var ye;(ye=this.options.fixCity)!=null&&ye[r]&&(r=this.options.fixCity[r]);const C=this.options.center,w=this.options.jsonNameObj[r],E=new City({container:this.container,editor:!1,workerOnce:this.workerOnce});return E.setOptions({container:this.container,center:C,fitTo:!1,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:w,grey:d.grey,greyFull:this.options.greyFull,clip:d.clip?this.map.options.geojson:void 0,clipOutShow:this.options.clipOutShow,planeOut:this.options.style==="map2CityOnMap",showBuilding:this.options.showBuilding,buildingSideGradient:this.options.buildingSideGradient,showRoad:this.options.showRoad,showGrassland:this.options.showGrassland,showRiver:this.options.showRiver,setWaterMaterial:this.options.setWaterMaterial,ssao:this.options.citySSAO,pencil2:this.pencil}),yield E.init(),this.cityVis=E,this.settings.mouseLeft=Ki.SCREEN_PAN,yield this.settings.mouseLeft,this.emit("initCityVis",r),E})}initCityOnMap(r){return D0(this,null,function*(){if(this.getAdcodeShowLevel(r)!=="city"){const C=findAdcodeInfo(r).parent;this.getAdcodeShowLevel(C)==="city"&&(yield this.initCityOnMap(C));return}const d=r===this.mapInfo.adcode||findAdcodeInfo(this.mapInfo.adcode).parent===r||findAdcodeInfo(r).parent===this.mapInfo.adcode,v=yield this.initCityVis(r,{clip:d,grey:!d});if(d){const C=this.mapObj.depth+1e-5;v.group.position.z=this.mapObj.z+C,v.outAreaGroup&&(v.outAreaGroup.position.z-=C/v.multiplyScalar)}else v.group.position.z=this.mapObj.z;this.pencil.camera.near=.001,this.pencil.camera.far=7,this.pencil.camera.updateProjectionMatrix()})}initVisBg(){return D0(this,null,function*(){let r=1e3,d=1e3;const v=new Vector3(0,0,0);if(this.options.parentBg){const C={projection:{center:this.pcenter,scale:this.pscale,rotate:[0,0],projectionType:this.options.projectionType},areaGroup:!1,depth:this.options.parentBgDepth},w=this.options.adcode!==1e5;if(w){const at=this.mList.getMultiple("parentPlane"),ot=findAdcodeInfo(this.options.adcode).parent,Gt=findAdcodeInfo(ot),ct=Gt.b,{res:ke}=yield this.getGeojson(ot),ht=yield this.lead.draw("PlaneMap",bi({key:"bg-100000",geojson:ke,bbox:ct,materialOptions:bi({},at)},C),this.group);ht.object3d.name=Gt.name,ht.lineArr.forEach(xt=>{xt.object3d.name="线",this.lead.updateBaseObjectKey(xt,"100000line"),this.initBaseObjectUserData(xt)}),ht.areaArr.forEach(xt=>{xt.object3d.name="板块",this.lead.updateBaseObjectKey(xt,"100000area")}),ht.position.z=-this.options.parentBgDepth,this.parentBg.push(ht)}const E=this.mList.getMultiple("worldPlane"),ye=this.options.geojsonMap[0],Le=findAdcodeInfo(0).b,Re=yield this.lead.draw("PlaneMap",bi({key:"bg-0",geojson:Di(bi({},ye),{features:[...ye.features.filter(at=>w?at.properties.iso_a3!=="CHN":!0)]}),bbox:Le,materialOptions:bi({},E)},C),this.group);Re.object3d.name="世界",Re.lineArr.forEach(at=>{at.object3d.name="线",this.lead.updateBaseObjectKey(at,"worldline"),this.initBaseObjectUserData(at)}),Re.areaArr.forEach(at=>{at.object3d.name="板块",this.lead.updateBaseObjectKey(at,"worldarea")}),Re.position.z=-this.options.parentBgDepth,this.parentBg.push(Re);const{center:Ne,size:Fe}=Re.getSize();r=Fe.x,d=Fe.y,v.set(Ne.x,Ne.y,0)}if(this.options.continentsBg){if(this.continentsBg=yield this.lead.draw("ContinentsBg",{depth:this.options.continentsBgDepth,scale:this.pscale},this.group),this.options.style!=="map2CityOnMap"&&this.options.style!=="map2Base"){const C=this.getLocationPosition([104,37.5]);this.continentsBg.position.set(...C)}this.continentsBg.position.z=.1}if(this.options.bottomPlane){const C=yield this.lead.draw("CityPlane",{width:r,height:d,color:"#0f1e57"},this.group);C.object3d.name="地图底面",this.lead.updateBaseObjectKey(C,"map-plane"),this.options.bottomPlaneWater&&C.addWater(),C.position.copy(v),C.position.z-=.1}})}initVis(r){return D0(this,null,function*(){var d;if(yield this.setAdcode({adcodes:[r],duration:0}),this.options.style!=="map2Base"&&this.options.style!=="map2CityOnMap"){const v=yield this.lead.draw("Light",{type:"SpotLight",color:this.options.worldPacificCentre?"#82d9f2":"#c1e6dd",intensity:3,distance:0,angle:this.options.continentsBg?1:.5,penumbra:1,decay:0}),C=this.pencil.cameraPositon,w=this.pencil.cameraTarget;v==null||v.spotLight.position.copy(C),v==null||v.spotLight.target.position.copy(w)}if(this.options.mapBoundary){const v=new Box3().setFromObject((d=this.map)==null?void 0:d.object3d);this.pencil.controls.setBoundary(v)}yield this.initVisBg()})}loaderAddBg(){this.options.bottomPlaneWater&&this.loader.add(["/image/water/normalMap0.jpg","/image/water/normalMap1.jpg"],{colorCorrection:!1})}initMaterialBg(){return D0(this,null,function*(){if(this.options.parentBg){const r=(()=>{const d=new MeshStandardMaterial({name:"世界顶面",emissive:"#081417",color:"#000000"}),v=new MeshBasicMaterial({name:"世界侧面",color:"#051714",side:DoubleSide}),C=new Ie$2({name:"世界线",color:new Color$1("#50766E"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:d,sideMat:v,lineMat:C}})();this.mList.addMultiple("worldPlane",r),this.options.adcode!==1e5&&(this.mList.copyMultiple("worldPlane","parentPlane"),Object.values(this.mList.getMultiple("parentPlane")).forEach(d=>{d.name=d.name.replace("世界","父级")}))}if(this.options.continentsBg){const r=(()=>{const d=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),v=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),C=new Ie$2({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:d,sideMat:v,lineMat:C}})();this.mList.addMultiple("continents",r)}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var C,w;const d=this.unproject(r,this.mapObj.z+this.mapObj.depth),v=(w=(C=this.projection).invert)==null?void 0:w.call(C,[d.x,-d.y]);console.log("consoleMousePostion.postion",d),console.log("consoleMousePostion.lnglat",v)})}setAreaMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.areaArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const E=C.object3d,ye=E.material[0].clone();v.color&&ye.color.set(v.color),v.emissive&&(ye.emissive.set(v.emissive),ye.emissiveIntensity=v.emissiveIntensity||1),C.setMaterialList(w,[ye,E.material[1]])}C.useMaterial(w)}}setLineMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.lineArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const ye=C.object3d.material.clone();v.color&&ye.color.set(v.color),v.width&&(ye.lineWidth=v.width),C.setMaterialList(w,ye)}C.useMaterial(w)}}addAreaPlaneByProperty(r,d,v){return D0(this,null,function*(){if(!this.map)return;const w=this.map.options.geojson.features.find(E=>E.properties&&E.properties[r]===d);if(w){let E=v.material,ye=v.sideMaterial;if(f(v.sideMaterial)&&(ye=new MeshBasicMaterial(bi({},v.sideMaterial))),f(v.material)&&(E=new MeshBasicMaterial(bi({},v.material))),v.area){const Ne=this.objectByUuid(v.area);Ne&&([E,ye]=Ne.material)}let Le=v.lineMaterial;if(f(v.lineMaterial)&&(Le=new Ie$2(bi({},v.lineMaterial))),v.line){const Ne=this.objectByUuid(v.line);Ne&&(Le=Ne.material)}const Re=yield this.lead.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[w]},depth:v.depth||0,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:{topMat:E,lineMat:Le,sideMat:ye},areaGroup:!1},this.group);if(Re.position.z=this.mapObj.z+this.mapObj.depth+.01,v.lineBloom&&Re.lineArr.forEach(Ne=>{Ne.enableBloom()}),v.area){Re.position.z=0;const Ne=this.baseObjectByUuid(v.area);Re.areaArr.forEach(Fe=>{Ne!=null&&Ne.isBloom&&Fe.enableBloom(),Fe.scale.z=Ne.scale.z,Fe.position.z=Ne.position.z})}if(v.line){const Ne=this.baseObjectByUuid(v.line);Re.lineArr.forEach(Fe=>{Ne!=null&&Ne.isBloom&&Fe.enableBloom(),Fe.position.z=Ne.position.z})}return Re}})}showAction(){return D0(this,null,function*(){yn(xn.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const r=this.lead.group;if(this.mapHistory[0]){const{stop:d,start:v}=sinusoidalInOut({onUpdate:C=>{if(!this.mapHistory[0]){d();return}r.position.z=-this.mapHistory[0].depth*(1-C)}});if(yield v(),this.mapHistory[0]){const C=this.pencil.cameraTarget.toArray();this.pencil.controls.setTarget(C[0],C[1],this.mapHistory[0].depth+this.mapHistory[0].z,!1)}this.saveCamvasState("controls",0)}})}hide(){return D0(this,null,function*(){if(!this.showState)return;const r=this.lead.group;yield sinusoidalInOut({onUpdate:d=>{r.position.z=-this.mapHistory[0].depth*d}}).start(),setTimeout(()=>{yn(xn.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return D0(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const r=yield this.lead.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0});this.lead.updateBaseObjectKey(r,"ShadowSpotLight"),this.shadowMapLight=r,r.object3d.position.set(.281,32.487,43.077),r.object3d.castShadow=!0;const d=yield this.lead.draw("PlaneShadow");this.planeShadow=d})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.shadowMapLight=void 0),this.planeShadow&&(this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(r){const d=this.getAdcodeShowLevel(r);let v=this.options.mapDepth;Array.isArray(v)||(v=new Array(3).fill(v));let C;return d==="country"?C=v[0]:d==="province"?C=v[1]:C=v[2],C}getDepth(r,d){let v=this.getOptionsDepth(r);if(this.options.depthReference){const C=this.options.depthReference,w=findAdcodeInfo(r).b;v=v*this.getReferenceScale(C,w)}else if(this.mapHistory.length){const C=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b,w=this.getReferenceScale(C,d);v=v*w}return v}getReferenceScale(r,d){const v=Math.abs(d[3]-d[1])/Math.abs(r[3]-r[1]),C=Math.abs(d[2]-d[0])/Math.abs(r[2]-r[0]);return Math.max(v,C)}getAdcodeShowLevel(r,d=!0){var v;if((v=this.options.fixCity)!=null&&v[r]&&(r=this.options.fixCity[r]),r===0)return"world";if(r===1e5)return"country";if(/^\d{6}$/.test(`${r}`)){const{level:C,parent:w}=findAdcodeInfo(r),E=w&&findAdcodeInfo(w).level;return C==="district"&&E==="province"&&d?"city":C}else if(continentsType.find(C=>C.adcode===r))return"continent"}handleClick(r){const{drillDownRestrictions:d}=this.options;this.isAnimating||(r&&r.userData.adcode?this.getAdcodeShowLevel(r.userData.adcode,!1)!==d?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){var C;const d=[];let v=r;for(;v&&(d.unshift(v),v!==this.options.adcode);)v=(C=findAdcodeInfo(v))==null?void 0:C.parent;return d}showMap(C){return D0(this,arguments,function*({adcode:r,adcodes:d,duration:v=1e3}){const w=d||this.getAdcodes(r);(yield this.beforeShowMap(w))!==!1&&(this.emit("beforeDrillDown",[...w]),yield this.setAdcode({adcodes:w,duration:v}),this.emit("afterDrillDown",[...w]))})}drawLabels(){return D0(this,null,function*(){var v;const r=this.options.showLabel;if(!((v=this.mapArea)!=null&&v.length)||!r)return;let d=this.lead.getObject("Group",{key:"mapLabel"});d||(d=yield this.lead.draw("Group",{key:"mapLabel"},this.group),d.object3d.name="地图标签组",yield Promise.all(this.mapArea.map(C=>D0(this,null,function*(){let{name:w,adcode:E,centroid:ye}=C.userData;const{DistrictID:Le,DistName:Re,iso_a2:Ne,center:Fe}=C.userData;if(E=E||Ne||Le,ye=ye||Fe,w=w||Re,!ye)return;const at=this.getLocationPosition(ye);if(this.lead.getObject("Node",{key:`mapLabel-${E}`})||!at)return;const[ot,Gt,ct]=at;let ke=w;r==="lite"&&ke&&(ke=w.replace(/自治州|地区|自治区|省|市|壮族|特别行政区|回族|维吾尔/g,""));const ht=ke&&getLabelElement(ke),xt=ke!=null&&ke.startsWith("澳门")?-1:0;yield this.lead.draw("Node",{position:new Vector3(ot,Gt+xt,ct),children:ht,key:`$p:-${this.options.adcode===0?w:E}`},d)}))))})}eraseLabels(){const r=this.lead.getObject("Group",{key:"mapLabel"});r==null||r.erase()}geAdcodePosition(r){var v;const d=(v=this.mapArea)==null?void 0:v.find(C=>C.userData.adcode===r);if(d){const{centroid:C,center:w}=d.userData;return this.getLocationPosition(C||w)}}getLocationPosition(r){const[d,v]=r,[C,w]=this.projection([d,v]);return[C,-w,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(r){const d=this.geAdcodePosition(r);if(d){const[v,C,w]=d,E=new Vector3(v,C,w);E.project(this.pencil.camera);const{width:ye,height:Le}=this.pencil.getSize(),Re=(E.x*.5+.5)*ye,Ne=(E.y*-.5+.5)*Le;return{x:Re,y:Ne}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(d=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(d)))}getGeojson(r,d=!1){return D0(this,null,function*(){var v,C,w,E;return d?this.options.extrudeLine?(w=this.options.extrudeLineGeojsonMap)!=null&&w[r]?{res:(E=this.options.extrudeLineGeojsonMap)==null?void 0:E[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${r}.json`):{res:void 0}:(v=this.options.geojsonMap)!=null&&v[r]?{res:(C=this.options.geojsonMap)==null?void 0:C[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${r}.json`)})}handleDrillDown(E){return D0(this,arguments,function*({adcode:r,duration:d,handleLook:v,saveBackCamvasState:C,extrudelineBloom:w}){var ye,Le,Re,Ne,Fe;if(typeof r!="undefined"&&!this.isAnimating){const at=(ye=this.map)==null?void 0:ye.findGroup(r,!0),ot=findAdcodeInfo(+r);if(this.isAnimating||!ot)return;this.isAnimating=!0;const{name:Gt}=ot;let{res:ct}=yield this.getGeojson(r),{res:ke}=yield this.getGeojson(r,!0);if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(ct=ke,ke=void 0),[ct,ke].filter(Boolean).forEach(xt=>{if(!xt.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const Rt=findAdcodeInfo(r);xt.features[0].properties=Di(bi(bi({},xt.features[0].properties),Rt),{center:[Rt.lng,Rt.lat]})}}),ct){const xt=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if((Le=this.options.fixGeojson)!=null&&Le[r]){const Ut=(Re=this.options.fixGeojson)==null?void 0:Re[r];if(Ut.startsWith("-")){const l0=+Ut.slice(1);ct.features=ct.features.filter(S0=>S0.properties.adcode!==l0)}}let Rt=findAdcodeInfo(r).b;const Wt=[...Rt];this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Rt=findAdcodeInfo(this.mapInfo.adcode).b:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Rt=findAdcodeInfo(this.mapInfo.adcode).b:Rt=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(Ut=>{Ut.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),C&&this.saveCamvasState("userControls",-1));const Pt=this.mapHistory.length,Nt=Pt-1,Kt=this.getDepth(r,Wt),Ft=(Ne=this.mapHistory[Nt])==null?void 0:Ne.depth,kt=Pt===0||this.options.showOneLevel?0:this.mapHistory[Nt].z+Ft,Yt=Pt===0||this.options.showOneLevel?0:kt-Kt,s0=turf.center(ct).geometry.coordinates,[o0,h0]=this.projection(s0),r0=yield this.drawPlaneMap({geojson:ct,extrudeLineGeojson:ke,depth:Kt,bbox:Rt,adcode:r,extrudelineBloom:w});at==null||at.hide(),r0.position.setZ(Yt);const e0=r0.position.z,i0=()=>D0(this,null,function*(){yield sinusoidalInOut({onUpdate:Ut=>{kt!==e0&&(r0.position.z=e0+(kt-e0)*Ut)}}).start({duration:d})});if(xt)if(this.fixNear(r),r0.position.z=kt,v){const Ut=(Fe=this.mapHistory.at(-1))==null?void 0:Fe.controls;yield this.fitTo(r0,{z:kt+Kt,adcode:r,enableTransition:d!==0,polarAngle:Ut==null?void 0:Ut.polarAngle,azimuthAngle:Ut==null?void 0:Ut.azimuthAngle,handleStart:()=>D0(this,null,function*(){r0.position.z=e0,yield i0()})})}else this.options.showOneLevel&&r0.hide();else yield i0();this.mapHistory.push({map:r0,mapInfo:ot,z:kt,depth:Kt,cX:o0,cY:-h0}),v&&this.drawLabels(),this.saveCamvasState("controls",-1)}else console.log(`${Gt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveCamvasState(r,d){const v=this.mapHistory.at(d);v&&(v[r]={lookAt:[...this.pencil.cameraPositon.toArray(),...this.pencil.cameraTarget.toArray()],polarAngle:this.pencil.controls.polarAngle,azimuthAngle:this.pencil.controls.azimuthAngle})}fixNear(r){const d=this.getAdcodeShowLevel(r),{pencilConfig:v}=this.options;r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(d==="country"||d==="province")&&this.pencil.camera.near!==v.camera.near*10?(this.pencil.camera.near=v.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(d==="city"||d==="district")&&this.pencil.camera.near!==v.camera.near&&(this.pencil.camera.near=v.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(Le){return D0(this,arguments,function*(r,{polarAngle:d,azimuthAngle:v,z:C,handleStart:w,adcode:E,enableTransition:ye=!0}={}){if(!(r!=null&&r.object3d))return;if(E&&(yield this.useSaveCamera(`map-${E}`,ye))){w&&(yield w());return}const Re=this.options.mapPadding,{height:Ne,width:Fe}=this.pencil.getSize();Ne<Re[0]+Re[2]+50&&(Re[0]=0,Re[2]=0),Fe<Re[1]+Re[3]+50&&(Re[1]=0,Re[3]=0);const at=d!=null?d:this.options.polarAngle,ot=v!=null?v:this.options.azimuthAngle,Gt=this.pencil.cameraPositon.toArray(),ct=this.pencil.cameraTarget.toArray();yield this.paddingInCssPixel(r,Re[0],Re[1],Re[2],Re[3],!1);let ke;C&&(ke=this.pencil.cameraTarget.toArray(),yield this.pencil.controls.setTarget(ke[0],ke[1],C,!1)),yield this.pencil.controls.rotateTo(ot,at,!1),ke=this.pencil.cameraTarget.toArray();const ht=this.pencil.cameraPositon.toArray();yield this.lookAt(...Gt,...ct),yield Promise.all([this.lookAt(...ht,...ke,ye),w==null?void 0:w()].filter(Boolean))})}drawPlaneMap(ye){return D0(this,arguments,function*({geojson:r,extrudeLineGeojson:d,bbox:v,depth:C,extrudelineBloom:w,adcode:E}){var Gt;const Le=[this.mList.getMultiple("plane"),this.mList.getMultiple("secondPlane"),this.mList.getMultiple("thirdPlane")];let Re=this.mapHistory.length,Ne=null;for(;Ne===null;)Ne=Le[Re],Re--;const Fe=this.mList.getMultiple("bgPlane"),at=bi(bi({},Ne),Fe?{bgTopMat:Fe.topMat,bgSideMat:Fe.sideMat,bgLineMat:Fe.lineMat,bgExtrudeLineMat:Fe.extrudeLineMat}:{}),ot=yield this.lead.draw("PlaneMap",{key:`${E}`,geojson:r,extrudeLineGeojson:d,depth:C,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:at,bbox:v,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return ot.object3d.name=((Gt=findAdcodeInfo(E))==null?void 0:Gt.name)||`${E}`,this.options.style==="map2CityOnMap"&&!this.options.showCityOnMapInnerLine&&(Ne.lineMat.colorWrite=!1,this.mList.setUserData("plane#lineMat",{selectHide:!0})),ot.extrudelineArr&&ot.extrudelineArr.forEach(ct=>{ct.object3d.name="板块边线",this.lead.updateBaseObjectKey(ct,"extrudeLine"),this.initBaseObjectUserData(ct),w&&(ct.object3d.userData.bloom=!0)}),ot})}handleBack(){return D0(this,arguments,function*({duration:r=1e3,handleLookBack:d=!0,keepOne:v=!0}={}){if(this.isAnimating||(v?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const C=this.mapHistory.pop();if(!this.options.drillDownPlateInCenter){const w=C.map.position.z,E=this.mapObj?this.mapObj.z+(this.mapObj.depth-C.depth):0;yield sinusoidalInOut({onUpdate:ye=>{C.map.position.z=w+(E-w)*ye}}).start({duration:r})}if(this.lead.eraseWithoutMaterial(C.map),this.eraseLabels(),this.mapObj){const{map:w}=this.mapObj,E=w==null?void 0:w.findGroup(C.mapInfo.adcode,!0);E&&E.show(),w&&d&&(this.options.showOneLevel?w.show():w.active(),this.options.drillDownHideParent&&this.parentBg.forEach(ye=>{ye.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return D0(this,null,function*(){const{userControls:d,controls:v}=this.mapObj;yield this.pencil.controls.setLookAt(...d?d.lookAt:v.lookAt,r!==0)})}compareLocations(r,d){const v=r.filter(ye=>ye),C=d.filter(ye=>ye),w=[];let E=0;for(let ye=0;ye<Math.min(v.length,C.length)&&v[ye]===C[ye];ye++)E++;for(let ye=E;ye<v.length;ye++)w.push(-1);for(let ye=E;ye<C.length;ye++)w.push(C[ye]);return w}setAdcode(v){return D0(this,arguments,function*({adcodes:r,duration:d}){var w,E,ye;const{adcodes:C}=this;if(!(JSON.stringify(r)===JSON.stringify(C)||this.isAnimating))if(JSON.stringify(r)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:d,handleLook:!0})}catch(at){console.error(at)}else{const{continent:at,country:ot,province:Gt,city:ct,district:ke}=r.reduce((kt,Yt)=>{const s0=this.getAdcodeShowLevel(Yt);return kt[s0]=Yt,kt},{}),{continent:ht,country:xt,province:Rt,city:Wt,district:Pt}=C.reduce((kt,Yt)=>{const s0=this.getAdcodeShowLevel(Yt);return kt[s0]=Yt,kt},{}),Nt=at||ht,Kt=(ye=(E=(w=this.map)==null?void 0:w.extrudelineArr)==null?void 0:E[0])==null?void 0:ye.object3d.userData.bloom,Ft=this.compareLocations([ht,xt,Rt,Wt,Pt],[at,ot,Gt,ct,ke]);try{for(var Le=En(Ft.entries()),Re,Ne,Fe;Re=!(Ne=yield Le.next()).done;Re=!1){const[kt,Yt]=Ne.value;const s0=kt===Ft.length-1?d:0,o0=kt===Ft.length-1;Yt===-1?yield this.handleBack({duration:s0,handleLookBack:o0,keepOne:!Nt}):yield this.handleDrillDown({adcode:Yt,duration:s0,handleLook:o0,saveBackCamvasState:Ft.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:Kt})}}catch(Ne){Fe=[Ne]}finally{try{Re&&(Ne=Le.return)&&(yield Ne.call(Le))}finally{if(Fe)throw Fe[0]}}}})}setPadding(r,d=!1,v=!1){this.options.mapPadding=[...r],d&&this.fitTo(this.map,{enableTransition:v})}dispose(){var r,d,v;(r=this.cityVis)==null||r.dispose(),(d=this.map)==null||d.dispose(),this.parentBg.forEach(C=>{C.dispose()}),this.parentBg.length=0,(v=this.continentsBg)==null||v.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};_0(xn,"VisName","map");let index$1=xn;class Earth extends Sphere{constructor(r){super();_0(this,"options");this.options=bi({radius:30,rotationY:0},r)}create(){const d=this.pencil.installPlugins.get("materialList").get("earthMaterial");this.material=d,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class Countries extends ie$1{constructor(r){super();_0(this,"options");_0(this,"areaArr",[]);_0(this,"lineArr",[]);this.options=bi({start:30,depth:1.4,lineOffset:.01,hasTop:!0,hasSide:!0,hasLine:!0,lineDuration:1e3,areaGroup:!0},r)}create(){return D0(this,null,function*(){const{geojson:r,mats:d,hasSide:v,lineOffset:C,areaGroup:w}=this.options;this.createGroup();const E=this.pencil.getPlugin("worker"),ye=this.pencil.lead,{borderMat:Le,topMat:Re,outLine:Ne}=d;let Fe=r.features.map(Gt=>{const{type:ct,coordinates:ke}=Gt.geometry;let ht=[];return ct==="Polygon"?ht=ke:ct==="MultiPolygon"&&(ht=ke.flat()),{coords:ht,properties:Gt.properties}});const at=this.options.hasTop||this.options.hasSide,ot=this.options.hasLine;w||(Fe=[{coords:Fe.map(({coords:Gt})=>Gt).flat(),properties:{}}]),yield Promise.all(Fe.map(Gt=>[at&&E.geoGeometry("conicPolygon",{mesaage:{start:[this.options.start],depth:[this.options.depth],useGroups:2,hasBottom:!1,topFirst:!0,coordinatesArr:Gt.coords,bbox:this.options.bbox,hasSide:v},cb:ct=>D0(this,null,function*(){var ht,xt;const ke=yield ye.draw("ConicPolygon",{geometry:ct,material:v?[Re,Le]:Re,hasSide:v},this);ke.object3d.name=(ht=Gt.properties)!=null&&ht.name?((xt=Gt.properties)==null?void 0:xt.name)+"-板块":"板块",ke.userData=bi({},Gt.properties),this.areaArr.push(ke)})}),ot&&E.geoGeometry("conicLine",{mesaage:{start:[this.options.start+this.options.depth+C],lineWidth:[1],coordinatesArr:Gt.coords},cb:ct=>D0(this,null,function*(){var ht;const ke=yield ye.draw("Line",{geometry:ct,material:Ne,onTop:2},this);ke.object3d.name=(ht=Gt.properties)!=null&&ht.name?Gt.properties.name+"-线":"线",ke.userData=bi({},Gt.properties),this.lineArr.push(ke)})})].filter(Boolean)).flat())})}}class SphereShadow extends ie$1{constructor(r){super();_0(this,"options");this.options=bi({radius:30},r)}create(){return D0(this,null,function*(){const r=new SphereGeometry(this.options.radius,128,90),d=new MeshBasicMaterial;this.createMesh(r,d),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs=Di(bi({},objs$3),{Earth,Countries,SphereShadow}),base=g=>{g.loaderAdd=function(){const{loader:t}=this;t.add(["/image/earth2/basic.jpg"]),t.add(["/image/earth2/NormalMap.jpg"],{colorCorrection:!1})},g.initMaterial=function(){return D0(this,null,function*(){const t=this.loader,r=t.getAsset("/image/earth2/basic.jpg"),d=t.getAsset("/image/earth2/NormalMap.jpg"),v=new MeshStandardMaterial({name:"地球材质",map:r,metalness:.1,roughness:.8,normalMap:d,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",v)})},g.initVis=function(){return D0(this,null,function*(){g.pencil.camera.near=1,g.pencil.camera.far=3e3,g.pencil.camera.fov=12,g.pencil.camera.updateProjectionMatrix();const[t,r]=yield Promise.all([this.lead.draw("Light",{type:"PointLight",intensity:4,color:16777215,distance:0,decay:0}),this.lead.draw("Earth",{radius:100,rotationY:Math.PI/180*90})]);yield this.pencil.controls.fitToBox(r.object3d,!1),t.position.copy(this.pencil.cameraPositon)})}},chinaPlate=g=>{g.extendsOptions=Di(bi({},g.extendsOptions),{copyChinaPlane:g.options.copyChinaPlane}),g.loaderAdd=function(){const{loader:t}=this;t.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png"]),t.add(["/image/earth/chinaNormal.webp"],{colorCorrection:!1})},g.initVis=function(){return D0(this,null,function*(){yield this.initLight();const[,t,r,d]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:worldJson.features.filter(v=>{var C;return((C=v.properties)==null?void 0:C.name)!=="中国"})},depth:0,start:this.options.radius,mats:this.mList.getMultiple("world"),hasSide:!1,hasTop:!1,areaGroup:!1}),this.lead.draw("Countries",{geojson:chinaLiteJson,depth:0,start:this.options.radius+this.options.mapDepth,mats:this.mList.getMultiple("china"),hasSide:!1,hasTop:!1}),this.lead.draw("Countries",{geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMultiple("plane"),bbox:chinaBbox,lineDuration:6e3})]);if(t.object3d.name="世界",r.object3d.name="中国边界",d.object3d.name="中国",this.map=d,this.options.copyChinaPlane){this.options.copyChinaPlane;const v=yield this.lead.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});v.object3d.name="复制中国顶面",this.lead.updateBaseObjectKey(v.children[0],"chinaPlaneCopy")}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},g.initMaterial=function(){return D0(this,null,function*(){const t=this.loader,r=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:t.getAsset("/image/earth/chinaNormal.webp")}),d=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:t.getAsset("/image/earth/chinaBorder.png")}),v=new Ie$2({name:"中国边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#59C8FF")}),C=new Ie$2({name:"世界边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#80abaf")}),w=t.getAsset("/image/earth/basic.webp"),E=new MeshStandardMaterial({name:"地球材质",map:w,color:new Color$1(2397309),metalness:.84,roughness:.51}),ye=t.getAsset("/image/earth/flyline.png");ye.wrapS=RepeatWrapping,ye.wrapT=RepeatWrapping,ye.repeat.set(.5,.5);const Le=new Ie$2({name:"省份边界",map:ye,useMap:1,lineWidth:2,sizeAttenuation:0,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:r,borderMat:d,outLine:Le}),this.mList.addMultiple("world",{outLine:C}),this.mList.addMultiple("china",{outLine:v}),this.mList.add("earthMaterial",E)})}},countryPlate=g=>{g.initVis=function(){return D0(this,null,function*(){yield this.initLight();const[,t]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{geojson:worldJson,depth:this.options.mapDepth,start:this.options.radius,mats:this.mList.getMultiple("plane"),bbox:[-180,-90,180,90],lineOffset:.14}),this.lead.draw("SphereShadow",{radius:this.options.radius})]);this.map=t,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)})},g.initMaterial=function(){return D0(this,null,function*(){const t=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),r=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),d=new Ie$2({name:"边框线",lineWidth:4,sizeAttenuation:0,color:new Color$1("#006aa3")}),v=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.addMultiple("plane",{topMat:r,borderMat:t,outLine:d}),this.mList.add("earthMaterial",v)})},g.getLocationPosition=function(t,r=0){const[d,v]=t,C=this.options.mapDepth+this.options.radius+r;return i$1(d,v,C)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),Rn=class Rn extends Base{constructor(){super(...arguments);_0(this,"leadObjs",objs);_0(this,"leftTruck",!1);_0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});_0(this,"map");_0(this,"autoRotateSpeed",0)}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(bi({mapDepth:1.4,radius:30,style:"chinaPlate",copyChinaPlane:!1},r)),this.initSettingsObj={autoRotate:!1},styles[this.options.style](this)}handleSetting(r,d){return D0(this,null,function*(){return yield yn(Rn.prototype,this,"handleSetting").call(this,r,d),r==="autoRotate"&&this.playing&&(d?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),d})}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 D0(this,null,function*(){const[r,d]=yield Promise.all([this.lead.draw("Light",{type:"RectAreaLight",color:"#E0FFFD",width:200,height:200}),this.lead.draw("Light",{type:"RectAreaLight",intensity:3,width:200,height:170})]);r.position.set(0,50,-100),d.position.set(0,0,150),r.object3d.lookAt(0,0,0),d.object3d.lookAt(0,0,0),this.lead.updateBaseObjectKey(r,"RectAreaLight_1"),this.lead.updateBaseObjectKey(d,"RectAreaLight_2")})}getLocationPosition(r,d=0){const[v,C]=r,w=this.getRadius()+d;return i$1(v,C,w)}setAreaMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.areaArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const E=C.object3d,ye=E.material[0].clone();v.color&&ye.color.set(v.color),v.emissive&&(ye.emissive.set(v.emissive),ye.emissiveIntensity=v.emissiveIntensity||1),C.setMaterialList(w,[ye,E.material[1]])}C.useMaterial(w)}}setLineMaterialByProperty(r,d,v){if(!this.map)return;const C=this.map.lineArr.find(w=>w.userData[r]===d);if(C){if(v==="origin"){C.useMaterial("origin");return}const w=JSON.stringify(v);if(!C.materialList[w]){const ye=C.object3d.material.clone();v.color&&ye.color.set(v.color),v.width&&(ye.lineWidth=v.width),C.setMaterialList(w,ye)}C.useMaterial(w)}}addAreaPlaneByProperty(r,d,v){return D0(this,null,function*(){if(!this.map)return;const w=this.map.options.geojson.features.find(E=>E.properties&&E.properties[r]===d);if(w)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[w]},depth:this.options.mapDepth+.3,start:this.options.radius,mats:{topMat:new MeshBasicMaterial(v.area),outLine:new Ie$2(v.line)}})})}getRadius(){const r=this.baseObjectByUuid("earth");return r?r.object3d.geometry.parameters.radius:0}checkBehindEarth(r,d){const v=new Vector3(0,0,0),C=new Vector3(0,0,0),w=this.getRadius(),E=()=>{const ye=r();if(!ye.length)return;this.pencil.controls.getPosition(C,!1);const Le=v.clone().sub(C),Re=Math.sqrt(Math.pow(Le.length(),2)-Math.pow(w,2)),Ne=ye.map(Fe=>Fe.position.clone().sub(C).length()>Re);d(ye,Ne)};E(),this.pencil.controls.addEventListener("update",()=>{E()})}};_0(Rn,"VisName","earth");let index=Rn;const ec=(g,t)=>{const r=stringToUtf8ByteArray(g),d=stringToUtf8ByteArray(t).map(function(v,C){return v^r[Math.floor(C%r.length)]}).join(",");return btoa(d)};function stringToUtf8ByteArray(g){const t=[];let r=0;for(let d=0;d<g.length;d++){let v=g.charCodeAt(d);v<128?t[r++]=v:v<2048?(t[r++]=v>>6|192,t[r++]=v&63|128):(v&64512)==55296&&d+1<g.length&&(g.charCodeAt(d+1)&64512)==56320?(v=65536+((v&1023)<<10)+(g.charCodeAt(++d)&1023),t[r++]=v>>18|240,t[r++]=v>>12&63|128,t[r++]=v>>6&63|128,t[r++]=v&63|128):(t[r++]=v>>12|224,t[r++]=v>>6&63|128,t[r++]=v&63|128)}return t}const png2webp=(g,t=2048)=>new Promise((r,d)=>{const v=document.createElement("img"),C=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",w,!1);const E=document.createElement("canvas");if(E.width=v.naturalWidth,E.height=v.naturalHeight,E.width>t||E.height>t){const Re=Math.min(t/E.width,t/E.height);E.width*=Re,E.height*=Re}E.getContext("2d").drawImage(v,0,0,E.width,E.height);const ye=E.toDataURL("image/webp"),Le=new Image;Le.onload=()=>{r(Le)},Le.src=ye},w=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",w,!1),d(new Error("Image load error"))};v.addEventListener("load",C,!1),v.addEventListener("error",w,!1),v.src=g});let b="/";b==="/"&&(b="");const getMapConfig=(v,...C)=>D0(exports,[v,...C],function*(g,t=b,r,d){if((r==null?void 0:r.style)==="map2CityOnMap")return getMapWithCityConfig(g,t,r,d);if(g===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const w=findAdcodeInfo(g);return extendMapConfig({center:[w.lng,w.lat],adcode:w.adcode},t,r,d)}}),getMapWithCityConfig=(v,...C)=>D0(exports,[v,...C],function*(g,t=b,r,d){const w=findAdcodeInfo(g);return extendMapConfig({center:[w.lng,w.lat],adcode:w.adcode,style:"map2CityOnMap",mapDepth:.004,mergeSide:!0},t,r,d)}),extendMapConfig=(v,...C)=>D0(exports,[v,...C],function*(g,t=b,r,d){var ot,Gt;if(g.adcode===0&&g.adcode===1e5)return bi({},g);const w=g.adcode,E=findAdcodeInfo(w).level==="province",ye=findAdcodeInfo(w).level==="city",Le=(ot=g.fixGeojson)==null?void 0:ot[w],Re=(Gt=g.fixGeojson)==null?void 0:Gt[w+"-lite"];let{res:Ne}=yield jsonFetch(t+`/geojson/${Le||"json"}/${w}.json`);const{res:Fe}=yield jsonFetch(t+`/geojson/${Re||"json-lite"}/${w}.json`),at=Di(bi({},g),{geojsonMap:{[w]:Ne},extrudeLineGeojsonMap:{[w]:Fe},cityBboxMap:{},jsonNameObj:{},depthReference:void 0,__template:r==null?void 0:r.__template});if(g.style==="map2CityOnMap"){if(!E){let ct=findAdcodeInfo(w).parent;for(;findAdcodeInfo(ct).level!=="province";)ct=findAdcodeInfo(ct).parent;const{res:ke}=yield jsonFetch(t+`/geojson/${Le||"json"}/${ct}.json`);Ne=ke}Ne.features.forEach(ct=>{at.jsonNameObj[ct.properties.adcode]=ec(ct.properties.name,`${ct.properties.adcode}`)})}if((r==null?void 0:r.__template)==="7s93q0lma4n9887"&&d){console.log("map",w);const ct=yield png2webp(`/template/7s93q0lma4n9887/${w}.jpg`),ke=yield png2webp(`/template/7s93q0lma4n9887/${w}-自发光.jpg`);d[4]=ct.src,d[5]=ke.src,console.log("替换 map emissiveMap")}if((r==null?void 0:r.__template)==="l7ojr7nqc06u24f"&&d&&ye){const ct=yield png2webp(`/template/l7ojr7nqc06u24f/${w}.jpg`),ke=yield png2webp(`/template/l7ojr7nqc06u24f/${w}-自发光.jpg`);d[5]=ct.src,d[4]=ke.src,console.log("替换 map emissiveMap")}if(g.parentBg){const ct=findAdcodeInfo(w).parent;if(ct!==1e5){const{res:ke}=yield jsonFetch(t+`/geojson/json/${ct}.json`),{res:ht}=yield jsonFetch(t+`/geojson/json-lite/${ct}.json`);at.geojsonMap[ct]=ke,at.extrudeLineGeojsonMap[ct]=ht}}return r&&(at.depthReference=r.depthReference||findAdcodeInfo(r.adcode).b),at}),getCityConfig=(r,...d)=>D0(exports,[r,...d],function*(g,t=b){const v=findAdcodeInfo(g),{name:C}=v;return{center:[v.lng,v.lat],adcode:v.adcode,jsonName:ec(C,`${g}`)}}),removeCameraHistory=g=>g.filter(t=>!(t.objectUuid==="camera"&&["SetPosition","SetTarget"].includes(t.type))),access={set token(g){accessToken.token=g}},VERSION=version;exports.Base=Base;exports.City=City$1;exports.Earth=index;exports.Map=index$1;exports.THREE=THREE;exports.TWEEN=tween_esm;exports.VERSION=VERSION;exports.access=access;exports.animationUtils=animation;exports.getCityConfig=getCityConfig;exports.getMapConfig=getMapConfig;exports.removeCameraHistory=removeCameraHistory;
|
package/dist/index.module.js
CHANGED
|
@@ -88,7 +88,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
|
|
|
88
88
|
).toString(CryptoJS.enc.Utf8), Fe = JSON.parse(Ne), at = Date.now();
|
|
89
89
|
return !Fe.s || Fe.s > at ? (this.token = void 0, "") : Fe.e && Fe.e < at ? (this.token = void 0, "") : (Fe.isValid = Le, Fe);
|
|
90
90
|
}
|
|
91
|
-
}, version = "0.27.
|
|
91
|
+
}, version = "0.27.15";
|
|
92
92
|
/**
|
|
93
93
|
* @license
|
|
94
94
|
* Copyright 2010-2025 Three.js Authors
|
|
@@ -141360,16 +141360,18 @@ const objs$1 = Di(bi({}, objs$3), {
|
|
|
141360
141360
|
r = Fe.x, d = Fe.y, v.set(Ne.x, Ne.y, 0);
|
|
141361
141361
|
}
|
|
141362
141362
|
if (this.options.continentsBg) {
|
|
141363
|
-
this.continentsBg = yield this.lead.draw(
|
|
141363
|
+
if (this.continentsBg = yield this.lead.draw(
|
|
141364
141364
|
"ContinentsBg",
|
|
141365
141365
|
{
|
|
141366
141366
|
depth: this.options.continentsBgDepth,
|
|
141367
141367
|
scale: this.pscale
|
|
141368
141368
|
},
|
|
141369
141369
|
this.group
|
|
141370
|
-
)
|
|
141371
|
-
|
|
141372
|
-
|
|
141370
|
+
), this.options.style !== "map2CityOnMap" && this.options.style !== "map2Base") {
|
|
141371
|
+
const C = this.getLocationPosition([104, 37.5]);
|
|
141372
|
+
this.continentsBg.position.set(...C);
|
|
141373
|
+
}
|
|
141374
|
+
this.continentsBg.position.z = 0.1;
|
|
141373
141375
|
}
|
|
141374
141376
|
if (this.options.bottomPlane) {
|
|
141375
141377
|
const C = yield this.lead.draw(
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.27.
|
|
1
|
+
declare const _default: "0.27.15";
|
|
2
2
|
export default _default;
|