vis-core 0.22.9 → 0.22.10

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.22.9";
11
+ export declare const VERSION = "0.22.10";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document!="undefined"){var t=document.createElement("style");t.appendChild(document.createTextNode(".-translate-x-1\\/2,.-translate-y-1\\/2{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1 }.shadow{--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.ring{--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.invert,.filter{--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: }.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.left-1\\/2{left:50%}.top-1\\/2{top:50%}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.whitespace-nowrap{white-space:nowrap}.text-center{text-align:center}.text-sm{font-size:14px;line-height:20px}.text-xs{font-size:12px;line-height:16px}.leading-\\[1\\]{line-height:1}.text-\\[\\#809083\\]{--tw-text-opacity: 1;color:rgb(128 144 131 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-opacity-80{--tw-text-opacity: .8 }.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- "use strict";var Tn=Object.defineProperty,Mn=Object.defineProperties;var Nn=Object.getOwnPropertyDescriptors;var Ln=Object.getOwnPropertySymbols,Fn=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty,Hn=Object.prototype.propertyIsEnumerable,wn=Reflect.get;var Zn=(c,e)=>(e=Symbol[c])?e:Symbol.for("Symbol."+c),Kn=c=>{throw TypeError(c)},ln=Math.pow,Sn=(c,e,s)=>e in c?Tn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[e]=s,ri=(c,e)=>{for(var s in e||(e={}))kn.call(e,s)&&Sn(c,s,e[s]);if(Ln)for(var s of Ln(e))Hn.call(e,s)&&Sn(c,s,e[s]);return c},zi=(c,e)=>Mn(c,Nn(e));var H0=(c,e,s)=>Sn(c,typeof e!="symbol"?e+"":e,s);var on=(c,e,s)=>wn(Fn(c),s,e);var ei=(c,e,s)=>new Promise((r,T)=>{var de=Je=>{try{Ke(s.next(Je))}catch(Qe){T(Qe)}},Xe=Je=>{try{Ke(s.throw(Je))}catch(Qe){T(Qe)}},Ke=Je=>Je.done?r(Je.value):Promise.resolve(Je.value).then(de,Xe);Ke((s=s.apply(c,e)).next())}),Jn=function(c,e){this[0]=c,this[1]=e};var Yn=c=>{var e=c[Zn("asyncIterator")],s=!1,r,T={};return e==null?(e=c[Zn("iterator")](),r=de=>T[de]=Xe=>e[de](Xe)):(e=e.call(c),r=de=>T[de]=Xe=>{if(s){if(s=!1,de==="throw")throw Xe;return Xe}return s=!0,{done:!1,value:new Jn(new Promise(Ke=>{var Je=e[de](Xe);Je instanceof Object||Kn("Object expected"),Ke(Je)}),1)}}),T[Zn("iterator")]=()=>T,r("next"),"throw"in e?r("throw"):T.throw=de=>{throw de},"return"in e&&r("return"),T},In=(c,e,s)=>(e=c[Zn("asyncIterator")])?e.call(c):(c=c[Zn("iterator")](),e={},s=(r,T)=>(T=c[r])&&(e[r]=de=>new Promise((Xe,Ke,Je)=>(de=T.call(c,de),Je=de.done,Promise.resolve(de.value).then(Qe=>Xe({value:Qe,done:Je}),Ke)))),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"),world$1=require("geojson-cn/extra/countries-next.json"),json100000Lite=require("geojson-cn/extra/100000-lite-next.json"),json100000=require("geojson-cn/extra/100000-next.json"),continentsCountriesIsoOrigin=require("geojson-cn/extra/continents-countries-iso.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(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)),T=CryptoJS.enc.Base64.parse(e),de=CryptoJS.enc.Base64.parse(s),Xe=CryptoJS.lib.WordArray.create(T.words.slice(0,4)),Ke=CryptoJS.lib.WordArray.create(T.words.slice(4)),Je=jsrsasign.KJUR.crypto.Util.hashHex(T.toString(),"sha256"),Qe=r.verifyWithMessageHashPSS(Je,jsrsasign.b64tohex(c),"sha256",32);if(!Qe)return this.token=void 0,"";const $e=CryptoJS.AES.decrypt({ciphertext:Ke},de,{iv:Xe,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),qe=JSON.parse($e),st=Date.now();return!qe.s||qe.s>st?(this.token=void 0,""):qe.e&&qe.e<st?(this.token=void 0,""):(qe.isValid=Qe,qe)}},version="0.22.9";/**
2
+ "use strict";var Tn=Object.defineProperty,Mn=Object.defineProperties;var Nn=Object.getOwnPropertyDescriptors;var Ln=Object.getOwnPropertySymbols,Fn=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty,Hn=Object.prototype.propertyIsEnumerable,wn=Reflect.get;var Zn=(c,e)=>(e=Symbol[c])?e:Symbol.for("Symbol."+c),Kn=c=>{throw TypeError(c)},ln=Math.pow,Sn=(c,e,s)=>e in c?Tn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[e]=s,ri=(c,e)=>{for(var s in e||(e={}))kn.call(e,s)&&Sn(c,s,e[s]);if(Ln)for(var s of Ln(e))Hn.call(e,s)&&Sn(c,s,e[s]);return c},zi=(c,e)=>Mn(c,Nn(e));var H0=(c,e,s)=>Sn(c,typeof e!="symbol"?e+"":e,s);var on=(c,e,s)=>wn(Fn(c),s,e);var ei=(c,e,s)=>new Promise((r,T)=>{var de=Je=>{try{Ke(s.next(Je))}catch(Qe){T(Qe)}},Xe=Je=>{try{Ke(s.throw(Je))}catch(Qe){T(Qe)}},Ke=Je=>Je.done?r(Je.value):Promise.resolve(Je.value).then(de,Xe);Ke((s=s.apply(c,e)).next())}),Jn=function(c,e){this[0]=c,this[1]=e};var Yn=c=>{var e=c[Zn("asyncIterator")],s=!1,r,T={};return e==null?(e=c[Zn("iterator")](),r=de=>T[de]=Xe=>e[de](Xe)):(e=e.call(c),r=de=>T[de]=Xe=>{if(s){if(s=!1,de==="throw")throw Xe;return Xe}return s=!0,{done:!1,value:new Jn(new Promise(Ke=>{var Je=e[de](Xe);Je instanceof Object||Kn("Object expected"),Ke(Je)}),1)}}),T[Zn("iterator")]=()=>T,r("next"),"throw"in e?r("throw"):T.throw=de=>{throw de},"return"in e&&r("return"),T},In=(c,e,s)=>(e=c[Zn("asyncIterator")])?e.call(c):(c=c[Zn("iterator")](),e={},s=(r,T)=>(T=c[r])&&(e[r]=de=>new Promise((Xe,Ke,Je)=>(de=T.call(c,de),Je=de.done,Promise.resolve(de.value).then(Qe=>Xe({value:Qe,done:Je}),Ke)))),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"),world$1=require("geojson-cn/extra/countries-next.json"),json100000Lite=require("geojson-cn/extra/100000-lite-next.json"),json100000=require("geojson-cn/extra/100000-next.json"),continentsCountriesIsoOrigin=require("geojson-cn/extra/continents-countries-iso.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(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)),T=CryptoJS.enc.Base64.parse(e),de=CryptoJS.enc.Base64.parse(s),Xe=CryptoJS.lib.WordArray.create(T.words.slice(0,4)),Ke=CryptoJS.lib.WordArray.create(T.words.slice(4)),Je=jsrsasign.KJUR.crypto.Util.hashHex(T.toString(),"sha256"),Qe=r.verifyWithMessageHashPSS(Je,jsrsasign.b64tohex(c),"sha256",32);if(!Qe)return this.token=void 0,"";const $e=CryptoJS.AES.decrypt({ciphertext:Ke},de,{iv:Xe,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),qe=JSON.parse($e),st=Date.now();return!qe.s||qe.s>st?(this.token=void 0,""):qe.e&&qe.e<st?(this.token=void 0,""):(qe.isValid=Qe,qe)}},version="0.22.10";/**
3
3
  * @license
4
4
  * Copyright 2010-2024 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
@@ -5680,4 +5680,4 @@ version 0.8.2
5680
5680
  gl_FragColor = vec4(ccccc, alpha * 0.65);
5681
5681
 
5682
5682
 
5683
- `)},Ke.needsUpdate=!0)}}setAreaEmissiveByProperty(s,r,T,de=1){if(!this.map)return;const Xe=this.map.areaArr.find(Ke=>Ke.userData[s]===r);Xe&&this.map.setAreaEmissive(Xe,T,de)}setLineColorByProperty(s,r,T){if(!this.map)return;const de=this.map.lineArr.find(Xe=>Xe.userData[s]===r);de&&this.map.setLineColor(de,T)}addAreaPlaneByProperty(s,r,T){return ei(this,null,function*(){if(!this.map)return;const Xe=this.map.options.geojson.features.find(Ke=>Ke.properties&&Ke.properties[s]===r);if(Xe)return this.drawController.draw("Countries",{geojson:{type:"FeatureCollection",features:[Xe]},depth:this.options.mapDepth+.3,start:this.options.radius,mats:{topMat:new MeshBasicMaterial(T.area),outLine:new it$1(T.line)}})})}checkBehindEarth(s,r,T){const de=new Vector3(0,0,0),Xe=new Vector3(0,0,0),Ke=this.options.radius,Je=()=>{const Qe=s();if(!Qe.length)return;this.pencil.controls.getPosition(Xe,!1);const _e=de.clone().sub(Xe),$e=Math.sqrt(Math.pow(_e.length(),2)-Math.pow(Ke,2)),qe=[],st=[];Qe.forEach(dt=>{dt.position.clone().sub(Xe).length()>$e?qe.push(dt):st.push(dt)}),r(qe,st)};Je(),T&&this.pencil.controls.addEventListener(T,()=>{Je()})}addBar(s){this.removeBar();const r=this.drawController.getObject("CrossPlane",{key:s.replace(/.*[#_]/,"")});if(!r)return;const T=["中国","泰国","缅甸","菲律宾","日本","柬埔寨","印度","美国","阿联酋","马来西亚","俄罗斯"];this.mapArea.filter(de=>T.includes(de.userData.NAME_CN)).forEach(de=>ei(this,null,function*(){const[Xe,Ke]=de.userData.CENTROID,Je=this.getLocationPosition([Xe,Ke],.1),Qe=yield r.instantiate();Qe.position.set(...Je),Qe.object3d.lookAt(0,0,0),this.barArr.push(Qe)}))}removeBar(){this.barArr.forEach(s=>{s.erase()}),this.barArr.length=0}};H0(fn,"VisName","earth");let index$1=fn;class Earth extends Sphere{create(){const e=this.pencil.getPlugin("loader"),s=e.getAsset("/image/earth2/basic.jpg"),r=e.getAsset("/image/earth2/NormalMap.jpg"),T=new MeshStandardMaterial({map:s,metalness:.1,roughness:.8,normalMap:r,normalScale:new Vector2(.5,.5)});this.material=T,super.create(),this.pencil.installPlugins.get("materialList").setObject3d(this.object3d,"earth")}}const objs=zi(ri({},objs$5),{Earth}),PENCIL_CONFIG={camera:{near:1,far:3e3,fov:12}},gn=class gn extends Base{constructor(){super(...arguments);H0(this,"leftTruck",!1);H0(this,"drawController",new Rl(objs));H0(this,"autoRotateSpeed",0);H0(this,"initSettingsObj",{autoRotate:!1})}setOptions(s){super.setOptions(ri({},s)),this.pencilConfig=PENCIL_CONFIG}loaderAdd(){this.loader.add(["/image/earth2/basic.jpg","/image/earth2/NormalMap.jpg","/image/earth2/BEIJING.png","/image/earth2/earth_circle.png","/image/earth2/earth_blue.png","/image/earth2/expose_point.png"])}initVis(){return ei(this,null,function*(){yield Promise.all([this.drawController.draw("Light",{type:"PointLight",intensity:4,color:16777215,distance:0,decay:0}),this.drawController.draw("Earth")])})}show(){super.show(),this.animationIn()}handleSetting(s,r){return ei(this,null,function*(){return yield on(gn.prototype,this,"handleSetting").call(this,s,r),s==="autoRotate"&&this.playing&&(r?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),r})}animationIn(){return ei(this,null,function*(){const s=this.pencil.controls;s.setPosition(0,0,1800,!1),yield s.rotatePolarTo(1.046,!1);const r=this.drawController.getObject("Light"),T=new Vector3;s.getPosition(T),r.position.copy(T),s.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),s.addEventListener("controlend",()=>{this.pencil.autoRotate(this.autoRotateSpeed)}),s.addEventListener("update",()=>{s.getPosition(T,!1),r.position.copy(T)})})}getLocationPosition(s,r=0){const[T,de]=s,Xe=this.drawController.getObject("Earth").radius+r;return o$1(T,de,Xe)}dispose(){super.dispose(),this.pencil.dispose()}};H0(gn,"VisName","earth2");let index=gn;const ec=(c,e)=>{const s=stringToUtf8ByteArray(c),r=stringToUtf8ByteArray(e).map(function(T,de){return T^s[Math.floor(de%s.length)]}).join(",");return btoa(r)};function stringToUtf8ByteArray(c){const e=[];let s=0;for(let r=0;r<c.length;r++){let T=c.charCodeAt(r);T<128?e[s++]=T:T<2048?(e[s++]=T>>6|192,e[s++]=T&63|128):(T&64512)==55296&&r+1<c.length&&(c.charCodeAt(r+1)&64512)==56320?(T=65536+((T&1023)<<10)+(c.charCodeAt(++r)&1023),e[s++]=T>>18|240,e[s++]=T>>12&63|128,e[s++]=T>>6&63|128,e[s++]=T&63|128):(e[s++]=T>>12|224,e[s++]=T>>6&63|128,e[s++]=T&63|128)}return e}let b="/";b==="/"&&(b="");const getMapConfig=(r,...T)=>ei(exports,[r,...T],function*(c,e=b,s){if(c===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const de=geojsonCn.adcodeMap[c];return extendMapConfig("map",{center:[de.lng,de.lat],adcode:de.adcode},e,s)}}),getMap2Config=(r,...T)=>ei(exports,[r,...T],function*(c,e=b,s){const de=geojsonCn.adcodeMap[c];return extendMapConfig("map2",{center:[de.lng,de.lat],adcode:de.adcode,parentBg:de.adcode!==1e5},e,s)}),getMap2WithCityConfig=(r,...T)=>ei(exports,[r,...T],function*(c,e=b,s){const de=geojsonCn.adcodeMap[c];return extendMapConfig("map2",{center:[de.lng,de.lat],adcode:de.adcode,showOneLevel:!0,allCity:de.level==="province",cityOnMap:!0,parentBg:!1,mapDepth:.004,bottomPlane:!1},e,s)}),extendMapConfig=(T,de,...Xe)=>ei(exports,[T,de,...Xe],function*(c,e,s=b,r){var Ke,Je;if(e.adcode!==0&&e.adcode!==1e5){const Qe=(Ke=e.fixGeojson)==null?void 0:Ke[e.adcode],_e=(Je=e.fixGeojson)==null?void 0:Je[e.adcode+"-lite"];let{res:$e}=yield jsonFetch(s+`/geojson/${Qe||"json"}/${e.adcode}.json`);const{res:qe}=yield jsonFetch(s+`/geojson/${_e||"json-lite"}/${e.adcode}.json`),st=turf.bbox(qe),dt=e.adcode,Wt=zi(ri({},e),{geojsonMap:{[dt]:$e},extrudeLineGeojsonMap:{[dt]:qe},bboxMap:{[dt]:st},cityBboxMap:{},jsonNameObj:{},depthReference:void 0});if(c==="map2"){if(!(geojsonCn.adcodeMap[dt].level==="province")){let rt=geojsonCn.adcodeMap[dt].parent;for(;geojsonCn.adcodeMap[rt].level!=="province";)rt=geojsonCn.adcodeMap[rt].parent;const{res:Zt}=yield jsonFetch(s+`/geojson/${Qe||"json"}/${rt}.json`);$e=Zt}$e.features.forEach(rt=>{Wt.cityBboxMap[rt.properties.adcode]=turf.bbox(rt),Wt.jsonNameObj[rt.properties.adcode]=ec(rt.properties.name,`${rt.properties.adcode}`)})}if(e.parentBg){const Yt=geojsonCn.adcodeMap[dt].parent;if(Yt!==1e5){const{res:rt}=yield jsonFetch(s+`/geojson/json/${Yt}.json`),{res:Zt}=yield jsonFetch(s+`/geojson/json-lite/${Yt}.json`);Wt.geojsonMap[Yt]=rt,Wt.extrudeLineGeojsonMap[Yt]=Zt,Wt.bboxMap[Yt]=turf.bbox(Zt)}}return r&&(Wt.depthReference=r.depthReference||r.bboxMap[r.adcode]),Wt}return ri({},e)}),getCityConfig=(s,...r)=>ei(exports,[s,...r],function*(c,e=b){const T=geojsonCn.adcodeMap[c],de=yield window.fetch(e+`/geojson/json-lite/${c}.json`).then(Je=>Je.json()),Xe=turf.bbox(de),{name:Ke}=geojsonCn.adcodeMap[c];return{center:[T.lng,T.lat],adcode:T.adcode,bbox:Xe,jsonName:ec(Ke,`${c}`)}}),removeCameraHistory=c=>c.filter(e=>!(e.objectUuid==="camera"&&["SetPosition","SetTarget"].includes(e.type))),access={set token(c){accessToken.token=c}},VERSION=version;exports.Base=Base;exports.City=City$1;exports.Earth=index$1;exports.Earth2=index;exports.Map=Map$2;exports.Map2=index$2;exports.THREE=THREE;exports.TWEEN=tween_esm;exports.VERSION=VERSION;exports.access=access;exports.animationUtils=animation;exports.extendMapConfig=extendMapConfig;exports.getCityConfig=getCityConfig;exports.getMap2Config=getMap2Config;exports.getMap2WithCityConfig=getMap2WithCityConfig;exports.getMapConfig=getMapConfig;exports.removeCameraHistory=removeCameraHistory;
5683
+ `)},Ke.needsUpdate=!0)}}setAreaEmissiveByProperty(s,r,T,de=1){if(!this.map)return;const Xe=this.map.areaArr.find(Ke=>Ke.userData[s]===r);Xe&&this.map.setAreaEmissive(Xe,T,de)}setLineColorByProperty(s,r,T){if(!this.map)return;const de=this.map.lineArr.find(Xe=>Xe.userData[s]===r);de&&this.map.setLineColor(de,T)}addAreaPlaneByProperty(s,r,T){return ei(this,null,function*(){if(!this.map)return;const Xe=this.map.options.geojson.features.find(Ke=>Ke.properties&&Ke.properties[s]===r);if(Xe)return this.drawController.draw("Countries",{geojson:{type:"FeatureCollection",features:[Xe]},depth:this.options.mapDepth+.3,start:this.options.radius,mats:{topMat:new MeshBasicMaterial(T.area),outLine:new it$1(T.line)}})})}checkBehindEarth(s,r,T){const de=new Vector3(0,0,0),Xe=new Vector3(0,0,0),Ke=this.options.radius,Je=()=>{const Qe=s();if(!Qe.length)return;this.pencil.controls.getPosition(Xe,!1);const _e=de.clone().sub(Xe),$e=Math.sqrt(Math.pow(_e.length(),2)-Math.pow(Ke,2)),qe=[],st=[];Qe.forEach(dt=>{dt.position.clone().sub(Xe).length()>$e?qe.push(dt):st.push(dt)}),r(qe,st)};Je(),T&&this.pencil.controls.addEventListener(T,()=>{Je()})}addBar(s){this.removeBar();const r=this.drawController.getObject("CrossPlane",{key:s.replace(/.*[#_]/,"")});if(!r)return;const T=["中国","泰国","缅甸","菲律宾","日本","柬埔寨","印度","美国","阿联酋","马来西亚","俄罗斯"];this.mapArea.filter(de=>T.includes(de.userData.NAME_CN)).forEach(de=>ei(this,null,function*(){const[Xe,Ke]=de.userData.CENTROID,Je=this.getLocationPosition([Xe,Ke],.1),Qe=yield r.instantiate();Qe.position.set(...Je),Qe.object3d.lookAt(0,0,0),this.barArr.push(Qe)}))}removeBar(){this.barArr.forEach(s=>{s.erase()}),this.barArr.length=0}};H0(fn,"VisName","earth");let index$1=fn;class Earth extends Sphere{create(){const e=this.pencil.getPlugin("loader"),s=e.getAsset("/image/earth2/basic.jpg"),r=e.getAsset("/image/earth2/NormalMap.jpg"),T=new MeshStandardMaterial({map:s,metalness:.1,roughness:.8,normalMap:r,normalScale:new Vector2(.5,.5)});this.material=T,super.create(),this.pencil.installPlugins.get("materialList").setObject3d(this.object3d,"earth")}}const objs=zi(ri({},objs$5),{Earth}),PENCIL_CONFIG={camera:{near:1,far:3e3,fov:12}},gn=class gn extends Base{constructor(){super(...arguments);H0(this,"leftTruck",!1);H0(this,"drawController",new Rl(objs));H0(this,"autoRotateSpeed",0);H0(this,"initSettingsObj",{autoRotate:!1})}setOptions(s){super.setOptions(ri({},s)),this.pencilConfig=PENCIL_CONFIG}loaderAdd(){this.loader.add(["/image/earth2/basic.jpg","/image/earth2/NormalMap.jpg","/image/earth2/BEIJING.png","/image/earth2/earth_circle.png","/image/earth2/earth_blue.png","/image/earth2/expose_point.png"])}initVis(){return ei(this,null,function*(){yield Promise.all([this.drawController.draw("Light",{type:"PointLight",intensity:4,color:16777215,distance:0,decay:0}),this.drawController.draw("Earth")])})}show(){super.show(),this.animationIn()}handleSetting(s,r){return ei(this,null,function*(){return yield on(gn.prototype,this,"handleSetting").call(this,s,r),s==="autoRotate"&&this.playing&&(r?this.autoRotateSpeed=-20:this.autoRotateSpeed=0,this.pencil.autoRotate(this.autoRotateSpeed)),r})}animationIn(){return ei(this,null,function*(){const s=this.pencil.controls;s.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),s.addEventListener("controlend",()=>{this.pencil.autoRotate(this.autoRotateSpeed)})})}getLocationPosition(s,r=0){const[T,de]=s,Xe=this.drawController.getObject("Earth").radius+r;return o$1(T,de,Xe)}dispose(){super.dispose(),this.pencil.dispose()}};H0(gn,"VisName","earth2");let index=gn;const ec=(c,e)=>{const s=stringToUtf8ByteArray(c),r=stringToUtf8ByteArray(e).map(function(T,de){return T^s[Math.floor(de%s.length)]}).join(",");return btoa(r)};function stringToUtf8ByteArray(c){const e=[];let s=0;for(let r=0;r<c.length;r++){let T=c.charCodeAt(r);T<128?e[s++]=T:T<2048?(e[s++]=T>>6|192,e[s++]=T&63|128):(T&64512)==55296&&r+1<c.length&&(c.charCodeAt(r+1)&64512)==56320?(T=65536+((T&1023)<<10)+(c.charCodeAt(++r)&1023),e[s++]=T>>18|240,e[s++]=T>>12&63|128,e[s++]=T>>6&63|128,e[s++]=T&63|128):(e[s++]=T>>12|224,e[s++]=T>>6&63|128,e[s++]=T&63|128)}return e}let b="/";b==="/"&&(b="");const getMapConfig=(r,...T)=>ei(exports,[r,...T],function*(c,e=b,s){if(c===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const de=geojsonCn.adcodeMap[c];return extendMapConfig("map",{center:[de.lng,de.lat],adcode:de.adcode},e,s)}}),getMap2Config=(r,...T)=>ei(exports,[r,...T],function*(c,e=b,s){const de=geojsonCn.adcodeMap[c];return extendMapConfig("map2",{center:[de.lng,de.lat],adcode:de.adcode,parentBg:de.adcode!==1e5},e,s)}),getMap2WithCityConfig=(r,...T)=>ei(exports,[r,...T],function*(c,e=b,s){const de=geojsonCn.adcodeMap[c];return extendMapConfig("map2",{center:[de.lng,de.lat],adcode:de.adcode,showOneLevel:!0,allCity:de.level==="province",cityOnMap:!0,parentBg:!1,mapDepth:.004,bottomPlane:!1},e,s)}),extendMapConfig=(T,de,...Xe)=>ei(exports,[T,de,...Xe],function*(c,e,s=b,r){var Ke,Je;if(e.adcode!==0&&e.adcode!==1e5){const Qe=(Ke=e.fixGeojson)==null?void 0:Ke[e.adcode],_e=(Je=e.fixGeojson)==null?void 0:Je[e.adcode+"-lite"];let{res:$e}=yield jsonFetch(s+`/geojson/${Qe||"json"}/${e.adcode}.json`);const{res:qe}=yield jsonFetch(s+`/geojson/${_e||"json-lite"}/${e.adcode}.json`),st=turf.bbox(qe),dt=e.adcode,Wt=zi(ri({},e),{geojsonMap:{[dt]:$e},extrudeLineGeojsonMap:{[dt]:qe},bboxMap:{[dt]:st},cityBboxMap:{},jsonNameObj:{},depthReference:void 0});if(c==="map2"){if(!(geojsonCn.adcodeMap[dt].level==="province")){let rt=geojsonCn.adcodeMap[dt].parent;for(;geojsonCn.adcodeMap[rt].level!=="province";)rt=geojsonCn.adcodeMap[rt].parent;const{res:Zt}=yield jsonFetch(s+`/geojson/${Qe||"json"}/${rt}.json`);$e=Zt}$e.features.forEach(rt=>{Wt.cityBboxMap[rt.properties.adcode]=turf.bbox(rt),Wt.jsonNameObj[rt.properties.adcode]=ec(rt.properties.name,`${rt.properties.adcode}`)})}if(e.parentBg){const Yt=geojsonCn.adcodeMap[dt].parent;if(Yt!==1e5){const{res:rt}=yield jsonFetch(s+`/geojson/json/${Yt}.json`),{res:Zt}=yield jsonFetch(s+`/geojson/json-lite/${Yt}.json`);Wt.geojsonMap[Yt]=rt,Wt.extrudeLineGeojsonMap[Yt]=Zt,Wt.bboxMap[Yt]=turf.bbox(Zt)}}return r&&(Wt.depthReference=r.depthReference||r.bboxMap[r.adcode]),Wt}return ri({},e)}),getCityConfig=(s,...r)=>ei(exports,[s,...r],function*(c,e=b){const T=geojsonCn.adcodeMap[c],de=yield window.fetch(e+`/geojson/json-lite/${c}.json`).then(Je=>Je.json()),Xe=turf.bbox(de),{name:Ke}=geojsonCn.adcodeMap[c];return{center:[T.lng,T.lat],adcode:T.adcode,bbox:Xe,jsonName:ec(Ke,`${c}`)}}),removeCameraHistory=c=>c.filter(e=>!(e.objectUuid==="camera"&&["SetPosition","SetTarget"].includes(e.type))),access={set token(c){accessToken.token=c}},VERSION=version;exports.Base=Base;exports.City=City$1;exports.Earth=index$1;exports.Earth2=index;exports.Map=Map$2;exports.Map2=index$2;exports.THREE=THREE;exports.TWEEN=tween_esm;exports.VERSION=VERSION;exports.access=access;exports.animationUtils=animation;exports.extendMapConfig=extendMapConfig;exports.getCityConfig=getCityConfig;exports.getMap2Config=getMap2Config;exports.getMap2WithCityConfig=getMap2WithCityConfig;exports.getMapConfig=getMapConfig;exports.removeCameraHistory=removeCameraHistory;
@@ -90,7 +90,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
90
90
  ).toString(CryptoJS.enc.Utf8), qe = JSON.parse($e), st = Date.now();
91
91
  return !qe.s || qe.s > st ? (this.token = void 0, "") : qe.e && qe.e < st ? (this.token = void 0, "") : (qe.isValid = Qe, qe);
92
92
  }
93
- }, version = "0.22.9";
93
+ }, version = "0.22.10";
94
94
  /**
95
95
  * @license
96
96
  * Copyright 2010-2024 Three.js Authors
@@ -129204,14 +129204,10 @@ const objs = zi(ri({}, objs$5), {
129204
129204
  animationIn() {
129205
129205
  return ei(this, null, function* () {
129206
129206
  const s = this.pencil.controls;
129207
- s.setPosition(0, 0, 1800, !1), yield s.rotatePolarTo(1.046, !1);
129208
- const r = this.drawController.getObject("Light"), T = new Vector3();
129209
- s.getPosition(T), r.position.copy(T), s.addEventListener("controlstart", () => {
129207
+ s.addEventListener("controlstart", () => {
129210
129208
  this.pencil.autoRotate(0);
129211
129209
  }), s.addEventListener("controlend", () => {
129212
129210
  this.pencil.autoRotate(this.autoRotateSpeed);
129213
- }), s.addEventListener("update", () => {
129214
- s.getPosition(T, !1), r.position.copy(T);
129215
129211
  });
129216
129212
  });
129217
129213
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.22.9";
1
+ declare const _default: "0.22.10";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.22.9",
3
+ "version": "0.22.10",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && bundler",