vis-core 0.28.21 → 0.28.22
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 +15 -11
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
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 Kn=Object.defineProperty,Fn=Object.defineProperties;var An=Object.getOwnPropertyDescriptors;var Pn=Object.getOwnPropertySymbols,kn=Object.getPrototypeOf,Hn=Object.prototype.hasOwnProperty,Yn=Object.prototype.propertyIsEnumerable,Bn=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?Kn(g,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):g[t]=r,q0=(g,t)=>{for(var r in t||(t={}))Hn.call(t,r)&&Vn(g,r,t[r]);if(Pn)for(var r of Pn(t))Yn.call(t,r)&&Vn(g,r,t[r]);return g},Ji=(g,t)=>Fn(g,An(t));var C0=(g,t,r)=>Vn(g,typeof t!="symbol"?t+"":t,r);var yn=(g,t,r)=>Bn(kn(g),r,t);var U0=(g,t,r)=>new Promise((m,v)=>{var C=I=>{try{w(r.next(I))}catch(O){v(O)}},_=I=>{try{w(r.throw(I))}catch(O){v(O)}},w=I=>I.done?m(I.value):Promise.resolve(I.value).then(C,_);w((r=r.apply(g,t)).next())}),Dn=function(g,t){this[0]=g,this[1]=t};var En=g=>{var t=g[Ln("asyncIterator")],r=!1,m,v={};return t==null?(t=g[Ln("iterator")](),m=C=>v[C]=_=>t[C](_)):(t=t.call(g),m=C=>v[C]=_=>{if(r){if(r=!1,C==="throw")throw _;return _}return r=!0,{done:!1,value:new Dn(new Promise(w=>{var I=t[C](_);I instanceof Object||Un("Object expected"),w(I)}),1)}}),v[Ln("iterator")]=()=>v,m("next"),"throw"in t?m("throw"):v.throw=C=>{throw C},"return"in t&&m("return"),v},In=(g,t,r)=>(t=g[Ln("asyncIterator")])?t.call(g):(g=g[Ln("iterator")](),t={},r=(m,v)=>(v=g[m])&&(t[m]=C=>new Promise((_,w,I)=>(C=v.call(g,C),I=C.done,Promise.resolve(C.value).then(O=>_({value:O,done:I}),w)))),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(":::"),m=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),v=CryptoJS.enc.Base64.parse(t),C=CryptoJS.enc.Base64.parse(r),_=CryptoJS.lib.WordArray.create(v.words.slice(0,4)),w=CryptoJS.lib.WordArray.create(v.words.slice(4)),I=jsrsasign.KJUR.crypto.Util.hashHex(v.toString(),"sha256"),O=m.verifyWithMessageHashPSS(I,jsrsasign.b64tohex(g),"sha256",32);if(!O)return this.token=void 0,"";const Ne=CryptoJS.AES.decrypt({ciphertext:w},C,{iv:_,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Fe=JSON.parse(Ne),Ae=Date.now();return!Fe.s||Fe.s>Ae?(this.token=void 0,""):Fe.e&&Fe.e<Ae?(this.token=void 0,""):(Fe.isValid=O,Fe)}},version="0.28.
|
|
2
|
+
"use strict";var Kn=Object.defineProperty,Fn=Object.defineProperties;var An=Object.getOwnPropertyDescriptors;var Pn=Object.getOwnPropertySymbols,kn=Object.getPrototypeOf,Hn=Object.prototype.hasOwnProperty,Yn=Object.prototype.propertyIsEnumerable,Bn=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?Kn(g,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):g[t]=r,q0=(g,t)=>{for(var r in t||(t={}))Hn.call(t,r)&&Vn(g,r,t[r]);if(Pn)for(var r of Pn(t))Yn.call(t,r)&&Vn(g,r,t[r]);return g},Ji=(g,t)=>Fn(g,An(t));var C0=(g,t,r)=>Vn(g,typeof t!="symbol"?t+"":t,r);var yn=(g,t,r)=>Bn(kn(g),r,t);var U0=(g,t,r)=>new Promise((m,v)=>{var C=I=>{try{w(r.next(I))}catch(O){v(O)}},_=I=>{try{w(r.throw(I))}catch(O){v(O)}},w=I=>I.done?m(I.value):Promise.resolve(I.value).then(C,_);w((r=r.apply(g,t)).next())}),Dn=function(g,t){this[0]=g,this[1]=t};var En=g=>{var t=g[Ln("asyncIterator")],r=!1,m,v={};return t==null?(t=g[Ln("iterator")](),m=C=>v[C]=_=>t[C](_)):(t=t.call(g),m=C=>v[C]=_=>{if(r){if(r=!1,C==="throw")throw _;return _}return r=!0,{done:!1,value:new Dn(new Promise(w=>{var I=t[C](_);I instanceof Object||Un("Object expected"),w(I)}),1)}}),v[Ln("iterator")]=()=>v,m("next"),"throw"in t?m("throw"):v.throw=C=>{throw C},"return"in t&&m("return"),v},In=(g,t,r)=>(t=g[Ln("asyncIterator")])?t.call(g):(g=g[Ln("iterator")](),t={},r=(m,v)=>(v=g[m])&&(t[m]=C=>new Promise((_,w,I)=>(C=v.call(g,C),I=C.done,Promise.resolve(C.value).then(O=>_({value:O,done:I}),w)))),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(":::"),m=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),v=CryptoJS.enc.Base64.parse(t),C=CryptoJS.enc.Base64.parse(r),_=CryptoJS.lib.WordArray.create(v.words.slice(0,4)),w=CryptoJS.lib.WordArray.create(v.words.slice(4)),I=jsrsasign.KJUR.crypto.Util.hashHex(v.toString(),"sha256"),O=m.verifyWithMessageHashPSS(I,jsrsasign.b64tohex(g),"sha256",32);if(!O)return this.token=void 0,"";const Ne=CryptoJS.AES.decrypt({ciphertext:w},C,{iv:_,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Fe=JSON.parse(Ne),Ae=Date.now();return!Fe.s||Fe.s>Ae?(this.token=void 0,""):Fe.e&&Fe.e<Ae?(this.token=void 0,""):(Fe.isValid=O,Fe)}},version="0.28.22";/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2010-2025 Three.js Authors
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -5148,4 +5148,4 @@ version 0.8.2
|
|
|
5148
5148
|
<div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
|
|
5149
5149
|
${g}
|
|
5150
5150
|
</div>
|
|
5151
|
-
`,t},xn=class xn extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs$1);C0(this,"mapHistory",[]);C0(this,"activePlaneMap",null);C0(this,"isAnimating",!1);C0(this,"parentBg",[]);C0(this,"continentsBg");C0(this,"group");C0(this,"projection");C0(this,"pcenter",[104,37.5]);C0(this,"pscale",5e4/1e3);C0(this,"meters");C0(this,"cityVis",null);C0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});C0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});C0(this,"caId");C0(this,"shadowMapLight");C0(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 m=q0(q0({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let v=q0({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);Object.keys(m).forEach(C=>{C!=="100000"&&/^\d{6}$/.test(C)&&m[+C].features.forEach(w=>{const I=w.properties.adcode;v[I]={type:"FeatureCollection",features:[w]}})}),v=q0(q0({},v),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(Ji(q0({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,topSegments: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,winkel3:!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:!1},r),{geojsonMap:m,extrudeLineGeojsonMap:v})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.winkel3&&(this.options.projectionType="winkel3"),this.options.adcode===0?this.extendsOptions.winkel3=()=>this.options.winkel3:(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.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,m){return U0(this,null,function*(){return yield yn(xn.prototype,this,"handleSetting").call(this,r,m),r==="label"?m===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels()):r==="labelLite"?m===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels()):r==="shadowMap"&&(m===!1?this.shadowMapDisabled():yield this.shadowMapEnabled()),m})}init(){return U0(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.projection=f({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:m,mouseEvent:v})=>{(this.playing||v.metaKey||v.ctrlKey)&&this.handleClick(m)}),this.options.clickOusideBack&&this.lead.handlePick(()=>this.map?[this.map]:[],"downOutside",({mouseEvent:m})=>{(this.playing||m.metaKey||m.ctrlKey)&&this.handleClick()})),yield Promise.all(this.lead.objectsPromise)})}initCityVis(v){return U0(this,arguments,function*(r,m={clip:!1,grey:!1}){var I;(I=this.options.fixCity)!=null&&I[r]&&(r=this.options.fixCity[r]);const C=this.options.center,_=this.options.jsonNameObj[r],w=new City({container:this.container,editor:!1,workerOnce:this.workerOnce});return w.setOptions({container:this.container,center:C,fitTo:!1,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:_,grey:m.grey,greyFull:this.options.greyFull,clip:m.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 w.init(),this.cityVis=w,this.settings.mouseLeft=Gi.SCREEN_PAN,yield this.settings.mouseLeft,this.emit("initCityVis",r),w})}initCityOnMap(r){return U0(this,null,function*(){if(this.getAdcodeShowLevel(r)!=="city"){const C=findAdcodeInfo(r).parent;this.getAdcodeShowLevel(C)==="city"&&(yield this.initCityOnMap(C));return}const m=r===this.mapInfo.adcode||findAdcodeInfo(this.mapInfo.adcode).parent===r||findAdcodeInfo(r).parent===this.mapInfo.adcode,v=yield this.initCityVis(r,{clip:m,grey:!m});if(m){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 U0(this,null,function*(){let r=1e3,m=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},_=this.options.adcode!==1e5;if(_){const Ae=this.mList.getMultiple("parentPlane"),De=findAdcodeInfo(this.options.adcode).parent,xt=findAdcodeInfo(De),je=xt.b,{res:ke}=yield this.getGeojson(De),at=yield this.lead.draw("PlaneMap",q0({key:"bg-100000",geojson:ke,bbox:je,materialOptions:q0({},Ae)},C),this.group);at.object3d.name=xt.name,at.lineArr.forEach(ct=>{ct.object3d.name="线",this.lead.updateBaseObjectKey(ct,"100000line"),this.initBaseObjectUserData(ct)}),at.areaArr.forEach(ct=>{ct.object3d.name="板块",this.lead.updateBaseObjectKey(ct,"100000area")}),at.position.z=-this.options.parentBgDepth,this.parentBg.push(at)}const w=this.mList.getMultiple("worldPlane"),I=this.options.geojsonMap[0],O=findAdcodeInfo(0).b,Pe=yield this.lead.draw("PlaneMap",q0({key:"bg-0",geojson:Ji(q0({},I),{features:[...I.features.filter(Ae=>_?Ae.properties.iso_a3!=="CHN":!0)]}),bbox:O,materialOptions:q0({},w)},C),this.group);Pe.object3d.name="世界",Pe.lineArr.forEach(Ae=>{Ae.object3d.name="线",this.lead.updateBaseObjectKey(Ae,"worldline"),this.initBaseObjectUserData(Ae)}),Pe.areaArr.forEach(Ae=>{Ae.object3d.name="板块",this.lead.updateBaseObjectKey(Ae,"worldarea")}),Pe.position.z=-this.options.parentBgDepth,this.parentBg.push(Pe);const{center:Ne,size:Fe}=Pe.getSize();r=Fe.x,m=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:m,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 U0(this,null,function*(){var m;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,_=this.pencil.cameraTarget;v==null||v.spotLight.position.copy(C),v==null||v.spotLight.target.position.copy(_)}if(this.options.mapBoundary){const v=new Box3().setFromObject((m=this.map)==null?void 0:m.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 U0(this,null,function*(){if(this.options.parentBg){const r=(()=>{const m=new MeshStandardMaterial({name:"世界顶面",emissive:"#081417",color:"#000000"}),v=new MeshBasicMaterial({name:"世界侧面",color:"#051714",side:DoubleSide}),C=new We$1({name:"世界线",color:new Color$1("#50766E"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:m,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(m=>{m.name=m.name.replace("世界","父级")}))}if(this.options.continentsBg){const r=(()=>{const m=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),v=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),C=new We$1({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:m,sideMat:v,lineMat:C}})();this.mList.addMultiple("continents",r)}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var C,_;const m=this.unproject(r,this.mapObj.z+this.mapObj.depth),v=(_=(C=this.projection).invert)==null?void 0:_.call(C,[m.x,-m.y]);console.log("consoleMousePostion.postion",m),console.log("consoleMousePostion.lnglat",v)})}setAreaMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.areaArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#topMat");v!=="origin"&&(w=_.material[0].clone(),v.color&&w.color.set(v.color),v.emissive&&(w.emissive.set(v.emissive),w.emissiveIntensity=v.emissiveIntensity||1)),_.material[0]=w}}setLineMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.lineArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#lineMat");v!=="origin"&&(w=_.material.clone(),v.color&&w.color.set(v.color),v.width&&(w.lineWidth=v.width)),_.material=w}}addAreaPlaneByProperty(r,m,v){return U0(this,null,function*(){if(!this.map)return;const _=this.map.options.geojson.features.find(w=>w.properties&&w.properties[r]===m);if(_){let w=v.material,I=v.sideMaterial;if(f$1(v.sideMaterial)&&(I=new MeshBasicMaterial(q0({},v.sideMaterial))),f$1(v.material)&&(w=new MeshBasicMaterial(q0({},v.material))),v.area){const Ne=this.objectByUuid(v.area);Ne&&([w,I]=Ne.material)}let O=v.lineMaterial;if(f$1(v.lineMaterial)&&(O=new We$1(q0({},v.lineMaterial))),v.line){const Ne=this.objectByUuid(v.line);Ne&&(O=Ne.material)}const Pe=yield this.lead.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[_]},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:w,lineMat:O,sideMat:I},areaGroup:!1},this.group);if(Pe.position.z=this.mapObj.z+this.mapObj.depth+.01,v.lineBloom&&Pe.lineArr.forEach(Ne=>{Ne.enableBloom()}),v.area){Pe.position.z=0;const Ne=this.baseObjectByUuid(v.area);Pe.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);Pe.lineArr.forEach(Fe=>{Ne!=null&&Ne.isBloom&&Fe.enableBloom(),Fe.position.z=Ne.position.z})}return Pe}})}showAction(){return U0(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:m,start:v}=sinusoidalInOut({onUpdate:C=>{if(!this.mapHistory[0]){m();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 U0(this,null,function*(){if(!this.showState)return;const r=this.lead.group;yield sinusoidalInOut({onUpdate:m=>{r.position.z=-this.mapHistory[0].depth*m}}).start(),setTimeout(()=>{yn(xn.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return U0(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 m=yield this.lead.draw("PlaneShadow");this.planeShadow=m})}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 m=this.getAdcodeShowLevel(r);let v=this.options.mapDepth;Array.isArray(v)||(v=new Array(3).fill(v));let C;return m==="country"?C=v[0]:m==="province"?C=v[1]:C=v[2],C}getDepth(r,m){let v=this.getOptionsDepth(r);if(this.options.depthReference){const C=this.options.depthReference,_=findAdcodeInfo(r).b;v=v*this.getReferenceScale(C,_)}else if(this.mapHistory.length){const C=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b,_=this.getReferenceScale(C,m);v=v*_}return v}getReferenceScale(r,m){const v=Math.abs(m[3]-m[1])/Math.abs(r[3]-r[1]),C=Math.abs(m[2]-m[0])/Math.abs(r[2]-r[0]);return Math.max(v,C)}getAdcodeShowLevel(r,m=!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:_}=findAdcodeInfo(r),w=_&&findAdcodeInfo(_).level;return C==="district"&&w==="province"&&m?"city":C}else if(continentsType.find(C=>C.adcode===r))return"continent"}handleClick(r){const{drillDownRestrictions:m}=this.options;this.isAnimating||(r&&r.userData.adcode?this.getAdcodeShowLevel(r.userData.adcode,!1)!==m?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 m=[];let v=r;for(;v&&(m.unshift(v),v!==this.options.adcode);)v=(C=findAdcodeInfo(v))==null?void 0:C.parent;return m}showMap(C){return U0(this,arguments,function*({adcode:r,adcodes:m,duration:v=1e3}){const _=m||this.getAdcodes(r);(yield this.beforeShowMap(_))!==!1&&(this.emit("beforeDrillDown",[..._]),yield this.setAdcode({adcodes:_,duration:v}),this.emit("afterDrillDown",[..._]))})}drawLabels(){return U0(this,null,function*(){var v;const r=this.options.showLabel;if(!((v=this.mapArea)!=null&&v.length)||!r)return;let m=this.lead.getObject("Group",{key:"mapLabel"});m||(m=yield this.lead.draw("Group",{key:"mapLabel"},this.group),m.object3d.name="地图标签组",yield Promise.all(this.mapArea.map(C=>U0(this,null,function*(){let{name:_,adcode:w,centroid:I}=C.userData;const{DistrictID:O,DistName:Pe,iso_a2:Ne,center:Fe}=C.userData;if(w=w||Ne||O,I=I||Fe,_=_||Pe,!I)return;const Ae=this.getLocationPosition(I);if(this.lead.getObject("Node",{key:`mapLabel-${w}`})||!Ae)return;const[De,xt,je]=Ae;let ke=_;r==="lite"&&ke&&(ke=_.replace(/自治州|地区|自治区|省|市|壮族|特别行政区|回族|维吾尔/g,""));const at=ke&&getLabelElement(ke),ct=ke!=null&&ke.startsWith("澳门")?-1:0;yield this.lead.draw("Node",{position:new Vector3(De,xt+ct,je),children:at,key:`$p:-${this.options.adcode===0?_:w}`},m)}))))})}eraseLabels(){const r=this.lead.getObject("Group",{key:"mapLabel"});r==null||r.erase()}geAdcodePosition(r){var v;const m=(v=this.mapArea)==null?void 0:v.find(C=>C.userData.adcode===r);if(m){const{centroid:C,center:_}=m.userData;return this.getLocationPosition(C||_)}}getLocationPosition(r){const[m,v]=r,[C,_]=this.projection([m,v]);return[C,-_,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(r){const m=this.geAdcodePosition(r);if(m){const[v,C,_]=m,w=new Vector3(v,C,_);w.project(this.pencil.camera);const{width:I,height:O}=this.pencil.getSize(),Pe=(w.x*.5+.5)*I,Ne=(w.y*-.5+.5)*O;return{x:Pe,y:Ne}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(m=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(m)))}getGeojson(r,m=!1){return U0(this,null,function*(){var v,C,_,w;return m?this.options.extrudeLine?(_=this.options.extrudeLineGeojsonMap)!=null&&_[r]?{res:(w=this.options.extrudeLineGeojsonMap)==null?void 0:w[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(w){return U0(this,arguments,function*({adcode:r,duration:m,handleLook:v,saveBackCamvasState:C,extrudelineBloom:_}){var I,O,Pe,Ne,Fe;if(typeof r!="undefined"&&!this.isAnimating){const Ae=(I=this.map)==null?void 0:I.findGroup(r,!0),De=findAdcodeInfo(+r);if(this.isAnimating||!De)return;this.isAnimating=!0;const{name:xt}=De;let{res:je}=yield this.getGeojson(r),{res:ke}=yield this.getGeojson(r,!0);if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(je=ke,ke=void 0),[je,ke].filter(Boolean).forEach(ct=>{if(!ct.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const Gt=findAdcodeInfo(r);ct.features[0].properties=Ji(q0(q0({},ct.features[0].properties),Gt),{center:[Gt.lng,Gt.lat]})}}),je){const ct=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if((O=this.options.fixGeojson)!=null&&O[r]){const Yt=(Pe=this.options.fixGeojson)==null?void 0:Pe[r];if(Yt.startsWith("-")){const a0=+Yt.slice(1);je.features=je.features.filter(g0=>g0.properties.adcode!==a0)}}let Gt=findAdcodeInfo(r).b;const Lt=[...Gt];this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Gt=findAdcodeInfo(this.mapInfo.adcode).b:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Gt=findAdcodeInfo(this.mapInfo.adcode).b:Gt=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(Yt=>{Yt.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),C&&this.saveCamvasState("userControls",-1));const Wt=this.mapHistory.length,Pt=Wt-1,zt=this.getDepth(r,Lt),Nt=(Ne=this.mapHistory[Pt])==null?void 0:Ne.depth,Kt=Wt===0||this.options.showOneLevel?0:this.mapHistory[Pt].z+Nt,kt=Wt===0||this.options.showOneLevel?0:Kt-zt,n0=turf.center(je).geometry.coordinates,[r0,l0]=this.projection(n0),s0=yield this.drawPlaneMap({geojson:je,extrudeLineGeojson:ke,depth:zt,bbox:Gt,adcode:r,extrudelineBloom:_});Ae==null||Ae.hide(),s0.position.setZ(kt);const qt=s0.position.z,t0=()=>U0(this,null,function*(){yield sinusoidalInOut({onUpdate:Yt=>{Kt!==qt&&(s0.position.z=qt+(Kt-qt)*Yt)}}).start({duration:m})});if(ct)if(this.fixNear(r),s0.position.z=Kt,v){const Yt=(Fe=this.mapHistory.at(-1))==null?void 0:Fe.controls;yield this.fitTo(s0,{z:Kt+zt,adcode:r,enableTransition:m!==0,polarAngle:Yt==null?void 0:Yt.polarAngle,azimuthAngle:Yt==null?void 0:Yt.azimuthAngle,handleStart:()=>U0(this,null,function*(){s0.position.z=qt,yield t0()})})}else this.options.showOneLevel&&s0.hide();else yield t0();this.mapHistory.push({map:s0,mapInfo:De,z:Kt,depth:zt,cX:r0,cY:-l0}),v&&this.drawLabels(),this.saveCamvasState("controls",-1)}else console.log(`${xt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveCamvasState(r,m){const v=this.mapHistory.at(m);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 m=this.getAdcodeShowLevel(r),v=this.pencil.options;r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(m==="country"||m==="province")&&this.pencil.camera.near!==v.camera.near*10?(this.pencil.camera.near=v.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(m==="city"||m==="district")&&this.pencil.camera.near!==v.camera.near&&(this.pencil.camera.near=v.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(O){return U0(this,arguments,function*(r,{polarAngle:m,azimuthAngle:v,z:C,handleStart:_,adcode:w,enableTransition:I=!0}={}){if(!(r!=null&&r.object3d))return;if(w&&(yield this.useSaveCamera(`map-${w}`,I))){_&&(yield _());return}const Pe=this.options.mapPadding,{height:Ne,width:Fe}=this.pencil.getSize();Ne<Pe[0]+Pe[2]+50&&(Pe[0]=0,Pe[2]=0),Fe<Pe[1]+Pe[3]+50&&(Pe[1]=0,Pe[3]=0);const Ae=m!=null?m:this.options.polarAngle,De=v!=null?v:this.options.azimuthAngle,xt=this.pencil.cameraPositon.toArray(),je=this.pencil.cameraTarget.toArray();yield this.paddingInCssPixel(r,Pe[0],Pe[1],Pe[2],Pe[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(De,Ae,!1),ke=this.pencil.cameraTarget.toArray();const at=this.pencil.cameraPositon.toArray();yield this.lookAt(...xt,...je),yield Promise.all([this.lookAt(...at,...ke,I),_==null?void 0:_()].filter(Boolean))})}drawPlaneMap(I){return U0(this,arguments,function*({geojson:r,extrudeLineGeojson:m,bbox:v,depth:C,extrudelineBloom:_,adcode:w}){var xt;const O=[this.mList.getMultiple("plane"),this.mList.getMultiple("secondPlane"),this.mList.getMultiple("thirdPlane")];let Pe=this.mapHistory.length,Ne=null;for(;Ne===null;)Ne=O[Pe],Pe--;const Fe=this.mList.getMultiple("bgPlane"),Ae=q0(q0({},Ne),Fe?{bgTopMat:Fe.topMat,bgSideMat:Fe.sideMat,bgLineMat:Fe.lineMat,bgExtrudeLineMat:Fe.extrudeLineMat}:{}),De=yield this.lead.draw("PlaneMap",{key:`${w}`,geojson:r,extrudeLineGeojson:m,depth:C,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:Ae,bbox:v,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return De.object3d.name=((xt=findAdcodeInfo(w))==null?void 0:xt.name)||`${w}`,this.options.style==="map2CityOnMap"&&!this.options.showCityOnMapInnerLine&&(Ne.lineMat.colorWrite=!1,De.lineArr.forEach(je=>{je.userData.selectHide=!0})),De.extrudelineArr&&De.extrudelineArr.forEach(je=>{je.object3d.name="板块边线",this.lead.updateBaseObjectKey(je,"extrudeLine"),this.initBaseObjectUserData(je),_&&(je.object3d.userData.bloom=!0)}),De.lineArr&&De.lineArr.forEach(je=>{this.initBaseObjectUserData(je)}),De})}handleBack(){return U0(this,arguments,function*({duration:r=1e3,handleLookBack:m=!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 _=C.map.position.z,w=this.mapObj?this.mapObj.z+(this.mapObj.depth-C.depth):0;yield sinusoidalInOut({onUpdate:I=>{C.map.position.z=_+(w-_)*I}}).start({duration:r})}if(this.lead.eraseWithoutMaterial(C.map),this.eraseLabels(),this.mapObj){const{map:_}=this.mapObj,w=_==null?void 0:_.findGroup(C.mapInfo.adcode,!0);w&&w.show(),_&&m&&(this.options.showOneLevel?_.show():_.active(),this.options.drillDownHideParent&&this.parentBg.forEach(I=>{I.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return U0(this,null,function*(){const{userControls:m,controls:v}=this.mapObj;yield this.pencil.controls.setLookAt(...m?m.lookAt:v.lookAt,r!==0)})}compareLocations(r,m){const v=r.filter(I=>I),C=m.filter(I=>I),_=[];let w=0;for(let I=0;I<Math.min(v.length,C.length)&&v[I]===C[I];I++)w++;for(let I=w;I<v.length;I++)_.push(-1);for(let I=w;I<C.length;I++)_.push(C[I]);return _}setAdcode(v){return U0(this,arguments,function*({adcodes:r,duration:m}){var _,w,I;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:m,handleLook:!0})}catch(Ae){console.error(Ae)}else{const{continent:Ae,country:De,province:xt,city:je,district:ke}=r.reduce((Kt,kt)=>{const n0=this.getAdcodeShowLevel(kt);return Kt[n0]=kt,Kt},{}),{continent:at,country:ct,province:Gt,city:Lt,district:Wt}=C.reduce((Kt,kt)=>{const n0=this.getAdcodeShowLevel(kt);return Kt[n0]=kt,Kt},{}),Pt=Ae||at,zt=(I=(w=(_=this.map)==null?void 0:_.extrudelineArr)==null?void 0:w[0])==null?void 0:I.object3d.userData.bloom,Nt=this.compareLocations([at,ct,Gt,Lt,Wt],[Ae,De,xt,je,ke]);try{for(var O=In(Nt.entries()),Pe,Ne,Fe;Pe=!(Ne=yield O.next()).done;Pe=!1){const[Kt,kt]=Ne.value;const n0=Kt===Nt.length-1?m:0,r0=Kt===Nt.length-1;kt===-1?yield this.handleBack({duration:n0,handleLookBack:r0,keepOne:!Pt}):yield this.handleDrillDown({adcode:kt,duration:n0,handleLook:r0,saveBackCamvasState:Nt.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:zt})}}catch(Ne){Fe=[Ne]}finally{try{Pe&&(Ne=O.return)&&(yield Ne.call(O))}finally{if(Fe)throw Fe[0]}}}})}setPadding(r,m=!1,v=!1){this.options.mapPadding=[...r],m&&this.fitTo(this.map,{enableTransition:v})}dispose(){var r,m,v;(r=this.cityVis)==null||r.dispose(),(m=this.map)==null||m.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()}};C0(xn,"VisName","map");let index$1=xn;class Earth extends Sphere{constructor(r){super();C0(this,"options");this.options=q0({radius:30,rotationY:0},r)}create(){const m=this.pencil.mList.get("earthMaterial");this.material=m,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class Countries extends ht{constructor(r){super();C0(this,"options");C0(this,"areaArr",[]);C0(this,"lineArr",[]);this.options=q0({start:30,depth:1.4,lineOffset:.01,hasTop:!0,hasSide:!0,hasLine:!0,lineDuration:1e3,areaGroup:!0},r)}create(){return U0(this,null,function*(){const{geojson:r,mats:m,hasSide:v,lineOffset:C,areaGroup:_}=this.options;this.createGroup();const w=this.pencil.getPlugin("worker"),I=this.pencil.lead,{borderMat:O,topMat:Pe,outLine:Ne}=m;let Fe=r.features.map(xt=>{const{type:je,coordinates:ke}=xt.geometry;let at=[];return je==="Polygon"?at=ke:je==="MultiPolygon"&&(at=ke.flat()),{coords:at,properties:xt.properties}});const Ae=this.options.hasTop||this.options.hasSide,De=this.options.hasLine;_||(Fe=[{coords:Fe.map(({coords:xt})=>xt).flat(),properties:{}}]),yield Promise.all(Fe.map(xt=>[Ae&&w.geoGeometry("conicPolygon",{mesaage:{start:[this.options.start],depth:[this.options.depth],useGroups:2,hasBottom:!1,topFirst:!0,coordinatesArr:xt.coords,bbox:this.options.bbox,hasSide:v},cb:je=>U0(this,null,function*(){var at,ct;const ke=yield I.draw("ConicPolygon",{geometry:je,material:v?[Pe,O]:Pe,hasSide:v},this);ke.object3d.name=(at=xt.properties)!=null&&at.name?((ct=xt.properties)==null?void 0:ct.name)+"-板块":"板块",ke.userData=q0({},xt.properties),this.areaArr.push(ke)})}),De&&w.geoGeometry("conicLine",{mesaage:{start:[this.options.start+this.options.depth+C],lineWidth:[1],coordinatesArr:xt.coords},cb:je=>U0(this,null,function*(){var at;const ke=yield I.draw("Line",{geometry:je,material:Ne,onTop:2},this);ke.object3d.name=(at=xt.properties)!=null&&at.name?xt.properties.name+"-线":"线",ke.userData=q0({},xt.properties),this.lineArr.push(ke)})})].filter(Boolean)).flat())})}}class SphereShadow extends ht{constructor(r){super();C0(this,"options");this.options=q0({radius:30},r)}create(){return U0(this,null,function*(){const r=new SphereGeometry(this.options.radius,128,90),m=new MeshBasicMaterial;this.createMesh(r,m),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs=Ji(q0({},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 U0(this,null,function*(){const t=this.loader,r=t.getAsset("/image/earth2/basic.jpg"),m=t.getAsset("/image/earth2/NormalMap.jpg"),v=new MeshStandardMaterial({name:"地球材质",map:r,metalness:.1,roughness:.8,normalMap:m,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",v)})},g.initVis=function(){return U0(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=Ji(q0({},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 U0(this,null,function*(){yield this.initLight();const[,t,r,m]=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="中国边界",m.object3d.name="中国",this.map=m,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 U0(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")}),m=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:t.getAsset("/image/earth/chinaBorder.png")}),v=new We$1({name:"中国边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#59C8FF")}),C=new We$1({name:"世界边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#80abaf")}),_=t.getAsset("/image/earth/basic.webp"),w=new MeshStandardMaterial({name:"地球材质",map:_,color:new Color$1(2397309),metalness:.84,roughness:.51}),I=t.getAsset("/image/earth/flyline.png");I.wrapS=RepeatWrapping,I.wrapT=RepeatWrapping,I.repeat.set(.5,.5);const O=new We$1({name:"省份边界",map:I,useMap:1,lineWidth:2,sizeAttenuation:0,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:r,borderMat:m,outLine:O}),this.mList.addMultiple("world",{outLine:C}),this.mList.addMultiple("china",{outLine:v}),this.mList.add("earthMaterial",w)})}},countryPlate=g=>{g.initVis=function(){return U0(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 U0(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")}),m=new We$1({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:m}),this.mList.add("earthMaterial",v)})},g.getLocationPosition=function(t,r=0){const[m,v]=t,C=this.options.mapDepth+this.options.radius+r;return i$2(m,v,C)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),Rn=class Rn extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs);C0(this,"leftTruck",!1);C0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});C0(this,"map");C0(this,"autoRotateSpeed",0)}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(q0({mapDepth:1.4,radius:30,style:"chinaPlate",copyChinaPlane:!1},r)),this.initSettingsObj={autoRotate:!1},styles[this.options.style](this)}handleSetting(r,m){return U0(this,null,function*(){return yield yn(Rn.prototype,this,"handleSetting").call(this,r,m),r==="autoRotate"&&this.playing&&(m?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),m})}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 U0(this,null,function*(){const[r,m]=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),m.position.set(0,0,150),r.object3d.lookAt(0,0,0),m.object3d.lookAt(0,0,0),this.lead.updateBaseObjectKey(r,"RectAreaLight_1"),this.lead.updateBaseObjectKey(m,"RectAreaLight_2")})}getLocationPosition(r,m=0){const[v,C]=r,_=this.getRadius()+m;return i$2(v,C,_)}setAreaMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.areaArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#topMat");v!=="origin"&&(w=_.material[0].clone(),v.color&&w.color.set(v.color),v.emissive&&(w.emissive.set(v.emissive),w.emissiveIntensity=v.emissiveIntensity||1)),_.material[0]=w}}setLineMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.lineArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#outLine");v!=="origin"&&(w=_.material.clone(),v.color&&w.color.set(v.color),v.width&&(w.lineWidth=v.width)),_.material=w}}addAreaPlaneByProperty(r,m,v){return U0(this,null,function*(){if(!this.map)return;const _=this.map.options.geojson.features.find(w=>w.properties&&w.properties[r]===m);if(_)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[_]},depth:this.options.mapDepth+.3,start:this.options.radius,mats:{topMat:new MeshBasicMaterial(v.area),outLine:new We$1(v.line)}})})}getRadius(){const r=this.baseObjectByUuid("earth");return r?r.object3d.geometry.parameters.radius:0}checkBehindEarth(r,m){const v=new Vector3(0,0,0),C=new Vector3(0,0,0),_=this.getRadius(),w=()=>{const I=r();if(!I.length)return;this.pencil.controls.getPosition(C,!1);const O=v.clone().sub(C),Pe=Math.sqrt(Math.pow(O.length(),2)-Math.pow(_,2)),Ne=I.map(Fe=>Fe.position.clone().sub(C).length()>Pe);m(I,Ne)};w(),this.pencil.controls.addEventListener("update",()=>{w()})}};C0(Rn,"VisName","earth");let index=Rn;const png2webp=(g,t=2048)=>new Promise((r,m)=>{const v=document.createElement("img"),C=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",_,!1);const w=document.createElement("canvas");if(w.width=v.naturalWidth,w.height=v.naturalHeight,w.width>t||w.height>t){const Pe=Math.min(t/w.width,t/w.height);w.width*=Pe,w.height*=Pe}w.getContext("2d").drawImage(v,0,0,w.width,w.height);const I=w.toDataURL("image/webp"),O=new Image;O.onload=()=>{r(O)},O.src=I},_=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",_,!1),m(new Error("Image load error"))};v.addEventListener("load",C,!1),v.addEventListener("error",_,!1),v.src=g}),ec=(g,t)=>{const r=stringToUtf8ByteArray(g),m=stringToUtf8ByteArray(t).map(function(v,C){return v^r[Math.floor(C%r.length)]}).join(",");return btoa(m)};function stringToUtf8ByteArray(g){const t=[];let r=0;for(let m=0;m<g.length;m++){let v=g.charCodeAt(m);v<128?t[r++]=v:v<2048?(t[r++]=v>>6|192,t[r++]=v&63|128):(v&64512)==55296&&m+1<g.length&&(g.charCodeAt(m+1)&64512)==56320?(v=65536+((v&1023)<<10)+(g.charCodeAt(++m)&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}let b="/";b==="/"&&(b="");const getMapConfig=(v,...C)=>U0(exports,[v,...C],function*(g,t=b,r,m){if((r==null?void 0:r.style)==="map2CityOnMap")return getMapWithCityConfig(g,t,r,m);if(g===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const _=findAdcodeInfo(g);return extendMapConfig({center:[_.lng,_.lat],adcode:_.adcode},t,r,m)}}),getMapWithCityConfig=(v,...C)=>U0(exports,[v,...C],function*(g,t=b,r,m){const _=findAdcodeInfo(g);return extendMapConfig({center:[_.lng,_.lat],adcode:_.adcode,style:"map2CityOnMap",mapDepth:.004,mergeSide:!0},t,r,m)}),extendMapConfig=(v,...C)=>U0(exports,[v,...C],function*(g,t=b,r,m){var De,xt;if(g.adcode===0&&g.adcode===1e5)return q0({},g);const _=g.adcode,w=findAdcodeInfo(_).level==="province",I=findAdcodeInfo(_).level==="city"||findAdcodeInfo(_).level==="district"&&findAdcodeInfo(findAdcodeInfo(_).parent).level==="province",O=(De=g.fixGeojson)==null?void 0:De[_],Pe=(xt=g.fixGeojson)==null?void 0:xt[_+"-lite"];let{res:Ne}=yield jsonFetch(t+`/geojson/${O||"json"}/${_}.json`);const{res:Fe}=yield jsonFetch(t+`/geojson/${Pe||"json-lite"}/${_}.json`),Ae=Ji(q0({},g),{geojsonMap:{[_]:Ne},extrudeLineGeojsonMap:{[_]:Fe},cityBboxMap:{},jsonNameObj:{},depthReference:void 0,__template:r==null?void 0:r.__template});if(g.style==="map2CityOnMap"){if(!w){let je=findAdcodeInfo(_).parent;for(;findAdcodeInfo(je).level!=="province";)je=findAdcodeInfo(je).parent;const{res:ke}=yield jsonFetch(t+`/geojson/${O||"json"}/${je}.json`);Ne=ke}Ne.features.forEach(je=>{Ae.jsonNameObj[je.properties.adcode]=ec(je.properties.name,`${je.properties.adcode}`)})}if((r==null?void 0:r.__template)==="7s93q0lma4n9887"&&m){console.log("map",_);const je=yield png2webp(`/template/7s93q0lma4n9887/${_}.jpg`),ke=yield png2webp(`/template/7s93q0lma4n9887/${_}-自发光.jpg`);m[4]=je.src,m[5]=ke.src,console.log("替换 map emissiveMap")}if((r==null?void 0:r.__template)==="l7ojr7nqc06u24f"&&m&&I){const je=yield png2webp(`/template/l7ojr7nqc06u24f/${_}.jpg`),ke=yield png2webp(`/template/l7ojr7nqc06u24f/${_}-自发光.jpg`);m[7]=je.src,m[6]=ke.src,console.log("替换 map emissiveMap")}if((r==null?void 0:r.__template)==="2xli7429f48857f"&&m){const je=yield png2webp(`/template/2xli7429f48857f/${_}.jpg`);m[14]=je.src,console.log("替换 emissiveMap")}if(g.parentBg){const je=findAdcodeInfo(_).parent;if(je!==1e5){const{res:ke}=yield jsonFetch(t+`/geojson/json/${je}.json`),{res:at}=yield jsonFetch(t+`/geojson/json-lite/${je}.json`);Ae.geojsonMap[je]=ke,Ae.extrudeLineGeojsonMap[je]=at}}return r&&(Ae.depthReference=r.depthReference||findAdcodeInfo(r.adcode).b),Ae}),getCityConfig=(r,...m)=>U0(exports,[r,...m],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;
|
|
5151
|
+
`,t},xn=class xn extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs$1);C0(this,"mapHistory",[]);C0(this,"activePlaneMap",null);C0(this,"isAnimating",!1);C0(this,"parentBg",[]);C0(this,"continentsBg");C0(this,"group");C0(this,"projection");C0(this,"pcenter",[104,37.5]);C0(this,"pscale",5e4/1e3);C0(this,"meters");C0(this,"cityVis",null);C0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});C0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});C0(this,"caId");C0(this,"shadowMapLight");C0(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 m=q0(q0({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let v=q0({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);Object.keys(m).forEach(C=>{C!=="100000"&&/^\d{6}$/.test(C)&&m[+C].features.forEach(w=>{const I=w.properties.adcode;v[I]={type:"FeatureCollection",features:[w]}})}),v=q0(q0({},v),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(Ji(q0({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,topSegments: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,winkel3:!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:!1},r),{geojsonMap:m,extrudeLineGeojsonMap:v})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.winkel3&&(this.options.projectionType="winkel3"),this.options.adcode===0?this.extendsOptions.winkel3=()=>this.options.winkel3:(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.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,m){return U0(this,null,function*(){return yield yn(xn.prototype,this,"handleSetting").call(this,r,m),r==="label"?m===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels()):r==="labelLite"?m===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels()):r==="shadowMap"&&(m===!1?this.shadowMapDisabled():yield this.shadowMapEnabled()),m})}init(){return U0(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.projection=f({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:m,mouseEvent:v})=>{(this.playing||v.metaKey||v.ctrlKey)&&this.handleClick(m)}),this.options.clickOusideBack&&this.lead.handlePick(()=>this.map?[this.map]:[],"downOutside",({mouseEvent:m})=>{(this.playing||m.metaKey||m.ctrlKey)&&this.handleClick()})),yield Promise.all(this.lead.objectsPromise)})}initCityVis(v){return U0(this,arguments,function*(r,m={clip:!1,grey:!1}){var I;(I=this.options.fixCity)!=null&&I[r]&&(r=this.options.fixCity[r]);const C=this.options.center,_=this.options.jsonNameObj[r],w=new City({container:this.container,editor:!1,workerOnce:this.workerOnce});return w.setOptions({container:this.container,center:C,fitTo:!1,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:_,grey:m.grey,greyFull:this.options.greyFull,clip:m.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 w.init(),this.cityVis=w,this.settings.mouseLeft=Gi.SCREEN_PAN,yield this.settings.mouseLeft,this.emit("initCityVis",r),w})}initCityOnMap(r){return U0(this,null,function*(){if(this.getAdcodeShowLevel(r)!=="city"){const C=findAdcodeInfo(r).parent;this.getAdcodeShowLevel(C)==="city"&&(yield this.initCityOnMap(C));return}const m=r===this.mapInfo.adcode||findAdcodeInfo(this.mapInfo.adcode).parent===r||findAdcodeInfo(r).parent===this.mapInfo.adcode,v=yield this.initCityVis(r,{clip:m,grey:!m});if(m){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 U0(this,null,function*(){let r=1e3,m=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},_=this.options.adcode!==1e5;if(_){const Ae=this.mList.getMultiple("parentPlane"),De=findAdcodeInfo(this.options.adcode).parent,xt=findAdcodeInfo(De),je=xt.b,{res:ke}=yield this.getGeojson(De),at=yield this.lead.draw("PlaneMap",q0({key:"bg-100000",geojson:ke,bbox:je,materialOptions:q0({},Ae)},C),this.group);at.object3d.name=xt.name,at.lineArr.forEach(ct=>{ct.object3d.name="线",this.lead.updateBaseObjectKey(ct,"100000line"),this.initBaseObjectUserData(ct)}),at.areaArr.forEach(ct=>{ct.object3d.name="板块",this.lead.updateBaseObjectKey(ct,"100000area")}),at.position.z=-this.options.parentBgDepth,this.parentBg.push(at)}const w=this.mList.getMultiple("worldPlane"),I=this.options.geojsonMap[0],O=findAdcodeInfo(0).b,Pe=yield this.lead.draw("PlaneMap",q0({key:"bg-0",geojson:Ji(q0({},I),{features:[...I.features.filter(Ae=>_?Ae.properties.iso_a3!=="CHN":!0)]}),bbox:O,materialOptions:q0({},w)},C),this.group);Pe.object3d.name="世界",Pe.lineArr.forEach(Ae=>{Ae.object3d.name="线",this.lead.updateBaseObjectKey(Ae,"worldline"),this.initBaseObjectUserData(Ae)}),Pe.areaArr.forEach(Ae=>{Ae.object3d.name="板块",this.lead.updateBaseObjectKey(Ae,"worldarea")}),Pe.position.z=-this.options.parentBgDepth,this.parentBg.push(Pe);const{center:Ne,size:Fe}=Pe.getSize();r=Fe.x,m=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:m,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 U0(this,null,function*(){var m;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,_=this.pencil.cameraTarget;v==null||v.spotLight.position.copy(C),v==null||v.spotLight.target.position.copy(_)}if(this.options.mapBoundary){const v=new Box3().setFromObject((m=this.map)==null?void 0:m.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 U0(this,null,function*(){if(this.options.parentBg){const r=(()=>{const m=new MeshStandardMaterial({name:"世界顶面",emissive:"#081417",color:"#000000"}),v=new MeshBasicMaterial({name:"世界侧面",color:"#051714",side:DoubleSide}),C=new We$1({name:"世界线",color:new Color$1("#50766E"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:m,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(m=>{m.name=m.name.replace("世界","父级")}))}if(this.options.continentsBg){const r=(()=>{const m=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),v=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),C=new We$1({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:0,lineWidth:this.options.lineWidth});return{topMat:m,sideMat:v,lineMat:C}})();this.mList.addMultiple("continents",r)}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var C,_;const m=this.unproject(r,this.mapObj.z+this.mapObj.depth),v=(_=(C=this.projection).invert)==null?void 0:_.call(C,[m.x,-m.y]);console.log("consoleMousePostion.postion",m),console.log("consoleMousePostion.lnglat",v)})}setAreaMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.areaArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#topMat");v!=="origin"&&(w=_.material[0].clone(),v.color&&w.color.set(v.color),v.emissive&&(w.emissive.set(v.emissive),w.emissiveIntensity=v.emissiveIntensity||1)),_.material[0]=w}}setLineMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.lineArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#lineMat");v!=="origin"&&(w=_.material.clone(),v.color&&w.color.set(v.color),v.width&&(w.lineWidth=v.width)),_.material=w}}addAreaPlaneByProperty(r,m,v){return U0(this,null,function*(){if(!this.map)return;const _=this.map.options.geojson.features.find(w=>w.properties&&w.properties[r]===m);if(_){let w=v.material,I=v.sideMaterial;if(f$1(v.sideMaterial)&&(I=new MeshBasicMaterial(q0({},v.sideMaterial))),f$1(v.material)&&(w=new MeshBasicMaterial(q0({},v.material))),v.area){const Ne=this.objectByUuid(v.area);Ne&&([w,I]=Ne.material)}let O=v.lineMaterial;if(f$1(v.lineMaterial)&&(O=new We$1(q0({},v.lineMaterial))),v.line){const Ne=this.objectByUuid(v.line);Ne&&(O=Ne.material)}const Pe=yield this.lead.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[_]},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:w,lineMat:O,sideMat:I},areaGroup:!1},this.group);if(Pe.position.z=this.mapObj.z+this.mapObj.depth+.01,v.lineBloom&&Pe.lineArr.forEach(Ne=>{Ne.enableBloom()}),v.area){Pe.position.z=0;const Ne=this.baseObjectByUuid(v.area);Pe.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);Pe.lineArr.forEach(Fe=>{Ne!=null&&Ne.isBloom&&Fe.enableBloom(),Fe.position.z=Ne.position.z})}return Pe}})}showAction(){return U0(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:m,start:v}=sinusoidalInOut({onUpdate:C=>{if(!this.mapHistory[0]){m();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 U0(this,null,function*(){if(!this.showState)return;const r=this.lead.group;yield sinusoidalInOut({onUpdate:m=>{r.position.z=-this.mapHistory[0].depth*m}}).start(),setTimeout(()=>{yn(xn.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return U0(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 m=yield this.lead.draw("PlaneShadow");this.planeShadow=m})}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 m=this.getAdcodeShowLevel(r);let v=this.options.mapDepth;Array.isArray(v)||(v=new Array(3).fill(v));let C;return m==="country"?C=v[0]:m==="province"?C=v[1]:C=v[2],C}getDepth(r,m){let v=this.getOptionsDepth(r);if(this.options.depthReference){const C=this.options.depthReference,_=findAdcodeInfo(r).b;v=v*this.getReferenceScale(C,_)}else if(this.mapHistory.length){const C=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b,_=this.getReferenceScale(C,m);v=v*_}return v}getReferenceScale(r,m){const v=Math.abs(m[3]-m[1])/Math.abs(r[3]-r[1]),C=Math.abs(m[2]-m[0])/Math.abs(r[2]-r[0]);return Math.max(v,C)}getAdcodeShowLevel(r,m=!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:_}=findAdcodeInfo(r),w=_&&findAdcodeInfo(_).level;return C==="district"&&w==="province"&&m?"city":C}else if(continentsType.find(C=>C.adcode===r))return"continent"}handleClick(r){const{drillDownRestrictions:m}=this.options;this.isAnimating||(r&&r.userData.adcode?this.getAdcodeShowLevel(r.userData.adcode,!1)!==m?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 m=[];let v=r;for(;v&&(m.unshift(v),v!==this.options.adcode);)v=(C=findAdcodeInfo(v))==null?void 0:C.parent;return m}showMap(C){return U0(this,arguments,function*({adcode:r,adcodes:m,duration:v=1e3}){const _=m||this.getAdcodes(r);(yield this.beforeShowMap(_))!==!1&&(this.emit("beforeDrillDown",[..._]),yield this.setAdcode({adcodes:_,duration:v}),this.emit("afterDrillDown",[..._]))})}drawLabels(){return U0(this,null,function*(){var v;const r=this.options.showLabel;if(!((v=this.mapArea)!=null&&v.length)||!r)return;let m=this.lead.getObject("Group",{key:"mapLabel"});m||(m=yield this.lead.draw("Group",{key:"mapLabel"},this.group),m.object3d.name="地图标签组",yield Promise.all(this.mapArea.map(C=>U0(this,null,function*(){let{name:_,adcode:w,centroid:I}=C.userData;const{DistrictID:O,DistName:Pe,iso_a2:Ne,center:Fe}=C.userData;if(w=w||Ne||O,I=I||Fe,_=_||Pe,!I)return;const Ae=this.getLocationPosition(I);if(this.lead.getObject("Node",{key:`mapLabel-${w}`})||!Ae)return;const[De,xt,je]=Ae;let ke=_;r==="lite"&&ke&&(ke=_.replace(/自治州|地区|自治区|省|市|壮族|特别行政区|回族|维吾尔/g,""));const at=ke&&getLabelElement(ke),ct=ke!=null&&ke.startsWith("澳门")?-1:0;yield this.lead.draw("Node",{position:new Vector3(De,xt+ct,je),children:at,key:`$p:-${this.options.adcode===0?_:w}`},m)}))))})}eraseLabels(){const r=this.lead.getObject("Group",{key:"mapLabel"});r==null||r.erase()}geAdcodePosition(r){var v;const m=(v=this.mapArea)==null?void 0:v.find(C=>C.userData.adcode===r);if(m){const{centroid:C,center:_}=m.userData;return this.getLocationPosition(C||_)}}getLocationPosition(r){const[m,v]=r,[C,_]=this.projection([m,v]);return[C,-_,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(r){const m=this.geAdcodePosition(r);if(m){const[v,C,_]=m,w=new Vector3(v,C,_);w.project(this.pencil.camera);const{width:I,height:O}=this.pencil.getSize(),Pe=(w.x*.5+.5)*I,Ne=(w.y*-.5+.5)*O;return{x:Pe,y:Ne}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(m=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(m)))}getGeojson(r,m=!1){return U0(this,null,function*(){var v,C,_,w;return m?this.options.extrudeLine?(_=this.options.extrudeLineGeojsonMap)!=null&&_[r]?{res:(w=this.options.extrudeLineGeojsonMap)==null?void 0:w[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(w){return U0(this,arguments,function*({adcode:r,duration:m,handleLook:v,saveBackCamvasState:C,extrudelineBloom:_}){var I,O,Pe,Ne,Fe;if(typeof r!="undefined"&&!this.isAnimating){const Ae=(I=this.map)==null?void 0:I.findGroup(r,!0),De=findAdcodeInfo(+r);if(this.isAnimating||!De)return;this.isAnimating=!0;const{name:xt}=De;let{res:je}=yield this.getGeojson(r),{res:ke}=yield this.getGeojson(r,!0);if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(je=ke,ke=void 0),[je,ke].filter(Boolean).forEach(ct=>{if(!ct.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const Gt=findAdcodeInfo(r);ct.features[0].properties=Ji(q0(q0({},ct.features[0].properties),Gt),{center:[Gt.lng,Gt.lat]})}}),je){const ct=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if((O=this.options.fixGeojson)!=null&&O[r]){const Yt=(Pe=this.options.fixGeojson)==null?void 0:Pe[r];if(Yt.startsWith("-")){const a0=+Yt.slice(1);je.features=je.features.filter(g0=>g0.properties.adcode!==a0)}}let Gt=findAdcodeInfo(r).b;const Lt=[...Gt];this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Gt=findAdcodeInfo(this.mapInfo.adcode).b:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Gt=findAdcodeInfo(this.mapInfo.adcode).b:Gt=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(Yt=>{Yt.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),C&&this.saveCamvasState("userControls",-1));const Wt=this.mapHistory.length,Pt=Wt-1,zt=this.getDepth(r,Lt),Nt=(Ne=this.mapHistory[Pt])==null?void 0:Ne.depth,Kt=Wt===0||this.options.showOneLevel?0:this.mapHistory[Pt].z+Nt,kt=Wt===0||this.options.showOneLevel?0:Kt-zt,n0=turf.center(je).geometry.coordinates,[r0,l0]=this.projection(n0),s0=yield this.drawPlaneMap({geojson:je,extrudeLineGeojson:ke,depth:zt,bbox:Gt,adcode:r,extrudelineBloom:_});Ae==null||Ae.hide(),s0.position.setZ(kt);const qt=s0.position.z,t0=()=>U0(this,null,function*(){yield sinusoidalInOut({onUpdate:Yt=>{Kt!==qt&&(s0.position.z=qt+(Kt-qt)*Yt)}}).start({duration:m})});if(ct)if(this.fixNear(r),s0.position.z=Kt,v){const Yt=(Fe=this.mapHistory.at(-1))==null?void 0:Fe.controls;yield this.fitTo(s0,{z:Kt+zt,adcode:r,enableTransition:m!==0,polarAngle:Yt==null?void 0:Yt.polarAngle,azimuthAngle:Yt==null?void 0:Yt.azimuthAngle,handleStart:()=>U0(this,null,function*(){s0.position.z=qt,yield t0()})})}else this.options.showOneLevel&&s0.hide();else yield t0();this.mapHistory.push({map:s0,mapInfo:De,z:Kt,depth:zt,cX:r0,cY:-l0}),v&&this.drawLabels(),this.saveCamvasState("controls",-1)}else console.log(`${xt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveCamvasState(r,m){const v=this.mapHistory.at(m);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 m=this.getAdcodeShowLevel(r),v=this.pencil.options;r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(m==="country"||m==="province")&&this.pencil.camera.near!==v.camera.near*10?(this.pencil.camera.near=v.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(m==="city"||m==="district")&&this.pencil.camera.near!==v.camera.near&&(this.pencil.camera.near=v.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(O){return U0(this,arguments,function*(r,{polarAngle:m,azimuthAngle:v,z:C,handleStart:_,adcode:w,enableTransition:I=!0}={}){if(!(r!=null&&r.object3d))return;if(w&&(yield this.useSaveCamera(`map-${w}`,I))){_&&(yield _());return}const Pe=this.options.mapPadding,{height:Ne,width:Fe}=this.pencil.getSize();Ne<Pe[0]+Pe[2]+50&&(Pe[0]=0,Pe[2]=0),Fe<Pe[1]+Pe[3]+50&&(Pe[1]=0,Pe[3]=0);const Ae=m!=null?m:this.options.polarAngle,De=v!=null?v:this.options.azimuthAngle,xt=this.pencil.cameraPositon.toArray(),je=this.pencil.cameraTarget.toArray();yield this.paddingInCssPixel(r,Pe[0],Pe[1],Pe[2],Pe[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(De,Ae,!1),ke=this.pencil.cameraTarget.toArray();const at=this.pencil.cameraPositon.toArray();yield this.lookAt(...xt,...je),yield Promise.all([this.lookAt(...at,...ke,I),_==null?void 0:_()].filter(Boolean))})}drawPlaneMap(I){return U0(this,arguments,function*({geojson:r,extrudeLineGeojson:m,bbox:v,depth:C,extrudelineBloom:_,adcode:w}){var xt;const O=[this.mList.getMultiple("plane"),this.mList.getMultiple("secondPlane"),this.mList.getMultiple("thirdPlane")];let Pe=this.mapHistory.length,Ne=null;for(;Ne===null;)Ne=O[Pe],Pe--;const Fe=this.mList.getMultiple("bgPlane"),Ae=q0(q0({},Ne),Fe?{bgTopMat:Fe.topMat,bgSideMat:Fe.sideMat,bgLineMat:Fe.lineMat,bgExtrudeLineMat:Fe.extrudeLineMat}:{}),De=yield this.lead.draw("PlaneMap",{key:`${w}`,geojson:r,extrudeLineGeojson:m,depth:C,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:Ae,bbox:v,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return De.object3d.name=((xt=findAdcodeInfo(w))==null?void 0:xt.name)||`${w}`,this.options.style==="map2CityOnMap"&&!this.options.showCityOnMapInnerLine&&(Ne.lineMat.colorWrite=!1,De.lineArr.forEach(je=>{je.userData.selectHide=!0})),De.extrudelineArr&&De.extrudelineArr.forEach(je=>{je.object3d.name="板块边线",this.lead.updateBaseObjectKey(je,"extrudeLine"),this.initBaseObjectUserData(je),_&&(je.object3d.userData.bloom=!0)}),De.lineArr&&De.lineArr.forEach(je=>{this.initBaseObjectUserData(je)}),De})}handleBack(){return U0(this,arguments,function*({duration:r=1e3,handleLookBack:m=!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 _=C.map.position.z,w=this.mapObj?this.mapObj.z+(this.mapObj.depth-C.depth):0;yield sinusoidalInOut({onUpdate:I=>{C.map.position.z=_+(w-_)*I}}).start({duration:r})}if(this.lead.eraseWithoutMaterial(C.map),this.eraseLabels(),this.mapObj){const{map:_}=this.mapObj,w=_==null?void 0:_.findGroup(C.mapInfo.adcode,!0);w&&w.show(),_&&m&&(this.options.showOneLevel?_.show():_.active(),this.options.drillDownHideParent&&this.parentBg.forEach(I=>{I.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return U0(this,null,function*(){const{userControls:m,controls:v}=this.mapObj;yield this.pencil.controls.setLookAt(...m?m.lookAt:v.lookAt,r!==0)})}compareLocations(r,m){const v=r.filter(I=>I),C=m.filter(I=>I),_=[];let w=0;for(let I=0;I<Math.min(v.length,C.length)&&v[I]===C[I];I++)w++;for(let I=w;I<v.length;I++)_.push(-1);for(let I=w;I<C.length;I++)_.push(C[I]);return _}setAdcode(v){return U0(this,arguments,function*({adcodes:r,duration:m}){var _,w,I;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:m,handleLook:!0})}catch(Ae){console.error(Ae)}else{const{continent:Ae,country:De,province:xt,city:je,district:ke}=r.reduce((Kt,kt)=>{const n0=this.getAdcodeShowLevel(kt);return Kt[n0]=kt,Kt},{}),{continent:at,country:ct,province:Gt,city:Lt,district:Wt}=C.reduce((Kt,kt)=>{const n0=this.getAdcodeShowLevel(kt);return Kt[n0]=kt,Kt},{}),Pt=Ae||at,zt=(I=(w=(_=this.map)==null?void 0:_.extrudelineArr)==null?void 0:w[0])==null?void 0:I.object3d.userData.bloom,Nt=this.compareLocations([at,ct,Gt,Lt,Wt],[Ae,De,xt,je,ke]);try{for(var O=In(Nt.entries()),Pe,Ne,Fe;Pe=!(Ne=yield O.next()).done;Pe=!1){const[Kt,kt]=Ne.value;const n0=Kt===Nt.length-1?m:0,r0=Kt===Nt.length-1;kt===-1?yield this.handleBack({duration:n0,handleLookBack:r0,keepOne:!Pt}):yield this.handleDrillDown({adcode:kt,duration:n0,handleLook:r0,saveBackCamvasState:Nt.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:zt})}}catch(Ne){Fe=[Ne]}finally{try{Pe&&(Ne=O.return)&&(yield Ne.call(O))}finally{if(Fe)throw Fe[0]}}}})}setPadding(r,m=!1,v=!1){this.options.mapPadding=[...r],m&&this.fitTo(this.map,{enableTransition:v})}dispose(){var r,m,v;(r=this.cityVis)==null||r.dispose(),(m=this.map)==null||m.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()}};C0(xn,"VisName","map");let index$1=xn;class Earth extends Sphere{constructor(r){super();C0(this,"options");this.options=q0({radius:30,rotationY:0},r)}create(){const m=this.pencil.mList.get("earthMaterial");this.material=m,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class Countries extends ht{constructor(r){super();C0(this,"options");C0(this,"areaArr",[]);C0(this,"lineArr",[]);this.options=q0({start:30,depth:1.4,lineOffset:.01,hasTop:!0,hasSide:!0,hasLine:!0,lineDuration:1e3,areaGroup:!0},r)}create(){return U0(this,null,function*(){const{geojson:r,mats:m,hasSide:v,lineOffset:C,areaGroup:_}=this.options;this.createGroup();const w=this.pencil.getPlugin("worker"),I=this.pencil.lead,{borderMat:O,topMat:Pe,outLine:Ne}=m;let Fe=r.features.map(xt=>{const{type:je,coordinates:ke}=xt.geometry;let at=[];return je==="Polygon"?at=ke:je==="MultiPolygon"&&(at=ke.flat()),{coords:at,properties:xt.properties}});const Ae=this.options.hasTop||this.options.hasSide,De=this.options.hasLine;_||(Fe=[{coords:Fe.map(({coords:xt})=>xt).flat(),properties:{}}]),yield Promise.all(Fe.map(xt=>[Ae&&w.geoGeometry("conicPolygon",{mesaage:{start:[this.options.start],depth:[this.options.depth],useGroups:2,hasBottom:!1,topFirst:!0,coordinatesArr:xt.coords,bbox:this.options.bbox,hasSide:v},cb:je=>U0(this,null,function*(){var at,ct;const ke=yield I.draw("ConicPolygon",{geometry:je,material:v?[Pe,O]:Pe,hasSide:v},this);ke.object3d.name=(at=xt.properties)!=null&&at.name?((ct=xt.properties)==null?void 0:ct.name)+"-板块":"板块",ke.userData=q0({},xt.properties),this.areaArr.push(ke)})}),De&&w.geoGeometry("conicLine",{mesaage:{start:[this.options.start+this.options.depth+C],lineWidth:[1],coordinatesArr:xt.coords},cb:je=>U0(this,null,function*(){var at;const ke=yield I.draw("Line",{geometry:je,material:Ne,onTop:2},this);ke.object3d.name=(at=xt.properties)!=null&&at.name?xt.properties.name+"-线":"线",ke.userData=q0({},xt.properties),this.lineArr.push(ke)})})].filter(Boolean)).flat())})}}class SphereShadow extends ht{constructor(r){super();C0(this,"options");this.options=q0({radius:30},r)}create(){return U0(this,null,function*(){const r=new SphereGeometry(this.options.radius,128,90),m=new MeshBasicMaterial;this.createMesh(r,m),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs=Ji(q0({},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 U0(this,null,function*(){const t=this.loader,r=t.getAsset("/image/earth2/basic.jpg"),m=t.getAsset("/image/earth2/NormalMap.jpg"),v=new MeshStandardMaterial({name:"地球材质",map:r,metalness:.1,roughness:.8,normalMap:m,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",v)})},g.initVis=function(){return U0(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=Ji(q0({},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 U0(this,null,function*(){yield this.initLight();const[,t,r,m]=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="中国边界",m.object3d.name="中国",this.map=m,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 U0(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")}),m=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:t.getAsset("/image/earth/chinaBorder.png")}),v=new We$1({name:"中国边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#59C8FF")}),C=new We$1({name:"世界边界",lineWidth:2,sizeAttenuation:0,color:new Color$1("#80abaf")}),_=t.getAsset("/image/earth/basic.webp"),w=new MeshStandardMaterial({name:"地球材质",map:_,color:new Color$1(2397309),metalness:.84,roughness:.51}),I=t.getAsset("/image/earth/flyline.png");I.wrapS=RepeatWrapping,I.wrapT=RepeatWrapping,I.repeat.set(.5,.5);const O=new We$1({name:"省份边界",map:I,useMap:1,lineWidth:2,sizeAttenuation:0,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:r,borderMat:m,outLine:O}),this.mList.addMultiple("world",{outLine:C}),this.mList.addMultiple("china",{outLine:v}),this.mList.add("earthMaterial",w)})}},countryPlate=g=>{g.initVis=function(){return U0(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 U0(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")}),m=new We$1({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:m}),this.mList.add("earthMaterial",v)})},g.getLocationPosition=function(t,r=0){const[m,v]=t,C=this.options.mapDepth+this.options.radius+r;return i$2(m,v,C)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),Rn=class Rn extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs);C0(this,"leftTruck",!1);C0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});C0(this,"map");C0(this,"autoRotateSpeed",0)}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(q0({mapDepth:1.4,radius:30,style:"chinaPlate",copyChinaPlane:!1},r)),this.initSettingsObj={autoRotate:!1},styles[this.options.style](this)}handleSetting(r,m){return U0(this,null,function*(){return yield yn(Rn.prototype,this,"handleSetting").call(this,r,m),r==="autoRotate"&&this.playing&&(m?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),m})}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 U0(this,null,function*(){const[r,m]=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),m.position.set(0,0,150),r.object3d.lookAt(0,0,0),m.object3d.lookAt(0,0,0),this.lead.updateBaseObjectKey(r,"RectAreaLight_1"),this.lead.updateBaseObjectKey(m,"RectAreaLight_2")})}getLocationPosition(r,m=0){const[v,C]=r,_=this.getRadius()+m;return i$2(v,C,_)}setAreaMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.areaArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#topMat");v!=="origin"&&(w=_.material[0].clone(),v.color&&w.color.set(v.color),v.emissive&&(w.emissive.set(v.emissive),w.emissiveIntensity=v.emissiveIntensity||1)),_.material[0]=w}}setLineMaterialByProperty(r,m,v){if(!this.map)return;const C=this.map.lineArr.find(_=>_.userData[r]===m);if(C){const _=C.object3d;let w=this.mList.get("plane#outLine");v!=="origin"&&(w=_.material.clone(),v.color&&w.color.set(v.color),v.width&&(w.lineWidth=v.width)),_.material=w}}addAreaPlaneByProperty(r,m,v){return U0(this,null,function*(){if(!this.map)return;const _=this.map.options.geojson.features.find(w=>w.properties&&w.properties[r]===m);if(_)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[_]},depth:this.options.mapDepth+.3,start:this.options.radius,mats:{topMat:new MeshBasicMaterial(v.area),outLine:new We$1(v.line)}})})}getRadius(){const r=this.baseObjectByUuid("earth");return r?r.object3d.geometry.parameters.radius:0}checkBehindEarth(r,m){const v=new Vector3(0,0,0),C=new Vector3(0,0,0),_=this.getRadius(),w=()=>{const I=r();if(!I.length)return;this.pencil.controls.getPosition(C,!1);const O=v.clone().sub(C),Pe=Math.sqrt(Math.pow(O.length(),2)-Math.pow(_,2)),Ne=I.map(Fe=>Fe.position.clone().sub(C).length()>Pe);m(I,Ne)};w(),this.pencil.controls.addEventListener("update",()=>{w()})}};C0(Rn,"VisName","earth");let index=Rn;const png2webp=(g,t=2048)=>new Promise((r,m)=>{const v=document.createElement("img"),C=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",_,!1);const w=document.createElement("canvas");if(w.width=v.naturalWidth,w.height=v.naturalHeight,w.width>t||w.height>t){const Pe=Math.min(t/w.width,t/w.height);w.width*=Pe,w.height*=Pe}w.getContext("2d").drawImage(v,0,0,w.width,w.height);const I=w.toDataURL("image/webp"),O=new Image;O.onload=()=>{r(O)},O.src=I},_=()=>{v.removeEventListener("load",C,!1),v.removeEventListener("error",_,!1),m(new Error("Image load error"))};v.addEventListener("load",C,!1),v.addEventListener("error",_,!1),v.src=g}),ec=(g,t)=>{const r=stringToUtf8ByteArray(g),m=stringToUtf8ByteArray(t).map(function(v,C){return v^r[Math.floor(C%r.length)]}).join(",");return btoa(m)};function stringToUtf8ByteArray(g){const t=[];let r=0;for(let m=0;m<g.length;m++){let v=g.charCodeAt(m);v<128?t[r++]=v:v<2048?(t[r++]=v>>6|192,t[r++]=v&63|128):(v&64512)==55296&&m+1<g.length&&(g.charCodeAt(m+1)&64512)==56320?(v=65536+((v&1023)<<10)+(g.charCodeAt(++m)&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}let b="/";b==="/"&&(b="");const getMapConfig=(v,...C)=>U0(exports,[v,...C],function*(g,t=b,r,m){if((r==null?void 0:r.style)==="map2CityOnMap")return getMapWithCityConfig(g,t,r,m);if(g===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const _=findAdcodeInfo(g);return extendMapConfig({center:[_.lng,_.lat],adcode:_.adcode},t,r,m)}}),getMapWithCityConfig=(v,...C)=>U0(exports,[v,...C],function*(g,t=b,r,m){const _=findAdcodeInfo(g);return extendMapConfig({center:[_.lng,_.lat],adcode:_.adcode,style:"map2CityOnMap",mapDepth:.004,mergeSide:!0},t,r,m)}),extendMapConfig=(v,...C)=>U0(exports,[v,...C],function*(g,t=b,r,m){var De,xt;if(g.adcode===0&&g.adcode===1e5)return q0({},g);const _=g.adcode,w=findAdcodeInfo(_).level==="province",I=findAdcodeInfo(_).level==="city"||findAdcodeInfo(_).level==="district"&&findAdcodeInfo(findAdcodeInfo(_).parent).level==="province",O=(De=g.fixGeojson)==null?void 0:De[_],Pe=(xt=g.fixGeojson)==null?void 0:xt[_+"-lite"];let{res:Ne}=yield jsonFetch(`${t}/geojson/${O||"json"}/${_}.json`);const{res:Fe}=yield jsonFetch(`${t}/geojson/${Pe||"json-lite"}/${_}.json`),Ae=Ji(q0({},g),{geojsonMap:{[_]:Ne},extrudeLineGeojsonMap:{[_]:Fe},cityBboxMap:{},jsonNameObj:{},depthReference:void 0,__template:r==null?void 0:r.__template});if(g.style==="map2CityOnMap"){if(!w){let je=findAdcodeInfo(_).parent;for(;findAdcodeInfo(je).level!=="province";)je=findAdcodeInfo(je).parent;const{res:ke}=yield jsonFetch(`${t}/geojson/${O||"json"}/${je}.json`);Ne=ke}Ne.features.forEach(je=>{Ae.jsonNameObj[je.properties.adcode]=ec(je.properties.name,`${je.properties.adcode}`)})}if((r==null?void 0:r.__template)==="7s93q0lma4n9887"&&m){console.log("map",_);const je=yield png2webp(`${t}/template/7s93q0lma4n9887/${_}.jpg`),ke=yield png2webp(`${t}/template/7s93q0lma4n9887/${_}-自发光.jpg`);m[4]=je.src,m[5]=ke.src,console.log("替换 map emissiveMap")}if((r==null?void 0:r.__template)==="l7ojr7nqc06u24f"&&m&&I){const je=yield png2webp(`${t}/template/l7ojr7nqc06u24f/${_}.jpg`),ke=yield png2webp(`${t}/template/l7ojr7nqc06u24f/${_}-自发光.jpg`);m[7]=je.src,m[6]=ke.src,console.log("替换 map emissiveMap")}if((r==null?void 0:r.__template)==="2xli7429f48857f"&&m){const je=yield png2webp(`${t}/template/2xli7429f48857f/${_}.jpg`);m[14]=je.src,console.log("替换 emissiveMap")}if(g.parentBg){const je=findAdcodeInfo(_).parent;if(je!==1e5){const{res:ke}=yield jsonFetch(`${t}/geojson/json/${je}.json`),{res:at}=yield jsonFetch(`${t}/geojson/json-lite/${je}.json`);Ae.geojsonMap[je]=ke,Ae.extrudeLineGeojsonMap[je]=at}}return r&&(Ae.depthReference=r.depthReference||findAdcodeInfo(r.adcode).b),Ae}),getCityConfig=(r,...m)=>U0(exports,[r,...m],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), Ae = Date.now();
|
|
89
89
|
return !Fe.s || Fe.s > Ae ? (this.token = void 0, "") : Fe.e && Fe.e < Ae ? (this.token = void 0, "") : (Fe.isValid = O, Fe);
|
|
90
90
|
}
|
|
91
|
-
}, version = "0.28.
|
|
91
|
+
}, version = "0.28.22";
|
|
92
92
|
/**
|
|
93
93
|
* @license
|
|
94
94
|
* Copyright 2010-2025 Three.js Authors
|
|
@@ -143318,10 +143318,10 @@ const getMapConfig = (v, ...C) => B0(void 0, [v, ...C], function* (g, t = b, r,
|
|
|
143318
143318
|
return q0({}, g);
|
|
143319
143319
|
const _ = g.adcode, w = findAdcodeInfo(_).level === "province", I = findAdcodeInfo(_).level === "city" || findAdcodeInfo(_).level === "district" && findAdcodeInfo(findAdcodeInfo(_).parent).level === "province", O = (De = g.fixGeojson) == null ? void 0 : De[_], Pe = (xt = g.fixGeojson) == null ? void 0 : xt[_ + "-lite"];
|
|
143320
143320
|
let { res: Ne } = yield jsonFetch(
|
|
143321
|
-
t
|
|
143321
|
+
`${t}/geojson/${O || "json"}/${_}.json`
|
|
143322
143322
|
);
|
|
143323
143323
|
const { res: Fe } = yield jsonFetch(
|
|
143324
|
-
t
|
|
143324
|
+
`${t}/geojson/${Pe || "json-lite"}/${_}.json`
|
|
143325
143325
|
), Ae = Ji(q0({}, g), {
|
|
143326
143326
|
geojsonMap: {
|
|
143327
143327
|
[_]: Ne
|
|
@@ -143340,7 +143340,7 @@ const getMapConfig = (v, ...C) => B0(void 0, [v, ...C], function* (g, t = b, r,
|
|
|
143340
143340
|
for (; findAdcodeInfo(je).level !== "province"; )
|
|
143341
143341
|
je = findAdcodeInfo(je).parent;
|
|
143342
143342
|
const { res: ke } = yield jsonFetch(
|
|
143343
|
-
t
|
|
143343
|
+
`${t}/geojson/${O || "json"}/${je}.json`
|
|
143344
143344
|
);
|
|
143345
143345
|
Ne = ke;
|
|
143346
143346
|
}
|
|
@@ -143353,20 +143353,24 @@ const getMapConfig = (v, ...C) => B0(void 0, [v, ...C], function* (g, t = b, r,
|
|
|
143353
143353
|
}
|
|
143354
143354
|
if ((r == null ? void 0 : r.__template) === "7s93q0lma4n9887" && m) {
|
|
143355
143355
|
console.log("map", _);
|
|
143356
|
-
const je = yield png2webp(
|
|
143357
|
-
|
|
143356
|
+
const je = yield png2webp(
|
|
143357
|
+
`${t}/template/7s93q0lma4n9887/${_}.jpg`
|
|
143358
|
+
), ke = yield png2webp(
|
|
143359
|
+
`${t}/template/7s93q0lma4n9887/${_}-自发光.jpg`
|
|
143358
143360
|
);
|
|
143359
143361
|
m[4] = je.src, m[5] = ke.src, console.log("替换 map emissiveMap");
|
|
143360
143362
|
}
|
|
143361
143363
|
if ((r == null ? void 0 : r.__template) === "l7ojr7nqc06u24f" && m && I) {
|
|
143362
|
-
const je = yield png2webp(
|
|
143363
|
-
|
|
143364
|
+
const je = yield png2webp(
|
|
143365
|
+
`${t}/template/l7ojr7nqc06u24f/${_}.jpg`
|
|
143366
|
+
), ke = yield png2webp(
|
|
143367
|
+
`${t}/template/l7ojr7nqc06u24f/${_}-自发光.jpg`
|
|
143364
143368
|
);
|
|
143365
143369
|
m[7] = je.src, m[6] = ke.src, console.log("替换 map emissiveMap");
|
|
143366
143370
|
}
|
|
143367
143371
|
if ((r == null ? void 0 : r.__template) === "2xli7429f48857f" && m) {
|
|
143368
143372
|
const je = yield png2webp(
|
|
143369
|
-
|
|
143373
|
+
`${t}/template/2xli7429f48857f/${_}.jpg`
|
|
143370
143374
|
);
|
|
143371
143375
|
m[14] = je.src, console.log("替换 emissiveMap");
|
|
143372
143376
|
}
|
|
@@ -143374,9 +143378,9 @@ const getMapConfig = (v, ...C) => B0(void 0, [v, ...C], function* (g, t = b, r,
|
|
|
143374
143378
|
const je = findAdcodeInfo(_).parent;
|
|
143375
143379
|
if (je !== 1e5) {
|
|
143376
143380
|
const { res: ke } = yield jsonFetch(
|
|
143377
|
-
t
|
|
143381
|
+
`${t}/geojson/json/${je}.json`
|
|
143378
143382
|
), { res: at } = yield jsonFetch(
|
|
143379
|
-
t
|
|
143383
|
+
`${t}/geojson/json-lite/${je}.json`
|
|
143380
143384
|
);
|
|
143381
143385
|
Ae.geojsonMap[je] = ke, Ae.extrudeLineGeojsonMap[je] = at;
|
|
143382
143386
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.28.
|
|
1
|
+
declare const _default: "0.28.22";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vis-core",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.22",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "npm run version && PORT=5173 bundler-dev",
|
|
6
|
-
"build:site": "npm run version && bundler",
|
|
6
|
+
"build:site": "npm run version && PUBLIC_EXCLUDE=true bundler",
|
|
7
7
|
"build:lib": "npm run version && PUBLIC_EXCLUDE=true BUILD_LIBRARY=src/sdk/index.ts CSS_EXTRACT=false bundler && npm run build:type",
|
|
8
8
|
"build:type": "BUILD_LIBRARY=src/sdk/index.ts bundler-type",
|
|
9
9
|
"preview": "bundler-preview",
|