@maptalks/vt 0.96.0 → 0.96.2

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.96.0
2
+ * @maptalks/vt v0.96.2
3
3
  * LICENSE : undefined
4
4
  * (c) 2016-2024 maptalks.org
5
5
  */
@@ -9,7 +9,7 @@ import * as e from "@maptalks/gl";
9
9
 
10
10
  import { reshader as n, vec3 as i, mat4 as r, GroundPainter as s, createREGL as o, vec4 as a, HighlightUtil as l, vec2 as h, mat2 as u, quat as c, mat3 as f, HeatmapProcess as d } from "@maptalks/gl";
11
11
 
12
- import { IconRequestor as p, GlyphRequestor as m, Color as y, FilterUtil as g, PackUtil as x, StyleUtil as v, SYMBOLS_NEED_REBUILD_IN_VT as b, FuncTypeUtil as A, INVALID_TEX_COORD as w, TextUtil as _, DEFAULT_TEX_WIDTH as M, PointPack as S, VectorPack as T, StyledPoint as P, LinePack as k, StyledVector as I, SYMBOLS_NEED_REBUILD_IN_VECTOR as O, PolygonPack as C, vec2 as F, ArrayPool as E, earcut as D, vec3 as L, vec4 as z } from "@maptalks/vector-packer";
12
+ import { IconRequestor as p, GlyphRequestor as m, Color as y, FilterUtil as g, PackUtil as x, StyleUtil as v, SYMBOLS_NEED_REBUILD_IN_VT as b, FuncTypeUtil as A, INVALID_TEX_COORD as w, TextUtil as _, DEFAULT_TEX_WIDTH as S, PointPack as M, VectorPack as T, StyledPoint as P, LinePack as k, StyledVector as I, SYMBOLS_NEED_REBUILD_IN_VECTOR as O, PolygonPack as C, vec2 as F, ArrayPool as E, earcut as D, vec3 as L, vec4 as z } from "@maptalks/vector-packer";
13
13
 
14
14
  export { FilterUtil, PackUtil, SYMBOLS_NEED_REBUILD_IN_VECTOR, SYMBOLS_NEED_REBUILD_IN_VT } from "@maptalks/vector-packer";
15
15
 
@@ -27,7 +27,7 @@ import { buildNormals as Y, buildTangents as B, packTangentFrame as X } from "@m
27
27
 
28
28
  import $ from "rbush";
29
29
 
30
- const q = "${", K = `function(t){let n;const e={width:100,height:10};function r(){if(!n){const{width:t,height:r}=e;OffscreenCanvas?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class i{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let r=1/0,i=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];r=Math.min(e,r),i=Math.max(e,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const s=i.createLinearGradient(0,0,t.width,0),{colors:o,valueOffset:a}=this;for(let t=0,n=o.length;t<n;t++){const[n,e]=o[t],r=(n-this.min)/a;s.addColorStop(r,e)}i.fillStyle=s,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const r=4*e;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function o(t,n){var e,r,i;if(y(t)){var s,h=t.stops&&"object"==typeof t.stops[0][0],d=h||void 0!==t.property,p=h||!d,m=t.type||n||"exponential";if("exponential"===m)s=l;else if("interval"===m)s=u;else if("categorical"===m)s=a;else if("identity"===m)s=f;else{if("color-interpolate"!==m)throw new Error('Unknown function type "'+m+'"');s=c}if(h){var g={},v=[];for(let n=0;n<t.stops.length;n++){var b=t.stops[n];void 0===g[b[0].zoom]&&(g[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),g[b[0].zoom].stops.push([b[0].value,b[1]])}for(let t in g)v.push([g[t].zoom,o(g[t])]);e=function(n,e){const r=l({stops:v,base:t.base},n)(n,e);return"function"==typeof r?r(n,e):r},r=!1,i=!1}else p?(e=function(n){const e=s(t,n);return"function"==typeof e?e(n):e},r=!0,i=!1):(e=function(n,e){const r=s(t,e?e[t.property]:null);return"function"==typeof r?r(n,e):r},r=!1,i=!0)}else e=function(){return t},r=!0,i=!0;return e.isZoomConstant=i,e.isFeatureConstant=r,e}function a(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function u(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function l(t,n){for(var e=void 0!==t.base?t.base:1,r=0;!(r>=t.stops.length||n<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:d(n,e,t.stops[r-1][0],t.stops[r][0],t.stops[r-1][1],t.stops[r][1])}"function"==typeof Map&&(s=new Map);const h={width:100,height:1};function c(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new i(e,h);s.set(n,t)}t=s.get(n)}else t=new i(e,h);const[r,o,a,u]=t.getColor(n);return[r/255,o/255,a/255,u/255]}return e&&1===e.length?e[0][1]:null}function f(t,n){return function(t,n,e){return void 0!==t?t:void 0!==n?n:null}(n,t.default)}function d(t,n,e,r,i,s){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),a=s.apply(void 0,arguments);return d(t,n,e,r,o,a)}:i.length?function(t,n,e,r,i,s){var o=[];for(let a=0;a<i.length;a++)o[a]=p(t,n,e,r,i[a],s[a]);return o}(t,n,e,r,i,s):p(t,n,e,r,i,s)}function p(t,n,e,r,i,s){var o,a=r-e,u=t-e;return i*(1-(o=1===n?u/a:(Math.pow(n,u)-1)/(Math.pow(n,a)-1)))+s*o}function y(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function m(t){return b(t,"exponential")}function g(t){return b(t,"interval")}function v(t,n){if(!t)return null;var e=!1;if(Array.isArray(t)){var r,i=[];for(let s=0;s<t.length;s++)(r=v(t[s],n))?(i.push(r),e=!0):i.push(t[s]);return e?i:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const u=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=m(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,r=a.length;n<r;n++)y(t[s=a[n]])?(e=!0,o["_"+s]=t[s],u(s)):o[s]=t[s];return e?o:t}function b(t,n){if(!y(t))return function(){return t};let e=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(y(i[t][1])){const s=b(i[t][1],n);e=e&&s.isZoomConstant,r=r&&s.isFeatureConstant,i[t]=[i[t][0],s]}const s=o(t,n);return s.isZoomConstant=e&&s.isZoomConstant,s.isFeatureConstant=r&&s.isFeatureConstant,s}let w=0;const M="function"==typeof Object.assign;function x(t,...n){if(M)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const r=n[e];for(const n in r)t[n]=r[n]}return t}function F(t){return!S(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function k(t){return"number"==typeof t&&!isNaN(t)}function A(t){return!S(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function P(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function S(t){return null==t}function _(t){return y(t)&&t.property}const O="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const e="_maptalks_jsonp_"+w++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,n,e){if(A(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const r="POST"===n.method;if(O){const r=new AbortController,i=n;i.signal=r.signal,i.referrerPolicy=i.referrerPolicy||"origin",i.method=i.method||"GET";const s=new Request(t,i);return n.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((r=>{const i=this.o(r,n.returnJSON,n.responseType);i.message?(i.url=t,e(i)):i.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),contentType:r.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),r}{const i=C.u(e);if(i.open(n.method||"GET",t,!0),n){for(const t in n.headers)i.setRequestHeader(t,n.headers[t]);i.withCredentials="include"===n.credentials,n.responseType&&(i.responseType=n.responseType)}return i.send(r?n.body:null),i}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${q}t.status}): ${q}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),m: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(${q}t.status}): ${q}t.statusText}\`})}},u: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.m(n,t),n},getArrayBuffer(t,n,e){if(A(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,e)}};function E(t,n,e,r,i=3){let s=r;const o=e-n>>1;let a,u=e-n;const l=t[n],h=t[n+1],c=t[e],f=t[e+1];for(let r=n+i;r<e;r+=i){const n=I(t[r],t[r+1],l,h,c,f);if(n>s)a=r,s=n;else if(n===s){const t=Math.abs(r-o);t<u&&(a=r,u=t)}}s>r&&(a-n>i&&E(t,n,a,r,i),t[a+2]=s,e-a>i&&E(t,a,e,r,i))}function I(t,n,e,r,i,s){let o=i-e,a=s-r;if(0!==o||0!==a){const u=((t-e)*o+(n-r)*a)/(o*o+a*a);u>1?(e=i,r=s):u>0&&(e+=o*u,r+=a*u)}return o=t-e,a=n-r,o*o+a*a}function $(t,n,e,r,i,s){const o={id:null==t?null:t,type:n,geometry:e,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(o.layer=i);return function(t,n){const e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)T(t,e,n);else if("Polygon"===r)T(t,e[0],n);else if("MultiLineString"===r)for(const r of e)T(t,r,n);else if("MultiPolygon"===r)for(const r of e)T(t,r[0],n)}(o,s?4:3),o}function T(t,n,e){for(let r=0;r<n.length;r+=e)t.minX=Math.min(t.minX,n[r]),t.minY=Math.min(t.minY,n[r+1]),t.maxX=Math.max(t.maxX,n[r]),t.maxY=Math.max(t.maxY,n[r+1])}function D(t,n,e,r){if(r.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)z(t,e.features[n],r,n);else"Feature"===e.type?z(t,e,r):z(t,{geometry:e},r)}function z(t,n,e,r){if(!n.geometry)return;const i=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let a=[],u=n.id;if(e.promoteId?u=n.properties[e.promoteId]:e.generateId&&(u=r||0),"Point"===s)j(i,a,e);else if("MultiPoint"===s)for(const t of i)j(t,a,e);else if("LineString"===s)U(i,a,o,!1,e);else if("MultiLineString"===s){if(e.lineMetrics){for(const r of i)a=[],U(r,a,o,!1,e),t.push($(u,"LineString",a,n.properties,e.layer,e.hasAltitude));return}N(i,a,o,!1,e)}else if("Polygon"===s)N(i,a,o,!0,e);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(const i of n.geometry.geometries)z(t,{id:u,geometry:i,properties:n.properties},e,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const n=[];N(t,n,o,!0,e),a.push(n)}}t.push($(u,s,a,n.properties,e.layer,e.hasAltitude))}function j(t,n,e){n.push(L(t[0]),R(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function U(t,n,e,r,i){let s,o,a=0;for(let e=0;e<t.length;e++){const u=L(t[e][0]),l=R(t[e][1],i.projection);n.push(u,l,0),i.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(a+=r?(s*l-u*o)/2:Math.sqrt(Math.pow(u-s,2)+Math.pow(l-o,2))),s=u,o=l}const u=i.hasAltitude?4:3,l=n.length-u;n[2]=1,E(n,0,l,e,u),n[l+2]=1,n.size=Math.abs(a),n.start=0,n.end=n.size}function N(t,n,e,r,i){for(let s=0;s<t.length;s++){const o=[];U(t[s],o,e,r,i),n.push(o)}}function L(t){return t/360+.5}function R(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function V(t,n,e,r,i,s,o,a){if(r/=n,s>=(e/=n)&&o<r)return t;if(o<e||s>=r)return null;const u=[];for(const n of t){const t=n.geometry;let s=n.type;const o=0===i?n.minX:n.minY,l=0===i?n.maxX:n.maxY;if(o>=e&&l<r){u.push(n);continue}if(l<e||o>=r)continue;let h=[];if("Point"===s||"MultiPoint"===s)H(t,h,e,r,i,a.hasAltitude);else if("LineString"===s)q(t,h,e,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===s)J(t,h,e,r,i,!1,a.hasAltitude);else if("Polygon"===s)J(t,h,e,r,i,!0,a.hasAltitude);else if("MultiPolygon"===s)for(const n of t){const t=[];J(n,t,e,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===s){for(const t of h)u.push($(n.id,s,t,n.tags,n.layer,a.hasAltitude));continue}"LineString"!==s&&"MultiLineString"!==s||(1===h.length?(s="LineString",h=h[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===h.length?"Point":"MultiPoint"),u.push($(n.id,s,h,n.tags,n.layer,a.hasAltitude))}}return u.length?u:null}function H(t,n,e,r,i,s){const o=s?4:3;for(let a=0;a<t.length;a+=o){const o=t[a+i];o>=e&&o<=r&&(W(n,t[a],t[a+1],t[a+2]),s&&n.push(t[a+3]))}}function q(t,n,e,r,i,s,o,a){let u=G(t);const l=0===i?B:X;let h,c,f=t.start;const d=a?4:3,p=s?t.length:t.length-d;for(let y=0;y<p;y+=d){const m=t[y],g=t[y+1],v=t[y+2];let b,w,M,x;s&&y===p-d?(b=t[0],w=t[1]):(b=t[y+d],w=t[y+d+1]),a&&(M=t[y+3],x=s&&y===p-d?t[3]:t[y+d+3]);const F=0===i?m:g,k=0===i?b:w;let A=!1;o&&(h=Math.sqrt(Math.pow(m-b,2)+Math.pow(g-w,2))),F<e?k>e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):F>r?k<r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):(W(u,m,g,v),a&&u.push(M)),k<e&&F>=e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),A=!0),k>r&&F<=r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),A=!0),!s&&A&&(o&&(u.end=f+h*c),n.push(u),u=G(t)),o&&(f+=h)}let y=t.length-d;if(!s){const n=t[y],s=t[y+1],o=t[y+2],l=0===i?n:s;if(l>=e&&l<=r&&W(u,n,s,o),l>=e&&l<=r&&a){const n=t[y+3];u.push(n)}}y=u.length-d,s&&y>=d&&(u[y]!==u[0]||u[y+1]!==u[1])&&(W(u,u[0],u[1],u[2]),a&&u.push(u[3])),u.length&&n.push(u)}function G(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function J(t,n,e,r,i,s,o){for(const a of t)q(a,n,e,r,i,s,!1,o)}function W(t,n,e,r){t.push(n,e,r)}function B(t,n,e,r,i,s){const o=(s-n)/(r-n);return W(t,s,e+(i-e)*o,1),o}function X(t,n,e,r,i,s){const o=(s-e)/(i-e);return W(t,n+(r-n)*o,s,1),o}function Y(t,n,e){return t+(n-t)*e}function K(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=s.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=Z(s.geometry,n,e);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const t of s.geometry)a.push(Z(t,n,e))}else if("MultiPolygon"===o){a=[];for(const t of s.geometry){const r=[];for(const i of t)r.push(Z(i,n,e));a.push(r)}}r.push($(s.id,o,a,s.tags,s.layer,e))}return r}function Z(t,n,e){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=e?4:3;for(let s=0;s<t.length;s+=i)r.push(t[s]+n,t[s+1],t[s+2]),e&&r.push(t[s+3]);return r}function Q(t,n,e){if(t.transformed)return t;const r=1<<t.z,i=t.x,s=t.y,o=e?3:2;for(const a of t.features){const t=a.geometry,u=a.type;if(a.geometry=[],1===u)for(let u=0;u<t.length;u+=o)a.geometry.push(tt(t[u],t[u+1],n,r,i,s)),e&&a.geometry[a.geometry.length-1].push(t[u+2]);else for(let u=0;u<t.length;u++){const l=[];for(let a=0;a<t[u].length;a+=o)l.push(tt(t[u][a],t[u][a+1],n,r,i,s)),e&&l[l.length-1].push(t[u][a+2]);a.geometry.push(l)}}return t.transformed=!0,t}function tt(t,n,e,r,i,s){return[Math.round(e*(t*r-i)),Math.round(e*(n*r-s))]}function nt(t,n,e,r,i){const s=n===i.maxZoom?0:i.tolerance/((1<<n)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:r,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(o,n,s,i);return o}function et(t,n,e,r){const i=n.geometry,s=n.type,o=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===s||"MultiPoint"===s)for(let n=0;n<i.length;n+=a)o.push(i[n],i[n+1]),r.hasAltitude&&o.push(i[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===s)it(o,i,t,e,!1,!1,r);else if("MultiLineString"===s||"Polygon"===s)for(let n=0;n<i.length;n++)it(o,i[n],t,e,"Polygon"===s,0===n,r);else if("MultiPolygon"===s)for(let n=0;n<i.length;n++){const s=i[n];for(let n=0;n<s.length;n++)it(o,s[n],t,e,!0,0===n,r)}if(o.length){let e=n.tags||null;if("LineString"===s&&r.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=i.start/i.size,e.mapbox_clip_end=i.end/i.size}const a={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:e};n.layer&&(a.layer=n.layer),null!==n.id&&(a.id=n.id),t.features.push(a)}}function rt(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function it(t,n,e,r,i,s,o){const a=r*r,{hasAltitude:u,disableFilter:l}=o,h=u?4:3;if(!l&&r>0&&n.size<(i?a:r))return void(e.numPoints+=n.length/h);const c=[];for(let t=0;t<n.length;t+=h)(0===r||n[t+2]>a||rt(n,t,u))&&(e.numSimplified++,c.push(n[t],n[t+1]),u&&c.push(n[t+3])),e.numPoints++;i&&function(t,n,e){const r=e?3:2;let i=0;for(let n=0,e=t.length,s=e-r;n<e;s=n,n+=r)i+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(i>0===n){const n=r,i=r-1,s=r-2;for(let o=0,a=t.length;o<a/2;o+=r){const r=t[o],u=t[o+1];let l;e&&(l=t[o+2]),t[o]=t[a-n-o],t[o+1]=t[a-i-o],e&&(t[o+2]=t[a-s-o]),t[a-n-o]=r,t[a-i-o]=u,e&&(t[a-s-o]=l)}}}(c,s,u),t.push(c)}C.getJSON=function(t,n,e){if(A(n)){const t=e;e=n,n=t}const r=function(t,n){const r="string"==typeof n?JSON.parse(n):n||null;e(t,r)};return n&&n.jsonp?C.jsonp(t,r):((n=n||{}).returnJSON=!0,C.get(t,n,r))};const st={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,hasAltitude:!1,disableFilter:!1,debug:0};class ot{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(st),n)).debug;if(e&&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.");let r=function(t,n){const e=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)D(e,t[r].layer,t[r].data,n);return e}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(e,t.features[r],n,r);else"Feature"===t.type?z(e,t,n):z(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,n){const e=n.buffer/n.extent;let r=t;const i=V(t,1,-1-e,e,0,-1,2,n),s=V(t,1,1-e,2+e,0,-1,2,n);return(i||s)&&(r=V(t,1,-e,1+e,0,-1,2,n)||[],i&&(r=K(i,1,n.hasAltitude).concat(r)),s&&(r=r.concat(K(s,-1,n.hasAltitude)))),r}(r,n),r.length&&this.splitTile(r,0,0,0),e&&(r.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)))}splitTile(t,n,e,r,i,s,o){const a=[t,n,e,r],u=this.options,l=u.debug;for(;a.length;){r=a.pop(),e=a.pop(),n=a.pop(),t=a.pop();const h=1<<n,c=at(n,e,r);let f=this.tiles[c];if(!f&&(l>1&&console.time("creation"),f=this.tiles[c]=nt(t,n,e,r,u),this.tileCoords.push({z:n,x:e,y:r}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${q}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(n===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue}else{if(n===u.maxZoom||n===i)continue;if(null!=i){const t=i-n;if(e!==s>>t||r!==o>>t)continue}}if(f.source=null,0===t.length)continue;l>1&&console.time("clipping");const d=.5*u.buffer/u.extent,p=.5-d,y=.5+d,m=1+d;let g=null,v=null,b=null,w=null,M=V(t,h,e-d,e+y,0,f.minX,f.maxX,u),x=V(t,h,e+p,e+m,0,f.minX,f.maxX,u);t=null,M&&(g=V(M,h,r-d,r+y,1,f.minY,f.maxY,u),v=V(M,h,r+p,r+m,1,f.minY,f.maxY,u),M=null),x&&(b=V(x,h,r-d,r+y,1,f.minY,f.maxY,u),w=V(x,h,r+p,r+m,1,f.minY,f.maxY,u),x=null),l>1&&console.timeEnd("clipping"),a.push(g||[],n+1,2*e,2*r),a.push(v||[],n+1,2*e,2*r+1),a.push(b||[],n+1,2*e+1,2*r),a.push(w||[],n+1,2*e+1,2*r+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const r=this.options,{extent:i,debug:s}=r,{hasAltitude:o,wrapX:a}=r;if(t<0||t>24)return null;if(a){const e=1<<t;n=n+e&e-1}const u=at(t,n,e);if(this.tiles[u])return Q(this.tiles[u],i,o);s>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let l,h=t,c=n,f=e;for(;!l&&h>0;)h--,c>>=1,f>>=1,l=this.tiles[at(h,c,f)];return l&&l.source?(s>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(l.source,h,c,f,t,n,e),s>1&&console.timeEnd("drilling down"),this.tiles[u]?Q(this.tiles[u],i,o):null):null}}function at(t,n,e){return 32*((1<<t)*e+n)+t}function ut(t,n,e,r,i,s,o){const a=e&&Array.isArray(e[0]);for(let u=0,l=e.length;u<l;u++){t[n]=(a?e[u][0]:e[u].x)*r,t[n+1]=(a?e[u][1]:e[u].y)*r,o!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let h=i||0;Array.isArray(i)&&(h=i[u]),h=h?Math.round(r*h):0,t[n+2]=h,n+=3,s&&0!==u&&u!==l-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function lt(t,n,e,r){const i=t[3*n],s=t[3*n+1],o=t[3*e],a=t[3*e+1];return i===o&&(i<0||i>r)||s===a&&(s<0||s>r)}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;function ht(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ct=ft;function ft(t,n){this.x=t,this.y=n}ft.prototype={clone:function(){return new ft(this.x,this.y)},add:function(t){return this.clone().F(t)},sub:function(t){return this.clone().k(t)},multByPoint:function(t){return this.clone().A(t)},divByPoint:function(t){return this.clone().P(t)},mult:function(t){return this.clone().S(t)},div:function(t){return this.clone()._(t)},rotate:function(t){return this.clone().O(t)},rotateAround:function(t,n){return this.clone().C(t,n)},matMult:function(t){return this.clone().I(t)},unit:function(){return this.clone().T()},perp:function(){return this.clone().D()},round:function(){return this.clone().j()},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,e=t.y-this.y;return n*n+e*e},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)},I:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},F:function(t){return this.x+=t.x,this.y+=t.y,this},k:function(t){return this.x-=t.x,this.y-=t.y,this},S:function(t){return this.x*=t,this.y*=t,this},_:function(t){return this.x/=t,this.y/=t,this},A:function(t){return this.x*=t.x,this.y*=t.y,this},P:function(t){return this.x/=t.x,this.y/=t.y,this},T:function(){return this._(this.mag()),this},D:function(){var t=this.y;return this.y=this.x,this.x=-t,this},O:function(t){var n=Math.cos(t),e=Math.sin(t),r=n*this.x-e*this.y,i=e*this.x+n*this.y;return this.x=r,this.y=i,this},C:function(t,n){var e=Math.cos(t),r=Math.sin(t),i=n.x+e*(this.x-n.x)-r*(this.y-n.y),s=n.y+r*(this.x-n.x)+e*(this.y-n.y);return this.x=i,this.y=s,this},j:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ft.convert=function(t){return t instanceof ft?t:Array.isArray(t)?new ft(t[0],t[1]):t};var dt=ht(ct);function pt(t,n,e){e=e||{},this.w=t||64,this.h=n||64,this.autoResize=!!e.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function yt(t,n,e){this.x=0,this.y=t,this.w=this.free=n,this.h=e}function mt(t,n,e,r,i,s,o){this.id=t,this.x=n,this.y=e,this.w=r,this.h=i,this.maxw=s||r,this.maxh=o||i,this.refcount=0}pt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var e,r,i,s,o=[],a=0;a<t.length;a++)if(e=t[a].w||t[a].width,r=t[a].h||t[a].height,i=t[a].id,e&&r){if(!(s=this.packOne(e,r,i)))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},pt.prototype.packOne=function(t,n,e){var r,i,s,o,a,u,l,h,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof e||"number"==typeof e){if(r=this.getBin(e))return this.ref(r),r;"number"==typeof e&&(this.maxId=Math.max(e,this.maxId))}else e=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(r=this.freebins[o]).maxh&&t===r.maxw)return this.allocFreebin(o,t,n,e);n>r.maxh||t>r.maxw||n<=r.maxh&&t<=r.maxw&&(s=r.maxw*r.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(i=this.shelves[o]).h,!(t>i.free)){if(n===i.h)return this.allocShelf(o,t,n,e);n>i.h||n<i.h&&(s=(i.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,e):-1!==c.shelf?this.allocShelf(c.shelf,t,n,e):n<=this.h-f&&t<=this.w?(i=new yt(f,this.w,n),this.allocShelf(this.shelves.push(i)-1,t,n,e)):this.autoResize?(a=u=this.h,((l=h=this.w)<=a||t>l)&&(h=2*Math.max(t,l)),(a<l||n>a)&&(u=2*Math.max(n,a)),this.resize(h,u),this.packOne(t,n,e)):null},pt.prototype.allocFreebin=function(t,n,e,r){var i=this.freebins.splice(t,1)[0];return i.id=r,i.w=n,i.h=e,i.refcount=0,this.bins[r]=i,this.ref(i),i},pt.prototype.allocShelf=function(t,n,e,r){var i=this.shelves[t].alloc(n,e,r);return this.bins[r]=i,this.ref(i),i},pt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,e=0;e<this.shelves.length;e++){var r=this.shelves[e];n+=r.h,t=Math.max(r.w-r.free,t)}this.resize(t,n)}},pt.prototype.getBin=function(t){return this.bins[t]},pt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},pt.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)},pt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},pt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var e=0;e<this.shelves.length;e++)this.shelves[e].resize(t);return!0},yt.prototype.alloc=function(t,n,e){if(t>this.free||n>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,new mt(e,r,this.y,t,n,t,this.h)},yt.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var gt={exports:{}},vt={exports:{}},bt=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))},wt=Array.prototype.concat,Mt=Array.prototype.slice,xt=vt.exports=function(t){for(var n=[],e=0,r=t.length;e<r;e++){var i=t[e];bt(i)?n=wt.call(n,Mt.call(i)):n.push(i)}return n};xt.wrap=function(t){return function(){return t(xt(arguments))}};var Ft=vt.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]},At=Ft,Pt=Object.hasOwnProperty,St=Object.create(null);for(var _t in kt)Pt.call(kt,_t)&&(St[kt[_t]]=_t);var Ot=gt.exports={to:{},get:{}};function Ct(t,n,e){return Math.min(Math.max(n,t),e)}function Et(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}Ot.get=function(t){var n,e;switch(t.substring(0,3).toLowerCase()){case"hsl":n=Ot.get.hsl(t),e="hsl";break;case"hwb":n=Ot.get.hwb(t),e="hwb";break;default:n=Ot.get.rgb(t),e="rgb"}return n?{model:e,value:n}:null},Ot.get.rgb=function(t){if(!t)return null;var n,e,r,i=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=n[2],n=n[1],e=0;e<3;e++){var s=2*e;i[e]=parseInt(n.slice(s,s+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(n=n[1])[3],e=0;e<3;e++)i[e]=parseInt(n[e]+n[e],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(e=0;e<3;e++)i[e]=parseInt(n[e+1],0);n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[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]:Pt.call(kt,n[1])?((i=kt[n[1]])[3]=1,i):null:null;for(e=0;e<3;e++)i[e]=Math.round(2.55*parseFloat(n[e+1]));n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[3]=parseFloat(n[4]))}for(e=0;e<3;e++)i[e]=Ct(i[e],0,255);return i[3]=Ct(i[3],0,1),i},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.to.hex=function(){var t=At(arguments);return"#"+Et(t[0])+Et(t[1])+Et(t[2])+(t[3]<1?Et(Math.round(255*t[3])):"")},Ot.to.rgb=function(){var t=At(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]+")"},Ot.to.rgb.percent=function(){var t=At(arguments),n=Math.round(t[0]/255*100),e=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+e+"%, "+r+"%)":"rgba("+n+"%, "+e+"%, "+r+"%, "+t[3]+")"},Ot.to.hsl=function(){var t=At(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},Ot.to.hwb=function(){var t=At(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},Ot.to.keyword=function(t){return St[t.slice(0,3)]};var It=gt.exports,$t={exports:{}},Tt={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]},Dt={};for(var zt in Tt)Tt.hasOwnProperty(zt)&&(Dt[Tt[zt]]=zt);var jt=$t.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 Ut in jt)if(jt.hasOwnProperty(Ut)){if(!("channels"in jt[Ut]))throw new Error("missing channels property: "+Ut);if(!("labels"in jt[Ut]))throw new Error("missing channel labels property: "+Ut);if(jt[Ut].labels.length!==jt[Ut].channels)throw new Error("channel and label counts mismatch: "+Ut);var Nt=jt[Ut].channels,Lt=jt[Ut].labels;delete jt[Ut].channels,delete jt[Ut].labels,Object.defineProperty(jt[Ut],"channels",{value:Nt}),Object.defineProperty(jt[Ut],"labels",{value:Lt})}function Rt(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}jt.rgb.hsl=function(t){var n,e,r=t[0]/255,i=t[1]/255,s=t[2]/255,o=Math.min(r,i,s),a=Math.max(r,i,s),u=a-o;return a===o?n=0:r===a?n=(i-s)/u:i===a?n=2+(s-r)/u:s===a&&(n=4+(r-i)/u),(n=Math.min(60*n,360))<0&&(n+=360),e=(o+a)/2,[n,100*(a===o?0:e<=.5?u/(a+o):u/(2-a-o)),100*e]},jt.rgb.hsv=function(t){var n,e,r,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,l=Math.max(o,a,u),h=l-Math.min(o,a,u),c=function(t){return(l-t)/6/h+.5};return 0===h?i=s=0:(s=h/l,n=c(o),e=c(a),r=c(u),o===l?i=r-e:a===l?i=1/3+n-r:u===l&&(i=2/3+e-n),i<0?i+=1:i>1&&(i-=1)),[360*i,100*s,100*l]},jt.rgb.hwb=function(t){var n=t[0],e=t[1],r=t[2];return[jt.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(e,r))),100*(r=1-1/255*Math.max(n,Math.max(e,r)))]},jt.rgb.cmyk=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255;return[100*((1-e-(n=Math.min(1-e,1-r,1-i)))/(1-n)||0),100*((1-r-n)/(1-n)||0),100*((1-i-n)/(1-n)||0),100*n]},jt.rgb.keyword=function(t){var n=Dt[t];if(n)return n;var e,r=1/0;for(var i in Tt)if(Tt.hasOwnProperty(i)){var s=Rt(t,Tt[i]);s<r&&(r=s,e=i)}return e},jt.keyword.rgb=function(t){return Tt[t]},jt.rgb.xyz=function(t){var n=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*n+.7152*e+.0722*r),100*(.0193*n+.1192*e+.9505*r)]},jt.rgb.lab=function(t){var n=jt.rgb.xyz(t),e=n[0],r=n[1],i=n[2];return r/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},jt.hsl.rgb=function(t){var n,e,r,i,s,o=t[0]/360,a=t[1]/100,u=t[2]/100;if(0===a)return[s=255*u,s,s];n=2*u-(e=u<.5?u*(1+a):u+a-u*a),i=[0,0,0];for(var l=0;l<3;l++)(r=o+1/3*-(l-1))<0&&r++,r>1&&r--,s=6*r<1?n+6*(e-n)*r:2*r<1?e:3*r<2?n+(e-n)*(2/3-r)*6:n,i[l]=255*s;return i},jt.hsl.hsv=function(t){var n=t[0],e=t[1]/100,r=t[2]/100,i=e,s=Math.max(r,.01);return e*=(r*=2)<=1?r:2-r,i*=s<=1?s:2-s,[n,100*(0===r?2*i/(s+i):2*e/(r+e)),100*((r+e)/2)]},jt.hsv.rgb=function(t){var n=t[0]/60,e=t[1]/100,r=t[2]/100,i=Math.floor(n)%6,s=n-Math.floor(n),o=255*r*(1-e),a=255*r*(1-e*s),u=255*r*(1-e*(1-s));switch(r*=255,i){case 0:return[r,u,o];case 1:return[a,r,o];case 2:return[o,r,u];case 3:return[o,a,r];case 4:return[u,o,r];case 5:return[r,o,a]}},jt.hsv.hsl=function(t){var n,e,r,i=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return r=(2-s)*o,e=s*a,[i,100*(e=(e/=(n=(2-s)*a)<=1?n:2-n)||0),100*(r/=2)]},jt.hwb.rgb=function(t){var n,e,r,i,s,o,a,u=t[0]/360,l=t[1]/100,h=t[2]/100,c=l+h;switch(c>1&&(l/=c,h/=c),r=6*u-(n=Math.floor(6*u)),1&n&&(r=1-r),i=l+r*((e=1-h)-l),n){default:case 6:case 0:s=e,o=i,a=l;break;case 1:s=i,o=e,a=l;break;case 2:s=l,o=e,a=i;break;case 3:s=l,o=i,a=e;break;case 4:s=i,o=l,a=e;break;case 5:s=e,o=l,a=i}return[255*s,255*o,255*a]},jt.cmyk.rgb=function(t){var n=t[0]/100,e=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},jt.xyz.rgb=function(t){var n,e,r,i=t[0]/100,s=t[1]/100,o=t[2]/100;return e=-.9689*i+1.8758*s+.0415*o,r=.0557*i+-.204*s+1.057*o,n=(n=3.2406*i+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(n=Math.min(Math.max(0,n),1)),255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1))]},jt.xyz.lab=function(t){var n=t[0],e=t[1],r=t[2];return e/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(n-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},jt.lab.xyz=function(t){var n,e,r,i=t[0];n=t[1]/500+(e=(i+16)/116),r=e-t[2]/200;var s=Math.pow(e,3),o=Math.pow(n,3),a=Math.pow(r,3);return e=s>.008856?s:(e-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,r=a>.008856?a:(r-16/116)/7.787,[n*=95.047,e*=100,r*=108.883]},jt.lab.lch=function(t){var n,e=t[0],r=t[1],i=t[2];return(n=360*Math.atan2(i,r)/2/Math.PI)<0&&(n+=360),[e,Math.sqrt(r*r+i*i),n]},jt.lch.lab=function(t){var n,e=t[0],r=t[1];return n=t[2]/360*2*Math.PI,[e,r*Math.cos(n),r*Math.sin(n)]},jt.rgb.ansi16=function(t){var n=t[0],e=t[1],r=t[2],i=1 in arguments?arguments[1]:jt.rgb.hsv(t)[2];if(0===(i=Math.round(i/50)))return 30;var s=30+(Math.round(r/255)<<2|Math.round(e/255)<<1|Math.round(n/255));return 2===i&&(s+=60),s},jt.hsv.ansi16=function(t){return jt.rgb.ansi16(jt.hsv.rgb(t),t[2])},jt.rgb.ansi256=function(t){var n=t[0],e=t[1],r=t[2];return n===e&&e===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5)},jt.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 e=.5*(1+~~(t>50));return[(1&n)*e*255,(n>>1&1)*e*255,(n>>2&1)*e*255]},jt.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},jt.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},jt.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 e=n[0];3===n[0].length&&(e=e.split("").map((function(t){return t+t})).join(""));var r=parseInt(e,16);return[r>>16&255,r>>8&255,255&r]},jt.rgb.hcg=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255,s=Math.max(Math.max(e,r),i),o=Math.min(Math.min(e,r),i),a=s-o;return n=a<=0?0:s===e?(r-i)/a%6:s===r?2+(i-e)/a:4+(e-r)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},jt.hsl.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=1,i=0;return(r=e<.5?2*n*e:2*n*(1-e))<1&&(i=(e-.5*r)/(1-r)),[t[0],100*r,100*i]},jt.hsv.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=n*e,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.hcg.rgb=function(t){var n=t[0]/360,e=t[1]/100,r=t[2]/100;if(0===e)return[255*r,255*r,255*r];var i,s=[0,0,0],o=n%1*6,a=o%1,u=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=u,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]=u,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]=u}return i=(1-e)*r,[255*(e*s[0]+i),255*(e*s[1]+i),255*(e*s[2]+i)]},jt.hcg.hsv=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n),r=0;return e>0&&(r=n/e),[t[0],100*r,100*e]},jt.hcg.hsl=function(t){var n=t[1]/100,e=t[2]/100*(1-n)+.5*n,r=0;return e>0&&e<.5?r=n/(2*e):e>=.5&&e<1&&(r=n/(2*(1-e))),[t[0],100*r,100*e]},jt.hcg.hwb=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n);return[t[0],100*(e-n),100*(1-e)]},jt.hwb.hcg=function(t){var n=t[1]/100,e=1-t[2]/100,r=e-n,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},jt.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},jt.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},jt.gray.hsl=jt.gray.hsv=function(t){return[0,0,t[0]]},jt.gray.hwb=function(t){return[0,100,t[0]]},jt.gray.cmyk=function(t){return[0,0,0,t[0]]},jt.gray.lab=function(t){return[t[0],0,0]},jt.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),e=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(e.length)+e},jt.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var Vt=$t.exports,Ht=Vt;function qt(t){var n=function(){for(var t={},n=Object.keys(Ht),e=n.length,r=0;r<e;r++)t[n[r]]={distance:-1,parent:null};return t}(),e=[t];for(n[t].distance=0;e.length;)for(var r=e.pop(),i=Object.keys(Ht[r]),s=i.length,o=0;o<s;o++){var a=i[o],u=n[a];-1===u.distance&&(u.distance=n[r].distance+1,u.parent=r,e.unshift(a))}return n}function Gt(t,n){return function(e){return n(t(e))}}function Jt(t,n){for(var e=[n[t].parent,t],r=Ht[n[t].parent][t],i=n[t].parent;n[i].parent;)e.unshift(n[i].parent),r=Gt(Ht[n[i].parent][i],r),i=n[i].parent;return r.conversion=e,r}var Wt=Vt,Bt=function(t){for(var n=qt(t),e={},r=Object.keys(n),i=r.length,s=0;s<i;s++){var o=r[s];null!==n[o].parent&&(e[o]=Jt(o,n))}return e},Xt={};Object.keys(Wt).forEach((function(t){Xt[t]={},Object.defineProperty(Xt[t],"channels",{value:Wt[t].channels}),Object.defineProperty(Xt[t],"labels",{value:Wt[t].labels});var n=Bt(t);Object.keys(n).forEach((function(e){var r=n[e];Xt[t][e]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var e=t(n);if("object"==typeof e)for(var r=e.length,i=0;i<r;i++)e[i]=Math.round(e[i]);return e};return"conversion"in t&&(n.conversion=t.conversion),n}(r),Xt[t][e].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}(r)}))}));var Yt=It,Kt=Xt,Zt=[].slice,Qt=["keyword","gray","hex"],tn={};Object.keys(Kt).forEach((function(t){tn[Zt.call(Kt[t].labels).sort().join("")]=t}));var nn={};function en(t,n){if(!(this instanceof en))return new en(t,n);if(n&&n in Qt&&(n=null),n&&!(n in Kt))throw new Error("Unknown model: "+n);var e,r;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 i=Yt.get(t);if(null===i)throw new Error("Unable to parse color from string: "+t);this.model=i.model,r=Kt[this.model].channels,this.color=i.value.slice(0,r),this.valpha="number"==typeof i.value[r]?i.value[r]:1}else if(t.length){this.model=n||"rgb",r=Kt[this.model].channels;var s=Zt.call(t,0,r);this.color=on(s,r),this.valpha="number"==typeof t[r]?t[r]: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 tn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=tn[a];var u=Kt[this.model].labels,l=[];for(e=0;e<u.length;e++)l.push(t[u[e]]);this.color=on(l)}if(nn[this.model])for(r=Kt[this.model].channels,e=0;e<r;e++){var h=nn[this.model][e];h&&(this.color[e]=h(this.color[e]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function rn(t,n,e){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(nn[t]||(nn[t]=[]))[n]=e})),t=t[0],function(r){var i;return arguments.length?(e&&(r=e(r)),(i=this[t]()).color[n]=r,i):(i=this[t]().color[n],e&&(i=e(i)),i)}}function sn(t){return function(n){return Math.max(0,Math.min(t,n))}}function on(t,n){for(var e=0;e<n;e++)"number"!=typeof t[e]&&(t[e]=0);return t}en.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in Yt.to?this:this.rgb(),e=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return Yt.to[n.model](e)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),e=1===n.valpha?n.color:n.color.concat(this.valpha);return Yt.to.rgb.percent(e)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Kt[this.model].channels,e=Kt[this.model].labels,r=0;r<n;r++)t[e[r]]=this.color[r];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:rn("rgb",0,sn(255)),green:rn("rgb",1,sn(255)),blue:rn("rgb",2,sn(255)),hue:rn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:rn("hsl",1,sn(100)),lightness:rn("hsl",2,sn(100)),saturationv:rn("hsv",1,sn(100)),value:rn("hsv",2,sn(100)),chroma:rn("hcg",1,sn(100)),gray:rn("hcg",2,sn(100)),white:rn("hwb",1,sn(100)),wblack:rn("hwb",2,sn(100)),cyan:rn("cmyk",0,sn(100)),magenta:rn("cmyk",1,sn(100)),yellow:rn("cmyk",2,sn(100)),black:rn("cmyk",3,sn(100)),x:rn("xyz",0,sn(100)),y:rn("xyz",1,sn(100)),z:rn("xyz",2,sn(100)),l:rn("lab",0,sn(100)),a:rn("lab",1),b:rn("lab",2),keyword:function(t){return arguments.length?new en(t):Kt[this.model].keyword(this.color)},hex:function(t){return arguments.length?new en(t):Yt.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=[],e=0;e<t.length;e++){var r=t[e]/255;n[e]=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),e=t.luminosity();return n>e?(n+.05)/(e+.05):(e+.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(),e=n.color[0];return e=(e=(e+t)%360)<0?360+e:e,n.color[0]=e,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 e=t.rgb(),r=this.rgb(),i=void 0===n?.5:n,s=2*i-1,o=e.alpha()-r.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,u=1-a;return en.rgb(a*e.red()+u*r.red(),a*e.green()+u*r.green(),a*e.blue()+u*r.blue(),e.alpha()*i+r.alpha()*(1-i))}},Object.keys(Kt).forEach((function(t){if(-1===Qt.indexOf(t)){var n=Kt[t].channels;en.prototype[t]=function(){if(this.model===t)return new en(this);if(arguments.length)return new en(arguments,t);var e,r="number"==typeof arguments[n]?n:this.valpha;return new en((e=Kt[this.model][t].raw(this.color),Array.isArray(e)?e:[e]).concat(r),t)},en[t]=function(e){return"number"==typeof e&&(e=on(Zt.call(arguments),n)),new en(e,t)}}}));var an=ht(en);\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 un=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ln(t){return new Function("f",\`var p = (f && f.properties || {}); return ${q}cn(t)}\`)}function hn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":case"!has":return 2===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"in":case"!in":return t.length>=2&&("string"==typeof t[1]||t[1].property&&t[1].op);case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"none":case"any":case"all":for(const n of t.slice(1))if(!hn(n)&&"boolean"!=typeof n)return!1;return!0;case"contains":return!0;default:return!1}}function cn(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${q}"=="===n?dn(t[1],t[2],"===",!1):"!="===n?dn(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?dn(t[1],t[2],n,!0):"any"===n?yn(t.slice(1),"||"):"all"===n?yn(t.slice(1),"&&"):"none"===n?vn(yn(t.slice(1),"||")):"in"===n?mn(t[1],t.slice(2)):"!in"===n?vn(mn(t[1],t.slice(2))):"has"===n?gn(t[1]):"!has"===n?vn(gn(t[1])):"contains"===n?function(t,n,e){const r=fn(t);return void 0!==e?\`(${q}r} + '').indexOf("${q}n}") === ${q}e}\`:\`(${q}r} + '').indexOf("${q}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function fn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function dn(t,n,e,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,n,e,r){const i=t.property,s=t.op;let o=fn(i);return"length"!==s?(console.error(\`not support ${q}s} op\`),"false"):(o=\`((${q}o}+='').length)\`,pn(o,i,n,e,r))}(t,n,e,r);var i;return pn(fn(t),t,n,e,r)}function pn(t,n,e,r,i){const s="$type"===n?un.indexOf(e):JSON.stringify(e);return(i?\`typeof ${q}t}=== typeof ${q}s}&&\`:"")+t+r+s}function yn(t,n){return t.map(cn).join(n)}function mn(t,n){"$type"===t&&(n=n.map((t=>un.indexOf(t))));const e=JSON.stringify(n.sort(bn)),r=fn(t);return n.length<=200?\`${q}e}.indexOf(${q}r}) !== -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; }(${q}r}, ${q}e},0,${q}n.length-1})\`}function gn(t){return"$id"===t?'"id" in f':\`${q}JSON.stringify(t)} in p\`}function vn(t){return\`!(${q}t})\`}function bn(t,n){return t<n?-1:t>n?1:0}var wn={exports:{}};wn.exports=function(){function t(t,e,i,s,o){n(t,e,i||0,s||t.length-1,o||r)}function n(t,r,i,s,o){for(;s>i;){if(s-i>600){var a=s-i+1,u=r-i+1,l=Math.log(a),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(a-h)/a)*(u-a/2<0?-1:1);n(t,r,Math.max(i,Math.floor(r-u*h/a+c)),Math.min(s,Math.floor(r+(a-u)*h/a+c)),o)}var f=t[r],d=i,p=s;for(e(t,i,r),o(t[s],f)>0&&e(t,i,s);d<p;){for(e(t,d,p),d++,p--;o(t[d],f)<0;)d++;for(;o(t[p],f)>0;)p--}0===o(t[i],f)?e(t,i,p):e(t,++p,s),p<=r&&(i=p+1),r<=p&&(s=p-1)}}function e(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function r(t,n){return t<n?-1:t>n?1:0}return t}();var Mn=ht(wn.exports);class xn{constructor(t=[],n=Fn){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.U(t)}push(t){this.data.push(t),this.length++,this.L(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.U(0)),t}peek(){return this.data[0]}L(t){const{data:n,compare:e}=this,r=n[t];for(;t>0;){const i=t-1>>1,s=n[i];if(e(r,s)>=0)break;n[t]=s,t=i}n[t]=r}U(t){const{data:n,compare:e}=this,r=this.length>>1,i=n[t];for(;t<r;){let r=1+(t<<1),s=n[r];const o=r+1;if(o<this.length&&e(n[o],s)<0&&(r=o,s=n[o]),e(s,i)>=0)break;n[t]=s,t=r}n[t]=i}}function Fn(t,n){return t<n?-1:t>n?1:0}var kn="undefined"!=typeof Float32Array?Float32Array:Array;function An(){var t=new kn(3);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Pn(t,n,e){var r=new kn(3);return r[0]=t,r[1]=n,r[2]=e,r}function Sn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function _n(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function On(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function Cn(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 En(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function In(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}var $n=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function Tn(){var t=new kn(4);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Dn(t,n){var e=n[0]+n[4]+n[8],r=void 0;if(e>0)r=Math.sqrt(e+1),t[3]=.5*r,r=.5/r,t[0]=(n[5]-n[7])*r,t[1]=(n[6]-n[2])*r,t[2]=(n[1]-n[3])*r;else{var i=0;n[4]>n[0]&&(i=1),n[8]>n[3*i+i]&&(i=2);var s=(i+1)%3,o=(i+2)%3;r=Math.sqrt(n[3*i+i]-n[3*s+s]-n[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(n[3*s+o]-n[3*o+s])*r,t[s]=(n[3*s+i]+n[3*i+s])*r,t[o]=(n[3*o+i]+n[3*i+o])*r}return t}!function(){var t=An()}(),function(){var t,n=(t=new kn(4),kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var zn,jn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},Un=function(t,n){var e=n[0],r=n[1],i=n[2],s=n[3],o=e*e+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=e*o,t[1]=r*o,t[2]=i*o,t[3]=s*o),t};An(),Pn(1,0,0),Pn(0,1,0),Tn(),Tn(),zn=new kn(9),kn!=Float32Array&&(zn[1]=0,zn[2]=0,zn[3]=0,zn[5]=0,zn[6]=0,zn[7]=0),zn[0]=1,zn[4]=1,zn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Nn=8,Ln=[],Rn=[],Vn=[],Hn=[];function qn(t,n,e){const r=In(Rn,n,e),i=function(t,n,e,r,i,s,o,a,u,l){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t[4]=s,t[5]=o,t[6]=a,t[7]=u,t[8]=l,t}(Ln,e[0],e[1],e[2],...r,...n);t=Dn(t,i),t=function(t){return t[3]<0?jn(t,t,-1):t}(t=Un(t,t));const s=1/((1<<2*Nn-1)-1);if(t[3]<s){t[3]=s;const n=Math.sqrt(1-s*s);t[0]*=n,t[1]*=n,t[2]*=n}const o=e[3]>0?In(Vn,e,n):In(Vn,n,e);return En(In(Hn,e,n),o)<0&&jn(t,t,-1),t}const Gn=[];function Jn(t,n,e){const r=e||[];r.setLength&&r.setLength(t.length);const i=Gn;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const s=void 0===n.length?n:n.length;for(let e=0;e<s/3;e++)void 0===n.length?te(t,3*e,3*e+1,3*e+2,r,i):te(t,n[3*e],n[3*e+1],n[3*e+2],r,i);const o=r.getLength?r.getLength():r.length;for(let t=0;t<o;t+=3){const n=i[t/3];0!==n?(r[t]/=n,r[t+1]/=n,r[t+2]/=n):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}const Wn=[],Bn=[],Xn=[],Yn=[],Kn=[],Zn=[],Qn=[];function te(t,n,e,r,i,s){_n(Yn,t[3*n],t[3*n+1],t[3*n+2]),_n(Kn,t[3*e],t[3*e+1],t[3*e+2]),_n(Zn,t[3*r],t[3*r+1],t[3*r+2]);const o=$n(Wn,Zn,Kn),a=$n(Bn,Yn,Kn),u=In(Xn,o,a);Cn(Qn,u),i[3*n]=i[3*n]||0,i[3*e]=i[3*e]||0,i[3*r]=i[3*r]||0,i[3*n+1]=i[3*n+1]||0,i[3*e+1]=i[3*e+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*n+2]=i[3*n+2]||0,i[3*e+2]=i[3*e+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*n]+=Qn[0],i[3*e]+=Qn[0],i[3*r]+=Qn[0],i[3*n+1]+=Qn[1],i[3*e+1]+=Qn[1],i[3*r+1]+=Qn[1],i[3*n+2]+=Qn[2],i[3*e+2]+=Qn[2],i[3*r+2]+=Qn[2],s[n]+=1,s[e]+=1,s[r]+=1}\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 ne(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function ee(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}var re={exports:{}};function ie(t,n,e){e=e||2;var r,i,s,o,a,u,l,h=n&&n.length,c=h?n[0]*e:t.length,f=se(t,0,c,e,!0),d=[];if(!f||f.next===f.prev)return d;if(h&&(f=function(t,n,e,r){var i,s,o,a=[];for(i=0,s=n.length;i<s;i++)(o=se(t,n[i]*r,i<s-1?n[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),a.push(me(o));for(a.sort(fe),i=0;i<a.length;i++)e=de(a[i],e);return e}(t,n,f,e)),t.length>80*e){r=s=t[0],i=o=t[1];for(var p=e;p<c;p+=e)(a=t[p])<r&&(r=a),(u=t[p+1])<i&&(i=u),a>s&&(s=a),u>o&&(o=u);l=0!==(l=Math.max(s-r,o-i))?32767/l:0}return ae(f,d,e,r,i,l,0),d}function se(t,n,e,r,i){var s,o;if(i===Oe(t,n,e,r)>0)for(s=n;s<e;s+=r)o=Pe(s,t[s],t[s+1],o);else for(s=e-r;s>=n;s-=r)o=Pe(s,t[s],t[s+1],o);return o&&we(o,o.next)&&(Se(o),o=o.next),o}function oe(t,n){if(!t)return t;n||(n=t);var e,r=t;do{if(e=!1,r.steiner||!we(r,r.next)&&0!==be(r.prev,r,r.next))r=r.next;else{if(Se(r),(r=n=r.prev)===r.next)break;e=!0}}while(e||r!==n);return n}function ae(t,n,e,r,i,s,o){if(t){!o&&s&&function(t,n,e,r){var i=t;do{0===i.z&&(i.z=ye(i.x,i.y,n,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var n,e,r,i,s,o,a,u,l=1;do{for(e=t,t=null,s=null,o=0;e;){for(o++,r=e,a=0,n=0;n<l&&(a++,r=r.nextZ);n++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||e.z<=r.z)?(i=e,e=e.nextZ,a--):(i=r,r=r.nextZ,u--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;e=r}s.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,s);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,s?le(t,r,i,s):ue(t))n.push(a.i/e|0),n.push(t.i/e|0),n.push(u.i/e|0),Se(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?ae(t=he(oe(t),n,e),n,e,r,i,s,2):2===o&&ce(t,n,e,r,i,s):ae(oe(t),n,e,r,i,s,1);break}}}function ue(t){var n=t.prev,e=t,r=t.next;if(be(n,e,r)>=0)return!1;for(var i=n.x,s=e.x,o=r.x,a=n.y,u=e.y,l=r.y,h=i<s?i<o?i:o:s<o?s:o,c=a<u?a<l?a:l:u<l?u:l,f=i>s?i>o?i:o:s>o?s:o,d=a>u?a>l?a:l:u>l?u:l,p=r.next;p!==n;){if(p.x>=h&&p.x<=f&&p.y>=c&&p.y<=d&&ge(i,a,s,u,o,l,p.x,p.y)&&be(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function le(t,n,e,r){var i=t.prev,s=t,o=t.next;if(be(i,s,o)>=0)return!1;for(var a=i.x,u=s.x,l=o.x,h=i.y,c=s.y,f=o.y,d=a<u?a<l?a:l:u<l?u:l,p=h<c?h<f?h:f:c<f?c:f,y=a>u?a>l?a:l:u>l?u:l,m=h>c?h>f?h:f:c>f?c:f,g=ye(d,p,n,e,r),v=ye(y,m,n,e,r),b=t.prevZ,w=t.nextZ;b&&b.z>=g&&w&&w.z<=v;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;b&&b.z>=g;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=v;){if(w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function he(t,n,e){var r=t;do{var i=r.prev,s=r.next.next;!we(i,s)&&Me(i,r,r.next,s)&&ke(i,s)&&ke(s,i)&&(n.push(i.i/e|0),n.push(r.i/e|0),n.push(s.i/e|0),Se(r),Se(r.next),r=t=s),r=r.next}while(r!==t);return oe(r)}function ce(t,n,e,r,i,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ve(o,a)){var u=Ae(o,a);return o=oe(o,o.next),u=oe(u,u.next),ae(o,n,e,r,i,s,0),void ae(u,n,e,r,i,s,0)}a=a.next}o=o.next}while(o!==t)}function fe(t,n){return t.x-n.x}function de(t,n){var e=function(t,n){var e,r=n,i=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>o&&(o=a,e=r.x<r.next.x?r:r.next,a===i))return e}r=r.next}while(r!==n);if(!e)return null;var u,l=e,h=e.x,c=e.y,f=1/0;r=e;do{i>=r.x&&r.x>=h&&i!==r.x&&ge(s<c?i:o,s,h,c,s<c?o:i,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(i-r.x),ke(r,t)&&(u<f||u===f&&(r.x>e.x||r.x===e.x&&pe(e,r)))&&(e=r,f=u)),r=r.next}while(r!==l);return e}(t,n);if(!e)return n;var r=Ae(e,t);return oe(r,r.next),oe(e,e.next)}function pe(t,n){return be(t.prev,t,n.prev)<0&&be(n.next,t,t.next)<0}function ye(t,n,e,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*i|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function me(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function ge(t,n,e,r,i,s,o,a){return(i-o)*(n-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(e-o)*(n-a)&&(e-o)*(s-a)>=(i-o)*(r-a)}function ve(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&Me(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(ke(t,n)&&ke(n,t)&&function(t,n){var e=t,r=!1,i=(t.x+n.x)/2,s=(t.y+n.y)/2;do{e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next}while(e!==t);return r}(t,n)&&(be(t.prev,t,n.prev)||be(t,n.prev,n))||we(t,n)&&be(t.prev,t,t.next)>0&&be(n.prev,n,n.next)>0)}function be(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function we(t,n){return t.x===n.x&&t.y===n.y}function Me(t,n,e,r){var i=Fe(be(t,n,e)),s=Fe(be(t,n,r)),o=Fe(be(e,r,t)),a=Fe(be(e,r,n));return i!==s&&o!==a||(!(0!==i||!xe(t,e,n))||(!(0!==s||!xe(t,r,n))||(!(0!==o||!xe(e,t,r))||!(0!==a||!xe(e,n,r)))))}function xe(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Fe(t){return t>0?1:t<0?-1:0}function ke(t,n){return be(t.prev,t,t.next)<0?be(t,n,t.next)>=0&&be(t,t.prev,n)>=0:be(t,n,t.prev)<0||be(t,t.next,n)<0}function Ae(t,n){var e=new _e(t.i,t.x,t.y),r=new _e(n.i,n.x,n.y),i=t.next,s=n.prev;return t.next=n,n.prev=t,e.next=i,i.prev=e,r.next=e,e.prev=r,s.next=r,r.prev=s,r}function Pe(t,n,e,r){var i=new _e(t,n,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Se(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 _e(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Oe(t,n,e,r){for(var i=0,s=n,o=e-r;s<e;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}re.exports=ie,re.exports.default=ie,ie.deviation=function(t,n,e,r){var i=n&&n.length,s=i?n[0]*e:t.length,o=Math.abs(Oe(t,0,s,e));if(i)for(var a=0,u=n.length;a<u;a++){var l=n[a]*e,h=a<u-1?n[a+1]*e:t.length;o-=Math.abs(Oe(t,l,h,e))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,p=r[a+2]*e;c+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},ie.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},r=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var o=0;o<n;o++)e.vertices.push(t[i][s][o]);i>0&&(r+=t[i-1].length,e.holes.push(r))}return e};var Ce=ht(re.exports),Ee="undefined"!=typeof Float32Array?Float32Array:Array;function Ie(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function $e(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 Te(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}function De(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function ze(t,n,e,r,i){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t}function je(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function Ue(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t}function Ne(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]}function Le(t,n,e){return t[0]=n,t[1]=e,t}function Re(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.hypot(e,r)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t=function(){var t=new Ee(3);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}(),function(){var t=function(){var t=new Ee(4);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();var Ve=function(t){var n=t[0],e=t[1];return Math.hypot(n,e)};!function(){var t=function(){var t=new Ee(2);return Ee!=Float32Array&&(t[0]=0,t[1]=0),t}()}();\n/*!\n * @maptalks/vector-packer v0.96.0\n * LICENSE : UNLICENSED\n * (c) 2016-2024 maptalks.com\n */\nconst He={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function qe(t,n={}){var e=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)Ge(e,t.features[r],n,r);else Ge(e,"Feature"===t.type?t:{geometry:t},n);return e}function Ge(t,n,e,r){if(n.geometry&&n.geometry.geometry){var i=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(e.promoteId?a=n.properties[e.promoteId]:e.generateId&&(a=r||0),"Point"===s)Je(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Je(i[u],o);else if("LineString"===s)Be([i],o);else if("MultiLineString"===s){if(e.lineMetrics){for(u=0;u<i.length;u++)We(i[u],o=[]),t.push(Xe(a,"LineString",o,n.properties));return}Be(i,o)}else if("Polygon"===s)Be(i,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)Ge(t,{id:a,geometry:n.geometry.geometries[u],properties:n.properties},e,r);return}return void console.warn(\`Input data type(${q}s}) is not a valid GeoJSON geometry type.\`)}for(u=0;u<i.length;u++){var l=[];Be(i[u],l),o.push(l)}}t.push(Xe(a,s,o,n.properties))}}function Je(t,n){const e=new dt(t[0],t[1]);e.z=100*(t[2]||0),n.push([e])}function We(t,n){for(let e=0;e<t.length;e++){const r=new dt(t[e][0],t[e][1]);r.z=100*(t[e][2]||0),n.push(r)}}function Be(t,n,e,r){for(var i=0;i<t.length;i++){var s=[];We(t[i],s),n.push(s)}}function Xe(t,n,e,r){return{id:void 0===t?null:t,type:He[n],geometry:e,properties:r}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ye(t,{width:n,height:e},r,i){if(i){if(i.length!==n*e*r)throw new RangeError("mismatched image size")}else i=new Uint8Array(n*e*r);return t.width=n,t.height=e,t.data=i,t}function Ke(t,{width:n,height:e},r){if(n===t.width&&e===t.height)return;const i=Ye({},{width:n,height:e},r);Ze(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,e)},r),t.width=n,t.height=e,t.data=i.data}function Ze(t,n,e,r,i,s){if(0===i.width||0===i.height)return n;if(i.width>t.width||i.height>t.height||e.x>t.width-i.width||e.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>n.width||i.height>n.height||r.x>n.width-i.width||r.y>n.height-i.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 u=0;u<i.height;u++){const l=((e.y+u)*t.width+e.x)*s,h=((r.y+u)*n.width+r.x)*s;for(let t=0;t<i.width*s;t++)a[h+t]=o[l+t]}return n}class Qe{constructor(t,n){Ye(this,t,1,n)}resize(t){Ke(this,t,1)}clone(){return new Qe({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,1)}}class tr{constructor(t,n){Ye(this,t,4,n)}resize(t){Ke(this,t,4)}clone(){return new tr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,4)}}function nr(t){let n=0;for(let e,r,i=0,s=t.length,o=s-1;i<s;o=i++)if(e=t[i],r=t[o],void 0!==e.x){if(e.z||r.z)return 1;n+=(r.x-e.x)*(e.y+r.y)}else{if(e[2]||r[2])return 1;n+=(r[0]-e[0])*(e[1]+r[1])}return n}function er(t,n,e,r,i){const s=t[n*r],o=t[n*r+1],a=t[e*r],u=t[e*r+1];return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function rr(t,n,e){let r=e;return n&&t&&(r=+t[n]),isNaN(r)&&(r=e||0),100*r}function ir(t,n,e,r,i,s,o){n||0===n||(n=1);const a=rr(t.properties,e,r),u=a*n;let l=(s?100*s:0)||a;return i?l=rr(t.properties,i,s):o&&(l=a-rr(t.properties,o,s)),l*=n,{altitude:u,height:l}}function sr(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function or(t){return null==t}function ar(t,n,e){if(t===e||t===n)return t;const r=e-n;return((t-n)%r+r)%r+n}function ur(t,n){if(!n)return null;const e=new Map;for(let r=0;r<n.length;r++){const i=n[r],s=t[i];let o=e.get(s);o||(o=[],e.set(s,o)),o.push(i)}return e}function lr(t){return!(t&t-1)&&0!==t}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class hr{constructor(t,n,{pixelRatio:e}){this.paddedRect=t,this.pixelRatio=e||1,this.padding=n}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class cr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n=Object.keys(t).length,e={},r=new pt(0,0,{autoResize:!0}),i=[],s=n>1?1:0;for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2*s,h:r.data.height+2*s};i.push(o),e[n]=new hr(o,s,r)}if(r.pack(i,{inPlace:!0}),!lr(r.w)||!lr(r.h)){const t=fr(r.w),n=fr(r.h);r.resize(t,n)}const o=new tr({width:r.w,height:r.h});for(const n in t){const r=t[n],i=e[n].paddedRect;tr.copy(r.data,o,{x:0,y:0},{x:i.x+s,y:i.y+s},r.data)}this.image=o,this.positions=e}}function fr(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 dr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},e=new pt(0,0,{autoResize:!0}),r=[];for(const e in t){const i=t[e],s=n[e]={};for(const t in i){const n=i[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const e={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};r.push(e),s[t]={rect:e,metrics:n.metrics}}}e.pack(r,{inPlace:!0});const i=new Qe({width:e.w,height:e.h});for(const e in t){const r=t[e];for(const t in r){const s=r[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[e][t].rect;Qe.copy(s.bitmap,i,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=i,this.positions=n}}function pr(t){return t<65536?Uint16Array:Uint32Array}function yr(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function mr(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function gr(t,n){const e=t.getLength?t.getLength():t.length;if(t instanceof n)return t.slice(0,e);const r=new n(e);t=t.R||t;for(let n=0;n<e;n++)r[n]=t[n]||0;return r}function vr(t){const n=t.type,e=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Je(t.geometry[n],e);else if(2===n)Be(t.geometry,e);else if(3===n)Be(t.geometry,e);else if(5===n)Be(t.geometry,e);else if(6===n)for(let n=0;n<t.geometry.length;n++){const r=[];Be(t.geometry[n],r),e.push(r)}return t.geometry=e,t}function br(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];for(const n in e)t[n]=e[n]}return t}function wr(t){return null==t}function Mr(t){return"number"==typeof t&&!isNaN(t)}function xr(t){return"object"==typeof t&&!!t}function Fr(t){return!wr(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function kr(t){return!wr(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}const Ar=Object.prototype.hasOwnProperty;function Pr(t,n){return Ar.call(t,n)}const Sr=Math.PI/180;function _r(t){return t&&y(t)&&t.property}function Or(t){const{verticalCentimeterToPoint:n,tileRatio:e}=t;return n*e}function Cr(t){return"centimeter"===t||"cm"===t?1:"millimeter"===t||"mm"===t?.1:100}const Er={};function Ir(t,n){if(!Array.isArray(n)){if(n&&void 0!==n.r&&void 0!==n.g&&void 0!==n.b)return t[0]=255*n.r,t[1]=255*n.g,t[2]=255*n.b,t[3]=void 0!==n.a?255*n.a:255,t;n=Er[n]=Er[n]||an(n).unitArray()}for(let e=0;e<n.length;e++)t[e]=255*n[e];return 3===n.length&&(t[3]=255),t}const $r={textFill:1,textSize:1,textOpacity:1,textDx:1,textDy:1,markerWidth:1,markerHeight:1,markerOpacity:1,markerDx:1,markerDy:1,lineWidth:1,lineColor:1,lineOpacity:1,polygonFill:1,polygonOpacity:1,polygonPatternFileWidth:1,polygonPatternFileOrigin:1,rotationX:1,rotationY:1,rotationZ:1,scaleX:1,scaleY:1,scaleZ:1,translationX:1,translationY:1,translationZ:1},Tr={textName:1,markerTextFitPadding:1,markerTextFit:1,lineGradientProperty:1};var Dr=Object.freeze({__proto__:null,checkIfIdentityZoomDependent:function(t,n,e){if(Array.isArray(e)||(e=Object.values(e)),!e||!e.length)return!1;if(!$r[t])return!1;for(let t=0;t<e.length;t++){const r=e[t]&&(e[t].feature||e[t]);if(!r)continue;const i=r.properties&&r.properties[n];if(i&&y(i)&&!m(i).isZoomConstant)return!0}return!1},checkIfZoomFnTypeSymbol:function(t){return!!$r[t]||!!Tr[t]},evaluate:function(t,n,e){return kr(t)?t(void 0!==e?e:null,n):t},extend:br,getAltitudeToLocal:Or,getTubeSizeScale:Cr,hasOwn:Pr,isFnTypeSymbol:_r,isFunction:kr,isInteger:function(t){return(0|t)===t},isNil:wr,isNumber:Mr,isObject:xr,isString:Fr,join:function(t,n){return t.join?t.join(n||","):Array.prototype.join.call(t,n||",")},normalizeColor:Ir,now:function(){return Date.now()},toDegree:function(t){return t/Sr},toRadian:function(t){return t*Sr}});class zr{constructor(t,n,e,r){this.feature=t,this.symbol=n,this.fnTypes=e,this.options=r}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.V(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.V(t,n)}V(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}function jr(t,n,e,r){const i=Math.abs(r)>>15,s=i>>1,o=i%2;let a=r%Math.pow(2,15);const u=n+(s<<14)*Math.sign(n),l=e+(o<<14)*Math.sign(e);return t[0]=u,t[1]=l,a=Math.round(a),t[2]=0===a?r<0?-1:0:a,t}const Ur=Math.pow(2,14),Nr=Math.pow(2,15);\n/*!\n * a compact version of mapbox-gl-style-spec\n * based on mapbox-gl-style-spec@13.28.0\n * https://github.com/mapbox/mapbox-gl-js/tree/main/src/style-spec\n * LICENSE : ISC\n */var Lr,Rr,Vr="undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self?self:{},Hr={exports:{}};function qr(t,...n){for(const e of n)for(const n in e)t[n]=e[n];return t}\n/*! https://mths.be/punycode v1.3.2 by @mathias */Lr=Hr,Rr=Hr.exports,function(t){var n=Rr&&!Rr.nodeType&&Rr,e=Lr&&!Lr.nodeType&&Lr,r="object"==typeof Vr&&Vr;r.global!==r&&r.window!==r&&r.self!==r||(t=r);var i,s,o=2147483647,a=36,u=26,l=38,h=700,c=/^xn--/,f=/[^\\x20-\\x7E]/,d=/[\\x2E\\u3002\\uFF0E\\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=a-1,m=Math.floor,g=String.fromCharCode;function v(t){throw RangeError(p[t])}function b(t,n){for(var e=t.length,r=[];e--;)r[e]=n(t[e]);return r}function w(t,n){var e=t.split("@"),r="";return e.length>1&&(r=e[0]+"@",t=e[1]),r+b((t=t.replace(d,".")).split("."),n).join(".")}function M(t){for(var n,e,r=[],i=0,s=t.length;i<s;)(n=t.charCodeAt(i++))>=55296&&n<=56319&&i<s?56320==(64512&(e=t.charCodeAt(i++)))?r.push(((1023&n)<<10)+(1023&e)+65536):(r.push(n),i--):r.push(n);return r}function x(t){return b(t,(function(t){var n="";return t>65535&&(n+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),n+g(t)})).join("")}function F(t,n){return t+22+75*(t<26)-((0!=n)<<5)}function k(t,n,e){var r=0;for(t=e?m(t/h):t>>1,t+=m(t/n);t>y*u>>1;r+=a)t=m(t/y);return m(r+(y+1)*t/(t+l))}function A(t){var n,e,r,i,s,l,h,c,f,d,p,y=[],g=t.length,b=0,w=128,M=72;for((e=t.lastIndexOf("-"))<0&&(e=0),r=0;r<e;++r)t.charCodeAt(r)>=128&&v("not-basic"),y.push(t.charCodeAt(r));for(i=e>0?e+1:0;i<g;){for(s=b,l=1,h=a;i>=g&&v("invalid-input"),((c=(p=t.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:a)>=a||c>m((o-b)/l))&&v("overflow"),b+=c*l,!(c<(f=h<=M?1:h>=M+u?u:h-M));h+=a)l>m(o/(d=a-f))&&v("overflow"),l*=d;M=k(b-s,n=y.length+1,0==s),m(b/n)>o-w&&v("overflow"),w+=m(b/n),b%=n,y.splice(b++,0,w)}return x(y)}function P(t){var n,e,r,i,s,l,h,c,f,d,p,y,b,w,x,A=[];for(y=(t=M(t)).length,n=128,e=0,s=72,l=0;l<y;++l)(p=t[l])<128&&A.push(g(p));for(r=i=A.length,i&&A.push("-");r<y;){for(h=o,l=0;l<y;++l)(p=t[l])>=n&&p<h&&(h=p);for(h-n>m((o-e)/(b=r+1))&&v("overflow"),e+=(h-n)*b,n=h,l=0;l<y;++l)if((p=t[l])<n&&++e>o&&v("overflow"),p==n){for(c=e,f=a;!(c<(d=f<=s?1:f>=s+u?u:f-s));f+=a)A.push(g(F(d+(x=c-d)%(w=a-d),0))),c=m(x/w);A.push(g(F(c,0))),s=k(e,b,r==i),e=0,++r}++e,++n}return A.join("")}if(i={version:"1.3.2",ucs2:{decode:M,encode:x},decode:A,encode:P,toASCII:function(t){return w(t,(function(t){return f.test(t)?"xn--"+P(t):t}))},toUnicode:function(t){return w(t,(function(t){return c.test(t)?A(t.slice(4).toLowerCase()):t}))}},n&&e)if(Lr.exports==n)e.exports=i;else for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);else t.punycode=i}(Vr);class Gr extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}var Jr=Gr;class Wr{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[t,e]of n)this.bindings[t]=e}concat(t){return new Wr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(\`${q}t} not found in scope.\`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}var Br=Wr;const Xr={kind:"null"},Yr={kind:"number"},Kr={kind:"string"},Zr={kind:"boolean"},Qr={kind:"color"},ti={kind:"object"},ni={kind:"value"},ei={kind:"collator"},ri={kind:"formatted"},ii={kind:"resolvedImage"};function si(t,n){return{kind:"array",itemType:t,N:n}}function oi(t){if("array"===t.kind){const n=oi(t.itemType);return"number"==typeof t.N?\`array<${q}n}, ${q}t.N}>\`:"value"===t.itemType.kind?"array":\`array<${q}n}>\`}return t.kind}const ai=[Xr,Yr,Kr,Zr,Qr,ri,ti,si(ni),ii];function ui(t,n){if("error"===n.kind)return null;if("array"===t.kind){if("array"===n.kind&&(0===n.N&&"value"===n.itemType.kind||!ui(t.itemType,n.itemType))&&("number"!=typeof t.N||t.N===n.N))return null}else{if(t.kind===n.kind)return null;if("value"===t.kind)for(const t of ai)if(!ui(t,n))return null}return\`Expected ${q}oi(t)} but found ${q}oi(n)} instead.\`}function li(t,n){return n.some((n=>n.kind===t.kind))}function hi(t,n){return n.some((n=>"null"===n?null===t:"array"===n?Array.isArray(t):"object"===n?t&&!Array.isArray(t)&&"object"==typeof t:n===typeof t))}var ci,fi={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function di(t){return(t=Math.round(t))<0?0:t>255?255:t}function pi(t){return di("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function yi(t){return function(t){return t<0?0:t>1?1:t}("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function mi(t,n,e){return e<0?e+=1:e>1&&(e-=1),6*e<1?t+(n-t)*e*6:2*e<1?n:3*e<2?t+(n-t)*(2/3-e)*6:t}try{ci={}.parseCSSColor=function(t){var n,e=t.replace(/ /g,"").toLowerCase();if(e in fi)return fi[e].slice();if("#"===e[0])return 4===e.length?(n=parseInt(e.substr(1),16))>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null:7===e.length&&(n=parseInt(e.substr(1),16))>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null;var r=e.indexOf("("),i=e.indexOf(")");if(-1!==r&&i+1===e.length){var s=e.substr(0,r),o=e.substr(r+1,i-(r+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=yi(o.pop());case"rgb":return 3!==o.length?null:[pi(o[0]),pi(o[1]),pi(o[2]),a];case"hsla":if(4!==o.length)return null;a=yi(o.pop());case"hsl":if(3!==o.length)return null;var u=(parseFloat(o[0])%360+360)%360/360,l=yi(o[1]),h=yi(o[2]),c=h<=.5?h*(l+1):h+l-h*l,f=2*h-c;return[di(255*mi(f,c,u+1/3)),di(255*mi(f,c,u)),di(255*mi(f,c,u-1/3)),a];default:return null}}return null}}catch(dt){}class gi{constructor(t,n,e,r=1){this.r=t,this.g=n,this.b=e,this.a=r}static parse(t){if(!t)return;if(t instanceof gi)return t;if("string"!=typeof t)return;const n=ci(t);return n?new gi(n[0]/255*n[3],n[1]/255*n[3],n[2]/255*n[3],n[3]):void 0}toString(){const[t,n,e,r]=this.toArray();return\`rgba(${q}Math.round(t)},${q}Math.round(n)},${q}Math.round(e)},${q}r})\`}toArray(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[255*t/r,255*n/r,255*e/r,r]}toArray01(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[t/r,n/r,e/r,r]}toArray01PremultipliedAlpha(){const{r:t,g:n,b:e,a:r}=this;return[t,n,e,r]}}gi.black=new gi(0,0,0,1),gi.white=new gi(1,1,1,1),gi.transparent=new gi(0,0,0,0),gi.red=new gi(1,0,0,1),gi.blue=new gi(0,0,1,1);var vi=gi;class bi{constructor(t,n,e){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=e,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class wi{constructor(t,n,e,r,i){this.text=t.normalize?t.normalize():t,this.image=n,this.scale=e,this.fontStack=r,this.textColor=i}}class Mi{constructor(t){this.sections=t}static fromString(t){return new Mi([new wi(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Mi?t:Mi.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const n of this.sections){if(n.image){t.push(["image",n.image.name]);continue}t.push(n.text);const e={};n.fontStack&&(e["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(e["font-scale"]=n.scale),n.textColor&&(e["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(e)}return t}}class xi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new xi({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Fi(t,n,e,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255&&"number"==typeof e&&e>=0&&e<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:\`Invalid rgba value [${q}[t,n,e,r].join(", ")}]: 'a' must be between 0 and 1.\`:\`Invalid rgba value [${q}("number"==typeof r?[t,n,e,r]:[t,n,e]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.\`}function ki(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof vi)return!0;if(t instanceof bi)return!0;if(t instanceof Mi)return!0;if(t instanceof xi)return!0;if(Array.isArray(t)){for(const n of t)if(!ki(n))return!1;return!0}if("object"==typeof t){for(const n in t)if(!ki(t[n]))return!1;return!0}return!1}function Ai(t){if(null===t)return Xr;if("string"==typeof t)return Kr;if("boolean"==typeof t)return Zr;if("number"==typeof t)return Yr;if(t instanceof vi)return Qr;if(t instanceof bi)return ei;if(t instanceof Mi)return ri;if(t instanceof xi)return ii;if(Array.isArray(t)){const n=t.length;let e;for(const n of t){const t=Ai(n);if(e){if(e===t)continue;e=ni;break}e=t}return si(e||ni,n)}return ti}function Pi(t){const n=typeof t;return null===t?"":"string"===n||"number"===n||"boolean"===n?String(t):t instanceof vi||t instanceof Mi||t instanceof xi?t.toString():JSON.stringify(t)}class Si{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(2!==t.length)return n.error(\`'literal' expression requires exactly one argument, but found ${q}t.length-1} instead.\`);if(!ki(t[1]))return n.error("invalid value");const e=t[1];let r=Ai(e);const i=n.expectedType;return"array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new Si(r,e)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof vi?["rgba"].concat(this.value.toArray()):this.value instanceof Mi?this.value.serialize():this.value}}var _i=Si,Oi=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Ci={string:Kr,number:Yr,boolean:Zr,object:ti};class Ei{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let e,r=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const e=t[1];if("string"!=typeof e||!(e in Ci)||"object"===e)return n.error('The item type argument of "array" must be one of string, number, boolean',1);i=Ci[e],r++}else i=ni;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);s=t[2],r++}e=si(i,s)}else e=Ci[i];const s=[];for(;r<t.length;r++){const e=n.parse(t[r],r,ni);if(!e)return null;s.push(e)}return new Ei(e,s)}evaluate(t){for(let n=0;n<this.args.length;n++){const e=this.args[n].evaluate(t);if(!ui(this.type,Ai(e)))return e;if(n===this.args.length-1)throw new Oi(\`Expected value to be of type ${q}oi(this.type)}, but found ${q}oi(Ai(e))} instead.\`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,n=[t.kind];if("array"===t.kind){const e=t.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){n.push(e.kind);const r=t.N;("number"==typeof r||this.args.length>1)&&n.push(r)}}return n.concat(this.args.map((t=>t.serialize())))}}var Ii=Ei;class $i{constructor(t){this.type=ri,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[1];if(!Array.isArray(e)&&"object"==typeof e)return n.error("First argument must be an image or text section.");const r=[];let i=!1;for(let e=1;e<=t.length-1;++e){const s=t[e];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=n.parse(s["font-scale"],1,Yr),!t))return null;let e=null;if(s["text-font"]&&(e=n.parse(s["text-font"],1,si(Kr)),!e))return null;let o=null;if(s["text-color"]&&(o=n.parse(s["text-color"],1,Qr),!o))return null;const a=r[r.length-1];a.scale=t,a.font=e,a.textColor=o}else{const s=n.parse(t[e],1,ni);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:s,scale:null,font:null,textColor:null})}}return new $i(r)}evaluate(t){return new Mi(this.sections.map((n=>{const e=n.content.evaluate(t);return Ai(e)===ii?new wi("",e,null,null,null):new wi(Pi(e),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null)})))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const n of this.sections){t.push(n.content.serialize());const e={};n.scale&&(e["font-scale"]=n.scale.serialize()),n.font&&(e["text-font"]=n.font.serialize()),n.textColor&&(e["text-color"]=n.textColor.serialize()),t.push(e)}return t}}class Ti{constructor(t){this.type=ii,this.input=t}static parse(t,n){if(2!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Kr);return e?new Ti(e):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),e=xi.fromString(n);return e&&t.availableImages&&(e.available=t.availableImages.indexOf(n)>-1),e}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Di={"to-boolean":Zr,"to-color":Qr,"to-number":Yr,"to-string":Kr};class zi{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[0];if(("to-boolean"===e||"to-string"===e)&&2!==t.length)return n.error("Expected one argument.");const r=Di[e],i=[];for(let e=1;e<t.length;e++){const r=n.parse(t[e],e,ni);if(!r)return null;i.push(r)}return new zi(r,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let n,e;for(const r of this.args){if(n=r.evaluate(t),e=null,n instanceof vi)return n;if("string"==typeof n){const e=t.parseColor(n);if(e)return e}else if(Array.isArray(n)&&(e=n.length<3||n.length>4?\`Invalid rbga value ${q}JSON.stringify(n)}: expected an array containing either three or four numeric values.\`:Fi(n[0],n[1],n[2],n[3]),!e))return new vi(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new Oi(e||\`Could not parse color from value '${q}"string"==typeof n?n:String(JSON.stringify(n))}'\`)}if("number"===this.type.kind){let n=null;for(const e of this.args){if(n=e.evaluate(t),null===n)return 0;const r=Number(n);if(!isNaN(r))return r}throw new Oi(\`Could not convert ${q}JSON.stringify(n)} to number.\`)}return"formatted"===this.type.kind?Mi.fromString(Pi(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?xi.fromString(Pi(this.args[0].evaluate(t))):Pi(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new $i([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Ti(this.args[0]).serialize();const t=[\`to-${q}this.type.kind}\`];return this.eachChild((n=>{t.push(n.serialize())})),t}}var ji=zi;const Ui=["Unknown","Point","LineString","Polygon"];var Ni=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.H={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ui[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,n=this.featureDistanceData.scale,{x:e,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(e*n-t[0])+this.featureDistanceData.bearing[1]*(r*n-t[1])}return 0}parseColor(t){let n=this.H[t];return n||(n=this.H[t]=vi.parse(t)),n}};class Li{constructor(t,n,e,r){this.name=t,this.type=n,this.q=e,this.args=r}evaluate(t){return this.q(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,n){const e=t[0],r=Li.definitions[e];if(!r)return n.error(\`Unknown expression "${q}e}". If you wanted a literal array, use ["literal", [...]].\`,0);const i=Array.isArray(r)?r[0]:r.type,s=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=s.filter((([n])=>!Array.isArray(n)||n.length===t.length-1));let a=null;for(const[r,s]of o){a=new ds(n.registry,n.path,null,n.scope);const o=[];let u=!1;for(let n=1;n<t.length;n++){const e=t[n],i=Array.isArray(r)?r[n-1]:r.type,s=a.parse(e,1+o.length,i);if(!s){u=!0;break}o.push(s)}if(!u)if(Array.isArray(r)&&r.length!==o.length)a.error(\`Expected ${q}r.length} arguments, but found ${q}o.length} instead.\`);else{for(let t=0;t<o.length;t++){const n=Array.isArray(r)?r[t]:r.type,e=o[t];a.concat(t+1).checkSubtype(n,e.type)}if(0===a.errors.length)return new Li(e,i,s,o)}}if(1===o.length)n.errors.push(...a.errors);else{const e=(o.length?o:s).map((([t])=>{return n=t,Array.isArray(n)?\`(${q}n.map(oi).join(", ")})\`:\`(${q}oi(n.type)}...)\`;var n})).join(" | "),r=[];for(let e=1;e<t.length;e++){const i=n.parse(t[e],1+r.length);if(!i)return null;r.push(oi(i.type))}n.error(\`Expected arguments of type ${q}e}, but found (${q}r.join(", ")}) instead.\`)}return null}static register(t,n){Li.definitions=n;for(const e in n)t[e]=Li}}var Ri=Li;class Vi{constructor(t,n,e){this.type=ei,this.locale=e,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(2!==t.length)return n.error("Expected one argument.");const e=t[1];if("object"!=typeof e||Array.isArray(e))return n.error("Collator options argument must be an object.");const r=n.parse(void 0!==e["case-sensitive"]&&e["case-sensitive"],1,Zr);if(!r)return null;const i=n.parse(void 0!==e["diacritic-sensitive"]&&e["diacritic-sensitive"],1,Zr);if(!i)return null;let s=null;return e.locale&&(s=n.parse(e.locale,1,Kr),!s)?null:new Vi(r,i,s)}evaluate(t){return new bi(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Hi=8192;function qi(t,n){t[0]=Math.min(t[0],n[0]),t[1]=Math.min(t[1],n[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}function Gi(t,n){return!(t[0]<=n[0]||t[2]>=n[2]||t[1]<=n[1]||t[3]>=n[3])}function Ji(t,n){const e=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,n.z);return[Math.round(e*i*Hi),Math.round(r*i*Hi)]}function Wi(t,n,e){const r=t[0]-n[0],i=t[1]-n[1],s=t[0]-e[0],o=t[1]-e[1];return r*o-s*i==0&&r*s<=0&&i*o<=0}function Bi(t,n){let e=!1;for(let o=0,a=n.length;o<a;o++){const a=n[o];for(let n=0,o=a.length;n<o-1;n++){if(Wi(t,a[n],a[n+1]))return!1;(i=a[n])[1]>(r=t)[1]!=(s=a[n+1])[1]>r[1]&&r[0]<(s[0]-i[0])*(r[1]-i[1])/(s[1]-i[1])+i[0]&&(e=!e)}}var r,i,s;return e}function Xi(t,n){for(let e=0;e<n.length;e++)if(Bi(t,n[e]))return!0;return!1}function Yi(t,n,e,r){const i=r[0]-e[0],s=r[1]-e[1],o=(t[0]-e[0])*s-i*(t[1]-e[1]),a=(n[0]-e[0])*s-i*(n[1]-e[1]);return o>0&&a<0||o<0&&a>0}function Ki(t,n,e){for(const l of e)for(let e=0;e<l.length-1;++e)if(void 0,void 0,0!=(a=[(o=l[e+1])[0]-(s=l[e])[0],o[1]-s[1]])[0]*(u=[(i=n)[0]-(r=t)[0],i[1]-r[1]])[1]-a[1]*u[0]&&Yi(r,i,s,o)&&Yi(s,o,r,i))return!0;var r,i,s,o,a,u;return!1}function Zi(t,n){for(let e=0;e<t.length;++e)if(!Bi(t[e],n))return!1;for(let e=0;e<t.length-1;++e)if(Ki(t[e],t[e+1],n))return!1;return!0}function Qi(t,n){for(let e=0;e<n.length;e++)if(Zi(t,n[e]))return!0;return!1}function ts(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=[];for(let r=0;r<t[i].length;r++){const o=Ji(t[i][r],e);qi(n,o),s.push(o)}r.push(s)}return r}function ns(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=ts(t[i],n,e);r.push(s)}return r}function es(t,n,e,r){if(t[0]<e[0]||t[0]>e[2]){const n=.5*r;let i=t[0]-e[0]>n?-r:e[0]-t[0]>n?r:0;0===i&&(i=t[0]-e[2]>n?-r:e[2]-t[0]>n?r:0),t[0]+=i}qi(n,t)}function rs(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const r of t)for(const t of r){const r=[t.x+s[0],t.y+s[1]];es(r,n,e,i),o.push(r)}return o}function is(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const e of t){const t=[];for(const r of e){const e=[r.x+s[0],r.y+s[1]];qi(n,e),t.push(e)}o.push(t)}if(n[2]-n[0]<=i/2){(a=n)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const r of t)es(r,n,e,i)}var a;return o}class ss{constructor(t,n){this.type=Zr,this.geojson=t,this.geometries=n}static parse(t,n){if(2!==t.length)return n.error(\`'within' expression requires exactly one argument, but found ${q}t.length-1} instead.\`);if(ki(t[1])){const n=t[1];if("FeatureCollection"===n.type)for(let t=0;t<n.features.length;++t){const e=n.features[t].geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ss(n,n.features[t].geometry)}else if("Feature"===n.type){const t=n.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new ss(n,n.geometry)}else if("Polygon"===n.type||"MultiPolygon"===n.type)return new ss(n,n)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Bi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Xi(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Zi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Qi(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var os=ss;function as(t){if(t instanceof Ri){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof os)return!1;let n=!0;return t.eachChild((t=>{n&&!as(t)&&(n=!1)})),n}function us(t){if(t instanceof Ri&&"feature-state"===t.name)return!1;let n=!0;return t.eachChild((t=>{n&&!us(t)&&(n=!1)})),n}function ls(t,n){if(t instanceof Ri&&n.indexOf(t.name)>=0)return!1;let e=!0;return t.eachChild((t=>{e&&!ls(t,n)&&(e=!1)})),e}class hs{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(2!==t.length||"string"!=typeof t[1])return n.error("'var' expression requires exactly one string literal argument.");const e=t[1];return n.scope.has(e)?new hs(e,n.scope.get(e)):n.error(\`Unknown variable "${q}e}". Make sure "${q}e}" has been bound in an enclosing "let" expression before using it.\`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var cs=hs;class fs{constructor(t,n=[],e,r=new Br,i=[]){this.registry=t,this.path=n,this.key=n.map((t=>\`[${q}t}]\`)).join(""),this.scope=r,this.errors=i,this.expectedType=e}parse(t,n,e,r,i={}){return n?this.concat(n,e,r).G(t,i):this.G(t,i)}G(t,n){function e(t,n,e){return"assert"===e?new Ii(n,[t]):"coerce"===e?new ji(n,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(\`Expression name must be a string, but found ${q}typeof r} instead. If you wanted a literal array, use ["literal", [...]].\`,0),null;const i=this.registry[r];if(i){let r=i.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else r=e(r,t,n.typeAnnotation||"coerce");else r=e(r,t,n.typeAnnotation||"assert")}if(!(r instanceof _i)&&"resolvedImage"!==r.type.kind&&ps(r)){const n=new Ni;try{r=new _i(r.type,r.evaluate(n))}catch(t){return this.error(t.message),null}}return r}return this.error(\`Unknown expression "${q}r}". If you wanted a literal array, use ["literal", [...]].\`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':\`Expected an array, but found ${q}typeof t} instead.\`)}concat(t,n,e){const r="number"==typeof t?this.path.concat(t):this.path,i=e?this.scope.concat(e):this.scope;return new fs(this.registry,r,n||null,i,this.errors)}error(t,...n){const e=\`${q}this.key}${q}n.map((t=>\`[${q}t}]\`)).join("")}\`;this.errors.push(new Jr(e,t))}checkSubtype(t,n){const e=ui(t,n);return e&&this.error(e),e}}var ds=fs;function ps(t){if(t instanceof cs)return ps(t.boundExpression);if(t instanceof Ri&&"error"===t.name)return!1;if(t instanceof Vi)return!1;if(t instanceof os)return!1;const n=t instanceof ji||t instanceof Ii;let e=!0;return t.eachChild((t=>{e=n?e&&ps(t):e&&t instanceof _i})),!!e&&as(t)&&ls(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function ys(t,n){const e=t.length-1;let r,i,s=0,o=e,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=t[a],i=t[a+1],r<=n){if(a===e||n<i)return a;s=a+1}else{if(!(r>n))throw new Oi("Input is not a number.");o=a-1}return 0}class ms{constructor(t,n,e){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[t,n]of e)this.labels.push(t),this.outputs.push(n)}static parse(t,n){if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${q}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=[];let i=null;n.expectedType&&"value"!==n.expectedType.kind&&(i=n.expectedType);for(let e=1;e<t.length;e+=2){const s=1===e?-1/0:t[e],o=t[e+1],a=e,u=e+1;if("number"!=typeof s)return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=s)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const l=n.parse(o,u,i);if(!l)return null;i=i||l.type,r.push([s,l])}return new ms(i,e,r)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;return r>=n[i-1]?e[i-1].evaluate(t):e[ys(n,r)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let n=0;n<this.labels.length;n++)n>0&&t.push(this.labels[n]),t.push(this.outputs[n].serialize());return t}}var gs=ms,vs=bs;function bs(t,n,e,r){this.cx=3*t,this.bx=3*(e-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(r-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=e,this.p2y=r}function ws(t,n,e){return t*(1-e)+n*e}bs.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(void 0===n&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var e=t,r=0;r<8;r++){var i=this.sampleCurveX(e)-t;if(Math.abs(i)<n)return e;var s=this.sampleCurveDerivativeX(e);if(Math.abs(s)<1e-6)break;e-=i/s}var o=0,a=1;for(e=t,r=0;r<20&&(i=this.sampleCurveX(e),!(Math.abs(i-t)<n));r++)t>i?o=e:a=e,e=.5*(a-o)+o;return e},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}};var Ms=Object.freeze({__proto__:null,number:ws,color:function(t,n,e){return new vi(ws(t.r,n.r,e),ws(t.g,n.g,e),ws(t.b,n.b,e),ws(t.a,n.a,e))},array:function(t,n,e){return t.map(((t,r)=>ws(t,n[r],e)))}});const xs=.95047,Fs=1.08883,ks=4/29,As=6/29,Ps=3*As*As,Ss=As*As*As,_s=Math.PI/180,Os=180/Math.PI;function Cs(t){return t>Ss?Math.pow(t,1/3):t/Ps+ks}function Es(t){return t>As?t*t*t:Ps*(t-ks)}function Is(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function $s(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ts(t){const n=$s(t.r),e=$s(t.g),r=$s(t.b),i=Cs((.4124564*n+.3575761*e+.1804375*r)/xs),s=Cs((.2126729*n+.7151522*e+.072175*r)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Cs((.0193339*n+.119192*e+.9503041*r)/Fs)),alpha:t.a}}function Ds(t){let n=(t.l+16)/116,e=isNaN(t.a)?n:n+t.a/500,r=isNaN(t.b)?n:n-t.b/200;return n=1*Es(n),e=xs*Es(e),r=Fs*Es(r),new vi(Is(3.2404542*e-1.5371385*n-.4985314*r),Is(-.969266*e+1.8760108*n+.041556*r),Is(.0556434*e-.2040259*n+1.0572252*r),t.alpha)}function zs(t,n,e){const r=n-t;return t+e*(r>180||r<-180?r-360*Math.round(r/360):r)}const js={forward:Ts,reverse:Ds,interpolate:function(t,n,e){return{l:ws(t.l,n.l,e),a:ws(t.a,n.a,e),b:ws(t.b,n.b,e),alpha:ws(t.alpha,n.alpha,e)}}},Us={forward:function(t){const{l:n,a:e,b:r}=Ts(t),i=Math.atan2(r,e)*Os;return{h:i<0?i+360:i,c:Math.sqrt(e*e+r*r),l:n,alpha:t.a}},reverse:function(t){const n=t.h*_s,e=t.c;return Ds({l:t.l,a:Math.cos(n)*e,b:Math.sin(n)*e,alpha:t.alpha})},interpolate:function(t,n,e){return{h:zs(t.h,n.h,e),c:ws(t.c,n.c,e),l:ws(t.l,n.l,e),alpha:ws(t.alpha,n.alpha,e)}}};var Ns=Object.freeze({__proto__:null,lab:js,hcl:Us});class Ls{constructor(t,n,e,r,i){this.type=t,this.operator=n,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(const[t,n]of i)this.labels.push(t),this.outputs.push(n)}static interpolationFactor(t,n,e,r){let i=0;if("exponential"===t.name)i=Rs(n,t.base,e,r);else if("linear"===t.name)i=Rs(n,1,e,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new vs(s[0],s[1],s[2],s[3]).solve(Rs(n,1,e,r))}return i}static parse(t,n){let[e,r,i,...s]=t;if(!Array.isArray(r)||0===r.length)return n.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return n.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return n.error(\`Unknown interpolation type ${q}String(r[0])}\`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${q}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(i=n.parse(i,2,Yr),!i)return null;const o=[];let a=null;"interpolate-hcl"===e||"interpolate-lab"===e?a=Qr:n.expectedType&&"value"!==n.expectedType.kind&&(a=n.expectedType);for(let t=0;t<s.length;t+=2){const e=s[t],r=s[t+1],i=t+3,u=t+4;if("number"!=typeof e)return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=e)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const l=n.parse(r,u,a);if(!l)return null;a=a||l.type,o.push([e,l])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Ls(a,e,r,i,o):n.error(\`Type ${q}oi(a)} is not interpolatable.\`)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;if(r>=n[i-1])return e[i-1].evaluate(t);const s=ys(n,r),o=Ls.interpolationFactor(this.interpolation,r,n[s],n[s+1]),a=e[s].evaluate(t),u=e[s+1].evaluate(t);return"interpolate"===this.operator?Ms[this.type.kind.toLowerCase()](a,u,o):"interpolate-hcl"===this.operator?Us.reverse(Us.interpolate(Us.forward(a),Us.forward(u),o)):js.reverse(js.interpolate(js.forward(a),js.forward(u),o))}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const n=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)n.push(this.labels[t],this.outputs[t].serialize());return n}}function Rs(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}var Vs=Ls;class Hs{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expectected at least one argument.");let e=null;const r=n.expectedType;r&&"value"!==r.kind&&(e=r);const i=[];for(const r of t.slice(1)){const t=n.parse(r,1+i.length,e,void 0,{typeAnnotation:"omit"});if(!t)return null;e=e||t.type,i.push(t)}const s=r&&i.some((t=>ui(r,t.type)));return new Hs(s?ni:e,i)}evaluate(t){let n,e=null,r=0;for(const i of this.args){if(r++,e=i.evaluate(t),e&&e instanceof xi&&!e.available&&(n||(n=e),e=null,r===this.args.length))return n;if(null!==e)break}return e}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var qs=Hs;class Gs{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found ${q}t.length-1} instead.\`);const e=[];for(let r=1;r<t.length-1;r+=2){const i=t[r];if("string"!=typeof i)return n.error(\`Expected string, but found ${q}typeof i} instead.\`,r);if(/[^a-zA-Z0-9_]/.test(i))return n.error("Variable names must contain only alphanumeric characters or '_'.",r);const s=n.parse(t[r+1],r+1);if(!s)return null;e.push([i,s])}const r=n.parse(t[t.length-1],t.length-1,n.expectedType,e);return r?new Gs(e,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[n,e]of this.bindings)t.push(n,e.serialize());return t.push(this.result.serialize()),t}}var Js=Gs;class Ws{constructor(t,n,e){this.type=t,this.index=n,this.input=e}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,Yr),r=n.parse(t[2],2,si(n.expectedType||ni));return e&&r?new Ws(r.type.itemType,e,r):null}evaluate(t){const n=this.index.evaluate(t),e=this.input.evaluate(t);if(n<0)throw new Oi(\`Array index out of bounds: ${q}n} < 0.\`);if(n>=e.length)throw new Oi(\`Array index out of bounds: ${q}n} > ${q}e.length-1}.\`);if(n!==Math.floor(n))throw new Oi(\`Array index must be an integer, but found ${q}n} instead.\`);return e[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Bs=Ws;class Xs{constructor(t,n){this.type=Zr,this.needle=t,this.haystack=n}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);return e&&r?li(e.type,[Zr,Kr,Yr,Xr,ni])?new Xs(e,r):n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(e.type)} instead\`):null}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(null==e)return!1;if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${q}oi(Ai(e))} instead.\`);return e.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Ys=Xs;class Ks{constructor(t,n,e){this.type=Yr,this.needle=t,this.haystack=n,this.fromIndex=e}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);if(!e||!r)return null;if(!li(e.type,[Zr,Kr,Yr,Xr,ni]))return n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new Ks(e,r,i):null}return new Ks(e,r)}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${q}oi(Ai(e))} instead.\`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return e.indexOf(n,r)}return e.indexOf(n)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Zs=Ks;class Qs{constructor(t,n,e,r,i,s){this.inputType=t,this.type=n,this.input=e,this.cases=r,this.outputs=i,this.otherwise=s}static parse(t,n){if(t.length<5)return n.error(\`Expected at least 4 arguments, but found only ${q}t.length-1}.\`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let e,r;n.expectedType&&"value"!==n.expectedType.kind&&(r=n.expectedType);const i={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const u=t[o+1];Array.isArray(a)||(a=[a]);const l=n.concat(o);if(0===a.length)return l.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return l.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return l.error(\`Branch labels must be integers no larger than ${q}Number.MAX_SAFE_INTEGER}.\`);if("number"==typeof t&&Math.floor(t)!==t)return l.error("Numeric branch labels must be integer values.");if(e){if(l.checkSubtype(e,Ai(t)))return null}else e=Ai(t);if(void 0!==i[String(t)])return l.error("Branch labels must be unique.");i[String(t)]=s.length}const h=n.parse(u,o,r);if(!h)return null;r=r||h.type,s.push(h)}const o=n.parse(t[1],1,ni);if(!o)return null;const a=n.parse(t[t.length-1],t.length-1,r);return a?"value"!==o.type.kind&&n.concat(1).checkSubtype(e,o.type)?null:new Qs(e,r,o,i,s,a):null}evaluate(t){const n=this.input.evaluate(t);return(Ai(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],n=Object.keys(this.cases).sort(),e=[],r={};for(const t of n){const n=r[this.cases[t]];void 0===n?(r[this.cases[t]]=e.length,e.push([this.cases[t],[t]])):e[n][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[n,r]of e)t.push(1===r.length?i(r[0]):r.map(i)),t.push(this.outputs[n].serialize());return t.push(this.otherwise.serialize()),t}}var to=Qs;class no{constructor(t,n,e){this.type=t,this.branches=n,this.otherwise=e}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found only ${q}t.length-1}.\`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let e;n.expectedType&&"value"!==n.expectedType.kind&&(e=n.expectedType);const r=[];for(let i=1;i<t.length-1;i+=2){const s=n.parse(t[i],i,Zr);if(!s)return null;const o=n.parse(t[i+1],i+1,e);if(!o)return null;r.push([s,o]),e=e||o.type}const i=n.parse(t[t.length-1],t.length-1,e);return i?new no(e,r,i):null}evaluate(t){for(const[n,e]of this.branches)if(n.evaluate(t))return e.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,e]of this.branches)t(n),t(e);t(this.otherwise)}outputDefined(){return this.branches.every((([t,n])=>n.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var eo=no;class ro{constructor(t,n,e,r){this.type=t,this.input=n,this.beginIndex=e,this.endIndex=r}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,Yr);if(!e||!r)return null;if(!li(e.type,[si(ni),Kr,ni]))return n.error(\`Expected first argument to be of type array or string, but found ${q}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new ro(e.type,e,r,i):null}return new ro(e.type,e,r)}evaluate(t){const n=this.input.evaluate(t),e=this.beginIndex.evaluate(t);if(!hi(n,["string","array"]))throw new Oi(\`Expected first argument to be of type array or string, but found ${q}oi(Ai(n))} instead.\`);if(this.endIndex){const r=this.endIndex.evaluate(t);return n.slice(e,r)}return n.slice(e)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var io=ro;function so(t,n){return"=="===t||"!="===t?"boolean"===n.kind||"string"===n.kind||"number"===n.kind||"null"===n.kind||"value"===n.kind:"string"===n.kind||"number"===n.kind||"value"===n.kind}function oo(t,n,e,r){return 0===r.compare(n,e)}function ao(t,n,e){const r="=="!==t&&"!="!==t;return class i{constructor(t,n,e){this.type=Zr,this.lhs=t,this.rhs=n,this.collator=e,this.hasUntypedArgument="value"===t.type.kind||"value"===n.type.kind}static parse(t,n){if(3!==t.length&&4!==t.length)return n.error("Expected two or three arguments.");const e=t[0];let s=n.parse(t[1],1,ni);if(!s)return null;if(!so(e,s.type))return n.concat(1).error(\`"${q}e}" comparisons are not supported for type '${q}oi(s.type)}'.\`);let o=n.parse(t[2],2,ni);if(!o)return null;if(!so(e,o.type))return n.concat(2).error(\`"${q}e}" comparisons are not supported for type '${q}oi(o.type)}'.\`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error(\`Cannot compare types '${q}oi(s.type)}' and '${q}oi(o.type)}'.\`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Ii(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Ii(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error("Cannot use collator to compare non-string types.");if(a=n.parse(t[3],3,ei),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const n=Ai(s),e=Ai(o);if(n.kind!==e.kind||"string"!==n.kind&&"number"!==n.kind)throw new Oi(\`Expected arguments for "${q}t}" to be (string, string) or (number, number), but found (${q}n.kind}, ${q}e.kind}) instead.\`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=Ai(s),e=Ai(o);if("string"!==t.kind||"string"!==e.kind)return n(i,s,o)}return this.collator?e(i,s,o,this.collator.evaluate(i)):n(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const n=[t];return this.eachChild((t=>{n.push(t.serialize())})),n}}}const uo=ao("==",(function(t,n,e){return n===e}),oo),lo=ao("!=",(function(t,n,e){return n!==e}),(function(t,n,e,r){return!oo(0,n,e,r)})),ho=ao("<",(function(t,n,e){return n<e}),(function(t,n,e,r){return r.compare(n,e)<0})),co=ao(">",(function(t,n,e){return n>e}),(function(t,n,e,r){return r.compare(n,e)>0})),fo=ao("<=",(function(t,n,e){return n<=e}),(function(t,n,e,r){return r.compare(n,e)<=0})),po=ao(">=",(function(t,n,e){return n>=e}),(function(t,n,e,r){return r.compare(n,e)>=0}));class yo{constructor(t,n,e,r,i,s){this.type=Kr,this.number=t,this.locale=n,this.currency=e,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,n){if(3!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return n.error("NumberFormat options argument must be an object.");let i=null;if(r.locale&&(i=n.parse(r.locale,1,Kr),!i))return null;let s=null;if(r.currency&&(s=n.parse(r.currency,1,Kr),!s))return null;let o=null;if(r.unit&&(o=n.parse(r.unit,1,Kr),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=n.parse(r["min-fraction-digits"],1,Yr),!a))return null;let u=null;return r["max-fraction-digits"]&&(u=n.parse(r["max-fraction-digits"],1,Yr),!u)?null:new yo(e,i,s,o,a,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class mo{constructor(t){this.type=Yr,this.input=t}static parse(t,n){if(2!==t.length)return n.error(\`Expected 1 argument, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1);return e?"array"!==e.type.kind&&"string"!==e.type.kind&&"value"!==e.type.kind?n.error(\`Expected argument of type string or array, but found ${q}oi(e.type)} instead.\`):new mo(e):null}evaluate(t){const n=this.input.evaluate(t);if("string"==typeof n)return n.length;if(Array.isArray(n))return n.length;throw new Oi(\`Expected value to be of type string or array, but found ${q}oi(Ai(n))} instead.\`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((n=>{t.push(n.serialize())})),t}}const go={"==":uo,"!=":lo,">":co,"<":ho,">=":po,"<=":fo,array:Ii,at:Bs,boolean:Ii,case:eo,coalesce:qs,collator:Vi,format:$i,image:Ti,in:Ys,"index-of":Zs,interpolate:Vs,"interpolate-hcl":Vs,"interpolate-lab":Vs,length:mo,let:Js,literal:_i,match:to,number:Ii,"number-format":yo,object:Ii,slice:io,step:gs,string:Ii,"to-boolean":ji,"to-color":ji,"to-number":ji,"to-string":ji,var:cs,within:os};function vo(t,[n,e,r,i]){n=n.evaluate(t),e=e.evaluate(t),r=r.evaluate(t);const s=i?i.evaluate(t):1,o=Fi(n,e,r,s);if(o)throw new Oi(o);return new vi(n/255*s,e/255*s,r/255*s,s)}function bo(t,n){return t in n}function wo(t,n){const e=n[t];return void 0===e?null:e}function Mo(t){return{type:t}}Ri.register(go,{error:[{kind:"error"},[Kr],(t,[n])=>{throw new Oi(n.evaluate(t))}],typeof:[Kr,[ni],(t,[n])=>oi(Ai(n.evaluate(t)))],"to-rgba":[si(Yr,4),[Qr],(t,[n])=>n.evaluate(t).toArray()],rgb:[Qr,[Yr,Yr,Yr],vo],rgba:[Qr,[Yr,Yr,Yr,Yr],vo],has:{type:Zr,overloads:[[[Kr],(t,[n])=>bo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>bo(n.evaluate(t),e.evaluate(t))]]},get:{type:ni,overloads:[[[Kr],(t,[n])=>wo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>wo(n.evaluate(t),e.evaluate(t))]]},"feature-state":[ni,[Kr],(t,[n])=>wo(n.evaluate(t),t.featureState||{})],properties:[ti,[],t=>t.properties()],"geometry-type":[Kr,[],t=>t.geometryType()],id:[ni,[],t=>t.id()],zoom:[Yr,[],t=>t.globals.zoom],pitch:[Yr,[],t=>t.globals.pitch||0],"distance-from-center":[Yr,[],t=>t.distanceFromCenter()],"heatmap-density":[Yr,[],t=>t.globals.heatmapDensity||0],"line-progress":[Yr,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Yr,[],t=>t.globals.skyRadialProgress||0],accumulated:[ni,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Yr,Mo(Yr),(t,n)=>{let e=0;for(const r of n)e+=r.evaluate(t);return e}],"*":[Yr,Mo(Yr),(t,n)=>{let e=1;for(const r of n)e*=r.evaluate(t);return e}],"-":{type:Yr,overloads:[[[Yr,Yr],(t,[n,e])=>n.evaluate(t)-e.evaluate(t)],[[Yr],(t,[n])=>-n.evaluate(t)]]},"/":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)/e.evaluate(t)],"%":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)%e.evaluate(t)],ln2:[Yr,[],()=>Math.LN2],pi:[Yr,[],()=>Math.PI],e:[Yr,[],()=>Math.E],"^":[Yr,[Yr,Yr],(t,[n,e])=>Math.pow(n.evaluate(t),e.evaluate(t))],sqrt:[Yr,[Yr],(t,[n])=>Math.sqrt(n.evaluate(t))],log10:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN10],ln:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))],log2:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN2],sin:[Yr,[Yr],(t,[n])=>Math.sin(n.evaluate(t))],cos:[Yr,[Yr],(t,[n])=>Math.cos(n.evaluate(t))],tan:[Yr,[Yr],(t,[n])=>Math.tan(n.evaluate(t))],asin:[Yr,[Yr],(t,[n])=>Math.asin(n.evaluate(t))],acos:[Yr,[Yr],(t,[n])=>Math.acos(n.evaluate(t))],atan:[Yr,[Yr],(t,[n])=>Math.atan(n.evaluate(t))],min:[Yr,Mo(Yr),(t,n)=>Math.min(...n.map((n=>n.evaluate(t))))],max:[Yr,Mo(Yr),(t,n)=>Math.max(...n.map((n=>n.evaluate(t))))],abs:[Yr,[Yr],(t,[n])=>Math.abs(n.evaluate(t))],round:[Yr,[Yr],(t,[n])=>{const e=n.evaluate(t);return e<0?-Math.round(-e):Math.round(e)}],floor:[Yr,[Yr],(t,[n])=>Math.floor(n.evaluate(t))],ceil:[Yr,[Yr],(t,[n])=>Math.ceil(n.evaluate(t))],"filter-==":[Zr,[Kr,ni],(t,[n,e])=>t.properties()[n.value]===e.value],"filter-id-==":[Zr,[ni],(t,[n])=>t.id()===n.value],"filter-type-==":[Zr,[Kr],(t,[n])=>t.geometryType()===n.value],"filter-<":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<i}],"filter-id-<":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<r}],"filter->":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>i}],"filter-id->":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>r}],"filter-<=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<=r}],"filter->=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>=r}],"filter-has":[Zr,[ni],(t,[n])=>n.value in t.properties()],"filter-has-id":[Zr,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Zr,[si(Kr)],(t,[n])=>n.value.indexOf(t.geometryType())>=0],"filter-id-in":[Zr,[si(ni)],(t,[n])=>n.value.indexOf(t.id())>=0],"filter-in-small":[Zr,[Kr,si(ni)],(t,[n,e])=>e.value.indexOf(t.properties()[n.value])>=0],"filter-in-large":[Zr,[Kr,si(ni)],(t,[n,e])=>function(t,n,e,r){for(;e<=r;){const i=e+r>>1;if(n[i]===t)return!0;n[i]>t?r=i-1:e=i+1}return!1}(t.properties()[n.value],e.value,0,e.value.length-1)],all:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)&&e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(!e.evaluate(t))return!1;return!0}]]},any:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)||e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(e.evaluate(t))return!0;return!1}]]},"!":[Zr,[Zr],(t,[n])=>!n.evaluate(t)],"is-supported-script":[Zr,[Kr],(t,[n])=>{const e=t.globals&&t.globals.isSupportedScript;return!e||e(n.evaluate(t))}],upcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toUpperCase()],downcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toLowerCase()],concat:[Kr,Mo(ni),(t,n)=>n.map((n=>Pi(n.evaluate(t)))).join("")],"resolved-locale":[Kr,[ei],(t,[n])=>n.evaluate(t).resolvedLocale()]});var xo=go;function Fo(t){return{result:"success",value:t}}function ko(t){return{result:"error",value:t}}function Ao(t){return!!t.expression&&t.expression.interpolated}function Po(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function So(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _o(t){return t}function Oo(t,n){const e="color"===n.type,r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),s=t.type||(Ao(n)?"exponential":"interval");if(e&&((t=qr({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],vi.parse(t[1])]))),t.default=vi.parse(t.default?t.default:n.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Ns[t.colorSpace])throw new Error(\`Unknown color space: ${q}t.colorSpace}\`);let o,a,u;if("exponential"===s)o=$o;else if("interval"===s)o=Io;else if("categorical"===s){o=Eo,a=Object.create(null);for(const n of t.stops)a[n[0]]=n[1];u=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(\`Unknown function type "${q}s}"\`);o=To}if(r){const e={},r=[];for(let n=0;n<t.stops.length;n++){const i=t.stops[n],s=i[0].zoom;void 0===e[s]&&(e[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},r.push(s)),e[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of r)i.push([e[t].zoom,Oo(e[t],n)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Vs.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:e},r)=>$o({stops:i,base:t.base},n,e).evaluate(e,r)}}if(i){const e="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:Vs.interpolationFactor.bind(void 0,e),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:e})=>o(t,n,e,a,u)}}return{kind:"source",evaluate(e,r){const i=r&&r.properties?r.properties[t.property]:void 0;return void 0===i?Co(t.default,n.default):o(t,n,i,a,u)}}}function Co(t,n,e){return void 0!==t?t:void 0!==n?n:void 0!==e?e:void 0}function Eo(t,n,e,r,i){return Co(typeof e===i?r[e]:void 0,t.default,n.default)}function Io(t,n,e){if("number"!==Po(e))return Co(t.default,n.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[r-1][0])return t.stops[r-1][1];const i=ys(t.stops.map((t=>t[0])),e);return t.stops[i][1]}function $o(t,n,e){const r=void 0!==t.base?t.base:1;if("number"!==Po(e))return Co(t.default,n.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[i-1][0])return t.stops[i-1][1];const s=ys(t.stops.map((t=>t[0])),e),o=function(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}(e,r,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],u=t.stops[s+1][1];let l=Ms[n.type]||_o;if(t.colorSpace&&"rgb"!==t.colorSpace){const n=Ns[t.colorSpace];l=(t,e)=>n.reverse(n.interpolate(n.forward(t),n.forward(e),o))}return"function"==typeof a.evaluate?{evaluate(...t){const n=a.evaluate.apply(void 0,t),e=u.evaluate.apply(void 0,t);if(void 0!==n&&void 0!==e)return l(n,e,o)}}:l(a,u,o)}function To(t,n,e){return"color"===n.type?e=vi.parse(e):"formatted"===n.type?e=Mi.fromString(e.toString()):"resolvedImage"===n.type?e=xi.fromString(e.toString()):Po(e)===n.type||"enum"===n.type&&n.values[e]||(e=void 0),Co(e,t.default,n.default)}class Do{constructor(t,n){this.expression=t,this.J={},this.W=new Ni,this.B=n?function(t){return"color"===t.type&&(So(t.default)||Array.isArray(t.default))?new vi(0,0,0,0):"color"===t.type?vi.parse(t.default)||null:void 0===t.default?null:t.default}(n):null,this.X=n&&"enum"===n.type?n.values:null}evaluateWithoutErrorHandling(t,n,e,r,i,s,o,a){return this.W.globals=t,this.W.feature=n,this.W.featureState=e,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null,this.expression.evaluate(this.W)}evaluate(t,n,e,r,i,s,o,a){this.W.globals=t,this.W.feature=n||null,this.W.featureState=e||null,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s||null,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null;try{const t=this.expression.evaluate(this.W);if(null==t||"number"==typeof t&&t!=t)return this.B;if(this.X&&!(t in this.X))throw new Oi(\`Expected value to be one of ${q}Object.keys(this.X).map((t=>JSON.stringify(t))).join(", ")}, but found ${q}JSON.stringify(t)} instead.\`);return t}catch(t){return this.J[t.message]||(this.J[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this.B}}}function zo(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in xo}function jo(t,n){const e=new ds(xo,[],n?function(t){const n={color:Qr,string:Kr,number:Yr,enum:Kr,boolean:Zr,formatted:ri,resolvedImage:ii};return"array"===t.type?si(n[t.value]||ni,t.length):n[t.type]}(n):void 0),r=e.parse(t,void 0,void 0,void 0,n&&"string"===n.type?{typeAnnotation:"coerce"}:void 0);return r?Fo(new Do(r,n)):ko(e.errors)}class Uo{constructor(t,n){this.kind=t,this.Y=n,this.isStateDependent="constant"!==t&&!us(n.expression)}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}}class No{constructor(t,n,e,r){this.kind=t,this.zoomStops=e,this.Y=n,this.isStateDependent="camera"!==t&&!us(n.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}interpolationFactor(t,n,e){return this.interpolationType?Vs.interpolationFactor(this.interpolationType,t,n,e):0}}function Lo(t,n){if("error"===(t=jo(t,n)).result)return t;const e=t.value.expression,r=as(e);if(!r&&!function(t){return"data-driven"===t["property-type"]}(n))return ko([new Jr("","data expressions not supported")]);const i=ls(e,["zoom","pitch","distance-from-center"]);if(!i&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(n))return ko([new Jr("","zoom expressions not supported")]);const s=Vo(e);if(!s&&!i)return ko([new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Jr)return ko([s]);if(s instanceof Vs&&!Ao(n))return ko([new Jr("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Fo(new Uo(r?"constant":"source",t.value));const o=s instanceof Vs?s.interpolation:void 0;return Fo(new No(r?"camera":"composite",t.value,s.labels,o))}class Ro{constructor(t,n){this.K=t,this.Z=n,qr(this,Oo(this.K,this.Z))}static deserialize(t){return new Ro(t.K,t.Z)}static serialize(t){return{K:t.K,Z:t.Z}}}function Vo(t){let n=null;if(t instanceof Js)n=Vo(t.result);else if(t instanceof qs){for(const e of t.args)if(n=Vo(e),n)break}else(t instanceof gs||t instanceof Vs)&&t.input instanceof Ri&&"zoom"===t.input.name&&(n=t);return n instanceof Jr||t.eachChild((t=>{const e=Vo(t);e instanceof Jr?n=e:!n&&e?n=new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&e&&n!==e&&(n=new Jr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),n}function Ho(t){if(Array.isArray(t))return t.map(Ho);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const n={};for(const e in t)n[e]=Ho(t[e]);return n}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}function qo(t,n="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};const e=t;let r=!0;try{r=function(t){if(!Wo(t))return t;let n=Ho(t);return Jo(n),n=Go(n),n}(e)}catch(t){console.warn(\`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\\nand paste the contents of this message in the report.\\nThank you!\\nFilter Expression:\\n${q}JSON.stringify(e,null,2)}\\n \`)}const i=jo(r,null);let s=null;if("error"===i.result)throw new Error(i.value.map((t=>\`${q}t.key}: ${q}t.message}\`)).join(", "));s=(t,n,e)=>i.value.evaluate(t,n,{},e);let o=null,a=null;if(r!==e){const t=jo(e,null);if("error"===t.result)throw new Error(t.value.map((t=>\`${q}t.key}: ${q}t.message}\`)).join(", "));o=(n,e,r,i,s)=>t.value.evaluate(n,e,{},r,void 0,void 0,i,s),a=!as(t.value.expression)}return{filter:s,dynamicFilter:o||void 0,needGeometry:Xo(r),needFeature:!!a}}function Go(t){if(!Array.isArray(t))return t;const n=function(t){if(Bo.has(t[0]))for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return t}(t);return!0===n?n:n.map((t=>Go(t)))}function Jo(t){let n=!1;const e=[];if("case"===t[0]){for(let r=1;r<t.length-1;r+=2)n=n||Wo(t[r]),e.push(t[r+1]);e.push(t[t.length-1])}else if("match"===t[0]){n=n||Wo(t[1]);for(let n=2;n<t.length-1;n+=2)e.push(t[n+1]);e.push(t[t.length-1])}else if("step"===t[0]){n=n||Wo(t[1]);for(let n=1;n<t.length-1;n+=2)e.push(t[n+1])}n&&(t.length=0,t.push("any",...e));for(let n=1;n<t.length;n++)Jo(t[n])}function Wo(t){if(!Array.isArray(t))return!1;if(function(t){return"pitch"===t||"distance-from-center"===t}(t[0]))return!0;for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return!1}const Bo=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Xo(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let n=1;n<t.length;n++)if(Xo(t[n]))return!0;return!1}const Yo={StyleExpression:Do,isExpression:zo,isExpressionFilter:function t(n){if(!0===n||!1===n)return!0;if(!Array.isArray(n)||0===n.length)return!1;switch(n[0]){case"has":return n.length>=2&&"$id"!==n[1]&&"$type"!==n[1];case"in":return n.length>=3&&("string"!=typeof n[1]||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==n.length||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!t(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}},createExpression:jo,createPropertyExpression:Lo,normalizePropertyExpression:function(t,n){if(So(t))return new Ro(t,n);if(zo(t)){const e=Lo(t,n);if("error"===e.result)throw new Error(e.value.map((t=>\`${q}t.key}: ${q}t.message}\`)).join(", "));return e.value}{let e=t;return"string"==typeof t&&"color"===n.type&&(e=vi.parse(t)),{kind:"constant",evaluate:()=>e}}},ZoomConstantExpression:Uo,ZoomDependentExpression:No,StylePropertyFunction:Ro},{isExpression:Ko,createExpression:Zo}=Yo,Qo={};function ta(t){if(!Array.isArray(t))return ta([t]);const n=[];for(let e=0;e<t.length;e++){let r;r=!0===t[e].filter?function(){return!0}:na(t[e].filter),n.push(br({},t[e],{filter:r}))}return n}function na(t){if(!0===t)return function(){return!0};if(t&&t.condition){if("any"===t.type){const n=t.condition,e=[];for(let t=0;t<n.length;t++)e.push(na(n[t]));return(t,n)=>{for(let r=0;r<e.length;r++)if(e[r](t,n))return!0;return!1}}const n=na(t.condition);if(wr(t.layer))return n;const e=n=>n.layer===t.layer;return(t,r)=>e(t)&&n(t,r)}if(hn(t))return ln(t);{let n=qo(t);n=n&&n.filter;const e=(t,e)=>(Qo.zoom=e,n&&n(Qo,t));return e}}const ea={type:"number","property-type":"data-driven",expression:{parameters:["zoom","feature"]}};function ra(t,n){ea.type=n||"number";const e=Zo(t,ea);if("success"!==e.result)throw new Error(\`Invalid maplibre spec expression: ${q}JSON.stringify(t)} (${q}e.value})\`);return e.value}function ia(t){return Ko(t)}const sa={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};function oa(t){return sa[t]}const aa={markerPlacement:1,markerFile:1,mergeOnProperty:1,markerTextFit:1,markerType:1,markerHorizontalAlignment:1,markerVerticalAlignment:1,markerRotationAlignment:1,markerPitchAlignment:1,markerFillPatternFile:1,markerLinePatternFile:1,textName:1,textPlacement:1,textFaceName:1,textStyle:1,textHorizontalAlignment:1,textVerticalAlignment:1,textRotationAlignment:1,textPitchAlignment:1,lineJoin:1,lineCap:1,linePatternFile:1,polygonPatternFile:1},ua={lineDasharray:1,markerLineDasharray:1,uvScale:1,uvOffset:1};function la(t){return aa[t]?"string":oa(t)?"number":ua[t]?"array":"color"}var ha=Object.freeze({__proto__:null,compileFilter:na,compileStyle:function(t=[]){return ta(t=t.map((t=>{const n=br({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n})))},createExpression:ra,getExpressionType:la,isExpression:ia,isInterpolated:oa});const ca="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,fa=function(t){return class extends t{pushIn(...t){const n=t.length;for(let e=0;e<n;e++)this[this.currentIndex++]=t[e]}fill(t,n,e){super.fill(t,n,e),e>this.currentIndex&&(this.currentIndex=e)}set(t,n){t>=this.currentIndex&&(this.currentIndex=t+1),this[t]=n}getLength(){return this.currentIndex}setLength(t){this.currentIndex=t,super.length<t&&(super.length=t)}trySetLength(t){t>this.currentIndex&&this.setLength(t)}reset(){this.currentIndex=0}slice(t,n){const e=super.slice(t,n);return e.currentIndex=n-t,e}}},da=fa(Array),pa={get:function(t,n){return"length"===n?t.getLength():t[n]}};class ya extends Array{setLength(t){this.length=t,this.currentIndex=t}trySetLength(t){this.length=t,this.currentIndex=t}getLength(){return this.length}}let ma;class ga{static createTypedArray(t,n){return gr(t,n)}static getInstance(){return ma}static ensureCapacity(t,n){if(!t.BYTES_PER_ELEMENT)return t;if(t.length>=n)return t;const e=new t.constructor(n+Math.ceil(.5*n)),r=t.getLength();for(let n=0;n<r;n++)e[n]=t[n];return e.currentIndex=t.currentIndex,e}static getArray(t){let n;if(t){const e=fa(t);n=new e(1048576/e.BYTES_PER_ELEMENT)}else n=new da;return n.push=(...t)=>{n.pushIn(...t)},n}static getProxyArray(){const t=new da,n=new Proxy(t,pa);return n.push=(...n)=>{t.pushIn(...n)},n.R=t,n}constructor(){this.tt=[],this.nt=0,this.et=[],this.rt=0,this.it={}}getProxy(){if(!ca){const t=new ya;return t.currentIndex=0,t}const t=this.et[this.rt]=this.et[this.rt]||ga.getProxyArray();return t.reset(),this.rt++,t}get(t){if(!ca){const t=new ya;return t.currentIndex=0,t}if(t){const n=t.name;let e=this.it[n];e||(e=this.it[n]={arrays:[],index:0});const r=e.index,i=e.arrays[r]=e.arrays[r]||ga.getArray(t);return i.reset(),e.index++,i}const n=this.tt[this.nt]=this.tt[this.nt]||ga.getArray();return n.reset(),this.nt++,n}reset(){this.nt=0,this.rt=0;for(const t in this.it)this.it[t].index=0}}ma=new ga;const va="__fea_idx",ba=[],wa={},Ma={},xa={},Fa=[],ka=ga.getInstance(),Aa=Math.pow(2,17);class Pa{static isAtlasLoaded(t,n={}){const{iconAtlas:e}=n;return!!(!t||e&&e.positions[t])}static genFnTypes(t){const n={};for(const e in t)if(ia(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim(),s=la(e);n[r]=ra(t[e],s),n[i]=(t,e)=>{let i;wa.zoom=t,Ma.properties=e;try{i=n[r].evaluateWithoutErrorHandling(wa,Ma,xa,null,Fa)}catch(t){return null}return i}}else if(_r(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim();oa(e)?(n[r]=m(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?m(i)(t,e):i}):(n[r]=g(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?g(i)(t,e):i})}return n}constructor(t,n,e){this.options=e;const r=[];this.symbolDef=n,this.symbol=v(n,(()=>(r[0]=e.zoom,r))),this.styledVectors=[],this.properties={},this.st=e.fnTypes||Pa.genFnTypes(this.symbolDef),_r(this.symbolDef.visible)&&(this.ot=m(this.symbolDef.visible)),e.atlas&&(this.iconAtlas=e.atlas.iconAtlas,this.glyphAtlas=e.atlas.glyphAtlas),this.features=this.ut(t)}needAltitudeAttribute(){return this.options.forceAltitudeAttribute||this.maxPosZ>=Aa||this.options.positionType===Float32Array}getPositionFormat(){return this.needAltitudeAttribute()?[{type:Int16Array,width:2,name:"aPosition"},{type:Float32Array,width:1,name:"aAltitude"}]:[{type:Float32Array,width:3,name:"aPosition"}]}fillPosition(t,n,e,r){if(n<this.lt&&(this.lt=n),n>this.ht&&(this.ht=n),e<this.ct&&(this.ct=e),e>this.ft&&(this.ft=e),this.needAltitudeAttribute()){let i=t.aPosition.currentIndex;t.aPosition[i++]=n,t.aPosition[i++]=e,t.aPosition.currentIndex=i,i=t.aAltitude.currentIndex,t.aAltitude[i++]=r,t.aAltitude.currentIndex=i}else{jr(ba,n,e,r);let i=t.aPosition.currentIndex;t.aPosition[i++]=ba[0],t.aPosition[i++]=ba[1],t.aPosition[i++]=ba[2],t.aPosition.currentIndex=i}}ut(t){if(!t.length)return t;const n=(va+"").trim();let e,r=0,i=t[r];for(;!i.geometry;)r++,i=t[r];if(Array.isArray(i.geometry)&&i.properties){let n=i.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof dt&&(e=t)}if(!e)if(e=[],Array.isArray(i.geometry))for(let n=0;n<t.length;n++){const r=br({},t[n]);e.push(vr(r))}else for(let r=0;r<t.length;r++){const i=t[r],s=qe(i);for(let t=0;t<s.length;t++){const r=s[t];r[n]=i[n],e.push(r)}}if(this.maxPosZ=0,!this.options.forceAltitudeAttribute){const t="line"===this.symbolDef.textPlacement;let n=0,r=!1;const{textPitchAlignmentFn:i}=this.st;!i&&t&&"map"===this.symbolDef.textPitchAlignment&&(r=!0);for(let s=0;s<e.length;s++){const o=_a(e[s]&&e[s].geometry);if(o>n&&(n=o),t&&!r&&i&&e[s].properties){const t=i(null,e[s].properties);"map"===t&&(r=t)}}this.hasMapPitchAlign=r,this.maxPosZ=n}const s=this.options.order;if(s){const t=[];for(let n=0;n<s.length;n++)s[n]&&t.push(na(s[n]));e=e.sort(((n,e)=>{const r=t.length;let i=-1,s=-1;for(let o=0;o<r&&(t[o](n)&&(i=o),t[o](e)&&(s=o),!(i>=0&&i<r&&s>=0&&s<r));o++);return i-s}))}return e}load(t=1){const n=(va+"").trim(),e="_debug_info".trim(),r=this.st,i=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},u={zoom:this.options.zoom,isVector3D:!!this.options.center},l=[],h=v(this.symbolDef,(()=>(l[0]=u.zoom,l)));let c=0,f=s.length;const d=this.options.debugIndex;try{for(;c<f;c++){const t=s[c];if(!t||!t.geometry)continue;if(Mr(d)&&t[e].index!==d)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const l=this.createStyledVector(t,h,r,u,o,a);l&&l.feature.geometry&&(l.featureIdx=void 0===t[n]?c:t[n],this.count++,i.push(l))}}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(((e,r)=>{this.fetchAtlas(t,n,((t,n)=>{if(t)r(t);else{if(n){const{icons:t,glyphs:e}=n;if(t&&Object.keys(t).length){for(const n in t){const e=t[n],{width:r,height:i,data:s}=e.data;e.data=new tr({width:r,height:i},s)}this.iconAtlas=new cr(t)}if(e&&Object.keys(e).length){for(const t in e){const n=e[t];for(const t in n){const e=n[t],{width:r,height:i,data:s}=e.bitmap;e.bitmap=new Qe({width:r,height:i},s)}}this.glyphAtlas=new dr(e)}}e({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}}))}))}fetchAtlas(t,n,e){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,e):e()}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 e=n.buffers;delete n.buffers;const r={data:n,buffers:e};if(this.iconAtlas){const t=r.data.iconAtlas=Sa(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)e.push(t.glyphMap[n].data.data.buffer);e.push(r.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(r.data.glyphAtlas=Sa(this.glyphAtlas),e.push(r.data.glyphAtlas.image.data.buffer)),r}createStyledVector(t,n,e,r){return new zr(t,n,e,r)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.lt=this.ct=1/0,this.ht=this.ft=-1/0,this.maxAltitude=0,this.dynamicAttrs={};const e=this.data={};this.dt=ka,ka.reset();let r=this.elements=ka.get();const i=this.yt=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol),s=this.needAltitudeAttribute()?2:3;for(let t=0;t<i.length;t++)e[i[t].name]=ka.get(i[t].type);let o=ka.get(),a=0;const u=ka.get();let l=0,h=!1,c=!0;const f=new Set;for(let r=0,i=t.length;r<i;r++){if(!t[r].feature.geometry)continue;const i=Array.isArray(t[r])?t[r][0].feature.id:t[r].feature.id;c&&(void 0!==Ma.id?f&&(f.has(Ma.id)?c=!1:f.add(Ma.id)):c=!1),Mr(i)&&(Math.abs(i)>l&&(l=Math.abs(i)),i<0&&(h=!0));const d=this.data.aPosition.getLength();if(Array.isArray(t[r]))for(let e=0;e<t[r].length;e++)this.gt(t[r][e],n);else this.gt(t[r],n);const p=(e.aPosition.getLength()-d)/s;for(let n=0;n<p;n++)o.push(t[r].featureIdx),Mr(i)&&u.push(i);a=Math.max(a,t[r].featureIdx)}if(this.countOutOfAngle>0&&console.warn("text anchor along line is ignored as anchor's line angle is bigger than textMaxAngle."),this.hasElements()&&!r.getLength())return null;const d=this.options.center?Float32Array:mr(a);o=ga.createTypedArray(o,d),i[0].type=this.options.positionType?this.options.positionType:yr(this.maxPos);const p=this.options.center;if(p&&(p[0]||p[1])){const t=e.aPosition,n=t.getLength();for(let e=0;e<n;e+=s)t[e]-=p[0],t[e+1]-=p[1]}const y=function(t,n){const e={};for(let r=0;r<t.length;r++){const i=t[r],s=i.type,o=i.name;e[o]=s===Array?n[o]:gr(n[o],s)}return e}(i,e);y.aPickingId=o;const m=[];for(const t in y)m.push(y[t].buffer);const g=pr(this.maxIndex);r=ga.createTypedArray(r,g),m.push(r.buffer);const v={data:y,isIdUnique:c,is2D:0===this.maxPosZ,indices:this.hasElements()?r:null,positionSize:s,positionBounding:[this.lt,this.ct,this.ht,this.ft],buffers:m,symbolIndex:this.symbolDef.index||{index:0},dynamicAttributes:this.dynamicAttrs};if(this.vt&&(v.markerPlacement=this.vt),this.bt&&(v.textPlacement=this.bt),u.getLength()){const t=h?yr(l):mr(l);v.featureIds=ga.createTypedArray(u,t),m.push(v.featureIds.buffer)}else v.featureIds=[];return v.pickingIdIndiceMap=ur(o,v.indices),v}gt(t,n){this.ot&&!this.ot(this.options.zoom,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(t,n,e){this.maxIndex=Math.max(this.maxIndex,t,n,e);let r=this.elements.currentIndex;this.elements[r++]=t,this.elements[r++]=n,this.elements[r++]=e,this.elements.currentIndex=r}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:e,altitudeScale:r}=this.options;let i=rr(t,n,e);return r&&(i*=r),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(i)),i}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const e in t)if(Pr(t,e)){const{tl:r,displaySize:i}=t[e],s=Math.max(r[0],r[1],i[0]-1,i[1]-1);s>n&&(n=s)}return n}ensureDataCapacity(t,n){const e=this.yt;for(let r=0;r<e.length;r++){const i=this.data[e[r].name];if(!i)continue;const s=e[r].width*t,o=i.getLength();this.data[e[r].name]=ga.ensureCapacity(i,o+s*n)}}}function Sa(t){let n=t.positions,e=t.image&&t.image.format||"alpha";if(t instanceof cr){n={};for(const e in t.positions){const r=t.positions[e];n[e]={paddedRect:r.paddedRect,pixelRatio:r.pixelRatio,tl:r.tl,br:r.br,displaySize:r.displaySize}}e="rgba"}const r=t.image;return{image:{width:r.width,height:r.height,data:r.data,format:e},glyphMap:t.glyphMap,positions:n}}function _a(t){if(!t)return 0;let n=0;if(Array.isArray(t))for(let e=0;e<t.length;e++)if(Array.isArray(t[e])){const r=_a(t[e]);r>n&&(n=r)}else{const r=Math.abs(t[e].z||0);r>n&&(n=r)}else{const e=Math.abs(t.z||0);e>n&&(n=e)}return n}const Oa="___fn_in_stops";function Ca(t,n,e,r){const i="__fn_textSize".trim();let s=t.textSize;if(wr(n.textSize))return[16,16];t[i]&&(s=t[i]);const o=[];if(o[0]=kr(s)?s(r,e):s,y(o[0])){const n=o[0].wt=o[0].wt||JSON.stringify(o[0]);t[Oa]||(t[Oa]={}),t[Oa][n]||(t[Oa][n]=m(o[0])),o[0]=(0,t[Oa][n])(r,e)}return o[1]=o[0],o}function Ea(t){const n=t.stops;let e=-1/0;for(let t=0;t<n.length;t++){let r=n[t][1];xr(n[t][1])&&(r=Ea(n[t][1])),r>e&&(e=r)}return e}function Ia(t){return t||"Open Sans Regular"}const $a=/\\{[\\w-]+(?:\\|[\\w-]+)*\\}/g;function Ta(t,n){return Fr(t)?t.replace($a,(function(t){if(!n)return"";if((t=t.substring(1,t.length-1)).indexOf("|")>0){const e=t.split("|");for(let t=0;t<e.length;t++){const r=n[e[t]];if(!wr(r))return r}return""}const e=n[t];return wr(e)?"":Array.isArray(e)?e.join():e})):t}var Da=Object.freeze({__proto__:null,getSDFFont:Ia,resolveExpVarNames:function t(n,e){if(2!==e.length||"get"!==e[0])for(let r=0;r<e.length;r++)2===e[r].length&&"get"===e[r][0]?n.push(e[r][1]):Array.isArray(e[r])&&t(n,e[r]);else n.push(e[1])},resolveText:Ta,resolveVarNames:function(t){return t.match($a)}});const za={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function ja(t){return!(za.Arabic(t)||za["Arabic Supplement"](t)||za["Arabic Extended-A"](t)||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t))}function Ua(t){return!!(!(t<11904)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||za["CJK Symbols and Punctuation"](t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Halfwidth and Fullwidth Forms"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)||za["Vertical Forms"](t)||za["Yi Radicals"](t)||za["Yi Syllables"](t)))}function Na(t){return!!(746===t||747===t||!(t<4352)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||!(!za["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Hangul Compatibility Jamo"](t)||za["Hangul Jamo Extended-A"](t)||za["Hangul Jamo Extended-B"](t)||za["Hangul Jamo"](t)||za["Hangul Syllables"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za.Kanbun(t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)&&12540!==t||!(!za["Halfwidth and Fullwidth Forms"](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)||!(!za["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||za["Unified Canadian Aboriginal Syllabics"](t)||za["Unified Canadian Aboriginal Syllabics Extended"](t)||za["Vertical Forms"](t)||za["Yijing Hexagram Symbols"](t)||za["Yi Syllables"](t)||za["Yi Radicals"](t)))}function La(t){return!(Na(t)||function(t){return!!(za["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||za["General Punctuation"](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)||za["Letterlike Symbols"](t)||za["Number Forms"](t)||za["Miscellaneous Technical"](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)||za["Control Pictures"](t)&&9251!==t||za["Optical Character Recognition"](t)||za["Enclosed Alphanumerics"](t)||za["Geometric Shapes"](t)||za["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||za["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||za["CJK Symbols and Punctuation"](t)||za.Katakana(t)||za["Private Use Area"](t)||za["CJK Compatibility Forms"](t)||za["Small Form Variants"](t)||za["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Ra(t){return t>=1424&&t<=2303||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t)}const Va=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function Ha(t){for(const n of Va)if(t>=n[0]&&t<=n[1])return!0;return!1}const qa={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",Mt:"︳","\`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Ga=1,Ja=2;function Wa(t,n,e,r,i,s,o,a,u,l){let h=t.trim();l===Ja&&(h=function(t){let n="";const e=Array.from(t);for(let t=0;t<e.length;t++){const r=e[t+1].codePointAt(0)||null,i=e[t-1].codePointAt(0)||null;n+=r&&La(r)&&!qa[e[t+1]]||i&&La(i)&&!qa[e[t-1]]||!qa[e[t]]?e[t]:qa[e[t]]}return n}(h));const c=[],f={positionedGlyphs:c,text:h,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:l};let d;return d=function(t,n){const e=[];let r=0;for(let i=0;i<n.length;i++){const s=n[i];e.push(t.substring(r,s)),r=s}return r<t.length&&e.push(t.substring(r,t.length)),e}(h,function(t,n,e,r){if(!e)return[];if(!t)return[];const i=[],s=function(t,n,e,r){let i=0;for(let e=0;e<t.length;e++){const s=r[t.codePointAt(e)];s&&(i+=s.metrics.advance+n)}return i/Math.max(1,Math.ceil(i/e))}(t,n,e,r);let o=0;for(let e=0;e<t.length;e++){const a=t.codePointAt(e),u=r[a];u&&(u&&!Ba[a]&&(o+=u.metrics.advance+n),e<t.length-1&&(Xa[a]||Ua(a))&&i.push(Za(e+1,o,s,i,Ka(a,t.codePointAt(e+1)),!1)))}return Qa(Za(t.length,o,s,i,0,!0))}(h,o,e,n)),function(t,n,e,r,i,s,o,a,u,l){let h=0,c=0,f=0;const d=t.positionedGlyphs;for(let t=0;t<e.length;t++){let i=e[t];if(i=i.trim(),!i.length){c-=r;continue}const s=d.length;for(let t=0;t<i.length;t++){const e=i.codePointAt(t),r=n[e];r&&(Na(e)&&o!==Ga?(32!==e&&d.push({glyph:e,x:h,y:0,vertical:!0}),h+=u+a):(32!==e&&d.push({glyph:e,x:h,y:c,vertical:!1}),h+=r.metrics.advance+a))}d.length!==s&&(f=Math.max(h-a,f),nu(d,n,s,d.length-1,.5)),h=0,c-=r}const{horizontalAlign:p,verticalAlign:y}=tu(i,void 0);!function(t,n,e,r,i,s,o){const a=(.5-e)*i,u=-(-r*o+.5)*s;if(a||u)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=u}(d,0,p,y,f,r,e.length);const m=e.length*r;t.top+=-y*m,t.bottom=t.top+m,t.left+=-p*f,t.right=t.left+f}(f,n,d,r,i,0,l,o,u),!!c.length&&f}const Ba={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Xa={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 Ya(t,n,e,r){const i=Math.pow(t-n,2);return r?t<n?i/2:2*i:i+Math.abs(e)*e}function Ka(t,n){let e=0;return 10===t&&(e-=1e4),40!==t&&65288!==t||(e+=50),41!==n&&65289!==n||(e+=50),e}function Za(t,n,e,r,i,s){let o=null,a=Ya(n,e,i,s);for(let t=0;t<r.length;t++){const u=r[t],l=Ya(n-u.x,e,i,s)+u.badness;l<=a&&(o=u,a=l)}return{index:t,x:n,priorBreak:o,badness:a}}function Qa(t){return t?Qa(t.priorBreak).concat(t.index):[]}function tu(t,n){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=n?1:0;break;case"left":case"top-left":case"bottom-left":e=n?0:1}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=n?1:0;break;case"top":case"top-right":case"top-left":r=n?0:1}return{horizontalAlign:e,verticalAlign:r}}function nu(t,n,e,r,i){const s=n[t[r].glyph];if(s){const n=(t[r].x+s.metrics.advance)*i;if(!n)return;for(let i=e;i<=r;i++)t[i].x-=n}}function eu(t){if(!function(t){for(const n of t)if(Ra(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],e=[],r=[];let i=0,s=0,o=1,a=1;for(const u of t){const t=u.codePointAt(0);Ha(t)?(r.push(u),i++):(o=Ra(t)?-1:1,a!==o?(s=i,e.length&&(a>0&&e.reverse(),n.push(...e)),r.length&&(n.splice(s,0,...r),r.length=0),a=o,e.length=0):r.length&&(e.push(...r),r.length=0),e.push(u),i++)}return r.length&&e.push(...r),e.length&&(a>0&&e.reverse(),n.push(...e)),n.reverse().join("")}const ru=/\\{ *([\\w_]+) *\\}/g;class iu{constructor(t,n,e,r,i){this.feature=t,this.symbolDef=n,this.symbol=e,this.options=i,this.xt=this.Ft.bind(this),this.st=r}Ft(t,n){return this.feature.properties[n]||""}getShape(t,n){if(this.kt)return this.kt;const{textHorizontalAlignmentFn:e,textVerticalAlignmentFn:r,markerHorizontalAlignmentFn:i,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.st;let a;const u=this.symbol,l=this.getIconAndGlyph(),h=this.feature.properties;if(l&&l.glyph){const{font:t,text:i}=l.glyph;if(""===i)return null;const s=this.size[0]/24,c=24,f=u.textKeepUpright,d="map"===u.textRotationAlignment&&"line"===u.textPlacement&&!u.isIconText,p=n.glyphMap[t],y=su(e?e(null,h):u.textHorizontalAlignment,r?r(null,h):u.textVerticalAlignment),m=1.2*c,g=function(t){for(let n=0;n<t.length;n++)if(!ja(t.charAt(n).charCodeAt(0)))return!1;return!0}(i),v=g&&u.textLetterSpacing/s||0,b=[u.textDx/s||0,u.textDy/s||0],w=((o?o(null,h):u.textWrapWidth)||10*c)/s;a={},a.horizontal=Wa(i,p,w,m,y,0,v,b,c,Ga),g&&d&&f&&(a.vertical=Wa(i,p,w,m,y,0,v,b,c,Ja))}else if(l&&l.icon){if(!t||!t.positions[l.icon.url])return null;const n=su(i?i(null,h):u.markerHorizontalAlignment,s?s(null,h):u.markerVerticalAlignment);a=function(t,n,e){let{horizontalAlign:r,verticalAlign:i}=tu(n,e);e?r=1-r:i=1-i;const s=-2048*r,o=-2048*i;return{image:t,top:o,bottom:o+2048,left:s,right:s+2048}}(t.positions[l.icon.url],n,this.options.isVector3D),this.size||(this.size=a.image.displaySize)}return this.kt=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:e,markerWidthFn:r,markerHeightFn:i,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:u,markerTextFitPaddingFn:l,markerLineColorFn:h,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:p,markerPathWidthFn:g,markerPathHeightFn:v,textNameFn:b,textFaceNameFn:w}=this.st,{zoom:M}=this.options,x={},F=this.symbol,k=this.feature.properties,A=t?t(null,k):F.markerFile,P=n?n(null,k):F.markerType,S=A||P||F.markerPath,_=!wr(this.symbolDef.textName);let O;if(S){O=function(t,n,e,r,i,s){if(wr(n.markerWidth)&&wr(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let u=n.markerWidth||0,l=n.markerHeight||0;return xr(u)&&("identity"!==u.type?u=Ea(u):(u=t.markerWidth,t[o]&&(u=t[o](r,e)),xr(u)&&(u="identity"===u.type?i(r,e):Ea(u)))),xr(l)&&("identity"!==l.type?l=Ea(l):(l=t.markerHeight,t[a]&&(l=t[a](r,e)),xr(l)&&(l="identity"===l.type?s(r,e):Ea(l)))),[u,l]}(F,this.symbolDef,k,M,r,i)||[0,0];let t=F.markerTextFit;if(u&&(t=u(M,k)),t&&F.text&&"none"!==t){const n=F.text.textSize;let e=F.text.textName;y(e)&&(e=m(e)(M,k));const r=Ta(e,k);if(r){const e="__fn_textSize".trim(),i="__fn_textSize_0".trim();y(n)&&!F.text[e]&&(F.text[i]=m(n),F.text[e]=(t,n)=>{const e=F.text[i](t,n);return y(e)?m(e)(t,n):e});const s=Ca(F.text,F.text,k,M);if("width"!==t&&"both"!==t||(O[0]=s[0]*r.length),"height"!==t&&"both"!==t||(O[1]=s[1]),s[0]&&s[1]){let t=F.markerTextFitPadding||[0,0,0,0];l&&(t=l(M,k)),O[0]+=t[1]+t[3],O[1]+=t[0]+t[2]}}else O[0]=O[1]=-1}}if(_&&(O=Ca(F,this.symbolDef,k,M)),!O)return x;if(O[0]=Math.ceil(O[0]),O[1]=Math.ceil(O[1]),this.size=O,S&&O[0]>=0&&O[1]>=0){let t;if(P){const n={};if(n.markerType=P,"path"===P&&(n.markerPath=e?e(null,k):F.markerPath,n.markerPathWidth=g?g(null,k):F.markerPathWidth,n.markerPathHeight=v?v(null,k):F.markerPathHeight),r){const t=r(null,k);wr(t)||(n.markerWidth=t)}else F.markerWidth>=0&&(n.markerWidth=F.markerWidth);if(i){const t=i(null,k);wr(t)||(n.markerHeight=t)}else F.markerHeight>=0&&(n.markerHeight=F.markerHeight);if(s){const t=s(null,k);wr(t)||(n.markerFill=t)}else F.markerFill&&(n.markerFill=F.markerFill);if(o){const t=o(null,k);wr(t)||(n.markerFillPatternFile=t)}else F.markerFillPatternFile&&(n.markerFillPatternFile=F.markerFillPatternFile);if(a){const t=a(null,k);wr(t)||(n.markerFillOpacity=t)}else F.markerFillOpacity>=0&&(n.markerFillOpacity=F.markerFillOpacity);if(h){const t=h(null,k);wr(t)||(n.markerLineColor=t)}else F.markerLineColor&&(n.markerLineColor=F.markerLineColor);if(c){const t=c(null,k);wr(t)||(n.markerLineWidth=t)}else F.markerLineWidth>=0&&(n.markerLineWidth=F.markerLineWidth);if(f){const t=f(null,k);wr(t)||(n.markerLineOpacity=t)}else F.markerLineOpacity>=0&&(n.markerLineOpacity=F.markerLineOpacity);if(d){const t=d(null,k);wr(t)||(n.markerLineDasharray=t)}else F.markerLineDasharray&&(n.markerLineDasharray=F.markerLineDasharray);if(p){const t=p(null,k);wr(t)||(n.markerLinePatternFile=t)}else F.markerLinePatternFile&&(n.markerLinePatternFile=F.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=A?A.replace(ru,this.xt):F.markerPath?function(t,n,e){if(!t.markerPath)return null;let r=1;const i=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);Mr(t.markerOpacity)&&(r=t.markerOpacity),Mr(t.opacity)&&(r*=t.opacity);const s={};if(i){for(const t in i.stroke)Pr(i.stroke,t)&&(wr(i.stroke[t])||(s[t]=i.stroke[t]));for(const t in i.fill)Pr(i.fill,t)&&(wr(i.fill[t])||(s[t]=i.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const u=[];for(let t=0;t<o.length;t++)a=Fr(o[t])?{path:o[t]}:o[t],a=br({},a,s),a.d=a.path,delete a.path,u.push(a);const l=['<svg version="1.1"','xmlns="http://www.w3.org/2000/svg"'];r<1&&l.push('opacity="'+r+'"'),t.markerPathWidth&&t.markerPathHeight&&l.push('viewBox="0 0 '+t.markerPathWidth+" "+t.markerPathHeight+'"'),l.push('preserveAspectRatio="none"'),n&&l.push('width="'+n+'"'),e&&l.push('height="'+e+'"'),l.push("><defs></defs>");for(let t=0;t<u.length;t++){let n="<path ";for(const e in u[t])Pr(u[t],e)&&(n+=" "+e+'="'+u[t][e]+'"');n+="></path>",l.push(n)}return l.push("</svg>"),"data:image/svg+xml;base64,"+btoa(l.join(" "))}(F,O[0],O[1]):null;x.icon={url:t,size:O}}if(_){const t=b?b(this.options.zoom,k):F.textName;if(t||0===t){const n=Ia(w?w(null,k):F.textFaceName);let e=Ta(t,k);e&&e.length&&(e=eu(e),x.glyph={font:n,text:e})}}return this.iconGlyph=x,x}}function su(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let e="center"!==n?n:"";return e+="center"!==t?(e.length?"-":"")+t:"",e\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function ou(t,n,e,r,i){const s=[];let o;for(let a=0;a<t.length;a++){const u=t[a];let l,h=!1;for(let t=0;t<u.length-1;t++){let a=u[t],c=u[t+1];a.x<n&&c.x<n||(a.x<n?(o=a,a=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(n-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x<n&&(o=c,c=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(n-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y<e&&c.y<e||(a.y<e?(o=a,a=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),a.z=o.z+(e-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y<e&&(o=c,c=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),c.z=a.z+(e-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),a.x>=r&&c.x>=r||(a.x>=r?(o=a,a=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(r-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x>=r&&(o=c,c=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(r-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y>=i&&c.y>=i||(a.y>=i?(o=a,a=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),a.z=o.z+(i-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y>=i&&(o=c,c=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),c.z=a.z+(i-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),l&&a.equals(l[l.length-1])||(l=[a],s.push(l)),h&&(l.clipped=!0),l.push(c)))))}}return s}class au extends dt{constructor(t,n,e,r){super(t,n),this.angle=e,void 0!==r&&(this.segment=r)}clone(){return new au(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 uu(t,n,e,r,i){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-e/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const u=[];let l=0;for(;a<e/2;){const n=t[o],e=t[o+1];if(!e)return!1;let s=t[o-1].angleTo(n)-n.angleTo(e);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:a,angleDelta:s}),l+=s;a-u[0].distance>r;)l-=u.shift().angleDelta;if(l>i)return!1;o++,a+=n.dist(e)}return!0}function lu(t,n,e,r,i,s,o,a,u,l,h){const c=function(t,n,e){return t?.6*n*e:0}(r,s,o),f=function(t,n){return Math.max(t?t.right-t.left:0,0)}(r),d=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return n-f*o<n/4&&(n=f*o+n/4),hu(t,d?n/2*a%n:(f/2+2*s)*o*a%n,n,c,e,f*o,d,!1,u,l,h)}function hu(t,n,e,r,i,s,o,a,u,l,h){let c=0;const f=s/2,d=function(t){let n=0;for(let e=0;e<t.length-1;e++)n+=t[e].dist(t[e+1]);return n}(t);let p=0,y=n-e,m=[];for(let n=0;n<t.length-1;n++){const o=t[n],a=t[n+1],g=o.dist(a),v=a.angleTo(o);for(;y+e<p+g;){y+=e;const b=(y-p)/g,w=cu(o.x,a.x,b),M=cu(o.y,a.y,b),x=cu(o.z||0,a.z||0,b);if(w>=0&&w<u&&M>=0&&M<u&&y-f>=0&&y+f<=d){const e=new au(w,M,v,n);e.z=x,l&&(e.axis=[o.y-M,w-o.x],e.angleR=x===(o.z||0)?0:Math.atan(.9*(x-(o.z||0))*h/o.dist(e))),e.line=t,e.j(),!r||uu(t,e,s,r,i)?m.push(e):r&&c++}}p+=g}return a||m.length||o||(m=hu(t,p/2,e,r,i,s,o,!0,u,l,h)),m.countOutOfAngle=c,m}function cu(t,n,e){return t*(1-e)+n*e}function fu(t,n){const e=t.length;if(e<=1)return[t];const r=[];let i,s;for(let n=0;n<e;n++){const e=nr(t[n]);0!==e&&(t[n].area=Math.abs(e),void 0===s&&(s=e<0),s===e<0?(i&&r.push(i),i=[t[n]]):i.push(t[n]))}if(i&&r.push(i),n>1)for(let t=0;t<r.length;t++)r[t].length<=n||(Mn(r[t],n,1,r[t].length-1,du),r[t]=r[t].slice(0,n));return r}function du(t,n){return n.area-t.area}function pu(t,n,e){const r=n.distSqr(e);if(0===r)return t.distSqr(n);const i=((t.x-n.x)*(e.x-n.x)+(t.y-n.y)*(e.y-n.y))/r;return t.distSqr(i<0?n:i>1?e:e.sub(n).S(i).F(n))}function yu(t,n=1,e=!1){let r=1/0,i=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<r)&&(r=n.x),(!t||n.y<i)&&(i=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const u=Math.min(s-r,o-i);let l=u/2;const h=new xn([],mu);if(0===u)return new dt(r,i);for(let n=r;n<s;n+=u)for(let e=i;e<o;e+=u)h.push(new gu(n+l,e+l,l,t));let c=function(t){let n=0,e=0,r=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],u=s.x*a.y-a.x*s.y;e+=(s.x+a.x)*u,r+=(s.y+a.y)*u,n+=3*u}return new gu(e/n,r/n,0,t)}(t),f=h.length;for(;h.length;){const r=h.pop();(r.d>c.d||!c.d)&&(c=r,e&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,f)),r.max-c.d<=n||(l=r.h/2,h.push(new gu(r.p.x-l,r.p.y-l,l,t)),h.push(new gu(r.p.x+l,r.p.y-l,l,t)),h.push(new gu(r.p.x-l,r.p.y+l,l,t)),h.push(new gu(r.p.x+l,r.p.y+l,l,t)),f+=4)}return e&&(console.log(\`num probes: ${q}f}\`),console.log(\`best distance: ${q}c.d}\`)),c.p}function mu(t,n){return n.max-t.max}function gu(t,n,e,r){this.p=new dt(t,n),this.h=e,this.d=function(t,n){let e=!1,r=1/0;for(let i=0;i<n.length;i++){const s=n[i];for(let n=0,i=s.length,o=i-1;n<i;o=n++){const i=s[n],a=s[o];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(e=!e),r=Math.min(r,pu(t,i,a))}}return(e?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}function vu(t,n,e,r,i,s,o,a,u,l){const{feature:h,size:c,symbol:f}=t,d=c?24:0,p=i*(c?c[0]/d:1);if("line"===o){const t=[];t.countOutOfAngle=0;let i=h.geometry;s&&(i=ou(h.geometry,0,0,s,s));for(let o=0;o<i.length;o++){const h=lu(i[o],a,e,f.isIconText?null:r&&r.vertical||r&&r.horizontal||r,0,d,f.isIconText?1:p,1,s||1/0,u,l);if(f.textPlacement&&!f.isIconText)for(let t=0;t<h.length;t++)h[t].startIndex=n.length/3;if(t.push.apply(t,h),f.textPlacement&&!f.isIconText)for(let t=0;t<i[o].length;t++)n.push(i[o][t].x,i[o][t].y,i[o][t].z||0);t.countOutOfAngle+=h.countOutOfAngle||0}return t}return bu(h,o,s)}function bu(t,n,e,r,i){const s=[];if(3===t.type){const o=fu(t.geometry,0);for(let t=0;t<o.length;t++){const a=o[t];if("vertex"===n)for(let t=0;t<a.length;t++){const n=a[t];for(let o=0;o<n.length;o++)sr(n[o],e)||(s.push(n[o]),r&&(0===o?wu(n[o],n[o],n[t+1],i):wu(n[o],n[o-1],n[o],i)))}else if("vertex-first"===n){const t=a[0];t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i))}else if("vertex-last"===n||"vertex-firstlast"===n){const t=a[0];if("vertex-firstlast"===n&&t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i)),t&&t[t.length-1]&&!sr(t[t.length-1],e)){const n=t.length-1;s.push(t[n]),r&&wu(t[n],t[n-1],t[n],i)}}else{const t=yu(a,16);sr(t,e)||s.push(t)}}}else if(2===t.type)for(let o=0;o<t.geometry.length;o++){const a=t.geometry[o];if("vertex"===n)for(let t=0;t<a.length;t++)sr(a[t],e)||(s.push(a[t]),r&&(0===t?wu(a[t],a[t],a[t+1],i):wu(a[t],a[t-1],a[t],i)));else if("vertex-last"===n||"vertex-firstlast"===n){if("vertex-firstlast"!==n||sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i)),a&&a[a.length-1]&&!sr(a[a.length-1],e)){const t=a.length-1;s.push(a[t]),r&&wu(a[t],a[t-1],a[t],i)}}else sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i))}else if(1===t.type)for(let n=0;n<t.geometry.length;n++){const i=t.geometry[n];for(let t=0;t<i.length;t++){const n=i[t];sr(n,e)||(r&&(n.xRotation=0,n.yRotation=0,n.zRotation=0),s.push(n))}}return s}function wu(t,n,e,r){if(t.xRotation||t.yRotation||t.zRotation)return t;const i=e.x-n.x,s=n.y-e.y,o=(e.z-n.z)*r,a=Math.atan2(s,i);t.zRotation=a;const u=Math.atan2(o,Math.sqrt(i*i+s*s));return t.xyRotation=u,t}function Mu(t,n){const e={},r={},i=[];let s=0;function o(n){i.push(t[n]),s++}function a(t,n,e){const s=r[t];return delete r[t],r[n]=s,i[s].geometry[0].pop(),i[s].geometry[0]=i[s].geometry[0].concat(e[0]),s}function u(t,n,r){const s=e[n];return delete e[n],e[t]=s,i[s].geometry[0].shift(),i[s].geometry[0]=r[0].concat(i[s].geometry[0]),s}function l(t,n,e){const r=e?n[0][n[0].length-1]:n[0][0];return\`${q}t}:${q}r.x}:${q}r.y}\`}for(let h=0;h<t.length;h++){const c=t[h],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(h);continue}const p=l(d,f),y=l(d,f,!0);if(p in r&&y in e&&r[p]!==e[y]){const t=u(p,y,f),n=a(p,y,i[t].geometry);delete e[p],delete r[y],r[l(d,i[n].geometry,!0)]=n,i[t].geometry=null}else p in r?a(p,y,f):y in e?u(p,y,f):(o(h),e[p]=s-1,r[y]=s-1)}return i.filter((t=>t.geometry))}const xu="__index";function Fu(t,n,e,r){const i=(xu+"").trim(),s=function(t,n,e,r){const i=(xu+"").trim(),{mergeOnPropertyFn:s}=e;if(!n.mergeOnProperty)return[];if(!or(o=n.mergeOnProperty)&&("string"==typeof o||null!==o.constructor&&o.constructor===String))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],u={},l=[];for(let e=0;e<t.length;e++){t[e][i]=e;const o=t[e].properties=t[e].properties||{};o.$layer=t[e].layer,o.$type=t[e].type;const h=s?s(r,o):n.mergeOnProperty;or(h)?l.push(t[e]):(void 0===u[h]&&(u[h]=a.length,a.push({features:[],property:h})),a[u[h]].features.push(t[e]))}return l.length&&a.push({features:l}),a}(t,n,e,r);if(s.length){const n=[];for(let e=0;e<s.length;e++)n.push(s[e].property?Mu(s[e].features,s[e].property):t);if(1===n.length)return n[0];{let t=[];for(let e=0;e<n.length;e++)t=t.concat(n[e]);return t.sort(((t,n)=>t[i]-n[i])),t}}return[]}class ku extends Pa{static needMerge(t,n,e){if(!t)return!1;let r="line"===t.textPlacement||"line"===t.markerPlacement;return r||(n.textPlacementFn&&(r="line"===n.textPlacementFn(e)),n.markerPlacementFn&&(r="line"===n.markerPlacementFn(e))),t.mergeOnProperty&&r}static mergeLineFeatures(t,n,e,r){let i=n.textPlacement,s=n.markerPlacement;return e.textPlacementFn&&(i=e.textPlacementFn(r)),e.markerPlacementFn&&(s=e.markerPlacementFn(r)),"line"!==i&&"line"!==s?t:Fu(t,n,e,r)}static splitPointSymbol(t,n=0){const e=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&e.push(...ku.splitPointSymbol(n[t],t));return e}let r=null,i=null;for(const n in t)0===n.indexOf("marker")?(r=r||{},r[n]=t[n]):0===n.indexOf("text")&&(i=i||{},i[n]=t[n]);return r&&(r.isIconText=!0,t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),e.push(r)),i&&(r&&(i.textPlacement=r.markerPlacement,i.textSpacing=r.markerSpacing,i.isIconText=!0),t.mergeOnProperty&&(i.mergeOnProperty=t.mergeOnProperty),e.push(i)),void 0!==t.visible&&(r&&(r.visible=t.visible),i&&(i.visible=t.visible)),r&&(r.markerTextFit&&i&&(r.text={},r.text.textName=i.textName,r.text.textSize=i.textSize),r.index={index:n,type:0}),i&&(i.index={index:n,type:1}),e}static isAtlasLoaded(t,n){const{icon:e,glyph:r}=t,{iconAtlas:i,glyphAtlas:s}=n;if(e&&(!i||!i.positions[e.url]))return!1;if(r){if(!s||!s.positions[r.font])return!1;const t=s.positions[r.font],{text:n}=r;for(const e of n)if(!t[e.codePointAt(0)])return!1}return!0}constructor(t,n,e){super(t,n,e),this.At=n.textPlacement,this.st.textPlacementFn&&(this.At=this.st.textPlacementFn(this.options.zoom))}createStyledVector(t,n,e,r,i,s){const o=new iu(t,this.symbolDef,n,e,r),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;i[t]||(i[t]=a.icon.size),i[t][0]<n[0]&&(i[t][0]=n[0]),i[t][1]<n[1]&&(i[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:n}=a.glyph,e=s[t]=s[t]||{};for(const t of n)e[t.codePointAt(0)]=1;"line"===this.At&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,e=n?this.getPackSDFFormat(t):this.getPackMarkerFormat();n?e.push(...this.Pt()):e.push(...this.St());const{markerOpacityFn:r,textOpacityFn:i,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:u,markerRotationFn:l,textRotationFn:h,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:p}=this.st;return(r||i)&&e.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&e.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||u)&&e.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(l||h)&&e.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||p)&&e.push({type:Uint8Array,width:1,name:"aOverlap"}),e}_t(){return this.hasMapPitchAlign}Pt(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:e,textHaloRadiusFn:r,textHaloOpacityFn:i,textDxFn:s,textDyFn:o}=this.st,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),e&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),i&&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}St(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:e,markerDyFn:r}=this.st,i=[];return t&&i.push({type:this.options.markerWidthType||Uint8Array,width:1,name:"aMarkerWidth"}),n&&i.push({type:this.options.markerHeightType||Uint8Array,width:1,name:"aMarkerHeight"}),e&&i.push({type:Int8Array,width:1,name:"aMarkerDx"}),r&&i.push({type:Int8Array,width:1,name:"aMarkerDy"}),i}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.countOutOfAngle=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 e=t.getShape(this.iconAtlas,this.glyphAtlas);if(!(this.options.allowEmptyPack||e&&e.image||e&&(e.horizontal||e.vertical)))return;const r=this.Ot(t,e,n);if(this.countOutOfAngle+=r.countOutOfAngle||0,0===r.length)return;const i=this.data,s=this.needAltitudeAttribute()?2:3;let o=this.data.aPosition.getLength()/s;const a=t.symbol,u=t.feature.properties,l="line"===this.At&&!a.isIconText,h=void 0!==a.textName,c=h&&l&&function(t){let n=0;for(let e=0;e<t.length;e++)if(Na(t.charAt(e).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:f,textSizeFn:d,textHaloFillFn:p,textHaloRadiusFn:m,textHaloOpacityFn:g,textDxFn:v,textDyFn:b,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:x,textAllowOverlapFn:F,textIgnorePlacementFn:k,textOpacityFn:A,markerWidthFn:P,markerHeightFn:S,markerDxFn:_,markerDyFn:O,markerPitchAlignmentFn:C,markerRotationAlignmentFn:E,markerRotationFn:I,markerAllowOverlapFn:$,markerIgnorePlacementFn:T,markerOpacityFn:D}=this.st;let z,j,U,N,L,R,V,H,q,G,J,W,B,X,Y,K,Z;if(h){const n=t.getIconAndGlyph().glyph.font;z=function(t,n,e){const r=t.positionedGlyphs,i=[];for(let s=0;s<r.length;s++){const o=r[s],a=e[o.glyph];if(!a)continue;const u=a.rect;if(!u)continue;const l=4,h=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+h,0]:[0,0],d=n?[0,o.y-c]:[o.x+h,o.y-c],p=a.metrics.left-l-h+d[0],y=a.metrics.top-l+d[1],m=p+u.w,g=y+u.h,v=new dt(p,y),b=new dt(m,y),w=new dt(p,g),M=new dt(m,g);if(n&&o.vertical){const t=new dt(-h,h),n=-Math.PI/2,e=new dt(5,0);v.C(n,t).F(e),b.C(n,t).F(e),w.C(n,t).F(e),M.C(n,t).F(e)}i.push({tl:v,tr:b,bl:w,br:M,tex:u,writingMode:t.writingMode,glyphOffset:f})}return i}(e.horizontal,l,this.glyphAtlas.positions[n]),f&&(j=f(null,u),y(j)?(this.dynamicAttrs.aTextFill=1,j=[0,0,0,0]):j=Ir([],j)),d&&(U=d(this.options.zoom,u),or(U)&&(U=14)),p&&(N=p(null,u),y(N)?(this.dynamicAttrs.aTextHaloFill=1,N=[0,0,0,0]):N=Ir([],N)),m&&(L=m(null,u)),g&&(R=255*g(null,u)),v&&(V=v(null,u)||0),b&&(H=b(null,u)||0),w&&(B=+("map"===w(null,u))),M&&(X=+("map"===M(null,u))),x&&(Y=ar(x(null,u),0,360)*Math.PI/180)}else z=e?function(t){const n=t.image,e=t.top-1/n.pixelRatio,r=t.left-1/n.pixelRatio,i=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,u,l;return o=new dt(r,e),a=new dt(s,e),u=new dt(s,i),l=new dt(r,i),[{tl:o,tr:a,bl:l,br:u,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(e):function(){const t=new dt(0,0),n=new dt(0,0),e=new dt(0,0);return[{tl:t,tr:n,bl:new dt(0,0),br:e,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),P&&(q=P(null,u)),or(q)&&(q=z[0].tex.w),S&&(G=S(null,u)),or(G)&&(G=z[0].tex.h),_&&(J=_(null,u)),O&&(W=O(null,u)),C&&(B=+("map"===C(null,u))),E&&(X=+("map"===E(null,u))),I&&(Y=ar(I(null,u),0,360)*Math.PI/180);y(U)&&(this.dynamicAttrs.aTextSize=1),y(L)&&(this.dynamicAttrs.aTextHaloRadius=1),y(R)&&(this.dynamicAttrs.aTextHaloOpacity=1),y(V)&&(this.dynamicAttrs.aTextDx=1),y(H)&&(this.dynamicAttrs.aTextDy=1),y(q)&&(this.dynamicAttrs.aMarkerWidth=1),y(G)&&(this.dynamicAttrs.aMarkerHeight=1),y(J)&&(this.dynamicAttrs.aMarkerDx=1),y(W)&&(this.dynamicAttrs.aMarkerDy=1),y(B)&&(this.dynamicAttrs.aPitchAlign=1),y(X)&&(this.dynamicAttrs.aRotationAlign=1),y(Y)&&(this.dynamicAttrs.aRotation=1);const Q=$||F;Q&&(K=Q(null,u)||0);const tt=T||k;let nt;tt&&(Z=tt(null,u)||0);const et=A||D;et&&(nt=255*et(this.options.zoom,u));const rt=z.length;this.ensureDataCapacity(4*rt,r.length);const it=this.options.EXTENT,{altitudeScale:st,altitudeProperty:ot,defaultAltitude:at}=this.options,{altitude:ut}=ir(t.feature,st,ot,at);for(let t=0;t<r.length;t++){const n=r[t],e=n.z||ut||0;if(it!==1/0&&sr(n,it))continue;const s=n.x,a=n.y,u=z.length;for(let t=0;t<u;t++){const r=z[t],{tl:u,tr:f,bl:d,br:p,tex:y}=r;this.Ct(i,s,a,e,10*u.x,10*u.y,y.x,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*f.x,10*f.y,y.x+y.w,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*d.x,10*d.y,y.x,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*p.x,10*p.y,y.x+y.w,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.addElements(o,o+1,o+2),this.addElements(o+1,o+2,o+3),o+=4;const m=Math.max(Math.abs(s),Math.abs(a),Math.abs(e));m>this.maxPos&&(this.maxPos=m)}}}Ct(t,n,e,r,i,s,o,a){this.fillPosition(t,n,e,r);let u=t.aShape.currentIndex;t.aShape[u++]=i,t.aShape[u++]=s,t.aShape.currentIndex=u,u=t.aTexCoord.currentIndex,t.aTexCoord[u++]=o,t.aTexCoord[u++]=a,t.aTexCoord.currentIndex=u}Et(t,n,e,r,i,s,o,a){let u=t.aCount.currentIndex;if(t.aCount[u++]=e,t.aCount.currentIndex=u,n){u=t.aGlyphOffset.currentIndex,t.aGlyphOffset[u++]=r[0],t.aGlyphOffset[u++]=r[1],t.aGlyphOffset.currentIndex=u,this._t()&&(u=t.aPitchRotation.currentIndex,t.aPitchRotation[u++]=o[0],t.aPitchRotation[u++]=o[1],t.aPitchRotation[u++]=a,t.aPitchRotation.currentIndex=u);const n=i.startIndex;u=t.aSegment.currentIndex,t.aSegment[u++]=i.segment+n,t.aSegment[u++]=n,t.aSegment[u++]=i.line.length,t.aSegment.currentIndex=u,u=t.aVertical.currentIndex,t.aVertical[u++]=s,t.aVertical.currentIndex=u}}It(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m,g){const{textFillFn:v,textSizeFn:b,textHaloFillFn:w,textHaloRadiusFn:M,textHaloOpacityFn:x,textDxFn:F,textDyFn:k,textPitchAlignmentFn:A,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:C,markerWidthFn:E,markerHeightFn:I,markerDxFn:$,markerDyFn:T,markerPitchAlignmentFn:D,markerRotationAlignmentFn:z,markerRotationFn:j,markerAllowOverlapFn:U,markerIgnorePlacementFn:N,markerOpacityFn:L}=this.st;if(v){let e=t.aTextFill.currentIndex;t.aTextFill[e++]=n[0],t.aTextFill[e++]=n[1],t.aTextFill[e++]=n[2],t.aTextFill[e++]=n[3],t.aTextFill.currentIndex=e}if(b){let n=t.aTextSize.currentIndex;t.aTextSize[n++]=e,t.aTextSize.currentIndex=n}if(w){let n=t.aTextHaloFill.currentIndex;t.aTextHaloFill[n++]=r[0],t.aTextHaloFill[n++]=r[1],t.aTextHaloFill[n++]=r[2],t.aTextHaloFill[n++]=r[3],t.aTextHaloFill.currentIndex=n}if(M){let n=t.aTextHaloRadius.currentIndex;t.aTextHaloRadius[n++]=i,t.aTextHaloRadius.currentIndex=n}if(x){let n=t.aTextHaloOpacity.currentIndex;t.aTextHaloOpacity[n++]=s,t.aTextHaloOpacity.currentIndex=n}if(F){let n=t.aTextDx.currentIndex;t.aTextDx[n++]=o,t.aTextDx.currentIndex=n}if(k){let n=t.aTextDy.currentIndex;t.aTextDy[n++]=a,t.aTextDy.currentIndex=n}if(E){let n=t.aMarkerWidth.currentIndex;t.aMarkerWidth[n++]=u,t.aMarkerWidth.currentIndex=n}if(I){let n=t.aMarkerHeight.currentIndex;t.aMarkerHeight[n++]=l,t.aMarkerHeight.currentIndex=n}if($){let n=t.aMarkerDx.currentIndex;t.aMarkerDx[n++]=h,t.aMarkerDx.currentIndex=n}if(T){let n=t.aMarkerDy.currentIndex;t.aMarkerDy[n++]=c,t.aMarkerDy.currentIndex=n}if(L||C){let n=t.aColorOpacity.currentIndex;t.aColorOpacity[n++]=f,t.aColorOpacity.currentIndex=n}if(A||D){let n=t.aPitchAlign.currentIndex;t.aPitchAlign[n++]=d,t.aPitchAlign.currentIndex=n}if(z||P){let n=t.aRotationAlign.currentIndex;t.aRotationAlign[n++]=p,t.aRotationAlign.currentIndex=n}if(j||S){let n=t.aRotation.currentIndex;t.aRotation[n++]=9362*y,t.aRotation.currentIndex=n}const R=U||_,V=N||O;if(R||V){let n=t.aOverlap.currentIndex;t.aOverlap[n++]=(R?8:0)+4*m+((V?2:0)+g),t.aOverlap.currentIndex=n}i>0&&(this.properties.hasHalo=1)}Ot(t,n,e){const{feature:r,symbol:i}=t,s=this.$t(t,i),o=r.properties,{markerSpacingFn:a,textSpacingFn:u,textMaxAngleFn:l}=this.st,h=((a?a(null,o):i.markerSpacing)||(u?u(null,o):i.textSpacing)||250)*e;let c=l?l(this.options.zoom,o):i.textMaxAngle;or(c)&&(c=80),c*=Math.PI/180;const f=this.options.EXTENT,d=this.options.altitudeToTileScale,p=this._t();return vu(t,this.lineVertex,c,n,e,f,s,h,p,d)}$t(t,n){let e;return e=this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||this.At,this.vt||!n.markerPlacement&&!n.isIconText||(this.vt=e),!this.At||n.isIconText||this.bt||(this.bt=e),e}getPackSDFFormat(t){if("line"!==this.At||t.isIconText)return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}];{const t=[...this.getPositionFormat(),{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"}];return this._t()&&t.push({type:Float32Array,width:3,name:"aPitchRotation"}),t}}getPackMarkerFormat(){return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}]}}class Au{constructor(t){this.x=t.x,this.y=t.y,this.z=t.z||0}clone(){return new Au(this)}T(){return this._(this.mag()),this}_(t){return this.x/=t,this.y/=t,this.z/=t,this}D(){var t=this.y;return this.y=this.x,this.x=-t,this}mag(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}add(t){return this.clone().F(t)}sub(t){return this.clone().k(t)}F(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}k(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}mult(t){return this.clone().S(t)}S(t){return this.x*=t,this.y*=t,this.z*=t,this}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){var n=t.x-this.x,e=t.y-this.y,r=t.z-this.z;return n*n+e*e+r*r}j(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}}const Pu=63,Su=Math.cos(Math.PI/180*37.5),_u=Math.pow(2,16)/1,Ou=new dt,Cu=new dt,Eu=new dt;class Iu extends Pa{static mergeLineFeatures(t,n,e,r){return Fu(t,n,e,r)}constructor(t,n,e){super(t,n,e);let r=!1;const{lineDasharrayFn:i,lineDashColorFn:s}=this.st;this.hasGradient=this.symbol.lineGradientProperty,i&&(r=function(t,n,e){for(let r=0;r<t.length;r++)if(e(n,t[r].properties))return!0;return!1}(t,this.options.zoom,i),r&&(this.dasharrayFn=i)),this.hasDasharray=Du(this.symbol.lineDasharray)||r,this.hasDasharray&&s&&(this.dashColorFn=s)}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getLineResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:e,lineColorFn:r,lineOpacityFn:i,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:u}=this.st,l=[...this.getPositionFormat()];if(l.push(this.iconAtlas||this.hasDasharray?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),l.push({type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}),t&&l.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&l.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),r&&l.push({type:Uint8Array,width:4,name:"aColor"}),e&&l.push({type:Uint8Array,width:4,name:"aStrokeColor"}),i&&l.push({type:Uint8Array,width:1,name:"aOpacity"}),this.dasharrayFn&&l.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&l.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();l.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return(s||o)&&l.push({type:Int8Array,width:2,name:"aLineDxDy"}),(a||u)&&l.push({type:Int8Array,width:2,name:"aLinePattern"}),l}placeVector(t){const{lineJoinFn:n,lineCapFn:e,lineWidthFn:r,lineHeightFn:i,lineStrokeWidthFn:s,lineStrokeColorFn:o,lineColorFn:a,lineOpacityFn:u,lineDxFn:l,lineDyFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=this.symbol,p=t.feature,m=p.properties;let g=d.lineJoin||"miter",v=d.lineCap||"butt";if(n&&(g=n(this.options.zoom,m)||"miter"),e&&(v=e(this.options.zoom,m)||"butt"),r){let t=r(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineWidth=1,t=4),wr(t)&&(t=4),this.feaLineWidth=+t}else this.feaLineWidth=+d.lineWidth;if(i){let t=i(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineHeight=1),wr(t)&&(t=this.feaLineWidth),this.feaLineHeight=+t}else this.feaLineHeight=+d.lineHeight||this.feaLineWidth;if(s){let t=s(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineStrokeWidth=1,t=0),wr(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(a&&(this.feaColor=a(this.options.zoom,m)||[255,255,255,255],y(this.feaColor)?(this.dynamicAttrs.aColor=1,this.feaColor=[0,0,0,0]):this.feaColor=Ir([],this.feaColor)),o&&(this.feaStrokeColor=o(this.options.zoom,m)||[0,0,0,255],y(this.feaStrokeColor)?(this.dynamicAttrs.aStrokeColor=1,this.feaStrokeColor=[0,0,0,0]):this.feaStrokeColor=Ir([],this.feaStrokeColor)),u){let t=u(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aOpacity=1,t=1),wr(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,m)||[0,0,0,0];if(y(t)&&(this.dynamicAttrs.aDasharray=1,t=[0,0,0,0]),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,m):this.symbol.lineDashColor)||[0,0,0,0];y(t)&&(this.dynamicAttrs.aDashColor=1,t=[0,0,0,0]),t=Ir([],t),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),e=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],e){const{tl:t,displaySize:e}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=e[0]-3,this.feaTexInfo[3]=e[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0}if(l){let t=l(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDx=t}if(h){let t=h(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternAnimSpeed=1,t=0),wr(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternGap=1,t=0),wr(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let w=p.geometry;if(b!==1/0){w=[];const t=[];for(let n=0;n<p.geometry.length;n++){t[0]=p.geometry[n];const e=ou(t,-1,-1,b+1,b+1);if(3===p.type&&e.length>1){const t=e[0],n=e[e.length-1];Uu(t[0],n[n.length-1])&&(e[0]=n.concat(t.slice(1)),e.length=e.length-1)}w.push(...e)}}const M=this.needAltitudeAttribute()?2:3;for(let t=0;t<w.length;t++)this.offset=this.data.aPosition.getLength()/M,this.Tt(w[t],p,g,v,2,1.05)}Dt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}Tt(t,n,e,r,i,s){const o=this.Dt()||Du(this.feaDash)||Du(this.symbol.lineDasharray),a=this.options.isTube;a&&(t=t.map((t=>new Au(t)))),this.overscaling=1;const u=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.prevVertex=null,this.symbol.lineGradientProperty&&n.properties&&Mr(n.properties.mapbox_clip_start)&&Mr(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 l=3===n.type&&!t.clipped;let h=t.length;for(;h>=2&&Uu(t[h-1],t[h-2]);)h--;let c=0;for(;c<h-1&&Uu(t[c],t[c+1]);)c++;if(h<(l?3:2))return;"bevel"===e&&(i=1.05);const f=this.overscaling<=16?15*u/(512*this.overscaling):0,d={vertexLength:0,primitiveLength:0,currentNormal:null};let p,y,m,g,v;this.e1=this.e2=-1,l&&(p=t[h-2],v=t[c].sub(p).T().D()),this.ensureDataCapacity(e,h,360,2);for(let n=c;n<h;n++){if(m=n===h-1?l?t[c+1]:void 0:t[n+1],m&&Uu(t[n],m))continue;v&&(g=v),p&&(y=p),p=t[n],m&&p.x===m.x&&p.y===m.y&&(p.x+=1e-4),v=m?m.sub(p).T().D():g,d.dir=y?p.sub(y).T():m.sub(p).T(),g=g||v,d.currentNormal=g;let u=g.add(v);0===u.x&&0===u.y||u.T();const b=g.x*v.x+g.y*v.y,w=u.x*v.x+u.y*v.y,M=0!==w?1/w:1/0,x=2*Math.sqrt(2-2*w),F=w<Su&&y&&m,k=g.x*v.y-g.y*v.x>0;if(!a&&F&&n>c){const t=p.dist(y);if(t>2*f){const n=p.sub(p.sub(y).S(f/t).j());n.z=p.z,this.updateDistance(y,n),this.addCurrentVertex(n,g,0,0,d),y=n}}const A=y&&m;d.middleVertex=A;let P=A?e:l?"butt":r;if(A&&"round"===P&&(M<s?P="miter":M<=2&&(P="fakeround")),"miter"===P&&M>i&&!a&&(P="bevel"),"bevel"===P&&(M>2&&(P="flipbevel"),M<i&&(P="miter")),y&&this.updateDistance(y,p),"miter"===P)a?(this.addCurrentVertex(p,g,0,0,d),d.dir=m.sub(p).T(),this.addCurrentVertex(p,v,0,0,d)):(u.S(M),this.addCurrentVertex(p,u,0,0,d),o&&(d.currentNormal=v,this.addCurrentVertex(p,u,0,0,d)));else if("flipbevel"===P){if(M>100)u=v.mult(-1);else{const t=M*g.add(v).mag()/g.sub(v).mag();u.D().S(t*(k?-1:1))}this.addCurrentVertex(p,u,0,0,d),this.addCurrentVertex(p,u.mult(-1),0,0,d)}else if("bevel"===P||"fakeround"===P){const t=-Math.sqrt(M*M-1),n=k?t:0,e=k?0:t;if(y&&this.addCurrentVertex(p,g,n,e,d),"fakeround"===P){const t=Math.round(180*x/Math.PI/20);for(let n=1;n<t;n++){let e=n/t;if(.5!==e){const t=e-.5;e+=e*t*(e-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*t*t+(.848013+b*(.215638*b-1.06021)))}const r=v.sub(g).S(e).F(g).T().S(k?-1:1);this.addHalfVertex(p,r.x,r.y,!1,k,0,d)}}m&&(d.currentNormal=v,this.addCurrentVertex(p,v,-n,-e,d))}else if("butt"===P)this.addCurrentVertex(p,u,0,0,d);else if("square"===P){const t=y?1:-1;this.addCurrentVertex(p,u,t,t,d)}else"round"===P&&(y&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,v,-1,-1,d,!0),this.addCurrentVertex(p,v,0,0,d)));if(!a&&F&&n<h-1){const t=p.dist(m);if(t>2*f){const n=p.add(m.sub(p).S(f/t).j());n.z=p.z,this.updateDistance(p,n),this.addCurrentVertex(n,v,0,0,d),p=n}}}}ensureDataCapacity(t,n,e,r){const i="round"===t?Math.round(e/20)-1:0;super.ensureDataCapacity((6+i)*r,n)}addCurrentVertex(t,n,e,r,i,s=!1){const o=n.x+n.y*e,a=n.y-n.x*e,u=n.y*r-n.x,l=-n.y-n.x*r;let h=0,c=0;if(i.middleVertex){Ou.x=o,Ou.y=a,Cu.x=u,Cu.y=l;const t=i.currentNormal;if(h=ju(t,Ou),0===e&&0===r)c=-h;else{const n=Eu;n.x=t.x,n.y=t.y,n.S(-1),c=ju(n,Cu)}}this.addHalfVertex(t,o,a,s,!1,e,i,h),this.addHalfVertex(t,u,l,s,!0,-r,i,c),this.prevVertex&&Uu(t,this.prevVertex)||(this.prevVertex=t),this.distance>_u/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,e,r,i,s))}addHalfVertex({x:t,y:n,z:e},r,i,s,o,a,u,l){this.fillData(this.data,t,n,e||0,r,i,s,o,1*this.scaledDistance,l);const h=u.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),u.primitiveLength++),o?this.e2=h:this.e1=h}fillData(t,n,e,r,i,s,o,a,u,l){const{lineWidthFn:h,lineStrokeWidthFn:c,lineStrokeColorFn:f,lineColorFn:d,lineOpacityFn:p,lineDxFn:y,lineDyFn:m,linePatternAnimSpeedFn:g,linePatternGapFn:v}=this.st;this.fillPosition(t,n,e,r);let b=Pu*i;b=(Math.sign(b)||1)*((Math.floor(Math.abs(b))>>1<<1)+ +o);let w=Pu*s;w=(Math.sign(w)||1)*((Math.floor(Math.abs(w))>>1<<1)+ +a);let M=t.aExtrude.currentIndex;t.aExtrude[M++]=b,t.aExtrude[M++]=w,(this.iconAtlas||this.hasDasharray)&&(t.aExtrude[M++]=Pu*l),t.aExtrude.currentIndex=M,M=t.aLinesofar.currentIndex,t.aLinesofar[M++]=u,t.aLinesofar.currentIndex=M,h&&(M=t.aLineWidth.currentIndex,t.aLineWidth[M++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=M),c&&(M=t.aLineStrokeWidth.currentIndex,t.aLineStrokeWidth[M++]=Math.round(2*this.feaLineStrokeWidth),t.aLineStrokeWidth.currentIndex=M),d&&(M=t.aColor.currentIndex,t.aColor[M++]=this.feaColor[0],t.aColor[M++]=this.feaColor[1],t.aColor[M++]=this.feaColor[2],t.aColor[M++]=this.feaColor[3],t.aColor.currentIndex=M),f&&(M=t.aStrokeColor.currentIndex,t.aStrokeColor[M++]=this.feaStrokeColor[0],t.aStrokeColor[M++]=this.feaStrokeColor[1],t.aStrokeColor[M++]=this.feaStrokeColor[2],t.aStrokeColor[M++]=this.feaStrokeColor[3],t.aStrokeColor.currentIndex=M),p&&(M=t.aOpacity.currentIndex,t.aOpacity[M++]=this.feaOpacity,t.aOpacity.currentIndex=M),this.dasharrayFn&&(M=t.aDasharray.currentIndex,t.aDasharray[M++]=this.feaDash[0],t.aDasharray[M++]=this.feaDash[1],t.aDasharray[M++]=this.feaDash[2],t.aDasharray[M++]=this.feaDash[3],t.aDasharray.currentIndex=M),this.dashColorFn&&(M=t.aDashColor.currentIndex,t.aDashColor[M++]=this.feaDashColor[0],t.aDashColor[M++]=this.feaDashColor[1],t.aDashColor[M++]=this.feaDashColor[2],t.aDashColor[M++]=this.feaDashColor[3],t.aDashColor.currentIndex=M),this.iconAtlas&&(M=t.aTexInfo.currentIndex,t.aTexInfo[M++]=this.feaTexInfo[0],t.aTexInfo[M++]=this.feaTexInfo[1],t.aTexInfo[M++]=this.feaTexInfo[2],t.aTexInfo[M++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=M),(y||m)&&(M=t.aLineDxDy.currentIndex,t.aLineDxDy[M++]=this.feaLineDx||0,t.aLineDxDy[M++]=this.feaLineDy||0,t.aLineDxDy.currentIndex=M),(g||v)&&(M=t.aLinePattern.currentIndex,t.aLinePattern[M++]=127*(this.feaPatternAnimSpeed||0),t.aLinePattern[M++]=10*(this.feaLinePatternGap||0),t.aLinePattern.currentIndex=M),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}addElements(t,n,e){super.addElements(this.offset+t,this.offset+n,this.offset+e)}zt(t){const n=this.options.EXTENT,e=this.elements;for(let r=0;r<e.length;r+=3)if(n===1/0||!Tu(this.data.aPosition,e[r],e[r+1],3,n)&&!Tu(this.data.aPosition,e[r+1],e[r+2],3,n)){let n=t.currentIndex;t[n++]=e[r],t[n++]=e[r+1],t[n++]=e[r+2],t.currentIndex=n}}jt(t){if(t.length<=1)return t;const n=[],e=this.options.EXTENT;let r,i=!0;for(r=0;r<t.length-1;r++){const s=$u(t[r],t[r+1],e);s&&i||(n.push(t[r]),i=s)}return i||n.push(t[r]),n}updateDistance(t,n){if(this.options.isTube){const e=t.dist(n),r=Or(this.options)*(n.z-t.z);this.distance+=Math.sqrt(e*e+r*r)}else this.distance+=t.dist(n);this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(_u-1):this.distance}}function $u(t,n,e){return e!==1/0&&(t.x<0&&n.x<0||t.x>e&&n.x>e||t.y<0&&n.y<0||t.y>e&&n.y>e)}function Tu(t,n,e,r,i){if(i===1/0)return!1;const s=Math.floor(.5*t[n*r]),o=Math.floor(.5*t[n*r+1]),a=Math.floor(.5*t[e*r]),u=Math.floor(.5*t[e*r+1]);return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function Du(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}const zu=new dt(0,0);function ju(t,n){const e=t.mag(),r=n.mag(),i=t.angleTo(zu),s=n.angleTo(zu);return Math.sign(s-i)*Math.sqrt(r*r-e*e)}function Uu(t,n){return t.equals(n)&&t.z===n.z}class Nu extends Iu{constructor(t,n,e){super(t,n,e),this.Ut=e.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.st,e=[{type:this.maxPosZ>=Math.pow(2,15)?Float32Array: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&&e.push({type:Uint8Array,width:4,name:"aColor"}),n&&e.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.Ut&&e.push({type:Float32Array,width:1,name:"aLineHeight"}),e}placeVector(t){const n=t.feature;if(this.Ut){const{altitudeScale:t,altitudeProperty:e,defaultAltitude:r,heightProperty:i,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:u}=ir(n,t,e,r,i,s,o);this.feaAltitude=a,this.feaMinHeight=(a-u)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}needAltitudeAttribute(){return!1}Tt(t,n,e,r,i,s){const o=this.data.aPosition.getLength()/3;super.Tt(t,n,e,r,i,s);const a=this.data.aPosition.getLength()/3,u=this.data.aPosition.getLength()/3-this.offset;if(3!==n.type&&u>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[o*r+3*r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*n+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*(n+3)+t];r.currentIndex=s}super.addElements(t+1,u+1,u),super.addElements(u,u+1,u+2);const r=this.data.aPosition.getLength()/3-this.offset;e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[a*r-r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-i+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-3*i+t];r.currentIndex=s}super.addElements(r,u-3,r+1),super.addElements(u-3,r+2,r+1)}}fillData(t,n,e,r,i,s,o,a,u){const l=!1!==this.options.top,h=!1!==this.options.side,c=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),f=Pu*i,d=Pu*s,p=c*i+n,y=c*s+e;this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),h&&(l&&this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(e))}Nt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=32767,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}Lt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=this.feaMinHeight||0,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}addElements(t,n,e){const r=!1!==this.options.top,i=!1!==this.options.side,s=(r?1:0)+(i?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(e*=s)+4]){if(r&&super.addElements(n,t,e),i){const t=r?1:0;super.addElements(n+t,e+t,e+t+2),super.addElements(n+t+1,e+t+1+2,n+t+1+2)}}else if(r&&super.addElements(t,e,n),i){const n=r?1:0;super.addElements(t+n,t+n+2,e+n),super.addElements(t+n+1+2,e+n+1+2,e+n+1)}}createDataPack(t,n){this.maxAltitude=0;const e=super.createDataPack(t,n);if(!e)return e;const{data:r,indices:i}=e;this.getFormat().reduce(((t,n)=>(t[n.name]={size:n.width},t)),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:u,aExtrude:l,aColor:h,aLineHeight:c,aLineWidth:f}=r,d={},p=Jn(s,i);let y,m=!0;for(let t=0;t<p.length;t++)p[t]=-p[t],p[t]%1!=0&&(m=!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)&&(y=function(t,n,e){const r=[];for(let i=0;i<t.length;i+=3){const t=n[i/3];r.push(t/256,e[i/3]?1:0)}return r}(s,a,u)),d.aPosition=o,y&&(d.aTexCoord0=new Float32Array(y)),d.aNormal=m?new Int8Array(p):new Float32Array(p),d.aPickingId=r.aPickingId,d.aExtrude=l,h&&(d.aColor=h),f&&(d.aLineWidth=f),c){const t=yr(this.maxAltitude);d.aLineHeight=new t(c)}const g=[];for(const t in d)g.push(d[t].buffer);return e.data=d,e.buffers=g,e}}const Lu=Math.pow(2,16)/1;class Ru extends Pa{getFormat(){return[...this.getPositionFormat()]}placeVector(t){const n=t.feature,e=3===n.type,r=n.geometry,i=this.elements;e&&(this.elements=this.dt.get());const s=this.needAltitudeAttribute()?2:3;for(let t=0;t<r.length;t++)this.offset=this.data.aPosition.getLength()/s,this.Tt(r[t],n),e&&(this.zt(i),this.elements=this.dt.get());e&&(this.elements=i)}Tt(t,n){const e=3===n.type;let r=t.length;for(;r>=2&&t[r-1].equals(t[r-2]);)r--;let i,s,o,a=0;for(;a<r-1&&t[a].equals(t[a+1]);)a++;if(!(r<(e?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,e&&(i=t[r-2]);for(let n=a;n<r;n++)o=e&&n===r-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(i&&(s=i),i=t[n],s&&(this.distance+=i.dist(s)),this.addCurrentVertex(i,this.distance))}}addCurrentVertex(t,n){const e=this.vertexLength++;this.addLineVertex(this.data,t,n),e>=1&&this.addElements(e-1,e),n>Lu&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){this.fillPosition(t,n.x,n.y,n.z||0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){this.maxIndex=Math.max(this.maxIndex,this.offset+t,this.offset+n);let e=this.elements.currentIndex;this.elements[e++]=this.offset+t,this.elements[e++]=this.offset+n,this.elements.currentIndex=e}zt(t){const n=this.options.EXTENT,e=this.elements,r=e.getLength();for(let i=0;i<r;i+=2)if(!er(this.data.aPosition,e[i],e[i+1],3,n)){let n=t.currentIndex;t[n++]=e[i],t[n++]=e[i+1],t.currentIndex=n}}}const Vu=45*Math.PI/100;class Hu extends Pa{getFormat(){const{markerFillFn:t}=this.st;let n;return n="line"===this.symbol.markerRotationAlignment?[...this.getPositionFormat(),{type:Float32Array,width:1,name:"aXYRotation"},{type:Float32Array,width:1,name:"aZRotation"}]:[...this.getPositionFormat()],t&&n.push({type:Uint8Array,width:4,name:"aColor"}),n}placeVector(t){const n=t.feature.properties,{markerFillFn:e}=this.st;let r;e&&(r=e(this.options.zoom,n)||[255,255,255,255],y(r)?(this.dynamicAttrs.aColor=1,r=[0,0,0,0]):r=Ir([],r));const i=this.data,s="line"===this.symbol.markerRotationAlignment,o=this.Ot(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point",s);for(let t=0;t<o.length;t++){const n=o[t];if(this.fillPosition(this.data,n.x,n.y,n.z),s){let t=i.aXYRotation.currentIndex;i.aXYRotation[t++]=n.xyRotation||0,i.aXYRotation.currentIndex=t,t=i.aZRotation.currentIndex,i.aZRotation[t++]=n.zRotation||0,i.aZRotation.currentIndex=t}if(r){let t=i.aColor.currentIndex;i.aColor[t++]=r[0],i.aColor[t++]=r[1],i.aColor[t++]=r[2],i.aColor[t++]=r[3],i.aColor.currentIndex=t}const e=Math.max(Math.abs(n.x),Math.abs(n.y));e>this.maxPos&&(this.maxPos=e)}}Ot(t,n,e,r){const i=t.feature,s=this.options.EXTENT;if("line"===e){const t=[];let e=i.geometry;s&&(e=ou(i.geometry,0,0,s,s));for(let r=0;r<e.length;r++){const i=lu(e[r],n,Vu,null,0,24,1,1,s||1/0);t.push.apply(t,i)}return t}return bu(i,e,s,r,this.options.altitudeToTileScale)}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const qu=[],Gu=[];function Ju(t,n){var e,r,i,s,o,a,u;for(r=1;r<=8;r*=2){for(e=[],s=!(Bu(i=t[t.length-1],n)&r),o=0;o<t.length;o++){if((u=!(Bu(a=t[o],n)&r))!==s){const t=Wu(i,a,r,n);e.push(void 0!==a.x?new dt(t[0],t[1]):t)}u&&e.push(a),i=a,s=u}if(!(t=e).length)break}return e}function Wu(t,n,e,r){return qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y,t=qu,Gu[0]=void 0===n.x?n[0]:n.x,Gu[1]=void 0===n.y?n[1]:n.y,n=Gu,8&e?[t[0]+(n[0]-t[0])*(r[3]-t[1])/(n[1]-t[1]),r[3]]:4&e?[t[0]+(n[0]-t[0])*(r[1]-t[1])/(n[1]-t[1]),r[1]]:2&e?[r[2],t[1]+(n[1]-t[1])*(r[2]-t[0])/(n[0]-t[0])]:1&e?[r[0],t[1]+(n[1]-t[1])*(r[0]-t[0])/(n[0]-t[0])]:null}function Bu(t,n){qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y;var e=0;return(t=qu)[0]<n[0]?e|=1:t[0]>n[2]&&(e|=2),t[1]<n[1]?e|=4:t[1]>n[3]&&(e|=8),e}const Xu=[0,0,0,0],Yu=-9999999;class Ku extends Pa{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getPolygonResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const t=[...this.getPositionFormat()],{polygonFillFn:n,polygonOpacityFn:e,uvScaleFn:r,uvOffsetFn:i,polygonPatternUVFn:s}=this.st;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"}),e&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),i&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),s&&t.push({type:Float32Array,width:2,name:"aTexCoord"}),t}placeVector(t,n){const e=t.feature;this.Rt(e.geometry,e,n)}Rt(t,n){let e,r,i,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:u,uvOffsetFn:l,uvOffsetInMeterFn:h,polygonPatternUVFn:c}=this.st,f=n.properties;o&&(e=o(this.options.zoom,f)||ze([],255,255,255,255),y(e)?(this.dynamicAttrs.aColor=1,e=Xu):e=Ir([],e)),a&&(r=a(this.options.zoom,f),y(r)?(this.dynamicAttrs.aOpacity=1,r=255):(wr(r)&&(r=1),r*=255)),u&&(i=u(this.options.zoom,f),y(i)?(i=[255,255],this.dynamicAttrs.aUVScale=1):(wr(i)&&(i=[1,1]),i=[255*i[0],255*i[1]])),l&&(h&&h(null,f)?s=[0,0]:(s=l(this.options.zoom,f),y(s)?(s=[0,0],this.dynamicAttrs.aUVOffset=1):(wr(s)&&(s=[0,0]),s=[255*s[0],255*s[1]])));const d=!!this.iconAtlas,p=fu(t,500),m=[0,0],g=[0,0];if(d){const{polygonPatternFileFn:t}=this.st,n=t?t(null,f):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n],e=!lr(t.displaySize[0])||!lr(t.displaySize[1]);m[0]=t.tl[0]+(e?1:0),m[1]=t.tl[1]+(e?1:0),g[0]=t.displaySize[0]-1-(e?2:0),g[1]=t.displaySize[1]-1-(e?2:0)}}let v,b=0;c&&(v=c(this.options.zoom,f));const w=this.needAltitudeAttribute()?2:3,M=[-1,-1,n.extent+1,n.extent+1],x=this.Vt=this.Vt||this.dt.getProxy(),F=this.Ht=this.Ht||this.dt.getProxy();for(let t=0;t<p.length;t++){const n=p[t],o=this.data.aPosition.getLength()/w;x.setLength(0),F.setLength(0);for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&0===this.maxPosZ&&(o=Ju(o,M)),0===o.length)continue;0!==t&&F.push(x.length/3),this.ensureDataCapacity(o.length);const a=this.data;for(let t=0;t<o.length;t++){const n=o[t].x,u=o[t].y,l=o[t].z||0;if(this.fillPosition(this.data,n,u,l),d){let t=a.aTexInfo.currentIndex;a.aTexInfo[t++]=m[0],a.aTexInfo[t++]=m[1],a.aTexInfo[t++]=g[0],a.aTexInfo[t++]=g[1],a.aTexInfo.currentIndex=t}if(void 0!==e){let t=a.aColor.currentIndex;a.aColor[t++]=e[0],a.aColor[t++]=e[1],a.aColor[t++]=e[2],a.aColor[t++]=e[3],a.aColor.currentIndex=t}if(void 0!==r){let t=a.aOpacity.currentIndex;a.aOpacity[t++]=r,a.aOpacity.currentIndex=t}if(void 0!==i){let t=a.aUVScale.currentIndex;a.aUVScale[t++]=i[0],a.aUVScale[t++]=i[1],a.aUVScale.currentIndex=t}if(void 0!==s){let t=a.aUVOffset.currentIndex;a.aUVOffset[t++]=s[0],a.aUVOffset[t++]=s[1],a.aUVOffset.currentIndex=t}if(c){let t=a.aTexCoord.currentIndex;if(v){const n=wr(v[2*b])?v[0]:v[2*b],e=wr(v[2*b]+1)?v[1]:v[2*b+1];a.aTexCoord[t++]=n,a.aTexCoord[t++]=e}else a.aTexCoord[t++]=Yu,a.aTexCoord[t++]=Yu;a.aTexCoord.currentIndex=t,b++}const h=Math.abs(n),f=Math.abs(u);h>this.maxPos&&(this.maxPos=h),f>this.maxPos&&(this.maxPos=f),x.push(n,u,l)}}let a=Ce(x,F,3);if(x.length&&!a.length){const t=[];for(let n=0;n<x.length;n+=3)t[n]=x[n],t[n+1]=x[n+2],t[n+2]=x[n+1];if(a=Ce(t,F,3),!a.length){for(let n=0;n<x.length;n+=3)t[n]=x[n+1],t[n+1]=x[n+2],t[n+2]=x[n];a=Ce(t,F,3)}}for(let t=0;t<a.length;t+=3)this.addElements(o+a[t],o+a[t+1],o+a[t+2])}}ensureDataCapacity(t){super.ensureDataCapacity(1,t)}}const Zu=[{type:Int16Array,width:3,name:"aPosition"}];class Qu extends Pa{getFormat(){return Zu}placeVector(t,n){const e=this.Ot(t,n);if(0===e.length)return;const r=this.data,i=this.getAltitude(t.feature.properties);let s=r.aPosition.getLength()/Zu[0].width;for(let t=0;t<e.length;t++){const n=e[t];r.aPosition.push(2*n.x+0,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+1,i),r.aPosition.push(2*n.x+0,2*n.y+1,i),this.addElements(s,s+1,s+2),this.addElements(s,s+2,s+3),s+=4;const o=Math.max(Math.abs(2*n.x+1),Math.abs(2*n.y+1));o>this.maxPos&&(this.maxPos=o)}}Ot(t,n){const{feature:e,symbol:r}=t,i=this.$t(t,r),s=e.properties,{markerSpacingFn:o}=this.st,a=((o?o(null,s):r.markerSpacing)||250)*n;return vu(t,null,null,n,this.options.EXTENT,i,a)}$t(t,n){return this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement}}class tl extends Iu{constructor(t,n,e){(n=br({},n)).lineJoin="miter",n.lineCap="butt",super(t,n,e),this.options.radialSegments%2==1&&this.options.radialSegments--}getFormat(){const{lineWidthFn:t,lineColorFn:n,lineOpacityFn:e,linePatternAnimSpeedFn:r,linePatternGapFn:i}=this.st,s=[...this.getPositionFormat(),{type:Int8Array,width:4,name:"aTubeNormal"},{type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}];if(this.iconAtlas){s.push({type:Int8Array,width:1,name:"aNormalDistance"});const t=this.getIconAtlasMaxValue();s.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return t&&s.push({type:Uint16Array,width:1,name:"aLineWidth"}),n&&s.push({type:Uint8Array,width:4,name:"aColor"}),e&&s.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&s.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),i&&s.push({type:Int8Array,width:1,name:"aLinePatternGap"}),s}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,r*(this.options.radialSegments/2))}addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,f=this.options.radialSegments/2,{x:d,y:p,z:y}=o.dir,m=function(t,n,e,r,i,s,o,a){Ie(nl,e,r,i),Ie(el,s,o,0),Te(rl,nl,el),$e(el,el),$e(rl,rl),il[n]||(il[n]=[]);const u=il[n];for(var l=0;l<n;l++){const t=Math.PI*l/n,e=1-Math.abs(t-0)/(Math.PI/2);u[l]=u[l]||[],sl(el,rl,u[l],1,t,e*(a?-1:1))}return u}(0,f,d,p,y,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,m,i,c,a)}fillTubeElements(t){const n=this.options.radialSegments/2,e=this.needAltitudeAttribute()?2:3,r=this.data.aPosition.getLength()/e;for(let e=0;e<n;e++){const i=e+r-2*n;let s,o;e===n-1&&t?(s=e+r-2*n+1,o=e+r-2*n-2*n+1):(s=e+r+1,o=e+r+1-2*n),super.addElements(e+r-this.offset,s-this.offset,i-this.offset),super.addElements(i-this.offset,s-this.offset,o-this.offset)}}fillData(t,n,e,r,i,s,o,a){const{lineWidthFn:u,lineColorFn:l,lineOpacityFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=i.length;for(let s=0;s<d;s++){this.fillPosition(t,n,e,r),Ue(i[s],i[s],Pu);let d=t.aTubeNormal.currentIndex;for(let n=0;n<i[s].length;n++)t.aTubeNormal[d++]=i[s][n];if(t.aTubeNormal.currentIndex=d,d=t.aLinesofar.currentIndex,t.aLinesofar[d++]=o,t.aLinesofar.currentIndex=d,this.iconAtlas&&(d=t.aNormalDistance.currentIndex,t.aNormalDistance[d++]=Pu*a,t.aNormalDistance.currentIndex=d,d=t.aTexInfo.currentIndex,t.aTexInfo[d++]=this.feaTexInfo[0],t.aTexInfo[d++]=this.feaTexInfo[1],t.aTexInfo[d++]=this.feaTexInfo[2],t.aTexInfo[d++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=d),u){const n=Cr(this.options.metric);let e=this.feaLineWidth*n;isNaN(e)&&(e=0),d=t.aLineWidth.currentIndex,t.aLineWidth[d++]=Math.round(e),t.aLineWidth.currentIndex=d}l&&(d=t.aColor.currentIndex,t.aColor[d++]=this.feaColor[0],t.aColor[d++]=this.feaColor[1],t.aColor[d++]=this.feaColor[2],t.aColor[d++]=this.feaColor[3],t.aColor.currentIndex=d),h&&(d=t.aOpacity.currentIndex,t.aOpacity[d++]=this.feaOpacity,t.aOpacity.currentIndex=d),c&&(d=t.aLinePatternAnimSpeed.currentIndex,t.aLinePatternAnimSpeed[d++]=127*(this.feaPatternAnimSpeed||0),t.aLinePatternAnimSpeed.currentIndex=d),f&&(d=t.aLinePatternGap.currentIndex,t.aLinePatternGap[d++]=10*(this.feaLinePatternGap||0),t.aLinePatternGap.currentIndex=d)}this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}createDataPack(t,n){const e=super.createDataPack(t,n);return e&&(e.is2D=!1),e}}const nl=[],el=[],rl=[],il={};function sl(t,n,e,r,i,s){return ze(e,r*(Math.cos(i)*t[0]+Math.sin(i)*n[0]),r*(Math.cos(i)*t[1]+Math.sin(i)*n[1]),r*(Math.cos(i)*t[2]+Math.sin(i)*n[2]),s),e}class ol extends tl{addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,{x:f,y:d,z:p}=o.dir,y=function(t,n,e,r,i,s,o,a){Ie(ul,e,r,i),Ie(ll,s,o,0),Te(hl,ul,ll),$e(ll,ll),$e(hl,hl),Le(al,t,n);const u=Ve(al)/t,l=Math.atan(n/t);let h=Math.PI/2+(Math.PI/2-l);return cl[0]||(cl[0]=[]),sl(ll,hl,cl[0],u,h,a?1:-1),h+=2*l,cl[1]||(cl[1]=[]),sl(ll,hl,cl[1],u,h,a?1:-1),cl}(this.feaLineWidth,this.feaLineHeight,f,d,p,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,y,i,c,a)}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,2*r)}}const al=[],ul=[],ll=[],hl=[],cl=[];class fl{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}}\n/*!\n * based on @mapbox/tiny-sdf\n * https://github.com/mapbox/tiny-sdf\n * @License BSD 2-Clause\n */var dl=1e20;function pl(t,n,e,r,i,s,o){this.fontSize=t||24,this.buffer=void 0===n?3:n,this.cutoff=r||.25,this.fontFamily=i||"sans-serif",this.fontWeight=s||"normal",this.fontStyle=o||"normal",this.radius=e||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas="undefined"==typeof document?new OffscreenCanvas(a,a):document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0}),this.ctx.font=this.fontStyle+" "+this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function yl(t,n,e,r,i,s){for(var o=0;o<n;o++)ml(t,o,n,e,r,i,s);for(var a=0;a<e;a++)ml(t,a*n,1,n,r,i,s)}function ml(t,n,e,r,i,s,o){var a,u,l,h;for(s[0]=0,o[0]=-dl,o[1]=dl,a=0;a<r;a++)i[a]=t[n+a*e];for(a=1,u=0,l=0;a<r;a++){do{l=(i[a]-i[h=s[u]]+a*a-h*h)/(a-h)/2}while(l<=o[u]&&--u>-1);s[++u]=a,o[u]=l,o[u+1]=dl}for(a=0,u=0;a<r;a++){for(;o[u+1]<a;)u++;t[n+a*e]=i[h=s[u]]+(a-h)*(a-h)}}pl.prototype.draw=function(t,n,e){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.textBaseline="top",this.ctx.fillText(t,this.buffer,this.buffer);for(var r=this.ctx.getImageData(0,0,n,e),i=new Uint8ClampedArray(n*e),s=0;s<n*e;s++){var o=r.data[4*s+3]/255;this.gridOuter[s]=1===o?0:0===o?dl:Math.pow(Math.max(0,.5-o),2),this.gridInner[s]=1===o?dl:0===o?0:Math.pow(Math.max(0,o-.5),2)}for(yl(this.gridOuter,n,e,this.f,this.v,this.z),yl(this.gridInner,n,e,this.f,this.v,this.z),s=0;s<n*e;s++){var a=Math.sqrt(this.gridOuter[s])-Math.sqrt(this.gridInner[s]);i[s]=Math.round(255-255*(a/this.radius+this.cutoff))}return i};let gl=0;class vl{constructor(t,n=15,e,r){this.entries={},this.qt={},this.Gt=new fl(2048,(function(){})),this.Jt=t,this.Wt=n,this.Bt=e,this.Xt=r}Yt(t){return t&&t.indexOf("{stack}")>=0&&t.indexOf("{range}")>0}getGlyphs(t,n){if(!t||!Object.keys(t).length)return void n(null,{glyphs:null});if(this.Yt(this.Xt))return void this.Kt(t,n);const e=this.entries,r=t.options;let i=!0;r&&(i=!1!==r.isCharsCompact),i=i||this.Bt;const s=(r,s,a)=>{let u=0,l=0;for(const n in t)if("options"!==n){e[n]=e[n]||{},s[n]=s[n]||{};for(const h in t[n]){if(l++,l<=r)continue;const t=i&&!Na(+h),c=n+":"+h+":"+t;let f;if(this.Gt.has(c)?f=this.Gt.get(c):(f=this.Zt(e[n],n,h,t),this.Gt.add(c,f),u++),f=bl(f),s[n][h]=f,a.push(f.bitmap.data.buffer),this.Jt&&u>this.Wt)return void this.Jt(o(l,s,a))}}n(null,{glyphs:s,buffers:a})};function o(t,n,e){return()=>{s(t,n,e)}}s(0,{},[])}Kt(t,n){const e=[];for(const n in t)for(const r of t[n])e.push(this.Qt(n,r));Promise.all(e).then((t=>{n(null,t)}))}Qt(t,n){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=e.glyphs[n];if(r)return Promise.resolve({font:t,charCode:n,glyph:r});const i=Math.floor(n/256);if(256*i>65535)return Promise.reject(new Error("glyphs > 65535 not supported"));e.requests[i].push(((t,n)=>{if(t)return t;n&&fnCallback(null,{stack:stack,id:id,glyph:n.glyphs[id]||null})}))}Zt(t,n,e,r){const i=n;let s=t.tinySDF;const o=r?-1:2;if(!s){let n="400";/bolder/i.test(i)?n="1000":/bold/i.test(i)?n="900":/medium/i.test(i)?n="500":/light/i.test(i)&&(n="200"),s=t.tinySDF=new pl(24,2,8,.25,i,n)}const a=String.fromCodePoint(e),u=s.ctx.measureText(a),l=Math.round(u.width),h=s.draw(a,l+4,28);if(gl<4){const t="undefined"!=typeof document&&document.getElementById("sdf-debug-"+gl++);t&&(t.width=l+4,t.height=s.canvas.height,t.getContext("2d").drawImage(s.canvas,0,0))}return{charCode:e,bitmap:{width:l+4,height:28,data:h},metrics:{width:l,height:24,left:1,top:-2,advance:l+2+o}}}}function bl(t){const n={width:t.bitmap.width,height:t.bitmap.height,data:new Uint8ClampedArray(t.bitmap.data)};return{charCode:t.charCode,bitmap:n,metrics:br({},t.metrics)}}var wl=Object.freeze({__proto__:null,calculateSignedArea:nr,clipPolygon:Ju,convertGeometry:vr,convertRTLText:eu,generatePickingIndiceIndex:ur,getFeaAltitudeAndHeight:ir,getIndexArrayType:pr,getPosArrayType:yr,getUnsignedArrayType:mr,packPosition:jr,unpackPosition:function(t,n,e,r){const i=(Math.sign(n)||1)*(Math.abs(n)%Ur),s=(Math.sign(e)||1)*(Math.abs(e)%Ur),o=Math.floor(Math.abs(n)/Ur),a=Math.floor(Math.abs(e)/Ur);return t[0]=i,t[1]=s,t[2]=Math.sign(r+1e-5)*(2*o+a)*Nr+r,t}});var Ml={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,r,i){var s,o,a=8*i-r-1,u=(1<<a)-1,l=u>>1,h=-7,c=e?i-1:0,f=e?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-h)-1,d>>=-h,h+=a;h>0;s=256*s+t[n+c],c+=f,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+t[n+c],c+=f,h-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=l}return(d?-1:1)*o*Math.pow(2,s-r)},write:function(t,n,e,r,i,s){var o,a,u,l=8*s-i-1,h=(1<<l)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,y=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=h):(o=Math.floor(Math.log(n)/Math.LN2),n*(u=Math.pow(2,-o))<1&&(o--,u*=2),(n+=o+c>=1?f/u:f*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(n*u-1)*Math.pow(2,i),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[e+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;t[e+d]=255&o,d+=p,o/=256,l-=8);t[e+d-p]|=128*y}},xl=kl,Fl=Ml;function kl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}kl.Varint=0,kl.Fixed64=1,kl.Bytes=2,kl.Fixed32=5;var Al=4294967296,Pl=1/Al,Sl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function _l(t){return t.type===kl.Bytes?t.readVarint()+t.pos:t.pos+1}function Ol(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function Cl(t,n,e){var r=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(r);for(var i=e.pos-1;i>=t;i--)e.buf[i+r]=e.buf[i]}function El(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function Il(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function $l(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Tl(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function Dl(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function zl(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function jl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Ul(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function Nl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function Ll(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Rl(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Vl(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}kl.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var r=this.readVarint(),i=r>>3,s=this.pos;this.type=7&r,t(i,n,this),this.pos===s&&this.skip(r)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ll(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Vl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ll(this.buf,this.pos)+Ll(this.buf,this.pos+4)*Al;return this.pos+=8,t},readSFixed64:function(){var t=Ll(this.buf,this.pos)+Vl(this.buf,this.pos+4)*Al;return this.pos+=8,t},readFloat:function(){var t=Fl.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Fl.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,r=this.buf;return n=127&(e=r[this.pos++]),e<128?n:(n|=(127&(e=r[this.pos++]))<<7,e<128?n:(n|=(127&(e=r[this.pos++]))<<14,e<128?n:(n|=(127&(e=r[this.pos++]))<<21,e<128?n:function(t,n,e){var r,i,s=e.buf;if(r=(112&(i=s[e.pos++]))>>4,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<3,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<10,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<17,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<24,i<128)return Ol(t,r,n);if(r|=(1&(i=s[e.pos++]))<<31,i<128)return Ol(t,r,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=r[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&&Sl?function(t,n,e){return Sl.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){for(var r="",i=n;i<e;){var s,o,a,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h>e)break;1===h?u<128&&(l=u):2===h?128==(192&(s=t[i+1]))&&(l=(31&u)<<6|63&s)<=127&&(l=null):3===h?(o=t[i+2],128==(192&(s=t[i+1]))&&128==(192&o)&&((l=(15&u)<<12|(63&s)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):4===h&&(o=t[i+2],a=t[i+3],128==(192&(s=t[i+1]))&&128==(192&o)&&128==(192&a)&&((l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=h}return r}(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!==kl.Bytes)return t.push(this.readVarint(n));var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==kl.Bytes)return t.push(this.readSVarint());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==kl.Bytes)return t.push(this.readBoolean());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==kl.Bytes)return t.push(this.readFloat());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==kl.Bytes)return t.push(this.readDouble());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===kl.Varint)for(;this.buf[this.pos++]>127;);else if(n===kl.Bytes)this.pos=this.readVarint()+this.pos;else if(n===kl.Fixed32)this.pos+=4;else{if(n!==kl.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 e=new Uint8Array(n);e.set(this.buf),this.buf=e,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),Rl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,r;if(t>=0?(e=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;n.buf[n.pos++]|=e|((t>>>=3)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t)))))}(r,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,e){for(var r,i,s=0;s<n.length;s++){if((r=n.charCodeAt(s))>55295&&r<57344){if(!i){r>56319||s+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):i=r;continue}if(r<56320){t[e++]=239,t[e++]=191,t[e++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[e++]=239,t[e++]=191,t[e++]=189,i=null);r<128?t[e++]=r:(r<2048?t[e++]=r>>6|192:(r<65536?t[e++]=r>>12|224:(t[e++]=r>>18|240,t[e++]=r>>12&63|128),t[e++]=r>>6&63|128),t[e++]=63&r|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&Cl(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),Fl.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Fl.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 e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var r=this.pos-e;r>=128&&Cl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,n,e){this.writeTag(t,kl.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,El,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,Il,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,Dl,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,$l,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Tl,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,zl,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,jl,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Ul,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,Nl,n)},writeBytesField:function(t,n){this.writeTag(t,kl.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,kl.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,kl.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Hl=function(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(xl);const ql={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textFaceName: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},ql),Object.assign({lineDasharray:1,topPolygonFill:1,bottomPolygonFill:1},ql);const Gl=Math.PI/180,Jl=6378137*Math.PI/180,Wl=85.0511287798;function Bl(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=Wl,r=n[0],i=Math.max(Math.min(e,n[1]),-e);let s;s=0===i?0:Math.log(Math.tan((90+i)*Gl/2))/Gl;return t[0]=r*Jl,t[1]=s*Jl,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Xl(t,n);if("baidu"===e)return Xl(t,n);throw new Error("unsupported projection:"+e)}function Xl(t,n){return t[0]=n[0],t[1]=n[1],t}function Yl(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){0===t?function(t,n,e,r,i,s,o,a,u,l){const h=1/(100*s[0]),c=1/(100*s[1]),f=l&&l[0]||0,d=l&&l[1]||0,p=[0,0];for(let i=t;i<n;i+=3){const t=i/3*2,n=r[i]-f,s=r[i+1]-d;e[t]=p[0]+n/o*h/a,e[t+1]=p[1]-s/o*c/u}}(n,e,r,i,0,o,a,u,l,p):1===t&&function(t,n,e,r,i,s,o,a,u,l,h){if(!t)return;let c,f,d,p;0===t[4]?(c=t[0],f=t[1],d=t[2],p=t[3]):(c=t[1],f=t[2],d=t[3],p=t[0]);const y=Re(c,f),m=Re(f,d),g=[],v=[],b=[];for(let t=n;t<e;t+=3){const n=t/3*2;Le(g,(s.x/u+i[t]/o)*a,s.y/u*a+(h?i[t+1]:-i[t+1])/o*a),"EPSG:4326"!==l&&"EPSG:4490"!==l||Bl(g,g,"EPSG:3857"),Kl(v,g,c,f),Kl(b,g,p,c),r[n]=Re(c,v)/y,r[n+1]=Re(c,b)/m}}(h,n,e,r,i,s,a,c,f,d,!!p)}function Kl(t,n,e,r){const i=e[0]-r[0],s=e[1]-r[1];let o=(n[0]-e[0])*(e[0]-r[0])+(n[1]-e[1])*(e[1]-r[1]);return o/=i*i+s*s,t[0]=e[0]+o*i,t[1]=e[1]+o*s,t}function Zl(t,n,e,r,i){const s=3*n[e-1],o=3*n[e-1]+1,a=t[s],u=t[o];return l=r,h=i,c=a,f=u,Math.sqrt((c-l)*(c-l)+(f-h)*(f-h));var l,h,c,f}const Ql="__fea_idx";new Float32Array([-1e12])[0];const th="maptalks_ombb";function nh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m){const g=n.getLength(),v=i/3;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-o;i+=g;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-a;i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,(e=e||[]).push(g/3);const b=e.getLength();for(let n=0;n<b;n++){eh(v+(e[n-1]||0),v+e[n],t,g/3,u,r,l,h,c,f,s,d,p,y,m)}return i}function eh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){const y=s.getLength();let m,g;for(let o=t,a=n;o<a-1;o++)if(m=o,g=o+1,i===1/0||!lt(e,m,g,i))if((o-t)%2==1&&(m+=2*r,g+=2*r),p){let t=s.currentIndex;s[t++]=m+r,s[t++]=g,s[t++]=m,s[t++]=g+r,s[t++]=g,s[t++]=m+r,s.currentIndex=t}else{let t=s.currentIndex;s[t++]=m+r,s[t++]=m,s[t++]=g,s[t++]=g,s[t++]=g+r,s[t++]=m+r,s.currentIndex=t}o&&function(t,n,e,r,i,s,o,a,u,l,h,c){let f,d=0,p=0,y=0,m=0;const g=c?[1,3,4]:[2,3,4];for(let c=s.getLength()-1;c>=o;c--){const o=s[c],v=3*o+1,b=3*o+2,w=i[3*o],M=i[v],x=i[b];d||p||(d=Math.max(i[b],i[3*s[c-3]+2]),p=Math.min(i[b],i[3*s[c-3]+2]),f=d-p);let F=y;const k=c%6;0===t?(5===k&&(m=Zl(i,s,c,w,M)),F=k===g[0]||k===g[1]||k===g[2]?y:y+m):1===t&&(k===g[0]||k===g[1]||k===g[2]?F=0:5===k?(m=Zl(i,s,c,w,M),F=m):F=m);const A=F/l*(1/(100*h))/a;let P;P=1===n?x===d?1:0:"bottom"===e?x===d?f/100/u:0:x===d?0:-f/100/u,r[2*o]=A,r[2*o+1]=P,0===k&&(y+=m)}}(a,u,l,h,e,s,y,c[0],c[1],f,d,p)}function rh(t){const n=[t[0]];let e=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===e[0]&&t[r][1]===e[1]&&t[r][2]===e[2]||n.push(t[r]):t[r].x===e.x&&t[r].y===e.y&&t[r].z===e.z||n.push(t[r]),e=t[r];return n}const ih=ga.getInstance();function sh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,v){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),ih.reset();const{altitudeScale:b,altitudeProperty:w,defaultAltitude:M,heightProperty:x,minHeightProperty:F,defaultHeight:A,tangent:P,uv:S,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,top:I,side:$,textureYOrigin:T,topThickness:D}=n,z=function(t,n,{altitudeScale:e,altitudeProperty:r,defaultAltitude:i,heightProperty:s,minHeightProperty:o,defaultHeight:a},{center:u,side:l,top:h,topThickness:c,uvOrigin:f,uv:d,uvSize:p,topUVMode:y,sideUVMode:m,sideVerticalUVMode:g,textureYOrigin:v,tileRatio:b,centimeterToPoint:w,verticalCentimeterToPoint:M,positionType:x,res:F,glScale:A,projectionCode:P},S,_){let O=n/t[0].extent;n===1/0&&(O=1);const C=n===1/0,E=_.get(),I=_.get(),$=_.get(),T=_.getProxy(),D=_.get(),z=_.get(),j=_.get(),U=!!d,N=!!h,L=!!l,R=U?_.get():null;function V(t,e,r,i,s,o){let a=e;if(N){const i=Ce(T,r,3);if(0===i.length)return e;let l=T.getLength(),h=D.currentIndex;for(let t=0;t<l;t++)D[h++]=T[t];if(D.currentIndex=h,e+=T.getLength(),o)for(let n=2,e=i.length;n<e;n+=3)i[n]+=t/3,i[n-1]+=t/3,i[n-2]+=t/3;else{let n;for(let e=2,r=i.length;e<r;e+=3)n=i[e-1],i[e-1]=i[e]+t/3,i[e]=n+t/3,i[e-2]+=t/3}l=i.length,h=z.currentIndex;for(let t=0;t<l;t++)z[h++]=i[t];z.currentIndex=h,U&&Yl(y||0,t,e,R,D,f,w,b,p[0],p[1],s,F,A,P,u),c>0&&!L&&(e=nh(D,T,r,z,e,R,0,c,n,U,m||0,g||0,v,p,b,M,o)),j.setLength(e/3),j.fill(1,a/3,e/3)}if(L){N&&(c=0),a=e,e=nh(D,T,r,z,e,R,c,i,n,U,m||0,g||0,v,p,b,M,o),j.setLength(e/3);const t=T.getLength()/3;j.fill(1,a/3,a/3+t),j.fill(0,a/3+t,a/3+2*t),j.fill(1,a/3+2*t,a/3+3*t),j.fill(0,a/3+3*t,e/3)}return e}let H=0,q=0;const G=[-1,-1,n+1,n+1];let J=0,W=t.length;k(S)&&(J=S,W=S+1);let B=0,X=!1;const Y=_.getProxy();for(;J<W;J++){const u=t[J],l=u.id;k(l)&&(Math.abs(l)>B&&(B=Math.abs(l)),l<0&&(X=!0));const h=u.geometry,c=u.properties[th];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:d,height:p}=wl.getFeaAltitudeAndHeight(u,e,r,i,s,a,o);H=Math.max(Math.abs(d),H);const y=D.getLength();let m=0,g=q;Y.setLength(0),T.setLength(0);const v=wl.calculateSignedArea(h[0])<0;for(let t=0,e=h.length;t<e;t++){let r=h[t];v&&(r=r.reverse()),r=rh(r);const i=wl.calculateSignedArea(r)<0;if(!i&&t>0&&(m++,f=c&&c[m],q=V(g,q,Y,p*O,f,C),T.setLength(0),Y.setLength(0),g=q),n!==1/0&&(r=wl.clipPolygon(r,G)),!r.length){t===e-1&&(q=V(g,q,Y,p*O,f,C));continue}const s=r.length;if(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]),i){let t=Y.currentIndex;Y[t++]=T.getLength()/3,Y.currentIndex=t}ut(T,T.getLength(),r,O,d,!1,x),t===e-1&&(q=V(g,q,Y,p*O,f,C))}const b=D.getLength()-y,w=(Ql+"").trim();for(let t=0;t<b/3;t++){let t=I.currentIndex;I[t++]=void 0===u[w]?J:u[w],I.currentIndex=t,t=E.currentIndex,E[t++]=J,E.currentIndex=t,k(l)&&(t=$.currentIndex,$[t++]=l,$.currentIndex=t)}}const K=wl.getUnsignedArrayType(I.getLength()?I[I.getLength()-1]:0),Z={maxAltitude:H,vertices:D,verticeTypes:j,indices:z,pickingIds:ga.createTypedArray(I,K),featureIndexes:E};if($.getLength()){const t=X?wl.getPosArrayType(B):wl.getUnsignedArrayType(B);Z.featureIds=ga.createTypedArray($,t)}else Z.featureIds=[];return R&&(R.setLength(D.getLength()/3*2),Z.uvs=R),Z}(t,e,{altitudeScale:b,altitudeProperty:w,defaultAltitude:M||0,heightProperty:x,minHeightProperty:F,defaultHeight:A||0},{center:v,top:I,side:$,topThickness:10*D||0,uv:S||P,uvSize:[i,i],uvOrigin:r,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,textureYOrigin:T,tileRatio:a,centimeterToPoint:u,verticalCentimeterToPoint:l,positionType:p,res:s,glScale:o,projectionCode:f},d,ih),j=[],U=z.vertices.getLength()/3,N=wl.getIndexArrayType(U),L=ga.createTypedArray(z.indices,N);delete z.indices,j.push(L.buffer,z.pickingIds.buffer);const R=wl.getPosArrayType(Math.max(512,z.maxAltitude));z.vertices=ga.createTypedArray(z.vertices,R);const V=P?ih.getProxy():new Float32Array(3*U);V.setLength&&V.setLength(3*U);const H=Jn(z.vertices,L,V);let q=!0;const G=H.getLength?H.getLength():H.length;for(let t=0;t<G;t++){H[t]=-H[t];const n=H[t]%1;1-Math.abs(n)>1e-6?q=!1:0!==n&&(H[t]=Math.round(H[t]))}if(z.normals=H,P){let t=ih.get();t.setLength(4*U),t=function(t,n,e,r,i){const s=(t.getLength?t.getLength():t.length)/3,o=i||new Array(4*s),a=[],u=[];for(let t=0;t<s;t++)a[t]=[0,0,0],u[t]=[0,0,0];const l=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],d=[0,0],p=[0,0],y=[0,0,0],m=[0,0,0];function g(n,r,i){ne(l,t,3*n),ne(h,t,3*r),ne(c,t,3*i),ee(f,e,2*n),ee(d,e,2*r),ee(p,e,2*i);const s=h[0]-l[0],o=c[0]-l[0],g=h[1]-l[1],v=c[1]-l[1],b=h[2]-l[2],w=c[2]-l[2],M=d[0]-f[0],x=p[0]-f[0],F=d[1]-f[1],k=p[1]-f[1],A=1/(M*k-x*F);_n(y,(k*s-F*o)*A,(k*g-F*v)*A,(k*b-F*w)*A),_n(m,(M*o-x*s)*A,(M*v-x*g)*A,(M*w-x*b)*A),On(a[n],a[n],y),On(a[r],a[r],y),On(a[i],a[i],y),On(u[n],u[n],m),On(u[r],u[r],m),On(u[i],u[i],m)}for(let t=0,n=r.length;t<n;t+=3)g(r[t+0],r[t+1],r[t+2]);const v=[],b=[],w=[],M=[];let x,F,k;function A(t){ne(w,n,3*t),Sn(M,w),F=a[t],Sn(v,F),$n(v,v,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(w,w,En(w,F))),Cn(v,v),In(b,M,F),k=En(b,u[t]),x=k<0?-1:1,o[4*t]=v[0],o[4*t+1]=v[1],o[4*t+2]=v[2],o[4*t+3]=x}for(let t=0,n=r.length;t<n;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return o}(z.vertices,z.normals,z.uvs,L,t),t=function(t,n){const e=n.getLength(),r=new Float32Array(e),i=[],s=[],o=[];for(let a=0;a<e;a+=4){const e=a/4*3;Ie(s,t[e]||0,t[e+1]||0,t[e+2]||0),ze(i,n[a]||0,n[a+1]||0,n[a+2]||0,n[a+3]||0),qn(o,s,i),De(r.subarray(a,a+4),o)}return r}(z.normals,t),z.tangents=t,j.push(t.buffer),delete z.normals}if(z.normals&&(q&&(z.normals=ga.createTypedArray(z.normals,Int8Array)),j.push(z.normals.buffer)),z.uvs){const t=z.uvs;z.uvs=ga.createTypedArray(t,Float32Array),j.push(z.uvs.buffer)}const J=function(t,n,e,r){const i={},s={},o=r.getLength();if(_(n.polygonFill)){let a=g(n.polygonFill);const u=new Uint8Array(4*o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aColor=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,Dr.normalizeColor(oh,l),u[4*n]=oh[0],u[4*n+1]=oh[1],u[4*n+2]=oh[2],u[4*n+3]=oh[3]}s.aColor=u}if(_(n.polygonOpacity)){let a=m(n.polygonOpacity);const u=new Uint8Array(o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aOpacity=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,u[n]=255*l}s.aOpacity=u}return s.dynamicAttributes=i,s}(t,h,c,z.featureIndexes),W=function(t,n,e,r,i){const s=[[],[]],o=_(r.topPolygonFill),a=_(r.bottomPolygonFill),u=[255,255,255,255],l=n.getLength();if(o||a){let h=o&&g(r.topPolygonFill),c=a&&g(r.bottomPolygonFill),f=null,d=null,p=null,m=null;for(let r=0;r<l;r++){if(1===t[r]&&!o||0===t[r]&&!a)continue;const l=1===t[r];if(l&&n[r]===f){t[r]=p;continue}if(!l&&n[r]===d){t[r]=m;continue}const v=e[n[r]],b=v.properties||{};b.$layer=v.layer,b.$type=v.type;let w=l?h:c,M=w(i,b);y(M)&&(w=g(M),M=w(i,b)),delete b.$layer,delete b.$type,Dr.normalizeColor(oh,M),je(oh,oh,u);let x=ah(s,oh);x<0&&(x=s.length,s.push(De([],oh))),t[r]=x,l?(f=n[r],p=x):(d=n[r],m=x)}}return s.slice(2)}(z.verticeTypes,z.featureIndexes,t,h,c),B={data:{data:{aVertexColorType:W.length<=252?ga.createTypedArray(z.verticeTypes,Uint8Array):ga.createTypedArray(z.verticeTypes,Uint16Array),aPosition:z.vertices,aNormal:z.normals,aTexCoord0:z.uvs,aTangent:z.tangents,aPickingId:z.pickingIds},indices:L,properties:{maxAltitude:z.maxAltitude},dynamicAttributes:J.dynamicAttributes,vertexColors:W},buffers:j};return z.featureIds.length?(B.data.featureIds=z.featureIds,j.push(B.data.featureIds.buffer)):B.data.featureIds=[],J.aColor&&(B.data.data.aColor=J.aColor,B.buffers.push(J.aColor.buffer)),J.aOpacity&&(B.data.data.aOpacity=J.aOpacity,B.buffers.push(J.aOpacity.buffer)),B.buffers.push(B.data.data.aPosition.buffer),B.data.pickingIdIndiceMap=wl.generatePickingIndiceIndex(B.data.data.aPickingId,B.data.indices),B}const oh=[];function ah(t,n){for(let e=0;e<t.length;e++)if(Ne(n,t[e]))return e;return-1}function uh(t,n,e,r,{altitudeScale:i,altitudeProperty:s,defaultAltitude:o,heightProperty:a,minHeightProperty:u,defaultHeight:l,bottom:h}){const c=h,f=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,r=t.length;n<r;n++){const r=t[n];if(k(r.geometry[0][0]))e+=3*r.geometry.length;else for(let t=0,n=r.geometry.length;t<n;t++){let n=3*r.geometry[t].length;3===r.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,p=[],m=new Int16Array(d),g=new Uint8Array(m.length/3*4);y(e)&&(e=ha.compileFilter(e));const v=[];function b(t,e,r){const i=e-t,s=m.subarray(t,e),o=m.subarray(e,e+i);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-r;const a=t/3,u=i/3;let l,h;for(let t=a,e=u+a;t<e;t++)t<e-1?(l=t,h=t+1):(l=t,h=a),lt(m,l,h,n)||(v.push(l,h),c&&v.push(l+u,h+u),lh(m,l,n)||v.push(l,l+u));return e+i}let w=0,M=0;const x=(Ql+"").trim(),F=[];for(let n=0,h=t.length;n<h;n++){const h=t[n],c=h.geometry;if(e){let t;t="function"==typeof e?e(h&&h.properties):e,Dr.normalizeColor(F,t)}else Ie(F,255,255,255);const d=w/3*4,{altitude:y,height:k}=wl.getFeaAltitudeAndHeight(h,i,s,o,a,l,u);M=Math.max(Math.abs(y),M);let A=w;for(let t=0,n=c.length;t<n;t++){let n=c[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),w=ut(m,A,n,f,y),w=b(A,w,k*f),A=w}const P=A/3*4;for(let t=d;t<P;t+=4)g[t]=F[0],g[t+1]=F[1],g[t+2]=F[2],g[t+3]=255*(r||1);const S=v.length-p.length;for(let t=0;t<S;t++)p.push(h[x])}const A=v.reduce(((t,n)=>Math.max(t,n)),0),P=new(wl.getIndexArrayType(A))(v),S=wl.getUnsignedArrayType(t.length);return{aPosition:new(wl.getPosArrayType(Math.max(512,M)))(m),indices:P,aPickingId:new S(p),aColor:g}}function lh(t,n,e){const r=t[3*n],i=t[3*n+1];return r<0||r>e||i<0||i>e}function hh(t,n,e,r){const i=uh(t,n,e.lineColor,e.lineOpacity,r),s=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],o=i.indices;return delete i.indices,{data:{data:i,indices:o},buffers:s}}let ch=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ch=!0}catch(t){ch=!1}var fh=ch;const dh="__original_properties",ph="__fn-type_properties";class yh{constructor(t,n,e,r,i){this.id=t,this.options=n,this.upload=e,this.tn(n.style),this.requests={},this.Gt=r,this.nn=1,this.loadings=i}updateStyle(t,n){this.options.style=t,this.nn=t.styleCounter,this.tn(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:e,y:r,z:s}=t.tileInfo;let o=!1;for(let t=0;t<i.length;t++)if(e===i[t].x&&r===i[t].y&&s===i[t].z){o=!0;break}if(!o)return void n()}if(e[r])return void e[r].push({context:t,callback:n,ref:this});e[r]=[{context:t,callback:n,ref:this}];const s=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((n,i,o,a)=>{const u=e[r];if(delete e[r],this.checkIfCanceled(r))return delete this.requests[r],void this.en(u,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||s)&&i)for(let n=0;n<i.length;n++)if(this.options.debug&&(i[n]._debug_info={index:n,id:i[n].id,tileId:t.tileInfo.id}),s){const t=P(s)?s[i[n].layer]:s,e=i[n].properties;i[n].id=e&&e[t]||null}if(n)this.en(u,n);else if(i&&i.length){if(u)for(let t=0;t<u.length;t++)this.rn.call(u[t].ref,u[t].context,u[t].callback,r,o,i,a)}else this.en(u)}))}rn(t,n,e,r,i,s){this.sn(r,i,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,s&&x(e.data,s),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.an(t),n()}an(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]}en(t,n,e){if(t)for(let r=0;r<t.length;r++)t[r].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.Gt,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&fh){const r=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));r.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.un||(this.un=new vl),this.un.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));r.push(t)}Promise.all(r).then((t=>{const n={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void e(t[r].err);t[r].iconData?n.icons=t[r].iconData.icons:t[r].glyphData&&(n.glyphs=t[r].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}sn(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=e,s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.hn(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,r=e.length;n<r;n++)t.push(e[n])}t.length}(o,this.featurePlugins);const a={};for(let t=0;t<o.length;t++)xh(n,e.tileInfo.z,o[t],a);const u=[],l=[];for(let t=0;t<n.length;t++){const e=n[t],r=a[t];if(r){l.fill(null);let t=0;for(const n in r){let i=0;const s=r[n].values();for(const t of s){let r=l[i];r||(r=Ph(e),l[i]=r),r.properties[n]=t,i++}i>t&&(t=i)}for(let n=0;n<t;n++)u.push(l[n])}else u.push(e)}const h=(n=u)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},d=[],p=[],y=[],m=this.options,g=[],v={},b=[Promise.resolve(e.styleCounter)];let w=0,M=-1;const F=[];let k=!1;for(let t=0;t<o.length;t++){M++;const r=o[t];r.type!==w&&(M=0,w=r.type);const a=0===r.type?d:p;if(r.symbol&&!1===r.symbol.visible){a[M]=null;continue}Oh(r.symbol,F,t),k=k||F[t]&&F[t].size>0;const{tileFeatures:u,tileFeaIndexes:l}=this.cn(c,r.type,r.filter,n,v,t);if(!u.length){a[M]=null;continue}const m=l[l.length-1],A=wl.getIndexArrayType(m);a[M]={styledFeatures:new A(l)},y.push({idx:t,typeIdx:M}),g.push(a[M].styledFeatures.buffer);const P=x({},e,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:r,z:s}=t[n];if(i.x===e&&i.y===r&&i.z===s){P.debugIndex=t[n].index;break}}}let S=this.dn(u,r,P);s&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=u[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=u[0].layer);return t}))),b.push(S)}return Promise.all(b).then((([e,...r])=>{if(e!==this.nn)return{canceled:!0};function i(t,n){if(void 0===t.data.ref&&(t.data.type=o[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)g.push(t.buffers[n])}for(let t=0;t<r.length;t++){if(!r[t])continue;const n=r[t],e=0===o[y[t].idx].type?d:p;if(Array.isArray(n)){const r=[];for(let e=0;e<n.length;e++)n[e]&&(i(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&r.push(n[e].data));r.length&&(e[y[t].typeIdx].data=r)}else i(n,t),e[y[t].typeIdx].data=n.data}const s={},a=t;if(m.features||m.schema||k){let t,e=!1;for(let r=0,i=n.length;r<i;r++)if(t=n[r],a[t.layer].properties||(a[t.layer].properties=vh(t.properties)),t&&(m.features||k&&v[r]))if("id"===m.features)s[r]=t.id;else{m.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[dh],e.customProps=x({},n),t=e}const i=x({},t);if(k&&v[r]&&(!m.features||"transient"===m.features)){const i=v[r];for(let r=0;r<i.length;r++){const i=F[r];i&&i.forEach((r=>{const i=n?n.properties:t.properties;i[ph]||(i[ph]=new Set),i[ph].add(r),e=!0}))}}s[r]=i}if(e)for(const t in s){const n=s[t],e=n.properties[ph];if(e){delete n.properties[ph],"transient"===m.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===m.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:a,data:d,featureData:p,extent:h,features:s},buffers:g}})).catch((t=>{console.error(t)}))}dn(t,n,e){let r=t;const i=n.renderPlugin.dataConfig,s=n.symbol,o=this.options.tileSize,{extent:a,glScale:u,zScale:l,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:d}=e,p=a/o,y=i.type,m=e.debugIndex;let g=x({},i,{EXTENT:a,zoom:h,debugIndex:m,features:this.options.features});if("3d-extrusion"===y){bh(s)&&(i.uv=1);const t=this.options.projectionCode,n=s.material&&s.material.textureWidth||23.25;return Promise.all([Promise.resolve(sh(r,i,a,c,n,e.tileInfo.res,u,a/this.options.tileSize,f,d,s,h,t,m))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(hh(r,a,s,i))]);if("point"===y){g=x(g,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:l*a/this.options.tileSize/u});const t=ku.splitPointSymbol(s),n=Pa.genFnTypes(t[0]);return ku.needMerge(t[0],n,h)&&(r=ku.mergeLineFeatures(r,t[0],n,h)),Promise.all(t.map(((t,e)=>(0===e?g.fnTypes=n:delete g.fnTypes,new ku(r,t,g).load(p)))))}if("native-point"===y){const t=l*a/this.options.tileSize/u;return g.altitudeToTileScale=t,wh(r,s,g,Hu,a/o)}if("line"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:p}),wh(r,s,g,Iu,1,!0);if("native-line"===y)return wh(r,s,g,Ru,1,!0);if("fill"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this)}),wh(r,s,g,Ku);if("line-extrusion"===y){delete s.lineGradientProperty,s.lineJoin="miter",s.lineCap="butt";const t=bh(s);if(t&&(i.uv=1),g=x(g,{tileSize:o,zScale:l,glScale:u}),s.mergeOnProperty){const t=Pa.genFnTypes(s);r=Iu.mergeLineFeatures(r,s,t,g.zoom)}if(t){const t=[];if(!1!==i.top){const n=x({},g);n.side=!1,t.push(new Nu(r,s,n))}return!1!==i.side&&(g.side=!0,g.top=!1,t.push(new Nu(r,s,g))),Promise.all(t.map((t=>t.load())))}return Promise.all([new Nu(r,s,g).load()])}if("circle"===y)return wh(r,s,g,Qu);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?tl:ol;return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:d,tileRatio:p,isTube:!0}),wh(r,s,g,t)}return Promise.resolve([])}cn(t,n,e,r,i,s){const o=(Ql+"").trim(),a=[],u=[],l=r.length;for(let h=0;h<l;h++)if((1===n||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!e.def||"default"===e.def)&&!i[h]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(r[h],t))){const t=r[h];if(void 0===t[o]&&(t[o]=h),i[h]||(i[h]=[]),i[h].push(s),u.push(t),a.push(h),1===n)break}return{tileFeatures:u,tileFeaIndexes:a}}tn(t){const{style:n,featureStyle:e}=t,r={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{r[t]=1})),t.filter=["in","$id",...t.id]):(r[t.id]=1,t.filter=["==","$id",t.id])}));const i=ha.compileStyle(n);for(let t=0;t<n.length;t++)i[t].filter&&(i[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),i[t].type=0;const s=[],o=ha.compileStyle(e);for(let t=0;t<e.length;t++)o[t].type=1,o[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=i,this.featurePlugins=s,this.styledFeatures=r}hn(t){let n=this.pn;this.pn||(n=this.pn={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const i in t){const s=i;if(!n[i]){const r=[];for(let n=0;n<t[i].types.length;n++){const o=t[i].types[n],a=["all",["==","$layer",s],["==","$type",e[o]]],u={filter:ln(a),renderPlugin:mh(o),symbol:gh(o)};u.filter.def=a,u.type=0,r.push(u)}n[s]=r}r.push(...n[s])}return r}}function mh(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 gh(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 vh(t){if(Array.isArray(t)||!P(t))return{};const n={};for(const e in t){const r=t[e];F(r)?n[e]="string":k(r)?n[e]="number":!0===r||!1===r?n[e]="boolean":Array.isArray(r)?n[e]="array":n[e]="object"}return n}function bh(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(P(t[e])){const r=bh(t[e]);if(2===r)return r;1===r&&(n=1)}}return n}function wh(t,n,e,r,i,s){const o={},a=Array.isArray(n)?n:[n];let u=-1;for(let t=0;t<a.length;t++)o[t]=Mh(a[t]),!o[t]&&a[t]&&-1===u&&(u=t);const l=[];for(let n=0;n<a.length;n++){if(!a[n])continue;a[n].index={index:n};let h=t;if(s&&a[n].mergeOnProperty){const r=Pa.genFnTypes(a[n]);h=Iu.mergeLineFeatures(t,a[0],r,e.zoom)}o[n]||n===u?l.push(new r(h,a[n],e).load(i)):l.push({data:{ref:u,symbolIndex:{index:n}}})}return Promise.all(l)}function Mh(t){if(!t)return 0;for(const n in t)if(_(t[n]))return 1;return 0}function xh(t,n,e,r){const i=e.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=ha.compileFilter(i[t].filter);for(let e=0;e<i.length;e++)for(let s=0,o=t.length;s<o;s++)if(i[e].fn(t[s],n))for(const t in i[e].properties){const n=i[e].properties[t];S(n)||(r[s]||(r[s]={}),r[s][t]||(r[s][t]=new Set),r[s][t].add(n))}}const Fh={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},kh={get:function(t,n){return n in t?t[n]:t[dh][n]},has:(t,n)=>n in t||n in t[dh]},Ah={};function Ph(t){const n={};n.originalFeature=t;const e=new Proxy(n,Fh);return e.properties=new Proxy({},kh),e.properties[dh]=t.properties||Ah,e}function Sh(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const _h=[];function Oh(t,n,e){if(!t)return _h;for(const r in t){if(!t[r]||!Dr.checkIfZoomFnTypeSymbol(r))continue;if(_(t[r]))Sh(n,e,t[r].property);else{if("lineGradientProperty"===r){Sh(n,e,t[r]);continue}if("textName"===r)if(F(t[r])){const i=Da.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)Sh(n,e,i[t])}else if(ha.isExpression(t[r])){const i=[];Da.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)Sh(n,e,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)_(i[t][1])&&Sh(n,t,i[t][1].property)}return n[e]}function Ch(t,n){Eh(t.geometry,n)}function Eh(t,n){if(t)switch(t.type){case"Point":Ih(t.coordinates,n);break;case"MultiPoint":case"LineString":$h(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,r=t.length;e<r;e++)$h(t[e],n)}(t.coordinates,n);break;case"Polygon":Th(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,r=t.length;e<r;e++)Th(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let r=0;r<e;r++)Eh(t.geometries[r],n)}}function Ih(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 $h(t,n){for(let e=0,r=t.length;e<r;e++)Ih(t[e],n)}function Th(t,n){t.length&&$h(t[0],n)}function Dh(t,n,e,r,i){zh(t,n,e||0,r||t.length-1,i||Uh)}function zh(t,n,e,r,i){for(;r>e;){if(r-e>600){var s=r-e+1,o=n-e+1,a=Math.log(s),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(s-u)/s)*(o-s/2<0?-1:1);zh(t,n,Math.max(e,Math.floor(n-o*u/s+l)),Math.min(r,Math.floor(n+(s-o)*u/s+l)),i)}var h=t[n],c=e,f=r;for(jh(t,e,n),i(t[r],h)>0&&jh(t,e,r);c<f;){for(jh(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[e],h)?jh(t,e,f):jh(t,++f,r),f<=n&&(e=f+1),n<=f&&(r=f-1)}}function jh(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function Uh(t,n){return t<n?-1:t>n?1:0}class Nh{constructor(t=9){this.yn=Math.max(4,t),this.mn=Math.max(2,Math.ceil(.4*this.yn)),this.clear()}all(){return this.gn(this.data,[])}search(t){let n=this.data;const e=[];if(!Kh(t,n))return e;const r=this.toBBox,i=[];for(;n;){for(let s=0;s<n.children.length;s++){const o=n.children[s],a=n.leaf?r(o):o;Kh(t,a)&&(n.leaf?e.push(o):Yh(t,a)?this.gn(o,e):i.push(o))}n=i.pop()}return e}collides(t){let n=this.data;if(!Kh(t,n))return!1;const e=[];for(;n;){for(let r=0;r<n.children.length;r++){const i=n.children[r],s=n.leaf?this.toBBox(i):i;if(Kh(t,s)){if(n.leaf||Yh(t,s))return!0;e.push(i)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.mn){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.vn(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.bn(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.wn(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.wn(t,this.data.height-1),this}clear(){return this.data=Zh([]),this}remove(t,n){if(!t)return this;let e=this.data;const r=this.toBBox(t),i=[],s=[];let o,a,u;for(;e||i.length;){if(e||(e=i.pop(),a=i[i.length-1],o=s.pop(),u=!0),e.leaf){const r=Lh(t,e.children,n);if(-1!==r)return e.children.splice(r,1),i.push(e),this.Mn(i),this}u||e.leaf||!Yh(e,r)?a?(o++,e=a.children[o],u=!1):e=null:(i.push(e),s.push(o),o=0,a=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}gn(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}vn(t,n,e,r){const i=e-n+1;let s,o=this.yn;if(i<=o)return s=Zh(t.slice(n,e+1)),Rh(s,this.toBBox),s;r||(r=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,r-1))),s=Zh([]),s.leaf=!1,s.height=r;const a=Math.ceil(i/o),u=a*Math.ceil(Math.sqrt(o));Qh(t,n,e,u,this.compareMinX);for(let i=n;i<=e;i+=u){const n=Math.min(i+u-1,e);Qh(t,i,n,a,this.compareMinY);for(let e=i;e<=n;e+=a){const i=Math.min(e+a-1,n);s.children.push(this.vn(t,e,i,r-1))}}return Rh(s,this.toBBox),s}xn(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){let e,r=1/0,i=1/0;for(let s=0;s<n.children.length;s++){const o=n.children[s],a=Jh(o),u=Bh(t,o)-a;u<i?(i=u,r=a<r?a:r,e=o):u===i&&a<r&&(r=a,e=o)}n=e||n.children[0]}return n}wn(t,n,e){const r=e?t:this.toBBox(t),i=[],s=this.xn(r,this.data,n,i);for(s.children.push(t),Hh(s,r);n>=0&&i[n].children.length>this.yn;)this.Fn(i,n),n--;this.kn(r,i,n)}Fn(t,n){const e=t[n],r=e.children.length,i=this.mn;this.An(e,i,r);const s=this.Pn(e,i,r),o=Zh(e.children.splice(s,e.children.length-s));o.height=e.height,o.leaf=e.leaf,Rh(e,this.toBBox),Rh(o,this.toBBox),n?t[n-1].children.push(o):this.bn(e,o)}bn(t,n){this.data=Zh([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Rh(this.data,this.toBBox)}Pn(t,n,e){let r,i=1/0,s=1/0;for(let o=n;o<=e-n;o++){const n=Vh(t,0,o,this.toBBox),a=Vh(t,o,e,this.toBBox),u=Xh(n,a),l=Jh(n)+Jh(a);u<i?(i=u,r=o,s=l<s?l:s):u===i&&l<s&&(s=l,r=o)}return r||e-n}An(t,n,e){const r=t.leaf?this.compareMinX:qh,i=t.leaf?this.compareMinY:Gh;this.Sn(t,n,e,r)<this.Sn(t,n,e,i)&&t.children.sort(r)}Sn(t,n,e,r){t.children.sort(r);const i=this.toBBox,s=Vh(t,0,n,i),o=Vh(t,e-n,e,i);let a=Wh(s)+Wh(o);for(let r=n;r<e-n;r++){const n=t.children[r];Hh(s,t.leaf?i(n):n),a+=Wh(s)}for(let r=e-n-1;r>=n;r--){const n=t.children[r];Hh(o,t.leaf?i(n):n),a+=Wh(o)}return a}kn(t,n,e){for(let r=e;r>=0;r--)Hh(n[r],t)}Mn(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():Rh(t[e],this.toBBox)}}function Lh(t,n,e){if(!e)return n.indexOf(t);for(let r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function Rh(t,n){Vh(t,0,t.children.length,n,t)}function Vh(t,n,e,r,i){i||(i=Zh(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s=n;s<e;s++){const n=t.children[s];Hh(i,t.leaf?r(n):n)}return i}function Hh(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function qh(t,n){return t.minX-n.minX}function Gh(t,n){return t.minY-n.minY}function Jh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Wh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Bh(t,n){return(Math.max(n.maxX,t.maxX)-Math.min(n.minX,t.minX))*(Math.max(n.maxY,t.maxY)-Math.min(n.minY,t.minY))}function Xh(t,n){const e=Math.max(t.minX,n.minX),r=Math.max(t.minY,n.minY),i=Math.min(t.maxX,n.maxX),s=Math.min(t.maxY,n.maxY);return Math.max(0,i-e)*Math.max(0,s-r)}function Yh(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function Kh(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function Zh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Qh(t,n,e,r,i){const s=[n,e];for(;s.length;){if((e=s.pop())-(n=s.pop())<=r)continue;const o=n+Math.ceil((e-n)/r/2)*r;Dh(t,o,n,e,i),s.push(n,o,o,e)}}var tc={exports:{}},nc=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=(r-e)/2,u=0,l=a-1;u<a;l=u++){var h=n[e+2*u+0],c=n[e+2*u+1],f=n[e+2*l+0],d=n[e+2*l+1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o},ec=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=r-e,u=0,l=a-1;u<a;l=u++){var h=n[u+e][0],c=n[u+e][1],f=n[l+e][0],d=n[l+e][1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o};tc.exports=function(t,n,e,r){return n.length>0&&Array.isArray(n[0])?ec(t,n,e,r):nc(t,n,e,r)};var rc=tc.exports.nested=ec;tc.exports.flat=nc;const ic=11102230246251565e-32,sc=134217729,oc=(3+8*ic)*ic;function ac(t,n,e,r,i){let s,o,a,u,l=n[0],h=r[0],c=0,f=0;h>l==h>-l?(s=l,l=n[++c]):(s=h,h=r[++f]);let d=0;if(c<t&&f<e)for(h>l==h>-l?(o=l+s,a=s-(o-l),l=n[++c]):(o=h+s,a=s-(o-h),h=r[++f]),s=o,0!==a&&(i[d++]=a);c<t&&f<e;)h>l==h>-l?(o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c]):(o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f]),s=o,0!==a&&(i[d++]=a);for(;c<t;)o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c],s=o,0!==a&&(i[d++]=a);for(;f<e;)o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f],s=o,0!==a&&(i[d++]=a);return 0===s&&0!==d||(i[d++]=s),d}function uc(t){return new Float64Array(t)}const lc=33306690738754716e-32,hc=22204460492503146e-32,cc=11093356479670487e-47,fc=uc(4),dc=uc(8),pc=uc(12),yc=uc(16),mc=uc(4);function gc(t,n,e,r,i,s){const o=(n-s)*(e-i),a=(t-i)*(r-s),u=o-a;if(0===o||0===a||o>0!=a>0)return u;const l=Math.abs(o+a);return Math.abs(u)>=lc*l?u:-function(t,n,e,r,i,s,o){let a,u,l,h,c,f,d,p,y,m,g,v,b,w,M,x,F,k;const A=t-i,P=e-i,S=n-s,_=r-s;w=A*_,f=sc*A,d=f-(f-A),p=A-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=S*P,f=sc*S,d=f-(f-S),p=S-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,fc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,fc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,fc[2]=v-(k-c)+(g-c),fc[3]=k;let O=function(t,n){let e=n[0];for(let r=1;r<t;r++)e+=n[r];return e}(4,fc),C=hc*o;if(O>=C||-O>=C)return O;if(c=t-A,a=t-(A+c)+(c-i),c=e-P,l=e-(P+c)+(c-i),c=n-S,u=n-(S+c)+(c-s),c=r-_,h=r-(_+c)+(c-s),0===a&&0===u&&0===l&&0===h)return O;if(C=cc*o+oc*Math.abs(O),O+=A*h+_*a-(S*l+P*u),O>=C||-O>=C)return O;w=a*_,f=sc*a,d=f-(f-a),p=a-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=u*P,f=sc*u,d=f-(f-u),p=u-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const E=ac(4,fc,4,mc,dc);w=A*h,f=sc*A,d=f-(f-A),p=A-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=S*l,f=sc*S,d=f-(f-S),p=S-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const I=ac(E,dc,4,mc,pc);w=a*h,f=sc*a,d=f-(f-a),p=a-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=u*l,f=sc*u,d=f-(f-u),p=u-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const $=ac(I,pc,4,mc,yc);return yc[$-1]}(t,n,e,r,i,s,l)}function vc(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var r=function(t){for(var n=t[0],e=t[0],r=t[0],i=t[0],s=0;s<t.length;s++){var o=t[s];o[0]<n[0]&&(n=o),o[0]>r[0]&&(r=o),o[1]<e[1]&&(e=o),o[1]>i[1]&&(i=o)}var a=[n,e,r,i],u=a.slice();for(s=0;s<t.length;s++)rc(t[s],a)||u.push(t[s]);return function(t){t.sort(Cc);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&kc(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&kc(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),n.pop(),n.concat(r)}(u)}(t),i=new Nh(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,n){return t[0]-n[0]},i.compareMinY=function(t,n){return t[1]-n[1]},i.load(t);for(var s,o=[],a=0;a<r.length;a++){var u=r[a];i.remove(u),s=Pc(u,s),o.push(s)}var l=new Nh(16);for(a=0;a<o.length;a++)l.insert(Ac(o[a]));for(var h=n*n,c=e*e;o.length;){var f=o.shift(),d=f.p,p=f.next.p,y=Sc(d,p);if(!(y<c)){var m=y/h;(u=bc(i,f.prev.p,d,p,f.next.next.p,m,l))&&Math.min(Sc(u,d),Sc(u,p))<=m&&(o.push(f),o.push(Pc(u,f)),i.remove(u),l.remove(f),l.insert(Ac(f)),l.insert(Ac(f.next)))}}f=s;var g=[];do{g.push(f.p),f=f.next}while(f!==s);return g.push(f.p),g}function bc(t,n,e,r,i,s,o){for(var a=new xn([],wc),u=t.data;u;){for(var l=0;l<u.children.length;l++){var h=u.children[l],c=u.leaf?_c(h,e,r):Mc(e,r,h);c>s||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),d=f.node,p=_c(d,n,e),y=_c(d,r,i);if(f.dist<p&&f.dist<y&&Fc(e,d,o)&&Fc(r,d,o))return d}(u=a.pop())&&(u=u.node)}return null}function wc(t,n){return t.dist-n.dist}function Mc(t,n,e){if(xc(t,e)||xc(n,e))return 0;var r=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===r)return 0;var i=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===i)return 0;var s=Oc(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===s)return 0;var o=Oc(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===o?0:Math.min(r,i,s,o)}function xc(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Fc(t,n,e){for(var r,i,s,o,a=Math.min(t[0],n[0]),u=Math.min(t[1],n[1]),l=Math.max(t[0],n[0]),h=Math.max(t[1],n[1]),c=e.search({minX:a,minY:u,maxX:l,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,s=t,r!==(o=n)&&i!==s&&kc(r,i,s)>0!=kc(r,i,o)>0&&kc(s,o,r)>0!=kc(s,o,i)>0)return!1;return!0}function kc(t,n,e){return gc(t[0],t[1],n[0],n[1],e[0],e[1])}function Ac(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Pc(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Sc(t,n){var e=t[0]-n[0],r=t[1]-n[1];return e*e+r*r}function _c(t,n,e){var r=n[0],i=n[1],s=e[0]-r,o=e[1]-i;if(0!==s||0!==o){var a=((t[0]-r)*s+(t[1]-i)*o)/(s*s+o*o);a>1?(r=e[0],i=e[1]):a>0&&(r+=s*a,i+=o*a)}return(s=t[0]-r)*s+(o=t[1]-i)*o}function Oc(t,n,e,r,i,s,o,a){var u,l,h,c,f=e-t,d=r-n,p=o-i,y=a-s,m=t-i,g=n-s,v=f*f+d*d,b=f*p+d*y,w=p*p+y*y,M=f*m+d*g,x=p*m+y*g,F=v*w-b*b,k=F,A=F;0===F?(l=0,k=1,c=x,A=w):(c=v*x-b*M,(l=b*x-w*M)<0?(l=0,c=x,A=w):l>k&&(l=k,c=x+b,A=w)),c<0?(c=0,-M<0?l=0:-M>v?l=k:(l=-M,k=v)):c>A&&(c=A,-M+b<0?l=0:-M+b>v?l=k:(l=-M+b,k=v));var P=(1-(h=0===c?0:c/A))*i+h*o-((1-(u=0===l?0:l/k))*t+u*e),S=(1-h)*s+h*a-((1-u)*n+u*r);return P*P+S*S}function Cc(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}class Ec{constructor(t,n){this.x=t,this.y=n}clone(){return new Ec(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 Ec(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}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 Ec(this.y,-this.x)}}function Ic(t,n,e,r){const i=n.x*r.y-n.y*r.x,s=e.x-t.x,o=e.y-t.y,a=(s*r.y-o*r.x)/i;return new Ec(t.x+a*n.x,t.y+a*n.y)}const $c=[],Tc=[];function Dc(t){if(k(t[0]&&t[0].x)){const n=[];let e=0;for(let r=0;r<t.length;r++)Tc[e]?(Tc[e][0]=t[r].x,Tc[e][1]=t[r].y):Tc[e]=[t[r].x,t[r].y],n.push(Tc[e]),e++;t=n}try{const n=vc(t,1/0);let e=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>r[0]&&(r[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>r[1]&&(r[1]=n[t][1]);const i=[];let s=[],o=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(Bl(i,n[t],"EPSG:3857"),$c[o]?($c[o].x=i[0],$c[o].y=i[1]):$c[o]=new Ec(i[0],i[1]),s.push($c[o]),o++);wl.calculateSignedArea(s)<0&&(s=s.reverse());const a=function(t){let n,e=Number.MAX_VALUE;const r=function(t,r,i,s,o,a,u,l){var h=Ic(t,r,o,a),c=Ic(i,s,o,a),f=Ic(u,l,t,r),d=Ic(u,l,i,s),p=h.distance(c)*h.distance(f);0!==p&&p<e&&(n=[h,f,d,c],e=p)};var i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();var s,o,a,u,l=new Ec(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Ec(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var c=t[n];c.x<l.x&&(l.x=c.x,s=n),c.x>h.x&&(h.x=c.x,o=n),c.y<l.y&&(l.y=c.y,u=n),c.y>h.y&&(h.y=c.y,a=n)}var f=new Ec(0,-1),d=new Ec(0,1),p=new Ec(-1,0),y=new Ec(1,0);for(let n=0;n<t.length;n++){var m=[Math.acos(f.dot(i[s])),Math.acos(d.dot(i[o])),Math.acos(p.dot(i[a])),Math.acos(y.dot(i[u]))];switch(m.indexOf(Math.min.apply(Math,m))){case 0:(d=(f=i[s].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 1:(f=(d=i[o].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 2:(y=(p=i[a].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(p=(y=i[u].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),u=(u+1)%t.length}r(t[s],f,t[o],d,t[a],p,t[u],y)}return n}(s);if(!a||4!==a.length)return null;const u=a[0].distance(a[1]),l=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(l>u)),h}catch(t){return null}}const zc=[];function jc(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)e?t[r]=jc(t[r]):(Bl(zc,t[r],n),t[r][0]=zc[0],t[r][1]=zc[1]);return t}class Uc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,s)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:k(this.options.tileBuffer)?this.options.tileBuffer:64,hasAltitude:!!this.options.hasAltitude,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5,disableFilter:!0};if(this.options.projection&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),F(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;C.getJSON(r,t.url?t:{},((t,i)=>{if(t&&(console.error("Failed to fetch geojson:"+r),n(t)),!i)return void n(null,{extent:null,idMap:{}});let s=i;if(this.options.convertFn){s=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(s)}const o=Array.isArray(s)?s:s.features;this._n(o);const{sample1000:a,idMap:u}=this.On(o);this.Cn(a,u,s,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features,i=r&&r.length;this._n(r);let s=r;if(r&&i>1e3){s=[];for(let t=0;t<i;t++)Nc(r[t],s,t,i)}this.Cn(s,null,t,e,n)}}_n(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Dc(t,t.length);e.properties=e.properties||{},e.properties[th]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const r=t[n][0];if(!r)continue;const i=Dc(r,r.length);e.properties=e.properties||{},e.properties[th]=e.properties[th]||[],e.properties[th][n]=i}}}}Cn(t,n,e,r,i){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":const e=t.features.length;for(let r=0;r<e;r++)Ch(t.features[r],n);break;case"Feature":Ch(t,n);break;default:Eh(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ot(t,n)}(e,this.options.geojsonvt||r),i(null,{extent:s,idMap:n})}catch(t){console.warn(t),i({error:t.message})}}On(t){const n=[],e={};let r=0;const i=this.options.featureIdProperty;if(t){const s=t.length;t.forEach(((t,o)=>{!function(t,s,o){if(t&&("Feature"!==t.type||t.geometry)){if(k(t.id)||(t.id=r++),i){let n=i;P(i)&&(n=i[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),Nc(t,n,s,o)}}(t,o,s)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,r,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const i=this.index.getTile(e.z,e.x,e.y);if(!i||0===i.features.length)return setTimeout((function(){n(null,r,[])}),1),1;const s=[];for(let t=0,n=i.features.length;t<n;t++){const n=i.features[t];let e=n.layer;void 0===e&&(e="0"),s[e]={types:{}};s[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(wl.convertGeometry(n),n.geometry.converted=1),r.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in s)s[t].types=Object.keys(s[t].types).map((t=>+t));return setTimeout((function(){n(null,r,s)}),1),1}onRemove(){super.onRemove(),delete this.index}}function Nc(t,n,e,r){const i=Math.floor(r/998);(0===e||e===r-1||(0===i||e%i==0)&&n.length<999)&&n.push(t)}var Lc=ct,Rc=Vc;function Vc(t,n,e,r,i){this.properties={},this.extent=e,this.type=0,this.En=t,this.In=-1,this.$n=r,this.Tn=i,t.readFields(Hc,this,n)}function Hc(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var r=n.$n[t.readVarint()],i=n.Tn[t.readVarint()];n.properties[r]=i}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.In=e.pos)}function qc(t){for(var n,e,r=0,i=0,s=t.length,o=s-1;i<s;o=i++)n=t[i],r+=((e=t[o]).x-n.x)*(n.y+e.y);return r}Vc.types=["Unknown","Point","LineString","Polygon"],Vc.prototype.loadGeometry=function(){var t=this.En;t.pos=this.In;for(var n,e=t.readVarint()+t.pos,r=1,i=0,s=0,o=0,a=[];t.pos<e;){if(i<=0){var u=t.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)s+=t.readSVarint(),o+=t.readSVarint(),1===r&&(n&&a.push(n),n=[]),n.push(new Lc(s,o));else{if(7!==r)throw new Error("unknown command "+r);n&&n.push(n[0].clone())}}return n&&a.push(n),a},Vc.prototype.bbox=function(){var t=this.En;t.pos=this.In;for(var n=t.readVarint()+t.pos,e=1,r=0,i=0,s=0,o=1/0,a=-1/0,u=1/0,l=-1/0;t.pos<n;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)(i+=t.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=t.readSVarint())<u&&(u=s),s>l&&(l=s);else if(7!==e)throw new Error("unknown command "+e)}return[o,u,a,l]},Vc.prototype.toGeoJSON=function(t,n,e){var r,i,s=this.extent*Math.pow(2,e),o=this.extent*t,a=this.extent*n,u=this.loadGeometry(),l=Vc.types[this.type];function h(t){for(var n=0;n<t.length;n++){var e=t[n],r=180-360*(e.y+a)/s;t[n]=[360*(e.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<u.length;r++)c[r]=u[r][0];h(u=c);break;case 2:for(r=0;r<u.length;r++)h(u[r]);break;case 3:for(u=function(t){var n=t.length;if(n<=1)return[t];for(var e,r,i=[],s=0;s<n;s++){var o=qc(t[s]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(e&&i.push(e),e=[t[s]]):e.push(t[s]))}e&&i.push(e);return i}(u),r=0;r<u.length;r++)for(i=0;i<u[r].length;i++)h(u[r][i])}1===u.length?u=u[0]:l="Multi"+l;var f={type:"Feature",geometry:{type:l,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Gc=Rc,Jc=Wc;function Wc(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.En=t,this.$n=[],this.Tn=[],this.Dn=[],t.readFields(Bc,this,n),this.length=this.Dn.length}function Bc(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Dn.push(e.pos):3===t?n.$n.push(e.readString()):4===t&&n.Tn.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var r=t.readVarint()>>3;n=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return n}(e))}Wc.prototype.feature=function(t){if(t<0||t>=this.Dn.length)throw new Error("feature index out of bounds");this.En.pos=this.Dn[t];var n=this.En.readVarint()+this.En.pos;return new Gc(this.En,n,this.extent,this.$n,this.Tn)};var Xc=Jc;function Yc(t,n,e){if(3===t){var r=new Xc(e,e.readVarint()+e.pos);r.length&&(n[r.name]=r)}}var Kc=function(t,n){this.layers=t.readFields(Yc,{},n)};class Zc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),n=n||{},s()}getTileFeatures(t,n){const e=t.tileInfo.url,r=t.fetchOptions||{};if(this.Gt.has(e)){const{err:t,data:r}=this.Gt.get(e);return setTimeout((()=>{this.zn(e,t,r,n)}),1)}return r.referrer=t.referrer,C.getArrayBuffer(e,r,((t,r)=>{this.Gt&&(t?t.loading||this.Gt.add(e,{err:t,data:r&&r.data}):r&&r.data&&this.Gt.add(e,{err:null,data:r.data}),this.zn(e,t,r&&r.data,n))}))}zn(t,n,e,r){if(n)return void r(n);let i;try{i=new Kc(new Hl(e))}catch(n){return void r(n.message,[],[])}const s=[];if(!i.layers)return void r(null,s,[]);const o={};let a;for(const t in i.layers)if(u=i.layers,l=t,Object.prototype.hasOwnProperty.call(u,l)){o[t]={types:{}};const e=o[t].types;for(let r=0,o=i.layers[t].length;r<o;r++)try{a=i.layers[t].feature(r),e[a.type]=1;const n={type:a.type,layer:t,geometry:a.loadGeometry(),properties:a.properties,extent:a.extent};void 0!==a.id&&(n.id=a.id);let o=n.properties[th];o&&(F(o)&&(o=JSON.parse(o)),n.properties[th]=jc(o,"EPSG:3857")),s.push(n)}catch(n){console.warn("error when load vt geometry:",n)}}var u,l;for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));r(null,s,o,{byteLength:e.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.an(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}let Qc=0;const tf=new fl(128);class nf{constructor(t){this.jn={},this.Un={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:r},i){if(this.Nn(n,e))return;const s=this.Ln(n,e),o=r.type,a=r.options,u=this.send.bind(this,t);this.jn[s]="GeoJSONVectorTileLayer"===o?new Uc(e,a,u,tf,{},i):new Zc(e,a,u,tf,{},i)}removeLayer({mapId:t,layerId:n},e){const r=this.Nn(t,n),i=this.Ln(t,n);delete this.jn[i],r&&r.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.loadTile(e,r)}abortTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.abortTile&&i.abortTile(e.url,r)}removeTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.removeTile(e,r)}updateStyle({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateStyle(e,r)}updateOptions({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateOptions(e,r)}setData({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.setData(e.data,r)}receive(t){const n=t.callback,e=this.Un[n];delete this.Un[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,r,i){const s=i?\`${q}t}-${q}Qc++}\`:null;i&&(this.Un[s]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(s)},r||[])}Ln(t,n){return\`${q}t}-${q}n}\`}Nn(t,n){const e=this.Ln(t,n);return this.jn[e]}Rn(){tf.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new nf(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=e.command;this.dispatcher[r]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,i)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(r,t),n(t,e,i)}))}}}`;
30
+ const q = "${", K = `function(t){let n;const e={width:100,height:10};function r(){if(!n){const{width:t,height:r}=e;OffscreenCanvas?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class i{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let r=1/0,i=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];r=Math.min(e,r),i=Math.max(e,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const s=i.createLinearGradient(0,0,t.width,0),{colors:o,valueOffset:a}=this;for(let t=0,n=o.length;t<n;t++){const[n,e]=o[t],r=(n-this.min)/a;s.addColorStop(r,e)}i.fillStyle=s,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const r=4*e;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function o(t,n){var e,r,i;if(y(t)){var s,h=t.stops&&"object"==typeof t.stops[0][0],d=h||void 0!==t.property,p=h||!d,m=t.type||n||"exponential";if("exponential"===m)s=l;else if("interval"===m)s=u;else if("categorical"===m)s=a;else if("identity"===m)s=f;else{if("color-interpolate"!==m)throw new Error('Unknown function type "'+m+'"');s=c}if(h){var g={},v=[];for(let n=0;n<t.stops.length;n++){var b=t.stops[n];void 0===g[b[0].zoom]&&(g[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),g[b[0].zoom].stops.push([b[0].value,b[1]])}for(let t in g)v.push([g[t].zoom,o(g[t])]);e=function(n,e){const r=l({stops:v,base:t.base},n)(n,e);return"function"==typeof r?r(n,e):r},r=!1,i=!1}else p?(e=function(n){const e=s(t,n);return"function"==typeof e?e(n):e},r=!0,i=!1):(e=function(n,e){const r=s(t,e?e[t.property]:null);return"function"==typeof r?r(n,e):r},r=!1,i=!0)}else e=function(){return t},r=!0,i=!0;return e.isZoomConstant=i,e.isFeatureConstant=r,e}function a(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function u(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function l(t,n){for(var e=void 0!==t.base?t.base:1,r=0;!(r>=t.stops.length||n<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:d(n,e,t.stops[r-1][0],t.stops[r][0],t.stops[r-1][1],t.stops[r][1])}"function"==typeof Map&&(s=new Map);const h={width:100,height:1};function c(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new i(e,h);s.set(n,t)}t=s.get(n)}else t=new i(e,h);const[r,o,a,u]=t.getColor(n);return[r/255,o/255,a/255,u/255]}return e&&1===e.length?e[0][1]:null}function f(t,n){return function(t,n,e){return void 0!==t?t:void 0!==n?n:null}(n,t.default)}function d(t,n,e,r,i,s){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),a=s.apply(void 0,arguments);return d(t,n,e,r,o,a)}:i.length?function(t,n,e,r,i,s){var o=[];for(let a=0;a<i.length;a++)o[a]=p(t,n,e,r,i[a],s[a]);return o}(t,n,e,r,i,s):p(t,n,e,r,i,s)}function p(t,n,e,r,i,s){var o,a=r-e,u=t-e;return i*(1-(o=1===n?u/a:(Math.pow(n,u)-1)/(Math.pow(n,a)-1)))+s*o}function y(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function m(t){return b(t,"exponential")}function g(t){return b(t,"interval")}function v(t,n){if(!t)return null;var e=!1;if(Array.isArray(t)){var r,i=[];for(let s=0;s<t.length;s++)(r=v(t[s],n))?(i.push(r),e=!0):i.push(t[s]);return e?i:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const u=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=m(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,r=a.length;n<r;n++)y(t[s=a[n]])?(e=!0,o["_"+s]=t[s],u(s)):o[s]=t[s];return e?o:t}function b(t,n){if(!y(t))return function(){return t};let e=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(y(i[t][1])){const s=b(i[t][1],n);e=e&&s.isZoomConstant,r=r&&s.isFeatureConstant,i[t]=[i[t][0],s]}const s=o(t,n);return s.isZoomConstant=e&&s.isZoomConstant,s.isFeatureConstant=r&&s.isFeatureConstant,s}let w=0;const M="function"==typeof Object.assign;function x(t,...n){if(M)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const r=n[e];for(const n in r)t[n]=r[n]}return t}function F(t){return!S(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function k(t){return"number"==typeof t&&!isNaN(t)}function A(t){return!S(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function P(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function S(t){return null==t}function _(t){return y(t)&&t.property}const O="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const e="_maptalks_jsonp_"+w++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,n,e){if(A(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const r="POST"===n.method;if(O){const r=new AbortController,i=n;i.signal=r.signal,i.referrerPolicy=i.referrerPolicy||"origin",i.method=i.method||"GET";const s=new Request(t,i);return n.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((r=>{const i=this.o(r,n.returnJSON,n.responseType);i.message?(i.url=t,e(i)):i.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),contentType:r.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),r}{const i=C.u(e);if(i.open(n.method||"GET",t,!0),n){for(const t in n.headers)i.setRequestHeader(t,n.headers[t]);i.withCredentials="include"===n.credentials,n.responseType&&(i.responseType=n.responseType)}return i.send(r?n.body:null),i}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${q}t.status}): ${q}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),m: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(${q}t.status}): ${q}t.statusText}\`})}},u: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.m(n,t),n},getArrayBuffer(t,n,e){if(A(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,e)}};function E(t,n,e,r,i=3){let s=r;const o=e-n>>1;let a,u=e-n;const l=t[n],h=t[n+1],c=t[e],f=t[e+1];for(let r=n+i;r<e;r+=i){const n=I(t[r],t[r+1],l,h,c,f);if(n>s)a=r,s=n;else if(n===s){const t=Math.abs(r-o);t<u&&(a=r,u=t)}}s>r&&(a-n>i&&E(t,n,a,r,i),t[a+2]=s,e-a>i&&E(t,a,e,r,i))}function I(t,n,e,r,i,s){let o=i-e,a=s-r;if(0!==o||0!==a){const u=((t-e)*o+(n-r)*a)/(o*o+a*a);u>1?(e=i,r=s):u>0&&(e+=o*u,r+=a*u)}return o=t-e,a=n-r,o*o+a*a}function $(t,n,e,r,i,s){const o={id:null==t?null:t,type:n,geometry:e,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(o.layer=i);return function(t,n){const e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)T(t,e,n);else if("Polygon"===r)T(t,e[0],n);else if("MultiLineString"===r)for(const r of e)T(t,r,n);else if("MultiPolygon"===r)for(const r of e)T(t,r[0],n)}(o,s?4:3),o}function T(t,n,e){for(let r=0;r<n.length;r+=e)t.minX=Math.min(t.minX,n[r]),t.minY=Math.min(t.minY,n[r+1]),t.maxX=Math.max(t.maxX,n[r]),t.maxY=Math.max(t.maxY,n[r+1])}function D(t,n,e,r){if(r.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)z(t,e.features[n],r,n);else"Feature"===e.type?z(t,e,r):z(t,{geometry:e},r)}function z(t,n,e,r){if(!n.geometry)return;const i=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let a=[],u=n.id;if(e.promoteId?u=n.properties[e.promoteId]:e.generateId&&(u=r||0),"Point"===s)j(i,a,e);else if("MultiPoint"===s)for(const t of i)j(t,a,e);else if("LineString"===s)U(i,a,o,!1,e);else if("MultiLineString"===s){if(e.lineMetrics){for(const r of i)a=[],U(r,a,o,!1,e),t.push($(u,"LineString",a,n.properties,e.layer,e.hasAltitude));return}N(i,a,o,!1,e)}else if("Polygon"===s)N(i,a,o,!0,e);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(const i of n.geometry.geometries)z(t,{id:u,geometry:i,properties:n.properties},e,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const n=[];N(t,n,o,!0,e),a.push(n)}}t.push($(u,s,a,n.properties,e.layer,e.hasAltitude))}function j(t,n,e){n.push(L(t[0]),R(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function U(t,n,e,r,i){let s,o,a=0;for(let e=0;e<t.length;e++){const u=L(t[e][0]),l=R(t[e][1],i.projection);n.push(u,l,0),i.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(a+=r?(s*l-u*o)/2:Math.sqrt(Math.pow(u-s,2)+Math.pow(l-o,2))),s=u,o=l}const u=i.hasAltitude?4:3,l=n.length-u;n[2]=1,E(n,0,l,e,u),n[l+2]=1,n.size=Math.abs(a),n.start=0,n.end=n.size}function N(t,n,e,r,i){for(let s=0;s<t.length;s++){const o=[];U(t[s],o,e,r,i),n.push(o)}}function L(t){return t/360+.5}function R(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function V(t,n,e,r,i,s,o,a){if(r/=n,s>=(e/=n)&&o<r)return t;if(o<e||s>=r)return null;const u=[];for(const n of t){const t=n.geometry;let s=n.type;const o=0===i?n.minX:n.minY,l=0===i?n.maxX:n.maxY;if(o>=e&&l<r){u.push(n);continue}if(l<e||o>=r)continue;let h=[];if("Point"===s||"MultiPoint"===s)H(t,h,e,r,i,a.hasAltitude);else if("LineString"===s)q(t,h,e,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===s)J(t,h,e,r,i,!1,a.hasAltitude);else if("Polygon"===s)J(t,h,e,r,i,!0,a.hasAltitude);else if("MultiPolygon"===s)for(const n of t){const t=[];J(n,t,e,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===s){for(const t of h)u.push($(n.id,s,t,n.tags,n.layer,a.hasAltitude));continue}"LineString"!==s&&"MultiLineString"!==s||(1===h.length?(s="LineString",h=h[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===h.length?"Point":"MultiPoint"),u.push($(n.id,s,h,n.tags,n.layer,a.hasAltitude))}}return u.length?u:null}function H(t,n,e,r,i,s){const o=s?4:3;for(let a=0;a<t.length;a+=o){const o=t[a+i];o>=e&&o<=r&&(W(n,t[a],t[a+1],t[a+2]),s&&n.push(t[a+3]))}}function q(t,n,e,r,i,s,o,a){let u=G(t);const l=0===i?B:X;let h,c,f=t.start;const d=a?4:3,p=s?t.length:t.length-d;for(let y=0;y<p;y+=d){const m=t[y],g=t[y+1],v=t[y+2];let b,w,M,x;s&&y===p-d?(b=t[0],w=t[1]):(b=t[y+d],w=t[y+d+1]),a&&(M=t[y+3],x=s&&y===p-d?t[3]:t[y+d+3]);const F=0===i?m:g,k=0===i?b:w;let A=!1;o&&(h=Math.sqrt(Math.pow(m-b,2)+Math.pow(g-w,2))),F<e?k>e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):F>r?k<r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):(W(u,m,g,v),a&&u.push(M)),k<e&&F>=e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),A=!0),k>r&&F<=r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),A=!0),!s&&A&&(o&&(u.end=f+h*c),n.push(u),u=G(t)),o&&(f+=h)}let y=t.length-d;if(!s){const n=t[y],s=t[y+1],o=t[y+2],l=0===i?n:s;if(l>=e&&l<=r&&W(u,n,s,o),l>=e&&l<=r&&a){const n=t[y+3];u.push(n)}}y=u.length-d,s&&y>=d&&(u[y]!==u[0]||u[y+1]!==u[1])&&(W(u,u[0],u[1],u[2]),a&&u.push(u[3])),u.length&&n.push(u)}function G(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function J(t,n,e,r,i,s,o){for(const a of t)q(a,n,e,r,i,s,!1,o)}function W(t,n,e,r){t.push(n,e,r)}function B(t,n,e,r,i,s){const o=(s-n)/(r-n);return W(t,s,e+(i-e)*o,1),o}function X(t,n,e,r,i,s){const o=(s-e)/(i-e);return W(t,n+(r-n)*o,s,1),o}function Y(t,n,e){return t+(n-t)*e}function K(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=s.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=Z(s.geometry,n,e);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const t of s.geometry)a.push(Z(t,n,e))}else if("MultiPolygon"===o){a=[];for(const t of s.geometry){const r=[];for(const i of t)r.push(Z(i,n,e));a.push(r)}}r.push($(s.id,o,a,s.tags,s.layer,e))}return r}function Z(t,n,e){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=e?4:3;for(let s=0;s<t.length;s+=i)r.push(t[s]+n,t[s+1],t[s+2]),e&&r.push(t[s+3]);return r}function Q(t,n,e){if(t.transformed)return t;const r=1<<t.z,i=t.x,s=t.y,o=e?3:2;for(const a of t.features){const t=a.geometry,u=a.type;if(a.geometry=[],1===u)for(let u=0;u<t.length;u+=o)a.geometry.push(tt(t[u],t[u+1],n,r,i,s)),e&&a.geometry[a.geometry.length-1].push(t[u+2]);else for(let u=0;u<t.length;u++){const l=[];for(let a=0;a<t[u].length;a+=o)l.push(tt(t[u][a],t[u][a+1],n,r,i,s)),e&&l[l.length-1].push(t[u][a+2]);a.geometry.push(l)}}return t.transformed=!0,t}function tt(t,n,e,r,i,s){return[Math.round(e*(t*r-i)),Math.round(e*(n*r-s))]}function nt(t,n,e,r,i){const s=n===i.maxZoom?0:i.tolerance/((1<<n)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:r,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(o,n,s,i);return o}function et(t,n,e,r){const i=n.geometry,s=n.type,o=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===s||"MultiPoint"===s)for(let n=0;n<i.length;n+=a)o.push(i[n],i[n+1]),r.hasAltitude&&o.push(i[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===s)it(o,i,t,e,!1,!1,r);else if("MultiLineString"===s||"Polygon"===s)for(let n=0;n<i.length;n++)it(o,i[n],t,e,"Polygon"===s,0===n,r);else if("MultiPolygon"===s)for(let n=0;n<i.length;n++){const s=i[n];for(let n=0;n<s.length;n++)it(o,s[n],t,e,!0,0===n,r)}if(o.length){let e=n.tags||null;if("LineString"===s&&r.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=i.start/i.size,e.mapbox_clip_end=i.end/i.size}const a={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:e};n.layer&&(a.layer=n.layer),null!==n.id&&(a.id=n.id),t.features.push(a)}}function rt(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function it(t,n,e,r,i,s,o){const a=r*r,{hasAltitude:u,disableFilter:l}=o,h=u?4:3;if(!l&&r>0&&n.size<(i?a:r))return void(e.numPoints+=n.length/h);const c=[];for(let t=0;t<n.length;t+=h)(0===r||n[t+2]>a||rt(n,t,u))&&(e.numSimplified++,c.push(n[t],n[t+1]),u&&c.push(n[t+3])),e.numPoints++;i&&function(t,n,e){const r=e?3:2;let i=0;for(let n=0,e=t.length,s=e-r;n<e;s=n,n+=r)i+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(i>0===n){const n=r,i=r-1,s=r-2;for(let o=0,a=t.length;o<a/2;o+=r){const r=t[o],u=t[o+1];let l;e&&(l=t[o+2]),t[o]=t[a-n-o],t[o+1]=t[a-i-o],e&&(t[o+2]=t[a-s-o]),t[a-n-o]=r,t[a-i-o]=u,e&&(t[a-s-o]=l)}}}(c,s,u),t.push(c)}C.getJSON=function(t,n,e){if(A(n)){const t=e;e=n,n=t}const r=function(t,n){const r="string"==typeof n?JSON.parse(n):n||null;e(t,r)};return n&&n.jsonp?C.jsonp(t,r):((n=n||{}).returnJSON=!0,C.get(t,n,r))};const st={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,hasAltitude:!1,disableFilter:!1,debug:0};class ot{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(st),n)).debug;if(e&&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.");let r=function(t,n){const e=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)D(e,t[r].layer,t[r].data,n);return e}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(e,t.features[r],n,r);else"Feature"===t.type?z(e,t,n):z(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,n){const e=n.buffer/n.extent;let r=t;const i=V(t,1,-1-e,e,0,-1,2,n),s=V(t,1,1-e,2+e,0,-1,2,n);return(i||s)&&(r=V(t,1,-e,1+e,0,-1,2,n)||[],i&&(r=K(i,1,n.hasAltitude).concat(r)),s&&(r=r.concat(K(s,-1,n.hasAltitude)))),r}(r,n),r.length&&this.splitTile(r,0,0,0),e&&(r.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)))}splitTile(t,n,e,r,i,s,o){const a=[t,n,e,r],u=this.options,l=u.debug;for(;a.length;){r=a.pop(),e=a.pop(),n=a.pop(),t=a.pop();const h=1<<n,c=at(n,e,r);let f=this.tiles[c];if(!f&&(l>1&&console.time("creation"),f=this.tiles[c]=nt(t,n,e,r,u),this.tileCoords.push({z:n,x:e,y:r}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${q}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(n===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue}else{if(n===u.maxZoom||n===i)continue;if(null!=i){const t=i-n;if(e!==s>>t||r!==o>>t)continue}}if(f.source=null,0===t.length)continue;l>1&&console.time("clipping");const d=.5*u.buffer/u.extent,p=.5-d,y=.5+d,m=1+d;let g=null,v=null,b=null,w=null,M=V(t,h,e-d,e+y,0,f.minX,f.maxX,u),x=V(t,h,e+p,e+m,0,f.minX,f.maxX,u);t=null,M&&(g=V(M,h,r-d,r+y,1,f.minY,f.maxY,u),v=V(M,h,r+p,r+m,1,f.minY,f.maxY,u),M=null),x&&(b=V(x,h,r-d,r+y,1,f.minY,f.maxY,u),w=V(x,h,r+p,r+m,1,f.minY,f.maxY,u),x=null),l>1&&console.timeEnd("clipping"),a.push(g||[],n+1,2*e,2*r),a.push(v||[],n+1,2*e,2*r+1),a.push(b||[],n+1,2*e+1,2*r),a.push(w||[],n+1,2*e+1,2*r+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const r=this.options,{extent:i,debug:s}=r,{hasAltitude:o,wrapX:a}=r;if(t<0||t>24)return null;if(a){const e=1<<t;n=n+e&e-1}const u=at(t,n,e);if(this.tiles[u])return Q(this.tiles[u],i,o);s>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let l,h=t,c=n,f=e;for(;!l&&h>0;)h--,c>>=1,f>>=1,l=this.tiles[at(h,c,f)];return l&&l.source?(s>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(l.source,h,c,f,t,n,e),s>1&&console.timeEnd("drilling down"),this.tiles[u]?Q(this.tiles[u],i,o):null):null}}function at(t,n,e){return 32*((1<<t)*e+n)+t}function ut(t,n,e,r,i,s,o){const a=e&&Array.isArray(e[0]);for(let u=0,l=e.length;u<l;u++){t[n]=(a?e[u][0]:e[u].x)*r,t[n+1]=(a?e[u][1]:e[u].y)*r,o!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let h=i||0;Array.isArray(i)&&(h=i[u]),h=h?Math.round(r*h):0,t[n+2]=h,n+=3,s&&0!==u&&u!==l-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function lt(t,n,e,r){const i=t[3*n],s=t[3*n+1],o=t[3*e],a=t[3*e+1];return i===o&&(i<0||i>r)||s===a&&(s<0||s>r)}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;function ht(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ct=ft;function ft(t,n){this.x=t,this.y=n}ft.prototype={clone:function(){return new ft(this.x,this.y)},add:function(t){return this.clone().F(t)},sub:function(t){return this.clone().k(t)},multByPoint:function(t){return this.clone().A(t)},divByPoint:function(t){return this.clone().P(t)},mult:function(t){return this.clone().S(t)},div:function(t){return this.clone()._(t)},rotate:function(t){return this.clone().O(t)},rotateAround:function(t,n){return this.clone().C(t,n)},matMult:function(t){return this.clone().I(t)},unit:function(){return this.clone().T()},perp:function(){return this.clone().D()},round:function(){return this.clone().j()},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,e=t.y-this.y;return n*n+e*e},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)},I:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},F:function(t){return this.x+=t.x,this.y+=t.y,this},k:function(t){return this.x-=t.x,this.y-=t.y,this},S:function(t){return this.x*=t,this.y*=t,this},_:function(t){return this.x/=t,this.y/=t,this},A:function(t){return this.x*=t.x,this.y*=t.y,this},P:function(t){return this.x/=t.x,this.y/=t.y,this},T:function(){return this._(this.mag()),this},D:function(){var t=this.y;return this.y=this.x,this.x=-t,this},O:function(t){var n=Math.cos(t),e=Math.sin(t),r=n*this.x-e*this.y,i=e*this.x+n*this.y;return this.x=r,this.y=i,this},C:function(t,n){var e=Math.cos(t),r=Math.sin(t),i=n.x+e*(this.x-n.x)-r*(this.y-n.y),s=n.y+r*(this.x-n.x)+e*(this.y-n.y);return this.x=i,this.y=s,this},j:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ft.convert=function(t){return t instanceof ft?t:Array.isArray(t)?new ft(t[0],t[1]):t};var dt=ht(ct);function pt(t,n,e){e=e||{},this.w=t||64,this.h=n||64,this.autoResize=!!e.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function yt(t,n,e){this.x=0,this.y=t,this.w=this.free=n,this.h=e}function mt(t,n,e,r,i,s,o){this.id=t,this.x=n,this.y=e,this.w=r,this.h=i,this.maxw=s||r,this.maxh=o||i,this.refcount=0}pt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var e,r,i,s,o=[],a=0;a<t.length;a++)if(e=t[a].w||t[a].width,r=t[a].h||t[a].height,i=t[a].id,e&&r){if(!(s=this.packOne(e,r,i)))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},pt.prototype.packOne=function(t,n,e){var r,i,s,o,a,u,l,h,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof e||"number"==typeof e){if(r=this.getBin(e))return this.ref(r),r;"number"==typeof e&&(this.maxId=Math.max(e,this.maxId))}else e=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(r=this.freebins[o]).maxh&&t===r.maxw)return this.allocFreebin(o,t,n,e);n>r.maxh||t>r.maxw||n<=r.maxh&&t<=r.maxw&&(s=r.maxw*r.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(i=this.shelves[o]).h,!(t>i.free)){if(n===i.h)return this.allocShelf(o,t,n,e);n>i.h||n<i.h&&(s=(i.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,e):-1!==c.shelf?this.allocShelf(c.shelf,t,n,e):n<=this.h-f&&t<=this.w?(i=new yt(f,this.w,n),this.allocShelf(this.shelves.push(i)-1,t,n,e)):this.autoResize?(a=u=this.h,((l=h=this.w)<=a||t>l)&&(h=2*Math.max(t,l)),(a<l||n>a)&&(u=2*Math.max(n,a)),this.resize(h,u),this.packOne(t,n,e)):null},pt.prototype.allocFreebin=function(t,n,e,r){var i=this.freebins.splice(t,1)[0];return i.id=r,i.w=n,i.h=e,i.refcount=0,this.bins[r]=i,this.ref(i),i},pt.prototype.allocShelf=function(t,n,e,r){var i=this.shelves[t].alloc(n,e,r);return this.bins[r]=i,this.ref(i),i},pt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,e=0;e<this.shelves.length;e++){var r=this.shelves[e];n+=r.h,t=Math.max(r.w-r.free,t)}this.resize(t,n)}},pt.prototype.getBin=function(t){return this.bins[t]},pt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},pt.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)},pt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},pt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var e=0;e<this.shelves.length;e++)this.shelves[e].resize(t);return!0},yt.prototype.alloc=function(t,n,e){if(t>this.free||n>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,new mt(e,r,this.y,t,n,t,this.h)},yt.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var gt={exports:{}},vt={exports:{}},bt=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))},wt=Array.prototype.concat,Mt=Array.prototype.slice,xt=vt.exports=function(t){for(var n=[],e=0,r=t.length;e<r;e++){var i=t[e];bt(i)?n=wt.call(n,Mt.call(i)):n.push(i)}return n};xt.wrap=function(t){return function(){return t(xt(arguments))}};var Ft=vt.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]},At=Ft,Pt=Object.hasOwnProperty,St=Object.create(null);for(var _t in kt)Pt.call(kt,_t)&&(St[kt[_t]]=_t);var Ot=gt.exports={to:{},get:{}};function Ct(t,n,e){return Math.min(Math.max(n,t),e)}function Et(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}Ot.get=function(t){var n,e;switch(t.substring(0,3).toLowerCase()){case"hsl":n=Ot.get.hsl(t),e="hsl";break;case"hwb":n=Ot.get.hwb(t),e="hwb";break;default:n=Ot.get.rgb(t),e="rgb"}return n?{model:e,value:n}:null},Ot.get.rgb=function(t){if(!t)return null;var n,e,r,i=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=n[2],n=n[1],e=0;e<3;e++){var s=2*e;i[e]=parseInt(n.slice(s,s+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(n=n[1])[3],e=0;e<3;e++)i[e]=parseInt(n[e]+n[e],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(e=0;e<3;e++)i[e]=parseInt(n[e+1],0);n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[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]:Pt.call(kt,n[1])?((i=kt[n[1]])[3]=1,i):null:null;for(e=0;e<3;e++)i[e]=Math.round(2.55*parseFloat(n[e+1]));n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[3]=parseFloat(n[4]))}for(e=0;e<3;e++)i[e]=Ct(i[e],0,255);return i[3]=Ct(i[3],0,1),i},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.to.hex=function(){var t=At(arguments);return"#"+Et(t[0])+Et(t[1])+Et(t[2])+(t[3]<1?Et(Math.round(255*t[3])):"")},Ot.to.rgb=function(){var t=At(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]+")"},Ot.to.rgb.percent=function(){var t=At(arguments),n=Math.round(t[0]/255*100),e=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+e+"%, "+r+"%)":"rgba("+n+"%, "+e+"%, "+r+"%, "+t[3]+")"},Ot.to.hsl=function(){var t=At(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},Ot.to.hwb=function(){var t=At(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},Ot.to.keyword=function(t){return St[t.slice(0,3)]};var It=gt.exports,$t={exports:{}},Tt={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]},Dt={};for(var zt in Tt)Tt.hasOwnProperty(zt)&&(Dt[Tt[zt]]=zt);var jt=$t.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 Ut in jt)if(jt.hasOwnProperty(Ut)){if(!("channels"in jt[Ut]))throw new Error("missing channels property: "+Ut);if(!("labels"in jt[Ut]))throw new Error("missing channel labels property: "+Ut);if(jt[Ut].labels.length!==jt[Ut].channels)throw new Error("channel and label counts mismatch: "+Ut);var Nt=jt[Ut].channels,Lt=jt[Ut].labels;delete jt[Ut].channels,delete jt[Ut].labels,Object.defineProperty(jt[Ut],"channels",{value:Nt}),Object.defineProperty(jt[Ut],"labels",{value:Lt})}function Rt(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}jt.rgb.hsl=function(t){var n,e,r=t[0]/255,i=t[1]/255,s=t[2]/255,o=Math.min(r,i,s),a=Math.max(r,i,s),u=a-o;return a===o?n=0:r===a?n=(i-s)/u:i===a?n=2+(s-r)/u:s===a&&(n=4+(r-i)/u),(n=Math.min(60*n,360))<0&&(n+=360),e=(o+a)/2,[n,100*(a===o?0:e<=.5?u/(a+o):u/(2-a-o)),100*e]},jt.rgb.hsv=function(t){var n,e,r,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,l=Math.max(o,a,u),h=l-Math.min(o,a,u),c=function(t){return(l-t)/6/h+.5};return 0===h?i=s=0:(s=h/l,n=c(o),e=c(a),r=c(u),o===l?i=r-e:a===l?i=1/3+n-r:u===l&&(i=2/3+e-n),i<0?i+=1:i>1&&(i-=1)),[360*i,100*s,100*l]},jt.rgb.hwb=function(t){var n=t[0],e=t[1],r=t[2];return[jt.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(e,r))),100*(r=1-1/255*Math.max(n,Math.max(e,r)))]},jt.rgb.cmyk=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255;return[100*((1-e-(n=Math.min(1-e,1-r,1-i)))/(1-n)||0),100*((1-r-n)/(1-n)||0),100*((1-i-n)/(1-n)||0),100*n]},jt.rgb.keyword=function(t){var n=Dt[t];if(n)return n;var e,r=1/0;for(var i in Tt)if(Tt.hasOwnProperty(i)){var s=Rt(t,Tt[i]);s<r&&(r=s,e=i)}return e},jt.keyword.rgb=function(t){return Tt[t]},jt.rgb.xyz=function(t){var n=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*n+.7152*e+.0722*r),100*(.0193*n+.1192*e+.9505*r)]},jt.rgb.lab=function(t){var n=jt.rgb.xyz(t),e=n[0],r=n[1],i=n[2];return r/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},jt.hsl.rgb=function(t){var n,e,r,i,s,o=t[0]/360,a=t[1]/100,u=t[2]/100;if(0===a)return[s=255*u,s,s];n=2*u-(e=u<.5?u*(1+a):u+a-u*a),i=[0,0,0];for(var l=0;l<3;l++)(r=o+1/3*-(l-1))<0&&r++,r>1&&r--,s=6*r<1?n+6*(e-n)*r:2*r<1?e:3*r<2?n+(e-n)*(2/3-r)*6:n,i[l]=255*s;return i},jt.hsl.hsv=function(t){var n=t[0],e=t[1]/100,r=t[2]/100,i=e,s=Math.max(r,.01);return e*=(r*=2)<=1?r:2-r,i*=s<=1?s:2-s,[n,100*(0===r?2*i/(s+i):2*e/(r+e)),100*((r+e)/2)]},jt.hsv.rgb=function(t){var n=t[0]/60,e=t[1]/100,r=t[2]/100,i=Math.floor(n)%6,s=n-Math.floor(n),o=255*r*(1-e),a=255*r*(1-e*s),u=255*r*(1-e*(1-s));switch(r*=255,i){case 0:return[r,u,o];case 1:return[a,r,o];case 2:return[o,r,u];case 3:return[o,a,r];case 4:return[u,o,r];case 5:return[r,o,a]}},jt.hsv.hsl=function(t){var n,e,r,i=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return r=(2-s)*o,e=s*a,[i,100*(e=(e/=(n=(2-s)*a)<=1?n:2-n)||0),100*(r/=2)]},jt.hwb.rgb=function(t){var n,e,r,i,s,o,a,u=t[0]/360,l=t[1]/100,h=t[2]/100,c=l+h;switch(c>1&&(l/=c,h/=c),r=6*u-(n=Math.floor(6*u)),1&n&&(r=1-r),i=l+r*((e=1-h)-l),n){default:case 6:case 0:s=e,o=i,a=l;break;case 1:s=i,o=e,a=l;break;case 2:s=l,o=e,a=i;break;case 3:s=l,o=i,a=e;break;case 4:s=i,o=l,a=e;break;case 5:s=e,o=l,a=i}return[255*s,255*o,255*a]},jt.cmyk.rgb=function(t){var n=t[0]/100,e=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},jt.xyz.rgb=function(t){var n,e,r,i=t[0]/100,s=t[1]/100,o=t[2]/100;return e=-.9689*i+1.8758*s+.0415*o,r=.0557*i+-.204*s+1.057*o,n=(n=3.2406*i+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(n=Math.min(Math.max(0,n),1)),255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1))]},jt.xyz.lab=function(t){var n=t[0],e=t[1],r=t[2];return e/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(n-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},jt.lab.xyz=function(t){var n,e,r,i=t[0];n=t[1]/500+(e=(i+16)/116),r=e-t[2]/200;var s=Math.pow(e,3),o=Math.pow(n,3),a=Math.pow(r,3);return e=s>.008856?s:(e-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,r=a>.008856?a:(r-16/116)/7.787,[n*=95.047,e*=100,r*=108.883]},jt.lab.lch=function(t){var n,e=t[0],r=t[1],i=t[2];return(n=360*Math.atan2(i,r)/2/Math.PI)<0&&(n+=360),[e,Math.sqrt(r*r+i*i),n]},jt.lch.lab=function(t){var n,e=t[0],r=t[1];return n=t[2]/360*2*Math.PI,[e,r*Math.cos(n),r*Math.sin(n)]},jt.rgb.ansi16=function(t){var n=t[0],e=t[1],r=t[2],i=1 in arguments?arguments[1]:jt.rgb.hsv(t)[2];if(0===(i=Math.round(i/50)))return 30;var s=30+(Math.round(r/255)<<2|Math.round(e/255)<<1|Math.round(n/255));return 2===i&&(s+=60),s},jt.hsv.ansi16=function(t){return jt.rgb.ansi16(jt.hsv.rgb(t),t[2])},jt.rgb.ansi256=function(t){var n=t[0],e=t[1],r=t[2];return n===e&&e===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5)},jt.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 e=.5*(1+~~(t>50));return[(1&n)*e*255,(n>>1&1)*e*255,(n>>2&1)*e*255]},jt.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},jt.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},jt.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 e=n[0];3===n[0].length&&(e=e.split("").map((function(t){return t+t})).join(""));var r=parseInt(e,16);return[r>>16&255,r>>8&255,255&r]},jt.rgb.hcg=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255,s=Math.max(Math.max(e,r),i),o=Math.min(Math.min(e,r),i),a=s-o;return n=a<=0?0:s===e?(r-i)/a%6:s===r?2+(i-e)/a:4+(e-r)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},jt.hsl.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=1,i=0;return(r=e<.5?2*n*e:2*n*(1-e))<1&&(i=(e-.5*r)/(1-r)),[t[0],100*r,100*i]},jt.hsv.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=n*e,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.hcg.rgb=function(t){var n=t[0]/360,e=t[1]/100,r=t[2]/100;if(0===e)return[255*r,255*r,255*r];var i,s=[0,0,0],o=n%1*6,a=o%1,u=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=u,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]=u,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]=u}return i=(1-e)*r,[255*(e*s[0]+i),255*(e*s[1]+i),255*(e*s[2]+i)]},jt.hcg.hsv=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n),r=0;return e>0&&(r=n/e),[t[0],100*r,100*e]},jt.hcg.hsl=function(t){var n=t[1]/100,e=t[2]/100*(1-n)+.5*n,r=0;return e>0&&e<.5?r=n/(2*e):e>=.5&&e<1&&(r=n/(2*(1-e))),[t[0],100*r,100*e]},jt.hcg.hwb=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n);return[t[0],100*(e-n),100*(1-e)]},jt.hwb.hcg=function(t){var n=t[1]/100,e=1-t[2]/100,r=e-n,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},jt.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},jt.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},jt.gray.hsl=jt.gray.hsv=function(t){return[0,0,t[0]]},jt.gray.hwb=function(t){return[0,100,t[0]]},jt.gray.cmyk=function(t){return[0,0,0,t[0]]},jt.gray.lab=function(t){return[t[0],0,0]},jt.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),e=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(e.length)+e},jt.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var Vt=$t.exports,Ht=Vt;function qt(t){var n=function(){for(var t={},n=Object.keys(Ht),e=n.length,r=0;r<e;r++)t[n[r]]={distance:-1,parent:null};return t}(),e=[t];for(n[t].distance=0;e.length;)for(var r=e.pop(),i=Object.keys(Ht[r]),s=i.length,o=0;o<s;o++){var a=i[o],u=n[a];-1===u.distance&&(u.distance=n[r].distance+1,u.parent=r,e.unshift(a))}return n}function Gt(t,n){return function(e){return n(t(e))}}function Jt(t,n){for(var e=[n[t].parent,t],r=Ht[n[t].parent][t],i=n[t].parent;n[i].parent;)e.unshift(n[i].parent),r=Gt(Ht[n[i].parent][i],r),i=n[i].parent;return r.conversion=e,r}var Wt=Vt,Bt=function(t){for(var n=qt(t),e={},r=Object.keys(n),i=r.length,s=0;s<i;s++){var o=r[s];null!==n[o].parent&&(e[o]=Jt(o,n))}return e},Xt={};Object.keys(Wt).forEach((function(t){Xt[t]={},Object.defineProperty(Xt[t],"channels",{value:Wt[t].channels}),Object.defineProperty(Xt[t],"labels",{value:Wt[t].labels});var n=Bt(t);Object.keys(n).forEach((function(e){var r=n[e];Xt[t][e]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var e=t(n);if("object"==typeof e)for(var r=e.length,i=0;i<r;i++)e[i]=Math.round(e[i]);return e};return"conversion"in t&&(n.conversion=t.conversion),n}(r),Xt[t][e].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}(r)}))}));var Yt=It,Kt=Xt,Zt=[].slice,Qt=["keyword","gray","hex"],tn={};Object.keys(Kt).forEach((function(t){tn[Zt.call(Kt[t].labels).sort().join("")]=t}));var nn={};function en(t,n){if(!(this instanceof en))return new en(t,n);if(n&&n in Qt&&(n=null),n&&!(n in Kt))throw new Error("Unknown model: "+n);var e,r;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 i=Yt.get(t);if(null===i)throw new Error("Unable to parse color from string: "+t);this.model=i.model,r=Kt[this.model].channels,this.color=i.value.slice(0,r),this.valpha="number"==typeof i.value[r]?i.value[r]:1}else if(t.length){this.model=n||"rgb",r=Kt[this.model].channels;var s=Zt.call(t,0,r);this.color=on(s,r),this.valpha="number"==typeof t[r]?t[r]: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 tn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=tn[a];var u=Kt[this.model].labels,l=[];for(e=0;e<u.length;e++)l.push(t[u[e]]);this.color=on(l)}if(nn[this.model])for(r=Kt[this.model].channels,e=0;e<r;e++){var h=nn[this.model][e];h&&(this.color[e]=h(this.color[e]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function rn(t,n,e){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(nn[t]||(nn[t]=[]))[n]=e})),t=t[0],function(r){var i;return arguments.length?(e&&(r=e(r)),(i=this[t]()).color[n]=r,i):(i=this[t]().color[n],e&&(i=e(i)),i)}}function sn(t){return function(n){return Math.max(0,Math.min(t,n))}}function on(t,n){for(var e=0;e<n;e++)"number"!=typeof t[e]&&(t[e]=0);return t}en.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in Yt.to?this:this.rgb(),e=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return Yt.to[n.model](e)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),e=1===n.valpha?n.color:n.color.concat(this.valpha);return Yt.to.rgb.percent(e)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Kt[this.model].channels,e=Kt[this.model].labels,r=0;r<n;r++)t[e[r]]=this.color[r];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:rn("rgb",0,sn(255)),green:rn("rgb",1,sn(255)),blue:rn("rgb",2,sn(255)),hue:rn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:rn("hsl",1,sn(100)),lightness:rn("hsl",2,sn(100)),saturationv:rn("hsv",1,sn(100)),value:rn("hsv",2,sn(100)),chroma:rn("hcg",1,sn(100)),gray:rn("hcg",2,sn(100)),white:rn("hwb",1,sn(100)),wblack:rn("hwb",2,sn(100)),cyan:rn("cmyk",0,sn(100)),magenta:rn("cmyk",1,sn(100)),yellow:rn("cmyk",2,sn(100)),black:rn("cmyk",3,sn(100)),x:rn("xyz",0,sn(100)),y:rn("xyz",1,sn(100)),z:rn("xyz",2,sn(100)),l:rn("lab",0,sn(100)),a:rn("lab",1),b:rn("lab",2),keyword:function(t){return arguments.length?new en(t):Kt[this.model].keyword(this.color)},hex:function(t){return arguments.length?new en(t):Yt.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=[],e=0;e<t.length;e++){var r=t[e]/255;n[e]=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),e=t.luminosity();return n>e?(n+.05)/(e+.05):(e+.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(),e=n.color[0];return e=(e=(e+t)%360)<0?360+e:e,n.color[0]=e,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 e=t.rgb(),r=this.rgb(),i=void 0===n?.5:n,s=2*i-1,o=e.alpha()-r.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,u=1-a;return en.rgb(a*e.red()+u*r.red(),a*e.green()+u*r.green(),a*e.blue()+u*r.blue(),e.alpha()*i+r.alpha()*(1-i))}},Object.keys(Kt).forEach((function(t){if(-1===Qt.indexOf(t)){var n=Kt[t].channels;en.prototype[t]=function(){if(this.model===t)return new en(this);if(arguments.length)return new en(arguments,t);var e,r="number"==typeof arguments[n]?n:this.valpha;return new en((e=Kt[this.model][t].raw(this.color),Array.isArray(e)?e:[e]).concat(r),t)},en[t]=function(e){return"number"==typeof e&&(e=on(Zt.call(arguments),n)),new en(e,t)}}}));var an=ht(en);\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 un=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ln(t){return new Function("f",\`var p = (f && f.properties || {}); return ${q}cn(t)}\`)}function hn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":case"!has":return 2===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"in":case"!in":return t.length>=2&&("string"==typeof t[1]||t[1].property&&t[1].op);case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"none":case"any":case"all":for(const n of t.slice(1))if(!hn(n)&&"boolean"!=typeof n)return!1;return!0;case"contains":return!0;default:return!1}}function cn(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${q}"=="===n?dn(t[1],t[2],"===",!1):"!="===n?dn(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?dn(t[1],t[2],n,!0):"any"===n?yn(t.slice(1),"||"):"all"===n?yn(t.slice(1),"&&"):"none"===n?vn(yn(t.slice(1),"||")):"in"===n?mn(t[1],t.slice(2)):"!in"===n?vn(mn(t[1],t.slice(2))):"has"===n?gn(t[1]):"!has"===n?vn(gn(t[1])):"contains"===n?function(t,n,e){const r=fn(t);return void 0!==e?\`(${q}r} + '').indexOf("${q}n}") === ${q}e}\`:\`(${q}r} + '').indexOf("${q}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function fn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function dn(t,n,e,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,n,e,r){const i=t.property,s=t.op;let o=fn(i);return"length"!==s?(console.error(\`not support ${q}s} op\`),"false"):(o=\`((${q}o}+='').length)\`,pn(o,i,n,e,r))}(t,n,e,r);var i;return pn(fn(t),t,n,e,r)}function pn(t,n,e,r,i){const s="$type"===n?un.indexOf(e):JSON.stringify(e);return(i?\`typeof ${q}t}=== typeof ${q}s}&&\`:"")+t+r+s}function yn(t,n){return t.map(cn).join(n)}function mn(t,n){"$type"===t&&(n=n.map((t=>un.indexOf(t))));const e=JSON.stringify(n.sort(bn)),r=fn(t);return n.length<=200?\`${q}e}.indexOf(${q}r}) !== -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; }(${q}r}, ${q}e},0,${q}n.length-1})\`}function gn(t){return"$id"===t?'"id" in f':\`${q}JSON.stringify(t)} in p\`}function vn(t){return\`!(${q}t})\`}function bn(t,n){return t<n?-1:t>n?1:0}var wn={exports:{}};wn.exports=function(){function t(t,e,i,s,o){n(t,e,i||0,s||t.length-1,o||r)}function n(t,r,i,s,o){for(;s>i;){if(s-i>600){var a=s-i+1,u=r-i+1,l=Math.log(a),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(a-h)/a)*(u-a/2<0?-1:1);n(t,r,Math.max(i,Math.floor(r-u*h/a+c)),Math.min(s,Math.floor(r+(a-u)*h/a+c)),o)}var f=t[r],d=i,p=s;for(e(t,i,r),o(t[s],f)>0&&e(t,i,s);d<p;){for(e(t,d,p),d++,p--;o(t[d],f)<0;)d++;for(;o(t[p],f)>0;)p--}0===o(t[i],f)?e(t,i,p):e(t,++p,s),p<=r&&(i=p+1),r<=p&&(s=p-1)}}function e(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function r(t,n){return t<n?-1:t>n?1:0}return t}();var Mn=ht(wn.exports);class xn{constructor(t=[],n=Fn){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.U(t)}push(t){this.data.push(t),this.length++,this.L(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.U(0)),t}peek(){return this.data[0]}L(t){const{data:n,compare:e}=this,r=n[t];for(;t>0;){const i=t-1>>1,s=n[i];if(e(r,s)>=0)break;n[t]=s,t=i}n[t]=r}U(t){const{data:n,compare:e}=this,r=this.length>>1,i=n[t];for(;t<r;){let r=1+(t<<1),s=n[r];const o=r+1;if(o<this.length&&e(n[o],s)<0&&(r=o,s=n[o]),e(s,i)>=0)break;n[t]=s,t=r}n[t]=i}}function Fn(t,n){return t<n?-1:t>n?1:0}var kn="undefined"!=typeof Float32Array?Float32Array:Array;function An(){var t=new kn(3);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Pn(t,n,e){var r=new kn(3);return r[0]=t,r[1]=n,r[2]=e,r}function Sn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function _n(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function On(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function Cn(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 En(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function In(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}var $n=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function Tn(){var t=new kn(4);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Dn(t,n){var e=n[0]+n[4]+n[8],r=void 0;if(e>0)r=Math.sqrt(e+1),t[3]=.5*r,r=.5/r,t[0]=(n[5]-n[7])*r,t[1]=(n[6]-n[2])*r,t[2]=(n[1]-n[3])*r;else{var i=0;n[4]>n[0]&&(i=1),n[8]>n[3*i+i]&&(i=2);var s=(i+1)%3,o=(i+2)%3;r=Math.sqrt(n[3*i+i]-n[3*s+s]-n[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(n[3*s+o]-n[3*o+s])*r,t[s]=(n[3*s+i]+n[3*i+s])*r,t[o]=(n[3*o+i]+n[3*i+o])*r}return t}!function(){var t=An()}(),function(){var t,n=(t=new kn(4),kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var zn,jn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},Un=function(t,n){var e=n[0],r=n[1],i=n[2],s=n[3],o=e*e+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=e*o,t[1]=r*o,t[2]=i*o,t[3]=s*o),t};An(),Pn(1,0,0),Pn(0,1,0),Tn(),Tn(),zn=new kn(9),kn!=Float32Array&&(zn[1]=0,zn[2]=0,zn[3]=0,zn[5]=0,zn[6]=0,zn[7]=0),zn[0]=1,zn[4]=1,zn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Nn=8,Ln=[],Rn=[],Vn=[],Hn=[];function qn(t,n,e){const r=In(Rn,n,e),i=function(t,n,e,r,i,s,o,a,u,l){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t[4]=s,t[5]=o,t[6]=a,t[7]=u,t[8]=l,t}(Ln,e[0],e[1],e[2],...r,...n);t=Dn(t,i),t=function(t){return t[3]<0?jn(t,t,-1):t}(t=Un(t,t));const s=1/((1<<2*Nn-1)-1);if(t[3]<s){t[3]=s;const n=Math.sqrt(1-s*s);t[0]*=n,t[1]*=n,t[2]*=n}const o=e[3]>0?In(Vn,e,n):In(Vn,n,e);return En(In(Hn,e,n),o)<0&&jn(t,t,-1),t}const Gn=[];function Jn(t,n,e){const r=e||[];r.setLength&&r.setLength(t.length);const i=Gn;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const s=void 0===n.length?n:n.length;for(let e=0;e<s/3;e++)void 0===n.length?te(t,3*e,3*e+1,3*e+2,r,i):te(t,n[3*e],n[3*e+1],n[3*e+2],r,i);const o=r.getLength?r.getLength():r.length;for(let t=0;t<o;t+=3){const n=i[t/3];0!==n?(r[t]/=n,r[t+1]/=n,r[t+2]/=n):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}const Wn=[],Bn=[],Xn=[],Yn=[],Kn=[],Zn=[],Qn=[];function te(t,n,e,r,i,s){_n(Yn,t[3*n],t[3*n+1],t[3*n+2]),_n(Kn,t[3*e],t[3*e+1],t[3*e+2]),_n(Zn,t[3*r],t[3*r+1],t[3*r+2]);const o=$n(Wn,Zn,Kn),a=$n(Bn,Yn,Kn),u=In(Xn,o,a);Cn(Qn,u),i[3*n]=i[3*n]||0,i[3*e]=i[3*e]||0,i[3*r]=i[3*r]||0,i[3*n+1]=i[3*n+1]||0,i[3*e+1]=i[3*e+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*n+2]=i[3*n+2]||0,i[3*e+2]=i[3*e+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*n]+=Qn[0],i[3*e]+=Qn[0],i[3*r]+=Qn[0],i[3*n+1]+=Qn[1],i[3*e+1]+=Qn[1],i[3*r+1]+=Qn[1],i[3*n+2]+=Qn[2],i[3*e+2]+=Qn[2],i[3*r+2]+=Qn[2],s[n]+=1,s[e]+=1,s[r]+=1}\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 ne(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function ee(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}var re={exports:{}};function ie(t,n,e){e=e||2;var r,i,s,o,a,u,l,h=n&&n.length,c=h?n[0]*e:t.length,f=se(t,0,c,e,!0),d=[];if(!f||f.next===f.prev)return d;if(h&&(f=function(t,n,e,r){var i,s,o,a=[];for(i=0,s=n.length;i<s;i++)(o=se(t,n[i]*r,i<s-1?n[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),a.push(me(o));for(a.sort(fe),i=0;i<a.length;i++)e=de(a[i],e);return e}(t,n,f,e)),t.length>80*e){r=s=t[0],i=o=t[1];for(var p=e;p<c;p+=e)(a=t[p])<r&&(r=a),(u=t[p+1])<i&&(i=u),a>s&&(s=a),u>o&&(o=u);l=0!==(l=Math.max(s-r,o-i))?32767/l:0}return ae(f,d,e,r,i,l,0),d}function se(t,n,e,r,i){var s,o;if(i===Oe(t,n,e,r)>0)for(s=n;s<e;s+=r)o=Pe(s,t[s],t[s+1],o);else for(s=e-r;s>=n;s-=r)o=Pe(s,t[s],t[s+1],o);return o&&we(o,o.next)&&(Se(o),o=o.next),o}function oe(t,n){if(!t)return t;n||(n=t);var e,r=t;do{if(e=!1,r.steiner||!we(r,r.next)&&0!==be(r.prev,r,r.next))r=r.next;else{if(Se(r),(r=n=r.prev)===r.next)break;e=!0}}while(e||r!==n);return n}function ae(t,n,e,r,i,s,o){if(t){!o&&s&&function(t,n,e,r){var i=t;do{0===i.z&&(i.z=ye(i.x,i.y,n,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var n,e,r,i,s,o,a,u,l=1;do{for(e=t,t=null,s=null,o=0;e;){for(o++,r=e,a=0,n=0;n<l&&(a++,r=r.nextZ);n++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||e.z<=r.z)?(i=e,e=e.nextZ,a--):(i=r,r=r.nextZ,u--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;e=r}s.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,s);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,s?le(t,r,i,s):ue(t))n.push(a.i/e|0),n.push(t.i/e|0),n.push(u.i/e|0),Se(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?ae(t=he(oe(t),n,e),n,e,r,i,s,2):2===o&&ce(t,n,e,r,i,s):ae(oe(t),n,e,r,i,s,1);break}}}function ue(t){var n=t.prev,e=t,r=t.next;if(be(n,e,r)>=0)return!1;for(var i=n.x,s=e.x,o=r.x,a=n.y,u=e.y,l=r.y,h=i<s?i<o?i:o:s<o?s:o,c=a<u?a<l?a:l:u<l?u:l,f=i>s?i>o?i:o:s>o?s:o,d=a>u?a>l?a:l:u>l?u:l,p=r.next;p!==n;){if(p.x>=h&&p.x<=f&&p.y>=c&&p.y<=d&&ge(i,a,s,u,o,l,p.x,p.y)&&be(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function le(t,n,e,r){var i=t.prev,s=t,o=t.next;if(be(i,s,o)>=0)return!1;for(var a=i.x,u=s.x,l=o.x,h=i.y,c=s.y,f=o.y,d=a<u?a<l?a:l:u<l?u:l,p=h<c?h<f?h:f:c<f?c:f,y=a>u?a>l?a:l:u>l?u:l,m=h>c?h>f?h:f:c>f?c:f,g=ye(d,p,n,e,r),v=ye(y,m,n,e,r),b=t.prevZ,w=t.nextZ;b&&b.z>=g&&w&&w.z<=v;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;b&&b.z>=g;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=v;){if(w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function he(t,n,e){var r=t;do{var i=r.prev,s=r.next.next;!we(i,s)&&Me(i,r,r.next,s)&&ke(i,s)&&ke(s,i)&&(n.push(i.i/e|0),n.push(r.i/e|0),n.push(s.i/e|0),Se(r),Se(r.next),r=t=s),r=r.next}while(r!==t);return oe(r)}function ce(t,n,e,r,i,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ve(o,a)){var u=Ae(o,a);return o=oe(o,o.next),u=oe(u,u.next),ae(o,n,e,r,i,s,0),void ae(u,n,e,r,i,s,0)}a=a.next}o=o.next}while(o!==t)}function fe(t,n){return t.x-n.x}function de(t,n){var e=function(t,n){var e,r=n,i=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>o&&(o=a,e=r.x<r.next.x?r:r.next,a===i))return e}r=r.next}while(r!==n);if(!e)return null;var u,l=e,h=e.x,c=e.y,f=1/0;r=e;do{i>=r.x&&r.x>=h&&i!==r.x&&ge(s<c?i:o,s,h,c,s<c?o:i,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(i-r.x),ke(r,t)&&(u<f||u===f&&(r.x>e.x||r.x===e.x&&pe(e,r)))&&(e=r,f=u)),r=r.next}while(r!==l);return e}(t,n);if(!e)return n;var r=Ae(e,t);return oe(r,r.next),oe(e,e.next)}function pe(t,n){return be(t.prev,t,n.prev)<0&&be(n.next,t,t.next)<0}function ye(t,n,e,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*i|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function me(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function ge(t,n,e,r,i,s,o,a){return(i-o)*(n-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(e-o)*(n-a)&&(e-o)*(s-a)>=(i-o)*(r-a)}function ve(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&Me(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(ke(t,n)&&ke(n,t)&&function(t,n){var e=t,r=!1,i=(t.x+n.x)/2,s=(t.y+n.y)/2;do{e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next}while(e!==t);return r}(t,n)&&(be(t.prev,t,n.prev)||be(t,n.prev,n))||we(t,n)&&be(t.prev,t,t.next)>0&&be(n.prev,n,n.next)>0)}function be(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function we(t,n){return t.x===n.x&&t.y===n.y}function Me(t,n,e,r){var i=Fe(be(t,n,e)),s=Fe(be(t,n,r)),o=Fe(be(e,r,t)),a=Fe(be(e,r,n));return i!==s&&o!==a||(!(0!==i||!xe(t,e,n))||(!(0!==s||!xe(t,r,n))||(!(0!==o||!xe(e,t,r))||!(0!==a||!xe(e,n,r)))))}function xe(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Fe(t){return t>0?1:t<0?-1:0}function ke(t,n){return be(t.prev,t,t.next)<0?be(t,n,t.next)>=0&&be(t,t.prev,n)>=0:be(t,n,t.prev)<0||be(t,t.next,n)<0}function Ae(t,n){var e=new _e(t.i,t.x,t.y),r=new _e(n.i,n.x,n.y),i=t.next,s=n.prev;return t.next=n,n.prev=t,e.next=i,i.prev=e,r.next=e,e.prev=r,s.next=r,r.prev=s,r}function Pe(t,n,e,r){var i=new _e(t,n,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Se(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 _e(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Oe(t,n,e,r){for(var i=0,s=n,o=e-r;s<e;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}re.exports=ie,re.exports.default=ie,ie.deviation=function(t,n,e,r){var i=n&&n.length,s=i?n[0]*e:t.length,o=Math.abs(Oe(t,0,s,e));if(i)for(var a=0,u=n.length;a<u;a++){var l=n[a]*e,h=a<u-1?n[a+1]*e:t.length;o-=Math.abs(Oe(t,l,h,e))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,p=r[a+2]*e;c+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},ie.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},r=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var o=0;o<n;o++)e.vertices.push(t[i][s][o]);i>0&&(r+=t[i-1].length,e.holes.push(r))}return e};var Ce=ht(re.exports),Ee="undefined"!=typeof Float32Array?Float32Array:Array;function Ie(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function $e(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 Te(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}function De(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function ze(t,n,e,r,i){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t}function je(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function Ue(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t}function Ne(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]}function Le(t,n,e){return t[0]=n,t[1]=e,t}function Re(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.hypot(e,r)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t=function(){var t=new Ee(3);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}(),function(){var t=function(){var t=new Ee(4);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();var Ve=function(t){var n=t[0],e=t[1];return Math.hypot(n,e)};!function(){var t=function(){var t=new Ee(2);return Ee!=Float32Array&&(t[0]=0,t[1]=0),t}()}();\n/*!\n * @maptalks/vector-packer v0.96.2\n * LICENSE : UNLICENSED\n * (c) 2016-2024 maptalks.com\n */\nconst He={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function qe(t,n={}){var e=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)Ge(e,t.features[r],n,r);else Ge(e,"Feature"===t.type?t:{geometry:t},n);return e}function Ge(t,n,e,r){if(n.geometry&&n.geometry.geometry){var i=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(e.promoteId?a=n.properties[e.promoteId]:e.generateId&&(a=r||0),"Point"===s)Je(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Je(i[u],o);else if("LineString"===s)Be([i],o);else if("MultiLineString"===s){if(e.lineMetrics){for(u=0;u<i.length;u++)We(i[u],o=[]),t.push(Xe(a,"LineString",o,n.properties));return}Be(i,o)}else if("Polygon"===s)Be(i,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)Ge(t,{id:a,geometry:n.geometry.geometries[u],properties:n.properties},e,r);return}return void console.warn(\`Input data type(${q}s}) is not a valid GeoJSON geometry type.\`)}for(u=0;u<i.length;u++){var l=[];Be(i[u],l),o.push(l)}}t.push(Xe(a,s,o,n.properties))}}function Je(t,n){const e=new dt(t[0],t[1]);e.z=100*(t[2]||0),n.push([e])}function We(t,n){for(let e=0;e<t.length;e++){const r=new dt(t[e][0],t[e][1]);r.z=100*(t[e][2]||0),n.push(r)}}function Be(t,n,e,r){for(var i=0;i<t.length;i++){var s=[];We(t[i],s),n.push(s)}}function Xe(t,n,e,r){return{id:void 0===t?null:t,type:He[n],geometry:e,properties:r}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ye(t,{width:n,height:e},r,i){if(i){if(i.length!==n*e*r)throw new RangeError("mismatched image size")}else i=new Uint8Array(n*e*r);return t.width=n,t.height=e,t.data=i,t}function Ke(t,{width:n,height:e},r){if(n===t.width&&e===t.height)return;const i=Ye({},{width:n,height:e},r);Ze(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,e)},r),t.width=n,t.height=e,t.data=i.data}function Ze(t,n,e,r,i,s){if(0===i.width||0===i.height)return n;if(i.width>t.width||i.height>t.height||e.x>t.width-i.width||e.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>n.width||i.height>n.height||r.x>n.width-i.width||r.y>n.height-i.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 u=0;u<i.height;u++){const l=((e.y+u)*t.width+e.x)*s,h=((r.y+u)*n.width+r.x)*s;for(let t=0;t<i.width*s;t++)a[h+t]=o[l+t]}return n}class Qe{constructor(t,n){Ye(this,t,1,n)}resize(t){Ke(this,t,1)}clone(){return new Qe({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,1)}}class tr{constructor(t,n){Ye(this,t,4,n)}resize(t){Ke(this,t,4)}clone(){return new tr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,4)}}function nr(t){let n=0;for(let e,r,i=0,s=t.length,o=s-1;i<s;o=i++)if(e=t[i],r=t[o],void 0!==e.x){if(e.z||r.z)return 1;n+=(r.x-e.x)*(e.y+r.y)}else{if(e[2]||r[2])return 1;n+=(r[0]-e[0])*(e[1]+r[1])}return n}function er(t,n,e,r,i){const s=t[n*r],o=t[n*r+1],a=t[e*r],u=t[e*r+1];return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function rr(t,n,e){let r=e;return n&&t&&(r=+t[n]),isNaN(r)&&(r=e||0),100*r}function ir(t,n,e,r,i,s,o){n||0===n||(n=1);const a=rr(t.properties,e,r),u=a*n;let l=(s?100*s:0)||a;return i?l=rr(t.properties,i,s):o&&(l=a-rr(t.properties,o,s)),l*=n,{altitude:u,height:l}}function sr(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function or(t){return null==t}function ar(t,n,e){if(t===e||t===n)return t;const r=e-n;return((t-n)%r+r)%r+n}function ur(t,n){if(!n)return null;const e=new Map;for(let r=0;r<n.length;r++){const i=n[r],s=t[i];let o=e.get(s);o||(o=[],e.set(s,o)),o.push(i)}return e}function lr(t){return!(t&t-1)&&0!==t}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class hr{constructor(t,n,{pixelRatio:e}){this.paddedRect=t,this.pixelRatio=e||1,this.padding=n}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class cr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n=Object.keys(t).length,e={},r=new pt(0,0,{autoResize:!0}),i=[],s=n>1?1:0;for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2*s,h:r.data.height+2*s};i.push(o),e[n]=new hr(o,s,r)}if(r.pack(i,{inPlace:!0}),!lr(r.w)||!lr(r.h)){const t=fr(r.w),n=fr(r.h);r.resize(t,n)}const o=new tr({width:r.w,height:r.h});for(const n in t){const r=t[n],i=e[n].paddedRect;tr.copy(r.data,o,{x:0,y:0},{x:i.x+s,y:i.y+s},r.data)}this.image=o,this.positions=e}}function fr(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 dr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},e=new pt(0,0,{autoResize:!0}),r=[];for(const e in t){const i=t[e],s=n[e]={};for(const t in i){const n=i[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const e={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};r.push(e),s[t]={rect:e,metrics:n.metrics}}}e.pack(r,{inPlace:!0});const i=new Qe({width:e.w,height:e.h});for(const e in t){const r=t[e];for(const t in r){const s=r[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[e][t].rect;Qe.copy(s.bitmap,i,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=i,this.positions=n}}function pr(t){return t<65536?Uint16Array:Uint32Array}function yr(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function mr(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function gr(t,n){const e=t.getLength?t.getLength():t.length;if(t instanceof n)return t.slice(0,e);const r=new n(e);t=t.R||t;for(let n=0;n<e;n++)r[n]=t[n]||0;return r}function vr(t){const n=t.type,e=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Je(t.geometry[n],e);else if(2===n)Be(t.geometry,e);else if(3===n)Be(t.geometry,e);else if(5===n)Be(t.geometry,e);else if(6===n)for(let n=0;n<t.geometry.length;n++){const r=[];Be(t.geometry[n],r),e.push(r)}return t.geometry=e,t}function br(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];for(const n in e)t[n]=e[n]}return t}function wr(t){return null==t}function Mr(t){return"number"==typeof t&&!isNaN(t)}function xr(t){return"object"==typeof t&&!!t}function Fr(t){return!wr(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function kr(t){return!wr(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}const Ar=Object.prototype.hasOwnProperty;function Pr(t,n){return Ar.call(t,n)}const Sr=Math.PI/180;function _r(t){return t&&y(t)&&t.property}function Or(t){const{verticalCentimeterToPoint:n,tileRatio:e}=t;return n*e}function Cr(t){return"centimeter"===t||"cm"===t?1:"millimeter"===t||"mm"===t?.1:100}const Er={};function Ir(t,n){if(!Array.isArray(n)){if(n&&void 0!==n.r&&void 0!==n.g&&void 0!==n.b)return t[0]=255*n.r,t[1]=255*n.g,t[2]=255*n.b,t[3]=void 0!==n.a?255*n.a:255,t;n=Er[n]=Er[n]||an(n).unitArray()}for(let e=0;e<n.length;e++)t[e]=255*n[e];return 3===n.length&&(t[3]=255),t}const $r={textFill:1,textSize:1,textOpacity:1,textDx:1,textDy:1,markerWidth:1,markerHeight:1,markerOpacity:1,markerDx:1,markerDy:1,lineWidth:1,lineColor:1,lineOpacity:1,polygonFill:1,polygonOpacity:1,polygonPatternFileWidth:1,polygonPatternFileOrigin:1,rotationX:1,rotationY:1,rotationZ:1,scaleX:1,scaleY:1,scaleZ:1,translationX:1,translationY:1,translationZ:1},Tr={textName:1,markerTextFitPadding:1,markerTextFit:1,lineGradientProperty:1};var Dr=Object.freeze({__proto__:null,checkIfIdentityZoomDependent:function(t,n,e){if(Array.isArray(e)||(e=Object.values(e)),!e||!e.length)return!1;if(!$r[t])return!1;for(let t=0;t<e.length;t++){const r=e[t]&&(e[t].feature||e[t]);if(!r)continue;const i=r.properties&&r.properties[n];if(i&&y(i)&&!m(i).isZoomConstant)return!0}return!1},checkIfZoomFnTypeSymbol:function(t){return!!$r[t]||!!Tr[t]},evaluate:function(t,n,e){return kr(t)?t(void 0!==e?e:null,n):t},extend:br,getAltitudeToLocal:Or,getTubeSizeScale:Cr,hasOwn:Pr,isFnTypeSymbol:_r,isFunction:kr,isInteger:function(t){return(0|t)===t},isNil:wr,isNumber:Mr,isObject:xr,isString:Fr,join:function(t,n){return t.join?t.join(n||","):Array.prototype.join.call(t,n||",")},normalizeColor:Ir,now:function(){return Date.now()},toDegree:function(t){return t/Sr},toRadian:function(t){return t*Sr}});class zr{constructor(t,n,e,r){this.feature=t,this.symbol=n,this.fnTypes=e,this.options=r}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.V(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.V(t,n)}V(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}function jr(t,n,e,r){const i=Math.abs(r)>>15,s=i>>1,o=i%2;let a=r%Math.pow(2,15);const u=n+(s<<14)*Math.sign(n),l=e+(o<<14)*Math.sign(e);return t[0]=u,t[1]=l,a=Math.round(a),t[2]=0===a?r<0?-1:0:a,t}const Ur=Math.pow(2,14),Nr=Math.pow(2,15);\n/*!\n * a compact version of mapbox-gl-style-spec\n * based on mapbox-gl-style-spec@13.28.0\n * https://github.com/mapbox/mapbox-gl-js/tree/main/src/style-spec\n * LICENSE : ISC\n */var Lr,Rr,Vr="undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self?self:{},Hr={exports:{}};function qr(t,...n){for(const e of n)for(const n in e)t[n]=e[n];return t}\n/*! https://mths.be/punycode v1.3.2 by @mathias */Lr=Hr,Rr=Hr.exports,function(t){var n=Rr&&!Rr.nodeType&&Rr,e=Lr&&!Lr.nodeType&&Lr,r="object"==typeof Vr&&Vr;r.global!==r&&r.window!==r&&r.self!==r||(t=r);var i,s,o=2147483647,a=36,u=26,l=38,h=700,c=/^xn--/,f=/[^\\x20-\\x7E]/,d=/[\\x2E\\u3002\\uFF0E\\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=a-1,m=Math.floor,g=String.fromCharCode;function v(t){throw RangeError(p[t])}function b(t,n){for(var e=t.length,r=[];e--;)r[e]=n(t[e]);return r}function w(t,n){var e=t.split("@"),r="";return e.length>1&&(r=e[0]+"@",t=e[1]),r+b((t=t.replace(d,".")).split("."),n).join(".")}function M(t){for(var n,e,r=[],i=0,s=t.length;i<s;)(n=t.charCodeAt(i++))>=55296&&n<=56319&&i<s?56320==(64512&(e=t.charCodeAt(i++)))?r.push(((1023&n)<<10)+(1023&e)+65536):(r.push(n),i--):r.push(n);return r}function x(t){return b(t,(function(t){var n="";return t>65535&&(n+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),n+g(t)})).join("")}function F(t,n){return t+22+75*(t<26)-((0!=n)<<5)}function k(t,n,e){var r=0;for(t=e?m(t/h):t>>1,t+=m(t/n);t>y*u>>1;r+=a)t=m(t/y);return m(r+(y+1)*t/(t+l))}function A(t){var n,e,r,i,s,l,h,c,f,d,p,y=[],g=t.length,b=0,w=128,M=72;for((e=t.lastIndexOf("-"))<0&&(e=0),r=0;r<e;++r)t.charCodeAt(r)>=128&&v("not-basic"),y.push(t.charCodeAt(r));for(i=e>0?e+1:0;i<g;){for(s=b,l=1,h=a;i>=g&&v("invalid-input"),((c=(p=t.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:a)>=a||c>m((o-b)/l))&&v("overflow"),b+=c*l,!(c<(f=h<=M?1:h>=M+u?u:h-M));h+=a)l>m(o/(d=a-f))&&v("overflow"),l*=d;M=k(b-s,n=y.length+1,0==s),m(b/n)>o-w&&v("overflow"),w+=m(b/n),b%=n,y.splice(b++,0,w)}return x(y)}function P(t){var n,e,r,i,s,l,h,c,f,d,p,y,b,w,x,A=[];for(y=(t=M(t)).length,n=128,e=0,s=72,l=0;l<y;++l)(p=t[l])<128&&A.push(g(p));for(r=i=A.length,i&&A.push("-");r<y;){for(h=o,l=0;l<y;++l)(p=t[l])>=n&&p<h&&(h=p);for(h-n>m((o-e)/(b=r+1))&&v("overflow"),e+=(h-n)*b,n=h,l=0;l<y;++l)if((p=t[l])<n&&++e>o&&v("overflow"),p==n){for(c=e,f=a;!(c<(d=f<=s?1:f>=s+u?u:f-s));f+=a)A.push(g(F(d+(x=c-d)%(w=a-d),0))),c=m(x/w);A.push(g(F(c,0))),s=k(e,b,r==i),e=0,++r}++e,++n}return A.join("")}if(i={version:"1.3.2",ucs2:{decode:M,encode:x},decode:A,encode:P,toASCII:function(t){return w(t,(function(t){return f.test(t)?"xn--"+P(t):t}))},toUnicode:function(t){return w(t,(function(t){return c.test(t)?A(t.slice(4).toLowerCase()):t}))}},n&&e)if(Lr.exports==n)e.exports=i;else for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);else t.punycode=i}(Vr);class Gr extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}var Jr=Gr;class Wr{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[t,e]of n)this.bindings[t]=e}concat(t){return new Wr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(\`${q}t} not found in scope.\`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}var Br=Wr;const Xr={kind:"null"},Yr={kind:"number"},Kr={kind:"string"},Zr={kind:"boolean"},Qr={kind:"color"},ti={kind:"object"},ni={kind:"value"},ei={kind:"collator"},ri={kind:"formatted"},ii={kind:"resolvedImage"};function si(t,n){return{kind:"array",itemType:t,N:n}}function oi(t){if("array"===t.kind){const n=oi(t.itemType);return"number"==typeof t.N?\`array<${q}n}, ${q}t.N}>\`:"value"===t.itemType.kind?"array":\`array<${q}n}>\`}return t.kind}const ai=[Xr,Yr,Kr,Zr,Qr,ri,ti,si(ni),ii];function ui(t,n){if("error"===n.kind)return null;if("array"===t.kind){if("array"===n.kind&&(0===n.N&&"value"===n.itemType.kind||!ui(t.itemType,n.itemType))&&("number"!=typeof t.N||t.N===n.N))return null}else{if(t.kind===n.kind)return null;if("value"===t.kind)for(const t of ai)if(!ui(t,n))return null}return\`Expected ${q}oi(t)} but found ${q}oi(n)} instead.\`}function li(t,n){return n.some((n=>n.kind===t.kind))}function hi(t,n){return n.some((n=>"null"===n?null===t:"array"===n?Array.isArray(t):"object"===n?t&&!Array.isArray(t)&&"object"==typeof t:n===typeof t))}var ci,fi={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function di(t){return(t=Math.round(t))<0?0:t>255?255:t}function pi(t){return di("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function yi(t){return function(t){return t<0?0:t>1?1:t}("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function mi(t,n,e){return e<0?e+=1:e>1&&(e-=1),6*e<1?t+(n-t)*e*6:2*e<1?n:3*e<2?t+(n-t)*(2/3-e)*6:t}try{ci={}.parseCSSColor=function(t){var n,e=t.replace(/ /g,"").toLowerCase();if(e in fi)return fi[e].slice();if("#"===e[0])return 4===e.length?(n=parseInt(e.substr(1),16))>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null:7===e.length&&(n=parseInt(e.substr(1),16))>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null;var r=e.indexOf("("),i=e.indexOf(")");if(-1!==r&&i+1===e.length){var s=e.substr(0,r),o=e.substr(r+1,i-(r+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=yi(o.pop());case"rgb":return 3!==o.length?null:[pi(o[0]),pi(o[1]),pi(o[2]),a];case"hsla":if(4!==o.length)return null;a=yi(o.pop());case"hsl":if(3!==o.length)return null;var u=(parseFloat(o[0])%360+360)%360/360,l=yi(o[1]),h=yi(o[2]),c=h<=.5?h*(l+1):h+l-h*l,f=2*h-c;return[di(255*mi(f,c,u+1/3)),di(255*mi(f,c,u)),di(255*mi(f,c,u-1/3)),a];default:return null}}return null}}catch(dt){}class gi{constructor(t,n,e,r=1){this.r=t,this.g=n,this.b=e,this.a=r}static parse(t){if(!t)return;if(t instanceof gi)return t;if("string"!=typeof t)return;const n=ci(t);return n?new gi(n[0]/255*n[3],n[1]/255*n[3],n[2]/255*n[3],n[3]):void 0}toString(){const[t,n,e,r]=this.toArray();return\`rgba(${q}Math.round(t)},${q}Math.round(n)},${q}Math.round(e)},${q}r})\`}toArray(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[255*t/r,255*n/r,255*e/r,r]}toArray01(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[t/r,n/r,e/r,r]}toArray01PremultipliedAlpha(){const{r:t,g:n,b:e,a:r}=this;return[t,n,e,r]}}gi.black=new gi(0,0,0,1),gi.white=new gi(1,1,1,1),gi.transparent=new gi(0,0,0,0),gi.red=new gi(1,0,0,1),gi.blue=new gi(0,0,1,1);var vi=gi;class bi{constructor(t,n,e){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=e,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class wi{constructor(t,n,e,r,i){this.text=t.normalize?t.normalize():t,this.image=n,this.scale=e,this.fontStack=r,this.textColor=i}}class Mi{constructor(t){this.sections=t}static fromString(t){return new Mi([new wi(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Mi?t:Mi.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const n of this.sections){if(n.image){t.push(["image",n.image.name]);continue}t.push(n.text);const e={};n.fontStack&&(e["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(e["font-scale"]=n.scale),n.textColor&&(e["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(e)}return t}}class xi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new xi({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Fi(t,n,e,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255&&"number"==typeof e&&e>=0&&e<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:\`Invalid rgba value [${q}[t,n,e,r].join(", ")}]: 'a' must be between 0 and 1.\`:\`Invalid rgba value [${q}("number"==typeof r?[t,n,e,r]:[t,n,e]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.\`}function ki(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof vi)return!0;if(t instanceof bi)return!0;if(t instanceof Mi)return!0;if(t instanceof xi)return!0;if(Array.isArray(t)){for(const n of t)if(!ki(n))return!1;return!0}if("object"==typeof t){for(const n in t)if(!ki(t[n]))return!1;return!0}return!1}function Ai(t){if(null===t)return Xr;if("string"==typeof t)return Kr;if("boolean"==typeof t)return Zr;if("number"==typeof t)return Yr;if(t instanceof vi)return Qr;if(t instanceof bi)return ei;if(t instanceof Mi)return ri;if(t instanceof xi)return ii;if(Array.isArray(t)){const n=t.length;let e;for(const n of t){const t=Ai(n);if(e){if(e===t)continue;e=ni;break}e=t}return si(e||ni,n)}return ti}function Pi(t){const n=typeof t;return null===t?"":"string"===n||"number"===n||"boolean"===n?String(t):t instanceof vi||t instanceof Mi||t instanceof xi?t.toString():JSON.stringify(t)}class Si{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(2!==t.length)return n.error(\`'literal' expression requires exactly one argument, but found ${q}t.length-1} instead.\`);if(!ki(t[1]))return n.error("invalid value");const e=t[1];let r=Ai(e);const i=n.expectedType;return"array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new Si(r,e)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof vi?["rgba"].concat(this.value.toArray()):this.value instanceof Mi?this.value.serialize():this.value}}var _i=Si,Oi=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Ci={string:Kr,number:Yr,boolean:Zr,object:ti};class Ei{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let e,r=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const e=t[1];if("string"!=typeof e||!(e in Ci)||"object"===e)return n.error('The item type argument of "array" must be one of string, number, boolean',1);i=Ci[e],r++}else i=ni;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);s=t[2],r++}e=si(i,s)}else e=Ci[i];const s=[];for(;r<t.length;r++){const e=n.parse(t[r],r,ni);if(!e)return null;s.push(e)}return new Ei(e,s)}evaluate(t){for(let n=0;n<this.args.length;n++){const e=this.args[n].evaluate(t);if(!ui(this.type,Ai(e)))return e;if(n===this.args.length-1)throw new Oi(\`Expected value to be of type ${q}oi(this.type)}, but found ${q}oi(Ai(e))} instead.\`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,n=[t.kind];if("array"===t.kind){const e=t.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){n.push(e.kind);const r=t.N;("number"==typeof r||this.args.length>1)&&n.push(r)}}return n.concat(this.args.map((t=>t.serialize())))}}var Ii=Ei;class $i{constructor(t){this.type=ri,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[1];if(!Array.isArray(e)&&"object"==typeof e)return n.error("First argument must be an image or text section.");const r=[];let i=!1;for(let e=1;e<=t.length-1;++e){const s=t[e];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=n.parse(s["font-scale"],1,Yr),!t))return null;let e=null;if(s["text-font"]&&(e=n.parse(s["text-font"],1,si(Kr)),!e))return null;let o=null;if(s["text-color"]&&(o=n.parse(s["text-color"],1,Qr),!o))return null;const a=r[r.length-1];a.scale=t,a.font=e,a.textColor=o}else{const s=n.parse(t[e],1,ni);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:s,scale:null,font:null,textColor:null})}}return new $i(r)}evaluate(t){return new Mi(this.sections.map((n=>{const e=n.content.evaluate(t);return Ai(e)===ii?new wi("",e,null,null,null):new wi(Pi(e),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null)})))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const n of this.sections){t.push(n.content.serialize());const e={};n.scale&&(e["font-scale"]=n.scale.serialize()),n.font&&(e["text-font"]=n.font.serialize()),n.textColor&&(e["text-color"]=n.textColor.serialize()),t.push(e)}return t}}class Ti{constructor(t){this.type=ii,this.input=t}static parse(t,n){if(2!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Kr);return e?new Ti(e):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),e=xi.fromString(n);return e&&t.availableImages&&(e.available=t.availableImages.indexOf(n)>-1),e}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Di={"to-boolean":Zr,"to-color":Qr,"to-number":Yr,"to-string":Kr};class zi{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[0];if(("to-boolean"===e||"to-string"===e)&&2!==t.length)return n.error("Expected one argument.");const r=Di[e],i=[];for(let e=1;e<t.length;e++){const r=n.parse(t[e],e,ni);if(!r)return null;i.push(r)}return new zi(r,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let n,e;for(const r of this.args){if(n=r.evaluate(t),e=null,n instanceof vi)return n;if("string"==typeof n){const e=t.parseColor(n);if(e)return e}else if(Array.isArray(n)&&(e=n.length<3||n.length>4?\`Invalid rbga value ${q}JSON.stringify(n)}: expected an array containing either three or four numeric values.\`:Fi(n[0],n[1],n[2],n[3]),!e))return new vi(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new Oi(e||\`Could not parse color from value '${q}"string"==typeof n?n:String(JSON.stringify(n))}'\`)}if("number"===this.type.kind){let n=null;for(const e of this.args){if(n=e.evaluate(t),null===n)return 0;const r=Number(n);if(!isNaN(r))return r}throw new Oi(\`Could not convert ${q}JSON.stringify(n)} to number.\`)}return"formatted"===this.type.kind?Mi.fromString(Pi(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?xi.fromString(Pi(this.args[0].evaluate(t))):Pi(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new $i([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Ti(this.args[0]).serialize();const t=[\`to-${q}this.type.kind}\`];return this.eachChild((n=>{t.push(n.serialize())})),t}}var ji=zi;const Ui=["Unknown","Point","LineString","Polygon"];var Ni=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.H={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ui[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,n=this.featureDistanceData.scale,{x:e,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(e*n-t[0])+this.featureDistanceData.bearing[1]*(r*n-t[1])}return 0}parseColor(t){let n=this.H[t];return n||(n=this.H[t]=vi.parse(t)),n}};class Li{constructor(t,n,e,r){this.name=t,this.type=n,this.q=e,this.args=r}evaluate(t){return this.q(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,n){const e=t[0],r=Li.definitions[e];if(!r)return n.error(\`Unknown expression "${q}e}". If you wanted a literal array, use ["literal", [...]].\`,0);const i=Array.isArray(r)?r[0]:r.type,s=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=s.filter((([n])=>!Array.isArray(n)||n.length===t.length-1));let a=null;for(const[r,s]of o){a=new ds(n.registry,n.path,null,n.scope);const o=[];let u=!1;for(let n=1;n<t.length;n++){const e=t[n],i=Array.isArray(r)?r[n-1]:r.type,s=a.parse(e,1+o.length,i);if(!s){u=!0;break}o.push(s)}if(!u)if(Array.isArray(r)&&r.length!==o.length)a.error(\`Expected ${q}r.length} arguments, but found ${q}o.length} instead.\`);else{for(let t=0;t<o.length;t++){const n=Array.isArray(r)?r[t]:r.type,e=o[t];a.concat(t+1).checkSubtype(n,e.type)}if(0===a.errors.length)return new Li(e,i,s,o)}}if(1===o.length)n.errors.push(...a.errors);else{const e=(o.length?o:s).map((([t])=>{return n=t,Array.isArray(n)?\`(${q}n.map(oi).join(", ")})\`:\`(${q}oi(n.type)}...)\`;var n})).join(" | "),r=[];for(let e=1;e<t.length;e++){const i=n.parse(t[e],1+r.length);if(!i)return null;r.push(oi(i.type))}n.error(\`Expected arguments of type ${q}e}, but found (${q}r.join(", ")}) instead.\`)}return null}static register(t,n){Li.definitions=n;for(const e in n)t[e]=Li}}var Ri=Li;class Vi{constructor(t,n,e){this.type=ei,this.locale=e,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(2!==t.length)return n.error("Expected one argument.");const e=t[1];if("object"!=typeof e||Array.isArray(e))return n.error("Collator options argument must be an object.");const r=n.parse(void 0!==e["case-sensitive"]&&e["case-sensitive"],1,Zr);if(!r)return null;const i=n.parse(void 0!==e["diacritic-sensitive"]&&e["diacritic-sensitive"],1,Zr);if(!i)return null;let s=null;return e.locale&&(s=n.parse(e.locale,1,Kr),!s)?null:new Vi(r,i,s)}evaluate(t){return new bi(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Hi=8192;function qi(t,n){t[0]=Math.min(t[0],n[0]),t[1]=Math.min(t[1],n[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}function Gi(t,n){return!(t[0]<=n[0]||t[2]>=n[2]||t[1]<=n[1]||t[3]>=n[3])}function Ji(t,n){const e=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,n.z);return[Math.round(e*i*Hi),Math.round(r*i*Hi)]}function Wi(t,n,e){const r=t[0]-n[0],i=t[1]-n[1],s=t[0]-e[0],o=t[1]-e[1];return r*o-s*i==0&&r*s<=0&&i*o<=0}function Bi(t,n){let e=!1;for(let o=0,a=n.length;o<a;o++){const a=n[o];for(let n=0,o=a.length;n<o-1;n++){if(Wi(t,a[n],a[n+1]))return!1;(i=a[n])[1]>(r=t)[1]!=(s=a[n+1])[1]>r[1]&&r[0]<(s[0]-i[0])*(r[1]-i[1])/(s[1]-i[1])+i[0]&&(e=!e)}}var r,i,s;return e}function Xi(t,n){for(let e=0;e<n.length;e++)if(Bi(t,n[e]))return!0;return!1}function Yi(t,n,e,r){const i=r[0]-e[0],s=r[1]-e[1],o=(t[0]-e[0])*s-i*(t[1]-e[1]),a=(n[0]-e[0])*s-i*(n[1]-e[1]);return o>0&&a<0||o<0&&a>0}function Ki(t,n,e){for(const l of e)for(let e=0;e<l.length-1;++e)if(void 0,void 0,0!=(a=[(o=l[e+1])[0]-(s=l[e])[0],o[1]-s[1]])[0]*(u=[(i=n)[0]-(r=t)[0],i[1]-r[1]])[1]-a[1]*u[0]&&Yi(r,i,s,o)&&Yi(s,o,r,i))return!0;var r,i,s,o,a,u;return!1}function Zi(t,n){for(let e=0;e<t.length;++e)if(!Bi(t[e],n))return!1;for(let e=0;e<t.length-1;++e)if(Ki(t[e],t[e+1],n))return!1;return!0}function Qi(t,n){for(let e=0;e<n.length;e++)if(Zi(t,n[e]))return!0;return!1}function ts(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=[];for(let r=0;r<t[i].length;r++){const o=Ji(t[i][r],e);qi(n,o),s.push(o)}r.push(s)}return r}function ns(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=ts(t[i],n,e);r.push(s)}return r}function es(t,n,e,r){if(t[0]<e[0]||t[0]>e[2]){const n=.5*r;let i=t[0]-e[0]>n?-r:e[0]-t[0]>n?r:0;0===i&&(i=t[0]-e[2]>n?-r:e[2]-t[0]>n?r:0),t[0]+=i}qi(n,t)}function rs(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const r of t)for(const t of r){const r=[t.x+s[0],t.y+s[1]];es(r,n,e,i),o.push(r)}return o}function is(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const e of t){const t=[];for(const r of e){const e=[r.x+s[0],r.y+s[1]];qi(n,e),t.push(e)}o.push(t)}if(n[2]-n[0]<=i/2){(a=n)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const r of t)es(r,n,e,i)}var a;return o}class ss{constructor(t,n){this.type=Zr,this.geojson=t,this.geometries=n}static parse(t,n){if(2!==t.length)return n.error(\`'within' expression requires exactly one argument, but found ${q}t.length-1} instead.\`);if(ki(t[1])){const n=t[1];if("FeatureCollection"===n.type)for(let t=0;t<n.features.length;++t){const e=n.features[t].geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ss(n,n.features[t].geometry)}else if("Feature"===n.type){const t=n.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new ss(n,n.geometry)}else if("Polygon"===n.type||"MultiPolygon"===n.type)return new ss(n,n)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Bi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Xi(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Zi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Qi(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var os=ss;function as(t){if(t instanceof Ri){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof os)return!1;let n=!0;return t.eachChild((t=>{n&&!as(t)&&(n=!1)})),n}function us(t){if(t instanceof Ri&&"feature-state"===t.name)return!1;let n=!0;return t.eachChild((t=>{n&&!us(t)&&(n=!1)})),n}function ls(t,n){if(t instanceof Ri&&n.indexOf(t.name)>=0)return!1;let e=!0;return t.eachChild((t=>{e&&!ls(t,n)&&(e=!1)})),e}class hs{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(2!==t.length||"string"!=typeof t[1])return n.error("'var' expression requires exactly one string literal argument.");const e=t[1];return n.scope.has(e)?new hs(e,n.scope.get(e)):n.error(\`Unknown variable "${q}e}". Make sure "${q}e}" has been bound in an enclosing "let" expression before using it.\`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var cs=hs;class fs{constructor(t,n=[],e,r=new Br,i=[]){this.registry=t,this.path=n,this.key=n.map((t=>\`[${q}t}]\`)).join(""),this.scope=r,this.errors=i,this.expectedType=e}parse(t,n,e,r,i={}){return n?this.concat(n,e,r).G(t,i):this.G(t,i)}G(t,n){function e(t,n,e){return"assert"===e?new Ii(n,[t]):"coerce"===e?new ji(n,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(\`Expression name must be a string, but found ${q}typeof r} instead. If you wanted a literal array, use ["literal", [...]].\`,0),null;const i=this.registry[r];if(i){let r=i.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else r=e(r,t,n.typeAnnotation||"coerce");else r=e(r,t,n.typeAnnotation||"assert")}if(!(r instanceof _i)&&"resolvedImage"!==r.type.kind&&ps(r)){const n=new Ni;try{r=new _i(r.type,r.evaluate(n))}catch(t){return this.error(t.message),null}}return r}return this.error(\`Unknown expression "${q}r}". If you wanted a literal array, use ["literal", [...]].\`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':\`Expected an array, but found ${q}typeof t} instead.\`)}concat(t,n,e){const r="number"==typeof t?this.path.concat(t):this.path,i=e?this.scope.concat(e):this.scope;return new fs(this.registry,r,n||null,i,this.errors)}error(t,...n){const e=\`${q}this.key}${q}n.map((t=>\`[${q}t}]\`)).join("")}\`;this.errors.push(new Jr(e,t))}checkSubtype(t,n){const e=ui(t,n);return e&&this.error(e),e}}var ds=fs;function ps(t){if(t instanceof cs)return ps(t.boundExpression);if(t instanceof Ri&&"error"===t.name)return!1;if(t instanceof Vi)return!1;if(t instanceof os)return!1;const n=t instanceof ji||t instanceof Ii;let e=!0;return t.eachChild((t=>{e=n?e&&ps(t):e&&t instanceof _i})),!!e&&as(t)&&ls(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function ys(t,n){const e=t.length-1;let r,i,s=0,o=e,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=t[a],i=t[a+1],r<=n){if(a===e||n<i)return a;s=a+1}else{if(!(r>n))throw new Oi("Input is not a number.");o=a-1}return 0}class ms{constructor(t,n,e){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[t,n]of e)this.labels.push(t),this.outputs.push(n)}static parse(t,n){if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${q}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=[];let i=null;n.expectedType&&"value"!==n.expectedType.kind&&(i=n.expectedType);for(let e=1;e<t.length;e+=2){const s=1===e?-1/0:t[e],o=t[e+1],a=e,u=e+1;if("number"!=typeof s)return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=s)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const l=n.parse(o,u,i);if(!l)return null;i=i||l.type,r.push([s,l])}return new ms(i,e,r)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;return r>=n[i-1]?e[i-1].evaluate(t):e[ys(n,r)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let n=0;n<this.labels.length;n++)n>0&&t.push(this.labels[n]),t.push(this.outputs[n].serialize());return t}}var gs=ms,vs=bs;function bs(t,n,e,r){this.cx=3*t,this.bx=3*(e-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(r-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=e,this.p2y=r}function ws(t,n,e){return t*(1-e)+n*e}bs.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(void 0===n&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var e=t,r=0;r<8;r++){var i=this.sampleCurveX(e)-t;if(Math.abs(i)<n)return e;var s=this.sampleCurveDerivativeX(e);if(Math.abs(s)<1e-6)break;e-=i/s}var o=0,a=1;for(e=t,r=0;r<20&&(i=this.sampleCurveX(e),!(Math.abs(i-t)<n));r++)t>i?o=e:a=e,e=.5*(a-o)+o;return e},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}};var Ms=Object.freeze({__proto__:null,number:ws,color:function(t,n,e){return new vi(ws(t.r,n.r,e),ws(t.g,n.g,e),ws(t.b,n.b,e),ws(t.a,n.a,e))},array:function(t,n,e){return t.map(((t,r)=>ws(t,n[r],e)))}});const xs=.95047,Fs=1.08883,ks=4/29,As=6/29,Ps=3*As*As,Ss=As*As*As,_s=Math.PI/180,Os=180/Math.PI;function Cs(t){return t>Ss?Math.pow(t,1/3):t/Ps+ks}function Es(t){return t>As?t*t*t:Ps*(t-ks)}function Is(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function $s(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ts(t){const n=$s(t.r),e=$s(t.g),r=$s(t.b),i=Cs((.4124564*n+.3575761*e+.1804375*r)/xs),s=Cs((.2126729*n+.7151522*e+.072175*r)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Cs((.0193339*n+.119192*e+.9503041*r)/Fs)),alpha:t.a}}function Ds(t){let n=(t.l+16)/116,e=isNaN(t.a)?n:n+t.a/500,r=isNaN(t.b)?n:n-t.b/200;return n=1*Es(n),e=xs*Es(e),r=Fs*Es(r),new vi(Is(3.2404542*e-1.5371385*n-.4985314*r),Is(-.969266*e+1.8760108*n+.041556*r),Is(.0556434*e-.2040259*n+1.0572252*r),t.alpha)}function zs(t,n,e){const r=n-t;return t+e*(r>180||r<-180?r-360*Math.round(r/360):r)}const js={forward:Ts,reverse:Ds,interpolate:function(t,n,e){return{l:ws(t.l,n.l,e),a:ws(t.a,n.a,e),b:ws(t.b,n.b,e),alpha:ws(t.alpha,n.alpha,e)}}},Us={forward:function(t){const{l:n,a:e,b:r}=Ts(t),i=Math.atan2(r,e)*Os;return{h:i<0?i+360:i,c:Math.sqrt(e*e+r*r),l:n,alpha:t.a}},reverse:function(t){const n=t.h*_s,e=t.c;return Ds({l:t.l,a:Math.cos(n)*e,b:Math.sin(n)*e,alpha:t.alpha})},interpolate:function(t,n,e){return{h:zs(t.h,n.h,e),c:ws(t.c,n.c,e),l:ws(t.l,n.l,e),alpha:ws(t.alpha,n.alpha,e)}}};var Ns=Object.freeze({__proto__:null,lab:js,hcl:Us});class Ls{constructor(t,n,e,r,i){this.type=t,this.operator=n,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(const[t,n]of i)this.labels.push(t),this.outputs.push(n)}static interpolationFactor(t,n,e,r){let i=0;if("exponential"===t.name)i=Rs(n,t.base,e,r);else if("linear"===t.name)i=Rs(n,1,e,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new vs(s[0],s[1],s[2],s[3]).solve(Rs(n,1,e,r))}return i}static parse(t,n){let[e,r,i,...s]=t;if(!Array.isArray(r)||0===r.length)return n.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return n.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return n.error(\`Unknown interpolation type ${q}String(r[0])}\`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${q}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(i=n.parse(i,2,Yr),!i)return null;const o=[];let a=null;"interpolate-hcl"===e||"interpolate-lab"===e?a=Qr:n.expectedType&&"value"!==n.expectedType.kind&&(a=n.expectedType);for(let t=0;t<s.length;t+=2){const e=s[t],r=s[t+1],i=t+3,u=t+4;if("number"!=typeof e)return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=e)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const l=n.parse(r,u,a);if(!l)return null;a=a||l.type,o.push([e,l])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Ls(a,e,r,i,o):n.error(\`Type ${q}oi(a)} is not interpolatable.\`)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;if(r>=n[i-1])return e[i-1].evaluate(t);const s=ys(n,r),o=Ls.interpolationFactor(this.interpolation,r,n[s],n[s+1]),a=e[s].evaluate(t),u=e[s+1].evaluate(t);return"interpolate"===this.operator?Ms[this.type.kind.toLowerCase()](a,u,o):"interpolate-hcl"===this.operator?Us.reverse(Us.interpolate(Us.forward(a),Us.forward(u),o)):js.reverse(js.interpolate(js.forward(a),js.forward(u),o))}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const n=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)n.push(this.labels[t],this.outputs[t].serialize());return n}}function Rs(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}var Vs=Ls;class Hs{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expectected at least one argument.");let e=null;const r=n.expectedType;r&&"value"!==r.kind&&(e=r);const i=[];for(const r of t.slice(1)){const t=n.parse(r,1+i.length,e,void 0,{typeAnnotation:"omit"});if(!t)return null;e=e||t.type,i.push(t)}const s=r&&i.some((t=>ui(r,t.type)));return new Hs(s?ni:e,i)}evaluate(t){let n,e=null,r=0;for(const i of this.args){if(r++,e=i.evaluate(t),e&&e instanceof xi&&!e.available&&(n||(n=e),e=null,r===this.args.length))return n;if(null!==e)break}return e}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var qs=Hs;class Gs{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found ${q}t.length-1} instead.\`);const e=[];for(let r=1;r<t.length-1;r+=2){const i=t[r];if("string"!=typeof i)return n.error(\`Expected string, but found ${q}typeof i} instead.\`,r);if(/[^a-zA-Z0-9_]/.test(i))return n.error("Variable names must contain only alphanumeric characters or '_'.",r);const s=n.parse(t[r+1],r+1);if(!s)return null;e.push([i,s])}const r=n.parse(t[t.length-1],t.length-1,n.expectedType,e);return r?new Gs(e,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[n,e]of this.bindings)t.push(n,e.serialize());return t.push(this.result.serialize()),t}}var Js=Gs;class Ws{constructor(t,n,e){this.type=t,this.index=n,this.input=e}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,Yr),r=n.parse(t[2],2,si(n.expectedType||ni));return e&&r?new Ws(r.type.itemType,e,r):null}evaluate(t){const n=this.index.evaluate(t),e=this.input.evaluate(t);if(n<0)throw new Oi(\`Array index out of bounds: ${q}n} < 0.\`);if(n>=e.length)throw new Oi(\`Array index out of bounds: ${q}n} > ${q}e.length-1}.\`);if(n!==Math.floor(n))throw new Oi(\`Array index must be an integer, but found ${q}n} instead.\`);return e[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Bs=Ws;class Xs{constructor(t,n){this.type=Zr,this.needle=t,this.haystack=n}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);return e&&r?li(e.type,[Zr,Kr,Yr,Xr,ni])?new Xs(e,r):n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(e.type)} instead\`):null}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(null==e)return!1;if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${q}oi(Ai(e))} instead.\`);return e.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Ys=Xs;class Ks{constructor(t,n,e){this.type=Yr,this.needle=t,this.haystack=n,this.fromIndex=e}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);if(!e||!r)return null;if(!li(e.type,[Zr,Kr,Yr,Xr,ni]))return n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new Ks(e,r,i):null}return new Ks(e,r)}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${q}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${q}oi(Ai(e))} instead.\`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return e.indexOf(n,r)}return e.indexOf(n)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Zs=Ks;class Qs{constructor(t,n,e,r,i,s){this.inputType=t,this.type=n,this.input=e,this.cases=r,this.outputs=i,this.otherwise=s}static parse(t,n){if(t.length<5)return n.error(\`Expected at least 4 arguments, but found only ${q}t.length-1}.\`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let e,r;n.expectedType&&"value"!==n.expectedType.kind&&(r=n.expectedType);const i={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const u=t[o+1];Array.isArray(a)||(a=[a]);const l=n.concat(o);if(0===a.length)return l.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return l.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return l.error(\`Branch labels must be integers no larger than ${q}Number.MAX_SAFE_INTEGER}.\`);if("number"==typeof t&&Math.floor(t)!==t)return l.error("Numeric branch labels must be integer values.");if(e){if(l.checkSubtype(e,Ai(t)))return null}else e=Ai(t);if(void 0!==i[String(t)])return l.error("Branch labels must be unique.");i[String(t)]=s.length}const h=n.parse(u,o,r);if(!h)return null;r=r||h.type,s.push(h)}const o=n.parse(t[1],1,ni);if(!o)return null;const a=n.parse(t[t.length-1],t.length-1,r);return a?"value"!==o.type.kind&&n.concat(1).checkSubtype(e,o.type)?null:new Qs(e,r,o,i,s,a):null}evaluate(t){const n=this.input.evaluate(t);return(Ai(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],n=Object.keys(this.cases).sort(),e=[],r={};for(const t of n){const n=r[this.cases[t]];void 0===n?(r[this.cases[t]]=e.length,e.push([this.cases[t],[t]])):e[n][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[n,r]of e)t.push(1===r.length?i(r[0]):r.map(i)),t.push(this.outputs[n].serialize());return t.push(this.otherwise.serialize()),t}}var to=Qs;class no{constructor(t,n,e){this.type=t,this.branches=n,this.otherwise=e}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found only ${q}t.length-1}.\`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let e;n.expectedType&&"value"!==n.expectedType.kind&&(e=n.expectedType);const r=[];for(let i=1;i<t.length-1;i+=2){const s=n.parse(t[i],i,Zr);if(!s)return null;const o=n.parse(t[i+1],i+1,e);if(!o)return null;r.push([s,o]),e=e||o.type}const i=n.parse(t[t.length-1],t.length-1,e);return i?new no(e,r,i):null}evaluate(t){for(const[n,e]of this.branches)if(n.evaluate(t))return e.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,e]of this.branches)t(n),t(e);t(this.otherwise)}outputDefined(){return this.branches.every((([t,n])=>n.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var eo=no;class ro{constructor(t,n,e,r){this.type=t,this.input=n,this.beginIndex=e,this.endIndex=r}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,Yr);if(!e||!r)return null;if(!li(e.type,[si(ni),Kr,ni]))return n.error(\`Expected first argument to be of type array or string, but found ${q}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new ro(e.type,e,r,i):null}return new ro(e.type,e,r)}evaluate(t){const n=this.input.evaluate(t),e=this.beginIndex.evaluate(t);if(!hi(n,["string","array"]))throw new Oi(\`Expected first argument to be of type array or string, but found ${q}oi(Ai(n))} instead.\`);if(this.endIndex){const r=this.endIndex.evaluate(t);return n.slice(e,r)}return n.slice(e)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var io=ro;function so(t,n){return"=="===t||"!="===t?"boolean"===n.kind||"string"===n.kind||"number"===n.kind||"null"===n.kind||"value"===n.kind:"string"===n.kind||"number"===n.kind||"value"===n.kind}function oo(t,n,e,r){return 0===r.compare(n,e)}function ao(t,n,e){const r="=="!==t&&"!="!==t;return class i{constructor(t,n,e){this.type=Zr,this.lhs=t,this.rhs=n,this.collator=e,this.hasUntypedArgument="value"===t.type.kind||"value"===n.type.kind}static parse(t,n){if(3!==t.length&&4!==t.length)return n.error("Expected two or three arguments.");const e=t[0];let s=n.parse(t[1],1,ni);if(!s)return null;if(!so(e,s.type))return n.concat(1).error(\`"${q}e}" comparisons are not supported for type '${q}oi(s.type)}'.\`);let o=n.parse(t[2],2,ni);if(!o)return null;if(!so(e,o.type))return n.concat(2).error(\`"${q}e}" comparisons are not supported for type '${q}oi(o.type)}'.\`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error(\`Cannot compare types '${q}oi(s.type)}' and '${q}oi(o.type)}'.\`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Ii(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Ii(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error("Cannot use collator to compare non-string types.");if(a=n.parse(t[3],3,ei),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const n=Ai(s),e=Ai(o);if(n.kind!==e.kind||"string"!==n.kind&&"number"!==n.kind)throw new Oi(\`Expected arguments for "${q}t}" to be (string, string) or (number, number), but found (${q}n.kind}, ${q}e.kind}) instead.\`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=Ai(s),e=Ai(o);if("string"!==t.kind||"string"!==e.kind)return n(i,s,o)}return this.collator?e(i,s,o,this.collator.evaluate(i)):n(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const n=[t];return this.eachChild((t=>{n.push(t.serialize())})),n}}}const uo=ao("==",(function(t,n,e){return n===e}),oo),lo=ao("!=",(function(t,n,e){return n!==e}),(function(t,n,e,r){return!oo(0,n,e,r)})),ho=ao("<",(function(t,n,e){return n<e}),(function(t,n,e,r){return r.compare(n,e)<0})),co=ao(">",(function(t,n,e){return n>e}),(function(t,n,e,r){return r.compare(n,e)>0})),fo=ao("<=",(function(t,n,e){return n<=e}),(function(t,n,e,r){return r.compare(n,e)<=0})),po=ao(">=",(function(t,n,e){return n>=e}),(function(t,n,e,r){return r.compare(n,e)>=0}));class yo{constructor(t,n,e,r,i,s){this.type=Kr,this.number=t,this.locale=n,this.currency=e,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,n){if(3!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return n.error("NumberFormat options argument must be an object.");let i=null;if(r.locale&&(i=n.parse(r.locale,1,Kr),!i))return null;let s=null;if(r.currency&&(s=n.parse(r.currency,1,Kr),!s))return null;let o=null;if(r.unit&&(o=n.parse(r.unit,1,Kr),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=n.parse(r["min-fraction-digits"],1,Yr),!a))return null;let u=null;return r["max-fraction-digits"]&&(u=n.parse(r["max-fraction-digits"],1,Yr),!u)?null:new yo(e,i,s,o,a,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class mo{constructor(t){this.type=Yr,this.input=t}static parse(t,n){if(2!==t.length)return n.error(\`Expected 1 argument, but found ${q}t.length-1} instead.\`);const e=n.parse(t[1],1);return e?"array"!==e.type.kind&&"string"!==e.type.kind&&"value"!==e.type.kind?n.error(\`Expected argument of type string or array, but found ${q}oi(e.type)} instead.\`):new mo(e):null}evaluate(t){const n=this.input.evaluate(t);if("string"==typeof n)return n.length;if(Array.isArray(n))return n.length;throw new Oi(\`Expected value to be of type string or array, but found ${q}oi(Ai(n))} instead.\`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((n=>{t.push(n.serialize())})),t}}const go={"==":uo,"!=":lo,">":co,"<":ho,">=":po,"<=":fo,array:Ii,at:Bs,boolean:Ii,case:eo,coalesce:qs,collator:Vi,format:$i,image:Ti,in:Ys,"index-of":Zs,interpolate:Vs,"interpolate-hcl":Vs,"interpolate-lab":Vs,length:mo,let:Js,literal:_i,match:to,number:Ii,"number-format":yo,object:Ii,slice:io,step:gs,string:Ii,"to-boolean":ji,"to-color":ji,"to-number":ji,"to-string":ji,var:cs,within:os};function vo(t,[n,e,r,i]){n=n.evaluate(t),e=e.evaluate(t),r=r.evaluate(t);const s=i?i.evaluate(t):1,o=Fi(n,e,r,s);if(o)throw new Oi(o);return new vi(n/255*s,e/255*s,r/255*s,s)}function bo(t,n){return t in n}function wo(t,n){const e=n[t];return void 0===e?null:e}function Mo(t){return{type:t}}Ri.register(go,{error:[{kind:"error"},[Kr],(t,[n])=>{throw new Oi(n.evaluate(t))}],typeof:[Kr,[ni],(t,[n])=>oi(Ai(n.evaluate(t)))],"to-rgba":[si(Yr,4),[Qr],(t,[n])=>n.evaluate(t).toArray()],rgb:[Qr,[Yr,Yr,Yr],vo],rgba:[Qr,[Yr,Yr,Yr,Yr],vo],has:{type:Zr,overloads:[[[Kr],(t,[n])=>bo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>bo(n.evaluate(t),e.evaluate(t))]]},get:{type:ni,overloads:[[[Kr],(t,[n])=>wo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>wo(n.evaluate(t),e.evaluate(t))]]},"feature-state":[ni,[Kr],(t,[n])=>wo(n.evaluate(t),t.featureState||{})],properties:[ti,[],t=>t.properties()],"geometry-type":[Kr,[],t=>t.geometryType()],id:[ni,[],t=>t.id()],zoom:[Yr,[],t=>t.globals.zoom],pitch:[Yr,[],t=>t.globals.pitch||0],"distance-from-center":[Yr,[],t=>t.distanceFromCenter()],"heatmap-density":[Yr,[],t=>t.globals.heatmapDensity||0],"line-progress":[Yr,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Yr,[],t=>t.globals.skyRadialProgress||0],accumulated:[ni,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Yr,Mo(Yr),(t,n)=>{let e=0;for(const r of n)e+=r.evaluate(t);return e}],"*":[Yr,Mo(Yr),(t,n)=>{let e=1;for(const r of n)e*=r.evaluate(t);return e}],"-":{type:Yr,overloads:[[[Yr,Yr],(t,[n,e])=>n.evaluate(t)-e.evaluate(t)],[[Yr],(t,[n])=>-n.evaluate(t)]]},"/":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)/e.evaluate(t)],"%":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)%e.evaluate(t)],ln2:[Yr,[],()=>Math.LN2],pi:[Yr,[],()=>Math.PI],e:[Yr,[],()=>Math.E],"^":[Yr,[Yr,Yr],(t,[n,e])=>Math.pow(n.evaluate(t),e.evaluate(t))],sqrt:[Yr,[Yr],(t,[n])=>Math.sqrt(n.evaluate(t))],log10:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN10],ln:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))],log2:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN2],sin:[Yr,[Yr],(t,[n])=>Math.sin(n.evaluate(t))],cos:[Yr,[Yr],(t,[n])=>Math.cos(n.evaluate(t))],tan:[Yr,[Yr],(t,[n])=>Math.tan(n.evaluate(t))],asin:[Yr,[Yr],(t,[n])=>Math.asin(n.evaluate(t))],acos:[Yr,[Yr],(t,[n])=>Math.acos(n.evaluate(t))],atan:[Yr,[Yr],(t,[n])=>Math.atan(n.evaluate(t))],min:[Yr,Mo(Yr),(t,n)=>Math.min(...n.map((n=>n.evaluate(t))))],max:[Yr,Mo(Yr),(t,n)=>Math.max(...n.map((n=>n.evaluate(t))))],abs:[Yr,[Yr],(t,[n])=>Math.abs(n.evaluate(t))],round:[Yr,[Yr],(t,[n])=>{const e=n.evaluate(t);return e<0?-Math.round(-e):Math.round(e)}],floor:[Yr,[Yr],(t,[n])=>Math.floor(n.evaluate(t))],ceil:[Yr,[Yr],(t,[n])=>Math.ceil(n.evaluate(t))],"filter-==":[Zr,[Kr,ni],(t,[n,e])=>t.properties()[n.value]===e.value],"filter-id-==":[Zr,[ni],(t,[n])=>t.id()===n.value],"filter-type-==":[Zr,[Kr],(t,[n])=>t.geometryType()===n.value],"filter-<":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<i}],"filter-id-<":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<r}],"filter->":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>i}],"filter-id->":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>r}],"filter-<=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<=r}],"filter->=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>=r}],"filter-has":[Zr,[ni],(t,[n])=>n.value in t.properties()],"filter-has-id":[Zr,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Zr,[si(Kr)],(t,[n])=>n.value.indexOf(t.geometryType())>=0],"filter-id-in":[Zr,[si(ni)],(t,[n])=>n.value.indexOf(t.id())>=0],"filter-in-small":[Zr,[Kr,si(ni)],(t,[n,e])=>e.value.indexOf(t.properties()[n.value])>=0],"filter-in-large":[Zr,[Kr,si(ni)],(t,[n,e])=>function(t,n,e,r){for(;e<=r;){const i=e+r>>1;if(n[i]===t)return!0;n[i]>t?r=i-1:e=i+1}return!1}(t.properties()[n.value],e.value,0,e.value.length-1)],all:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)&&e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(!e.evaluate(t))return!1;return!0}]]},any:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)||e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(e.evaluate(t))return!0;return!1}]]},"!":[Zr,[Zr],(t,[n])=>!n.evaluate(t)],"is-supported-script":[Zr,[Kr],(t,[n])=>{const e=t.globals&&t.globals.isSupportedScript;return!e||e(n.evaluate(t))}],upcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toUpperCase()],downcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toLowerCase()],concat:[Kr,Mo(ni),(t,n)=>n.map((n=>Pi(n.evaluate(t)))).join("")],"resolved-locale":[Kr,[ei],(t,[n])=>n.evaluate(t).resolvedLocale()]});var xo=go;function Fo(t){return{result:"success",value:t}}function ko(t){return{result:"error",value:t}}function Ao(t){return!!t.expression&&t.expression.interpolated}function Po(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function So(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _o(t){return t}function Oo(t,n){const e="color"===n.type,r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),s=t.type||(Ao(n)?"exponential":"interval");if(e&&((t=qr({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],vi.parse(t[1])]))),t.default=vi.parse(t.default?t.default:n.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Ns[t.colorSpace])throw new Error(\`Unknown color space: ${q}t.colorSpace}\`);let o,a,u;if("exponential"===s)o=$o;else if("interval"===s)o=Io;else if("categorical"===s){o=Eo,a=Object.create(null);for(const n of t.stops)a[n[0]]=n[1];u=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(\`Unknown function type "${q}s}"\`);o=To}if(r){const e={},r=[];for(let n=0;n<t.stops.length;n++){const i=t.stops[n],s=i[0].zoom;void 0===e[s]&&(e[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},r.push(s)),e[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of r)i.push([e[t].zoom,Oo(e[t],n)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Vs.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:e},r)=>$o({stops:i,base:t.base},n,e).evaluate(e,r)}}if(i){const e="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:Vs.interpolationFactor.bind(void 0,e),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:e})=>o(t,n,e,a,u)}}return{kind:"source",evaluate(e,r){const i=r&&r.properties?r.properties[t.property]:void 0;return void 0===i?Co(t.default,n.default):o(t,n,i,a,u)}}}function Co(t,n,e){return void 0!==t?t:void 0!==n?n:void 0!==e?e:void 0}function Eo(t,n,e,r,i){return Co(typeof e===i?r[e]:void 0,t.default,n.default)}function Io(t,n,e){if("number"!==Po(e))return Co(t.default,n.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[r-1][0])return t.stops[r-1][1];const i=ys(t.stops.map((t=>t[0])),e);return t.stops[i][1]}function $o(t,n,e){const r=void 0!==t.base?t.base:1;if("number"!==Po(e))return Co(t.default,n.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[i-1][0])return t.stops[i-1][1];const s=ys(t.stops.map((t=>t[0])),e),o=function(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}(e,r,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],u=t.stops[s+1][1];let l=Ms[n.type]||_o;if(t.colorSpace&&"rgb"!==t.colorSpace){const n=Ns[t.colorSpace];l=(t,e)=>n.reverse(n.interpolate(n.forward(t),n.forward(e),o))}return"function"==typeof a.evaluate?{evaluate(...t){const n=a.evaluate.apply(void 0,t),e=u.evaluate.apply(void 0,t);if(void 0!==n&&void 0!==e)return l(n,e,o)}}:l(a,u,o)}function To(t,n,e){return"color"===n.type?e=vi.parse(e):"formatted"===n.type?e=Mi.fromString(e.toString()):"resolvedImage"===n.type?e=xi.fromString(e.toString()):Po(e)===n.type||"enum"===n.type&&n.values[e]||(e=void 0),Co(e,t.default,n.default)}class Do{constructor(t,n){this.expression=t,this.J={},this.W=new Ni,this.B=n?function(t){return"color"===t.type&&(So(t.default)||Array.isArray(t.default))?new vi(0,0,0,0):"color"===t.type?vi.parse(t.default)||null:void 0===t.default?null:t.default}(n):null,this.X=n&&"enum"===n.type?n.values:null}evaluateWithoutErrorHandling(t,n,e,r,i,s,o,a){return this.W.globals=t,this.W.feature=n,this.W.featureState=e,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null,this.expression.evaluate(this.W)}evaluate(t,n,e,r,i,s,o,a){this.W.globals=t,this.W.feature=n||null,this.W.featureState=e||null,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s||null,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null;try{const t=this.expression.evaluate(this.W);if(null==t||"number"==typeof t&&t!=t)return this.B;if(this.X&&!(t in this.X))throw new Oi(\`Expected value to be one of ${q}Object.keys(this.X).map((t=>JSON.stringify(t))).join(", ")}, but found ${q}JSON.stringify(t)} instead.\`);return t}catch(t){return this.J[t.message]||(this.J[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this.B}}}function zo(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in xo}function jo(t,n){const e=new ds(xo,[],n?function(t){const n={color:Qr,string:Kr,number:Yr,enum:Kr,boolean:Zr,formatted:ri,resolvedImage:ii};return"array"===t.type?si(n[t.value]||ni,t.length):n[t.type]}(n):void 0),r=e.parse(t,void 0,void 0,void 0,n&&"string"===n.type?{typeAnnotation:"coerce"}:void 0);return r?Fo(new Do(r,n)):ko(e.errors)}class Uo{constructor(t,n){this.kind=t,this.Y=n,this.isStateDependent="constant"!==t&&!us(n.expression)}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}}class No{constructor(t,n,e,r){this.kind=t,this.zoomStops=e,this.Y=n,this.isStateDependent="camera"!==t&&!us(n.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}interpolationFactor(t,n,e){return this.interpolationType?Vs.interpolationFactor(this.interpolationType,t,n,e):0}}function Lo(t,n){if("error"===(t=jo(t,n)).result)return t;const e=t.value.expression,r=as(e);if(!r&&!function(t){return"data-driven"===t["property-type"]}(n))return ko([new Jr("","data expressions not supported")]);const i=ls(e,["zoom","pitch","distance-from-center"]);if(!i&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(n))return ko([new Jr("","zoom expressions not supported")]);const s=Vo(e);if(!s&&!i)return ko([new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Jr)return ko([s]);if(s instanceof Vs&&!Ao(n))return ko([new Jr("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Fo(new Uo(r?"constant":"source",t.value));const o=s instanceof Vs?s.interpolation:void 0;return Fo(new No(r?"camera":"composite",t.value,s.labels,o))}class Ro{constructor(t,n){this.K=t,this.Z=n,qr(this,Oo(this.K,this.Z))}static deserialize(t){return new Ro(t.K,t.Z)}static serialize(t){return{K:t.K,Z:t.Z}}}function Vo(t){let n=null;if(t instanceof Js)n=Vo(t.result);else if(t instanceof qs){for(const e of t.args)if(n=Vo(e),n)break}else(t instanceof gs||t instanceof Vs)&&t.input instanceof Ri&&"zoom"===t.input.name&&(n=t);return n instanceof Jr||t.eachChild((t=>{const e=Vo(t);e instanceof Jr?n=e:!n&&e?n=new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&e&&n!==e&&(n=new Jr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),n}function Ho(t){if(Array.isArray(t))return t.map(Ho);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const n={};for(const e in t)n[e]=Ho(t[e]);return n}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}function qo(t,n="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};const e=t;let r=!0;try{r=function(t){if(!Wo(t))return t;let n=Ho(t);return Jo(n),n=Go(n),n}(e)}catch(t){console.warn(\`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\\nand paste the contents of this message in the report.\\nThank you!\\nFilter Expression:\\n${q}JSON.stringify(e,null,2)}\\n \`)}const i=jo(r,null);let s=null;if("error"===i.result)throw new Error(i.value.map((t=>\`${q}t.key}: ${q}t.message}\`)).join(", "));s=(t,n,e)=>i.value.evaluate(t,n,{},e);let o=null,a=null;if(r!==e){const t=jo(e,null);if("error"===t.result)throw new Error(t.value.map((t=>\`${q}t.key}: ${q}t.message}\`)).join(", "));o=(n,e,r,i,s)=>t.value.evaluate(n,e,{},r,void 0,void 0,i,s),a=!as(t.value.expression)}return{filter:s,dynamicFilter:o||void 0,needGeometry:Xo(r),needFeature:!!a}}function Go(t){if(!Array.isArray(t))return t;const n=function(t){if(Bo.has(t[0]))for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return t}(t);return!0===n?n:n.map((t=>Go(t)))}function Jo(t){let n=!1;const e=[];if("case"===t[0]){for(let r=1;r<t.length-1;r+=2)n=n||Wo(t[r]),e.push(t[r+1]);e.push(t[t.length-1])}else if("match"===t[0]){n=n||Wo(t[1]);for(let n=2;n<t.length-1;n+=2)e.push(t[n+1]);e.push(t[t.length-1])}else if("step"===t[0]){n=n||Wo(t[1]);for(let n=1;n<t.length-1;n+=2)e.push(t[n+1])}n&&(t.length=0,t.push("any",...e));for(let n=1;n<t.length;n++)Jo(t[n])}function Wo(t){if(!Array.isArray(t))return!1;if(function(t){return"pitch"===t||"distance-from-center"===t}(t[0]))return!0;for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return!1}const Bo=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Xo(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let n=1;n<t.length;n++)if(Xo(t[n]))return!0;return!1}const Yo={StyleExpression:Do,isExpression:zo,isExpressionFilter:function t(n){if(!0===n||!1===n)return!0;if(!Array.isArray(n)||0===n.length)return!1;switch(n[0]){case"has":return n.length>=2&&"$id"!==n[1]&&"$type"!==n[1];case"in":return n.length>=3&&("string"!=typeof n[1]||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==n.length||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!t(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}},createExpression:jo,createPropertyExpression:Lo,normalizePropertyExpression:function(t,n){if(So(t))return new Ro(t,n);if(zo(t)){const e=Lo(t,n);if("error"===e.result)throw new Error(e.value.map((t=>\`${q}t.key}: ${q}t.message}\`)).join(", "));return e.value}{let e=t;return"string"==typeof t&&"color"===n.type&&(e=vi.parse(t)),{kind:"constant",evaluate:()=>e}}},ZoomConstantExpression:Uo,ZoomDependentExpression:No,StylePropertyFunction:Ro},{isExpression:Ko,createExpression:Zo}=Yo,Qo={};function ta(t){if(!Array.isArray(t))return ta([t]);const n=[];for(let e=0;e<t.length;e++){let r;r=!0===t[e].filter?function(){return!0}:na(t[e].filter),n.push(br({},t[e],{filter:r}))}return n}function na(t){if(!0===t)return function(){return!0};if(t&&t.condition){if("any"===t.type){const n=t.condition,e=[];for(let t=0;t<n.length;t++)e.push(na(n[t]));return(t,n)=>{for(let r=0;r<e.length;r++)if(e[r](t,n))return!0;return!1}}const n=na(t.condition);if(wr(t.layer))return n;const e=n=>n.layer===t.layer;return(t,r)=>e(t)&&n(t,r)}if(hn(t))return ln(t);{let n=qo(t);n=n&&n.filter;const e=(t,e)=>(Qo.zoom=e,n&&n(Qo,t));return e}}const ea={type:"number","property-type":"data-driven",expression:{parameters:["zoom","feature"]}};function ra(t,n){ea.type=n||"number";const e=Zo(t,ea);if("success"!==e.result)throw new Error(\`Invalid maplibre spec expression: ${q}JSON.stringify(t)} (${q}e.value})\`);return e.value}function ia(t){return Ko(t)}const sa={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};function oa(t){return sa[t]}const aa={markerPlacement:1,markerFile:1,mergeOnProperty:1,markerTextFit:1,markerType:1,markerHorizontalAlignment:1,markerVerticalAlignment:1,markerRotationAlignment:1,markerPitchAlignment:1,markerFillPatternFile:1,markerLinePatternFile:1,textName:1,textPlacement:1,textFaceName:1,textStyle:1,textHorizontalAlignment:1,textVerticalAlignment:1,textRotationAlignment:1,textPitchAlignment:1,lineJoin:1,lineCap:1,linePatternFile:1,polygonPatternFile:1},ua={lineDasharray:1,markerLineDasharray:1,uvScale:1,uvOffset:1};function la(t){return aa[t]?"string":oa(t)?"number":ua[t]?"array":"color"}var ha=Object.freeze({__proto__:null,compileFilter:na,compileStyle:function(t=[]){return ta(t=t.map((t=>{const n=br({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n})))},createExpression:ra,getExpressionType:la,isExpression:ia,isInterpolated:oa});const ca="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,fa=function(t){return class extends t{pushIn(...t){const n=t.length;for(let e=0;e<n;e++)this[this.currentIndex++]=t[e]}fill(t,n,e){super.fill(t,n,e),e>this.currentIndex&&(this.currentIndex=e)}set(t,n){t>=this.currentIndex&&(this.currentIndex=t+1),this[t]=n}getLength(){return this.currentIndex}setLength(t){this.currentIndex=t,super.length<t&&(super.length=t)}trySetLength(t){t>this.currentIndex&&this.setLength(t)}reset(){this.currentIndex=0}slice(t,n){const e=super.slice(t,n);return e.currentIndex=n-t,e}}},da=fa(Array),pa={get:function(t,n){return"length"===n?t.getLength():t[n]}};class ya extends Array{setLength(t){this.length=t,this.currentIndex=t}trySetLength(t){this.length=t,this.currentIndex=t}getLength(){return this.length}}let ma;class ga{static createTypedArray(t,n){return gr(t,n)}static getInstance(){return ma}static ensureCapacity(t,n){if(!t.BYTES_PER_ELEMENT)return t;if(t.length>=n)return t;const e=new t.constructor(n+Math.ceil(.5*n)),r=t.getLength();for(let n=0;n<r;n++)e[n]=t[n];return e.currentIndex=t.currentIndex,e}static getArray(t){let n;if(t){const e=fa(t);n=new e(1048576/e.BYTES_PER_ELEMENT)}else n=new da;return n.push=(...t)=>{n.pushIn(...t)},n}static getProxyArray(){const t=new da,n=new Proxy(t,pa);return n.push=(...n)=>{t.pushIn(...n)},n.R=t,n}constructor(){this.tt=[],this.nt=0,this.et=[],this.rt=0,this.it={}}getProxy(){if(!ca){const t=new ya;return t.currentIndex=0,t}const t=this.et[this.rt]=this.et[this.rt]||ga.getProxyArray();return t.reset(),this.rt++,t}get(t){if(!ca){const t=new ya;return t.currentIndex=0,t}if(t){const n=t.name;let e=this.it[n];e||(e=this.it[n]={arrays:[],index:0});const r=e.index,i=e.arrays[r]=e.arrays[r]||ga.getArray(t);return i.reset(),e.index++,i}const n=this.tt[this.nt]=this.tt[this.nt]||ga.getArray();return n.reset(),this.nt++,n}reset(){this.nt=0,this.rt=0;for(const t in this.it)this.it[t].index=0}}ma=new ga;const va="__fea_idx",ba=[],wa={},Ma={},xa={},Fa=[],ka=ga.getInstance(),Aa=Math.pow(2,17);class Pa{static isAtlasLoaded(t,n={}){const{iconAtlas:e}=n;return!!(!t||e&&e.positions[t])}static genFnTypes(t){const n={};for(const e in t)if(ia(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim(),s=la(e);n[r]=ra(t[e],s),n[i]=(t,e)=>{let i;wa.zoom=t,Ma.properties=e;try{i=n[r].evaluateWithoutErrorHandling(wa,Ma,xa,null,Fa)}catch(t){return null}return i}}else if(_r(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim();oa(e)?(n[r]=m(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?m(i)(t,e):i}):(n[r]=g(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?g(i)(t,e):i})}return n}constructor(t,n,e){this.options=e;const r=[];this.symbolDef=n,this.symbol=v(n,(()=>(r[0]=e.zoom,r))),this.styledVectors=[],this.properties={},this.st=e.fnTypes||Pa.genFnTypes(this.symbolDef),_r(this.symbolDef.visible)&&(this.ot=m(this.symbolDef.visible)),e.atlas&&(this.iconAtlas=e.atlas.iconAtlas,this.glyphAtlas=e.atlas.glyphAtlas),this.features=this.ut(t)}needAltitudeAttribute(){return this.options.forceAltitudeAttribute||this.maxPosZ>=Aa||this.options.positionType===Float32Array}getPositionFormat(){return this.needAltitudeAttribute()?[{type:Int16Array,width:2,name:"aPosition"},{type:Float32Array,width:1,name:"aAltitude"}]:[{type:Float32Array,width:3,name:"aPosition"}]}fillPosition(t,n,e,r){if(n<this.lt&&(this.lt=n),n>this.ht&&(this.ht=n),e<this.ct&&(this.ct=e),e>this.ft&&(this.ft=e),this.needAltitudeAttribute()){let i=t.aPosition.currentIndex;t.aPosition[i++]=n,t.aPosition[i++]=e,t.aPosition.currentIndex=i,i=t.aAltitude.currentIndex,t.aAltitude[i++]=r,t.aAltitude.currentIndex=i}else{jr(ba,n,e,r);let i=t.aPosition.currentIndex;t.aPosition[i++]=ba[0],t.aPosition[i++]=ba[1],t.aPosition[i++]=ba[2],t.aPosition.currentIndex=i}}ut(t){if(!t.length)return t;const n=(va+"").trim();let e,r=0,i=t[r];for(;!i.geometry;)r++,i=t[r];if(Array.isArray(i.geometry)&&i.properties){let n=i.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof dt&&(e=t)}if(!e)if(e=[],Array.isArray(i.geometry))for(let n=0;n<t.length;n++){const r=br({},t[n]);e.push(vr(r))}else for(let r=0;r<t.length;r++){const i=t[r],s=qe(i);for(let t=0;t<s.length;t++){const r=s[t];r[n]=i[n],e.push(r)}}if(this.maxPosZ=0,!this.options.forceAltitudeAttribute){const t="line"===this.symbolDef.textPlacement;let n=0,r=!1;const{textPitchAlignmentFn:i}=this.st;!i&&t&&"map"===this.symbolDef.textPitchAlignment&&(r=!0);for(let s=0;s<e.length;s++){const o=_a(e[s]&&e[s].geometry);if(o>n&&(n=o),t&&!r&&i&&e[s].properties){const t=i(null,e[s].properties);"map"===t&&(r=t)}}this.hasMapPitchAlign=r,this.maxPosZ=n}const s=this.options.order;if(s){const t=[];for(let n=0;n<s.length;n++)s[n]&&t.push(na(s[n]));e=e.sort(((n,e)=>{const r=t.length;let i=-1,s=-1;for(let o=0;o<r&&(t[o](n)&&(i=o),t[o](e)&&(s=o),!(i>=0&&i<r&&s>=0&&s<r));o++);return i-s}))}return e}load(t=1){const n=(va+"").trim(),e="_debug_info".trim(),r=this.st,i=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},u={zoom:this.options.zoom,isVector3D:!!this.options.center},l=[],h=v(this.symbolDef,(()=>(l[0]=u.zoom,l)));let c=0,f=s.length;const d=this.options.debugIndex;try{for(;c<f;c++){const t=s[c];if(!t||!t.geometry)continue;if(Mr(d)&&t[e].index!==d)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const l=this.createStyledVector(t,h,r,u,o,a);l&&l.feature.geometry&&(l.featureIdx=void 0===t[n]?c:t[n],this.count++,i.push(l))}}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(((e,r)=>{this.fetchAtlas(t,n,((t,n)=>{if(t)r(t);else{if(n){const{icons:t,glyphs:e}=n;if(t&&Object.keys(t).length){for(const n in t){const e=t[n],{width:r,height:i,data:s}=e.data;e.data=new tr({width:r,height:i},s)}this.iconAtlas=new cr(t)}if(e&&Object.keys(e).length){for(const t in e){const n=e[t];for(const t in n){const e=n[t],{width:r,height:i,data:s}=e.bitmap;e.bitmap=new Qe({width:r,height:i},s)}}this.glyphAtlas=new dr(e)}}e({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}}))}))}fetchAtlas(t,n,e){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,e):e()}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 e=n.buffers;delete n.buffers;const r={data:n,buffers:e};if(this.iconAtlas){const t=r.data.iconAtlas=Sa(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)e.push(t.glyphMap[n].data.data.buffer);e.push(r.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(r.data.glyphAtlas=Sa(this.glyphAtlas),e.push(r.data.glyphAtlas.image.data.buffer)),r}createStyledVector(t,n,e,r){return new zr(t,n,e,r)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.lt=this.ct=1/0,this.ht=this.ft=-1/0,this.maxAltitude=0,this.dynamicAttrs={};const e=this.data={};this.dt=ka,ka.reset();let r=this.elements=ka.get();const i=this.yt=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol),s=this.needAltitudeAttribute()?2:3;for(let t=0;t<i.length;t++)e[i[t].name]=ka.get(i[t].type);let o=ka.get(),a=0;const u=ka.get();let l=0,h=!1,c=!0;const f=new Set;for(let r=0,i=t.length;r<i;r++){if(!t[r].feature.geometry)continue;const i=Array.isArray(t[r])?t[r][0].feature.id:t[r].feature.id;c&&(void 0!==Ma.id?f&&(f.has(Ma.id)?c=!1:f.add(Ma.id)):c=!1),Mr(i)&&(Math.abs(i)>l&&(l=Math.abs(i)),i<0&&(h=!0));const d=this.data.aPosition.getLength();if(Array.isArray(t[r]))for(let e=0;e<t[r].length;e++)this.gt(t[r][e],n);else this.gt(t[r],n);const p=(e.aPosition.getLength()-d)/s;for(let n=0;n<p;n++)o.push(t[r].featureIdx),Mr(i)&&u.push(i);a=Math.max(a,t[r].featureIdx)}if(this.countOutOfAngle>0&&console.warn("text anchor along line is ignored as anchor's line angle is bigger than textMaxAngle."),this.hasElements()&&!r.getLength())return null;const d=this.options.center?Float32Array:mr(a);o=ga.createTypedArray(o,d),i[0].type=this.options.positionType?this.options.positionType:yr(this.maxPos);const p=this.options.center;if(p&&(p[0]||p[1])){const t=e.aPosition,n=t.getLength();for(let e=0;e<n;e+=s)t[e]-=p[0],t[e+1]-=p[1]}const y=function(t,n){const e={};for(let r=0;r<t.length;r++){const i=t[r],s=i.type,o=i.name;e[o]=s===Array?n[o]:gr(n[o],s)}return e}(i,e);y.aPickingId=o;const m=[];for(const t in y)m.push(y[t].buffer);const g=pr(this.maxIndex);r=ga.createTypedArray(r,g),m.push(r.buffer);const v={data:y,isIdUnique:c,is2D:0===this.maxPosZ,indices:this.hasElements()?r:null,positionSize:s,positionBounding:[this.lt,this.ct,this.ht,this.ft],buffers:m,symbolIndex:this.symbolDef.index||{index:0},dynamicAttributes:this.dynamicAttrs};if(this.vt&&(v.markerPlacement=this.vt),this.bt&&(v.textPlacement=this.bt),u.getLength()){const t=h?yr(l):mr(l);v.featureIds=ga.createTypedArray(u,t),m.push(v.featureIds.buffer)}else v.featureIds=[];return v.pickingIdIndiceMap=ur(o,v.indices),v}gt(t,n){this.ot&&!this.ot(this.options.zoom,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(t,n,e){this.maxIndex=Math.max(this.maxIndex,t,n,e);let r=this.elements.currentIndex;this.elements[r++]=t,this.elements[r++]=n,this.elements[r++]=e,this.elements.currentIndex=r}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:e,altitudeScale:r}=this.options;let i=rr(t,n,e);return r&&(i*=r),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(i)),i}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const e in t)if(Pr(t,e)){const{tl:r,displaySize:i}=t[e],s=Math.max(r[0],r[1],i[0]-1,i[1]-1);s>n&&(n=s)}return n}ensureDataCapacity(t,n){const e=this.yt;for(let r=0;r<e.length;r++){const i=this.data[e[r].name];if(!i)continue;const s=e[r].width*t,o=i.getLength();this.data[e[r].name]=ga.ensureCapacity(i,o+s*n)}}}function Sa(t){let n=t.positions,e=t.image&&t.image.format||"alpha";if(t instanceof cr){n={};for(const e in t.positions){const r=t.positions[e];n[e]={paddedRect:r.paddedRect,pixelRatio:r.pixelRatio,tl:r.tl,br:r.br,displaySize:r.displaySize}}e="rgba"}const r=t.image;return{image:{width:r.width,height:r.height,data:r.data,format:e},glyphMap:t.glyphMap,positions:n}}function _a(t){if(!t)return 0;let n=0;if(Array.isArray(t))for(let e=0;e<t.length;e++)if(Array.isArray(t[e])){const r=_a(t[e]);r>n&&(n=r)}else{const r=Math.abs(t[e].z||0);r>n&&(n=r)}else{const e=Math.abs(t.z||0);e>n&&(n=e)}return n}const Oa="___fn_in_stops";function Ca(t,n,e,r){const i="__fn_textSize".trim();let s=t.textSize;if(wr(n.textSize))return[16,16];t[i]&&(s=t[i]);const o=[];if(o[0]=kr(s)?s(r,e):s,y(o[0])){const n=o[0].wt=o[0].wt||JSON.stringify(o[0]);t[Oa]||(t[Oa]={}),t[Oa][n]||(t[Oa][n]=m(o[0])),o[0]=(0,t[Oa][n])(r,e)}return o[1]=o[0],o}function Ea(t){const n=t.stops;let e=-1/0;for(let t=0;t<n.length;t++){let r=n[t][1];xr(n[t][1])&&(r=Ea(n[t][1])),r>e&&(e=r)}return e}function Ia(t){return t||"Open Sans Regular"}const $a=/\\{[\\w-]+(?:\\|[\\w-]+)*\\}/g;function Ta(t,n){return Fr(t)?t.replace($a,(function(t){if(!n)return"";if((t=t.substring(1,t.length-1)).indexOf("|")>0){const e=t.split("|");for(let t=0;t<e.length;t++){const r=n[e[t]];if(!wr(r))return r}return""}const e=n[t];return wr(e)?"":Array.isArray(e)?e.join():e})):t}var Da=Object.freeze({__proto__:null,getSDFFont:Ia,resolveExpVarNames:function t(n,e){if(2!==e.length||"get"!==e[0])for(let r=0;r<e.length;r++)2===e[r].length&&"get"===e[r][0]?n.push(e[r][1]):Array.isArray(e[r])&&t(n,e[r]);else n.push(e[1])},resolveText:Ta,resolveVarNames:function(t){return t.match($a)}});const za={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function ja(t){return!(za.Arabic(t)||za["Arabic Supplement"](t)||za["Arabic Extended-A"](t)||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t))}function Ua(t){return!!(!(t<11904)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||za["CJK Symbols and Punctuation"](t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Halfwidth and Fullwidth Forms"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)||za["Vertical Forms"](t)||za["Yi Radicals"](t)||za["Yi Syllables"](t)))}function Na(t){return!!(746===t||747===t||!(t<4352)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||!(!za["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Hangul Compatibility Jamo"](t)||za["Hangul Jamo Extended-A"](t)||za["Hangul Jamo Extended-B"](t)||za["Hangul Jamo"](t)||za["Hangul Syllables"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za.Kanbun(t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)&&12540!==t||!(!za["Halfwidth and Fullwidth Forms"](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)||!(!za["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||za["Unified Canadian Aboriginal Syllabics"](t)||za["Unified Canadian Aboriginal Syllabics Extended"](t)||za["Vertical Forms"](t)||za["Yijing Hexagram Symbols"](t)||za["Yi Syllables"](t)||za["Yi Radicals"](t)))}function La(t){return!(Na(t)||function(t){return!!(za["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||za["General Punctuation"](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)||za["Letterlike Symbols"](t)||za["Number Forms"](t)||za["Miscellaneous Technical"](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)||za["Control Pictures"](t)&&9251!==t||za["Optical Character Recognition"](t)||za["Enclosed Alphanumerics"](t)||za["Geometric Shapes"](t)||za["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||za["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||za["CJK Symbols and Punctuation"](t)||za.Katakana(t)||za["Private Use Area"](t)||za["CJK Compatibility Forms"](t)||za["Small Form Variants"](t)||za["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Ra(t){return t>=1424&&t<=2303||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t)}const Va=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function Ha(t){for(const n of Va)if(t>=n[0]&&t<=n[1])return!0;return!1}const qa={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",Mt:"︳","\`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Ga=1,Ja=2;function Wa(t,n,e,r,i,s,o,a,u,l){let h=t.trim();l===Ja&&(h=function(t){let n="";const e=Array.from(t);for(let t=0;t<e.length;t++){const r=e[t+1].codePointAt(0)||null,i=e[t-1].codePointAt(0)||null;n+=r&&La(r)&&!qa[e[t+1]]||i&&La(i)&&!qa[e[t-1]]||!qa[e[t]]?e[t]:qa[e[t]]}return n}(h));const c=[],f={positionedGlyphs:c,text:h,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:l};let d;return d=function(t,n){const e=[];let r=0;for(let i=0;i<n.length;i++){const s=n[i];e.push(t.substring(r,s)),r=s}return r<t.length&&e.push(t.substring(r,t.length)),e}(h,function(t,n,e,r){if(!e)return[];if(!t)return[];const i=[],s=function(t,n,e,r){let i=0;for(let e=0;e<t.length;e++){const s=r[t.codePointAt(e)];s&&(i+=s.metrics.advance+n)}return i/Math.max(1,Math.ceil(i/e))}(t,n,e,r);let o=0;for(let e=0;e<t.length;e++){const a=t.codePointAt(e),u=r[a];u&&(u&&!Ba[a]&&(o+=u.metrics.advance+n),e<t.length-1&&(Xa[a]||Ua(a))&&i.push(Za(e+1,o,s,i,Ka(a,t.codePointAt(e+1)),!1)))}return Qa(Za(t.length,o,s,i,0,!0))}(h,o,e,n)),function(t,n,e,r,i,s,o,a,u,l){let h=0,c=0,f=0;const d=t.positionedGlyphs;for(let t=0;t<e.length;t++){let i=e[t];if(i=i.trim(),!i.length){c-=r;continue}const s=d.length;for(let t=0;t<i.length;t++){const e=i.codePointAt(t),r=n[e];r&&(Na(e)&&o!==Ga?(32!==e&&d.push({glyph:e,x:h,y:0,vertical:!0}),h+=u+a):(32!==e&&d.push({glyph:e,x:h,y:c,vertical:!1}),h+=r.metrics.advance+a))}d.length!==s&&(f=Math.max(h-a,f),nu(d,n,s,d.length-1,.5)),h=0,c-=r}const{horizontalAlign:p,verticalAlign:y}=tu(i,void 0);!function(t,n,e,r,i,s,o){const a=(.5-e)*i,u=-(-r*o+.5)*s;if(a||u)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=u}(d,0,p,y,f,r,e.length);const m=e.length*r;t.top+=-y*m,t.bottom=t.top+m,t.left+=-p*f,t.right=t.left+f}(f,n,d,r,i,0,l,o,u),!!c.length&&f}const Ba={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Xa={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 Ya(t,n,e,r){const i=Math.pow(t-n,2);return r?t<n?i/2:2*i:i+Math.abs(e)*e}function Ka(t,n){let e=0;return 10===t&&(e-=1e4),40!==t&&65288!==t||(e+=50),41!==n&&65289!==n||(e+=50),e}function Za(t,n,e,r,i,s){let o=null,a=Ya(n,e,i,s);for(let t=0;t<r.length;t++){const u=r[t],l=Ya(n-u.x,e,i,s)+u.badness;l<=a&&(o=u,a=l)}return{index:t,x:n,priorBreak:o,badness:a}}function Qa(t){return t?Qa(t.priorBreak).concat(t.index):[]}function tu(t,n){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=n?1:0;break;case"left":case"top-left":case"bottom-left":e=n?0:1}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=n?1:0;break;case"top":case"top-right":case"top-left":r=n?0:1}return{horizontalAlign:e,verticalAlign:r}}function nu(t,n,e,r,i){const s=n[t[r].glyph];if(s){const n=(t[r].x+s.metrics.advance)*i;if(!n)return;for(let i=e;i<=r;i++)t[i].x-=n}}function eu(t){if(!function(t){for(const n of t)if(Ra(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],e=[],r=[];let i=0,s=0,o=1,a=1;for(const u of t){const t=u.codePointAt(0);Ha(t)?(r.push(u),i++):(o=Ra(t)?-1:1,a!==o?(s=i,e.length&&(a>0&&e.reverse(),n.push(...e)),r.length&&(n.splice(s,0,...r),r.length=0),a=o,e.length=0):r.length&&(e.push(...r),r.length=0),e.push(u),i++)}return r.length&&e.push(...r),e.length&&(a>0&&e.reverse(),n.push(...e)),n.reverse().join("")}const ru=/\\{ *([\\w_]+) *\\}/g;class iu{constructor(t,n,e,r,i){this.feature=t,this.symbolDef=n,this.symbol=e,this.options=i,this.xt=this.Ft.bind(this),this.st=r}Ft(t,n){return this.feature.properties[n]||""}getShape(t,n){if(this.kt)return this.kt;const{textHorizontalAlignmentFn:e,textVerticalAlignmentFn:r,markerHorizontalAlignmentFn:i,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.st;let a;const u=this.symbol,l=this.getIconAndGlyph(),h=this.feature.properties;if(l&&l.glyph){const{font:t,text:i}=l.glyph;if(""===i)return null;const s=this.size[0]/24,c=24,f=u.textKeepUpright,d="map"===u.textRotationAlignment&&"line"===u.textPlacement&&!u.isIconText,p=n.glyphMap[t],y=su(e?e(null,h):u.textHorizontalAlignment,r?r(null,h):u.textVerticalAlignment),m=1.2*c,g=function(t){for(let n=0;n<t.length;n++)if(!ja(t.charAt(n).charCodeAt(0)))return!1;return!0}(i),v=g&&u.textLetterSpacing/s||0,b=[u.textDx/s||0,u.textDy/s||0],w=((o?o(null,h):u.textWrapWidth)||10*c)/s;a={},a.horizontal=Wa(i,p,w,m,y,0,v,b,c,Ga),g&&d&&f&&(a.vertical=Wa(i,p,w,m,y,0,v,b,c,Ja))}else if(l&&l.icon){if(!t||!t.positions[l.icon.url])return null;const n=su(i?i(null,h):u.markerHorizontalAlignment,s?s(null,h):u.markerVerticalAlignment);a=function(t,n,e){let{horizontalAlign:r,verticalAlign:i}=tu(n,e);e?r=1-r:i=1-i;const s=-2048*r,o=-2048*i;return{image:t,top:o,bottom:o+2048,left:s,right:s+2048}}(t.positions[l.icon.url],n,this.options.isVector3D),this.size||(this.size=a.image.displaySize)}return this.kt=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:e,markerWidthFn:r,markerHeightFn:i,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:u,markerTextFitPaddingFn:l,markerLineColorFn:h,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:p,markerPathWidthFn:g,markerPathHeightFn:v,textNameFn:b,textFaceNameFn:w}=this.st,{zoom:M}=this.options,x={},F=this.symbol,k=this.feature.properties,A=t?t(null,k):F.markerFile,P=n?n(null,k):F.markerType,S=A||P||F.markerPath,_=!wr(this.symbolDef.textName);let O;if(S){O=function(t,n,e,r,i,s){if(wr(n.markerWidth)&&wr(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let u=n.markerWidth||0,l=n.markerHeight||0;return xr(u)&&("identity"!==u.type?u=Ea(u):(u=t.markerWidth,t[o]&&(u=t[o](r,e)),xr(u)&&(u="identity"===u.type?i(r,e):Ea(u)))),xr(l)&&("identity"!==l.type?l=Ea(l):(l=t.markerHeight,t[a]&&(l=t[a](r,e)),xr(l)&&(l="identity"===l.type?s(r,e):Ea(l)))),[u,l]}(F,this.symbolDef,k,M,r,i)||[0,0];let t=F.markerTextFit;if(u&&(t=u(M,k)),t&&F.text&&"none"!==t){const n=F.text.textSize;let e=F.text.textName;y(e)&&(e=m(e)(M,k));const r=Ta(e,k);if(r){const e="__fn_textSize".trim(),i="__fn_textSize_0".trim();y(n)&&!F.text[e]&&(F.text[i]=m(n),F.text[e]=(t,n)=>{const e=F.text[i](t,n);return y(e)?m(e)(t,n):e});const s=Ca(F.text,F.text,k,M);if("width"!==t&&"both"!==t||(O[0]=s[0]*r.length),"height"!==t&&"both"!==t||(O[1]=s[1]),s[0]&&s[1]){let t=F.markerTextFitPadding||[0,0,0,0];l&&(t=l(M,k)),O[0]+=t[1]+t[3],O[1]+=t[0]+t[2]}}else O[0]=O[1]=-1}}if(_&&(O=Ca(F,this.symbolDef,k,M)),!O)return x;if(O[0]=Math.ceil(O[0]),O[1]=Math.ceil(O[1]),this.size=O,S&&O[0]>=0&&O[1]>=0){let t;if(P){const n={};if(n.markerType=P,"path"===P&&(n.markerPath=e?e(null,k):F.markerPath,n.markerPathWidth=g?g(null,k):F.markerPathWidth,n.markerPathHeight=v?v(null,k):F.markerPathHeight),r){const t=r(null,k);wr(t)||(n.markerWidth=t)}else F.markerWidth>=0&&(n.markerWidth=F.markerWidth);if(i){const t=i(null,k);wr(t)||(n.markerHeight=t)}else F.markerHeight>=0&&(n.markerHeight=F.markerHeight);if(s){const t=s(null,k);wr(t)||(n.markerFill=t)}else F.markerFill&&(n.markerFill=F.markerFill);if(o){const t=o(null,k);wr(t)||(n.markerFillPatternFile=t)}else F.markerFillPatternFile&&(n.markerFillPatternFile=F.markerFillPatternFile);if(a){const t=a(null,k);wr(t)||(n.markerFillOpacity=t)}else F.markerFillOpacity>=0&&(n.markerFillOpacity=F.markerFillOpacity);if(h){const t=h(null,k);wr(t)||(n.markerLineColor=t)}else F.markerLineColor&&(n.markerLineColor=F.markerLineColor);if(c){const t=c(null,k);wr(t)||(n.markerLineWidth=t)}else F.markerLineWidth>=0&&(n.markerLineWidth=F.markerLineWidth);if(f){const t=f(null,k);wr(t)||(n.markerLineOpacity=t)}else F.markerLineOpacity>=0&&(n.markerLineOpacity=F.markerLineOpacity);if(d){const t=d(null,k);wr(t)||(n.markerLineDasharray=t)}else F.markerLineDasharray&&(n.markerLineDasharray=F.markerLineDasharray);if(p){const t=p(null,k);wr(t)||(n.markerLinePatternFile=t)}else F.markerLinePatternFile&&(n.markerLinePatternFile=F.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=A?A.replace(ru,this.xt):F.markerPath?function(t,n,e){if(!t.markerPath)return null;let r=1;const i=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);Mr(t.markerOpacity)&&(r=t.markerOpacity),Mr(t.opacity)&&(r*=t.opacity);const s={};if(i){for(const t in i.stroke)Pr(i.stroke,t)&&(wr(i.stroke[t])||(s[t]=i.stroke[t]));for(const t in i.fill)Pr(i.fill,t)&&(wr(i.fill[t])||(s[t]=i.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const u=[];for(let t=0;t<o.length;t++)a=Fr(o[t])?{path:o[t]}:o[t],a=br({},a,s),a.d=a.path,delete a.path,u.push(a);const l=['<svg version="1.1"','xmlns="http://www.w3.org/2000/svg"'];r<1&&l.push('opacity="'+r+'"'),t.markerPathWidth&&t.markerPathHeight&&l.push('viewBox="0 0 '+t.markerPathWidth+" "+t.markerPathHeight+'"'),l.push('preserveAspectRatio="none"'),n&&l.push('width="'+n+'"'),e&&l.push('height="'+e+'"'),l.push("><defs></defs>");for(let t=0;t<u.length;t++){let n="<path ";for(const e in u[t])Pr(u[t],e)&&(n+=" "+e+'="'+u[t][e]+'"');n+="></path>",l.push(n)}return l.push("</svg>"),"data:image/svg+xml;base64,"+btoa(l.join(" "))}(F,O[0],O[1]):null;x.icon={url:t,size:O}}if(_){const t=b?b(this.options.zoom,k):F.textName;if(t||0===t){const n=Ia(w?w(null,k):F.textFaceName);let e=Ta(t,k);e&&e.length&&(e=eu(e),x.glyph={font:n,text:e})}}return this.iconGlyph=x,x}}function su(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let e="center"!==n?n:"";return e+="center"!==t?(e.length?"-":"")+t:"",e\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function ou(t,n,e,r,i){const s=[];let o;for(let a=0;a<t.length;a++){const u=t[a];let l,h=!1;for(let t=0;t<u.length-1;t++){let a=u[t],c=u[t+1];a.x<n&&c.x<n||(a.x<n?(o=a,a=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(n-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x<n&&(o=c,c=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(n-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y<e&&c.y<e||(a.y<e?(o=a,a=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),a.z=o.z+(e-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y<e&&(o=c,c=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),c.z=a.z+(e-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),a.x>=r&&c.x>=r||(a.x>=r?(o=a,a=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(r-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x>=r&&(o=c,c=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(r-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y>=i&&c.y>=i||(a.y>=i?(o=a,a=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),a.z=o.z+(i-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y>=i&&(o=c,c=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),c.z=a.z+(i-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),l&&a.equals(l[l.length-1])||(l=[a],s.push(l)),h&&(l.clipped=!0),l.push(c)))))}}return s}class au extends dt{constructor(t,n,e,r){super(t,n),this.angle=e,void 0!==r&&(this.segment=r)}clone(){return new au(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 uu(t,n,e,r,i){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-e/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const u=[];let l=0;for(;a<e/2;){const n=t[o],e=t[o+1];if(!e)return!1;let s=t[o-1].angleTo(n)-n.angleTo(e);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:a,angleDelta:s}),l+=s;a-u[0].distance>r;)l-=u.shift().angleDelta;if(l>i)return!1;o++,a+=n.dist(e)}return!0}function lu(t,n,e,r,i,s,o,a,u,l,h){const c=function(t,n,e){return t?.6*n*e:0}(r,s,o),f=function(t,n){return Math.max(t?t.right-t.left:0,0)}(r),d=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return n-f*o<n/4&&(n=f*o+n/4),hu(t,d?n/2*a%n:(f/2+2*s)*o*a%n,n,c,e,f*o,d,!1,u,l,h)}function hu(t,n,e,r,i,s,o,a,u,l,h){let c=0;const f=s/2,d=function(t){let n=0;for(let e=0;e<t.length-1;e++)n+=t[e].dist(t[e+1]);return n}(t);let p=0,y=n-e,m=[];for(let n=0;n<t.length-1;n++){const o=t[n],a=t[n+1],g=o.dist(a),v=a.angleTo(o);for(;y+e<p+g;){y+=e;const b=(y-p)/g,w=cu(o.x,a.x,b),M=cu(o.y,a.y,b),x=cu(o.z||0,a.z||0,b);if(w>=0&&w<u&&M>=0&&M<u&&y-f>=0&&y+f<=d){const e=new au(w,M,v,n);e.z=x,l&&(e.axis=[o.y-M,w-o.x],e.angleR=x===(o.z||0)?0:Math.atan(.9*(x-(o.z||0))*h/o.dist(e))),e.line=t,e.j(),!r||uu(t,e,s,r,i)?m.push(e):r&&c++}}p+=g}return a||m.length||o||(m=hu(t,p/2,e,r,i,s,o,!0,u,l,h)),m.countOutOfAngle=c,m}function cu(t,n,e){return t*(1-e)+n*e}function fu(t,n){const e=t.length;if(e<=1)return[t];const r=[];let i,s;for(let n=0;n<e;n++){const e=nr(t[n]);0!==e&&(t[n].area=Math.abs(e),void 0===s&&(s=e<0),s===e<0?(i&&r.push(i),i=[t[n]]):i.push(t[n]))}if(i&&r.push(i),n>1)for(let t=0;t<r.length;t++)r[t].length<=n||(Mn(r[t],n,1,r[t].length-1,du),r[t]=r[t].slice(0,n));return r}function du(t,n){return n.area-t.area}function pu(t,n,e){const r=n.distSqr(e);if(0===r)return t.distSqr(n);const i=((t.x-n.x)*(e.x-n.x)+(t.y-n.y)*(e.y-n.y))/r;return t.distSqr(i<0?n:i>1?e:e.sub(n).S(i).F(n))}function yu(t,n=1,e=!1){let r=1/0,i=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<r)&&(r=n.x),(!t||n.y<i)&&(i=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const u=Math.min(s-r,o-i);let l=u/2;const h=new xn([],mu);if(0===u)return new dt(r,i);for(let n=r;n<s;n+=u)for(let e=i;e<o;e+=u)h.push(new gu(n+l,e+l,l,t));let c=function(t){let n=0,e=0,r=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],u=s.x*a.y-a.x*s.y;e+=(s.x+a.x)*u,r+=(s.y+a.y)*u,n+=3*u}return new gu(e/n,r/n,0,t)}(t),f=h.length;for(;h.length;){const r=h.pop();(r.d>c.d||!c.d)&&(c=r,e&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,f)),r.max-c.d<=n||(l=r.h/2,h.push(new gu(r.p.x-l,r.p.y-l,l,t)),h.push(new gu(r.p.x+l,r.p.y-l,l,t)),h.push(new gu(r.p.x-l,r.p.y+l,l,t)),h.push(new gu(r.p.x+l,r.p.y+l,l,t)),f+=4)}return e&&(console.log(\`num probes: ${q}f}\`),console.log(\`best distance: ${q}c.d}\`)),c.p}function mu(t,n){return n.max-t.max}function gu(t,n,e,r){this.p=new dt(t,n),this.h=e,this.d=function(t,n){let e=!1,r=1/0;for(let i=0;i<n.length;i++){const s=n[i];for(let n=0,i=s.length,o=i-1;n<i;o=n++){const i=s[n],a=s[o];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(e=!e),r=Math.min(r,pu(t,i,a))}}return(e?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}function vu(t,n,e,r,i,s,o,a,u,l){const{feature:h,size:c,symbol:f}=t,d=c?24:0,p=i*(c?c[0]/d:1);if("line"===o){const t=[];t.countOutOfAngle=0;let i=h.geometry;s&&(i=ou(h.geometry,0,0,s,s));for(let o=0;o<i.length;o++){const h=lu(i[o],a,e,f.isIconText?null:r&&r.vertical||r&&r.horizontal||r,0,d,f.isIconText?1:p,1,s||1/0,u,l);if(f.textPlacement&&!f.isIconText)for(let t=0;t<h.length;t++)h[t].startIndex=n.length/3;if(t.push.apply(t,h),f.textPlacement&&!f.isIconText)for(let t=0;t<i[o].length;t++)n.push(i[o][t].x,i[o][t].y,i[o][t].z||0);t.countOutOfAngle+=h.countOutOfAngle||0}return t}return bu(h,o,s)}function bu(t,n,e,r,i){const s=[];if(3===t.type){const o=fu(t.geometry,0);for(let t=0;t<o.length;t++){const a=o[t];if("vertex"===n)for(let t=0;t<a.length;t++){const n=a[t];for(let o=0;o<n.length;o++)sr(n[o],e)||(s.push(n[o]),r&&(0===o?wu(n[o],n[o],n[t+1],i):wu(n[o],n[o-1],n[o],i)))}else if("vertex-first"===n){const t=a[0];t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i))}else if("vertex-last"===n||"vertex-firstlast"===n){const t=a[0];if("vertex-firstlast"===n&&t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i)),t&&t[t.length-1]&&!sr(t[t.length-1],e)){const n=t.length-1;s.push(t[n]),r&&wu(t[n],t[n-1],t[n],i)}}else{const t=yu(a,16);sr(t,e)||s.push(t)}}}else if(2===t.type)for(let o=0;o<t.geometry.length;o++){const a=t.geometry[o];if("vertex"===n)for(let t=0;t<a.length;t++)sr(a[t],e)||(s.push(a[t]),r&&(0===t?wu(a[t],a[t],a[t+1],i):wu(a[t],a[t-1],a[t],i)));else if("vertex-last"===n||"vertex-firstlast"===n){if("vertex-firstlast"!==n||sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i)),a&&a[a.length-1]&&!sr(a[a.length-1],e)){const t=a.length-1;s.push(a[t]),r&&wu(a[t],a[t-1],a[t],i)}}else sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i))}else if(1===t.type)for(let n=0;n<t.geometry.length;n++){const i=t.geometry[n];for(let t=0;t<i.length;t++){const n=i[t];sr(n,e)||(r&&(n.xRotation=0,n.yRotation=0,n.zRotation=0),s.push(n))}}return s}function wu(t,n,e,r){if(t.xRotation||t.yRotation||t.zRotation)return t;const i=e.x-n.x,s=n.y-e.y,o=(e.z-n.z)*r,a=Math.atan2(s,i);t.zRotation=a;const u=Math.atan2(o,Math.sqrt(i*i+s*s));return t.xyRotation=u,t}function Mu(t,n){const e={},r={},i=[];let s=0;function o(n){i.push(t[n]),s++}function a(t,n,e){const s=r[t];return delete r[t],r[n]=s,i[s].geometry[0].pop(),i[s].geometry[0]=i[s].geometry[0].concat(e[0]),s}function u(t,n,r){const s=e[n];return delete e[n],e[t]=s,i[s].geometry[0].shift(),i[s].geometry[0]=r[0].concat(i[s].geometry[0]),s}function l(t,n,e){const r=e?n[0][n[0].length-1]:n[0][0];return\`${q}t}:${q}r.x}:${q}r.y}\`}for(let h=0;h<t.length;h++){const c=t[h],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(h);continue}const p=l(d,f),y=l(d,f,!0);if(p in r&&y in e&&r[p]!==e[y]){const t=u(p,y,f),n=a(p,y,i[t].geometry);delete e[p],delete r[y],r[l(d,i[n].geometry,!0)]=n,i[t].geometry=null}else p in r?a(p,y,f):y in e?u(p,y,f):(o(h),e[p]=s-1,r[y]=s-1)}return i.filter((t=>t.geometry))}const xu="__index";function Fu(t,n,e,r){const i=(xu+"").trim(),s=function(t,n,e,r){const i=(xu+"").trim(),{mergeOnPropertyFn:s}=e;if(!n.mergeOnProperty)return[];if(!or(o=n.mergeOnProperty)&&("string"==typeof o||null!==o.constructor&&o.constructor===String))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],u={},l=[];for(let e=0;e<t.length;e++){t[e][i]=e;const o=t[e].properties=t[e].properties||{};o.$layer=t[e].layer,o.$type=t[e].type;const h=s?s(r,o):n.mergeOnProperty;or(h)?l.push(t[e]):(void 0===u[h]&&(u[h]=a.length,a.push({features:[],property:h})),a[u[h]].features.push(t[e]))}return l.length&&a.push({features:l}),a}(t,n,e,r);if(s.length){const n=[];for(let e=0;e<s.length;e++)n.push(s[e].property?Mu(s[e].features,s[e].property):t);if(1===n.length)return n[0];{let t=[];for(let e=0;e<n.length;e++)t=t.concat(n[e]);return t.sort(((t,n)=>t[i]-n[i])),t}}return[]}class ku extends Pa{static needMerge(t,n,e){if(!t)return!1;let r="line"===t.textPlacement||"line"===t.markerPlacement;return r||(n.textPlacementFn&&(r="line"===n.textPlacementFn(e)),n.markerPlacementFn&&(r="line"===n.markerPlacementFn(e))),t.mergeOnProperty&&r}static mergeLineFeatures(t,n,e,r){let i=n.textPlacement,s=n.markerPlacement;return e.textPlacementFn&&(i=e.textPlacementFn(r)),e.markerPlacementFn&&(s=e.markerPlacementFn(r)),"line"!==i&&"line"!==s?t:Fu(t,n,e,r)}static splitPointSymbol(t,n=0){const e=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&e.push(...ku.splitPointSymbol(n[t],t));return e}let r=null,i=null;for(const n in t)0===n.indexOf("marker")?(r=r||{},r[n]=t[n]):0===n.indexOf("text")&&(i=i||{},i[n]=t[n]);return r&&(r.isIconText=!0,t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),e.push(r)),i&&(r&&(i.textPlacement=r.markerPlacement,i.textSpacing=r.markerSpacing,i.isIconText=!0),t.mergeOnProperty&&(i.mergeOnProperty=t.mergeOnProperty),e.push(i)),void 0!==t.visible&&(r&&(r.visible=t.visible),i&&(i.visible=t.visible)),r&&(r.markerTextFit&&i&&(r.text={},r.text.textName=i.textName,r.text.textSize=i.textSize),r.index={index:n,type:0}),i&&(i.index={index:n,type:1}),e}static isAtlasLoaded(t,n){const{icon:e,glyph:r}=t,{iconAtlas:i,glyphAtlas:s}=n;if(e&&(!i||!i.positions[e.url]))return!1;if(r){if(!s||!s.positions[r.font])return!1;const t=s.positions[r.font],{text:n}=r;for(const e of n)if(!t[e.codePointAt(0)])return!1}return!0}constructor(t,n,e){super(t,n,e),this.At=n.textPlacement,this.st.textPlacementFn&&(this.At=this.st.textPlacementFn(this.options.zoom))}createStyledVector(t,n,e,r,i,s){const o=new iu(t,this.symbolDef,n,e,r),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;i[t]||(i[t]=a.icon.size),i[t][0]<n[0]&&(i[t][0]=n[0]),i[t][1]<n[1]&&(i[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:n}=a.glyph,e=s[t]=s[t]||{};for(const t of n)e[t.codePointAt(0)]=1;"line"===this.At&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,e=n?this.getPackSDFFormat(t):this.getPackMarkerFormat();n?e.push(...this.Pt()):e.push(...this.St());const{markerOpacityFn:r,textOpacityFn:i,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:u,markerRotationFn:l,textRotationFn:h,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:p}=this.st;return(r||i)&&e.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&e.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||u)&&e.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(l||h)&&e.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||p)&&e.push({type:Uint8Array,width:1,name:"aOverlap"}),e}_t(){return this.hasMapPitchAlign}Pt(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:e,textHaloRadiusFn:r,textHaloOpacityFn:i,textDxFn:s,textDyFn:o}=this.st,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),e&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),i&&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}St(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:e,markerDyFn:r}=this.st,i=[];return t&&i.push({type:this.options.markerWidthType||Uint8Array,width:1,name:"aMarkerWidth"}),n&&i.push({type:this.options.markerHeightType||Uint8Array,width:1,name:"aMarkerHeight"}),e&&i.push({type:Int8Array,width:1,name:"aMarkerDx"}),r&&i.push({type:Int8Array,width:1,name:"aMarkerDy"}),i}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.countOutOfAngle=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 e=t.getShape(this.iconAtlas,this.glyphAtlas);if(!(this.options.allowEmptyPack||e&&e.image||e&&(e.horizontal||e.vertical)))return;const r=this.Ot(t,e,n);if(this.countOutOfAngle+=r.countOutOfAngle||0,0===r.length)return;const i=this.data,s=this.needAltitudeAttribute()?2:3;let o=this.data.aPosition.getLength()/s;const a=t.symbol,u=t.feature.properties,l="line"===this.At&&!a.isIconText,h=void 0!==a.textName,c=h&&l&&function(t){let n=0;for(let e=0;e<t.length;e++)if(Na(t.charAt(e).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:f,textSizeFn:d,textHaloFillFn:p,textHaloRadiusFn:m,textHaloOpacityFn:g,textDxFn:v,textDyFn:b,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:x,textAllowOverlapFn:F,textIgnorePlacementFn:k,textOpacityFn:A,markerWidthFn:P,markerHeightFn:S,markerDxFn:_,markerDyFn:O,markerPitchAlignmentFn:C,markerRotationAlignmentFn:E,markerRotationFn:I,markerAllowOverlapFn:$,markerIgnorePlacementFn:T,markerOpacityFn:D}=this.st;let z,j,U,N,L,R,V,H,q,G,J,W,B,X,Y,K,Z;if(h){const n=t.getIconAndGlyph().glyph.font;z=function(t,n,e){const r=t.positionedGlyphs,i=[];for(let s=0;s<r.length;s++){const o=r[s],a=e[o.glyph];if(!a)continue;const u=a.rect;if(!u)continue;const l=4,h=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+h,0]:[0,0],d=n?[0,o.y-c]:[o.x+h,o.y-c],p=a.metrics.left-l-h+d[0],y=a.metrics.top-l+d[1],m=p+u.w,g=y+u.h,v=new dt(p,y),b=new dt(m,y),w=new dt(p,g),M=new dt(m,g);if(n&&o.vertical){const t=new dt(-h,h),n=-Math.PI/2,e=new dt(5,0);v.C(n,t).F(e),b.C(n,t).F(e),w.C(n,t).F(e),M.C(n,t).F(e)}i.push({tl:v,tr:b,bl:w,br:M,tex:u,writingMode:t.writingMode,glyphOffset:f})}return i}(e.horizontal,l,this.glyphAtlas.positions[n]),f&&(j=f(null,u),y(j)?(this.dynamicAttrs.aTextFill=1,j=[0,0,0,0]):j=Ir([],j)),d&&(U=d(this.options.zoom,u),or(U)&&(U=14)),p&&(N=p(null,u),y(N)?(this.dynamicAttrs.aTextHaloFill=1,N=[0,0,0,0]):N=Ir([],N)),m&&(L=m(null,u)),g&&(R=255*g(null,u)),v&&(V=v(null,u)||0),b&&(H=b(null,u)||0),w&&(B=+("map"===w(null,u))),M&&(X=+("map"===M(null,u))),x&&(Y=ar(x(null,u),0,360)*Math.PI/180)}else z=e?function(t){const n=t.image,e=t.top-1/n.pixelRatio,r=t.left-1/n.pixelRatio,i=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,u,l;return o=new dt(r,e),a=new dt(s,e),u=new dt(s,i),l=new dt(r,i),[{tl:o,tr:a,bl:l,br:u,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(e):function(){const t=new dt(0,0),n=new dt(0,0),e=new dt(0,0);return[{tl:t,tr:n,bl:new dt(0,0),br:e,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),P&&(q=P(null,u)),or(q)&&(q=z[0].tex.w),S&&(G=S(null,u)),or(G)&&(G=z[0].tex.h),_&&(J=_(null,u)),O&&(W=O(null,u)),C&&(B=+("map"===C(null,u))),E&&(X=+("map"===E(null,u))),I&&(Y=ar(I(null,u),0,360)*Math.PI/180);y(U)&&(this.dynamicAttrs.aTextSize=1),y(L)&&(this.dynamicAttrs.aTextHaloRadius=1),y(R)&&(this.dynamicAttrs.aTextHaloOpacity=1),y(V)&&(this.dynamicAttrs.aTextDx=1),y(H)&&(this.dynamicAttrs.aTextDy=1),y(q)&&(this.dynamicAttrs.aMarkerWidth=1),y(G)&&(this.dynamicAttrs.aMarkerHeight=1),y(J)&&(this.dynamicAttrs.aMarkerDx=1),y(W)&&(this.dynamicAttrs.aMarkerDy=1),y(B)&&(this.dynamicAttrs.aPitchAlign=1),y(X)&&(this.dynamicAttrs.aRotationAlign=1),y(Y)&&(this.dynamicAttrs.aRotation=1);const Q=$||F;Q&&(K=Q(null,u)||0);const tt=T||k;let nt;tt&&(Z=tt(null,u)||0);const et=A||D;et&&(nt=255*et(this.options.zoom,u));const rt=z.length;this.ensureDataCapacity(4*rt,r.length);const it=this.options.EXTENT,{altitudeScale:st,altitudeProperty:ot,defaultAltitude:at}=this.options,{altitude:ut}=ir(t.feature,st,ot,at);for(let t=0;t<r.length;t++){const n=r[t],e=n.z||ut||0;if(it!==1/0&&sr(n,it))continue;const s=n.x,a=n.y,u=z.length;for(let t=0;t<u;t++){const r=z[t],{tl:u,tr:f,bl:d,br:p,tex:y}=r;this.Ct(i,s,a,e,10*u.x,10*u.y,y.x,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*f.x,10*f.y,y.x+y.w,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*d.x,10*d.y,y.x,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*p.x,10*p.y,y.x+y.w,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.addElements(o,o+1,o+2),this.addElements(o+1,o+2,o+3),o+=4;const m=Math.max(Math.abs(s),Math.abs(a),Math.abs(e));m>this.maxPos&&(this.maxPos=m)}}}Ct(t,n,e,r,i,s,o,a){this.fillPosition(t,n,e,r);let u=t.aShape.currentIndex;t.aShape[u++]=i,t.aShape[u++]=s,t.aShape.currentIndex=u,u=t.aTexCoord.currentIndex,t.aTexCoord[u++]=o,t.aTexCoord[u++]=a,t.aTexCoord.currentIndex=u}Et(t,n,e,r,i,s,o,a){let u=t.aCount.currentIndex;if(t.aCount[u++]=e,t.aCount.currentIndex=u,n){u=t.aGlyphOffset.currentIndex,t.aGlyphOffset[u++]=r[0],t.aGlyphOffset[u++]=r[1],t.aGlyphOffset.currentIndex=u,this._t()&&(u=t.aPitchRotation.currentIndex,t.aPitchRotation[u++]=o[0],t.aPitchRotation[u++]=o[1],t.aPitchRotation[u++]=a,t.aPitchRotation.currentIndex=u);const n=i.startIndex;u=t.aSegment.currentIndex,t.aSegment[u++]=i.segment+n,t.aSegment[u++]=n,t.aSegment[u++]=i.line.length,t.aSegment.currentIndex=u,u=t.aVertical.currentIndex,t.aVertical[u++]=s,t.aVertical.currentIndex=u}}It(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m,g){const{textFillFn:v,textSizeFn:b,textHaloFillFn:w,textHaloRadiusFn:M,textHaloOpacityFn:x,textDxFn:F,textDyFn:k,textPitchAlignmentFn:A,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:C,markerWidthFn:E,markerHeightFn:I,markerDxFn:$,markerDyFn:T,markerPitchAlignmentFn:D,markerRotationAlignmentFn:z,markerRotationFn:j,markerAllowOverlapFn:U,markerIgnorePlacementFn:N,markerOpacityFn:L}=this.st;if(v){let e=t.aTextFill.currentIndex;t.aTextFill[e++]=n[0],t.aTextFill[e++]=n[1],t.aTextFill[e++]=n[2],t.aTextFill[e++]=n[3],t.aTextFill.currentIndex=e}if(b){let n=t.aTextSize.currentIndex;t.aTextSize[n++]=e,t.aTextSize.currentIndex=n}if(w){let n=t.aTextHaloFill.currentIndex;t.aTextHaloFill[n++]=r[0],t.aTextHaloFill[n++]=r[1],t.aTextHaloFill[n++]=r[2],t.aTextHaloFill[n++]=r[3],t.aTextHaloFill.currentIndex=n}if(M){let n=t.aTextHaloRadius.currentIndex;t.aTextHaloRadius[n++]=i,t.aTextHaloRadius.currentIndex=n}if(x){let n=t.aTextHaloOpacity.currentIndex;t.aTextHaloOpacity[n++]=s,t.aTextHaloOpacity.currentIndex=n}if(F){let n=t.aTextDx.currentIndex;t.aTextDx[n++]=o,t.aTextDx.currentIndex=n}if(k){let n=t.aTextDy.currentIndex;t.aTextDy[n++]=a,t.aTextDy.currentIndex=n}if(E){let n=t.aMarkerWidth.currentIndex;t.aMarkerWidth[n++]=u,t.aMarkerWidth.currentIndex=n}if(I){let n=t.aMarkerHeight.currentIndex;t.aMarkerHeight[n++]=l,t.aMarkerHeight.currentIndex=n}if($){let n=t.aMarkerDx.currentIndex;t.aMarkerDx[n++]=h,t.aMarkerDx.currentIndex=n}if(T){let n=t.aMarkerDy.currentIndex;t.aMarkerDy[n++]=c,t.aMarkerDy.currentIndex=n}if(L||C){let n=t.aColorOpacity.currentIndex;t.aColorOpacity[n++]=f,t.aColorOpacity.currentIndex=n}if(A||D){let n=t.aPitchAlign.currentIndex;t.aPitchAlign[n++]=d,t.aPitchAlign.currentIndex=n}if(z||P){let n=t.aRotationAlign.currentIndex;t.aRotationAlign[n++]=p,t.aRotationAlign.currentIndex=n}if(j||S){let n=t.aRotation.currentIndex;t.aRotation[n++]=9362*y,t.aRotation.currentIndex=n}const R=U||_,V=N||O;if(R||V){let n=t.aOverlap.currentIndex;t.aOverlap[n++]=(R?8:0)+4*m+((V?2:0)+g),t.aOverlap.currentIndex=n}i>0&&(this.properties.hasHalo=1)}Ot(t,n,e){const{feature:r,symbol:i}=t,s=this.$t(t,i),o=r.properties,{markerSpacingFn:a,textSpacingFn:u,textMaxAngleFn:l}=this.st,h=((a?a(null,o):i.markerSpacing)||(u?u(null,o):i.textSpacing)||250)*e;let c=l?l(this.options.zoom,o):i.textMaxAngle;or(c)&&(c=80),c*=Math.PI/180;const f=this.options.EXTENT,d=this.options.altitudeToTileScale,p=this._t();return vu(t,this.lineVertex,c,n,e,f,s,h,p,d)}$t(t,n){let e;return e=this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||this.At,this.vt||!n.markerPlacement&&!n.isIconText||(this.vt=e),!this.At||n.isIconText||this.bt||(this.bt=e),e}getPackSDFFormat(t){if("line"!==this.At||t.isIconText)return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}];{const t=[...this.getPositionFormat(),{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"}];return this._t()&&t.push({type:Float32Array,width:3,name:"aPitchRotation"}),t}}getPackMarkerFormat(){return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}]}}class Au{constructor(t){this.x=t.x,this.y=t.y,this.z=t.z||0}clone(){return new Au(this)}T(){return this._(this.mag()),this}_(t){return this.x/=t,this.y/=t,this.z/=t,this}D(){var t=this.y;return this.y=this.x,this.x=-t,this}mag(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}add(t){return this.clone().F(t)}sub(t){return this.clone().k(t)}F(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}k(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}mult(t){return this.clone().S(t)}S(t){return this.x*=t,this.y*=t,this.z*=t,this}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){var n=t.x-this.x,e=t.y-this.y,r=t.z-this.z;return n*n+e*e+r*r}j(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}}const Pu=63,Su=Math.cos(Math.PI/180*37.5),_u=Math.pow(2,16)/1,Ou=new dt,Cu=new dt,Eu=new dt;class Iu extends Pa{static mergeLineFeatures(t,n,e,r){return Fu(t,n,e,r)}constructor(t,n,e){super(t,n,e);let r=!1;const{lineDasharrayFn:i,lineDashColorFn:s}=this.st;this.hasGradient=this.symbol.lineGradientProperty,i&&(r=function(t,n,e){for(let r=0;r<t.length;r++)if(e(n,t[r].properties))return!0;return!1}(t,this.options.zoom,i),r&&(this.dasharrayFn=i)),this.hasDasharray=Du(this.symbol.lineDasharray)||r,this.hasDasharray&&s&&(this.dashColorFn=s)}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getLineResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:e,lineColorFn:r,lineOpacityFn:i,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:u}=this.st,l=[...this.getPositionFormat()];if(l.push(this.iconAtlas||this.hasDasharray?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),l.push({type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}),t&&l.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&l.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),r&&l.push({type:Uint8Array,width:4,name:"aColor"}),e&&l.push({type:Uint8Array,width:4,name:"aStrokeColor"}),i&&l.push({type:Uint8Array,width:1,name:"aOpacity"}),this.dasharrayFn&&l.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&l.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();l.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return(s||o)&&l.push({type:Int8Array,width:2,name:"aLineDxDy"}),(a||u)&&l.push({type:Int8Array,width:2,name:"aLinePattern"}),l}placeVector(t){const{lineJoinFn:n,lineCapFn:e,lineWidthFn:r,lineHeightFn:i,lineStrokeWidthFn:s,lineStrokeColorFn:o,lineColorFn:a,lineOpacityFn:u,lineDxFn:l,lineDyFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=this.symbol,p=t.feature,m=p.properties;let g=d.lineJoin||"miter",v=d.lineCap||"butt";if(n&&(g=n(this.options.zoom,m)||"miter"),e&&(v=e(this.options.zoom,m)||"butt"),r){let t=r(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineWidth=1,t=4),wr(t)&&(t=4),this.feaLineWidth=+t}else this.feaLineWidth=+d.lineWidth;if(i){let t=i(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineHeight=1),wr(t)&&(t=this.feaLineWidth),this.feaLineHeight=+t}else this.feaLineHeight=+d.lineHeight||this.feaLineWidth;if(s){let t=s(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineStrokeWidth=1,t=0),wr(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(a&&(this.feaColor=a(this.options.zoom,m)||[255,255,255,255],y(this.feaColor)?(this.dynamicAttrs.aColor=1,this.feaColor=[0,0,0,0]):this.feaColor=Ir([],this.feaColor)),o&&(this.feaStrokeColor=o(this.options.zoom,m)||[0,0,0,255],y(this.feaStrokeColor)?(this.dynamicAttrs.aStrokeColor=1,this.feaStrokeColor=[0,0,0,0]):this.feaStrokeColor=Ir([],this.feaStrokeColor)),u){let t=u(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aOpacity=1,t=1),wr(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,m)||[0,0,0,0];if(y(t)&&(this.dynamicAttrs.aDasharray=1,t=[0,0,0,0]),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,m):this.symbol.lineDashColor)||[0,0,0,0];y(t)&&(this.dynamicAttrs.aDashColor=1,t=[0,0,0,0]),t=Ir([],t),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),e=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],e){const{tl:t,displaySize:e}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=e[0]-3,this.feaTexInfo[3]=e[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0}if(l){let t=l(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDx=t}if(h){let t=h(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternAnimSpeed=1,t=0),wr(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternGap=1,t=0),wr(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let w=p.geometry;if(b!==1/0){w=[];const t=[];for(let n=0;n<p.geometry.length;n++){t[0]=p.geometry[n];const e=ou(t,-1,-1,b+1,b+1);if(3===p.type&&e.length>1){const t=e[0],n=e[e.length-1];Uu(t[0],n[n.length-1])&&(e[0]=n.concat(t.slice(1)),e.length=e.length-1)}w.push(...e)}}const M=this.needAltitudeAttribute()?2:3;for(let t=0;t<w.length;t++)this.offset=this.data.aPosition.getLength()/M,this.Tt(w[t],p,g,v,2,1.05)}Dt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}Tt(t,n,e,r,i,s){const o=this.Dt()||Du(this.feaDash)||Du(this.symbol.lineDasharray),a=this.options.isTube;a&&(t=t.map((t=>new Au(t)))),this.overscaling=1;const u=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.prevVertex=null,this.symbol.lineGradientProperty&&n.properties&&Mr(n.properties.mapbox_clip_start)&&Mr(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 l=3===n.type&&!t.clipped;let h=t.length;for(;h>=2&&Uu(t[h-1],t[h-2]);)h--;let c=0;for(;c<h-1&&Uu(t[c],t[c+1]);)c++;if(h<(l?3:2))return;"bevel"===e&&(i=1.05);const f=this.overscaling<=16?15*u/(512*this.overscaling):0,d={vertexLength:0,primitiveLength:0,currentNormal:null};let p,y,m,g,v;this.e1=this.e2=-1,l&&(p=t[h-2],v=t[c].sub(p).T().D()),this.ensureDataCapacity(e,h,360,2);for(let n=c;n<h;n++){if(m=n===h-1?l?t[c+1]:void 0:t[n+1],m&&Uu(t[n],m))continue;v&&(g=v),p&&(y=p),p=t[n],m&&p.x===m.x&&p.y===m.y&&(p.x+=1e-4),v=m?m.sub(p).T().D():g,d.dir=y?p.sub(y).T():m.sub(p).T(),g=g||v,d.currentNormal=g;let u=g.add(v);0===u.x&&0===u.y||u.T();const b=g.x*v.x+g.y*v.y,w=u.x*v.x+u.y*v.y,M=0!==w?1/w:1/0,x=2*Math.sqrt(2-2*w),F=w<Su&&y&&m,k=g.x*v.y-g.y*v.x>0;if(!a&&F&&n>c){const t=p.dist(y);if(t>2*f){const n=p.sub(p.sub(y).S(f/t).j());n.z=p.z,this.updateDistance(y,n),this.addCurrentVertex(n,g,0,0,d),y=n}}const A=y&&m;d.middleVertex=A;let P=A?e:l?"butt":r;if(A&&"round"===P&&(M<s?P="miter":M<=2&&(P="fakeround")),"miter"===P&&M>i&&!a&&(P="bevel"),"bevel"===P&&(M>2&&(P="flipbevel"),M<i&&(P="miter")),y&&this.updateDistance(y,p),"miter"===P)a?(this.addCurrentVertex(p,g,0,0,d),d.dir=m.sub(p).T(),this.addCurrentVertex(p,v,0,0,d)):(u.S(M),this.addCurrentVertex(p,u,0,0,d),o&&(d.currentNormal=v,this.addCurrentVertex(p,u,0,0,d)));else if("flipbevel"===P){if(M>100)u=v.mult(-1);else{const t=M*g.add(v).mag()/g.sub(v).mag();u.D().S(t*(k?-1:1))}this.addCurrentVertex(p,u,0,0,d),this.addCurrentVertex(p,u.mult(-1),0,0,d)}else if("bevel"===P||"fakeround"===P){const t=-Math.sqrt(M*M-1),n=k?t:0,e=k?0:t;if(y&&this.addCurrentVertex(p,g,n,e,d),"fakeround"===P){const t=Math.round(180*x/Math.PI/20);for(let n=1;n<t;n++){let e=n/t;if(.5!==e){const t=e-.5;e+=e*t*(e-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*t*t+(.848013+b*(.215638*b-1.06021)))}const r=v.sub(g).S(e).F(g).T().S(k?-1:1);this.addHalfVertex(p,r.x,r.y,!1,k,0,d)}}m&&(d.currentNormal=v,this.addCurrentVertex(p,v,-n,-e,d))}else if("butt"===P)this.addCurrentVertex(p,u,0,0,d);else if("square"===P){const t=y?1:-1;this.addCurrentVertex(p,u,t,t,d)}else"round"===P&&(y&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,v,-1,-1,d,!0),this.addCurrentVertex(p,v,0,0,d)));if(!a&&F&&n<h-1){const t=p.dist(m);if(t>2*f){const n=p.add(m.sub(p).S(f/t).j());n.z=p.z,this.updateDistance(p,n),this.addCurrentVertex(n,v,0,0,d),p=n}}}}ensureDataCapacity(t,n,e,r){const i="round"===t?Math.round(e/20)-1:0;super.ensureDataCapacity((6+i)*r,n)}addCurrentVertex(t,n,e,r,i,s=!1){const o=n.x+n.y*e,a=n.y-n.x*e,u=n.y*r-n.x,l=-n.y-n.x*r;let h=0,c=0;if(i.middleVertex){Ou.x=o,Ou.y=a,Cu.x=u,Cu.y=l;const t=i.currentNormal;if(h=ju(t,Ou),0===e&&0===r)c=-h;else{const n=Eu;n.x=t.x,n.y=t.y,n.S(-1),c=ju(n,Cu)}}this.addHalfVertex(t,o,a,s,!1,e,i,h),this.addHalfVertex(t,u,l,s,!0,-r,i,c),this.prevVertex&&Uu(t,this.prevVertex)||(this.prevVertex=t),this.distance>_u/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,e,r,i,s))}addHalfVertex({x:t,y:n,z:e},r,i,s,o,a,u,l){this.fillData(this.data,t,n,e||0,r,i,s,o,1*this.scaledDistance,l);const h=u.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),u.primitiveLength++),o?this.e2=h:this.e1=h}fillData(t,n,e,r,i,s,o,a,u,l){const{lineWidthFn:h,lineStrokeWidthFn:c,lineStrokeColorFn:f,lineColorFn:d,lineOpacityFn:p,lineDxFn:y,lineDyFn:m,linePatternAnimSpeedFn:g,linePatternGapFn:v}=this.st;this.fillPosition(t,n,e,r);let b=Pu*i;b=(Math.sign(b)||1)*((Math.floor(Math.abs(b))>>1<<1)+ +o);let w=Pu*s;w=(Math.sign(w)||1)*((Math.floor(Math.abs(w))>>1<<1)+ +a);let M=t.aExtrude.currentIndex;t.aExtrude[M++]=b,t.aExtrude[M++]=w,(this.iconAtlas||this.hasDasharray)&&(t.aExtrude[M++]=Pu*l),t.aExtrude.currentIndex=M,M=t.aLinesofar.currentIndex,t.aLinesofar[M++]=u,t.aLinesofar.currentIndex=M,h&&(M=t.aLineWidth.currentIndex,t.aLineWidth[M++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=M),c&&(M=t.aLineStrokeWidth.currentIndex,t.aLineStrokeWidth[M++]=Math.round(2*this.feaLineStrokeWidth),t.aLineStrokeWidth.currentIndex=M),d&&(M=t.aColor.currentIndex,t.aColor[M++]=this.feaColor[0],t.aColor[M++]=this.feaColor[1],t.aColor[M++]=this.feaColor[2],t.aColor[M++]=this.feaColor[3],t.aColor.currentIndex=M),f&&(M=t.aStrokeColor.currentIndex,t.aStrokeColor[M++]=this.feaStrokeColor[0],t.aStrokeColor[M++]=this.feaStrokeColor[1],t.aStrokeColor[M++]=this.feaStrokeColor[2],t.aStrokeColor[M++]=this.feaStrokeColor[3],t.aStrokeColor.currentIndex=M),p&&(M=t.aOpacity.currentIndex,t.aOpacity[M++]=this.feaOpacity,t.aOpacity.currentIndex=M),this.dasharrayFn&&(M=t.aDasharray.currentIndex,t.aDasharray[M++]=this.feaDash[0],t.aDasharray[M++]=this.feaDash[1],t.aDasharray[M++]=this.feaDash[2],t.aDasharray[M++]=this.feaDash[3],t.aDasharray.currentIndex=M),this.dashColorFn&&(M=t.aDashColor.currentIndex,t.aDashColor[M++]=this.feaDashColor[0],t.aDashColor[M++]=this.feaDashColor[1],t.aDashColor[M++]=this.feaDashColor[2],t.aDashColor[M++]=this.feaDashColor[3],t.aDashColor.currentIndex=M),this.iconAtlas&&(M=t.aTexInfo.currentIndex,t.aTexInfo[M++]=this.feaTexInfo[0],t.aTexInfo[M++]=this.feaTexInfo[1],t.aTexInfo[M++]=this.feaTexInfo[2],t.aTexInfo[M++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=M),(y||m)&&(M=t.aLineDxDy.currentIndex,t.aLineDxDy[M++]=this.feaLineDx||0,t.aLineDxDy[M++]=this.feaLineDy||0,t.aLineDxDy.currentIndex=M),(g||v)&&(M=t.aLinePattern.currentIndex,t.aLinePattern[M++]=127*(this.feaPatternAnimSpeed||0),t.aLinePattern[M++]=10*(this.feaLinePatternGap||0),t.aLinePattern.currentIndex=M),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}addElements(t,n,e){super.addElements(this.offset+t,this.offset+n,this.offset+e)}zt(t){const n=this.options.EXTENT,e=this.elements;for(let r=0;r<e.length;r+=3)if(n===1/0||!Tu(this.data.aPosition,e[r],e[r+1],3,n)&&!Tu(this.data.aPosition,e[r+1],e[r+2],3,n)){let n=t.currentIndex;t[n++]=e[r],t[n++]=e[r+1],t[n++]=e[r+2],t.currentIndex=n}}jt(t){if(t.length<=1)return t;const n=[],e=this.options.EXTENT;let r,i=!0;for(r=0;r<t.length-1;r++){const s=$u(t[r],t[r+1],e);s&&i||(n.push(t[r]),i=s)}return i||n.push(t[r]),n}updateDistance(t,n){if(this.options.isTube){const e=t.dist(n),r=Or(this.options)*(n.z-t.z);this.distance+=Math.sqrt(e*e+r*r)}else this.distance+=t.dist(n);this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(_u-1):this.distance}}function $u(t,n,e){return e!==1/0&&(t.x<0&&n.x<0||t.x>e&&n.x>e||t.y<0&&n.y<0||t.y>e&&n.y>e)}function Tu(t,n,e,r,i){if(i===1/0)return!1;const s=Math.floor(.5*t[n*r]),o=Math.floor(.5*t[n*r+1]),a=Math.floor(.5*t[e*r]),u=Math.floor(.5*t[e*r+1]);return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function Du(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}const zu=new dt(0,0);function ju(t,n){const e=t.mag(),r=n.mag(),i=t.angleTo(zu),s=n.angleTo(zu);return Math.sign(s-i)*Math.sqrt(r*r-e*e)}function Uu(t,n){return t.equals(n)&&t.z===n.z}class Nu extends Iu{constructor(t,n,e){super(t,n,e),this.Ut=e.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.st,e=[{type:this.maxPosZ>=Math.pow(2,15)?Float32Array: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&&e.push({type:Uint8Array,width:4,name:"aColor"}),n&&e.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.Ut&&e.push({type:Float32Array,width:1,name:"aLineHeight"}),e}placeVector(t){const n=t.feature;if(this.Ut){const{altitudeScale:t,altitudeProperty:e,defaultAltitude:r,heightProperty:i,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:u}=ir(n,t,e,r,i,s,o);this.feaAltitude=a,this.feaMinHeight=(a-u)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}needAltitudeAttribute(){return!1}Tt(t,n,e,r,i,s){const o=this.data.aPosition.getLength()/3;super.Tt(t,n,e,r,i,s);const a=this.data.aPosition.getLength()/3,u=this.data.aPosition.getLength()/3-this.offset;if(3!==n.type&&u>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[o*r+3*r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*n+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*(n+3)+t];r.currentIndex=s}super.addElements(t+1,u+1,u),super.addElements(u,u+1,u+2);const r=this.data.aPosition.getLength()/3-this.offset;e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[a*r-r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-i+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-3*i+t];r.currentIndex=s}super.addElements(r,u-3,r+1),super.addElements(u-3,r+2,r+1)}}fillData(t,n,e,r,i,s,o,a,u){const l=!1!==this.options.top,h=!1!==this.options.side,c=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),f=Pu*i,d=Pu*s,p=c*i+n,y=c*s+e;this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),h&&(l&&this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(e))}Nt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=32767,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}Lt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=this.feaMinHeight||0,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}addElements(t,n,e){const r=!1!==this.options.top,i=!1!==this.options.side,s=(r?1:0)+(i?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(e*=s)+4]){if(r&&super.addElements(n,t,e),i){const t=r?1:0;super.addElements(n+t,e+t,e+t+2),super.addElements(n+t+1,e+t+1+2,n+t+1+2)}}else if(r&&super.addElements(t,e,n),i){const n=r?1:0;super.addElements(t+n,t+n+2,e+n),super.addElements(t+n+1+2,e+n+1+2,e+n+1)}}createDataPack(t,n){this.maxAltitude=0;const e=super.createDataPack(t,n);if(!e)return e;const{data:r,indices:i}=e;this.getFormat().reduce(((t,n)=>(t[n.name]={size:n.width},t)),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:u,aExtrude:l,aColor:h,aLineHeight:c,aLineWidth:f}=r,d={},p=Jn(s,i);let y,m=!0;for(let t=0;t<p.length;t++)p[t]=-p[t],p[t]%1!=0&&(m=!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)&&(y=function(t,n,e){const r=[];for(let i=0;i<t.length;i+=3){const t=n[i/3];r.push(t/256,e[i/3]?1:0)}return r}(s,a,u)),d.aPosition=o,y&&(d.aTexCoord0=new Float32Array(y)),d.aNormal=m?new Int8Array(p):new Float32Array(p),d.aPickingId=r.aPickingId,d.aExtrude=l,h&&(d.aColor=h),f&&(d.aLineWidth=f),c){const t=yr(this.maxAltitude);d.aLineHeight=new t(c)}const g=[];for(const t in d)g.push(d[t].buffer);return e.data=d,e.buffers=g,e}}const Lu=Math.pow(2,16)/1;class Ru extends Pa{getFormat(){return[...this.getPositionFormat()]}placeVector(t){const n=t.feature,e=3===n.type,r=n.geometry,i=this.elements;e&&(this.elements=this.dt.get());const s=this.needAltitudeAttribute()?2:3;for(let t=0;t<r.length;t++)this.offset=this.data.aPosition.getLength()/s,this.Tt(r[t],n),e&&(this.zt(i),this.elements=this.dt.get());e&&(this.elements=i)}Tt(t,n){const e=3===n.type;let r=t.length;for(;r>=2&&t[r-1].equals(t[r-2]);)r--;let i,s,o,a=0;for(;a<r-1&&t[a].equals(t[a+1]);)a++;if(!(r<(e?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,e&&(i=t[r-2]);for(let n=a;n<r;n++)o=e&&n===r-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(i&&(s=i),i=t[n],s&&(this.distance+=i.dist(s)),this.addCurrentVertex(i,this.distance))}}addCurrentVertex(t,n){const e=this.vertexLength++;this.addLineVertex(this.data,t,n),e>=1&&this.addElements(e-1,e),n>Lu&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){this.fillPosition(t,n.x,n.y,n.z||0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){this.maxIndex=Math.max(this.maxIndex,this.offset+t,this.offset+n);let e=this.elements.currentIndex;this.elements[e++]=this.offset+t,this.elements[e++]=this.offset+n,this.elements.currentIndex=e}zt(t){const n=this.options.EXTENT,e=this.elements,r=e.getLength();for(let i=0;i<r;i+=2)if(!er(this.data.aPosition,e[i],e[i+1],3,n)){let n=t.currentIndex;t[n++]=e[i],t[n++]=e[i+1],t.currentIndex=n}}}const Vu=45*Math.PI/100;class Hu extends Pa{getFormat(){const{markerFillFn:t}=this.st;let n;return n="line"===this.symbol.markerRotationAlignment?[...this.getPositionFormat(),{type:Float32Array,width:1,name:"aXYRotation"},{type:Float32Array,width:1,name:"aZRotation"}]:[...this.getPositionFormat()],t&&n.push({type:Uint8Array,width:4,name:"aColor"}),n}placeVector(t){const n=t.feature.properties,{markerFillFn:e}=this.st;let r;e&&(r=e(this.options.zoom,n)||[255,255,255,255],y(r)?(this.dynamicAttrs.aColor=1,r=[0,0,0,0]):r=Ir([],r));const i=this.data,s="line"===this.symbol.markerRotationAlignment,o=this.Ot(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point",s);for(let t=0;t<o.length;t++){const n=o[t];if(this.fillPosition(this.data,n.x,n.y,n.z),s){let t=i.aXYRotation.currentIndex;i.aXYRotation[t++]=n.xyRotation||0,i.aXYRotation.currentIndex=t,t=i.aZRotation.currentIndex,i.aZRotation[t++]=n.zRotation||0,i.aZRotation.currentIndex=t}if(r){let t=i.aColor.currentIndex;i.aColor[t++]=r[0],i.aColor[t++]=r[1],i.aColor[t++]=r[2],i.aColor[t++]=r[3],i.aColor.currentIndex=t}const e=Math.max(Math.abs(n.x),Math.abs(n.y));e>this.maxPos&&(this.maxPos=e)}}Ot(t,n,e,r){const i=t.feature,s=this.options.EXTENT;if("line"===e){const t=[];let e=i.geometry;s&&(e=ou(i.geometry,0,0,s,s));for(let r=0;r<e.length;r++){const i=lu(e[r],n,Vu,null,0,24,1,1,s||1/0);t.push.apply(t,i)}return t}return bu(i,e,s,r,this.options.altitudeToTileScale)}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const qu=[],Gu=[];function Ju(t,n){var e,r,i,s,o,a,u;for(r=1;r<=8;r*=2){for(e=[],s=!(Bu(i=t[t.length-1],n)&r),o=0;o<t.length;o++){if((u=!(Bu(a=t[o],n)&r))!==s){const t=Wu(i,a,r,n);e.push(void 0!==a.x?new dt(t[0],t[1]):t)}u&&e.push(a),i=a,s=u}if(!(t=e).length)break}return e}function Wu(t,n,e,r){return qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y,t=qu,Gu[0]=void 0===n.x?n[0]:n.x,Gu[1]=void 0===n.y?n[1]:n.y,n=Gu,8&e?[t[0]+(n[0]-t[0])*(r[3]-t[1])/(n[1]-t[1]),r[3]]:4&e?[t[0]+(n[0]-t[0])*(r[1]-t[1])/(n[1]-t[1]),r[1]]:2&e?[r[2],t[1]+(n[1]-t[1])*(r[2]-t[0])/(n[0]-t[0])]:1&e?[r[0],t[1]+(n[1]-t[1])*(r[0]-t[0])/(n[0]-t[0])]:null}function Bu(t,n){qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y;var e=0;return(t=qu)[0]<n[0]?e|=1:t[0]>n[2]&&(e|=2),t[1]<n[1]?e|=4:t[1]>n[3]&&(e|=8),e}const Xu=[0,0,0,0],Yu=-9999999;class Ku extends Pa{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getPolygonResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const t=[...this.getPositionFormat()],{polygonFillFn:n,polygonOpacityFn:e,uvScaleFn:r,uvOffsetFn:i,polygonPatternUVFn:s}=this.st;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"}),e&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),i&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),s&&t.push({type:Float32Array,width:2,name:"aTexCoord"}),t}placeVector(t,n){const e=t.feature;this.Rt(e.geometry,e,n)}Rt(t,n){let e,r,i,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:u,uvOffsetFn:l,uvOffsetInMeterFn:h,polygonPatternUVFn:c}=this.st,f=n.properties;o&&(e=o(this.options.zoom,f)||ze([],255,255,255,255),y(e)?(this.dynamicAttrs.aColor=1,e=Xu):e=Ir([],e)),a&&(r=a(this.options.zoom,f),y(r)?(this.dynamicAttrs.aOpacity=1,r=255):(wr(r)&&(r=1),r*=255)),u&&(i=u(this.options.zoom,f),y(i)?(i=[255,255],this.dynamicAttrs.aUVScale=1):(wr(i)&&(i=[1,1]),i=[255*i[0],255*i[1]])),l&&(h&&h(null,f)?s=[0,0]:(s=l(this.options.zoom,f),y(s)?(s=[0,0],this.dynamicAttrs.aUVOffset=1):(wr(s)&&(s=[0,0]),s=[255*s[0],255*s[1]])));const d=!!this.iconAtlas,p=fu(t,500),m=[0,0],g=[0,0];if(d){const{polygonPatternFileFn:t}=this.st,n=t?t(null,f):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n],e=!lr(t.displaySize[0])||!lr(t.displaySize[1]);m[0]=t.tl[0]+(e?1:0),m[1]=t.tl[1]+(e?1:0),g[0]=t.displaySize[0]-1-(e?2:0),g[1]=t.displaySize[1]-1-(e?2:0)}}let v,b=0;c&&(v=c(this.options.zoom,f));const w=this.needAltitudeAttribute()?2:3,M=[-1,-1,n.extent+1,n.extent+1],x=this.Vt=this.Vt||this.dt.getProxy(),F=this.Ht=this.Ht||this.dt.getProxy();for(let t=0;t<p.length;t++){const n=p[t],o=this.data.aPosition.getLength()/w;x.setLength(0),F.setLength(0);for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&0===this.maxPosZ&&(o=Ju(o,M)),0===o.length)continue;0!==t&&F.push(x.length/3),this.ensureDataCapacity(o.length);const a=this.data;for(let t=0;t<o.length;t++){const n=o[t].x,u=o[t].y,l=o[t].z||0;if(this.fillPosition(this.data,n,u,l),d){let t=a.aTexInfo.currentIndex;a.aTexInfo[t++]=m[0],a.aTexInfo[t++]=m[1],a.aTexInfo[t++]=g[0],a.aTexInfo[t++]=g[1],a.aTexInfo.currentIndex=t}if(void 0!==e){let t=a.aColor.currentIndex;a.aColor[t++]=e[0],a.aColor[t++]=e[1],a.aColor[t++]=e[2],a.aColor[t++]=e[3],a.aColor.currentIndex=t}if(void 0!==r){let t=a.aOpacity.currentIndex;a.aOpacity[t++]=r,a.aOpacity.currentIndex=t}if(void 0!==i){let t=a.aUVScale.currentIndex;a.aUVScale[t++]=i[0],a.aUVScale[t++]=i[1],a.aUVScale.currentIndex=t}if(void 0!==s){let t=a.aUVOffset.currentIndex;a.aUVOffset[t++]=s[0],a.aUVOffset[t++]=s[1],a.aUVOffset.currentIndex=t}if(c){let t=a.aTexCoord.currentIndex;if(v){const n=wr(v[2*b])?v[0]:v[2*b],e=wr(v[2*b]+1)?v[1]:v[2*b+1];a.aTexCoord[t++]=n,a.aTexCoord[t++]=e}else a.aTexCoord[t++]=Yu,a.aTexCoord[t++]=Yu;a.aTexCoord.currentIndex=t,b++}const h=Math.abs(n),f=Math.abs(u);h>this.maxPos&&(this.maxPos=h),f>this.maxPos&&(this.maxPos=f),x.push(n,u,l)}}let a=Ce(x,F,3);if(x.length&&!a.length){const t=[];for(let n=0;n<x.length;n+=3)t[n]=x[n],t[n+1]=x[n+2],t[n+2]=x[n+1];if(a=Ce(t,F,3),!a.length){for(let n=0;n<x.length;n+=3)t[n]=x[n+1],t[n+1]=x[n+2],t[n+2]=x[n];a=Ce(t,F,3)}}for(let t=0;t<a.length;t+=3)this.addElements(o+a[t],o+a[t+1],o+a[t+2])}}ensureDataCapacity(t){super.ensureDataCapacity(1,t)}}const Zu=[{type:Int16Array,width:3,name:"aPosition"}];class Qu extends Pa{getFormat(){return Zu}placeVector(t,n){const e=this.Ot(t,n);if(0===e.length)return;const r=this.data,i=this.getAltitude(t.feature.properties);let s=r.aPosition.getLength()/Zu[0].width;for(let t=0;t<e.length;t++){const n=e[t];r.aPosition.push(2*n.x+0,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+1,i),r.aPosition.push(2*n.x+0,2*n.y+1,i),this.addElements(s,s+1,s+2),this.addElements(s,s+2,s+3),s+=4;const o=Math.max(Math.abs(2*n.x+1),Math.abs(2*n.y+1));o>this.maxPos&&(this.maxPos=o)}}Ot(t,n){const{feature:e,symbol:r}=t,i=this.$t(t,r),s=e.properties,{markerSpacingFn:o}=this.st,a=((o?o(null,s):r.markerSpacing)||250)*n;return vu(t,null,null,n,this.options.EXTENT,i,a)}$t(t,n){return this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement}}class tl extends Iu{constructor(t,n,e){(n=br({},n)).lineJoin="miter",n.lineCap="butt",super(t,n,e),this.options.radialSegments%2==1&&this.options.radialSegments--}getFormat(){const{lineWidthFn:t,lineColorFn:n,lineOpacityFn:e,linePatternAnimSpeedFn:r,linePatternGapFn:i}=this.st,s=[...this.getPositionFormat(),{type:Int8Array,width:4,name:"aTubeNormal"},{type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}];if(this.iconAtlas){s.push({type:Int8Array,width:1,name:"aNormalDistance"});const t=this.getIconAtlasMaxValue();s.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return t&&s.push({type:Uint16Array,width:1,name:"aLineWidth"}),n&&s.push({type:Uint8Array,width:4,name:"aColor"}),e&&s.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&s.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),i&&s.push({type:Int8Array,width:1,name:"aLinePatternGap"}),s}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,r*(this.options.radialSegments/2))}addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,f=this.options.radialSegments/2,{x:d,y:p,z:y}=o.dir,m=function(t,n,e,r,i,s,o,a){Ie(nl,e,r,i),Ie(el,s,o,0),Te(rl,nl,el),$e(el,el),$e(rl,rl),il[n]||(il[n]=[]);const u=il[n];for(var l=0;l<n;l++){const t=Math.PI*l/n,e=1-Math.abs(t-0)/(Math.PI/2);u[l]=u[l]||[],sl(el,rl,u[l],1,t,e*(a?-1:1))}return u}(0,f,d,p,y,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,m,i,c,a)}fillTubeElements(t){const n=this.options.radialSegments/2,e=this.needAltitudeAttribute()?2:3,r=this.data.aPosition.getLength()/e;for(let e=0;e<n;e++){const i=e+r-2*n;let s,o;e===n-1&&t?(s=e+r-2*n+1,o=e+r-2*n-2*n+1):(s=e+r+1,o=e+r+1-2*n),super.addElements(e+r-this.offset,s-this.offset,i-this.offset),super.addElements(i-this.offset,s-this.offset,o-this.offset)}}fillData(t,n,e,r,i,s,o,a){const{lineWidthFn:u,lineColorFn:l,lineOpacityFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=i.length;for(let s=0;s<d;s++){this.fillPosition(t,n,e,r),Ue(i[s],i[s],Pu);let d=t.aTubeNormal.currentIndex;for(let n=0;n<i[s].length;n++)t.aTubeNormal[d++]=i[s][n];if(t.aTubeNormal.currentIndex=d,d=t.aLinesofar.currentIndex,t.aLinesofar[d++]=o,t.aLinesofar.currentIndex=d,this.iconAtlas&&(d=t.aNormalDistance.currentIndex,t.aNormalDistance[d++]=Pu*a,t.aNormalDistance.currentIndex=d,d=t.aTexInfo.currentIndex,t.aTexInfo[d++]=this.feaTexInfo[0],t.aTexInfo[d++]=this.feaTexInfo[1],t.aTexInfo[d++]=this.feaTexInfo[2],t.aTexInfo[d++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=d),u){const n=Cr(this.options.metric);let e=this.feaLineWidth*n;isNaN(e)&&(e=0),d=t.aLineWidth.currentIndex,t.aLineWidth[d++]=Math.round(e),t.aLineWidth.currentIndex=d}l&&(d=t.aColor.currentIndex,t.aColor[d++]=this.feaColor[0],t.aColor[d++]=this.feaColor[1],t.aColor[d++]=this.feaColor[2],t.aColor[d++]=this.feaColor[3],t.aColor.currentIndex=d),h&&(d=t.aOpacity.currentIndex,t.aOpacity[d++]=this.feaOpacity,t.aOpacity.currentIndex=d),c&&(d=t.aLinePatternAnimSpeed.currentIndex,t.aLinePatternAnimSpeed[d++]=127*(this.feaPatternAnimSpeed||0),t.aLinePatternAnimSpeed.currentIndex=d),f&&(d=t.aLinePatternGap.currentIndex,t.aLinePatternGap[d++]=10*(this.feaLinePatternGap||0),t.aLinePatternGap.currentIndex=d)}this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}createDataPack(t,n){const e=super.createDataPack(t,n);return e&&(e.is2D=!1),e}}const nl=[],el=[],rl=[],il={};function sl(t,n,e,r,i,s){return ze(e,r*(Math.cos(i)*t[0]+Math.sin(i)*n[0]),r*(Math.cos(i)*t[1]+Math.sin(i)*n[1]),r*(Math.cos(i)*t[2]+Math.sin(i)*n[2]),s),e}class ol extends tl{addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,{x:f,y:d,z:p}=o.dir,y=function(t,n,e,r,i,s,o,a){Ie(ul,e,r,i),Ie(ll,s,o,0),Te(hl,ul,ll),$e(ll,ll),$e(hl,hl),Le(al,t,n);const u=Ve(al)/t,l=Math.atan(n/t);let h=Math.PI/2+(Math.PI/2-l);return cl[0]||(cl[0]=[]),sl(ll,hl,cl[0],u,h,a?1:-1),h+=2*l,cl[1]||(cl[1]=[]),sl(ll,hl,cl[1],u,h,a?1:-1),cl}(this.feaLineWidth,this.feaLineHeight,f,d,p,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,y,i,c,a)}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,2*r)}}const al=[],ul=[],ll=[],hl=[],cl=[];class fl{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}}\n/*!\n * based on @mapbox/tiny-sdf\n * https://github.com/mapbox/tiny-sdf\n * @License BSD 2-Clause\n */var dl=1e20;function pl(t,n,e,r,i,s,o){this.fontSize=t||24,this.buffer=void 0===n?3:n,this.cutoff=r||.25,this.fontFamily=i||"sans-serif",this.fontWeight=s||"normal",this.fontStyle=o||"normal",this.radius=e||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas="undefined"==typeof document?new OffscreenCanvas(a,a):document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0}),this.ctx.font=this.fontStyle+" "+this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function yl(t,n,e,r,i,s){for(var o=0;o<n;o++)ml(t,o,n,e,r,i,s);for(var a=0;a<e;a++)ml(t,a*n,1,n,r,i,s)}function ml(t,n,e,r,i,s,o){var a,u,l,h;for(s[0]=0,o[0]=-dl,o[1]=dl,a=0;a<r;a++)i[a]=t[n+a*e];for(a=1,u=0,l=0;a<r;a++){do{l=(i[a]-i[h=s[u]]+a*a-h*h)/(a-h)/2}while(l<=o[u]&&--u>-1);s[++u]=a,o[u]=l,o[u+1]=dl}for(a=0,u=0;a<r;a++){for(;o[u+1]<a;)u++;t[n+a*e]=i[h=s[u]]+(a-h)*(a-h)}}pl.prototype.draw=function(t,n,e){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.textBaseline="top",this.ctx.fillText(t,this.buffer,this.buffer);for(var r=this.ctx.getImageData(0,0,n,e),i=new Uint8ClampedArray(n*e),s=0;s<n*e;s++){var o=r.data[4*s+3]/255;this.gridOuter[s]=1===o?0:0===o?dl:Math.pow(Math.max(0,.5-o),2),this.gridInner[s]=1===o?dl:0===o?0:Math.pow(Math.max(0,o-.5),2)}for(yl(this.gridOuter,n,e,this.f,this.v,this.z),yl(this.gridInner,n,e,this.f,this.v,this.z),s=0;s<n*e;s++){var a=Math.sqrt(this.gridOuter[s])-Math.sqrt(this.gridInner[s]);i[s]=Math.round(255-255*(a/this.radius+this.cutoff))}return i};let gl=0;class vl{constructor(t,n=15,e,r){this.entries={},this.qt={},this.Gt=new fl(2048,(function(){})),this.Jt=t,this.Wt=n,this.Bt=e,this.Xt=r}Yt(t){return t&&t.indexOf("{stack}")>=0&&t.indexOf("{range}")>0}getGlyphs(t,n){if(!t||!Object.keys(t).length)return void n(null,{glyphs:null});if(this.Yt(this.Xt))return void this.Kt(t,n);const e=this.entries,r=t.options;let i=!0;r&&(i=!1!==r.isCharsCompact),i=i||this.Bt;const s=(r,s,a)=>{let u=0,l=0;for(const n in t)if("options"!==n){e[n]=e[n]||{},s[n]=s[n]||{};for(const h in t[n]){if(l++,l<=r)continue;const t=i&&!Na(+h),c=n+":"+h+":"+t;let f;if(this.Gt.has(c)?f=this.Gt.get(c):(f=this.Zt(e[n],n,h,t),this.Gt.add(c,f),u++),f=bl(f),s[n][h]=f,a.push(f.bitmap.data.buffer),this.Jt&&u>this.Wt)return void this.Jt(o(l,s,a))}}n(null,{glyphs:s,buffers:a})};function o(t,n,e){return()=>{s(t,n,e)}}s(0,{},[])}Kt(t,n){const e=[];for(const n in t)for(const r of t[n])e.push(this.Qt(n,r));Promise.all(e).then((t=>{n(null,t)}))}Qt(){return Promise.resolve(null)}Zt(t,n,e,r){const i=n;let s=t.tinySDF;const o=r?-1:2;if(!s){let n="400";/bolder/i.test(i)?n="1000":/bold/i.test(i)?n="900":/medium/i.test(i)?n="500":/light/i.test(i)&&(n="200"),s=t.tinySDF=new pl(24,2,8,.25,i,n)}const a=String.fromCodePoint(e),u=s.ctx.measureText(a),l=Math.round(u.width),h=s.draw(a,l+4,28);if(gl<4){const t="undefined"!=typeof document&&document.getElementById("sdf-debug-"+gl++);t&&(t.width=l+4,t.height=s.canvas.height,t.getContext("2d").drawImage(s.canvas,0,0))}return{charCode:e,bitmap:{width:l+4,height:28,data:h},metrics:{width:l,height:24,left:1,top:-2,advance:l+2+o}}}}function bl(t){const n={width:t.bitmap.width,height:t.bitmap.height,data:new Uint8ClampedArray(t.bitmap.data)};return{charCode:t.charCode,bitmap:n,metrics:br({},t.metrics)}}var wl=Object.freeze({__proto__:null,calculateSignedArea:nr,clipPolygon:Ju,convertGeometry:vr,convertRTLText:eu,generatePickingIndiceIndex:ur,getFeaAltitudeAndHeight:ir,getIndexArrayType:pr,getPosArrayType:yr,getUnsignedArrayType:mr,packPosition:jr,unpackPosition:function(t,n,e,r){const i=(Math.sign(n)||1)*(Math.abs(n)%Ur),s=(Math.sign(e)||1)*(Math.abs(e)%Ur),o=Math.floor(Math.abs(n)/Ur),a=Math.floor(Math.abs(e)/Ur);return t[0]=i,t[1]=s,t[2]=Math.sign(r+1e-5)*(2*o+a)*Nr+r,t}});var Ml={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,r,i){var s,o,a=8*i-r-1,u=(1<<a)-1,l=u>>1,h=-7,c=e?i-1:0,f=e?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-h)-1,d>>=-h,h+=a;h>0;s=256*s+t[n+c],c+=f,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+t[n+c],c+=f,h-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=l}return(d?-1:1)*o*Math.pow(2,s-r)},write:function(t,n,e,r,i,s){var o,a,u,l=8*s-i-1,h=(1<<l)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,y=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=h):(o=Math.floor(Math.log(n)/Math.LN2),n*(u=Math.pow(2,-o))<1&&(o--,u*=2),(n+=o+c>=1?f/u:f*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(n*u-1)*Math.pow(2,i),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[e+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;t[e+d]=255&o,d+=p,o/=256,l-=8);t[e+d-p]|=128*y}},xl=kl,Fl=Ml;function kl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}kl.Varint=0,kl.Fixed64=1,kl.Bytes=2,kl.Fixed32=5;var Al=4294967296,Pl=1/Al,Sl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function _l(t){return t.type===kl.Bytes?t.readVarint()+t.pos:t.pos+1}function Ol(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function Cl(t,n,e){var r=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(r);for(var i=e.pos-1;i>=t;i--)e.buf[i+r]=e.buf[i]}function El(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function Il(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function $l(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Tl(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function Dl(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function zl(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function jl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Ul(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function Nl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function Ll(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Rl(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Vl(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}kl.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var r=this.readVarint(),i=r>>3,s=this.pos;this.type=7&r,t(i,n,this),this.pos===s&&this.skip(r)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ll(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Vl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ll(this.buf,this.pos)+Ll(this.buf,this.pos+4)*Al;return this.pos+=8,t},readSFixed64:function(){var t=Ll(this.buf,this.pos)+Vl(this.buf,this.pos+4)*Al;return this.pos+=8,t},readFloat:function(){var t=Fl.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Fl.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,r=this.buf;return n=127&(e=r[this.pos++]),e<128?n:(n|=(127&(e=r[this.pos++]))<<7,e<128?n:(n|=(127&(e=r[this.pos++]))<<14,e<128?n:(n|=(127&(e=r[this.pos++]))<<21,e<128?n:function(t,n,e){var r,i,s=e.buf;if(r=(112&(i=s[e.pos++]))>>4,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<3,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<10,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<17,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<24,i<128)return Ol(t,r,n);if(r|=(1&(i=s[e.pos++]))<<31,i<128)return Ol(t,r,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=r[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&&Sl?function(t,n,e){return Sl.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){for(var r="",i=n;i<e;){var s,o,a,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h>e)break;1===h?u<128&&(l=u):2===h?128==(192&(s=t[i+1]))&&(l=(31&u)<<6|63&s)<=127&&(l=null):3===h?(o=t[i+2],128==(192&(s=t[i+1]))&&128==(192&o)&&((l=(15&u)<<12|(63&s)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):4===h&&(o=t[i+2],a=t[i+3],128==(192&(s=t[i+1]))&&128==(192&o)&&128==(192&a)&&((l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=h}return r}(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!==kl.Bytes)return t.push(this.readVarint(n));var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==kl.Bytes)return t.push(this.readSVarint());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==kl.Bytes)return t.push(this.readBoolean());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==kl.Bytes)return t.push(this.readFloat());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==kl.Bytes)return t.push(this.readDouble());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===kl.Varint)for(;this.buf[this.pos++]>127;);else if(n===kl.Bytes)this.pos=this.readVarint()+this.pos;else if(n===kl.Fixed32)this.pos+=4;else{if(n!==kl.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 e=new Uint8Array(n);e.set(this.buf),this.buf=e,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),Rl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,r;if(t>=0?(e=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;n.buf[n.pos++]|=e|((t>>>=3)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t)))))}(r,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,e){for(var r,i,s=0;s<n.length;s++){if((r=n.charCodeAt(s))>55295&&r<57344){if(!i){r>56319||s+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):i=r;continue}if(r<56320){t[e++]=239,t[e++]=191,t[e++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[e++]=239,t[e++]=191,t[e++]=189,i=null);r<128?t[e++]=r:(r<2048?t[e++]=r>>6|192:(r<65536?t[e++]=r>>12|224:(t[e++]=r>>18|240,t[e++]=r>>12&63|128),t[e++]=r>>6&63|128),t[e++]=63&r|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&Cl(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),Fl.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Fl.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 e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var r=this.pos-e;r>=128&&Cl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,n,e){this.writeTag(t,kl.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,El,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,Il,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,Dl,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,$l,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Tl,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,zl,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,jl,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Ul,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,Nl,n)},writeBytesField:function(t,n){this.writeTag(t,kl.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,kl.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,kl.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Hl=function(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(xl);const ql={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textFaceName: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},ql),Object.assign({lineDasharray:1,topPolygonFill:1,bottomPolygonFill:1},ql);const Gl=Math.PI/180,Jl=6378137*Math.PI/180,Wl=85.0511287798;function Bl(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=Wl,r=n[0],i=Math.max(Math.min(e,n[1]),-e);let s;s=0===i?0:Math.log(Math.tan((90+i)*Gl/2))/Gl;return t[0]=r*Jl,t[1]=s*Jl,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Xl(t,n);if("baidu"===e)return Xl(t,n);throw new Error("unsupported projection:"+e)}function Xl(t,n){return t[0]=n[0],t[1]=n[1],t}function Yl(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){0===t?function(t,n,e,r,i,s,o,a,u,l){const h=1/(100*s[0]),c=1/(100*s[1]),f=l&&l[0]||0,d=l&&l[1]||0,p=[0,0];for(let i=t;i<n;i+=3){const t=i/3*2,n=r[i]-f,s=r[i+1]-d;e[t]=p[0]+n/o*h/a,e[t+1]=p[1]-s/o*c/u}}(n,e,r,i,0,o,a,u,l,p):1===t&&function(t,n,e,r,i,s,o,a,u,l,h){if(!t)return;let c,f,d,p;0===t[4]?(c=t[0],f=t[1],d=t[2],p=t[3]):(c=t[1],f=t[2],d=t[3],p=t[0]);const y=Re(c,f),m=Re(f,d),g=[],v=[],b=[];for(let t=n;t<e;t+=3){const n=t/3*2;Le(g,(s.x/u+i[t]/o)*a,s.y/u*a+(h?i[t+1]:-i[t+1])/o*a),"EPSG:4326"!==l&&"EPSG:4490"!==l||Bl(g,g,"EPSG:3857"),Kl(v,g,c,f),Kl(b,g,p,c),r[n]=Re(c,v)/y,r[n+1]=Re(c,b)/m}}(h,n,e,r,i,s,a,c,f,d,!!p)}function Kl(t,n,e,r){const i=e[0]-r[0],s=e[1]-r[1];let o=(n[0]-e[0])*(e[0]-r[0])+(n[1]-e[1])*(e[1]-r[1]);return o/=i*i+s*s,t[0]=e[0]+o*i,t[1]=e[1]+o*s,t}function Zl(t,n,e,r,i){const s=3*n[e-1],o=3*n[e-1]+1,a=t[s],u=t[o];return l=r,h=i,c=a,f=u,Math.sqrt((c-l)*(c-l)+(f-h)*(f-h));var l,h,c,f}const Ql="__fea_idx";new Float32Array([-1e12])[0];const th="maptalks_ombb";function nh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m){const g=n.getLength(),v=i/3;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-o;i+=g;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-a;i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,(e=e||[]).push(g/3);const b=e.getLength();for(let n=0;n<b;n++){eh(v+(e[n-1]||0),v+e[n],t,g/3,u,r,l,h,c,f,s,d,p,y,m)}return i}function eh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){const y=s.getLength();let m,g;for(let o=t,a=n;o<a-1;o++)if(m=o,g=o+1,i===1/0||!lt(e,m,g,i))if((o-t)%2==1&&(m+=2*r,g+=2*r),p){let t=s.currentIndex;s[t++]=m+r,s[t++]=g,s[t++]=m,s[t++]=g+r,s[t++]=g,s[t++]=m+r,s.currentIndex=t}else{let t=s.currentIndex;s[t++]=m+r,s[t++]=m,s[t++]=g,s[t++]=g,s[t++]=g+r,s[t++]=m+r,s.currentIndex=t}o&&function(t,n,e,r,i,s,o,a,u,l,h,c){let f,d=0,p=0,y=0,m=0;const g=c?[1,3,4]:[2,3,4];for(let c=s.getLength()-1;c>=o;c--){const o=s[c],v=3*o+1,b=3*o+2,w=i[3*o],M=i[v],x=i[b];d||p||(d=Math.max(i[b],i[3*s[c-3]+2]),p=Math.min(i[b],i[3*s[c-3]+2]),f=d-p);let F=y;const k=c%6;0===t?(5===k&&(m=Zl(i,s,c,w,M)),F=k===g[0]||k===g[1]||k===g[2]?y:y+m):1===t&&(k===g[0]||k===g[1]||k===g[2]?F=0:5===k?(m=Zl(i,s,c,w,M),F=m):F=m);const A=F/l*(1/(100*h))/a;let P;P=1===n?x===d?1:0:"bottom"===e?x===d?f/100/u:0:x===d?0:-f/100/u,r[2*o]=A,r[2*o+1]=P,0===k&&(y+=m)}}(a,u,l,h,e,s,y,c[0],c[1],f,d,p)}function rh(t){const n=[t[0]];let e=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===e[0]&&t[r][1]===e[1]&&t[r][2]===e[2]||n.push(t[r]):t[r].x===e.x&&t[r].y===e.y&&t[r].z===e.z||n.push(t[r]),e=t[r];return n}const ih=ga.getInstance();function sh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,v){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),ih.reset();const{altitudeScale:b,altitudeProperty:w,defaultAltitude:M,heightProperty:x,minHeightProperty:F,defaultHeight:A,tangent:P,uv:S,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,top:I,side:$,textureYOrigin:T,topThickness:D}=n,z=function(t,n,{altitudeScale:e,altitudeProperty:r,defaultAltitude:i,heightProperty:s,minHeightProperty:o,defaultHeight:a},{center:u,side:l,top:h,topThickness:c,uvOrigin:f,uv:d,uvSize:p,topUVMode:y,sideUVMode:m,sideVerticalUVMode:g,textureYOrigin:v,tileRatio:b,centimeterToPoint:w,verticalCentimeterToPoint:M,positionType:x,res:F,glScale:A,projectionCode:P},S,_){let O=n/t[0].extent;n===1/0&&(O=1);const C=n===1/0,E=_.get(),I=_.get(),$=_.get(),T=_.getProxy(),D=_.get(),z=_.get(),j=_.get(),U=!!d,N=!!h,L=!!l,R=U?_.get():null;function V(t,e,r,i,s,o){let a=e;if(N){const i=Ce(T,r,3);if(0===i.length)return e;let l=T.getLength(),h=D.currentIndex;for(let t=0;t<l;t++)D[h++]=T[t];if(D.currentIndex=h,e+=T.getLength(),o)for(let n=2,e=i.length;n<e;n+=3)i[n]+=t/3,i[n-1]+=t/3,i[n-2]+=t/3;else{let n;for(let e=2,r=i.length;e<r;e+=3)n=i[e-1],i[e-1]=i[e]+t/3,i[e]=n+t/3,i[e-2]+=t/3}l=i.length,h=z.currentIndex;for(let t=0;t<l;t++)z[h++]=i[t];z.currentIndex=h,U&&Yl(y||0,t,e,R,D,f,w,b,p[0],p[1],s,F,A,P,u),c>0&&!L&&(e=nh(D,T,r,z,e,R,0,c,n,U,m||0,g||0,v,p,b,M,o)),j.setLength(e/3),j.fill(1,a/3,e/3)}if(L){N&&(c=0),a=e,e=nh(D,T,r,z,e,R,c,i,n,U,m||0,g||0,v,p,b,M,o),j.setLength(e/3);const t=T.getLength()/3;j.fill(1,a/3,a/3+t),j.fill(0,a/3+t,a/3+2*t),j.fill(1,a/3+2*t,a/3+3*t),j.fill(0,a/3+3*t,e/3)}return e}let H=0,q=0;const G=[-1,-1,n+1,n+1];let J=0,W=t.length;k(S)&&(J=S,W=S+1);let B=0,X=!1;const Y=_.getProxy();for(;J<W;J++){const u=t[J],l=u.id;k(l)&&(Math.abs(l)>B&&(B=Math.abs(l)),l<0&&(X=!0));const h=u.geometry,c=u.properties[th];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:d,height:p}=wl.getFeaAltitudeAndHeight(u,e,r,i,s,a,o);H=Math.max(Math.abs(d),H);const y=D.getLength();let m=0,g=q;Y.setLength(0),T.setLength(0);const v=wl.calculateSignedArea(h[0])<0;for(let t=0,e=h.length;t<e;t++){let r=h[t];v&&(r=r.reverse()),r=rh(r);const i=wl.calculateSignedArea(r)<0;if(!i&&t>0&&(m++,f=c&&c[m],q=V(g,q,Y,p*O,f,C),T.setLength(0),Y.setLength(0),g=q),n!==1/0&&(r=wl.clipPolygon(r,G)),!r.length){t===e-1&&(q=V(g,q,Y,p*O,f,C));continue}const s=r.length;if(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]),i){let t=Y.currentIndex;Y[t++]=T.getLength()/3,Y.currentIndex=t}ut(T,T.getLength(),r,O,d,!1,x),t===e-1&&(q=V(g,q,Y,p*O,f,C))}const b=D.getLength()-y,w=(Ql+"").trim();for(let t=0;t<b/3;t++){let t=I.currentIndex;I[t++]=void 0===u[w]?J:u[w],I.currentIndex=t,t=E.currentIndex,E[t++]=J,E.currentIndex=t,k(l)&&(t=$.currentIndex,$[t++]=l,$.currentIndex=t)}}const K=wl.getUnsignedArrayType(I.getLength()?I[I.getLength()-1]:0),Z={maxAltitude:H,vertices:D,verticeTypes:j,indices:z,pickingIds:ga.createTypedArray(I,K),featureIndexes:E};if($.getLength()){const t=X?wl.getPosArrayType(B):wl.getUnsignedArrayType(B);Z.featureIds=ga.createTypedArray($,t)}else Z.featureIds=[];return R&&(R.setLength(D.getLength()/3*2),Z.uvs=R),Z}(t,e,{altitudeScale:b,altitudeProperty:w,defaultAltitude:M||0,heightProperty:x,minHeightProperty:F,defaultHeight:A||0},{center:v,top:I,side:$,topThickness:10*D||0,uv:S||P,uvSize:[i,i],uvOrigin:r,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,textureYOrigin:T,tileRatio:a,centimeterToPoint:u,verticalCentimeterToPoint:l,positionType:p,res:s,glScale:o,projectionCode:f},d,ih),j=[],U=z.vertices.getLength()/3,N=wl.getIndexArrayType(U),L=ga.createTypedArray(z.indices,N);delete z.indices,j.push(L.buffer,z.pickingIds.buffer);const R=wl.getPosArrayType(Math.max(512,z.maxAltitude));z.vertices=ga.createTypedArray(z.vertices,R);const V=P?ih.getProxy():new Float32Array(3*U);V.setLength&&V.setLength(3*U);const H=Jn(z.vertices,L,V);let q=!0;const G=H.getLength?H.getLength():H.length;for(let t=0;t<G;t++){H[t]=-H[t];const n=H[t]%1;1-Math.abs(n)>1e-6?q=!1:0!==n&&(H[t]=Math.round(H[t]))}if(z.normals=H,P){let t=ih.get();t.setLength(4*U),t=function(t,n,e,r,i){const s=(t.getLength?t.getLength():t.length)/3,o=i||new Array(4*s),a=[],u=[];for(let t=0;t<s;t++)a[t]=[0,0,0],u[t]=[0,0,0];const l=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],d=[0,0],p=[0,0],y=[0,0,0],m=[0,0,0];function g(n,r,i){ne(l,t,3*n),ne(h,t,3*r),ne(c,t,3*i),ee(f,e,2*n),ee(d,e,2*r),ee(p,e,2*i);const s=h[0]-l[0],o=c[0]-l[0],g=h[1]-l[1],v=c[1]-l[1],b=h[2]-l[2],w=c[2]-l[2],M=d[0]-f[0],x=p[0]-f[0],F=d[1]-f[1],k=p[1]-f[1],A=1/(M*k-x*F);_n(y,(k*s-F*o)*A,(k*g-F*v)*A,(k*b-F*w)*A),_n(m,(M*o-x*s)*A,(M*v-x*g)*A,(M*w-x*b)*A),On(a[n],a[n],y),On(a[r],a[r],y),On(a[i],a[i],y),On(u[n],u[n],m),On(u[r],u[r],m),On(u[i],u[i],m)}for(let t=0,n=r.length;t<n;t+=3)g(r[t+0],r[t+1],r[t+2]);const v=[],b=[],w=[],M=[];let x,F,k;function A(t){ne(w,n,3*t),Sn(M,w),F=a[t],Sn(v,F),$n(v,v,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(w,w,En(w,F))),Cn(v,v),In(b,M,F),k=En(b,u[t]),x=k<0?-1:1,o[4*t]=v[0],o[4*t+1]=v[1],o[4*t+2]=v[2],o[4*t+3]=x}for(let t=0,n=r.length;t<n;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return o}(z.vertices,z.normals,z.uvs,L,t),t=function(t,n){const e=n.getLength(),r=new Float32Array(e),i=[],s=[],o=[];for(let a=0;a<e;a+=4){const e=a/4*3;Ie(s,t[e]||0,t[e+1]||0,t[e+2]||0),ze(i,n[a]||0,n[a+1]||0,n[a+2]||0,n[a+3]||0),qn(o,s,i),De(r.subarray(a,a+4),o)}return r}(z.normals,t),z.tangents=t,j.push(t.buffer),delete z.normals}if(z.normals&&(q&&(z.normals=ga.createTypedArray(z.normals,Int8Array)),j.push(z.normals.buffer)),z.uvs){const t=z.uvs;z.uvs=ga.createTypedArray(t,Float32Array),j.push(z.uvs.buffer)}const J=function(t,n,e,r){const i={},s={},o=r.getLength();if(_(n.polygonFill)){let a=g(n.polygonFill);const u=new Uint8Array(4*o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aColor=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,Dr.normalizeColor(oh,l),u[4*n]=oh[0],u[4*n+1]=oh[1],u[4*n+2]=oh[2],u[4*n+3]=oh[3]}s.aColor=u}if(_(n.polygonOpacity)){let a=m(n.polygonOpacity);const u=new Uint8Array(o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aOpacity=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,u[n]=255*l}s.aOpacity=u}return s.dynamicAttributes=i,s}(t,h,c,z.featureIndexes),W=function(t,n,e,r,i){const s=[[],[]],o=_(r.topPolygonFill),a=_(r.bottomPolygonFill),u=[255,255,255,255],l=n.getLength();if(o||a){let h=o&&g(r.topPolygonFill),c=a&&g(r.bottomPolygonFill),f=null,d=null,p=null,m=null;for(let r=0;r<l;r++){if(1===t[r]&&!o||0===t[r]&&!a)continue;const l=1===t[r];if(l&&n[r]===f){t[r]=p;continue}if(!l&&n[r]===d){t[r]=m;continue}const v=e[n[r]],b=v.properties||{};b.$layer=v.layer,b.$type=v.type;let w=l?h:c,M=w(i,b);y(M)&&(w=g(M),M=w(i,b)),delete b.$layer,delete b.$type,Dr.normalizeColor(oh,M),je(oh,oh,u);let x=ah(s,oh);x<0&&(x=s.length,s.push(De([],oh))),t[r]=x,l?(f=n[r],p=x):(d=n[r],m=x)}}return s.slice(2)}(z.verticeTypes,z.featureIndexes,t,h,c),B={data:{data:{aVertexColorType:W.length<=252?ga.createTypedArray(z.verticeTypes,Uint8Array):ga.createTypedArray(z.verticeTypes,Uint16Array),aPosition:z.vertices,aNormal:z.normals,aTexCoord0:z.uvs,aTangent:z.tangents,aPickingId:z.pickingIds},indices:L,properties:{maxAltitude:z.maxAltitude},dynamicAttributes:J.dynamicAttributes,vertexColors:W},buffers:j};return z.featureIds.length?(B.data.featureIds=z.featureIds,j.push(B.data.featureIds.buffer)):B.data.featureIds=[],J.aColor&&(B.data.data.aColor=J.aColor,B.buffers.push(J.aColor.buffer)),J.aOpacity&&(B.data.data.aOpacity=J.aOpacity,B.buffers.push(J.aOpacity.buffer)),B.buffers.push(B.data.data.aPosition.buffer),B.data.pickingIdIndiceMap=wl.generatePickingIndiceIndex(B.data.data.aPickingId,B.data.indices),B}const oh=[];function ah(t,n){for(let e=0;e<t.length;e++)if(Ne(n,t[e]))return e;return-1}function uh(t,n,e,r,{altitudeScale:i,altitudeProperty:s,defaultAltitude:o,heightProperty:a,minHeightProperty:u,defaultHeight:l,bottom:h}){const c=h,f=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,r=t.length;n<r;n++){const r=t[n];if(k(r.geometry[0][0]))e+=3*r.geometry.length;else for(let t=0,n=r.geometry.length;t<n;t++){let n=3*r.geometry[t].length;3===r.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,p=[],m=new Int16Array(d),g=new Uint8Array(m.length/3*4);y(e)&&(e=ha.compileFilter(e));const v=[];function b(t,e,r){const i=e-t,s=m.subarray(t,e),o=m.subarray(e,e+i);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-r;const a=t/3,u=i/3;let l,h;for(let t=a,e=u+a;t<e;t++)t<e-1?(l=t,h=t+1):(l=t,h=a),lt(m,l,h,n)||(v.push(l,h),c&&v.push(l+u,h+u),lh(m,l,n)||v.push(l,l+u));return e+i}let w=0,M=0;const x=(Ql+"").trim(),F=[];for(let n=0,h=t.length;n<h;n++){const h=t[n],c=h.geometry;if(e){let t;t="function"==typeof e?e(h&&h.properties):e,Dr.normalizeColor(F,t)}else Ie(F,255,255,255);const d=w/3*4,{altitude:y,height:k}=wl.getFeaAltitudeAndHeight(h,i,s,o,a,l,u);M=Math.max(Math.abs(y),M);let A=w;for(let t=0,n=c.length;t<n;t++){let n=c[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),w=ut(m,A,n,f,y),w=b(A,w,k*f),A=w}const P=A/3*4;for(let t=d;t<P;t+=4)g[t]=F[0],g[t+1]=F[1],g[t+2]=F[2],g[t+3]=255*(r||1);const S=v.length-p.length;for(let t=0;t<S;t++)p.push(h[x])}const A=v.reduce(((t,n)=>Math.max(t,n)),0),P=new(wl.getIndexArrayType(A))(v),S=wl.getUnsignedArrayType(t.length);return{aPosition:new(wl.getPosArrayType(Math.max(512,M)))(m),indices:P,aPickingId:new S(p),aColor:g}}function lh(t,n,e){const r=t[3*n],i=t[3*n+1];return r<0||r>e||i<0||i>e}function hh(t,n,e,r){const i=uh(t,n,e.lineColor,e.lineOpacity,r),s=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],o=i.indices;return delete i.indices,{data:{data:i,indices:o},buffers:s}}let ch=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ch=!0}catch(t){ch=!1}var fh=ch;const dh="__original_properties",ph="__fn-type_properties";class yh{constructor(t,n,e,r,i){this.id=t,this.options=n,this.upload=e,this.tn(n.style),this.requests={},this.Gt=r,this.nn=1,this.loadings=i}updateStyle(t,n){this.options.style=t,this.nn=t.styleCounter,this.tn(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:e,y:r,z:s}=t.tileInfo;let o=!1;for(let t=0;t<i.length;t++)if(e===i[t].x&&r===i[t].y&&s===i[t].z){o=!0;break}if(!o)return void n()}if(e[r])return void e[r].push({context:t,callback:n,ref:this});e[r]=[{context:t,callback:n,ref:this}];const s=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((n,i,o,a)=>{const u=e[r];if(delete e[r],this.checkIfCanceled(r))return delete this.requests[r],void this.en(u,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||s)&&i)for(let n=0;n<i.length;n++)if(this.options.debug&&(i[n]._debug_info={index:n,id:i[n].id,tileId:t.tileInfo.id}),s){const t=P(s)?s[i[n].layer]:s,e=i[n].properties;i[n].id=e&&e[t]||null}if(n)this.en(u,n);else if(i&&i.length){if(u)for(let t=0;t<u.length;t++)this.rn.call(u[t].ref,u[t].context,u[t].callback,r,o,i,a)}else this.en(u)}))}rn(t,n,e,r,i,s){this.sn(r,i,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,s&&x(e.data,s),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.an(t),n()}an(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]}en(t,n,e){if(t)for(let r=0;r<t.length;r++)t[r].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.Gt,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&fh){const r=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));r.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.un||(this.un=new vl),this.un.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));r.push(t)}Promise.all(r).then((t=>{const n={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void e(t[r].err);t[r].iconData?n.icons=t[r].iconData.icons:t[r].glyphData&&(n.glyphs=t[r].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}sn(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=e,s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.hn(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,r=e.length;n<r;n++)t.push(e[n])}t.length}(o,this.featurePlugins);const a={};for(let t=0;t<o.length;t++)xh(n,e.tileInfo.z,o[t],a);const u=[],l=[];for(let t=0;t<n.length;t++){const e=n[t],r=a[t];if(r){l.fill(null);let t=0;for(const n in r){let i=0;const s=r[n].values();for(const t of s){let r=l[i];r||(r=Ph(e),l[i]=r),r.properties[n]=t,i++}i>t&&(t=i)}for(let n=0;n<t;n++)u.push(l[n])}else u.push(e)}const h=(n=u)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},d=[],p=[],y=[],m=this.options,g=[],v={},b=[Promise.resolve(e.styleCounter)];let w=0,M=-1;const F=[];let k=!1;for(let t=0;t<o.length;t++){M++;const r=o[t];r.type!==w&&(M=0,w=r.type);const a=0===r.type?d:p;if(r.symbol&&!1===r.symbol.visible){a[M]=null;continue}Oh(r.symbol,F,t),k=k||F[t]&&F[t].size>0;const{tileFeatures:u,tileFeaIndexes:l}=this.cn(c,r.type,r.filter,n,v,t);if(!u.length){a[M]=null;continue}const m=l[l.length-1],A=wl.getIndexArrayType(m);a[M]={styledFeatures:new A(l)},y.push({idx:t,typeIdx:M}),g.push(a[M].styledFeatures.buffer);const P=x({},e,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:r,z:s}=t[n];if(i.x===e&&i.y===r&&i.z===s){P.debugIndex=t[n].index;break}}}let S=this.dn(u,r,P);s&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=u[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=u[0].layer);return t}))),b.push(S)}return Promise.all(b).then((([e,...r])=>{if(e!==this.nn)return{canceled:!0};function i(t,n){if(void 0===t.data.ref&&(t.data.type=o[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)g.push(t.buffers[n])}for(let t=0;t<r.length;t++){if(!r[t])continue;const n=r[t],e=0===o[y[t].idx].type?d:p;if(Array.isArray(n)){const r=[];for(let e=0;e<n.length;e++)n[e]&&(i(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&r.push(n[e].data));r.length&&(e[y[t].typeIdx].data=r)}else i(n,t),e[y[t].typeIdx].data=n.data}const s={},a=t;if(m.features||m.schema||k){let t,e=!1;for(let r=0,i=n.length;r<i;r++)if(t=n[r],a[t.layer].properties||(a[t.layer].properties=vh(t.properties)),t&&(m.features||k&&v[r]))if("id"===m.features)s[r]=t.id;else{m.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[dh],e.customProps=x({},n),t=e}const i=x({},t);if(k&&v[r]&&(!m.features||"transient"===m.features)){const i=v[r];for(let r=0;r<i.length;r++){const i=F[r];i&&i.forEach((r=>{const i=n?n.properties:t.properties;i[ph]||(i[ph]=new Set),i[ph].add(r),e=!0}))}}s[r]=i}if(e)for(const t in s){const n=s[t],e=n.properties[ph];if(e){delete n.properties[ph],"transient"===m.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===m.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:a,data:d,featureData:p,extent:h,features:s},buffers:g}})).catch((t=>{console.error(t)}))}dn(t,n,e){let r=t;const i=n.renderPlugin.dataConfig,s=n.symbol,o=this.options.tileSize,{extent:a,glScale:u,zScale:l,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:d}=e,p=a/o,y=i.type,m=e.debugIndex;let g=x({},i,{EXTENT:a,zoom:h,debugIndex:m,features:this.options.features});if("3d-extrusion"===y){bh(s)&&(i.uv=1);const t=this.options.projectionCode,n=s.material&&s.material.textureWidth||23.25;return Promise.all([Promise.resolve(sh(r,i,a,c,n,e.tileInfo.res,u,a/this.options.tileSize,f,d,s,h,t,m))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(hh(r,a,s,i))]);if("point"===y){g=x(g,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:l*a/this.options.tileSize/u});const t=ku.splitPointSymbol(s),n=Pa.genFnTypes(t[0]);return ku.needMerge(t[0],n,h)&&(r=ku.mergeLineFeatures(r,t[0],n,h)),Promise.all(t.map(((t,e)=>(0===e?g.fnTypes=n:delete g.fnTypes,new ku(r,t,g).load(p)))))}if("native-point"===y){const t=l*a/this.options.tileSize/u;return g.altitudeToTileScale=t,wh(r,s,g,Hu,a/o)}if("line"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:p}),wh(r,s,g,Iu,1,!0);if("native-line"===y)return wh(r,s,g,Ru,1,!0);if("fill"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this)}),wh(r,s,g,Ku);if("line-extrusion"===y){delete s.lineGradientProperty,s.lineJoin="miter",s.lineCap="butt";const t=bh(s);if(t&&(i.uv=1),g=x(g,{tileSize:o,zScale:l,glScale:u}),s.mergeOnProperty){const t=Pa.genFnTypes(s);r=Iu.mergeLineFeatures(r,s,t,g.zoom)}if(t){const t=[];if(!1!==i.top){const n=x({},g);n.side=!1,t.push(new Nu(r,s,n))}return!1!==i.side&&(g.side=!0,g.top=!1,t.push(new Nu(r,s,g))),Promise.all(t.map((t=>t.load())))}return Promise.all([new Nu(r,s,g).load()])}if("circle"===y)return wh(r,s,g,Qu);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?tl:ol;return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:d,tileRatio:p,isTube:!0}),wh(r,s,g,t)}return Promise.resolve([])}cn(t,n,e,r,i,s){const o=(Ql+"").trim(),a=[],u=[],l=r.length;for(let h=0;h<l;h++)if((1===n||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!e.def||"default"===e.def)&&!i[h]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(r[h],t))){const t=r[h];if(void 0===t[o]&&(t[o]=h),i[h]||(i[h]=[]),i[h].push(s),u.push(t),a.push(h),1===n)break}return{tileFeatures:u,tileFeaIndexes:a}}tn(t){const{style:n,featureStyle:e}=t,r={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{r[t]=1})),t.filter=["in","$id",...t.id]):(r[t.id]=1,t.filter=["==","$id",t.id])}));const i=ha.compileStyle(n);for(let t=0;t<n.length;t++)i[t].filter&&(i[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),i[t].type=0;const s=[],o=ha.compileStyle(e);for(let t=0;t<e.length;t++)o[t].type=1,o[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=i,this.featurePlugins=s,this.styledFeatures=r}hn(t){let n=this.pn;this.pn||(n=this.pn={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const i in t){const s=i;if(!n[i]){const r=[];for(let n=0;n<t[i].types.length;n++){const o=t[i].types[n],a=["all",["==","$layer",s],["==","$type",e[o]]],u={filter:ln(a),renderPlugin:mh(o),symbol:gh(o)};u.filter.def=a,u.type=0,r.push(u)}n[s]=r}r.push(...n[s])}return r}}function mh(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 gh(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 vh(t){if(Array.isArray(t)||!P(t))return{};const n={};for(const e in t){const r=t[e];F(r)?n[e]="string":k(r)?n[e]="number":!0===r||!1===r?n[e]="boolean":Array.isArray(r)?n[e]="array":n[e]="object"}return n}function bh(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(P(t[e])){const r=bh(t[e]);if(2===r)return r;1===r&&(n=1)}}return n}function wh(t,n,e,r,i,s){const o={},a=Array.isArray(n)?n:[n];let u=-1;for(let t=0;t<a.length;t++)o[t]=Mh(a[t]),!o[t]&&a[t]&&-1===u&&(u=t);const l=[];for(let n=0;n<a.length;n++){if(!a[n])continue;a[n].index={index:n};let h=t;if(s&&a[n].mergeOnProperty){const r=Pa.genFnTypes(a[n]);h=Iu.mergeLineFeatures(t,a[0],r,e.zoom)}o[n]||n===u?l.push(new r(h,a[n],e).load(i)):l.push({data:{ref:u,symbolIndex:{index:n}}})}return Promise.all(l)}function Mh(t){if(!t)return 0;for(const n in t)if(_(t[n]))return 1;return 0}function xh(t,n,e,r){const i=e.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=ha.compileFilter(i[t].filter);for(let e=0;e<i.length;e++)for(let s=0,o=t.length;s<o;s++)if(i[e].fn(t[s],n))for(const t in i[e].properties){const n=i[e].properties[t];S(n)||(r[s]||(r[s]={}),r[s][t]||(r[s][t]=new Set),r[s][t].add(n))}}const Fh={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},kh={get:function(t,n){return n in t?t[n]:t[dh][n]},has:(t,n)=>n in t||n in t[dh]},Ah={};function Ph(t){const n={};n.originalFeature=t;const e=new Proxy(n,Fh);return e.properties=new Proxy({},kh),e.properties[dh]=t.properties||Ah,e}function Sh(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const _h=[];function Oh(t,n,e){if(!t)return _h;for(const r in t){if(!t[r]||!Dr.checkIfZoomFnTypeSymbol(r))continue;if(_(t[r]))Sh(n,e,t[r].property);else{if("lineGradientProperty"===r){Sh(n,e,t[r]);continue}if("textName"===r)if(F(t[r])){const i=Da.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)Sh(n,e,i[t])}else if(ha.isExpression(t[r])){const i=[];Da.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)Sh(n,e,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)_(i[t][1])&&Sh(n,t,i[t][1].property)}return n[e]}function Ch(t,n){Eh(t.geometry,n)}function Eh(t,n){if(t)switch(t.type){case"Point":Ih(t.coordinates,n);break;case"MultiPoint":case"LineString":$h(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,r=t.length;e<r;e++)$h(t[e],n)}(t.coordinates,n);break;case"Polygon":Th(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,r=t.length;e<r;e++)Th(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let r=0;r<e;r++)Eh(t.geometries[r],n)}}function Ih(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 $h(t,n){for(let e=0,r=t.length;e<r;e++)Ih(t[e],n)}function Th(t,n){t.length&&$h(t[0],n)}function Dh(t,n,e,r,i){zh(t,n,e||0,r||t.length-1,i||Uh)}function zh(t,n,e,r,i){for(;r>e;){if(r-e>600){var s=r-e+1,o=n-e+1,a=Math.log(s),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(s-u)/s)*(o-s/2<0?-1:1);zh(t,n,Math.max(e,Math.floor(n-o*u/s+l)),Math.min(r,Math.floor(n+(s-o)*u/s+l)),i)}var h=t[n],c=e,f=r;for(jh(t,e,n),i(t[r],h)>0&&jh(t,e,r);c<f;){for(jh(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[e],h)?jh(t,e,f):jh(t,++f,r),f<=n&&(e=f+1),n<=f&&(r=f-1)}}function jh(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function Uh(t,n){return t<n?-1:t>n?1:0}class Nh{constructor(t=9){this.yn=Math.max(4,t),this.mn=Math.max(2,Math.ceil(.4*this.yn)),this.clear()}all(){return this.gn(this.data,[])}search(t){let n=this.data;const e=[];if(!Kh(t,n))return e;const r=this.toBBox,i=[];for(;n;){for(let s=0;s<n.children.length;s++){const o=n.children[s],a=n.leaf?r(o):o;Kh(t,a)&&(n.leaf?e.push(o):Yh(t,a)?this.gn(o,e):i.push(o))}n=i.pop()}return e}collides(t){let n=this.data;if(!Kh(t,n))return!1;const e=[];for(;n;){for(let r=0;r<n.children.length;r++){const i=n.children[r],s=n.leaf?this.toBBox(i):i;if(Kh(t,s)){if(n.leaf||Yh(t,s))return!0;e.push(i)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.mn){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.vn(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.bn(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.wn(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.wn(t,this.data.height-1),this}clear(){return this.data=Zh([]),this}remove(t,n){if(!t)return this;let e=this.data;const r=this.toBBox(t),i=[],s=[];let o,a,u;for(;e||i.length;){if(e||(e=i.pop(),a=i[i.length-1],o=s.pop(),u=!0),e.leaf){const r=Lh(t,e.children,n);if(-1!==r)return e.children.splice(r,1),i.push(e),this.Mn(i),this}u||e.leaf||!Yh(e,r)?a?(o++,e=a.children[o],u=!1):e=null:(i.push(e),s.push(o),o=0,a=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}gn(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}vn(t,n,e,r){const i=e-n+1;let s,o=this.yn;if(i<=o)return s=Zh(t.slice(n,e+1)),Rh(s,this.toBBox),s;r||(r=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,r-1))),s=Zh([]),s.leaf=!1,s.height=r;const a=Math.ceil(i/o),u=a*Math.ceil(Math.sqrt(o));Qh(t,n,e,u,this.compareMinX);for(let i=n;i<=e;i+=u){const n=Math.min(i+u-1,e);Qh(t,i,n,a,this.compareMinY);for(let e=i;e<=n;e+=a){const i=Math.min(e+a-1,n);s.children.push(this.vn(t,e,i,r-1))}}return Rh(s,this.toBBox),s}xn(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){let e,r=1/0,i=1/0;for(let s=0;s<n.children.length;s++){const o=n.children[s],a=Jh(o),u=Bh(t,o)-a;u<i?(i=u,r=a<r?a:r,e=o):u===i&&a<r&&(r=a,e=o)}n=e||n.children[0]}return n}wn(t,n,e){const r=e?t:this.toBBox(t),i=[],s=this.xn(r,this.data,n,i);for(s.children.push(t),Hh(s,r);n>=0&&i[n].children.length>this.yn;)this.Fn(i,n),n--;this.kn(r,i,n)}Fn(t,n){const e=t[n],r=e.children.length,i=this.mn;this.An(e,i,r);const s=this.Pn(e,i,r),o=Zh(e.children.splice(s,e.children.length-s));o.height=e.height,o.leaf=e.leaf,Rh(e,this.toBBox),Rh(o,this.toBBox),n?t[n-1].children.push(o):this.bn(e,o)}bn(t,n){this.data=Zh([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Rh(this.data,this.toBBox)}Pn(t,n,e){let r,i=1/0,s=1/0;for(let o=n;o<=e-n;o++){const n=Vh(t,0,o,this.toBBox),a=Vh(t,o,e,this.toBBox),u=Xh(n,a),l=Jh(n)+Jh(a);u<i?(i=u,r=o,s=l<s?l:s):u===i&&l<s&&(s=l,r=o)}return r||e-n}An(t,n,e){const r=t.leaf?this.compareMinX:qh,i=t.leaf?this.compareMinY:Gh;this.Sn(t,n,e,r)<this.Sn(t,n,e,i)&&t.children.sort(r)}Sn(t,n,e,r){t.children.sort(r);const i=this.toBBox,s=Vh(t,0,n,i),o=Vh(t,e-n,e,i);let a=Wh(s)+Wh(o);for(let r=n;r<e-n;r++){const n=t.children[r];Hh(s,t.leaf?i(n):n),a+=Wh(s)}for(let r=e-n-1;r>=n;r--){const n=t.children[r];Hh(o,t.leaf?i(n):n),a+=Wh(o)}return a}kn(t,n,e){for(let r=e;r>=0;r--)Hh(n[r],t)}Mn(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():Rh(t[e],this.toBBox)}}function Lh(t,n,e){if(!e)return n.indexOf(t);for(let r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function Rh(t,n){Vh(t,0,t.children.length,n,t)}function Vh(t,n,e,r,i){i||(i=Zh(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s=n;s<e;s++){const n=t.children[s];Hh(i,t.leaf?r(n):n)}return i}function Hh(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function qh(t,n){return t.minX-n.minX}function Gh(t,n){return t.minY-n.minY}function Jh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Wh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Bh(t,n){return(Math.max(n.maxX,t.maxX)-Math.min(n.minX,t.minX))*(Math.max(n.maxY,t.maxY)-Math.min(n.minY,t.minY))}function Xh(t,n){const e=Math.max(t.minX,n.minX),r=Math.max(t.minY,n.minY),i=Math.min(t.maxX,n.maxX),s=Math.min(t.maxY,n.maxY);return Math.max(0,i-e)*Math.max(0,s-r)}function Yh(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function Kh(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function Zh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Qh(t,n,e,r,i){const s=[n,e];for(;s.length;){if((e=s.pop())-(n=s.pop())<=r)continue;const o=n+Math.ceil((e-n)/r/2)*r;Dh(t,o,n,e,i),s.push(n,o,o,e)}}var tc={exports:{}},nc=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=(r-e)/2,u=0,l=a-1;u<a;l=u++){var h=n[e+2*u+0],c=n[e+2*u+1],f=n[e+2*l+0],d=n[e+2*l+1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o},ec=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=r-e,u=0,l=a-1;u<a;l=u++){var h=n[u+e][0],c=n[u+e][1],f=n[l+e][0],d=n[l+e][1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o};tc.exports=function(t,n,e,r){return n.length>0&&Array.isArray(n[0])?ec(t,n,e,r):nc(t,n,e,r)};var rc=tc.exports.nested=ec;tc.exports.flat=nc;const ic=11102230246251565e-32,sc=134217729,oc=(3+8*ic)*ic;function ac(t,n,e,r,i){let s,o,a,u,l=n[0],h=r[0],c=0,f=0;h>l==h>-l?(s=l,l=n[++c]):(s=h,h=r[++f]);let d=0;if(c<t&&f<e)for(h>l==h>-l?(o=l+s,a=s-(o-l),l=n[++c]):(o=h+s,a=s-(o-h),h=r[++f]),s=o,0!==a&&(i[d++]=a);c<t&&f<e;)h>l==h>-l?(o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c]):(o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f]),s=o,0!==a&&(i[d++]=a);for(;c<t;)o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c],s=o,0!==a&&(i[d++]=a);for(;f<e;)o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f],s=o,0!==a&&(i[d++]=a);return 0===s&&0!==d||(i[d++]=s),d}function uc(t){return new Float64Array(t)}const lc=33306690738754716e-32,hc=22204460492503146e-32,cc=11093356479670487e-47,fc=uc(4),dc=uc(8),pc=uc(12),yc=uc(16),mc=uc(4);function gc(t,n,e,r,i,s){const o=(n-s)*(e-i),a=(t-i)*(r-s),u=o-a;if(0===o||0===a||o>0!=a>0)return u;const l=Math.abs(o+a);return Math.abs(u)>=lc*l?u:-function(t,n,e,r,i,s,o){let a,u,l,h,c,f,d,p,y,m,g,v,b,w,M,x,F,k;const A=t-i,P=e-i,S=n-s,_=r-s;w=A*_,f=sc*A,d=f-(f-A),p=A-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=S*P,f=sc*S,d=f-(f-S),p=S-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,fc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,fc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,fc[2]=v-(k-c)+(g-c),fc[3]=k;let O=function(t,n){let e=n[0];for(let r=1;r<t;r++)e+=n[r];return e}(4,fc),C=hc*o;if(O>=C||-O>=C)return O;if(c=t-A,a=t-(A+c)+(c-i),c=e-P,l=e-(P+c)+(c-i),c=n-S,u=n-(S+c)+(c-s),c=r-_,h=r-(_+c)+(c-s),0===a&&0===u&&0===l&&0===h)return O;if(C=cc*o+oc*Math.abs(O),O+=A*h+_*a-(S*l+P*u),O>=C||-O>=C)return O;w=a*_,f=sc*a,d=f-(f-a),p=a-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=u*P,f=sc*u,d=f-(f-u),p=u-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const E=ac(4,fc,4,mc,dc);w=A*h,f=sc*A,d=f-(f-A),p=A-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=S*l,f=sc*S,d=f-(f-S),p=S-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const I=ac(E,dc,4,mc,pc);w=a*h,f=sc*a,d=f-(f-a),p=a-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=u*l,f=sc*u,d=f-(f-u),p=u-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const $=ac(I,pc,4,mc,yc);return yc[$-1]}(t,n,e,r,i,s,l)}function vc(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var r=function(t){for(var n=t[0],e=t[0],r=t[0],i=t[0],s=0;s<t.length;s++){var o=t[s];o[0]<n[0]&&(n=o),o[0]>r[0]&&(r=o),o[1]<e[1]&&(e=o),o[1]>i[1]&&(i=o)}var a=[n,e,r,i],u=a.slice();for(s=0;s<t.length;s++)rc(t[s],a)||u.push(t[s]);return function(t){t.sort(Cc);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&kc(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&kc(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),n.pop(),n.concat(r)}(u)}(t),i=new Nh(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,n){return t[0]-n[0]},i.compareMinY=function(t,n){return t[1]-n[1]},i.load(t);for(var s,o=[],a=0;a<r.length;a++){var u=r[a];i.remove(u),s=Pc(u,s),o.push(s)}var l=new Nh(16);for(a=0;a<o.length;a++)l.insert(Ac(o[a]));for(var h=n*n,c=e*e;o.length;){var f=o.shift(),d=f.p,p=f.next.p,y=Sc(d,p);if(!(y<c)){var m=y/h;(u=bc(i,f.prev.p,d,p,f.next.next.p,m,l))&&Math.min(Sc(u,d),Sc(u,p))<=m&&(o.push(f),o.push(Pc(u,f)),i.remove(u),l.remove(f),l.insert(Ac(f)),l.insert(Ac(f.next)))}}f=s;var g=[];do{g.push(f.p),f=f.next}while(f!==s);return g.push(f.p),g}function bc(t,n,e,r,i,s,o){for(var a=new xn([],wc),u=t.data;u;){for(var l=0;l<u.children.length;l++){var h=u.children[l],c=u.leaf?_c(h,e,r):Mc(e,r,h);c>s||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),d=f.node,p=_c(d,n,e),y=_c(d,r,i);if(f.dist<p&&f.dist<y&&Fc(e,d,o)&&Fc(r,d,o))return d}(u=a.pop())&&(u=u.node)}return null}function wc(t,n){return t.dist-n.dist}function Mc(t,n,e){if(xc(t,e)||xc(n,e))return 0;var r=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===r)return 0;var i=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===i)return 0;var s=Oc(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===s)return 0;var o=Oc(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===o?0:Math.min(r,i,s,o)}function xc(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Fc(t,n,e){for(var r,i,s,o,a=Math.min(t[0],n[0]),u=Math.min(t[1],n[1]),l=Math.max(t[0],n[0]),h=Math.max(t[1],n[1]),c=e.search({minX:a,minY:u,maxX:l,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,s=t,r!==(o=n)&&i!==s&&kc(r,i,s)>0!=kc(r,i,o)>0&&kc(s,o,r)>0!=kc(s,o,i)>0)return!1;return!0}function kc(t,n,e){return gc(t[0],t[1],n[0],n[1],e[0],e[1])}function Ac(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Pc(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Sc(t,n){var e=t[0]-n[0],r=t[1]-n[1];return e*e+r*r}function _c(t,n,e){var r=n[0],i=n[1],s=e[0]-r,o=e[1]-i;if(0!==s||0!==o){var a=((t[0]-r)*s+(t[1]-i)*o)/(s*s+o*o);a>1?(r=e[0],i=e[1]):a>0&&(r+=s*a,i+=o*a)}return(s=t[0]-r)*s+(o=t[1]-i)*o}function Oc(t,n,e,r,i,s,o,a){var u,l,h,c,f=e-t,d=r-n,p=o-i,y=a-s,m=t-i,g=n-s,v=f*f+d*d,b=f*p+d*y,w=p*p+y*y,M=f*m+d*g,x=p*m+y*g,F=v*w-b*b,k=F,A=F;0===F?(l=0,k=1,c=x,A=w):(c=v*x-b*M,(l=b*x-w*M)<0?(l=0,c=x,A=w):l>k&&(l=k,c=x+b,A=w)),c<0?(c=0,-M<0?l=0:-M>v?l=k:(l=-M,k=v)):c>A&&(c=A,-M+b<0?l=0:-M+b>v?l=k:(l=-M+b,k=v));var P=(1-(h=0===c?0:c/A))*i+h*o-((1-(u=0===l?0:l/k))*t+u*e),S=(1-h)*s+h*a-((1-u)*n+u*r);return P*P+S*S}function Cc(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}class Ec{constructor(t,n){this.x=t,this.y=n}clone(){return new Ec(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 Ec(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}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 Ec(this.y,-this.x)}}function Ic(t,n,e,r){const i=n.x*r.y-n.y*r.x,s=e.x-t.x,o=e.y-t.y,a=(s*r.y-o*r.x)/i;return new Ec(t.x+a*n.x,t.y+a*n.y)}const $c=[],Tc=[];function Dc(t){if(k(t[0]&&t[0].x)){const n=[];let e=0;for(let r=0;r<t.length;r++)Tc[e]?(Tc[e][0]=t[r].x,Tc[e][1]=t[r].y):Tc[e]=[t[r].x,t[r].y],n.push(Tc[e]),e++;t=n}try{const n=vc(t,1/0);let e=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>r[0]&&(r[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>r[1]&&(r[1]=n[t][1]);const i=[];let s=[],o=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(Bl(i,n[t],"EPSG:3857"),$c[o]?($c[o].x=i[0],$c[o].y=i[1]):$c[o]=new Ec(i[0],i[1]),s.push($c[o]),o++);wl.calculateSignedArea(s)<0&&(s=s.reverse());const a=function(t){let n,e=Number.MAX_VALUE;const r=function(t,r,i,s,o,a,u,l){var h=Ic(t,r,o,a),c=Ic(i,s,o,a),f=Ic(u,l,t,r),d=Ic(u,l,i,s),p=h.distance(c)*h.distance(f);0!==p&&p<e&&(n=[h,f,d,c],e=p)};var i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();var s,o,a,u,l=new Ec(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Ec(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var c=t[n];c.x<l.x&&(l.x=c.x,s=n),c.x>h.x&&(h.x=c.x,o=n),c.y<l.y&&(l.y=c.y,u=n),c.y>h.y&&(h.y=c.y,a=n)}var f=new Ec(0,-1),d=new Ec(0,1),p=new Ec(-1,0),y=new Ec(1,0);for(let n=0;n<t.length;n++){var m=[Math.acos(f.dot(i[s])),Math.acos(d.dot(i[o])),Math.acos(p.dot(i[a])),Math.acos(y.dot(i[u]))];switch(m.indexOf(Math.min.apply(Math,m))){case 0:(d=(f=i[s].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 1:(f=(d=i[o].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 2:(y=(p=i[a].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(p=(y=i[u].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),u=(u+1)%t.length}r(t[s],f,t[o],d,t[a],p,t[u],y)}return n}(s);if(!a||4!==a.length)return null;const u=a[0].distance(a[1]),l=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(l>u)),h}catch(t){return null}}const zc=[];function jc(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)e?t[r]=jc(t[r]):(Bl(zc,t[r],n),t[r][0]=zc[0],t[r][1]=zc[1]);return t}class Uc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,s)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:k(this.options.tileBuffer)?this.options.tileBuffer:64,hasAltitude:!!this.options.hasAltitude,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5,disableFilter:!0};if(this.options.projection&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),F(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;C.getJSON(r,t.url?t:{},((t,i)=>{if(t&&(console.error("Failed to fetch geojson:"+r),n(t)),!i)return void n(null,{extent:null,idMap:{}});let s=i;if(this.options.convertFn){s=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(s)}const o=Array.isArray(s)?s:s.features;this._n(o);const{sample1000:a,idMap:u}=this.On(o);this.Cn(a,u,s,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features,i=r&&r.length;this._n(r);let s=r;if(r&&i>1e3){s=[];for(let t=0;t<i;t++)Nc(r[t],s,t,i)}this.Cn(s,null,t,e,n)}}_n(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Dc(t,t.length);e.properties=e.properties||{},e.properties[th]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const r=t[n][0];if(!r)continue;const i=Dc(r,r.length);e.properties=e.properties||{},e.properties[th]=e.properties[th]||[],e.properties[th][n]=i}}}}Cn(t,n,e,r,i){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":const e=t.features.length;for(let r=0;r<e;r++)Ch(t.features[r],n);break;case"Feature":Ch(t,n);break;default:Eh(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ot(t,n)}(e,this.options.geojsonvt||r),i(null,{extent:s,idMap:n})}catch(t){console.warn(t),i({error:t.message})}}On(t){const n=[],e={};let r=0;const i=this.options.featureIdProperty;if(t){const s=t.length;t.forEach(((t,o)=>{!function(t,s,o){if(t&&("Feature"!==t.type||t.geometry)){if(k(t.id)||(t.id=r++),i){let n=i;P(i)&&(n=i[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),Nc(t,n,s,o)}}(t,o,s)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,r,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const i=this.index.getTile(e.z,e.x,e.y);if(!i||0===i.features.length)return setTimeout((function(){n(null,r,[])}),1),1;const s=[];for(let t=0,n=i.features.length;t<n;t++){const n=i.features[t];let e=n.layer;void 0===e&&(e="0"),s[e]={types:{}};s[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(wl.convertGeometry(n),n.geometry.converted=1),r.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in s)s[t].types=Object.keys(s[t].types).map((t=>+t));return setTimeout((function(){n(null,r,s)}),1),1}onRemove(){super.onRemove(),delete this.index}}function Nc(t,n,e,r){const i=Math.floor(r/998);(0===e||e===r-1||(0===i||e%i==0)&&n.length<999)&&n.push(t)}var Lc=ct,Rc=Vc;function Vc(t,n,e,r,i){this.properties={},this.extent=e,this.type=0,this.En=t,this.In=-1,this.$n=r,this.Tn=i,t.readFields(Hc,this,n)}function Hc(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var r=n.$n[t.readVarint()],i=n.Tn[t.readVarint()];n.properties[r]=i}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.In=e.pos)}function qc(t){for(var n,e,r=0,i=0,s=t.length,o=s-1;i<s;o=i++)n=t[i],r+=((e=t[o]).x-n.x)*(n.y+e.y);return r}Vc.types=["Unknown","Point","LineString","Polygon"],Vc.prototype.loadGeometry=function(){var t=this.En;t.pos=this.In;for(var n,e=t.readVarint()+t.pos,r=1,i=0,s=0,o=0,a=[];t.pos<e;){if(i<=0){var u=t.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)s+=t.readSVarint(),o+=t.readSVarint(),1===r&&(n&&a.push(n),n=[]),n.push(new Lc(s,o));else{if(7!==r)throw new Error("unknown command "+r);n&&n.push(n[0].clone())}}return n&&a.push(n),a},Vc.prototype.bbox=function(){var t=this.En;t.pos=this.In;for(var n=t.readVarint()+t.pos,e=1,r=0,i=0,s=0,o=1/0,a=-1/0,u=1/0,l=-1/0;t.pos<n;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)(i+=t.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=t.readSVarint())<u&&(u=s),s>l&&(l=s);else if(7!==e)throw new Error("unknown command "+e)}return[o,u,a,l]},Vc.prototype.toGeoJSON=function(t,n,e){var r,i,s=this.extent*Math.pow(2,e),o=this.extent*t,a=this.extent*n,u=this.loadGeometry(),l=Vc.types[this.type];function h(t){for(var n=0;n<t.length;n++){var e=t[n],r=180-360*(e.y+a)/s;t[n]=[360*(e.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<u.length;r++)c[r]=u[r][0];h(u=c);break;case 2:for(r=0;r<u.length;r++)h(u[r]);break;case 3:for(u=function(t){var n=t.length;if(n<=1)return[t];for(var e,r,i=[],s=0;s<n;s++){var o=qc(t[s]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(e&&i.push(e),e=[t[s]]):e.push(t[s]))}e&&i.push(e);return i}(u),r=0;r<u.length;r++)for(i=0;i<u[r].length;i++)h(u[r][i])}1===u.length?u=u[0]:l="Multi"+l;var f={type:"Feature",geometry:{type:l,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Gc=Rc,Jc=Wc;function Wc(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.En=t,this.$n=[],this.Tn=[],this.Dn=[],t.readFields(Bc,this,n),this.length=this.Dn.length}function Bc(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Dn.push(e.pos):3===t?n.$n.push(e.readString()):4===t&&n.Tn.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var r=t.readVarint()>>3;n=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return n}(e))}Wc.prototype.feature=function(t){if(t<0||t>=this.Dn.length)throw new Error("feature index out of bounds");this.En.pos=this.Dn[t];var n=this.En.readVarint()+this.En.pos;return new Gc(this.En,n,this.extent,this.$n,this.Tn)};var Xc=Jc;function Yc(t,n,e){if(3===t){var r=new Xc(e,e.readVarint()+e.pos);r.length&&(n[r.name]=r)}}var Kc=function(t,n){this.layers=t.readFields(Yc,{},n)};class Zc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),n=n||{},s()}getTileFeatures(t,n){const e=t.tileInfo.url,r=t.fetchOptions||{};if(this.Gt.has(e)){const{err:t,data:r}=this.Gt.get(e);return setTimeout((()=>{this.zn(e,t,r,n)}),1)}return r.referrer=t.referrer,C.getArrayBuffer(e,r,((t,r)=>{this.Gt&&(t?t.loading||this.Gt.add(e,{err:t,data:r&&r.data}):r&&r.data&&this.Gt.add(e,{err:null,data:r.data}),this.zn(e,t,r&&r.data,n))}))}zn(t,n,e,r){if(n)return void r(n);let i;try{i=new Kc(new Hl(e))}catch(n){return void r(n.message,[],[])}const s=[];if(!i.layers)return void r(null,s,[]);const o={};let a;for(const t in i.layers)if(u=i.layers,l=t,Object.prototype.hasOwnProperty.call(u,l)){o[t]={types:{}};const e=o[t].types;for(let r=0,o=i.layers[t].length;r<o;r++)try{a=i.layers[t].feature(r),e[a.type]=1;const n={type:a.type,layer:t,geometry:a.loadGeometry(),properties:a.properties,extent:a.extent};void 0!==a.id&&(n.id=a.id);let o=n.properties[th];o&&(F(o)&&(o=JSON.parse(o)),n.properties[th]=jc(o,"EPSG:3857")),s.push(n)}catch(n){console.warn("error when load vt geometry:",n)}}var u,l;for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));r(null,s,o,{byteLength:e.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.an(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}let Qc=0;const tf=new fl(128);class nf{constructor(t){this.jn={},this.Un={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:r},i){if(this.Nn(n,e))return;const s=this.Ln(n,e),o=r.type,a=r.options,u=this.send.bind(this,t);this.jn[s]="GeoJSONVectorTileLayer"===o?new Uc(e,a,u,tf,{},i):new Zc(e,a,u,tf,{},i)}removeLayer({mapId:t,layerId:n},e){const r=this.Nn(t,n),i=this.Ln(t,n);delete this.jn[i],r&&r.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.loadTile(e,r)}abortTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.abortTile&&i.abortTile(e.url,r)}removeTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.removeTile(e,r)}updateStyle({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateStyle(e,r)}updateOptions({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateOptions(e,r)}setData({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.setData(e.data,r)}receive(t){const n=t.callback,e=this.Un[n];delete this.Un[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,r,i){const s=i?\`${q}t}-${q}Qc++}\`:null;i&&(this.Un[s]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(s)},r||[])}Ln(t,n){return\`${q}t}-${q}n}\`}Nn(t,n){const e=this.Ln(t,n);return this.jn[e]}Rn(){tf.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new nf(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=e.command;this.dispatcher[r]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,i)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(r,t),n(t,e,i)}))}}}`;
31
31
 
32
32
  let J = 0;
33
33
 
@@ -325,7 +325,7 @@ class pt extends t.worker.Actor {
325
325
  };
326
326
  this.send(i, null, e, this.v[n]);
327
327
  }
328
- M(t) {
328
+ S(t) {
329
329
  return t.id;
330
330
  }
331
331
  }
@@ -342,13 +342,13 @@ const mt = {}, yt = {
342
342
 
343
343
  class gt {
344
344
  constructor(t, e, n) {
345
- this.S = t, this.T = e, this.P = n || [ 0, 1, 0 ];
345
+ this.M = t, this.T = e, this.P = n || [ 0, 1, 0 ];
346
346
  }
347
347
  draw(t, e, n, i, r) {
348
348
  if (this.k || this.I(), !this.O) {
349
- this.O = this.S.buffer(xt(i));
349
+ this.O = this.M.buffer(xt(i));
350
350
  const t = i / n;
351
- this.C = this.S.buffer(vt(i, t));
351
+ this.C = this.M.buffer(vt(i, t));
352
352
  }
353
353
  if (i !== this.F) {
354
354
  const t = i / n;
@@ -360,7 +360,7 @@ class gt {
360
360
  const t = this.T.getDevicePixelRatio() > 1 ? 2 : 1;
361
361
  s = this.D = document.createElement("canvas"), s.width = 512 * t, s.height = 64 * t;
362
362
  const e = s.getContext("2d");
363
- e.font = "36px monospace", e.scale(t, t), this.L = this.S.texture({
363
+ e.font = "36px monospace", e.scale(t, t), this.L = this.M.texture({
364
364
  width: s.width,
365
365
  height: s.height,
366
366
  data: s
@@ -398,23 +398,23 @@ class gt {
398
398
  delete this.k);
399
399
  }
400
400
  I() {
401
- this.R = this.S.buffer(new Uint8Array([ 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1 ])),
402
- this.k = this.S({
401
+ this.R = this.M.buffer(new Uint8Array([ 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1 ])),
402
+ this.k = this.M({
403
403
  vert: "\n attribute vec2 aPosition;\n attribute vec2 aTexCoord;\n uniform mat4 transform;\n\n varying vec2 vTexCoord;\n void main()\n {\n gl_Position = transform * vec4(aPosition, 0.0, 1.0);\n vTexCoord = aTexCoord;\n }\n ",
404
404
  frag: "\n precision mediump float;\n uniform sampler2D uImage;\n uniform vec3 uColor;\n uniform float uOpacity;\n uniform float uDebugLine;\n\n varying vec2 vTexCoord;\n\n void main()\n {\n if (uDebugLine == 1.) {\n gl_FragColor = vec4(uColor, 1.0) * uOpacity;\n } else {\n gl_FragColor = texture2D(uImage, vTexCoord) * uOpacity;\n }\n gl_FragColor *= gl_FragColor.a;\n }\n ",
405
405
  attributes: {
406
- aPosition: this.S.prop("data"),
407
- aTexCoord: this.S.prop("texData")
406
+ aPosition: this.M.prop("data"),
407
+ aTexCoord: this.M.prop("texData")
408
408
  },
409
409
  uniforms: {
410
- transform: this.S.prop("transform"),
410
+ transform: this.M.prop("transform"),
411
411
  uColor: this.P,
412
412
  uOpacity: 1,
413
- uDebugLine: this.S.prop("debugLine"),
414
- uImage: this.S.prop("image")
413
+ uDebugLine: this.M.prop("debugLine"),
414
+ uImage: this.M.prop("image")
415
415
  },
416
- count: this.S.prop("count"),
417
- primitive: this.S.prop("primitive"),
416
+ count: this.M.prop("count"),
417
+ primitive: this.M.prop("primitive"),
418
418
  depth: {
419
419
  enable: !1,
420
420
  mask: !1
@@ -436,7 +436,7 @@ class gt {
436
436
  width: () => this.T.getRenderer().canvas.width,
437
437
  height: () => this.T.getRenderer().canvas.height
438
438
  },
439
- framebuffer: this.S.prop("framebuffer")
439
+ framebuffer: this.M.prop("framebuffer")
440
440
  });
441
441
  }
442
442
  }
@@ -453,7 +453,7 @@ const bt = new Uint8Array([ 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1 ]), At = [];
453
453
 
454
454
  class wt {
455
455
  constructor(t, e, i) {
456
- this.S = t;
456
+ this.M = t;
457
457
  (this.H = new n.Geometry({
458
458
  aPosition: bt
459
459
  }, null, bt.length / 2, {
@@ -529,7 +529,7 @@ class wt {
529
529
  }
530
530
  }
531
531
 
532
- const _t = "__fea_idx", Mt = -999999, St = new Float32Array([ -1e12 ])[0], Tt = "maptalks_ombb", Pt = (_t + "").trim();
532
+ const _t = "__fea_idx", St = -999999, Mt = new Float32Array([ -1e12 ])[0], Tt = "maptalks_ombb", Pt = (_t + "").trim();
533
533
 
534
534
  function kt(e, n, i, r, s, o) {
535
535
  const a = {};
@@ -858,7 +858,7 @@ class ie extends t.renderer.TileLayerCanvasRenderer {
858
858
  i || (this.it(), this.wt(), i = this.ot());
859
859
  const r = this.lt();
860
860
  n.isDefaultRender() || i.length || r.length ? (n.options.collision && n.clearCollisionIndex(),
861
- this._t = t, this.Mt = this.St(this.getMap().getGLRes()), this.Tt = e || {}, this.Pt(t),
861
+ this._t = t, this.St = this.Mt(this.getMap().getGLRes()), this.Tt = e || {}, this.Pt(t),
862
862
  super.draw(t), this.At !== t && this.kt(t), this.It(t), this.At = t) : this.completeRender();
863
863
  }
864
864
  wt() {
@@ -938,7 +938,7 @@ class ie extends t.renderer.TileLayerCanvasRenderer {
938
938
  extent2d: e.extent2d
939
939
  },
940
940
  glScale: l,
941
- zScale: this.Mt,
941
+ zScale: this.St,
942
942
  centimeterToPoint: o,
943
943
  verticalCentimeterToPoint: a,
944
944
  fetchOptions: h,
@@ -1508,7 +1508,7 @@ class ie extends t.renderer.TileLayerCanvasRenderer {
1508
1508
  }
1509
1509
  return i;
1510
1510
  }
1511
- St(t) {
1511
+ Mt(t) {
1512
1512
  return ht(t, this.getMap());
1513
1513
  }
1514
1514
  debugFBO(t, e) {
@@ -1608,7 +1608,7 @@ class ie extends t.renderer.TileLayerCanvasRenderer {
1608
1608
  }(this.gl));
1609
1609
  }
1610
1610
  getZScale() {
1611
- return this.Mt;
1611
+ return this.St;
1612
1612
  }
1613
1613
  outline(t, e) {
1614
1614
  e && (Array.isArray(e) || (e = [ e ]), this.Ft || (this.Ft = []), this.Ft.push([ "paintOutline", [ t, e ] ]),
@@ -1764,7 +1764,7 @@ ie.include({
1764
1764
  const t = new Array(3), e = new Array(3), n = new Array(3);
1765
1765
  return function(s, o, a) {
1766
1766
  const l = this.getTileGLScale(o), h = s, u = this.layer.getTileSize().width, c = r.identity([]);
1767
- return r.scale(c, c, i.set(t, l, l, this.Mt)), r.translate(c, c, i.set(e, h.x, h.y, 0)),
1767
+ return r.scale(c, c, i.set(t, l, l, this.St)), r.translate(c, c, i.set(e, h.x, h.y, 0)),
1768
1768
  r.scale(c, c, i.set(n, u / a, -u / a, 1)), c;
1769
1769
  };
1770
1770
  }(),
@@ -1938,11 +1938,11 @@ class pe extends t.TileLayer {
1938
1938
  const i = t[n].style;
1939
1939
  if (i && Array.isArray(i) && i.length) for (let r = 0; r < i.length; r++) {
1940
1940
  const s = tt({}, t[n], i[r]);
1941
- i[r].Me = e.length, delete s.style, e.push(s);
1941
+ i[r].Se = e.length, delete s.style, e.push(s);
1942
1942
  } else e.push(tt({}, t[n]));
1943
1943
  }
1944
1944
  return e;
1945
- }(t.featureStyle), this.Se = t.style || [];
1945
+ }(t.featureStyle), this.Me = t.style || [];
1946
1946
  const e = t.background || {};
1947
1947
  this.Te = {
1948
1948
  enable: e.enable || !1,
@@ -2072,7 +2072,7 @@ class pe extends t.TileLayer {
2072
2072
  return t ? (t.cancelAllHighlight(), this) : this;
2073
2073
  }
2074
2074
  Pe() {
2075
- t.Util.convertStylePath(this.Se, this.Ae), t.Util.convertStylePath(this._e, this.Ae);
2075
+ t.Util.convertStylePath(this.Me, this.Ae), t.Util.convertStylePath(this._e, this.Ae);
2076
2076
  }
2077
2077
  updateSceneConfig(t, e) {
2078
2078
  return et(t) && (t = this.Ee(t)), this.De(0, t, e);
@@ -2086,7 +2086,7 @@ class pe extends t.TileLayer {
2086
2086
  let s, o = e;
2087
2087
  if (r[e].renderPlugin.sceneConfig || (r[e].renderPlugin.sceneConfig = {}), tt(r[e].renderPlugin.sceneConfig, n),
2088
2088
  void 0 !== i) {
2089
- xe(this.we, e, i), o = this.we[e].style[i].Me;
2089
+ xe(this.we, e, i), o = this.we[e].style[i].Se;
2090
2090
  const t = r[o].renderPlugin;
2091
2091
  t.sceneConfig || (t.sceneConfig = {}), s = t.sceneConfig;
2092
2092
  } else ve(r, e), s = r[e].renderPlugin.sceneConfig;
@@ -2119,7 +2119,7 @@ class pe extends t.TileLayer {
2119
2119
  const r = this.ht(t);
2120
2120
  if (!r) return this;
2121
2121
  let s, o = e;
2122
- void 0 !== i ? (xe(this.we, e, i), o = this.we[e].style[i].Me, s = r[o].renderPlugin.dataConfig) : (ve(r, e),
2122
+ void 0 !== i ? (xe(this.we, e, i), o = this.we[e].style[i].Se, s = r[o].renderPlugin.dataConfig) : (ve(r, e),
2123
2123
  s = r[e].renderPlugin.dataConfig);
2124
2124
  const a = tt({}, s);
2125
2125
  if (tt(s, n), Array.isArray(this.options.style)) tt(this.options.style[e].renderPlugin.dataConfig, n); else {
@@ -2148,7 +2148,7 @@ class pe extends t.TileLayer {
2148
2148
  const s = this.ht(e);
2149
2149
  if (!s) return this;
2150
2150
  let o = n;
2151
- void 0 !== r && (xe(this.we, n, r), o = this.we[n].style[r].Me);
2151
+ void 0 !== r && (xe(this.we, n, r), o = this.we[n].style[r].Se);
2152
2152
  const a = s[o];
2153
2153
  if (!a) throw new Error(`No style defined at ${n}`);
2154
2154
  const l = this, h = this.Ae;
@@ -2195,15 +2195,15 @@ class pe extends t.TileLayer {
2195
2195
  if (e) {
2196
2196
  return 0 === t ? e.style : e.featureStyle;
2197
2197
  }
2198
- return 0 === t ? this.Se : this._e;
2198
+ return 0 === t ? this.Me : this._e;
2199
2199
  }
2200
2200
  isDefaultRender() {
2201
2201
  return !!this.Re && this.options.defaultRendering;
2202
2202
  }
2203
2203
  validateStyle() {
2204
2204
  this.Re = !1;
2205
- let t = this.Se;
2206
- this.options.style || (this.Re = !0, t = this.Se = []), Array.isArray(t) || (t = this.Se = [ t ]);
2205
+ let t = this.Me;
2206
+ this.options.style || (this.Re = !0, t = this.Me = []), Array.isArray(t) || (t = this.Me = [ t ]);
2207
2207
  for (let e = 0; e < t.length; e++) {
2208
2208
  let n = t[e].filter;
2209
2209
  if (n && n.value && (n = n.value), n || console.warn(`render plugin at ${e} doesn't define filter, its filter will be set to 'default' by default.`),
@@ -2214,7 +2214,7 @@ class pe extends t.TileLayer {
2214
2214
  return this.options.style ? JSON.parse(JSON.stringify(this.options.style)) : null;
2215
2215
  }
2216
2216
  Ee(t) {
2217
- const e = this.Se;
2217
+ const e = this.Me;
2218
2218
  if (!e) return -1;
2219
2219
  for (let n = 0; n < e.length; n++) if (e[n].name === t) return n;
2220
2220
  throw new Error(`No style defined with name: ${t}`);
@@ -2242,7 +2242,7 @@ class pe extends t.TileLayer {
2242
2242
  tt() {
2243
2243
  return {
2244
2244
  background: this.Te,
2245
- style: this.Se || [],
2245
+ style: this.Me || [],
2246
2246
  featureStyle: this._e || []
2247
2247
  };
2248
2248
  }
@@ -2552,9 +2552,9 @@ we.mergeOptions({
2552
2552
  const _e = {
2553
2553
  redraw: !1,
2554
2554
  retire: !1
2555
- }, Me = [];
2555
+ }, Se = [];
2556
2556
 
2557
- let Se = 1;
2557
+ let Me = 1;
2558
2558
 
2559
2559
  function Te(t, e) {
2560
2560
  const n = W.extend(t, {
@@ -2596,7 +2596,7 @@ function Te(t, e) {
2596
2596
  },
2597
2597
  getShadowMeshes() {
2598
2598
  const t = this.painter;
2599
- return t && t.getShadowMeshes && t.getShadowMeshes() || Me;
2599
+ return t && t.getShadowMeshes && t.getShadowMeshes() || Se;
2600
2600
  },
2601
2601
  createTile: function(t) {
2602
2602
  const {tileCache: e, tileData: n} = t;
@@ -2645,7 +2645,7 @@ function Te(t, e) {
2645
2645
  tileVectorTransform: o
2646
2646
  }, e);
2647
2647
  if (f.length) {
2648
- for (let t = 0; t < f.length; t++) f[t] && (h = !0, this.Ke(f[t], r, e.timestamp, Se++, u.isEnableTileStencil()));
2648
+ for (let t = 0; t < f.length; t++) f[t] && (h = !0, this.Ke(f[t], r, e.timestamp, Me++, u.isEnableTileStencil()));
2649
2649
  l.animation && (f.Je = e.timestamp);
2650
2650
  const t = this.Be(e);
2651
2651
  this.Ue[t] = f;
@@ -2779,7 +2779,7 @@ function Te(t, e) {
2779
2779
  },
2780
2780
  Be: function(t) {
2781
2781
  const e = t.tileInfo;
2782
- return e.meshKey || (e.meshKey = Se++), e.meshKey;
2782
+ return e.meshKey || (e.meshKey = Me++), e.meshKey;
2783
2783
  },
2784
2784
  G: function(t) {
2785
2785
  return this.Ue[t];
@@ -3150,7 +3150,7 @@ function tn(t, e, n, r, s, o, a, l) {
3150
3150
  break;
3151
3151
  }
3152
3152
  if (!y) return Je;
3153
- const g = Ze.set(f, d), x = o.queryTilePointTerrain(r, y, g, u, h), v = null === x[0] ? St : x[0];
3153
+ const g = Ze.set(f, d), x = o.queryTilePointTerrain(r, y, g, u, h), v = null === x[0] ? Mt : x[0];
3154
3154
  if (v) {
3155
3155
  let n = i.set(Qe, r.x, r.y, 0);
3156
3156
  return n[2] += 100 * v, n = Xe(t, n, a, e.width, e.height), n;
@@ -3266,7 +3266,7 @@ class pn {
3266
3266
  t[i] && !t[i].is2D && (this.xn = !1);
3267
3267
  const r = this.createGeometry(t[i], e, i);
3268
3268
  if (r && r.geometry) {
3269
- const s = r.geometry.properties, {pickingIdMap: o, idPickingMap: a, hasFeaIds: l} = this.Mn(t[i]);
3269
+ const s = r.geometry.properties, {pickingIdMap: o, idPickingMap: a, hasFeaIds: l} = this.Sn(t[i]);
3270
3270
  l && (s.feaIdPickingMap = o, s.feaPickingIdMap = a), s.symbolIndex = r.symbolIndex,
3271
3271
  s.features = e, s.is2D = t[i].is2D, s.layer = this.layer, s.positionBounding = t[i].positionBounding,
3272
3272
  this.postCreateGeometry(r, n);
@@ -3279,7 +3279,7 @@ class pn {
3279
3279
  return this.xn;
3280
3280
  }
3281
3281
  postCreateGeometry() {}
3282
- Mn(t) {
3282
+ Sn(t) {
3283
3283
  if (!t) return {};
3284
3284
  if (Array.isArray(t) && !(t = t[0])) return {};
3285
3285
  const e = t.featureIds, n = {}, i = {}, r = e && e.length;
@@ -3302,7 +3302,7 @@ class pn {
3302
3302
  if (!t[o]) continue;
3303
3303
  if (r && i && i.isRenderingTerrain && this.isTerrainVector()) {
3304
3304
  const e = t[o], n = e && e.geometry;
3305
- this.Sn(n, n.data, n.properties, n.positionSize || n.desc.positionSize, i);
3305
+ this.Mn(n, n.data, n.properties, n.positionSize || n.desc.positionSize, i);
3306
3306
  }
3307
3307
  let a = this.createMesh(t[o], e, n, i || {});
3308
3308
  Array.isArray(a) ? (a = a.filter((t => !!t)), s.push(...a)) : a && s.push(a);
@@ -3338,7 +3338,7 @@ class pn {
3338
3338
  if (!!l.HAS_BLOOM !== e && (a = !0, e ? l.HAS_BLOOM = 1 : delete l.HAS_BLOOM), i) {
3339
3339
  if (t.geometry.data.aTerrainAltitude) {
3340
3340
  const e = t.geometry;
3341
- this.Sn(e, e.data, e.properties, e.desc.positionSize, n);
3341
+ this.Mn(e, e.data, e.properties, e.desc.positionSize, n);
3342
3342
  }
3343
3343
  t.geometry.data.aTerrainAltitude && !l.HAS_TERRAIN_ALTITUDE && (l.HAS_TERRAIN_ALTITUDE = 1,
3344
3344
  a = !0);
@@ -3754,14 +3754,14 @@ class pn {
3754
3754
  }(t, this.layer, this.le) : null;
3755
3755
  l.highlightMesh(this.regl, t, n, this.Yn, e);
3756
3756
  }
3757
- Sn(t, e, n, i, r) {
3757
+ Mn(t, e, n, i, r) {
3758
3758
  let s = n.aAnchor;
3759
3759
  if (!s) {
3760
3760
  const {aPosition: t} = e;
3761
3761
  s = n.aAnchor = t.slice(0);
3762
3762
  }
3763
3763
  let o = n.aTerrainAltitude;
3764
- o || (o = n.aTerrainAltitude = new Float32Array(s.length / i), o.fill(St)), this.Xn(o, s, r.tileInfo, 0, o.length - 1),
3764
+ o || (o = n.aTerrainAltitude = new Float32Array(s.length / i), o.fill(Mt)), this.Xn(o, s, r.tileInfo, 0, o.length - 1),
3765
3765
  e.aTerrainAltitude ? o.dirty && this.$n(t, o) : e.aTerrainAltitude = o, o.dirty = !1;
3766
3766
  }
3767
3767
  $n(t, e) {
@@ -3794,24 +3794,24 @@ class pn {
3794
3794
  }
3795
3795
  const b = performance.now();
3796
3796
  i.terrainQueryStatus[u] = x;
3797
- const {xmin: A, ymax: w} = l, _ = ln.set(A, w), M = this.layer.getTileSize().width / i.extent, S = n.length / e.length;
3797
+ const {xmin: A, ymax: w} = l, _ = ln.set(A, w), S = this.layer.getTileSize().width / i.extent, M = n.length / e.length;
3798
3798
  let T = e.queryResult;
3799
3799
  T || (T = e.queryResult = new Map);
3800
3800
  let P = !0;
3801
3801
  for (let t = r; t <= s; t++) {
3802
- let i = n[t * S];
3802
+ let i = n[t * M];
3803
3803
  i < 0 ? i = 0 : i > a && (i = a);
3804
- let r = n[t * S + 1];
3804
+ let r = n[t * M + 1];
3805
3805
  r < 0 ? r = 0 : r > a && (r = a);
3806
3806
  const s = i + r * a;
3807
3807
  let l, h, u = T.get(s);
3808
3808
  if (u || 0 === u) e[t] !== u && (e[t] = u, e.dirty = !0); else {
3809
- for (let t = 0; t < y.length; t++) if (en(y[t], A + M * i, w - M * r, o)) {
3809
+ for (let t = 0; t < y.length; t++) if (en(y[t], A + S * i, w - S * r, o)) {
3810
3810
  l = y[t];
3811
3811
  break;
3812
3812
  }
3813
- l && (m.getRenderer().isTileCached(l.id) || e[t] === St) && (hn.set(i, r), h = this.layer.queryTilePointTerrain(hn, l, _, a, o)),
3814
- u = e[t], h && (u = null === h[0] ? St : h[0], un[0] = u, u = un[0]), e[t] !== u && (e[t] = u,
3813
+ l && (m.getRenderer().isTileCached(l.id) || e[t] === Mt) && (hn.set(i, r), h = this.layer.queryTilePointTerrain(hn, l, _, a, o)),
3814
+ u = e[t], h && (u = null === h[0] ? Mt : h[0], un[0] = u, u = un[0]), e[t] !== u && (e[t] = u,
3815
3815
  e.dirty = !0), h && h[1] ? T.set(s, u) : P = !1;
3816
3816
  }
3817
3817
  }
@@ -3922,14 +3922,14 @@ function wn(t) {
3922
3922
  return An[0] = r, An[1] = s, An;
3923
3923
  }
3924
3924
 
3925
- const _n = r.identity([]), Mn = {
3925
+ const _n = r.identity([]), Sn = {
3926
3926
  polygonFill: [ 1, 1, 1, 1 ],
3927
3927
  polygonOpacity: 1,
3928
3928
  uvScale: [ 1, 1 ],
3929
3929
  uvOffset: [ 0, 0 ],
3930
3930
  patternWidth: [ 0, 0 ],
3931
3931
  patternOffset: [ 0, 0 ]
3932
- }, Sn = [], Tn = new t.Coordinate(0, 0), Pn = new t.Coordinate(0, 0), kn = new t.Coordinate(0, 0), In = [];
3932
+ }, Mn = [], Tn = new t.Coordinate(0, 0), Pn = new t.Coordinate(0, 0), kn = new t.Coordinate(0, 0), In = [];
3933
3933
 
3934
3934
  class On extends gn {
3935
3935
  static getBloomSymbol() {
@@ -3952,7 +3952,7 @@ class On extends gn {
3952
3952
  return !0;
3953
3953
  }
3954
3954
  getAnalysisMeshes() {
3955
- if (!this.isVisible()) return Sn;
3955
+ if (!this.isVisible()) return Mn;
3956
3956
  return this.scene.getMeshes().filter((t => 0 === t.properties.level));
3957
3957
  }
3958
3958
  createMesh(e, i, r) {
@@ -3961,8 +3961,8 @@ class On extends gn {
3961
3961
  tileRatio: d
3962
3962
  }, g = this.getSymbol(l), x = this.getSymbolDef(l);
3963
3963
  if (H(x.polygonPatternFileOrigin) && this.qn(x, e, c ? [ 0, 0 ] : o, p), (H(x.polygonPatternFileWidth) || H(x.polygonPatternFileWidth)) && this.Kn(x, e, c ? d : 1, m, p),
3964
- x.uvOffsetInMeter && H(x.uvOffset) && this.Jn(x, e, m, p), Nt(y, "polygonFill", g, "polygonFill", Mn.polygonFill, Ut(this.colorCache)),
3965
- Nt(y, "polygonOpacity", g, "polygonOpacity", Mn.polygonOpacity), Nt(y, "uvScale", g, "uvScale", Mn.uvScale),
3964
+ x.uvOffsetInMeter && H(x.uvOffset) && this.Jn(x, e, m, p), Nt(y, "polygonFill", g, "polygonFill", Sn.polygonFill, Ut(this.colorCache)),
3965
+ Nt(y, "polygonOpacity", g, "polygonOpacity", Sn.polygonOpacity), Nt(y, "uvScale", g, "uvScale", Sn.uvScale),
3966
3966
  void 0 === u) {
3967
3967
  const t = this.getFnTypeConfig(l);
3968
3968
  Oe(a, x, t), a.generateBuffers(this.regl);
@@ -3984,24 +3984,24 @@ class On extends gn {
3984
3984
  Object.defineProperty(y, "patternWidth", {
3985
3985
  enumerable: !0,
3986
3986
  get: () => {
3987
- if (a.data.aPatternWidth) return Mn.patternWidth;
3987
+ if (a.data.aPatternWidth) return Sn.patternWidth;
3988
3988
  const t = x.polygonPatternFileWidth, n = x.polygonPatternFileHeight;
3989
- if (!t && !n) return Mn.patternWidth;
3989
+ if (!t && !n) return Sn.patternWidth;
3990
3990
  const [i, r] = this.Zn(In, t, n, c ? d : 1, m, p);
3991
3991
  return h.set(e, i, r);
3992
3992
  }
3993
3993
  }), Object.defineProperty(y, "uvOffset", {
3994
3994
  enumerable: !0,
3995
- get: () => a.data.aPatternOffset || x.uvOffsetInMeter ? Mn.uvOffset : g.uvOffset || Mn.uvOffset
3995
+ get: () => a.data.aPatternOffset || x.uvOffsetInMeter ? Sn.uvOffset : g.uvOffset || Sn.uvOffset
3996
3996
  });
3997
3997
  const n = [];
3998
3998
  Object.defineProperty(y, "patternOffset", {
3999
3999
  enumerable: !0,
4000
4000
  get: () => {
4001
- if (a.data.aPatternOffset) return Mn.uvOffset;
4002
- if (!x.uvOffsetInMeter) return Mn.uvOffset;
4001
+ if (a.data.aPatternOffset) return Sn.uvOffset;
4002
+ if (!x.uvOffsetInMeter) return Sn.uvOffset;
4003
4003
  const t = x.uvOffset;
4004
- if (!t) return Mn.uvOffset;
4004
+ if (!t) return Sn.uvOffset;
4005
4005
  const e = Kt(s, t[0], m, p), i = Kt(s, t[1], m, p);
4006
4006
  return h.set(n, e, i);
4007
4007
  }
@@ -4014,16 +4014,16 @@ class On extends gn {
4014
4014
  }), y.polygonPatternFile = vn(this.regl, v, !1, !1), y.atlasSize = [ v.width, v.height ],
4015
4015
  this.drawDebugAtlas(v);
4016
4016
  }
4017
- const A = new n.Material(y, Mn), _ = new n.Mesh(a, A, {
4017
+ const A = new n.Material(y, Sn), _ = new n.Mesh(a, A, {
4018
4018
  castShadow: !1,
4019
4019
  picking: !0
4020
- }), M = {};
4021
- return v && a.data.aTexInfo && (M.HAS_PATTERN = 1), v && a.data.aTexCoord && (M.HAS_TEX_COORD = 1,
4022
- M.INVALID_TEX_COORD = w + ".0"), a.data.aAltitude && (M.HAS_ALTITUDE = 1), a.data.aColor && (M.HAS_COLOR = 1),
4023
- a.data.aOpacity && (M.HAS_OPACITY = 1), a.data.aUVScale && (M.HAS_UV_SCALE = 1),
4024
- a.data.aUVOffset && (M.HAS_UV_OFFSET = 1), a.data.aPatternOrigin && (M.HAS_PATTERN_ORIGIN = 1),
4025
- a.data.aPatternWidth && (M.HAS_PATTERN_WIDTH = 1), a.data.aPatternOffset && (M.HAS_PATTERN_OFFSET = 1),
4026
- c && (M.IS_VT = 1), _.setDefines(M), _.setLocalTransform(i), _.properties.symbolIndex = l,
4020
+ }), S = {};
4021
+ return v && a.data.aTexInfo && (S.HAS_PATTERN = 1), v && a.data.aTexCoord && (S.HAS_TEX_COORD = 1,
4022
+ S.INVALID_TEX_COORD = w + ".0"), a.data.aAltitude && (S.HAS_ALTITUDE = 1), a.data.aColor && (S.HAS_COLOR = 1),
4023
+ a.data.aOpacity && (S.HAS_OPACITY = 1), a.data.aUVScale && (S.HAS_UV_SCALE = 1),
4024
+ a.data.aUVOffset && (S.HAS_UV_OFFSET = 1), a.data.aPatternOrigin && (S.HAS_PATTERN_ORIGIN = 1),
4025
+ a.data.aPatternWidth && (S.HAS_PATTERN_WIDTH = 1), a.data.aPatternOffset && (S.HAS_PATTERN_OFFSET = 1),
4026
+ c && (S.IS_VT = 1), _.setDefines(S), _.setLocalTransform(i), _.properties.symbolIndex = l,
4027
4027
  _;
4028
4028
  }
4029
4029
  Kn(t, e, n, i, r) {
@@ -4790,8 +4790,8 @@ class $n extends gn {
4790
4790
  }
4791
4791
  let y = t && d && 0 === d.collides, g = 1, x = !1;
4792
4792
  if (this.sceneConfig.fading) {
4793
- const t = this.Mi(e);
4794
- if (this.Si) t[r] = y ? 1 : -1; else if (c && delete e.Ti, g = this.Pi(c, y, t, r),
4793
+ const t = this.Si(e);
4794
+ if (this.Mi) t[r] = y ? 1 : -1; else if (c && delete e.Ti, g = this.Pi(c, y, t, r),
4795
4795
  c ? (g > 0 && (y = !0), x = this.isBoxFading(e, r), x && this.setToRedraw()) : y || (this.ki(t, r),
4796
4796
  g = 0), y) {
4797
4797
  const n = e.Ti;
@@ -4838,7 +4838,7 @@ class $n extends gn {
4838
4838
  const {frameTimestamp: n} = this.ri;
4839
4839
  let i = this.sceneConfig.fadingDuration;
4840
4840
  Rt(i) && (i = Vn);
4841
- return n - Math.abs(this.Mi(t)[e]) < i;
4841
+ return n - Math.abs(this.Si(t)[e]) < i;
4842
4842
  }
4843
4843
  _i(t, e, n, i, r, s, o) {
4844
4844
  const a = this.getSymbol(t.properties.symbolIndex), l = this.Ii(a, t, e[i]), h = this.Fi(a, t, e[i]);
@@ -4877,7 +4877,7 @@ class $n extends gn {
4877
4877
  h = (a - l) / r) : (l > 0 && (n[i] = l = -(a + o)), h = 1 - (a + l) / r), (h < 0 || h > 1) && (h = Lt(h, 0, 1)),
4878
4878
  h;
4879
4879
  }
4880
- Mi(t) {
4880
+ Si(t) {
4881
4881
  this.Ei || (this.Ei = {});
4882
4882
  const {meshKey: e} = t.properties;
4883
4883
  if (!this.Ei[e]) {
@@ -4893,7 +4893,7 @@ class $n extends gn {
4893
4893
  const e = this.scene.getMeshes();
4894
4894
  if (e && e.length) {
4895
4895
  for (let n = 0; n < e.length; n++) {
4896
- const i = this.Mi(e[n]);
4896
+ const i = this.Si(e[n]);
4897
4897
  i.timestamp < this.Li ? delete e[n]._fading_timestamps : i.timestamp = t;
4898
4898
  }
4899
4899
  this.Li = t;
@@ -4970,10 +4970,10 @@ class $n extends gn {
4970
4970
  const t = this.layer.getRenderer();
4971
4971
  this.Gi = this.scene.getMeshes().filter((e => !t.isForeground(e) && !e.properties.isLinePlacement));
4972
4972
  } else e && !this.wi && (this.$i = t.getResolution());
4973
- if (e) this.qi && (clearTimeout(this.qi), delete this.Si, delete this.qi), this.Si = this.$i && t.getResolution() > this.$i; else if (this.wi && !this.qi) {
4973
+ if (e) this.qi && (clearTimeout(this.qi), delete this.Mi, delete this.qi), this.Mi = this.$i && t.getResolution() > this.$i; else if (this.wi && !this.qi) {
4974
4974
  let {fadeOutDelay: t, fadingDuration: e} = this.sceneConfig;
4975
4975
  Rt(t) && (t = Un), Rt(e) && (e = Vn), this.qi = setTimeout((() => {
4976
- delete this.Si, delete this.qi;
4976
+ delete this.Mi, delete this.qi;
4977
4977
  }), t + e + 1);
4978
4978
  }
4979
4979
  this.wi = e;
@@ -5087,7 +5087,7 @@ class $n extends gn {
5087
5087
  const {uniquePlacements: o} = n.geometry.properties;
5088
5088
  if (o) for (let t = 0; t < o.length; t++) {
5089
5089
  if (!o[t]) continue;
5090
- const {key: e, index: s} = o[t], a = this.Mi(n), l = Kn(e, i), h = r[l];
5090
+ const {key: e, index: s} = o[t], a = this.Si(n), l = Kn(e, i), h = r[l];
5091
5091
  if (h) {
5092
5092
  const t = h.length, e = h[t - 3].properties.meshKey, i = h[t - 2], r = h[t - 1];
5093
5093
  this.tr[e] = this.tr[e] || {}, this.tr[e][r] = 1, this.er(a, s, i, r), h.push(n, a, s);
@@ -5201,7 +5201,7 @@ function wi(t, e, n, r, s) {
5201
5201
  if (o.markerPerspectiveRatio) {
5202
5202
  g = Lt(.5 + .5 * (1 - (1 - a / y) * o.markerPerspectiveRatio), 0, 4);
5203
5203
  }
5204
- const {aShape: x, aMarkerDx: v, aMarkerDy: b, aMarkerWidth: A, aMarkerHeight: w, aPitchAlign: _, aRotationAlign: M, aRotation: S} = l, T = v ? v[n] : u.markerDx, P = b ? b[n] : u.markerDy, k = _ ? _[n] : o.pitchWithMap, I = M ? M[n] : o.rotateWithMap, O = h.set(vi, T || 0, -(P || 0));
5204
+ const {aShape: x, aMarkerDx: v, aMarkerDy: b, aMarkerWidth: A, aMarkerHeight: w, aPitchAlign: _, aRotationAlign: S, aRotation: M} = l, T = v ? v[n] : u.markerDx, P = b ? b[n] : u.markerDy, k = _ ? _[n] : o.pitchWithMap, I = S ? S[n] : o.rotateWithMap, O = h.set(vi, T || 0, -(P || 0));
5205
5205
  let C = h.set(mi, x[2 * n] / 10, x[2 * n + 1] / 10), F = h.set(yi, x[2 * n + 2] / 10, x[2 * n + 3] / 10), E = h.set(gi, x[2 * n + 4] / 10, x[2 * n + 5] / 10), D = h.set(xi, x[2 * n + 6] / 10, x[2 * n + 7] / 10);
5206
5206
  0 === o.flipY && 1 === k && (h.multiply(C, C, bi), h.multiply(F, F, bi), h.multiply(E, E, bi),
5207
5207
  h.multiply(D, D, bi));
@@ -5212,7 +5212,7 @@ function wi(t, e, n, r, s) {
5212
5212
  Rt(H) && (H = z || 15);
5213
5213
  const N = h.set(Ai, R / hi, H / hi);
5214
5214
  h.mul(C, C, N), h.mul(F, F, N), h.mul(E, E, N), h.mul(D, D, N);
5215
- const V = -(S ? S[n] / 9362 : -(u.markerRotation || 0) * Math.PI / 180), j = s.getBearing() * Math.PI / 180;
5215
+ const V = -(M ? M[n] / 9362 : -(u.markerRotation || 0) * Math.PI / 180), j = s.getBearing() * Math.PI / 180;
5216
5216
  if (j * I || V) {
5217
5217
  const t = li(pi, V, j, I, k);
5218
5218
  C = h.transformMat2(C, C, t), F = h.transformMat2(F, F, t), E = h.transformMat2(E, E, t),
@@ -5224,7 +5224,7 @@ function wi(t, e, n, r, s) {
5224
5224
  return 1 !== U && (t[0] *= U, t[1] *= U, t[2] *= U, t[3] *= U), t;
5225
5225
  }
5226
5226
 
5227
- const _i = 1, Mi = [], Si = [], Ti = [], Pi = [], ki = [], Ii = [], Oi = [ 1, -1 ];
5227
+ const _i = 1, Si = [], Mi = [], Ti = [], Pi = [], ki = [], Ii = [], Oi = [ 1, -1 ];
5228
5228
 
5229
5229
  function Ci(t, e, n, r, s, o, a, l, u) {
5230
5230
  const c = r.material.uniforms, f = u.cameraToCenterDistance, d = r.geometry.properties, p = this.getSymbol(d.symbolIndex), m = "line" === p.textPlacement && !Bt(p), y = ui, g = n[2];
@@ -5232,12 +5232,12 @@ function Ci(t, e, n, r, s, o, a, l, u) {
5232
5232
  if (c.textPerspectiveRatio) {
5233
5233
  x = Lt(.5 + .5 * (1 - (1 - f / g) * c.textPerspectiveRatio), 0, 4);
5234
5234
  }
5235
- const {aTextDx: v, aTextDy: b, aPitchAlign: A, aRotationAlign: w, aRotation: _} = r.geometry.properties, M = v ? v[a] : p.textDx, S = b ? b[a] : p.textDy, T = A ? A[a] : c.pitchWithMap, P = w ? w[a] : c.rotateWithMap, k = h.set(Ii, M || 0, -(S || 0));
5235
+ const {aTextDx: v, aTextDy: b, aPitchAlign: A, aRotationAlign: w, aRotation: _} = r.geometry.properties, S = v ? v[a] : p.textDx, M = b ? b[a] : p.textDy, T = A ? A[a] : c.pitchWithMap, P = w ? w[a] : c.rotateWithMap, k = h.set(Ii, S || 0, -(M || 0));
5236
5236
  if (m) {
5237
5237
  const {aOffset: r, aShape: s} = d, o = r.length !== s.length;
5238
5238
  let f, p, m, y;
5239
- if (o ? (f = i.set(Si, r[3 * a] / 10, r[3 * a + 1] / 10, r[3 * a + 2] / 10), p = i.set(Ti, r[3 * a + 3] / 10, r[3 * a + 4] / 10, r[3 * a + 5] / 10),
5240
- m = i.set(Pi, r[3 * a + 6] / 10, r[3 * a + 7] / 10, r[3 * a + 8] / 10), y = i.set(ki, r[3 * a + 9] / 10, r[3 * a + 10] / 10, r[3 * a + 11] / 10)) : (f = h.set(Si, r[2 * a] / 10, r[2 * a + 1] / 10),
5239
+ if (o ? (f = i.set(Mi, r[3 * a] / 10, r[3 * a + 1] / 10, r[3 * a + 2] / 10), p = i.set(Ti, r[3 * a + 3] / 10, r[3 * a + 4] / 10, r[3 * a + 5] / 10),
5240
+ m = i.set(Pi, r[3 * a + 6] / 10, r[3 * a + 7] / 10, r[3 * a + 8] / 10), y = i.set(ki, r[3 * a + 9] / 10, r[3 * a + 10] / 10, r[3 * a + 11] / 10)) : (f = h.set(Mi, r[2 * a] / 10, r[2 * a + 1] / 10),
5241
5241
  p = h.set(Ti, r[2 * a + 2] / 10, r[2 * a + 3] / 10), m = h.set(Pi, r[2 * a + 4] / 10, r[2 * a + 5] / 10),
5242
5242
  y = h.set(ki, r[2 * a + 6] / 10, r[2 * a + 7] / 10)), 1 === T) {
5243
5243
  const n = ht(u.getResolution(), u);
@@ -5246,12 +5246,12 @@ function Ci(t, e, n, r, s, o, a, l, u) {
5246
5246
  ai(t, n, f, p, m, y, k, x);
5247
5247
  } else {
5248
5248
  const {aShape: i} = d;
5249
- let r = h.set(Si, i[2 * a] / 10, -i[2 * a + 1] / 10), o = h.set(Ti, i[2 * a + 2] / 10, -i[2 * a + 3] / 10), f = h.set(Pi, i[2 * a + 4] / 10, -i[2 * a + 5] / 10), v = h.set(ki, i[2 * a + 6] / 10, -i[2 * a + 7] / 10);
5249
+ let r = h.set(Mi, i[2 * a] / 10, -i[2 * a + 1] / 10), o = h.set(Ti, i[2 * a + 2] / 10, -i[2 * a + 3] / 10), f = h.set(Pi, i[2 * a + 4] / 10, -i[2 * a + 5] / 10), v = h.set(ki, i[2 * a + 6] / 10, -i[2 * a + 7] / 10);
5250
5250
  0 === c.flipY && 1 === T && (h.multiply(r, r, Oi), h.multiply(o, o, Oi), h.multiply(f, f, Oi),
5251
5251
  h.multiply(v, v, Oi));
5252
5252
  const b = _ ? _[a] / 9362 : (p.textRotation || 0) * Math.PI / 180, A = m ? 0 : u.getBearing() * Math.PI / 180;
5253
5253
  if (b || A) {
5254
- const t = li(Mi, b, A, P, T);
5254
+ const t = li(Si, b, A, P, T);
5255
5255
  r = h.transformMat2(r, r, t), o = h.transformMat2(o, o, t), f = h.transformMat2(f, f, t),
5256
5256
  v = h.transformMat2(v, v, t);
5257
5257
  }
@@ -5628,7 +5628,7 @@ function Gi(t, e, n, i, r, s, o) {
5628
5628
  const m = f ? f[n[r]] : e.properties.textHaloRadius, y = Fi(ji, e, n[r]), {aProjectedAnchor: g} = e.geometry.properties;
5629
5629
  let x = Ui;
5630
5630
  const v = 3 * n[r];
5631
- g && g[v] !== Mt ? (Ui[0] = g[v], Ui[1] = g[v + 1], Ui[2] = g[v + 2]) : x = Xe(Ui, y, o, a.width, a.height);
5631
+ g && g[v] !== St ? (Ui[0] = g[v], Ui[1] = g[v + 1], Ui[2] = g[v + 2]) : x = Xe(Ui, y, o, a.width, a.height);
5632
5632
  const b = i, {boxes: A, collision: w} = this.nr(e, r);
5633
5633
  let _ = 0;
5634
5634
  if (u || 1 === e.material.uniforms.rotateWithMap || h.textRotation) {
@@ -5959,24 +5959,24 @@ function rr(t, e) {
5959
5959
  w = (A.textSizeFn = A.textSizeFn || N(w))(u, A);
5960
5960
  }
5961
5961
  w /= ui;
5962
- let _, M, S = h && h(u, A) || l;
5963
- if (H(S)) {
5964
- S = (A.fitPaddingFn = A.fitPaddingFn || V(S))(u, A);
5962
+ let _, S, M = h && h(u, A) || l;
5963
+ if (H(M)) {
5964
+ M = (A.fitPaddingFn = A.fitPaddingFn || V(M))(u, A);
5965
5965
  }
5966
- if (S = S || ir, S[0] === S[2] && S[1] === S[3] || (_ = r.aPadOffsetX, M = r.aPadOffsetY,
5967
- _ || (_ = r.aPadOffsetX = new Int8Array(p.length), M = r.aPadOffsetY = new Int8Array(p.length))),
5966
+ if (M = M || ir, M[0] === M[2] && M[1] === M[3] || (_ = r.aPadOffsetX, S = r.aPadOffsetY,
5967
+ _ || (_ = r.aPadOffsetX = new Int8Array(p.length), S = r.aPadOffsetY = new Int8Array(p.length))),
5968
5968
  p && n) {
5969
- const e = Math.abs((f - s) / 10 * w) + (S[1] + S[3] || 0);
5969
+ const e = Math.abs((f - s) / 10 * w) + (M[1] + M[3] || 0);
5970
5970
  if (Ji[0] = e, p[t] !== Ji[0] && (Wt(p, Ji[0], t, t + Ki), p.dirty = !0), _) {
5971
- const e = (S[1] + S[3]) / 2 - S[3];
5971
+ const e = (M[1] + M[3]) / 2 - M[3];
5972
5972
  Zi[0] = e, _[t] !== Zi[0] && (Wt(_, e, t, t + Ki), _.dirty = !0);
5973
5973
  }
5974
5974
  }
5975
5975
  if (m && i) {
5976
- const e = Math.abs((d - c) / 10 * w) + (S[0] + S[2] || 0);
5977
- if (Ji[0] = e, m[t] !== Ji[0] && (Wt(m, Ji[0], t, t + Ki), m.dirty = !0), M) {
5978
- const e = S[0] - (S[0] + S[2]) / 2;
5979
- Zi[0] = e, M[t] !== Zi[0] && (Wt(M, e, t, t + Ki), M.dirty = !0);
5976
+ const e = Math.abs((d - c) / 10 * w) + (M[0] + M[2] || 0);
5977
+ if (Ji[0] = e, m[t] !== Ji[0] && (Wt(m, Ji[0], t, t + Ki), m.dirty = !0), S) {
5978
+ const e = M[0] - (M[0] + M[2]) / 2;
5979
+ Zi[0] = e, S[t] !== Zi[0] && (Wt(S, e, t, t + Ki), S.dirty = !0);
5980
5980
  }
5981
5981
  }
5982
5982
  };
@@ -6240,7 +6240,7 @@ class pr extends $n {
6240
6240
  const s = e.isForeground(i.meshes[0]);
6241
6241
  if (this.shouldIgnoreBackground() && !s) continue;
6242
6242
  const o = i.properties.meshKey;
6243
- this.startMeshCollision(i), this.Mr(i), this.forEachBox(i, this._r), this.Sr(i),
6243
+ this.startMeshCollision(i), this.Sr(i), this.forEachBox(i, this._r), this.Mr(i),
6244
6244
  this.endMeshCollision(o);
6245
6245
  for (let t = 0; t < i.meshes.length; t++) this.Tr(i.meshes[t]);
6246
6246
  }
@@ -6288,7 +6288,7 @@ class pr extends $n {
6288
6288
  if (!h) return !1;
6289
6289
  return n.call(this, t, l, a, i.boxIndex++) && this.kr(t, e), !0;
6290
6290
  }
6291
- Mr(t) {
6291
+ Sr(t) {
6292
6292
  const e = t.meshes;
6293
6293
  for (let t = 0; t < e.length; t++) {
6294
6294
  const n = e[t], i = n && n.geometry;
@@ -6310,7 +6310,7 @@ class pr extends $n {
6310
6310
  a.count = c;
6311
6311
  }
6312
6312
  }
6313
- Sr(t) {
6313
+ Mr(t) {
6314
6314
  const e = t.meshes;
6315
6315
  for (let t = 0; t < e.length; t++) {
6316
6316
  const n = e[t], i = n && n.geometry;
@@ -6324,7 +6324,7 @@ class pr extends $n {
6324
6324
  if (t.geometry.properties.isEmpty) return ur;
6325
6325
  const {aTerrainAltitude: o} = t.geometry.properties;
6326
6326
  if (o) {
6327
- if (o[2 * e[i]] === St) return ur;
6327
+ if (o[2 * e[i]] === Mt) return ur;
6328
6328
  }
6329
6329
  const a = this.getMap(), {boxes: l, collision: h} = this.nr(t, i);
6330
6330
  let u = 0, c = 0, f = 0;
@@ -6483,19 +6483,19 @@ function mr(t, e) {
6483
6483
  const yr = [], gr = [], xr = [];
6484
6484
 
6485
6485
  function vr(t, e, n, r, s, o, a, l, u, c, f, d, p) {
6486
- const {aGlyphOffset: m, aSegment: y, aTextDx: g, aTextDy: x, symbolIndex: v} = e.geometry.properties, b = this.getSymbol(v), A = g ? g[s] : b.textDx, w = x ? x[s] : b.textDy, _ = h.set(xr, A || 0, w || 0), M = h.set(yr, m[2 * s], m[2 * s + 1]), S = i.set(gr, y[3 * s], y[3 * s + 1], y[3 * s + 2]), T = function(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m, y, g) {
6486
+ const {aGlyphOffset: m, aSegment: y, aTextDx: g, aTextDy: x, symbolIndex: v} = e.geometry.properties, b = this.getSymbol(v), A = g ? g[s] : b.textDx, w = x ? x[s] : b.textDy, _ = h.set(xr, A || 0, w || 0), S = h.set(yr, m[2 * s], m[2 * s + 1]), M = i.set(gr, y[3 * s], y[3 * s + 1], y[3 * s + 2]), T = function(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m, y, g) {
6487
6487
  p || (p = i);
6488
6488
  const x = e.geometry.properties.line, v = s[0] * c, b = f ? v - o : v + o;
6489
6489
  let A = b > 0 ? 1 : -1, w = 0;
6490
6490
  f && (A *= -1, w = Math.PI), A < 0 && (w += Math.PI);
6491
- const _ = h + u, M = Math.abs(b);
6492
- let S = A > 0 ? l : l + 1, T = Ye.convert(i), P = Ye.convert(i), k = Ye.convert(r), I = Ye.convert(r), O = 0, C = 0;
6493
- for (;O + C <= M; ) {
6494
- if (S += A, S < h || S >= _) return null;
6495
- P.x = T.x, P.y = T.y, I.x = k.x, I.y = k.y, T.x = n[3 * S], T.y = n[3 * S + 1],
6496
- k.x = x[3 * S], k.y = x[3 * S + 1], O += C, C = P.dist(T) / d;
6497
- }
6498
- const F = (M - O) / C, E = m && m.getRenderer(), D = E && E.getTerrainHelper(), L = e.properties.tile.terrainTileInfos;
6491
+ const _ = h + u, S = Math.abs(b);
6492
+ let M = A > 0 ? l : l + 1, T = Ye.convert(i), P = Ye.convert(i), k = Ye.convert(r), I = Ye.convert(r), O = 0, C = 0;
6493
+ for (;O + C <= S; ) {
6494
+ if (M += A, M < h || M >= _) return null;
6495
+ P.x = T.x, P.y = T.y, I.x = k.x, I.y = k.y, T.x = n[3 * M], T.y = n[3 * M + 1],
6496
+ k.x = x[3 * M], k.y = x[3 * M + 1], O += C, C = P.dist(T) / d;
6497
+ }
6498
+ const F = (S - O) / C, E = m && m.getRenderer(), D = E && E.getTerrainHelper(), L = e.properties.tile.terrainTileInfos;
6499
6499
  if (!g && D) {
6500
6500
  const {extent: n} = e.properties.tile, i = m.getTileSize().width / n, r = m.getMap();
6501
6501
  let s = k.sub(I).mult(F).rn(I);
@@ -6507,7 +6507,7 @@ function vr(t, e, n, r, s, o, a, l, u, c, f, d, p) {
6507
6507
  R.rn(z.mn().yn().hn(a * A));
6508
6508
  const H = w + Math.atan2(T.y - P.y, T.x - P.x);
6509
6509
  return t[0] = (R.x - i[0]) / d, t[1] = (R.y - i[1]) / d, t[2] = H, t;
6510
- }(t, e, r, o, a, M, _[0], _[1], S[0], S[1], S[2], n / 24, u, l, c, f, d, p);
6510
+ }(t, e, r, o, a, S, _[0], _[1], M[0], M[1], M[2], n / 24, u, l, c, f, d, p);
6511
6511
  return T;
6512
6512
  }
6513
6513
 
@@ -6528,10 +6528,10 @@ function wr(t, e, n, r, s, o, a, l, u, c, f, d) {
6528
6528
 
6529
6529
  var _r = "#define SHADER_NAME TEXT_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aTexCoord;\n#ifdef HAS_OFFSET_Z\nattribute vec3 aOffset;\nuniform float altitudeScale;\n#else\nattribute vec2 aOffset;\n#endif\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;\nuniform float isRenderingTerrain;\nuniform float textPitchFilter;\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#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\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;\n if(isRenderingTerrain == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_OFFSET_Z\nvec3 m = aOffset / 10.0;\n m[2] /= altitudeScale;\n#else\nvec3 m = vec3(aOffset / 10.0, .0);\n#endif\nvec2 n = aTexCoord;\n if(h == 1.) {\n float o;\n if(isRenderingTerrain == 1.) {\n o = tileRatio;\n } else {\n o = tileRatio / zoomScale * j * k;\n }\n m.xy *= o;\n gl_Position = projViewModelMatrix * vec4(c + m, 1.);\n } else {\n gl_Position.xy += m.xy * 2. / canvasSize * k * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n if(textPitchFilter > .0) {\n if(textPitchFilter == 1. && h == .0 || textPitchFilter == 2. && h == 1.) {\n gl_Position = vec4(-9999., -9999., .0, 1.);\n }\n }\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\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool u = aOpacity == 255.;\n#else\nbool u = true;\n#endif\nfbo_picking_setData(gl_Position.w, u);\n#endif\n}";
6530
6530
 
6531
- const Mr = function(t) {
6531
+ const Sr = function(t) {
6532
6532
  const e = this.layer.getRenderer();
6533
6533
  return !this.sr(t) && e.isTileNearCamera(t) && "line" !== t.geometry.properties.textPlacement;
6534
- }, Sr = function(t) {
6534
+ }, Mr = function(t) {
6535
6535
  const e = this.layer.getRenderer();
6536
6536
  return !this.sr(t) && !e.isForeground(t) && "line" !== t.geometry.properties.textPlacement;
6537
6537
  }, Tr = function(t) {
@@ -6548,7 +6548,7 @@ class Qr extends $n {
6548
6548
  }
6549
6549
  constructor(t, e, n, i, r, s) {
6550
6550
  super(t, e, n, i, r, s), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
6551
- this.colorCache = {}, this.Ir = Mr.bind(this), this.Or = Sr.bind(this), this.Cr = Tr.bind(this),
6551
+ this.colorCache = {}, this.Ir = Sr.bind(this), this.Or = Mr.bind(this), this.Cr = Tr.bind(this),
6552
6552
  this.Fr = Pr.bind(this), this.isLabelCollides = Gi.bind(this), this.Er();
6553
6553
  }
6554
6554
  prepareRender(...t) {
@@ -6754,22 +6754,22 @@ class Qr extends $n {
6754
6754
  }
6755
6755
  }
6756
6756
  Wr(t, e, n, s, o, l, u) {
6757
- const f = this.layer.getRenderer(), d = t.material.uniforms, p = 1 === d.pitchWithMap, m = !p && f.getTerrainHelper && f.getTerrainHelper(), y = this.isEnableCollision(), g = this.getMap(), v = t.geometry, b = v.desc.positionSize, {aShape: A, aOffset: w, aAnchor: _, aAltitude: M, aPitchRotation: S} = v.properties;
6757
+ const f = this.layer.getRenderer(), d = t.material.uniforms, p = 1 === d.pitchWithMap, m = !p && f.getTerrainHelper && f.getTerrainHelper(), y = this.isEnableCollision(), g = this.getMap(), v = t.geometry, b = v.desc.positionSize, {aShape: A, aOffset: w, aAnchor: _, aAltitude: S, aPitchRotation: M} = v.properties;
6758
6758
  let {aProjectedAnchor: T} = v.properties;
6759
6759
  T || (T = v.properties.aProjectedAnchor = new Array(_.length / b * 3));
6760
6760
  const P = v.properties.aTextSize, k = !u, I = e[n], O = I * b;
6761
6761
  let C;
6762
- C = v.data.aAltitude ? i.set(Fr, _[O], _[O + 1], M[I]) : x.unpackPosition(Fr, _[O], _[O + 1], _[O + 2]);
6762
+ C = v.data.aAltitude ? i.set(Fr, _[O], _[O + 1], S[I]) : x.unpackPosition(Fr, _[O], _[O + 1], _[O + 2]);
6763
6763
  const F = Xe(Er, C, l, g.width, g.height), E = v.properties.aTerrainAltitude;
6764
6764
  let D;
6765
6765
  if (E) {
6766
6766
  const t = E[I];
6767
- if (t === St) return T[3 * I] = Mt, T[3 * I + 1] = Mt, T[3 * I + 2] = Mt, !1;
6767
+ if (t === Mt) return T[3 * I] = St, T[3 * I + 1] = St, T[3 * I + 2] = St, !1;
6768
6768
  t ? (D = i.set(Kr, ...C), D[2] = 100 * t, D = Xe(D, D, l, g.width, g.height)) : D = F;
6769
6769
  } else D = F;
6770
6770
  const L = g.getDevicePixelRatio();
6771
- if (a.scale(Zr, D, 1 / L), g.isOffscreen(Zr)) return y || ts(w, e, n, s), T[3 * I] = Mt,
6772
- T[3 * I + 1] = Mt, T[3 * I + 2] = Mt, !1;
6771
+ if (a.scale(Zr, D, 1 / L), g.isOffscreen(Zr)) return y || ts(w, e, n, s), T[3 * I] = St,
6772
+ T[3 * I + 1] = St, T[3 * I + 2] = St, !1;
6773
6773
  k && (C = F), T[3 * I] = D[0], T[3 * I + 1] = D[1], T[3 * I + 2] = D[2];
6774
6774
  const z = k ? 1 : v.properties.tileExtent / this.layer.getTileSize().width;
6775
6775
  let R = !0;
@@ -6789,8 +6789,8 @@ class Qr extends $n {
6789
6789
  const x = li(Dr, g, 0, d.rotateWithMap, d.pitchWithMap), v = w.length > A.length;
6790
6790
  let b;
6791
6791
  if (v) {
6792
- i.set(Ur, S[3 * u], S[3 * u + 1], 0);
6793
- const t = i.normalize(Ur, Ur), e = -S[3 * u + 2];
6792
+ i.set(Ur, M[3 * u], M[3 * u + 1], 0);
6793
+ const t = i.normalize(Ur, Ur), e = -M[3 * u + 2];
6794
6794
  if (e) {
6795
6795
  const n = c.setAxisAngle(Nr, t, e);
6796
6796
  r.fromTranslation(Vr, kr), r.fromQuat(jr, n), b = r.multiply(jr, jr, Vr);
@@ -7245,7 +7245,7 @@ class gs extends pn {
7245
7245
  f && (c = this.getUVOffset(f));
7246
7246
  const d = a && a.uvScale || cs;
7247
7247
  let p = this.dataConfig.side ? 0 : l[0], m = this.dataConfig.side ? 0 : l[1];
7248
- const y = a && a.textureWidth || M, g = y * d[1] / d[0];
7248
+ const y = a && a.textureWidth || S, g = y * d[1] / d[0];
7249
7249
  u && (p += c[0] / r, m += c[1] / r);
7250
7250
  const x = u ? 0 : c[0], v = u ? 0 : c[1], b = h.set(t, p * r * d[0] / y + x, m * r * d[1] / g + v);
7251
7251
  return s || (b[1] *= -1), b;
@@ -7584,7 +7584,7 @@ class ws extends pn {
7584
7584
 
7585
7585
  const {getPBRUniforms: _s} = n.pbr.PBRUtils;
7586
7586
 
7587
- class Ms extends gs {
7587
+ class Ss extends gs {
7588
7588
  constructor(...t) {
7589
7589
  super(...t), this.Zr = new n.ResourceLoader(null, this.layer.getURLModifier()),
7590
7590
  this.scene.sortFunction = this.sortByCommandKey;
@@ -7773,7 +7773,7 @@ class Ms extends gs {
7773
7773
  }
7774
7774
  }
7775
7775
 
7776
- var Ss = "#include <gl2_vert>\n#define EXTRUDE_SCALE 63.0\n#define EXTRUDE_MOD 64.0\n#define MAX_LINE_DISTANCE 65535.0\nuniform mat4 projViewModelMatrix;\nuniform vec2 centiMeterToLocal;\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aTubeNormal;\n#ifdef HAS_LINE_WIDTH\nattribute float aLineWidth;\n#else\nuniform float lineWidth;\n#endif\n#include <vt_position_vert>\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#else\nuniform mat4 modelViewMatrix;\nuniform mat3 modelNormalMatrix;\nuniform mat4 modelMatrix;\n#if defined(HAS_PATTERN)\nuniform float resolution;\nuniform float tileResolution;\nuniform float tileRatio;\nattribute float aLinesofar;\nvarying highp float vLinesofar;\nattribute vec4 aTexInfo;\nvarying vec4 vTexInfo;\nvarying float vNormalY;\nvarying float vPatternHeight;\nattribute float aNormalDistance;\n#if defined(HAS_PATTERN_ANIM)\nattribute float aLinePatternAnimSpeed;\nvarying float vLinePatternAnimSpeed;\n#endif\n#if defined(HAS_PATTERN_GAP)\nattribute float aLinePatternGap;\nvarying float vLinePatternGap;\n#endif\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#ifdef HAS_OPACITY\nattribute float aOpacity;\n#endif\nvarying float vOpacity;\nvarying vec3 vModelNormal;\nvarying vec4 vViewVertex;\nvarying vec3 vModelVertex;\n#endif\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_vert>\n#endif\n#include <highlight_vert>\nvoid main() {\n \n#ifdef HAS_LINE_WIDTH\nfloat c = aLineWidth;\n#else\nfloat c = lineWidth;\n#endif\nfloat d = c / 2.;\n vec3 e = aTubeNormal.xyz / EXTRUDE_SCALE;\n vec3 f = unpackVTPosition();\n vec4 h = vec4(f, 1.);\n h.xy += e.xy * d * centiMeterToLocal;\n h.z += e.z * d;\n gl_Position = projViewModelMatrix * h;\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#else\nvViewVertex = modelViewMatrix * h;\n vec3 i = normalize(e);\n vModelNormal = modelNormalMatrix * i;\n vModelVertex = (modelMatrix * h).xyz;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nshadow_computeShadowPars(h);\n#endif\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_PATTERN\nfloat j = tileResolution / resolution;\n float k = aLinesofar - d * centiMeterToLocal.y * aNormalDistance / EXTRUDE_SCALE;\n vLinesofar = k / tileRatio * j;\n vTexInfo = vec4(aTexInfo.xy, aTexInfo.zw + 1.);\n vPatternHeight = c * centiMeterToLocal.x / tileRatio * j;\n vNormalY = aTubeNormal.w / EXTRUDE_SCALE;\n#if defined(HAS_PATTERN_ANIM)\nvLinePatternAnimSpeed = aLinePatternAnimSpeed / 127.;\n#endif\n#if defined(HAS_PATTERN_GAP)\nvLinePatternGap = aLinePatternGap / 10.0;\n#endif\n#endif\nhighlight_setVarying();\n#endif\n}";
7776
+ var Ms = "#include <gl2_vert>\n#define EXTRUDE_SCALE 63.0\n#define EXTRUDE_MOD 64.0\n#define MAX_LINE_DISTANCE 65535.0\nuniform mat4 projViewModelMatrix;\nuniform vec2 centiMeterToLocal;\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aTubeNormal;\n#ifdef HAS_LINE_WIDTH\nattribute float aLineWidth;\n#else\nuniform float lineWidth;\n#endif\n#include <vt_position_vert>\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#else\nuniform mat4 modelViewMatrix;\nuniform mat3 modelNormalMatrix;\nuniform mat4 modelMatrix;\n#if defined(HAS_PATTERN)\nuniform float resolution;\nuniform float tileResolution;\nuniform float tileRatio;\nattribute float aLinesofar;\nvarying highp float vLinesofar;\nattribute vec4 aTexInfo;\nvarying vec4 vTexInfo;\nvarying float vNormalY;\nvarying float vPatternHeight;\nattribute float aNormalDistance;\n#if defined(HAS_PATTERN_ANIM)\nattribute float aLinePatternAnimSpeed;\nvarying float vLinePatternAnimSpeed;\n#endif\n#if defined(HAS_PATTERN_GAP)\nattribute float aLinePatternGap;\nvarying float vLinePatternGap;\n#endif\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#ifdef HAS_OPACITY\nattribute float aOpacity;\n#endif\nvarying float vOpacity;\nvarying vec3 vModelNormal;\nvarying vec4 vViewVertex;\nvarying vec3 vModelVertex;\n#endif\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_vert>\n#endif\n#include <highlight_vert>\nvoid main() {\n \n#ifdef HAS_LINE_WIDTH\nfloat c = aLineWidth;\n#else\nfloat c = lineWidth;\n#endif\nfloat d = c / 2.;\n vec3 e = aTubeNormal.xyz / EXTRUDE_SCALE;\n vec3 f = unpackVTPosition();\n vec4 h = vec4(f, 1.);\n h.xy += e.xy * d * centiMeterToLocal;\n h.z += e.z * d;\n gl_Position = projViewModelMatrix * h;\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#else\nvViewVertex = modelViewMatrix * h;\n vec3 i = normalize(e);\n vModelNormal = modelNormalMatrix * i;\n vModelVertex = (modelMatrix * h).xyz;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nshadow_computeShadowPars(h);\n#endif\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_PATTERN\nfloat j = tileResolution / resolution;\n float k = aLinesofar - d * centiMeterToLocal.y * aNormalDistance / EXTRUDE_SCALE;\n vLinesofar = k / tileRatio * j;\n vTexInfo = vec4(aTexInfo.xy, aTexInfo.zw + 1.);\n vPatternHeight = c * centiMeterToLocal.x / tileRatio * j;\n vNormalY = aTubeNormal.w / EXTRUDE_SCALE;\n#if defined(HAS_PATTERN_ANIM)\nvLinePatternAnimSpeed = aLinePatternAnimSpeed / 127.;\n#endif\n#if defined(HAS_PATTERN_GAP)\nvLinePatternGap = aLinePatternGap / 10.0;\n#endif\n#endif\nhighlight_setVarying();\n#endif\n}";
7777
7777
 
7778
7778
  const {getPBRUniforms: Ts} = n.pbr.PBRUtils;
7779
7779
 
@@ -7851,7 +7851,7 @@ class Ps extends gn {
7851
7851
  if (this.renderer = new n.Renderer(e), this.createShader(t), this.pickingFBO) {
7852
7852
  const t = [];
7853
7853
  this.picking = [ new n.FBORayPicking(this.renderer, {
7854
- vert: "#define PICKING_MODE 1\n" + Ss,
7854
+ vert: "#define PICKING_MODE 1\n" + Ms,
7855
7855
  uniforms: [ {
7856
7856
  name: "projViewModelMatrix",
7857
7857
  type: "function",
@@ -7879,7 +7879,7 @@ class Ps extends gn {
7879
7879
  return r.multiply(n, e.projViewMatrix, e.modelMatrix), n;
7880
7880
  }
7881
7881
  }), this.shader = new n.pbr.StandardShader({
7882
- vert: Ss,
7882
+ vert: Ms,
7883
7883
  uniforms: e,
7884
7884
  defines: this.us(i),
7885
7885
  extraCommandProps: this.getExtraCommandProps()
@@ -8068,9 +8068,9 @@ const ks = [], Is = [], Os = [], Cs = [], Fs = [], Es = [ 0, 0, 0 ], Ds = [ 0, 0
8068
8068
  };
8069
8069
  const A = this.vs(), w = this.bs(), _ = r.identity([]);
8070
8070
  r.scale(_, _, [ w, w, w ]);
8071
- const M = [], S = this.getSymbols();
8072
- for (let t = 0; t < S.length; t++) {
8073
- const e = S[t], o = this.As[t];
8071
+ const S = [], M = this.getSymbols();
8072
+ for (let t = 0; t < M.length; t++) {
8073
+ const e = M[t], o = this.As[t];
8074
8074
  if (!o) continue;
8075
8075
  const u = this.ys[t][0], {fixSizeOnZoom: c} = e;
8076
8076
  let f = r.identity([]);
@@ -8085,23 +8085,23 @@ const ks = [], Is = [], Os = [], Cs = [], Fs = [], Es = [ 0, 0, 0 ], Ds = [ 0, 0
8085
8085
  Math.abs(a) > Math.abs(d) && (d = a);
8086
8086
  }));
8087
8087
  const p = [ 0, 0, d ], m = o.map(((o, m) => {
8088
- const {geometry: y, materialInfo: A, morphWeights: w, extraInfo: M, nodeIndex: S} = o;
8088
+ const {geometry: y, materialInfo: A, morphWeights: w, extraInfo: S, nodeIndex: M} = o;
8089
8089
  e.alphaTest && (A.alphaTest = e.alphaTest);
8090
8090
  const T = new (this.getMaterialClazz(A))(A), P = {}, k = new n.InstancedMesh(b, g, y, T, {
8091
8091
  transparent: !1,
8092
8092
  picking: !0
8093
8093
  });
8094
8094
  if (u.hasSkinAnimation()) {
8095
- const e = this.Ms(k, t, 0)[S];
8095
+ const e = this.Ss(k, t, 0)[M];
8096
8096
  k.setUniform("jointTexture", e.jointTexture), k.setUniform("jointTextureSize", e.jointTextureSize),
8097
8097
  k.setUniform("numJoints", e.numJoints), k.setUniform("skinAnimation", +this.gs(t)),
8098
8098
  k.properties.startTime = a, P.HAS_SKIN = 1;
8099
8099
  }
8100
- w && (k.setUniform("morphWeights", w), P.HAS_MORPH = 1), k.setUniform("hasAlpha", M.alphaMode && "BLEND" === M.alphaMode.toUpperCase()),
8100
+ w && (k.setUniform("morphWeights", w), P.HAS_MORPH = 1), k.setUniform("hasAlpha", S.alphaMode && "BLEND" === S.alphaMode.toUpperCase()),
8101
8101
  Nt(k.uniforms, "polygonFill", e, "markerFill", Rs, Ut(this.colorCache)), Nt(k.uniforms, "polygonOpacity", e, "markerOpacity", 1);
8102
8102
  const I = [];
8103
8103
  k.setPositionMatrix((() => {
8104
- const e = this.Ss(t, m, S);
8104
+ const e = this.Ms(t, m, M);
8105
8105
  r.multiply(I, Ns, e), r.multiply(I, f, I), r.multiply(I, _, I);
8106
8106
  const n = r.identity(Hs);
8107
8107
  if (0 !== d && (r.fromTranslation(n, p), r.multiply(I, n, I)), Yt(c)) {
@@ -8122,21 +8122,21 @@ const ks = [], Is = [], Os = [], Cs = [], Fs = [], Es = [ 0, 0, 0 ], Ds = [ 0, 0
8122
8122
  index: t
8123
8123
  }, k;
8124
8124
  }));
8125
- M.push(...m);
8125
+ S.push(...m);
8126
8126
  }
8127
- return M.insContext = {
8127
+ return S.insContext = {
8128
8128
  instanceData: x,
8129
8129
  tileTranslationMatrix: s,
8130
8130
  tileExtent: o,
8131
8131
  aPosition: f,
8132
8132
  positionSize: u
8133
- }, M;
8133
+ }, S;
8134
8134
  }
8135
- Ss(t, e, n) {
8135
+ Ms(t, e, n) {
8136
8136
  const i = t, r = this.As[i][e];
8137
8137
  return this.gs(t) && this.Ts && this.Ts[n] || r.nodeMatrix;
8138
8138
  }
8139
- Ms(t, e, n) {
8139
+ Ss(t, e, n) {
8140
8140
  if (!this.ys) return;
8141
8141
  const i = this.ys[e][0];
8142
8142
  this.Ps || (this.Ps = {}), this.Ts = {}, this.Ps[t.uuid] || (this.Ps[t.uuid] = {});
@@ -8156,9 +8156,9 @@ const ks = [], Is = [], Os = [], Cs = [], Fs = [], Es = [ 0, 0, 0 ], Ds = [ 0, 0
8156
8156
  const i = n.timestamp;
8157
8157
  for (let e = 0; e < t.length; e++) {
8158
8158
  if (!t[e] || !t[e].geometry) continue;
8159
- t[e].instancedData.aTerrainAltitude && this.Sn(t[e], t[e].instancedData, t[e].properties, 3, n);
8159
+ t[e].instancedData.aTerrainAltitude && this.Mn(t[e], t[e].instancedData, t[e].properties, 3, n);
8160
8160
  const r = t[e].properties.symbolIndex.index, s = this.gs(r);
8161
- s && this.Ms(t[e], r, i), t[e].setUniform("skinAnimation", +s);
8161
+ s && this.Ss(t[e], r, i), t[e].setUniform("skinAnimation", +s);
8162
8162
  }
8163
8163
  return this.scene.addMesh(t), this;
8164
8164
  }
@@ -8191,18 +8191,18 @@ const ks = [], Is = [], Os = [], Cs = [], Fs = [], Es = [ 0, 0, 0 ], Ds = [ 0, 0
8191
8191
  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];
8192
8192
  }
8193
8193
  const p = o.length / u, m = this.layer.getTileSize().width / n * this.layer.getRenderer().getTileGLScale(s), y = this.layer.getRenderer().getZScale(), g = 100 * (this.dataConfig.altitudeOffset || 0);
8194
- let v = 1 / 0, b = 1 / 0, A = 1 / 0, w = -1 / 0, _ = -1 / 0, M = -1 / 0;
8195
- const S = [], T = [];
8194
+ let v = 1 / 0, b = 1 / 0, A = 1 / 0, w = -1 / 0, _ = -1 / 0, S = -1 / 0;
8195
+ const M = [], T = [];
8196
8196
  for (let t = 0; t < p; t++) {
8197
8197
  a ? i.set(T, o[t * u], o[t * u + 1], a[t]) : x.unpackPosition(T, o[t * u], o[t * u + 1], o[t * u + 2]);
8198
- const e = i.set(S, T[0] * m, -T[1] * m, (T[2] + g) * y);
8198
+ const e = i.set(M, T[0] * m, -T[1] * m, (T[2] + g) * y);
8199
8199
  e[0] < v && (v = e[0]), e[0] > w && (w = e[0]), e[1] < b && (b = e[1]), e[1] > _ && (_ = e[1]),
8200
- e[2] < A && (A = e[2]), e[2] > M && (M = e[2]);
8200
+ e[2] < A && (A = e[2]), e[2] > S && (S = e[2]);
8201
8201
  }
8202
- const P = (v + w) / 2, k = (b + _) / 2, I = (A + M) / 2, O = [], C = this.vs(), F = [ 0, 0, 1 ];
8202
+ const P = (v + w) / 2, k = (b + _) / 2, I = (A + S) / 2, O = [], C = this.vs(), F = [ 0, 0, 1 ];
8203
8203
  for (let e = 0; e < p; e++) {
8204
8204
  a ? i.set(T, o[e * u], o[e * u + 1], a[e]) : x.unpackPosition(T, o[e * u], o[e * u + 1], o[e * u + 2]);
8205
- const n = T[0], s = T[1], p = i.set(S, n * m - P, -s * m - k, (T[2] + g) * y - I), v = l && l[e] || 0, b = h && h[e] || 0;
8205
+ const n = T[0], s = T[1], p = i.set(M, n * m - P, -s * m - k, (T[2] + g) * y - I), v = l && l[e] || 0, b = h && h[e] || 0;
8206
8206
  if (v || b) {
8207
8207
  r.fromRotation(O, b, F);
8208
8208
  const t = i.set(ks, n, s, 0), e = i.normalize(t, i.cross(t, t, F));
@@ -8217,7 +8217,7 @@ const ks = [], Is = [], Os = [], Cs = [], Fs = [], Es = [ 0, 0, 0 ], Ds = [ 0, 0
8217
8217
  d("instance_vectorA", e, O, 0), d("instance_vectorB", e, O, 1), d("instance_vectorC", e, O, 2),
8218
8218
  t.aPickingId[e] = e;
8219
8219
  }
8220
- return i.set(S, P, k, I), S;
8220
+ return i.set(M, P, k, I), M;
8221
8221
  }
8222
8222
  bs() {
8223
8223
  if (!this.Is) {
@@ -8235,8 +8235,8 @@ const ks = [], Is = [], Os = [], Cs = [], Fs = [], Es = [ 0, 0, 0 ], Ds = [ 0, 0
8235
8235
  this.Ds && (c = this.Ds(v, b)), this.Ls && (f = this.Ls(v, b)), this.zs && (d = this.zs(v, b));
8236
8236
  const _ = i.set(Os, c, f, d);
8237
8237
  this.Rs && (p = this.Rs(v, b)), this.Hs && (m = this.Hs(v, b)), this.Ns && (y = this.Ns(v, b));
8238
- const M = i.set(Cs, p * A, m * A, y * A);
8239
- return this.Vs(t, w, _, M);
8238
+ const S = i.set(Cs, p * A, m * A, y * A);
8239
+ return this.Vs(t, w, _, S);
8240
8240
  }
8241
8241
  Os(t, e) {
8242
8242
  const n = this.symbolDef[0];
@@ -8329,7 +8329,7 @@ class js extends(Vs(bs)){
8329
8329
  }
8330
8330
  }
8331
8331
 
8332
- class Us extends(Vs(Ms)){
8332
+ class Us extends(Vs(Ss)){
8333
8333
  getMaterialClazz(t) {
8334
8334
  return t.specularGlossinessTexture || t.diffuseTexture ? n.pbr.StandardSpecularGlossinessMaterial : n.pbr.StandardMaterial;
8335
8335
  }
@@ -8644,7 +8644,7 @@ const ro = Te("wireframe", ws);
8644
8644
 
8645
8645
  ro.registerAt(pe);
8646
8646
 
8647
- const so = Te("lit", Ms);
8647
+ const so = Te("lit", Ss);
8648
8648
 
8649
8649
  so.registerAt(pe);
8650
8650
 
@@ -8728,7 +8728,7 @@ ho.registerAt(pe);
8728
8728
 
8729
8729
  const uo = Te("water", qs);
8730
8730
 
8731
- uo.registerAt(pe), we.registerPainter("lit", Ms), we.registerPainter("icon", pr),
8731
+ uo.registerAt(pe), we.registerPainter("lit", Ss), we.registerPainter("icon", pr),
8732
8732
  we.registerPainter("fill", On), we.registerPainter("line", Dn), we.registerPainter("line-gradient", Ln),
8733
8733
  we.registerPainter("water", qs), we.registerPainter("tube", Ps);
8734
8734
 
@@ -9219,7 +9219,7 @@ const go = {
9219
9219
  }
9220
9220
  }, bo = "_line_gradient_property", Ao = new t.Point(0, 0), wo = "_vector3dlayer_id", _o = (bo + "").trim();
9221
9221
 
9222
- function Mo(e, n, i) {
9222
+ function So(e, n, i) {
9223
9223
  const r = (_t + "").trim(), s = e.getMap(), o = s.getGLRes();
9224
9224
  let a = e.getCoordinates();
9225
9225
  const l = [], h = [];
@@ -9269,7 +9269,7 @@ function Mo(e, n, i) {
9269
9269
  if (Array.isArray(f) && f.length) {
9270
9270
  const t = [], s = f.length;
9271
9271
  for (let o = 0; o < s; o++) {
9272
- const a = o === s - 1 ? c : tt({}, c), p = So(f[o], a);
9272
+ const a = o === s - 1 ? c : tt({}, c), p = Mo(f[o], a);
9273
9273
  for (const t in f[o]) if (lt(f[o], t)) {
9274
9274
  a[("_symbol_" + t).trim()] = f[o][t];
9275
9275
  }
@@ -9288,7 +9288,7 @@ function Mo(e, n, i) {
9288
9288
  return t;
9289
9289
  }
9290
9290
  if (f) {
9291
- const t = So(f, c);
9291
+ const t = Mo(f, c);
9292
9292
  for (const t in f) if (lt(f, t)) {
9293
9293
  c[("_symbol_" + t).trim()] = f[t];
9294
9294
  }
@@ -9306,7 +9306,7 @@ function Mo(e, n, i) {
9306
9306
  return m[r] = p, m;
9307
9307
  }
9308
9308
 
9309
- function So(t, e) {
9309
+ function Mo(t, e) {
9310
9310
  const n = t.lineGradientProperty;
9311
9311
  return n && (e[_o] = e[n], e.mapbox_clip_start = 0, e.mapbox_clip_end = 1, delete e[n]),
9312
9312
  n;
@@ -9350,16 +9350,16 @@ class Co extends t.renderer.CanvasRenderer {
9350
9350
  draw(t, e) {
9351
9351
  this._t = t;
9352
9352
  const n = this.layer;
9353
- this.prepareCanvas(), this.Mt = this.St(this.getMap().getGLRes()), this.Tt = e || {};
9353
+ this.prepareCanvas(), this.St = this.Mt(this.getMap().getGLRes()), this.Tt = e || {};
9354
9354
  const i = this.Tt.renderMode, r = this.wo();
9355
- if (this.Pt(r, i), this.yo) this.buildMesh(), this._o(), this.Mo(), this.vo = {},
9356
- this.So = !1, this.yo = !1, this.To = !1; else if (this.So) {
9355
+ if (this.Pt(r, i), this.yo) this.buildMesh(), this._o(), this.So(), this.vo = {},
9356
+ this.Mo = !1, this.yo = !1, this.To = !1; else if (this.Mo) {
9357
9357
  const t = this.atlas, e = this.Po, n = this.ko;
9358
9358
  delete this.atlas, delete this.Po, delete this.ko, this.buildMesh(t), this._o(e),
9359
- this.Mo(n), this.So = !1, this.To = !1;
9359
+ this.So(n), this.Mo = !1, this.To = !1;
9360
9360
  } else if (this.To) {
9361
9361
  const t = this.ko;
9362
- delete this.ko, this.Mo(t), this.To = !1;
9362
+ delete this.ko, this.So(t), this.To = !1;
9363
9363
  }
9364
9364
  if (!this.meshes && !this.Io && !this.Oo) return void this.completeRender();
9365
9365
  this.Co && (this.Fo(), this.Co = !1), this.Eo();
@@ -9477,7 +9477,7 @@ class Co extends t.renderer.CanvasRenderer {
9477
9477
  const h = e.createGeometries([ t.data ], kt(o, null, 0, s, this.layer));
9478
9478
  for (let t = 0; t < h.length; t++) h[t] && this.$e(h[t].geometry);
9479
9479
  const u = r.identity([]);
9480
- r.translate(u, u, i.set([], l[0], l[1], 0)), r.scale(u, u, i.set([], 1, 1, this.Mt));
9480
+ r.translate(u, u, i.set([], l[0], l[1], 0)), r.scale(u, u, i.set([], 1, 1, this.St));
9481
9481
  const c = e.createMeshes(h, u, {
9482
9482
  tilePoint: [ l[0], l[1] ]
9483
9483
  });
@@ -9577,7 +9577,7 @@ class Co extends t.renderer.CanvasRenderer {
9577
9577
  const n = t[0] && t[0].data.iconAtlas, s = t[0] && t[0].data.glyphAtlas || t[1] && t[1].data.glyphAtlas;
9578
9578
  n && (this.Po.iconAtlas = n), s && (this.Po.glyphAtlas = s);
9579
9579
  const a = r.identity([]);
9580
- r.translate(a, a, i.set(f, o[0], o[1], 0)), r.scale(a, a, i.set(c, 1, 1, this.Mt));
9580
+ r.translate(a, a, i.set(f, o[0], o[1], 0)), r.scale(a, a, i.set(c, 1, 1, this.St));
9581
9581
  const l = this.bo.createMeshes(e, a);
9582
9582
  for (let t = 0; t < l.length; t++) l[t].geometry.properties.originElements = l[t].geometry.properties.elements.slice(),
9583
9583
  l[t].properties.level = 0, l[t].material.set("flipY", 1), l[t].properties.meshKey = To++;
@@ -9613,7 +9613,7 @@ class Co extends t.renderer.CanvasRenderer {
9613
9613
  markerHeightType: Uint16Array
9614
9614
  }, s = tt({}, r);
9615
9615
  r.allowEmptyPack = 1;
9616
- return S.splitPointSymbol(this.qo).map(((n, i) => new S(0 === i ? t : e, n, 0 === i ? r : s).load()));
9616
+ return M.splitPointSymbol(this.qo).map(((n, i) => new M(0 === i ? t : e, n, 0 === i ? r : s).load()));
9617
9617
  }
9618
9618
  updateMesh() {}
9619
9619
  Ko(t) {
@@ -9631,7 +9631,7 @@ class Co extends t.renderer.CanvasRenderer {
9631
9631
  for (let t = 0; t < r.length; t++) {
9632
9632
  if (!r[t]) continue;
9633
9633
  const i = Array.isArray(e) ? e[t] : e, s = Array.isArray(h) ? h[t] : h, o = Array.isArray(u) ? u[t] : u, a = new P(r, i, s, o, n).getIconAndGlyph();
9634
- if (!this.Po || !S.isAtlasLoaded(a, this.Po)) return this.Zo(), this.setToRedraw(),
9634
+ if (!this.Po || !M.isAtlasLoaded(a, this.Po)) return this.Zo(), this.setToRedraw(),
9635
9635
  !1;
9636
9636
  }
9637
9637
  for (let t = 0; t < r.length; t++) {
@@ -9714,7 +9714,7 @@ class Co extends t.renderer.CanvasRenderer {
9714
9714
  this.layer.fire("updatemesh"), this.setToRedraw();
9715
9715
  }
9716
9716
  }
9717
- Mo(t) {
9717
+ So(t) {
9718
9718
  if (!Object.keys(this.mo).length) return void (this.Oo && (this.Ao.deleteMesh(this.Oo),
9719
9719
  delete this.Oo));
9720
9720
  const {features: e, center: n} = this.Ro(this.mo);
@@ -9748,7 +9748,7 @@ class Co extends t.renderer.CanvasRenderer {
9748
9748
  return [ i, r, s ];
9749
9749
  }
9750
9750
  sa() {
9751
- this.So = !0, this.setToRedraw();
9751
+ this.Mo = !0, this.setToRedraw();
9752
9752
  }
9753
9753
  Zo() {
9754
9754
  this.yo = !0, this.setToRedraw();
@@ -9769,7 +9769,7 @@ class Co extends t.renderer.CanvasRenderer {
9769
9769
  Jo(t) {
9770
9770
  void 0 === t[wo] && (t[wo] = this.j++);
9771
9771
  const e = t[wo];
9772
- this.features[e] && this.aa(e), this.features[e] = Mo(t, this.xo, this.features[e]);
9772
+ this.features[e] && this.aa(e), this.features[e] = So(t, this.xo, this.features[e]);
9773
9773
  const n = this.features[e];
9774
9774
  return this.la(n, e), this.uo[e] = t, e;
9775
9775
  }
@@ -9918,7 +9918,7 @@ class Co extends t.renderer.CanvasRenderer {
9918
9918
  }
9919
9919
  onGeometryPropertiesChange(t) {
9920
9920
  const e = t.target._getParent() || t.target, n = e[wo];
9921
- void 0 !== n && (this.features[n] = Mo(e, this.xo), this.la(this.features[n], n),
9921
+ void 0 !== n && (this.features[n] = So(e, this.xo), this.la(this.features[n], n),
9922
9922
  this.Zo(), Fo(this));
9923
9923
  }
9924
9924
  createContext() {
@@ -10027,7 +10027,7 @@ class Co extends t.renderer.CanvasRenderer {
10027
10027
  isEnableWorkAround(t) {
10028
10028
  return "win-intel-gpu-crash" === t && (this.layer.options.workarounds["win-intel-gpu-crash"] && Eo(this.gl));
10029
10029
  }
10030
- St(t) {
10030
+ Mt(t) {
10031
10031
  return ht(t, this.getMap());
10032
10032
  }
10033
10033
  je() {
@@ -10390,13 +10390,13 @@ function ra(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p) {
10390
10390
  d || p || (d = Math.max(r[v], r[3 * s[c - 3] + 2]), p = Math.min(r[v], r[3 * s[c - 3] + 2]),
10391
10391
  f = d - p);
10392
10392
  let _ = m;
10393
- const M = c % 6;
10394
- 0 === t ? (5 === M && (y = na(r, s, c, b, A)), _ = M === g[0] || M === g[1] || M === g[2] ? m : m + y) : 1 === t && (M === g[0] || M === g[1] || M === g[2] ? _ = 0 : 5 === M ? (y = na(r, s, c, b, A),
10393
+ const S = c % 6;
10394
+ 0 === t ? (5 === S && (y = na(r, s, c, b, A)), _ = S === g[0] || S === g[1] || S === g[2] ? m : m + y) : 1 === t && (S === g[0] || S === g[1] || S === g[2] ? _ = 0 : 5 === S ? (y = na(r, s, c, b, A),
10395
10395
  _ = y) : _ = y);
10396
- const S = _ / h * (1 / (100 * u)) / a;
10396
+ const M = _ / h * (1 / (100 * u)) / a;
10397
10397
  let T;
10398
10398
  T = 1 === e ? w === d ? 1 : 0 : "bottom" === n ? w === d ? f / 100 / l : 0 : w === d ? 0 : -f / 100 / l,
10399
- i[2 * o] = S, i[2 * o + 1] = T, 0 === M && (m += y);
10399
+ i[2 * o] = M, i[2 * o + 1] = T, 0 === S && (m += y);
10400
10400
  }
10401
10401
  }(a, l, h, u, n, s, m, c[0], c[1], f, d, p);
10402
10402
  }
@@ -10413,7 +10413,7 @@ const oa = E.getInstance();
10413
10413
 
10414
10414
  function aa(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m) {
10415
10415
  void 0 === e.top && (e.top = !0), void 0 === e.side && (e.side = !0), oa.reset();
10416
- const {altitudeScale: y, altitudeProperty: g, defaultAltitude: b, heightProperty: A, minHeightProperty: w, defaultHeight: _, tangent: M, uv: S, topUVMode: T, sideUVMode: P, sideVerticalUVMode: k, top: I, side: O, textureYOrigin: C, topThickness: F} = e, R = !!m, j = function(t, e, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: s, minHeightProperty: o, defaultHeight: a}, {center: l, side: h, top: u, topThickness: c, uvOrigin: f, uv: d, uvSize: p, topUVMode: m, sideUVMode: y, sideVerticalUVMode: g, textureYOrigin: v, tileRatio: b, centimeterToPoint: A, verticalCentimeterToPoint: w, positionType: _, res: M, glScale: S, projectionCode: T}, P, k) {
10416
+ const {altitudeScale: y, altitudeProperty: g, defaultAltitude: b, heightProperty: A, minHeightProperty: w, defaultHeight: _, tangent: S, uv: M, topUVMode: T, sideUVMode: P, sideVerticalUVMode: k, top: I, side: O, textureYOrigin: C, topThickness: F} = e, R = !!m, j = function(t, e, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: s, minHeightProperty: o, defaultHeight: a}, {center: l, side: h, top: u, topThickness: c, uvOrigin: f, uv: d, uvSize: p, topUVMode: m, sideUVMode: y, sideVerticalUVMode: g, textureYOrigin: v, tileRatio: b, centimeterToPoint: A, verticalCentimeterToPoint: w, positionType: _, res: S, glScale: M, projectionCode: T}, P, k) {
10417
10417
  let I = e / t[0].extent;
10418
10418
  e === 1 / 0 && (I = 1);
10419
10419
  const O = e === 1 / 0, C = k.get(), F = k.get(), L = k.get(), z = k.getProxy(), R = k.get(), H = k.get(), N = k.get(), V = !!d, j = !!u, U = !!h, G = V ? k.get() : null;
@@ -10432,7 +10432,7 @@ function aa(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m) {
10432
10432
  }
10433
10433
  h = r.length, u = H.currentIndex;
10434
10434
  for (let t = 0; t < h; t++) H[u++] = r[t];
10435
- H.currentIndex = u, V && ta(m || 0, t, n, G, R, f, A, b, p[0], p[1], s, M, S, T, l),
10435
+ H.currentIndex = u, V && ta(m || 0, t, n, G, R, f, A, b, p[0], p[1], s, S, M, T, l),
10436
10436
  c > 0 && !U && (n = ia(R, z, i, H, n, G, 0, c, e, V, y || 0, g || 0, v, p, b, w, o)),
10437
10437
  N.setLength(n / 3), N.fill(1, a / 3, n / 3);
10438
10438
  }
@@ -10511,7 +10511,7 @@ function aa(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m) {
10511
10511
  top: I,
10512
10512
  side: O,
10513
10513
  topThickness: 10 * F || 0,
10514
- uv: S || M,
10514
+ uv: M || S,
10515
10515
  uvSize: [ r, r ],
10516
10516
  uvOrigin: i,
10517
10517
  topUVMode: T,
@@ -10529,7 +10529,7 @@ function aa(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m) {
10529
10529
  delete j.indices, U.push($.buffer, j.pickingIds.buffer);
10530
10530
  const q = p || x.getPosArrayType(Math.max(512, j.maxAltitude));
10531
10531
  j.vertices = E.createTypedArray(j.vertices, q);
10532
- const K = M ? oa.getProxy() : new Float32Array(3 * G);
10532
+ const K = S ? oa.getProxy() : new Float32Array(3 * G);
10533
10533
  K.setLength && K.setLength(3 * G);
10534
10534
  const J = Y(j.vertices, $, K);
10535
10535
  let Z = !0;
@@ -10539,7 +10539,7 @@ function aa(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m) {
10539
10539
  const e = J[t] % 1;
10540
10540
  1 - Math.abs(e) > 1e-6 ? Z = !1 : 0 !== e && (J[t] = Math.round(J[t]));
10541
10541
  }
10542
- if (j.normals = J, M) {
10542
+ if (j.normals = J, S) {
10543
10543
  let t = oa.get();
10544
10544
  t.setLength(4 * G), t = B(j.vertices, j.normals, j.uvs, $, t), t = function(t, e) {
10545
10545
  const n = e.getLength(), i = new Float32Array(n), r = [], s = [], o = [];
@@ -10738,50 +10738,50 @@ function ba(t) {
10738
10738
  return new Float64Array(t);
10739
10739
  }
10740
10740
 
10741
- const Aa = 33306690738754716e-32, wa = 22204460492503146e-32, _a = 11093356479670487e-47, Ma = ba(4), Sa = ba(8), Ta = ba(12), Pa = ba(16), ka = ba(4);
10741
+ const Aa = 33306690738754716e-32, wa = 22204460492503146e-32, _a = 11093356479670487e-47, Sa = ba(4), Ma = ba(8), Ta = ba(12), Pa = ba(16), ka = ba(4);
10742
10742
 
10743
10743
  function Ia(t, e, n, i, r, s) {
10744
10744
  const o = (e - s) * (n - r), a = (t - r) * (i - s), l = o - a;
10745
10745
  if (0 === o || 0 === a || o > 0 != a > 0) return l;
10746
10746
  const h = Math.abs(o + a);
10747
10747
  return Math.abs(l) >= Aa * h ? l : -function(t, e, n, i, r, s, o) {
10748
- let a, l, h, u, c, f, d, p, m, y, g, x, v, b, A, w, _, M;
10749
- const S = t - r, T = n - r, P = e - s, k = i - s;
10750
- b = S * k, f = ga * S, d = f - (f - S), p = S - d, f = ga * k, m = f - (f - k),
10748
+ let a, l, h, u, c, f, d, p, m, y, g, x, v, b, A, w, _, S;
10749
+ const M = t - r, T = n - r, P = e - s, k = i - s;
10750
+ b = M * k, f = ga * M, d = f - (f - M), p = M - d, f = ga * k, m = f - (f - k),
10751
10751
  y = k - m, A = p * y - (b - d * m - p * m - d * y), w = P * T, f = ga * P, d = f - (f - P),
10752
10752
  p = P - d, f = ga * T, m = f - (f - T), y = T - m, _ = p * y - (w - d * m - p * m - d * y),
10753
- g = A - _, c = A - g, Ma[0] = A - (g + c) + (c - _), x = b + g, c = x - b, v = b - (x - c) + (g - c),
10754
- g = v - w, c = v - g, Ma[1] = v - (g + c) + (c - w), M = x + g, c = M - x, Ma[2] = x - (M - c) + (g - c),
10755
- Ma[3] = M;
10753
+ g = A - _, c = A - g, Sa[0] = A - (g + c) + (c - _), x = b + g, c = x - b, v = b - (x - c) + (g - c),
10754
+ g = v - w, c = v - g, Sa[1] = v - (g + c) + (c - w), S = x + g, c = S - x, Sa[2] = x - (S - c) + (g - c),
10755
+ Sa[3] = S;
10756
10756
  let I = function(t, e) {
10757
10757
  let n = e[0];
10758
10758
  for (let i = 1; i < t; i++) n += e[i];
10759
10759
  return n;
10760
- }(4, Ma), O = wa * o;
10760
+ }(4, Sa), O = wa * o;
10761
10761
  if (I >= O || -I >= O) return I;
10762
- if (c = t - S, a = t - (S + c) + (c - r), c = n - T, h = n - (T + c) + (c - r),
10762
+ if (c = t - M, a = t - (M + c) + (c - r), c = n - T, h = n - (T + c) + (c - r),
10763
10763
  c = e - P, l = e - (P + c) + (c - s), c = i - k, u = i - (k + c) + (c - s), 0 === a && 0 === l && 0 === h && 0 === u) return I;
10764
- if (O = _a * o + xa * Math.abs(I), I += S * u + k * a - (P * h + T * l), I >= O || -I >= O) return I;
10764
+ if (O = _a * o + xa * Math.abs(I), I += M * u + k * a - (P * h + T * l), I >= O || -I >= O) return I;
10765
10765
  b = a * k, f = ga * a, d = f - (f - a), p = a - d, f = ga * k, m = f - (f - k),
10766
10766
  y = k - m, A = p * y - (b - d * m - p * m - d * y), w = l * T, f = ga * l, d = f - (f - l),
10767
10767
  p = l - d, f = ga * T, m = f - (f - T), y = T - m, _ = p * y - (w - d * m - p * m - d * y),
10768
10768
  g = A - _, c = A - g, ka[0] = A - (g + c) + (c - _), x = b + g, c = x - b, v = b - (x - c) + (g - c),
10769
- g = v - w, c = v - g, ka[1] = v - (g + c) + (c - w), M = x + g, c = M - x, ka[2] = x - (M - c) + (g - c),
10770
- ka[3] = M;
10771
- const C = va(4, Ma, 4, ka, Sa);
10772
- b = S * u, f = ga * S, d = f - (f - S), p = S - d, f = ga * u, m = f - (f - u),
10769
+ g = v - w, c = v - g, ka[1] = v - (g + c) + (c - w), S = x + g, c = S - x, ka[2] = x - (S - c) + (g - c),
10770
+ ka[3] = S;
10771
+ const C = va(4, Sa, 4, ka, Ma);
10772
+ b = M * u, f = ga * M, d = f - (f - M), p = M - d, f = ga * u, m = f - (f - u),
10773
10773
  y = u - m, A = p * y - (b - d * m - p * m - d * y), w = P * h, f = ga * P, d = f - (f - P),
10774
10774
  p = P - d, f = ga * h, m = f - (f - h), y = h - m, _ = p * y - (w - d * m - p * m - d * y),
10775
10775
  g = A - _, c = A - g, ka[0] = A - (g + c) + (c - _), x = b + g, c = x - b, v = b - (x - c) + (g - c),
10776
- g = v - w, c = v - g, ka[1] = v - (g + c) + (c - w), M = x + g, c = M - x, ka[2] = x - (M - c) + (g - c),
10777
- ka[3] = M;
10778
- const F = va(C, Sa, 4, ka, Ta);
10776
+ g = v - w, c = v - g, ka[1] = v - (g + c) + (c - w), S = x + g, c = S - x, ka[2] = x - (S - c) + (g - c),
10777
+ ka[3] = S;
10778
+ const F = va(C, Ma, 4, ka, Ta);
10779
10779
  b = a * u, f = ga * a, d = f - (f - a), p = a - d, f = ga * u, m = f - (f - u),
10780
10780
  y = u - m, A = p * y - (b - d * m - p * m - d * y), w = l * h, f = ga * l, d = f - (f - l),
10781
10781
  p = l - d, f = ga * h, m = f - (f - h), y = h - m, _ = p * y - (w - d * m - p * m - d * y),
10782
10782
  g = A - _, c = A - g, ka[0] = A - (g + c) + (c - _), x = b + g, c = x - b, v = b - (x - c) + (g - c),
10783
- g = v - w, c = v - g, ka[1] = v - (g + c) + (c - w), M = x + g, c = M - x, ka[2] = x - (M - c) + (g - c),
10784
- ka[3] = M;
10783
+ g = v - w, c = v - g, ka[1] = v - (g + c) + (c - w), S = x + g, c = S - x, ka[2] = x - (S - c) + (g - c),
10784
+ ka[3] = S;
10785
10785
  const E = va(F, Ta, 4, ka, Pa);
10786
10786
  return Pa[E - 1];
10787
10787
  }(t, e, n, i, r, s, h);
@@ -10930,12 +10930,12 @@ function Va(t, e, n) {
10930
10930
  }
10931
10931
 
10932
10932
  function ja(t, e, n, i, r, s, o, a) {
10933
- var l, h, u, c, f = n - t, d = i - e, p = o - r, m = a - s, y = t - r, g = e - s, x = f * f + d * d, v = f * p + d * m, b = p * p + m * m, A = f * y + d * g, w = p * y + m * g, _ = x * b - v * v, M = _, S = _;
10934
- 0 === _ ? (h = 0, M = 1, c = w, S = b) : (c = x * w - v * A, (h = v * w - b * A) < 0 ? (h = 0,
10935
- c = w, S = b) : h > M && (h = M, c = w + v, S = b)), c < 0 ? (c = 0, -A < 0 ? h = 0 : -A > x ? h = M : (h = -A,
10936
- M = x)) : c > S && (c = S, -A + v < 0 ? h = 0 : -A + v > x ? h = M : (h = -A + v,
10937
- M = x));
10938
- var T = (1 - (u = 0 === c ? 0 : c / S)) * r + u * o - ((1 - (l = 0 === h ? 0 : h / M)) * t + l * n), P = (1 - u) * s + u * a - ((1 - l) * e + l * i);
10933
+ var l, h, u, c, f = n - t, d = i - e, p = o - r, m = a - s, y = t - r, g = e - s, x = f * f + d * d, v = f * p + d * m, b = p * p + m * m, A = f * y + d * g, w = p * y + m * g, _ = x * b - v * v, S = _, M = _;
10934
+ 0 === _ ? (h = 0, S = 1, c = w, M = b) : (c = x * w - v * A, (h = v * w - b * A) < 0 ? (h = 0,
10935
+ c = w, M = b) : h > S && (h = S, c = w + v, M = b)), c < 0 ? (c = 0, -A < 0 ? h = 0 : -A > x ? h = S : (h = -A,
10936
+ S = x)) : c > M && (c = M, -A + v < 0 ? h = 0 : -A + v > x ? h = S : (h = -A + v,
10937
+ S = x));
10938
+ var T = (1 - (u = 0 === c ? 0 : c / M)) * r + u * o - ((1 - (l = 0 === h ? 0 : h / S)) * t + l * n), P = (1 - u) * s + u * a - ((1 - l) * e + l * i);
10939
10939
  return T * T + P * P;
10940
10940
  }
10941
10941
 
@@ -11195,7 +11195,7 @@ $a.registerRenderer("gl", class extends Xo {
11195
11195
  createMesh(t, e, n, i, r, s) {
11196
11196
  const o = [];
11197
11197
  this._a = s;
11198
- const a = this.Ma(i, n, !0, !1), l = this.Ma(i, n, !1, !0);
11198
+ const a = this.Sa(i, n, !0, !1), l = this.Sa(i, n, !1, !0);
11199
11199
  if (a) {
11200
11200
  const r = this.No(a, t, e, n, i, null, s);
11201
11201
  r.meshes[0].properties.top = 1, o.push(r);
@@ -11206,23 +11206,23 @@ $a.registerRenderer("gl", class extends Xo {
11206
11206
  }
11207
11207
  return o;
11208
11208
  }
11209
- Ma(e, n, i, r) {
11209
+ Sa(e, n, i, r) {
11210
11210
  const s = this.getMap();
11211
11211
  n = qa;
11212
11212
  const o = this._a, a = 1 / 0, l = s.getZoom(), h = new t.Point(0, 0), u = new t.Coordinate(0, 0), c = tt({}, Ka, this.layer.options.dataConfig);
11213
11213
  if (c.uv = !0, c.top && (c.top = i), c.side && (c.side = r), !1 === c.top && !1 === c.side) return null;
11214
11214
  if (!e.length) return null;
11215
- const f = s.getGLRes(), d = s.getProjection().code, p = i ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, m = p && p.textureWidth || M, y = [ Kt(s, 1, u, f) / 100, Kt(s, 1, u, f, 1) / 100 ];
11216
- return aa(e, c, a, h, m, s.getGLRes(), 1, 1, y, this.Mt, n, l, d, undefined, Float32Array, o);
11215
+ const f = s.getGLRes(), d = s.getProjection().code, p = i ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, m = p && p.textureWidth || S, y = [ Kt(s, 1, u, f) / 100, Kt(s, 1, u, f, 1) / 100 ];
11216
+ return aa(e, c, a, h, m, s.getGLRes(), 1, 1, y, this.St, n, l, d, undefined, Float32Array, o);
11217
11217
  }
11218
11218
  updateMesh(t) {
11219
11219
  const e = t[wo];
11220
11220
  let n = this.features[e];
11221
11221
  if (!n || !this.meshes) return;
11222
- const i = this.Ma([ n ], this.painterSymbol, !0, !1);
11222
+ const i = this.Sa([ n ], this.painterSymbol, !0, !1);
11223
11223
  let r = 0;
11224
11224
  i && i.data && this.ia(this.meshes[r++], n.id, i);
11225
- const s = this.Ma([ n ], this.painterSymbol, !1, !0);
11225
+ const s = this.Sa([ n ], this.painterSymbol, !1, !0);
11226
11226
  s && s.data && this.ia(this.meshes[r++], n.id, s);
11227
11227
  }
11228
11228
  Jo(e) {
@@ -11269,5 +11269,5 @@ if (e.mat4.create(), e.transcoders) {
11269
11269
 
11270
11270
  export { $a as ExtrudePolygonLayer, On as FillPainter, Js as FillPlugin, ao as GLTFPhongPlugin, lo as GLTFStandardPlugin, po as GeoJSONVectorTileLayer, ho as HeatmapPlugin, pr as IconPainter, to as IconPlugin, Qs as LineGradientPlugin, Dn as LinePainter, Zs as LinePlugin, Go as LineStringLayer, so as LitPlugin, co as MapboxVectorTileLayer, as as NativeLinePainter, no as NativeLinePlugin, rs as NativePointPainter, bs as PhongPainter, io as PhongPlugin, Uo as PointLayer, Yo as PolygonLayer, Qr as TextPainter, eo as TextPlugin, oo as TubePlugin, we as Vector3DLayer, pe as VectorTileLayer, ie as VectorTileLayerRenderer, uo as WaterPlugin, ws as WireframePainter, ro as WireframePlugin };
11271
11271
 
11272
- "undefined" != typeof console && console.log("@maptalks/vt v0.96.0");
11272
+ "undefined" != typeof console && console.log("@maptalks/vt v0.96.2");
11273
11273
  //# sourceMappingURL=maptalks.vt.es.js.map