vis-core 0.21.65 → 0.21.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8,4 +8,4 @@ export * from './getVisConfig';
8
8
  export declare const access: {
9
9
  token: string;
10
10
  };
11
- export declare const VERSION = "0.21.65";
11
+ export declare const VERSION = "0.21.66";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document!="undefined"){var t=document.createElement("style");t.appendChild(document.createTextNode(".-translate-x-1\\/2,.-translate-y-1\\/2{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1 }.shadow{--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.ring{--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.invert,.filter{--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: }.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.left-1\\/2{left:50%}.top-1\\/2{top:50%}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.whitespace-nowrap{white-space:nowrap}.text-center{text-align:center}.text-xs{font-size:12px;line-height:16px}.leading-\\[1\\]{line-height:1}.text-\\[\\#809083\\]{--tw-text-opacity: 1;color:rgb(128 144 131 / var(--tw-text-opacity))}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- "use strict";var Tn=Object.defineProperty,Mn=Object.defineProperties;var Nn=Object.getOwnPropertyDescriptors;var Cn=Object.getOwnPropertySymbols,Fn=Object.getPrototypeOf,Hn=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,Jn=Reflect.get;var Gn=(c,e)=>(e=Symbol[c])?e:Symbol.for("Symbol."+c),wn=c=>{throw TypeError(c)},on=Math.pow,Sn=(c,e,s)=>e in c?Tn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[e]=s,di=(c,e)=>{for(var s in e||(e={}))Hn.call(e,s)&&Sn(c,s,e[s]);if(Cn)for(var s of Cn(e))kn.call(e,s)&&Sn(c,s,e[s]);return c},Ui=(c,e)=>Mn(c,Nn(e));var H0=(c,e,s)=>Sn(c,typeof e!="symbol"?e+"":e,s);var rn=(c,e,s)=>Jn(Fn(c),s,e);var ti=(c,e,s)=>new Promise((r,f)=>{var st=Wt=>{try{Zt(s.next(Wt))}catch(Yt){f(Yt)}},ct=Wt=>{try{Zt(s.throw(Wt))}catch(Yt){f(Yt)}},Zt=Wt=>Wt.done?r(Wt.value):Promise.resolve(Wt.value).then(st,ct);Zt((s=s.apply(c,e)).next())}),Kn=function(c,e){this[0]=c,this[1]=e};var Ln=c=>{var e=c[Gn("asyncIterator")],s=!1,r,f={};return e==null?(e=c[Gn("iterator")](),r=st=>f[st]=ct=>e[st](ct)):(e=e.call(c),r=st=>f[st]=ct=>{if(s){if(s=!1,st==="throw")throw ct;return ct}return s=!0,{done:!1,value:new Kn(new Promise(Zt=>{var Wt=e[st](ct);Wt instanceof Object||wn("Object expected"),Zt(Wt)}),1)}}),f[Gn("iterator")]=()=>f,r("next"),"throw"in e?r("throw"):f.throw=st=>{throw st},"return"in e&&r("return"),f},Yn=(c,e,s)=>(e=c[Gn("asyncIterator")])?e.call(c):(c=c[Gn("iterator")](),e={},s=(r,f)=>(f=c[r])&&(e[r]=st=>new Promise((ct,Zt,Wt)=>(st=f.call(c,st),Wt=st.done,Promise.resolve(st.value).then(Yt=>ct({value:Yt,done:Wt}),Zt)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),lodashEs=require("lodash-es"),turf=require("@turf/turf"),json100000=require("geojson-cn/extra/100000-lite-next.json"),countries=require("geojson-cn/extra/countries-next.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn"),chinaJson=require("geojson-cn/extra/100000-next.json");Array.prototype.at||(Array.prototype.at=function(c){return c<0&&(c=this.length+c),this[c]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[c,e,s]=this.token.split(":::"),r=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),f=CryptoJS.enc.Base64.parse(e),st=CryptoJS.enc.Base64.parse(s),ct=CryptoJS.lib.WordArray.create(f.words.slice(0,4)),Zt=CryptoJS.lib.WordArray.create(f.words.slice(4)),Wt=jsrsasign.KJUR.crypto.Util.hashHex(f.toString(),"sha256"),Yt=r.verifyWithMessageHashPSS(Wt,jsrsasign.b64tohex(c),"sha256",32);if(!Yt)return this.token=void 0,"";const Tt=CryptoJS.AES.decrypt({ciphertext:Zt},st,{iv:ct,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Jt=JSON.parse(Tt),$t=Date.now();return!Jt.s||Jt.s>$t?(this.token=void 0,""):Jt.e&&Jt.e<$t?(this.token=void 0,""):(Jt.isValid=Yt,Jt)}},version="0.21.65";/**
2
+ "use strict";var Tn=Object.defineProperty,Mn=Object.defineProperties;var Nn=Object.getOwnPropertyDescriptors;var Cn=Object.getOwnPropertySymbols,Fn=Object.getPrototypeOf,Hn=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,Jn=Reflect.get;var Gn=(c,e)=>(e=Symbol[c])?e:Symbol.for("Symbol."+c),wn=c=>{throw TypeError(c)},on=Math.pow,Sn=(c,e,s)=>e in c?Tn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[e]=s,di=(c,e)=>{for(var s in e||(e={}))Hn.call(e,s)&&Sn(c,s,e[s]);if(Cn)for(var s of Cn(e))kn.call(e,s)&&Sn(c,s,e[s]);return c},Ui=(c,e)=>Mn(c,Nn(e));var H0=(c,e,s)=>Sn(c,typeof e!="symbol"?e+"":e,s);var rn=(c,e,s)=>Jn(Fn(c),s,e);var ti=(c,e,s)=>new Promise((r,f)=>{var st=Wt=>{try{Zt(s.next(Wt))}catch(Yt){f(Yt)}},ct=Wt=>{try{Zt(s.throw(Wt))}catch(Yt){f(Yt)}},Zt=Wt=>Wt.done?r(Wt.value):Promise.resolve(Wt.value).then(st,ct);Zt((s=s.apply(c,e)).next())}),Kn=function(c,e){this[0]=c,this[1]=e};var Ln=c=>{var e=c[Gn("asyncIterator")],s=!1,r,f={};return e==null?(e=c[Gn("iterator")](),r=st=>f[st]=ct=>e[st](ct)):(e=e.call(c),r=st=>f[st]=ct=>{if(s){if(s=!1,st==="throw")throw ct;return ct}return s=!0,{done:!1,value:new Kn(new Promise(Zt=>{var Wt=e[st](ct);Wt instanceof Object||wn("Object expected"),Zt(Wt)}),1)}}),f[Gn("iterator")]=()=>f,r("next"),"throw"in e?r("throw"):f.throw=st=>{throw st},"return"in e&&r("return"),f},Yn=(c,e,s)=>(e=c[Gn("asyncIterator")])?e.call(c):(c=c[Gn("iterator")](),e={},s=(r,f)=>(f=c[r])&&(e[r]=st=>new Promise((ct,Zt,Wt)=>(st=f.call(c,st),Wt=st.done,Promise.resolve(st.value).then(Yt=>ct({value:Yt,done:Wt}),Zt)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),lodashEs=require("lodash-es"),turf=require("@turf/turf"),json100000=require("geojson-cn/extra/100000-lite-next.json"),countries=require("geojson-cn/extra/countries-next.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn"),chinaJson=require("geojson-cn/extra/100000-next.json");Array.prototype.at||(Array.prototype.at=function(c){return c<0&&(c=this.length+c),this[c]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[c,e,s]=this.token.split(":::"),r=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),f=CryptoJS.enc.Base64.parse(e),st=CryptoJS.enc.Base64.parse(s),ct=CryptoJS.lib.WordArray.create(f.words.slice(0,4)),Zt=CryptoJS.lib.WordArray.create(f.words.slice(4)),Wt=jsrsasign.KJUR.crypto.Util.hashHex(f.toString(),"sha256"),Yt=r.verifyWithMessageHashPSS(Wt,jsrsasign.b64tohex(c),"sha256",32);if(!Yt)return this.token=void 0,"";const Tt=CryptoJS.AES.decrypt({ciphertext:Zt},st,{iv:ct,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Jt=JSON.parse(Tt),$t=Date.now();return!Jt.s||Jt.s>$t?(this.token=void 0,""):Jt.e&&Jt.e<$t?(this.token=void 0,""):(Jt.isValid=Yt,Jt)}},version="0.21.66";/**
3
3
  * @license
4
4
  * Copyright 2010-2024 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
@@ -5328,7 +5328,7 @@ version 0.8.2
5328
5328
  gl_FragColor = vec4(ccccc, alpha * 0.65);
5329
5329
 
5330
5330
 
5331
- `)},Zt.needsUpdate=!0)}}setAreaEmissiveByProperty(s,r,f,st=1){if(!this.map)return;const ct=this.map.areaArr.find(Zt=>Zt.userData[s]===r);ct&&this.map.setAreaEmissive(ct,f,st)}setLineColorByProperty(s,r,f){if(!this.map)return;const st=this.map.lineArr.find(ct=>ct.userData[s]===r);st&&this.map.setLineColor(st,f)}setLineWidthByProperty(s,r,f){if(!this.map)return;const st=this.map.lineArr.find(ct=>ct.userData[s]===r);st&&this.map.setLineWidth(st,f)}addAreaPlaneByProperty(st,ct){return ti(this,arguments,function*(s,r,f={}){var Yt,vt;if(!this.map)return;const Wt=this.map.options.geojson.features.find(Tt=>Tt.properties&&Tt.properties[s]===r);if(Wt){const Tt=(Yt=f.uid)!=null?Yt:"";let Jt=!1;if(this.mList.objectList.forEach((Ke,de)=>{if(Ke.key==="planeCopyExtrudePolygon"+Tt){console.warn("已经存在复制面",Tt),Jt=!0;return}}),Jt)return;let $t;f.material?n$1(f.material)?$t=new MeshBasicMaterial(di({},f.material)):$t=f.material:$t=new MeshBasicMaterial({color:"red"});let Xe;f.lineMaterial?n$1(f.lineMaterial)?Xe=new it$1(di({},f.lineMaterial)):Xe=f.lineMaterial:Xe=new it$1({color:new Color$1("blue"),sizeAttenuation:0,lineWidth:this.options.lineWidth});const Qe=yield this.map.addPlane(Wt,{material:$t,lineMaterial:Xe,topSegments:(vt=f.topSegments)!=null?vt:0});return Qe.children.forEach(Ke=>{Ke instanceof je?(Ke.object3d.name="复制面"+Tt,this.mList.setObject3d(Ke.object3d,"planeCopyExtrudePolygon"+Tt,{baseObject:Ke})):Ke instanceof Ge&&(Ke.object3d.name="复制线"+Tt,this.mList.setObject3d(Ke.object3d,"planeCopyLine"+Tt,{baseObject:Ke}))}),Qe}})}show(){return ti(this,null,function*(){if(this.showState||this.options.disableInitShow)return;rn(un.prototype,this,"show").call(this);const s=this.drawController.group;this.mapHistory[0]&&(yield sinusoidalInOut({onUpdate:r=>{s.position.z=-this.mapHistory[0].depth*(1-r)}}).start()),this.handlePickTest()})}handlePickTest(){return ti(this,null,function*(){var s;this.playing||(s=this.mapArea)==null||s.forEach(r=>{r.onPointerEvent("down",f=>ti(this,null,function*(){var Wt,Yt,vt;(Yt=(Wt=this.pencil)==null?void 0:Wt.helperController)==null||Yt.removeAllExcludeScene(),(vt=this.pencil.helperController)==null||vt.add(f.object3d),this.caId=f.userData.ISO_A2||f.userData.adcode;const st=this.mapLine.find(Tt=>Tt.userData.ISO_A2===this.caId||Tt.userData.adcode===this.caId),Zt=f.object3d.material[0].color.getHexString();this.settings["测试板块颜色.color:::caId"]="#"+Zt,yield this.settings["测试板块颜色.color:::caId"],this.settings["测试边框颜色.color:::caId"]="#"+(st==null?void 0:st.material.color.getHexString()),yield this.settings["测试边框颜色.color:::caId"],this.settings["测试边框宽度:::caId"]=st==null?void 0:st.material.lineWidth,yield this.settings["测试边框宽度:::caId"],this.emit("settingsChanged")}))})})}hide(){return ti(this,null,function*(){if(!this.showState)return;const s=this.drawController.group;yield sinusoidalInOut({onUpdate:r=>{s.position.z=-this.mapHistory[0].depth*r}}).start(),setTimeout(()=>{rn(un.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return ti(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const s=yield this.drawController.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0}),r=s.object3d;this.mList.changeObject3dKey(r,"Shadow$1"),this.mList.changeObject3dKey(r.target,"Shadow$1"),this.shadowMapLight=s,s.object3d.position.set(.281,32.487,43.077),s.object3d.castShadow=!0;const f=yield this.drawController.draw("PlaneShadow");this.mList.setObject3d(f.object3d,"PlaneShadow",{baseObject:f}),this.planeShadow=f})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.mList.delObject3d(this.shadowMapLight.object3d),this.shadowMapLight=void 0),this.planeShadow&&(this.mList.delObject3d(this.planeShadow.object3d),this.planeShadow.erase(),this.planeShadow=void 0))}getDepth(s,r){const f=this.getAdcodeShowLevel(s);let st=this.options.mapDepth;Array.isArray(st)||(st=new Array(3).fill(st));let ct;if(f==="country"?ct=st[0]:f==="province"?ct=st[1]:ct=st[2],this.options.depthReference&&this.options.bboxMap[s]){const Zt=this.options.depthReference,Wt=this.options.bboxMap[s];ct=ct*this.getReferenceScale(Zt,Wt)}else if(this.mapHistory.length&&this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]){const Zt=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode],Wt=turf.bbox(r),Yt=this.getReferenceScale(Zt,Wt);ct=ct*Yt}return ct}getReferenceScale(s,r){const f=Math.abs(r[3]-r[1])/Math.abs(s[3]-s[1]),st=Math.abs(r[2]-r[0])/Math.abs(s[2]-s[0]);return Math.max(f,st)}getAdcodeShowLevel(s){var r;if((r=this.options.fixCity)!=null&&r[s]&&(s=this.options.fixCity[s]),s===0)return"world";if(s===1e5)return"country";{const{level:f,parent:st}=geojsonCn.adcodeMap[s],ct=st&&geojsonCn.adcodeMap[st].level;return f==="district"&&ct==="province"?"city":f}}handleClick(s){var st;const{drillDownRestrictions:r}=this.options;if(this.isAnimating)return;const f=(st=this.map)==null?void 0:st.pickArea(s);if(f&&f.userData.adcode&&this.getAdcodeShowLevel(f.userData.adcode)!==r)this.clickArea({adcodes:[...this.adcodes,f.userData.adcode]});else if(this.options.clickOusideBack&&!f&&this.mapHistory.length>1){const ct=[...this.adcodes];ct.pop(),this.clickArea({adcodes:ct})}}beforeClickArea(s){return!0}clickArea(f){return ti(this,arguments,function*({adcodes:s,duration:r=1e3}){(yield this.beforeClickArea(s))!==!1&&(this.emit("beforeDrillDown",s),yield this.setAdcode({adcodes:s,duration:r}),this.emit("afterDrillDown",s))})}drawLabels(){return ti(this,null,function*(){var f;const s=this.options.showLabel;!((f=this.mapArea)!=null&&f.length)||!s||this.drawController.getAllObject("Node",{key:"mapLabel"}).length||(yield Promise.all(this.mapArea.map(st=>ti(this,null,function*(){let{name:ct,adcode:Zt}=st.userData;const{DistrictID:Wt,DistName:Yt,NAME_CN:vt,CENTROID:Tt}=st.userData;Zt=Zt||Wt,ct=this.options.adcode===0?vt:ct||Yt;const Jt=this.options.adcode===0?this.getLocationPosition([...Tt]):this.geAdcodePosition(Zt);if(this.drawController.getObject("Node",{key:`mapLabel-${Zt}`})||!Jt)return;const[$t,Xe,Qe]=Jt;let Ke=ct;s==="lite"&&Ke&&(Ke=ct.replace("自治州","").replace("地区","").replace("自治区","").replace("省","").replace("市","").replace("壮族","").replace("特别行政区","").replace("回族","").replace("维吾尔",""));const de=Ke&&getLabelElement(Ke),Je=Ke!=null&&Ke.startsWith("澳门")?-1:0;yield this.drawController.draw("Node",{position:new Vector3($t,Xe+Je,Qe),children:de,key:`mapLabel#${this.options.adcode===0?ct:Zt}`})}))))})}eraseLabels(){const s=this.drawController.getAllObject("Node",{key:"mapLabel"});this.drawController.erase(...s)}geAdcodePosition(s){const r=this.centroidObj[s];if(r){const[f,st]=r;return this.getLocationPosition([f,st])}}getLocationPosition(s){const[r,f]=s,[st,ct]=this.projection([r,f]);return[st,-ct,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(s){const r=this.geAdcodePosition(s);if(r){const[f,st,ct]=r,Zt=new Vector3(f,st,ct);Zt.project(this.pencil.camera);const{width:Wt,height:Yt}=this.pencil.getSize(),vt=(Zt.x*.5+.5)*Wt,Tt=(Zt.y*-.5+.5)*Yt;return{x:vt,y:Tt}}}booleanPointInCn(s){return json100000.features[0].geometry.coordinates.some(r=>turf.booleanPointInPolygon(turf.point(s),turf.polygon(r)))}handleDrillDown(st){return ti(this,arguments,function*({adcode:s,duration:r,saveBackCamvasState:f}){var ct,Zt,Wt,Yt,vt,Tt,Jt,$t;if(typeof s!="undefined"&&!this.isAnimating){const Xe=(ct=this.map)==null?void 0:ct.findGroup(s),Qe=geojsonCn.findLevelJsonItem(+s)||s===0;if(this.isAnimating||!Qe)return;this.isAnimating=!0;const{name:Ke}=Qe;let{res:de}=(Zt=this.options.geojsonMap)!=null&&Zt[s]?{res:(Wt=this.options.geojsonMap)==null?void 0:Wt[s]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${s}.json`),{res:Je}=this.options.extrudeLine?(Yt=this.options.extrudeLineGeojsonMap)!=null&&Yt[s]?{res:(vt=this.options.extrudeLineGeojsonMap)==null?void 0:vt[s]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${s}.json`):{res:void 0};if(!this.options.showDistrict&&this.getAdcodeShowLevel(s)==="city"&&(de=Je,Je=void 0),[de,Je].filter(Boolean).forEach($e=>{if(!$e.features[0].properties.adcode&&s!==0){const qe=geojsonCn.adcodeMap[s];$e.features[0].properties=Ui(di(di({},$e.features[0].properties),qe),{center:[qe.lng,qe.lat]})}}),de){const $e=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if($e&&this.fixNear(s),(Tt=this.options.fixGeojson)!=null&&Tt[s]){const d0=(Jt=this.options.fixGeojson)==null?void 0:Jt[s];if(d0.startsWith("-")){const o0=+d0.slice(1);de.features=de.features.filter(b0=>b0.properties.adcode!==o0)}}const qe=this.options.bboxMap[s]||Object.values(this.options.bboxMap).pop();de.features.forEach(d0=>{d0.properties.adcode&&(this.centroidObj[d0.properties.adcode]=d0.properties.centroid||d0.properties.center)}),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(d0=>{d0.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),(f!=null?f:this.options.handleBackKeepCamvasState)&&this.saveBackCamvasState(-1));const t0=this.mapHistory.length,e0=t0-1,i0=this.getDepth(s,Je||de),n0=($t=this.mapHistory[e0])==null?void 0:$t.depth,s0=t0===0?0:this.mapHistory[e0].z+(this.options.showOneLevel?0:n0),a0=t0===0?0:s0-i0,h0=turf.center(de).geometry.coordinates,[m0,V0]=this.projection(h0),u0=yield this.drawPlaneMap({geojson:de,extrudeLineGeojson:Je,depth:i0,bbox:qe,adcode:s});u0.position.setZ(a0),this.mapHistory.push({map:u0,mapInfo:Qe,z:s0,depth:i0,cX:m0,cY:-V0});const r0=u0.position.z;$e&&(u0.position.z=s0,this.fitTo(u0,{enableTransition:r!==0}),u0.position.z=r0),Xe==null||Xe.hide(),this.map&&t0!==0&&(r?yield sinusoidalInOut({onUpdate:d0=>{this.map.position.z=r0+(s0-r0)*d0}}).start({duration:r}):this.map.position.z=s0),this.drawLabels()}else console.log(`${Ke}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:s,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveBackCamvasState(s){const r=this.mapHistory.at(s);r&&(r.cameraPositon=this.pencil.cameraPositon.clone(),r.cameraTarget=this.pencil.cameraTarget.clone())}fixNear(s){const r=this.getAdcodeShowLevel(s);s===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(r==="country"||r==="province")&&this.pencil.camera.near!==this.pencilConfig.camera.near*10?(this.pencil.camera.near=this.pencilConfig.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(r==="city"||r==="district")&&this.pencil.camera.near!==this.pencilConfig.camera.near&&(this.pencil.camera.near=this.pencilConfig.camera.near,this.pencil.camera.updateProjectionMatrix())}absoluteAngle(s,r){const f=Math.PI*2,st=s-r;return MathUtils.euclideanModulo(st+Math.PI,f)-Math.PI}fitTo(ct){return ti(this,arguments,function*(s,{polarAngle:r,azimuthAngle:f,enableTransition:st=!0}={}){var Qe,Ke,de;if(!(s!=null&&s.object3d))return;const Zt=(Ke=this.options.lookAtMap)==null?void 0:Ke[(Qe=this.mapInfo)==null?void 0:Qe.adcode];if(Zt){const[Je,_e,$e,qe,t0,e0]=Zt;yield(de=this.pencil.controls)==null?void 0:de.setLookAt(Je,_e,$e,qe,t0,e0,st);return}const Wt=this.options.mapPadding,{height:Yt,width:vt}=this.pencil.getSize();Yt<Wt[0]+Wt[2]+100&&(Wt[0]=0,Wt[2]=0),vt<Wt[1]+Wt[3]+100&&(Wt[1]=0,Wt[3]=0);const Tt=r||this.options.polarAngle,Jt=f||this.options.azimuthAngle,$t=this.pencil.controls.azimuthAngle,Xe=this.pencil.controls.polarAngle;yield Promise.all([this.paddingInCssPixel(s,Wt[0],Wt[1],Wt[2],Wt[3],st),this.pencil.controls.rotateTo($t+this.absoluteAngle(Jt,$t),Xe+this.absoluteAngle(Tt,Xe),st)])})}paddingInCssPixel(s,r,f,st,ct,Zt){const{camera:Wt,controls:Yt}=this.pencil,vt=Wt.fov*MathUtils.DEG2RAD,Tt=this.pencil.getSize().height,{size:Jt}=s.getSize(),$t=Jt.x,Xe=Jt.y,Qe=Jt.z;let Ke=Yt.getDistanceToFitBox($t,Xe,Qe),de=0,Je=0,_e=0,$e=0;for(let qe=0;qe<10;qe++){const t0=Ke-Qe*.5,e0=2*Math.tan(vt*.5)*Math.abs(t0)/Tt;de=r*e0,Je=st*e0,_e=ct*e0,$e=f*e0,Ke=Yt.getDistanceToFitBox($t+_e+$e,Xe+de+Je,Qe)}return Yt.fitToBox(s.object3d,Zt,{paddingLeft:_e,paddingRight:$e,paddingBottom:Je,paddingTop:de})}drawPlaneMap(Zt){return ti(this,arguments,function*({geojson:s,extrudeLineGeojson:r,bbox:f,depth:st,adcode:ct}){const Wt=this.mList.getMaterialObj("plane"),Yt=di({},Wt),vt=yield this.drawController.draw("PlaneMap",{geojson:s,extrudeLineGeojson:r,depth:st,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:Yt,bbox:f,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return vt.extrudelineArr&&vt.extrudelineArr.forEach(Tt=>{Tt.object3d.name="板块边线",this.mList.setObject3d(Tt.object3d,"extrudeLine",{baseObject:Tt}),this.initBaseObjectUserData(Tt)}),this.mList.setObject3d(vt.object3d,ct===1e5?"chinaGroup":"planeMapGroup",{baseObject:vt}),vt})}handleBack(){return ti(this,arguments,function*({duration:s=1e3,handleLookBack:r=!0}={}){if(this.mapHistory.length>1&&!this.isAnimating){this.isAnimating=!0;const f=this.mapHistory.pop();if(f!=null&&f.map){if(!this.options.drillDownPlateInCenter){const Zt=f.map.position.z,Wt=this.mapObj.z+(this.mapObj.depth-f.depth);yield sinusoidalInOut({onUpdate:Yt=>{f.map.position.z=Zt+(Wt-Zt)*Yt}}).start({duration:s})}this.drawController.eraseWithoutMaterial(f.map)}const{map:st}=this.mapObj,ct=st==null?void 0:st.findGroup(f==null?void 0:f.mapInfo.adcode);ct&&ct.show(),st&&(this.eraseLabels(),this.options.showOneLevel?st.show():st.active(),this.options.drillDownHideParent&&this.parentBg.forEach(Zt=>{Zt.show()}),r&&(yield this.handleLookBack(s),this.drawLabels())),this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1}})}handleLookBack(s){return ti(this,null,function*(){var ct;const{map:r,cameraPositon:f,cameraTarget:st}=this.mapObj;f&&st?yield(ct=this.pencil.controls)==null?void 0:ct.setLookAt(f.x,f.y,f.z,st.x,st.y,st.z,s!==0):yield this.fitTo(r,{enableTransition:s!==0})})}compareLocations(s,r){const f=s.filter(Wt=>Wt),st=r.filter(Wt=>Wt),ct=[];let Zt=0;for(let Wt=0;Wt<Math.min(f.length,st.length)&&f[Wt]===st[Wt];Wt++)Zt++;for(let Wt=Zt;Wt<f.length;Wt++)ct.push(-1);for(let Wt=Zt;Wt<st.length;Wt++)ct.push(st[Wt]);return ct}setAdcode(f){return ti(this,arguments,function*({adcodes:s,duration:r}){const{adcodes:st}=this;if(!(JSON.stringify(s)===JSON.stringify(st)||this.isAnimating))if(JSON.stringify(s)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:r})}catch(vt){console.error(vt)}else{const{country:vt,province:Tt,city:Jt}=s.reduce((de,Je)=>{const _e=this.getAdcodeShowLevel(Je);return de[_e]=Je,de},{}),{country:$t,province:Xe,city:Qe}=st.reduce((de,Je)=>{const _e=this.getAdcodeShowLevel(Je);return de[_e]=Je,de},{}),Ke=this.compareLocations([$t,Xe,Qe],[vt,Tt,Jt]);try{for(var ct=Yn(Ke.entries()),Zt,Wt,Yt;Zt=!(Wt=yield ct.next()).done;Zt=!1){const[de,Je]=Wt.value;const _e=de===Ke.length-1?r:0;Je===-1?yield this.handleBack({duration:_e,handleLookBack:!!_e}):yield this.handleDrillDown({adcode:Je,duration:_e,saveBackCamvasState:Ke.includes(-1)?!1:this.options.handleBackKeepCamvasState})}}catch(Wt){Yt=[Wt]}finally{try{Zt&&(Wt=ct.return)&&(yield Wt.call(ct))}finally{if(Yt)throw Yt[0]}}}})}setPadding(s,r=!1){this.options.mapPadding=s,r&&this.fitTo(this.map)}dispose(){var s,r;(s=this.map)==null||s.dispose(),this.parentBg.forEach(f=>{f.dispose()}),this.parentBg.length=0,(r=this.continentsBg)==null||r.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,this.centroidObj={},super.dispose()}};H0(un,"VisName","map");let Map$2=un;const PENCIL_CONFIG$3={camera:{near:.01,far:100,fov:45,up:new Vector3(0,0,1)}};class Reflector extends Mesh{constructor(e,s={}){super(e),this.isReflector=!0,this.type="Reflector",this.camera=new PerspectiveCamera;const r=this,f=s.color!==void 0?new Color$1(s.color):new Color$1(8355711),st=s.textureWidth||512,ct=s.textureHeight||512,Zt=s.clipBias||0,Wt=s.shader||Reflector.ReflectorShader,Yt=s.multisample!==void 0?s.multisample:4,vt=new Plane$1,Tt=new Vector3,Jt=new Vector3,$t=new Vector3,Xe=new Matrix4,Qe=new Vector3(0,0,-1),Ke=new Vector4,de=new Vector3,Je=new Vector3,_e=new Vector4,$e=new Matrix4,qe=this.camera,t0=new WebGLRenderTarget(st,ct,{samples:Yt,type:HalfFloatType}),e0=new ShaderMaterial({name:Wt.name!==void 0?Wt.name:"unspecified",uniforms:UniformsUtils.clone(Wt.uniforms),fragmentShader:Wt.fragmentShader,vertexShader:Wt.vertexShader});e0.uniforms.tDiffuse.value=t0.texture,e0.uniforms.color.value=f,e0.uniforms.textureMatrix.value=$e,this.material=e0,this.onBeforeRender=function(i0,n0,s0){if(Jt.setFromMatrixPosition(r.matrixWorld),$t.setFromMatrixPosition(s0.matrixWorld),Xe.extractRotation(r.matrixWorld),Tt.set(0,0,1),Tt.applyMatrix4(Xe),de.subVectors(Jt,$t),de.dot(Tt)>0)return;de.reflect(Tt).negate(),de.add(Jt),Xe.extractRotation(s0.matrixWorld),Qe.set(0,0,-1),Qe.applyMatrix4(Xe),Qe.add($t),Je.subVectors(Jt,Qe),Je.reflect(Tt).negate(),Je.add(Jt),qe.position.copy(de),qe.up.set(0,1,0),qe.up.applyMatrix4(Xe),qe.up.reflect(Tt),qe.lookAt(Je),qe.far=s0.far,qe.updateMatrixWorld(),qe.projectionMatrix.copy(s0.projectionMatrix),$e.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),$e.multiply(qe.projectionMatrix),$e.multiply(qe.matrixWorldInverse),$e.multiply(r.matrixWorld),vt.setFromNormalAndCoplanarPoint(Tt,Jt),vt.applyMatrix4(qe.matrixWorldInverse),Ke.set(vt.normal.x,vt.normal.y,vt.normal.z,vt.constant);const a0=qe.projectionMatrix;_e.x=(Math.sign(Ke.x)+a0.elements[8])/a0.elements[0],_e.y=(Math.sign(Ke.y)+a0.elements[9])/a0.elements[5],_e.z=-1,_e.w=(1+a0.elements[10])/a0.elements[14],Ke.multiplyScalar(2/Ke.dot(_e)),a0.elements[2]=Ke.x,a0.elements[6]=Ke.y,a0.elements[10]=Ke.z+1-Zt,a0.elements[14]=Ke.w,r.visible=!1;const h0=i0.getRenderTarget(),m0=i0.xr.enabled,V0=i0.shadowMap.autoUpdate;i0.xr.enabled=!1,i0.shadowMap.autoUpdate=!1,i0.setRenderTarget(t0),i0.state.buffers.depth.setMask(!0),i0.autoClear===!1&&i0.clear(),i0.render(n0,qe),i0.xr.enabled=m0,i0.shadowMap.autoUpdate=V0,i0.setRenderTarget(h0);const u0=s0.viewport;u0!==void 0&&i0.state.viewport(u0),r.visible=!0},this.getRenderTarget=function(){return t0},this.dispose=function(){t0.dispose(),r.material.dispose()}}}Reflector.ReflectorShader={name:"ReflectorShader",uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
5331
+ `)},Zt.needsUpdate=!0)}}setAreaEmissiveByProperty(s,r,f,st=1){if(!this.map)return;const ct=this.map.areaArr.find(Zt=>Zt.userData[s]===r);ct&&this.map.setAreaEmissive(ct,f,st)}setLineColorByProperty(s,r,f){if(!this.map)return;const st=this.map.lineArr.find(ct=>ct.userData[s]===r);st&&this.map.setLineColor(st,f)}setLineWidthByProperty(s,r,f){if(!this.map)return;const st=this.map.lineArr.find(ct=>ct.userData[s]===r);st&&this.map.setLineWidth(st,f)}addAreaPlaneByProperty(st,ct){return ti(this,arguments,function*(s,r,f={}){var Yt,vt;if(!this.map)return;const Wt=this.map.options.geojson.features.find(Tt=>Tt.properties&&Tt.properties[s]===r);if(Wt){const Tt=(Yt=f.uid)!=null?Yt:"";let Jt=!1;if(this.mList.objectList.forEach((Ke,de)=>{if(Ke.key==="planeCopyExtrudePolygon"+Tt){console.warn("已经存在复制面",Tt),Jt=!0;return}}),Jt)return;let $t;f.material?n$1(f.material)?$t=new MeshBasicMaterial(di({},f.material)):$t=f.material:$t=new MeshBasicMaterial({color:"red"});let Xe;f.lineMaterial?n$1(f.lineMaterial)?Xe=new it$1(di({},f.lineMaterial)):Xe=f.lineMaterial:Xe=new it$1({color:new Color$1("blue"),sizeAttenuation:0,lineWidth:this.options.lineWidth});const Qe=yield this.map.addPlane(Wt,{material:$t,lineMaterial:Xe,topSegments:(vt=f.topSegments)!=null?vt:0});return Qe.children.forEach(Ke=>{Ke instanceof je?(Ke.object3d.name="复制面"+Tt,this.mList.setObject3d(Ke.object3d,"planeCopyExtrudePolygon"+Tt,{baseObject:Ke})):Ke instanceof Ge&&(Ke.object3d.name="复制线"+Tt,this.mList.setObject3d(Ke.object3d,"planeCopyLine"+Tt,{baseObject:Ke}))}),Qe}})}show(){return ti(this,null,function*(){if(this.showState||this.options.disableInitShow)return;rn(un.prototype,this,"show").call(this);const s=this.drawController.group;this.mapHistory[0]&&(yield sinusoidalInOut({onUpdate:r=>{s.position.z=-this.mapHistory[0].depth*(1-r)}}).start()),this.handlePickTest()})}handlePickTest(){return ti(this,null,function*(){var s;this.playing||(s=this.mapArea)==null||s.forEach(r=>{r.onPointerEvent("down",f=>ti(this,null,function*(){var Wt,Yt,vt;(Yt=(Wt=this.pencil)==null?void 0:Wt.helperController)==null||Yt.removeAllExcludeScene(),(vt=this.pencil.helperController)==null||vt.add(f.object3d),this.caId=f.userData.ISO_A2||f.userData.adcode;const st=this.mapLine.find(Tt=>Tt.userData.ISO_A2===this.caId||Tt.userData.adcode===this.caId),Zt=f.object3d.material[0].color.getHexString();this.settings["测试板块颜色.color:::caId"]="#"+Zt,yield this.settings["测试板块颜色.color:::caId"],this.settings["测试边框颜色.color:::caId"]="#"+(st==null?void 0:st.material.color.getHexString()),yield this.settings["测试边框颜色.color:::caId"],this.settings["测试边框宽度:::caId"]=st==null?void 0:st.material.lineWidth,yield this.settings["测试边框宽度:::caId"],this.emit("settingsChanged")}))})})}hide(){return ti(this,null,function*(){if(!this.showState)return;const s=this.drawController.group;yield sinusoidalInOut({onUpdate:r=>{s.position.z=-this.mapHistory[0].depth*r}}).start(),setTimeout(()=>{rn(un.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return ti(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const s=yield this.drawController.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0}),r=s.object3d;this.mList.changeObject3dKey(r,"Shadow$1"),this.mList.changeObject3dKey(r.target,"Shadow$1"),this.shadowMapLight=s,s.object3d.position.set(.281,32.487,43.077),s.object3d.castShadow=!0;const f=yield this.drawController.draw("PlaneShadow");this.mList.setObject3d(f.object3d,"PlaneShadow",{baseObject:f}),this.planeShadow=f})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.mList.delObject3d(this.shadowMapLight.object3d),this.shadowMapLight=void 0),this.planeShadow&&(this.mList.delObject3d(this.planeShadow.object3d),this.planeShadow.erase(),this.planeShadow=void 0))}getDepth(s,r){const f=this.getAdcodeShowLevel(s);let st=this.options.mapDepth;Array.isArray(st)||(st=new Array(3).fill(st));let ct;if(f==="country"?ct=st[0]:f==="province"?ct=st[1]:ct=st[2],this.options.depthReference&&this.options.bboxMap[s]){const Zt=this.options.depthReference,Wt=this.options.bboxMap[s];ct=ct*this.getReferenceScale(Zt,Wt)}else if(this.mapHistory.length&&this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]){const Zt=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode],Wt=turf.bbox(r),Yt=this.getReferenceScale(Zt,Wt);ct=ct*Yt}return ct}getReferenceScale(s,r){const f=Math.abs(r[3]-r[1])/Math.abs(s[3]-s[1]),st=Math.abs(r[2]-r[0])/Math.abs(s[2]-s[0]);return Math.max(f,st)}getAdcodeShowLevel(s){var r;if((r=this.options.fixCity)!=null&&r[s]&&(s=this.options.fixCity[s]),s===0)return"world";if(s===1e5)return"country";{const{level:f,parent:st}=geojsonCn.adcodeMap[s],ct=st&&geojsonCn.adcodeMap[st].level;return f==="district"&&ct==="province"?"city":f}}handleClick(s){var st;const{drillDownRestrictions:r}=this.options;if(this.isAnimating)return;const f=(st=this.map)==null?void 0:st.pickArea(s);if(f&&f.userData.adcode&&this.getAdcodeShowLevel(f.userData.adcode)!==r)this.clickArea({adcodes:[...this.adcodes,f.userData.adcode]});else if(this.options.clickOusideBack&&!f&&this.mapHistory.length>1){const ct=[...this.adcodes];ct.pop(),this.clickArea({adcodes:ct})}}beforeClickArea(s){return!0}clickArea(f){return ti(this,arguments,function*({adcodes:s,duration:r=1e3}){(yield this.beforeClickArea(s))!==!1&&(this.emit("beforeDrillDown",s),yield this.setAdcode({adcodes:s,duration:r}),this.emit("afterDrillDown",s))})}drawLabels(){return ti(this,null,function*(){var f;const s=this.options.showLabel;!((f=this.mapArea)!=null&&f.length)||!s||this.drawController.getAllObject("Node",{key:"mapLabel"}).length||(yield Promise.all(this.mapArea.map(st=>ti(this,null,function*(){let{name:ct,adcode:Zt}=st.userData;const{DistrictID:Wt,DistName:Yt,NAME_CN:vt,CENTROID:Tt}=st.userData;Zt=Zt||Wt,ct=this.options.adcode===0?vt:ct||Yt;const Jt=this.options.adcode===0?this.getLocationPosition([...Tt]):this.geAdcodePosition(Zt);if(this.drawController.getObject("Node",{key:`mapLabel-${Zt}`})||!Jt)return;const[$t,Xe,Qe]=Jt;let Ke=ct;s==="lite"&&Ke&&(Ke=ct.replace("自治州","").replace("地区","").replace("自治区","").replace("省","").replace("市","").replace("壮族","").replace("特别行政区","").replace("回族","").replace("维吾尔",""));const de=Ke&&getLabelElement(Ke),Je=Ke!=null&&Ke.startsWith("澳门")?-1:0;yield this.drawController.draw("Node",{position:new Vector3($t,Xe+Je,Qe),children:de,key:`mapLabel#${this.options.adcode===0?ct:Zt}`})}))))})}eraseLabels(){const s=this.drawController.getAllObject("Node",{key:"mapLabel"});this.drawController.erase(...s)}geAdcodePosition(s){const r=this.centroidObj[s];if(r){const[f,st]=r;return this.getLocationPosition([f,st])}}getLocationPosition(s){const[r,f]=s,[st,ct]=this.projection([r,f]);return[st,-ct,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(s){const r=this.geAdcodePosition(s);if(r){const[f,st,ct]=r,Zt=new Vector3(f,st,ct);Zt.project(this.pencil.camera);const{width:Wt,height:Yt}=this.pencil.getSize(),vt=(Zt.x*.5+.5)*Wt,Tt=(Zt.y*-.5+.5)*Yt;return{x:vt,y:Tt}}}booleanPointInCn(s){return json100000.features[0].geometry.coordinates.some(r=>turf.booleanPointInPolygon(turf.point(s),turf.polygon(r)))}handleDrillDown(st){return ti(this,arguments,function*({adcode:s,duration:r,saveBackCamvasState:f}){var ct,Zt,Wt,Yt,vt,Tt,Jt,$t;if(typeof s!="undefined"&&!this.isAnimating){const Xe=(ct=this.map)==null?void 0:ct.findGroup(s),Qe=geojsonCn.findLevelJsonItem(+s)||s===0;if(this.isAnimating||!Qe)return;this.isAnimating=!0;const{name:Ke}=Qe;let{res:de}=(Zt=this.options.geojsonMap)!=null&&Zt[s]?{res:(Wt=this.options.geojsonMap)==null?void 0:Wt[s]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${s}.json`),{res:Je}=this.options.extrudeLine?(Yt=this.options.extrudeLineGeojsonMap)!=null&&Yt[s]?{res:(vt=this.options.extrudeLineGeojsonMap)==null?void 0:vt[s]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${s}.json`):{res:void 0};if(!this.options.showDistrict&&this.getAdcodeShowLevel(s)==="city"&&(de=Je,Je=void 0),[de,Je].filter(Boolean).forEach($e=>{if(!$e.features[0].properties.adcode&&s!==0){const qe=geojsonCn.adcodeMap[s];$e.features[0].properties=Ui(di(di({},$e.features[0].properties),qe),{center:[qe.lng,qe.lat]})}}),de){const $e=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if($e&&this.fixNear(s),(Tt=this.options.fixGeojson)!=null&&Tt[s]){const d0=(Jt=this.options.fixGeojson)==null?void 0:Jt[s];if(d0.startsWith("-")){const o0=+d0.slice(1);de.features=de.features.filter(b0=>b0.properties.adcode!==o0)}}const qe=this.options.bboxMap[s]||Object.values(this.options.bboxMap).pop();de.features.forEach(d0=>{d0.properties.adcode&&(this.centroidObj[d0.properties.adcode]=d0.properties.centroid||d0.properties.center)}),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(d0=>{d0.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),(f!=null?f:this.options.handleBackKeepCamvasState)&&this.saveBackCamvasState(-1));const t0=this.mapHistory.length,e0=t0-1,i0=this.getDepth(s,Je||de),n0=($t=this.mapHistory[e0])==null?void 0:$t.depth,s0=t0===0?0:this.mapHistory[e0].z+(this.options.showOneLevel?0:n0),a0=t0===0?0:s0-i0,h0=turf.center(de).geometry.coordinates,[m0,V0]=this.projection(h0),u0=yield this.drawPlaneMap({geojson:de,extrudeLineGeojson:Je,depth:i0,bbox:qe,adcode:s});u0.position.setZ(a0),this.mapHistory.push({map:u0,mapInfo:Qe,z:s0,depth:i0,cX:m0,cY:-V0});const r0=u0.position.z;$e&&(u0.position.z=s0,this.fitTo(u0,{enableTransition:r!==0}),u0.position.z=r0),Xe==null||Xe.hide(),this.map&&t0!==0&&(r?yield sinusoidalInOut({onUpdate:d0=>{this.map.position.z=r0+(s0-r0)*d0}}).start({duration:r}):this.map.position.z=s0),this.drawLabels()}else console.log(`${Ke}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:s,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveBackCamvasState(s){const r=this.mapHistory.at(s);r&&(r.cameraPositon=this.pencil.cameraPositon.clone(),r.cameraTarget=this.pencil.cameraTarget.clone())}fixNear(s){const r=this.getAdcodeShowLevel(s);s===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(r==="country"||r==="province")&&this.pencil.camera.near!==this.pencilConfig.camera.near*10?(this.pencil.camera.near=this.pencilConfig.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(r==="city"||r==="district")&&this.pencil.camera.near!==this.pencilConfig.camera.near&&(this.pencil.camera.near=this.pencilConfig.camera.near,this.pencil.camera.updateProjectionMatrix())}absoluteAngle(s,r){const f=Math.PI*2,st=s-r;return MathUtils.euclideanModulo(st+Math.PI,f)-Math.PI}fitTo(ct){return ti(this,arguments,function*(s,{polarAngle:r,azimuthAngle:f,enableTransition:st=!0}={}){var Qe,Ke,de;if(!(s!=null&&s.object3d))return;const Zt=(Ke=this.options.lookAtMap)==null?void 0:Ke[(Qe=this.mapInfo)==null?void 0:Qe.adcode];if(Zt){const[Je,_e,$e,qe,t0,e0]=Zt;yield(de=this.pencil.controls)==null?void 0:de.setLookAt(Je,_e,$e,qe,t0,e0,st);return}const Wt=this.options.mapPadding,{height:Yt,width:vt}=this.pencil.getSize();Yt<Wt[0]+Wt[2]+100&&(Wt[0]=0,Wt[2]=0),vt<Wt[1]+Wt[3]+100&&(Wt[1]=0,Wt[3]=0);const Tt=r||this.options.polarAngle,Jt=f||this.options.azimuthAngle,$t=this.pencil.controls.azimuthAngle,Xe=this.pencil.controls.polarAngle;yield Promise.all([this.paddingInCssPixel(s,Wt[0],Wt[1],Wt[2],Wt[3],st),this.pencil.controls.rotateTo($t+this.absoluteAngle(Jt,$t),Xe+this.absoluteAngle(Tt,Xe),st)])})}paddingInCssPixel(s,r,f,st,ct,Zt){const{camera:Wt,controls:Yt}=this.pencil,vt=Wt.fov*MathUtils.DEG2RAD,Tt=this.pencil.getSize().height,{size:Jt}=s.getSize(),$t=Jt.x,Xe=Jt.y,Qe=Jt.z;let Ke=Yt.getDistanceToFitBox($t,Xe,Qe),de=0,Je=0,_e=0,$e=0;for(let qe=0;qe<10;qe++){const t0=Ke-Qe*.5,e0=2*Math.tan(vt*.5)*Math.abs(t0)/Tt;de=r*e0,Je=st*e0,_e=ct*e0,$e=f*e0,Ke=Yt.getDistanceToFitBox($t+_e+$e,Xe+de+Je,Qe)}return Yt.fitToBox(s.object3d,Zt,{paddingLeft:_e,paddingRight:$e,paddingBottom:Je,paddingTop:de})}drawPlaneMap(Zt){return ti(this,arguments,function*({geojson:s,extrudeLineGeojson:r,bbox:f,depth:st,adcode:ct}){const Wt=this.mList.getMaterialObj("plane"),Yt=di({},Wt),vt=yield this.drawController.draw("PlaneMap",{geojson:s,extrudeLineGeojson:r,depth:st,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:Yt,bbox:f,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return vt.extrudelineArr&&vt.extrudelineArr.forEach(Tt=>{Tt.object3d.name="板块边线",this.mList.setObject3d(Tt.object3d,"extrudeLine",{baseObject:Tt}),this.initBaseObjectUserData(Tt)}),this.mList.setObject3d(vt.object3d,ct===1e5?"chinaGroup":"planeMapGroup",{baseObject:vt}),vt})}handleBack(){return ti(this,arguments,function*({duration:s=1e3,handleLookBack:r=!0}={}){if(this.mapHistory.length>1&&!this.isAnimating){this.isAnimating=!0;const f=this.mapHistory.pop();if(f!=null&&f.map){if(!this.options.drillDownPlateInCenter){const Zt=f.map.position.z,Wt=this.mapObj.z+(this.mapObj.depth-f.depth);yield sinusoidalInOut({onUpdate:Yt=>{f.map.position.z=Zt+(Wt-Zt)*Yt}}).start({duration:s})}this.drawController.eraseWithoutMaterial(f.map)}const{map:st}=this.mapObj,ct=st==null?void 0:st.findGroup(f==null?void 0:f.mapInfo.adcode);ct&&ct.show(),st&&r&&(this.eraseLabels(),this.options.showOneLevel?st.show():st.active(),this.options.drillDownHideParent&&this.parentBg.forEach(Zt=>{Zt.show()}),yield this.handleLookBack(s),this.drawLabels()),this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1}})}handleLookBack(s){return ti(this,null,function*(){var ct;const{map:r,cameraPositon:f,cameraTarget:st}=this.mapObj;f&&st?yield(ct=this.pencil.controls)==null?void 0:ct.setLookAt(f.x,f.y,f.z,st.x,st.y,st.z,s!==0):yield this.fitTo(r,{enableTransition:s!==0})})}compareLocations(s,r){const f=s.filter(Wt=>Wt),st=r.filter(Wt=>Wt),ct=[];let Zt=0;for(let Wt=0;Wt<Math.min(f.length,st.length)&&f[Wt]===st[Wt];Wt++)Zt++;for(let Wt=Zt;Wt<f.length;Wt++)ct.push(-1);for(let Wt=Zt;Wt<st.length;Wt++)ct.push(st[Wt]);return ct}setAdcode(f){return ti(this,arguments,function*({adcodes:s,duration:r}){const{adcodes:st}=this;if(!(JSON.stringify(s)===JSON.stringify(st)||this.isAnimating))if(JSON.stringify(s)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:r})}catch(vt){console.error(vt)}else{const{country:vt,province:Tt,city:Jt}=s.reduce((de,Je)=>{const _e=this.getAdcodeShowLevel(Je);return de[_e]=Je,de},{}),{country:$t,province:Xe,city:Qe}=st.reduce((de,Je)=>{const _e=this.getAdcodeShowLevel(Je);return de[_e]=Je,de},{}),Ke=this.compareLocations([$t,Xe,Qe],[vt,Tt,Jt]);try{for(var ct=Yn(Ke.entries()),Zt,Wt,Yt;Zt=!(Wt=yield ct.next()).done;Zt=!1){const[de,Je]=Wt.value;const _e=de===Ke.length-1?r:0;Je===-1?yield this.handleBack({duration:_e,handleLookBack:!!_e}):yield this.handleDrillDown({adcode:Je,duration:_e,saveBackCamvasState:Ke.includes(-1)?!1:this.options.handleBackKeepCamvasState})}}catch(Wt){Yt=[Wt]}finally{try{Zt&&(Wt=ct.return)&&(yield Wt.call(ct))}finally{if(Yt)throw Yt[0]}}}})}setPadding(s,r=!1){this.options.mapPadding=s,r&&this.fitTo(this.map)}dispose(){var s,r;(s=this.map)==null||s.dispose(),this.parentBg.forEach(f=>{f.dispose()}),this.parentBg.length=0,(r=this.continentsBg)==null||r.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,this.centroidObj={},super.dispose()}};H0(un,"VisName","map");let Map$2=un;const PENCIL_CONFIG$3={camera:{near:.01,far:100,fov:45,up:new Vector3(0,0,1)}};class Reflector extends Mesh{constructor(e,s={}){super(e),this.isReflector=!0,this.type="Reflector",this.camera=new PerspectiveCamera;const r=this,f=s.color!==void 0?new Color$1(s.color):new Color$1(8355711),st=s.textureWidth||512,ct=s.textureHeight||512,Zt=s.clipBias||0,Wt=s.shader||Reflector.ReflectorShader,Yt=s.multisample!==void 0?s.multisample:4,vt=new Plane$1,Tt=new Vector3,Jt=new Vector3,$t=new Vector3,Xe=new Matrix4,Qe=new Vector3(0,0,-1),Ke=new Vector4,de=new Vector3,Je=new Vector3,_e=new Vector4,$e=new Matrix4,qe=this.camera,t0=new WebGLRenderTarget(st,ct,{samples:Yt,type:HalfFloatType}),e0=new ShaderMaterial({name:Wt.name!==void 0?Wt.name:"unspecified",uniforms:UniformsUtils.clone(Wt.uniforms),fragmentShader:Wt.fragmentShader,vertexShader:Wt.vertexShader});e0.uniforms.tDiffuse.value=t0.texture,e0.uniforms.color.value=f,e0.uniforms.textureMatrix.value=$e,this.material=e0,this.onBeforeRender=function(i0,n0,s0){if(Jt.setFromMatrixPosition(r.matrixWorld),$t.setFromMatrixPosition(s0.matrixWorld),Xe.extractRotation(r.matrixWorld),Tt.set(0,0,1),Tt.applyMatrix4(Xe),de.subVectors(Jt,$t),de.dot(Tt)>0)return;de.reflect(Tt).negate(),de.add(Jt),Xe.extractRotation(s0.matrixWorld),Qe.set(0,0,-1),Qe.applyMatrix4(Xe),Qe.add($t),Je.subVectors(Jt,Qe),Je.reflect(Tt).negate(),Je.add(Jt),qe.position.copy(de),qe.up.set(0,1,0),qe.up.applyMatrix4(Xe),qe.up.reflect(Tt),qe.lookAt(Je),qe.far=s0.far,qe.updateMatrixWorld(),qe.projectionMatrix.copy(s0.projectionMatrix),$e.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),$e.multiply(qe.projectionMatrix),$e.multiply(qe.matrixWorldInverse),$e.multiply(r.matrixWorld),vt.setFromNormalAndCoplanarPoint(Tt,Jt),vt.applyMatrix4(qe.matrixWorldInverse),Ke.set(vt.normal.x,vt.normal.y,vt.normal.z,vt.constant);const a0=qe.projectionMatrix;_e.x=(Math.sign(Ke.x)+a0.elements[8])/a0.elements[0],_e.y=(Math.sign(Ke.y)+a0.elements[9])/a0.elements[5],_e.z=-1,_e.w=(1+a0.elements[10])/a0.elements[14],Ke.multiplyScalar(2/Ke.dot(_e)),a0.elements[2]=Ke.x,a0.elements[6]=Ke.y,a0.elements[10]=Ke.z+1-Zt,a0.elements[14]=Ke.w,r.visible=!1;const h0=i0.getRenderTarget(),m0=i0.xr.enabled,V0=i0.shadowMap.autoUpdate;i0.xr.enabled=!1,i0.shadowMap.autoUpdate=!1,i0.setRenderTarget(t0),i0.state.buffers.depth.setMask(!0),i0.autoClear===!1&&i0.clear(),i0.render(n0,qe),i0.xr.enabled=m0,i0.shadowMap.autoUpdate=V0,i0.setRenderTarget(h0);const u0=s0.viewport;u0!==void 0&&i0.state.viewport(u0),r.visible=!0},this.getRenderTarget=function(){return t0},this.dispose=function(){t0.dispose(),r.material.dispose()}}}Reflector.ReflectorShader={name:"ReflectorShader",uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
5332
5332
  uniform mat4 textureMatrix;
5333
5333
  varying vec4 vUv;
5334
5334
 
@@ -89,7 +89,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
89
89
  ).toString(CryptoJS.enc.Utf8), Jt = JSON.parse(Tt), $t = Date.now();
90
90
  return !Jt.s || Jt.s > $t ? (this.token = void 0, "") : Jt.e && Jt.e < $t ? (this.token = void 0, "") : (Jt.isValid = Yt, Jt);
91
91
  }
92
- }, version = "0.21.65";
92
+ }, version = "0.21.66";
93
93
  /**
94
94
  * @license
95
95
  * Copyright 2010-2024 Three.js Authors
@@ -52183,9 +52183,9 @@ const objs$4 = Ui(di({}, objs$5), {
52183
52183
  this.drawController.eraseWithoutMaterial(f.map);
52184
52184
  }
52185
52185
  const { map: st } = this.mapObj, ct = st == null ? void 0 : st.findGroup(f == null ? void 0 : f.mapInfo.adcode);
52186
- ct && ct.show(), st && (this.eraseLabels(), this.options.showOneLevel ? st.show() : st.active(), this.options.drillDownHideParent && this.parentBg.forEach((Zt) => {
52186
+ ct && ct.show(), st && r && (this.eraseLabels(), this.options.showOneLevel ? st.show() : st.active(), this.options.drillDownHideParent && this.parentBg.forEach((Zt) => {
52187
52187
  Zt.show();
52188
- }), r && (yield this.handleLookBack(s), this.drawLabels())), this.emit("handleBack", {
52188
+ }), yield this.handleLookBack(s), this.drawLabels()), this.emit("handleBack", {
52189
52189
  adcodes: this.adcodes
52190
52190
  }), this.isAnimating = !1;
52191
52191
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.21.65";
1
+ declare const _default: "0.21.66";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.21.65",
3
+ "version": "0.21.66",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version &&PUBLIC_EXCLUDE=public/city bundler",