UNPKG

maptalks-gl

Version:

All-in-one package for maptalks webgl layers

18 lines (17 loc) 2.73 MB
/*! * maptalks-gl v0.118.1 * LICENSE : MIT * (c) 2016-2025 maptalks.com */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).maptalks=e.maptalks||{})}(this,(function(e){"use strict"; /*! * maptalks v1.7.1 * LICENSE : BSD-3-Clause * (c) 2016-2025 maptalks.org */var t="1.7.1",n="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];function i(){return"undefined"!=typeof globalThis?globalThis:global||self}function o(e){var t=i().maptalksversion;if(t)throw new Error("Disallow duplicate imports of maptalks version "+e+" and "+t);i().maptalksversion=e}var s={isTest:!1,idleLog:!1,idleForceTimeThreshold:48,workerCount:i().MAPTALKS_WORKER_COUNT||0,messagePostRatioPerWorker:.3,maxFPS:0,crsMaxNativeZoom:22};function a(){return Date.now()}function l(e,...t){for(var n=0;n<t.length;n++){var i=t[n];for(var o in i)e[o]=i[o]}return e}function h(e){return null==e}function c(e){return"number"==typeof e&&!isNaN(e)}function u(e){return(0|e)===e}function f(e){return"object"==typeof e&&!!e}function g(e){return!h(e)&&("string"==typeof e||null!==e.constructor&&e.constructor===String)}function m(e){return!h(e)&&("function"==typeof e||null!==e.constructor&&e.constructor===Function)}var A=Object.prototype.hasOwnProperty;function x(e,t){return A.call(e,t)}var T=Math.PI/180;function w(e){return e*T}function S(e){return e/T}var I={};function E(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!n){var R=navigator.userAgent.toLowerCase(),H=document.documentElement||{style:{}},N="ActiveXObject"in window,B=-1!==R.indexOf("webkit"),z=-1!==R.indexOf("phantom"),U=-1!==R.search("android [23]"),V=-1!==R.indexOf("chrome"),j=-1!==R.indexOf("gecko")&&!B&&!window.opera&&!N,W=/iphone/i.test(R)&&/micromessenger/i.test(R),q="undefined"!=typeof orientation||-1!==R.indexOf("mobile"),Z=!window.PointerEvent&&window.MSPointerEvent,X=window.PointerEvent&&navigator.pointerEnabled||Z,Y=N&&"transition"in H.style,Q="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!U,J="MozPerspective"in H.style,$="OTransition"in H.style,K=(Y||Q||J)&&!$&&!z,ee="undefined"!=typeof window&&m(window.createImageBitmap),te="undefined"!=typeof window&&m(window.ResizeObserver),ne="undefined"!=typeof window&&m(window.btoa),ie="undefined"!=typeof window&&m(window.Proxy),re="undefined"!=typeof window&&m(window.requestIdleCallback),oe=void 0!==globalThis.scheduler&&"object"==typeof globalThis.scheduler,se="undefined"!=typeof CanvasRenderingContext2D&&m(CanvasRenderingContext2D.prototype.roundRect),ae=0;V&&(ae=R.match(/chrome\/([\d.]+)/)[1]);var le=!z&&(X||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),he="undefined"!=typeof window&&"WebGLRenderingContext"in window,ce=E(),ue=!1;try{new OffscreenCanvas(2,2).getContext("2d"),ue=!0}catch(e){ue=!1}var pe=!1;try{var ge=Object.defineProperty({},"passive",{get:function(){pe=!0}});window.addEventListener("testPassive",null,ge),window.removeEventListener("testPassive",null,ge)}catch(Ek){}(I={IS_NODE:n,isTest:!1,ie:N,ielt9:N&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:B,gecko:j,android:-1!==R.indexOf("android"),android23:U,chrome:V,chromeVersion:ae,safari:!V&&-1!==R.indexOf("safari"),phantomjs:z,ie3d:Y,webkit3d:Q,gecko3d:J,opera12:$,any3d:K,iosWeixin:W,mobile:q,mobileWebkit:q&&B,mobileWebkit3d:q&&Q,mobileOpera:q&&window.opera,mobileGecko:q&&j,touch:!!le,msPointer:!!Z,pointer:!!X,retina:ce>1,devicePixelRatio:ce,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:N&&9===document.documentMode,ie10:N&&10===document.documentMode,webgl:he,imageBitMap:ee,roundRect:se,resizeObserver:te,btoa:ne,decodeImageInWorker:ue,monitorDPRChange:!0,supportsPassive:pe,proxy:ie,requestIdleCallback:re,scheduler:oe,checkDevicePixelRatio:function(){if("undefined"!=typeof window&&I.monitorDPRChange){var e=E(),t=e!==I.devicePixelRatio;return t&&(I.devicePixelRatio=e),t}return!1}}).roundRect||console.warn("current env the canvas not support roundRect")}var me=I;function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function _e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xe(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Ie(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function be(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ae(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ae(e,t):void 0}}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[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.")}function Te(e){return Te=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Te(e)}function we(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ce(e,t)}function Se(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Se=function(){return!!e})()}function Me(){Me=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var s=Object.create((t&&t.prototype instanceof w?t:w).prototype),a=new q(i||[]);return o(s,"_invoke",{value:U(e,n,a)}),s}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var g="suspendedStart",m="suspendedYield",A="executing",x="completed",T={};function w(){}function S(){}function I(){}var E={};c(E,a,(function(){return this}));var R=Object.getPrototypeOf,H=R&&R(R(Z([])));H&&H!==n&&i.call(H,a)&&(E=H);var N=I.prototype=w.prototype=Object.create(E);function B(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function z(e,t){function n(o,s,a,l){var h=f(e[o],e,s);if("throw"!==h.type){var c=h.arg,u=c.value;return u&&"object"==typeof u&&i.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,l)}))}l(h.arg)}var s;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,o){n(e,i,t,o)}))}return s=s?s.then(o,o):o()}})}function U(t,n,i){var o=g;return function(s,a){if(o===A)throw Error("Generator is already running");if(o===x){if("throw"===s)throw a;return{value:e,done:!0}}for(i.method=s,i.arg=a;;){var l=i.delegate;if(l){var h=V(l,i);if(h){if(h===T)continue;return h}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===g)throw o=x,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=A;var c=f(t,n,i);if("normal"===c.type){if(o=i.done?x:m,c.arg===T)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(o=x,i.method="throw",i.arg=c.arg)}}}function V(t,n){var i=n.method,o=t.iterator[i];if(o===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,V(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),T;var s=f(o,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,T;var a=s.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,T):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,T)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function W(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function q(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function Z(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){for(;++o<t.length;)if(i.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(typeof t+" is not iterable")}return S.prototype=I,o(N,"constructor",{value:I,configurable:!0}),o(I,"constructor",{value:S,configurable:!0}),S.displayName=c(I,h,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,I):(e.__proto__=I,c(e,h,"GeneratorFunction")),e.prototype=Object.create(N),e},t.awrap=function(e){return{__await:e}},B(z.prototype),c(z.prototype,l,(function(){return this})),t.AsyncIterator=z,t.async=function(e,n,i,o,s){void 0===s&&(s=Promise);var a=new z(u(e,n,i,o),s);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},B(N),c(N,h,"Generator"),c(N,a,(function(){return this})),c(N,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=Z,q.prototype={constructor:q,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(W),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(i,o){return l.type="throw",l.arg=t,n.next=i,o&&(n.method="next",n.arg=e),!!o}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var h=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(h&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(h){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var s=o;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=t,s?(this.method="next",this.next=s.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),W(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;W(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:Z(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),T}},t}function Ce(e,t){return Ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ce(e,t)}function Ie(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function Oe(e){var t="function"==typeof Map?new Map:void 0;return Oe=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(Se())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var o=new(e.bind.apply(e,i));return n&&Ce(o,n.prototype),o}(e,arguments,Te(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ce(n,e)},Oe(e)}var ke,Ee,Re=function(){function e(e,t,n){if(h(e)||h(t)?h(e.x)||h(e.y)?Array.isArray(e)&&(this.x=+e[0],this.y=+e[1],this.z=e[2]):(this.x=+e.x,this.y=+e.y,this.z=e.z):(this.x=+e,this.y=+t,this.z=n),this._isNaN())throw new Error("Position is NaN")}var t=e.prototype;return t.set=function(e,t,n){return this.x=e,this.y=t,this.z=n||0,this},t._abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t._round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t._ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.distanceTo=function(e){var t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)},t.mag=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t._floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t._add=function(e,t){return h(e.x)?h(e[0])?(this.x+=e,this.y+=t):(this.x+=e[0],this.y+=e[1]):(this.x+=e.x,this.y+=e.y),this},t._sub=function(e,t){return h(e.x)?h(e[0])?(this.x-=e,this.y-=t):(this.x-=e[0],this.y-=e[1]):(this.x-=e.x,this.y-=e.y),this},t._substract=function(e,t){return c(t)?this._sub(e,t):this._sub(e)},t.substract=function(e,t){return this.sub(e,t)},t._multi=function(e){return this.x*=e,this.y*=e,this},t.div=function(e){return this.multi(1/e)},t._div=function(e){return this._multi(1/e)},t._isNaN=function(){return isNaN(this.x)||isNaN(this.y)||c(this.z)&&isNaN(this.z)},t.isZero=function(){return 0===this.x&&0===this.y},t.toArray=function(){return c(this.z)?[this.x,this.y,this.z]:[this.x,this.y]},t.toJSON=function(){var e={x:this.x,y:this.y};return c(this.z)&&(e.z=this.z),e},e}(),Le=function(e){function t(){return e.apply(this,arguments)||this}we(t,e);var n=t.prototype;return n.closeTo=function(e,t){return t||(t=0),this.x>=e.x-t&&this.x<=e.x+t&&this.y>=e.y-t&&this.y<=e.y+t},n.unit=function(){return this.copy()._unit()},n._unit=function(){return this._div(this.mag()),this},n.perp=function(){return this.copy()._perp()},n._perp=function(){return[this.x,this.y]=[-this.y,this.x],this},n.angleWith=function(e){return this.angleWithSep(e.x,e.y)},n.angleWithSep=function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},n._rotate=function(e){var t=Math.cos(e),n=Math.sin(e),i=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=i,this},n.rotate=function(e){return this.copy()._rotate(e)},n.abs=function(){return new t(Math.abs(this.x),Math.abs(this.y))},n.round=function(){return new t(Math.round(this.x),Math.round(this.y))},n.ceil=function(){return new t(Math.ceil(this.x),Math.ceil(this.y))},n.floor=function(){return new t(Math.floor(this.x),Math.floor(this.y))},n.copy=function(){return new t(this.x,this.y,this.z)},n.toFixed=function(e){return new t(this.x.toFixed(e),this.y.toFixed(e),c(this.z)?this.z.toFixed(e):void 0)},n.add=function(e,n){var i,o;return h(e.x)?h(e[0])?(i=this.x+e,o=this.y+n):(i=this.x+e[0],o=this.y+e[1]):(i=this.x+e.x,o=this.y+e.y),new t(i,o)},n.sub=function(e,n){var i,o;return h(e.x)?h(e[0])?(i=this.x-e,o=this.y-n):(i=this.x-e[0],o=this.y-e[1]):(i=this.x-e.x,o=this.y-e.y),new t(i,o)},n.multi=function(e){return new t(this.x*e,this.y*e)},n.equals=function(e){return e instanceof this.constructor&&(this.x===e.x&&this.y===e.y&&this.z===e.z)},t}(Re);function De(e){var t="data:image/svg+xml";return e.length>4&&".svg"===e.slice(-4)?1:e.slice(0,18)===t?2:0}function Fe(e,t){n&&Fe.node?Fe.node(e,t):e.src=t[0]}!function(){if(n)return ke=function(e){return setTimeout(e,16)},void(Ee=clearTimeout);ke=function(e){return requestAnimationFrame(e)},Ee=function(e){return cancelAnimationFrame(e)}}();var He=0;function Ne(){return He++}var Be=Ne;function ze(e){return e&&g(e)?JSON.parse(e):e}function Ge(...e){for(var t=e[0],n=1;n<e.length;n++){var i=e[n];if(i&&i.length)for(var o=0,s=i.length;o<s;o++)t.push(i[o])}return t.length}function Ue(...e){for(var t=[],n=-1,i=0;i<e.length;i++){var o=e[i];if(o&&o.length)for(var s=0,a=o.length;s<a;s++)t[++n]=o[s]}return t}function Ve(e,t){var n=t.indexOf(e);n>-1&&t.splice(n,1)}function je(e,t,n){if(!Array.isArray(e))return n?t.call(n,e):t(e);for(var i,o,s=[],a=0,l=e.length;a<l;a++)h(i=e[a])?s.push(null):Array.isArray(i)?s.push(je(i,t,n)):(o=n?t.call(n,i):t(i),s.push(o));return s}function We(e,t){return void 0===e?t:e}function qe(e){return Math.sign?Math.sign(e):0===(e=+e)||isNaN(e)?Number(e):e>0?1:-1}function Ze(e,t,n){return e*(1-n)+t*n}function Xe(e,t,n){if(e===n||e===t)return e;var i=n-t;return((e-t)%i+i)%i+t}function Ye(e,t,n){return Math.min(n,Math.max(t,e))}function Qe(e){return Array.isArray(e)&&e.length>0}var Je=/^([a-z][a-z\d+\-.]*:)?\/\//i;function $e(e){return Je.test(e)}var Ke=/^url\((['"])(.+)\1\)$/i,et=/^url\(([^'"].*[^'"])\)$/i;function tt(e){return g(e)?et.test(e)?1:Ke.test(e)?2:3:0}function nt(e){var t=tt(e);return 3===t?e:1===t?et.exec(e)[1]:2===t?Ke.exec(e)[2]:e}var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function rt(e){if(me.btoa)return window.btoa(e);for(var t,n,i=String(e),o="",s=0,a=it;i.charAt(0|s)||(a="=",s%1);o+=a.charAt(63&t>>8-s%1*8)){if((n=i.charCodeAt(s+=3/4))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");t=t<<8|n}return o}function ot(e,t){for(var n=atob(e),i=new ArrayBuffer(n.length),o=new Uint8Array(i),s=0;s<n.length;s++)o[s]=255&n.charCodeAt(s);return new Blob([i],{type:t})}function st(e,t,n,i){return Math.atan2(i-t,n-e)}var at="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";function lt(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;for(var n in e)if("center"===n){if(!t[n]||!ht(e[n][0],t[n][0])||!ht(e[n][1],t[n][1]))return!1}else if(e[n]!==t[n])return!1;return!0}function ht(e,t,n){return null==n&&(n=1e-6),e>=t-n&&e<=t+n}function ut(e=100,t=4,n=null,i=null){e||(e=100),t||(t=4);var o=this,s=this.isVisible();return t*=2,this._flashTimeout&&clearTimeout(this._flashTimeout),this._flashTimeout=setTimeout((function a(){if(0===t)return s?o.show():o.hide(),void(n&&(i?n.call(i):n()));t%2==0?o.hide():o.show(),t--,o._flashTimeout=setTimeout(a,e)}),e),this}function ft(e=[],t="_pt"){for(var n=[],i=0,o=e.length;i<o;i++){var s=e[i];if(s){s[t]||(s[t]=new Le(0,0));var a=s[t];a.x=0,a.y=0,n.push(a)}else n.push(null)}return n}function pt(e,t){t(e.data)}function gt(e){if(e&&0===e.indexOf("http://")||0===e.indexOf("https://"))return e;var t=document.createElement("a");return t.href=e,e=t.href,t=null,e}var mt={cssWidth:"1px",cssHeight:"1px",width:1,height:1};function At(e,t=1){var{width:n,height:i}=e;return mt.cssWidth=n+"px",mt.cssHeight=i+"px",mt.width=Math.round(n*t),mt.height=Math.round(i*t),mt}var yt="_maptalks__internal_layer_",vt=["MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"],xt=["FeatureCollection","Feature","Point","LineString","Polygon"].concat(vt),bt=["markerFile","polygonPatternFile","linePatternFile","markerFillPatternFile","markerLinePatternFile"],Tt=[["markerWidth","markerHeight"],[],[null,"lineWidth"],[],[null,"markerLineWidth"]],wt={lineWidth:1,lineOpacity:1,lineDx:1,lineDy:1,polygonOpacity:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerOpacity:1,markerFillOpacity:1,markerLineWidth:1,markerLineOpacity:1,textSize:1,textOpacity:1,textHaloRadius:1,textWrapWidth:1,textLineSpacing:1,textDx:1,textDy:1},Mt=["lineColor","polygonFill","markerFill","markerLineColor","textFill"],Ct=14,Pt=function(){function e(e,t){c(e)&&c(t)?(this.width=e,this.height=t):c(e.width)?(this.width=e.width,this.height=e.height):Array.isArray(e)&&(this.width=e[0],this.height=e[1])}var t=e.prototype;return t.copy=function(){return new e(this.width,this.height)},t.add=function(t,n){var i,o;return t instanceof e?(i=this.width+t.width,o=this.height+t.height):(i=this.width+t,o=this.height+n),new e(i,o)},t.equals=function(e){return this.width===e.width&&this.height===e.height},t.multi=function(t){return new e(this.width*t,this.height*t)},t._multi=function(e){return this.width*=e,this.height*=e,this},t._round=function(){return this.width=Math.round(this.width),this.height=Math.round(this.height),this},t.toPoint=function(){return new Le(this.width,this.height)},t.toArray=function(){return[this.width,this.height]},t.toJSON=function(){return{width:this.width,height:this.height}},e}(),Ot="";function Et(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Rt(e,t,n){if(!e)return e;for(;e.indexOf(t)>-1;)e=e.replace(t,n);return e}var Dt=/[\b\t\r\v\f]/gim;function Ht(e){return g(e)?e.replace(Dt,Ot):e}function Nt(e){return Et(e).split(/\s+/)}var Bt="undefined"!=typeof document?document.createElement("canvas").getContext("2d"):null;function zt(e,t){return zt.node?zt.node(e,t):(Bt.font=t,Bt.measureText(e).width)}function Ut(e,t,n){var i=zt(e,t);return new Pt(i,n||Ct)}function Vt(e,t,n,i){if(!e||0===e.length)return[{text:"",width:0}];var o=h(i)?zt(e,t):i,s=o/e.length,a=Math.floor(n/s/2);if(s>=n||a<=0)return[{text:"",width:n}];if(o<=n)return[{text:e,width:o}];for(var l=[],c=e.substring(0,a),u=s*a,f=a,g=e.length;f<g;f++){var m=e[f],A=zt(c+m);A>=n?(l.push({text:c,width:u}),c=e.substring(f,a+f),f+=a-1,u=s*a):(c+=m,u=A),f>=g-1&&(u=zt(c),l.push({text:c,width:u}))}return l}var Wt=["{","}"];function qt(e,t){if(!g(e))return e;var[n,i]=Wt;if(-1===e.indexOf(n)&&-1===e.indexOf(i))return e;function o(e){if(!t)return Ot;var n=t[e];return h(n)?Ot:Array.isArray(n)?n.join():n}for(var s=function(e){e+=Ot;for(var[t,n]=Wt,i=[],o=!1,s=Ot,a=0,l=e.length;a<l;a++){var h=e[a];o||h!==t||(o=!0),h===t&&o&&(s=Ot),o&&h!==t&&h!==n&&(s+=h),h===n&&s&&(o=!1,i.push(s),s=Ot)}return i}(e),a=0,l=s.length;a<l;a++){var c=s[a];e=Rt(e,""+n+c+i,o(c))}return e}function Zt(e,t){c(e)&&(e+="");var n=t.textMaxHeight||0,i=Kt(e=e||"",t);return n&&n<i.size.height&&(i.size.height=n),i}function Xt(e,t,n){var i=e.width,o=e.height;return new Le("left"===t?-i:"right"===t?0:-i/2,"top"===n?-o:"bottom"===n?0:-o/2)}var Yt="sans-serif",Qt=14;function $t(e){if(e.textFont)return e.textFont;var t=e.textSize;return h(t)&&(t=Qt),(e.textStyle&&"normal"!==e.textStyle?e.textStyle+" ":"")+(e.textWeight&&"normal"!==e.textWeight?e.textWeight+" ":"")+t+"px "+(e.textFaceName&&function(e){for(var t=e.split(","),n=0;n<t.length;n++)t[n].trim&&(t[n]=t[n].trim()),t[n].indexOf(" ")>0&&'"'!==t[n][0]&&"'"!==t[n][0]&&(t[n]='"'+t[n]+'"');return t.join(",")}(e.textFaceName)||Yt)}function Kt(e,t){var n=$t(t),i=t.textLineSpacing||0,o=Ut(e,n,t.textSize),s=o.width,a=o.height,l=t.textWrapCharacter||"\n",h=[],c=t.textWrapWidth;(!c||c>s)&&(c=s),g(e)||(e+="");var u=0;if(l&&e.indexOf(l)>=0)for(var f=e.split(l),m=0,A=f.length;m<A;m++){var x=f[m],T=zt(x,n);if(T>c)for(var w=Vt(x,n,c,T),S=0,I=w.length;S<I;S++){var E=w[S].width;E>u&&(u=E),h.push({text:w[S].text,size:new Pt(E,a)})}else T>u&&(u=T),h.push({text:x,size:new Pt(T,a)})}else if(s>c)for(var R=Vt(e,n,c,s),H=0;H<R.length;H++){var N=R[H].width;N>u&&(u=N),h.push({text:R[H].text,size:new Pt(N,a)})}else s>u&&(u=s),h.push({text:e,size:o});var B=h.length;return{total:B,size:new Pt(u,a*B+i*(B-1)),rows:h,rawSize:o}}function en(e){var t=0,n=e&&e.length||0;if(!n)return t;for(var i=0;i<n;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return t}var tn=Object.freeze({__proto__:null,DEFAULT_FONT:Yt,DEFAULT_TEXTSIZE:Qt,EMPTY_STRING:Ot,describeText:Zt,escapeSpecialChars:Ht,getAlignPoint:Xt,getFont:$t,hashCode:en,replaceAll:Rt,replaceVariable:qt,splitContent:Vt,splitTextToRow:Kt,splitWords:Nt,stringLength:Ut,stringWidth:zt,trim:Et}),nn=n?function(e){return e[0]}:function(e){for(var t=document.documentElement&&document.documentElement.style||{},n=0;n<e.length;n++)if(e[n]in t)return e[n];return!1},rn=nn(["transform","WebkitTransform","OTransform","MozTransform","msTransform"]),sn=nn(["transformOrigin","WebkitTransformOrigin","OTransformOrigin","MozTransformOrigin","msTransformOrigin"]),un=nn(["transition","WebkitTransition","OTransition","MozTransition","msTransition"]),fn=nn(["filter","WebkitFilter","OFilter","MozFilter","msFilter"]);function dn(e,t){var n=document.createElement(e);return t&&Fn(n,t),n}function pn(e,t,n){var i=dn(e);return t&&Rn(i,t),n&&n.appendChild(i),i}function mn(e){if(!e)return this;if(me.ielt9||me.ie9){var t=dn("div");t.appendChild(e),t.innerHTML="",t=null}else e.parentNode&&e.parentNode.removeChild(e);return this}function yn(e,t,n,i){if(!(e&&e.addEventListener&&t&&n))return this;for(var o=function(t){t||(t=window.event),n.call(i||e,t)},s=t.split(" "),a=s.length-1;a>=0;a--){var l=s[a];if(l)e["Z__"+l]||(e["Z__"+l]=[]),xn(e,l,n)>=0&&(console.warn(e,"find '"+l+"' handler:",n," The old listener function will be removed"),vn(e,l,n)),e["Z__"+l].push({callback:o,src:n}),e.addEventListener(l,o,!!me.supportsPassive&&{capture:!1,passive:!1})}return this}function vn(e,t,n){function i(t,n){"mousewheel"===t&&me.gecko&&(t="DOMMouseScroll"),e.removeEventListener(t,n,!1)}if(!e||!e.removeEventListener||!t)return this;for(var o=t.split(" "),s=o.length-1;s>=0;s--){var a=o[s];if(a){if(!n&&e["Z__"+a]){for(var l=e["Z__"+a],h=0,c=l.length;h<c;h++)i(l[h].callback);return delete e["Z__"+a],this}var u=xn(e,a,n);if(u<0)return this;i(a,e["Z__"+a][u].callback),e["Z__"+a].splice(u,1)}}return this}function xn(e,t,n){if(!e||!e["Z__"+t]||!n)return-1;for(var i=e["Z__"+t],o=0,s=i.length;o<s;o++)if(i[o].src===n)return o;return-1}function wn(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this}function Sn(e){return e._cancelBubble=!0,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this}function Cn(e){return e.onselectstart=function(){return!1},e.ondragstart=function(){return!1},e.setAttribute("unselectable","on"),this}function Pn(e,t){return e?(me.any3d?Nn(e,t):(e.style.left=t.x+"px",e.style.top=t.y+"px"),t):null}function kn(e){var t=window.getComputedStyle(e),n=[parseInt(t["padding-left"]),parseInt(t["padding-top"])],i=e.getBoundingClientRect(),o=e.offsetWidth,s=e.offsetHeight;return e.__position=[i.left+n[0],i.top+n[1],o?i.width/o:1,s?i.height/s:1],e.__position}function En(e,t){e||(e=window.event);var n=t.__position;n||(n=kn(t));var i=e;return i.touches&&i.touches.length&&(e=i.touches[0]),i.changedTouches&&i.changedTouches.length&&(e=i.changedTouches[0]),new Le((e.clientX-n[0]-t.clientLeft)/n[2],(e.clientY-n[1]-t.clientTop)/n[3])}function Rn(e,t){var n=e.style.cssText;return function(e,t){var n=e.length-t.length;return n>=0&&e.indexOf(t,n)===n}(n,";")||(n+=";"),e.style.cssText=n+t,this}function Ln(e,t){if(void 0!==e.classList)return e.classList.contains(t);var n=Hn(e);return n.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(n)}function Dn(e,t){if(void 0===e.classList||Ln(e,t)){var n=Hn(e);Fn(e,(n?n+" ":"")+t)}else for(var i=Nt(t),o=0,s=i.length;o<s;o++)e.classList.add(i[o]);return this}function Fn(e,t){return h(e.className.baseVal)?e.className=t:e.className.baseVal=t,this}function Hn(e){return h(e.className.baseVal)?e.className:e.className.baseVal}function Nn(e,t){var n=t||new Le(0,0);return e.style[rn]=me.any3d?"translate3d("+n.x+"px,"+n.y+"px,0px)":"translate("+n.x+"px,"+n.y+"px)",this}function Bn(e){return/<[a-z\][\s\S]*>/i.test(e)}function zn(e,t){var n=Gn(e);g(t)?n.innerHTML=t:n.appendChild(t);var i=new Pt(n.clientWidth,n.clientHeight);return mn(n),i}function Gn(e){var t=document.createElement(e);return t.style.cssText="position:absolute;left:-10000px;top:-10000px;",document.body.appendChild(t),t}var Un=yn,Vn=vn;function jn(e){return e&&("mousemove"===e||"touchmove"===e)}function Wn(e,t){var n=a();return!!(e._mousemoveTime&&n-e._mousemoveTime<(t||48))||(e._mousemoveTime=n,!1)}var qn=Object.freeze({__proto__:null,CSSFILTER:fn,MOUSEMOVE_THROTTLE_TIME:48,TRANSFORM:rn,TRANSFORMORIGIN:sn,TRANSITION:un,addClass:Dn,addDomEvent:yn,computeDomPosition:kn,createEl:dn,createElOn:pn,getClass:Hn,getDomRuler:Gn,getEventContainerPoint:En,hasClass:Ln,isHTML:Bn,isMousemoveEventBlocked:Wn,isMoveEvent:jn,listensDomEvent:xn,measureDom:zn,off:Vn,offsetDom:Pn,on:Un,preventDefault:wn,preventSelection:Cn,removeDomEvent:vn,removeDomNode:mn,removeTransform:function(e){return e.style[rn]&&(e.style[rn]=""),this},setClass:Fn,setOpacity:function(e,t){return e.style.opacity=t,this},setStyle:Rn,setTransform:Nn,setTransformMatrix:function(e,t){var n="matrix("+(g(t)?t:t.join())+")";return e.style[rn]!==n&&(e.style[rn]=n),this},stopPropagation:Sn}),Zn={jsonp:function(e,t){var n="_maptalks_jsonp_"+Ne();e.match(/\?/)?e+="&callback="+n:e+="?callback="+n;var i=document.createElement("script");return i.type="text/javascript",i.src=e,window[n]=function(e){t(null,e),document.getElementsByTagName("head")[0].removeChild(i),i=null,delete window[n]},document.getElementsByTagName("head")[0].appendChild(i),this},get:function(e,t,i){if(m(t)){var o=i;i=t,t=o}if(n&&Zn.get.node)return Zn.get.node(e,i,t);var s=Zn._getClient(i);if(s.open("GET",e,!0),t){for(var a in t.headers)s.setRequestHeader(a,t.headers[a]);s.withCredentials="include"===t.credentials,t.responseType&&(s.responseType=t.responseType)}return s.send(null),s},post:function(e,t,i){var o;if(g(e)){if(m(t)){var s=i;i=t,t=s}o=(t=t||{}).postData}else{o=t,e=(t=e).url,i=i}if(n&&Zn.post.node)return t.url=e,Zn.post.node(t,o,i);var a=Zn._getClient(i);if(a.open("POST",t.url,!0),t.headers||(t.headers={}),t.headers["Content-Type"]||(t.headers["Content-Type"]="application/x-www-form-urlencoded"),"setRequestHeader"in a)for(var l in t.headers)t.headers.hasOwnProperty(l)&&a.setRequestHeader(l,t.headers[l]);return g(o)||(o=JSON.stringify(o)),a.send(o),a},_wrapCallback:function(e,t){return function(){4===e.readyState&&(200===e.status?"arraybuffer"===e.responseType?0===e.response.byteLength?t(new Error("http status 200 returned without content.")):t(null,{data:e.response,cacheControl:e.getResponseHeader("Cache-Control"),expires:e.getResponseHeader("Expires"),contentType:e.getResponseHeader("Content-Type")}):t(null,e.responseText):t(new Error(e.statusText+","+e.status)))}},_getClient:function(e){var t;try{t=new XMLHttpRequest}catch(e){try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}return t.onreadystatechange=Zn._wrapCallback(t,e),t},getArrayBuffer:function(e,t,n){if(m(t)){var i=n;n=t,t=i}return t||(t={}),t.responseType="arraybuffer",Zn.get(e,t,n)},getImage:function(e,t,n){return Zn.getArrayBuffer(t,n,(function(t,n){if(t)e.onerror&&e.onerror(t);else if(n){var i=window.URL||window.webkitURL,o=e.onload;e.onload=function(){o&&o(),i.revokeObjectURL(e.src)};var s=new Blob([new Uint8Array(n.data)],{type:n.contentType});e.cacheControl=n.cacheControl,e.expires=n.expires,e.src=n.data.byteLength?i.createObjectURL(s):at}}))},getJSON:function(e,t,n){}};Zn.getJSON=function(e,t,n){if(m(t)){var i=n;n=t,t=i}var o=function(e,t){var i=t?ze(t):null;n(e,i)};return t&&t.jsonp?Zn.jsonp(e,o):Zn.get(e,t,o)};var Xn="",Jn=/data:image\/.*;base64,/;function $n(e,t={}){for(var n in t){var i=t[n];if(i&&i.target&&(a=n,c(s=e)&&(s+=Xn),c(a)&&(a+=Xn),s&&a&&(s.includes?s.includes(a):s.indexOf(a)>-1))){var{target:o}=i;return e.replace(n,o)}}var s,a;return Xn}var Kn,ni={host:Xn,resources:{},proxy:{},origin:{},fromJSON:function(e){try{g(e)&&(e=JSON.parse(e)),f(e)&&l(ni,e)}catch(e){console.error(e)}},toJSON:function(){return{host:ni.host,proxy:l({},ni.proxy||{}),origin:l({},ni.origin||{})}},getResource:function(e){return ni.resources[e]},removeResource:function(e){delete ni.resources[e]},addResource:function(e,t){ni.resources[e]?console.warn(e+" resource Already exists,the "+e+" Cannot be added,the resource name Cannot repeat "):ni.resources[e]=t},updateResource:function(e,t){ni.resources[e]=t},allResource:function(){return ni.resources},loadSprite:function(e={imgUrl:"",jsonUrl:""}){return new Promise((function(t,n){var{imgUrl:i,jsonUrl:o}=e;if(!i||!o)return n(new Error("not find imgUrl/jsonUrl from options")),void console.error(e);function s(e,t,n){e.width=t,e.height=n;var i=e.getContext("2d");return i.clearRect(0,0,t,n),i}function a(i={},o){var a=function(){var e;return me.IS_NODE?console.error("Current environment does not support canvas dom"):e=dn("canvas"),e}();if(a){var l=[];for(var h in i){l.push({name:h,spriteItem:i[h]})}var c=function(){var e;return me.decodeImageInWorker&&(e=new OffscreenCanvas(2,2)),e}(),u=e.sourceName||"";l.forEach((function(e){var t,{name:n,spriteItem:i}=e,{x:l,y:h,width:f,height:g}=i;c?(s(c,f,g).drawImage(o,l,h,f,g,0,0,f,g),t=c.transferToImageBitmap()):(s(a,f,g).drawImage(o,l,h,f,g,0,0,f,g),t=a.toDataURL());e.resource=t,ni.addResource(u+n,t)})),t(l)}else n(new Error("can not create canvas"))}Zn.getJSON(o,{},(function(e,t){if(e)n(e);else{var o=new Image;o.onload=function(){a(t,o)},o.onerror=function(e){n(e)},Zn.getImage(o,i,{})}}))}))},loadSvgs:function(e){return new Promise((function(t,n){var i="",o=[],s="",a="",l="";if(Array.isArray(e)||e instanceof NodeList)o=e;else if(f(e)){i=e.url,o=e.symbols,s=e.fill,a=e.stroke,l=e.sourceName||""}else g(e)&&(i=e);if(i||!o||0!==o.length){var h=[],c=function(e,t){var n=ai(t);n&&(n.forEach((function(e){s&&(e.fill=s),a&&(e.stroke=a)})),ni.addResource(l+e,n)),h.push({name:e,paths:n,body:t})};if(i&&g(i))fetch(i).then((function(e){return e.json()})).then((function(e){e.forEach((function(e){var{name:t,body:n}=e;c(t,n)})),t(h)})).catch((function(e){console.log(e),n(e)}));else if(o){for(var u=0,m=o.length;u<m;u++){var A=o[u],x=A.id;x&&c(x,"<xml><svg>"+A.innerHTML+"</svg></xml>")}t(h)}else n(new Error("not support svgs params type"))}else n(new Error("not find svgs data"))}))}};function ii(e){if(c(e)&&(e+=Xn),!e)return console.error("resouce path is null,path:",e),e;if(!g(e))return e;if(function(e){return Jn.test(e)}(e)||function(e){return 0===e.indexOf("blob:")}(e))return e;if("$"===e[0])return ni.getResource(e.substring(1,1/0))||"";var t=ni.origin||{},n=$e(e);if(n&&f(t)){var i=$n(e,t);return i||e}var o=ni.proxy||{};if(f(o)){var s=$n(e,o);if(s)return s}var{host:a}=ni;return!n&&a&&g(a)?""+a+e:gt(e)}function si(e,t){return e?e[t]&&e[t].value:null}function ai(e){var t=(Kn||(Kn=new DOMParser),Kn).parseFromString(e,"text/xml").querySelector("svg");if(!t)return null;for(var n=t.childNodes,i=[],o=t.attributes,s=si(o,"fill"),a=si(o,"fill-opacity"),l=si(o,"stroke"),h=si(o,"stroke-opacity"),c=si(o,"stroke-width"),u=0,f=n.length;u<f;u++){var g=n[u],m=g.attributes;if(m){var A=void 0,x="path"===(g.tagName||"").toLowerCase();if(A=x?si(m,"d"):g){var T=si(m,"fill")||s,w=si(m,"stroke")||l,S={path:A};if(T&&(S.fill=T,S["fill-opacity"]=si(m,"fill-opacity")||a||1),w&&(S.stroke=w,S["stroke-opacity"]=si(m,"stroke-opacity")||h||1,S["stroke-width"]=si(m,"stroke-width")||c||1),i.push(S),!x)for(var I in S)"path"!==I&&S.hasOwnProperty(I)&&g.setAttribute(I,S[I])}}}return i}let li;const hi={width:100,height:10};let ci=!1;try{const e=new OffscreenCanvas(1,1);e.getContext("2d").fillText("hello",0,0),ci=!0}catch(e){ci=!1}let fi=class ColorIn{constructor(e,t={}){if(!Array.isArray(e))return void console.error("colors is not array");if(e.length<2)return void console.error("colors.length should >1");this.colors=e;let n=1/0,i=-1/0;for(let t=0,o=e.length;t<o;t++){const o=e[t][0];n=Math.min(o,n),i=Math.max(o,i)}this.min=n,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},hi,t),this._initImgData()}getImageData(){return this.imgData}_initImgData(){const e=function(){if(!li){const{width:e,height:t}=hi;ci?li=new OffscreenCanvas(e,t):(li=document.createElement("canvas"),li.width=e,li.height=t)}return li}(),{width:t,height:n}=this.options;e.width=t,e.height=n;const i=e.getContext("2d");i.clearRect(0,0,e.width,e.height);const o=i.createLinearGradient(0,0,e.width,0),{colors:s,valueOffset:a}=this;for(let e=0,t=s.length;e<t;e++){const[t,n]=s[e];o.addColorStop((t-this.min)/a,n)}i.fillStyle=o,i.fillRect(0,0,e.width,e.height),this.imgData=i.getImageData(0,0,e.width,e.height)}getColor(e){e=Math.max(this.min,e),e=Math.min(e,this.max);let t=Math.round((e-this.min)/this.valueOffset*this.imgData.width);t=Math.min(t,this.imgData.width-1);const n=4*t;return[this.imgData.data[n],this.imgData.data[n+1],this.imgData.data[n+2],this.imgData.data[n+3]]}};var di;function gi(e){return null==e}function mi(e){return!gi(e)}function Ai(e){return""===e}function vi(e,t){var n,i,o;if(Li(e)){var s,a=e.stops&&"object"==typeof e.stops[0][0],l=a||mi(e.property),h=a||!l,c=e.type||t||"exponential";if("exponential"===c)s=Ti;else if("interval"===c)s=bi;else if("categorical"===c)s=xi;else if("identity"===c)s=Mi;else if("color-interpolate"===c)s=Si;else{if("calculate-expression"!==c)throw new Error('Unknown function type "'+c+'"');s=Pi}if(a){var u={},f=[];for(let t=0;t<e.stops.length;t++){var g=e.stops[t];void 0===u[g[0].zoom]&&(u[g[0].zoom]={zoom:g[0].zoom,type:e.type,property:e.property,default:e.default,stops:[]}),u[g[0].zoom].stops.push([g[0].value,g[1]])}for(let e in u)f.push([u[e].zoom,vi(u[e])]);n=function(t,n){const i=Ti({stops:f,base:e.base},t)(t,n);return"function"==typeof i?i(t,n):i},i=!1,o=!1}else h?(n=function(t){const n=s(e,t);return"function"==typeof n?n(t):n},i=!0,o=!1):(n=function(t,n){const i=s(e,n?n[e.property]:null);return"function"==typeof i?i(t,n):i},i=!1,o=!0)}else n=function(){return e},i=!0,o=!0;return n.isZoomConstant=o,n.isFeatureConstant=i,n}function xi(e,t){for(let n=0;n<e.stops.length;n++)if(t===e.stops[n][0])return e.stops[n][1];return e.default}function bi(e,t){for(var n=0;n<e.stops.length&&!(t<e.stops[n][0]);n++);return e.stops[Math.max(n-1,0)][1]}function Ti(e,t){for(var n=mi(e.base)&&!Ai(e.base)?e.base:1,i=0;!(i>=e.stops.length||t<=e.stops[i][0]);)i++;return 0===i?e.stops[i][1]:i===e.stops.length?e.stops[i-1][1]:Oi(t,n,e.stops[i-1][0],e.stops[i][0],e.stops[i-1][1],e.stops[i][1])}"function"==typeof Map&&(di=new Map);const wi={width:100,height:1};function Si(e,t){const n=e.stops;if(n&&n.length>1){let e;if(di){const t=JSON.stringify(n);if(!di.has(t)){const e=new fi(n,wi);di.set(t,e)}e=di.get(t)}else e=new fi(n,wi);const[i,o,s,a]=e.getColor(t);return[i/255,o/255,s/255,a/255]}return n&&1===n.length?n[0][1]:null}function Mi(e,t){return function(e,t,n){return mi(e)?e:mi(t)?t:mi(n)?n:null}(t,e.default)}function Pi(e,t){const n=String(e.property),i=e.expression,o=t;function s(t){return gi(t)||Ai(t)||isNaN(t)?e.default:t}if(!mi(t)||Ai(t)||isNaN(t)||t<0)return s(e.default);{const t=function e(t,n,i){const o=Number(i),s=String(n);return Array.isArray(t)?t.map((t=>e(t,s,o))):t===s?o:t}(i,n,o);return s(function t(n){if(!Array.isArray(n)){if("number"==typeof n)return n;throw new Error("Invalid expression format")}{const i=n[0];if(!["+","-","*","/"].includes(i))throw new Error(`Unknown operator: ${i}`);const o=n.slice(1).map((e=>t(e)));switch(i){case"+":return o.reduce(((e,t)=>e+t),0);case"-":return o.reduce(((e,t)=>e-t));case"*":return o.reduce(((e,t)=>e*t),1);case"/":return o.some((e=>0===e))?e.default:o.reduce(((e,t)=>e/t));default:throw new Error(`Unsupported operator: ${i}`)}}}(t))}}function Oi(e,t,n,i,o,s){return"function"==typeof o?function(){var a=o.apply(void 0,arguments),l=s.apply(void 0,arguments);return Oi(e,t,n,i,a,l)}:o.length?function(e,t,n,i,o,s){var a=[];for(let l=0;l<o.length;l++)a[l]=ki(e,t,n,i,o[l],s[l]);return a}(e,t,n,i,o,s):ki(e,t,n,i,o,s)}function ki(e,t,n,i,o,s){var a,l=i-n,h=e-n;return o*(1-(a=1===t?h/l:(Math.pow(t,h)-1)/(Math.pow(t,l)-1)))+s*a}function Li(e){return e&&"object"==typeof e&&(e.stops||e.property&&"identity"===e.type||e.expression&&"calculate-expression"===e.type)}function Di(e){for(const t in e)if(Li(e[t]))return!0;return!1}function Fi(e){return Ui(e,"exponential")}function Bi(e,t){if(!e)return null;var n=!1;if(Array.isArray(e)){var i,o=[];for(let s=0;s<e.length;s++)(i=Bi(e[s],t))?(o.push(i),n=!0):o.push(e[s]);return n?o:e}var s,a={__fn_types_loaded:!0},l=[];for(s in e)e.hasOwnProperty(s)&&l.push(s);const h=function(e){Object.defineProperty(a,e,{get:function(){return this["__fn_"+e]||(this["__fn_"+e]=Fi(this["_"+e])),this["__fn_"+e].apply(this,t())},set:function(t){this["_"+e]=t},configurable:!0,enumerable:!0})};for(let t=0,i=l.length;t<i;t++)Li(e[s=l[t]])?(n=!0,a["_"+s]=e[s],h(s)):a[s]=e[s];return n?a:e}function zi(e){if(!e||!e.stops)return[];const t=[];for(let n=0,i=e.stops.length;n<i;n++)t.push(e.stops[n][1]);return t}function Ui(e,t){if(!Li(e))return function(){return e};let n=!0,i=!0;const o=(e=JSON.parse(JSON.stringify(e))).stops;if(o)for(let e=0;e<o.length;e++)if(Li(o[e][1])){const s=Ui(o[e][1],t);n=n&&s.isZoomConstant,i=i&&s.isFeatureConstant,o[e]=[o[e][0],s]}const s=vi(e,t);return s.isZoomConstant=n&&s.isZoomConstant,s.isFeatureConstant=i&&s.isFeatureConstant,s} /*! Feature Filter by (c) mapbox 2016 and maptalks 2018 www.mapbox.com | www.maptalks.org License: MIT, header required. */const ji=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function qi(e){return new Function("f",`var p = (f && f.properties || {}); return ${Zi(e)}`)}function Zi(e){if(!e)return"true";const t=e[0];if(e.length<=1)return"any"===t?"false":"true";const n="=="===t?Qi(e[1],e[2],"===",!1):"!="===t?Qi(e[1],e[2],"!==",!1):"<"===t||">"===t||"<="===t||">="===t?Qi(e[1],e[2],t,!0):"any"===t?$i(e.slice(1),"||"):"all"===t?$i(e.slice(1),"&&"):"none"===t?tr($i(e.slice(1),"||")):"in"===t?Ki(e[1],e.slice(2)):"!in"===t?tr(Ki(e[1],e.slice(2))):"has"===t?er(e[1]):"!has"===t?tr(er(e[1])):"contains"===t?function(e,t,n){const i=Yi(e);return void 0!==n?`(${i} + '').indexOf("${t}") === ${n}`:`(${i} + '').indexOf("${t}") >= 0`}(e[1],e[2],e[3]):"true";return`(${n})`}function Yi(e){return"$"===e[0]?"f."+e.substring(1):"p["+JSON.stringify(e)+"]"}function Qi(e,t,n,i){if("object"==typeof(o=e)&&o&&e.op)return function(e,t,n,i){const o=e.property,s=e.op;let a=Yi(o);return"length"!==s?(console.error(`not support ${s} op`),"false"):(a=`((${a}+='').length)`,Ji(a,o,t,n,i))}(e,t,n,i);var o;return Ji(Yi(e),e,t,n,i)}function Ji(e,t,n,i,o){const s="$type"===t?ji.indexOf(n):JSON.stringify(n);return(o?`typeof ${e}=== typeof ${s}&&`:"")+e+i+s}function $i(e,t){return e.map(Zi).join(t)}function Ki(e,t){"$type"===e&&(t=t.map((e=>ji.indexOf(e))));const n=JSON.stringify(t.sort(nr)),i=Yi(e);return t.length<=200?`${n}.indexOf(${i}) !== -1`:`function(v, a, i, j) {\n while (i <= j) { var m = (i + j) >> 1;\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\n }\n return false; }(${i}, ${n},0,${t.length-1})`}function er(e){return"$id"===e?'"id" in f':`${JSON.stringify(e)} in p`}function tr(e){return`!(${e})`}function nr(e,t){return e<t?-1:e>t?1:0}function or(e){const t=e._toJSON(),n=t.feature;return n.type=ji.indexOf(n.geometry.type),n.subType=t.subType,n}function sr(e){if(!Array.isArray(e))return sr([e]);const t=[];for(let n=0;n<e.length;n++){let i;i=!0===e[n].filter?function(){return!0}:qi(e[n].filter),t.push(ar({},e[n],{filter:i}))}return t}function ar(e){for(let t=1;t<arguments.length;t++){const n=arguments[t];for(const t in n)e[t]=n[t]}return e}var lr={};var hr=[],cr={};function ur(e,t){return Bi(e,(function(){var e=t.getMap(),n=0,i=0,o=10,s=!!e;if(e){var a=lr[e.id];a?(n=a.bearing,i=a.pitch,o=a.zoom):(n=e.getBearing(),i=e.getPitch(),o=e.getZoom())}var h=!1;if(t._funTypeProperties=t._funTypeProperties||{},t.propertiesDirty)t._funTypeProperties={},t.propertiesDirty=!1,h=!0;else{var c=t._funTypeProperties;h=c["{bearing}"]!==n||c["{pitch}"]!==i||c["{zoom}"]!==o}var u=t._funTypeProperties;return h&&(u=l(u||{},t.getProperties(),function(e,t,n,i){return e["{bearing}"]=t,e["{pitch}"]=n,e["{zoom}"]=i,e}(cr,n,i,o))),function(e,t,n){return e[0]=t,e[1]=n,e}(hr,s?o:12,u)}))}var fr=Object.freeze({__proto__:null,compileStyle:sr,createFilter:qi,getFilterFeature:or,getFunctionTypeResources:zi,hasFunctionDefinition:Di,interpolated:Fi,isFeatureFilter:function e(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":case"!has":return 2===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"in":case"!in":return t.length>=2&&("string"==typeof t[1]||t[1].property&&t[1].op);case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"none":case"any":case"all":for(const n of t.slice(1))if(!e(n)&&"boolean"!=typeof n)return!1;return!0;case"contains":return!0;default:return!1}},isFunctionDefinition:Li,loadFunctionTypes:Bi,loadGeoSymbol:ur});function dr(e){var t={stroke:{stroke:e.markerLineColor,"stroke-width":e.markerLineWidth,"stroke-opacity":e.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:e.markerFill,"fill-opacity":e.markerFillOpacity}};return 0===t.stroke["stroke-width"]&&(t.stroke["stroke-opacity"]=0),t}function pr(e,t,n){if(!e.markerPath)return null;var i=1,o=dr(e);c(e.markerOpacity)&&(i=e.markerOpacity),c(e.opacity)&&(i*=e.opacity);var s,a={};if(o){for(var u in o.stroke)o.stroke.hasOwnProperty(u)&&(h(o.stroke[u])||(a[u]=o.stroke[u]));for(var f in o.fill)o.fill.hasOwnProperty(f)&&(h(o.fill[f])||(a[f]=o.fill[f]))}var m,A=e.markerPath;s=g(A)&&"$"===A[0]?ni.getResource(A.substring(1,1/0))||[]:Array.isArray(e.markerPath)?e.markerPath:[e.markerPath];for(var x=[],T=0;T<s.length;T++)(m=l({},a,m=g(s[T])?{path:s[T]}:s[T])).d=m.path,delete m.path,x.push(m);var w=['<svg version="1.1"','xmlns="http://www.w3.org/2000/svg"'];i<1&&w.push('opacity="'+i+'"'),e.markerPathWidth&&e.markerPathHeight&&w.push('viewBox="0 0 '+e.markerPathWidth+" "+e.markerPathHeight+'"'),w.push('preserveAspectRatio="none"'),t&&w.push('width="'+t+'"'),n&&w.push('height="'+n+'"'),w.push("><defs></defs>");for(var S=0;S<x.length;S++)if(x[S].d instanceof Element)w.push(x[S].d.outerHTML);else{var I="<path";for(var E in x[S])x[S].hasOwnProperty(E)&&(I+=" "+E+'="'+x[S][E]+'"');w.push(I+="></path>")}return w.push("</svg>"),"data:image/svg+xml;base64,"+rt(w.join(" "))}function gr(e,t){if(!e)return[];var n=e;Array.isArray(e)||(n=[e]);for(var i,o,s,a,l=[],h=bt,c=n.length-1;c>=0;c--)if(e=n[c]){t&&(e=mr(e));for(var u=0;u<h.length;u++)if(Li(i=e[h[u]])&&(i=zi(i)),i){Array.isArray(i)||(i=[i]);for(var f=0;f<i.length;f++)"url("===i[f].slice(0,4)&&(i[f]=nt(i[f])),l.push([i[f],e[(o=Tt[u])[0]],e[o[1]]])}if("path"===e.markerType&&e.markerPath)if(s=Li(e.markerWidth)?200:e.markerWidth,a=Li(e.markerHeight)?200:e.markerHeight,Li(e.markerPath)){i=zi(e.markerPath);for(var g=e.markerPath,m=0;m<i.length;m++)e.markerPath=i[m],l.push([pr(e),s,a]);e.markerPath=g}else l.push([pr(e),s,a])}return l}function mr(e){if(!e)return null;var t=e;if(n)return t;for(var i,o=bt,s=0,a=o.length;s<a;s++)(i=t[o[s]])&&(t[o[s]]=Ar(i));return t}function Ar(e){if(Li(e)&&e.stops){for(var t=e.stops,n=0;n<t.length;n++)t[n][1]=Ar(t[n][1]);return e}return"url("===e.slice(0,4)&&(e=nt(e)),e}function yr(e){return e&&me.decodeImageInWorker&&e instanceof ImageBitmap}function _r(e){return e&&e.colorStops}function xr(e){var t=[e.type];if(e.places&&t.push(e.places.join()),e.colorStops){for(var n=[],i=e.colorStops.length-1;i>=0;i--)n.push(e.colorStops[i].join());t.push(n.join(","))}return t.join("_")}function br(e,t){if(!e)return 1;var n=[];if(Array.isArray(e)){for(var i=0;i<e.length;i++)n.push(br(e[i],t));return n.sort().join(",")}var o=Object.keys(e).sort().reduce((function(n,i){return t&&0!==i.indexOf(t)||(n[i]=e[i]),n}),{});return en(JSON.stringify(o))}function Tr(e,t){function n(e,t){h(e.opacity)?e.opacity=t:e.opacity*=t}var i;if(Array.isArray(e)){i=[];for(var o=0;o<e.length;o++){var s=l({},e[o]);n(s,t),i.push(s)}}else n(i=l({},e),t);return i}function Pr(...e){var t=e[0],n=Array.prototype.slice.call(e,1);if(n&&n.length||(n=[{}]),Array.isArray(t)){for(var i,o,s=[],a=0,c=t.length;a<c;a++){i=t[a],o={};for(var u=0,f=n.length;u<f;u++)Array.isArray(n[u])?h(n[u][a])?l(o,i||{}):l(o,i,n[u][a]):l(o,i,n[u]?n[u]:{});s.push(o)}return s}var g=[{},t];return g.push.apply(g,n),l.apply(this,g)}function Ir(e){if(e.symbol&&(e=[e]),Array.isArray(e))return e;var t=e.$root,n=e.$iconset;if(e=e.style,t||n){t&&"/"===t[t.length-1]&&(t=t.substring(0,t.length-1)),n&&"/"===n[n.length-1]&&(n=n.substring(0,n.length-1));kr(e,(function(e){return"{$root}"===e?t:"{$iconset}"===e?n:null}))}return e}function kr(e,t){for(var n=0;n<e.length;n++){var{symbol:i}=e[n];i&&Rr(i,t)}}var Er=/(\{\$root\}|\{\$iconset\})/g;function Rr(e,t){for(var n in e)e.hasOwnProperty(n)&&"textName"!==n&&(g(e[n])&&e[n].length>2?e[n]=e[n].replace(Er,t):Li(e[n])?e[n]=Lr(e[n],t):f(e[n])&&Rr(e[n],t))}function Lr(e,t){var n=e.default;g(n)&&(e.default=n.replace(Er,t));var i=e.stops;if(!i)return e;for(var o=0;o<i.length;o++)Array.isArray(i[o])&&(g(i[o][1])?i[o][1]=i[o][1].replace(Er,t):Li(i[o][1])&&(i[o][1]=Lr(i[o][1],t)));return e}function Dr(e=[]){Array.isArray(e)||(e=[e]);for(var t=e.length,n=0;n<t;n++){var i=e[n];if(i.style){var{lineDasharray:o,l