vis-core 0.30.0-beta.3 → 0.30.0-beta.4
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 +17 -7
- package/dist/version.d.ts +1 -1
- package/dist/vis/earth/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document!="undefined"){var t=document.createElement("style");t.appendChild(document.createTextNode(".-translate-x-1\\/2,.-translate-y-1\\/2,.transform{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1 }.shadow{--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.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))}.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)}.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 kn=Object.defineProperty,Kn=Object.defineProperties;var Yn=Object.getOwnPropertyDescriptors;var In=Object.getOwnPropertySymbols,Hn=Object.getPrototypeOf,Un=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,On=Reflect.get;var Cn=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),Dn=o=>{throw TypeError(o)},fn=Math.pow,En=(o,e,n)=>e in o?kn(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,q0=(o,e)=>{for(var n in e||(e={}))Un.call(e,n)&&En(o,n,e[n]);if(In)for(var n of In(e))Bn.call(e,n)&&En(o,n,e[n]);return o},Bi=(o,e)=>Kn(o,Yn(e));var v0=(o,e,n)=>En(o,typeof e!="symbol"?e+"":e,n);var xn=(o,e,n)=>On(Hn(o),n,e);var A0=(o,e,n)=>new Promise((r,w)=>{var E=le=>{try{j(n.next(le))}catch(fe){w(fe)}},O=le=>{try{j(n.throw(le))}catch(fe){w(fe)}},j=le=>le.done?r(le.value):Promise.resolve(le.value).then(E,O);j((n=n.apply(o,e)).next())}),Jn=function(o,e){this[0]=o,this[1]=e};var zn=o=>{var e=o[Cn("asyncIterator")],n=!1,r,w={};return e==null?(e=o[Cn("iterator")](),r=E=>w[E]=O=>e[E](O)):(e=e.call(o),r=E=>w[E]=O=>{if(n){if(n=!1,E==="throw")throw O;return O}return n=!0,{done:!1,value:new Jn(new Promise(j=>{var le=e[E](O);le instanceof Object||Dn("Object expected"),j(le)}),1)}}),w[Cn("iterator")]=()=>w,r("next"),"throw"in e?r("throw"):w.throw=E=>{throw E},"return"in e&&r("return"),w},Nn=(o,e,n)=>(e=o[Cn("asyncIterator")])?e.call(o):(o=o[Cn("iterator")](),e={},n=(r,w)=>(w=o[r])&&(e[r]=E=>new Promise((O,j,le)=>(E=w.call(o,E),le=E.done,Promise.resolve(E.value).then(fe=>O({value:fe,done:le}),j)))),n("next"),n("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),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"),turf=require("@turf/turf"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(o){return o<0&&(o=this.length+o),this[o]});const version="0.30.0-beta.3",publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[o,e,n]=this.token.split(":::"),r=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),w=CryptoJS.enc.Base64.parse(e),E=CryptoJS.enc.Base64.parse(n),O=CryptoJS.lib.WordArray.create(w.words.slice(0,4)),j=CryptoJS.lib.WordArray.create(w.words.slice(4)),le=jsrsasign.KJUR.crypto.Util.hashHex(w.toString(),"sha256"),fe=r.verifyWithMessageHashPSS(le,jsrsasign.b64tohex(o),"sha256",32);if(!fe)return this.token=void 0,"";const ze=CryptoJS.AES.decrypt({ciphertext:j},E,{iv:O,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Fe=JSON.parse(ze),ke=Date.now();return!Fe.s||Fe.s>ke?(this.token=void 0,""):Fe.e&&Fe.e<ke?(this.token=void 0,""):(Fe.isValid=fe,Fe)}};var Easing=Object.freeze({Linear:Object.freeze({None:function(o){return o},In:function(o){return o},Out:function(o){return o},InOut:function(o){return o}}),Quadratic:Object.freeze({In:function(o){return o*o},Out:function(o){return o*(2-o)},InOut:function(o){return(o*=2)<1?.5*o*o:-.5*(--o*(o-2)-1)}}),Cubic:Object.freeze({In:function(o){return o*o*o},Out:function(o){return--o*o*o+1},InOut:function(o){return(o*=2)<1?.5*o*o*o:.5*((o-=2)*o*o+2)}}),Quartic:Object.freeze({In:function(o){return o*o*o*o},Out:function(o){return 1- --o*o*o*o},InOut:function(o){return(o*=2)<1?.5*o*o*o*o:-.5*((o-=2)*o*o*o-2)}}),Quintic:Object.freeze({In:function(o){return o*o*o*o*o},Out:function(o){return--o*o*o*o*o+1},InOut:function(o){return(o*=2)<1?.5*o*o*o*o*o:.5*((o-=2)*o*o*o*o+2)}}),Sinusoidal:Object.freeze({In:function(o){return 1-Math.sin((1-o)*Math.PI/2)},Out:function(o){return Math.sin(o*Math.PI/2)},InOut:function(o){return .5*(1-Math.sin(Math.PI*(.5-o)))}}),Exponential:Object.freeze({In:function(o){return o===0?0:Math.pow(1024,o-1)},Out:function(o){return o===1?1:1-Math.pow(2,-10*o)},InOut:function(o){return o===0?0:o===1?1:(o*=2)<1?.5*Math.pow(1024,o-1):.5*(-Math.pow(2,-10*(o-1))+2)}}),Circular:Object.freeze({In:function(o){return 1-Math.sqrt(1-o*o)},Out:function(o){return Math.sqrt(1- --o*o)},InOut:function(o){return(o*=2)<1?-.5*(Math.sqrt(1-o*o)-1):.5*(Math.sqrt(1-(o-=2)*o)+1)}}),Elastic:Object.freeze({In:function(o){return o===0?0:o===1?1:-Math.pow(2,10*(o-1))*Math.sin((o-1.1)*5*Math.PI)},Out:function(o){return o===0?0:o===1?1:Math.pow(2,-10*o)*Math.sin((o-.1)*5*Math.PI)+1},InOut:function(o){return o===0?0:o===1?1:(o*=2,o<1?-.5*Math.pow(2,10*(o-1))*Math.sin((o-1.1)*5*Math.PI):.5*Math.pow(2,-10*(o-1))*Math.sin((o-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(o){var e=1.70158;return o===1?1:o*o*((e+1)*o-e)},Out:function(o){var e=1.70158;return o===0?0:--o*o*((e+1)*o+e)+1},InOut:function(o){var e=2.5949095;return(o*=2)<1?.5*(o*o*((e+1)*o-e)):.5*((o-=2)*o*((e+1)*o+e)+2)}}),Bounce:Object.freeze({In:function(o){return 1-Easing.Bounce.Out(1-o)},Out:function(o){return o<1/2.75?7.5625*o*o:o<2/2.75?7.5625*(o-=1.5/2.75)*o+.75:o<2.5/2.75?7.5625*(o-=2.25/2.75)*o+.9375:7.5625*(o-=2.625/2.75)*o+.984375},InOut:function(o){return o<.5?Easing.Bounce.In(o*2)*.5:Easing.Bounce.Out(o*2-1)*.5+.5}}),generatePow:function(o){return o===void 0&&(o=4),o=o<Number.EPSILON?Number.EPSILON:o,o=o>1e4?1e4:o,{In:function(e){return Math.pow(e,o)},Out:function(e){return 1-Math.pow(1-e,o)},InOut:function(e){return e<.5?Math.pow(e*2,o)/2:(1-Math.pow(2-e*2,o))/2+.5}}}}),now=function(){return performance.now()},Group$1=function(){function o(){this._tweens={},this._tweensAddedDuringUpdate={}}return o.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(n){return e._tweens[n]})},o.prototype.removeAll=function(){this._tweens={}},o.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},o.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},o.prototype.update=function(e,n){e===void 0&&(e=now()),n===void 0&&(n=!1);var r=Object.keys(this._tweens);if(r.length===0)return!1;for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var w=0;w<r.length;w++){var E=this._tweens[r[w]],O=!n;E&&E.update(e,O)===!1&&!n&&delete this._tweens[r[w]]}r=Object.keys(this._tweensAddedDuringUpdate)}return!0},o}(),Interpolation={Linear:function(o,e){var n=o.length-1,r=n*e,w=Math.floor(r),E=Interpolation.Utils.Linear;return e<0?E(o[0],o[1],r):e>1?E(o[n],o[n-1],n-r):E(o[w],o[w+1>n?n:w+1],r-w)},Bezier:function(o,e){for(var n=0,r=o.length-1,w=Math.pow,E=Interpolation.Utils.Bernstein,O=0;O<=r;O++)n+=w(1-e,r-O)*w(e,O)*o[O]*E(r,O);return n},CatmullRom:function(o,e){var n=o.length-1,r=n*e,w=Math.floor(r),E=Interpolation.Utils.CatmullRom;return o[0]===o[n]?(e<0&&(w=Math.floor(r=n*(1+e))),E(o[(w-1+n)%n],o[w],o[(w+1)%n],o[(w+2)%n],r-w)):e<0?o[0]-(E(o[0],o[0],o[1],o[1],-r)-o[0]):e>1?o[n]-(E(o[n],o[n],o[n-1],o[n-1],r-n)-o[n]):E(o[w?w-1:0],o[w],o[n<w+1?n:w+1],o[n<w+2?n:w+2],r-w)},Utils:{Linear:function(o,e,n){return(e-o)*n+o},Bernstein:function(o,e){var n=Interpolation.Utils.Factorial;return n(o)/n(e)/n(o-e)},Factorial:function(){var o=[1];return function(e){var n=1;if(o[e])return o[e];for(var r=e;r>1;r--)n*=r;return o[e]=n,n}}(),CatmullRom:function(o,e,n,r,w){var E=(n-o)*.5,O=(r-e)*.5,j=w*w,le=w*j;return(2*e-2*n+E+O)*le+(-3*e+3*n-2*E-O)*j+E*w+e}}},Sequence=function(){function o(){}return o.nextId=function(){return o._nextId++},o._nextId=0,o}(),mainGroup=new Group$1,Tween=function(){function o(e,n){n===void 0&&(n=mainGroup),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Easing.Linear.None,this._interpolationFunction=Interpolation.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Sequence.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return o.prototype.getId=function(){return this._id},o.prototype.isPlaying=function(){return this._isPlaying},o.prototype.isPaused=function(){return this._isPaused},o.prototype.getDuration=function(){return this._duration},o.prototype.to=function(e,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},o.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},o.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},o.prototype.start=function(e,n){if(e===void 0&&(e=now()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var w={};for(var E in this._valuesEnd)w[E]=this._valuesEnd[E];this._valuesEnd=w}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},o.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},o.prototype._setupProperties=function(e,n,r,w,E){for(var O in r){var j=e[O],le=Array.isArray(j),fe=le?"array":typeof j,Se=!le&&Array.isArray(r[O]);if(!(fe==="undefined"||fe==="function")){if(Se){var ze=r[O];if(ze.length===0)continue;for(var Fe=[j],ke=0,mt=ze.length;ke<mt;ke+=1){var Lt=this._handleRelativeValue(j,ze[ke]);if(isNaN(Lt)){Se=!1,console.warn("Found invalid interpolation list. Skipping.");break}Fe.push(Lt)}Se&&(r[O]=Fe)}if((fe==="object"||le)&&j&&!Se){n[O]=le?[]:{};var Gt=j;for(var Ue in Gt)n[O][Ue]=Gt[Ue];w[O]=le?[]:{};var ze=r[O];if(!this._isDynamic){var xt={};for(var Ue in ze)xt[Ue]=ze[Ue];r[O]=ze=xt}this._setupProperties(Gt,n[O],ze,w[O],E)}else(typeof n[O]=="undefined"||E)&&(n[O]=j),le||(n[O]*=1),Se?w[O]=r[O].slice().reverse():w[O]=n[O]||0}}},o.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},o.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},o.prototype.pause=function(e){return e===void 0&&(e=now()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},o.prototype.resume=function(e){return e===void 0&&(e=now()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},o.prototype.stopChainedTweens=function(){for(var e=0,n=this._chainedTweens.length;e<n;e++)this._chainedTweens[e].stop();return this},o.prototype.group=function(e){return e===void 0&&(e=mainGroup),this._group=e,this},o.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},o.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},o.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},o.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},o.prototype.easing=function(e){return e===void 0&&(e=Easing.Linear.None),this._easingFunction=e,this},o.prototype.interpolation=function(e){return e===void 0&&(e=Interpolation.Linear),this._interpolationFunction=e,this},o.prototype.chain=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this._chainedTweens=e,this},o.prototype.onStart=function(e){return this._onStartCallback=e,this},o.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},o.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},o.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},o.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},o.prototype.onStop=function(e){return this._onStopCallback=e,this},o.prototype.update=function(e,n){var r;if(e===void 0&&(e=now()),n===void 0&&(n=!0),this._isPaused)return!0;var w=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>w)return!1;n&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var E=e-this._startTime,O=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),j=this._duration+this._repeat*O,le=this._calculateElapsedPortion(E,O,j),fe=this._easingFunction(le),Se=this._calculateCompletionStatus(E,O);if(Se==="repeat"&&this._processRepetition(E,O),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,fe),Se==="about-to-repeat"&&this._processRepetition(E,O),this._onUpdateCallback&&this._onUpdateCallback(this._object,le),Se==="repeat"||Se==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(Se==="completed"){this._isPlaying=!1,this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var ze=0,Fe=this._chainedTweens.length;ze<Fe;ze++)this._chainedTweens[ze].start(this._startTime+this._duration,!1)}return Se!=="completed"},o.prototype._calculateElapsedPortion=function(e,n,r){if(this._duration===0||e>r)return 1;var w=e%n,E=Math.min(w/this._duration,1);return E===0&&e!==0&&e%this._duration===0?1:E},o.prototype._calculateCompletionStatus=function(e,n){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},o.prototype._processRepetition=function(e,n){var r=Math.min(Math.trunc((e-this._duration)/n)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=r);for(var w in this._valuesStartRepeat){var E=this._valuesEnd[w];!this._yoyo&&typeof E=="string"&&(this._valuesStartRepeat[w]=this._valuesStartRepeat[w]+parseFloat(E)),this._yoyo&&this._swapEndStartRepeatValues(w),this._valuesStart[w]=this._valuesStartRepeat[w]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=n*r},o.prototype._updateProperties=function(e,n,r,w){for(var E in r)if(n[E]!==void 0){var O=n[E]||0,j=r[E],le=Array.isArray(e[E]),fe=Array.isArray(j),Se=!le&&fe;Se?e[E]=this._interpolationFunction(j,w):typeof j=="object"&&j?this._updateProperties(e[E],O,j,w):(j=this._handleRelativeValue(O,j),typeof j=="number"&&(e[E]=O+(j-O)*w))}},o.prototype._handleRelativeValue=function(e,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?e+parseFloat(n):parseFloat(n)},o.prototype._swapEndStartRepeatValues=function(e){var n=this._valuesStartRepeat[e],r=this._valuesEnd[e];typeof r=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(r):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=n},o}(),VERSION$1="23.1.2",nextId=Sequence.nextId,TWEEN=mainGroup,getAll=TWEEN.getAll.bind(TWEEN),removeAll=TWEEN.removeAll.bind(TWEEN),add=TWEEN.add.bind(TWEEN),remove=TWEEN.remove.bind(TWEEN),update=TWEEN.update.bind(TWEEN),exports$1={Easing,Group:Group$1,Interpolation,now,Sequence,nextId,Tween,VERSION:VERSION$1,getAll,removeAll,add,remove,update};const tween_esm=Object.freeze(Object.defineProperty({__proto__:null,Easing,Group:Group$1,Interpolation,Sequence,Tween,VERSION:VERSION$1,add,default:exports$1,getAll,nextId,now,remove,removeAll,update},Symbol.toStringTag,{value:"Module"}));/**
|
|
2
|
+
"use strict";var kn=Object.defineProperty,Kn=Object.defineProperties;var Yn=Object.getOwnPropertyDescriptors;var In=Object.getOwnPropertySymbols,Hn=Object.getPrototypeOf,Un=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,On=Reflect.get;var Cn=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),Dn=o=>{throw TypeError(o)},fn=Math.pow,En=(o,e,n)=>e in o?kn(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,q0=(o,e)=>{for(var n in e||(e={}))Un.call(e,n)&&En(o,n,e[n]);if(In)for(var n of In(e))Bn.call(e,n)&&En(o,n,e[n]);return o},Bi=(o,e)=>Kn(o,Yn(e));var v0=(o,e,n)=>En(o,typeof e!="symbol"?e+"":e,n);var xn=(o,e,n)=>On(Hn(o),n,e);var A0=(o,e,n)=>new Promise((r,w)=>{var E=le=>{try{j(n.next(le))}catch(fe){w(fe)}},O=le=>{try{j(n.throw(le))}catch(fe){w(fe)}},j=le=>le.done?r(le.value):Promise.resolve(le.value).then(E,O);j((n=n.apply(o,e)).next())}),Jn=function(o,e){this[0]=o,this[1]=e};var zn=o=>{var e=o[Cn("asyncIterator")],n=!1,r,w={};return e==null?(e=o[Cn("iterator")](),r=E=>w[E]=O=>e[E](O)):(e=e.call(o),r=E=>w[E]=O=>{if(n){if(n=!1,E==="throw")throw O;return O}return n=!0,{done:!1,value:new Jn(new Promise(j=>{var le=e[E](O);le instanceof Object||Dn("Object expected"),j(le)}),1)}}),w[Cn("iterator")]=()=>w,r("next"),"throw"in e?r("throw"):w.throw=E=>{throw E},"return"in e&&r("return"),w},Nn=(o,e,n)=>(e=o[Cn("asyncIterator")])?e.call(o):(o=o[Cn("iterator")](),e={},n=(r,w)=>(w=o[r])&&(e[r]=E=>new Promise((O,j,le)=>(E=w.call(o,E),le=E.done,Promise.resolve(E.value).then(fe=>O({value:fe,done:le}),j)))),n("next"),n("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),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"),turf=require("@turf/turf"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(o){return o<0&&(o=this.length+o),this[o]});const version="0.30.0-beta.4",publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[o,e,n]=this.token.split(":::"),r=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),w=CryptoJS.enc.Base64.parse(e),E=CryptoJS.enc.Base64.parse(n),O=CryptoJS.lib.WordArray.create(w.words.slice(0,4)),j=CryptoJS.lib.WordArray.create(w.words.slice(4)),le=jsrsasign.KJUR.crypto.Util.hashHex(w.toString(),"sha256"),fe=r.verifyWithMessageHashPSS(le,jsrsasign.b64tohex(o),"sha256",32);if(!fe)return this.token=void 0,"";const ze=CryptoJS.AES.decrypt({ciphertext:j},E,{iv:O,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),Fe=JSON.parse(ze),ke=Date.now();return!Fe.s||Fe.s>ke?(this.token=void 0,""):Fe.e&&Fe.e<ke?(this.token=void 0,""):(Fe.isValid=fe,Fe)}};var Easing=Object.freeze({Linear:Object.freeze({None:function(o){return o},In:function(o){return o},Out:function(o){return o},InOut:function(o){return o}}),Quadratic:Object.freeze({In:function(o){return o*o},Out:function(o){return o*(2-o)},InOut:function(o){return(o*=2)<1?.5*o*o:-.5*(--o*(o-2)-1)}}),Cubic:Object.freeze({In:function(o){return o*o*o},Out:function(o){return--o*o*o+1},InOut:function(o){return(o*=2)<1?.5*o*o*o:.5*((o-=2)*o*o+2)}}),Quartic:Object.freeze({In:function(o){return o*o*o*o},Out:function(o){return 1- --o*o*o*o},InOut:function(o){return(o*=2)<1?.5*o*o*o*o:-.5*((o-=2)*o*o*o-2)}}),Quintic:Object.freeze({In:function(o){return o*o*o*o*o},Out:function(o){return--o*o*o*o*o+1},InOut:function(o){return(o*=2)<1?.5*o*o*o*o*o:.5*((o-=2)*o*o*o*o+2)}}),Sinusoidal:Object.freeze({In:function(o){return 1-Math.sin((1-o)*Math.PI/2)},Out:function(o){return Math.sin(o*Math.PI/2)},InOut:function(o){return .5*(1-Math.sin(Math.PI*(.5-o)))}}),Exponential:Object.freeze({In:function(o){return o===0?0:Math.pow(1024,o-1)},Out:function(o){return o===1?1:1-Math.pow(2,-10*o)},InOut:function(o){return o===0?0:o===1?1:(o*=2)<1?.5*Math.pow(1024,o-1):.5*(-Math.pow(2,-10*(o-1))+2)}}),Circular:Object.freeze({In:function(o){return 1-Math.sqrt(1-o*o)},Out:function(o){return Math.sqrt(1- --o*o)},InOut:function(o){return(o*=2)<1?-.5*(Math.sqrt(1-o*o)-1):.5*(Math.sqrt(1-(o-=2)*o)+1)}}),Elastic:Object.freeze({In:function(o){return o===0?0:o===1?1:-Math.pow(2,10*(o-1))*Math.sin((o-1.1)*5*Math.PI)},Out:function(o){return o===0?0:o===1?1:Math.pow(2,-10*o)*Math.sin((o-.1)*5*Math.PI)+1},InOut:function(o){return o===0?0:o===1?1:(o*=2,o<1?-.5*Math.pow(2,10*(o-1))*Math.sin((o-1.1)*5*Math.PI):.5*Math.pow(2,-10*(o-1))*Math.sin((o-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(o){var e=1.70158;return o===1?1:o*o*((e+1)*o-e)},Out:function(o){var e=1.70158;return o===0?0:--o*o*((e+1)*o+e)+1},InOut:function(o){var e=2.5949095;return(o*=2)<1?.5*(o*o*((e+1)*o-e)):.5*((o-=2)*o*((e+1)*o+e)+2)}}),Bounce:Object.freeze({In:function(o){return 1-Easing.Bounce.Out(1-o)},Out:function(o){return o<1/2.75?7.5625*o*o:o<2/2.75?7.5625*(o-=1.5/2.75)*o+.75:o<2.5/2.75?7.5625*(o-=2.25/2.75)*o+.9375:7.5625*(o-=2.625/2.75)*o+.984375},InOut:function(o){return o<.5?Easing.Bounce.In(o*2)*.5:Easing.Bounce.Out(o*2-1)*.5+.5}}),generatePow:function(o){return o===void 0&&(o=4),o=o<Number.EPSILON?Number.EPSILON:o,o=o>1e4?1e4:o,{In:function(e){return Math.pow(e,o)},Out:function(e){return 1-Math.pow(1-e,o)},InOut:function(e){return e<.5?Math.pow(e*2,o)/2:(1-Math.pow(2-e*2,o))/2+.5}}}}),now=function(){return performance.now()},Group$1=function(){function o(){this._tweens={},this._tweensAddedDuringUpdate={}}return o.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(n){return e._tweens[n]})},o.prototype.removeAll=function(){this._tweens={}},o.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},o.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},o.prototype.update=function(e,n){e===void 0&&(e=now()),n===void 0&&(n=!1);var r=Object.keys(this._tweens);if(r.length===0)return!1;for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var w=0;w<r.length;w++){var E=this._tweens[r[w]],O=!n;E&&E.update(e,O)===!1&&!n&&delete this._tweens[r[w]]}r=Object.keys(this._tweensAddedDuringUpdate)}return!0},o}(),Interpolation={Linear:function(o,e){var n=o.length-1,r=n*e,w=Math.floor(r),E=Interpolation.Utils.Linear;return e<0?E(o[0],o[1],r):e>1?E(o[n],o[n-1],n-r):E(o[w],o[w+1>n?n:w+1],r-w)},Bezier:function(o,e){for(var n=0,r=o.length-1,w=Math.pow,E=Interpolation.Utils.Bernstein,O=0;O<=r;O++)n+=w(1-e,r-O)*w(e,O)*o[O]*E(r,O);return n},CatmullRom:function(o,e){var n=o.length-1,r=n*e,w=Math.floor(r),E=Interpolation.Utils.CatmullRom;return o[0]===o[n]?(e<0&&(w=Math.floor(r=n*(1+e))),E(o[(w-1+n)%n],o[w],o[(w+1)%n],o[(w+2)%n],r-w)):e<0?o[0]-(E(o[0],o[0],o[1],o[1],-r)-o[0]):e>1?o[n]-(E(o[n],o[n],o[n-1],o[n-1],r-n)-o[n]):E(o[w?w-1:0],o[w],o[n<w+1?n:w+1],o[n<w+2?n:w+2],r-w)},Utils:{Linear:function(o,e,n){return(e-o)*n+o},Bernstein:function(o,e){var n=Interpolation.Utils.Factorial;return n(o)/n(e)/n(o-e)},Factorial:function(){var o=[1];return function(e){var n=1;if(o[e])return o[e];for(var r=e;r>1;r--)n*=r;return o[e]=n,n}}(),CatmullRom:function(o,e,n,r,w){var E=(n-o)*.5,O=(r-e)*.5,j=w*w,le=w*j;return(2*e-2*n+E+O)*le+(-3*e+3*n-2*E-O)*j+E*w+e}}},Sequence=function(){function o(){}return o.nextId=function(){return o._nextId++},o._nextId=0,o}(),mainGroup=new Group$1,Tween=function(){function o(e,n){n===void 0&&(n=mainGroup),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Easing.Linear.None,this._interpolationFunction=Interpolation.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Sequence.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return o.prototype.getId=function(){return this._id},o.prototype.isPlaying=function(){return this._isPlaying},o.prototype.isPaused=function(){return this._isPaused},o.prototype.getDuration=function(){return this._duration},o.prototype.to=function(e,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},o.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},o.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},o.prototype.start=function(e,n){if(e===void 0&&(e=now()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var w={};for(var E in this._valuesEnd)w[E]=this._valuesEnd[E];this._valuesEnd=w}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},o.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},o.prototype._setupProperties=function(e,n,r,w,E){for(var O in r){var j=e[O],le=Array.isArray(j),fe=le?"array":typeof j,Se=!le&&Array.isArray(r[O]);if(!(fe==="undefined"||fe==="function")){if(Se){var ze=r[O];if(ze.length===0)continue;for(var Fe=[j],ke=0,mt=ze.length;ke<mt;ke+=1){var Lt=this._handleRelativeValue(j,ze[ke]);if(isNaN(Lt)){Se=!1,console.warn("Found invalid interpolation list. Skipping.");break}Fe.push(Lt)}Se&&(r[O]=Fe)}if((fe==="object"||le)&&j&&!Se){n[O]=le?[]:{};var Gt=j;for(var Ue in Gt)n[O][Ue]=Gt[Ue];w[O]=le?[]:{};var ze=r[O];if(!this._isDynamic){var xt={};for(var Ue in ze)xt[Ue]=ze[Ue];r[O]=ze=xt}this._setupProperties(Gt,n[O],ze,w[O],E)}else(typeof n[O]=="undefined"||E)&&(n[O]=j),le||(n[O]*=1),Se?w[O]=r[O].slice().reverse():w[O]=n[O]||0}}},o.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},o.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},o.prototype.pause=function(e){return e===void 0&&(e=now()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},o.prototype.resume=function(e){return e===void 0&&(e=now()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},o.prototype.stopChainedTweens=function(){for(var e=0,n=this._chainedTweens.length;e<n;e++)this._chainedTweens[e].stop();return this},o.prototype.group=function(e){return e===void 0&&(e=mainGroup),this._group=e,this},o.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},o.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},o.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},o.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},o.prototype.easing=function(e){return e===void 0&&(e=Easing.Linear.None),this._easingFunction=e,this},o.prototype.interpolation=function(e){return e===void 0&&(e=Interpolation.Linear),this._interpolationFunction=e,this},o.prototype.chain=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this._chainedTweens=e,this},o.prototype.onStart=function(e){return this._onStartCallback=e,this},o.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},o.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},o.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},o.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},o.prototype.onStop=function(e){return this._onStopCallback=e,this},o.prototype.update=function(e,n){var r;if(e===void 0&&(e=now()),n===void 0&&(n=!0),this._isPaused)return!0;var w=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>w)return!1;n&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var E=e-this._startTime,O=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),j=this._duration+this._repeat*O,le=this._calculateElapsedPortion(E,O,j),fe=this._easingFunction(le),Se=this._calculateCompletionStatus(E,O);if(Se==="repeat"&&this._processRepetition(E,O),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,fe),Se==="about-to-repeat"&&this._processRepetition(E,O),this._onUpdateCallback&&this._onUpdateCallback(this._object,le),Se==="repeat"||Se==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(Se==="completed"){this._isPlaying=!1,this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var ze=0,Fe=this._chainedTweens.length;ze<Fe;ze++)this._chainedTweens[ze].start(this._startTime+this._duration,!1)}return Se!=="completed"},o.prototype._calculateElapsedPortion=function(e,n,r){if(this._duration===0||e>r)return 1;var w=e%n,E=Math.min(w/this._duration,1);return E===0&&e!==0&&e%this._duration===0?1:E},o.prototype._calculateCompletionStatus=function(e,n){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},o.prototype._processRepetition=function(e,n){var r=Math.min(Math.trunc((e-this._duration)/n)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=r);for(var w in this._valuesStartRepeat){var E=this._valuesEnd[w];!this._yoyo&&typeof E=="string"&&(this._valuesStartRepeat[w]=this._valuesStartRepeat[w]+parseFloat(E)),this._yoyo&&this._swapEndStartRepeatValues(w),this._valuesStart[w]=this._valuesStartRepeat[w]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=n*r},o.prototype._updateProperties=function(e,n,r,w){for(var E in r)if(n[E]!==void 0){var O=n[E]||0,j=r[E],le=Array.isArray(e[E]),fe=Array.isArray(j),Se=!le&&fe;Se?e[E]=this._interpolationFunction(j,w):typeof j=="object"&&j?this._updateProperties(e[E],O,j,w):(j=this._handleRelativeValue(O,j),typeof j=="number"&&(e[E]=O+(j-O)*w))}},o.prototype._handleRelativeValue=function(e,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?e+parseFloat(n):parseFloat(n)},o.prototype._swapEndStartRepeatValues=function(e){var n=this._valuesStartRepeat[e],r=this._valuesEnd[e];typeof r=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(r):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=n},o}(),VERSION$1="23.1.2",nextId=Sequence.nextId,TWEEN=mainGroup,getAll=TWEEN.getAll.bind(TWEEN),removeAll=TWEEN.removeAll.bind(TWEEN),add=TWEEN.add.bind(TWEEN),remove=TWEEN.remove.bind(TWEEN),update=TWEEN.update.bind(TWEEN),exports$1={Easing,Group:Group$1,Interpolation,now,Sequence,nextId,Tween,VERSION:VERSION$1,getAll,removeAll,add,remove,update};const tween_esm=Object.freeze(Object.defineProperty({__proto__:null,Easing,Group:Group$1,Interpolation,Sequence,Tween,VERSION:VERSION$1,add,default:exports$1,getAll,nextId,now,remove,removeAll,update},Symbol.toStringTag,{value:"Module"}));/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2010-2025 Three.js Authors
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -5262,7 +5262,7 @@ version 0.8.2
|
|
|
5262
5262
|
#include <tonemapping_fragment>
|
|
5263
5263
|
#include <colorspace_fragment>
|
|
5264
5264
|
#include <fog_fragment>
|
|
5265
|
-
}`},It=new ShaderMaterial({name:Wt.name,uniforms:UniformsUtils.clone(Wt.uniforms),vertexShader:Wt.vertexShader,fragmentShader:Wt.fragmentShader,lights:!0,side:fe,fog:Se});It.uniforms.mirrorSampler.value=Vt.texture,It.uniforms.textureMatrix.value=Zt,It.uniforms.alpha.value=w,It.uniforms.normalSampler.value=E,It.uniforms.waterColor.value=O,It.uniforms.distortionScale.value=le,It.uniforms.eye.value=j;const Nt=o.material;o.material=It,o.onBeforeRender=function(Ft,Ht,i0){Nt.color!==It.uniforms.waterColor.value&&(It.uniforms.waterColor.value=Nt.color),ke.setFromMatrixPosition(o.matrixWorld),mt.setFromMatrixPosition(i0.matrixWorld),Lt.extractRotation(o.matrixWorld),Fe.set(0,0,1),Fe.applyMatrix4(Lt),xt.subVectors(ke,mt),i0.updateMatrix(),i0.updateMatrixWorld(),o.updateMatrix(),o.updateMatrixWorld();const n0=new Frustum,qt=new Matrix4;if(qt.multiplyMatrices(i0.projectionMatrix,i0.matrixWorldInverse),n0.setFromProjectionMatrix(qt),!n0.intersectsObject(o)||xt.dot(Fe)>0)return;xt.reflect(Fe).negate(),xt.add(ke),Lt.extractRotation(i0.matrixWorld),Gt.set(0,0,-1),Gt.applyMatrix4(Lt),Gt.add(mt),bt.subVectors(ke,Gt),bt.reflect(Fe).negate(),bt.add(ke),wt.position.copy(xt),wt.up.set(0,1,0),wt.up.applyMatrix4(Lt),wt.up.reflect(Fe),wt.lookAt(bt),wt.far=i0.far,wt.updateMatrixWorld(),wt.projectionMatrix.copy(i0.projectionMatrix),Zt.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),Zt.multiply(wt.projectionMatrix),Zt.multiply(wt.matrixWorldInverse),ze.setFromNormalAndCoplanarPoint(Fe,ke),ze.applyMatrix4(wt.matrixWorldInverse),Ue.set(ze.normal.x,ze.normal.y,ze.normal.z,ze.constant);const Kt=wt.projectionMatrix;Xt.x=(Math.sign(Ue.x)+Kt.elements[8])/Kt.elements[0],Xt.y=(Math.sign(Ue.y)+Kt.elements[9])/Kt.elements[5],Xt.z=-1,Xt.w=(1+Kt.elements[10])/Kt.elements[14],Ue.multiplyScalar(2/Ue.dot(Xt)),Kt.elements[2]=Ue.x,Kt.elements[6]=Ue.y,Kt.elements[10]=Ue.z+1,Kt.elements[14]=Ue.w,j.setFromMatrixPosition(i0.matrixWorld);const $t=Ft.getRenderTarget(),kt=Ft.xr.enabled,e0=Ft.shadowMap.autoUpdate;o.visible=!1,Ft.xr.enabled=!1,Ft.shadowMap.autoUpdate=!1,Ft.setRenderTarget(Vt),Ft.state.buffers.depth.setMask(!0),Ft.autoClear===!1&&Ft.clear(),Ft.render(Ht,wt),o.visible=!0,Ft.xr.enabled=kt,Ft.shadowMap.autoUpdate=e0,Ft.setRenderTarget($t);const h0=i0.viewport;h0!==void 0&&Ft.state.viewport(h0)}};class City$1 extends Base{constructor(){super(...arguments);v0(this,"leadObjs",objs$2);v0(this,"adcode",0);v0(this,"pcenter",[104,37.5]);v0(this,"pscale",5e4);v0(this,"projection");v0(this,"group");v0(this,"outAreaGroup");v0(this,"building");v0(this,"road");v0(this,"multiplyScalar",1)}setOptions(n){super.setOptions(q0({fitTo:!0,plane:!0,grey:!1,showBuilding:!0,showRoad:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,ssao:!0,buildingHasSide:!0},n))}loaderAdd(){this.loader.add(["/image/city/20-1.jpg","/image/city/60-1.jpg","/image/city/max-1.jpg","/image/city/cylinder.webp","/image/city/20.webp","/image/city/60.webp","/image/city/max.webp"])}loaderAddJson(n){this.loader.add([this.options.showBuilding&&`/cityGzip/Building${n}.json.gzip`,this.options.showRoad&&`/cityGzip/Road${n}.json.gzip`,this.options.showRiver&&`/cityGzip/River${n}.json.gzip`,this.options.showGrassland&&`/cityGzip/Grassland${n}.json.gzip`].filter(Boolean),{})}initMaterial(){return A0(this,null,function*(){if(this.mList.get("city-plane-mat")){console.log("city-plane-mat exist");return}if(this.options.showBuilding){const n=["20","60","max"].reduce((w,E)=>{const O=this.loader.getAsset(`/image/city/${E}-1.jpg`),j=this.loader.getAsset(`/image/city/${E}.webp`);return w[E]=[new MeshBasicMaterial({name:"建筑顶面-板块内"+E+"高",color:"#00a3bc"}),new MeshStandardMaterial({name:"建筑侧面-板块内"+E+"高",map:O,normalMap:j,envMap:this.getRoomEnvMap()})],[O,j].forEach(le=>{le.wrapS=RepeatWrapping,le.wrapT=RepeatWrapping,le.repeat.set(1,1)}),w},{});this.mList.addMultiple("building",{"20Top":n[20][0],"20Side":n[20][1],"60Top":n[60][0],"60Side":n[60][1],maxTop:n.max[0],maxSide:n.max[1]});const r=["20","60","max"].reduce((w,E)=>{const O=this.loader.getAsset(`/image/city/${E}-1.jpg`),j=this.loader.getAsset(`/image/city/${E}.webp`);return w[E]=[new MeshBasicMaterial({name:"建筑顶面-板块外"+E+"高",color:"#133144"}),new MeshStandardMaterial({name:"建筑侧面-块外"+E+"高",map:O,normalMap:j,envMap:this.getRoomEnvMap()})],[O,j].forEach(le=>{le.wrapS=RepeatWrapping,le.wrapT=RepeatWrapping,le.repeat.set(1,1)}),w},{});this.mList.addMultiple("building-grey",{"20Top":r[20][0],"20Side":r[20][1],"60Top":r[60][0],"60Side":r[60][1],maxTop:r.max[0],maxSide:r.max[1]})}if(this.options.showRoad){const n=new Ot$2({name:"道路-板块内",color:"#ffc457",sizeAttenuation:!1,lineWidth:12}),r=new Ot$2({name:"道路-板块外",color:"#4a3f15",sizeAttenuation:!1,lineWidth:12});this.mList.addMultiple("road",{primary:n}),this.mList.addMultiple("road-grey",{primary:r})}(this.options.showRiver||this.options.showGrassland)&&(this.mList.addMultiple("geography",{river:new MeshBasicMaterial({name:"河流-板块内",color:"#115d8a"}),grassland:new MeshBasicMaterial({name:"绿地-板块内",color:"#043141"})}),this.mList.addMultiple("geography-grey",{river:new MeshBasicMaterial({name:"河流-板块外",color:"#19354f"}),grassland:new MeshBasicMaterial({name:"绿地-板块外",color:"#133341"})})),this.mList.add("city-plane-mat",new MeshBasicMaterial({color:"#0b2234"}))})}disableSSAO(){const n=this.pencil.composerController.ssaoPass;n&&n.enabled&&(n.enabled=!1,console.log("disableSSAO"))}enabledSSAO(){const n=this.pencil.composerController.ssaoPass;n&&!n.enabled&&(n.enabled=!0,console.log("enabledSSAO"))}init(){return A0(this,null,function*(){this.options.jsonName||(this.options.jsonName=(yield getCityConfig(this.options.adcode)).jsonName);const{jsonName:n,adcode:r}=this.options;yield this.initPencil(),this.loaderAdd(),this.loaderAddJson(n),console.time(`vis-core:time.${this.visName}${r}-loader`),yield this.loader.loadAll(),console.timeEnd(`vis-core:time.${this.visName}${r}-loader`),this.settings.mouseLeft=Xi.SCREEN_PAN,yield this.settings.mouseLeft,this.pencil.camera.userData.up="0,0,1",this.adcode=this.options.adcode,this.options.center&&(this.pcenter=this.options.center),this.projection=f({center:this.pcenter,scale:this.pscale}),this.group=yield this.lead.draw("Group",{key:`city${r}`});const w=findAdcodeInfo(r);this.group.object3d.name=`城市-${w?w.name:r}`,this.group.scale.multiplyScalar(this.multiplyScalar),this.outAreaGroup=yield this.lead.draw("Group",{key:"$p:-out"},this.group),this.outAreaGroup.object3d.name="城市外区域",yield this.initMaterial(),yield this.initVis(),yield Promise.all(this.lead.objectsPromise)})}getInvert(n){var r,w;return(w=(r=this.projection).invert)==null?void 0:w.call(r,[n.x,-n.z])}fitTo(n,r=!0){return A0(this,null,function*(){this.pencil.controls.fitToBox(n.object3d,r),this.pencil.controls.rotatePolarTo(this.pencil.camera.up.z===1?Math.PI/180*70:Math.PI/180*160,r)})}initVis(){return A0(this,null,function*(){const{fitTo:n,jsonName:r}=this.options,w=this.adcode,E=this.loader,O=this.options.showBuilding&&E.getAsset(`/cityGzip/Building${r}.json.gzip`),j=this.options.showRoad&&E.getAsset(`/cityGzip/Road${r}.json.gzip`),le=this.options.showRiver&&E.getAsset(`/cityGzip/River${r}.json.gzip`),fe=this.options.showGrassland&&E.getAsset(`/cityGzip/Grassland${r}.json.gzip`),Se={};[...(le==null?void 0:le.features)||[],...(fe==null?void 0:fe.features)||[]].forEach(Zt=>{Zt.properties.o&&(Se[Zt.properties.o]=!0)});const ze=Object.keys(Se).map(Zt=>+Zt).sort((Zt,wt)=>Zt-wt),Fe=-f({center:this.pcenter,scale:this.pscale})([this.pcenter[0],899e-8+this.pcenter[1]])[1],ke=findAdcodeInfo(w).b,mt=this.projection([ke[0],ke[1]]),Lt=this.projection([ke[2],ke[3]]),Gt=Math.abs(Lt[0]-mt[0]),Ue=Math.abs(Lt[1]-mt[1]),xt=Gt,bt=Ue,Xt=this.mList.get("city-plane-mat");if(!this.options.grey){const Zt=yield this.lead.draw("CityPlane",{width:xt*10,height:bt*10,material:Xt},this.outAreaGroup);Zt.object3d.name="底面",this.lead.updateBaseObjectKey(Zt,{type:"city-plane"})}yield Promise.all([O&&this.drawBuilding({json:O,meters:Fe,grey:this.options.grey,sideGradient:this.options.buildingSideGradient,hasSide:this.options.buildingHasSide}),j&&this.drawRoad({json:j,meters:Fe,z:ze.length,grey:this.options.grey}),le&&this.drawArea({json:le,type:"river",oArr:ze,grey:this.options.grey}),fe&&this.drawArea({json:fe,type:"grassland",oArr:ze,grey:this.options.grey})].filter(Boolean)),this.pencil.getPlugin("worker").saveCache(),!this.tier0&&this.options.showBuilding&&this.options.ssao&&this.pencil.controls.addEventListener("update",()=>{this.pencil.controls.distance<.1?this.enabledSSAO():this.disableSSAO()})})}drawBuilding(){return A0(this,arguments,function*(n={}){if(!n.json){console.warn(" json:Building");return}const r=this.options.cacheKey?`building-${this.options.cacheKey}${n.grey?"-grey":""}${n.hasSide?"":"-no-side"}`:void 0,w=yield this.lead.draw("Building",{key:"$p:-building",projection:{center:this.pcenter,scale:this.pscale},json:n.json,cacheKey:r,meters:n.meters,sideGradient:n.sideGradient,grey:n.grey,hasSide:n.hasSide},this.group);return this.building=w,w})}drawArea(){return A0(this,arguments,function*(n={}){if(!n.json){console.warn(" json:drawGeography");return}if(!n.type)return;const{grey:r}=n,w=r?"-grey":"",E=this.options.cacheKey?`${n.type}-${this.options.cacheKey}${w}`:void 0,O=yield this.lead.draw("Area",{key:`$p:-${n.type}`,projection:{center:this.pcenter,scale:this.pscale},json:n.json,material:this.mList.getMultiple("geography"+w)[n.type],type:n.type,cacheKey:E,oArr:n.oArr},this.group);return O.object3d.name=n.type==="river"?"河流":"绿地",n.type==="river"&&!r&&this.options.setWaterMaterial&&O.area.forEach(j=>{setWaterMaterial(j.object3d)}),O})}drawRoad(){return A0(this,arguments,function*(n={}){if(!n.json){console.warn(" json:Road");return}const r=this.options.cacheKey?`road-${this.options.cacheKey}${n.grey?"-grey":""}`:void 0,w=yield this.lead.draw("Road",{key:"$p:-road",projection:{center:this.pcenter,scale:this.pscale},json:n.json,cacheKey:r,grey:n.grey,meters:n.meters},this.group),E=n.z||0;return w.position.z=(E+1)*.001,n.grey||(this.lead.updateBaseObjectKey(w,{type:"road",key:"group"}),this.initBaseObjectUserData(w)),n.grey||(this.road=w),w})}getWorldPosition(n,r){if(this.options.coordtransformFunc){const O=this.options.coordtransformFunc(n,r);n=O.longitude,r=O.latitude}const[w,E]=this.projection([n,r]);return{x:w,y:-E}}}v0(City$1,"VisName","city");const hideMaterial=new MeshBasicMaterial({colorWrite:!1,transparent:!0});let PlaneMap$1=class extends pe$1{constructor(n){var r;super();v0(this,"options");v0(this,"isActive",!0);v0(this,"groupArr",[]);v0(this,"areaArr",[]);v0(this,"lineArr");v0(this,"mergeSideArea",null);v0(this,"extrudelineArr");v0(this,"splitPolygons",0);this.options=q0({areaGroup:!0,hasSide:!0,hasTop:!0,lineOffset:0,start:0,hasLine:!0,topSegments:0,depth:2,bloom:!1,conic:!1,mergeSide:!1,onTop:0,projection:{}},n),((r=this.options.projection.rotate)==null?void 0:r[0])===-160&&(this.options.projection.projectionType==="winkel3"?this.splitPolygons=100:this.splitPolygons=300)}create(){return A0(this,null,function*(){const{geojson:n,extrudeLineGeojson:r,bbox:w,areaGroup:E,materialOptions:O,hasSide:j,hasTop:le,hasLine:fe,mergeSide:Se}=this.options;this.createGroup();const ze=this.pencil.lead;if(E){const Wt=yield Promise.all(n.features.map(It=>A0(this,null,function*(){const{properties:Nt}=It,Ft=`${this.getPropertiesKey(Nt)}`,Ht=yield ze.draw("Group",{target:this,key:Ft});return Ht.object3d.name=(Nt==null?void 0:Nt.adcode)==="100000_JD"?"十段线":Nt==null?void 0:Nt.name,Ht.userData=q0({},Nt),Ht})));this.groupArr=Wt}const{lineMat:Fe,extrudeLineMat:ke,topMat:mt,sideMat:Lt,bgTopMat:Gt,bgSideMat:Ue,bgLineMat:xt,bgExtrudeLineMat:bt}=O,[Xt,Zt,wt,Vt]=yield Promise.all([(le||le)&&this.addArea(n,{material:j?[mt,Se?hideMaterial:Lt]:mt,bbox:w,areaGroup:E,hasSide:j,hasTop:!0,castShadow:!Se,onTop:this.options.onTop}),fe&&this.addLine(n,{material:Fe,onTop:this.options.onTop+2,areaGroup:E}),r&&this.addLine(r,{material:ke,onTop:this.options.onTop+3}),Se&&r&&this.addArea(r,{material:Lt,bbox:w,castShadow:!0,areaGroup:!1,hasSide:!0,hasTop:!1,onTop:this.options.onTop})]);Vt&&(this.mergeSideArea=Vt[0],this.mergeSideArea.object3d.name="板块合并侧面"),Xt&&(this.areaArr=Xt),Zt&&(this.options.conic||Zt.forEach(Wt=>{Wt.position.z=this.options.depth+this.options.lineOffset}),this.lineArr=Zt),wt&&(wt.forEach(Wt=>{this.options.conic||(Wt.position.z=this.options.depth+this.options.lineOffset),this.lead.updateBaseObjectKey(Wt,{key:this.getPropertiesKey({name:"extrudeLine"})})}),this.extrudelineArr=wt),Gt&&Ue&&this.setAreaMaterial("bg",[Gt,Ue]),xt&&this.setLineMaterial("bg",xt),bt&&this.setExtrudeLineMaterial("bg",bt)})}addArea(n,r){return A0(this,null,function*(){const{bbox:w,material:E,onTop:O}=r,j=this.geojson2Meta(n),le=this.pencil.getPlugin("worker"),fe=this.pencil.lead;if(this.pencil.mList,r.areaGroup)return yield Promise.all(j.map(Se=>A0(this,null,function*(){const{coords:ze,properties:Fe}=Se,ke=this.findGroup(this.getPropertiesKey(Fe)),mt=this.options.conic?yield le.geoGeometry("conicPolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:w,hasBottom:!1,hasSide:r.hasSide,hasTop:r.hasTop,useGroups:r.hasSide&&r.hasTop?2:0}}):yield le.geoGeometry("extrudePolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth]),mesaage:{projection:this.options.projection,topSegments:this.options.topSegments,bbox:w,hasBottom:!1,hasSide:r.hasSide,hasTop:r.hasTop,useGroups:r.hasSide&&r.hasTop?2:0,splitPolygons:this.splitPolygons}}),Lt=`${this.getPropertiesKey(Fe)}`,Gt=yield fe.draw("ExtrudePolygon",{key:Lt,geometry:mt,material:E,onTop:O},ke);return Gt.object3d.name="板块",r!=null&&r.castShadow&&(Gt.object3d.castShadow=!0),Gt.userData=q0({},Fe),Gt})));{const Se=j.flatMap(({coords:ke})=>ke),ze=this.options.conic?yield le.geoGeometry("conicPolygon",{coordinatesArr:Se,metaArray:Se.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:w,hasBottom:!1,hasSide:r.hasSide,hasTop:r.hasTop,useGroups:2}}):yield le.geoGeometry("extrudePolygon",{coordinatesArr:Se,metaArray:Se.map(()=>[this.options.depth]),mesaage:{projection:q0({},this.options.projection),topSegments:this.options.topSegments,bbox:w,hasSide:r.hasSide,hasTop:r.hasTop,hasBottom:!1,useGroups:2,splitPolygons:this.splitPolygons}}),Fe=yield fe.draw("ExtrudePolygon",{key:this.getPropertiesKey({name:"all"}),geometry:ze,material:E},this);return r!=null&&r.castShadow&&(Fe.object3d.castShadow=!0),Fe.object3d.name="板块",Fe.userData={},[Fe]}})}addLine(n,r){return A0(this,null,function*(){const{material:w,onTop:E}=r,O=this.geojson2Meta(n),j=this.pencil.getPlugin("worker"),le=this.pencil.lead;if(r.areaGroup)return yield Promise.all(O.map(fe=>A0(this,null,function*(){const{coords:Se,properties:ze}=fe,Fe=this.findGroup(this.getPropertiesKey(ze)),ke=this.options.conic?yield j.geoGeometry("conicLine",{coordinatesArr:Se,metaArray:Se.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield j.geoGeometry("line",{coordinatesArr:Se,metaArray:Se.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),mt=`${this.getPropertiesKey(ze)}`,Lt=yield le.draw("Line",{key:mt,geometry:ke,material:w,onTop:E},Fe);return Lt.userData=q0({},ze),Lt.object3d.name="线",Lt})));{const fe=O.flatMap(({coords:Fe})=>Fe),Se=this.options.conic?yield j.geoGeometry("conicLine",{coordinatesArr:fe,metaArray:fe.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield j.geoGeometry("line",{coordinatesArr:fe,metaArray:fe.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),ze=yield le.draw("Line",{key:this.getPropertiesKey({name:"all"}),geometry:Se,material:w,onTop:E},this);return ze.object3d.name="线",[ze]}})}getPropertiesKey(n){return`${this.key.split("#")[1]}-${n.adcode||n.iso_a2||n.name}`}geojson2Meta(n){return n.features.filter(r=>r.geometry).map(r=>{const{type:w,coordinates:E}=r.geometry;let O=[];return w==="Polygon"?O=E:w==="MultiPolygon"&&(O=E.flat()),{coords:O,properties:r.properties}})}update(n,r){const{lineMat:w,extrudeLineMat:E}=this.options.materialOptions;this.isActive&&[w,E].forEach(O=>{var j;!O||!((j=O.uniforms.lineLightAnimation)!=null&&j.value)||(O.uniforms.time.value=r)})}findGroup(n,r=!1){return this.pencil.lead.getObject("Group",{key:`${r?this.getPropertiesKey({adcode:n}):n}`})}setAreaMaterial(n,r){this.areaArr.forEach(w=>{w.setMaterialList(n,this.mergeSideArea&&Array.isArray(r)?[r[0],hideMaterial]:r)}),this.mergeSideArea&&Array.isArray(r)&&this.mergeSideArea.setMaterialList(n,r[1])}useAreaMaterial(n){this.areaArr.forEach(r=>{r.useMaterial(n)}),this.mergeSideArea&&this.mergeSideArea.useMaterial(n)}setLineMaterial(n,r){this.lineArr.forEach(w=>{w.setMaterialList(n,r)})}useLineMaterial(n){this.lineArr.forEach(r=>{r.useMaterial(n)})}setExtrudeLineMaterial(n,r){var w;(w=this.extrudelineArr)==null||w.forEach(E=>{E.setMaterialList(n,r)})}useExtrudeLineMaterial(n){var r;(r=this.extrudelineArr)==null||r.forEach(w=>{w.useMaterial(n)})}changeLineAnimateParams({speed:n=.5,extrude:r=!1}){const{lineMat:w,extrudeLineMat:E}=this.options.materialOptions,O=r?E:w;if(!O)return;O.uniforms.time.value=0,O.uniforms.speed.value=n,O.uniforms.lineLightAnimation.value=1;const{size:j,min:le,max:fe}=this.getSize();O.uniforms.size.value=Math.max(j.x,j.y)/2,O.uniforms.uCenter.value=new Vector2((le.x+fe.x)/2,(le.y+fe.y)/2)}deactive(){this.isActive&&(this.options,this.isActive=!1,this.options.bloom&&this.toggleExtrudelineBloom(!1),this.useAreaMaterial("bg"),this.useLineMaterial("bg"),this.useExtrudeLineMaterial("bg"))}render(){this.options.bloom&&this.toggleExtrudelineBloom(!0)}toggleExtrudelineBloom(n){var r;(r=this.extrudelineArr)==null||r.forEach(w=>{n?w.enableBloom():w.disableBloom()})}active(){this.isActive||(this.isActive=!0,this.useAreaMaterial("origin"),this.useLineMaterial("origin"),this.useExtrudeLineMaterial("origin"),this.options.bloom&&this.toggleExtrudelineBloom(!0))}dispose(){super.dispose(),this.areaArr.length=0,this.lineArr&&(this.lineArr.length=0),this.extrudelineArr&&(this.extrudelineArr.length=0)}};class Earth extends Sphere{constructor(n){super();v0(this,"options");this.options=q0({radius:30,rotationY:0},n)}create(){const r=this.pencil.mList.get("earthMaterial");this.material=r,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class SphereShadow extends pe$1{constructor(n){super();v0(this,"options");this.options=q0({radius:30},n)}create(){return A0(this,null,function*(){const n=new SphereGeometry(this.options.radius,128,90),r=new MeshBasicMaterial;this.createMesh(n,r),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs$1=Bi(q0({},objs$3),{Earth,SphereShadow,Countries:PlaneMap$1}),base$2=o=>{o.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth2/basic.jpg","/image/earth2/NormalMap.jpg"])},o.initMaterial=function(){return A0(this,null,function*(){const e=this.loader,n=e.getAsset("/image/earth2/basic.jpg"),r=e.getAsset("/image/earth2/NormalMap.jpg"),w=new MeshStandardMaterial({name:"地球材质",map:n,metalness:.1,roughness:.8,normalMap:r,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",w)})},o.initVis=function(){return A0(this,null,function*(){o.pencil.camera.near=1,o.pencil.camera.far=3e3,o.pencil.camera.fov=12,o.pencil.camera.updateProjectionMatrix();const[e,n]=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(n.object3d,!1),e.position.copy(this.pencil.cameraPositon)})}},chinaPlate=o=>{o.extendsOptions=Bi(q0({},o.extendsOptions),{otherMapDepth:()=>o.options.otherMapDepth,copyChinaPlane:o.options.copyChinaPlane,mergeSide:()=>o.options.mergeSide}),o.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png","/image/earth/chinaNormal.webp"])},o.initVis=function(){return A0(this,null,function*(){yield this.initLight();const[,e,n]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{key:"countries",conic:!0,geojson:{type:"FeatureCollection",features:worldJson.features.filter(r=>{var w;return((w=r.properties)==null?void 0:w.name)!=="中国"})},depth:this.options.otherMapDepth,start:this.options.radius,lineOffset:.01,materialOptions:this.mList.getMultiple("world"),hasSide:!!this.options.otherMapDepth,hasTop:!!this.options.otherMapDepth,areaGroup:!1,bbox:[-180,-90,180,90]}),this.lead.draw("Countries",{key:"china",conic:!0,geojson:chinaJson,extrudeLineGeojson:chinaLiteJson,depth:this.options.mapDepth,start:this.options.radius,lineOffset:.01,materialOptions:this.mList.getMultiple("plane"),bbox:chinaBbox,mergeSide:this.options.mergeSide})]);if(e.object3d.name="世界",n.object3d.name="中国",n.extrudelineArr&&o.initBaseObjectUserData(n.extrudelineArr[0]),this.map=n,this.options.copyChinaPlane){this.options.copyChinaPlane;const r=yield this.lead.draw("Countries",{key:"chinaCopy",conic:!0,geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,materialOptions:{topMat:new MeshBasicMaterial({color:"#ffffff"})},bbox:chinaBbox,hasSide:!1,hasTop:!0,hasLine:!1,areaGroup:!1});r.object3d.name="复制中国顶面",this.lead.updateBaseObjectKey(r.children[0],{type:"chinaPlaneCopy"})}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},o.initMaterial=function(){return A0(this,null,function*(){const e=this.loader,n=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:e.getAsset("/image/earth/chinaNormal.webp")}),r=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:e.getAsset("/image/earth/chinaBorder.png")}),w=new Ot$2({name:"中国边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#59C8FF")}),E=new Ot$2({name:"世界边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#80abaf")}),O=new MeshBasicMaterial({name:"世界顶面"}),j=new MeshBasicMaterial({name:"世界侧面"}),le=e.getAsset("/image/earth/basic.webp"),fe=new MeshStandardMaterial({name:"地球材质",map:le,color:new Color$1(2397309),metalness:.84,roughness:.51}),Se=e.getAsset("/image/earth/flyline.png");Se.wrapS=RepeatWrapping,Se.wrapT=RepeatWrapping,Se.repeat.set(.5,.5);const ze=new Ot$2({name:"省份边界",map:Se,lineWidth:.6,sizeAttenuation:!1,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:n,sideMat:r,lineMat:ze,extrudeLineMat:w}),this.mList.addMultiple("world",{topMat:O,sideMat:j,lineMat:E}),this.mList.add("earthMaterial",fe)})}},countryPlate=o=>{o.initVis=function(){return A0(this,null,function*(){yield this.initLight();const[,e]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{key:"countries",conic:!0,geojson:worldJson,depth:this.options.mapDepth,start:this.options.radius,projection:{},materialOptions:this.mList.getMultiple("plane"),bbox:[-180,-90,180,90],lineOffset:.14}),this.lead.draw("SphereShadow",{radius:this.options.radius})]);this.map=e,yield this.pencil.controls.rotateTo(1.8041576242193995,1.2232045720480524,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1),this.playing&&(this.pencil.controls.minPolarAngle=this.pencil.controls.polarAngle,this.pencil.controls.maxPolarAngle=this.pencil.controls.polarAngle)})},o.initMaterial=function(){return A0(this,null,function*(){const e=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),n=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),r=new Ot$2({name:"边框线",lineWidth:1,sizeAttenuation:!1,color:new Color$1("#006aa3")}),w=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.addMultiple("plane",{topMat:n,sideMat:e,lineMat:r}),this.mList.add("earthMaterial",w)})},o.getLocationPosition=function(e,n=0){const[r,w]=e,E=this.options.mapDepth+this.options.radius+n;return p(r,w,E)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base:base$2,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),wn=class wn extends Base{constructor(){super(...arguments);v0(this,"leadObjs",objs$1);v0(this,"leftTruck",!1);v0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});v0(this,"map")}get mapArea(){return this.map.areaArr}setOptions(n){super.setOptions(q0({mapDepth:1.4,otherMapDepth:0,radius:30,style:"chinaPlate",copyChinaPlane:!1,mergeSide:!1},n)),this.initSettingsObj={autoRotateSpeed:0},styles[this.options.style](this)}handleSetting(n,r){return A0(this,null,function*(){return yield xn(wn.prototype,this,"handleSetting").call(this,n,r),n==="autoRotateSpeed"?this.pencil.autoRotate(r):n==="autoRotate"&&(r?this.settings.autoRotateSpeed=-20:this.settings.autoRotateSpeed=0),r})}show(){super.show(),this.animationIn()}animationIn(){const n=this.pencil.controls;n.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),n.addEventListener("controlend",()=>{this.pencil.autoRotate(this.settings.autoRotateSpeed)})}initLight(){return A0(this,null,function*(){const[n,r]=yield Promise.all([this.lead.draw("Light",{type:"RectAreaLight",uId:"1",color:"#E0FFFD",width:200,height:200}),this.lead.draw("Light",{type:"RectAreaLight",uId:"2",intensity:3,width:200,height:170})]);n.position.set(0,50,-100),r.position.set(0,0,150),n.object3d.lookAt(0,0,0),r.object3d.lookAt(0,0,0)})}getLocationPosition(n,r=0){const[w,E]=n,O=this.getRadius()+r;return p(w,E,O)}setAreaMaterialByProperty(n,r,w){if(!this.map)return;const E=this.map.areaArr.find(O=>O.userData[n]===r);if(E){const O=E.object3d;let j=this.mList.get("plane#topMat");w!=="origin"&&(j=O.material[0].clone(),w.color&&j.color.set(w.color),w.emissive&&(j.emissive.set(w.emissive),j.emissiveIntensity=w.emissiveIntensity||1)),O.material[0]=j}}setLineMaterialByProperty(n,r,w){if(!this.map)return;const E=this.map.lineArr.find(O=>O.userData[n]===r);if(E){const O=E.object3d;let j=this.mList.get("plane#outLine");w!=="origin"&&(j=O.material.clone(),w.color&&j.color.set(w.color),w.width&&(j.lineWidth=w.width)),O.material=j}}addAreaPlaneByProperty(n,r,w){return A0(this,null,function*(){if(!this.map)return;const O=this.map.options.geojson.features.find(j=>j.properties&&j.properties[n]===r);if(O)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[O]},depth:this.options.mapDepth+.3,start:this.options.radius,materialOptions:{topMat:new MeshBasicMaterial(w.area),lineMat:new Ot$2(w.line)}})})}getRadius(){const n=this.baseObjectByUuid("earth");return n?n.object3d.geometry.parameters.radius:0}checkBehindEarth(n,r){const w=new Vector3(0,0,0),E=new Vector3(0,0,0),O=this.getRadius(),j=()=>{const le=n();if(!le.length)return;this.pencil.controls.getPosition(E,!1);const fe=w.clone().sub(E),Se=Math.sqrt(fn(fe.length(),2)-fn(O,2)),ze=le.map(Fe=>Fe.position.clone().sub(E).length()>Se);r(le,ze)};j(),this.pencil.controls.addEventListener("update",()=>{j()})}setObjectOnSphere(n,r,w=0,E=[0,1,0]){const O=n.rotation.clone(),j=this.getLocationPosition(r,w);n.position.set(...j);const le=new Vector3(...j).normalize(),fe=new Vector3(...E);fe.applyEuler(O);const Se=new Quaternion().setFromUnitVectors(fe,le);n.object3d.applyQuaternion(Se)}};v0(wn,"VisName","earth");let index$1=wn;const timeOut=o=>A0(exports,null,function*(){const e=esusLite.makePromiseCreator();return setTimeout(()=>{e.resolve()},o),e.promise}),getTween=o=>({onUpdate:e=w=>{},onComplete:n=()=>{},backwards:r=!0}={})=>{r&&e(0);const w=new Tween({v:0});return{start:({duration:E=1e3,repeat:O=0,repeatResolve:j=1,repeatDelay:le=0}={})=>{const fe=esusLite.makePromiseCreator();let Se=0;return w.to({v:1},E).onUpdate(({v:ze})=>{e(ze)}).onComplete(()=>{e(1),n(),fe.resolve()}).onRepeat(()=>{Se++,Se>=j&&fe.resolve()}).repeat(O).repeatDelay(le).easing(o).start(),fe.promise},stop:()=>{w.stop()}}},sinusoidalInOut=getTween(Easing.Sinusoidal.InOut),baseObjectFadeIn=o=>{const e=new Set,n=new Set;o.object3d.traverse(w=>{const E=w;E.material&&(Array.isArray(E.material)?E.material:[E.material]).forEach(j=>{e.add(j)})});const r=new Map;return e.forEach(w=>{r.set(w,w.opacity),w.transparent||(n.add(w),w.transparent=!0,w.needsUpdate=!0)}),sinusoidalInOut({onUpdate:w=>{e.forEach(E=>{E.opacity=w*r.get(E)})},onComplete:()=>{n.forEach(w=>{w.transparent=!1,w.needsUpdate=!0}),e.clear(),n.clear(),r.clear()}})},baseObjectFadeOut=o=>{const e=new Set,n=new Set;o.object3d.traverse(w=>{const E=w;E.material&&(Array.isArray(E.material)?E.material:[E.material]).forEach(j=>{e.add(j)})});const r=new Map;return e.forEach(w=>{r.set(w,w.opacity),w.transparent||(n.add(w),w.transparent=!0,w.needsUpdate=!0)}),sinusoidalInOut({onUpdate:w=>{e.forEach(E=>{E.opacity=(1-w)*r.get(E)})},onComplete:()=>{e.clear(),n.clear(),r.clear()}})},baseObjectBounceIn=(o,e="z")=>{const n=e.trim().split(""),r=n.reduce((w,E)=>(w[E]=o.scale[E],w),{});return sinusoidalInOut({onUpdate:w=>{n.forEach(E=>{o.scale[E]=r[E]*w})}})},baseObjectBounce=(o,e="z",n)=>{const r=e.trim().split(""),w=r.reduce((E,O)=>(E[O]=o.scale[O],E),{});return sinusoidalInOut({onUpdate:E=>{r.forEach(O=>{o.scale[O]=w[O]+(n-w[O])*E})}})},animation=Object.freeze(Object.defineProperty({__proto__:null,baseObjectBounce,baseObjectBounceIn,baseObjectFadeIn,baseObjectFadeOut,sinusoidalInOut,timeOut},Symbol.toStringTag,{value:"Module"}));class ContinentsBg extends pe$1{constructor(n){super();v0(this,"options");v0(this,"mapArr",[]);this.options=n}create(){return A0(this,null,function*(){const{depth:n}=this.options,r=this.pencil.mList,w=this.pencil.lead,E=r.getMultiple("continents");this.createGroup(),this.object3d.name="大洲",yield Promise.all(Object.values(continentsLiteJson).map(O=>A0(this,null,function*(){const j=O.features[0],le=j.properties.adcode;if(le===10)return;const fe=turf.centroid(j).geometry.coordinates;let Se=0,ze=0,Fe=this.options.scale;const ke=30,mt=25;le===5?(Se=-ke,ze=mt,Fe=Fe*.2):le===21?(Se=0,ze=mt,Fe=Fe*.18):le===9?(Se=ke,ze=mt,Fe=Fe*.3):le===142?(Se=-ke,ze=-mt,Fe=Fe*.15):le===150?(Se=0,ze=-mt,Fe=Fe*.3):le===2&&(Se=ke,ze=-mt,Fe=Fe*.2);const Lt=yield w.draw("PlaneMap",{key:`${this.key}-${le}`,geojson:O,projection:{center:fe,scale:Fe,rotate:[0,0],projectionType:"equirectangular"},areaGroup:!1,depth:n,materialOptions:q0({},E)},this);Lt.userData.projection=f({center:fe,scale:Fe,rotate:[0,0],projectionType:"equirectangular"}),Lt.object3d.name=j.properties.name,Lt.userData.name=j.properties.name,Lt.position.set(Se,ze,0),this.mapArr.push(Lt)})))})}getPointInContinentInfo(n){var r;return(r=Object.values(continentsLiteJson).map(w=>w.features).find(w=>w[0].geometry.coordinates.some(E=>E.length?turf.booleanPointInPolygon(turf.point(n),turf.polygon(E)):!1)))==null?void 0:r[0]}getPointInContinent(n){return!!this.getPointInContinentInfo(n)}getLocationPosition(n,r){var E;const w=r||((E=this.getPointInContinentInfo(n))==null?void 0:E.properties.name);if(w){const O=this.mapArr.find(j=>j.userData.name===w);if(O){const{projection:j}=O.userData,[le,fe]=n,[Se,ze]=j([le,fe]),Fe=new Vector3(Se,-ze,this.options.depth);return Fe.applyMatrix4(O.object3d.matrixWorld),[Fe.x,Fe.y,Fe.z]}}}render(){this.lead.updateBaseObjectKey(this,{type:"continents-group"}),this.mapArr.forEach(n=>{this.lead.updateBaseObjectKey(n,{type:"continents-"+n.userData.name})})}dispose(){this.mapArr.forEach(n=>{n.dispose()}),this.mapArr.length=0}}class PlaneMap extends pe$1{constructor(n){super();v0(this,"options");v0(this,"extrudePolygon");this.options=q0({depth:2},n)}geojson2Meta(n){return n.features.filter(r=>r.geometry).map(r=>{const{type:w,coordinates:E}=r.geometry;let O=[];return w==="Polygon"?O=E:w==="MultiPolygon"&&(O=E.flat()),{coords:O,properties:r.properties}})}create(){return A0(this,null,function*(){const{geojson:n,bbox:r}=this.options,w=this.geojson2Meta(n),E=this.pencil.getPlugin("worker"),O=this.pencil.lead,le=yield this.pencil.loader.load("/1.png"),fe=w.flatMap(({coords:bt})=>bt),Se=yield E.geoGeometry("extrudePolygon",{coordinatesArr:fe,metaArray:fe.map(()=>[this.options.depth]),mesaage:{projection:q0({},this.options.projection),topSegments:100,bbox:r,hasBottom:!1,hasSide:!1}}),ze=Se.attributes.position.count;Se.setAttribute("color",new BufferAttribute(new Float32Array(ze*3),3));const Fe=this.options.depth;this.setNoise(Se,le.image,Fe);const ke=new Color$1,mt=Se.attributes.color,Lt=Se.attributes.position,Gt=new Color$1("red"),Ue=new Color$1("green");for(let bt=0;bt<ze;bt++){const Xt=Lt.getZ(bt)/Fe;ke.lerpColors(Gt,Ue,Xt),mt.setXYZ(bt,ke.r,ke.g,ke.b)}const xt=yield O.draw("ExtrudePolygon",{geometry:Se,material:new MeshStandardMaterial({flatShading:!0,vertexColors:!0})},null);xt.position.z+=.001,this.extrudePolygon=xt,this.object3d=xt.object3d})}setNoise(n,r,w=1){const E=document.createElement("canvas"),O=[];E.width=r.width,E.height=r.height;const j=E.getContext("2d");j.drawImage(r,0,0);const fe=j.getImageData(0,0,r.width,r.height).data;for(let ke=0;ke<r.height;ke++){O[ke]=[];for(let mt=0;mt<r.width;mt++){const Lt=(ke*r.width+mt)*4,Gt=fe[Lt];O[ke][mt]=Gt/255}}const Se=n.attributes.position,ze=n.attributes.uv,Fe=new Vector2;for(let ke=0;ke<Se.count;ke++){Fe.fromBufferAttribute(ze,ke);let mt=Math.round(Fe.x*r.width)-1,Lt=Math.round(Fe.y*r.height)-1;mt<0&&(mt=0),Lt<0&&(Lt=0);const Gt=O[Lt][mt];Se.setZ(ke,Gt*w)}}render(){this.mList.rmBaseObjectMap(this.extrudePolygon)}dispose(){this.extrudePolygon.dispose(),super.dispose()}}const objs=Bi(q0({},objs$3),{PlaneMap:PlaneMap$1,CityPlane,ContinentsBg,Mountain:PlaneMap});class City extends City$1{constructor(){super(...arguments);v0(this,"multiplyScalar",1/1e3)}fixNearFar(n=.01,r){this.pencil.camera.near=n*this.multiplyScalar,r&&(this.pencil.camera.far=r*this.multiplyScalar),this.pencil.camera.updateProjectionMatrix()}}const getLabelElement=o=>{const e=document.createElement("div");return o.replace(/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,""),e.classList.add("vis-map-label","absolute","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2"),e.innerHTML=`
|
|
5265
|
+
}`},It=new ShaderMaterial({name:Wt.name,uniforms:UniformsUtils.clone(Wt.uniforms),vertexShader:Wt.vertexShader,fragmentShader:Wt.fragmentShader,lights:!0,side:fe,fog:Se});It.uniforms.mirrorSampler.value=Vt.texture,It.uniforms.textureMatrix.value=Zt,It.uniforms.alpha.value=w,It.uniforms.normalSampler.value=E,It.uniforms.waterColor.value=O,It.uniforms.distortionScale.value=le,It.uniforms.eye.value=j;const Nt=o.material;o.material=It,o.onBeforeRender=function(Ft,Ht,i0){Nt.color!==It.uniforms.waterColor.value&&(It.uniforms.waterColor.value=Nt.color),ke.setFromMatrixPosition(o.matrixWorld),mt.setFromMatrixPosition(i0.matrixWorld),Lt.extractRotation(o.matrixWorld),Fe.set(0,0,1),Fe.applyMatrix4(Lt),xt.subVectors(ke,mt),i0.updateMatrix(),i0.updateMatrixWorld(),o.updateMatrix(),o.updateMatrixWorld();const n0=new Frustum,qt=new Matrix4;if(qt.multiplyMatrices(i0.projectionMatrix,i0.matrixWorldInverse),n0.setFromProjectionMatrix(qt),!n0.intersectsObject(o)||xt.dot(Fe)>0)return;xt.reflect(Fe).negate(),xt.add(ke),Lt.extractRotation(i0.matrixWorld),Gt.set(0,0,-1),Gt.applyMatrix4(Lt),Gt.add(mt),bt.subVectors(ke,Gt),bt.reflect(Fe).negate(),bt.add(ke),wt.position.copy(xt),wt.up.set(0,1,0),wt.up.applyMatrix4(Lt),wt.up.reflect(Fe),wt.lookAt(bt),wt.far=i0.far,wt.updateMatrixWorld(),wt.projectionMatrix.copy(i0.projectionMatrix),Zt.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),Zt.multiply(wt.projectionMatrix),Zt.multiply(wt.matrixWorldInverse),ze.setFromNormalAndCoplanarPoint(Fe,ke),ze.applyMatrix4(wt.matrixWorldInverse),Ue.set(ze.normal.x,ze.normal.y,ze.normal.z,ze.constant);const Kt=wt.projectionMatrix;Xt.x=(Math.sign(Ue.x)+Kt.elements[8])/Kt.elements[0],Xt.y=(Math.sign(Ue.y)+Kt.elements[9])/Kt.elements[5],Xt.z=-1,Xt.w=(1+Kt.elements[10])/Kt.elements[14],Ue.multiplyScalar(2/Ue.dot(Xt)),Kt.elements[2]=Ue.x,Kt.elements[6]=Ue.y,Kt.elements[10]=Ue.z+1,Kt.elements[14]=Ue.w,j.setFromMatrixPosition(i0.matrixWorld);const $t=Ft.getRenderTarget(),kt=Ft.xr.enabled,e0=Ft.shadowMap.autoUpdate;o.visible=!1,Ft.xr.enabled=!1,Ft.shadowMap.autoUpdate=!1,Ft.setRenderTarget(Vt),Ft.state.buffers.depth.setMask(!0),Ft.autoClear===!1&&Ft.clear(),Ft.render(Ht,wt),o.visible=!0,Ft.xr.enabled=kt,Ft.shadowMap.autoUpdate=e0,Ft.setRenderTarget($t);const h0=i0.viewport;h0!==void 0&&Ft.state.viewport(h0)}};class City$1 extends Base{constructor(){super(...arguments);v0(this,"leadObjs",objs$2);v0(this,"adcode",0);v0(this,"pcenter",[104,37.5]);v0(this,"pscale",5e4);v0(this,"projection");v0(this,"group");v0(this,"outAreaGroup");v0(this,"building");v0(this,"road");v0(this,"multiplyScalar",1)}setOptions(n){super.setOptions(q0({fitTo:!0,plane:!0,grey:!1,showBuilding:!0,showRoad:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,ssao:!0,buildingHasSide:!0},n))}loaderAdd(){this.loader.add(["/image/city/20-1.jpg","/image/city/60-1.jpg","/image/city/max-1.jpg","/image/city/cylinder.webp","/image/city/20.webp","/image/city/60.webp","/image/city/max.webp"])}loaderAddJson(n){this.loader.add([this.options.showBuilding&&`/cityGzip/Building${n}.json.gzip`,this.options.showRoad&&`/cityGzip/Road${n}.json.gzip`,this.options.showRiver&&`/cityGzip/River${n}.json.gzip`,this.options.showGrassland&&`/cityGzip/Grassland${n}.json.gzip`].filter(Boolean),{})}initMaterial(){return A0(this,null,function*(){if(this.mList.get("city-plane-mat")){console.log("city-plane-mat exist");return}if(this.options.showBuilding){const n=["20","60","max"].reduce((w,E)=>{const O=this.loader.getAsset(`/image/city/${E}-1.jpg`),j=this.loader.getAsset(`/image/city/${E}.webp`);return w[E]=[new MeshBasicMaterial({name:"建筑顶面-板块内"+E+"高",color:"#00a3bc"}),new MeshStandardMaterial({name:"建筑侧面-板块内"+E+"高",map:O,normalMap:j,envMap:this.getRoomEnvMap()})],[O,j].forEach(le=>{le.wrapS=RepeatWrapping,le.wrapT=RepeatWrapping,le.repeat.set(1,1)}),w},{});this.mList.addMultiple("building",{"20Top":n[20][0],"20Side":n[20][1],"60Top":n[60][0],"60Side":n[60][1],maxTop:n.max[0],maxSide:n.max[1]});const r=["20","60","max"].reduce((w,E)=>{const O=this.loader.getAsset(`/image/city/${E}-1.jpg`),j=this.loader.getAsset(`/image/city/${E}.webp`);return w[E]=[new MeshBasicMaterial({name:"建筑顶面-板块外"+E+"高",color:"#133144"}),new MeshStandardMaterial({name:"建筑侧面-块外"+E+"高",map:O,normalMap:j,envMap:this.getRoomEnvMap()})],[O,j].forEach(le=>{le.wrapS=RepeatWrapping,le.wrapT=RepeatWrapping,le.repeat.set(1,1)}),w},{});this.mList.addMultiple("building-grey",{"20Top":r[20][0],"20Side":r[20][1],"60Top":r[60][0],"60Side":r[60][1],maxTop:r.max[0],maxSide:r.max[1]})}if(this.options.showRoad){const n=new Ot$2({name:"道路-板块内",color:"#ffc457",sizeAttenuation:!1,lineWidth:12}),r=new Ot$2({name:"道路-板块外",color:"#4a3f15",sizeAttenuation:!1,lineWidth:12});this.mList.addMultiple("road",{primary:n}),this.mList.addMultiple("road-grey",{primary:r})}(this.options.showRiver||this.options.showGrassland)&&(this.mList.addMultiple("geography",{river:new MeshBasicMaterial({name:"河流-板块内",color:"#115d8a"}),grassland:new MeshBasicMaterial({name:"绿地-板块内",color:"#043141"})}),this.mList.addMultiple("geography-grey",{river:new MeshBasicMaterial({name:"河流-板块外",color:"#19354f"}),grassland:new MeshBasicMaterial({name:"绿地-板块外",color:"#133341"})})),this.mList.add("city-plane-mat",new MeshBasicMaterial({color:"#0b2234"}))})}disableSSAO(){const n=this.pencil.composerController.ssaoPass;n&&n.enabled&&(n.enabled=!1,console.log("disableSSAO"))}enabledSSAO(){const n=this.pencil.composerController.ssaoPass;n&&!n.enabled&&(n.enabled=!0,console.log("enabledSSAO"))}init(){return A0(this,null,function*(){this.options.jsonName||(this.options.jsonName=(yield getCityConfig(this.options.adcode)).jsonName);const{jsonName:n,adcode:r}=this.options;yield this.initPencil(),this.loaderAdd(),this.loaderAddJson(n),console.time(`vis-core:time.${this.visName}${r}-loader`),yield this.loader.loadAll(),console.timeEnd(`vis-core:time.${this.visName}${r}-loader`),this.settings.mouseLeft=Xi.SCREEN_PAN,yield this.settings.mouseLeft,this.pencil.camera.userData.up="0,0,1",this.adcode=this.options.adcode,this.options.center&&(this.pcenter=this.options.center),this.projection=f({center:this.pcenter,scale:this.pscale}),this.group=yield this.lead.draw("Group",{key:`city${r}`});const w=findAdcodeInfo(r);this.group.object3d.name=`城市-${w?w.name:r}`,this.group.scale.multiplyScalar(this.multiplyScalar),this.outAreaGroup=yield this.lead.draw("Group",{key:"$p:-out"},this.group),this.outAreaGroup.object3d.name="城市外区域",yield this.initMaterial(),yield this.initVis(),yield Promise.all(this.lead.objectsPromise)})}getInvert(n){var r,w;return(w=(r=this.projection).invert)==null?void 0:w.call(r,[n.x,-n.z])}fitTo(n,r=!0){return A0(this,null,function*(){this.pencil.controls.fitToBox(n.object3d,r),this.pencil.controls.rotatePolarTo(this.pencil.camera.up.z===1?Math.PI/180*70:Math.PI/180*160,r)})}initVis(){return A0(this,null,function*(){const{fitTo:n,jsonName:r}=this.options,w=this.adcode,E=this.loader,O=this.options.showBuilding&&E.getAsset(`/cityGzip/Building${r}.json.gzip`),j=this.options.showRoad&&E.getAsset(`/cityGzip/Road${r}.json.gzip`),le=this.options.showRiver&&E.getAsset(`/cityGzip/River${r}.json.gzip`),fe=this.options.showGrassland&&E.getAsset(`/cityGzip/Grassland${r}.json.gzip`),Se={};[...(le==null?void 0:le.features)||[],...(fe==null?void 0:fe.features)||[]].forEach(Zt=>{Zt.properties.o&&(Se[Zt.properties.o]=!0)});const ze=Object.keys(Se).map(Zt=>+Zt).sort((Zt,wt)=>Zt-wt),Fe=-f({center:this.pcenter,scale:this.pscale})([this.pcenter[0],899e-8+this.pcenter[1]])[1],ke=findAdcodeInfo(w).b,mt=this.projection([ke[0],ke[1]]),Lt=this.projection([ke[2],ke[3]]),Gt=Math.abs(Lt[0]-mt[0]),Ue=Math.abs(Lt[1]-mt[1]),xt=Gt,bt=Ue,Xt=this.mList.get("city-plane-mat");if(!this.options.grey){const Zt=yield this.lead.draw("CityPlane",{width:xt*10,height:bt*10,material:Xt},this.outAreaGroup);Zt.object3d.name="底面",this.lead.updateBaseObjectKey(Zt,{type:"city-plane"})}yield Promise.all([O&&this.drawBuilding({json:O,meters:Fe,grey:this.options.grey,sideGradient:this.options.buildingSideGradient,hasSide:this.options.buildingHasSide}),j&&this.drawRoad({json:j,meters:Fe,z:ze.length,grey:this.options.grey}),le&&this.drawArea({json:le,type:"river",oArr:ze,grey:this.options.grey}),fe&&this.drawArea({json:fe,type:"grassland",oArr:ze,grey:this.options.grey})].filter(Boolean)),this.pencil.getPlugin("worker").saveCache(),!this.tier0&&this.options.showBuilding&&this.options.ssao&&this.pencil.controls.addEventListener("update",()=>{this.pencil.controls.distance<.1?this.enabledSSAO():this.disableSSAO()})})}drawBuilding(){return A0(this,arguments,function*(n={}){if(!n.json){console.warn(" json:Building");return}const r=this.options.cacheKey?`building-${this.options.cacheKey}${n.grey?"-grey":""}${n.hasSide?"":"-no-side"}`:void 0,w=yield this.lead.draw("Building",{key:"$p:-building",projection:{center:this.pcenter,scale:this.pscale},json:n.json,cacheKey:r,meters:n.meters,sideGradient:n.sideGradient,grey:n.grey,hasSide:n.hasSide},this.group);return this.building=w,w})}drawArea(){return A0(this,arguments,function*(n={}){if(!n.json){console.warn(" json:drawGeography");return}if(!n.type)return;const{grey:r}=n,w=r?"-grey":"",E=this.options.cacheKey?`${n.type}-${this.options.cacheKey}${w}`:void 0,O=yield this.lead.draw("Area",{key:`$p:-${n.type}`,projection:{center:this.pcenter,scale:this.pscale},json:n.json,material:this.mList.getMultiple("geography"+w)[n.type],type:n.type,cacheKey:E,oArr:n.oArr},this.group);return O.object3d.name=n.type==="river"?"河流":"绿地",n.type==="river"&&!r&&this.options.setWaterMaterial&&O.area.forEach(j=>{setWaterMaterial(j.object3d)}),O})}drawRoad(){return A0(this,arguments,function*(n={}){if(!n.json){console.warn(" json:Road");return}const r=this.options.cacheKey?`road-${this.options.cacheKey}${n.grey?"-grey":""}`:void 0,w=yield this.lead.draw("Road",{key:"$p:-road",projection:{center:this.pcenter,scale:this.pscale},json:n.json,cacheKey:r,grey:n.grey,meters:n.meters},this.group),E=n.z||0;return w.position.z=(E+1)*.001,n.grey||(this.lead.updateBaseObjectKey(w,{type:"road",key:"group"}),this.initBaseObjectUserData(w)),n.grey||(this.road=w),w})}getWorldPosition(n,r){if(this.options.coordtransformFunc){const O=this.options.coordtransformFunc(n,r);n=O.longitude,r=O.latitude}const[w,E]=this.projection([n,r]);return{x:w,y:-E}}}v0(City$1,"VisName","city");const hideMaterial=new MeshBasicMaterial({colorWrite:!1,transparent:!0});let PlaneMap$1=class extends pe$1{constructor(n){var r;super();v0(this,"options");v0(this,"isActive",!0);v0(this,"groupArr",[]);v0(this,"areaArr",[]);v0(this,"lineArr");v0(this,"mergeSideArea",null);v0(this,"extrudelineArr");v0(this,"splitPolygons",0);this.options=q0({areaGroup:!0,hasSide:!0,hasTop:!0,lineOffset:0,start:0,hasLine:!0,topSegments:0,depth:2,bloom:!1,conic:!1,mergeSide:!1,onTop:0,projection:{}},n),((r=this.options.projection.rotate)==null?void 0:r[0])===-160&&(this.options.projection.projectionType==="winkel3"?this.splitPolygons=100:this.splitPolygons=300)}create(){return A0(this,null,function*(){const{geojson:n,extrudeLineGeojson:r,bbox:w,areaGroup:E,materialOptions:O,hasSide:j,hasTop:le,hasLine:fe,mergeSide:Se}=this.options;this.createGroup();const ze=this.pencil.lead;if(E){const Wt=yield Promise.all(n.features.map(It=>A0(this,null,function*(){const{properties:Nt}=It,Ft=`${this.getPropertiesKey(Nt)}`,Ht=yield ze.draw("Group",{target:this,key:Ft});return Ht.object3d.name=(Nt==null?void 0:Nt.adcode)==="100000_JD"?"十段线":Nt==null?void 0:Nt.name,Ht.userData=q0({},Nt),Ht})));this.groupArr=Wt}const{lineMat:Fe,extrudeLineMat:ke,topMat:mt,sideMat:Lt,bgTopMat:Gt,bgSideMat:Ue,bgLineMat:xt,bgExtrudeLineMat:bt}=O,[Xt,Zt,wt,Vt]=yield Promise.all([(le||le)&&this.addArea(n,{material:j?[mt,Se?hideMaterial:Lt]:mt,bbox:w,areaGroup:E,hasSide:j,hasTop:!0,castShadow:!Se,onTop:this.options.onTop}),fe&&this.addLine(n,{material:Fe,onTop:this.options.onTop+2,areaGroup:E}),r&&this.addLine(r,{material:ke,onTop:this.options.onTop+3}),Se&&r&&this.addArea(r,{material:Lt,bbox:w,castShadow:!0,areaGroup:!1,hasSide:!0,hasTop:!1,onTop:this.options.onTop})]);Vt&&(this.mergeSideArea=Vt[0],this.mergeSideArea.object3d.name="板块合并侧面"),Xt&&(this.areaArr=Xt),Zt&&(this.options.conic||Zt.forEach(Wt=>{Wt.position.z=this.options.depth+this.options.lineOffset}),this.lineArr=Zt),wt&&(wt.forEach(Wt=>{this.options.conic||(Wt.position.z=this.options.depth+this.options.lineOffset),this.lead.updateBaseObjectKey(Wt,{key:this.getPropertiesKey({name:"extrudeLine"})})}),this.extrudelineArr=wt),Gt&&Ue&&this.setAreaMaterial("bg",[Gt,Ue]),xt&&this.setLineMaterial("bg",xt),bt&&this.setExtrudeLineMaterial("bg",bt)})}addArea(n,r){return A0(this,null,function*(){const{bbox:w,material:E,onTop:O}=r,j=this.geojson2Meta(n),le=this.pencil.getPlugin("worker"),fe=this.pencil.lead;if(this.pencil.mList,r.areaGroup)return yield Promise.all(j.map(Se=>A0(this,null,function*(){const{coords:ze,properties:Fe}=Se,ke=this.findGroup(this.getPropertiesKey(Fe)),mt=this.options.conic?yield le.geoGeometry("conicPolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:w,hasBottom:!1,hasSide:r.hasSide,hasTop:r.hasTop,useGroups:r.hasSide&&r.hasTop?2:0}}):yield le.geoGeometry("extrudePolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth]),mesaage:{projection:this.options.projection,topSegments:this.options.topSegments,bbox:w,hasBottom:!1,hasSide:r.hasSide,hasTop:r.hasTop,useGroups:r.hasSide&&r.hasTop?2:0,splitPolygons:this.splitPolygons}}),Lt=`${this.getPropertiesKey(Fe)}`,Gt=yield fe.draw("ExtrudePolygon",{key:Lt,geometry:mt,material:E,onTop:O},ke);return Gt.object3d.name="板块",r!=null&&r.castShadow&&(Gt.object3d.castShadow=!0),Gt.userData=q0({},Fe),Gt})));{const Se=j.flatMap(({coords:ke})=>ke),ze=this.options.conic?yield le.geoGeometry("conicPolygon",{coordinatesArr:Se,metaArray:Se.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:w,hasBottom:!1,hasSide:r.hasSide,hasTop:r.hasTop,useGroups:2}}):yield le.geoGeometry("extrudePolygon",{coordinatesArr:Se,metaArray:Se.map(()=>[this.options.depth]),mesaage:{projection:q0({},this.options.projection),topSegments:this.options.topSegments,bbox:w,hasSide:r.hasSide,hasTop:r.hasTop,hasBottom:!1,useGroups:2,splitPolygons:this.splitPolygons}}),Fe=yield fe.draw("ExtrudePolygon",{key:this.getPropertiesKey({name:"all"}),geometry:ze,material:E},this);return r!=null&&r.castShadow&&(Fe.object3d.castShadow=!0),Fe.object3d.name="板块",Fe.userData={},[Fe]}})}addLine(n,r){return A0(this,null,function*(){const{material:w,onTop:E}=r,O=this.geojson2Meta(n),j=this.pencil.getPlugin("worker"),le=this.pencil.lead;if(r.areaGroup)return yield Promise.all(O.map(fe=>A0(this,null,function*(){const{coords:Se,properties:ze}=fe,Fe=this.findGroup(this.getPropertiesKey(ze)),ke=this.options.conic?yield j.geoGeometry("conicLine",{coordinatesArr:Se,metaArray:Se.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield j.geoGeometry("line",{coordinatesArr:Se,metaArray:Se.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),mt=`${this.getPropertiesKey(ze)}`,Lt=yield le.draw("Line",{key:mt,geometry:ke,material:w,onTop:E},Fe);return Lt.userData=q0({},ze),Lt.object3d.name="线",Lt})));{const fe=O.flatMap(({coords:Fe})=>Fe),Se=this.options.conic?yield j.geoGeometry("conicLine",{coordinatesArr:fe,metaArray:fe.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield j.geoGeometry("line",{coordinatesArr:fe,metaArray:fe.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),ze=yield le.draw("Line",{key:this.getPropertiesKey({name:"all"}),geometry:Se,material:w,onTop:E},this);return ze.object3d.name="线",[ze]}})}getPropertiesKey(n){return`${this.key.split("#")[1]}-${n.adcode||n.iso_a2||n.name}`}geojson2Meta(n){return n.features.filter(r=>r.geometry).map(r=>{const{type:w,coordinates:E}=r.geometry;let O=[];return w==="Polygon"?O=E:w==="MultiPolygon"&&(O=E.flat()),{coords:O,properties:r.properties}})}update(n,r){const{lineMat:w,extrudeLineMat:E}=this.options.materialOptions;this.isActive&&[w,E].forEach(O=>{var j;!O||!((j=O.uniforms.lineLightAnimation)!=null&&j.value)||(O.uniforms.time.value=r)})}findGroup(n,r=!1){return this.pencil.lead.getObject("Group",{key:`${r?this.getPropertiesKey({adcode:n}):n}`})}setAreaMaterial(n,r){this.areaArr.forEach(w=>{w.setMaterialList(n,this.mergeSideArea&&Array.isArray(r)?[r[0],hideMaterial]:r)}),this.mergeSideArea&&Array.isArray(r)&&this.mergeSideArea.setMaterialList(n,r[1])}useAreaMaterial(n){this.areaArr.forEach(r=>{r.useMaterial(n)}),this.mergeSideArea&&this.mergeSideArea.useMaterial(n)}setLineMaterial(n,r){this.lineArr.forEach(w=>{w.setMaterialList(n,r)})}useLineMaterial(n){this.lineArr.forEach(r=>{r.useMaterial(n)})}setExtrudeLineMaterial(n,r){var w;(w=this.extrudelineArr)==null||w.forEach(E=>{E.setMaterialList(n,r)})}useExtrudeLineMaterial(n){var r;(r=this.extrudelineArr)==null||r.forEach(w=>{w.useMaterial(n)})}changeLineAnimateParams({speed:n=.5,extrude:r=!1}){const{lineMat:w,extrudeLineMat:E}=this.options.materialOptions,O=r?E:w;if(!O)return;O.uniforms.time.value=0,O.uniforms.speed.value=n,O.uniforms.lineLightAnimation.value=1;const{size:j,min:le,max:fe}=this.getSize();O.uniforms.size.value=Math.max(j.x,j.y)/2,O.uniforms.uCenter.value=new Vector2((le.x+fe.x)/2,(le.y+fe.y)/2)}deactive(){this.isActive&&(this.options,this.isActive=!1,this.options.bloom&&this.toggleExtrudelineBloom(!1),this.useAreaMaterial("bg"),this.useLineMaterial("bg"),this.useExtrudeLineMaterial("bg"))}render(){this.options.bloom&&this.toggleExtrudelineBloom(!0)}toggleExtrudelineBloom(n){var r;(r=this.extrudelineArr)==null||r.forEach(w=>{n?w.enableBloom():w.disableBloom()})}active(){this.isActive||(this.isActive=!0,this.useAreaMaterial("origin"),this.useLineMaterial("origin"),this.useExtrudeLineMaterial("origin"),this.options.bloom&&this.toggleExtrudelineBloom(!0))}dispose(){super.dispose(),this.areaArr.length=0,this.lineArr&&(this.lineArr.length=0),this.extrudelineArr&&(this.extrudelineArr.length=0)}};class Earth extends Sphere{constructor(n){super();v0(this,"options");this.options=q0({radius:30,rotationY:0},n)}create(){const r=this.pencil.mList.get("earthMaterial");this.material=r,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class SphereShadow extends pe$1{constructor(n){super();v0(this,"options");this.options=q0({radius:30},n)}create(){return A0(this,null,function*(){const n=new SphereGeometry(this.options.radius,128,90),r=new MeshBasicMaterial;this.createMesh(n,r),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs$1=Bi(q0({},objs$3),{Earth,SphereShadow,Countries:PlaneMap$1}),base$2=o=>{o.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth2/basic.jpg","/image/earth2/NormalMap.jpg"])},o.initMaterial=function(){return A0(this,null,function*(){const e=this.loader,n=e.getAsset("/image/earth2/basic.jpg"),r=e.getAsset("/image/earth2/NormalMap.jpg"),w=new MeshStandardMaterial({name:"地球材质",map:n,metalness:.1,roughness:.8,normalMap:r,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",w)})},o.initVis=function(){return A0(this,null,function*(){o.pencil.camera.near=1,o.pencil.camera.far=3e3,o.pencil.camera.fov=12,o.pencil.camera.updateProjectionMatrix();const[e,n]=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(n.object3d,!1),e.position.copy(this.pencil.cameraPositon)})}},chinaPlate=o=>{o.extendsOptions=Bi(q0({},o.extendsOptions),{otherMapDepth:()=>o.options.otherMapDepth,copyChinaPlane:o.options.copyChinaPlane,mergeSide:()=>o.options.mergeSide}),o.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png","/image/earth/chinaNormal.webp"])},o.initVis=function(){return A0(this,null,function*(){yield this.initLight();const[,e,n]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{key:"countries",conic:!0,geojson:{type:"FeatureCollection",features:worldJson.features.filter(r=>{var w;return((w=r.properties)==null?void 0:w.name)!=="中国"})},depth:this.options.otherMapDepth,start:this.options.radius,lineOffset:.01,materialOptions:this.mList.getMultiple("world"),hasSide:!!this.options.otherMapDepth,hasTop:!!this.options.otherMapDepth,areaGroup:!1,bbox:[-180,-90,180,90]}),this.lead.draw("Countries",{key:"china",conic:!0,geojson:chinaJson,extrudeLineGeojson:chinaLiteJson,depth:this.options.mapDepth,start:this.options.radius,lineOffset:.01,materialOptions:this.mList.getMultiple("plane"),bbox:chinaBbox,mergeSide:this.options.mergeSide})]);if(e.object3d.name="世界",n.object3d.name="中国",n.extrudelineArr&&o.initBaseObjectUserData(n.extrudelineArr[0]),this.map=n,this.options.copyChinaPlane){this.options.copyChinaPlane;const r=yield this.lead.draw("Countries",{key:"chinaCopy",conic:!0,geojson:chinaJson,depth:this.options.mapDepth,start:this.options.radius,materialOptions:{topMat:new MeshBasicMaterial({color:"#ffffff"})},bbox:chinaBbox,hasSide:!1,hasTop:!0,hasLine:!1,areaGroup:!1});r.object3d.name="复制中国顶面",this.lead.updateBaseObjectKey(r.children[0],{type:"chinaPlaneCopy"})}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},o.initMaterial=function(){return A0(this,null,function*(){const e=this.loader,n=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:e.getAsset("/image/earth/chinaNormal.webp")}),r=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:e.getAsset("/image/earth/chinaBorder.png")}),w=new Ot$2({name:"中国边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#59C8FF")}),E=new Ot$2({name:"世界边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#80abaf")}),O=new MeshBasicMaterial({name:"世界顶面"}),j=new MeshBasicMaterial({name:"世界侧面"}),le=e.getAsset("/image/earth/basic.webp"),fe=new MeshStandardMaterial({name:"地球材质",map:le,color:new Color$1(2397309),metalness:.84,roughness:.51}),Se=e.getAsset("/image/earth/flyline.png");Se.wrapS=RepeatWrapping,Se.wrapT=RepeatWrapping,Se.repeat.set(.5,.5);const ze=new Ot$2({name:"省份边界",map:Se,lineWidth:.6,sizeAttenuation:!1,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:n,sideMat:r,lineMat:ze,extrudeLineMat:w}),this.mList.addMultiple("world",{topMat:O,sideMat:j,lineMat:E}),this.mList.add("earthMaterial",fe)})}},countryPlate=o=>{o.initVis=function(){return A0(this,null,function*(){yield this.initLight();const[,e]=yield Promise.all([this.lead.draw("Earth",{radius:this.options.radius,rotationY:Math.PI/180*-90}),this.lead.draw("Countries",{key:"countries",conic:!0,geojson:worldJson,depth:this.options.mapDepth,start:this.options.radius,projection:{},materialOptions:this.mList.getMultiple("plane"),bbox:[-180,-90,180,90],lineOffset:.14}),this.lead.draw("SphereShadow",{radius:this.options.radius})]);this.map=e,yield this.pencil.controls.rotateTo(1.8041576242193995,1.2232045720480524,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1),this.playing&&(this.pencil.controls.minPolarAngle=this.pencil.controls.polarAngle,this.pencil.controls.maxPolarAngle=this.pencil.controls.polarAngle)})},o.initMaterial=function(){return A0(this,null,function*(){const e=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),n=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),r=new Ot$2({name:"边框线",lineWidth:1,sizeAttenuation:!1,color:new Color$1("#006aa3")}),w=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.addMultiple("plane",{topMat:n,sideMat:e,lineMat:r}),this.mList.add("earthMaterial",w)})},o.getLocationPosition=function(e,n=0){const[r,w]=e,E=this.options.mapDepth+this.options.radius+n;return p(r,w,E)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base:base$2,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),wn=class wn extends Base{constructor(){super(...arguments);v0(this,"leadObjs",objs$1);v0(this,"leftTruck",!1);v0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});v0(this,"map")}get mapArea(){return this.map.areaArr}setOptions(n){super.setOptions(q0({mapDepth:1.4,otherMapDepth:0,radius:30,style:"chinaPlate",copyChinaPlane:!1,mergeSide:!1},n)),this.initSettingsObj={autoRotateSpeed:0},styles[this.options.style](this)}handleSetting(n,r){return A0(this,null,function*(){return yield xn(wn.prototype,this,"handleSetting").call(this,n,r),n==="autoRotateSpeed"?this.pencil.autoRotate(r):n==="autoRotate"&&(r?this.settings.autoRotateSpeed=-20:this.settings.autoRotateSpeed=0),r})}show(){super.show(),this.animationIn()}animationIn(){const n=this.pencil.controls;n.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),n.addEventListener("controlend",()=>{this.pencil.autoRotate(this.settings.autoRotateSpeed)})}initLight(){return A0(this,null,function*(){const[n,r]=yield Promise.all([this.lead.draw("Light",{type:"RectAreaLight",uId:"1",color:"#E0FFFD",width:200,height:200}),this.lead.draw("Light",{type:"RectAreaLight",uId:"2",intensity:3,width:200,height:170})]);n.position.set(0,50,-100),r.position.set(0,0,150),n.object3d.lookAt(0,0,0),r.object3d.lookAt(0,0,0)})}getLocationPosition(n,r=0){const[w,E]=n,O=this.getRadius()+r;return p(w,E,O)}setAreaMaterialByProperty(n,r,w){if(!this.map)return;const E=this.map.areaArr.find(O=>O.userData[n]===r);if(E){const O=E.object3d;let j=this.mList.get("plane#topMat");w!=="origin"&&(j=O.material[0].clone(),w.color&&j.color.set(w.color),w.emissive&&(j.emissive.set(w.emissive),j.emissiveIntensity=w.emissiveIntensity||1)),O.material[0]=j}}setLineMaterialByProperty(n,r,w){if(!this.map)return;const E=this.map.lineArr.find(O=>O.userData[n]===r);if(E){const O=E.object3d;let j=this.mList.get("plane#outLine");w!=="origin"&&(j=O.material.clone(),w.color&&j.color.set(w.color),w.width&&(j.lineWidth=w.width)),O.material=j}}addAreaPlaneByProperty(n,r,w){return A0(this,null,function*(){if(!this.map)return;const O=this.map.options.geojson.features.find(j=>j.properties&&j.properties[n]===r);if(O)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[O]},depth:this.options.mapDepth+.3,start:this.options.radius,materialOptions:{topMat:new MeshBasicMaterial(w.area),lineMat:new Ot$2(w.line)}})})}getRadius(){const n=this.baseObjectByUuid("earth");return n?n.object3d.geometry.parameters.radius:0}checkBehindEarth(n,r){const w=new Vector3(0,0,0),E=new Vector3(0,0,0),O=this.getRadius(),j=()=>{const le=n();if(!le.length)return;this.pencil.controls.getPosition(E,!1);const fe=w.clone().sub(E),Se=Math.sqrt(fn(fe.length(),2)-fn(O,2)),ze=le.map(Fe=>Fe.position.clone().sub(E).length()>Se);r(le,ze)};j(),this.pencil.controls.addEventListener("update",()=>{j()})}setObjectOnSphere(n,r,w=0,E=[0,1,0]){if(n.objectType==="Plane"){const O=this.getLocationPosition(r,w);n.position.set(...O);const j=n.object3d.material;j&&(j.side=DoubleSide),n.object3d.lookAt(0,0,0)}else{const O=n.rotation.clone(),j=this.getLocationPosition(r,w);n.position.set(...j);const le=new Vector3(...j).normalize(),fe=new Vector3(...E);fe.applyEuler(O);const Se=new Quaternion().setFromUnitVectors(fe,le);n.object3d.applyQuaternion(Se)}}};v0(wn,"VisName","earth");let index$1=wn;const timeOut=o=>A0(exports,null,function*(){const e=esusLite.makePromiseCreator();return setTimeout(()=>{e.resolve()},o),e.promise}),getTween=o=>({onUpdate:e=w=>{},onComplete:n=()=>{},backwards:r=!0}={})=>{r&&e(0);const w=new Tween({v:0});return{start:({duration:E=1e3,repeat:O=0,repeatResolve:j=1,repeatDelay:le=0}={})=>{const fe=esusLite.makePromiseCreator();let Se=0;return w.to({v:1},E).onUpdate(({v:ze})=>{e(ze)}).onComplete(()=>{e(1),n(),fe.resolve()}).onRepeat(()=>{Se++,Se>=j&&fe.resolve()}).repeat(O).repeatDelay(le).easing(o).start(),fe.promise},stop:()=>{w.stop()}}},sinusoidalInOut=getTween(Easing.Sinusoidal.InOut),baseObjectFadeIn=o=>{const e=new Set,n=new Set;o.object3d.traverse(w=>{const E=w;E.material&&(Array.isArray(E.material)?E.material:[E.material]).forEach(j=>{e.add(j)})});const r=new Map;return e.forEach(w=>{r.set(w,w.opacity),w.transparent||(n.add(w),w.transparent=!0,w.needsUpdate=!0)}),sinusoidalInOut({onUpdate:w=>{e.forEach(E=>{E.opacity=w*r.get(E)})},onComplete:()=>{n.forEach(w=>{w.transparent=!1,w.needsUpdate=!0}),e.clear(),n.clear(),r.clear()}})},baseObjectFadeOut=o=>{const e=new Set,n=new Set;o.object3d.traverse(w=>{const E=w;E.material&&(Array.isArray(E.material)?E.material:[E.material]).forEach(j=>{e.add(j)})});const r=new Map;return e.forEach(w=>{r.set(w,w.opacity),w.transparent||(n.add(w),w.transparent=!0,w.needsUpdate=!0)}),sinusoidalInOut({onUpdate:w=>{e.forEach(E=>{E.opacity=(1-w)*r.get(E)})},onComplete:()=>{e.clear(),n.clear(),r.clear()}})},baseObjectBounceIn=(o,e="z")=>{const n=e.trim().split(""),r=n.reduce((w,E)=>(w[E]=o.scale[E],w),{});return sinusoidalInOut({onUpdate:w=>{n.forEach(E=>{o.scale[E]=r[E]*w})}})},baseObjectBounce=(o,e="z",n)=>{const r=e.trim().split(""),w=r.reduce((E,O)=>(E[O]=o.scale[O],E),{});return sinusoidalInOut({onUpdate:E=>{r.forEach(O=>{o.scale[O]=w[O]+(n-w[O])*E})}})},animation=Object.freeze(Object.defineProperty({__proto__:null,baseObjectBounce,baseObjectBounceIn,baseObjectFadeIn,baseObjectFadeOut,sinusoidalInOut,timeOut},Symbol.toStringTag,{value:"Module"}));class ContinentsBg extends pe$1{constructor(n){super();v0(this,"options");v0(this,"mapArr",[]);this.options=n}create(){return A0(this,null,function*(){const{depth:n}=this.options,r=this.pencil.mList,w=this.pencil.lead,E=r.getMultiple("continents");this.createGroup(),this.object3d.name="大洲",yield Promise.all(Object.values(continentsLiteJson).map(O=>A0(this,null,function*(){const j=O.features[0],le=j.properties.adcode;if(le===10)return;const fe=turf.centroid(j).geometry.coordinates;let Se=0,ze=0,Fe=this.options.scale;const ke=30,mt=25;le===5?(Se=-ke,ze=mt,Fe=Fe*.2):le===21?(Se=0,ze=mt,Fe=Fe*.18):le===9?(Se=ke,ze=mt,Fe=Fe*.3):le===142?(Se=-ke,ze=-mt,Fe=Fe*.15):le===150?(Se=0,ze=-mt,Fe=Fe*.3):le===2&&(Se=ke,ze=-mt,Fe=Fe*.2);const Lt=yield w.draw("PlaneMap",{key:`${this.key}-${le}`,geojson:O,projection:{center:fe,scale:Fe,rotate:[0,0],projectionType:"equirectangular"},areaGroup:!1,depth:n,materialOptions:q0({},E)},this);Lt.userData.projection=f({center:fe,scale:Fe,rotate:[0,0],projectionType:"equirectangular"}),Lt.object3d.name=j.properties.name,Lt.userData.name=j.properties.name,Lt.position.set(Se,ze,0),this.mapArr.push(Lt)})))})}getPointInContinentInfo(n){var r;return(r=Object.values(continentsLiteJson).map(w=>w.features).find(w=>w[0].geometry.coordinates.some(E=>E.length?turf.booleanPointInPolygon(turf.point(n),turf.polygon(E)):!1)))==null?void 0:r[0]}getPointInContinent(n){return!!this.getPointInContinentInfo(n)}getLocationPosition(n,r){var E;const w=r||((E=this.getPointInContinentInfo(n))==null?void 0:E.properties.name);if(w){const O=this.mapArr.find(j=>j.userData.name===w);if(O){const{projection:j}=O.userData,[le,fe]=n,[Se,ze]=j([le,fe]),Fe=new Vector3(Se,-ze,this.options.depth);return Fe.applyMatrix4(O.object3d.matrixWorld),[Fe.x,Fe.y,Fe.z]}}}render(){this.lead.updateBaseObjectKey(this,{type:"continents-group"}),this.mapArr.forEach(n=>{this.lead.updateBaseObjectKey(n,{type:"continents-"+n.userData.name})})}dispose(){this.mapArr.forEach(n=>{n.dispose()}),this.mapArr.length=0}}class PlaneMap extends pe$1{constructor(n){super();v0(this,"options");v0(this,"extrudePolygon");this.options=q0({depth:2},n)}geojson2Meta(n){return n.features.filter(r=>r.geometry).map(r=>{const{type:w,coordinates:E}=r.geometry;let O=[];return w==="Polygon"?O=E:w==="MultiPolygon"&&(O=E.flat()),{coords:O,properties:r.properties}})}create(){return A0(this,null,function*(){const{geojson:n,bbox:r}=this.options,w=this.geojson2Meta(n),E=this.pencil.getPlugin("worker"),O=this.pencil.lead,le=yield this.pencil.loader.load("/1.png"),fe=w.flatMap(({coords:bt})=>bt),Se=yield E.geoGeometry("extrudePolygon",{coordinatesArr:fe,metaArray:fe.map(()=>[this.options.depth]),mesaage:{projection:q0({},this.options.projection),topSegments:100,bbox:r,hasBottom:!1,hasSide:!1}}),ze=Se.attributes.position.count;Se.setAttribute("color",new BufferAttribute(new Float32Array(ze*3),3));const Fe=this.options.depth;this.setNoise(Se,le.image,Fe);const ke=new Color$1,mt=Se.attributes.color,Lt=Se.attributes.position,Gt=new Color$1("red"),Ue=new Color$1("green");for(let bt=0;bt<ze;bt++){const Xt=Lt.getZ(bt)/Fe;ke.lerpColors(Gt,Ue,Xt),mt.setXYZ(bt,ke.r,ke.g,ke.b)}const xt=yield O.draw("ExtrudePolygon",{geometry:Se,material:new MeshStandardMaterial({flatShading:!0,vertexColors:!0})},null);xt.position.z+=.001,this.extrudePolygon=xt,this.object3d=xt.object3d})}setNoise(n,r,w=1){const E=document.createElement("canvas"),O=[];E.width=r.width,E.height=r.height;const j=E.getContext("2d");j.drawImage(r,0,0);const fe=j.getImageData(0,0,r.width,r.height).data;for(let ke=0;ke<r.height;ke++){O[ke]=[];for(let mt=0;mt<r.width;mt++){const Lt=(ke*r.width+mt)*4,Gt=fe[Lt];O[ke][mt]=Gt/255}}const Se=n.attributes.position,ze=n.attributes.uv,Fe=new Vector2;for(let ke=0;ke<Se.count;ke++){Fe.fromBufferAttribute(ze,ke);let mt=Math.round(Fe.x*r.width)-1,Lt=Math.round(Fe.y*r.height)-1;mt<0&&(mt=0),Lt<0&&(Lt=0);const Gt=O[Lt][mt];Se.setZ(ke,Gt*w)}}render(){this.mList.rmBaseObjectMap(this.extrudePolygon)}dispose(){this.extrudePolygon.dispose(),super.dispose()}}const objs=Bi(q0({},objs$3),{PlaneMap:PlaneMap$1,CityPlane,ContinentsBg,Mountain:PlaneMap});class City extends City$1{constructor(){super(...arguments);v0(this,"multiplyScalar",1/1e3)}fixNearFar(n=.01,r){this.pencil.camera.near=n*this.multiplyScalar,r&&(this.pencil.camera.far=r*this.multiplyScalar),this.pencil.camera.updateProjectionMatrix()}}const getLabelElement=o=>{const e=document.createElement("div");return o.replace(/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,""),e.classList.add("vis-map-label","absolute","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2"),e.innerHTML=`
|
|
5266
5266
|
<div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
|
|
5267
5267
|
${o}
|
|
5268
5268
|
</div>
|
package/dist/index.module.js
CHANGED
|
@@ -63,7 +63,7 @@ import { continentsCountriesIso2 } from "geojson-cn";
|
|
|
63
63
|
Array.prototype.at || (Array.prototype.at = function(o) {
|
|
64
64
|
return o < 0 && (o = this.length + o), this[o];
|
|
65
65
|
});
|
|
66
|
-
const version = "0.30.0-beta.
|
|
66
|
+
const version = "0.30.0-beta.4", publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t", accessToken = {
|
|
67
67
|
token: void 0,
|
|
68
68
|
getInfo() {
|
|
69
69
|
if (!this.token)
|
|
@@ -144692,12 +144692,22 @@ const objs$1 = Bi(q0({}, objs$3), {
|
|
|
144692
144692
|
* @param upAxis - 物体的up轴方向,默认为Y轴 [0, 1, 0]
|
|
144693
144693
|
*/
|
|
144694
144694
|
setObjectOnSphere(n, r, w = 0, E = [0, 1, 0]) {
|
|
144695
|
-
|
|
144696
|
-
|
|
144697
|
-
|
|
144698
|
-
|
|
144699
|
-
|
|
144700
|
-
|
|
144695
|
+
if (n.objectType === "Plane") {
|
|
144696
|
+
const O = this.getLocationPosition(r, w);
|
|
144697
|
+
n.position.set(...O);
|
|
144698
|
+
const j = n.object3d.material;
|
|
144699
|
+
j && (j.side = DoubleSide), n.object3d.lookAt(0, 0, 0);
|
|
144700
|
+
} else {
|
|
144701
|
+
const O = n.rotation.clone(), j = this.getLocationPosition(r, w);
|
|
144702
|
+
n.position.set(...j);
|
|
144703
|
+
const le = new Vector3(...j).normalize(), fe = new Vector3(...E);
|
|
144704
|
+
fe.applyEuler(O);
|
|
144705
|
+
const Se = new Quaternion().setFromUnitVectors(
|
|
144706
|
+
fe,
|
|
144707
|
+
le
|
|
144708
|
+
);
|
|
144709
|
+
n.object3d.applyQuaternion(Se);
|
|
144710
|
+
}
|
|
144701
144711
|
}
|
|
144702
144712
|
};
|
|
144703
144713
|
v0(wn, "VisName", "earth");
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.30.0-beta.
|
|
1
|
+
declare const _default: "0.30.0-beta.4";
|
|
2
2
|
export default _default;
|
|
@@ -81,6 +81,6 @@ export default class extends Base {
|
|
|
81
81
|
* @param height - 距离球面的高度,默认为0
|
|
82
82
|
* @param upAxis - 物体的up轴方向,默认为Y轴 [0, 1, 0]
|
|
83
83
|
*/
|
|
84
|
-
setObjectOnSphere(
|
|
84
|
+
setObjectOnSphere(baseObject: BaseObject, location: [number, number], height?: number, upAxis?: [number, number, number]): void;
|
|
85
85
|
}
|
|
86
86
|
export {};
|