@maptalks/vt 0.63.6 → 0.63.9

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,5 +1,5 @@
1
1
  /*!
2
- * @maptalks/vt v0.63.6
2
+ * @maptalks/vt v0.63.9
3
3
  * LICENSE : undefined
4
4
  * (c) 2016-2022 maptalks.org
5
5
  */
@@ -11,7 +11,7 @@ import { reshader as n, vec3 as i, mat4 as r, GroundPainter as s, createREGL as
11
11
 
12
12
  import { compileStyle as d, createFilter as p } from "@maptalks/feature-filter";
13
13
 
14
- import { loadFunctionTypes as m, isFunctionDefinition as y, interpolated as g, piecewiseConstant as v } from "@maptalks/function-type";
14
+ import { loadFunctionTypes as y, isFunctionDefinition as m, interpolated as g, piecewiseConstant as v } from "@maptalks/function-type";
15
15
 
16
16
  import { IconRequestor as x, GlyphRequestor as b, PointPack as A, VectorPack as w, StyledPoint as _, LinePack as S, StyledVector as M, SYMBOLS_NEED_REBUILD_IN_VECTOR as P, PolygonPack as T, SYMBOLS_NEED_REBUILD_IN_VT as k } from "@maptalks/vector-packer";
17
17
 
@@ -27,7 +27,7 @@ import F from "@maptalks/vt-plugin";
27
27
 
28
28
  import E from "@mapbox/point-geometry";
29
29
 
30
- const H = 'function(t){\n/*!\n Feature Filter by\n\n (c) mapbox 2016 and maptalks 2018\n www.mapbox.com | www.maptalks.org\n License: MIT, header required.\n */\nconst n=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function i(t){return new Function("f","var p = (f && f.properties || {}); return "+e(t))}function e(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return`(${"=="===n?s(t[1],t[2],"===",!1):"!="===n?s(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?s(t[1],t[2],n,!0):"any"===n?o(t.slice(1),"||"):"all"===n?o(t.slice(1),"&&"):"none"===n?u(o(t.slice(1),"||")):"in"===n?a(t[1],t.slice(2)):"!in"===n?u(a(t[1],t.slice(2))):"has"===n?h(t[1]):"!has"===n?u(h(t[1])):"true"})`}function r(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function s(t,i,e,s){const o=r(t),a="$type"===t?n.indexOf(i):JSON.stringify(i);return(s?`typeof ${o}=== typeof ${a}&&`:"")+o+e+a}function o(t,n){return t.map(e).join(n)}function a(t,i){"$type"===t&&(i=i.map(t=>n.indexOf(t)));const e=JSON.stringify(i.sort(l)),s=r(t);return i.length<=200?`${e}.indexOf(${s}) !== -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; }(${s}, ${e},0,${i.length-1})`}function h(t){return"$id"===t?\'"id" in f\':JSON.stringify(t)+" in p"}function u(t){return`!(${t})`}function l(t,n){return t<n?-1:t>n?1:0}function c(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function f(t,n){for(let i=0;i<t.stops.length;i++)if(n===t.stops[i][0])return t.stops[i][1];return t.default}function d(t,n){for(var i=0;i<t.stops.length&&!(n<t.stops[i][0]);i++);return t.stops[Math.max(i-1,0)][1]}function y(t,n){for(var i=void 0!==t.base?t.base:1,e=0;!(e>=t.stops.length||n<=t.stops[e][0]);)e++;return 0===e?t.stops[e][1]:e===t.stops.length?t.stops[e-1][1]:function t(n,i,e,r,s,o){return"function"==typeof s?function(){var a=s.apply(void 0,arguments),h=o.apply(void 0,arguments);return t(n,i,e,r,a,h)}:s.length?function(t,n,i,e,r,s){var o=[];for(let a=0;a<r.length;a++)o[a]=p(t,n,i,e,r[a],s[a]);return o}(n,i,e,r,s,o):p(n,i,e,r,s,o)}(n,i,t.stops[e-1][0],t.stops[e][0],t.stops[e-1][1],t.stops[e][1])}function v(t,n){return function(t,n,i){return void 0!==t?t:void 0!==n?n:void 0!==i?i:null}(n,t.default)}function p(t,n,i,e,r,s){var o,a=e-i,h=t-i;return r*(1-(o=1===n?h/a:(Math.pow(n,h)-1)/(Math.pow(n,a)-1)))+s*o}function m(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function g(t){return b(t,"exponential")}function w(t){return b(t,"interval")}function M(t,n){if(!t)return null;var i=!1;if(Array.isArray(t)){var e,r=[];for(let s=0;s<t.length;s++)(e=M(t[s],n))?(r.push(e),i=!0):r.push(t[s]);return i?r:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const h=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=g(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,e=a.length;n<e;n++)m(t[s=a[n]])?(i=!0,o["_"+s]=t[s],h(s)):o[s]=t[s];return i?o:t}function b(t,n){if(!m(t))return function(){return t};let i=!0,e=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(m(r[t][1])){const s=b(r[t][1],n);i=i&&s.isZoomConstant,e=e&&s.isFeatureConstant,r[t]=[r[t][0],s]}const s=function t(n,i){var e,r,s;if(m(n)){var o,a=n.stops&&"object"==typeof n.stops[0][0],h=a||void 0!==n.property,u=a||!h,l=n.type||i||"exponential";if("exponential"===l)o=y;else if("interval"===l)o=d;else if("categorical"===l)o=f;else{if("identity"!==l)throw new Error(\'Unknown function type "\'+l+\'"\');o=v}if(a){var c={},p=[];for(let t=0;t<n.stops.length;t++){var g=n.stops[t];void 0===c[g[0].zoom]&&(c[g[0].zoom]={zoom:g[0].zoom,type:n.type,property:n.property,default:n.default,stops:[]}),c[g[0].zoom].stops.push([g[0].value,g[1]])}for(let n in c)p.push([c[n].zoom,t(c[n])]);e=function(t,i){const e=y({stops:p,base:n.base},t)(t,i);return"function"==typeof e?e(t,i):e},r=!1,s=!1}else u?(e=function(t){const i=o(n,t);return"function"==typeof i?i(t):i},r=!0,s=!1):(e=function(t,i){const e=o(n,i?i[n.property]:null);return"function"==typeof e?e(t,i):e},r=!1,s=!0)}else e=function(){return n},r=!0,s=!0;return e.isZoomConstant=s,e.isFeatureConstant=r,e}(t,n);return s.isZoomConstant=i&&s.isZoomConstant,s.isFeatureConstant=e&&s.isFeatureConstant,s}let x=0;const F="function"==typeof Object.assign;function A(t,...n){if(F)return Object.assign(t,...n),t;for(let i=0;i<n.length;i++){const e=n[i];for(const n in e)t[n]=e[n]}return t}function k(t){return!O(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function P(t){return"number"==typeof t&&!isNaN(t)}function S(t){return!O(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function _(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function O(t){return null==t}function I(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];if(i)for(let n=0,e=i.length;n<e;n++)t.push(i[n])}return t.length}function T(t){return t<65536?Uint16Array:Uint32Array}function L(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function U(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function z(t){return function t(n){if(!Array.isArray(n))return t([n]);const e=[];for(let t=0;t<n.length;t++){let r;r=!0===n[t].filter?function(){return!0}:i(n[t].filter),e.push(c({},n[t],{filter:r}))}return e}(t=t.map(t=>{const n=A({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n}))}function D(t){return m(t)&&t.property}const E="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const i="_maptalks_jsonp_"+x++;t.match(/\\?/)?t+="&callback="+i:t+="?callback="+i;let e=document.createElement("script");return e.type="text/javascript",e.src=t,window[i]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(e),e=null,delete window[i]},document.getElementsByTagName("head")[0].appendChild(e),this},get:function(t,n,i){if(S(n)){const t=i;i=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const e="POST"===n.method;if(E){const r=new AbortController,s={signal:r.signal,method:n.method||"GET",referrerPolicy:"origin"};return e&&(O(n.body)||(s.body=JSON.stringify(n.body))),O(n.headers)||(s.headers=n.headers),O(n.credentials)||(s.credentials=n.credentials),fetch(t,s).then(t=>{const e=this.t(t,n.returnJSON,n.responseType);e.message?i(e):e.then(e=>{"arraybuffer"===n.responseType?i(null,{data:e,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}):i(null,e)}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))})}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))}),r}{const r=C.s(i);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(e?n.body:null),r}},t:(t,n,i)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===i?t.arrayBuffer():n?t.json():t.text(),o:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`})}},s:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=C.o(n,t),n},getArrayBuffer(t,n,i){if(S(n)){const t=i;i=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,i)}};function j(t,n,i,e,r,s){var o=r-i,a=s-e;if(0!==o||0!==a){var h=((t-i)*o+(n-e)*a)/(o*o+a*a);h>1?(i=r,e=s):h>0&&(i+=o*h,e+=a*h)}return(o=t-i)*o+(a=n-e)*a}function N(t,n,i,e){var r={id:void 0===t?null:t,type:n,geometry:i,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var n=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)H(t,n);else if("Polygon"===i||"MultiLineString"===i)for(var e=0;e<n.length;e++)H(t,n[e]);else if("MultiPolygon"===i)for(e=0;e<n.length;e++)for(var r=0;r<n[e].length;r++)H(t,n[e][r])}(r),r}function H(t,n){for(var i=0;i<n.length;i+=3)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function V(t,n,i,e){if(n.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],h=n.id;if(i.promoteId?h=n.properties[i.promoteId]:i.generateId&&(h=e||0),"Point"===s)R(r,a);else if("MultiPoint"===s)for(var u=0;u<r.length;u++)R(r[u],a);else if("LineString"===s)$(r,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<r.length;u++)a=[],$(r[u],a,o,!1),t.push(N(h,"LineString",a,n.properties));return}W(r,a,o,!1)}else if("Polygon"===s)W(r,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)V(t,{id:h,geometry:n.geometry.geometries[u],properties:n.properties},i,e);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var l=[];W(r[u],l,o,!0),a.push(l)}}t.push(N(h,s,a,n.properties))}}function R(t,n){n.push(q(t[0])),n.push(B(t[1])),n.push(0)}function $(t,n,i,e){for(var r,s,o=0,a=0;a<t.length;a++){var h=q(t[a][0]),u=B(t[a][1]);n.push(h),n.push(u),n.push(0),a>0&&(o+=e?(r*u-h*s)/2:Math.sqrt(Math.pow(h-r,2)+Math.pow(u-s,2))),r=h,s=u}var l=n.length-3;n[2]=1,function t(n,i,e,r){for(var s,o=r,a=e-i>>1,h=e-i,u=n[i],l=n[i+1],c=n[e],f=n[e+1],d=i+3;d<e;d+=3){var y=j(n[d],n[d+1],u,l,c,f);if(y>o)s=d,o=y;else if(y===o){var v=Math.abs(d-a);v<h&&(s=d,h=v)}}o>r&&(s-i>3&&t(n,i,s,r),n[s+2]=o,e-s>3&&t(n,s,e,r))}(n,0,l,i),n[l+2]=1,n.size=Math.abs(o),n.start=0,n.end=n.size}function W(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];$(t[r],s,i,e),n.push(s)}}function q(t){return t/360+.5}function B(t){var n=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return i<0?0:i>1?1:i}function G(t,n,i,e,r,s,o,a){if(e/=n,s>=(i/=n)&&o<e)return t;if(o<i||s>=e)return null;for(var h=[],u=0;u<t.length;u++){var l=t[u],c=l.geometry,f=l.type,d=0===r?l.minX:l.minY,y=0===r?l.maxX:l.maxY;if(d>=i&&y<e)h.push(l);else if(!(y<i||d>=e)){var v=[];if("Point"===f||"MultiPoint"===f)J(c,v,i,e,r);else if("LineString"===f)X(c,v,i,e,r,!1,a.lineMetrics);else if("MultiLineString"===f)Y(c,v,i,e,r,!1);else if("Polygon"===f)Y(c,v,i,e,r,!0);else if("MultiPolygon"===f)for(var p=0;p<c.length;p++){var m=[];Y(c[p],m,i,e,r,!0),m.length&&v.push(m)}if(v.length){if(a.lineMetrics&&"LineString"===f){for(p=0;p<v.length;p++)h.push(N(l.id,f,v[p],l.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===v.length?(f="LineString",v=v[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===v.length?"Point":"MultiPoint"),h.push(N(l.id,f,v,l.tags))}}}return h.length?h:null}function J(t,n,i,e,r){for(var s=0;s<t.length;s+=3){var o=t[s+r];o>=i&&o<=e&&(n.push(t[s]),n.push(t[s+1]),n.push(t[s+2]))}}function X(t,n,i,e,r,s,o){for(var a,h,u=Z(t),l=0===r?Q:tt,c=t.start,f=0;f<t.length-3;f+=3){var d=t[f],y=t[f+1],v=t[f+2],p=t[f+3],m=t[f+4],g=0===r?d:y,w=0===r?p:m,M=!1;o&&(a=Math.sqrt(Math.pow(d-p,2)+Math.pow(y-m,2))),g<i?w>i&&(h=l(u,d,y,p,m,i),o&&(u.start=c+a*h)):g>e?w<e&&(h=l(u,d,y,p,m,e),o&&(u.start=c+a*h)):K(u,d,y,v),w<i&&g>=i&&(h=l(u,d,y,p,m,i),M=!0),w>e&&g<=e&&(h=l(u,d,y,p,m,e),M=!0),!s&&M&&(o&&(u.end=c+a*h),n.push(u),u=Z(t)),o&&(c+=a)}var b=t.length-3;d=t[b],y=t[b+1],v=t[b+2],(g=0===r?d:y)>=i&&g<=e&&K(u,d,y,v),b=u.length-3,s&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&n.push(u)}function Z(t){var n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,i,e,r,s){for(var o=0;o<t.length;o++)X(t[o],n,i,e,r,s,!1)}function K(t,n,i,e){t.push(n),t.push(i),t.push(e)}function Q(t,n,i,e,r,s){var o=(s-n)/(e-n);return t.push(s),t.push(i+(r-i)*o),t.push(1),o}function tt(t,n,i,e,r,s){var o=(s-i)/(r-i);return t.push(n+(e-n)*o),t.push(s),t.push(1),o}function nt(t,n){for(var i=[],e=0;e<t.length;e++){var r,s=t[e],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=it(s.geometry,n);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var a=0;a<s.geometry.length;a++)r.push(it(s.geometry[a],n))}else if("MultiPolygon"===o)for(r=[],a=0;a<s.geometry.length;a++){for(var h=[],u=0;u<s.geometry[a].length;u++)h.push(it(s.geometry[a][u],n));r.push(h)}i.push(N(s.id,o,r,s.tags))}return i}function it(t,n){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var e=0;e<t.length;e+=3)i.push(t[e]+n,t[e+1],t[e+2]);return i}function et(t,n){if(t.transformed)return t;var i,e,r,s=1<<t.z,o=t.x,a=t.y;for(i=0;i<t.features.length;i++){var h=t.features[i],u=h.geometry,l=h.type;if(h.geometry=[],1===l)for(e=0;e<u.length;e+=2)h.geometry.push(rt(u[e],u[e+1],n,s,o,a));else for(e=0;e<u.length;e++){var c=[];for(r=0;r<u[e].length;r+=2)c.push(rt(u[e][r],u[e][r+1],n,s,o,a));h.geometry.push(c)}}return t.transformed=!0,t}function rt(t,n,i,e,r,s){return[Math.round(i*(t*e-r)),Math.round(i*(n*e-s))]}function st(t,n,i,e,r){for(var s=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:e,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,ot(o,t[a],s,r);var h=t[a].minX,u=t[a].minY,l=t[a].maxX,c=t[a].maxY;h<o.minX&&(o.minX=h),u<o.minY&&(o.minY=u),l>o.maxX&&(o.maxX=l),c>o.maxY&&(o.maxY=c)}return o}function ot(t,n,i,e){var r=n.geometry,s=n.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<r.length;a+=3)o.push(r[a]),o.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)at(o,r,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<r.length;a++)at(o,r[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var h=0;h<r.length;h++){var u=r[h];for(a=0;a<u.length;a++)at(o,u[a],t,i,!0,0===a)}if(o.length){var l=n.tags||null;if("LineString"===s&&e.lineMetrics){for(var c in l={},n.tags)l[c]=n.tags[c];l.mapbox_clip_start=r.start/r.size,l.mapbox_clip_end=r.end/r.size}var f={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:l};null!==n.id&&(f.id=n.id),t.features.push(f)}}function at(t,n,i,e,r,s){var o=e*e;if(e>0&&n.size<(r?o:e))i.numPoints+=n.length/3;else{for(var a=[],h=0;h<n.length;h+=3)(0===e||n[h+2]>o)&&(i.numSimplified++,a.push(n[h]),a.push(n[h+1])),i.numPoints++;r&&function(t,n){for(var i=0,e=0,r=t.length,s=r-2;e<r;s=e,e+=2)i+=(t[e]-t[s])*(t[e+1]+t[s+1]);if(i>0===n)for(e=0,r=t.length;e<r/2;e+=2){var o=t[e],a=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=o,t[r-1-e]=a}}(a,s),t.push(a)}}function ht(t,n){var i=(n=this.options=function(t,n){for(var i in n)t[i]=n[i];return t}(Object.create(this.options),n)).debug;if(i&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");var e=function(t,n){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)V(i,t.features[e],n,e);else"Feature"===t.type?V(i,t,n):V(i,{geometry:t},n);return i}(t,n);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(e=function(t,n){var i=n.buffer/n.extent,e=t,r=G(t,1,-1-i,i,0,-1,2,n),s=G(t,1,1-i,2+i,0,-1,2,n);return(r||s)&&(e=G(t,1,-i,1+i,0,-1,2,n)||[],r&&(e=nt(r,1).concat(e)),s&&(e=e.concat(nt(s,-1)))),e}(e,n)).length&&this.splitTile(e,0,0,0),i&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ut(t,n,i){return 32*((1<<t)*i+n)+t}function lt(t,n,i,e,r,s){const o=i&&Array.isArray(i[0]);for(let a=0,h=i.length;a<h;a++){t[n]=Math.round((o?i[a][0]:i[a].x)*e),t[n+1]=Math.round((o?i[a][1]:i[a].y)*e);let u=r||0;Array.isArray(r)&&(u=r[a]),u=u?Math.round(e*u):0,t[n+2]=u,n+=3,s&&0!==a&&a!==h-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return n}function ct(t,n,i,e){const r=t[3*n],s=t[3*n+1],o=t[3*i],a=t[3*i+1];return r===o&&(r<0||r>e)||s===a&&(s<0||s>e)}C.getJSON=function(t,n,i){if(S(n)){const t=i;i=n,n=t}const e=function(t,n){const e="string"==typeof n?JSON.parse(n):n||null;i(t,e)};return n&&n.jsonp?C.jsonp(t,e):((n=n||{}).returnJSON=!0,C.get(t,n,e))},ht.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ht.prototype.splitTile=function(t,n,i,e,r,s,o){for(var a=[t,n,i,e],h=this.options,u=h.debug;a.length;){e=a.pop(),i=a.pop(),n=a.pop(),t=a.pop();var l=1<<n,c=ut(n,i,e),f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=st(t,n,i,e,h),this.tileCoords.push({z:n,x:i,y:e}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,i,e,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+n;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=t,r){if(n===h.maxZoom||n===r)continue;var y=1<<r-n;if(i!==Math.floor(s/y)||e!==Math.floor(o/y))continue}else if(n===h.indexMaxZoom||f.numPoints<=h.indexMaxPoints)continue;if(f.source=null,0!==t.length){u>1&&console.time("clipping");var v,p,m,g,w,M,b=.5*h.buffer/h.extent,x=.5-b,F=.5+b,A=1+b;v=p=m=g=null,w=G(t,l,i-b,i+F,0,f.minX,f.maxX,h),M=G(t,l,i+x,i+A,0,f.minX,f.maxX,h),t=null,w&&(v=G(w,l,e-b,e+F,1,f.minY,f.maxY,h),p=G(w,l,e+x,e+A,1,f.minY,f.maxY,h),w=null),M&&(m=G(M,l,e-b,e+F,1,f.minY,f.maxY,h),g=G(M,l,e+x,e+A,1,f.minY,f.maxY,h),M=null),u>1&&console.timeEnd("clipping"),a.push(v||[],n+1,2*i,2*e),a.push(p||[],n+1,2*i,2*e+1),a.push(m||[],n+1,2*i+1,2*e),a.push(g||[],n+1,2*i+1,2*e+1)}}},ht.prototype.getTile=function(t,n,i){var e=this.options,r=e.extent,s=e.debug;if(t<0||t>24)return null;var o=1<<t,a=ut(t,n=(n%o+o)%o,i);if(this.tiles[a])return et(this.tiles[a],r);s>1&&console.log("drilling down to z%d-%d-%d",t,n,i);for(var h,u=t,l=n,c=i;!h&&u>0;)u--,l=Math.floor(l/2),c=Math.floor(c/2),h=this.tiles[ut(u,l,c)];return h&&h.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,l,c),s>1&&console.time("drilling down"),this.splitTile(h.source,u,l,c,t,n,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?et(this.tiles[a],r):null):null};class ft{constructor(t,n){this.x=t,this.y=n}clone(){return new ft(this.x,this.y)}normalize(){const t=this.length();this.x/=t,this.y/=t}negate(){this.x=-this.x,this.y=-this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}diff(t){return new ft(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new ft(this.y,-this.x)}}function dt(t,n,i){const e=(n.x-t.x)*(i.y-t.y)-(n.y-t.y)*(i.x-t.x);return e>1e-5?1:e<-1e-5?2:0}function yt(t,n,i,e){const r=n.x*e.y-n.y*e.x,s=i.x-t.x,o=i.y-t.y,a=(s*e.y-o*e.x)/r;return new ft(t.x+a*n.x,t.y+a*n.y)}const vt=[];function pt(t,n,i){let e=0;const r=[];for(let s=n;s<i;s+=3)vt[e]?(vt[e].x=t[s],vt[e].y=t[s+1]):vt[e]=new ft(t[s],t[s+1]),r.push(vt[e]),e++;const s=function(t){let n;this.UpdateOmbb=function(t,i,e,r,s,o,a,h){const u=yt(t,i,s,o),l=yt(e,r,s,o),c=yt(a,h,t,i),f=yt(a,h,e,r),d=u.distance(l)*u.distance(c);d<this.BestObbArea&&(n=[u,c,f,l],this.BestObbArea=d)},this.BestObbArea=Number.MAX_VALUE;const i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();const e=new ft(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new ft(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let s,o,a,h;for(let n=0;n<t.length;n++){const i=t[n];i.x<e.x&&(e.x=i.x,s=n),i.x>r.x&&(r.x=i.x,o=n),i.y<e.y&&(e.y=i.y,h=n),i.y>r.y&&(r.y=i.y,a=n)}let u=new ft(0,-1),l=new ft(0,1),c=new ft(-1,0),f=new ft(1,0);for(let n=0;n<t.length;n++){const n=[Math.acos(u.dot(i[s])),Math.acos(l.dot(i[o])),Math.acos(c.dot(i[a])),Math.acos(f.dot(i[h]))];switch(n.indexOf(Math.min.apply(Math,n))){case 0:u=i[s].clone(),l=u.clone(),l.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),s=(s+1)%t.length;break;case 1:l=i[o].clone(),u=l.clone(),u.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),o=(o+1)%t.length;break;case 2:c=i[a].clone(),f=c.clone(),f.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),a=(a+1)%t.length;break;case 3:f=i[h].clone(),c=f.clone(),c.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),h=(h+1)%t.length}this.UpdateOmbb(t[s],u,t[o],l,t[a],c,t[h],f)}return n}(function(t){if(t.length<3)return t;let n=t[0];const i=[];for(let i=1;i<t.length;i++)(t[i].x<n.x||Math.abs(t[i].x-n.x)<1e-5&&t[i].y<n.y)&&(n=t[i]);let e=t[0];do{i.unshift(n.clone());for(let i=1;i<t.length;i++){const r=dt(n,e,t[i]);(e.equals(n)||1===r||0===r&&n.distance(t[i])>n.distance(e))&&(e=t[i])}n=e}while(!e.equals(i[i.length-1]));return i}(r)),o=s[0].distance(s[1]),a=s[1].distance(s[2]),h=s.map(t=>[t.x,t.y]);return h.push(+(a>o)),h}var mt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(){var t=new mt(3);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function wt(t,n,i){var e=new mt(3);return e[0]=t,e[1]=n,e[2]=i,e}function Mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function bt(t,n,i,e){return t[0]=n,t[1]=i,t[2]=e,t}function xt(t,n,i){return t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t}function Ft(t,n,i){return t[0]=n[0]/i[0],t[1]=n[1]/i[1],t[2]=n[2]/i[2],t}function At(t,n){var i=n[0],e=n[1],r=n[2],s=i*i+e*e+r*r;return s>0&&(s=1/Math.sqrt(s),t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s),t}function kt(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pt(t,n,i){var e=n[0],r=n[1],s=n[2],o=i[0],a=i[1],h=i[2];return t[0]=r*h-s*a,t[1]=s*o-e*h,t[2]=e*a-r*o,t}var St=function(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t};function _t(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Ot(t,n,i,e,r){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t}function It(){var t=new mt(4);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Tt(t,n){var i=n[0]+n[4]+n[8],e=void 0;if(i>0)e=Math.sqrt(i+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;e=Math.sqrt(n[3*r+r]-n[3*s+s]-n[3*o+o]+1),t[r]=.5*e,e=.5/e,t[3]=(n[3*s+o]-n[3*o+s])*e,t[s]=(n[3*s+r]+n[3*r+s])*e,t[o]=(n[3*o+r]+n[3*r+o])*e}return t}gt(),function(){var t,n=(t=new mt(4),mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Lt,Ut=function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i,t},zt=function(t,n){var i=n[0],e=n[1],r=n[2],s=n[3],o=i*i+e*e+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=e*o,t[2]=r*o,t[3]=s*o),t};function Dt(t,n){var i=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(i*i+e*e)}function Et(t,n,i,e,r,s,o,a,h,u){0===t?function(t,n,i,e,r,s,o,a,h){const u=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],l=e[r+1];i[t]=u[0]+n*s*o/a,i[t+1]=u[1]-l*s*o/h}}(n,i,e,r,0,o,a,h,u):1===t&&function(t,n,i,e){const r=pt(e,t,n),s=r[4],o=r[s],a=r[s+1],h=r[s+2],u=(a[1]-o[1])/(a[0]-o[0]),l=(h[1]-a[1])/(h[0]-a[0]),c=Dt(o,a),f=Dt(a,h);for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],s=e[r+1];i[t]=jt(n,s,o,u,c),i[t+1]=-jt(n,s,a,l,f)}}(n,i,e,r)}gt(),wt(1,0,0),wt(0,1,0),It(),It(),Lt=new mt(9),mt!=Float32Array&&(Lt[1]=0,Lt[2]=0,Lt[3]=0,Lt[5]=0,Lt[6]=0,Lt[7]=0),Lt[0]=1,Lt[4]=1,Lt[8]=1,function(){var t=function(){var t=new mt(2);return mt!=Float32Array&&(t[0]=0,t[1]=0),t}()}();const Ct=[];function jt(t,n,i,e,r){return Ct[0]=(e*e*i[0]+e*(n-i[1])+t)/(e*e+1),Ct[1]=e*(Ct[0]-i[0])+i[1],Dt(i,Ct)/r}function Nt(t,n,i,e,r){const s=3*n[i-1],o=3*n[i-1]+1,a=t[s],h=t[o];return u=e,l=r,c=a,f=h,Math.sqrt((c-u)*(c-u)+(f-l)*(f-l));var u,l,c,f}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;var Ht=Vt;function Vt(t,n){this.x=t,this.y=n}function Rt(t,n,i){i=i||{},this.w=t||64,this.h=n||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function $t(t,n,i){this.x=0,this.y=t,this.w=this.free=n,this.h=i}function Wt(t,n,i,e,r,s,o){this.id=t,this.x=n,this.y=i,this.w=e,this.h=r,this.maxw=s||e,this.maxh=o||r,this.refcount=0}Vt.prototype={clone:function(){return new Vt(this.x,this.y)},add:function(t){return this.clone().u(t)},sub:function(t){return this.clone().v(t)},multByPoint:function(t){return this.clone().m(t)},divByPoint:function(t){return this.clone().M(t)},mult:function(t){return this.clone().F(t)},div:function(t){return this.clone().A(t)},rotate:function(t){return this.clone().k(t)},rotateAround:function(t,n){return this.clone().P(t,n)},matMult:function(t){return this.clone().S(t)},unit:function(){return this.clone()._()},perp:function(){return this.clone().O()},round:function(){return this.clone().I()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},S:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},u:function(t){return this.x+=t.x,this.y+=t.y,this},v:function(t){return this.x-=t.x,this.y-=t.y,this},F:function(t){return this.x*=t,this.y*=t,this},A:function(t){return this.x/=t,this.y/=t,this},m:function(t){return this.x*=t.x,this.y*=t.y,this},M:function(t){return this.x/=t.x,this.y/=t.y,this},_:function(){return this.A(this.mag()),this},O:function(){var t=this.y;return this.y=this.x,this.x=-t,this},k:function(t){var n=Math.cos(t),i=Math.sin(t),e=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=e,this.y=r,this},P:function(t,n){var i=Math.cos(t),e=Math.sin(t),r=n.x+i*(this.x-n.x)-e*(this.y-n.y),s=n.y+e*(this.x-n.x)+i*(this.y-n.y);return this.x=r,this.y=s,this},I:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Vt.convert=function(t){return t instanceof Vt?t:Array.isArray(t)?new Vt(t[0],t[1]):t},Rt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var i,e,r,s,o=[],a=0;a<t.length;a++)if(i=t[a].w||t[a].width,e=t[a].h||t[a].height,r=t[a].id,i&&e){if(!(s=this.packOne(i,e,r)))continue;n.inPlace&&(t[a].x=s.x,t[a].y=s.y,t[a].id=s.id),o.push(s)}return this.shrink(),o},Rt.prototype.packOne=function(t,n,i){var e,r,s,o,a,h,u,l,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof i||"number"==typeof i){if(e=this.getBin(i))return this.ref(e),e;"number"==typeof i&&(this.maxId=Math.max(i,this.maxId))}else i=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(e=this.freebins[o]).maxh&&t===e.maxw)return this.allocFreebin(o,t,n,i);n>e.maxh||t>e.maxw||n<=e.maxh&&t<=e.maxw&&(s=e.maxw*e.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(r=this.shelves[o]).h,!(t>r.free)){if(n===r.h)return this.allocShelf(o,t,n,i);n>r.h||n<r.h&&(s=(r.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,i):-1!==c.shelf?this.allocShelf(c.shelf,t,n,i):n<=this.h-f&&t<=this.w?(r=new $t(f,this.w,n),this.allocShelf(this.shelves.push(r)-1,t,n,i)):this.autoResize?(a=h=this.h,((u=l=this.w)<=a||t>u)&&(l=2*Math.max(t,u)),(a<u||n>a)&&(h=2*Math.max(n,a)),this.resize(l,h),this.packOne(t,n,i)):null},Rt.prototype.allocFreebin=function(t,n,i,e){var r=this.freebins.splice(t,1)[0];return r.id=e,r.w=n,r.h=i,r.refcount=0,this.bins[e]=r,this.ref(r),r},Rt.prototype.allocShelf=function(t,n,i,e){var r=this.shelves[t].alloc(n,i,e);return this.bins[e]=r,this.ref(r),r},Rt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,i=0;i<this.shelves.length;i++){var e=this.shelves[i];n+=e.h,t=Math.max(e.w-e.free,t)}this.resize(t,n)}},Rt.prototype.getBin=function(t){return this.bins[t]},Rt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},Rt.prototype.unref=function(t){return 0===t.refcount?0:(0==--t.refcount&&(this.stats[t.h]--,delete this.bins[t.id],this.freebins.push(t)),t.refcount)},Rt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},Rt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(t);return!0},$t.prototype.alloc=function(t,n,i){if(t>this.free||n>this.h)return null;var e=this.x;return this.x+=t,this.free-=t,new Wt(i,e,this.y,t,n,t,this.h)},$t.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var qt={exports:{}};qt.exports=function(){function t(t,n,i){var e=t[n];t[n]=t[i],t[i]=e}function n(t,n){return t<n?-1:t>n?1:0}return function(i,e,r,s,o){!function n(i,e,r,s,o){for(;s>r;){if(s-r>600){var a=s-r+1,h=e-r+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(h-a/2<0?-1:1),f=Math.max(r,Math.floor(e-h*l/a+c)),d=Math.min(s,Math.floor(e+(a-h)*l/a+c));n(i,e,f,d,o)}var y=i[e],v=r,p=s;for(t(i,r,e),o(i[s],y)>0&&t(i,r,s);v<p;){for(t(i,v,p),v++,p--;o(i[v],y)<0;)v++;for(;o(i[p],y)>0;)p--}0===o(i[r],y)?t(i,r,p):(p++,t(i,p,s)),p<=e&&(r=p+1),e<=p&&(s=p-1)}}(i,e,r||0,s||i.length-1,o||n)}}();var Bt=qt.exports,Gt={exports:{}};function Jt(t,n){if(!(this instanceof Jt))return new Jt(t,n);if(this.data=t||[],this.length=this.data.length,this.compare=n||Xt,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this.T(i)}function Xt(t,n){return t<n?-1:t>n?1:0}Gt.exports=Jt,Gt.exports.default=Jt,Jt.prototype={push:function(t){this.data.push(t),this.length++,this.L(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this.T(0)),this.data.pop(),t}},peek:function(){return this.data[0]},L:function(t){for(var n=this.data,i=this.compare,e=n[t];t>0;){var r=t-1>>1,s=n[r];if(i(e,s)>=0)break;n[t]=s,t=r}n[t]=e},T:function(t){for(var n=this.data,i=this.compare,e=this.length>>1,r=n[t];t<e;){var s=1+(t<<1),o=s+1,a=n[s];if(o<this.length&&i(n[o],a)<0&&(s=o,a=n[o]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}};var Zt=Gt.exports,Yt={exports:{}},Kt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Qt={exports:{}},tn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},nn=Array.prototype.concat,en=Array.prototype.slice,rn=Qt.exports=function(t){for(var n=[],i=0,e=t.length;i<e;i++){var r=t[i];tn(r)?n=nn.call(n,en.call(r)):n.push(r)}return n};rn.wrap=function(t){return function(){return t(rn(arguments))}};var sn=Kt,on=Qt.exports,an=Object.hasOwnProperty,hn={};for(var un in sn)an.call(sn,un)&&(hn[sn[un]]=un);var ln=Yt.exports={to:{},get:{}};function cn(t,n,i){return Math.min(Math.max(n,t),i)}function fn(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}ln.get=function(t){var n,i;switch(t.substring(0,3).toLowerCase()){case"hsl":n=ln.get.hsl(t),i="hsl";break;case"hwb":n=ln.get.hwb(t),i="hwb";break;default:n=ln.get.rgb(t),i="rgb"}return n?{model:i,value:n}:null},ln.get.rgb=function(t){if(!t)return null;var n,i,e,r=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(e=n[2],n=n[1],i=0;i<3;i++){var s=2*i;r[i]=parseInt(n.slice(s,s+2),16)}e&&(r[3]=parseInt(e,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(e=(n=n[1])[3],i=0;i<3;i++)r[i]=parseInt(n[i]+n[i],16);e&&(r[3]=parseInt(e+e,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(i=0;i<3;i++)r[i]=parseInt(n[i+1],0);n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}else{if(!(n=t.match(/^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)))return(n=t.match(/^(\\w+)$/))?"transparent"===n[1]?[0,0,0,0]:an.call(sn,n[1])?((r=sn[n[1]])[3]=1,r):null:null;for(i=0;i<3;i++)r[i]=Math.round(2.55*parseFloat(n[i+1]));n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}for(i=0;i<3;i++)r[i]=cn(r[i],0,255);return r[3]=cn(r[3],0,1),r},ln.get.hsl=function(t){if(!t)return null;var n=t.match(/^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.get.hwb=function(t){if(!t)return null;var n=t.match(/^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.to.hex=function(){var t=on(arguments);return"#"+fn(t[0])+fn(t[1])+fn(t[2])+(t[3]<1?fn(Math.round(255*t[3])):"")},ln.to.rgb=function(){var t=on(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},ln.to.rgb.percent=function(){var t=on(arguments),n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),e=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+i+"%, "+e+"%)":"rgba("+n+"%, "+i+"%, "+e+"%, "+t[3]+")"},ln.to.hsl=function(){var t=on(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},ln.to.hwb=function(){var t=on(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},ln.to.keyword=function(t){return hn[t.slice(0,3)]};var dn={exports:{}},yn=Kt,vn={};for(var pn in yn)yn.hasOwnProperty(pn)&&(vn[yn[pn]]=pn);var mn=dn.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var gn in mn)if(mn.hasOwnProperty(gn)){if(!("channels"in mn[gn]))throw new Error("missing channels property: "+gn);if(!("labels"in mn[gn]))throw new Error("missing channel labels property: "+gn);if(mn[gn].labels.length!==mn[gn].channels)throw new Error("channel and label counts mismatch: "+gn);var wn=mn[gn].channels,Mn=mn[gn].labels;delete mn[gn].channels,delete mn[gn].labels,Object.defineProperty(mn[gn],"channels",{value:wn}),Object.defineProperty(mn[gn],"labels",{value:Mn})}function bn(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}mn.rgb.hsl=function(t){var n,i,e=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(e,r,s),a=Math.max(e,r,s),h=a-o;return a===o?n=0:e===a?n=(r-s)/h:r===a?n=2+(s-e)/h:s===a&&(n=4+(e-r)/h),(n=Math.min(60*n,360))<0&&(n+=360),i=(o+a)/2,[n,100*(a===o?0:i<=.5?h/(a+o):h/(2-a-o)),100*i]},mn.rgb.hsv=function(t){var n,i,e,r,s,o=t[0]/255,a=t[1]/255,h=t[2]/255,u=Math.max(o,a,h),l=u-Math.min(o,a,h),c=function(t){return(u-t)/6/l+.5};return 0===l?r=s=0:(s=l/u,n=c(o),i=c(a),e=c(h),o===u?r=e-i:a===u?r=1/3+n-e:h===u&&(r=2/3+i-n),r<0?r+=1:r>1&&(r-=1)),[360*r,100*s,100*u]},mn.rgb.hwb=function(t){var n=t[0],i=t[1],e=t[2];return[mn.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(i,e))),100*(e=1-1/255*Math.max(n,Math.max(i,e)))]},mn.rgb.cmyk=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*((1-i-(n=Math.min(1-i,1-e,1-r)))/(1-n)||0),100*((1-e-n)/(1-n)||0),100*((1-r-n)/(1-n)||0),100*n]},mn.rgb.keyword=function(t){var n=vn[t];if(n)return n;var i,e=1/0;for(var r in yn)if(yn.hasOwnProperty(r)){var s=bn(t,yn[r]);s<e&&(e=s,i=r)}return i},mn.keyword.rgb=function(t){return yn[t]},mn.rgb.xyz=function(t){var n=t[0]/255,i=t[1]/255,e=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)),100*(.2126*n+.7152*i+.0722*e),100*(.0193*n+.1192*i+.9505*e)]},mn.rgb.lab=function(t){var n=mn.rgb.xyz(t),i=n[0],e=n[1],r=n[2];return e/=100,r/=108.883,i=(i/=95.047)>.008856?Math.pow(i,1/3):7.787*i+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(i-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},mn.hsl.rgb=function(t){var n,i,e,r,s,o=t[0]/360,a=t[1]/100,h=t[2]/100;if(0===a)return[s=255*h,s,s];n=2*h-(i=h<.5?h*(1+a):h+a-h*a),r=[0,0,0];for(var u=0;u<3;u++)(e=o+1/3*-(u-1))<0&&e++,e>1&&e--,s=6*e<1?n+6*(i-n)*e:2*e<1?i:3*e<2?n+(i-n)*(2/3-e)*6:n,r[u]=255*s;return r},mn.hsl.hsv=function(t){var n=t[0],i=t[1]/100,e=t[2]/100,r=i,s=Math.max(e,.01);return i*=(e*=2)<=1?e:2-e,r*=s<=1?s:2-s,[n,100*(0===e?2*r/(s+r):2*i/(e+i)),100*((e+i)/2)]},mn.hsv.rgb=function(t){var n=t[0]/60,i=t[1]/100,e=t[2]/100,r=Math.floor(n)%6,s=n-Math.floor(n),o=255*e*(1-i),a=255*e*(1-i*s),h=255*e*(1-i*(1-s));switch(e*=255,r){case 0:return[e,h,o];case 1:return[a,e,o];case 2:return[o,e,h];case 3:return[o,a,e];case 4:return[h,o,e];case 5:return[e,o,a]}},mn.hsv.hsl=function(t){var n,i,e,r=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return e=(2-s)*o,i=s*a,[r,100*(i=(i/=(n=(2-s)*a)<=1?n:2-n)||0),100*(e/=2)]},mn.hwb.rgb=function(t){var n,i,e,r,s,o,a,h=t[0]/360,u=t[1]/100,l=t[2]/100,c=u+l;switch(c>1&&(u/=c,l/=c),e=6*h-(n=Math.floor(6*h)),0!=(1&n)&&(e=1-e),r=u+e*((i=1-l)-u),n){default:case 6:case 0:s=i,o=r,a=u;break;case 1:s=r,o=i,a=u;break;case 2:s=u,o=i,a=r;break;case 3:s=u,o=r,a=i;break;case 4:s=r,o=u,a=i;break;case 5:s=i,o=u,a=r}return[255*s,255*o,255*a]},mn.cmyk.rgb=function(t){var n=t[0]/100,i=t[1]/100,e=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r))]},mn.xyz.rgb=function(t){var n,i,e,r=t[0]/100,s=t[1]/100,o=t[2]/100;return i=-.9689*r+1.8758*s+.0415*o,e=.0557*r+-.204*s+1.057*o,n=(n=3.2406*r+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,[255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1)),255*(e=Math.min(Math.max(0,e),1))]},mn.xyz.lab=function(t){var n=t[0],i=t[1],e=t[2];return i/=100,e/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116))]},mn.lab.xyz=function(t){var n,i,e,r=t[0];n=t[1]/500+(i=(r+16)/116),e=i-t[2]/200;var s=Math.pow(i,3),o=Math.pow(n,3),a=Math.pow(e,3);return i=s>.008856?s:(i-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,[n*=95.047,i*=100,e*=108.883]},mn.lab.lch=function(t){var n,i=t[0],e=t[1],r=t[2];return(n=360*Math.atan2(r,e)/2/Math.PI)<0&&(n+=360),[i,Math.sqrt(e*e+r*r),n]},mn.lch.lab=function(t){var n,i=t[0],e=t[1];return n=t[2]/360*2*Math.PI,[i,e*Math.cos(n),e*Math.sin(n)]},mn.rgb.ansi16=function(t){var n=t[0],i=t[1],e=t[2],r=1 in arguments?arguments[1]:mn.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var s=30+(Math.round(e/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===r&&(s+=60),s},mn.hsv.ansi16=function(t){return mn.rgb.ansi16(mn.hsv.rgb(t),t[2])},mn.rgb.ansi256=function(t){var n=t[0],i=t[1],e=t[2];return n===i&&i===e?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(i/255*5)+Math.round(e/255*5)},mn.ansi16.rgb=function(t){var n=t%10;if(0===n||7===n)return t>50&&(n+=3.5),[n=n/10.5*255,n,n];var i=.5*(1+~~(t>50));return[(1&n)*i*255,(n>>1&1)*i*255,(n>>2&1)*i*255]},mn.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var i;return t-=16,[Math.floor(t/36)/5*255,Math.floor((i=t%36)/6)/5*255,i%6/5*255]},mn.rgb.hex=function(t){var n=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(n.length)+n},mn.hex.rgb=function(t){var n=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];var i=n[0];3===n[0].length&&(i=i.split("").map((function(t){return t+t})).join(""));var e=parseInt(i,16);return[e>>16&255,e>>8&255,255&e]},mn.rgb.hcg=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255,s=Math.max(Math.max(i,e),r),o=Math.min(Math.min(i,e),r),a=s-o;return n=a<=0?0:s===i?(e-r)/a%6:s===e?2+(r-i)/a:4+(i-e)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},mn.hsl.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=1,r=0;return(e=i<.5?2*n*i:2*n*(1-i))<1&&(r=(i-.5*e)/(1-e)),[t[0],100*e,100*r]},mn.hsv.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=n*i,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.hcg.rgb=function(t){var n=t[0]/360,i=t[1]/100,e=t[2]/100;if(0===i)return[255*e,255*e,255*e];var r,s=[0,0,0],o=n%1*6,a=o%1,h=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=h,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=a;break;case 3:s[0]=0,s[1]=h,s[2]=1;break;case 4:s[0]=a,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=h}return r=(1-i)*e,[255*(i*s[0]+r),255*(i*s[1]+r),255*(i*s[2]+r)]},mn.hcg.hsv=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n),e=0;return i>0&&(e=n/i),[t[0],100*e,100*i]},mn.hcg.hsl=function(t){var n=t[1]/100,i=t[2]/100*(1-n)+.5*n,e=0;return i>0&&i<.5?e=n/(2*i):i>=.5&&i<1&&(e=n/(2*(1-i))),[t[0],100*e,100*i]},mn.hcg.hwb=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n);return[t[0],100*(i-n),100*(1-i)]},mn.hwb.hcg=function(t){var n=t[1]/100,i=1-t[2]/100,e=i-n,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},mn.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},mn.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},mn.gray.hsl=mn.gray.hsv=function(t){return[0,0,t[0]]},mn.gray.hwb=function(t){return[0,100,t[0]]},mn.gray.cmyk=function(t){return[0,0,0,t[0]]},mn.gray.lab=function(t){return[t[0],0,0]},mn.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),i=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(i.length)+i},mn.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var xn=dn.exports;function Fn(t){var n=function(){for(var t={},n=Object.keys(xn),i=n.length,e=0;e<i;e++)t[n[e]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;)for(var e=i.pop(),r=Object.keys(xn[e]),s=r.length,o=0;o<s;o++){var a=r[o],h=n[a];-1===h.distance&&(h.distance=n[e].distance+1,h.parent=e,i.unshift(a))}return n}function An(t,n){return function(i){return n(t(i))}}function kn(t,n){for(var i=[n[t].parent,t],e=xn[n[t].parent][t],r=n[t].parent;n[r].parent;)i.unshift(n[r].parent),e=An(xn[n[r].parent][r],e),r=n[r].parent;return e.conversion=i,e}var Pn=dn.exports,Sn=function(t){for(var n=Fn(t),i={},e=Object.keys(n),r=e.length,s=0;s<r;s++){var o=e[s];null!==n[o].parent&&(i[o]=kn(o,n))}return i},_n={};Object.keys(Pn).forEach((function(t){_n[t]={},Object.defineProperty(_n[t],"channels",{value:Pn[t].channels}),Object.defineProperty(_n[t],"labels",{value:Pn[t].labels});var n=Sn(t);Object.keys(n).forEach((function(i){var e=n[i];_n[t][i]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var i=t(n);if("object"==typeof i)for(var e=i.length,r=0;r<e;r++)i[r]=Math.round(i[r]);return i};return"conversion"in t&&(n.conversion=t.conversion),n}(e),_n[t][i].raw=function(t){var n=function(n){return null==n?n:(arguments.length>1&&(n=Array.prototype.slice.call(arguments)),t(n))};return"conversion"in t&&(n.conversion=t.conversion),n}(e)}))}));var On=_n,In=Yt.exports,Tn=On,Ln=[].slice,Un=["keyword","gray","hex"],zn={};Object.keys(Tn).forEach((function(t){zn[Ln.call(Tn[t].labels).sort().join("")]=t}));var Dn={};function En(t,n){if(!(this instanceof En))return new En(t,n);if(n&&n in Un&&(n=null),n&&!(n in Tn))throw new Error("Unknown model: "+n);var i,e;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof En)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var r=In.get(t);if(null===r)throw new Error("Unable to parse color from string: "+t);this.model=r.model,e=Tn[this.model].channels,this.color=r.value.slice(0,e),this.valpha="number"==typeof r.value[e]?r.value[e]:1}else if(t.length){this.model=n||"rgb",e=Tn[this.model].channels;var s=Ln.call(t,0,e);this.color=Hn(s,e),this.valpha="number"==typeof t[e]?t[e]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var a=o.sort().join("");if(!(a in zn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=zn[a];var h=Tn[this.model].labels,u=[];for(i=0;i<h.length;i++)u.push(t[h[i]]);this.color=Hn(u)}if(Dn[this.model])for(e=Tn[this.model].channels,i=0;i<e;i++){var l=Dn[this.model][i];l&&(this.color[i]=l(this.color[i]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function Cn(t,n,i){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(Dn[t]||(Dn[t]=[]))[n]=i})),t=t[0],function(e){var r;return arguments.length?(i&&(e=i(e)),(r=this[t]()).color[n]=e,r):(r=this[t]().color[n],i&&(r=i(r)),r)}}function jn(t){return function(n){return Math.max(0,Math.min(t,n))}}function Nn(t){return Array.isArray(t)?t:[t]}function Hn(t,n){for(var i=0;i<n;i++)"number"!=typeof t[i]&&(t[i]=0);return t}En.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in In.to?this:this.rgb(),i=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return In.to[n.model](i)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),i=1===n.valpha?n.color:n.color.concat(this.valpha);return In.to.rgb.percent(i)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Tn[this.model].channels,i=Tn[this.model].labels,e=0;e<n;e++)t[i[e]]=this.color[e];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new En(this.color.map(function(t){return function(n){return function(t,n){return Number(t.toFixed(n))}(n,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new En(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Cn("rgb",0,jn(255)),green:Cn("rgb",1,jn(255)),blue:Cn("rgb",2,jn(255)),hue:Cn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:Cn("hsl",1,jn(100)),lightness:Cn("hsl",2,jn(100)),saturationv:Cn("hsv",1,jn(100)),value:Cn("hsv",2,jn(100)),chroma:Cn("hcg",1,jn(100)),gray:Cn("hcg",2,jn(100)),white:Cn("hwb",1,jn(100)),wblack:Cn("hwb",2,jn(100)),cyan:Cn("cmyk",0,jn(100)),magenta:Cn("cmyk",1,jn(100)),yellow:Cn("cmyk",2,jn(100)),black:Cn("cmyk",3,jn(100)),x:Cn("xyz",0,jn(100)),y:Cn("xyz",1,jn(100)),z:Cn("xyz",2,jn(100)),l:Cn("lab",0,jn(100)),a:Cn("lab",1),b:Cn("lab",2),keyword:function(t){return arguments.length?new En(t):Tn[this.model].keyword(this.color)},hex:function(t){return arguments.length?new En(t):In.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,n=[],i=0;i<t.length;i++){var e=t[i]/255;n[i]=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),i=t.luminosity();return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)},level:function(t){var n=this.contrast(t);return n>=7.1?"AAA":n>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),n=0;n<3;n++)t.color[n]=255-t.color[n];return t},lighten:function(t){var n=this.hsl();return n.color[2]+=n.color[2]*t,n},darken:function(t){var n=this.hsl();return n.color[2]-=n.color[2]*t,n},saturate:function(t){var n=this.hsl();return n.color[1]+=n.color[1]*t,n},desaturate:function(t){var n=this.hsl();return n.color[1]-=n.color[1]*t,n},whiten:function(t){var n=this.hwb();return n.color[1]+=n.color[1]*t,n},blacken:function(t){var n=this.hwb();return n.color[2]+=n.color[2]*t,n},grayscale:function(){var t=this.rgb().color,n=.3*t[0]+.59*t[1]+.11*t[2];return En.rgb(n,n,n)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var n=this.hsl(),i=n.color[0];return i=(i=(i+t)%360)<0?360+i:i,n.color[0]=i,n},mix:function(t,n){if(!t||!t.rgb)throw new Error(\'Argument to "mix" was not a Color instance, but rather an instance of \'+typeof t);var i=t.rgb(),e=this.rgb(),r=void 0===n?.5:n,s=2*r-1,o=i.alpha()-e.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,h=1-a;return En.rgb(a*i.red()+h*e.red(),a*i.green()+h*e.green(),a*i.blue()+h*e.blue(),i.alpha()*r+e.alpha()*(1-r))}},Object.keys(Tn).forEach((function(t){if(-1===Un.indexOf(t)){var n=Tn[t].channels;En.prototype[t]=function(){if(this.model===t)return new En(this);if(arguments.length)return new En(arguments,t);var i="number"==typeof arguments[n]?n:this.valpha;return new En(Nn(Tn[this.model][t].raw(this.color)).concat(i),t)},En[t]=function(i){return"number"==typeof i&&(i=Hn(Ln.call(arguments),n)),new En(i,t)}}}));var Vn=En;class Rn{constructor(t,n){this.position=t,this.index=n,this.faces=[],this.neighbors=[]}addUniqueNeighbor(t){-1===this.neighbors.indexOf(t)&&this.neighbors.push(t)}}class $n{constructor(t,n,i,e){this.a=e.a,this.b=e.b,this.c=e.c,this.v1=t,this.v2=n,this.v3=i,this.normal=[],this.computeNormal(),t.faces.push(this),t.addUniqueNeighbor(n),t.addUniqueNeighbor(i),n.faces.push(this),n.addUniqueNeighbor(t),n.addUniqueNeighbor(i),i.faces.push(this),i.addUniqueNeighbor(t),i.addUniqueNeighbor(n)}computeNormal(){const t=this.v1.position,n=this.v2.position,i=this.v3.position,e=Pt([],St([],i,n),St([],t,n));At(this.normal,e)}hasVertex(t){return t===this.v1||t===this.v2||t===this.v3}}\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */const Wn=[],qn=[],Bn=[],Gn=[];function Jn(t,n,i){const e=Pt(qn,n,i);t=Tt(t,function(t,n,i,e,r,s,o,a,h,u){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=s,t[5]=o,t[6]=a,t[7]=h,t[8]=u,t}(Wn,i[0],i[1],i[2],...e,...n));if((t=function(t){return t[3]<0?Ut(t,t,-1):t}(t=zt(t,t)))[3]<1/32767){t[3]=1/32767;const n=Math.sqrt(.9999999990686206);t[0]*=n,t[1]*=n,t[2]*=n}const r=i[3]>0?Pt(Bn,i,n):Pt(Bn,n,i);return kt(Pt(Gn,i,n),r)<0&&Ut(t,t,-1),t}function Xn(t,n){const i=[],e=[];let r=0;for(r=0;r<t.length;r+=3){const n=new Rn([t[r],t[r+1],t[r+2]],r/3);i.push(n)}if(!n.length){const t=n;n=[];for(let i=0;i<t;i++)n.push(i)}for(r=0;r<n.length/3;r++){const t={a:n[3*r],b:n[3*r+1],c:n[3*r+2]};new $n(i[t.a],i[t.b],i[t.c],t)}const s=[],o=[0,0,0];for(r=0;r<i.length;r++){const t=i[r],n=t.index;bt(o,0,0,0);let a=t.faces.length;for(let n=0;n<a;n++)xt(o,o,t.faces[n].normal);a=a||1,bt(s,a,a,a),Ft(o,o,s),e[3*n]=o[0],e[3*n+1]=o[1],e[3*n+2]=o[2]}return e}\n/*!\n * Contains code from THREE.JS\n * https://github.com/mrdoob/three.js/\n * License MIT\n * \n * Generate tangents per vertex.\n */function Zn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t}function Yn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t}var Kn={exports:{}};function Qn(t,n,i){i=i||2;var e,r,s,o,a,h,u,l=n&&n.length,c=l?n[0]*i:t.length,f=ti(t,0,c,i,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,n,i,e){var r,s,o,a,h,u=[];for(r=0,s=n.length;r<s;r++)o=n[r]*e,a=r<s-1?n[r+1]*e:t.length,(h=ti(t,o,a,e,!1))===h.next&&(h.steiner=!0),u.push(ci(h));for(u.sort(ai),r=0;r<u.length;r++)i=ni(i=hi(u[r],i),i.next);return i}(t,n,f,i)),t.length>80*i){e=s=t[0],r=o=t[1];for(var y=i;y<c;y+=i)(a=t[y])<e&&(e=a),(h=t[y+1])<r&&(r=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-e,o-r))?1/u:0}return ii(f,d,i,e,r,u),d}function ti(t,n,i,e,r){var s,o;if(r===Ai(t,n,i,e)>0)for(s=n;s<i;s+=e)o=bi(s,t[s],t[s+1],o);else for(s=i-e;s>=n;s-=e)o=bi(s,t[s],t[s+1],o);return o&&vi(o,o.next)&&(xi(o),o=o.next),o}function ni(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!vi(e,e.next)&&0!==yi(e.prev,e,e.next))e=e.next;else{if(xi(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function ii(t,n,i,e,r,s,o){if(t){!o&&s&&function(t,n,i,e){var r=t;do{null===r.z&&(r.z=li(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,e,r,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,e=i,a=0,n=0;n<u&&(a++,e=e.nextZ);n++);for(h=u;a>0||h>0&&e;)0!==a&&(0===h||!e||i.z<=e.z)?(r=i,i=i.nextZ,a--):(r=e,e=e.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=e}s.nextZ=null,u*=2}while(o>1)}(r)}(t,e,r,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ri(t,e,r,s):ei(t))n.push(a.i/i),n.push(t.i/i),n.push(h.i/i),xi(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?ii(t=si(ni(t),n,i),n,i,e,r,s,2):2===o&&oi(t,n,i,e,r,s):ii(ni(t),n,i,e,r,s,1);break}}}function ei(t){var n=t.prev,i=t,e=t.next;if(yi(n,i,e)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(fi(n.x,n.y,i.x,i.y,e.x,e.y,r.x,r.y)&&yi(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ri(t,n,i,e){var r=t.prev,s=t,o=t.next;if(yi(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,l=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=li(a,h,n,i,e),f=li(u,l,n,i,e),d=t.prevZ,y=t.nextZ;d&&d.z>=c&&y&&y.z<=f;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;y&&y.z<=f;){if(y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function si(t,n,i){var e=t;do{var r=e.prev,s=e.next.next;!vi(r,s)&&pi(r,e,e.next,s)&&wi(r,s)&&wi(s,r)&&(n.push(r.i/i),n.push(e.i/i),n.push(s.i/i),xi(e),xi(e.next),e=t=s),e=e.next}while(e!==t);return ni(e)}function oi(t,n,i,e,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&di(o,a)){var h=Mi(o,a);return o=ni(o,o.next),h=ni(h,h.next),ii(o,n,i,e,r,s),void ii(h,n,i,e,r,s)}a=a.next}o=o.next}while(o!==t)}function ai(t,n){return t.x-n.x}function hi(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o){if(o=a,a===r){if(s===e.y)return e;if(s===e.next.y)return e.next}i=e.x<e.next.x?e:e.next}}e=e.next}while(e!==n);if(!i)return null;if(r===o)return i;var h,u=i,l=i.x,c=i.y,f=1/0;e=i;do{r>=e.x&&e.x>=l&&r!==e.x&&fi(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(h=Math.abs(s-e.y)/(r-e.x),wi(e,t)&&(h<f||h===f&&(e.x>i.x||e.x===i.x&&ui(i,e)))&&(i=e,f=h)),e=e.next}while(e!==u);return i}(t,n);if(!i)return n;var e=Mi(i,t),r=ni(i,i.next);return ni(e,e.next),n===i?r:n}function ui(t,n){return yi(t.prev,t,n.prev)<0&&yi(n.next,t,t.next)<0}function li(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-e)*r)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function ci(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 fi(t,n,i,e,r,s,o,a){return(r-o)*(n-a)-(t-o)*(s-a)>=0&&(t-o)*(e-a)-(i-o)*(n-a)>=0&&(i-o)*(s-a)-(r-o)*(e-a)>=0}function di(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&&pi(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(wi(t,n)&&wi(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)&&(yi(t.prev,t,n.prev)||yi(t,n.prev,n))||vi(t,n)&&yi(t.prev,t,t.next)>0&&yi(n.prev,n,n.next)>0)}function yi(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function vi(t,n){return t.x===n.x&&t.y===n.y}function pi(t,n,i,e){var r=gi(yi(t,n,i)),s=gi(yi(t,n,e)),o=gi(yi(i,e,t)),a=gi(yi(i,e,n));return r!==s&&o!==a||(!(0!==r||!mi(t,i,n))||(!(0!==s||!mi(t,e,n))||(!(0!==o||!mi(i,t,e))||!(0!==a||!mi(i,n,e)))))}function mi(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 gi(t){return t>0?1:t<0?-1:0}function wi(t,n){return yi(t.prev,t,t.next)<0?yi(t,n,t.next)>=0&&yi(t,t.prev,n)>=0:yi(t,n,t.prev)<0||yi(t,t.next,n)<0}function Mi(t,n){var i=new Fi(t.i,t.x,t.y),e=new Fi(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 bi(t,n,i,e){var r=new Fi(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 xi(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 Fi(t,n,i){this.i=t,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ai(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}Kn.exports=Qn,Kn.exports.default=Qn,Qn.deviation=function(t,n,i,e){var r=n&&n.length,s=r?n[0]*i:t.length,o=Math.abs(Ai(t,0,s,i));if(r)for(var a=0,h=n.length;a<h;a++){var u=n[a]*i,l=a<h-1?n[a+1]*i:t.length;o-=Math.abs(Ai(t,u,l,i))}var c=0;for(a=0;a<e.length;a+=3){var f=e[a]*i,d=e[a+1]*i,y=e[a+2]*i;c+=Math.abs((t[f]-t[y])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[y+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Qn.flatten=function(t){for(var n=t[0][0].length,i={vertices:[],holes:[],dimensions:n},e=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<n;o++)i.vertices.push(t[r][s][o]);r>0&&(e+=t[r-1].length,i.holes.push(e))}return i};var ki=Kn.exports;\n/*!\n * @maptalks/vector-packer v0.63.4\n * LICENSE : UNLICENSED\n * (c) 2016-2022 maptalks.com\n */const Pi={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function Si(t,n={}){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)_i(i,t.features[e],n,e);else _i(i,"Feature"===t.type?t:{geometry:t},n);return i}function _i(t,n,i,e){if(n.geometry&&n.geometry.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(i.promoteId?a=n.properties[i.promoteId]:i.generateId&&(a=e||0),"Point"===s)Oi(r,o);else if("MultiPoint"===s)for(var h=0;h<r.length;h++)Oi(r[h],o);else if("LineString"===s)Ti([r],o);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<r.length;h++)Ii(r[h],o=[]),t.push(Li(a,"LineString",o,n.properties));return}Ti(r,o)}else if("Polygon"===s)Ti(r,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<n.geometry.geometries.length;h++)_i(t,{id:a,geometry:n.geometry.geometries[h],properties:n.properties},i,e);return}return void console.warn(`Input data type(${s}) is not a valid GeoJSON geometry type.`)}for(h=0;h<r.length;h++){var u=[];Ti(r[h],u),o.push(u)}}t.push(Li(a,s,o,n.properties))}}function Oi(t,n){n.push([new Ht(t[0],t[1])])}function Ii(t,n){for(var i=0;i<t.length;i++)n.push(new Ht(t[i][0],t[i][1]))}function Ti(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];Ii(t[r],s),n.push(s)}}function Li(t,n,i,e){return{id:void 0===t?null:t,type:Pi[n],geometry:i,properties:e}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ui(t,{width:n,height:i},e,r){if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);return t.width=n,t.height=i,t.data=r,t}function zi(t,{width:n,height:i},e){if(n===t.width&&i===t.height)return;const r=Ui({},{width:n,height:i},e);Di(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},e),t.width=n,t.height=i,t.data=r.data}function Di(t,n,i,e,r,s){if(0===r.width||0===r.height)return n;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>n.width||r.height>n.height||e.x>n.width-r.width||e.y>n.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=n.data;if(o===a)return n;for(let h=0;h<r.height;h++){const u=((i.y+h)*t.width+i.x)*s,l=((e.y+h)*n.width+e.x)*s;for(let t=0;t<r.width*s;t++)a[l+t]=o[u+t]}return n}class Ei{constructor(t,n){Ui(this,t,1,n)}resize(t){zi(this,t,1)}clone(){return new Ei({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,1)}}class Ci{constructor(t,n){Ui(this,t,4,n)}resize(t){zi(this,t,4)}clone(){return new Ci({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,4)}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class ji{constructor(t,{pixelRatio:n}){this.paddedRect=t,this.pixelRatio=n||1}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ni{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s={x:0,y:0,w:r.data.width+2,h:r.data.height+2};e.push(s),n[i]=new ji(s,r)}if(i.pack(e,{inPlace:!0}),!Hi(i.w)||!Hi(i.h)){const t=Vi(i.w),n=Vi(i.h);i.resize(t,n)}const r=new Ci({width:i.w,height:i.h});for(const i in t){const e=t[i],s=n[i].paddedRect;Ci.copy(e.data,r,{x:0,y:0},{x:s.x+1,y:s.y+1},e.data)}this.image=r,this.positions=n}}function Hi(t){return 0==(t&t-1)&&0!==t}function Vi(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n * TODO 升级为potpack\n */class Ri{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s=n[i]={};for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const i={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};e.push(i),s[t]={rect:i,metrics:n.metrics}}}i.pack(e,{inPlace:!0});const r=new Ei({width:i.w,height:i.h});for(const i in t){const e=t[i];for(const t in e){const s=e[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[i][t].rect;Ei.copy(s.bitmap,r,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=r,this.positions=n}}function $i(t){return t<65536?Uint16Array:Uint32Array}function Wi(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function qi(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function Bi(t){const n=t.type,i=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Oi(t.geometry[n],i);else if(2===n)Ti(t.geometry,i);else if(3===n)Ti(t.geometry,i);else if(5===n)Ti(t.geometry,i);else if(6===n)for(let n=0;n<t.geometry.length;n++){const e=[];Ti(t.geometry[n],e),i.push(e)}return t.geometry=i,t}function Gi(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function Ji(t){return null==t}function Xi(t){return"number"==typeof t&&!isNaN(t)}function Zi(t){return"object"==typeof t&&!!t}function Yi(t){return!Ji(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}const Ki=Object.prototype.hasOwnProperty;function Qi(t,n){return Ki.call(t,n)}function te(t){return m(t)&&t.property}function ne(t){let n=0;for(let i,e,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],e=t[o],n+=void 0!==i.x?(e.x-i.x)*(i.y+e.y):(e[0]-i[0])*(i[1]+e[1]);return n}function ie(t,n,i,e,r){const s=t[n*e],o=t[n*e+1],a=t[i*e],h=t[i*e+1];return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function ee(t,n,i){let e=i;return n&&t&&(e=t[n]),void 0===e&&(e=i),10*(e||0)}function re(t,n,i,e,r,s,o){const a=ee(t.properties,i,e),h=a*n;let u=a;return r?u=ee(t.properties,r,s):o&&(u=a-ee(t.properties,o,0)),u*=n,{altitude:h,height:u}}function se(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function oe(t){return null==t}function ae(t,n,i){if(t===i||t===n)return t;const e=i-n;return((t-n)%e+e)%e+n}class he{constructor(t,n,i,e){this.feature=t,this.symbol=n,this.fnTypes=i,this.options=e}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.U(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.U(t,n)}U(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}const ue={lineWidth:1,lineStrokeWidth:1,lineDx:1,lineDy:1,lineOpacity:1,linePatternAnimSpeed:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerSpacing:1,markerOpacity:1,markerRotation:1,textWrapWidth:1,textSpacing:1,textSize:1,textHaloRadius:1,textHaloOpacity:1,textDx:1,textDy:1,textOpacity:1,textRotation:1,polygonOpacity:1};class le{static isAtlasLoaded(t,n={}){const{iconAtlas:i}=n;return!!(!t||i&&i.positions[t])}static genFnTypes(t){const n={};for(const i in t)if(te(t[i])){const e=(i+"_Fn_0").trim(),r=(i+"Fn").trim();ue[i]?(n[e]=g(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?g(r)(t,i):r}):(n[e]=w(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?w(r)(t,i):r})}return n}constructor(t,n,i){this.options=i,this.features=this.D(t),this.symbolDef=n,this.symbol=M(n,()=>[i.zoom]),this.styledVectors=[],this.properties={},this.C=le.genFnTypes(this.symbolDef),te(this.symbolDef.visible)&&(this.j=g(this.symbolDef.visible)),i.atlas&&(this.iconAtlas=i.atlas.iconAtlas,this.glyphAtlas=i.atlas.glyphAtlas)}D(t){if(!t.length)return t;const n="__fea_idx".trim();let e,r=0,s=t[r];for(;!s.geometry;)r++,s=t[r];if(Array.isArray(s.geometry)&&s.properties){let n=s.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof Ht&&(e=t)}if(!e)if(e=[],Array.isArray(s.geometry))for(let n=0;n<t.length;n++){const i=Gi({},t[n]);e.push(Bi(i))}else for(let i=0;i<t.length;i++){const r=t[i],s=Si(r);for(let t=0;t<s.length;t++){const i=s[t];i[n]=r[n],e.push(i)}}const o=this.options.order;if(o){const t=[];for(let n=0;n<o.length;n++)o[n]&&t.push(i(o[n]));e=e.sort((n,i)=>{const e=t.length;let r=e,s=e;for(let o=0;o<e&&(t[o](n)&&(r=o),t[o](i)&&(s=o),!(r<e&&s<e));o++);return r-s})}return e}load(t=1){const n="__fea_idx".trim(),i="_debug_info".trim(),e=this.C,r=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},h={zoom:this.options.zoom},u=M(this.symbolDef,()=>[h.zoom]);let l=0,c=s.length;const f=this.options.debugIndex;try{for(;l<c;l++){const t=s[l];if(!t||!t.geometry)continue;if(void 0!==f&&t[i].index!==f)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const c=this.createStyledVector(t,u,e,h,o,a);c&&c.feature.geometry&&(c.featureIdx=void 0===t[n]?l:t[n],this.count++,r.push(c))}}catch(t){return Promise.reject(t)}return this.options.atlas?Promise.resolve(this.pack(t)):this.loadAtlas(o,a).then(()=>this.pack(t))}loadAtlas(t,n){return new Promise((i,e)=>{this.fetchAtlas(t,n,(t,n)=>{if(t)e(t);else{if(n){const{icons:t,glyphs:i}=n;if(t&&Object.keys(t).length){for(const n in t){const i=t[n],{width:e,height:r,data:s}=i.data;i.data=new Ci({width:e,height:r},s)}this.iconAtlas=new Ni(t)}if(i&&Object.keys(i).length){for(const t in i){const n=i[t];for(const t in n){const i=n[t],{width:e,height:r,data:s}=i.bitmap;i.bitmap=new Ei({width:e,height:r},s)}}this.glyphAtlas=new Ri(i)}}i({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}})})}fetchAtlas(t,n,i){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,i):i()}pack(t){if(!this.count)return null;if(null==t)throw new Error("layout scale is undefined");const n=this.createDataPack(this.styledVectors,t);if(!n)return null;n.properties=this.properties,this.empty&&(n.empty=!0);const i=n.buffers;delete n.buffers;const e={data:n,buffers:i};if(this.iconAtlas){const t=e.data.iconAtlas=ce(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)i.push(t.glyphMap[n].data.data.buffer);i.push(e.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(e.data.glyphAtlas=ce(this.glyphAtlas),i.push(e.data.glyphAtlas.image.data.buffer)),e}createStyledVector(t,n,i,e){return new he(t,n,i,e)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.maxAltitude=0;const i=this.data={};let e=this.elements=[];const r=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol);for(let t=0;t<r.length;t++)i[r[t].name]=[];let s=[],o=0;const a=[];let h=0,u=!1;for(let e=0,r=t.length;e<r;e++){if(!t[e].feature.geometry)continue;const r=Array.isArray(t[e])?t[e][0].feature.id:t[e].feature.id;Xi(r)&&(Math.abs(r)>h&&(h=Math.abs(r)),r<0&&(u=!0));const l=this.data.aPosition.length;if(Array.isArray(t[e]))for(let i=0;i<t[e].length;i++)this.N(t[e][i],n);else this.N(t[e],n);const c=(i.aPosition.length-l)/3;for(let n=0;n<c;n++)s.push(t[e].featureIdx),Xi(r)&&a.push(r);o=Math.max(o,t[e].featureIdx)}if(this.hasElements()&&!e.length)return null;s=new(qi(o))(s),r[0].type=this.options.positionType?this.options.positionType:Wi(Math.max(this.maxPos,this.maxAltitude));const l=this.options.center;if(l&&(l[0]||l[1])){const t=i.aPosition;for(let n=0;n<t.length;n+=3)t[n]-=l[0],t[n+1]-=l[1]}const c=function(t,n){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=r.type,o=r.name;i[o]=s===Array?n[o]:new s(n[o])}return i}(r,i);c.aPickingId=s;const f=[];for(const t in c)f.push(c[t].buffer);e=new($i(this.maxIndex))(e),f.push(e.buffer);const d={data:c,indices:this.hasElements()?e:null,positionSize:3,\n//!this.maxAltitude ? 2 : 3,\nbuffers:f,symbolIndex:this.symbolDef.index||{index:0}};if(a.length){const t=u?Wi(h):qi(h);d.featureIds=new t(a),f.push(d.featureIds.buffer)}else d.featureIds=[];return d}N(t,n){this.j&&this.j.isZoomConstant&&!this.j(null,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(...t){this.maxIndex=Math.max(this.maxIndex,...t),this.elements.push(...t)}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:i,altitudeScale:e}=this.options;let r=ee(t,n,i);return e&&(r*=e),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(r)),r}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const i in t)if(Qi(t,i)){const{tl:e,displaySize:r}=t[i],s=Math.max(e[0],e[1],r[0]-1,r[1]-1);s>n&&(n=s)}return n}}function ce(t){let n=t.positions,i=t.image&&t.image.format||"alpha";if(t instanceof Ni){n={};for(const i in t.positions){const e=t.positions[i];n[i]={paddedRect:e.paddedRect,pixelRatio:e.pixelRatio,tl:e.tl,br:e.br,displaySize:e.displaySize}}i="rgba"}const e=t.image;return{image:{width:e.width,height:e.height,data:e.data,format:i},glyphMap:t.glyphMap,positions:n}}function fe(t,n,i,e){const r="__fn_textSize".trim();let s=t.textSize;if(Ji(n.textSize))return[16,16];t[r]&&(s=t[r]);const o=[];var a;return o[0]=Ji(a=s)||"function"!=typeof a&&(null===a.constructor||a.constructor!==Function)?s:s(e,i),o[1]=o[0],o}function de(t){const n=t.stops;let i=-1/0;for(let t=0;t<n.length;t++){let e=n[t][1];Zi(n[t][1])&&(e=de(n[t][1])),e>i&&(i=e)}return i}const ye=/\\{([\\w_]+)\\}/g;function ve(t,n){return Yi(t)?t.replace(ye,(function(t,i){if(!n)return"";const e=n[i];return Ji(e)?"":Array.isArray(e)?e.join():e})):t}const pe=t=>t>=11904&&t<=12031,me=t=>t>=12032&&t<=12255,ge=t=>t>=12272&&t<=12287,we=t=>t>=12288&&t<=12351,Me=t=>t>=12352&&t<=12447,be=t=>t>=12448&&t<=12543,xe=t=>t>=12544&&t<=12591,Fe=t=>t>=12704&&t<=12735,Ae=t=>t>=12736&&t<=12783,ke=t=>t>=12784&&t<=12799,Pe=t=>t>=12800&&t<=13055,Se=t=>t>=13056&&t<=13311,_e=t=>t>=13312&&t<=19903,Oe=t=>t>=19968&&t<=40959,Ie=t=>t>=40960&&t<=42127,Te=t=>t>=42128&&t<=42191,Le=t=>t>=63744&&t<=64255,Ue=t=>t>=64336&&t<=65023,ze=t=>t>=65040&&t<=65055,De=t=>t>=65072&&t<=65103,Ee=t=>t>=65104&&t<=65135,Ce=t=>t>=65136&&t<=65279,je=t=>t>=65280&&t<=65519;function Ne(t){return!((t=>t>=1536&&t<=1791)(t)||(t=>t>=1872&&t<=1919)(t)||(t=>t>=2208&&t<=2303)(t)||Ue(t)||Ce(t))}function He(t){return!!(746===t||747===t||!(t<4352)&&(Fe(t)||xe(t)||De(t)&&!(t>=65097&&t<=65103)||Le(t)||Se(t)||pe(t)||Ae(t)||!(!we(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_e(t)||Oe(t)||Pe(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Me(t)||ge(t)||(t=>t>=12688&&t<=12703)(t)||me(t)||ke(t)||be(t)&&12540!==t||!(!je(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Ee(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||ze(t)||(t=>t>=19904&&t<=19967)(t)||Ie(t)||Te(t)))}function Ve(t){return!(He(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||we(t)||be(t)||(t=>t>=57344&&t<=63743)(t)||De(t)||Ee(t)||je(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Re(t){return t>=1424&&t<=2303||Ue(t)||Ce(t)}const $e=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function We(t){for(const n of $e)if(t>=n[0]&&t<=n[1])return!0;return!1}const qe={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",H:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Be(t,n,i,e,r,s,o,a,h,u){let l=t.trim();2===u&&(l=function(t){let n="";for(let i=0;i<t.length;i++){const e=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;n+=e&&Ve(e)&&!qe[t[i+1]]||r&&Ve(r)&&!qe[t[i-1]]||!qe[t[i]]?t[i]:qe[t[i]]}return n}(l));const c=[],f={positionedGlyphs:c,text:l,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:u};let d;return d=function(t,n){const i=[];let e=0;for(let r=0;r<n.length;r++){const s=n[r];i.push(t.substring(e,s)),e=s}return e<t.length&&i.push(t.substring(e,t.length)),i}(l,function(t,n,i,e){if(!i)return[];if(!t)return[];const r=[],s=function(t,n,i,e){let r=0;for(let i=0;i<t.length;i++){const s=e[t.charCodeAt(i)];s&&(r+=s.metrics.advance+n)}return r/Math.max(1,Math.ceil(r/i))}(t,n,i,e);let o=0;for(let i=0;i<t.length;i++){const h=t.charCodeAt(i),u=e[h];u&&!Ge[h]&&(o+=u.metrics.advance+n),i<t.length-1&&(Je[h]||!((a=h)<11904)&&(Fe(a)||xe(a)||De(a)||Le(a)||Se(a)||pe(a)||Ae(a)||we(a)||_e(a)||Oe(a)||Pe(a)||je(a)||Me(a)||ge(a)||me(a)||ke(a)||be(a)||ze(a)||Te(a)||Ie(a)))&&r.push(Ye(i+1,o,s,r,Ze(h,t.charCodeAt(i+1)),!1))}var a;return function t(n){return n?t(n.priorBreak).concat(n.index):[]}(Ye(t.length,o,s,r,0,!0))}(l,o,i,n)),function(t,n,i,e,r,s,o,a,h){let u=0,l=8,c=0;const f=t.positionedGlyphs,d="right"===s?1:"left"===s?0:.5;for(let t=0;t<i.length;t++){let r=i[t];if(r=r.trim(),!r.length){l-=e;continue}const s=f.length;for(let t=0;t<r.length;t++){const i=r.charCodeAt(t),e=n[i];e&&(He(i)&&1!==o?(32!==i&&f.push({glyph:i,x:u,y:0,vertical:!0}),u+=h+a):(32!==i&&f.push({glyph:i,x:u,y:l,vertical:!1}),u+=e.metrics.advance+a))}f.length!==s&&(c=Math.max(u-a,c),Qe(f,n,s,f.length-1,d)),u=0,l-=e}const{horizontalAlign:y,verticalAlign:v}=Ke(r);!function(t,n,i,e,r,s,o){const a=(n-i)*r,h=-(-e*o+.5)*s;if(a||h)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=h}(f,d,y,v,c,e,i.length);const p=i.length*e;t.top+=-v*p,t.bottom=t.top+p,t.left+=-y*c,t.right=t.left+c}(f,n,d,e,r,s,u,o,h),!!c.length&&f}const Ge={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Je={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Xe(t,n,i,e){const r=Math.pow(t-n,2);return e?t<n?r/2:2*r:r+Math.abs(i)*i}function Ze(t,n){let i=0;return 10===t&&(i-=1e4),40!==t&&65288!==t||(i+=50),41!==n&&65289!==n||(i+=50),i}function Ye(t,n,i,e,r,s){let o=null,a=Xe(n,i,r,s);for(let t=0;t<e.length;t++){const h=e[t],u=Xe(n-h.x,i,r,s)+h.badness;u<=a&&(o=h,a=u)}return{index:t,x:n,priorBreak:o,badness:a}}function Ke(t){let n=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:n,verticalAlign:i}}function Qe(t,n,i,e,r){if(!r)return;const s=n[t[e].glyph];if(s){const n=(t[e].x+s.metrics.advance)*r;if(!n)return;for(let r=i;r<=e;r++)t[r].x-=n}}function tr(t){if(!function(t){for(const n of t)if(Re(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],i=[],e=[];let r=0,s=0,o=1,a=1;for(const h of t){const t=h.codePointAt(0);We(t)?(e.push(h),r++):(o=Re(t)?-1:1,a!==o?(s=r,i.length&&(a>0&&i.reverse(),n.push(...i)),e.length&&(n.splice(s,0,...e),e.length=0),a=o,i.length=0):e.length&&(i.push(...e),e.length=0),i.push(h),r++)}return e.length&&i.push(...e),i.length&&(a>0&&i.reverse(),n.push(...i)),n.reverse().join("")}const nr=/\\{ *([\\w_]+) *\\}/g;class ir{constructor(t,n,i,e,r){this.feature=t,this.symbolDef=n,this.symbol=i,this.options=r,this.V=this.R.bind(this),this.C=e}R(t,n){return this.feature.properties[n]||"default"}getShape(t,n){if(this.W)return this.W;const{textHorizontalAlignmentFn:i,textVerticalAlignmentFn:e,markerHorizontalAlignmentFn:r,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.C;let a;const h=this.symbol,u=this.getIconAndGlyph(),l=this.feature.properties;if(u&&u.glyph){const{font:t,text:r}=u.glyph;if(""===r)return null;const s=this.size[0]/24,c=24,f=h.textKeepUpright,d="map"===h.textRotationAlignment&&"line"===h.textPlacement&&!h.isIconText,y=n.glyphMap[t],v=er(i?i(null,l):h.textHorizontalAlignment,e?e(null,l):h.textVerticalAlignment),p=1.2*c,m=function(t){for(let n=0;n<t.length;n++)if(!Ne(t.charAt(n).charCodeAt(0)))return!1;return!0}(r),g=m&&h.textLetterSpacing/s||0,w=[h.textDx/s||0,h.textDy/s||0],M=((o?o(null,l):h.textWrapWidth)||10*c)/s;a={},a.horizontal=Be(r,y,M,p,v,"center",g,w,c,1),m&&d&&f&&(a.vertical=Be(r,y,M,p,v,"center",g,w,c,2))}else if(u&&u.icon){if(!t.positions[u.icon.url])return null;const n=er(r?r(null,l):h.markerHorizontalAlignment,s?s(null,l):h.markerVerticalAlignment);a=function(t,n){const{horizontalAlign:i,verticalAlign:e}=Ke(n),r=-24*i,s=-24*e;return{image:t,top:s,bottom:s+24,left:r,right:r+24}}(t.positions[u.icon.url],n),this.size||(this.size=a.image.displaySize)}return this.W=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:i,markerWidthFn:e,markerHeightFn:r,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:h,markerTextFitPaddingFn:u,markerLineColorFn:l,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:y,markerPathWidthFn:v,markerPathHeightFn:p,textNameFn:w,textFaceNameFn:M,textStyleFn:b,textWeightFn:x}=this.C,{zoom:F}=this.options,A={},k=this.symbol,P=this.feature.properties,S=t?t(null,P):k.markerFile,_=n?n(null,P):k.markerType,O=S||_||k.markerPath,I=!Ji(this.symbolDef.textName);let T;if(O){T=function(t,n,i,e,r,s){if(Ji(n.markerWidth)&&Ji(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let h=n.markerWidth||0,u=n.markerHeight||0;return Zi(h)&&("identity"!==h.type?h=de(h):(h=t.markerWidth,t[o]&&(h=t[o](e,i)),Zi(h)&&(h="identity"===h.type?r(e,i):de(h)))),Zi(u)&&("identity"!==u.type?u=de(u):(u=t.markerHeight,t[a]&&(u=t[a](e,i)),Zi(u)&&(u="identity"===u.type?s(e,i):de(u)))),[h,u]}(k,this.symbolDef,P,F,e,r)||[0,0];let t=k.markerTextFit;if(h&&(t=h(F,P)),t&&t&&"none"!==t){const n=k.text.textSize;let i=k.text.textName;m(i)&&(i=g(i)(F,P));const e=ve(i,P);if(e){const i="__fn_textSize".trim(),r="__fn_textSize_0".trim();m(n)&&!k.text[i]&&(k.text[r]=g(n),k.text[i]=(t,n)=>{const i=k.text[r](t,n);return m(i)?g(i)(t,n):i});const s=fe(k.text,k.text,P,F);if("width"!==t&&"both"!==t||(T[0]=s[0]*e.length),"height"!==t&&"both"!==t||(T[1]=s[1]),s[0]&&s[1]){let t=k.markerTextFitPadding||[0,0,0,0];u&&(t=u(F,P)),T[0]+=t[1]+t[3],T[1]+=t[0]+t[2]}}else T[0]=T[1]=-1}}if(I&&(T=fe(k,this.symbolDef,P,F)),!T)return A;if(T[0]=Math.ceil(T[0]),T[1]=Math.ceil(T[1]),this.size=T,O&&T[0]>=0&&T[1]>=0){let t;if(_){const n={};if(n.markerType=_,"path"===_&&(n.markerPath=i?i(null,P):k.markerPath,n.markerPathWidth=v?v(null,P):k.markerPathWidth,n.markerPathHeight=p?p(null,P):k.markerPathHeight),e){const t=e(null,P);Ji(t)||(n.markerWidth=t)}else k.markerWidth>=0&&(n.markerWidth=k.markerWidth);if(r){const t=r(null,P);Ji(t)||(n.markerHeight=t)}else k.markerHeight>=0&&(n.markerHeight=k.markerHeight);if(s){const t=s(null,P);Ji(t)||(n.markerFill=t)}else k.markerFill&&(n.markerFill=k.markerFill);if(o){const t=o(null,P);Ji(t)||(n.markerFillPatternFile=t)}else k.markerFillPatternFile&&(n.markerFillPatternFile=k.markerFillPatternFile);if(a){const t=a(null,P);Ji(t)||(n.markerFillOpacity=t)}else k.markerFillOpacity>=0&&(n.markerFillOpacity=k.markerFillOpacity);if(l){const t=l(null,P);Ji(t)||(n.markerLineColor=t)}else k.markerLineColor&&(n.markerLineColor=k.markerLineColor);if(c){const t=c(null,P);Ji(t)||(n.markerLineWidth=t)}else k.markerLineWidth>=0&&(n.markerLineWidth=k.markerLineWidth);if(f){const t=f(null,P);Ji(t)||(n.markerLineOpacity=t)}else k.markerLineOpacity>=0&&(n.markerLineOpacity=k.markerLineOpacity);if(d){const t=d(null,P);Ji(t)||(n.markerLineDasharray=t)}else k.markerLineDasharray&&(n.markerLineDasharray=k.markerLineDasharray);if(y){const t=y(null,P);Ji(t)||(n.markerLinePatternFile=t)}else k.markerLinePatternFile&&(n.markerLinePatternFile=k.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=S?S.replace(nr,this.V):k.markerPath?function(t,n,i){if(!t.markerPath)return null;let e=1;const r=function(t){const n={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return 0===n.stroke["stroke-width"]&&(n.stroke["stroke-opacity"]=0),n}(t);Xi(t.markerOpacity)&&(e=t.markerOpacity),Xi(t.opacity)&&(e*=t.opacity);const s={};if(r){for(const t in r.stroke)Qi(r.stroke,t)&&(Ji(r.stroke[t])||(s[t]=r.stroke[t]));for(const t in r.fill)Qi(r.fill,t)&&(Ji(r.fill[t])||(s[t]=r.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const h=[];for(let t=0;t<o.length;t++)a=Yi(o[t])?{path:o[t]}:o[t],a=Gi({},a,s),a.d=a.path,delete a.path,h.push(a);const u=[\'<svg version="1.1"\',\'xmlns="http://www.w3.org/2000/svg"\'];e<1&&u.push(\'opacity="\'+e+\'"\'),t.markerPathWidth&&t.markerPathHeight&&u.push(\'viewBox="0 0 \'+t.markerPathWidth+" "+t.markerPathHeight+\'"\'),u.push(\'preserveAspectRatio="none"\'),n&&u.push(\'width="\'+n+\'"\'),i&&u.push(\'height="\'+i+\'"\'),u.push("><defs></defs>");for(let t=0;t<h.length;t++){let n="<path ";for(const i in h[t])Qi(h[t],i)&&(n+=" "+i+\'="\'+h[t][i]+\'"\');n+="></path>",u.push(n)}return u.push("</svg>"),"data:image/svg+xml;base64,"+btoa(u.join(" "))}(k,T[0],T[1]):null;A.icon={url:t,size:T}}if(I){const t=w?w(null,P):k.textName;if(t||0===t){const n=function(t,n,i){return[n||"normal",i||"normal","24px",t||"monospace"].join(" ")}(M?M(null,P):k.textFaceName,b?b(null,P):k.textStyle,x?x(null,P):k.textWeight);let i=ve(t,P);i&&i.length&&(i=tr(i),A.glyph={font:n,text:i})}}return this.iconGlyph=A,A}}function er(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let i="center"!==n?n:"";return i+="center"!==t?(i.length?"-":"")+t:"",i\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function rr(t,n,i,e,r){const s=[];for(let o=0;o<t.length;o++){const a=t[o];let h;for(let t=0;t<a.length-1;t++){let o=a[t],u=a[t+1];o.x<n&&u.x<n||(o.x<n?o=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x<n&&(u=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y<i&&u.y<i||(o.y<i?o=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I():u.y<i&&(u=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I()),o.x>=e&&u.x>=e||(o.x>=e?o=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x>=e&&(u=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y>=r&&u.y>=r||(o.y>=r?o=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I():u.y>=r&&(u=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I()),h&&o.equals(h[h.length-1])||(h=[o],s.push(h)),h.push(u)))))}}return s}class sr extends Ht{constructor(t,n,i,e){super(t,n),this.angle=i,void 0!==e&&(this.segment=e)}clone(){return new sr(this.x,this.y,this.angle,this.segment)}}\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */function or(t,n,i,e,r){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const h=[];let u=0;for(;a<i/2;){const n=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(n)-n.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:a,angleDelta:s}),u+=s;a-h[0].distance>e;)u-=h.shift().angleDelta;if(u>r)return!1;o++,a+=n.dist(i)}return!0}function ar(t,n,i,e,r,s,o,a,h){const u=function(t,n,i){return t?.6*n*i:0}(e,s,o),l=function(t,n){return Math.max(t?t.right-t.left:0,n?n.right-n.left:0)}(e,r),c=0===t[0].x||t[0].x===h||0===t[0].y||t[0].y===h;return n-l*o<n/4&&(n=l*o+n/4),function t(n,i,e,r,s,o,a,h,u){const l=o/2,c=function(t){let n=0;for(let i=0;i<t.length-1;i++)n+=t[i].dist(t[i+1]);return n}(n);let f=0,d=i-e,y=[];for(let t=0;t<n.length-1;t++){const i=n[t],a=n[t+1],h=i.dist(a),v=a.angleTo(i);for(;d+e<f+h;){d+=e;const p=(d-f)/h,m=hr(i.x,a.x,p),g=hr(i.y,a.y,p);if(m>=0&&m<u&&g>=0&&g<u&&d-l>=0&&d+l<=c){const i=new sr(m,g,v,t);i.line=n,i.I(),r&&!or(n,i,o,r,s)||y.push(i)}}f+=h}return h||y.length||a||(y=t(n,f/2,e,r,s,o,a,!0,u)),y}(t,c?n/2*a%n:(l/2+2*s)*o*a%n,n,u,i,l*o,c,!1,h)}function hr(t,n,i){return t*(1-i)+n*i}function ur(t,n){const i=t.length;if(i<=1)return[t];const e=[];let r,s;for(let n=0;n<i;n++){const i=ne(t[n]);0!==i&&(t[n].area=Math.abs(i),void 0===s&&(s=i<0),s===i<0?(r&&e.push(r),r=[t[n]]):r.push(t[n]))}if(r&&e.push(r),n>1)for(let t=0;t<e.length;t++)e[t].length<=n||(Bt(e[t],n,1,e[t].length-1,lr),e[t]=e[t].slice(0,n));return e}function lr(t,n){return n.area-t.area}function cr(t,n,i){const e=n.distSqr(i);if(0===e)return t.distSqr(n);const r=((t.x-n.x)*(i.x-n.x)+(t.y-n.y)*(i.y-n.y))/e;return t.distSqr(r<0?n:r>1?i:i.sub(n).F(r).u(n))}function fr(t,n=1,i=!1){let e=1/0,r=1/0,s=-1/0,o=-1/0;const a=t[0];for(let t=0;t<a.length;t++){const n=a[t];(!t||n.x<e)&&(e=n.x),(!t||n.y<r)&&(r=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const h=Math.min(s-e,o-r);let u=h/2;const l=new Zt(null,dr);if(0===h)return new Ht(e,r);for(let n=e;n<s;n+=h)for(let i=r;i<o;i+=h)l.push(new yr(n+u,i+u,u,t));let c=function(t){let n=0,i=0,e=0;const r=t[0];for(let t=0,s=r.length,o=s-1;t<s;o=t++){const s=r[t],a=r[o],h=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*h,e+=(s.y+a.y)*h,n+=3*h}return new yr(i/n,e/n,0,t)}(t),f=l.length;for(;l.length;){const e=l.pop();(e.d>c.d||!c.d)&&(c=e,i&&console.log("found best %d after %d probes",Math.round(1e4*e.d)/1e4,f)),e.max-c.d<=n||(u=e.h/2,l.push(new yr(e.p.x-u,e.p.y-u,u,t)),l.push(new yr(e.p.x+u,e.p.y-u,u,t)),l.push(new yr(e.p.x-u,e.p.y+u,u,t)),l.push(new yr(e.p.x+u,e.p.y+u,u,t)),f+=4)}return i&&(console.log("num probes: "+f),console.log("best distance: "+c.d)),c.p}function dr(t,n){return n.max-t.max}function yr(t,n,i,e){this.p=new Ht(t,n),this.h=i,this.d=function(t,n){let i=!1,e=1/0;for(let r=0;r<n.length;r++){const s=n[r];for(let n=0,r=s.length,o=r-1;n<r;o=n++){const r=s[n],a=s[o];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),e=Math.min(e,cr(t,r,a))}}return(i?1:-1)*Math.sqrt(e)}(this.p,e),this.max=this.d+this.h*Math.SQRT2}const vr=45*Math.PI/100;function pr(t,n){const i={},e={},r=[];let s=0;function o(n){r.push(t[n]),s++}function a(t,n,i){const s=e[t];return delete e[t],e[n]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(i[0]),s}function h(t,n,e){const s=i[n];return delete i[n],i[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=e[0].concat(r[s].geometry[0]),s}function u(t,n,i){const e=i?n[0][n[0].length-1]:n[0][0];return`${t}:${e.x}:${e.y}`}for(let l=0;l<t.length;l++){const c=t[l],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(l);continue}const y=u(d,f),v=u(d,f,!0);if(y in e&&v in i&&e[y]!==i[v]){const t=h(y,v,f),n=a(y,v,r[t].geometry);delete i[y],delete e[v],e[u(d,r[n].geometry,!0)]=n,r[t].geometry=null}else y in e?a(y,v,f):v in i?h(y,v,f):(o(l),i[y]=s-1,e[v]=s-1)}return r.filter(t=>t.geometry)}class mr extends le{static needMerge(t){return t.mergeOnProperty&&("line"===t.textPlacement||"line"===t.markerPlacement)}static mergeLineFeatures(t,n,i){const e="__index".trim(),r=function(t,n,i){const e="__index".trim(),r=le.genFnTypes(n),{mergeOnPropertyFn:s}=r;if(!n.mergeOnProperty||"line"!==n.textPlacement&&"line"!==n.markerPlacement)return[];if(!(oe(o=n.mergeOnProperty)||"string"!=typeof o&&(null===o.constructor||o.constructor!==String)||"line"!==n.textPlacement&&"line"!==n.markerPlacement))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],h={},u=[];for(let r=0;r<t.length;r++){t[r][e]=r;const o=t[r].properties=t[r].properties||{};o.$layer=t[r].layer,o.$type=t[r].type;let l=n.markerPlacement;"line"!==l&&(l=n.textPlacement);const c=s?s(i,o):n.mergeOnProperty;"line"!==l||oe(c)?u.push(t[r]):(void 0===h[c]&&(h[c]=a.length,a.push({features:[],property:c})),a[h[c]].features.push(t[r]))}return u.length&&a.push({features:u}),a}(t,n,i);if(r.length){const n=[];for(let i=0;i<r.length;i++)n.push(r[i].property?pr(r[i].features,r[i].property):t);if(1===n.length)return n[0];{let t=[];for(let i=0;i<n.length;i++)t=t.concat(n[i]);return t.sort((t,n)=>t[e]-n[e]),t}}}static splitPointSymbol(t,n=0){const i=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&i.push(...mr.splitPointSymbol(n[t],t));return i}let e=null,r=null;for(const n in t)0===n.indexOf("marker")?(e=e||{},e[n]=t[n]):0===n.indexOf("text")&&(r=r||{},r[n]=t[n]);return e&&(e.isIconText=!0,t.mergeOnProperty&&(e.mergeOnProperty=t.mergeOnProperty),i.push(e)),r&&(e&&(r.textPlacement=e.markerPlacement,r.textSpacing=e.markerSpacing,r.isIconText=!0),t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),i.push(r)),void 0!==t.visible&&(e&&(e.visible=t.visible),r&&(r.visible=t.visible)),e&&(e.markerTextFit&&r&&(e.text={},e.text.textName=r.textName,e.text.textSize=r.textSize),e.index={index:n,type:0}),r&&(r.index={index:n,type:1}),i}static isAtlasLoaded(t,n){const{icon:i,glyph:e}=t,{iconAtlas:r,glyphAtlas:s}=n;if(i&&(!r||!r.positions[i.url]))return!1;if(e){if(!s||!s.positions[e.font])return!1;const t=s.positions[e.font],{text:n}=e;for(let i=0;i<n.length;i++)if(!t[n.charCodeAt(i)])return!1}return!0}constructor(t,n,i){super(t,n,i)}createStyledVector(t,n,i,e,r,s){const o=new ir(t,this.symbolDef,n,i,e),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;r[t]||(r[t]=a.icon.size),r[t][0]<n[0]&&(r[t][0]=n[0]),r[t][1]<n[1]&&(r[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:i}=a.glyph,e=s[t]=s[t]||{};for(let t=0;t<i.length;t++)e[i.charCodeAt(t)]=1;"line"===n.textPlacement&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,i=n?function(t){return"line"!==t.textPlacement||t.isIconText?[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}]:[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"},{type:Int16Array,width:2,name:"aGlyphOffset"},{type:Uint16Array,width:3,name:"aSegment"},{type:Uint8Array,width:1,name:"aVertical"}]}(t):[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}];n?i.push(...this.q()):i.push(...this.B());const{markerOpacityFn:e,textOpacityFn:r,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:h,markerRotationFn:u,textRotationFn:l,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:y}=this.C;return(e||r)&&i.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&i.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||h)&&i.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(u||l)&&i.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||y)&&i.push({type:Uint8Array,width:1,name:"aOverlap"}),i}q(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:i,textHaloRadiusFn:e,textHaloOpacityFn:r,textDxFn:s,textDyFn:o}=this.C,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),i&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),e&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloOpacity"}),s&&a.push({type:Int8Array,width:1,name:"aTextDx"}),o&&a.push({type:Int8Array,width:1,name:"aTextDy"}),a}B(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:i,markerDyFn:e}=this.C,r=[];return t&&r.push({type:Uint8Array,width:1,name:"aMarkerWidth"}),n&&r.push({type:Uint8Array,width:1,name:"aMarkerHeight"}),i&&r.push({type:Int8Array,width:1,name:"aMarkerDx"}),e&&r.push({type:Int8Array,width:1,name:"aMarkerDy"}),r}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.lineVertex=[];const t=super.createDataPack.apply(this,arguments);return t?(t.lineVertex=new Int16Array(this.lineVertex),t.buffers.push(t.lineVertex.buffer),t):null}placeVector(t,n){const i=t.getShape(this.iconAtlas,this.glyphAtlas);if(!this.options.allowEmptyPack&&!i)return;const e=this.G(t,i,n);if(0===e.length)return;const r=this.data;let s=this.data.aPosition.length/3;const o=t.symbol,a=t.feature.properties,h="line"===o.textPlacement&&!o.isIconText,u=void 0!==o.textName,l=u&&h&&function(t){let n=0;for(let i=0;i<t.length;i++)if(He(t.charAt(i).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:c,textSizeFn:f,textHaloFillFn:d,textHaloRadiusFn:y,textHaloOpacityFn:v,textDxFn:p,textDyFn:g,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:b,textAllowOverlapFn:x,textIgnorePlacementFn:F,textOpacityFn:A,markerWidthFn:k,markerHeightFn:P,markerDxFn:S,markerDyFn:_,markerPitchAlignmentFn:O,markerRotationAlignmentFn:I,markerRotationFn:T,markerAllowOverlapFn:L,markerIgnorePlacementFn:U,markerOpacityFn:z}=this.C;let D,E,C,j,N,H,V,R,$,W,q,B,G,J,X,Z,Y;if(u){const n=t.getIconAndGlyph().glyph.font;D=function(t,n,i){const e=t.positionedGlyphs,r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[o.glyph];if(!a)continue;const h=a.rect;if(!h)continue;const u=4,l=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+l,0]:[0,0],d=n?[0,o.y-c]:[o.x+l,o.y-c],y=a.metrics.left-u-l+d[0],v=a.metrics.top-u+d[1],p=y+h.w,m=v+h.h,g=new Ht(y,v),w=new Ht(p,v),M=new Ht(y,m),b=new Ht(p,m);if(n&&o.vertical){const t=new Ht(-l,l),n=-Math.PI/2,i=new Ht(5,0);g.P(n,t).u(i),w.P(n,t).u(i),M.P(n,t).u(i),b.P(n,t).u(i)}r.push({tl:g,tr:w,bl:M,br:b,tex:h,writingMode:t.writingMode,glyphOffset:f})}return r}(i.horizontal,h,this.glyphAtlas.positions[n]),c&&(E=c(null,a),m(E)?E=[0,0,0,0]:(E=Array.isArray(E)?E.map(t=>255*t):Vn(E).array(),3===E.length&&E.push(255))),f&&(C=f(this.options.zoom,a),oe(C)&&(C=14)),d&&(j=d(null,a),j=Array.isArray(j)?j.map(t=>255*t):Vn(j).array(),3===j.length&&j.push(255)),y&&(N=y(null,a)),v&&(H=255*v(null,a)),p&&(V=p(null,a)||0),g&&(R=g(null,a)||0),w&&(G=+("map"===w(null,a))),M&&(J=+("map"===M(null,a))),b&&(X=ae(b(null,a),0,360)*Math.PI/180)}else D=i?function(t){const n=t.image,i=t.top-1/n.pixelRatio,e=t.left-1/n.pixelRatio,r=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,h,u;return o=new Ht(e,i),a=new Ht(s,i),h=new Ht(s,r),u=new Ht(e,r),[{tl:o,tr:a,bl:u,br:h,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(i):function(){const t=new Ht(0,0),n=new Ht(0,0),i=new Ht(0,0);return[{tl:t,tr:n,bl:new Ht(0,0),br:i,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),k&&($=k(null,a)),P&&(W=P(null,a)),S&&(q=S(null,a)),_&&(B=_(null,a)),O&&(G=+("map"===O(null,a))),I&&(J=+("map"===I(null,a))),T&&(X=ae(T(null,a),0,360)*Math.PI/180);const K=L||x;K&&(Z=K(null,a)||0);const Q=U||F;let tt;Q&&(Y=Q(null,a)||0);const nt=A||z;nt&&(tt=255*nt(this.options.zoom,a));const it=this.options.EXTENT,et=D.length,rt=this.getAltitude(t.feature.properties);for(let t=0;t<e.length;t++){const n=e[t];if(it!==1/0&&se(n,it))continue;const i=n.x,o=n.y,a=D.length;for(let t=0;t<a;t++){const e=D[t],{tl:a,tr:c,bl:f,br:d,tex:y}=e;this.J(r,i,o,rt,10*a.x,10*a.y,y.x,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*c.x,10*c.y,y.x+y.w,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*f.x,10*f.y,y.x,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*d.x,10*d.y,y.x+y.w,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.addElements(s,s+1,s+2),this.addElements(s+1,s+2,s+3),s+=4;const v=Math.max(Math.abs(i),Math.abs(o),Math.abs(rt));v>this.maxPos&&(this.maxPos=v)}}}J(t,n,i,e,r,s,o,a){t.aPosition.push(n,i,e),t.aShape.push(r,s),t.aTexCoord.push(o,a)}X(t,n,i,e,r,s){if(t.aCount.push(i),n){t.aGlyphOffset.push(e[0],e[1]);const n=r.startIndex;t.aSegment.push(r.segment+n,n,r.line.length),t.aVertical.push(s)}}Z(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y,v,p,m){const{textFillFn:g,textSizeFn:w,textHaloFillFn:M,textHaloRadiusFn:b,textHaloOpacityFn:x,textDxFn:F,textDyFn:A,textPitchAlignmentFn:k,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:I,markerWidthFn:T,markerHeightFn:L,markerDxFn:U,markerDyFn:z,markerPitchAlignmentFn:D,markerRotationAlignmentFn:E,markerRotationFn:C,markerAllowOverlapFn:j,markerIgnorePlacementFn:N,markerOpacityFn:H}=this.C;g&&t.aTextFill.push(...n),w&&t.aTextSize.push(i),M&&t.aTextHaloFill.push(...e),b&&t.aTextHaloRadius.push(r),x&&t.aTextHaloOpacity.push(s),F&&t.aTextDx.push(o),A&&t.aTextDy.push(a),T&&t.aMarkerWidth.push(h),L&&t.aMarkerHeight.push(u),U&&t.aMarkerDx.push(l),z&&t.aMarkerDy.push(c),(H||I)&&t.aColorOpacity.push(f),(k||D)&&t.aPitchAlign.push(d),(E||P)&&t.aRotationAlign.push(y),(C||S)&&t.aRotation.push(9362*v);const V=j||_,R=N||O;(V||R)&&t.aOverlap.push((V?8:0)+4*p+((R?2:0)+m)),r>0&&(this.properties.hasHalo=1)}G(t,n,i){const{feature:e,symbol:r}=t,s=this.Y(t,r),o=e.properties,{markerSpacingFn:a,textSpacingFn:h}=this.C,u=((a?a(null,o):r.markerSpacing)||(h?h(null,o):r.textSpacing)||250)*i;return function(t,n,i,e,r,s,o){const{feature:a,size:h,symbol:u}=t,l=h?24:0,c=e*(h?h[0]/l:1),f=[];if("line"===s){let t=a.geometry;r&&(t=rr(a.geometry,0,0,r,r));for(let e=0;e<t.length;e++){const s=ar(t[e],o,vr,u.isIconText?null:i.vertical||i.horizontal||i,null,l,u.isIconText?1:c,1,r||1/0);if(u.textPlacement&&!u.isIconText)for(let t=0;t<s.length;t++)s[t].startIndex=n.length/3;if(f.push.apply(f,s),u.textPlacement&&!u.isIconText)for(let i=0;i<t[e].length;i++)n.push(t[e][i].x,t[e][i].y,0)}}else if(3===a.type){const t=ur(a.geometry,0);for(let n=0;n<t.length;n++){const i=t[n];if("vertex"===s)for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t])}else{const t=fr(i,16);se(t,r)||f.push(t)}}}else if(2===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];if("vertex"===s)for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t]);else se(n[0],r)||f.push(n[0])}else if(1===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,r)||f.push(i)}}return f}(t,this.lineVertex,n,i,this.options.EXTENT,s,u)}Y(t,n){return this.C.markerPlacementFn?this.C.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||n.textPlacement}}const gr=Math.cos(Math.PI/180*37.5),wr=Math.pow(2,16)/1;class Mr extends le{constructor(t,n,i){super(t,n,i);let e=!1;const{lineDasharrayFn:r,lineDashColorFn:s}=this.C;r&&(e=function(t,n,i){for(let e=0;e<t.length;e++)if(i(n,t[e].properties))return!0;return!1}(t,this.options.zoom,r),e&&(this.dasharrayFn=r)),(Fr(this.symbol.lineDasharray)||e)&&s&&(this.dashColorFn=s)}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getLineResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:i,lineColorFn:e,lineOpacityFn:r,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:h}=this.C,u=[{type:Int16Array,width:3,name:"aPosition"}];if(u.push(this.options.center||this.iconAtlas?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),u.push({type:Uint16Array,width:1,name:"aLinesofar"}),t&&u.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&u.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),e&&u.push({type:Uint8Array,width:4,name:"aColor"}),i&&u.push({type:Uint8Array,width:4,name:"aStrokeColor"}),r&&u.push({type:Uint8Array,width:1,name:"aOpacity"}),this.symbol.lineOffset&&u.push({type:Int8Array,width:2,name:"aExtrudeOffset"}),this.dasharrayFn&&u.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&u.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();u.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return s&&u.push({type:Int8Array,width:1,name:"aLineDx"}),o&&u.push({type:Int8Array,width:1,name:"aLineDy"}),a&&u.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),h&&u.push({type:Uint8Array,width:1,name:"aLinePatternGap"}),u}placeVector(t){const{lineJoinFn:n,lineCapFn:i,lineWidthFn:e,lineStrokeWidthFn:r,lineStrokeColorFn:s,lineColorFn:o,lineOpacityFn:a,lineJoinPatternModeFn:h,lineDxFn:u,lineDyFn:l,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.C,d=this.symbol,y=t.feature,v=3===y.type,p=y.properties,g=this.elements;v&&(this.elements=[]);let w=d.lineJoin||"miter",M=d.lineCap||"butt";if(n&&(w=n(this.options.zoom,p)||"miter"),i&&(M=i(this.options.zoom,p)||"butt"),e){let t=e(this.options.zoom,p);Ji(t)&&(t=4),this.feaLineWidth=t}else this.feaLineWidth=d.lineWidth;if(r){let t=r(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(o&&(this.feaColor=o(this.options.zoom,p)||[0,0,0,255],m(this.feaColor)?this.feaColor=[0,0,0,0]:(this.feaColor=Array.isArray(this.feaColor)?this.feaColor.map(t=>255*t):Vn(this.feaColor).array(),3===this.feaColor.length&&this.feaColor.push(255))),s&&(this.feaStrokeColor=s(this.options.zoom,p)||[0,0,0,255],m(this.feaStrokeColor)?this.feaStrokeColor=[0,0,0,0]:(this.feaStrokeColor=Array.isArray(this.feaStrokeColor)?this.feaStrokeColor.map(t=>255*t):Vn(this.feaStrokeColor).array(),3===this.feaStrokeColor.length&&this.feaStrokeColor.push(255))),a){let t=a(this.options.zoom,p);Ji(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,p)||[0,0,0,0];if(t.length<4){const n=t;1===t.length?t=[n[0],n[0],n[0],n[0]]:2===t.length?t=[n[0],n[1],n[0],n[1]]:3===t.length&&(t=[n[0],n[1],n[2],n[2]])}this.feaDash=t}if(this.dashColorFn){let t=(this.dashColorFn?this.dashColorFn(this.options.zoom,p):this.symbol.lineDashColor)||[0,0,0,0];t=Array.isArray(t)?t.map(t=>255*t):Vn(t).array(),3===t.length&&t.push(255),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),i=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],i){const{tl:t,displaySize:i}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=i[0]-3,this.feaTexInfo[3]=i[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0;this.feaJoinPatternMode=h?h(this.options.zoom,p)||0:d.lineJoinPatternMode||0}if(u){let t=u(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDx=t}if(l){let t=l(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,p);Ji(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,p);Ji(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let x=y.geometry;b!==1/0&&3!==y.type&&(x=rr(y.geometry,-1,-1,b+1,b+1));for(let t=0;t<x.length;t++)this.offset=this.data.aPosition.length/3,this.K(x[t],y,w,M,2,1.05),v&&(this.tt(g),this.elements=[]);v&&(this.elements=g)}nt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}K(t,n,i,e,r,s){const o=this.nt()||Fr(this.feaDash)||Fr(this.symbol.lineDasharray);this.overscaling=1;const a=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.symbol.lineGradientProperty&&n.properties&&Qi(n.properties,"mapbox_clip_start")&&Qi(n.properties,"mapbox_clip_end")){this.clipStart=+n.properties.mapbox_clip_start,this.clipEnd=+n.properties.mapbox_clip_end;for(let n=0;n<t.length-1;n++)this.totalDistance+=t[n].dist(t[n+1]);this.updateScaledDistance()}const h=3===n.type;let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let l=0;for(;l<u-1&&t[l].equals(t[l+1]);)l++;if(u<(h?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?15*a/(512*this.overscaling):0,f={vertexLength:0,primitiveLength:0};let d,y,v,p,m;this.e1=this.e2=-1,h&&(d=t[u-2],m=t[l].sub(d)._().O());for(let n=l;n<u;n++){if(v=n===u-1?h?t[l+1]:void 0:t[n+1],v&&t[n].equals(v))continue;m&&(p=m),d&&(y=d),d=t[n],m=v?v.sub(d)._().O():p,p=p||m;let a=p.add(m);0===a.x&&0===a.y||a._();const g=p.x*m.x+p.y*m.y,w=a.x*m.x+a.y*m.y,M=0!==w?1/w:1/0,b=2*Math.sqrt(2-2*w),x=w<gr&&y&&v,F=p.x*m.y-p.y*m.x>0;if(!o&&x&&n>l){const t=d.dist(y);if(t>2*c){const n=d.sub(d.sub(y).F(c/t).I());this.updateDistance(y,n),this.addCurrentVertex(n,p,0,0,f),y=n}}const A=y&&v;let k=A?i:h?"butt":e;if(A&&"round"===k&&(M<s?k="miter":M<=2&&(k="fakeround")),"miter"===k&&M>r&&(k="bevel"),"bevel"===k&&(M>2&&(k="flipbevel"),M<r&&(k="miter")),y&&this.updateDistance(y,d),(n>l&&n<u-1||h&&n===u-1)&&o){const t=this.feaJoinPatternMode?0:-p.mag()*w;this.addCurrentVertex(d,p,t,t,f),this.it=1}if("miter"===k)a.F(M),this.addCurrentVertex(d,a,0,0,f);else if("flipbevel"===k){if(M>100)a=m.mult(-1);else{const t=M*p.add(m).mag()/p.sub(m).mag();a.O().F(t*(F?-1:1))}this.addCurrentVertex(d,a,0,0,f),this.addCurrentVertex(d,a.mult(-1),0,0,f)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(M*M-1),n=F?t:0,i=F?0:t;if(y&&this.addCurrentVertex(d,p,n,i,f),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let n=1;n<t;n++){let i=n/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const e=m.sub(p).F(i).u(p)._().F(F?-1:1);this.addHalfVertex(d,e.x,e.y,!1,F,0,f)}}v&&this.addCurrentVertex(d,m,-n,-i,f)}else if("butt"===k)this.addCurrentVertex(d,a,0,0,f);else if("square"===k){const t=y?1:-1;this.addCurrentVertex(d,a,t,t,f)}else"round"===k&&(y&&(this.addCurrentVertex(d,p,0,0,f),this.addCurrentVertex(d,p,1,1,f,!0)),v&&(this.addCurrentVertex(d,m,-1,-1,f,!0),this.addCurrentVertex(d,m,0,0,f)));if(!o&&x&&n<u-1){const t=d.dist(v);if(t>2*c){const n=d.add(v.sub(d).F(c/t).I());this.updateDistance(d,n),this.addCurrentVertex(n,m,0,0,f),d=n}}if((n>l&&n<u-1||h&&n===l)&&o){delete this.it;const t=this.feaJoinPatternMode?0:m.mag()*w;this.addCurrentVertex(d,m,t,t,f)}}}addCurrentVertex(t,n,i,e,r,s=!1){const o=n.y*e-n.x,a=-n.y-n.x*e;this.addHalfVertex(t,n.x+n.y*i,n.y-n.x*i,s,!1,i,r),this.addHalfVertex(t,o,a,s,!0,-e,r),this.distance>wr/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,i,e,r,s))}addHalfVertex({x:t,y:n},i,e,r,s,o,a){this.fillData(this.data,t,n,i,e,r,s,1*this.scaledDistance);const h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),a.primitiveLength++),s?this.e2=h:this.e1=h}fillData(t,n,i,e,r,s,o,a){const{lineWidthFn:h,lineStrokeWidthFn:u,lineStrokeColorFn:l,lineColorFn:c,lineOpacityFn:f,lineDxFn:d,lineDyFn:y,linePatternAnimSpeedFn:v,linePatternGapFn:p}=this.C;if(this.options.center?t.aPosition.push(n,i,0):t.aPosition.push(n=(n<<1)+(s?1:0),i=(i<<1)+(o?1:0),0),t.aExtrude.push(63*e,63*r),this.options.center||this.iconAtlas){let n=0;this.options.center&&(n+=2*s+o),this.iconAtlas&&(n+=4*(this.it&&this.feaJoinPatternMode?1:0)),t.aExtrude.push(n)}t.aLinesofar.push(a),h&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),u&&t.aLineStrokeWidth.push(Math.round(2*this.feaLineStrokeWidth)),c&&t.aColor.push(...this.feaColor),l&&t.aStrokeColor.push(...this.feaStrokeColor),f&&t.aOpacity.push(this.feaOpacity),this.dasharrayFn&&t.aDasharray.push(...this.feaDash),this.dashColorFn&&t.aDashColor.push(...this.feaDashColor),this.iconAtlas&&t.aTexInfo.push(...this.feaTexInfo),d&&t.aLineDx.push(this.feaLineDx),y&&t.aLineDy.push(this.feaLineDy),v&&t.aLinePatternAnimSpeed.push(127*this.feaPatternAnimSpeed),p&&t.aLinePatternGap.push(10*this.feaLinePatternGap),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(i)+1)}addElements(t,n,i){super.addElements(this.offset+t,this.offset+n,this.offset+i)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=3)n!==1/0&&(xr(this.data.aPosition,i[e],i[e+1],3,n)||xr(this.data.aPosition,i[e+1],i[e+2],3,n))||t.push(i[e],i[e+1],i[e+2])}et(t){if(t.length<=1)return t;const n=[],i=this.options.EXTENT;let e,r=!0;for(e=0;e<t.length-1;e++){const s=br(t[e],t[e+1],i);s&&r||(n.push(t[e]),r=s)}return r||n.push(t[e]),n}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(wr-1):this.distance}}function br(t,n,i){return i!==1/0&&(t.x<0&&n.x<0||t.x>i&&n.x>i||t.y<0&&n.y<0||t.y>i&&n.y>i)}function xr(t,n,i,e,r){if(r===1/0)return!1;const s=Math.floor(.5*t[n*e]),o=Math.floor(.5*t[n*e+1]),a=Math.floor(.5*t[i*e]),h=Math.floor(.5*t[i*e+1]);return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function Fr(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}class Ar extends Mr{constructor(t,n,i){super(t,n,i),this.rt=i.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.C,i=[{type:Int16Array,width:3,name:"aPosition"},{type:Uint16Array,width:1,name:"aLinesofar"},{type:Uint8Array,width:1,name:"aUp"},{type:Int16Array,width:3,name:"aExtrudedPosition"},{type:Int8Array,width:2,name:"aExtrude"}];return t&&i.push({type:Uint8Array,width:4,name:"aColor"}),n&&i.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.rt&&i.push({type:Array,width:1,name:"aLineHeight"}),i}placeVector(t){const n=t.feature;if(this.rt){const{altitudeScale:t,altitudeProperty:i,defaultAltitude:e,heightProperty:r,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:h}=re(n,t,i,e,r,s,o);this.feaAltitude=a,this.feaMinHeight=(a-h)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}K(t,n,i,e,r,s){const o=this.data.aPosition.length/3;super.K(t,n,i,e,r,s);const a=this.data.aPosition.length/3,h=this.data.aPosition.length/3-this.offset;if(3!==n.type&&h>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[o*e+3*e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*n+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*(n+3)+t])}super.addElements(t+1,h+1,h),super.addElements(h,h+1,h+2);const e=this.data.aPosition.length/3-this.offset;i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[a*e-e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-r+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-3*r+t])}super.addElements(e,h-3,e+1),super.addElements(h-3,e+2,e+1)}}fillData(t,n,i,e,r,s,o,a){const h=!1!==this.options.top,u=!1!==this.options.side,l=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),c=63*e,f=63*r,d=l*e+n,y=l*r+i;this.st(t,n,i,e,r,s,o,a,d,y,c,f),u&&(h&&this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(i))}st(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,32767),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}ot(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,this.feaMinHeight||0),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}addElements(t,n,i){const e=!1!==this.options.top,r=!1!==this.options.side,s=(e?1:0)+(r?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(i*=s)+4]){if(e&&super.addElements(n,t,i),r){const t=e?1:0;super.addElements(n+t,i+t,i+t+2),super.addElements(n+t+1,i+t+1+2,n+t+1+2)}}else if(e&&super.addElements(t,i,n),r){const n=e?1:0;super.addElements(t+n,t+n+2,i+n),super.addElements(t+n+1+2,i+n+1+2,i+n+1)}}createDataPack(t,n){this.maxAltitude=0;const i=super.createDataPack(t,n);if(!i)return i;const{data:e,indices:r}=i;this.getFormat().reduce((t,n)=>(t[n.name]={size:n.width},t),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:h,aExtrude:u,aColor:l,aLineHeight:c,aLineWidth:f}=e,d={},y=Xn(s,r);let v,p=!0;for(let t=0;t<y.length;t++)y[t]=-y[t],y[t]%1!=0&&(p=!1);if(!1!==this.options.top&&this.symbol.material&&function(t){for(const n in t)if(n.indexOf("Texture")>=0&&t[n])return!0;return!1}(this.symbol.material)&&(v=function(t,n,i){const e=[];for(let r=0;r<t.length;r+=3){const t=n[r/3];e.push(t/256,i[r/3]?1:0)}return e}(s,a,h)),d.aPosition=o,v&&(d.aTexCoord0=new Float32Array(v)),d.aNormal=p?new Int8Array(y):new Float32Array(y),d.aPickingId=e.aPickingId,d.aExtrude=u,l&&(d.aColor=l),f&&(d.aLineWidth=f),c){const t=Wi(this.maxAltitude);d.aLineHeight=new t(c)}const m=[];for(const t in d)m.push(d[t].buffer);return i.data=d,i.buffers=m,i}}const kr=Math.pow(2,16)/1;class Pr extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=t.feature,i=3===n.type,e=n.geometry,r=this.elements;i&&(this.elements=[]);for(let t=0;t<e.length;t++)this.offset=this.data.aPosition.length/3,this.K(e[t],n),i&&(this.tt(r),this.elements=[]);i&&(this.elements=r)}K(t,n){const i=3===n.type;let e=t.length;for(;e>=2&&t[e-1].equals(t[e-2]);)e--;let r,s,o,a=0;for(;a<e-1&&t[a].equals(t[a+1]);)a++;if(!(e<(i?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,i&&(r=t[e-2]);for(let n=a;n<e;n++)o=i&&n===e-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(r&&(s=r),r=t[n],s&&(this.distance+=r.dist(s)),this.addCurrentVertex(r,this.distance))}}addCurrentVertex(t,n){const i=this.vertexLength++;this.addLineVertex(this.data,t,n),i>=1&&this.addElements(i-1,i),n>kr&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){t.aPosition.push(n.x,n.y,0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){super.addElements(this.offset+t,this.offset+n)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=2)ie(this.data.aPosition,i[e],i[e+1],3,n)||t.push(i[e],i[e+1])}}const Sr=45*Math.PI/100;class _r extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=this.G(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point"),i=this.getAltitude(t.feature.properties);for(let t=0;t<n.length;t++){const e=n[t];this.data.aPosition.push(e.x,e.y),this.data.aPosition.push(i);const r=Math.max(Math.abs(e.x),Math.abs(e.y));r>this.maxPos&&(this.maxPos=r)}}G(t,n,i){const e=t.feature,r=t.feature.type,s=this.options.EXTENT,o=[];if("line"===i){let t=e.geometry;s&&(t=rr(e.geometry,0,0,s,s));for(let i=0;i<t.length;i++){const e=ar(t[i],n,Sr,null,null,24,1,1,s||1/0);o.push.apply(o,e)}}else if(3===r){const t=ur(e.geometry,0);for(let n=0;n<t.length;n++){const i=fr(t[n],16);se(i,s)||o.push(i)}}else if(2===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];se(n[0],s)||o.push(n[0])}else if(1===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,s)||o.push(i)}}return o}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const Or=[],Ir=[];function Tr(t,n){var i,e,r,s,o,a,h;for(e=1;e<=8;e*=2){for(i=[],s=!(Ur(r=t[t.length-1],n)&e),o=0;o<t.length;o++){if((h=!(Ur(a=t[o],n)&e))!==s){const t=Lr(r,a,e,n);i.push(void 0!==a.x?new Ht(t[0],t[1]):t)}h&&i.push(a),r=a,s=h}if(!(t=i).length)break}return i}function Lr(t,n,i,e){return Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y,t=Or,Ir[0]=void 0===n.x?n[0]:n.x,Ir[1]=void 0===n.y?n[1]:n.y,n=Ir,8&i?[t[0]+(n[0]-t[0])*(e[3]-t[1])/(n[1]-t[1]),e[3]]:4&i?[t[0]+(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1]),e[1]]:2&i?[e[2],t[1]+(n[1]-t[1])*(e[2]-t[0])/(n[0]-t[0])]:1&i?[e[0],t[1]+(n[1]-t[1])*(e[0]-t[0])/(n[0]-t[0])]:null}function Ur(t,n){Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y;var i=0;return(t=Or)[0]<n[0]?i|=1:t[0]>n[2]&&(i|=2),t[1]<n[1]?i|=4:t[1]>n[3]&&(i|=8),i}class zr extends le{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getPolygonResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const t=[{type:Int16Array,width:3,name:"aPosition"}],{polygonFillFn:n,polygonOpacityFn:i,uvScaleFn:e,uvOffsetFn:r}=this.C;if(this.iconAtlas){const n=this.getIconAtlasMaxValue();t.push({type:n>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return n&&t.push({type:Uint8Array,width:4,name:"aColor"}),i&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),e&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),r&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),t}createDataPack(...t){this.maxLineIndex=0,this.lineElements=[];const n=super.createDataPack(...t);if(!n)return n;let i=this.lineElements;return i=new($i(this.maxLineIndex))(this.lineElements),n.lineIndices=i,n.buffers.push(i.buffer),n}placeVector(t,n){const i=t.feature;this.at(i.geometry,i,n)}at(t,n){let i,e,r,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:h,uvOffsetFn:u}=this.C,l=n.properties;o&&(i=o(this.options.zoom,l)||[255,255,255,255],m(i)?i=[0,0,0,0]:(i=Array.isArray(i)?i.map(t=>255*t):Vn(i).array(),3===i.length&&i.push(255))),a&&(e=a(this.options.zoom,l),Ji(e)&&(e=1),e*=255),h&&(r=h(this.options.zoom,l),Ji(r)&&(r=[1,1]),r=[255*r[0],255*r[1]]),u&&(s=u(this.options.zoom,l),Ji(s)&&(s=[0,0]),s=[255*s[0],255*s[1]]);const c=!!this.iconAtlas,f=ur(t,500),d=this.getAltitude(l),y=[0,0],v=[0,0];if(c){const{polygonPatternFileFn:t}=this.C,n=t?t(null,l):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n];y[0]=t.tl[0]+1,y[1]=t.tl[1]+1,v[0]=t.displaySize[0]-3,v[1]=t.displaySize[1]-3}}const p=[-1,-1,n.extent+1,n.extent+1];for(let t=0;t<f.length;t++){const n=f[t],o=this.data.aPosition.length/3,a=[],h=[];for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&(o=Tr(o,p)),0===o.length)continue;0!==t&&h.push(a.length/2);const u=this.lineElements.length;this.data.aPosition.push(o[0].x,o[0].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[0].x),Math.abs(o[0].y)),this.addLineElements(u+o.length-1,u),a.push(o[0].x),a.push(o[0].y);for(let t=1;t<o.length;t++)this.data.aPosition.push(o[t].x,o[t].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[t].x),Math.abs(o[t].y)),this.addLineElements(u+t-1,u+t),a.push(o[t].x),a.push(o[t].y)}const u=ki(a,h);for(let t=0;t<u.length;t+=3)this.addElements(o+u[t],o+u[t+1],o+u[t+2])}}addLineElements(...t){this.maxLineIndex=Math.max(this.maxLineIndex,...t),this.lineElements.push(...t)}}var Dr=Object.freeze({__proto__:null,clipPolygon:Tr,calculateSignedArea:ne,getFeaAltitudeAndHeight:re,convertRTLText:tr});const Er={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textStyle:1,textFaceName:1,textWeight:1,textPlacement:1,textSpacing:1,lineJoin:1,lineCap:1,linePatternFile:1};Object.assign({visible:1,textHorizontalAlignment:1,textVerticalAlignment:1,textWrapWidth:1,markerHorizontalAlignment:1,markerVerticalAlignment:1},Er),Object.assign({lineDasharray:1},Er);function Cr(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y){const v=n.length,p=r/3;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v,(i=i||[]).push(v/3);for(let n=0;n<i.length;n++){jr(p+(i[n-1]||0),p+i[n],t,v/3,a,e,h,u,l,c,f,d,y)}return r}function jr(t,n,i,e,r,s,o,a,h,u,l,c,f){const d=s.length;let y,v;for(let o=t,a=n;o<a-1;o++)y=o,v=o+1,ct(i,y,v,r)||((o-t)%2==1&&(y+=2*e,v+=2*e),s.push(y+e,y,v),s.push(v,v+e,y+e));o&&function(t,n,i,e,r,s,o,a,h){let u,l=0,c=0,f=0,d=0;for(let y=e.length-1;y>=0;y--){const v=3*e[y],p=3*e[y]+1,m=3*e[y]+2,g=i[v],w=i[p],M=i[m];l||c||(l=Math.max(i[m],i[3*e[y-2]+2]),c=Math.min(i[m],i[3*e[y-2]+2]),u=l-c);let b=f;const x=y%6;0===t?(5===x&&(d=Nt(i,e,y,g,w)),b=2===x||3===x||4===x?f:f+d):1===t&&(2===x||3===x||4===x?b=0:5===x?(d=Nt(i,e,y,g,w),b=d):b=d);const F=b*o*a/r,A=M===l?0:u*h/s;n[v/3*2]=F,n[v/3*2+1]=-A,0===x&&(f+=d)}}(a,h,i,s.slice(d,s.length),u[0],u[1],l,c,f)}function Nr(t,n,i,e,r,s,o,a,h,u){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0);const{altitudeScale:l,altitudeProperty:c,defaultAltitude:f,heightProperty:d,minHeightProperty:y,defaultHeight:v,tangent:p,uv:m,uvScale:M,topUVMode:b,sideUVMode:x,top:F,side:A,topThickness:k}=n,S=function(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a},{side:h,top:u,topThickness:l,uvOrigin:c,uv:f,uvSize:d,topUVMode:y,sideUVMode:v,glScale:p,localScale:m,vScale:g},w){const M=n/t[0].extent,b=[],x=[],F=[],A=[],k=[],S=[],_=!!f,O=!!u,T=!!h,z=_?[]:null;function D(t,i,e,r){if(O){const r=ki(A,e,3);if(0===r.length)return i;let s;I(k,A),i+=A.length;for(let n=2,i=r.length;n<i;n+=3)s=r[n-1],r[n-1]=r[n]+t/3,r[n]=s+t/3,r[n-2]+=t/3;I(S,r),_&&Et(y||0,t,i,z,k,0,p,m,d[0],d[1]),l>0&&!T&&(i=Cr(k,A,e,S,i,0,l,n,_,v||0,z,d,p,m,g))}return T&&(O&&(l=0),i=Cr(k,A,e,S,i,l,r,n,_,v||0,z,d,p,m,g)),i}let E=0,C=0;const j=[-1,-1,n+1,n+1];let N=0,H=t.length;void 0!==w&&(N=w,H=w+1);let V=0,R=!1;for(;N<H;N++){const h=t[N],u=h.id;P(u)&&(Math.abs(u)>V&&(V=Math.abs(u)),u<0&&(R=!0));const l=h.geometry,{altitude:c,height:f}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);E=Math.max(Math.abs(c),E);const d=k.length;let y=C,v=[];A.length=0;for(let t=0,i=l.length;t<i;t++){const e=Dr.calculateSignedArea(l[t])<0;!e&&t>0&&(C=D(y,C,v,f*M),A.length=0,v=[],y=C);let r=l[t];if(n!==1/0&&(r=Dr.clipPolygon(r,j)),!r.length){t===i-1&&(C=D(y,C,v,f*M));continue}const s=r.length;Array.isArray(r[0])?r[0][0]===r[s-1][0]&&r[0][1]===r[s-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[s-1].x&&r[0].y===r[s-1].y||r.push(r[0]),e&&v.push(A.length/3),lt(A,A.length,r,M,c),t===i-1&&(C=D(y,C,v,f*M))}const p=k.length-d,m="__fea_idx".trim();for(let t=0;t<p/3;t++)x.push(void 0===h[m]?N:h[m]),b.push(N),P(u)&&F.push(u)}const $=L(x.length?x[x.length-1]:0),W={maxAltitude:E,vertices:new(U(Math.max(512,E)))(k),indices:S,pickingIds:new $(x),featureIndexes:b};if(F.length){const t=R?U(V):L(V);W.featureIds=new t(F)}else W.featureIds=[];return z&&(z.length=k.length/3*2,W.uvs=z),W}(t,i,{altitudeScale:l,altitudeProperty:c,defaultAltitude:f||0,heightProperty:d,minHeightProperty:y,defaultHeight:v||0},{top:F,side:A,topThickness:10*k||0,uv:m||p,uvSize:M?[.5*M[0],.5*M[1]]:[.5,.5],uvOrigin:e,topUVMode:b,sideUVMode:x,glScale:r,localScale:o,vScale:s},u),_=[],O=new(T(S.vertices.length/3))(S.indices);delete S.indices,_.push(O.buffer,S.vertices.buffer,S.pickingIds.buffer);const z=Xn(S.vertices,O);let E=!0;for(let t=0;t<z.length;t++)z[t]=-z[t],z[t]%1!=0&&(E=!1);if(S.normals=z,p){let t=function(t,n,i,e){const r=t.length/3,s=new Array(4*r),o=[],a=[];for(let t=0;t<r;t++)o[t]=[0,0,0],a[t]=[0,0,0];const h=[0,0,0],u=[0,0,0],l=[0,0,0],c=[0,0],f=[0,0],d=[0,0],y=[0,0,0],v=[0,0,0];function p(n,e,r){Zn(h,t,3*n),Zn(u,t,3*e),Zn(l,t,3*r),Yn(c,i,2*n),Yn(f,i,2*e),Yn(d,i,2*r);const s=u[0]-h[0],p=l[0]-h[0],m=u[1]-h[1],g=l[1]-h[1],w=u[2]-h[2],M=l[2]-h[2],b=f[0]-c[0],x=d[0]-c[0],F=f[1]-c[1],A=d[1]-c[1],k=1/(b*A-x*F);bt(y,(A*s-F*p)*k,(A*m-F*g)*k,(A*w-F*M)*k),bt(v,(b*p-x*s)*k,(b*g-x*m)*k,(b*M-x*w)*k),xt(o[n],o[n],y),xt(o[e],o[e],y),xt(o[r],o[r],y),xt(a[n],a[n],v),xt(a[e],a[e],v),xt(a[r],a[r],v)}for(let t=0,n=e.length;t<n;t+=3)p(e[t+0],e[t+1],e[t+2]);const m=[],g=[],w=[],M=[];let b,x,F;function A(t){Zn(w,n,3*t),Mt(M,w),x=o[t],Mt(m,x),St(m,m,function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}(w,w,kt(w,x))),At(m,m),Pt(g,M,x),F=kt(g,a[t]),b=F<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,n=e.length;t<n;t+=3)A(e[t+0]),A(e[t+1]),A(e[t+2]);return s}(S.vertices,S.normals,S.uvs,O);t=function(t,n){const i=new Float32Array(n.length),e=[],r=[],s=[];for(let o=0;o<n.length;o+=4){const a=o/4*3;bt(r,t[a]||0,t[a+1]||0,t[a+2]||0),Ot(e,n[o]||0,n[o+1]||0,n[o+2]||0,n[o+3]||0),Jn(s,r,e),_t(i.subarray(o,o+4),s)}return i}(S.normals,t),S.tangents=t,_.push(t.buffer),delete S.normals}if(S.normals&&(S.normals=E?new Int8Array(S.normals):new Float32Array(S.normals),_.push(S.normals.buffer)),S.uvs){const t=S.uvs;S.uvs=new Float32Array(t),_.push(S.uvs.buffer)}const C=function(t,n,i,e){const r={};if(D(n.polygonFill)){const s={},o=w(n.polygonFill),a=new Uint8Array(4*e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],h=r.properties||{};h.$layer=r.layer,h.$type=r.type;let u=o(i,h);if(delete h.$layer,delete h.$type,Array.isArray(u)||(u=s[u]=s[u]||Vn(u).array()),Array.isArray(u)){for(let t=0;t<u.length;t++)Hr[t]=255*u[t];3===u.length&&(Hr[3]=255)}a[4*n]=Hr[0],a[4*n+1]=Hr[1],a[4*n+2]=Hr[2],a[4*n+3]=Hr[3]}r.aColor=a}if(D(n.polygonOpacity)){const s=g(n.polygonOpacity),o=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],a=r.properties||{};a.$layer=r.layer,a.$type=r.type;const h=s(i,a);delete a.$layer,delete a.$type,o[n]=255*h}r.aOpacity=o}return r}(t,a,h,S.featureIndexes),j={data:{data:{aPosition:S.vertices,aNormal:S.normals,aTexCoord0:S.uvs,aTangent:S.tangents,aPickingId:S.pickingIds},indices:O,properties:{maxAltitude:S.maxAltitude}},buffers:_};return S.featureIds.length?(j.data.featureIds=S.featureIds,_.push(j.data.featureIds.buffer)):j.data.featureIds=[],C.aColor&&(j.data.data.aColor=C.aColor,j.buffers.push(C.aColor.buffer)),C.aOpacity&&(j.data.data.aOpacity=C.aOpacity,j.buffers.push(C.aOpacity.buffer)),j}const Hr=[];function Vr(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a,bottom:h}){const u=h,l=n/t[0].extent,c=2*function(t,n){let i=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(P(r.geometry[0][0])){const t=3*r.geometry.length;i+=n?2*t-6:t}else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),i+=n?2*e-6:e}}return i}(t)+3*t.length*2,f=[],d=new Int16Array(c),y=[];function v(t,i,e){const r=i-t,s=d.subarray(t,i),o=d.subarray(i,i+r);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-e;const a=t/3,h=r/3;let l,c;for(let t=a,i=h+a;t<i;t++)t<i-1?(l=t,c=t+1):(l=t,c=a),ct(d,l,c,n)||(y.push(l,c),u&&y.push(l+h,c+h),Rr(d,l,n)||y.push(l,l+h));return i+r}let p=0,m=0;const g="__fea_idx".trim();for(let n=0,h=t.length;n<h;n++){const h=t[n],u=h.geometry,{altitude:c,height:w}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);m=Math.max(Math.abs(c),m);let M=p;for(let t=0,n=u.length;t<n;t++){let n=u[t];const i=n.length;n[0][0]===n[i-1][0]&&n[0][1]===n[i-1][1]&&(n=n.slice(0,i-1)),p=lt(d,M,n,l,c),p=v(M,p,w*l),M=p}const b=y.length-f.length;for(let t=0;t<b;t++)f.push(h[g])}const w=new(T(y.reduce((t,n)=>Math.max(t,n),0)))(y),M=L(t.length);return{aPosition:new(U(Math.max(512,m)))(d),indices:w,aPickingId:new M(f)}}function Rr(t,n,i){const e=t[3*n],r=t[3*n+1];return e<0||e>i||r<0||r>i}function $r(t,n,i){const e=Vr(t,i,n),r=[e.aPosition.buffer,e.indices.buffer,e.aPickingId.buffer],s=e.indices;return delete e.indices,{data:{data:e,indices:s},buffers:r}}class Wr{constructor(t,n,i,e,r){this.id=t,this.options=n,this.upload=i,this.ht(n.style),this.requests={},this.ut=0,this.lt=e,this.loadings=r}updateStyle(t,n){this.options.style=t,this.ht(t),this.ut++,n()}updateOptions(t,n){this.options=A(this.options,t),n()}loadTile(t,n){const i=this.loadings,e=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:i,y:e,z:s}=t.tileInfo;if(s!==r.z||i!==r.x||e!==r.y)return void n()}if(this.lt.has(e)){const{features:r,layers:s}=this.lt.get(e),o=i[e];if(delete i[e],!r||!r.length)return this.ct(o),void n();if(o)for(let n=0;n<o.length;n++)this.ft.call(o[n].ref,t,o[n].callback,e,s,r);this.ft(t,n,e,s,r)}else i[e]?i[e].push({callback:n,ref:this}):(i[e]=[{callback:n,ref:this}],this.requests[e]=this.getTileFeatures(t.tileInfo,(n,r,s,o)=>{const a=i[e];if(delete i[e],this.checkIfCanceled(e))return delete this.requests[e],void this.ct(a,null,{canceled:!0});if(delete this.requests[e],this.options.debug&&r)for(let n=0;n<r.length;n++)r[n]._debug_info={index:n,tileId:t.tileInfo.id};if(n)return n.loading||this.lt.add(e,{features:[],layers:[]}),void this.ct(a,n);if(!r||!r.length)return this.lt.add(e,{features:[],layers:[]}),void this.ct(a);if(this.lt.add(e,{features:r,layers:s}),a)for(let n=0;n<a.length;n++)this.ft.call(a[n].ref,t,a[n].callback,e,s,r,o)}))}ft(t,n,i,e,r,s){this.dt(e,r,t).then(t=>{t.canceled?n(null,{canceled:!0}):(t.data.style=this.ut,s&&A(t.data,s),n(null,t.data,t.buffers))}).catch(t=>{n(t)})}abortTile(t,n){delete this.requests[t],this.yt(t),n()}yt(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}ct(t,n,i){if(t)for(let e=0;e<t.length;e++)t[e].callback(n,i)}checkIfCanceled(t){return!this.requests[t]}fetchIconGlyphs(t,n,i){this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,i)}dt(t,n,{glScale:i,zScale:e,tileInfo:r}){if(!n.length)return Promise.resolve({data:null,buffers:[]});const s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.vt(t)),this.featurePlugins&&I(o,this.featurePlugins);const a=n[0].extent,h=r.z,u={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},l=[],c=[],f=[],d=this.options,y=[],v={},p=[Promise.resolve(this.ut)];let m=0,g=-1;for(let t=0;t<o.length;t++){g++;const r=o[t];r.type!==m&&(g=0,m=r.type);const d=0===r.type?l:c;if(r.symbol&&!1===r.symbol.visible){d[g]=null;continue}const{tileFeatures:w,tileFeaIndexes:M}=this.pt(r.type,r.filter,n,v,t);if(!w.length){d[g]=null;continue}const b=T(M[M.length-1]);d[g]={styledFeatures:new b(M)},f.push({idx:t,typeIdx:g}),y.push(d[g].styledFeatures.buffer);let x=this.gt(w,r,{extent:a,tilePoint:u,glScale:i,zScale:e,zoom:h});s&&(x=x.then(t=>{if(!t)return null;if(t.data)t.data.layer=w[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=w[0].layer);return t})),p.push(x)}return Promise.all(p).then(([i,...e])=>{function r(t,n){if(void 0===t.data.ref&&(t.data.type=o[f[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[f[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)y.push(t.buffers[n])}if(i!==this.ut)return{canceled:!0};for(let t=0;t<e.length;t++){if(!e[t])continue;const n=e[t],i=0===o[f[t].idx].type?l:c;if(Array.isArray(n)){const e=[];for(let i=0;i<n.length;i++)n[i]&&(r(n[i],t),(void 0===n[i].data.ref||n[n[i].data.ref])&&e.push(n[i].data));e.length&&(i[f[t].typeIdx].data=e)}else r(n,t),i[f[t].typeIdx].data=n.data}const s={},h=t;if(d.features||d.schema){let t;for(let i=0,e=n.length;i<e;i++)if(t=n[i],h[t.layer].properties||(h[t.layer].properties=Gr(t.properties)),d.features&&t&&v[i])if("id"===d.features)s[i]=t.id;else{const n=A({},t);d.pickingGeometry||delete n.geometry,delete n.extent,delete n.properties.$layer,delete n.properties.$type,delete n.__index,s[i]=n}}return{data:{schema:h,data:l,featureData:c,extent:a,features:s},buffers:y}})}gt(t,n,i){const e=n.renderPlugin.dataConfig,r=n.symbol,s=this.options.tileSize[0],{extent:o,glScale:a,zScale:h,zoom:u,tilePoint:l}=i,c=o/s,f=e.type,d=this.options.debugTile&&this.options.debugTile.index;if("3d-extrusion"===f){const n=Jr(r);return n&&(e.uv=1,2===n&&(e.tangent=1)),Promise.all([Promise.resolve(Nr(t,e,o,l,a,h,this.options.tileSize[1]/o,r,u,d))])}if("3d-wireframe"===f)return Promise.all([Promise.resolve($r(t,e,o))]);if("point"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d}),i=mr.splitPointSymbol(r);return mr.needMerge(i[0])&&(t=mr.mergeLineFeatures(t,i[0],u)),Promise.all(i.map(i=>new mr(t,i,n).load(c)))}if("native-point"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,_r,o/s)}if("line"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),tileRatio:c,zoom:u,debugIndex:d});return Xr(t,r,n,Mr)}if("native-line"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,Pr)}if("fill"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d});return Xr(t,r,n,zr)}if("line-extrusion"===f){delete r.lineGradientProperty,r.lineJoin="miter",r.lineCap="butt";const n=Jr(r);n&&(e.uv=1,2===n&&(e.tangent=1));const i=A({},e,{EXTENT:o,tileSize:s,zScale:h,glScale:a,zoom:u,debugIndex:d});if(n){const n=[];if(!1!==e.top){const e=A({},i);e.side=!1,n.push(new Ar(t,r,e))}return!1!==e.side&&(i.side=!0,i.top=!1,n.push(new Ar(t,r,i))),Promise.all(n.map(t=>t.load()))}return Promise.all([new Ar(t,r,i).load()])}return Promise.resolve([])}pt(t,n,i,e){const r="__fea_idx".trim(),s=[],o=[],a=i.length;for(let h=0;h<a;h++)if((1===t||void 0===i[h].id||!this.styledFeatures[i[h].id])&&((!n.def||"default"===n.def)&&!e[h]||!0===n.def||Array.isArray(n.def)&&n(i[h]))){e[h]=1;const n=A({},i[h]);if(n[r]=h,o.push(n),s.push(h),1===t)break}return{tileFeatures:o,tileFeaIndexes:s}}ht(t){const{style:n,featureStyle:i}=t,e={};i.forEach(t=>{Array.isArray(t.id)?(t.id.forEach(t=>{e[t]=1}),t.filter=["in","$id",...t.id]):(e[t.id]=1,t.filter=["==","$id",t.id])});const r=z(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const s=[],o=z(i);for(let t=0;t<i.length;t++)o[t].type=1,o[t].filter.def=i[t].filter?i[t].filter.value||i[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=r,this.featurePlugins=s,this.styledFeatures=e}vt(t){let n=this.wt;this.wt||(n=this.wt={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const s in t){const o=s;if(!n[s]){const r=[];for(let n=0;n<t[s].types.length;n++){const a=t[s].types[n],h=["all",["==","$layer",o],["==","$type",e[a]]],u={filter:i(h),renderPlugin:qr(a),symbol:Br(a)};u.filter.def=h,u.type=0,r.push(u)}n[o]=r}r.push(...n[o])}return r}}function qr(t){switch(t){case 1:return{type:"native-point",dataConfig:{type:"native-point",only2D:!0}};case 2:return{type:"native-line",dataConfig:{type:"native-line",only2D:!0}};case 3:return{type:"fill",dataConfig:{type:"fill",only2D:!0}}}return null}function Br(t){switch(t){case 1:return{markerFill:"#f00",markerSize:10};case 2:return{lineColor:"#fff"};case 3:return{polygonFill:"#00f",polygonOpacity:.4}}return null}function Gr(t){if(Array.isArray(t)||!_(t))return{};const n={};for(const i in t){const e=t[i];k(e)?n[i]="string":P(e)?n[i]="number":!0===e||!1===e?n[i]="boolean":Array.isArray(e)?n[i]="array":n[i]="object"}return n}function Jr(t){if(!t)return 0;let n=0;for(const i in t){if(("normalTexture"===i||"bumpTexture"===i)&&t[i])return 2;if(i.indexOf("Texture")>0&&t[i])n=1;else if(_(t[i])){const e=Jr(t[i]);if(2===e)return e;1===e&&(n=1)}}return n}function Xr(t,n,i,e,r){const s={},o=Array.isArray(n)?n:[n];let a=-1;for(let t=0;t<o.length;t++)s[t]=Zr(o[t]),!s[t]&&o[t]&&-1===a&&(a=t);const h=[];for(let n=0;n<o.length;n++)o[n]&&(o[n].index={index:n},s[n]||n===a?h.push(new e(t,o[n],i).load(r)):h.push({data:{ref:a,symbolIndex:{index:n}}}));return Promise.all(h)}function Zr(t){if(!t)return 0;for(const n in t)if(D(t[n]))return 1;return 0}function Yr(t,n){Kr(t.geometry,n)}function Kr(t,n){if(t)switch(t.type){case"Point":Qr(t.coordinates,n);break;case"MultiPoint":case"LineString":ts(t.coordinates,n);break;case"MultiLineString":case"Polygon":ns(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let i=0;i<t.length;i++)ns(t[i],n)}(t.coordinates,n);break;case"GeometryCollection":for(let i=0;i<t.geometries.length;i++)Kr(t.geometries[i],n)}}function Qr(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function ts(t,n){for(let i=0;i<t.length;i++)Qr(t[i],n)}function ns(t,n){for(let i=0;i<t.length;i++)ts(t[i],n)}class is extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),(n=n||{}).extent||(n.extent=8192),this.zoomOffset=0,n.tileSize&&(this.zoomOffset=-function(t){if(Math.log2)return Math.log2(t);const n=Math.log(t)*Math.LOG2E,i=Math.round(n);return Math.abs(i-n)<1e-14?i:n}(n.tileSize[0]/256)),this.setData(n.data,s)}setData(t,n){if(delete this.index,!t)return void n();const i={maxZoom:24,tolerance:this.options.extent/this.options.tileSize[0]*1,extent:this.options.extent,buffer:this.options.tileBuffer||64,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5};if(k(t)&&"{"!=t.substring(0,1)||t.url)C.getJSON(t.url?t.url:t,t.url?t:{},(t,e)=>{if(t&&n(t),!e)return void n(null,{extent:null,idMap:{}});const r=e,{first1000:s,idMap:o}=this.Mt(r);this.bt(s,o,r,i,n)});else{"string"==typeof t&&(t=JSON.parse(t));const e=Array.isArray(t)?t:t.features;let r=e;e&&e.length>1e3&&(r=e.slice(0,1e3)),this.bt(r,null,t,i,n)}}bt(t,n,i,e,r){try{const s=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Yr(t.features[i],n);break;case"Feature":Yr(t,n);break;default:Kr(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ht(t,n)}(i,this.options.geojsonvt||e),r(null,{extent:s,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Mt(t){const n=[],i={};let e=0;function r(t){t&&("Feature"!==t.type||t.geometry)&&(void 0!==t.id&&null!==t.id||(t.id=e++),i[t.id]=A({},t),t.geometry?(i[t.id].geometry=A({},t.geometry),i[t.id].geometry.coordinates=null):t.coordinates&&(i[t.id].coordinates=null),n.length<1e3&&n.push(t))}return Array.isArray(t)?t.forEach(t=>{r(t)}):t.features&&t.features.forEach(t=>{r(t)}),{first1000:n,idMap:i}}getTileFeatures(t,n){const i=[];if(!this.index)return setTimeout((function(){n({loading:!0})}),1),1;const e=this.index.getTile(t.z+this.zoomOffset,t.x,t.y);if(!e||0===e.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const r=[];for(let t=0,n=e.features.length;t<n;t++){const n=e.features[t];let s=n.layer;void 0===s&&(s="0"),r[s]={types:{}};r[s].types[n.type]=1,n.tags=n.tags||{},i.push({type:n.type,layer:s,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in r)r[t].types=Object.keys(r[t].types).map(t=>+t);return setTimeout((function(){n(null,i,r)}),1),1}onRemove(){delete this.index}}var es={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,i,e,r){var s,o,a=8*r-e-1,h=(1<<a)-1,u=h>>1,l=-7,c=i?r-1:0,f=i?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+t[n+c],c+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=e;l>0;o=256*o+t[n+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,e),s-=u}return(d?-1:1)*o*Math.pow(2,s-e)},write:function(t,n,i,e,r,s){var o,a,h,u=8*s-r-1,l=(1<<u)-1,c=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=e?0:s-1,y=e?1:-1,v=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(a=isNaN(n)?1:0,o=l):(o=Math.floor(Math.log(n)/Math.LN2),n*(h=Math.pow(2,-o))<1&&(o--,h*=2),(n+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(n*h-1)*Math.pow(2,r),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+d]=255&a,d+=y,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;t[i+d]=255&o,d+=y,o/=256,u-=8);t[i+d-y]|=128*v}},rs=os,ss=es;function os(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}os.Varint=0,os.Fixed64=1,os.Bytes=2,os.Fixed32=5;var as="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hs(t){return t.type===os.Bytes?t.readVarint()+t.pos:t.pos+1}function us(t,n,i){return i?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function ls(t,n,i){var e=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));i.realloc(e);for(var r=i.pos-1;r>=t;r--)i.buf[r+e]=i.buf[r]}function cs(t,n){for(var i=0;i<t.length;i++)n.writeVarint(t[i])}function fs(t,n){for(var i=0;i<t.length;i++)n.writeSVarint(t[i])}function ds(t,n){for(var i=0;i<t.length;i++)n.writeFloat(t[i])}function ys(t,n){for(var i=0;i<t.length;i++)n.writeDouble(t[i])}function vs(t,n){for(var i=0;i<t.length;i++)n.writeBoolean(t[i])}function ps(t,n){for(var i=0;i<t.length;i++)n.writeFixed32(t[i])}function ms(t,n){for(var i=0;i<t.length;i++)n.writeSFixed32(t[i])}function gs(t,n){for(var i=0;i<t.length;i++)n.writeFixed64(t[i])}function ws(t,n){for(var i=0;i<t.length;i++)n.writeSFixed64(t[i])}function Ms(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function bs(t,n,i){t[i]=n,t[i+1]=n>>>8,t[i+2]=n>>>16,t[i+3]=n>>>24}function xs(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}os.prototype={destroy:function(){this.buf=null},readFields:function(t,n,i){for(i=i||this.length;this.pos<i;){var e=this.readVarint(),r=e>>3,s=this.pos;this.type=7&e,t(r,n,this),this.pos===s&&this.skip(e)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ms(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xs(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*Ms(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*xs(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ss.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ss.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,i,e=this.buf;return n=127&(i=e[this.pos++]),i<128?n:(n|=(127&(i=e[this.pos++]))<<7,i<128?n:(n|=(127&(i=e[this.pos++]))<<14,i<128?n:(n|=(127&(i=e[this.pos++]))<<21,i<128?n:function(t,n,i){var e,r,s=i.buf;if(r=s[i.pos++],e=(112&r)>>4,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<3,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<10,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<17,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<24,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(1&r)<<31,r<128)return us(t,e,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(i=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&as?function(t,n,i){return as.decode(t.subarray(n,i))}(this.buf,n,t):function(t,n,i){var e="",r=n;for(;r<i;){var s,o,a,h=t[r],u=null,l=h>239?4:h>223?3:h>191?2:1;if(r+l>i)break;1===l?h<128&&(u=h):2===l?128==(192&(s=t[r+1]))&&(u=(31&h)<<6|63&s)<=127&&(u=null):3===l?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((u=(15&h)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,e+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),e+=String.fromCharCode(u),r+=l}return e}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==os.Bytes)return t.push(this.readVarint(n));var i=hs(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==os.Bytes)return t.push(this.readSVarint());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==os.Bytes)return t.push(this.readBoolean());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==os.Bytes)return t.push(this.readFloat());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==os.Bytes)return t.push(this.readDouble());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===os.Varint)for(;this.buf[this.pos++]>127;);else if(n===os.Bytes)this.pos=this.readVarint()+this.pos;else if(n===os.Fixed32)this.pos+=4;else{if(n!==os.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var i=new Uint8Array(n);i.set(this.buf),this.buf=i,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var i,e;t>=0?(i=t%4294967296|0,e=t/4294967296|0):(e=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,e=e+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn\'t fit into 10 bytes");n.realloc(10),function(t,n,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,n),function(t,n){var i=(7&t)<<4;if(n.buf[n.pos++]|=i|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(e,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,i){for(var e,r,s=0;s<n.length;s++){if((e=n.charCodeAt(s))>55295&&e<57344){if(!r){e>56319||s+1===n.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=e;continue}if(e<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);e<128?t[i++]=e:(e<2048?t[i++]=e>>6|192:(e<65536?t[i++]=e>>12|224:(t[i++]=e>>18|240,t[i++]=e>>12&63|128),t[i++]=e>>6&63|128),t[i++]=63&e|128)}return i}(this.buf,t,this.pos);var i=this.pos-n;i>=128&&ls(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),ss.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ss.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var i=0;i<n;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,n){this.pos++;var i=this.pos;t(n,this);var e=this.pos-i;e>=128&&ls(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeMessage:function(t,n,i){this.writeTag(t,os.Bytes),this.writeRawMessage(n,i)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,cs,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,fs,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,vs,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,ds,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,ys,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,ps,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,ms,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,gs,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,ws,n)},writeBytesField:function(t,n){this.writeTag(t,os.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,os.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,os.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,os.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Fs=Ht,As=ks;function ks(t,n,i,e,r){this.properties={},this.extent=i,this.type=0,this.xt=t,this.Ft=-1,this.At=e,this.kt=r,t.readFields(Ps,this,n)}function Ps(t,n,i){1==t?n.id=i.readVarint():2==t?function(t,n){var i=t.readVarint()+t.pos;for(;t.pos<i;){var e=n.At[t.readVarint()],r=n.kt[t.readVarint()];n.properties[e]=r}}(i,n):3==t?n.type=i.readVarint():4==t&&(n.Ft=i.pos)}function Ss(t){for(var n,i,e=0,r=0,s=t.length,o=s-1;r<s;o=r++)n=t[r],e+=((i=t[o]).x-n.x)*(n.y+i.y);return e}ks.types=["Unknown","Point","LineString","Polygon"],ks.prototype.loadGeometry=function(){var t=this.xt;t.pos=this.Ft;for(var n,i=t.readVarint()+t.pos,e=1,r=0,s=0,o=0,a=[];t.pos<i;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)s+=t.readSVarint(),o+=t.readSVarint(),1===e&&(n&&a.push(n),n=[]),n.push(new Fs(s,o));else{if(7!==e)throw new Error("unknown command "+e);n&&n.push(n[0].clone())}}return n&&a.push(n),a},ks.prototype.bbox=function(){var t=this.xt;t.pos=this.Ft;for(var n=t.readVarint()+t.pos,i=1,e=0,r=0,s=0,o=1/0,a=-1/0,h=1/0,u=-1/0;t.pos<n;){if(e<=0){var l=t.readVarint();i=7&l,e=l>>3}if(e--,1===i||2===i)(r+=t.readSVarint())<o&&(o=r),r>a&&(a=r),(s+=t.readSVarint())<h&&(h=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,h,a,u]},ks.prototype.toGeoJSON=function(t,n,i){var e,r,s=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*n,h=this.loadGeometry(),u=ks.types[this.type];function l(t){for(var n=0;n<t.length;n++){var i=t[n],e=180-360*(i.y+a)/s;t[n]=[360*(i.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(e=0;e<h.length;e++)c[e]=h[e][0];l(h=c);break;case 2:for(e=0;e<h.length;e++)l(h[e]);break;case 3:for(h=function(t){var n=t.length;if(n<=1)return[t];for(var i,e,r=[],s=0;s<n;s++){var o=Ss(t[s]);0!==o&&(void 0===e&&(e=o<0),e===o<0?(i&&r.push(i),i=[t[s]]):i.push(t[s]))}i&&r.push(i);return r}(h),e=0;e<h.length;e++)for(r=0;r<h[e].length;r++)l(h[e][r])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f};var _s=As,Os=Is;function Is(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.xt=t,this.At=[],this.kt=[],this.Pt=[],t.readFields(Ts,this,n),this.length=this.Pt.length}function Ts(t,n,i){15===t?n.version=i.readVarint():1===t?n.name=i.readString():5===t?n.extent=i.readVarint():2===t?n.Pt.push(i.pos):3===t?n.At.push(i.readString()):4===t&&n.kt.push(function(t){var n=null,i=t.readVarint()+t.pos;for(;t.pos<i;){var e=t.readVarint()>>3;n=1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return n}(i))}Is.prototype.feature=function(t){if(t<0||t>=this.Pt.length)throw new Error("feature index out of bounds");this.xt.pos=this.Pt[t];var n=this.xt.readVarint()+this.xt.pos;return new _s(this.xt,n,this.extent,this.At,this.kt)};var Ls=Os;function Us(t,n,i){if(3===t){var e=new Ls(i,i.readVarint()+i.pos);e.length&&(n[e.name]=e)}}var zs=function(t,n){this.layers=t.readFields(Us,{},n)};class Ds extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),n=n||{},s()}getTileFeatures(t,n){const i=t.url;return C.getArrayBuffer(i,(t,i)=>{if(t)return void n(t);const e=new zs(new rs(i.data)),r=[];if(!e.layers)return void n(null,r,[]);const s={};let o;for(const n in e.layers)if(a=e.layers,h=n,Object.prototype.hasOwnProperty.call(a,h)){s[n]={types:{}};const i=s[n].types;for(let s=0,a=e.layers[n].length;s<a;s++)try{o=e.layers[n].feature(s),i[o.type]=1,r.push({type:o.type,layer:n,geometry:o.loadGeometry(),properties:o.properties,extent:o.extent})}catch(t){console.warn("error when load vt geometry:",t)}}var a,h;for(const t in s)s[t].types=Object.keys(s[t].types).map(t=>+t);n(null,r,s,{byteLength:i.data.byteLength})})}abortTile(t,n){const i=this.requests[t];delete this.requests[t],i&&i.abort&&i.abort(),this.yt(t),n()}onRemove(){for(const t in this.requests)this.requests[t].abort();this.requests={}}}let Es=0;const Cs=new class{constructor(t){this.max=t,this.reset()}reset(){return this.data={},this.order=[],this}clear(){this.reset()}add(t,n){return this.has(t)?(this.order.splice(this.order.indexOf(t),1),this.data[t]=n,this.order.push(t)):(this.data[t]=n,this.order.push(t),this.order.length>this.max&&this.getAndRemove(this.order[0])),this}has(t){return t in this.data}keys(){return this.order}getAndRemove(t){if(!this.has(t))return null;const n=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),n}get(t){return this.has(t)?this.data[t]:null}remove(t){return this.has(t)?(delete this.data[t],this.order.splice(this.order.indexOf(t),1),this):this}setMaxSize(t){for(this.max=t;this.order.length>this.max;)this.getAndRemove(this.order[0]);return this}}(128),js={};class Ns{constructor(t){this.St={},this._t={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:i,params:e},r){if(this.Ot(n,i))return;const s=this.It(n,i),o=e.type,a=e.options,h=this.send.bind(this,t);this.St[s]="GeoJSONVectorTileLayer"===o?new is(i,a,h,Cs,js,r):new Ds(i,a,h,Cs,js,r)}removeLayer({mapId:t,layerId:n},i){const e=this.Ot(t,n),r=this.It(t,n);delete this.St[r],e&&(e.onRemove(i),this.Tt())}loadTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.loadTile(i,e)}abortTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.abortTile&&r.abortTile(i.url,e)}removeTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.removeTile(i,e)}updateStyle({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateStyle(i,e),this.Tt())}updateOptions({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateOptions(i,e),this.Tt())}setData({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.setData(i.data,e),this.Tt())}receive(t){const n=t.callback,i=this._t[n];delete this._t[n],i&&t.error?i(new Error(t.error)):i&&i(null,t.data)}send(t,n,i,e,r){const s=r?`${t}-${Es++}`:null;r&&(this._t[s]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:i,callback:String(s)},e||[])}It(t,n){return`${t}-${n}`}Ot(t,n){const i=this.It(t,n);return this.St[i]}Tt(){const t=Object.keys(js);for(let n=0;n<t.length;n++)delete js[t[n]];Cs.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const i=t.data;if(this.dispatcher||(this.dispatcher=new Ns(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const e=i.command;this.dispatcher[e]({actorId:t.actorId,mapId:i.mapId,layerId:i.layerId,params:i.params},(t,i,r)=>{t&&console.error(e,t),n(t,i,r)})}},Object.defineProperty(t,"Lt",{value:!0})}';
30
+ const H = 'function(t){\n/*!\n Feature Filter by\n\n (c) mapbox 2016 and maptalks 2018\n www.mapbox.com | www.maptalks.org\n License: MIT, header required.\n */\nconst n=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function i(t){return new Function("f","var p = (f && f.properties || {}); return "+e(t))}function e(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return`(${"=="===n?s(t[1],t[2],"===",!1):"!="===n?s(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?s(t[1],t[2],n,!0):"any"===n?o(t.slice(1),"||"):"all"===n?o(t.slice(1),"&&"):"none"===n?u(o(t.slice(1),"||")):"in"===n?a(t[1],t.slice(2)):"!in"===n?u(a(t[1],t.slice(2))):"has"===n?h(t[1]):"!has"===n?u(h(t[1])):"true"})`}function r(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function s(t,i,e,s){const o=r(t),a="$type"===t?n.indexOf(i):JSON.stringify(i);return(s?`typeof ${o}=== typeof ${a}&&`:"")+o+e+a}function o(t,n){return t.map(e).join(n)}function a(t,i){"$type"===t&&(i=i.map(t=>n.indexOf(t)));const e=JSON.stringify(i.sort(l)),s=r(t);return i.length<=200?`${e}.indexOf(${s}) !== -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; }(${s}, ${e},0,${i.length-1})`}function h(t){return"$id"===t?\'"id" in f\':JSON.stringify(t)+" in p"}function u(t){return`!(${t})`}function l(t,n){return t<n?-1:t>n?1:0}function c(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function f(t,n){for(let i=0;i<t.stops.length;i++)if(n===t.stops[i][0])return t.stops[i][1];return t.default}function d(t,n){for(var i=0;i<t.stops.length&&!(n<t.stops[i][0]);i++);return t.stops[Math.max(i-1,0)][1]}function y(t,n){for(var i=void 0!==t.base?t.base:1,e=0;!(e>=t.stops.length||n<=t.stops[e][0]);)e++;return 0===e?t.stops[e][1]:e===t.stops.length?t.stops[e-1][1]:function t(n,i,e,r,s,o){return"function"==typeof s?function(){var a=s.apply(void 0,arguments),h=o.apply(void 0,arguments);return t(n,i,e,r,a,h)}:s.length?function(t,n,i,e,r,s){var o=[];for(let a=0;a<r.length;a++)o[a]=p(t,n,i,e,r[a],s[a]);return o}(n,i,e,r,s,o):p(n,i,e,r,s,o)}(n,i,t.stops[e-1][0],t.stops[e][0],t.stops[e-1][1],t.stops[e][1])}function v(t,n){return function(t,n,i){return void 0!==t?t:void 0!==n?n:void 0!==i?i:null}(n,t.default)}function p(t,n,i,e,r,s){var o,a=e-i,h=t-i;return r*(1-(o=1===n?h/a:(Math.pow(n,h)-1)/(Math.pow(n,a)-1)))+s*o}function m(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function g(t){return b(t,"exponential")}function w(t){return b(t,"interval")}function M(t,n){if(!t)return null;var i=!1;if(Array.isArray(t)){var e,r=[];for(let s=0;s<t.length;s++)(e=M(t[s],n))?(r.push(e),i=!0):r.push(t[s]);return i?r:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const h=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=g(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,e=a.length;n<e;n++)m(t[s=a[n]])?(i=!0,o["_"+s]=t[s],h(s)):o[s]=t[s];return i?o:t}function b(t,n){if(!m(t))return function(){return t};let i=!0,e=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(m(r[t][1])){const s=b(r[t][1],n);i=i&&s.isZoomConstant,e=e&&s.isFeatureConstant,r[t]=[r[t][0],s]}const s=function t(n,i){var e,r,s;if(m(n)){var o,a=n.stops&&"object"==typeof n.stops[0][0],h=a||void 0!==n.property,u=a||!h,l=n.type||i||"exponential";if("exponential"===l)o=y;else if("interval"===l)o=d;else if("categorical"===l)o=f;else{if("identity"!==l)throw new Error(\'Unknown function type "\'+l+\'"\');o=v}if(a){var c={},p=[];for(let t=0;t<n.stops.length;t++){var g=n.stops[t];void 0===c[g[0].zoom]&&(c[g[0].zoom]={zoom:g[0].zoom,type:n.type,property:n.property,default:n.default,stops:[]}),c[g[0].zoom].stops.push([g[0].value,g[1]])}for(let n in c)p.push([c[n].zoom,t(c[n])]);e=function(t,i){const e=y({stops:p,base:n.base},t)(t,i);return"function"==typeof e?e(t,i):e},r=!1,s=!1}else u?(e=function(t){const i=o(n,t);return"function"==typeof i?i(t):i},r=!0,s=!1):(e=function(t,i){const e=o(n,i?i[n.property]:null);return"function"==typeof e?e(t,i):e},r=!1,s=!0)}else e=function(){return n},r=!0,s=!0;return e.isZoomConstant=s,e.isFeatureConstant=r,e}(t,n);return s.isZoomConstant=i&&s.isZoomConstant,s.isFeatureConstant=e&&s.isFeatureConstant,s}let x=0;const F="function"==typeof Object.assign;function A(t,...n){if(F)return Object.assign(t,...n),t;for(let i=0;i<n.length;i++){const e=n[i];for(const n in e)t[n]=e[n]}return t}function k(t){return!O(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function P(t){return"number"==typeof t&&!isNaN(t)}function S(t){return!O(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function _(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function O(t){return null==t}function I(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];if(i)for(let n=0,e=i.length;n<e;n++)t.push(i[n])}return t.length}function T(t){return t<65536?Uint16Array:Uint32Array}function L(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function U(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function z(t){return function t(n){if(!Array.isArray(n))return t([n]);const e=[];for(let t=0;t<n.length;t++){let r;r=!0===n[t].filter?function(){return!0}:i(n[t].filter),e.push(c({},n[t],{filter:r}))}return e}(t=t.map(t=>{const n=A({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n}))}function D(t){return m(t)&&t.property}const E="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const i="_maptalks_jsonp_"+x++;t.match(/\\?/)?t+="&callback="+i:t+="?callback="+i;let e=document.createElement("script");return e.type="text/javascript",e.src=t,window[i]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(e),e=null,delete window[i]},document.getElementsByTagName("head")[0].appendChild(e),this},get:function(t,n,i){if(S(n)){const t=i;i=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const e="POST"===n.method;if(E){const r=new AbortController,s={signal:r.signal,method:n.method||"GET",referrerPolicy:"origin"};return e&&(O(n.body)||(s.body=JSON.stringify(n.body))),O(n.headers)||(s.headers=n.headers),O(n.credentials)||(s.credentials=n.credentials),fetch(t,s).then(t=>{const e=this.t(t,n.returnJSON,n.responseType);e.message?i(e):e.then(e=>{"arraybuffer"===n.responseType?i(null,{data:e,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}):i(null,e)}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))})}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))}),r}{const r=C.s(i);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(e?n.body:null),r}},t:(t,n,i)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===i?t.arrayBuffer():n?t.json():t.text(),o:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`})}},s:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=C.o(n,t),n},getArrayBuffer(t,n,i){if(S(n)){const t=i;i=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,i)}};function j(t,n,i,e,r,s){var o=r-i,a=s-e;if(0!==o||0!==a){var h=((t-i)*o+(n-e)*a)/(o*o+a*a);h>1?(i=r,e=s):h>0&&(i+=o*h,e+=a*h)}return(o=t-i)*o+(a=n-e)*a}function N(t,n,i,e){var r={id:void 0===t?null:t,type:n,geometry:i,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var n=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)H(t,n);else if("Polygon"===i||"MultiLineString"===i)for(var e=0;e<n.length;e++)H(t,n[e]);else if("MultiPolygon"===i)for(e=0;e<n.length;e++)for(var r=0;r<n[e].length;r++)H(t,n[e][r])}(r),r}function H(t,n){for(var i=0;i<n.length;i+=3)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function V(t,n,i,e){if(n.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],h=n.id;if(i.promoteId?h=n.properties[i.promoteId]:i.generateId&&(h=e||0),"Point"===s)R(r,a);else if("MultiPoint"===s)for(var u=0;u<r.length;u++)R(r[u],a);else if("LineString"===s)$(r,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<r.length;u++)a=[],$(r[u],a,o,!1),t.push(N(h,"LineString",a,n.properties));return}W(r,a,o,!1)}else if("Polygon"===s)W(r,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)V(t,{id:h,geometry:n.geometry.geometries[u],properties:n.properties},i,e);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var l=[];W(r[u],l,o,!0),a.push(l)}}t.push(N(h,s,a,n.properties))}}function R(t,n){n.push(q(t[0])),n.push(B(t[1])),n.push(0)}function $(t,n,i,e){for(var r,s,o=0,a=0;a<t.length;a++){var h=q(t[a][0]),u=B(t[a][1]);n.push(h),n.push(u),n.push(0),a>0&&(o+=e?(r*u-h*s)/2:Math.sqrt(Math.pow(h-r,2)+Math.pow(u-s,2))),r=h,s=u}var l=n.length-3;n[2]=1,function t(n,i,e,r){for(var s,o=r,a=e-i>>1,h=e-i,u=n[i],l=n[i+1],c=n[e],f=n[e+1],d=i+3;d<e;d+=3){var y=j(n[d],n[d+1],u,l,c,f);if(y>o)s=d,o=y;else if(y===o){var v=Math.abs(d-a);v<h&&(s=d,h=v)}}o>r&&(s-i>3&&t(n,i,s,r),n[s+2]=o,e-s>3&&t(n,s,e,r))}(n,0,l,i),n[l+2]=1,n.size=Math.abs(o),n.start=0,n.end=n.size}function W(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];$(t[r],s,i,e),n.push(s)}}function q(t){return t/360+.5}function B(t){var n=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return i<0?0:i>1?1:i}function G(t,n,i,e,r,s,o,a){if(e/=n,s>=(i/=n)&&o<e)return t;if(o<i||s>=e)return null;for(var h=[],u=0;u<t.length;u++){var l=t[u],c=l.geometry,f=l.type,d=0===r?l.minX:l.minY,y=0===r?l.maxX:l.maxY;if(d>=i&&y<e)h.push(l);else if(!(y<i||d>=e)){var v=[];if("Point"===f||"MultiPoint"===f)J(c,v,i,e,r);else if("LineString"===f)X(c,v,i,e,r,!1,a.lineMetrics);else if("MultiLineString"===f)Y(c,v,i,e,r,!1);else if("Polygon"===f)Y(c,v,i,e,r,!0);else if("MultiPolygon"===f)for(var p=0;p<c.length;p++){var m=[];Y(c[p],m,i,e,r,!0),m.length&&v.push(m)}if(v.length){if(a.lineMetrics&&"LineString"===f){for(p=0;p<v.length;p++)h.push(N(l.id,f,v[p],l.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===v.length?(f="LineString",v=v[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===v.length?"Point":"MultiPoint"),h.push(N(l.id,f,v,l.tags))}}}return h.length?h:null}function J(t,n,i,e,r){for(var s=0;s<t.length;s+=3){var o=t[s+r];o>=i&&o<=e&&(n.push(t[s]),n.push(t[s+1]),n.push(t[s+2]))}}function X(t,n,i,e,r,s,o){for(var a,h,u=Z(t),l=0===r?Q:tt,c=t.start,f=0;f<t.length-3;f+=3){var d=t[f],y=t[f+1],v=t[f+2],p=t[f+3],m=t[f+4],g=0===r?d:y,w=0===r?p:m,M=!1;o&&(a=Math.sqrt(Math.pow(d-p,2)+Math.pow(y-m,2))),g<i?w>i&&(h=l(u,d,y,p,m,i),o&&(u.start=c+a*h)):g>e?w<e&&(h=l(u,d,y,p,m,e),o&&(u.start=c+a*h)):K(u,d,y,v),w<i&&g>=i&&(h=l(u,d,y,p,m,i),M=!0),w>e&&g<=e&&(h=l(u,d,y,p,m,e),M=!0),!s&&M&&(o&&(u.end=c+a*h),n.push(u),u=Z(t)),o&&(c+=a)}var b=t.length-3;d=t[b],y=t[b+1],v=t[b+2],(g=0===r?d:y)>=i&&g<=e&&K(u,d,y,v),b=u.length-3,s&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&n.push(u)}function Z(t){var n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,i,e,r,s){for(var o=0;o<t.length;o++)X(t[o],n,i,e,r,s,!1)}function K(t,n,i,e){t.push(n),t.push(i),t.push(e)}function Q(t,n,i,e,r,s){var o=(s-n)/(e-n);return t.push(s),t.push(i+(r-i)*o),t.push(1),o}function tt(t,n,i,e,r,s){var o=(s-i)/(r-i);return t.push(n+(e-n)*o),t.push(s),t.push(1),o}function nt(t,n){for(var i=[],e=0;e<t.length;e++){var r,s=t[e],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=it(s.geometry,n);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var a=0;a<s.geometry.length;a++)r.push(it(s.geometry[a],n))}else if("MultiPolygon"===o)for(r=[],a=0;a<s.geometry.length;a++){for(var h=[],u=0;u<s.geometry[a].length;u++)h.push(it(s.geometry[a][u],n));r.push(h)}i.push(N(s.id,o,r,s.tags))}return i}function it(t,n){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var e=0;e<t.length;e+=3)i.push(t[e]+n,t[e+1],t[e+2]);return i}function et(t,n){if(t.transformed)return t;var i,e,r,s=1<<t.z,o=t.x,a=t.y;for(i=0;i<t.features.length;i++){var h=t.features[i],u=h.geometry,l=h.type;if(h.geometry=[],1===l)for(e=0;e<u.length;e+=2)h.geometry.push(rt(u[e],u[e+1],n,s,o,a));else for(e=0;e<u.length;e++){var c=[];for(r=0;r<u[e].length;r+=2)c.push(rt(u[e][r],u[e][r+1],n,s,o,a));h.geometry.push(c)}}return t.transformed=!0,t}function rt(t,n,i,e,r,s){return[Math.round(i*(t*e-r)),Math.round(i*(n*e-s))]}function st(t,n,i,e,r){for(var s=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:e,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,ot(o,t[a],s,r);var h=t[a].minX,u=t[a].minY,l=t[a].maxX,c=t[a].maxY;h<o.minX&&(o.minX=h),u<o.minY&&(o.minY=u),l>o.maxX&&(o.maxX=l),c>o.maxY&&(o.maxY=c)}return o}function ot(t,n,i,e){var r=n.geometry,s=n.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<r.length;a+=3)o.push(r[a]),o.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)at(o,r,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<r.length;a++)at(o,r[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var h=0;h<r.length;h++){var u=r[h];for(a=0;a<u.length;a++)at(o,u[a],t,i,!0,0===a)}if(o.length){var l=n.tags||null;if("LineString"===s&&e.lineMetrics){for(var c in l={},n.tags)l[c]=n.tags[c];l.mapbox_clip_start=r.start/r.size,l.mapbox_clip_end=r.end/r.size}var f={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:l};null!==n.id&&(f.id=n.id),t.features.push(f)}}function at(t,n,i,e,r,s){var o=e*e;if(e>0&&n.size<(r?o:e))i.numPoints+=n.length/3;else{for(var a=[],h=0;h<n.length;h+=3)(0===e||n[h+2]>o)&&(i.numSimplified++,a.push(n[h]),a.push(n[h+1])),i.numPoints++;r&&function(t,n){for(var i=0,e=0,r=t.length,s=r-2;e<r;s=e,e+=2)i+=(t[e]-t[s])*(t[e+1]+t[s+1]);if(i>0===n)for(e=0,r=t.length;e<r/2;e+=2){var o=t[e],a=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=o,t[r-1-e]=a}}(a,s),t.push(a)}}function ht(t,n){var i=(n=this.options=function(t,n){for(var i in n)t[i]=n[i];return t}(Object.create(this.options),n)).debug;if(i&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");var e=function(t,n){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)V(i,t.features[e],n,e);else"Feature"===t.type?V(i,t,n):V(i,{geometry:t},n);return i}(t,n);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(e=function(t,n){var i=n.buffer/n.extent,e=t,r=G(t,1,-1-i,i,0,-1,2,n),s=G(t,1,1-i,2+i,0,-1,2,n);return(r||s)&&(e=G(t,1,-i,1+i,0,-1,2,n)||[],r&&(e=nt(r,1).concat(e)),s&&(e=e.concat(nt(s,-1)))),e}(e,n)).length&&this.splitTile(e,0,0,0),i&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ut(t,n,i){return 32*((1<<t)*i+n)+t}function lt(t,n,i,e,r,s){const o=i&&Array.isArray(i[0]);for(let a=0,h=i.length;a<h;a++){t[n]=Math.round((o?i[a][0]:i[a].x)*e),t[n+1]=Math.round((o?i[a][1]:i[a].y)*e);let u=r||0;Array.isArray(r)&&(u=r[a]),u=u?Math.round(e*u):0,t[n+2]=u,n+=3,s&&0!==a&&a!==h-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return n}function ct(t,n,i,e){const r=t[3*n],s=t[3*n+1],o=t[3*i],a=t[3*i+1];return r===o&&(r<0||r>e)||s===a&&(s<0||s>e)}C.getJSON=function(t,n,i){if(S(n)){const t=i;i=n,n=t}const e=function(t,n){const e="string"==typeof n?JSON.parse(n):n||null;i(t,e)};return n&&n.jsonp?C.jsonp(t,e):((n=n||{}).returnJSON=!0,C.get(t,n,e))},ht.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ht.prototype.splitTile=function(t,n,i,e,r,s,o){for(var a=[t,n,i,e],h=this.options,u=h.debug;a.length;){e=a.pop(),i=a.pop(),n=a.pop(),t=a.pop();var l=1<<n,c=ut(n,i,e),f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=st(t,n,i,e,h),this.tileCoords.push({z:n,x:i,y:e}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,i,e,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+n;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=t,r){if(n===h.maxZoom||n===r)continue;var y=1<<r-n;if(i!==Math.floor(s/y)||e!==Math.floor(o/y))continue}else if(n===h.indexMaxZoom||f.numPoints<=h.indexMaxPoints)continue;if(f.source=null,0!==t.length){u>1&&console.time("clipping");var v,p,m,g,w,M,b=.5*h.buffer/h.extent,x=.5-b,F=.5+b,A=1+b;v=p=m=g=null,w=G(t,l,i-b,i+F,0,f.minX,f.maxX,h),M=G(t,l,i+x,i+A,0,f.minX,f.maxX,h),t=null,w&&(v=G(w,l,e-b,e+F,1,f.minY,f.maxY,h),p=G(w,l,e+x,e+A,1,f.minY,f.maxY,h),w=null),M&&(m=G(M,l,e-b,e+F,1,f.minY,f.maxY,h),g=G(M,l,e+x,e+A,1,f.minY,f.maxY,h),M=null),u>1&&console.timeEnd("clipping"),a.push(v||[],n+1,2*i,2*e),a.push(p||[],n+1,2*i,2*e+1),a.push(m||[],n+1,2*i+1,2*e),a.push(g||[],n+1,2*i+1,2*e+1)}}},ht.prototype.getTile=function(t,n,i){var e=this.options,r=e.extent,s=e.debug;if(t<0||t>24)return null;var o=1<<t,a=ut(t,n=(n%o+o)%o,i);if(this.tiles[a])return et(this.tiles[a],r);s>1&&console.log("drilling down to z%d-%d-%d",t,n,i);for(var h,u=t,l=n,c=i;!h&&u>0;)u--,l=Math.floor(l/2),c=Math.floor(c/2),h=this.tiles[ut(u,l,c)];return h&&h.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,l,c),s>1&&console.time("drilling down"),this.splitTile(h.source,u,l,c,t,n,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?et(this.tiles[a],r):null):null};class ft{constructor(t,n){this.x=t,this.y=n}clone(){return new ft(this.x,this.y)}normalize(){const t=this.length();this.x/=t,this.y/=t}negate(){this.x=-this.x,this.y=-this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}diff(t){return new ft(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new ft(this.y,-this.x)}}function dt(t,n,i){const e=(n.x-t.x)*(i.y-t.y)-(n.y-t.y)*(i.x-t.x);return e>1e-5?1:e<-1e-5?2:0}function yt(t,n,i,e){const r=n.x*e.y-n.y*e.x,s=i.x-t.x,o=i.y-t.y,a=(s*e.y-o*e.x)/r;return new ft(t.x+a*n.x,t.y+a*n.y)}const vt=[];function pt(t,n,i){let e=0;const r=[];for(let s=n;s<i;s+=3)vt[e]?(vt[e].x=t[s],vt[e].y=t[s+1]):vt[e]=new ft(t[s],t[s+1]),r.push(vt[e]),e++;const s=function(t){let n;this.UpdateOmbb=function(t,i,e,r,s,o,a,h){const u=yt(t,i,s,o),l=yt(e,r,s,o),c=yt(a,h,t,i),f=yt(a,h,e,r),d=u.distance(l)*u.distance(c);d<this.BestObbArea&&(n=[u,c,f,l],this.BestObbArea=d)},this.BestObbArea=Number.MAX_VALUE;const i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();const e=new ft(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new ft(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let s,o,a,h;for(let n=0;n<t.length;n++){const i=t[n];i.x<e.x&&(e.x=i.x,s=n),i.x>r.x&&(r.x=i.x,o=n),i.y<e.y&&(e.y=i.y,h=n),i.y>r.y&&(r.y=i.y,a=n)}let u=new ft(0,-1),l=new ft(0,1),c=new ft(-1,0),f=new ft(1,0);for(let n=0;n<t.length;n++){const n=[Math.acos(u.dot(i[s])),Math.acos(l.dot(i[o])),Math.acos(c.dot(i[a])),Math.acos(f.dot(i[h]))];switch(n.indexOf(Math.min.apply(Math,n))){case 0:u=i[s].clone(),l=u.clone(),l.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),s=(s+1)%t.length;break;case 1:l=i[o].clone(),u=l.clone(),u.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),o=(o+1)%t.length;break;case 2:c=i[a].clone(),f=c.clone(),f.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),a=(a+1)%t.length;break;case 3:f=i[h].clone(),c=f.clone(),c.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),h=(h+1)%t.length}this.UpdateOmbb(t[s],u,t[o],l,t[a],c,t[h],f)}return n}(function(t){if(t.length<3)return t;let n=t[0];const i=[];for(let i=1;i<t.length;i++)(t[i].x<n.x||Math.abs(t[i].x-n.x)<1e-5&&t[i].y<n.y)&&(n=t[i]);let e=t[0];do{i.unshift(n.clone());for(let i=1;i<t.length;i++){const r=dt(n,e,t[i]);(e.equals(n)||1===r||0===r&&n.distance(t[i])>n.distance(e))&&(e=t[i])}n=e}while(!e.equals(i[i.length-1]));return i}(r)),o=s[0].distance(s[1]),a=s[1].distance(s[2]),h=s.map(t=>[t.x,t.y]);return h.push(+(a>o)),h}var mt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(){var t=new mt(3);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function wt(t,n,i){var e=new mt(3);return e[0]=t,e[1]=n,e[2]=i,e}function Mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function bt(t,n,i,e){return t[0]=n,t[1]=i,t[2]=e,t}function xt(t,n,i){return t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t}function Ft(t,n,i){return t[0]=n[0]/i[0],t[1]=n[1]/i[1],t[2]=n[2]/i[2],t}function At(t,n){var i=n[0],e=n[1],r=n[2],s=i*i+e*e+r*r;return s>0&&(s=1/Math.sqrt(s),t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s),t}function kt(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pt(t,n,i){var e=n[0],r=n[1],s=n[2],o=i[0],a=i[1],h=i[2];return t[0]=r*h-s*a,t[1]=s*o-e*h,t[2]=e*a-r*o,t}var St=function(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t};function _t(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Ot(t,n,i,e,r){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t}function It(){var t=new mt(4);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Tt(t,n){var i=n[0]+n[4]+n[8],e=void 0;if(i>0)e=Math.sqrt(i+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;e=Math.sqrt(n[3*r+r]-n[3*s+s]-n[3*o+o]+1),t[r]=.5*e,e=.5/e,t[3]=(n[3*s+o]-n[3*o+s])*e,t[s]=(n[3*s+r]+n[3*r+s])*e,t[o]=(n[3*o+r]+n[3*r+o])*e}return t}gt(),function(){var t,n=(t=new mt(4),mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Lt,Ut=function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i,t},zt=function(t,n){var i=n[0],e=n[1],r=n[2],s=n[3],o=i*i+e*e+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=e*o,t[2]=r*o,t[3]=s*o),t};function Dt(t,n){var i=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(i*i+e*e)}function Et(t,n,i,e,r,s,o,a,h,u){0===t?function(t,n,i,e,r,s,o,a,h){const u=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],l=e[r+1];i[t]=u[0]+n*s*o/a,i[t+1]=u[1]-l*s*o/h}}(n,i,e,r,0,o,a,h,u):1===t&&function(t,n,i,e){const r=pt(e,t,n),s=r[4],o=r[s],a=r[s+1],h=r[s+2],u=(a[1]-o[1])/(a[0]-o[0]),l=(h[1]-a[1])/(h[0]-a[0]),c=Dt(o,a),f=Dt(a,h);for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],s=e[r+1];i[t]=jt(n,s,o,u,c),i[t+1]=-jt(n,s,a,l,f)}}(n,i,e,r)}gt(),wt(1,0,0),wt(0,1,0),It(),It(),Lt=new mt(9),mt!=Float32Array&&(Lt[1]=0,Lt[2]=0,Lt[3]=0,Lt[5]=0,Lt[6]=0,Lt[7]=0),Lt[0]=1,Lt[4]=1,Lt[8]=1,function(){var t=function(){var t=new mt(2);return mt!=Float32Array&&(t[0]=0,t[1]=0),t}()}();const Ct=[];function jt(t,n,i,e,r){return Ct[0]=(e*e*i[0]+e*(n-i[1])+t)/(e*e+1),Ct[1]=e*(Ct[0]-i[0])+i[1],Dt(i,Ct)/r}function Nt(t,n,i,e,r){const s=3*n[i-1],o=3*n[i-1]+1,a=t[s],h=t[o];return u=e,l=r,c=a,f=h,Math.sqrt((c-u)*(c-u)+(f-l)*(f-l));var u,l,c,f}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;var Ht=Vt;function Vt(t,n){this.x=t,this.y=n}function Rt(t,n,i){i=i||{},this.w=t||64,this.h=n||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function $t(t,n,i){this.x=0,this.y=t,this.w=this.free=n,this.h=i}function Wt(t,n,i,e,r,s,o){this.id=t,this.x=n,this.y=i,this.w=e,this.h=r,this.maxw=s||e,this.maxh=o||r,this.refcount=0}Vt.prototype={clone:function(){return new Vt(this.x,this.y)},add:function(t){return this.clone().u(t)},sub:function(t){return this.clone().v(t)},multByPoint:function(t){return this.clone().m(t)},divByPoint:function(t){return this.clone().M(t)},mult:function(t){return this.clone().F(t)},div:function(t){return this.clone().A(t)},rotate:function(t){return this.clone().k(t)},rotateAround:function(t,n){return this.clone().P(t,n)},matMult:function(t){return this.clone().S(t)},unit:function(){return this.clone()._()},perp:function(){return this.clone().O()},round:function(){return this.clone().I()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},S:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},u:function(t){return this.x+=t.x,this.y+=t.y,this},v:function(t){return this.x-=t.x,this.y-=t.y,this},F:function(t){return this.x*=t,this.y*=t,this},A:function(t){return this.x/=t,this.y/=t,this},m:function(t){return this.x*=t.x,this.y*=t.y,this},M:function(t){return this.x/=t.x,this.y/=t.y,this},_:function(){return this.A(this.mag()),this},O:function(){var t=this.y;return this.y=this.x,this.x=-t,this},k:function(t){var n=Math.cos(t),i=Math.sin(t),e=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=e,this.y=r,this},P:function(t,n){var i=Math.cos(t),e=Math.sin(t),r=n.x+i*(this.x-n.x)-e*(this.y-n.y),s=n.y+e*(this.x-n.x)+i*(this.y-n.y);return this.x=r,this.y=s,this},I:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Vt.convert=function(t){return t instanceof Vt?t:Array.isArray(t)?new Vt(t[0],t[1]):t},Rt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var i,e,r,s,o=[],a=0;a<t.length;a++)if(i=t[a].w||t[a].width,e=t[a].h||t[a].height,r=t[a].id,i&&e){if(!(s=this.packOne(i,e,r)))continue;n.inPlace&&(t[a].x=s.x,t[a].y=s.y,t[a].id=s.id),o.push(s)}return this.shrink(),o},Rt.prototype.packOne=function(t,n,i){var e,r,s,o,a,h,u,l,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof i||"number"==typeof i){if(e=this.getBin(i))return this.ref(e),e;"number"==typeof i&&(this.maxId=Math.max(i,this.maxId))}else i=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(e=this.freebins[o]).maxh&&t===e.maxw)return this.allocFreebin(o,t,n,i);n>e.maxh||t>e.maxw||n<=e.maxh&&t<=e.maxw&&(s=e.maxw*e.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(r=this.shelves[o]).h,!(t>r.free)){if(n===r.h)return this.allocShelf(o,t,n,i);n>r.h||n<r.h&&(s=(r.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,i):-1!==c.shelf?this.allocShelf(c.shelf,t,n,i):n<=this.h-f&&t<=this.w?(r=new $t(f,this.w,n),this.allocShelf(this.shelves.push(r)-1,t,n,i)):this.autoResize?(a=h=this.h,((u=l=this.w)<=a||t>u)&&(l=2*Math.max(t,u)),(a<u||n>a)&&(h=2*Math.max(n,a)),this.resize(l,h),this.packOne(t,n,i)):null},Rt.prototype.allocFreebin=function(t,n,i,e){var r=this.freebins.splice(t,1)[0];return r.id=e,r.w=n,r.h=i,r.refcount=0,this.bins[e]=r,this.ref(r),r},Rt.prototype.allocShelf=function(t,n,i,e){var r=this.shelves[t].alloc(n,i,e);return this.bins[e]=r,this.ref(r),r},Rt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,i=0;i<this.shelves.length;i++){var e=this.shelves[i];n+=e.h,t=Math.max(e.w-e.free,t)}this.resize(t,n)}},Rt.prototype.getBin=function(t){return this.bins[t]},Rt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},Rt.prototype.unref=function(t){return 0===t.refcount?0:(0==--t.refcount&&(this.stats[t.h]--,delete this.bins[t.id],this.freebins.push(t)),t.refcount)},Rt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},Rt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(t);return!0},$t.prototype.alloc=function(t,n,i){if(t>this.free||n>this.h)return null;var e=this.x;return this.x+=t,this.free-=t,new Wt(i,e,this.y,t,n,t,this.h)},$t.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var qt={exports:{}};qt.exports=function(){function t(t,n,i){var e=t[n];t[n]=t[i],t[i]=e}function n(t,n){return t<n?-1:t>n?1:0}return function(i,e,r,s,o){!function n(i,e,r,s,o){for(;s>r;){if(s-r>600){var a=s-r+1,h=e-r+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(h-a/2<0?-1:1),f=Math.max(r,Math.floor(e-h*l/a+c)),d=Math.min(s,Math.floor(e+(a-h)*l/a+c));n(i,e,f,d,o)}var y=i[e],v=r,p=s;for(t(i,r,e),o(i[s],y)>0&&t(i,r,s);v<p;){for(t(i,v,p),v++,p--;o(i[v],y)<0;)v++;for(;o(i[p],y)>0;)p--}0===o(i[r],y)?t(i,r,p):(p++,t(i,p,s)),p<=e&&(r=p+1),e<=p&&(s=p-1)}}(i,e,r||0,s||i.length-1,o||n)}}();var Bt=qt.exports,Gt={exports:{}};function Jt(t,n){if(!(this instanceof Jt))return new Jt(t,n);if(this.data=t||[],this.length=this.data.length,this.compare=n||Xt,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this.T(i)}function Xt(t,n){return t<n?-1:t>n?1:0}Gt.exports=Jt,Gt.exports.default=Jt,Jt.prototype={push:function(t){this.data.push(t),this.length++,this.L(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this.T(0)),this.data.pop(),t}},peek:function(){return this.data[0]},L:function(t){for(var n=this.data,i=this.compare,e=n[t];t>0;){var r=t-1>>1,s=n[r];if(i(e,s)>=0)break;n[t]=s,t=r}n[t]=e},T:function(t){for(var n=this.data,i=this.compare,e=this.length>>1,r=n[t];t<e;){var s=1+(t<<1),o=s+1,a=n[s];if(o<this.length&&i(n[o],a)<0&&(s=o,a=n[o]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}};var Zt=Gt.exports,Yt={exports:{}},Kt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Qt={exports:{}},tn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},nn=Array.prototype.concat,en=Array.prototype.slice,rn=Qt.exports=function(t){for(var n=[],i=0,e=t.length;i<e;i++){var r=t[i];tn(r)?n=nn.call(n,en.call(r)):n.push(r)}return n};rn.wrap=function(t){return function(){return t(rn(arguments))}};var sn=Kt,on=Qt.exports,an=Object.hasOwnProperty,hn={};for(var un in sn)an.call(sn,un)&&(hn[sn[un]]=un);var ln=Yt.exports={to:{},get:{}};function cn(t,n,i){return Math.min(Math.max(n,t),i)}function fn(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}ln.get=function(t){var n,i;switch(t.substring(0,3).toLowerCase()){case"hsl":n=ln.get.hsl(t),i="hsl";break;case"hwb":n=ln.get.hwb(t),i="hwb";break;default:n=ln.get.rgb(t),i="rgb"}return n?{model:i,value:n}:null},ln.get.rgb=function(t){if(!t)return null;var n,i,e,r=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(e=n[2],n=n[1],i=0;i<3;i++){var s=2*i;r[i]=parseInt(n.slice(s,s+2),16)}e&&(r[3]=parseInt(e,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(e=(n=n[1])[3],i=0;i<3;i++)r[i]=parseInt(n[i]+n[i],16);e&&(r[3]=parseInt(e+e,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(i=0;i<3;i++)r[i]=parseInt(n[i+1],0);n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}else{if(!(n=t.match(/^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)))return(n=t.match(/^(\\w+)$/))?"transparent"===n[1]?[0,0,0,0]:an.call(sn,n[1])?((r=sn[n[1]])[3]=1,r):null:null;for(i=0;i<3;i++)r[i]=Math.round(2.55*parseFloat(n[i+1]));n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}for(i=0;i<3;i++)r[i]=cn(r[i],0,255);return r[3]=cn(r[3],0,1),r},ln.get.hsl=function(t){if(!t)return null;var n=t.match(/^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.get.hwb=function(t){if(!t)return null;var n=t.match(/^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.to.hex=function(){var t=on(arguments);return"#"+fn(t[0])+fn(t[1])+fn(t[2])+(t[3]<1?fn(Math.round(255*t[3])):"")},ln.to.rgb=function(){var t=on(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},ln.to.rgb.percent=function(){var t=on(arguments),n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),e=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+i+"%, "+e+"%)":"rgba("+n+"%, "+i+"%, "+e+"%, "+t[3]+")"},ln.to.hsl=function(){var t=on(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},ln.to.hwb=function(){var t=on(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},ln.to.keyword=function(t){return hn[t.slice(0,3)]};var dn={exports:{}},yn=Kt,vn={};for(var pn in yn)yn.hasOwnProperty(pn)&&(vn[yn[pn]]=pn);var mn=dn.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var gn in mn)if(mn.hasOwnProperty(gn)){if(!("channels"in mn[gn]))throw new Error("missing channels property: "+gn);if(!("labels"in mn[gn]))throw new Error("missing channel labels property: "+gn);if(mn[gn].labels.length!==mn[gn].channels)throw new Error("channel and label counts mismatch: "+gn);var wn=mn[gn].channels,Mn=mn[gn].labels;delete mn[gn].channels,delete mn[gn].labels,Object.defineProperty(mn[gn],"channels",{value:wn}),Object.defineProperty(mn[gn],"labels",{value:Mn})}function bn(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}mn.rgb.hsl=function(t){var n,i,e=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(e,r,s),a=Math.max(e,r,s),h=a-o;return a===o?n=0:e===a?n=(r-s)/h:r===a?n=2+(s-e)/h:s===a&&(n=4+(e-r)/h),(n=Math.min(60*n,360))<0&&(n+=360),i=(o+a)/2,[n,100*(a===o?0:i<=.5?h/(a+o):h/(2-a-o)),100*i]},mn.rgb.hsv=function(t){var n,i,e,r,s,o=t[0]/255,a=t[1]/255,h=t[2]/255,u=Math.max(o,a,h),l=u-Math.min(o,a,h),c=function(t){return(u-t)/6/l+.5};return 0===l?r=s=0:(s=l/u,n=c(o),i=c(a),e=c(h),o===u?r=e-i:a===u?r=1/3+n-e:h===u&&(r=2/3+i-n),r<0?r+=1:r>1&&(r-=1)),[360*r,100*s,100*u]},mn.rgb.hwb=function(t){var n=t[0],i=t[1],e=t[2];return[mn.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(i,e))),100*(e=1-1/255*Math.max(n,Math.max(i,e)))]},mn.rgb.cmyk=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*((1-i-(n=Math.min(1-i,1-e,1-r)))/(1-n)||0),100*((1-e-n)/(1-n)||0),100*((1-r-n)/(1-n)||0),100*n]},mn.rgb.keyword=function(t){var n=vn[t];if(n)return n;var i,e=1/0;for(var r in yn)if(yn.hasOwnProperty(r)){var s=bn(t,yn[r]);s<e&&(e=s,i=r)}return i},mn.keyword.rgb=function(t){return yn[t]},mn.rgb.xyz=function(t){var n=t[0]/255,i=t[1]/255,e=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)),100*(.2126*n+.7152*i+.0722*e),100*(.0193*n+.1192*i+.9505*e)]},mn.rgb.lab=function(t){var n=mn.rgb.xyz(t),i=n[0],e=n[1],r=n[2];return e/=100,r/=108.883,i=(i/=95.047)>.008856?Math.pow(i,1/3):7.787*i+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(i-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},mn.hsl.rgb=function(t){var n,i,e,r,s,o=t[0]/360,a=t[1]/100,h=t[2]/100;if(0===a)return[s=255*h,s,s];n=2*h-(i=h<.5?h*(1+a):h+a-h*a),r=[0,0,0];for(var u=0;u<3;u++)(e=o+1/3*-(u-1))<0&&e++,e>1&&e--,s=6*e<1?n+6*(i-n)*e:2*e<1?i:3*e<2?n+(i-n)*(2/3-e)*6:n,r[u]=255*s;return r},mn.hsl.hsv=function(t){var n=t[0],i=t[1]/100,e=t[2]/100,r=i,s=Math.max(e,.01);return i*=(e*=2)<=1?e:2-e,r*=s<=1?s:2-s,[n,100*(0===e?2*r/(s+r):2*i/(e+i)),100*((e+i)/2)]},mn.hsv.rgb=function(t){var n=t[0]/60,i=t[1]/100,e=t[2]/100,r=Math.floor(n)%6,s=n-Math.floor(n),o=255*e*(1-i),a=255*e*(1-i*s),h=255*e*(1-i*(1-s));switch(e*=255,r){case 0:return[e,h,o];case 1:return[a,e,o];case 2:return[o,e,h];case 3:return[o,a,e];case 4:return[h,o,e];case 5:return[e,o,a]}},mn.hsv.hsl=function(t){var n,i,e,r=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return e=(2-s)*o,i=s*a,[r,100*(i=(i/=(n=(2-s)*a)<=1?n:2-n)||0),100*(e/=2)]},mn.hwb.rgb=function(t){var n,i,e,r,s,o,a,h=t[0]/360,u=t[1]/100,l=t[2]/100,c=u+l;switch(c>1&&(u/=c,l/=c),e=6*h-(n=Math.floor(6*h)),0!=(1&n)&&(e=1-e),r=u+e*((i=1-l)-u),n){default:case 6:case 0:s=i,o=r,a=u;break;case 1:s=r,o=i,a=u;break;case 2:s=u,o=i,a=r;break;case 3:s=u,o=r,a=i;break;case 4:s=r,o=u,a=i;break;case 5:s=i,o=u,a=r}return[255*s,255*o,255*a]},mn.cmyk.rgb=function(t){var n=t[0]/100,i=t[1]/100,e=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r))]},mn.xyz.rgb=function(t){var n,i,e,r=t[0]/100,s=t[1]/100,o=t[2]/100;return i=-.9689*r+1.8758*s+.0415*o,e=.0557*r+-.204*s+1.057*o,n=(n=3.2406*r+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,[255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1)),255*(e=Math.min(Math.max(0,e),1))]},mn.xyz.lab=function(t){var n=t[0],i=t[1],e=t[2];return i/=100,e/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116))]},mn.lab.xyz=function(t){var n,i,e,r=t[0];n=t[1]/500+(i=(r+16)/116),e=i-t[2]/200;var s=Math.pow(i,3),o=Math.pow(n,3),a=Math.pow(e,3);return i=s>.008856?s:(i-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,[n*=95.047,i*=100,e*=108.883]},mn.lab.lch=function(t){var n,i=t[0],e=t[1],r=t[2];return(n=360*Math.atan2(r,e)/2/Math.PI)<0&&(n+=360),[i,Math.sqrt(e*e+r*r),n]},mn.lch.lab=function(t){var n,i=t[0],e=t[1];return n=t[2]/360*2*Math.PI,[i,e*Math.cos(n),e*Math.sin(n)]},mn.rgb.ansi16=function(t){var n=t[0],i=t[1],e=t[2],r=1 in arguments?arguments[1]:mn.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var s=30+(Math.round(e/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===r&&(s+=60),s},mn.hsv.ansi16=function(t){return mn.rgb.ansi16(mn.hsv.rgb(t),t[2])},mn.rgb.ansi256=function(t){var n=t[0],i=t[1],e=t[2];return n===i&&i===e?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(i/255*5)+Math.round(e/255*5)},mn.ansi16.rgb=function(t){var n=t%10;if(0===n||7===n)return t>50&&(n+=3.5),[n=n/10.5*255,n,n];var i=.5*(1+~~(t>50));return[(1&n)*i*255,(n>>1&1)*i*255,(n>>2&1)*i*255]},mn.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var i;return t-=16,[Math.floor(t/36)/5*255,Math.floor((i=t%36)/6)/5*255,i%6/5*255]},mn.rgb.hex=function(t){var n=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(n.length)+n},mn.hex.rgb=function(t){var n=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];var i=n[0];3===n[0].length&&(i=i.split("").map((function(t){return t+t})).join(""));var e=parseInt(i,16);return[e>>16&255,e>>8&255,255&e]},mn.rgb.hcg=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255,s=Math.max(Math.max(i,e),r),o=Math.min(Math.min(i,e),r),a=s-o;return n=a<=0?0:s===i?(e-r)/a%6:s===e?2+(r-i)/a:4+(i-e)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},mn.hsl.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=1,r=0;return(e=i<.5?2*n*i:2*n*(1-i))<1&&(r=(i-.5*e)/(1-e)),[t[0],100*e,100*r]},mn.hsv.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=n*i,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.hcg.rgb=function(t){var n=t[0]/360,i=t[1]/100,e=t[2]/100;if(0===i)return[255*e,255*e,255*e];var r,s=[0,0,0],o=n%1*6,a=o%1,h=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=h,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=a;break;case 3:s[0]=0,s[1]=h,s[2]=1;break;case 4:s[0]=a,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=h}return r=(1-i)*e,[255*(i*s[0]+r),255*(i*s[1]+r),255*(i*s[2]+r)]},mn.hcg.hsv=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n),e=0;return i>0&&(e=n/i),[t[0],100*e,100*i]},mn.hcg.hsl=function(t){var n=t[1]/100,i=t[2]/100*(1-n)+.5*n,e=0;return i>0&&i<.5?e=n/(2*i):i>=.5&&i<1&&(e=n/(2*(1-i))),[t[0],100*e,100*i]},mn.hcg.hwb=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n);return[t[0],100*(i-n),100*(1-i)]},mn.hwb.hcg=function(t){var n=t[1]/100,i=1-t[2]/100,e=i-n,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},mn.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},mn.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},mn.gray.hsl=mn.gray.hsv=function(t){return[0,0,t[0]]},mn.gray.hwb=function(t){return[0,100,t[0]]},mn.gray.cmyk=function(t){return[0,0,0,t[0]]},mn.gray.lab=function(t){return[t[0],0,0]},mn.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),i=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(i.length)+i},mn.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var xn=dn.exports;function Fn(t){var n=function(){for(var t={},n=Object.keys(xn),i=n.length,e=0;e<i;e++)t[n[e]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;)for(var e=i.pop(),r=Object.keys(xn[e]),s=r.length,o=0;o<s;o++){var a=r[o],h=n[a];-1===h.distance&&(h.distance=n[e].distance+1,h.parent=e,i.unshift(a))}return n}function An(t,n){return function(i){return n(t(i))}}function kn(t,n){for(var i=[n[t].parent,t],e=xn[n[t].parent][t],r=n[t].parent;n[r].parent;)i.unshift(n[r].parent),e=An(xn[n[r].parent][r],e),r=n[r].parent;return e.conversion=i,e}var Pn=dn.exports,Sn=function(t){for(var n=Fn(t),i={},e=Object.keys(n),r=e.length,s=0;s<r;s++){var o=e[s];null!==n[o].parent&&(i[o]=kn(o,n))}return i},_n={};Object.keys(Pn).forEach((function(t){_n[t]={},Object.defineProperty(_n[t],"channels",{value:Pn[t].channels}),Object.defineProperty(_n[t],"labels",{value:Pn[t].labels});var n=Sn(t);Object.keys(n).forEach((function(i){var e=n[i];_n[t][i]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var i=t(n);if("object"==typeof i)for(var e=i.length,r=0;r<e;r++)i[r]=Math.round(i[r]);return i};return"conversion"in t&&(n.conversion=t.conversion),n}(e),_n[t][i].raw=function(t){var n=function(n){return null==n?n:(arguments.length>1&&(n=Array.prototype.slice.call(arguments)),t(n))};return"conversion"in t&&(n.conversion=t.conversion),n}(e)}))}));var On=_n,In=Yt.exports,Tn=On,Ln=[].slice,Un=["keyword","gray","hex"],zn={};Object.keys(Tn).forEach((function(t){zn[Ln.call(Tn[t].labels).sort().join("")]=t}));var Dn={};function En(t,n){if(!(this instanceof En))return new En(t,n);if(n&&n in Un&&(n=null),n&&!(n in Tn))throw new Error("Unknown model: "+n);var i,e;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof En)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var r=In.get(t);if(null===r)throw new Error("Unable to parse color from string: "+t);this.model=r.model,e=Tn[this.model].channels,this.color=r.value.slice(0,e),this.valpha="number"==typeof r.value[e]?r.value[e]:1}else if(t.length){this.model=n||"rgb",e=Tn[this.model].channels;var s=Ln.call(t,0,e);this.color=Hn(s,e),this.valpha="number"==typeof t[e]?t[e]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var a=o.sort().join("");if(!(a in zn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=zn[a];var h=Tn[this.model].labels,u=[];for(i=0;i<h.length;i++)u.push(t[h[i]]);this.color=Hn(u)}if(Dn[this.model])for(e=Tn[this.model].channels,i=0;i<e;i++){var l=Dn[this.model][i];l&&(this.color[i]=l(this.color[i]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function Cn(t,n,i){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(Dn[t]||(Dn[t]=[]))[n]=i})),t=t[0],function(e){var r;return arguments.length?(i&&(e=i(e)),(r=this[t]()).color[n]=e,r):(r=this[t]().color[n],i&&(r=i(r)),r)}}function jn(t){return function(n){return Math.max(0,Math.min(t,n))}}function Nn(t){return Array.isArray(t)?t:[t]}function Hn(t,n){for(var i=0;i<n;i++)"number"!=typeof t[i]&&(t[i]=0);return t}En.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in In.to?this:this.rgb(),i=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return In.to[n.model](i)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),i=1===n.valpha?n.color:n.color.concat(this.valpha);return In.to.rgb.percent(i)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Tn[this.model].channels,i=Tn[this.model].labels,e=0;e<n;e++)t[i[e]]=this.color[e];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new En(this.color.map(function(t){return function(n){return function(t,n){return Number(t.toFixed(n))}(n,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new En(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Cn("rgb",0,jn(255)),green:Cn("rgb",1,jn(255)),blue:Cn("rgb",2,jn(255)),hue:Cn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:Cn("hsl",1,jn(100)),lightness:Cn("hsl",2,jn(100)),saturationv:Cn("hsv",1,jn(100)),value:Cn("hsv",2,jn(100)),chroma:Cn("hcg",1,jn(100)),gray:Cn("hcg",2,jn(100)),white:Cn("hwb",1,jn(100)),wblack:Cn("hwb",2,jn(100)),cyan:Cn("cmyk",0,jn(100)),magenta:Cn("cmyk",1,jn(100)),yellow:Cn("cmyk",2,jn(100)),black:Cn("cmyk",3,jn(100)),x:Cn("xyz",0,jn(100)),y:Cn("xyz",1,jn(100)),z:Cn("xyz",2,jn(100)),l:Cn("lab",0,jn(100)),a:Cn("lab",1),b:Cn("lab",2),keyword:function(t){return arguments.length?new En(t):Tn[this.model].keyword(this.color)},hex:function(t){return arguments.length?new En(t):In.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,n=[],i=0;i<t.length;i++){var e=t[i]/255;n[i]=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),i=t.luminosity();return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)},level:function(t){var n=this.contrast(t);return n>=7.1?"AAA":n>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),n=0;n<3;n++)t.color[n]=255-t.color[n];return t},lighten:function(t){var n=this.hsl();return n.color[2]+=n.color[2]*t,n},darken:function(t){var n=this.hsl();return n.color[2]-=n.color[2]*t,n},saturate:function(t){var n=this.hsl();return n.color[1]+=n.color[1]*t,n},desaturate:function(t){var n=this.hsl();return n.color[1]-=n.color[1]*t,n},whiten:function(t){var n=this.hwb();return n.color[1]+=n.color[1]*t,n},blacken:function(t){var n=this.hwb();return n.color[2]+=n.color[2]*t,n},grayscale:function(){var t=this.rgb().color,n=.3*t[0]+.59*t[1]+.11*t[2];return En.rgb(n,n,n)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var n=this.hsl(),i=n.color[0];return i=(i=(i+t)%360)<0?360+i:i,n.color[0]=i,n},mix:function(t,n){if(!t||!t.rgb)throw new Error(\'Argument to "mix" was not a Color instance, but rather an instance of \'+typeof t);var i=t.rgb(),e=this.rgb(),r=void 0===n?.5:n,s=2*r-1,o=i.alpha()-e.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,h=1-a;return En.rgb(a*i.red()+h*e.red(),a*i.green()+h*e.green(),a*i.blue()+h*e.blue(),i.alpha()*r+e.alpha()*(1-r))}},Object.keys(Tn).forEach((function(t){if(-1===Un.indexOf(t)){var n=Tn[t].channels;En.prototype[t]=function(){if(this.model===t)return new En(this);if(arguments.length)return new En(arguments,t);var i="number"==typeof arguments[n]?n:this.valpha;return new En(Nn(Tn[this.model][t].raw(this.color)).concat(i),t)},En[t]=function(i){return"number"==typeof i&&(i=Hn(Ln.call(arguments),n)),new En(i,t)}}}));var Vn=En;class Rn{constructor(t,n){this.position=t,this.index=n,this.faces=[],this.neighbors=[]}addUniqueNeighbor(t){-1===this.neighbors.indexOf(t)&&this.neighbors.push(t)}}class $n{constructor(t,n,i,e){this.a=e.a,this.b=e.b,this.c=e.c,this.v1=t,this.v2=n,this.v3=i,this.normal=[],this.computeNormal(),t.faces.push(this),t.addUniqueNeighbor(n),t.addUniqueNeighbor(i),n.faces.push(this),n.addUniqueNeighbor(t),n.addUniqueNeighbor(i),i.faces.push(this),i.addUniqueNeighbor(t),i.addUniqueNeighbor(n)}computeNormal(){const t=this.v1.position,n=this.v2.position,i=this.v3.position,e=Pt([],St([],i,n),St([],t,n));At(this.normal,e)}hasVertex(t){return t===this.v1||t===this.v2||t===this.v3}}\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */const Wn=[],qn=[],Bn=[],Gn=[];function Jn(t,n,i){const e=Pt(qn,n,i);t=Tt(t,function(t,n,i,e,r,s,o,a,h,u){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=s,t[5]=o,t[6]=a,t[7]=h,t[8]=u,t}(Wn,i[0],i[1],i[2],...e,...n));if((t=function(t){return t[3]<0?Ut(t,t,-1):t}(t=zt(t,t)))[3]<1/32767){t[3]=1/32767;const n=Math.sqrt(.9999999990686206);t[0]*=n,t[1]*=n,t[2]*=n}const r=i[3]>0?Pt(Bn,i,n):Pt(Bn,n,i);return kt(Pt(Gn,i,n),r)<0&&Ut(t,t,-1),t}function Xn(t,n){const i=[],e=[];let r=0;for(r=0;r<t.length;r+=3){const n=new Rn([t[r],t[r+1],t[r+2]],r/3);i.push(n)}if(!n.length){const t=n;n=[];for(let i=0;i<t;i++)n.push(i)}for(r=0;r<n.length/3;r++){const t={a:n[3*r],b:n[3*r+1],c:n[3*r+2]};new $n(i[t.a],i[t.b],i[t.c],t)}const s=[],o=[0,0,0];for(r=0;r<i.length;r++){const t=i[r],n=t.index;bt(o,0,0,0);let a=t.faces.length;for(let n=0;n<a;n++)xt(o,o,t.faces[n].normal);a=a||1,bt(s,a,a,a),Ft(o,o,s),e[3*n]=o[0],e[3*n+1]=o[1],e[3*n+2]=o[2]}return e}\n/*!\n * Contains code from THREE.JS\n * https://github.com/mrdoob/three.js/\n * License MIT\n * \n * Generate tangents per vertex.\n */function Zn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t}function Yn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t}var Kn={exports:{}};function Qn(t,n,i){i=i||2;var e,r,s,o,a,h,u,l=n&&n.length,c=l?n[0]*i:t.length,f=ti(t,0,c,i,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,n,i,e){var r,s,o,a,h,u=[];for(r=0,s=n.length;r<s;r++)o=n[r]*e,a=r<s-1?n[r+1]*e:t.length,(h=ti(t,o,a,e,!1))===h.next&&(h.steiner=!0),u.push(ci(h));for(u.sort(ai),r=0;r<u.length;r++)i=ni(i=hi(u[r],i),i.next);return i}(t,n,f,i)),t.length>80*i){e=s=t[0],r=o=t[1];for(var y=i;y<c;y+=i)(a=t[y])<e&&(e=a),(h=t[y+1])<r&&(r=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-e,o-r))?1/u:0}return ii(f,d,i,e,r,u),d}function ti(t,n,i,e,r){var s,o;if(r===Ai(t,n,i,e)>0)for(s=n;s<i;s+=e)o=bi(s,t[s],t[s+1],o);else for(s=i-e;s>=n;s-=e)o=bi(s,t[s],t[s+1],o);return o&&vi(o,o.next)&&(xi(o),o=o.next),o}function ni(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!vi(e,e.next)&&0!==yi(e.prev,e,e.next))e=e.next;else{if(xi(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function ii(t,n,i,e,r,s,o){if(t){!o&&s&&function(t,n,i,e){var r=t;do{null===r.z&&(r.z=li(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,e,r,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,e=i,a=0,n=0;n<u&&(a++,e=e.nextZ);n++);for(h=u;a>0||h>0&&e;)0!==a&&(0===h||!e||i.z<=e.z)?(r=i,i=i.nextZ,a--):(r=e,e=e.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=e}s.nextZ=null,u*=2}while(o>1)}(r)}(t,e,r,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ri(t,e,r,s):ei(t))n.push(a.i/i),n.push(t.i/i),n.push(h.i/i),xi(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?ii(t=si(ni(t),n,i),n,i,e,r,s,2):2===o&&oi(t,n,i,e,r,s):ii(ni(t),n,i,e,r,s,1);break}}}function ei(t){var n=t.prev,i=t,e=t.next;if(yi(n,i,e)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(fi(n.x,n.y,i.x,i.y,e.x,e.y,r.x,r.y)&&yi(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ri(t,n,i,e){var r=t.prev,s=t,o=t.next;if(yi(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,l=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=li(a,h,n,i,e),f=li(u,l,n,i,e),d=t.prevZ,y=t.nextZ;d&&d.z>=c&&y&&y.z<=f;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;y&&y.z<=f;){if(y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function si(t,n,i){var e=t;do{var r=e.prev,s=e.next.next;!vi(r,s)&&pi(r,e,e.next,s)&&wi(r,s)&&wi(s,r)&&(n.push(r.i/i),n.push(e.i/i),n.push(s.i/i),xi(e),xi(e.next),e=t=s),e=e.next}while(e!==t);return ni(e)}function oi(t,n,i,e,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&di(o,a)){var h=Mi(o,a);return o=ni(o,o.next),h=ni(h,h.next),ii(o,n,i,e,r,s),void ii(h,n,i,e,r,s)}a=a.next}o=o.next}while(o!==t)}function ai(t,n){return t.x-n.x}function hi(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o){if(o=a,a===r){if(s===e.y)return e;if(s===e.next.y)return e.next}i=e.x<e.next.x?e:e.next}}e=e.next}while(e!==n);if(!i)return null;if(r===o)return i;var h,u=i,l=i.x,c=i.y,f=1/0;e=i;do{r>=e.x&&e.x>=l&&r!==e.x&&fi(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(h=Math.abs(s-e.y)/(r-e.x),wi(e,t)&&(h<f||h===f&&(e.x>i.x||e.x===i.x&&ui(i,e)))&&(i=e,f=h)),e=e.next}while(e!==u);return i}(t,n);if(!i)return n;var e=Mi(i,t),r=ni(i,i.next);return ni(e,e.next),n===i?r:n}function ui(t,n){return yi(t.prev,t,n.prev)<0&&yi(n.next,t,t.next)<0}function li(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-e)*r)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function ci(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 fi(t,n,i,e,r,s,o,a){return(r-o)*(n-a)-(t-o)*(s-a)>=0&&(t-o)*(e-a)-(i-o)*(n-a)>=0&&(i-o)*(s-a)-(r-o)*(e-a)>=0}function di(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&&pi(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(wi(t,n)&&wi(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)&&(yi(t.prev,t,n.prev)||yi(t,n.prev,n))||vi(t,n)&&yi(t.prev,t,t.next)>0&&yi(n.prev,n,n.next)>0)}function yi(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function vi(t,n){return t.x===n.x&&t.y===n.y}function pi(t,n,i,e){var r=gi(yi(t,n,i)),s=gi(yi(t,n,e)),o=gi(yi(i,e,t)),a=gi(yi(i,e,n));return r!==s&&o!==a||(!(0!==r||!mi(t,i,n))||(!(0!==s||!mi(t,e,n))||(!(0!==o||!mi(i,t,e))||!(0!==a||!mi(i,n,e)))))}function mi(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 gi(t){return t>0?1:t<0?-1:0}function wi(t,n){return yi(t.prev,t,t.next)<0?yi(t,n,t.next)>=0&&yi(t,t.prev,n)>=0:yi(t,n,t.prev)<0||yi(t,t.next,n)<0}function Mi(t,n){var i=new Fi(t.i,t.x,t.y),e=new Fi(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 bi(t,n,i,e){var r=new Fi(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 xi(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 Fi(t,n,i){this.i=t,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ai(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}Kn.exports=Qn,Kn.exports.default=Qn,Qn.deviation=function(t,n,i,e){var r=n&&n.length,s=r?n[0]*i:t.length,o=Math.abs(Ai(t,0,s,i));if(r)for(var a=0,h=n.length;a<h;a++){var u=n[a]*i,l=a<h-1?n[a+1]*i:t.length;o-=Math.abs(Ai(t,u,l,i))}var c=0;for(a=0;a<e.length;a+=3){var f=e[a]*i,d=e[a+1]*i,y=e[a+2]*i;c+=Math.abs((t[f]-t[y])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[y+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Qn.flatten=function(t){for(var n=t[0][0].length,i={vertices:[],holes:[],dimensions:n},e=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<n;o++)i.vertices.push(t[r][s][o]);r>0&&(e+=t[r-1].length,i.holes.push(e))}return i};var ki=Kn.exports;\n/*!\n * @maptalks/vector-packer v0.63.9\n * LICENSE : UNLICENSED\n * (c) 2016-2022 maptalks.com\n */const Pi={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function Si(t,n={}){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)_i(i,t.features[e],n,e);else _i(i,"Feature"===t.type?t:{geometry:t},n);return i}function _i(t,n,i,e){if(n.geometry&&n.geometry.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(i.promoteId?a=n.properties[i.promoteId]:i.generateId&&(a=e||0),"Point"===s)Oi(r,o);else if("MultiPoint"===s)for(var h=0;h<r.length;h++)Oi(r[h],o);else if("LineString"===s)Ti([r],o);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<r.length;h++)Ii(r[h],o=[]),t.push(Li(a,"LineString",o,n.properties));return}Ti(r,o)}else if("Polygon"===s)Ti(r,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<n.geometry.geometries.length;h++)_i(t,{id:a,geometry:n.geometry.geometries[h],properties:n.properties},i,e);return}return void console.warn(`Input data type(${s}) is not a valid GeoJSON geometry type.`)}for(h=0;h<r.length;h++){var u=[];Ti(r[h],u),o.push(u)}}t.push(Li(a,s,o,n.properties))}}function Oi(t,n){n.push([new Ht(t[0],t[1])])}function Ii(t,n){for(var i=0;i<t.length;i++)n.push(new Ht(t[i][0],t[i][1]))}function Ti(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];Ii(t[r],s),n.push(s)}}function Li(t,n,i,e){return{id:void 0===t?null:t,type:Pi[n],geometry:i,properties:e}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ui(t,{width:n,height:i},e,r){if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);return t.width=n,t.height=i,t.data=r,t}function zi(t,{width:n,height:i},e){if(n===t.width&&i===t.height)return;const r=Ui({},{width:n,height:i},e);Di(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},e),t.width=n,t.height=i,t.data=r.data}function Di(t,n,i,e,r,s){if(0===r.width||0===r.height)return n;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>n.width||r.height>n.height||e.x>n.width-r.width||e.y>n.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=n.data;if(o===a)return n;for(let h=0;h<r.height;h++){const u=((i.y+h)*t.width+i.x)*s,l=((e.y+h)*n.width+e.x)*s;for(let t=0;t<r.width*s;t++)a[l+t]=o[u+t]}return n}class Ei{constructor(t,n){Ui(this,t,1,n)}resize(t){zi(this,t,1)}clone(){return new Ei({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,1)}}class Ci{constructor(t,n){Ui(this,t,4,n)}resize(t){zi(this,t,4)}clone(){return new Ci({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,4)}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class ji{constructor(t,{pixelRatio:n}){this.paddedRect=t,this.pixelRatio=n||1}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ni{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s={x:0,y:0,w:r.data.width+2,h:r.data.height+2};e.push(s),n[i]=new ji(s,r)}if(i.pack(e,{inPlace:!0}),!Hi(i.w)||!Hi(i.h)){const t=Vi(i.w),n=Vi(i.h);i.resize(t,n)}const r=new Ci({width:i.w,height:i.h});for(const i in t){const e=t[i],s=n[i].paddedRect;Ci.copy(e.data,r,{x:0,y:0},{x:s.x+1,y:s.y+1},e.data)}this.image=r,this.positions=n}}function Hi(t){return 0==(t&t-1)&&0!==t}function Vi(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n * TODO 升级为potpack\n */class Ri{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s=n[i]={};for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const i={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};e.push(i),s[t]={rect:i,metrics:n.metrics}}}i.pack(e,{inPlace:!0});const r=new Ei({width:i.w,height:i.h});for(const i in t){const e=t[i];for(const t in e){const s=e[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[i][t].rect;Ei.copy(s.bitmap,r,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=r,this.positions=n}}function $i(t){return t<65536?Uint16Array:Uint32Array}function Wi(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function qi(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function Bi(t){const n=t.type,i=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Oi(t.geometry[n],i);else if(2===n)Ti(t.geometry,i);else if(3===n)Ti(t.geometry,i);else if(5===n)Ti(t.geometry,i);else if(6===n)for(let n=0;n<t.geometry.length;n++){const e=[];Ti(t.geometry[n],e),i.push(e)}return t.geometry=i,t}function Gi(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function Ji(t){return null==t}function Xi(t){return"number"==typeof t&&!isNaN(t)}function Zi(t){return"object"==typeof t&&!!t}function Yi(t){return!Ji(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}const Ki=Object.prototype.hasOwnProperty;function Qi(t,n){return Ki.call(t,n)}function te(t){return m(t)&&t.property}function ne(t){let n=0;for(let i,e,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],e=t[o],n+=void 0!==i.x?(e.x-i.x)*(i.y+e.y):(e[0]-i[0])*(i[1]+e[1]);return n}function ie(t,n,i,e,r){const s=t[n*e],o=t[n*e+1],a=t[i*e],h=t[i*e+1];return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function ee(t,n,i){let e=i;return n&&t&&(e=t[n]),void 0===e&&(e=i),10*(e||0)}function re(t,n,i,e,r,s,o){n||0===n||(n=1);const a=ee(t.properties,i,e),h=a*n;let u=a;return r?u=ee(t.properties,r,s):o&&(u=a-ee(t.properties,o,0)),u*=n,{altitude:h,height:u}}function se(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function oe(t){return null==t}function ae(t,n,i){if(t===i||t===n)return t;const e=i-n;return((t-n)%e+e)%e+n}class he{constructor(t,n,i,e){this.feature=t,this.symbol=n,this.fnTypes=i,this.options=e}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.U(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.U(t,n)}U(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}const ue={lineWidth:1,lineStrokeWidth:1,lineDx:1,lineDy:1,lineOpacity:1,linePatternAnimSpeed:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerSpacing:1,markerOpacity:1,markerRotation:1,textWrapWidth:1,textSpacing:1,textSize:1,textHaloRadius:1,textHaloOpacity:1,textDx:1,textDy:1,textOpacity:1,textRotation:1,polygonOpacity:1};class le{static isAtlasLoaded(t,n={}){const{iconAtlas:i}=n;return!!(!t||i&&i.positions[t])}static genFnTypes(t){const n={};for(const i in t)if(te(t[i])){const e=(i+"_Fn_0").trim(),r=(i+"Fn").trim();ue[i]?(n[e]=g(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?g(r)(t,i):r}):(n[e]=w(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?w(r)(t,i):r})}return n}constructor(t,n,i){this.options=i,this.features=this.D(t),this.symbolDef=n,this.symbol=M(n,()=>[i.zoom]),this.styledVectors=[],this.properties={},this.C=le.genFnTypes(this.symbolDef),te(this.symbolDef.visible)&&(this.j=g(this.symbolDef.visible)),i.atlas&&(this.iconAtlas=i.atlas.iconAtlas,this.glyphAtlas=i.atlas.glyphAtlas)}D(t){if(!t.length)return t;const n="__fea_idx".trim();let e,r=0,s=t[r];for(;!s.geometry;)r++,s=t[r];if(Array.isArray(s.geometry)&&s.properties){let n=s.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof Ht&&(e=t)}if(!e)if(e=[],Array.isArray(s.geometry))for(let n=0;n<t.length;n++){const i=Gi({},t[n]);e.push(Bi(i))}else for(let i=0;i<t.length;i++){const r=t[i],s=Si(r);for(let t=0;t<s.length;t++){const i=s[t];i[n]=r[n],e.push(i)}}const o=this.options.order;if(o){const t=[];for(let n=0;n<o.length;n++)o[n]&&t.push(i(o[n]));e=e.sort((n,i)=>{const e=t.length;let r=e,s=e;for(let o=0;o<e&&(t[o](n)&&(r=o),t[o](i)&&(s=o),!(r<e&&s<e));o++);return r-s})}return e}load(t=1){const n="__fea_idx".trim(),i="_debug_info".trim(),e=this.C,r=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},h={zoom:this.options.zoom},u=M(this.symbolDef,()=>[h.zoom]);let l=0,c=s.length;const f=this.options.debugIndex;try{for(;l<c;l++){const t=s[l];if(!t||!t.geometry)continue;if(void 0!==f&&t[i].index!==f)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const c=this.createStyledVector(t,u,e,h,o,a);c&&c.feature.geometry&&(c.featureIdx=void 0===t[n]?l:t[n],this.count++,r.push(c))}}catch(t){return Promise.reject(t)}return this.options.atlas?Promise.resolve(this.pack(t)):this.loadAtlas(o,a).then(()=>this.pack(t))}loadAtlas(t,n){return new Promise((i,e)=>{this.fetchAtlas(t,n,(t,n)=>{if(t)e(t);else{if(n){const{icons:t,glyphs:i}=n;if(t&&Object.keys(t).length){for(const n in t){const i=t[n],{width:e,height:r,data:s}=i.data;i.data=new Ci({width:e,height:r},s)}this.iconAtlas=new Ni(t)}if(i&&Object.keys(i).length){for(const t in i){const n=i[t];for(const t in n){const i=n[t],{width:e,height:r,data:s}=i.bitmap;i.bitmap=new Ei({width:e,height:r},s)}}this.glyphAtlas=new Ri(i)}}i({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}})})}fetchAtlas(t,n,i){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,i):i()}pack(t){if(!this.count)return null;if(null==t)throw new Error("layout scale is undefined");const n=this.createDataPack(this.styledVectors,t);if(!n)return null;n.properties=this.properties,this.empty&&(n.empty=!0);const i=n.buffers;delete n.buffers;const e={data:n,buffers:i};if(this.iconAtlas){const t=e.data.iconAtlas=ce(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)i.push(t.glyphMap[n].data.data.buffer);i.push(e.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(e.data.glyphAtlas=ce(this.glyphAtlas),i.push(e.data.glyphAtlas.image.data.buffer)),e}createStyledVector(t,n,i,e){return new he(t,n,i,e)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.maxAltitude=0;const i=this.data={};let e=this.elements=[];const r=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol);for(let t=0;t<r.length;t++)i[r[t].name]=[];let s=[],o=0;const a=[];let h=0,u=!1;for(let e=0,r=t.length;e<r;e++){if(!t[e].feature.geometry)continue;const r=Array.isArray(t[e])?t[e][0].feature.id:t[e].feature.id;Xi(r)&&(Math.abs(r)>h&&(h=Math.abs(r)),r<0&&(u=!0));const l=this.data.aPosition.length;if(Array.isArray(t[e]))for(let i=0;i<t[e].length;i++)this.N(t[e][i],n);else this.N(t[e],n);const c=(i.aPosition.length-l)/3;for(let n=0;n<c;n++)s.push(t[e].featureIdx),Xi(r)&&a.push(r);o=Math.max(o,t[e].featureIdx)}if(this.hasElements()&&!e.length)return null;s=new(qi(o))(s),r[0].type=this.options.positionType?this.options.positionType:Wi(Math.max(this.maxPos,this.maxAltitude));const l=this.options.center;if(l&&(l[0]||l[1])){const t=i.aPosition;for(let n=0;n<t.length;n+=3)t[n]-=l[0],t[n+1]-=l[1]}const c=function(t,n){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=r.type,o=r.name;i[o]=s===Array?n[o]:new s(n[o])}return i}(r,i);c.aPickingId=s;const f=[];for(const t in c)f.push(c[t].buffer);e=new($i(this.maxIndex))(e),f.push(e.buffer);const d={data:c,indices:this.hasElements()?e:null,positionSize:3,\n//!this.maxAltitude ? 2 : 3,\nbuffers:f,symbolIndex:this.symbolDef.index||{index:0}};if(a.length){const t=u?Wi(h):qi(h);d.featureIds=new t(a),f.push(d.featureIds.buffer)}else d.featureIds=[];return d}N(t,n){this.j&&this.j.isZoomConstant&&!this.j(null,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(...t){this.maxIndex=Math.max(this.maxIndex,...t),this.elements.push(...t)}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:i,altitudeScale:e}=this.options;let r=ee(t,n,i);return e&&(r*=e),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(r)),r}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const i in t)if(Qi(t,i)){const{tl:e,displaySize:r}=t[i],s=Math.max(e[0],e[1],r[0]-1,r[1]-1);s>n&&(n=s)}return n}}function ce(t){let n=t.positions,i=t.image&&t.image.format||"alpha";if(t instanceof Ni){n={};for(const i in t.positions){const e=t.positions[i];n[i]={paddedRect:e.paddedRect,pixelRatio:e.pixelRatio,tl:e.tl,br:e.br,displaySize:e.displaySize}}i="rgba"}const e=t.image;return{image:{width:e.width,height:e.height,data:e.data,format:i},glyphMap:t.glyphMap,positions:n}}function fe(t,n,i,e){const r="__fn_textSize".trim();let s=t.textSize;if(Ji(n.textSize))return[16,16];t[r]&&(s=t[r]);const o=[];var a;return o[0]=Ji(a=s)||"function"!=typeof a&&(null===a.constructor||a.constructor!==Function)?s:s(e,i),o[1]=o[0],o}function de(t){const n=t.stops;let i=-1/0;for(let t=0;t<n.length;t++){let e=n[t][1];Zi(n[t][1])&&(e=de(n[t][1])),e>i&&(i=e)}return i}const ye=/\\{([\\w_]+)\\}/g;function ve(t,n){return Yi(t)?t.replace(ye,(function(t,i){if(!n)return"";const e=n[i];return Ji(e)?"":Array.isArray(e)?e.join():e})):t}const pe=t=>t>=11904&&t<=12031,me=t=>t>=12032&&t<=12255,ge=t=>t>=12272&&t<=12287,we=t=>t>=12288&&t<=12351,Me=t=>t>=12352&&t<=12447,be=t=>t>=12448&&t<=12543,xe=t=>t>=12544&&t<=12591,Fe=t=>t>=12704&&t<=12735,Ae=t=>t>=12736&&t<=12783,ke=t=>t>=12784&&t<=12799,Pe=t=>t>=12800&&t<=13055,Se=t=>t>=13056&&t<=13311,_e=t=>t>=13312&&t<=19903,Oe=t=>t>=19968&&t<=40959,Ie=t=>t>=40960&&t<=42127,Te=t=>t>=42128&&t<=42191,Le=t=>t>=63744&&t<=64255,Ue=t=>t>=64336&&t<=65023,ze=t=>t>=65040&&t<=65055,De=t=>t>=65072&&t<=65103,Ee=t=>t>=65104&&t<=65135,Ce=t=>t>=65136&&t<=65279,je=t=>t>=65280&&t<=65519;function Ne(t){return!((t=>t>=1536&&t<=1791)(t)||(t=>t>=1872&&t<=1919)(t)||(t=>t>=2208&&t<=2303)(t)||Ue(t)||Ce(t))}function He(t){return!!(746===t||747===t||!(t<4352)&&(Fe(t)||xe(t)||De(t)&&!(t>=65097&&t<=65103)||Le(t)||Se(t)||pe(t)||Ae(t)||!(!we(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_e(t)||Oe(t)||Pe(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Me(t)||ge(t)||(t=>t>=12688&&t<=12703)(t)||me(t)||ke(t)||be(t)&&12540!==t||!(!je(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Ee(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||ze(t)||(t=>t>=19904&&t<=19967)(t)||Ie(t)||Te(t)))}function Ve(t){return!(He(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||we(t)||be(t)||(t=>t>=57344&&t<=63743)(t)||De(t)||Ee(t)||je(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Re(t){return t>=1424&&t<=2303||Ue(t)||Ce(t)}const $e=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function We(t){for(const n of $e)if(t>=n[0]&&t<=n[1])return!0;return!1}const qe={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",H:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Be(t,n,i,e,r,s,o,a,h,u){let l=t.trim();2===u&&(l=function(t){let n="";for(let i=0;i<t.length;i++){const e=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;n+=e&&Ve(e)&&!qe[t[i+1]]||r&&Ve(r)&&!qe[t[i-1]]||!qe[t[i]]?t[i]:qe[t[i]]}return n}(l));const c=[],f={positionedGlyphs:c,text:l,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:u};let d;return d=function(t,n){const i=[];let e=0;for(let r=0;r<n.length;r++){const s=n[r];i.push(t.substring(e,s)),e=s}return e<t.length&&i.push(t.substring(e,t.length)),i}(l,function(t,n,i,e){if(!i)return[];if(!t)return[];const r=[],s=function(t,n,i,e){let r=0;for(let i=0;i<t.length;i++){const s=e[t.charCodeAt(i)];s&&(r+=s.metrics.advance+n)}return r/Math.max(1,Math.ceil(r/i))}(t,n,i,e);let o=0;for(let i=0;i<t.length;i++){const h=t.charCodeAt(i),u=e[h];u&&!Ge[h]&&(o+=u.metrics.advance+n),i<t.length-1&&(Je[h]||!((a=h)<11904)&&(Fe(a)||xe(a)||De(a)||Le(a)||Se(a)||pe(a)||Ae(a)||we(a)||_e(a)||Oe(a)||Pe(a)||je(a)||Me(a)||ge(a)||me(a)||ke(a)||be(a)||ze(a)||Te(a)||Ie(a)))&&r.push(Ye(i+1,o,s,r,Ze(h,t.charCodeAt(i+1)),!1))}var a;return function t(n){return n?t(n.priorBreak).concat(n.index):[]}(Ye(t.length,o,s,r,0,!0))}(l,o,i,n)),function(t,n,i,e,r,s,o,a,h){let u=0,l=8,c=0;const f=t.positionedGlyphs,d="right"===s?1:"left"===s?0:.5;for(let t=0;t<i.length;t++){let r=i[t];if(r=r.trim(),!r.length){l-=e;continue}const s=f.length;for(let t=0;t<r.length;t++){const i=r.charCodeAt(t),e=n[i];e&&(He(i)&&1!==o?(32!==i&&f.push({glyph:i,x:u,y:0,vertical:!0}),u+=h+a):(32!==i&&f.push({glyph:i,x:u,y:l,vertical:!1}),u+=e.metrics.advance+a))}f.length!==s&&(c=Math.max(u-a,c),Qe(f,n,s,f.length-1,d)),u=0,l-=e}const{horizontalAlign:y,verticalAlign:v}=Ke(r);!function(t,n,i,e,r,s,o){const a=(n-i)*r,h=-(-e*o+.5)*s;if(a||h)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=h}(f,d,y,v,c,e,i.length);const p=i.length*e;t.top+=-v*p,t.bottom=t.top+p,t.left+=-y*c,t.right=t.left+c}(f,n,d,e,r,s,u,o,h),!!c.length&&f}const Ge={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Je={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Xe(t,n,i,e){const r=Math.pow(t-n,2);return e?t<n?r/2:2*r:r+Math.abs(i)*i}function Ze(t,n){let i=0;return 10===t&&(i-=1e4),40!==t&&65288!==t||(i+=50),41!==n&&65289!==n||(i+=50),i}function Ye(t,n,i,e,r,s){let o=null,a=Xe(n,i,r,s);for(let t=0;t<e.length;t++){const h=e[t],u=Xe(n-h.x,i,r,s)+h.badness;u<=a&&(o=h,a=u)}return{index:t,x:n,priorBreak:o,badness:a}}function Ke(t){let n=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:n,verticalAlign:i}}function Qe(t,n,i,e,r){if(!r)return;const s=n[t[e].glyph];if(s){const n=(t[e].x+s.metrics.advance)*r;if(!n)return;for(let r=i;r<=e;r++)t[r].x-=n}}function tr(t){if(!function(t){for(const n of t)if(Re(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],i=[],e=[];let r=0,s=0,o=1,a=1;for(const h of t){const t=h.codePointAt(0);We(t)?(e.push(h),r++):(o=Re(t)?-1:1,a!==o?(s=r,i.length&&(a>0&&i.reverse(),n.push(...i)),e.length&&(n.splice(s,0,...e),e.length=0),a=o,i.length=0):e.length&&(i.push(...e),e.length=0),i.push(h),r++)}return e.length&&i.push(...e),i.length&&(a>0&&i.reverse(),n.push(...i)),n.reverse().join("")}const nr=/\\{ *([\\w_]+) *\\}/g;class ir{constructor(t,n,i,e,r){this.feature=t,this.symbolDef=n,this.symbol=i,this.options=r,this.V=this.R.bind(this),this.C=e}R(t,n){return this.feature.properties[n]||"default"}getShape(t,n){if(this.W)return this.W;const{textHorizontalAlignmentFn:i,textVerticalAlignmentFn:e,markerHorizontalAlignmentFn:r,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.C;let a;const h=this.symbol,u=this.getIconAndGlyph(),l=this.feature.properties;if(u&&u.glyph){const{font:t,text:r}=u.glyph;if(""===r)return null;const s=this.size[0]/24,c=24,f=h.textKeepUpright,d="map"===h.textRotationAlignment&&"line"===h.textPlacement&&!h.isIconText,y=n.glyphMap[t],v=er(i?i(null,l):h.textHorizontalAlignment,e?e(null,l):h.textVerticalAlignment),p=1.2*c,m=function(t){for(let n=0;n<t.length;n++)if(!Ne(t.charAt(n).charCodeAt(0)))return!1;return!0}(r),g=m&&h.textLetterSpacing/s||0,w=[h.textDx/s||0,h.textDy/s||0],M=((o?o(null,l):h.textWrapWidth)||10*c)/s;a={},a.horizontal=Be(r,y,M,p,v,"center",g,w,c,1),m&&d&&f&&(a.vertical=Be(r,y,M,p,v,"center",g,w,c,2))}else if(u&&u.icon){if(!t.positions[u.icon.url])return null;const n=er(r?r(null,l):h.markerHorizontalAlignment,s?s(null,l):h.markerVerticalAlignment);a=function(t,n){const{horizontalAlign:i,verticalAlign:e}=Ke(n),r=-24*i,s=-24*e;return{image:t,top:s,bottom:s+24,left:r,right:r+24}}(t.positions[u.icon.url],n),this.size||(this.size=a.image.displaySize)}return this.W=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:i,markerWidthFn:e,markerHeightFn:r,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:h,markerTextFitPaddingFn:u,markerLineColorFn:l,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:y,markerPathWidthFn:v,markerPathHeightFn:p,textNameFn:w,textFaceNameFn:M,textStyleFn:b,textWeightFn:x}=this.C,{zoom:F}=this.options,A={},k=this.symbol,P=this.feature.properties,S=t?t(null,P):k.markerFile,_=n?n(null,P):k.markerType,O=S||_||k.markerPath,I=!Ji(this.symbolDef.textName);let T;if(O){T=function(t,n,i,e,r,s){if(Ji(n.markerWidth)&&Ji(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let h=n.markerWidth||0,u=n.markerHeight||0;return Zi(h)&&("identity"!==h.type?h=de(h):(h=t.markerWidth,t[o]&&(h=t[o](e,i)),Zi(h)&&(h="identity"===h.type?r(e,i):de(h)))),Zi(u)&&("identity"!==u.type?u=de(u):(u=t.markerHeight,t[a]&&(u=t[a](e,i)),Zi(u)&&(u="identity"===u.type?s(e,i):de(u)))),[h,u]}(k,this.symbolDef,P,F,e,r)||[0,0];let t=k.markerTextFit;if(h&&(t=h(F,P)),t&&t&&"none"!==t){const n=k.text.textSize;let i=k.text.textName;m(i)&&(i=g(i)(F,P));const e=ve(i,P);if(e){const i="__fn_textSize".trim(),r="__fn_textSize_0".trim();m(n)&&!k.text[i]&&(k.text[r]=g(n),k.text[i]=(t,n)=>{const i=k.text[r](t,n);return m(i)?g(i)(t,n):i});const s=fe(k.text,k.text,P,F);if("width"!==t&&"both"!==t||(T[0]=s[0]*e.length),"height"!==t&&"both"!==t||(T[1]=s[1]),s[0]&&s[1]){let t=k.markerTextFitPadding||[0,0,0,0];u&&(t=u(F,P)),T[0]+=t[1]+t[3],T[1]+=t[0]+t[2]}}else T[0]=T[1]=-1}}if(I&&(T=fe(k,this.symbolDef,P,F)),!T)return A;if(T[0]=Math.ceil(T[0]),T[1]=Math.ceil(T[1]),this.size=T,O&&T[0]>=0&&T[1]>=0){let t;if(_){const n={};if(n.markerType=_,"path"===_&&(n.markerPath=i?i(null,P):k.markerPath,n.markerPathWidth=v?v(null,P):k.markerPathWidth,n.markerPathHeight=p?p(null,P):k.markerPathHeight),e){const t=e(null,P);Ji(t)||(n.markerWidth=t)}else k.markerWidth>=0&&(n.markerWidth=k.markerWidth);if(r){const t=r(null,P);Ji(t)||(n.markerHeight=t)}else k.markerHeight>=0&&(n.markerHeight=k.markerHeight);if(s){const t=s(null,P);Ji(t)||(n.markerFill=t)}else k.markerFill&&(n.markerFill=k.markerFill);if(o){const t=o(null,P);Ji(t)||(n.markerFillPatternFile=t)}else k.markerFillPatternFile&&(n.markerFillPatternFile=k.markerFillPatternFile);if(a){const t=a(null,P);Ji(t)||(n.markerFillOpacity=t)}else k.markerFillOpacity>=0&&(n.markerFillOpacity=k.markerFillOpacity);if(l){const t=l(null,P);Ji(t)||(n.markerLineColor=t)}else k.markerLineColor&&(n.markerLineColor=k.markerLineColor);if(c){const t=c(null,P);Ji(t)||(n.markerLineWidth=t)}else k.markerLineWidth>=0&&(n.markerLineWidth=k.markerLineWidth);if(f){const t=f(null,P);Ji(t)||(n.markerLineOpacity=t)}else k.markerLineOpacity>=0&&(n.markerLineOpacity=k.markerLineOpacity);if(d){const t=d(null,P);Ji(t)||(n.markerLineDasharray=t)}else k.markerLineDasharray&&(n.markerLineDasharray=k.markerLineDasharray);if(y){const t=y(null,P);Ji(t)||(n.markerLinePatternFile=t)}else k.markerLinePatternFile&&(n.markerLinePatternFile=k.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=S?S.replace(nr,this.V):k.markerPath?function(t,n,i){if(!t.markerPath)return null;let e=1;const r=function(t){const n={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return 0===n.stroke["stroke-width"]&&(n.stroke["stroke-opacity"]=0),n}(t);Xi(t.markerOpacity)&&(e=t.markerOpacity),Xi(t.opacity)&&(e*=t.opacity);const s={};if(r){for(const t in r.stroke)Qi(r.stroke,t)&&(Ji(r.stroke[t])||(s[t]=r.stroke[t]));for(const t in r.fill)Qi(r.fill,t)&&(Ji(r.fill[t])||(s[t]=r.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const h=[];for(let t=0;t<o.length;t++)a=Yi(o[t])?{path:o[t]}:o[t],a=Gi({},a,s),a.d=a.path,delete a.path,h.push(a);const u=[\'<svg version="1.1"\',\'xmlns="http://www.w3.org/2000/svg"\'];e<1&&u.push(\'opacity="\'+e+\'"\'),t.markerPathWidth&&t.markerPathHeight&&u.push(\'viewBox="0 0 \'+t.markerPathWidth+" "+t.markerPathHeight+\'"\'),u.push(\'preserveAspectRatio="none"\'),n&&u.push(\'width="\'+n+\'"\'),i&&u.push(\'height="\'+i+\'"\'),u.push("><defs></defs>");for(let t=0;t<h.length;t++){let n="<path ";for(const i in h[t])Qi(h[t],i)&&(n+=" "+i+\'="\'+h[t][i]+\'"\');n+="></path>",u.push(n)}return u.push("</svg>"),"data:image/svg+xml;base64,"+btoa(u.join(" "))}(k,T[0],T[1]):null;A.icon={url:t,size:T}}if(I){const t=w?w(null,P):k.textName;if(t||0===t){const n=function(t,n,i){return[n||"normal",i||"normal","24px",t||"monospace"].join(" ")}(M?M(null,P):k.textFaceName,b?b(null,P):k.textStyle,x?x(null,P):k.textWeight);let i=ve(t,P);i&&i.length&&(i=tr(i),A.glyph={font:n,text:i})}}return this.iconGlyph=A,A}}function er(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let i="center"!==n?n:"";return i+="center"!==t?(i.length?"-":"")+t:"",i\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function rr(t,n,i,e,r){const s=[];for(let o=0;o<t.length;o++){const a=t[o];let h;for(let t=0;t<a.length-1;t++){let o=a[t],u=a[t+1];o.x<n&&u.x<n||(o.x<n?o=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x<n&&(u=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y<i&&u.y<i||(o.y<i?o=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I():u.y<i&&(u=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I()),o.x>=e&&u.x>=e||(o.x>=e?o=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x>=e&&(u=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y>=r&&u.y>=r||(o.y>=r?o=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I():u.y>=r&&(u=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I()),h&&o.equals(h[h.length-1])||(h=[o],s.push(h)),h.push(u)))))}}return s}class sr extends Ht{constructor(t,n,i,e){super(t,n),this.angle=i,void 0!==e&&(this.segment=e)}clone(){return new sr(this.x,this.y,this.angle,this.segment)}}\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */function or(t,n,i,e,r){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const h=[];let u=0;for(;a<i/2;){const n=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(n)-n.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:a,angleDelta:s}),u+=s;a-h[0].distance>e;)u-=h.shift().angleDelta;if(u>r)return!1;o++,a+=n.dist(i)}return!0}function ar(t,n,i,e,r,s,o,a,h){const u=function(t,n,i){return t?.6*n*i:0}(e,s,o),l=function(t,n){return Math.max(t?t.right-t.left:0,n?n.right-n.left:0)}(e,r),c=0===t[0].x||t[0].x===h||0===t[0].y||t[0].y===h;return n-l*o<n/4&&(n=l*o+n/4),function t(n,i,e,r,s,o,a,h,u){const l=o/2,c=function(t){let n=0;for(let i=0;i<t.length-1;i++)n+=t[i].dist(t[i+1]);return n}(n);let f=0,d=i-e,y=[];for(let t=0;t<n.length-1;t++){const i=n[t],a=n[t+1],h=i.dist(a),v=a.angleTo(i);for(;d+e<f+h;){d+=e;const p=(d-f)/h,m=hr(i.x,a.x,p),g=hr(i.y,a.y,p);if(m>=0&&m<u&&g>=0&&g<u&&d-l>=0&&d+l<=c){const i=new sr(m,g,v,t);i.line=n,i.I(),r&&!or(n,i,o,r,s)||y.push(i)}}f+=h}return h||y.length||a||(y=t(n,f/2,e,r,s,o,a,!0,u)),y}(t,c?n/2*a%n:(l/2+2*s)*o*a%n,n,u,i,l*o,c,!1,h)}function hr(t,n,i){return t*(1-i)+n*i}function ur(t,n){const i=t.length;if(i<=1)return[t];const e=[];let r,s;for(let n=0;n<i;n++){const i=ne(t[n]);0!==i&&(t[n].area=Math.abs(i),void 0===s&&(s=i<0),s===i<0?(r&&e.push(r),r=[t[n]]):r.push(t[n]))}if(r&&e.push(r),n>1)for(let t=0;t<e.length;t++)e[t].length<=n||(Bt(e[t],n,1,e[t].length-1,lr),e[t]=e[t].slice(0,n));return e}function lr(t,n){return n.area-t.area}function cr(t,n,i){const e=n.distSqr(i);if(0===e)return t.distSqr(n);const r=((t.x-n.x)*(i.x-n.x)+(t.y-n.y)*(i.y-n.y))/e;return t.distSqr(r<0?n:r>1?i:i.sub(n).F(r).u(n))}function fr(t,n=1,i=!1){let e=1/0,r=1/0,s=-1/0,o=-1/0;const a=t[0];for(let t=0;t<a.length;t++){const n=a[t];(!t||n.x<e)&&(e=n.x),(!t||n.y<r)&&(r=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const h=Math.min(s-e,o-r);let u=h/2;const l=new Zt(null,dr);if(0===h)return new Ht(e,r);for(let n=e;n<s;n+=h)for(let i=r;i<o;i+=h)l.push(new yr(n+u,i+u,u,t));let c=function(t){let n=0,i=0,e=0;const r=t[0];for(let t=0,s=r.length,o=s-1;t<s;o=t++){const s=r[t],a=r[o],h=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*h,e+=(s.y+a.y)*h,n+=3*h}return new yr(i/n,e/n,0,t)}(t),f=l.length;for(;l.length;){const e=l.pop();(e.d>c.d||!c.d)&&(c=e,i&&console.log("found best %d after %d probes",Math.round(1e4*e.d)/1e4,f)),e.max-c.d<=n||(u=e.h/2,l.push(new yr(e.p.x-u,e.p.y-u,u,t)),l.push(new yr(e.p.x+u,e.p.y-u,u,t)),l.push(new yr(e.p.x-u,e.p.y+u,u,t)),l.push(new yr(e.p.x+u,e.p.y+u,u,t)),f+=4)}return i&&(console.log("num probes: "+f),console.log("best distance: "+c.d)),c.p}function dr(t,n){return n.max-t.max}function yr(t,n,i,e){this.p=new Ht(t,n),this.h=i,this.d=function(t,n){let i=!1,e=1/0;for(let r=0;r<n.length;r++){const s=n[r];for(let n=0,r=s.length,o=r-1;n<r;o=n++){const r=s[n],a=s[o];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),e=Math.min(e,cr(t,r,a))}}return(i?1:-1)*Math.sqrt(e)}(this.p,e),this.max=this.d+this.h*Math.SQRT2}const vr=45*Math.PI/100;function pr(t,n){const i={},e={},r=[];let s=0;function o(n){r.push(t[n]),s++}function a(t,n,i){const s=e[t];return delete e[t],e[n]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(i[0]),s}function h(t,n,e){const s=i[n];return delete i[n],i[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=e[0].concat(r[s].geometry[0]),s}function u(t,n,i){const e=i?n[0][n[0].length-1]:n[0][0];return`${t}:${e.x}:${e.y}`}for(let l=0;l<t.length;l++){const c=t[l],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(l);continue}const y=u(d,f),v=u(d,f,!0);if(y in e&&v in i&&e[y]!==i[v]){const t=h(y,v,f),n=a(y,v,r[t].geometry);delete i[y],delete e[v],e[u(d,r[n].geometry,!0)]=n,r[t].geometry=null}else y in e?a(y,v,f):v in i?h(y,v,f):(o(l),i[y]=s-1,e[v]=s-1)}return r.filter(t=>t.geometry)}class mr extends le{static needMerge(t){return t.mergeOnProperty&&("line"===t.textPlacement||"line"===t.markerPlacement)}static mergeLineFeatures(t,n,i){const e="__index".trim(),r=function(t,n,i){const e="__index".trim(),r=le.genFnTypes(n),{mergeOnPropertyFn:s}=r;if(!n.mergeOnProperty||"line"!==n.textPlacement&&"line"!==n.markerPlacement)return[];if(!(oe(o=n.mergeOnProperty)||"string"!=typeof o&&(null===o.constructor||o.constructor!==String)||"line"!==n.textPlacement&&"line"!==n.markerPlacement))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],h={},u=[];for(let r=0;r<t.length;r++){t[r][e]=r;const o=t[r].properties=t[r].properties||{};o.$layer=t[r].layer,o.$type=t[r].type;let l=n.markerPlacement;"line"!==l&&(l=n.textPlacement);const c=s?s(i,o):n.mergeOnProperty;"line"!==l||oe(c)?u.push(t[r]):(void 0===h[c]&&(h[c]=a.length,a.push({features:[],property:c})),a[h[c]].features.push(t[r]))}return u.length&&a.push({features:u}),a}(t,n,i);if(r.length){const n=[];for(let i=0;i<r.length;i++)n.push(r[i].property?pr(r[i].features,r[i].property):t);if(1===n.length)return n[0];{let t=[];for(let i=0;i<n.length;i++)t=t.concat(n[i]);return t.sort((t,n)=>t[e]-n[e]),t}}}static splitPointSymbol(t,n=0){const i=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&i.push(...mr.splitPointSymbol(n[t],t));return i}let e=null,r=null;for(const n in t)0===n.indexOf("marker")?(e=e||{},e[n]=t[n]):0===n.indexOf("text")&&(r=r||{},r[n]=t[n]);return e&&(e.isIconText=!0,t.mergeOnProperty&&(e.mergeOnProperty=t.mergeOnProperty),i.push(e)),r&&(e&&(r.textPlacement=e.markerPlacement,r.textSpacing=e.markerSpacing,r.isIconText=!0),t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),i.push(r)),void 0!==t.visible&&(e&&(e.visible=t.visible),r&&(r.visible=t.visible)),e&&(e.markerTextFit&&r&&(e.text={},e.text.textName=r.textName,e.text.textSize=r.textSize),e.index={index:n,type:0}),r&&(r.index={index:n,type:1}),i}static isAtlasLoaded(t,n){const{icon:i,glyph:e}=t,{iconAtlas:r,glyphAtlas:s}=n;if(i&&(!r||!r.positions[i.url]))return!1;if(e){if(!s||!s.positions[e.font])return!1;const t=s.positions[e.font],{text:n}=e;for(let i=0;i<n.length;i++)if(!t[n.charCodeAt(i)])return!1}return!0}constructor(t,n,i){super(t,n,i)}createStyledVector(t,n,i,e,r,s){const o=new ir(t,this.symbolDef,n,i,e),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;r[t]||(r[t]=a.icon.size),r[t][0]<n[0]&&(r[t][0]=n[0]),r[t][1]<n[1]&&(r[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:i}=a.glyph,e=s[t]=s[t]||{};for(let t=0;t<i.length;t++)e[i.charCodeAt(t)]=1;"line"===n.textPlacement&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,i=n?function(t){return"line"!==t.textPlacement||t.isIconText?[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}]:[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"},{type:Int16Array,width:2,name:"aGlyphOffset"},{type:Uint16Array,width:3,name:"aSegment"},{type:Uint8Array,width:1,name:"aVertical"}]}(t):[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}];n?i.push(...this.q()):i.push(...this.B());const{markerOpacityFn:e,textOpacityFn:r,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:h,markerRotationFn:u,textRotationFn:l,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:y}=this.C;return(e||r)&&i.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&i.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||h)&&i.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(u||l)&&i.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||y)&&i.push({type:Uint8Array,width:1,name:"aOverlap"}),i}q(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:i,textHaloRadiusFn:e,textHaloOpacityFn:r,textDxFn:s,textDyFn:o}=this.C,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),i&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),e&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloOpacity"}),s&&a.push({type:Int8Array,width:1,name:"aTextDx"}),o&&a.push({type:Int8Array,width:1,name:"aTextDy"}),a}B(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:i,markerDyFn:e}=this.C,r=[];return t&&r.push({type:Uint8Array,width:1,name:"aMarkerWidth"}),n&&r.push({type:Uint8Array,width:1,name:"aMarkerHeight"}),i&&r.push({type:Int8Array,width:1,name:"aMarkerDx"}),e&&r.push({type:Int8Array,width:1,name:"aMarkerDy"}),r}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.lineVertex=[];const t=super.createDataPack.apply(this,arguments);return t?(t.lineVertex=new Int16Array(this.lineVertex),t.buffers.push(t.lineVertex.buffer),t):null}placeVector(t,n){const i=t.getShape(this.iconAtlas,this.glyphAtlas);if(!this.options.allowEmptyPack&&!i)return;const e=this.G(t,i,n);if(0===e.length)return;const r=this.data;let s=this.data.aPosition.length/3;const o=t.symbol,a=t.feature.properties,h="line"===o.textPlacement&&!o.isIconText,u=void 0!==o.textName,l=u&&h&&function(t){let n=0;for(let i=0;i<t.length;i++)if(He(t.charAt(i).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:c,textSizeFn:f,textHaloFillFn:d,textHaloRadiusFn:y,textHaloOpacityFn:v,textDxFn:p,textDyFn:g,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:b,textAllowOverlapFn:x,textIgnorePlacementFn:F,textOpacityFn:A,markerWidthFn:k,markerHeightFn:P,markerDxFn:S,markerDyFn:_,markerPitchAlignmentFn:O,markerRotationAlignmentFn:I,markerRotationFn:T,markerAllowOverlapFn:L,markerIgnorePlacementFn:U,markerOpacityFn:z}=this.C;let D,E,C,j,N,H,V,R,$,W,q,B,G,J,X,Z,Y;if(u){const n=t.getIconAndGlyph().glyph.font;D=function(t,n,i){const e=t.positionedGlyphs,r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[o.glyph];if(!a)continue;const h=a.rect;if(!h)continue;const u=4,l=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+l,0]:[0,0],d=n?[0,o.y-c]:[o.x+l,o.y-c],y=a.metrics.left-u-l+d[0],v=a.metrics.top-u+d[1],p=y+h.w,m=v+h.h,g=new Ht(y,v),w=new Ht(p,v),M=new Ht(y,m),b=new Ht(p,m);if(n&&o.vertical){const t=new Ht(-l,l),n=-Math.PI/2,i=new Ht(5,0);g.P(n,t).u(i),w.P(n,t).u(i),M.P(n,t).u(i),b.P(n,t).u(i)}r.push({tl:g,tr:w,bl:M,br:b,tex:h,writingMode:t.writingMode,glyphOffset:f})}return r}(i.horizontal,h,this.glyphAtlas.positions[n]),c&&(E=c(null,a),m(E)?E=[0,0,0,0]:(E=Array.isArray(E)?E.map(t=>255*t):Vn(E).array(),3===E.length&&E.push(255))),f&&(C=f(this.options.zoom,a),oe(C)&&(C=14)),d&&(j=d(null,a),j=Array.isArray(j)?j.map(t=>255*t):Vn(j).array(),3===j.length&&j.push(255)),y&&(N=y(null,a)),v&&(H=255*v(null,a)),p&&(V=p(null,a)||0),g&&(R=g(null,a)||0),w&&(G=+("map"===w(null,a))),M&&(J=+("map"===M(null,a))),b&&(X=ae(b(null,a),0,360)*Math.PI/180)}else D=i?function(t){const n=t.image,i=t.top-1/n.pixelRatio,e=t.left-1/n.pixelRatio,r=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,h,u;return o=new Ht(e,i),a=new Ht(s,i),h=new Ht(s,r),u=new Ht(e,r),[{tl:o,tr:a,bl:u,br:h,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(i):function(){const t=new Ht(0,0),n=new Ht(0,0),i=new Ht(0,0);return[{tl:t,tr:n,bl:new Ht(0,0),br:i,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),k&&($=k(null,a)),P&&(W=P(null,a)),S&&(q=S(null,a)),_&&(B=_(null,a)),O&&(G=+("map"===O(null,a))),I&&(J=+("map"===I(null,a))),T&&(X=ae(T(null,a),0,360)*Math.PI/180);const K=L||x;K&&(Z=K(null,a)||0);const Q=U||F;let tt;Q&&(Y=Q(null,a)||0);const nt=A||z;nt&&(tt=255*nt(this.options.zoom,a));const it=this.options.EXTENT,et=D.length,rt=this.getAltitude(t.feature.properties);for(let t=0;t<e.length;t++){const n=e[t];if(it!==1/0&&se(n,it))continue;const i=n.x,o=n.y,a=D.length;for(let t=0;t<a;t++){const e=D[t],{tl:a,tr:c,bl:f,br:d,tex:y}=e;this.J(r,i,o,rt,10*a.x,10*a.y,y.x,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*c.x,10*c.y,y.x+y.w,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*f.x,10*f.y,y.x,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*d.x,10*d.y,y.x+y.w,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.addElements(s,s+1,s+2),this.addElements(s+1,s+2,s+3),s+=4;const v=Math.max(Math.abs(i),Math.abs(o),Math.abs(rt));v>this.maxPos&&(this.maxPos=v)}}}J(t,n,i,e,r,s,o,a){t.aPosition.push(n,i,e),t.aShape.push(r,s),t.aTexCoord.push(o,a)}X(t,n,i,e,r,s){if(t.aCount.push(i),n){t.aGlyphOffset.push(e[0],e[1]);const n=r.startIndex;t.aSegment.push(r.segment+n,n,r.line.length),t.aVertical.push(s)}}Z(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y,v,p,m){const{textFillFn:g,textSizeFn:w,textHaloFillFn:M,textHaloRadiusFn:b,textHaloOpacityFn:x,textDxFn:F,textDyFn:A,textPitchAlignmentFn:k,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:I,markerWidthFn:T,markerHeightFn:L,markerDxFn:U,markerDyFn:z,markerPitchAlignmentFn:D,markerRotationAlignmentFn:E,markerRotationFn:C,markerAllowOverlapFn:j,markerIgnorePlacementFn:N,markerOpacityFn:H}=this.C;g&&t.aTextFill.push(...n),w&&t.aTextSize.push(i),M&&t.aTextHaloFill.push(...e),b&&t.aTextHaloRadius.push(r),x&&t.aTextHaloOpacity.push(s),F&&t.aTextDx.push(o),A&&t.aTextDy.push(a),T&&t.aMarkerWidth.push(h),L&&t.aMarkerHeight.push(u),U&&t.aMarkerDx.push(l),z&&t.aMarkerDy.push(c),(H||I)&&t.aColorOpacity.push(f),(k||D)&&t.aPitchAlign.push(d),(E||P)&&t.aRotationAlign.push(y),(C||S)&&t.aRotation.push(9362*v);const V=j||_,R=N||O;(V||R)&&t.aOverlap.push((V?8:0)+4*p+((R?2:0)+m)),r>0&&(this.properties.hasHalo=1)}G(t,n,i){const{feature:e,symbol:r}=t,s=this.Y(t,r),o=e.properties,{markerSpacingFn:a,textSpacingFn:h}=this.C,u=((a?a(null,o):r.markerSpacing)||(h?h(null,o):r.textSpacing)||250)*i;return function(t,n,i,e,r,s,o){const{feature:a,size:h,symbol:u}=t,l=h?24:0,c=e*(h?h[0]/l:1),f=[];if("line"===s){let t=a.geometry;r&&(t=rr(a.geometry,0,0,r,r));for(let e=0;e<t.length;e++){const s=ar(t[e],o,vr,u.isIconText?null:i.vertical||i.horizontal||i,null,l,u.isIconText?1:c,1,r||1/0);if(u.textPlacement&&!u.isIconText)for(let t=0;t<s.length;t++)s[t].startIndex=n.length/3;if(f.push.apply(f,s),u.textPlacement&&!u.isIconText)for(let i=0;i<t[e].length;i++)n.push(t[e][i].x,t[e][i].y,0)}}else if(3===a.type){const t=ur(a.geometry,0);for(let n=0;n<t.length;n++){const i=t[n];if("vertex"===s)for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t])}else{const t=fr(i,16);se(t,r)||f.push(t)}}}else if(2===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];if("vertex"===s)for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t]);else se(n[0],r)||f.push(n[0])}else if(1===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,r)||f.push(i)}}return f}(t,this.lineVertex,n,i,this.options.EXTENT,s,u)}Y(t,n){return this.C.markerPlacementFn?this.C.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||n.textPlacement}}const gr=Math.cos(Math.PI/180*37.5),wr=Math.pow(2,16)/1;class Mr extends le{constructor(t,n,i){super(t,n,i);let e=!1;const{lineDasharrayFn:r,lineDashColorFn:s}=this.C;r&&(e=function(t,n,i){for(let e=0;e<t.length;e++)if(i(n,t[e].properties))return!0;return!1}(t,this.options.zoom,r),e&&(this.dasharrayFn=r)),(Fr(this.symbol.lineDasharray)||e)&&s&&(this.dashColorFn=s)}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getLineResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:i,lineColorFn:e,lineOpacityFn:r,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:h}=this.C,u=[{type:Int16Array,width:3,name:"aPosition"}];if(u.push(this.options.center||this.iconAtlas?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),u.push({type:Uint16Array,width:1,name:"aLinesofar"}),t&&u.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&u.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),e&&u.push({type:Uint8Array,width:4,name:"aColor"}),i&&u.push({type:Uint8Array,width:4,name:"aStrokeColor"}),r&&u.push({type:Uint8Array,width:1,name:"aOpacity"}),this.symbol.lineOffset&&u.push({type:Int8Array,width:2,name:"aExtrudeOffset"}),this.dasharrayFn&&u.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&u.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();u.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return s&&u.push({type:Int8Array,width:1,name:"aLineDx"}),o&&u.push({type:Int8Array,width:1,name:"aLineDy"}),a&&u.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),h&&u.push({type:Uint8Array,width:1,name:"aLinePatternGap"}),u}placeVector(t){const{lineJoinFn:n,lineCapFn:i,lineWidthFn:e,lineStrokeWidthFn:r,lineStrokeColorFn:s,lineColorFn:o,lineOpacityFn:a,lineJoinPatternModeFn:h,lineDxFn:u,lineDyFn:l,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.C,d=this.symbol,y=t.feature,v=3===y.type,p=y.properties,g=this.elements;v&&(this.elements=[]);let w=d.lineJoin||"miter",M=d.lineCap||"butt";if(n&&(w=n(this.options.zoom,p)||"miter"),i&&(M=i(this.options.zoom,p)||"butt"),e){let t=e(this.options.zoom,p);Ji(t)&&(t=4),this.feaLineWidth=t}else this.feaLineWidth=d.lineWidth;if(r){let t=r(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(o&&(this.feaColor=o(this.options.zoom,p)||[0,0,0,255],m(this.feaColor)?this.feaColor=[0,0,0,0]:(this.feaColor=Array.isArray(this.feaColor)?this.feaColor.map(t=>255*t):Vn(this.feaColor).array(),3===this.feaColor.length&&this.feaColor.push(255))),s&&(this.feaStrokeColor=s(this.options.zoom,p)||[0,0,0,255],m(this.feaStrokeColor)?this.feaStrokeColor=[0,0,0,0]:(this.feaStrokeColor=Array.isArray(this.feaStrokeColor)?this.feaStrokeColor.map(t=>255*t):Vn(this.feaStrokeColor).array(),3===this.feaStrokeColor.length&&this.feaStrokeColor.push(255))),a){let t=a(this.options.zoom,p);Ji(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,p)||[0,0,0,0];if(t.length<4){const n=t;1===t.length?t=[n[0],n[0],n[0],n[0]]:2===t.length?t=[n[0],n[1],n[0],n[1]]:3===t.length&&(t=[n[0],n[1],n[2],n[2]])}this.feaDash=t}if(this.dashColorFn){let t=(this.dashColorFn?this.dashColorFn(this.options.zoom,p):this.symbol.lineDashColor)||[0,0,0,0];t=Array.isArray(t)?t.map(t=>255*t):Vn(t).array(),3===t.length&&t.push(255),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),i=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],i){const{tl:t,displaySize:i}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=i[0]-3,this.feaTexInfo[3]=i[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0;this.feaJoinPatternMode=h?h(this.options.zoom,p)||0:d.lineJoinPatternMode||0}if(u){let t=u(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDx=t}if(l){let t=l(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,p);Ji(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,p);Ji(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let x=y.geometry;b!==1/0&&3!==y.type&&(x=rr(y.geometry,-1,-1,b+1,b+1));for(let t=0;t<x.length;t++)this.offset=this.data.aPosition.length/3,this.K(x[t],y,w,M,2,1.05),v&&(this.tt(g),this.elements=[]);v&&(this.elements=g)}nt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}K(t,n,i,e,r,s){const o=this.nt()||Fr(this.feaDash)||Fr(this.symbol.lineDasharray);this.overscaling=1;const a=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.symbol.lineGradientProperty&&n.properties&&Qi(n.properties,"mapbox_clip_start")&&Qi(n.properties,"mapbox_clip_end")){this.clipStart=+n.properties.mapbox_clip_start,this.clipEnd=+n.properties.mapbox_clip_end;for(let n=0;n<t.length-1;n++)this.totalDistance+=t[n].dist(t[n+1]);this.updateScaledDistance()}const h=3===n.type;let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let l=0;for(;l<u-1&&t[l].equals(t[l+1]);)l++;if(u<(h?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?15*a/(512*this.overscaling):0,f={vertexLength:0,primitiveLength:0};let d,y,v,p,m;this.e1=this.e2=-1,h&&(d=t[u-2],m=t[l].sub(d)._().O());for(let n=l;n<u;n++){if(v=n===u-1?h?t[l+1]:void 0:t[n+1],v&&t[n].equals(v))continue;m&&(p=m),d&&(y=d),d=t[n],m=v?v.sub(d)._().O():p,p=p||m;let a=p.add(m);0===a.x&&0===a.y||a._();const g=p.x*m.x+p.y*m.y,w=a.x*m.x+a.y*m.y,M=0!==w?1/w:1/0,b=2*Math.sqrt(2-2*w),x=w<gr&&y&&v,F=p.x*m.y-p.y*m.x>0;if(!o&&x&&n>l){const t=d.dist(y);if(t>2*c){const n=d.sub(d.sub(y).F(c/t).I());this.updateDistance(y,n),this.addCurrentVertex(n,p,0,0,f),y=n}}const A=y&&v;let k=A?i:h?"butt":e;if(A&&"round"===k&&(M<s?k="miter":M<=2&&(k="fakeround")),"miter"===k&&M>r&&(k="bevel"),"bevel"===k&&(M>2&&(k="flipbevel"),M<r&&(k="miter")),y&&this.updateDistance(y,d),(n>l&&n<u-1||h&&n===u-1)&&o){const t=this.feaJoinPatternMode?0:-p.mag()*w;this.addCurrentVertex(d,p,t,t,f),this.it=1}if("miter"===k)a.F(M),this.addCurrentVertex(d,a,0,0,f);else if("flipbevel"===k){if(M>100)a=m.mult(-1);else{const t=M*p.add(m).mag()/p.sub(m).mag();a.O().F(t*(F?-1:1))}this.addCurrentVertex(d,a,0,0,f),this.addCurrentVertex(d,a.mult(-1),0,0,f)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(M*M-1),n=F?t:0,i=F?0:t;if(y&&this.addCurrentVertex(d,p,n,i,f),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let n=1;n<t;n++){let i=n/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const e=m.sub(p).F(i).u(p)._().F(F?-1:1);this.addHalfVertex(d,e.x,e.y,!1,F,0,f)}}v&&this.addCurrentVertex(d,m,-n,-i,f)}else if("butt"===k)this.addCurrentVertex(d,a,0,0,f);else if("square"===k){const t=y?1:-1;this.addCurrentVertex(d,a,t,t,f)}else"round"===k&&(y&&(this.addCurrentVertex(d,p,0,0,f),this.addCurrentVertex(d,p,1,1,f,!0)),v&&(this.addCurrentVertex(d,m,-1,-1,f,!0),this.addCurrentVertex(d,m,0,0,f)));if(!o&&x&&n<u-1){const t=d.dist(v);if(t>2*c){const n=d.add(v.sub(d).F(c/t).I());this.updateDistance(d,n),this.addCurrentVertex(n,m,0,0,f),d=n}}if((n>l&&n<u-1||h&&n===l)&&o){delete this.it;const t=this.feaJoinPatternMode?0:m.mag()*w;this.addCurrentVertex(d,m,t,t,f)}}}addCurrentVertex(t,n,i,e,r,s=!1){const o=n.y*e-n.x,a=-n.y-n.x*e;this.addHalfVertex(t,n.x+n.y*i,n.y-n.x*i,s,!1,i,r),this.addHalfVertex(t,o,a,s,!0,-e,r),this.distance>wr/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,i,e,r,s))}addHalfVertex({x:t,y:n},i,e,r,s,o,a){this.fillData(this.data,t,n,i,e,r,s,1*this.scaledDistance);const h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),a.primitiveLength++),s?this.e2=h:this.e1=h}fillData(t,n,i,e,r,s,o,a){const{lineWidthFn:h,lineStrokeWidthFn:u,lineStrokeColorFn:l,lineColorFn:c,lineOpacityFn:f,lineDxFn:d,lineDyFn:y,linePatternAnimSpeedFn:v,linePatternGapFn:p}=this.C;if(this.options.center?t.aPosition.push(n,i,0):t.aPosition.push(n=(n<<1)+(s?1:0),i=(i<<1)+(o?1:0),0),t.aExtrude.push(63*e,63*r),this.options.center||this.iconAtlas){let n=0;this.options.center&&(n+=2*s+o),this.iconAtlas&&(n+=4*(this.it&&this.feaJoinPatternMode?1:0)),t.aExtrude.push(n)}t.aLinesofar.push(a),h&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),u&&t.aLineStrokeWidth.push(Math.round(2*this.feaLineStrokeWidth)),c&&t.aColor.push(...this.feaColor),l&&t.aStrokeColor.push(...this.feaStrokeColor),f&&t.aOpacity.push(this.feaOpacity),this.dasharrayFn&&t.aDasharray.push(...this.feaDash),this.dashColorFn&&t.aDashColor.push(...this.feaDashColor),this.iconAtlas&&t.aTexInfo.push(...this.feaTexInfo),d&&t.aLineDx.push(this.feaLineDx),y&&t.aLineDy.push(this.feaLineDy),v&&t.aLinePatternAnimSpeed.push(127*this.feaPatternAnimSpeed),p&&t.aLinePatternGap.push(10*this.feaLinePatternGap),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(i)+1)}addElements(t,n,i){super.addElements(this.offset+t,this.offset+n,this.offset+i)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=3)n!==1/0&&(xr(this.data.aPosition,i[e],i[e+1],3,n)||xr(this.data.aPosition,i[e+1],i[e+2],3,n))||t.push(i[e],i[e+1],i[e+2])}et(t){if(t.length<=1)return t;const n=[],i=this.options.EXTENT;let e,r=!0;for(e=0;e<t.length-1;e++){const s=br(t[e],t[e+1],i);s&&r||(n.push(t[e]),r=s)}return r||n.push(t[e]),n}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(wr-1):this.distance}}function br(t,n,i){return i!==1/0&&(t.x<0&&n.x<0||t.x>i&&n.x>i||t.y<0&&n.y<0||t.y>i&&n.y>i)}function xr(t,n,i,e,r){if(r===1/0)return!1;const s=Math.floor(.5*t[n*e]),o=Math.floor(.5*t[n*e+1]),a=Math.floor(.5*t[i*e]),h=Math.floor(.5*t[i*e+1]);return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function Fr(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}class Ar extends Mr{constructor(t,n,i){super(t,n,i),this.rt=i.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.C,i=[{type:Int16Array,width:3,name:"aPosition"},{type:Uint16Array,width:1,name:"aLinesofar"},{type:Uint8Array,width:1,name:"aUp"},{type:Int16Array,width:3,name:"aExtrudedPosition"},{type:Int8Array,width:2,name:"aExtrude"}];return t&&i.push({type:Uint8Array,width:4,name:"aColor"}),n&&i.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.rt&&i.push({type:Array,width:1,name:"aLineHeight"}),i}placeVector(t){const n=t.feature;if(this.rt){const{altitudeScale:t,altitudeProperty:i,defaultAltitude:e,heightProperty:r,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:h}=re(n,t,i,e,r,s,o);this.feaAltitude=a,this.feaMinHeight=(a-h)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}K(t,n,i,e,r,s){const o=this.data.aPosition.length/3;super.K(t,n,i,e,r,s);const a=this.data.aPosition.length/3,h=this.data.aPosition.length/3-this.offset;if(3!==n.type&&h>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[o*e+3*e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*n+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*(n+3)+t])}super.addElements(t+1,h+1,h),super.addElements(h,h+1,h+2);const e=this.data.aPosition.length/3-this.offset;i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[a*e-e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-r+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-3*r+t])}super.addElements(e,h-3,e+1),super.addElements(h-3,e+2,e+1)}}fillData(t,n,i,e,r,s,o,a){const h=!1!==this.options.top,u=!1!==this.options.side,l=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),c=63*e,f=63*r,d=l*e+n,y=l*r+i;this.st(t,n,i,e,r,s,o,a,d,y,c,f),u&&(h&&this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(i))}st(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,32767),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}ot(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,this.feaMinHeight||0),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}addElements(t,n,i){const e=!1!==this.options.top,r=!1!==this.options.side,s=(e?1:0)+(r?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(i*=s)+4]){if(e&&super.addElements(n,t,i),r){const t=e?1:0;super.addElements(n+t,i+t,i+t+2),super.addElements(n+t+1,i+t+1+2,n+t+1+2)}}else if(e&&super.addElements(t,i,n),r){const n=e?1:0;super.addElements(t+n,t+n+2,i+n),super.addElements(t+n+1+2,i+n+1+2,i+n+1)}}createDataPack(t,n){this.maxAltitude=0;const i=super.createDataPack(t,n);if(!i)return i;const{data:e,indices:r}=i;this.getFormat().reduce((t,n)=>(t[n.name]={size:n.width},t),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:h,aExtrude:u,aColor:l,aLineHeight:c,aLineWidth:f}=e,d={},y=Xn(s,r);let v,p=!0;for(let t=0;t<y.length;t++)y[t]=-y[t],y[t]%1!=0&&(p=!1);if(!1!==this.options.top&&this.symbol.material&&function(t){for(const n in t)if(n.indexOf("Texture")>=0&&t[n])return!0;return!1}(this.symbol.material)&&(v=function(t,n,i){const e=[];for(let r=0;r<t.length;r+=3){const t=n[r/3];e.push(t/256,i[r/3]?1:0)}return e}(s,a,h)),d.aPosition=o,v&&(d.aTexCoord0=new Float32Array(v)),d.aNormal=p?new Int8Array(y):new Float32Array(y),d.aPickingId=e.aPickingId,d.aExtrude=u,l&&(d.aColor=l),f&&(d.aLineWidth=f),c){const t=Wi(this.maxAltitude);d.aLineHeight=new t(c)}const m=[];for(const t in d)m.push(d[t].buffer);return i.data=d,i.buffers=m,i}}const kr=Math.pow(2,16)/1;class Pr extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=t.feature,i=3===n.type,e=n.geometry,r=this.elements;i&&(this.elements=[]);for(let t=0;t<e.length;t++)this.offset=this.data.aPosition.length/3,this.K(e[t],n),i&&(this.tt(r),this.elements=[]);i&&(this.elements=r)}K(t,n){const i=3===n.type;let e=t.length;for(;e>=2&&t[e-1].equals(t[e-2]);)e--;let r,s,o,a=0;for(;a<e-1&&t[a].equals(t[a+1]);)a++;if(!(e<(i?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,i&&(r=t[e-2]);for(let n=a;n<e;n++)o=i&&n===e-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(r&&(s=r),r=t[n],s&&(this.distance+=r.dist(s)),this.addCurrentVertex(r,this.distance))}}addCurrentVertex(t,n){const i=this.vertexLength++;this.addLineVertex(this.data,t,n),i>=1&&this.addElements(i-1,i),n>kr&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){t.aPosition.push(n.x,n.y,0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){super.addElements(this.offset+t,this.offset+n)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=2)ie(this.data.aPosition,i[e],i[e+1],3,n)||t.push(i[e],i[e+1])}}const Sr=45*Math.PI/100;class _r extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=this.G(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point"),i=this.getAltitude(t.feature.properties);for(let t=0;t<n.length;t++){const e=n[t];this.data.aPosition.push(e.x,e.y),this.data.aPosition.push(i);const r=Math.max(Math.abs(e.x),Math.abs(e.y));r>this.maxPos&&(this.maxPos=r)}}G(t,n,i){const e=t.feature,r=t.feature.type,s=this.options.EXTENT,o=[];if("line"===i){let t=e.geometry;s&&(t=rr(e.geometry,0,0,s,s));for(let i=0;i<t.length;i++){const e=ar(t[i],n,Sr,null,null,24,1,1,s||1/0);o.push.apply(o,e)}}else if(3===r){const t=ur(e.geometry,0);for(let n=0;n<t.length;n++){const i=fr(t[n],16);se(i,s)||o.push(i)}}else if(2===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];se(n[0],s)||o.push(n[0])}else if(1===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,s)||o.push(i)}}return o}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const Or=[],Ir=[];function Tr(t,n){var i,e,r,s,o,a,h;for(e=1;e<=8;e*=2){for(i=[],s=!(Ur(r=t[t.length-1],n)&e),o=0;o<t.length;o++){if((h=!(Ur(a=t[o],n)&e))!==s){const t=Lr(r,a,e,n);i.push(void 0!==a.x?new Ht(t[0],t[1]):t)}h&&i.push(a),r=a,s=h}if(!(t=i).length)break}return i}function Lr(t,n,i,e){return Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y,t=Or,Ir[0]=void 0===n.x?n[0]:n.x,Ir[1]=void 0===n.y?n[1]:n.y,n=Ir,8&i?[t[0]+(n[0]-t[0])*(e[3]-t[1])/(n[1]-t[1]),e[3]]:4&i?[t[0]+(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1]),e[1]]:2&i?[e[2],t[1]+(n[1]-t[1])*(e[2]-t[0])/(n[0]-t[0])]:1&i?[e[0],t[1]+(n[1]-t[1])*(e[0]-t[0])/(n[0]-t[0])]:null}function Ur(t,n){Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y;var i=0;return(t=Or)[0]<n[0]?i|=1:t[0]>n[2]&&(i|=2),t[1]<n[1]?i|=4:t[1]>n[3]&&(i|=8),i}class zr extends le{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getPolygonResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const t=[{type:Int16Array,width:3,name:"aPosition"}],{polygonFillFn:n,polygonOpacityFn:i,uvScaleFn:e,uvOffsetFn:r}=this.C;if(this.iconAtlas){const n=this.getIconAtlasMaxValue();t.push({type:n>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return n&&t.push({type:Uint8Array,width:4,name:"aColor"}),i&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),e&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),r&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),t}createDataPack(...t){this.maxLineIndex=0,this.lineElements=[];const n=super.createDataPack(...t);if(!n)return n;let i=this.lineElements;return i=new($i(this.maxLineIndex))(this.lineElements),n.lineIndices=i,n.buffers.push(i.buffer),n}placeVector(t,n){const i=t.feature;this.at(i.geometry,i,n)}at(t,n){let i,e,r,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:h,uvOffsetFn:u}=this.C,l=n.properties;o&&(i=o(this.options.zoom,l)||[255,255,255,255],m(i)?i=[0,0,0,0]:(i=Array.isArray(i)?i.map(t=>255*t):Vn(i).array(),3===i.length&&i.push(255))),a&&(e=a(this.options.zoom,l),Ji(e)&&(e=1),e*=255),h&&(r=h(this.options.zoom,l),Ji(r)&&(r=[1,1]),r=[255*r[0],255*r[1]]),u&&(s=u(this.options.zoom,l),Ji(s)&&(s=[0,0]),s=[255*s[0],255*s[1]]);const c=!!this.iconAtlas,f=ur(t,500),d=this.getAltitude(l),y=[0,0],v=[0,0];if(c){const{polygonPatternFileFn:t}=this.C,n=t?t(null,l):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n];y[0]=t.tl[0]+1,y[1]=t.tl[1]+1,v[0]=t.displaySize[0]-3,v[1]=t.displaySize[1]-3}}const p=[-1,-1,n.extent+1,n.extent+1];for(let t=0;t<f.length;t++){const n=f[t],o=this.data.aPosition.length/3,a=[],h=[];for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&(o=Tr(o,p)),0===o.length)continue;0!==t&&h.push(a.length/2);const u=this.lineElements.length;this.data.aPosition.push(o[0].x,o[0].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[0].x),Math.abs(o[0].y)),this.addLineElements(u+o.length-1,u),a.push(o[0].x),a.push(o[0].y);for(let t=1;t<o.length;t++)this.data.aPosition.push(o[t].x,o[t].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[t].x),Math.abs(o[t].y)),this.addLineElements(u+t-1,u+t),a.push(o[t].x),a.push(o[t].y)}const u=ki(a,h);for(let t=0;t<u.length;t+=3)this.addElements(o+u[t],o+u[t+1],o+u[t+2])}}addLineElements(...t){this.maxLineIndex=Math.max(this.maxLineIndex,...t),this.lineElements.push(...t)}}var Dr=Object.freeze({__proto__:null,clipPolygon:Tr,calculateSignedArea:ne,getFeaAltitudeAndHeight:re,convertRTLText:tr});const Er={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textStyle:1,textFaceName:1,textWeight:1,textPlacement:1,textSpacing:1,lineJoin:1,lineCap:1,linePatternFile:1};Object.assign({visible:1,textHorizontalAlignment:1,textVerticalAlignment:1,textWrapWidth:1,markerHorizontalAlignment:1,markerVerticalAlignment:1},Er),Object.assign({lineDasharray:1},Er);function Cr(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y){const v=n.length,p=r/3;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v,(i=i||[]).push(v/3);for(let n=0;n<i.length;n++){jr(p+(i[n-1]||0),p+i[n],t,v/3,a,e,h,u,l,c,f,d,y)}return r}function jr(t,n,i,e,r,s,o,a,h,u,l,c,f){const d=s.length;let y,v;for(let o=t,a=n;o<a-1;o++)y=o,v=o+1,ct(i,y,v,r)||((o-t)%2==1&&(y+=2*e,v+=2*e),s.push(y+e,y,v),s.push(v,v+e,y+e));o&&function(t,n,i,e,r,s,o,a,h){let u,l=0,c=0,f=0,d=0;for(let y=e.length-1;y>=0;y--){const v=3*e[y],p=3*e[y]+1,m=3*e[y]+2,g=i[v],w=i[p],M=i[m];l||c||(l=Math.max(i[m],i[3*e[y-2]+2]),c=Math.min(i[m],i[3*e[y-2]+2]),u=l-c);let b=f;const x=y%6;0===t?(5===x&&(d=Nt(i,e,y,g,w)),b=2===x||3===x||4===x?f:f+d):1===t&&(2===x||3===x||4===x?b=0:5===x?(d=Nt(i,e,y,g,w),b=d):b=d);const F=b*o*a/r,A=M===l?0:u*h/s;n[v/3*2]=F,n[v/3*2+1]=-A,0===x&&(f+=d)}}(a,h,i,s.slice(d,s.length),u[0],u[1],l,c,f)}function Nr(t,n,i,e,r,s,o,a,h,u){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0);const{altitudeScale:l,altitudeProperty:c,defaultAltitude:f,heightProperty:d,minHeightProperty:y,defaultHeight:v,tangent:p,uv:m,uvScale:M,topUVMode:b,sideUVMode:x,top:F,side:A,topThickness:k}=n,S=function(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a},{side:h,top:u,topThickness:l,uvOrigin:c,uv:f,uvSize:d,topUVMode:y,sideUVMode:v,glScale:p,localScale:m,vScale:g},w){const M=n/t[0].extent,b=[],x=[],F=[],A=[],k=[],S=[],_=!!f,O=!!u,T=!!h,z=_?[]:null;function D(t,i,e,r){if(O){const r=ki(A,e,3);if(0===r.length)return i;let s;I(k,A),i+=A.length;for(let n=2,i=r.length;n<i;n+=3)s=r[n-1],r[n-1]=r[n]+t/3,r[n]=s+t/3,r[n-2]+=t/3;I(S,r),_&&Et(y||0,t,i,z,k,0,p,m,d[0],d[1]),l>0&&!T&&(i=Cr(k,A,e,S,i,0,l,n,_,v||0,z,d,p,m,g))}return T&&(O&&(l=0),i=Cr(k,A,e,S,i,l,r,n,_,v||0,z,d,p,m,g)),i}let E=0,C=0;const j=[-1,-1,n+1,n+1];let N=0,H=t.length;void 0!==w&&(N=w,H=w+1);let V=0,R=!1;for(;N<H;N++){const h=t[N],u=h.id;P(u)&&(Math.abs(u)>V&&(V=Math.abs(u)),u<0&&(R=!0));const l=h.geometry,{altitude:c,height:f}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);E=Math.max(Math.abs(c),E);const d=k.length;let y=C,v=[];A.length=0;for(let t=0,i=l.length;t<i;t++){const e=Dr.calculateSignedArea(l[t])<0;!e&&t>0&&(C=D(y,C,v,f*M),A.length=0,v=[],y=C);let r=l[t];if(n!==1/0&&(r=Dr.clipPolygon(r,j)),!r.length){t===i-1&&(C=D(y,C,v,f*M));continue}const s=r.length;Array.isArray(r[0])?r[0][0]===r[s-1][0]&&r[0][1]===r[s-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[s-1].x&&r[0].y===r[s-1].y||r.push(r[0]),e&&v.push(A.length/3),lt(A,A.length,r,M,c),t===i-1&&(C=D(y,C,v,f*M))}const p=k.length-d,m="__fea_idx".trim();for(let t=0;t<p/3;t++)x.push(void 0===h[m]?N:h[m]),b.push(N),P(u)&&F.push(u)}const $=L(x.length?x[x.length-1]:0),W={maxAltitude:E,vertices:new(U(Math.max(512,E)))(k),indices:S,pickingIds:new $(x),featureIndexes:b};if(F.length){const t=R?U(V):L(V);W.featureIds=new t(F)}else W.featureIds=[];return z&&(z.length=k.length/3*2,W.uvs=z),W}(t,i,{altitudeScale:l,altitudeProperty:c,defaultAltitude:f||0,heightProperty:d,minHeightProperty:y,defaultHeight:v||0},{top:F,side:A,topThickness:10*k||0,uv:m||p,uvSize:M?[.5*M[0],.5*M[1]]:[.5,.5],uvOrigin:e,topUVMode:b,sideUVMode:x,glScale:r,localScale:o,vScale:s},u),_=[],O=new(T(S.vertices.length/3))(S.indices);delete S.indices,_.push(O.buffer,S.vertices.buffer,S.pickingIds.buffer);const z=Xn(S.vertices,O);let E=!0;for(let t=0;t<z.length;t++)z[t]=-z[t],z[t]%1!=0&&(E=!1);if(S.normals=z,p){let t=function(t,n,i,e){const r=t.length/3,s=new Array(4*r),o=[],a=[];for(let t=0;t<r;t++)o[t]=[0,0,0],a[t]=[0,0,0];const h=[0,0,0],u=[0,0,0],l=[0,0,0],c=[0,0],f=[0,0],d=[0,0],y=[0,0,0],v=[0,0,0];function p(n,e,r){Zn(h,t,3*n),Zn(u,t,3*e),Zn(l,t,3*r),Yn(c,i,2*n),Yn(f,i,2*e),Yn(d,i,2*r);const s=u[0]-h[0],p=l[0]-h[0],m=u[1]-h[1],g=l[1]-h[1],w=u[2]-h[2],M=l[2]-h[2],b=f[0]-c[0],x=d[0]-c[0],F=f[1]-c[1],A=d[1]-c[1],k=1/(b*A-x*F);bt(y,(A*s-F*p)*k,(A*m-F*g)*k,(A*w-F*M)*k),bt(v,(b*p-x*s)*k,(b*g-x*m)*k,(b*M-x*w)*k),xt(o[n],o[n],y),xt(o[e],o[e],y),xt(o[r],o[r],y),xt(a[n],a[n],v),xt(a[e],a[e],v),xt(a[r],a[r],v)}for(let t=0,n=e.length;t<n;t+=3)p(e[t+0],e[t+1],e[t+2]);const m=[],g=[],w=[],M=[];let b,x,F;function A(t){Zn(w,n,3*t),Mt(M,w),x=o[t],Mt(m,x),St(m,m,function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}(w,w,kt(w,x))),At(m,m),Pt(g,M,x),F=kt(g,a[t]),b=F<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,n=e.length;t<n;t+=3)A(e[t+0]),A(e[t+1]),A(e[t+2]);return s}(S.vertices,S.normals,S.uvs,O);t=function(t,n){const i=new Float32Array(n.length),e=[],r=[],s=[];for(let o=0;o<n.length;o+=4){const a=o/4*3;bt(r,t[a]||0,t[a+1]||0,t[a+2]||0),Ot(e,n[o]||0,n[o+1]||0,n[o+2]||0,n[o+3]||0),Jn(s,r,e),_t(i.subarray(o,o+4),s)}return i}(S.normals,t),S.tangents=t,_.push(t.buffer),delete S.normals}if(S.normals&&(S.normals=E?new Int8Array(S.normals):new Float32Array(S.normals),_.push(S.normals.buffer)),S.uvs){const t=S.uvs;S.uvs=new Float32Array(t),_.push(S.uvs.buffer)}const C=function(t,n,i,e){const r={};if(D(n.polygonFill)){const s={},o=w(n.polygonFill),a=new Uint8Array(4*e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],h=r.properties||{};h.$layer=r.layer,h.$type=r.type;let u=o(i,h);if(delete h.$layer,delete h.$type,Array.isArray(u)||(u=s[u]=s[u]||Vn(u).array()),Array.isArray(u)){for(let t=0;t<u.length;t++)Hr[t]=255*u[t];3===u.length&&(Hr[3]=255)}a[4*n]=Hr[0],a[4*n+1]=Hr[1],a[4*n+2]=Hr[2],a[4*n+3]=Hr[3]}r.aColor=a}if(D(n.polygonOpacity)){const s=g(n.polygonOpacity),o=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],a=r.properties||{};a.$layer=r.layer,a.$type=r.type;const h=s(i,a);delete a.$layer,delete a.$type,o[n]=255*h}r.aOpacity=o}return r}(t,a,h,S.featureIndexes),j={data:{data:{aPosition:S.vertices,aNormal:S.normals,aTexCoord0:S.uvs,aTangent:S.tangents,aPickingId:S.pickingIds},indices:O,properties:{maxAltitude:S.maxAltitude}},buffers:_};return S.featureIds.length?(j.data.featureIds=S.featureIds,_.push(j.data.featureIds.buffer)):j.data.featureIds=[],C.aColor&&(j.data.data.aColor=C.aColor,j.buffers.push(C.aColor.buffer)),C.aOpacity&&(j.data.data.aOpacity=C.aOpacity,j.buffers.push(C.aOpacity.buffer)),j}const Hr=[];function Vr(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a,bottom:h}){const u=h,l=n/t[0].extent,c=2*function(t,n){let i=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(P(r.geometry[0][0])){const t=3*r.geometry.length;i+=n?2*t-6:t}else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),i+=n?2*e-6:e}}return i}(t)+3*t.length*2,f=[],d=new Int16Array(c),y=[];function v(t,i,e){const r=i-t,s=d.subarray(t,i),o=d.subarray(i,i+r);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-e;const a=t/3,h=r/3;let l,c;for(let t=a,i=h+a;t<i;t++)t<i-1?(l=t,c=t+1):(l=t,c=a),ct(d,l,c,n)||(y.push(l,c),u&&y.push(l+h,c+h),Rr(d,l,n)||y.push(l,l+h));return i+r}let p=0,m=0;const g="__fea_idx".trim();for(let n=0,h=t.length;n<h;n++){const h=t[n],u=h.geometry,{altitude:c,height:w}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);m=Math.max(Math.abs(c),m);let M=p;for(let t=0,n=u.length;t<n;t++){let n=u[t];const i=n.length;n[0][0]===n[i-1][0]&&n[0][1]===n[i-1][1]&&(n=n.slice(0,i-1)),p=lt(d,M,n,l,c),p=v(M,p,w*l),M=p}const b=y.length-f.length;for(let t=0;t<b;t++)f.push(h[g])}const w=new(T(y.reduce((t,n)=>Math.max(t,n),0)))(y),M=L(t.length);return{aPosition:new(U(Math.max(512,m)))(d),indices:w,aPickingId:new M(f)}}function Rr(t,n,i){const e=t[3*n],r=t[3*n+1];return e<0||e>i||r<0||r>i}function $r(t,n,i){const e=Vr(t,i,n),r=[e.aPosition.buffer,e.indices.buffer,e.aPickingId.buffer],s=e.indices;return delete e.indices,{data:{data:e,indices:s},buffers:r}}class Wr{constructor(t,n,i,e,r){this.id=t,this.options=n,this.upload=i,this.ht(n.style),this.requests={},this.ut=0,this.lt=e,this.loadings=r}updateStyle(t,n){this.options.style=t,this.ht(t),this.ut++,n()}updateOptions(t,n){this.options=A(this.options,t),n()}loadTile(t,n){const i=this.loadings,e=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:i,y:e,z:s}=t.tileInfo;if(s!==r.z||i!==r.x||e!==r.y)return void n()}if(this.lt.has(e)){const{features:r,layers:s}=this.lt.get(e),o=i[e];if(delete i[e],!r||!r.length)return this.ct(o),void n();if(o)for(let n=0;n<o.length;n++)this.ft.call(o[n].ref,t,o[n].callback,e,s,r);this.ft(t,n,e,s,r)}else i[e]?i[e].push({callback:n,ref:this}):(i[e]=[{callback:n,ref:this}],this.requests[e]=this.getTileFeatures(t.tileInfo,(n,r,s,o)=>{const a=i[e];if(delete i[e],this.checkIfCanceled(e))return delete this.requests[e],void this.ct(a,null,{canceled:!0});if(delete this.requests[e],this.options.debug&&r)for(let n=0;n<r.length;n++)r[n]._debug_info={index:n,tileId:t.tileInfo.id};if(n)return n.loading||this.lt.add(e,{features:[],layers:[]}),void this.ct(a,n);if(!r||!r.length)return this.lt.add(e,{features:[],layers:[]}),void this.ct(a);if(this.lt.add(e,{features:r,layers:s}),a)for(let n=0;n<a.length;n++)this.ft.call(a[n].ref,t,a[n].callback,e,s,r,o)}))}ft(t,n,i,e,r,s){this.dt(e,r,t).then(t=>{t.canceled?n(null,{canceled:!0}):(t.data.style=this.ut,s&&A(t.data,s),n(null,t.data,t.buffers))}).catch(t=>{n(t)})}abortTile(t,n){delete this.requests[t],this.yt(t),n()}yt(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}ct(t,n,i){if(t)for(let e=0;e<t.length;e++)t[e].callback(n,i)}checkIfCanceled(t){return!this.requests[t]}fetchIconGlyphs(t,n,i){this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,i)}dt(t,n,{glScale:i,zScale:e,tileInfo:r}){if(!n.length)return Promise.resolve({data:null,buffers:[]});const s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.vt(t)),this.featurePlugins&&I(o,this.featurePlugins);const a=n[0].extent,h=r.z,u={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},l=[],c=[],f=[],d=this.options,y=[],v={},p=[Promise.resolve(this.ut)];let m=0,g=-1;for(let t=0;t<o.length;t++){g++;const r=o[t];r.type!==m&&(g=0,m=r.type);const d=0===r.type?l:c;if(r.symbol&&!1===r.symbol.visible){d[g]=null;continue}const{tileFeatures:w,tileFeaIndexes:M}=this.pt(r.type,r.filter,n,v,t);if(!w.length){d[g]=null;continue}const b=T(M[M.length-1]);d[g]={styledFeatures:new b(M)},f.push({idx:t,typeIdx:g}),y.push(d[g].styledFeatures.buffer);let x=this.gt(w,r,{extent:a,tilePoint:u,glScale:i,zScale:e,zoom:h});s&&(x=x.then(t=>{if(!t)return null;if(t.data)t.data.layer=w[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=w[0].layer);return t})),p.push(x)}return Promise.all(p).then(([i,...e])=>{function r(t,n){if(void 0===t.data.ref&&(t.data.type=o[f[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[f[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)y.push(t.buffers[n])}if(i!==this.ut)return{canceled:!0};for(let t=0;t<e.length;t++){if(!e[t])continue;const n=e[t],i=0===o[f[t].idx].type?l:c;if(Array.isArray(n)){const e=[];for(let i=0;i<n.length;i++)n[i]&&(r(n[i],t),(void 0===n[i].data.ref||n[n[i].data.ref])&&e.push(n[i].data));e.length&&(i[f[t].typeIdx].data=e)}else r(n,t),i[f[t].typeIdx].data=n.data}const s={},h=t;if(d.features||d.schema){let t;for(let i=0,e=n.length;i<e;i++)if(t=n[i],h[t.layer].properties||(h[t.layer].properties=Gr(t.properties)),d.features&&t&&v[i])if("id"===d.features)s[i]=t.id;else{const n=A({},t);d.pickingGeometry||delete n.geometry,delete n.extent,delete n.properties.$layer,delete n.properties.$type,delete n.__index,s[i]=n}}return{data:{schema:h,data:l,featureData:c,extent:a,features:s},buffers:y}})}gt(t,n,i){const e=n.renderPlugin.dataConfig,r=n.symbol,s=this.options.tileSize[0],{extent:o,glScale:a,zScale:h,zoom:u,tilePoint:l}=i,c=o/s,f=e.type,d=this.options.debugTile&&this.options.debugTile.index;if("3d-extrusion"===f){const n=Jr(r);return n&&(e.uv=1,2===n&&(e.tangent=1)),Promise.all([Promise.resolve(Nr(t,e,o,l,a,h,this.options.tileSize[1]/o,r,u,d))])}if("3d-wireframe"===f)return Promise.all([Promise.resolve($r(t,e,o))]);if("point"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d}),i=mr.splitPointSymbol(r);return mr.needMerge(i[0])&&(t=mr.mergeLineFeatures(t,i[0],u)),Promise.all(i.map(i=>new mr(t,i,n).load(c)))}if("native-point"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,_r,o/s)}if("line"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),tileRatio:c,zoom:u,debugIndex:d});return Xr(t,r,n,Mr)}if("native-line"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,Pr)}if("fill"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d});return Xr(t,r,n,zr)}if("line-extrusion"===f){delete r.lineGradientProperty,r.lineJoin="miter",r.lineCap="butt";const n=Jr(r);n&&(e.uv=1,2===n&&(e.tangent=1));const i=A({},e,{EXTENT:o,tileSize:s,zScale:h,glScale:a,zoom:u,debugIndex:d});if(n){const n=[];if(!1!==e.top){const e=A({},i);e.side=!1,n.push(new Ar(t,r,e))}return!1!==e.side&&(i.side=!0,i.top=!1,n.push(new Ar(t,r,i))),Promise.all(n.map(t=>t.load()))}return Promise.all([new Ar(t,r,i).load()])}return Promise.resolve([])}pt(t,n,i,e){const r="__fea_idx".trim(),s=[],o=[],a=i.length;for(let h=0;h<a;h++)if((1===t||void 0===i[h].id||!this.styledFeatures[i[h].id])&&((!n.def||"default"===n.def)&&!e[h]||!0===n.def||Array.isArray(n.def)&&n(i[h]))){e[h]=1;const n=A({},i[h]);if(n[r]=h,o.push(n),s.push(h),1===t)break}return{tileFeatures:o,tileFeaIndexes:s}}ht(t){const{style:n,featureStyle:i}=t,e={};i.forEach(t=>{Array.isArray(t.id)?(t.id.forEach(t=>{e[t]=1}),t.filter=["in","$id",...t.id]):(e[t.id]=1,t.filter=["==","$id",t.id])});const r=z(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const s=[],o=z(i);for(let t=0;t<i.length;t++)o[t].type=1,o[t].filter.def=i[t].filter?i[t].filter.value||i[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=r,this.featurePlugins=s,this.styledFeatures=e}vt(t){let n=this.wt;this.wt||(n=this.wt={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const s in t){const o=s;if(!n[s]){const r=[];for(let n=0;n<t[s].types.length;n++){const a=t[s].types[n],h=["all",["==","$layer",o],["==","$type",e[a]]],u={filter:i(h),renderPlugin:qr(a),symbol:Br(a)};u.filter.def=h,u.type=0,r.push(u)}n[o]=r}r.push(...n[o])}return r}}function qr(t){switch(t){case 1:return{type:"native-point",dataConfig:{type:"native-point",only2D:!0}};case 2:return{type:"native-line",dataConfig:{type:"native-line",only2D:!0}};case 3:return{type:"fill",dataConfig:{type:"fill",only2D:!0}}}return null}function Br(t){switch(t){case 1:return{markerFill:"#f00",markerSize:10};case 2:return{lineColor:"#fff"};case 3:return{polygonFill:"#00f",polygonOpacity:.4}}return null}function Gr(t){if(Array.isArray(t)||!_(t))return{};const n={};for(const i in t){const e=t[i];k(e)?n[i]="string":P(e)?n[i]="number":!0===e||!1===e?n[i]="boolean":Array.isArray(e)?n[i]="array":n[i]="object"}return n}function Jr(t){if(!t)return 0;let n=0;for(const i in t){if(("normalTexture"===i||"bumpTexture"===i)&&t[i])return 2;if(i.indexOf("Texture")>0&&t[i])n=1;else if(_(t[i])){const e=Jr(t[i]);if(2===e)return e;1===e&&(n=1)}}return n}function Xr(t,n,i,e,r){const s={},o=Array.isArray(n)?n:[n];let a=-1;for(let t=0;t<o.length;t++)s[t]=Zr(o[t]),!s[t]&&o[t]&&-1===a&&(a=t);const h=[];for(let n=0;n<o.length;n++)o[n]&&(o[n].index={index:n},s[n]||n===a?h.push(new e(t,o[n],i).load(r)):h.push({data:{ref:a,symbolIndex:{index:n}}}));return Promise.all(h)}function Zr(t){if(!t)return 0;for(const n in t)if(D(t[n]))return 1;return 0}function Yr(t,n){Kr(t.geometry,n)}function Kr(t,n){if(t)switch(t.type){case"Point":Qr(t.coordinates,n);break;case"MultiPoint":case"LineString":ts(t.coordinates,n);break;case"MultiLineString":case"Polygon":ns(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let i=0;i<t.length;i++)ns(t[i],n)}(t.coordinates,n);break;case"GeometryCollection":for(let i=0;i<t.geometries.length;i++)Kr(t.geometries[i],n)}}function Qr(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function ts(t,n){for(let i=0;i<t.length;i++)Qr(t[i],n)}function ns(t,n){for(let i=0;i<t.length;i++)ts(t[i],n)}class is extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),(n=n||{}).extent||(n.extent=8192),this.zoomOffset=0,n.tileSize&&(this.zoomOffset=-function(t){if(Math.log2)return Math.log2(t);const n=Math.log(t)*Math.LOG2E,i=Math.round(n);return Math.abs(i-n)<1e-14?i:n}(n.tileSize[0]/256)),this.setData(n.data,s)}setData(t,n){if(delete this.index,!t)return void n();const i={maxZoom:24,tolerance:this.options.extent/this.options.tileSize[0]*1,extent:this.options.extent,buffer:this.options.tileBuffer||64,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5};if(k(t)&&"{"!=t.substring(0,1)||t.url)C.getJSON(t.url?t.url:t,t.url?t:{},(t,e)=>{if(t&&n(t),!e)return void n(null,{extent:null,idMap:{}});const r=e,{first1000:s,idMap:o}=this.Mt(r);this.bt(s,o,r,i,n)});else{"string"==typeof t&&(t=JSON.parse(t));const e=Array.isArray(t)?t:t.features;let r=e;e&&e.length>1e3&&(r=e.slice(0,1e3)),this.bt(r,null,t,i,n)}}bt(t,n,i,e,r){try{const s=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Yr(t.features[i],n);break;case"Feature":Yr(t,n);break;default:Kr(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ht(t,n)}(i,this.options.geojsonvt||e),r(null,{extent:s,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Mt(t){const n=[],i={};let e=0;function r(t){t&&("Feature"!==t.type||t.geometry)&&(void 0!==t.id&&null!==t.id||(t.id=e++),i[t.id]=A({},t),t.geometry?(i[t.id].geometry=A({},t.geometry),i[t.id].geometry.coordinates=null):t.coordinates&&(i[t.id].coordinates=null),n.length<1e3&&n.push(t))}return Array.isArray(t)?t.forEach(t=>{r(t)}):t.features&&t.features.forEach(t=>{r(t)}),{first1000:n,idMap:i}}getTileFeatures(t,n){const i=[];if(!this.index)return setTimeout((function(){n({loading:!0})}),1),1;const e=this.index.getTile(t.z+this.zoomOffset,t.x,t.y);if(!e||0===e.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const r=[];for(let t=0,n=e.features.length;t<n;t++){const n=e.features[t];let s=n.layer;void 0===s&&(s="0"),r[s]={types:{}};r[s].types[n.type]=1,n.tags=n.tags||{},i.push({type:n.type,layer:s,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in r)r[t].types=Object.keys(r[t].types).map(t=>+t);return setTimeout((function(){n(null,i,r)}),1),1}onRemove(){delete this.index}}var es={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,i,e,r){var s,o,a=8*r-e-1,h=(1<<a)-1,u=h>>1,l=-7,c=i?r-1:0,f=i?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+t[n+c],c+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=e;l>0;o=256*o+t[n+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,e),s-=u}return(d?-1:1)*o*Math.pow(2,s-e)},write:function(t,n,i,e,r,s){var o,a,h,u=8*s-r-1,l=(1<<u)-1,c=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=e?0:s-1,y=e?1:-1,v=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(a=isNaN(n)?1:0,o=l):(o=Math.floor(Math.log(n)/Math.LN2),n*(h=Math.pow(2,-o))<1&&(o--,h*=2),(n+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(n*h-1)*Math.pow(2,r),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+d]=255&a,d+=y,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;t[i+d]=255&o,d+=y,o/=256,u-=8);t[i+d-y]|=128*v}},rs=os,ss=es;function os(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}os.Varint=0,os.Fixed64=1,os.Bytes=2,os.Fixed32=5;var as="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hs(t){return t.type===os.Bytes?t.readVarint()+t.pos:t.pos+1}function us(t,n,i){return i?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function ls(t,n,i){var e=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));i.realloc(e);for(var r=i.pos-1;r>=t;r--)i.buf[r+e]=i.buf[r]}function cs(t,n){for(var i=0;i<t.length;i++)n.writeVarint(t[i])}function fs(t,n){for(var i=0;i<t.length;i++)n.writeSVarint(t[i])}function ds(t,n){for(var i=0;i<t.length;i++)n.writeFloat(t[i])}function ys(t,n){for(var i=0;i<t.length;i++)n.writeDouble(t[i])}function vs(t,n){for(var i=0;i<t.length;i++)n.writeBoolean(t[i])}function ps(t,n){for(var i=0;i<t.length;i++)n.writeFixed32(t[i])}function ms(t,n){for(var i=0;i<t.length;i++)n.writeSFixed32(t[i])}function gs(t,n){for(var i=0;i<t.length;i++)n.writeFixed64(t[i])}function ws(t,n){for(var i=0;i<t.length;i++)n.writeSFixed64(t[i])}function Ms(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function bs(t,n,i){t[i]=n,t[i+1]=n>>>8,t[i+2]=n>>>16,t[i+3]=n>>>24}function xs(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}os.prototype={destroy:function(){this.buf=null},readFields:function(t,n,i){for(i=i||this.length;this.pos<i;){var e=this.readVarint(),r=e>>3,s=this.pos;this.type=7&e,t(r,n,this),this.pos===s&&this.skip(e)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ms(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xs(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*Ms(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*xs(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ss.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ss.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,i,e=this.buf;return n=127&(i=e[this.pos++]),i<128?n:(n|=(127&(i=e[this.pos++]))<<7,i<128?n:(n|=(127&(i=e[this.pos++]))<<14,i<128?n:(n|=(127&(i=e[this.pos++]))<<21,i<128?n:function(t,n,i){var e,r,s=i.buf;if(r=s[i.pos++],e=(112&r)>>4,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<3,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<10,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<17,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<24,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(1&r)<<31,r<128)return us(t,e,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(i=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&as?function(t,n,i){return as.decode(t.subarray(n,i))}(this.buf,n,t):function(t,n,i){var e="",r=n;for(;r<i;){var s,o,a,h=t[r],u=null,l=h>239?4:h>223?3:h>191?2:1;if(r+l>i)break;1===l?h<128&&(u=h):2===l?128==(192&(s=t[r+1]))&&(u=(31&h)<<6|63&s)<=127&&(u=null):3===l?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((u=(15&h)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,e+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),e+=String.fromCharCode(u),r+=l}return e}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==os.Bytes)return t.push(this.readVarint(n));var i=hs(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==os.Bytes)return t.push(this.readSVarint());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==os.Bytes)return t.push(this.readBoolean());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==os.Bytes)return t.push(this.readFloat());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==os.Bytes)return t.push(this.readDouble());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===os.Varint)for(;this.buf[this.pos++]>127;);else if(n===os.Bytes)this.pos=this.readVarint()+this.pos;else if(n===os.Fixed32)this.pos+=4;else{if(n!==os.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var i=new Uint8Array(n);i.set(this.buf),this.buf=i,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var i,e;t>=0?(i=t%4294967296|0,e=t/4294967296|0):(e=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,e=e+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn\'t fit into 10 bytes");n.realloc(10),function(t,n,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,n),function(t,n){var i=(7&t)<<4;if(n.buf[n.pos++]|=i|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(e,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,i){for(var e,r,s=0;s<n.length;s++){if((e=n.charCodeAt(s))>55295&&e<57344){if(!r){e>56319||s+1===n.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=e;continue}if(e<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);e<128?t[i++]=e:(e<2048?t[i++]=e>>6|192:(e<65536?t[i++]=e>>12|224:(t[i++]=e>>18|240,t[i++]=e>>12&63|128),t[i++]=e>>6&63|128),t[i++]=63&e|128)}return i}(this.buf,t,this.pos);var i=this.pos-n;i>=128&&ls(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),ss.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ss.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var i=0;i<n;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,n){this.pos++;var i=this.pos;t(n,this);var e=this.pos-i;e>=128&&ls(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeMessage:function(t,n,i){this.writeTag(t,os.Bytes),this.writeRawMessage(n,i)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,cs,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,fs,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,vs,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,ds,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,ys,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,ps,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,ms,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,gs,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,ws,n)},writeBytesField:function(t,n){this.writeTag(t,os.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,os.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,os.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,os.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Fs=Ht,As=ks;function ks(t,n,i,e,r){this.properties={},this.extent=i,this.type=0,this.xt=t,this.Ft=-1,this.At=e,this.kt=r,t.readFields(Ps,this,n)}function Ps(t,n,i){1==t?n.id=i.readVarint():2==t?function(t,n){var i=t.readVarint()+t.pos;for(;t.pos<i;){var e=n.At[t.readVarint()],r=n.kt[t.readVarint()];n.properties[e]=r}}(i,n):3==t?n.type=i.readVarint():4==t&&(n.Ft=i.pos)}function Ss(t){for(var n,i,e=0,r=0,s=t.length,o=s-1;r<s;o=r++)n=t[r],e+=((i=t[o]).x-n.x)*(n.y+i.y);return e}ks.types=["Unknown","Point","LineString","Polygon"],ks.prototype.loadGeometry=function(){var t=this.xt;t.pos=this.Ft;for(var n,i=t.readVarint()+t.pos,e=1,r=0,s=0,o=0,a=[];t.pos<i;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)s+=t.readSVarint(),o+=t.readSVarint(),1===e&&(n&&a.push(n),n=[]),n.push(new Fs(s,o));else{if(7!==e)throw new Error("unknown command "+e);n&&n.push(n[0].clone())}}return n&&a.push(n),a},ks.prototype.bbox=function(){var t=this.xt;t.pos=this.Ft;for(var n=t.readVarint()+t.pos,i=1,e=0,r=0,s=0,o=1/0,a=-1/0,h=1/0,u=-1/0;t.pos<n;){if(e<=0){var l=t.readVarint();i=7&l,e=l>>3}if(e--,1===i||2===i)(r+=t.readSVarint())<o&&(o=r),r>a&&(a=r),(s+=t.readSVarint())<h&&(h=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,h,a,u]},ks.prototype.toGeoJSON=function(t,n,i){var e,r,s=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*n,h=this.loadGeometry(),u=ks.types[this.type];function l(t){for(var n=0;n<t.length;n++){var i=t[n],e=180-360*(i.y+a)/s;t[n]=[360*(i.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(e=0;e<h.length;e++)c[e]=h[e][0];l(h=c);break;case 2:for(e=0;e<h.length;e++)l(h[e]);break;case 3:for(h=function(t){var n=t.length;if(n<=1)return[t];for(var i,e,r=[],s=0;s<n;s++){var o=Ss(t[s]);0!==o&&(void 0===e&&(e=o<0),e===o<0?(i&&r.push(i),i=[t[s]]):i.push(t[s]))}i&&r.push(i);return r}(h),e=0;e<h.length;e++)for(r=0;r<h[e].length;r++)l(h[e][r])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f};var _s=As,Os=Is;function Is(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.xt=t,this.At=[],this.kt=[],this.Pt=[],t.readFields(Ts,this,n),this.length=this.Pt.length}function Ts(t,n,i){15===t?n.version=i.readVarint():1===t?n.name=i.readString():5===t?n.extent=i.readVarint():2===t?n.Pt.push(i.pos):3===t?n.At.push(i.readString()):4===t&&n.kt.push(function(t){var n=null,i=t.readVarint()+t.pos;for(;t.pos<i;){var e=t.readVarint()>>3;n=1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return n}(i))}Is.prototype.feature=function(t){if(t<0||t>=this.Pt.length)throw new Error("feature index out of bounds");this.xt.pos=this.Pt[t];var n=this.xt.readVarint()+this.xt.pos;return new _s(this.xt,n,this.extent,this.At,this.kt)};var Ls=Os;function Us(t,n,i){if(3===t){var e=new Ls(i,i.readVarint()+i.pos);e.length&&(n[e.name]=e)}}var zs=function(t,n){this.layers=t.readFields(Us,{},n)};class Ds extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),n=n||{},s()}getTileFeatures(t,n){const i=t.url;return C.getArrayBuffer(i,(t,i)=>{if(t)return void n(t);const e=new zs(new rs(i.data)),r=[];if(!e.layers)return void n(null,r,[]);const s={};let o;for(const n in e.layers)if(a=e.layers,h=n,Object.prototype.hasOwnProperty.call(a,h)){s[n]={types:{}};const i=s[n].types;for(let s=0,a=e.layers[n].length;s<a;s++)try{o=e.layers[n].feature(s),i[o.type]=1,r.push({type:o.type,layer:n,geometry:o.loadGeometry(),properties:o.properties,extent:o.extent})}catch(t){console.warn("error when load vt geometry:",t)}}var a,h;for(const t in s)s[t].types=Object.keys(s[t].types).map(t=>+t);n(null,r,s,{byteLength:i.data.byteLength})})}abortTile(t,n){const i=this.requests[t];delete this.requests[t],i&&i.abort&&i.abort(),this.yt(t),n()}onRemove(){for(const t in this.requests)this.requests[t].abort();this.requests={}}}let Es=0;const Cs=new class{constructor(t){this.max=t,this.reset()}reset(){return this.data={},this.order=[],this}clear(){this.reset()}add(t,n){return this.has(t)?(this.order.splice(this.order.indexOf(t),1),this.data[t]=n,this.order.push(t)):(this.data[t]=n,this.order.push(t),this.order.length>this.max&&this.getAndRemove(this.order[0])),this}has(t){return t in this.data}keys(){return this.order}getAndRemove(t){if(!this.has(t))return null;const n=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),n}get(t){return this.has(t)?this.data[t]:null}remove(t){return this.has(t)?(delete this.data[t],this.order.splice(this.order.indexOf(t),1),this):this}setMaxSize(t){for(this.max=t;this.order.length>this.max;)this.getAndRemove(this.order[0]);return this}}(128),js={};class Ns{constructor(t){this.St={},this._t={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:i,params:e},r){if(this.Ot(n,i))return;const s=this.It(n,i),o=e.type,a=e.options,h=this.send.bind(this,t);this.St[s]="GeoJSONVectorTileLayer"===o?new is(i,a,h,Cs,js,r):new Ds(i,a,h,Cs,js,r)}removeLayer({mapId:t,layerId:n},i){const e=this.Ot(t,n),r=this.It(t,n);delete this.St[r],e&&(e.onRemove(i),this.Tt())}loadTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.loadTile(i,e)}abortTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.abortTile&&r.abortTile(i.url,e)}removeTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.removeTile(i,e)}updateStyle({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateStyle(i,e),this.Tt())}updateOptions({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateOptions(i,e),this.Tt())}setData({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.setData(i.data,e),this.Tt())}receive(t){const n=t.callback,i=this._t[n];delete this._t[n],i&&t.error?i(new Error(t.error)):i&&i(null,t.data)}send(t,n,i,e,r){const s=r?`${t}-${Es++}`:null;r&&(this._t[s]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:i,callback:String(s)},e||[])}It(t,n){return`${t}-${n}`}Ot(t,n){const i=this.It(t,n);return this.St[i]}Tt(){const t=Object.keys(js);for(let n=0;n<t.length;n++)delete js[t[n]];Cs.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const i=t.data;if(this.dispatcher||(this.dispatcher=new Ns(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const e=i.command;this.dispatcher[e]({actorId:t.actorId,mapId:i.mapId,layerId:i.layerId,params:i.params},(t,i,r)=>{t&&console.error(e,t),n(t,i,r)})}},Object.defineProperty(t,"Lt",{value:!0})}';
31
31
 
32
32
  let D = 0;
33
33
 
@@ -1431,14 +1431,14 @@ class ct extends t.TileLayer {
1431
1431
  pt(this.Bt, e, i), o = this.Bt[e].style[i].Yt;
1432
1432
  const t = r[o].renderPlugin;
1433
1433
  t.sceneConfig || (t.sceneConfig = {}), s = t.sceneConfig;
1434
- } else mt(r, e), s = r[e].renderPlugin.sceneConfig;
1434
+ } else yt(r, e), s = r[e].renderPlugin.sceneConfig;
1435
1435
  if (R(s, n), Array.isArray(this.options.style)) {
1436
1436
  const t = this.options.style[e].renderPlugin;
1437
1437
  t.sceneConfig || (t.sceneConfig = {}), R(t.sceneConfig, n);
1438
1438
  } else {
1439
1439
  const r = this.Z(t, this.options.style);
1440
1440
  let s;
1441
- void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (mt(r, e), s = r[e].renderPlugin),
1441
+ void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (yt(r, e), s = r[e].renderPlugin),
1442
1442
  s.sceneConfig || (s.sceneConfig = {}), R(s.sceneConfig, n);
1443
1443
  }
1444
1444
  const a = this.getRenderer();
@@ -1461,13 +1461,13 @@ class ct extends t.TileLayer {
1461
1461
  const r = this.Z(t);
1462
1462
  if (!r) return this;
1463
1463
  let s, o = e;
1464
- void 0 !== i ? (pt(this.Bt, e, i), o = this.Bt[e].style[i].Yt, s = r[o].renderPlugin.dataConfig) : (mt(r, e),
1464
+ void 0 !== i ? (pt(this.Bt, e, i), o = this.Bt[e].style[i].Yt, s = r[o].renderPlugin.dataConfig) : (yt(r, e),
1465
1465
  s = r[e].renderPlugin.dataConfig);
1466
1466
  const a = R({}, s);
1467
1467
  if (R(s, n), Array.isArray(this.options.style)) R(this.options.style[e].renderPlugin.dataConfig, n); else {
1468
1468
  const r = this.Z(t, this.options.style);
1469
1469
  let s;
1470
- void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (mt(r, e), s = r[e].renderPlugin),
1470
+ void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (yt(r, e), s = r[e].renderPlugin),
1471
1471
  s.dataConfig || (s.dataConfig = {}), R(s.dataConfig, n);
1472
1472
  }
1473
1473
  const l = this.getRenderer();
@@ -1511,7 +1511,7 @@ class ct extends t.TileLayer {
1511
1511
  let f = l.options.style;
1512
1512
  Array.isArray(f) || (f = l.Z(e, l.options.style));
1513
1513
  const u = JSON.parse(JSON.stringify(s));
1514
- return void 0 !== r ? (pt(f, n, r), void 0 === o ? f[n].style[r].symbol = u : f[n].style[r].symbol[o] = u) : (mt(f, n),
1514
+ return void 0 !== r ? (pt(f, n, r), void 0 === o ? f[n].style[r].symbol = u : f[n].style[r].symbol[o] = u) : (yt(f, n),
1515
1515
  void 0 === o ? f[n].symbol = u : f[n].symbol[o] = u), c;
1516
1516
  }
1517
1517
  const f = this.getRenderer();
@@ -1664,7 +1664,7 @@ function pt(t, e, n) {
1664
1664
  if (!t[e] || !t[e].style || !t[e].style[n]) throw new Error(`No plugin defined at feature style of ${e} - ${n}`);
1665
1665
  }
1666
1666
 
1667
- function mt(t, e) {
1667
+ function yt(t, e) {
1668
1668
  if (!t[e]) throw new Error("No plugin defined at style of " + e);
1669
1669
  }
1670
1670
 
@@ -1673,7 +1673,7 @@ ct.prototype._getTileZoom = function(e) {
1673
1673
  }, ct.registerJSONType("VectorTileLayer"), ct.mergeOptions(ht), ct.registerRenderer("gl", nt),
1674
1674
  ct.registerRenderer("canvas", null);
1675
1675
 
1676
- class yt extends ct {
1676
+ class mt extends ct {
1677
1677
  getTileUrl(t, e, n) {
1678
1678
  const i = this.getMap().getResolution(n);
1679
1679
  return super.getTileUrl(t, e, function(t) {
@@ -1681,11 +1681,11 @@ class yt extends ct {
1681
1681
  }(i));
1682
1682
  }
1683
1683
  static fromJSON(t) {
1684
- return t && "MapboxVectorTileLayer" === t.type ? new yt(t.id, t.options) : null;
1684
+ return t && "MapboxVectorTileLayer" === t.type ? new mt(t.id, t.options) : null;
1685
1685
  }
1686
1686
  }
1687
1687
 
1688
- yt.registerJSONType("MapboxVectorTileLayer");
1688
+ mt.registerJSONType("MapboxVectorTileLayer");
1689
1689
 
1690
1690
  const gt = 12756274 * Math.PI / (256 * Math.pow(2, 20));
1691
1691
 
@@ -1736,7 +1736,7 @@ class vt extends ct {
1736
1736
  de(e) {
1737
1737
  this.ue = new t.Extent(...e);
1738
1738
  }
1739
- me(t, e) {
1739
+ ye(t, e) {
1740
1740
  N(t) ? lt.getJSON(t, e) : lt.getJSON(t.url, t, e);
1741
1741
  }
1742
1742
  getData() {
@@ -2272,7 +2272,7 @@ let Ct = new Float32Array(1);
2272
2272
 
2273
2273
  class Ft extends t.renderer.CanvasRenderer {
2274
2274
  constructor(...t) {
2275
- super(...t), this.features = {}, this.ye = {}, this.F = 1, this.ge = {}, this.ve = {},
2275
+ super(...t), this.features = {}, this.me = {}, this.F = 1, this.ge = {}, this.ve = {},
2276
2276
  this.xe = {}, this.be = {}, this.Ae = {}, this.we = !0, this._e = {
2277
2277
  id: 0,
2278
2278
  pickingId: 0
@@ -2515,7 +2515,7 @@ class Ft extends t.renderer.CanvasRenderer {
2515
2515
  Array.isArray(r) || (r = [ r ]);
2516
2516
  const s = [], o = [], a = this.getMap().getZoom();
2517
2517
  let l, h;
2518
- l = Array.isArray(e) ? e.map(t => t ? m(t, () => a) : t) : m(e, () => a), h = Array.isArray(e) ? e.map(t => t ? w.genFnTypes(t) : t) : w.genFnTypes(e);
2518
+ l = Array.isArray(e) ? e.map(t => t ? y(t, () => a) : t) : y(e, () => a), h = Array.isArray(e) ? e.map(t => t ? w.genFnTypes(t) : t) : w.genFnTypes(e);
2519
2519
  for (let t = 0; t < r.length; t++) {
2520
2520
  if (!r[t]) continue;
2521
2521
  const i = Array.isArray(e) ? e[t] : e, s = Array.isArray(l) ? l[t] : l, o = Array.isArray(h) ? h[t] : h, a = new _(r, i, s, o, n).getIconAndGlyph();
@@ -2568,8 +2568,8 @@ class Ft extends t.renderer.CanvasRenderer {
2568
2568
  if (n[0].geometry.properties.aFeaIds.indexOf(d) < 0) return this.tn(), this.setToRedraw(),
2569
2569
  !1;
2570
2570
  }
2571
- const m = R({}, o), y = p.map(t => this.createVectorPacks(r, s, m, t, n[0], i));
2572
- return Promise.all(y).then(t => {
2571
+ const y = R({}, o), m = p.map(t => this.createVectorPacks(r, s, y, t, n[0], i));
2572
+ return Promise.all(m).then(t => {
2573
2573
  for (let n = 0; n < t.length; n++) {
2574
2574
  let i;
2575
2575
  if (Array.isArray(e)) {
@@ -2654,7 +2654,7 @@ class Ft extends t.renderer.CanvasRenderer {
2654
2654
  const e = t[_t];
2655
2655
  this.features[e] && this.hn(e), this.features[e] = St(t, this._e, this.features[e]);
2656
2656
  const n = this.features[e];
2657
- return this.cn(n), this.features[e][_t] = e, this.ye[e] = t, e;
2657
+ return this.cn(n), this.features[e][_t] = e, this.me[e] = t, e;
2658
2658
  }
2659
2659
  cn(t) {
2660
2660
  if (!t) return;
@@ -2693,7 +2693,7 @@ class Ft extends t.renderer.CanvasRenderer {
2693
2693
  const s = r.pick(t, e, n.tolerance);
2694
2694
  if (s && s.data && s.data.feature) {
2695
2695
  const t = s.data.feature;
2696
- i.push(this.ye[t[_t]]);
2696
+ i.push(this.me[t[_t]]);
2697
2697
  }
2698
2698
  }), i;
2699
2699
  }
@@ -2730,7 +2730,7 @@ class Ft extends t.renderer.CanvasRenderer {
2730
2730
  if (t && t.length) {
2731
2731
  for (let e = 0; e < t.length; e++) {
2732
2732
  const n = t[e][_t];
2733
- void 0 !== n && (delete this.ye[n], this.hn(n), delete this.features[n]);
2733
+ void 0 !== n && (delete this.me[n], this.hn(n), delete this.features[n]);
2734
2734
  }
2735
2735
  this.tn(), Et(this);
2736
2736
  }
@@ -2770,12 +2770,12 @@ class Ft extends t.renderer.CanvasRenderer {
2770
2770
  this.tn();
2771
2771
  }
2772
2772
  onGeometryShow(t) {
2773
- this.mn(t);
2773
+ this.yn(t);
2774
2774
  }
2775
2775
  onGeometryHide(t) {
2776
- this.mn(t);
2776
+ this.yn(t);
2777
2777
  }
2778
- mn(t) {
2778
+ yn(t) {
2779
2779
  const e = t.target, n = e[_t], i = this.features[n];
2780
2780
  if (i) {
2781
2781
  const t = e.isVisible();
@@ -2786,10 +2786,10 @@ class Ft extends t.renderer.CanvasRenderer {
2786
2786
  if (t === i.visible) return;
2787
2787
  i.visible = t;
2788
2788
  }
2789
- this.yn(), Et(this);
2789
+ this.mn(), Et(this);
2790
2790
  }
2791
2791
  }
2792
- yn() {
2792
+ mn() {
2793
2793
  this.Le = !0;
2794
2794
  }
2795
2795
  onGeometryPropertiesChange(t) {
@@ -2807,7 +2807,9 @@ class Ft extends t.renderer.CanvasRenderer {
2807
2807
  this.prepareRequestors(), this.pickingFBO = this.canvas.pickingFBO || this.regl.framebuffer(this.canvas.width, this.canvas.height),
2808
2808
  this.painter = this.createPainter();
2809
2809
  const e = At.get3DPainterClass("icon"), n = R({}, Mt, Pt);
2810
- this.Pe = new e(this.regl, this.layer, n, this.layer.options.sceneConfig, 0);
2810
+ this.Pe = new e(this.regl, this.layer, n, this.layer.options.sceneConfig, 0), this.Pe.setTextShaderDefines({
2811
+ REVERSE_MAP_ROTATION_ON_PITCH: 1
2812
+ });
2811
2813
  const i = At.get3DPainterClass("line"), r = R({}, Tt);
2812
2814
  this.Te = new i(this.regl, this.layer, r, this.layer.options.sceneConfig, 0), this.layer.getGeometries() && this.onGeometryAdd(this.layer.getGeometries());
2813
2815
  }
@@ -2923,7 +2925,7 @@ function zt(t, e) {
2923
2925
  if (Object.keys(t).sort().join() !== Object.keys(e.properties || {}).filter(t => 0 === t.indexOf(It)).map(t => t.substring(It.length)).sort().join()) return !1;
2924
2926
  for (const n in t) if (B(t, n)) {
2925
2927
  const i = (It + n).trim();
2926
- if (y(t[n]) !== y(e.properties[i])) return !1;
2928
+ if (m(t[n]) !== m(e.properties[i])) return !1;
2927
2929
  }
2928
2930
  return !0;
2929
2931
  }
@@ -3369,7 +3371,7 @@ function ee(t, e, n, i, r, s) {
3369
3371
  Object.defineProperty(t, e, {
3370
3372
  enumerable: !0,
3371
3373
  get: function() {
3372
- const t = Qt(n[i]) || y(n[i]) ? r : n[i];
3374
+ const t = Qt(n[i]) || m(n[i]) ? r : n[i];
3373
3375
  return s ? s(t) : t;
3374
3376
  }
3375
3377
  });
@@ -3447,20 +3449,20 @@ function pe(t, e, n) {
3447
3449
  let h = t.data[s];
3448
3450
  if (!h) {
3449
3451
  if (_e(e[o])) {
3450
- h = t.data[s] = new n.type(n.width * r.length), me(t, e, n);
3452
+ h = t.data[s] = new n.type(n.width * r.length), ye(t, e, n);
3451
3453
  return Ae(s, t, t.properties[l], a), h;
3452
3454
  }
3453
3455
  return null;
3454
3456
  }
3455
- return _e(e[o]) ? (me(t, e, n), h) : (h && h.buffer && h.buffer.destroy && h.buffer.destroy(),
3456
- delete t.data[s], ye(t, s), null);
3457
+ return _e(e[o]) ? (ye(t, e, n), h) : (h && h.buffer && h.buffer.destroy && h.buffer.destroy(),
3458
+ delete t.data[s], me(t, s), null);
3457
3459
  }
3458
3460
 
3459
- function me(t, e, n) {
3461
+ function ye(t, e, n) {
3460
3462
  const {attrName: i, symbolName: r} = n, s = function(t) {
3461
3463
  if (!t) return be;
3462
3464
  const e = [];
3463
- for (let n = 0; n < t.length; n++) y(t[n][1]) && !g(t[n][1]).isZoomConstant && e.push(t[n][0]);
3465
+ for (let n = 0; n < t.length; n++) m(t[n][1]) && !g(t[n][1]).isZoomConstant && e.push(t[n][0]);
3464
3466
  return e;
3465
3467
  }(e[r].stops), o = "identity" === e[r].type && function(t, e, n) {
3466
3468
  let {features: i} = n.properties;
@@ -3473,11 +3475,11 @@ function me(t, e, n) {
3473
3475
  const e = i[t] && i[t].feature;
3474
3476
  if (!e) continue;
3475
3477
  const n = e.properties && e.properties[s];
3476
- if (n && (y(n) && !g(n).isZoomConstant)) return !0;
3478
+ if (n && (m(n) && !g(n).isZoomConstant)) return !0;
3477
3479
  }
3478
3480
  return !1;
3479
3481
  }(n, e[r], t);
3480
- if (!o && !s.length) return void ye(t, i);
3482
+ if (!o && !s.length) return void me(t, i);
3481
3483
  const a = t.properties, {features: l, aPickingId: h} = a, c = function(t, e, n, i, r) {
3482
3484
  const s = [];
3483
3485
  let o = 0, a = e[0];
@@ -3485,12 +3487,12 @@ function me(t, e, n) {
3485
3487
  a = e[l], o = l);
3486
3488
  return s;
3487
3489
  }(l, h, e[r].property, s, o);
3488
- if (!c.length) return void ye(t, i);
3490
+ if (!c.length) return void me(t, i);
3489
3491
  const f = t.data[i], u = (fe + i + "Index").trim(), d = (fe + i).trim();
3490
3492
  a[u] = c, a[d] = f.BYTES_PER_ELEMENT ? new f.constructor(f) : new n.type(f.length);
3491
3493
  }
3492
3494
 
3493
- function ye(t, e) {
3495
+ function me(t, e) {
3494
3496
  const n = t.properties, i = (fe + e + "Index").trim(), r = (fe + e).trim();
3495
3497
  delete n[i], delete n[r];
3496
3498
  }
@@ -3585,7 +3587,7 @@ function we(t, e, n, i, r, s, o) {
3585
3587
  }
3586
3588
 
3587
3589
  function _e(t) {
3588
- return t && y(t) && t.property;
3590
+ return t && m(t) && t.property;
3589
3591
  }
3590
3592
 
3591
3593
  const {loginIBLResOnCanvas: Se, logoutIBLResOnCanvas: Me, getIBLResOnCanvas: Pe} = n.pbr.PBRUtils, Te = [], ke = [], Ie = t => 0 === t.getUniform("level"), Oe = t => t.getUniform("level") > 0;
@@ -3847,7 +3849,7 @@ class Ce {
3847
3849
  this.symbolDef[t] = te(n);
3848
3850
  const r = this.Bn[t];
3849
3851
  for (const t in r) delete r[t];
3850
- const s = this.getMap(), o = m(this.symbolDef[t], () => [ s.getZoom() ]);
3852
+ const s = this.getMap(), o = y(this.symbolDef[t], () => [ s.getZoom() ]);
3851
3853
  for (const t in o) {
3852
3854
  const e = Object.getOwnPropertyDescriptor(o, t);
3853
3855
  e.get ? Object.defineProperty(r, t, {
@@ -3857,7 +3859,7 @@ class Ce {
3857
3859
  enumerable: !0
3858
3860
  }) : r[t] = o[t];
3859
3861
  }
3860
- return y(n.visible) && (this.Ln[t] = g(n.visible)), i;
3862
+ return m(n.visible) && (this.Ln[t] = g(n.visible)), i;
3861
3863
  }
3862
3864
  getSymbolDef(t) {
3863
3865
  return this.symbolDef[t.index];
@@ -3872,8 +3874,8 @@ class Ce {
3872
3874
  Dn() {
3873
3875
  const t = this.getMap(), e = () => [ t.getZoom() ];
3874
3876
  this.Bn = [], this.Ln = [];
3875
- for (let t = 0; t < this.symbolDef.length; t++) this.Bn[t] = m(Zt({}, this.symbolDef[t]), e),
3876
- this.symbolDef[t] && y(this.symbolDef[t].visible) && (this.Ln[t] = g(this.symbolDef[t].visible));
3877
+ for (let t = 0; t < this.symbolDef.length; t++) this.Bn[t] = y(Zt({}, this.symbolDef[t]), e),
3878
+ this.symbolDef[t] && m(this.symbolDef[t].visible) && (this.Ln[t] = g(this.symbolDef[t].visible));
3877
3879
  }
3878
3880
  getFnTypeConfig(t) {
3879
3881
  this.Gn || (this.Gn = []);
@@ -4221,7 +4223,7 @@ class Ne extends He {
4221
4223
  define: "HAS_COLOR",
4222
4224
  evaluate: (e, i, r) => {
4223
4225
  let s = n(t.getZoom(), e);
4224
- return y(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = this.colorCache[s] = this.colorCache[s] || O(s).unitArray()),
4226
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = this.colorCache[s] = this.colorCache[s] || O(s).unitArray()),
4225
4227
  s = ie(s), s;
4226
4228
  }
4227
4229
  }, {
@@ -4232,7 +4234,7 @@ class Ne extends He {
4232
4234
  define: "HAS_OPACITY",
4233
4235
  evaluate: (e, n, r) => {
4234
4236
  let s = i(t.getZoom(), e);
4235
- return y(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), o[0] = 255 * s, o[0];
4237
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), o[0] = 255 * s, o[0];
4236
4238
  }
4237
4239
  }, {
4238
4240
  attrName: "aUVScale",
@@ -4449,7 +4451,7 @@ class Ve extends He {
4449
4451
  define: "HAS_COLOR",
4450
4452
  evaluate: (e, i, r) => {
4451
4453
  let s = n(t.getZoom(), e);
4452
- return y(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = this.colorCache[s] = this.colorCache[s] || O(s).unitArray()),
4454
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = this.colorCache[s] = this.colorCache[s] || O(s).unitArray()),
4453
4455
  s = ie(s), s;
4454
4456
  }
4455
4457
  }, {
@@ -4485,7 +4487,7 @@ class Ve extends He {
4485
4487
  define: "HAS_LINE_WIDTH",
4486
4488
  evaluate: (e, i, r) => {
4487
4489
  let s = n(t.getZoom(), e);
4488
- return y(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), a[0] = Math.round(2 * s),
4490
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), a[0] = Math.round(2 * s),
4489
4491
  a[0];
4490
4492
  }
4491
4493
  }, {
@@ -4526,7 +4528,7 @@ class Ve extends He {
4526
4528
  define: "HAS_OPACITY",
4527
4529
  evaluate: (e, n, r) => {
4528
4530
  let s = i(t.getZoom(), e);
4529
- return y(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), a[0] = 255 * s, a[0];
4531
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), a[0] = 255 * s, a[0];
4530
4532
  }
4531
4533
  } ];
4532
4534
  }
@@ -4750,18 +4752,18 @@ class $e extends He {
4750
4752
  const e = this.di.tags[t];
4751
4753
  if (this.hi && e && this.fi) {
4752
4754
  const t = this.getMap();
4753
- e.anchor0 = t.containerPointToCoord(this.pi), e.anchor1 = t.containerPointToCoord(this.mi),
4755
+ e.anchor0 = t.containerPointToCoord(this.pi), e.anchor1 = t.containerPointToCoord(this.yi),
4754
4756
  e.anchor0.z = t.getZoom(), e.anchor0.width = t.width, e.anchor0.height = t.height;
4755
4757
  }
4756
4758
  this.getMap().collisionFrameTime += performance.now() - this.li;
4757
4759
  }
4758
4760
  ui(t) {
4759
- const e = this.getMap(), n = e.getZoom(), [i, r] = this.yi(t);
4760
- return !i || !r || i.z !== n || i.width !== e.width || i.height !== e.height || i.distanceTo(this.pi) > 2 || r.distanceTo(this.mi) > 2;
4761
+ const e = this.getMap(), n = e.getZoom(), [i, r] = this.mi(t);
4762
+ return !i || !r || i.z !== n || i.width !== e.width || i.height !== e.height || i.distanceTo(this.pi) > 2 || r.distanceTo(this.yi) > 2;
4761
4763
  }
4762
4764
  gi() {
4763
4765
  const e = this.getMap();
4764
- this.vi = {}, this.pi = new t.Point(e.width / 2, e.height / 3), this.mi = new t.Point(e.width / 2, 2 * e.height / 3),
4766
+ this.vi = {}, this.pi = new t.Point(e.width / 2, e.height / 3), this.yi = new t.Point(e.width / 2, 2 * e.height / 3),
4765
4767
  delete this.hi, this.di || (this.di = {
4766
4768
  tags: {}
4767
4769
  }), this.ai = {
@@ -4791,7 +4793,7 @@ class $e extends He {
4791
4793
  const e = this.layer.options.collisionFrameLimit;
4792
4794
  return t.collisionFrameTime <= e;
4793
4795
  }
4794
- yi(t) {
4796
+ mi(t) {
4795
4797
  const e = "__meshAnchorKey".trim(), n = this.di.tags[t];
4796
4798
  if (n && n.anchor0) {
4797
4799
  const {anchor0: t, anchor1: i} = n, r = t[e] = t[e] || t.x + "," + t.y, s = i[e] = i[e] || i.x + "," + i.y;
@@ -4810,9 +4812,9 @@ class $e extends He {
4810
4812
  if (h && this._i(c, r)) return !1;
4811
4813
  const u = n.length;
4812
4814
  let d = l[c] && l[c][r];
4813
- const p = d, m = this.Si && d;
4814
- if (!(m && 0 !== d.collides) && t) {
4815
- const t = m && 0 === d.collides;
4815
+ const p = d, y = this.Si && d;
4816
+ if (!(y && 0 !== d.collides) && t) {
4817
+ const t = y && 0 === d.collides;
4816
4818
  if (this.hi || t) if ((this.fi || d && d.z !== a) && (d = null), d) {
4817
4819
  if (d.boxes && d.boxes.length) {
4818
4820
  const {boxes: t, isAllowOverlap: e} = d;
@@ -4843,12 +4845,12 @@ class $e extends He {
4843
4845
  d.collides = t, this.wi(c, r, d);
4844
4846
  }
4845
4847
  }
4846
- let y = t && d && 0 === d.collides, g = 1, v = !1;
4848
+ let m = t && d && 0 === d.collides, g = 1, v = !1;
4847
4849
  if (this.sceneConfig.fading) {
4848
4850
  const t = this.Pi(e);
4849
- if (this.Ti) t[r] = y ? 1 : -1; else if (f && delete e.ki, g = this.Ii(f, y, t, r),
4850
- f ? (g > 0 && (y = !0), v = this.isBoxFading(e, r), v && this.setToRedraw()) : y || (this.Oi(t, r),
4851
- g = 0), y) {
4851
+ if (this.Ti) t[r] = m ? 1 : -1; else if (f && delete e.ki, g = this.Ii(f, m, t, r),
4852
+ f ? (g > 0 && (m = !0), v = this.isBoxFading(e, r), v && this.setToRedraw()) : m || (this.Oi(t, r),
4853
+ g = 0), m) {
4852
4854
  const n = e.ki;
4853
4855
  if (n && 1 === g && t[r] > 0) {
4854
4856
  let {fadeOutDelay: t, fadingDuration: e} = this.sceneConfig;
@@ -4859,18 +4861,18 @@ class $e extends He {
4859
4861
  }
4860
4862
  }
4861
4863
  if (d && s.options.debugCollision && this.addCollisionDebugBox(d.boxes, d.collides ? 0 : 1),
4862
- y || v) {
4864
+ m || v) {
4863
4865
  const {mesh: t, start: e} = n[0], i = this.getSymbol(t.properties.symbolIndex);
4864
4866
  !this.Ci(i, t, e) && d && d.boxes && this.Fi(d.boxes, t);
4865
4867
  }
4866
- if (y) {
4868
+ if (m) {
4867
4869
  const t = qe[0] = 255 * g;
4868
4870
  for (let e = 0; e < u; e++) {
4869
4871
  const {mesh: i, allElements: r, start: s, end: o, boxIndex: a} = n[e];
4870
4872
  this.setCollisionOpacity(i, r, t, s, o, a);
4871
4873
  }
4872
4874
  }
4873
- return y && g > 0;
4875
+ return m && g > 0;
4874
4876
  }
4875
4877
  isMeshIterable() {
4876
4878
  return !0;
@@ -5224,7 +5226,7 @@ function rn(t, e, n, i, r) {
5224
5226
  const sn = [], on = [], an = [], ln = [], hn = [], cn = [];
5225
5227
 
5226
5228
  function fn(t, e, n, r, s, o, l, c, f, u, d, p) {
5227
- const {tileRatio: m, tileResolution: y} = f, g = m / (y / u.getResolution()) * (d / u.cameraToCenterDistance) * p;
5229
+ const {tileRatio: y, tileResolution: m} = f, g = y / (m / u.getResolution()) * (d / u.cameraToCenterDistance) * p;
5228
5230
  h.scale(n, n, g), h.scale(r, r, g), h.scale(s, s, g), h.scale(o, o, g), i.set(sn, n[0], n[1], 0),
5229
5231
  i.set(on, r[0], r[1], 0), i.set(an, s[0], s[1], 0), i.set(ln, o[0], o[1], 0), i.add(sn, sn, e),
5230
5232
  i.add(on, on, e), i.add(an, an, e), i.add(ln, ln, e), rn(n, sn, l, u.width, u.height),
@@ -5245,15 +5247,15 @@ function dn(t, e, n, i, r) {
5245
5247
  return l.set(t, o, -s, s, o);
5246
5248
  }
5247
5249
 
5248
- const pn = [], mn = [], yn = [], gn = [], vn = [], xn = [], bn = [], An = [], wn = [ 1, -1 ], _n = [ 1, 1 ];
5250
+ const pn = [], yn = [], mn = [], gn = [], vn = [], xn = [], bn = [], An = [], wn = [ 1, -1 ], _n = [ 1, 1 ];
5249
5251
 
5250
5252
  function Sn(t, e, n, r, s) {
5251
5253
  const o = e.material.uniforms, a = s.cameraToCenterDistance, l = e.geometry.properties, c = this.getSymbol(l.symbolIndex), f = e.geometry.desc.positionSize, u = l.aAnchor, d = i.set(pn, u[n * f], u[n * f + 1], 2 === f ? 0 : u[n * f + 2]);
5252
- let p = rn(mn, d, r, s.width, s.height);
5253
- const m = p[2];
5254
- let y = 1;
5254
+ let p = rn(yn, d, r, s.width, s.height);
5255
+ const y = p[2];
5256
+ let m = 1;
5255
5257
  if (o.markerPerspectiveRatio) {
5256
- y = Kt(.5 + .5 * (1 - (1 - a / m) * o.markerPerspectiveRatio), 0, 4);
5258
+ m = Kt(.5 + .5 * (1 - (1 - a / y) * o.markerPerspectiveRatio), 0, 4);
5257
5259
  }
5258
5260
  const {aShape: g, aMarkerDx: v, aMarkerDy: x, aMarkerWidth: b, aMarkerHeight: A, aPitchAlign: w, aRotationAlign: _, aRotation: S} = l, M = v ? v[n] : c.markerDx, P = x ? x[n] : c.markerDy, T = w ? w[n] : o.pitchWithMap, k = _ ? _[n] : o.rotateWithMap, I = h.set(An, M || 0, -(P || 0));
5259
5261
  let O = h.set(gn, g[2 * n] / 10, g[2 * n + 1] / 10), C = h.set(vn, g[2 * n + 2] / 10, g[2 * n + 3] / 10), F = h.set(xn, g[2 * n + 4] / 10, g[2 * n + 5] / 10), E = h.set(bn, g[2 * n + 6] / 10, g[2 * n + 7] / 10);
@@ -5268,29 +5270,29 @@ function Sn(t, e, n, r, s) {
5268
5270
  let R = S ? S[n] / 9362 : -(c.markerRotation || 0) * Math.PI / 180;
5269
5271
  const N = s.getBearing() * Math.PI / 180;
5270
5272
  if (N * k || R) {
5271
- const t = dn(yn, R, N, k, T);
5273
+ const t = dn(mn, R, N, k, T);
5272
5274
  O = h.transformMat2(O, O, t), C = h.transformMat2(C, C, t), F = h.transformMat2(F, F, t),
5273
5275
  E = h.transformMat2(E, E, t);
5274
5276
  }
5275
- return 1 === T ? fn(t, d, O, C, F, E, r, I, o, s, m, y) : (h.multiply(O, O, wn),
5276
- h.multiply(C, C, wn), h.multiply(F, F, wn), h.multiply(E, E, wn), un(t, p, O, C, F, E, I, y)),
5277
+ return 1 === T ? fn(t, d, O, C, F, E, r, I, o, s, y, m) : (h.multiply(O, O, wn),
5278
+ h.multiply(C, C, wn), h.multiply(F, F, wn), h.multiply(E, E, wn), un(t, p, O, C, F, E, I, m)),
5277
5279
  t;
5278
5280
  }
5279
5281
 
5280
5282
  const Mn = [], Pn = [], Tn = [], kn = [], In = [], On = [], Cn = [ 1, -1 ];
5281
5283
 
5282
5284
  function Fn(t, e, n, i, r, s, o, a, l) {
5283
- const c = i.material.uniforms, f = l.cameraToCenterDistance, u = i.geometry.properties, d = this.getSymbol(u.symbolIndex), p = "line" === d.textPlacement && !le(d), m = n[2];
5284
- let y = 1;
5285
+ const c = i.material.uniforms, f = l.cameraToCenterDistance, u = i.geometry.properties, d = this.getSymbol(u.symbolIndex), p = "line" === d.textPlacement && !le(d), y = n[2];
5286
+ let m = 1;
5285
5287
  if (c.textPerspectiveRatio) {
5286
- y = Kt(.5 + .5 * (1 - (1 - f / m) * c.textPerspectiveRatio), 0, 4);
5288
+ m = Kt(.5 + .5 * (1 - (1 - f / y) * c.textPerspectiveRatio), 0, 4);
5287
5289
  }
5288
5290
  const {aTextDx: g, aTextDy: v, aPitchAlign: x, aRotationAlign: b, aRotation: A} = i.geometry.properties, w = g ? g[o] : d.textDx, _ = v ? v[o] : d.textDy, S = x ? x[o] : c.pitchWithMap, M = b ? b[o] : c.rotateWithMap, P = h.set(On, w || 0, -(_ || 0));
5289
5291
  if (p) {
5290
5292
  const {aOffset: i} = u;
5291
5293
  let r = h.set(Pn, i[2 * o] / 10, i[2 * o + 1] / 10), s = h.set(Tn, i[2 * o + 2] / 10, i[2 * o + 3] / 10), f = h.set(kn, i[2 * o + 4] / 10, i[2 * o + 5] / 10), d = h.set(In, i[2 * o + 6] / 10, i[2 * o + 7] / 10);
5292
- 1 === S ? fn(t, e, r, s, f, d, a, P, c, l, m, y) : (h.multiply(r, r, Cn), h.multiply(s, s, Cn),
5293
- h.multiply(f, f, Cn), h.multiply(d, d, Cn), un(t, n, r, s, f, d, P, y));
5294
+ 1 === S ? fn(t, e, r, s, f, d, a, P, c, l, y, m) : (h.multiply(r, r, Cn), h.multiply(s, s, Cn),
5295
+ h.multiply(f, f, Cn), h.multiply(d, d, Cn), un(t, n, r, s, f, d, P, m));
5294
5296
  } else {
5295
5297
  const {aShape: i} = u;
5296
5298
  let s = h.set(Pn, i[2 * o] / 10, i[2 * o + 1] / 10), f = h.set(Tn, i[2 * o + 2] / 10, i[2 * o + 3] / 10), g = h.set(kn, i[2 * o + 4] / 10, i[2 * o + 5] / 10), v = h.set(In, i[2 * o + 6] / 10, i[2 * o + 7] / 10);
@@ -5304,7 +5306,7 @@ function Fn(t, e, n, i, r, s, o, a, l) {
5304
5306
  v = h.transformMat2(v, v, t);
5305
5307
  }
5306
5308
  const w = r / 24;
5307
- h.scale(s, s, w), h.scale(f, f, w), h.scale(g, g, w), h.scale(v, v, w), 1 === S ? fn(t, e, s, f, g, v, a, P, c, l, m, y) : un(t, n, s, f, g, v, P, y);
5309
+ h.scale(s, s, w), h.scale(f, f, w), h.scale(g, g, w), h.scale(v, v, w), 1 === S ? fn(t, e, s, f, g, v, a, P, c, l, y, m) : un(t, n, s, f, g, v, P, m);
5308
5310
  }
5309
5311
  return s = s || 0, t[0] -= s + 1, t[1] -= s + 1, t[2] += s + 1, t[3] += s + 1, t;
5310
5312
  }
@@ -5380,15 +5382,15 @@ function Dn(t, e, i, r, s, o, a, l, h) {
5380
5382
  s.textOpacity < 1 && (p = !0), e.properties.memorySize = e.getMemorySize(), e.generateBuffers(t, {
5381
5383
  excludeElementsInVAO: !0
5382
5384
  });
5383
- const m = new n.Material(d, Hn), y = new n.Mesh(e, m, {
5385
+ const y = new n.Material(d, Hn), m = new n.Mesh(e, y, {
5384
5386
  disableVAO: !0,
5385
5387
  transparent: p,
5386
5388
  castShadow: !1,
5387
5389
  picking: !0
5388
5390
  });
5389
- if (y.setLocalTransform(i), d.isHalo && (y.properties.isHalo = !0), a && y.setDefines({
5391
+ if (m.setLocalTransform(i), d.isHalo && (m.properties.isHalo = !0), a && m.setDefines({
5390
5392
  ENABLE_COLLISION: 1
5391
- }), c.push(y), d.isHalo) {
5393
+ }), c.push(m), d.isHalo) {
5392
5394
  const t = {
5393
5395
  flipY: 0,
5394
5396
  tileResolution: e.properties.tileResolution,
@@ -5466,19 +5468,19 @@ function Rn(t, e, n) {
5466
5468
  function Nn(t, e) {
5467
5469
  const n = t.getRenderer().canvas;
5468
5470
  return {
5469
- uniforms: [ "flipY", "textSize", "textDx", "textDy", "textRotation", "cameraToCenterDistance", {
5471
+ uniforms: [ {
5470
5472
  name: "projViewModelMatrix",
5471
5473
  type: "function",
5472
5474
  fn: function(t, e) {
5473
5475
  return r.multiply([], e.projViewMatrix, e.modelMatrix);
5474
5476
  }
5475
- }, "textPerspectiveRatio", "texSize", "canvasSize", "glyphSize", "pitchWithMap", "mapPitch", "texture", "gammaScale", "textFill", "textOpacity", "textHaloRadius", "textHaloFill", "textHaloBlur", "textHaloOpacity", "isHalo", {
5477
+ }, {
5476
5478
  name: "zoomScale",
5477
5479
  type: "function",
5478
5480
  fn: function(t, e) {
5479
5481
  return e.tileResolution / e.resolution;
5480
5482
  }
5481
- }, "rotateWithMap", "mapRotation", "tileRatio" ],
5483
+ } ],
5482
5484
  extraCommandProps: {
5483
5485
  viewport: {
5484
5486
  x: 0,
@@ -5523,7 +5525,7 @@ function Nn(t, e) {
5523
5525
  }
5524
5526
 
5525
5527
  function zn(t, e) {
5526
- const n = g(e.textFill), i = g(e.textSize), r = g(e.textHaloFill), s = g(e.textHaloRadius), o = g(e.textHaloOpacity), a = g(e.textDx), l = g(e.textDy), h = g(e.textOpacity), c = v(e.textPitchAlignment), f = v(e.textRotationAlignment), u = g(e.textRotation), d = v(e.textAllowOverlapFn), p = v(e.textIgnorePlacement), m = {}, x = new Int16Array(1), b = new Uint16Array(1);
5528
+ const n = g(e.textFill), i = g(e.textSize), r = g(e.textHaloFill), s = g(e.textHaloRadius), o = g(e.textHaloOpacity), a = g(e.textDx), l = g(e.textDy), h = g(e.textOpacity), c = v(e.textPitchAlignment), f = v(e.textRotationAlignment), u = g(e.textRotation), d = v(e.textAllowOverlapFn), p = v(e.textIgnorePlacement), y = {}, x = new Int16Array(1), b = new Uint16Array(1);
5527
5529
  return [ {
5528
5530
  attrName: "aTextFill",
5529
5531
  symbolName: "textFill",
@@ -5532,7 +5534,7 @@ function zn(t, e) {
5532
5534
  width: 4,
5533
5535
  evaluate: (e, i, r) => {
5534
5536
  let s = n(t.getZoom(), e);
5535
- return y(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = m[s] = m[s] || O(s).unitArray()),
5537
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = y[s] = y[s] || O(s).unitArray()),
5536
5538
  s = ie(s), s;
5537
5539
  }
5538
5540
  }, {
@@ -5543,7 +5545,7 @@ function zn(t, e) {
5543
5545
  width: 1,
5544
5546
  evaluate: (e, n, r) => {
5545
5547
  let s = i(t.getZoom(), e) || Hn.textSize;
5546
- return y(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), x[0] = s, x[0];
5548
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), x[0] = s, x[0];
5547
5549
  }
5548
5550
  }, {
5549
5551
  attrName: "aTextHaloFill",
@@ -5553,7 +5555,7 @@ function zn(t, e) {
5553
5555
  width: 4,
5554
5556
  evaluate: e => {
5555
5557
  let n = r(t.getZoom(), e);
5556
- return Array.isArray(n) || (n = m[n] = m[n] || O(n).array()), n = ie(n), n;
5558
+ return Array.isArray(n) || (n = y[n] = y[n] || O(n).array()), n = ie(n), n;
5557
5559
  }
5558
5560
  }, {
5559
5561
  attrName: "aTextHaloRadius",
@@ -5603,7 +5605,7 @@ function zn(t, e) {
5603
5605
  width: 1,
5604
5606
  evaluate: (e, n, i) => {
5605
5607
  let r = h(t.getZoom(), e);
5606
- return y(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), x[0] = 255 * r, x[0];
5608
+ return m(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), x[0] = 255 * r, x[0];
5607
5609
  }
5608
5610
  }, {
5609
5611
  attrName: "aPitchAlign",
@@ -5657,14 +5659,14 @@ function Wn(t, e, n, i, r, s, o) {
5657
5659
  const a = this.getMap(), l = e.geometry.properties, h = this.getSymbol(l.symbolIndex), c = "line" === h.textPlacement && !le(h), {aTextSize: f, aTextHaloRadius: u, aShape: d} = l;
5658
5660
  let p = f ? f[n[r]] : e.properties.textSize;
5659
5661
  null == p && (p = Hn.textSize);
5660
- const m = u ? u[n[r]] : e.properties.textHaloRadius, y = En(Un, e, n[r]), g = rn(Gn, y, o, a.width, a.height), v = i, {boxes: x, collision: b} = this.rr(e, r);
5662
+ const y = u ? u[n[r]] : e.properties.textHaloRadius, m = En(Un, e, n[r]), g = rn(Gn, m, o, a.width, a.height), v = i, {boxes: x, collision: b} = this.rr(e, r);
5661
5663
  let A = 0;
5662
5664
  if (c || 1 === e.material.uniforms.rotateWithMap || h.textRotation) {
5663
5665
  let i = 0;
5664
5666
  for (let s = r; s < r + 6 * v; s += 6) {
5665
5667
  const r = x[A] = x[A] || [];
5666
5668
  A++;
5667
- const l = Fn.call(this, r, y, g, e, p, m, n[s], o, a);
5669
+ const l = Fn.call(this, r, m, g, e, p, y, n[s], o, a);
5668
5670
  if (!t) {
5669
5671
  const e = this.isCollides(l);
5670
5672
  1 === e ? t = 1 : -1 === e && i++;
@@ -5676,7 +5678,7 @@ function Wn(t, e, n, i, r, s, o) {
5676
5678
  for (let h = r; h < s; h += 6) {
5677
5679
  const r = d[2 * n[h] + 1];
5678
5680
  if (l !== r || h === s - 6) {
5679
- const c = n[h === s - 6 ? h : h - 6], f = Fn.call(this, Vn, y, g, e, p, m, i, o, a), u = Fn.call(this, jn, y, g, e, p, m, c, o, a), d = x[A] = x[A] || [];
5681
+ const c = n[h === s - 6 ? h : h - 6], f = Fn.call(this, Vn, m, g, e, p, y, i, o, a), u = Fn.call(this, jn, m, g, e, p, y, c, o, a), d = x[A] = x[A] || [];
5680
5682
  A++, d[0] = Math.min(f[0], u[0]), d[1] = Math.min(f[1], u[1]), d[2] = Math.max(f[2], u[2]),
5681
5683
  d[3] = Math.max(f[3], u[3]), i = n[h], l = r, !t && this.isCollides(d) && (t = 1);
5682
5684
  }
@@ -5703,7 +5705,7 @@ function Bn(t, e) {
5703
5705
 
5704
5706
  const Xn = [], Yn = [];
5705
5707
 
5706
- var Jn = "#define SHADER_NAME TEXT\n#define RAD 0.0174532925\nattribute vec3 aPosition;\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n#ifdef HAS_ROTATION\nfloat o = aRotation / 9362. - mapRotation * i;\n#else\nfloat o = textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n o += mapRotation;\n }\n float u = sin(o);\n float v = cos(o);\n mat2 A = mat2(v, -1. * u, u, v);\n j = A * (j / glyphSize * d);\n float B = l / cameraToCenterDistance;\n if(h == .0) {\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * l;\n } else {\n vec2 C = j;\n gl_Position = projViewModelMatrix * vec4(c + vec3(C, .0) * tileRatio / zoomScale * B * n, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * l;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = k / texSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\n#else\n#ifdef ENABLE_COLLISION\nbool D = aOpacity == 255.;\n#else\nbool D = true;\n#endif\nfbo_picking_setData(gl_Position.w, D);\n#endif\n}", qn = "#define SHADER_NAME TEXT\n#define SDF_PX 8.0\n#define DEVICE_PIXEL_RATIO 1.0\n#define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\nprecision mediump float;\nuniform sampler2D texture;\nuniform float textOpacity;\nuniform highp float gammaScale;\nuniform int isHalo;\nuniform highp float textHaloBlur;\n#ifdef HAS_TEXT_HALO_OPACITY\nvarying float vTextHaloOpacity;\n#else\nuniform float textHaloOpacity;\n#endif\nvarying vec2 vTexCoord;\nvarying float vSize;\nvarying float vGammaScale;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nvarying vec4 vTextFill;\n#else\nuniform vec4 textFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvarying vec4 vTextHaloFill;\n#else\nuniform vec4 textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvarying float vTextHaloRadius;\n#else\nuniform highp float textHaloRadius;\n#endif\nvoid main() {\n \n#ifdef HAS_TEXT_FILL\nvec4 c = vTextFill;\n#else\nvec4 c = textFill;\n#endif\nfloat d = vSize / 24.;\n lowp vec4 e = c;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n if(isHalo == 1) {\n \n#ifdef HAS_TEXT_HALO_FILL\nvec4 i = vTextHaloFill;\n#else\nvec4 i = textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nfloat j = vTextHaloRadius;\n#else\nfloat j = textHaloRadius;\n#endif\ne = i;\n f = (textHaloBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (d * gammaScale);\n h = (6. - j / d) / SDF_PX;\n#ifdef HAS_TEXT_HALO_OPACITY\nfloat k = vTextHaloOpacity / 255.;\n#else\nfloat k = textHaloOpacity;\n#endif\ne *= k * 1.25;\n }\n float l = texture2D(texture, vTexCoord).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * textOpacity * vOpacity);\n}";
5708
+ var Jn = "#define SHADER_NAME TEXT\n#define RAD 0.0174532925\nattribute vec3 aPosition;\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n#ifdef HAS_ROTATION\nfloat o = aRotation / 9362. - mapRotation * i;\n#else\nfloat o = textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\no += mapRotation;\n#else\no -= mapRotation;\n#endif\n }\n float u = sin(o);\n float v = cos(o);\n mat2 A = mat2(v, -1. * u, u, v);\n j = A * (j / glyphSize * d);\n float B = l / cameraToCenterDistance;\n if(h == .0) {\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * l;\n } else {\n vec2 C = j;\n gl_Position = projViewModelMatrix * vec4(c + vec3(C, .0) * tileRatio / zoomScale * B * n, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * l;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = k / texSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\n#else\n#ifdef ENABLE_COLLISION\nbool D = aOpacity == 255.;\n#else\nbool D = true;\n#endif\nfbo_picking_setData(gl_Position.w, D);\n#endif\n}", qn = "#define SHADER_NAME TEXT\n#define SDF_PX 8.0\n#define DEVICE_PIXEL_RATIO 1.0\n#define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\nprecision mediump float;\nuniform sampler2D texture;\nuniform float textOpacity;\nuniform highp float gammaScale;\nuniform int isHalo;\nuniform highp float textHaloBlur;\n#ifdef HAS_TEXT_HALO_OPACITY\nvarying float vTextHaloOpacity;\n#else\nuniform float textHaloOpacity;\n#endif\nvarying vec2 vTexCoord;\nvarying float vSize;\nvarying float vGammaScale;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nvarying vec4 vTextFill;\n#else\nuniform vec4 textFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvarying vec4 vTextHaloFill;\n#else\nuniform vec4 textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvarying float vTextHaloRadius;\n#else\nuniform highp float textHaloRadius;\n#endif\nvoid main() {\n \n#ifdef HAS_TEXT_FILL\nvec4 c = vTextFill;\n#else\nvec4 c = textFill;\n#endif\nfloat d = vSize / 24.;\n lowp vec4 e = c;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n if(isHalo == 1) {\n \n#ifdef HAS_TEXT_HALO_FILL\nvec4 i = vTextHaloFill;\n#else\nvec4 i = textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nfloat j = vTextHaloRadius;\n#else\nfloat j = textHaloRadius;\n#endif\ne = i;\n f = (textHaloBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (d * gammaScale);\n h = (6. - j / d) / SDF_PX;\n#ifdef HAS_TEXT_HALO_OPACITY\nfloat k = vTextHaloOpacity / 255.;\n#else\nfloat k = textHaloOpacity;\n#endif\ne *= k * 1.25;\n }\n float l = texture2D(texture, vTexCoord).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * textOpacity * vOpacity);\n}";
5707
5709
 
5708
5710
  const Zn = new Uint16Array(1), Kn = new Int8Array(1);
5709
5711
 
@@ -5757,7 +5759,7 @@ function Qn(t, e) {
5757
5759
  const o = e.markerTextFit, l = a ? a(t.getZoom(), i) : o;
5758
5760
  if ("both" === l || "width" === l) return r;
5759
5761
  let h = n(t.getZoom(), i);
5760
- return y(h) && (h = this.evaluateInFnTypeConfig(h, s, t, i)), d[0] = h, d[0];
5762
+ return m(h) && (h = this.evaluateInFnTypeConfig(h, s, t, i)), d[0] = h, d[0];
5761
5763
  }
5762
5764
  }, {
5763
5765
  attrName: "aMarkerHeight",
@@ -5769,7 +5771,7 @@ function Qn(t, e) {
5769
5771
  const o = e.markerTextFit, l = a ? a(t.getZoom(), n) : o;
5770
5772
  if ("both" === l || "height" === l) return r;
5771
5773
  let h = i(t.getZoom(), n);
5772
- return y(h) && (h = this.evaluateInFnTypeConfig(h, s, t, n)), d[0] = h, d[0];
5774
+ return m(h) && (h = this.evaluateInFnTypeConfig(h, s, t, n)), d[0] = h, d[0];
5773
5775
  }
5774
5776
  }, {
5775
5777
  attrName: "aMarkerDx",
@@ -5779,7 +5781,7 @@ function Qn(t, e) {
5779
5781
  define: "HAS_MARKER_DX",
5780
5782
  evaluate: (e, n, i) => {
5781
5783
  let s = r(t.getZoom(), e);
5782
- return y(s) && (s = this.evaluateInFnTypeConfig(s, i, t, e)), d[0] = s, d[0];
5784
+ return m(s) && (s = this.evaluateInFnTypeConfig(s, i, t, e)), d[0] = s, d[0];
5783
5785
  }
5784
5786
  }, {
5785
5787
  attrName: "aMarkerDy",
@@ -5789,7 +5791,7 @@ function Qn(t, e) {
5789
5791
  define: "HAS_MARKER_DY",
5790
5792
  evaluate: (e, n, i) => {
5791
5793
  let r = s(t.getZoom(), e);
5792
- return y(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), d[0] = r, d[0];
5794
+ return m(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), d[0] = r, d[0];
5793
5795
  }
5794
5796
  }, {
5795
5797
  attrName: "aColorOpacity",
@@ -5799,7 +5801,7 @@ function Qn(t, e) {
5799
5801
  define: "HAS_OPACITY",
5800
5802
  evaluate: (e, n, i) => {
5801
5803
  let r = o(t.getZoom(), e);
5802
- return y(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), d[0] = 255 * r, d[0];
5804
+ return m(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), d[0] = 255 * r, d[0];
5803
5805
  }
5804
5806
  }, {
5805
5807
  attrName: "aPitchAlign",
@@ -5850,7 +5852,7 @@ function ti(t, e, n, i) {
5850
5852
  if (!n || !i || "none" === i) return;
5851
5853
  const r = function(t, e, n) {
5852
5854
  let i = t.properties.textFitFn;
5853
- y(n) && (i = t.properties.textFitFn = v(n));
5855
+ m(n) && (i = t.properties.textFitFn = v(n));
5854
5856
  const r = "none" !== n, s = [], o = t.getElements(), a = t.data.aPickingId;
5855
5857
  let l, h, c;
5856
5858
  e && (l = e.getElements(), h = e.data.aPickingId, c = e.data.aCount);
@@ -5864,27 +5866,27 @@ function ti(t, e, n, i) {
5864
5866
  end: 6 * c[t]
5865
5867
  };
5866
5868
  }
5867
- let d = !1, p = !1, m = 0;
5869
+ let d = !1, p = !1, y = 0;
5868
5870
  const g = [];
5869
5871
  for (let t = 0; t < o.length; t += 6) {
5870
- const e = o[t], y = a[e];
5871
- if (!d && u) for (;u.pickingId < y && u.end < l.length; ) {
5872
+ const e = o[t], m = a[e];
5873
+ if (!d && u) for (;u.pickingId < m && u.end < l.length; ) {
5872
5874
  const t = u.end, e = l[t];
5873
5875
  u.start = t, u.end = t + 6 * c[e], u.pickingId = h[e];
5874
5876
  }
5875
- if (!d && u && u.pickingId < y && (d = !0, !r)) {
5877
+ if (!d && u && u.pickingId < m && (d = !0, !r)) {
5876
5878
  if (!p) return [];
5877
- for (let e = t; e < o.length; e += 6) s[m++] = [ -1, -1 ];
5879
+ for (let e = t; e < o.length; e += 6) s[y++] = [ -1, -1 ];
5878
5880
  return s;
5879
5881
  }
5880
- const v = f[y] && f[y].feature, x = v && v.properties || {};
5882
+ const v = f[m] && f[m].feature, x = v && v.properties || {};
5881
5883
  x.$layer = v && v.layer, x.$type = v && v.type;
5882
5884
  const b = i ? i(null, x) : n;
5883
- if (delete x.$layer, delete x.$type, u && y === u.pickingId) {
5884
- s[m++] = [ u.start, u.end ];
5885
+ if (delete x.$layer, delete x.$type, u && m === u.pickingId) {
5886
+ s[y++] = [ u.start, u.end ];
5885
5887
  const t = u.end, e = l[t];
5886
5888
  u.start = t, u.end = t + 6 * c[e], u.pickingId = h[e], p = !0;
5887
- } else if (b && "none" !== b) for (let e = t; e < t + 6; e++) g.push(e); else s[m++] = [ -1, -1 ];
5889
+ } else if (b && "none" !== b) for (let e = t; e < t + 6; e++) g.push(e); else s[y++] = [ -1, -1 ];
5888
5890
  }
5889
5891
  if (g.length) if (g.length === o.length) t.setElements([]); else {
5890
5892
  const e = [];
@@ -5925,7 +5927,7 @@ function ti(t, e, n, i) {
5925
5927
  function ei(t, e) {
5926
5928
  const n = this.getSymbolDef(e.properties.symbolIndex), i = n.markerTextFit, r = e.properties;
5927
5929
  let s = "both" === i || "width" === i, o = "both" === i || "height" === i;
5928
- if (y(n.markerTextFit)) {
5930
+ if (m(n.markerTextFit)) {
5929
5931
  let t = e.properties.textFitFn;
5930
5932
  t || (t = e.properties.textFitFn = g(n.markerTextFit));
5931
5933
  const {features: i} = e.properties, a = e.properties.elements || e.elements, {aPickingId: l} = e.data, h = [], c = [];
@@ -5934,7 +5936,7 @@ function ei(t, e) {
5934
5936
  const n = i[l[a[e]]], r = n && n.feature || {}, s = r.properties || {};
5935
5937
  s.$layer = r.layer, s.$type = r.type;
5936
5938
  let o = t(null, s);
5937
- if (y(o)) {
5939
+ if (m(o)) {
5938
5940
  o = (s.textFitFn = s.textFitFn || g(o))(null, s);
5939
5941
  }
5940
5942
  delete s.$layer, delete s.$type, "both" === o ? (h.push(e / 6), c.push(e / 6)) : "width" === o ? (f = !1,
@@ -5966,7 +5968,7 @@ function ei(t, e) {
5966
5968
  e.data.aMarkerHeight = new Uint16Array(c);
5967
5969
  }
5968
5970
  const f = this.getSymbolDef(e.properties.textGeo.properties.symbolIndex), u = g(f.textSize);
5969
- ni.call(this, t, e), (!y(f.textSize) || u.isZoomConstant && u.isFeatureConstant) && (r.isFitConstant = !0);
5971
+ ni.call(this, t, e), (!m(f.textSize) || u.isZoomConstant && u.isFeatureConstant) && (r.isFitConstant = !0);
5970
5972
  }
5971
5973
 
5972
5974
  function ni(t, e) {
@@ -5976,22 +5978,22 @@ function ni(t, e) {
5976
5978
  if (r.isFitConstant || !r.labelShape || !r.labelShape.length) return;
5977
5979
  const s = this.getSymbolDef(e.properties.symbolIndex), o = this.getSymbolDef(n.properties.symbolIndex).textSize;
5978
5980
  let a;
5979
- y(o) && (a = i.lr ? i.lr : i.lr = g(o));
5981
+ m(o) && (a = i.lr ? i.lr : i.lr = g(o));
5980
5982
  const l = s.markerTextFitPadding || [ 0, 0, 0, 0 ];
5981
5983
  let h;
5982
- y(l) && (h = r.hr ? r.hr : r.hr = v(l));
5983
- const c = t.getZoom(), {fitIcons: f, fitWidthIcons: u, fitHeightIcons: d} = r, {aMarkerWidth: p, aMarkerHeight: m, labelShape: x} = r, b = r.elements || e.elements, {features: A, aPickingId: w} = r, _ = (t, e, n, i) => {
5984
+ m(l) && (h = r.hr ? r.hr : r.hr = v(l));
5985
+ const c = t.getZoom(), {fitIcons: f, fitWidthIcons: u, fitHeightIcons: d} = r, {aMarkerWidth: p, aMarkerHeight: y, labelShape: x} = r, b = r.elements || e.elements, {features: A, aPickingId: w} = r, _ = (t, e, n, i) => {
5984
5986
  const s = x[4 * e], f = x[4 * e + 1], u = x[4 * e + 2], d = x[4 * e + 3];
5985
5987
  if (!(s || f || u || d)) return;
5986
5988
  const b = w[t], _ = A[b] && A[b].feature, S = _ && _.properties || {};
5987
5989
  S.$layer = _ && _.layer, S.$type = _ && _.type;
5988
5990
  let M = a ? a(c, S) : o;
5989
- if (y(M)) {
5991
+ if (m(M)) {
5990
5992
  M = (S.textSizeFn = S.textSizeFn || g(M))(c, S);
5991
5993
  }
5992
5994
  M /= 24;
5993
5995
  let P, T, k = h ? h(c, S) : l;
5994
- if (y(k)) {
5996
+ if (m(k)) {
5995
5997
  k = (S.fitPaddingFn = S.fitPaddingFn || v(k))(c, S);
5996
5998
  }
5997
5999
  if (k[0] === k[2] && k[1] === k[3] || (P = r.aPadOffsetX, T = r.aPadOffsetY, P || (P = r.aPadOffsetX = new Int8Array(p.length),
@@ -6003,9 +6005,9 @@ function ni(t, e) {
6003
6005
  Kn[0] = e, P[t] !== Kn[0] && (oe(P, e, t, t + 4), P.dirty = !0);
6004
6006
  }
6005
6007
  }
6006
- if (m && i) {
6008
+ if (y && i) {
6007
6009
  const e = Math.abs((d - f) / 10 * M) + (k[0] + k[2] || 0);
6008
- if (Zn[0] = e, m[t] !== Zn[0] && (oe(m, Zn[0], t, t + 4), m.dirty = !0), T) {
6010
+ if (Zn[0] = e, y[t] !== Zn[0] && (oe(y, Zn[0], t, t + 4), y.dirty = !0), T) {
6009
6011
  const e = k[0] - (k[0] + k[2]) / 2;
6010
6012
  Kn[0] = e, T[t] !== Kn[0] && (oe(T, e, t, t + 4), T.dirty = !0);
6011
6013
  }
@@ -6053,7 +6055,10 @@ class hi extends $e {
6053
6055
  constructor(t, e, n, i, r) {
6054
6056
  super(t, e, n, i, r), this.propAllowOverlap = "markerAllowOverlap", this.propIgnorePlacement = "markerIgnorePlacement",
6055
6057
  this.Gn = {}, this.isLabelCollides = Wn.bind(this), this.cr = ii.bind(this), this.ur = ri.bind(this),
6056
- this.dr = si.bind(this), this.pr = oi.bind(this), this.mr = [];
6058
+ this.dr = si.bind(this), this.pr = oi.bind(this), this.yr = [];
6059
+ }
6060
+ setTextShaderDefines(t) {
6061
+ this.mr = t;
6057
6062
  }
6058
6063
  createFnTypeConfig(t, e) {
6059
6064
  return {
@@ -6062,7 +6067,7 @@ class hi extends $e {
6062
6067
  };
6063
6068
  }
6064
6069
  startFrame(...t) {
6065
- return this.mr.length = 0, super.startFrame(...t);
6070
+ return this.yr.length = 0, super.startFrame(...t);
6066
6071
  }
6067
6072
  createGeometry(t, e) {
6068
6073
  return t && t.empty && (t.data = {
@@ -6072,8 +6077,8 @@ class hi extends $e {
6072
6077
  }
6073
6078
  postCreateGeometry(t, e) {
6074
6079
  const {geometry: n, symbolIndex: i} = t, r = this.getSymbolDef(i), s = this.getFnTypeConfig(i);
6075
- if (this.yr(n)) n.properties.iconAtlas ? this.drawDebugAtlas(n.properties.iconAtlas) : n.properties.isEmpty = !0,
6076
- $n(n, r, s.icon); else if (this.gr(n) && le(r)) {
6080
+ if (this.gr(n)) n.properties.iconAtlas ? this.drawDebugAtlas(n.properties.iconAtlas) : n.properties.isEmpty = !0,
6081
+ $n(n, r, s.icon); else if (this.vr(n) && le(r)) {
6077
6082
  const t = e[e.length - 1];
6078
6083
  if (t) {
6079
6084
  const {geometry: e, symbolIndex: s} = t;
@@ -6084,7 +6089,7 @@ class hi extends $e {
6084
6089
  }
6085
6090
  }
6086
6091
  }
6087
- vr(t) {
6092
+ xr(t) {
6088
6093
  if (!this.layer.options.collision) return;
6089
6094
  const {collideIds: e, elements: n, aCount: i} = t.properties, r = e, s = {};
6090
6095
  if (!n) return void (t.properties.collideBoxIndex = s);
@@ -6098,7 +6103,7 @@ class hi extends $e {
6098
6103
  const s = this.isEnableCollision(), o = this.layer, {geometry: a, symbolIndex: l} = t;
6099
6104
  a.properties.symbolIndex = l;
6100
6105
  const h = this.getSymbolDef(l), c = this.getSymbol(l), f = this.getFnTypeConfig(l), u = [];
6101
- if (this.yr(a)) {
6106
+ if (this.gr(a)) {
6102
6107
  const t = function(t, e, i, r, s, o, a, l, h) {
6103
6108
  if (e.isDisposed() || 0 === e.data.aPosition.length) return null;
6104
6109
  const c = e.properties.iconAtlas;
@@ -6141,25 +6146,25 @@ class hi extends $e {
6141
6146
  d;
6142
6147
  }(this.regl, a, e, 0, c, f.icon, o.options.collision, !s, this.isEnableUniquePlacement());
6143
6148
  t && (delete t.geometry.properties.glyphAtlas, u.push(t));
6144
- } else if (this.gr(a)) {
6149
+ } else if (this.vr(a)) {
6145
6150
  const t = Dn.call(this, this.regl, a, e, h, c, f.text, o.options.collision, !s, this.isEnableUniquePlacement());
6146
6151
  t.length && (t.forEach(t => {
6147
6152
  delete t.geometry.properties.iconAtlas;
6148
6153
  }), u.push(...t));
6149
6154
  }
6150
- return "line" === h.markerPlacement && this.xr(a, r), "line" !== h.markerPlacement && "line" !== h.textPlacement || u.forEach(t => t.properties.isLinePlacement = !0),
6151
- this.vr(a), u;
6155
+ return "line" === h.markerPlacement && this.br(a, r), "line" !== h.markerPlacement && "line" !== h.textPlacement || u.forEach(t => t.properties.isLinePlacement = !0),
6156
+ this.xr(a), u;
6152
6157
  }
6153
- xr(t, e) {
6158
+ br(t, e) {
6154
6159
  const {collideIds: n} = t.properties, i = new Uint16Array(n.length);
6155
- if (this.yr(t)) {
6160
+ if (this.gr(t)) {
6156
6161
  let r = 0;
6157
6162
  for (let t = 0; t < n.length; t += 4) i.fill(r++, t, t + 4);
6158
6163
  t.properties.collideIds = i, t.properties.uniqueCollideIds = ce(i), e.markerCollideMap = {
6159
6164
  old: n,
6160
6165
  new: i
6161
6166
  };
6162
- } else if (this.gr(t)) {
6167
+ } else if (this.vr(t)) {
6163
6168
  const {collideIds: n, aCount: i} = t.properties;
6164
6169
  if (!i) return;
6165
6170
  if (e.markerCollideMap) {
@@ -6186,7 +6191,7 @@ class hi extends $e {
6186
6191
  if (this.Gi() && t.length > 0) {
6187
6192
  const e = new Be(t);
6188
6193
  e.properties.uniqueCollideIds = t[0].geometry.properties.uniqueCollideIds, e.properties.meshKey = t[0].properties.meshKey,
6189
- e.properties.level = t[0].properties.level, this.mr.push(e);
6194
+ e.properties.level = t[0].properties.level, this.yr.push(e);
6190
6195
  }
6191
6196
  for (let e = 0; e < t.length; e++) {
6192
6197
  if (!this.isMeshIterable(t[e])) continue;
@@ -6209,31 +6214,31 @@ class hi extends $e {
6209
6214
  if (!this.Gi()) return;
6210
6215
  super.updateCollision(t);
6211
6216
  const e = this.scene.getMeshes();
6212
- e && e.length ? (this.br(t.timestamp), this.mr = [], this.xi()) : this.xi();
6217
+ e && e.length ? (this.Ar(t.timestamp), this.yr = [], this.xi()) : this.xi();
6213
6218
  }
6214
6219
  callCurrentTileShader(t, e) {
6215
6220
  this.shader.filter = e.sceneFilter ? [ this.cr, e.sceneFilter ] : this.cr, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
6216
- this.Ar.filter = e.sceneFilter ? [ this.dr, e.sceneFilter ] : this.dr, this.renderer.render(this.Ar, t, this.scene, this.getRenderFBO(e));
6221
+ this.wr.filter = e.sceneFilter ? [ this.dr, e.sceneFilter ] : this.dr, this.renderer.render(this.wr, t, this.scene, this.getRenderFBO(e));
6217
6222
  }
6218
6223
  callBackgroundTileShader(t, e) {
6219
6224
  this.shader.filter = e.sceneFilter ? [ this.ur, e.sceneFilter ] : this.ur, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
6220
- this.Ar.filter = e.sceneFilter ? [ this.pr, e.sceneFilter ] : this.pr, this.renderer.render(this.Ar, t, this.scene, this.getRenderFBO(e));
6225
+ this.wr.filter = e.sceneFilter ? [ this.pr, e.sceneFilter ] : this.pr, this.renderer.render(this.wr, t, this.scene, this.getRenderFBO(e));
6221
6226
  }
6222
6227
  isMeshIterable(t) {
6223
6228
  return t && t.geometry && !t.geometry.properties.isEmpty && t.material && !t.material.get("isHalo") && this.isMeshVisible(t) && !(this.shouldIgnoreBackground() && !this.layer.getRenderer().isForeground(t));
6224
6229
  }
6225
- br() {
6230
+ Ar() {
6226
6231
  if (!this.Gi()) return;
6227
- let t = this.mr;
6228
- t && t.length && this.wr(t);
6232
+ let t = this.yr;
6233
+ t && t.length && this._r(t);
6229
6234
  }
6230
- _r(t, e, n, i) {
6235
+ Sr(t, e, n, i) {
6231
6236
  return this.updateBoxCollisionFading(!0, t, e, n, i);
6232
6237
  }
6233
6238
  isEnableUniquePlacement() {
6234
6239
  return this.isEnableCollision() && !0 === this.sceneConfig.uniquePlacement;
6235
6240
  }
6236
- wr(t) {
6241
+ _r(t) {
6237
6242
  const e = this.layer.getRenderer();
6238
6243
  t = t.sort(ci);
6239
6244
  for (let n = 0; n < t.length; n++) {
@@ -6248,12 +6253,12 @@ class hi extends $e {
6248
6253
  const s = e.isForeground(i.meshes[0]);
6249
6254
  if (this.shouldIgnoreBackground() && !s) continue;
6250
6255
  const o = i.properties.meshKey;
6251
- this.startMeshCollision(i), this.Sr(i), this.forEachBox(i, this._r), this.Mr(i),
6256
+ this.startMeshCollision(i), this.Mr(i), this.forEachBox(i, this.Sr), this.Pr(i),
6252
6257
  this.endMeshCollision(o);
6253
- for (let t = 0; t < i.meshes.length; t++) this.Pr(i.meshes[t]);
6258
+ for (let t = 0; t < i.meshes.length; t++) this.Tr(i.meshes[t]);
6254
6259
  }
6255
6260
  }
6256
- Pr(t) {
6261
+ Tr(t) {
6257
6262
  const e = t && t.geometry && t.geometry.properties.aOpacity;
6258
6263
  e && e.dirty && (t.geometry.updateData("aOpacity", e), e.dirty = !1);
6259
6264
  }
@@ -6263,11 +6268,11 @@ class hi extends $e {
6263
6268
  const i = {
6264
6269
  boxIndex: 0
6265
6270
  }, r = n.length;
6266
- for (let s = 0; s < r; s++) this.Tr(t, n[s], e, i);
6271
+ for (let s = 0; s < r; s++) this.kr(t, n[s], e, i);
6267
6272
  }
6268
- Tr(t, e, n, i) {
6273
+ kr(t, e, n, i) {
6269
6274
  const s = this.getMap(), {collideBoxIndex: o} = t.meshes[0].geometry.properties;
6270
- if (!o[e]) return !1;
6275
+ if (!(o && o[e])) return !1;
6271
6276
  const a = r.multiply(ai, s.projViewMatrix, t.meshes[0].localTransform);
6272
6277
  let l, h = !1;
6273
6278
  const c = t.meshes;
@@ -6289,21 +6294,21 @@ class hi extends $e {
6289
6294
  const [a, f, d] = o;
6290
6295
  let p = 1;
6291
6296
  r && (p = r[i[a]]);
6292
- const m = a + 0 * p * 6;
6293
- l[u].mesh = c[t], l[u].start = m, l[u].end = f, l[u].boxCount = d, l[u].allElements = i,
6297
+ const y = a + 0 * p * 6;
6298
+ l[u].mesh = c[t], l[u].start = y, l[u].end = f, l[u].boxCount = d, l[u].allElements = i,
6294
6299
  u++;
6295
6300
  }
6296
6301
  if (!h) return !1;
6297
- return n.call(this, t, l, a, i.boxIndex++) && this.kr(t, e), !0;
6302
+ return n.call(this, t, l, a, i.boxIndex++) && this.Ir(t, e), !0;
6298
6303
  }
6299
- Sr(t) {
6304
+ Mr(t) {
6300
6305
  const e = t.meshes;
6301
6306
  for (let t = 0; t < e.length; t++) {
6302
6307
  const n = e[t], i = n && n.geometry;
6303
6308
  i && (i.properties.visElemts.count = 0);
6304
6309
  }
6305
6310
  }
6306
- kr(t, e) {
6311
+ Ir(t, e) {
6307
6312
  const n = t.meshes;
6308
6313
  for (let t = 0; t < n.length; t++) {
6309
6314
  const i = n[t];
@@ -6318,7 +6323,7 @@ class hi extends $e {
6318
6323
  a.count = f;
6319
6324
  }
6320
6325
  }
6321
- Mr(t) {
6326
+ Pr(t) {
6322
6327
  const e = t.meshes;
6323
6328
  for (let t = 0; t < e.length; t++) {
6324
6329
  const n = e[t], i = n && n.geometry;
@@ -6328,7 +6333,7 @@ class hi extends $e {
6328
6333
  }
6329
6334
  }
6330
6335
  isBoxCollides(t, e, n, i, r, s) {
6331
- if (this.gr(t.geometry)) return Wn.call(this, 0, t, e, n, i, r, s);
6336
+ if (this.vr(t.geometry)) return Wn.call(this, 0, t, e, n, i, r, s);
6332
6337
  if (t.geometry.properties.isEmpty) return li;
6333
6338
  const o = this.getMap(), {boxes: a, collision: l} = this.rr(t, i);
6334
6339
  let h = 0, c = 0, f = 0;
@@ -6364,13 +6369,13 @@ class hi extends $e {
6364
6369
  this.shader = new n.MeshShader({
6365
6370
  vert: en,
6366
6371
  frag: "#define SHADER_NAME MARKER\nprecision mediump float;\nuniform sampler2D texture;\nuniform lowp float markerOpacity;\nuniform lowp float blendSrcIsOne;\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nvoid main() {\n gl_FragColor = texture2D(texture, vTexCoord) * markerOpacity * vOpacity;\n if(blendSrcIsOne == 1.) {\n gl_FragColor *= gl_FragColor.a;\n }\n}",
6367
- uniforms: [ "flipY", "markerWidth", "markerHeight", "markerDx", "markerDy", "markerRotation", "cameraToCenterDistance", {
6372
+ uniforms: [ {
6368
6373
  name: "projViewModelMatrix",
6369
6374
  type: "function",
6370
6375
  fn: function(t, e) {
6371
6376
  return r.multiply([], e.projViewMatrix, e.modelMatrix);
6372
6377
  }
6373
- }, "texSize", "canvasSize", "iconSize", "pitchWithMap", "mapPitch", "markerPerspectiveRatio", "texture", "rotateWithMap", "mapRotation", "tileRatio", {
6378
+ }, {
6374
6379
  name: "zoomScale",
6375
6380
  type: "function",
6376
6381
  fn: function(t, e) {
@@ -6396,22 +6401,23 @@ class hi extends $e {
6396
6401
  }
6397
6402
  }
6398
6403
  });
6399
- const {uniforms: s, extraCommandProps: o} = Nn.call(this, this.layer, this.sceneConfig);
6400
- if (this.Ar = new n.MeshShader({
6404
+ const {uniforms: s, extraCommandProps: o} = Nn.call(this, this.layer, this.sceneConfig), a = this.mr || {};
6405
+ if (this.wr = new n.MeshShader({
6401
6406
  vert: Jn,
6402
6407
  frag: qn,
6403
6408
  uniforms: s,
6404
- extraCommandProps: o
6409
+ extraCommandProps: o,
6410
+ defines: a
6405
6411
  }), this.pickingFBO) {
6406
6412
  const t = new n.FBORayPicking(this.renderer, {
6407
6413
  vert: "#define PICKING_MODE 1\n" + en,
6408
- uniforms: [ "flipY", "markerWidth", "markerHeight", "markerDx", "markerDy", "markerRotation", "cameraToCenterDistance", {
6414
+ uniforms: [ {
6409
6415
  name: "projViewModelMatrix",
6410
6416
  type: "function",
6411
6417
  fn: function(t, e) {
6412
6418
  return r.multiply([], e.projViewMatrix, e.modelMatrix);
6413
6419
  }
6414
- }, "canvasSize", "iconSize", "pitchWithMap", "mapPitch", "markerPerspectiveRatio", "rotateWithMap", "mapRotation", "tileRatio", {
6420
+ }, {
6415
6421
  name: "zoomScale",
6416
6422
  type: "function",
6417
6423
  fn: function(t, e) {
@@ -6450,15 +6456,15 @@ class hi extends $e {
6450
6456
  };
6451
6457
  }
6452
6458
  getUniqueEntryKey(t, e) {
6453
- if (!this.gr(t.geometry)) return null;
6459
+ if (!this.vr(t.geometry)) return null;
6454
6460
  const {elements: n} = t.geometry.properties;
6455
6461
  return Bn(t, n[e]);
6456
6462
  }
6457
- yr(t) {
6463
+ gr(t) {
6458
6464
  const {symbolIndex: e} = t.properties;
6459
6465
  return 0 === e.type;
6460
6466
  }
6461
- gr(t) {
6467
+ vr(t) {
6462
6468
  const {symbolIndex: e} = t.properties;
6463
6469
  return 1 === e.type;
6464
6470
  }
@@ -6471,37 +6477,37 @@ function ci(t, e) {
6471
6477
  const fi = [], ui = [], di = [];
6472
6478
 
6473
6479
  function pi(t, e, n, r, s, o, a, l) {
6474
- const {aGlyphOffset: c, aSegment: f, aTextDx: u, aTextDy: d, symbolIndex: p} = e.geometry.properties, m = this.getSymbol(p), y = u ? u[s] : m.textDx, g = d ? d[s] : m.textDy, v = h.set(di, y || 0, g || 0), x = h.set(fi, c[2 * s], c[2 * s + 1]), b = i.set(ui, f[3 * s], f[3 * s + 1], f[3 * s + 2]);
6480
+ const {aGlyphOffset: c, aSegment: f, aTextDx: u, aTextDy: d, symbolIndex: p} = e.geometry.properties, y = this.getSymbol(p), m = u ? u[s] : y.textDx, g = d ? d[s] : y.textDy, v = h.set(di, m || 0, g || 0), x = h.set(fi, c[2 * s], c[2 * s + 1]), b = i.set(ui, f[3 * s], f[3 * s + 1], f[3 * s + 2]);
6475
6481
  return function(t, e, n, i, r, s, o, a, l, h, c, f) {
6476
6482
  const u = i[0] * h, d = c ? u - r : u + r;
6477
- let p = d > 0 ? 1 : -1, m = 0;
6478
- c && (p *= -1, m = Math.PI), p < 0 && (m += Math.PI);
6479
- const y = a + l, g = Math.abs(d);
6483
+ let p = d > 0 ? 1 : -1, y = 0;
6484
+ c && (p *= -1, y = Math.PI), p < 0 && (y += Math.PI);
6485
+ const m = a + l, g = Math.abs(d);
6480
6486
  let v = p > 0 ? o : o + 1, x = E.convert(n), b = E.convert(n), A = 0, w = 0;
6481
6487
  for (;A + w <= g; ) {
6482
- if (v += p, v < a || v >= y) return null;
6488
+ if (v += p, v < a || v >= m) return null;
6483
6489
  b.x = x.x, b.y = x.y, x.x = e[3 * v], x.y = e[3 * v + 1], A += w, w = b.dist(x) / f;
6484
6490
  }
6485
- const _ = (g - A) / w, S = x.sub(b), M = S.mult(_).Ir(b);
6486
- M.Ir(S.Fr().Cr().Or(s * p));
6487
- const P = m + Math.atan2(x.y - b.y, x.x - b.x);
6491
+ const _ = (g - A) / w, S = x.sub(b), M = S.mult(_).Or(b);
6492
+ M.Or(S.Er().Fr().Cr(s * p));
6493
+ const P = y + Math.atan2(x.y - b.y, x.x - b.x);
6488
6494
  return t[0] = (M.x - n[0]) / f, t[1] = (M.y - n[1]) / f, t[2] = P, t;
6489
6495
  }(t, r, o, x, v[0], v[1], b[0], b[1], b[2], n / 24, l, a);
6490
6496
  }
6491
6497
 
6492
- const mi = [], yi = [];
6498
+ const yi = [], mi = [];
6493
6499
 
6494
6500
  function gi(t, e, n, r, s, o, a, l, c, f, u) {
6495
6501
  const {aVertical: d} = n.geometry.properties, p = d[o];
6496
- let m, y, g = pi.call(this, mi, n, r, s, o, l, c, !1);
6502
+ let y, m, g = pi.call(this, yi, n, r, s, o, l, c, !1);
6497
6503
  if (!g) return null;
6498
- if (i.copy(t, g), g = pi.call(this, yi, n, r, s, a, l, c, !1), !g) return null;
6499
- if (i.copy(e, g), u && (h.transformMat2(mi, mi, u), h.transformMat2(yi, yi, u)),
6504
+ if (i.copy(t, g), g = pi.call(this, mi, n, r, s, a, l, c, !1), !g) return null;
6505
+ if (i.copy(e, g), u && (h.transformMat2(yi, yi, u), h.transformMat2(mi, mi, u)),
6500
6506
  p) {
6501
- const t = Math.abs(yi[1] - mi[1]), e = Math.abs(yi[0] - mi[0]) * f;
6502
- y = mi[0] > yi[0] ? 1 : 0, t > e ? (m = 1, y = mi[1] < yi[1] ? 0 : 1) : m = 0;
6503
- } else m = 0, y = mi[0] > yi[0] ? 1 : 0;
6504
- return 2 * y + m;
6507
+ const t = Math.abs(mi[1] - yi[1]), e = Math.abs(mi[0] - yi[0]) * f;
6508
+ m = yi[0] > mi[0] ? 1 : 0, t > e ? (y = 1, m = yi[1] < mi[1] ? 0 : 1) : y = 0;
6509
+ } else y = 0, m = yi[0] > mi[0] ? 1 : 0;
6510
+ return 2 * m + y;
6505
6511
  }
6506
6512
 
6507
6513
  var vi = "#define SHADER_NAME TEXT_LINE\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nattribute vec2 aOffset;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\n#ifdef HAS_TEXT_DX\nfloat d = aTextDx;\n#else\nfloat d = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat e = aTextDy;\n#else\nfloat e = textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\nfloat f = aTextSize * layerScale;\n#else\nfloat f = textSize * layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n float l = clamp(.5 + .5 * (1. - k), .0, 4.);\n vec2 m = aOffset / 10.0;\n vec2 n = aTexCoord;\n if(h == 1.) {\n gl_Position = projViewModelMatrix * vec4(c + vec3(m, .0) * tileRatio / zoomScale * j * l, 1.);\n } else {\n gl_Position.xy += m * 2. / canvasSize * l * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n#ifndef PICKING_MODE\nif(h == 1.) {\n vGammaScale = j + mapPitch / 4.;\n } else {\n vGammaScale = mix(1., j, textPerspectiveRatio);\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTexCoord = n / texSize;\n vSize = f;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\n#else\n#ifdef ENABLE_COLLISION\nbool o = aOpacity == 255.;\n#else\nbool o = true;\n#endif\nfbo_picking_setData(gl_Position.w, o);\n#endif\n}";
@@ -6523,19 +6529,19 @@ const xi = function(t) {
6523
6529
  class Li extends $e {
6524
6530
  constructor(t, e, n, i, r) {
6525
6531
  super(t, e, n, i, r), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
6526
- this.colorCache = {}, this.Er = xi.bind(this), this.Hr = bi.bind(this), this.Dr = Ai.bind(this),
6527
- this.Lr = wi.bind(this), this.isLabelCollides = Wn.bind(this), this.Rr();
6532
+ this.colorCache = {}, this.Hr = xi.bind(this), this.Dr = bi.bind(this), this.Lr = Ai.bind(this),
6533
+ this.Rr = wi.bind(this), this.isLabelCollides = Wn.bind(this), this.Nr();
6528
6534
  }
6529
- Rr() {
6530
- this.Nr = [];
6535
+ Nr() {
6536
+ this.zr = [];
6531
6537
  for (let t = 0; t < this.symbolDef.length; t++) {
6532
6538
  const e = this.symbolDef[t];
6533
- y(e.textName) && (this.Nr[t] = g(e.textName));
6539
+ m(e.textName) && (this.zr[t] = g(e.textName));
6534
6540
  }
6535
6541
  }
6536
6542
  updateSymbol(...t) {
6537
6543
  const e = super.updateSymbol(...t);
6538
- return this.Rr(), e;
6544
+ return this.Nr(), e;
6539
6545
  }
6540
6546
  shouldDeleteMeshOnUpdateSymbol(t) {
6541
6547
  if (!Array.isArray(t)) return (0 === t.textHaloRadius || 0 === this.symbolDef[0].textHaloRadius) && t.textHaloRadius !== this.symbolDef[0].textHaloRadius;
@@ -6563,24 +6569,24 @@ class Li extends $e {
6563
6569
  r.properties.symbolIndex = s;
6564
6570
  const o = this.getSymbol(s), a = this.getSymbolDef(s), l = this.getFnTypeConfig(s), h = Dn.call(this, this.regl, r, e, a, o, l, this.layer.options.collision, !n, i);
6565
6571
  if (h.length) {
6566
- "line" === o.textPlacement ? this.zr = !0 : this.Vr = !0;
6572
+ "line" === o.textPlacement ? this.Vr = !0 : this.jr = !0;
6567
6573
  }
6568
6574
  return h;
6569
6575
  }
6570
6576
  updateCollision(t) {
6571
6577
  super.updateCollision(t);
6572
6578
  const e = this.scene.getMeshes();
6573
- e && e.length ? (this.jr = {}, this.Ur(t.timestamp), this.xi()) : this.xi();
6579
+ e && e.length ? (this.Ur = {}, this.Gr(t.timestamp), this.xi()) : this.xi();
6574
6580
  }
6575
6581
  callCurrentTileShader(t, e) {
6576
- this.shader.filter = e.sceneFilter ? [ this.Er, e.sceneFilter ] : this.Er, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
6577
- this.Gr.filter = e.sceneFilter ? [ this.Dr, e.sceneFilter ] : this.Dr, this.renderer.render(this.Gr, t, this.scene, this.getRenderFBO(e));
6582
+ this.shader.filter = e.sceneFilter ? [ this.Hr, e.sceneFilter ] : this.Hr, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
6583
+ this.Wr.filter = e.sceneFilter ? [ this.Lr, e.sceneFilter ] : this.Lr, this.renderer.render(this.Wr, t, this.scene, this.getRenderFBO(e));
6578
6584
  }
6579
6585
  callBackgroundTileShader(t, e) {
6580
- this.shader.filter = e.sceneFilter ? [ this.Hr, e.sceneFilter ] : this.Hr, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
6581
- this.Gr.filter = e.sceneFilter ? [ this.Lr, e.sceneFilter ] : this.Lr, this.renderer.render(this.Gr, t, this.scene, this.getRenderFBO(e));
6586
+ this.shader.filter = e.sceneFilter ? [ this.Dr, e.sceneFilter ] : this.Dr, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
6587
+ this.Wr.filter = e.sceneFilter ? [ this.Rr, e.sceneFilter ] : this.Rr, this.renderer.render(this.Wr, t, this.scene, this.getRenderFBO(e));
6582
6588
  }
6583
- Ur() {
6589
+ Gr() {
6584
6590
  let t = this.scene.getMeshes();
6585
6591
  if (!t || !t.length) return;
6586
6592
  const e = -this.getMap().getBearing() * Math.PI / 180, n = l.fromRotation(Mi, e), i = (t, e, n, i) => {
@@ -6602,7 +6608,7 @@ class Li extends $e {
6602
6608
  const c = o.properties.meshKey;
6603
6609
  if ("line" === h.textPlacement) {
6604
6610
  if (!l.properties.line) continue;
6605
- r && this.startMeshCollision(o), this.Wr(o, n);
6611
+ r && this.startMeshCollision(o), this.Br(o, n);
6606
6612
  const {aOffset: t, aOpacity: e} = l.properties;
6607
6613
  t.dirty && (l.updateData("aOffset", t), t.dirty = !1), e && e.dirty && (l.updateData("aOpacity", e),
6608
6614
  e.dirty = !1), r && this.endMeshCollision(c);
@@ -6627,7 +6633,7 @@ class Li extends $e {
6627
6633
  getUniqueEntryKey(t, e) {
6628
6634
  return Bn(t, e);
6629
6635
  }
6630
- Wr(t, e) {
6636
+ Br(t, e) {
6631
6637
  const n = this.getMap(), i = t.geometry, s = i.properties, o = this.layer.getRenderer().isForeground(t);
6632
6638
  if (this.shouldIgnoreBackground() && !o) return;
6633
6639
  let a = s.line;
@@ -6635,12 +6641,12 @@ class Li extends $e {
6635
6641
  const l = 1 === t.material.uniforms.pitchWithMap, h = s.elements;
6636
6642
  if (!l) {
6637
6643
  const e = r.multiply(_i, n.projViewMatrix, t.localTransform), i = new Array(a.length);
6638
- a = this.Br(i, a, e, n.width, n.height);
6644
+ a = this.Xr(i, a, e, n.width, n.height);
6639
6645
  }
6640
6646
  const c = this.Gi(), f = i.properties.visElemts = i.properties.visElemts || new h.constructor(h.length);
6641
6647
  c && (f.count = 0), this.forEachBox(t, (t, n, i, r) => {
6642
6648
  const {start: s, end: o} = n[0];
6643
- let u = this.Xr(t, h, s, o, a, i, l ? e : null, r);
6649
+ let u = this.Yr(t, h, s, o, a, i, l ? e : null, r);
6644
6650
  if (c && (u = this.updateBoxCollisionFading(u, t, n, i, r), u)) {
6645
6651
  let t = f.count;
6646
6652
  for (let e = s; e < o; e++) f[t++] = h[e];
@@ -6648,53 +6654,53 @@ class Li extends $e {
6648
6654
  }
6649
6655
  }), !c || f.count === h.length && i.count === f.count || i.setElements(f, f.count);
6650
6656
  }
6651
- Br(t, e, n, i, r) {
6657
+ Xr(t, e, n, i, r) {
6652
6658
  const s = e.id + "-" + n.join();
6653
- if (this.jr[s]) return this.jr[s];
6659
+ if (this.Ur[s]) return this.Ur[s];
6654
6660
  const o = function(t, e, n, i, r) {
6655
6661
  const s = [];
6656
6662
  for (let o = 0; o < e.length; o += 3) a.set(s, e[o], e[o + 1], e[o + 2], 1), rn(s, s, n, i, r),
6657
6663
  t[o] = s[0], t[o + 1] = s[1], t[o + 2] = e[o + 2];
6658
6664
  return t;
6659
6665
  }(t, e, n, i, r);
6660
- return this.jr[s] = o, o;
6666
+ return this.Ur[s] = o, o;
6661
6667
  }
6662
6668
  forEachBox(t, e) {
6663
6669
  const n = this.getMap(), i = r.multiply(_i, n.projViewMatrix, t.localTransform), {collideIds: s, aCount: o, features: a, elements: l} = t.geometry.properties, h = s, c = this.isEnableUniquePlacement(), f = this.sr(1);
6664
6670
  f[0].allElements = l, f[0].mesh = t;
6665
- let u = 0, d = l[0], p = 0, m = h[d];
6666
- for (let n = 0; n <= l.length; n += 6) if (d = l[n], h[d] !== m || n === l.length) {
6667
- const r = a[m] && a[m].feature;
6671
+ let u = 0, d = l[0], p = 0, y = h[d];
6672
+ for (let n = 0; n <= l.length; n += 6) if (d = l[n], h[d] !== y || n === l.length) {
6673
+ const r = a[y] && a[y].feature;
6668
6674
  if (c && this.isMeshUniquePlaced(t) && r && !r.label) {
6669
6675
  const e = r.properties || {};
6670
6676
  e.$layer = r.layer, e.$type = r.type;
6671
- const i = Ni(this.Nr[n] ? this.Nr[n](null, e) : this.getSymbol(t.properties.symbolIndex).textName, e);
6677
+ const i = Ni(this.zr[n] ? this.zr[n](null, e) : this.getSymbol(t.properties.symbolIndex).textName, e);
6672
6678
  delete e.$layer, delete e.$type, r.label = i;
6673
6679
  }
6674
- const s = n, y = o[l[p]];
6675
- for (let n = p; n < s; n += 6 * y) f[0].start = n, f[0].end = n + 6 * y, f[0].boxCount = y,
6680
+ const s = n, m = o[l[p]];
6681
+ for (let n = p; n < s; n += 6 * m) f[0].start = n, f[0].end = n + 6 * m, f[0].boxCount = m,
6676
6682
  e.call(this, t, f, i, u++);
6677
- m = h[d], p = n;
6683
+ y = h[d], p = n;
6678
6684
  }
6679
6685
  }
6680
- Xr(t, e, n, r, s, o, l) {
6681
- const c = this.Gi(), f = this.getMap(), u = t.geometry, d = u.desc.positionSize, {aShape: p, aOffset: m, aAnchor: y} = u.properties, g = u.properties.aTextSize, v = !l, x = e[n] * d;
6682
- let b = i.set(Pi, y[x], y[x + 1], 2 === d ? 0 : y[x + 2]);
6686
+ Yr(t, e, n, r, s, o, l) {
6687
+ const c = this.Gi(), f = this.getMap(), u = t.geometry, d = u.desc.positionSize, {aShape: p, aOffset: y, aAnchor: m} = u.properties, g = u.properties.aTextSize, v = !l, x = e[n] * d;
6688
+ let b = i.set(Pi, m[x], m[x + 1], 2 === d ? 0 : m[x + 2]);
6683
6689
  const A = rn(Ti, b, o, f.width, f.height);
6684
- if (a.set(ki, A[0], A[1], A[0], A[1]), f.isOffscreen(ki)) return c || zi(m, e, n, r),
6690
+ if (a.set(ki, A[0], A[1], A[0], A[1]), f.isOffscreen(ki)) return c || zi(y, e, n, r),
6685
6691
  !1;
6686
6692
  v && (b = A);
6687
6693
  const w = v ? 1 : u.properties.tileExtent / this.layer.options.tileSize[0];
6688
6694
  let _ = !0;
6689
- const S = e[n], M = e[r - 1], P = g ? g[S] : t.properties.textSize, T = this.Yr(t, P, s, S, M, b, w, l);
6690
- if (null === T) return zi(m, e, n, r), !1;
6695
+ const S = e[n], M = e[r - 1], P = g ? g[S] : t.properties.textSize, T = this.Jr(t, P, s, S, M, b, w, l);
6696
+ if (null === T) return zi(y, e, n, r), !1;
6691
6697
  const k = M - S <= 3, I = t.material.uniforms, O = 1 === I.pitchWithMap, C = Math.floor(T / 2), F = T % 2;
6692
6698
  for (let i = n; i < r; i += 6) {
6693
6699
  const o = e[i];
6694
6700
  let a;
6695
6701
  if (a = C || i !== n || k ? C || i !== r - 6 || k ? pi.call(this, Si, t, P, s, o, b, w, C) : Di : Hi,
6696
6702
  !a) {
6697
- _ = !1, c || zi(m, e, n, r);
6703
+ _ = !1, c || zi(y, e, n, r);
6698
6704
  break;
6699
6705
  }
6700
6706
  let l = a[2];
@@ -6703,12 +6709,12 @@ class Li extends $e {
6703
6709
  for (let t = 0; t < 4; t++) h.set(Oi, p[2 * (o + t)] / 10, p[2 * (o + t) + 1] / 10),
6704
6710
  h.scale(Oi, Oi, P / 24), h.transformMat2(Oi, Oi, f), O ? (h.multiply(Oi, Oi, Fi),
6705
6711
  h.add(Ci, Oi, a)) : (h.multiply(Ci, a, Fi), h.add(Ci, Oi, Ci)), Ei[0] = 10 * Ci[0],
6706
- Ei[1] = 10 * Ci[1], m[2 * (o + t)] === Ei[0] && m[2 * (o + t) + 1] === Ei[1] || (m.dirty = !0,
6707
- m[2 * (o + t)] = Ei[0], m[2 * (o + t) + 1] = Ei[1]);
6712
+ Ei[1] = 10 * Ci[1], y[2 * (o + t)] === Ei[0] && y[2 * (o + t) + 1] === Ei[1] || (y.dirty = !0,
6713
+ y[2 * (o + t)] = Ei[0], y[2 * (o + t) + 1] = Ei[1]);
6708
6714
  }
6709
6715
  return _;
6710
6716
  }
6711
- Yr(t, e, n, i, r, s, o, a) {
6717
+ Jr(t, e, n, i, r, s, o, a) {
6712
6718
  const l = r - i <= 3, h = this.getMap();
6713
6719
  return l ? 0 : gi.call(this, Hi, Di, t, e, n, i, r, s, o, h.width / h.height, a);
6714
6720
  }
@@ -6721,7 +6727,7 @@ class Li extends $e {
6721
6727
  }) : t.material && delete t.material.uniforms.texture), super.deleteMesh(t, e));
6722
6728
  }
6723
6729
  delete() {
6724
- super.delete(), this.Gr.dispose(), delete this.jr, this.Jr && this.Jr.dispose();
6730
+ super.delete(), this.Wr.dispose(), delete this.Ur, this.qr && this.qr.dispose();
6725
6731
  }
6726
6732
  needClearStencil() {
6727
6733
  return !0;
@@ -6738,7 +6744,7 @@ class Li extends $e {
6738
6744
  });
6739
6745
  let r = i;
6740
6746
  if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (r = Zt({}, i),
6741
- r.stencil = Zt({}, i.stencil), r.stencil.enable = !0), this.Gr = new n.MeshShader({
6747
+ r.stencil = Zt({}, i.stencil), r.stencil.enable = !0), this.Wr = new n.MeshShader({
6742
6748
  vert: vi,
6743
6749
  frag: qn,
6744
6750
  uniforms: e,
@@ -6911,7 +6917,7 @@ var Wi = "#define SHADER_NAME NATIVE_LINE\nattribute vec3 aPosition;\nuniform ma
6911
6917
 
6912
6918
  class Bi extends He {
6913
6919
  constructor(t, e, n, i, r) {
6914
- if (super(t, e, n, i, r), this.primitive = "lines", y(this.symbolDef.lineColor)) {
6920
+ if (super(t, e, n, i, r), this.primitive = "lines", m(this.symbolDef.lineColor)) {
6915
6921
  const t = e.getMap(), n = v(this.symbolDef.lineColor);
6916
6922
  this.colorSymbol = e => n(t.getZoom(), e);
6917
6923
  }
@@ -7051,7 +7057,7 @@ class qi extends Ce {
7051
7057
  }
7052
7058
  o.generateBuffers(this.regl), l.setDefines(u), l.setLocalTransform(e), (o.properties.maxAltitude <= 0 || l.getUniform("level") >= 3) && (l.castShadow = !1),
7053
7059
  l.setUniform("maxAltitude", l.geometry.properties.maxAltitude);
7054
- const p = this.getMap(), m = p.getGLRes(), y = this.layer.getSpatialReference && this.layer.getSpatialReference(), g = (y ? y.getResolution(s) : p.getResolution(s)) / m;
7060
+ const p = this.getMap(), y = p.getGLRes(), m = this.layer.getSpatialReference && this.layer.getSpatialReference(), g = (m ? m.getResolution(s) : p.getResolution(s)) / y;
7055
7061
  return Object.defineProperty(l.uniforms, "uvOrigin", {
7056
7062
  enumerable: !0,
7057
7063
  get: () => {
@@ -7068,7 +7074,7 @@ class qi extends Ce {
7068
7074
  enumerable: !0,
7069
7075
  get: () => {
7070
7076
  const t = this.getSymbol(a);
7071
- return o.properties.hasAlpha || t.polygonOpacity < 1;
7077
+ return o.properties.hasAlpha || t.polygonOpacity < 1 || t.lineOpacity < 1;
7072
7078
  }
7073
7079
  }), l.properties.symbolIndex = a, l;
7074
7080
  }
@@ -7082,10 +7088,10 @@ class qi extends Ce {
7082
7088
  r;
7083
7089
  }
7084
7090
  needPolygonOffset() {
7085
- return this.qr;
7091
+ return this.Zr;
7086
7092
  }
7087
7093
  startFrame(...t) {
7088
- return delete this.qr, super.startFrame(...t);
7094
+ return delete this.Zr, super.startFrame(...t);
7089
7095
  }
7090
7096
  addMesh(t, e) {
7091
7097
  t.forEach(t => {
@@ -7098,7 +7104,7 @@ class qi extends Ce {
7098
7104
  0 === e && (e = .01), Xi[2] = e, r.fromScaling(n, Xi), r.multiply(n, t.properties.tileTransform, n),
7099
7105
  t.setLocalTransform(n);
7100
7106
  } else t.setLocalTransform(t.properties.tileTransform);
7101
- t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.qr = !0),
7107
+ t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.Zr = !0),
7102
7108
  this.getSymbol(t.properties.symbolIndex).ssr ? t.ssr = 1 : t.ssr = 0;
7103
7109
  }
7104
7110
  deleteMesh(t, e) {
@@ -7150,7 +7156,7 @@ class qi extends Ce {
7150
7156
  }
7151
7157
  updateSymbol(t, e) {
7152
7158
  const n = super.updateSymbol(t, e);
7153
- return t.material && this.Zr(t.material), n;
7159
+ return t.material && this.Kr(t.material), n;
7154
7160
  }
7155
7161
  Wn(t, e) {
7156
7162
  return Zi(t) !== Zi(e);
@@ -7192,14 +7198,14 @@ class Ki extends qi {
7192
7198
  return this.shader;
7193
7199
  }
7194
7200
  delete(t) {
7195
- this.getMap().off("updatelights", this.Kr, this), super.delete(t), this.material.dispose();
7201
+ this.getMap().off("updatelights", this.$r, this), super.delete(t), this.material.dispose();
7196
7202
  }
7197
7203
  init() {
7198
- this.getMap().on("updatelights", this.Kr, this);
7204
+ this.getMap().on("updatelights", this.$r, this);
7199
7205
  const t = this.regl;
7200
7206
  this.renderer = new n.Renderer(t);
7201
7207
  const e = this.getShaderConfig();
7202
- this.shader = new n.PhongShader(e), this.Zr();
7208
+ this.shader = new n.PhongShader(e), this.Kr();
7203
7209
  const i = {
7204
7210
  vert: this.getPickingVert(),
7205
7211
  uniforms: [ "projViewMatrix", "modelMatrix", "positionMatrix", {
@@ -7215,7 +7221,7 @@ class Ki extends qi {
7215
7221
  };
7216
7222
  this.picking = [ new n.FBORayPicking(this.renderer, i, this.layer.getRenderer().pickingFBO) ];
7217
7223
  }
7218
- Kr() {
7224
+ $r() {
7219
7225
  this.setToRedraw();
7220
7226
  }
7221
7227
  getShaderConfig() {
@@ -7264,14 +7270,14 @@ class Ki extends qi {
7264
7270
  }
7265
7271
  };
7266
7272
  }
7267
- Zr() {
7273
+ Kr() {
7268
7274
  this.material && this.material.dispose();
7269
7275
  const t = this.getSymbols()[0].material, e = {};
7270
7276
  for (const n in t) he(t, n) && (e[n] = t[n]);
7271
7277
  this.material = new n.PhongMaterial(e);
7272
7278
  }
7273
7279
  getUniformValues(t, e) {
7274
- const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.$r(), o = Zt({
7280
+ const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.Qr(), o = Zt({
7275
7281
  viewMatrix: n,
7276
7282
  projMatrix: i,
7277
7283
  cameraPosition: r,
@@ -7284,7 +7290,7 @@ class Ki extends qi {
7284
7290
  getPickingVert() {
7285
7291
  return "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 modelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <fbo_picking_vert>\n #include <get_output>\n void main()\n {\n mat4 localPositionMatrix = getPositionMatrix();\n vec4 localPosition = getPosition(aPosition);\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localPosition;\n //传入gl_Position的depth值\n fbo_picking_setData(gl_Position.w, true);\n }\n ";
7286
7292
  }
7287
- $r() {
7293
+ Qr() {
7288
7294
  const t = this.getMap().getLightManager(), e = t && t.getAmbientLight() || {}, n = t && t.getDirectionalLight() || {};
7289
7295
  return {
7290
7296
  ambientColor: e.color || [ .2, .2, .2 ],
@@ -7299,7 +7305,7 @@ const $i = [ 1, 1, 1 ];
7299
7305
 
7300
7306
  class Qi extends Ce {
7301
7307
  constructor(t, e, n, i, r) {
7302
- if (super(t, e, n, i, r), y(this.symbolDef[0].lineColor)) {
7308
+ if (super(t, e, n, i, r), m(this.symbolDef[0].lineColor)) {
7303
7309
  const t = e.getMap(), n = v(this.symbolDef.lineColor);
7304
7310
  this.colorSymbol = e => n(t.getZoom(), e);
7305
7311
  } else this.colorSymbol = this.getSymbol({
@@ -7354,7 +7360,7 @@ class Qi extends Ce {
7354
7360
  const n = [];
7355
7361
  return r.multiply(n, e.projViewMatrix, e.modelMatrix), n;
7356
7362
  }
7357
- }, "outSize", "opacity" ],
7363
+ } ],
7358
7364
  extraCommandProps: {
7359
7365
  stencil: {
7360
7366
  enable: !0,
@@ -7392,20 +7398,20 @@ const {getPBRUniforms: tr} = n.pbr.PBRUtils, er = [];
7392
7398
 
7393
7399
  class nr extends qi {
7394
7400
  constructor(...t) {
7395
- super(...t), this.Qr = new n.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
7401
+ super(...t), this.ts = new n.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
7396
7402
  }
7397
7403
  supportRenderMode(t) {
7398
7404
  return this.getSymbols()[0].ssr ? "fxaa" === t || "fxaaAfterTaa" === t : super.supportRenderMode(t);
7399
7405
  }
7400
7406
  isAnimating() {
7401
- const t = this.ts();
7407
+ const t = this.es();
7402
7408
  if (t && (t[0] || t[1])) return !0;
7403
7409
  }
7404
7410
  needToRedraw() {
7405
- const t = this.ts();
7411
+ const t = this.es();
7406
7412
  return !(!t || !t[0] && !t[1]) || super.needToRedraw();
7407
7413
  }
7408
- ts() {
7414
+ es() {
7409
7415
  const t = this.getSymbols()[0];
7410
7416
  return t.material && t.material.uvOffsetAnim;
7411
7417
  }
@@ -7431,18 +7437,18 @@ class nr extends qi {
7431
7437
  const e = Zt({}, r, t.ssr.defines);
7432
7438
  i.shaderDefines = e;
7433
7439
  }
7434
- if (t.onlyUpdateDepthInTaa && (this.shader = this.es, !n && this.ns && (this.shader = i,
7440
+ if (t.onlyUpdateDepthInTaa && (this.shader = this.ns, !n && this.rs && (this.shader = i,
7435
7441
  this.setToRedraw(!0))), this.updateIBLDefines(i), super.paint(t), void 0 !== this.shadowCount && e) {
7436
7442
  const t = this.scene.getMeshes().length;
7437
7443
  this.shadowCount !== t && this.setToRedraw();
7438
7444
  }
7439
7445
  this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount;
7440
- const s = this.ts();
7446
+ const s = this.es();
7441
7447
  if (s && (s[0] || s[1])) this.material.set("uvOffset", [ 0, 0 ]); else {
7442
7448
  const t = this.getUVOffset(s);
7443
7449
  this.material.set("uvOffset", t);
7444
7450
  }
7445
- this.ns = n;
7451
+ this.rs = n;
7446
7452
  }
7447
7453
  getShadowMeshes() {
7448
7454
  if (!this.isVisible()) return er;
@@ -7458,15 +7464,15 @@ class nr extends qi {
7458
7464
  Zt(this.sceneConfig, t), this.setToRedraw();
7459
7465
  }
7460
7466
  delete() {
7461
- super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.rs && this.rs.dispose(),
7462
- this.shader && (this.shader.dispose(), delete this.shader), this.es && (this.es.dispose(),
7463
- delete this.es);
7467
+ super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.ss && this.ss.dispose(),
7468
+ this.shader && (this.shader.dispose(), delete this.shader), this.ns && (this.ns.dispose(),
7469
+ delete this.ns);
7464
7470
  }
7465
7471
  init(t) {
7466
- this.getMap().on("updatelights", this.ss, this), this.createIBLTextures(), this.oi = this.oi || t;
7472
+ this.getMap().on("updatelights", this.os, this), this.createIBLTextures(), this.oi = this.oi || t;
7467
7473
  const e = this.regl;
7468
- this.renderer = new n.Renderer(e), this.os = this.as.bind(this), this.ls = this.disposeCachedTexture.bind(this),
7469
- this.hs = this.cs.bind(this), this.Zr(), this.ni(t);
7474
+ this.renderer = new n.Renderer(e), this.as = this.ls.bind(this), this.hs = this.disposeCachedTexture.bind(this),
7475
+ this.cs = this.fs.bind(this), this.Kr(), this.ni(t);
7470
7476
  const i = {
7471
7477
  vert: "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <line_extrusion_vert>\n #include <get_output>\n #include <fbo_picking_vert>\n void main() {\n mat4 localPositionMatrix = getPositionMatrix();\n #ifdef IS_LINE_EXTRUSION\n vec3 linePosition = getLineExtrudePosition(aPosition);\n vec4 localVertex = getPosition(linePosition);\n #else\n vec4 localVertex = getPosition(aPosition);\n #endif\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localVertex;\n fbo_picking_setData(gl_Position.w, true);\n }\n ",
7472
7478
  uniforms: [ {
@@ -7522,20 +7528,20 @@ class nr extends qi {
7522
7528
  polygonOffset: this.getPolygonOffset()
7523
7529
  }, o = {
7524
7530
  uniforms: r,
7525
- defines: this.fs(i),
7531
+ defines: this.us(i),
7526
7532
  extraCommandProps: s
7527
7533
  };
7528
7534
  this.shader = new n.pbr.StandardShader(o), o.frag = "\n precision mediump float;\n #include <gl2_frag>\n void main() {\n glFragColor = vec4(0.0);\n #if __VERSION__ == 100\n gl_FragColor = glFragColor;\n #endif\n }\n ",
7529
- this.es = new n.pbr.StandardShader(o);
7535
+ this.ns = new n.pbr.StandardShader(o);
7530
7536
  }
7531
- as({resources: t}) {
7537
+ ls({resources: t}) {
7532
7538
  for (let e = 0; e < t.length; e++) this.addCachedTexture(t[e].url, t[e].data);
7533
7539
  this.setToRedraw(!0);
7534
7540
  }
7535
- cs() {
7541
+ fs() {
7536
7542
  this.setToRedraw(!0);
7537
7543
  }
7538
- Zr(t) {
7544
+ Kr(t) {
7539
7545
  const e = t || this.getSymbols()[0].material, i = {};
7540
7546
  let r = !1;
7541
7547
  for (const t in e) if (he(e, t)) if (t.indexOf("Texture") > 0) {
@@ -7554,15 +7560,15 @@ class nr extends qi {
7554
7560
  } : s.data = a : o === s && (s = {
7555
7561
  url: o,
7556
7562
  wrap: "repeat"
7557
- }), s.flipY = !0, i[t] = new n.Texture2D(s, this.Qr), i[t].once("complete", this.os),
7558
- i[t].once("disposed", this.ls), i[t].promise && this.addCachedTexture(o, i[t].promise),
7563
+ }), s.flipY = !0, i[t] = new n.Texture2D(s, this.ts), i[t].once("complete", this.as),
7564
+ i[t].once("disposed", this.hs), i[t].promise && this.addCachedTexture(o, i[t].promise),
7559
7565
  r = !0;
7560
7566
  } else i[t] = e[t];
7561
7567
  if (this.material) {
7562
7568
  for (let t in i) this.material.set(t, i[t]);
7563
7569
  this.setToRedraw(!0);
7564
- } else this.material = new n.pbr.StandardMaterial(i), this.material.once("complete", this.hs);
7565
- r || this.cs();
7570
+ } else this.material = new n.pbr.StandardMaterial(i), this.material.once("complete", this.cs);
7571
+ r || this.fs();
7566
7572
  }
7567
7573
  getShader() {
7568
7574
  return this.shader;
@@ -7571,30 +7577,30 @@ class nr extends qi {
7571
7577
  const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = tr(t, n, i, e && e.ssr, e && e.jitter);
7572
7578
  return this.setIncludeUniformValues(r, e), r;
7573
7579
  }
7574
- fs(t) {
7580
+ us(t) {
7575
7581
  return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
7576
7582
  }
7577
- ss() {
7583
+ os() {
7578
7584
  if (!this.shader) return;
7579
7585
  const t = this.shader.shaderDefines;
7580
- this.fs(t), this.shader.shaderDefines = t;
7586
+ this.us(t), this.shader.shaderDefines = t;
7581
7587
  }
7582
7588
  }
7583
7589
 
7584
7590
  const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr = [], hr = [ 1, 1, 1, 1 ], cr = [], fr = t => class extends t {
7585
7591
  constructor(t, e, n, i, r) {
7586
- super(t, e, n, i, r), this.us = !1, this.scene.sortFunction = this.sortByCommandKey,
7587
- this.ds = [];
7592
+ super(t, e, n, i, r), this.ds = !1, this.scene.sortFunction = this.sortByCommandKey,
7593
+ this.ps = [];
7588
7594
  }
7589
7595
  isAnimating() {
7590
7596
  const t = this.getSymbols();
7591
7597
  for (let e = 0; e < t.length; e++) {
7592
- if (t[e] && this.ps[e] && this.ms(e)) return !0;
7598
+ if (t[e] && this.ys[e] && this.ms(e)) return !0;
7593
7599
  }
7594
7600
  return !1;
7595
7601
  }
7596
7602
  createGeometry(t, e) {
7597
- if (this.ys(), !this.us) return null;
7603
+ if (this.gs(), !this.ds) return null;
7598
7604
  const {data: n, positionSize: i} = t;
7599
7605
  return {
7600
7606
  geometry: {
@@ -7618,7 +7624,7 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
7618
7624
  instance_vectorC: new Float32Array(4 * u),
7619
7625
  aPickingId: []
7620
7626
  };
7621
- this.gs(d, s, o, l.properties.z, f, h);
7627
+ this.vs(d, s, o, l.properties.z, f, h);
7622
7628
  const p = {};
7623
7629
  for (const t in d) p[t] = {
7624
7630
  buffer: this.regl.buffer({
@@ -7627,26 +7633,26 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
7627
7633
  }),
7628
7634
  divisor: 1
7629
7635
  };
7630
- const m = [], y = this.getSymbols();
7631
- for (let t = 0; t < y.length; t++) {
7632
- const e = y[t], o = this.ds[t];
7636
+ const y = [], m = this.getSymbols();
7637
+ for (let t = 0; t < m.length; t++) {
7638
+ const e = m[t], o = this.ps[t];
7633
7639
  if (!o) continue;
7634
- const {translation: l, rotation: h, scale: f, fixSizeOnZoom: g} = e, v = this.vs([], l, h, f);
7640
+ const {translation: l, rotation: h, scale: f, fixSizeOnZoom: g} = e, v = this.xs([], l, h, f);
7635
7641
  let x = 0;
7636
7642
  o.forEach(t => {
7637
7643
  const {geometry: n, nodeMatrix: i} = t, s = r.multiply(cr, v, i), o = n.boundingBox.copy();
7638
7644
  o.transform(s);
7639
- const a = this.xs(o, e);
7645
+ const a = this.bs(o, e);
7640
7646
  a > x && (x = a);
7641
7647
  });
7642
7648
  const b = [ 0, 0, x ], A = o.map(o => {
7643
- const {geometry: l, nodeMatrix: h, materialInfo: f, skin: m, morphWeights: y, extraInfo: x} = o, A = new (this.getMaterialClazz(f))(f), w = {}, _ = new n.InstancedMesh(p, u, l, A, {
7649
+ const {geometry: l, nodeMatrix: h, materialInfo: f, skin: y, morphWeights: m, extraInfo: x} = o, A = new (this.getMaterialClazz(f))(f), w = {}, _ = new n.InstancedMesh(p, u, l, A, {
7644
7650
  transparent: !1,
7645
7651
  picking: !0
7646
7652
  });
7647
- m && (_.setUniform("jointTexture", m.jointTexture), _.setUniform("jointTextureSize", m.jointTextureSize),
7648
- _.setUniform("numJoints", m.numJoints), _.setUniform("skinAnimation", 0), w.HAS_SKIN = 1),
7649
- y && (_.setUniform("morphWeights", y), w.HAS_MORPH = 1), _.setUniform("hasAlpha", x.alphaMode && "BLEND" === x.alphaMode.toUpperCase()),
7653
+ y && (_.setUniform("jointTexture", y.jointTexture), _.setUniform("jointTextureSize", y.jointTextureSize),
7654
+ _.setUniform("numJoints", y.numJoints), _.setUniform("skinAnimation", 0), w.HAS_SKIN = 1),
7655
+ m && (_.setUniform("morphWeights", m), w.HAS_MORPH = 1), _.setUniform("hasAlpha", x.alphaMode && "BLEND" === x.alphaMode.toUpperCase()),
7650
7656
  ee(_.uniforms, "polygonFill", e, "polygonFill", hr, re(this.colorCache)), ee(_.uniforms, "polygonOpacity", e, "polygonOpacity", 1);
7651
7657
  const S = r.multiply([], v, h), M = [];
7652
7658
  return r.fromTranslation(M, b), r.multiply(S, M, S), _.setPositionMatrix(() => {
@@ -7662,17 +7668,17 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
7662
7668
  index: t
7663
7669
  }, _;
7664
7670
  });
7665
- m.push(...A);
7671
+ y.push(...A);
7666
7672
  }
7667
- return m.insContext = {
7673
+ return y.insContext = {
7668
7674
  instanceData: d,
7669
7675
  tileTranslationMatrix: s,
7670
7676
  tileExtent: o,
7671
7677
  aPosition: f,
7672
7678
  positionSize: h
7673
- }, m;
7679
+ }, y;
7674
7680
  }
7675
- xs(t, e) {
7681
+ bs(t, e) {
7676
7682
  const n = e.anchorZ || "bottom";
7677
7683
  let i = 0;
7678
7684
  return "bottom" === n ? i = -t.min[2] : "top" === n ? i = -t.max[2] : "center" === n && (i = -(t.min[2] + t.max[2]) / 2),
@@ -7693,12 +7699,12 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
7693
7699
  let n = !1;
7694
7700
  for (let i = 0; i < e.length; i++) {
7695
7701
  const r = e[i];
7696
- if (!r || !this.ps[i]) continue;
7697
- if (this.ms(i) && this.ps[i]) {
7702
+ if (!r || !this.ys[i]) continue;
7703
+ if (this.ms(i) && this.ys[i]) {
7698
7704
  n || (n = !0);
7699
7705
  let e = r.speed;
7700
7706
  const s = !!r.loop;
7701
- Qt(e) && (e = 1), this.ps[i].updateAnimation(t.timestamp, s, e);
7707
+ Qt(e) && (e = 1), this.ys[i].updateAnimation(t.timestamp, s, e);
7702
7708
  }
7703
7709
  }
7704
7710
  n && this.setToRedraw(!0), super.prepareRender(t);
@@ -7710,9 +7716,9 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
7710
7716
  }
7711
7717
  ms(t) {
7712
7718
  const e = this.getSymbols()[t];
7713
- return e && e.animation && this.ps[t] && this.ps[t].hasSkinAnimation();
7719
+ return e && e.animation && this.ys[t] && this.ys[t].hasSkinAnimation();
7714
7720
  }
7715
- gs(t, e, n, s, o, a) {
7721
+ vs(t, e, n, s, o, a) {
7716
7722
  function l(e, n, i, r) {
7717
7723
  t[e][4 * n] = i[r], t[e][4 * n + 1] = i[r + 4], t[e][4 * n + 2] = i[r + 8], t[e][4 * n + 3] = i[r + 12];
7718
7724
  }
@@ -7728,26 +7734,26 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
7728
7734
  return t.positionAttribute = "POSITION", t.normalAttribute = "NORMAL", t;
7729
7735
  }
7730
7736
  init(t) {
7731
- super.init(t), this.ys();
7737
+ super.init(t), this.gs();
7732
7738
  }
7733
- ys() {
7734
- if (this.ps) return;
7735
- this.ps = [];
7739
+ gs() {
7740
+ if (this.ys) return;
7741
+ this.ys = [];
7736
7742
  const t = this.layer.getRenderer(), e = this.getSymbols();
7737
- this.bs = 0;
7743
+ this.As = 0;
7738
7744
  for (let i = 0; i < e.length; i++) {
7739
7745
  const r = e[i].url;
7740
7746
  if (t.isCachePlaced(r)) continue;
7741
7747
  const s = t.fetchCache(r);
7742
- s ? (this.ps[i] = [ s ], this.ds[i] = s.getMeshesInfo(), this.bs++, t.addToCache(r)) : (t.placeCache(r),
7748
+ s ? (this.ys[i] = [ s ], this.ps[i] = s.getMeshesInfo(), this.As++, t.addToCache(r)) : (t.placeCache(r),
7743
7749
  n.GLTFHelper.load(r).then(s => {
7744
7750
  const o = n.GLTFHelper.exportGLTFPack(s, this.regl);
7745
- this.ps[i] = [ o ], this.ds[i] = o.getMeshesInfo(), t.addToCache(r, o, t => {
7751
+ this.ys[i] = [ o ], this.ps[i] = o.getMeshesInfo(), t.addToCache(r, o, t => {
7746
7752
  t.dispose();
7747
- }), this.bs++, this.bs >= e.length && (this.us = !0), this.setToRedraw(!0);
7753
+ }), this.As++, this.As >= e.length && (this.ds = !0), this.setToRedraw(!0);
7748
7754
  }));
7749
7755
  }
7750
- this.bs >= e.length && (this.us = !0);
7756
+ this.As >= e.length && (this.ds = !0);
7751
7757
  }
7752
7758
  getPickingVert() {
7753
7759
  return "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 modelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <fbo_picking_vert>\n #include <get_output>\n void main()\n {\n mat4 localPositionMatrix = getPositionMatrix();\n vec4 localPosition = getPosition(aPosition);\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localPosition;\n //传入gl_Position的depth值\n fbo_picking_setData(gl_Position.w, true);\n }";
@@ -7761,15 +7767,15 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
7761
7767
  delete() {
7762
7768
  super.delete();
7763
7769
  const t = this.getSymbols()[0].url;
7764
- if (this.layer.getRenderer().removeCache(t), this.ds) for (let t = 0; t < this.ds.length; t++) {
7765
- const e = this.ds[t];
7770
+ if (this.layer.getRenderer().removeCache(t), this.ps) for (let t = 0; t < this.ps.length; t++) {
7771
+ const e = this.ps[t];
7766
7772
  for (let n = 0; n < e.length; n++) {
7767
7773
  const n = e[t], {geometry: i, materialInfo: r} = n;
7768
7774
  if (i && i.dispose(), r) for (const t in r) r[t] && r[t].destroy && r[t].destroy();
7769
7775
  }
7770
7776
  }
7771
7777
  }
7772
- vs(t, e, n, s) {
7778
+ xs(t, e, n, s) {
7773
7779
  const o = i.set(ir, ...e || sr), a = n || or, l = s || ar, h = c.fromEuler(rr, a[0], a[1], a[2]);
7774
7780
  return r.fromRotationTranslationScale(t, h, o, l);
7775
7781
  }
@@ -7790,9 +7796,9 @@ class dr extends(fr(nr)){
7790
7796
  const pr = {
7791
7797
  color: [ 2.0303, 2.028, 2.028 ],
7792
7798
  direction: [ 0, -.2717, -1 ]
7793
- }, mr = {
7799
+ }, yr = {
7794
7800
  index: 0
7795
- }, yr = [ 0, 0, 0 ];
7801
+ }, mr = [ 0, 0, 0 ];
7796
7802
 
7797
7803
  class gr extends He {
7798
7804
  supportRenderMode(t) {
@@ -7802,7 +7808,7 @@ class gr extends He {
7802
7808
  return !0;
7803
7809
  }
7804
7810
  needToRedraw() {
7805
- return this.getSymbol(mr).animation;
7811
+ return this.getSymbol(yr).animation;
7806
7812
  }
7807
7813
  createMesh(t, e) {
7808
7814
  const {geometry: i} = t;
@@ -7811,29 +7817,29 @@ class gr extends He {
7811
7817
  castShadow: !1,
7812
7818
  picking: !0
7813
7819
  });
7814
- return r.properties.symbolIndex = mr, r.setLocalTransform(e), r;
7820
+ return r.properties.symbolIndex = yr, r.setLocalTransform(e), r;
7815
7821
  }
7816
7822
  callShader(t, e) {
7817
7823
  super.callShader(t, e), this.transformWater();
7818
- const n = this.As(this.getMap(), e);
7819
- this.renderer.render(this.ws, n, this._s, this.getRenderFBO(e));
7824
+ const n = this.ws(this.getMap(), e);
7825
+ this.renderer.render(this._s, n, this.Ss, this.getRenderFBO(e));
7820
7826
  }
7821
7827
  addMesh(t, e) {
7822
7828
  this.si(t, e), super.addMesh(...arguments);
7823
7829
  }
7824
7830
  si(t) {
7825
- const e = this.getSymbol(mr).ssr;
7831
+ const e = this.getSymbol(yr).ssr;
7826
7832
  for (let n = 0; n < t.length; n++) t[n].ssr = e ? 1 : 0;
7827
7833
  }
7828
7834
  paint(t) {
7829
- t.states && t.states.includesChanged && (this.shader.dispose(), this.ws.dispose(),
7835
+ t.states && t.states.includesChanged && (this.shader.dispose(), this._s.dispose(),
7830
7836
  this.ni(t));
7831
- const e = !!t.ssr && this.getSymbol(mr).ssr, n = this.ws, i = n.shaderDefines;
7837
+ const e = !!t.ssr && this.getSymbol(yr).ssr, n = this._s, i = n.shaderDefines;
7832
7838
  if (e) {
7833
7839
  const e = Zt({}, i, t.ssr.defines);
7834
7840
  n.shaderDefines = e;
7835
7841
  }
7836
- this.updateIBLDefines(n), this.Ss.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
7842
+ this.updateIBLDefines(n), this.Ms.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
7837
7843
  }
7838
7844
  init(t) {
7839
7845
  this.createIBLTextures();
@@ -7851,38 +7857,38 @@ class gr extends He {
7851
7857
  extraCommandProps: {
7852
7858
  viewport: this.pickingViewport
7853
7859
  }
7854
- }, this.pickingFBO) ]), this.Ms();
7860
+ }, this.pickingFBO) ]), this.Ps();
7855
7861
  }
7856
- Ms() {
7862
+ Ps() {
7857
7863
  const t = this.regl;
7858
- this.Ps = t.texture(2), this.Ts = [ 2, 2 ];
7864
+ this.Ts = t.texture(2), this.ks = [ 2, 2 ];
7859
7865
  const e = this.getSymbol({
7860
7866
  index: 0
7861
7867
  }), n = e.texWaveNormal, i = this.getCachedTexture(n), r = this;
7862
- if (i) i.loading || (this.ks = this.Is(t, i)); else {
7868
+ if (i) i.loading || (this.Is = this.Os(t, i)); else {
7863
7869
  const e = new Image;
7864
7870
  e.loading = !0, e.onload = function() {
7865
- delete this.loading, r.ks = r.Is(t, this), this.Ts = [ this.width, this.height ],
7871
+ delete this.loading, r.Is = r.Os(t, this), this.ks = [ this.width, this.height ],
7866
7872
  r.setToRedraw();
7867
7873
  }, e.onerror = () => {
7868
7874
  console.error("invalid water wave normal texture:" + n);
7869
7875
  }, this.addCachedTexture(n, e), e.src = n;
7870
7876
  }
7871
7877
  const s = e.texWavePerturbation, o = this.getCachedTexture(s);
7872
- if (o) o.loading || (this.Os = this.Is(t, o)); else {
7878
+ if (o) o.loading || (this.Cs = this.Os(t, o)); else {
7873
7879
  const e = new Image;
7874
7880
  e.loading = !0, e.onload = function() {
7875
- delete this.loading, r.Os = r.Is(t, this), this.Ts = [ this.width, this.height ],
7881
+ delete this.loading, r.Cs = r.Os(t, this), this.ks = [ this.width, this.height ],
7876
7882
  r.setToRedraw();
7877
7883
  }, e.onerror = () => {
7878
7884
  console.error("invalid water wave perturbation texture:" + s);
7879
7885
  }, this.addCachedTexture(s, e), e.src = s;
7880
7886
  }
7881
7887
  }
7882
- Is(t, e) {
7883
- return this.Ps ? t.texture({
7884
- width: this.Ts[0],
7885
- height: this.Ts[1],
7888
+ Os(t, e) {
7889
+ return this.Ts ? t.texture({
7890
+ width: this.ks[0],
7891
+ height: this.ks[1],
7886
7892
  mag: "linear",
7887
7893
  min: "linear mipmap linear",
7888
7894
  wrapS: "repeat",
@@ -7979,7 +7985,7 @@ class gr extends He {
7979
7985
  enable: !1
7980
7986
  }
7981
7987
  };
7982
- i.push(...n.SsrPass.getUniformDeclares()), this.ws = new n.MeshShader({
7988
+ i.push(...n.SsrPass.getUniformDeclares()), this._s = new n.MeshShader({
7983
7989
  vert: "#define SHADER_NAME WATER\nuniform mat4 modelMatrix;\nuniform mat4 projViewModelMatrix;\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform vec2 uvOffset;\nuniform vec2 noiseUvOffset;\nuniform vec2 uvScale;\nvarying vec2 vUv;\nvarying vec2 vNoiseUv;\nvarying vec3 vPos;\nvarying mat3 vTbnMatrix;\n#ifdef HAS_SSR\nuniform mat4 modelViewMatrix;\nvarying vec4 vViewVertex;\n#endif\nmat3 c(in vec3 d) {\n vec3 t = normalize(cross(d, vec3(.0, 1., .0)));\n vec3 e = normalize(cross(d, t));\n return mat3(t, e, d);\n}\n#if defined(HAS_SHADOWING)\n#include <vsm_shadow_vert>\n#endif\nconst vec3 f = vec3(0., 0., 1.);\nvoid main(void) {\n vec4 h = vec4(aPosition, 1.);\n vec4 i = modelMatrix * h;\n vPos = i.xyz;\n vTbnMatrix = c(f);\n gl_Position = projViewModelMatrix * h;\n vUv = aTexCoord * uvScale + uvOffset;\n vNoiseUv = aTexCoord * uvScale * TIME_NOISE_TEXTURE_REPEAT + noiseUvOffset;\n#ifdef HAS_SSR\nvec4 j = modelViewMatrix * h;\n vViewVertex = j;\n#endif\n#if defined(HAS_SHADOWING)\nshadow_computeShadowPars(h);\n#endif\n}",
7984
7990
  frag: "#define SHADER_NAME WATER\nprecision highp float;\nprecision highp sampler2D;\n#include <hsv_frag>\nuniform vec3 hsv;\nuniform float contrast;\n#if defined(HAS_SHADOWING)\n#include <vsm_shadow_frag>\n#endif\n#if defined(HAS_IBL_LIGHTING)\nuniform vec3 hdrHsv;\nuniform samplerCube specularPBR;\nuniform float rgbmRange;\nuniform vec3 diffuseSPH[9];\n#else\nuniform vec3 ambientColor;\n#endif\nstruct PBRShadingWater {\n float NdotL;\n float NdotV;\n float NdotH;\n float VdotH;\n float LdotH;\n float VdotN;\n};\nvec3 c(const in vec4 d, const in float e) {\n if(e <= .0)\n return d.rgb;\n return e * d.rgb * d.a;\n}\n#ifdef HAS_SSR\nvarying vec4 vViewVertex;\nuniform mat3 modelViewNormalMatrix;\nuniform sampler2D TextureDepth;\nuniform highp vec2 outSize;\nuniform float ssrFactor;\nuniform float ssrQuality;\nuniform sampler2D TextureReflected;\nuniform highp mat4 projMatrix;\nuniform mat4 invProjMatrix;\nuniform vec4 outputFovInfo[2];\nuniform mat4 reprojViewProjMatrix;\nuniform vec2 cameraNearFar;\nfloat f(const in vec4 h) {\n return h.r + h.g / 255.;\n}\nfloat i(const in vec2 j, const in float k) {\n vec3 l = vec3(.06711056, .00583715, 52.9829189);\n return fract(l.z * fract(dot(j.xy + k * vec2(47., 17.) * .695, l.xy))) * .5;\n}\nvec3 m(const in float n, const in float o, const in vec2 u) {\n float v = min(o - .01, n);\n float A = floor(v);\n float B = min(o, A + 1.);\n float C = pow(2., B);\n vec2 D = 2. * C / u;\n if(v - A > .5)\n C *= 2.;\n return vec3(D, C);\n}\nvec2 E(const in vec2 F, const in vec3 G) {\n vec2 H = max(G.xy, min(1. - G.xy, F));\n return vec2(2. * H.x, G.z - 1. - H.y) / G.z;\n}\nvec3 I(const in mat4 J, const in vec3 K) {\n vec4 L = J * vec4(K, 1.);\n return vec3(.5 + .5 * L.xy / L.w, L.w);\n}\nvec3 M(const in float N, const in vec2 H) {\n return texture2D(TextureReflected, H).rgb;\n}\nfloat O(float P) {\n highp mat4 J = projMatrix;\n highp float z = P * 2. - 1.;\n return -J[3].z / (z + J[2].z);\n}\nfloat Q(const vec2 H) {\n float P = f(texture2D(TextureDepth, H));\n return P;\n}\nvec3 R(const in float k, const in vec3 S, const in vec3 T, const in vec3 U, const in vec3 V, const in float W) {\n vec2 X;\n X.x = i(gl_FragCoord.yx, k);\n X.y = fract(X.x * 52.9829189);\n X.y = mix(X.y, 1., .7);\n float Y = 2. * 3.14159 * X.x;\n float Z = pow(max(X.y, .000001), W / (2. - W));\n float ba = sqrt(1. - Z * Z);\n vec3 bb = vec3(ba * cos(Y), ba * sin(Y), Z);\n bb = bb.x * S + bb.y * T + bb.z * U;\n return normalize((2. * dot(V, bb)) * bb - V);\n}\nfloat bc(const in float k) {\n return (i(gl_FragCoord.xy, k) - .5);\n}\nvec3 bd(const in vec3 be, const in float bf, const in vec3 bg) {\n vec3 bh = I(projMatrix, vViewVertex.xyz + bg * bf);\n bh.z = 1. / bh.z;\n bh -= be;\n float bi = min(1., .99 * (1. - be.x) / max(1e-5, bh.x));\n float bj = min(1., .99 * (1. - be.y) / max(1e-5, bh.y));\n float bk = min(1., .99 * be.x / max(1e-5, -bh.x));\n float bl = min(1., .99 * be.y / max(1e-5, -bh.y));\n return bh * min(bi, bj) * min(bk, bl);\n}\nfloat bm(const in vec3 be, const in vec3 bh, inout float bn, inout float bo) {\n float bp = (bo + bn) * .5;\n vec3 bq = be + bh * bp;\n float z = Q(bq.xy);\n float P = O(z);\n float br = -1. / bq.z;\n bn = P > br ? bn : bp;\n bo = P > br ? bp : bo;\n return bp;\n}\nvec4 bs(const in vec3 be, const in float bf, in float bt, const in vec3 bg, const in float bu, const in float k) {\n const int bv = 20;\n float bw = 1. / float(bv);\n bt *= bw;\n vec3 bh = bd(be, bf, bg);\n float bx = bw;\n vec3 by = vec3(.0, bx, 1.);\n vec3 bq;\n float z, P, br, bz, bA, bB;\n bool bC;\n float bD = 1.;\n float bp;\n for(int bE = 0; bE < bv; bE++) {\n bq = be + bh * by.y;\n z = Q(bq.xy);\n P = O(z);\n br = -1. / bq.z;\n bz = br - P;\n bz *= clamp(sign(abs(bz) - bf * bw * bw), .0, 1.);\n bC = abs(bz + bt) < bt;\n bA = clamp(by.x / (by.x - bz), .0, 1.);\n bB = bC ? by.y + bA * bw - bw : 1.;\n by.z = min(by.z, bB);\n by.x = bz;\n if(bC) {\n float bn = by.y - bw;\n float bo = by.y;\n bp = bm(be, bh, bn, bo);\n bp = bm(be, bh, bn, bo);\n bp = bm(be, bh, bn, bo);\n bD = bp;\n break;\n }\n by.y += bw;\n }\n return vec4(be + bh * bD, 1. - bD);\n}\nvec3 bF(in vec4 bG, const in float bH, const in vec3 bI, const in vec3 bJ, const in float bu) {\n vec4 bK = mix(outputFovInfo[0], outputFovInfo[1], bG.x);\n bG.xyz = vec3(mix(bK.xy, bK.zw, bG.y), 1.) * -1. / bG.z;\n bG.xyz = (reprojViewProjMatrix * vec4(bG.xyz, 1.)).xyw;\n bG.xy /= bG.z;\n float bL = clamp(6. - 6. * max(abs(bG.x), abs(bG.y)), .0, 1.);\n bG.xy = .5 + .5 * bG.xy;\n return vec3(bG.xy, 1.);\n}\nvec3 ssr(const in vec3 bI, const in vec3 bJ, const in float bu, const in vec3 bM, const in vec3 V) {\n float bN = .0;\n vec4 bO = vec4(.0);\n float W = bu * bu;\n W = W * W;\n vec3 bP = abs(bM.z) < .999 ? vec3(.0, .0, 1.) : vec3(1., .0, .0);\n vec3 S = normalize(cross(bP, bM));\n vec3 T = cross(bM, S);\n float bH = ssrFactor * clamp(-4. * dot(V, bM) + 3.8, .0, 1.);\n bH *= clamp(4.7 - bu * 5., .0, 1.);\n vec3 be = I(projMatrix, vViewVertex.xyz);\n be.z = 1. / be.z;\n vec3 bg = R(bN, S, T, bM, V, W);\n float bf = mix(cameraNearFar.y + vViewVertex.z, -vViewVertex.z - cameraNearFar.x, bg.z * .5 + .5);\n float bt = .5 * bf;\n vec4 bG;\n if(dot(bg, bM) > .001 && bH > .0) {\n bG = bs(be, bf, bt, bg, bu, bN);\n if(bG.w > .0)\n return bF(bG, bH, bI, bJ, bu);\n \n }\n return vec3(.0);\n}\n#endif\nconst vec3 bQ = vec3(0., 0., 1.);\nuniform mat4 viewMatrix;\nuniform sampler2D normalTexture;\nuniform sampler2D heightTexture;\nuniform vec4 waveParams;\nuniform vec2 waterDir;\nuniform vec4 waterBaseColor;\nuniform vec3 lightDirection;\nuniform vec3 lightColor;\nuniform vec3 camPos;\nuniform float timeElapsed;\nvarying vec2 vUv;\nvarying vec2 vNoiseUv;\nvarying vec3 vPos;\nvarying mat3 vTbnMatrix;\nfloat bR(vec3 bS, float bT) {\n float bU = max(.015, bT);\n return max((bS.x + bS.y) * .3303545 / bU + .3303545, .0);\n}\nconst vec2 bV = vec2(6. / 25., 5. / 24.);\nvec2 bW(sampler2D bX, vec2 H) {\n return 2. * texture2D(bX, H).rg - 1.;\n}\nfloat bY(vec2 H) {\n return texture2D(heightTexture, H).b;\n}\nvec3 bZ(sampler2D bX, vec2 H) {\n return 2. * texture2D(bX, H).rgb - 1.;\n}\nfloat ca(vec2 H, float cb) {\n return fract(cb);\n}\nfloat cc(vec2 H, float cb) {\n float cd = ca(H, cb);\n return 1. - abs(1. - 2. * cd);\n}\nvec3 ce(sampler2D cf, vec2 H, float cb, float cg) {\n float ch = waveParams[2];\n float ci = waveParams[3];\n vec2 cj = bW(cf, H) * ch;\n float cd = ca(H, cb + cg);\n float ck = cc(H, cb + cg);\n vec2 bO = H;\n bO -= cj * (cd + ci);\n bO += cg;\n bO += (cb - cd) * bV;\n return vec3(bO, ck);\n}\nconst float cl = 7.77;\nvec3 cm(sampler2D cn, sampler2D co, vec2 cp, vec2 cq, float cb) {\n float bT = waveParams[0];\n vec2 cr = cb * -cq;\n float cs = bY(vNoiseUv) * cl;\n vec3 ct = ce(co, cp + cr, cb + cs, .0);\n vec3 cu = ce(co, cp + cr, cb + cs, .5);\n vec3 cv = bZ(cn, ct.xy) * ct.z;\n vec3 cw = bZ(cn, cu.xy) * cu.z;\n vec3 cx = normalize(cv + cw);\n cx.xy *= bT;\n cx.z = sqrt(1. - dot(cx.xy, cx.xy));\n return cx;\n}\nvec4 cy(vec2 cp, float cz) {\n float cA = waveParams[1];\n vec3 bM = cm(normalTexture, heightTexture, cp * cA, waterDir, cz);\n float cB = bR(bM, waveParams[0]);\n return vec4(bM, cB);\n}\nconst float cC = 3.141592653589793;\nconst float cD = 1. / cC;\nconst float cE = .3183098861837907;\nconst float cF = 1.570796326794897;\nconst float cG = .4;\nfloat cH = 2.2;\nvec3 cI(float cJ, vec3 cK, float cL) {\n return cK + (cL - cK) * pow(1. - cJ, 5.);\n}\nfloat cM(float cN, float bu) {\n float cO = bu * bu;\n float cP = cN * cN;\n float cQ = pow((cP * (cO - 1.) + 1.), cH) * cC;\n return cO / cQ;\n}\nfloat cR(float cS) {\n return .25 / (cS * cS);\n}\nvec3 cT(const vec3 x) {\n return (x * (2.51 * x + .03)) / (x * (2.43 * x + .59) + .14);\n}\nconst float cU = 2.2;\nconst float cV = .4545454545;\nvec4 cW(vec4 d) {\n return vec4(pow(d.rgb, vec3(cV)), d.w);\n}\nvec3 cX(vec3 d) {\n return pow(d, vec3(cU));\n}\nconst vec3 cY = vec3(.02, 1., 5.);\nconst vec2 cZ = vec2(.02, .1);\nconst float bu = .06;\nconst float da = 1.7;\nconst vec3 db = vec3(0, .6, .9);\nconst vec3 dc = vec3(.72, .92, 1.);\nconst float dd = .65;\nconst float de = 300000.0;\nconst float df = 500000.0;\nconst float dg = .775;\nconst float dh = .8;\nvec3 di(in vec3 bS, in vec3 dj) {\n \n#ifdef HAS_IBL_LIGHTING\nvec3 dk = reflect(-dj, bS);\n return c(textureCube(specularPBR, dk), rgbmRange);\n#else\nreturn ambientColor;\n#endif\n}\nPBRShadingWater dl;\nvec3 dm(in PBRShadingWater dn, float bu, vec3 dp, float dq) {\n vec3 dr = cI(dn.VdotH, dp, dq);\n float ds = cM(dn.NdotH, bu);\n float dt = cR(dn.LdotH);\n float du = mix(bu + .045, bu + .385, 1. - dn.VdotH);\n float dv = 1.2;\n float dw = cM(dn.NdotH, du) * dv;\n return ((ds + dw) * dt) * dr;\n}\nvec3 dx(float da, float dy, vec3 db, float dz) {\n return da * (.075 * db * pow(dy, 4.) + 50. * pow(dy, 23.)) * dz;\n}\nvec3 dA(in float Z, in vec3 dB, in vec3 dC) {\n float dD = pow((1. - Z), cY[2]);\n return mix(dC, dB, dD);\n}\nvec3 dE(in vec3 bS, in vec3 dj, in vec3 dF, vec3 d, in vec3 dG, in vec3 dH, in float dI, float dJ, vec3 dK) {\n float dL = 0.;\n vec3 dM = cX(d);\n vec3 bb = normalize(dF + dj);\n dl.NdotL = clamp(dot(bS, dF), .0, 1.);\n dl.NdotV = clamp(dot(bS, dj), .001, 1.);\n dl.VdotN = clamp(dot(dj, bS), .001, 1.);\n dl.NdotH = clamp(dot(bS, bb), .0, 1.);\n dl.VdotH = clamp(dot(dj, bb), .0, 1.);\n dl.LdotH = clamp(dot(dF, bb), .0, 1.);\n float dN = max(dot(dH, dj), .0);\n vec3 dO = cX(dc);\n vec3 dP = cX(db);\n vec3 dc = dA(dN, dO, dP);\n float dQ = max(dot(dH, dF), .0);\n float dR = .1 + dQ * .9;\n dc *= dR;\n float dS = clamp(dI, .8, 1.);\n vec3 dT = cI(dl.VdotN, vec3(cY[0]), cY[1]);\n vec3 dU = dT * dc * dS;\n vec3 dV = dM * mix(dc, dQ * dG * cD, 2. / 3.) * dS;\n vec3 dW = vec3(.0);\n if(dN > .0 && dQ > .0) {\n vec3 dX = dm(dl, bu, vec3(cZ[0]), cZ[1]);\n vec3 dY = dG * cD * dI;\n dW = dl.NdotL * dY * dX;\n }\n vec3 cB = vec3(.0);\n if(dN > .0) {\n cB = dx(da, dJ, db, dR);\n }\n vec3 dZ = vec3(.0);\n#ifdef HAS_SSR\nfloat ea = smoothstep(df, de, -dK.z);\n mat4 eb = viewMatrix;\n vec4 ec = vec4(dK.xyz, 1.);\n vec3 ed = normalize(ec.xyz);\n vec4 ee = eb * vec4(bS, .0);\n vec3 ef = normalize(ee.xyz);\n vec4 eg = eb * vec4(dH, .0);\n float eh = pow(max(dot(-ed, eg.xyz), .0), cG);\n vec3 ei = mix(eg.xyz, ef, eh);\n vec3 ej = ssr(vec3(.0), vec3(1.), bu, normalize(ei), -normalize(vViewVertex.xyz));\n if(ej.z > .0) {\n vec2 ek = smoothstep(.3, .6, abs(vec2(.5) - ej.xy));\n dL = dg * clamp(1. - 1.3 * ek.y, .0, 1.) * ea;\n vec3 el = M(.0, ej.xy);\n dZ = cX(el) * dL * dT.y * dd;\n }\n#endif\nfloat em = mix(dh, dh * .5, dL);\n return cT((1. - dL) * dU + dZ + dV * em + dW + cB);\n}\nvoid main() {\n vec3 dH = bQ;\n vec4 en = cy(vUv, timeElapsed);\n vec3 bS = normalize(vTbnMatrix * en.xyz);\n vec3 dj = -normalize(vPos - camPos);\n vec3 dF = normalize(-lightDirection);\n#if defined(HAS_SHADOWING)\nfloat dI = shadow_computeShadow();\n#else\nfloat dI = 1.;\n#endif\nvec4 eo = viewMatrix * vec4(vPos, 1.);\n vec4 ep = vec4(dE(bS, dj, dF, waterBaseColor.rgb, lightColor, dH, dI, en.w, eo.xyz), waterBaseColor.a);\n gl_FragColor = cW(ep);\n if(contrast != 1.) {\n gl_FragColor = contrastMatrix(contrast) * gl_FragColor;\n }\n if(length(hsv) > .0) {\n gl_FragColor = hsv_apply(gl_FragColor, hsv);\n }\n}",
7985
7991
  defines: s,
@@ -8000,10 +8006,10 @@ class gr extends He {
8000
8006
  };
8001
8007
  return this.setIncludeUniformValues(i, e), i;
8002
8008
  }
8003
- As(t, e) {
8009
+ ws(t, e) {
8004
8010
  const {iblTexes: n} = this.getIBLRes(), i = t.projViewMatrix, r = t.getLightManager();
8005
8011
  let s = r && r.getDirectionalLight() || {};
8006
- const o = r && r.getAmbientLight() || {}, a = this.getSymbol(mr), l = this.Cs = this.Cs || [], h = {
8012
+ const o = r && r.getAmbientLight() || {}, a = this.getSymbol(yr), l = this.Fs = this.Fs || [], h = {
8007
8013
  hdrHsv: o.hsv || [ 0, 0, 0 ],
8008
8014
  specularPBR: n && n.prefilterMap,
8009
8015
  rgbmRange: n && n.rgbmRange,
@@ -8017,36 +8023,36 @@ class gr extends He {
8017
8023
  lightColor: s.color || pr.color,
8018
8024
  camPos: t.cameraPosition,
8019
8025
  timeElapsed: a.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (a.waterSpeed || 1) * 1e4) : 0,
8020
- normalTexture: this.ks || this.Ps,
8021
- heightTexture: this.Os || this.Ps,
8026
+ normalTexture: this.Is || this.Ts,
8027
+ heightTexture: this.Cs || this.Ts,
8022
8028
  waveParams: [ .09, a.uvScale || 3, .03, -.5 ],
8023
8029
  waterDir: vr(l, a.waterDirection || 0),
8024
8030
  waterBaseColor: a.waterBaseColor || [ .1451, .2588, .4863, 1 ],
8025
8031
  contrast: a.contrast || 1,
8026
- hsv: a.hsv || yr
8032
+ hsv: a.hsv || mr
8027
8033
  };
8028
8034
  return this.setIncludeUniformValues(h, e), e && e.ssr && e.ssr.renderUniforms && Zt(h, e.ssr.renderUniforms),
8029
8035
  h;
8030
8036
  }
8031
8037
  delete() {
8032
- super.delete(), this.Ps && (this.Ps.destroy(), delete this.Ps), this.ks && this.ks.destroy(),
8033
- this.Os && this.Os.destroy(), this.shader && this.shader.dispose(), this.ws && this.ws.dispose(),
8034
- this.Ss && (this.Ss.geometry.dispose(), this.Ss.material && this.Ss.material.dispose(),
8035
- this.Ss.dispose(), delete this.Ss), this.disposeIBLTextures();
8038
+ super.delete(), this.Ts && (this.Ts.destroy(), delete this.Ts), this.Is && this.Is.destroy(),
8039
+ this.Cs && this.Cs.destroy(), this.shader && this.shader.dispose(), this._s && this._s.dispose(),
8040
+ this.Ms && (this.Ms.geometry.dispose(), this.Ms.material && this.Ms.material.dispose(),
8041
+ this.Ms.dispose(), delete this.Ms), this.disposeIBLTextures();
8036
8042
  }
8037
8043
  createGround() {
8038
8044
  const t = new n.Plane;
8039
8045
  t.data.aTexCoord = new Uint8Array([ 0, 1, 1, 1, 0, 0, 1, 0 ]), t.generateBuffers(this.renderer.regl),
8040
- this.Ss = new n.Mesh(t, null, {
8046
+ this.Ms = new n.Mesh(t, null, {
8041
8047
  castShadow: !1
8042
- }), this._s = new n.Scene([ this.Ss ]);
8048
+ }), this.Ss = new n.Scene([ this.Ms ]);
8043
8049
  }
8044
8050
  transformWater() {
8045
- const t = this.getMap(), e = s.getGroundTransform(this.Ss.localTransform, t);
8046
- this.Ss.setLocalTransform(e);
8047
- const n = t._get2DExtentAtRes(t.getGLRes()), i = n.getWidth(), r = n.getHeight(), o = t.cameraLookAt, a = o[0] - i, l = o[1] + r, h = this.Ts, c = a / h[0], f = l / h[1], u = c % 1, d = f % 1, p = .3737 * c % 1, m = .3737 * f % 1, y = n.getWidth() / h[0] * 2, g = n.getHeight() / h[1] * 2;
8048
- this.Ss.setUniform("uvOffset", [ u, d ]), this.Ss.setUniform("noiseUvOffset", [ p, m ]),
8049
- this.Ss.setUniform("uvScale", [ y, -g ]);
8051
+ const t = this.getMap(), e = s.getGroundTransform(this.Ms.localTransform, t);
8052
+ this.Ms.setLocalTransform(e);
8053
+ const n = t._get2DExtentAtRes(t.getGLRes()), i = n.getWidth(), r = n.getHeight(), o = t.cameraLookAt, a = o[0] - i, l = o[1] + r, h = this.ks, c = a / h[0], f = l / h[1], u = c % 1, d = f % 1, p = .3737 * c % 1, y = .3737 * f % 1, m = n.getWidth() / h[0] * 2, g = n.getHeight() / h[1] * 2;
8054
+ this.Ms.setUniform("uvOffset", [ u, d ]), this.Ms.setUniform("noiseUvOffset", [ p, y ]),
8055
+ this.Ms.setUniform("uvScale", [ m, -g ]);
8050
8056
  }
8051
8057
  }
8052
8058
 
@@ -8142,7 +8148,7 @@ const Or = Jt("heatmap", class extends He {
8142
8148
  o;
8143
8149
  }
8144
8150
  callRenderer(t, e) {
8145
- this.Fs.render(this.scene, t, this.getRenderFBO(e));
8151
+ this.Es.render(this.scene, t, this.getRenderFBO(e));
8146
8152
  }
8147
8153
  getUniformValues(t) {
8148
8154
  const {projViewMatrix: e} = t;
@@ -8156,7 +8162,7 @@ const Or = Jt("heatmap", class extends He {
8156
8162
  return this.scene.getMeshes();
8157
8163
  }
8158
8164
  delete() {
8159
- super.delete(...arguments), this.Fs.dispose(), delete this.Fs;
8165
+ super.delete(...arguments), this.Es.dispose(), delete this.Es;
8160
8166
  }
8161
8167
  init() {
8162
8168
  const t = this.regl;
@@ -8175,7 +8181,7 @@ const Or = Jt("heatmap", class extends He {
8175
8181
  zpass: "replace"
8176
8182
  }
8177
8183
  }, r = this.getPolygonOffset(), s = this.getSymbols()[0];
8178
- this.Fs = new f(this.regl, this.sceneConfig, this.layer, s.heatmapColor, i, r);
8184
+ this.Es = new f(this.regl, this.sceneConfig, this.layer, s.heatmapColor, i, r);
8179
8185
  }
8180
8186
  });
8181
8187
 
@@ -8185,7 +8191,7 @@ const Cr = Jt("water", gr);
8185
8191
 
8186
8192
  Cr.registerAt(ct), At.registerPainter("lit", nr), At.registerPainter("icon", hi),
8187
8193
  At.registerPainter("fill", Ne), At.registerPainter("line", Ve), At.registerPainter("line-gradient", je),
8188
- At.registerPainter("water", gr), ct.VERSION = "0.63.6", At.VERSION = "0.63.6";
8194
+ At.registerPainter("water", gr), ct.VERSION = "0.63.9", At.VERSION = "0.63.9";
8189
8195
 
8190
8196
  if (e.mat4.create(), e.transcoders) {
8191
8197
  const n = t.Map.VERSION;
@@ -8197,6 +8203,6 @@ if (e.mat4.create(), e.transcoders) {
8197
8203
  }));
8198
8204
  } else t.registerWorkerAdapter("@maptalks/vt", H);
8199
8205
 
8200
- export { Ne as FillPainter, xr as FillPlugin, kr as GLTFPhongPlugin, Ir as GLTFStandardPlugin, vt as GeoJSONVectorTileLayer, Or as HeatmapPlugin, hi as IconPainter, wr as IconPlugin, Ar as LineGradientPlugin, Ve as LinePainter, br as LinePlugin, Ut as LineStringLayer, Tr as LitPlugin, yt as MapboxVectorTileLayer, Bi as NativeLinePainter, Sr as NativeLinePlugin, Gi as NativePointPainter, Ki as PhongPainter, Mr as PhongPlugin, jt as PointLayer, Gt as PolygonLayer, Li as TextPainter, _r as TextPlugin, At as Vector3DLayer, ct as VectorTileLayer, nt as VectorTileLayerRenderer, Cr as WaterPlugin, Qi as WireframePainter, Pr as WireframePlugin };
8206
+ export { Ne as FillPainter, xr as FillPlugin, kr as GLTFPhongPlugin, Ir as GLTFStandardPlugin, vt as GeoJSONVectorTileLayer, Or as HeatmapPlugin, hi as IconPainter, wr as IconPlugin, Ar as LineGradientPlugin, Ve as LinePainter, br as LinePlugin, Ut as LineStringLayer, Tr as LitPlugin, mt as MapboxVectorTileLayer, Bi as NativeLinePainter, Sr as NativeLinePlugin, Gi as NativePointPainter, Ki as PhongPainter, Mr as PhongPlugin, jt as PointLayer, Gt as PolygonLayer, Li as TextPainter, _r as TextPlugin, At as Vector3DLayer, ct as VectorTileLayer, nt as VectorTileLayerRenderer, Cr as WaterPlugin, Qi as WireframePainter, Pr as WireframePlugin };
8201
8207
 
8202
- "undefined" != typeof console && console.log("@maptalks/vt v0.63.6");
8208
+ "undefined" != typeof console && console.log("@maptalks/vt v0.63.9");