vis-core 0.30.0-beta.27 → 0.30.0-beta.28
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 +4 -4
- package/dist/index.module.js +525 -522
- package/dist/version.d.ts +1 -1
- package/dist/vis/city/index.d.ts +2 -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 Jn=Object.defineProperty,jn=Object.defineProperties;var Qn=Object.getOwnPropertyDescriptors;var Yn=Object.getOwnPropertySymbols,$n=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty,e1=Object.prototype.propertyIsEnumerable,t1=Reflect.get;var Pn=(v,e)=>(e=Symbol[v])?e:Symbol.for("Symbol."+v),i1=v=>{throw TypeError(v)},Gn=Math.pow,Hn=(v,e,r)=>e in v?Jn(v,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):v[e]=r,gi=(v,e)=>{for(var r in e||(e={}))qn.call(e,r)&&Hn(v,r,e[r]);if(Yn)for(var r of Yn(e))e1.call(e,r)&&Hn(v,r,e[r]);return v},qi=(v,e)=>jn(v,Qn(e));var C0=(v,e,r)=>Hn(v,typeof e!="symbol"?e+"":e,r);var _n=(v,e,r)=>t1($n(v),r,e);var B0=(v,e,r)=>new Promise((o,V)=>{var le=Ce=>{try{Le(r.next(Ce))}catch(Re){V(Re)}},fe=Ce=>{try{Le(r.throw(Ce))}catch(Re){V(Re)}},Le=Ce=>Ce.done?o(Ce.value):Promise.resolve(Ce.value).then(le,fe);Le((r=r.apply(v,e)).next())}),n1=function(v,e){this[0]=v,this[1]=e};var Un=v=>{var e=v[Pn("asyncIterator")],r=!1,o,V={};return e==null?(e=v[Pn("iterator")](),o=le=>V[le]=fe=>e[le](fe)):(e=e.call(v),o=le=>V[le]=fe=>{if(r){if(r=!1,le==="throw")throw fe;return fe}return r=!0,{done:!1,value:new n1(new Promise(Le=>{var Ce=e[le](fe);Ce instanceof Object||i1("Object expected"),Le(Ce)}),1)}}),V[Pn("iterator")]=()=>V,o("next"),"throw"in e?o("throw"):V.throw=le=>{throw le},"return"in e&&o("return"),V},Bn=(v,e,r)=>(e=v[Pn("asyncIterator")])?e.call(v):(v=v[Pn("iterator")](),e={},r=(o,V)=>(V=v[o])&&(e[o]=le=>new Promise((fe,Le,Ce)=>(le=V.call(v,le),Ce=le.done,Promise.resolve(le.value).then(Re=>fe({value:Re,done:Ce}),Le)))),r("next"),r("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(v){return v<0&&(v=this.length+v),this[v]});const version="0.30.0-beta.27",publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[v,e,r]=this.token.split(":::"),o=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),V=CryptoJS.enc.Base64.parse(e),le=CryptoJS.enc.Base64.parse(r),fe=CryptoJS.lib.WordArray.create(V.words.slice(0,4)),Le=CryptoJS.lib.WordArray.create(V.words.slice(4)),Ce=jsrsasign.KJUR.crypto.Util.hashHex(V.toString(),"sha256"),Re=o.verifyWithMessageHashPSS(Ce,jsrsasign.b64tohex(v),"sha256",32);if(!Re)return this.token=void 0,"";const ze=CryptoJS.AES.decrypt({ciphertext:Le},le,{iv:fe,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=Re,Fe)}};var Easing=Object.freeze({Linear:Object.freeze({None:function(v){return v},In:function(v){return v},Out:function(v){return v},InOut:function(v){return v}}),Quadratic:Object.freeze({In:function(v){return v*v},Out:function(v){return v*(2-v)},InOut:function(v){return(v*=2)<1?.5*v*v:-.5*(--v*(v-2)-1)}}),Cubic:Object.freeze({In:function(v){return v*v*v},Out:function(v){return--v*v*v+1},InOut:function(v){return(v*=2)<1?.5*v*v*v:.5*((v-=2)*v*v+2)}}),Quartic:Object.freeze({In:function(v){return v*v*v*v},Out:function(v){return 1- --v*v*v*v},InOut:function(v){return(v*=2)<1?.5*v*v*v*v:-.5*((v-=2)*v*v*v-2)}}),Quintic:Object.freeze({In:function(v){return v*v*v*v*v},Out:function(v){return--v*v*v*v*v+1},InOut:function(v){return(v*=2)<1?.5*v*v*v*v*v:.5*((v-=2)*v*v*v*v+2)}}),Sinusoidal:Object.freeze({In:function(v){return 1-Math.sin((1-v)*Math.PI/2)},Out:function(v){return Math.sin(v*Math.PI/2)},InOut:function(v){return .5*(1-Math.sin(Math.PI*(.5-v)))}}),Exponential:Object.freeze({In:function(v){return v===0?0:Math.pow(1024,v-1)},Out:function(v){return v===1?1:1-Math.pow(2,-10*v)},InOut:function(v){return v===0?0:v===1?1:(v*=2)<1?.5*Math.pow(1024,v-1):.5*(-Math.pow(2,-10*(v-1))+2)}}),Circular:Object.freeze({In:function(v){return 1-Math.sqrt(1-v*v)},Out:function(v){return Math.sqrt(1- --v*v)},InOut:function(v){return(v*=2)<1?-.5*(Math.sqrt(1-v*v)-1):.5*(Math.sqrt(1-(v-=2)*v)+1)}}),Elastic:Object.freeze({In:function(v){return v===0?0:v===1?1:-Math.pow(2,10*(v-1))*Math.sin((v-1.1)*5*Math.PI)},Out:function(v){return v===0?0:v===1?1:Math.pow(2,-10*v)*Math.sin((v-.1)*5*Math.PI)+1},InOut:function(v){return v===0?0:v===1?1:(v*=2,v<1?-.5*Math.pow(2,10*(v-1))*Math.sin((v-1.1)*5*Math.PI):.5*Math.pow(2,-10*(v-1))*Math.sin((v-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(v){var e=1.70158;return v===1?1:v*v*((e+1)*v-e)},Out:function(v){var e=1.70158;return v===0?0:--v*v*((e+1)*v+e)+1},InOut:function(v){var e=2.5949095;return(v*=2)<1?.5*(v*v*((e+1)*v-e)):.5*((v-=2)*v*((e+1)*v+e)+2)}}),Bounce:Object.freeze({In:function(v){return 1-Easing.Bounce.Out(1-v)},Out:function(v){return v<1/2.75?7.5625*v*v:v<2/2.75?7.5625*(v-=1.5/2.75)*v+.75:v<2.5/2.75?7.5625*(v-=2.25/2.75)*v+.9375:7.5625*(v-=2.625/2.75)*v+.984375},InOut:function(v){return v<.5?Easing.Bounce.In(v*2)*.5:Easing.Bounce.Out(v*2-1)*.5+.5}}),generatePow:function(v){return v===void 0&&(v=4),v=v<Number.EPSILON?Number.EPSILON:v,v=v>1e4?1e4:v,{In:function(e){return Math.pow(e,v)},Out:function(e){return 1-Math.pow(1-e,v)},InOut:function(e){return e<.5?Math.pow(e*2,v)/2:(1-Math.pow(2-e*2,v))/2+.5}}}}),now=function(){return performance.now()},Group$1=function(){function v(){this._tweens={},this._tweensAddedDuringUpdate={}}return v.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(r){return e._tweens[r]})},v.prototype.removeAll=function(){this._tweens={}},v.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},v.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},v.prototype.update=function(e,r){e===void 0&&(e=now()),r===void 0&&(r=!1);var o=Object.keys(this._tweens);if(o.length===0)return!1;for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var V=0;V<o.length;V++){var le=this._tweens[o[V]],fe=!r;le&&le.update(e,fe)===!1&&!r&&delete this._tweens[o[V]]}o=Object.keys(this._tweensAddedDuringUpdate)}return!0},v}(),Interpolation={Linear:function(v,e){var r=v.length-1,o=r*e,V=Math.floor(o),le=Interpolation.Utils.Linear;return e<0?le(v[0],v[1],o):e>1?le(v[r],v[r-1],r-o):le(v[V],v[V+1>r?r:V+1],o-V)},Bezier:function(v,e){for(var r=0,o=v.length-1,V=Math.pow,le=Interpolation.Utils.Bernstein,fe=0;fe<=o;fe++)r+=V(1-e,o-fe)*V(e,fe)*v[fe]*le(o,fe);return r},CatmullRom:function(v,e){var r=v.length-1,o=r*e,V=Math.floor(o),le=Interpolation.Utils.CatmullRom;return v[0]===v[r]?(e<0&&(V=Math.floor(o=r*(1+e))),le(v[(V-1+r)%r],v[V],v[(V+1)%r],v[(V+2)%r],o-V)):e<0?v[0]-(le(v[0],v[0],v[1],v[1],-o)-v[0]):e>1?v[r]-(le(v[r],v[r],v[r-1],v[r-1],o-r)-v[r]):le(v[V?V-1:0],v[V],v[r<V+1?r:V+1],v[r<V+2?r:V+2],o-V)},Utils:{Linear:function(v,e,r){return(e-v)*r+v},Bernstein:function(v,e){var r=Interpolation.Utils.Factorial;return r(v)/r(e)/r(v-e)},Factorial:function(){var v=[1];return function(e){var r=1;if(v[e])return v[e];for(var o=e;o>1;o--)r*=o;return v[e]=r,r}}(),CatmullRom:function(v,e,r,o,V){var le=(r-v)*.5,fe=(o-e)*.5,Le=V*V,Ce=V*Le;return(2*e-2*r+le+fe)*Ce+(-3*e+3*r-2*le-fe)*Le+le*V+e}}},Sequence=function(){function v(){}return v.nextId=function(){return v._nextId++},v._nextId=0,v}(),mainGroup=new Group$1,Tween=function(){function v(e,r){r===void 0&&(r=mainGroup),this._object=e,this._group=r,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 v.prototype.getId=function(){return this._id},v.prototype.isPlaying=function(){return this._isPlaying},v.prototype.isPaused=function(){return this._isPaused},v.prototype.getDuration=function(){return this._duration},v.prototype.to=function(e,r){if(r===void 0&&(r=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=r<0?0:r,this},v.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},v.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},v.prototype.start=function(e,r){if(e===void 0&&(e=now()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var o in this._valuesStartRepeat)this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}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||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var V={};for(var le in this._valuesEnd)V[le]=this._valuesEnd[le];this._valuesEnd=V}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},v.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},v.prototype._setupProperties=function(e,r,o,V,le){for(var fe in o){var Le=e[fe],Ce=Array.isArray(Le),Re=Ce?"array":typeof Le,Pe=!Ce&&Array.isArray(o[fe]);if(!(Re==="undefined"||Re==="function")){if(Pe){var ze=o[fe];if(ze.length===0)continue;for(var Fe=[Le],ke=0,Gt=ze.length;ke<Gt;ke+=1){var Vt=this._handleRelativeValue(Le,ze[ke]);if(isNaN(Vt)){Pe=!1,console.warn("Found invalid interpolation list. Skipping.");break}Fe.push(Vt)}Pe&&(o[fe]=Fe)}if((Re==="object"||Ce)&&Le&&!Pe){r[fe]=Ce?[]:{};var wt=Le;for(var xt in wt)r[fe][xt]=wt[xt];V[fe]=Ce?[]:{};var ze=o[fe];if(!this._isDynamic){var Xt={};for(var xt in ze)Xt[xt]=ze[xt];o[fe]=ze=Xt}this._setupProperties(wt,r[fe],ze,V[fe],le)}else(typeof r[fe]=="undefined"||le)&&(r[fe]=Le),Ce||(r[fe]*=1),Pe?V[fe]=o[fe].slice().reverse():V[fe]=r[fe]||0}}},v.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},v.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},v.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)},v.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)},v.prototype.stopChainedTweens=function(){for(var e=0,r=this._chainedTweens.length;e<r;e++)this._chainedTweens[e].stop();return this},v.prototype.group=function(e){return e===void 0&&(e=mainGroup),this._group=e,this},v.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},v.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},v.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},v.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},v.prototype.easing=function(e){return e===void 0&&(e=Easing.Linear.None),this._easingFunction=e,this},v.prototype.interpolation=function(e){return e===void 0&&(e=Interpolation.Linear),this._interpolationFunction=e,this},v.prototype.chain=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this._chainedTweens=e,this},v.prototype.onStart=function(e){return this._onStartCallback=e,this},v.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},v.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},v.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},v.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},v.prototype.onStop=function(e){return this._onStopCallback=e,this},v.prototype.update=function(e,r){var o;if(e===void 0&&(e=now()),r===void 0&&(r=!0),this._isPaused)return!0;var V=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>V)return!1;r&&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 le=e-this._startTime,fe=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),Le=this._duration+this._repeat*fe,Ce=this._calculateElapsedPortion(le,fe,Le),Re=this._easingFunction(Ce),Pe=this._calculateCompletionStatus(le,fe);if(Pe==="repeat"&&this._processRepetition(le,fe),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,Re),Pe==="about-to-repeat"&&this._processRepetition(le,fe),this._onUpdateCallback&&this._onUpdateCallback(this._object,Ce),Pe==="repeat"||Pe==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(Pe==="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 Pe!=="completed"},v.prototype._calculateElapsedPortion=function(e,r,o){if(this._duration===0||e>o)return 1;var V=e%r,le=Math.min(V/this._duration,1);return le===0&&e!==0&&e%this._duration===0?1:le},v.prototype._calculateCompletionStatus=function(e,r){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},v.prototype._processRepetition=function(e,r){var o=Math.min(Math.trunc((e-this._duration)/r)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=o);for(var V in this._valuesStartRepeat){var le=this._valuesEnd[V];!this._yoyo&&typeof le=="string"&&(this._valuesStartRepeat[V]=this._valuesStartRepeat[V]+parseFloat(le)),this._yoyo&&this._swapEndStartRepeatValues(V),this._valuesStart[V]=this._valuesStartRepeat[V]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=r*o},v.prototype._updateProperties=function(e,r,o,V){for(var le in o)if(r[le]!==void 0){var fe=r[le]||0,Le=o[le],Ce=Array.isArray(e[le]),Re=Array.isArray(Le),Pe=!Ce&ℜPe?e[le]=this._interpolationFunction(Le,V):typeof Le=="object"&&Le?this._updateProperties(e[le],fe,Le,V):(Le=this._handleRelativeValue(fe,Le),typeof Le=="number"&&(e[le]=fe+(Le-fe)*V))}},v.prototype._handleRelativeValue=function(e,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?e+parseFloat(r):parseFloat(r)},v.prototype._swapEndStartRepeatValues=function(e){var r=this._valuesStartRepeat[e],o=this._valuesEnd[e];typeof o=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(o):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=r},v}(),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 Jn=Object.defineProperty,jn=Object.defineProperties;var Qn=Object.getOwnPropertyDescriptors;var Yn=Object.getOwnPropertySymbols,$n=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty,e1=Object.prototype.propertyIsEnumerable,t1=Reflect.get;var Pn=(v,e)=>(e=Symbol[v])?e:Symbol.for("Symbol."+v),i1=v=>{throw TypeError(v)},Gn=Math.pow,Hn=(v,e,r)=>e in v?Jn(v,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):v[e]=r,gi=(v,e)=>{for(var r in e||(e={}))qn.call(e,r)&&Hn(v,r,e[r]);if(Yn)for(var r of Yn(e))e1.call(e,r)&&Hn(v,r,e[r]);return v},qi=(v,e)=>jn(v,Qn(e));var C0=(v,e,r)=>Hn(v,typeof e!="symbol"?e+"":e,r);var _n=(v,e,r)=>t1($n(v),r,e);var B0=(v,e,r)=>new Promise((o,V)=>{var le=Ce=>{try{Le(r.next(Ce))}catch(Re){V(Re)}},fe=Ce=>{try{Le(r.throw(Ce))}catch(Re){V(Re)}},Le=Ce=>Ce.done?o(Ce.value):Promise.resolve(Ce.value).then(le,fe);Le((r=r.apply(v,e)).next())}),n1=function(v,e){this[0]=v,this[1]=e};var Un=v=>{var e=v[Pn("asyncIterator")],r=!1,o,V={};return e==null?(e=v[Pn("iterator")](),o=le=>V[le]=fe=>e[le](fe)):(e=e.call(v),o=le=>V[le]=fe=>{if(r){if(r=!1,le==="throw")throw fe;return fe}return r=!0,{done:!1,value:new n1(new Promise(Le=>{var Ce=e[le](fe);Ce instanceof Object||i1("Object expected"),Le(Ce)}),1)}}),V[Pn("iterator")]=()=>V,o("next"),"throw"in e?o("throw"):V.throw=le=>{throw le},"return"in e&&o("return"),V},Bn=(v,e,r)=>(e=v[Pn("asyncIterator")])?e.call(v):(v=v[Pn("iterator")](),e={},r=(o,V)=>(V=v[o])&&(e[o]=le=>new Promise((fe,Le,Ce)=>(le=V.call(v,le),Ce=le.done,Promise.resolve(le.value).then(Re=>fe({value:Re,done:Ce}),Le)))),r("next"),r("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(v){return v<0&&(v=this.length+v),this[v]});const version="0.30.0-beta.28",publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[v,e,r]=this.token.split(":::"),o=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),V=CryptoJS.enc.Base64.parse(e),le=CryptoJS.enc.Base64.parse(r),fe=CryptoJS.lib.WordArray.create(V.words.slice(0,4)),Le=CryptoJS.lib.WordArray.create(V.words.slice(4)),Ce=jsrsasign.KJUR.crypto.Util.hashHex(V.toString(),"sha256"),Re=o.verifyWithMessageHashPSS(Ce,jsrsasign.b64tohex(v),"sha256",32);if(!Re)return this.token=void 0,"";const ze=CryptoJS.AES.decrypt({ciphertext:Le},le,{iv:fe,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=Re,Fe)}};var Easing=Object.freeze({Linear:Object.freeze({None:function(v){return v},In:function(v){return v},Out:function(v){return v},InOut:function(v){return v}}),Quadratic:Object.freeze({In:function(v){return v*v},Out:function(v){return v*(2-v)},InOut:function(v){return(v*=2)<1?.5*v*v:-.5*(--v*(v-2)-1)}}),Cubic:Object.freeze({In:function(v){return v*v*v},Out:function(v){return--v*v*v+1},InOut:function(v){return(v*=2)<1?.5*v*v*v:.5*((v-=2)*v*v+2)}}),Quartic:Object.freeze({In:function(v){return v*v*v*v},Out:function(v){return 1- --v*v*v*v},InOut:function(v){return(v*=2)<1?.5*v*v*v*v:-.5*((v-=2)*v*v*v-2)}}),Quintic:Object.freeze({In:function(v){return v*v*v*v*v},Out:function(v){return--v*v*v*v*v+1},InOut:function(v){return(v*=2)<1?.5*v*v*v*v*v:.5*((v-=2)*v*v*v*v+2)}}),Sinusoidal:Object.freeze({In:function(v){return 1-Math.sin((1-v)*Math.PI/2)},Out:function(v){return Math.sin(v*Math.PI/2)},InOut:function(v){return .5*(1-Math.sin(Math.PI*(.5-v)))}}),Exponential:Object.freeze({In:function(v){return v===0?0:Math.pow(1024,v-1)},Out:function(v){return v===1?1:1-Math.pow(2,-10*v)},InOut:function(v){return v===0?0:v===1?1:(v*=2)<1?.5*Math.pow(1024,v-1):.5*(-Math.pow(2,-10*(v-1))+2)}}),Circular:Object.freeze({In:function(v){return 1-Math.sqrt(1-v*v)},Out:function(v){return Math.sqrt(1- --v*v)},InOut:function(v){return(v*=2)<1?-.5*(Math.sqrt(1-v*v)-1):.5*(Math.sqrt(1-(v-=2)*v)+1)}}),Elastic:Object.freeze({In:function(v){return v===0?0:v===1?1:-Math.pow(2,10*(v-1))*Math.sin((v-1.1)*5*Math.PI)},Out:function(v){return v===0?0:v===1?1:Math.pow(2,-10*v)*Math.sin((v-.1)*5*Math.PI)+1},InOut:function(v){return v===0?0:v===1?1:(v*=2,v<1?-.5*Math.pow(2,10*(v-1))*Math.sin((v-1.1)*5*Math.PI):.5*Math.pow(2,-10*(v-1))*Math.sin((v-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(v){var e=1.70158;return v===1?1:v*v*((e+1)*v-e)},Out:function(v){var e=1.70158;return v===0?0:--v*v*((e+1)*v+e)+1},InOut:function(v){var e=2.5949095;return(v*=2)<1?.5*(v*v*((e+1)*v-e)):.5*((v-=2)*v*((e+1)*v+e)+2)}}),Bounce:Object.freeze({In:function(v){return 1-Easing.Bounce.Out(1-v)},Out:function(v){return v<1/2.75?7.5625*v*v:v<2/2.75?7.5625*(v-=1.5/2.75)*v+.75:v<2.5/2.75?7.5625*(v-=2.25/2.75)*v+.9375:7.5625*(v-=2.625/2.75)*v+.984375},InOut:function(v){return v<.5?Easing.Bounce.In(v*2)*.5:Easing.Bounce.Out(v*2-1)*.5+.5}}),generatePow:function(v){return v===void 0&&(v=4),v=v<Number.EPSILON?Number.EPSILON:v,v=v>1e4?1e4:v,{In:function(e){return Math.pow(e,v)},Out:function(e){return 1-Math.pow(1-e,v)},InOut:function(e){return e<.5?Math.pow(e*2,v)/2:(1-Math.pow(2-e*2,v))/2+.5}}}}),now=function(){return performance.now()},Group$1=function(){function v(){this._tweens={},this._tweensAddedDuringUpdate={}}return v.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(r){return e._tweens[r]})},v.prototype.removeAll=function(){this._tweens={}},v.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},v.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},v.prototype.update=function(e,r){e===void 0&&(e=now()),r===void 0&&(r=!1);var o=Object.keys(this._tweens);if(o.length===0)return!1;for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var V=0;V<o.length;V++){var le=this._tweens[o[V]],fe=!r;le&&le.update(e,fe)===!1&&!r&&delete this._tweens[o[V]]}o=Object.keys(this._tweensAddedDuringUpdate)}return!0},v}(),Interpolation={Linear:function(v,e){var r=v.length-1,o=r*e,V=Math.floor(o),le=Interpolation.Utils.Linear;return e<0?le(v[0],v[1],o):e>1?le(v[r],v[r-1],r-o):le(v[V],v[V+1>r?r:V+1],o-V)},Bezier:function(v,e){for(var r=0,o=v.length-1,V=Math.pow,le=Interpolation.Utils.Bernstein,fe=0;fe<=o;fe++)r+=V(1-e,o-fe)*V(e,fe)*v[fe]*le(o,fe);return r},CatmullRom:function(v,e){var r=v.length-1,o=r*e,V=Math.floor(o),le=Interpolation.Utils.CatmullRom;return v[0]===v[r]?(e<0&&(V=Math.floor(o=r*(1+e))),le(v[(V-1+r)%r],v[V],v[(V+1)%r],v[(V+2)%r],o-V)):e<0?v[0]-(le(v[0],v[0],v[1],v[1],-o)-v[0]):e>1?v[r]-(le(v[r],v[r],v[r-1],v[r-1],o-r)-v[r]):le(v[V?V-1:0],v[V],v[r<V+1?r:V+1],v[r<V+2?r:V+2],o-V)},Utils:{Linear:function(v,e,r){return(e-v)*r+v},Bernstein:function(v,e){var r=Interpolation.Utils.Factorial;return r(v)/r(e)/r(v-e)},Factorial:function(){var v=[1];return function(e){var r=1;if(v[e])return v[e];for(var o=e;o>1;o--)r*=o;return v[e]=r,r}}(),CatmullRom:function(v,e,r,o,V){var le=(r-v)*.5,fe=(o-e)*.5,Le=V*V,Ce=V*Le;return(2*e-2*r+le+fe)*Ce+(-3*e+3*r-2*le-fe)*Le+le*V+e}}},Sequence=function(){function v(){}return v.nextId=function(){return v._nextId++},v._nextId=0,v}(),mainGroup=new Group$1,Tween=function(){function v(e,r){r===void 0&&(r=mainGroup),this._object=e,this._group=r,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 v.prototype.getId=function(){return this._id},v.prototype.isPlaying=function(){return this._isPlaying},v.prototype.isPaused=function(){return this._isPaused},v.prototype.getDuration=function(){return this._duration},v.prototype.to=function(e,r){if(r===void 0&&(r=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=r<0?0:r,this},v.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},v.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},v.prototype.start=function(e,r){if(e===void 0&&(e=now()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var o in this._valuesStartRepeat)this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}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||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var V={};for(var le in this._valuesEnd)V[le]=this._valuesEnd[le];this._valuesEnd=V}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},v.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},v.prototype._setupProperties=function(e,r,o,V,le){for(var fe in o){var Le=e[fe],Ce=Array.isArray(Le),Re=Ce?"array":typeof Le,Pe=!Ce&&Array.isArray(o[fe]);if(!(Re==="undefined"||Re==="function")){if(Pe){var ze=o[fe];if(ze.length===0)continue;for(var Fe=[Le],ke=0,Gt=ze.length;ke<Gt;ke+=1){var Vt=this._handleRelativeValue(Le,ze[ke]);if(isNaN(Vt)){Pe=!1,console.warn("Found invalid interpolation list. Skipping.");break}Fe.push(Vt)}Pe&&(o[fe]=Fe)}if((Re==="object"||Ce)&&Le&&!Pe){r[fe]=Ce?[]:{};var wt=Le;for(var xt in wt)r[fe][xt]=wt[xt];V[fe]=Ce?[]:{};var ze=o[fe];if(!this._isDynamic){var Xt={};for(var xt in ze)Xt[xt]=ze[xt];o[fe]=ze=Xt}this._setupProperties(wt,r[fe],ze,V[fe],le)}else(typeof r[fe]=="undefined"||le)&&(r[fe]=Le),Ce||(r[fe]*=1),Pe?V[fe]=o[fe].slice().reverse():V[fe]=r[fe]||0}}},v.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},v.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},v.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)},v.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)},v.prototype.stopChainedTweens=function(){for(var e=0,r=this._chainedTweens.length;e<r;e++)this._chainedTweens[e].stop();return this},v.prototype.group=function(e){return e===void 0&&(e=mainGroup),this._group=e,this},v.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},v.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},v.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},v.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},v.prototype.easing=function(e){return e===void 0&&(e=Easing.Linear.None),this._easingFunction=e,this},v.prototype.interpolation=function(e){return e===void 0&&(e=Interpolation.Linear),this._interpolationFunction=e,this},v.prototype.chain=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this._chainedTweens=e,this},v.prototype.onStart=function(e){return this._onStartCallback=e,this},v.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},v.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},v.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},v.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},v.prototype.onStop=function(e){return this._onStopCallback=e,this},v.prototype.update=function(e,r){var o;if(e===void 0&&(e=now()),r===void 0&&(r=!0),this._isPaused)return!0;var V=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>V)return!1;r&&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 le=e-this._startTime,fe=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),Le=this._duration+this._repeat*fe,Ce=this._calculateElapsedPortion(le,fe,Le),Re=this._easingFunction(Ce),Pe=this._calculateCompletionStatus(le,fe);if(Pe==="repeat"&&this._processRepetition(le,fe),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,Re),Pe==="about-to-repeat"&&this._processRepetition(le,fe),this._onUpdateCallback&&this._onUpdateCallback(this._object,Ce),Pe==="repeat"||Pe==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(Pe==="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 Pe!=="completed"},v.prototype._calculateElapsedPortion=function(e,r,o){if(this._duration===0||e>o)return 1;var V=e%r,le=Math.min(V/this._duration,1);return le===0&&e!==0&&e%this._duration===0?1:le},v.prototype._calculateCompletionStatus=function(e,r){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},v.prototype._processRepetition=function(e,r){var o=Math.min(Math.trunc((e-this._duration)/r)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=o);for(var V in this._valuesStartRepeat){var le=this._valuesEnd[V];!this._yoyo&&typeof le=="string"&&(this._valuesStartRepeat[V]=this._valuesStartRepeat[V]+parseFloat(le)),this._yoyo&&this._swapEndStartRepeatValues(V),this._valuesStart[V]=this._valuesStartRepeat[V]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=r*o},v.prototype._updateProperties=function(e,r,o,V){for(var le in o)if(r[le]!==void 0){var fe=r[le]||0,Le=o[le],Ce=Array.isArray(e[le]),Re=Array.isArray(Le),Pe=!Ce&ℜPe?e[le]=this._interpolationFunction(Le,V):typeof Le=="object"&&Le?this._updateProperties(e[le],fe,Le,V):(Le=this._handleRelativeValue(fe,Le),typeof Le=="number"&&(e[le]=fe+(Le-fe)*V))}},v.prototype._handleRelativeValue=function(e,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?e+parseFloat(r):parseFloat(r)},v.prototype._swapEndStartRepeatValues=function(e){var r=this._valuesStartRepeat[e],o=this._valuesEnd[e];typeof o=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(o):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=r},v}(),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
|
|
@@ -5278,7 +5278,7 @@ version 0.8.2
|
|
|
5278
5278
|
#include <colorspace_fragment>
|
|
5279
5279
|
#include <fog_fragment>
|
|
5280
5280
|
|
|
5281
|
-
}`};class CityPlane extends Z$1{constructor(r){super();C0(this,"options");C0(this,"plane");C0(this,"water");this.options=gi({color:"#0C4557",map:null},r)}create(){return B0(this,null,function*(){const{width:r,height:o,color:V,map:le,material:fe}=this.options,Le=new PlaneGeometry(r,o,2,2);this.plane=Le;const Ce=fe||new MeshBasicMaterial({color:V,map:le});this.createMesh(Le,Ce)})}addWater(){const r=this.pencil.loader,o=new Water(this.plane.clone(),{color:"#ffffff",scale:1,flowDirection:new Vector2(0,0),flowSpeed:1e-9,textureWidth:1024,textureHeight:1024,normalMap0:r.getAsset("/image/water/normalMap0.jpg"),normalMap1:r.getAsset("/image/water/normalMap1.jpg"),reflectivity:.04});this.water=o,o.position.z=.001,this.add(o)}}const fragmentShader="varying vec2 vUv;uniform vec3 uColor;uniform float uOpacity;uniform float uSpeed;uniform float uLineCount;uniform float time;float PI=3.14159265;float drawCircle(float index,float range){float opacity=1.0;if(index>=1.0-range){opacity=1.0-(index-(1.0-range))/range;}else if(index<=range){opacity=index/range;}return opacity;}float distanceTo(vec2 src,vec2 dst){float dx=src.x-dst.x;float dy=src.y-dst.y;return sqrt(dx*dx+dy*dy);}void main(){float iTime=-time*uSpeed;float opacity=0.0;float len=distanceTo(vec2(0.5,0.5),vec2(vUv.x,vUv.y));float size=1.0/uLineCount;vec2 range=vec2(0.5,0.8);float index=mod(iTime+len,size);if(index<size&&len<=0.5){float i=sin(index/size*PI);if(i>=range.x&&i<=range.y){float t=(i-range.x)/(range.y-range.x);float r=0.3;opacity=drawCircle(t,r);}opacity*=1.0-len/0.5;}gl_FragColor=vec4(uColor,opacity*uOpacity);}",vertexShader="varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",fs="uniform sampler2D uTexture;uniform vec2 uOffset;uniform float uRepeat;uniform float uOpacity;varying vec2 vUv;void main(){vec4 color=texture2D(uTexture,vUv+uOffset);float alpha=smoothstep(uRepeat,0.0,vUv.y);if(color.a<0.1){discard;}gl_FragColor=vec4(color.rgb,alpha*uOpacity);}",vs="uniform float uRepeat;varying vec2 vUv;void main(){vUv=uv*uRepeat;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",width=10,height=20,radialSegments=32;function getCanvasTexture(v){const e=document.createElement("canvas");e.width=256,e.height=256;const r=e.getContext("2d"),o=r.createLinearGradient(0,0,0,256);o.addColorStop(0,`rgba(${v}, 1)`),o.addColorStop(.1,`rgba(${v}, 1)`),o.addColorStop(.1,"rgba(255, 255, 255, 0.00)"),o.addColorStop(1,"rgba(255, 255, 255, 0.00)"),r.fillStyle=o,r.fillRect(0,0,256,256);const V=new CanvasTexture(e);return V.colorSpace=SRGBColorSpace,V.wrapT=RepeatWrapping,V.magFilter=NearestFilter,V.minFilter=NearestFilter,e.remove(),V}class Target extends Z$1{constructor(r){super();C0(this,"options");C0(this,"time",{value:0});C0(this,"offset",new Vector2(0,0));C0(this,"timer",null);C0(this,"inTween",null);C0(this,"outTween",null);this.options=r}createWave(r){const o=width*3,V=new PlaneGeometry(o,o,1,1),le=new ShaderMaterial({uniforms:{uColor:{value:new Color$1(`rgb(${r})`)},uOpacity:{value:0},uSpeed:{value:.1},uLineCount:{value:3},uRadius:{value:o/2},time:this.time},blending:AdditiveBlending,depthWrite:!1,transparent:!0,vertexShader,fragmentShader});return new Mesh(V,le)}createRipple(r){const o=new ShaderMaterial({uniforms:{uTexture:{value:r},uOffset:{value:this.offset},uRepeat:{value:6},uOpacity:{value:1}},fragmentShader:fs,vertexShader:vs,transparent:!0,depthWrite:!1,blending:AdditiveBlending,side:DoubleSide}),V=width,le=height*1.5,fe=new CylinderGeometry(V,V,le,radialSegments,1,!0),Le=new Mesh(fe,o);return Le.translateZ(le/2),Le.rotateX(Math.PI/2),Le}createCylinder(r){const o=width-.1,V=new CylinderGeometry(o,o,height,radialSegments,1,!0),le=new MeshBasicMaterial({map:r,transparent:!0,side:DoubleSide,opacity:.3}),fe=new Object3D,Le=new Mesh(V,le);return Le.translateZ(height/2),Le.rotateX(Math.PI/2),fe.add(Le),fe.scale.setZ(1),fe}createTorus(r){const o=new TorusGeometry(width/3,.4,6,36),V=new MeshBasicMaterial({color:`rgb(${r})`,transparent:!0,opacity:0}),le=new Mesh(o,V);return le.translateZ(1),le}create(){return B0(this,null,function*(){const{scale:r=.03}=this.options;this.createGroup();const o=this.pencil.loader,V="241, 241, 86",le=o.getAsset("/image/city/cylinder.webp"),fe=getCanvasTexture(V),Le=this.createRipple(fe);this.object3d.add(Le);const Ce=this.createCylinder(le);this.object3d.add(Ce),this.object3d.scale.multiplyScalar(r)})}erase(){this.inTween&&(this.inTween.stop(),this.inTween=null),this.timer&&(clearTimeout(this.timer),this.timer=null),this.outTween&&(this.outTween.stop(),this.outTween=null),super.erase()}update(r,o){this.time.value+=.01,this.offset.y-=.02}}const objs$2=qi(gi({},objs$3),{Building,Road,Area,CityPlane,Target}),png2webp=(v,e=2048)=>new Promise((r,o)=>{const V=document.createElement("img");V.crossOrigin="anonymous";const le=()=>{V.removeEventListener("load",le,!1),V.removeEventListener("error",fe,!1);const Le=document.createElement("canvas");if(Le.width=V.naturalWidth,Le.height=V.naturalHeight,Le.width>e||Le.height>e){const Pe=Math.min(e/Le.width,e/Le.height);Le.width*=Pe,Le.height*=Pe}Le.getContext("2d").drawImage(V,0,0,Le.width,Le.height);const Ce=Le.toDataURL("image/webp"),Re=new Image;Re.onload=()=>{r(Re)},Re.src=Ce},fe=()=>{V.removeEventListener("load",le,!1),V.removeEventListener("error",fe,!1),o(new Error("Image load error"))};V.addEventListener("load",le,!1),V.addEventListener("error",fe,!1),V.src=v}),ec=(v,e)=>{const r=stringToUtf8ByteArray(v),o=stringToUtf8ByteArray(e).map(function(V,le){return V^r[Math.floor(le%r.length)]}).join(",");return btoa(o)};function stringToUtf8ByteArray(v){const e=[];let r=0;for(let o=0;o<v.length;o++){let V=v.charCodeAt(o);V<128?e[r++]=V:V<2048?(e[r++]=V>>6|192,e[r++]=V&63|128):(V&64512)==55296&&o+1<v.length&&(v.charCodeAt(o+1)&64512)==56320?(V=65536+((V&1023)<<10)+(v.charCodeAt(++o)&1023),e[r++]=V>>18|240,e[r++]=V>>12&63|128,e[r++]=V>>6&63|128,e[r++]=V&63|128):(e[r++]=V>>12|224,e[r++]=V>>6&63|128,e[r++]=V&63|128)}return e}const TEMPLATE_CONFIGS={"7s93q0lma4n9887":{id:"7s93q0lma4n9887",mapIndex:4,mapId:"398-0",emissiveMapIndex:5,emmisiveMapId:"419-0"},l7ojr7nqc06u24f:{id:"l7ojr7nqc06u24f",mapIndex:7,mapId:"245-0",emissiveMapIndex:6,emmisiveMapId:"177-0",cityOnly:!0},"2xli7429f48857f":{id:"2xli7429f48857f",emissiveMapIndex:14,emmisiveMapId:"1140-0"}},getBaseUrl=()=>{const v="/";return v==="/"?"":v},getAdcodeInfo=v=>{const e=findAdcodeInfo(v);if(!e)throw new Error(`Adcode ${v} not found`);return e},fetchGeojsonData=(v,e,r,o)=>B0(exports,null,function*(){const V=o||e,{res:le}=yield jsonFetch(`${v}/geojson/${V}/${r}.json`);return le}),processTemplateImages=(v,e,r,o,V)=>B0(exports,null,function*(){const le=TEMPLATE_CONFIGS[v];if(!(!le||le.cityOnly&&!V))try{if(le.mapIndex!==void 0||le.mapId!==void 0){const fe=yield png2webp(`${r}/template/${v}/${e}.jpg`);Array.isArray(o)?(o[le.mapIndex]=fe.src,console.log(`已替换模板 ${v} 的 map 资源, ${le.mapIndex}`)):(o[le.mapId]=fe.src,console.log(`已替换模板 ${v} 的 map 资源, ${le.mapId}`))}if(le.emissiveMapIndex!==void 0||le.emmisiveMapId!==void 0){const fe=yield png2webp(`${r}/template/${v}/${e}-自发光.jpg`);Array.isArray(o)?(o[le.emissiveMapIndex]=fe.src,console.log(`已替换模板 ${v} 的 emissiveMap 资源, ${le.emissiveMapIndex}`)):(o[le.emmisiveMapId]=fe.src,console.log(`已替换模板 ${v} 的 emissiveMap 资源, ${le.emmisiveMapId}`))}}catch(fe){console.warn(`模板 ${v} 图像资源加载失败:`,fe)}}),getMapConfig=(V,...le)=>B0(exports,[V,...le],function*(v,e=getBaseUrl(),r,o){if((r==null?void 0:r.style)==="map2CityOnMap")return getMapWithCityConfig(v,e,r,o);if(v===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const fe=getAdcodeInfo(v);return extendMapConfig({center:[fe.lng,fe.lat],adcode:fe.adcode},e,r,o)}}),getMapWithCityConfig=(V,...le)=>B0(exports,[V,...le],function*(v,e=getBaseUrl(),r,o){const fe=getAdcodeInfo(v),Le=fe?findAdcodeInfo(fe.parent):null,Ce=(fe==null?void 0:fe.level)==="district"&&(Le==null?void 0:Le.level)==="city";return extendMapConfig({center:[fe.lng,fe.lat],adcode:fe.adcode,style:"map2CityOnMap",mapDepth:.004,mergeSide:!0,nearbyCities:Ce},e,r,o)}),extendMapConfig=(V,...le)=>B0(exports,[V,...le],function*(v,e=getBaseUrl(),r,o){var Vt,wt;if(v.adcode===0||v.adcode===1e5)return gi({},v);const fe=v.adcode,Le=getAdcodeInfo(fe),Ce=Le.level==="province",Re=Le.level==="city"||Le.level==="district"&&getAdcodeInfo(Le.parent).level==="province",Pe=(Vt=v.fixGeojson)==null?void 0:Vt[fe],ze=(wt=v.fixGeojson)==null?void 0:wt[fe+"-lite"],Fe=yield fetchGeojsonData(e,"json",fe,Pe),ke=yield fetchGeojsonData(e,"json-lite",fe,ze),Gt=qi(gi({},v),{geojsonMap:{[fe]:Fe},extrudeLineGeojsonMap:{[fe]:ke},cityBboxMap:{},jsonNameObj:{},depthReference:void 0,showBuilding:!Ce,__template:r==null?void 0:r.__template});if(v.style==="map2CityOnMap"){const xt=ke.features[0];Gt.jsonNameObj[xt.properties.adcode]=ec(xt.properties.name,`${xt.properties.adcode}`)}if(r!=null&&r.__template&&o&&(yield processTemplateImages(r.__template,fe,e,o,Re)),v.parentBg){const xt=Le.parent;if(xt!==1e5){const Xt=yield fetchGeojsonData(e,"json",xt),Zt=yield fetchGeojsonData(e,"json-lite",xt);Gt.geojsonMap[xt]=Xt,Gt.extrudeLineGeojsonMap[xt]=Zt}}return r&&(Gt.depthReference=r.depthReference||getAdcodeInfo(r.adcode).b),Gt}),getCityConfig=v=>B0(exports,null,function*(){const e=getAdcodeInfo(v),{name:r}=e;return{center:[e.lng,e.lat],adcode:e.adcode,jsonName:ec(r,`${v}`)}}),removeCameraHistory=v=>v.filter(e=>!(e.objectUuid==="camera"&&["SetPosition","SetTarget"].includes(e.type))),setWaterMaterial=(v,e={})=>{const r=e.textureWidth!==void 0?e.textureWidth:512,o=e.textureHeight!==void 0?e.textureHeight:512,V=e.alpha!==void 0?e.alpha:1,le=e.waterNormals!==void 0?e.waterNormals:null,fe=new Color$1(e.waterColor!==void 0?e.waterColor:v.material.color),Le=e.eye!==void 0?e.eye:new Vector3(0,0,0),Ce=e.distortionScale!==void 0?e.distortionScale:0,Re=e.side!==void 0?e.side:FrontSide,Pe=e.fog!==void 0?e.fog:!1,ze=new Plane$1,Fe=new Vector3,ke=new Vector3,Gt=new Vector3,Vt=new Matrix4,wt=new Vector3(0,0,-1),xt=new Vector4,Xt=new Vector3,Zt=new Vector3,Wt=new Vector4,It=new Matrix4,Nt=new PerspectiveCamera,Ft=new WebGLRenderTarget(r,o),Ht={name:"MirrorShader",uniforms:UniformsUtils.merge([UniformsLib.fog,UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new Matrix4},eye:{value:new Vector3},waterColor:{value:new Color$1(5592405)}}]),vertexShader:`
|
|
5281
|
+
}`};class CityPlane extends Z$1{constructor(r){super();C0(this,"options");C0(this,"plane");C0(this,"water");this.options=gi({color:"#0C4557",map:null},r)}create(){return B0(this,null,function*(){const{width:r,height:o,color:V,map:le,material:fe}=this.options,Le=new PlaneGeometry(r,o,2,2);this.plane=Le;const Ce=fe||new MeshBasicMaterial({color:V,map:le});this.createMesh(Le,Ce)})}addWater(){const r=this.pencil.loader,o=new Water(this.plane.clone(),{color:"#ffffff",scale:1,flowDirection:new Vector2(0,0),flowSpeed:1e-9,textureWidth:1024,textureHeight:1024,normalMap0:r.getAsset("/image/water/normalMap0.jpg"),normalMap1:r.getAsset("/image/water/normalMap1.jpg"),reflectivity:.04});this.water=o,o.position.z=.001,this.add(o)}}const fragmentShader="varying vec2 vUv;uniform vec3 uColor;uniform float uOpacity;uniform float uSpeed;uniform float uLineCount;uniform float time;float PI=3.14159265;float drawCircle(float index,float range){float opacity=1.0;if(index>=1.0-range){opacity=1.0-(index-(1.0-range))/range;}else if(index<=range){opacity=index/range;}return opacity;}float distanceTo(vec2 src,vec2 dst){float dx=src.x-dst.x;float dy=src.y-dst.y;return sqrt(dx*dx+dy*dy);}void main(){float iTime=-time*uSpeed;float opacity=0.0;float len=distanceTo(vec2(0.5,0.5),vec2(vUv.x,vUv.y));float size=1.0/uLineCount;vec2 range=vec2(0.5,0.8);float index=mod(iTime+len,size);if(index<size&&len<=0.5){float i=sin(index/size*PI);if(i>=range.x&&i<=range.y){float t=(i-range.x)/(range.y-range.x);float r=0.3;opacity=drawCircle(t,r);}opacity*=1.0-len/0.5;}gl_FragColor=vec4(uColor,opacity*uOpacity);}",vertexShader="varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",fs="uniform sampler2D uTexture;uniform vec2 uOffset;uniform float uRepeat;uniform float uOpacity;varying vec2 vUv;void main(){vec4 color=texture2D(uTexture,vUv+uOffset);float alpha=smoothstep(uRepeat,0.0,vUv.y);if(color.a<0.1){discard;}gl_FragColor=vec4(color.rgb,alpha*uOpacity);}",vs="uniform float uRepeat;varying vec2 vUv;void main(){vUv=uv*uRepeat;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",width=10,height=20,radialSegments=32;function getCanvasTexture(v){const e=document.createElement("canvas");e.width=256,e.height=256;const r=e.getContext("2d"),o=r.createLinearGradient(0,0,0,256);o.addColorStop(0,`rgba(${v}, 1)`),o.addColorStop(.1,`rgba(${v}, 1)`),o.addColorStop(.1,"rgba(255, 255, 255, 0.00)"),o.addColorStop(1,"rgba(255, 255, 255, 0.00)"),r.fillStyle=o,r.fillRect(0,0,256,256);const V=new CanvasTexture(e);return V.colorSpace=SRGBColorSpace,V.wrapT=RepeatWrapping,V.magFilter=NearestFilter,V.minFilter=NearestFilter,e.remove(),V}class Target extends Z$1{constructor(r){super();C0(this,"options");C0(this,"time",{value:0});C0(this,"offset",new Vector2(0,0));C0(this,"timer",null);C0(this,"inTween",null);C0(this,"outTween",null);this.options=r}createWave(r){const o=width*3,V=new PlaneGeometry(o,o,1,1),le=new ShaderMaterial({uniforms:{uColor:{value:new Color$1(`rgb(${r})`)},uOpacity:{value:0},uSpeed:{value:.1},uLineCount:{value:3},uRadius:{value:o/2},time:this.time},blending:AdditiveBlending,depthWrite:!1,transparent:!0,vertexShader,fragmentShader});return new Mesh(V,le)}createRipple(r){const o=new ShaderMaterial({uniforms:{uTexture:{value:r},uOffset:{value:this.offset},uRepeat:{value:6},uOpacity:{value:1}},fragmentShader:fs,vertexShader:vs,transparent:!0,depthWrite:!1,blending:AdditiveBlending,side:DoubleSide}),V=width,le=height*1.5,fe=new CylinderGeometry(V,V,le,radialSegments,1,!0),Le=new Mesh(fe,o);return Le.translateZ(le/2),Le.rotateX(Math.PI/2),Le}createCylinder(r){const o=width-.1,V=new CylinderGeometry(o,o,height,radialSegments,1,!0),le=new MeshBasicMaterial({map:r,transparent:!0,side:DoubleSide,opacity:.3}),fe=new Object3D,Le=new Mesh(V,le);return Le.translateZ(height/2),Le.rotateX(Math.PI/2),fe.add(Le),fe.scale.setZ(1),fe}createTorus(r){const o=new TorusGeometry(width/3,.4,6,36),V=new MeshBasicMaterial({color:`rgb(${r})`,transparent:!0,opacity:0}),le=new Mesh(o,V);return le.translateZ(1),le}create(){return B0(this,null,function*(){const{scale:r=.03}=this.options;this.createGroup();const o=this.pencil.loader,V="241, 241, 86",le=o.getAsset("/image/city/cylinder.webp"),fe=getCanvasTexture(V),Le=this.createRipple(fe);this.object3d.add(Le);const Ce=this.createCylinder(le);this.object3d.add(Ce),this.object3d.scale.multiplyScalar(r)})}erase(){this.inTween&&(this.inTween.stop(),this.inTween=null),this.timer&&(clearTimeout(this.timer),this.timer=null),this.outTween&&(this.outTween.stop(),this.outTween=null),super.erase()}update(r,o){this.time.value+=.01,this.offset.y-=.02}}const objs$2=qi(gi({},objs$3),{Building,Road,Area,CityPlane,Target}),png2webp=(v,e=2048)=>new Promise((r,o)=>{const V=document.createElement("img");V.crossOrigin="anonymous";const le=()=>{V.removeEventListener("load",le,!1),V.removeEventListener("error",fe,!1);const Le=document.createElement("canvas");if(Le.width=V.naturalWidth,Le.height=V.naturalHeight,Le.width>e||Le.height>e){const Pe=Math.min(e/Le.width,e/Le.height);Le.width*=Pe,Le.height*=Pe}Le.getContext("2d").drawImage(V,0,0,Le.width,Le.height);const Ce=Le.toDataURL("image/webp"),Re=new Image;Re.onload=()=>{r(Re)},Re.src=Ce},fe=()=>{V.removeEventListener("load",le,!1),V.removeEventListener("error",fe,!1),o(new Error("Image load error"))};V.addEventListener("load",le,!1),V.addEventListener("error",fe,!1),V.src=v}),ec=(v,e)=>{const r=stringToUtf8ByteArray(v),o=stringToUtf8ByteArray(e).map(function(V,le){return V^r[Math.floor(le%r.length)]}).join(",");return btoa(o)};function stringToUtf8ByteArray(v){const e=[];let r=0;for(let o=0;o<v.length;o++){let V=v.charCodeAt(o);V<128?e[r++]=V:V<2048?(e[r++]=V>>6|192,e[r++]=V&63|128):(V&64512)==55296&&o+1<v.length&&(v.charCodeAt(o+1)&64512)==56320?(V=65536+((V&1023)<<10)+(v.charCodeAt(++o)&1023),e[r++]=V>>18|240,e[r++]=V>>12&63|128,e[r++]=V>>6&63|128,e[r++]=V&63|128):(e[r++]=V>>12|224,e[r++]=V>>6&63|128,e[r++]=V&63|128)}return e}const TEMPLATE_CONFIGS={"7s93q0lma4n9887":{id:"7s93q0lma4n9887",mapIndex:4,mapId:"398-0",emissiveMapIndex:5,emmisiveMapId:"419-0"},l7ojr7nqc06u24f:{id:"l7ojr7nqc06u24f",mapIndex:7,mapId:"245-0",emissiveMapIndex:6,emmisiveMapId:"177-0",cityOnly:!0},"2xli7429f48857f":{id:"2xli7429f48857f",emissiveMapIndex:14,emmisiveMapId:"1140-0"}},getBaseUrl=()=>{const v="/";return v==="/"?"":v},getAdcodeInfo=v=>{const e=findAdcodeInfo(v);if(!e)throw new Error(`Adcode ${v} not found`);return e},fetchGeojsonData=(v,e,r,o)=>B0(exports,null,function*(){const V=o||e,{res:le}=yield jsonFetch(`${v}/geojson/${V}/${r}.json`);return le}),processTemplateImages=(v,e,r,o,V)=>B0(exports,null,function*(){const le=TEMPLATE_CONFIGS[v];if(!(!le||le.cityOnly&&!V))try{if(le.mapIndex!==void 0||le.mapId!==void 0){const fe=yield png2webp(`${r}/template/${v}/${e}.jpg`);Array.isArray(o)?(o[le.mapIndex]=fe.src,console.log(`已替换模板 ${v} 的 map 资源, ${le.mapIndex}`)):(o[le.mapId]=fe.src,console.log(`已替换模板 ${v} 的 map 资源, ${le.mapId}`))}if(le.emissiveMapIndex!==void 0||le.emmisiveMapId!==void 0){const fe=yield png2webp(`${r}/template/${v}/${e}-自发光.jpg`);Array.isArray(o)?(o[le.emissiveMapIndex]=fe.src,console.log(`已替换模板 ${v} 的 emissiveMap 资源, ${le.emissiveMapIndex}`)):(o[le.emmisiveMapId]=fe.src,console.log(`已替换模板 ${v} 的 emissiveMap 资源, ${le.emmisiveMapId}`))}}catch(fe){console.warn(`模板 ${v} 图像资源加载失败:`,fe)}}),getMapConfig=(V,...le)=>B0(exports,[V,...le],function*(v,e=getBaseUrl(),r,o){if((r==null?void 0:r.style)==="map2CityOnMap")return getMapWithCityConfig(v,e,r,o);if(v===0)return{mapDepth:5,adcode:0,extrudeLine:!1,worldPacificCentre:!0,center:[0,0]};{const fe=getAdcodeInfo(v);return extendMapConfig({center:[fe.lng,fe.lat],adcode:fe.adcode},e,r,o)}}),getMapWithCityConfig=(V,...le)=>B0(exports,[V,...le],function*(v,e=getBaseUrl(),r,o){const fe=getAdcodeInfo(v),Le=fe?findAdcodeInfo(fe.parent):null,Ce=(fe==null?void 0:fe.level)==="district"&&(Le==null?void 0:Le.level)==="city";return extendMapConfig({center:[fe.lng,fe.lat],adcode:fe.adcode,style:"map2CityOnMap",mapDepth:.004,mergeSide:!0,nearbyCities:Ce},e,r,o)}),extendMapConfig=(V,...le)=>B0(exports,[V,...le],function*(v,e=getBaseUrl(),r,o){var Vt,wt;if(v.adcode===0||v.adcode===1e5)return gi({},v);const fe=v.adcode,Le=getAdcodeInfo(fe),Ce=Le.level==="province",Re=Le.level==="city"||Le.level==="district"&&getAdcodeInfo(Le.parent).level==="province",Pe=(Vt=v.fixGeojson)==null?void 0:Vt[fe],ze=(wt=v.fixGeojson)==null?void 0:wt[fe+"-lite"],Fe=yield fetchGeojsonData(e,"json",fe,Pe),ke=yield fetchGeojsonData(e,"json-lite",fe,ze),Gt=qi(gi({},v),{geojsonMap:{[fe]:Fe},extrudeLineGeojsonMap:{[fe]:ke},cityBboxMap:{},jsonNameObj:{},depthReference:void 0,showBuilding:!Ce,__template:r==null?void 0:r.__template});if(r!=null&&r.__template&&o&&(yield processTemplateImages(r.__template,fe,e,o,Re)),v.parentBg){const xt=Le.parent;if(xt!==1e5){const Xt=yield fetchGeojsonData(e,"json",xt),Zt=yield fetchGeojsonData(e,"json-lite",xt);Gt.geojsonMap[xt]=Xt,Gt.extrudeLineGeojsonMap[xt]=Zt}}return r&&(Gt.depthReference=r.depthReference||getAdcodeInfo(r.adcode).b),Gt}),getCityConfig=v=>B0(exports,null,function*(){const e=getAdcodeInfo(v),{name:r}=e;return{center:[e.lng,e.lat],adcode:e.adcode,jsonName:ec(r,`${v}`)}}),removeCameraHistory=v=>v.filter(e=>!(e.objectUuid==="camera"&&["SetPosition","SetTarget"].includes(e.type))),setWaterMaterial=(v,e={})=>{const r=e.textureWidth!==void 0?e.textureWidth:512,o=e.textureHeight!==void 0?e.textureHeight:512,V=e.alpha!==void 0?e.alpha:1,le=e.waterNormals!==void 0?e.waterNormals:null,fe=new Color$1(e.waterColor!==void 0?e.waterColor:v.material.color),Le=e.eye!==void 0?e.eye:new Vector3(0,0,0),Ce=e.distortionScale!==void 0?e.distortionScale:0,Re=e.side!==void 0?e.side:FrontSide,Pe=e.fog!==void 0?e.fog:!1,ze=new Plane$1,Fe=new Vector3,ke=new Vector3,Gt=new Vector3,Vt=new Matrix4,wt=new Vector3(0,0,-1),xt=new Vector4,Xt=new Vector3,Zt=new Vector3,Wt=new Vector4,It=new Matrix4,Nt=new PerspectiveCamera,Ft=new WebGLRenderTarget(r,o),Ht={name:"MirrorShader",uniforms:UniformsUtils.merge([UniformsLib.fog,UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new Matrix4},eye:{value:new Vector3},waterColor:{value:new Color$1(5592405)}}]),vertexShader:`
|
|
5282
5282
|
uniform mat4 textureMatrix;
|
|
5283
5283
|
uniform float time;
|
|
5284
5284
|
|
|
@@ -5359,8 +5359,8 @@ version 0.8.2
|
|
|
5359
5359
|
#include <tonemapping_fragment>
|
|
5360
5360
|
#include <colorspace_fragment>
|
|
5361
5361
|
#include <fog_fragment>
|
|
5362
|
-
}`},Kt=new ShaderMaterial({name:Ht.name,uniforms:UniformsUtils.clone(Ht.uniforms),vertexShader:Ht.vertexShader,fragmentShader:Ht.fragmentShader,lights:!0,side:Re,fog:Pe});Kt.uniforms.mirrorSampler.value=Ft.texture,Kt.uniforms.textureMatrix.value=It,Kt.uniforms.alpha.value=V,Kt.uniforms.normalSampler.value=le,Kt.uniforms.waterColor.value=fe,Kt.uniforms.distortionScale.value=Ce,Kt.uniforms.eye.value=Le;const Yt=v.material;v.material=Kt,v.onBeforeRender=function(jt,n0,a0){Yt.color!==Kt.uniforms.waterColor.value&&(Kt.uniforms.waterColor.value=Yt.color),ke.setFromMatrixPosition(v.matrixWorld),Gt.setFromMatrixPosition(a0.matrixWorld),Vt.extractRotation(v.matrixWorld),Fe.set(0,0,1),Fe.applyMatrix4(Vt),Xt.subVectors(ke,Gt),a0.updateMatrix(),a0.updateMatrixWorld(),v.updateMatrix(),v.updateMatrixWorld();const l0=new Frustum,s0=new Matrix4;if(s0.multiplyMatrices(a0.projectionMatrix,a0.matrixWorldInverse),l0.setFromProjectionMatrix(s0),!l0.intersectsObject(v)||Xt.dot(Fe)>0)return;Xt.reflect(Fe).negate(),Xt.add(ke),Vt.extractRotation(a0.matrixWorld),wt.set(0,0,-1),wt.applyMatrix4(Vt),wt.add(Gt),Zt.subVectors(ke,wt),Zt.reflect(Fe).negate(),Zt.add(ke),Nt.position.copy(Xt),Nt.up.set(0,1,0),Nt.up.applyMatrix4(Vt),Nt.up.reflect(Fe),Nt.lookAt(Zt),Nt.far=a0.far,Nt.updateMatrixWorld(),Nt.projectionMatrix.copy(a0.projectionMatrix),It.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),It.multiply(Nt.projectionMatrix),It.multiply(Nt.matrixWorldInverse),ze.setFromNormalAndCoplanarPoint(Fe,ke),ze.applyMatrix4(Nt.matrixWorldInverse),xt.set(ze.normal.x,ze.normal.y,ze.normal.z,ze.constant);const $t=Nt.projectionMatrix;Wt.x=(Math.sign(xt.x)+$t.elements[8])/$t.elements[0],Wt.y=(Math.sign(xt.y)+$t.elements[9])/$t.elements[5],Wt.z=-1,Wt.w=(1+$t.elements[10])/$t.elements[14],xt.multiplyScalar(2/xt.dot(Wt)),$t.elements[2]=xt.x,$t.elements[6]=xt.y,$t.elements[10]=xt.z+1,$t.elements[14]=xt.w,Le.setFromMatrixPosition(a0.matrixWorld);const qt=jt.getRenderTarget(),e0=jt.xr.enabled,o0=jt.shadowMap.autoUpdate;v.visible=!1,jt.xr.enabled=!1,jt.shadowMap.autoUpdate=!1,jt.setRenderTarget(Ft),jt.state.buffers.depth.setMask(!0),jt.autoClear===!1&&jt.clear(),jt.render(n0,Nt),v.visible=!0,jt.xr.enabled=e0,jt.shadowMap.autoUpdate=o0,jt.setRenderTarget(qt);const b0=a0.viewport;b0!==void 0&&jt.state.viewport(b0)}};class City$1 extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs$2);C0(this,"adcode",0);C0(this,"pcenter",[104,37.5]);C0(this,"pscale",5e4);C0(this,"projection");C0(this,"group");C0(this,"outAreaGroup");C0(this,"building");C0(this,"road");C0(this,"multiplyScalar",1)}setOptions(r){super.setOptions(gi({fitTo:!0,plane:!0,grey:!1,showBuilding:!0,showRoad:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,ssao:!0,buildingHasSide:!0},r))}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(r){this.loader.add([this.options.showBuilding&&`/cityGzip/Building${r}.json.gzip`,this.options.showRoad&&`/cityGzip/Road${r}.json.gzip`,this.options.showRiver&&`/cityGzip/River${r}.json.gzip`,this.options.showGrassland&&`/cityGzip/Grassland${r}.json.gzip`].filter(Boolean),{})}initMaterial(){return B0(this,null,function*(){if(this.mList.get("city-plane-mat")){console.log("city-plane-mat exist");return}if(this.options.showBuilding){const r=["20","60","max"].reduce((V,le)=>{const fe=this.loader.getAsset(`/image/city/${le}-1.jpg`),Le=this.loader.getAsset(`/image/city/${le}.webp`);return V[le]=[new MeshBasicMaterial({name:"建筑顶面-板块内"+le+"高",color:"#00a3bc"}),new MeshStandardMaterial({name:"建筑侧面-板块内"+le+"高",map:fe,normalMap:Le,envMap:this.getRoomEnvMap()})],[fe,Le].forEach(Ce=>{Ce.wrapS=RepeatWrapping,Ce.wrapT=RepeatWrapping,Ce.repeat.set(1,1)}),V},{});this.mList.addMultiple("building",{"20Top":r[20][0],"20Side":r[20][1],"60Top":r[60][0],"60Side":r[60][1],maxTop:r.max[0],maxSide:r.max[1]});const o=["20","60","max"].reduce((V,le)=>{const fe=this.loader.getAsset(`/image/city/${le}-1.jpg`),Le=this.loader.getAsset(`/image/city/${le}.webp`);return V[le]=[new MeshBasicMaterial({name:"建筑顶面-板块外"+le+"高",color:"#133144"}),new MeshStandardMaterial({name:"建筑侧面-块外"+le+"高",map:fe,normalMap:Le,envMap:this.getRoomEnvMap()})],[fe,Le].forEach(Ce=>{Ce.wrapS=RepeatWrapping,Ce.wrapT=RepeatWrapping,Ce.repeat.set(1,1)}),V},{});this.mList.addMultiple("building-grey",{"20Top":o[20][0],"20Side":o[20][1],"60Top":o[60][0],"60Side":o[60][1],maxTop:o.max[0],maxSide:o.max[1]})}if(this.options.showRoad){const r=new kt({name:"道路-板块内",color:"#ffc457",sizeAttenuation:!1,lineWidth:12}),o=new kt({name:"道路-板块外",color:"#4a3f15",sizeAttenuation:!1,lineWidth:12});this.mList.addMultiple("road",{primary:r}),this.mList.addMultiple("road-grey",{primary:o})}(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 r=this.pencil.composerController.ssaoPass;r&&r.enabled&&(r.enabled=!1,console.log("disableSSAO"))}enabledSSAO(){const r=this.pencil.composerController.ssaoPass;r&&!r.enabled&&(r.enabled=!0,console.log("enabledSSAO"))}init(){return B0(this,null,function*(){this.options.jsonName||(this.options.jsonName=(yield getCityConfig(this.options.adcode)).jsonName);const{jsonName:r,adcode:o}=this.options;yield this.initPencil(),this.loaderAdd(),this.loaderAddJson(r),console.time(`vis-core:time.${this.visName}${o}-loader`),yield this.loader.loadAll(),console.timeEnd(`vis-core:time.${this.visName}${o}-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${o}`});const V=findAdcodeInfo(o);this.group.object3d.name=`城市-${V?V.name:o}`,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(r){var o,V;return(V=(o=this.projection).invert)==null?void 0:V.call(o,[r.x,-r.z])}fitTo(r,o=!0){return B0(this,null,function*(){this.pencil.controls.fitToBox(r.object3d,o),this.pencil.controls.rotatePolarTo(this.pencil.camera.up.z===1?Math.PI/180*70:Math.PI/180*160,o)})}initVis(){return B0(this,null,function*(){const{fitTo:r,jsonName:o}=this.options,V=this.adcode,le=this.loader,fe=this.options.showBuilding&&le.getAsset(`/cityGzip/Building${o}.json.gzip`),Le=this.options.showRoad&&le.getAsset(`/cityGzip/Road${o}.json.gzip`),Ce=this.options.showRiver&&le.getAsset(`/cityGzip/River${o}.json.gzip`),Re=this.options.showGrassland&&le.getAsset(`/cityGzip/Grassland${o}.json.gzip`),Pe={};[...(Ce==null?void 0:Ce.features)||[],...(Re==null?void 0:Re.features)||[]].forEach(It=>{It.properties.o&&(Pe[It.properties.o]=!0)});const ze=Object.keys(Pe).map(It=>+It).sort((It,Nt)=>It-Nt),Fe=-f({center:this.pcenter,scale:this.pscale})([this.pcenter[0],899e-8+this.pcenter[1]])[1],ke=findAdcodeInfo(V).b,Gt=this.projection([ke[0],ke[1]]),Vt=this.projection([ke[2],ke[3]]),wt=Math.abs(Vt[0]-Gt[0]),xt=Math.abs(Vt[1]-Gt[1]),Xt=wt,Zt=xt,Wt=this.mList.get("city-plane-mat");if(!this.options.grey){const It=yield this.lead.draw("CityPlane",{width:Xt*10,height:Zt*10,material:Wt},this.outAreaGroup);It.object3d.name="底面",this.lead.updateBaseObjectKey(It,{type:"city-plane"})}yield Promise.all([fe&&this.drawBuilding({json:fe,meters:Fe,grey:this.options.grey,sideGradient:this.options.buildingSideGradient,hasSide:this.options.buildingHasSide}),Le&&this.drawRoad({json:Le,meters:Fe,z:ze.length,grey:this.options.grey}),Ce&&this.drawArea({json:Ce,type:"river",oArr:ze,grey:this.options.grey}),Re&&this.drawArea({json:Re,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 B0(this,arguments,function*(r={}){if(!r.json){console.warn(" json:Building");return}const o=this.options.cacheKey?`building-${this.options.cacheKey}${r.grey?"-grey":""}${r.hasSide?"":"-no-side"}`:void 0,V=yield this.lead.draw("Building",{key:"$p:-building",projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:o,meters:r.meters,sideGradient:r.sideGradient,grey:r.grey,hasSide:r.hasSide},this.group);return this.building=V,V})}drawArea(){return B0(this,arguments,function*(r={}){if(!r.json){console.warn(" json:drawGeography");return}if(!r.type)return;const{grey:o}=r,V=o?"-grey":"",le=this.options.cacheKey?`${r.type}-${this.options.cacheKey}${V}`:void 0,fe=yield this.lead.draw("Area",{key:`$p:-${r.type}`,projection:{center:this.pcenter,scale:this.pscale},json:r.json,material:this.mList.getMultiple("geography"+V)[r.type],type:r.type,cacheKey:le,oArr:r.oArr},this.group);return fe.object3d.name=r.type==="river"?"河流":"绿地",r.type==="river"&&!o&&this.options.setWaterMaterial&&fe.area.forEach(Le=>{setWaterMaterial(Le.object3d)}),fe})}drawRoad(){return B0(this,arguments,function*(r={}){if(!r.json){console.warn(" json:Road");return}const o=this.options.cacheKey?`road-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,V=yield this.lead.draw("Road",{key:"$p:-road",projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:o,grey:r.grey,meters:r.meters},this.group),le=r.z||0;return V.position.z=(le+1)*.001,r.grey||(this.lead.updateBaseObjectKey(V,{type:"road",key:"group"}),this.initBaseObjectUserData(V)),r.grey||(this.road=V),V})}getWorldPosition(r,o){if(this.options.coordtransformFunc){const fe=this.options.coordtransformFunc(r,o);r=fe.longitude,o=fe.latitude}const[V,le]=this.projection([r,o]);return{x:V,y:-le}}}C0(City$1,"VisName","city");const hideMaterial=new MeshBasicMaterial({colorWrite:!1,transparent:!0});let PlaneMap$1=class extends Z$1{constructor(r){var o;super();C0(this,"options");C0(this,"isActive",!0);C0(this,"groupArr",[]);C0(this,"areaArr",[]);C0(this,"lineArr");C0(this,"mergeSideArea",null);C0(this,"extrudelineArr");C0(this,"splitPolygons",0);this.options=gi({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:{}},r),((o=this.options.projection.rotate)==null?void 0:o[0])===-160&&(this.options.projection.projectionType==="winkel3"?this.splitPolygons=100:this.splitPolygons=300)}create(){return B0(this,null,function*(){const{geojson:r,extrudeLineGeojson:o,bbox:V,areaGroup:le,materialOptions:fe,hasSide:Le,hasTop:Ce,hasLine:Re,mergeSide:Pe}=this.options;this.createGroup();const ze=this.pencil.lead;if(le){const Ht=yield Promise.all(r.features.map(Kt=>B0(this,null,function*(){const{properties:Yt}=Kt,jt=`${this.getPropertiesKey(Yt)}`,n0=yield ze.draw("Group",{target:this,key:jt});return n0.object3d.name=(Yt==null?void 0:Yt.adcode)==="100000_JD"?"十段线":Yt==null?void 0:Yt.name,n0.userData=gi({},Yt),n0})));this.groupArr=Ht}const{lineMat:Fe,extrudeLineMat:ke,topMat:Gt,sideMat:Vt,bgTopMat:wt,bgSideMat:xt,bgLineMat:Xt,bgExtrudeLineMat:Zt}=fe,[Wt,It,Nt,Ft]=yield Promise.all([(Ce||Ce)&&this.addArea(r,{material:Le?[Gt,Pe?hideMaterial:Vt]:Gt,bbox:V,areaGroup:le,hasSide:Le,hasTop:!0,castShadow:!Pe,onTop:this.options.onTop}),Re&&this.addLine(r,{material:Fe,onTop:this.options.onTop+2,areaGroup:le}),o&&this.addLine(o,{material:ke,onTop:this.options.onTop+3}),Pe&&o&&this.addArea(o,{material:Vt,bbox:V,castShadow:!0,areaGroup:!1,hasSide:!0,hasTop:!1,onTop:this.options.onTop})]);Ft&&(this.mergeSideArea=Ft[0],this.mergeSideArea.object3d.name="板块合并侧面"),Wt&&(this.areaArr=Wt),It&&(this.options.conic||It.forEach(Ht=>{Ht.position.z=this.options.depth+this.options.lineOffset}),this.lineArr=It),Nt&&(Nt.forEach(Ht=>{this.options.conic||(Ht.position.z=this.options.depth+this.options.lineOffset),this.lead.updateBaseObjectKey(Ht,{key:this.getPropertiesKey({name:"extrudeLine"})})}),this.extrudelineArr=Nt),wt&&xt&&this.setAreaMaterial("bg",[wt,xt]),Xt&&this.setLineMaterial("bg",Xt),Zt&&this.setExtrudeLineMaterial("bg",Zt)})}addArea(r,o){return B0(this,null,function*(){const{bbox:V,material:le,onTop:fe}=o,Le=this.geojson2Meta(r),Ce=this.pencil.getPlugin("worker"),Re=this.pencil.lead;if(this.pencil.mList,o.areaGroup)return yield Promise.all(Le.map(Pe=>B0(this,null,function*(){const{coords:ze,properties:Fe}=Pe,ke=this.findGroup(this.getPropertiesKey(Fe)),Gt=this.options.conic?yield Ce.geoGeometry("conicPolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:V,hasBottom:!1,hasSide:o.hasSide,hasTop:o.hasTop,useGroups:o.hasSide&&o.hasTop?2:0}}):yield Ce.geoGeometry("extrudePolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth]),mesaage:{projection:this.options.projection,topSegments:this.options.topSegments,bbox:V,hasBottom:!1,hasSide:o.hasSide,hasTop:o.hasTop,useGroups:o.hasSide&&o.hasTop?2:0,splitPolygons:this.splitPolygons}}),Vt=`${this.getPropertiesKey(Fe)}`,wt=yield Re.draw("ExtrudePolygon",{key:Vt,geometry:Gt,material:le,onTop:fe},ke);return wt.object3d.name="板块",o!=null&&o.castShadow&&(wt.object3d.castShadow=!0),wt.userData=gi({},Fe),wt})));{const Pe=Le.flatMap(({coords:ke})=>ke),ze=this.options.conic?yield Ce.geoGeometry("conicPolygon",{coordinatesArr:Pe,metaArray:Pe.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:V,hasBottom:!1,hasSide:o.hasSide,hasTop:o.hasTop,useGroups:2}}):yield Ce.geoGeometry("extrudePolygon",{coordinatesArr:Pe,metaArray:Pe.map(()=>[this.options.depth]),mesaage:{projection:gi({},this.options.projection),topSegments:this.options.topSegments,bbox:V,hasSide:o.hasSide,hasTop:o.hasTop,hasBottom:!1,useGroups:2,splitPolygons:this.splitPolygons}}),Fe=yield Re.draw("ExtrudePolygon",{key:this.getPropertiesKey({name:"all"}),geometry:ze,material:le},this);return o!=null&&o.castShadow&&(Fe.object3d.castShadow=!0),Fe.object3d.name="板块",Fe.userData={},[Fe]}})}addLine(r,o){return B0(this,null,function*(){const{material:V,onTop:le}=o,fe=this.geojson2Meta(r),Le=this.pencil.getPlugin("worker"),Ce=this.pencil.lead;if(o.areaGroup)return yield Promise.all(fe.map(Re=>B0(this,null,function*(){const{coords:Pe,properties:ze}=Re,Fe=this.findGroup(this.getPropertiesKey(ze)),ke=this.options.conic?yield Le.geoGeometry("conicLine",{coordinatesArr:Pe,metaArray:Pe.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield Le.geoGeometry("line",{coordinatesArr:Pe,metaArray:Pe.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),Gt=`${this.getPropertiesKey(ze)}`,Vt=yield Ce.draw("Line",{key:Gt,geometry:ke,material:V,onTop:le},Fe);return Vt.userData=gi({},ze),Vt.object3d.name="线",Vt})));{const Re=fe.flatMap(({coords:Fe})=>Fe),Pe=this.options.conic?yield Le.geoGeometry("conicLine",{coordinatesArr:Re,metaArray:Re.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield Le.geoGeometry("line",{coordinatesArr:Re,metaArray:Re.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),ze=yield Ce.draw("Line",{key:this.getPropertiesKey({name:"all"}),geometry:Pe,material:V,onTop:le},this);return ze.object3d.name="线",[ze]}})}getPropertiesKey(r){return`${this.key.split("#")[1]}-${r.adcode||r.iso_a2||r.name}`}geojson2Meta(r){return r.features.filter(o=>o.geometry).map(o=>{const{type:V,coordinates:le}=o.geometry;let fe=[];return V==="Polygon"?fe=le:V==="MultiPolygon"&&(fe=le.flat()),{coords:fe,properties:o.properties}})}update(r,o){const{lineMat:V,extrudeLineMat:le}=this.options.materialOptions;this.isActive&&[V,le].forEach(fe=>{var Le;!fe||!((Le=fe.uniforms.lineLightAnimation)!=null&&Le.value)||(fe.uniforms.time.value=o)})}findGroup(r,o=!1){return this.pencil.lead.getObject("Group",{key:`${o?this.getPropertiesKey({adcode:r}):r}`})}setAreaMaterial(r,o){this.areaArr.forEach(V=>{V.setMaterialList(r,this.mergeSideArea&&Array.isArray(o)?[o[0],hideMaterial]:o)}),this.mergeSideArea&&Array.isArray(o)&&this.mergeSideArea.setMaterialList(r,o[1])}useAreaMaterial(r){this.areaArr.forEach(o=>{o.useMaterial(r)}),this.mergeSideArea&&this.mergeSideArea.useMaterial(r)}setLineMaterial(r,o){this.lineArr.forEach(V=>{V.setMaterialList(r,o)})}useLineMaterial(r){this.lineArr.forEach(o=>{o.useMaterial(r)})}setExtrudeLineMaterial(r,o){var V;(V=this.extrudelineArr)==null||V.forEach(le=>{le.setMaterialList(r,o)})}useExtrudeLineMaterial(r){var o;(o=this.extrudelineArr)==null||o.forEach(V=>{V.useMaterial(r)})}changeLineAnimateParams({speed:r=.5,extrude:o=!1}){const{lineMat:V,extrudeLineMat:le}=this.options.materialOptions,fe=o?le:V;if(!fe)return;fe.uniforms.time.value=0,fe.uniforms.speed.value=r,fe.uniforms.lineLightAnimation.value=1;const{size:Le,min:Ce,max:Re}=this.getSize();fe.uniforms.size.value=Math.max(Le.x,Le.y)/2,fe.uniforms.uCenter.value=new Vector2((Ce.x+Re.x)/2,(Ce.y+Re.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(r){var o;(o=this.extrudelineArr)==null||o.forEach(V=>{r?V.enableBloom():V.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(r){super();C0(this,"options");this.options=gi({radius:30,rotationY:0},r)}create(){const o=this.pencil.mList.get("earthMaterial");this.material=o,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class SphereShadow extends Z$1{constructor(r){super();C0(this,"options");this.options=gi({radius:30},r)}create(){return B0(this,null,function*(){const r=new SphereGeometry(this.options.radius,128,90),o=new MeshBasicMaterial;this.createMesh(r,o),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs$1=qi(gi({},objs$3),{Earth,SphereShadow,Countries:PlaneMap$1}),base$2=v=>{v.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth2/basic.jpg","/image/earth2/NormalMap.jpg"])},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=e.getAsset("/image/earth2/basic.jpg"),o=e.getAsset("/image/earth2/NormalMap.jpg"),V=new MeshStandardMaterial({name:"地球材质",map:r,metalness:.1,roughness:.8,normalMap:o,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",V)})},v.initVis=function(){return B0(this,null,function*(){v.pencil.camera.near=1,v.pencil.camera.far=3e3,v.pencil.camera.fov=12,v.pencil.camera.updateProjectionMatrix();const[e,r]=yield Promise.all([this.lead.draw("Light",{type:"PointLight",intensity:4,color:16777215,distance:0,decay:0}),this.lead.draw("Earth",{radius:100,rotationY:Math.PI/180*90})]);yield this.pencil.controls.fitToBox(r.object3d,!1),e.position.copy(this.pencil.cameraPositon)})}},chinaPlate=v=>{v.extendsOptions=qi(gi({},v.extendsOptions),{otherMapDepth:()=>v.options.otherMapDepth,copyChinaPlane:v.options.copyChinaPlane,mergeSide:()=>v.options.mergeSide}),v.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png","/image/earth/chinaNormal.webp"])},v.initVis=function(){return B0(this,null,function*(){yield this.initLight();const[,e,r]=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(o=>{var V;return((V=o.properties)==null?void 0:V.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="世界",r.object3d.name="中国",r.extrudelineArr&&v.initBaseObjectUserData(r.extrudelineArr[0]),this.map=r,this.options.copyChinaPlane){this.options.copyChinaPlane;const o=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});o.object3d.name="复制中国顶面",this.lead.updateBaseObjectKey(o.children[0],{type:"chinaPlaneCopy"})}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:e.getAsset("/image/earth/chinaNormal.webp")}),o=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:e.getAsset("/image/earth/chinaBorder.png")}),V=new kt({name:"中国边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#59C8FF")}),le=new kt({name:"世界边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#80abaf")}),fe=new MeshBasicMaterial({name:"世界顶面"}),Le=new MeshBasicMaterial({name:"世界侧面"}),Ce=e.getAsset("/image/earth/basic.webp"),Re=new MeshStandardMaterial({name:"地球材质",map:Ce,color:new Color$1(2397309),metalness:.84,roughness:.51}),Pe=e.getAsset("/image/earth/flyline.png");Pe.wrapS=RepeatWrapping,Pe.wrapT=RepeatWrapping,Pe.repeat.set(.5,.5);const ze=new kt({name:"省份边界",map:Pe,lineWidth:.6,sizeAttenuation:!1,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:r,sideMat:o,lineMat:ze,extrudeLineMat:V}),this.mList.addMultiple("world",{topMat:fe,sideMat:Le,lineMat:le}),this.mList.add("earthMaterial",Re)})}},countryPlate=v=>{v.initVis=function(){return B0(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)})},v.initMaterial=function(){return B0(this,null,function*(){const e=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),r=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),o=new kt({name:"边框线",lineWidth:1,sizeAttenuation:!1,color:new Color$1("#006aa3")}),V=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.addMultiple("plane",{topMat:r,sideMat:e,lineMat:o}),this.mList.add("earthMaterial",V)})},v.getLocationPosition=function(e,r=0){const[o,V]=e,le=this.options.mapDepth+this.options.radius+r;return p$2(o,V,le)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base:base$2,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),Fn=class Fn extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs$1);C0(this,"leftTruck",!1);C0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});C0(this,"map")}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(gi({mapDepth:1.4,otherMapDepth:0,radius:30,style:"chinaPlate",copyChinaPlane:!1,mergeSide:!1},r)),this.initSettingsObj={autoRotateSpeed:0},styles[this.options.style](this)}handleSetting(r,o){return B0(this,null,function*(){return yield _n(Fn.prototype,this,"handleSetting").call(this,r,o),r==="autoRotateSpeed"?this.pencil.autoRotate(o):r==="autoRotate"&&(o?this.settings.autoRotateSpeed=-20:this.settings.autoRotateSpeed=0),o})}show(){super.show(),this.animationIn()}animationIn(){const r=this.pencil.controls;r.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),r.addEventListener("controlend",()=>{this.pencil.autoRotate(this.settings.autoRotateSpeed)})}initLight(){return B0(this,null,function*(){const[r,o]=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})]);r.position.set(0,50,-100),o.position.set(0,0,150),r.object3d.lookAt(0,0,0),o.object3d.lookAt(0,0,0)})}getLocationPosition(r,o=0){const[V,le]=r,fe=this.getRadius()+o;return p$2(V,le,fe)}setAreaMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.areaArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#topMat");V!=="origin"&&(Le=fe.material[0].clone(),V.color&&Le.color.set(V.color),V.emissive&&(Le.emissive.set(V.emissive),Le.emissiveIntensity=V.emissiveIntensity||1)),fe.material[0]=Le}}setLineMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.lineArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#outLine");V!=="origin"&&(Le=fe.material.clone(),V.color&&Le.color.set(V.color),V.width&&(Le.lineWidth=V.width)),fe.material=Le}}addAreaPlaneByProperty(r,o,V){return B0(this,null,function*(){if(!this.map)return;const fe=this.map.options.geojson.features.find(Le=>Le.properties&&Le.properties[r]===o);if(fe)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[fe]},depth:this.options.mapDepth+.3,start:this.options.radius,materialOptions:{topMat:new MeshBasicMaterial(V.area),lineMat:new kt(V.line)}})})}getRadius(){const r=this.baseObjectByUuid("earth");return r?r.object3d.geometry.parameters.radius:0}checkBehindEarth(r,o){const V=new Vector3(0,0,0),le=new Vector3(0,0,0),fe=this.getRadius(),Le=()=>{const Ce=r();if(!Ce.length)return;this.pencil.controls.getPosition(le,!1);const Re=V.clone().sub(le),Pe=Math.sqrt(Gn(Re.length(),2)-Gn(fe,2)),ze=Ce.map(Fe=>Fe.position.clone().sub(le).length()>Pe);o(Ce,ze)};Le(),this.pencil.controls.addEventListener("update",()=>{Le()})}setObjectOnSphere(r,o,V=0,le=[0,1,0]){if(r.objectType==="Plane"){const fe=this.getLocationPosition(o,V);r.position.set(...fe);const Le=r.object3d.material;Le&&(Le.side=DoubleSide),r.object3d.lookAt(0,0,0)}else{const fe=r.rotation.clone(),Le=this.getLocationPosition(o,V);r.position.set(...Le);const Ce=new Vector3(...Le).normalize(),Re=new Vector3(...le);Re.applyEuler(fe);const Pe=new Quaternion().setFromUnitVectors(Re,Ce);r.object3d.applyQuaternion(Pe)}}};C0(Fn,"VisName","earth");let index$1=Fn;const timeOut=v=>B0(exports,null,function*(){const e=esusLite.makePromiseCreator();return setTimeout(()=>{e.resolve()},v),e.promise}),getTween=v=>({onUpdate:e=V=>{},onComplete:r=()=>{},backwards:o=!0}={})=>{o&&e(0);const V=new Tween({v:0});return{start:({duration:le=1e3,repeat:fe=0,repeatResolve:Le=1,repeatDelay:Ce=0}={})=>{const Re=esusLite.makePromiseCreator();let Pe=0;return V.to({v:1},le).onUpdate(({v:ze})=>{e(ze)}).onComplete(()=>{e(1),r(),Re.resolve()}).onRepeat(()=>{Pe++,Pe>=Le&&Re.resolve()}).repeat(fe).repeatDelay(Ce).easing(v).start(),Re.promise},stop:()=>{V.stop()}}},sinusoidalInOut=getTween(Easing.Sinusoidal.InOut),baseObjectFadeIn=v=>{const e=new Set,r=new Set;v.object3d.traverse(V=>{const le=V;le.material&&(Array.isArray(le.material)?le.material:[le.material]).forEach(Le=>{e.add(Le)})});const o=new Map;return e.forEach(V=>{o.set(V,V.opacity),V.transparent||(r.add(V),V.transparent=!0,V.needsUpdate=!0)}),sinusoidalInOut({onUpdate:V=>{e.forEach(le=>{le.opacity=V*o.get(le)})},onComplete:()=>{r.forEach(V=>{V.transparent=!1,V.needsUpdate=!0}),e.clear(),r.clear(),o.clear()}})},baseObjectFadeOut=v=>{const e=new Set,r=new Set;v.object3d.traverse(V=>{const le=V;le.material&&(Array.isArray(le.material)?le.material:[le.material]).forEach(Le=>{e.add(Le)})});const o=new Map;return e.forEach(V=>{o.set(V,V.opacity),V.transparent||(r.add(V),V.transparent=!0,V.needsUpdate=!0)}),sinusoidalInOut({onUpdate:V=>{e.forEach(le=>{le.opacity=(1-V)*o.get(le)})},onComplete:()=>{e.clear(),r.clear(),o.clear()}})},baseObjectBounceIn=(v,e="z")=>{const r=e.trim().split(""),o=r.reduce((V,le)=>(V[le]=v.scale[le],V),{});return sinusoidalInOut({onUpdate:V=>{r.forEach(le=>{v.scale[le]=o[le]*V})}})},baseObjectBounce=(v,e="z",r)=>{const o=e.trim().split(""),V=o.reduce((le,fe)=>(le[fe]=v.scale[fe],le),{});return sinusoidalInOut({onUpdate:le=>{o.forEach(fe=>{v.scale[fe]=V[fe]+(r-V[fe])*le})}})},animation=Object.freeze(Object.defineProperty({__proto__:null,baseObjectBounce,baseObjectBounceIn,baseObjectFadeIn,baseObjectFadeOut,sinusoidalInOut,timeOut},Symbol.toStringTag,{value:"Module"}));class ContinentsBg extends Z$1{constructor(r){super();C0(this,"options");C0(this,"mapArr",[]);this.options=r}create(){return B0(this,null,function*(){const{depth:r}=this.options,o=this.pencil.mList,V=this.pencil.lead,le=o.getMultiple("continents");this.createGroup(),this.object3d.name="大洲",yield Promise.all(Object.values(continentsLiteJson).map(fe=>B0(this,null,function*(){const Le=fe.features[0],Ce=Le.properties.adcode;if(Ce===10)return;const Re=turf.centroid(Le).geometry.coordinates;let Pe=0,ze=0,Fe=this.options.scale;const ke=30,Gt=25;Ce===5?(Pe=-ke,ze=Gt,Fe=Fe*.2):Ce===21?(Pe=0,ze=Gt,Fe=Fe*.18):Ce===9?(Pe=ke,ze=Gt,Fe=Fe*.3):Ce===142?(Pe=-ke,ze=-Gt,Fe=Fe*.15):Ce===150?(Pe=0,ze=-Gt,Fe=Fe*.3):Ce===2&&(Pe=ke,ze=-Gt,Fe=Fe*.2);const Vt=yield V.draw("PlaneMap",{key:`${this.key}-${Ce}`,geojson:fe,projection:{center:Re,scale:Fe,rotate:[0,0],projectionType:"equirectangular"},areaGroup:!1,depth:r,materialOptions:gi({},le)},this);Vt.userData.projection=f({center:Re,scale:Fe,rotate:[0,0],projectionType:"equirectangular"}),Vt.object3d.name=Le.properties.name,Vt.userData.name=Le.properties.name,Vt.position.set(Pe,ze,0),this.mapArr.push(Vt)})))})}getPointInContinentInfo(r){var o;return(o=Object.values(continentsLiteJson).map(V=>V.features).find(V=>V[0].geometry.coordinates.some(le=>le.length?turf.booleanPointInPolygon(turf.point(r),turf.polygon(le)):!1)))==null?void 0:o[0]}getPointInContinent(r){return!!this.getPointInContinentInfo(r)}getLocationPosition(r,o){var le;const V=o||((le=this.getPointInContinentInfo(r))==null?void 0:le.properties.name);if(V){const fe=this.mapArr.find(Le=>Le.userData.name===V);if(fe){const{projection:Le}=fe.userData,[Ce,Re]=r,[Pe,ze]=Le([Ce,Re]),Fe=new Vector3(Pe,-ze,this.options.depth);return Fe.applyMatrix4(fe.object3d.matrixWorld),[Fe.x,Fe.y,Fe.z]}}}render(){this.lead.updateBaseObjectKey(this,{type:"continents-group"}),this.mapArr.forEach(r=>{this.lead.updateBaseObjectKey(r,{type:"continents-"+r.userData.name})})}dispose(){this.mapArr.forEach(r=>{r.dispose()}),this.mapArr.length=0}}class PlaneMap extends Z$1{constructor(r){super();C0(this,"options");C0(this,"extrudePolygon");this.options=gi({depth:2},r)}geojson2Meta(r){return r.features.filter(o=>o.geometry).map(o=>{const{type:V,coordinates:le}=o.geometry;let fe=[];return V==="Polygon"?fe=le:V==="MultiPolygon"&&(fe=le.flat()),{coords:fe,properties:o.properties}})}create(){return B0(this,null,function*(){const{geojson:r,bbox:o}=this.options,V=this.geojson2Meta(r),le=this.pencil.getPlugin("worker"),fe=this.pencil.lead,Ce=yield this.pencil.loader.load("/1.png"),Re=V.flatMap(({coords:Zt})=>Zt),Pe=yield le.geoGeometry("extrudePolygon",{coordinatesArr:Re,metaArray:Re.map(()=>[this.options.depth]),mesaage:{projection:gi({},this.options.projection),topSegments:100,bbox:o,hasBottom:!1,hasSide:!1}}),ze=Pe.attributes.position.count;Pe.setAttribute("color",new BufferAttribute(new Float32Array(ze*3),3));const Fe=this.options.depth;this.setNoise(Pe,Ce.image,Fe);const ke=new Color$1,Gt=Pe.attributes.color,Vt=Pe.attributes.position,wt=new Color$1("red"),xt=new Color$1("green");for(let Zt=0;Zt<ze;Zt++){const Wt=Vt.getZ(Zt)/Fe;ke.lerpColors(wt,xt,Wt),Gt.setXYZ(Zt,ke.r,ke.g,ke.b)}const Xt=yield fe.draw("ExtrudePolygon",{geometry:Pe,material:new MeshStandardMaterial({flatShading:!0,vertexColors:!0})},null);Xt.position.z+=.001,this.extrudePolygon=Xt,this.object3d=Xt.object3d})}setNoise(r,o,V=1){const le=document.createElement("canvas"),fe=[];le.width=o.width,le.height=o.height;const Le=le.getContext("2d");Le.drawImage(o,0,0);const Re=Le.getImageData(0,0,o.width,o.height).data;for(let ke=0;ke<o.height;ke++){fe[ke]=[];for(let Gt=0;Gt<o.width;Gt++){const Vt=(ke*o.width+Gt)*4,wt=Re[Vt];fe[ke][Gt]=wt/255}}const Pe=r.attributes.position,ze=r.attributes.uv,Fe=new Vector2;for(let ke=0;ke<Pe.count;ke++){Fe.fromBufferAttribute(ze,ke);let Gt=Math.round(Fe.x*o.width)-1,Vt=Math.round(Fe.y*o.height)-1;Gt<0&&(Gt=0),Vt<0&&(Vt=0);const wt=fe[Vt][Gt];Pe.setZ(ke,wt*V)}}render(){this.mList.rmBaseObjectMap(this.extrudePolygon)}dispose(){this.extrudePolygon.dispose(),super.dispose()}}const objs=qi(gi({},objs$3),{PlaneMap:PlaneMap$1,CityPlane,ContinentsBg,Mountain:PlaneMap});class City extends City$1{constructor(){super(...arguments);C0(this,"multiplyScalar",1/1e3)}fixNearFar(r=.01,o){this.pencil.camera.near=r*this.multiplyScalar,o&&(this.pencil.camera.far=o*this.multiplyScalar),this.pencil.camera.updateProjectionMatrix()}}const getLabelElement=v=>{const e=document.createElement("div");return v.replace(/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,""),e.classList.add("vis-map-label","absolute","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2"),e.innerHTML=`
|
|
5362
|
+
}`},Kt=new ShaderMaterial({name:Ht.name,uniforms:UniformsUtils.clone(Ht.uniforms),vertexShader:Ht.vertexShader,fragmentShader:Ht.fragmentShader,lights:!0,side:Re,fog:Pe});Kt.uniforms.mirrorSampler.value=Ft.texture,Kt.uniforms.textureMatrix.value=It,Kt.uniforms.alpha.value=V,Kt.uniforms.normalSampler.value=le,Kt.uniforms.waterColor.value=fe,Kt.uniforms.distortionScale.value=Ce,Kt.uniforms.eye.value=Le;const Yt=v.material;v.material=Kt,v.onBeforeRender=function(jt,n0,a0){Yt.color!==Kt.uniforms.waterColor.value&&(Kt.uniforms.waterColor.value=Yt.color),ke.setFromMatrixPosition(v.matrixWorld),Gt.setFromMatrixPosition(a0.matrixWorld),Vt.extractRotation(v.matrixWorld),Fe.set(0,0,1),Fe.applyMatrix4(Vt),Xt.subVectors(ke,Gt),a0.updateMatrix(),a0.updateMatrixWorld(),v.updateMatrix(),v.updateMatrixWorld();const l0=new Frustum,s0=new Matrix4;if(s0.multiplyMatrices(a0.projectionMatrix,a0.matrixWorldInverse),l0.setFromProjectionMatrix(s0),!l0.intersectsObject(v)||Xt.dot(Fe)>0)return;Xt.reflect(Fe).negate(),Xt.add(ke),Vt.extractRotation(a0.matrixWorld),wt.set(0,0,-1),wt.applyMatrix4(Vt),wt.add(Gt),Zt.subVectors(ke,wt),Zt.reflect(Fe).negate(),Zt.add(ke),Nt.position.copy(Xt),Nt.up.set(0,1,0),Nt.up.applyMatrix4(Vt),Nt.up.reflect(Fe),Nt.lookAt(Zt),Nt.far=a0.far,Nt.updateMatrixWorld(),Nt.projectionMatrix.copy(a0.projectionMatrix),It.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),It.multiply(Nt.projectionMatrix),It.multiply(Nt.matrixWorldInverse),ze.setFromNormalAndCoplanarPoint(Fe,ke),ze.applyMatrix4(Nt.matrixWorldInverse),xt.set(ze.normal.x,ze.normal.y,ze.normal.z,ze.constant);const $t=Nt.projectionMatrix;Wt.x=(Math.sign(xt.x)+$t.elements[8])/$t.elements[0],Wt.y=(Math.sign(xt.y)+$t.elements[9])/$t.elements[5],Wt.z=-1,Wt.w=(1+$t.elements[10])/$t.elements[14],xt.multiplyScalar(2/xt.dot(Wt)),$t.elements[2]=xt.x,$t.elements[6]=xt.y,$t.elements[10]=xt.z+1,$t.elements[14]=xt.w,Le.setFromMatrixPosition(a0.matrixWorld);const qt=jt.getRenderTarget(),e0=jt.xr.enabled,o0=jt.shadowMap.autoUpdate;v.visible=!1,jt.xr.enabled=!1,jt.shadowMap.autoUpdate=!1,jt.setRenderTarget(Ft),jt.state.buffers.depth.setMask(!0),jt.autoClear===!1&&jt.clear(),jt.render(n0,Nt),v.visible=!0,jt.xr.enabled=e0,jt.shadowMap.autoUpdate=o0,jt.setRenderTarget(qt);const b0=a0.viewport;b0!==void 0&&jt.state.viewport(b0)}};class City$1 extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs$2);C0(this,"adcode",0);C0(this,"pcenter",[104,37.5]);C0(this,"pscale",5e4);C0(this,"projection");C0(this,"group");C0(this,"building");C0(this,"road");C0(this,"multiplyScalar",1)}setOptions(r){super.setOptions(gi({fitTo:!0,plane:!0,grey:!1,showBuilding:!0,showRoad:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,ssao:!0,buildingHasSide:!0},r))}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(r){this.loader.add([this.options.showBuilding&&`/cityGzip/Building${r}.json.gzip`,this.options.showRoad&&`/cityGzip/Road${r}.json.gzip`,this.options.showRiver&&`/cityGzip/River${r}.json.gzip`,this.options.showGrassland&&`/cityGzip/Grassland${r}.json.gzip`].filter(Boolean),{})}initMaterial(){return B0(this,null,function*(){if(this.mList.get("city-plane-mat")){console.log("city-plane-mat exist");return}if(this.options.showBuilding){const r=["20","60","max"].reduce((V,le)=>{const fe=this.loader.getAsset(`/image/city/${le}-1.jpg`),Le=this.loader.getAsset(`/image/city/${le}.webp`);return V[le]=[new MeshBasicMaterial({name:"建筑顶面-板块内"+le+"高",color:"#00a3bc"}),new MeshStandardMaterial({name:"建筑侧面-板块内"+le+"高",map:fe,normalMap:Le,envMap:this.getRoomEnvMap()})],[fe,Le].forEach(Ce=>{Ce.wrapS=RepeatWrapping,Ce.wrapT=RepeatWrapping,Ce.repeat.set(1,1)}),V},{});this.mList.addMultiple("building",{"20Top":r[20][0],"20Side":r[20][1],"60Top":r[60][0],"60Side":r[60][1],maxTop:r.max[0],maxSide:r.max[1]});const o=["20","60","max"].reduce((V,le)=>{const fe=this.loader.getAsset(`/image/city/${le}-1.jpg`),Le=this.loader.getAsset(`/image/city/${le}.webp`);return V[le]=[new MeshBasicMaterial({name:"建筑顶面-板块外"+le+"高",color:"#133144"}),new MeshStandardMaterial({name:"建筑侧面-块外"+le+"高",map:fe,normalMap:Le,envMap:this.getRoomEnvMap()})],[fe,Le].forEach(Ce=>{Ce.wrapS=RepeatWrapping,Ce.wrapT=RepeatWrapping,Ce.repeat.set(1,1)}),V},{});this.mList.addMultiple("building-grey",{"20Top":o[20][0],"20Side":o[20][1],"60Top":o[60][0],"60Side":o[60][1],maxTop:o.max[0],maxSide:o.max[1]})}if(this.options.showRoad){const r=new kt({name:"道路-板块内",color:"#ffc457",sizeAttenuation:!1,lineWidth:12}),o=new kt({name:"道路-板块外",color:"#4a3f15",sizeAttenuation:!1,lineWidth:12});this.mList.addMultiple("road",{primary:r}),this.mList.addMultiple("road-grey",{primary:o})}(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 r=this.pencil.composerController.ssaoPass;r&&r.enabled&&(r.enabled=!1,console.log("disableSSAO"))}enabledSSAO(){const r=this.pencil.composerController.ssaoPass;r&&!r.enabled&&(r.enabled=!0,console.log("enabledSSAO"))}init(){return B0(this,null,function*(){this.options.jsonName||(this.options.jsonName=(yield getCityConfig(this.options.adcode)).jsonName);const{jsonName:r,adcode:o}=this.options;yield this.initPencil(),this.loaderAdd(),this.loaderAddJson(r),console.time(`vis-core:time.${this.visName}${o}-loader`),yield this.loader.loadAll(),console.timeEnd(`vis-core:time.${this.visName}${o}-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${o}`});const V=findAdcodeInfo(o);this.group.object3d.name=`城市-${V?V.name:o}`,this.group.scale.multiplyScalar(this.multiplyScalar),yield this.initMaterial(),yield this.initVis(),yield Promise.all(this.lead.objectsPromise)})}getInvert(r){var o,V;return(V=(o=this.projection).invert)==null?void 0:V.call(o,[r.x,-r.z])}fitTo(r,o=!0){return B0(this,null,function*(){this.pencil.controls.fitToBox(r.object3d,o),this.pencil.controls.rotatePolarTo(this.pencil.camera.up.z===1?Math.PI/180*70:Math.PI/180*160,o)})}initVis(){return B0(this,null,function*(){const{fitTo:r,jsonName:o}=this.options;this.adcode;const V=this.loader,le=this.options.showBuilding&&V.getAsset(`/cityGzip/Building${o}.json.gzip`),fe=this.options.showRoad&&V.getAsset(`/cityGzip/Road${o}.json.gzip`),Le=this.options.showRiver&&V.getAsset(`/cityGzip/River${o}.json.gzip`),Ce=this.options.showGrassland&&V.getAsset(`/cityGzip/Grassland${o}.json.gzip`),Re={};[...(Le==null?void 0:Le.features)||[],...(Ce==null?void 0:Ce.features)||[]].forEach(Fe=>{Fe.properties.o&&(Re[Fe.properties.o]=!0)});const Pe=Object.keys(Re).map(Fe=>+Fe).sort((Fe,ke)=>Fe-ke),ze=-f({center:this.pcenter,scale:this.pscale})([this.pcenter[0],899e-8+this.pcenter[1]])[1];yield Promise.all([le&&this.drawBuilding({json:le,meters:ze,grey:this.options.grey,sideGradient:this.options.buildingSideGradient,hasSide:this.options.buildingHasSide}),fe&&this.drawRoad({json:fe,meters:ze,z:Pe.length,grey:this.options.grey}),Le&&this.drawArea({json:Le,type:"river",oArr:Pe,grey:this.options.grey}),Ce&&this.drawArea({json:Ce,type:"grassland",oArr:Pe,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()})})}drawCityPlane(r,o){return B0(this,null,function*(){const V=this.mList.get("city-plane-mat"),le=findAdcodeInfo(r).b,fe=this.projection([le[0],le[1]]),Le=this.projection([le[2],le[3]]),Ce=Math.abs(Le[0]-fe[0]),Re=Math.abs(Le[1]-fe[1]),Pe=Ce,ze=Re,Fe=yield this.lead.draw("CityPlane",{width:Pe*10,height:ze*10,material:V},o!=null?o:this.group);Fe.object3d.name="底面",this.lead.updateBaseObjectKey(Fe,{type:"city-plane"})})}drawBuilding(){return B0(this,arguments,function*(r={}){if(!r.json){console.warn(" json:Building");return}const o=this.options.cacheKey?`building-${this.options.cacheKey}${r.grey?"-grey":""}${r.hasSide?"":"-no-side"}`:void 0,V=yield this.lead.draw("Building",{key:"$p:-building",projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:o,meters:r.meters,sideGradient:r.sideGradient,grey:r.grey,hasSide:r.hasSide},this.group);return this.building=V,V})}drawArea(){return B0(this,arguments,function*(r={}){if(!r.json){console.warn(" json:drawGeography");return}if(!r.type)return;const{grey:o}=r,V=o?"-grey":"",le=this.options.cacheKey?`${r.type}-${this.options.cacheKey}${V}`:void 0,fe=yield this.lead.draw("Area",{key:`$p:-${r.type}`,projection:{center:this.pcenter,scale:this.pscale},json:r.json,material:this.mList.getMultiple("geography"+V)[r.type],type:r.type,cacheKey:le,oArr:r.oArr},this.group);return fe.object3d.name=r.type==="river"?"河流":"绿地",r.type==="river"&&!o&&this.options.setWaterMaterial&&fe.area.forEach(Le=>{setWaterMaterial(Le.object3d)}),fe})}drawRoad(){return B0(this,arguments,function*(r={}){if(!r.json){console.warn(" json:Road");return}const o=this.options.cacheKey?`road-${this.options.cacheKey}${r.grey?"-grey":""}`:void 0,V=yield this.lead.draw("Road",{key:"$p:-road",projection:{center:this.pcenter,scale:this.pscale},json:r.json,cacheKey:o,grey:r.grey,meters:r.meters},this.group),le=r.z||0;return V.position.z=(le+1)*.001,r.grey||(this.lead.updateBaseObjectKey(V,{type:"road",key:"group"}),this.initBaseObjectUserData(V)),r.grey||(this.road=V),V})}getWorldPosition(r,o){if(this.options.coordtransformFunc){const fe=this.options.coordtransformFunc(r,o);r=fe.longitude,o=fe.latitude}const[V,le]=this.projection([r,o]);return{x:V,y:-le}}}C0(City$1,"VisName","city");const hideMaterial=new MeshBasicMaterial({colorWrite:!1,transparent:!0});let PlaneMap$1=class extends Z$1{constructor(r){var o;super();C0(this,"options");C0(this,"isActive",!0);C0(this,"groupArr",[]);C0(this,"areaArr",[]);C0(this,"lineArr");C0(this,"mergeSideArea",null);C0(this,"extrudelineArr");C0(this,"splitPolygons",0);this.options=gi({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:{}},r),((o=this.options.projection.rotate)==null?void 0:o[0])===-160&&(this.options.projection.projectionType==="winkel3"?this.splitPolygons=100:this.splitPolygons=300)}create(){return B0(this,null,function*(){const{geojson:r,extrudeLineGeojson:o,bbox:V,areaGroup:le,materialOptions:fe,hasSide:Le,hasTop:Ce,hasLine:Re,mergeSide:Pe}=this.options;this.createGroup();const ze=this.pencil.lead;if(le){const Ht=yield Promise.all(r.features.map(Kt=>B0(this,null,function*(){const{properties:Yt}=Kt,jt=`${this.getPropertiesKey(Yt)}`,n0=yield ze.draw("Group",{target:this,key:jt});return n0.object3d.name=(Yt==null?void 0:Yt.adcode)==="100000_JD"?"十段线":Yt==null?void 0:Yt.name,n0.userData=gi({},Yt),n0})));this.groupArr=Ht}const{lineMat:Fe,extrudeLineMat:ke,topMat:Gt,sideMat:Vt,bgTopMat:wt,bgSideMat:xt,bgLineMat:Xt,bgExtrudeLineMat:Zt}=fe,[Wt,It,Nt,Ft]=yield Promise.all([(Ce||Ce)&&this.addArea(r,{material:Le?[Gt,Pe?hideMaterial:Vt]:Gt,bbox:V,areaGroup:le,hasSide:Le,hasTop:!0,castShadow:!Pe,onTop:this.options.onTop}),Re&&this.addLine(r,{material:Fe,onTop:this.options.onTop+2,areaGroup:le}),o&&this.addLine(o,{material:ke,onTop:this.options.onTop+3}),Pe&&o&&this.addArea(o,{material:Vt,bbox:V,castShadow:!0,areaGroup:!1,hasSide:!0,hasTop:!1,onTop:this.options.onTop})]);Ft&&(this.mergeSideArea=Ft[0],this.mergeSideArea.object3d.name="板块合并侧面"),Wt&&(this.areaArr=Wt),It&&(this.options.conic||It.forEach(Ht=>{Ht.position.z=this.options.depth+this.options.lineOffset}),this.lineArr=It),Nt&&(Nt.forEach(Ht=>{this.options.conic||(Ht.position.z=this.options.depth+this.options.lineOffset),this.lead.updateBaseObjectKey(Ht,{key:this.getPropertiesKey({name:"extrudeLine"})})}),this.extrudelineArr=Nt),wt&&xt&&this.setAreaMaterial("bg",[wt,xt]),Xt&&this.setLineMaterial("bg",Xt),Zt&&this.setExtrudeLineMaterial("bg",Zt)})}addArea(r,o){return B0(this,null,function*(){const{bbox:V,material:le,onTop:fe}=o,Le=this.geojson2Meta(r),Ce=this.pencil.getPlugin("worker"),Re=this.pencil.lead;if(this.pencil.mList,o.areaGroup)return yield Promise.all(Le.map(Pe=>B0(this,null,function*(){const{coords:ze,properties:Fe}=Pe,ke=this.findGroup(this.getPropertiesKey(Fe)),Gt=this.options.conic?yield Ce.geoGeometry("conicPolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:V,hasBottom:!1,hasSide:o.hasSide,hasTop:o.hasTop,useGroups:o.hasSide&&o.hasTop?2:0}}):yield Ce.geoGeometry("extrudePolygon",{coordinatesArr:ze,metaArray:ze.map(()=>[this.options.depth]),mesaage:{projection:this.options.projection,topSegments:this.options.topSegments,bbox:V,hasBottom:!1,hasSide:o.hasSide,hasTop:o.hasTop,useGroups:o.hasSide&&o.hasTop?2:0,splitPolygons:this.splitPolygons}}),Vt=`${this.getPropertiesKey(Fe)}`,wt=yield Re.draw("ExtrudePolygon",{key:Vt,geometry:Gt,material:le,onTop:fe},ke);return wt.object3d.name="板块",o!=null&&o.castShadow&&(wt.object3d.castShadow=!0),wt.userData=gi({},Fe),wt})));{const Pe=Le.flatMap(({coords:ke})=>ke),ze=this.options.conic?yield Ce.geoGeometry("conicPolygon",{coordinatesArr:Pe,metaArray:Pe.map(()=>[this.options.depth,this.options.start]),mesaage:{topFirst:!0,bbox:V,hasBottom:!1,hasSide:o.hasSide,hasTop:o.hasTop,useGroups:2}}):yield Ce.geoGeometry("extrudePolygon",{coordinatesArr:Pe,metaArray:Pe.map(()=>[this.options.depth]),mesaage:{projection:gi({},this.options.projection),topSegments:this.options.topSegments,bbox:V,hasSide:o.hasSide,hasTop:o.hasTop,hasBottom:!1,useGroups:2,splitPolygons:this.splitPolygons}}),Fe=yield Re.draw("ExtrudePolygon",{key:this.getPropertiesKey({name:"all"}),geometry:ze,material:le},this);return o!=null&&o.castShadow&&(Fe.object3d.castShadow=!0),Fe.object3d.name="板块",Fe.userData={},[Fe]}})}addLine(r,o){return B0(this,null,function*(){const{material:V,onTop:le}=o,fe=this.geojson2Meta(r),Le=this.pencil.getPlugin("worker"),Ce=this.pencil.lead;if(o.areaGroup)return yield Promise.all(fe.map(Re=>B0(this,null,function*(){const{coords:Pe,properties:ze}=Re,Fe=this.findGroup(this.getPropertiesKey(ze)),ke=this.options.conic?yield Le.geoGeometry("conicLine",{coordinatesArr:Pe,metaArray:Pe.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield Le.geoGeometry("line",{coordinatesArr:Pe,metaArray:Pe.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),Gt=`${this.getPropertiesKey(ze)}`,Vt=yield Ce.draw("Line",{key:Gt,geometry:ke,material:V,onTop:le},Fe);return Vt.userData=gi({},ze),Vt.object3d.name="线",Vt})));{const Re=fe.flatMap(({coords:Fe})=>Fe),Pe=this.options.conic?yield Le.geoGeometry("conicLine",{coordinatesArr:Re,metaArray:Re.map(()=>[1,this.options.start+this.options.depth+this.options.lineOffset]),mesaage:{}}):yield Le.geoGeometry("line",{coordinatesArr:Re,metaArray:Re.map(()=>[1]),mesaage:{projection:this.options.projection,splitPolygons:this.splitPolygons}}),ze=yield Ce.draw("Line",{key:this.getPropertiesKey({name:"all"}),geometry:Pe,material:V,onTop:le},this);return ze.object3d.name="线",[ze]}})}getPropertiesKey(r){return`${this.key.split("#")[1]}-${r.adcode||r.iso_a2||r.name}`}geojson2Meta(r){return r.features.filter(o=>o.geometry).map(o=>{const{type:V,coordinates:le}=o.geometry;let fe=[];return V==="Polygon"?fe=le:V==="MultiPolygon"&&(fe=le.flat()),{coords:fe,properties:o.properties}})}update(r,o){const{lineMat:V,extrudeLineMat:le}=this.options.materialOptions;this.isActive&&[V,le].forEach(fe=>{var Le;!fe||!((Le=fe.uniforms.lineLightAnimation)!=null&&Le.value)||(fe.uniforms.time.value=o)})}findGroup(r,o=!1){return this.pencil.lead.getObject("Group",{key:`${o?this.getPropertiesKey({adcode:r}):r}`})}setAreaMaterial(r,o){this.areaArr.forEach(V=>{V.setMaterialList(r,this.mergeSideArea&&Array.isArray(o)?[o[0],hideMaterial]:o)}),this.mergeSideArea&&Array.isArray(o)&&this.mergeSideArea.setMaterialList(r,o[1])}useAreaMaterial(r){this.areaArr.forEach(o=>{o.useMaterial(r)}),this.mergeSideArea&&this.mergeSideArea.useMaterial(r)}setLineMaterial(r,o){this.lineArr.forEach(V=>{V.setMaterialList(r,o)})}useLineMaterial(r){this.lineArr.forEach(o=>{o.useMaterial(r)})}setExtrudeLineMaterial(r,o){var V;(V=this.extrudelineArr)==null||V.forEach(le=>{le.setMaterialList(r,o)})}useExtrudeLineMaterial(r){var o;(o=this.extrudelineArr)==null||o.forEach(V=>{V.useMaterial(r)})}changeLineAnimateParams({speed:r=.5,extrude:o=!1}){const{lineMat:V,extrudeLineMat:le}=this.options.materialOptions,fe=o?le:V;if(!fe)return;fe.uniforms.time.value=0,fe.uniforms.speed.value=r,fe.uniforms.lineLightAnimation.value=1;const{size:Le,min:Ce,max:Re}=this.getSize();fe.uniforms.size.value=Math.max(Le.x,Le.y)/2,fe.uniforms.uCenter.value=new Vector2((Ce.x+Re.x)/2,(Ce.y+Re.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(r){var o;(o=this.extrudelineArr)==null||o.forEach(V=>{r?V.enableBloom():V.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(r){super();C0(this,"options");this.options=gi({radius:30,rotationY:0},r)}create(){const o=this.pencil.mList.get("earthMaterial");this.material=o,super.create(),this.rotation.y=this.options.rotationY,this.object3d.name="地球"}}class SphereShadow extends Z$1{constructor(r){super();C0(this,"options");this.options=gi({radius:30},r)}create(){return B0(this,null,function*(){const r=new SphereGeometry(this.options.radius,128,90),o=new MeshBasicMaterial;this.createMesh(r,o),this.scale.multiplyScalar(1.001),this.rotation.y=Math.PI/180*-90,this.object3d.name="阴影面",this.hide()})}}const objs$1=qi(gi({},objs$3),{Earth,SphereShadow,Countries:PlaneMap$1}),base$2=v=>{v.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth2/basic.jpg","/image/earth2/NormalMap.jpg"])},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=e.getAsset("/image/earth2/basic.jpg"),o=e.getAsset("/image/earth2/NormalMap.jpg"),V=new MeshStandardMaterial({name:"地球材质",map:r,metalness:.1,roughness:.8,normalMap:o,normalScale:new Vector2(.5,.5)});this.mList.add("earthMaterial",V)})},v.initVis=function(){return B0(this,null,function*(){v.pencil.camera.near=1,v.pencil.camera.far=3e3,v.pencil.camera.fov=12,v.pencil.camera.updateProjectionMatrix();const[e,r]=yield Promise.all([this.lead.draw("Light",{type:"PointLight",intensity:4,color:16777215,distance:0,decay:0}),this.lead.draw("Earth",{radius:100,rotationY:Math.PI/180*90})]);yield this.pencil.controls.fitToBox(r.object3d,!1),e.position.copy(this.pencil.cameraPositon)})}},chinaPlate=v=>{v.extendsOptions=qi(gi({},v.extendsOptions),{otherMapDepth:()=>v.options.otherMapDepth,copyChinaPlane:v.options.copyChinaPlane,mergeSide:()=>v.options.mergeSide}),v.loaderAdd=function(){const{loader:e}=this;e.add(["/image/earth/basic.webp","/image/earth/chinaBorder.png","/image/earth/flyline.png","/image/earth/chinaNormal.webp"])},v.initVis=function(){return B0(this,null,function*(){yield this.initLight();const[,e,r]=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(o=>{var V;return((V=o.properties)==null?void 0:V.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="世界",r.object3d.name="中国",r.extrudelineArr&&v.initBaseObjectUserData(r.extrudelineArr[0]),this.map=r,this.options.copyChinaPlane){this.options.copyChinaPlane;const o=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});o.object3d.name="复制中国顶面",this.lead.updateBaseObjectKey(o.children[0],{type:"chinaPlaneCopy"})}yield this.pencil.controls.rotateTo(1.833542196136704,.9809685394021701,!1),yield this.pencil.controls.dollyTo(99.11560932366835,!1)})},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=new MeshStandardMaterial({side:DoubleSide,name:"顶面",color:new Color$1("#0d8a8c"),metalness:.75,roughness:.61,normalMap:e.getAsset("/image/earth/chinaNormal.webp")}),o=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999"),map:e.getAsset("/image/earth/chinaBorder.png")}),V=new kt({name:"中国边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#59C8FF")}),le=new kt({name:"世界边界",lineWidth:.6,sizeAttenuation:!1,color:new Color$1("#80abaf")}),fe=new MeshBasicMaterial({name:"世界顶面"}),Le=new MeshBasicMaterial({name:"世界侧面"}),Ce=e.getAsset("/image/earth/basic.webp"),Re=new MeshStandardMaterial({name:"地球材质",map:Ce,color:new Color$1(2397309),metalness:.84,roughness:.51}),Pe=e.getAsset("/image/earth/flyline.png");Pe.wrapS=RepeatWrapping,Pe.wrapT=RepeatWrapping,Pe.repeat.set(.5,.5);const ze=new kt({name:"省份边界",map:Pe,lineWidth:.6,sizeAttenuation:!1,transparent:!0,color:new Color$1("#3a898b")});this.mList.addMultiple("plane",{topMat:r,sideMat:o,lineMat:ze,extrudeLineMat:V}),this.mList.addMultiple("world",{topMat:fe,sideMat:Le,lineMat:le}),this.mList.add("earthMaterial",Re)})}},countryPlate=v=>{v.initVis=function(){return B0(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)})},v.initMaterial=function(){return B0(this,null,function*(){const e=new MeshStandardMaterial({side:DoubleSide,name:"侧面",color:new Color$1("#999999")}),r=new MeshStandardMaterial({name:"顶面",color:new Color$1("#ffffff"),emissive:new Color$1("#523333")}),o=new kt({name:"边框线",lineWidth:1,sizeAttenuation:!1,color:new Color$1("#006aa3")}),V=new MeshBasicMaterial({name:"地球材质",color:new Color$1("#012b47")});this.mList.addMultiple("plane",{topMat:r,sideMat:e,lineMat:o}),this.mList.add("earthMaterial",V)})},v.getLocationPosition=function(e,r=0){const[o,V]=e,le=this.options.mapDepth+this.options.radius+r;return p$2(o,V,le)}},styles=Object.freeze(Object.defineProperty({__proto__:null,base:base$2,chinaPlate,countryPlate},Symbol.toStringTag,{value:"Module"})),Fn=class Fn extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs$1);C0(this,"leftTruck",!1);C0(this,"extendsOptions",{mapDepth:()=>this.options.mapDepth});C0(this,"map")}get mapArea(){return this.map.areaArr}setOptions(r){super.setOptions(gi({mapDepth:1.4,otherMapDepth:0,radius:30,style:"chinaPlate",copyChinaPlane:!1,mergeSide:!1},r)),this.initSettingsObj={autoRotateSpeed:0},styles[this.options.style](this)}handleSetting(r,o){return B0(this,null,function*(){return yield _n(Fn.prototype,this,"handleSetting").call(this,r,o),r==="autoRotateSpeed"?this.pencil.autoRotate(o):r==="autoRotate"&&(o?this.settings.autoRotateSpeed=-20:this.settings.autoRotateSpeed=0),o})}show(){super.show(),this.animationIn()}animationIn(){const r=this.pencil.controls;r.addEventListener("controlstart",()=>{this.pencil.autoRotate(0)}),r.addEventListener("controlend",()=>{this.pencil.autoRotate(this.settings.autoRotateSpeed)})}initLight(){return B0(this,null,function*(){const[r,o]=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})]);r.position.set(0,50,-100),o.position.set(0,0,150),r.object3d.lookAt(0,0,0),o.object3d.lookAt(0,0,0)})}getLocationPosition(r,o=0){const[V,le]=r,fe=this.getRadius()+o;return p$2(V,le,fe)}setAreaMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.areaArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#topMat");V!=="origin"&&(Le=fe.material[0].clone(),V.color&&Le.color.set(V.color),V.emissive&&(Le.emissive.set(V.emissive),Le.emissiveIntensity=V.emissiveIntensity||1)),fe.material[0]=Le}}setLineMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.lineArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#outLine");V!=="origin"&&(Le=fe.material.clone(),V.color&&Le.color.set(V.color),V.width&&(Le.lineWidth=V.width)),fe.material=Le}}addAreaPlaneByProperty(r,o,V){return B0(this,null,function*(){if(!this.map)return;const fe=this.map.options.geojson.features.find(Le=>Le.properties&&Le.properties[r]===o);if(fe)return this.lead.draw("Countries",{geojson:{type:"FeatureCollection",features:[fe]},depth:this.options.mapDepth+.3,start:this.options.radius,materialOptions:{topMat:new MeshBasicMaterial(V.area),lineMat:new kt(V.line)}})})}getRadius(){const r=this.baseObjectByUuid("earth");return r?r.object3d.geometry.parameters.radius:0}checkBehindEarth(r,o){const V=new Vector3(0,0,0),le=new Vector3(0,0,0),fe=this.getRadius(),Le=()=>{const Ce=r();if(!Ce.length)return;this.pencil.controls.getPosition(le,!1);const Re=V.clone().sub(le),Pe=Math.sqrt(Gn(Re.length(),2)-Gn(fe,2)),ze=Ce.map(Fe=>Fe.position.clone().sub(le).length()>Pe);o(Ce,ze)};Le(),this.pencil.controls.addEventListener("update",()=>{Le()})}setObjectOnSphere(r,o,V=0,le=[0,1,0]){if(r.objectType==="Plane"){const fe=this.getLocationPosition(o,V);r.position.set(...fe);const Le=r.object3d.material;Le&&(Le.side=DoubleSide),r.object3d.lookAt(0,0,0)}else{const fe=r.rotation.clone(),Le=this.getLocationPosition(o,V);r.position.set(...Le);const Ce=new Vector3(...Le).normalize(),Re=new Vector3(...le);Re.applyEuler(fe);const Pe=new Quaternion().setFromUnitVectors(Re,Ce);r.object3d.applyQuaternion(Pe)}}};C0(Fn,"VisName","earth");let index$1=Fn;const timeOut=v=>B0(exports,null,function*(){const e=esusLite.makePromiseCreator();return setTimeout(()=>{e.resolve()},v),e.promise}),getTween=v=>({onUpdate:e=V=>{},onComplete:r=()=>{},backwards:o=!0}={})=>{o&&e(0);const V=new Tween({v:0});return{start:({duration:le=1e3,repeat:fe=0,repeatResolve:Le=1,repeatDelay:Ce=0}={})=>{const Re=esusLite.makePromiseCreator();let Pe=0;return V.to({v:1},le).onUpdate(({v:ze})=>{e(ze)}).onComplete(()=>{e(1),r(),Re.resolve()}).onRepeat(()=>{Pe++,Pe>=Le&&Re.resolve()}).repeat(fe).repeatDelay(Ce).easing(v).start(),Re.promise},stop:()=>{V.stop()}}},sinusoidalInOut=getTween(Easing.Sinusoidal.InOut),baseObjectFadeIn=v=>{const e=new Set,r=new Set;v.object3d.traverse(V=>{const le=V;le.material&&(Array.isArray(le.material)?le.material:[le.material]).forEach(Le=>{e.add(Le)})});const o=new Map;return e.forEach(V=>{o.set(V,V.opacity),V.transparent||(r.add(V),V.transparent=!0,V.needsUpdate=!0)}),sinusoidalInOut({onUpdate:V=>{e.forEach(le=>{le.opacity=V*o.get(le)})},onComplete:()=>{r.forEach(V=>{V.transparent=!1,V.needsUpdate=!0}),e.clear(),r.clear(),o.clear()}})},baseObjectFadeOut=v=>{const e=new Set,r=new Set;v.object3d.traverse(V=>{const le=V;le.material&&(Array.isArray(le.material)?le.material:[le.material]).forEach(Le=>{e.add(Le)})});const o=new Map;return e.forEach(V=>{o.set(V,V.opacity),V.transparent||(r.add(V),V.transparent=!0,V.needsUpdate=!0)}),sinusoidalInOut({onUpdate:V=>{e.forEach(le=>{le.opacity=(1-V)*o.get(le)})},onComplete:()=>{e.clear(),r.clear(),o.clear()}})},baseObjectBounceIn=(v,e="z")=>{const r=e.trim().split(""),o=r.reduce((V,le)=>(V[le]=v.scale[le],V),{});return sinusoidalInOut({onUpdate:V=>{r.forEach(le=>{v.scale[le]=o[le]*V})}})},baseObjectBounce=(v,e="z",r)=>{const o=e.trim().split(""),V=o.reduce((le,fe)=>(le[fe]=v.scale[fe],le),{});return sinusoidalInOut({onUpdate:le=>{o.forEach(fe=>{v.scale[fe]=V[fe]+(r-V[fe])*le})}})},animation=Object.freeze(Object.defineProperty({__proto__:null,baseObjectBounce,baseObjectBounceIn,baseObjectFadeIn,baseObjectFadeOut,sinusoidalInOut,timeOut},Symbol.toStringTag,{value:"Module"}));class ContinentsBg extends Z$1{constructor(r){super();C0(this,"options");C0(this,"mapArr",[]);this.options=r}create(){return B0(this,null,function*(){const{depth:r}=this.options,o=this.pencil.mList,V=this.pencil.lead,le=o.getMultiple("continents");this.createGroup(),this.object3d.name="大洲",yield Promise.all(Object.values(continentsLiteJson).map(fe=>B0(this,null,function*(){const Le=fe.features[0],Ce=Le.properties.adcode;if(Ce===10)return;const Re=turf.centroid(Le).geometry.coordinates;let Pe=0,ze=0,Fe=this.options.scale;const ke=30,Gt=25;Ce===5?(Pe=-ke,ze=Gt,Fe=Fe*.2):Ce===21?(Pe=0,ze=Gt,Fe=Fe*.18):Ce===9?(Pe=ke,ze=Gt,Fe=Fe*.3):Ce===142?(Pe=-ke,ze=-Gt,Fe=Fe*.15):Ce===150?(Pe=0,ze=-Gt,Fe=Fe*.3):Ce===2&&(Pe=ke,ze=-Gt,Fe=Fe*.2);const Vt=yield V.draw("PlaneMap",{key:`${this.key}-${Ce}`,geojson:fe,projection:{center:Re,scale:Fe,rotate:[0,0],projectionType:"equirectangular"},areaGroup:!1,depth:r,materialOptions:gi({},le)},this);Vt.userData.projection=f({center:Re,scale:Fe,rotate:[0,0],projectionType:"equirectangular"}),Vt.object3d.name=Le.properties.name,Vt.userData.name=Le.properties.name,Vt.position.set(Pe,ze,0),this.mapArr.push(Vt)})))})}getPointInContinentInfo(r){var o;return(o=Object.values(continentsLiteJson).map(V=>V.features).find(V=>V[0].geometry.coordinates.some(le=>le.length?turf.booleanPointInPolygon(turf.point(r),turf.polygon(le)):!1)))==null?void 0:o[0]}getPointInContinent(r){return!!this.getPointInContinentInfo(r)}getLocationPosition(r,o){var le;const V=o||((le=this.getPointInContinentInfo(r))==null?void 0:le.properties.name);if(V){const fe=this.mapArr.find(Le=>Le.userData.name===V);if(fe){const{projection:Le}=fe.userData,[Ce,Re]=r,[Pe,ze]=Le([Ce,Re]),Fe=new Vector3(Pe,-ze,this.options.depth);return Fe.applyMatrix4(fe.object3d.matrixWorld),[Fe.x,Fe.y,Fe.z]}}}render(){this.lead.updateBaseObjectKey(this,{type:"continents-group"}),this.mapArr.forEach(r=>{this.lead.updateBaseObjectKey(r,{type:"continents-"+r.userData.name})})}dispose(){this.mapArr.forEach(r=>{r.dispose()}),this.mapArr.length=0}}class PlaneMap extends Z$1{constructor(r){super();C0(this,"options");C0(this,"extrudePolygon");this.options=gi({depth:2},r)}geojson2Meta(r){return r.features.filter(o=>o.geometry).map(o=>{const{type:V,coordinates:le}=o.geometry;let fe=[];return V==="Polygon"?fe=le:V==="MultiPolygon"&&(fe=le.flat()),{coords:fe,properties:o.properties}})}create(){return B0(this,null,function*(){const{geojson:r,bbox:o}=this.options,V=this.geojson2Meta(r),le=this.pencil.getPlugin("worker"),fe=this.pencil.lead,Ce=yield this.pencil.loader.load("/1.png"),Re=V.flatMap(({coords:Zt})=>Zt),Pe=yield le.geoGeometry("extrudePolygon",{coordinatesArr:Re,metaArray:Re.map(()=>[this.options.depth]),mesaage:{projection:gi({},this.options.projection),topSegments:100,bbox:o,hasBottom:!1,hasSide:!1}}),ze=Pe.attributes.position.count;Pe.setAttribute("color",new BufferAttribute(new Float32Array(ze*3),3));const Fe=this.options.depth;this.setNoise(Pe,Ce.image,Fe);const ke=new Color$1,Gt=Pe.attributes.color,Vt=Pe.attributes.position,wt=new Color$1("red"),xt=new Color$1("green");for(let Zt=0;Zt<ze;Zt++){const Wt=Vt.getZ(Zt)/Fe;ke.lerpColors(wt,xt,Wt),Gt.setXYZ(Zt,ke.r,ke.g,ke.b)}const Xt=yield fe.draw("ExtrudePolygon",{geometry:Pe,material:new MeshStandardMaterial({flatShading:!0,vertexColors:!0})},null);Xt.position.z+=.001,this.extrudePolygon=Xt,this.object3d=Xt.object3d})}setNoise(r,o,V=1){const le=document.createElement("canvas"),fe=[];le.width=o.width,le.height=o.height;const Le=le.getContext("2d");Le.drawImage(o,0,0);const Re=Le.getImageData(0,0,o.width,o.height).data;for(let ke=0;ke<o.height;ke++){fe[ke]=[];for(let Gt=0;Gt<o.width;Gt++){const Vt=(ke*o.width+Gt)*4,wt=Re[Vt];fe[ke][Gt]=wt/255}}const Pe=r.attributes.position,ze=r.attributes.uv,Fe=new Vector2;for(let ke=0;ke<Pe.count;ke++){Fe.fromBufferAttribute(ze,ke);let Gt=Math.round(Fe.x*o.width)-1,Vt=Math.round(Fe.y*o.height)-1;Gt<0&&(Gt=0),Vt<0&&(Vt=0);const wt=fe[Vt][Gt];Pe.setZ(ke,wt*V)}}render(){this.mList.rmBaseObjectMap(this.extrudePolygon)}dispose(){this.extrudePolygon.dispose(),super.dispose()}}const objs=qi(gi({},objs$3),{PlaneMap:PlaneMap$1,CityPlane,ContinentsBg,Mountain:PlaneMap});class City extends City$1{constructor(){super(...arguments);C0(this,"multiplyScalar",1/1e3)}fixNearFar(r=.01,o){this.pencil.camera.near=r*this.multiplyScalar,o&&(this.pencil.camera.far=o*this.multiplyScalar),this.pencil.camera.updateProjectionMatrix()}}const getLabelElement=v=>{const e=document.createElement("div");return v.replace(/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,""),e.classList.add("vis-map-label","absolute","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2"),e.innerHTML=`
|
|
5363
5363
|
<div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
|
|
5364
5364
|
${v}
|
|
5365
5365
|
</div>
|
|
5366
|
-
`,e},worldPacificCentre=v=>{v.loaderAdd=function(){const e=this.loader;e.add(["/image/map/jianbian.webp"]),e.add(["/image/map/hp2.webp","/image/map/fx2.webp"])},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=this.mList,o=(()=>{const V=e.getAsset("/image/map/hp2.webp");V.center.set(.5,.5),V.repeat.set(.97,1.01);const le=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp2.webp"),normalMap:e.getAsset("/image/map/fx2.webp"),normalScale:new Vector2(2,1)}),fe=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),Le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),Ce=new kt({name:"板块边线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:le,sideMat:fe,lineMat:Le,extrudeLineMat:v.options.extrudeLine?Ce:null}})();r.addMultiple("plane",o)})}},world=v=>{if(v.options.lineOffset=.02,delete v.extendsOptions.handleBackKeepCamvasState,v.extendsOptions.extrudeLine=()=>v.options.extrudeLine,v.extendsOptions.worldPacificCentre=()=>v.options.worldPacificCentre,v.options.worldPacificCentre){worldPacificCentre(v);return}v.initMaterial=function(){return B0(this,null,function*(){const e=this.mList,r=(()=>{const o=new MeshBasicMaterial({name:"顶面",color:"#0d2425"}),V=new MeshBasicMaterial({name:"侧面",color:"#0d2425"}),le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),fe=new kt({name:"板块边线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:o,sideMat:V,lineMat:le,extrudeLineMat:v.options.extrudeLine?fe:null}})();e.addMultiple("plane",r)})}},china=v=>{v.options.lineOffset=.005,v.loaderAdd=function(){return B0(this,null,function*(){this.loader.add(["/image/map/jianbian.webp","/image/map/hp.webp","/image/map/shuchu2.webp"]),this.loaderAddBg()})},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=(()=>{const o=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp.webp"),normalMap:e.getAsset("/image/map/shuchu2.webp")}),V=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),fe=new kt({name:"板块边线",color:new Color$1("#00FFED"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:o,sideMat:V,lineMat:le,extrudeLineMat:fe}})();this.mList.addMultiple("plane",r),this.options.drillDownFirstLevelUseBgMats&&this.mList.copyMultiple("plane","bgPlane"),this.options.drillDownSecondLevelMats&&this.mList.copyMultiple("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMultiple("plane","thirdPlane"),this.initMaterialBg()})}},base$1=v=>{v.loaderAdd=function(){return B0(this,null,function*(){this.loader.add(["/image/map/jianbian.webp"]),this.loaderAddBg()})},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=(()=>{const o=new MeshBasicMaterial({name:"顶面",color:new Color$1("#0d2425")}),V=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),fe=new kt({name:"板块边线",color:new Color$1("#00FFED"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:o,sideMat:V,lineMat:le,extrudeLineMat:fe}})();this.mList.addMultiple("plane",r),this.options.drillDownFirstLevelUseBgMats&&this.mList.copyMultiple("plane","bgPlane"),this.options.drillDownSecondLevelMats&&this.mList.copyMultiple("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMultiple("plane","thirdPlane"),this.initMaterialBg()})}},cityOnMap=v=>{v.extendsOptions={mapDepth:v.options.mapDepth,parentBg:v.options.parentBg,continentsBg:v.options.continentsBg,continentsBgDepth:v.options.continentsBgDepth,mergeSide:v.options.mergeSide,handleBackKeepCamvasState:v.options.handleBackKeepCamvasState,mapBoundary:v.options.mapBoundary,showBuilding:v.options.showBuilding,showRoad:v.options.showRoad,showGrassland:v.options.showGrassland,showRiver:v.options.showRiver,buildingSideGradient:v.options.buildingSideGradient,buildingHasSide:v.options.buildingHasSide,setWaterMaterial:v.options.setWaterMaterial,showCityOnMapInnerLine:v.options.showCityOnMapInnerLine},v.options.parentBg&&(v.extendsOptions.parentBgDepth=()=>v.options.parentBgDepth),v.loaderAdd=function(){this.loader.add(["/image/map2/side.png"])},v.initMaterial=function(){return B0(this,null,function*(){const r=this.loader,o=(()=>{const V=new MeshBasicMaterial({name:"板块顶面",color:"#094253"}),le=new MeshBasicMaterial({name:"板块侧面",map:r.getAsset("/image/map2/side.png"),side:DoubleSide}),fe=new kt({name:"板块边框",color:new Color$1("#02f7eb"),lineWidth:1.8,sizeAttenuation:!1,depthTest:!1}),Le=new kt({name:"板块内线",color:new Color$1("#02f7eb"),lineWidth:1.8,sizeAttenuation:!1,depthTest:!1});return{topMat:V,sideMat:le,lineMat:Le,extrudeLineMat:fe}})();this.mList.addMultiple("plane",o),this.initMaterialBg()})};const e=v.init.bind(v);v.init=function(){return B0(this,null,function*(){yield e(),yield this.initCityOnMap(this.mapInfo.adcode)})}},base=v=>{if(v.initMaterialBg=function(){return B0(this,null,function*(){const e=this.getRoomEnvMap();if(this.options.parentBg){if(this.options.adcode!==1e5){const o=(()=>{const V=new MeshStandardMaterial({name:"父级顶面",color:"#031529",emissive:"#010f1f",envMap:e}),le=new MeshBasicMaterial({name:"父级侧面",color:"#064d73",side:DoubleSide}),fe=new kt({name:"父级板块线",color:new Color$1("#3f648c"),lineWidth:1.2,sizeAttenuation:!1});return{topMat:V,sideMat:le,lineMat:fe}})();this.mList.addMultiple("parentPlane",o)}const r=(()=>{const o=new MeshStandardMaterial({name:"世界顶面",color:"#031529",emissive:"#010f1f",envMap:e}),V=new MeshBasicMaterial({name:"世界侧面",color:"#064d73",side:DoubleSide}),le=new kt({name:"世界板块线",color:new Color$1("#3f648c"),lineWidth:1.2,sizeAttenuation:!1});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("worldPlane",r)}if(this.options.continentsBg){const r=(()=>{const o=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#235278"}),V=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),le=new kt({name:"大洲板块线",color:new Color$1("#1488e0"),sizeAttenuation:!1,lineWidth:this.options.lineWidth});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("continents",r)}})},v.options.style==="map2CityOnMap"){cityOnMap(v);return}v.loaderAdd=function(){return B0(this,null,function*(){this.loaderAddBg()})},v.initMaterial=function(){return B0(this,null,function*(){const e=(()=>{const r=new MeshBasicMaterial({name:"板块顶面",color:new Color$1("#064773")}),o=new MeshBasicMaterial({name:"板块侧面",color:new Color$1("#064d73"),side:DoubleSide}),V=new kt({name:"板块线",color:new Color$1("#02BAF7"),lineWidth:1,sizeAttenuation:!1}),le=new kt({name:"板块边框线",color:new Color$1("#02BAF7"),lineWidth:1,sizeAttenuation:!1});return{topMat:r,sideMat:o,lineMat:V,extrudeLineMat:le}})();this.mList.addMultiple("plane",e),this.options.drillDownFirstLevelUseBgMats&&this.mList.copyMultiple("plane","bgPlane"),this.initMaterialBg()})}},getAdcodeShowLevel=(v,e=!0)=>{if(v===0)return"world";if(v===1e5)return"country";if(/^\d{6}$/.test(`${v}`)){const{level:r,parent:o}=findAdcodeInfo(v),V=o&&findAdcodeInfo(o).level;return r==="district"&&V==="province"&&e?"city":r}else if(continentsType.find(r=>r.adcode===v))return"continent"},Ln=class Ln extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs);C0(this,"mapHistory",[]);C0(this,"activePlaneMap",null);C0(this,"isAnimating",!1);C0(this,"parentBg",[]);C0(this,"continentsBg");C0(this,"group");C0(this,"projection");C0(this,"pcenter",[104,37.5]);C0(this,"pscale",5e4/1e3);C0(this,"meters");C0(this,"cityVis",[]);C0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});C0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});C0(this,"caId");C0(this,"shadowMapLight");C0(this,"planeShadow")}get mapObj(){return this.mapHistory[this.mapHistory.length-1]}get map(){var r;return(r=this.mapObj)==null?void 0:r.map}get mapInfo(){var r;return(r=this.mapObj)==null?void 0:r.mapInfo}get mapArea(){var r;return(r=this.map)==null?void 0:r.areaArr}get mapLine(){var r;return(r=this.map)==null?void 0:r.lineArr}get adcodes(){return this.mapHistory.map(r=>r.mapInfo.adcode)}setOptions(r){r.continentType;const o=gi(gi({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let V=gi({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);Object.keys(o).forEach(le=>{le!=="100000"&&/^\d{6}$/.test(le)&&o[+le].features.forEach(Le=>{const Ce=Le.properties.adcode;V[Ce]={type:"FeatureCollection",features:[Le]}})}),V=gi(gi({},V),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(qi(gi({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,topSegments:0,clickHandleDrillDown:!1,drillDownSecondLevelMats:!1,drillDownFirstLevelUseBgMats:!1,drillDownThirdLevelMats:!1,clickOusideBack:!0,mapDepth:[1,.4,.2],mapPadding:[100,100,100,100],plateInCenter:!0,drillDownPlateInCenter:!0,drillDownHideParent:!1,showOneLevel:!1,drillDownRestrictions:"district",showDistrict:!0,showLabel:!1,lineWidth:.6,lineOffset:0,extrudeLineWidth:1.8,extrudeLine:!0,equirectangular:!1,winkel3:!1,projectionType:"mercator",polarAngle:r.style==="map2CityOnMap"?Math.PI/180*60:Math.PI/180*120,azimuthAngle:0,handleBackKeepCamvasState:!1,worldPacificCentre:!1,mapBoundary:!0,mergeSide:!1,bottomPlane:!1,bottomPlaneWater:!1,showBuilding:!0,buildingSideGradient:!1,buildingHasSide:!0,showRoad:!0,cacheCity:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,showCityOnMapInnerLine:!1,nearbyCities:!1,citySSAO:!1},r),{geojsonMap:o,extrudeLineGeojsonMap:V})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.winkel3&&(this.options.projectionType="winkel3"),this.options.adcode===0?this.extendsOptions.winkel3=()=>this.options.winkel3:(this.getAdcodeShowLevel(this.options.adcode)==="province"||this.getAdcodeShowLevel(this.options.adcode)==="country")&&(this.extendsOptions.clickHandleDrillDown=()=>this.options.clickHandleDrillDown,this.options.clickHandleDrillDown&&(this.extendsOptions.mapDepth=()=>Array.isArray(this.options.mapDepth)?this.options.mapDepth:new Array(3).fill(this.options.mapDepth),this.extendsOptions.drillDownFirstLevelUseBgMats=()=>this.options.drillDownFirstLevelUseBgMats,this.extendsOptions.drillDownSecondLevelMats=()=>this.options.drillDownSecondLevelMats,this.extendsOptions.drillDownThirdLevelMats=()=>this.options.drillDownThirdLevelMats,this.extendsOptions.drillDownPlateInCenter=()=>this.options.drillDownPlateInCenter,this.extendsOptions.clickOusideBack=()=>this.options.clickOusideBack,this.extendsOptions.handleBackKeepCamvasState=()=>this.options.handleBackKeepCamvasState,this.extendsOptions.showOneLevel=()=>this.options.showOneLevel,this.extendsOptions.showDistrict=()=>this.options.showDistrict,this.options.parentBg&&(this.extendsOptions.drillDownHideParent=()=>this.options.drillDownHideParent)),this.extendsOptions.parentBg=()=>this.options.parentBg,this.options.parentBg&&(this.extendsOptions.parentBgDepth=()=>this.options.parentBgDepth,this.options.adcode===1e5&&(this.extendsOptions.worldPacificCentre=()=>this.options.worldPacificCentre)),this.extendsOptions.continentsBg=()=>this.options.continentsBg,this.options.continentsBg&&(this.extendsOptions.continentsBgDepth=()=>this.options.continentsBgDepth)),this.options.adcode===0?world(this):this.options.style==="map2Base"||this.options.style==="map2CityOnMap"?base(this):this.options.adcode===1e5?china(this):base$1(this)}handleSetting(r,o){return B0(this,null,function*(){return yield _n(Ln.prototype,this,"handleSetting").call(this,r,o),r==="label"?o===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels()):r==="labelLite"?o===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels()):r==="shadowMap"&&(o===!1?this.shadowMapDisabled():yield this.shadowMapEnabled()),o})}init(){return B0(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.options.worldPacificCentre&&r===1e5&&(this.pcenter=[this.pcenter[0]-160,this.pcenter[1]]),this.projection=f({center:this.pcenter,scale:this.pscale,projectionType:this.options.projectionType,rotate:this.options.worldPacificCentre?[-160,0]:void 0}),this.meters=this.projection([1*1141e-8+this.pcenter[0],0])[0],yield this.initPencil(),console.time(`vis-core:time.${this.visName}-loader`),this.loaderAdd(),console.timeEnd(`vis-core:time.${this.visName}-loader`),yield this.loader.loadAll(),this.group=yield this.lead.draw("Group",{key:"map"+r}),this.group.object3d.name="地图",yield this.initMaterial(),yield this.initVis(r),this.options.clickHandleDrillDown&&(this.lead.handlePick(()=>this.mapArea||[],"down",({baseObject:o,mouseEvent:V})=>{(this.playing||V.metaKey||V.ctrlKey)&&this.handleClick(o)}),this.options.clickOusideBack&&this.lead.handlePick(()=>this.map?[this.map]:[],"downOutside",({mouseEvent:o})=>{(this.playing||o.metaKey||o.ctrlKey)&&this.handleClick()})),yield Promise.all(this.lead.objectsPromise)})}initCityVis(r,o=!1){return B0(this,null,function*(){var Le;(Le=this.options.fixCity)!=null&&Le[r]&&(r=this.options.fixCity[r]);const V=this.options.center,le=this.options.jsonNameObj[r],fe=new City({container:this.container,editor:!1});return fe.setOptions({container:this.container,center:V,grey:o,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:le,showBuilding:this.options.showBuilding,buildingSideGradient:this.options.buildingSideGradient,buildingHasSide:this.options.buildingHasSide,showRoad:this.options.showRoad,showGrassland:this.options.showGrassland,showRiver:this.options.showRiver,setWaterMaterial:this.options.setWaterMaterial,ssao:this.options.citySSAO,pencil2:this.pencil}),yield fe.init(),this.cityVis.push(fe),this.settings.mouseLeft=Xi.SCREEN_PAN,yield this.settings.mouseLeft,this.emit("initCityVis",r),fe})}initCityOnMap(r){return B0(this,null,function*(){const o=yield this.initCityVis(r),V=this.mapObj.depth+1e-5;if(o.group.position.z=this.mapObj.z+V,o.outAreaGroup.position.z=-this.mapObj.depth/o.multiplyScalar,this.pencil.camera.near=.001,this.pencil.camera.far=7,this.pencil.camera.updateProjectionMatrix(),this.options.nearbyCities&&this.getAdcodeShowLevel(r)==="district"){const le=findAdcodeInfo(r).parent;if(this.getAdcodeShowLevel(le)==="city"){const fe=findAdcodeInfo(le).c;for(const Le of fe)(this.options.nearbyCities==="full"||Le!==r)&&(yield this.initCityVis(Le,!0))}return}})}initVisBg(){return B0(this,null,function*(){let r=1e3,o=1e3;const V=new Vector3(0,0,0);if(this.options.parentBg){const le={projection:{center:this.pcenter,scale:this.pscale,rotate:[0,0],projectionType:this.options.projectionType},areaGroup:!1,depth:this.options.parentBgDepth},fe=this.options.adcode!==1e5;if(fe){const ke=this.mList.getMultiple("parentPlane"),Gt=findAdcodeInfo(this.options.adcode).parent,Vt=findAdcodeInfo(Gt),wt=Vt.b,{res:xt}=yield this.getGeojson(Gt),Xt=yield this.lead.draw("PlaneMap",gi({key:"bg-100000",geojson:xt,bbox:wt,materialOptions:gi({},ke)},le),this.group);Xt.object3d.name=Vt.name,Xt.lineArr.forEach(Zt=>{Zt.object3d.name="线",this.lead.updateBaseObjectKey(Zt,{type:"100000line"}),this.initBaseObjectUserData(Zt)}),Xt.areaArr.forEach(Zt=>{Zt.object3d.name="板块",this.lead.updateBaseObjectKey(Zt,{type:"100000area"})}),Xt.position.z=-this.options.parentBgDepth,this.parentBg.push(Xt)}const Le=this.mList.getMultiple("worldPlane"),Ce=this.options.geojsonMap[0],Re=findAdcodeInfo(0).b,Pe=yield this.lead.draw("PlaneMap",qi(gi({key:"bg-0",geojson:qi(gi({},Ce),{features:[...Ce.features.filter(ke=>fe?ke.properties.iso_a3!=="CHN":!0)]}),bbox:Re,materialOptions:gi({},Le)},le),{projection:qi(gi({},le.projection),{rotate:this.options.worldPacificCentre?[-160,0]:void 0})}),this.group);Pe.object3d.name="世界",Pe.lineArr.forEach(ke=>{ke.object3d.name="线",this.lead.updateBaseObjectKey(ke,{type:"worldline"}),this.initBaseObjectUserData(ke)}),Pe.areaArr.forEach(ke=>{ke.object3d.name="板块",this.lead.updateBaseObjectKey(ke,{type:"worldarea"})}),Pe.position.z=-this.options.parentBgDepth,this.parentBg.push(Pe);const{center:ze,size:Fe}=Pe.getSize();r=Fe.x,o=Fe.y,V.set(ze.x,ze.y,0)}if(this.options.continentsBg){if(this.continentsBg=yield this.lead.draw("ContinentsBg",{depth:this.options.continentsBgDepth,scale:this.pscale},this.group),this.options.style!=="map2CityOnMap"&&this.options.style!=="map2Base"){const le=this.getLocationPosition([104,37.5]);this.continentsBg.position.set(...le)}this.continentsBg.position.z=.1}if(this.options.bottomPlane){const le=yield this.lead.draw("CityPlane",{width:r,height:o,color:"#0f1e57"},this.group);le.object3d.name="地图底面",this.lead.updateBaseObjectKey(le,{type:"map-plane"}),this.options.bottomPlaneWater&&le.addWater(),le.position.copy(V),le.position.z-=.1}})}initVis(r){return B0(this,null,function*(){var o;if(yield this.setAdcode({adcodes:[r],duration:0}),this.options.style!=="map2Base"&&this.options.style!=="map2CityOnMap"){const V=yield this.lead.draw("Light",{type:"SpotLight",color:this.options.adcode===0?"#82d9f2":"#c1e6dd",intensity:3,distance:0,angle:this.options.continentsBg?1:.5,penumbra:1,decay:0}),le=this.pencil.cameraPositon,fe=this.pencil.cameraTarget;V==null||V.spotLight.position.copy(le),V==null||V.spotLight.target.position.copy(fe)}if(this.options.mapBoundary){const V=new Box3().setFromObject((o=this.map)==null?void 0:o.object3d);this.pencil.controls.setBoundary(V)}yield this.initVisBg()})}loaderAddBg(){this.options.bottomPlaneWater&&this.loader.add(["/image/water/normalMap0.jpg","/image/water/normalMap1.jpg"],{})}initMaterialBg(){return B0(this,null,function*(){if(this.options.parentBg){const r=(()=>{const o=new MeshStandardMaterial({name:"世界顶面",emissive:"#081417",color:"#000000"}),V=new MeshBasicMaterial({name:"世界侧面",color:"#051714",side:DoubleSide}),le=new kt({name:"世界线",color:new Color$1("#50766E"),sizeAttenuation:!1,lineWidth:this.options.lineWidth});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("worldPlane",r),this.options.adcode!==1e5&&(this.mList.copyMultiple("worldPlane","parentPlane"),Object.values(this.mList.getMultiple("parentPlane")).forEach(o=>{o.name=o.name.replace("世界","父级")}))}if(this.options.continentsBg){const r=(()=>{const o=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),V=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),le=new kt({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:!1,lineWidth:this.options.lineWidth});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("continents",r)}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var le,fe;const o=this.unproject(r,this.mapObj.z+this.mapObj.depth),V=(fe=(le=this.projection).invert)==null?void 0:fe.call(le,[o.x,-o.y]);console.log("consoleMousePostion.postion",o),console.log("consoleMousePostion.lnglat",V)})}setAreaMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.areaArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#topMat");V!=="origin"&&(Le=fe.material[0].clone(),V.color&&Le.color.set(V.color),V.emissive&&(Le.emissive.set(V.emissive),Le.emissiveIntensity=V.emissiveIntensity||1)),fe.material[0]=Le}}setLineMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.lineArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#lineMat");V!=="origin"&&(Le=fe.material.clone(),V.color&&Le.color.set(V.color),V.width&&(Le.lineWidth=V.width)),fe.material=Le}}addAreaPlaneByProperty(r,o,V){return B0(this,null,function*(){if(!this.map)return;const fe=this.map.options.geojson.features.find(Le=>Le.properties&&Le.properties[r]===o);if(fe){let Le=V.material,Ce=V.sideMaterial;if(y(V.sideMaterial)&&(Ce=new MeshBasicMaterial(gi({},V.sideMaterial))),y(V.material)&&(Le=new MeshBasicMaterial(gi({},V.material))),V.area){const ze=this.objectByUuid(V.area);ze&&([Le,Ce]=ze.material)}let Re=V.lineMaterial;if(y(V.lineMaterial)&&(Re=new kt(gi({},V.lineMaterial))),V.line){const ze=this.objectByUuid(V.line);ze&&(Re=ze.material)}const Pe=yield this.lead.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[fe]},depth:V.depth||0,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:{topMat:Le,lineMat:Re,sideMat:Ce},areaGroup:!1},this.group);if(Pe.position.z=this.mapObj.z+this.mapObj.depth+.01,V.lineBloom&&Pe.lineArr.forEach(ze=>{ze.enableBloom()}),V.area){Pe.position.z=0;const ze=this.baseObjectByUuid(V.area);Pe.areaArr.forEach(Fe=>{ze!=null&&ze.isBloom&&Fe.enableBloom(),Fe.scale.z=ze.scale.z,Fe.position.z=ze.position.z})}if(V.line){const ze=this.baseObjectByUuid(V.line);Pe.lineArr.forEach(Fe=>{ze!=null&&ze.isBloom&&Fe.enableBloom(),Fe.position.z=ze.position.z})}return Pe}})}showAction(){return B0(this,null,function*(){_n(Ln.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const r=this.lead.group;if(this.mapHistory[0]){const{stop:o,start:V}=sinusoidalInOut({onUpdate:le=>{if(!this.mapHistory[0]){o();return}r.position.z=-this.mapHistory[0].depth*(1-le)}});yield V(),this.saveCamvasState("controls",0)}})}hide(){return B0(this,null,function*(){if(!this.showState)return;const r=this.lead.group;yield sinusoidalInOut({onUpdate:o=>{r.position.z=-this.mapHistory[0].depth*o}}).start(),setTimeout(()=>{_n(Ln.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return B0(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const r=yield this.lead.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0});this.lead.updateBaseObjectKey(r,{type:"ShadowSpotLight"}),this.shadowMapLight=r,r.object3d.position.set(.281,32.487,43.077),r.object3d.castShadow=!0;const o=yield this.lead.draw("PlaneShadow");this.planeShadow=o})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.shadowMapLight=void 0),this.planeShadow&&(this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(r){const o=this.getAdcodeShowLevel(r);let V=this.options.mapDepth;Array.isArray(V)||(V=new Array(3).fill(V));let le;return o==="country"?le=V[0]:o==="province"?le=V[1]:le=V[2],le}getDepth(r,o){let V=this.getOptionsDepth(r);if(this.options.depthReference){const le=this.options.depthReference,fe=findAdcodeInfo(r).b;V=V*this.getReferenceScale(le,fe)}else if(this.mapHistory.length){const le=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b,fe=this.getReferenceScale(le,o);V=V*fe}return V}getReferenceScale(r,o){const V=Math.abs(o[3]-o[1])/Math.abs(r[3]-r[1]),le=Math.abs(o[2]-o[0])/Math.abs(r[2]-r[0]);return Math.max(V,le)}getAdcodeShowLevel(r,o=!0){var V;return(V=this.options.fixCity)!=null&&V[r]&&(r=this.options.fixCity[r]),getAdcodeShowLevel(r,o)}handleClick(r){const{drillDownRestrictions:o}=this.options;this.isAnimating||(r&&r.userData.adcode?this.getAdcodeShowLevel(r.userData.adcode,!1)!==o?this.showMap({adcode:r.userData.adcode}):this.emit("drilldownRestrictions",r.userData.adcode):!r&&this.mapHistory.length>1&&this.showMap({adcode:this.adcodes.at(-2)}))}beforeShowMap(r){return!0}getAdcodes(r){var le;const o=[];let V=r;for(;V&&(o.unshift(V),V!==this.options.adcode);)V=(le=findAdcodeInfo(V))==null?void 0:le.parent;return o}showMap(le){return B0(this,arguments,function*({adcode:r,adcodes:o,duration:V=1e3}){const fe=o||this.getAdcodes(r);(yield this.beforeShowMap(fe))!==!1&&(this.emit("beforeDrillDown",[...fe]),yield this.setAdcode({adcodes:fe,duration:V}),this.emit("afterDrillDown",[...fe]))})}drawLabels(){return B0(this,null,function*(){var V;const r=this.options.showLabel;if(!((V=this.mapArea)!=null&&V.length)||!r)return;let o=this.lead.getObject("Group",{key:"mapLabel"});o||(o=yield this.lead.draw("Group",{key:"mapLabel"},this.group),o.object3d.name="地图标签组",yield Promise.all(this.mapArea.map(le=>B0(this,null,function*(){let{name:fe,adcode:Le,centroid:Ce}=le.userData;const{DistrictID:Re,DistName:Pe,iso_a2:ze,center:Fe}=le.userData;if(Le=Le||ze||Re,Ce=Ce||Fe,fe=fe||Pe,!Ce)return;const ke=this.getLocationPosition(Ce);if(this.lead.getObject("Node",{key:`mapLabel-${Le}`})||!ke)return;const[Gt,Vt,wt]=ke;let xt=fe;r==="lite"&&xt&&(xt=fe.replace(/自治州|地区|自治区|省|市|壮族|特别行政区|回族|维吾尔/g,""));const Xt=xt&&getLabelElement(xt),Zt=xt!=null&&xt.startsWith("澳门")?-1:0;yield this.lead.draw("Node",{position:new Vector3(Gt,Vt+Zt,wt),children:Xt,key:`$p:-${this.options.adcode===0?fe:Le}`},o)}))))})}eraseLabels(){const r=this.lead.getObject("Group",{key:"mapLabel"});r==null||r.erase()}geAdcodePosition(r){var V;const o=(V=this.mapArea)==null?void 0:V.find(le=>le.userData.adcode===r);if(o){const{centroid:le,center:fe}=o.userData;return this.getLocationPosition(le||fe)}}getLocationPosition(r){const[o,V]=r,[le,fe]=this.projection([o,V]);return[le,-fe,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}setObjectOnMap(r,o,V=0){const le=this.getLocationPosition(o);r.position.set(le[0],le[1],le[2]+V)}setObjectOnMapAreaByProperty(r,o,V,le=0){var Le;const fe=(Le=this.mapArea)==null?void 0:Le.find(Ce=>Ce.userData[o]===V);if(fe){const{centroid:Ce,center:Re}=fe.userData,Pe=this.getLocationPosition(Ce||Re);r.position.set(Pe[0],Pe[1],Pe[2]+le)}}getAdcodeScreenPosition(r){const o=this.geAdcodePosition(r);if(o){const[V,le,fe]=o,Le=new Vector3(V,le,fe);Le.project(this.pencil.camera);const{width:Ce,height:Re}=this.pencil.getSize(),Pe=(Le.x*.5+.5)*Ce,ze=(Le.y*-.5+.5)*Re;return{x:Pe,y:ze}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(o=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(o)))}booleanPointInMap(r,o){var Le,Ce;const V=o!=null?o:(Le=this.mapInfo)==null?void 0:Le.adcode;if(!V)return!1;const le=findAdcodeInfo(V);if(le!=null&&le.b){const[Re,Pe,ze,Fe]=le.b,[ke,Gt]=r;if(ke<Re||ke>ze||Gt<Pe||Gt>Fe)return!1}const fe=(Ce=this.options.extrudeLineGeojsonMap)==null?void 0:Ce[V];return fe?fe.features.some(Re=>{const Pe=Re.geometry.coordinates;return Re.geometry.type==="Polygon"?Pe.some(ze=>turf.booleanPointInPolygon(turf.point(r),turf.polygon([ze]))):Re.geometry.type==="MultiPolygon"?Pe.some(ze=>ze.some(Fe=>turf.booleanPointInPolygon(turf.point(r),turf.polygon([Fe])))):!1}):!1}getGeojson(r,o=!1){return B0(this,null,function*(){var V,le,fe,Le;return o?this.options.extrudeLine?(fe=this.options.extrudeLineGeojsonMap)!=null&&fe[r]?{res:(Le=this.options.extrudeLineGeojsonMap)==null?void 0:Le[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${r}.json`):{res:void 0}:(V=this.options.geojsonMap)!=null&&V[r]?{res:(le=this.options.geojsonMap)==null?void 0:le[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${r}.json`)})}handleDrillDown(Le){return B0(this,arguments,function*({adcode:r,duration:o,handleLook:V,saveBackCamvasState:le,extrudelineBloom:fe}){var Ce,Re,Pe,ze,Fe;if(typeof r!="undefined"&&!this.isAnimating){const ke=(Ce=this.map)==null?void 0:Ce.findGroup(r,!0),Gt=findAdcodeInfo(+r);if(this.isAnimating||!Gt)return;this.isAnimating=!0;const{name:Vt}=Gt;let{res:wt}=yield this.getGeojson(r),{res:xt}=yield this.getGeojson(r,!0);if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(wt=xt,xt=void 0),[wt,xt].filter(Boolean).forEach(Zt=>{if(!Zt.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const Wt=findAdcodeInfo(r);Zt.features[0].properties=qi(gi(gi({},Zt.features[0].properties),Wt),{center:[Wt.lng,Wt.lat]})}}),wt){const Zt=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if((Re=this.options.fixGeojson)!=null&&Re[r]){const e0=(Pe=this.options.fixGeojson)==null?void 0:Pe[r];if(e0.startsWith("-")){const o0=+e0.slice(1);wt.features=wt.features.filter(b0=>b0.properties.adcode!==o0)}}let Wt=findAdcodeInfo(r).b;const It=[...Wt];this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Wt=findAdcodeInfo(this.mapInfo.adcode).b:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Wt=findAdcodeInfo(this.mapInfo.adcode).b:Wt=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(e0=>{e0.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),le&&this.saveCamvasState("userControls",-1));const Nt=this.mapHistory.length,Ft=Nt-1,Ht=this.getDepth(r,It),Kt=(ze=this.mapHistory[Ft])==null?void 0:ze.depth,Yt=Nt===0||this.options.showOneLevel?0:this.mapHistory[Ft].z+Kt,jt=Nt===0||this.options.showOneLevel?0:Yt-Ht,n0=turf.center(wt).geometry.coordinates,[a0,l0]=this.projection(n0),s0=yield this.drawPlaneMap({geojson:wt,extrudeLineGeojson:xt,depth:Ht,bbox:Wt,adcode:r,extrudelineBloom:fe});ke==null||ke.hide(),s0.position.setZ(jt);const $t=s0.position.z,qt=()=>B0(this,null,function*(){yield sinusoidalInOut({onUpdate:e0=>{Yt!==$t&&(s0.position.z=$t+(Yt-$t)*e0)}}).start({duration:o})});if(Zt)if(this.fixNear(r),s0.position.z=Yt,V){const e0=(Fe=this.mapHistory.at(-1))==null?void 0:Fe.controls;yield this.fitTo(s0,{z:Yt+Ht,adcode:r,enableTransition:o!==0,polarAngle:e0==null?void 0:e0.polarAngle,azimuthAngle:e0==null?void 0:e0.azimuthAngle,handleStart:()=>B0(this,null,function*(){s0.position.z=$t,yield qt()})})}else this.options.showOneLevel&&s0.hide();else yield qt();this.mapHistory.push({map:s0,mapInfo:Gt,z:Yt,depth:Ht,cX:a0,cY:-l0}),V&&this.drawLabels(),this.saveCamvasState("controls",-1)}else console.log(`${Vt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveCamvasState(r,o){const V=this.mapHistory.at(o);V&&(V[r]={lookAt:[...this.pencil.cameraPositon.toArray(),...this.pencil.cameraTarget.toArray()],polarAngle:this.pencil.controls.polarAngle,azimuthAngle:this.pencil.controls.azimuthAngle})}fixNear(r){const o=this.getAdcodeShowLevel(r),V=this.pencil.options;r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(o==="country"||o==="province")&&this.pencil.camera.near!==V.camera.near*10?(this.pencil.camera.near=V.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(o==="city"||o==="district")&&this.pencil.camera.near!==V.camera.near&&(this.pencil.camera.near=V.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(Re){return B0(this,arguments,function*(r,{polarAngle:o,azimuthAngle:V,z:le,handleStart:fe,adcode:Le,enableTransition:Ce=!0}={}){if(!(r!=null&&r.object3d))return;if(Le&&(yield this.useSaveCamera(`map-${Le}`,Ce))){fe&&(yield fe());return}const Pe=this.options.mapPadding,{height:ze,width:Fe}=this.pencil.getSize();ze<Pe[0]+Pe[2]+50&&(Pe[0]=0,Pe[2]=0),Fe<Pe[1]+Pe[3]+50&&(Pe[1]=0,Pe[3]=0);const ke=o!=null?o:this.options.polarAngle,Gt=V!=null?V:this.options.azimuthAngle,Vt=this.pencil.cameraPositon.toArray(),wt=this.pencil.cameraTarget.toArray();yield this.paddingInCssPixel(r,Pe[0],Pe[1],Pe[2],Pe[3],!1);let xt;le&&(xt=this.pencil.cameraTarget.toArray(),yield this.pencil.controls.setTarget(xt[0],xt[1],le,!1)),yield this.pencil.controls.rotateTo(Gt,ke,!1),xt=this.pencil.cameraTarget.toArray();const Xt=this.pencil.cameraPositon.toArray();yield this.lookAt(...Vt,...wt),yield Promise.all([this.lookAt(...Xt,...xt,Ce),fe==null?void 0:fe()].filter(Boolean))})}drawPlaneMap(Ce){return B0(this,arguments,function*({geojson:r,extrudeLineGeojson:o,bbox:V,depth:le,extrudelineBloom:fe,adcode:Le}){var Vt;const Re=[this.mList.getMultiple("plane"),this.mList.getMultiple("secondPlane"),this.mList.getMultiple("thirdPlane")];let Pe=this.mapHistory.length,ze=null;for(;ze===null;)ze=Re[Pe],Pe--;const Fe=this.mList.getMultiple("bgPlane"),ke=gi(gi({},ze),Fe?{bgTopMat:Fe.topMat,bgSideMat:Fe.sideMat,bgLineMat:Fe.lineMat,bgExtrudeLineMat:Fe.extrudeLineMat}:{}),Gt=yield this.lead.draw("PlaneMap",{key:`${Le}`,geojson:r,extrudeLineGeojson:o,depth:le,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:ke,bbox:V,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return Gt.object3d.name=((Vt=findAdcodeInfo(Le))==null?void 0:Vt.name)||`${Le}`,this.options.style==="map2CityOnMap"&&!this.options.showCityOnMapInnerLine&&(ze.lineMat.colorWrite=!1,Gt.lineArr.forEach(wt=>{wt.userData.selectHide=!0})),Gt.extrudelineArr&&Gt.extrudelineArr.forEach(wt=>{wt.object3d.name="板块边线",this.lead.updateBaseObjectKey(wt,{type:"extrudeLine",key:this.mapHistory.length?"$p:":void 0}),this.initBaseObjectUserData(wt),fe&&(wt.object3d.userData.bloom=!0)}),Gt.lineArr&&Gt.lineArr.forEach(wt=>{this.initBaseObjectUserData(wt)}),Gt})}handleBack(){return B0(this,arguments,function*({duration:r=1e3,handleLookBack:o=!0,keepOne:V=!0}={}){if(this.isAnimating||(V?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const le=this.mapHistory.pop();if(!this.options.drillDownPlateInCenter){const fe=le.map.position.z,Le=this.mapObj?this.mapObj.z+(this.mapObj.depth-le.depth):0;yield sinusoidalInOut({onUpdate:Ce=>{le.map.position.z=fe+(Le-fe)*Ce}}).start({duration:r})}if(this.lead.eraseWithoutMaterial(le.map),this.eraseLabels(),this.mapObj){const{map:fe}=this.mapObj,Le=fe==null?void 0:fe.findGroup(le.mapInfo.adcode,!0);Le&&Le.show(),fe&&o&&(this.options.showOneLevel?fe.show():fe.active(),this.options.drillDownHideParent&&this.parentBg.forEach(Ce=>{Ce.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return B0(this,null,function*(){const{userControls:o,controls:V}=this.mapObj;yield this.pencil.controls.setLookAt(...o?o.lookAt:V.lookAt,r!==0)})}compareLocations(r,o){const V=r.filter(Ce=>Ce),le=o.filter(Ce=>Ce),fe=[];let Le=0;for(let Ce=0;Ce<Math.min(V.length,le.length)&&V[Ce]===le[Ce];Ce++)Le++;for(let Ce=Le;Ce<V.length;Ce++)fe.push(-1);for(let Ce=Le;Ce<le.length;Ce++)fe.push(le[Ce]);return fe}setAdcode(V){return B0(this,arguments,function*({adcodes:r,duration:o}){var fe,Le,Ce;const{adcodes:le}=this;if(!(JSON.stringify(r)===JSON.stringify(le)||this.isAnimating))if(JSON.stringify(r)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:o,handleLook:!0})}catch(ke){console.error(ke)}else{const{continent:ke,country:Gt,province:Vt,city:wt,district:xt}=r.reduce((Yt,jt)=>{const n0=this.getAdcodeShowLevel(jt);return Yt[n0]=jt,Yt},{}),{continent:Xt,country:Zt,province:Wt,city:It,district:Nt}=le.reduce((Yt,jt)=>{const n0=this.getAdcodeShowLevel(jt);return Yt[n0]=jt,Yt},{}),Ft=ke||Xt,Ht=(Ce=(Le=(fe=this.map)==null?void 0:fe.extrudelineArr)==null?void 0:Le[0])==null?void 0:Ce.object3d.userData.bloom,Kt=this.compareLocations([Xt,Zt,Wt,It,Nt],[ke,Gt,Vt,wt,xt]);try{for(var Re=Bn(Kt.entries()),Pe,ze,Fe;Pe=!(ze=yield Re.next()).done;Pe=!1){const[Yt,jt]=ze.value;const n0=Yt===Kt.length-1?o:0,a0=Yt===Kt.length-1;jt===-1?yield this.handleBack({duration:n0,handleLookBack:a0,keepOne:!Ft}):yield this.handleDrillDown({adcode:jt,duration:n0,handleLook:a0,saveBackCamvasState:Kt.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:Ht})}}catch(ze){Fe=[ze]}finally{try{Pe&&(ze=Re.return)&&(yield ze.call(Re))}finally{if(Fe)throw Fe[0]}}}})}setPadding(r,o=!1,V=!1){this.options.mapPadding=[...r],o&&this.fitTo(this.map,{enableTransition:V})}findAdcodeInfo(r){return findAdcodeInfo(r)}dispose(){var r,o,V;(r=this.editor)==null||r.events.removeAllListeners(),this.cityVis.forEach(le=>{le.dispose()}),this.cityVis.length=0,(o=this.map)==null||o.dispose(),this.parentBg.forEach(le=>{le.dispose()}),this.parentBg.length=0,(V=this.continentsBg)==null||V.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};C0(Ln,"VisName","map"),C0(Ln,"getAdcodeShowLevel",getAdcodeShowLevel),C0(Ln,"findAdcodeInfo",findAdcodeInfo),C0(Ln,"findNameInfo",findNameInfo);let index=Ln;const access={set token(v){accessToken.token=v}},VERSION=version;exports.Base=Base;exports.City=City$1;exports.Earth=index$1;exports.Map=index;exports.THREE=THREE;exports.TWEEN=tween_esm;exports.VERSION=VERSION;exports.access=access;exports.animationUtils=animation;exports.getCityConfig=getCityConfig;exports.getMapConfig=getMapConfig;exports.removeCameraHistory=removeCameraHistory;
|
|
5366
|
+
`,e},worldPacificCentre=v=>{v.loaderAdd=function(){const e=this.loader;e.add(["/image/map/jianbian.webp"]),e.add(["/image/map/hp2.webp","/image/map/fx2.webp"])},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=this.mList,o=(()=>{const V=e.getAsset("/image/map/hp2.webp");V.center.set(.5,.5),V.repeat.set(.97,1.01);const le=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp2.webp"),normalMap:e.getAsset("/image/map/fx2.webp"),normalScale:new Vector2(2,1)}),fe=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),Le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),Ce=new kt({name:"板块边线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:le,sideMat:fe,lineMat:Le,extrudeLineMat:v.options.extrudeLine?Ce:null}})();r.addMultiple("plane",o)})}},world=v=>{if(v.options.lineOffset=.02,delete v.extendsOptions.handleBackKeepCamvasState,v.extendsOptions.extrudeLine=()=>v.options.extrudeLine,v.extendsOptions.worldPacificCentre=()=>v.options.worldPacificCentre,v.options.worldPacificCentre){worldPacificCentre(v);return}v.initMaterial=function(){return B0(this,null,function*(){const e=this.mList,r=(()=>{const o=new MeshBasicMaterial({name:"顶面",color:"#0d2425"}),V=new MeshBasicMaterial({name:"侧面",color:"#0d2425"}),le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),fe=new kt({name:"板块边线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:o,sideMat:V,lineMat:le,extrudeLineMat:v.options.extrudeLine?fe:null}})();e.addMultiple("plane",r)})}},china=v=>{v.options.lineOffset=.005,v.loaderAdd=function(){return B0(this,null,function*(){this.loader.add(["/image/map/jianbian.webp","/image/map/hp.webp","/image/map/shuchu2.webp"]),this.loaderAddBg()})},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=(()=>{const o=new MeshStandardMaterial({name:"顶面",map:e.getAsset("/image/map/hp.webp"),normalMap:e.getAsset("/image/map/shuchu2.webp")}),V=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),fe=new kt({name:"板块边线",color:new Color$1("#00FFED"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:o,sideMat:V,lineMat:le,extrudeLineMat:fe}})();this.mList.addMultiple("plane",r),this.options.drillDownFirstLevelUseBgMats&&this.mList.copyMultiple("plane","bgPlane"),this.options.drillDownSecondLevelMats&&this.mList.copyMultiple("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMultiple("plane","thirdPlane"),this.initMaterialBg()})}},base$1=v=>{v.loaderAdd=function(){return B0(this,null,function*(){this.loader.add(["/image/map/jianbian.webp"]),this.loaderAddBg()})},v.initMaterial=function(){return B0(this,null,function*(){const e=this.loader,r=(()=>{const o=new MeshBasicMaterial({name:"顶面",color:new Color$1("#0d2425")}),V=new MeshBasicMaterial({name:"侧面",map:e.getAsset("/image/map/jianbian.webp")}),le=new kt({name:"板块线",color:new Color$1("#73FEDD"),sizeAttenuation:!1,lineWidth:this.options.lineWidth,depthWrite:!1}),fe=new kt({name:"板块边线",color:new Color$1("#00FFED"),sizeAttenuation:!1,lineWidth:this.options.extrudeLineWidth,depthWrite:!1});return{topMat:o,sideMat:V,lineMat:le,extrudeLineMat:fe}})();this.mList.addMultiple("plane",r),this.options.drillDownFirstLevelUseBgMats&&this.mList.copyMultiple("plane","bgPlane"),this.options.drillDownSecondLevelMats&&this.mList.copyMultiple("plane","secondPlane"),this.options.drillDownThirdLevelMats&&this.mList.copyMultiple("plane","thirdPlane"),this.initMaterialBg()})}},cityOnMap=v=>{v.extendsOptions={mapDepth:v.options.mapDepth,parentBg:v.options.parentBg,continentsBg:v.options.continentsBg,continentsBgDepth:v.options.continentsBgDepth,mergeSide:v.options.mergeSide,handleBackKeepCamvasState:v.options.handleBackKeepCamvasState,mapBoundary:v.options.mapBoundary,showBuilding:v.options.showBuilding,showRoad:v.options.showRoad,showGrassland:v.options.showGrassland,showRiver:v.options.showRiver,buildingSideGradient:v.options.buildingSideGradient,buildingHasSide:v.options.buildingHasSide,setWaterMaterial:v.options.setWaterMaterial,showCityOnMapInnerLine:v.options.showCityOnMapInnerLine},v.options.parentBg&&(v.extendsOptions.parentBgDepth=()=>v.options.parentBgDepth),v.loaderAdd=function(){this.loader.add(["/image/map2/side.png"])},v.initMaterial=function(){return B0(this,null,function*(){const r=this.loader,o=(()=>{const V=new MeshBasicMaterial({name:"板块顶面",color:"#094253"}),le=new MeshBasicMaterial({name:"板块侧面",map:r.getAsset("/image/map2/side.png"),side:DoubleSide}),fe=new kt({name:"板块边框",color:new Color$1("#02f7eb"),lineWidth:1.8,sizeAttenuation:!1,depthTest:!1}),Le=new kt({name:"板块内线",color:new Color$1("#02f7eb"),lineWidth:1.8,sizeAttenuation:!1,depthTest:!1});return{topMat:V,sideMat:le,lineMat:Le,extrudeLineMat:fe}})();this.mList.addMultiple("plane",o),this.initMaterialBg()})};const e=v.init.bind(v);v.init=function(){return B0(this,null,function*(){yield e(),yield this.initCityOnMap(this.mapInfo.adcode)})}},base=v=>{if(v.initMaterialBg=function(){return B0(this,null,function*(){const e=this.getRoomEnvMap();if(this.options.parentBg){if(this.options.adcode!==1e5){const o=(()=>{const V=new MeshStandardMaterial({name:"父级顶面",color:"#031529",emissive:"#010f1f",envMap:e}),le=new MeshBasicMaterial({name:"父级侧面",color:"#064d73",side:DoubleSide}),fe=new kt({name:"父级板块线",color:new Color$1("#3f648c"),lineWidth:1.2,sizeAttenuation:!1});return{topMat:V,sideMat:le,lineMat:fe}})();this.mList.addMultiple("parentPlane",o)}const r=(()=>{const o=new MeshStandardMaterial({name:"世界顶面",color:"#031529",emissive:"#010f1f",envMap:e}),V=new MeshBasicMaterial({name:"世界侧面",color:"#064d73",side:DoubleSide}),le=new kt({name:"世界板块线",color:new Color$1("#3f648c"),lineWidth:1.2,sizeAttenuation:!1});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("worldPlane",r)}if(this.options.continentsBg){const r=(()=>{const o=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#235278"}),V=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),le=new kt({name:"大洲板块线",color:new Color$1("#1488e0"),sizeAttenuation:!1,lineWidth:this.options.lineWidth});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("continents",r)}})},v.options.style==="map2CityOnMap"){cityOnMap(v);return}v.loaderAdd=function(){return B0(this,null,function*(){this.loaderAddBg()})},v.initMaterial=function(){return B0(this,null,function*(){const e=(()=>{const r=new MeshBasicMaterial({name:"板块顶面",color:new Color$1("#064773")}),o=new MeshBasicMaterial({name:"板块侧面",color:new Color$1("#064d73"),side:DoubleSide}),V=new kt({name:"板块线",color:new Color$1("#02BAF7"),lineWidth:1,sizeAttenuation:!1}),le=new kt({name:"板块边框线",color:new Color$1("#02BAF7"),lineWidth:1,sizeAttenuation:!1});return{topMat:r,sideMat:o,lineMat:V,extrudeLineMat:le}})();this.mList.addMultiple("plane",e),this.options.drillDownFirstLevelUseBgMats&&this.mList.copyMultiple("plane","bgPlane"),this.initMaterialBg()})}},getAdcodeShowLevel=(v,e=!0)=>{if(v===0)return"world";if(v===1e5)return"country";if(/^\d{6}$/.test(`${v}`)){const{level:r,parent:o}=findAdcodeInfo(v),V=o&&findAdcodeInfo(o).level;return r==="district"&&V==="province"&&e?"city":r}else if(continentsType.find(r=>r.adcode===v))return"continent"},Ln=class Ln extends Base{constructor(){super(...arguments);C0(this,"leadObjs",objs);C0(this,"mapHistory",[]);C0(this,"activePlaneMap",null);C0(this,"isAnimating",!1);C0(this,"parentBg",[]);C0(this,"continentsBg");C0(this,"group");C0(this,"projection");C0(this,"pcenter",[104,37.5]);C0(this,"pscale",5e4/1e3);C0(this,"meters");C0(this,"cityVis",[]);C0(this,"extendsOptions",{mapDepth:()=>this.getOptionsDepth(this.options.adcode),equirectangular:()=>this.options.projectionType==="equirectangular",mapBoundary:()=>this.options.mapBoundary,mergeSide:()=>this.options.mergeSide});C0(this,"initSettingsObj",{label:!1,labelLite:!1,shadowMap:!1});C0(this,"caId");C0(this,"shadowMapLight");C0(this,"planeShadow")}get mapObj(){return this.mapHistory[this.mapHistory.length-1]}get map(){var r;return(r=this.mapObj)==null?void 0:r.map}get mapInfo(){var r;return(r=this.mapObj)==null?void 0:r.mapInfo}get mapArea(){var r;return(r=this.map)==null?void 0:r.areaArr}get mapLine(){var r;return(r=this.map)==null?void 0:r.lineArr}get adcodes(){return this.mapHistory.map(r=>r.mapInfo.adcode)}setOptions(r){r.continentType;const o=gi(gi({0:worldExclATAJson,1e5:chinaJson},continentsJson),r==null?void 0:r.geojsonMap);let V=gi({0:worldExclATALiteJson,1e5:chinaLiteJson},continentsLiteJson);Object.keys(o).forEach(le=>{le!=="100000"&&/^\d{6}$/.test(le)&&o[+le].features.forEach(Le=>{const Ce=Le.properties.adcode;V[Ce]={type:"FeatureCollection",features:[Le]}})}),V=gi(gi({},V),r==null?void 0:r.extrudeLineGeojsonMap),super.setOptions(qi(gi({parentBg:!1,continents:"",continentsBg:!1,continentsBgDepth:0,parentBgDepth:0,topSegments:0,clickHandleDrillDown:!1,drillDownSecondLevelMats:!1,drillDownFirstLevelUseBgMats:!1,drillDownThirdLevelMats:!1,clickOusideBack:!0,mapDepth:[1,.4,.2],mapPadding:[100,100,100,100],plateInCenter:!0,drillDownPlateInCenter:!0,drillDownHideParent:!1,showOneLevel:!1,drillDownRestrictions:"district",showDistrict:!0,showLabel:!1,lineWidth:.6,lineOffset:0,extrudeLineWidth:1.8,extrudeLine:!0,equirectangular:!1,winkel3:!1,projectionType:"mercator",polarAngle:r.style==="map2CityOnMap"?Math.PI/180*60:Math.PI/180*120,azimuthAngle:0,handleBackKeepCamvasState:!1,worldPacificCentre:!1,mapBoundary:!0,mergeSide:!1,bottomPlane:!1,bottomPlaneWater:!1,showBuilding:!0,buildingSideGradient:!1,buildingHasSide:!0,showRoad:!0,cacheCity:!0,showGrassland:!0,showRiver:!0,setWaterMaterial:!1,showCityOnMapInnerLine:!1,nearbyCities:!1,citySSAO:!1},r),{geojsonMap:o,extrudeLineGeojsonMap:V})),this.options.equirectangular&&(this.options.projectionType="equirectangular"),this.options.winkel3&&(this.options.projectionType="winkel3"),this.options.adcode===0?this.extendsOptions.winkel3=()=>this.options.winkel3:(this.getAdcodeShowLevel(this.options.adcode)==="province"||this.getAdcodeShowLevel(this.options.adcode)==="country")&&(this.extendsOptions.clickHandleDrillDown=()=>this.options.clickHandleDrillDown,this.options.clickHandleDrillDown&&(this.extendsOptions.mapDepth=()=>Array.isArray(this.options.mapDepth)?this.options.mapDepth:new Array(3).fill(this.options.mapDepth),this.extendsOptions.drillDownFirstLevelUseBgMats=()=>this.options.drillDownFirstLevelUseBgMats,this.extendsOptions.drillDownSecondLevelMats=()=>this.options.drillDownSecondLevelMats,this.extendsOptions.drillDownThirdLevelMats=()=>this.options.drillDownThirdLevelMats,this.extendsOptions.drillDownPlateInCenter=()=>this.options.drillDownPlateInCenter,this.extendsOptions.clickOusideBack=()=>this.options.clickOusideBack,this.extendsOptions.handleBackKeepCamvasState=()=>this.options.handleBackKeepCamvasState,this.extendsOptions.showOneLevel=()=>this.options.showOneLevel,this.extendsOptions.showDistrict=()=>this.options.showDistrict,this.options.parentBg&&(this.extendsOptions.drillDownHideParent=()=>this.options.drillDownHideParent)),this.extendsOptions.parentBg=()=>this.options.parentBg,this.options.parentBg&&(this.extendsOptions.parentBgDepth=()=>this.options.parentBgDepth,this.options.adcode===1e5&&(this.extendsOptions.worldPacificCentre=()=>this.options.worldPacificCentre)),this.extendsOptions.continentsBg=()=>this.options.continentsBg,this.options.continentsBg&&(this.extendsOptions.continentsBgDepth=()=>this.options.continentsBgDepth)),this.options.adcode===0?world(this):this.options.style==="map2Base"||this.options.style==="map2CityOnMap"?base(this):this.options.adcode===1e5?china(this):base$1(this)}handleSetting(r,o){return B0(this,null,function*(){return yield _n(Ln.prototype,this,"handleSetting").call(this,r,o),r==="label"?o===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.labelLite=!1,yield this.settings.labelLite,this.options.showLabel=!0,yield this.drawLabels()):r==="labelLite"?o===!1?(this.eraseLabels(),this.options.showLabel=!1):(this.settings.label=!1,yield this.settings.label,this.options.showLabel="lite",yield this.drawLabels()):r==="shadowMap"&&(o===!1?this.shadowMapDisabled():yield this.shadowMapEnabled()),o})}init(){return B0(this,null,function*(){const{adcode:r}=this.options;this.options.center&&(this.pcenter=this.options.center),this.options.worldPacificCentre&&r===1e5&&(this.pcenter=[this.pcenter[0]-160,this.pcenter[1]]),this.projection=f({center:this.pcenter,scale:this.pscale,projectionType:this.options.projectionType,rotate:this.options.worldPacificCentre?[-160,0]:void 0}),this.meters=this.projection([1*1141e-8+this.pcenter[0],0])[0],yield this.initPencil(),console.time(`vis-core:time.${this.visName}-loader`),this.loaderAdd(),console.timeEnd(`vis-core:time.${this.visName}-loader`),yield this.loader.loadAll(),this.group=yield this.lead.draw("Group",{key:"map"+r}),this.group.object3d.name="地图",yield this.initMaterial(),yield this.initVis(r),this.options.clickHandleDrillDown&&(this.lead.handlePick(()=>this.mapArea||[],"down",({baseObject:o,mouseEvent:V})=>{(this.playing||V.metaKey||V.ctrlKey)&&this.handleClick(o)}),this.options.clickOusideBack&&this.lead.handlePick(()=>this.map?[this.map]:[],"downOutside",({mouseEvent:o})=>{(this.playing||o.metaKey||o.ctrlKey)&&this.handleClick()})),yield Promise.all(this.lead.objectsPromise)})}initCityVis(r,o=!1){return B0(this,null,function*(){var Le;(Le=this.options.fixCity)!=null&&Le[r]&&(r=this.options.fixCity[r]);const V=this.options.center,le=this.options.jsonNameObj[r],fe=new City({container:this.container,editor:!1});return fe.setOptions({container:this.container,center:V,grey:o,adcode:r,cacheKey:this.options.cacheCity?`${this.options.adcode}-${r}`:void 0,jsonName:le,showBuilding:this.options.showBuilding,buildingSideGradient:this.options.buildingSideGradient,buildingHasSide:this.options.buildingHasSide,showRoad:this.options.showRoad,showGrassland:this.options.showGrassland,showRiver:this.options.showRiver,setWaterMaterial:this.options.setWaterMaterial,ssao:this.options.citySSAO,pencil2:this.pencil}),yield fe.init(),this.cityVis.push(fe),this.settings.mouseLeft=Xi.SCREEN_PAN,yield this.settings.mouseLeft,this.emit("initCityVis",r),fe})}initCityOnMap(r){return B0(this,null,function*(){const o=this.getAdcodeShowLevel(r);if(o==="province")yield(yield this.initCityVis(r)).drawCityPlane(r,this.lead.group);else if(o==="city"){const V=findAdcodeInfo(r).c;let le=null;if(V.length>0)for(const fe of V)le=yield this.initCityVis(fe);else le=yield this.initCityVis(r);yield le==null?void 0:le.drawCityPlane(r,this.lead.group),this.pencil.camera.near=.001,this.pencil.camera.far=7,this.pencil.camera.updateProjectionMatrix()}else if(o==="district"&&(yield(yield this.initCityVis(r)).drawCityPlane(r,this.lead.group),this.options.nearbyCities)){const le=findAdcodeInfo(r).parent,fe=findAdcodeInfo(le).c;for(const Le of fe)(this.options.nearbyCities==="full"||Le!==r)&&(yield this.initCityVis(Le,!0))}this.cityVis.forEach(V=>{if(!V.options.grey){const le=this.mapObj.depth+1e-5;V.group.position.z=this.mapObj.z+le}})})}initVisBg(){return B0(this,null,function*(){let r=1e3,o=1e3;const V=new Vector3(0,0,0);if(this.options.parentBg){const le={projection:{center:this.pcenter,scale:this.pscale,rotate:[0,0],projectionType:this.options.projectionType},areaGroup:!1,depth:this.options.parentBgDepth},fe=this.options.adcode!==1e5;if(fe){const ke=this.mList.getMultiple("parentPlane"),Gt=findAdcodeInfo(this.options.adcode).parent,Vt=findAdcodeInfo(Gt),wt=Vt.b,{res:xt}=yield this.getGeojson(Gt),Xt=yield this.lead.draw("PlaneMap",gi({key:"bg-100000",geojson:xt,bbox:wt,materialOptions:gi({},ke)},le),this.group);Xt.object3d.name=Vt.name,Xt.lineArr.forEach(Zt=>{Zt.object3d.name="线",this.lead.updateBaseObjectKey(Zt,{type:"100000line"}),this.initBaseObjectUserData(Zt)}),Xt.areaArr.forEach(Zt=>{Zt.object3d.name="板块",this.lead.updateBaseObjectKey(Zt,{type:"100000area"})}),Xt.position.z=-this.options.parentBgDepth,this.parentBg.push(Xt)}const Le=this.mList.getMultiple("worldPlane"),Ce=this.options.geojsonMap[0],Re=findAdcodeInfo(0).b,Pe=yield this.lead.draw("PlaneMap",qi(gi({key:"bg-0",geojson:qi(gi({},Ce),{features:[...Ce.features.filter(ke=>fe?ke.properties.iso_a3!=="CHN":!0)]}),bbox:Re,materialOptions:gi({},Le)},le),{projection:qi(gi({},le.projection),{rotate:this.options.worldPacificCentre?[-160,0]:void 0})}),this.group);Pe.object3d.name="世界",Pe.lineArr.forEach(ke=>{ke.object3d.name="线",this.lead.updateBaseObjectKey(ke,{type:"worldline"}),this.initBaseObjectUserData(ke)}),Pe.areaArr.forEach(ke=>{ke.object3d.name="板块",this.lead.updateBaseObjectKey(ke,{type:"worldarea"})}),Pe.position.z=-this.options.parentBgDepth,this.parentBg.push(Pe);const{center:ze,size:Fe}=Pe.getSize();r=Fe.x,o=Fe.y,V.set(ze.x,ze.y,0)}if(this.options.continentsBg){if(this.continentsBg=yield this.lead.draw("ContinentsBg",{depth:this.options.continentsBgDepth,scale:this.pscale},this.group),this.options.style!=="map2CityOnMap"&&this.options.style!=="map2Base"){const le=this.getLocationPosition([104,37.5]);this.continentsBg.position.set(...le)}this.continentsBg.position.z=.1}if(this.options.bottomPlane){const le=yield this.lead.draw("CityPlane",{width:r,height:o,color:"#0f1e57"},this.group);le.object3d.name="地图底面",this.lead.updateBaseObjectKey(le,{type:"map-plane"}),this.options.bottomPlaneWater&&le.addWater(),le.position.copy(V),le.position.z-=.1}})}initVis(r){return B0(this,null,function*(){var o;if(yield this.setAdcode({adcodes:[r],duration:0}),this.options.style!=="map2Base"&&this.options.style!=="map2CityOnMap"){const V=yield this.lead.draw("Light",{type:"SpotLight",color:this.options.adcode===0?"#82d9f2":"#c1e6dd",intensity:3,distance:0,angle:this.options.continentsBg?1:.5,penumbra:1,decay:0}),le=this.pencil.cameraPositon,fe=this.pencil.cameraTarget;V==null||V.spotLight.position.copy(le),V==null||V.spotLight.target.position.copy(fe)}if(this.options.mapBoundary){const V=new Box3().setFromObject((o=this.map)==null?void 0:o.object3d);this.pencil.controls.setBoundary(V)}yield this.initVisBg()})}loaderAddBg(){this.options.bottomPlaneWater&&this.loader.add(["/image/water/normalMap0.jpg","/image/water/normalMap1.jpg"],{})}initMaterialBg(){return B0(this,null,function*(){if(this.options.parentBg){const r=(()=>{const o=new MeshStandardMaterial({name:"世界顶面",emissive:"#081417",color:"#000000"}),V=new MeshBasicMaterial({name:"世界侧面",color:"#051714",side:DoubleSide}),le=new kt({name:"世界线",color:new Color$1("#50766E"),sizeAttenuation:!1,lineWidth:this.options.lineWidth});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("worldPlane",r),this.options.adcode!==1e5&&(this.mList.copyMultiple("worldPlane","parentPlane"),Object.values(this.mList.getMultiple("parentPlane")).forEach(o=>{o.name=o.name.replace("世界","父级")}))}if(this.options.continentsBg){const r=(()=>{const o=new MeshStandardMaterial({name:"大洲板块顶面",emissive:"#154532"}),V=new MeshBasicMaterial({name:"大洲板块侧面",color:"#0c1528"}),le=new kt({name:"大洲板块线",color:new Color$1("#09e6c1"),sizeAttenuation:!1,lineWidth:this.options.lineWidth});return{topMat:o,sideMat:V,lineMat:le}})();this.mList.addMultiple("continents",r)}})}consoleMousePostion(){this.addListener(this.container,"click",r=>{var le,fe;const o=this.unproject(r,this.mapObj.z+this.mapObj.depth),V=(fe=(le=this.projection).invert)==null?void 0:fe.call(le,[o.x,-o.y]);console.log("consoleMousePostion.postion",o),console.log("consoleMousePostion.lnglat",V)})}setAreaMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.areaArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#topMat");V!=="origin"&&(Le=fe.material[0].clone(),V.color&&Le.color.set(V.color),V.emissive&&(Le.emissive.set(V.emissive),Le.emissiveIntensity=V.emissiveIntensity||1)),fe.material[0]=Le}}setLineMaterialByProperty(r,o,V){if(!this.map)return;const le=this.map.lineArr.find(fe=>fe.userData[r]===o);if(le){const fe=le.object3d;let Le=this.mList.get("plane#lineMat");V!=="origin"&&(Le=fe.material.clone(),V.color&&Le.color.set(V.color),V.width&&(Le.lineWidth=V.width)),fe.material=Le}}addAreaPlaneByProperty(r,o,V){return B0(this,null,function*(){if(!this.map)return;const fe=this.map.options.geojson.features.find(Le=>Le.properties&&Le.properties[r]===o);if(fe){let Le=V.material,Ce=V.sideMaterial;if(y(V.sideMaterial)&&(Ce=new MeshBasicMaterial(gi({},V.sideMaterial))),y(V.material)&&(Le=new MeshBasicMaterial(gi({},V.material))),V.area){const ze=this.objectByUuid(V.area);ze&&([Le,Ce]=ze.material)}let Re=V.lineMaterial;if(y(V.lineMaterial)&&(Re=new kt(gi({},V.lineMaterial))),V.line){const ze=this.objectByUuid(V.line);ze&&(Re=ze.material)}const Pe=yield this.lead.draw("PlaneMap",{geojson:{type:"FeatureCollection",features:[fe]},depth:V.depth||0,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:{topMat:Le,lineMat:Re,sideMat:Ce},areaGroup:!1},this.group);if(Pe.position.z=this.mapObj.z+this.mapObj.depth+.01,V.lineBloom&&Pe.lineArr.forEach(ze=>{ze.enableBloom()}),V.area){Pe.position.z=0;const ze=this.baseObjectByUuid(V.area);Pe.areaArr.forEach(Fe=>{ze!=null&&ze.isBloom&&Fe.enableBloom(),Fe.scale.z=ze.scale.z,Fe.position.z=ze.position.z})}if(V.line){const ze=this.baseObjectByUuid(V.line);Pe.lineArr.forEach(Fe=>{ze!=null&&ze.isBloom&&Fe.enableBloom(),Fe.position.z=ze.position.z})}return Pe}})}showAction(){return B0(this,null,function*(){_n(Ln.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const r=this.lead.group;if(this.mapHistory[0]){const{stop:o,start:V}=sinusoidalInOut({onUpdate:le=>{if(!this.mapHistory[0]){o();return}r.position.z=-this.mapHistory[0].depth*(1-le)}});yield V(),this.saveCamvasState("controls",0)}})}hide(){return B0(this,null,function*(){if(!this.showState)return;const r=this.lead.group;yield sinusoidalInOut({onUpdate:o=>{r.position.z=-this.mapHistory[0].depth*o}}).start(),setTimeout(()=>{_n(Ln.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return B0(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const r=yield this.lead.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0});this.lead.updateBaseObjectKey(r,{type:"ShadowSpotLight"}),this.shadowMapLight=r,r.object3d.position.set(.281,32.487,43.077),r.object3d.castShadow=!0;const o=yield this.lead.draw("PlaneShadow");this.planeShadow=o})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.shadowMapLight=void 0),this.planeShadow&&(this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(r){const o=this.getAdcodeShowLevel(r);let V=this.options.mapDepth;Array.isArray(V)||(V=new Array(3).fill(V));let le;return o==="country"?le=V[0]:o==="province"?le=V[1]:le=V[2],le}getDepth(r,o){let V=this.getOptionsDepth(r);if(this.options.depthReference){const le=this.options.depthReference,fe=findAdcodeInfo(r).b;V=V*this.getReferenceScale(le,fe)}else if(this.mapHistory.length){const le=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b,fe=this.getReferenceScale(le,o);V=V*fe}return V}getReferenceScale(r,o){const V=Math.abs(o[3]-o[1])/Math.abs(r[3]-r[1]),le=Math.abs(o[2]-o[0])/Math.abs(r[2]-r[0]);return Math.max(V,le)}getAdcodeShowLevel(r,o=!0){var V;return(V=this.options.fixCity)!=null&&V[r]&&(r=this.options.fixCity[r]),getAdcodeShowLevel(r,o)}handleClick(r){const{drillDownRestrictions:o}=this.options;this.isAnimating||(r&&r.userData.adcode?this.getAdcodeShowLevel(r.userData.adcode,!1)!==o?this.showMap({adcode:r.userData.adcode}):this.emit("drilldownRestrictions",r.userData.adcode):!r&&this.mapHistory.length>1&&this.showMap({adcode:this.adcodes.at(-2)}))}beforeShowMap(r){return!0}getAdcodes(r){var le;const o=[];let V=r;for(;V&&(o.unshift(V),V!==this.options.adcode);)V=(le=findAdcodeInfo(V))==null?void 0:le.parent;return o}showMap(le){return B0(this,arguments,function*({adcode:r,adcodes:o,duration:V=1e3}){const fe=o||this.getAdcodes(r);(yield this.beforeShowMap(fe))!==!1&&(this.emit("beforeDrillDown",[...fe]),yield this.setAdcode({adcodes:fe,duration:V}),this.emit("afterDrillDown",[...fe]))})}drawLabels(){return B0(this,null,function*(){var V;const r=this.options.showLabel;if(!((V=this.mapArea)!=null&&V.length)||!r)return;let o=this.lead.getObject("Group",{key:"mapLabel"});o||(o=yield this.lead.draw("Group",{key:"mapLabel"},this.group),o.object3d.name="地图标签组",yield Promise.all(this.mapArea.map(le=>B0(this,null,function*(){let{name:fe,adcode:Le,centroid:Ce}=le.userData;const{DistrictID:Re,DistName:Pe,iso_a2:ze,center:Fe}=le.userData;if(Le=Le||ze||Re,Ce=Ce||Fe,fe=fe||Pe,!Ce)return;const ke=this.getLocationPosition(Ce);if(this.lead.getObject("Node",{key:`mapLabel-${Le}`})||!ke)return;const[Gt,Vt,wt]=ke;let xt=fe;r==="lite"&&xt&&(xt=fe.replace(/自治州|地区|自治区|省|市|壮族|特别行政区|回族|维吾尔/g,""));const Xt=xt&&getLabelElement(xt),Zt=xt!=null&&xt.startsWith("澳门")?-1:0;yield this.lead.draw("Node",{position:new Vector3(Gt,Vt+Zt,wt),children:Xt,key:`$p:-${this.options.adcode===0?fe:Le}`},o)}))))})}eraseLabels(){const r=this.lead.getObject("Group",{key:"mapLabel"});r==null||r.erase()}geAdcodePosition(r){var V;const o=(V=this.mapArea)==null?void 0:V.find(le=>le.userData.adcode===r);if(o){const{centroid:le,center:fe}=o.userData;return this.getLocationPosition(le||fe)}}getLocationPosition(r){const[o,V]=r,[le,fe]=this.projection([o,V]);return[le,-fe,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}setObjectOnMap(r,o,V=0){const le=this.getLocationPosition(o);r.position.set(le[0],le[1],le[2]+V)}setObjectOnMapAreaByProperty(r,o,V,le=0){var Le;const fe=(Le=this.mapArea)==null?void 0:Le.find(Ce=>Ce.userData[o]===V);if(fe){const{centroid:Ce,center:Re}=fe.userData,Pe=this.getLocationPosition(Ce||Re);r.position.set(Pe[0],Pe[1],Pe[2]+le)}}getAdcodeScreenPosition(r){const o=this.geAdcodePosition(r);if(o){const[V,le,fe]=o,Le=new Vector3(V,le,fe);Le.project(this.pencil.camera);const{width:Ce,height:Re}=this.pencil.getSize(),Pe=(Le.x*.5+.5)*Ce,ze=(Le.y*-.5+.5)*Re;return{x:Pe,y:ze}}}booleanPointInCn(r){return chinaLiteJson.features[0].geometry.coordinates.some(o=>turf.booleanPointInPolygon(turf.point(r),turf.polygon(o)))}booleanPointInMap(r,o){var Le,Ce;const V=o!=null?o:(Le=this.mapInfo)==null?void 0:Le.adcode;if(!V)return!1;const le=findAdcodeInfo(V);if(le!=null&&le.b){const[Re,Pe,ze,Fe]=le.b,[ke,Gt]=r;if(ke<Re||ke>ze||Gt<Pe||Gt>Fe)return!1}const fe=(Ce=this.options.extrudeLineGeojsonMap)==null?void 0:Ce[V];return fe?fe.features.some(Re=>{const Pe=Re.geometry.coordinates;return Re.geometry.type==="Polygon"?Pe.some(ze=>turf.booleanPointInPolygon(turf.point(r),turf.polygon([ze]))):Re.geometry.type==="MultiPolygon"?Pe.some(ze=>ze.some(Fe=>turf.booleanPointInPolygon(turf.point(r),turf.polygon([Fe])))):!1}):!1}getGeojson(r,o=!1){return B0(this,null,function*(){var V,le,fe,Le;return o?this.options.extrudeLine?(fe=this.options.extrudeLineGeojsonMap)!=null&&fe[r]?{res:(Le=this.options.extrudeLineGeojsonMap)==null?void 0:Le[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${r}.json`):{res:void 0}:(V=this.options.geojsonMap)!=null&&V[r]?{res:(le=this.options.geojsonMap)==null?void 0:le[r]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${r}.json`)})}handleDrillDown(Le){return B0(this,arguments,function*({adcode:r,duration:o,handleLook:V,saveBackCamvasState:le,extrudelineBloom:fe}){var Ce,Re,Pe,ze,Fe;if(typeof r!="undefined"&&!this.isAnimating){const ke=(Ce=this.map)==null?void 0:Ce.findGroup(r,!0),Gt=findAdcodeInfo(+r);if(this.isAnimating||!Gt)return;this.isAnimating=!0;const{name:Vt}=Gt;let{res:wt}=yield this.getGeojson(r),{res:xt}=yield this.getGeojson(r,!0);if(!this.options.showDistrict&&this.getAdcodeShowLevel(r)==="city"&&(wt=xt,xt=void 0),[wt,xt].filter(Boolean).forEach(Zt=>{if(!Zt.features[0].properties.adcode&&/^\d{6}$/.test(`${r}`)){const Wt=findAdcodeInfo(r);Zt.features[0].properties=qi(gi(gi({},Zt.features[0].properties),Wt),{center:[Wt.lng,Wt.lat]})}}),wt){const Zt=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if((Re=this.options.fixGeojson)!=null&&Re[r]){const e0=(Pe=this.options.fixGeojson)==null?void 0:Pe[r];if(e0.startsWith("-")){const o0=+e0.slice(1);wt.features=wt.features.filter(b0=>b0.properties.adcode!==o0)}}let Wt=findAdcodeInfo(r).b;const It=[...Wt];this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Wt=findAdcodeInfo(this.mapInfo.adcode).b:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Wt=findAdcodeInfo(this.mapInfo.adcode).b:Wt=findAdcodeInfo(this.mapHistory[0].mapInfo.adcode).b),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(e0=>{e0.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),le&&this.saveCamvasState("userControls",-1));const Nt=this.mapHistory.length,Ft=Nt-1,Ht=this.getDepth(r,It),Kt=(ze=this.mapHistory[Ft])==null?void 0:ze.depth,Yt=Nt===0||this.options.showOneLevel?0:this.mapHistory[Ft].z+Kt,jt=Nt===0||this.options.showOneLevel?0:Yt-Ht,n0=turf.center(wt).geometry.coordinates,[a0,l0]=this.projection(n0),s0=yield this.drawPlaneMap({geojson:wt,extrudeLineGeojson:xt,depth:Ht,bbox:Wt,adcode:r,extrudelineBloom:fe});ke==null||ke.hide(),s0.position.setZ(jt);const $t=s0.position.z,qt=()=>B0(this,null,function*(){yield sinusoidalInOut({onUpdate:e0=>{Yt!==$t&&(s0.position.z=$t+(Yt-$t)*e0)}}).start({duration:o})});if(Zt)if(this.fixNear(r),s0.position.z=Yt,V){const e0=(Fe=this.mapHistory.at(-1))==null?void 0:Fe.controls;yield this.fitTo(s0,{z:Yt+Ht,adcode:r,enableTransition:o!==0,polarAngle:e0==null?void 0:e0.polarAngle,azimuthAngle:e0==null?void 0:e0.azimuthAngle,handleStart:()=>B0(this,null,function*(){s0.position.z=$t,yield qt()})})}else this.options.showOneLevel&&s0.hide();else yield qt();this.mapHistory.push({map:s0,mapInfo:Gt,z:Yt,depth:Ht,cX:a0,cY:-l0}),V&&this.drawLabels(),this.saveCamvasState("controls",-1)}else console.log(`${Vt}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:r,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveCamvasState(r,o){const V=this.mapHistory.at(o);V&&(V[r]={lookAt:[...this.pencil.cameraPositon.toArray(),...this.pencil.cameraTarget.toArray()],polarAngle:this.pencil.controls.polarAngle,azimuthAngle:this.pencil.controls.azimuthAngle})}fixNear(r){const o=this.getAdcodeShowLevel(r),V=this.pencil.options;r===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(o==="country"||o==="province")&&this.pencil.camera.near!==V.camera.near*10?(this.pencil.camera.near=V.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(o==="city"||o==="district")&&this.pencil.camera.near!==V.camera.near&&(this.pencil.camera.near=V.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(Re){return B0(this,arguments,function*(r,{polarAngle:o,azimuthAngle:V,z:le,handleStart:fe,adcode:Le,enableTransition:Ce=!0}={}){if(!(r!=null&&r.object3d))return;if(Le&&(yield this.useSaveCamera(`map-${Le}`,Ce))){fe&&(yield fe());return}const Pe=this.options.mapPadding,{height:ze,width:Fe}=this.pencil.getSize();ze<Pe[0]+Pe[2]+50&&(Pe[0]=0,Pe[2]=0),Fe<Pe[1]+Pe[3]+50&&(Pe[1]=0,Pe[3]=0);const ke=o!=null?o:this.options.polarAngle,Gt=V!=null?V:this.options.azimuthAngle,Vt=this.pencil.cameraPositon.toArray(),wt=this.pencil.cameraTarget.toArray();yield this.paddingInCssPixel(r,Pe[0],Pe[1],Pe[2],Pe[3],!1);let xt;le&&(xt=this.pencil.cameraTarget.toArray(),yield this.pencil.controls.setTarget(xt[0],xt[1],le,!1)),yield this.pencil.controls.rotateTo(Gt,ke,!1),xt=this.pencil.cameraTarget.toArray();const Xt=this.pencil.cameraPositon.toArray();yield this.lookAt(...Vt,...wt),yield Promise.all([this.lookAt(...Xt,...xt,Ce),fe==null?void 0:fe()].filter(Boolean))})}drawPlaneMap(Ce){return B0(this,arguments,function*({geojson:r,extrudeLineGeojson:o,bbox:V,depth:le,extrudelineBloom:fe,adcode:Le}){var Vt;const Re=[this.mList.getMultiple("plane"),this.mList.getMultiple("secondPlane"),this.mList.getMultiple("thirdPlane")];let Pe=this.mapHistory.length,ze=null;for(;ze===null;)ze=Re[Pe],Pe--;const Fe=this.mList.getMultiple("bgPlane"),ke=gi(gi({},ze),Fe?{bgTopMat:Fe.topMat,bgSideMat:Fe.sideMat,bgLineMat:Fe.lineMat,bgExtrudeLineMat:Fe.extrudeLineMat}:{}),Gt=yield this.lead.draw("PlaneMap",{key:`${Le}`,geojson:r,extrudeLineGeojson:o,depth:le,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:ke,bbox:V,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return Gt.object3d.name=((Vt=findAdcodeInfo(Le))==null?void 0:Vt.name)||`${Le}`,this.options.style==="map2CityOnMap"&&!this.options.showCityOnMapInnerLine&&(ze.lineMat.colorWrite=!1,Gt.lineArr.forEach(wt=>{wt.userData.selectHide=!0})),Gt.extrudelineArr&&Gt.extrudelineArr.forEach(wt=>{wt.object3d.name="板块边线",this.lead.updateBaseObjectKey(wt,{type:"extrudeLine",key:this.mapHistory.length?"$p:":void 0}),this.initBaseObjectUserData(wt),fe&&(wt.object3d.userData.bloom=!0)}),Gt.lineArr&&Gt.lineArr.forEach(wt=>{this.initBaseObjectUserData(wt)}),Gt})}handleBack(){return B0(this,arguments,function*({duration:r=1e3,handleLookBack:o=!0,keepOne:V=!0}={}){if(this.isAnimating||(V?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const le=this.mapHistory.pop();if(!this.options.drillDownPlateInCenter){const fe=le.map.position.z,Le=this.mapObj?this.mapObj.z+(this.mapObj.depth-le.depth):0;yield sinusoidalInOut({onUpdate:Ce=>{le.map.position.z=fe+(Le-fe)*Ce}}).start({duration:r})}if(this.lead.eraseWithoutMaterial(le.map),this.eraseLabels(),this.mapObj){const{map:fe}=this.mapObj,Le=fe==null?void 0:fe.findGroup(le.mapInfo.adcode,!0);Le&&Le.show(),fe&&o&&(this.options.showOneLevel?fe.show():fe.active(),this.options.drillDownHideParent&&this.parentBg.forEach(Ce=>{Ce.show()}),yield this.handleLookBack(r),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(r){return B0(this,null,function*(){const{userControls:o,controls:V}=this.mapObj;yield this.pencil.controls.setLookAt(...o?o.lookAt:V.lookAt,r!==0)})}compareLocations(r,o){const V=r.filter(Ce=>Ce),le=o.filter(Ce=>Ce),fe=[];let Le=0;for(let Ce=0;Ce<Math.min(V.length,le.length)&&V[Ce]===le[Ce];Ce++)Le++;for(let Ce=Le;Ce<V.length;Ce++)fe.push(-1);for(let Ce=Le;Ce<le.length;Ce++)fe.push(le[Ce]);return fe}setAdcode(V){return B0(this,arguments,function*({adcodes:r,duration:o}){var fe,Le,Ce;const{adcodes:le}=this;if(!(JSON.stringify(r)===JSON.stringify(le)||this.isAnimating))if(JSON.stringify(r)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:o,handleLook:!0})}catch(ke){console.error(ke)}else{const{continent:ke,country:Gt,province:Vt,city:wt,district:xt}=r.reduce((Yt,jt)=>{const n0=this.getAdcodeShowLevel(jt);return Yt[n0]=jt,Yt},{}),{continent:Xt,country:Zt,province:Wt,city:It,district:Nt}=le.reduce((Yt,jt)=>{const n0=this.getAdcodeShowLevel(jt);return Yt[n0]=jt,Yt},{}),Ft=ke||Xt,Ht=(Ce=(Le=(fe=this.map)==null?void 0:fe.extrudelineArr)==null?void 0:Le[0])==null?void 0:Ce.object3d.userData.bloom,Kt=this.compareLocations([Xt,Zt,Wt,It,Nt],[ke,Gt,Vt,wt,xt]);try{for(var Re=Bn(Kt.entries()),Pe,ze,Fe;Pe=!(ze=yield Re.next()).done;Pe=!1){const[Yt,jt]=ze.value;const n0=Yt===Kt.length-1?o:0,a0=Yt===Kt.length-1;jt===-1?yield this.handleBack({duration:n0,handleLookBack:a0,keepOne:!Ft}):yield this.handleDrillDown({adcode:jt,duration:n0,handleLook:a0,saveBackCamvasState:Kt.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:Ht})}}catch(ze){Fe=[ze]}finally{try{Pe&&(ze=Re.return)&&(yield ze.call(Re))}finally{if(Fe)throw Fe[0]}}}})}setPadding(r,o=!1,V=!1){this.options.mapPadding=[...r],o&&this.fitTo(this.map,{enableTransition:V})}findAdcodeInfo(r){return findAdcodeInfo(r)}dispose(){var r,o,V;(r=this.editor)==null||r.events.removeAllListeners(),this.cityVis.forEach(le=>{le.dispose()}),this.cityVis.length=0,(o=this.map)==null||o.dispose(),this.parentBg.forEach(le=>{le.dispose()}),this.parentBg.length=0,(V=this.continentsBg)==null||V.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};C0(Ln,"VisName","map"),C0(Ln,"getAdcodeShowLevel",getAdcodeShowLevel),C0(Ln,"findAdcodeInfo",findAdcodeInfo),C0(Ln,"findNameInfo",findNameInfo);let index=Ln;const access={set token(v){accessToken.token=v}},VERSION=version;exports.Base=Base;exports.City=City$1;exports.Earth=index$1;exports.Map=index;exports.THREE=THREE;exports.TWEEN=tween_esm;exports.VERSION=VERSION;exports.access=access;exports.animationUtils=animation;exports.getCityConfig=getCityConfig;exports.getMapConfig=getMapConfig;exports.removeCameraHistory=removeCameraHistory;
|