map-core-func 0.2.10 → 0.2.11
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import*as t from"maptalks";import{Marker as e,Geometry as n,VectorLayer as r,renderer as i}from"maptalks";import*as o from"three";import{TrianglesDrawMode as s,TriangleFanDrawMode as a,TriangleStripDrawMode as u,BufferGeometry as l,BufferAttribute as h,Color as c,Quaternion as f,Matrix4 as p,LoaderUtils as d,FileLoader as g,Loader as y,MeshBasicMaterial as v,LinearSRGBColorSpace as m,SRGBColorSpace as A,InterleavedBuffer as _,InterleavedBufferAttribute as x,LinearFilter as w,LinearMipmapLinearFilter as b,RepeatWrapping as E,PointsMaterial as I,Material as C,LineBasicMaterial as S,MeshStandardMaterial as M,DoubleSide as B,Vector2 as T,PropertyBinding as k,SkinnedMesh as P,Mesh as L,LineSegments as R,Line as D,LineLoop as O,Points as N,Group as F,PerspectiveCamera as U,MathUtils as Q,OrthographicCamera as G,Skeleton as z,AnimationClip as j,Bone as V,Object3D as q,InterpolateLinear as H,ColorManagement as W,SpotLight as Y,PointLight as X,DirectionalLight as J,MeshPhysicalMaterial as K,Vector3 as Z,InstancedMesh as $,InstancedBufferAttribute as tt,NearestFilter as et,NearestMipmapNearestFilter as nt,LinearMipmapNearestFilter as rt,NearestMipmapLinearFilter as it,ClampToEdgeWrapping as ot,MirroredRepeatWrapping as st,InterpolateDiscrete as at,FrontSide as ut,TextureLoader as lt,ImageBitmapLoader as ht,Texture as ct,VectorKeyframeTrack as ft,NumberKeyframeTrack as pt,QuaternionKeyframeTrack as dt,Box3 as gt,Sphere as yt,Interpolant as vt,DefaultLoadingManager as mt,Ray as At,REVISION as _t,Plane as xt,Spherical as wt,Matrix3 as bt,Frustum as Et,EventDispatcher as It,LoadingManager as Ct,EdgesGeometry as St,BoxGeometry as Mt,Box3Helper as Bt,Vector4 as Tt,Float32BufferAttribute as kt,Box2 as Pt,WebGLRenderer as Lt,WebGLRenderTarget as Rt,ShaderMaterial as Dt,CustomBlending as Ot,ZeroFactor as Nt,OneFactor as Ft,Euler as Ut,PlaneGeometry as Qt,Raycaster as Gt,RGBAFormat as zt,RGBA_ASTC_4x4_Format as jt,RGBA_BPTC_Format as Vt,RGBA_ETC2_EAC_Format as qt,RGBA_PVRTC_4BPPV1_Format as Ht,RGBA_S3TC_DXT5_Format as Wt,RGB_ETC1_Format as Yt,RGB_ETC2_Format as Xt,RGB_PVRTC_4BPPV1_Format as Jt,RGB_S3TC_DXT1_Format as Kt,RGFormat as Zt,RedFormat as $t,RGBA_ASTC_6x6_Format as te,FloatType as ee,HalfFloatType as ne,UnsignedByteType as re,CompressedCubeTexture as ie,CompressedArrayTexture as oe,CompressedTexture as se,DisplayP3ColorSpace as ae,LinearDisplayP3ColorSpace as ue,NoColorSpace as le,DataTexture as he,Data3DTexture as ce,Curve as fe,MeshPhongMaterial as pe,MeshLambertMaterial as de,EquirectangularReflectionMapping as ge,AmbientLight as ye,Uint16BufferAttribute as ve,ShapeUtils as me,UniformsLib as Ae,ShaderLib as _e,UniformsUtils as xe,InstancedInterleavedBuffer as we,WireframeGeometry as be,InstancedBufferGeometry as Ee,Line3 as Ie,DepthTexture as Ce,DepthStencilFormat as Se,UnsignedInt248Type as Me,UnsignedIntType as Be,Scene as Te,Camera as ke,BasicDepthPacking as Pe,BackSide as Le,Uniform as Re,NoBlending as De,RGBADepthPacking as Oe,EqualDepth as Ne,NotEqualDepth as Fe,LessDepth as Ue,MeshDepthMaterial as Qe,GreaterDepth as Ge,GreaterEqualDepth as ze,LessEqualDepth as je,AlwaysDepth as Ve,NeverDepth as qe,DataUtils as He,DataTextureLoader as We,MeshDistanceMaterial as Ye,ShaderChunk as Xe}from"three";function Je(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ke(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function Ze(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){Ke(o,r,i,s,a,"next",t)}function a(t){Ke(o,r,i,s,a,"throw",t)}s(void 0)}))}}function $e(t,e,n){return e=un(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,hn()?Reflect.construct(e,n||[],un(t).constructor):e.apply(t,n))}function tn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function en(t,e,n){if(hn())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&gn(i,n.prototype),i}function nn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xn(r.key),r)}}function rn(t,e,n){return e&&nn(t.prototype,e),n&&nn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function on(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=bn(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function sn(t,e,n){return(e=xn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function an(){return an="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=vn(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},an.apply(null,arguments)}function un(t){return un=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},un(t)}function ln(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gn(t,e)}function hn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(hn=function(){return!!t})()}function cn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function fn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?cn(Object(n),!0).forEach((function(e){sn(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cn(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function pn(){pn=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof v?e:v,s=Object.create(o.prototype),a=new T(r||[]);return i(s,"_invoke",{value:C(t,n,a)}),s}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var f="suspendedStart",p="suspendedYield",d="executing",g="completed",y={};function v(){}function m(){}function A(){}var _={};l(_,s,(function(){return this}));var x=Object.getPrototypeOf,w=x&&x(x(k([])));w&&w!==n&&r.call(w,s)&&(_=w);var b=A.prototype=v.prototype=Object.create(_);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,o,s,a){var u=c(t[i],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function C(e,n,r){var i=f;return function(o,s){if(i===d)throw Error("Generator is already running");if(i===g){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=S(a,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=d;var l=c(e,n,r);if("normal"===l.type){if(i=r.done?g:p,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=g,r.method="throw",r.arg=l.arg)}}}function S(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=c(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function M(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function B(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function k(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return m.prototype=A,i(b,"constructor",{value:A,configurable:!0}),i(A,"constructor",{value:m,configurable:!0}),m.displayName=l(A,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,A):(t.__proto__=A,l(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},E(I.prototype),l(I.prototype,a,(function(){return this})),e.AsyncIterator=I,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new I(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},E(b),l(b,u,"Generator"),l(b,s,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=k,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(B),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(u&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),B(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;B(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:k(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function dn(t,e,n,r){return dn="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,r){var i,o=vn(t,e);if(o){if((i=Object.getOwnPropertyDescriptor(o,e)).set)return i.set.call(r,n),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(r,e)){if(!i.writable)return!1;i.value=n,Object.defineProperty(r,e,i)}else sn(r,e,n);return!0},dn(t,e,n,r)}function gn(t,e){return gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gn(t,e)}function yn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(t,e)||bn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vn(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=un(t)););return t}function mn(t,e,n,r){var i=an(un(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function An(t,e,n,r,i,o){return function(t,e,n,r,i){if(!dn(t,e,n,r||t)&&i)throw new TypeError("failed to set property");return n}(un(o?t.prototype:t),e,n,r,i)}function _n(t){return function(t){if(Array.isArray(t))return Je(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||bn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xn(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function wn(t){return wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wn(t)}function bn(t,e){if(t){if("string"==typeof t)return Je(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Je(t,e):void 0}}const En=parseInt(o.REVISION.replace("dev",""));function In(t,e,n){return En>109?t.setAttribute(e,n):t.addAttribute(e,n),t}function Cn(){return o}function Sn(){return(t=Cn()).VertexColors?t.VertexColors:2;var t}function Mn(t,e,n){const r=Cn();return En>=144?new r.BoxGeometry(t,e,n):r.BoxBufferGeometry?new r.BoxBufferGeometry(t,e,n):r.BoxGeometry?new r.BoxGeometry(t,e,n):void 0}console.log(`maptalks.three log: current three.js version is %c${En}`,"color:red;font-size: 16px;font-weight: bold;");class Bn extends o.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),In(this,"position",new o.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),In(this,"uv",new o.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix(t){var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(t.applyToBufferAttribute(e),t.applyToBufferAttribute(n),e.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var n=new o.InstancedInterleavedBuffer(e,6,1);return In(this,"instanceStart",new o.InterleavedBufferAttribute(n,3,0)),In(this,"instanceEnd",new o.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var n=new o.InstancedInterleavedBuffer(e,6,1);return In(this,"instanceColorStart",new o.InterleavedBufferAttribute(n,3,0)),In(this,"instanceColorEnd",new o.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new o.WireframeGeometry(t.geometry)),this}fromLineSegements(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this}computeBoundingBox(){var t=new o.Box3;null===this.boundingBox&&(this.boundingBox=new o.Box3);var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;void 0!==e&&void 0!==n&&(this.boundingBox.setFromBufferAttribute(e),t.setFromBufferAttribute(n),this.boundingBox.union(t))}computeBoundingSphere(){var t=new o.Vector3;null===this.boundingSphere&&(this.boundingSphere=new o.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==e&&void 0!==n){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var i=0,s=0,a=e.count;s<a;s++)t.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(t)),t.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}copy(t){return this}}const Tn={},kn={};Tn.line={linewidth:{value:1},resolution:{value:new o.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},kn.line={uniforms:o.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.fog,Tn.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <premultiplied_alpha_fragment>\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\n\t\t}\n\t\t"};class Pn extends o.ShaderMaterial{constructor(t){super({uniforms:o.UniformsUtils.clone(kn.line.uniforms),vertexShader:kn.line.vertexShader,fragmentShader:kn.line.fragmentShader}),this.dashed=!0,this.isLineMaterial=!0,this.type="LineMaterial",Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}}),this.setValues(t)}}class Ln extends o.Mesh{constructor(t,e){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2",this.geometry=void 0!==t?t:new Bn,this.material=void 0!==e?e:new Pn({color:16777215*Math.random()})}computeLineDistances(){var t=new o.Vector3,e=new o.Vector3,n=this.geometry,r=n.attributes.instanceStart,i=n.attributes.instanceEnd;if(!r||!i)return this;for(var s=new Float32Array(2*r.data.count),a=0,u=0,l=r.data.count;a<l;a++,u+=2)t.fromBufferAttribute(r,a),e.fromBufferAttribute(i,a),s[u]=0===u?0:s[u-1],s[u+1]=s[u]+t.distanceTo(e);var h=new o.InstancedInterleavedBuffer(s,2,1);return In(n,"instanceDistanceStart",new o.InterleavedBufferAttribute(h,1,0)),In(n,"instanceDistanceEnd",new o.InterleavedBufferAttribute(h,1,1)),this}}class Rn extends Bn{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}fromLine(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this}}class Dn extends Ln{constructor(t,e){super(t,e),this.isLine2=!0,this.type="Line2",this.geometry=void 0!==t?t:new Rn,this.material=void 0!==e?e:new Pn({color:16777215*Math.random()})}copy(t){return this}}const On={interactive:!0,altitude:0,minZoom:0,maxZoom:30,asynchronous:!1,bloom:!1,pickWeight:-1};function Nn(){}class Fn extends(t.Eventable(Nn)){constructor(e){super(),this.isAdd=!1,this._mouseover=!1,this._visible=!0,this._zoomVisible=!0,this.picked=!1,this.isBaseObject=!0,void 0===e&&(e=t.Util.GUID()),this.id=e}addTo(t){return t&&"ThreeLayer"===t.type?t.addMesh([this]):console.error("layer only support maptalks.ThreeLayer"),this}remove(){const t=this.getLayer();return t&&t.removeMesh([this]),this}getObject3d(){return this.object3d}getId(){return this.id}setId(t){const e=this.getId();return this.id=t,this._fire("idchange",{old:e,new:t,target:this}),this}getType(){return this.type}getOptions(){return this.options}getProperties(){return(this.options||{}).properties}setProperties(t){const e=Object.assign({},this.getProperties());return this.options.properties=t,this._fire("propertieschange",{old:e,new:t,target:this}),this}getLayer(){return this.options.layer}getMap(){const t=this.getLayer();if(t)return t.getMap()}getCenter(){const e=this.getOptions(),{coordinate:n,lineString:r,polygon:i}=e;if(n)return n instanceof t.Coordinate?n:new t.Coordinate(n);{const t=i||r;if(t&&t.getCenter)return t.getCenter()}}getAltitude(){return this.getOptions().altitude}setAltitude(e){if(t.Util.isNumber(e)){const t=this.getLayer().altitudeToVector3(e,e).x;if(this.getObject3d().position.z=t,this.options.altitude=e,this.pickObject3d&&(this.pickObject3d.position.z=t),this._baseObjects&&Array.isArray(this._baseObjects))for(let e=0,n=this._baseObjects.length;e<n;e++)this._baseObjects[e]&&(this._baseObjects[e].getObject3d().position.z=t)}return this}supportHeight(){return this.getOptions().heightEnable}getHeight(){const{height:e}=this.getOptions();return t.Util.isNumber(e)?e:0}setHeight(e){if(!t.Util.isNumber(e)||this._baseObjects||!this.supportHeight())return this;const n=this.getLayer();if(!n)return this;const{geometry:r}=this.getObject3d();if(r instanceof o.BufferGeometry){const{position:t}=r.attributes||{};if(!t)return this;const i=t.array;let o=1/0,s=-1/0;for(let t=0,e=i.length;t<e;t+=3){const e=i[t+2];o=Math.min(e,o),s=Math.max(e,s)}const a=(o+s)/2;let u=n.altitudeToVector3(e,e).x;u=Math.max(u,1e-6);for(let t=0,e=i.length;t<e;t+=3)i[t+2]>a&&(i[t+2]=u);r.attributes.position.needsUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),this.getOptions().height=e}return this}show(){return this._zoomVisible&&(this.getObject3d().visible=!0,this._fire("show")),this._visible=!0,this}hide(){return this.getObject3d().visible=!1,this._fire("hide"),this._visible=!1,this._hideUI(),this}isVisible(){return!!this.getObject3d().visible}getSymbol(){return this.getObject3d().material}setSymbol(t){if(t&&t instanceof o.Material){t.needsUpdate=!0,t.vertexColors=this.getObject3d().material.vertexColors;const e=this.getObject3d().material.clone();this.getObject3d().material=t,this._fire("symbolchange",{old:e,new:t,target:this})}return this}setInfoWindow(e){return this.removeInfoWindow(),this.infoWindow=new t.ui.InfoWindow(e),this.infoWindow.addTo(this),this}getInfoWindow(){return this.infoWindow}openInfoWindow(e){return(e=e||this.getCenter())instanceof t.Coordinate||(e=new t.Coordinate(e)),e&&this.infoWindow&&this.infoWindow.show(e),this}closeInfoWindow(){return this.infoWindow&&this.infoWindow.hide(),this}removeInfoWindow(){return this.infoWindow&&(this.infoWindow.remove(),delete this.infoWindow),this}setToolTip(e,n){return this.removeToolTip(),this.toolTip=new t.ui.ToolTip(e,n),this.toolTip.addTo(this),this}getToolTip(){return this.toolTip}openToolTip(t){return this}closeToolTip(){return this.toolTip&&this.toolTip.hide(),this}removeToolTip(){return this.toolTip&&(this.toolTip.remove(),delete this.toolTip),this}_hideUI(){return this.closeInfoWindow(),this.closeToolTip(),this}animateShow(e={},n){this._showPlayer&&this._showPlayer.cancel(),t.Util.isFunction(e)&&(n=e={});const r=e.duration||1e3,i=e.easing||"out",o=this._showPlayer=t.animation.Animation.animate({scale:1},{duration:r,easing:i},(t=>{const e=t.styles.scale;e>0&&(this.getObject3d().scale.z=e),n&&n(t,e)}));return o.play(),o}getMinZoom(){return this.getOptions().minZoom}getMaxZoom(){return this.getOptions().maxZoom}isAsynchronous(){return this.getOptions().asynchronous}get bloom(){return this.getOptions().bloom}fire(t,e){return this._fire(t,e),this._vt&&this._vt.onSelectMesh&&this._vt.onSelectMesh(t,e),this}config(){return this}setPickObject3d(t){return this.pickObject3d=t,this.pickObject3d.__parent=this,this}getPickObject3d(){return this.pickObject3d}_initOptions(e){return this.options=t.Util.extend({},On,e),this}_createMesh(t,e){return this.object3d=new o.Mesh(t,e),this.object3d.__parent=this,this}_createInstancedMesh(t,e,n){return this.object3d=new o.InstancedMesh(t,e,n),this.object3d.__parent=this,this}_createGroup(){return this.object3d=new o.Group,this.object3d.__parent=this,this}_createLine(t,e){return this.object3d=new o.Line(t,e),this._computeLineDistances(t),this.object3d.__parent=this,this}_createLine2(t,e){return this.object3d=new Dn(t,e),this.object3d.computeLineDistances(),this.object3d.__parent=this,this}_createPoints(t,e){return this.object3d=new o.Points(t,e),this.object3d.__parent=this,this}_createLineSegments(t,e){return this.object3d=new o.LineSegments(t,e),this._computeLineDistances(t),this.object3d.__parent=this,this}_computeLineDistances(t){const e=t.attributes.position.array,n=t.attributes.position.count,r=new Float32Array(n);r[0]=0;const i=new o.Vector3(0,0,0),s=new o.Vector3(0,0,0);for(let t=1;t<n;t++){const n=3*(t-1);i.x=e[n],i.y=e[n+1],i.z=e[n+2];const o=3*t;s.x=e[o],s.y=e[o+1],s.z=e[o+2];const a=s.distanceTo(i);r[t]=r[t-1]+a}In(t,"lineDistance",new o.BufferAttribute(r,1))}}const Un=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];function Qn(t){return t.geometry?t.geometry.type:null}function Gn(t){const e=Qn(t);if(e)for(let t=0,n=Un.length;t<n;t++)if(Un[t]===e)return!0;return!1}function zn(t){const e=Qn(t);return!(!e||e!==Un[4]&&e!==Un[5])}function jn(t){const e=Qn(t);return!(!e||e!==Un[2]&&e!==Un[3])}function Vn(t){const e=Qn(t);return!(!e||e!==Un[0]&&e!==Un[1])}function qn(t){const e=Qn(t);return!!(e&&e.indexOf("Multi")>-1)}function Hn(t){return t.geometry?t.geometry.coordinates:[]}function Wn(e,n){const r=Qn(e);if(!r||!e.geometry)return null;const i=e.geometry.coordinates;if(!i)return null;let o=0,s=0,a=0;switch(r){case"Point":o=i[0],s=i[1],a++;break;case"MultiPoint":case"LineString":for(let t=0,e=i.length;t<e;t++)o+=i[t][0],s+=i[t][1],a++;break;case"MultiLineString":case"Polygon":for(let t=0,e=i.length;t<e;t++)for(let e=0,n=i[t].length;e<n;e++)o+=i[t][e][0],s+=i[t][e][1],a++;break;case"MultiPolygon":for(let t=0,e=i.length;t<e;t++)for(let e=0,n=i[t].length;e<n;e++)for(let n=0,r=i[t][e].length;n<r;n++)o+=i[t][e][n][0],s+=i[t][e][n][1],a++}const u=o/a,l=s/a;return n?(n.x=u,n.y=l,n):new t.Coordinate(u,l)}function Yn(t){const e=Qn(t);if(!e||!t.geometry)return null;const n=t.geometry,r=t.properties||{},i=n.coordinates;if(!i)return null;const o=[];let s;switch(e){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}if(s)for(let t=0,e=i.length;t<e;t++)o.push({type:"Feature",geometry:{type:s,coordinates:i[t]},properties:r});else o.push(t);return o}
|
|
2
2
|
/*!
|
|
3
3
|
* poly-extrude v0.16.0
|
|
4
|
-
*/function Xn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Jn(t,e){return Jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jn(t,e)}function Kn(t,e,n){void 0===n&&(n=2);var r,i,o,s=e&&e.length,a=s?e[0]*n:t.length,u=Zn(t,0,a,n,!0),l=[];if(!u||u.next===u.prev)return l;if(s&&(u=function(t,e,n,r){for(var i=[],o=0,s=e.length;o<s;o++){var a=Zn(t,e[o]*r,o<s-1?e[o+1]*r:t.length,r,!1);a===a.next&&(a.steiner=!0),i.push(lr(a))}i.sort(or);for(var u=0;u<i.length;u++)n=sr(i[u],n);return n}(t,e,u,n)),t.length>80*n){r=1/0,i=1/0;for(var h=-1/0,c=-1/0,f=n;f<a;f+=n){var p=t[f],d=t[f+1];p<r&&(r=p),d<i&&(i=d),p>h&&(h=p),d>c&&(c=d)}o=0!==(o=Math.max(h-r,c-i))?32767/o:0}return tr(u,l,n,r,i,o,0),l}function Zn(t,e,n,r,i){var o;if(i===function(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,n,r)>0)for(var s=e;s<n;s+=r)o=_r(s/r|0,t[s],t[s+1],o);else for(var a=n-r;a>=e;a-=r)o=_r(a/r|0,t[a],t[a+1],o);return o&&dr(o,o.next)&&(xr(o),o=o.next),o}function $n(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!dr(r,r.next)&&0!==pr(r.prev,r,r.next))r=r.next;else{if(xr(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function tr(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=ur(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n=1;do{var r=t,i=void 0;t=null;var o=null;for(e=0;r;){e++;for(var s=r,a=0,u=0;u<n&&(a++,s=s.nextZ);u++);for(var l=n;a>0||l>0&&s;)0!==a&&(0===l||!s||r.z<=s.z)?(i=r,r=r.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);for(var a=t;t.prev!==t.next;){var u=t.prev,l=t.next;if(o?nr(t,r,i,o):er(t))e.push(u.i,t.i,l.i),xr(t),t=l.next,a=l.next;else if((t=l)===a){s?1===s?tr(t=rr($n(t),e),e,n,r,i,o,2):2===s&&ir(t,e,n,r,i,o):tr($n(t),e,n,r,i,o,1);break}}}}function er(t){var e=t.prev,n=t,r=t.next;if(pr(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,u=n.y,l=r.y,h=Math.min(i,o,s),c=Math.min(a,u,l),f=Math.max(i,o,s),p=Math.max(a,u,l),d=r.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&cr(i,a,o,u,s,l,d.x,d.y)&&pr(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function nr(t,e,n,r){var i=t.prev,o=t,s=t.next;if(pr(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,u,l),d=Math.min(h,c,f),g=Math.max(a,u,l),y=Math.max(h,c,f),v=ur(p,d,e,n,r),m=ur(g,y,e,n,r),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&cr(a,h,u,c,l,f,A.x,A.y)&&pr(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&cr(a,h,u,c,l,f,_.x,_.y)&&pr(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&cr(a,h,u,c,l,f,A.x,A.y)&&pr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&cr(a,h,u,c,l,f,_.x,_.y)&&pr(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function rr(t,e){var n=t;do{var r=n.prev,i=n.next.next;!dr(r,i)&&gr(r,n,n.next,i)&&mr(r,i)&&mr(i,r)&&(e.push(r.i,n.i,i.i),xr(n),xr(n.next),n=t=i),n=n.next}while(n!==t);return $n(n)}function ir(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&fr(s,a)){var u=Ar(s,a);return s=$n(s,s.next),u=$n(u,u.next),tr(s,e,n,r,i,o,0),void tr(u,e,n,r,i,o,0)}a=a.next}s=s.next}while(s!==t)}function or(t,e){var n=t.x-e.x;0===n&&(0===(n=t.y-e.y)&&(n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)));return n}function sr(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;if(dr(t,r))return r;do{if(dr(t,r.next))return r.next;if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var u=n,l=n.x,h=n.y,c=1/0;r=n;do{if(i>=r.x&&r.x>=l&&i!==r.x&&hr(o<h?i:s,o,l,h,o<h?s:i,o,r.x,r.y)){var f=Math.abs(o-r.y)/(i-r.x);mr(r,t)&&(f<c||f===c&&(r.x>n.x||r.x===n.x&&ar(n,r)))&&(n=r,c=f)}r=r.next}while(r!==u);return n}(t,e);if(!n)return e;var r=Ar(n,t);return $n(r,r.next),$n(n,n.next)}function ar(t,e){return pr(t.prev,t,e.prev)<0&&pr(e.next,t,t.next)<0}function ur(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function lr(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function hr(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function cr(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&hr(t,e,n,r,i,o,s,a)}function fr(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&gr(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(mr(t,e)&&mr(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(pr(t.prev,t,e.prev)||pr(t,e.prev,e))||dr(t,e)&&pr(t.prev,t,t.next)>0&&pr(e.prev,e,e.next)>0)}function pr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function dr(t,e){return t.x===e.x&&t.y===e.y}function gr(t,e,n,r){var i=vr(pr(t,e,n)),o=vr(pr(t,e,r)),s=vr(pr(n,r,t)),a=vr(pr(n,r,e));return i!==o&&s!==a||(!(0!==i||!yr(t,n,e))||(!(0!==o||!yr(t,r,e))||(!(0!==s||!yr(n,t,r))||!(0!==a||!yr(n,e,r)))))}function yr(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function vr(t){return t>0?1:t<0?-1:0}function mr(t,e){return pr(t.prev,t,t.next)<0?pr(t,e,t.next)>=0&&pr(t,t.prev,e)>=0:pr(t,e,t.prev)<0||pr(t,t.next,e)<0}function Ar(t,e){var n=wr(t.i,t.x,t.y),r=wr(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function _r(t,e,n,r){var i=wr(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function xr(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function wr(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var br=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}t.slerpFlat=function(t,e,n,r,i,o,s){var a=n[r+0],u=n[r+1],l=n[r+2],h=n[r+3],c=i[o+0],f=i[o+1],p=i[o+2],d=i[o+3];if(0===s)return t[e+0]=a,t[e+1]=u,t[e+2]=l,void(t[e+3]=h);if(1===s)return t[e+0]=c,t[e+1]=f,t[e+2]=p,void(t[e+3]=d);if(h!==d||a!==c||u!==f||l!==p){var g=1-s,y=a*c+u*f+l*p+h*d,v=y>=0?1:-1,m=1-y*y;if(m>Number.EPSILON){var A=Math.sqrt(m),_=Math.atan2(A,y*v);g=Math.sin(g*_)/A,s=Math.sin(s*_)/A}var x=s*v;if(a=a*g+c*x,u=u*g+f*x,l=l*g+p*x,h=h*g+d*x,g===1-s){var w=1/Math.sqrt(a*a+u*u+l*l+h*h);a*=w,u*=w,l*=w,h*=w}}t[e]=a,t[e+1]=u,t[e+2]=l,t[e+3]=h},t.multiplyQuaternionsFlat=function(t,e,n,r,i,o){var s=n[r],a=n[r+1],u=n[r+2],l=n[r+3],h=i[o],c=i[o+1],f=i[o+2],p=i[o+3];return t[e]=s*p+l*h+a*f-u*c,t[e+1]=a*p+l*c+u*h-s*f,t[e+2]=u*p+l*f+s*c-a*h,t[e+3]=l*p-s*h-a*c-u*f,t};var e,n,r,i=t.prototype;return i.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},i.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},i.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},i.setFromEuler=function(t,e){void 0===e&&(e=!0);var n=t._x,r=t._y,i=t._z,o=t._order,s=Math.cos,a=Math.sin,u=s(n/2),l=s(r/2),h=s(i/2),c=a(n/2),f=a(r/2),p=a(i/2);switch(o){case"XYZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"YXZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"ZXY":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"ZYX":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"YZX":this._x=c*l*h+u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h-c*f*p;break;case"XZY":this._x=c*l*h-u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h+c*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===e&&this._onChangeCallback(),this},i.setFromAxisAngle=function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},i.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],r=e[4],i=e[8],o=e[1],s=e[5],a=e[9],u=e[2],l=e[6],h=e[10],c=n+s+h;if(c>0){var f=.5/Math.sqrt(c+1);this._w=.25/f,this._x=(l-a)*f,this._y=(i-u)*f,this._z=(o-r)*f}else if(n>s&&n>h){var p=2*Math.sqrt(1+n-s-h);this._w=(l-a)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(i+u)/p}else if(s>h){var d=2*Math.sqrt(1+s-n-h);this._w=(i-u)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(a+l)/d}else{var g=2*Math.sqrt(1+h-n-s);this._w=(o-r)/g,this._x=(i+u)/g,this._y=(a+l)/g,this._z=.25*g}return this._onChangeCallback(),this},i.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},i.rotateTowards=function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},i.identity=function(){return this.set(0,0,0,1)},i.invert=function(){return this.conjugate()},i.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},i.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},i.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},i.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},i.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},i.multiply=function(t){return this.multiplyQuaternions(this,t)},i.premultiply=function(t){return this.multiplyQuaternions(t,this)},i.multiplyQuaternions=function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,s=e._x,a=e._y,u=e._z,l=e._w;return this._x=n*l+o*s+r*u-i*a,this._y=r*l+o*a+i*s-n*u,this._z=i*l+o*u+n*a-r*s,this._w=o*l-n*s-r*a-i*u,this._onChangeCallback(),this},i.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,s=o*t._w+n*t._x+r*t._y+i*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var a=1-s*s;if(a<=Number.EPSILON){var u=1-e;return this._w=u*o+e*this._w,this._x=u*n+e*this._x,this._y=u*r+e*this._y,this._z=u*i+e*this._z,this.normalize(),this}var l=Math.sqrt(a),h=Math.atan2(l,s),c=Math.sin((1-e)*h)/l,f=Math.sin(e*h)/l;return this._w=o*c+this._w*f,this._x=n*c+this._x*f,this._y=r*c+this._y*f,this._z=i*c+this._z*f,this._onChangeCallback(),this},i.slerpQuaternions=function(t,e,n){return this.copy(t).slerp(e,n)},i.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),i*Math.sin(e),i*Math.cos(e))},i.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},i.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},i.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},i.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this},i.toJSON=function(){return this.toArray()},i._onChange=function(t){return this._onChangeCallback=t,this},i._onChangeCallback=function(){},e=t,(n=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])&&Xn(e.prototype,n),r&&Xn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Er=new br,Ir=function(){function t(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=n}var e=t.prototype;return e.set=function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Er.setFromAxisAngle(t,e))},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this},e.applyQuaternion=function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,s=t.z,a=t.w,u=a*e+o*r-s*n,l=a*n+s*e-i*r,h=a*r+i*n-o*e,c=-i*e-o*n-s*r;return this.x=u*a+c*-i+l*-s-h*-o,this.y=l*a+c*-o+h*-i-u*-s,this.z=h*a+c*-s+u*-o-l*-i,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function Cr(t){let e,n,r=0,i=1;const o=t.length;for(;i<o;)e=n||t[0],n=t[i],r+=(n[0]-e[0])*(n[1]+e[1]),i++;return r>0}function Sr(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Mr(t,e){const n=e[0],r=e[1],i=e[2],o=Math.sqrt(n*n+r*r+i*i)||1;return t[0]=n/o,t[1]=r/o,t[2]=i/o,t}function Br(t,e,n){const r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2];return t[0]=i*u-o*a,t[1]=o*s-r*u,t[2]=r*a-i*s,t}function Tr(t,e){function n(t,e,n,r){t[0]=e,t[1]=n,t[2]=r}const r=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);let c=0;for(;c<l;){const l=3*t[c],f=3*t[c+1],p=3*t[c+2];n(r,e[l],e[l+1],e[l+2]),n(i,e[f],e[f+1],e[f+2]),n(o,e[p],e[p+1],e[p+2]),Sr(a,o,i),Sr(s,r,i),Br(u,a,s);for(let t=0;t<3;t++)h[l+t]+=u[t],h[f+t]+=u[t],h[p+t]+=u[t];c+=3}let f=0;const p=h.length;for(;f<p;)n(u,h[f],h[f+1],h[f+2]),Mr(u,u),h[f]=u[0]||0,h[f+1]=u[1]||0,h[f+2]=u[2]||0,f+=3;return h}function kr(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let e=0,n=0;for(let r=0,i=t.length;r<i;r++){const{position:i,indices:o}=t[r];e+=i.length,n+=o.length}const r={position:new Float32Array(e),normal:new Float32Array(e),uv:new Float32Array(e/3*2),indices:new Uint32Array(n),results:t};let i=0,o=0,s=0,a=0;for(let e=0,n=t.length;e<n;e++){const{position:n,indices:u,normal:l,uv:h}=t[e];r.position.set(n,i),r.normal.set(l,i),r.uv.set(h,a);let c=0;const f=u.length;for(;c<f;){const t=u[c]+o;r.indices[s]=t,s++,c++}a+=h.length,i+=n.length,o+=n.length/3}return r}function Pr(t){return 180*t/Math.PI}function Lr(t){return t/180*Math.PI}function Rr(t,e,n,r,i,o){const s=3*n,a=3*r,u=3*i,l=3*o,h=e[s],c=e[s+1],f=e[s+2],p=e[a],d=e[a+1],g=e[a+2],y=e[u],v=e[u+1],m=e[u+2],A=e[l],_=e[l+1],x=e[l+2];let w=t.length-1;Math.abs(c-d)<Math.abs(h-p)?(t[++w]=h,t[++w]=1-f,t[++w]=p,t[++w]=1-g,t[++w]=y,t[++w]=1-m,t[++w]=A,t[++w]=1-x):(t[++w]=c,t[++w]=1-f,t[++w]=d,t[++w]=1-g,t[++w]=v,t[++w]=1-m,t[++w]=_,t[++w]=1-x)}function Dr(t,e){e=Object.assign({},{depth:2,top:!0},e);const n=t.map((t=>{for(let e=0,n=t.length;e<n;e++){const n=t[e];Or(n),0===e?Cr(n)||(t[e]=n.reverse()):Cr(n)&&(t[e]=n.reverse()),Nr(n)&&n.splice(n.length-1,1)}const n=function(t,e){const n=function(t){let e=0,n=0;const r=t.length;for(;n<r;)e+=t[n].length,n++;return e}(t),r=t.length,i=[],o=new Float32Array(2*n),s=[],a=[],u=3*n,l=2*n,h=e.depth;let c=0,f=0,p=0;for(let e=0;e<r;e++){const n=t[e];e>0&&i.push(c/2);let r=0;const d=n.length;for(;r<d;){const t=n[r],e=t[0],i=t[1],d=t[2]||0;o[c++]=e,o[c++]=i,s[f]=e,s[f+1]=i,s[f+2]=h+d,s[u+f]=e,s[u+f+1]=i,s[u+f+2]=d,a[p]=e,a[p+1]=i,a[l+p]=e,a[l+p+1]=i,f+=3,p+=2,r++}}return{flatVertices:o,holes:i,points:s,count:n,uv:a}}(t,e);n.polygon=t;return function(t,e,n){const r=[],{count:i}=t,o=n.top;for(let t=0,n=e.length;t<n;t+=3){const s=e[t],a=e[t+1],u=e[t+2];o&&(r[t]=s,r[t+1]=a,r[t+2]=u);let l=n+t;const h=i+s,c=i+a,f=i+u;o||(l=t),r[l]=h,r[l+1]=c,r[l+2]=f}t.indices=r}(n,Kn(n.flatVertices,n.holes,2),e),function(t,e){const{points:n,indices:r,polygon:i,uv:o}=t,s=e.depth;let a=n.length-1,u=r.length-1;for(let t=0,e=i.length;t<e;t++){const e=i[t];let l=0;const h=e.length;for(;l<h;){const t=e[l];let i=e[l+1];l===h-1&&(i=e[0]);const c=n.length/3,f=t[0],p=t[1],d=t[2]||0,g=i[0],y=i[1],v=i[2]||0;n[++a]=f,n[++a]=p,n[++a]=d+s,n[++a]=g,n[++a]=y,n[++a]=v+s,n[++a]=f,n[++a]=p,n[++a]=d,n[++a]=g,n[++a]=y,n[++a]=v;const m=c+2,A=c+3,_=c,x=c+1;r[++u]=m,r[++u]=_,r[++u]=A,r[++u]=_,r[++u]=x,r[++u]=A,Rr(o,n,m,A,_,x),l++}}}(n,e),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=Tr(n.indices,n.position),n})),r=kr(n);return r.polygons=t,r}function Or(t){Nr(t)||t.push(t[0])}function Nr(t){const e=t.length,[n,r]=t[0],[i,o]=t[e-1];return n===i&&r===o}function Fr(t,e){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(e=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},e));const n=t.map((t=>{const n=function(t,e){let n=e.lineWidth/2;e.isSlope&&(n*=2);const r=[],i=[],o=[],s=t.length;let a=0;for(;a<s;){let e=t[a],u=t[a+1];const l=t[a];a===s-1&&(e=t[s-2],u=t[s-1]);const h=u[1]-e[1],c=u[0]-e[0];let f=0;const p=Pr(Math.atan(h/c));if(0===a||a===s-1)f=p,f-=90;else{const n=t[a-1];Ur.x=n[0]-e[0],Ur.y=n[1]-e[1],Qr.x=u[0]-e[0],Qr.y=u[1]-e[1];f=p-Gr(Ur,Qr)/2}const d=Lr(f),g=l,y=[Math.cos(d)+g[0],Math.sin(d)+g[1]],[v,m]=jr(e,u,n);let A=Vr(v[0],v[1],g,y),_=Vr(m[0],m[1],g,y);if(!A||!_){const t=r.length,e=r[t-2],n=r[t-1];if(!e||!n)continue;A=[e[0],e[1]],_=[n[0],n[1]]}A[2]=l[2]||0,_[2]=l[2]||0,r.push(A,_),zr(A,e,u)?(i.push(A),o.push(_)):(i.push(_),o.push(A)),a++}return{offsetPoints:r,leftPoints:i,rightPoints:o,line:t}}(t,e);return n.line=t,function(t,e){const n=e.bottomStickGround,r=e.depth,i=t.depths;let o=r,s=r;i&&(o=i[0],s=i[1]);const{leftPoints:a,rightPoints:u}=t,l=t.line,h=e.pathUV;if(h){!function(t){let e=0;for(let n=0,r=t.length;n<r;n++){const r=t[n],i=t[n+1];if(0===n&&(r.distance=0),r&&i){const[t,n,o]=r,[s,a,u]=i,l=t-s,h=n-a,c=(o||0)-(u||0);e+=Math.sqrt(l*l+h*h+c*c),i.distance=e}}}(l);for(let t=0,e=l.length;t<e;t++)a[t].distance=u[t].distance=l[t].distance}let c=0,f=a.length;const p=[],d=[],g=[];for(;c<f;){const t=3*c,[e,r,i]=a[c];p[t]=e,p[t+1]=r,p[t+2]=o+i;const[d,y,v]=u[c],m=3*f+t;p[m]=d,p[m+1]=y,p[m+2]=s+v;const A=2*f*3+t;p[A]=e,p[A+1]=r,p[A+2]=i,n&&(p[A+2]=0);const _=2*f*3+3*f+t;if(p[_]=d,p[_+1]=y,p[_+2]=v,n&&(p[_+2]=0),h){const t=l[c].distance,e=2*c;g[e]=t,g[e+1]=1;const n=2*f+e;g[n]=t,g[n+1]=0;const r=2*f*2+e;g[r]=t,g[r+1]=1;const i=2*f*2+2*f+e;g[i]=t,g[i+1]=0}c++}if(!h){c=0,f=p.length;let t=g.length-1;for(;c<f;){const e=p[c],n=p[c+1];g[++t]=e,g[++t]=n,c+=3}}c=0,f=a.length;let y=d.length-1;for(;c<f-1;){const t=c,e=c+1,n=t+f,r=e+f;d[++y]=t,d[++y]=n,d[++y]=e,d[++y]=n,d[++y]=r,d[++y]=e;const i=c+2*f,o=i+1,s=i+f,a=o+f;d[++y]=i,d[++y]=s,d[++y]=o,d[++y]=s,d[++y]=a,d[++y]=o,c++}if(t.indices=d,t.points=p,t.uv=g,i)for(f=a.length,c=0;c<f;)a[c].depth=o,u[c].depth=s,c++}(n,e),function(t,e){const{points:n,indices:r,leftPoints:i,rightPoints:o,uv:s}=t,a=e.depth,u=e.bottomStickGround,l=[i,o],h=t.depths,c=e.pathUV,f=e.lineWidth;let p=n.length-1,d=r.length-1,g=s.length-1;function y(t,e){const i=n.length/3,o=h?t.depth:a,l=h?e.depth:a;n[++p]=t[0],n[++p]=t[1],n[++p]=o+t[2],n[++p]=e[0],n[++p]=e[1],n[++p]=l+e[2],n[++p]=t[0],n[++p]=t[1],n[++p]=u?0:t[2],n[++p]=e[0],n[++p]=e[1],n[++p]=u?0:e[2];const y=i+2,v=i+3,m=i,A=i+1;r[++d]=y,r[++d]=m,r[++d]=v,r[++d]=m,r[++d]=A,r[++d]=v,c?(s[++g]=t.distance,s[++g]=o/f,s[++g]=e.distance,s[++g]=l/f,s[++g]=t.distance,s[++g]=0,s[++g]=e.distance,s[++g]=0):Rr(s,n,y,v,m,A)}for(let t=0,e=l.length;t<e;t++){let e=l[t];t>0&&(e=e.map((t=>t)),e=e.reverse());let n=0;const r=e.length-1;for(;n<r;){y(e[n],e[n+1]),n++}}const v=i.length,m=[o[0],i[0],i[v-1],o[v-1]];for(let t=0;t<m.length;t+=2){y(m[t],m[t+1])}}(n,e),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=Tr(n.indices,n.position),n})),r=kr(n);return r.lines=t,r}const Ur={x:0,y:0},Qr={x:0,y:0};const Gr=({x:t,y:e},{x:n,y:r})=>{const i=t*n+e*r,o=t*r-e*n;return(Math.atan2(o,i)/Math.PI*180+360)%360};function zr(t,e,n){const[r,i]=e,[o,s]=n,[a,u]=t;return(i-s)*a+(o-r)*u+r*s-o*i>0}function jr(t,e,n){const r=e[1]-t[1],i=e[0]-t[0],o=Math.atan2(r,i),s=o+Math.PI/2;let a=Math.cos(s)*n,u=Math.sin(s)*n;const l=[t[0]+a,t[1]+u],h=[e[0]+a,e[1]+u],c=o-Math.PI/2;a=Math.cos(c)*n,u=Math.sin(c)*n;return[[l,h],[[t[0]+a,t[1]+u],[e[0]+a,e[1]+u]]]}function Vr(t,e,n,r){const i=e[0]-t[0],o=e[1]-t[1],s=r[0]-n[0],a=r[1]-n[1];if(0===i&&0===s)return null;if(0===o&&0===a)return null;const u=o/i,l=a/s,h=t[1]-u*t[0],c=n[1]-l*n[0];let f,p;return 0===i?(f=t[0],p=l*f+c):0===s?(f=n[0],p=u*f+h):0===o?(p=t[1],f=(p-c)/l):0===a?(p=n[1],f=(p-h)/u):(f=(c-h)/(u-l),p=u*f+h),[f,p]}var qr=function(){function t(){this.pos=new Ir,this.dir=new Ir,this.right=new Ir,this.up=new Ir,this.dist=0,this.widthScale=1,this.sharp=!1}var e=t.prototype;return e.lerpPathPoints=function(t,e,n){this.pos.lerpVectors(t.pos,e.pos,n),this.dir.lerpVectors(t.dir,e.dir,n),this.up.lerpVectors(t.up,e.up,n),this.right.lerpVectors(t.right,e.right,n),this.dist=(e.dist-t.dist)*n+t.dist,this.widthScale=(e.widthScale-t.widthScale)*n+t.widthScale},e.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),Hr=function(){function t(t,e,n,r,i,o,s,a,u,l,h,c,f,p,d,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,r,i,o,s,a,u,l,h,c,f,p,d,g)}var e=t.prototype;return e.set=function(t,e,n,r,i,o,s,a,u,l,h,c,f,p,d,g){var y=this.elements;return y[0]=t,y[4]=e,y[8]=n,y[12]=r,y[1]=i,y[5]=o,y[9]=s,y[13]=a,y[2]=u,y[6]=l,y[10]=h,y[14]=c,y[3]=f,y[7]=p,y[11]=d,y[15]=g,this},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.makeRotationAxis=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,s=t.y,a=t.z,u=i*o,l=i*s;return this.set(u*o+n,u*s-r*a,u*a+r*s,0,u*s+r*a,l*s+n,l*a-r*o,0,u*a-r*s,l*a+r*o,i*a*a+n,0,0,0,0,1),this},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},t}(),Wr=function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var e=t.prototype;return e.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},e.getPointAt=function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},e.getPoints=function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},e.getLength=function(){var t=this.getLengths();return t[t.length-1]},e.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],r=this.getPoint(0),i=0;n.push(0);for(var o=1;o<=t;o++)i+=(e=this.getPoint(o/t)).distanceTo(r),n.push(i),r=e;return this.cacheArcLengths=n,n},e.getUtoTmapping=function(t,e){var n,r=this.getLengths(),i=0,o=r.length;n=e||t*r[o-1];for(var s,a=0,u=o-1;a<=u;)if((s=r[i=Math.floor(a+(u-a)/2)]-n)<0)a=i+1;else{if(!(s>0)){u=i;break}u=i-1}if(r[i=u]===n)return i/(o-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(o-1)},t}();function Yr(t,e,n,r){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}var Xr=function(t){var e,n;function r(e,n,r){var i;return void 0===e&&(e=new Ir),void 0===n&&(n=new Ir),void 0===r&&(r=new Ir),(i=t.call(this)||this).isQuadraticBezierCurve3=!0,i.type="QuadraticBezierCurve3",i.v0=e,i.v1=n,i.v2=r,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,Jn(e,n),r.prototype.getPoint=function(t,e){void 0===e&&(e=new Ir);var n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(Yr(t,r.x,i.x,o.x),Yr(t,r.y,i.y,o.y),Yr(t,r.z,i.z,o.z)),n},r}(Wr),Jr=new Ir,Kr=new Ir,Zr=new Ir,$r=new Hr,ti=new Xr;var ei=function(){function t(){this.array=[],this.count=0}var e=t.prototype;return e.set=function(t,e,n,r,i){if(void 0===e&&(e=.1),void 0===n&&(n=10),void 0===r&&(r=null),void 0===i&&(i=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);i&&!t[0].equals(t[t.length-1])&&t.push((new Ir).copy(t[0]));for(var o=0,s=t.length;o<s;o++)if(0===o)this._start(t[o],t[o+1],r);else if(o===s-1)if(i){this._corner(t[o],t[1],e,n,r);var a=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=a}else this._end(t[o]);else this._corner(t[o],t[o+1],e,n,r)},e.distance=function(){return this.count>0?this.array[this.count-1].dist:0},e._getByIndex=function(t){return this.array[t]||(this.array[t]=new qr),this.array[t]},e._start=function(t,e,n){this.count=0;var r=this._getByIndex(this.count);if(r.pos.copy(t),r.dir.subVectors(e,t),n)r.up.copy(n);else{var i=Number.MAX_VALUE,o=Math.abs(r.dir.x),s=Math.abs(r.dir.y),a=Math.abs(r.dir.z);o<i&&(i=o,r.up.set(1,0,0)),s<i&&(i=s,r.up.set(0,1,0)),a<i&&r.up.set(0,0,1)}r.right.crossVectors(r.dir,r.up).normalize(),r.up.crossVectors(r.right,r.dir).normalize(),r.dist=0,r.widthScale=1,r.sharp=!1,r.dir.normalize(),this.count++},e._end=function(t){var e=this.array[this.count-1],n=this._getByIndex(this.count);n.pos.copy(t),n.dir.subVectors(t,e.pos);var r=n.dir.length();n.dir.normalize(),n.up.copy(e.up);var i=Jr.crossVectors(e.dir,n.dir);if(i.length()>Number.EPSILON){i.normalize();var o=Math.acos(Math.min(Math.max(e.dir.dot(n.dir),-1),1));n.up.applyMatrix4($r.makeRotationAxis(i,o))}n.right.crossVectors(n.dir,n.up).normalize(),n.dist=e.dist+r,n.widthScale=1,n.sharp=!1,this.count++},e._corner=function(t,e,n,r,i){if(n>0&&r>0){for(var o=function(t,e,n,r,i,o){var s=Jr.subVectors(e,t),a=Kr.subVectors(n,e),u=s.length(),l=a.length();s.normalize(),a.normalize();var h=Math.min(.999999*(i?u/2:u),r);o.v0.copy(e).sub(s.multiplyScalar(h)),o.v1.copy(e);var c=Math.min(l/2*.999999,r);return o.v2.copy(e).add(a.multiplyScalar(c)),o}(this.array[this.count-1].pos,t,e,n,this.count-1==0,ti),s=o.getPoints(r),a=0;a<r;a++)this._sharpCorner(s[a],s[a+1],i,0===a?1:0);s[r].equals(e)||this._sharpCorner(s[r],e,i,2)}else this._sharpCorner(t,e,i,0,!0)},e._sharpCorner=function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=this.array[this.count-1],s=this._getByIndex(this.count),a=Jr.subVectors(t,o.pos),u=Kr.subVectors(e,t),l=a.length();if(a.normalize(),u.normalize(),s.pos.copy(t),1===r?s.dir.copy(a):2===r?s.dir.copy(u):(s.dir.addVectors(a,u),s.dir.normalize()),n)1===s.dir.dot(n)?s.right.crossVectors(u,n).normalize():s.right.crossVectors(s.dir,n).normalize(),s.up.crossVectors(s.right,s.dir).normalize();else{s.up.copy(o.up);var h=Zr.crossVectors(o.dir,s.dir);if(h.length()>Number.EPSILON){h.normalize();var c=Math.acos(Math.min(Math.max(o.dir.dot(s.dir),-1),1));s.up.applyMatrix4($r.makeRotationAxis(h,c))}s.right.crossVectors(s.dir,s.up).normalize()}s.dist=o.dist+l;var f=a.dot(u);s.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,s.sharp=Math.abs(f-1)>.05&&i,this.count++},t}();const ni=new Ir(0,0,1),ri=new Ir,ii=new Ir,oi=new Ir,si=new Ir,ai=new Ir,ui=new Ir;function li(t,e){e=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},e);const n=t.map((t=>{const n=function(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n],[i,o,s]=r,a=new Ir(i,o,s||0);e[n]=a}return e}(t),r=new ei;r.set(n,e.cornerRadius,e.cornerSplit,ni);const i=function(t,e){const n=e.lineWidth||.1,r=1,i=n/2,o=n,s=t.distance(),a=r*s;let u=0;const l=[],h=[],c=[],f=[];let p=0;if(0===s)return{position:l,normal:h,uv:c,indices:f,count:u};const d=i/o;let g,y=l.length-1,v=h.length-1,m=c.length-1,A=f.length-1;function _(t){const e=0===l.length,n=t.sharp&&!e,r=t.dist/o,s=t.dir,a=t.up,g=t.right;if(ri.copy(g).multiplyScalar(i*t.widthScale),ii.copy(g).multiplyScalar(-i*t.widthScale),ri.add(t.pos),ii.add(t.pos),n){oi.fromArray(l,l.length-6).sub(ii),si.fromArray(l,l.length-3).sub(ri);const t=oi.length()-si.length();let e,n;t>0?(e=oi,n=ii):(e=si,n=ri),ai.copy(e).setLength(Math.abs(t)).add(n);let i=ui.copy(n).sub(ai).normalize().dot(s)*ui.copy(n).sub(ai).length()*2;ui.copy(s).setLength(i).add(ai),t>0?(l[++y]=ai.x,l[++y]=ai.y,l[++y]=ai.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,l[++y]=ui.x,l[++y]=ui.y,l[++y]=ui.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-4,f[++A]=p-6,f[++A]=p-5,f[++A]=p-2,f[++A]=p-4,f[++A]=p-1,u+=12):(l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ai.x,l[++y]=ai.y,l[++y]=ai.z,l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ui.x,l[++y]=ui.y,l[++y]=ui.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-6,f[++A]=p-5,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=12);for(let t=0;t<6;t++)h[++v]=a.x,h[++v]=a.y,h[++v]=a.z;c[++m]=r-d,c[++m]=0,c[++m]=r-d,c[++m]=1,c[++m]=r,c[++m]=0,c[++m]=r,c[++m]=1,c[++m]=r+d,c[++m]=0,c[++m]=r+d,c[++m]=1}else l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,c[++m]=r,c[++m]=0,c[++m]=r,c[++m]=1,p+=2,e||(f[++A]=p-2,f[++A]=p-4,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=6)}if(a>0)for(let e=0;e<t.count;e++){const n=t.array[e];if(n.dist>a){const r=t.array[e-1];g=new qr;const i=(a-r.dist)/(n.dist-r.dist);g.lerpPathPoints(r,n,i),_(g);break}_(n)}else g=t.array[0];return{position:l,normal:h,uv:c,indices:f,count:u}}(r,e);return{position:new Float32Array(i.position),indices:new Uint32Array(i.indices),uv:new Float32Array(i.uv),normal:new Float32Array(i.normal),line:t,count:i.count}})),r=kr(n);return r.lines=t,r}function hi(t,e,n={}){return void 0===n[t]&&(n[t]=e.distanceToVector3(t,t).x),n[t]}function ci(t,e,n={}){return void 0===n[t]&&(n[t]=e.altitudeToVector3(t,t).x),n[t]}function fi(e=[]){let n=0,r=0;const i=e.length;for(let o=0;o<i;o++){const{coordinate:i,lnglat:s,lnglats:a,xy:u,xys:l}=e[o],h=i||s||a||u||l||e[o];let c,f;Array.isArray(h)?(c=h[0],f=h[1]):h instanceof t.Coordinate&&(c=h.x,f=h.y),n+=c,r+=f}return new t.Coordinate(n/i,r/i)}function pi(t,e,n,r){if(void 0===e||"number"!=typeof e||0===e)return 0;let i;i=t instanceof o.BufferGeometry?t.attributes.position.array:Array.isArray(t)||t instanceof Float32Array?t:t.position;let s=0;if(i){r?(void 0===r[e]&&(r[e]=n.altitudeToVector3(e,e).x),s=r[e]):s=n.altitudeToVector3(e,e).x;const t=i.length;if(i[0]instanceof o.Vector3)for(let e=0;e<t;e++)i[e].z+=s;else for(let e=0;e<t;e+=3)i[e+2]+=s}return s}function di(t){const e=t.length;let n=0;for(let r=0;r<e;r++){const{count:e}=t[r].position;n+=e}return new Float32Array(3*n)}new Ir(0,0,1),new Ir;const gi=new o.Vector3,yi=new Map;function vi(t=[],e){const n=t.length,r=!!e,i=r?3:2,o=new Float64Array(n*i);yi.clear();for(let s=0;s<n;s++){let n,a;const u=t[s];let l;if(u.x?(n=u.x,a=u.y,l=u.z):(n=u[0],a=u[1],l=u[2]),o[s*i]=n,o[s*i+1]=a,l=l||0,r&&0!==l){if(!yi.has(l)){const t=e.altitudeToVector3(l,l,null,gi).x;yi.set(l,t)}o[s*i+2]=yi.get(l)}}return o.buffer}function mi(t){return(zn(t)?t.properties:t.getProperties())||{}}function Ai(t){return(jn(t)?t.properties:t.getProperties())||{}}const _i=new o.Color("#fff"),xi=new o.Color("#fff");function wi(t,e,n,r,i,o){const s=Ei(t,n,r,i,!1);if(!s)return null;o?(null==o[e]&&(o[e]=n.altitudeToVector3(e,e).x),e=o[e]):e=n.altitudeToVector3(e,e).x;const{position:a,normal:u,uv:l,indices:h}=Dr(s,{depth:e});return{position:a,normal:u,uv:l,indices:h}}function bi(t,e,n,r){void 0===r&&(r=0);const i=t.attributes.position.array,s=i.length;let a;if(xi.setStyle(e),_i.setStyle(n),Array.isArray(r)){let t=0;for(let e=0,n=r.length;e<n;e++){const{count:n}=r[e].position;t+=3*n}a=new Float32Array(t)}else a=new Float32Array(i.length);if(Array.isArray(r))for(let t=0,e=r.length;t<e;t++){const{middleZ:e,start:n,end:o}=r[t].position;for(let t=n;t<o;t+=3){i[t+2]>e?(a[t]=_i.r,a[t+1]=_i.g,a[t+2]=_i.b):(a[t]=xi.r,a[t+1]=xi.g,a[t+2]=xi.b)}}else for(let t=0;t<s;t+=3){i[t+2]>r?(a[t]=_i.r,a[t+1]=_i.g,a[t+2]=_i.b):(a[t]=xi.r,a[t+1]=xi.g,a[t+2]=xi.b)}return In(t,"color",new o.BufferAttribute(a,3,!0)),a}function Ei(e,n,r,i,o=!1){if(!e)return null;let s=[];if(e instanceof t.MultiPolygon)s=e.getGeometries().map((t=>Ii(t,n,r||e.getCenter(),i,o)));else if(e instanceof t.Polygon){const t=Ii(e,n,r||e.getCenter(),i,o);s.push(t)}else if(zn(e))if(qn(e)){const t=Yn(e);for(let a=0,u=t.length;a<u;a++)s.push(Ii(t[a],n,r||Wn(e),i,o))}else{const t=Ii(e,n,r||Wn(e),i,o);s.push(t)}return s}function Ii(e,n,r,i,o=!1){let s,a,u;if(zn(e)){const t=Hn(e);s=t[0],a=t.slice(1,t.length),r=r||Wn(e)}else e instanceof t.Polygon&&(s=e.getShell(),a=e.getHoles(),r=r||e.getCenter());i=i||n.coordinateToVector3(r),u=o?n.coordinatiesToGLFloatArray(s,i).positons2d:n.coordinatiesToGLArray(s,i);const l=[o?u.buffer:u];if(a&&a.length>0)for(let t=0,e=a.length;t<e;t++){let e;e=o?n.coordinatiesToGLFloatArray(a[t],i).positons2d:n.coordinatiesToGLArray(a[t],i),l.push(o?e.buffer:e)}return l}function Ci(e){if(!e)return null;let n=[];if(e instanceof t.MultiPolygon)n=e.getGeometries().map((t=>Si(t,!1)));else if(e instanceof t.Polygon){const t=Si(e,!1);n.push(t)}else if(zn(e))if(qn(e)){const t=Yn(e);for(let e=0,r=t.length;e<r;e++)n.push(Si(t[e],!0))}else{const t=Si(e,!0);n.push(t)}return n}function Si(e,n){let r,i;if(n){const t=Hn(e);r=t[0],i=t.slice(1,t.length)}else e instanceof t.Polygon&&(r=e.getShell(),i=e.getHoles());const o=[vi(r)];if(i&&i.length>0)for(let t=0,e=i.length;t<e;t++){const e=vi(i[t]);o.push(e)}return o}const Mi=new Map,Bi=new o.Vector3;function Ti(e,n,r,i=!0){let s,a,u=[];if(Array.isArray(e)&&e[0]instanceof o.Vector3)u=e;else{Array.isArray(e)&&(e=new t.LineString(e));const o=0;let l,h;Gn(e)?(l=Hn(e),r||(h=Wn(e))):e instanceof t.LineString&&(l=e.getCoordinates(),r||(h=e.getCenter()));const c=n.coordinateToVector3(r||h);if(i){Mi.clear();for(let t=0,e=l.length;t<e;t++){const e=l[t],r=e.z||e[2]||0;if(!Mi.has(r)){const t=n.altitudeToVector3(r,r,null,Bi).x;Mi.set(r,t)}const i=n.coordinateToVector3(e,o).sub(c);i.z+=Mi.get(r)||0,u.push(i)}}else{const t=n.coordinatiesToGLFloatArray(l,c,!0);s=t.positions,a=t.positons2d}}if(!i)return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer};a=new Float32Array(2*u.length),s=new Float32Array(3*u.length);for(let t=0,e=u.length;t<e;t++){const e=3*t,n=u[t];s[e]=n.x,s[e+1]=n.y,s[e+2]=n.z;const r=2*t;a[r]=n.x,a[r+1]=n.y}return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer}}function ki(t,e,n,r){const i=[],o=[],s=[];let a,u;for(let n=0,l=t.length;n<l;n++){const l=t[n];for(let t=0,n=l.length;t<n;t++){const n=l[t],h=n.join(",").toString();a?(h!==a&&(u=e.coordinateToVector3(n,0).sub(r),i.push(u.x,u.y,u.z),o.push(u),s.push(n)),a=h):(s.push(n),a=h,u=e.coordinateToVector3(n,0).sub(r),i.push(u.x,u.y,u.z),o.push(u))}}return{positions:i,positionsV:o,lnglats:s}}function Pi(t){let e;const n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];for(let t=0,r=i.length;t<r;t++){const r=i[t],o=r.join(",").toString();e?(o!==e&&n.push(r),e=o):(n.push(r),e=o)}}return n}function Li(t,e=1,n=1,r,i){const o=Ti(t,r,i).positionsV,s=[];for(let t=0,e=o.length;t<e;t++){const e=o[t];s.push([e.x,e.y,e.z])}const{indices:a,position:u,normal:l,uv:h}=Fr([s],{lineWidth:e,depth:n});return{position:u,normal:l,indices:a,uv:h}}function Ri(t,e=1,n=1,r,i){const o=Ti(t,r,i).positionsV,s=[];for(let t=0,e=o.length;t<e;t++){const e=o[t];s.push([e.x,e.y,e.z])}const{indices:a,position:u,normal:l,uv:h}=li([s],{lineWidth:e,cornerRadius:n});return{position:u,normal:l,indices:a,uv:h}}function Di(e){let n,r=[];return e instanceof t.MultiLineString?(r=e.getGeometries(),n=e.getCenter()):e instanceof t.LineString?(r.push(e),n=e.getCenter()):Gn(e)&&(n=Wn(e),qn(e)?r=Yn(e):r.push(e)),{lineStrings:r,center:n}}function Oi(t){const e=new Float32Array(2*t.length-6);let n=0;for(let r=0,i=t.length/3;r<i;r++){const o=t[3*r],s=t[3*r+1],a=t[3*r+2];if(r>0&&r<i-1){const t=3*n;e[t]=o,e[t+1]=s,e[t+2]=a,n++}const u=3*n;e[u]=o,e[u+1]=s,e[u+2]=a,n++}return e}function Ni(t){let e=0;const n=t.length;if(1===n)return t[0];for(let r=0;r<n;r++)e+=t[r].length;const r=new Float32Array(e);let i=0;for(let e=0;e<n;e++)r.set(t[e],i),i+=t[e].length;return r}function Fi(e,n){return e instanceof t.LineString?vi(e.getCoordinates(),n):jn(e)?vi(e.geometry.coordinates,n):void 0}let Ui;function Qi(){return Ui||(Ui=new o.BufferGeometry,In(Ui,"position",new o.BufferAttribute(new Float32Array(3),3))),Ui}let Gi;var zi;function ji(){return t.worker||console.error("maptalks.worker is not defined,You can't use ThreeVectorTileLayer"),!zi&&Gi&&(zi=new Gi("__maptalks.three__")),zi}function Vi(t,e,n={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===n[t]&&(n[t]=e.distanceToVector3(t,t).x),n[t]):0}function qi(t,e,n={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===n[t]&&(n[t]=e.altitudeToVector3(t,t).x),n[t]):0}function Hi(t,e){return e?Object.assign({},e,t):t||{}}function Wi(t,e,n,r,i=[],o){const s=n.isMercator();let a,u,l;if(s){const t=n.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=n.coordinateToVector3(e));const h=[],c=[],f={},p={},d=t.length;for(let a=0;a<d;a++){const u=t[a];let d=i[a]?i[a]:Ai(r[a]);d=Hi(d,o),e||(l=n.coordinateToVector3(d.center));let g=d.width||1,y=d.height||1,v=d.cornerRadius||0,m=d.bottomHeight||0;const A=d.parentCenter;g=Vi(g,n,f),v=Vi(v,n,f),y=qi(y,n,p),m=qi(m,n,p);const _=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];let i;i=s?Fi(r,n):Ti(r,n,A||e,!1).arrayBuffer,c.push(i),_.push(i)}const x={id:d.id,data:_,height:y,width:g,cornerRadius:v,bottomHeight:m};s&&(x.center=[l.x,l.y]),h.push(x)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function Yi(t,e,n,r,i=[],o){const s=n.isMercator();let a,u,l;if(s){const t=n.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=n.coordinateToVector3(e));const h=[],c=[],f={},p=t.length;for(let a=0;a<p;a++){const u=t[a];let p=i[a]?i[a]:Ai(r[a]);p=Hi(p,o),e||(l=n.coordinateToVector3(p.center));let d=p.bottomHeight||0;d=qi(d,n,f);const g=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];if(s){const t=Fi(r,n);c.push(t),g.push(t)}else{const t=Ti(r,n,e,!1).arrayBuffer;c.push(t),g.push(t)}}const y={id:p.id,data:g,bottomHeight:d};s&&(y.center=[l.x,l.y]),h.push(y)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function Xi(t){return t.map((t=>t.data))}function Ji(t){return t.map((t=>t.option||t.baseObject.getOptions()))}t.worker&&(Gi=class extends t.worker.Actor{test(t,e){this.send(t,null,e)}pushQueue(t={}){const{type:e,data:n,callback:r,layer:i,key:o,center:s,lineStrings:a,options:u,id:l,baseOptions:h}=t;let c;e.indexOf("ExtrudePolygon")>-1?c=function(t=[],e,n,r=[],i){const o=n.isMercator();let s,a,u;if(o){const t=n.getMap();s=t.getGLRes(),a=t.getSpatialReference().getTransformation().matrix}e&&(u=n.coordinateToVector3(e));const l=t.length,h=[],c=[],f={};for(let s=0;s<l;s++){const a=t[s],l=a;let p,d=r[s]?r[s]:mi(l);d=Hi(d,i),e||(u=n.coordinateToVector3(d.center)),p=o?Ci(a):Ei(a,n,d.center||e,u,!0);for(let t=0,e=p.length;t<e;t++){const e=p[t];for(let t=0,n=e.length;t<n;t++)c.push(e[t])}let g=d.height||1,y=d.bottomHeight||0;g=qi(g,n,f),y=qi(y,n,f);const v={id:d.id,data:p,height:g,bottomHeight:y};o&&(v.center=[u.x,u.y]),h.push(v),l._properties&&delete l._properties}return{datas:h,transfer:c,glRes:s,matrix:a,center:o?[u.x,u.y]:null}}(n,s,i,u,h):"ExtrudeLines"===e||"Paths"===e?c=Wi(n,s,i,a,u,h):"Point"===e||("Line"===e||"FatLine"===e||"Lines"===e||"FatLines"===e?c=Yi(n,s,i,a,u,h):"ExtrudeLine"===e||"Path"===e?c=Wi(n,s,i,a,u,h):"Bar"!==e&&"Bars"!==e||(c=function(t){const e=t.length,n=new Float32Array(7*e);let r=0;for(let i=0;i<e;i++){let{center:e,radialSegments:o,radius:s,height:a,altitude:u,id:l}=t[i];e=e||[0,0],n[r]=e[0],n[r+1]=e[1],n[r+2]=o||6,n[r+3]=s||1,n[r+4]=a,n[r+5]=u||0,n[r+6]=l,r+=7}const i=n.buffer;return{datas:i,transfer:[i]}}(n))),c?this.send({type:e,datas:c.datas,glRes:c.glRes,matrix:c.matrix,center:c.center},c.transfer,(function(t,e){t&&console.error(t),e.key=o,e.id=l,r(e)})):console.error(`No processing logic found for type:${e}`)}});class Ki{constructor(){this.queueMap={},this.tempQueue=[],this.time=this.getCurrentTime(),this.deQueueCount=5,this.resultQueue=[]}getActor(){return ji()}getCurrentTime(){return t.Util.now()}loop(){this.deQueue()}push(t){return this.tempQueue.push(t),t.id&&(this.queueMap[t.id]=t),this}reset(){return this.time=this.getCurrentTime(),this.tempQueue=[],this}pushResult(t){if(t)return Array.isArray(t)||(t=[t]),t.forEach((t=>{this.resultQueue.push(t)})),this}deQueue(){if(!this.resultQueue.length)return this;const t=this.deQueueCount;return(this.resultQueue.slice(0,t)||[]).forEach((t=>{const{id:e}=t;if(this.queueMap[e]){const{baseObject:n}=this.queueMap[e];if(n&&n._workerLoad){n.getLayer()?n._workerLoad(t):console.warn(n," worker Processing completed but removed from the layer")}delete this.queueMap[e]}})),this.resultQueue.splice(0,t),this}}const Zi=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"ExtrudePolygon",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},$i=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudePolygons",layer:e.layer,data:e.data,key:e.key,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},to=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"ExtrudeLine",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},eo=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudeLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},no=new class extends Ki{constructor(){super(),this.deQueueCount=200}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"Line",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},ro=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Lines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},io=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"FatLine",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},oo=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"FatLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},so=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"Bar",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},ao=new class extends Ki{constructor(){super(),this.deQueueCount=1}loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Bars",layer:e.layer,data:e.data,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},uo=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"Path",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},lo=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Paths",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},ho={isRunning:!1,tasks:[],addTask:t=>{t&&ho.tasks.push(t)},removeTask:t=>{ho.tasks.splice(ho.tasks.indexOf(t),1)},loop(){Zi.loop(),$i.loop(),to.loop(),eo.loop(),no.loop(),ro.loop(),io.loop(),oo.loop(),so.loop(),ao.loop(),uo.loop(),lo.loop(),ho.tasks.forEach((t=>{t&&t.loop&&t.loop()})),t.Util.requestAnimFrame(ho.loop)},star(){ho.isRunning||(ho.isRunning=!0,ho.loop())}};function co(t){const{position:e,normal:n,uv:r,indices:i}=fo(t),s=new o.BufferGeometry,a=new Float32Array(e.length);return a.fill(1,0,e.length),In(s,"color",new o.BufferAttribute(a,3)),In(s,"normal",new o.BufferAttribute(n,3)),In(s,"position",new o.BufferAttribute(e,3)),r&&r.length&&In(s,"uv",new o.BufferAttribute(r,2)),s.setIndex(new o.BufferAttribute(i,1)),s}function fo(t){const e={},n={};for(let r=0;r<t.length;++r){const i=t[r];for(const t in i)void 0===e[t]&&(e[t]=[],n[t]=0),e[t].push(i[t]),n[t]+=i[t].length}const r={};let i=0;const o=new Uint32Array(n.indices);for(const t in e)if("indices"===t){const n=e[t];let r=0;for(let t=0,s=n.length;t<s;t++){const s=n[t];for(let t=0,e=s.length;t<e;t++)o[r]=s[t]+i,r++;i+=e.position[t].length/3}}else{const i=po(e[t],n[t]);if(!i)return null;r[t]=i}return r.indices=o,r}function po(t,e){const n=new Float32Array(e);let r=0;for(let e=0;e<t.length;++e)n.set(t[e],r),r+=t[e].length;return n}function go(t){const{position:e,normal:n,uv:r,indices:i}=t,s=new o.BufferGeometry;return In(s,"normal",new o.BufferAttribute(new Float32Array(n),3)),In(s,"position",new o.BufferAttribute(new Float32Array(e),3)),In(s,"uv",new o.BufferAttribute(new Float32Array(r),2)),s.setIndex(new o.BufferAttribute(new Uint32Array(i),1)),s}function yo(t){const e=new o.BufferGeometry;return In(e,"normal",t.getAttribute("normal")),In(e,"position",t.getAttribute("position").clone()),e.setIndex(t.getIndex()),e}let vo;function mo(){if(!vo){const t=1e-6;vo=Mn(t,t,t)}return vo}mo();const Ao=Mn(1,1,1);Ao.translate(0,0,.5);const _o=new o.Color("#fff"),xo=new o.Color("#fff");function wo(t){const{position:e,normal:n,uv:r,indices:i}=function(t,e){e=Object.assign({},{radius:1,height:2,radialSegments:6},e);const n=Math.round(Math.max(4,e.radialSegments));let{radius:r,height:i}=e;const o=360/n/360*Math.PI*2,s=n+1,a=new Float32Array(3*s*2),[u,l]=t;let h=0,c=0;const f=3*s,p=2*s,d=[],g=[];let y=d.length-1;for(let t=-1;t<n;t++){const e=o*t,n=Math.cos(e)*r+u,s=Math.sin(e)*r+l;a[h]=n,a[h+1]=s,a[h+2]=0,a[h+f]=n,a[h+1+f]=s,a[h+2+f]=i;let v=0,m=0;v=.5+n/r/2,m=.5+s/r/2,g[c]=v,g[c+1]=m,g[c+p]=v,g[c+1+p]=m,h+=3,c+=2,t>1&&(d[++y]=0,d[++y]=t-1,d[++y]=t)}h-=3,a[h]=a[0],a[h+1]=a[1],a[h+2]=a[2];const v=a.length;a[v-3]=a[0],a[v-2]=a[1],a[v-1]=i;const m=d.length;y=d.length-1;for(let t=0;t<m;t++){const e=d[t];d[++y]=e+s}const A=new Float32Array(2*(3*s*2-6));let _=-1;h=2*s,c=0,y=d.length-1;let x=g.length-1;for(let t=0,e=a.length/2;t<e-3;t+=3){const e=a[t],n=a[t+1],o=a[t+3],u=a[t+4];A[++_]=e,A[++_]=n,A[++_]=i,A[++_]=o,A[++_]=u,A[++_]=i,A[++_]=e,A[++_]=n,A[++_]=0,A[++_]=o,A[++_]=u,A[++_]=0;const l=h+2,f=h+3,p=h,v=h+1;d[++y]=p,d[++y]=l,d[++y]=v,d[++y]=l,d[++y]=f,d[++y]=v,h+=4;const m=c/s,w=(c+1)/s;g[++x]=m,g[++x]=i/r/2,g[++x]=w,g[++x]=i/r/2,g[++x]=m,g[++x]=0,g[++x]=w,g[++x]=0,c++}const w=new Float32Array(a.length+A.length);w.set(a,0),w.set(A,a.length);const b=Tr(d,w);return{points:a,indices:new Uint32Array(d),position:w,normal:b,uv:new Float32Array(g)}}(t.center||[0,0],t),s=new o.BufferGeometry;return In(s,"normal",new o.BufferAttribute(n,3)),In(s,"position",new o.BufferAttribute(e,3)),In(s,"uv",new o.BufferAttribute(r,2)),s.setIndex(new o.BufferAttribute(i,1)),s}function bo(t){const e=Object.assign({},t);return e._radius&&(e.radius=e._radius),wo(e)}function Eo(t,e,n,r="y",i=0){let s=0;"y"===r?s=1:"z"===r&&(s=2);const a=t.attributes.position.array,u=a.length;xo.setStyle(e),_o.setStyle(n);const l=new Float32Array(u);if(Array.isArray(i))for(let t=0,e=i.length;t<e;t++){const{middleZ:e,start:n,end:r}=i[t].position;for(let t=n;t<r;t+=3){a[t+2]>e?(l[t]=_o.r,l[t+1]=_o.g,l[t+2]=_o.b):(l[t]=xo.r,l[t+1]=xo.g,l[t+2]=xo.b)}}else for(let t=0;t<u;t+=3){a[t+s]>i?(l[t]=_o.r,l[t+1]=_o.g,l[t+2]=_o.b):(l[t]=xo.r,l[t+1]=xo.g,l[t+2]=xo.b)}return In(t,"color",new o.BufferAttribute(l,3,!0)),l}function Io(t){const e=[],n=t.length;let r=0;for(let e=0;e<n;e++){const{color:n}=t[e].attributes;n&&(r+=n.array.length)}const i=new Float32Array(r);let s=0;for(let n=0,r=t.length;n<r;n++){const{color:r,normal:o,position:a,uv:u}=t[n].attributes,l=t[n].index;r&&(i.set(r.array,s),s+=r.array.length),e.push({normal:o.array,uv:u.array,position:a.array,indices:l.array})}const a=co(e);i.length&&In(a,"color",new o.BufferAttribute(i,3,!0));for(let e=0,n=t.length;e<n;e++)t[e].dispose();return a}function Co(){return Ao}const So={radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class Mo extends Fn{constructor(e,n,r,i){n=t.Util.extend({},So,n,{layer:i,coordinate:e}),super(),this._initOptions(n);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l,asynchronous:h}=n;let c;if(n.height=i.altitudeToVector3(o,o).x,n.radius=i.distanceToVector3(s,s).x,h){c=mo();const e=t.Util.GUID();this.getOptions().id=e,so.push({data:{radius:n.radius,height:n.height,radialSegments:n.radialSegments,id:e},layer:i,id:e,baseObject:this})}else c=bo(n),a&&(Eo(c,u,a,"z",n.height/2),r.vertexColors=Sn());this._createMesh(c,r);const f=i.altitudeToVector3(l,l).x,p=i.coordinateToVector3(e,f);this.getObject3d().position.copy(p),this.type="Bar"}_workerLoad(t){const e=go(t),{topColor:n,bottomColor:r,height:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(n){Eo(e,r,n,"z",this.getLayer().altitudeToVector3(i,i).x/2),s.vertexColors=Sn()}o.geometry=e,o.material.needsUpdate=!0,this._fire("workerload",{target:this})}}function Bo(t){const e=[];return t&&t.length&&t.forEach((t=>{t=t instanceof o.Color?t:new o.Color(t),e.push(t.r,t.g,t.b)})),e}const To={altitude:0,bottomHeight:0,colors:null};class ko extends Fn{constructor(e,n,r,i){n=t.Util.extend({},To,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{lineStrings:s,center:a}=Di(e),{asynchronous:u}=n;let l;if(u){l=Qi();const r=t.Util.GUID();this.getOptions().id=r,this.getOptions().center=a,no.push({id:r,data:s,layer:i,key:n.key,lineString:e,baseObject:this})}else{const t=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],{positions:r}=Ti(n,i,a,!1);t.push(Oi(r))}const e=Ni(t);l=new o.BufferGeometry,In(l,"position",new o.BufferAttribute(e,3)),pi(l,n.bottomHeight,i);const u=Bo(n.colors);u&&u.length&&(In(l,"color",new o.Float32BufferAttribute(u,3)),r.vertexColors=Sn())}this._createLineSegments(l,r);const{altitude:h}=n,c=i.altitudeToVector3(h,h).x,f=i.coordinateToVector3(a,c);this.getObject3d().position.copy(f),this.type="Line"}_workerLoad(t){const e=new o.BufferGeometry;In(e,"position",new o.BufferAttribute(new Float32Array(t.position),3));const n=Bo(this.getOptions().colors),r=this.getObject3d(),i=r.material;n&&n.length&&(In(e,"color",new o.Float32BufferAttribute(n,3)),i.vertexColors=Sn()),this._computeLineDistances(e),r.geometry=e,r.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Po={bottomHeight:0,width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class Lo extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Po,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{height:o,width:s,bottomColor:a,topColor:u,bottomHeight:l,altitude:h,asynchronous:c}=n,f=i.altitudeToVector3(o,o).x,p=i.distanceToVector3(s,s).x,{lineStrings:d,center:g}=Di(e);let y;if(c){y=mo();const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=g,to.push({id:n,data:d,layer:i,center:g,lineString:e,baseObject:this})}else{const t=[];let e=0;const n={};for(let r=0,o=d.length;r<o;r++){const o=Li(d[r],p,f,i,g);e=pi(o,l,i,n),t.push(o)}y=co(t),u&&(bi(y,a,u,e+f/2),r.vertexColors=Sn())}this._createMesh(y,r);const v=i.altitudeToVector3(h,h).x,m=i.coordinateToVector3(g,v);this.getObject3d().position.copy(m),this.type="ExtrudeLine"}_workerLoad(t){const e=go(t),{topColor:n,bottomColor:r,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(n){const t=this.getLayer();bi(e,r,n,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=Sn()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Ro={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class Do extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Ro,n,{layer:i,polygon:e}),super(),this._initOptions(n);const{height:s,topColor:a,bottomColor:u,altitude:l,bottomHeight:h,asynchronous:c}=n;let f;const p=zn(e)?Wn(e):e.getCenter();if(c){f=mo();const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=p,Zi.push({data:e,layer:i,id:n,baseObject:this})}else{f=function(t,e,n,r){const{position:i,normal:s,uv:a,indices:u}=wi(t,e,n,r),l=new Float32Array(i.length);l.fill(1,0,i.length);const h=new o.BufferGeometry;return In(h,"color",new o.BufferAttribute(l,3)),In(h,"normal",new o.BufferAttribute(s,3)),In(h,"position",new o.BufferAttribute(i,3)),In(h,"uv",new o.BufferAttribute(a,2)),h.setIndex(new o.BufferAttribute(u,1)),h}(e,s,i);const t=pi(f,h,i);if(a){bi(f,u,a,t+i.altitudeToVector3(s,s).x/2),r.vertexColors=Sn()}}this._createMesh(f,r);const d=i.altitudeToVector3(l,l).x,g=i.coordinateToVector3(p,d);this.getObject3d().position.copy(g),this.type="ExtrudePolygon"}_workerLoad(t){const e=go(t),{topColor:n,bottomColor:r,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(n){const t=this.getLayer();bi(e,r,n,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=Sn()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Oo={altitude:0,coordinate:null};class No extends Fn{constructor(e,n={},r){n.coordinate||(console.warn("coordinate is null,it is important to locate the model"),n.coordinate=r.getMap().getCenter()),n=t.Util.extend({},Oo,n,{layer:r,model:e}),super(),this._initOptions(n),this._createGroup(),this.getObject3d().add(e);const{altitude:i,coordinate:o}=n,s=r.altitudeToVector3(i,i).x,a=r.coordinateToVector3(o,s);this.getObject3d().position.copy(a),this.type="Model"}getCoordinates(){const e=this.options.coordinate,n=this.options.altitude,r=new t.Coordinate(e);return r.z=n,r}}const Fo=Math.PI/180;function Uo(t){return t*Fo}function Qo(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());let n=Uo(t[1]);const r=Uo(e[1]),i=n-r,o=Uo(t[0])-Uo(e[0]);return n=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(n)*Math.cos(r)*Math.pow(Math.sin(o/2),2))),n*=6378137,Math.round(1e5*n)/1e5}function Go(t,e){const{len:n,c1:r,c2:i}=t,o=i[0]-r[0],s=i[1]-r[1],a=e/n;return[r[0]+a*o,r[1]+a*s]}const zo=1e3;const jo={trail:5,chunkLength:50,width:2,height:1,speed:1,altitude:0,interactive:!1,heightEnable:!0};class Vo extends Fn{constructor(e,n,r,i){n=t.Util.extend({},jo,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{width:s,height:a,altitude:u,speed:l,chunkLength:h,trail:c}=n;let f,p;Gn(e)?(f=Wn(e),p=Hn(e)):(f=e.getCenter(),p=e);const d=function(t,e=10){e=Math.max(e,.1),Array.isArray(t)||(t=t.getCoordinates().map((t=>t.toArray())));const n=t.length;let r=[],i=0;for(let e=0;e<n-1;e++){const n=Qo(t[e],t[e+1]),o=Math.floor(n);r.push({c1:t[e],len:o,c2:t[e+1]}),i+=o}if(i<=e)return r.map((t=>[t.c1,t.c2]));if(1===r.length&&r[0].len<=e)return[[r[0].c1,r[0].c2]];const o=r.length;let s,a=0,u=0;const l=[];let h=[r[0].c1];for(;a<o;){const{len:t,c2:n}=r[a];if(u+=t,u<e&&(h.push(n),a===o-1&&l.push(h),a++),u===e&&(h.push(n),u=0,l.push(h),h=[n],a++),u>e){const n=t-u+e;s=Go(r[a],n),h.push(s),l.push(h),u=0,r[a].c1=s,r[a].len=t-n,h=[],h.push(s)}}return l}(p,h),g=i.coordinateToVector3(f),y=new o.BufferGeometry,v=new Float32Array(3e3),m=new Float32Array(3e3),A=new Uint16Array(zo);In(y,"position",new o.BufferAttribute(v,3)),In(y,"normal",new o.BufferAttribute(m,3)),y.setIndex(new o.BufferAttribute(A,1));const _=i.distanceToVector3(s,s).x,x=i.altitudeToVector3(a,a).x;this._createMesh(y,r);const w=i.altitudeToVector3(u,u).x,b=i.coordinateToVector3(f,w);this.getObject3d().position.copy(b),this._params={index:0,chunkLines:d,geometries:[],layer:i,trail:Math.max(1,c),lineWidth:_,depth:x,speed:Math.min(1,l),idx:0,loaded:!0,center:f,centerPt:g,workerInitCount:0},this._init(this._params),this.type="ExtrudeLineTrail"}_init(e){const{layer:n,trail:r,lineWidth:i,depth:o,chunkLines:s,positionMap:a,centerPt:u,center:l}=e,h=s.length,c=[];if(this.options.asynchronous){e.loaded=!1;const i=t.Util.GUID();for(let e=0;e<h;e++){const o={type:"Feature",geometry:{type:"LineString",coordinates:Pi(s.slice(e,e+r))}},a=`${i}-${e}`,u=t.Util.extend({},this.options);u.parentCenter=l,u.id=a,u.center=l,to.push({id:a,data:[o],layer:n,center:l,lineString:o,baseObject:this,option:u})}}else for(let t=0;t<h;t++){const e=ki(s.slice(t,t+r),n,0,u).positionsV;c.push(Li(e,i,o,n))}}_animation(){const{index:t,geometries:e,speed:n,idx:r,chunkLines:i,trail:o,lineWidth:s,depth:a,loaded:u,layer:l,positionMap:h,centerPt:c}=this._params;if(!u)return;const f=Math.round(t);if(f>r&&f<=i.length-1){this._params.idx++;let t=e[f];if(!t){t=Li(ki(i.slice(f,f+o),l,0,c).positionsV,s,a,l),e[f]=t}const n=this.getObject3d();!function(t,e,n,r){const i=e.length;t.attributes.normal.count=i,t.attributes.position.count=i;const o=t.attributes.position.array,s=t.attributes.normal.array;for(let t=0;t<i;t++)o[t]=e[t],s[t]=n[t];t.index.count=r.length;for(let e=0,n=r.length;e<n;e++)t.index.array[e]=r[e]}(n.geometry,t.position,t.normal,t.indices),n.geometry.attributes.position.needsUpdate=!0,n.geometry.attributes.normal.needsUpdate=!0,n.geometry.index.needsUpdate=!0}t>=i.length-1&&(this._params.index=-1,this._params.idx=-1),this._params.index+=n}_workerLoad(e){if(!e)return this;const{id:n,indices:r,position:i,normal:o,uv:s}=e;if(!(n&&r&&i&&o&&s))return;let a=n.split("-")[1];if(a=parseInt(a),t.Util.isNumber(a)){this._params.geometries[a]={indices:new Uint32Array(r),position:new Float32Array(i),uv:new Float32Array(s),normal:new Float32Array(o)},this._params.workerInitCount++}this._params.workerInitCount===this._params.chunkLines.length&&(this._params.loaded=!0,this._fire("workerload",{target:this}))}}const qo=["click","mousemove","mousedown","mouseup","dblclick","contextmenu"].join(" ").toString(),Ho=new o.MeshBasicMaterial;Ho.vertexColors=Sn();const Wo=t=>class extends t{_initBaseObjectsEvent(t){if(t&&Array.isArray(t)&&t.length)for(let e=0,n=t.length;e<n;e++){const n=t[e];this._proxyEvent(n)}return this}_proxyEvent(t){t.on("add",(t=>{this._showGeometry(t.target,!0)})),t.on("remove",(t=>{this._showGeometry(t.target,!1)})),t.on("mouseout",(t=>{this._mouseover=!1,this.fire("mouseout",Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))})),t.on(qo,(t=>{this.fire(t.type,Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))}))}_getHideGeometryIndex(t){const e=[];let n=0;for(let r=0,i=this._geometriesAttributes.length;r<i;r++)!0===this._geometriesAttributes[r].hide&&(e.push(r),n+=this._geometriesAttributes[r][t].count);return{indexs:e,count:n}}_updateAttribute(t,e){const{indexs:n}=this._getHideGeometryIndex(e),r=this._geometryCache.attributes[e].array,i=r.length;for(let e=0;e<i;e++)t.array[e]=r[e];let s=NaN;this.getObject3d()instanceof o.LineSegments&&(s=0);for(let r=0;r<n.length;r++){const i=n[r],{start:o,end:a}=this._geometriesAttributes[i][e];for(let e=o;e<a;e++)t.array[e]=s}return this}_showGeometry(t,e){let n;if(t&&(n=t.getOptions().index),null!=n){const t=this._geometriesAttributes[n],{hide:r}=t;if(r===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.position,"position"),i.attributes.position.needsUpdate=!0,this.isHide=e}return this}getSelectMesh(){const t=this._getIndex();if(null!=t)return{data:this._datas[t],baseObject:this._baseObjects[t]}}_getIndex(t){return null==t&&(t=this.faceIndex||this.index),t}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:n}=this,r=n.length,i=di(n);let s=0;for(let t=0;t<r;t++){const r=e.getColor(),o=r.getHex();this._colorMap[o]=t;const{count:a}=n[t].position;this._datas[t].colorIndex=o;for(let t=0;t<a;t++)i[s]=r.r,i[s+1]=r.g,i[s+2]=r.b,s+=3}In(t,"color",new o.BufferAttribute(i,3,!0));const a=e.getColor().getHex(),u=new o.Mesh(t,Ho);u.position.copy(this.getObject3d().position),u._colorIndex=a,this.setPickObject3d(u)}},Yo={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61"},Xo=new t.Coordinate(0,0);class Jo extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=e.length;0===o&&console.error("polygons is empty");let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let n=0;n<o;n++){const r=e[n],i=r.getCenter?r.getCenter():Wn(r,Xo);let o,h;Array.isArray(i)?(o=i[0],h=i[1]):i instanceof t.Coordinate&&(o=i.x,h=i.y),s=Math.min(s,o),a=Math.min(a,h),u=Math.max(u,o),l=Math.max(l,h)}const h=new t.Coordinate((s+u)/2,(a+l)/2);n=t.Util.extend({},Yo,n,{layer:i,polygons:e,coordinate:h});const{topColor:c,bottomColor:f,altitude:p,asynchronous:d}=n;let g;const y=[],v=[];if(super(),d)g=mo(),$i.push({id:t.Util.GUID(),layer:i,key:n.key,center:h,data:e,baseObject:this,option:n});else{const s=i.coordinateToVector3(h),a=[];let u=0;const l={};for(let r=0;r<o;r++){const o=e[r],c=t.Util.extend({},n,mi(o)),f=c.height||1,p=c.bottomHeight||0,d=wi(o,f,i,h,s,l);a.push(d);const g=pi(d,p,i,l),{position:y,normal:m,uv:A,indices:_}=d;_.length;const x=y.length/3;m.length,A.length,v[r]={position:{middleZ:g+l[f]/2,count:x,start:u,end:u+3*x},hide:!1},u+=3*x}g=co(a),c&&(bi(g,f,c,v),r.vertexColors=Sn())}this._initOptions(n),this._createMesh(g,r);const m=i.altitudeToVector3(p,p).x,A=i.coordinateToVector3(h,m);this.getObject3d().position.copy(A),this._baseObjects=y,this._datas=e,this._geometriesAttributes=v,this.faceIndex=null,this._geometryCache=yo(g),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(y),d||(this._setPickObject3d(),this._init()),this.type="ExtrudePolygons"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,zn(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new Do(e,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);this._geometryCache=yo(n);const{topColor:r,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(r&&(bi(n,i,r,e),s.vertexColors=Sn()),o.geometry=n,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}function Ko(t,e,n){const r=t.project(n),i=e.width/2,o=e.height/2;return{x:Math.round(r.x*i+i),y:Math.round(-r.y*o+o)}}const Zo={altitude:0,height:0,color:null},$o=new o.Vector3;class ts extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Zo,n,{layer:i,coordinate:e}),super();let{height:s,altitude:a,color:u,size:l}=n;const h=[],c=[];u&&(u=u instanceof o.Color?u:new o.Color(u),c.push(u.r,u.g,u.b));const f=i.altitudeToVector3(s,s).x,p=i.coordinateToVector3(e,f);h.push(0,0,p.z);const d=new o.BufferGeometry;In(d,"position",new o.Float32BufferAttribute(h,3,!0)),c.length&&In(d,"color",new o.Float32BufferAttribute(c,3,!0)),void 0!==l&&In(d,"size",new o.Float32BufferAttribute([l],1,!0)),n.positions=p,this._initOptions(n),this._createPoints(d,r);const g=i.altitudeToVector3(a,a).x,y=new o.Vector3(p.x,p.y,g);this.getObject3d().position.copy(y),this.type="Point"}identify(t){const e=this.getLayer(),n=this.getMap().getSize(),r=this.getLayer().getCamera(),i=this.getOptions().positions,o=this.getOptions().altitude;let s=this.getObject3d().material.size;void 0===s&&(s=this.options.size||1);const a=this.getMap().coordToContainerPoint(t),u=e.altitudeToVector3(o,o).x;$o.x=i.x,$o.y=i.y,$o.z=i.z+u;const l=Ko($o,n,r);return Math.sqrt(Math.pow(a.x-l.x,2)+Math.pow(a.y-l.y,2))<=s/2}}function es(t,e){const{minx:n,miny:r,maxx:i,maxy:o}=t,[s,a]=e;return n<=s&&s<=i&&r<=a&&a<=o}class ns{constructor(t,e,n,r){this.minlng=t,this.minlat=e,this.maxlng=n,this.maxlat=r,this.minx=1/0,this.miny=1/0,this.maxx=-1/0,this.maxy=-1/0,this.coordinates=[],this.positions=[],this.indexs=[],this.key=null}updateBBoxPixel(e){let n=1/0,r=1/0,i=-1/0,o=-1/0;const{minlng:s,minlat:a,maxlng:u,maxlat:l}=this;return[[s,a],[s,l],[u,a],[u,l]].map((e=>new t.Coordinate(e))).map((t=>e.coordToContainerPoint(t))).forEach((t=>{n=Math.min(n,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y)})),this.minx=n,this.miny=r,this.maxx=i,this.maxy=o,this}containsCoordinate(e){let n,r;Array.isArray(e)?(n=e[0],r=e[1]):e instanceof t.Coordinate&&(n=e.x,r=e.y);const{minlng:i,minlat:o,maxlng:s,maxlat:a}=this;return i<=n&&n<=s&&o<=r&&r<=a}isRecCross(t,e){const{x:n,y:r}=t,i={minx:n-e/2,miny:r-e/2,maxx:n+e/2,maxy:r+e/2},{minx:o,miny:s,maxx:a,maxy:u}=i;return!!(es(this,[o,s])||es(this,[o,u])||es(this,[a,s])||es(this,[a,u])||es(i,[this.minx,this.miny])||es(i,[this.minx,this.maxy])||es(i,[this.maxx,this.miny])||es(i,[this.maxx,this.maxy]))}static initGrids(t,e,n,r){const i=[],o=(n-t)/30,s=(r-e)/30;let a=t,u=e;for(let n=0;n<30;n++){a=t+n*o;for(let t=0;t<30;t++){u=e+t*s;const r=new ns(a,u,a+o,u+s);r.key=t+"-"+n,i.push(r)}}return{grids:i,averageX:o,averageY:s,ROWS:30,COLS:30}}}const rs={altitude:0},is=new o.Vector3;function os(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}class ss extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]),n=t.Util.extend({},rs,n,{layer:i,points:e});let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let n=0,r=e.length;n<r;n++){const{coordinate:r}=e[n];let i,o;Array.isArray(r)?(i=r[0],o=r[1]):r instanceof t.Coordinate&&(i=r.x,o=r.y),e[n].coords=[i,o],s=Math.min(s,i),a=Math.min(a,o),u=Math.max(u,i),l=Math.max(l,o)}const h=i.coordinateToVector3([(s+u)/2,(a+l)/2]),{grids:c,averageX:f,averageY:p,ROWS:d,COLS:g}=ns.initGrids(s,a,u,l);c.length;const y=new Float32Array(3*e.length),v=[],m=new Float32Array(3*e.length),A=new Float32Array(e.length),_=[],x=[],w={};let b=0,E=!1,I=!1;const C=new o.Vector3(0,0,0);for(let t=0,n=e.length;t<n;t++){let{coordinate:n,height:r,color:u,size:l,coords:g}=e[t];const _=3*t;u&&(E=!0,u=u instanceof o.Color?u:new o.Color(u),m[_]=u.r,m[_+1]=u.g,m[_+2]=u.b),l&&(I=!0,A[t]=l,b=Math.max(b,l));const S=ci(r,i,w),M=i.coordinateToVector3(n,S);C.x=M.x,C.y=M.y,C.z=M.z,C.sub(h),y[_]=C.x,y[_+1]=C.y,y[_+2]=C.z,v.push(M),x[t]={position:{count:1,start:3*t,end:3*t+3},hide:!1};let B=os((g[1]-a)/p,4),T=os((g[0]-s)/f,4);B-=1,T-=1,B=Math.max(0,B),T=Math.max(0,T),B=Math.ceil(B),T=Math.ceil(T);const k=T*d+B;c[k]&&(c[k].positions.push(M),c[k].indexs.push(t))}const S=new o.BufferGeometry;In(S,"position",new o.BufferAttribute(y,3,!0)),E&&In(S,"color",new o.BufferAttribute(m,3,!0)),I&&In(S,"size",new o.BufferAttribute(A,1,!0)),n.positions=v,super(),this._initOptions(n),this._createPoints(S,r);const M=n.altitude,B=i.altitudeToVector3(M,M).x,T=h.clone();T.z=B,this.getObject3d().position.copy(T),this._baseObjects=_,this._datas=e,this.faceIndex=null,this._geometriesAttributes=x,this._geometryCache=S.clone(),this.isHide=!1,this._initBaseObjectsEvent(_),this._grids=c,this._bindMapEvents(),this.type="Points",this.maxSize=b}_bindMapEvents(){const t=this.getMap(),e="zoomstart zooming zoomend movestart moving moveend pitch rotate";this.on("add",(()=>{this._updateGrids(),t.on(e,this._updateGrids,this)})),this.on("remove",(()=>{t.off(e,this._updateGrids,this)}))}_updateGrids(){const t=this.getMap();this._grids.forEach((e=>{e.indexs.length&&e.updateBBoxPixel(t)}))}getSelectMesh(){const t=this.faceIndex;if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],{coordinate:n,height:r,color:i,size:o}=e;this._baseObjects[t]=new ts(n,{height:r,index:t,color:i,size:o},this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){const e=this.getLayer(),n=this.getMap().getSize(),r=this.getLayer().getCamera(),i=this.getOptions().altitude,o=this.getMap(),s=e.altitudeToVector3(i,i).x;let a=this.getObject3d().material.size;const u=void 0===a,l=o.coordToContainerPoint(t),h=[];if(this._grids.forEach((t=>{t.indexs.length&&t.isRecCross(l,u?this.maxSize:a)&&h.push(t)})),h.length<1)return!1;for(let t=0,e=h.length;t<e;t++)for(let e=h[t].positions.length-1;e>=0;e--){u&&(a=this._datas[h[t].indexs[e]].size||1);const i=h[t].positions[e];is.x=i.x,is.y=i.y,is.z=i.z+s;const o=Ko(is,n,r);if(Math.sqrt(Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2))<=a/2)return this.faceIndex=h[t].indexs[e],!0}return!1}}const as={coordinate:"",radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61"};class us extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const s=e.length,a=fi(e),u=i.coordinateToVector3(a),l=[],h=[],c=[];let f=0;const p={},d={};let g;super(),n=t.Util.extend({},{altitude:0,layer:i,points:e},as,n),this._initOptions(n);const y=new o.Vector3;if(n.asynchronous){g=mo();const r=t.Util.GUID();this.getOptions().id=r;const o=[];for(let r=0;r<s;r++){const s=t.Util.extend({index:r},n,e[r]),{radius:a,radialSegments:l,altitude:h,height:c,coordinate:f}=s,g=hi(a,i,p);e[r]._radius=g;const v=ci(c,i,d),m=ci(h,i,d),A=i.coordinateToVector3(f,0,y).sub(u);o.push({radialSegments:l,radius:g,height:v,center:[A.x,A.y],altitude:m})}ao.push({id:r,data:o,layer:i,baseObject:this})}else{for(let o=0;o<s;o++){const s=t.Util.extend({index:o},n,e[o]),{radius:a,radialSegments:g,altitude:v,topColor:m,bottomColor:A,height:_,coordinate:x}=s,w=hi(a,i,p),b=ci(_,i,d),E=ci(v,i,d),I=i.coordinateToVector3(x,0,y).sub(u),C=bo({radius:w,height:b,radialSegments:g,center:[I.x,I.y]});m&&(Eo(C,A,m,"z",b/2),r.vertexColors=Sn());const S=C.attributes.position.array;for(let t=0,e=S.length;t<e;t+=3)S[t+2]+=E;l.push(C);const M=new Mo(x,s,r,i);h.push(M),C.index.count;const B=C.attributes.position.count;C.attributes.normal.count,C.attributes.uv.count,c[o]={position:{count:B,start:f,end:f+3*B},hide:!1},f+=3*B}g=Io(l)}this._createMesh(g,r);const v=n.altitude,m=i.altitudeToVector3(v,v).x,A=u.clone();A.z=m,this.getObject3d().position.copy(A),this._baseObjects=h,this._datas=e,this._geometriesAttributes=c,this.faceIndex=null,this._geometryCache=yo(g),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(h),n.asynchronous||(this._setPickObject3d(),this._init()),this.type="Bars"}identify(){return this.picked}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,e,{index:t,asynchronous:!1});this._baseObjects[t]=new Mo(e.coordinate,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);this._geometryCache=yo(n);const{topColor:r,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(r&&(Eo(n,i,r,"z",e),s.vertexColors=Sn()),o.geometry=n,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const ls={width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61"};class hs extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=[],s=[],a=e.length;for(let t=0;t<a;t++){const n=Di(e[t]);o.push(n.center),s.push(n.lineStrings)}const u=fi(o);n=t.Util.extend({},ls,n,{layer:i,lineStrings:e,coordinate:u});const{altitude:l,topColor:h,bottomColor:c,asynchronous:f}=n;let p;const d=[],g=[];if(super(),f)p=mo(),eo.push({id:t.Util.GUID(),layer:i,key:n.key,center:u,data:s,lineStrings:e,baseObject:this,option:n});else{const o=[];let l=0;const f={},d={};for(let r=0;r<a;r++){const a=e[r],h=t.Util.extend({},n,Ai(a),{index:r}),{height:c,width:p,bottomHeight:y}=h,v=hi(p,i,f),m=ci(c,i,d),A=s[r],_=[];let x=0;for(let t=0,e=A.length;t<e;t++){const e=Li(A[t],v,m,i,u);x=pi(e,y,i,f),_.push(e)}const w=fo(_);o.push(w);const{position:b,normal:E,indices:I}=w;I.length;const C=b.length/3;E.length,g[r]={position:{middleZ:x+m/2,count:C,start:l,end:l+3*C},hide:!1},l+=3*C}p=co(o),h&&(bi(p,c,h,g),r.vertexColors=Sn())}this._initOptions(n),this._createMesh(p,r);const y=i.altitudeToVector3(l,l).x,v=i.coordinateToVector3(u,y);this.getObject3d().position.copy(v),this._baseObjects=d,this._datas=e,this._geometriesAttributes=g,this.faceIndex=null,this._geometryCache=yo(p),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(d),f||(this._setPickObject3d(),this._init()),this.type="ExtrudeLines"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,jn(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new Lo(e,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);this._geometryCache=yo(n);const{topColor:r,bottomColor:i,bottomHeight:o,height:s}=this.getOptions(),a=this.getObject3d().material;if(r&&(bi(n,i,r,e),a.vertexColors=Sn()),this.getObject3d().geometry=n,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const cs={altitude:0,colors:null};class fs extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const s=[],a=[],u=e.length;for(let t=0;t<u;t++){const n=Di(e[t]);s.push(n.center),a.push(n.lineStrings)}const l=fi(s);n=t.Util.extend({},cs,n,{layer:i,lineStrings:e,coordinate:l}),super(),this._initOptions(n);const{asynchronous:h}=n;let c;const f=[],p={};let d=[],g=0,y=[];if(h)c=Qi(),ro.push({id:t.Util.GUID(),layer:i,key:n.key,center:l,data:a,lineStrings:e,baseObject:this,option:n});else{for(let e=0;e<u;e++){const r=a[e];let o=0;for(let e=0,s=r.length;e<s;e++){const s=Ai(r[e]),a=t.Util.extend({},n,s),{positions:u}=Ti(r[e],i,l,!1);pi(u,a.bottomHeight,i,p),o+=u.length/3*2-2,y.push(Oi(u))}d[e]={position:{count:o,start:g,end:g+3*o},hide:!1},g+=3*o}const e=Ni(y);c=new o.BufferGeometry,In(c,"position",new o.BufferAttribute(e,3))}this._createLineSegments(c,r);const{altitude:v}=n,m=i.altitudeToVector3(v,v).x,A=i.coordinateToVector3(l,m);this.getObject3d().position.copy(A),this._baseObjects=f,this._datas=e,this._geometriesAttributes=d,this.faceIndex=null,this.index=null,this._geometryCache=c.clone(),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Lines"}getSelectMesh(){const e=this._getIndex();if(null!=e){if(!this._baseObjects[e]){const n=this._datas[e],r=t.Util.extend({},this.getOptions(),{index:e},jn(n)?n.properties:n.getProperties());this._baseObjects[e]=new ko(n,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[e])}return{data:this._datas[e],baseObject:this._baseObjects[e]}}}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:n}=this,r=n.length,i=di(n);let s=0;for(let t=0;t<r;t++){const r=e.getColor(),o=r.getHex();this._colorMap[o]=t;const{count:a}=n[t].position;this._datas[t].colorIndex=o;for(let t=0;t<a;t++)i[s]=r.r,i[s+1]=r.g,i[s+2]=r.b,s+=3}In(t,"color",new o.BufferAttribute(i,3,!0));const a=this.getObject3d().material.clone();a.color.set("#fff"),a.vertexColors=Sn();const u=e.getColor().getHex(),l=new o.LineSegments(t,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}_workerLoad(t){const{position:e,geometriesAttributes:n}=t;this._geometriesAttributes=n;const r=new o.BufferGeometry;if(In(r,"position",new o.BufferAttribute(new Float32Array(e),3)),this._computeLineDistances(r),this._geometryCache=r.clone(),this.getObject3d().geometry=r,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const ps=[],ds=[];function gs(){return{waitingQueue:ps,currentQueue:ds}}function ys(t,e){for(let n=0,r=t.length;n<r;n++){const r=t[n];if(r){const{key:i,callback:o}=r;if(e===i)return t.splice(n,1),o}}return null}const vs=document.createElement("canvas");let ms;function As(t,e=!1){if(ms)return ms;const n=vs.getContext("2d");return n.clearRect(0,0,256,256),n.save(),ms=vs.toDataURL(),ms}function _s(t=1,e=1){let n;return"undefined"==typeof document||(n=document.createElement("canvas"),t&&(n.width=t),e&&(n.height=e)),n}vs.width=vs.height=256;class xs extends t.TileLayer{constructor(e,n={}){super(t.Util.GUID(),t.Util.extend({urlTemplate:e},n)),this._opts=null,this._layer=null,this.material=null,this.getMaterial=null,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime()}isAsynchronous(){return this._opts.worker}getBaseObjects(){const t=this._loadTiles,e=[];for(let n in t){const t=this._baseObjectKeys[n];if(t&&Array.isArray(t)&&t.length)for(let n=0,r=t.length;n<r;n++)e.push(t[n])}return e}onSelectMesh(t,e){}formatBaseObjects(t,e){return[]}loopMessage(t){}getTileData(e){const{key:n,url:r,callback:i,img:o}=e;t.Ajax.getJSON(r,{},(function(t,e){t?(console.error(t),i(n,null,o)):i(n,e,o)}))}_getCurentTileKeys(){const t=this.getTiles().tileGrids||[],e=[],n={};for(let r=0,i=t.length;r<i;r++){const i=t[r].tiles||[];for(let t=0,r=i.length;t<r;t++){const{id:r}=i[t];e.push(r),n[r]=!0}}return{keys:e,keysMap:n}}_isLoad(){const{keys:t}=this._getCurentTileKeys(),e=Object.keys(this._renderer.tilesInView);return t.length===e.length}_layerOnLoad(){const t=(new Date).getTime();if(t-this._layerLaodTime<20)return;this._layerLaodTime=t;const e=this._renderer.tilesInView,n=this._loadTiles,r=this._layer,i=this._baseObjectKeys,o=Object.keys(e).length,s=Object.keys(n).length,a=[];if(o&&s)for(let t in n)e[t]||i[t]&&(i[t]||[]).forEach((t=>{a.push(t)}));if(a.length&&r.removeMesh(a,!1),o&&s)for(let t in e)if(!n[t])if(i[t]){const e=i[t];r.addMesh(e)}else{const{x:e,y:n,z:r}=this._getXYZOfIndex(t);this.getTileUrl(e,n,r)}this._loadTiles=Object.assign({},e),this._diffCache()}_init(){}_workerLoad(t){const e=t.target._img;e.currentCount++,e.currentCount===e.needCount&&(e.src=As(e._key,this._opts.debug))}_generateBaseObjects(t,e,n){if(e&&n){const{keysMap:r}=this._getCurentTileKeys();if(!r[t])return void(n.src=As(0,this._opts.debug));const i=this.formatBaseObjects(t,e);if(i.length){n.needCount=i.length,n.currentCount=0;for(let e=0,r=i.length;e<r;e++){const r=i[e];r._img=n,r._vt=this,this.isVisible()||r.hide(),this._cachetile(t,r),r.isAsynchronous()||n.currentCount++}this._layer.addMesh(i,!1),n.needCount===n.currentCount&&(n.src=As(0,this._opts.debug)),this.isAsynchronous()?i.filter((t=>t.isAsynchronous())).forEach((t=>{t.on("workerload",this._workerLoad,this)})):n.src=As(0,this._opts.debug)}else n.src=As(0,this._opts.debug);this._loadTiles[t]=!0}else n&&(n.src=As(0,this._opts.debug))}_diffCache(){if(Object.keys(this._baseObjectKeys).length>this._renderer.tileCache.max){const t=this._renderer.tileCache.data,e=this._renderer.tilesInView,n=[];for(let r in this._baseObjectKeys)t[r]||e[r]||((this._baseObjectKeys[r]||[]).forEach((t=>{t.isAdd&&n.push(t)})),this._diposeBaseObject(r),delete this._baseObjectKeys[r]);n.length&&this._layer.removeMesh(n,!1)}}_diposeBaseObject(t){const e=this._baseObjectKeys[t];e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t._geometryCache&&t._geometryCache.dispose();const e=t._baseObjects;e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t=null})),t._datas=null,t._geometriesAttributes=null,t._faceMap=null,t._colorMap=null,t.pickObject3d&&t.pickObject3d.geometry.dispose(),t=null}))}_cachetile(t,e){this._baseObjectKeys[t]||(this._baseObjectKeys[t]=[]),this._baseObjectKeys[t].push(e)}_getXYZOfIndex(t){const e=t.indexOf("_")>-1?"_":"-";let[n,r,i]=t.split(e).slice(1,4);return{x:parseInt(r),y:parseInt(n),z:parseInt(i)}}_getTileExtent(t,e,n){const r=this.getMap()._getResolution(n);return this._getTileConfig().getTilePrjExtent(t,e,r)}_getTileLngLatExtent(e,n,r){const i=this._getTileExtent(e,n,r);let o=i.getMax(),s=i.getMin();const a=this.getMap().getProjection();return s=a.unproject(s),o=a.unproject(o),new t.Extent(s,o)}}const ws={worker:!1};class bs extends xs{constructor(e,n={},r,i){super(t.Util.GUID(),t.Util.extend({urlTemplate:e},ws,n)),this._opts=n,this._layer=i,this.getMaterial=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime(),this._init()}formatBaseObjects(e,n){const r=this._opts,i=[],s=this.isAsynchronous();for(let a in n){const u=n[a]||{};let l;if(Array.isArray(u)?l=u:"FeatureCollection"===u.type&&(l=u.features),l&&l.length){const n=[],h=[],c=[];for(let e=0,r=l.length;e<r;e++){const r=l[e];if(zn(r))n.push(r);else if(jn(r)){const t=Yn(r);for(let e=0,n=t.length;e<n;e++)h.push(t[e])}else if(Vn(r)){const e=Yn(r);for(let n=0,r=e.length;n<r;n++)c.push(t.Util.extend({},e[n].properties,e[n],{coordinate:Hn(e[n])}))}}if(n.length){const o=this._getMaterial(a,n,e,u);if(o){const u=this._layer.toExtrudePolygons(n,t.Util.extend({},{topColor:"#fff",layerName:a,asynchronous:s,key:e},r),o);i.push(u)}}if(h.length){const n=this._getMaterial(a,h,e,u);if(n&&(n instanceof o.LineBasicMaterial||n instanceof o.LineDashedMaterial)){const e=this._layer.toLines(h,t.Util.extend({},{layerName:a,asynchronous:s},r),n);i.push(e)}}if(c.length){const n=this._getMaterial(a,c,e,u);if(n&&n instanceof o.PointsMaterial){const e=this._layer.toPoints(c,t.Util.extend({},{layerName:a,asynchronous:s},r),n);i.push(e)}}}}return i}loopMessage(t){const{currentQueue:e}=gs();e.length>0&&this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),n=new Image;return n.width=e.width,n.height=e.height,n.onload=this.onTileLoad.bind(this,n,t),n.onerror=this.onTileError.bind(this,n,t),this.loadTileImage(n,t.url,t.id),n},t.renderer.deleteTile=function(t){if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;!function(t){const e=ys(ps,t);e&&e(t)}((t.info||{}).id)},t.renderer.loadTileImage=(t,e,n)=>{t._key=n,function(t,e,n,r,i){const o={key:t,url:e,callback:n,img:r,vt:i};ds.length<10?(ds.push(o),i.loopMessage(o)):ps.push(o)}(n,e,((t,e,n)=>{this._generateBaseObjects(t,e,n),function(t,e){if(ys(ds,t),ps.length){ds.push(ps[0]),ps.splice(0,1);const t=ds[ds.length-1];e.loopMessage(t)}}(t,this)}),t,this)}}))}_getMaterial(e,n,r,i){return this.getMaterial&&t.Util.isFunction(this.getMaterial)?this.getMaterial(e,n,r,i):null}}function Es(t,e,n,r){const{position:i,uv:s,normal:a,indexs:u}=function(t,e,n,r){const i=t/n,o=e/r,s=-t/2,a=e/2,u=-e/2,l=(n+1)*(r+1),h=new Float32Array(3*l),c=new Float32Array(2*l),f=new Float32Array(3*l),p=new Uint32Array(10*l);let d=0,g=0,y=0;for(let l=0;l<=r;l++)for(let v=0;v<=n;v++){const m=s+i*v,A=a-o*l;h[d]=m,h[d+1]=A,h[d+2]=0,f[d]=0,f[d+1]=0,f[d+2]=1;const _=(m-s)/t,x=(A-u)/e;if(c[g]=_,c[g+1]=x,d+=3,g+=2,v<n&&l<r){const t=l*(n+1)+v,e=t+1,r=(n+1)*(l+1)+v,i=r+1;p[y]=t,p[y+1]=r,p[y+2]=e,p[y+3]=r,p[y+4]=i,p[y+5]=e,y+=6}}const v=new Uint32Array(y);for(let t=0,e=v.length;t<e;t++)v[t]=p[t];return{position:h,uv:c,normal:f,indexs:v}}(t,e,n,r),l=new o.BufferGeometry;return In(l,"position",new o.BufferAttribute(i,3)),In(l,"normal",new o.BufferAttribute(a,3)),In(l,"uv",new o.BufferAttribute(s,2)),l.setIndex(new o.BufferAttribute(u,1)),l}const Is=new o.TextureLoader,Cs=document.createElement("canvas");function Ss(t){if(!t)return null;let e;return"string"==typeof t?(e=new Image,e.src=t):t instanceof HTMLCanvasElement?(e=new Image,e.src=t.toDataURL()):t instanceof Image&&(e=new Image,e.src=t.src,e.crossOrigin=t.crossOrigin),e&&!e.crossOrigin&&(e.crossOrigin="Anonymous"),e}const Ms=new Map;function Bs(t,e,n,r){if(!e||!n)return;const{imageWidth:i,imageHeight:s,flaserBoundary:a}=r;let u;if(u=t instanceof Uint32Array||t instanceof Uint8ClampedArray?t:function(t,e=256,n=256){Cs.width=e,Cs.height=n;const r=Cs.getContext("2d");return r.drawImage(t,0,0,e,n),r.getImageData(0,0,e,n).data}(t,i,s),!u)return void console.error("image is error type data",t);let l=0,h=0,c=0;const f=new o.Vector3,p=Ms;for(let t=0,r=u.length;t<r;t+=4){const r=.1*(256*u[t]*256+256*u[t+1]+u[t+2])-1e4;let o=0;if(0!==h&&h+1!==s&&0!==c&&c+1!==i||!a){const t=p.get(r);void 0!==t?o=t:(o=n.altitudeToVector3(r,r,null,f).x,p.set(r,o))}e.attributes.position.array[3*l+2]=o,l++,c++,c===i&&(h++,c=0)}e.attributes.position.needsUpdate=!0}const Ts={interactive:!1,altitude:0,image:null,imageWidth:256,imageHeight:256,texture:null,flaserBoundary:!0,bufferPixel:1};class ks extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Ts,n,{layer:i,extent:e});const{texture:o,image:s,altitude:a,imageHeight:u,imageWidth:l,flaserBoundary:h,bufferPixel:c}=n;e instanceof t.Extent||(e=new t.Extent(e));const{xmin:f,ymin:p,xmax:d,ymax:g}=e;let y=1/0,v=1/0,m=-1/0,A=-1/0;[[f,p],[f,g],[d,g],[d,p]].forEach((t=>{const e=i.coordinateToVector3(t),{x:n,y:r}=e;y=Math.min(n,y),v=Math.min(r,v),m=Math.max(n,m),A=Math.max(r,A)}));const _=(m-y)/l,x=(A-v)/u;y-=_*c,m+=_*c,v-=x*c,A+=x*c;const w=Math.abs(m-y),b=Math.abs(A-v),E=Ss(s),I=Ss(o),C=Es(w,b,l-1,u-1);super(),this._initOptions(n),this._createMesh(C,r);const S=i.altitudeToVector3(a,a).x,M=i.coordinateToVector3(e.getCenter(),S);this.getObject3d().position.copy(M),r.transparent=!0,E&&(E.onload=()=>{Bs(E,C,i,{imageWidth:l,imageHeight:u,flaserBoundary:h}),this.fire("dataload",{})},E.onerror=function(){console.error(`not load ${E.src}`),this.fire("dataerror",{})}),I?(r.opacity=0,Is.load(I.src,(t=>{r.map=t,r.opacity=1,r.needsUpdate=!0,this.fire("textureload",{})}))):r.opacity=1,this.type="Terrain"}updateData(t){return Bs(t,this.getObject3d().geometry,this.getLayer(),this.getOptions()),this.fire("updatedata",{}),this}}const Ps={scale:1,tileDivisor:4};class Ls extends xs{constructor(e,n={},r,i){super(t.Util.GUID(),t.Util.extend({urlTemplate:e},Ps,n)),this._opts=n,this._layer=i,this.material=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._imgQueue={},this._layerLaodTime=(new Date).getTime(),this._init()}isAsynchronous(){return!1}formatBaseObjects(t,e){const n=this.options,r=[],{scale:i,tileDivisor:o}=n,{x:s,y:a,z:u}=this._getXYZOfIndex(t),l=this.getMap().getZoom(),h=this.getTileUrl(s,a,u),[c,f]=this.options.tileSize,p=this._getTileLngLatExtent(s,a,u),d=this.material.clone();if(u+1>=Math.round(l)){const t=new ks(p,{image:e,imageWidth:c/o,imageHeight:f/o,texture:h},d,this._layer);t.getObject3d().scale.set(i,i,1),r.push(t)}return r}loopMessage(t){this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),n=new Image;return n.width=e.width,n.height=e.height,n.onload=this.onTileLoad.bind(this,n,t),n.onerror=this.onTileError.bind(this,n,t),this.loadTileImage(n,t.url,t.id),n},t.renderer.deleteTile=t=>{if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;const e=t.info||{},n=this._imgQueue[e.id];n&&(n.src="",n.onload=null,n.onerror=null,delete this._imgQueue[e.id])},t.renderer.loadTileImage=(t,e,n)=>{t._key=n;const r=new Image;this._imgQueue[n]=r;const i={key:n,url:e,rgbImage:r,callback:(t,e,n)=>{this._generateBaseObjects(t,e,n)},img:t,vt:this};this.loopMessage(i)}}))}}
|
|
4
|
+
*/function Xn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Jn(t,e){return Jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jn(t,e)}function Kn(t,e,n){void 0===n&&(n=2);var r,i,o,s=e&&e.length,a=s?e[0]*n:t.length,u=Zn(t,0,a,n,!0),l=[];if(!u||u.next===u.prev)return l;if(s&&(u=function(t,e,n,r){for(var i=[],o=0,s=e.length;o<s;o++){var a=Zn(t,e[o]*r,o<s-1?e[o+1]*r:t.length,r,!1);a===a.next&&(a.steiner=!0),i.push(lr(a))}i.sort(or);for(var u=0;u<i.length;u++)n=sr(i[u],n);return n}(t,e,u,n)),t.length>80*n){r=1/0,i=1/0;for(var h=-1/0,c=-1/0,f=n;f<a;f+=n){var p=t[f],d=t[f+1];p<r&&(r=p),d<i&&(i=d),p>h&&(h=p),d>c&&(c=d)}o=0!==(o=Math.max(h-r,c-i))?32767/o:0}return tr(u,l,n,r,i,o,0),l}function Zn(t,e,n,r,i){var o;if(i===function(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,n,r)>0)for(var s=e;s<n;s+=r)o=_r(s/r|0,t[s],t[s+1],o);else for(var a=n-r;a>=e;a-=r)o=_r(a/r|0,t[a],t[a+1],o);return o&&dr(o,o.next)&&(xr(o),o=o.next),o}function $n(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!dr(r,r.next)&&0!==pr(r.prev,r,r.next))r=r.next;else{if(xr(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function tr(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=ur(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n=1;do{var r=t,i=void 0;t=null;var o=null;for(e=0;r;){e++;for(var s=r,a=0,u=0;u<n&&(a++,s=s.nextZ);u++);for(var l=n;a>0||l>0&&s;)0!==a&&(0===l||!s||r.z<=s.z)?(i=r,r=r.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);for(var a=t;t.prev!==t.next;){var u=t.prev,l=t.next;if(o?nr(t,r,i,o):er(t))e.push(u.i,t.i,l.i),xr(t),t=l.next,a=l.next;else if((t=l)===a){s?1===s?tr(t=rr($n(t),e),e,n,r,i,o,2):2===s&&ir(t,e,n,r,i,o):tr($n(t),e,n,r,i,o,1);break}}}}function er(t){var e=t.prev,n=t,r=t.next;if(pr(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,u=n.y,l=r.y,h=Math.min(i,o,s),c=Math.min(a,u,l),f=Math.max(i,o,s),p=Math.max(a,u,l),d=r.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&cr(i,a,o,u,s,l,d.x,d.y)&&pr(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function nr(t,e,n,r){var i=t.prev,o=t,s=t.next;if(pr(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,u,l),d=Math.min(h,c,f),g=Math.max(a,u,l),y=Math.max(h,c,f),v=ur(p,d,e,n,r),m=ur(g,y,e,n,r),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&cr(a,h,u,c,l,f,A.x,A.y)&&pr(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&cr(a,h,u,c,l,f,_.x,_.y)&&pr(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&cr(a,h,u,c,l,f,A.x,A.y)&&pr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&cr(a,h,u,c,l,f,_.x,_.y)&&pr(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function rr(t,e){var n=t;do{var r=n.prev,i=n.next.next;!dr(r,i)&&gr(r,n,n.next,i)&&mr(r,i)&&mr(i,r)&&(e.push(r.i,n.i,i.i),xr(n),xr(n.next),n=t=i),n=n.next}while(n!==t);return $n(n)}function ir(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&fr(s,a)){var u=Ar(s,a);return s=$n(s,s.next),u=$n(u,u.next),tr(s,e,n,r,i,o,0),void tr(u,e,n,r,i,o,0)}a=a.next}s=s.next}while(s!==t)}function or(t,e){var n=t.x-e.x;0===n&&(0===(n=t.y-e.y)&&(n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)));return n}function sr(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;if(dr(t,r))return r;do{if(dr(t,r.next))return r.next;if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var u=n,l=n.x,h=n.y,c=1/0;r=n;do{if(i>=r.x&&r.x>=l&&i!==r.x&&hr(o<h?i:s,o,l,h,o<h?s:i,o,r.x,r.y)){var f=Math.abs(o-r.y)/(i-r.x);mr(r,t)&&(f<c||f===c&&(r.x>n.x||r.x===n.x&&ar(n,r)))&&(n=r,c=f)}r=r.next}while(r!==u);return n}(t,e);if(!n)return e;var r=Ar(n,t);return $n(r,r.next),$n(n,n.next)}function ar(t,e){return pr(t.prev,t,e.prev)<0&&pr(e.next,t,t.next)<0}function ur(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function lr(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function hr(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function cr(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&hr(t,e,n,r,i,o,s,a)}function fr(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&gr(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(mr(t,e)&&mr(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(pr(t.prev,t,e.prev)||pr(t,e.prev,e))||dr(t,e)&&pr(t.prev,t,t.next)>0&&pr(e.prev,e,e.next)>0)}function pr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function dr(t,e){return t.x===e.x&&t.y===e.y}function gr(t,e,n,r){var i=vr(pr(t,e,n)),o=vr(pr(t,e,r)),s=vr(pr(n,r,t)),a=vr(pr(n,r,e));return i!==o&&s!==a||(!(0!==i||!yr(t,n,e))||(!(0!==o||!yr(t,r,e))||(!(0!==s||!yr(n,t,r))||!(0!==a||!yr(n,e,r)))))}function yr(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function vr(t){return t>0?1:t<0?-1:0}function mr(t,e){return pr(t.prev,t,t.next)<0?pr(t,e,t.next)>=0&&pr(t,t.prev,e)>=0:pr(t,e,t.prev)<0||pr(t,t.next,e)<0}function Ar(t,e){var n=wr(t.i,t.x,t.y),r=wr(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function _r(t,e,n,r){var i=wr(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function xr(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function wr(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var br=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}t.slerpFlat=function(t,e,n,r,i,o,s){var a=n[r+0],u=n[r+1],l=n[r+2],h=n[r+3],c=i[o+0],f=i[o+1],p=i[o+2],d=i[o+3];if(0===s)return t[e+0]=a,t[e+1]=u,t[e+2]=l,void(t[e+3]=h);if(1===s)return t[e+0]=c,t[e+1]=f,t[e+2]=p,void(t[e+3]=d);if(h!==d||a!==c||u!==f||l!==p){var g=1-s,y=a*c+u*f+l*p+h*d,v=y>=0?1:-1,m=1-y*y;if(m>Number.EPSILON){var A=Math.sqrt(m),_=Math.atan2(A,y*v);g=Math.sin(g*_)/A,s=Math.sin(s*_)/A}var x=s*v;if(a=a*g+c*x,u=u*g+f*x,l=l*g+p*x,h=h*g+d*x,g===1-s){var w=1/Math.sqrt(a*a+u*u+l*l+h*h);a*=w,u*=w,l*=w,h*=w}}t[e]=a,t[e+1]=u,t[e+2]=l,t[e+3]=h},t.multiplyQuaternionsFlat=function(t,e,n,r,i,o){var s=n[r],a=n[r+1],u=n[r+2],l=n[r+3],h=i[o],c=i[o+1],f=i[o+2],p=i[o+3];return t[e]=s*p+l*h+a*f-u*c,t[e+1]=a*p+l*c+u*h-s*f,t[e+2]=u*p+l*f+s*c-a*h,t[e+3]=l*p-s*h-a*c-u*f,t};var e,n,r,i=t.prototype;return i.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},i.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},i.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},i.setFromEuler=function(t,e){void 0===e&&(e=!0);var n=t._x,r=t._y,i=t._z,o=t._order,s=Math.cos,a=Math.sin,u=s(n/2),l=s(r/2),h=s(i/2),c=a(n/2),f=a(r/2),p=a(i/2);switch(o){case"XYZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"YXZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"ZXY":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"ZYX":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"YZX":this._x=c*l*h+u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h-c*f*p;break;case"XZY":this._x=c*l*h-u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h+c*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===e&&this._onChangeCallback(),this},i.setFromAxisAngle=function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},i.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],r=e[4],i=e[8],o=e[1],s=e[5],a=e[9],u=e[2],l=e[6],h=e[10],c=n+s+h;if(c>0){var f=.5/Math.sqrt(c+1);this._w=.25/f,this._x=(l-a)*f,this._y=(i-u)*f,this._z=(o-r)*f}else if(n>s&&n>h){var p=2*Math.sqrt(1+n-s-h);this._w=(l-a)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(i+u)/p}else if(s>h){var d=2*Math.sqrt(1+s-n-h);this._w=(i-u)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(a+l)/d}else{var g=2*Math.sqrt(1+h-n-s);this._w=(o-r)/g,this._x=(i+u)/g,this._y=(a+l)/g,this._z=.25*g}return this._onChangeCallback(),this},i.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},i.rotateTowards=function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},i.identity=function(){return this.set(0,0,0,1)},i.invert=function(){return this.conjugate()},i.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},i.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},i.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},i.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},i.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},i.multiply=function(t){return this.multiplyQuaternions(this,t)},i.premultiply=function(t){return this.multiplyQuaternions(t,this)},i.multiplyQuaternions=function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,s=e._x,a=e._y,u=e._z,l=e._w;return this._x=n*l+o*s+r*u-i*a,this._y=r*l+o*a+i*s-n*u,this._z=i*l+o*u+n*a-r*s,this._w=o*l-n*s-r*a-i*u,this._onChangeCallback(),this},i.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,s=o*t._w+n*t._x+r*t._y+i*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var a=1-s*s;if(a<=Number.EPSILON){var u=1-e;return this._w=u*o+e*this._w,this._x=u*n+e*this._x,this._y=u*r+e*this._y,this._z=u*i+e*this._z,this.normalize(),this}var l=Math.sqrt(a),h=Math.atan2(l,s),c=Math.sin((1-e)*h)/l,f=Math.sin(e*h)/l;return this._w=o*c+this._w*f,this._x=n*c+this._x*f,this._y=r*c+this._y*f,this._z=i*c+this._z*f,this._onChangeCallback(),this},i.slerpQuaternions=function(t,e,n){return this.copy(t).slerp(e,n)},i.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),i*Math.sin(e),i*Math.cos(e))},i.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},i.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},i.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},i.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this},i.toJSON=function(){return this.toArray()},i._onChange=function(t){return this._onChangeCallback=t,this},i._onChangeCallback=function(){},e=t,(n=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])&&Xn(e.prototype,n),r&&Xn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Er=new br,Ir=function(){function t(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=n}var e=t.prototype;return e.set=function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Er.setFromAxisAngle(t,e))},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this},e.applyQuaternion=function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,s=t.z,a=t.w,u=a*e+o*r-s*n,l=a*n+s*e-i*r,h=a*r+i*n-o*e,c=-i*e-o*n-s*r;return this.x=u*a+c*-i+l*-s-h*-o,this.y=l*a+c*-o+h*-i-u*-s,this.z=h*a+c*-s+u*-o-l*-i,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function Cr(t){let e,n,r=0,i=1;const o=t.length;for(;i<o;)e=n||t[0],n=t[i],r+=(n[0]-e[0])*(n[1]+e[1]),i++;return r>0}function Sr(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Mr(t,e){const n=e[0],r=e[1],i=e[2],o=Math.sqrt(n*n+r*r+i*i)||1;return t[0]=n/o,t[1]=r/o,t[2]=i/o,t}function Br(t,e,n){const r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2];return t[0]=i*u-o*a,t[1]=o*s-r*u,t[2]=r*a-i*s,t}function Tr(t,e){function n(t,e,n,r){t[0]=e,t[1]=n,t[2]=r}const r=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);let c=0;for(;c<l;){const l=3*t[c],f=3*t[c+1],p=3*t[c+2];n(r,e[l],e[l+1],e[l+2]),n(i,e[f],e[f+1],e[f+2]),n(o,e[p],e[p+1],e[p+2]),Sr(a,o,i),Sr(s,r,i),Br(u,a,s);for(let t=0;t<3;t++)h[l+t]+=u[t],h[f+t]+=u[t],h[p+t]+=u[t];c+=3}let f=0;const p=h.length;for(;f<p;)n(u,h[f],h[f+1],h[f+2]),Mr(u,u),h[f]=u[0]||0,h[f+1]=u[1]||0,h[f+2]=u[2]||0,f+=3;return h}function kr(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let e=0,n=0;for(let r=0,i=t.length;r<i;r++){const{position:i,indices:o}=t[r];e+=i.length,n+=o.length}const r={position:new Float32Array(e),normal:new Float32Array(e),uv:new Float32Array(e/3*2),indices:new Uint32Array(n),results:t};let i=0,o=0,s=0,a=0;for(let e=0,n=t.length;e<n;e++){const{position:n,indices:u,normal:l,uv:h}=t[e];r.position.set(n,i),r.normal.set(l,i),r.uv.set(h,a);let c=0;const f=u.length;for(;c<f;){const t=u[c]+o;r.indices[s]=t,s++,c++}a+=h.length,i+=n.length,o+=n.length/3}return r}function Pr(t){return 180*t/Math.PI}function Lr(t){return t/180*Math.PI}function Rr(t,e,n,r,i,o){const s=3*n,a=3*r,u=3*i,l=3*o,h=e[s],c=e[s+1],f=e[s+2],p=e[a],d=e[a+1],g=e[a+2],y=e[u],v=e[u+1],m=e[u+2],A=e[l],_=e[l+1],x=e[l+2];let w=t.length-1;Math.abs(c-d)<Math.abs(h-p)?(t[++w]=h,t[++w]=1-f,t[++w]=p,t[++w]=1-g,t[++w]=y,t[++w]=1-m,t[++w]=A,t[++w]=1-x):(t[++w]=c,t[++w]=1-f,t[++w]=d,t[++w]=1-g,t[++w]=v,t[++w]=1-m,t[++w]=_,t[++w]=1-x)}function Dr(t,e){e=Object.assign({},{depth:2,top:!0},e);const n=t.map((t=>{for(let e=0,n=t.length;e<n;e++){const n=t[e];Or(n),0===e?Cr(n)||(t[e]=n.reverse()):Cr(n)&&(t[e]=n.reverse()),Nr(n)&&n.splice(n.length-1,1)}const n=function(t,e){const n=function(t){let e=0,n=0;const r=t.length;for(;n<r;)e+=t[n].length,n++;return e}(t),r=t.length,i=[],o=new Float32Array(2*n),s=[],a=[],u=3*n,l=2*n,h=e.depth;let c=0,f=0,p=0;for(let e=0;e<r;e++){const n=t[e];e>0&&i.push(c/2);let r=0;const d=n.length;for(;r<d;){const t=n[r],e=t[0],i=t[1],d=t[2]||0;o[c++]=e,o[c++]=i,s[f]=e,s[f+1]=i,s[f+2]=h+d,s[u+f]=e,s[u+f+1]=i,s[u+f+2]=d,a[p]=e,a[p+1]=i,a[l+p]=e,a[l+p+1]=i,f+=3,p+=2,r++}}return{flatVertices:o,holes:i,points:s,count:n,uv:a}}(t,e);n.polygon=t;return function(t,e,n){const r=[],{count:i}=t,o=n.top;for(let t=0,n=e.length;t<n;t+=3){const s=e[t],a=e[t+1],u=e[t+2];o&&(r[t]=s,r[t+1]=a,r[t+2]=u);let l=n+t;const h=i+s,c=i+a,f=i+u;o||(l=t),r[l]=h,r[l+1]=c,r[l+2]=f}t.indices=r}(n,Kn(n.flatVertices,n.holes,2),e),function(t,e){const{points:n,indices:r,polygon:i,uv:o}=t,s=e.depth;let a=n.length-1,u=r.length-1;for(let t=0,e=i.length;t<e;t++){const e=i[t];let l=0;const h=e.length;for(;l<h;){const t=e[l];let i=e[l+1];l===h-1&&(i=e[0]);const c=n.length/3,f=t[0],p=t[1],d=t[2]||0,g=i[0],y=i[1],v=i[2]||0;n[++a]=f,n[++a]=p,n[++a]=d+s,n[++a]=g,n[++a]=y,n[++a]=v+s,n[++a]=f,n[++a]=p,n[++a]=d,n[++a]=g,n[++a]=y,n[++a]=v;const m=c+2,A=c+3,_=c,x=c+1;r[++u]=m,r[++u]=_,r[++u]=A,r[++u]=_,r[++u]=x,r[++u]=A,Rr(o,n,m,A,_,x),l++}}}(n,e),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=Tr(n.indices,n.position),n})),r=kr(n);return r.polygons=t,r}function Or(t){Nr(t)||t.push(t[0])}function Nr(t){const e=t.length,[n,r]=t[0],[i,o]=t[e-1];return n===i&&r===o}function Fr(t,e){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(e=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},e));const n=t.map((t=>{const n=function(t,e){let n=e.lineWidth/2;e.isSlope&&(n*=2);const r=[],i=[],o=[],s=t.length;let a=0;for(;a<s;){let e=t[a],u=t[a+1];const l=t[a];a===s-1&&(e=t[s-2],u=t[s-1]);const h=u[1]-e[1],c=u[0]-e[0];let f=0;const p=Pr(Math.atan(h/c));if(0===a||a===s-1)f=p,f-=90;else{const n=t[a-1];Ur.x=n[0]-e[0],Ur.y=n[1]-e[1],Qr.x=u[0]-e[0],Qr.y=u[1]-e[1];f=p-Gr(Ur,Qr)/2}const d=Lr(f),g=l,y=[Math.cos(d)+g[0],Math.sin(d)+g[1]],[v,m]=jr(e,u,n);let A=Vr(v[0],v[1],g,y),_=Vr(m[0],m[1],g,y);if(!A||!_){const t=r.length,e=r[t-2],n=r[t-1];if(!e||!n)continue;A=[e[0],e[1]],_=[n[0],n[1]]}A[2]=l[2]||0,_[2]=l[2]||0,r.push(A,_),zr(A,e,u)?(i.push(A),o.push(_)):(i.push(_),o.push(A)),a++}return{offsetPoints:r,leftPoints:i,rightPoints:o,line:t}}(t,e);return n.line=t,function(t,e){const n=e.bottomStickGround,r=e.depth,i=t.depths;let o=r,s=r;i&&(o=i[0],s=i[1]);const{leftPoints:a,rightPoints:u}=t,l=t.line,h=e.pathUV;if(h){!function(t){let e=0;for(let n=0,r=t.length;n<r;n++){const r=t[n],i=t[n+1];if(0===n&&(r.distance=0),r&&i){const[t,n,o]=r,[s,a,u]=i,l=t-s,h=n-a,c=(o||0)-(u||0);e+=Math.sqrt(l*l+h*h+c*c),i.distance=e}}}(l);for(let t=0,e=l.length;t<e;t++)a[t].distance=u[t].distance=l[t].distance}let c=0,f=a.length;const p=[],d=[],g=[];for(;c<f;){const t=3*c,[e,r,i]=a[c];p[t]=e,p[t+1]=r,p[t+2]=o+i;const[d,y,v]=u[c],m=3*f+t;p[m]=d,p[m+1]=y,p[m+2]=s+v;const A=2*f*3+t;p[A]=e,p[A+1]=r,p[A+2]=i,n&&(p[A+2]=0);const _=2*f*3+3*f+t;if(p[_]=d,p[_+1]=y,p[_+2]=v,n&&(p[_+2]=0),h){const t=l[c].distance,e=2*c;g[e]=t,g[e+1]=1;const n=2*f+e;g[n]=t,g[n+1]=0;const r=2*f*2+e;g[r]=t,g[r+1]=1;const i=2*f*2+2*f+e;g[i]=t,g[i+1]=0}c++}if(!h){c=0,f=p.length;let t=g.length-1;for(;c<f;){const e=p[c],n=p[c+1];g[++t]=e,g[++t]=n,c+=3}}c=0,f=a.length;let y=d.length-1;for(;c<f-1;){const t=c,e=c+1,n=t+f,r=e+f;d[++y]=t,d[++y]=n,d[++y]=e,d[++y]=n,d[++y]=r,d[++y]=e;const i=c+2*f,o=i+1,s=i+f,a=o+f;d[++y]=i,d[++y]=s,d[++y]=o,d[++y]=s,d[++y]=a,d[++y]=o,c++}if(t.indices=d,t.points=p,t.uv=g,i)for(f=a.length,c=0;c<f;)a[c].depth=o,u[c].depth=s,c++}(n,e),function(t,e){const{points:n,indices:r,leftPoints:i,rightPoints:o,uv:s}=t,a=e.depth,u=e.bottomStickGround,l=[i,o],h=t.depths,c=e.pathUV,f=e.lineWidth;let p=n.length-1,d=r.length-1,g=s.length-1;function y(t,e){const i=n.length/3,o=h?t.depth:a,l=h?e.depth:a;n[++p]=t[0],n[++p]=t[1],n[++p]=o+t[2],n[++p]=e[0],n[++p]=e[1],n[++p]=l+e[2],n[++p]=t[0],n[++p]=t[1],n[++p]=u?0:t[2],n[++p]=e[0],n[++p]=e[1],n[++p]=u?0:e[2];const y=i+2,v=i+3,m=i,A=i+1;r[++d]=y,r[++d]=m,r[++d]=v,r[++d]=m,r[++d]=A,r[++d]=v,c?(s[++g]=t.distance,s[++g]=o/f,s[++g]=e.distance,s[++g]=l/f,s[++g]=t.distance,s[++g]=0,s[++g]=e.distance,s[++g]=0):Rr(s,n,y,v,m,A)}for(let t=0,e=l.length;t<e;t++){let e=l[t];t>0&&(e=e.map((t=>t)),e=e.reverse());let n=0;const r=e.length-1;for(;n<r;){y(e[n],e[n+1]),n++}}const v=i.length,m=[o[0],i[0],i[v-1],o[v-1]];for(let t=0;t<m.length;t+=2){y(m[t],m[t+1])}}(n,e),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=Tr(n.indices,n.position),n})),r=kr(n);return r.lines=t,r}const Ur={x:0,y:0},Qr={x:0,y:0};const Gr=({x:t,y:e},{x:n,y:r})=>{const i=t*n+e*r,o=t*r-e*n;return(Math.atan2(o,i)/Math.PI*180+360)%360};function zr(t,e,n){const[r,i]=e,[o,s]=n,[a,u]=t;return(i-s)*a+(o-r)*u+r*s-o*i>0}function jr(t,e,n){const r=e[1]-t[1],i=e[0]-t[0],o=Math.atan2(r,i),s=o+Math.PI/2;let a=Math.cos(s)*n,u=Math.sin(s)*n;const l=[t[0]+a,t[1]+u],h=[e[0]+a,e[1]+u],c=o-Math.PI/2;a=Math.cos(c)*n,u=Math.sin(c)*n;return[[l,h],[[t[0]+a,t[1]+u],[e[0]+a,e[1]+u]]]}function Vr(t,e,n,r){const i=e[0]-t[0],o=e[1]-t[1],s=r[0]-n[0],a=r[1]-n[1];if(0===i&&0===s)return null;if(0===o&&0===a)return null;const u=o/i,l=a/s,h=t[1]-u*t[0],c=n[1]-l*n[0];let f,p;return 0===i?(f=t[0],p=l*f+c):0===s?(f=n[0],p=u*f+h):0===o?(p=t[1],f=(p-c)/l):0===a?(p=n[1],f=(p-h)/u):(f=(c-h)/(u-l),p=u*f+h),[f,p]}var qr=function(){function t(){this.pos=new Ir,this.dir=new Ir,this.right=new Ir,this.up=new Ir,this.dist=0,this.widthScale=1,this.sharp=!1}var e=t.prototype;return e.lerpPathPoints=function(t,e,n){this.pos.lerpVectors(t.pos,e.pos,n),this.dir.lerpVectors(t.dir,e.dir,n),this.up.lerpVectors(t.up,e.up,n),this.right.lerpVectors(t.right,e.right,n),this.dist=(e.dist-t.dist)*n+t.dist,this.widthScale=(e.widthScale-t.widthScale)*n+t.widthScale},e.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),Hr=function(){function t(t,e,n,r,i,o,s,a,u,l,h,c,f,p,d,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,r,i,o,s,a,u,l,h,c,f,p,d,g)}var e=t.prototype;return e.set=function(t,e,n,r,i,o,s,a,u,l,h,c,f,p,d,g){var y=this.elements;return y[0]=t,y[4]=e,y[8]=n,y[12]=r,y[1]=i,y[5]=o,y[9]=s,y[13]=a,y[2]=u,y[6]=l,y[10]=h,y[14]=c,y[3]=f,y[7]=p,y[11]=d,y[15]=g,this},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.makeRotationAxis=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,s=t.y,a=t.z,u=i*o,l=i*s;return this.set(u*o+n,u*s-r*a,u*a+r*s,0,u*s+r*a,l*s+n,l*a-r*o,0,u*a-r*s,l*a+r*o,i*a*a+n,0,0,0,0,1),this},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},t}(),Wr=function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var e=t.prototype;return e.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},e.getPointAt=function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},e.getPoints=function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},e.getLength=function(){var t=this.getLengths();return t[t.length-1]},e.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],r=this.getPoint(0),i=0;n.push(0);for(var o=1;o<=t;o++)i+=(e=this.getPoint(o/t)).distanceTo(r),n.push(i),r=e;return this.cacheArcLengths=n,n},e.getUtoTmapping=function(t,e){var n,r=this.getLengths(),i=0,o=r.length;n=e||t*r[o-1];for(var s,a=0,u=o-1;a<=u;)if((s=r[i=Math.floor(a+(u-a)/2)]-n)<0)a=i+1;else{if(!(s>0)){u=i;break}u=i-1}if(r[i=u]===n)return i/(o-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(o-1)},t}();function Yr(t,e,n,r){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}var Xr=function(t){var e,n;function r(e,n,r){var i;return void 0===e&&(e=new Ir),void 0===n&&(n=new Ir),void 0===r&&(r=new Ir),(i=t.call(this)||this).isQuadraticBezierCurve3=!0,i.type="QuadraticBezierCurve3",i.v0=e,i.v1=n,i.v2=r,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,Jn(e,n),r.prototype.getPoint=function(t,e){void 0===e&&(e=new Ir);var n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(Yr(t,r.x,i.x,o.x),Yr(t,r.y,i.y,o.y),Yr(t,r.z,i.z,o.z)),n},r}(Wr),Jr=new Ir,Kr=new Ir,Zr=new Ir,$r=new Hr,ti=new Xr;var ei=function(){function t(){this.array=[],this.count=0}var e=t.prototype;return e.set=function(t,e,n,r,i){if(void 0===e&&(e=.1),void 0===n&&(n=10),void 0===r&&(r=null),void 0===i&&(i=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);i&&!t[0].equals(t[t.length-1])&&t.push((new Ir).copy(t[0]));for(var o=0,s=t.length;o<s;o++)if(0===o)this._start(t[o],t[o+1],r);else if(o===s-1)if(i){this._corner(t[o],t[1],e,n,r);var a=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=a}else this._end(t[o]);else this._corner(t[o],t[o+1],e,n,r)},e.distance=function(){return this.count>0?this.array[this.count-1].dist:0},e._getByIndex=function(t){return this.array[t]||(this.array[t]=new qr),this.array[t]},e._start=function(t,e,n){this.count=0;var r=this._getByIndex(this.count);if(r.pos.copy(t),r.dir.subVectors(e,t),n)r.up.copy(n);else{var i=Number.MAX_VALUE,o=Math.abs(r.dir.x),s=Math.abs(r.dir.y),a=Math.abs(r.dir.z);o<i&&(i=o,r.up.set(1,0,0)),s<i&&(i=s,r.up.set(0,1,0)),a<i&&r.up.set(0,0,1)}r.right.crossVectors(r.dir,r.up).normalize(),r.up.crossVectors(r.right,r.dir).normalize(),r.dist=0,r.widthScale=1,r.sharp=!1,r.dir.normalize(),this.count++},e._end=function(t){var e=this.array[this.count-1],n=this._getByIndex(this.count);n.pos.copy(t),n.dir.subVectors(t,e.pos);var r=n.dir.length();n.dir.normalize(),n.up.copy(e.up);var i=Jr.crossVectors(e.dir,n.dir);if(i.length()>Number.EPSILON){i.normalize();var o=Math.acos(Math.min(Math.max(e.dir.dot(n.dir),-1),1));n.up.applyMatrix4($r.makeRotationAxis(i,o))}n.right.crossVectors(n.dir,n.up).normalize(),n.dist=e.dist+r,n.widthScale=1,n.sharp=!1,this.count++},e._corner=function(t,e,n,r,i){if(n>0&&r>0){for(var o=function(t,e,n,r,i,o){var s=Jr.subVectors(e,t),a=Kr.subVectors(n,e),u=s.length(),l=a.length();s.normalize(),a.normalize();var h=Math.min(.999999*(i?u/2:u),r);o.v0.copy(e).sub(s.multiplyScalar(h)),o.v1.copy(e);var c=Math.min(l/2*.999999,r);return o.v2.copy(e).add(a.multiplyScalar(c)),o}(this.array[this.count-1].pos,t,e,n,this.count-1==0,ti),s=o.getPoints(r),a=0;a<r;a++)this._sharpCorner(s[a],s[a+1],i,0===a?1:0);s[r].equals(e)||this._sharpCorner(s[r],e,i,2)}else this._sharpCorner(t,e,i,0,!0)},e._sharpCorner=function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=this.array[this.count-1],s=this._getByIndex(this.count),a=Jr.subVectors(t,o.pos),u=Kr.subVectors(e,t),l=a.length();if(a.normalize(),u.normalize(),s.pos.copy(t),1===r?s.dir.copy(a):2===r?s.dir.copy(u):(s.dir.addVectors(a,u),s.dir.normalize()),n)1===s.dir.dot(n)?s.right.crossVectors(u,n).normalize():s.right.crossVectors(s.dir,n).normalize(),s.up.crossVectors(s.right,s.dir).normalize();else{s.up.copy(o.up);var h=Zr.crossVectors(o.dir,s.dir);if(h.length()>Number.EPSILON){h.normalize();var c=Math.acos(Math.min(Math.max(o.dir.dot(s.dir),-1),1));s.up.applyMatrix4($r.makeRotationAxis(h,c))}s.right.crossVectors(s.dir,s.up).normalize()}s.dist=o.dist+l;var f=a.dot(u);s.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,s.sharp=Math.abs(f-1)>.05&&i,this.count++},t}();const ni=new Ir(0,0,1),ri=new Ir,ii=new Ir,oi=new Ir,si=new Ir,ai=new Ir,ui=new Ir;function li(t,e){e=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},e);const n=t.map((t=>{const n=function(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n],[i,o,s]=r,a=new Ir(i,o,s||0);e[n]=a}return e}(t),r=new ei;r.set(n,e.cornerRadius,e.cornerSplit,ni);const i=function(t,e){const n=e.lineWidth||.1,r=1,i=n/2,o=n,s=t.distance(),a=r*s;let u=0;const l=[],h=[],c=[],f=[];let p=0;if(0===s)return{position:l,normal:h,uv:c,indices:f,count:u};const d=i/o;let g,y=l.length-1,v=h.length-1,m=c.length-1,A=f.length-1;function _(t){const e=0===l.length,n=t.sharp&&!e,r=t.dist/o,s=t.dir,a=t.up,g=t.right;if(ri.copy(g).multiplyScalar(i*t.widthScale),ii.copy(g).multiplyScalar(-i*t.widthScale),ri.add(t.pos),ii.add(t.pos),n){oi.fromArray(l,l.length-6).sub(ii),si.fromArray(l,l.length-3).sub(ri);const t=oi.length()-si.length();let e,n;t>0?(e=oi,n=ii):(e=si,n=ri),ai.copy(e).setLength(Math.abs(t)).add(n);let i=ui.copy(n).sub(ai).normalize().dot(s)*ui.copy(n).sub(ai).length()*2;ui.copy(s).setLength(i).add(ai),t>0?(l[++y]=ai.x,l[++y]=ai.y,l[++y]=ai.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,l[++y]=ui.x,l[++y]=ui.y,l[++y]=ui.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-4,f[++A]=p-6,f[++A]=p-5,f[++A]=p-2,f[++A]=p-4,f[++A]=p-1,u+=12):(l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ai.x,l[++y]=ai.y,l[++y]=ai.z,l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ui.x,l[++y]=ui.y,l[++y]=ui.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-6,f[++A]=p-5,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=12);for(let t=0;t<6;t++)h[++v]=a.x,h[++v]=a.y,h[++v]=a.z;c[++m]=r-d,c[++m]=0,c[++m]=r-d,c[++m]=1,c[++m]=r,c[++m]=0,c[++m]=r,c[++m]=1,c[++m]=r+d,c[++m]=0,c[++m]=r+d,c[++m]=1}else l[++y]=ii.x,l[++y]=ii.y,l[++y]=ii.z,l[++y]=ri.x,l[++y]=ri.y,l[++y]=ri.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,c[++m]=r,c[++m]=0,c[++m]=r,c[++m]=1,p+=2,e||(f[++A]=p-2,f[++A]=p-4,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=6)}if(a>0)for(let e=0;e<t.count;e++){const n=t.array[e];if(n.dist>a){const r=t.array[e-1];g=new qr;const i=(a-r.dist)/(n.dist-r.dist);g.lerpPathPoints(r,n,i),_(g);break}_(n)}else g=t.array[0];return{position:l,normal:h,uv:c,indices:f,count:u}}(r,e);return{position:new Float32Array(i.position),indices:new Uint32Array(i.indices),uv:new Float32Array(i.uv),normal:new Float32Array(i.normal),line:t,count:i.count}})),r=kr(n);return r.lines=t,r}function hi(t,e,n={}){return void 0===n[t]&&(n[t]=e.distanceToVector3(t,t).x),n[t]}function ci(t,e,n={}){return void 0===n[t]&&(n[t]=e.altitudeToVector3(t,t).x),n[t]}function fi(e=[]){let n=0,r=0;const i=e.length;for(let o=0;o<i;o++){const{coordinate:i,lnglat:s,lnglats:a,xy:u,xys:l}=e[o],h=i||s||a||u||l||e[o];let c,f;Array.isArray(h)?(c=h[0],f=h[1]):h instanceof t.Coordinate&&(c=h.x,f=h.y),n+=c,r+=f}return new t.Coordinate(n/i,r/i)}function pi(t,e,n,r){if(void 0===e||"number"!=typeof e||0===e)return 0;let i;i=t instanceof o.BufferGeometry?t.attributes.position.array:Array.isArray(t)||t instanceof Float32Array?t:t.position;let s=0;if(i){r?(void 0===r[e]&&(r[e]=n.altitudeToVector3(e,e).x),s=r[e]):s=n.altitudeToVector3(e,e).x;const t=i.length;if(i[0]instanceof o.Vector3)for(let e=0;e<t;e++)i[e].z+=s;else for(let e=0;e<t;e+=3)i[e+2]+=s}return s}function di(t){const e=t.length;let n=0;for(let r=0;r<e;r++){const{count:e}=t[r].position;n+=e}return new Float32Array(3*n)}new Ir(0,0,1),new Ir;const gi=new o.Vector3,yi=new Map;function vi(t=[],e){const n=t.length,r=!!e,i=r?3:2,o=new Float64Array(n*i);yi.clear();for(let s=0;s<n;s++){let n,a;const u=t[s];let l;if(u.x?(n=u.x,a=u.y,l=u.z):(n=u[0],a=u[1],l=u[2]),o[s*i]=n,o[s*i+1]=a,l=l||0,r&&0!==l){if(!yi.has(l)){const t=e.altitudeToVector3(l,l,null,gi).x;yi.set(l,t)}o[s*i+2]=yi.get(l)}}return o.buffer}function mi(t){return(zn(t)?t.properties:t.getProperties())||{}}function Ai(t){return(jn(t)?t.properties:t.getProperties())||{}}const _i=new o.Color("#fff"),xi=new o.Color("#fff");function wi(t,e,n,r,i,o,s){const a=Ei(t,r,i,o,!1);if(!a)return null;s?(null==s[e]&&(s[e]=r.altitudeToVector3(e,e).x),e=s[e]):e=r.altitudeToVector3(e,e).x;const{position:u,normal:l,uv:h,indices:c}=Dr(a,{depth:e,top:n});return{position:u,normal:l,uv:h,indices:c}}function bi(t,e,n,r){void 0===r&&(r=0);const i=t.attributes.position.array,s=i.length;let a;if(xi.setStyle(e),_i.setStyle(n),Array.isArray(r)){let t=0;for(let e=0,n=r.length;e<n;e++){const{count:n}=r[e].position;t+=3*n}a=new Float32Array(t)}else a=new Float32Array(i.length);if(Array.isArray(r))for(let t=0,e=r.length;t<e;t++){const{middleZ:e,start:n,end:o}=r[t].position;for(let t=n;t<o;t+=3){i[t+2]>e?(a[t]=_i.r,a[t+1]=_i.g,a[t+2]=_i.b):(a[t]=xi.r,a[t+1]=xi.g,a[t+2]=xi.b)}}else for(let t=0;t<s;t+=3){i[t+2]>r?(a[t]=_i.r,a[t+1]=_i.g,a[t+2]=_i.b):(a[t]=xi.r,a[t+1]=xi.g,a[t+2]=xi.b)}return In(t,"color",new o.BufferAttribute(a,3,!0)),a}function Ei(e,n,r,i,o=!1){if(!e)return null;let s=[];if(e instanceof t.MultiPolygon)s=e.getGeometries().map((t=>Ii(t,n,r||e.getCenter(),i,o)));else if(e instanceof t.Polygon){const t=Ii(e,n,r||e.getCenter(),i,o);s.push(t)}else if(zn(e))if(qn(e)){const t=Yn(e);for(let a=0,u=t.length;a<u;a++)s.push(Ii(t[a],n,r||Wn(e),i,o))}else{const t=Ii(e,n,r||Wn(e),i,o);s.push(t)}return s}function Ii(e,n,r,i,o=!1){let s,a,u;if(zn(e)){const t=Hn(e);s=t[0],a=t.slice(1,t.length),r=r||Wn(e)}else e instanceof t.Polygon&&(s=e.getShell(),a=e.getHoles(),r=r||e.getCenter());i=i||n.coordinateToVector3(r),u=o?n.coordinatiesToGLFloatArray(s,i).positons2d:n.coordinatiesToGLArray(s,i);const l=[o?u.buffer:u];if(a&&a.length>0)for(let t=0,e=a.length;t<e;t++){let e;e=o?n.coordinatiesToGLFloatArray(a[t],i).positons2d:n.coordinatiesToGLArray(a[t],i),l.push(o?e.buffer:e)}return l}function Ci(e){if(!e)return null;let n=[];if(e instanceof t.MultiPolygon)n=e.getGeometries().map((t=>Si(t,!1)));else if(e instanceof t.Polygon){const t=Si(e,!1);n.push(t)}else if(zn(e))if(qn(e)){const t=Yn(e);for(let e=0,r=t.length;e<r;e++)n.push(Si(t[e],!0))}else{const t=Si(e,!0);n.push(t)}return n}function Si(e,n){let r,i;if(n){const t=Hn(e);r=t[0],i=t.slice(1,t.length)}else e instanceof t.Polygon&&(r=e.getShell(),i=e.getHoles());const o=[vi(r)];if(i&&i.length>0)for(let t=0,e=i.length;t<e;t++){const e=vi(i[t]);o.push(e)}return o}const Mi=new Map,Bi=new o.Vector3;function Ti(e,n,r,i=!0){let s,a,u=[];if(Array.isArray(e)&&e[0]instanceof o.Vector3)u=e;else{Array.isArray(e)&&(e=new t.LineString(e));const o=0;let l,h;Gn(e)?(l=Hn(e),r||(h=Wn(e))):e instanceof t.LineString&&(l=e.getCoordinates(),r||(h=e.getCenter()));const c=n.coordinateToVector3(r||h);if(i){Mi.clear();for(let t=0,e=l.length;t<e;t++){const e=l[t],r=e.z||e[2]||0;if(!Mi.has(r)){const t=n.altitudeToVector3(r,r,null,Bi).x;Mi.set(r,t)}const i=n.coordinateToVector3(e,o).sub(c);i.z+=Mi.get(r)||0,u.push(i)}}else{const t=n.coordinatiesToGLFloatArray(l,c,!0);s=t.positions,a=t.positons2d}}if(!i)return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer};a=new Float32Array(2*u.length),s=new Float32Array(3*u.length);for(let t=0,e=u.length;t<e;t++){const e=3*t,n=u[t];s[e]=n.x,s[e+1]=n.y,s[e+2]=n.z;const r=2*t;a[r]=n.x,a[r+1]=n.y}return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer}}function ki(t,e,n,r){const i=[],o=[],s=[];let a,u;for(let n=0,l=t.length;n<l;n++){const l=t[n];for(let t=0,n=l.length;t<n;t++){const n=l[t],h=n.join(",").toString();a?(h!==a&&(u=e.coordinateToVector3(n,0).sub(r),i.push(u.x,u.y,u.z),o.push(u),s.push(n)),a=h):(s.push(n),a=h,u=e.coordinateToVector3(n,0).sub(r),i.push(u.x,u.y,u.z),o.push(u))}}return{positions:i,positionsV:o,lnglats:s}}function Pi(t){let e;const n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];for(let t=0,r=i.length;t<r;t++){const r=i[t],o=r.join(",").toString();e?(o!==e&&n.push(r),e=o):(n.push(r),e=o)}}return n}function Li(t,e=1,n=1,r=!1,i,o){const s=Ti(t,i,o).positionsV,a=[];for(let t=0,e=s.length;t<e;t++){const e=s[t];a.push([e.x,e.y,e.z])}const{indices:u,position:l,normal:h,uv:c}=Fr([a],{lineWidth:e,depth:n,pathUV:r});return{position:l,normal:h,indices:u,uv:c}}function Ri(t,e=1,n=1,r,i){const o=Ti(t,r,i).positionsV,s=[];for(let t=0,e=o.length;t<e;t++){const e=o[t];s.push([e.x,e.y,e.z])}const{indices:a,position:u,normal:l,uv:h}=li([s],{lineWidth:e,cornerRadius:n});return{position:u,normal:l,indices:a,uv:h}}function Di(e){let n,r=[];return e instanceof t.MultiLineString?(r=e.getGeometries(),n=e.getCenter()):e instanceof t.LineString?(r.push(e),n=e.getCenter()):Gn(e)&&(n=Wn(e),qn(e)?r=Yn(e):r.push(e)),{lineStrings:r,center:n}}function Oi(t){const e=new Float32Array(2*t.length-6);let n=0;for(let r=0,i=t.length/3;r<i;r++){const o=t[3*r],s=t[3*r+1],a=t[3*r+2];if(r>0&&r<i-1){const t=3*n;e[t]=o,e[t+1]=s,e[t+2]=a,n++}const u=3*n;e[u]=o,e[u+1]=s,e[u+2]=a,n++}return e}function Ni(t){let e=0;const n=t.length;if(1===n)return t[0];for(let r=0;r<n;r++)e+=t[r].length;const r=new Float32Array(e);let i=0;for(let e=0;e<n;e++)r.set(t[e],i),i+=t[e].length;return r}function Fi(e,n){return e instanceof t.LineString?vi(e.getCoordinates(),n):jn(e)?vi(e.geometry.coordinates,n):void 0}let Ui;function Qi(){return Ui||(Ui=new o.BufferGeometry,In(Ui,"position",new o.BufferAttribute(new Float32Array(3),3))),Ui}let Gi;var zi;function ji(){return t.worker||console.error("maptalks.worker is not defined,You can't use ThreeVectorTileLayer"),!zi&&Gi&&(zi=new Gi("__maptalks.three__")),zi}function Vi(t,e,n={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===n[t]&&(n[t]=e.distanceToVector3(t,t).x),n[t]):0}function qi(t,e,n={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===n[t]&&(n[t]=e.altitudeToVector3(t,t).x),n[t]):0}function Hi(t,e){return e?Object.assign({},e,t):t||{}}function Wi(t,e,n,r,i=[],o){const s=n.isMercator();let a,u,l;if(s){const t=n.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=n.coordinateToVector3(e));const h=[],c=[],f={},p={},d=t.length;for(let a=0;a<d;a++){const u=t[a];let d=i[a]?i[a]:Ai(r[a]);d=Hi(d,o),e||(l=n.coordinateToVector3(d.center));let g=d.width||1,y=d.height||1,v=d.cornerRadius||0,m=d.bottomHeight||0;const A=d.pathUV,_=d.parentCenter;g=Vi(g,n,f),v=Vi(v,n,f),y=qi(y,n,p),m=qi(m,n,p);const x=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];let i;i=s?Fi(r,n):Ti(r,n,_||e,!1).arrayBuffer,c.push(i),x.push(i)}const w={id:d.id,data:x,height:y,width:g,cornerRadius:v,bottomHeight:m,pathUV:A};s&&(w.center=[l.x,l.y]),h.push(w)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function Yi(t,e,n,r,i=[],o){const s=n.isMercator();let a,u,l;if(s){const t=n.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=n.coordinateToVector3(e));const h=[],c=[],f={},p=t.length;for(let a=0;a<p;a++){const u=t[a];let p=i[a]?i[a]:Ai(r[a]);p=Hi(p,o),e||(l=n.coordinateToVector3(p.center));let d=p.bottomHeight||0;d=qi(d,n,f);const g=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];if(s){const t=Fi(r,n);c.push(t),g.push(t)}else{const t=Ti(r,n,e,!1).arrayBuffer;c.push(t),g.push(t)}}const y={id:p.id,data:g,bottomHeight:d};s&&(y.center=[l.x,l.y]),h.push(y)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function Xi(t){return t.map((t=>t.data))}function Ji(t){return t.map((t=>t.option||t.baseObject.getOptions()))}t.worker&&(Gi=class extends t.worker.Actor{test(t,e){this.send(t,null,e)}pushQueue(t={}){const{type:e,data:n,callback:r,layer:i,key:o,center:s,lineStrings:a,options:u,id:l,baseOptions:h}=t;let c;e.indexOf("ExtrudePolygon")>-1?c=function(t=[],e,n,r=[],i){const o=n.isMercator();let s,a,u;if(o){const t=n.getMap();s=t.getGLRes(),a=t.getSpatialReference().getTransformation().matrix}e&&(u=n.coordinateToVector3(e));const l=t.length,h=[],c=[],f={};for(let s=0;s<l;s++){const a=t[s],l=a;let p,d=r[s]?r[s]:mi(l);d=Hi(d,i),e||(u=n.coordinateToVector3(d.center)),p=o?Ci(a):Ei(a,n,d.center||e,u,!0);for(let t=0,e=p.length;t<e;t++){const e=p[t];for(let t=0,n=e.length;t<n;t++)c.push(e[t])}let g=d.height||1,y=d.bottomHeight||0;const v=d.top;g=qi(g,n,f),y=qi(y,n,f);const m={id:d.id,data:p,height:g,bottomHeight:y,top:v};o&&(m.center=[u.x,u.y]),h.push(m),l._properties&&delete l._properties}return{datas:h,transfer:c,glRes:s,matrix:a,center:o?[u.x,u.y]:null}}(n,s,i,u,h):"ExtrudeLines"===e||"Paths"===e?c=Wi(n,s,i,a,u,h):"Point"===e||("Line"===e||"FatLine"===e||"Lines"===e||"FatLines"===e?c=Yi(n,s,i,a,u,h):"ExtrudeLine"===e||"Path"===e?c=Wi(n,s,i,a,u,h):"Bar"!==e&&"Bars"!==e||(c=function(t){const e=t.length,n=new Float32Array(7*e);let r=0;for(let i=0;i<e;i++){let{center:e,radialSegments:o,radius:s,height:a,altitude:u,id:l}=t[i];e=e||[0,0],n[r]=e[0],n[r+1]=e[1],n[r+2]=o||6,n[r+3]=s||1,n[r+4]=a,n[r+5]=u||0,n[r+6]=l,r+=7}const i=n.buffer;return{datas:i,transfer:[i]}}(n))),c?this.send({type:e,datas:c.datas,glRes:c.glRes,matrix:c.matrix,center:c.center},c.transfer,(function(t,e){t&&console.error(t),e.key=o,e.id=l,r(e)})):console.error(`No processing logic found for type:${e}`)}});class Ki{constructor(){this.queueMap={},this.tempQueue=[],this.time=this.getCurrentTime(),this.deQueueCount=5,this.resultQueue=[]}getActor(){return ji()}getCurrentTime(){return t.Util.now()}loop(){this.deQueue()}push(t){return this.tempQueue.push(t),t.id&&(this.queueMap[t.id]=t),this}reset(){return this.time=this.getCurrentTime(),this.tempQueue=[],this}pushResult(t){if(t)return Array.isArray(t)||(t=[t]),t.forEach((t=>{this.resultQueue.push(t)})),this}deQueue(){if(!this.resultQueue.length)return this;const t=this.deQueueCount;return(this.resultQueue.slice(0,t)||[]).forEach((t=>{const{id:e}=t;if(this.queueMap[e]){const{baseObject:n}=this.queueMap[e];if(n&&n._workerLoad){n.getLayer()?n._workerLoad(t):console.warn(n," worker Processing completed but removed from the layer")}delete this.queueMap[e]}})),this.resultQueue.splice(0,t),this}}const Zi=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"ExtrudePolygon",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},$i=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudePolygons",layer:e.layer,data:e.data,key:e.key,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},to=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"ExtrudeLine",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},eo=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudeLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},no=new class extends Ki{constructor(){super(),this.deQueueCount=200}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"Line",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},ro=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Lines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},io=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"FatLine",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},oo=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"FatLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},so=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"Bar",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},ao=new class extends Ki{constructor(){super(),this.deQueueCount=1}loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Bars",layer:e.layer,data:e.data,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},uo=new class extends Ki{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){ji().pushQueue({type:"Path",layer:this.tempQueue[0].layer,data:Xi(this.tempQueue),options:Ji(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},lo=new class extends Ki{loop(){if(this.tempQueue.length){const t=ji();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Paths",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},ho={isRunning:!1,tasks:[],addTask:t=>{t&&ho.tasks.push(t)},removeTask:t=>{const e=ho.tasks.indexOf(t);e>-1&&ho.tasks.splice(e,1)},loop(){Zi.loop(),$i.loop(),to.loop(),eo.loop(),no.loop(),ro.loop(),io.loop(),oo.loop(),so.loop(),ao.loop(),uo.loop(),lo.loop(),ho.tasks.forEach((t=>{t&&t.loop&&t.loop()})),requestAnimationFrame(ho.loop)},star(){ho.isRunning||(ho.isRunning=!0,ho.loop())}};function co(t){const{position:e,normal:n,uv:r,indices:i}=fo(t),s=new o.BufferGeometry,a=new Float32Array(e.length);return a.fill(1,0,e.length),In(s,"color",new o.BufferAttribute(a,3)),In(s,"normal",new o.BufferAttribute(n,3)),In(s,"position",new o.BufferAttribute(e,3)),r&&r.length&&In(s,"uv",new o.BufferAttribute(r,2)),s.setIndex(new o.BufferAttribute(i,1)),s}function fo(t){const e={},n={};for(let r=0;r<t.length;++r){const i=t[r];for(const t in i)void 0===e[t]&&(e[t]=[],n[t]=0),e[t].push(i[t]),n[t]+=i[t].length}const r={};let i=0;const o=new Uint32Array(n.indices);for(const t in e)if("indices"===t){const n=e[t];let r=0;for(let t=0,s=n.length;t<s;t++){const s=n[t];for(let t=0,e=s.length;t<e;t++)o[r]=s[t]+i,r++;i+=e.position[t].length/3}}else{const i=po(e[t],n[t]);if(!i)return null;r[t]=i}return r.indices=o,r}function po(t,e){const n=new Float32Array(e);let r=0;for(let e=0;e<t.length;++e)n.set(t[e],r),r+=t[e].length;return n}function go(t){const{position:e,normal:n,uv:r,indices:i}=t,s=new o.BufferGeometry;return In(s,"normal",new o.BufferAttribute(new Float32Array(n),3)),In(s,"position",new o.BufferAttribute(new Float32Array(e),3)),In(s,"uv",new o.BufferAttribute(new Float32Array(r),2)),s.setIndex(new o.BufferAttribute(new Uint32Array(i),1)),s}function yo(t){const e=new o.BufferGeometry;return In(e,"normal",t.getAttribute("normal")),In(e,"position",t.getAttribute("position").clone()),e.setIndex(t.getIndex()),e}let vo;function mo(){if(!vo){const t=1e-6;vo=Mn(t,t,t)}return vo}mo();const Ao=Mn(1,1,1);Ao.translate(0,0,.5);const _o=new o.Color("#fff"),xo=new o.Color("#fff");function wo(t){const{position:e,normal:n,uv:r,indices:i}=function(t,e){e=Object.assign({},{radius:1,height:2,radialSegments:6},e);const n=Math.round(Math.max(4,e.radialSegments));let{radius:r,height:i}=e;const o=360/n/360*Math.PI*2,s=n+1,a=new Float32Array(3*s*2),[u,l]=t;let h=0,c=0;const f=3*s,p=2*s,d=[],g=[];let y=d.length-1;for(let t=-1;t<n;t++){const e=o*t,n=Math.cos(e)*r+u,s=Math.sin(e)*r+l;a[h]=n,a[h+1]=s,a[h+2]=0,a[h+f]=n,a[h+1+f]=s,a[h+2+f]=i;let v=0,m=0;v=.5+n/r/2,m=.5+s/r/2,g[c]=v,g[c+1]=m,g[c+p]=v,g[c+1+p]=m,h+=3,c+=2,t>1&&(d[++y]=0,d[++y]=t-1,d[++y]=t)}h-=3,a[h]=a[0],a[h+1]=a[1],a[h+2]=a[2];const v=a.length;a[v-3]=a[0],a[v-2]=a[1],a[v-1]=i;const m=d.length;y=d.length-1;for(let t=0;t<m;t++){const e=d[t];d[++y]=e+s}const A=new Float32Array(2*(3*s*2-6));let _=-1;h=2*s,c=0,y=d.length-1;let x=g.length-1;for(let t=0,e=a.length/2;t<e-3;t+=3){const e=a[t],n=a[t+1],o=a[t+3],u=a[t+4];A[++_]=e,A[++_]=n,A[++_]=i,A[++_]=o,A[++_]=u,A[++_]=i,A[++_]=e,A[++_]=n,A[++_]=0,A[++_]=o,A[++_]=u,A[++_]=0;const l=h+2,f=h+3,p=h,v=h+1;d[++y]=p,d[++y]=l,d[++y]=v,d[++y]=l,d[++y]=f,d[++y]=v,h+=4;const m=c/s,w=(c+1)/s;g[++x]=m,g[++x]=i/r/2,g[++x]=w,g[++x]=i/r/2,g[++x]=m,g[++x]=0,g[++x]=w,g[++x]=0,c++}const w=new Float32Array(a.length+A.length);w.set(a,0),w.set(A,a.length);const b=Tr(d,w);return{points:a,indices:new Uint32Array(d),position:w,normal:b,uv:new Float32Array(g)}}(t.center||[0,0],t),s=new o.BufferGeometry;return In(s,"normal",new o.BufferAttribute(n,3)),In(s,"position",new o.BufferAttribute(e,3)),In(s,"uv",new o.BufferAttribute(r,2)),s.setIndex(new o.BufferAttribute(i,1)),s}function bo(t){const e=Object.assign({},t);return e._radius&&(e.radius=e._radius),wo(e)}function Eo(t,e,n,r="y",i=0){let s=0;"y"===r?s=1:"z"===r&&(s=2);const a=t.attributes.position.array,u=a.length;xo.setStyle(e),_o.setStyle(n);const l=new Float32Array(u);if(Array.isArray(i))for(let t=0,e=i.length;t<e;t++){const{middleZ:e,start:n,end:r}=i[t].position;for(let t=n;t<r;t+=3){a[t+2]>e?(l[t]=_o.r,l[t+1]=_o.g,l[t+2]=_o.b):(l[t]=xo.r,l[t+1]=xo.g,l[t+2]=xo.b)}}else for(let t=0;t<u;t+=3){a[t+s]>i?(l[t]=_o.r,l[t+1]=_o.g,l[t+2]=_o.b):(l[t]=xo.r,l[t+1]=xo.g,l[t+2]=xo.b)}return In(t,"color",new o.BufferAttribute(l,3,!0)),l}function Io(t){const e=[],n=t.length;let r=0;for(let e=0;e<n;e++){const{color:n}=t[e].attributes;n&&(r+=n.array.length)}const i=new Float32Array(r);let s=0;for(let n=0,r=t.length;n<r;n++){const{color:r,normal:o,position:a,uv:u}=t[n].attributes,l=t[n].index;r&&(i.set(r.array,s),s+=r.array.length),e.push({normal:o.array,uv:u.array,position:a.array,indices:l.array})}const a=co(e);i.length&&In(a,"color",new o.BufferAttribute(i,3,!0));for(let e=0,n=t.length;e<n;e++)t[e].dispose();return a}function Co(){return Ao}const So={radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class Mo extends Fn{constructor(e,n,r,i){n=t.Util.extend({},So,n,{layer:i,coordinate:e}),super(),this._initOptions(n);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l,asynchronous:h}=n;let c;if(n.height=i.altitudeToVector3(o,o).x,n.radius=i.distanceToVector3(s,s).x,h){c=mo();const e=t.Util.GUID();this.getOptions().id=e,so.push({data:{radius:n.radius,height:n.height,radialSegments:n.radialSegments,id:e},layer:i,id:e,baseObject:this})}else c=bo(n),a&&(Eo(c,u,a,"z",n.height/2),r.vertexColors=Sn());this._createMesh(c,r);const f=i.altitudeToVector3(l,l).x,p=i.coordinateToVector3(e,f);this.getObject3d().position.copy(p),this.type="Bar"}_workerLoad(t){const e=go(t),{topColor:n,bottomColor:r,height:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(n){Eo(e,r,n,"z",this.getLayer().altitudeToVector3(i,i).x/2),s.vertexColors=Sn()}o.geometry=e,o.material.needsUpdate=!0,this._fire("workerload",{target:this})}}function Bo(t){const e=[];return t&&t.length&&t.forEach((t=>{t=t instanceof o.Color?t:new o.Color(t),e.push(t.r,t.g,t.b)})),e}const To={altitude:0,bottomHeight:0,colors:null};class ko extends Fn{constructor(e,n,r,i){n=t.Util.extend({},To,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{lineStrings:s,center:a}=Di(e),{asynchronous:u}=n;let l;if(u){l=Qi();const r=t.Util.GUID();this.getOptions().id=r,this.getOptions().center=a,no.push({id:r,data:s,layer:i,key:n.key,lineString:e,baseObject:this})}else{const t=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],{positions:r}=Ti(n,i,a,!1);t.push(Oi(r))}const e=Ni(t);l=new o.BufferGeometry,In(l,"position",new o.BufferAttribute(e,3)),pi(l,n.bottomHeight,i);const u=Bo(n.colors);u&&u.length&&(In(l,"color",new o.Float32BufferAttribute(u,3)),r.vertexColors=Sn())}this._createLineSegments(l,r);const{altitude:h}=n,c=i.altitudeToVector3(h,h).x,f=i.coordinateToVector3(a,c);this.getObject3d().position.copy(f),this.type="Line"}_workerLoad(t){const e=new o.BufferGeometry;In(e,"position",new o.BufferAttribute(new Float32Array(t.position),3));const n=Bo(this.getOptions().colors),r=this.getObject3d(),i=r.material;n&&n.length&&(In(e,"color",new o.Float32BufferAttribute(n,3)),i.vertexColors=Sn()),this._computeLineDistances(e),r.geometry=e,r.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Po={bottomHeight:0,width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0,pathUV:!1};class Lo extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Po,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{height:o,width:s,bottomColor:a,topColor:u,bottomHeight:l,altitude:h,asynchronous:c,pathUV:f}=n,p=i.altitudeToVector3(o,o).x,d=i.distanceToVector3(s,s).x,{lineStrings:g,center:y}=Di(e);let v;if(c){v=mo();const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=y,to.push({id:n,data:g,layer:i,center:y,lineString:e,baseObject:this})}else{const t=[];let e=0;const n={};for(let r=0,o=g.length;r<o;r++){const o=Li(g[r],d,p,f,i,y);e=pi(o,l,i,n),t.push(o)}v=co(t),u&&(bi(v,a,u,e+p/2),r.vertexColors=Sn())}this._createMesh(v,r);const m=i.altitudeToVector3(h,h).x,A=i.coordinateToVector3(y,m);this.getObject3d().position.copy(A),this.type="ExtrudeLine"}_workerLoad(t){const e=go(t),{topColor:n,bottomColor:r,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(n){const t=this.getLayer();bi(e,r,n,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=Sn()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Ro={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0,top:!0};class Do extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Ro,n,{layer:i,polygon:e}),super(),this._initOptions(n);const{height:s,topColor:a,bottomColor:u,altitude:l,bottomHeight:h,asynchronous:c,top:f}=n;let p;const d=zn(e)?Wn(e):e.getCenter();if(c){p=mo();const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=d,Zi.push({data:e,layer:i,id:n,baseObject:this})}else{p=function(t,e,n,r,i){const{position:s,normal:a,uv:u,indices:l}=wi(t,e,n,r,i),h=new Float32Array(s.length);h.fill(1,0,s.length);const c=new o.BufferGeometry;return In(c,"color",new o.BufferAttribute(h,3)),In(c,"normal",new o.BufferAttribute(a,3)),In(c,"position",new o.BufferAttribute(s,3)),In(c,"uv",new o.BufferAttribute(u,2)),c.setIndex(new o.BufferAttribute(l,1)),c}(e,s,f,i);const t=pi(p,h,i);if(a){bi(p,u,a,t+i.altitudeToVector3(s,s).x/2),r.vertexColors=Sn()}}this._createMesh(p,r);const g=i.altitudeToVector3(l,l).x,y=i.coordinateToVector3(d,g);this.getObject3d().position.copy(y),this.type="ExtrudePolygon"}_workerLoad(t){const e=go(t),{topColor:n,bottomColor:r,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(n){const t=this.getLayer();bi(e,r,n,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=Sn()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Oo={altitude:0,coordinate:null};class No extends Fn{constructor(e,n={},r){n.coordinate||(console.warn("coordinate is null,it is important to locate the model"),n.coordinate=r.getMap().getCenter()),n=t.Util.extend({},Oo,n,{layer:r,model:e}),super(),this._initOptions(n),this._createGroup(),this.getObject3d().add(e);const{altitude:i,coordinate:o}=n,s=r.altitudeToVector3(i,i).x,a=r.coordinateToVector3(o,s);this.getObject3d().position.copy(a),this.type="Model"}getCoordinates(){const e=this.options.coordinate,n=this.options.altitude,r=new t.Coordinate(e);return r.z=n,r}}const Fo=Math.PI/180;function Uo(t){return t*Fo}function Qo(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());let n=Uo(t[1]);const r=Uo(e[1]),i=n-r,o=Uo(t[0])-Uo(e[0]);return n=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(n)*Math.cos(r)*Math.pow(Math.sin(o/2),2))),n*=6378137,Math.round(1e5*n)/1e5}function Go(t,e){const{len:n,c1:r,c2:i}=t,o=i[0]-r[0],s=i[1]-r[1],a=e/n;return[r[0]+a*o,r[1]+a*s]}const zo=1e3;const jo={trail:5,chunkLength:50,width:2,height:1,speed:1,altitude:0,interactive:!1,heightEnable:!0,pathUV:!1};class Vo extends Fn{constructor(e,n,r,i){n=t.Util.extend({},jo,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{width:s,height:a,altitude:u,speed:l,chunkLength:h,trail:c,pathUV:f}=n;let p,d;Gn(e)?(p=Wn(e),d=Hn(e)):(p=e.getCenter(),d=e);const g=function(t,e=10){e=Math.max(e,.1),Array.isArray(t)||(t=t.getCoordinates().map((t=>t.toArray())));const n=t.length;let r=[],i=0;for(let e=0;e<n-1;e++){const n=Qo(t[e],t[e+1]),o=Math.floor(n);r.push({c1:t[e],len:o,c2:t[e+1]}),i+=o}if(i<=e)return r.map((t=>[t.c1,t.c2]));if(1===r.length&&r[0].len<=e)return[[r[0].c1,r[0].c2]];const o=r.length;let s,a=0,u=0;const l=[];let h=[r[0].c1];for(;a<o;){const{len:t,c2:n}=r[a];if(u+=t,u<e&&(h.push(n),a===o-1&&l.push(h),a++),u===e&&(h.push(n),u=0,l.push(h),h=[n],a++),u>e){const n=t-u+e;s=Go(r[a],n),h.push(s),l.push(h),u=0,r[a].c1=s,r[a].len=t-n,h=[],h.push(s)}}return l}(d,h),y=i.coordinateToVector3(p),v=new o.BufferGeometry,m=new Float32Array(3e3),A=new Float32Array(3e3),_=new Uint16Array(zo);In(v,"position",new o.BufferAttribute(m,3)),In(v,"normal",new o.BufferAttribute(A,3)),v.setIndex(new o.BufferAttribute(_,1));const x=i.distanceToVector3(s,s).x,w=i.altitudeToVector3(a,a).x;this._createMesh(v,r);const b=i.altitudeToVector3(u,u).x,E=i.coordinateToVector3(p,b);this.getObject3d().position.copy(E),this._params={index:0,chunkLines:g,geometries:[],layer:i,trail:Math.max(1,c),lineWidth:x,depth:w,speed:Math.min(1,l),idx:0,loaded:!0,center:p,centerPt:y,workerInitCount:0,pathUV:f},this._init(this._params),this.type="ExtrudeLineTrail"}_init(e){const{layer:n,trail:r,lineWidth:i,depth:o,chunkLines:s,positionMap:a,centerPt:u,center:l,pathUV:h}=e,c=s.length,f=[];if(this.options.asynchronous){e.loaded=!1;const i=t.Util.GUID();for(let e=0;e<c;e++){const o={type:"Feature",geometry:{type:"LineString",coordinates:Pi(s.slice(e,e+r))}},a=`${i}-${e}`,u=t.Util.extend({},this.options);u.parentCenter=l,u.id=a,u.center=l,to.push({id:a,data:[o],layer:n,center:l,lineString:o,baseObject:this,option:u})}}else for(let t=0;t<c;t++){const e=ki(s.slice(t,t+r),n,0,u).positionsV;f.push(Li(e,i,o,h,n))}}_animation(){const{index:t,geometries:e,speed:n,idx:r,chunkLines:i,trail:o,lineWidth:s,depth:a,loaded:u,layer:l,positionMap:h,centerPt:c,pathUV:f}=this._params;if(!u)return;const p=Math.round(t);if(p>r&&p<=i.length-1){this._params.idx++;let t=e[p];if(!t){t=Li(ki(i.slice(p,p+o),l,0,c).positionsV,s,a,f,l),e[p]=t}const n=this.getObject3d();!function(t,e,n,r){const i=e.length;t.attributes.normal.count=i,t.attributes.position.count=i;const o=t.attributes.position.array,s=t.attributes.normal.array;for(let t=0;t<i;t++)o[t]=e[t],s[t]=n[t];t.index.count=r.length;for(let e=0,n=r.length;e<n;e++)t.index.array[e]=r[e]}(n.geometry,t.position,t.normal,t.indices),n.geometry.attributes.position.needsUpdate=!0,n.geometry.attributes.normal.needsUpdate=!0,n.geometry.index.needsUpdate=!0}t>=i.length-1&&(this._params.index=-1,this._params.idx=-1),this._params.index+=n}_workerLoad(e){if(!e)return this;const{id:n,indices:r,position:i,normal:o,uv:s}=e;if(!(n&&r&&i&&o&&s))return;let a=n.split("-")[1];if(a=parseInt(a),t.Util.isNumber(a)){this._params.geometries[a]={indices:new Uint32Array(r),position:new Float32Array(i),uv:new Float32Array(s),normal:new Float32Array(o)},this._params.workerInitCount++}this._params.workerInitCount===this._params.chunkLines.length&&(this._params.loaded=!0,this._fire("workerload",{target:this}))}}const qo=["click","mousemove","mousedown","mouseup","dblclick","contextmenu"].join(" ").toString(),Ho=new o.MeshBasicMaterial;Ho.vertexColors=Sn();const Wo=t=>class extends t{_initBaseObjectsEvent(t){if(t&&Array.isArray(t)&&t.length)for(let e=0,n=t.length;e<n;e++){const n=t[e];this._proxyEvent(n)}return this}_proxyEvent(t){t.on("add",(t=>{this._showGeometry(t.target,!0)})),t.on("remove",(t=>{this._showGeometry(t.target,!1)})),t.on("mouseout",(t=>{this._mouseover=!1,this.fire("mouseout",Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))})),t.on(qo,(t=>{this.fire(t.type,Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))}))}_getHideGeometryIndex(t){const e=[];let n=0;for(let r=0,i=this._geometriesAttributes.length;r<i;r++)!0===this._geometriesAttributes[r].hide&&(e.push(r),n+=this._geometriesAttributes[r][t].count);return{indexs:e,count:n}}_updateAttribute(t,e){const{indexs:n}=this._getHideGeometryIndex(e),r=this._geometryCache.attributes[e].array,i=r.length;for(let e=0;e<i;e++)t.array[e]=r[e];let s=NaN;this.getObject3d()instanceof o.LineSegments&&(s=0);for(let r=0;r<n.length;r++){const i=n[r],{start:o,end:a}=this._geometriesAttributes[i][e];for(let e=o;e<a;e++)t.array[e]=s}return this}_showGeometry(t,e){let n;if(t&&(n=t.getOptions().index),null!=n){const t=this._geometriesAttributes[n],{hide:r}=t;if(r===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.position,"position"),i.attributes.position.needsUpdate=!0,this.isHide=e}return this}getSelectMesh(){const t=this._getIndex();if(null!=t)return{data:this._datas[t],baseObject:this._baseObjects[t]}}_getIndex(t){return null==t&&(t=this.faceIndex||this.index),t}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:n}=this,r=n.length,i=di(n);let s=0;for(let t=0;t<r;t++){const r=e.getColor(),o=r.getHex();this._colorMap[o]=t;const{count:a}=n[t].position;this._datas[t].colorIndex=o;for(let t=0;t<a;t++)i[s]=r.r,i[s+1]=r.g,i[s+2]=r.b,s+=3}In(t,"color",new o.BufferAttribute(i,3,!0));const a=e.getColor().getHex(),u=new o.Mesh(t,Ho);u.position.copy(this.getObject3d().position),u._colorIndex=a,this.setPickObject3d(u)}},Yo={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61",top:!0},Xo=new t.Coordinate(0,0);class Jo extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=e.length;0===o&&console.error("polygons is empty");let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let n=0;n<o;n++){const r=e[n],i=r.getCenter?r.getCenter():Wn(r,Xo);let o,h;Array.isArray(i)?(o=i[0],h=i[1]):i instanceof t.Coordinate&&(o=i.x,h=i.y),s=Math.min(s,o),a=Math.min(a,h),u=Math.max(u,o),l=Math.max(l,h)}const h=new t.Coordinate((s+u)/2,(a+l)/2);n=t.Util.extend({},Yo,n,{layer:i,polygons:e,coordinate:h});const{topColor:c,bottomColor:f,altitude:p,asynchronous:d,top:g}=n;let y;const v=[],m=[];if(super(),d)y=mo(),$i.push({id:t.Util.GUID(),layer:i,key:n.key,center:h,data:e,baseObject:this,option:n});else{const s=i.coordinateToVector3(h),a=[];let u=0;const l={};for(let r=0;r<o;r++){const o=e[r],c=t.Util.extend({},n,mi(o)),f=c.height||1,p=c.bottomHeight||0,d=wi(o,f,g,i,h,s,l);a.push(d);const y=pi(d,p,i,l),{position:v,normal:A,uv:_,indices:x}=d;x.length;const w=v.length/3;A.length,_.length,m[r]={position:{middleZ:y+l[f]/2,count:w,start:u,end:u+3*w},hide:!1},u+=3*w}y=co(a),c&&(bi(y,f,c,m),r.vertexColors=Sn())}this._initOptions(n),this._createMesh(y,r);const A=i.altitudeToVector3(p,p).x,_=i.coordinateToVector3(h,A);this.getObject3d().position.copy(_),this._baseObjects=v,this._datas=e,this._geometriesAttributes=m,this.faceIndex=null,this._geometryCache=yo(y),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(v),d||(this._setPickObject3d(),this._init()),this.type="ExtrudePolygons"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,zn(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new Do(e,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);this._geometryCache=yo(n);const{topColor:r,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(r&&(bi(n,i,r,e),s.vertexColors=Sn()),o.geometry=n,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}function Ko(t,e,n){const r=t.project(n),i=e.width/2,o=e.height/2;return{x:Math.round(r.x*i+i),y:Math.round(-r.y*o+o)}}const Zo={altitude:0,height:0,color:null},$o=new o.Vector3;class ts extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Zo,n,{layer:i,coordinate:e}),super();let{height:s,altitude:a,color:u,size:l}=n;const h=[],c=[];u&&(u=u instanceof o.Color?u:new o.Color(u),c.push(u.r,u.g,u.b));const f=i.altitudeToVector3(s,s).x,p=i.coordinateToVector3(e,f);h.push(0,0,p.z);const d=new o.BufferGeometry;In(d,"position",new o.Float32BufferAttribute(h,3,!0)),c.length&&In(d,"color",new o.Float32BufferAttribute(c,3,!0)),void 0!==l&&In(d,"size",new o.Float32BufferAttribute([l],1,!0)),n.positions=p,this._initOptions(n),this._createPoints(d,r);const g=i.altitudeToVector3(a,a).x,y=new o.Vector3(p.x,p.y,g);this.getObject3d().position.copy(y),this.type="Point"}identify(t){const e=this.getLayer(),n=this.getMap().getSize(),r=this.getLayer().getCamera(),i=this.getOptions().positions,o=this.getOptions().altitude;let s=this.getObject3d().material.size;void 0===s&&(s=this.options.size||1);const a=this.getMap().coordToContainerPoint(t),u=e.altitudeToVector3(o,o).x;$o.x=i.x,$o.y=i.y,$o.z=i.z+u;const l=Ko($o,n,r);return Math.sqrt(Math.pow(a.x-l.x,2)+Math.pow(a.y-l.y,2))<=s/2}}function es(t,e){const{minx:n,miny:r,maxx:i,maxy:o}=t,[s,a]=e;return n<=s&&s<=i&&r<=a&&a<=o}class ns{constructor(t,e,n,r){this.minlng=t,this.minlat=e,this.maxlng=n,this.maxlat=r,this.minx=1/0,this.miny=1/0,this.maxx=-1/0,this.maxy=-1/0,this.coordinates=[],this.positions=[],this.indexs=[],this.key=null}updateBBoxPixel(e){let n=1/0,r=1/0,i=-1/0,o=-1/0;const{minlng:s,minlat:a,maxlng:u,maxlat:l}=this;return[[s,a],[s,l],[u,a],[u,l]].map((e=>new t.Coordinate(e))).map((t=>e.coordToContainerPoint(t))).forEach((t=>{n=Math.min(n,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y)})),this.minx=n,this.miny=r,this.maxx=i,this.maxy=o,this}containsCoordinate(e){let n,r;Array.isArray(e)?(n=e[0],r=e[1]):e instanceof t.Coordinate&&(n=e.x,r=e.y);const{minlng:i,minlat:o,maxlng:s,maxlat:a}=this;return i<=n&&n<=s&&o<=r&&r<=a}isRecCross(t,e){const{x:n,y:r}=t,i={minx:n-e/2,miny:r-e/2,maxx:n+e/2,maxy:r+e/2},{minx:o,miny:s,maxx:a,maxy:u}=i;return!!(es(this,[o,s])||es(this,[o,u])||es(this,[a,s])||es(this,[a,u])||es(i,[this.minx,this.miny])||es(i,[this.minx,this.maxy])||es(i,[this.maxx,this.miny])||es(i,[this.maxx,this.maxy]))}static initGrids(t,e,n,r){const i=[],o=(n-t)/30,s=(r-e)/30;let a=t,u=e;for(let n=0;n<30;n++){a=t+n*o;for(let t=0;t<30;t++){u=e+t*s;const r=new ns(a,u,a+o,u+s);r.key=t+"-"+n,i.push(r)}}return{grids:i,averageX:o,averageY:s,ROWS:30,COLS:30}}}const rs={altitude:0},is=new o.Vector3;function os(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}class ss extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]),n=t.Util.extend({},rs,n,{layer:i,points:e});let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let n=0,r=e.length;n<r;n++){const{coordinate:r}=e[n];let i,o;Array.isArray(r)?(i=r[0],o=r[1]):r instanceof t.Coordinate&&(i=r.x,o=r.y),e[n].coords=[i,o],s=Math.min(s,i),a=Math.min(a,o),u=Math.max(u,i),l=Math.max(l,o)}const h=i.coordinateToVector3([(s+u)/2,(a+l)/2]),{grids:c,averageX:f,averageY:p,ROWS:d,COLS:g}=ns.initGrids(s,a,u,l);c.length;const y=new Float32Array(3*e.length),v=[],m=new Float32Array(3*e.length),A=new Float32Array(e.length),_=[],x=[],w={};let b=0,E=!1,I=!1;const C=new o.Vector3(0,0,0);for(let t=0,n=e.length;t<n;t++){let{coordinate:n,height:r,color:u,size:l,coords:g}=e[t];const _=3*t;u&&(E=!0,u=u instanceof o.Color?u:new o.Color(u),m[_]=u.r,m[_+1]=u.g,m[_+2]=u.b),l&&(I=!0,A[t]=l,b=Math.max(b,l));const S=ci(r,i,w),M=i.coordinateToVector3(n,S);C.x=M.x,C.y=M.y,C.z=M.z,C.sub(h),y[_]=C.x,y[_+1]=C.y,y[_+2]=C.z,v.push(M),x[t]={position:{count:1,start:3*t,end:3*t+3},hide:!1};let B=os((g[1]-a)/p,4),T=os((g[0]-s)/f,4);B-=1,T-=1,B=Math.max(0,B),T=Math.max(0,T),B=Math.ceil(B),T=Math.ceil(T);const k=T*d+B;c[k]&&(c[k].positions.push(M),c[k].indexs.push(t))}const S=new o.BufferGeometry;In(S,"position",new o.BufferAttribute(y,3,!0)),E&&In(S,"color",new o.BufferAttribute(m,3,!0)),I&&In(S,"size",new o.BufferAttribute(A,1,!0)),n.positions=v,super(),this._initOptions(n),this._createPoints(S,r);const M=n.altitude,B=i.altitudeToVector3(M,M).x,T=h.clone();T.z=B,this.getObject3d().position.copy(T),this._baseObjects=_,this._datas=e,this.faceIndex=null,this._geometriesAttributes=x,this._geometryCache=S.clone(),this.isHide=!1,this._initBaseObjectsEvent(_),this._grids=c,this._bindMapEvents(),this.type="Points",this.maxSize=b}_bindMapEvents(){const t=this.getMap(),e="zoomstart zooming zoomend movestart moving moveend pitch rotate";this.on("add",(()=>{this._updateGrids(),t.on(e,this._updateGrids,this)})),this.on("remove",(()=>{t.off(e,this._updateGrids,this)}))}_updateGrids(){const t=this.getMap();this._grids.forEach((e=>{e.indexs.length&&e.updateBBoxPixel(t)}))}getSelectMesh(){const t=this.faceIndex;if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],{coordinate:n,height:r,color:i,size:o}=e;this._baseObjects[t]=new ts(n,{height:r,index:t,color:i,size:o},this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){const e=this.getLayer(),n=this.getMap().getSize(),r=this.getLayer().getCamera(),i=this.getOptions().altitude,o=this.getMap(),s=e.altitudeToVector3(i,i).x;let a=this.getObject3d().material.size;const u=void 0===a,l=o.coordToContainerPoint(t),h=[];if(this._grids.forEach((t=>{t.indexs.length&&t.isRecCross(l,u?this.maxSize:a)&&h.push(t)})),h.length<1)return!1;for(let t=0,e=h.length;t<e;t++)for(let e=h[t].positions.length-1;e>=0;e--){u&&(a=this._datas[h[t].indexs[e]].size||1);const i=h[t].positions[e];is.x=i.x,is.y=i.y,is.z=i.z+s;const o=Ko(is,n,r);if(Math.sqrt(Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2))<=a/2)return this.faceIndex=h[t].indexs[e],!0}return!1}}const as={coordinate:"",radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61"};class us extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const s=e.length,a=fi(e),u=i.coordinateToVector3(a),l=[],h=[],c=[];let f=0;const p={},d={};let g;super(),n=t.Util.extend({},{altitude:0,layer:i,points:e},as,n),this._initOptions(n);const y=new o.Vector3;if(n.asynchronous){g=mo();const r=t.Util.GUID();this.getOptions().id=r;const o=[];for(let r=0;r<s;r++){const s=t.Util.extend({index:r},n,e[r]),{radius:a,radialSegments:l,altitude:h,height:c,coordinate:f}=s,g=hi(a,i,p);e[r]._radius=g;const v=ci(c,i,d),m=ci(h,i,d),A=i.coordinateToVector3(f,0,y).sub(u);o.push({radialSegments:l,radius:g,height:v,center:[A.x,A.y],altitude:m})}ao.push({id:r,data:o,layer:i,baseObject:this})}else{for(let o=0;o<s;o++){const s=t.Util.extend({index:o},n,e[o]),{radius:a,radialSegments:g,altitude:v,topColor:m,bottomColor:A,height:_,coordinate:x}=s,w=hi(a,i,p),b=ci(_,i,d),E=ci(v,i,d),I=i.coordinateToVector3(x,0,y).sub(u),C=bo({radius:w,height:b,radialSegments:g,center:[I.x,I.y]});m&&(Eo(C,A,m,"z",b/2),r.vertexColors=Sn());const S=C.attributes.position.array;for(let t=0,e=S.length;t<e;t+=3)S[t+2]+=E;l.push(C);const M=new Mo(x,s,r,i);h.push(M),C.index.count;const B=C.attributes.position.count;C.attributes.normal.count,C.attributes.uv.count,c[o]={position:{count:B,start:f,end:f+3*B},hide:!1},f+=3*B}g=Io(l)}this._createMesh(g,r);const v=n.altitude,m=i.altitudeToVector3(v,v).x,A=u.clone();A.z=m,this.getObject3d().position.copy(A),this._baseObjects=h,this._datas=e,this._geometriesAttributes=c,this.faceIndex=null,this._geometryCache=yo(g),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(h),n.asynchronous||(this._setPickObject3d(),this._init()),this.type="Bars"}identify(){return this.picked}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,e,{index:t,asynchronous:!1});this._baseObjects[t]=new Mo(e.coordinate,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);this._geometryCache=yo(n);const{topColor:r,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(r&&(Eo(n,i,r,"z",e),s.vertexColors=Sn()),o.geometry=n,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const ls={width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61",pathUV:!1};class hs extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=[],s=[],a=e.length;for(let t=0;t<a;t++){const n=Di(e[t]);o.push(n.center),s.push(n.lineStrings)}const u=fi(o);n=t.Util.extend({},ls,n,{layer:i,lineStrings:e,coordinate:u});const{altitude:l,topColor:h,bottomColor:c,asynchronous:f,pathUV:p}=n;let d;const g=[],y=[];if(super(),f)d=mo(),eo.push({id:t.Util.GUID(),layer:i,key:n.key,center:u,data:s,lineStrings:e,baseObject:this,option:n});else{const o=[];let l=0;const f={},g={};for(let r=0;r<a;r++){const a=e[r],h=t.Util.extend({},n,Ai(a),{index:r}),{height:c,width:d,bottomHeight:v}=h,m=hi(d,i,f),A=ci(c,i,g),_=s[r],x=[];let w=0;for(let t=0,e=_.length;t<e;t++){const e=Li(_[t],m,A,p,i,u);w=pi(e,v,i,f),x.push(e)}const b=fo(x);o.push(b);const{position:E,normal:I,indices:C}=b;C.length;const S=E.length/3;I.length,y[r]={position:{middleZ:w+A/2,count:S,start:l,end:l+3*S},hide:!1},l+=3*S}d=co(o),h&&(bi(d,c,h,y),r.vertexColors=Sn())}this._initOptions(n),this._createMesh(d,r);const v=i.altitudeToVector3(l,l).x,m=i.coordinateToVector3(u,v);this.getObject3d().position.copy(m),this._baseObjects=g,this._datas=e,this._geometriesAttributes=y,this.faceIndex=null,this._geometryCache=yo(d),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(g),f||(this._setPickObject3d(),this._init()),this.type="ExtrudeLines"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,jn(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new Lo(e,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);this._geometryCache=yo(n);const{topColor:r,bottomColor:i,bottomHeight:o,height:s}=this.getOptions(),a=this.getObject3d().material;if(r&&(bi(n,i,r,e),a.vertexColors=Sn()),this.getObject3d().geometry=n,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const cs={altitude:0,colors:null};class fs extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const s=[],a=[],u=e.length;for(let t=0;t<u;t++){const n=Di(e[t]);s.push(n.center),a.push(n.lineStrings)}const l=fi(s);n=t.Util.extend({},cs,n,{layer:i,lineStrings:e,coordinate:l}),super(),this._initOptions(n);const{asynchronous:h}=n;let c;const f=[],p={};let d=[],g=0,y=[];if(h)c=Qi(),ro.push({id:t.Util.GUID(),layer:i,key:n.key,center:l,data:a,lineStrings:e,baseObject:this,option:n});else{for(let e=0;e<u;e++){const r=a[e];let o=0;for(let e=0,s=r.length;e<s;e++){const s=Ai(r[e]),a=t.Util.extend({},n,s),{positions:u}=Ti(r[e],i,l,!1);pi(u,a.bottomHeight,i,p),o+=u.length/3*2-2,y.push(Oi(u))}d[e]={position:{count:o,start:g,end:g+3*o},hide:!1},g+=3*o}const e=Ni(y);c=new o.BufferGeometry,In(c,"position",new o.BufferAttribute(e,3))}this._createLineSegments(c,r);const{altitude:v}=n,m=i.altitudeToVector3(v,v).x,A=i.coordinateToVector3(l,m);this.getObject3d().position.copy(A),this._baseObjects=f,this._datas=e,this._geometriesAttributes=d,this.faceIndex=null,this.index=null,this._geometryCache=c.clone(),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Lines"}getSelectMesh(){const e=this._getIndex();if(null!=e){if(!this._baseObjects[e]){const n=this._datas[e],r=t.Util.extend({},this.getOptions(),{index:e},jn(n)?n.properties:n.getProperties());this._baseObjects[e]=new ko(n,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[e])}return{data:this._datas[e],baseObject:this._baseObjects[e]}}}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:n}=this,r=n.length,i=di(n);let s=0;for(let t=0;t<r;t++){const r=e.getColor(),o=r.getHex();this._colorMap[o]=t;const{count:a}=n[t].position;this._datas[t].colorIndex=o;for(let t=0;t<a;t++)i[s]=r.r,i[s+1]=r.g,i[s+2]=r.b,s+=3}In(t,"color",new o.BufferAttribute(i,3,!0));const a=this.getObject3d().material.clone();a.color.set("#fff"),a.vertexColors=Sn();const u=e.getColor().getHex(),l=new o.LineSegments(t,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}_workerLoad(t){const{position:e,geometriesAttributes:n}=t;this._geometriesAttributes=n;const r=new o.BufferGeometry;if(In(r,"position",new o.BufferAttribute(new Float32Array(e),3)),this._computeLineDistances(r),this._geometryCache=r.clone(),this.getObject3d().geometry=r,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const ps=[],ds=[];function gs(){return{waitingQueue:ps,currentQueue:ds}}function ys(t,e){for(let n=0,r=t.length;n<r;n++){const r=t[n];if(r){const{key:i,callback:o}=r;if(e===i)return t.splice(n,1),o}}return null}const vs=document.createElement("canvas");let ms;function As(t,e=!1){if(ms)return ms;const n=vs.getContext("2d");return n.clearRect(0,0,256,256),n.save(),ms=vs.toDataURL(),ms}function _s(t=1,e=1){let n;return"undefined"==typeof document||(n=document.createElement("canvas"),t&&(n.width=t),e&&(n.height=e)),n}vs.width=vs.height=256;class xs extends t.TileLayer{constructor(e,n={}){super(t.Util.GUID(),t.Util.extend({urlTemplate:e},n)),this._opts=null,this._layer=null,this.material=null,this.getMaterial=null,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime()}isAsynchronous(){return this._opts.worker}getBaseObjects(){const t=this._loadTiles,e=[];for(let n in t){const t=this._baseObjectKeys[n];if(t&&Array.isArray(t)&&t.length)for(let n=0,r=t.length;n<r;n++)e.push(t[n])}return e}onSelectMesh(t,e){}formatBaseObjects(t,e){return[]}loopMessage(t){}getTileData(e){const{key:n,url:r,callback:i,img:o}=e;t.Ajax.getJSON(r,{},(function(t,e){t?(console.error(t),i(n,null,o)):i(n,e,o)}))}_getCurentTileKeys(){const t=this.getTiles().tileGrids||[],e=[],n={};for(let r=0,i=t.length;r<i;r++){const i=t[r].tiles||[];for(let t=0,r=i.length;t<r;t++){const{id:r}=i[t];e.push(r),n[r]=!0}}return{keys:e,keysMap:n}}_isLoad(){const{keys:t}=this._getCurentTileKeys(),e=Object.keys(this._renderer.tilesInView);return t.length===e.length}_layerOnLoad(){const t=(new Date).getTime();if(t-this._layerLaodTime<20)return;this._layerLaodTime=t;const e=this._renderer.tilesInView,n=this._loadTiles,r=this._layer,i=this._baseObjectKeys,o=Object.keys(e).length,s=Object.keys(n).length,a=[];if(o&&s)for(let t in n)e[t]||i[t]&&(i[t]||[]).forEach((t=>{a.push(t)}));if(a.length&&r.removeMesh(a,!1),o&&s)for(let t in e)if(!n[t])if(i[t]){const e=i[t];r.addMesh(e)}else{const{x:e,y:n,z:r}=this._getXYZOfIndex(t);this.getTileUrl(e,n,r)}this._loadTiles=Object.assign({},e),this._diffCache()}_init(){}_workerLoad(t){const e=t.target._img;e.currentCount++,e.currentCount===e.needCount&&(e.src=As(e._key,this._opts.debug))}_generateBaseObjects(t,e,n){if(e&&n){const{keysMap:r}=this._getCurentTileKeys();if(!r[t])return void(n.src=As(0,this._opts.debug));const i=this.formatBaseObjects(t,e);if(i.length){n.needCount=i.length,n.currentCount=0;for(let e=0,r=i.length;e<r;e++){const r=i[e];r._img=n,r._vt=this,this.isVisible()||r.hide(),this._cachetile(t,r),r.isAsynchronous()||n.currentCount++}this._layer.addMesh(i,!1),n.needCount===n.currentCount&&(n.src=As(0,this._opts.debug)),this.isAsynchronous()?i.filter((t=>t.isAsynchronous())).forEach((t=>{t.on("workerload",this._workerLoad,this)})):n.src=As(0,this._opts.debug)}else n.src=As(0,this._opts.debug);this._loadTiles[t]=!0}else n&&(n.src=As(0,this._opts.debug))}_diffCache(){if(Object.keys(this._baseObjectKeys).length>this._renderer.tileCache.max){const t=this._renderer.tileCache.data,e=this._renderer.tilesInView,n=[];for(let r in this._baseObjectKeys)t[r]||e[r]||((this._baseObjectKeys[r]||[]).forEach((t=>{t.isAdd&&n.push(t)})),this._diposeBaseObject(r),delete this._baseObjectKeys[r]);n.length&&this._layer.removeMesh(n,!1)}}_diposeBaseObject(t){const e=this._baseObjectKeys[t];e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t._geometryCache&&t._geometryCache.dispose();const e=t._baseObjects;e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t=null})),t._datas=null,t._geometriesAttributes=null,t._faceMap=null,t._colorMap=null,t.pickObject3d&&t.pickObject3d.geometry.dispose(),t=null}))}_cachetile(t,e){this._baseObjectKeys[t]||(this._baseObjectKeys[t]=[]),this._baseObjectKeys[t].push(e)}_getXYZOfIndex(t){const e=t.indexOf("_")>-1?"_":"-";let[n,r,i]=t.split(e).slice(1,4);return{x:parseInt(r),y:parseInt(n),z:parseInt(i)}}_getTileExtent(t,e,n){const r=this.getMap()._getResolution(n);return this._getTileConfig().getTilePrjExtent(t,e,r)}_getTileLngLatExtent(e,n,r){const i=this._getTileExtent(e,n,r);let o=i.getMax(),s=i.getMin();const a=this.getMap().getProjection();return s=a.unproject(s),o=a.unproject(o),new t.Extent(s,o)}}const ws={worker:!1};class bs extends xs{constructor(e,n={},r,i){super(t.Util.GUID(),t.Util.extend({urlTemplate:e},ws,n)),this._opts=n,this._layer=i,this.getMaterial=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime(),this._init()}formatBaseObjects(e,n){const r=this._opts,i=[],s=this.isAsynchronous();for(let a in n){const u=n[a]||{};let l;if(Array.isArray(u)?l=u:"FeatureCollection"===u.type&&(l=u.features),l&&l.length){const n=[],h=[],c=[];for(let e=0,r=l.length;e<r;e++){const r=l[e];if(zn(r))n.push(r);else if(jn(r)){const t=Yn(r);for(let e=0,n=t.length;e<n;e++)h.push(t[e])}else if(Vn(r)){const e=Yn(r);for(let n=0,r=e.length;n<r;n++)c.push(t.Util.extend({},e[n].properties,e[n],{coordinate:Hn(e[n])}))}}if(n.length){const o=this._getMaterial(a,n,e,u);if(o){const u=this._layer.toExtrudePolygons(n,t.Util.extend({},{topColor:"#fff",layerName:a,asynchronous:s,key:e},r),o);i.push(u)}}if(h.length){const n=this._getMaterial(a,h,e,u);if(n&&(n instanceof o.LineBasicMaterial||n instanceof o.LineDashedMaterial)){const e=this._layer.toLines(h,t.Util.extend({},{layerName:a,asynchronous:s},r),n);i.push(e)}}if(c.length){const n=this._getMaterial(a,c,e,u);if(n&&n instanceof o.PointsMaterial){const e=this._layer.toPoints(c,t.Util.extend({},{layerName:a,asynchronous:s},r),n);i.push(e)}}}}return i}loopMessage(t){const{currentQueue:e}=gs();e.length>0&&this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),n=new Image;return n.width=e.width,n.height=e.height,n.onload=this.onTileLoad.bind(this,n,t),n.onerror=this.onTileError.bind(this,n,t),this.loadTileImage(n,t.url,t.id),n},t.renderer.deleteTile=function(t){if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;!function(t){const e=ys(ps,t);e&&e(t)}((t.info||{}).id)},t.renderer.loadTileImage=(t,e,n)=>{t._key=n,function(t,e,n,r,i){const o={key:t,url:e,callback:n,img:r,vt:i};ds.length<10?(ds.push(o),i.loopMessage(o)):ps.push(o)}(n,e,((t,e,n)=>{this._generateBaseObjects(t,e,n),function(t,e){if(ys(ds,t),ps.length){ds.push(ps[0]),ps.splice(0,1);const t=ds[ds.length-1];e.loopMessage(t)}}(t,this)}),t,this)}}))}_getMaterial(e,n,r,i){return this.getMaterial&&t.Util.isFunction(this.getMaterial)?this.getMaterial(e,n,r,i):null}}function Es(t,e,n,r){const{position:i,uv:s,normal:a,indexs:u}=function(t,e,n,r){const i=t/n,o=e/r,s=-t/2,a=e/2,u=-e/2,l=(n+1)*(r+1),h=new Float32Array(3*l),c=new Float32Array(2*l),f=new Float32Array(3*l),p=new Uint32Array(10*l);let d=0,g=0,y=0;for(let l=0;l<=r;l++)for(let v=0;v<=n;v++){const m=s+i*v,A=a-o*l;h[d]=m,h[d+1]=A,h[d+2]=0,f[d]=0,f[d+1]=0,f[d+2]=1;const _=(m-s)/t,x=(A-u)/e;if(c[g]=_,c[g+1]=x,d+=3,g+=2,v<n&&l<r){const t=l*(n+1)+v,e=t+1,r=(n+1)*(l+1)+v,i=r+1;p[y]=t,p[y+1]=r,p[y+2]=e,p[y+3]=r,p[y+4]=i,p[y+5]=e,y+=6}}const v=new Uint32Array(y);for(let t=0,e=v.length;t<e;t++)v[t]=p[t];return{position:h,uv:c,normal:f,indexs:v}}(t,e,n,r),l=new o.BufferGeometry;return In(l,"position",new o.BufferAttribute(i,3)),In(l,"normal",new o.BufferAttribute(a,3)),In(l,"uv",new o.BufferAttribute(s,2)),l.setIndex(new o.BufferAttribute(u,1)),l}const Is=new o.TextureLoader,Cs=document.createElement("canvas");function Ss(t){if(!t)return null;let e;return"string"==typeof t?(e=new Image,e.src=t):t instanceof HTMLCanvasElement?(e=new Image,e.src=t.toDataURL()):t instanceof Image&&(e=new Image,e.src=t.src,e.crossOrigin=t.crossOrigin),e&&!e.crossOrigin&&(e.crossOrigin="Anonymous"),e}const Ms=new Map;function Bs(t,e,n,r){if(!e||!n)return;const{imageWidth:i,imageHeight:s,flaserBoundary:a}=r;let u;if(u=t instanceof Uint32Array||t instanceof Uint8ClampedArray?t:function(t,e=256,n=256){Cs.width=e,Cs.height=n;const r=Cs.getContext("2d");return r.drawImage(t,0,0,e,n),r.getImageData(0,0,e,n).data}(t,i,s),!u)return void console.error("image is error type data",t);let l=0,h=0,c=0;const f=new o.Vector3,p=Ms;for(let t=0,r=u.length;t<r;t+=4){const r=.1*(256*u[t]*256+256*u[t+1]+u[t+2])-1e4;let o=0;if(0!==h&&h+1!==s&&0!==c&&c+1!==i||!a){const t=p.get(r);void 0!==t?o=t:(o=n.altitudeToVector3(r,r,null,f).x,p.set(r,o))}e.attributes.position.array[3*l+2]=o,l++,c++,c===i&&(h++,c=0)}e.attributes.position.needsUpdate=!0}const Ts={interactive:!1,altitude:0,image:null,imageWidth:256,imageHeight:256,texture:null,flaserBoundary:!0,bufferPixel:1};class ks extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Ts,n,{layer:i,extent:e});const{texture:o,image:s,altitude:a,imageHeight:u,imageWidth:l,flaserBoundary:h,bufferPixel:c}=n;e instanceof t.Extent||(e=new t.Extent(e));const{xmin:f,ymin:p,xmax:d,ymax:g}=e;let y=1/0,v=1/0,m=-1/0,A=-1/0;[[f,p],[f,g],[d,g],[d,p]].forEach((t=>{const e=i.coordinateToVector3(t),{x:n,y:r}=e;y=Math.min(n,y),v=Math.min(r,v),m=Math.max(n,m),A=Math.max(r,A)}));const _=(m-y)/l,x=(A-v)/u;y-=_*c,m+=_*c,v-=x*c,A+=x*c;const w=Math.abs(m-y),b=Math.abs(A-v),E=Ss(s),I=Ss(o),C=Es(w,b,l-1,u-1);super(),this._initOptions(n),this._createMesh(C,r);const S=i.altitudeToVector3(a,a).x,M=i.coordinateToVector3(e.getCenter(),S);this.getObject3d().position.copy(M),r.transparent=!0,E&&(E.onload=()=>{Bs(E,C,i,{imageWidth:l,imageHeight:u,flaserBoundary:h}),this.fire("dataload",{})},E.onerror=function(){console.error(`not load ${E.src}`),this.fire("dataerror",{})}),I?(r.opacity=0,Is.load(I.src,(t=>{r.map=t,r.opacity=1,r.needsUpdate=!0,this.fire("textureload",{})}))):r.opacity=1,this.type="Terrain"}updateData(t){return Bs(t,this.getObject3d().geometry,this.getLayer(),this.getOptions()),this.fire("updatedata",{}),this}}const Ps={scale:1,tileDivisor:4};class Ls extends xs{constructor(e,n={},r,i){super(t.Util.GUID(),t.Util.extend({urlTemplate:e},Ps,n)),this._opts=n,this._layer=i,this.material=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._imgQueue={},this._layerLaodTime=(new Date).getTime(),this._init()}isAsynchronous(){return!1}formatBaseObjects(t,e){const n=this.options,r=[],{scale:i,tileDivisor:o}=n,{x:s,y:a,z:u}=this._getXYZOfIndex(t),l=this.getMap().getZoom(),h=this.getTileUrl(s,a,u),[c,f]=this.options.tileSize,p=this._getTileLngLatExtent(s,a,u),d=this.material.clone();if(u+1>=Math.round(l)){const t=new ks(p,{image:e,imageWidth:c/o,imageHeight:f/o,texture:h},d,this._layer);t.getObject3d().scale.set(i,i,1),r.push(t)}return r}loopMessage(t){this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),n=new Image;return n.width=e.width,n.height=e.height,n.onload=this.onTileLoad.bind(this,n,t),n.onerror=this.onTileError.bind(this,n,t),this.loadTileImage(n,t.url,t.id),n},t.renderer.deleteTile=t=>{if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;const e=t.info||{},n=this._imgQueue[e.id];n&&(n.src="",n.onload=null,n.onerror=null,delete this._imgQueue[e.id])},t.renderer.loadTileImage=(t,e,n)=>{t._key=n;const r=new Image;this._imgQueue[n]=r;const i={key:n,url:e,rgbImage:r,callback:(t,e,n)=>{this._generateBaseObjects(t,e,n)},img:t,vt:this};this.loopMessage(i)}}))}}
|
|
5
5
|
/*!
|
|
6
6
|
* Code from baidu mapv
|
|
7
7
|
* License: BSD-3
|
|
@@ -14,7 +14,7 @@ import*as t from"maptalks";import{Marker as e,Geometry as n,VectorLayer as r,ren
|
|
|
14
14
|
* https://github.com/huiyan-fe/mapv
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
function(t){var e=t/2,n=t+e,r=1e4,i=_s(2*n,2*n),o=i.getContext("2d");return o.shadowBlur=e,o.shadowColor="black",o.shadowOffsetX=o.shadowOffsetY=r,o.beginPath(),o.arc(n-r,n-r,t,0,2*Math.PI,!0),o.closePath(),o.fill(),i}(n._size||n.size||13),o=i.width/2,s=i.height/2,a=e,u={};for(var l in a.forEach((function(t){var e=void 0===t.count?1:t.count,n=Math.min(1,e/r).toFixed(2);u[n]=u[n]||[],u[n].push(t)})),u)if(!isNaN(l)){var h=u[l];t.beginPath(),n.withoutAlpha||(t.globalAlpha=l),h.forEach((function(e){var n=e.coordinate,a=void 0===e.count?1:e.count;t.globalAlpha=a/r,t.drawImage(i,n[0]-o,n[1]-s)}))}}Rs.prototype.setMax=function(t){this.max=t||100},Rs.prototype.setMin=function(t){this.min=t||0},Rs.prototype.setMaxSize=function(t){this.maxSize=t||35},Rs.prototype.setMinSize=function(t){this.minSize=t||0},Rs.prototype.initPalette=function(){var t=this.gradient,e=_s(256,1),n=this.paletteCtx=e.getContext("2d"),r=n.createLinearGradient(0,0,256,1);for(var i in t)r.addColorStop(parseFloat(i),t[i]);n.fillStyle=r,n.fillRect(0,0,256,1)},Rs.prototype.getColor=function(t){var e=this.getImageData(t);return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]/256+")"},Rs.prototype.getImageData=function(t){var e=this.paletteCtx.getImageData(0,0,256,1).data;if(void 0===t)return e;var n=this.max,r=this.min;t>n&&(t=n),t<r&&(t=r);var i=4*Math.floor((t-r)/(n-r)*255);return[e[i],e[i+1],e[i+2],e[i+3]]},Rs.prototype.getSize=function(t){var e=this.max,n=this.min,r=this.maxSize,i=this.minSize;return t>e&&(t=e),t<n&&(t=n),e>n?i+(t-n)/(e-n)*(r-i):r},Rs.prototype.getLegend=function(t){var e=this.gradient,n=t.width||20,r=t.height||180,i=_s(n,r),o=i.getContext("2d"),s=o.createLinearGradient(0,r,0,0);for(var a in e)s.addColorStop(parseFloat(a),e[a]);return o.fillStyle=s,o.fillRect(0,0,n,r),i};var Fs={draw:function(t,e,n){if(!(t.canvas.width<=0||t.canvas.height<=0)){var r=n.strength||.3;t.strokeStyle="rgba(0,0,0,"+r+")";var i=_s(t.canvas.width,t.canvas.height),o=i.getContext("2d");o.scale(devicePixelRatio,devicePixelRatio),n=n||{},t.save();var s=new Rs({gradient:n.gradient});if(Ns(o,e,n),!n.absolute){var a=o.getImageData(0,0,t.canvas.width,t.canvas.height);Ds(a.data,s.getImageData(),n),t.putImageData(a,0,0),t.restore()}s=null,i=null}},drawGray:Ns,colorize:Ds};const Us={altitude:0,interactive:!1,min:0,max:100,size:13,gradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},gridScale:.5},Qs=2048;class Gs extends Fn{constructor(e,n,r,i){Array.isArray(e)||(e=[e]);let s=1/0,a=1/0,u=-1/0,l=-1/0;const h=[];for(let t=0,n=e.length;t<n;t++){const{coordinate:n,lnglat:r,xy:o}=e[t],c=n||r||o;if(!c){console.warn("not find coordinate");continue}const f=i.coordinateToVector3(c);h.push(f);const{x:p,y:d}=f;s=Math.min(s,p),a=Math.min(a,d),u=Math.max(u,p),l=Math.max(l,d)}n=t.Util.extend({},Us,n,{layer:i,points:e});let{gridScale:c,altitude:f,size:p}=n;const d=Math.abs(u-s),g=Math.abs(l-a),y=Math.max(d*c,g*c);if(y>Qs){console.warn(`gridScale: ${c} it's too big. I hope it's a smaller value,canvas max size is 2048* 2048`);c=Qs/(y/c)}let v=Math.ceil(d*c),m=Math.ceil(g*c);const A=v/d,_=m/g,x=[],w=Math.ceil(2*p);for(let t=0,n=h.length;t<n;t++){const n=h[t];n.x-=s,n.y-=a,n.x*=A,n.y*=_,n.y=m-n.y,n.x+=w,n.y+=w,x.push({coordinate:[n.x,n.y],count:e[t].count})}v+=2*w,m+=2*w;let b=_s(v,m),E=b.getContext("2d");Fs.drawGray(E,x,n);const I=E.getImageData(0,0,E.canvas.width,E.canvas.height);let C=-1/0;const S=new Float32Array(I.data.length/4),M=new Float32Array(I.data.length/4);for(let t=3,e=I.data.length,n=0;t<e;t+=4){const e=I.data[t];C=Math.max(C,e),M[n]=e,e<=0&&(S[n]=1),n++}const B=new Rs({gradient:n.gradient});Fs.colorize(I.data,B.getImageData(),n),b=null,E=null;const T=Es(d,g,v-1,m-1),k=T.getIndex().array,P=T.attributes.position.array,L=new Float32Array(P.length),R=new Uint32Array(6*P.length),D=new o.Color;let O=0;for(let t=0,e=P.length,n=0,r=k.length,i=0,o=I.data.length,s=0;t<Math.max(e,r,o);t+=3){if(t<e){const e=M[s];e>0&&(P[t+2]=e/C)}if(n<r){const t=k[n],e=k[n+1],r=k[n+2];S[t]&&S[e]&&S[r]||(R[O]=t,R[O+1]=e,R[O+2]=r,O+=3)}if(i<o){const t=`rgb(${I.data[i]},${I.data[i+1]},${I.data[i+2]})`;D.setStyle(t),L[n]=D.r,L[n+1]=D.g,L[n+2]=D.b}n+=3,i+=4,s++}const N=new Uint32Array(O);for(let t=0;t<O;t++)N[t]=R[t];T.setIndex(new o.BufferAttribute(N,1)),In(T,"color",new o.BufferAttribute(L,3,!0)),r.vertexColors=Sn(),super(),this._initOptions(n),this._createMesh(T,r);const F=i.altitudeToVector3(f,f).x;this.getObject3d().position.copy(new o.Vector3((s+u)/2,(a+l)/2,F)),this.type="HeatMap"}}const zs=new o.Color;let js=1;class Vs{constructor(t){this.object3ds=[],this.layer=t,this.camera=t.getCamera(),this.renderer=t.getThreeRenderer(),this.pickingTexture=En>=152?new o.WebGLRenderTarget(1,1,{format:o.RGBAFormat,colorSpace:o.SRGBColorSpace}):new o.WebGLRenderTarget(1,1,{}),this.pickingScene=new o.Scene}getColor(){return zs.setHex(js),js++,zs}add(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=t,this.pickingScene.add(t))}return this}remove(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=null,this.pickingScene.remove(t))}return this}isEmpty(){if(0===this.pickingScene.children.length)return!0;for(let t=0,e=this.pickingScene.children.length;t<e;t++){const e=this.pickingScene.children[t];if(e){const t=e.__parent;if(t&&!0===t.getOptions().interactive)return!1}}return!0}pick(t){if(!t)return;if(this.isEmpty())return;const{camera:e,renderer:n,pickingTexture:r,pickingScene:i,object3ds:o,layer:s}=this,a=this.pickingScene.children.length;for(let t=0;t<a;t++){const e=this.pickingScene.children[t];e&&e.__parent&&(e.__parent.picked=!1)}const{width:u,height:l}=s._getRenderer().canvas,h=r.width,c=r.height;u===h&&l===c||r.setSize(u,l),n.setRenderTarget(r),n.clear(),e&&e.layers&&this.camera.layers.set(0),n.render(i,e);const f=new Uint8Array(4),{x:p,y:d}=t;let g=window.devicePixelRatio;const y=s.getMap();y&&(g=y.getDevicePixelRatio?y.getDevicePixelRatio():y.options.devicePixelRatio);const v=p*g,m=r.height-d*g;n.readRenderTargetPixels(r,Math.round(v),Math.round(m),1,1,f);const A=f[0]<<16|f[1]<<8|f[2],_=o[A];if(_)_.__parent&&(o[A].__parent.picked=!0);else for(let t=0;t<a;t++){const e=this.pickingScene.children[t];if(e&&e.__parent){const t=e.__parent;if(t._colorMap&&null!=t._colorMap[A]){t.picked=!0,t.index=t._colorMap[A];break}}}n.setRenderTarget(null)}}const qs={bottomHeight:0,altitude:0};class Hs extends Fn{constructor(e,n,r,i){n=t.Util.extend({},qs,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{asynchronous:o}=n,{lineStrings:s,center:a}=Di(e),u=new Rn;let l;if(o){const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=a,io.push({id:n,data:s,lineString:e,center:a,layer:i,baseObject:this})}else{const t=[],e={};for(let r=0,o=s.length;r<o;r++){const o=Ti(s[r],i,a,!1).positions;pi(o,n.bottomHeight,i,e),t.push(Oi(o))}l=Ni(t),u.setPositions(l)}this._setMaterialRes(i,r),this._createLine2(u,r);const{altitude:h}=n,c=i.altitudeToVector3(h,h).x,f=i.coordinateToVector3(a,c);this.getObject3d().position.copy(f),o||(this._setPickObject3d(l,r.linewidth),this._init()),this.type="FatLine"}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setMaterialRes(t,e){const n=t.getMap();if(!n)return this;const r=n.getSize(),i=r.width,o=r.height;e.resolution.set(i,o)}_setPickObject3d(t,e){const n=new Rn;n.setPositions(t);const r=this.getLayer().getPick().getColor(),i=[];for(let e=0,n=t.length/3;e<n;e++)i.push(r.r,r.g,r.b);n.setColors(i);const o=new Pn({color:"#fff",linewidth:e,vertexColors:Sn()});this._setMaterialRes(this.getLayer(),o);const s=r.getHex(),a=new Dn(n,o);a.position.copy(this.getObject3d().position),a._colorIndex=s,this.setPickObject3d(a)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof o.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),n=e.width,r=e.height;t.resolution.set(n,r),this.getObject3d().material=t}return this}_workerLoad(t){const e=new Float32Array(t.position),n=this.getObject3d();if(n.geometry.setPositions(e),n.computeLineDistances(),this._setPickObject3d(e,n.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const Ws={altitude:0,colors:null};class Ys extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=[],s=[],a=e.length;for(let t=0;t<a;t++){const n=Di(e[t]);o.push(n.center),s.push(n.lineStrings)}const u=fi(o);n=t.Util.extend({},Ws,n,{layer:i,lineStrings:e,coordinate:u}),super(),this._initOptions(n);const{asynchronous:l}=n,h=new Rn,c=[],f={};let p,d,g=[],y=0,v=[];if(l)oo.push({id:t.Util.GUID(),data:s,key:n.key,center:u,layer:i,baseObject:this,lineStrings:e,option:n});else{for(let e=0;e<a;e++){const r=s[e];let o=0;for(let e=0,s=r.length;e<s;e++){const s=Ai(r[e]),a=t.Util.extend({},n,s),{positions:l}=Ti(r[e],i,u,!1);pi(l,a.bottomHeight,i,f),o+=l.length/3*2-2,v.push(Oi(l))}g[e]={position:{count:o,start:y,end:y+3*o},instanceStart:{count:o,start:y,end:y+3*o},instanceEnd:{count:o,start:y,end:y+3*o},hide:!1},y+=3*o}p=Ni(v),h.setPositions(p)}this._setMaterialRes(i,r),this._createLine2(h,r);const{altitude:m}=n,A=i.altitudeToVector3(m,m).x,_=i.coordinateToVector3(u,A);this.getObject3d().position.copy(_),this._baseObjects=c,this._datas=e,this._geometriesAttributes=g,this.faceIndex=null,this.index=null,this._geometryCache=new Rn,l||(d=new Float32Array(p),this._geometryCache.setPositions(d)),this._colorMap={},this.isHide=!1,this._initBaseObjectsEvent(c),l||(this._setPickObject3d(d,r.linewidth),this._init()),this.type="FatLines"}_setMaterialRes(t,e){const n=t.getMap();if(!n)return this;const r=n.getSize(),i=r.width,o=r.height;e.resolution.set(i,o)}_setPickObject3d(t,e){if(!this._colorMap)return;const n=this._geometryCache||new Rn;n.setPositions(t);const r=this.getLayer().getPick(),{_geometriesAttributes:i}=this,o=di(i);let s=0;for(let t=0,e=i.length;t<e;t++){const e=r.getColor(),n=e.getHex();this._colorMap[n]=t;const{count:a}=i[t].position;this._datas[t].colorIndex=n;for(let t=0;t<a;t++)o[s]=e.r,o[s+1]=e.g,o[s+2]=e.b,s+=3}n.setColors(o);const a=new Pn({color:"#fff",linewidth:e,vertexColors:Sn()});this._setMaterialRes(this.getLayer(),a);const u=r.getColor().getHex(),l=new Dn(n,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof o.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),n=e.width,r=e.height;t.resolution.set(n,r),this.getObject3d().material=t}return this}getSelectMesh(){const e=this._getIndex();if(null!=e){if(!this._baseObjects[e]){const n=this._datas[e],r=t.Util.extend({},this.getOptions(),{index:e},jn(n)?n.properties:n.getProperties());this._baseObjects[e]=new Hs(n,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[e])}return{data:this._datas[e],baseObject:this._baseObjects[e]}}}_updateAttribute(t,e){const{indexs:n}=this._getHideGeometryIndex(e),r=this._geometryCache.attributes[e].array,i=r.length;for(let e=0;e<i;e++)t.array[e]=r[e];for(let r=0;r<n.length;r++){const i=n[r],{start:o,end:s}=this._geometriesAttributes[i][e];for(let e=o;e<s;e++)t.array[e]=-1e5}return this}_showGeometry(t,e){let n;if(t&&(n=t.getOptions().index),null!=n){const t=this._geometriesAttributes[n],{hide:r}=t;if(r===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.instanceStart,"instanceStart"),this._updateAttribute(i.attributes.instanceEnd,"instanceEnd"),i.attributes.instanceStart.data.needsUpdate=!0,i.attributes.instanceEnd.data.needsUpdate=!0,this.isHide=e}return this}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=this.getObject3d(),r=new Float32Array(t.position),i=new Float32Array(r);if(n.geometry.setPositions(new Float32Array(r)),this._geometryCache.setPositions(i),this._setPickObject3d(i,n.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const Xs={radius:10,height:100,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class Js extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Xs,n,{layer:i,coordinate:e}),super(),this._initOptions(n);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l}=n,h=i.altitudeToVector3(o,o).x,c=i.distanceToVector3(s,s).x,f=Co().clone();f.scale(2*c,2*c,h),a&&(Eo(f,u,a,"z",h/2),r.vertexColors=Sn()),this._createMesh(f,r);const p=i.altitudeToVector3(l,l).x,d=i.coordinateToVector3(e,p);this.getObject3d().position.copy(d),this.type="Box"}}const Ks={radius:10,height:100,altitude:0,topColor:null,bottomColor:"#2d2f61"};class Zs extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=e.length,s=fi(e),a=i.coordinateToVector3(s),u=[],l=[],h=[];let c=0;n=t.Util.extend({},{altitude:0,layer:i,points:e},Ks,n);const f={},p={};for(let s=0;s<o;s++){const o=t.Util.extend({index:s},n,e[s]),{radius:d,altitude:g,topColor:y,bottomColor:v,height:m,coordinate:A}=o,_=hi(d,i,f),x=ci(m,i,p),w=ci(g,i,p),b=Co().clone();b.scale(2*_,2*_,x),y&&(Eo(b,v,y,"z",x/2),r.vertexColors=Sn());const E=i.coordinateToVector3(A).sub(a),I=b.attributes.position.array;for(let t=0,e=I.length;t<e;t+=3)I[t+2]+=w,I[t]+=E.x,I[t+1]+=E.y,I[t+2]+=E.z;u.push(b);const C=new Js(A,o,r,i);l.push(C),b.index.count;const S=b.attributes.position.count;b.attributes.normal.count,b.attributes.uv.count,h[s]={position:{count:S,start:c,end:c+3*S},hide:!1},c+=3*S}super(),this._initOptions(n);const d=Io(u);this._createMesh(d,r);const g=n.altitude,y=i.altitudeToVector3(g,g).x,v=a.clone();v.z=y,this.getObject3d().position.copy(v),this._baseObjects=l,this._datas=e,this._geometriesAttributes=h,this.faceIndex=null,this._geometryCache=yo(d),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(l),this._setPickObject3d(),this._init(),this.type="Boxs"}identify(t){return this.picked}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function $s(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}var ta={exports:{}};function ea(t,e,n){n=n||2;var r,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*n:t.length,f=na(t,0,c,n,!0),p=[];if(!f||f.next===f.prev)return p;if(h&&(f=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=na(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(pa(s));for(a.sort(la),i=0;i<a.length;i++)n=ha(a[i],n);return n}(t,e,f,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var d=n;d<c;d+=n)(a=t[d])<r&&(r=a),(u=t[d+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-r,s-i))?32767/l:0}return ia(f,p,n,r,i,l,0),p}function na(t,e,n,r,i){var o,s;if(i===Ca(t,e,n,r)>0)for(o=e;o<n;o+=r)s=ba(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=ba(o,t[o],t[o+1],s);return s&&va(s,s.next)&&(Ea(s),s=s.next),s}function ra(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!va(r,r.next)&&0!==ya(r.prev,r,r.next))r=r.next;else{if(Ea(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function ia(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=fa(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,u,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(s>1)}(i)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?sa(t,r,i,o):oa(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(u.i/n|0),Ea(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?ia(t=aa(ra(t),e,n),e,n,r,i,o,2):2===s&&ua(t,e,n,r,i,o):ia(ra(t),e,n,r,i,o,1);break}}}function oa(t){var e=t.prev,n=t,r=t.next;if(ya(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,u=n.y,l=r.y,h=i<o?i<s?i:s:o<s?o:s,c=a<u?a<l?a:l:u<l?u:l,f=i>o?i>s?i:s:o>s?o:s,p=a>u?a>l?a:l:u>l?u:l,d=r.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&da(i,a,o,u,s,l,d.x,d.y)&&ya(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function sa(t,e,n,r){var i=t.prev,o=t,s=t.next;if(ya(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=a<u?a<l?a:l:u<l?u:l,d=h<c?h<f?h:f:c<f?c:f,g=a>u?a>l?a:l:u>l?u:l,y=h>c?h>f?h:f:c>f?c:f,v=fa(p,d,e,n,r),m=fa(g,y,e,n,r),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&da(a,h,u,c,l,f,A.x,A.y)&&ya(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&da(a,h,u,c,l,f,_.x,_.y)&&ya(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&da(a,h,u,c,l,f,A.x,A.y)&&ya(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&da(a,h,u,c,l,f,_.x,_.y)&&ya(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function aa(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!va(i,o)&&ma(i,r,r.next,o)&&xa(i,o)&&xa(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Ea(r),Ea(r.next),r=t=o),r=r.next}while(r!==t);return ra(r)}function ua(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ga(s,a)){var u=wa(s,a);return s=ra(s,s.next),u=ra(u,u.next),ia(s,e,n,r,i,o,0),void ia(u,e,n,r,i,o,0)}a=a.next}s=s.next}while(s!==t)}function la(t,e){return t.x-e.x}function ha(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var u,l=n,h=n.x,c=n.y,f=1/0;r=n;do{i>=r.x&&r.x>=h&&i!==r.x&&da(o<c?i:s,o,h,c,o<c?s:i,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(i-r.x),xa(r,t)&&(u<f||u===f&&(r.x>n.x||r.x===n.x&&ca(n,r)))&&(n=r,f=u)),r=r.next}while(r!==l);return n}(t,e);if(!n)return e;var r=wa(n,t);return ra(r,r.next),ra(n,n.next)}function ca(t,e){return ya(t.prev,t,e.prev)<0&&ya(e.next,t,t.next)<0}function fa(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function pa(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function da(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function ga(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&ma(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(xa(t,e)&&xa(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(ya(t.prev,t,e.prev)||ya(t,e.prev,e))||va(t,e)&&ya(t.prev,t,t.next)>0&&ya(e.prev,e,e.next)>0)}function ya(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function va(t,e){return t.x===e.x&&t.y===e.y}function ma(t,e,n,r){var i=_a(ya(t,e,n)),o=_a(ya(t,e,r)),s=_a(ya(n,r,t)),a=_a(ya(n,r,e));return i!==o&&s!==a||(!(0!==i||!Aa(t,n,e))||(!(0!==o||!Aa(t,r,e))||(!(0!==s||!Aa(n,t,r))||!(0!==a||!Aa(n,e,r)))))}function Aa(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function _a(t){return t>0?1:t<0?-1:0}function xa(t,e){return ya(t.prev,t,t.next)<0?ya(t,e,t.next)>=0&&ya(t,t.prev,e)>=0:ya(t,e,t.prev)<0||ya(t,t.next,e)<0}function wa(t,e){var n=new Ia(t.i,t.x,t.y),r=new Ia(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function ba(t,e,n,r){var i=new Ia(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ea(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ia(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ca(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}ta.exports=ea,ta.exports.default=ea,ea.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Ca(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Ca(t,l,h,n))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*n,p=r[a+1]*n,d=r[a+2]*n;c+=Math.abs((t[f]-t[d])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[d+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},ea.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n};var Sa=ta.exports;function Ma(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Ba(t,e,n,r,i){for(var o,s=r,a=e+1;a<n;a++){var u=Ma(t[a],t[e],t[n]);u>s&&(o=a,s=u)}s>r&&(o-e>1&&Ba(t,e,o,r,i),i.push(t[o]),n-o>1&&Ba(t,o,n,r,i))}function Ta(t,e){var n=t.length-1,r=[t[0]];return Ba(t,0,n,e,r),r.push(t[n]),r}function ka(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return t=n?t:function(t,e){for(var n,r,i,o,s,a=t[0],u=[a],l=1,h=t.length;l<h;l++)n=t[l],i=a,o=void 0,s=void 0,o=(r=n)[0]-i[0],s=r[1]-i[1],o*o+s*s>e&&(u.push(n),a=n);return a!==n&&u.push(n),u}(t,r),t=Ta(t,r)}function Pa(t,e){return t[0]*e[0]+t[1]*e[1]}function La(t,e){const n=e[0],r=e[1],i=Math.sqrt(n*n+r*r);return t[0]=n/i,t[1]=r/i,t}function Ra(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function Da(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function Oa(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Na(t,e){const n=e[0],r=e[1],i=e[2],o=Math.sqrt(n*n+r*r+i*i);return t[0]=n/o,t[1]=r/o,t[2]=i/o,t}function Fa(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2];return t[0]=i*u-o*a,t[1]=o*s-r*u,t[2]=r*a-i*s,t}const Ua=[];function Qa(t,e,n,r){const i=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}(e,n),o=Math.acos(i)*r;return Ra(Ua,n,e,-i),function(t,e){const n=e[0],r=e[1],i=e[2],o=Math.sqrt(n*n+r*r+i*i);t[0]=n/o,t[1]=r/o,t[2]=i/o}(Ua,Ua),function(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}(t,e,Math.cos(o)),Ra(t,t,Ua,Math.sin(o)),t}function Ga(t,e,n,r,i,o,s,a,u,l){const h=s-i,c=a-o,f=(h*(e-o)-c*(t-i))/(c*(n-t)-h*(r-e));return u&&(u[l=l||0]=t+f*(n-t),u[l+1]=e+f*(r-e)),f}function za(t,e,n){if(n-e<3)return 0;let r=0;for(let i=2*(n-1),o=2*e;o<2*n;){const e=t[i],n=t[i+1],s=t[o],a=t[o+1];i=o,o+=2,r+=e*a-s*n}return r}function ja(t,e,n=2){return Sa(t,e,n)}const Va=[],qa=[],Ha=[];function Wa(t,e,n,r,i,o,s,a,u){const l=null!=s;let h,c,f,p=i,d=null;l&&(d=new Uint32Array(r-n));let g=[];for(let i=n;i<r;i++){const y=i===r-1?n:i+1,v=i===n?r-1:i-1,m=t[2*v],A=t[2*v+1],_=t[2*i],x=t[2*i+1],w=t[2*y],b=t[2*y+1];Va[0]=_-m,Va[1]=x-A,qa[0]=w-_,qa[1]=b-x,La(Va,Va),La(qa,qa),l&&(d[i]=p);let E,I,C=!1;if(a||i!==n)if(a||i!==r-1){Da(Ha,qa,Va);const t=Ha[1];Ha[1]=-Ha[0],Ha[0]=t,La(Ha,Ha);const n=Pa(Ha,qa),r=Math.sqrt(1-n*n),i=o*Math.min(10,1/r);if(l&&1/r>s&&o*n<0){const t=_+Ha[0]*o,n=x+Ha[1]*o,i=Math.acos(r)/2,s=Math.tan(i)*Math.abs(o);e[2*p]=t+Ha[1]*s,e[2*p+1]=n-Ha[0]*s,p++,e[2*p]=t-Ha[1]*s,e[2*p+1]=n+Ha[0]*s,p++}else E=_+Ha[0]*i,I=x+Ha[1]*i,C=!0;if(C){if(u&&null!=h){const t=Ga(m,A,h,c,_,x,E,I,g,0);t>=-.01&&t<=1.01&&(e[2*f]=E=g[0],e[2*f+1]=I=g[1])}h=e[2*p]=E,c=e[2*p+1]=I,f=p,p++}}else Ha[0]=Va[1],Ha[1]=-Va[0],La(Ha,Ha),E=_+Ha[0]*o,I=x+Ha[1]*o,C=!0;else Ha[0]=qa[1],Ha[1]=-qa[0],La(Ha,Ha),h=e[2*p]=_+Ha[0]*o,c=e[2*p+1]=x+Ha[1]*o,f=p,p++}return d}function Ya(t,e,n,r,i){const o=null!=r?[]:new Float32Array(t.length);if(Wa(t,o,0,e&&e.length?e[0]:t.length/2,0,n,r,i,!0),e)for(let s=0;s<e.length;s++){const a=e[s];Wa(t,o,a,e[s+1]||t.length/2,null!=r?o.length/2:a,n,r,i,!1)}return o}function Xa(t,e,n,r){for(let i=0;i<Math.floor((r-n)/2);i++)for(let o=0;o<e;o++){const s=(i+n)*e+o,a=(r-i-1)*e+o,u=t[s];t[s]=t[a],t[a]=u}return t}function Ja(t,e){let n=t.length/2,r=0,i=e&&e.length?e[0]:n;za(t,r,i)>0&&Xa(t,2,r,i);for(let o=1;o<(e?e.length:0)+1;o++)r=e[o-1],i=e[o]||n,za(t,r,i)<0&&Xa(t,2,r,i)}const Ka=[[0,0],[1,0],[1,1],[0,0],[1,1],[0,1]];function Za(t,e,n){let r=0,i=t[e],o=t[e+1];const s=i,a=o;for(let s=e+2;s<n;s+=2){const e=t[s],n=t[s+1];r+=Math.sqrt((e-i)*(e-i)+(n-o)*(n-o)),i=e,o=n}return r+=Math.sqrt((i-s)*(i-s)+(o-a)*(o-a)),r}function $a(t,{vertices:e,topVertices:n,splittedMap:r,depth:i,rect:o},s,a,u,l){const h=a-s,c=l.smoothBevel?1:2,f=Math.min(i/2,l.bevelSize),p=l.bevelSegments,d=u.vertex,g=u.ringPerimeter,y=Math.max(o.width,o.height,i,g);function v(t){const n=(t+1)%h,r=e[2*t],i=e[2*t+1],o=e[2*n],s=e[2*n+1];return r===o&&i===s}if(f>0){const o=[0,0,1],a=[],l=[0,0,-1],g=[];let m=0,A=new Float32Array(h);for(let _=0;_<2;_++){const x=0===_?i-f:f;for(let i=0;i<=p*c;i++){let w,b,E=0;for(let I=0;I<h;I++){const C=2*(I%h+s),S=r?2*r[C/2]:C;a[0]=e[C]-n[S],a[1]=e[C+1]-n[S+1],a[2]=0;const M=Math.sqrt(a[0]*a[0]+a[1]*a[1]);a[0]/=M,a[1]/=M;const B=(Math.floor(i/c)+i%c)/p;0===_?Qa(g,o,a,B):Qa(g,a,l,B);const T=0===_?B:1-B,k=f*Math.sin(T*Math.PI/2),P=M*Math.cos(T*Math.PI/2),L=f*M/Math.sqrt(k*k+P*P),R=g[0]*L+n[S],D=g[1]*L+n[S+1],O=g[2]*L+x;if(t.position[3*u.vertex]=R,t.position[3*u.vertex+1]=D,t.position[3*u.vertex+2]=O,I>0&&(E+=Math.sqrt((w-R)*(w-R)+(b-D)*(b-D))),i>0||_>0){let e=3*(u.vertex-h),n=t.position[e],r=t.position[e+1],i=t.position[e+2];A[I]+=Math.sqrt((n-R)*(n-R)+(r-D)*(r-D)+(i-O)*(i-O))}if(t.uv[2*u.vertex]=E/y,t.uv[2*u.vertex+1]=A[I]/y,w=R,b=D,u.vertex++,!v(I)&&(c>1&&i%c||1===c&&i>=1))for(let e=0;e<6;e++){const n=(Ka[e][0]+I)%h,r=Ka[e][1]+m;t.indices[u.index++]=(r-1)*h+n+d}}m++}}}else for(let n=0;n<2;n++){const r=0===n?i-f:f;let o,a,l=0;for(let n=0;n<h;n++){const i=2*(n%h+s),c=e[i],f=e[i+1];t.position[3*u.vertex]=c,t.position[3*u.vertex+1]=f,t.position[3*u.vertex+2]=r,n>0&&(l+=Math.sqrt((o-c)*(o-c)+(a-f)*(a-f))),t.uv[2*u.vertex]=l/y,t.uv[2*u.vertex+1]=r/y,o=c,a=f,u.vertex++}}const m=f>0?p*c+1:1;for(let e=0;e<h;e++)if(!v(e))for(let n=0;n<6;n++){const r=(Ka[n][0]+e)%h,i=Ka[n][1]+m;t.indices[u.index++]=(i-1)*h+r+d}}function tu({indices:t,topVertices:e,rect:n,depth:r},i,o,s){if(e.length<=4)return;const a=o.vertex,u=t.length;for(let e=0;e<u;e++)i.indices[o.index++]=a+t[e];const l=Math.max(n.width,n.height);for(let t=0;t<(s.excludeBottom?1:2);t++)for(let s=0;s<e.length;s+=2){const a=e[s],u=e[s+1];i.position[3*o.vertex]=a,i.position[3*o.vertex+1]=u,i.position[3*o.vertex+2]=(1-t)*r,i.uv[2*o.vertex]=(a-n.x)/l,i.uv[2*o.vertex+1]=(u-n.y)/l,o.vertex++}if(!s.excludeBottom){const n=e.length/2;for(let e=0;e<u;e+=3)for(let r=0;r<3;r++)i.indices[o.index++]=a+n+t[e+2-r]}}function eu(t,e,n,r){const i=null==n||"auto"===n;if(!0===n)return{vertices:t,holes:e};const o=[],s=e&&[],a=t.length/2,u=[],l=[],h=[];let c=0,f=0;const p=(e?e.length:0)+1;for(let n=0;n<p;n++){0===n?f=e&&e.length?e[0]:a:(c=e[n-1],f=e[n]||a);for(let e=c;e<f;e++){const n=t[2*e],s=t[2*e+1],a=e===f-1?c:e+1,p=t[2*a],d=t[2*a+1];if(i){const i=e===c?f-1:e-1,a=t[2*i],g=t[2*i+1];u[0]=a-n,u[1]=g-s,l[0]=p-n,l[1]=d-s,La(u,u),La(l,l);1-(.5*Pa(u,l)+.5)>r?(o.push(n,s),h.push(e)):(o.push(n,s,n,s),h.push(e,e))}else o.push(n,s,n,s),h.push(e,e)}n<p-1&&s&&s.push(o.length/2)}return{vertices:new Float32Array(o),splittedMap:h,holes:s}}function nu(t,e){let n=0,r=0;for(let i=0;i<t.length;i++){const{indices:o,vertices:s,splittedMap:a,topVertices:u,depth:l}=t[i],h=Math.min(l/2,e.bevelSize)>0?e.bevelSegments:0,c=t[i].holes||[];n+=o.length*(e.excludeBottom?1:2),r+=u.length/2*(e.excludeBottom?1:2);const f=2+2*h;let p=0,d=0;for(let t=0;t<c.length+1;t++){0===t?d=c.length?c[0]:s.length/2:(p=c[t-1],d=c[t]||s.length/2);n+=6*((a?a[d-1]+1:d)-(a?a[p]:p))*(f-1);const i=d-p;r+=i*f+(e.smoothBevel?0:h*i*2)}}const i={position:new Float32Array(3*r),indices:new(r>65535?Uint32Array:Uint16Array)(n),uv:new Float32Array(2*r)},o={vertex:0,index:0,ringPerimeter:0};for(let n=0;n<t.length;n++)tu(t[n],i,o,e);for(let n=0;n<t.length;n++){const{holes:r,vertices:s}=t[n],a=s.length/2;let u=0,l=r&&r.length?r[0]:a;if(o.ringPerimeter=Za(t[n].topVertices,u,l),$a(i,t[n],u,l,o,e),r)for(let s=0;s<r.length;s++)u=r[s],l=r[s+1]||a,o.ringPerimeter=Za(t[n].topVertices,u,l),$a(i,t[n],u,l,o,e)}for(let t=0;t<i.uv.length;t++){const e=i.uv[t];e>0&&Math.round(e)===e?i.uv[t]=1:i.uv[t]=e%1}return i.normal=function(t,e){function n(t,e,n,r){t[0]=e,t[1]=n,t[2]=r}const r=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);for(let c=0;c<l;){const l=3*t[c++],f=3*t[c++],p=3*t[c++];n(r,e[l],e[l+1],e[l+2]),n(i,e[f],e[f+1],e[f+2]),n(o,e[p],e[p+1],e[p+2]),Oa(s,r,i),Oa(a,i,o),Fa(u,s,a);for(let t=0;t<3;t++)h[l+t]=h[l+t]+u[t],h[f+t]=h[f+t]+u[t],h[p+t]=h[p+t]+u[t]}for(var c=0;c<h.length;)n(u,h[c],h[c+1],h[c+2]),Na(u,u),h[c++]=u[0],h[c++]=u[1],h[c++]=u[2];return h}(i.indices,i.position),i.boundingRect=t[0]&&t[0].rect,i}function ru(t,e){const n=[];for(let r=0;r<t.length;r++){const i=t[r],o=[],s=i.length;let a=i[s-1][0],u=i[s-1][1],l=0;for(let t=0;t<s;t++){let n=i[t][0],r=i[t][1];const s=n-a,h=r-u;l+=Math.sqrt(s*s+h*h),l>e&&(o.push(i[t]),l=0),a=n,u=r}o.length>=3&&n.push(o)}return n.length>0?n:null}function iu(t,e){const n=[];for(let r=0;r<t.length;r++){let i=t[r];i=ka(i,e,!0),i.length>=3&&n.push(i)}return n.length>0?n:null}function ou(t,e){e=Object.assign({},e);const n=[1/0,1/0],r=[-1/0,-1/0];for(let e=0;e<t.length;e++)su(t[e][0],n,r);e.boundingRect=e.boundingRect||{x:n[0],y:n[1],width:r[0]-n[0],height:r[1]-n[1]},function(t){t.depth=t.depth||1,t.bevelSize=t.bevelSize||0,t.bevelSegments=null==t.bevelSegments?2:t.bevelSegments,t.smoothBevel=t.smoothBevel||!1,t.simplify=t.simplify||0,null==t.smoothSide&&(t.smoothSide="auto"),null==t.smoothSideThreshold&&(t.smoothSideThreshold=.9),"number"==typeof t.depth&&(t.bevelSize=Math.min(t.bevelSegments>0?t.bevelSize:0,t.depth/2)),t.bevelSize>0||(t.bevelSegments=0),t.bevelSegments=Math.round(t.bevelSegments);const e=t.boundingRect;if(t.translate=t.translate||[0,0],t.scale=t.scale||[1,1],t.fitRect){let n=null==t.fitRect.x?e.x||0:t.fitRect.x,r=null==t.fitRect.y?e.y||0:t.fitRect.y,i=t.fitRect.width,o=t.fitRect.height;null==i?null!=o?i=o/e.height*e.width:(i=e.width,o=e.height):null==o&&(o=i/e.width*e.height),t.scale=[i/e.width,o/e.height],t.translate=[(n-e.x)*t.scale[0],(r-e.y)*t.scale[1]]}}(e);const i=[],o=e.translate||[0,0],s=e.scale||[1,1],a=e.boundingRect,u={x:a.x*s[0]+o[0],y:a.y*s[1]+o[1],width:a.width*s[0],height:a.height*s[1]},l=Math.min(a.width,a.height)/1e5;for(let n=0;n<t.length;n++){let r=ru(t[n],l);if(!r)continue;const a=e.simplify/Math.max(s[0],s[1]);if(a>0&&(r=iu(r,a)),!r)continue;const{vertices:h,holes:c,dimensions:f}=Sa.flatten(r);for(let t=0;t<h.length;)h[t]=h[t++]*s[0]+o[0],h[t]=h[t++]*s[1]+o[1];if(Ja(h,c),2!==f)throw new Error("Only 2D polygon points are supported");const p=e.bevelSize>0?Ya(h,c,e.bevelSize,null,!0):h,d=ja(p,c,f),g=eu(h,c,e.smoothSide,e.smoothSideThreshold);i.push({indices:d,vertices:g.vertices,rawVertices:h,topVertices:p,holes:g.holes,splittedMap:g.splittedMap,rect:u,depth:"function"==typeof e.depth?e.depth(n):e.depth})}return nu(i,e)}function su(t,e,n){for(let r=0;r<t.length;r++)e[0]=Math.min(t[r][0],e[0]),e[1]=Math.min(t[r][1],e[1]),n[0]=Math.max(t[r][0],n[0]),n[1]=Math.max(t[r][1],n[1])}const au={bottomHeight:0,width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class uu extends Fn{constructor(e,n,r,i){n=t.Util.extend({},au,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{width:o,cornerRadius:s,bottomHeight:a,altitude:u,asynchronous:l}=n,h=i.distanceToVector3(s,s).x,c=i.distanceToVector3(o,o).x,{lineStrings:f,center:p}=Di(e);let d;if(l){d=mo();const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=p,uo.push({id:n,data:f,layer:i,center:p,lineString:e,baseObject:this})}else{const t=[],e={};for(let n=0,r=f.length;n<r;n++){const r=Ri(f[n],c,h,i,p);pi(r,a,i,e),t.push(r)}d=co(t)}this._createMesh(d,r);const g=i.altitudeToVector3(u,u).x,y=i.coordinateToVector3(p,g);this.getObject3d().position.copy(y),this.type="Path"}_workerLoad(t){const e=go(t);this.getObject3d().geometry=e,this._fire("workerload",{target:this})}}const lu={width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61"};class hu extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=[],s=[],a=e.length;for(let t=0;t<a;t++){const n=Di(e[t]);o.push(n.center),s.push(n.lineStrings)}const u=fi(o);n=t.Util.extend({},lu,n,{layer:i,lineStrings:e,coordinate:u});const{altitude:l,asynchronous:h}=n;let c;const f=[],p=[];if(super(),h)c=mo(),lo.push({id:t.Util.GUID(),layer:i,key:n.key,center:u,data:s,lineStrings:e,baseObject:this,option:n});else{const r=[];let o=0;const l={},h={};for(let c=0;c<a;c++){const a=e[c],f=t.Util.extend({},n,Ai(a),{index:c}),{cornerRadius:d,width:g,bottomHeight:y}=f,v=hi(g,i,l),m=hi(d,i,h),A=s[c],_=[];let x=0;for(let t=0,e=A.length;t<e;t++){const e=Ri(A[t],v,m,i,u);x=pi(e,y,i,l),_.push(e)}const w=fo(_);r.push(w);const{position:b,normal:E,indices:I}=w;I.length;const C=b.length/3;E.length,p[c]={position:{middleZ:x,count:C,start:o,end:o+3*C},hide:!1},o+=3*C}c=co(r)}this._initOptions(n),this._createMesh(c,r);const d=i.altitudeToVector3(l,l).x,g=i.coordinateToVector3(u,d);this.getObject3d().position.copy(g),this._baseObjects=f,this._datas=e,this._geometriesAttributes=p,this.faceIndex=null,this._geometryCache=yo(c),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Paths"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,jn(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new uu(e,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);if(this._geometryCache=yo(n),this.getObject3d().geometry=n,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const cu=Math.PI/180,fu=[[4e3,220],[2e3,100],[1e3,30],[500,15],[100,5],[50,2],[10,1],[5,.7],[2,.1],[1,.05],[.5,.02],[.4,.01],[.1,.005],[.05,.002],[.01,.001]],pu=["mouseout","mousemove","click","mousedown","mouseup","dblclick","contextmenu","touchstart","touchmove","touchend"],du=new t.Coordinate(0,0),gu=new t.Point(0,0),yu=new o.Vector3,vu=new Map,mu="__webglFramebuffer",Au=new o.Vector4;class _u extends t.CanvasLayer{constructor(t,e){super(t,e),this._animationBaseObjectMap={},this._needsUpdate=!0,this._mousemoveTimeOut=0,this._mousedownTime=0,this._baseObjects=[],this._delayMeshes=[],this._meshes=[],this.type="ThreeLayer"}isMercator(){const t=this.getMap();if(!t)return!1;const e=t.getSpatialReference(),n=e._projection,r=e._resolutions;return!!(n&&"EPSG:3857"===n.code&&r&&r.length&&156543===Math.floor(r[0])&&t.getGLRes)}isRendering(){const t=this.getMap();return!!t&&(t.isInteracting()||t.isAnimating())}prepareToDraw(...t){}draw(t,e,n,r,i,o){this.renderScene(o,this)}drawOnInteracting(t,e,n,r,i,o,s){this.renderScene(s,this)}_transformHeight(t,e){if(!t)return 0;if(0===(e=e||0))return 0;return this.altitudeToVector3(e,e,null,yu).x}coordinateToVector3(e,n=0,r){const i=this.getMap();if(!i)return null;const s=Array.isArray(e);s?(du.x=e[0],du.y=e[1]):e instanceof t.Coordinate||(e=new t.Coordinate(e));const a=Eu(i),u=Iu(i,s?du:e,a,gu);return r&&(r.x=u.x,r.y=u.y,r.z=n),new o.Vector3(u.x,u.y,n)}coordinatiesToGLFloatArray(e,n,r){const i=this.getMap();if(!i)return null;const o=Eu(i),s=e.length,a=new Float32Array(2*s),u=new Float32Array(3*s);vu.clear();for(let l=0;l<s;l++){let s=e[l];const h=Array.isArray(s);h?(du.x=s[0],du.y=s[1]):s instanceof t.Coordinate||(s=new t.Coordinate(s));const c=Iu(i,h?du:s,o,gu);c.x-=n.x,c.y-=n.y;const f=2*l;a[f]=c.x,a[f+1]=c.y;const p=s;let d=p.z||p[2]||0;if(r&&!vu.has(d)){const t=this._transformHeight(r,d);vu.set(d,t)}let g=0;r&&(g=vu.get(d)||0);const y=3*l;u[y]=c.x,u[y+1]=c.y,u[y+2]=g}return{positions:u,positons2d:a}}coordinatiesToGLArray(e,n){const r=this.getMap();if(!r)return null;const i=Eu(r),o=e.length,s=new Array(o);for(let a=0;a<o;a++){let o=e[a];const u=Array.isArray(o);u?(du.x=o[0],du.y=o[1]):o instanceof t.Coordinate||(o=new t.Coordinate(o));const l=Iu(r,u?du:o,i,gu);l.x-=n.x,l.y-=n.y,s[a]=[l.x,l.y]}return s}distanceToVector3(e,n,r){if(0===e&&0===n||!t.Util.isNumber(e)||!t.Util.isNumber(n))return new o.Vector3(0,0,0);const i=this.getMap(),s=Eu(i);let a=r||i.getCenter();a instanceof t.Coordinate||(a=new t.Coordinate(a));const u=i.locate(a,e,n),l=Iu(i,a,s),h=Iu(i,u,s),c=Math.abs(h.x-l.x)*t.Util.sign(e),f=Math.abs(h.y-l.y)*t.Util.sign(n);return new o.Vector3(c,f,0)}altitudeToVector3(e,n,r,i){if(0===e||!t.Util.isNumber(e))return new o.Vector3(0,0,0);const s=this.getMap();if(s.altitudeToPoint){const t=Eu(s);let n=s.altitudeToPoint(e,t);return e<0&&n>0&&(n=-n),i?(i.x=n,i.y=n,i.z=0,i):new o.Vector3(n,n,0)}return this.distanceToVector3(e,e,r)}toShape(e){if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map((t=>this.toShape(t)));const n=e.getCenter(),r=this.coordinateToVector3(n),i=e.getShell().map((t=>{const e=this.coordinateToVector3(t).sub(r);return new o.Vector2(e.x,e.y)})),s=new o.Shape(i),a=e.getHoles();return a&&a.length>0&&(s.holes=a.map((t=>{const e=t.map((t=>{const e=this.coordinateToVector3(t).sub(r);return new o.Vector2(e.x,e.y)}));return new o.Shape(e)}))),s}toExtrudeMesh(e,n,r,i){if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map((t=>this.toExtrudeMesh(t,n,r,i)));const s=e.getCoordinates();s.forEach((t=>{for(let e=t.length-1;e>=1;e--)t[e].equals(t[e-1])&&t.splice(e,1)})),e.setCoordinates(s);const a=this.toShape(e),u=this.coordinateToVector3(e.getCenter());i=t.Util.isNumber(i)?i:n,i=this.altitudeToVector3(i,i).x;const l=this.altitudeToVector3(n,n).x,h={bevelEnabled:!1,bevelSize:1};h[parseInt(o.REVISION)>=93?"depth":"amount"]=i;const c=new o.ExtrudeGeometry(a,h);let f=c;o.BufferGeometry.prototype.fromGeometry&&(f=new o.BufferGeometry,f.fromGeometry(c));const p=new o.Mesh(f,r);return p.position.set(u.x,u.y,l-i),p}toExtrudePolygon(t,e,n){return new Do(t,e,n,this)}toBar(t,e,n){return new Mo(t,e,n,this)}toLine(t,e,n){return new ko(t,e,n,this)}toExtrudeLine(t,e,n){return new Lo(t,e,n,this)}toModel(t,e){return new No(t,e,this)}toExtrudeLineTrail(t,e,n){return new Vo(t,e,n,this)}toExtrudePolygons(t,e,n){return new Jo(t,e,n,this)}toPoint(t,e,n){return new ts(t,e,n,this)}toPoints(t,e,n){return new ss(t,e,n,this)}toBars(t,e,n){return new us(t,e,n,this)}toExtrudeLines(t,e,n){return new hs(t,e,n,this)}toLines(t,e,n){return new fs(t,e,n,this)}toThreeVectorTileLayer(t,e,n){return new bs(t,e,n,this)}toTerrain(t,e,n){return new ks(t,e,n,this)}toTerrainVectorTileLayer(t,e,n){return new Ls(t,e,n,this)}toHeatMap(t,e,n){return new Gs(t,e,n,this)}toFatLine(t,e,n){return new Hs(t,e,n,this)}toFatLines(t,e,n){return new Ys(t,e,n,this)}toBox(t,e,n){return new Js(t,e,n,this)}toBoxs(t,e,n){return new Zs(t,e,n,this)}toPath(t,e,n){return new uu(t,e,n,this)}toPaths(t,e,n){return new hu(t,e,n,this)}getBaseObjects(){return this.getMeshes().filter((t=>t instanceof Fn))}getMeshes(){const t=this.getScene();if(!t)return[];const e=[];for(let n=0,r=t.children.length;n<r;n++){const r=t.children[n];r instanceof o.Object3D&&!(r instanceof o.Camera)&&e.push(r.__parent||r)}return e}clear(){return this.clearMesh()}clearBaseObjects(){return this.removeMesh(this.getBaseObjects())}clearMesh(){const t=this.getScene();if(!t)return this;for(let e=t.children.length-1;e>=0;e--){const n=t.children[e];if(n instanceof o.Object3D&&!(n instanceof o.Camera)){t.remove(n);const e=n.__parent;e&&e instanceof Fn&&(e.isAdd=!1,e.options.layer=null,e._fire("remove",{target:e}),delete this._animationBaseObjectMap[n.uuid],e._hideUI())}}return this._meshes=[],this}lookAt(t){const e=this._getRenderer();return e&&e.context.lookAt(t),this}getCamera(){const t=this._getRenderer();return t?t.camera:null}getScene(){const t=this._getRenderer();return t?t.scene:null}renderScene(t,e){const n=this._getRenderer();return n&&(n.clearCanvas(),n.renderScene(t),e||n.setToRedraw()),this}loop(t=!1){const e=this._delayMeshes;if(!e.length)return;const n=this.getMap();if(!n||n.isAnimating()||n.isInteracting())return;const r=this.options.loopRenderCount||50,i=e.slice(0,r);i&&this.addMesh(i,t),e.splice(0,r)}renderPickScene(){const t=this._getRenderer();if(t){const e=t.pick;e&&e.pick(this._containerPoint)}return this}getThreeRenderer(){const t=this._getRenderer();return t?t.context:null}getPick(){const t=this._getRenderer();return t?t.pick:null}delayAddMesh(t){if(!t)return this;Array.isArray(t)||(t=[t]);for(let e=0,n=t.length;e<n;e++)this._delayMeshes.push(t[e]);return this}addMesh(e,n=!0){if(!e)return this;Array.isArray(e)||(e=[e]);const r=this.getScene();if(e.forEach((e=>{e instanceof Fn?(r.add(e.getObject3d()),e.isAdd||(e.isAdd=!0,e.options.layer=this,e._fire("add",{target:e})),e._animation&&t.Util.isFunction(e._animation)&&(this._animationBaseObjectMap[e.getObject3d().uuid]=e)):e instanceof o.Object3D&&r.add(e);-1===this._meshes.indexOf(e)&&this._meshes.push(e)})),this._zoomend(),n){const t=this._getRenderer();t&&t.setToRedraw()}return this}removeMesh(e,n=!0){if(!e)return this;Array.isArray(e)||(e=[e]);const r=this.getScene();if(e.forEach((e=>{if(e instanceof Fn){r.remove(e.getObject3d()),e.isAdd&&(e.isAdd=!1,e.options.layer=null,e._fire("remove",{target:e}),e._hideUI()),e._animation&&t.Util.isFunction(e._animation)&&delete this._animationBaseObjectMap[e.getObject3d().uuid];const n=this._delayMeshes;if(n.length)for(let t=0,r=n.length;t<r;t++)if(n[t]===e){n.splice(t,1);break}}else e instanceof o.Object3D&&r.remove(e);for(let t=0,n=this._meshes.length;t<n;t++){const n=this._meshes[t];n&&(n===e&&this._meshes.splice(t,1))}})),n){const t=this._getRenderer();t&&t.setToRedraw()}return this}_initRaycaster(){return this._raycaster||(this._raycaster=new o.Raycaster,this._mouse=new o.Vector2),this}getRaycaster(){return this._raycaster}identify(e,n){if(!e)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(e)&&(e=new t.Coordinate(e)),!(e instanceof t.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];const r=this.getMap().coordToContainerPoint(e);this._containerPoint=r;const{x:i,y:s}=r;this._initRaycaster(),this.fire("identify",{coordinate:e,options:n});const a=this._raycaster,u=this._mouse,l=this.getCamera(),h=this.getScene(),c=this.getMap().getSize();if(!h)return[];const f=c.width,p=c.height;u.x=i/f*2-1,u.y=-s/p*2+1,a.setFromCamera(u,l),a.layers&&a.layers.enableAll&&a.layers.enableAll(),function(t,e){En>113?t.params.Line.threshold=e:t.linePrecision=e}(a,this._getLinePrecision(this.getMap().getResolution()));const d=[],g=[];h.children.forEach((e=>{const n=e.__parent;if(n&&n.getOptions){const r=n;r.getOptions().interactive&&r.isVisible()&&(r.identify&&t.Util.isFunction(r.identify)?g.push(r):d.push(e))}else(e instanceof o.Mesh||e instanceof o.Group)&&d.push(e)}));let y=[];const v=a.intersectObjects(d,!0);v&&Array.isArray(v)&&v.length&&(y=v.map((e=>{let n=e.object;const r=e.instanceId;n=this._recursionMesh(n)||{};const i=n.__parent||n;return i.faceIndex=e.faceIndex,i.index=e.index,i.intersect=e,t.Util.isNumber(r)&&(i.instanceId=r),i}))),this.renderPickScene(),g.length&&g.forEach((t=>{t.identify(e)&&y.push(t)}));const m=y.length;for(let t=0;t<m;t++)if(y[t])for(let e=t+1;e<m;e++)y[t]===y[e]&&y.splice(e,1);let A=y.filter((t=>t instanceof Fn));A=A.sort(((t,e)=>t.options.pickWeight-e.options.pickWeight)),y.forEach((t=>{t instanceof Fn||A.push(t)}));const _=(n=t.Util.extend({},n)).count;return t.Util.isNumber(_)&&_>0?A.slice(0,_):y}identifyAtPoint(t,e={}){const n=this.getMap();if(!n)return[];const r=n.containerPointToCoordinate(t);return this.identify(r,e)}_recursionMesh(t){for(;t&&t.parent!==this.getScene();)t=t.parent;return t}_getLinePrecision(t=10){for(let e=0,n=fu.length;e<n;e++){const[n,r]=fu[e];if(t>n)return r}return.01}fireGeoEvent(t,e,n){if(!(t instanceof Fn))return this;n=n||e.type;const r=this._getEventParams(e),{coordinate:i}=r,o=this.getMap();function s(t,e){e=e||n;const r=t.getInfoWindow();r&&!r._owner&&r.addTo(t);((r?r.options:{}).autoOpenOn||"click")===e&&(o.options.supportPluginEvent||t.openInfoWindow(i),t.fire("showinfowindow",{infoWindow:r}))}if("mousemove"===n){t.fire(n,Object.assign({},r,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(i),s(t)}else"mouseover"===n?t._mouseover||(t.fire("mouseover",Object.assign({},r,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,s(t,"mouseover")):"mouseout"===n?t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},r,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},r,{target:t,type:"mouseout"})),t.closeToolTip()):(t.fire(n,Object.assign({},r,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),s(t))}_emptyIdentify(t={}){const e=t.domEvent,n=this.getScene();if(!n)return this;const r=this.map||this.getMap();if(!r)return this;const i=r._getEventParams?r._getEventParams(e):this._getEventParams(e);for(let t=0,e=n.children.length;t<e;t++){const e=(n.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}}_identifyBaseObjectEvents(e){if(!this.options.geometryEvents)return this;const n=this.map||this.getMap();if(n.isInteracting()||!n.options.geometryEvents||n._ignoreEvent(e))return this;const r=e.type,i=n._getEventParams?n._getEventParams(e):this._getEventParams(e);i.type=r;const{type:o,coordinate:s}=i,a=t.Util.now();if(this._mousemoveTimeOut&&"mousemove"===o&&a-this._mousemoveTimeOut<64)return this;this._mousemoveTimeOut=a,"mousedown"!==o&&"touchstart"!==o||(this._mousedownTime=t.Util.now());let u=!1;if("click"===o||"touchend"===o){const e=n.options.clickTimeThreshold||280;u=t.Util.now()-this._mousedownTime<e}if("click"===o&&!u)return this;const l=this.options.identifyCountOnEvent;let h=Math.max(0,t.Util.isNumber(l)?l:0);0===h&&(h=1/0);const c=t=>{const e=[];this._baseObjects&&this._baseObjects.forEach((n=>{let r=!0;t.forEach((t=>{n===t&&(r=!1)})),r&&e.push(n)})),e.forEach((t=>{t&&t instanceof Fn&&(t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout"})),t.closeToolTip()))}))};if("mouseout"===o)return c([]),this._baseObjects=[],this;const f=this.identify(s,{count:h}),p=this.getScene();if(0===f.length&&p)for(let t=0,e=p.children.length;t<e;t++){const e=(p.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}function d(t,e){e=e||o;const n=t.getInfoWindow();n&&!n._owner&&n.addTo(t);((n?n.options:{}).autoOpenOn||"click")===e&&(t.openInfoWindow(s),t.fire("showinfowindow",{infoWindow:n}))}if("mousemove"===o?(c(f),f.forEach((t=>{if(t instanceof Fn){t._mouseover||(t.fire("mouseover",Object.assign({},i,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,d(t,"mouseover")),t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(s),d(t)}})),this._baseObjects=f):f.forEach((t=>{t instanceof Fn&&(t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t))})),"touchend"===o&&u){const n=t.Util.extend({},i,{domEvent:e});f.forEach((t=>{t instanceof Fn&&(t.fire("click",Object.assign({},n,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t,"click"))}))}return this}_getEventParams(e){const n=this.getMap(),r={domEvent:e};if(!n)return r;const i=e.touches&&e.touches.length>0?e.touches[0]:e.changedTouches&&e.changedTouches.length>0?e.changedTouches[0]:e;if(i){const e=(0,t.DomUtil.getEventContainerPoint)(i,n._containerDOM);r.coordinate=n.containerPointToCoordinate(e),r.containerPoint=e,r.viewPoint=n.containerPointToViewPoint(e),r.pont2d=n._containerPointToPoint(e)}return r}_zoomend(){const e=this.getScene();if(!e)return;const n=this.getMap().getZoom();e.children.forEach((e=>{const r=e.__parent;if(r&&r.getOptions){const e=r;e.zoomChange&&t.Util.isFunction(e.zoomChange)&&e.zoomChange(n);const i=e.getMinZoom(),o=e.getMaxZoom();n<i||n>o?(e.isVisible()&&(e.getObject3d().visible=!1),e._zoomVisible=!1):i<=n&&n<=o&&(e._visible&&(e.getObject3d().visible=!0),e._zoomVisible=!0)}}))}_getGeometryEventMapPanel(){const t=this.map||this.getMap();return t._panels.allLayers||t._containerDOM}onAdd(){super.onAdd();const e=this.map||this.getMap();if(!e)return this;const n=this._getGeometryEventMapPanel();return this._identifyBaseObjectEventsThis||(this._identifyBaseObjectEventsThis=this._identifyBaseObjectEvents.bind(this)),this._zoomendThis||(this._zoomendThis=this._zoomend.bind(this)),this._emptyIdentifyThis||(this._emptyIdentifyThis=this._emptyIdentify.bind(this)),e.options.supportPluginEvent?this.on("identifyempty",this._emptyIdentifyThis):t.DomUtil.on(n,pu.join(" "),this._identifyBaseObjectEventsThis,this),this._needsUpdate=!0,this._animationBaseObjectMap||(this._animationBaseObjectMap={}),e.on("zooming zoomend",this._zoomendThis,this),this}onRemove(){super.onRemove();const e=this.map||this.getMap();if(!e)return this;const n=this._getGeometryEventMapPanel();return e.options.supportPluginEvent?this.off("identifyempty",this._emptyIdentifyThis):t.DomUtil.off(n,pu.join(" "),this._identifyBaseObjectEventsThis,this),e.off("zooming zoomend",this._zoomendThis,this),this}_addBaseObjectsWhenInit(){return this.addMesh(this._meshes),this}_callbackBaseObjectAnimation(){const t=this;if(t._animationBaseObjectMap)for(const e in t._animationBaseObjectMap){t._animationBaseObjectMap[e]._animation()}return this}_getFovRatio(){const t=this.getMap().getFov();return Math.tan(t/2*cu)}}_u.mergeOptions({renderer:"gl",doubleBuffer:!1,glOptions:null,geometryEvents:!0,identifyCountOnEvent:0,forceRenderOnZooming:!0,loopRenderCount:50});const xu={bloom:!0};class wu extends t.renderer.CanvasLayerRenderer{constructor(){super(...arguments),this._renderTime=0,this._renderTarget=null}getPrepareParams(){return[this.scene,this.camera]}getDrawParams(){return[this.scene,this.camera]}_drawLayer(){super._drawLayer.apply(this,arguments)}hitDetect(){return!1}createCanvas(){super.createCanvas(),this.createContext()}createContext(){if(this.canvas.gl&&this.canvas.gl.wrap)this.gl=this.canvas.gl.wrap();else{const t=this.layer.options.glOptions||{alpha:!0,depth:!0,antialias:!0,stencil:!0,preserveDrawingBuffer:!1};t.preserveDrawingBuffer=!0,this.gl=this.gl||this._createGLContext(this.canvas,t)}this._initThreeRenderer(),this.layer.onCanvasCreate(this.context,this.scene,this.camera)}_initThreeRenderer(){this.matrix4=new o.Matrix4;const t=new o.WebGLRenderer({context:this.gl,alpha:!0});t.autoClear=!1,t.setClearColor(new o.Color(1,1,1),0),t.setSize(this.canvas.width,this.canvas.height),t.clear(),this.context=t;const e=this.scene=new o.Scene,n=this.layer.getMap(),r=n.getFov()*Math.PI/180,i=this.camera=new o.PerspectiveCamera(r,n.width/n.height,n.cameraNear,n.cameraFar);i.matrixAutoUpdate=!1,this._syncCamera(),e.add(i),this.pick=new Vs(this.layer),ho.star(),this.layer._addBaseObjectsWhenInit()}onCanvasCreate(){super.onCanvasCreate()}resizeCanvas(e){if(!this.canvas)return;let n,r=this.getMap();n=e||r.getSize();const i=r.getDevicePixelRatio?r.getDevicePixelRatio():t.Browser.retina?2:1,o=this.canvas,{width:s,height:a,cssWidth:u,cssHeight:l}=t.Util.calCanvasSize(n,i);if(!this.layer._canvas||o.style.width===u&&o.style.height===l||(o.style.width=u,o.style.height=l),o.width===s&&o.height===a)return this;o.width=s,o.height=a,this.context.setSize(o.width,o.height)}clearCanvas(){this.canvas&&this.context.clear()}prepareCanvas(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null}renderScene(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){const{width:e,height:n}=t.renderTarget.fbo;this._renderTarget?(this._renderTarget.viewport.set(0,0,e,n),this._renderTarget.scissor.set(0,0,e,n)):(this._renderTarget=new o.WebGLRenderTarget(e,n,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));const r=this.context.properties.get(this._renderTarget),i=r[mu];r[mu]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);const s=1===t.bloom&&t.sceneFilter,a=this.scene.children||[];let u=!1;if(s){const e=t.sceneFilter;u=e(xu);for(let t=0,n=a.length;t<n;t++){if(!a[t]||!a[t].layers)continue;const n=a[t].__parent;a[t].bloom=!1,n&&(a[t].bloom=n.bloom);let r=0;(a[t]&&e(a[t])||!n)&&u&&(r=1),a[t].__layer!==r&&(bu(a[t],r),a[t].__layer=r)}}else for(let t=0,e=a.length;t<e;t++)a[t]&&a[t].layers&&0!==a[t].__layer&&(bu(a[t],0),a[t].__layer=0);this.camera.layers.set(u?1:0),this.context.render(this.scene,this.camera),r[mu]=i}else{const{width:t,height:e}=this.canvas,n=this.context.getViewport(Au);n.width===t&&n.height===e||this.context.setViewport(0,0,t,e),this.context.render(this.scene,this.camera)}this.context.setRenderTarget(null),this.completeRender()}remove(){delete this._drawContext,this._renderTarget&&(this._renderTarget.dispose(),delete this._renderTarget),super.remove()}_syncCamera(){const t=this.getMap(),e=this.camera;e.matrix.elements=t.cameraWorldMatrix,e.projectionMatrix.elements=t.projMatrix,this.matrix4.invert?e.projectionMatrixInverse.elements=this.matrix4.copy(e.projectionMatrix).invert().elements:e.projectionMatrixInverse&&(e.projectionMatrixInverse.elements=this.matrix4.getInverse(e.projectionMatrix).elements)}_createGLContext(t,e){const n=["webgl2","webgl","experimental-webgl"];let r=null;for(let i=0;i<n.length;++i){try{r=t.getContext(n[i],e)}catch(t){}if(r)break}return r}}function bu(t,e){if(!t)return;t.layers&&t.layers.set(e);const n=t.children;if(n&&n.length)for(let t=0,r=n.length;t<r;t++)bu(n[t],e)}function Eu(t){return t.getGLRes?t.getGLRes():t.getGLZoom()}function Iu(t,e,n,r){return t.coordToPointAtRes?t.coordToPointAtRes(e,n,r):t.coordinateToPoint(e,n,r)}_u.registerRenderer("gl",wu),t.registerWorkerAdapter&&(t.registerWorkerAdapter("__maptalks.three__",'(function(t){"use strict";\n/*!\n * poly-extrude v0.16.0\n */function n(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function i(t,n){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i(t,n)}function e(t,n,i){void 0===i&&(i=2);var e,s,h,a=n&&n.length,u=a?n[0]*i:t.length,c=r(t,0,u,i,!0),x=[];if(!c||c.next===c.prev)return x;if(a&&(c=function(t,n,i,e){for(var s=[],o=0,h=n.length;o<h;o++){var a=r(t,n[o]*e,o<h-1?n[o+1]*e:t.length,e,!1);a===a.next&&(a.steiner=!0),s.push(d(a))}s.sort(l);for(var u=0;u<s.length;u++)i=f(s[u],i);return i}(t,n,c,i)),t.length>80*i){e=1/0,s=1/0;for(var y=-1/0,p=-1/0,v=i;v<u;v+=i){var g=t[v],_=t[v+1];g<e&&(e=g),_<s&&(s=_),g>y&&(y=g),_>p&&(p=_)}h=0!==(h=Math.max(y-e,p-s))?32767/h:0}return o(c,x,i,e,s,h,0),x}function r(t,n,i,e,r){var s;if(r===function(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,n,i,e)>0)for(var o=n;o<i;o+=e)s=P(o/e|0,t[o],t[o+1],s);else for(var h=i-e;h>=n;h-=e)s=P(h/e|0,t[h],t[h+1],s);return s&&m(s,s.next)&&(S(s),s=s.next),s}function s(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!m(e,e.next)&&0!==_(e.prev,e,e.next))e=e.next;else{if(S(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function o(t,n,i,e,r,l,f){if(t){!f&&l&&function(t,n,i,e){var r=t;do{0===r.z&&(r.z=y(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i=1;do{var e=t,r=void 0;t=null;var s=null;for(n=0;e;){n++;for(var o=e,h=0,a=0;a<i&&(h++,o=o.nextZ);a++);for(var u=i;h>0||u>0&&o;)0!==h&&(0===u||!o||e.z<=o.z)?(r=e,e=e.nextZ,h--):(r=o,o=o.nextZ,u--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;e=o}s.nextZ=null,i*=2}while(n>1)}(r)}(t,e,r,l);for(var x=t;t.prev!==t.next;){var d=t.prev,p=t.next;if(l?a(t,e,r,l):h(t))n.push(d.i,t.i,p.i),S(t),t=p.next,x=p.next;else if((t=p)===x){f?1===f?o(t=u(s(t),n),n,i,e,r,l,2):2===f&&c(t,n,i,e,r,l):o(s(t),n,i,e,r,l,1);break}}}}function h(t){var n=t.prev,i=t,e=t.next;if(_(n,i,e)>=0)return!1;for(var r=n.x,s=i.x,o=e.x,h=n.y,a=i.y,u=e.y,c=Math.min(r,s,o),l=Math.min(h,a,u),f=Math.max(r,s,o),x=Math.max(h,a,u),y=e.next;y!==n;){if(y.x>=c&&y.x<=f&&y.y>=l&&y.y<=x&&v(r,h,s,a,o,u,y.x,y.y)&&_(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function a(t,n,i,e){var r=t.prev,s=t,o=t.next;if(_(r,s,o)>=0)return!1;for(var h=r.x,a=s.x,u=o.x,c=r.y,l=s.y,f=o.y,x=Math.min(h,a,u),d=Math.min(c,l,f),p=Math.max(h,a,u),g=Math.max(c,l,f),m=y(x,d,n,i,e),z=y(p,g,n,i,e),w=t.prevZ,M=t.nextZ;w&&w.z>=m&&M&&M.z<=z;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;w&&w.z>=m;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=z;){if(M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function u(t,n){var i=t;do{var e=i.prev,r=i.next.next;!m(e,r)&&z(e,i,i.next,r)&&b(e,r)&&b(r,e)&&(n.push(e.i,i.i,r.i),S(i),S(i.next),i=t=r),i=i.next}while(i!==t);return s(i)}function c(t,n,i,e,r,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&g(a,u)){var c=A(a,u);return a=s(a,a.next),c=s(c,c.next),o(a,n,i,e,r,h,0),void o(c,n,i,e,r,h,0)}u=u.next}a=a.next}while(a!==t)}function l(t,n){var i=t.x-n.x;0===i&&(0===(i=t.y-n.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(n.next.y-n.y)/(n.next.x-n.x)));return i}function f(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;if(m(t,e))return e;do{if(m(t,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,i=e.x<e.next.x?e:e.next,h===r))return i}e=e.next}while(e!==n);if(!i)return null;var a=i,u=i.x,c=i.y,l=1/0;e=i;do{if(r>=e.x&&e.x>=u&&r!==e.x&&p(s<c?r:o,s,u,c,s<c?o:r,s,e.x,e.y)){var f=Math.abs(s-e.y)/(r-e.x);b(e,t)&&(f<l||f===l&&(e.x>i.x||e.x===i.x&&x(i,e)))&&(i=e,l=f)}e=e.next}while(e!==a);return i}(t,n);if(!i)return n;var e=A(i,t);return s(e,e.next),s(i,i.next)}function x(t,n){return _(t.prev,t,n.prev)<0&&_(n.next,t,t.next)<0}function y(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-e)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function d(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function p(t,n,i,e,r,s,o,h){return(r-o)*(n-h)>=(t-o)*(s-h)&&(t-o)*(e-h)>=(i-o)*(n-h)&&(i-o)*(s-h)>=(r-o)*(e-h)}function v(t,n,i,e,r,s,o,h){return!(t===o&&n===h)&&p(t,n,i,e,r,s,o,h)}function g(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&z(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(b(t,n)&&b(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(_(t.prev,t,n.prev)||_(t,n.prev,n))||m(t,n)&&_(t.prev,t,t.next)>0&&_(n.prev,n,n.next)>0)}function _(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function m(t,n){return t.x===n.x&&t.y===n.y}function z(t,n,i,e){var r=M(_(t,n,i)),s=M(_(t,n,e)),o=M(_(i,e,t)),h=M(_(i,e,n));return r!==s&&o!==h||(!(0!==r||!w(t,i,n))||(!(0!==s||!w(t,e,n))||(!(0!==o||!w(i,t,e))||!(0!==h||!w(i,n,e)))))}function w(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function M(t){return t>0?1:t<0?-1:0}function b(t,n){return _(t.prev,t,t.next)<0?_(t,n,t.next)>=0&&_(t,t.prev,n)>=0:_(t,n,t.prev)<0||_(t,t.next,n)<0}function A(t,n){var i=C(t.i,t.x,t.y),e=C(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function P(t,n,i,e){var r=C(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function S(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function C(t,n,i){return{i:t,x:n,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var k=new(function(){function t(t,n,i,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===e&&(e=1),this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=e}t.slerpFlat=function(t,n,i,e,r,s,o){var h=i[e+0],a=i[e+1],u=i[e+2],c=i[e+3],l=r[s+0],f=r[s+1],x=r[s+2],y=r[s+3];if(0===o)return t[n+0]=h,t[n+1]=a,t[n+2]=u,void(t[n+3]=c);if(1===o)return t[n+0]=l,t[n+1]=f,t[n+2]=x,void(t[n+3]=y);if(c!==y||h!==l||a!==f||u!==x){var d=1-o,p=h*l+a*f+u*x+c*y,v=p>=0?1:-1,g=1-p*p;if(g>Number.EPSILON){var _=Math.sqrt(g),m=Math.atan2(_,p*v);d=Math.sin(d*m)/_,o=Math.sin(o*m)/_}var z=o*v;if(h=h*d+l*z,a=a*d+f*z,u=u*d+x*z,c=c*d+y*z,d===1-o){var w=1/Math.sqrt(h*h+a*a+u*u+c*c);h*=w,a*=w,u*=w,c*=w}}t[n]=h,t[n+1]=a,t[n+2]=u,t[n+3]=c},t.multiplyQuaternionsFlat=function(t,n,i,e,r,s){var o=i[e],h=i[e+1],a=i[e+2],u=i[e+3],c=r[s],l=r[s+1],f=r[s+2],x=r[s+3];return t[n]=o*x+u*c+h*f-a*l,t[n+1]=h*x+u*l+a*c-o*f,t[n+2]=a*x+u*f+o*l-h*c,t[n+3]=u*x-o*c-h*l-a*f,t};var i,e,r,s=t.prototype;return s.set=function(t,n,i,e){return this._x=t,this._y=n,this._z=i,this._w=e,this._onChangeCallback(),this},s.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},s.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},s.setFromEuler=function(t,n){void 0===n&&(n=!0);var i=t._x,e=t._y,r=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(i/2),u=o(e/2),c=o(r/2),l=h(i/2),f=h(e/2),x=h(r/2);switch(s){case"XYZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"YXZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"ZXY":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"ZYX":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"YZX":this._x=l*u*c+a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c-l*f*x;break;case"XZY":this._x=l*u*c-a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c+l*f*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===n&&this._onChangeCallback(),this},s.setFromAxisAngle=function(t,n){var i=n/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this},s.setFromRotationMatrix=function(t){var n=t.elements,i=n[0],e=n[4],r=n[8],s=n[1],o=n[5],h=n[9],a=n[2],u=n[6],c=n[10],l=i+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this._w=.25/f,this._x=(u-h)*f,this._y=(r-a)*f,this._z=(s-e)*f}else if(i>o&&i>c){var x=2*Math.sqrt(1+i-o-c);this._w=(u-h)/x,this._x=.25*x,this._y=(e+s)/x,this._z=(r+a)/x}else if(o>c){var y=2*Math.sqrt(1+o-i-c);this._w=(r-a)/y,this._x=(e+s)/y,this._y=.25*y,this._z=(h+u)/y}else{var d=2*Math.sqrt(1+c-i-o);this._w=(s-e)/d,this._x=(r+a)/d,this._y=(h+u)/d,this._z=.25*d}return this._onChangeCallback(),this},s.setFromUnitVectors=function(t,n){var i=t.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=i),this.normalize()},s.rotateTowards=function(t,n){var i=this.angleTo(t);if(0===i)return this;var e=Math.min(1,n/i);return this.slerp(t,e),this},s.identity=function(){return this.set(0,0,0,1)},s.invert=function(){return this.conjugate()},s.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},s.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},s.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},s.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},s.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},s.multiply=function(t){return this.multiplyQuaternions(this,t)},s.premultiply=function(t){return this.multiplyQuaternions(t,this)},s.multiplyQuaternions=function(t,n){var i=t._x,e=t._y,r=t._z,s=t._w,o=n._x,h=n._y,a=n._z,u=n._w;return this._x=i*u+s*o+e*a-r*h,this._y=e*u+s*h+r*o-i*a,this._z=r*u+s*a+i*h-e*o,this._w=s*u-i*o-e*h-r*a,this._onChangeCallback(),this},s.slerp=function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var i=this._x,e=this._y,r=this._z,s=this._w,o=s*t._w+i*t._x+e*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=i,this._y=e,this._z=r,this;var h=1-o*o;if(h<=Number.EPSILON){var a=1-n;return this._w=a*s+n*this._w,this._x=a*i+n*this._x,this._y=a*e+n*this._y,this._z=a*r+n*this._z,this.normalize(),this}var u=Math.sqrt(h),c=Math.atan2(u,o),l=Math.sin((1-n)*c)/u,f=Math.sin(n*c)/u;return this._w=s*l+this._w*f,this._x=i*l+this._x*f,this._y=e*l+this._y*f,this._z=r*l+this._z*f,this._onChangeCallback(),this},s.slerpQuaternions=function(t,n,i){return this.copy(t).slerp(n,i)},s.random=function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(n),r*Math.cos(n))},s.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},s.fromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this},s.toArray=function(t,n){return void 0===t&&(t=[]),void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t},s.fromBufferAttribute=function(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this},s.toJSON=function(){return this.toArray()},s._onChange=function(t){return this._onChangeCallback=t,this},s._onChangeCallback=function(){},i=t,(e=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])&&n(i.prototype,e),r&&n(i,r),Object.defineProperty(i,"prototype",{writable:!1}),t}()),Z=function(){function t(t,n,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),this.x=t,this.y=n,this.z=i}var n=t.prototype;return n.set=function(t,n,i){return void 0===i&&(i=this.z),this.x=t,this.y=n,this.z=i,this},n.clone=function(){return new this.constructor(this.x,this.y,this.z)},n.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.addVectors=function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this},n.addScaledVector=function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this},n.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.subVectors=function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this},n.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.multiplyVectors=function(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this},n.applyAxisAngle=function(t,n){return this.applyQuaternion(k.setFromAxisAngle(t,n))},n.applyMatrix4=function(t){var n=this.x,i=this.y,e=this.z,r=t.elements,s=1/(r[3]*n+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*e+r[12])*s,this.y=(r[1]*n+r[5]*i+r[9]*e+r[13])*s,this.z=(r[2]*n+r[6]*i+r[10]*e+r[14])*s,this},n.applyQuaternion=function(t){var n=this.x,i=this.y,e=this.z,r=t.x,s=t.y,o=t.z,h=t.w,a=h*n+s*e-o*i,u=h*i+o*n-r*e,c=h*e+r*i-s*n,l=-r*n-s*i-o*e;return this.x=a*h+l*-r+u*-o-c*-s,this.y=u*h+l*-s+c*-r-a*-o,this.z=c*h+l*-o+a*-s-u*-r,this},n.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.divideScalar=function(t){return this.multiplyScalar(1/t)},n.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},n.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},n.clamp=function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this},n.clampScalar=function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this},n.clampLength=function(t,n){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,i)))},n.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.normalize=function(){return this.divideScalar(this.length()||1)},n.setLength=function(t){return this.normalize().multiplyScalar(t)},n.lerp=function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this},n.lerpVectors=function(t,n,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this},n.cross=function(t){return this.crossVectors(this,t)},n.crossVectors=function(t,n){var i=t.x,e=t.y,r=t.z,s=n.x,o=n.y,h=n.z;return this.x=e*h-r*o,this.y=r*s-i*h,this.z=i*o-e*s,this},n.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.fromArray=function(t,n){return void 0===n&&(n=0),this.x=t[n],this.y=t[n+1],this.z=t[n+2],this},n.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function F(t){let n,i,e=0,r=1;const s=t.length;for(;r<s;)n=i||t[0],i=t[r],e+=(i[0]-n[0])*(i[1]+n[1]),r++;return e>0}function V(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t}function L(t,n){const i=n[0],e=n[1],r=n[2],s=Math.sqrt(i*i+e*e+r*r)||1;return t[0]=i/s,t[1]=e/s,t[2]=r/s,t}function q(t,n,i){const e=n[0],r=n[1],s=n[2],o=i[0],h=i[1],a=i[2];return t[0]=r*a-s*h,t[1]=s*o-e*a,t[2]=e*h-r*o,t}function E(t,n){function i(t,n,i,e){t[0]=n,t[1]=i,t[2]=e}const e=[],r=[],s=[],o=[],h=[],a=[],u=t.length,c=new Float32Array(n.length);let l=0;for(;l<u;){const u=3*t[l],f=3*t[l+1],x=3*t[l+2];i(e,n[u],n[u+1],n[u+2]),i(r,n[f],n[f+1],n[f+2]),i(s,n[x],n[x+1],n[x+2]),V(h,s,r),V(o,e,r),q(a,h,o);for(let t=0;t<3;t++)c[u+t]+=a[t],c[f+t]+=a[t],c[x+t]+=a[t];l+=3}let f=0;const x=c.length;for(;f<x;)i(a,c[f],c[f+1],c[f+2]),L(a,a),c[f]=a[0]||0,c[f+1]=a[1]||0,c[f+2]=a[2]||0,f+=3;return c}function I(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let n=0,i=0;for(let e=0,r=t.length;e<r;e++){const{position:r,indices:s}=t[e];n+=r.length,i+=s.length}const e={position:new Float32Array(n),normal:new Float32Array(n),uv:new Float32Array(n/3*2),indices:new Uint32Array(i),results:t};let r=0,s=0,o=0,h=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:a,normal:u,uv:c}=t[n];e.position.set(i,r),e.normal.set(u,r),e.uv.set(c,h);let l=0;const f=a.length;for(;l<f;){const t=a[l]+s;e.indices[o]=t,o++,l++}h+=c.length,r+=i.length,s+=i.length/3}return e}function O(t){return 180*t/Math.PI}function U(t){return t/180*Math.PI}function N(t,n,i,e,r,s){const o=3*i,h=3*e,a=3*r,u=3*s,c=n[o],l=n[o+1],f=n[o+2],x=n[h],y=n[h+1],d=n[h+2],p=n[a],v=n[a+1],g=n[a+2],_=n[u],m=n[u+1],z=n[u+2];let w=t.length-1;Math.abs(l-y)<Math.abs(c-x)?(t[++w]=c,t[++w]=1-f,t[++w]=x,t[++w]=1-d,t[++w]=p,t[++w]=1-g,t[++w]=_,t[++w]=1-z):(t[++w]=l,t[++w]=1-f,t[++w]=y,t[++w]=1-d,t[++w]=v,t[++w]=1-g,t[++w]=m,t[++w]=1-z)}function j(t,n){n=Object.assign({},{depth:2,top:!0},n);const i=t.map((t=>{for(let n=0,i=t.length;n<i;n++){const i=t[n];Q(i),0===n?F(i)||(t[n]=i.reverse()):F(i)&&(t[n]=i.reverse()),R(i)&&i.splice(i.length-1,1)}const i=function(t,n){const i=function(t){let n=0,i=0;const e=t.length;for(;i<e;)n+=t[i].length,i++;return n}(t),e=t.length,r=[],s=new Float32Array(2*i),o=[],h=[],a=3*i,u=2*i,c=n.depth;let l=0,f=0,x=0;for(let n=0;n<e;n++){const i=t[n];n>0&&r.push(l/2);let e=0;const y=i.length;for(;e<y;){const t=i[e],n=t[0],r=t[1],y=t[2]||0;s[l++]=n,s[l++]=r,o[f]=n,o[f+1]=r,o[f+2]=c+y,o[a+f]=n,o[a+f+1]=r,o[a+f+2]=y,h[x]=n,h[x+1]=r,h[u+x]=n,h[u+x+1]=r,f+=3,x+=2,e++}}return{flatVertices:s,holes:r,points:o,count:i,uv:h}}(t,n);i.polygon=t;return function(t,n,i){const e=[],{count:r}=t,s=i.top;for(let t=0,i=n.length;t<i;t+=3){const o=n[t],h=n[t+1],a=n[t+2];s&&(e[t]=o,e[t+1]=h,e[t+2]=a);let u=i+t;const c=r+o,l=r+h,f=r+a;s||(u=t),e[u]=c,e[u+1]=l,e[u+2]=f}t.indices=e}(i,e(i.flatVertices,i.holes,2),n),function(t,n){const{points:i,indices:e,polygon:r,uv:s}=t,o=n.depth;let h=i.length-1,a=e.length-1;for(let t=0,n=r.length;t<n;t++){const n=r[t];let u=0;const c=n.length;for(;u<c;){const t=n[u];let r=n[u+1];u===c-1&&(r=n[0]);const l=i.length/3,f=t[0],x=t[1],y=t[2]||0,d=r[0],p=r[1],v=r[2]||0;i[++h]=f,i[++h]=x,i[++h]=y+o,i[++h]=d,i[++h]=p,i[++h]=v+o,i[++h]=f,i[++h]=x,i[++h]=y,i[++h]=d,i[++h]=p,i[++h]=v;const g=l+2,_=l+3,m=l,z=l+1;e[++a]=g,e[++a]=m,e[++a]=_,e[++a]=m,e[++a]=z,e[++a]=_,N(s,i,g,_,m,z),u++}}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),r=I(i);return r.polygons=t,r}function Q(t){R(t)||t.push(t[0])}function R(t){const n=t.length,[i,e]=t[0],[r,s]=t[n-1];return i===r&&e===s}function W(t,n){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(n=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n));const i=t.map((t=>{const i=function(t,n){let i=n.lineWidth/2;n.isSlope&&(i*=2);const e=[],r=[],s=[],o=t.length;let h=0;for(;h<o;){let n=t[h],a=t[h+1];const u=t[h];h===o-1&&(n=t[o-2],a=t[o-1]);const c=a[1]-n[1],l=a[0]-n[0];let f=0;const x=O(Math.atan(c/l));if(0===h||h===o-1)f=x,f-=90;else{const i=t[h-1];B.x=i[0]-n[0],B.y=i[1]-n[1],T.x=a[0]-n[0],T.y=a[1]-n[1];f=x-H(B,T)/2}const y=U(f),d=u,p=[Math.cos(y)+d[0],Math.sin(y)+d[1]],[v,g]=Y(n,a,i);let _=D(v[0],v[1],d,p),m=D(g[0],g[1],d,p);if(!_||!m){const t=e.length,n=e[t-2],i=e[t-1];if(!n||!i)continue;_=[n[0],n[1]],m=[i[0],i[1]]}_[2]=u[2]||0,m[2]=u[2]||0,e.push(_,m),X(_,n,a)?(r.push(_),s.push(m)):(r.push(m),s.push(_)),h++}return{offsetPoints:e,leftPoints:r,rightPoints:s,line:t}}(t,n);return i.line=t,function(t,n){const i=n.bottomStickGround,e=n.depth,r=t.depths;let s=e,o=e;r&&(s=r[0],o=r[1]);const{leftPoints:h,rightPoints:a}=t,u=t.line,c=n.pathUV;if(c){!function(t){let n=0;for(let i=0,e=t.length;i<e;i++){const e=t[i],r=t[i+1];if(0===i&&(e.distance=0),e&&r){const[t,i,s]=e,[o,h,a]=r,u=t-o,c=i-h,l=(s||0)-(a||0);n+=Math.sqrt(u*u+c*c+l*l),r.distance=n}}}(u);for(let t=0,n=u.length;t<n;t++)h[t].distance=a[t].distance=u[t].distance}let l=0,f=h.length;const x=[],y=[],d=[];for(;l<f;){const t=3*l,[n,e,r]=h[l];x[t]=n,x[t+1]=e,x[t+2]=s+r;const[y,p,v]=a[l],g=3*f+t;x[g]=y,x[g+1]=p,x[g+2]=o+v;const _=2*f*3+t;x[_]=n,x[_+1]=e,x[_+2]=r,i&&(x[_+2]=0);const m=2*f*3+3*f+t;if(x[m]=y,x[m+1]=p,x[m+2]=v,i&&(x[m+2]=0),c){const t=u[l].distance,n=2*l;d[n]=t,d[n+1]=1;const i=2*f+n;d[i]=t,d[i+1]=0;const e=2*f*2+n;d[e]=t,d[e+1]=1;const r=2*f*2+2*f+n;d[r]=t,d[r+1]=0}l++}if(!c){l=0,f=x.length;let t=d.length-1;for(;l<f;){const n=x[l],i=x[l+1];d[++t]=n,d[++t]=i,l+=3}}l=0,f=h.length;let p=y.length-1;for(;l<f-1;){const t=l,n=l+1,i=t+f,e=n+f;y[++p]=t,y[++p]=i,y[++p]=n,y[++p]=i,y[++p]=e,y[++p]=n;const r=l+2*f,s=r+1,o=r+f,h=s+f;y[++p]=r,y[++p]=o,y[++p]=s,y[++p]=o,y[++p]=h,y[++p]=s,l++}if(t.indices=y,t.points=x,t.uv=d,r)for(f=h.length,l=0;l<f;)h[l].depth=s,a[l].depth=o,l++}(i,n),function(t,n){const{points:i,indices:e,leftPoints:r,rightPoints:s,uv:o}=t,h=n.depth,a=n.bottomStickGround,u=[r,s],c=t.depths,l=n.pathUV,f=n.lineWidth;let x=i.length-1,y=e.length-1,d=o.length-1;function p(t,n){const r=i.length/3,s=c?t.depth:h,u=c?n.depth:h;i[++x]=t[0],i[++x]=t[1],i[++x]=s+t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=u+n[2],i[++x]=t[0],i[++x]=t[1],i[++x]=a?0:t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=a?0:n[2];const p=r+2,v=r+3,g=r,_=r+1;e[++y]=p,e[++y]=g,e[++y]=v,e[++y]=g,e[++y]=_,e[++y]=v,l?(o[++d]=t.distance,o[++d]=s/f,o[++d]=n.distance,o[++d]=u/f,o[++d]=t.distance,o[++d]=0,o[++d]=n.distance,o[++d]=0):N(o,i,p,v,g,_)}for(let t=0,n=u.length;t<n;t++){let n=u[t];t>0&&(n=n.map((t=>t)),n=n.reverse());let i=0;const e=n.length-1;for(;i<e;){p(n[i],n[i+1]),i++}}const v=r.length,g=[s[0],r[0],r[v-1],s[v-1]];for(let t=0;t<g.length;t+=2){p(g[t],g[t+1])}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),e=I(i);return e.lines=t,e}const B={x:0,y:0},T={x:0,y:0};const H=({x:t,y:n},{x:i,y:e})=>{const r=t*i+n*e,s=t*e-n*i;return(Math.atan2(s,r)/Math.PI*180+360)%360};function X(t,n,i){const[e,r]=n,[s,o]=i,[h,a]=t;return(r-o)*h+(s-e)*a+e*o-s*r>0}function Y(t,n,i){const e=n[1]-t[1],r=n[0]-t[0],s=Math.atan2(e,r),o=s+Math.PI/2;let h=Math.cos(o)*i,a=Math.sin(o)*i;const u=[t[0]+h,t[1]+a],c=[n[0]+h,n[1]+a],l=s-Math.PI/2;h=Math.cos(l)*i,a=Math.sin(l)*i;return[[u,c],[[t[0]+h,t[1]+a],[n[0]+h,n[1]+a]]]}function D(t,n,i,e){const r=n[0]-t[0],s=n[1]-t[1],o=e[0]-i[0],h=e[1]-i[1];if(0===r&&0===o)return null;if(0===s&&0===h)return null;const a=s/r,u=h/o,c=t[1]-a*t[0],l=i[1]-u*i[0];let f,x;return 0===r?(f=t[0],x=u*f+l):0===o?(f=i[0],x=a*f+c):0===s?(x=t[1],f=(x-l)/u):0===h?(x=i[1],f=(x-c)/a):(f=(l-c)/(a-u),x=a*f+c),[f,x]}function G(t,n){n=Object.assign({},{radius:1,height:2,radialSegments:6},n);const i=Math.round(Math.max(4,n.radialSegments));let{radius:e,height:r}=n;e=e,r=r;const s=360/i/360*Math.PI*2,o=i+1,h=new Float32Array(3*o*2),[a,u]=t;let c=0,l=0;const f=3*o,x=2*o,y=[],d=[];let p=y.length-1;for(let t=-1;t<i;t++){const n=s*t,i=Math.cos(n)*e+a,o=Math.sin(n)*e+u;h[c]=i,h[c+1]=o,h[c+2]=0,h[c+f]=i,h[c+1+f]=o,h[c+2+f]=r;let v=0,g=0;v=.5+i/e/2,g=.5+o/e/2,d[l]=v,d[l+1]=g,d[l+x]=v,d[l+1+x]=g,c+=3,l+=2,t>1&&(y[++p]=0,y[++p]=t-1,y[++p]=t)}c-=3,h[c]=h[0],h[c+1]=h[1],h[c+2]=h[2];const v=h.length;h[v-3]=h[0],h[v-2]=h[1],h[v-1]=r;const g=y.length;p=y.length-1;for(let t=0;t<g;t++){const n=y[t];y[++p]=n+o}const _=new Float32Array(2*(3*o*2-6));let m=-1;c=2*o,l=0,p=y.length-1;let z=d.length-1;for(let t=0,n=h.length/2;t<n-3;t+=3){const n=h[t],i=h[t+1],s=h[t+3],a=h[t+4];_[++m]=n,_[++m]=i,_[++m]=r,_[++m]=s,_[++m]=a,_[++m]=r,_[++m]=n,_[++m]=i,_[++m]=0,_[++m]=s,_[++m]=a,_[++m]=0;const u=c+2,f=c+3,x=c,v=c+1;y[++p]=x,y[++p]=u,y[++p]=v,y[++p]=u,y[++p]=f,y[++p]=v,c+=4;const g=l/o,w=(l+1)/o;d[++z]=g,d[++z]=r/e/2,d[++z]=w,d[++z]=r/e/2,d[++z]=g,d[++z]=0,d[++z]=w,d[++z]=0,l++}const w=new Float32Array(h.length+_.length);w.set(h,0),w.set(_,h.length);const M=E(y,w);return{points:h,indices:new Uint32Array(y),position:w,normal:M,uv:new Float32Array(d)}}var J=function(){function t(){this.pos=new Z,this.dir=new Z,this.right=new Z,this.up=new Z,this.dist=0,this.widthScale=1,this.sharp=!1}var n=t.prototype;return n.lerpPathPoints=function(t,n,i){this.pos.lerpVectors(t.pos,n.pos,i),this.dir.lerpVectors(t.dir,n.dir,i),this.up.lerpVectors(t.up,n.up,i),this.right.lerpVectors(t.right,n.right,i),this.dist=(n.dist-t.dist)*i+t.dist,this.widthScale=(n.widthScale-t.widthScale)*i+t.widthScale},n.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),K=function(){function t(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d)}var n=t.prototype;return n.set=function(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){var p=this.elements;return p[0]=t,p[4]=n,p[8]=i,p[12]=e,p[1]=r,p[5]=s,p[9]=o,p[13]=h,p[2]=a,p[6]=u,p[10]=c,p[14]=l,p[3]=f,p[7]=x,p[11]=y,p[15]=d,this},n.multiply=function(t){return this.multiplyMatrices(this,t)},n.makeRotationAxis=function(t,n){var i=Math.cos(n),e=Math.sin(n),r=1-i,s=t.x,o=t.y,h=t.z,a=r*s,u=r*o;return this.set(a*s+i,a*o-e*h,a*h+e*o,0,a*o+e*h,u*o+i,u*h-e*s,0,a*h-e*o,u*h+e*s,r*h*h+i,0,0,0,0,1),this},n.equals=function(t){for(var n=this.elements,i=t.elements,e=0;e<16;e++)if(n[e]!==i[e])return!1;return!0},t}();function $(t,n,i,e){return function(t,n){var i=1-t;return i*i*n}(t,n)+function(t,n){return 2*(1-t)*t*n}(t,i)+function(t,n){return t*t*n}(t,e)}var tt=function(t){var n,e;function r(n,i,e){var r;return void 0===n&&(n=new Z),void 0===i&&(i=new Z),void 0===e&&(e=new Z),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=i,r.v2=e,r}return e=t,(n=r).prototype=Object.create(e.prototype),n.prototype.constructor=n,i(n,e),r.prototype.getPoint=function(t,n){void 0===n&&(n=new Z);var i=n,e=this.v0,r=this.v1,s=this.v2;return i.set($(t,e.x,r.x,s.x),$(t,e.y,r.y,s.y),$(t,e.z,r.z,s.z)),i},r}(function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var n=t.prototype;return n.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},n.getPointAt=function(t,n){var i=this.getUtoTmapping(t);return this.getPoint(i,n)},n.getPoints=function(t){void 0===t&&(t=5);for(var n=[],i=0;i<=t;i++)n.push(this.getPoint(i/t));return n},n.getLength=function(){var t=this.getLengths();return t[t.length-1]},n.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var n,i=[],e=this.getPoint(0),r=0;i.push(0);for(var s=1;s<=t;s++)r+=(n=this.getPoint(s/t)).distanceTo(e),i.push(r),e=n;return this.cacheArcLengths=i,i},n.getUtoTmapping=function(t,n){var i,e=this.getLengths(),r=0,s=e.length;i=n||t*e[s-1];for(var o,h=0,a=s-1;h<=a;)if((o=e[r=Math.floor(h+(a-h)/2)]-i)<0)h=r+1;else{if(!(o>0)){a=r;break}a=r-1}if(e[r=a]===i)return r/(s-1);var u=e[r];return(r+(i-u)/(e[r+1]-u))/(s-1)},t}()),nt=new Z,it=new Z,et=new Z,rt=new K,st=new tt;var ot=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,i,e,r){if(void 0===n&&(n=.1),void 0===i&&(i=10),void 0===e&&(e=null),void 0===r&&(r=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);r&&!t[0].equals(t[t.length-1])&&t.push((new Z).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],e);else if(s===o-1)if(r){this._corner(t[s],t[1],n,i,e);var h=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=h}else this._end(t[s]);else this._corner(t[s],t[s+1],n,i,e)},n.distance=function(){return this.count>0?this.array[this.count-1].dist:0},n._getByIndex=function(t){return this.array[t]||(this.array[t]=new J),this.array[t]},n._start=function(t,n,i){this.count=0;var e=this._getByIndex(this.count);if(e.pos.copy(t),e.dir.subVectors(n,t),i)e.up.copy(i);else{var r=Number.MAX_VALUE,s=Math.abs(e.dir.x),o=Math.abs(e.dir.y),h=Math.abs(e.dir.z);s<r&&(r=s,e.up.set(1,0,0)),o<r&&(r=o,e.up.set(0,1,0)),h<r&&e.up.set(0,0,1)}e.right.crossVectors(e.dir,e.up).normalize(),e.up.crossVectors(e.right,e.dir).normalize(),e.dist=0,e.widthScale=1,e.sharp=!1,e.dir.normalize(),this.count++},n._end=function(t){var n=this.array[this.count-1],i=this._getByIndex(this.count);i.pos.copy(t),i.dir.subVectors(t,n.pos);var e=i.dir.length();i.dir.normalize(),i.up.copy(n.up);var r=nt.crossVectors(n.dir,i.dir);if(r.length()>Number.EPSILON){r.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(i.dir),-1),1));i.up.applyMatrix4(rt.makeRotationAxis(r,s))}i.right.crossVectors(i.dir,i.up).normalize(),i.dist=n.dist+e,i.widthScale=1,i.sharp=!1,this.count++},n._corner=function(t,n,i,e,r){if(i>0&&e>0){for(var s=function(t,n,i,e,r,s){var o=nt.subVectors(n,t),h=it.subVectors(i,n),a=o.length(),u=h.length();o.normalize(),h.normalize();var c=Math.min(.999999*(r?a/2:a),e);s.v0.copy(n).sub(o.multiplyScalar(c)),s.v1.copy(n);var l=Math.min(u/2*.999999,e);return s.v2.copy(n).add(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,i,this.count-1==0,st),o=s.getPoints(e),h=0;h<e;h++)this._sharpCorner(o[h],o[h+1],r,0===h?1:0);o[e].equals(n)||this._sharpCorner(o[e],n,r,2)}else this._sharpCorner(t,n,r,0,!0)},n._sharpCorner=function(t,n,i,e,r){void 0===e&&(e=0),void 0===r&&(r=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),h=nt.subVectors(t,s.pos),a=it.subVectors(n,t),u=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===e?o.dir.copy(h):2===e?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),i)1===o.dir.dot(i)?o.right.crossVectors(a,i).normalize():o.right.crossVectors(o.dir,i).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var c=et.crossVectors(s.dir,o.dir);if(c.length()>Number.EPSILON){c.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(rt.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;var f=h.dot(a);o.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,o.sharp=Math.abs(f-1)>.05&&r,this.count++},t}();const ht=new Z(0,0,1),at=new Z,ut=new Z,ct=new Z,lt=new Z,ft=new Z,xt=new Z;function yt(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);const i=t.map((t=>{const i=function(t){const n=[];for(let i=0,e=t.length;i<e;i++){const e=t[i],[r,s,o]=e,h=new Z(r,s,o||0);n[i]=h}return n}(t),e=new ot;e.set(i,n.cornerRadius,n.cornerSplit,ht);const r=function(t,n){const i=n.lineWidth||.1,e=1,r=i/2,s=i,o=t.distance(),h=e*o;let a=0;const u=[],c=[],l=[],f=[];let x=0;if(0===o)return{position:u,normal:c,uv:l,indices:f,count:a};const y=r/s;let d,p=u.length-1,v=c.length-1,g=l.length-1,_=f.length-1;function m(t){const n=0===u.length,i=t.sharp&&!n,e=t.dist/s,o=t.dir,h=t.up,d=t.right;if(at.copy(d).multiplyScalar(r*t.widthScale),ut.copy(d).multiplyScalar(-r*t.widthScale),at.add(t.pos),ut.add(t.pos),i){ct.fromArray(u,u.length-6).sub(ut),lt.fromArray(u,u.length-3).sub(at);const t=ct.length()-lt.length();let n,i;t>0?(n=ct,i=ut):(n=lt,i=at),ft.copy(n).setLength(Math.abs(t)).add(i);let r=xt.copy(i).sub(ft).normalize().dot(o)*xt.copy(i).sub(ft).length()*2;xt.copy(o).setLength(r).add(ft),t>0?(u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,x+=6,f[++_]=x-6,f[++_]=x-8,f[++_]=x-7,f[++_]=x-6,f[++_]=x-7,f[++_]=x-5,f[++_]=x-4,f[++_]=x-6,f[++_]=x-5,f[++_]=x-2,f[++_]=x-4,f[++_]=x-1,a+=12):(u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.z,x+=6,f[++_]=x-6,f[++_]=x-8,f[++_]=x-7,f[++_]=x-6,f[++_]=x-7,f[++_]=x-5,f[++_]=x-6,f[++_]=x-5,f[++_]=x-3,f[++_]=x-2,f[++_]=x-3,f[++_]=x-1,a+=12);for(let t=0;t<6;t++)c[++v]=h.x,c[++v]=h.y,c[++v]=h.z;l[++g]=e-y,l[++g]=0,l[++g]=e-y,l[++g]=1,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,l[++g]=e+y,l[++g]=0,l[++g]=e+y,l[++g]=1}else u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,x+=2,n||(f[++_]=x-2,f[++_]=x-4,f[++_]=x-3,f[++_]=x-2,f[++_]=x-3,f[++_]=x-1,a+=6)}if(h>0)for(let n=0;n<t.count;n++){const i=t.array[n];if(i.dist>h){const e=t.array[n-1];d=new J;const r=(h-e.dist)/(i.dist-e.dist);d.lerpPathPoints(e,i,r),m(d);break}m(i)}else d=t.array[0];return{position:u,normal:c,uv:l,indices:f,count:a}}(e,n);return{position:new Float32Array(r.position),indices:new Uint32Array(r.indices),uv:new Float32Array(r.uv),normal:new Float32Array(r.normal),line:t,count:r.count}})),e=I(i);return e.lines=t,e}new Z(0,0,1),new Z;var dt={x:0,y:0},pt={x:0,y:0};function vt(t,n,i,e){for(var r=t.length,s=0;s<r;s++){var o=t[s].data;n=t[s].center||n;for(var h=0,a=o.length;h<a;h++)for(var u=o[h],c=0,l=u.length;c<l;c++)t[s].data[h][c]=gt(u[c],n,i,e)}}function gt(t,n,i,e,r){for(var s,o=[],h=r?3:2,a=0,u=(s=i?new Float64Array(t):new Float32Array(t)).length;a<u;a+=h){var c=s[a],l=s[a+1],f=s[a+2];if(n&&i&&e){dt.x=c,dt.y=l;var x=kt(dt,pt);dt.x=x.x,dt.y=x.y,c=(x=Zt(e,dt,i,pt)).x,l=x.y,c-=n[0],l-=n[1]}r?o.push([c,l,f]):o.push([c,l])}return o}function _t(t,n){void 0===n&&(n=1);for(var i=t.length,e=[],r=[],s=0,o=0;o<i;o++){var h=void 0;1===n?h=mt(t[o]):2===n?h=zt(t[o]):3===n&&(h=wt(t[o]));var a=t[o].bottomHeight||0,u=h.position;r.push(h);var c=u.length/3;e[o]={position:{middleZ:a+(t[o].height||0)/2,count:c,start:s,end:s+3*c},hide:!1},s+=3*c}var l=bt(r),f=l.position,x=l.normal,y=l.uv,d=l.indices;return{position:f.buffer,normal:x.buffer,uv:y.buffer,indices:d.buffer,geometriesAttributes:e}}function mt(t){var n=t.data,i=t.height,e=t.bottomHeight,r=j(n,{depth:i}),s=r.position,o=r.normal,h=r.uv,a=r.indices;return At(s,e),{position:s,normal:o,uv:h,indices:a}}function zt(t){var n=t.data,i=t.height,e=t.width,r=t.bottomHeight,s=W(n,{lineWidth:e,depth:i}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function wt(t){var n=t.data,i=t.cornerRadius,e=t.width,r=t.bottomHeight,s=yt(n,{lineWidth:e,cornerRadius:i}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function Mt(t,n){for(var i=new Float32Array(n),e=0,r=0;r<t.length;++r)i.set(t[r],e),e+=t[r].length;return i}function bt(t){for(var n={},i={},e=0;e<t.length;++e){var r=t[e];for(var s in r)void 0===n[s]&&(n[s]=[],i[s]=0),n[s].push(r[s]),i[s]+=r[s].length}var o={},h=0,a=[];for(var u in n)if("indices"===u)for(var c=n[u],l=0,f=c.length;l<f;l++){for(var x=c[l],y=0,d=x.length;y<d;y++)a.push(x[y]+h);h+=n.position[l].length/3}else{var p=Mt(n[u],i[u]);if(!p)return null;o[u]=p}return o.indices=new Uint32Array(a),o}function At(t,n){if(void 0!==n&&"number"==typeof n&&0!==n)for(var i=0,e=t.length;i<e;i+=3)t[i+2]+=n}function Pt(t){for(var n=[],i=0,e=t.length;i<e;i+=7){var r=t[i],s=t[i+1],o=t[i+2],h=t[i+3],a=t[i+4],u=t[i+5];n.push({radialSegments:o,radius:h,height:a,altitude:u,center:[r,s]})}for(var c=n.length,l=[],f=[],x=0,y=0;y<c;y++){var d=G(n[y].center||[0,0],n[y]),p=d.position;if(n[y].altitude)for(var v=n[y].altitude,g=0,_=p.length;g<_;g+=3)d[g+2]+=v;f.push(d);var m=p.length/3;l[y]={position:{middleZ:n[y].height/2,count:m,start:x,end:x+3*m},hide:!1},x+=3*m}var z=bt(f),w=z.position,M=z.normal,b=z.uv,A=z.indices;return{position:w.buffer,normal:M.buffer,uv:b.buffer,indices:A.buffer,geometriesAttributes:l}}var St=Math.PI/180,Ct=6378137*Math.PI/180;function kt(t,n){var i,e=85.0511287798,r=t.x,s=Math.max(Math.min(e,t.y),-e);i=0===s?0:Math.log(Math.tan((90+s)*St/2))/St;var o=r*Ct,h=i*Ct;return n?(n.x=o,n.y=h,n):{x:o,y:h}}function Zt(t,n,i,e){var r=t[0]*(n.x-t[2])/i,s=-t[1]*(n.y-t[3])/i;return e?(e.x=r,e.y=s,e):{x:r,y:s}}function Ft(t){void 0===t&&(t=[]);for(var n=t.length,i=new Float32Array(3*n),e=0;e<n;e++){var r=t[e],s=3*e;i[s]=r[0],i[s+1]=r[1],i[s+2]=r[2]||0}return i}function Vt(t){for(var n=new Float32Array(2*t.length-6),i=0,e=0,r=t.length/3;e<r;e++){var s=t[3*e],o=t[3*e+1],h=t[3*e+2];if(e>0&&e<r-1){var a=3*i;n[a]=s,n[a+1]=o,n[a+2]=h,i++}var u=3*i;n[u]=s,n[u+1]=o,n[u+2]=h,i++}return n}function Lt(t){var n=0,i=t.length;if(1===i)return t[0];for(var e=0;e<i;e++)n+=t[e].length;for(var r=new Float32Array(n),s=0,o=0;o<i;o++)r.set(t[o],s),s+=t[o].length;return r}t.initialize=function(){},t.onmessage=function(t,n){var i=t.data,e=i.type,r=i.datas,s=i.glRes,o=i.matrix,h=i.center;if("ExtrudePolygons"===e){vt(r,h,s,o);var a=_t(r);n(null,a,[a.position,a.normal,a.uv,a.indices])}else if("ExtrudeLines"===e||"Paths"===e){for(var u=0,c=r.length;u<c;u++)for(var l=0,f=r[u].data.length;l<f;l++)r[u].data[l]=gt(r[u].data[l],r[u].center||h,s,o,!0);var x=_t(r,"ExtrudeLines"===e?2:3);n(null,x,[x.position,x.normal,x.uv,x.indices])}else if("ExtrudePolygon"===e){var y=[],d=[];r.forEach((function(t){var n=[t];vt(n,h,s,o);var i=_t(n),e=i.position,r=i.normal,a=i.uv,u=i.indices;y.push({id:t.id,position:e,normal:r,uv:a,indices:u}),d.push(e,r,a,u)})),n(null,y,d)}else if("Line"===e||"FatLine"===e){for(var p=[],v=[],g=0,_=r.length;g<_;g++){for(var m=[],z=0,w=r[g].data.length;z<w;z++){r[g].data[z]=gt(r[g].data[z],r[g].center||h,s,o,!0);var M=Ft(r[g].data[z]);m.push(Vt(M))}var b=Lt(m);At(b,r[g].bottomHeight),p.push({id:r[g].id,position:b.buffer}),v.push(b.buffer)}n(null,p,v)}else if("Lines"===e||"FatLines"===e){for(var A=0,P=[],S=[],C=0,k=[],Z=0,F=r.length;Z<F;Z++){for(var V=0,L=0,q=r[Z].data.length;L<q;L++){r[Z].data[L]=gt(r[Z].data[L],r[Z].center||h,s,o,!0);var E=Ft(r[Z].data[L]);At(E,r[Z].bottomHeight),V+=E.length/3*2-2,k.push(Vt(E))}var I=V;P[Z]=[A,A+I],A+=I,S[Z]={position:{count:V,start:C,end:C+3*V},hide:!1},"FatLines"===e&&(S[Z].instanceStart={count:V,start:C,end:C+3*V},S[Z].instanceEnd={count:V,start:C,end:C+3*V}),C+=3*V}var O=Lt(k);n(null,{id:r.id,position:O.buffer,geometriesAttributes:S,faceMap:P},[O.buffer])}else if("ExtrudeLine"===e||"Path"===e){for(var U=0,N=r.length;U<N;U++)for(var j=0,Q=r[U].data.length;j<Q;j++)r[U].data[j]=gt(r[U].data[j],r[U].center||h,s,o,!0);var R=[],W=[];r.forEach((function(t){var n=_t([t],"ExtrudeLine"===e?2:3),i=n.position,r=n.normal,s=n.uv,o=n.indices;R.push({id:t.id,position:i,normal:r,uv:s,indices:o}),W.push(i,r,s,o)})),n(null,R,W)}else if("Bar"===e){for(var B=[],T=[],H=(r=new Float32Array(r)).length/7,X=0;X<H;){var Y=r.slice(7*X,7*(X+1)),D=Pt(Y),G=D.position,J=D.normal,K=D.uv,$=D.indices;B.push({id:parseInt(Y[6]),position:G,normal:J,uv:K,indices:$}),T.push(G,J,K,$),X++}n(null,B,T)}else if("Bars"===e){var tt=Pt(r=new Float32Array(r));n(null,tt,[tt.position,tt.normal,tt.uv,tt.indices])}else console.error("No processing logic found for type:"+e)},Object.defineProperty(t,"__esModule",{value:!0})})'),t.registerWorkerAdapter("__maptalks.three.fetchdata__",(function(t){const e=[],n=[];function r(t){t.abort?(n.splice(n.indexOf(t),1),e.length&&(n.push(e[0]),e.splice(0,1),i(n[n.length-1]))):n.length<5?(n.push(t),i(t)):e.push(t)}function i(t){fetch(t.url).then((t=>t.text())).then((e=>{new Blob([e],{type:"application/json"}).arrayBuffer().then((e=>{t.postResponse(null,e,[e]),t.abort=!0,r(t)}))})).catch((e=>{console.error(e),t.abort=!0,r(t)}))}t.initialize=function(){},t.onmessage=function(t,e){r({url:t.data,postResponse:e,abort:!1})}})));var Cu=6371008.8,Su={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:Cu,metres:Cu,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:3440.069546436285,radians:1,yards:6967335.223679999},Mu={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Cu,yards:1.0936133},Bu={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Tu(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function ku(t,e,n){switch(t){case"Point":return Pu(e).geometry;case"LineString":return Ou(e).geometry;case"Polygon":return Ru(e).geometry;case"MultiPoint":return Qu(e).geometry;case"MultiLineString":return Uu(e).geometry;case"MultiPolygon":return Gu(e).geometry;default:throw new Error(t+" is invalid")}}function Pu(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Zu(t[0])||!Zu(t[1]))throw new Error("coordinates must contain numbers");return Tu({type:"Point",coordinates:t},e,n)}function Lu(t,e,n){return void 0===n&&(n={}),Fu(t.map((function(t){return Pu(t,e)})),n)}function Ru(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return Tu({type:"Polygon",coordinates:t},e,n)}function Du(t,e,n){return void 0===n&&(n={}),Fu(t.map((function(t){return Ru(t,e)})),n)}function Ou(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return Tu({type:"LineString",coordinates:t},e,n)}function Nu(t,e,n){return void 0===n&&(n={}),Fu(t.map((function(t){return Ou(t,e)})),n)}function Fu(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function Uu(t,e,n){return void 0===n&&(n={}),Tu({type:"MultiLineString",coordinates:t},e,n)}function Qu(t,e,n){return void 0===n&&(n={}),Tu({type:"MultiPoint",coordinates:t},e,n)}function Gu(t,e,n){return void 0===n&&(n={}),Tu({type:"MultiPolygon",coordinates:t},e,n)}function zu(t,e,n){return void 0===n&&(n={}),Tu({type:"GeometryCollection",geometries:t},e,n)}function ju(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function Vu(t,e){void 0===e&&(e="kilometers");var n=Su[e];if(!n)throw new Error(e+" units is invalid");return t*n}function qu(t,e){void 0===e&&(e="kilometers");var n=Su[e];if(!n)throw new Error(e+" units is invalid");return t/n}function Hu(t,e){return Yu(qu(t,e))}function Wu(t){var e=t%360;return e<0&&(e+=360),e}function Yu(t){return 180*(t%(2*Math.PI))/Math.PI}function Xu(t){return t%360*Math.PI/180}function Ju(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Vu(qu(t,e),n)}function Ku(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=Bu[e];if(!r)throw new Error("invalid original units");var i=Bu[n];if(!i)throw new Error("invalid final units");return t/r*i}function Zu(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function $u(t){return!!t&&t.constructor===Object}function tl(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!Zu(t))throw new Error("bbox must only contain numbers")}))}function el(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var nl=Object.freeze({__proto__:null,earthRadius:Cu,factors:Su,unitsFactors:Mu,areaFactors:Bu,feature:Tu,geometry:ku,point:Pu,points:Lu,polygon:Ru,polygons:Du,lineString:Ou,lineStrings:Nu,featureCollection:Fu,multiLineString:Uu,multiPoint:Qu,multiPolygon:Gu,geometryCollection:zu,round:ju,radiansToLength:Vu,lengthToRadians:qu,lengthToDegrees:Hu,bearingToAzimuth:Wu,radiansToDegrees:Yu,degreesToRadians:Xu,convertLength:Ju,convertArea:Ku,isNumber:Zu,isObject:$u,validateBBox:tl,validateId:el});function rl(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,h,c=0,f=0,p=t.type,d="FeatureCollection"===p,g="Feature"===p,y=d?t.features.length:1,v=0;v<y;v++){a=(h=!!(l=d?t.features[v].geometry:g?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var m=0;m<a;m++){var A=0,_=0;if(null!==(s=h?l.geometries[m]:l)){u=s.coordinates;var x=s.type;switch(c=!n||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===e(u,f,v,A,_))return!1;f++,A++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(!1===e(u[r],f,v,A,_))return!1;f++,"MultiPoint"===x&&A++}"LineString"===x&&A++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-c;i++){if(!1===e(u[r][i],f,v,A,_))return!1;f++}"MultiLineString"===x&&A++,"Polygon"===x&&_++}"Polygon"===x&&A++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(_=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-c;o++){if(!1===e(u[r][i][o],f,v,A,_))return!1;f++}_++}A++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===rl(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function il(t,e,n,r){var i=n;return rl(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i}function ol(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function sl(t,e,n){var r=n;return ol(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function al(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function ul(t,e,n){var r=n;return al(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function ll(t){var e=[];return rl(t,(function(t){e.push(t)})),e}function hl(t,e){var n,r,i,o,s,a,u,l,h,c,f=0,p="FeatureCollection"===t.type,d="Feature"===t.type,g=p?t.features.length:1;for(n=0;n<g;n++){for(a=p?t.features[n].geometry:d?t.geometry:t,l=p?t.features[n].properties:d?t.properties:{},h=p?t.features[n].bbox:d?t.bbox:void 0,c=p?t.features[n].id:d?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function cl(t,e,n){var r=n;return hl(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r}function fl(t,e){hl(t,(function(t,n,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(Tu(t,r,{bbox:i,id:o}),n,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(Tu({type:s,coordinates:l},r),n,u))return!1}}))}function pl(t,e,n){var r=n;return fl(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function dl(t,e){fl(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==rl(t,(function(o,h,c,f,p){if(void 0===s||n>a||f>u||p>l)return s=o,a=n,u=f,l=p,void(i=0);var d=Ou([s,o],t.properties);if(!1===e(d,n,r,p,i))return!1;i++,s=o}))&&void 0}}}))}function gl(t,e,n){var r=n,i=!1;return dl(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}function yl(t,e){if(!t)throw new Error("geojson is required");fl(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(Ou(o[s],t.properties),n,r,s))return!1}}}))}function vl(t,e,n){var r=n;return yl(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r}function ml(t,e){if(!$u(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),Ou([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),Ou([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),Ou([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),Ou([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function Al(t,e){if(!$u(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return Pu(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Pu(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Pu(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Pu(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Pu(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),Pu(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var _l=Object.freeze({__proto__:null,coordAll:ll,coordEach:rl,coordReduce:il,featureEach:al,featureReduce:ul,findPoint:Al,findSegment:ml,flattenEach:fl,flattenReduce:pl,geomEach:hl,geomReduce:cl,lineEach:yl,lineReduce:vl,propEach:ol,propReduce:sl,segmentEach:dl,segmentReduce:gl});function xl(t){var e=[1/0,1/0,-1/0,-1/0];return rl(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function wl(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function bl(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function El(t){if(t.length>1&&Zu(t[0])&&Zu(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return El(t[0]);throw new Error("coordinates must only contain numbers")}function Il(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function Cl(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function Sl(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r<i.length;r++){var o=i[r];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}function Ml(t){return"Feature"===t.type?t.geometry:t}function Bl(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}xl.default=xl;var Tl=Object.freeze({__proto__:null,getCoord:wl,getCoords:bl,containsNumber:El,geojsonType:Il,featureOf:Cl,collectionOf:Sl,getGeom:Ml,getType:Bl}),kl=Object.getOwnPropertySymbols,Pl=Object.prototype.hasOwnProperty,Ll=Object.prototype.propertyIsEnumerable;
|
|
17
|
+
function(t){var e=t/2,n=t+e,r=1e4,i=_s(2*n,2*n),o=i.getContext("2d");return o.shadowBlur=e,o.shadowColor="black",o.shadowOffsetX=o.shadowOffsetY=r,o.beginPath(),o.arc(n-r,n-r,t,0,2*Math.PI,!0),o.closePath(),o.fill(),i}(n._size||n.size||13),o=i.width/2,s=i.height/2,a=e,u={};for(var l in a.forEach((function(t){var e=void 0===t.count?1:t.count,n=Math.min(1,e/r).toFixed(2);u[n]=u[n]||[],u[n].push(t)})),u)if(!isNaN(l)){var h=u[l];t.beginPath(),n.withoutAlpha||(t.globalAlpha=l),h.forEach((function(e){var n=e.coordinate,a=void 0===e.count?1:e.count;t.globalAlpha=a/r,t.drawImage(i,n[0]-o,n[1]-s)}))}}Rs.prototype.setMax=function(t){this.max=t||100},Rs.prototype.setMin=function(t){this.min=t||0},Rs.prototype.setMaxSize=function(t){this.maxSize=t||35},Rs.prototype.setMinSize=function(t){this.minSize=t||0},Rs.prototype.initPalette=function(){var t=this.gradient,e=_s(256,1),n=this.paletteCtx=e.getContext("2d"),r=n.createLinearGradient(0,0,256,1);for(var i in t)r.addColorStop(parseFloat(i),t[i]);n.fillStyle=r,n.fillRect(0,0,256,1)},Rs.prototype.getColor=function(t){var e=this.getImageData(t);return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]/256+")"},Rs.prototype.getImageData=function(t){var e=this.paletteCtx.getImageData(0,0,256,1).data;if(void 0===t)return e;var n=this.max,r=this.min;t>n&&(t=n),t<r&&(t=r);var i=4*Math.floor((t-r)/(n-r)*255);return[e[i],e[i+1],e[i+2],e[i+3]]},Rs.prototype.getSize=function(t){var e=this.max,n=this.min,r=this.maxSize,i=this.minSize;return t>e&&(t=e),t<n&&(t=n),e>n?i+(t-n)/(e-n)*(r-i):r},Rs.prototype.getLegend=function(t){var e=this.gradient,n=t.width||20,r=t.height||180,i=_s(n,r),o=i.getContext("2d"),s=o.createLinearGradient(0,r,0,0);for(var a in e)s.addColorStop(parseFloat(a),e[a]);return o.fillStyle=s,o.fillRect(0,0,n,r),i};var Fs={draw:function(t,e,n){if(!(t.canvas.width<=0||t.canvas.height<=0)){var r=n.strength||.3;t.strokeStyle="rgba(0,0,0,"+r+")";var i=_s(t.canvas.width,t.canvas.height),o=i.getContext("2d");o.scale(devicePixelRatio,devicePixelRatio),n=n||{},t.save();var s=new Rs({gradient:n.gradient});if(Ns(o,e,n),!n.absolute){var a=o.getImageData(0,0,t.canvas.width,t.canvas.height);Ds(a.data,s.getImageData(),n),t.putImageData(a,0,0),t.restore()}s=null,i=null}},drawGray:Ns,colorize:Ds};const Us={altitude:0,interactive:!1,min:0,max:100,size:13,gradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},gridScale:.5},Qs=2048;class Gs extends Fn{constructor(e,n,r,i){Array.isArray(e)||(e=[e]);let s=1/0,a=1/0,u=-1/0,l=-1/0;const h=[];for(let t=0,n=e.length;t<n;t++){const{coordinate:n,lnglat:r,xy:o}=e[t],c=n||r||o;if(!c){console.warn("not find coordinate");continue}const f=i.coordinateToVector3(c);h.push(f);const{x:p,y:d}=f;s=Math.min(s,p),a=Math.min(a,d),u=Math.max(u,p),l=Math.max(l,d)}n=t.Util.extend({},Us,n,{layer:i,points:e});let{gridScale:c,altitude:f,size:p}=n;const d=Math.abs(u-s),g=Math.abs(l-a),y=Math.max(d*c,g*c);if(y>Qs){console.warn(`gridScale: ${c} it's too big. I hope it's a smaller value,canvas max size is 2048* 2048`);c=Qs/(y/c)}let v=Math.ceil(d*c),m=Math.ceil(g*c);const A=v/d,_=m/g,x=[],w=Math.ceil(2*p);for(let t=0,n=h.length;t<n;t++){const n=h[t];n.x-=s,n.y-=a,n.x*=A,n.y*=_,n.y=m-n.y,n.x+=w,n.y+=w,x.push({coordinate:[n.x,n.y],count:e[t].count})}v+=2*w,m+=2*w;let b=_s(v,m),E=b.getContext("2d");Fs.drawGray(E,x,n);const I=E.getImageData(0,0,E.canvas.width,E.canvas.height);let C=-1/0;const S=new Float32Array(I.data.length/4),M=new Float32Array(I.data.length/4);for(let t=3,e=I.data.length,n=0;t<e;t+=4){const e=I.data[t];C=Math.max(C,e),M[n]=e,e<=0&&(S[n]=1),n++}const B=new Rs({gradient:n.gradient});Fs.colorize(I.data,B.getImageData(),n),b=null,E=null;const T=Es(d,g,v-1,m-1),k=T.getIndex().array,P=T.attributes.position.array,L=new Float32Array(P.length),R=new Uint32Array(6*P.length),D=new o.Color;let O=0;for(let t=0,e=P.length,n=0,r=k.length,i=0,o=I.data.length,s=0;t<Math.max(e,r,o);t+=3){if(t<e){const e=M[s];e>0&&(P[t+2]=e/C)}if(n<r){const t=k[n],e=k[n+1],r=k[n+2];S[t]&&S[e]&&S[r]||(R[O]=t,R[O+1]=e,R[O+2]=r,O+=3)}if(i<o){const t=`rgb(${I.data[i]},${I.data[i+1]},${I.data[i+2]})`;D.setStyle(t),L[n]=D.r,L[n+1]=D.g,L[n+2]=D.b}n+=3,i+=4,s++}const N=new Uint32Array(O);for(let t=0;t<O;t++)N[t]=R[t];T.setIndex(new o.BufferAttribute(N,1)),In(T,"color",new o.BufferAttribute(L,3,!0)),r.vertexColors=Sn(),super(),this._initOptions(n),this._createMesh(T,r);const F=i.altitudeToVector3(f,f).x;this.getObject3d().position.copy(new o.Vector3((s+u)/2,(a+l)/2,F)),this.type="HeatMap"}}const zs=new o.Color;let js=1;class Vs{constructor(t){this.object3ds=[],this.layer=t,this.camera=t.getCamera(),this.renderer=t.getThreeRenderer(),this.pickingTexture=En>=152?new o.WebGLRenderTarget(1,1,{format:o.RGBAFormat,colorSpace:o.SRGBColorSpace}):new o.WebGLRenderTarget(1,1,{}),this.pickingScene=new o.Scene}getColor(){return zs.setHex(js),js++,zs}add(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=t,this.pickingScene.add(t))}return this}remove(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=null,this.pickingScene.remove(t))}return this}isEmpty(){if(0===this.pickingScene.children.length)return!0;for(let t=0,e=this.pickingScene.children.length;t<e;t++){const e=this.pickingScene.children[t];if(e){const t=e.__parent;if(t&&!0===t.getOptions().interactive)return!1}}return!0}pick(t){if(!t)return;if(this.isEmpty())return;const{camera:e,renderer:n,pickingTexture:r,pickingScene:i,object3ds:o,layer:s}=this,a=this.pickingScene.children.length;for(let t=0;t<a;t++){const e=this.pickingScene.children[t];e&&e.__parent&&(e.__parent.picked=!1)}const{width:u,height:l}=s._getRenderer().canvas,h=r.width,c=r.height;u===h&&l===c||r.setSize(u,l),n.setRenderTarget(r),n.clear(),e&&e.layers&&this.camera.layers.set(0),n.render(i,e);const f=new Uint8Array(4),{x:p,y:d}=t;let g=window.devicePixelRatio;const y=s.getMap();y&&(g=y.getDevicePixelRatio?y.getDevicePixelRatio():y.options.devicePixelRatio);const v=p*g,m=r.height-d*g;n.readRenderTargetPixels(r,Math.round(v),Math.round(m),1,1,f);const A=f[0]<<16|f[1]<<8|f[2],_=o[A];if(_)_.__parent&&(o[A].__parent.picked=!0);else for(let t=0;t<a;t++){const e=this.pickingScene.children[t];if(e&&e.__parent){const t=e.__parent;if(t._colorMap&&null!=t._colorMap[A]){t.picked=!0,t.index=t._colorMap[A];break}}}n.setRenderTarget(null)}}const qs={bottomHeight:0,altitude:0};class Hs extends Fn{constructor(e,n,r,i){n=t.Util.extend({},qs,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{asynchronous:o}=n,{lineStrings:s,center:a}=Di(e),u=new Rn;let l;if(o){const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=a,io.push({id:n,data:s,lineString:e,center:a,layer:i,baseObject:this})}else{const t=[],e={};for(let r=0,o=s.length;r<o;r++){const o=Ti(s[r],i,a,!1).positions;pi(o,n.bottomHeight,i,e),t.push(Oi(o))}l=Ni(t),u.setPositions(l)}this._setMaterialRes(i,r),this._createLine2(u,r);const{altitude:h}=n,c=i.altitudeToVector3(h,h).x,f=i.coordinateToVector3(a,c);this.getObject3d().position.copy(f),o||(this._setPickObject3d(l,r.linewidth),this._init()),this.type="FatLine"}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setMaterialRes(t,e){const n=t.getMap();if(!n)return this;const r=n.getSize(),i=r.width,o=r.height;e.resolution.set(i,o)}_setPickObject3d(t,e){const n=new Rn;n.setPositions(t);const r=this.getLayer().getPick().getColor(),i=[];for(let e=0,n=t.length/3;e<n;e++)i.push(r.r,r.g,r.b);n.setColors(i);const o=new Pn({color:"#fff",linewidth:e,vertexColors:Sn()});this._setMaterialRes(this.getLayer(),o);const s=r.getHex(),a=new Dn(n,o);a.position.copy(this.getObject3d().position),a._colorIndex=s,this.setPickObject3d(a)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof o.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),n=e.width,r=e.height;t.resolution.set(n,r),this.getObject3d().material=t}return this}_workerLoad(t){const e=new Float32Array(t.position),n=this.getObject3d();if(n.geometry.setPositions(e),n.computeLineDistances(),this._setPickObject3d(e,n.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const Ws={altitude:0,colors:null};class Ys extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=[],s=[],a=e.length;for(let t=0;t<a;t++){const n=Di(e[t]);o.push(n.center),s.push(n.lineStrings)}const u=fi(o);n=t.Util.extend({},Ws,n,{layer:i,lineStrings:e,coordinate:u}),super(),this._initOptions(n);const{asynchronous:l}=n,h=new Rn,c=[],f={};let p,d,g=[],y=0,v=[];if(l)oo.push({id:t.Util.GUID(),data:s,key:n.key,center:u,layer:i,baseObject:this,lineStrings:e,option:n});else{for(let e=0;e<a;e++){const r=s[e];let o=0;for(let e=0,s=r.length;e<s;e++){const s=Ai(r[e]),a=t.Util.extend({},n,s),{positions:l}=Ti(r[e],i,u,!1);pi(l,a.bottomHeight,i,f),o+=l.length/3*2-2,v.push(Oi(l))}g[e]={position:{count:o,start:y,end:y+3*o},instanceStart:{count:o,start:y,end:y+3*o},instanceEnd:{count:o,start:y,end:y+3*o},hide:!1},y+=3*o}p=Ni(v),h.setPositions(p)}this._setMaterialRes(i,r),this._createLine2(h,r);const{altitude:m}=n,A=i.altitudeToVector3(m,m).x,_=i.coordinateToVector3(u,A);this.getObject3d().position.copy(_),this._baseObjects=c,this._datas=e,this._geometriesAttributes=g,this.faceIndex=null,this.index=null,this._geometryCache=new Rn,l||(d=new Float32Array(p),this._geometryCache.setPositions(d)),this._colorMap={},this.isHide=!1,this._initBaseObjectsEvent(c),l||(this._setPickObject3d(d,r.linewidth),this._init()),this.type="FatLines"}_setMaterialRes(t,e){const n=t.getMap();if(!n)return this;const r=n.getSize(),i=r.width,o=r.height;e.resolution.set(i,o)}_setPickObject3d(t,e){if(!this._colorMap)return;const n=this._geometryCache||new Rn;n.setPositions(t);const r=this.getLayer().getPick(),{_geometriesAttributes:i}=this,o=di(i);let s=0;for(let t=0,e=i.length;t<e;t++){const e=r.getColor(),n=e.getHex();this._colorMap[n]=t;const{count:a}=i[t].position;this._datas[t].colorIndex=n;for(let t=0;t<a;t++)o[s]=e.r,o[s+1]=e.g,o[s+2]=e.b,s+=3}n.setColors(o);const a=new Pn({color:"#fff",linewidth:e,vertexColors:Sn()});this._setMaterialRes(this.getLayer(),a);const u=r.getColor().getHex(),l=new Dn(n,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof o.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),n=e.width,r=e.height;t.resolution.set(n,r),this.getObject3d().material=t}return this}getSelectMesh(){const e=this._getIndex();if(null!=e){if(!this._baseObjects[e]){const n=this._datas[e],r=t.Util.extend({},this.getOptions(),{index:e},jn(n)?n.properties:n.getProperties());this._baseObjects[e]=new Hs(n,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[e])}return{data:this._datas[e],baseObject:this._baseObjects[e]}}}_updateAttribute(t,e){const{indexs:n}=this._getHideGeometryIndex(e),r=this._geometryCache.attributes[e].array,i=r.length;for(let e=0;e<i;e++)t.array[e]=r[e];for(let r=0;r<n.length;r++){const i=n[r],{start:o,end:s}=this._geometriesAttributes[i][e];for(let e=o;e<s;e++)t.array[e]=-1e5}return this}_showGeometry(t,e){let n;if(t&&(n=t.getOptions().index),null!=n){const t=this._geometriesAttributes[n],{hide:r}=t;if(r===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.instanceStart,"instanceStart"),this._updateAttribute(i.attributes.instanceEnd,"instanceEnd"),i.attributes.instanceStart.data.needsUpdate=!0,i.attributes.instanceEnd.data.needsUpdate=!0,this.isHide=e}return this}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=this.getObject3d(),r=new Float32Array(t.position),i=new Float32Array(r);if(n.geometry.setPositions(new Float32Array(r)),this._geometryCache.setPositions(i),this._setPickObject3d(i,n.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const Xs={radius:10,height:100,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class Js extends Fn{constructor(e,n,r,i){n=t.Util.extend({},Xs,n,{layer:i,coordinate:e}),super(),this._initOptions(n);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l}=n,h=i.altitudeToVector3(o,o).x,c=i.distanceToVector3(s,s).x,f=Co().clone();f.scale(2*c,2*c,h),a&&(Eo(f,u,a,"z",h/2),r.vertexColors=Sn()),this._createMesh(f,r);const p=i.altitudeToVector3(l,l).x,d=i.coordinateToVector3(e,p);this.getObject3d().position.copy(d),this.type="Box"}}const Ks={radius:10,height:100,altitude:0,topColor:null,bottomColor:"#2d2f61"};class Zs extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=e.length,s=fi(e),a=i.coordinateToVector3(s),u=[],l=[],h=[];let c=0;n=t.Util.extend({},{altitude:0,layer:i,points:e},Ks,n);const f={},p={};for(let s=0;s<o;s++){const o=t.Util.extend({index:s},n,e[s]),{radius:d,altitude:g,topColor:y,bottomColor:v,height:m,coordinate:A}=o,_=hi(d,i,f),x=ci(m,i,p),w=ci(g,i,p),b=Co().clone();b.scale(2*_,2*_,x),y&&(Eo(b,v,y,"z",x/2),r.vertexColors=Sn());const E=i.coordinateToVector3(A).sub(a),I=b.attributes.position.array;for(let t=0,e=I.length;t<e;t+=3)I[t+2]+=w,I[t]+=E.x,I[t+1]+=E.y,I[t+2]+=E.z;u.push(b);const C=new Js(A,o,r,i);l.push(C),b.index.count;const S=b.attributes.position.count;b.attributes.normal.count,b.attributes.uv.count,h[s]={position:{count:S,start:c,end:c+3*S},hide:!1},c+=3*S}super(),this._initOptions(n);const d=Io(u);this._createMesh(d,r);const g=n.altitude,y=i.altitudeToVector3(g,g).x,v=a.clone();v.z=y,this.getObject3d().position.copy(v),this._baseObjects=l,this._datas=e,this._geometriesAttributes=h,this.faceIndex=null,this._geometryCache=yo(d),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(l),this._setPickObject3d(),this._init(),this.type="Boxs"}identify(t){return this.picked}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function $s(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}var ta={exports:{}};function ea(t,e,n){n=n||2;var r,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*n:t.length,f=na(t,0,c,n,!0),p=[];if(!f||f.next===f.prev)return p;if(h&&(f=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=na(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(pa(s));for(a.sort(la),i=0;i<a.length;i++)n=ha(a[i],n);return n}(t,e,f,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var d=n;d<c;d+=n)(a=t[d])<r&&(r=a),(u=t[d+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-r,s-i))?32767/l:0}return ia(f,p,n,r,i,l,0),p}function na(t,e,n,r,i){var o,s;if(i===Ca(t,e,n,r)>0)for(o=e;o<n;o+=r)s=ba(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=ba(o,t[o],t[o+1],s);return s&&va(s,s.next)&&(Ea(s),s=s.next),s}function ra(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!va(r,r.next)&&0!==ya(r.prev,r,r.next))r=r.next;else{if(Ea(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function ia(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=fa(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,u,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(s>1)}(i)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?sa(t,r,i,o):oa(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(u.i/n|0),Ea(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?ia(t=aa(ra(t),e,n),e,n,r,i,o,2):2===s&&ua(t,e,n,r,i,o):ia(ra(t),e,n,r,i,o,1);break}}}function oa(t){var e=t.prev,n=t,r=t.next;if(ya(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,u=n.y,l=r.y,h=i<o?i<s?i:s:o<s?o:s,c=a<u?a<l?a:l:u<l?u:l,f=i>o?i>s?i:s:o>s?o:s,p=a>u?a>l?a:l:u>l?u:l,d=r.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&da(i,a,o,u,s,l,d.x,d.y)&&ya(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function sa(t,e,n,r){var i=t.prev,o=t,s=t.next;if(ya(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=a<u?a<l?a:l:u<l?u:l,d=h<c?h<f?h:f:c<f?c:f,g=a>u?a>l?a:l:u>l?u:l,y=h>c?h>f?h:f:c>f?c:f,v=fa(p,d,e,n,r),m=fa(g,y,e,n,r),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&da(a,h,u,c,l,f,A.x,A.y)&&ya(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&da(a,h,u,c,l,f,_.x,_.y)&&ya(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&da(a,h,u,c,l,f,A.x,A.y)&&ya(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&da(a,h,u,c,l,f,_.x,_.y)&&ya(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function aa(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!va(i,o)&&ma(i,r,r.next,o)&&xa(i,o)&&xa(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Ea(r),Ea(r.next),r=t=o),r=r.next}while(r!==t);return ra(r)}function ua(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ga(s,a)){var u=wa(s,a);return s=ra(s,s.next),u=ra(u,u.next),ia(s,e,n,r,i,o,0),void ia(u,e,n,r,i,o,0)}a=a.next}s=s.next}while(s!==t)}function la(t,e){return t.x-e.x}function ha(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var u,l=n,h=n.x,c=n.y,f=1/0;r=n;do{i>=r.x&&r.x>=h&&i!==r.x&&da(o<c?i:s,o,h,c,o<c?s:i,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(i-r.x),xa(r,t)&&(u<f||u===f&&(r.x>n.x||r.x===n.x&&ca(n,r)))&&(n=r,f=u)),r=r.next}while(r!==l);return n}(t,e);if(!n)return e;var r=wa(n,t);return ra(r,r.next),ra(n,n.next)}function ca(t,e){return ya(t.prev,t,e.prev)<0&&ya(e.next,t,t.next)<0}function fa(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function pa(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function da(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function ga(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&ma(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(xa(t,e)&&xa(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(ya(t.prev,t,e.prev)||ya(t,e.prev,e))||va(t,e)&&ya(t.prev,t,t.next)>0&&ya(e.prev,e,e.next)>0)}function ya(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function va(t,e){return t.x===e.x&&t.y===e.y}function ma(t,e,n,r){var i=_a(ya(t,e,n)),o=_a(ya(t,e,r)),s=_a(ya(n,r,t)),a=_a(ya(n,r,e));return i!==o&&s!==a||(!(0!==i||!Aa(t,n,e))||(!(0!==o||!Aa(t,r,e))||(!(0!==s||!Aa(n,t,r))||!(0!==a||!Aa(n,e,r)))))}function Aa(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function _a(t){return t>0?1:t<0?-1:0}function xa(t,e){return ya(t.prev,t,t.next)<0?ya(t,e,t.next)>=0&&ya(t,t.prev,e)>=0:ya(t,e,t.prev)<0||ya(t,t.next,e)<0}function wa(t,e){var n=new Ia(t.i,t.x,t.y),r=new Ia(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function ba(t,e,n,r){var i=new Ia(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ea(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ia(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ca(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}ta.exports=ea,ta.exports.default=ea,ea.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Ca(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Ca(t,l,h,n))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*n,p=r[a+1]*n,d=r[a+2]*n;c+=Math.abs((t[f]-t[d])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[d+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},ea.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n};var Sa=ta.exports;function Ma(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Ba(t,e,n,r,i){for(var o,s=r,a=e+1;a<n;a++){var u=Ma(t[a],t[e],t[n]);u>s&&(o=a,s=u)}s>r&&(o-e>1&&Ba(t,e,o,r,i),i.push(t[o]),n-o>1&&Ba(t,o,n,r,i))}function Ta(t,e){var n=t.length-1,r=[t[0]];return Ba(t,0,n,e,r),r.push(t[n]),r}function ka(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return t=n?t:function(t,e){for(var n,r,i,o,s,a=t[0],u=[a],l=1,h=t.length;l<h;l++)n=t[l],i=a,o=void 0,s=void 0,o=(r=n)[0]-i[0],s=r[1]-i[1],o*o+s*s>e&&(u.push(n),a=n);return a!==n&&u.push(n),u}(t,r),t=Ta(t,r)}function Pa(t,e){return t[0]*e[0]+t[1]*e[1]}function La(t,e){const n=e[0],r=e[1],i=Math.sqrt(n*n+r*r);return t[0]=n/i,t[1]=r/i,t}function Ra(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function Da(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function Oa(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Na(t,e){const n=e[0],r=e[1],i=e[2],o=Math.sqrt(n*n+r*r+i*i);return t[0]=n/o,t[1]=r/o,t[2]=i/o,t}function Fa(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2];return t[0]=i*u-o*a,t[1]=o*s-r*u,t[2]=r*a-i*s,t}const Ua=[];function Qa(t,e,n,r){const i=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}(e,n),o=Math.acos(i)*r;return Ra(Ua,n,e,-i),function(t,e){const n=e[0],r=e[1],i=e[2],o=Math.sqrt(n*n+r*r+i*i);t[0]=n/o,t[1]=r/o,t[2]=i/o}(Ua,Ua),function(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}(t,e,Math.cos(o)),Ra(t,t,Ua,Math.sin(o)),t}function Ga(t,e,n,r,i,o,s,a,u,l){const h=s-i,c=a-o,f=(h*(e-o)-c*(t-i))/(c*(n-t)-h*(r-e));return u&&(u[l=l||0]=t+f*(n-t),u[l+1]=e+f*(r-e)),f}function za(t,e,n){if(n-e<3)return 0;let r=0;for(let i=2*(n-1),o=2*e;o<2*n;){const e=t[i],n=t[i+1],s=t[o],a=t[o+1];i=o,o+=2,r+=e*a-s*n}return r}function ja(t,e,n=2){return Sa(t,e,n)}const Va=[],qa=[],Ha=[];function Wa(t,e,n,r,i,o,s,a,u){const l=null!=s;let h,c,f,p=i,d=null;l&&(d=new Uint32Array(r-n));let g=[];for(let i=n;i<r;i++){const y=i===r-1?n:i+1,v=i===n?r-1:i-1,m=t[2*v],A=t[2*v+1],_=t[2*i],x=t[2*i+1],w=t[2*y],b=t[2*y+1];Va[0]=_-m,Va[1]=x-A,qa[0]=w-_,qa[1]=b-x,La(Va,Va),La(qa,qa),l&&(d[i]=p);let E,I,C=!1;if(a||i!==n)if(a||i!==r-1){Da(Ha,qa,Va);const t=Ha[1];Ha[1]=-Ha[0],Ha[0]=t,La(Ha,Ha);const n=Pa(Ha,qa),r=Math.sqrt(1-n*n),i=o*Math.min(10,1/r);if(l&&1/r>s&&o*n<0){const t=_+Ha[0]*o,n=x+Ha[1]*o,i=Math.acos(r)/2,s=Math.tan(i)*Math.abs(o);e[2*p]=t+Ha[1]*s,e[2*p+1]=n-Ha[0]*s,p++,e[2*p]=t-Ha[1]*s,e[2*p+1]=n+Ha[0]*s,p++}else E=_+Ha[0]*i,I=x+Ha[1]*i,C=!0;if(C){if(u&&null!=h){const t=Ga(m,A,h,c,_,x,E,I,g,0);t>=-.01&&t<=1.01&&(e[2*f]=E=g[0],e[2*f+1]=I=g[1])}h=e[2*p]=E,c=e[2*p+1]=I,f=p,p++}}else Ha[0]=Va[1],Ha[1]=-Va[0],La(Ha,Ha),E=_+Ha[0]*o,I=x+Ha[1]*o,C=!0;else Ha[0]=qa[1],Ha[1]=-qa[0],La(Ha,Ha),h=e[2*p]=_+Ha[0]*o,c=e[2*p+1]=x+Ha[1]*o,f=p,p++}return d}function Ya(t,e,n,r,i){const o=null!=r?[]:new Float32Array(t.length);if(Wa(t,o,0,e&&e.length?e[0]:t.length/2,0,n,r,i,!0),e)for(let s=0;s<e.length;s++){const a=e[s];Wa(t,o,a,e[s+1]||t.length/2,null!=r?o.length/2:a,n,r,i,!1)}return o}function Xa(t,e,n,r){for(let i=0;i<Math.floor((r-n)/2);i++)for(let o=0;o<e;o++){const s=(i+n)*e+o,a=(r-i-1)*e+o,u=t[s];t[s]=t[a],t[a]=u}return t}function Ja(t,e){let n=t.length/2,r=0,i=e&&e.length?e[0]:n;za(t,r,i)>0&&Xa(t,2,r,i);for(let o=1;o<(e?e.length:0)+1;o++)r=e[o-1],i=e[o]||n,za(t,r,i)<0&&Xa(t,2,r,i)}const Ka=[[0,0],[1,0],[1,1],[0,0],[1,1],[0,1]];function Za(t,e,n){let r=0,i=t[e],o=t[e+1];const s=i,a=o;for(let s=e+2;s<n;s+=2){const e=t[s],n=t[s+1];r+=Math.sqrt((e-i)*(e-i)+(n-o)*(n-o)),i=e,o=n}return r+=Math.sqrt((i-s)*(i-s)+(o-a)*(o-a)),r}function $a(t,{vertices:e,topVertices:n,splittedMap:r,depth:i,rect:o},s,a,u,l){const h=a-s,c=l.smoothBevel?1:2,f=Math.min(i/2,l.bevelSize),p=l.bevelSegments,d=u.vertex,g=u.ringPerimeter,y=Math.max(o.width,o.height,i,g);function v(t){const n=(t+1)%h,r=e[2*t],i=e[2*t+1],o=e[2*n],s=e[2*n+1];return r===o&&i===s}if(f>0){const o=[0,0,1],a=[],l=[0,0,-1],g=[];let m=0,A=new Float32Array(h);for(let _=0;_<2;_++){const x=0===_?i-f:f;for(let i=0;i<=p*c;i++){let w,b,E=0;for(let I=0;I<h;I++){const C=2*(I%h+s),S=r?2*r[C/2]:C;a[0]=e[C]-n[S],a[1]=e[C+1]-n[S+1],a[2]=0;const M=Math.sqrt(a[0]*a[0]+a[1]*a[1]);a[0]/=M,a[1]/=M;const B=(Math.floor(i/c)+i%c)/p;0===_?Qa(g,o,a,B):Qa(g,a,l,B);const T=0===_?B:1-B,k=f*Math.sin(T*Math.PI/2),P=M*Math.cos(T*Math.PI/2),L=f*M/Math.sqrt(k*k+P*P),R=g[0]*L+n[S],D=g[1]*L+n[S+1],O=g[2]*L+x;if(t.position[3*u.vertex]=R,t.position[3*u.vertex+1]=D,t.position[3*u.vertex+2]=O,I>0&&(E+=Math.sqrt((w-R)*(w-R)+(b-D)*(b-D))),i>0||_>0){let e=3*(u.vertex-h),n=t.position[e],r=t.position[e+1],i=t.position[e+2];A[I]+=Math.sqrt((n-R)*(n-R)+(r-D)*(r-D)+(i-O)*(i-O))}if(t.uv[2*u.vertex]=E/y,t.uv[2*u.vertex+1]=A[I]/y,w=R,b=D,u.vertex++,!v(I)&&(c>1&&i%c||1===c&&i>=1))for(let e=0;e<6;e++){const n=(Ka[e][0]+I)%h,r=Ka[e][1]+m;t.indices[u.index++]=(r-1)*h+n+d}}m++}}}else for(let n=0;n<2;n++){const r=0===n?i-f:f;let o,a,l=0;for(let n=0;n<h;n++){const i=2*(n%h+s),c=e[i],f=e[i+1];t.position[3*u.vertex]=c,t.position[3*u.vertex+1]=f,t.position[3*u.vertex+2]=r,n>0&&(l+=Math.sqrt((o-c)*(o-c)+(a-f)*(a-f))),t.uv[2*u.vertex]=l/y,t.uv[2*u.vertex+1]=r/y,o=c,a=f,u.vertex++}}const m=f>0?p*c+1:1;for(let e=0;e<h;e++)if(!v(e))for(let n=0;n<6;n++){const r=(Ka[n][0]+e)%h,i=Ka[n][1]+m;t.indices[u.index++]=(i-1)*h+r+d}}function tu({indices:t,topVertices:e,rect:n,depth:r},i,o,s){if(e.length<=4)return;const a=o.vertex,u=t.length;for(let e=0;e<u;e++)i.indices[o.index++]=a+t[e];const l=Math.max(n.width,n.height);for(let t=0;t<(s.excludeBottom?1:2);t++)for(let s=0;s<e.length;s+=2){const a=e[s],u=e[s+1];i.position[3*o.vertex]=a,i.position[3*o.vertex+1]=u,i.position[3*o.vertex+2]=(1-t)*r,i.uv[2*o.vertex]=(a-n.x)/l,i.uv[2*o.vertex+1]=(u-n.y)/l,o.vertex++}if(!s.excludeBottom){const n=e.length/2;for(let e=0;e<u;e+=3)for(let r=0;r<3;r++)i.indices[o.index++]=a+n+t[e+2-r]}}function eu(t,e,n,r){const i=null==n||"auto"===n;if(!0===n)return{vertices:t,holes:e};const o=[],s=e&&[],a=t.length/2,u=[],l=[],h=[];let c=0,f=0;const p=(e?e.length:0)+1;for(let n=0;n<p;n++){0===n?f=e&&e.length?e[0]:a:(c=e[n-1],f=e[n]||a);for(let e=c;e<f;e++){const n=t[2*e],s=t[2*e+1],a=e===f-1?c:e+1,p=t[2*a],d=t[2*a+1];if(i){const i=e===c?f-1:e-1,a=t[2*i],g=t[2*i+1];u[0]=a-n,u[1]=g-s,l[0]=p-n,l[1]=d-s,La(u,u),La(l,l);1-(.5*Pa(u,l)+.5)>r?(o.push(n,s),h.push(e)):(o.push(n,s,n,s),h.push(e,e))}else o.push(n,s,n,s),h.push(e,e)}n<p-1&&s&&s.push(o.length/2)}return{vertices:new Float32Array(o),splittedMap:h,holes:s}}function nu(t,e){let n=0,r=0;for(let i=0;i<t.length;i++){const{indices:o,vertices:s,splittedMap:a,topVertices:u,depth:l}=t[i],h=Math.min(l/2,e.bevelSize)>0?e.bevelSegments:0,c=t[i].holes||[];n+=o.length*(e.excludeBottom?1:2),r+=u.length/2*(e.excludeBottom?1:2);const f=2+2*h;let p=0,d=0;for(let t=0;t<c.length+1;t++){0===t?d=c.length?c[0]:s.length/2:(p=c[t-1],d=c[t]||s.length/2);n+=6*((a?a[d-1]+1:d)-(a?a[p]:p))*(f-1);const i=d-p;r+=i*f+(e.smoothBevel?0:h*i*2)}}const i={position:new Float32Array(3*r),indices:new(r>65535?Uint32Array:Uint16Array)(n),uv:new Float32Array(2*r)},o={vertex:0,index:0,ringPerimeter:0};for(let n=0;n<t.length;n++)tu(t[n],i,o,e);for(let n=0;n<t.length;n++){const{holes:r,vertices:s}=t[n],a=s.length/2;let u=0,l=r&&r.length?r[0]:a;if(o.ringPerimeter=Za(t[n].topVertices,u,l),$a(i,t[n],u,l,o,e),r)for(let s=0;s<r.length;s++)u=r[s],l=r[s+1]||a,o.ringPerimeter=Za(t[n].topVertices,u,l),$a(i,t[n],u,l,o,e)}for(let t=0;t<i.uv.length;t++){const e=i.uv[t];e>0&&Math.round(e)===e?i.uv[t]=1:i.uv[t]=e%1}return i.normal=function(t,e){function n(t,e,n,r){t[0]=e,t[1]=n,t[2]=r}const r=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);for(let c=0;c<l;){const l=3*t[c++],f=3*t[c++],p=3*t[c++];n(r,e[l],e[l+1],e[l+2]),n(i,e[f],e[f+1],e[f+2]),n(o,e[p],e[p+1],e[p+2]),Oa(s,r,i),Oa(a,i,o),Fa(u,s,a);for(let t=0;t<3;t++)h[l+t]=h[l+t]+u[t],h[f+t]=h[f+t]+u[t],h[p+t]=h[p+t]+u[t]}for(var c=0;c<h.length;)n(u,h[c],h[c+1],h[c+2]),Na(u,u),h[c++]=u[0],h[c++]=u[1],h[c++]=u[2];return h}(i.indices,i.position),i.boundingRect=t[0]&&t[0].rect,i}function ru(t,e){const n=[];for(let r=0;r<t.length;r++){const i=t[r],o=[],s=i.length;let a=i[s-1][0],u=i[s-1][1],l=0;for(let t=0;t<s;t++){let n=i[t][0],r=i[t][1];const s=n-a,h=r-u;l+=Math.sqrt(s*s+h*h),l>e&&(o.push(i[t]),l=0),a=n,u=r}o.length>=3&&n.push(o)}return n.length>0?n:null}function iu(t,e){const n=[];for(let r=0;r<t.length;r++){let i=t[r];i=ka(i,e,!0),i.length>=3&&n.push(i)}return n.length>0?n:null}function ou(t,e){e=Object.assign({},e);const n=[1/0,1/0],r=[-1/0,-1/0];for(let e=0;e<t.length;e++)su(t[e][0],n,r);e.boundingRect=e.boundingRect||{x:n[0],y:n[1],width:r[0]-n[0],height:r[1]-n[1]},function(t){t.depth=t.depth||1,t.bevelSize=t.bevelSize||0,t.bevelSegments=null==t.bevelSegments?2:t.bevelSegments,t.smoothBevel=t.smoothBevel||!1,t.simplify=t.simplify||0,null==t.smoothSide&&(t.smoothSide="auto"),null==t.smoothSideThreshold&&(t.smoothSideThreshold=.9),"number"==typeof t.depth&&(t.bevelSize=Math.min(t.bevelSegments>0?t.bevelSize:0,t.depth/2)),t.bevelSize>0||(t.bevelSegments=0),t.bevelSegments=Math.round(t.bevelSegments);const e=t.boundingRect;if(t.translate=t.translate||[0,0],t.scale=t.scale||[1,1],t.fitRect){let n=null==t.fitRect.x?e.x||0:t.fitRect.x,r=null==t.fitRect.y?e.y||0:t.fitRect.y,i=t.fitRect.width,o=t.fitRect.height;null==i?null!=o?i=o/e.height*e.width:(i=e.width,o=e.height):null==o&&(o=i/e.width*e.height),t.scale=[i/e.width,o/e.height],t.translate=[(n-e.x)*t.scale[0],(r-e.y)*t.scale[1]]}}(e);const i=[],o=e.translate||[0,0],s=e.scale||[1,1],a=e.boundingRect,u={x:a.x*s[0]+o[0],y:a.y*s[1]+o[1],width:a.width*s[0],height:a.height*s[1]},l=Math.min(a.width,a.height)/1e5;for(let n=0;n<t.length;n++){let r=ru(t[n],l);if(!r)continue;const a=e.simplify/Math.max(s[0],s[1]);if(a>0&&(r=iu(r,a)),!r)continue;const{vertices:h,holes:c,dimensions:f}=Sa.flatten(r);for(let t=0;t<h.length;)h[t]=h[t++]*s[0]+o[0],h[t]=h[t++]*s[1]+o[1];if(Ja(h,c),2!==f)throw new Error("Only 2D polygon points are supported");const p=e.bevelSize>0?Ya(h,c,e.bevelSize,null,!0):h,d=ja(p,c,f),g=eu(h,c,e.smoothSide,e.smoothSideThreshold);i.push({indices:d,vertices:g.vertices,rawVertices:h,topVertices:p,holes:g.holes,splittedMap:g.splittedMap,rect:u,depth:"function"==typeof e.depth?e.depth(n):e.depth})}return nu(i,e)}function su(t,e,n){for(let r=0;r<t.length;r++)e[0]=Math.min(t[r][0],e[0]),e[1]=Math.min(t[r][1],e[1]),n[0]=Math.max(t[r][0],n[0]),n[1]=Math.max(t[r][1],n[1])}const au={bottomHeight:0,width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class uu extends Fn{constructor(e,n,r,i){n=t.Util.extend({},au,n,{layer:i,lineString:e}),super(),this._initOptions(n);const{width:o,cornerRadius:s,bottomHeight:a,altitude:u,asynchronous:l}=n,h=i.distanceToVector3(s,s).x,c=i.distanceToVector3(o,o).x,{lineStrings:f,center:p}=Di(e);let d;if(l){d=mo();const n=t.Util.GUID();this.getOptions().id=n,this.getOptions().center=p,uo.push({id:n,data:f,layer:i,center:p,lineString:e,baseObject:this})}else{const t=[],e={};for(let n=0,r=f.length;n<r;n++){const r=Ri(f[n],c,h,i,p);pi(r,a,i,e),t.push(r)}d=co(t)}this._createMesh(d,r);const g=i.altitudeToVector3(u,u).x,y=i.coordinateToVector3(p,g);this.getObject3d().position.copy(y),this.type="Path"}_workerLoad(t){const e=go(t);this.getObject3d().geometry=e,this._fire("workerload",{target:this})}}const lu={width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61"};class hu extends(Wo(Fn)){constructor(e,n,r,i){Array.isArray(e)||(e=[e]);const o=[],s=[],a=e.length;for(let t=0;t<a;t++){const n=Di(e[t]);o.push(n.center),s.push(n.lineStrings)}const u=fi(o);n=t.Util.extend({},lu,n,{layer:i,lineStrings:e,coordinate:u});const{altitude:l,asynchronous:h}=n;let c;const f=[],p=[];if(super(),h)c=mo(),lo.push({id:t.Util.GUID(),layer:i,key:n.key,center:u,data:s,lineStrings:e,baseObject:this,option:n});else{const r=[];let o=0;const l={},h={};for(let c=0;c<a;c++){const a=e[c],f=t.Util.extend({},n,Ai(a),{index:c}),{cornerRadius:d,width:g,bottomHeight:y}=f,v=hi(g,i,l),m=hi(d,i,h),A=s[c],_=[];let x=0;for(let t=0,e=A.length;t<e;t++){const e=Ri(A[t],v,m,i,u);x=pi(e,y,i,l),_.push(e)}const w=fo(_);r.push(w);const{position:b,normal:E,indices:I}=w;I.length;const C=b.length/3;E.length,p[c]={position:{middleZ:x,count:C,start:o,end:o+3*C},hide:!1},o+=3*C}c=co(r)}this._initOptions(n),this._createMesh(c,r);const d=i.altitudeToVector3(l,l).x,g=i.coordinateToVector3(u,d);this.getObject3d().position.copy(g),this._baseObjects=f,this._datas=e,this._geometriesAttributes=p,this.faceIndex=null,this._geometryCache=yo(c),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Paths"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],n=Object.assign({},this.options,jn(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new uu(e,n,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const n=go(t);if(this._geometryCache=yo(n),this.getObject3d().geometry=n,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const cu=Math.PI/180,fu=[[4e3,220],[2e3,100],[1e3,30],[500,15],[100,5],[50,2],[10,1],[5,.7],[2,.1],[1,.05],[.5,.02],[.4,.01],[.1,.005],[.05,.002],[.01,.001]],pu=["mouseout","mousemove","click","mousedown","mouseup","dblclick","contextmenu","touchstart","touchmove","touchend"],du=new t.Coordinate(0,0),gu=new t.Point(0,0),yu=new o.Vector3,vu=new Map,mu="__webglFramebuffer",Au=new o.Vector4;class _u extends t.CanvasLayer{constructor(t,e){super(t,e),this._animationBaseObjectMap={},this._needsUpdate=!0,this._mousemoveTimeOut=0,this._mousedownTime=0,this._baseObjects=[],this._delayMeshes=[],this._meshes=[],this.type="ThreeLayer"}isMercator(){const t=this.getMap();if(!t)return!1;const e=t.getSpatialReference(),n=e._projection,r=e._resolutions;return!!(n&&"EPSG:3857"===n.code&&r&&r.length&&156543===Math.floor(r[0])&&t.getGLRes)}isRendering(){const t=this.getMap();return!!t&&(t.isInteracting()||t.isAnimating())}prepareToDraw(...t){}draw(t,e,n,r,i,o){this.renderScene(o,this)}drawOnInteracting(t,e,n,r,i,o,s){this.renderScene(s,this)}_transformHeight(t,e){if(!t)return 0;if(0===(e=e||0))return 0;return this.altitudeToVector3(e,e,null,yu).x}coordinateToVector3(e,n=0,r){const i=this.getMap();if(!i)return null;const s=Array.isArray(e);s?(du.x=e[0],du.y=e[1]):e instanceof t.Coordinate||(e=new t.Coordinate(e));const a=Eu(i),u=Iu(i,s?du:e,a,gu);return r&&(r.x=u.x,r.y=u.y,r.z=n),new o.Vector3(u.x,u.y,n)}coordinatiesToGLFloatArray(e,n,r){const i=this.getMap();if(!i)return null;const o=Eu(i),s=e.length,a=new Float32Array(2*s),u=new Float32Array(3*s);vu.clear();for(let l=0;l<s;l++){let s=e[l];const h=Array.isArray(s);h?(du.x=s[0],du.y=s[1]):s instanceof t.Coordinate||(s=new t.Coordinate(s));const c=Iu(i,h?du:s,o,gu);c.x-=n.x,c.y-=n.y;const f=2*l;a[f]=c.x,a[f+1]=c.y;const p=s;let d=p.z||p[2]||0;if(r&&!vu.has(d)){const t=this._transformHeight(r,d);vu.set(d,t)}let g=0;r&&(g=vu.get(d)||0);const y=3*l;u[y]=c.x,u[y+1]=c.y,u[y+2]=g}return{positions:u,positons2d:a}}coordinatiesToGLArray(e,n){const r=this.getMap();if(!r)return null;const i=Eu(r),o=e.length,s=new Array(o);for(let a=0;a<o;a++){let o=e[a];const u=Array.isArray(o);u?(du.x=o[0],du.y=o[1]):o instanceof t.Coordinate||(o=new t.Coordinate(o));const l=Iu(r,u?du:o,i,gu);l.x-=n.x,l.y-=n.y,s[a]=[l.x,l.y]}return s}distanceToVector3(e,n,r){if(0===e&&0===n||!t.Util.isNumber(e)||!t.Util.isNumber(n))return new o.Vector3(0,0,0);const i=this.getMap(),s=Eu(i);let a=r||i.getCenter();a instanceof t.Coordinate||(a=new t.Coordinate(a));const u=i.locate(a,e,n),l=Iu(i,a,s),h=Iu(i,u,s),c=Math.abs(h.x-l.x)*t.Util.sign(e),f=Math.abs(h.y-l.y)*t.Util.sign(n);return new o.Vector3(c,f,0)}altitudeToVector3(e,n,r,i){if(0===e||!t.Util.isNumber(e))return new o.Vector3(0,0,0);const s=this.getMap();if(s.altitudeToPoint){const t=Eu(s);let n=s.altitudeToPoint(e,t);return e<0&&n>0&&(n=-n),i?(i.x=n,i.y=n,i.z=0,i):new o.Vector3(n,n,0)}return this.distanceToVector3(e,e,r)}toShape(e){if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map((t=>this.toShape(t)));const n=e.getCenter(),r=this.coordinateToVector3(n),i=e.getShell().map((t=>{const e=this.coordinateToVector3(t).sub(r);return new o.Vector2(e.x,e.y)})),s=new o.Shape(i),a=e.getHoles();return a&&a.length>0&&(s.holes=a.map((t=>{const e=t.map((t=>{const e=this.coordinateToVector3(t).sub(r);return new o.Vector2(e.x,e.y)}));return new o.Shape(e)}))),s}toExtrudeMesh(e,n,r,i){if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map((t=>this.toExtrudeMesh(t,n,r,i)));const s=e.getCoordinates();s.forEach((t=>{for(let e=t.length-1;e>=1;e--)t[e].equals(t[e-1])&&t.splice(e,1)})),e.setCoordinates(s);const a=this.toShape(e),u=this.coordinateToVector3(e.getCenter());i=t.Util.isNumber(i)?i:n,i=this.altitudeToVector3(i,i).x;const l=this.altitudeToVector3(n,n).x,h={bevelEnabled:!1,bevelSize:1};h[parseInt(o.REVISION)>=93?"depth":"amount"]=i;const c=new o.ExtrudeGeometry(a,h);let f=c;o.BufferGeometry.prototype.fromGeometry&&(f=new o.BufferGeometry,f.fromGeometry(c));const p=new o.Mesh(f,r);return p.position.set(u.x,u.y,l-i),p}toExtrudePolygon(t,e,n){return new Do(t,e,n,this)}toBar(t,e,n){return new Mo(t,e,n,this)}toLine(t,e,n){return new ko(t,e,n,this)}toExtrudeLine(t,e,n){return new Lo(t,e,n,this)}toModel(t,e){return new No(t,e,this)}toExtrudeLineTrail(t,e,n){return new Vo(t,e,n,this)}toExtrudePolygons(t,e,n){return new Jo(t,e,n,this)}toPoint(t,e,n){return new ts(t,e,n,this)}toPoints(t,e,n){return new ss(t,e,n,this)}toBars(t,e,n){return new us(t,e,n,this)}toExtrudeLines(t,e,n){return new hs(t,e,n,this)}toLines(t,e,n){return new fs(t,e,n,this)}toThreeVectorTileLayer(t,e,n){return new bs(t,e,n,this)}toTerrain(t,e,n){return new ks(t,e,n,this)}toTerrainVectorTileLayer(t,e,n){return new Ls(t,e,n,this)}toHeatMap(t,e,n){return new Gs(t,e,n,this)}toFatLine(t,e,n){return new Hs(t,e,n,this)}toFatLines(t,e,n){return new Ys(t,e,n,this)}toBox(t,e,n){return new Js(t,e,n,this)}toBoxs(t,e,n){return new Zs(t,e,n,this)}toPath(t,e,n){return new uu(t,e,n,this)}toPaths(t,e,n){return new hu(t,e,n,this)}getBaseObjects(){return this.getMeshes().filter((t=>t instanceof Fn))}getMeshes(){const t=this.getScene();if(!t)return[];const e=[];for(let n=0,r=t.children.length;n<r;n++){const r=t.children[n];r instanceof o.Object3D&&!(r instanceof o.Camera)&&e.push(r.__parent||r)}return e}clear(){return this.clearMesh()}clearBaseObjects(){return this.removeMesh(this.getBaseObjects())}clearMesh(){const t=this.getScene();if(!t)return this;for(let e=t.children.length-1;e>=0;e--){const n=t.children[e];if(n instanceof o.Object3D&&!(n instanceof o.Camera)){t.remove(n);const e=n.__parent;e&&e instanceof Fn&&(e.isAdd=!1,e.options.layer=null,e._fire("remove",{target:e}),delete this._animationBaseObjectMap[n.uuid],e._hideUI())}}return this._meshes=[],this}lookAt(t){const e=this.getCamera();return e&&e.lookAt&&t&&e.lookAt(t),this}getCamera(){const t=this._getRenderer();return t?t.camera:null}getScene(){const t=this._getRenderer();return t?t.scene:null}renderScene(t,e){const n=this._getRenderer();return n&&(n.clearCanvas(),n.renderScene(t),e||n.setToRedraw()),this}loop(t=!1){const e=this._delayMeshes;if(!e.length)return;const n=this.getMap();if(!n||n.isAnimating()||n.isInteracting())return;const r=this.options.loopRenderCount||50,i=e.slice(0,r);i&&this.addMesh(i,t),e.splice(0,r)}renderPickScene(){const t=this._getRenderer();if(t){const e=t.pick;e&&e.pick(this._containerPoint)}return this}getThreeRenderer(){const t=this._getRenderer();return t?t.context:null}getPick(){const t=this._getRenderer();return t?t.pick:null}delayAddMesh(t){if(!t)return this;Array.isArray(t)||(t=[t]);for(let e=0,n=t.length;e<n;e++)this._delayMeshes.push(t[e]);return this}addMesh(e,n=!0){if(!e)return this;Array.isArray(e)||(e=[e]);const r=this.getScene();if(e.forEach((e=>{e instanceof Fn?(r.add(e.getObject3d()),e.isAdd||(e.isAdd=!0,e.options.layer=this,e._fire("add",{target:e})),e._animation&&t.Util.isFunction(e._animation)&&(this._animationBaseObjectMap[e.getObject3d().uuid]=e)):e instanceof o.Object3D&&r.add(e);-1===this._meshes.indexOf(e)&&this._meshes.push(e)})),this._zoomend(),n){const t=this._getRenderer();t&&t.setToRedraw()}return this}removeMesh(e,n=!0){if(!e)return this;Array.isArray(e)||(e=[e]);const r=this.getScene();if(e.forEach((e=>{if(e instanceof Fn){r.remove(e.getObject3d()),e.isAdd&&(e.isAdd=!1,e.options.layer=null,e._fire("remove",{target:e}),e._hideUI()),e._animation&&t.Util.isFunction(e._animation)&&delete this._animationBaseObjectMap[e.getObject3d().uuid];const n=this._delayMeshes;if(n.length)for(let t=0,r=n.length;t<r;t++)if(n[t]===e){n.splice(t,1);break}}else e instanceof o.Object3D&&r.remove(e);for(let t=0,n=this._meshes.length;t<n;t++){const n=this._meshes[t];n&&(n===e&&this._meshes.splice(t,1))}})),n){const t=this._getRenderer();t&&t.setToRedraw()}return this}_initRaycaster(){return this._raycaster||(this._raycaster=new o.Raycaster,this._mouse=new o.Vector2),this}getRaycaster(){return this._raycaster}identify(e,n){if(!e)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(e)&&(e=new t.Coordinate(e)),!(e instanceof t.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];const r=this.getMap().coordToContainerPoint(e);this._containerPoint=r;const{x:i,y:s}=r;this._initRaycaster(),this.fire("identify",{coordinate:e,options:n});const a=this._raycaster,u=this._mouse,l=this.getCamera(),h=this.getScene(),c=this.getMap().getSize();if(!h)return[];const f=c.width,p=c.height;u.x=i/f*2-1,u.y=-s/p*2+1,a.setFromCamera(u,l),a.layers&&a.layers.enableAll&&a.layers.enableAll(),function(t,e){En>113?t.params.Line.threshold=e:t.linePrecision=e}(a,this._getLinePrecision(this.getMap().getResolution()));const d=[],g=[];h.children.forEach((e=>{const n=e.__parent;if(n&&n.getOptions){const r=n;r.getOptions().interactive&&r.isVisible()&&(r.identify&&t.Util.isFunction(r.identify)?g.push(r):d.push(e))}else(e instanceof o.Mesh||e instanceof o.Group)&&d.push(e)}));let y=[];const v=a.intersectObjects(d,!0);v&&Array.isArray(v)&&v.length&&(y=v.map((e=>{let n=e.object;const r=e.instanceId;n=this._recursionMesh(n)||{};const i=n.__parent||n;return i.faceIndex=e.faceIndex,i.index=e.index,i.intersect=e,t.Util.isNumber(r)&&(i.instanceId=r),i}))),this.renderPickScene(),g.length&&g.forEach((t=>{t.identify(e)&&y.push(t)}));const m=y.length;for(let t=0;t<m;t++)if(y[t])for(let e=t+1;e<m;e++)y[t]===y[e]&&y.splice(e,1);let A=y.filter((t=>t instanceof Fn));A=A.sort(((t,e)=>t.options.pickWeight-e.options.pickWeight)),y.forEach((t=>{t instanceof Fn||A.push(t)}));const _=(n=t.Util.extend({},n)).count;return t.Util.isNumber(_)&&_>0?A.slice(0,_):y}identifyAtPoint(t,e={}){const n=this.getMap();if(!n)return[];const r=n.containerPointToCoordinate(t);return this.identify(r,e)}_recursionMesh(t){for(;t&&t.parent!==this.getScene();)t=t.parent;return t}_getLinePrecision(t=10){for(let e=0,n=fu.length;e<n;e++){const[n,r]=fu[e];if(t>n)return r}return.01}fireGeoEvent(t,e,n){if(!(t instanceof Fn))return this;n=n||e.type;const r=this._getEventParams(e),{coordinate:i}=r,o=this.getMap();function s(t,e){e=e||n;const r=t.getInfoWindow();r&&!r._owner&&r.addTo(t);((r?r.options:{}).autoOpenOn||"click")===e&&(o.options.supportPluginEvent||t.openInfoWindow(i),t.fire("showinfowindow",{infoWindow:r}))}if("mousemove"===n){t.fire(n,Object.assign({},r,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(i),s(t)}else"mouseover"===n?t._mouseover||(t.fire("mouseover",Object.assign({},r,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,s(t,"mouseover")):"mouseout"===n?t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},r,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},r,{target:t,type:"mouseout"})),t.closeToolTip()):(t.fire(n,Object.assign({},r,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),s(t))}_emptyIdentify(t={}){const e=t.domEvent,n=this.getScene();if(!n)return this;const r=this.map||this.getMap();if(!r)return this;const i=r._getEventParams?r._getEventParams(e):this._getEventParams(e);for(let t=0,e=n.children.length;t<e;t++){const e=(n.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}}_identifyBaseObjectEvents(e){if(!this.options.geometryEvents)return this;const n=this.map||this.getMap();if(n.isInteracting()||!n.options.geometryEvents||n._ignoreEvent(e))return this;const r=e.type,i=n._getEventParams?n._getEventParams(e):this._getEventParams(e);i.type=r;const{type:o,coordinate:s}=i,a=t.Util.now();if(this._mousemoveTimeOut&&"mousemove"===o&&a-this._mousemoveTimeOut<64)return this;this._mousemoveTimeOut=a,"mousedown"!==o&&"touchstart"!==o||(this._mousedownTime=t.Util.now());let u=!1;if("click"===o||"touchend"===o){const e=n.options.clickTimeThreshold||280;u=t.Util.now()-this._mousedownTime<e}if("click"===o&&!u)return this;const l=this.options.identifyCountOnEvent;let h=Math.max(0,t.Util.isNumber(l)?l:0);0===h&&(h=1/0);const c=t=>{const e=[];this._baseObjects&&this._baseObjects.forEach((n=>{let r=!0;t.forEach((t=>{n===t&&(r=!1)})),r&&e.push(n)})),e.forEach((t=>{t&&t instanceof Fn&&(t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout"})),t.closeToolTip()))}))};if("mouseout"===o)return c([]),this._baseObjects=[],this;const f=this.identify(s,{count:h}),p=this.getScene();if(0===f.length&&p)for(let t=0,e=p.children.length;t<e;t++){const e=(p.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}function d(t,e){e=e||o;const n=t.getInfoWindow();n&&!n._owner&&n.addTo(t);((n?n.options:{}).autoOpenOn||"click")===e&&(t.openInfoWindow(s),t.fire("showinfowindow",{infoWindow:n}))}if("mousemove"===o?(c(f),f.forEach((t=>{if(t instanceof Fn){t._mouseover||(t.fire("mouseover",Object.assign({},i,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,d(t,"mouseover")),t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(s),d(t)}})),this._baseObjects=f):f.forEach((t=>{t instanceof Fn&&(t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t))})),"touchend"===o&&u){const n=t.Util.extend({},i,{domEvent:e});f.forEach((t=>{t instanceof Fn&&(t.fire("click",Object.assign({},n,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t,"click"))}))}return this}_getEventParams(e){const n=this.getMap(),r={domEvent:e};if(!n)return r;const i=e.touches&&e.touches.length>0?e.touches[0]:e.changedTouches&&e.changedTouches.length>0?e.changedTouches[0]:e;if(i){const e=(0,t.DomUtil.getEventContainerPoint)(i,n._containerDOM);r.coordinate=n.containerPointToCoordinate(e),r.containerPoint=e,r.viewPoint=n.containerPointToViewPoint(e),r.pont2d=n._containerPointToPoint(e)}return r}_zoomend(){const e=this.getScene();if(!e)return;const n=this.getMap().getZoom();e.children.forEach((e=>{const r=e.__parent;if(r&&r.getOptions){const e=r;e.zoomChange&&t.Util.isFunction(e.zoomChange)&&e.zoomChange(n);const i=e.getMinZoom(),o=e.getMaxZoom();n<i||n>o?(e.isVisible()&&(e.getObject3d().visible=!1),e._zoomVisible=!1):i<=n&&n<=o&&(e._visible&&(e.getObject3d().visible=!0),e._zoomVisible=!0)}}))}_getGeometryEventMapPanel(){const t=this.map||this.getMap();return t._panels.allLayers||t._containerDOM}onAdd(){super.onAdd();const e=this.map||this.getMap();if(!e)return this;const n=this._getGeometryEventMapPanel();return this._identifyBaseObjectEventsThis||(this._identifyBaseObjectEventsThis=this._identifyBaseObjectEvents.bind(this)),this._zoomendThis||(this._zoomendThis=this._zoomend.bind(this)),this._emptyIdentifyThis||(this._emptyIdentifyThis=this._emptyIdentify.bind(this)),e.options.supportPluginEvent?this.on("identifyempty",this._emptyIdentifyThis):t.DomUtil.on(n,pu.join(" "),this._identifyBaseObjectEventsThis,this),this._needsUpdate=!0,this._animationBaseObjectMap||(this._animationBaseObjectMap={}),e.on("zooming zoomend",this._zoomendThis,this),this}onRemove(){super.onRemove();const e=this.map||this.getMap();if(!e)return this;const n=this._getGeometryEventMapPanel();return e.options.supportPluginEvent?this.off("identifyempty",this._emptyIdentifyThis):t.DomUtil.off(n,pu.join(" "),this._identifyBaseObjectEventsThis,this),e.off("zooming zoomend",this._zoomendThis,this),this}_addBaseObjectsWhenInit(){return this.addMesh(this._meshes),this}_callbackBaseObjectAnimation(){const t=this;if(t._animationBaseObjectMap)for(const e in t._animationBaseObjectMap){t._animationBaseObjectMap[e]._animation()}return this}_getFovRatio(){const t=this.getMap().getFov();return Math.tan(t/2*cu)}}_u.mergeOptions({renderer:"gl",doubleBuffer:!1,glOptions:null,geometryEvents:!0,identifyCountOnEvent:0,forceRenderOnZooming:!0,loopRenderCount:50});const xu={bloom:!0};class wu extends t.renderer.CanvasLayerRenderer{constructor(){super(...arguments),this._renderTime=0,this._renderTarget=null}getPrepareParams(){return[this.scene,this.camera]}getDrawParams(){return[this.scene,this.camera]}_drawLayer(){super._drawLayer.apply(this,arguments)}hitDetect(){return!1}createCanvas(){super.createCanvas(),this.createContext()}createContext(){if(this.canvas.gl&&this.canvas.gl.wrap)this.gl=this.canvas.gl.wrap();else{const t=this.layer.options.glOptions||{alpha:!0,depth:!0,antialias:!0,stencil:!0,preserveDrawingBuffer:!1};t.preserveDrawingBuffer=!0,this.gl=this.gl||this._createGLContext(this.canvas,t)}this._initThreeRenderer(),this.layer.onCanvasCreate(this.context,this.scene,this.camera)}_initThreeRenderer(){this.matrix4=new o.Matrix4;const t=new o.WebGLRenderer({context:this.gl,alpha:!0});t.autoClear=!1,t.setClearColor(new o.Color(1,1,1),0),t.setSize(this.canvas.width,this.canvas.height),t.clear(),this.context=t;const e=this.scene=new o.Scene,n=this.layer.getMap(),r=n.getFov()*Math.PI/180,i=this.camera=new o.PerspectiveCamera(r,n.width/n.height,n.cameraNear,n.cameraFar);i.matrixAutoUpdate=!1,this._syncCamera(),e.add(i),this.pick=new Vs(this.layer),ho.star(),this.layer._addBaseObjectsWhenInit()}onCanvasCreate(){super.onCanvasCreate()}resizeCanvas(e){if(!this.canvas)return;let n,r=this.getMap();n=e||r.getSize();const i=r.getDevicePixelRatio?r.getDevicePixelRatio():t.Browser.retina?2:1,o=this.canvas,{width:s,height:a,cssWidth:u,cssHeight:l}=t.Util.calCanvasSize(n,i);if(!this.layer._canvas||o.style.width===u&&o.style.height===l||(o.style.width=u,o.style.height=l),o.width===s&&o.height===a)return this;o.width=s,o.height=a,this.context.setSize(o.width,o.height)}clearCanvas(){this.canvas&&this.context.clear()}prepareCanvas(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null}renderScene(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){const{width:e,height:n}=t.renderTarget.fbo;this._renderTarget?(this._renderTarget.viewport.set(0,0,e,n),this._renderTarget.scissor.set(0,0,e,n)):(this._renderTarget=new o.WebGLRenderTarget(e,n,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));const r=this.context.properties.get(this._renderTarget),i=r[mu];r[mu]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);const s=1===t.bloom&&t.sceneFilter,a=this.scene.children||[];let u=!1;if(s){const e=t.sceneFilter;u=e(xu);for(let t=0,n=a.length;t<n;t++){if(!a[t]||!a[t].layers)continue;const n=a[t].__parent;a[t].bloom=!1,n&&(a[t].bloom=n.bloom);let r=0;(a[t]&&e(a[t])||!n)&&u&&(r=1),a[t].__layer!==r&&(bu(a[t],r),a[t].__layer=r)}}else for(let t=0,e=a.length;t<e;t++)a[t]&&a[t].layers&&0!==a[t].__layer&&(bu(a[t],0),a[t].__layer=0);this.camera.layers.set(u?1:0),this.context.render(this.scene,this.camera),r[mu]=i}else{const{width:t,height:e}=this.canvas,n=this.context.getViewport(Au);n.width===t&&n.height===e||this.context.setViewport(0,0,t,e),this.context.render(this.scene,this.camera)}this.context.setRenderTarget(null),this.completeRender()}remove(){delete this._drawContext,this._renderTarget&&(this._renderTarget.dispose(),delete this._renderTarget),super.remove()}_syncCamera(){const t=this.getMap(),e=this.camera;e.matrix.elements=t.cameraWorldMatrix,e.projectionMatrix.elements=t.projMatrix,this.matrix4.invert?e.projectionMatrixInverse.elements=this.matrix4.copy(e.projectionMatrix).invert().elements:e.projectionMatrixInverse&&(e.projectionMatrixInverse.elements=this.matrix4.getInverse(e.projectionMatrix).elements)}_createGLContext(t,e){const n=["webgl2","webgl","experimental-webgl"];let r=null;for(let i=0;i<n.length;++i){try{r=t.getContext(n[i],e)}catch(t){}if(r)break}return r}}function bu(t,e){if(!t)return;t.layers&&t.layers.set(e);const n=t.children;if(n&&n.length)for(let t=0,r=n.length;t<r;t++)bu(n[t],e)}function Eu(t){return t.getGLRes?t.getGLRes():t.getGLZoom()}function Iu(t,e,n,r){return t.coordToPointAtRes?t.coordToPointAtRes(e,n,r):t.coordinateToPoint(e,n,r)}_u.registerRenderer("gl",wu),t.registerWorkerAdapter&&(t.registerWorkerAdapter("__maptalks.three__",'(function(t){"use strict";\n/*!\n * poly-extrude v0.16.0\n */function n(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function i(t,n){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i(t,n)}function e(t,n,i){void 0===i&&(i=2);var e,s,h,a=n&&n.length,u=a?n[0]*i:t.length,c=r(t,0,u,i,!0),x=[];if(!c||c.next===c.prev)return x;if(a&&(c=function(t,n,i,e){for(var s=[],o=0,h=n.length;o<h;o++){var a=r(t,n[o]*e,o<h-1?n[o+1]*e:t.length,e,!1);a===a.next&&(a.steiner=!0),s.push(d(a))}s.sort(l);for(var u=0;u<s.length;u++)i=f(s[u],i);return i}(t,n,c,i)),t.length>80*i){e=1/0,s=1/0;for(var y=-1/0,p=-1/0,v=i;v<u;v+=i){var g=t[v],_=t[v+1];g<e&&(e=g),_<s&&(s=_),g>y&&(y=g),_>p&&(p=_)}h=0!==(h=Math.max(y-e,p-s))?32767/h:0}return o(c,x,i,e,s,h,0),x}function r(t,n,i,e,r){var s;if(r===function(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,n,i,e)>0)for(var o=n;o<i;o+=e)s=P(o/e|0,t[o],t[o+1],s);else for(var h=i-e;h>=n;h-=e)s=P(h/e|0,t[h],t[h+1],s);return s&&m(s,s.next)&&(S(s),s=s.next),s}function s(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!m(e,e.next)&&0!==_(e.prev,e,e.next))e=e.next;else{if(S(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function o(t,n,i,e,r,l,f){if(t){!f&&l&&function(t,n,i,e){var r=t;do{0===r.z&&(r.z=y(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i=1;do{var e=t,r=void 0;t=null;var s=null;for(n=0;e;){n++;for(var o=e,h=0,a=0;a<i&&(h++,o=o.nextZ);a++);for(var u=i;h>0||u>0&&o;)0!==h&&(0===u||!o||e.z<=o.z)?(r=e,e=e.nextZ,h--):(r=o,o=o.nextZ,u--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;e=o}s.nextZ=null,i*=2}while(n>1)}(r)}(t,e,r,l);for(var x=t;t.prev!==t.next;){var d=t.prev,p=t.next;if(l?a(t,e,r,l):h(t))n.push(d.i,t.i,p.i),S(t),t=p.next,x=p.next;else if((t=p)===x){f?1===f?o(t=u(s(t),n),n,i,e,r,l,2):2===f&&c(t,n,i,e,r,l):o(s(t),n,i,e,r,l,1);break}}}}function h(t){var n=t.prev,i=t,e=t.next;if(_(n,i,e)>=0)return!1;for(var r=n.x,s=i.x,o=e.x,h=n.y,a=i.y,u=e.y,c=Math.min(r,s,o),l=Math.min(h,a,u),f=Math.max(r,s,o),x=Math.max(h,a,u),y=e.next;y!==n;){if(y.x>=c&&y.x<=f&&y.y>=l&&y.y<=x&&v(r,h,s,a,o,u,y.x,y.y)&&_(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function a(t,n,i,e){var r=t.prev,s=t,o=t.next;if(_(r,s,o)>=0)return!1;for(var h=r.x,a=s.x,u=o.x,c=r.y,l=s.y,f=o.y,x=Math.min(h,a,u),d=Math.min(c,l,f),p=Math.max(h,a,u),g=Math.max(c,l,f),m=y(x,d,n,i,e),z=y(p,g,n,i,e),w=t.prevZ,M=t.nextZ;w&&w.z>=m&&M&&M.z<=z;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;w&&w.z>=m;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=z;){if(M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function u(t,n){var i=t;do{var e=i.prev,r=i.next.next;!m(e,r)&&z(e,i,i.next,r)&&b(e,r)&&b(r,e)&&(n.push(e.i,i.i,r.i),S(i),S(i.next),i=t=r),i=i.next}while(i!==t);return s(i)}function c(t,n,i,e,r,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&g(a,u)){var c=A(a,u);return a=s(a,a.next),c=s(c,c.next),o(a,n,i,e,r,h,0),void o(c,n,i,e,r,h,0)}u=u.next}a=a.next}while(a!==t)}function l(t,n){var i=t.x-n.x;0===i&&(0===(i=t.y-n.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(n.next.y-n.y)/(n.next.x-n.x)));return i}function f(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;if(m(t,e))return e;do{if(m(t,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,i=e.x<e.next.x?e:e.next,h===r))return i}e=e.next}while(e!==n);if(!i)return null;var a=i,u=i.x,c=i.y,l=1/0;e=i;do{if(r>=e.x&&e.x>=u&&r!==e.x&&p(s<c?r:o,s,u,c,s<c?o:r,s,e.x,e.y)){var f=Math.abs(s-e.y)/(r-e.x);b(e,t)&&(f<l||f===l&&(e.x>i.x||e.x===i.x&&x(i,e)))&&(i=e,l=f)}e=e.next}while(e!==a);return i}(t,n);if(!i)return n;var e=A(i,t);return s(e,e.next),s(i,i.next)}function x(t,n){return _(t.prev,t,n.prev)<0&&_(n.next,t,t.next)<0}function y(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-e)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function d(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function p(t,n,i,e,r,s,o,h){return(r-o)*(n-h)>=(t-o)*(s-h)&&(t-o)*(e-h)>=(i-o)*(n-h)&&(i-o)*(s-h)>=(r-o)*(e-h)}function v(t,n,i,e,r,s,o,h){return!(t===o&&n===h)&&p(t,n,i,e,r,s,o,h)}function g(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&z(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(b(t,n)&&b(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(_(t.prev,t,n.prev)||_(t,n.prev,n))||m(t,n)&&_(t.prev,t,t.next)>0&&_(n.prev,n,n.next)>0)}function _(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function m(t,n){return t.x===n.x&&t.y===n.y}function z(t,n,i,e){var r=M(_(t,n,i)),s=M(_(t,n,e)),o=M(_(i,e,t)),h=M(_(i,e,n));return r!==s&&o!==h||(!(0!==r||!w(t,i,n))||(!(0!==s||!w(t,e,n))||(!(0!==o||!w(i,t,e))||!(0!==h||!w(i,n,e)))))}function w(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function M(t){return t>0?1:t<0?-1:0}function b(t,n){return _(t.prev,t,t.next)<0?_(t,n,t.next)>=0&&_(t,t.prev,n)>=0:_(t,n,t.prev)<0||_(t,t.next,n)<0}function A(t,n){var i=C(t.i,t.x,t.y),e=C(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function P(t,n,i,e){var r=C(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function S(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function C(t,n,i){return{i:t,x:n,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var k=new(function(){function t(t,n,i,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===e&&(e=1),this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=e}t.slerpFlat=function(t,n,i,e,r,s,o){var h=i[e+0],a=i[e+1],u=i[e+2],c=i[e+3],l=r[s+0],f=r[s+1],x=r[s+2],y=r[s+3];if(0===o)return t[n+0]=h,t[n+1]=a,t[n+2]=u,void(t[n+3]=c);if(1===o)return t[n+0]=l,t[n+1]=f,t[n+2]=x,void(t[n+3]=y);if(c!==y||h!==l||a!==f||u!==x){var d=1-o,p=h*l+a*f+u*x+c*y,v=p>=0?1:-1,g=1-p*p;if(g>Number.EPSILON){var _=Math.sqrt(g),m=Math.atan2(_,p*v);d=Math.sin(d*m)/_,o=Math.sin(o*m)/_}var z=o*v;if(h=h*d+l*z,a=a*d+f*z,u=u*d+x*z,c=c*d+y*z,d===1-o){var w=1/Math.sqrt(h*h+a*a+u*u+c*c);h*=w,a*=w,u*=w,c*=w}}t[n]=h,t[n+1]=a,t[n+2]=u,t[n+3]=c},t.multiplyQuaternionsFlat=function(t,n,i,e,r,s){var o=i[e],h=i[e+1],a=i[e+2],u=i[e+3],c=r[s],l=r[s+1],f=r[s+2],x=r[s+3];return t[n]=o*x+u*c+h*f-a*l,t[n+1]=h*x+u*l+a*c-o*f,t[n+2]=a*x+u*f+o*l-h*c,t[n+3]=u*x-o*c-h*l-a*f,t};var i,e,r,s=t.prototype;return s.set=function(t,n,i,e){return this._x=t,this._y=n,this._z=i,this._w=e,this._onChangeCallback(),this},s.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},s.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},s.setFromEuler=function(t,n){void 0===n&&(n=!0);var i=t._x,e=t._y,r=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(i/2),u=o(e/2),c=o(r/2),l=h(i/2),f=h(e/2),x=h(r/2);switch(s){case"XYZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"YXZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"ZXY":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"ZYX":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"YZX":this._x=l*u*c+a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c-l*f*x;break;case"XZY":this._x=l*u*c-a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c+l*f*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===n&&this._onChangeCallback(),this},s.setFromAxisAngle=function(t,n){var i=n/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this},s.setFromRotationMatrix=function(t){var n=t.elements,i=n[0],e=n[4],r=n[8],s=n[1],o=n[5],h=n[9],a=n[2],u=n[6],c=n[10],l=i+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this._w=.25/f,this._x=(u-h)*f,this._y=(r-a)*f,this._z=(s-e)*f}else if(i>o&&i>c){var x=2*Math.sqrt(1+i-o-c);this._w=(u-h)/x,this._x=.25*x,this._y=(e+s)/x,this._z=(r+a)/x}else if(o>c){var y=2*Math.sqrt(1+o-i-c);this._w=(r-a)/y,this._x=(e+s)/y,this._y=.25*y,this._z=(h+u)/y}else{var d=2*Math.sqrt(1+c-i-o);this._w=(s-e)/d,this._x=(r+a)/d,this._y=(h+u)/d,this._z=.25*d}return this._onChangeCallback(),this},s.setFromUnitVectors=function(t,n){var i=t.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=i),this.normalize()},s.rotateTowards=function(t,n){var i=this.angleTo(t);if(0===i)return this;var e=Math.min(1,n/i);return this.slerp(t,e),this},s.identity=function(){return this.set(0,0,0,1)},s.invert=function(){return this.conjugate()},s.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},s.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},s.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},s.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},s.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},s.multiply=function(t){return this.multiplyQuaternions(this,t)},s.premultiply=function(t){return this.multiplyQuaternions(t,this)},s.multiplyQuaternions=function(t,n){var i=t._x,e=t._y,r=t._z,s=t._w,o=n._x,h=n._y,a=n._z,u=n._w;return this._x=i*u+s*o+e*a-r*h,this._y=e*u+s*h+r*o-i*a,this._z=r*u+s*a+i*h-e*o,this._w=s*u-i*o-e*h-r*a,this._onChangeCallback(),this},s.slerp=function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var i=this._x,e=this._y,r=this._z,s=this._w,o=s*t._w+i*t._x+e*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=i,this._y=e,this._z=r,this;var h=1-o*o;if(h<=Number.EPSILON){var a=1-n;return this._w=a*s+n*this._w,this._x=a*i+n*this._x,this._y=a*e+n*this._y,this._z=a*r+n*this._z,this.normalize(),this}var u=Math.sqrt(h),c=Math.atan2(u,o),l=Math.sin((1-n)*c)/u,f=Math.sin(n*c)/u;return this._w=s*l+this._w*f,this._x=i*l+this._x*f,this._y=e*l+this._y*f,this._z=r*l+this._z*f,this._onChangeCallback(),this},s.slerpQuaternions=function(t,n,i){return this.copy(t).slerp(n,i)},s.random=function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(n),r*Math.cos(n))},s.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},s.fromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this},s.toArray=function(t,n){return void 0===t&&(t=[]),void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t},s.fromBufferAttribute=function(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this},s.toJSON=function(){return this.toArray()},s._onChange=function(t){return this._onChangeCallback=t,this},s._onChangeCallback=function(){},i=t,(e=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])&&n(i.prototype,e),r&&n(i,r),Object.defineProperty(i,"prototype",{writable:!1}),t}()),V=function(){function t(t,n,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),this.x=t,this.y=n,this.z=i}var n=t.prototype;return n.set=function(t,n,i){return void 0===i&&(i=this.z),this.x=t,this.y=n,this.z=i,this},n.clone=function(){return new this.constructor(this.x,this.y,this.z)},n.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.addVectors=function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this},n.addScaledVector=function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this},n.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.subVectors=function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this},n.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.multiplyVectors=function(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this},n.applyAxisAngle=function(t,n){return this.applyQuaternion(k.setFromAxisAngle(t,n))},n.applyMatrix4=function(t){var n=this.x,i=this.y,e=this.z,r=t.elements,s=1/(r[3]*n+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*e+r[12])*s,this.y=(r[1]*n+r[5]*i+r[9]*e+r[13])*s,this.z=(r[2]*n+r[6]*i+r[10]*e+r[14])*s,this},n.applyQuaternion=function(t){var n=this.x,i=this.y,e=this.z,r=t.x,s=t.y,o=t.z,h=t.w,a=h*n+s*e-o*i,u=h*i+o*n-r*e,c=h*e+r*i-s*n,l=-r*n-s*i-o*e;return this.x=a*h+l*-r+u*-o-c*-s,this.y=u*h+l*-s+c*-r-a*-o,this.z=c*h+l*-o+a*-s-u*-r,this},n.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.divideScalar=function(t){return this.multiplyScalar(1/t)},n.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},n.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},n.clamp=function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this},n.clampScalar=function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this},n.clampLength=function(t,n){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,i)))},n.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.normalize=function(){return this.divideScalar(this.length()||1)},n.setLength=function(t){return this.normalize().multiplyScalar(t)},n.lerp=function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this},n.lerpVectors=function(t,n,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this},n.cross=function(t){return this.crossVectors(this,t)},n.crossVectors=function(t,n){var i=t.x,e=t.y,r=t.z,s=n.x,o=n.y,h=n.z;return this.x=e*h-r*o,this.y=r*s-i*h,this.z=i*o-e*s,this},n.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.fromArray=function(t,n){return void 0===n&&(n=0),this.x=t[n],this.y=t[n+1],this.z=t[n+2],this},n.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function Z(t){let n,i,e=0,r=1;const s=t.length;for(;r<s;)n=i||t[0],i=t[r],e+=(i[0]-n[0])*(i[1]+n[1]),r++;return e>0}function F(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t}function L(t,n){const i=n[0],e=n[1],r=n[2],s=Math.sqrt(i*i+e*e+r*r)||1;return t[0]=i/s,t[1]=e/s,t[2]=r/s,t}function q(t,n,i){const e=n[0],r=n[1],s=n[2],o=i[0],h=i[1],a=i[2];return t[0]=r*a-s*h,t[1]=s*o-e*a,t[2]=e*h-r*o,t}function E(t,n){function i(t,n,i,e){t[0]=n,t[1]=i,t[2]=e}const e=[],r=[],s=[],o=[],h=[],a=[],u=t.length,c=new Float32Array(n.length);let l=0;for(;l<u;){const u=3*t[l],f=3*t[l+1],x=3*t[l+2];i(e,n[u],n[u+1],n[u+2]),i(r,n[f],n[f+1],n[f+2]),i(s,n[x],n[x+1],n[x+2]),F(h,s,r),F(o,e,r),q(a,h,o);for(let t=0;t<3;t++)c[u+t]+=a[t],c[f+t]+=a[t],c[x+t]+=a[t];l+=3}let f=0;const x=c.length;for(;f<x;)i(a,c[f],c[f+1],c[f+2]),L(a,a),c[f]=a[0]||0,c[f+1]=a[1]||0,c[f+2]=a[2]||0,f+=3;return c}function I(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let n=0,i=0;for(let e=0,r=t.length;e<r;e++){const{position:r,indices:s}=t[e];n+=r.length,i+=s.length}const e={position:new Float32Array(n),normal:new Float32Array(n),uv:new Float32Array(n/3*2),indices:new Uint32Array(i),results:t};let r=0,s=0,o=0,h=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:a,normal:u,uv:c}=t[n];e.position.set(i,r),e.normal.set(u,r),e.uv.set(c,h);let l=0;const f=a.length;for(;l<f;){const t=a[l]+s;e.indices[o]=t,o++,l++}h+=c.length,r+=i.length,s+=i.length/3}return e}function O(t){return 180*t/Math.PI}function U(t){return t/180*Math.PI}function N(t,n,i,e,r,s){const o=3*i,h=3*e,a=3*r,u=3*s,c=n[o],l=n[o+1],f=n[o+2],x=n[h],y=n[h+1],d=n[h+2],p=n[a],v=n[a+1],g=n[a+2],_=n[u],m=n[u+1],z=n[u+2];let w=t.length-1;Math.abs(l-y)<Math.abs(c-x)?(t[++w]=c,t[++w]=1-f,t[++w]=x,t[++w]=1-d,t[++w]=p,t[++w]=1-g,t[++w]=_,t[++w]=1-z):(t[++w]=l,t[++w]=1-f,t[++w]=y,t[++w]=1-d,t[++w]=v,t[++w]=1-g,t[++w]=m,t[++w]=1-z)}function j(t,n){n=Object.assign({},{depth:2,top:!0},n);const i=t.map((t=>{for(let n=0,i=t.length;n<i;n++){const i=t[n];Q(i),0===n?Z(i)||(t[n]=i.reverse()):Z(i)&&(t[n]=i.reverse()),R(i)&&i.splice(i.length-1,1)}const i=function(t,n){const i=function(t){let n=0,i=0;const e=t.length;for(;i<e;)n+=t[i].length,i++;return n}(t),e=t.length,r=[],s=new Float32Array(2*i),o=[],h=[],a=3*i,u=2*i,c=n.depth;let l=0,f=0,x=0;for(let n=0;n<e;n++){const i=t[n];n>0&&r.push(l/2);let e=0;const y=i.length;for(;e<y;){const t=i[e],n=t[0],r=t[1],y=t[2]||0;s[l++]=n,s[l++]=r,o[f]=n,o[f+1]=r,o[f+2]=c+y,o[a+f]=n,o[a+f+1]=r,o[a+f+2]=y,h[x]=n,h[x+1]=r,h[u+x]=n,h[u+x+1]=r,f+=3,x+=2,e++}}return{flatVertices:s,holes:r,points:o,count:i,uv:h}}(t,n);i.polygon=t;return function(t,n,i){const e=[],{count:r}=t,s=i.top;for(let t=0,i=n.length;t<i;t+=3){const o=n[t],h=n[t+1],a=n[t+2];s&&(e[t]=o,e[t+1]=h,e[t+2]=a);let u=i+t;const c=r+o,l=r+h,f=r+a;s||(u=t),e[u]=c,e[u+1]=l,e[u+2]=f}t.indices=e}(i,e(i.flatVertices,i.holes,2),n),function(t,n){const{points:i,indices:e,polygon:r,uv:s}=t,o=n.depth;let h=i.length-1,a=e.length-1;for(let t=0,n=r.length;t<n;t++){const n=r[t];let u=0;const c=n.length;for(;u<c;){const t=n[u];let r=n[u+1];u===c-1&&(r=n[0]);const l=i.length/3,f=t[0],x=t[1],y=t[2]||0,d=r[0],p=r[1],v=r[2]||0;i[++h]=f,i[++h]=x,i[++h]=y+o,i[++h]=d,i[++h]=p,i[++h]=v+o,i[++h]=f,i[++h]=x,i[++h]=y,i[++h]=d,i[++h]=p,i[++h]=v;const g=l+2,_=l+3,m=l,z=l+1;e[++a]=g,e[++a]=m,e[++a]=_,e[++a]=m,e[++a]=z,e[++a]=_,N(s,i,g,_,m,z),u++}}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),r=I(i);return r.polygons=t,r}function Q(t){R(t)||t.push(t[0])}function R(t){const n=t.length,[i,e]=t[0],[r,s]=t[n-1];return i===r&&e===s}function W(t,n){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(n=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n));const i=t.map((t=>{const i=function(t,n){let i=n.lineWidth/2;n.isSlope&&(i*=2);const e=[],r=[],s=[],o=t.length;let h=0;for(;h<o;){let n=t[h],a=t[h+1];const u=t[h];h===o-1&&(n=t[o-2],a=t[o-1]);const c=a[1]-n[1],l=a[0]-n[0];let f=0;const x=O(Math.atan(c/l));if(0===h||h===o-1)f=x,f-=90;else{const i=t[h-1];B.x=i[0]-n[0],B.y=i[1]-n[1],T.x=a[0]-n[0],T.y=a[1]-n[1];f=x-H(B,T)/2}const y=U(f),d=u,p=[Math.cos(y)+d[0],Math.sin(y)+d[1]],[v,g]=Y(n,a,i);let _=D(v[0],v[1],d,p),m=D(g[0],g[1],d,p);if(!_||!m){const t=e.length,n=e[t-2],i=e[t-1];if(!n||!i)continue;_=[n[0],n[1]],m=[i[0],i[1]]}_[2]=u[2]||0,m[2]=u[2]||0,e.push(_,m),X(_,n,a)?(r.push(_),s.push(m)):(r.push(m),s.push(_)),h++}return{offsetPoints:e,leftPoints:r,rightPoints:s,line:t}}(t,n);return i.line=t,function(t,n){const i=n.bottomStickGround,e=n.depth,r=t.depths;let s=e,o=e;r&&(s=r[0],o=r[1]);const{leftPoints:h,rightPoints:a}=t,u=t.line,c=n.pathUV;if(c){!function(t){let n=0;for(let i=0,e=t.length;i<e;i++){const e=t[i],r=t[i+1];if(0===i&&(e.distance=0),e&&r){const[t,i,s]=e,[o,h,a]=r,u=t-o,c=i-h,l=(s||0)-(a||0);n+=Math.sqrt(u*u+c*c+l*l),r.distance=n}}}(u);for(let t=0,n=u.length;t<n;t++)h[t].distance=a[t].distance=u[t].distance}let l=0,f=h.length;const x=[],y=[],d=[];for(;l<f;){const t=3*l,[n,e,r]=h[l];x[t]=n,x[t+1]=e,x[t+2]=s+r;const[y,p,v]=a[l],g=3*f+t;x[g]=y,x[g+1]=p,x[g+2]=o+v;const _=2*f*3+t;x[_]=n,x[_+1]=e,x[_+2]=r,i&&(x[_+2]=0);const m=2*f*3+3*f+t;if(x[m]=y,x[m+1]=p,x[m+2]=v,i&&(x[m+2]=0),c){const t=u[l].distance,n=2*l;d[n]=t,d[n+1]=1;const i=2*f+n;d[i]=t,d[i+1]=0;const e=2*f*2+n;d[e]=t,d[e+1]=1;const r=2*f*2+2*f+n;d[r]=t,d[r+1]=0}l++}if(!c){l=0,f=x.length;let t=d.length-1;for(;l<f;){const n=x[l],i=x[l+1];d[++t]=n,d[++t]=i,l+=3}}l=0,f=h.length;let p=y.length-1;for(;l<f-1;){const t=l,n=l+1,i=t+f,e=n+f;y[++p]=t,y[++p]=i,y[++p]=n,y[++p]=i,y[++p]=e,y[++p]=n;const r=l+2*f,s=r+1,o=r+f,h=s+f;y[++p]=r,y[++p]=o,y[++p]=s,y[++p]=o,y[++p]=h,y[++p]=s,l++}if(t.indices=y,t.points=x,t.uv=d,r)for(f=h.length,l=0;l<f;)h[l].depth=s,a[l].depth=o,l++}(i,n),function(t,n){const{points:i,indices:e,leftPoints:r,rightPoints:s,uv:o}=t,h=n.depth,a=n.bottomStickGround,u=[r,s],c=t.depths,l=n.pathUV,f=n.lineWidth;let x=i.length-1,y=e.length-1,d=o.length-1;function p(t,n){const r=i.length/3,s=c?t.depth:h,u=c?n.depth:h;i[++x]=t[0],i[++x]=t[1],i[++x]=s+t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=u+n[2],i[++x]=t[0],i[++x]=t[1],i[++x]=a?0:t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=a?0:n[2];const p=r+2,v=r+3,g=r,_=r+1;e[++y]=p,e[++y]=g,e[++y]=v,e[++y]=g,e[++y]=_,e[++y]=v,l?(o[++d]=t.distance,o[++d]=s/f,o[++d]=n.distance,o[++d]=u/f,o[++d]=t.distance,o[++d]=0,o[++d]=n.distance,o[++d]=0):N(o,i,p,v,g,_)}for(let t=0,n=u.length;t<n;t++){let n=u[t];t>0&&(n=n.map((t=>t)),n=n.reverse());let i=0;const e=n.length-1;for(;i<e;){p(n[i],n[i+1]),i++}}const v=r.length,g=[s[0],r[0],r[v-1],s[v-1]];for(let t=0;t<g.length;t+=2){p(g[t],g[t+1])}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),e=I(i);return e.lines=t,e}const B={x:0,y:0},T={x:0,y:0};const H=({x:t,y:n},{x:i,y:e})=>{const r=t*i+n*e,s=t*e-n*i;return(Math.atan2(s,r)/Math.PI*180+360)%360};function X(t,n,i){const[e,r]=n,[s,o]=i,[h,a]=t;return(r-o)*h+(s-e)*a+e*o-s*r>0}function Y(t,n,i){const e=n[1]-t[1],r=n[0]-t[0],s=Math.atan2(e,r),o=s+Math.PI/2;let h=Math.cos(o)*i,a=Math.sin(o)*i;const u=[t[0]+h,t[1]+a],c=[n[0]+h,n[1]+a],l=s-Math.PI/2;h=Math.cos(l)*i,a=Math.sin(l)*i;return[[u,c],[[t[0]+h,t[1]+a],[n[0]+h,n[1]+a]]]}function D(t,n,i,e){const r=n[0]-t[0],s=n[1]-t[1],o=e[0]-i[0],h=e[1]-i[1];if(0===r&&0===o)return null;if(0===s&&0===h)return null;const a=s/r,u=h/o,c=t[1]-a*t[0],l=i[1]-u*i[0];let f,x;return 0===r?(f=t[0],x=u*f+l):0===o?(f=i[0],x=a*f+c):0===s?(x=t[1],f=(x-l)/u):0===h?(x=i[1],f=(x-c)/a):(f=(l-c)/(a-u),x=a*f+c),[f,x]}function G(t,n){n=Object.assign({},{radius:1,height:2,radialSegments:6},n);const i=Math.round(Math.max(4,n.radialSegments));let{radius:e,height:r}=n;e=e,r=r;const s=360/i/360*Math.PI*2,o=i+1,h=new Float32Array(3*o*2),[a,u]=t;let c=0,l=0;const f=3*o,x=2*o,y=[],d=[];let p=y.length-1;for(let t=-1;t<i;t++){const n=s*t,i=Math.cos(n)*e+a,o=Math.sin(n)*e+u;h[c]=i,h[c+1]=o,h[c+2]=0,h[c+f]=i,h[c+1+f]=o,h[c+2+f]=r;let v=0,g=0;v=.5+i/e/2,g=.5+o/e/2,d[l]=v,d[l+1]=g,d[l+x]=v,d[l+1+x]=g,c+=3,l+=2,t>1&&(y[++p]=0,y[++p]=t-1,y[++p]=t)}c-=3,h[c]=h[0],h[c+1]=h[1],h[c+2]=h[2];const v=h.length;h[v-3]=h[0],h[v-2]=h[1],h[v-1]=r;const g=y.length;p=y.length-1;for(let t=0;t<g;t++){const n=y[t];y[++p]=n+o}const _=new Float32Array(2*(3*o*2-6));let m=-1;c=2*o,l=0,p=y.length-1;let z=d.length-1;for(let t=0,n=h.length/2;t<n-3;t+=3){const n=h[t],i=h[t+1],s=h[t+3],a=h[t+4];_[++m]=n,_[++m]=i,_[++m]=r,_[++m]=s,_[++m]=a,_[++m]=r,_[++m]=n,_[++m]=i,_[++m]=0,_[++m]=s,_[++m]=a,_[++m]=0;const u=c+2,f=c+3,x=c,v=c+1;y[++p]=x,y[++p]=u,y[++p]=v,y[++p]=u,y[++p]=f,y[++p]=v,c+=4;const g=l/o,w=(l+1)/o;d[++z]=g,d[++z]=r/e/2,d[++z]=w,d[++z]=r/e/2,d[++z]=g,d[++z]=0,d[++z]=w,d[++z]=0,l++}const w=new Float32Array(h.length+_.length);w.set(h,0),w.set(_,h.length);const M=E(y,w);return{points:h,indices:new Uint32Array(y),position:w,normal:M,uv:new Float32Array(d)}}var J=function(){function t(){this.pos=new V,this.dir=new V,this.right=new V,this.up=new V,this.dist=0,this.widthScale=1,this.sharp=!1}var n=t.prototype;return n.lerpPathPoints=function(t,n,i){this.pos.lerpVectors(t.pos,n.pos,i),this.dir.lerpVectors(t.dir,n.dir,i),this.up.lerpVectors(t.up,n.up,i),this.right.lerpVectors(t.right,n.right,i),this.dist=(n.dist-t.dist)*i+t.dist,this.widthScale=(n.widthScale-t.widthScale)*i+t.widthScale},n.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),K=function(){function t(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d)}var n=t.prototype;return n.set=function(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){var p=this.elements;return p[0]=t,p[4]=n,p[8]=i,p[12]=e,p[1]=r,p[5]=s,p[9]=o,p[13]=h,p[2]=a,p[6]=u,p[10]=c,p[14]=l,p[3]=f,p[7]=x,p[11]=y,p[15]=d,this},n.multiply=function(t){return this.multiplyMatrices(this,t)},n.makeRotationAxis=function(t,n){var i=Math.cos(n),e=Math.sin(n),r=1-i,s=t.x,o=t.y,h=t.z,a=r*s,u=r*o;return this.set(a*s+i,a*o-e*h,a*h+e*o,0,a*o+e*h,u*o+i,u*h-e*s,0,a*h-e*o,u*h+e*s,r*h*h+i,0,0,0,0,1),this},n.equals=function(t){for(var n=this.elements,i=t.elements,e=0;e<16;e++)if(n[e]!==i[e])return!1;return!0},t}();function $(t,n,i,e){return function(t,n){var i=1-t;return i*i*n}(t,n)+function(t,n){return 2*(1-t)*t*n}(t,i)+function(t,n){return t*t*n}(t,e)}var tt=function(t){var n,e;function r(n,i,e){var r;return void 0===n&&(n=new V),void 0===i&&(i=new V),void 0===e&&(e=new V),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=i,r.v2=e,r}return e=t,(n=r).prototype=Object.create(e.prototype),n.prototype.constructor=n,i(n,e),r.prototype.getPoint=function(t,n){void 0===n&&(n=new V);var i=n,e=this.v0,r=this.v1,s=this.v2;return i.set($(t,e.x,r.x,s.x),$(t,e.y,r.y,s.y),$(t,e.z,r.z,s.z)),i},r}(function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var n=t.prototype;return n.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},n.getPointAt=function(t,n){var i=this.getUtoTmapping(t);return this.getPoint(i,n)},n.getPoints=function(t){void 0===t&&(t=5);for(var n=[],i=0;i<=t;i++)n.push(this.getPoint(i/t));return n},n.getLength=function(){var t=this.getLengths();return t[t.length-1]},n.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var n,i=[],e=this.getPoint(0),r=0;i.push(0);for(var s=1;s<=t;s++)r+=(n=this.getPoint(s/t)).distanceTo(e),i.push(r),e=n;return this.cacheArcLengths=i,i},n.getUtoTmapping=function(t,n){var i,e=this.getLengths(),r=0,s=e.length;i=n||t*e[s-1];for(var o,h=0,a=s-1;h<=a;)if((o=e[r=Math.floor(h+(a-h)/2)]-i)<0)h=r+1;else{if(!(o>0)){a=r;break}a=r-1}if(e[r=a]===i)return r/(s-1);var u=e[r];return(r+(i-u)/(e[r+1]-u))/(s-1)},t}()),nt=new V,it=new V,et=new V,rt=new K,st=new tt;var ot=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,i,e,r){if(void 0===n&&(n=.1),void 0===i&&(i=10),void 0===e&&(e=null),void 0===r&&(r=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);r&&!t[0].equals(t[t.length-1])&&t.push((new V).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],e);else if(s===o-1)if(r){this._corner(t[s],t[1],n,i,e);var h=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=h}else this._end(t[s]);else this._corner(t[s],t[s+1],n,i,e)},n.distance=function(){return this.count>0?this.array[this.count-1].dist:0},n._getByIndex=function(t){return this.array[t]||(this.array[t]=new J),this.array[t]},n._start=function(t,n,i){this.count=0;var e=this._getByIndex(this.count);if(e.pos.copy(t),e.dir.subVectors(n,t),i)e.up.copy(i);else{var r=Number.MAX_VALUE,s=Math.abs(e.dir.x),o=Math.abs(e.dir.y),h=Math.abs(e.dir.z);s<r&&(r=s,e.up.set(1,0,0)),o<r&&(r=o,e.up.set(0,1,0)),h<r&&e.up.set(0,0,1)}e.right.crossVectors(e.dir,e.up).normalize(),e.up.crossVectors(e.right,e.dir).normalize(),e.dist=0,e.widthScale=1,e.sharp=!1,e.dir.normalize(),this.count++},n._end=function(t){var n=this.array[this.count-1],i=this._getByIndex(this.count);i.pos.copy(t),i.dir.subVectors(t,n.pos);var e=i.dir.length();i.dir.normalize(),i.up.copy(n.up);var r=nt.crossVectors(n.dir,i.dir);if(r.length()>Number.EPSILON){r.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(i.dir),-1),1));i.up.applyMatrix4(rt.makeRotationAxis(r,s))}i.right.crossVectors(i.dir,i.up).normalize(),i.dist=n.dist+e,i.widthScale=1,i.sharp=!1,this.count++},n._corner=function(t,n,i,e,r){if(i>0&&e>0){for(var s=function(t,n,i,e,r,s){var o=nt.subVectors(n,t),h=it.subVectors(i,n),a=o.length(),u=h.length();o.normalize(),h.normalize();var c=Math.min(.999999*(r?a/2:a),e);s.v0.copy(n).sub(o.multiplyScalar(c)),s.v1.copy(n);var l=Math.min(u/2*.999999,e);return s.v2.copy(n).add(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,i,this.count-1==0,st),o=s.getPoints(e),h=0;h<e;h++)this._sharpCorner(o[h],o[h+1],r,0===h?1:0);o[e].equals(n)||this._sharpCorner(o[e],n,r,2)}else this._sharpCorner(t,n,r,0,!0)},n._sharpCorner=function(t,n,i,e,r){void 0===e&&(e=0),void 0===r&&(r=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),h=nt.subVectors(t,s.pos),a=it.subVectors(n,t),u=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===e?o.dir.copy(h):2===e?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),i)1===o.dir.dot(i)?o.right.crossVectors(a,i).normalize():o.right.crossVectors(o.dir,i).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var c=et.crossVectors(s.dir,o.dir);if(c.length()>Number.EPSILON){c.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(rt.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;var f=h.dot(a);o.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,o.sharp=Math.abs(f-1)>.05&&r,this.count++},t}();const ht=new V(0,0,1),at=new V,ut=new V,ct=new V,lt=new V,ft=new V,xt=new V;function yt(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);const i=t.map((t=>{const i=function(t){const n=[];for(let i=0,e=t.length;i<e;i++){const e=t[i],[r,s,o]=e,h=new V(r,s,o||0);n[i]=h}return n}(t),e=new ot;e.set(i,n.cornerRadius,n.cornerSplit,ht);const r=function(t,n){const i=n.lineWidth||.1,e=1,r=i/2,s=i,o=t.distance(),h=e*o;let a=0;const u=[],c=[],l=[],f=[];let x=0;if(0===o)return{position:u,normal:c,uv:l,indices:f,count:a};const y=r/s;let d,p=u.length-1,v=c.length-1,g=l.length-1,_=f.length-1;function m(t){const n=0===u.length,i=t.sharp&&!n,e=t.dist/s,o=t.dir,h=t.up,d=t.right;if(at.copy(d).multiplyScalar(r*t.widthScale),ut.copy(d).multiplyScalar(-r*t.widthScale),at.add(t.pos),ut.add(t.pos),i){ct.fromArray(u,u.length-6).sub(ut),lt.fromArray(u,u.length-3).sub(at);const t=ct.length()-lt.length();let n,i;t>0?(n=ct,i=ut):(n=lt,i=at),ft.copy(n).setLength(Math.abs(t)).add(i);let r=xt.copy(i).sub(ft).normalize().dot(o)*xt.copy(i).sub(ft).length()*2;xt.copy(o).setLength(r).add(ft),t>0?(u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,x+=6,f[++_]=x-6,f[++_]=x-8,f[++_]=x-7,f[++_]=x-6,f[++_]=x-7,f[++_]=x-5,f[++_]=x-4,f[++_]=x-6,f[++_]=x-5,f[++_]=x-2,f[++_]=x-4,f[++_]=x-1,a+=12):(u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.z,x+=6,f[++_]=x-6,f[++_]=x-8,f[++_]=x-7,f[++_]=x-6,f[++_]=x-7,f[++_]=x-5,f[++_]=x-6,f[++_]=x-5,f[++_]=x-3,f[++_]=x-2,f[++_]=x-3,f[++_]=x-1,a+=12);for(let t=0;t<6;t++)c[++v]=h.x,c[++v]=h.y,c[++v]=h.z;l[++g]=e-y,l[++g]=0,l[++g]=e-y,l[++g]=1,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,l[++g]=e+y,l[++g]=0,l[++g]=e+y,l[++g]=1}else u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,x+=2,n||(f[++_]=x-2,f[++_]=x-4,f[++_]=x-3,f[++_]=x-2,f[++_]=x-3,f[++_]=x-1,a+=6)}if(h>0)for(let n=0;n<t.count;n++){const i=t.array[n];if(i.dist>h){const e=t.array[n-1];d=new J;const r=(h-e.dist)/(i.dist-e.dist);d.lerpPathPoints(e,i,r),m(d);break}m(i)}else d=t.array[0];return{position:u,normal:c,uv:l,indices:f,count:a}}(e,n);return{position:new Float32Array(r.position),indices:new Uint32Array(r.indices),uv:new Float32Array(r.uv),normal:new Float32Array(r.normal),line:t,count:r.count}})),e=I(i);return e.lines=t,e}new V(0,0,1),new V;var dt={x:0,y:0},pt={x:0,y:0};function vt(t,n,i,e){for(var r=t.length,s=0;s<r;s++){var o=t[s].data;n=t[s].center||n;for(var h=0,a=o.length;h<a;h++)for(var u=o[h],c=0,l=u.length;c<l;c++)t[s].data[h][c]=gt(u[c],n,i,e)}}function gt(t,n,i,e,r){for(var s,o=[],h=r?3:2,a=0,u=(s=i?new Float64Array(t):new Float32Array(t)).length;a<u;a+=h){var c=s[a],l=s[a+1],f=s[a+2];if(n&&i&&e){dt.x=c,dt.y=l;var x=kt(dt,pt);dt.x=x.x,dt.y=x.y,c=(x=Vt(e,dt,i,pt)).x,l=x.y,c-=n[0],l-=n[1]}r?o.push([c,l,f]):o.push([c,l])}return o}function _t(t,n){void 0===n&&(n=1);for(var i=t.length,e=[],r=[],s=0,o=0;o<i;o++){var h=void 0;1===n?h=mt(t[o]):2===n?h=zt(t[o]):3===n&&(h=wt(t[o]));var a=t[o].bottomHeight||0,u=h.position;r.push(h);var c=u.length/3;e[o]={position:{middleZ:a+(t[o].height||0)/2,count:c,start:s,end:s+3*c},hide:!1},s+=3*c}var l=bt(r),f=l.position,x=l.normal,y=l.uv,d=l.indices;return{position:f.buffer,normal:x.buffer,uv:y.buffer,indices:d.buffer,geometriesAttributes:e}}function mt(t){var n=t.data,i=t.height,e=t.bottomHeight,r=j(n,{depth:i,top:t.top}),s=r.position,o=r.normal,h=r.uv,a=r.indices;return At(s,e),{position:s,normal:o,uv:h,indices:a}}function zt(t){var n=t.data,i=t.height,e=t.width,r=t.bottomHeight,s=W(n,{lineWidth:e,depth:i,pathUV:t.pathUV}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function wt(t){var n=t.data,i=t.cornerRadius,e=t.width,r=t.bottomHeight,s=yt(n,{lineWidth:e,cornerRadius:i}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function Mt(t,n){for(var i=new Float32Array(n),e=0,r=0;r<t.length;++r)i.set(t[r],e),e+=t[r].length;return i}function bt(t){for(var n={},i={},e=0;e<t.length;++e){var r=t[e];for(var s in r)void 0===n[s]&&(n[s]=[],i[s]=0),n[s].push(r[s]),i[s]+=r[s].length}var o={},h=0,a=[];for(var u in n)if("indices"===u)for(var c=n[u],l=0,f=c.length;l<f;l++){for(var x=c[l],y=0,d=x.length;y<d;y++)a.push(x[y]+h);h+=n.position[l].length/3}else{var p=Mt(n[u],i[u]);if(!p)return null;o[u]=p}return o.indices=new Uint32Array(a),o}function At(t,n){if(void 0!==n&&"number"==typeof n&&0!==n)for(var i=0,e=t.length;i<e;i+=3)t[i+2]+=n}function Pt(t){for(var n=[],i=0,e=t.length;i<e;i+=7){var r=t[i],s=t[i+1],o=t[i+2],h=t[i+3],a=t[i+4],u=t[i+5];n.push({radialSegments:o,radius:h,height:a,altitude:u,center:[r,s]})}for(var c=n.length,l=[],f=[],x=0,y=0;y<c;y++){var d=G(n[y].center||[0,0],n[y]),p=d.position;if(n[y].altitude)for(var v=n[y].altitude,g=0,_=p.length;g<_;g+=3)d[g+2]+=v;f.push(d);var m=p.length/3;l[y]={position:{middleZ:n[y].height/2,count:m,start:x,end:x+3*m},hide:!1},x+=3*m}var z=bt(f),w=z.position,M=z.normal,b=z.uv,A=z.indices;return{position:w.buffer,normal:M.buffer,uv:b.buffer,indices:A.buffer,geometriesAttributes:l}}var St=Math.PI/180,Ct=6378137*Math.PI/180;function kt(t,n){var i,e=85.0511287798,r=t.x,s=Math.max(Math.min(e,t.y),-e);i=0===s?0:Math.log(Math.tan((90+s)*St/2))/St;var o=r*Ct,h=i*Ct;return n?(n.x=o,n.y=h,n):{x:o,y:h}}function Vt(t,n,i,e){var r=t[0]*(n.x-t[2])/i,s=-t[1]*(n.y-t[3])/i;return e?(e.x=r,e.y=s,e):{x:r,y:s}}function Zt(t){void 0===t&&(t=[]);for(var n=t.length,i=new Float32Array(3*n),e=0;e<n;e++){var r=t[e],s=3*e;i[s]=r[0],i[s+1]=r[1],i[s+2]=r[2]||0}return i}function Ft(t){for(var n=new Float32Array(2*t.length-6),i=0,e=0,r=t.length/3;e<r;e++){var s=t[3*e],o=t[3*e+1],h=t[3*e+2];if(e>0&&e<r-1){var a=3*i;n[a]=s,n[a+1]=o,n[a+2]=h,i++}var u=3*i;n[u]=s,n[u+1]=o,n[u+2]=h,i++}return n}function Lt(t){var n=0,i=t.length;if(1===i)return t[0];for(var e=0;e<i;e++)n+=t[e].length;for(var r=new Float32Array(n),s=0,o=0;o<i;o++)r.set(t[o],s),s+=t[o].length;return r}t.initialize=function(){},t.onmessage=function(t,n){var i=t.data,e=i.type,r=i.datas,s=i.glRes,o=i.matrix,h=i.center;if("ExtrudePolygons"===e){vt(r,h,s,o);var a=_t(r);n(null,a,[a.position,a.normal,a.uv,a.indices])}else if("ExtrudeLines"===e||"Paths"===e){for(var u=0,c=r.length;u<c;u++)for(var l=0,f=r[u].data.length;l<f;l++)r[u].data[l]=gt(r[u].data[l],r[u].center||h,s,o,!0);var x=_t(r,"ExtrudeLines"===e?2:3);n(null,x,[x.position,x.normal,x.uv,x.indices])}else if("ExtrudePolygon"===e){var y=[],d=[];r.forEach((function(t){var n=[t];vt(n,h,s,o);var i=_t(n),e=i.position,r=i.normal,a=i.uv,u=i.indices;y.push({id:t.id,position:e,normal:r,uv:a,indices:u}),d.push(e,r,a,u)})),n(null,y,d)}else if("Line"===e||"FatLine"===e){for(var p=[],v=[],g=0,_=r.length;g<_;g++){for(var m=[],z=0,w=r[g].data.length;z<w;z++){r[g].data[z]=gt(r[g].data[z],r[g].center||h,s,o,!0);var M=Zt(r[g].data[z]);m.push(Ft(M))}var b=Lt(m);At(b,r[g].bottomHeight),p.push({id:r[g].id,position:b.buffer}),v.push(b.buffer)}n(null,p,v)}else if("Lines"===e||"FatLines"===e){for(var A=0,P=[],S=[],C=0,k=[],V=0,Z=r.length;V<Z;V++){for(var F=0,L=0,q=r[V].data.length;L<q;L++){r[V].data[L]=gt(r[V].data[L],r[V].center||h,s,o,!0);var E=Zt(r[V].data[L]);At(E,r[V].bottomHeight),F+=E.length/3*2-2,k.push(Ft(E))}var I=F;P[V]=[A,A+I],A+=I,S[V]={position:{count:F,start:C,end:C+3*F},hide:!1},"FatLines"===e&&(S[V].instanceStart={count:F,start:C,end:C+3*F},S[V].instanceEnd={count:F,start:C,end:C+3*F}),C+=3*F}var O=Lt(k);n(null,{id:r.id,position:O.buffer,geometriesAttributes:S,faceMap:P},[O.buffer])}else if("ExtrudeLine"===e||"Path"===e){for(var U=0,N=r.length;U<N;U++)for(var j=0,Q=r[U].data.length;j<Q;j++)r[U].data[j]=gt(r[U].data[j],r[U].center||h,s,o,!0);var R=[],W=[];r.forEach((function(t){var n=_t([t],"ExtrudeLine"===e?2:3),i=n.position,r=n.normal,s=n.uv,o=n.indices;R.push({id:t.id,position:i,normal:r,uv:s,indices:o}),W.push(i,r,s,o)})),n(null,R,W)}else if("Bar"===e){for(var B=[],T=[],H=(r=new Float32Array(r)).length/7,X=0;X<H;){var Y=r.slice(7*X,7*(X+1)),D=Pt(Y),G=D.position,J=D.normal,K=D.uv,$=D.indices;B.push({id:parseInt(Y[6]),position:G,normal:J,uv:K,indices:$}),T.push(G,J,K,$),X++}n(null,B,T)}else if("Bars"===e){var tt=Pt(r=new Float32Array(r));n(null,tt,[tt.position,tt.normal,tt.uv,tt.indices])}else console.error("No processing logic found for type:"+e)},Object.defineProperty(t,"__esModule",{value:!0})})'),t.registerWorkerAdapter("__maptalks.three.fetchdata__",(function(t){const e=[],n=[];function r(t){t.abort?(n.splice(n.indexOf(t),1),e.length&&(n.push(e[0]),e.splice(0,1),i(n[n.length-1]))):n.length<5?(n.push(t),i(t)):e.push(t)}function i(t){fetch(t.url).then((t=>t.text())).then((e=>{new Blob([e],{type:"application/json"}).arrayBuffer().then((e=>{t.postResponse(null,e,[e]),t.abort=!0,r(t)}))})).catch((e=>{console.error(e),t.abort=!0,r(t)}))}t.initialize=function(){},t.onmessage=function(t,e){r({url:t.data,postResponse:e,abort:!1})}})));var Cu=6371008.8,Su={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:Cu,metres:Cu,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:3440.069546436285,radians:1,yards:6967335.223679999},Mu={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Cu,yards:1.0936133},Bu={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Tu(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function ku(t,e,n){switch(t){case"Point":return Pu(e).geometry;case"LineString":return Ou(e).geometry;case"Polygon":return Ru(e).geometry;case"MultiPoint":return Qu(e).geometry;case"MultiLineString":return Uu(e).geometry;case"MultiPolygon":return Gu(e).geometry;default:throw new Error(t+" is invalid")}}function Pu(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Zu(t[0])||!Zu(t[1]))throw new Error("coordinates must contain numbers");return Tu({type:"Point",coordinates:t},e,n)}function Lu(t,e,n){return void 0===n&&(n={}),Fu(t.map((function(t){return Pu(t,e)})),n)}function Ru(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return Tu({type:"Polygon",coordinates:t},e,n)}function Du(t,e,n){return void 0===n&&(n={}),Fu(t.map((function(t){return Ru(t,e)})),n)}function Ou(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return Tu({type:"LineString",coordinates:t},e,n)}function Nu(t,e,n){return void 0===n&&(n={}),Fu(t.map((function(t){return Ou(t,e)})),n)}function Fu(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function Uu(t,e,n){return void 0===n&&(n={}),Tu({type:"MultiLineString",coordinates:t},e,n)}function Qu(t,e,n){return void 0===n&&(n={}),Tu({type:"MultiPoint",coordinates:t},e,n)}function Gu(t,e,n){return void 0===n&&(n={}),Tu({type:"MultiPolygon",coordinates:t},e,n)}function zu(t,e,n){return void 0===n&&(n={}),Tu({type:"GeometryCollection",geometries:t},e,n)}function ju(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function Vu(t,e){void 0===e&&(e="kilometers");var n=Su[e];if(!n)throw new Error(e+" units is invalid");return t*n}function qu(t,e){void 0===e&&(e="kilometers");var n=Su[e];if(!n)throw new Error(e+" units is invalid");return t/n}function Hu(t,e){return Yu(qu(t,e))}function Wu(t){var e=t%360;return e<0&&(e+=360),e}function Yu(t){return 180*(t%(2*Math.PI))/Math.PI}function Xu(t){return t%360*Math.PI/180}function Ju(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Vu(qu(t,e),n)}function Ku(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=Bu[e];if(!r)throw new Error("invalid original units");var i=Bu[n];if(!i)throw new Error("invalid final units");return t/r*i}function Zu(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function $u(t){return!!t&&t.constructor===Object}function tl(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!Zu(t))throw new Error("bbox must only contain numbers")}))}function el(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var nl=Object.freeze({__proto__:null,earthRadius:Cu,factors:Su,unitsFactors:Mu,areaFactors:Bu,feature:Tu,geometry:ku,point:Pu,points:Lu,polygon:Ru,polygons:Du,lineString:Ou,lineStrings:Nu,featureCollection:Fu,multiLineString:Uu,multiPoint:Qu,multiPolygon:Gu,geometryCollection:zu,round:ju,radiansToLength:Vu,lengthToRadians:qu,lengthToDegrees:Hu,bearingToAzimuth:Wu,radiansToDegrees:Yu,degreesToRadians:Xu,convertLength:Ju,convertArea:Ku,isNumber:Zu,isObject:$u,validateBBox:tl,validateId:el});function rl(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,h,c=0,f=0,p=t.type,d="FeatureCollection"===p,g="Feature"===p,y=d?t.features.length:1,v=0;v<y;v++){a=(h=!!(l=d?t.features[v].geometry:g?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var m=0;m<a;m++){var A=0,_=0;if(null!==(s=h?l.geometries[m]:l)){u=s.coordinates;var x=s.type;switch(c=!n||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===e(u,f,v,A,_))return!1;f++,A++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(!1===e(u[r],f,v,A,_))return!1;f++,"MultiPoint"===x&&A++}"LineString"===x&&A++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-c;i++){if(!1===e(u[r][i],f,v,A,_))return!1;f++}"MultiLineString"===x&&A++,"Polygon"===x&&_++}"Polygon"===x&&A++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(_=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-c;o++){if(!1===e(u[r][i][o],f,v,A,_))return!1;f++}_++}A++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===rl(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function il(t,e,n,r){var i=n;return rl(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i}function ol(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function sl(t,e,n){var r=n;return ol(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function al(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function ul(t,e,n){var r=n;return al(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function ll(t){var e=[];return rl(t,(function(t){e.push(t)})),e}function hl(t,e){var n,r,i,o,s,a,u,l,h,c,f=0,p="FeatureCollection"===t.type,d="Feature"===t.type,g=p?t.features.length:1;for(n=0;n<g;n++){for(a=p?t.features[n].geometry:d?t.geometry:t,l=p?t.features[n].properties:d?t.properties:{},h=p?t.features[n].bbox:d?t.bbox:void 0,c=p?t.features[n].id:d?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function cl(t,e,n){var r=n;return hl(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r}function fl(t,e){hl(t,(function(t,n,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(Tu(t,r,{bbox:i,id:o}),n,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(Tu({type:s,coordinates:l},r),n,u))return!1}}))}function pl(t,e,n){var r=n;return fl(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function dl(t,e){fl(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==rl(t,(function(o,h,c,f,p){if(void 0===s||n>a||f>u||p>l)return s=o,a=n,u=f,l=p,void(i=0);var d=Ou([s,o],t.properties);if(!1===e(d,n,r,p,i))return!1;i++,s=o}))&&void 0}}}))}function gl(t,e,n){var r=n,i=!1;return dl(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}function yl(t,e){if(!t)throw new Error("geojson is required");fl(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(Ou(o[s],t.properties),n,r,s))return!1}}}))}function vl(t,e,n){var r=n;return yl(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r}function ml(t,e){if(!$u(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),Ou([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),Ou([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),Ou([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),Ou([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function Al(t,e){if(!$u(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return Pu(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Pu(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Pu(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Pu(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Pu(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),Pu(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var _l=Object.freeze({__proto__:null,coordAll:ll,coordEach:rl,coordReduce:il,featureEach:al,featureReduce:ul,findPoint:Al,findSegment:ml,flattenEach:fl,flattenReduce:pl,geomEach:hl,geomReduce:cl,lineEach:yl,lineReduce:vl,propEach:ol,propReduce:sl,segmentEach:dl,segmentReduce:gl});function xl(t){var e=[1/0,1/0,-1/0,-1/0];return rl(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function wl(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function bl(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function El(t){if(t.length>1&&Zu(t[0])&&Zu(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return El(t[0]);throw new Error("coordinates must only contain numbers")}function Il(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function Cl(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function Sl(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r<i.length;r++){var o=i[r];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}function Ml(t){return"Feature"===t.type?t.geometry:t}function Bl(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}xl.default=xl;var Tl=Object.freeze({__proto__:null,getCoord:wl,getCoords:bl,containsNumber:El,geojsonType:Il,featureOf:Cl,collectionOf:Sl,getGeom:Ml,getType:Bl}),kl=Object.getOwnPropertySymbols,Pl=Object.prototype.hasOwnProperty,Ll=Object.prototype.propertyIsEnumerable;
|
|
18
18
|
/*
|
|
19
19
|
object-assign
|
|
20
20
|
(c) Sindre Sorhus
|
|
@@ -186,7 +186,7 @@ Original licenses apply:
|
|
|
186
186
|
Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver)
|
|
187
187
|
for use in Troika text rendering.
|
|
188
188
|
Original MIT license applies
|
|
189
|
-
*/const Az=dz({name:"FontResolver",dependencies:[function(t,e){const n=Object.create(null),r=Object.create(null);function i(e,i){let o=n[e];o?i(o):r[e]?r[e].push(i):(r[e]=[i],function(e,n){const r=t=>{console.error(`Failure loading font ${e}`,t)};try{const i=new XMLHttpRequest;i.open("get",e,!0),i.responseType="arraybuffer",i.onload=function(){if(i.status>=400)r(new Error(i.statusText));else if(i.status>0)try{const r=t(i.response);r.src=e,n(r)}catch(t){r(t)}},i.onerror=r,i.send()}catch(t){r(t)}}(e,(t=>{t.src=e,n[e]=t,r[e].forEach((e=>e(t))),delete r[e]})))}return function(t,r,{lang:o,fonts:s=[],style:a="normal",weight:u="normal",unicodeFontsURL:l}={}){const h=new Uint8Array(t.length),c=[];t.length||g();const f=new Map,p=[];if("italic"!==a&&(a="normal"),"number"!=typeof u&&(u="bold"===u?700:400),s&&!Array.isArray(s)&&(s=[s]),(s=s.slice().filter((t=>!t.lang||t.lang.test(o))).reverse()).length){const e=1,r=2;let o=0;!function a(u=0){for(let l=u,d=t.length;l<d;l++){const u=t.codePointAt(l);if(o===e&&c[h[l-1]].supportsCodePoint(u)||l>0&&/\s/.test(t[l]))h[l]=h[l-1],o===r&&(p[p.length-1][1]=l);else for(let t=h[l],d=s.length;t<=d;t++)if(t===d){(o===r?p[p.length-1]:p[p.length]=[l,l])[1]=l,o=r}else{h[l]=t;const{src:r,unicodeRange:p}=s[t];if(!p||y(u,p)){const t=n[r];if(!t)return void i(r,(()=>{a(l)}));if(t.supportsCodePoint(u)){let n=f.get(t);"number"!=typeof n&&(n=c.length,c.push(t),f.set(t,n)),h[l]=n,o=e;break}}}u>65535&&l+1<d&&(h[l+1]=h[l],l++,o===r&&(p[p.length-1][1]=l))}d()}()}else p.push([0,t.length-1]),d();function d(){if(p.length){const n=p.map((e=>t.substring(e[0],e[1]+1))).join("\n");e.getFontsForString(n,{lang:o||void 0,style:a,weight:u,dataUrl:l}).then((({fontUrls:t,chars:e})=>{const n=c.length;let r=0;p.forEach((t=>{for(let i=0,o=t[1]-t[0];i<=o;i++)h[t[0]+i]=e[r++]+n;r++}));let o=0;t.forEach(((e,r)=>{i(e,(e=>{c[r+n]=e,++o===t.length&&g()}))}))}))}else g()}function g(){r({chars:h,fonts:c})}function y(t,e){for(let n=0;n<e.length;n++){const[r,i=r]=e[n];if(r<=t&&t<=i)return!0}return!1}}},mz,function(){return function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(t){var e=t>>5;this.buckets.set(e,(this.buckets.get(e)||0)|1<<(31&t))},e.prototype.has=function(t){var e=this.buckets.get(t>>5);return void 0!==e&&!!(e&1<<(31&t))},e.prototype.serialize=function(){var t=[];return this.buckets.forEach((function(e,n){t.push((+n).toString(36)+":"+e.toString(36))})),t.join(",")},e.prototype.deserialize=function(t){var e=this;this.buckets.clear(),t.split(",").forEach((function(t){var n=t.split(":");e.buckets.set(parseInt(n[0],36),parseInt(n[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function o(t){var e=function(t){return t&i}(t).toString(16),r=function(t){return(t&i)+n-1}(t).toString(16);return"codepoint-index/plane"+(t>>16)+"/"+e+"-"+r+".json"}function s(t,e){var n=t&r,i=e.codePointAt(n/6|0);return!!((i=(i||48)-48)&1<<n%6)}function a(t,e){!function(t,e){var n;(n=t,n.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(t){return t.split("-").map((function(t){return parseInt(t.trim(),16)}))}))).forEach((function(t){var n=t[0],r=t[1];void 0===r&&(r=n),e(n,r)}))}(t,(function(t,n){for(var r=t;r<=n;r++)e(r)}))}var u={},l={},h=new WeakMap,c="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function f(t){var n=h.get(t);return n||(n=new e,a(t.ranges,(function(t){return n.add(t)})),h.set(t,n)),n}var p,d=new Map;function g(t,e,n){return t[e]?e:t[n]?n:function(t){for(var e in t)return e}(t)}function y(t,e){var n=e;if(!t.includes(n)){n=1/0;for(var r=0;r<t.length;r++)Math.abs(t[r]-e)<Math.abs(n-e)&&(n=t[r])}return n}function v(t){return p||(p=new Set,a("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(t){p.add(t)}))),p.has(t)}return t.CodePointSet=e,t.clearCache=function(){u={},l={}},t.getFontsForString=function(t,e){void 0===e&&(e={});var n,r=e.lang;void 0===r&&(r=/\p{Script=Hangul}/u.test(n=t)?"ko":/\p{Script=Hiragana}|\p{Script=Katakana}/u.test(n)?"ja":"en");var i=e.category;void 0===i&&(i="sans-serif");var a=e.style;void 0===a&&(a="normal");var h=e.weight;void 0===h&&(h=400);var p=(e.dataUrl||c).replace(/\/$/g,""),m=new Map,A=new Uint8Array(t.length),_={},x={},w=new Array(t.length),b=new Map,E=!1;function I(t){var e=d.get(t);return e||(e=fetch(p+"/"+t).then((function(t){if(!t.ok)throw new Error(t.statusText);return t.json().then((function(t){if(!Array.isArray(t)||1!==t[0])throw new Error("Incorrect schema version; need 1, got "+t[0]);return t[1]}))})).catch((function(e){if(p!==c)return E||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+p+'", trying default CDN. '+e.message),E=!0),p=c,d.delete(t),I(t);throw e})),d.set(t,e)),e}for(var C=function(e){var n=t.codePointAt(e),r=o(n);w[e]=r,u[r]||b.has(r)||b.set(r,I(r).then((function(t){u[r]=t}))),n>65535&&(e++,S=e)},S=0;S<t.length;S++)C(S);return Promise.all(b.values()).then((function(){b.clear();for(var e=function(e){var i=t.codePointAt(e),o=null,a=u[w[e]],h=void 0;for(var c in a){var f=x[c];if(void 0===f&&(f=x[c]=new RegExp(c).test(r||"en")),f){for(var p in h=c,a[c])if(s(i,a[c][p])){o=p;break}break}}if(!o)t:for(var d in a)if(d!==h)for(var g in a[d])if(s(i,a[d][g])){o=g;break t}o||(console.debug("No font coverage for U+"+i.toString(16)),o="latin"),w[e]=o,l[o]||b.has(o)||b.set(o,I("font-meta/"+o+".json").then((function(t){l[o]=t}))),i>65535&&(e++,n=e)},n=0;n<t.length;n++)e(n);return Promise.all(b.values())})).then((function(){for(var e,n=null,r=0;r<t.length;r++){var o=t.codePointAt(r);if(n&&(v(o)||f(n).has(o)))A[r]=A[r-1];else{n=l[w[r]];var s=_[n.id];if(!s){var u=n.typeforms,c=g(u,i,"sans-serif"),d=g(u[c],a,"normal"),x=y(null===(e=u[c])||void 0===e?void 0:e[d],h);s=_[n.id]=p+"/font-files/"+n.id+"/"+c+"."+d+"."+x+".woff"}var b=m.get(s);null==b&&(b=m.size,m.set(s,b)),A[r]=b}o>65535&&(r++,A[r]=A[r-1])}return{fontUrls:Array.from(m.keys()),chars:A}}))},Object.defineProperty(t,"__esModule",{value:!0}),t}({})}],init:(t,e,n)=>t(e,n())});const _z=()=>(self.performance||Date).now(),xz=vz();let wz;const bz=[];let Ez=0;function Iz(){const t=_z();for(;bz.length&&_z()-t<5;)bz.shift()();Ez=bz.length?setTimeout(Iz,0):0}const Cz=(...t)=>new Promise(((e,n)=>{bz.push((()=>{const r=_z();try{xz.webgl.generateIntoCanvas(...t),e({timing:_z()-r})}catch(t){n(t)}})),Ez||(Ez=setTimeout(Iz,0))})),Sz=4,Mz=2e3,Bz={};let Tz=0;function kz(t,e,n,r,i,o,s,a,u,l){const h="TroikaTextSDFGenerator_JS_"+Tz++%Sz;let c=Bz[h];return c||(c=Bz[h]={workerModule:dz({name:h,workerId:h,dependencies:[vz,_z],init(t,e){const n=t().javascript.generate;return function(...t){const r=e();return{textureData:n(...t),timing:e()-r}}},getTransferables:t=>[t.textureData.buffer]}),requests:0,idleTimer:null}),c.requests++,clearTimeout(c.idleTimer),c.workerModule(t,e,n,r,i,o).then((({textureData:n,timing:r})=>{const i=_z(),o=new Uint8Array(4*n.length);for(let t=0;t<n.length;t++)o[4*t+l]=n[t];return xz.webglUtils.renderImageData(s,o,a,u,t,e,1<<3-l),r+=_z()-i,0==--c.requests&&(c.idleTimer=setTimeout((()=>{!function(t){fz[t]&&fz[t].forEach((function(t){t()})),cz[t]&&(cz[t].terminate(),delete cz[t])}(h)}),Mz)),{timing:r}}))}const Pz=xz.webglUtils.resizeWebGLCanvasWithoutClearing,Lz={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},Rz=new c;function Dz(){return(self.performance||Date).now()}const Oz=Object.create(null);function Nz(t,e){t=function(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}({},t);const n=Dz(),{defaultFontURL:r}=Lz,i=[];if(r&&i.push({label:"default",src:Qz(r)}),t.font&&i.push({label:"user",src:Qz(t.font)}),t.font=i,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||Lz.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||Lz.unicodeFontsURL,null!=t.colorRanges){let e={};for(let n in t.colorRanges)if(t.colorRanges.hasOwnProperty(n)){let r=t.colorRanges[n];"number"!=typeof r&&(r=Rz.set(r).getHex()),e[n]=r}t.colorRanges=e}Object.freeze(t);const{textureWidth:o,sdfExponent:s}=Lz,{sdfGlyphSize:a}=t,u=o/a*4;let l=Oz[a];if(!l){const t=document.createElement("canvas");t.width=o,t.height=256*a/u,l=Oz[a]={glyphCount:0,sdfGlyphSize:a,sdfCanvas:t,sdfTexture:new ct(t,void 0,void 0,void 0,w,w),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,function(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",(e=>{console.log("Context Lost",e),e.preventDefault(),t.contextLost=!0})),e.addEventListener("webglcontextrestored",(e=>{console.log("Context Restored",e),t.contextLost=!1;const n=[];t.glyphsByFont.forEach((e=>{e.forEach((e=>{n.push(Fz(e,t,!0))}))})),Promise.all(n).then((()=>{Gz(t),t.sdfTexture.needsUpdate=!0}))}))}(l)}const{sdfTexture:h,sdfCanvas:c}=l;jz(t).then((r=>{const{glyphIds:i,glyphFontIndices:f,fontData:p,glyphPositions:d,fontSize:g,timings:y}=r,v=[],m=new Float32Array(4*i.length);let A=0,_=0;const x=Dz(),w=p.map((t=>{let e=l.glyphsByFont.get(t.src);return e||l.glyphsByFont.set(t.src,e=new Map),e}));i.forEach(((t,e)=>{const n=f[e],{src:o,unitsPerEm:s}=p[n];let u=w[n].get(t);if(!u){const{path:e,pathBounds:i}=r.glyphData[o][t],s=Math.max(i[2]-i[0],i[3]-i[1])/a*(Lz.sdfMargin*a+.5),h=l.glyphCount++,c=[i[0]-s,i[1]-s,i[2]+s,i[3]+s];w[n].set(t,u={path:e,atlasIndex:h,sdfViewBox:c}),v.push(u)}const{sdfViewBox:h}=u,c=d[_++],y=d[_++],x=g/s;m[A++]=c+h[0]*x,m[A++]=y+h[1]*x,m[A++]=c+h[2]*x,m[A++]=y+h[3]*x,i[e]=u.atlasIndex})),y.quads=(y.quads||0)+(Dz()-x);const b=Dz();y.sdf={};const E=c.height,I=Math.ceil(l.glyphCount/u),C=Math.pow(2,Math.ceil(Math.log2(I*a)));C>E&&(console.info(`Increasing SDF texture size ${E}->${C}`),Pz(c,o,C),h.dispose()),Promise.all(v.map((e=>Fz(e,l,t.gpuAccelerateSDF).then((({timing:t})=>{y.sdf[e.atlasIndex]=t}))))).then((()=>{v.length&&!l.contextLost&&(Gz(l),h.needsUpdate=!0),y.sdfTotal=Dz()-b,y.total=Dz()-n,e(Object.freeze({parameters:t,sdfTexture:h,sdfGlyphSize:a,sdfExponent:s,glyphBounds:m,glyphAtlasIndices:i,glyphColors:r.glyphColors,caretPositions:r.caretPositions,chunkedBounds:r.chunkedBounds,ascender:r.ascender,descender:r.descender,lineHeight:r.lineHeight,capHeight:r.capHeight,xHeight:r.xHeight,topBaseline:r.topBaseline,blockBounds:r.blockBounds,visibleBounds:r.visibleBounds,timings:r.timings}))}))})),Promise.resolve().then((()=>{l.contextLost||function(t){t._warm||(xz.webgl.isSupported(t),t._warm=!0)}(c)}))}function Fz({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:r,sdfCanvas:i,contextLost:o},s){if(o)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:u}=Lz,l=Math.max(n[2]-n[0],n[3]-n[1]),h=Math.floor(e/4);return function(t,e,n,r,i,o,s,a,u,l,h=!0){return h?Cz(t,e,n,r,i,o,s,a,u,l).then(null,(h=>(wz||(console.warn("WebGL SDF generation failed, falling back to JS",h),wz=!0),kz(t,e,n,r,i,o,s,a,u,l)))):kz(t,e,n,r,i,o,s,a,u,l)}(r,r,t,n,l,u,i,h%(a/r)*r,Math.floor(h/(a/r))*r,e%4,s)}let Uz;function Qz(t){return Uz||(Uz="undefined"==typeof document?{}:document.createElement("a")),Uz.href=t,Uz.href}function Gz(t){if("function"!=typeof createImageBitmap){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:n}=t,{width:r,height:i}=e,o=t.sdfCanvas.getContext("webgl");let s=n.image.data;s&&s.length===r*i*4||(s=new Uint8Array(r*i*4),n.image={width:r,height:i,data:s},n.flipY=!1,n.isDataTexture=!0),o.readPixels(0,0,r,i,o.RGBA,o.UNSIGNED_BYTE,s)}}const zz=dz({name:"Typesetter",dependencies:[function(t,e){const n=1/0,r=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",o=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function s({text:s="",font:c,lang:f,sdfGlyphSize:p=64,fontSize:d=400,fontWeight:g=1,fontStyle:y="normal",letterSpacing:v=0,lineHeight:m="normal",maxWidth:A=n,direction:_,textAlign:x="left",textIndent:w=0,whiteSpace:b="normal",overflowWrap:E="normal",anchorX:I=0,anchorY:C=0,metricsOnly:S=!1,unicodeFontsURL:M,preResolvedFonts:B=null,includeCaretPositions:T=!1,chunkedBoundsSize:k=8192,colorRanges:P=null},L){const R=l(),D={fontLoad:0,typesetting:0};s.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),s=s.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),d=+d,v=+v,A=+A,m=m||"normal",w=+w,function({text:e,lang:n,fonts:r,style:i,weight:o,preResolvedFonts:s,unicodeFontsURL:a},u){const l=({chars:t,fonts:e})=>{let n,r;const i=[];for(let o=0;o<t.length;o++)t[o]!==r?(r=t[o],i.push(n={start:o,end:o,fontObj:e[t[o]]})):n.end=o;u(i)};s?l(s):t(e,l,{lang:n,fonts:r,style:i,weight:o,unicodeFontsURL:a})}({text:s,lang:f,style:y,weight:g,fonts:"string"==typeof c?[{src:c}]:c,unicodeFontsURL:M,preResolvedFonts:B},(t=>{D.fontLoad=l()-R;const c=isFinite(A);let f=null,p=null,g=null,y=null,M=null,B=null,O=null,N=null,F=0,U=0,Q="nowrap"!==b;const G=new Map,z=l();let j=w,V=0,q=new h;const H=[q];t.forEach((t=>{const{fontObj:e}=t,{ascender:n,descender:a,unitsPerEm:u,lineGap:l,capHeight:f,xHeight:p}=e;let g=G.get(e);if(!g){const t=d/u,r="normal"===m?(n-a+l)*t:m*d,i=(r-(n-a)*t)/2,o=Math.min(r,(n-a)*t),s=(n+a)/2*t+o/2;g={index:G.size,src:e.src,fontObj:e,fontSizeMult:t,unitsPerEm:u,ascender:n*t,descender:a*t,capHeight:f*t,xHeight:p*t,lineHeight:r,baseline:-i-n*t,caretTop:s,caretBottom:s-o},G.set(e,g)}const{fontSizeMult:y}=g,_=s.slice(t.start,t.end+1);let x,b;e.forEachGlyph(_,d,v,((e,n,a,u)=>{n+=V,u+=t.start,x=n,b=e;const l=s.charAt(u),f=e.advanceWidth*y,p=q.count;let m;if("isEmpty"in e||(e.isWhitespace=!!l&&new RegExp(i).test(l),e.canBreakAfter=!!l&&o.test(l),e.isEmpty=e.xMin===e.xMax||e.yMin===e.yMax||r.test(l)),e.isWhitespace||e.isEmpty||U++,Q&&c&&!e.isWhitespace&&n+f+j>A&&p){if(q.glyphAt(p-1).glyphObj.canBreakAfter)m=new h,j=-n;else for(let t=p;t--;){if(0===t&&"break-word"===E){m=new h,j=-n;break}if(q.glyphAt(t).glyphObj.canBreakAfter){m=q.splitAt(t+1);const e=m.glyphAt(0).x;j-=e;for(let t=m.count;t--;)m.glyphAt(t).x-=e;break}}m&&(q.isSoftWrapped=!0,q=m,H.push(q),F=A)}let _=q.glyphAt(q.count);_.glyphObj=e,_.x=n+j,_.y=a,_.width=f,_.charIndex=u,_.fontData=g,"\n"===l&&(q=new h,H.push(q),j=-(n+f+v*d)+w)})),V=x+b.advanceWidth*y+v*d}));let W=0;H.forEach((t=>{let e=!0;for(let n=t.count;n--;){const r=t.glyphAt(n);e&&!r.glyphObj.isWhitespace&&(t.width=r.x+r.width,t.width>F&&(F=t.width),e=!1);let{lineHeight:i,capHeight:o,xHeight:s,baseline:a}=r.fontData;i>t.lineHeight&&(t.lineHeight=i);const u=a-t.baseline;u<0&&(t.baseline+=u,t.cap+=u,t.ex+=u),t.cap=Math.max(t.cap,t.baseline+o),t.ex=Math.max(t.ex,t.baseline+s)}t.baseline-=W,t.cap-=W,t.ex-=W,W+=t.lineHeight}));let Y=0,X=0;if(I&&("number"==typeof I?Y=-I:"string"==typeof I&&(Y=-F*("left"===I?0:"center"===I?.5:"right"===I?1:a(I)))),C&&("number"==typeof C?X=-C:"string"==typeof C&&(X="top"===C?0:"top-baseline"===C?-H[0].baseline:"top-cap"===C?-H[0].cap:"top-ex"===C?-H[0].ex:"middle"===C?W/2:"bottom"===C?W:"bottom-baseline"===C?-H[H.length-1].baseline:a(C)*W)),!S){const t=e.getEmbeddingLevels(s,_);f=new Uint16Array(U),p=new Uint8Array(U),g=new Float32Array(2*U),y={},O=[n,n,-1/0,-1/0],N=[],T&&(B=new Float32Array(4*s.length)),P&&(M=new Uint8Array(3*U));let r,i,o=0,a=-1,l=-1;if(H.forEach(((h,c)=>{let{count:d,width:v}=h;if(d>0){let c=0;for(let t=d;t--&&h.glyphAt(t).glyphObj.isWhitespace;)c++;let m=0,A=0;if("center"===x)m=(F-v)/2;else if("right"===x)m=F-v;else if("justify"===x&&h.isSoftWrapped){let t=0;for(let e=d-c;e--;)h.glyphAt(e).glyphObj.isWhitespace&&t++;A=(F-v)/t}if(A||m){let t=0;for(let e=0;e<d;e++){let n=h.glyphAt(e);const r=n.glyphObj;n.x+=m+t,0!==A&&r.isWhitespace&&e<d-c&&(t+=A,n.width+=A)}}const _=e.getReorderSegments(s,t,h.glyphAt(0).charIndex,h.glyphAt(h.count-1).charIndex);for(let t=0;t<_.length;t++){const[e,n]=_[t];let r=1/0,i=-1/0;for(let t=0;t<d;t++)if(h.glyphAt(t).charIndex>=e){let e=t,o=t;for(;o<d;o++){let t=h.glyphAt(o);if(t.charIndex>n)break;o<d-c&&(r=Math.min(r,t.x),i=Math.max(i,t.x+t.width))}for(let t=e;t<o;t++){const e=h.glyphAt(t);e.x=i-(e.x+e.width-r)}break}}let w;const b=t=>w=t;for(let c=0;c<d;c++){const d=h.glyphAt(c);w=d.glyphObj;const v=w.index,m=1&t.levels[d.charIndex];if(m){const t=e.getMirroredCharacter(s[d.charIndex]);t&&d.fontData.fontObj.forEachGlyph(t,0,0,b)}if(T){const{charIndex:t,fontData:e}=d,n=d.x+Y,r=d.x+d.width+Y;B[4*t]=m?r:n,B[4*t+1]=m?n:r,B[4*t+2]=h.baseline+e.caretBottom+X,B[4*t+3]=h.baseline+e.caretTop+X;const i=t-a;i>1&&u(B,a,i),a=t}if(P){const{charIndex:t}=d;for(;t>l;)l++,P.hasOwnProperty(l)&&(i=P[l])}if(!w.isWhitespace&&!w.isEmpty){const t=o++,{fontSizeMult:e,src:s,index:a}=d.fontData,u=y[s]||(y[s]={});u[v]||(u[v]={path:w.path,pathBounds:[w.xMin,w.yMin,w.xMax,w.yMax]});const l=d.x+Y,c=d.y+h.baseline+X;g[2*t]=l,g[2*t+1]=c;const m=l+w.xMin*e,A=c+w.yMin*e,_=l+w.xMax*e,x=c+w.yMax*e;m<O[0]&&(O[0]=m),A<O[1]&&(O[1]=A),_>O[2]&&(O[2]=_),x>O[3]&&(O[3]=x),t%k==0&&(r={start:t,end:t,rect:[n,n,-1/0,-1/0]},N.push(r)),r.end++;const b=r.rect;if(m<b[0]&&(b[0]=m),A<b[1]&&(b[1]=A),_>b[2]&&(b[2]=_),x>b[3]&&(b[3]=x),f[t]=v,p[t]=a,P){const e=3*t;M[e]=i>>16&255,M[e+1]=i>>8&255,M[e+2]=255&i}}}}})),B){const t=s.length-a;t>1&&u(B,a,t)}}const J=[];G.forEach((({index:t,src:e,unitsPerEm:n,ascender:r,descender:i,lineHeight:o,capHeight:s,xHeight:a})=>{J[t]={src:e,unitsPerEm:n,ascender:r,descender:i,lineHeight:o,capHeight:s,xHeight:a}})),D.typesetting=l()-z,L({glyphIds:f,glyphFontIndices:p,glyphPositions:g,glyphData:y,fontData:J,caretPositions:B,glyphColors:M,chunkedBounds:N,fontSize:d,topBaseline:X+H[0].baseline,blockBounds:[Y,X-W,Y+F,X],visibleBounds:O,timings:D})}))}function a(t){let e=t.match(/^([\d.]+)%$/),n=e?parseFloat(e[1]):NaN;return isNaN(n)?0:n/100}function u(t,e,n){const r=t[4*e],i=t[4*e+1],o=t[4*e+2],s=t[4*e+3],a=(i-r)/n;for(let i=0;i<n;i++){const n=4*(e+i);t[n]=r+a*i,t[n+1]=r+a*(i+1),t[n+2]=o,t[n+3]=s}}function l(){return(self.performance||Date).now()}function h(){this.data=[]}const c=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/c.length)},glyphAt(t){let e=h.flyweight;return e.data=this.data,e.index=t,e},splitAt(t){let e=new h;return e.data=this.data.splice(t*c.length),e}},h.flyweight=c.reduce(((t,e,n,r)=>(Object.defineProperty(t,e,{get(){return this.data[this.index*c.length+n]},set(t){this.data[this.index*c.length+n]=t}}),t)),{data:null,index:0}),{typeset:s,measure:function(t,e){s({...t,metricsOnly:!0},(t=>{const[n,r,i,o]=t.blockBounds;e({width:i-n,height:o-r})}))}}},Az,function(){var t=function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},n={},r={};n.L=1,r[1]="L",Object.keys(e).forEach((function(t,e){n[t]=1<<e+1,r[n[t]]=t})),Object.freeze(n);var i=n.LRI|n.RLI|n.FSI,o=n.L|n.R|n.AL,s=n.B|n.S|n.WS|n.ON|n.FSI|n.LRI|n.RLI|n.PDI,a=n.BN|n.RLE|n.LRE|n.RLO|n.LRO|n.PDF,u=n.S|n.WS|n.B|i|n.PDI|a,l=null;function h(t){return function(){if(!l){l=new Map;var t=function(t){if(e.hasOwnProperty(t)){var r=0;e[t].split(",").forEach((function(e){var i=e.split("+"),o=i[0],s=i[1];o=parseInt(o,36),s=s?parseInt(s,36):0,l.set(r+=o,n[t]);for(var a=0;a<s;a++)l.set(++r,n[t])}))}};for(var r in e)t(r)}}(),l.get(t.codePointAt(0))||n.L}var c,f,p,d="14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",g="6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye";function y(t,e){var n,r=0,i=new Map,o=e&&new Map;return t.split(",").forEach((function t(s){if(-1!==s.indexOf("+"))for(var a=+s;a--;)t(n);else{n=s;var u=s.split(">"),l=u[0],h=u[1];l=String.fromCodePoint(r+=parseInt(l,36)),h=String.fromCodePoint(r+=parseInt(h,36)),i.set(l,h),e&&o.set(h,l)}})),{map:i,reverseMap:o}}function v(){if(!c){var t=y(d,!0),e=t.map,n=t.reverseMap;c=e,f=n,p=y(g,!1).map}}function m(t){return v(),c.get(t)||null}function A(t){return v(),f.get(t)||null}function _(t){return v(),p.get(t)||null}var x=n.L,w=n.R,b=n.EN,E=n.ES,I=n.ET,C=n.AN,S=n.CS,M=n.B,B=n.S,T=n.ON,k=n.BN,P=n.NSM,L=n.AL,R=n.LRO,D=n.RLO,O=n.LRE,N=n.RLE,F=n.PDF,U=n.LRI,Q=n.RLI,G=n.FSI,z=n.PDI;var j;function V(t){return function(){if(!j){var t=y("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),e=t.map;t.reverseMap.forEach((function(t,n){e.set(n,t)})),j=e}}(),j.get(t)||null}function q(t,e,n,r){var i=t.length;n=Math.max(0,null==n?0:+n),r=Math.min(i-1,null==r?i-1:+r);var o=[];return e.paragraphs.forEach((function(i){var s=Math.max(n,i.start),a=Math.min(r,i.end);if(s<a){for(var l=e.levels.slice(s,a+1),c=a;c>=s&&h(t[c])&u;c--)l[c]=i.level;for(var f=i.level,p=1/0,d=0;d<l.length;d++){var g=l[d];g>f&&(f=g),g<p&&(p=1|g)}for(var y=f;y>=p;y--)for(var v=0;v<l.length;v++)if(l[v]>=y){for(var m=v;v+1<l.length&&l[v+1]>=y;)v++;v>m&&o.push([m+s,v+s])}}})),o}function H(t,e,n,r){for(var i=q(t,e,n,r),o=[],s=0;s<t.length;s++)o[s]=s;return i.forEach((function(t){for(var e=t[0],n=t[1],r=o.slice(e,n+1),i=r.length;i--;)o[n-i]=r[i]})),o}return t.closingToOpeningBracket=A,t.getBidiCharType=h,t.getBidiCharTypeName=function(t){return r[h(t)]},t.getCanonicalBracket=_,t.getEmbeddingLevels=function(t,e){for(var n=new Uint32Array(t.length),r=0;r<t.length;r++)n[r]=h(t[r]);var l=new Map;function c(t,e){var r=n[t];n[t]=e,l.set(r,l.get(r)-1),r&s&&l.set(s,l.get(s)-1),l.set(e,(l.get(e)||0)+1),e&s&&l.set(s,(l.get(s)||0)+1)}for(var f=new Uint8Array(t.length),p=new Map,d=[],g=null,y=0;y<t.length;y++)g||d.push(g={start:y,end:t.length-1,level:"rtl"===e?1:"ltr"===e?0:Ge(y,!1)}),n[y]&M&&(g.end=y,g=null);for(var v=N|O|D|R|i|z|F|M,j=function(t){return t+(1&t?1:2)},V=function(t){return t+(1&t?2:1)},q=0;q<d.length;q++){var H=[{_level:(g=d[q]).level,_override:0,_isolate:0}],W=void 0,Y=0,X=0,J=0;l.clear();for(var K=g.start;K<=g.end;K++){var Z=n[K];if(W=H[H.length-1],l.set(Z,(l.get(Z)||0)+1),Z&s&&l.set(s,(l.get(s)||0)+1),Z&v)if(Z&(N|O)){f[K]=W._level;var $=(Z===N?V:j)(W._level);$<=125&&!Y&&!X?H.push({_level:$,_override:0,_isolate:0}):Y||X++}else if(Z&(D|R)){f[K]=W._level;var tt=(Z===D?V:j)(W._level);tt<=125&&!Y&&!X?H.push({_level:tt,_override:Z&D?w:x,_isolate:0}):Y||X++}else if(Z&i){Z&G&&(Z=1===Ge(K+1,!0)?Q:U),f[K]=W._level,W._override&&c(K,W._override);var et=(Z===Q?V:j)(W._level);et<=125&&0===Y&&0===X?(J++,H.push({_level:et,_override:0,_isolate:1,_isolInitIndex:K})):Y++}else if(Z&z){if(Y>0)Y--;else if(J>0){for(X=0;!H[H.length-1]._isolate;)H.pop();var nt=H[H.length-1]._isolInitIndex;null!=nt&&(p.set(nt,K),p.set(K,nt)),H.pop(),J--}W=H[H.length-1],f[K]=W._level,W._override&&c(K,W._override)}else Z&F?(0===Y&&(X>0?X--:!W._isolate&&H.length>1&&(H.pop(),W=H[H.length-1])),f[K]=W._level):Z&M&&(f[K]=g.level);else f[K]=W._level,W._override&&Z!==k&&c(K,W._override)}for(var rt=[],it=null,ot=g.start;ot<=g.end;ot++){var st=n[ot];if(!(st&a)){var at=f[ot],ut=st&i,lt=st===z;it&&at===it._level?(it._end=ot,it._endsWithIsolInit=ut):rt.push(it={_start:ot,_end:ot,_level:at,_startsWithPDI:lt,_endsWithIsolInit:ut})}}for(var ht=[],ct=0;ct<rt.length;ct++){var ft=rt[ct];if(!ft._startsWithPDI||ft._startsWithPDI&&!p.has(ft._start)){for(var pt=[it=ft],dt=void 0;it&&it._endsWithIsolInit&&null!=(dt=p.get(it._end));)for(var gt=ct+1;gt<rt.length;gt++)if(rt[gt]._start===dt){pt.push(it=rt[gt]);break}for(var yt=[],vt=0;vt<pt.length;vt++)for(var mt=pt[vt],At=mt._start;At<=mt._end;At++)yt.push(At);for(var _t=f[yt[0]],xt=g.level,wt=yt[0]-1;wt>=0;wt--)if(!(n[wt]&a)){xt=f[wt];break}var bt=yt[yt.length-1],Et=f[bt],It=g.level;if(!(n[bt]&i))for(var Ct=bt+1;Ct<=g.end;Ct++)if(!(n[Ct]&a)){It=f[Ct];break}ht.push({_seqIndices:yt,_sosType:Math.max(xt,_t)%2?w:x,_eosType:Math.max(It,Et)%2?w:x})}}for(var St=0;St<ht.length;St++){var Mt=ht[St],Bt=Mt._seqIndices,Tt=Mt._sosType,kt=Mt._eosType,Pt=1&f[Bt[0]]?w:x;if(l.get(P))for(var Lt=0;Lt<Bt.length;Lt++){var Rt=Bt[Lt];if(n[Rt]&P){for(var Dt=Tt,Ot=Lt-1;Ot>=0;Ot--)if(!(n[Bt[Ot]]&a)){Dt=n[Bt[Ot]];break}c(Rt,Dt&(i|z)?T:Dt)}}if(l.get(b))for(var Nt=0;Nt<Bt.length;Nt++){var Ft=Bt[Nt];if(n[Ft]&b)for(var Ut=Nt-1;Ut>=-1;Ut--){var Qt=-1===Ut?Tt:n[Bt[Ut]];if(Qt&o){Qt===L&&c(Ft,C);break}}}if(l.get(L))for(var Gt=0;Gt<Bt.length;Gt++){var zt=Bt[Gt];n[zt]&L&&c(zt,w)}if(l.get(E)||l.get(S))for(var jt=1;jt<Bt.length-1;jt++){var Vt=Bt[jt];if(n[Vt]&(E|S)){for(var qt=0,Ht=0,Wt=jt-1;Wt>=0&&(qt=n[Bt[Wt]])&a;Wt--);for(var Yt=jt+1;Yt<Bt.length&&(Ht=n[Bt[Yt]])&a;Yt++);qt===Ht&&(n[Vt]===E?qt===b:qt&(b|C))&&c(Vt,qt)}}if(l.get(b))for(var Xt=0;Xt<Bt.length;Xt++){var Jt=Bt[Xt];if(n[Jt]&b){for(var Kt=Xt-1;Kt>=0&&n[Bt[Kt]]&(I|a);Kt--)c(Bt[Kt],b);for(Xt++;Xt<Bt.length&&n[Bt[Xt]]&(I|a|b);Xt++)n[Bt[Xt]]!==b&&c(Bt[Xt],b)}}if(l.get(I)||l.get(E)||l.get(S))for(var Zt=0;Zt<Bt.length;Zt++){var $t=Bt[Zt];if(n[$t]&(I|E|S)){c($t,T);for(var te=Zt-1;te>=0&&n[Bt[te]]&a;te--)c(Bt[te],T);for(var ee=Zt+1;ee<Bt.length&&n[Bt[ee]]&a;ee++)c(Bt[ee],T)}}if(l.get(b))for(var ne=0,re=Tt;ne<Bt.length;ne++){var ie=Bt[ne],oe=n[ie];oe&b?re===x&&c(ie,x):oe&o&&(re=oe)}if(l.get(s)){for(var se=w|b|C,ae=se|x,ue=[],le=[],he=0;he<Bt.length;he++)if(n[Bt[he]]&s){var ce=t[Bt[he]],fe=void 0;if(null!==m(ce)){if(!(le.length<63))break;le.push({char:ce,seqIndex:he})}else if(null!==(fe=A(ce)))for(var pe=le.length-1;pe>=0;pe--){var de=le[pe].char;if(de===fe||de===A(_(ce))||m(_(de))===ce){ue.push([le[pe].seqIndex,he]),le.length=pe;break}}}ue.sort((function(t,e){return t[0]-e[0]}));for(var ge=0;ge<ue.length;ge++){for(var ye=ue[ge],ve=ye[0],me=ye[1],Ae=!1,_e=0,xe=ve+1;xe<me;xe++){var we=Bt[xe];if(n[we]&ae){Ae=!0;var be=n[we]&se?w:x;if(be===Pt){_e=be;break}}}if(Ae&&!_e){_e=Tt;for(var Ee=ve-1;Ee>=0;Ee--){var Ie=Bt[Ee];if(n[Ie]&ae){var Ce=n[Ie]&se?w:x;_e=Ce!==Pt?Ce:Pt;break}}}if(_e){if(n[Bt[ve]]=n[Bt[me]]=_e,_e!==Pt)for(var Se=ve+1;Se<Bt.length;Se++)if(!(n[Bt[Se]]&a)){h(t[Bt[Se]])&P&&(n[Bt[Se]]=_e);break}if(_e!==Pt)for(var Me=me+1;Me<Bt.length;Me++)if(!(n[Bt[Me]]&a)){h(t[Bt[Me]])&P&&(n[Bt[Me]]=_e);break}}}for(var Be=0;Be<Bt.length;Be++)if(n[Bt[Be]]&s){for(var Te=Be,ke=Be,Pe=Tt,Le=Be-1;Le>=0;Le--){if(!(n[Bt[Le]]&a)){Pe=n[Bt[Le]]&se?w:x;break}Te=Le}for(var Re=kt,De=Be+1;De<Bt.length;De++){if(!(n[Bt[De]]&(s|a))){Re=n[Bt[De]]&se?w:x;break}ke=De}for(var Oe=Te;Oe<=ke;Oe++)n[Bt[Oe]]=Pe===Re?Pe:Pt;Be=ke}}}for(var Ne=g.start;Ne<=g.end;Ne++){var Fe=f[Ne],Ue=n[Ne];if(1&Fe?Ue&(x|b|C)&&f[Ne]++:Ue&w?f[Ne]++:Ue&(C|b)&&(f[Ne]+=2),Ue&a&&(f[Ne]=0===Ne?g.level:f[Ne-1]),Ne===g.end||h(t[Ne])&(B|M))for(var Qe=Ne;Qe>=0&&h(t[Qe])&u;Qe--)f[Qe]=g.level}}return{levels:f,paragraphs:d};function Ge(e,r){for(var o=e;o<t.length;o++){var s=n[o];if(s&(w|L))return 1;if(s&(M|x)||r&&s===z)return 0;if(s&i){var a=ze(o);o=-1===a?t.length:a}}return 0}function ze(e){for(var r=1,o=e+1;o<t.length;o++){var s=n[o];if(s&M)break;if(s&z){if(0==--r)return o}else s&i&&r++}return-1}},t.getMirroredCharacter=V,t.getMirroredCharactersMap=function(t,e,n,r){var i=t.length;n=Math.max(0,null==n?0:+n),r=Math.min(i-1,null==r?i-1:+r);for(var o=new Map,s=n;s<=r;s++)if(1&e[s]){var a=V(t[s]);null!==a&&o.set(s,a)}return o},t.getReorderSegments=q,t.getReorderedIndices=H,t.getReorderedString=function(t,e,n,r){var i=H(t,e,n,r),o=[].concat(t);return i.forEach((function(n,r){o[r]=(1&e.levels[n]?V(t[n]):null)||t[n]})),o.join("")},t.openingToClosingBracket=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({});return t}],init:(t,e,n)=>t(e,n())}),jz=dz({name:"Typesetter",dependencies:[zz],init:t=>function(e){return new Promise((n=>{t.typeset(e,n)}))},getTransferables(t){const e=[];for(let n in t)t[n]&&t[n].buffer&&e.push(t[n].buffer);return e}});jz.onMainThread;const Vz={};const qz="aTroikaGlyphIndex";class Hz extends Ee{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new yt,this.boundingBox=new gt}computeBoundingSphere(){}computeBoundingBox(){}set detail(t){if(t!==this._detail){this._detail=t,("number"!=typeof t||t<1)&&(t=1);let e=function(t){let e=Vz[t];return e||(e=Vz[t]=new Qt(1,1,t,t).translate(.5,.5,0)),e}(t);["position","normal","uv"].forEach((t=>{this.attributes[t]=e.attributes[t].clone()})),this.setIndex(e.getIndex().clone())}}get detail(){return this._detail}set curveRadius(t){t!==this._curveRadius&&(this._curveRadius=t,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(t,e,n,r,i){this.updateAttributeData("aTroikaGlyphBounds",t,4),this.updateAttributeData(qz,e,1),this.updateAttributeData("aTroikaGlyphColor",i,3),this._blockBounds=n,this._chunkedBounds=r,this.instanceCount=e.length,this._updateBounds()}_updateBounds(){const t=this._blockBounds;if(t){const{curveRadius:e,boundingBox:n}=this;if(e){const{PI:r,floor:i,min:o,max:s,sin:a,cos:u}=Math,l=r/2,h=2*r,c=Math.abs(e),f=t[0]/c,p=t[2]/c,d=i((f+l)/h)!==i((p+l)/h)?-c:o(a(f)*c,a(p)*c),g=i((f-l)/h)!==i((p-l)/h)?c:s(a(f)*c,a(p)*c),y=i((f+r)/h)!==i((p+r)/h)?2*c:s(c-u(f)*c,c-u(p)*c);n.min.set(d,t[1],e<0?-y:0),n.max.set(g,t[3],e<0?0:y)}else n.min.set(t[0],t[1],0),n.max.set(t[2],t[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(t){let e=this.getAttribute(qz).count,n=this._chunkedBounds;if(n)for(let r=n.length;r--;){e=n[r].end;let i=n[r].rect;if(i[1]<t.w&&i[3]>t.y&&i[0]<t.z&&i[2]>t.x)break}this.instanceCount=e}updateAttributeData(t,e,n){const r=this.getAttribute(t);e?r&&r.array.length===e.length?(r.array.set(e),r.needsUpdate=!0):(this.setAttribute(t,new tt(e,n)),delete this._maxInstanceCount,this.dispose()):r&&this.deleteAttribute(t)}}const Wz=new v({color:16777215,side:B,transparent:!0}),Yz=8421504,Xz=new p,Jz=new Z,Kz=new Z,Zz=[],$z=new Z,tj="+x+y";function ej(t){return Array.isArray(t)?t[0]:t}let nj=()=>{const t=new L(new Qt(1,1),Wz);return nj=()=>t,t},rj=()=>{const t=new L(new Qt(1,1,32,1),Wz);return rj=()=>t,t};const ij={type:"syncstart"},oj={type:"synccomplete"},sj=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],aj=sj.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class uj extends L{constructor(){super(new Hz,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Yz,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=tj,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(t){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(t):(this._isSyncing=!0,this.dispatchEvent(ij),Nz({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},(e=>{this._isSyncing=!1,this._textRenderInfo=e,this.geometry.updateGlyphs(e.glyphBounds,e.glyphAtlasIndices,e.blockBounds,e.chunkedBounds,e.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync((()=>{n.forEach((t=>t&&t()))}))),this.dispatchEvent(oj),t&&t()}))))}onBeforeRender(t,e,n,r,i,o){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(t){return function(t){const e=ez(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new T},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Tt(0,0,0,0)},uTroikaClipRect:{value:new Tt(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new T},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new c},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new bt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nuniform vec4 uTroikaClipRect;\nuniform mat3 uTroikaOrient;\nuniform bool uTroikaUseGlyphColors;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaBlurRadius;\nuniform vec2 uTroikaPositionOffset;\nuniform float uTroikaCurveRadius;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nattribute vec3 aTroikaGlyphColor;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec3 vTroikaGlyphColor;\nvarying vec2 vTroikaGlyphDimensions;\n",vertexTransform:"\nvec4 bounds = aTroikaGlyphBounds;\nbounds.xz += uTroikaPositionOffset.x;\nbounds.yw -= uTroikaPositionOffset.y;\n\nvec4 outlineBounds = vec4(\n bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,\n bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius\n);\nvec4 clippedBounds = vec4(\n clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),\n clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)\n);\n\nvec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);\n\nposition.xy = mix(bounds.xy, bounds.zw, clippedXY);\n\nuv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);\n\nfloat rad = uTroikaCurveRadius;\nif (rad != 0.0) {\n float angle = position.x / rad;\n position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);\n normal.xz = vec2(sin(angle), cos(angle));\n}\n \nposition = uTroikaOrient * position;\nnormal = uTroikaOrient * normal;\n\nvTroikaGlyphUV = clippedXY.xy;\nvTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);\n\n\nfloat txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;\nvec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\nvec2 txStartUV = txUvPerSquare * vec2(\n mod(floor(aTroikaGlyphIndex / 4.0), txCols),\n floor(floor(aTroikaGlyphIndex / 4.0) / txCols)\n);\nvTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);\nvTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);\n",fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform float uTroikaSDFExponent;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaFillOpacity;\nuniform float uTroikaBlurRadius;\nuniform vec3 uTroikaStrokeColor;\nuniform float uTroikaStrokeWidth;\nuniform float uTroikaStrokeOpacity;\nuniform bool uTroikaSDFDebug;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec2 vTroikaGlyphDimensions;\n\nfloat troikaSdfValueToSignedDistance(float alpha) {\n // Inverse of exponential encoding in webgl-sdf-generator\n \n float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);\n float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;\n float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);\n return signedDist;\n}\n\nfloat troikaGlyphUvToSdfValue(vec2 glyphUV) {\n vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);\n vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);\n float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1\n return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;\n}\n\nfloat troikaGlyphUvToDistance(vec2 uv) {\n return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));\n}\n\nfloat troikaGetAADist() {\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;\n #else\n return vTroikaGlyphDimensions.x / 64.0;\n #endif\n}\n\nfloat troikaGetFragDistValue() {\n vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);\n float distance = troikaGlyphUvToDistance(clampedGlyphUV);\n \n // Extrapolate distance when outside bounds:\n distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : \n length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);\n\n \n\n return distance;\n}\n\nfloat troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {\n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(-distanceOffset, -distance);\n #else\n\n float alpha = smoothstep(\n distanceOffset + aaDist,\n distanceOffset - aaDist,\n distance\n );\n #endif\n\n return alpha;\n}\n",fragmentColorTransform:"\nfloat aaDist = troikaGetAADist();\nfloat fragDistance = troikaGetFragDistValue();\nfloat edgeAlpha = uTroikaSDFDebug ?\n troikaGlyphUvToSdfValue(vTroikaGlyphUV) :\n troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));\n\n#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)\nvec4 fillRGBA = gl_FragColor;\nfillRGBA.a *= uTroikaFillOpacity;\nvec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);\nif (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;\ngl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(\n -uTroikaStrokeWidth - aaDist,\n -uTroikaStrokeWidth + aaDist,\n fragDistance\n));\ngl_FragColor.a *= edgeAlpha;\n#endif\n\nif (edgeAlpha == 0.0) {\n discard;\n}\n",customRewriter({vertexShader:t,fragmentShader:e}){let n=/\buniform\s+vec3\s+diffuse\b/;return n.test(e)&&(e=e.replace(n,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),n.test(t)||(t=t.replace(WG,"uniform vec3 diffuse;\n$&\nvTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;\n"))),{vertexShader:t,fragmentShader:e}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}(t)}get material(){let t=this._derivedMaterial;const e=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Wz.clone());if(t&&t.isDerivedFrom(e)||(t=this._derivedMaterial=this.createDerivedMaterial(e),e.addEventListener("dispose",(function n(){e.removeEventListener("dispose",n),t.dispose()}))),this.hasOutline()){let e=t._outlineMtl;return e||(e=t._outlineMtl=Object.create(t,{id:{value:t.id+.1}}),e.isTextOutlineMaterial=!0,e.depthWrite=!1,e.map=null,t.addEventListener("dispose",(function n(){t.removeEventListener("dispose",n),e.dispose()}))),[e,t]}return t}set material(t){t&&t.isTroikaTextMaterial?(this._derivedMaterial=t,this._baseMaterial=t.baseMaterial):this._baseMaterial=t}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(t){this.geometry.detail=t}get curveRadius(){return this.geometry.curveRadius}set curveRadius(t){this.geometry.curveRadius=t}get customDepthMaterial(){return ej(this.material).getDepthMaterial()}set customDepthMaterial(t){}get customDistanceMaterial(){return ej(this.material).getDistanceMaterial()}set customDistanceMaterial(t){}_prepareForRender(t){const e=t.isTextOutlineMaterial,n=t.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:t,blockBounds:i}=r;n.uTroikaSDFTexture.value=t,n.uTroikaSDFTextureSize.value.set(t.image.width,t.image.height),n.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,n.uTroikaSDFExponent.value=r.sdfExponent,n.uTroikaTotalBounds.value.fromArray(i),n.uTroikaUseGlyphColors.value=!e&&!!r.glyphColors;let o,s,a,u=0,l=0,h=0,c=0,f=0;if(e){let{outlineWidth:t,outlineOffsetX:e,outlineOffsetY:n,outlineBlur:r,outlineOpacity:i}=this;u=this._parsePercent(t)||0,l=Math.max(0,this._parsePercent(r)||0),o=i,c=this._parsePercent(e)||0,f=this._parsePercent(n)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(a=this.strokeColor,n.uTroikaStrokeColor.value.set(null==a?Yz:a),s=this.strokeOpacity,null==s&&(s=1)),o=this.fillOpacity;n.uTroikaEdgeOffset.value=u,n.uTroikaPositionOffset.value.set(c,f),n.uTroikaBlurRadius.value=l,n.uTroikaStrokeWidth.value=h,n.uTroikaStrokeOpacity.value=s,n.uTroikaFillOpacity.value=null==o?1:o,n.uTroikaCurveRadius.value=this.curveRadius||0;let p=this.clipRect;if(p&&Array.isArray(p)&&4===p.length)n.uTroikaClipRect.value.fromArray(p);else{const t=100*(this.fontSize||.1);n.uTroikaClipRect.value.set(i[0]-t,i[1]-t,i[2]+t,i[3]+t)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,t.polygonOffset=!!this.depthOffset,t.polygonOffsetFactor=t.polygonOffsetUnits=this.depthOffset||0;const i=e?this.outlineColor||0:this.color;if(null==i)delete t.color;else{const e=t.hasOwnProperty("color")?t.color:t.color=new c;i===e._input&&"object"!=typeof i||e.set(e._input=i)}let o=this.orientation||tj;if(o!==t._orientation){let e=n.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let r=o!==tj&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(r){let[,t,n,i,o]=r;Jz.set(0,0,0)[n]="-"===t?1:-1,Kz.set(0,0,0)[o]="-"===i?-1:1,Xz.lookAt($z,Jz.cross(Kz),Kz),e.setFromMatrix4(Xz)}else e.identity();t._orientation=o}}_parsePercent(t){if("string"==typeof t){let e=t.match(/^(-?[\d.]+)%$/),n=e?parseFloat(e[1]):NaN;t=(isNaN(n)?0:n/100)*this.fontSize}return t}localPositionToTextCoords(t,e=new T){e.copy(t);const n=this.curveRadius;return n&&(e.x=Math.atan2(t.x,Math.abs(n)-Math.abs(t.z))*Math.abs(n)),e}worldPositionToTextCoords(t,e=new T){return Jz.copy(t),this.localPositionToTextCoords(this.worldToLocal(Jz),e)}raycast(t,e){const{textRenderInfo:n,curveRadius:r}=this;if(n){const i=n.blockBounds,o=r?rj():nj(),s=o.geometry,{position:a,uv:u}=s.attributes;for(let t=0;t<u.count;t++){let e=i[0]+u.getX(t)*(i[2]-i[0]);const n=i[1]+u.getY(t)*(i[3]-i[1]);let o=0;r&&(o=r-Math.cos(e/r)*r,e=Math.sin(e/r)*r),a.setXYZ(t,e,n,o)}s.boundingSphere=this.geometry.boundingSphere,s.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,Zz.length=0,o.raycast(t,Zz);for(let t=0;t<Zz.length;t++)Zz[t].object=this,e.push(Zz[t])}}copy(t){const e=this.geometry;return super.copy(t),this.geometry=e,aj.forEach((e=>{this[e]=t[e]})),this}clone(){return(new this.constructor).copy(this)}}sj.forEach((t=>{const e="_private_"+t;Object.defineProperty(uj.prototype,t,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})})),new gt,new c;var lj={altitude:0,height:0,interactive:!1};Fn.prototype._createSDFText=function(){return this.object3d=new uj,this.object3d.__parent=this,this};var hj=function(){function e(n,r,i,o){var s;tn(this,e),i=t.Util.extend({},lj,i,{layer:o}),s=$e(this,e);var a=i.altitude;s._initOptions(i),console.log(i,"fffffffff"),s._createSDFText(),s.getObject3d().text=i.text,s.getObject3d().fontSize=i.fontSize,s.getObject3d().color=i.color,s.getObject3d().letterSpacing=i.letterSpacing||0,s.getObject3d().textAlign="center",s.getObject3d().anchorX=i.anchorX||"center",s.getObject3d().anchorY=i.anchorY||"middle",s.getObject3d().renderOrder=i.renderOrder,s.getObject3d().material=r,s.getObject3d().font=i.fontfile;var u=o.distanceToVector3(a,a).x,l=o.coordinateToVector3(n,u);return s.getObject3d().position.copy(l),s}return ln(e,Fn),rn(e)}(),cj=function(){return rn((function t(e,n,r){var i=this;tn(this,t),0!=e.length?(this.map=r.map,this.threeLayer=r,this.textWidth=n.textWidth||40,this.textHeight=n.textHeight||40,this.beginSizeZoom=n.beginSizeZoom||3,this.endSizeZoom=n.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.textDx=n.textDx||0,this.textDy=n.textDy||0,this.anchorX=n.anchorX,this.anchorY=n.anchorY,this.minZoom=n.pointMinZoom||3,this.maxZoom=n.pointMaxZoom||20,this.fontSize=n.fontSize||.4,this.letterSpacing=n.letterSpacing||0,this.textField=n.textField,this.altitude=n.altitude,this.zoomChangeCallback=n.zoomChangeCallback,this.meshs=[],this.m=this.createBillboardMaterial(new o.MeshBasicMaterial),console.log(e,"77777777777777"),e.forEach((function(t){if(t[i.textField]){console.log(t);var e=new hj([t.longitude,t.latitude],i.m,{minZoom:i.minZoom,maxZoom:i.maxZoom,text:t[i.textField],color:t.color||"#fff",renderOrder:n.pointOrder||5,fontSize:i.fontSize,letterSpacing:i.letterSpacing,altitude:i.altitude,anchorX:i.anchorX,anchorY:i.anchorY},r);e.zoomChange=function(){i.m.uniforms.cameraToCenterDistance.value=i.map.cameraToCenterDistance,i.m.uniforms.zoomScale.value=76.43702828517625/i.map.getResolution();var t=i._getRate();i.m.uniforms.size.value=[i.textWidth*t,i.textHeight*t],i.m.uniforms.xyOffset.value=[i.textDx*t,i.textDy*t],i.zoomChangeCallback&&i.zoomChangeCallback(e)},i.meshs.push(e)}})),this.dataItems=e,r.addMesh(this.meshs),this._bindMapEvents()):console.error("需要绘制的点位数量为0")}),[{key:"createBillboardMaterial",value:function(t,e){return ez(t,Object.assign({uniforms:{canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:76.43702828517625/this.map.getResolution()},size:{value:[this.textWidth*this._getRate(),this.textHeight*this._getRate()]},xyOffset:{value:[this.textDx*this._getRate(),this.textDy*this._getRate()]}},vertexDefs:"\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform vec2 size;\n uniform vec2 xyOffset;\n ",vertexMainOutro:"\n\n vec2 iconSize = vec2(24, 24);\n vec3 c = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n float k = gl_Position.w;\n float l = (1. - cameraToCenterDistance / k);\n float m = clamp(.5 + .5 * (1. - l), .0, 4.);\n vec2 A = position.xy;\n A = A * size;\n \n vec2 B = A * 2. / canvasSize;\n gl_Position.xy += B * m * k;\n\n //float C = k / cameraToCenterDistance;\n //vec2 B = A;\n //gl_Position = projectionMatrix * modelViewMatrix * vec4(vec3(B, .0) / zoomScale * C * m, 1.);\n\n\n gl_Position.xy += xyOffset * 2. / canvasSize * k;\n "},e))}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(e,n,r){for(var i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];e.includes(l.code)?(i=Math.min(i,this.dataItems[u].longitude),o=Math.min(o,this.dataItems[u].latitude),s=Math.max(s,this.dataItems[u].longitude),a=Math.max(a,this.dataItems[u].latitude),l.visibility=1):l.visibility=.1}this.updateByVisibility(),n&&this.map.fitExtent(new t.Extent(i,o,s,a),r||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,n){.1===t.dataItems[n].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t,e=this;this.meshs.forEach((function(t){e.threeLayer.removeMesh(t),t.object3d.dispose()})),null===(t=this.m)||void 0===t||t.dispose()}}],[{key:"preloadFont",value:function(t){return new Promise((function(t){!function({font:t,characters:e,sdfGlyphSize:n},r){Nz({font:t,sdfGlyphSize:n,text:Array.isArray(e)?e.join("\n"):""+e},r)}({font:"/NotoSerifSC-Regular.otf"},(function(){t()}))}))}}])}(),fj="__webglFramebuffer",pj=new o.Vector4,dj={bloom:!0},gj=1*o.REVISION>154?Math.PI:1;function yj(t,e){if(t){t.layers&&t.layers.set(e);var n=t.children;if(n&&n.length)for(var r=0,i=n.length;r<i;r++)yj(n[r],e)}}wu.prototype.renderScene=function(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){var e=t.renderTarget.fbo,n=e.width,r=e.height;this._renderTarget?(this._renderTarget.viewport.set(0,0,n,r),this._renderTarget.scissor.set(0,0,n,r)):(this._renderTarget=new o.WebGLRenderTarget(n,r,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));var i=this.context.properties.get(this._renderTarget),s=i[fj];i[fj]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);var a=1===t.bloom&&t.sceneFilter,u=this.scene.children||[],l=!1;if(a){var h=t.sceneFilter;l=h(dj);for(var c=0,f=u.length;c<f;c++)if(u[c]&&u[c].layers){var p=u[c].__parent;u[c].bloom=!1,p&&(u[c].bloom=p.bloom);var d=0;(u[c]&&h(u[c])||!p)&&l&&(d=1),u[c].__layer!==d&&(yj(u[c],d),u[c].__layer=d)}}else for(var g=0,y=u.length;g<y;g++)u[g]&&u[g].layers&&0!==u[g].__layer&&(yj(u[g],0),u[g].__layer=0);this.camera.layers.set(l?1:0),this.context.render(this.scene,this.camera),i[fj]=s}else{var v=this.canvas,m=v.width,A=v.height,_=this.context.getViewport(pj);_.width===m&&_.height===A||this.context.setViewport(0,0,m,A),this.context.render(this.scene,this.camera),this.layer.updateComposer()}this.context.setRenderTarget(null),this.completeRender()},_u.prototype.initEnvironment=function(t){var e=this.getScene(),n=(new jG).load(t,(function(){n.mapping=o.EquirectangularReflectionMapping,e.environment=n}))},_u.prototype.initBloom=function(){var t=this.getThreeRenderer(),e=this.getScene(),n=this.getCamera();this.composer=new qQ(t,{frameBufferType:o.HalfFloatType}),this.composer.addPass(new SG(e,n))},_u.prototype.delComposer=function(){var t;null===(t=this.composer)||void 0===t||t.dispose()},_u.prototype.updateComposer=function(){var t;null===(t=this.composer)||void 0===t||t.render()},_u.prototype.getComposer=function(){return this.composer},_u.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},_u.prototype.identify=function(e,n){var r=this;if(!e)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(e)&&(e=new t.Coordinate(e)),!(e instanceof t.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var i=this.getMap().coordToContainerPoint(e);this._containerPoint=i;var s=i.x,a=i.y;this._initRaycaster(),this.fire("identify",{coordinate:e,options:n});var u=this._raycaster,l=this._mouse,h=this.getCamera(),c=this.getScene(),f=this.getMap().getSize();if(!c)return[];var p=f.width,d=f.height;l.x=s/p*2-1,l.y=-a/d*2+1,u.setFromCamera(l,h),u.layers&&u.layers.enableAll&&u.layers.enableAll(),function(t,e){t.linePrecision=e}(u,this._getLinePrecision(this.getMap().getResolution()));var g=[],y=[];c.children.forEach((function(e){var n=e.__parent;if(n&&n.getOptions){var r=n;r.getOptions().interactive&&r.isVisible()&&(r.identify&&t.Util.isFunction(r.identify)?y.push(r):g.push(e))}else(e instanceof o.Mesh||e instanceof o.Group)&&e.customType&&e.children.forEach((function(e){var n=e.__parent;if(n&&n.getOptions){var r=n;r.getOptions().interactive&&r.isVisible()&&(r.identify&&t.Util.isFunction(r.identify)?y.push(r):g.push(e))}}))}));var v=[],m=u.intersectObjects(g,!0);m&&Array.isArray(m)&&m.length&&(v=m.map((function(e){var n=e.object,i=e.instanceId,o=(n=r._recursionMesh(n)||{}).__parent||n;return o.faceIndex=e.faceIndex,o.index=e.index,o.intersect=e,t.Util.isNumber(i)&&(o.instanceId=i),o}))),this.renderPickScene(),y.length&&y.forEach((function(t){t.identify(e)&&v.push(t)}));for(var A=v.length,_=0;_<A;_++)if(v[_])for(var x=_+1;x<A;x++)v[_]===v[x]&&v.splice(x,1);var w=(n=t.Util.extend({},n)).count;return v.sort((function(t,e){return e.object3d.renderOrder-t.object3d.renderOrder})),t.Util.isNumber(w)&&w>0?v.slice(0,w):v},_u.prototype._zoomend=function(){var e=this.getScene();if(e){var n=this.getMap().getZoom();e.children.forEach((function(e){if(e.customType)e.children.forEach((function(e){var r=e.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(n);var o=i.getMinZoom(),s=i.getMaxZoom();n<o||n>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=n&&n<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var r=e.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(n);var o=i.getMinZoom(),s=i.getMaxZoom();n<o||n>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=n&&n<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},_u.prototype.addMesh1=function(t,e){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof Fn){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=n,t._fire("add",{target:t}))}})),this._zoomend(),r){var s=this._getRenderer();s&&s.setToRedraw()}return this},_u.prototype.removeMesh1=function(e,n){var r=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return this;Array.isArray(e)||(e=[e]);var s=this.getScene(),a=s.getObjectByProperty("customId",n);if(e.forEach((function(e){if(e instanceof Fn){a?a.remove(e.getObject3d()):s.remove(e.getObject3d()),e.isAdd&&(e.isAdd=!1,e._fire("remove",{target:e})),e._animation&&t.Util.isFunction(e._animation)&&delete r._animationBaseObjectMap[e.getObject3d().uuid];var n=r._delayMeshes;if(n.length)for(var i=0,u=n.length;i<u;i++)if(n[i]===e){n.splice(i,1);break}}else e instanceof o.Object3D&&s.remove(e)})),i){var u=this._getRenderer();u&&u.setToRedraw()}return this};var vj=function(){return rn((function t(e,n,r){var i=this;tn(this,t),this.map=n,this.animationId=null,this.updatables=[];var s=UB();this.threeLayer=new _u(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var a=function(){i.threeLayer._needsUpdate=!i.threeLayer._needsUpdate,i.threeLayer._needsUpdate&&i.threeLayer.redraw();var t,e=i.clock.getDelta(),n=on(i.updatables);try{for(n.s();!(t=n.n()).done;){t.value.tick(e)}}catch(t){n.e(t)}finally{n.f()}i.statsFlag&&i.stats.update(),i.animationId=requestAnimationFrame(a)};this.threeLayer.prepareToDraw=function(t,e,n){var r=new o.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),a()},null!=r&&r.groupLayer?this.threeLayer.addTo(r.groupLayer):this.threeLayer.addTo(n),this.groupLayer=null==r?void 0:r.groupLayer,this.layerId=s,this.layerName=e,this.dirty=!1,this.initFlag=!1,this.bloomFlag=(null==r?void 0:r.bloomFlag)||!1,this.bloomStrength=null==r?void 0:r.bloomStrength,this.bloomThreshold=null==r?void 0:r.bloomThreshold,this.bloomRadius=null==r?void 0:r.bloomRadius,this.hdrPath=null==r?void 0:r.hdrPath,this.ambientLightIntensity=(null==r?void 0:r.ambientLightIntensity)||1,this.stats=new UG,this.stats.dom.style.display="none",document.body.appendChild(this.stats.dom),this.statsFlag=!1}),[{key:"createGroup",value:(t=Ze(pn().mark((function t(e){return pn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,QB(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var n=t.getObjectByName(e);return n||(n=new CF(t,e)),n.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=UB();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate&&t.threeLayer.redraw();var n,r=t.clock.getDelta(),i=on(t.updatables);try{for(i.s();!(n=i.n()).done;){n.value.tick(r)}}catch(t){i.e(t)}finally{i.f()}t.statsFlag&&t.stats.update(),t.animationId=requestAnimationFrame(e)};return new Promise((function(n){var r=t;t.threeLayer.prepareToDraw=function(t,i,s){r.hdrPath&&this.initEnvironment(r.hdrPath);var a=new o.DirectionalLight(16777215,1*gj);a.position.set(0,-10,10).normalize(),i.add(a),i.add(new o.AmbientLight(16777215,r.ambientLightIntensity*gj)),e(),this.initBloom(),n()}}))}},{key:"drawRadar",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawRadar1",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new gT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new gT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawRadar2",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new yT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new yT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawRadar3",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new vT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new vT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSector",value:function(t,e,n,r){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new _T(t,e,n||{},i.threeLayer,r);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new _T(t,e,n||{},i.threeLayer,r);o(s)}))}))}},{key:"drawRing",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new HG(t,e,n,r||{},o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new HG(t,e,n,r||{},o.threeLayer,i);s(a)}))}))}},{key:"drawSectorImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawImage",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new shockEffect(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new shockEffect(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawPoybyHeight",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new zG(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new zG(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawSdfText",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=null;t.length>0?o=new cj(t,e,r.threeLayer,n):i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=null;t.length>0?o=new cj(t,e,r.threeLayer,n):i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new wF(t,e,n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new wF(t,e,n.threeLayer,n);r(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new IF(t,e.threeLayer);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new IF(t,e.threeLayer);n(r)}))}))}},{key:"drawFbxModel",value:function(t,e,n,r){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new IU(t,e,n,i.threeLayer,r);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new IU(t,e,n,i.threeLayer,r);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawWall",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new BU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new BU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new LQ(t,e,r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new LQ(t,e,r.threeLayer,n);i(o)}))}))}},{key:"createBloomClass",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new NG(e.threeLayer,t);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new NG(e.threeLayer,t);n(r)}))}))}},{key:"createOutlineBloom",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new FG(e.threeLayer,t);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new FG(e.threeLayer,t);n(r)}))}))}},{key:"drawPolyline",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new CQ(t,e,r.threeLayer,n);o.generatePolygon().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new CQ(t,e,r.threeLayer,n);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawExtrudePolygon",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new BQ(t,e,r.threeLayer,n);o.generatePolygon().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new BQ(t,e,r.threeLayer,n);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawTube",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripHeight1",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new mQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new mQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripLine1",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new _Q(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new _Q(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"setStateFlag",value:function(){this.statsFlag=!this.statsFlag,this.statsFlag?this.stats.dom.style.display="":this.stats.dom.style.display="none"}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.delComposer(),this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),n=this.threeLayer.getScene(),r=this.threeLayer.getPick(),i=r.pickingTexture;r.pickingScene;var o=this.threeLayer.getRenderer();n.remove(e),e=null,n=null,i.dispose(),i=null,this.groupLayer?this.groupLayer.removeLayer(this.threeLayer):(o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer))}}]);var t}(),mj=function(){return rn((function t(e,n){var r=this;tn(this,t),this.map=n,this.animationId=null,this.updatables=[];var i=UB();this.threeLayer=new _u(i,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var s=function(){var t;(r.threeLayer._needsUpdate=!r.threeLayer._needsUpdate,r.threeLayer._needsUpdate)&&(null===(t=r.threeLayer)||void 0===t||null===(t=t.getRenderer())||void 0===t||t.clearCanvas(),r.threeLayer.renderScene());var e,n=r.clock.getDelta(),i=on(r.updatables);try{for(i.s();!(e=i.n()).done;){e.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}r.animationId=requestAnimationFrame(s)};this.threeLayer.prepareToDraw=function(t,e,n){var r=new o.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),s()},this.threeLayer.addTo(n),this.layerId=i,this.layerName=e,this.dirty=!1,this.initFlag=!1}),[{key:"createGroup",value:(t=Ze(pn().mark((function t(e){return pn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,QB(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var n=t.getObjectByName(e);return n||(n=new CF(t,e)),n.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=UB();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){var n;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(n=t.threeLayer)||void 0===n||null===(n=n.getRenderer())||void 0===n||n.clearCanvas(),t.threeLayer.renderScene());var r,i=t.clock.getDelta(),o=on(t.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(n){t.threeLayer.prepareToDraw=function(t,r,i){var s=new o.DirectionalLight(16777215);s.position.set(0,-10,10).normalize(),r.add(s),r.add(new o.AmbientLight(16777215)),e(),n()}}))}},{key:"drawRadar",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSector",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new _T(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new _T(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawImage",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new ST(t,e||{},n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new ST(t,e||{},n.threeLayer,n);r(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new wF(t,e,n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new wF(t,e,n.threeLayer,n);r(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new IF(t,e.threeLayer);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new IF(t,e.threeLayer);n(r)}))}))}},{key:"drawFbxModel",value:function(t,e,n,r){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new IU(t,e,n,i.threeLayer,r);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new IU(t,e,n,i.threeLayer,r);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new CQ(t,e,r.threeLayer,n);o.generatePolygon().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new CQ(t,e,r.threeLayer,n);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawTube",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),n=this.threeLayer.getScene(),r=this.threeLayer.getPick(),i=r.pickingTexture;r.pickingScene;var o=this.threeLayer.getRenderer();n.remove(e),e=null,n=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]);var t}(),Aj=function(){return rn((function e(n,r,i,o){tn(this,e),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new t.DrawTool({mode:n,symbol:{lineColor:i.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:i.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=r,this.mode=n,this.toolLayer=new t.VectorLayer(t.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),i.zIndex&&this.toolLayer.setZIndex(i.zIndex),this.type="drawTool"}),[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}])}();function _j(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,n){for(;t>n;)t-=n-e;for(;t<e;)t+=n-e;return t},this._getRange=function(t,e,n){return null!=e&&(t=Math.max(t,e)),null!=n&&(t=Math.min(t,n)),t}}_j.prototype.BD2GCJ=function(t,e){var n=t-.0065,r=e-.006,i=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.x_PI),o=Math.atan2(r,n)-3e-6*Math.cos(n*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},_j.prototype.GCJ2BD=function(t,e){var n=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),r=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[n*Math.cos(r)+.0065,n*Math.sin(r)+.006]},_j.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var n=this._transformlat(t-105,e-35),r=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return n=180*n/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(r=180*r/(this.a/s*Math.cos(i)*this.PI)),e+n]},_j.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var n=this._transformlat(t-105,e-35),r=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return n=180*n/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(r=180*r/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+n)]},_j.prototype.WGS2BD=function(t,e){var n=this.WGS2GCJ(t,e);return n=this.GCJ2BD(n[0],n[1])},_j.prototype.BD2WGS=function(t,e){var n=this.BD2GCJ(t,e);return n=this.GCJ2WGS(n[0],n[1])},_j.prototype.BD_MKT2WGS=function(t,e){var n=null;t=Math.abs(t),e=Math.abs(e);for(var r=0;r<this.MCBAND.length;r++)if(e>=this.MCBAND[r]){n=this.MC2LL[r];break}t=n[0]+n[1]*Math.abs(t);var i=Math.abs(e)/n[9];return e=n[2]+n[3]*i+n[4]*i*i+n[5]*i*i*i+n[6]*i*i*i*i+n[7]*i*i*i*i*i+n[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},_j.prototype.BD_WGS2MKT=function(t,e){var n=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var r=0;r<this.LLBAND.length;r++)if(e>=this.LLBAND[r]){n=this.LL2MC[r];break}if(null!=n)for(r=this.LLBAND.length-1;r>=0;r--)if(e<=-this.LLBAND[r]){n=this.LL2MC[r];break}t=n[0]+n[1]*Math.abs(t);var i=Math.abs(e)/n[9];return e=n[2]+n[3]*i+n[4]*i*i+n[5]*i*i*i+n[6]*i*i*i*i+n[7]*i*i*i*i*i+n[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var xj=function(){return rn((function e(n,r,i){tn(this,e),this.map=r,this.overlayer=new t.VectorLayer("overLayer",{geometryEvents:!1,hitDetect:!1,forceRenderOnMoving:!0,forceRenderOnRotating:!0,enableSimplify:!1}),this.overlayer.addTo(this.map);var o=new t.MultiPolygon(n,{symbol:{polygonFill:i.color||"#000",polygonOpacity:i.opacity||1,lineWidth:0}});this.overlayer.addGeometry(o)}),[{key:"dispose",value:function(){this.map.removeLayer(this.overlayer),delete this.toolLayer}}])}();
|
|
189
|
+
*/const Az=dz({name:"FontResolver",dependencies:[function(t,e){const n=Object.create(null),r=Object.create(null);function i(e,i){let o=n[e];o?i(o):r[e]?r[e].push(i):(r[e]=[i],function(e,n){const r=t=>{console.error(`Failure loading font ${e}`,t)};try{const i=new XMLHttpRequest;i.open("get",e,!0),i.responseType="arraybuffer",i.onload=function(){if(i.status>=400)r(new Error(i.statusText));else if(i.status>0)try{const r=t(i.response);r.src=e,n(r)}catch(t){r(t)}},i.onerror=r,i.send()}catch(t){r(t)}}(e,(t=>{t.src=e,n[e]=t,r[e].forEach((e=>e(t))),delete r[e]})))}return function(t,r,{lang:o,fonts:s=[],style:a="normal",weight:u="normal",unicodeFontsURL:l}={}){const h=new Uint8Array(t.length),c=[];t.length||g();const f=new Map,p=[];if("italic"!==a&&(a="normal"),"number"!=typeof u&&(u="bold"===u?700:400),s&&!Array.isArray(s)&&(s=[s]),(s=s.slice().filter((t=>!t.lang||t.lang.test(o))).reverse()).length){const e=1,r=2;let o=0;!function a(u=0){for(let l=u,d=t.length;l<d;l++){const u=t.codePointAt(l);if(o===e&&c[h[l-1]].supportsCodePoint(u)||l>0&&/\s/.test(t[l]))h[l]=h[l-1],o===r&&(p[p.length-1][1]=l);else for(let t=h[l],d=s.length;t<=d;t++)if(t===d){(o===r?p[p.length-1]:p[p.length]=[l,l])[1]=l,o=r}else{h[l]=t;const{src:r,unicodeRange:p}=s[t];if(!p||y(u,p)){const t=n[r];if(!t)return void i(r,(()=>{a(l)}));if(t.supportsCodePoint(u)){let n=f.get(t);"number"!=typeof n&&(n=c.length,c.push(t),f.set(t,n)),h[l]=n,o=e;break}}}u>65535&&l+1<d&&(h[l+1]=h[l],l++,o===r&&(p[p.length-1][1]=l))}d()}()}else p.push([0,t.length-1]),d();function d(){if(p.length){const n=p.map((e=>t.substring(e[0],e[1]+1))).join("\n");e.getFontsForString(n,{lang:o||void 0,style:a,weight:u,dataUrl:l}).then((({fontUrls:t,chars:e})=>{const n=c.length;let r=0;p.forEach((t=>{for(let i=0,o=t[1]-t[0];i<=o;i++)h[t[0]+i]=e[r++]+n;r++}));let o=0;t.forEach(((e,r)=>{i(e,(e=>{c[r+n]=e,++o===t.length&&g()}))}))}))}else g()}function g(){r({chars:h,fonts:c})}function y(t,e){for(let n=0;n<e.length;n++){const[r,i=r]=e[n];if(r<=t&&t<=i)return!0}return!1}}},mz,function(){return function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(t){var e=t>>5;this.buckets.set(e,(this.buckets.get(e)||0)|1<<(31&t))},e.prototype.has=function(t){var e=this.buckets.get(t>>5);return void 0!==e&&!!(e&1<<(31&t))},e.prototype.serialize=function(){var t=[];return this.buckets.forEach((function(e,n){t.push((+n).toString(36)+":"+e.toString(36))})),t.join(",")},e.prototype.deserialize=function(t){var e=this;this.buckets.clear(),t.split(",").forEach((function(t){var n=t.split(":");e.buckets.set(parseInt(n[0],36),parseInt(n[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function o(t){var e=function(t){return t&i}(t).toString(16),r=function(t){return(t&i)+n-1}(t).toString(16);return"codepoint-index/plane"+(t>>16)+"/"+e+"-"+r+".json"}function s(t,e){var n=t&r,i=e.codePointAt(n/6|0);return!!((i=(i||48)-48)&1<<n%6)}function a(t,e){!function(t,e){var n;(n=t,n.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(t){return t.split("-").map((function(t){return parseInt(t.trim(),16)}))}))).forEach((function(t){var n=t[0],r=t[1];void 0===r&&(r=n),e(n,r)}))}(t,(function(t,n){for(var r=t;r<=n;r++)e(r)}))}var u={},l={},h=new WeakMap,c="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function f(t){var n=h.get(t);return n||(n=new e,a(t.ranges,(function(t){return n.add(t)})),h.set(t,n)),n}var p,d=new Map;function g(t,e,n){return t[e]?e:t[n]?n:function(t){for(var e in t)return e}(t)}function y(t,e){var n=e;if(!t.includes(n)){n=1/0;for(var r=0;r<t.length;r++)Math.abs(t[r]-e)<Math.abs(n-e)&&(n=t[r])}return n}function v(t){return p||(p=new Set,a("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(t){p.add(t)}))),p.has(t)}return t.CodePointSet=e,t.clearCache=function(){u={},l={}},t.getFontsForString=function(t,e){void 0===e&&(e={});var n,r=e.lang;void 0===r&&(r=/\p{Script=Hangul}/u.test(n=t)?"ko":/\p{Script=Hiragana}|\p{Script=Katakana}/u.test(n)?"ja":"en");var i=e.category;void 0===i&&(i="sans-serif");var a=e.style;void 0===a&&(a="normal");var h=e.weight;void 0===h&&(h=400);var p=(e.dataUrl||c).replace(/\/$/g,""),m=new Map,A=new Uint8Array(t.length),_={},x={},w=new Array(t.length),b=new Map,E=!1;function I(t){var e=d.get(t);return e||(e=fetch(p+"/"+t).then((function(t){if(!t.ok)throw new Error(t.statusText);return t.json().then((function(t){if(!Array.isArray(t)||1!==t[0])throw new Error("Incorrect schema version; need 1, got "+t[0]);return t[1]}))})).catch((function(e){if(p!==c)return E||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+p+'", trying default CDN. '+e.message),E=!0),p=c,d.delete(t),I(t);throw e})),d.set(t,e)),e}for(var C=function(e){var n=t.codePointAt(e),r=o(n);w[e]=r,u[r]||b.has(r)||b.set(r,I(r).then((function(t){u[r]=t}))),n>65535&&(e++,S=e)},S=0;S<t.length;S++)C(S);return Promise.all(b.values()).then((function(){b.clear();for(var e=function(e){var i=t.codePointAt(e),o=null,a=u[w[e]],h=void 0;for(var c in a){var f=x[c];if(void 0===f&&(f=x[c]=new RegExp(c).test(r||"en")),f){for(var p in h=c,a[c])if(s(i,a[c][p])){o=p;break}break}}if(!o)t:for(var d in a)if(d!==h)for(var g in a[d])if(s(i,a[d][g])){o=g;break t}o||(console.debug("No font coverage for U+"+i.toString(16)),o="latin"),w[e]=o,l[o]||b.has(o)||b.set(o,I("font-meta/"+o+".json").then((function(t){l[o]=t}))),i>65535&&(e++,n=e)},n=0;n<t.length;n++)e(n);return Promise.all(b.values())})).then((function(){for(var e,n=null,r=0;r<t.length;r++){var o=t.codePointAt(r);if(n&&(v(o)||f(n).has(o)))A[r]=A[r-1];else{n=l[w[r]];var s=_[n.id];if(!s){var u=n.typeforms,c=g(u,i,"sans-serif"),d=g(u[c],a,"normal"),x=y(null===(e=u[c])||void 0===e?void 0:e[d],h);s=_[n.id]=p+"/font-files/"+n.id+"/"+c+"."+d+"."+x+".woff"}var b=m.get(s);null==b&&(b=m.size,m.set(s,b)),A[r]=b}o>65535&&(r++,A[r]=A[r-1])}return{fontUrls:Array.from(m.keys()),chars:A}}))},Object.defineProperty(t,"__esModule",{value:!0}),t}({})}],init:(t,e,n)=>t(e,n())});const _z=()=>(self.performance||Date).now(),xz=vz();let wz;const bz=[];let Ez=0;function Iz(){const t=_z();for(;bz.length&&_z()-t<5;)bz.shift()();Ez=bz.length?setTimeout(Iz,0):0}const Cz=(...t)=>new Promise(((e,n)=>{bz.push((()=>{const r=_z();try{xz.webgl.generateIntoCanvas(...t),e({timing:_z()-r})}catch(t){n(t)}})),Ez||(Ez=setTimeout(Iz,0))})),Sz=4,Mz=2e3,Bz={};let Tz=0;function kz(t,e,n,r,i,o,s,a,u,l){const h="TroikaTextSDFGenerator_JS_"+Tz++%Sz;let c=Bz[h];return c||(c=Bz[h]={workerModule:dz({name:h,workerId:h,dependencies:[vz,_z],init(t,e){const n=t().javascript.generate;return function(...t){const r=e();return{textureData:n(...t),timing:e()-r}}},getTransferables:t=>[t.textureData.buffer]}),requests:0,idleTimer:null}),c.requests++,clearTimeout(c.idleTimer),c.workerModule(t,e,n,r,i,o).then((({textureData:n,timing:r})=>{const i=_z(),o=new Uint8Array(4*n.length);for(let t=0;t<n.length;t++)o[4*t+l]=n[t];return xz.webglUtils.renderImageData(s,o,a,u,t,e,1<<3-l),r+=_z()-i,0==--c.requests&&(c.idleTimer=setTimeout((()=>{!function(t){fz[t]&&fz[t].forEach((function(t){t()})),cz[t]&&(cz[t].terminate(),delete cz[t])}(h)}),Mz)),{timing:r}}))}const Pz=xz.webglUtils.resizeWebGLCanvasWithoutClearing,Lz={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},Rz=new c;function Dz(){return(self.performance||Date).now()}const Oz=Object.create(null);function Nz(t,e){t=function(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}({},t);const n=Dz(),{defaultFontURL:r}=Lz,i=[];if(r&&i.push({label:"default",src:Qz(r)}),t.font&&i.push({label:"user",src:Qz(t.font)}),t.font=i,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||Lz.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||Lz.unicodeFontsURL,null!=t.colorRanges){let e={};for(let n in t.colorRanges)if(t.colorRanges.hasOwnProperty(n)){let r=t.colorRanges[n];"number"!=typeof r&&(r=Rz.set(r).getHex()),e[n]=r}t.colorRanges=e}Object.freeze(t);const{textureWidth:o,sdfExponent:s}=Lz,{sdfGlyphSize:a}=t,u=o/a*4;let l=Oz[a];if(!l){const t=document.createElement("canvas");t.width=o,t.height=256*a/u,l=Oz[a]={glyphCount:0,sdfGlyphSize:a,sdfCanvas:t,sdfTexture:new ct(t,void 0,void 0,void 0,w,w),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,function(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",(e=>{console.log("Context Lost",e),e.preventDefault(),t.contextLost=!0})),e.addEventListener("webglcontextrestored",(e=>{console.log("Context Restored",e),t.contextLost=!1;const n=[];t.glyphsByFont.forEach((e=>{e.forEach((e=>{n.push(Fz(e,t,!0))}))})),Promise.all(n).then((()=>{Gz(t),t.sdfTexture.needsUpdate=!0}))}))}(l)}const{sdfTexture:h,sdfCanvas:c}=l;jz(t).then((r=>{const{glyphIds:i,glyphFontIndices:f,fontData:p,glyphPositions:d,fontSize:g,timings:y}=r,v=[],m=new Float32Array(4*i.length);let A=0,_=0;const x=Dz(),w=p.map((t=>{let e=l.glyphsByFont.get(t.src);return e||l.glyphsByFont.set(t.src,e=new Map),e}));i.forEach(((t,e)=>{const n=f[e],{src:o,unitsPerEm:s}=p[n];let u=w[n].get(t);if(!u){const{path:e,pathBounds:i}=r.glyphData[o][t],s=Math.max(i[2]-i[0],i[3]-i[1])/a*(Lz.sdfMargin*a+.5),h=l.glyphCount++,c=[i[0]-s,i[1]-s,i[2]+s,i[3]+s];w[n].set(t,u={path:e,atlasIndex:h,sdfViewBox:c}),v.push(u)}const{sdfViewBox:h}=u,c=d[_++],y=d[_++],x=g/s;m[A++]=c+h[0]*x,m[A++]=y+h[1]*x,m[A++]=c+h[2]*x,m[A++]=y+h[3]*x,i[e]=u.atlasIndex})),y.quads=(y.quads||0)+(Dz()-x);const b=Dz();y.sdf={};const E=c.height,I=Math.ceil(l.glyphCount/u),C=Math.pow(2,Math.ceil(Math.log2(I*a)));C>E&&(console.info(`Increasing SDF texture size ${E}->${C}`),Pz(c,o,C),h.dispose()),Promise.all(v.map((e=>Fz(e,l,t.gpuAccelerateSDF).then((({timing:t})=>{y.sdf[e.atlasIndex]=t}))))).then((()=>{v.length&&!l.contextLost&&(Gz(l),h.needsUpdate=!0),y.sdfTotal=Dz()-b,y.total=Dz()-n,e(Object.freeze({parameters:t,sdfTexture:h,sdfGlyphSize:a,sdfExponent:s,glyphBounds:m,glyphAtlasIndices:i,glyphColors:r.glyphColors,caretPositions:r.caretPositions,chunkedBounds:r.chunkedBounds,ascender:r.ascender,descender:r.descender,lineHeight:r.lineHeight,capHeight:r.capHeight,xHeight:r.xHeight,topBaseline:r.topBaseline,blockBounds:r.blockBounds,visibleBounds:r.visibleBounds,timings:r.timings}))}))})),Promise.resolve().then((()=>{l.contextLost||function(t){t._warm||(xz.webgl.isSupported(t),t._warm=!0)}(c)}))}function Fz({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:r,sdfCanvas:i,contextLost:o},s){if(o)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:u}=Lz,l=Math.max(n[2]-n[0],n[3]-n[1]),h=Math.floor(e/4);return function(t,e,n,r,i,o,s,a,u,l,h=!0){return h?Cz(t,e,n,r,i,o,s,a,u,l).then(null,(h=>(wz||(console.warn("WebGL SDF generation failed, falling back to JS",h),wz=!0),kz(t,e,n,r,i,o,s,a,u,l)))):kz(t,e,n,r,i,o,s,a,u,l)}(r,r,t,n,l,u,i,h%(a/r)*r,Math.floor(h/(a/r))*r,e%4,s)}let Uz;function Qz(t){return Uz||(Uz="undefined"==typeof document?{}:document.createElement("a")),Uz.href=t,Uz.href}function Gz(t){if("function"!=typeof createImageBitmap){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:n}=t,{width:r,height:i}=e,o=t.sdfCanvas.getContext("webgl");let s=n.image.data;s&&s.length===r*i*4||(s=new Uint8Array(r*i*4),n.image={width:r,height:i,data:s},n.flipY=!1,n.isDataTexture=!0),o.readPixels(0,0,r,i,o.RGBA,o.UNSIGNED_BYTE,s)}}const zz=dz({name:"Typesetter",dependencies:[function(t,e){const n=1/0,r=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",o=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function s({text:s="",font:c,lang:f,sdfGlyphSize:p=64,fontSize:d=400,fontWeight:g=1,fontStyle:y="normal",letterSpacing:v=0,lineHeight:m="normal",maxWidth:A=n,direction:_,textAlign:x="left",textIndent:w=0,whiteSpace:b="normal",overflowWrap:E="normal",anchorX:I=0,anchorY:C=0,metricsOnly:S=!1,unicodeFontsURL:M,preResolvedFonts:B=null,includeCaretPositions:T=!1,chunkedBoundsSize:k=8192,colorRanges:P=null},L){const R=l(),D={fontLoad:0,typesetting:0};s.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),s=s.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),d=+d,v=+v,A=+A,m=m||"normal",w=+w,function({text:e,lang:n,fonts:r,style:i,weight:o,preResolvedFonts:s,unicodeFontsURL:a},u){const l=({chars:t,fonts:e})=>{let n,r;const i=[];for(let o=0;o<t.length;o++)t[o]!==r?(r=t[o],i.push(n={start:o,end:o,fontObj:e[t[o]]})):n.end=o;u(i)};s?l(s):t(e,l,{lang:n,fonts:r,style:i,weight:o,unicodeFontsURL:a})}({text:s,lang:f,style:y,weight:g,fonts:"string"==typeof c?[{src:c}]:c,unicodeFontsURL:M,preResolvedFonts:B},(t=>{D.fontLoad=l()-R;const c=isFinite(A);let f=null,p=null,g=null,y=null,M=null,B=null,O=null,N=null,F=0,U=0,Q="nowrap"!==b;const G=new Map,z=l();let j=w,V=0,q=new h;const H=[q];t.forEach((t=>{const{fontObj:e}=t,{ascender:n,descender:a,unitsPerEm:u,lineGap:l,capHeight:f,xHeight:p}=e;let g=G.get(e);if(!g){const t=d/u,r="normal"===m?(n-a+l)*t:m*d,i=(r-(n-a)*t)/2,o=Math.min(r,(n-a)*t),s=(n+a)/2*t+o/2;g={index:G.size,src:e.src,fontObj:e,fontSizeMult:t,unitsPerEm:u,ascender:n*t,descender:a*t,capHeight:f*t,xHeight:p*t,lineHeight:r,baseline:-i-n*t,caretTop:s,caretBottom:s-o},G.set(e,g)}const{fontSizeMult:y}=g,_=s.slice(t.start,t.end+1);let x,b;e.forEachGlyph(_,d,v,((e,n,a,u)=>{n+=V,u+=t.start,x=n,b=e;const l=s.charAt(u),f=e.advanceWidth*y,p=q.count;let m;if("isEmpty"in e||(e.isWhitespace=!!l&&new RegExp(i).test(l),e.canBreakAfter=!!l&&o.test(l),e.isEmpty=e.xMin===e.xMax||e.yMin===e.yMax||r.test(l)),e.isWhitespace||e.isEmpty||U++,Q&&c&&!e.isWhitespace&&n+f+j>A&&p){if(q.glyphAt(p-1).glyphObj.canBreakAfter)m=new h,j=-n;else for(let t=p;t--;){if(0===t&&"break-word"===E){m=new h,j=-n;break}if(q.glyphAt(t).glyphObj.canBreakAfter){m=q.splitAt(t+1);const e=m.glyphAt(0).x;j-=e;for(let t=m.count;t--;)m.glyphAt(t).x-=e;break}}m&&(q.isSoftWrapped=!0,q=m,H.push(q),F=A)}let _=q.glyphAt(q.count);_.glyphObj=e,_.x=n+j,_.y=a,_.width=f,_.charIndex=u,_.fontData=g,"\n"===l&&(q=new h,H.push(q),j=-(n+f+v*d)+w)})),V=x+b.advanceWidth*y+v*d}));let W=0;H.forEach((t=>{let e=!0;for(let n=t.count;n--;){const r=t.glyphAt(n);e&&!r.glyphObj.isWhitespace&&(t.width=r.x+r.width,t.width>F&&(F=t.width),e=!1);let{lineHeight:i,capHeight:o,xHeight:s,baseline:a}=r.fontData;i>t.lineHeight&&(t.lineHeight=i);const u=a-t.baseline;u<0&&(t.baseline+=u,t.cap+=u,t.ex+=u),t.cap=Math.max(t.cap,t.baseline+o),t.ex=Math.max(t.ex,t.baseline+s)}t.baseline-=W,t.cap-=W,t.ex-=W,W+=t.lineHeight}));let Y=0,X=0;if(I&&("number"==typeof I?Y=-I:"string"==typeof I&&(Y=-F*("left"===I?0:"center"===I?.5:"right"===I?1:a(I)))),C&&("number"==typeof C?X=-C:"string"==typeof C&&(X="top"===C?0:"top-baseline"===C?-H[0].baseline:"top-cap"===C?-H[0].cap:"top-ex"===C?-H[0].ex:"middle"===C?W/2:"bottom"===C?W:"bottom-baseline"===C?-H[H.length-1].baseline:a(C)*W)),!S){const t=e.getEmbeddingLevels(s,_);f=new Uint16Array(U),p=new Uint8Array(U),g=new Float32Array(2*U),y={},O=[n,n,-1/0,-1/0],N=[],T&&(B=new Float32Array(4*s.length)),P&&(M=new Uint8Array(3*U));let r,i,o=0,a=-1,l=-1;if(H.forEach(((h,c)=>{let{count:d,width:v}=h;if(d>0){let c=0;for(let t=d;t--&&h.glyphAt(t).glyphObj.isWhitespace;)c++;let m=0,A=0;if("center"===x)m=(F-v)/2;else if("right"===x)m=F-v;else if("justify"===x&&h.isSoftWrapped){let t=0;for(let e=d-c;e--;)h.glyphAt(e).glyphObj.isWhitespace&&t++;A=(F-v)/t}if(A||m){let t=0;for(let e=0;e<d;e++){let n=h.glyphAt(e);const r=n.glyphObj;n.x+=m+t,0!==A&&r.isWhitespace&&e<d-c&&(t+=A,n.width+=A)}}const _=e.getReorderSegments(s,t,h.glyphAt(0).charIndex,h.glyphAt(h.count-1).charIndex);for(let t=0;t<_.length;t++){const[e,n]=_[t];let r=1/0,i=-1/0;for(let t=0;t<d;t++)if(h.glyphAt(t).charIndex>=e){let e=t,o=t;for(;o<d;o++){let t=h.glyphAt(o);if(t.charIndex>n)break;o<d-c&&(r=Math.min(r,t.x),i=Math.max(i,t.x+t.width))}for(let t=e;t<o;t++){const e=h.glyphAt(t);e.x=i-(e.x+e.width-r)}break}}let w;const b=t=>w=t;for(let c=0;c<d;c++){const d=h.glyphAt(c);w=d.glyphObj;const v=w.index,m=1&t.levels[d.charIndex];if(m){const t=e.getMirroredCharacter(s[d.charIndex]);t&&d.fontData.fontObj.forEachGlyph(t,0,0,b)}if(T){const{charIndex:t,fontData:e}=d,n=d.x+Y,r=d.x+d.width+Y;B[4*t]=m?r:n,B[4*t+1]=m?n:r,B[4*t+2]=h.baseline+e.caretBottom+X,B[4*t+3]=h.baseline+e.caretTop+X;const i=t-a;i>1&&u(B,a,i),a=t}if(P){const{charIndex:t}=d;for(;t>l;)l++,P.hasOwnProperty(l)&&(i=P[l])}if(!w.isWhitespace&&!w.isEmpty){const t=o++,{fontSizeMult:e,src:s,index:a}=d.fontData,u=y[s]||(y[s]={});u[v]||(u[v]={path:w.path,pathBounds:[w.xMin,w.yMin,w.xMax,w.yMax]});const l=d.x+Y,c=d.y+h.baseline+X;g[2*t]=l,g[2*t+1]=c;const m=l+w.xMin*e,A=c+w.yMin*e,_=l+w.xMax*e,x=c+w.yMax*e;m<O[0]&&(O[0]=m),A<O[1]&&(O[1]=A),_>O[2]&&(O[2]=_),x>O[3]&&(O[3]=x),t%k==0&&(r={start:t,end:t,rect:[n,n,-1/0,-1/0]},N.push(r)),r.end++;const b=r.rect;if(m<b[0]&&(b[0]=m),A<b[1]&&(b[1]=A),_>b[2]&&(b[2]=_),x>b[3]&&(b[3]=x),f[t]=v,p[t]=a,P){const e=3*t;M[e]=i>>16&255,M[e+1]=i>>8&255,M[e+2]=255&i}}}}})),B){const t=s.length-a;t>1&&u(B,a,t)}}const J=[];G.forEach((({index:t,src:e,unitsPerEm:n,ascender:r,descender:i,lineHeight:o,capHeight:s,xHeight:a})=>{J[t]={src:e,unitsPerEm:n,ascender:r,descender:i,lineHeight:o,capHeight:s,xHeight:a}})),D.typesetting=l()-z,L({glyphIds:f,glyphFontIndices:p,glyphPositions:g,glyphData:y,fontData:J,caretPositions:B,glyphColors:M,chunkedBounds:N,fontSize:d,topBaseline:X+H[0].baseline,blockBounds:[Y,X-W,Y+F,X],visibleBounds:O,timings:D})}))}function a(t){let e=t.match(/^([\d.]+)%$/),n=e?parseFloat(e[1]):NaN;return isNaN(n)?0:n/100}function u(t,e,n){const r=t[4*e],i=t[4*e+1],o=t[4*e+2],s=t[4*e+3],a=(i-r)/n;for(let i=0;i<n;i++){const n=4*(e+i);t[n]=r+a*i,t[n+1]=r+a*(i+1),t[n+2]=o,t[n+3]=s}}function l(){return(self.performance||Date).now()}function h(){this.data=[]}const c=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/c.length)},glyphAt(t){let e=h.flyweight;return e.data=this.data,e.index=t,e},splitAt(t){let e=new h;return e.data=this.data.splice(t*c.length),e}},h.flyweight=c.reduce(((t,e,n,r)=>(Object.defineProperty(t,e,{get(){return this.data[this.index*c.length+n]},set(t){this.data[this.index*c.length+n]=t}}),t)),{data:null,index:0}),{typeset:s,measure:function(t,e){s({...t,metricsOnly:!0},(t=>{const[n,r,i,o]=t.blockBounds;e({width:i-n,height:o-r})}))}}},Az,function(){var t=function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},n={},r={};n.L=1,r[1]="L",Object.keys(e).forEach((function(t,e){n[t]=1<<e+1,r[n[t]]=t})),Object.freeze(n);var i=n.LRI|n.RLI|n.FSI,o=n.L|n.R|n.AL,s=n.B|n.S|n.WS|n.ON|n.FSI|n.LRI|n.RLI|n.PDI,a=n.BN|n.RLE|n.LRE|n.RLO|n.LRO|n.PDF,u=n.S|n.WS|n.B|i|n.PDI|a,l=null;function h(t){return function(){if(!l){l=new Map;var t=function(t){if(e.hasOwnProperty(t)){var r=0;e[t].split(",").forEach((function(e){var i=e.split("+"),o=i[0],s=i[1];o=parseInt(o,36),s=s?parseInt(s,36):0,l.set(r+=o,n[t]);for(var a=0;a<s;a++)l.set(++r,n[t])}))}};for(var r in e)t(r)}}(),l.get(t.codePointAt(0))||n.L}var c,f,p,d="14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",g="6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye";function y(t,e){var n,r=0,i=new Map,o=e&&new Map;return t.split(",").forEach((function t(s){if(-1!==s.indexOf("+"))for(var a=+s;a--;)t(n);else{n=s;var u=s.split(">"),l=u[0],h=u[1];l=String.fromCodePoint(r+=parseInt(l,36)),h=String.fromCodePoint(r+=parseInt(h,36)),i.set(l,h),e&&o.set(h,l)}})),{map:i,reverseMap:o}}function v(){if(!c){var t=y(d,!0),e=t.map,n=t.reverseMap;c=e,f=n,p=y(g,!1).map}}function m(t){return v(),c.get(t)||null}function A(t){return v(),f.get(t)||null}function _(t){return v(),p.get(t)||null}var x=n.L,w=n.R,b=n.EN,E=n.ES,I=n.ET,C=n.AN,S=n.CS,M=n.B,B=n.S,T=n.ON,k=n.BN,P=n.NSM,L=n.AL,R=n.LRO,D=n.RLO,O=n.LRE,N=n.RLE,F=n.PDF,U=n.LRI,Q=n.RLI,G=n.FSI,z=n.PDI;var j;function V(t){return function(){if(!j){var t=y("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),e=t.map;t.reverseMap.forEach((function(t,n){e.set(n,t)})),j=e}}(),j.get(t)||null}function q(t,e,n,r){var i=t.length;n=Math.max(0,null==n?0:+n),r=Math.min(i-1,null==r?i-1:+r);var o=[];return e.paragraphs.forEach((function(i){var s=Math.max(n,i.start),a=Math.min(r,i.end);if(s<a){for(var l=e.levels.slice(s,a+1),c=a;c>=s&&h(t[c])&u;c--)l[c]=i.level;for(var f=i.level,p=1/0,d=0;d<l.length;d++){var g=l[d];g>f&&(f=g),g<p&&(p=1|g)}for(var y=f;y>=p;y--)for(var v=0;v<l.length;v++)if(l[v]>=y){for(var m=v;v+1<l.length&&l[v+1]>=y;)v++;v>m&&o.push([m+s,v+s])}}})),o}function H(t,e,n,r){for(var i=q(t,e,n,r),o=[],s=0;s<t.length;s++)o[s]=s;return i.forEach((function(t){for(var e=t[0],n=t[1],r=o.slice(e,n+1),i=r.length;i--;)o[n-i]=r[i]})),o}return t.closingToOpeningBracket=A,t.getBidiCharType=h,t.getBidiCharTypeName=function(t){return r[h(t)]},t.getCanonicalBracket=_,t.getEmbeddingLevels=function(t,e){for(var n=new Uint32Array(t.length),r=0;r<t.length;r++)n[r]=h(t[r]);var l=new Map;function c(t,e){var r=n[t];n[t]=e,l.set(r,l.get(r)-1),r&s&&l.set(s,l.get(s)-1),l.set(e,(l.get(e)||0)+1),e&s&&l.set(s,(l.get(s)||0)+1)}for(var f=new Uint8Array(t.length),p=new Map,d=[],g=null,y=0;y<t.length;y++)g||d.push(g={start:y,end:t.length-1,level:"rtl"===e?1:"ltr"===e?0:Ge(y,!1)}),n[y]&M&&(g.end=y,g=null);for(var v=N|O|D|R|i|z|F|M,j=function(t){return t+(1&t?1:2)},V=function(t){return t+(1&t?2:1)},q=0;q<d.length;q++){var H=[{_level:(g=d[q]).level,_override:0,_isolate:0}],W=void 0,Y=0,X=0,J=0;l.clear();for(var K=g.start;K<=g.end;K++){var Z=n[K];if(W=H[H.length-1],l.set(Z,(l.get(Z)||0)+1),Z&s&&l.set(s,(l.get(s)||0)+1),Z&v)if(Z&(N|O)){f[K]=W._level;var $=(Z===N?V:j)(W._level);$<=125&&!Y&&!X?H.push({_level:$,_override:0,_isolate:0}):Y||X++}else if(Z&(D|R)){f[K]=W._level;var tt=(Z===D?V:j)(W._level);tt<=125&&!Y&&!X?H.push({_level:tt,_override:Z&D?w:x,_isolate:0}):Y||X++}else if(Z&i){Z&G&&(Z=1===Ge(K+1,!0)?Q:U),f[K]=W._level,W._override&&c(K,W._override);var et=(Z===Q?V:j)(W._level);et<=125&&0===Y&&0===X?(J++,H.push({_level:et,_override:0,_isolate:1,_isolInitIndex:K})):Y++}else if(Z&z){if(Y>0)Y--;else if(J>0){for(X=0;!H[H.length-1]._isolate;)H.pop();var nt=H[H.length-1]._isolInitIndex;null!=nt&&(p.set(nt,K),p.set(K,nt)),H.pop(),J--}W=H[H.length-1],f[K]=W._level,W._override&&c(K,W._override)}else Z&F?(0===Y&&(X>0?X--:!W._isolate&&H.length>1&&(H.pop(),W=H[H.length-1])),f[K]=W._level):Z&M&&(f[K]=g.level);else f[K]=W._level,W._override&&Z!==k&&c(K,W._override)}for(var rt=[],it=null,ot=g.start;ot<=g.end;ot++){var st=n[ot];if(!(st&a)){var at=f[ot],ut=st&i,lt=st===z;it&&at===it._level?(it._end=ot,it._endsWithIsolInit=ut):rt.push(it={_start:ot,_end:ot,_level:at,_startsWithPDI:lt,_endsWithIsolInit:ut})}}for(var ht=[],ct=0;ct<rt.length;ct++){var ft=rt[ct];if(!ft._startsWithPDI||ft._startsWithPDI&&!p.has(ft._start)){for(var pt=[it=ft],dt=void 0;it&&it._endsWithIsolInit&&null!=(dt=p.get(it._end));)for(var gt=ct+1;gt<rt.length;gt++)if(rt[gt]._start===dt){pt.push(it=rt[gt]);break}for(var yt=[],vt=0;vt<pt.length;vt++)for(var mt=pt[vt],At=mt._start;At<=mt._end;At++)yt.push(At);for(var _t=f[yt[0]],xt=g.level,wt=yt[0]-1;wt>=0;wt--)if(!(n[wt]&a)){xt=f[wt];break}var bt=yt[yt.length-1],Et=f[bt],It=g.level;if(!(n[bt]&i))for(var Ct=bt+1;Ct<=g.end;Ct++)if(!(n[Ct]&a)){It=f[Ct];break}ht.push({_seqIndices:yt,_sosType:Math.max(xt,_t)%2?w:x,_eosType:Math.max(It,Et)%2?w:x})}}for(var St=0;St<ht.length;St++){var Mt=ht[St],Bt=Mt._seqIndices,Tt=Mt._sosType,kt=Mt._eosType,Pt=1&f[Bt[0]]?w:x;if(l.get(P))for(var Lt=0;Lt<Bt.length;Lt++){var Rt=Bt[Lt];if(n[Rt]&P){for(var Dt=Tt,Ot=Lt-1;Ot>=0;Ot--)if(!(n[Bt[Ot]]&a)){Dt=n[Bt[Ot]];break}c(Rt,Dt&(i|z)?T:Dt)}}if(l.get(b))for(var Nt=0;Nt<Bt.length;Nt++){var Ft=Bt[Nt];if(n[Ft]&b)for(var Ut=Nt-1;Ut>=-1;Ut--){var Qt=-1===Ut?Tt:n[Bt[Ut]];if(Qt&o){Qt===L&&c(Ft,C);break}}}if(l.get(L))for(var Gt=0;Gt<Bt.length;Gt++){var zt=Bt[Gt];n[zt]&L&&c(zt,w)}if(l.get(E)||l.get(S))for(var jt=1;jt<Bt.length-1;jt++){var Vt=Bt[jt];if(n[Vt]&(E|S)){for(var qt=0,Ht=0,Wt=jt-1;Wt>=0&&(qt=n[Bt[Wt]])&a;Wt--);for(var Yt=jt+1;Yt<Bt.length&&(Ht=n[Bt[Yt]])&a;Yt++);qt===Ht&&(n[Vt]===E?qt===b:qt&(b|C))&&c(Vt,qt)}}if(l.get(b))for(var Xt=0;Xt<Bt.length;Xt++){var Jt=Bt[Xt];if(n[Jt]&b){for(var Kt=Xt-1;Kt>=0&&n[Bt[Kt]]&(I|a);Kt--)c(Bt[Kt],b);for(Xt++;Xt<Bt.length&&n[Bt[Xt]]&(I|a|b);Xt++)n[Bt[Xt]]!==b&&c(Bt[Xt],b)}}if(l.get(I)||l.get(E)||l.get(S))for(var Zt=0;Zt<Bt.length;Zt++){var $t=Bt[Zt];if(n[$t]&(I|E|S)){c($t,T);for(var te=Zt-1;te>=0&&n[Bt[te]]&a;te--)c(Bt[te],T);for(var ee=Zt+1;ee<Bt.length&&n[Bt[ee]]&a;ee++)c(Bt[ee],T)}}if(l.get(b))for(var ne=0,re=Tt;ne<Bt.length;ne++){var ie=Bt[ne],oe=n[ie];oe&b?re===x&&c(ie,x):oe&o&&(re=oe)}if(l.get(s)){for(var se=w|b|C,ae=se|x,ue=[],le=[],he=0;he<Bt.length;he++)if(n[Bt[he]]&s){var ce=t[Bt[he]],fe=void 0;if(null!==m(ce)){if(!(le.length<63))break;le.push({char:ce,seqIndex:he})}else if(null!==(fe=A(ce)))for(var pe=le.length-1;pe>=0;pe--){var de=le[pe].char;if(de===fe||de===A(_(ce))||m(_(de))===ce){ue.push([le[pe].seqIndex,he]),le.length=pe;break}}}ue.sort((function(t,e){return t[0]-e[0]}));for(var ge=0;ge<ue.length;ge++){for(var ye=ue[ge],ve=ye[0],me=ye[1],Ae=!1,_e=0,xe=ve+1;xe<me;xe++){var we=Bt[xe];if(n[we]&ae){Ae=!0;var be=n[we]&se?w:x;if(be===Pt){_e=be;break}}}if(Ae&&!_e){_e=Tt;for(var Ee=ve-1;Ee>=0;Ee--){var Ie=Bt[Ee];if(n[Ie]&ae){var Ce=n[Ie]&se?w:x;_e=Ce!==Pt?Ce:Pt;break}}}if(_e){if(n[Bt[ve]]=n[Bt[me]]=_e,_e!==Pt)for(var Se=ve+1;Se<Bt.length;Se++)if(!(n[Bt[Se]]&a)){h(t[Bt[Se]])&P&&(n[Bt[Se]]=_e);break}if(_e!==Pt)for(var Me=me+1;Me<Bt.length;Me++)if(!(n[Bt[Me]]&a)){h(t[Bt[Me]])&P&&(n[Bt[Me]]=_e);break}}}for(var Be=0;Be<Bt.length;Be++)if(n[Bt[Be]]&s){for(var Te=Be,ke=Be,Pe=Tt,Le=Be-1;Le>=0;Le--){if(!(n[Bt[Le]]&a)){Pe=n[Bt[Le]]&se?w:x;break}Te=Le}for(var Re=kt,De=Be+1;De<Bt.length;De++){if(!(n[Bt[De]]&(s|a))){Re=n[Bt[De]]&se?w:x;break}ke=De}for(var Oe=Te;Oe<=ke;Oe++)n[Bt[Oe]]=Pe===Re?Pe:Pt;Be=ke}}}for(var Ne=g.start;Ne<=g.end;Ne++){var Fe=f[Ne],Ue=n[Ne];if(1&Fe?Ue&(x|b|C)&&f[Ne]++:Ue&w?f[Ne]++:Ue&(C|b)&&(f[Ne]+=2),Ue&a&&(f[Ne]=0===Ne?g.level:f[Ne-1]),Ne===g.end||h(t[Ne])&(B|M))for(var Qe=Ne;Qe>=0&&h(t[Qe])&u;Qe--)f[Qe]=g.level}}return{levels:f,paragraphs:d};function Ge(e,r){for(var o=e;o<t.length;o++){var s=n[o];if(s&(w|L))return 1;if(s&(M|x)||r&&s===z)return 0;if(s&i){var a=ze(o);o=-1===a?t.length:a}}return 0}function ze(e){for(var r=1,o=e+1;o<t.length;o++){var s=n[o];if(s&M)break;if(s&z){if(0==--r)return o}else s&i&&r++}return-1}},t.getMirroredCharacter=V,t.getMirroredCharactersMap=function(t,e,n,r){var i=t.length;n=Math.max(0,null==n?0:+n),r=Math.min(i-1,null==r?i-1:+r);for(var o=new Map,s=n;s<=r;s++)if(1&e[s]){var a=V(t[s]);null!==a&&o.set(s,a)}return o},t.getReorderSegments=q,t.getReorderedIndices=H,t.getReorderedString=function(t,e,n,r){var i=H(t,e,n,r),o=[].concat(t);return i.forEach((function(n,r){o[r]=(1&e.levels[n]?V(t[n]):null)||t[n]})),o.join("")},t.openingToClosingBracket=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({});return t}],init:(t,e,n)=>t(e,n())}),jz=dz({name:"Typesetter",dependencies:[zz],init:t=>function(e){return new Promise((n=>{t.typeset(e,n)}))},getTransferables(t){const e=[];for(let n in t)t[n]&&t[n].buffer&&e.push(t[n].buffer);return e}});jz.onMainThread;const Vz={};const qz="aTroikaGlyphIndex";class Hz extends Ee{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new yt,this.boundingBox=new gt}computeBoundingSphere(){}computeBoundingBox(){}set detail(t){if(t!==this._detail){this._detail=t,("number"!=typeof t||t<1)&&(t=1);let e=function(t){let e=Vz[t];return e||(e=Vz[t]=new Qt(1,1,t,t).translate(.5,.5,0)),e}(t);["position","normal","uv"].forEach((t=>{this.attributes[t]=e.attributes[t].clone()})),this.setIndex(e.getIndex().clone())}}get detail(){return this._detail}set curveRadius(t){t!==this._curveRadius&&(this._curveRadius=t,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(t,e,n,r,i){this.updateAttributeData("aTroikaGlyphBounds",t,4),this.updateAttributeData(qz,e,1),this.updateAttributeData("aTroikaGlyphColor",i,3),this._blockBounds=n,this._chunkedBounds=r,this.instanceCount=e.length,this._updateBounds()}_updateBounds(){const t=this._blockBounds;if(t){const{curveRadius:e,boundingBox:n}=this;if(e){const{PI:r,floor:i,min:o,max:s,sin:a,cos:u}=Math,l=r/2,h=2*r,c=Math.abs(e),f=t[0]/c,p=t[2]/c,d=i((f+l)/h)!==i((p+l)/h)?-c:o(a(f)*c,a(p)*c),g=i((f-l)/h)!==i((p-l)/h)?c:s(a(f)*c,a(p)*c),y=i((f+r)/h)!==i((p+r)/h)?2*c:s(c-u(f)*c,c-u(p)*c);n.min.set(d,t[1],e<0?-y:0),n.max.set(g,t[3],e<0?0:y)}else n.min.set(t[0],t[1],0),n.max.set(t[2],t[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(t){let e=this.getAttribute(qz).count,n=this._chunkedBounds;if(n)for(let r=n.length;r--;){e=n[r].end;let i=n[r].rect;if(i[1]<t.w&&i[3]>t.y&&i[0]<t.z&&i[2]>t.x)break}this.instanceCount=e}updateAttributeData(t,e,n){const r=this.getAttribute(t);e?r&&r.array.length===e.length?(r.array.set(e),r.needsUpdate=!0):(this.setAttribute(t,new tt(e,n)),delete this._maxInstanceCount,this.dispose()):r&&this.deleteAttribute(t)}}const Wz=new v({color:16777215,side:B,transparent:!0}),Yz=8421504,Xz=new p,Jz=new Z,Kz=new Z,Zz=[],$z=new Z,tj="+x+y";function ej(t){return Array.isArray(t)?t[0]:t}let nj=()=>{const t=new L(new Qt(1,1),Wz);return nj=()=>t,t},rj=()=>{const t=new L(new Qt(1,1,32,1),Wz);return rj=()=>t,t};const ij={type:"syncstart"},oj={type:"synccomplete"},sj=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],aj=sj.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class uj extends L{constructor(){super(new Hz,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Yz,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=tj,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(t){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(t):(this._isSyncing=!0,this.dispatchEvent(ij),Nz({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},(e=>{this._isSyncing=!1,this._textRenderInfo=e,this.geometry.updateGlyphs(e.glyphBounds,e.glyphAtlasIndices,e.blockBounds,e.chunkedBounds,e.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync((()=>{n.forEach((t=>t&&t()))}))),this.dispatchEvent(oj),t&&t()}))))}onBeforeRender(t,e,n,r,i,o){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(t){return function(t){const e=ez(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new T},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Tt(0,0,0,0)},uTroikaClipRect:{value:new Tt(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new T},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new c},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new bt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nuniform vec4 uTroikaClipRect;\nuniform mat3 uTroikaOrient;\nuniform bool uTroikaUseGlyphColors;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaBlurRadius;\nuniform vec2 uTroikaPositionOffset;\nuniform float uTroikaCurveRadius;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nattribute vec3 aTroikaGlyphColor;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec3 vTroikaGlyphColor;\nvarying vec2 vTroikaGlyphDimensions;\n",vertexTransform:"\nvec4 bounds = aTroikaGlyphBounds;\nbounds.xz += uTroikaPositionOffset.x;\nbounds.yw -= uTroikaPositionOffset.y;\n\nvec4 outlineBounds = vec4(\n bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,\n bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius\n);\nvec4 clippedBounds = vec4(\n clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),\n clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)\n);\n\nvec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);\n\nposition.xy = mix(bounds.xy, bounds.zw, clippedXY);\n\nuv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);\n\nfloat rad = uTroikaCurveRadius;\nif (rad != 0.0) {\n float angle = position.x / rad;\n position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);\n normal.xz = vec2(sin(angle), cos(angle));\n}\n \nposition = uTroikaOrient * position;\nnormal = uTroikaOrient * normal;\n\nvTroikaGlyphUV = clippedXY.xy;\nvTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);\n\n\nfloat txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;\nvec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\nvec2 txStartUV = txUvPerSquare * vec2(\n mod(floor(aTroikaGlyphIndex / 4.0), txCols),\n floor(floor(aTroikaGlyphIndex / 4.0) / txCols)\n);\nvTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);\nvTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);\n",fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform float uTroikaSDFExponent;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaFillOpacity;\nuniform float uTroikaBlurRadius;\nuniform vec3 uTroikaStrokeColor;\nuniform float uTroikaStrokeWidth;\nuniform float uTroikaStrokeOpacity;\nuniform bool uTroikaSDFDebug;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec2 vTroikaGlyphDimensions;\n\nfloat troikaSdfValueToSignedDistance(float alpha) {\n // Inverse of exponential encoding in webgl-sdf-generator\n \n float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);\n float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;\n float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);\n return signedDist;\n}\n\nfloat troikaGlyphUvToSdfValue(vec2 glyphUV) {\n vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);\n vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);\n float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1\n return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;\n}\n\nfloat troikaGlyphUvToDistance(vec2 uv) {\n return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));\n}\n\nfloat troikaGetAADist() {\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;\n #else\n return vTroikaGlyphDimensions.x / 64.0;\n #endif\n}\n\nfloat troikaGetFragDistValue() {\n vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);\n float distance = troikaGlyphUvToDistance(clampedGlyphUV);\n \n // Extrapolate distance when outside bounds:\n distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : \n length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);\n\n \n\n return distance;\n}\n\nfloat troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {\n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(-distanceOffset, -distance);\n #else\n\n float alpha = smoothstep(\n distanceOffset + aaDist,\n distanceOffset - aaDist,\n distance\n );\n #endif\n\n return alpha;\n}\n",fragmentColorTransform:"\nfloat aaDist = troikaGetAADist();\nfloat fragDistance = troikaGetFragDistValue();\nfloat edgeAlpha = uTroikaSDFDebug ?\n troikaGlyphUvToSdfValue(vTroikaGlyphUV) :\n troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));\n\n#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)\nvec4 fillRGBA = gl_FragColor;\nfillRGBA.a *= uTroikaFillOpacity;\nvec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);\nif (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;\ngl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(\n -uTroikaStrokeWidth - aaDist,\n -uTroikaStrokeWidth + aaDist,\n fragDistance\n));\ngl_FragColor.a *= edgeAlpha;\n#endif\n\nif (edgeAlpha == 0.0) {\n discard;\n}\n",customRewriter({vertexShader:t,fragmentShader:e}){let n=/\buniform\s+vec3\s+diffuse\b/;return n.test(e)&&(e=e.replace(n,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),n.test(t)||(t=t.replace(WG,"uniform vec3 diffuse;\n$&\nvTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;\n"))),{vertexShader:t,fragmentShader:e}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}(t)}get material(){let t=this._derivedMaterial;const e=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Wz.clone());if(t&&t.isDerivedFrom(e)||(t=this._derivedMaterial=this.createDerivedMaterial(e),e.addEventListener("dispose",(function n(){e.removeEventListener("dispose",n),t.dispose()}))),this.hasOutline()){let e=t._outlineMtl;return e||(e=t._outlineMtl=Object.create(t,{id:{value:t.id+.1}}),e.isTextOutlineMaterial=!0,e.depthWrite=!1,e.map=null,t.addEventListener("dispose",(function n(){t.removeEventListener("dispose",n),e.dispose()}))),[e,t]}return t}set material(t){t&&t.isTroikaTextMaterial?(this._derivedMaterial=t,this._baseMaterial=t.baseMaterial):this._baseMaterial=t}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(t){this.geometry.detail=t}get curveRadius(){return this.geometry.curveRadius}set curveRadius(t){this.geometry.curveRadius=t}get customDepthMaterial(){return ej(this.material).getDepthMaterial()}set customDepthMaterial(t){}get customDistanceMaterial(){return ej(this.material).getDistanceMaterial()}set customDistanceMaterial(t){}_prepareForRender(t){const e=t.isTextOutlineMaterial,n=t.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:t,blockBounds:i}=r;n.uTroikaSDFTexture.value=t,n.uTroikaSDFTextureSize.value.set(t.image.width,t.image.height),n.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,n.uTroikaSDFExponent.value=r.sdfExponent,n.uTroikaTotalBounds.value.fromArray(i),n.uTroikaUseGlyphColors.value=!e&&!!r.glyphColors;let o,s,a,u=0,l=0,h=0,c=0,f=0;if(e){let{outlineWidth:t,outlineOffsetX:e,outlineOffsetY:n,outlineBlur:r,outlineOpacity:i}=this;u=this._parsePercent(t)||0,l=Math.max(0,this._parsePercent(r)||0),o=i,c=this._parsePercent(e)||0,f=this._parsePercent(n)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(a=this.strokeColor,n.uTroikaStrokeColor.value.set(null==a?Yz:a),s=this.strokeOpacity,null==s&&(s=1)),o=this.fillOpacity;n.uTroikaEdgeOffset.value=u,n.uTroikaPositionOffset.value.set(c,f),n.uTroikaBlurRadius.value=l,n.uTroikaStrokeWidth.value=h,n.uTroikaStrokeOpacity.value=s,n.uTroikaFillOpacity.value=null==o?1:o,n.uTroikaCurveRadius.value=this.curveRadius||0;let p=this.clipRect;if(p&&Array.isArray(p)&&4===p.length)n.uTroikaClipRect.value.fromArray(p);else{const t=100*(this.fontSize||.1);n.uTroikaClipRect.value.set(i[0]-t,i[1]-t,i[2]+t,i[3]+t)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,t.polygonOffset=!!this.depthOffset,t.polygonOffsetFactor=t.polygonOffsetUnits=this.depthOffset||0;const i=e?this.outlineColor||0:this.color;if(null==i)delete t.color;else{const e=t.hasOwnProperty("color")?t.color:t.color=new c;i===e._input&&"object"!=typeof i||e.set(e._input=i)}let o=this.orientation||tj;if(o!==t._orientation){let e=n.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let r=o!==tj&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(r){let[,t,n,i,o]=r;Jz.set(0,0,0)[n]="-"===t?1:-1,Kz.set(0,0,0)[o]="-"===i?-1:1,Xz.lookAt($z,Jz.cross(Kz),Kz),e.setFromMatrix4(Xz)}else e.identity();t._orientation=o}}_parsePercent(t){if("string"==typeof t){let e=t.match(/^(-?[\d.]+)%$/),n=e?parseFloat(e[1]):NaN;t=(isNaN(n)?0:n/100)*this.fontSize}return t}localPositionToTextCoords(t,e=new T){e.copy(t);const n=this.curveRadius;return n&&(e.x=Math.atan2(t.x,Math.abs(n)-Math.abs(t.z))*Math.abs(n)),e}worldPositionToTextCoords(t,e=new T){return Jz.copy(t),this.localPositionToTextCoords(this.worldToLocal(Jz),e)}raycast(t,e){const{textRenderInfo:n,curveRadius:r}=this;if(n){const i=n.blockBounds,o=r?rj():nj(),s=o.geometry,{position:a,uv:u}=s.attributes;for(let t=0;t<u.count;t++){let e=i[0]+u.getX(t)*(i[2]-i[0]);const n=i[1]+u.getY(t)*(i[3]-i[1]);let o=0;r&&(o=r-Math.cos(e/r)*r,e=Math.sin(e/r)*r),a.setXYZ(t,e,n,o)}s.boundingSphere=this.geometry.boundingSphere,s.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,Zz.length=0,o.raycast(t,Zz);for(let t=0;t<Zz.length;t++)Zz[t].object=this,e.push(Zz[t])}}copy(t){const e=this.geometry;return super.copy(t),this.geometry=e,aj.forEach((e=>{this[e]=t[e]})),this}clone(){return(new this.constructor).copy(this)}}sj.forEach((t=>{const e="_private_"+t;Object.defineProperty(uj.prototype,t,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})})),new gt,new c;var lj={altitude:0,height:0,interactive:!1};Fn.prototype._createSDFText=function(){return this.object3d=new uj,this.object3d.__parent=this,this};var hj=function(){function e(n,r,i,o){var s;tn(this,e),i=t.Util.extend({},lj,i,{layer:o}),s=$e(this,e);var a=i.altitude;s._initOptions(i),console.log(i,"fffffffff"),s._createSDFText(),s.getObject3d().text=i.text,s.getObject3d().fontSize=i.fontSize,s.getObject3d().color=i.color,s.getObject3d().letterSpacing=i.letterSpacing||0,s.getObject3d().textAlign="center",s.getObject3d().anchorX=i.anchorX||"center",s.getObject3d().anchorY=i.anchorY||"middle",s.getObject3d().renderOrder=i.renderOrder,s.getObject3d().material=r,s.getObject3d().font=i.fontfile;var u=o.distanceToVector3(a,a).x,l=o.coordinateToVector3(n,u);return s.getObject3d().position.copy(l),s}return ln(e,Fn),rn(e)}(),cj=function(){return rn((function t(e,n,r){var i=this;tn(this,t),0!=e.length?(this.map=r.map,this.threeLayer=r,this.textWidth=n.textWidth||40,this.textHeight=n.textHeight||40,this.beginSizeZoom=n.beginSizeZoom||3,this.endSizeZoom=n.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.textDx=n.textDx||0,this.textDy=n.textDy||0,this.anchorX=n.anchorX,this.anchorY=n.anchorY,this.minZoom=n.pointMinZoom||3,this.maxZoom=n.pointMaxZoom||20,this.fontSize=n.fontSize||.4,this.letterSpacing=n.letterSpacing||0,this.textField=n.textField,this.altitude=n.altitude,this.zoomChangeCallback=n.zoomChangeCallback,this.meshs=[],this.m=this.createBillboardMaterial(new o.MeshBasicMaterial),console.log(e,"77777777777777"),e.forEach((function(t){if(t[i.textField]){console.log(t);var e=new hj([t.longitude,t.latitude],i.m,{minZoom:i.minZoom,maxZoom:i.maxZoom,text:t[i.textField],color:t.color||"#fff",renderOrder:n.pointOrder||5,fontSize:i.fontSize,letterSpacing:i.letterSpacing,altitude:i.altitude,anchorX:i.anchorX,anchorY:i.anchorY},r);e.zoomChange=function(){i.m.uniforms.cameraToCenterDistance.value=i.map.cameraToCenterDistance,i.m.uniforms.zoomScale.value=76.43702828517625/i.map.getResolution();var t=i._getRate();i.m.uniforms.size.value=[i.textWidth*t,i.textHeight*t],i.m.uniforms.xyOffset.value=[i.textDx*t,i.textDy*t],i.zoomChangeCallback&&i.zoomChangeCallback(e)},i.meshs.push(e)}})),this.dataItems=e,r.addMesh(this.meshs),this._bindMapEvents()):console.error("需要绘制的点位数量为0")}),[{key:"createBillboardMaterial",value:function(t,e){return ez(t,Object.assign({uniforms:{canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:76.43702828517625/this.map.getResolution()},size:{value:[this.textWidth*this._getRate(),this.textHeight*this._getRate()]},xyOffset:{value:[this.textDx*this._getRate(),this.textDy*this._getRate()]}},vertexDefs:"\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform vec2 size;\n uniform vec2 xyOffset;\n ",vertexMainOutro:"\n\n vec2 iconSize = vec2(24, 24);\n vec3 c = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n float k = gl_Position.w;\n float l = (1. - cameraToCenterDistance / k);\n float m = clamp(.5 + .5 * (1. - l), .0, 4.);\n vec2 A = position.xy;\n A = A * size;\n \n vec2 B = A * 2. / canvasSize;\n gl_Position.xy += B * m * k;\n\n //float C = k / cameraToCenterDistance;\n //vec2 B = A;\n //gl_Position = projectionMatrix * modelViewMatrix * vec4(vec3(B, .0) / zoomScale * C * m, 1.);\n\n\n gl_Position.xy += xyOffset * 2. / canvasSize * k;\n "},e))}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(e,n,r){for(var i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];e.includes(l.code)?(i=Math.min(i,this.dataItems[u].longitude),o=Math.min(o,this.dataItems[u].latitude),s=Math.max(s,this.dataItems[u].longitude),a=Math.max(a,this.dataItems[u].latitude),l.visibility=1):l.visibility=.1}this.updateByVisibility(),n&&this.map.fitExtent(new t.Extent(i,o,s,a),r||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,n){.1===t.dataItems[n].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t,e=this;this.meshs.forEach((function(t){e.threeLayer.removeMesh(t),t.object3d.dispose()})),null===(t=this.m)||void 0===t||t.dispose()}}],[{key:"preloadFont",value:function(t){return new Promise((function(t){!function({font:t,characters:e,sdfGlyphSize:n},r){Nz({font:t,sdfGlyphSize:n,text:Array.isArray(e)?e.join("\n"):""+e},r)}({font:"/NotoSerifSC-Regular.otf"},(function(){t()}))}))}}])}(),fj="__webglFramebuffer",pj=new o.Vector4,dj={bloom:!0},gj=1*o.REVISION>154?Math.PI:1;function yj(t,e){if(t){t.layers&&t.layers.set(e);var n=t.children;if(n&&n.length)for(var r=0,i=n.length;r<i;r++)yj(n[r],e)}}wu.prototype.renderScene=function(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){var e=t.renderTarget.fbo,n=e.width,r=e.height;this._renderTarget?(this._renderTarget.viewport.set(0,0,n,r),this._renderTarget.scissor.set(0,0,n,r)):(this._renderTarget=new o.WebGLRenderTarget(n,r,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));var i=this.context.properties.get(this._renderTarget),s=i[fj];i[fj]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);var a=1===t.bloom&&t.sceneFilter,u=this.scene.children||[],l=!1;if(a){var h=t.sceneFilter;l=h(dj);for(var c=0,f=u.length;c<f;c++)if(u[c]&&u[c].layers){var p=u[c].__parent;u[c].bloom=!1,p&&(u[c].bloom=p.bloom);var d=0;(u[c]&&h(u[c])||!p)&&(u[c].customType||l&&(d=1)),u[c].__layer!==d&&(yj(u[c],d),u[c].__layer=d)}}else for(var g=0,y=u.length;g<y;g++)u[g]&&u[g].layers&&0!==u[g].__layer&&(yj(u[g],0),u[g].__layer=0);this.camera.layers.set(l?1:0),this.context.render(this.scene,this.camera),i[fj]=s}else{var v=this.canvas,m=v.width,A=v.height,_=this.context.getViewport(pj);_.width===m&&_.height===A||this.context.setViewport(0,0,m,A),this.context.render(this.scene,this.camera),this.layer.updateComposer()}this.context.setRenderTarget(null),this.completeRender()},_u.prototype.initEnvironment=function(t){var e=this.getScene(),n=(new jG).load(t,(function(){n.mapping=o.EquirectangularReflectionMapping,e.environment=n}))},_u.prototype.initBloom=function(){var t=this.getThreeRenderer(),e=this.getScene(),n=this.getCamera();this.composer=new qQ(t,{frameBufferType:o.HalfFloatType}),this.composer.addPass(new SG(e,n))},_u.prototype.delComposer=function(){var t;null===(t=this.composer)||void 0===t||t.dispose()},_u.prototype.updateComposer=function(){var t;null===(t=this.composer)||void 0===t||t.render()},_u.prototype.getComposer=function(){return this.composer},_u.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},_u.prototype.identify=function(e,n){var r=this;if(!e)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(e)&&(e=new t.Coordinate(e)),!(e instanceof t.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var i=this.getMap().coordToContainerPoint(e);this._containerPoint=i;var s=i.x,a=i.y;this._initRaycaster(),this.fire("identify",{coordinate:e,options:n});var u=this._raycaster,l=this._mouse,h=this.getCamera(),c=this.getScene(),f=this.getMap().getSize();if(!c)return[];var p=f.width,d=f.height;l.x=s/p*2-1,l.y=-a/d*2+1,u.setFromCamera(l,h),u.layers&&u.layers.enableAll&&u.layers.enableAll(),function(t,e){t.linePrecision=e}(u,this._getLinePrecision(this.getMap().getResolution()));var g=[],y=[];c.children.forEach((function(e){var n=e.__parent;if(n&&n.getOptions){var r=n;r.getOptions().interactive&&r.isVisible()&&(r.identify&&t.Util.isFunction(r.identify)?y.push(r):g.push(e))}else(e instanceof o.Mesh||e instanceof o.Group)&&e.customType&&e.children.forEach((function(e){var n=e.__parent;if(n&&n.getOptions){var r=n;r.getOptions().interactive&&r.isVisible()&&(r.identify&&t.Util.isFunction(r.identify)?y.push(r):g.push(e))}}))}));var v=[],m=u.intersectObjects(g,!0);m&&Array.isArray(m)&&m.length&&(v=m.map((function(e){var n=e.object,i=e.instanceId,o=(n=r._recursionMesh(n)||{}).__parent||n;return o.faceIndex=e.faceIndex,o.index=e.index,o.intersect=e,t.Util.isNumber(i)&&(o.instanceId=i),o}))),this.renderPickScene(),y.length&&y.forEach((function(t){t.identify(e)&&v.push(t)}));for(var A=v.length,_=0;_<A;_++)if(v[_])for(var x=_+1;x<A;x++)v[_]===v[x]&&v.splice(x,1);var w=(n=t.Util.extend({},n)).count;return v.sort((function(t,e){return e.object3d.renderOrder-t.object3d.renderOrder})),t.Util.isNumber(w)&&w>0?v.slice(0,w):v},_u.prototype._zoomend=function(){var e=this.getScene();if(e){var n=this.getMap().getZoom();e.children.forEach((function(e){if(e.customType)e.children.forEach((function(e){var r=e.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(n);var o=i.getMinZoom(),s=i.getMaxZoom();n<o||n>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=n&&n<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var r=e.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(n);var o=i.getMinZoom(),s=i.getMaxZoom();n<o||n>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=n&&n<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},_u.prototype.addMesh1=function(t,e){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof Fn){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=n,t._fire("add",{target:t}))}})),this._zoomend(),r){var s=this._getRenderer();s&&s.setToRedraw()}return this},_u.prototype.removeMesh1=function(e,n){var r=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return this;Array.isArray(e)||(e=[e]);var s=this.getScene(),a=s.getObjectByProperty("customId",n);if(e.forEach((function(e){if(e instanceof Fn){a?a.remove(e.getObject3d()):s.remove(e.getObject3d()),e.isAdd&&(e.isAdd=!1,e._fire("remove",{target:e})),e._animation&&t.Util.isFunction(e._animation)&&delete r._animationBaseObjectMap[e.getObject3d().uuid];var n=r._delayMeshes;if(n.length)for(var i=0,u=n.length;i<u;i++)if(n[i]===e){n.splice(i,1);break}}else e instanceof o.Object3D&&s.remove(e)})),i){var u=this._getRenderer();u&&u.setToRedraw()}return this};var vj=function(){return rn((function t(e,n,r){var i=this;tn(this,t),this.map=n,this.animationId=null,this.updatables=[];var s=UB();this.threeLayer=new _u(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var a=function(){i.threeLayer._needsUpdate=!i.threeLayer._needsUpdate,i.threeLayer._needsUpdate&&i.threeLayer.redraw();var t,e=i.clock.getDelta(),n=on(i.updatables);try{for(n.s();!(t=n.n()).done;){t.value.tick(e)}}catch(t){n.e(t)}finally{n.f()}i.statsFlag&&i.stats.update(),i.animationId=requestAnimationFrame(a)};this.threeLayer.prepareToDraw=function(t,e,n){var r=new o.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),a()},null!=r&&r.groupLayer?this.threeLayer.addTo(r.groupLayer):this.threeLayer.addTo(n),this.groupLayer=null==r?void 0:r.groupLayer,this.layerId=s,this.layerName=e,this.dirty=!1,this.initFlag=!1,this.bloomFlag=(null==r?void 0:r.bloomFlag)||!1,this.bloomStrength=null==r?void 0:r.bloomStrength,this.bloomThreshold=null==r?void 0:r.bloomThreshold,this.bloomRadius=null==r?void 0:r.bloomRadius,this.hdrPath=null==r?void 0:r.hdrPath,this.ambientLightIntensity=(null==r?void 0:r.ambientLightIntensity)||1,this.stats=new UG,this.stats.dom.style.display="none",document.body.appendChild(this.stats.dom),this.statsFlag=!1}),[{key:"createGroup",value:(t=Ze(pn().mark((function t(e){return pn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,QB(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var n=t.getObjectByName(e);return n||(n=new CF(t,e)),n.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=UB();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate&&t.threeLayer.redraw();var n,r=t.clock.getDelta(),i=on(t.updatables);try{for(i.s();!(n=i.n()).done;){n.value.tick(r)}}catch(t){i.e(t)}finally{i.f()}t.statsFlag&&t.stats.update(),t.animationId=requestAnimationFrame(e)};return new Promise((function(n){var r=t;t.threeLayer.prepareToDraw=function(t,i,s){r.hdrPath&&this.initEnvironment(r.hdrPath);var a=new o.DirectionalLight(16777215,1*gj);a.position.set(0,-10,10).normalize(),i.add(a),i.add(new o.AmbientLight(16777215,r.ambientLightIntensity*gj)),e(),this.initBloom(),n()}}))}},{key:"drawRadar",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawRadar1",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new gT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new gT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawRadar2",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new yT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new yT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawRadar3",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new vT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new vT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSector",value:function(t,e,n,r){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new _T(t,e,n||{},i.threeLayer,r);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new _T(t,e,n||{},i.threeLayer,r);o(s)}))}))}},{key:"drawRing",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new HG(t,e,n,r||{},o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new HG(t,e,n,r||{},o.threeLayer,i);s(a)}))}))}},{key:"drawSectorImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawImage",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new ST(t,e||{},n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new ST(t,e||{},n.threeLayer,n);r(i)}))}))}},{key:"drawPoybyHeight",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new zG(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new zG(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawSdfText",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=null;t.length>0?o=new cj(t,e,r.threeLayer,n):i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=null;t.length>0?o=new cj(t,e,r.threeLayer,n):i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new wF(t,e,n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new wF(t,e,n.threeLayer,n);r(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new IF(t,e.threeLayer);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new IF(t,e.threeLayer);n(r)}))}))}},{key:"drawFbxModel",value:function(t,e,n,r){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new IU(t,e,n,i.threeLayer,r);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new IU(t,e,n,i.threeLayer,r);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawWall",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new BU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new BU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new LQ(t,e,r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new LQ(t,e,r.threeLayer,n);i(o)}))}))}},{key:"createBloomClass",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new NG(e.threeLayer,t);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new NG(e.threeLayer,t);n(r)}))}))}},{key:"createOutlineBloom",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new FG(e.threeLayer,t);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new FG(e.threeLayer,t);n(r)}))}))}},{key:"drawPolyline",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new CQ(t,e,r.threeLayer,n);o.generatePolygon().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new CQ(t,e,r.threeLayer,n);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawExtrudePolygon",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new BQ(t,e,r.threeLayer,n);o.generatePolygon().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new BQ(t,e,r.threeLayer,n);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawTube",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripHeight1",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new mQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new mQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripLine1",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new _Q(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new _Q(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"setStateFlag",value:function(){this.statsFlag=!this.statsFlag,this.statsFlag?this.stats.dom.style.display="":this.stats.dom.style.display="none"}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.delComposer(),this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),n=this.threeLayer.getScene(),r=this.threeLayer.getPick(),i=r.pickingTexture;r.pickingScene;var o=this.threeLayer.getRenderer();n.remove(e),e=null,n=null,i.dispose(),i=null,this.groupLayer?this.groupLayer.removeLayer(this.threeLayer):(o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer))}}]);var t}(),mj=function(){return rn((function t(e,n){var r=this;tn(this,t),this.map=n,this.animationId=null,this.updatables=[];var i=UB();this.threeLayer=new _u(i,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var s=function(){var t;(r.threeLayer._needsUpdate=!r.threeLayer._needsUpdate,r.threeLayer._needsUpdate)&&(null===(t=r.threeLayer)||void 0===t||null===(t=t.getRenderer())||void 0===t||t.clearCanvas(),r.threeLayer.renderScene());var e,n=r.clock.getDelta(),i=on(r.updatables);try{for(i.s();!(e=i.n()).done;){e.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}r.animationId=requestAnimationFrame(s)};this.threeLayer.prepareToDraw=function(t,e,n){var r=new o.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),s()},this.threeLayer.addTo(n),this.layerId=i,this.layerName=e,this.dirty=!1,this.initFlag=!1}),[{key:"createGroup",value:(t=Ze(pn().mark((function t(e){return pn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,QB(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var n=t.getObjectByName(e);return n||(n=new CF(t,e)),n.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=UB();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){var n;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(n=t.threeLayer)||void 0===n||null===(n=n.getRenderer())||void 0===n||n.clearCanvas(),t.threeLayer.renderScene());var r,i=t.clock.getDelta(),o=on(t.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(n){t.threeLayer.prepareToDraw=function(t,r,i){var s=new o.DirectionalLight(16777215);s.position.set(0,-10,10).normalize(),r.add(s),r.add(new o.AmbientLight(16777215)),e(),n()}}))}},{key:"drawRadar",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new dT(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSector",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new _T(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new _T(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new ET(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawImage",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new cT(t,e,n,r,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new ST(t,e||{},n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new ST(t,e||{},n.threeLayer,n);r(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=null;t.length>0?(o=new qT(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new wF(t,e,n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new wF(t,e,n.threeLayer,n);r(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new IF(t,e.threeLayer);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new IF(t,e.threeLayer);n(r)}))}))}},{key:"drawFbxModel",value:function(t,e,n,r){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new IU(t,e,n,i.threeLayer,r);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new IU(t,e,n,i.threeLayer,r);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new MU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new TU(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new RU(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new CQ(t,e,r.threeLayer,n);o.generatePolygon().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new CQ(t,e,r.threeLayer,n);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new NU(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new sQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawTube",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new fQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new lQ(t,e,n,r||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new vQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new AQ(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new PQ(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),n=this.threeLayer.getScene(),r=this.threeLayer.getPick(),i=r.pickingTexture;r.pickingScene;var o=this.threeLayer.getRenderer();n.remove(e),e=null,n=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]);var t}(),Aj=function(){return rn((function e(n,r,i,o){tn(this,e),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new t.DrawTool({mode:n,symbol:{lineColor:i.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:i.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=r,this.mode=n,this.toolLayer=new t.VectorLayer(t.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),i.zIndex&&this.toolLayer.setZIndex(i.zIndex),this.type="drawTool"}),[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}])}();function _j(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,n){for(;t>n;)t-=n-e;for(;t<e;)t+=n-e;return t},this._getRange=function(t,e,n){return null!=e&&(t=Math.max(t,e)),null!=n&&(t=Math.min(t,n)),t}}_j.prototype.BD2GCJ=function(t,e){var n=t-.0065,r=e-.006,i=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.x_PI),o=Math.atan2(r,n)-3e-6*Math.cos(n*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},_j.prototype.GCJ2BD=function(t,e){var n=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),r=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[n*Math.cos(r)+.0065,n*Math.sin(r)+.006]},_j.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var n=this._transformlat(t-105,e-35),r=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return n=180*n/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(r=180*r/(this.a/s*Math.cos(i)*this.PI)),e+n]},_j.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var n=this._transformlat(t-105,e-35),r=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return n=180*n/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(r=180*r/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+n)]},_j.prototype.WGS2BD=function(t,e){var n=this.WGS2GCJ(t,e);return n=this.GCJ2BD(n[0],n[1])},_j.prototype.BD2WGS=function(t,e){var n=this.BD2GCJ(t,e);return n=this.GCJ2WGS(n[0],n[1])},_j.prototype.BD_MKT2WGS=function(t,e){var n=null;t=Math.abs(t),e=Math.abs(e);for(var r=0;r<this.MCBAND.length;r++)if(e>=this.MCBAND[r]){n=this.MC2LL[r];break}t=n[0]+n[1]*Math.abs(t);var i=Math.abs(e)/n[9];return e=n[2]+n[3]*i+n[4]*i*i+n[5]*i*i*i+n[6]*i*i*i*i+n[7]*i*i*i*i*i+n[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},_j.prototype.BD_WGS2MKT=function(t,e){var n=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var r=0;r<this.LLBAND.length;r++)if(e>=this.LLBAND[r]){n=this.LL2MC[r];break}if(null!=n)for(r=this.LLBAND.length-1;r>=0;r--)if(e<=-this.LLBAND[r]){n=this.LL2MC[r];break}t=n[0]+n[1]*Math.abs(t);var i=Math.abs(e)/n[9];return e=n[2]+n[3]*i+n[4]*i*i+n[5]*i*i*i+n[6]*i*i*i*i+n[7]*i*i*i*i*i+n[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var xj=function(){return rn((function e(n,r,i){tn(this,e),this.map=r,this.overlayer=new t.VectorLayer("overLayer",{geometryEvents:!1,hitDetect:!1,forceRenderOnMoving:!0,forceRenderOnRotating:!0,enableSimplify:!1}),this.overlayer.addTo(this.map);var o=new t.MultiPolygon(n,{symbol:{polygonFill:i.color||"#000",polygonOpacity:i.opacity||1,lineWidth:0}});this.overlayer.addGeometry(o)}),[{key:"dispose",value:function(){this.map.removeLayer(this.overlayer),delete this.toolLayer}}])}();
|
|
190
190
|
/*!
|
|
191
191
|
* maptalks.animatemarker v0.4.1
|
|
192
192
|
* LICENSE : MIT
|